| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <div class="software-update">
- <el-dialog
- title="正在下载新版本,请稍候......"
- :visible.sync="centerDialogVisible"
- width="50%"
- :show-close=false
- :close-on-click-modal=false
- :close-on-press-escape=false
- >
- <el-progress :percentage="uploadPercent"></el-progress>
- </el-dialog>
- </div>
- </template>
- <script>
- import mixin from '../mixin'
- export default {
- mixins: [mixin],
- created () {
- this.$electron.ipcRenderer.send('checkForUpdate')
- this.$electron.ipcRenderer.on('msgBox', (event, status) => {
- if (status === 2) {
- this.openUpdateDialog()
- }
- })
- this.$electron.ipcRenderer.on('isUpdateNow', function (event, index) {
- event.sender.send('isUpdateNow')
- })
- },
- data () {
- return {
- uploadPercent: 0,
- centerDialogVisible: false
- }
- },
- methods: {
- openUpdateDialog () {
- this.$confirm('更新内容:1:添加XXX功能<br>' +
- '2:修改XXXbug<br>' +
- '3:提高了响应速度', '新版本更新提示', {
- confirmButtonText: '马上更新',
- cancelButtonText: '稍后再说',
- center: true,
- showClose: false,
- closeOnClickModal: false,
- dangerouslyUseHTMLString: true
- }).then(() => {
- setTimeout(() => {
- this.ProcessDialog()
- }, 200)
- }).catch(() => {
- })
- },
- ProcessDialog () {
- this.$electron.ipcRenderer.send('downloadUpdate')
- this.centerDialogVisible = true
- this.$electron.ipcRenderer.on('downloadProgress', (event, progressObj) => {
- this.uploadPercent = parseInt(progressObj.percent)
- })
- }
- }
- }
- </script>
|