用户中心样式调整
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import Config from '@/config'
|
||||
import {useUserStore} from '@/store'
|
||||
import { useUserStore } from '@/store'
|
||||
import type chooseImageVue from '@/components/choose-image/choose-image.vue'
|
||||
import { appUserEditUserInfoPost } from '@/service'
|
||||
import {debounce} from 'throttle-debounce';
|
||||
import {upload} from '@/utils/upload/alioss'
|
||||
import {EventEnum} from "@/constant/enums";
|
||||
import { debounce } from 'throttle-debounce';
|
||||
import { upload } from '@/utils/upload/alioss'
|
||||
import { EventEnum } from "@/constant/enums";
|
||||
|
||||
const userStore = useUserStore()
|
||||
const {t} = useI18n()
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
const chooseImageRef = ref<InstanceType<typeof chooseImageVue> | null>(null)
|
||||
@@ -18,16 +18,16 @@ const form = ref({
|
||||
|
||||
|
||||
watch(
|
||||
() => userStore.userInfo,
|
||||
(newValue) => {
|
||||
console.log('userInfo', newValue)
|
||||
form.value = {
|
||||
avatar: newValue?.avatar || '',
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
},
|
||||
() => userStore.userInfo,
|
||||
(newValue) => {
|
||||
console.log('userInfo', newValue)
|
||||
form.value = {
|
||||
avatar: newValue?.avatar || '',
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
},
|
||||
)
|
||||
|
||||
async function handleCropperAvatarSuccess(avatarUrl: string) {
|
||||
@@ -61,13 +61,13 @@ async function submit() {
|
||||
avatar: form.value.avatar,
|
||||
}
|
||||
})
|
||||
await uni.showToast({title: t('common.prompt.save-successfully'), icon: 'none'})
|
||||
await uni.showToast({ title: t('common.prompt.save-successfully'), icon: 'none' })
|
||||
await userStore.getUserInfo()
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = debounce(Config.debounceLongTime, submit, {atBegin: true})
|
||||
const handleSubmit = debounce(Config.debounceLongTime, submit, { atBegin: true })
|
||||
|
||||
function handleAddImg() {
|
||||
chooseImageRef.value?.init()
|
||||
@@ -91,7 +91,7 @@ function handlePreviewImage() {
|
||||
|
||||
|
||||
function navigateTo(url: string) {
|
||||
uni.navigateTo({url})
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
|
||||
onLoad(async () => {
|
||||
@@ -119,37 +119,31 @@ onBackPress(() => {
|
||||
</template>
|
||||
</choose-image>
|
||||
<view class="h-full flex flex-col">
|
||||
<navbar :title="t('navbar-personal-information')"/>
|
||||
<navbar :title="t('navbar-personal-information')" />
|
||||
<view class="bg-#fff">
|
||||
<view class="p-18rpx flex items-center justify-between border-bottom">
|
||||
<view class="shrink-0 mr-20rpx text-30rpx text-primary">{{ t('pages-user.user-info.head-portrait') }}</view>
|
||||
<view class="flex items-center" @click="handleAddImg">
|
||||
<image :src="form.avatar" class="shrink-0 w-80rpx h-80rpx rounded-full"></image>
|
||||
<image
|
||||
src="@img/chef/100202.png"
|
||||
class="shrink-0 ml-16rpx w-22rpx h-30rpx"
|
||||
></image>
|
||||
<image src="@img/chef/100202.png" class="shrink-0 ml-16rpx w-22rpx h-30rpx"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="px-18rpx py-37rpx flex items-center justify-between"
|
||||
@click="navigateTo('/pages-user/pages/edit-nickname/index')">
|
||||
@click="navigateTo('/pages-user/pages/edit-nickname/index')">
|
||||
<view class="shrink-0 mr-20rpx text-30rpx text-primary">{{ t('pages-user.user-info.nickname') }}</view>
|
||||
<view class="flex-1 flex items-center justify-end text-30rpx text-primary">
|
||||
<text>{{ `${userStore.userInfo.firstName} ${userStore.userInfo.surname}` }}</text>
|
||||
<image
|
||||
src="@img/chef/100202.png"
|
||||
class="shrink-0 ml-16rpx w-22rpx h-30rpx"
|
||||
></image>
|
||||
<image src="@img/chef/100202.png" class="shrink-0 ml-16rpx w-22rpx h-30rpx"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="mt-318rpx px-30rpx">
|
||||
<wd-button custom-class="!h-108rpx !text-36rpx font-bold !rounded-16rpx" block @click="handleSubmit">
|
||||
{{ t('common.save') }}
|
||||
</wd-button>
|
||||
</view>
|
||||
<view class="mt-318rpx px-30rpx" style="position: fixed; bottom: 30rpx; left: 0; right: 0; z-index: 100;">
|
||||
<wd-button custom-class="!h-108rpx !text-36rpx font-bold !rounded-46rpx" block @click="handleSubmit">
|
||||
{{ t('common.save') }}
|
||||
</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user