zhanghui 2 年 前
コミット
d4e853718b

+ 26 - 24
App.vue

@@ -6,30 +6,32 @@
 	export default {
 		onLaunch: function() {
             let that = this;
-            // wx.login({
-            //     success(re) {
-            //         that.$api.wxAuthLogin({code:re.code}).then(res=>{
-            //             uni.setStorageSync('userInfo',res.data.data.userInfo)
-            //             uni.setStorageSync('accessToken',res.data.data.access_token)
-            //             uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)
-            //
-            //             if (res.data.data.phoneIsBind){
-            //                 uni.switchTab({
-            //                     url: '/pages/index/index',
-            //                 })
-            //                 // uni.navigateTo({
-            //                 //     url: '/loginPages/bindAccount/index',
-            //                 // })
-            //             }else {
-            //                 uni.navigateTo({
-            //                     url: '/pages/login/login',
-            //                 })
-            //             }
-            //
-            //         })
-            //
-            //     },
-            // })
+            wx.login({
+                success(re) {
+                    that.$api.wxLogin({code:re.code}).then(res=>{
+                        uni.setStorageSync('userInfo',res.data.data.userInfo)
+                        uni.setStorageSync('accessToken',res.data.data.access_token)
+                        uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)
+
+                        uni.removeStorageSync('parent_member_id');
+                        if (!res.data.data.phoneIsBind){
+                            uni.showModal({
+                                title:'绑定手机号',
+                                content:'请绑定手机号,以便为你提供服务',
+                                success:res=>{
+                                    if (res.confirm){
+                                        uni.navigateTo({
+                                            url: '/myPages/setting/setting-telphone',
+                                        })
+                                    }
+                                }
+                            })
+                        }
+
+                    })
+
+                },
+            })
 			console.log('App Launch')
 		},
 		onShow: function() {

+ 22 - 1
common/js/api.js

@@ -3,7 +3,16 @@ import request from '../js/request.js';
 
 export default {
 
-    //post请求  我的权益卡列表
+
+    //绑定用户的推荐人
+    updateMemberMsg(data) {
+        return request({
+            url: '/member/memberBind/updateMemberMsg',
+            method: 'GET'
+        })
+    },
+
+    //我的权益卡列表
     myEquityCardList() {
         return request({
             url: '/member/wechat/getMyEquityCard',
@@ -708,9 +717,21 @@ export default {
 
     },
 
+
     /**
      * 微信静默登录
      */
+    wxLogin(data) {
+        return request({
+            url: '/auth/wxLogin',
+            method: 'POST',
+            data: data
+        })
+    },
+
+    /**
+     * 微信静默登录 原来的
+     */
     wxAuthLogin(data) {
         return request({
             url: '/auth/xcxLogin',

+ 2 - 2
loginPages/login/retrieve-account.vue

@@ -167,7 +167,7 @@ export default {
 		validateSmsCode(){
 			let that = this;
 			// 验证电话号码是否存在
-			validateSmsCode(null,{data:this.userInfo}).then((res)=>{
+			this.$api.validateSmsCode(this.userInfo).then((res)=>{
 				console.log(res)
 				if(res.phoneIsExist){ // 正确
 					that.errShow = true;
@@ -214,7 +214,7 @@ export default {
 			uni.showLoading({
 				title: '正在获取验证码'
 			})
-			getSmsCode({data:{phonenumber:this.userInfo.phonenumber,auth: true}}).then((res)=>{
+			this.$api.getSmsCode({phonenumber:this.userInfo.phonenumber,auth: true}).then((res)=>{
 				uni.hideLoading();
 				// 这里此提示会被this.start()方法中的提示覆盖
 				uni.$u.toast('验证码已发送');

+ 1 - 1
orderPages/bookService/index.vue

@@ -17,7 +17,7 @@
                 </view>
                 <picker  @change="bindPickerChange" mode='selector'  range-key="typeName" :value="storeServiceIndex" :range="storeServiceList">
                     <view class="flex-row justify-between groupItemContent">
-                        <text  v>{{storeServiceList[storeServiceIndex].typeName || '请选择服务类别' }}</text>
+                        <text>{{storeServiceList[storeServiceIndex].typeName || '请选择服务类别' }}</text>
                         <u-icon name="arrow-right" color="#666" size="18"></u-icon>
                     </view>
                 </picker>

+ 0 - 1
orderPages/serviceObject/index.vue

@@ -12,7 +12,6 @@
                 </view>
                 <view class="h-desc">
                     <text>关系:{{item.blood}}</text>
-                    <text>权益券</text>
                 </view>
                 <view class="h-content">
                     <view class="h-text">

+ 8 - 7
pages.json

@@ -3,13 +3,7 @@
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
 	"pages": [
-		{
-			"path": "pages/login/login",
-			"style": {
-				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
-			}
-		},
+
 		{
 			"path": "pages/index/index",
 			"style": {
@@ -44,6 +38,13 @@
 				"navigationStyle": "custom",
 				"enablePullDownRefresh": false
 			}
+		},
+		{
+			"path": "pages/login/login",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
 		}
 	],
 	"subPackages": [

+ 13 - 1
pages/index/index.vue

@@ -268,7 +268,10 @@ export default {
     })
 
     if (e.scene){
-      this.scanCode(e.scene)
+      setTimeout(()=>{
+        let userInfo = uni.getStorageSync('userInfo');
+        this.updateMemberMsg(userInfo.otherId,e.scene);
+      },2000)
     }
 
     // 获取经纬度信息
@@ -298,6 +301,15 @@ export default {
   },
   methods: {
 
+    updateMemberMsg(otherId,reference){
+        this.$api.updateMemberMsg({
+          openId:otherId,
+          reference:this.reference
+        }).then(res=>{
+          console.log('用户绑定成功')
+        })
+    },
+
     scanCode(memberId){
       setTimeout(res=>{
         this.$api.scanCode({

+ 125 - 89
pages/login/login.vue

@@ -15,76 +15,78 @@
             </button> -->
 
 			<button class="login-btn" @click="wechatCodeLogin()">
-				<u-icon name="weixin-fill" color="green" size="26"></u-icon>
-				授权微信登录
+				<!--				<u-icon name="weixin-fill" color="green" size="26"></u-icon>-->
+				快捷登录
 			</button>
 
+			<!--			<view class="login-form">-->
+			<!--				<view class="remember-acconut">-->
+			<!--					<view class="remember-acconut-password">-->
+			<!--						<u-radio-group-->
+			<!--								v-model="radiovalue1"-->
+			<!--								placement="column"-->
+			<!--								@change="groupChange"-->
+			<!--						>-->
+			<!--							<u-radio-->
+			<!--									:customStyle="{marginBottom: '8px'}"-->
+			<!--									v-for="(item, index) in radiolist1"-->
+			<!--									:key="index"-->
+			<!--									:label="item.name"-->
+			<!--									:name="item.name"-->
+			<!--									@change="radioChange"-->
+			<!--							>-->
+			<!--							</u-radio>-->
+			<!--						</u-radio-group>-->
+			<!--					</view>-->
+			<!--					<view @click="gotoRetieveAccount()" class="forget-acconut-password">-->
+			<!--						找回账号-->
+			<!--					</view>-->
+			<!--				</view>-->
+			<!--			</view>-->
 
 			<view class="login-form">
-				<view class="remember-acconut">
-					<view class="remember-acconut-password">
-						<u-radio-group
-								v-model="radiovalue1"
-								placement="column"
-								@change="groupChange"
-						>
-							<u-radio
-									:customStyle="{marginBottom: '8px'}"
-									v-for="(item, index) in radiolist1"
-									:key="index"
-									:label="item.name"
-									:name="item.name"
-									@change="radioChange"
-							>
-							</u-radio>
-						</u-radio-group>
-					</view>
-					<view @click="gotoRetieveAccount()" class="forget-acconut-password">
-						找回账号
-					</view>
-				</view>
-			</view>
-
-			<view class="login-form">
-        <text style="color: red;font-size: 22rpx  ">*此账号密码可进行交易使用,请保存好您的隐私。</text>
+				<!--        <text style="color: red;font-size: 22rpx  ">*此账号密码可进行交易使用,请保存好您的隐私。</text>-->
 				<view class="agreement-content">
-          <u-icon name="checkmark-circle-fill" color="#2979ff" size="20"></u-icon>
+					<u-icon v-if="choose" name="checkmark-circle-fill" color="#2979ff" size="20" @click="changeChoose"></u-icon>
+					<u-icon v-else name="/static/order/ud9.png" color="green" size="20" @click="changeChoose"></u-icon>
 					<view class="agreement">
 						<text>允许我们在必要的场景下合理使用你的相关信息,请阅读并同意协议</text>
 						<text @click="gotoAgreement('1','会员协议')" class="text-color">《会员协议》、</text>
 						<text @click="gotoAgreement('2','服务对象协议')" class="text-color">《服务对象协议》、</text>
-						<text @click="gotoAgreement('3','服务对象协议')" class="text-color">《服务对象协议》</text>等内容
 					</view>
 				</view>
 			</view>
 
 
-			<!-- 判断微信是否绑定账号 -->
-			<u-popup :show="show" :round="10"  mode="center" >
-				<view class="h-popo-content">
-					<view class="h-img">
-						<u-icon name="/static/login/u01.png" color="red" size="60"></u-icon>
-					</view>
-					<view class="text">
-						<text>该微信未绑定账号</text>
+		</view>
+
+
+		<!-- 判断微信是否绑定账号 -->
+		<u-popup :show="show" :round="10" mode="center">
+			<view class="h-popo-content">
+				<view class="h-img">
+					<u-icon name="/static/login/u01.png" color="red" size="60"></u-icon>
+				</view>
+				<view class="text">
+					<text>该微信未绑定账号</text>
+				</view>
+				<view class="h-btn-wrap">
+					<view @click="cancelOption" class="h-left-btn">
+						<text>取消</text>
 					</view>
-					<view class="h-btn-wrap">
-						<view @click="cancelOption" class="h-left-btn">
-							<text>取消</text>
-						</view>
-						<view @click="gotoBindAccount" class="h-right-btn">
-							<text>去绑定</text>
-						</view>
+					<view @click="gotoBindAccount" class="h-right-btn">
+						<text>去绑定</text>
 					</view>
 				</view>
-			</u-popup>
-		</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 <script>
 	export default {
 		data() {
 			return {
+				choose:true,
 				show: false,
 				userInfo: {
 					username: 'uview-plus UI',
@@ -109,48 +111,62 @@
 			// this.wechatCodeLogin();
 		},
 		methods: {
+
+			changeChoose(){
+				this.choose =!this.choose
+			},
 			// 去协议页面
-			gotoAgreement(type,name){
+			gotoAgreement(type, name) {
 				uni.navigateTo({
-					url: '/myPages/TermsOfService/index?name='+name + '&type=' + type,
+					url: '/myPages/TermsOfService/index?name=' + name + '&type=' + type,
 				})
 			},
 			// 取消操作
-			cancelOption(){
+			cancelOption() {
 				this.show = false;
 			},
 			// 去绑定账号
-			gotoBindAccount(){
+			gotoBindAccount() {
 				this.show = false;
 				uni.navigateTo({
 					url: '/loginPages/login/bind-account',
 				})
 			},
 			// 自动登录不成功,用户手动授权登录
-			authWechatCodeLogin(){
-				if(this.userInfo == undefined){
+			authWechatCodeLogin() {
+				if (this.userInfo == undefined) {
 					this.show = true;
 				}
 			},
 			// 微信小程序code自动登录
-			wechatCodeLogin(){
+			wechatCodeLogin() {
 				let that = this;
-
+				if (!this.choose){
+					uni.showToast({
+						icon:'error',
+						title: '请勾选相关协议'
+					})
+				}
 				wx.login({
 					success(re) {
-						that.$api.wxAuthLogin({code:re.code}).then(res=>{
-							that.userInfo = res.data.data.userInfo
-							uni.setStorageSync('userInfoOpenId',res.data.data.openId)
+						that.$api.wxLogin({code:re.code}).then(res=>{
 							uni.setStorageSync('userInfo',res.data.data.userInfo)
 							uni.setStorageSync('accessToken',res.data.data.access_token)
 							uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)
 
-							if (res.data.data.phoneIsBind){
-								uni.switchTab({
-									url: '/pages/index/index',
+							uni.removeStorageSync('parent_member_id');
+							if (!res.data.data.phoneIsBind){
+								uni.showModal({
+									title:'绑定手机号',
+									content:'请绑定手机号,以便为你提供服务',
+									success:res=>{
+										if (res.confirm){
+											uni.navigateTo({
+												url: '/myPages/setting/setting-telphone',
+											})
+										}
+									}
 								})
-							}else {
-								that.show = true
 							}
 
 						})
@@ -158,16 +174,16 @@
 					},
 				})
 			},
-			getPhoneNumber (e) {
+			getPhoneNumber(e) {
 				uni.showToast({
 					title: e.detail.code
 				})
-				console.log(e.detail.code)  // 动态令牌
+				console.log(e.detail.code) // 动态令牌
 				console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
-				console.log(e.detail.errno)  // 错误码(失败时返回)
+				console.log(e.detail.errno) // 错误码(失败时返回)
 			},
 			// 去找回账号页面
-			gotoRetieveAccount(){
+			gotoRetieveAccount() {
 				uni.navigateTo({
 					url: '/loginPages/login/retrieve-account',
 				})
@@ -184,14 +200,17 @@
 	};
 </script>
 <style lang="scss">
-	page,body{
+	page,
+	body {
 		background: #fff;
 	}
-	.container{
+
+	.container {
 		width: 90%;
 		margin: 0 auto;
 		font-family: PingFangSC-Semibold, PingFang SC;
-		.title{
+
+		.title {
 			margin-top: 12px;
 			width: 140px;
 			font-size: 24px;
@@ -199,19 +218,23 @@
 			color: #333333;
 			line-height: 38px;
 		}
-		.h-logo{
+
+		.h-logo {
 			text-align: center;
-			.logo-img{
+
+			.logo-img {
 				width: 160px;
 				height: 122px;
 			}
 		}
+
 		.login-wrap {
-			.account{
+			.account {
 				display: flex;
 			}
 		}
-		.login-btn{
+
+		.login-btn {
 			text-align: center;
 			color: #333;
 			width: 70%;
@@ -225,76 +248,88 @@
 			border-radius: 21px;
 			font-size: 14px;
 			display: flex;
-			.wechat-logo{
+
+			.wechat-logo {
 				height: 12px;
 				width: 12px;
 			}
 		}
-		.identifying-code{
-			image{
+
+		.identifying-code {
+			image {
 				width: 80px;
 				height: 30px;
 			}
 		}
-		.remember-acconut{
+
+		.remember-acconut {
 			margin-top: 18px;
 			display: flex;
 			justify-content: space-between;
 			color: #999999;
-			.forget-acconut-password{
+
+			.forget-acconut-password {
 				color: rgb(96, 98, 102);
 				font-size: 15px;
 				line-height: 25px;
 				margin-left: 30%;
 			}
 		}
-		.agreement-content{
+
+		.agreement-content {
 			margin-top: 18px;
 			display: flex;
 			// justify-content: space-between;
 			color: #999999;
 			align-items: center;
-			.agreement{
+
+			.agreement {
 				color: rgb(96, 98, 102);
 				padding-left: 1px;
 				font-size: 23rpx;
-				.text-color{
+
+				.text-color {
 					color: blue;
 				}
 			}
 		}
 	}
 
-	.h-popo-content{
+	.h-popo-content {
 		height: 180px;
 		padding: 12px;
 		width: 300px;
 		text-align: center;
 		font-size: 14px;
 		font-family: PingFangSC-Semibold, PingFang SC;
-		.h-img{
+
+		.h-img {
 			padding: 7px;
 			display: flex;
 			justify-content: center;
 
 		}
-		.h-text{
+
+		.h-text {
 			margin-top: 12px;
 			font-weight: 400;
 			color: #666666;
 		}
-		.text{
+
+		.text {
 			margin-top: 6px;
 			font-weight: 400;
 			color: #666666;
 		}
-		.h-btn-wrap{
+
+		.h-btn-wrap {
 			display: flex;
 			justify-content: space-between;
 			color: #333333;
 			text-align: center;
 			margin-top: 14px;
-			.h-left-btn{
+
+			.h-left-btn {
 				height: 32px;
 				line-height: 30px;
 				background: #EEEEEE;
@@ -303,7 +338,8 @@
 				border-radius: 16px;
 				margin: 0 auto;
 			}
-			.h-right-btn{
+
+			.h-right-btn {
 				height: 32px;
 				line-height: 30px;
 				background: #FFE05C;