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

修改图片上传

parent 5769fee8
......@@ -25,6 +25,7 @@
<script>
import ELM from '@/components/elm-toast/index.vue';
import {updateUser, userDetail} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default {
data() {
return {
......@@ -54,8 +55,10 @@
loadPage() {
userDetail(uni.getStorageSync('userInfo').memberId).then(res => {
//处理图片
if (res.data.data.educationPictureUrl !== null && res.data.data.educationPictureUrl !== ''){
this.educationPictureUrl = (res.data.data.educationPictureUrl.replace(/\\/g, '/'))
if (res.data.data.memEducationPictureId !== null && res.data.data.memEducationPictureId !== ''){
getOssUrl(res.data.data.memEducationPictureId).then(imgRes => {
this.educationPictureUrl = imgRes.data.data
})
}
})
},
......
......@@ -237,6 +237,7 @@
import {updateUser, userDetail} from "../../api/user";
import {calculateAge, parseDate} from "../../common";
import {getCity, getValue} from "../../common/options";
import {getOssUrl} from "../../api/article";
export default {
data() {
......@@ -422,15 +423,21 @@ import {updateUser, userDetail} from "../../api/user";
userDetail(uni.getStorageSync('userInfo').memberId).then(res => {
this.userInfo = res.data.data
//处理头像
if (this.judgment(res.data.data.avatarUrl)){
this.userInfo.avatarUrl = (res.data.data.avatarUrl.replace(/\\/g, '/'))
if (this.judgment(res.data.data.avatar)){
getOssUrl(res.data.data.avatar).then(imgRes => {
this.userInfo.avatarUrl=imgRes.data.data
})
}
//处理信息图片
if (this.judgment(res.data.data.pictureUrls)){
this.userInfo.pictureUrls = res.data.data.pictureUrls.split(',')
this.userInfo.pictureUrls.forEach((item, index) => {
this.userInfo.pictureUrls[index] = (item.replace(/\\/g, '/'))
if (this.judgment(res.data.data.memPictureId)){
const urlArray = JSON.parse(res.data.data.memPictureId)
let url = []
urlArray.id.forEach(item => {
getOssUrl(item).then(imgRes => {
url.push(imgRes.data.data)
})
})
this.userInfo.pictureUrls = url
}
//处理学历
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