diff --git a/components/ComplaintFooter/ComplaintFooter.vue b/components/ComplaintFooter/ComplaintFooter.vue new file mode 100644 index 0000000..2ba6042 --- /dev/null +++ b/components/ComplaintFooter/ComplaintFooter.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/pages.json b/pages.json index 23a9bd3..7300895 100644 --- a/pages.json +++ b/pages.json @@ -17,7 +17,7 @@ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { "path": "pages/index/index", - "needLogin": true, + "needLogin": false, "style": { "navigationBarTitleText": "电梯图纸生成平台", "enablePullDownRefresh":true diff --git a/pages/consumption/consumption.vue b/pages/consumption/consumption.vue index bc83a6a..8ebbfd3 100644 --- a/pages/consumption/consumption.vue +++ b/pages/consumption/consumption.vue @@ -3,7 +3,7 @@
-
全部
+
全部
生成
充值
会员
@@ -57,9 +57,11 @@ 暂无消费记录 - + + + @@ -70,7 +72,7 @@ ref } from "vue"; import { - onShow, + onShow, onReachBottom } from "@dcloudio/uni-app"; import { @@ -78,19 +80,20 @@ useUserStore } from "@/store"; import HeaderCustom from "/components/HeaderCustom/HeaderCustom.vue"; - import RPC from "@/utils/request"; - import dayjs from "dayjs"; - - const isWeChatH5 = ref(false) - // #ifdef H5 - if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) { - isWeChatH5.value = true - } + import ComplaintFooter from "/components/ComplaintFooter/ComplaintFooter.vue"; + import RPC from "@/utils/request"; + import dayjs from "dayjs"; + + const isWeChatH5 = ref(false) + // #ifdef H5 + if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) { + isWeChatH5.value = true + } // #endif const authStore = useAuthStore(); - const userStore = useUserStore(); - + const userStore = useUserStore(); + const active = ref('全部') const list = ref([{ @@ -134,64 +137,64 @@ type: "other", }, ]); - - const switchTab = (tab) => { - list.value = [] - active.value = tab - page.value = 1 - if(tab === '全部') { - typeParams.value = '' - }else { - typeParams.value = tab - } - getList() - } - const page = ref(1) - const typeParams = ref('') - const loadingStatus = ref('loadmore') + + const switchTab = (tab) => { + list.value = [] + active.value = tab + page.value = 1 + if(tab === '全部') { + typeParams.value = '' + }else { + typeParams.value = tab + } + getList() + } + const page = ref(1) + const typeParams = ref('') + const loadingStatus = ref('loadmore') const count = ref(0); // 加载消费记录 - const getList = () => { - uni.showLoading(); - RPC.post('/wallet/txns/list', { - user_id: userStore.userInfo.id, - page:page.value, - size:20, - type:typeParams.value - }).then(res => { - list.value = [...list.value, ...res.list]; - count.value = res.total; - if (list.value.length >= count.value) { - loadingStatus.value = "nomore"; - } else { - loadingStatus.value = "loadmore"; - } - }).catch(() => { - loadingStatus.value = "loadmore"; - }).finally(() => { - uni.hideLoading(); - }) + const getList = () => { + uni.showLoading(); + RPC.post('/wallet/txns/list', { + user_id: userStore.userInfo.id, + page:page.value, + size:20, + type:typeParams.value + }).then(res => { + list.value = [...list.value, ...res.list]; + count.value = res.total; + if (list.value.length >= count.value) { + loadingStatus.value = "nomore"; + } else { + loadingStatus.value = "loadmore"; + } + }).catch(() => { + loadingStatus.value = "loadmore"; + }).finally(() => { + uni.hideLoading(); + }) } onMounted(() => { - }); - - onReachBottom(() => { - if (list.value.length >= count.value || loadingStatus.value === "loading") - return; - console.log("上拉加载:"); - loadingStatus.value = "loading"; - page.value = ++page.value; - getList(); + }); + + onReachBottom(() => { + if (list.value.length >= count.value || loadingStatus.value === "loading") + return; + console.log("上拉加载:"); + loadingStatus.value = "loading"; + page.value = ++page.value; + getList(); }); onShow(() => { - // 页面显示时刷新数据 - list.value = [] - page.value = 1 - active.value = '全部' + // 页面显示时刷新数据 + list.value = [] + page.value = 1 + active.value = '全部' typeParams.value = '' getList(); }); @@ -202,26 +205,26 @@ font-size: 14px; min-height: 100vh; background-color: #f8f8f8; - } - - .tabBox { - height: 50px; - background-color: #fff; - display: flex; - - .tabItem { - height: 100%; - font-weight: 600; - display: flex; - align-items: center; - justify-content: center; - flex: 1; - - &.selected { - color: #5479ED; - border-bottom: 1px solid #5479ED; - } - } + } + + .tabBox { + height: 50px; + background-color: #fff; + display: flex; + + .tabItem { + height: 100%; + font-weight: 600; + display: flex; + align-items: center; + justify-content: center; + flex: 1; + + &.selected { + color: #5479ED; + border-bottom: 1px solid #5479ED; + } + } } .consumption-list { diff --git a/pages/index/index.vue b/pages/index/index.vue index 818aea6..52445dd 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,5 +1,17 @@ @@ -235,7 +229,7 @@ import { } from "@dcloudio/uni-app"; import { useAuthStore, useUserStore } from "@/store"; import RPC from "@/utils/request"; -import { usePermission } from "@/hooks/usePermission"; +import ComplaintFooter from "@/components/ComplaintFooter/ComplaintFooter.vue"; import dayjs from 'dayjs' const authStore = useAuthStore(); @@ -248,17 +242,18 @@ const applyModalRef = ref(null); const applyReason = ref(""); const applyLoading = ref(false); -const complaintModalRef = ref(null); -const openComplaintModal = () => { - complaintModalRef.value.open(); -}; -const closeComplaintModal = () => { - complaintModalRef.value.close(); +// 查看演示图纸 +const viewDemo = () => { + uni.previewImage({ + urls: ['/static/imgs/demo.jpg'], + current: 0 + }); }; -const callService = () => { - uni.makePhoneCall({ - phoneNumber: '13666500395' +// 跳转到登录页 +const goToLogin = () => { + uni.navigateTo({ + url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index/index') }); }; @@ -613,19 +608,28 @@ onShareTimeline((data) => { onLoad(() => { console.log("index-onLoad"); }); -onShow(async () => { - getList(); +onShow(() => { console.log("test page onShow"); - const hasPermission = await usePermission(); - console.log(hasPermission ? "已登录" : "跳转登录"); - // 以下开始写业务逻辑... - if (!hasPermission) { - authStore.signOut(); - uni.$uv.route("/pages/login/login"); + + // 直接检查登录状态,不使用usePermission(避免被重定向) + const isLoggedIn = authStore.isLoggedIn; + console.log(isLoggedIn ? "已登录" : "未登录"); + + // 未登录用户也可以查看首页,但不加载模板列表 + if (isLoggedIn) { + // 已登录,加载模板列表 + getList(); + } else { + // 未登录,清空模板列表 + templateList.value = []; + currentTemplate.value = {}; } }); onPullDownRefresh(() => { - getList(); + // 直接检查登录状态 + if (authStore.isLoggedIn) { + getList(); + } uni.stopPullDownRefresh(); }); @@ -639,8 +643,57 @@ onPullDownRefresh(() => { /* #ifdef H5 */ padding-bottom: 102px; - /* H5环境下需要更多空间 (50px按钮 + 50px tabBar + 2px间距) */ /* #endif */ + + &.logged-in { + padding-bottom: 102px; + + /* #ifdef H5 */ + padding-bottom: 152px; + /* #endif */ + } +} + +.service-intro { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + padding: 24px 20px; + color: white; + + .intro-title { + font-size: 20px; + font-weight: bold; + margin-bottom: 12px; + text-align: center; + } + + .intro-subtitle { + font-size: 13px; + line-height: 1.6; + margin-bottom: 16px; + opacity: 0.95; + text-align: justify; + } + + .demo-btn { + background: rgba(255, 255, 255, 0.2); + border: 1px solid rgba(255, 255, 255, 0.4); + border-radius: 20px; + padding: 10px 20px; + display: flex; + align-items: center; + justify-content: center; + backdrop-filter: blur(10px); + + .demo-icon { + font-size: 18px; + margin-right: 8px; + } + + .demo-text { + font-size: 14px; + font-weight: 500; + } + } } .header-section { @@ -692,6 +745,22 @@ onPullDownRefresh(() => { .status { margin-bottom: 20px; } + + .login-prompt { + text-align: center; + padding: 40px 20px; + + .prompt-icon { + font-size: 48px; + margin-bottom: 12px; + } + + .prompt-text { + font-size: 15px; + color: #666; + margin-bottom: 8px; + } + } } .template-grid { @@ -742,7 +811,6 @@ onPullDownRefresh(() => { .bottom-actions { z-index: 999; position: fixed; - bottom: 0; left: 0; background: #fff; height: 50px; @@ -757,7 +825,7 @@ onPullDownRefresh(() => { /* #ifdef H5 */ bottom: 50px; - /* H5环境下给tabBar留出空间 */ + /* H5环境下给底部和tabBar留出空间 */ /* #endif */ } @@ -806,62 +874,6 @@ onPullDownRefresh(() => { } } } -.floating-btn { - position: fixed; - right: 16px; - bottom: 120px; - /* #ifdef H5 */ - bottom: 170px; - /* #endif */ - width: 56px; - height: 56px; - background: linear-gradient(135deg, #3f70ff, #5c8aff); - border-radius: 50%; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - color: white; - box-shadow: 0 4px 12px rgba(63, 112, 255, 0.4); - z-index: 99; - font-size: 12px; - - .floating-text { - line-height: 1.2; - } -} - -.complaint-content { - max-height: 60vh; - padding: 0 10px 10px; - - .complaint-text { - font-size: 14px; - color: #333; - line-height: 1.6; - - .h3 { - font-size: 15px; - font-weight: bold; - margin-top: 16px; - margin-bottom: 8px; - color: #111; - } - - .p { - margin-bottom: 8px; - text-align: justify; - color: #666; - } - - .phone-link { - color: #3f70ff; - text-decoration: underline; - display: inline-block; - padding: 0 4px; - } - } -}