diff --git a/odf-uniapp/.hbuilderx/launch.json b/odf-uniapp/.hbuilderx/launch.json index 8ae452a..4724a85 100644 --- a/odf-uniapp/.hbuilderx/launch.json +++ b/odf-uniapp/.hbuilderx/launch.json @@ -2,6 +2,7 @@ "version" : "1.0", "configurations" : [ { + "customPlaygroundType" : "local", "playground" : "standard", "type" : "uni-app:app-android" } diff --git a/odf-uniapp/pages/portal/index.vue b/odf-uniapp/pages/portal/index.vue index cb30a7e..11c2652 100644 --- a/odf-uniapp/pages/portal/index.vue +++ b/odf-uniapp/pages/portal/index.vue @@ -37,6 +37,9 @@ 暂无可用功能模块 + + + @@ -45,8 +48,14 @@ import { ref, computed } from 'vue' import { onLoad } from '@dcloudio/uni-app' import store from '@/store' import { getUserModules } from '@/services/permission' +import { checkAppVersion } from '@/services/home' +import { APP_VERSION } from '@/services/api' +import updateDialog from '@/components/update-dialog.vue' const statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0 +const showUpdate = ref(false) +const updateUrl = ref('') +const forceUpdate = ref(false) // 所有可用功能版块定义 const allModules = [ @@ -77,7 +86,18 @@ function goSettings() { onLoad(() => { // 页面加载时刷新权限 handleRefresh() + // 检查版本更新 + loadVersionCheck() }) + +async function loadVersionCheck() { + const res = await checkAppVersion(APP_VERSION) + if (res.code === 200 && res.data && res.data.needUpdate) { + updateUrl.value = res.data.downloadUrl || '' + forceUpdate.value = !!res.data.forceUpdate + showUpdate.value = true + } +}