diff --git a/App.vue b/App.vue index 98f50c4..05c6e1a 100644 --- a/App.vue +++ b/App.vue @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- // #ifdef APP-PLUS let jpushModule = uni.requireNativePlugin("JG-JPush"); + const mp = uni.requireNativePlugin('uniMP'); // #endif import { checkLogin @@ -74,7 +75,18 @@ }, onLaunch: function(option) { this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'; - this.globalData.uid = this.$store.state.app.uid + this.globalData.uid = this.$store.state.app.uid; + + //监听uni小程序发送的事件 + mp.onUniMPEventReceive(ret=>{ + console.log('小程序事件: ', ret); + if(ret.event=='closeApp'){ + mp.closeUniMP(ret.fromAppid, (ret)=>{ + console.log('closeUniMP: '+JSON.stringify(ret)); + }); + } + }); + let that = this; // #ifdef MP if (HTTP_REQUEST_URL == '') { @@ -188,7 +200,6 @@ - }, onShow() { let that = this diff --git a/config/app.js b/config/app.js index d731782..d98a31e 100644 --- a/config/app.js +++ b/config/app.js @@ -9,8 +9,8 @@ let httpApiThree // 网络接口修改此字符 小程序域名要求https // let httpApi = 'http://192.168.31.110:8324' // 测试 if (process.env.NODE_ENV === "development") { - httpApi = 'https://shop.lihaink.cn' // 生产 - // httpApi = "https://crmeb-test.shop.lihaink.cn" + // httpApi = 'https://shop.lihaink.cn' // 生产 + httpApi = "https://crmeb-test.shop.lihaink.cn" // httpApi = "http://192.168.0.222" // httpApi = "http://192.168.0.108:8325" // httpApi = 'http://192.168.0.108:8325' diff --git a/utils/uniMP.js b/utils/uniMP.js index 36c9fb9..3b09d3e 100644 --- a/utils/uniMP.js +++ b/utils/uniMP.js @@ -33,7 +33,7 @@ const loadMP = async (id) => { // return ; mp.getUniMPVersion(id, (ret) => { console.log('当前版本', ret); - if (0!=ret.code||compareVersions(info.data.version, ret.versionInfo.name) == 1) { + if (0!=ret.code||compareVersions(info.data.version, ret.versionInfo.name) == 1||true) { uni.downloadFile({ url: info.data.version_info?.dow_url, success(res) { @@ -100,7 +100,10 @@ const doInstallMP = () => { const open = (id = null) => { mp.openUniMP({ - appid: id || appid + appid: id || appid, + extraData: { + uniMP: true + } }, (ret) => { uni.hideLoading(); if (0 != ret.code) {