|
|
@ -3,16 +3,24 @@ |
|
|
<view class="main"> |
|
|
<view class="main"> |
|
|
<view class="top"> |
|
|
<view class="top"> |
|
|
<view class="bell"> |
|
|
<view class="bell"> |
|
|
<image class="image-bell" src="/static/my/bell.png"></image> |
|
|
|
|
|
|
|
|
<!-- <image class="image-bell" src="/static/my/bell.png" /> --> |
|
|
</view> |
|
|
</view> |
|
|
<view class="msg"> |
|
|
<view class="msg"> |
|
|
<view class="msg-left"> |
|
|
<view class="msg-left"> |
|
|
<view class="avatar"></view> |
|
|
|
|
|
|
|
|
<image class="avatar" |
|
|
|
|
|
:src="avatarUrl || 'https://d31zlh4on95l9h.cloudfront.net/default/1961d9d2e31e78e47e885231e7514a35.png'" |
|
|
|
|
|
mode="aspectFill" /> |
|
|
</view> |
|
|
</view> |
|
|
<view class=" msg-center"> |
|
|
<view class=" msg-center"> |
|
|
<view style="display: flex;"> |
|
|
<view style="display: flex;"> |
|
|
|
|
|
<template v-if="!isEditingName"> |
|
|
<view class="userInfo">{{ username }}</view> |
|
|
<view class="userInfo">{{ username }}</view> |
|
|
<image class="image-editName" src="/static/my/editName.png"></image> |
|
|
|
|
|
|
|
|
<image class="image-editName" src="/static/my/editName.png" @click="startEditName" /> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else> |
|
|
|
|
|
<input v-model="editingName" class="edit-input" @blur="finishEditName" |
|
|
|
|
|
@keyup.enter="finishEditName" autofocus placeholder="请输入用户名" /> |
|
|
|
|
|
</template> |
|
|
</view> |
|
|
</view> |
|
|
<view class="userId">ID:{{ dccode }}</view> |
|
|
<view class="userId">ID:{{ dccode }}</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -43,7 +51,7 @@ |
|
|
<text>账号与安全</text> |
|
|
<text>账号与安全</text> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
</view> |
|
|
</view> |
|
|
<view class="list-item"> |
|
|
|
|
|
|
|
|
<!-- <view class="list-item"> |
|
|
<image src="/static/my/connection.png" class="list-icon" /> |
|
|
<image src="/static/my/connection.png" class="list-icon" /> |
|
|
<text>联系我们</text> |
|
|
<text>联系我们</text> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
@ -60,7 +68,7 @@ |
|
|
<image src="/static/my/opinion.png" class="list-icon" /> |
|
|
<image src="/static/my/opinion.png" class="list-icon" /> |
|
|
<text>意见反馈</text> |
|
|
<text>意见反馈</text> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
<uni-icons type="arrowright" size="16" class="arrow" /> |
|
|
</view> |
|
|
|
|
|
|
|
|
</view> --> |
|
|
<view class="list-item" @click="goToAbout"> |
|
|
<view class="list-item" @click="goToAbout"> |
|
|
<image src="/static/my/about.png" class="list-icon" /> |
|
|
<image src="/static/my/about.png" class="list-icon" /> |
|
|
<text>关于DeepChart</text> |
|
|
<text>关于DeepChart</text> |
|
|
@ -80,23 +88,60 @@ import { |
|
|
ArrowRight |
|
|
ArrowRight |
|
|
} from '@element-plus/icons-vue' |
|
|
} from '@element-plus/icons-vue' |
|
|
import footerBar from '../../components/footerBar.vue' |
|
|
import footerBar from '../../components/footerBar.vue' |
|
|
import {getUserInfo} from "@/api/member" |
|
|
|
|
|
import { useUserStore } from "../../stores/modules/userInfo" |
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
getUserInfo, |
|
|
|
|
|
updateUserInfo |
|
|
|
|
|
} from "@/api/member" |
|
|
|
|
|
import { |
|
|
|
|
|
useUserStore |
|
|
|
|
|
} from "../../stores/modules/userInfo" |
|
|
const userStore = useUserStore() |
|
|
const userStore = useUserStore() |
|
|
|
|
|
|
|
|
const type = ref('member') |
|
|
const type = ref('member') |
|
|
const iSMT = ref(0) |
|
|
const iSMT = ref(0) |
|
|
const username = ref('') |
|
|
const username = ref('') |
|
|
const dccode = ref('') |
|
|
const dccode = ref('') |
|
|
|
|
|
const avatarUrl = ref('') |
|
|
|
|
|
const isEditingName = ref(false) |
|
|
|
|
|
const editingName = ref('') |
|
|
|
|
|
|
|
|
const userInfoRes = ref() // 用户身份信息 |
|
|
const userInfoRes = ref() // 用户身份信息 |
|
|
userInfoRes.value = getUserInfo() |
|
|
userInfoRes.value = getUserInfo() |
|
|
userInfoRes.value.then(res => { |
|
|
userInfoRes.value.then(res => { |
|
|
username.value = res.data.dcname |
|
|
username.value = res.data.dcname |
|
|
dccode.value = res.data.dccode |
|
|
dccode.value = res.data.dccode |
|
|
|
|
|
avatarUrl.value = res.data.avatar |
|
|
console.log('用户信息', userInfoRes.value) |
|
|
console.log('用户信息', userInfoRes.value) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const startEditName = () => { |
|
|
|
|
|
isEditingName.value = true |
|
|
|
|
|
editingName.value = username.value |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const finishEditName = async () => { |
|
|
|
|
|
if (editingName.value.trim() === '' || editingName.value === username.value) { |
|
|
|
|
|
isEditingName.value = false |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
await updateUserInfo({ |
|
|
|
|
|
dcname: editingName.value |
|
|
|
|
|
}) |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '昵称修改成功', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '修改失败,请重试', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} finally { |
|
|
|
|
|
isEditingName.value = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const goToGeneral = () => { |
|
|
const goToGeneral = () => { |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
@ -196,7 +241,8 @@ onMounted(() => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.userInfo { |
|
|
.userInfo { |
|
|
font-size: 20px; |
|
|
|
|
|
|
|
|
font-size: 30rpx; |
|
|
|
|
|
font-weight: bold; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.userId { |
|
|
.userId { |
|
|
@ -306,4 +352,8 @@ onMounted(() => { |
|
|
background-color: red; |
|
|
background-color: red; |
|
|
margin-left: 10rpx; |
|
|
margin-left: 10rpx; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.edit-input { |
|
|
|
|
|
background-color: #999; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |