剩余模块:生产入库,销售出库

This commit is contained in:
2025-05-20 14:40:44 +08:00
parent 14a5fa371b
commit 933ddab8f3
68 changed files with 8868 additions and 13081 deletions

View File

@@ -1,15 +1,16 @@
import callCheckVersion, { UniUpgradeCenterResult } from "./call-check-version"
import { platform_iOS } from './utils'
// #ifdef UNI-APP-X
import { openSchema } from '@/uni_modules/uts-openSchema'
// #endif
// 推荐再App.vue中使用
const PACKAGE_INFO_KEY = '__package_info__'
// #ifdef APP-HARMONY
export default function (component?: any) : Promise<UniUpgradeCenterResult> {
// uni-app 项目无法从 vue 中导出 ComponentPublicInstance 类型,故使用条件编译
// #ifdef UNI-APP-X
export default function (component : ComponentPublicInstance | null = null) : Promise<UniUpgradeCenterResult> {
// #endif
// #ifndef APP-HARMONY
// #ifndef UNI-APP-X
export default function () : Promise<UniUpgradeCenterResult> {
// #endif
return new Promise<UniUpgradeCenterResult>((resolve, reject) => {
@@ -18,13 +19,12 @@ export default function () : Promise<UniUpgradeCenterResult> {
const code = uniUpgradeCenterResult.code
const message = uniUpgradeCenterResult.message
const url = uniUpgradeCenterResult.url // 安装包下载地址
// 此处逻辑仅为示例,可自行编写
if (code > 0) {
// 腾讯云获取下载链接
if (/^cloud:\/\//.test(url)) {
const tcbRes = await uniCloud.getTempFileURL({ fileList: [url] });
if (typeof tcbRes.fileList[0].tempFileURL !== 'undefined') uniUpgradeCenterResult.url = tcbRes.fileList[0].tempFileURL;
}
// 腾讯云和阿里云下载链接不同,需要处理一下,阿里云会原样返回
const tcbRes = await uniCloud.getTempFileURL({ fileList: [url] });
if (typeof tcbRes.fileList[0].tempFileURL !== 'undefined') uniUpgradeCenterResult.url = tcbRes.fileList[0].tempFileURL;
/**
* 提示升级一
@@ -55,7 +55,6 @@ export default function () : Promise<UniUpgradeCenterResult> {
* 官方适配的升级弹窗可自行替换资源适配UI风格
*/
// #ifndef UNI-APP-X
// #ifdef APP-PLUS
uni.setStorageSync(PACKAGE_INFO_KEY, uniUpgradeCenterResult)
uni.navigateTo({
url: `/uni_modules/uni-upgrade-center-app/pages/upgrade-popup?local_storage_key=${PACKAGE_INFO_KEY}`,
@@ -65,27 +64,8 @@ export default function () : Promise<UniUpgradeCenterResult> {
}
})
// #endif
// #ifdef APP-HARMONY
if (component) {
component.show(true, uniUpgradeCenterResult)
} else {
reject({
code: -1,
message: '在 HarmonyOS Next 平台请传递组件使用'
})
}
// #endif
// #endif
// #ifdef UNI-APP-X
uni.setStorageSync(PACKAGE_INFO_KEY, uniUpgradeCenterResult)
uni.openDialogPage({
url: `/uni_modules/uni-upgrade-center-app/pages/uni-app-x/upgrade-popup?local_storage_key=${PACKAGE_INFO_KEY}`,
disableEscBack: true,
fail: (err) => {
console.error('更新弹框跳转失败', err)
uni.removeStorageSync(PACKAGE_INFO_KEY)
}
})
component?.$callMethod('show', true, uniUpgradeCenterResult)
// #endif
return resolve(uniUpgradeCenterResult)
@@ -115,7 +95,7 @@ function updateUseModal(packageInfo : UniUpgradeCenterResult) : void {
} = packageInfo;
let isWGT = type === 'wgt'
let isiOS = !isWGT ? platform.includes(platform_iOS) : false;
let isiOS = !isWGT ? platform.includes('iOS') : false;
// #ifndef UNI-APP-X
let confirmText = isiOS ? '立即跳转更新' : '立即下载更新'
@@ -164,19 +144,7 @@ function updateUseModal(packageInfo : UniUpgradeCenterResult) : void {
}, () => {
if (is_mandatory) {
//更新完重启app
// #ifdef APP-PLUS
plus.runtime.restart();
// #endif
// #ifdef APP-HARMONY
uni.showModal({
title: '安装成功',
content: '请手动重启应用',
showCancel: false,
success: res => {
plus.runtime.quit();
}
});
// #endif
return;
}
uni.showModal({
@@ -184,12 +152,7 @@ function updateUseModal(packageInfo : UniUpgradeCenterResult) : void {
success: res => {
if (res.confirm) {
//更新完重启app
// #ifdef APP-PLUS
plus.runtime.restart();
// #endif
// #ifdef APP-HARMONY
plus.runtime.quit();
// #endif
}
}
});
@@ -214,7 +177,7 @@ function updateUseModal(packageInfo : UniUpgradeCenterResult) : void {
fail: err => {
uni.showModal({
title: '更新失败',
content: err.errMsg,
content: err.message,
showCancel: false
});
}