merchapp/java-mall-app-shop-admin/config/componentConfig.js
2025-07-28 01:55:47 +08:00

133 lines
4.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**** 此文件说明请看注释 *****/
// 可以用自己项目的请求方法
// 请求配置说明https://ext.dcloud.net.cn/plugin?id=822
import { GetAPPversion } from "../api/checkAPPupdate";
/**** 结束 *****/
const platform = uni.getSystemInfoSync().platform;
const phoneInfo = uni.getSystemInfoSync();
export default {
// 发起ajax请求获取服务端版本号
getServerNo: async (version, isPrompt = false, callback) => {
if (platform != "android") {
let appleId = 1549638327; //app的appleId
plus.runtime.launchApplication(
{
action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`,
},
function (e) {
console.log("Open system default browser failed: " + e.message);
}
);
return;
}
// let httpData = {
// version: version.versionCode,
// // 版本名称
// versionName: version.versionName,
// // setupPage参数说明判断用户是不是从设置页面点击的更新如果是设置页面点击的更新有不要用静默更新了不然用户点击没反应很奇怪的
// setupPage: isPrompt,
// };
// if (platform == 'android') {
// httpData.type = 1101;
// } else {
// httpData.type = 1102;
/* 接口入参说明
* version: 应用当前版本号(已自动获取)
* versionName: 应用当前版本名称(已自动获取)
* type平台1101是安卓1102是IOS
*/
/****************以下是示例*******************/
// 可以用自己项目的请求方法(接口自己找后台要,插件不提供)
let marketId = 100;
phoneInfo.brand = phoneInfo.brand.toLowerCase();
switch (phoneInfo.brand) {
case "xiaomi":
marketId = 1;
break;
case "huawei":
marketId = 2;
break;
case "tengxun":
marketId = 3;
break;
case "oppo":
marketId = 4;
break;
case "vivo":
marketId = 5;
break;
case "samsung":
marketId = 6;
break;
default:
marketId = 100;
break;
}
let params = {
marketId: 100,
packageName: "com.xiaofa.shopAdmin",
currVersionKey: version,
};
let res = await GetAPPversion(params);
if (res && res.status == 200) {
if (res.data) {
res.data.updateType = "solicit";
if (res.data.is_force_update == 1) {
res.data.updateType = "forcibly";
callback && callback(res.data);
} else {
callback && callback(res.data);
}
}
}
// .get('api/common/v1/app_version', httpData, {
// isPrompt: isPrompt,
// })
// .then((res) => {
// /* res的数据说明
// * | 参数名称 | 一定返回 | 类型 | 描述
// * | -------------|--------- | --------- | ------------- |
// * | versionCode | y | int | 版本号 |
// * | versionName | y | String | 版本名称 |
// * | versionInfo | y | String | 版本信息 |
// * | updateType | y | String | forcibly = 强制更新, solicit = 弹窗确认更新, silent = 静默更新 |
// * | downloadUrl | y | String | 版本下载链接IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接 |
// */
// if (res && res.downloadUrl) {
// // 兼容之前的版本updateType是新版才有的参数
// if (res.updateType) {
// callback && callback(res);
// } else {
// if (res.forceUpdate) {
// res.updateType = 'forcibly';
// } else {
// res.updateType = 'solicit';
// }
// callback && callback(res);
// }
// } else if (isPrompt) {
// uni.showToast({
// title: '暂无新版本',
// icon: 'none',
// });
// }
// });
/****************以上是示例*******************/
},
// 弹窗主颜色(不填默认粉色)
appUpdateColor: "f00",
// 弹窗图标(不填显示默认图标,链接配置示例如: '/static/demo/ic_attention.png'
appUpdateIcon: "/static/ic_ar.png",
};