From 39b1952f46853df637db252ef7e28006c88573c7 Mon Sep 17 00:00:00 2001 From: zhusiyu <410827992@qq.com> Date: Wed, 2 Nov 2022 11:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E6=98=BE=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/screenAdaptation/api/commonInter.js | 5 ++ .../screenAdaptation/common/portrait.vue | 74 ++++++++++++------- .../pages/homePages/menuTop/interConfig.js | 17 ++++- .../homePages/menuTop/personMsgModal.vue | 43 ++++++++--- 4 files changed, 101 insertions(+), 38 deletions(-) diff --git a/src/views/screenAdaptation/api/commonInter.js b/src/views/screenAdaptation/api/commonInter.js index e9b3235..b1c82c1 100644 --- a/src/views/screenAdaptation/api/commonInter.js +++ b/src/views/screenAdaptation/api/commonInter.js @@ -52,4 +52,9 @@ export default { method:"get", isTestLogin:true }, + "getPersonTxBy": { + url: "person/getPersonTxByYw", + method: "get", + isTestLogin: false + }, } diff --git a/src/views/screenAdaptation/common/portrait.vue b/src/views/screenAdaptation/common/portrait.vue index d029184..07f4261 100644 --- a/src/views/screenAdaptation/common/portrait.vue +++ b/src/views/screenAdaptation/common/portrait.vue @@ -8,46 +8,68 @@ * 头像组件 * src */ - import interConfig from '../api/commonInter'; + import interConfig from '../api/commonInter.js'; import {Avatar} from 'ant-design-vue'; + import BaseConfig from '../../../global-llibs/base-config' import StaticParams from '../../../global-llibs/staticParams'; - export default{ - data(){ + + export default { + data() { return { imgUrl: this.$store.state.userStore.portraitUrl, } }, props: ['personId'], created() { - if(!this.imgUrl || this.imgUrl === "") { + if (!this.imgUrl || this.imgUrl === "") { this.getImgSrc(this.$props.personId) } }, + mounted() { + this.getImgSrc() + }, methods: { - showMessage(){ - //this.$emit('showMessage') + showMessage() { + this.$emit('showMessage') }, - getImgSrc: function (personId) { - if (personId && personId != '') { - this.InterfaceConfig.callInterface([{ - url: interConfig.getPersonTxByYw.url, - params: { - person_id: personId, - identity_id: 5, - }, - method: interConfig.getPersonTxByYw.method, - isTestLogin: interConfig.getPersonTxByYw.isTestLogin, - }], (result) => { - let resData = result[0].data; - if (result[0].status === 200) { - if (resData.success === true) { - this.imgUrl = StaticParams.getThumbUrl(resData.file_id + "." + resData.extension, 100, 100, 100); - this.$store.commit('userStore/setPortraitUrl', this.imgUrl); - } - } - }) + getImgSrc() { + let param = { + person_id: BaseConfig.userInfo.person_id_cookie, + identity_id: BaseConfig.userInfo.identity_id_cookie } - } + this.InterfaceConfig.callInterface([{ + url: interConfig.getPersonTxBy.url, + params: param, + method: interConfig.getPersonTxBy.method, + isTestLogin: interConfig.getPersonTxBy.isTestLogin, + }], (result) => { + // console.log('获取头像------', result) + if (result[0].data.file_id !== "") { + this.imgUrl = result[0].data.file_id + ',' + result[0].data.extension + } + }) + }, + // getImgSrc: function (personId) { + // if (personId && personId != '') { + // this.InterfaceConfig.callInterface([{ + // url: interConfig.getPersonTxByYw.url, + // params: { + // person_id: personId, + // identity_id: 5, + // }, + // method: interConfig.getPersonTxByYw.method, + // isTestLogin: interConfig.getPersonTxByYw.isTestLogin, + // }], (result) => { + // let resData = result[0].data; + // if (result[0].status === 200) { + // if (resData.success === true) { + // this.imgUrl = StaticParams.getThumbUrl(resData.file_id + "." + resData.extension, 100, 100, 100); + // this.$store.commit('userStore/setPortraitUrl', this.imgUrl); + // } + // } + // }) + // } + // } }, watch: { personId: function (newVal) { diff --git a/src/views/screenAdaptation/pages/homePages/menuTop/interConfig.js b/src/views/screenAdaptation/pages/homePages/menuTop/interConfig.js index 54d9862..bd6fc5c 100644 --- a/src/views/screenAdaptation/pages/homePages/menuTop/interConfig.js +++ b/src/views/screenAdaptation/pages/homePages/menuTop/interConfig.js @@ -9,9 +9,20 @@ export default { method: "post", isTestLogin: true }, - "personTx": { - url: "intellioa/sys/cloudPlatform/getPersonTxByYw", + //获取头像 + // "personTx": { + // url: "intellioa/sys/cloudPlatform/getPersonTxByYw", + // method: "get", + // isTestLogin: true + // }, + "getPersonTxByYw": { + url: "person/getPersonTxByYw", method: "get", - isTestLogin: true + isTestLogin: false + }, + "setPersonTxByYw": { + url: "person/setPersonTxByYw", + method: "post", + isTestLogin: false }, } \ No newline at end of file diff --git a/src/views/screenAdaptation/pages/homePages/menuTop/personMsgModal.vue b/src/views/screenAdaptation/pages/homePages/menuTop/personMsgModal.vue index 343b6f1..70335e3 100644 --- a/src/views/screenAdaptation/pages/homePages/menuTop/personMsgModal.vue +++ b/src/views/screenAdaptation/pages/homePages/menuTop/personMsgModal.vue @@ -28,7 +28,7 @@
- 更换图片 - 保存头像 + 保存头像 仅支持.jpg.jpeg.png.bmp图片格式
@@ -67,11 +67,12 @@