职站学生端小程序版
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.

74 lines
1.9 KiB

<template>
3 days ago
<uni-popup ref="alertDialog" :is-mask-click="false">
<view class="realname-wrap">
3 days ago
<view class="realname-form">
2 days ago
<uni-forms label-width="70" label-align="right">
<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>
3 days ago
</view>
<view class="btn" @click="realNameSubmit">确认</view>
</view>
</uni-popup>
</template>
<script>
import { checkUserNameOrWorkNumber, updateUserNameOrWorkNumber } from '@/apis/modules/user.js'
export default {
data() {
return {
3 days ago
realNameForm: {
userName: '',
workNumber: '',
},
}
},
3 days ago
mounted() {
console.log('realname:')
2 days ago
// this.handleRealName()
},
methods: {
// 提示填写姓名(登录后调用一次)
async handleRealName () {
const res = await checkUserNameOrWorkNumber()
// 如果没有真实姓名,则弹框提示填写
2 days ago
if (!res.hasName) this.realNameForm.workNumber = res.workNumber
2 days ago
this.$refs.alertDialog[res.hasName ? 'close' : 'open']()
},
// 真实姓名提交
async realNameSubmit() {
const form = this.realNameForm
if (!form.userName) return this.$util.errMsg('请输入真实姓名!')
await updateUserNameOrWorkNumber({
userName: form.userName,
workNumber: form.workNumber
})
2 days ago
this.$refs.alertDialog.close()
},
}
}
</script>
<style scoped lang="scss">
.realname-wrap {
width: 460rpx;
background-color: #fff;
border-radius: 20rpx;
3 days ago
.realname-form {
padding: 30rpx 30rpx 0;
}
.btn {
3 days ago
flex: 1;
padding: 22rpx 16rpx;
font-size: 24rpx;
color: #007EFF;
text-align: center;
border-top: 1px solid #eee;
}
}
</style>