|
@@ -1,55 +1,70 @@
|
|
|
<template>
|
|
|
- <div class="card" style="margin-bottom: 20px">
|
|
|
- <h3><strong>个人资料</strong></h3>
|
|
|
- <p>昵称</p>
|
|
|
- <van-cell-group>
|
|
|
- <van-field
|
|
|
- placeholder=" "
|
|
|
- v-model="personName"
|
|
|
- :error="personError"
|
|
|
- @click="personError=false"
|
|
|
- required
|
|
|
- maxlength="10"
|
|
|
- />
|
|
|
- </van-cell-group>
|
|
|
- <p>性别</p>
|
|
|
- <van-radio-group v-model="gender">
|
|
|
- <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px">男</van-radio>
|
|
|
- <van-radio name="1" checked-color="#fd6740">女</van-radio>
|
|
|
- </van-radio-group>
|
|
|
- <p>微信号</p>
|
|
|
- <van-cell-group>
|
|
|
- <van-field
|
|
|
- placeholder=" "
|
|
|
- v-model="weixinName"
|
|
|
- :error="weixinError"
|
|
|
- @click="weixinError=false"
|
|
|
- required
|
|
|
- maxlength="20"
|
|
|
- />
|
|
|
- </van-cell-group>
|
|
|
- <p>宿舍区</p>
|
|
|
- <van-radio-group v-model="dormDistrict">
|
|
|
- <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px">南区</van-radio>
|
|
|
- <van-radio name="1" checked-color="#fd6740" style="float: left; margin-right: 20px">西南</van-radio>
|
|
|
- <van-radio name="2" checked-color="#fd6740" style="float: left; margin-right: 20px">斋区</van-radio>
|
|
|
- <van-radio name="3" checked-color="#fd6740">西丽</van-radio>
|
|
|
- </van-radio-group>
|
|
|
- </div>
|
|
|
+ <div class="card" style="margin-bottom: 20px">
|
|
|
+ <van-row>
|
|
|
+ <van-col span="14">
|
|
|
+ <h3><strong>个人资料</strong></h3>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="6" style="">
|
|
|
+ <p style="border-bottom: solid 1px #e4e4e4" @click="toggleReadOnly()">{{isReadonly ? "编辑" : "保存"}}</p>
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <p>昵称</p>
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field
|
|
|
+ placeholder=" "
|
|
|
+ v-model="personName"
|
|
|
+ :error="personError"
|
|
|
+ @click="personError=false"
|
|
|
+ required
|
|
|
+ maxlength="10"
|
|
|
+ :readonly="isReadonly"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
+ <p>性别</p>
|
|
|
+ <van-radio-group v-model="gender">
|
|
|
+ <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly"
|
|
|
+ >男</van-radio>
|
|
|
+ <van-radio name="1" checked-color="#fd6740" :disabled="isReadonly"
|
|
|
+ >女</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ <p>微信号</p>
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field
|
|
|
+ placeholder=" "
|
|
|
+ v-model="weixinName"
|
|
|
+ :error="weixinError"
|
|
|
+ @click="weixinError=false"
|
|
|
+ required
|
|
|
+ maxlength="20"
|
|
|
+ :readonly="isReadonly"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
+ <p>宿舍区</p>
|
|
|
+ <van-radio-group v-model="dormDistrict">
|
|
|
+ <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">南区</van-radio>
|
|
|
+ <van-radio name="1" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">西南</van-radio>
|
|
|
+ <van-radio name="2" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">斋区</van-radio>
|
|
|
+ <van-radio name="3" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">桂庙</van-radio>
|
|
|
+ <van-radio name="4" checked-color="#fd6740" :disabled="isReadonly">西丽</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {
|
|
|
+ import { Row, Col,
|
|
|
CellGroup, Field,
|
|
|
RadioGroup, Radio,
|
|
|
} from 'vant';
|
|
|
import {BasicFunction} from "../connector/basic-service";
|
|
|
+
|
|
|
export default {
|
|
|
name: "schoolidCard",
|
|
|
components: {
|
|
|
|
|
|
[CellGroup.name]: CellGroup, [Field.name]: Field,
|
|
|
[RadioGroup.name]: RadioGroup, [Radio.name]: Radio,
|
|
|
+ [Row.name]: Row, [Col.name]: Col,
|
|
|
+
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -59,9 +74,42 @@
|
|
|
personError: false,
|
|
|
weixinName: '',
|
|
|
weixinError: false,
|
|
|
+ isReadonly: true,
|
|
|
+ userDo: {},
|
|
|
+ reviewDo: {},
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ uploadNameChange: function () {
|
|
|
+ BasicFunction.get_data("smartUsers/updateBatch", function (response) {
|
|
|
+ console.log("------ Data Rcvd in PresentReg --------");
|
|
|
+ console.log(response);
|
|
|
+ if (response.ret === "10000") {
|
|
|
+ history.go(0);
|
|
|
+ } else {
|
|
|
+ // 注册失败的处理
|
|
|
+ Toast.fail("上传失败,请检查网络");
|
|
|
+ }
|
|
|
+ }, [this.userDo]);
|
|
|
+ },
|
|
|
+ uploadReviewChange: function () {
|
|
|
+ BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
|
|
|
+ console.log("------ Data Rcvd in PresentReg --------");
|
|
|
+ console.log(response);
|
|
|
+ if (response.ret === "10000") {
|
|
|
+ history.go(0);
|
|
|
+ } else {
|
|
|
+ // 注册失败的处理
|
|
|
+ Toast.fail("上传失败,请检查网络");
|
|
|
+ }
|
|
|
+ }, [this.reviewDo]);
|
|
|
+ },
|
|
|
+ toggleReadOnly: function () {
|
|
|
+ if (!this.isReadonly){
|
|
|
+ this.savePage()
|
|
|
+ }
|
|
|
+ this.isReadonly = !this.isReadonly;
|
|
|
+ },
|
|
|
savePage() {
|
|
|
// 检验输入
|
|
|
// var userId = localStorage.getItem(....
|
|
@@ -74,66 +122,54 @@
|
|
|
return;
|
|
|
}
|
|
|
// post_present()
|
|
|
- let objectToUpload = {
|
|
|
- "reviewId": "",
|
|
|
- "userId": userId,
|
|
|
- "dormDistrict": parseInt(this.dormDistrict),
|
|
|
- "userSex": parseInt(this.gender)
|
|
|
- };
|
|
|
- console.log(objectToUpload);
|
|
|
- BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
|
|
|
+ this.userDo.name = this.weixinName;
|
|
|
+ this.uploadNameChange();
|
|
|
+ this.reviewDo.gender = this.gender;
|
|
|
+ this.reviewDo.dormDistrict = this.dormDistrict;
|
|
|
+ this.uploadReviewChange();
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getIdentityInfo: function (obj) {
|
|
|
+ //this;
|
|
|
+ var userId = localStorage.getItem("frontend-userid");
|
|
|
+ window.schoolIdCard = this;
|
|
|
+ BasicFunction.get_data("smartUsers/list?uid=" + userId, function (response) {
|
|
|
console.log("------ Data Rcvd in PresentReg --------");
|
|
|
console.log(response);
|
|
|
if (response.ret === "10000") {
|
|
|
- // 不需要 设置 SessionID, 已经自动保存在jSessionID中
|
|
|
- this.$router.push('index');
|
|
|
+ var t = response.model.list;
|
|
|
+ window.schoolIdCard.personName = t[0].name; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
|
|
|
+ window.schoolIdCard.userDo = t[0];
|
|
|
} else {
|
|
|
// 注册失败的处理
|
|
|
- Toast.fail("上传失败,请检查网络");
|
|
|
+ Toast.fail("获取失败,请检查网络");
|
|
|
}
|
|
|
- }, [objectToUpload]);
|
|
|
- // this.$router.push('index');
|
|
|
+ }, [{}]);
|
|
|
},
|
|
|
-
|
|
|
- getIndentityInfo: function (obj) {
|
|
|
- //this;
|
|
|
+ getReviewInfo:function (obj) {
|
|
|
+ var userId = localStorage.getItem("frontend-userid");
|
|
|
window.schoolIdCard = this;
|
|
|
- BasicFunction.get_data("", function (response) {
|
|
|
+ BasicFunction.get_data("smartIdentity/list?userId=" + userId, function (response) {
|
|
|
console.log("------ Data Rcvd in PresentReg --------");
|
|
|
console.log(response);
|
|
|
if (response.ret === "10000") {
|
|
|
var t = response.model.list;
|
|
|
- window.schoolIdCard.gender = t[0].gender; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
|
|
|
+ window.schoolIdCard.gender = t[0].userSex; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
|
|
|
+ window.schoolIdCard.dormDistrict = t[0].dormDistrict;
|
|
|
+ window.schoolIdCard.reviewDo = t[0];
|
|
|
} else {
|
|
|
- // 注册失败的处理
|
|
|
- Toast.fail("上传失败,请检查网络");
|
|
|
+
|
|
|
+ Toast.fail("获取失败,请检查网络");
|
|
|
}
|
|
|
}, [{}]);
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
created: function () {
|
|
|
window.schoolIdCard = this;
|
|
|
- getIdentityInfo(window.schoolIdCard);
|
|
|
- BasicFunction.get_data("", function (response) {
|
|
|
- console.log("------ Data Rcvd in PresentReg --------");
|
|
|
- console.log(response);
|
|
|
- if (response.ret === "10000") {
|
|
|
- var t = response.model.list;
|
|
|
- window.schoolIdCard.weixinID = t[0].gender; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
|
|
|
- } else {
|
|
|
- // 注册失败的处理
|
|
|
- Toast.fail("上传失败,请检查网络");
|
|
|
- }
|
|
|
- }, [{}]);
|
|
|
- if (this.$route.query.present) {
|
|
|
- let present = this.$route.query.present;
|
|
|
- console.log(present);
|
|
|
- this.gender = present.gender.toString();
|
|
|
- this.dormDistrict = present.dormDistrict.toString();
|
|
|
- this.personName = present.name;
|
|
|
- this.weixinName = present.weixinID;
|
|
|
- }
|
|
|
+ this.getIdentityInfo(window.schoolIdCard);
|
|
|
+ this.getReviewInfo(window.schoolIdCard);
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -142,13 +178,16 @@
|
|
|
p, h3 {
|
|
|
color: #fd6740;
|
|
|
}
|
|
|
+
|
|
|
h3 {
|
|
|
padding: 5px;
|
|
|
border-bottom: solid 1px #e4e4e4;
|
|
|
}
|
|
|
+
|
|
|
p {
|
|
|
- padding-top: 3px ;
|
|
|
+ padding-top: 3px;
|
|
|
}
|
|
|
+
|
|
|
.card {
|
|
|
background-color: white;
|
|
|
margin: 20px 20px;
|