Bläddra i källkod

feat:获取微信code,兼容微信浏览器标题,微信浏览器判断

zhanghui 2 år sedan
förälder
incheckning
1efbc2726b

+ 16 - 0
App.vue

@@ -6,6 +6,22 @@
 <script>
 	export default {
 		onLaunch: function() {
+            var ua = window.navigator.userAgent.toLowerCase();
+
+            console.log('+++++++浏览器++++++',ua)
+            // if(ua.match(/windowswechat/i)=="windowswechat") {
+            //     console.log('这windos的微信浏览器');
+            // } else {
+            //     console.log('这不是微信浏览器');
+            // }
+            if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+                console.log('这是微信浏览器');
+            }else {
+                uni.showModal({
+                    title:'温馨提示',
+                    content:'请在手机端微信浏览器打开该网站',
+                })
+            }
 			console.log('App Launch')
 		},
 		onShow: function() {

+ 10 - 0
common/js/service.js

@@ -3,6 +3,16 @@ import request from '../js/request.js';
 
 export default {
 
+
+    idCardAndName(data) {
+        return request({
+            url: '/resource/authentication/idCardAndName',
+            method: 'GET',
+            data:data
+
+        })
+    },
+
     getMyMemberList(data) {
         return request({
             url: '/member/wechat/getMyMemberList',

+ 4 - 2
main.js

@@ -7,8 +7,8 @@ import './uni.promisify.adaptor'
 import uView from "uview-ui";
 // #ifdef H5
 // 提交前需要注释  本地调试使用 使用vconsole
-// const vconsole = require('vconsole')
-// Vue.prototype.$vconsole = new vconsole()
+const vconsole = require('vconsole')
+Vue.prototype.$vconsole = new vconsole()
 // #endif
 import api from './common/js/api'
 import env from './common/js/env.js';
@@ -20,6 +20,8 @@ Vue.prototype.$baseUrl = env.baseUrl;
 Vue.prototype.$xcxUrl = 'https://jje.xinyuekj.com.cn/spread/spread';
 //拓客端地址
 Vue.prototype.$tkUrl = 'http://tk.gzzzyd.com/#/pages/register/register';
+//微信授权回调地址
+Vue.prototype.$callbackUrl = 'http://tk.gzzzyd.com';
 Vue.prototype.$api = api;
 Vue.use(uView);
 Vue.config.productionTip = false

+ 21 - 20
pages.json

@@ -8,14 +8,14 @@
 		{
 			"path": "pages/login/login",
 			"style": {
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "登录",
 				"enablePullDownRefresh": false
 			}
 		},
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "首页",
 				"enablePullDownRefresh": false
 			}
 		},
@@ -23,14 +23,14 @@
 			"path" : "pages/my/my",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "个人中心",
 				"enablePullDownRefresh" : false
 			}
 		},		{
 			"path" : "pages/userInfo/userInfo",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "个人信息",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -38,7 +38,7 @@
 			"path" : "pages/forgetPassword/forgetPassword",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "找回密码",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -46,7 +46,7 @@
 			"path" : "pages/updatePassword/updatePassword",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "修改登录密码",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -55,7 +55,7 @@
 			"path" : "pages/register/register",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "注册",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -63,7 +63,7 @@
 			"path" : "pages/specialistsList/specialistsList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "我的专员",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -71,7 +71,7 @@
 			"path" : "pages/earningsList/earningsList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "我的收益",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -79,7 +79,7 @@
 			"path" : "pages/todayEarningsList/todayEarningsList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "今日收益",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -87,7 +87,7 @@
 			"path" : "pages/todayPromotionList/todayPromotionList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "今日推广",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -95,7 +95,7 @@
 			"path" : "pages/directPromotionList/directPromotionList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "我的直推",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -103,7 +103,7 @@
 			"path" : "pages/indirectPromotionList/indirectPromotionList",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "我的间推",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -111,7 +111,7 @@
 			"path" : "pages/myGroup/myGroup",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "我的分组",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -119,7 +119,7 @@
 			"path" : "pages/cooperation/cooperation",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "合作伙伴",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -127,7 +127,7 @@
 			"path" : "pages/addGroup/addGroup",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "新增分组",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -135,7 +135,7 @@
 			"path" : "pages/purchaseCoupon/purchaseCoupon",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "购买优惠券",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -143,8 +143,8 @@
 			"path" : "pages/groupDetail/groupDetail",
 			"style" :
 			{
-				"navigationStyle": "custom",
-//				"navigationBarTitleText" : "",
+
+				"navigationBarTitleText" : "分组详情",
 				"enablePullDownRefresh" : false
 			}
 		},
@@ -152,7 +152,7 @@
 			"path" : "pages/updateGroup/updateGroup",
 			"style" :
 			{
-				"navigationStyle": "custom",
+				"navigationBarTitleText" : "修改分组",
 				"enablePullDownRefresh" : false
 			}
 		}
@@ -175,6 +175,7 @@
 		}]
 	},
 	"globalStyle": {
+		"navigationStyle": "custom",
 		"navigationBarTextStyle": "black",
 		//		"navigationBarTitleText": "加载中",
 		"navigationBarBackgroundColor": "#FFE05C",

+ 0 - 3
pages/addGroup/addGroup.vue

@@ -1,9 +1,6 @@
 <template>
 	<view class="page">
-		<uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left"
-			title="新增分组" @clickLeft="back" />
 		<view>
-
 				<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
 
 					<u-form-item prop="name" borderBottom>

+ 0 - 1
pages/cooperation/cooperation.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="合作伙伴" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
 			</mescroll-item>

+ 0 - 1
pages/directPromotionList/directPromotionList.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的直推" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
 			</mescroll-item>

+ 0 - 1
pages/earningsList/earningsList.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的收益" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
 			</mescroll-item>

+ 0 - 1
pages/forgetPassword/forgetPassword.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="找回密码" @clickLeft="back" />
 		<view :style="{'marginTop':'10rpx'}">
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
 

+ 0 - 2
pages/groupDetail/groupDetail.vue

@@ -1,7 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left"
-					 title="分组详情" @clickLeft="back" />
 		<view>
 
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">

+ 0 - 1
pages/index/index.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"   title="首页"  />
 		<manager :height="height" v-if="userInfo.isManager === 1"></manager>
 		<attach :height="height" v-if="userInfo.isManager === 0 && userInfo.roleTag == '0'"></attach>
 		<view  v-if="userInfo.isManager === 0 && userInfo.roleTag == '1'">

+ 0 - 1
pages/indirectPromotionList/indirectPromotionList.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的间推" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
 						  :up="upOption" @up="upCallback" @emptyclick="emptyClick">

+ 29 - 1
pages/login/login.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  title="登录" />
 		<view class="logTitle">
 <!--			<view class="welcome">-->
 <!--				<text>HI,您好!</text>-->
@@ -43,6 +42,10 @@
 					<text>登录</text>
 				</view>
 
+				<view class="loginButton" @click="getWxCosde">
+					<text>获取微信code</text>
+				</view>
+
 			</u--form>
 
 		</view>
@@ -91,7 +94,32 @@
 			this.form.password = uni.getStorageSync('password')
 			this.savePassword = uni.getStorageSync('savePassword')
 		},
+		onLoad(e){
+			console.log('重定向获取到的参数',e)
+			console.log('重定向的url',location.href)
+			let code = this.getUrlCode('code')
+			if (code){
+				uni.showToast({
+					icon: 'success',
+					duration: 5000,
+					title: '获取到的code:'+code
+				});
+			}
+
+		},
 		methods: {
+			getUrlCode(name) {
+		     	return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) ||[, ''])[1].replace(/\+/g, '%20')) || null
+			},
+
+			getWxCosde(){
+
+				const callBack = this.$callbackUrl; //回调地址 就是完整地址登录页
+
+
+				let wx_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx54f2b294ce5acbe7&redirect_uri='+encodeURIComponent(callBack)+'&response_type=code&scope=snsapi_base#wechat_redirect'
+				window.location.href = wx_url;
+			},
 
 			goRegister(){
 				uni.redirectTo({

+ 0 - 1
pages/myGroup/myGroup.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的分组" @clickLeft="back" />
 		<view>
 			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
 			</mescroll-item>

+ 0 - 1
pages/purchaseCoupon/purchaseCoupon.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left" title="购买优惠券" @clickLeft="back" />
 		<view class="flex-row coupon" v-for="i in 10">
 			<view class="flex-col couponLeft">
 				<text class="discounts">¥50</text>

+ 43 - 17
pages/register/register.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  title="注册"  />
 		<view :style="{'marginTop':'10rpx'}">
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
 				<u-form-item :labelWidth="80" label="头像:" borderBottom prop="img" ref="item1">
@@ -104,22 +103,40 @@
 						message: '请上传头像',
 						trigger: ['blur', 'change']
 					},
-					'name': {
-						type: 'string',
-						required: true,
-						min:2,
-						message: '请输入姓名',
-						trigger: ['blur', 'change']
-					},
-					'idCard': {
-						type: 'string',
-						required: true,
-						min:18,
-						max: 18,
-						pattern:this.$idCardPattern,
-						message: '请输入身份证号',
-						trigger: ['blur', 'change']
-					},
+					'name':[
+						{
+							type: 'string',
+							required: true,
+							min:2,
+							message: '请输入姓名',
+							trigger: ['blur']
+						}
+					] ,
+					'idCard': [
+						{
+							type: 'string',
+							required: true,
+							min:18,
+							max: 18,
+							pattern:this.$idCardPattern,
+							message: '请输入身份证号',
+							trigger: ['blur']
+						},
+						{
+							asyncValidator: async (a,b,callback) => {
+								this.$refs.uForm.validateField('name');
+								let res = await this.idCardAndName()
+								if(res.data.data.respCode !== '0000') {
+									callback(new Error(res.data.data.respMessage));
+								} else {
+									// 如果校验通过,也要执行callback()回调
+									callback();
+								}
+							},
+							// 触发器可以同时用blur和change
+							trigger: ['blur']
+						}
+					],
 					'phone': {
 						type: 'string',
 						required: true,
@@ -167,6 +184,15 @@
 			}
 		},
 		methods: {
+			idCardAndName(){
+				return this.$api.service.idCardAndName({
+					name:this.form.name,
+					idCard:this.form.idCard,
+				}).then(res=>{
+					return res
+				})
+			},
+
 			gologin(){
 				uni.redirectTo({
 					url:'/pages/login/login'

+ 0 - 1
pages/specialistsList/specialistsList.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的专员" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
 			</mescroll-item>

+ 0 - 1
pages/todayEarningsList/todayEarningsList.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="今日收益" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
 			<mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
 						  :up="upOption" @up="upCallback" @emptyclick="emptyClick">

+ 0 - 3
pages/todayPromotionList/todayPromotionList.vue

@@ -1,8 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="今日推广" @clickLeft="back" />
-
-
 		<view :style="{height:height}" class="list">
 			<mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
 						  :up="upOption" @up="upCallback" @emptyclick="emptyClick">

+ 0 - 2
pages/updateGroup/updateGroup.vue

@@ -1,7 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left"
-					 title="修改分组" @clickLeft="back" />
 		<view>
 
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">

+ 0 - 1
pages/updatePassword/updatePassword.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="修改登录密码" @clickLeft="back" />
 		<view :style="{'marginTop':'10rpx'}">
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
 

+ 0 - 1
pages/userInfo/userInfo.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="page">
-		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="个人信息" @clickLeft="back" />
 
 		<view class="outView">
 			<form @submit="inputValue">