Lufaneng 11 months ago
parent 04bbcfcf02
commit 3565433ce9

@ -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;
}
}

Loading…
Cancel
Save