app验收反馈
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='head'>
|
||||
<image class="head-img" src="/static/head.png"></image>
|
||||
<Cn-page :loading="loading">
|
||||
<view slot="body">
|
||||
<view class="head">
|
||||
<image class="head-img" :src="userInfo.avatar" v-if="userInfo.avatar"></image>
|
||||
<image class="head-img" src="/static/head.png" v-else></image>
|
||||
<view class="head-setup">
|
||||
<view class="head-setup-item" @click="take('album')">从相册选一张</view>
|
||||
<view class="head-setup-item" @click="take('camera')">拍一张照片</view>
|
||||
@@ -12,29 +13,52 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { uploadImage, getImageUrl } from '@/common/api/basic'
|
||||
import { apiUpdateUser } from '@/common/api/user'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
take (type) {
|
||||
take(type) {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: [type],
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
uploadImage(res.tempFilePaths[0]).then((res) => {
|
||||
console.log(res)
|
||||
let result = JSON.parse(res[1].data)
|
||||
apiUpdateUser({
|
||||
headSculpture: result.data.minFileUrl,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
getImageUrl(result.data.minFileUrl).then((url) => {
|
||||
console.log(url.data)
|
||||
this.userInfo.headSculpture = result.data.minFileUrl
|
||||
this.userInfo.avatar = url.data
|
||||
console.warn(this.userInfo)
|
||||
uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo)
|
||||
this.$forceUpdate()
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.head {
|
||||
|
||||
.head-img {
|
||||
height: 750rpx;
|
||||
width: 750rpx;
|
||||
@@ -48,7 +72,7 @@ export default {
|
||||
padding-bottom: 60rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.head-setup-item{
|
||||
.head-setup-item {
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
@@ -56,4 +80,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user