Ver Fonte

手机号脱敏
手机号是否匹配
首页跳转判断修改

lyb há 4 anos atrás
pai
commit
5e1774d070

+ 1 - 1
components/alert/verificationCodeAlert.vue

@@ -4,7 +4,7 @@
 			<view class="code-alert-container">
 				<view class="title">投票验证</view>
 				<view class="code-input">
-					<u-input placeholder="请输入验证码" maxlength="4" v-model="codevalue" type="number"></u-input>
+					<u-input placeholder="请输入验证码" maxlength="4" v-model="codevalue"></u-input>
 					<image style="width: 160rpx; height: 80rpx;" :src="codeImg" @click="handleRefreshCode"></imague>
 				</view>
 				<view style="color: #EF9944; margin-bottom: 30rpx;">* 为了保证投票的公平性,防止刷票行为,请先完成验证</view>

+ 9 - 1
components/login.vue

@@ -59,7 +59,7 @@
 					<view class="content" style="padding: 120rpx 40rpx ;">
 						<u-form :model="form" ref="uForm" label-width="140" :border-bottom="borderBottom">
 							<u-form-item label="手机号">
-								<u-input v-model="form.phone" :clearable="false" />
+								<u-input v-model="form.phone" maxlength="11" :clearable="false" />
 							</u-form-item>
 							<u-form-item label="验证码">
 								<u-input :clearable="false" placeholder="请输入验证码" v-model="form.code"
@@ -148,6 +148,10 @@
 					this.$refs.toast.info('请输入手机号')
 					return
 				}
+				if (!this.$util.isPhone(this.form.phone)) {
+					this.$u.toast("手机号码有误,请重新输入")
+					return
+				}
 				if (this.$refs.uCode.canGetCode) {
 					// 模拟向后端请求验证码
 					let params = {
@@ -173,6 +177,10 @@
 					this.$u.toast("请输入手机号")
 					return
 				}
+				if (!this.$util.isPhone(this.form.phone)) {
+					this.$u.toast("手机号码有误,请重新输入")
+					return
+				}
 				if (this.$isEmpty(this.form.code)) {
 					this.$u.toast("请输入验证码")
 					return

+ 3 - 3
pages/index/home.vue

@@ -257,10 +257,10 @@
 				this.swiperList = this.vuex_active_setting.indexImageList
 			},
 			jump(item) {
-				if (item.name == '排行榜') {
-					item.path = '/pages/rank/rank?activeId=' + this.activeId
+				if (item.path == '/pages/rank/rank') {
+					item.path = `${item.path}?activeId=${this.activeId}`
 				}
-				if (item.name == '报名参赛') {
+				if (item.path == '/pages/apply/apply') {
 					//登录后才可以参赛
 					this.applyUrl = `${item.path}?activeId=${this.activeId}&activeType=${this.activeInfo.type}`
 					this.login()

+ 2 - 0
pages/payResult/payResult.vue

@@ -7,8 +7,10 @@
 </template>
 
 <script>
+	// #ifdef H5
 	let goldPlan = require('@/utils/jgoldplan-1.0.0.js');
 	import VConsole from 'vconsole';
+	// #endif
 	export default {
 		data() {
 			return {

+ 16 - 0
utils/util.js

@@ -237,4 +237,20 @@ util.getUrlParam = (name) => {
 	return null;
 }
 
+//手机号脱敏
+util.handlePhone = (phone) => {
+	return  phone.toString().substr(0, 3) + '****' + phone.toString().substr(7, phone.length)
+}
+
+/**
+ * 正则匹配手机号码是否正确
+ * phone 手机号码
+ * return 是否属于三大运营商号段范围
+ * https://www.qqzeng.com/article/phone.html
+ */
+util.isPhone = (phone) => {
+	let regExp = new RegExp("^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\\d{8}$").test(phone);
+	return regExp
+}
+
 export default util