From 1c6c0a0f7bfdbd1a1c8f30c45dd7f85e21747424 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 15:44:20 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/integrated/visitor/index.vue | 58 +++++++++---------- .../integrated/visitor/myyyvisitorlist.vue | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/pages/integrated/visitor/index.vue b/src/pages/integrated/visitor/index.vue index faa999c..cfd758c 100644 --- a/src/pages/integrated/visitor/index.vue +++ b/src/pages/integrated/visitor/index.vue @@ -10,8 +10,8 @@ - @@ -60,8 +60,8 @@ 拜访原因* - @@ -246,24 +246,24 @@ 选择接待人 × - + - - - { const filteredUserList = computed(() => { if (!searchKeyword.value) return userList.value const keyword = searchKeyword.value.toLowerCase() - return userList.value.filter(user => + return userList.value.filter(user => user.name.toLowerCase().includes(keyword) ) }) @@ -466,7 +466,7 @@ const validateForm = () => { uni.showToast({ title: '请选择到访单位', icon: 'none' }) return false } - if (!formData.userId || !formData.userName) { + if (!formData.receiveId || !formData.userName) { uni.showToast({ title: '请选择接待人', icon: 'none' }) return false } @@ -508,7 +508,7 @@ const handleSubmit = async () => { icon: 'none', duration: 3000 }) - + // 延迟返回,让用户能看到提示 setTimeout(() => { uni.navigateBack() @@ -600,17 +600,17 @@ const confirmDeptSelect = () => { }) return } - + // 更新表单数据,同时保存ID和名称 formData.deptId = selectedDeptId.value formData.deptName = selectedDeptName.value - + // 清空已选择的接待人 - formData.userId = '' + formData.receiveId = '' formData.userName = '' selectedUserName.value = '' selectedUserId.value = '' - + // 关闭弹窗 closeDeptPicker() } @@ -644,11 +644,11 @@ const confirmUserSelect = () => { }) return } - + // 更新表单数据,同时保存ID和名称 - formData.userId = selectedUserId.value + formData.receiveId = selectedUserId.value formData.userName = selectedUserName.value - + // 关闭弹窗 closeUserPicker() } @@ -662,7 +662,7 @@ const showUserPicker = async () => { }) return } - + // 如果切换了部门,重新获取用户列表 if (formData.deptId !== currentDeptId.value) { await getUserList(formData.deptId) @@ -671,7 +671,7 @@ const showUserPicker = async () => { selectedUserId.value = '' selectedUserName.value = '' } - + showUserPopup.value = true } @@ -721,13 +721,13 @@ onMounted(async () => { // 获取该部门的用户列表 await getUserList(firstDept.id) - + // 设置默认的接待人(选择第一个用户) if (userList.value.length > 0) { const firstUser = userList.value[0] selectedUserId.value = firstUser.userId selectedUserName.value = firstUser.name - formData.userId = firstUser.userId + formData.receiveId = firstUser.userId formData.userName = firstUser.name } } @@ -1161,12 +1161,12 @@ onMounted(async () => { color: #323233; display: flex; align-items: center; - + &.active { color: #1989FA; background: #F5F5F5; } - + .user-name { flex: 1; } diff --git a/src/pages/integrated/visitor/myyyvisitorlist.vue b/src/pages/integrated/visitor/myyyvisitorlist.vue index bb4b466..5c100bf 100644 --- a/src/pages/integrated/visitor/myyyvisitorlist.vue +++ b/src/pages/integrated/visitor/myyyvisitorlist.vue @@ -46,7 +46,7 @@ 拜访原因: - {{ getReasonText(item.description) }} + {{ getReasonText(item.reasonValue) }} From 0a952f01c1d05bcb2c4b61a5c719f9e381048428 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 16:50:01 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 8 + src/pages.json | 199 +++++------------- .../integrated/visitor/myyyvisitorlist.vue | 62 +----- src/pages/tabbar/my.vue | 183 +++++++++++++++- 4 files changed, 239 insertions(+), 213 deletions(-) diff --git a/src/App.vue b/src/App.vue index 55e3905..293e203 100644 --- a/src/App.vue +++ b/src/App.vue @@ -95,6 +95,14 @@ const tabbar: TabbarItem[] = [ selectedIconPath: "/static/tabbar/my-select.png", launchParam: ["canteen", "selfMerchant"], auth: ["user",], + }, + { + pagePath: "pages/integrated/visitor/verify", + text: "访客核销", + iconPath: "/static/tabbar/my.png", + selectedIconPath: "/static/tabbar/my-select.png", + launchParam: ["canteen", "selfMerchant"], + auth: ["user",], }, { pagePath: "pages/tabbar/my", diff --git a/src/pages.json b/src/pages.json index df12b47..1bd9629 100644 --- a/src/pages.json +++ b/src/pages.json @@ -9,67 +9,47 @@ } }, "pages": [ -// { -// "path": "pages/tabbar/canteen", -// "style": { -// "navigationBarTitleText": "食堂", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/selfMerchant", -// "style": { -// "navigationBarTitleText": "自营商家", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/coopMerchant", -// "style": { -// "navigationBarTitleText": "合作商家", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/order", -// "style": { -// "navigationBarTitleText": "订单", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/flowStatistics", -// "style": { -// "navigationBarTitleText": "流水统计", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/individualOrder", -// "style": { -// "navigationBarTitleText": "订单", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/integrated/visitor/myvisitor", -// "style": { -// "navigationBarTitleText": "访客", -// "disableScroll": true -// } -// }, { - "path": "pages/tabbar/my", + "path": "pages/integrated/visitor/index", "style": { - "navigationBarTitleText": "我的", - "disableScroll": true + "navigationBarTitleText": "访客申请", + "navigationStyle": "custom" + } + }, + { + "path": "pages/integrated/visitor/myvisitor", + "style": { + "navigationBarTitleText": "申请记录", + "navigationStyle": "custom" + } + }, + { + "path": "pages/integrated/visitor/myyyvisitor", + "style": { + "navigationBarTitleText": "访客邀约", + "navigationStyle": "custom" + } + }, + { + "path": "pages/integrated/visitor/myyyvisitorlist", + "style": { + "navigationBarTitleText": "邀约记录", + "navigationStyle": "custom" } }, { "path": "pages/integrated/visitor/verify", "style": { + "navigationBarTitleText": "访客核销", "navigationStyle": "custom" } + }, + { + "path": "pages/tabbar/my", + "style": { + "navigationBarTitleText": "我的", + "disableScroll": true + } } ], "subPackages": [ @@ -371,7 +351,7 @@ { "path": "visitor/myyyvisitor", "style": { - "navigationBarTitleText": "邀约访客" + "navigationBarTitleText": "访客邀约" } } ] @@ -412,118 +392,39 @@ { "pagePath": "pages/integrated/visitor/index", "text": "访客申请", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/visitor-apply.png", + "selectedIconPath": "static/tabbar/visitor-apply-select.png" }, { "pagePath": "pages/integrated/visitor/myvisitor", "text": "申请记录", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/visitor-record.png", + "selectedIconPath": "static/tabbar/visitor-record-select.png" }, { "pagePath": "pages/integrated/visitor/myyyvisitor", "text": "访客邀约", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/visitor-invite.png", + "selectedIconPath": "static/tabbar/visitor-invite-select.png" }, { "pagePath": "pages/integrated/visitor/myyyvisitorlist", "text": "邀约记录", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/visitor-invited.png", + "selectedIconPath": "static/tabbar/visitor-invited-select.png" }, { "pagePath": "pages/integrated/visitor/verify", - "text": "核销", - "iconPath": "", - "selectedIconPath": "" + "text": "访客核销", + "iconPath": "static/tabbar/visitor-verify.png", + "selectedIconPath": "static/tabbar/visitor-verify-select.png" }, -// { -// "pagePath": "pages/tabbar/canteen", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/selfMerchant", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/coopMerchant", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/order", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/flowStatistics", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/individualOrder", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/my", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// } - // { - // "pagePath": "pages/tabbar/canteen", - // "text": "食堂", - // "iconPath": "static/tabbar/canteen.png", - // "selectedIconPath": "static/tabbar/canteen-select.png" - // }, - // { - // "pagePath": "pages/tabbar/selfMerchant", - // "text": "自营商家", - // "iconPath": "static/tabbar/selfMerchant.png", - // "selectedIconPath": "static/tabbar/selfMerchant-select.png" - // }, - // { - // pagePath: "pages/tabbar/coopMerchant", - // text: "合作商家", - // iconPath: "static/tabbar/coopMerchant.png", - // selectedIconPath: "static/tabbar/coopMerchant-select.png", - // }, - // { - // "pagePath": "pages/tabbar/order", - // "text": "订单", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - // { - // "pagePath": "pages/tabbar/flowStatistics", - // "text": "流水统计", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - // { - // "pagePath": "pages/tabbar/individualOrder", - // "text": "订单", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - { - "pagePath": "pages/tabbar/my", - "text": "我的", - "iconPath": "static/tabbar/my.png", - "selectedIconPath": "static/tabbar/my-select.png" - } - + { + "pagePath": "pages/tabbar/my", + "text": "我的", + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png" + } ] } } diff --git a/src/pages/integrated/visitor/myyyvisitorlist.vue b/src/pages/integrated/visitor/myyyvisitorlist.vue index 5c100bf..0332231 100644 --- a/src/pages/integrated/visitor/myyyvisitorlist.vue +++ b/src/pages/integrated/visitor/myyyvisitorlist.vue @@ -69,30 +69,6 @@ 暂无数据 - - - - - - 访客申请 - - - - 申请记录 - - - - 主动邀约 - - - - 邀约记录 - - - - 我的 - - @@ -362,7 +338,7 @@ defineExpose({ .page-container { min-height: 100vh; background-color: #f5f5f5; - padding-bottom: 120rpx; // 为底部导航留出空间 + padding-bottom: 20rpx; // 修改底部间距 } .status-tabs { @@ -506,40 +482,4 @@ defineExpose({ color: #999; font-size: 26rpx; } - -.bottom-nav { - position: fixed; - bottom: 0; - left: 0; - right: 0; - height: 100rpx; - background-color: #fff; - display: flex; - justify-content: space-around; - align-items: center; - border-top: 1rpx solid #eee; - padding-bottom: env(safe-area-inset-bottom); // 适配iPhone底部安全区 - - .nav-item { - display: flex; - flex-direction: column; - align-items: center; - padding: 10rpx 0; - - .nav-icon { - width: 44rpx; - height: 44rpx; - margin-bottom: 4rpx; - } - - .nav-text { - font-size: 20rpx; - color: #999; - - &.active { - color: #1777FF; - } - } - } -} diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index ca6598d..8313fa5 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -16,7 +16,7 @@ ID {{ state.userInfo?.sysUser?.userId }} - + 请先登录 @@ -42,6 +42,40 @@ 切换角色 + + + + + + + 账号密码登录 + × + + + + + + + + + + + + + + @@ -80,7 +114,7 @@ const state = reactive<{ // { text: "访客记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myvisitor" }, // { text: "访客邀约", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitor" }, // { text: "邀约记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitorlist" }, - // { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" }, + { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" }, // { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" } ], @@ -125,6 +159,59 @@ const storage = { }, } +// 添加登录相关的状态 +const showLogin = ref(false) +const loginForm = reactive({ + username: '', + password: '' +}) + +// 显示登录弹窗 +const showLoginPopup = () => { + showLogin.value = true +} + +// 关闭登录弹窗 +const closeLoginPopup = () => { + showLogin.value = false + loginForm.username = '' + loginForm.password = '' +} + +// 处理账号密码登录 +const handleLogin = async () => { + if (!loginForm.username || !loginForm.password) { + uni.showToast({ + title: '请输入账号和密码', + icon: 'none' + }) + return + } + + try { + uni.showLoading({ title: '登录中...', mask: true }) + const response = await userApi.login({ + username: loginForm.username, + password: loginForm.password + }) + + if (response.code === 0) { + storage.saveToken({ accessToken: response.data.accessToken }) + const { data: userData } = await userApi.userInfo() + storage.saveUserInfo(userData) + closeLoginPopup() + uni.showToast({ title: '登录成功', icon: 'none' }) + } else { + uni.showToast({ title: response.msg || '登录失败', icon: 'none' }) + } + } catch (error) { + console.error('登录失败:', error) + uni.showToast({ title: '登录失败', icon: 'none' }) + } finally { + uni.hideLoading() + } +} + const login = { // 检查应用环境并登录 checkAppInfo: async () => { @@ -137,7 +224,8 @@ const login = { const zhengdingResult = login.zhengdingLogin() if (zhengdingResult) return - uni.showToast({ title: "当前登录环境未知", icon: "none" }) + // 如果都不是,显示账号密码登录弹窗 + showLoginPopup() } catch (error) { console.error("登录失败:", error) uni.showToast({ title: "登录失败", icon: "none" }) @@ -393,4 +481,93 @@ onShow(() => { border-bottom: 1px solid #fafafa; margin-bottom: 40rpx; } + +// 添加登录弹窗样式 +.login-popup { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 100; + + .popup-mask { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.4); + } + + .popup-content { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: #fff; + border-radius: 24rpx 24rpx 0 0; + } + + .popup-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 32rpx; + border-bottom: 1rpx solid #f5f5f5; + + .popup-title { + font-size: 32rpx; + color: #323233; + font-weight: 500; + } + + .popup-close { + font-size: 40rpx; + color: #969799; + padding: 10rpx; + } + } + + .popup-body { + padding: 32rpx; + } + + .input-item { + margin-bottom: 24rpx; + + .input { + width: 100%; + height: 88rpx; + background: #F7F8FA; + border-radius: 8rpx; + padding: 0 24rpx; + font-size: 30rpx; + color: #323233; + } + + .placeholder { + color: #969799; + } + } + + .popup-footer { + padding: 24rpx 32rpx; + background: #fff; + border-top: 1rpx solid #f5f5f5; + + .login-btn { + width: 100%; + height: 88rpx; + background: #1989FA; + border-radius: 44rpx; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + font-size: 32rpx; + font-weight: 500; + } + } +} From 4d6a5d5e0a631a661b5df3cf231d9a0a0eff550c Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 17:02:21 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 482 ++++++++---------- src/pages.json | 205 ++++++-- .../integrated/visitor/myyyvisitorlist.vue | 62 ++- src/pages/tabbar/my.vue | 213 ++------ 4 files changed, 469 insertions(+), 493 deletions(-) diff --git a/src/App.vue b/src/App.vue index 293e203..e42042e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,259 +1,223 @@ - - - + + + diff --git a/src/pages.json b/src/pages.json index 1bd9629..df12b47 100644 --- a/src/pages.json +++ b/src/pages.json @@ -9,47 +9,67 @@ } }, "pages": [ - { - "path": "pages/integrated/visitor/index", - "style": { - "navigationBarTitleText": "访客申请", - "navigationStyle": "custom" - } - }, - { - "path": "pages/integrated/visitor/myvisitor", - "style": { - "navigationBarTitleText": "申请记录", - "navigationStyle": "custom" - } - }, - { - "path": "pages/integrated/visitor/myyyvisitor", - "style": { - "navigationBarTitleText": "访客邀约", - "navigationStyle": "custom" - } - }, - { - "path": "pages/integrated/visitor/myyyvisitorlist", - "style": { - "navigationBarTitleText": "邀约记录", - "navigationStyle": "custom" - } - }, - { - "path": "pages/integrated/visitor/verify", - "style": { - "navigationBarTitleText": "访客核销", - "navigationStyle": "custom" - } - }, +// { +// "path": "pages/tabbar/canteen", +// "style": { +// "navigationBarTitleText": "食堂", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/tabbar/selfMerchant", +// "style": { +// "navigationBarTitleText": "自营商家", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/tabbar/coopMerchant", +// "style": { +// "navigationBarTitleText": "合作商家", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/tabbar/order", +// "style": { +// "navigationBarTitleText": "订单", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/tabbar/flowStatistics", +// "style": { +// "navigationBarTitleText": "流水统计", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/tabbar/individualOrder", +// "style": { +// "navigationBarTitleText": "订单", +// "disableScroll": true +// } +// }, +// { +// "path": "pages/integrated/visitor/myvisitor", +// "style": { +// "navigationBarTitleText": "访客", +// "disableScroll": true +// } +// }, { "path": "pages/tabbar/my", "style": { "navigationBarTitleText": "我的", "disableScroll": true } + }, + { + "path": "pages/integrated/visitor/verify", + "style": { + "navigationStyle": "custom" + } } ], "subPackages": [ @@ -351,7 +371,7 @@ { "path": "visitor/myyyvisitor", "style": { - "navigationBarTitleText": "访客邀约" + "navigationBarTitleText": "邀约访客" } } ] @@ -392,39 +412,118 @@ { "pagePath": "pages/integrated/visitor/index", "text": "访客申请", - "iconPath": "static/tabbar/visitor-apply.png", - "selectedIconPath": "static/tabbar/visitor-apply-select.png" + "iconPath": "", + "selectedIconPath": "" }, { "pagePath": "pages/integrated/visitor/myvisitor", "text": "申请记录", - "iconPath": "static/tabbar/visitor-record.png", - "selectedIconPath": "static/tabbar/visitor-record-select.png" + "iconPath": "", + "selectedIconPath": "" }, { "pagePath": "pages/integrated/visitor/myyyvisitor", "text": "访客邀约", - "iconPath": "static/tabbar/visitor-invite.png", - "selectedIconPath": "static/tabbar/visitor-invite-select.png" + "iconPath": "", + "selectedIconPath": "" }, { "pagePath": "pages/integrated/visitor/myyyvisitorlist", "text": "邀约记录", - "iconPath": "static/tabbar/visitor-invited.png", - "selectedIconPath": "static/tabbar/visitor-invited-select.png" + "iconPath": "", + "selectedIconPath": "" }, { "pagePath": "pages/integrated/visitor/verify", - "text": "访客核销", - "iconPath": "static/tabbar/visitor-verify.png", - "selectedIconPath": "static/tabbar/visitor-verify-select.png" + "text": "核销", + "iconPath": "", + "selectedIconPath": "" }, - { - "pagePath": "pages/tabbar/my", - "text": "我的", - "iconPath": "static/tabbar/my.png", - "selectedIconPath": "static/tabbar/my-select.png" - } +// { +// "pagePath": "pages/tabbar/canteen", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/selfMerchant", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/coopMerchant", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/order", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/flowStatistics", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/individualOrder", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// }, +// { +// "pagePath": "pages/tabbar/my", +// "text": "", +// "iconPath": "", +// "selectedIconPath": "" +// } + // { + // "pagePath": "pages/tabbar/canteen", + // "text": "食堂", + // "iconPath": "static/tabbar/canteen.png", + // "selectedIconPath": "static/tabbar/canteen-select.png" + // }, + // { + // "pagePath": "pages/tabbar/selfMerchant", + // "text": "自营商家", + // "iconPath": "static/tabbar/selfMerchant.png", + // "selectedIconPath": "static/tabbar/selfMerchant-select.png" + // }, + // { + // pagePath: "pages/tabbar/coopMerchant", + // text: "合作商家", + // iconPath: "static/tabbar/coopMerchant.png", + // selectedIconPath: "static/tabbar/coopMerchant-select.png", + // }, + // { + // "pagePath": "pages/tabbar/order", + // "text": "订单", + // "iconPath": "static/tabbar/order.png", + // "selectedIconPath": "static/tabbar/order-select.png" + // }, + // { + // "pagePath": "pages/tabbar/flowStatistics", + // "text": "流水统计", + // "iconPath": "static/tabbar/order.png", + // "selectedIconPath": "static/tabbar/order-select.png" + // }, + // { + // "pagePath": "pages/tabbar/individualOrder", + // "text": "订单", + // "iconPath": "static/tabbar/order.png", + // "selectedIconPath": "static/tabbar/order-select.png" + // }, + { + "pagePath": "pages/tabbar/my", + "text": "我的", + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png" + } + ] } } diff --git a/src/pages/integrated/visitor/myyyvisitorlist.vue b/src/pages/integrated/visitor/myyyvisitorlist.vue index 0332231..5c100bf 100644 --- a/src/pages/integrated/visitor/myyyvisitorlist.vue +++ b/src/pages/integrated/visitor/myyyvisitorlist.vue @@ -69,6 +69,30 @@ 暂无数据 + + + + + + 访客申请 + + + + 申请记录 + + + + 主动邀约 + + + + 邀约记录 + + + + 我的 + + @@ -338,7 +362,7 @@ defineExpose({ .page-container { min-height: 100vh; background-color: #f5f5f5; - padding-bottom: 20rpx; // 修改底部间距 + padding-bottom: 120rpx; // 为底部导航留出空间 } .status-tabs { @@ -482,4 +506,40 @@ defineExpose({ color: #999; font-size: 26rpx; } + +.bottom-nav { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 100rpx; + background-color: #fff; + display: flex; + justify-content: space-around; + align-items: center; + border-top: 1rpx solid #eee; + padding-bottom: env(safe-area-inset-bottom); // 适配iPhone底部安全区 + + .nav-item { + display: flex; + flex-direction: column; + align-items: center; + padding: 10rpx 0; + + .nav-icon { + width: 44rpx; + height: 44rpx; + margin-bottom: 4rpx; + } + + .nav-text { + font-size: 20rpx; + color: #999; + + &.active { + color: #1777FF; + } + } + } +} diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 8313fa5..69407a4 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -16,7 +16,7 @@ ID {{ state.userInfo?.sysUser?.userId }} - + 请先登录 @@ -42,40 +42,6 @@ 切换角色 - - - - - - - 账号密码登录 - × - - - - - - - - - - - - - - @@ -114,7 +80,7 @@ const state = reactive<{ // { text: "访客记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myvisitor" }, // { text: "访客邀约", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitor" }, // { text: "邀约记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitorlist" }, - { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" }, + // { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" }, // { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" } ], @@ -159,59 +125,6 @@ const storage = { }, } -// 添加登录相关的状态 -const showLogin = ref(false) -const loginForm = reactive({ - username: '', - password: '' -}) - -// 显示登录弹窗 -const showLoginPopup = () => { - showLogin.value = true -} - -// 关闭登录弹窗 -const closeLoginPopup = () => { - showLogin.value = false - loginForm.username = '' - loginForm.password = '' -} - -// 处理账号密码登录 -const handleLogin = async () => { - if (!loginForm.username || !loginForm.password) { - uni.showToast({ - title: '请输入账号和密码', - icon: 'none' - }) - return - } - - try { - uni.showLoading({ title: '登录中...', mask: true }) - const response = await userApi.login({ - username: loginForm.username, - password: loginForm.password - }) - - if (response.code === 0) { - storage.saveToken({ accessToken: response.data.accessToken }) - const { data: userData } = await userApi.userInfo() - storage.saveUserInfo(userData) - closeLoginPopup() - uni.showToast({ title: '登录成功', icon: 'none' }) - } else { - uni.showToast({ title: response.msg || '登录失败', icon: 'none' }) - } - } catch (error) { - console.error('登录失败:', error) - uni.showToast({ title: '登录失败', icon: 'none' }) - } finally { - uni.hideLoading() - } -} - const login = { // 检查应用环境并登录 checkAppInfo: async () => { @@ -224,8 +137,10 @@ const login = { const zhengdingResult = login.zhengdingLogin() if (zhengdingResult) return - // 如果都不是,显示账号密码登录弹窗 - showLoginPopup() + // 显示账号密码登录界面 + uni.navigateTo({ + url: '/pages/user/login' + }) } catch (error) { console.error("登录失败:", error) uni.showToast({ title: "登录失败", icon: "none" }) @@ -335,6 +250,33 @@ const login = { changeRole: () => { router.jump("/pages/user/userRole") }, + + // 账号密码登录 + accountLogin: async (username: string, password: string) => { + try { + uni.showLoading({ title: "登录中...", mask: true }) + const response = await userApi.login({ username, password }) + + if (response.code == 0) { + storage.saveToken({ accessToken: response.data.accessToken }) + uni.hideLoading() + uni.showToast({ title: "登录成功", icon: "none" }) + + const { data: userData } = await userApi.userInfo() + storage.saveUserInfo(userData) + return true + } else { + uni.hideLoading() + storage.clearUserStorage() + uni.showToast({ title: response.msg || "登录失败", icon: "none" }) + return false + } + } catch (error) { + uni.hideLoading() + uni.showToast({ title: "登录失败", icon: "none" }) + return false + } + }, } const scanCode = { @@ -481,93 +423,4 @@ onShow(() => { border-bottom: 1px solid #fafafa; margin-bottom: 40rpx; } - -// 添加登录弹窗样式 -.login-popup { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 100; - - .popup-mask { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.4); - } - - .popup-content { - position: absolute; - left: 0; - right: 0; - bottom: 0; - background: #fff; - border-radius: 24rpx 24rpx 0 0; - } - - .popup-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 32rpx; - border-bottom: 1rpx solid #f5f5f5; - - .popup-title { - font-size: 32rpx; - color: #323233; - font-weight: 500; - } - - .popup-close { - font-size: 40rpx; - color: #969799; - padding: 10rpx; - } - } - - .popup-body { - padding: 32rpx; - } - - .input-item { - margin-bottom: 24rpx; - - .input { - width: 100%; - height: 88rpx; - background: #F7F8FA; - border-radius: 8rpx; - padding: 0 24rpx; - font-size: 30rpx; - color: #323233; - } - - .placeholder { - color: #969799; - } - } - - .popup-footer { - padding: 24rpx 32rpx; - background: #fff; - border-top: 1rpx solid #f5f5f5; - - .login-btn { - width: 100%; - height: 88rpx; - background: #1989FA; - border-radius: 44rpx; - display: flex; - align-items: center; - justify-content: center; - color: #fff; - font-size: 32rpx; - font-weight: 500; - } - } -} From e640856538a048f039bdb16c3308e0688c2572b4 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 17:06:38 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/App.vue b/src/App.vue index e42042e..e888691 100644 --- a/src/App.vue +++ b/src/App.vue @@ -149,8 +149,6 @@ const setTabbarByUserRole = (role: string) => { export default { async onLaunch() { - if (isDevEnv()) return - uni.setNavigationBarTitle({ title: "" }) // 检查是否已登录 @@ -168,13 +166,6 @@ export default { methods: { async _initTabbar() { - if (isDevEnv()) { - tabbar.forEach((item, index) => { - setTabbarItem(index, item, true) - }) - return - } - // 根据用户角色设置tabbar const userInfo = uni.getStorageSync("userInfo") if (userInfo) { From 6110d8de1652e40b8a59e9507a77ae411e81ea50 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 18:23:46 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 6 ++++-- src/pages.json | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index e888691..1fa5a4c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -151,10 +151,12 @@ export default { async onLaunch() { uni.setNavigationBarTitle({ title: "" }) - // 检查是否已登录 + // 检查登录状态 const token = uni.getStorageSync("token") if (!token) { - uni.navigateTo({ url: "/pages/user/login" }) + uni.navigateTo({ + url: '/pages/test/login' + }) return } diff --git a/src/pages.json b/src/pages.json index df12b47..b503584 100644 --- a/src/pages.json +++ b/src/pages.json @@ -70,6 +70,12 @@ "style": { "navigationStyle": "custom" } + }, + { + "path": "pages/user/login", + "style": { + "navigationBarTitleText": "登录" + } } ], "subPackages": [ From d3cde0e24ac3fefa95083b85d543eca4eb21e341 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 18:31:21 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 340 +++++-------------------------------------------- 1 file changed, 29 insertions(+), 311 deletions(-) diff --git a/src/pages.json b/src/pages.json index b503584..4c0f952 100644 --- a/src/pages.json +++ b/src/pages.json @@ -9,55 +9,6 @@ } }, "pages": [ -// { -// "path": "pages/tabbar/canteen", -// "style": { -// "navigationBarTitleText": "食堂", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/selfMerchant", -// "style": { -// "navigationBarTitleText": "自营商家", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/coopMerchant", -// "style": { -// "navigationBarTitleText": "合作商家", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/order", -// "style": { -// "navigationBarTitleText": "订单", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/flowStatistics", -// "style": { -// "navigationBarTitleText": "流水统计", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/tabbar/individualOrder", -// "style": { -// "navigationBarTitleText": "订单", -// "disableScroll": true -// } -// }, -// { -// "path": "pages/integrated/visitor/myvisitor", -// "style": { -// "navigationBarTitleText": "访客", -// "disableScroll": true -// } -// }, { "path": "pages/tabbar/my", "style": { @@ -70,12 +21,6 @@ "style": { "navigationStyle": "custom" } - }, - { - "path": "pages/user/login", - "style": { - "navigationBarTitleText": "登录" - } } ], "subPackages": [ @@ -249,158 +194,7 @@ { "path": "login", "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/wallet", - "pages": [ - { - "path": "list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "recharge", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/human-face", - "pages": [ - { - "path": "list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "apply", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/user", - "pages": [ - { - "path": "userRole", - "style": { - "navigationBarTitleText": "用户身份", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/pay", - "pages": [ - { - "path": "scanPay", - "style": { - "navigationBarTitleText": "支付", - "disableScroll": true - } - }, - { - "path": "payComplete", - "style": { - "navigationBarTitleText": "支付完成", - "disableScroll": true - } - }, - { - "path": "transferMoney", - "style": { - "navigationBarTitleText": "转账", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "feedback/index", - "style": { - "navigationBarTitleText": "意见反馈" - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "visitor/index", - "style": { - "navigationBarTitleText": "访客" - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "visitor/myvisitor", - "style": { - "navigationBarTitleText": "访客记录" - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "visitor/myyyvisitor", - "style": { - "navigationBarTitleText": "邀约访客" - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "visitor/myyyvisitorlist", - "style": { - "navigationBarTitleText": "邀约记录" - } - } - ] - }, - { - "root": "pages/integrated", - "pages": [ - { - "path": "visitor/visitorDetail", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "记录详情" + "navigationBarTitleText": "登录" } } ] @@ -408,128 +202,52 @@ ], "globalStyle": { "navigationBarTextStyle": "black", - "navigationBarTitleText": "浦江小程序", - "navigationBarBackgroundColor": "#1777FF", - "backgroundColor": "#ecf4f9", - "navigationStyle": "custom" + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" }, "tabBar": { + "color": "#7A7E83", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", "list": [ { "pagePath": "pages/integrated/visitor/index", - "text": "访客申请", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "访客申请" }, { "pagePath": "pages/integrated/visitor/myvisitor", - "text": "申请记录", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "申请记录" }, { "pagePath": "pages/integrated/visitor/myyyvisitor", - "text": "访客邀约", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "主动邀约" }, { "pagePath": "pages/integrated/visitor/myyyvisitorlist", - "text": "邀约记录", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "邀约记录" }, { "pagePath": "pages/integrated/visitor/verify", - "text": "核销", - "iconPath": "", - "selectedIconPath": "" + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "访客核销" }, -// { -// "pagePath": "pages/tabbar/canteen", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/selfMerchant", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/coopMerchant", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/order", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/flowStatistics", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/individualOrder", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// }, -// { -// "pagePath": "pages/tabbar/my", -// "text": "", -// "iconPath": "", -// "selectedIconPath": "" -// } - // { - // "pagePath": "pages/tabbar/canteen", - // "text": "食堂", - // "iconPath": "static/tabbar/canteen.png", - // "selectedIconPath": "static/tabbar/canteen-select.png" - // }, - // { - // "pagePath": "pages/tabbar/selfMerchant", - // "text": "自营商家", - // "iconPath": "static/tabbar/selfMerchant.png", - // "selectedIconPath": "static/tabbar/selfMerchant-select.png" - // }, - // { - // pagePath: "pages/tabbar/coopMerchant", - // text: "合作商家", - // iconPath: "static/tabbar/coopMerchant.png", - // selectedIconPath: "static/tabbar/coopMerchant-select.png", - // }, - // { - // "pagePath": "pages/tabbar/order", - // "text": "订单", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - // { - // "pagePath": "pages/tabbar/flowStatistics", - // "text": "流水统计", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - // { - // "pagePath": "pages/tabbar/individualOrder", - // "text": "订单", - // "iconPath": "static/tabbar/order.png", - // "selectedIconPath": "static/tabbar/order-select.png" - // }, - { - "pagePath": "pages/tabbar/my", - "text": "我的", - "iconPath": "static/tabbar/my.png", - "selectedIconPath": "static/tabbar/my-select.png" - } - + { + "pagePath": "pages/tabbar/my", + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png", + "text": "我的" + } ] } } From a5d0312a1981988a03fed8af5c086b30f2ef0ff9 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 18:49:59 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +- src/pages.json | 24 +++ src/pages/tabbar/my.vue | 318 ++++------------------------------------ 3 files changed, 55 insertions(+), 291 deletions(-) diff --git a/.env b/.env index f5ea089..ab839ac 100644 --- a/.env +++ b/.env @@ -43,5 +43,5 @@ VITE_APP_PROD_SERVICE = http://60.12.184.86:8089/api #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api # 信创线上 # ******************** end 生产环境 end ******************** -VITE_DEV_ENV = dev -# VITE_DEV_ENV = prod +#VITE_DEV_ENV = dev + VITE_DEV_ENV = prod diff --git a/src/pages.json b/src/pages.json index 4c0f952..8ea3c23 100644 --- a/src/pages.json +++ b/src/pages.json @@ -16,6 +16,30 @@ "disableScroll": true } }, + { + "path": "pages/integrated/visitor/index", + "style": { + "navigationBarTitleText": "访客申请" + } + }, + { + "path": "pages/integrated/visitor/myvisitor", + "style": { + "navigationBarTitleText": "申请记录" + } + }, + { + "path": "pages/integrated/visitor/myyyvisitor", + "style": { + "navigationBarTitleText": "主动邀约" + } + }, + { + "path": "pages/integrated/visitor/myyyvisitorlist", + "style": { + "navigationBarTitleText": "邀约记录" + } + }, { "path": "pages/integrated/visitor/verify", "style": { diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 69407a4..796cbdf 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -12,7 +12,6 @@ {{ state.userInfo?.sysUser?.name }} - ID {{ state.userInfo?.sysUser?.userId }} @@ -37,11 +36,6 @@ 退出登录 - - - 切换角色 - - @@ -55,7 +49,6 @@ import { hooks, router, constant } from "@@/index" import { userApi } from "@@/api" import isDevEnv from "@/sheep/utils/isDevEnv" import { usePayStore } from "@/sheep/stores/pay" -// import dd from "gdt-jsapi" const state = reactive<{ wallet: any[] @@ -65,26 +58,12 @@ const state = reactive<{ icon: string router: string }[] - appInfo: string }>({ wallet: [], userInfo: {}, menuList: [ - // { text: "扫一扫", icon: "/static/icon/scan.png", router: "" }, - // { text: "钱包管理", icon: "/static/icon/service_3.png", router: "/pages/wallet/list" }, - // { text: "包厢预定", icon: "/static/icon/service_4.png", router: "/pages/boxes/apply-list" }, - // { text: "外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" }, - // { text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" }, { text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" }, - // { text: "访客", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/index" }, - // { text: "访客记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myvisitor" }, - // { text: "访客邀约", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitor" }, - // { text: "邀约记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitorlist" }, - // { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" }, - - // { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" } ], - appInfo: "", }) // 常量 @@ -126,115 +105,6 @@ const storage = { } const login = { - // 检查应用环境并登录 - checkAppInfo: async () => { - try { - // 先尝试诗画登录 - const shihuaResult = await login.shihuaLogin() - if (shihuaResult) return - - // 尝试浙政钉登录 - const zhengdingResult = login.zhengdingLogin() - if (zhengdingResult) return - - // 显示账号密码登录界面 - uni.navigateTo({ - url: '/pages/user/login' - }) - } catch (error) { - console.error("登录失败:", error) - uni.showToast({ title: "登录失败", icon: "none" }) - } - }, - - // 诗画环境登录 - shihuaLogin: async () => { - const appInfo = await (window as any).CP2.getAppInfo() - if (appInfo.code == 0) return false - - const userInfo = await (window as any).CP2.getUserInfo() - if (userInfo.code == 0) { - uni.showToast({ title: "获取诗画用户信息失败", icon: "none" }) - return false - } else { - const { accountId, sessionId } = userInfo.data - return login.doLogin(1, "", accountId, sessionId) - // return login.doLogin(1, "", "67186e49d63fea141aad6772", "67186e49d63fea141aad6776") - } - }, - - // 浙政钉登录 - zhengdingLogin: () => { - const params = new URL(window.location.href).searchParams - const token = params.get("uabaseToken") - if (token) { - return login.doLogin(2, token, "", "") - } - return false - }, - - // 执行登录操作 - loginType 1:诗画登录 2:浙政钉登录 - doLogin: async (loginType: number, token: string, accountId: string, sessionId: string) => { - const tokenStorage = uni.getStorageSync(STORAGE_KEYS.TOKEN) - const userStorage = uni.getStorageSync(STORAGE_KEYS.USER_INFO) - - switch (loginType) { - case 1: // 诗画登录 - uni.showLoading({ title: "登录中...", mask: true }) - const response = await userApi.authsh({ accountId, sessionId }) - - if (response.code == 0) { - storage.saveToken({ accessToken: response.data.accessToken }) - uni.hideLoading() - uni.showToast({ title: "登录成功", icon: "none" }) - - const { data: userData } = await userApi.userInfo() - storage.saveUserInfo(userData) - } else { - uni.hideLoading() - storage.clearUserStorage() - if (response.msg == "token已失效") { - uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 }) - } else { - uni.showToast({ title: response.msg || "登录失败", icon: "none" }) - } - } - break - - case 2: // 浙政钉登录 - if (isEmpty(tokenStorage) || isEmpty(userStorage)) { - try { - uni.showLoading({ title: "登录中...", mask: true }) - const res = await userApi.auth(token) - - if (res.code == 0) { - storage.saveToken(res.data) - uni.hideLoading() - uni.showToast({ title: "登录成功", icon: "none" }) - - const { data: userData } = await userApi.userInfo() - storage.saveUserInfo(userData) - } else { - storage.clearUserStorage() - if (res.msg == "token已失效") { - uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 }) - } else { - uni.showToast({ title: res.msg || "登录失败", icon: "none" }) - } - } - } catch (error) { - uni.showToast({ title: "登录错误", icon: "none" }) - } finally { - uni.hideLoading() - } - } - break - - default: - uni.showToast({ title: "当前登录环境未知", icon: "none" }) - } - }, - // 退出登录 logout: async () => { const isLogin = await hooks.useCheckLogin() @@ -245,182 +115,52 @@ const login = { uni.hideLoading() uni.showToast({ title: "退出登录成功", icon: "none" }) }, - - // 切换角色 - changeRole: () => { - router.jump("/pages/user/userRole") - }, - - // 账号密码登录 - accountLogin: async (username: string, password: string) => { - try { - uni.showLoading({ title: "登录中...", mask: true }) - const response = await userApi.login({ username, password }) - - if (response.code == 0) { - storage.saveToken({ accessToken: response.data.accessToken }) - uni.hideLoading() - uni.showToast({ title: "登录成功", icon: "none" }) - - const { data: userData } = await userApi.userInfo() - storage.saveUserInfo(userData) - return true - } else { - uni.hideLoading() - storage.clearUserStorage() - uni.showToast({ title: response.msg || "登录失败", icon: "none" }) - return false - } - } catch (error) { - uni.hideLoading() - uni.showToast({ title: "登录失败", icon: "none" }) - return false - } - }, } -const scanCode = { - // 扫一扫 - scan: async () => { - usePayStore().setPayData({}) - try { - const decodedString = await scanCode.getScanResult() - - if (decodedString) { - scanCode.processScanResult(decodedString) - } - // else { - // uni.showToast({ title: "无效的二维码", icon: "none" }) - // } - } catch (error: any) { - // if (error) { - // uni.showToast({ title: error, icon: "none" }) - // } - } - }, - - // 获取扫码结果 - getScanResult: async (): Promise => { - if (isDevEnv()) { - // 开发环境模拟扫码 - // const testQrCode = "eyJpZCI6IjE4OTYxNTcyMDc2NDQwNTM1MDYiLCJuYW1lIjoi5rWL6K+V5ZWG5oi3In0=" // 线上-测试超市-收款码 - // const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 测试环境-邓本地-新县府超市-收款码 - const testQrCode = "eyJpZCI6IjE5MDc2ODQwNTY4NDA4NDMyNjYiLCJuYW1lIjoi5pm66IO95p+c6Ieq6JCl5ZWG5oi3MSJ9" // 测试环境-邓本地-智能柜自营商户1-收款码 - uni.showToast({ title: "开发环境不是浙政钉环境,扫码仅供测试,收款商家为测试商户超市", icon: "none" }) - return scanCode.decodeBase64(testQrCode) - } else if (state.appInfo == "dd") { - // 浙政钉扫码 - const res: any = await (window as any).dd.scan({ type: "all" }) - return scanCode.decodeBase64(res.text) - } else if (state.appInfo == "sh") { - // 诗画扫码 - const res = await (window as any).CP2.showScanQr({ needResult: 1 }) - if (res.code == 1) return scanCode.decodeBase64(res.data.qrCode) - } else { - uni.showToast({ title: "当前环境未知", icon: "none" }) - } - }, - - // 处理扫码结果 - processScanResult: (decodedString: string) => { - try { - const decodedJson = JSON.parse(decodedString) - if (decodedJson?.id && decodedJson?.name) { - usePayStore().setPayData(decodedJson) - router.jump("/pages/pay/scanPay") - } else { - uni.showToast({ title: "无效的二维码", icon: "none" }) - } - } catch (error) { - uni.showToast({ title: "无效的二维码内容", icon: "none" }) - } - }, - - // 解码base64 - decodeBase64: (base64String: string): string | undefined => { - try { - const decodedBinaryString = atob(base64String) - const uint8Array = new Uint8Array(decodedBinaryString.length) - for (let i = 0; i < decodedBinaryString.length; i++) { - uint8Array[i] = decodedBinaryString.charCodeAt(i) - } - const decoder = new TextDecoder("utf-8") - const decodedString = decoder.decode(uint8Array) - console.log("解码结果", decodedString) - return decodedString - } catch (error) { - console.error("Base64 解码失败:", error) - uni.showToast({ title: "无效的二维码", icon: "none" }) - return undefined - } - }, +// 点击登录 +const onTabLogin = () => { + uni.navigateTo({ + url: '/pages/test/login' + }) } -const onTabLogin = () => (isDevEnv() ? router.jump("/pages/test/login") : login.checkAppInfo()) - -const onTabMenu = async (item: any, index: number) => { - if (index == state.menuList.length - 1) { - router.jump(item.router) - return - } - - const isLogin = await hooks.useCheckLogin() - if (isLogin) { - if (item.text === "扫一扫") { - await scanCode.scan() - } else { - router.jump(item.router) - } +// 点击菜单 +const onTabMenu = (v: any, i: number) => { + if (v.router) { + uni.navigateTo({ + url: v.router + }) } } // 退出登录 -const doLogout = async () => { - await login.logout() +const doLogout = () => { + uni.showModal({ + title: "提示", + content: "确定要退出登录吗?", + success: async (res) => { + if (res.confirm) { + await login.logout() + } + } + }) } -// 切换角色 -const doChangeRole = () => { - login.changeRole() -} - -// 初始化配置菜单 -const initMenuConfig = () => { - if (isDevEnv()) { - state.menuList.push({ - text: "测试-登录", - icon: "/static/icon/login.png", - router: "/pages/test/login", - }) - state.menuList.push({ - text: "测试-角色选择", - icon: "/static/icon/login.png", - router: "/pages/user/userRole", - }) - } -} - -onLoad(async () => { - const app = getApp() - app._initTabbar() - - // 初始化配置菜单 - initMenuConfig() - - // 获取应用信息 - state.appInfo = await getAppInfo() +onLoad(() => { + storage.getUserInfo() }) onShow(() => { - // 获取存储中的用户信息 storage.getUserInfo() }) From f526b505579fbf35c46501eb2a163d0a20e67fdb Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Fri, 18 Apr 2025 18:58:01 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/integrated/visitor/myvisitor.vue | 295 ++++++++++----------- 1 file changed, 142 insertions(+), 153 deletions(-) diff --git a/src/pages/integrated/visitor/myvisitor.vue b/src/pages/integrated/visitor/myvisitor.vue index 3d1ac70..bb1c96e 100644 --- a/src/pages/integrated/visitor/myvisitor.vue +++ b/src/pages/integrated/visitor/myvisitor.vue @@ -321,170 +321,159 @@ onMounted(() => { \ No newline at end of file From d0f5ef2bdd0119092e7add8d77e7822ad3565d0b Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Mon, 21 Apr 2025 20:56:39 +0800 Subject: [PATCH 09/12] env --- .env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env b/.env index ab839ac..8a2aede 100644 --- a/.env +++ b/.env @@ -39,9 +39,9 @@ VITE_OAUTH2_APP_CLIENT='mini:mini' #VITE_APP_PROD_SERVICE = http://123.156.228.134:48080/app-api ; #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api #VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api -VITE_APP_PROD_SERVICE = http://60.12.184.86:8089/api +#VITE_APP_PROD_SERVICE = http://60.12.184.86:8089/api #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api # 信创线上 # ******************** end 生产环境 end ******************** -#VITE_DEV_ENV = dev - VITE_DEV_ENV = prod +VITE_DEV_ENV = dev + #VITE_DEV_ENV = prod From 32c485e539eba83d50cc461d806446e1d4618e22 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Mon, 21 Apr 2025 20:57:35 +0800 Subject: [PATCH 10/12] env --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 8a2aede..41815ee 100644 --- a/.env +++ b/.env @@ -39,7 +39,7 @@ VITE_OAUTH2_APP_CLIENT='mini:mini' #VITE_APP_PROD_SERVICE = http://123.156.228.134:48080/app-api ; #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api #VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api -#VITE_APP_PROD_SERVICE = http://60.12.184.86:8089/api +VITE_APP_PROD_SERVICE = http://123.156.230.15:8089/api #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api # 信创线上 # ******************** end 生产环境 end ******************** From fcb4e0d8903db47c4bed3741843d771a65ae3d7a Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Tue, 22 Apr 2025 11:08:57 +0800 Subject: [PATCH 11/12] env --- .env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 41815ee..93bf388 100644 --- a/.env +++ b/.env @@ -43,5 +43,5 @@ VITE_APP_PROD_SERVICE = http://123.156.230.15:8089/api #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api # 信创线上 # ******************** end 生产环境 end ******************** -VITE_DEV_ENV = dev - #VITE_DEV_ENV = prod +#VITE_DEV_ENV = dev + VITE_DEV_ENV = prod From b9345a58f5cfb405c548b363c44a045b7dd51828 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Tue, 22 Apr 2025 11:55:20 +0800 Subject: [PATCH 12/12] request.ts --- src/sheep/utils/request.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sheep/utils/request.ts b/src/sheep/utils/request.ts index 3f76b23..f19f7c7 100644 --- a/src/sheep/utils/request.ts +++ b/src/sheep/utils/request.ts @@ -34,10 +34,10 @@ function showLoading(message: string) { // 读取token并处理Authorization请求头 const getAuthHeader = (tokenStorage: any) => { - if (isDevEnv()) { + // if (isDevEnv()) { return tokenStorage?.access_token ? `Bearer ${tokenStorage.access_token}` : null - } - return tokenStorage?.accessToken?.tokenValue ? `Bearer ${tokenStorage.accessToken.tokenValue}` : null + // } + // return tokenStorage?.accessToken?.tokenValue ? `Bearer ${tokenStorage.accessToken.tokenValue}` : null } // 浙政钉登录 登录成功返回true,否则返回false