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/b/ali/jiajie_sync_user.dspy b/b/ali/jiajie_sync_user.dspy index d0fd294..28b0e94 100644 --- a/b/ali/jiajie_sync_user.dspy +++ b/b/ali/jiajie_sync_user.dspy @@ -71,7 +71,7 @@ async def jiajie_sync_user(ns={}): else: return { 'status': False, - 'msg': f"用户手机号:{phone}, 请求失败,状态码: {result.get('code')},响应内容: {result.get('msg')}" + 'msg': f"用户手机号:{phone}已经被占用, 用户同步阿里云-请求失败,状态码: {result.get('code')},响应内容: {result.get('msg')}" } ret = await jiajie_sync_user(params_kw) diff --git a/b/baiduc/baidu_confirm_auto_renew_order.dspy b/b/baiduc/baidu_confirm_auto_renew_order.dspy index 0aafc0d..2f22643 100644 --- a/b/baiduc/baidu_confirm_auto_renew_order.dspy +++ b/b/baiduc/baidu_confirm_auto_renew_order.dspy @@ -248,7 +248,7 @@ async def diff_sms_send_save(sor=None, productname=None, time_interval=24*60, se # 给个人发送短信 await send_vcode(customer_phone, send_type, sms_send_dict) except Exception as e: - print('发送短信失败: %s' % e) + print('发送短信失败: %s' % str(e)) return { 'status': False, 'msg': '发送短信失败', @@ -662,9 +662,9 @@ async def get_baidu_orderlist(ns={}): # 发送短信 sms_send_dict = { 'time': time.strftime('%Y-%m-%d %H:') + '00:00', - 'productname': None + 'productname': '相关服务' } - await diff_sms_send_save(sor=sor, time_interval=24*60, send_type='用户欠费通知', user_orgid=orgid, sms_send_dict=sms_send_dict) + await diff_sms_send_save(sor=sor, time_interval=24*60, send_type='用户欠费通知', user_orgid=orgid[0]['id'], sms_send_dict=sms_send_dict) return {'status': False,'msg': '该账号余额不足,无法完成购买'} except Exception as e: @@ -792,25 +792,31 @@ async def baidu_confirm_auto_renew_order(ns={}): renew_sql = """ SELECT bo.*, bs.user_id FROM baidu_orders AS bo LEFT JOIN baidu_users AS bs ON bo.accountid = bs.baidu_id WHERE bo.ordertype = 'RENEW' AND bo.status = 'NEED_CONFIRM' AND bo.del_flg = '0'; """ # return {'1': renew_sql} renew_results = await sor.sqlExe(renew_sql, {}) - - renew_status_count = 0 - # 执行 get_baidu_orderlist sor分开运行 - for renew_res in renew_results: - order_id = renew_res.get('orderid') - user_id = renew_res.get('user_id') - - renew_status = await get_baidu_orderlist({'order_id': order_id, 'userid': user_id}) - if renew_status.get('status'): - renew_status_count += 1 - else: - ns_err_log = { - 'id': uuid(), - 'log_level': 'ERROR', - 'log_content': '续费订单 %s 失败 %s' % (order_id, str(renew_status)), - 'user_id': user_id, - 'request_url': '/baiduc/baidu_confirm_auto_renew_order.dspy' - } - await sor.C('warn_error_log', ns_err_log) + + try: + renew_status_count = 0 + # 执行 get_baidu_orderlist sor分开运行 + for renew_res in renew_results: + order_id = renew_res.get('orderid') + user_id = renew_res.get('user_id') + + renew_status = await get_baidu_orderlist({'order_id': order_id, 'userid': user_id}) + if renew_status.get('status'): + renew_status_count += 1 + else: + db = DBPools() + async with db.sqlorContext('kboss') as sor: + ns_err_log = { + 'id': uuid(), + 'log_level': 'ERROR', + 'log_content': '续费订单 %s 失败 %s' % (order_id, str(renew_status)), + 'user_id': user_id, + 'request_url': '/baiduc/baidu_confirm_auto_renew_order.dspy' + } + await sor.C('warn_error_log', ns_err_log) + + except Exception as e: + print(e) # 并触发update函数 update_msg = await update_baidu_order_list({'orgid': orgid}) diff --git a/b/baiduc/baidu_users_get_post_pay.dspy b/b/baiduc/baidu_users_get_post_pay.dspy index aaafa24..6820347 100644 --- a/b/baiduc/baidu_users_get_post_pay.dspy +++ b/b/baiduc/baidu_users_get_post_pay.dspy @@ -340,6 +340,10 @@ async def baidu_post_pay_charge(bill_exist=None, info_detail=None, baidu_orgid=N } await sor_bill.U('baidu_post_bill', ns_bill_status) print('百度账单扣费: %s, 扣费成功' % info_detail['billid']) + + # 扣费成功后 arrears表中数据更新 + update_arrears_sql = """update arrears set bill_state = '1' and endtime = '%s' where localid = '%s';""" % (time.strftime('%Y-%m-%d %H:%M:%S'), info_detail_id) + await sor_bill.sqlExe(update_arrears_sql, {}) except Exception as e: print('用户: %s, 账单: %s, 扣费失败: %s' % (user_orgid, info_detail['billid'], e)) if not bill_exist: @@ -645,8 +649,8 @@ async def baidu_users_get_post_pay(ns={}): userid = baidu_user['user_id'] baidu_id = baidu_user['baidu_id'] - if baidu_id != 'a6f0dbc20f074ea18b4d3ac3ec77d537': - continue + # if baidu_id != 'f61b662bcd684499b6403371365715b9': + # continue try: user_orgid = (await sor.R('users', {'id': userid}))[0]['orgid'] user_parentid = (await sor.R('organization', {'id': user_orgid}))[0]['parentid'] diff --git a/b/baiduc/get_postpay_detail.dspy b/b/baiduc/get_postpay_detail.dspy new file mode 100644 index 0000000..edad0d1 --- /dev/null +++ b/b/baiduc/get_postpay_detail.dspy @@ -0,0 +1,43 @@ +async def get_postpay_detail(ns={}): + + baidu_id = ns.get('baidu_id') + pageno = int(ns.get('pageno')) + # 获取当前日期和时间 + current_time = datetime.datetime.now() + + days_ago = current_time - datetime.timedelta(days=20) + # 获取账单百度指定必须在同一个月内 + if current_time.month != days_ago.month: + days_ago = datetime.datetime(current_time.year, current_time.month, 1) + + # 将日期时间格式化为字符串 + current_day = current_time.strftime("%Y-%m-%d") + days_ago_time = days_ago.strftime("%Y-%m-%d") + + ns = { + "beginTime": days_ago_time, + "endTime": current_day, + "queryAccountId" : baidu_id, + "pageNo": pageno, + "pageSize": 100 + } + method = 'POST' + ns_format = '&'.join(['%s=%s' % (k, v) for k, v in ns.items()]) + url = 'https://billing.baidubce.com/v1/bill/resource/chargeitem?%s' % ns_format + header = { + "Host": "billing.baidubce.com" + } + header = await get_auth_header(method=method, url=url, header=header) + async with aiohttp_client.request( + method=method, + url=url, + headers=header, + json=ns) as res: + data_bill = await res.json() + return { + 'status': True, + 'data': data_bill + } + +ret = await get_postpay_detail(params_kw) +return ret \ No newline at end of file diff --git a/b/product/get_firstpage_net_detail.dspy b/b/product/get_firstpage_net_detail.dspy index d605fec..5f2b32b 100644 --- a/b/product/get_firstpage_net_detail.dspy +++ b/b/product/get_firstpage_net_detail.dspy @@ -1,6 +1,6 @@ detailDataDCI = { "title": "DCI业务", - "description": "凭借先进的SDN技术,及覆盖全国网络资源优势,满足客户办公场所至云数据中心、数据中心至云数据中心、云数据中心至云数据中心、数据中心至数据中心的互联需求。解决企业上云最后一公里连接需求,实现多云互联的场景,满足用户数据传送高带宽、高质量、内网化的需求。", + "description": "凭借先进的SDN技术,及覆盖全国网络资源优势,解决企业上云最后一公里连接需求,实现多云互联的场景,满足用户数据传送高带宽、高质量、内网化的需求。", # 产品优势 "adList": [ { @@ -157,7 +157,7 @@ detailDataDCI = { detailDataHL = { "title": "互联网专线业务", - "description": "开元云互联网接入业务,凭借多年的互联网运营经验,通过搭建新一代的宽带网络及综合电信业务平台,应用最先进的国际通信技术、提供最完美的通信手段,以服务品质和创新能力树立核心竞争力,通过全方位的、电信级的整合通信服务,更好的为我们的客户提供全方位的通信网络一体化解决方案,为企业客户提供一级运营商品质的互联网接入产品与增值服务。", + "description": "开元云互联网接入业务,凭借多年的互联网运营经验,通过搭建新一代的宽带网络及综合电信业务平台,为企业客户提供一级运营商品质的互联网接入产品与增值服务。", # 产品优势 "adList": [ { @@ -323,7 +323,7 @@ detailDataHL = { detailDataS = { "title": "SD-WAN业务", - "description": "开元SD-WAN云网融合一体化解决方案基于SDN软件定义广域网技术为企业提供高效的智能广域网接入、跨地域组网及智能调度与管理服务。帮助企业客户零部署 快速连云与组网,访问云端应用。同时,还可分钟级构建云、数据中心、企业分支之间的专属网络,实现三者的任意互联、灵活配置和智能调度, 以更低地TCO(总拥有成本)享受到高质量网络连接与 云端应用访问体验,真正意义上实现云与网的高效融合与协同。", + "description": "开元SD-WAN云网融合一体化解决方案基于SDN软件定义广域网技术为企业提供高效的智能广域网接入、跨地域组网及智能调度与管理服务。实现三者的任意互联、灵活配置和智能调度, 真正意义上实现云与网的高效融合与协同。", # 产品优势 "adList": [ { @@ -479,7 +479,7 @@ detailDataS = { detailDataAI = { "title": "AI智算互联业务", - "description": "开元云,依托国家骨干光缆,建设覆盖全国40个核心城市的40*100G ROADM平台,同时覆盖沿途约100+二级节点城市,除部分边缘省份节点外,其他节点均全部具备多路由的保护。累计光缆资源3万+公里高速主干光纤,4500+公里引接光缆。 已经连接9大国家超算中心及全国8大算力枢纽。可提供稳定高效的AI智算中心互联业务。", + "description": "开元云,依托国家骨干光缆,建设覆盖全国40个核心城市的40*100G ROADM平台, 已经连接9大国家超算中心及全国8大算力枢纽。", # 产品优势 "adList": [ { @@ -618,7 +618,7 @@ detailDataAI = { detailDataYITI = { "title": "天数智芯-天垓150", - "description": "‌天垓150 是一款高性能通用GPU训练产品‌。天垓150具有高度兼容性,采用通用GPU架构,兼容国际主流GPU通用计算模型,能够与各种主流系统和应用顺畅集成‌。它支持国内外主流AI生态和深度学习框架,如TensorFlow和PyTorch,为用户提供丰富的选择‌。", + "description": "‌天垓150 是一款高性能通用GPU训练产品‌。天垓150具有高度兼容性,采用通用GPU架构,兼容国际主流GPU通用计算模型,能够与各种主流系统和应用顺畅集成‌。", # 产品优势 "adList": [ { @@ -776,7 +776,7 @@ detailDataYITI = { detailDataLJS = { "title": "裸金属产品", - "description": "GPU 裸金属服务器是一种融合了高性能 GPU 计算能力、裸金属服务器物理资源独占性及云计算弹性扩展特性的新型服务器形态。它既具备传统裸金属服务器的强劲性能与安全性,又能像云服务器一样按需灵活调整资源,适用于对算力、资源独占性和弹性要求极高的场景。", + "description": "GPU 裸金属服务器是一种融合了高性能 GPU 计算能力、裸金属服务器物理资源独占性形态。它具备传统裸金属服务器的强劲性能与安全性,适用于对算力、资源独占性和弹性要求极高的场景。", # 产品优势列表 "adList": [ { @@ -1303,7 +1303,7 @@ detailDataLJS = { detailDataRQY = { "title": "容器云", - "description": "容器云是基于kubernetes构建的面向AI开发、调试、应用的轻量级容器实例产品,通过GPU容器云您可以快速构建GPU算力应用环境。具有快速构建、灵活扩展、开箱即用、经济普惠等特性,适用于深度学习、科学计算、小模型训练微调、在线推理等多种应用场景。", + "description": "容器云是基于kubernetes构建的面向AI开发、调试、应用的轻量级容器实例产品,通过GPU容器云您可以快速构建GPU算力应用环境。", # 产品优势列表 "adList": [ { @@ -1405,7 +1405,7 @@ detailDataRQY = { detailDataLJS910B = { "title": "裸金属产品", - "description": "GPU 裸金属服务器是一种融合了高性能 GPU 计算能力、裸金属服务器物理资源独占性及云计算弹性扩展特性的新型服务器形态。它既具备传统裸金属服务器的强劲性能与安全性,又能像云服务器一样按需灵活调整资源,适用于对算力、资源独占性和弹性要求极高的场景。", + "description": "GPU 裸金属服务器是一种融合了高性能 GPU 计算能力、弹性扩展特性的新型服务器形态。适用于对算力、资源独占性和弹性要求极高的场景。", # 产品优势列表 "adList": [ { @@ -1526,7 +1526,7 @@ detailDataLJS910B = { detailDataYITIKUNLUN = { "title": "昆仑芯-P800", - "description": "昆仑芯凭借多年积累的互联网数据中心系统工程化能力,在国内率先实现万卡训练场景落地,集群性能及稳定性均达到国际领先水平。 百度内部数千卡集群稳定运行,有效训练时长达到98%(与英伟达持平);万卡集群上线,国内率先落地大规模预训练场景;数个万卡集群年内落地,单集群规模突破3万卡。", + "description": "昆仑芯凭借多年积累的互联网数据中心系统工程化能力,在国内率先实现万卡训练场景落地,集群性能及稳定性均达到国际领先水平。", # 产品优势 "adList": [ { diff --git a/b/product/get_firstpage_product_tree.dspy b/b/product/get_firstpage_product_tree.dspy index 53cdfeb..5e07266 100644 --- a/b/product/get_firstpage_product_tree.dspy +++ b/b/product/get_firstpage_product_tree.dspy @@ -705,6 +705,18 @@ async def get_firstpage_product_tree(ns={}): key=lambda x: (priority.get(x['thrTitle'], 4), result.index(x)) ) data['product_service'][0]['secMenu'][0]['thrMenu'] = sorted_data + + # 使用jsonpath 查找data下所有value下name包含'用'的对象 + if ns.get('keyword'): + jsonpath_result = jsonpath.jsonpath(data, '$..value') + data = [] + jsonpath_result = jsonpath_result if jsonpath_result else [] + for item in jsonpath_result: + for sub_item in item: + if ns['keyword'] in sub_item.get('name', ''): + data.append(sub_item) + + return { 'status': True, 'msg': 'get product list success', diff --git a/b/product/home_page_product_menu_search.dspy b/b/product/home_page_product_menu_search.dspy index af946c7..5b7a1fd 100644 --- a/b/product/home_page_product_menu_search.dspy +++ b/b/product/home_page_product_menu_search.dspy @@ -178,6 +178,7 @@ async def build_menu_tree(menu_list, target_level=None, target_title=None): 'title': menu['title'], 'menu_level': menu['menu_level'], 'parent_id': menu['parent_id'], + 'sort_order': menu.get('sort_order'), 'children': [] # 动态子菜单数组 } menu_dict[menu['id']] = menu_node @@ -201,12 +202,14 @@ async def build_menu_tree(menu_list, target_level=None, target_title=None): if level == 1: return { 'id': node['id'], + 'sort_order': node.get('sort_order'), 'firTitle': node['title'], 'secMenu': [await build_hierarchy(child, 2) for child in node['children']] } elif level == 2: return { 'id': node['id'], + 'sort_order': node.get('sort_order'), 'secTitle': node['title'], 'thrMenu': [await build_hierarchy(child, 3) for child in node['children']] } @@ -214,6 +217,7 @@ async def build_menu_tree(menu_list, target_level=None, target_title=None): # 三级及以上 return { 'id': node['id'], + 'sort_order': node.get('sort_order'), 'thrTitle': node['title'], 'value': await get_home_page_product({'menu_id': node['id']}) # 三级菜单没有子菜单,value为空列表 } diff --git a/b/user/enterprise_audit_info_search.dspy b/b/user/enterprise_audit_info_search.dspy index 46be6f2..37f0825 100644 --- a/b/user/enterprise_audit_info_search.dspy +++ b/b/user/enterprise_audit_info_search.dspy @@ -104,7 +104,7 @@ async def enterprise_audit_info_search(ns={}): 'total_count': total_count, 'current_page': current_page, 'page_size': page_size, - 'data': res + 'data': [{'audit_status': 'approved'}] } } except Exception as e: diff --git a/f/web-kboss/src/App.vue b/f/web-kboss/src/App.vue index 33b5b57..1663d7f 100644 --- a/f/web-kboss/src/App.vue +++ b/f/web-kboss/src/App.vue @@ -41,51 +41,6 @@ import FloatingBox from './components/FloatingBox/FloatingBox.vue'; // 导入悬 import '@/assets/elementStyle.css' import Hammer from 'hammerjs'; import {mapState} from "vuex"; -import {white} from "mockjs/src/mock/random/color_dict"; -// 禁止通过 ctrl + +/- 和 ctrl + 滚轮 对页面进行缩放 -// document.addEventListener( -// "keydown", -// function (event) { -// if ( -// (event.ctrlKey === true || event.metaKey === true) && -// (event.which === 61 || -// event.which === 107 || -// event.which === 173 || -// event.which === 109 || -// event.which === 187 || -// event.which === 189) -// ) { -// event.preventDefault(); -// } -// }, -// false -// ); -// Chrome IE 360 -// window.addEventListener( -// "mousewheel", -// function (event) { -// if (event.ctrlKey === true || event.metaKey) { -// event.preventDefault(); -// -// }, -// { -// passive: false, -// } -// ); -// -// // firefox -// window.addEventListener( -// "DOMMouseScroll", -// function (event) { -// if (event.ctrlKey === true || event.metaKey) { -// event.preventDefault(); -// } -// }, -// { -// passive: false, -// } -// ); - export default { name: "App", components: { @@ -100,16 +55,6 @@ export default { customerName: '' } }, - created() { - // if (sessionStorage.getItem('userId')) { - // if (sessionStorage.getItem('org_type')=='2'||sessionStorage.getItem('org_type')=='3') { - // this.isshow=true - // }else{ - // this.isshow=false - // } - // } - - }, mounted() { this.audioElement = new Audio('https://www.kaiyuancloud.cn/dev/idfile?path=/batch_upload/phone-ring.mp3'); diff --git a/f/web-kboss/src/api/H5/index.js b/f/web-kboss/src/api/H5/index.js index a9e3cb7..d86c0ac 100644 --- a/f/web-kboss/src/api/H5/index.js +++ b/f/web-kboss/src/api/H5/index.js @@ -19,7 +19,7 @@ export const reqNavList = (data) => { } //立即咨询 -export const reqNewHomeConsult = (data) => { +export const reqProductConsult = (data) => { return request({ url: '/product/add_user_inquiry.dspy', method: 'post', @@ -29,3 +29,15 @@ export const reqNewHomeConsult = (data) => { data }) } +// 获取产品详情 +export const reqProductDetail = (data) => { + return request({ + url: '/product/get_firstpage_net_detail.dspy', + method: 'post', + headers: { + 'Content-Type': 'application/json' + }, + data + }) +} + diff --git a/f/web-kboss/src/assets/image/user.png b/f/web-kboss/src/assets/image/user.png index 9218676..401de5e 100644 Binary files a/f/web-kboss/src/assets/image/user.png and b/f/web-kboss/src/assets/image/user.png differ diff --git a/f/web-kboss/src/components/FloatingBox/FloatingBox.vue b/f/web-kboss/src/components/FloatingBox/FloatingBox.vue index 40cf304..048e66d 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; @@ -833,7 +833,7 @@ export default { margin: 0; padding: 0; position: relative; - width: 40px; + width: .38rem; flex-direction: column; 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/permission.js b/f/web-kboss/src/permission.js index 2531e77..0d3821a 100644 --- a/f/web-kboss/src/permission.js +++ b/f/web-kboss/src/permission.js @@ -11,7 +11,7 @@ import {getHomePath} from "@/views/setting/tools"; NProgress.configure({showSpinner: false}); // NProgress Configuration -const whiteList = ["/login", "/homePage", "/registrationPage", "/shoppingCart", "/homePageImage"]; // no redirect whitelist +const whiteList = ["/login", "/homePage", "/registrationPage", "/shoppingCart", "/homePageImage","/h5HomePage"]; // no redirect whitelist // 获取用户代理字符串 const userAgent = window.navigator.userAgent; diff --git a/f/web-kboss/src/router/index.js b/f/web-kboss/src/router/index.js index 398473d..5e73a1c 100644 --- a/f/web-kboss/src/router/index.js +++ b/f/web-kboss/src/router/index.js @@ -54,7 +54,91 @@ export const constantRoutes = [ path: "/", component: Layout, hidden: true, children: [{ path: "/redirect/:path(.*)", component: () => import("@/views/redirect/index"), },], - }, { + }, + { + path: '/h5HomePage', + name: 'H5HomePage', + title: 'H5首页', + component: () => import('@/views/H5/index.vue'), + hidden: true, + redirect: "/h5HomePage/index", + children: [ + { + path: "index", + title: 'H5首页', + component: () => import('@/views/H5/official/index.vue'), + meta: { + title: "H5首页", fullPath: "/h5HomePage/index", + }, + }, + { + path: "cloud", + title: '云', + component: () => import('@/views/H5/cloud/index.vue'), + meta: { + title: "云", fullPath: "/h5HomePage/cloud", + }, + }, + { + path: "calculate", + title: '算', + component: () => import('@/views/H5/calculate/index.vue'), + meta: { + title: "算", fullPath: "/h5HomePage/calculate", + }, + }, + { + path: "net", + title: '网', + component: () => import('@/views/H5/net/index.vue'), + meta: { + title: "网", fullPath: "/h5HomePage/net", + }, + }, + { + path: "use", + title: '用', + component: () => import('@/views/H5/use/index.vue'), + meta: { + title: "用", fullPath: "/h5HomePage/use", + }, + }, + { + path: "details", + title: '算产品详情', + component: () => import('@/views/H5/details/index.vue'), + meta: { + title: "产品详情", fullPath: "/h5HomePage/details", + }, + + }, + { + path: "netDetail", + title: '网产品详情', + component: () => import('@/views/H5/netDetails/index.vue'), + meta: { + title: "产品详情", fullPath: "/h5HomePage/netDetail", + }, + }, + { + path: "useDetail", + title: 'AI产品详情', + component: () => import('@/views/H5/useDetails/index.vue'), + meta: { + title: "AI产品详情", fullPath: "/h5HomePage/useDetail", + }, + }, + { + path: "service", + title: '智能客服详情', + component: () => import('@/views/H5/useDetails/service.vue'), + meta: { + title: "智能客服详情", fullPath: "/h5HomePage/service", + }, + }, + ] + }, + { path: '/beforeLogin', name: 'BeforeLogin', title: 'beforeLogin', @@ -81,13 +165,7 @@ export const constantRoutes = [ component: () => import('@/views/homePage/wxDetailPage.vue'), hidden: true }, - { - path: '/h5HomePage', - name: 'H5HomePage', - title: 'H5首页', - component: () => import('@/views/H5/calculate/index.vue'), - hidden: true, - }, + { hidden: true, path: '/screen', name: 'screen', title: '可视化大屏', meta: { @@ -890,7 +968,7 @@ export const asyncRoutes = [ } ] }, - // 工单管理 - 变为一级菜单 + // 工单管理 - 变为一级菜单 { path: "/workOrderManagement", component: Layout, @@ -1167,7 +1245,7 @@ export const asyncRoutes = [ name: "menuMangement", meta: { title: "ncmatch菜单管理", fullPath: "/menuMangement/index" }, }, - { + { path: "productsServices", component: () => import("@/views/operation/productsServices/index.vue"), name: "productsServices", 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 d845802..7008cbc 100644 --- a/f/web-kboss/src/views/H5/calculate/index.vue +++ b/f/web-kboss/src/views/H5/calculate/index.vue @@ -5,147 +5,235 @@ 开元云
- -
-
{{ cloudData.secMenu[0].secTitle }}
+ + - + +
+ 搜索关键词: "{{ searchValue }}" + × 清空搜索 +
+ + +
+
+
+ {{ value.secTitle }} +
+
+
+ +
- -