From 4c8f2050e885fd170039fe29dba88510ca22ca52 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Thu, 6 Mar 2025 22:00:21 +0800 Subject: [PATCH] =?UTF-8?q?2024.03.05~2024.03.06=20=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/App.vue | 216 ++++++++++++----------- jiuyi2/api/mine.js | 1 + jiuyi2/common/js/config.js | 6 +- jiuyi2/common/js/util.js | 27 ++- jiuyi2/components/index/appVerUpdate.vue | 60 ++++--- jiuyi2/components/index/leftMenu.vue | 212 +++++++++++----------- jiuyi2/manifest.json | 4 +- jiuyi2/pages.json | 13 +- jiuyi2/pages/index/index.nvue | 8 +- jiuyi2/pages/index/trade.vue | 2 +- jiuyi2/pages/index/wallet/bill.vue | 26 ++- jiuyi2/pages/index/wallet/wallet.vue | 32 ++-- jiuyi2/pages/mine/homepage.vue | 14 +- jiuyi2/pages/mine/setting/about.vue | 92 ++++++++++ jiuyi2/pages/mine/setting/setting.vue | 2 +- jiuyi2/store/index.js | 11 +- jiuyi2/vite.config.js | 4 +- 17 files changed, 451 insertions(+), 279 deletions(-) create mode 100644 jiuyi2/pages/mine/setting/about.vue diff --git a/jiuyi2/App.vue b/jiuyi2/App.vue index c7cfd3bc..2bf94f11 100644 --- a/jiuyi2/App.vue +++ b/jiuyi2/App.vue @@ -1,124 +1,126 @@ \ No newline at end of file diff --git a/jiuyi2/api/mine.js b/jiuyi2/api/mine.js index e0b9c5af..3282bb13 100644 --- a/jiuyi2/api/mine.js +++ b/jiuyi2/api/mine.js @@ -123,6 +123,7 @@ const mine = { url: '/coreplay/app/durian/getUserDataByAccount', query: param.query, method: 'GET', + load: true, }) }, diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index ea5d4755..2f0ce731 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,9 +6,11 @@ const config = { // host: 'h5api', // #endif // #ifndef H5 - // host: 'http://91f.xyz:8080', - host: 'http://3f609e6a.r24.cpolar.top', + host: 'http://91f.xyz:8080', + // host: 'http://3dd3096c.r24.cpolar.top', // #endif + // 是否vivo显示 + showVivo: true, // 支付方式配置 payType: { score: { diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 17db9ca8..2a3fd18c 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -213,7 +213,7 @@ const util = { responseType: params.responseType || 'text', // 请求成功返回 success: res => { - // console.log('request success', url, res, params.data ? params.data : '') + console.log('request success', url, res, params.data ? params.data : '') // 关闭加载效果 if (params.load) { uni.hideLoading() @@ -623,7 +623,8 @@ const util = { obj.success && obj.success({ value: result, width: imageInfo.width, - height: imageInfo.height, + height: imageInfo + .height, }); }, }) @@ -1606,6 +1607,28 @@ const util = { }) }) }, + + /** + * 获取app最新版本信息 + * @param {Object} option + */ + getAppVersion(callback) { + // 获取最新版本信息 + api.getAppVersion().then(rs => { + if (rs.code == 200) { + const result = rs.data + console.log('getAppVersion result', result) + // 同步修改云端数据 + uni.$store.commit('setState', { + key: 'versionCloud', + value: result + }) + + if (callback) callback(result) + return + } + }) + }, } export default util \ No newline at end of file diff --git a/jiuyi2/components/index/appVerUpdate.vue b/jiuyi2/components/index/appVerUpdate.vue index 83e43dcb..08507594 100644 --- a/jiuyi2/components/index/appVerUpdate.vue +++ b/jiuyi2/components/index/appVerUpdate.vue @@ -10,6 +10,7 @@ getCurrentInstance, computed, nextTick, + onMounted, } from 'vue' // 工具库 import util from '@/common/js/util'; @@ -19,28 +20,25 @@ const { proxy } = getCurrentInstance() - // 云端版本信息 - const versionCloud = reactive({}) // 程序版本信息 const versionkApp = reactive({}) + // 云端app版本信息 + const versionCloud = computed(() => uni.$store.state.versionCloud) + + onMounted(() => { + let system = uni.getSystemInfoSync() + Object.assign(versionkApp, system) + }) // 初始化 function init() { - // 获取最新版本信息 - api.getAppVersion().then(rs => { - if (rs.code == 200) { - console.log('getAppVersion', rs) - // 结果 - const result = rs.data - let system = uni.getSystemInfoSync() - Object.assign(versionCloud, result) - Object.assign(versionkApp, system) - console.log('if', system.appVersionCode, result.versionCode) - // 如果需要更新 则打开手机浏览器 - if (system.appVersionCode < result.versionCode || true) open() - return - } - }) + console.log('versionCloud', versionCloud.value) + return + Object.assign(versionkApp, system) + // status 1更新 0未开启 + if (result.status != 1) return + // 手机版本号 < 设定版本号 + if (system.appVersionCode < result.versionCode) open() } // 打开弹窗 @@ -56,13 +54,19 @@ // 更新弹窗点击确认 function handleConfirm() { // 下载地址 - // let downloadUrl = 'https://www.doubao.com/chat/' - let downloadUrl = versionCloud.downloadUrl + let downloadUrl = versionCloud.value.downloadUrl plus.runtime.openURL(downloadUrl, function(res) { console.log('打开浏览器结果:', res); }, function(err) { console.log('打开浏览器失败:', err); - }); + }) + } + + // 取消 + function handleCancel() { + // 判断是否强制更新 + if (versionCloud.value.isforce == 1) plus.runtime.quit() + else close() } defineExpose({ @@ -73,10 +77,10 @@