|
@@ -112,6 +112,25 @@
|
|
|
@success="stepCaptchaSuccess"
|
|
|
@cancel="stepCaptchaCancel"
|
|
|
></two-step-captcha>
|
|
|
+ <!-- ElectronApp 更新 -->
|
|
|
+ <a-modal
|
|
|
+ title="正在更新新版本,请稍候..."
|
|
|
+ width="60%"
|
|
|
+ :visible="dialogVisible"
|
|
|
+ :closable="false"
|
|
|
+ :maskClosable="false"
|
|
|
+ centered
|
|
|
+ :footer="null"
|
|
|
+ >
|
|
|
+ <div style="width:100%;height:20vh;line-height:20vh;text-align:center">
|
|
|
+ <a-progress
|
|
|
+ status="success"
|
|
|
+ :strokeWidth="20"
|
|
|
+ :percent="percentage"
|
|
|
+ :width="strokeWidth"
|
|
|
+ ></a-progress>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -122,7 +141,6 @@ import { mapActions } from 'vuex'
|
|
|
import { timeFix } from '@/utils/util'
|
|
|
import { getSmsCaptcha, get2step } from '@/api/login'
|
|
|
import { updateTheme } from '@/components/SettingDrawer/settingConfig'
|
|
|
-
|
|
|
export default {
|
|
|
components: {
|
|
|
TwoStepCaptcha
|
|
@@ -146,7 +164,34 @@ export default {
|
|
|
},
|
|
|
rememberMe: true,
|
|
|
username: '',
|
|
|
- password: ''
|
|
|
+ password: '',
|
|
|
+ // 客户端升级弹框
|
|
|
+ dialogVisible: false,
|
|
|
+ percentage: 0,
|
|
|
+ strokeWidth: 200
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ const _this = this
|
|
|
+ if (isElectronApp) {
|
|
|
+ // 接收主进程版本更新消息
|
|
|
+ ipcRenderer.on('message', (event, arg) => {
|
|
|
+ console.log(arg)
|
|
|
+ if (arg.cmd == 'update-available') {
|
|
|
+ // 显示升级对话框
|
|
|
+ _this.dialogVisible = true
|
|
|
+ } else if (arg.cmd == 'download-progress') {
|
|
|
+ console.log(arg.message.percent)
|
|
|
+ const percent = Math.round(parseFloat(arg.message.percent))
|
|
|
+ _this.percentage = percent
|
|
|
+ } else if (arg.cmd == 'error') {
|
|
|
+ _this.dialogVisible = false
|
|
|
+ _this.$message.error('更新失败')
|
|
|
+ } else if (arg.cmd == 'update-downloaded') {
|
|
|
+ _this.dialogVisible = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ipcRenderer.send('checkForUpdate')
|
|
|
}
|
|
|
},
|
|
|
created () {
|