You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
4.3 KiB
146 lines
4.3 KiB
import compareVersions from 'compare-versions'
|
|
|
|
if (ENV_DEV) {
|
|
window.auditStatus = {
|
|
auditid: 438893451,
|
|
errcode: 0,
|
|
errmsg: "ok",
|
|
reason: '你充的钱不够,请再充钱',
|
|
status: 1, // 0: 审核成功,1: 审核失败,2: 审核中,3: 已撤回
|
|
};
|
|
|
|
window.versions = {
|
|
version: "1.4.0", // 第三方平台模板库的最新版本
|
|
commit_version: "1.3.0", // 上传为体验版
|
|
audit_version: "", // 最新提交了审核的版本
|
|
audited_version: "1.2.0", // 审核通过的版本
|
|
release_version: "", // 线上的版本
|
|
};
|
|
|
|
window.categoriesList = [
|
|
{"first_class": "商家自营", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
{"first_class": "商家自营2", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
{"first_class": "商家自营3", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
{"first_class": "商家自营4", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
{"first_class": "商家自营5", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
{"first_class": "商家自营6", "second_class": "机械/电子器件", "first_id": 304, "second_id": 788},
|
|
];
|
|
}
|
|
|
|
const {auditStatus, versions, categoriesList} = window;
|
|
|
|
const {version, commit_version, audit_version, audited_version, release_version} = versions;
|
|
|
|
const versionsArray = [version, commit_version, audit_version, audited_version, release_version];
|
|
|
|
const stepInfoList = [
|
|
{
|
|
title: '上传',
|
|
buttonText: '上传小程序代码',
|
|
icon: 'cloud-upload',
|
|
url: 'commit',
|
|
description: '将代码上传到微信公众平台,使其成为体验版'
|
|
},
|
|
{
|
|
title: '审核',
|
|
buttonText: '提交审核',
|
|
icon: 'audit',
|
|
url: 'submit-audit',
|
|
action: 'submitAudit',
|
|
description: '微信小程序均需要审核后才能上线,一般情况下24小时内即可完成审核'
|
|
},
|
|
{
|
|
title: '审核结果未知',
|
|
icon: 'question-circle',
|
|
buttonIcon: 'audit',
|
|
url: 'submit-audit',
|
|
action: 'submitAudit',
|
|
status: {
|
|
0: {
|
|
title: '审核通过',
|
|
icon: 'check-circle',
|
|
},
|
|
1: {
|
|
title: '审核不通过',
|
|
icon: 'close-circle',
|
|
stepStatus: 'error',
|
|
buttonText: '重新提交审核',
|
|
description: '审核不通过,原因:'
|
|
},
|
|
2: {
|
|
title: '等待审核结果',
|
|
icon: 'sync',
|
|
description: '请耐心等待微信的审核结果,一般情况下 24 小时内即可完成审核,节假日审核可能需要一到三天'
|
|
},
|
|
3: {
|
|
title: '审核已撤回',
|
|
icon: 'rollback',
|
|
stepStatus: 'error',
|
|
buttonText: '重新提交审核',
|
|
description: '有人手动操作撤回了本次审核,请重新提交审核'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
title: '发布',
|
|
buttonText: '发布新版',
|
|
icon: 'export',
|
|
url: 'release',
|
|
description: '新版本的小程序需要等下一次冷启动,即退出超过一定时间(目前是5分钟)后才会应用上。'
|
|
},
|
|
];
|
|
|
|
const initVersionList = [
|
|
{
|
|
label: '版本库最新版本',
|
|
value: version
|
|
},
|
|
{
|
|
label: '体验版版本',
|
|
value: commit_version
|
|
},
|
|
{
|
|
label: '审核中版本',
|
|
value: auditStatus.status === 2 ? audit_version : '无'
|
|
},
|
|
{
|
|
label: '已审核版本',
|
|
value: audited_version
|
|
},
|
|
{
|
|
label: '线上版本',
|
|
value: release_version
|
|
},
|
|
];
|
|
|
|
let canRelease = false;
|
|
|
|
// 查找第一个需要完成的步骤
|
|
let _currentStep = versionsArray[0] ? 0 : 4;
|
|
|
|
if (versionsArray[2] && auditStatus.status === 2) {
|
|
_currentStep = 2;
|
|
} else if (versionsArray[0]) {
|
|
_currentStep = versionsArray.findIndex((currentVersion, index) => {
|
|
const nextItem = versionsArray[index + 1];
|
|
return !nextItem || compareVersions(currentVersion, nextItem) > 0
|
|
});
|
|
}
|
|
|
|
let _auditStatusCode = auditStatus.status;
|
|
|
|
if (_currentStep === -1) {
|
|
_currentStep = 4;
|
|
}
|
|
|
|
if (_currentStep !== 2) {
|
|
_auditStatusCode = 2;
|
|
}
|
|
|
|
const currentStep = _currentStep;
|
|
const auditStatusCode = _auditStatusCode;
|
|
const latestVersion = version;
|
|
const auditedVersion = audited_version;
|
|
|
|
export {currentStep, auditStatusCode, initVersionList, stepInfoList, latestVersion,
|
|
auditedVersion, categoriesList}
|