|
|
@ -1,5 +1,6 @@
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { getMemberProfileAPI, postMemberProfileAPI } from '@/services/profile'
|
|
|
|
import { getMemberProfileAPI, postMemberProfileAPI } from '@/services/profile'
|
|
|
|
|
|
|
|
import { fileDomain } from '@/services/constants'
|
|
|
|
import { useMemberStore } from '@/stores'
|
|
|
|
import { useMemberStore } from '@/stores'
|
|
|
|
import type { Gender } from '@/types/member'
|
|
|
|
import type { Gender } from '@/types/member'
|
|
|
|
import { formatDate } from '@/utils'
|
|
|
|
import { formatDate } from '@/utils'
|
|
|
@ -9,7 +10,7 @@ import { computed, ref } from 'vue'
|
|
|
|
const { safeAreaInsets } = uni.getSystemInfoSync()
|
|
|
|
const { safeAreaInsets } = uni.getSystemInfoSync()
|
|
|
|
const isDev = import.meta.env.DEV
|
|
|
|
const isDev = import.meta.env.DEV
|
|
|
|
const memberStore = useMemberStore()
|
|
|
|
const memberStore = useMemberStore()
|
|
|
|
const domain = isDev ? 'http://222.71.165.188:8808' : 'http://222.71.165.188:8808'
|
|
|
|
// const fileDomain = isDev ? 'http://222.71.165.188:8808' : 'http://222.71.165.188:8808'
|
|
|
|
|
|
|
|
|
|
|
|
// 获取个人信息,修改个人信息需提供初始值
|
|
|
|
// 获取个人信息,修改个人信息需提供初始值
|
|
|
|
const profile = ref({})
|
|
|
|
const profile = ref({})
|
|
|
@ -17,7 +18,7 @@ const headIcon = ref()
|
|
|
|
const getMemberProfileData = async () => {
|
|
|
|
const getMemberProfileData = async () => {
|
|
|
|
const res = await getMemberProfileAPI()
|
|
|
|
const res = await getMemberProfileAPI()
|
|
|
|
const obj = res.data
|
|
|
|
const obj = res.data
|
|
|
|
const avatar = domain + JSON.parse(obj.headIcon)[0].url
|
|
|
|
const avatar = fileDomain + JSON.parse(obj.headIcon)[0].url
|
|
|
|
profile.value = {
|
|
|
|
profile.value = {
|
|
|
|
avatar,
|
|
|
|
avatar,
|
|
|
|
gender: obj.gender + '',
|
|
|
|
gender: obj.gender + '',
|
|
|
@ -62,7 +63,7 @@ const uploadFile = (file: string) => {
|
|
|
|
headIcon.value = JSON.stringify(target)
|
|
|
|
headIcon.value = JSON.stringify(target)
|
|
|
|
const avatar = JSON.parse(res.data).data.url
|
|
|
|
const avatar = JSON.parse(res.data).data.url
|
|
|
|
// 个人信息页数据更新
|
|
|
|
// 个人信息页数据更新
|
|
|
|
const imgUrl = domain + avatar
|
|
|
|
const imgUrl = fileDomain + avatar
|
|
|
|
profile.value.avatar = imgUrl
|
|
|
|
profile.value.avatar = imgUrl
|
|
|
|
// Store头像更新
|
|
|
|
// Store头像更新
|
|
|
|
memberStore.profile!.avatar = imgUrl
|
|
|
|
memberStore.profile!.avatar = imgUrl
|
|
|
|