Browse Source

修改登录逻辑

howard 1 year ago
parent
commit
db0df2a0af
3 changed files with 89 additions and 139 deletions
  1. 2 2
      manifest.json
  2. 5 4
      pages/cashier/index.vue
  3. 82 133
      pages/user/login/index.vue

+ 2 - 2
manifest.json

@@ -90,8 +90,8 @@
90
                 // 自行修改下方的 /web
90
                 // 自行修改下方的 /web
91
                 "/gateway" : {
91
                 "/gateway" : {
92
                     // "secure": false,
92
                     // "secure": false,
93
-                    // "target": "https://api.gdjbp.com"
94
-                    "target" : "https://api.hebeiyhc.com"
93
+                    "target": "https://api.gdjbp.com"
94
+                    // "target" : "https://api.hebeiyhc.com"
95
                 },
95
                 },
96
                 // "target": "http://8.141.0.149:9000",
96
                 // "target": "http://8.141.0.149:9000",
97
                 // "target": "https://app.bjtdba.com"
97
                 // "target": "https://app.bjtdba.com"

+ 5 - 4
pages/cashier/index.vue

@@ -62,7 +62,7 @@
62
 			<view class="cashier-list-tbot">
62
 			<view class="cashier-list-tbot">
63
 				<view class="yis">
63
 				<view class="yis">
64
 					<view class="sgjd">
64
 					<view class="sgjd">
65
-						¥{{dataList.orderLineOrderSun.orderLine==undefined?0:dataList.orderLineOrderSun.orderLine}}
65
+						¥{{dataList.orderLineOrderSun ? dataList.orderLineOrderSun.orderLine || 0 :  0}}
66
 					</view>
66
 					</view>
67
 					<view class="sf">
67
 					<view class="sf">
68
 						线上营收
68
 						线上营收
@@ -70,7 +70,7 @@
70
 				</view>
70
 				</view>
71
 				<view class="yis">
71
 				<view class="yis">
72
 					<view class="sgjd">
72
 					<view class="sgjd">
73
-						¥{{dataList.belowTheLineSum.belowTheLine==undefined?0:dataList.belowTheLineSum.belowTheLine}}
73
+						¥{{dataList.belowTheLineSum ?  dataList.belowTheLineSum.belowTheLine || 0:0}}
74
 					</view>
74
 					</view>
75
 					<view class="sf">
75
 					<view class="sf">
76
 						线下营收
76
 						线下营收
@@ -198,11 +198,12 @@
198
 			})
198
 			})
199
 			}
199
 			}
200
 		},
200
 		},
201
-		onShow() {
201
+		onShow() {
202
 			let authorization = uni.getStorageSync('authorization')
202
 			let authorization = uni.getStorageSync('authorization')
203
 			let userinfo = uni.getStorageSync('userinfo')
203
 			let userinfo = uni.getStorageSync('userinfo')
204
 			let selectmerchant = uni.getStorageSync('selectmerchant')
204
 			let selectmerchant = uni.getStorageSync('selectmerchant')
205
-			let uid = userinfo.uid
205
+			let uid = userinfo.uid
206
+			console.log(authorization, uid)
206
 			if (authorization && uid) {
207
 			if (authorization && uid) {
207
 				if (selectmerchant.merId >= 0 && selectmerchant.status == -1) {
208
 				if (selectmerchant.merId >= 0 && selectmerchant.status == -1) {
208
 					uni.redirectTo({
209
 					uni.redirectTo({

+ 82 - 133
pages/user/login/index.vue

@@ -2,7 +2,7 @@
2
 	<view class="login">
2
 	<view class="login">
3
 		<view class="login_header">
3
 		<view class="login_header">
4
 			<view class="login_header_top">
4
 			<view class="login_header_top">
5
-				<image src="https://cdn.bjtdba.com/vod/image/2024-04-12/20240412151953641.png" mode="widthFix"></image>
5
+				<image src="https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png" mode="widthFix"></image>
6
 			</view>
6
 			</view>
7
 			<!-- <view class="login_header_botom">
7
 			<!-- <view class="login_header_botom">
8
 				<image src="https://cdn.bjtdba.com/vod/image/2022-08-09/20220809135451815.png" mode="widthFix"></image>
8
 				<image src="https://cdn.bjtdba.com/vod/image/2022-08-09/20220809135451815.png" mode="widthFix"></image>
@@ -37,20 +37,20 @@
37
 			</view>
37
 			</view>
38
 			<view class="bottom-index-ri">
38
 			<view class="bottom-index-ri">
39
 				我已经阅读并同意<span style="color: #1f7cff" @click="xieyi()">《注册协议》</span >、<span style="color: #1f7cff" @click="yincang()">《隐私协议》</span>、<span style="color: #1f7cff" @click="ruzhuxieyi()">《商家入驻协议》</span>
39
 				我已经阅读并同意<span style="color: #1f7cff" @click="xieyi()">《注册协议》</span >、<span style="color: #1f7cff" @click="yincang()">《隐私协议》</span>、<span style="color: #1f7cff" @click="ruzhuxieyi()">《商家入驻协议》</span>
40
-			</view>
41
-		</view>
42
-		
43
-		<view class="unLogin-singn" @click="unLogin">
44
-			<view class="login-singn-text">
45
-				暂不登录
46
-			</view>
47
-		</view>
48
-		
49
-		
50
-		<!-- #ifdef MP-WEIXIN -->
51
-			<ws-wx-privacy id="privacy-popup"></ws-wx-privacy>
52
-		<!-- #endif -->
53
-
40
+			</view>
41
+		</view>
42
+		
43
+		<view class="unLogin-singn" @click="unLogin">
44
+			<view class="login-singn-text">
45
+				暂不登录
46
+			</view>
47
+		</view>
48
+		
49
+		
50
+		<!-- #ifdef MP-WEIXIN -->
51
+			<ws-wx-privacy id="privacy-popup"></ws-wx-privacy>
52
+		<!-- #endif -->
53
+
54
 
54
 
55
 	</view>
55
 	</view>
56
 
56
 
@@ -63,11 +63,11 @@
63
 		selectMerchant,
63
 		selectMerchant,
64
 		queryStoreBranch,
64
 		queryStoreBranch,
65
 		getImUser
65
 		getImUser
66
-	} from '@/commit/api.js'
66
+	} from '@/commit/api.js'
67
 	import emHandleReconnect from '@/EaseIM/utils/emHandleReconnect'; 
67
 	import emHandleReconnect from '@/EaseIM/utils/emHandleReconnect'; 
68
 	import { emConnect,emUserInfos } from '@/EaseIM/emApis';
68
 	import { emConnect,emUserInfos } from '@/EaseIM/emApis';
69
 	const { updateUserInfosFromServer } = emUserInfos();
69
 	const { updateUserInfosFromServer } = emUserInfos();
70
-	const { loginWithPassword } = emConnect();
70
+	const { loginWithPassword } = emConnect();
71
 	import wxPrivacy from '@/uni_modules/ws-wx-privacy/components/ws-wx-privacy/ws-wx-privacy.vue'
71
 	import wxPrivacy from '@/uni_modules/ws-wx-privacy/components/ws-wx-privacy/ws-wx-privacy.vue'
72
 	export default {
72
 	export default {
73
 		data() {
73
 		data() {
@@ -81,42 +81,42 @@
81
 					phone: uni.getStorageSync("user_phone").length == 0?'':uni.getStorageSync("user_phone"),
81
 					phone: uni.getStorageSync("user_phone").length == 0?'':uni.getStorageSync("user_phone"),
82
 					sms_code: '',
82
 					sms_code: '',
83
 					type: '1'
83
 					type: '1'
84
-				},
85
-				
84
+				},
85
+				
86
 				type: ''
86
 				type: ''
87
 			}
87
 			}
88
 		},
88
 		},
89
 		onLoad(options) {
89
 		onLoad(options) {
90
-			//#ifdef MP-WEIXIN        
91
-			wx.requirePrivacyAuthorize({            
92
-			  success: () => {                
93
-			    console.log('点击同意');            
94
-			 },            
95
-			  fail: () => {                
96
-			    console.log('点击拒绝');                            
97
-			 },             
98
-			  complete: () => {                
99
-			    console.log('用户已点击');            
100
-			 }       
101
-			})
102
-			//#endif
103
-			
104
-			this.type = options.type
105
-			console.log(options.type)
90
+			//#ifdef MP-WEIXIN        
91
+			wx.requirePrivacyAuthorize({            
92
+			  success: () => {                
93
+			    console.log('点击同意');            
94
+			 },            
95
+			  fail: () => {                
96
+			    console.log('点击拒绝');                            
97
+			 },             
98
+			  complete: () => {                
99
+			    console.log('用户已点击');            
100
+			 }       
101
+			})
102
+			//#endif
103
+			
104
+			this.type = options.type
105
+			console.log(options.type)
106
 			console.log(this.type)
106
 			console.log(this.type)
107
-		},
108
-		components: {
109
-			wxPrivacy
107
+		},
108
+		components: {
109
+			wxPrivacy
110
 		},
110
 		},
111
 		methods: {
111
 		methods: {
112
-			
113
-			handleDisagree() {
114
-			    // 处理用户不同意隐私协议的逻辑
115
-			},
116
-			handleAgree() {
117
-			    // 处理用户同意隐私协议的逻辑
118
-		    },
119
-			
112
+			
113
+			handleDisagree() {
114
+			    // 处理用户不同意隐私协议的逻辑
115
+			},
116
+			handleAgree() {
117
+			    // 处理用户同意隐私协议的逻辑
118
+		    },
119
+			
120
 			
120
 			
121
 			getCode() {
121
 			getCode() {
122
 				var mobileReg = /^1[3456789]\d{9}$/;
122
 				var mobileReg = /^1[3456789]\d{9}$/;
@@ -130,8 +130,8 @@
130
 						title: "手机号格式有误",
130
 						title: "手机号格式有误",
131
 						icon: "none"
131
 						icon: "none"
132
 					})
132
 					})
133
-				} else {
134
-					// 点击获取验证码后 保存手机号
133
+				} else {
134
+					// 点击获取验证码后 保存手机号
135
 					uni.setStorageSync('user_phone',this.form.phone);
135
 					uni.setStorageSync('user_phone',this.form.phone);
136
 					const TIME_COUNT = 60;
136
 					const TIME_COUNT = 60;
137
 					if (!this.timer) {
137
 					if (!this.timer) {
@@ -190,25 +190,25 @@
190
 					this.form.sms_code = o.value.replace(inputRule, '');
190
 					this.form.sms_code = o.value.replace(inputRule, '');
191
 				})
191
 				})
192
 			},
192
 			},
193
-			xieyi() {
194
-				
195
-				uni.setStorageSync('agreementType','2')
193
+			xieyi() {
194
+				
195
+				uni.setStorageSync('agreementType','2')
196
 				
196
 				
197
 				uni.navigateTo({
197
 				uni.navigateTo({
198
 					url: "/pages/index/bottombat?type=2" 
198
 					url: "/pages/index/bottombat?type=2" 
199
 				})
199
 				})
200
 			},
200
 			},
201
-			yincang() {
201
+			yincang() {
202
 				uni.setStorageSync('agreementType','1')
202
 				uni.setStorageSync('agreementType','1')
203
 				uni.navigateTo({
203
 				uni.navigateTo({
204
 					url: "/pages/index/bottombat?type=1"
204
 					url: "/pages/index/bottombat?type=1"
205
 				})
205
 				})
206
-			},
207
-			ruzhuxieyi() {
208
-				uni.setStorageSync('agreementType','6')
209
-				uni.navigateTo({
210
-					url: "/pages/index/bottombat?type=6" 
211
-				})
206
+			},
207
+			ruzhuxieyi() {
208
+				uni.setStorageSync('agreementType','6')
209
+				uni.navigateTo({
210
+					url: "/pages/index/bottombat?type=6" 
211
+				})
212
 			},
212
 			},
213
 			gou() {
213
 			gou() {
214
 				if (this.is_wei == true) {
214
 				if (this.is_wei == true) {
@@ -218,16 +218,16 @@
218
 					this.is_wei = true;
218
 					this.is_wei = true;
219
 					this.is_yes = false;
219
 					this.is_yes = false;
220
 				}
220
 				}
221
-			},
222
-			// 暂不登录
223
-			unLogin() {
224
-				setTimeout(function() {
225
-					uni.switchTab({
226
-						url: '../../my/index'
227
-					});
228
-				}, 300);
229
 			},
221
 			},
230
-			//lww
222
+			// 暂不登录
223
+			unLogin() {
224
+				setTimeout(function() {
225
+					uni.switchTab({
226
+						url: '../../my/index'
227
+					});
228
+				}, 300);
229
+			},
230
+			//lww
231
 			// loginWithUserId (){
231
 			// loginWithUserId (){
232
 			// 	try {
232
 			// 	try {
233
 			// 	  uni.setStorage({
233
 			// 	  uni.setStorage({
@@ -315,8 +315,7 @@
315
 					return;
315
 					return;
316
 				} else {
316
 				} else {
317
 					// 登录注册
317
 					// 登录注册
318
-					userPhoneLogOn(this.form).then(res => {
319
-						console.log(res)
318
+					userPhoneLogOn(this.form).then(res => {
320
 						if (res.data.status == 200 && JSON.stringify(res.data.data) != "{}") {
319
 						if (res.data.status == 200 && JSON.stringify(res.data.data) != "{}") {
321
 							uni.setStorageSync('userinfo', res.data.data.user);
320
 							uni.setStorageSync('userinfo', res.data.data.user);
322
 							uni.setStorageSync('authorization', res.data.data.x_token);
321
 							uni.setStorageSync('authorization', res.data.data.x_token);
@@ -325,47 +324,8 @@
325
 							selectMerchant({
324
 							selectMerchant({
326
 								uid: res.data.data.user.uid
325
 								uid: res.data.data.user.uid
327
 							}).then(data => {
326
 							}).then(data => {
328
-								uni.setStorage({
329
-								  key: 'myUsername',
330
-								  data: JSON.stringify(uni.getStorageSync('userinfo').uid),
331
-								});
332
-								uni.setStorage({
333
-								  key: 'mer_id',
334
-								  data: data.data.data.merchantIntention.mer_id,
335
-								});
336
-								
337
 								if (data.data.status == 200) {
327
 								if (data.data.status == 200) {
338
 									uni.setStorageSync('selectmerchant', data.data.data);
328
 									uni.setStorageSync('selectmerchant', data.data.data);
339
-									//lww
340
-									
341
-									getImUser({
342
-										mer_id:	uni.getStorageSync('mer_id'),
343
-									}).then(data=>{
344
-										console.log('getImUser======',data.data.data);
345
-										// actionEMReconnect();
346
-										 // this.loginWithUserId()
347
-										const { loginWithPassword } = emConnect();
348
-										uni.setStorage({
349
-											key: 'im_userid',
350
-											data:data.data.data.im_userid
351
-										})
352
-										uni.setStorage({
353
-											key: 'im_pass',
354
-											data:data.data.data.im_pass
355
-										})
356
-										uni.setStorage({
357
-											key: 'im_uuid',
358
-											data:data.data.data.im_uuid
359
-										})
360
-										//环信注册成功 登录
361
-										if(data.data.status==200){
362
-											console.log('>>>>>>>>环信注册成功 登录')
363
-											this.loginWithUserId()
364
-											//更新环信的用户信息 头像,昵称
365
-											
366
-										}
367
-									})
368
-									//lww
369
 									let storeStaff = uni.getStorageSync('storeStaff')
329
 									let storeStaff = uni.getStorageSync('storeStaff')
370
 									if (storeStaff != null) {
330
 									if (storeStaff != null) {
371
 										queryStoreBranch({
331
 										queryStoreBranch({
@@ -381,23 +341,12 @@
381
 									uni.showToast({
341
 									uni.showToast({
382
 										title: res.data.message,
342
 										title: res.data.message,
383
 										icon: "none"
343
 										icon: "none"
384
-									})
385
-									
386
-									console.log(this.type, 'this.type')
387
-									
388
-									if (this.type == 1) {
389
-										
390
-										console.log('返回上一页')
391
-										uni.navigateBack({
392
-											delta: 1
393
-										})
394
-									} else {
395
-										setTimeout(function() {
396
-											uni.switchTab({
397
-												url: '../../cashier/index'
398
-											});
399
-										}, 700);
400
-									}
344
+									})
345
+									setTimeout(function() {
346
+										uni.switchTab({
347
+											url: '../../cashier/index'
348
+										});
349
+									}, 700);
401
 								}
350
 								}
402
 							}, fail => {
351
 							}, fail => {
403
 								uni.showToast({
352
 								uni.showToast({
@@ -409,7 +358,7 @@
409
 							})
358
 							})
410
 						} else {
359
 						} else {
411
 							uni.showToast({
360
 							uni.showToast({
412
-								title: res.data.message,
361
+								title: "信息异常请联系客服...",
413
 								icon: "none"
362
 								icon: "none"
414
 							})
363
 							})
415
 						}
364
 						}
@@ -509,9 +458,9 @@
509
 			align-items: center;
458
 			align-items: center;
510
 			color: #333333;
459
 			color: #333333;
511
 		}
460
 		}
512
-
513
-		.unLogin-singn {
514
-			margin-top: 88rpx;
461
+
462
+		.unLogin-singn {
463
+			margin-top: 88rpx;
515
 		}
464
 		}
516
 		.bottom-index {
465
 		.bottom-index {
517
 			width: 658rpx;
466
 			width: 658rpx;
@@ -524,13 +473,13 @@
524
 			.bottom-index-in {
473
 			.bottom-index-in {
525
 				width: 32rpx;
474
 				width: 32rpx;
526
 				height: 32rpx;
475
 				height: 32rpx;
527
-				line-height: 33rpx;
476
+				line-height: 33rpx;
528
 				transform: sale(2);
477
 				transform: sale(2);
529
 				image {
478
 				image {
530
 					width: 100%;
479
 					width: 100%;
531
 					height: 100%;
480
 					height: 100%;
532
-				}
533
-				margin-right: 20rpx;
481
+				}
482
+				margin-right: 20rpx;
534
 				// position: relative;
483
 				// position: relative;
535
 			}
484
 			}
536
 
485
 
@@ -540,4 +489,4 @@
540
 			}
489
 			}
541
 		}
490
 		}
542
 	}
491
 	}
543
-</style>
492
+</style>