修复更新bug

This commit is contained in:
yanran200730
2023-08-08 23:02:41 +08:00
parent 4475d8d60d
commit f4ccfe8d74
4 changed files with 22 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "TEMU助手", "name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率", "description": "TEMU助手 - 自动化提高生产效率",
"version": "0.0.1", "version": "1.0",
"background": { "background": {
"service_worker": "/background.js" "service_worker": "/background.js"
}, },

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "TEMU助手", "name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率", "description": "TEMU助手 - 自动化提高生产效率",
"version": "1.0.0", "version": "1.0",
"background": { "background": {
"service_worker": "/background.js" "service_worker": "/background.js"
}, },

View File

@@ -98,7 +98,7 @@
if (action === 'confirm') { if (action === 'confirm') {
this.$http.post(isFavorite === '0' ? `/api/learning/addFavorite?id=${id}` : `/api/learning/delFavorite?id=${id}`).then(res => { this.$http.post(isFavorite === '0' ? `/api/learning/addFavorite?id=${id}` : `/api/learning/delFavorite?id=${id}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success(isFavorite === '1' ? '取消成功' : '收藏成功') this.$message.success(isFavorite === '0' ? '收藏成功' : '取消成功')
this.getList() this.getList()
} }
}) })

View File

@@ -23,9 +23,9 @@
</ai-card> </ai-card>
<ai-card title="更新记录"> <ai-card title="更新记录">
<div class="list"> <div class="list">
<div class="item" v-for="(item, index) in changeLogList" :key="index" @click="info = item, isShow = true"> <div class="item" v-for="(item, index) in changeLogList" :key="index" @click="showInfo(item, index)">
<div class="left"> <div class="left">
<el-tag v-if="version !== item.varsion" size="small" effect="dark" type="danger">新版本</el-tag> <el-tag v-if="version !== item.version && index === 0" size="small" effect="dark" type="danger" @click.stop="download(item.downloadUrl)">新版本下载</el-tag>
<h2 :title="item.title">{{ item.title }}</h2> <h2 :title="item.title">{{ item.title }}</h2>
</div> </div>
<span>{{ item.createTime }}</span> <span>{{ item.createTime }}</span>
@@ -45,14 +45,15 @@
:close-on-click-modal="false" :close-on-click-modal="false"
customFooter customFooter
:show-close="!isImportant" :show-close="!isImportant"
@close="info = {}, isShowDownload = false"
width="690"> width="690">
<div class="news"> <div class="news">
<h2>{{ info.title }}</h2> <h2>{{ info.title }}</h2>
<p>{{ info.content }}</p> <p>{{ info.content }}</p>
</div> </div>
<div class="dialog-footer" slot="footer"> <div class="dialog-footer" slot="footer">
<el-button @click="read" type="primary" v-if="!info.varsion">{{ isImportant ? '我已阅读' : '关闭' }}{{ info.version }}</el-button> <el-button @click="read" type="primary" style="width: 140px" v-if="!info.version">{{ isImportant ? '我已阅读' : '关闭' }}</el-button>
<el-button @click="download" type="primary" style="width: 140px" v-if="info.varsion && info.varsion !== version">下载新版本</el-button> <el-button type="primary" style="width: 140px" v-if="info.version" @click="isShow = false">关闭</el-button>
</div> </div>
</AiDialog> </AiDialog>
</div> </div>
@@ -70,7 +71,8 @@
info: {}, info: {},
changeLogList: [], changeLogList: [],
isImportant: false, isImportant: false,
version: '' version: '',
isShowDownload: false
} }
}, },
@@ -93,12 +95,21 @@
}) })
}, },
download () { showInfo (info, index) {
if (index === 0) {
this.isShowDownload = true
}
this.info = info
console.log(this.info.version === this.version)
this.isShow = true
},
download (url) {
const link = document.createElement('a') const link = document.createElement('a')
link.style.display = 'none' link.style.display = 'none'
link.href = this.info.downloadUrl link.href = url
link.setAttribute('target', '_blank') link.setAttribute('target', '_blank')
link.setAttribute('download', `TEMU助手-${this.info.varsion}.zip`) link.setAttribute('download', `TEMU助手-${url}.zip`)
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link) document.body.removeChild(link)