2022-06-08 15:48:09 +08:00
|
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
import App from './App'
|
2025-01-04 17:20:45 +08:00
|
|
|
|
import { _chooseImage } from "@/common/permissionTips.js";
|
2023-12-15 14:18:44 +08:00
|
|
|
|
// import VueResource from "vue-resource";
|
2023-12-15 09:27:23 +08:00
|
|
|
|
// main.js
|
|
|
|
|
|
import uView from "uview-ui";
|
2025-06-27 17:22:44 +08:00
|
|
|
|
import dayjs from "dayjs";
|
2025-07-09 15:08:55 +08:00
|
|
|
|
import duration from 'dayjs/plugin/duration';
|
2025-06-27 17:22:44 +08:00
|
|
|
|
|
2025-07-09 15:08:55 +08:00
|
|
|
|
// 扩展Day.js以使用duration插件
|
|
|
|
|
|
dayjs.extend(duration);
|
2025-06-27 17:22:44 +08:00
|
|
|
|
|
2023-12-15 09:27:23 +08:00
|
|
|
|
Vue.use(uView);
|
2023-12-15 11:34:44 +08:00
|
|
|
|
// H5控制台**********
|
2023-12-15 14:18:44 +08:00
|
|
|
|
// let consoleScript = document.createElement("script");
|
|
|
|
|
|
// consoleScript.src = "https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js";
|
|
|
|
|
|
// consoleScript.onload = function () {
|
|
|
|
|
|
// new VConsole()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// document.head.appendChild(consoleScript);
|
|
|
|
|
|
// // H5控制台**********
|
|
|
|
|
|
// // import VConsole from 'vconsole'//h5控制台
|
|
|
|
|
|
// // const vConsole = new VConsole()//h5控制台
|
|
|
|
|
|
// // Vue.use(vConsole)//h5控制台
|
2022-08-02 15:11:04 +08:00
|
|
|
|
Vue.config.productionTip = false
|
2023-12-15 14:18:44 +08:00
|
|
|
|
// Vue.use(VueResource)
|
2022-06-08 15:48:09 +08:00
|
|
|
|
App.mpType = 'app'
|
2024-04-15 17:23:33 +08:00
|
|
|
|
// import UniIcons from './uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
|
|
|
|
|
// Vue.use('UniIcons')
|
|
|
|
|
|
// 由于引入的icons的命名会跟项目文件里的冲突,所以随便往命名加了个2,区分开来
|
|
|
|
|
|
import uniIcons2 from './uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
|
|
|
|
|
Vue.component('uni-icons2', uniIcons2)
|
2022-06-08 15:48:09 +08:00
|
|
|
|
//全局变量
|
|
|
|
|
|
// Vue.prototype.mobileTopHeight = uni.getMenuButtonBoundingClientRect()?uni.getMenuButtonBoundingClientRect().top:0;
|
2023-03-20 18:43:57 +08:00
|
|
|
|
// Vue.prototype.url_config = ''
|
2022-08-02 15:11:04 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "longguang"
|
2023-03-20 18:43:57 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "nanchang"
|
2023-06-19 09:02:35 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "sanjiang" //(部署三江h5需要打开/pages/projectManage/projectManage,页面onload内容)
|
2023-05-04 15:33:11 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "zjwj"
|
2023-12-15 09:27:23 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "sccr"
|
2025-06-27 17:22:44 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "agjt" // 鞍钢集团环境
|
2024-06-28 18:15:14 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "cpgs" // 成平高速环境
|
2025-06-27 17:22:44 +08:00
|
|
|
|
Vue.prototype.COMPANY = "xjw" // 新金湾环境
|
2024-06-27 18:51:28 +08:00
|
|
|
|
// Vue.prototype.COMPANY = "" // 标准版
|
2022-06-08 15:48:09 +08:00
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// 开发环境
|
|
|
|
|
|
console.log('开发环境')
|
2025-01-20 17:52:30 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://121.37.106.37:9809/' // 121测试环境
|
2024-11-26 14:25:20 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://jxj.zhgdyun.com:30250/'// 演示平台H5
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://jxj.zhgdyun.com:33983' // 演示平台工作流地址
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://47.93.215.234:9809/' // 鞍钢正式地址(弃用)
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://42.180.188.17:9809/' // 鞍钢正式地址
|
2024-06-21 18:53:01 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://42.180.188.17:11211/' // 鞍钢测试地址
|
2024-05-30 09:13:50 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.237:51234/' //雄哥内网穿透地址
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://jxj.zhgdyun.com:61212/' //杰哥内网穿透地址
|
2024-08-22 18:33:10 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:28890/' //郭圣雄本地
|
2024-06-27 18:51:28 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:28888/' //郭圣雄本地
|
2025-06-27 17:22:44 +08:00
|
|
|
|
Vue.prototype.url_config = 'http://192.168.34.221:8111/' //郭圣雄本地
|
2024-06-06 09:47:49 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.237:51234/' //郭圣雄本地
|
2025-05-13 15:53:29 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.155:19111/' //彭洁本地
|
2025-01-20 17:52:30 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://183.249.224.118:9000/'// 嘉兴项目
|
2025-06-27 17:22:44 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.155:28890/' //彭洁本地
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://192.168.34.216:5173' // jiayu工作流地址
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://47.93.215.234:19997' // 工作流线上地址(弃用)
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://42.180.188.17:19997' // 工作流线上地址
|
2024-06-13 11:13:39 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://42.180.188.17:19097' // 工作流测试地址
|
2024-09-06 14:42:23 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://192.168.34.175:5173' // 工作流地址
|
2024-06-21 18:53:01 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://192.168.34.138:5173' // 工作流地址
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://139.9.66.234:5173' // 工作流地址
|
2024-05-25 19:55:24 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://192.168.34.126:5173' // 工作流地址
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://8.142.139.165:7080/' // 湖里
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://139.9.66.234:5173/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.125:6023/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.237:7000/' //广西联通
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.67.160:8088/'//中建四局
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.148:6023' //广西联通/本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://223.82.100.80:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://120.236.247.200:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://zhgd.loganwy.com/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://183.60.227.61:30249/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://183.60.227.61:30249/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.178.44:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = "http://58.34.63.88:9090/"
|
|
|
|
|
|
// Vue.prototype.url_config = "http://183.95.84.34:7185/"
|
|
|
|
|
|
// Vue.prototype.url_config = "http://218.92.215.138:9090/" //新佳城小区 123456
|
|
|
|
|
|
// Vue.prototype.url_config = "http://36.137.53.203:9090/" //南昌地铁 gdjt 123456
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.178.44:8/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.87.250/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.178.44:8012' // 河南
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:100/' //演示平台
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.116:6023/'//邱平毅本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:18170'//瑞士恒通
|
|
|
|
|
|
// Vue.prototype.url_config = 'https://jxjzhgd.yyvtl.com:8443/'//三江
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:30002'//郭圣熊本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:8188'//中建四局本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:12350'//中建五局
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://42.194.144.62:8088'//新中建四局地址
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:11111/'//郭圣雄三江本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:15551'//成润线上
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://118.121.198.147:23232'//成润正式
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://huli.zjzhiliao.com/jxjgdapi'//金林湾测试
|
2024-06-11 21:44:26 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://8.136.222.164:8808/'//中科安信
|
2024-12-04 18:37:56 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:11111/'// 百色三标段
|
2025-07-09 15:08:55 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://jxj.zhgdyun.com:9500/'// 测试环境h5
|
2022-06-08 15:48:09 +08:00
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 生产环境
|
|
|
|
|
|
console.log('生产环境')
|
2025-06-27 17:22:44 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://121.37.106.37:9840/'
|
2025-05-16 10:09:07 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://jxjzw.zhgdyun.com:100/' // 演示平台
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://jxj.zhgdyun.com:33983'// 工作流地址 演示平台
|
2025-03-04 09:16:26 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://117.146.73.156:9809/'// 中新建项目
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://117.146.73.156:19997'// 工作流地址 通用
|
2024-12-04 18:37:56 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://121.37.106.37:9809/' // 测试环境
|
2025-05-16 10:09:07 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:11111/'
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://101.43.164.214:11131'// 工作流地址 通用
|
2025-01-04 17:20:45 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://117.146.73.156:9809/' // 中新建地址(外网)
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://117.146.73.156:19997' // 中新建工作流地址(外网)
|
2024-11-26 14:25:20 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://121.37.106.37:19999/'// 新能源智慧基建管理平台
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://121.37.106.37:19997'// 新能源智慧基建管理平台工作流地址
|
2024-10-28 10:32:34 +08:00
|
|
|
|
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:11111/'// 百色通用
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://101.43.164.214:11131'// 工作流地址 通用
|
2025-07-01 18:11:06 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:11112/'// 新金湾
|
2025-06-27 17:22:44 +08:00
|
|
|
|
Vue.prototype.work_url = 'http://101.43.164.214:11137'// 新金湾地址 通用
|
2024-10-09 15:02:59 +08:00
|
|
|
|
|
2025-07-01 18:11:06 +08:00
|
|
|
|
Vue.prototype.url_config = 'http://jxj.zhgdyun.com:9500/'// 测试环境h5
|
2025-06-27 18:36:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-09-06 14:18:27 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://222.80.185.228:6090/' // 木垒县新能源工程线上地址
|
2024-04-24 17:53:36 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://10.168.1.105:11111/' // 线上地址
|
2024-04-25 22:33:57 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://10.168.1.104:11111/' // 线上地址
|
2024-05-04 16:20:39 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://47.93.215.234:9809/' // 鞍钢线上地址(弃用)
|
2024-11-28 15:17:12 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://42.180.188.17:9809/' // 鞍钢线上地址
|
2024-07-26 10:41:21 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://42.180.188.17:11211/' // 鞍钢线上测试地址
|
2024-04-21 09:44:03 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.237:51234/' // 百色三标段
|
2024-04-22 17:36:17 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:9111/' // 百色三标段
|
2024-05-04 16:20:39 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://47.93.215.234:19997' // 工作流线上地址(弃用)
|
2024-11-28 15:17:12 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://42.180.188.17:19997' // 工作流线上地址
|
2024-07-26 10:41:21 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://42.180.188.17:19097' // 工作流测试地址
|
2024-04-22 17:36:17 +08:00
|
|
|
|
// Vue.prototype.work_url = 'http://192.168.34.139:5173' // 工作流地址
|
2024-04-21 09:44:03 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:100/' //演示平台
|
|
|
|
|
|
// Vue.prototype.url_config ='http://124.71.178.44:8012/' // 河南
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://8.142.139.165:7080/' //湖里
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://139.9.66.234:8/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.125:6023/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.237:7000/' //广西联通
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.67.160:8088/' //中建四局
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.148:6023' //广西联通/本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://223.82.100.80:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://120.236.247.200:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = "http://58.34.63.88:9090/"
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.178.44:9000/'
|
|
|
|
|
|
// Vue.prototype.url_config = "http://183.95.84.34:7185/"
|
|
|
|
|
|
// Vue.prototype.url_config = "http://36.137.53.203:9090/"
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.125:6023/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://183.60.227.61:30249/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://zhgd.loganwy.com/'
|
|
|
|
|
|
// Vue.prototype.url_config = "http://36.137.53.203:9090/"
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://124.71.87.250/'
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.116:6023/'//邱平毅本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:18170/'//瑞士恒通
|
|
|
|
|
|
// Vue.prototype.url_config = 'https://jxjzhgd.yyvtl.com:8443/'//三江
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:8188/'//中建四局本地
|
|
|
|
|
|
// Vue.prototype.url_config= 'http://101.43.164.214:12350/'//中建五局
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://42.194.144.62:8088/'//新中建四局地址
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:11111/'//郭圣雄三江本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://182.90.224.147:15551/'//成润线上
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://118.121.198.147:23232/'//成润正式
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://192.168.34.221:30002/'//郭圣雄本地
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:45022/'//盘锦
|
|
|
|
|
|
// Vue.prototype.url_config = 'http://183.249.224.118:9000/'// 嘉兴项目
|
2024-10-09 15:02:59 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://jxj.zhgdyun.com:30250/'// 演示平台H5
|
|
|
|
|
|
// Vue.prototype.work_url = 'http://jxj.zhgdyun.com:33983' // 演示平台工作流地址
|
2024-06-28 18:15:14 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://101.43.164.214:11111/'// 百色三标段
|
2024-06-26 14:09:58 +08:00
|
|
|
|
// Vue.prototype.url_config = 'http://8.136.222.164:8808/'//中科安信
|
2022-06-08 15:48:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-06 11:14:16 +08:00
|
|
|
|
Vue.prototype.$formatDates = formatDates;
|
2025-01-04 17:20:45 +08:00
|
|
|
|
Vue.prototype.$chooseImage = _chooseImage;
|
2023-02-06 11:14:16 +08:00
|
|
|
|
//时间戳转换方法 date:时间戳数字
|
|
|
|
|
|
function formatDates(date, fmt = 'yyyy-MM-dd HH:mm:ss') {
|
|
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
if (!date) {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (date.length == 10) {
|
|
|
|
|
|
date = date * 1000;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof date === 'string') {
|
|
|
|
|
|
date = date.replace('T', ' ').replace('Z', '');
|
|
|
|
|
|
date = new Date(date.replace(/-/g, '/'))
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof date === 'number') {
|
|
|
|
|
|
date = new Date(date)
|
|
|
|
|
|
}
|
|
|
|
|
|
var o = {
|
|
|
|
|
|
'M+': date.getMonth() + 1,
|
|
|
|
|
|
'd+': date.getDate(),
|
|
|
|
|
|
'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
|
|
|
|
|
|
'H+': date.getHours(),
|
|
|
|
|
|
'm+': date.getMinutes(),
|
|
|
|
|
|
's+': date.getSeconds(),
|
|
|
|
|
|
'q+': Math.floor((date.getMonth() + 3) / 3),
|
|
|
|
|
|
'S': date.getMilliseconds()
|
|
|
|
|
|
}
|
|
|
|
|
|
var week = {
|
|
|
|
|
|
'0': '\u65e5',
|
|
|
|
|
|
'1': '\u4e00',
|
|
|
|
|
|
'2': '\u4e8c',
|
|
|
|
|
|
'3': '\u4e09',
|
|
|
|
|
|
'4': '\u56db',
|
|
|
|
|
|
'5': '\u4e94',
|
|
|
|
|
|
'6': '\u516d'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (/(y+)/.test(fmt)) {
|
|
|
|
|
|
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
|
|
|
|
|
}
|
|
|
|
|
|
if (/(E+)/.test(fmt)) {
|
|
|
|
|
|
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') :
|
|
|
|
|
|
'') +
|
|
|
|
|
|
week[date.getDay() + ''])
|
|
|
|
|
|
}
|
|
|
|
|
|
for (var k in o) {
|
|
|
|
|
|
if (new RegExp('(' + k + ')').test(fmt)) {
|
|
|
|
|
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return fmt
|
2023-02-06 11:14:16 +08:00
|
|
|
|
}
|
2025-06-27 17:22:44 +08:00
|
|
|
|
Vue.prototype.$dayjs = dayjs;
|
2022-06-08 15:48:09 +08:00
|
|
|
|
Vue.prototype.sendRequest = function(param) {
|
2024-05-21 01:19:28 +08:00
|
|
|
|
var _self = this,
|
|
|
|
|
|
url = param.url,
|
|
|
|
|
|
method = param.method,
|
|
|
|
|
|
header = param.header || {
|
|
|
|
|
|
'content-type': "application/json"
|
|
|
|
|
|
},
|
2023-08-29 10:55:31 +08:00
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
data = param.data || {},
|
|
|
|
|
|
token = "",
|
|
|
|
|
|
isalert = param.isalert || false,
|
|
|
|
|
|
hideLoading = param.hideLoading || false;
|
2024-04-21 09:44:03 +08:00
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
//拼接完整请求地址
|
|
|
|
|
|
var requestUrl = Vue.prototype.url_config + url + '?lang=' + uni.getStorageSync('language');
|
|
|
|
|
|
if (uni.getStorageSync('userInfo') && url != 'xmgl/base/login' && url !=
|
|
|
|
|
|
'xmgl/wirelessEducationQuestionSubject/getDeviceRandomEducationQuestion' && url !=
|
|
|
|
|
|
'xmgl/wirelessEducationQuestionAnswer/add' && url !=
|
|
|
|
|
|
'xmgl/safeEducationQuestionAnswer/getAnswerWorkerInfo' && url != 'xmgl/safeEducationQuestionAnswer/add' &&
|
|
|
|
|
|
url != 'xmgl/safeEducationQuestion/selectSafeEducationQuestionInfo') {
|
|
|
|
|
|
if (JSON.parse(uni.getStorageSync('userInfo')).token) {
|
|
|
|
|
|
token = "Bearer " + JSON.parse(uni.getStorageSync('userInfo')).token;
|
|
|
|
|
|
header["Authorization"] = token
|
|
|
|
|
|
console.log("网络请求 token :" + token);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-08-02 15:11:04 +08:00
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
// var timestamp = Date.parse(new Date());//时间戳
|
|
|
|
|
|
// data["timestamp"] = timestamp;
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
|
// data["device"] = "wxapp";
|
|
|
|
|
|
// data["ver"] = "1.1.30";
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef APP-PLUS || H5
|
|
|
|
|
|
// data["device"] = "iosapp";
|
|
|
|
|
|
// data["ver"] = "1.0.0";
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
if (method) {
|
|
|
|
|
|
method = method.toUpperCase(); //小写改为大写
|
|
|
|
|
|
}
|
|
|
|
|
|
//加密sessionStorage.getItem("loginData")
|
|
|
|
|
|
// if (uni.getStorageSync("loginData") && data != {}) {
|
|
|
|
|
|
// console.log(url+"参数");
|
|
|
|
|
|
// console.log(data);
|
|
|
|
|
|
// data = encryptByDES(data);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//用户交互:加载圈
|
|
|
|
|
|
if (!hideLoading) {
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '加载中...'
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
// console.log(requestUrl, "网络请求start");
|
|
|
|
|
|
// console.log(data, "网络请求data====================");
|
|
|
|
|
|
//网络请求
|
|
|
|
|
|
uni.request({
|
|
|
|
|
|
url: requestUrl,
|
|
|
|
|
|
method: method,
|
|
|
|
|
|
header: header,
|
|
|
|
|
|
data: data,
|
|
|
|
|
|
success: res => {
|
|
|
|
|
|
// console.log("网络请求success:" + JSON.stringify(res.data));
|
2024-04-21 09:44:03 +08:00
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
if (res.data.code && res.data.code != 200) {
|
|
|
|
|
|
if (res.data.code == 401 || res.data.code == 403) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '登录过期,请重新登录',
|
|
|
|
|
|
icon: "none"
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|
uni.removeStorageSync('userInfo')
|
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
|
url: '/pages/login/login.vue'
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|
if (!isalert) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: res.data.message,
|
|
|
|
|
|
icon: "none"
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 200)
|
|
|
|
|
|
}
|
2022-08-02 15:11:04 +08:00
|
|
|
|
|
2024-05-21 01:19:28 +08:00
|
|
|
|
typeof param.error == "function" && param.error(Data);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
let Data = res.data;
|
|
|
|
|
|
// if (res.data.data && res.data.data.requestData) {
|
|
|
|
|
|
// let data = decryptByDES(
|
|
|
|
|
|
// res.data.data.requestData,
|
|
|
|
|
|
// res.data.data.encrypted
|
|
|
|
|
|
// );
|
|
|
|
|
|
// Data.data = JSON.parse(data);
|
|
|
|
|
|
// console.log(url + "解密后的数据");
|
|
|
|
|
|
// console.log(Data);
|
|
|
|
|
|
// }
|
|
|
|
|
|
typeof param.success == "function" && param.success(Data);
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (e) => {
|
|
|
|
|
|
console.log("网络请求fail:" + JSON.stringify(e));
|
|
|
|
|
|
console.log(requestUrl, "requestUrl");
|
|
|
|
|
|
// uni.showModal({
|
|
|
|
|
|
// content: "" + e.errMsg
|
|
|
|
|
|
// });
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '服务器开小差了呢,请您稍后再试',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
typeof param.fail == "function" && param.fail(e.data);
|
|
|
|
|
|
},
|
|
|
|
|
|
complete: () => {
|
|
|
|
|
|
if (!hideLoading) {
|
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
|
}
|
|
|
|
|
|
typeof param.complete == "function" && param.complete();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2022-06-08 15:48:09 +08:00
|
|
|
|
}
|
2024-05-28 20:01:14 +08:00
|
|
|
|
// 判断按钮权限的函数
|
|
|
|
|
|
Vue.prototype.checkBtnPermission = function(permission) {
|
2024-05-24 19:01:30 +08:00
|
|
|
|
var permissions = JSON.parse(uni.getStorageSync("userInfo")).menuAuthority.menuList;
|
|
|
|
|
|
// var permissions = store.state.userInfo.menuAuthority.menuList;
|
|
|
|
|
|
permissions = permissions.filter(
|
|
|
|
|
|
(x) => x.path == permission.menuPath
|
|
|
|
|
|
)[0];
|
2024-05-28 15:58:10 +08:00
|
|
|
|
console.log(permissions,'按钮权限')
|
|
|
|
|
|
if (!permissions || !permissions.actionList) {
|
2024-05-24 19:01:30 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
let index = permissions.actionList.findIndex(
|
|
|
|
|
|
(x) => x.actionCode == permission.key
|
|
|
|
|
|
)
|
|
|
|
|
|
return index != -1 ? true : false;
|
|
|
|
|
|
}
|
2024-05-28 20:01:14 +08:00
|
|
|
|
Vue.prototype.checkMenuPermission = function(permission) {
|
|
|
|
|
|
var permissions = JSON.parse(uni.getStorageSync("userInfo")).menuAuthority.menuList;
|
|
|
|
|
|
// var permissions = store.state.userInfo.menuAuthority.menuList;
|
|
|
|
|
|
permissions = permissions.filter(
|
|
|
|
|
|
(x) => x.path == permission.menuPath
|
|
|
|
|
|
)[0];
|
|
|
|
|
|
if (!permissions) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-27 17:22:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-06-08 15:48:09 +08:00
|
|
|
|
const app = new Vue({
|
2024-05-21 01:19:28 +08:00
|
|
|
|
...App
|
2022-06-08 15:48:09 +08:00
|
|
|
|
})
|
2024-04-17 22:11:05 +08:00
|
|
|
|
app.$mount()
|