myInfo.vue
5.14 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<div class="mb20">
<el-card :body-style="{'padding':'0'}">
<div class="indexTitle">
<h3 class="leftboderTT" v-if="user.utype=='2'">{{ language==0?'机构基础信息':'Institutional Basic Information' }}</h3>
<h3 class="leftboderTT" v-if="user.utype=='1'">{{ language==0?'个人基础信息':'Personal Basic Information' }}</h3>
</div>
<!-- uType字段 1 是个人 2是团体-->
<!-- {{user}}-->
<team-info :form="myform" :language="language" v-if="user.utype=='2'"/>
<div class="pd20">
<div class="d-form-border" style="margin-top: 0">
<el-form class="d-form" label-width="120">
<el-form-item :label="language==0?'用户名':'Account'">
{{user.userName}}
</el-form-item>
<el-form-item label="姓名" required>
<el-input v-model="myform.realName" />
</el-form-item>
<el-form-item label="性别" prop="sex" required>
<el-radio-group v-model="myform.sex">
<el-radio label="0" size="large">男</el-radio>
<el-radio label="1" size="large">女</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="证件类型">
<el-select v-model="myform.idcType" placeholder="请选择证件类型" style="width: 100%">
<el-option
v-for="item in certificates"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="证件号码">
<el-input v-model="myform.idcCode" @blur="checkCode"/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="myform.type" placeholder="请选择" style="width: 100%;">
<el-option label="业余" value="0" />
<el-option label="专业" value="1" />
<el-option label="大专院校" value="2" />
<el-option label="其他" value="3" />
</el-select>
</el-form-item>
<el-form-item :label="language==0?'联系人邮箱':'Contact Email'" required prop="email">
<el-input v-model="myform.email" type="email" :placeholder="language==0?'请输入内容':''"/>
</el-form-item>
</el-form>
<div class="text-center">
<el-button type="primary" class="btn-lineG" round @click="save">{{ language==0?'确定修改':'Save' }}</el-button>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { getCurrentInstance, onMounted } from '@vue/runtime-core'
import * as match from '@/apiPc/match'
import { ElMessage, ElMessageBox } from 'element-plus'
import { nationList } from '@/assets/js/data'
import {getGroupInfo} from "@/apiPc/match";
import TeamInfo from "@/viewsPc/center/teamInfo";
import cache from "@/plugins/cache";
const language = ref(cache.local.get('language') || 0)
const router = useRouter()
const { proxy } = getCurrentInstance()
const props = defineProps({
user:{
type:Object,
required:true
}
})
const activeName = ref('first')
const myform = ref({
idcType: 0,
countryId: 240,
nation: '汉族',
realName:''
})
const labelArr = ref([])
const certificates = ref([
{
value: '0',
label: '居民身份证'
},
{
value: '1',
label: '护照'
},
{
value: '2',
label: '其他'
}
])
onMounted(() => {
getData()
})
function getData() {
if(props.user.utype=='2'){
match.getGroupInfo().then(res => {
myform.value = res.data
})
}
if(props.user.utype=='1'){
match.getMyPersonInfo().then(res => {
myform.value = res.data
})
}
}
function save(){
match.saveMyBaseInfo().then(res=>{
})
}
function checkCode() {
if (myform.value.idcType == 0 && myform.value.idcCode) {
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(myform.value.idcCode))) {
ElMessage.error('请输入正确的身份证号码')
} else {
let tmpStr = ''
if (myform.value.idcCode.length == 15) {
tmpStr = myform.value.idcCode.substring(6, 12)
tmpStr = '19' + tmpStr
tmpStr = tmpStr.substring(0, 4) + '-' + tmpStr.substring(4, 6) + '-' + tmpStr.substring(6)
} else {
tmpStr = myform.value.idcCode.substring(6, 14)
tmpStr = tmpStr.substring(0, 4) + '-' + tmpStr.substring(4, 6) + '-' + tmpStr.substring(6)
}
myform.value.birth = tmpStr
const res = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/
if (myform.value.idcCode && res.test(myform.value.idcCode)) {
const genderCode = myform.value.idcCode.charAt(16)
if (parseInt(genderCode) % 2 == 0) {
myform.value.sex = '0'
} else {
myform.value.sex = '1'
}
}
}
}
}
</script>
<style scoped lang="scss">
.indexTitle{margin: 20px 0 12px;padding: 0 20px 15px;border-bottom: 1px solid #e5e5e5;
h3{
font-size: 16px;
color:var(--el-color-primary);
}
}
</style>