dxz1228 лет назад: 2
Родитель
Сommit
953c1649c7

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
src/pages.json


+ 1 - 1
src/pages/accumulate-income/index.vue

@@ -68,7 +68,7 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
68
   getUserInviteProfitList({
68
   getUserInviteProfitList({
69
     ...params
69
     ...params
70
   }).then(res => {
70
   }).then(res => {
71
-    accumulateIncome.value = res
71
+	      accumulateIncome.value = res
72
     if (action === 'page') {
72
     if (action === 'page') {
73
       state.list = state.list.concat(res.pageInfo.list)
73
       state.list = state.list.concat(res.pageInfo.list)
74
     }
74
     }

+ 3 - 0
src/pages/home/index.vue

@@ -366,6 +366,9 @@ function Tomsindex() {
366
   uni.navigateTo({
366
   uni.navigateTo({
367
     url: '/pages/miaosha/index?type_show=2'
367
     url: '/pages/miaosha/index?type_show=2'
368
   })
368
   })
369
+  // uni.navigateTo({
370
+  //   url: `/pages/user/login/invite-login`
371
+  // })
369
 }
372
 }
370
 
373
 
371
 //秒杀跳转详情页
374
 //秒杀跳转详情页

+ 1 - 1
src/pages/invite-friends/index.vue

@@ -164,7 +164,7 @@ function handleItemClick(item) {
164
     uid: userStore.uid,
164
     uid: userStore.uid,
165
     imgId: item.id
165
     imgId: item.id
166
   }).then(res => {
166
   }).then(res => {
167
-    console.log(res)
167
+    console.log('生成的二维码',res)
168
     if (res && res.shareImgs) {
168
     if (res && res.shareImgs) {
169
       state.currentImg = res.shareImgs
169
       state.currentImg = res.shareImgs
170
     }
170
     }

+ 1 - 1
src/pages/order_addcart/index.vue

@@ -731,7 +731,7 @@ function handlePageClick() {
731
   <div @tap="handlePageClick">
731
   <div @tap="handlePageClick">
732
     <div class="">
732
     <div class="">
733
       <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
733
       <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
734
-      <div v-if="hasShopping" class="bg-white h-10 fixed top-0 w-full z-1 flex justify-end ">
734
+      <div v-if="hasShopping" class="bg-white h-10 fixed top-0 w-full z-999 flex justify-end ">
735
         <div class="pr-3">
735
         <div class="pr-3">
736
           <FButton size="small" @click="handleManageCart">
736
           <FButton size="small" @click="handleManageCart">
737
             <div>{{ state.isManage ? '管理' : '完成' }}</div>
737
             <div>{{ state.isManage ? '管理' : '完成' }}</div>

+ 237 - 0
src/pages/user/login/invite-login.vue

@@ -0,0 +1,237 @@
1
+<template>
2
+	<div v-if="showPage == true">
3
+		<div class="page_title">手机号登录</div>
4
+		<div class="flex flex-col justify-center items-center py-25">
5
+			<image src="https://test.bjtdba.com/applet/static/home/404986b1e3aeaf4b3829efa2c2ac6bf.png" mode="widthFix"
6
+				class="w-35 h-35"></image>
7
+		</div>
8
+
9
+		<nut-input v-model="state.phone" placeholder="请输入手机号" type="number">
10
+			<template #right>
11
+				<nut-button type='primary' size="small" @click="handleGetCode" :loading="state.isAuthVerify">
12
+					{{ state.buttonText }}
13
+				</nut-button>
14
+			</template>
15
+		</nut-input>
16
+		<nut-input v-model="state.code" placeholder="请输入验证码" clearable type="number">
17
+		</nut-input>
18
+
19
+		<div class="flex w-full">
20
+			<div class="p-3 w-full">
21
+				<nut-button type="primary" @click="handleLogin" block :disabled="!isFormVerify">登录</nut-button>
22
+				<!--        <div class="text-xs text-gray flex flex-col justify-center items-center p-3">-->
23
+				<!--          <div>-->
24
+				<!--            我已阅读并同意<span class="text-red text-xs" @click="handleViewXieyi(2)">《注册协议》</span>和<span-->
25
+				<!--              class="text-red text-xs" @click="handleViewXieyi(1)">《隐私协议》</span>-->
26
+				<!--          </div>-->
27
+				<!--        </div>-->
28
+
29
+			</div>
30
+
31
+		</div>
32
+
33
+	</div>
34
+</template>
35
+<script setup lang="ts">
36
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
37
+import CXBBanner from "~/components/CXBBanner/CXBBanner.vue";
38
+import { authSmsLogin, authVerify } from "~/apis/auth.api";
39
+import Cache from "~/utils/cache";
40
+import { getUserUnionId } from "~/apis/user";
41
+const userStore = useUserStore()
42
+const pageStore = usePageStoreWidthOut()
43
+const state = reactive({
44
+	phone: '',
45
+	code: '',
46
+	spread: '',
47
+	isAuthVerify: false,
48
+	buttonText: '获取验证码',
49
+})
50
+const showPage = ref(false)
51
+onLoad((options: any) => {
52
+	uni.showLoading({
53
+		title: '加载中',
54
+	});
55
+	console.log(userStore.uid);
56
+	pageStore.setPageConfig({
57
+		currentPage: {
58
+			type: 'tab',
59
+			url: '/pages/home/index'
60
+		}
61
+	})
62
+	if (userStore.uid) {
63
+		uni.hideLoading()
64
+		return uni.switchTab({
65
+			url: '/pages/home/index'
66
+		})
67
+	}
68
+	showPage.value = true
69
+	console.log(options);
70
+	uni.setNavigationBarTitle({
71
+		title: '手机登录'
72
+	})
73
+	if (options.scene) {
74
+		let queryString = decodeURIComponent(options.scene)
75
+		console.log(queryString);
76
+
77
+		// 将字符串按 '&' 分割成数组
78
+		state.spread = queryString.split('=')[1];
79
+		console.log(state.spread);
80
+	}
81
+	uni.hideLoading()
82
+})
83
+function sendCode() {
84
+	if (state.isAuthVerify) return
85
+	// if (this.disabled) return;
86
+	// this.disabled = true;
87
+	state.isAuthVerify = true
88
+	let n = 60;
89
+	state.buttonText = "剩余 " + n + "s";
90
+	const run = setInterval(() => {
91
+		n = n - 1;
92
+		if (n < 0) {
93
+			clearInterval(run);
94
+			n = 0
95
+		}
96
+		state.buttonText = "剩余 " + n + "s";
97
+		if (state.buttonText === "剩余 " + 0 + "s") {
98
+			state.isAuthVerify = false;
99
+			state.buttonText = "重新获取";
100
+		}
101
+	}, 1000);
102
+}
103
+
104
+const isFormVerify = computed(() => {
105
+	if (state.phone !== '' && state.code !== '') {
106
+		return true
107
+	}
108
+})
109
+function handleGetCode() {
110
+	if (!state.phone) {
111
+		return uni.showToast({
112
+			title: '请填写手机号码',
113
+			icon: 'none'
114
+		})
115
+	}
116
+	if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(state.phone)) {
117
+		return uni.showToast({
118
+			title: '请输入正确的手机号码',
119
+			icon: 'none'
120
+		})
121
+	}
122
+
123
+	state.isAuthVerify = true
124
+	authVerify(state.phone).then(res => {
125
+		state.isAuthVerify = false
126
+		sendCode()
127
+	}).catch(res => {
128
+	})
129
+}
130
+function handleViewXieyi(type: number) {
131
+	uni.navigateTo({
132
+		url: `/pages/user/login/user-agreement?type=${type}`
133
+	})
134
+}
135
+
136
+function handleLogin() {
137
+	uni.showLoading({
138
+		title: '登录中'
139
+	});
140
+	const shareId = Cache.get('SHARE_ID')
141
+	// uni.login({
142
+	//   provider: 'weixin',
143
+	//   univerifyStyle: {
144
+	//     fullScreen: true
145
+	//   },
146
+	//   success: result => {
147
+	//     // console.log(result)
148
+	//     getUserUnionId({
149
+	//       code: result.code,
150
+	//       source: 'cxb'
151
+	//     }).then(unionRes => {
152
+	//       console.log(111111, unionRes)
153
+	//       // const shareId = Cache.get('SHARE_ID')
154
+	//       //存储openid
155
+	//       userStore.setOpenid(unionRes.openid)
156
+	//     })
157
+	//   }
158
+	// })
159
+	let params = {
160
+		phone: state.phone,
161
+		sms_code: state.code,
162
+		// share_id:
163
+	}
164
+	if (shareId && shareId !== '') {
165
+		params.share_id = shareId
166
+	}
167
+	if (state.spread && state.spread !== '' && state.spread != '0') {
168
+		params.spread = state.spread
169
+	}
170
+	authSmsLogin({
171
+		...params
172
+	}).then(authRes => {
173
+		console.log(111111, authRes)
174
+		userStore.login(authRes.token, authRes.exp)
175
+		userStore.setUID(authRes.user.uid)
176
+		userStore.setUserInfo(authRes.user)
177
+		uni.hideLoading();
178
+		uni.showToast({
179
+			title: '登录成功',
180
+			icon: 'none'
181
+		})
182
+		Cache.clear('SHARE_ID')
183
+		state.isAuthVerify = false
184
+		let redirectPageObj: { page: string, type: 'page' | 'tab' }
185
+		if (Cache.get('SHARE_REDIRECT_PAGE')) {
186
+			redirectPageObj = JSON.parse(Cache.get('SHARE_REDIRECT_PAGE'))
187
+		}
188
+		setTimeout(() => {
189
+			if (redirectPageObj) {
190
+				if (redirectPageObj.type === 'page') {
191
+					return uni.redirectTo({
192
+						url: redirectPageObj.page
193
+					})
194
+				}
195
+				if (redirectPageObj.type === 'tab') {
196
+					return uni.switchTab({
197
+						url: redirectPageObj.page
198
+					})
199
+				}
200
+			} else {
201
+				uni.switchTab({
202
+					url: '/pages/home/index'
203
+				})
204
+			}
205
+		}, 200)
206
+
207
+
208
+	}).catch((errorMsg) => {
209
+		console.log(errorMsg)
210
+		uni.showToast({
211
+			title: errorMsg,
212
+			icon: 'none'
213
+		})
214
+	})
215
+}
216
+</script>
217
+  
218
+<route lang="yaml">
219
+style:
220
+  navigationBarTitleText: 手机号登录
221
+  navigationStyle: custom
222
+  enablePullDownRefresh: false
223
+</route>
224
+  
225
+<style>
226
+page {
227
+	background: #f8f8f8;
228
+}
229
+
230
+.page_title {
231
+	width: 182rpx;
232
+	height: 48rpx;
233
+	position: absolute;
234
+	top: 20%;
235
+	left: 284rpx;
236
+}
237
+</style>

+ 30 - 6
src/pages/user/login/other-phone.vue

@@ -1,5 +1,5 @@
1
 <template>
1
 <template>
2
-  <div>
2
+  <div v-if="showPage == true">
3
     <CXBBanner />
3
     <CXBBanner />
4
 
4
 
5
     <nut-input v-model="state.phone" placeholder="请输入手机号" type="number">
5
     <nut-input v-model="state.phone" placeholder="请输入手机号" type="number">
@@ -35,7 +35,7 @@ import { authSmsLogin, authVerify } from "~/apis/auth.api";
35
 import Cache from "~/utils/cache";
35
 import Cache from "~/utils/cache";
36
 import { getUserUnionId } from "~/apis/user";
36
 import { getUserUnionId } from "~/apis/user";
37
 const userStore = useUserStore()
37
 const userStore = useUserStore()
38
-
38
+const pageStore = usePageStoreWidthOut()
39
 const state = reactive({
39
 const state = reactive({
40
   phone: '',
40
   phone: '',
41
   code: '',
41
   code: '',
@@ -43,16 +43,40 @@ const state = reactive({
43
   isAuthVerify: false,
43
   isAuthVerify: false,
44
   buttonText: '获取验证码',
44
   buttonText: '获取验证码',
45
 })
45
 })
46
+const showPage = ref(false)
46
 onLoad((options: any) => {
47
 onLoad((options: any) => {
48
+  uni.showLoading({
49
+    title: '加载中',
50
+  });
51
+
52
+  console.log(userStore.uid);
53
+
54
+  if (userStore.uid) {
55
+    pageStore.setPageConfig({
56
+      currentPage: {
57
+        type: 'tab',
58
+        url: '/pages/home/index'
59
+      }
60
+    })
61
+    uni.hideLoading()
62
+    return uni.switchTab({
63
+      url: '/pages/home/index'
64
+    })
65
+  }
66
+  showPage.value = true
47
   console.log(options);
67
   console.log(options);
68
+  uni.setNavigationBarTitle({
69
+    title: '手机登录'
70
+  })
48
   if (options.scene) {
71
   if (options.scene) {
49
     let queryString = decodeURIComponent(options.scene)
72
     let queryString = decodeURIComponent(options.scene)
50
     console.log(queryString);
73
     console.log(queryString);
51
-    
74
+
52
     // 将字符串按 '&' 分割成数组
75
     // 将字符串按 '&' 分割成数组
53
     state.spread = queryString.split('=')[1];
76
     state.spread = queryString.split('=')[1];
54
     console.log(state.spread);
77
     console.log(state.spread);
55
   }
78
   }
79
+  uni.hideLoading()
56
 })
80
 })
57
 function sendCode() {
81
 function sendCode() {
58
   if (state.isAuthVerify) return
82
   if (state.isAuthVerify) return
@@ -138,8 +162,8 @@ function handleLogin() {
138
   if (shareId && shareId !== '') {
162
   if (shareId && shareId !== '') {
139
     params.share_id = shareId
163
     params.share_id = shareId
140
   }
164
   }
141
-  if(state.spread&&state.spread!==''&&state.spread!='0'){
142
-    params.spread=state.spread
165
+  if (state.spread && state.spread !== '' && state.spread != '0') {
166
+    params.spread = state.spread
143
   }
167
   }
144
   authSmsLogin({
168
   authSmsLogin({
145
     ...params
169
     ...params
@@ -191,7 +215,7 @@ function handleLogin() {
191
 
215
 
192
 <route lang="yaml">
216
 <route lang="yaml">
193
 style:
217
 style:
194
-  navigationBarTitleText: 手机登录
218
+  navigationBarTitleText: 储蓄保
195
 </route>
219
 </route>
196
 
220
 
197
 <style>
221
 <style>

+ 239 - 2
src/pages/user/login/register-agreement.vue

@@ -1,2 +1,239 @@
1
-<script lang="ts" setup></script>
2
-<template></template>
1
+<template>
2
+	<div v-if="showPage == true">
3
+		<div class="page_title">手机号登录</div>
4
+		<div class="flex flex-col justify-center items-center py-25">
5
+			<image src="https://test.bjtdba.com/applet/static/home/404986b1e3aeaf4b3829efa2c2ac6bf.png" mode="widthFix"
6
+				class="w-35 h-35"></image>
7
+		</div>
8
+
9
+		<nut-input v-model="state.phone" placeholder="请输入手机号" type="number">
10
+			<template #right>
11
+				<nut-button type='primary' size="small" @click="handleGetCode" :loading="state.isAuthVerify">
12
+					{{ state.buttonText }}
13
+				</nut-button>
14
+			</template>
15
+		</nut-input>
16
+		<nut-input v-model="state.code" placeholder="请输入验证码" clearable type="number">
17
+		</nut-input>
18
+
19
+		<div class="flex w-full">
20
+			<div class="p-3 w-full">
21
+				<nut-button type="primary" @click="handleLogin" block :disabled="!isFormVerify">登录</nut-button>
22
+				<!--        <div class="text-xs text-gray flex flex-col justify-center items-center p-3">-->
23
+				<!--          <div>-->
24
+				<!--            我已阅读并同意<span class="text-red text-xs" @click="handleViewXieyi(2)">《注册协议》</span>和<span-->
25
+				<!--              class="text-red text-xs" @click="handleViewXieyi(1)">《隐私协议》</span>-->
26
+				<!--          </div>-->
27
+				<!--        </div>-->
28
+
29
+			</div>
30
+
31
+		</div>
32
+
33
+	</div>
34
+</template>
35
+<script setup lang="ts">
36
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
37
+import CXBBanner from "~/components/CXBBanner/CXBBanner.vue";
38
+import { authSmsLogin, authVerify } from "~/apis/auth.api";
39
+import Cache from "~/utils/cache";
40
+import { getUserUnionId } from "~/apis/user";
41
+const userStore = useUserStore()
42
+const pageStore = usePageStoreWidthOut()
43
+const state = reactive({
44
+	phone: '',
45
+	code: '',
46
+	spread: '',
47
+	isAuthVerify: false,
48
+	buttonText: '获取验证码',
49
+})
50
+const showPage = ref(false)
51
+onLoad((options: any) => {
52
+	uni.showLoading({
53
+		title: '加载中',
54
+	});
55
+	console.log(userStore.uid);
56
+	pageStore.setPageConfig({
57
+		currentPage: {
58
+			type: 'tab',
59
+			url: '/pages/home/index'
60
+		}
61
+	})
62
+	if (userStore.uid) {
63
+		uni.hideLoading()
64
+		return uni.switchTab({
65
+			url: '/pages/home/index'
66
+		})
67
+	}
68
+	showPage.value = true
69
+	console.log(options);
70
+	uni.setNavigationBarTitle({
71
+		title: '手机登录'
72
+	})
73
+	if (options.scene) {
74
+		let queryString = decodeURIComponent(options.scene)
75
+		console.log(queryString);
76
+
77
+		// 将字符串按 '&' 分割成数组
78
+		state.spread = queryString.split('=')[1];
79
+		console.log(state.spread);
80
+	}
81
+	uni.hideLoading()
82
+})
83
+function sendCode() {
84
+	if (state.isAuthVerify) return
85
+	// if (this.disabled) return;
86
+	// this.disabled = true;
87
+	state.isAuthVerify = true
88
+	let n = 60;
89
+	state.buttonText = "剩余 " + n + "s";
90
+	const run = setInterval(() => {
91
+		n = n - 1;
92
+		if (n < 0) {
93
+			clearInterval(run);
94
+			n = 0
95
+		}
96
+		state.buttonText = "剩余 " + n + "s";
97
+		if (state.buttonText === "剩余 " + 0 + "s") {
98
+			state.isAuthVerify = false;
99
+			state.buttonText = "重新获取";
100
+		}
101
+	}, 1000);
102
+}
103
+
104
+const isFormVerify = computed(() => {
105
+	if (state.phone !== '' && state.code !== '') {
106
+		return true
107
+	}
108
+})
109
+function handleGetCode() {
110
+	if (!state.phone) {
111
+		return uni.showToast({
112
+			title: '请填写手机号码',
113
+			icon: 'none'
114
+		})
115
+	}
116
+	if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(state.phone)) {
117
+		return uni.showToast({
118
+			title: '请输入正确的手机号码',
119
+			icon: 'none'
120
+		})
121
+	}
122
+
123
+	state.isAuthVerify = true
124
+	authVerify(state.phone).then(res => {
125
+		state.isAuthVerify = false
126
+		sendCode()
127
+	}).catch(res => {
128
+	})
129
+}
130
+function handleViewXieyi(type: number) {
131
+	uni.navigateTo({
132
+		url: `/pages/user/login/user-agreement?type=${type}`
133
+	})
134
+}
135
+
136
+function handleLogin() {
137
+	uni.showLoading({
138
+		title: '登录中'
139
+	});
140
+	const shareId = Cache.get('SHARE_ID')
141
+	// uni.login({
142
+	//   provider: 'weixin',
143
+	//   univerifyStyle: {
144
+	//     fullScreen: true
145
+	//   },
146
+	//   success: result => {
147
+	//     // console.log(result)
148
+	//     getUserUnionId({
149
+	//       code: result.code,
150
+	//       source: 'cxb'
151
+	//     }).then(unionRes => {
152
+	//       console.log(111111, unionRes)
153
+	//       // const shareId = Cache.get('SHARE_ID')
154
+	//       //存储openid
155
+	//       userStore.setOpenid(unionRes.openid)
156
+	//     })
157
+	//   }
158
+	// })
159
+	let params = {
160
+		phone: state.phone,
161
+		sms_code: state.code,
162
+		// share_id:
163
+	}
164
+	if (shareId && shareId !== '') {
165
+		params.share_id = shareId
166
+	}
167
+	if (state.spread && state.spread !== '' && state.spread != '0') {
168
+		params.spread = state.spread
169
+	}
170
+	authSmsLogin({
171
+		...params
172
+	}).then(authRes => {
173
+		console.log(111111, authRes)
174
+		userStore.login(authRes.token, authRes.exp)
175
+		userStore.setUID(authRes.user.uid)
176
+		userStore.setUserInfo(authRes.user)
177
+		uni.hideLoading();
178
+		uni.showToast({
179
+			title: '登录成功',
180
+			icon: 'none'
181
+		})
182
+		Cache.clear('SHARE_ID')
183
+		state.isAuthVerify = false
184
+		let redirectPageObj: { page: string, type: 'page' | 'tab' }
185
+		if (Cache.get('SHARE_REDIRECT_PAGE')) {
186
+			redirectPageObj = JSON.parse(Cache.get('SHARE_REDIRECT_PAGE'))
187
+		}
188
+		setTimeout(() => {
189
+			if (redirectPageObj) {
190
+				if (redirectPageObj.type === 'page') {
191
+					return uni.redirectTo({
192
+						url: redirectPageObj.page
193
+					})
194
+				}
195
+				if (redirectPageObj.type === 'tab') {
196
+					return uni.switchTab({
197
+						url: redirectPageObj.page
198
+					})
199
+				}
200
+			} else {
201
+				uni.switchTab({
202
+					url: '/pages/home/index'
203
+				})
204
+			}
205
+		}, 200)
206
+
207
+
208
+	}).catch((errorMsg) => {
209
+		console.log(errorMsg)
210
+		uni.showToast({
211
+			title: errorMsg,
212
+			icon: 'none'
213
+		})
214
+	})
215
+}
216
+</script>
217
+  
218
+<route lang="yaml">
219
+style:
220
+  navigationBarTitleText: 手机号登录
221
+  navigationStyle: custom
222
+  enablePullDownRefresh: false
223
+</route>
224
+  
225
+<style>
226
+page {
227
+	background: #f8f8f8;
228
+}
229
+
230
+.page_title {
231
+	width: 180rpx;
232
+	height: 48rpx;
233
+	position: absolute;
234
+	margin-top: 110rpx;
235
+	left: 50%;
236
+    text-align: center;
237
+    margin-left: -90rpx;
238
+}
239
+</style>