li.shaoyi před 2 roky
rodič
revize
768d812899

+ 2 - 0
electron.build.js

@@ -44,4 +44,6 @@ axios.get(appConfig.apiUrl).then((res) => {
     build({
         config
     })
+}).catch((err) => {
+    console.error(err)
 })

+ 62 - 58
main.js

@@ -3,71 +3,77 @@ const yaml = require('js-yaml')
 const { app, BrowserWindow, Menu, dialog } = require('electron')
 const { autoUpdater } = require('electron-updater')
 
-const fileContents = fs.readFileSync('resources/app-update.yml', 'utf-8')
-const data = yaml.load(fileContents)
+const useUpdater = (win) => {
+    if (app.isPackaged) {
+        const fileContents = fs.readFileSync('resources/app-update.yml', 'utf-8')
+        const data = yaml.load(fileContents)
 
-const createWindow = () => {
-    Menu.setApplicationMenu(null)
-
-    if (data.url) {
-        autoUpdater.autoDownload = false
+        if (data.url) {
+            autoUpdater.autoDownload = false
 
-        autoUpdater.setFeedURL({
-            provider: data.provider,
-            url: data.url
-        })
+            autoUpdater.setFeedURL({
+                provider: data.provider,
+                url: data.url
+            })
 
-        // 检查更新出错
-        autoUpdater.on('error', (err) => {
-            dialog.showMessageBox({
-                type: 'error',
-                title: '错误',
-                noLink: true,
-                message: '更新发生错误',
-                detail: err.message
+            // 检查更新出错
+            autoUpdater.on('error', (err) => {
+                dialog.showMessageBox({
+                    type: 'error',
+                    title: '错误',
+                    noLink: true,
+                    message: '更新发生错误',
+                    detail: err.message
+                })
             })
-        })
 
-        // 检测到有版本更新
-        autoUpdater.on('update-available', (e) => {
-            dialog.showMessageBox({
-                type: 'info',
-                title: '提示',
-                noLink: true,
-                message: e.version,
-                detail: '发现新版本,是否现在下载?',
-                buttons: ['取消', '下载']
-            }).then((res) => {
-                if (res.response === 1) {
-                    autoUpdater.downloadUpdate()
-                }
+            // 检测到有版本更新
+            autoUpdater.on('update-available', (e) => {
+                dialog.showMessageBox({
+                    type: 'info',
+                    title: '提示',
+                    noLink: true,
+                    message: e.version,
+                    detail: '发现新版本,是否现在下载?',
+                    buttons: ['取消', '下载']
+                }).then((res) => {
+                    if (res.response === 1) {
+                        autoUpdater.downloadUpdate()
+                    }
+                })
             })
-        })
 
-        // 更新下载进度事件
-        autoUpdater.on('download-progress', (progress) => {
-            // https://www.electronjs.org/zh/docs/latest/tutorial/progress-bar
-            win.setProgressBar(progress.percent / 100)
-        })
+            // 更新下载进度事件
+            autoUpdater.on('download-progress', (progress) => {
+                // https://www.electronjs.org/zh/docs/latest/tutorial/progress-bar
+                win.setProgressBar(progress.percent / 100)
+            })
 
-        // 下载完成,询问用户是否更新
-        autoUpdater.on('update-downloaded', (e) => {
-            dialog.showMessageBox({
-                type: 'info',
-                title: '提示',
-                noLink: true,
-                message: e.version,
-                detail: '已下载新版本,是否关闭应用更新?',
-                buttons: ['取消', '安装']
-            }).then((res) => {
-                if (res.response === 1) {
-                    autoUpdater.quitAndInstall()
-                } else {
-                    win.setProgressBar(-1)
-                }
+            // 下载完成,询问用户是否更新
+            autoUpdater.on('update-downloaded', (e) => {
+                dialog.showMessageBox({
+                    type: 'info',
+                    title: '提示',
+                    noLink: true,
+                    message: e.version,
+                    detail: '已下载新版本,是否关闭应用更新?',
+                    buttons: ['取消', '安装']
+                }).then((res) => {
+                    if (res.response === 1) {
+                        autoUpdater.quitAndInstall()
+                    } else {
+                        win.setProgressBar(-1)
+                    }
+                })
             })
-        })
+
+            autoUpdater.checkForUpdates()
+        }
     }
+}
+
+const createWindow = () => {
+    Menu.setApplicationMenu(null)
 
     const win = new BrowserWindow({
         center: true,
@@ -78,9 +84,7 @@ const createWindow = () => {
 
     win.maximize()
     win.loadFile('dist/index.html')
-    win.on('ready-to-show', () => {
-        autoUpdater.checkForUpdates()
-    })
+    win.on('ready-to-show', () => useUpdater(win))
 }
 
 app.whenReady().then(() => {

+ 2 - 2
src/packages/mobile/views/bank/sign/Index.vue

@@ -77,7 +77,7 @@ const formSubmit = () => {
         fullloading((hideLoading) => {
             cancelSubmit().then(() => {
                 hideLoading()
-                dialog('签约提交成功,请耐心等待审核。').then(() => {
+                dialog('解约提交成功,请稍后确认结果。').then(() => {
                     router.back()
                 })
             }).catch((err) => {
@@ -94,7 +94,7 @@ const showComponent = (isEdit: boolean) => {
 
 const beforeShowComponent = () => {
     if (bankInfo.value?.cusbankid === 'jdjs') {
-        dialog('请先发函到结算中心修改信息后再修改,否则将会影响出入金。').then(() => {
+        dialog('请先发函到结算中心修改信息后再修改,否则将会影响充值、提现。').then(() => {
             showComponent(true)
         })
     } else {

+ 1 - 1
src/packages/mobile/views/bank/sign/components/edit/Index.vue

@@ -167,7 +167,7 @@ const formSubmit = () => {
 
         onSubmit().then(() => {
             hideLoading()
-            dialog(props.isedit ? '签约信息修改提交成功' : '签约提交成功,请耐心等待审核。').then(() => {
+            dialog(props.isedit ? '签约信息修改提交成功。' : '签约提交成功,请稍后确认结果。').then(() => {
                 closed(true)
             })
         }).catch((err) => {