From ba5f0a22558ce40300fa1668d98ea74ad56fd1e3 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期二, 26 四月 2022 20:23:32 +0800 Subject: [PATCH] 初始化页面添加信息刷新 --- src/pages/ai/index/App.vue | 164 ++++++++++++++---------------------------------------- 1 files changed, 43 insertions(+), 121 deletions(-) diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue index 6552cac..7308d94 100644 --- a/src/pages/ai/index/App.vue +++ b/src/pages/ai/index/App.vue @@ -88,7 +88,9 @@ <div class="desc-2">鐗堟湰 {{ item.version }}</div> </div> <div class="right-icon"> - <span class="icon iconfont"></span> + <el-tooltip effect="dark" content="涓嬭浇" placement="bottom"> + <span class="icon iconfont"></span> + </el-tooltip> </div> </div> </div> @@ -142,6 +144,9 @@ v-for="(item, index) in tempList" :key="index" @click="checkDetail(item)" + :class="{ + disabled: activeName == '搴旂敤涓績' && !item.canUpOrIns, + }" > <div class="icon-img"> <span class="icon iconfont" v-if="item.isUpgrade" @@ -169,7 +174,7 @@ class="other-btn" round @click="checkDetail(item)" - v-if="activeName == '搴旂敤涓績'&&item.price>0" + v-if="activeName == '搴旂敤涓績' && item.price > 0" >婵�娲�</el-button > <el-button @@ -178,7 +183,7 @@ class="update-btn" round @click.stop="actived(item)" - v-if="activeName == '搴旂敤涓績'&&item.price==0" + v-if="activeName == '搴旂敤涓績' && item.price == 0" >瀹夎</el-button > <el-button @@ -357,6 +362,7 @@ <detailPage :detailProductID="detailProductID" :detailType="detailType" + :detailPrice="detailPrice" v-if="inDetail" @flushSdk="getAllSdk" @flushApp="getAllApps" @@ -469,6 +475,7 @@ showUpload: false, detailType: "", detailProductID: "", + detailPrice: "", buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [], activeName: "搴旂敤涓績", patchUpdateStatus: "", @@ -504,8 +511,8 @@ installedApps: [], storeApps: [], installFile: {}, - appUpgreading: true, - sdkUpgreading: true, + appUpgreading: false, + sdkUpgreading: false, autoRefresh: true, productDetailVisible: false, isUpgrading: false, @@ -546,11 +553,6 @@ goback() { this.inDetail = false; }, - // isShow(authority) { - // return ( - // this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1 - // ); - // }, batchUpdate(s) { if (s == "both") { this.batchUpdateSDK(); @@ -584,7 +586,6 @@ this.tempList = this.installedList; this.tempDarkList = this.notInstalledList; break; - case "鏇存柊": this.showQuickPath = false; this.tempList = this.hasNewVersionSdk; @@ -620,69 +621,23 @@ this.tempDarkList = []; } }, - // closeDial() { - // this.productDetailVisible = false; - // this.productDetail = {}; - // this.otherProducts = []; - // }, - checkDetail(item, typ) { + checkDetail(item) { + /* if (!item.canUpOrIns && typ == "Appcenter") { + return false; + } */ + this.inDetail = true; this.detailProductID = item.id; + this.detailPrice = item.price; if (typ) { this.detailType = typ; } else { this.detailType = this.activeName == "搴旂敤涓績" ? "inactive" : "active"; } }, - // checkInWindow(item) { - // this.backStack.push([this.productDetail, this.otherProducts]); - // this.backDisable = false; - // this.checkIsDefOrNot(item.id); - - // let _this = this; - // getAppDetail({ id: item.id }).then((res) => { - // _this.productDetail = res.data.detail; - // _this.productDetail.iconBlob = item.iconBlob; - // this.actId = _this.productDetail.productBaseId; - // let flag = false; - // const allNeedToNew = [ - // ...this.hasNewVersionSdk, - // ...this.hasNewVersionApp, - // ]; - // for (let i = 0; i < allNeedToNew.length; i++) { - // const item = allNeedToNew[i]; - // if (item.id == _this.productDetail.productBaseId) { - // flag = true; - // } - // } - // this.needToUpgradeInWin = flag; - // _this.productDetail.isUpgrade = flag; - - // _this.otherProducts = res.data.randoms; - // }); - // }, checkIsDefOrNot(id) { - if (id.length > 10) { - this.isDefaultApp = false; - } else { - this.isDefaultApp = true; - } + this.isDefaultApp = id.length <= 10; }, - // backwards() { - // if (this.backStack.length == 0) { - // this.backDisable = true; - // return; - // } - // this.forwardStack.push([this.productDetail, this.otherProducts]); - // let item = this.backStack.pop(); - // this.productDetail = item[0]; - // this.checkIsDefOrNot(this.productDetail.productBaseId); - // this.otherProducts = item[1]; - // this.forwardDisable = false; - // if (this.backStack.length == 0) { - // this.backDisable = true; - // } - // }, forwards() { if (this.forwardStack.length == 0) { this.forwardDisable = true; @@ -740,7 +695,7 @@ } }) .catch((e) => { - _this.$notify.warning(e.data); + _this.$notify.warning(e.msg); clearInterval(timer); app.upgradeLoading = false; }); @@ -804,18 +759,6 @@ }) .catch((e) => {}); }, - // toActivatePage(item) { - // this.checkDetail(item, "inactive"); - // this.actType = this.activeTab; - // this.actId = item.id; - // this.actStep = 0; - // this.activeCode = ""; - // this.activedSdkOrApp = this.newActInfo(); - // }, - // cancelActivate() { - // this.showInputCode = false; - // this.activeCode = ""; - // }, newActInfo() { return { activateCode: "", @@ -853,11 +796,15 @@ getUnActivedApp().then((res) => { if (res.code == 200) { this.unActivedAppList = res.data; - this.pickTab() + this.pickTab(); } }); }, actived(item) { + if (!item.canUpOrIns) { + return false; + } + let _this = this; if (this.activeTab == "sdk") { actPageAlg(item.id, "") @@ -896,10 +843,6 @@ }); } }, - // checkMyAlgorith() { - // this.showActivateSuccess = false; - // this.activeName = "宸叉縺娲�"; - // }, onFileUpload(file) { this.patchFile = { ...file }; this.fileAdded = true; @@ -935,12 +878,6 @@ this.$message.error(e.msg); }); }, - // openApp() { - // window.parent.postMessage( - // { msg: "toOpenApp?" + this.productDetail.productBaseId }, - // "*" - // ); - // }, onFileAdded(f) { this.patchUpdateStatus = ""; }, @@ -975,26 +912,8 @@ this.notInstalledList = unInstalledList; this.toUpdateArr1 = this.installedList.slice(0, 10); this.hasNewVersionSdk = hasNewVersionList; - this.pickTab() + this.pickTab(); }, - // unloadSDKinWin() { - // let appToUnload; - // let sdkToUnload; - // if (this.productDetail.productTypeName == "搴旂敤") { - // appToUnload = this.installedApps.find((item) => { - // return item.id == this.productDetail.productBaseId; - // }); - // this.unloadApp(appToUnload); - // } else { - // sdkToUnload = this.installedList.find((item) => { - // return item.id == this.productDetail.productBaseId; - // }); - // this.unloadSdk(sdkToUnload); - // } - // }, - // unLoadSdkOrApp(item) { - // this.activeTab == "sdk" ? this.unloadSdk(item) : this.unloadApp(item); - // }, unloadSdk(sdk) { let _this = this; this.$confirm("纭畾瑕佸嵏杞借绠楁硶鍚�?", "鎻愮ず") @@ -1016,7 +935,6 @@ }) .catch((e) => {}); }, - donwloadSDK(item) { let timer = null; item.upgradeLoading = true; @@ -1029,7 +947,7 @@ clearInterval(timer); item.upgradeLoading = false; this.downloadItem = ""; - + window.parent.postMessage({ msg: "AppUpdate" }, "*"); }) .catch((err) => { @@ -1041,20 +959,19 @@ this.sdkUpgreading = true; }, autoRefreshAppAndSdkState() { - // 鍏抽棴鍚庨��鍑� + this.getAllApps(); + this.getAllSdk(); if (!this.autoRefresh) { return; } - if (this.appUpgreading) { - this.getAllApps(); - } - if (this.sdkUpgreading) { - this.getAllSdk(); - } - let _this = this; setTimeout(() => { - _this.autoRefreshAppAndSdkState(); - }, 500); + if (this.appUpgreading) { + this.getAllApps(); + } + if (this.sdkUpgreading) { + this.getAllSdk(); + } + }, 1000); }, }, }; @@ -1418,6 +1335,10 @@ height: 76px; border-radius: 4px; + /* &.disabled { + cursor: default; + } */ + .icon-img { width: 58px; height: 58px; @@ -1461,8 +1382,8 @@ text-align: center; position: relative; .check-btn { - background-color:#FFFFFF !important; - border-color: #BDBDBD !important; + background-color: #ffffff !important; + border-color: #bdbdbd !important; color: #333333; } .update-btn { @@ -1501,6 +1422,7 @@ text-align: end; position: absolute; right: 0; + width: 120px; margin-top: 2px; } .rocket-icon { -- Gitblit v1.8.0