diff --git a/aiApp/manifest.json b/aiApp/manifest.json
index b8ab3182..f0685907 100644
--- a/aiApp/manifest.json
+++ b/aiApp/manifest.json
@@ -1,6 +1,6 @@
{
- "name" : "存客宝",
- "appid" : "__UNI__2B34F1A",
+ "name" : "Ai数智员工",
+ "appid" : "__UNI__8F915F5",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
diff --git a/aiApp/pages.json b/aiApp/pages.json
index 570407ef..93b15ad7 100644
--- a/aiApp/pages.json
+++ b/aiApp/pages.json
@@ -6,13 +6,6 @@
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
- },
- {
- "path": "pages/index/test",
- "style": {
- "navigationBarTitleText": "",
- "navigationStyle": "custom"
- }
}
],
"globalStyle": {
diff --git a/aiApp/pages/index/index copy.vue b/aiApp/pages/index/index copy.vue
new file mode 100644
index 00000000..87817bfb
--- /dev/null
+++ b/aiApp/pages/index/index copy.vue
@@ -0,0 +1,164 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aiApp/pages/index/index.vue b/aiApp/pages/index/index.vue
index 50698c36..d85d8282 100644
--- a/aiApp/pages/index/index.vue
+++ b/aiApp/pages/index/index.vue
@@ -1,7 +1,7 @@
@@ -9,6 +9,7 @@
-
-
diff --git a/aiApp/utils/updateService.js b/aiApp/utils/updateService.js
new file mode 100644
index 00000000..d8531f9b
--- /dev/null
+++ b/aiApp/utils/updateService.js
@@ -0,0 +1,207 @@
+/**
+ * App自动更新服务
+ * 用于检查新版本并触发下载更新
+ */
+
+/**
+ * 检查应用更新
+ * @param {Object} options 配置选项
+ * @param {String} options.currentVersion 当前应用版本号
+ * @param {String} options.apiUrl 检查更新的API地址
+ * @param {Function} options.onSuccess 检查成功回调
+ * @param {Function} options.onError 检查失败回调
+ * @returns {Promise} 更新检查的Promise
+ */
+export function checkUpdate(options) {
+ const { currentVersion, apiUrl, onSuccess, onError } = options;
+
+ return new Promise((resolve, reject) => {
+ uni.request({
+ url: apiUrl,
+ method: 'GET',
+ success: (res) => {
+
+
+ if (res.statusCode === 200 && res.data) {
+
+
+ try {
+ const result = res.data;
+
+ const updateInfo = result.data;
+
+ // 检查是否有新版本
+ if (compareVersion(updateInfo.version, currentVersion) > 0) {
+ // 有新版本
+ const result = {
+ hasUpdate: true,
+ version: updateInfo.version,
+ downloadUrl: updateInfo.downloadUrl,
+ updateContent: updateInfo.updateContent || '发现新版本,请更新!'
+ };
+
+ if (onSuccess) {
+ onSuccess(result);
+ }
+
+ resolve(result);
+ } else {
+ // 没有新版本
+ const result = {
+ hasUpdate: false,
+ currentVersion
+ };
+
+ if (onSuccess) {
+ onSuccess(result);
+ }
+
+ resolve(result);
+ }
+ } catch (error) {
+ const errorMsg = '解析更新信息失败';
+ if (onError) {
+ onError(errorMsg, error);
+ }
+ reject(error);
+ }
+ } else {
+ const errorMsg = '获取更新信息失败';
+ if (onError) {
+ onError(errorMsg);
+ }
+ reject(new Error(errorMsg));
+ }
+ },
+ fail: (error) => {
+ const errorMsg = '检查更新请求失败';
+ if (onError) {
+ onError(errorMsg, error);
+ }
+ reject(error);
+ }
+ });
+ });
+}
+
+/**
+ * 下载并安装更新
+ * @param {Object} options 配置选项
+ * @param {String} options.downloadUrl 下载地址
+ * @param {Function} options.onProgress 下载进度回调
+ * @param {Function} options.onSuccess 下载成功回调
+ * @param {Function} options.onError 下载失败回调
+ */
+export function downloadAndInstallUpdate(options) {
+ const { downloadUrl, onProgress, onSuccess, onError } = options;
+
+ // 判断平台
+ const platform = uni.getSystemInfoSync().platform;
+
+ if (platform === 'android') {
+ // Android平台下载APK并安装
+ const downloadTask = uni.downloadFile({
+ url: downloadUrl,
+ success: (res) => {
+ if (res.statusCode === 200) {
+ // 下载成功,安装APK
+ plus.runtime.install(
+ res.tempFilePath,
+ {
+ force: false
+ },
+ () => {
+ if (onSuccess) {
+ onSuccess();
+ }
+ },
+ (error) => {
+ if (onError) {
+ onError('安装更新失败', error);
+ }
+ }
+ );
+ } else {
+ if (onError) {
+ onError('下载更新文件失败');
+ }
+ }
+ },
+ fail: (error) => {
+ if (onError) {
+ onError('下载更新文件失败', error);
+ }
+ }
+ });
+
+ // 监听下载进度
+ if (onProgress) {
+ downloadTask.onProgressUpdate((res) => {
+ onProgress(res.progress);
+ });
+ }
+ } else if (platform === 'ios') {
+ // iOS平台打开App Store
+ plus.runtime.openURL(downloadUrl);
+ if (onSuccess) {
+ onSuccess();
+ }
+ } else {
+ if (onError) {
+ onError('不支持的平台');
+ }
+ }
+}
+
+/**
+ * 比较版本号
+ * @param {String} v1 版本号1
+ * @param {String} v2 版本号2
+ * @returns {Number} 1: v1>v2, -1: v1 v2Part) {
+ return 1;
+ }
+
+ if (v1Part < v2Part) {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * 显示更新对话框
+ * @param {Object} updateInfo 更新信息
+ * @param {Function} onConfirm 确认更新回调
+ */
+export function showUpdateDialog(updateInfo, onConfirm) {
+ // 处理更新内容中的换行符
+ let content = updateInfo.updateContent || `发现新版本 ${updateInfo.version},是否更新?`;
+
+ // 确保字符串中的\n被转换为实际的换行符
+ content = content.replace(/\\n/g, '\n');
+
+ uni.showModal({
+ title: '发现新版本',
+ content: content,
+ confirmText: '立即更新',
+ cancelText: '稍后再说',
+ success: (res) => {
+ if (res.confirm && onConfirm) {
+ onConfirm();
+ }
+ }
+ });
+}
\ No newline at end of file
diff --git a/ckApp/pages/index/index.vue b/ckApp/pages/index/index.vue
index 50698c36..5bd991d4 100644
--- a/ckApp/pages/index/index.vue
+++ b/ckApp/pages/index/index.vue
@@ -9,6 +9,7 @@