Commit db23adb9 authored by 罗林杰's avatar 罗林杰

修改图片上传

parent 5769fee8
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<script> <script>
import ELM from '@/components/elm-toast/index.vue'; import ELM from '@/components/elm-toast/index.vue';
import {updateUser, userDetail} from "../../api/user"; import {updateUser, userDetail} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default { export default {
data() { data() {
return { return {
...@@ -54,8 +55,10 @@ ...@@ -54,8 +55,10 @@
loadPage() { loadPage() {
userDetail(uni.getStorageSync('userInfo').memberId).then(res => { userDetail(uni.getStorageSync('userInfo').memberId).then(res => {
//处理图片 //处理图片
if (res.data.data.educationPictureUrl !== null && res.data.data.educationPictureUrl !== ''){ if (res.data.data.memEducationPictureId !== null && res.data.data.memEducationPictureId !== ''){
this.educationPictureUrl = (res.data.data.educationPictureUrl.replace(/\\/g, '/')) getOssUrl(res.data.data.memEducationPictureId).then(imgRes => {
this.educationPictureUrl = imgRes.data.data
})
} }
}) })
}, },
......
...@@ -237,6 +237,7 @@ ...@@ -237,6 +237,7 @@
import {updateUser, userDetail} from "../../api/user"; import {updateUser, userDetail} from "../../api/user";
import {calculateAge, parseDate} from "../../common"; import {calculateAge, parseDate} from "../../common";
import {getCity, getValue} from "../../common/options"; import {getCity, getValue} from "../../common/options";
import {getOssUrl} from "../../api/article";
export default { export default {
data() { data() {
...@@ -422,15 +423,21 @@ import {updateUser, userDetail} from "../../api/user"; ...@@ -422,15 +423,21 @@ import {updateUser, userDetail} from "../../api/user";
userDetail(uni.getStorageSync('userInfo').memberId).then(res => { userDetail(uni.getStorageSync('userInfo').memberId).then(res => {
this.userInfo = res.data.data this.userInfo = res.data.data
//处理头像 //处理头像
if (this.judgment(res.data.data.avatarUrl)){ if (this.judgment(res.data.data.avatar)){
this.userInfo.avatarUrl = (res.data.data.avatarUrl.replace(/\\/g, '/')) getOssUrl(res.data.data.avatar).then(imgRes => {
this.userInfo.avatarUrl=imgRes.data.data
})
} }
//处理信息图片 //处理信息图片
if (this.judgment(res.data.data.pictureUrls)){ if (this.judgment(res.data.data.memPictureId)){
this.userInfo.pictureUrls = res.data.data.pictureUrls.split(',') const urlArray = JSON.parse(res.data.data.memPictureId)
this.userInfo.pictureUrls.forEach((item, index) => { let url = []
this.userInfo.pictureUrls[index] = (item.replace(/\\/g, '/')) urlArray.id.forEach(item => {
getOssUrl(item).then(imgRes => {
url.push(imgRes.data.data)
})
}) })
this.userInfo.pictureUrls = url
} }
//处理学历 //处理学历
if (this.judgment(res.data.data.memMaxEducation)){ if (this.judgment(res.data.data.memMaxEducation)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment