From 4b43bfb3f6f499f480712dd29bef52275466afd6 Mon Sep 17 00:00:00 2001 From: heyujie <516346543@qq.com> Date: 星期五, 30 七月 2021 22:10:59 +0800 Subject: [PATCH] change all --- src/pages/vindicate/views/updateSettings.vue | 174 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 113 insertions(+), 61 deletions(-) diff --git a/src/pages/vindicate/views/updateSettings.vue b/src/pages/vindicate/views/updateSettings.vue index dac6c1f..74a3bcd 100644 --- a/src/pages/vindicate/views/updateSettings.vue +++ b/src/pages/vindicate/views/updateSettings.vue @@ -1,6 +1,6 @@ <template> <div class="all"> - <div class="cluster-content"> + <div class="update-set-content"> <div class="cluster-center" ref="left"> <div class="menu-item" @@ -17,38 +17,57 @@ </div> <div class="cluster-right"> <div class="net-set" v-if="activePage == 0"> - <el-radio-group v-model="radio2" size="medium"> + <el-radio-group + v-model="radio2" + size="medium" + fill="rgba(61, 104, 225, 1)" + > <el-radio-button label="妫�鏌ユ洿鏂�"></el-radio-button> <el-radio-button label="涓婁紶鏇存柊"></el-radio-button> </el-radio-group> - <div - class="update-center" - v-if="radio2 == '妫�鏌ユ洿鏂�'" - v-loading="upgrading" - element-loading-text="鏇存柊涓紝璇风◢鍚�" - element-loading-spinner="el-icon-loading" - > - <span class="icon iconfont spin-bg"></span> - <div class="desc" v-if="hasNewVersion"> - 妫�鏌ュ埌鏈�鏂扮増鏈細{{ newVersionName }} + <div class="update-center" v-if="radio2 == '妫�鏌ユ洿鏂�'"> + <span v-if="hasNewVersion||checking" + class="icon iconfont spin-bg" + :class="upgrading || checking ? 'spin-bg-rot' : ''" + ></span + > + <span v-else + class="icon iconfont spin-bg" + ></span + > + <div class="desc" v-if="checking && !upgrading"> + 姝e湪妫�娴嬬増鏈洿鏂扳�︹�� </div> - <div class="desc desc-suc" v-else>宸叉槸鏈�鏂扮増鏈�</div> + <div class="desc" v-if="!checking && hasNewVersion"> + {{ upgrading ? "姝e湪鍗囩骇鑷�" : "妫�鏌ュ埌" }}鏈�鏂扮増鏈細{{ + newVersionName + }} + </div> + <div class="desc desc-suc" v-if="!checking && !hasNewVersion"> + 褰撳墠宸茬粡鏄渶鏂扮増鏈� + </div> <el-button - v-if="hasNewVersion" + v-if="hasNewVersion && !checking" + :loading="upgrading" type="primary" + style="width: 150px" size="small" @click="upgradeNewVersion" >鏇存柊</el-button > + + <div class="text-desc" v-if="hasNewVersion && !checking&& !upgrading"> + {{verText}} + </div> </div> <div class="upload-center" v-if="radio2 == '涓婁紶鏇存柊'"> <div class="upload-top"> - <!-- <div class="up-text">涓婁紶鏇存柊鏂囦欢锛屽彧鑳戒笂浼犳枃浠�</div> --> <el-upload class="upload-demo" drag action + v-show="!shengjiing" :http-request="uploadPkg" :limit="1" > @@ -63,16 +82,19 @@ </div> <div class="el-upload__tip" slot="tip"></div> </el-upload> - <!-- <fileUploader - single - url="/version/upload" - @complete="onFileUpload" - @file-added="onFileAdded" - /> --> + + <span + class="icon iconfont spin-bg" + :class="shengjiing ? 'spin-bg-rot' : ''" + v-if="shengjiing" + ></span + > + <div class="desc" v-if="shengjiing">姝e湪杩涜鏇存柊鈥︹��</div> <el-button type="primary" - style="width: 150px" + style="width: 150px; font-size: 15px" @click="upgrade" + size="small" class="uploader-btn" :loading="shengjiing" >{{ shengjiing ? "鏇存柊涓�" : "鏇存柊" }}</el-button @@ -106,6 +128,8 @@ <div class="name">{{ item.title }}</div> <el-switch v-model="item.val" + active-value="1" + inactive-value="0" active-color="rgba(61, 104, 225, 1)" @change="switchChange(item)" > @@ -121,7 +145,6 @@ <script> import { getDevInfo, - fileUpload, doUpgrade, checkNewVersion, upgradeNewVersion, @@ -130,31 +153,21 @@ getSettings, updateSettings, } from "@/api/system"; +import { getUrlKey } from "@/api/utils"; export default { - filters: { - nameFilter(v) { - switch (v) { - case value: - break; - - default: - break; - } - return; - }, - }, data() { return { radio2: "妫�鏌ユ洿鏂�", activePage: 0, patchUpdateStatus: "", probeSum: 0, - timer: null, + timer: null,verText:"", patchFile: {}, fileAdded: false, curVersionName: "", shengjiing: false, upgrading: false, + checking: true, newVersionName: "", hasNewVersion: true, sysSetList: [ @@ -175,7 +188,18 @@ }; }, mounted() { - this.fetchUpgradInfo(); + const isAutoUpdate = getUrlKey("autoUpdate"); + if (isAutoUpdate==1) { + this.checking = false + this.upgradeNewVersion() + // this.showWelcome = false; + // this.activeIndex = this.menuArr.findIndex((x) => x.name == menu); + // this.$nextTick(() => { + // this.$refs.netSettings.openRight(2); + // }); + }else{ + this.fetchUpgradInfo(); + } this.fetchSettings(); }, methods: { @@ -196,17 +220,25 @@ }); }, fetchUpgradInfo() { + this.checking = true; checkNewVersion().then((res) => { + setTimeout(() => { + this.checking = false; + }, 800); this.newVersionName = res.data.newVersion; this.curVersionName = res.data.curVersion; this.hasNewVersion = res.data.hasNewVersion; + this.verText=res.data.newVersionInfo + + if (!this.hasNewVersion) { + this.upgrading = false; + } }); }, upgradeNewVersion() { this.upgrading = true; upgradeNewVersion().then((res) => { - this.upgrading = false; - this.$message.success("鏇存柊鐗堟湰鎴愬姛"); + this.$notify.success("鏇存柊鐗堟湰鎴愬姛"); this.fetchUpgradInfo(); }); }, @@ -233,7 +265,7 @@ id: this.pkgID, }).then((res) => { this.shengjiing = false; - this.$message.success("鏇存柊鐗堟湰鎴愬姛"); + this.$notify.success("鏇存柊鐗堟湰鎴愬姛"); this.pkgID = ""; }); }, @@ -279,13 +311,12 @@ this.activePage = typ; }, switchChange(item) { - let data = { + updateSettings({ name: item.name, value: item.val, - }; - updateSettings(data).then((res) => { + }).then((res) => { if (res.code == 200) { - this.$message.success("鏇存柊鎴愬姛"); + this.$notify.success("鏇存柊鎴愬姛"); } }); }, @@ -296,8 +327,7 @@ .all { width: 100%; } - -.cluster-content { +.update-set-content { height: 100%; display: flex; flex-direction: row; @@ -386,33 +416,55 @@ flex-direction: column; justify-content: space-between; height: 95%; + @keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } + } + .spin-bg { + color: rgb(206, 205, 205); + font-size: 100px; + margin-bottom: 20px; + } + .spin-bg-rot { + animation: spin 0.8s linear infinite; + } + .desc { + height: 20px; + line-height: 20px; + font-size: 15px; + color: rgb(231, 121, 58); + margin-bottom: 20px; + font-weight: 600; + } .update-center { display: flex; flex-direction: column; align-items: center; - .spin-bg { - color: rgb(206, 205, 205); - font-size: 110px; - margin-bottom: 5px; - } - - .desc { - height: 20px; - line-height: 20px; - font-size: 15px; - color: rgb(231, 121, 58); - margin-bottom: 20px; - font-weight: 600; - } .desc-suc { - color: rgb(58, 231, 58); + color: #3a8120; } .el-button { width: 100px; font-size: 15px; } + .text-desc{ + width: 260px; + margin-top: 20px; + background-color: rgba(250, 250, 250, 1); + border: 1px dashed rgba(220, 220, 220, 1); + height: 100px; + padding: 10px 20px; + color: rgba(94, 94, 94, 1); + text-align: left; + font-size: 14px; + border-radius:5px ; + } } .upload-center { .update-center { -- Gitblit v1.8.0