Explorar el Código

优化指引页面

LinWuTai hace 2 semanas
padre
commit
0235531f67

+ 15 - 0
api/setting.js

@@ -14,3 +14,18 @@ export function removeInfo(data) {
 		'data': data
 	})
 }
+
+/**
+ * 用户注销
+ * @param {Object} data 参数
+ */
+export function unregister(data) {
+	return request({
+		'url': '/user/unregister',
+		headers: {
+			isToken: true
+		},
+		'method': 'post',
+		'data': data
+	})
+}

+ 1 - 1
components/creditCard.vue

@@ -22,7 +22,7 @@
 			<view class="image-item-box item-photo">
 				<image class="photo" :src="data.headUrl" :key="data.headUrl" @click="previewImage(data.headUrl)"></image>
 			</view>
-			<view class="image-item-box item-qrcode">
+			<view class="image-item-box item-qrcode" @click="onGuideClick">
 				<view class="qrcode-box">
 					<!-- <image class="qrcode" :src="`${FILE_URL}/zhengshu/qrCode.png`"></image>-->
 					 <ikun-qrcode

+ 7 - 5
pages/personalCenter/personalCenter.vue

@@ -273,7 +273,8 @@
 		headUrl: '',
 		url: '',
 		isAgtNT: false,
-		isAgtNTAsst: false
+		isAgtNTAsst: false,
+		guideFile: null
 	})
 	function onShowCreditCard() {
 		showCreditCard.value = false
@@ -290,7 +291,7 @@
 	}
 	function onCreditZhiYin() {
 		uni.navigateTo({
-			url: '/pages/zhiyin/zhiyin?title=信息信用卡指引'
+			url: '/pages/zhiyin/zhiyin?title=信息信用卡指引&pdfUrl=' + creditCard.value.guideFile
 		})
 	}
 	function onPreviewImage(url) {
@@ -311,7 +312,7 @@
 			})
 		} else {
 			uni.navigateTo({
-				url: '/pages/zhiyin/zhiyin?title=中介认证报名指引'
+				url: '/pages/zhiyin/zhiyin?title=中介认证报名指引&pdfUrl=' + zhongjie.value.guideFile
 			})
 		}
 	}
@@ -326,7 +327,7 @@
 			})
 		} else {
 			uni.navigateTo({
-				url: '/pages/zhiyin/zhiyin?title=按揭认证报名指引'
+				url: '/pages/zhiyin/zhiyin?title=按揭认证报名指引&pdfUrl=' + zhongjie.value.guideFile
 			})
 		}
 	}
@@ -337,7 +338,8 @@
 		xm: null,
 		xb: null,
 		sfzh: null,
-		whcd: null
+		whcd: null,
+		guideFile: null
 	})
 	const anjie = ref({
 		zsbh: null,

+ 45 - 15
pages/setting/cancelAccount/cancelAccount.vue

@@ -14,7 +14,7 @@
 							<u-input v-model="formData.form.phone" disabled :border="true" type="text" placeholder="请输入绑定手机号"/>
 						</view>
 						<view class="btn">
-							<text class="form-item-text" @click="getCode">{{tips}}</text>
+							<text class="form-item-text" @click="getCode">{{codeText}}</text>
 						</view>
 					</view>
 				</u-form-item>
@@ -34,12 +34,13 @@
 
 <script setup>
 	import { ref, reactive } from 'vue'
-	import { onLoad, onReady } from '@dcloudio/uni-app'
-	import { msgError, msgSuccess, showConfirm } from '@/utils/common'
+	import { onShow, onReady } from '@dcloudio/uni-app'
+	import { msgError, msgSuccess, showConfirm, msg } from '@/utils/common'
 	import { useAuthStore } from '@/store/authStore'
 	import {
 		smsSend
 	} from "@/api/login.js"
+	import { unregister } from '@/api/setting.js'
 	
 	const authStore = useAuthStore()
 	
@@ -70,18 +71,31 @@
 		}
 	})
 	const isAwaitCode = ref(false)
-	const tips = ref('获取验证码') // 59秒重新获取
+	const codeText = ref('获取验证码') // 59秒重新获取
 	const cancelCheck = ref(false)
 	function getCode() {
 		let {phone} = formData.form
+		if (!/^1[3-9]\d{9}$/.test(phone)) {
+			msg("请输入正确的手机号");
+			return;
+		}
 		if (!isAwaitCode.value) {
 			smsSend({phone}).then(res => {
 				if (res && res.data.captchaUuid) {
 					formData.form.captchaUuid = res.data.captchaUuid
-					isSendCode.value = true
-					setTimeout(() => {
-						
-					}, 60 * 1000)
+					isAwaitCode.value = true
+						// 倒计时60秒后重新获取
+						let time = 60
+						codeText.value = `重新获取(${time > 10 ? time : '0' + time}s)`
+						const timer = setInterval(() => {
+							time--
+							codeText.value = `重新获取(${time > 10 ? time : '0' + time}s)`
+							if (time <= 0) {
+								clearInterval(timer)
+								codeText.value = '获取验证码'
+								isAwaitCode.value = false
+							}
+						}, 1000)
 				}
 			})
 		} else {
@@ -92,13 +106,29 @@
 	function onSubmit() {
 		formRef.value.validate((valid) => {
 			if (valid) {
+				if (!cancelCheck.value) {
+					msg('请阅读并同意《会员中心小程序账号注销通知》')
+					return
+				}
 				// 提交
 				showConfirm('是否确认注销').then(res => {
 				 	if (res.confirm) {
-						authStore.clearAuthToken()
-						authStore.cleanUserInfo()
-						uni.reLaunch({
-							url: '/pages/initial/initial?isCancelAccount=1'
+						const form = {
+							captcha: formData.form.code,
+							captchaUuid: formData.form.captchaUuid
+						}
+						uni.showLoading({
+							title: "请稍候..."
+						})
+						unregister(form).then(res => {
+							if (res && res.code === 0) {
+								uni.hideLoading()
+								authStore.clearAuthToken()
+								authStore.cleanUserInfo()
+								uni.reLaunch({
+									url: '/pages/initial/initial?isCancelAccount=1'
+								})
+							}
 						})
 				 	}
 				})
@@ -109,9 +139,9 @@
 	onReady(() => {
 		formRef.value.setRules(formData.rules)
 	})
-	 onLoad(() => {
-		 formData.form.phone = authStore.phone
-	 })
+	onShow(() => {
+		formData.form.phone = authStore.userInfo.phone
+	})
 </script>
 
 <style lang="scss" scoped>

+ 3 - 6
pages/zhiyin/zhiyin.vue

@@ -1,8 +1,6 @@
 <template>
 	<view class="container">
-		<view class="content">
-			<u-parse :html="data.content" :selectable="true" :show-with-animation="true" style="width: 100%;"></u-parse>
-		</view>
+		<web-view :src="pdfUrl" v-if="pdfUrl"></web-view>
 	</view>
 </template>
 
@@ -12,15 +10,14 @@
 	// import { query } from '@/api/contactUs.js'
 	
 	const pageTitle = ref('')
-	const data = ref({
-		content: '指引页面,待确认'
-	})
+	const pdfUrl = ref(null)
 	
 	onLoad((load) => {
 		pageTitle.value = load.title
 		uni.setNavigationBarTitle({
 			title: pageTitle.value
 		})
+		pdfUrl.value = load.pdfUrl
 		// query().then(res => {
 		// 	if (res && res.code === 0) {
 		// 		data.value = res.data