后端更新包更新

This commit is contained in:
a0049873 2022-11-10 09:04:13 +08:00
parent f00373baa4
commit b707337c4f
1 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,136 @@
<!--
* @Author: hisense.liangjunhua
* @Date: 2022-06-20 10:38:17
* @LastEditors: Light
* @LastEditTime: 2022-11-09 16:32:57
* @Description: 告诉大家这是什么
-->
<template>
<div class="systemUpdate">
<!-- <div class="item" @click="downloadTemplate()">
<svg t="1655692930310" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1593" width="200" height="200"><path d="M599.13 0.476L33.55 109.306a20.778 20.778 0 0 0-16.492 20.42v764.308a20.778 20.778 0 0 0 16.372 20.48l565.58 108.83a20.837 20.837 0 0 0 3.81 0.654 19.29 19.29 0 0 0 12.622-4.465 21.313 21.313 0 0 0 7.56-16.015V20.361a21.313 21.313 0 0 0-7.56-16.074 19.23 19.23 0 0 0-16.313-3.81z m-206.11 696.08l-46.14-83.348c-10.597-18.575-20.241-37.864-32.148-59.951h-2.203c-10.538 21.67-20.004 40.305-29.767 58.344l-43.937 76.323-87.278-5 115.557-175.985L158.454 342.8l91.147-5.953 41.317 70.608c9.466 16.55 18.337 33.697 30.541 55.784h2.798c9.824-22.683 18.159-40.543 27.03-58.404l38.935-77.395 86.683-5.953-108.592 188.249L483.93 701.915zM966.519 122.76H663.487v143.36h40.364v40.96h-40.364v102.4h40.364v40.96h-40.364V552.9h40.364v40.96h-40.364v122.939h40.364v40.96h-40.364v143.419h302.972a40.781 40.781 0 0 0 40.424-40.96V163.72a40.781 40.781 0 0 0-40.364-40.96zM905.912 757.7H744.275v-40.96h161.637z m0-163.9H744.275v-40.9h161.637z m0-143.418H744.275v-40.9h161.637z m0-143.42H744.275v-40.84h161.637z" fill="#1296db" p-id="1594"></path></svg>
<span>下载模板</span>
</div> -->
<el-upload
ref="addUpload"
class="item"
:action="fileUploadUrl"
:on-success="onSuccess"
:on-remove="onRemove"
:show-file-list='false'
:on-error="onErrorFile"
:on-exceed='onExceed'
:limit='1'
:on-preview="onPreview"
list-type="text"
>
<svg t="1655692986683" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2083" width="200" height="200"><path d="M192 256v29h9.9c-6.5-9.3-9.9-19-9.9-29z m384 128c-41.9 0-82.3-2.2-120-6.4L590.2 512 467.5 634.8c34.4 3.4 70.8 5.2 108.5 5.2 212.1 0 384-57.3 384-128V256c0 70.7-171.9 128-384 128z m-263.9-99h51.3l17.2 17.2c57.2 11.3 124 17.8 195.4 17.8 212.1 0 384-57.3 384-128S788.1 64 576 64s-384 57.3-384 128c0 36.6 46.2 69.7 120.1 93zM576 704c-59.1 0-115.2-4.5-165.2-12.4L363.4 739H192v93c0 70.7 171.9 128 384 128s384-57.3 384-128V576c0 70.7-171.9 128-384 128z" fill="#E6C27C" p-id="2084"></path><path d="M336.9 349H198.6l98.9 98.9H64v128.2h233.5L198.6 675h138.3l162.9-163z" fill="#497CAD" p-id="2085"></path></svg>
<div>导入更新包</div>
</el-upload>
</div>
</template>
<script>
import Cookies from 'js-cookie'
export default {
name: '',
components: {
},
props: {
},
data () {
return {
fileUploadUrl: window.SITE_CONFIG.apiURL + '/upload?token=' + Cookies.get('ucsToken')
}
},
methods: {
downloadTemplate () {
window.open(window.SITE_CONFIG.apiURL + '/%E8%83%BD%E5%8A%9B%E8%B5%84%E6%BA%90%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx?token=' + Cookies.get('ucsToken'))
},
onSuccess (res, file) {
if (res.code == 0) {
this.$http.post('/admin/update?token=' + Cookies.get('ucsToken'), { updateFile: res.data }).then(up => {
console.log(up, '11111111111111111111111')
this.$message({
message: '导入成功',
type: 'success'
})
this.$refs.addUpload.clearFiles()
})
} else {
this.$message('导入失败!')
this.$refs.addUpload.clearFiles() //
}
},
onErrorFile () {
this.$message('导入失败!')
this.$refs.addUpload.clearFiles() //
},
onRemove (file, fileList) {
console.log(file, fileList)
},
onPreview (file) {
console.log('点击预览===============>', file)
window.open(file.response.data)
},
onExceed (files, fileList) {
this.$message.warning('当前附件数量已达上限,请先删除部分附件!')
}
}
}
</script>
<style lang='scss' scoped>
.systemUpdate {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
padding: 250px 300px;
.item {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 1px solid rgba(0, 0, 0, 0);
span {
font-size: 20px;
font-weight: 600;
margin-top: 20px;
}
div {
font-size: 20px;
font-weight: 600;
margin-top: 20px;
}
}
.item:hover {
cursor: pointer;
border: 1px solid #1296db;
border-radius: 10px;
svg {
animation: turn 2s linear infinite;
animation-iteration-count: 1;
}
}
}
@keyframes turn {
0% {
-webkit-transform: rotateY(0deg);
}
25% {
-webkit-transform: rotateY(90deg);
}
50% {
-webkit-transform: rotateY(180deg);
}
75% {
-webkit-transform: rotateY(270deg);
}
100% {
-webkit-transform: rotateY(360deg);
}
}
</style>