|
@@ -10,7 +10,7 @@
|
|
|
import { useUserStore } from '../../../../store'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
|
|
|
-import { getBroker, getVendorAppInfo } from '../../../../core/libs/requests'
|
|
|
+import { getBroker, getVendorAppInfo, updateProfile } from '../../../../core/libs/requests'
|
|
|
import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
|
|
|
import { messages } from '../../../../core/libs/messages'
|
|
|
import { useMessage } from 'wot-design-uni'
|
|
@@ -25,6 +25,38 @@ const { isLogined, userInfo } = storeToRefs(userStore)
|
|
|
const { data, run: setData } = useRequest(() =>
|
|
|
getBroker({ brokerId: String(userInfo.value.userId) }),
|
|
|
)
|
|
|
+
|
|
|
+const onChooseAvatar = () =>{
|
|
|
+ uni.chooseMedia({
|
|
|
+ mediaType:['image'],
|
|
|
+ count:1,
|
|
|
+ success:(res)=>{
|
|
|
+ const tempFilePaths = res.tempFiles
|
|
|
+ uni.uploadFile({
|
|
|
+ url:`${import.meta.env.VITE_SERVER_BASEURL}/app-api/infra/file/upload`,
|
|
|
+ name:"file",
|
|
|
+ filePath: tempFilePaths[0].tempFilePath,
|
|
|
+ success (res){
|
|
|
+ let img = JSON.parse(res.data)
|
|
|
+ updateProfile({headImgUrl:img.data,id:data.value.id}).then(()=>{
|
|
|
+ uni.showToast({
|
|
|
+ title: '头像更新成功',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
+ })
|
|
|
+ setData()
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
const logout = () => {
|
|
|
uni.showModal({
|
|
|
title: messages.mine.setting.logoutMessageText,
|
|
@@ -45,7 +77,9 @@ onMounted(async () => {
|
|
|
<view class="bg-white p-[16px] flex-grow flex flex-col gap-8.5">
|
|
|
<SectionHeading size="sm" :title="'头像'">
|
|
|
<template #append>
|
|
|
- <wd-img width="28" height="28" round custom-class="" :src="data?.headImgUrl" />
|
|
|
+ <view class="relative">
|
|
|
+ <wd-img width="28" @click="onChooseAvatar" height="28" round custom-class="relative z-0" :src="data?.headImgUrl" />
|
|
|
+ </view>
|
|
|
</template>
|
|
|
</SectionHeading>
|
|
|
<SectionHeading size="sm" :title="'姓名'" :end-text="String(data?.brokerName)"></SectionHeading>
|