From 36b348a533ff2bd3dbeb6a28e798edf274ae8578 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 14 Oct 2021 18:29:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 8 +- src/pages/setting/person/index.vue | 233 +++++++++++++++-------------- src/setting.js | 4 +- 3 files changed, 123 insertions(+), 122 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 9ea9b20..1bfae20 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,11 +1,5 @@ import Setting from "@/setting"; -// let host = Setting.apiBaseURL -// let host = "http://192.168.31.151:9000/"; // 榕 -// let host = 'http://192.168.31.125:9000/'; // 坤 -// let host = 'http://192.168.31.137:9000/'; // 赓 -let host = "http://39.108.250.202:9000/"; // 测试服 - - +let host = Setting.apiBaseURL let uploadURL = Setting.upload.apiURL; let host1 = "http://39.108.250.202:8080/"; // 川大 diff --git a/src/pages/setting/person/index.vue b/src/pages/setting/person/index.vue index f7a587b..9703417 100644 --- a/src/pages/setting/person/index.vue +++ b/src/pages/setting/person/index.vue @@ -6,10 +6,10 @@
点击更改头像
@@ -389,6 +389,7 @@ import { mapState, mapActions } from "vuex"; export default { data() { return { + token: util.local.get(Setting.tokenKey), personalInformation: { userName: "", name: "", @@ -526,7 +527,7 @@ export default { ]), getProvince() { this.$get(this.api.queryProvince).then(res => { - this.provinceList = res.message; + this.provinceList = res.list; }).catch(res => { }); }, @@ -549,9 +550,9 @@ export default { let provinceId = type == 1 ? this.personalInformation.provinceId : this.archivesList[index].provinceId; this.$get(this.api.queryCity, { provinceId }).then(res => { if (type == 1) { - this.cityList = res.message; + this.cityList = res.list; } else { - this.archivesList[index].cityList = res.message; + this.archivesList[index].cityList = res.list; } }).catch(res => { }); @@ -565,7 +566,7 @@ export default { // 获取学校名称 getSchoolData() { this.$get(this.api.querySchoolData, { schoolName: "", provinceId: "", cityId: "" }).then(res => { - this.schoolList = res.message; + this.schoolList = res.list; }).catch(res => { }); }, @@ -593,57 +594,61 @@ export default { } }, getdata() { - this.$get(`${this.api.userinfo}/${this.userId}`) - .then(res => { - this.personalInformation = Object.assign(this.personalInformation, res.data.userInfo[0]); - this.personalInformation.idNumber = this.personalInformation.IDNumber; - this.originAccount = this.personalInformation.account; - this.archivesList = res.data.userPersonalFile; - this.$nextTick(() => { - if (this.personalInformation.provinceId) { - this.getCityData(1); - } - if (this.archivesList.length != 0) { - this.archivesList.forEach((e, k) => { - this.$set(e, "subjectList", this.subjectList); - this.$set(e, "disciplineId", e.disciplineId ? e.disciplineId : ""); - this.$set(e, "disciplineName", e.disciplineName ? e.disciplineName : ""); - this.$set(e, "professionalClassId", e.professionalClassId ? e.professionalClassId : ""); - this.$set(e, "professionalClassName", e.professionalClassName ? e.professionalClassName : ""); - this.$set(e, "professionalId", e.professionalId ? e.professionalId : ""); - this.$set(e, "professionalName", e.professionalName ? e.professionalName : ""); - this.$set(e, "schoolId", e.schoolId ? e.schoolId : ""); - this.$set(e, "schoolName", e.schoolName ? e.schoolName : ""); - - if (e.disciplineId) { - this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => { - this.$set(e, "ProfessionalClassList", res.message); - }).catch(res => { - }); - } else { - this.$set(e, "ProfessionalClassList", []); - } - if (e.professionalClassId) { - this.$get(this.api.queryCourseProfessional, { professionalClassId: e.professionalClassId }).then(res => { - this.$set(e, "ProfessionalList", res.message); - }).catch(res => { - }); - } else { - this.$set(e, "ProfessionalList", []); - } - // if(e.provinceId){ - // this.$get(this.api.queryCity,{provinceId: e.provinceId}).then(res => { - // this.$set(e, 'cityList', res.message); - // }).catch(res => {}); - // }else{ - // this.$set(e, 'cityList', []); - // } - }); - } else { - this.concatArch(1); - } - }); - }) + this.$get(this.api.queryUserInfoDetails).then(res => { + let userInfo = res.result.hrUserInfo; + let schoolId = userInfo.schoolId; + this.personalInformation = Object.assign(userInfo, res.result.userAccountList[0]); + this.personalInformation.schoolId = schoolId; + this.personalInformation.accountId = userInfo.id; + this.originAccount = this.personalInformation.account; + this.archivesList = res.result.personalFileList; + if (userInfo.userAvatars) this.avatar = userInfo.userAvatars; + + this.$nextTick(() => { + if (this.personalInformation.provinceId) { + this.getCityData(1); + } + if (this.archivesList.length != 0) { + this.archivesList.forEach((e, k) => { + this.$set(e, "subjectList", this.subjectList); + this.$set(e, "disciplineId", e.disciplineId ? e.disciplineId : ""); + this.$set(e, "disciplineName", e.disciplineName ? e.disciplineName : ""); + this.$set(e, "professionalClassId", e.professionalClassId ? e.professionalClassId : ""); + this.$set(e, "professionalClassName", e.professionalClassName ? e.professionalClassName : ""); + this.$set(e, "professionalId", e.professionalId ? e.professionalId : ""); + this.$set(e, "professionalName", e.professionalName ? e.professionalName : ""); + this.$set(e, "schoolId", e.schoolId ? e.schoolId : ""); + this.$set(e, "schoolName", e.schoolName ? e.schoolName : ""); + + if (e.disciplineId) { + this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => { + this.$set(e, "ProfessionalClassList", res.list); + }).catch(res => { + }); + } else { + this.$set(e, "ProfessionalClassList", []); + } + if (e.professionalClassId) { + this.$get(this.api.queryCourseProfessional, { professionalClassId: e.professionalClassId }).then(res => { + this.$set(e, "ProfessionalList", res.list); + }).catch(res => { + }); + } else { + this.$set(e, "ProfessionalList", []); + } + // if(e.provinceId){ + // this.$get(this.api.queryCity,{provinceId: e.provinceId}).then(res => { + // this.$set(e, 'cityList', res.message); + // }).catch(res => {}); + // }else{ + // this.$set(e, 'cityList', []); + // } + }); + } else { + this.concatArch(1); + } + }); + }) .catch(err => { console.log(err); }); @@ -731,7 +736,7 @@ export default { // 获取学科类别 getSubject() { this.$get(this.api.queryCourseDiscipline).then(res => { - this.subjectList = res.message; + this.subjectList = res.list; }).catch(res => { }); }, @@ -776,7 +781,7 @@ export default { this.$get(this.api.queryCourseProfessionalClass, { disciplineId: item }).then(res => { this.archivesList.map(e => { if (e.disciplineId == item) { - e.ProfessionalClassList = res.message; + e.ProfessionalClassList = res.list; e.disciplineName = obj.disciplineName; } }); @@ -786,7 +791,7 @@ export default { }, getProfessionalClassData(value) { this.$get(this.api.queryCourseProfessionalClass, { disciplineId: value }).then(res => { - this.ProfessionalClassList = res.message; + this.ProfessionalClassList = res.list; }).catch(res => { }); }, @@ -826,7 +831,7 @@ export default { obj = e.ProfessionalClassList.find(r => { return r.professionalClassId === item; }); - e.ProfessionalList = res.message; + e.ProfessionalList = res.list; e.professionalClassName = obj.professionalClassName; } }); @@ -836,7 +841,7 @@ export default { }, getProfessionalData(value) { this.$get(this.api.queryCourseProfessional, { professionalClassId: value }).then(res => { - this.ProfessionalList = res.message; + this.ProfessionalList = res.list; }).catch(res => { }); }, @@ -865,35 +870,17 @@ export default { }, save() { let isEmpty = false; - this.archivesList.forEach((n, k) => { - if (!n.personalCareerId) isEmpty = true; - n.userId = this.userId; - }); - if (isEmpty) return util.warningMsg("请选择职业"); - if (this.accountReapeat) return util.warningMsg("该账号已存在"); + // this.archivesList.forEach((n, k) => { + // if (!n.personalCareerId) isEmpty = true; + // n.userId = this.userId; + // }); + // if (isEmpty) return util.warningMsg("请选择职业"); + // if (this.accountReapeat) return util.warningMsg("该账号已存在"); if (this.personalInformation.idNumber && !/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/.test(this.personalInformation.idNumber)) return util.warningMsg("请输入正确的证件号码"); - let personalInformation = this.personalInformation; - let userInfoEntity = { - idNumber: personalInformation.idNumber, - account: personalInformation.account, - cityId: personalInformation.cityId, - countries: personalInformation.countries, - dateBirth: personalInformation.dateBirth, - educationDegree: personalInformation.educationDegree, - email: personalInformation.email, - phone: personalInformation.phone, - provinceId: personalInformation.provinceId, - schoolId: personalInformation.schoolId, - sex: personalInformation.sex, - userId: this.userId, - userName: personalInformation.userName, - weChatID: personalInformation.weChatID - }; - let personalFileEntities = []; - this.archivesList.forEach((n, k) => { - personalFileEntities.push({ - cityId: n.cityId, - cityName: n.cityName, + let form = this.personalInformation; + let personalFileList = [] + this.archivesList.forEach((n,k) => { + n.personalCareerId && personalFileList.push({ disciplineId: n.disciplineId, disciplineName: n.disciplineName, personalCareerId: n.personalCareerId, @@ -906,19 +893,35 @@ export default { provinceName: n.provinceName, schoolId: n.schoolId, schoolName: n.schoolName, - userId: this.userId - }); - }); + userId: form.userId + }) + }) let data = { - userInfoEntity, - personalFileEntities - }; - this.$put(this.api.userinfoUpdate, data).then(res => { - this.setUserName(personalInformation.userName); - // bus.$emit('updateAccount',personalInformation.userName) - util.successMsg("提交成功!"); - }).catch(res => { - }); + userId: form.userId, + userAccountList: [{ + id: form.accountId, + account: form.account, + userId: form.userId, + }], + hrUserInfo: { + provinceId: form.provinceId, + cityId: form.cityId, + countries: form.countries, + dateBirth: form.dateBirth, + educationDegree: form.educationDegree, + idNumber: form.idNumber, + schoolId: form.schoolId, + sex: form.sex, + userId: form.userId, + userName: form.userName, + wechatId: form.wechatId + }, + personalFileList, + } + this.$post(this.api.updatePersonCenter,data).then(res => { + this.setUserName(form.userName); + this.$message.success('提交成功!') + }).catch(res => {}) }, emailCountdown() { let count = 60; @@ -969,10 +972,12 @@ export default { email: this.email, types: 1 }; - this.$post(this.api.sendEmailCode, data).then(res => { - if (res.errmessage == "success") { + this.$post(this.api.sendPhoneOrEmailCode, data).then(res => { + if(res.message.opener){ this.emailCountdown(); - this.emailOpener = res.data; + this.emailOpener = res.message.opener; + } else{ + util.errorMsg(res.message); } }).catch(res => { }); @@ -988,8 +993,8 @@ export default { code: this.emailCode, opener: this.emailOpener }; - this.$put(this.api.bingEmail, data).then(res => { - if (res.errmessage == "success") { + this.$put(this.api.bindPhoneOrEmail, data).then(res => { + if(res.status == 200){ util.successMsg("绑定成功"); this.personalInformation.email = this.email; this.emailVisible = false; @@ -1010,10 +1015,12 @@ export default { phone: this.phone, types: 2 }; - this.$post(this.api.sendPhoneCode, data).then(res => { - if (res.errmessage == "success") { + this.$post(this.api.sendPhoneOrEmailCode, data).then(res => { + if(res.message.opener){ this.phoneCountdown(); - this.phoneOpener = res.data; + this.phoneOpener = res.message.opener; + } else{ + util.errorMsg(res.message); } }).catch(res => { }); @@ -1029,8 +1036,8 @@ export default { code: this.phoneCode, opener: this.phoneOpener }; - this.$put(this.api.bindPhone, data).then(res => { - if (res.errmessage == "success") { + this.$put(this.api.bindPhoneOrEmail, data).then(res => { + if(res.status == 200){ util.successMsg("绑定成功"); this.personalInformation.phone = this.phone; this.phoneVisible = false; diff --git a/src/setting.js b/src/setting.js index 13aea02..8a44dd5 100644 --- a/src/setting.js +++ b/src/setting.js @@ -42,8 +42,8 @@ if (isHh) { schoolId = 2105; } else if (isDev) { jumpPath = "http://192.168.31.154:8087/"; - host = "http://39.108.250.202:9000/"; // 中台测试服 - // host = "http://192.168.31.151:9000/"; // 榕 + // host = "http://39.108.250.202:9000/"; // 中台测试服 + host = "http://192.168.31.151:9000/"; // 榕 // host = "http://192.168.31.125:9000/"; // 坤 // host = 'http://192.168.31.137:9000/'; // 赓 title = "职站服务端管理系统";