diff --git a/b/account/email_info.dspy b/b/account/email_info.dspy index c4a6e4b..741c857 100644 --- a/b/account/email_info.dspy +++ b/b/account/email_info.dspy @@ -90,8 +90,10 @@ async def email_info(msg, indent=0): index = find_data.index("<") name = find_data[:index] if price and name: - mail_code_sql = """SELECT * FROM mail_code WHERE LOCATE(mailcode, '%s') > 0 and del_flg = '0';""" % name - mail_code = await sor.sqlExe(mail_code_sql, {}) + mail_code_sql = """SELECT * FROM mail_code WHERE mailcode= ${mailcode}$ and del_flg = '0';""" + mail_code = await sor.sqlExe(mail_code_sql, {'mailcode': name}) + if len(mail_code) < 1: + raise Exception(f'{name}不是合法的编码,数据库中没有找到') # mail_code = await sor.R('mail_code',{'mailcode':name,'del_flg':'0'}) date = await get_business_date(sor=None) recharge_log = {'customerid': mail_code[0]['customer_id'], 'recharge_amt': price, @@ -119,4 +121,4 @@ async def email_info(msg, indent=0): msg = Parser().parsestr(msg_content) ret = await email_info(msg) -return ret \ No newline at end of file +return ret diff --git a/f/web-kboss/src/components/FloatingBox/FloatingBox.vue b/f/web-kboss/src/components/FloatingBox/FloatingBox.vue index 40cf304..1cc6dd2 100644 --- a/f/web-kboss/src/components/FloatingBox/FloatingBox.vue +++ b/f/web-kboss/src/components/FloatingBox/FloatingBox.vue @@ -6,7 +6,7 @@
-
+
@@ -789,7 +789,7 @@ export default { top: -28px; width: 40px; height: 40px; - z-index: 9999; + z-index: 99; } position: relative; diff --git a/f/web-kboss/src/main.js b/f/web-kboss/src/main.js index 77e80ea..272443e 100644 --- a/f/web-kboss/src/main.js +++ b/f/web-kboss/src/main.js @@ -171,7 +171,7 @@ Vue.use(HappyScroll) // }); // console.log(element); -// console.clear(); // 清除测试日志 +// console.clear(); // 清除测试日志 // } // // 方法4: 检查Eruda等移动端调试工具 @@ -345,6 +345,77 @@ window.addEventListener('beforeunload', function () { Object.keys(filters).forEach(key => { Vue.filter(key, filters[key]) }) +// 在 main.js 的 router.beforeEach 中添加 +router.beforeEach((to, from, next) => { + // 清空面包屑状态的代码 + // store.commit('tagsView/resetBreadcrumbState'); + + // 新增:检测是否为移动设备 + const userAgent = navigator.userAgent; + const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent); + + // 如果是移动设备且访问的是根路径,重定向到移动端首页 + if (isMobile && to.path === '/') { + next('/h5HomePage'); + return; + } + + // 如果是移动设备且访问的不是移动端页面,重定向到移动端首页 + if (isMobile && !to.meta?.isMobile && to.path !== '/h5HomePage' && !to.path.startsWith('/h5HomePage/')) { + next('/h5HomePage'); + return; + } + + // 如果已登录且有token,但Vuex状态丢失,从sessionStorage恢复 + if (store.getters.token && (!store.getters.user || !store.getters.userType)) { + console.log("检测到状态丢失,从sessionStorage恢复用户状态"); + + const user = sessionStorage.getItem('user'); + const auths = sessionStorage.getItem('auths'); + const userType = sessionStorage.getItem('userType'); + const orgType = sessionStorage.getItem('orgType'); + + if (user) { + store.commit('user/SET_USER', user); + } + if (auths) { + store.commit('user/SET_AUTHS', JSON.parse(auths)); + } + if (userType) { + store.commit('user/SET_USER_TYPE', userType); + } + if (orgType) { + store.commit('user/SET_ORG_TYPE', parseInt(orgType)); + } + + // 重新生成路由 + try { + const accessRoutes = store.dispatch('permission/generateRoutes', { + user: store.getters.user, + auths: store.getters.auths, + userType: store.getters.userType, + orgType: store.getters.orgType + }); + + // 重新添加路由 + router.addRoutes(accessRoutes); + + // 重定向到当前路由以确保路由更新 + next({ ...to, replace: true }); + return; + } catch (error) { + console.error('重新生成路由失败:', error); + } + } + + onOverflow.forEach(element => { + if (to.path == element) { + document.querySelector("body").setAttribute("style", "overflow: auto !important;") + } + }); + + next(); +}); Vue.config.productionTip = false diff --git a/f/web-kboss/src/store/modules/permission.js b/f/web-kboss/src/store/modules/permission.js index 9b9188d..dfa8adf 100644 --- a/f/web-kboss/src/store/modules/permission.js +++ b/f/web-kboss/src/store/modules/permission.js @@ -6,8 +6,83 @@ const userAgent = window.navigator.userAgent; // 判断是否为移动设备 const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent); +// 如果是移动设备,添加移动端首页路由和根路径重定向 +if (isMobile) { + console.log("检测到移动设备,添加移动端路由"); + + // 先添加根路径重定向到移动端首页 + constantRoutes.unshift({ + path: '/', + redirect: '/h5HomePage', + hidden: true + }); + + // 添加移动端首页路由 + constantRoutes.push({ + path: '/h5HomePage', + name: 'H5HomePage', + title: 'H5首页', + component: () => import('@/views/H5/index.vue'), + hidden: true, + redirect: "/h5HomePage/index", + meta: { isMobile: true }, + children: [ + { + path: "index", + title: 'H5首页', + component: () => import('@/views/H5/official/index.vue'), + meta: { + title: "H5首页", + fullPath: "/h5HomePage/index", + isMobile: true + }, + }, + { + path: "cloud", + title: '云', + component: () => import('@/views/H5/cloud/index.vue'), + meta: { + title: "云", + fullPath: "/h5HomePage/cloud", + isMobile: true + }, + }, + { + path: "calculate", + title: '算', + component: () => import('@/views/H5/calculate/index.vue'), + meta: { + title: "算", + fullPath: "/h5HomePage/calculate", + isMobile: true + }, + }, + { + path: "net", + title: '网', + component: () => import('@/views/H5/net/index.vue'), + meta: { + title: "网", + fullPath: "/h5HomePage/net", + isMobile: true + }, + }, + { + path: "use", + title: '用', + component: () => import('@/views/H5/use/index.vue'), + meta: { + title: "用", + fullPath: "/h5HomePage/use", + isMobile: true + }, + }, + ] + }); +} + // 修复:更全面的路由过滤逻辑 -function filterAsyncRoutes(routes, permissions, userRoles = []) { +function filterAsyncRoutes(routes, permissions, userRoles = [], deviceType = 'pc') { const res = []; // 定义需要客户角色才能访问的路由 @@ -35,6 +110,14 @@ function filterAsyncRoutes(routes, permissions, userRoles = []) { return; // 跳过当前路由 } + // 新增:根据设备类型过滤路由 + if (deviceType === 'mobile' && !(route.meta?.isMobile || route.meta?.isMobile === true)) { + return; // 移动设备跳过非移动端路由 + } + if (deviceType === 'pc' && route.meta?.isMobile === true) { + return; // PC设备跳过移动端路由 + } + // 如果当前路由有权限,则加入结果 if (hasPermission) { res.push(tmpRoute); @@ -45,7 +128,7 @@ function filterAsyncRoutes(routes, permissions, userRoles = []) { } // 如果没有直接权限,但有子路由,递归处理子路由 else if (tmpRoute.children) { - const filteredChildren = filterAsyncRoutes(tmpRoute.children, permissions, userRoles); + const filteredChildren = filterAsyncRoutes(tmpRoute.children, permissions, userRoles, deviceType); if (filteredChildren.length > 0) { tmpRoute.children = filteredChildren; res.push(tmpRoute); // 即使父路由本身没有权限,只要有子路由有权限,也要保留父路由 @@ -57,7 +140,7 @@ function filterAsyncRoutes(routes, permissions, userRoles = []) { } // 新增:为普通用户添加订单管理和资源管理路由 -function addUserRoutes(routes, userType, orgType, userRoles = []) { +function addUserRoutes(routes, userType, orgType, userRoles = [], deviceType = 'pc') { console.log("addUserRoutes - userType:", userType, "orgType:", orgType, "userRoles:", userRoles); const userRoutes = []; @@ -67,12 +150,13 @@ function addUserRoutes(routes, userType, orgType, userRoles = []) { const orderManagementRoute = routes.find(route => route.path === "/orderManagement"); const resourceManagementRoute = routes.find(route => route.path === "/resourceManagement"); - if (orderManagementRoute) { + // 新增:根据设备类型过滤 + if (orderManagementRoute && (deviceType === 'pc' || orderManagementRoute.meta?.isMobile === true)) { console.log("添加订单管理路由"); userRoutes.push(JSON.parse(JSON.stringify(orderManagementRoute))); // 深拷贝 } - if (resourceManagementRoute) { + if (resourceManagementRoute && (deviceType === 'pc' || resourceManagementRoute.meta?.isMobile === true)) { console.log("添加资源管理路由"); userRoutes.push(JSON.parse(JSON.stringify(resourceManagementRoute))); // 深拷贝 } @@ -85,10 +169,10 @@ function addUserRoutes(routes, userType, orgType, userRoles = []) { routes.find(route => route.path === "/rechargeManagement"), routes.find(route => route.path === "/invoiceManagement"), routes.find(route => route.path === "/workOrderManagement") - ].filter(route => { // 过滤掉undefined,并且只有客户角色才能看到这些路由 - return route && userRoles.includes('客户'); + return route && userRoles.includes('客户') && + (deviceType === 'pc' || route.meta?.isMobile === true); }); console.log("添加新的客户菜单路由:", newCustomerRoutes.map(r => r.path)); @@ -97,38 +181,11 @@ function addUserRoutes(routes, userType, orgType, userRoles = []) { return userRoutes; } -function filterRoutesMobile(routes) { - return routes.filter(route => { - if (route.children && route.children.length) { - route.children = filterRoutesMobile(route.children); - return route.children.length > 0; - } - if (route.meta?.isMobile || route.meta?.isMobile === true) { - return true; - } else { - return false; - } - }); -} - -function filterRoutesPc(routes) { - return routes.filter(route => { - if (route.children && route.children.length) { - route.children = filterRoutesPc(route.children); - return route.children.length > 0; - } - if (!route.meta?.isMobile || route.meta?.isMobile === false) { - return true; - } else { - return false; - } - }); -} - const state = { routes: [], addRoutes: [], - users: [] + users: [], + isMobile: isMobile // 保存设备类型状态 }; const mutations = { @@ -136,11 +193,15 @@ const mutations = { console.log("MUTATION SET_ROUTES - received routes:", routes); state.addRoutes = routes; sessionStorage.setItem("routes", JSON.stringify(routes)); + // 将移动端首页路由也包含在内 state.routes = constantRoutes.concat(routes); console.log("MUTATION SET_ROUTES - final state.routes:", state.routes); }, SETUSERS: (state, user) => { state.users = user; + }, + SET_DEVICE_TYPE: (state, isMobile) => { + state.isMobile = isMobile; } }; @@ -161,7 +222,7 @@ const actions = { * @param {Object} [params.user] - 用户信息对象 * @returns {Promise} 解析后的动态路由数组 */ - generateRoutes({ commit, rootState }, params) { + generateRoutes({ commit, rootState, state }, params) { console.log("ACTION generateRoutes - params:", params); return new Promise((resolve) => { let accessedRoutes; @@ -176,10 +237,18 @@ const actions = { console.log("用户类型:", userType, "orgType:", orgType); + // 确定设备类型 + const deviceType = state.isMobile ? 'mobile' : 'pc'; + console.log("设备类型:", deviceType); + // 修复:包含 orgType 为 2 和 3 的情况 if (params.user && params.user.includes("admin") && orgType != 2 && orgType != 3) { - // 管理员:只显示超级管理员菜单 - accessedRoutes = asyncRoutes.filter(item => item.path === '/superAdministrator'); + // 管理员:只显示超级管理员菜单(仅PC端) + if (deviceType === 'pc') { + accessedRoutes = asyncRoutes.filter(item => item.path === '/superAdministrator'); + } else { + accessedRoutes = []; + } } else { const auths = params.auths ? JSON.parse(JSON.stringify(params.auths)) : []; console.log("ACTION generateRoutes - auths:", auths); @@ -195,8 +264,8 @@ const actions = { // 如果权限列表包含空路径,认为用户有所有权限 accessedRoutes = asyncRoutes || []; } else { - // 使用修复后的过滤函数,传入用户角色 - accessedRoutes = filterAsyncRoutes(asyncRoutes, auths, userRoles); + // 使用修复后的过滤函数,传入用户角色和设备类型 + accessedRoutes = filterAsyncRoutes(asyncRoutes, auths, userRoles, deviceType); } } else { // 如果没有权限列表,不显示任何动态路由 @@ -205,7 +274,7 @@ const actions = { // 新增:为普通用户添加订单管理和资源管理路由以及新的五个客户菜单 console.log("为用户添加特定路由"); - const userSpecificRoutes = addUserRoutes(asyncRoutes, userType, orgType, userRoles); + const userSpecificRoutes = addUserRoutes(asyncRoutes, userType, orgType, userRoles, deviceType); // 确保不重复添加路由,同时检查角色权限 userSpecificRoutes.forEach(route => { diff --git a/f/web-kboss/src/views/H5/calculate/index.vue b/f/web-kboss/src/views/H5/calculate/index.vue index 00b348a..af5b513 100644 --- a/f/web-kboss/src/views/H5/calculate/index.vue +++ b/f/web-kboss/src/views/H5/calculate/index.vue @@ -4,7 +4,22 @@
开元云
- + +
@@ -83,6 +99,8 @@ export default { return { cloudData: {}, activeSupplierIndex: 0, // 默认选中第一个供应商 + searchValue: '', // 搜索关键词 + isSearching: false, // 是否正在搜索 // 咨询弹窗相关 showConsultDialog: false, @@ -116,6 +134,26 @@ export default { } }, + // 处理搜索 + handleSearch() { + this.isSearching = !!this.searchValue.trim() + // 这里可以根据需要添加实际的搜索逻辑,比如调用API + console.log('搜索关键词:', this.searchValue) + }, + + // 判断产品是否应该显示 + shouldShowProduct(product) { + if (!this.isSearching) { + return true + } + // 模糊搜索:检查产品名称或描述中是否包含搜索关键词 + const keyword = this.searchValue.toLowerCase().trim() + return ( + (product.name && product.name.toLowerCase().includes(keyword)) || + (product.description && product.description.toLowerCase().includes(keyword)) + ) + }, + // 选择供应商 selectSupplier(index) { this.activeSupplierIndex = index diff --git a/f/web-kboss/src/views/H5/cloud/index.vue b/f/web-kboss/src/views/H5/cloud/index.vue index 4a5a86a..273f2c2 100644 --- a/f/web-kboss/src/views/H5/cloud/index.vue +++ b/f/web-kboss/src/views/H5/cloud/index.vue @@ -4,6 +4,22 @@
开元云
+ +
@@ -19,7 +35,7 @@