update APP更新和 热更新

This commit is contained in:
qijq 2025-05-08 16:02:00 +08:00
parent 8cb3bbd58a
commit d996e742a7
9 changed files with 2247 additions and 125 deletions

View File

@ -28,16 +28,6 @@ export default {
onAPPUpdate() { onAPPUpdate() {
APPUpdate(this.version); APPUpdate(this.version);
}, },
async getAPPversion() {
let params = {
marketId: 100,
packageName: "com.xiaofa.shopAdmin",
currVersionKey: 1,
};
let res = await GetAPPversion(params);
console.log(res);
},
}, },
}; };
</script> </script>

View File

@ -1,5 +1,5 @@
import http from '../utils/http' import http from '../utils/http';
import config from '../config/config' import config from '../config/config';
/** /**
* 登录/注册同一个接口 * 登录/注册同一个接口
@ -10,17 +10,18 @@ import config from '../config/config'
* @see https://mall.gpxscs.cn/mobile/account/login/doMerchSmsRegisterAndLogin * @see https://mall.gpxscs.cn/mobile/account/login/doMerchSmsRegisterAndLogin
*/ */
export function GetLogin (params){ export function GetLogin(params) {
params.isFilter = true return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
http({ http({
url:'/account/login/doMerchSmsRegisterAndLogin', url: '/account/login/doMerchSmsRegisterAndLogin',
method:'post', method: 'post',
data:params, data: params,
}).then(res=>{ })
resolve(res) .then((res) => {
}).catch(e => reject(console.warn(e))) resolve(res);
}) })
.catch((e) => reject(console.warn(e)));
});
} }
/** /**
@ -31,17 +32,19 @@ export function GetLogin (params){
* @see https://mall.gpxscs.cn/mobile/account/login/sendVerifyCode * @see https://mall.gpxscs.cn/mobile/account/login/sendVerifyCode
*/ */
export function GetSmsCode(params){ export function GetSmsCode(params) {
params.isFilter = true params.isFilter = true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http({ http({
url:'/account/login/sendVerifyCode', url: '/account/login/sendVerifyCode',
method:'post', method: 'post',
data:params, data: params,
}).then(res=>{ })
resolve(res) .then((res) => {
}).catch(e => reject(console.warn(e))) resolve(res);
}) })
.catch((e) => reject(console.warn(e)));
});
} }
/** /**
@ -52,20 +55,21 @@ export function GetSmsCode(params){
* @see https://mall.gpxscs.cn/api/admin/account/account-user-base/doLogin * @see https://mall.gpxscs.cn/api/admin/account/account-user-base/doLogin
*/ */
export function GetAccountLogin(params){ export function GetAccountLogin(params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http({ http({
url:'/account/account-user-base/doLogin', url: '/account/account-user-base/doLogin',
method:'post', method: 'post',
params, params,
baseURL:config.adminApi baseURL: config.adminApi,
}).then(res=>{ })
resolve(res) .then((res) => {
}).catch(e => reject(console.warn(e))) resolve(res);
}) })
.catch((e) => reject(console.warn(e)));
});
} }
/** /**
* 获取图形验证码 * 获取图形验证码
* @author Seven * @author Seven
@ -74,15 +78,15 @@ export function GetAccountLogin(params){
* @see https://mall.gpxscs.cn/api/admin/shop/shop-base-config/image * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-config/image
*/ */
export function GetVerifyCode(params){ export function GetVerifyCode(params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http({ http({
url:'/shop/shop-base-config/image', url: '/shop/shop-base-config/image',
method:'GET', method: 'GET',
params, params,
baseURL:config.adminApi baseURL: config.adminApi,
}).then(res=>{ }).then((res) => {
resolve(res) resolve(res);
}) });
}) });
} }

View File

@ -8,7 +8,7 @@ const $mainColor = componentConfig.appUpdateColor
// 弹窗图标url // 弹窗图标url
const $iconUrl = componentConfig.appUpdateIcon const $iconUrl = componentConfig.appUpdateIcon
? componentConfig.appUpdateIcon ? componentConfig.appUpdateIcon
: '../static/ic_ar.png'; : '@/static/ic_ar.png';
// 获取当前应用的版本号 // 获取当前应用的版本号
export const getCurrentNo = function (callback) { export const getCurrentNo = function (callback) {
@ -23,6 +23,7 @@ export const getCurrentNo = function (callback) {
}; };
// 从服务器下载应用资源包wgt文件 // 从服务器下载应用资源包wgt文件
const getDownload = function (data) { const getDownload = function (data) {
console.log(data.downloadUrl);
let dtask; let dtask;
if (data.updateType == 'forcibly' || data.updateType == 'solicit') { if (data.updateType == 'forcibly' || data.updateType == 'solicit') {
let popupData = { let popupData = {
@ -865,32 +866,28 @@ function downloadPopup(data) {
export default function (isPrompt = false) { export default function (isPrompt = false) {
getCurrentNo((versionInfo) => { getCurrentNo((versionInfo) => {
componentConfig.getServerNo(versionInfo, isPrompt, (res) => { componentConfig.getServerNo(versionInfo, isPrompt, (res) => {
if (res.updateType == 'forcibly' || res.updateType == 'silent') { if (res) {
if (/\.wgt$/i.test(res.download_wgt_url)) { res.versionInfo = res.description;
getDownload(res);
} else if (/\.html$/i.test(res.downloadUrl)) { if (res.version_name > versionInfo.versionName) {
plus.runtime.openURL(res.downloadUrl); res.versionName = res.version_name;
res.downloadUrl = res.download_apk_url;
} else { } else {
if (platform == 'android') { if (res.version_key > versionInfo.versionCode) {
getDownload(res); res.versionName = res.version_key;
} else { res.downloadUrl = res.download_wgt_url;
plus.runtime.openURL(res.downloadUrl);
} }
} }
} else if (res.updateType == 'solicit') { }
updatePopup(res, function () {
if (/\.wgt$/i.test(res.downloadUrl)) { if (res) {
if (res.updateType == 'forcibly' || res.updateType == 'silent') {
getDownload(res);
} else if (res.updateType == 'solicit') {
updatePopup(res, function () {
getDownload(res); getDownload(res);
} else if (/\.html$/i.test(res.downloadUrl)) { });
plus.runtime.openURL(res.downloadUrl); }
} else {
if (platform == 'android') {
getDownload(res);
} else {
plus.runtime.openURL(res.downloadUrl);
}
}
});
} }
}); });
}); });

View File

@ -84,8 +84,8 @@ export default {
if (res && res.status == 200) { if (res && res.status == 200) {
if (res.data) { if (res.data) {
res.data.updateType = 'solicit'; res.data.updateType = 'solicit';
if (res.data.is_force_update) { if (res.data.is_force_update == 1) {
res.updateType = 'forcibly'; res.data.updateType = 'forcibly';
callback && callback(res.data); callback && callback(res.data);
} else { } else {
callback && callback(res.data); callback && callback(res.data);
@ -130,5 +130,5 @@ export default {
// 弹窗主颜色(不填默认粉色) // 弹窗主颜色(不填默认粉色)
appUpdateColor: 'f00', appUpdateColor: 'f00',
// 弹窗图标(不填显示默认图标,链接配置示例如: '/static/demo/ic_attention.png' // 弹窗图标(不填显示默认图标,链接配置示例如: '/static/demo/ic_attention.png'
appUpdateIcon: '', appUpdateIcon: '/static/ic_ar.png',
}; };

View File

@ -3,7 +3,7 @@
"appid" : "__UNI__95F809F", "appid" : "__UNI__95F809F",
"package" : "com.xiaofa.shopAdmin", "package" : "com.xiaofa.shopAdmin",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.1",
"versionCode" : 100, "versionCode" : 100,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */

View File

@ -85,7 +85,7 @@
<u-input <u-input
v-if="loginType == 0" v-if="loginType == 0"
class="input-block" class="input-block"
v-model.number="accountCode" v-model="accountCode"
:color="'#555555'" :color="'#555555'"
:border="'false'" :border="'false'"
:clearable="true" :clearable="true"
@ -359,7 +359,7 @@ export default {
} }
}, 1000); }, 1000);
await this.GetSmsCode(params); await this.getSmsCode(params);
}, },
async getVerifyCode() { async getVerifyCode() {
this.verify_token = new Date().getTime(); this.verify_token = new Date().getTime();

View File

@ -121,6 +121,7 @@ export default {
}, },
onHide() {}, onHide() {},
methods: { methods: {
...mapActions("user", ["GetLogin", "GetSmsCode", "GetAccountLogin"]),
// //
async handleRegister() { async handleRegister() {
if (!this.account) { if (!this.account) {

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__95F809F","name":"小发同城商家版","version":{"name":"1.0.0","code":100},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Maps":{"coordType":"gcj02"},"Camera":{},"Record":{},"VideoPlayer":{},"UIWebview":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#FFFFFF"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{"privacyDescription":{"NSPhotoLibraryAddUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSPhotoLibraryUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSCameraUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSMicrophoneUsageDescription":"此APP会在使用声音识别服务中使用您的麦克风权限","NSLocationWhenInUseUsageDescription":"此App会在使用导航服务中使用您的定位权限","NSLocationAlwaysUsageDescription":"此App会在使用导航服务中使用您的定位权限","NSLocationAlwaysAndWhenInUseUsageDescription":"此App会在使用导航服务中使用您的定位权限"},"dSYMs":false},"plugins":{"maps":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#ffffff","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"4.29","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#000","selectedColor":"#4b71ff","borderStyle":"rgba(0,0,0,0.4)","backgroundColor":"#ffffff","iconfontSrc":"/static/font/iconfont.ttf","fontSize":"14px","height":"58px","spacing":"5px","list":[{"pagePath":"pages/order/order","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"20px"},"text":"工作台"},{"pagePath":"pages/IM/IM","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"22px"},"text":"消息"},{"pagePath":"pages/viewCenter/viewCenter","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"20px"},"text":"视图中心"},{"pagePath":"pages/my/my","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"24px"},"text":"我的"}]},"launch_path":"__uniappview.html"},"screenOrientation":["portrait-primary","portrait-secondary"]} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__95F809F","name":"小发同城商家版","version":{"name":"1.0.1","code":100},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Maps":{"coordType":"gcj02"},"Camera":{},"Record":{},"VideoPlayer":{},"UIWebview":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#FFFFFF"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{"privacyDescription":{"NSPhotoLibraryAddUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSPhotoLibraryUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSCameraUsageDescription":"此App会在上传头像图片服务中访问您的相机权限","NSMicrophoneUsageDescription":"此APP会在使用声音识别服务中使用您的麦克风权限","NSLocationWhenInUseUsageDescription":"此App会在使用导航服务中使用您的定位权限","NSLocationAlwaysUsageDescription":"此App会在使用导航服务中使用您的定位权限","NSLocationAlwaysAndWhenInUseUsageDescription":"此App会在使用导航服务中使用您的定位权限"},"dSYMs":false},"plugins":{"maps":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#ffffff","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"4.29","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#000","selectedColor":"#4b71ff","borderStyle":"rgba(0,0,0,0.4)","backgroundColor":"#ffffff","iconfontSrc":"/static/font/iconfont.ttf","fontSize":"14px","height":"58px","spacing":"5px","list":[{"pagePath":"pages/order/order","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"20px"},"text":"工作台"},{"pagePath":"pages/IM/IM","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"22px"},"text":"消息"},{"pagePath":"pages/viewCenter/viewCenter","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"20px"},"text":"视图中心"},{"pagePath":"pages/my/my","iconfont":{"text":"","selectedText":"","selectedColor":"#4b71ff","color":"#000","fontSize":"24px"},"text":"我的"}]},"launch_path":"__uniappview.html"},"screenOrientation":["portrait-primary","portrait-secondary"]}