| | |
| | | getToken, |
| | | getUserInfo |
| | | } from "./utils/auth"; |
| | | import getuiUtils from "./utils/getuiUtils"; |
| | | export default { |
| | | onLaunch: function() { |
| | | console.log('App Launch') |
| | |
| | | // }); |
| | | // } |
| | | // #endif |
| | | |
| | | // #ifdef APP-PLUS || APP |
| | | // 监听 App 启动时的推送参数(冷启动:App 关闭后点击通知启动) |
| | | const launchOpts = plus.runtime.launchArguments; |
| | | if (launchOpts && launchOpts.payload) { |
| | | this.handlePushJump(launchOpts.payload); // 处理跳转 |
| | | } |
| | | |
| | | // 监听通知点击事件(热启动:App 后台运行时点击通知) |
| | | plus.push.addEventListener("click", (msg) => { |
| | | let payload = {}; |
| | | console.log('payload: ', msg.payload); |
| | | // 兼容不同格式的 payload(本地推送 vs 远程推送) |
| | | if (typeof msg.payload === "string") { |
| | | payload = JSON.parse(msg.payload); // 远程推送可能是字符串,需解析 |
| | | } else { |
| | | payload = msg.payload; // 本地推送是对象 |
| | | } |
| | | this.handlePushJump(payload); // 处理跳转 |
| | | }); |
| | | // #endif |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | |
| | | }, |
| | | onHide: function() { |
| | | console.log('App Hide') |
| | | }, |
| | | methods: { |
| | | // 处理通知跳转逻辑 |
| | | handlePushJump(payload) { |
| | | console.log('payload-enter: ', payload); |
| | | if (!payload || !payload.pagePath) return; |
| | | |
| | | // 确保 App 处于前台 |
| | | // plus.runtime.foreground(); |
| | | |
| | | // 跳转到指定页面 |
| | | setTimeout(() => { |
| | | uni.navigateTo({ |
| | | url: `${payload.pagePath}?itemId=${payload.itemId}`, // 携带参数 |
| | | fail: (err) => { |
| | | // 若页面栈满(最多10层),使用 redirectTo 替换当前页面 |
| | | uni.redirectTo({ |
| | | url: `${payload.pagePath}?itemId=${payload.itemId}`, |
| | | }); |
| | | } |
| | | }); |
| | | }, 300) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", |
| | | "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", |
| | | "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>", |
| | | "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>" |
| | | "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", |
| | | "<uses-permission android:name=\"android.permission.INTERNET\"/>", |
| | | "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>", |
| | | "<uses-permission android:name=\"android.permission.GET_TASKS\"/>", |
| | | "<uses-permission android:name=\"android.permission.BLUETOOTH\"/>", |
| | | "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", |
| | | "<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_ADDED\"/>", |
| | | "<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_CHANGED\"/>", |
| | | "<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_INSTALL\"/>", |
| | | "<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_REPLACED\"/>", |
| | | "<uses-permission android:name=\"android.permission.RESTART_PACKAGES\"/>", |
| | | "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>" |
| | | ], |
| | | "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], |
| | | "minSdkVersion" : 23 |
| | | "minSdkVersion" : 23, |
| | | "excludePermissions" : [] |
| | | }, |
| | | /* ios打包配置 */ |
| | | "ios" : { |
| | |
| | | }, |
| | | /* SDK配置 */ |
| | | "sdkConfigs" : { |
| | | "ad" : {} |
| | | "ad" : {}, |
| | | "push" : { |
| | | "unipush" : { |
| | | "icons" : { |
| | | "small" : { |
| | | "ldpi" : "static/logo_icon.png", |
| | | "mdpi" : "static/logo_icon.png", |
| | | "hdpi" : "static/logo_icon.png", |
| | | "xhdpi" : "static/logo_icon.png", |
| | | "xxhdpi" : "static/logo_icon.png" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "icons" : { |
| | | "android" : { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | /* 快应用特有相关 */ |
| | | "quickapp" : {}, |
| | |
| | | "locale" : "zh-Hans", |
| | | "fallbackLocale" : "zh-Hans" |
| | | } |
| | | //docs.getui.com/getui/question/sdk/ --> |
| | | /* ios打包配置 *//* SDK配置 */ |
| | | |
| | |
| | | import { |
| | | CommonUtils |
| | | } from "../../utils/common"; |
| | | import { getLanguagePackJson } from "../../utils/i18n"; |
| | | import { |
| | | getLanguagePackJson |
| | | } from "../../utils/i18n"; |
| | | import WebSocketServices from "@/utils/WebSocketServices"; |
| | | import getuiUtils from "../../utils/getuiUtils"; |
| | | export default { |
| | | components: { |
| | | hFormAlert |
| | |
| | | "杭州凯贝奈特外网": 'http://erp.hzcabinet.cn:9090/API/', |
| | | "翁涛涛本地测试": 'http://localhost:81/API/', |
| | | "陈镐哲本地测试": 'http://192.168.0.121:81/API/', |
| | | "陈镐哲本地测试2": 'http://192.168.255.35:81/API/', |
| | | "陈镐哲本地测试2": 'http://192.168.0.102:81/API/', |
| | | "张瑞广本地测试": 'http://localhost:8082/API/', |
| | | "余思杰本地测试": 'http://localhost:8082/LuBaoAPI/', |
| | | // 小卫内外网 |
| | |
| | | // 锦隆 |
| | | "锦隆-智能家居": "http://192.168.1.11/API/", |
| | | "锦隆-智能家居-外网": "http://61.174.29.234:8880/API/", |
| | | // 华舟包装 |
| | | "宁波华舟包装1": "http://192.168.110.222:8082/API_NW/", |
| | | // 华舟包装 |
| | | "宁波华舟包装1": "http://192.168.110.222:8082/API_NW/", |
| | | "宁波华舟包装2": "http://192.168.88.167:8082/API_NW/", |
| | | "宁波华舟包装": "http://61.164.64.222:8082/API_WW/", |
| | | "宁波华舟包装": "http://61.164.64.222:8082/API_WW/", |
| | | }, |
| | | serverUrlName:uni.getStorageSync('serverUrlName') || '浙江智云迈思', |
| | | serverUrlName: uni.getStorageSync('serverUrlName') || '浙江智云迈思', |
| | | |
| | | arrayOrganization: [], |
| | | Organization: '', |
| | |
| | | let url = this.serverUrlandName[this.serverUrlName]; |
| | | if (url != undefined) { |
| | | uni.setStorageSync('serverUrl', url) |
| | | uni.setStorageSync('serverUrlName', this.serverUrlName) |
| | | uni.setStorageSync('serverUrlName', this.serverUrlName) |
| | | this.serverUrl = url |
| | | this.changeApi = false |
| | | this.getOrganization() |
| | |
| | | uni.setStorageSync('login', "login"); |
| | | uni.setStorageSync('Organization', this.Organization); |
| | | uni.setStorageSync('OrganizationID', this.HOrgName); |
| | | //存储部门 职员 仓库 等信息 |
| | | uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门 |
| | | uni.setStorageSync('HDeptName', res.data.data[0].HDeptName); |
| | | uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员 |
| | | uni.setStorageSync('HEmpName', res.data.data[0].HEmpName); |
| | | uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库 |
| | | uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName); |
| | | uni.setStorageSync('HWhID', res.data.data[0].HWhID);//对应仓库 |
| | | uni.setStorageSync('HWhName', res.data.data[0].HWhName); |
| | | uni.setStorageSync('HWorkCenterID', res.data.data[0].HWorkCenterID);//工作中心 |
| | | uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName); |
| | | uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收 |
| | | uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName); |
| | | //存储部门 职员 仓库 等信息 |
| | | uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门 |
| | | uni.setStorageSync('HDeptName', res.data.data[0].HDeptName); |
| | | uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员 |
| | | uni.setStorageSync('HEmpName', res.data.data[0].HEmpName); |
| | | uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库 |
| | | uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName); |
| | | uni.setStorageSync('HWhID', res.data.data[0].HWhID); //对应仓库 |
| | | uni.setStorageSync('HWhName', res.data.data[0].HWhName); |
| | | uni.setStorageSync('HWorkCenterID', res.data.data[0].HWorkCenterID); //工作中心 |
| | | uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName); |
| | | uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收 |
| | | uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName); |
| | | this.CommonUtils.setServerUrl(this.serverUrl) |
| | | // this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc); |
| | | // getuiUtils.getClientID() |
| | | var clientInfo = plus.push.getClientInfo(); |
| | | console.log('clientInfo: ', clientInfo); |
| | | uni.reLaunch({ |
| | | url: '/pages/index/index' |
| | | }) |
| | |
| | | this.wsUrl = CommonUtils.httpFormatWs(); // WebSocket 基础地址 |
| | | |
| | | // 超时校验配置 |
| | | this.businessMessageInterval = 5 * 60 * 1000; |
| | | this.businessMessageInterval = 5 * 60 * 1000; |
| | | this.noMessageTimeout = this.businessMessageInterval + 2 * 60 * 1000; |
| | | this.noMessageTimer = null; // 无消息超时定时器 |
| | | |
| | |
| | | this.resetNoMessageTimer(); |
| | | |
| | | // 处理业务消息 |
| | | if (message.Type === "Message") { |
| | | if (message.Type === "MessageUnRead") { // 未读消息 |
| | | let payload = { |
| | | pagePath: "/pages/ZLGL/OA_WorkLink/OA_WorkLinkBillList", |
| | | itemId: 0 |
| | | } |
| | | const content = JSON.parse(message.Content); |
| | | this.showTaskTip(`您有${content.length}条消息需要处理!`); |
| | | this.showTaskTip(`您有${content.length}条消息需要处理!`, payload); |
| | | // this.emit("message", content); // 支持外部监听 |
| | | } else if (message.Type === "Message") { |
| | | const content = JSON.parse(message.Content) |
| | | let payload = { |
| | | pagePath: "/pages/ZLGL/OA_WorkLink/OA_WorkLinkBillList", |
| | | itemId: 0 |
| | | } |
| | | this.showTaskTip(content[0]["内容"], payload, content[0]["主题"]); |
| | | |
| | | } |
| | | } catch (error) { |
| | | console.error("[WebSocket] 消息解析失败", error, res.data); |
| | |
| | | } |
| | | |
| | | |
| | | showTaskTip(Content) { |
| | | showTaskTip(Content, payloads, Title = "重要通知") { |
| | | // #ifdef APP-PLUS || APP |
| | | let content = Content; |
| | | let options = { |
| | | title: "重要通知", |
| | | title: Title, |
| | | cover: true, // 是否覆盖上一次的通知 |
| | | when: new Date() // 通知显示时间 |
| | | when: new Date(), // 通知显示时间 |
| | | icon: "../static/logo.png", |
| | | largeIcon: "../static/logo.png" |
| | | }; |
| | | // TODO 跳转到指定页 |
| | | let payload = JSON.stringify({}); |
| | | let payload = JSON.stringify(payloads); |
| | | console.log('payload: ', payload); |
| | | |
| | | plus.push.createMessage(content, payload, options); |
| | | // #endif |
| New file |
| | |
| | | class getuiInstance { |
| | | constructor() { |
| | | this.cid = "" |
| | | } |
| | | |
| | | getClientID() { |
| | | // #ifdef APP-PLUS |
| | | plus.push.getClientInfoAsync((info) => { |
| | | this.cid = info["clientid"] |
| | | console.log('cid: ', this.cid); |
| | | }); |
| | | // #endif |
| | | } |
| | | } |
| | | |
| | | export default new getuiInstance() |