maintain.vue
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
<el-dialog v-model="show" title="维护信息" width="30%" align-center @close="close">
<el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px">
<el-form-item label="证件号" prop="idcCode">
<el-input v-model="user.idcCode" placeholder="请输入证件号" />
</el-form-item>
<br>
<el-row justify="center">
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="close">取消</el-button>
</el-row>
</el-form>
</el-dialog>
</template>
<script setup>
import useUserStore from '@/store/modules/user'
import { ref, getCurrentInstance } from 'vue'
// import { bind } from '@/apiPc/common'
const show = ref(false)
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const user = ref({
idcCode: undefined
})
const equalToPassword = (rule, value, callback) => {
if (value.length > 0 && value.length <= 18) {
callback()
} else {
callback(new Error('请输入18为内的证件号'))
}
}
const rules = ref({
idcCode: [
{ required: true, message: '证件号不能为空', trigger: 'blur' },
{ required: true, validator: equalToPassword, trigger: 'blur' }
]
})
//
// /** 提交按钮 */
// function submit() {
// proxy.$refs['pwdRef'].validate(async valid => {
// if (valid) {
// // updateUserPwd(user.oldPassword, user.newPassword).then(response => {
// // proxy.$modal.msgSuccess('修改成功')
// //
// // userStore.logOut().then(() => {
// // setTimeout(() => {
// // location.reload()
// // }, 1000)
// // })
// // })
// const res = await bind(user.value)
// if (res.code == 200) {
// proxy.$modal.msgSuccess('操作成功')
// await userStore.getInfoPc()
// await close()
// }
// }
// })
// }
function close() {
show.value = false
user.value.idcCode = null
}
function open() {
show.value = true
}
defineExpose({
open
})
</script>