Ver código fonte

修改登录逻辑

howard 1 ano atrás
pai
commit
db0df2a0af
3 arquivos alterados com 89 adições e 139 exclusões
  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 90
                 // 自行修改下方的 /web
91 91
                 "/gateway" : {
92 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 96
                 // "target": "http://8.141.0.149:9000",
97 97
                 // "target": "https://app.bjtdba.com"

+ 5 - 4
pages/cashier/index.vue

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

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

@@ -2,7 +2,7 @@
2 2
 	<view class="login">
3 3
 		<view class="login_header">
4 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 6
 			</view>
7 7
 			<!-- <view class="login_header_botom">
8 8
 				<image src="https://cdn.bjtdba.com/vod/image/2022-08-09/20220809135451815.png" mode="widthFix"></image>
@@ -37,20 +37,20 @@
37 37
 			</view>
38 38
 			<view class="bottom-index-ri">
39 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 55
 	</view>
56 56
 
@@ -63,11 +63,11 @@
63 63
 		selectMerchant,
64 64
 		queryStoreBranch,
65 65
 		getImUser
66
-	} from '@/commit/api.js'
66
+	} from '@/commit/api.js'
67 67
 	import emHandleReconnect from '@/EaseIM/utils/emHandleReconnect'; 
68 68
 	import { emConnect,emUserInfos } from '@/EaseIM/emApis';
69 69
 	const { updateUserInfosFromServer } = emUserInfos();
70
-	const { loginWithPassword } = emConnect();
70
+	const { loginWithPassword } = emConnect();
71 71
 	import wxPrivacy from '@/uni_modules/ws-wx-privacy/components/ws-wx-privacy/ws-wx-privacy.vue'
72 72
 	export default {
73 73
 		data() {
@@ -81,42 +81,42 @@
81 81
 					phone: uni.getStorageSync("user_phone").length == 0?'':uni.getStorageSync("user_phone"),
82 82
 					sms_code: '',
83 83
 					type: '1'
84
-				},
85
-				
84
+				},
85
+				
86 86
 				type: ''
87 87
 			}
88 88
 		},
89 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 106
 			console.log(this.type)
107
-		},
108
-		components: {
109
-			wxPrivacy
107
+		},
108
+		components: {
109
+			wxPrivacy
110 110
 		},
111 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 121
 			getCode() {
122 122
 				var mobileReg = /^1[3456789]\d{9}$/;
@@ -130,8 +130,8 @@
130 130
 						title: "手机号格式有误",
131 131
 						icon: "none"
132 132
 					})
133
-				} else {
134
-					// 点击获取验证码后 保存手机号
133
+				} else {
134
+					// 点击获取验证码后 保存手机号
135 135
 					uni.setStorageSync('user_phone',this.form.phone);
136 136
 					const TIME_COUNT = 60;
137 137
 					if (!this.timer) {
@@ -190,25 +190,25 @@
190 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 197
 				uni.navigateTo({
198 198
 					url: "/pages/index/bottombat?type=2" 
199 199
 				})
200 200
 			},
201
-			yincang() {
201
+			yincang() {
202 202
 				uni.setStorageSync('agreementType','1')
203 203
 				uni.navigateTo({
204 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 213
 			gou() {
214 214
 				if (this.is_wei == true) {
@@ -218,16 +218,16 @@
218 218
 					this.is_wei = true;
219 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 231
 			// loginWithUserId (){
232 232
 			// 	try {
233 233
 			// 	  uni.setStorage({
@@ -315,8 +315,7 @@
315 315
 					return;
316 316
 				} else {
317 317
 					// 登录注册
318
-					userPhoneLogOn(this.form).then(res => {
319
-						console.log(res)
318
+					userPhoneLogOn(this.form).then(res => {
320 319
 						if (res.data.status == 200 && JSON.stringify(res.data.data) != "{}") {
321 320
 							uni.setStorageSync('userinfo', res.data.data.user);
322 321
 							uni.setStorageSync('authorization', res.data.data.x_token);
@@ -325,47 +324,8 @@
325 324
 							selectMerchant({
326 325
 								uid: res.data.data.user.uid
327 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 327
 								if (data.data.status == 200) {
338 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 329
 									let storeStaff = uni.getStorageSync('storeStaff')
370 330
 									if (storeStaff != null) {
371 331
 										queryStoreBranch({
@@ -381,23 +341,12 @@
381 341
 									uni.showToast({
382 342
 										title: res.data.message,
383 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 351
 							}, fail => {
403 352
 								uni.showToast({
@@ -409,7 +358,7 @@
409 358
 							})
410 359
 						} else {
411 360
 							uni.showToast({
412
-								title: res.data.message,
361
+								title: "信息异常请联系客服...",
413 362
 								icon: "none"
414 363
 							})
415 364
 						}
@@ -509,9 +458,9 @@
509 458
 			align-items: center;
510 459
 			color: #333333;
511 460
 		}
512
-
513
-		.unLogin-singn {
514
-			margin-top: 88rpx;
461
+
462
+		.unLogin-singn {
463
+			margin-top: 88rpx;
515 464
 		}
516 465
 		.bottom-index {
517 466
 			width: 658rpx;
@@ -524,13 +473,13 @@
524 473
 			.bottom-index-in {
525 474
 				width: 32rpx;
526 475
 				height: 32rpx;
527
-				line-height: 33rpx;
476
+				line-height: 33rpx;
528 477
 				transform: sale(2);
529 478
 				image {
530 479
 					width: 100%;
531 480
 					height: 100%;
532
-				}
533
-				margin-right: 20rpx;
481
+				}
482
+				margin-right: 20rpx;
534 483
 				// position: relative;
535 484
 			}
536 485
 
@@ -540,4 +489,4 @@
540 489
 			}
541 490
 		}
542 491
 	}
543
-</style>
492
+</style>