修复bug,优化加载提示
This commit is contained in:
parent
118a3a985b
commit
af0d12bcbd
@ -15,8 +15,9 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<zbpSwiper :isSelectPlace="true" :location_Arr="locationArr" @kkchange='kkchange'></zbpSwiper>
|
<zbpSwiper :isSelectPlace="true" :location_Arr="locationArr" @kkchange='kkchange'></zbpSwiper>
|
||||||
<u-empty :show="jurisdiction" marginTop="260" mode="permission" :text="emptyText"
|
<u-empty :show="jurisdiction" marginTop="80" mode="permission" :text="emptyText"
|
||||||
icon="http://cdn.uviewui.com/uview/empty/permission.png"></u-empty>
|
icon="http://cdn.uviewui.com/uview/empty/permission.png"></u-empty>
|
||||||
|
<block v-if="!jurisdiction">
|
||||||
<view class="business com special_work">
|
<view class="business com special_work">
|
||||||
<view class="title project">
|
<view class="title project">
|
||||||
<view>更多功能</view>
|
<view>更多功能</view>
|
||||||
@ -52,6 +53,7 @@
|
|||||||
</u-transition>
|
</u-transition>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
<view class="" v-if='jurisdiction==false&&isShow==false'>
|
<view class="" v-if='jurisdiction==false&&isShow==false'>
|
||||||
<emptyPage title="暂无信息"></emptyPage>
|
<emptyPage title="暂无信息"></emptyPage>
|
||||||
|
@ -23,25 +23,47 @@ function compareVersions(version1, version2) {
|
|||||||
// 加载小程序
|
// 加载小程序
|
||||||
const loadMP = async (id) => {
|
const loadMP = async (id) => {
|
||||||
appid = id;
|
appid = id;
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中',
|
|
||||||
mask: true
|
|
||||||
})
|
|
||||||
let info = await getGXconfig();
|
let info = await getGXconfig();
|
||||||
console.log('最新版本', info.data);
|
console.log('最新版本', info.data);
|
||||||
console.log(mp, uni);
|
console.log(mp, uni);
|
||||||
// return ;
|
// return ;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '下载中...'
|
||||||
|
})
|
||||||
mp.getUniMPVersion(id, (ret) => {
|
mp.getUniMPVersion(id, (ret) => {
|
||||||
console.log('当前版本', ret);
|
console.log('当前版本', ret);
|
||||||
if (0!=ret.code||compareVersions(info.data.version, ret.versionInfo.name) == 1||true) {
|
if (0 != ret.code || compareVersions(info.data.version, ret.versionInfo.name) == 1 || true) {
|
||||||
uni.downloadFile({
|
let downloadTask = uni.downloadFile({
|
||||||
url: info.data.version_info?.dow_url,
|
url: info.data.version_info?.dow_url,
|
||||||
success(res) {
|
success(res) {
|
||||||
wgtFile = res.tempFilePath;
|
wgtFile = res.tempFilePath;
|
||||||
console.log('下载完成', wgtFile);
|
console.log('下载完成', wgtFile);
|
||||||
installMP();
|
installMP();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
let count = 0;
|
||||||
|
let timer = null;
|
||||||
|
timer = setInterval(()=>{
|
||||||
|
uni.showLoading({
|
||||||
|
title: `下载中... ${count}%`,
|
||||||
|
mask: true
|
||||||
})
|
})
|
||||||
|
}, 600)
|
||||||
|
downloadTask.onProgressUpdate((res) => {
|
||||||
|
console.log('下载进度' + res.progress);
|
||||||
|
if (res.progress > count + 10) count += 10;
|
||||||
|
if (count >= 90) {
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = null;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '安装中...'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 满足测试条件,取消下载任务。
|
||||||
|
// if (res.progress > 50) {
|
||||||
|
// downloadTask.abort();
|
||||||
|
// }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
open()
|
open()
|
||||||
}
|
}
|
||||||
@ -80,6 +102,7 @@ const doInstallMP = () => {
|
|||||||
appid: appid,
|
appid: appid,
|
||||||
wgtFile: wgtFile
|
wgtFile: wgtFile
|
||||||
}, (r) => {
|
}, (r) => {
|
||||||
|
uni.hideLoading();
|
||||||
if (0 == r.code) {
|
if (0 == r.code) {
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: '安装成功'
|
// title: '安装成功'
|
||||||
@ -87,7 +110,6 @@ const doInstallMP = () => {
|
|||||||
console.log('小程序安装成功');
|
console.log('小程序安装成功');
|
||||||
open();
|
open();
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading();
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '安装失败',
|
title: '安装失败',
|
||||||
content: JSON.stringify(r),
|
content: JSON.stringify(r),
|
||||||
@ -99,13 +121,18 @@ const doInstallMP = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const open = (id = null) => {
|
const open = (id = null) => {
|
||||||
|
let token = uni.getStorageSync('LOGIN_STATUS_TOKEN');
|
||||||
|
if (!token) return uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '请先登录'
|
||||||
|
})
|
||||||
mp.openUniMP({
|
mp.openUniMP({
|
||||||
appid: id || appid,
|
appid: id || appid,
|
||||||
extraData: {
|
extraData: {
|
||||||
uniMP: true
|
uniMP: true,
|
||||||
|
token: token,
|
||||||
}
|
}
|
||||||
}, (ret) => {
|
}, (ret) => {
|
||||||
uni.hideLoading();
|
|
||||||
if (0 != ret.code) {
|
if (0 != ret.code) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '启动失败',
|
title: '启动失败',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user