【银保app】查看和上传头像

This commit is contained in:
li.yuetong
2022-11-07 16:35:51 +08:00
parent ec595b854f
commit bfee576b60
2 changed files with 28 additions and 8 deletions

View File

@@ -343,12 +343,12 @@ export default {
methods:{
setMarginTop(){
EWebBridge.webCallAppInJs("top_bar_height").then(data => {
let result = JSON.parse(data)
if(result){
// 获取高度成功
let height = result.height
// 设置高度
this.marginTop = height
console.log(data,'top_bar_height')
if(data){
// 获取高度成功
let height = data.height
// 设置高度
this.marginTop = height
}
})
},

View File

@@ -8,7 +8,8 @@
<div style="display:flex;justify-content: flex-start;padding: 65px 15px 15px 20px;align-items: center;">
<div style="width:60px;">
<img style="width:100%;" src="@/assets/YB_APP/images/25.png">
<!-- <img style="width:100%;" src="@/assets/YB_APP/images/25.png" @click="uploadHeadImage(item)"> -->
<img style="width:100%;" :src="imagePath" @click="uploadHeadImage()">
</div>
<div style="margin-left:15px;">
<p style="color:#fff;padding: 3px;display: flex;align-items: center;">
@@ -59,6 +60,7 @@
<script>
import { Icon, Cell } from 'vant'
import { homeConfigYB } from '@/api/YB_APP/index'
import imagePath from '@/assets/YB_APP/images/25.png'
export default {
name: 'mine',
components: {
@@ -68,7 +70,8 @@ export default {
data() {
return {
messages:false,
menu1:[]
menu1:[],
imagePath: imagePath //新头像URL
}
},
mounted(){
@@ -96,6 +99,23 @@ export default {
}
})
},
uploadHeadImage(){
EWebBridge.webCallAppInJs("head_image").then(data => {
console.log(data,'head_image')
let uploadResult = JSON.parse(data)
if(uploadResult.code==0){
// 头像上传成功
let uploadData = uploadResult.content
// 新头像URL
this.imagePath = uploadData.imageUrl
} else if(uploadResult.code==1) {
//头像选择或上传失败 错误信息
let errorMessage = uploadResult.message
// 提示异常信息
// 用户选择了头像预览
}
})
}
},
}
</script>