Lufaneng 11 months ago
parent 04bbcfcf02
commit 3565433ce9

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

Loading…
Cancel
Save