新增在线更新功能
This commit is contained in:
@@ -135,6 +135,8 @@
|
||||
<fastCashier ref="fastCashierRef" type="0" />
|
||||
<!-- 挂起订单 -->
|
||||
<pendingCartModal ref="pendingCartModalRef" @select="pendingCartHandle" />
|
||||
<!-- 检查版本升级 -->
|
||||
<updateDialog />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -147,6 +149,8 @@ import { onMounted, ref } from "vue";
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
|
||||
import updateDialog from '@/components/updateDialog.vue'
|
||||
import remarkModal from "@/components/remarkModal.vue";
|
||||
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||
import cartOperation from "@/views/home/components/cartOperation.vue";
|
||||
@@ -409,6 +413,7 @@ async function createCodeAjax(type = "0") {
|
||||
const res = await createCode({
|
||||
shopId: store.userInfo.shopId,
|
||||
type: type,
|
||||
tableId: global.tableInfo.qrcode || '',
|
||||
});
|
||||
masterId.value = res.code;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,72 @@
|
||||
<template>
|
||||
<el-button>button</el-button>
|
||||
<el-dialog v-model="showDialog" title="发现新版本" width="500" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" :show-close="false">
|
||||
<div class="message">
|
||||
{{ updataInfo.message }}
|
||||
</div>
|
||||
<div class="progress_wrap" style="padding-top: 20px;">
|
||||
<el-progress :percentage="uploadPro" :stroke-width="15" striped :striped-flow="uploadPro < 100" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="footer" style="padding: 0 20px 20px;">
|
||||
<el-button v-if="!updataInfo.isUp">下次更新</el-button>
|
||||
<el-button type="primary" :loading="isUpload" @click="uplaodHandle">
|
||||
<template v-if="!uploadSucess">
|
||||
<template v-if="!isUpload">
|
||||
立即更新
|
||||
</template>
|
||||
<template v-else>
|
||||
下载中...
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
立即安装
|
||||
</template>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { findVersion } from '@/api/user.js'
|
||||
import packageData from "../../../package.json";
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
const showDialog = ref(false)
|
||||
const updataInfo = ref({})
|
||||
const isUpload = ref(false)
|
||||
const uploadPro = ref(0)
|
||||
const uploadSucess = ref(false)
|
||||
const uploadResponse = ref({})
|
||||
const tempFilePath = ref('')
|
||||
|
||||
// 检查版本更新
|
||||
async function findVersionAjax() {
|
||||
try {
|
||||
const res = await findVersion()
|
||||
let reg = /\./g;
|
||||
// console.log('res.version', res.version.replace(reg, ''));
|
||||
// console.log('packageData.version', packageData.version.replace(reg, ''));
|
||||
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url) {
|
||||
console.log('有版本更新');
|
||||
showDialog.value = true
|
||||
updataInfo.value = res
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 下载新版本
|
||||
async function uplaodHandle() {
|
||||
try {
|
||||
if (!uploadSucess.value) {
|
||||
isUpload.value = true
|
||||
ipcRenderer.send('downloadFile', JSON.stringify({ url: updataInfo.value.url }))
|
||||
// await downloadFile(updataInfo.value.url)
|
||||
// isUpload.value = false
|
||||
// uploadSucess.value = true
|
||||
} else {
|
||||
// 安装文件
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -23,5 +75,9 @@ async function findVersionAjax() {
|
||||
|
||||
onMounted(() => {
|
||||
findVersionAjax()
|
||||
ipcRenderer.on('updateProgress', (event, res) => {
|
||||
// console.log('updateProgress===', event, res);
|
||||
uploadPro.value = res
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -308,7 +308,8 @@ const asyncqueryMembermember = async () => {//会员列表数据
|
||||
shopId: store.userInfo.shopId,
|
||||
page: tableData.page,
|
||||
pageSize: 10,
|
||||
phone: tableData.phone
|
||||
phone: tableData.phone,
|
||||
isFlag: 0
|
||||
})
|
||||
if (res) {
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user