|
@ -2,58 +2,103 @@ |
|
|
<view> |
|
|
<view> |
|
|
<form class="padding-lr cu-form-group flex-direction"> |
|
|
<form class="padding-lr cu-form-group flex-direction"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>姓名</view> |
|
|
<view class="title padding-bottom-sm"> |
|
|
<input :disabled="userInfo ? true : false" placeholder="请输入真实姓名" name="input" type="text" v-model="name" /> |
|
|
<span class="text-red padding-right-xs" v-show="!userInfo">*</span>姓名 |
|
|
|
|
|
</view> |
|
|
|
|
|
<input |
|
|
|
|
|
:disabled="(userinfo && userInfo.id) ? true : false" |
|
|
|
|
|
name="input" |
|
|
|
|
|
placeholder="请输入真实姓名" |
|
|
|
|
|
type="text" |
|
|
|
|
|
v-model="name" |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>身份证</view> |
|
|
<view class="title padding-bottom-sm"> |
|
|
<input :disabled="userInfo ? true : false" placeholder="请输入身份证号" name="input" type="text" v-model="idCard" /> |
|
|
<span class="text-red padding-right-xs" v-show="!(userinfo && userInfo.id)">*</span>身份证 |
|
|
|
|
|
</view> |
|
|
|
|
|
<input |
|
|
|
|
|
:disabled="(userinfo && userInfo.id) ? true : false" |
|
|
|
|
|
name="input" |
|
|
|
|
|
placeholder="请输入身份证号" |
|
|
|
|
|
type="text" |
|
|
|
|
|
v-model="idCard" |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>联系方式</view> |
|
|
<view class="title padding-bottom-sm"> |
|
|
<input :disabled="userInfo ? true : false" placeholder="请输入手机号码" name="input" type="number" v-model="phone" /> |
|
|
<span class="text-red padding-right-xs" v-show="!(userinfo && userInfo.id)">*</span>联系方式 |
|
|
|
|
|
</view> |
|
|
|
|
|
<input |
|
|
|
|
|
:disabled="(userinfo && userInfo.id) ? true : false" |
|
|
|
|
|
name="input" |
|
|
|
|
|
placeholder="请输入手机号码" |
|
|
|
|
|
type="number" |
|
|
|
|
|
v-model="phone" |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>身份</view> |
|
|
<view class="title padding-bottom-sm"> |
|
|
<radio-group class="block" @change="RadioChange" v-if="!userInfo"> |
|
|
<span class="text-red padding-right-xs" v-show="!(userinfo && userInfo.id)">*</span>身份 |
|
|
|
|
|
</view> |
|
|
|
|
|
<radio-group @change="RadioChange" class="block" v-if="!(userinfo && userInfo.id)"> |
|
|
<view class="flex"> |
|
|
<view class="flex"> |
|
|
<view class="flex-sub margin-tb-sm" v-for="(identity,index) in identitys" :key="index"> |
|
|
<view :key="index" class="flex-sub margin-tb-sm" v-for="(identity,index) in identitys"> |
|
|
<label class="flex justify-between align-center"> |
|
|
<label class="flex justify-between align-center"> |
|
|
<radio class="round margin-right-xs" :checked="index === current" :value="identity.value"></radio> |
|
|
<radio |
|
|
|
|
|
:checked="index === current" |
|
|
|
|
|
:value="identity.value" |
|
|
|
|
|
class="round margin-right-xs" |
|
|
|
|
|
></radio> |
|
|
<text class="flex-sub" style="font-size: 34rpx;">{{ identity.name }}</text> |
|
|
<text class="flex-sub" style="font-size: 34rpx;">{{ identity.name }}</text> |
|
|
</label> |
|
|
</label> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</radio-group> |
|
|
</radio-group> |
|
|
<input v-else disabled name="input" type="text" :value="current === 0 ? '学生' : current === 1 ? '教师' : '工作人员'" /> |
|
|
<input |
|
|
|
|
|
:value="current === 0 ? '学生' : current === 1 ? '教师' : '工作人员'" |
|
|
|
|
|
disabled |
|
|
|
|
|
name="input" |
|
|
|
|
|
type="text" |
|
|
|
|
|
v-else |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>学号</view> |
|
|
<view class="title padding-bottom-sm"> |
|
|
<input :disabled="userInfo ? true : false" placeholder="请输入学号" name="input" type="text" v-model="studentID" /> |
|
|
<span class="text-red padding-right-xs" v-show="!(userinfo && userInfo.id)">*</span>学号 |
|
|
|
|
|
</view> |
|
|
|
|
|
<input |
|
|
|
|
|
:disabled="(userinfo && userInfo.id) ? true : false" |
|
|
|
|
|
name="input" |
|
|
|
|
|
placeholder="请输入学号" |
|
|
|
|
|
type="text" |
|
|
|
|
|
v-model="studentID" |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
</form> |
|
|
</form> |
|
|
<user-agreement v-if="!userInfo" @changeIntentions='changeIntentions'></user-agreement> |
|
|
<user-agreement @changeIntentions="changeIntentions" v-if="!(userinfo && userInfo.id)"></user-agreement> |
|
|
<button v-show="!userInfo" class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleSubmitUserInfo">确认提交</button> |
|
|
<button |
|
|
|
|
|
@tap="handleSubmitUserInfo" |
|
|
|
|
|
class="bg-cyan margin primary-btn" |
|
|
|
|
|
hover-class="cc-active" |
|
|
|
|
|
v-show="!(userinfo && userInfo.id)" |
|
|
|
|
|
>确认提交</button> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { |
|
|
import { showToast } from 'common/script/util'; |
|
|
showToast |
|
|
import { SUBMIT_USER_INFO } from 'api/api'; |
|
|
} from 'common/script/util'; |
|
|
import { mapState, mapMutations } from 'vuex'; |
|
|
import { |
|
|
|
|
|
SUBMIT_USER_INFO |
|
|
|
|
|
} from 'api/api'; |
|
|
|
|
|
import { mapState,mapMutations } from 'vuex'; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
name: '', |
|
|
name: '', |
|
|
idCard: '', |
|
|
idCard: '', |
|
|
phone: '', |
|
|
phone: '', |
|
|
identitys: [{ |
|
|
identitys: [ |
|
|
|
|
|
{ |
|
|
value: '0', |
|
|
value: '0', |
|
|
name: '学生', |
|
|
name: '学生', |
|
|
}, |
|
|
}, |
|
@ -68,12 +113,12 @@ |
|
|
], |
|
|
], |
|
|
studentID: '', |
|
|
studentID: '', |
|
|
current: 0, |
|
|
current: 0, |
|
|
agree: false |
|
|
agree: false, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
created() { |
|
|
created() { |
|
|
if(this.userInfo){ |
|
|
if (this.userInfo) { |
|
|
this.name = this.userInfo.name; |
|
|
this.name = this.userInfo.name; |
|
|
this.idCard = this.userInfo.idCard; |
|
|
this.idCard = this.userInfo.idCard; |
|
|
this.phone = this.userInfo.phone; |
|
|
this.phone = this.userInfo.phone; |
|
@ -82,7 +127,7 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
computed: mapState('user', ['userInfo','pagePath']), |
|
|
computed: mapState('user', ['userInfo', 'pagePath']), |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
...mapMutations('user', ['setUserInfo']), |
|
|
...mapMutations('user', ['setUserInfo']), |
|
@ -95,7 +140,7 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
changeIntentions(data){ |
|
|
changeIntentions(data) { |
|
|
this.agree = data; |
|
|
this.agree = data; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -106,38 +151,27 @@ |
|
|
try { |
|
|
try { |
|
|
if (!this.checkRules()) return; |
|
|
if (!this.checkRules()) return; |
|
|
|
|
|
|
|
|
const { |
|
|
const { name, idCard, phone, studentID, current } = this; |
|
|
name, |
|
|
|
|
|
idCard, |
|
|
|
|
|
phone, |
|
|
|
|
|
studentID, |
|
|
|
|
|
current |
|
|
|
|
|
} = this; |
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
param: { |
|
|
param: { |
|
|
idCard, |
|
|
idCard, |
|
|
name, |
|
|
name, |
|
|
no: studentID, |
|
|
no: studentID, |
|
|
phone, |
|
|
phone, |
|
|
post: current |
|
|
post: current, |
|
|
} |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const res = await this.$http.post(SUBMIT_USER_INFO, params); |
|
|
const res = await this.$http.post(SUBMIT_USER_INFO, params); |
|
|
const { |
|
|
const { success, code, msg, data } = res.data; |
|
|
success, |
|
|
|
|
|
code, |
|
|
|
|
|
msg, |
|
|
|
|
|
data |
|
|
|
|
|
} = res.data; |
|
|
|
|
|
if (success && code === 200) { |
|
|
if (success && code === 200) { |
|
|
this.success = true; |
|
|
this.success = true; |
|
|
this.setUserInfo(data); |
|
|
this.setUserInfo(data); |
|
|
this.openPage(pagePath) |
|
|
this.openPage(pagePath); |
|
|
} else { |
|
|
} else { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: msg || '提交基本信息成功', |
|
|
title: msg || '提交基本信息成功', |
|
|
icon: 'none' |
|
|
icon: 'none', |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
@ -145,7 +179,7 @@ |
|
|
if (error.msg) { |
|
|
if (error.msg) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: error.msg || '提交基本信息失败', |
|
|
title: error.msg || '提交基本信息失败', |
|
|
icon: 'none' |
|
|
icon: 'none', |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -153,7 +187,7 @@ |
|
|
|
|
|
|
|
|
// 验证信息 |
|
|
// 验证信息 |
|
|
checkRules() { |
|
|
checkRules() { |
|
|
const { name,idCard,phone,identitys,studentID,agree } = this; |
|
|
const { name, idCard, phone, identitys, studentID, agree } = this; |
|
|
if (!name) { |
|
|
if (!name) { |
|
|
showToast('请输入姓名'); |
|
|
showToast('请输入姓名'); |
|
|
return; |
|
|
return; |
|
@ -174,7 +208,7 @@ |
|
|
showToast('请输入学号'); |
|
|
showToast('请输入学号'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if(!agree) { |
|
|
if (!agree) { |
|
|
showToast('请选择是否同意《用户服务协议》和《隐私政策》'); |
|
|
showToast('请选择是否同意《用户服务协议》和《隐私政策》'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -199,11 +233,11 @@ |
|
|
return idCardExg.test(idCard); |
|
|
return idCardExg.test(idCard); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.primary-btn { |
|
|
.primary-btn { |
|
|
border-radius: 15rpx; |
|
|
border-radius: 15rpx; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|