提交 25a53493 authored 作者: lihuihui's avatar lihuihui

添加绑定手机号

上级 2cf5d451
......@@ -124,6 +124,30 @@
</div>
</div>
<batch-import @upload="upload" :data="data" v-model="isbatchImport"></batch-import>
<div class="mobile-pop" v-if="isBindMobile">
<div class="content">
<div class="title">提示</div>
<div class="tips">您的账号未绑定手机号码,请输入绑定手机号</div>
<van-form @submit="bindMobile">
<van-field
style="margin-top: 20px"
v-model="mobile"
name="手机号"
label="手机号"
placeholder="手机号"
:rules="[
{ required: true, message: '请填写手机号' },
{ pattern: /^1(3|4|7|5|8)([0-9]{9})/, message: '请输入正确的手机号' }
]"
/>
<div style="margin: 16px">
<van-button style="border: none; background: #b80140" round block type="info" native-type="submit"
>提交</van-button
>
</div>
</van-form>
</div>
</div>
</div>
</template>
......@@ -131,8 +155,7 @@
import { Toast } from 'vant'
import BatchImport from '../components/BatchImport.vue'
import Commonheader from '../components/Commonheader.vue'
import { saveStepInfo, getOpenid } from '../api'
// updateUserInfo
import { saveStepInfo, getOpenid, updateUserInfo } from '../api'
import allFormList from '@/utils/formList'
export default {
components: { Commonheader, BatchImport },
......@@ -144,21 +167,50 @@ export default {
data() {
return {
mobile: '',
isbatchImport: false,
title: '报名',
checkedPay: false, // 勾选是否跳过按钮
index: 0,
cIndex: 0,
minDate: new Date()
minDate: new Date(),
isBindMobile: false
}
},
mounted() {
console.log(JSON.parse(window.localStorage.userInfo).mobile, 'phone')
const userInfo = JSON.parse(window.localStorage.userInfo)
if (userInfo.mobile === '') {
this.isBindMobile = true
}
if (this.isPc()) {
document.getElementById('main_footer').style.width = '400px'
}
},
methods: {
bindMobile() {
updateUserInfo({ mobile: this.mobile }).then(res => {
console.log(res, 'res')
if (res.code === 0) {
const userInfo = JSON.parse(window.localStorage.userInfo)
this.data.user_fields.map(item => {
const d = item.find(i => i.value === userInfo.nickname)
if (d) {
item.map(i => {
if (i.key === 'mobile') {
i.value = this.mobile
i.enable_edit = false
}
return i
})
}
return item
})
this.isBindMobile = false
} else {
Toast(res.msg)
}
})
},
isPc() {
const userAgentInfo = navigator.userAgent
const Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
......@@ -466,4 +518,39 @@ export default {
border-radius: 0.1rem;
}
}
.mobile-pop {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 2001;
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
// height: 210px;
padding-bottom: 10px;
background: #fff;
border-radius: 10px;
text-align: center;
.title {
font-size: 0.34rem;
text-align: center;
color: #333;
padding: 0.2rem;
}
.tips {
font-size: 0.24rem;
padding-left: 0.2rem;
}
input {
width: 100%;
font-size: 0.24rem;
}
}
}
</style>
......@@ -43,7 +43,7 @@ httpRequest.interceptors.response.use(
// 未登录
if (data.code === 1) {
// window.location.href = `${import.meta.env.VITE_LOGIN_URL}`
return
return data
}
// 没有权限
if (data.code === 4008 || data.code === 5018) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论