版本不兼容时可以到浏览器下载安装包
This commit is contained in:
270
App.vue
270
App.vue
@@ -8,6 +8,7 @@ import IMSDK, {
|
|||||||
import config from "./common/config";
|
import config from "./common/config";
|
||||||
import { getDbDir, toastWithCallback } from "@/util/common.js";
|
import { getDbDir, toastWithCallback } from "@/util/common.js";
|
||||||
import { conversationSort } from "@/util/imCommon";
|
import { conversationSort } from "@/util/imCommon";
|
||||||
|
import updateManager from "@/util/update.js";
|
||||||
import { PageEvents, UpdateMessageTypes } from "@/constant";
|
import { PageEvents, UpdateMessageTypes } from "@/constant";
|
||||||
const openSdk = uni.requireNativePlugin('Tuoyun-OpenIMSDK');
|
const openSdk = uni.requireNativePlugin('Tuoyun-OpenIMSDK');
|
||||||
const globalEvent = uni.requireNativePlugin('globalEvent');
|
const globalEvent = uni.requireNativePlugin('globalEvent');
|
||||||
@@ -15,11 +16,11 @@ const globalEvent = uni.requireNativePlugin('globalEvent');
|
|||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
console.log("App Launch");
|
console.log("App Launch");
|
||||||
console.log(openSdk);
|
console.log(openSdk);
|
||||||
this.setGlobalIMlistener();
|
this.setGlobalIMlistener();
|
||||||
this.tryLogin();
|
this.tryLogin();
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
checkUpdate(); // 直接调用独立函数,避免this问题
|
updateManager.checkUpdate(); // 直接调用独立函数,避免this问题
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
console.error(
|
console.error(
|
||||||
@@ -45,19 +46,19 @@ export default {
|
|||||||
onShow: function () {
|
onShow: function () {
|
||||||
console.log("App Show");
|
console.log("App Show");
|
||||||
IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false);
|
IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false);
|
||||||
//#ifdef APP-PLUS
|
//#ifdef APP-PLUS
|
||||||
// var info = plus.push.getClientInfo()
|
// var info = plus.push.getClientInfo()
|
||||||
// plus.push.addEventListener("click", function(msg) {
|
// plus.push.addEventListener("click", function(msg) {
|
||||||
// console.log("click:" + JSON.stringify(msg));
|
// console.log("click:" + JSON.stringify(msg));
|
||||||
// console.log(msg.payload);
|
// console.log(msg.payload);
|
||||||
// console.log(JSON.stringify(msg));
|
// console.log(JSON.stringify(msg));
|
||||||
// }, false);
|
// }, false);
|
||||||
// // 监听在线消息事件
|
// // 监听在线消息事件
|
||||||
// plus.push.addEventListener("receive", function(msg) {
|
// plus.push.addEventListener("receive", function(msg) {
|
||||||
// //业务代码
|
// //业务代码
|
||||||
// console.log("recevice:" + JSON.stringify(msg))
|
// console.log("recevice:" + JSON.stringify(msg))
|
||||||
// }, false);
|
// }, false);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -498,245 +499,8 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkUpdate(forceCheck = false) {
|
|
||||||
const localVersion = plus.runtime.version;
|
|
||||||
const localWgtVersion = uni.getStorageSync('wgtVersion') || localVersion;
|
|
||||||
uni.request({
|
|
||||||
url: 'http://47.117.71.33:11295/fadapp-update/version.json?t=' + Date.now(),
|
|
||||||
success: (res) => {
|
|
||||||
const remoteVersion = res.data.version;
|
|
||||||
const wgtUrl = res.data.wgtUrl;
|
|
||||||
// 取本地基座和本地wgt的最大版本
|
|
||||||
const currentVersion = compareVersion(localWgtVersion, localVersion) > 0 ? localWgtVersion : localVersion;
|
|
||||||
console.log('本地基座版本:', localVersion, '本地wgt版本:', localWgtVersion, '当前对比版本:', currentVersion, '远程版本:', remoteVersion);
|
|
||||||
if (compareVersion(remoteVersion, currentVersion) > 0) {
|
|
||||||
// 检查版本兼容性
|
|
||||||
if (!checkVersionCompatibility(remoteVersion, localVersion)) {
|
|
||||||
console.warn('版本不兼容,跳过更新');
|
|
||||||
uni.showModal({
|
|
||||||
title: '版本不兼容',
|
|
||||||
content: `新版本 ${remoteVersion} 与当前基座版本 ${localVersion} 不兼容,请通过应用商店更新完整版本。`,
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否已忽略当前版本(除非强制检查)
|
|
||||||
const ignoredVersion = uni.getStorageSync('ignoredVersion');
|
|
||||||
if (!forceCheck && ignoredVersion === remoteVersion) {
|
|
||||||
console.log('用户已选择忽略此版本:', remoteVersion);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showModal({
|
|
||||||
title: '发现新版本',
|
|
||||||
content: `检测到新版本(${remoteVersion}),是否立即下载并更新?`,
|
|
||||||
confirmText: '立即更新',
|
|
||||||
cancelText: '暂不更新',
|
|
||||||
showCancel: true,
|
|
||||||
success: (modalRes) => {
|
|
||||||
if (modalRes.confirm) {
|
|
||||||
// 检查存储空间
|
|
||||||
checkStorageSpace().then(() => {
|
|
||||||
uni.showLoading({title: '正在下载更新包...'});
|
|
||||||
console.log('开始下载wgt包:', wgtUrl);
|
|
||||||
uni.downloadFile({
|
|
||||||
url: wgtUrl,
|
|
||||||
success: (downloadResult) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
console.log('下载结果:', downloadResult);
|
|
||||||
if (downloadResult.statusCode === 200) {
|
|
||||||
console.log('开始安装wgt包:', downloadResult.tempFilePath);
|
|
||||||
// 检查文件是否存在
|
|
||||||
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, (entry) => {
|
|
||||||
console.log('文件存在,开始安装');
|
|
||||||
plus.runtime.install(downloadResult.tempFilePath, {force: true}, function() {
|
|
||||||
console.log('wgt包安装成功');
|
|
||||||
// 更新本地wgt版本号
|
|
||||||
uni.setStorageSync('wgtVersion', remoteVersion);
|
|
||||||
uni.showModal({
|
|
||||||
title: '更新完成',
|
|
||||||
content: '应用需要重启才能生效,是否立即重启?',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
plus.runtime.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, function(e) {
|
|
||||||
console.error('wgt包安装失败:', e);
|
|
||||||
let errorMsg = '安装失败';
|
|
||||||
if (e && e.message) {
|
|
||||||
errorMsg += ': ' + e.message;
|
|
||||||
}
|
|
||||||
if (e && e.code) {
|
|
||||||
errorMsg += ' (错误代码: ' + e.code + ')';
|
|
||||||
}
|
|
||||||
uni.showModal({
|
|
||||||
title: '安装失败',
|
|
||||||
content: errorMsg + '\n\n可能的原因:\n1. 版本不兼容\n2. 文件损坏\n3. 权限不足\n4. 存储空间不足',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, (error) => {
|
|
||||||
console.error('文件不存在:', error);
|
|
||||||
uni.showModal({
|
|
||||||
title: '安装失败',
|
|
||||||
content: '下载的文件不存在或已损坏',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.error('下载失败,状态码:', downloadResult.statusCode);
|
|
||||||
uni.showModal({
|
|
||||||
title: '下载失败',
|
|
||||||
content: `服务器返回错误,状态码: ${downloadResult.statusCode}`,
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (error) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
console.error('下载失败:', error);
|
|
||||||
uni.showModal({
|
|
||||||
title: '下载失败',
|
|
||||||
content: '网络连接异常,请检查网络后重试',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('存储空间检查失败:', error);
|
|
||||||
uni.showModal({
|
|
||||||
title: '存储空间不足',
|
|
||||||
content: '设备存储空间不足,无法下载更新包',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '确定'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// 用户选择暂不更新,询问是否忽略此版本
|
|
||||||
uni.showModal({
|
|
||||||
title: '忽略更新',
|
|
||||||
content: `是否忽略版本 ${remoteVersion}?忽略后下次启动时将不再提示此版本更新。`,
|
|
||||||
confirmText: '忽略此版本',
|
|
||||||
cancelText: '下次提醒',
|
|
||||||
success: (ignoreRes) => {
|
|
||||||
if (ignoreRes.confirm) {
|
|
||||||
uni.setStorageSync('ignoredVersion', remoteVersion);
|
|
||||||
uni.showToast({title: '已忽略此版本更新'});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// uni.showToast({title: '当前已是最新版本'});
|
|
||||||
console.log('当前已是最新版本');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (error) => {
|
|
||||||
console.error('检查更新失败:', error);
|
|
||||||
uni.showToast({title: '网络异常,请稍后重试'});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function extractVersionNum(str) {
|
|
||||||
// 匹配第一个出现的数字版本号
|
|
||||||
const match = str.match(/(\d+\.\d+(?:\.\d+)?)/);
|
|
||||||
return match ? match[1] : '0.0.0';
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareVersion(v1, v2) {
|
|
||||||
v1 = extractVersionNum(v1).split('.').map(Number);
|
|
||||||
v2 = extractVersionNum(v2).split('.').map(Number);
|
|
||||||
for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
|
|
||||||
const n1 = v1[i] || 0;
|
|
||||||
const n2 = v2[i] || 0;
|
|
||||||
if (n1 > n2) return 1;
|
|
||||||
if (n1 < n2) return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新管理工具函数
|
|
||||||
function clearIgnoredVersion() {
|
|
||||||
uni.removeStorageSync('ignoredVersion');
|
|
||||||
console.log('已清除忽略的版本设置');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIgnoredVersion() {
|
|
||||||
return uni.getStorageSync('ignoredVersion');
|
|
||||||
}
|
|
||||||
|
|
||||||
function setIgnoredVersion(version) {
|
|
||||||
uni.setStorageSync('ignoredVersion', version);
|
|
||||||
console.log('已设置忽略版本:', version);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查版本兼容性
|
|
||||||
function checkVersionCompatibility(wgtVersion, baseVersion) {
|
|
||||||
console.log('检查版本兼容性:', { wgtVersion, baseVersion });
|
|
||||||
|
|
||||||
// 提取主版本号进行比较
|
|
||||||
const wgtMajor = extractVersionNum(wgtVersion).split('.')[0];
|
|
||||||
const baseMajor = extractVersionNum(baseVersion).split('.')[0];
|
|
||||||
|
|
||||||
// 主版本号必须匹配
|
|
||||||
if (wgtMajor !== baseMajor) {
|
|
||||||
console.warn('主版本号不匹配:', { wgtMajor, baseMajor });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查wgt版本是否高于基座版本
|
|
||||||
if (compareVersion(wgtVersion, baseVersion) <= 0) {
|
|
||||||
console.warn('wgt版本不高于基座版本');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查存储空间
|
|
||||||
function checkStorageSpace() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
if (typeof plus !== 'undefined' && plus.io) {
|
|
||||||
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
|
|
||||||
fs.root.getDirectory('temp', { create: true }, (dir) => {
|
|
||||||
// 简单检查,实际项目中可能需要更复杂的空间检查
|
|
||||||
resolve(true);
|
|
||||||
}, (error) => {
|
|
||||||
console.error('检查存储空间失败:', error);
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
resolve(true);
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifndef APP-PLUS
|
|
||||||
resolve(true);
|
|
||||||
// #endif
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出更新管理函数供其他页面使用
|
// 导出更新管理函数供其他页面使用
|
||||||
uni.$updateManager = {
|
uni.$updateManager = updateManager;
|
||||||
checkUpdate: (forceCheck = false) => checkUpdate(forceCheck),
|
|
||||||
clearIgnoredVersion,
|
|
||||||
getIgnoredVersion,
|
|
||||||
setIgnoredVersion,
|
|
||||||
checkVersionCompatibility,
|
|
||||||
checkStorageSpace
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
44
api/oa/contact.js
Normal file
44
api/oa/contact.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from "@/util/oaRequest"
|
||||||
|
|
||||||
|
// 查询家具列表
|
||||||
|
export function listFurnitureTable(query) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/furnitureTable/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询家具详细
|
||||||
|
export function getFurnitureTable(furnitureId) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/furnitureTable/' + furnitureId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增家具
|
||||||
|
export function addFurnitureTable(data) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/furnitureTable',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改家具
|
||||||
|
export function updateFurnitureTable(data) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/furnitureTable',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除家具
|
||||||
|
export function delFurnitureTable(furnitureId) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/furnitureTable/' + furnitureId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
53
api/oa/emailAccount.js
Normal file
53
api/oa/emailAccount.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询发件人邮箱账号管理列表
|
||||||
|
export function listEmailAccount(query) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询发件人邮箱账号管理详细
|
||||||
|
export function getEmailAccount(emailId) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount/' + emailId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增发件人邮箱账号管理
|
||||||
|
export function addEmailAccount(data) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改发件人邮箱账号管理
|
||||||
|
export function updateEmailAccount(data) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除发件人邮箱账号管理
|
||||||
|
export function delEmailAccount(emailId) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount/' + emailId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送邮件(单条和批量共用)
|
||||||
|
export function sendEmail(data) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/emailAccount/sendBatchEmail',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
52
components/oa/oa-file-upload/index.vue
Normal file
52
components/oa/oa-file-upload/index.vue
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<button type="primary" @click="chooseFile">选择文件</button>
|
||||||
|
<view v-if="fileName" class="file-name">已选择:{{ fileName }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'OaFileUpload',
|
||||||
|
props: {
|
||||||
|
// 选择文件后回调,参数为文件临时路径和文件信息
|
||||||
|
onChoose: {
|
||||||
|
type: Function,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileName: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
chooseFile() {
|
||||||
|
uni.chooseFile({
|
||||||
|
count: 1,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.tempFiles && res.tempFiles.length > 0) {
|
||||||
|
const file = res.tempFiles[0];
|
||||||
|
this.fileName = file.name;
|
||||||
|
this.$emit('choose', file);
|
||||||
|
if (this.onChoose) {
|
||||||
|
this.onChoose(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({ title: '文件选择失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.file-name {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
color: #666;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -349,6 +349,14 @@
|
|||||||
"navigationBarTitleText" : "项目详情",
|
"navigationBarTitleText" : "项目详情",
|
||||||
"navigationStyle": "default"
|
"navigationStyle": "default"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/workbench/sales/sales",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "线上营销",
|
||||||
|
"navigationStyle": "default"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
|
|||||||
@@ -6,34 +6,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</custom-nav-bar>
|
</custom-nav-bar>
|
||||||
<view class="entry-list">
|
<view class="entry-list">
|
||||||
<view class="entry-item" @click="goReportWork">
|
<view
|
||||||
<image class="entry-icon" src="/static/images/baogong.png" mode="aspectFit" />
|
v-for="item in entryList"
|
||||||
<text class="entry-text">每日报工</text>
|
:key="item.text"
|
||||||
|
class="entry-item"
|
||||||
|
@click="handleEntryClick(item)"
|
||||||
|
>
|
||||||
|
<image class="entry-icon" :src="item.icon" mode="aspectFit" />
|
||||||
|
<text class="entry-text">{{ item.text }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="entry-item" @click="goConstruction">
|
|
||||||
<image class="entry-icon" src="/static/images/shigong.png" mode="aspectFit" />
|
|
||||||
<text class="entry-text">施工进度</text>
|
|
||||||
</view>
|
|
||||||
<view class="entry-item" @click="goTask">
|
|
||||||
<image class="entry-icon" src="/static/images/task.png" mode="aspectFit"></image>
|
|
||||||
<text class="entry-text">任务中心</text>
|
|
||||||
</view>
|
|
||||||
<view class="entry-item" @click="goSchedule">
|
|
||||||
<image class="entry-icon" src="/static/images/paichan.png" mode="aspectFit"></image>
|
|
||||||
<text class="entry-text">项目排产</text>
|
|
||||||
</view>
|
|
||||||
<view class="entry-item" @click="goExpress">
|
|
||||||
<image class="entry-icon" src="/static/images/express.svg" mode="aspectFit"></image>
|
|
||||||
<text class="entry-text">快递信息</text>
|
|
||||||
</view>
|
|
||||||
<view class="entry-item" @click="goProject">
|
|
||||||
<image class="entry-icon" src="/static/images/project.png" mode="aspectFit"></image>
|
|
||||||
<text class="entry-text">项目中心</text>
|
|
||||||
</view>
|
|
||||||
<view class="entry-item" @click="goStock">
|
|
||||||
<image class="entry-icon" src="/static/images/stock.png" mode="aspectFit"></image>
|
|
||||||
<text class="entry-text">库存盘点</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -53,6 +34,52 @@ export default {
|
|||||||
// 页面加载时调用getUserProfile
|
// 页面加载时调用getUserProfile
|
||||||
this.fetchUserProfile();
|
this.fetchUserProfile();
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
entryList: [
|
||||||
|
{
|
||||||
|
text: '每日报工',
|
||||||
|
icon: '/static/images/baogong.png',
|
||||||
|
url: '/pages/workbench/reportWork/reportWork',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '施工进度',
|
||||||
|
icon: '/static/images/shigong.png',
|
||||||
|
url: '/pages/workbench/construction/construction',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '任务中心',
|
||||||
|
icon: '/static/images/task.png',
|
||||||
|
url: '/pages/workbench/task/task',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '项目排产',
|
||||||
|
icon: '/static/images/paichan.png',
|
||||||
|
url: '/pages/workbench/reportSchedule/reportSchedule',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '快递信息',
|
||||||
|
icon: '/static/images/express.svg',
|
||||||
|
url: '/pages/workbench/express/express',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '项目中心',
|
||||||
|
icon: '/static/images/project.png',
|
||||||
|
url: '/pages/workbench/project/project',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '库存盘点',
|
||||||
|
icon: '/static/images/stock.png',
|
||||||
|
url: '/pages/workbench/wms/wms',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '线上营销',
|
||||||
|
icon: '/static/images/yingxiao.png',
|
||||||
|
url: '/pages/workbench/sales/sales',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取用户个人信息
|
// 获取用户个人信息
|
||||||
async fetchUserProfile() {
|
async fetchUserProfile() {
|
||||||
@@ -66,41 +93,11 @@ export default {
|
|||||||
console.error('获取用户个人信息失败:', error);
|
console.error('获取用户个人信息失败:', error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goReportWork() {
|
handleEntryClick(item) {
|
||||||
uni.navigateTo({
|
if (item.url) {
|
||||||
url: '/pages/workbench/reportWork/reportWork'
|
uni.navigateTo({ url: item.url });
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
goConstruction() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/construction/construction'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
goTask() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/task/task'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goSchedule() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/reportSchedule/reportSchedule'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goExpress() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/express/express'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goProject() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/project/project'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goStock() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/workbench/wms/wms'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
37
pages/workbench/sales/sales.vue
Normal file
37
pages/workbench/sales/sales.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<oa-file-upload @choose="onFileChoose" />
|
||||||
|
<view v-if="fileInfo">
|
||||||
|
已选择文件:{{ fileInfo.name }}
|
||||||
|
</view>
|
||||||
|
<button @click="test">测试下载</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileInfo: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onFileChoose(file) {
|
||||||
|
this.fileInfo = file;
|
||||||
|
},
|
||||||
|
test() {
|
||||||
|
// 替换为你的下载地址
|
||||||
|
const downloadUrl = 'http://47.117.71.33:11295/fadapp-update/fad.wgt';
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL(downloadUrl);
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
window.open(downloadUrl, '_blank');
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
BIN
static/images/yingxiao.png
Normal file
BIN
static/images/yingxiao.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
232
util/update.js
Normal file
232
util/update.js
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
|
||||||
|
// 匹配第一个出现的数字版本号
|
||||||
|
function extractVersionNum(str) {
|
||||||
|
const match = str.match(/(\d+\.\d+(?:\.\d+)?)/);
|
||||||
|
return match ? match[1] : '0.0.0';
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareVersion(v1, v2) {
|
||||||
|
v1 = extractVersionNum(v1).split('.').map(Number);
|
||||||
|
v2 = extractVersionNum(v2).split('.').map(Number);
|
||||||
|
for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
|
||||||
|
const n1 = v1[i] || 0;
|
||||||
|
const n2 = v2[i] || 0;
|
||||||
|
if (n1 > n2) return 1;
|
||||||
|
if (n1 < n2) return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearIgnoredVersion() {
|
||||||
|
uni.removeStorageSync('ignoredVersion');
|
||||||
|
console.log('已清除忽略的版本设置');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIgnoredVersion() {
|
||||||
|
return uni.getStorageSync('ignoredVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setIgnoredVersion(version) {
|
||||||
|
uni.setStorageSync('ignoredVersion', version);
|
||||||
|
console.log('已设置忽略版本:', version);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkVersionCompatibility(wgtVersion, baseVersion) {
|
||||||
|
console.log('检查版本兼容性:', { wgtVersion, baseVersion });
|
||||||
|
const wgtMajor = extractVersionNum(wgtVersion).split('.')[0];
|
||||||
|
const baseMajor = extractVersionNum(baseVersion).split('.')[0];
|
||||||
|
if (wgtMajor !== baseMajor) {
|
||||||
|
console.warn('主版本号不匹配:', { wgtMajor, baseMajor });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (compareVersion(wgtVersion, baseVersion) <= 0) {
|
||||||
|
console.warn('wgt版本不高于基座版本');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkStorageSpace() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (typeof plus !== 'undefined' && plus.io) {
|
||||||
|
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
|
||||||
|
fs.root.getDirectory('temp', { create: true }, (dir) => {
|
||||||
|
resolve(true);
|
||||||
|
}, (error) => {
|
||||||
|
console.error('检查存储空间失败:', error);
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
resolve(true);
|
||||||
|
// #endif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkUpdate(forceCheck = false) {
|
||||||
|
const localVersion = plus.runtime.version;
|
||||||
|
const localWgtVersion = uni.getStorageSync('wgtVersion') || localVersion;
|
||||||
|
uni.request({
|
||||||
|
url: 'http://47.117.71.33:11295/fadapp-update/version.json?t=' + Date.now(),
|
||||||
|
success: (res) => {
|
||||||
|
const remoteVersion = res.data.version;
|
||||||
|
const wgtUrl = res.data.wgtUrl;
|
||||||
|
const currentVersion = compareVersion(localWgtVersion, localVersion) > 0 ? localWgtVersion : localVersion;
|
||||||
|
console.log('本地基座版本:', localVersion, '本地wgt版本:', localWgtVersion, '当前对比版本:', currentVersion, '远程版本:', remoteVersion);
|
||||||
|
if (compareVersion(remoteVersion, currentVersion) > 0) {
|
||||||
|
if (!checkVersionCompatibility(remoteVersion, localVersion)) {
|
||||||
|
console.warn('版本不兼容,跳转到浏览器下载新版安装包');
|
||||||
|
uni.showModal({
|
||||||
|
title: '版本不兼容',
|
||||||
|
content: `新版本 ${remoteVersion} 与当前基座版本 ${localVersion} 不兼容,请前往官网下载最新安装包。`,
|
||||||
|
showCancel: true,
|
||||||
|
confirmText: '去下载',
|
||||||
|
cancelText: '取消',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
const downloadUrl = `http://47.117.71.33:11295/fadapp-update/fad${remoteVersion}.apk`;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL(downloadUrl);
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
window.open(downloadUrl, '_blank');
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ignoredVersion = uni.getStorageSync('ignoredVersion');
|
||||||
|
if (!forceCheck && ignoredVersion === remoteVersion) {
|
||||||
|
console.log('用户已选择忽略此版本:', remoteVersion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '发现新版本',
|
||||||
|
content: `检测到新版本(${remoteVersion}),是否立即下载并更新?`,
|
||||||
|
confirmText: '立即更新',
|
||||||
|
cancelText: '暂不更新',
|
||||||
|
showCancel: true,
|
||||||
|
success: (modalRes) => {
|
||||||
|
if (modalRes.confirm) {
|
||||||
|
checkStorageSpace().then(() => {
|
||||||
|
uni.showLoading({title: '正在下载更新包...'});
|
||||||
|
console.log('开始下载wgt包:', wgtUrl);
|
||||||
|
uni.downloadFile({
|
||||||
|
url: wgtUrl,
|
||||||
|
success: (downloadResult) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
console.log('下载结果:', downloadResult);
|
||||||
|
if (downloadResult.statusCode === 200) {
|
||||||
|
console.log('开始安装wgt包:', downloadResult.tempFilePath);
|
||||||
|
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, (entry) => {
|
||||||
|
console.log('文件存在,开始安装');
|
||||||
|
plus.runtime.install(downloadResult.tempFilePath, {force: true}, function() {
|
||||||
|
console.log('wgt包安装成功');
|
||||||
|
uni.setStorageSync('wgtVersion', remoteVersion);
|
||||||
|
uni.showModal({
|
||||||
|
title: '更新完成',
|
||||||
|
content: '应用需要重启才能生效,是否立即重启?',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
plus.runtime.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, function(e) {
|
||||||
|
console.error('wgt包安装失败:', e);
|
||||||
|
let errorMsg = '安装失败';
|
||||||
|
if (e && e.message) {
|
||||||
|
errorMsg += ': ' + e.message;
|
||||||
|
}
|
||||||
|
if (e && e.code) {
|
||||||
|
errorMsg += ' (错误代码: ' + e.code + ')';
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '安装失败',
|
||||||
|
content: errorMsg + '\n\n可能的原因:\n1. 版本不兼容\n2. 文件损坏\n3. 权限不足\n4. 存储空间不足',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '确定'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, (error) => {
|
||||||
|
console.error('文件不存在:', error);
|
||||||
|
uni.showModal({
|
||||||
|
title: '安装失败',
|
||||||
|
content: '下载的文件不存在或已损坏',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '确定'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error('下载失败,状态码:', downloadResult.statusCode);
|
||||||
|
uni.showModal({
|
||||||
|
title: '下载失败',
|
||||||
|
content: `服务器返回错误,状态码: ${downloadResult.statusCode}`,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '确定'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
console.error('下载失败:', error);
|
||||||
|
uni.showModal({
|
||||||
|
title: '下载失败',
|
||||||
|
content: '网络连接异常,请检查网络后重试',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '确定'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('存储空间检查失败:', error);
|
||||||
|
uni.showModal({
|
||||||
|
title: '存储空间不足',
|
||||||
|
content: '设备存储空间不足,无法下载更新包',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '确定'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
title: '忽略更新',
|
||||||
|
content: `是否忽略版本 ${remoteVersion}?忽略后下次启动时将不再提示此版本更新。`,
|
||||||
|
confirmText: '忽略此版本',
|
||||||
|
cancelText: '下次提醒',
|
||||||
|
success: (ignoreRes) => {
|
||||||
|
if (ignoreRes.confirm) {
|
||||||
|
uni.setStorageSync('ignoredVersion', remoteVersion);
|
||||||
|
uni.showToast({title: '已忽略此版本更新'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('当前已是最新版本');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.error('检查更新失败:', error);
|
||||||
|
uni.showToast({title: '网络异常,请稍后重试'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
checkUpdate,
|
||||||
|
clearIgnoredVersion,
|
||||||
|
getIgnoredVersion,
|
||||||
|
setIgnoredVersion,
|
||||||
|
checkVersionCompatibility,
|
||||||
|
checkStorageSpace,
|
||||||
|
compareVersion,
|
||||||
|
extractVersionNum
|
||||||
|
};
|
||||||
5
version.md
Normal file
5
version.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## 4.5.1
|
||||||
|
+ 开始记录版本
|
||||||
|
+ 增加版本不兼容时可以从浏览器下载安装包的功能
|
||||||
|
+ 优化部分页面功能
|
||||||
|
+ 增加线上销售页面
|
||||||
Reference in New Issue
Block a user