You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
3 days ago
|
<template>
|
||
|
<uni-popup ref="alertDialog">
|
||
|
<view class="realname-wrap">
|
||
|
<uni-forms>
|
||
|
<uni-forms-item label="真实姓名" required>
|
||
|
<uni-easyinput type="text" v-model.trim="realNameForm.userName" placeholder="请输入真实姓名" />
|
||
|
</uni-forms-item>
|
||
|
<uni-forms-item label="学号">
|
||
|
<uni-easyinput type="text" v-model.trim="realNameForm.workNumber" placeholder="请输入学号" />
|
||
|
</uni-forms-item>
|
||
|
</uni-forms>
|
||
|
<button class="btn" type="primary" @click="realNameSubmit">确认</button>
|
||
|
</view>
|
||
|
</uni-popup>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { checkUserNameOrWorkNumber, updateUserNameOrWorkNumber } from '@/apis/modules/user.js'
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
src: uni.getSystemInfoSync().uniPlatform === 'mp-toutiao' ? 'https://occupationlab.com/images/dyQrcode.jpg' : 'https://occupationlab.com/images/customer.png'
|
||
|
}
|
||
|
},
|
||
|
onShow() {
|
||
|
console.log(3333)
|
||
|
this.handleRealName()
|
||
|
},
|
||
|
methods: {
|
||
|
// 提示填写姓名(登录后调用一次)
|
||
|
async handleRealName () {
|
||
|
const res = await checkUserNameOrWorkNumber()
|
||
|
// 如果没有真实姓名,则弹框提示填写
|
||
|
if (!res.hasName) this.$refs.alertDialog.open()
|
||
|
},
|
||
|
// 真实姓名提交
|
||
|
async realNameSubmit() {
|
||
|
const form = this.realNameForm
|
||
|
if (!form.userName) return this.$util.errMsg('请输入真实姓名!')
|
||
|
await updateUserNameOrWorkNumber({
|
||
|
userName: form.userName,
|
||
|
workNumber: form.workNumber
|
||
|
})
|
||
|
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.realname-wrap {
|
||
|
width: 460rpx;
|
||
|
padding: 30rpx;
|
||
|
background-color: #fff;
|
||
|
border-radius: 20rpx;
|
||
|
.btn {
|
||
|
line-height: 2.2;
|
||
|
}
|
||
|
}
|
||
|
</style>
|