Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
xingyy | 695f33d77b | 2 days ago |
xingyy | c955087e49 | 2 days ago |
@ -1,89 +1,40 @@
|
|||||||
<script>
|
<script>
|
||||||
import silenceUpdate from '@/uni_modules/rt-uni-update/js_sdk/silence-update.js' //引入静默更新
|
export default {
|
||||||
import config from './config';
|
methods:{
|
||||||
export default {
|
networkStatusChange(res){
|
||||||
methods: {
|
if(res.isConnected){
|
||||||
networkStatusChange(res) {
|
uni.redirectTo({
|
||||||
if (res.isConnected) {
|
url:'/pages/index/index'
|
||||||
uni.redirectTo({
|
})
|
||||||
url: "/pages/index/index",
|
}else{
|
||||||
});
|
uni.redirectTo({
|
||||||
} else {
|
url:'/pages/networko/index'
|
||||||
uni.redirectTo({
|
})
|
||||||
url: "/pages/networko/index",
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取本地应用资源版本号
|
onLaunch: function() {
|
||||||
getLocalVersion() {
|
},
|
||||||
return new Promise((resolve, reject) => {
|
onShow: function() {
|
||||||
plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
|
uni.getNetworkType({
|
||||||
resolve(widgetInfo);
|
success:(res)=> {
|
||||||
});
|
if(res.networkType==='none') {
|
||||||
});
|
uni.redirectTo({
|
||||||
},
|
url: '/pages/networko/index'
|
||||||
// 获取服务端应用资源版本号
|
})
|
||||||
getServerVersion(widgetInfo) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
uni.request({
|
|
||||||
url: config.apiBaseUrl + "/version-info",
|
|
||||||
method:'POST',
|
|
||||||
data:{
|
|
||||||
edition_type:widgetInfo.appid,
|
|
||||||
version_type:uni.getSystemInfoSync().platform,
|
|
||||||
edition_number:Number(widgetInfo.versionCode)
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
console.log("res4", res.data.data);
|
|
||||||
resolve(res.data.data);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 检测更新
|
|
||||||
checkUpdate() {
|
|
||||||
// 检测更新
|
|
||||||
this.getLocalVersion().then((widgetInfo) => {
|
|
||||||
console.log("本地信息", widgetInfo);
|
|
||||||
console.log("config", config);
|
|
||||||
this.getServerVersion(widgetInfo).then((serverVersionData) => {
|
|
||||||
if (Number(widgetInfo.versionCode) !== serverVersionData.edition_number) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url:
|
|
||||||
"/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update?obj=" +
|
|
||||||
JSON.stringify(serverVersionData),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
})
|
||||||
},
|
uni.onNetworkStatusChange(this.networkStatusChange);
|
||||||
},
|
},
|
||||||
onLaunch: function () {},
|
onHide: function() {
|
||||||
onShow: function () {
|
uni.offNetworkStatusChange(this.networkStatusChange)
|
||||||
console.log("App 1onShow");
|
}
|
||||||
this.checkUpdate();
|
}
|
||||||
// silenceUpdate('555')
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: "./uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update",
|
|
||||||
// });
|
|
||||||
uni.getNetworkType({
|
|
||||||
success: (res) => {
|
|
||||||
if (res.networkType === "none") {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: "/pages/networko/index",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
|
||||||
},
|
|
||||||
onHide: function () {
|
|
||||||
uni.offNetworkStatusChange(this.networkStatusChange);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
</style>
|
</style>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{}
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.6 KiB |
Loading…
Reference in New Issue