|
|
|
|
@ -6,8 +6,12 @@
|
|
|
|
|
<view class="profile-item" @click="changeAvatar">
|
|
|
|
|
<view class="item-label">头像</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<image class="avatar" :src="userInfo.avatar" mode="aspectFill"></image>
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<image
|
|
|
|
|
class="avatar"
|
|
|
|
|
:src="userInfo.avatar"
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
></image>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -16,7 +20,7 @@
|
|
|
|
|
<view class="item-label">用户名</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<text class="item-value">{{ userInfo.username }}</text>
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -25,7 +29,7 @@
|
|
|
|
|
<view class="item-label">电话</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<text class="item-value">{{ userInfo.phone }}</text>
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -34,7 +38,7 @@
|
|
|
|
|
<view class="item-label">邮箱</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<text class="item-value">{{ userInfo.email }}</text>
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -46,7 +50,7 @@
|
|
|
|
|
<view class="item-label">缓存</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<text class="item-value">{{ cacheSize }}</text>
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
|
|
@ -54,7 +58,7 @@
|
|
|
|
|
<view class="profile-item" @click="viewUserAgreement">
|
|
|
|
|
<view class="item-label">用户协议</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -62,20 +66,25 @@
|
|
|
|
|
<view class="profile-item" @click="viewAbout">
|
|
|
|
|
<view class="item-label">关于我们</view>
|
|
|
|
|
<view class="item-content">
|
|
|
|
|
<u-icon name="arrow-right" size="16" color="#ccc"></u-icon>
|
|
|
|
|
<uv-icon name="arrow-right" size="16" color="#ccc"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 退出登录按钮 -->
|
|
|
|
|
<view class="logout-section">
|
|
|
|
|
<u-button type="primary" size="large" @click="logout" :loading="logoutLoading">
|
|
|
|
|
<uv-button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="large"
|
|
|
|
|
@click="logout"
|
|
|
|
|
:loading="logoutLoading"
|
|
|
|
|
>
|
|
|
|
|
退出登陆
|
|
|
|
|
</u-button>
|
|
|
|
|
</uv-button>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 编辑弹窗 -->
|
|
|
|
|
<u-popup :show="showEditModal" mode="center" @close="closeEditModal" :round="10">
|
|
|
|
|
<uv-popup ref="editPopup" mode="center" @close="closeEditModal" :round="10">
|
|
|
|
|
<view class="edit-modal">
|
|
|
|
|
<view class="modal-title">
|
|
|
|
|
编辑{{
|
|
|
|
|
@ -83,44 +92,46 @@
|
|
|
|
|
? "用户名"
|
|
|
|
|
: editType === "phone"
|
|
|
|
|
? "电话"
|
|
|
|
|
: "邮箱"
|
|
|
|
|
: editType === 'email' ? "邮箱" : ''
|
|
|
|
|
}}
|
|
|
|
|
</view>
|
|
|
|
|
<u-input v-model="editValue" :placeholder="getPlaceholder()" :type="
|
|
|
|
|
<uv-input
|
|
|
|
|
v-model="editValue"
|
|
|
|
|
:placeholder="getPlaceholder()"
|
|
|
|
|
:type="
|
|
|
|
|
editType === 'phone'
|
|
|
|
|
? 'number'
|
|
|
|
|
: editType === 'email'
|
|
|
|
|
? 'email'
|
|
|
|
|
: 'text'
|
|
|
|
|
" border="bottom" clearable></u-input>
|
|
|
|
|
"
|
|
|
|
|
border="bottom"
|
|
|
|
|
clearable
|
|
|
|
|
></uv-input>
|
|
|
|
|
<view class="modal-actions">
|
|
|
|
|
<u-button type="default" @click="closeEditModal">取消</u-button>
|
|
|
|
|
<u-button type="primary" @click="saveEdit">保存</u-button>
|
|
|
|
|
<uv-button type="default" @click="closeEditModal">取消</uv-button>
|
|
|
|
|
<uv-button type="primary" @click="saveEdit">保存</uv-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
|
|
|
|
</uv-popup>
|
|
|
|
|
|
|
|
|
|
<!-- 头像选择弹窗 -->
|
|
|
|
|
<u-action-sheet :show="showAvatarSheet" :actions="avatarActions" @close="showAvatarSheet = false"
|
|
|
|
|
@select="onAvatarSelect"></u-action-sheet>
|
|
|
|
|
<uv-action-sheet
|
|
|
|
|
:show="showAvatarSheet"
|
|
|
|
|
:actions="avatarActions"
|
|
|
|
|
@close="showAvatarSheet = false"
|
|
|
|
|
@select="onAvatarSelect"
|
|
|
|
|
></uv-action-sheet>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
onMounted
|
|
|
|
|
} from "vue";
|
|
|
|
|
import {
|
|
|
|
|
onShow
|
|
|
|
|
} from "@dcloudio/uni-app";
|
|
|
|
|
import {
|
|
|
|
|
useAuthStore,
|
|
|
|
|
useUserStore
|
|
|
|
|
} from "@/store";
|
|
|
|
|
|
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
|
|
|
import { useAuthStore, useUserStore } from "@/store";
|
|
|
|
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
|
|
// 响应式数据
|
|
|
|
|
const userInfo = ref({
|
|
|
|
|
@ -132,13 +143,14 @@
|
|
|
|
|
|
|
|
|
|
const cacheSize = ref("36MB");
|
|
|
|
|
const logoutLoading = ref(false);
|
|
|
|
|
const showEditModal = ref(false);
|
|
|
|
|
const showAvatarSheet = ref(false);
|
|
|
|
|
const editType = ref("");
|
|
|
|
|
const editValue = ref("");
|
|
|
|
|
const editPopup = ref(null);
|
|
|
|
|
|
|
|
|
|
// 头像选择选项
|
|
|
|
|
const avatarActions = ref([{
|
|
|
|
|
const avatarActions = ref([
|
|
|
|
|
{
|
|
|
|
|
name: "拍照",
|
|
|
|
|
value: "camera",
|
|
|
|
|
},
|
|
|
|
|
@ -188,21 +200,21 @@
|
|
|
|
|
const editUsername = () => {
|
|
|
|
|
editType.value = "username";
|
|
|
|
|
editValue.value = userInfo.value.username;
|
|
|
|
|
showEditModal.value = true;
|
|
|
|
|
editPopup.value.open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 编辑电话
|
|
|
|
|
const editPhone = () => {
|
|
|
|
|
editType.value = "phone";
|
|
|
|
|
editValue.value = userInfo.value.phone;
|
|
|
|
|
showEditModal.value = true;
|
|
|
|
|
editPopup.value.open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 编辑邮箱
|
|
|
|
|
const editEmail = () => {
|
|
|
|
|
editType.value = "email";
|
|
|
|
|
editValue.value = userInfo.value.email;
|
|
|
|
|
showEditModal.value = true;
|
|
|
|
|
editPopup.value.open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取输入框占位符
|
|
|
|
|
@ -221,7 +233,7 @@
|
|
|
|
|
|
|
|
|
|
// 关闭编辑弹窗
|
|
|
|
|
const closeEditModal = () => {
|
|
|
|
|
showEditModal.value = false;
|
|
|
|
|
editPopup.value.close();
|
|
|
|
|
editType.value = "";
|
|
|
|
|
editValue.value = "";
|
|
|
|
|
};
|
|
|
|
|
@ -314,9 +326,9 @@
|
|
|
|
|
|
|
|
|
|
// 查看关于我们
|
|
|
|
|
const viewAbout = () => {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pagesA/about/about",
|
|
|
|
|
});
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url: "/pagesA/about/about",
|
|
|
|
|
// });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 退出登录
|
|
|
|
|
@ -330,7 +342,7 @@
|
|
|
|
|
|
|
|
|
|
// 模拟退出登录
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
authStore.signOut()
|
|
|
|
|
authStore.signOut();
|
|
|
|
|
logoutLoading.value = false;
|
|
|
|
|
|
|
|
|
|
// 清除用户信息和token
|
|
|
|
|
@ -452,7 +464,7 @@
|
|
|
|
|
gap: 12px;
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
|
|
|
|
.u-button {
|
|
|
|
|
.uv-button {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|