feat: 格式化代码

This commit is contained in:
2025-08-27 18:37:50 +08:00
parent 9de068e7fc
commit 0e51fdcd69
21 changed files with 1502 additions and 1522 deletions

View File

@@ -19,10 +19,10 @@
<!-- 中间功能入口循环渲染 -->
<view class="menu-card">
<view
class="menu-item"
v-for="(item, index) in menuList"
:key="index"
<view
class="menu-item"
v-for="(item, index) in menuList"
:key="index"
@click="handleMenuClick(item)"
>
<text class="label">{{ item.label }}</text>
@@ -36,60 +36,64 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { getLoginUserPhone } from '@/request/api/LoginApi'
import { ref, onMounted } from "vue";
import { getLoginUserPhone } from "@/request/api/LoginApi";
// 假数据
const userInfo = ref({
avatar: '/static/default-avatar.png',
nickname: '微信用户',
phone: ''
})
avatar: "/static/default-avatar.png",
nickname: "微信用户",
phone: "",
});
// 功能菜单列表(带 type 区分操作类型)
const menuList = ref([
// { label: '修改手机号', type: 'navigate', url: '/pages/change-phone/change-phone' },
{ label: '账号注销', type: 'navigate', url: '/pages/cancel-account/cancel-account' },
{
label: "账号注销",
type: "navigate",
url: "/pages/cancel-account/cancel-account",
},
// { label: '营业资质&协议', type: 'navigate', url: '/pages/agreement/agreement' },
{ label: '联系客服', type: 'action', action: 'contactService' }
])
{ label: "联系客服", type: "action", action: "contactService" },
]);
// 生命周期钩子
onMounted(() => {
getLoginUserPhoneInfo()
})
getLoginUserPhoneInfo();
});
const getLoginUserPhoneInfo = async () => {
const res = await getLoginUserPhone()
const res = await getLoginUserPhone();
if (res.code === 0) {
userInfo.value.phone = res.data
}
}
userInfo.value.phone = res.data;
}
};
// 处理菜单点击
const handleMenuClick = (item) => {
if (item.type === 'navigate' && item.url) {
uni.navigateTo({ url: item.url })
} else if (item.type === 'action') {
if (item.action === 'contactService') {
uni.showToast({ title: '联系客服功能待实现', icon: 'none' })
if (item.type === "navigate" && item.url) {
uni.navigateTo({ url: item.url });
} else if (item.type === "action") {
if (item.action === "contactService") {
uni.showToast({ title: "联系客服功能待实现", icon: "none" });
}
}
}
};
// 退出登录
const handleLogout = () => {
uni.showModal({
title: '温馨提示',
content: '确定要退出登录吗?',
title: "温馨提示",
content: "确定要退出登录吗?",
success: (res) => {
if (res.confirm) {
uni.clearStorageSync()
uni.reLaunch({ url: '/pages/login/index' })
uni.clearStorageSync();
uni.reLaunch({ url: "/pages/login/index" });
}
}
})
}
},
});
};
</script>
<style scoped>