diff --git a/index.html b/index.html index 5999a84..88860dd 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,10 @@ 小发同城官网 - 小发旗下本地sass电商品牌,品类多,价格低。精选好货,省心省钱! +

+ 《小发同城》是小发电商官方商家入驻平台的登录入口,提供了一站式的商家开店服务,在这里,商家可以轻松地注册账号、创建店铺、处理订单等。小发官网致力于为广大商家提供高效便捷的电商运营解决方案,助力商家实现商业成功,和小发合作,一起更好。 + 小发同城 +

diff --git a/src/views/HeadMenu.vue b/src/views/HeadMenu.vue index 4c7fac1..c981210 100644 --- a/src/views/HeadMenu.vue +++ b/src/views/HeadMenu.vue @@ -18,9 +18,11 @@
- + {{ - approval_status == -1 || approval_status == 4 || !isLoggedIn ? "立即入驻" : "查看审核状态" + approval_status == -1 || approval_status == 4 || !isLoggedIn + ? "立即入驻" + : "查看审核状态" }}
@@ -38,7 +40,11 @@ {{ mobile }} @@ -73,7 +79,7 @@ import { ref, onMounted, watch, onUnmounted } from "vue"; import { useRouter } from "vue-router"; import { useUserStore } from "@/stores/userStore"; -import { Menu,Avatar } from "@element-plus/icons-vue"; +import { Menu, Avatar } from "@element-plus/icons-vue"; import { getApproval_status } from "@/api/login"; const emits = defineEmits(["open-login-form", "open-register-form"]); @@ -102,22 +108,28 @@ const userStore = useUserStore(); const isLoggedIn = ref(userStore.isLoggedIn); const approval_status = ref(-1); const token = ref(userStore.token); -const mobile = ref(userStore.mobilePhone); +const mobile = ref(userStore.mobilePhone); -watch(userStore, (newVal)=>{ - token.value = newVal.token - mobile.value = newVal.mobilePhone.replace(/(^\d{3})(\d+)(\d{4})/g, "$1****$3") +watch(userStore, (newVal) => { + token.value = newVal.token; + mobile.value = newVal.mobilePhone.replace( + /(^\d{3})(\d+)(\d{4})/g, + "$1****$3" + ); isLoggedIn.value = !!token.value; -}) +}); // 每次页面加载时检查 token onMounted(() => { - getApproval_status().then((res) => { - if (res.code === 0 && res.status === 200) { - approval_status.value = res.data.approval_status; - console.log("res.data.approval_status", res.data.approval_status); - } - }); + const mobile = localStorage.getItem("mobilePhone"); + if (mobile) { + getApproval_status().then((res) => { + if (res.code === 0 && res.status === 200) { + approval_status.value = res.data.approval_status; + console.log("res.data.approval_status", res.data.approval_status); + } + }); + } }); // 监听 userStore.isLoggedIn 的变化 @@ -257,15 +269,15 @@ onUnmounted(() => { } } -.icon_avatar{ - width: 32px; - height: 32px; - display: flex; - justify-content: center; - align-items: center; - background: #eee; - border-radius: 100%; - } +.icon_avatar { + width: 32px; + height: 32px; + display: flex; + justify-content: center; + align-items: center; + background: #eee; + border-radius: 100%; +} .start { display: flex; @@ -280,7 +292,6 @@ onUnmounted(() => { align-items: center; } - .header_right { display: flex; justify-content: flex-end; @@ -305,13 +316,13 @@ onUnmounted(() => { } .header_right { - gap: 5px; -} + gap: 5px; + } .header-menu { display: none; } - + .avatar { display: none; } diff --git a/src/views/index/slider.vue b/src/views/index/slider.vue index 7c1777e..e7a350e 100644 --- a/src/views/index/slider.vue +++ b/src/views/index/slider.vue @@ -1,15 +1,21 @@