Files
zhxg_xsbdV1.0/pages/gather/gather.vue

356 lines
11 KiB
Vue
Raw Permalink Normal View History

2025-07-16 17:44:45 +08:00
<template>
<view class="gather">
<!-- 滚动通知 -->
<view class="notic">
<u-notice-bar :text="text1"></u-notice-bar>
</view>
<!-- 内容 -->
<u-form labelPosition="left" :model="model1" ref="uForm" :borderBottom="false" class="list">
<!-- 基本信息展示 -->
<u-form-item label="姓名" :labelWidth="120">
<text>{{ info.stu_name }}</text>
</u-form-item>
<u-form-item label="性别" :labelWidth="120">
<text>{{ info.gender }}</text>
</u-form-item>
<u-form-item label="民族" :labelWidth="120">
<text>{{ info.mz }}</text>
</u-form-item>
<u-form-item label="身份证号" :labelWidth="120">
<text>{{ info.sfzh }}</text>
</u-form-item>
<u-form-item label="院系" :labelWidth="120">
<text>{{ info.xy }}</text>
</u-form-item>
<u-form-item label="专业" :labelWidth="120">
<text>{{ info.zy }}</text>
</u-form-item>
<u-form-item label="班级" :labelWidth="120">
<text>{{ info.bj }}</text>
</u-form-item>
<u-form-item label="联系方式" :labelWidth="120">
<text>{{ info.phone }}</text>
</u-form-item>
<!-- 可编辑信息 -->
<u-form-item label="家长姓名" prop="userInfo.famName" :labelWidth="200">
<u--input v-model="model1.userInfo.famName" border="none" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="家长电话" prop="userInfo.famPhone" :labelWidth="200">
<u--input v-model="model1.userInfo.famPhone" border="none" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="与本人关系" prop="userInfo.famRelation" :labelWidth="200">
<u--input v-model="model1.userInfo.famRelation" border="none" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="家庭住址" prop="userInfo.address" :labelWidth="130">
<u--textarea v-model="model1.userInfo.address" placeholder="请输入详细家庭住址" height="80" border="none"
autoHeight />
</u-form-item>
<u-form-item label="是否退役复学" prop="userInfo.isRetired" :labelWidth="200" @click="showRetired = true;">
<u--input v-model="model1.userInfo.isRetired" border="none" placeholder="请选择" input-align="right"
readonly />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
<u-form-item label="是否建档立卡户" prop="userInfo.isFiling" :labelWidth="200" @click="showFiling = true;">
<u--input v-model="model1.userInfo.isFiling" border="none" placeholder="请选择" input-align="right"
readonly />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
<u-form-item label="本人是否残疾" prop="userInfo.isDisability" :labelWidth="200" @click="showDisability = true;">
<u--input v-model="model1.userInfo.isDisability" border="none" placeholder="请选择" input-align="right"
readonly />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
<u-form-item v-if="model1.userInfo.isDisability==='是'" label="残疾说明" prop="userInfo.disableDescript"
:labelWidth="200">
<u--input v-model="model1.userInfo.disableDescript" border="none" placeholder="请输入"
input-align="right" />
</u-form-item>
<u-form-item label="是否吸烟" prop="userInfo.isSmoke" :labelWidth="200" @click="showIsSmoke = true;">
<u--input v-model="model1.userInfo.isSmoke" border="none" placeholder="请选择" input-align="right"
readonly />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
<u-form-item label="是否早睡" prop="userInfo.isEarly" :labelWidth="200" @click="showIsEarly = true;">
<u--input v-model="model1.userInfo.isEarly" border="none" placeholder="请选择" input-align="right"
readonly />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
<u-form-item label="兴趣特长" prop="userInfo.hobby" :labelWidth="200">
<u--input v-model="model1.userInfo.hobby" border="none" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="修改密码" :labelWidth="200">
<u--input value="********" @click.native="doResetPwd" border="none" input-align="right"
placeholder="请输入" readonly />
</u-form-item>
</u-form>
<!-- 选择面板 -->
<u-action-sheet :show="showRetired" :actions="actions" title="选择是否退役复学" @close="showRetired = false"
@select="retiredSelect" />
<u-action-sheet :show="showFiling" :actions="actions" title="选择是否建档立卡户" @close="showFiling = false"
@select="filingSelect" />
<u-action-sheet :show="showDisability" :actions="actions" title="选择是否残疾" @close="showDisability = false"
@select="disabilitySelect" />
<u-action-sheet :show="showIsSmoke" :actions="actions" title="选择是否吸烟" @close="showIsSmoke = false"
@select="isSmokeSelect" />
<u-action-sheet :show="showIsEarly" :actions="actions" title="选择是否早睡" @close="showIsEarly = false"
@select="isEarlySelect" />
<!-- 密码弹窗 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="重置密码" :value="reset_pwd" placeholder="请输入新密码"
@confirm="dialogInputConfirm" />
</uni-popup>
<u-toast ref="uToast"></u-toast>
<zero-loading v-if="loading"></zero-loading>
<button @click="doEdit" style="margin:20rpx 30rpx 0 30rpx;background-color: #38B865;color:white;">保存</button>
<FloatBall />
</view>
</template>
<script>
import {
getUserInfo,
editInfo,
changePwd
} from "@/api/validApi.js";
import FloatBall from "@/pages/compoents/FloatBall.vue";
import {
isEmpty
} from "@/api/helpFunc.js";
export default {
components: {
FloatBall
},
data() {
return {
text1: '信息收集关系到报到情况,请如实填写',
model1: {
userInfo: {
phone: '',
address: '',
isSmoke: "",
isEarly: "",
hobby: "",
famName: "",
famPhone: "",
famRelation: "",
isRetired: "",
isFiling: "",
isDisability: "",
disableDescript: ""
},
},
reset_pwd: "",
info: {
stu_name: "",
gender: "",
mz: "",
sfzh: "",
xy: "",
zy: "",
bj: "",
phone: ""
},
actions: [{
name: '否'
},
{
name: '是'
},
],
loading: false,
showRetired: false,
showDisability: false,
showFiling: false,
showIsSmoke: false,
showIsEarly: false
}
},
created() {
this.getOwnInfo();
},
methods: {
async dialogInputConfirm(val) {
if (val.length < 6) {
this.$refs.uToast.show({
type: "error",
message: "密码长度不能小于6位",
duration: 1500,
})
} else {
let sdata = {
pwd: val
}
let res = await changePwd(sdata);
if (res.code == 200) {
this.$refs.uToast.show({
type: "success",
message: res.msg,
duration: 1500
})
} else {
this.$refs.uToast.show({
type: "error",
message: res.msg,
duration: 1500,
})
}
}
},
doResetPwd() {
this.$refs.inputDialog.open()
},
async doEdit() {
const sdata = {
famNowAddr: this.model1.userInfo.address,
famRelation: this.model1.userInfo.famRelation,
famName: this.model1.userInfo.famName,
famPhone: this.model1.userInfo.famPhone,
isRetired: this.model1.userInfo.isRetired,
isFiling: this.model1.userInfo.isFiling,
isDisability: this.model1.userInfo.isDisability,
disableDescript: this.model1.userInfo.disableDescript,
isSmoke: this.model1.userInfo.isSmoke,
isEarly: this.model1.userInfo.isEarly,
hobby: this.model1.userInfo.hobby
}
if (!sdata.famRelation) {
this.$refs.uToast.show({
type: "error",
message: "与本人关系不能为空",
duration: 1500
});
return;
}
if (!sdata.famNowAddr) {
this.$refs.uToast.show({
type: "error",
message: "地址数据不能为空",
duration: 1500
});
return;
}
if (!sdata.famName) {
this.$refs.uToast.show({
type: "error",
message: "家长姓名不能为空",
duration: 1500
});
return;
}
if (!sdata.famPhone) {
this.$refs.uToast.show({
type: "error",
message: "家长电话不能为空",
duration: 1500
});
return;
}
if (isEmpty(sdata.isSmoke)) {
this.$refs.uToast.show({
type: "error",
message: "请选择是否吸烟",
duration: 1500
});
return;
}
if (isEmpty(sdata.isEarly)) {
this.$refs.uToast.show({
type: "error",
message: "请选择是否早睡",
duration: 1500
});
return;
}
if (isEmpty(sdata.hobby)) {
this.$refs.uToast.show({
type: "error",
message: "请输入兴趣特长",
duration: 1500
});
return;
}
this.loading = true;
let res = await editInfo(sdata);
this.loading = false;
if (res.code == 200) {
this.$refs.uToast.show({
type: "success",
message: "修改成功",
duration: 1500,
});
uni.redirectTo({
url: "/pages/newindex/newindex"
});
}
},
async getOwnInfo() {
let res = await getUserInfo();
if (res.code == 200) {
let data = res.data;
this.info.stu_name = data.xsxm;
this.info.gender = data.xb;
this.info.mz = data.mz;
this.info.sfzh = data.sfzh;
this.info.xy = data.xy;
this.info.zy = data.zy;
this.info.bj = data.bj;
this.info.phone = data.sjh;
this.model1.userInfo.address = data.famNowAddr;
this.model1.userInfo.famRelation = data.famRelation;
this.model1.userInfo.famName = data.famName;
this.model1.userInfo.famPhone = data.famPhone;
this.model1.userInfo.isRetired = data.isRetired;
this.model1.userInfo.isFiling = data.isFiling;
this.model1.userInfo.isDisability = data.isDisability;
this.model1.userInfo.disableDescript = data.disableDescript;
this.model1.userInfo.isSmoke = data.isSmoke;
this.model1.userInfo.isEarly = data.isEarly;
this.model1.userInfo.hobby = data.hobby;
}
},
retiredSelect(e) {
this.model1.userInfo.isRetired = e.name
},
filingSelect(e) {
this.model1.userInfo.isFiling = e.name;
},
disabilitySelect(e) {
this.model1.userInfo.isDisability = e.name;
if (e.name == "否") {
this.model1.userInfo.disableDescript = "";
}
},
isSmokeSelect(e) {
this.model1.userInfo.isSmoke = e.name;
},
isEarlySelect(e) {
this.model1.userInfo.isEarly = e.name;
},
}
}
</script>
<style lang="less" scoped>
.gather {
.list {
padding: 0 10rpx;
background: #fff;
border-radius: 16rpx;
margin-top: 20rpx;
}
.u-form-item {
border-top: 1px solid #efefef;
}
.u-form-item:first-child {
border-top: none;
}
}
</style>