From 98710e70bb52e761a1769c6454a290040b610aee Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期三, 07 四月 2021 18:20:46 +0800
Subject: [PATCH] 在请求index.js时添加参数,解决缓存的问题
---
src/pages/ai/index/App.vue | 371 ++++++++++++++++++++--------------------------------
1 files changed, 141 insertions(+), 230 deletions(-)
diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 16c2718..679fc32 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -26,47 +26,6 @@
>
<p class="src-title">绠楁硶杞欢</p>
<div class="flex-list">
- <!-- <div class="wrap-box" v-for="item in ungradeList" :key="'upgrade'+item.id">
- <div class="list-choose-item-left">
- <div class="list-complete-item-handle">
- <div
- class="svg-wrap"
- :class="{willUpGrade:item.isUpgrade}"
- v-loading="item.upgradeLoading"
- :element-loading-text="item.progressMsg"
- element-loading-background="rgba(0,0,0,.8)"
- >
- <i class="iconfont iconupdate" v-if="item.isUpgrade"></i>
- <div class="mask">
- <div class="info-onmask">
- <div>褰撳墠鐗堟湰:{{item.version}}</div>
- <div>鏈�鏂扮増鏈�:{{item.remoteVersion}}</div>
- </div>
- <div class="mask-btn">
- <el-button
- type="warning"
- class="bot-btn"
- size="small"
- @click="donwload(item)"
- >鍗囩骇</el-button>
- </div>
- </div>
- <img
- v-if="item.iconBlob"
- class="baseImg"
- :src="item.iconBlob.indexOf(',')>0? item.iconBlob:`data:image/png;base64,${item.iconBlob}`"
- alt
- />
- <img v-else class="baseImg" :src="item.icon" alt />
- </div>
- <div class="alg-name">
- <div style="padding:0px 10px 0px 10px;">
- <span>{{ item.sdk_name }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>-->
<div
class="wrap-box"
v-for="item in installedList"
@@ -111,7 +70,7 @@
>
<el-button
v-if="item.isUpgrade"
- @click="donwload(item)"
+ @click="donwload(item,0)"
type="warning"
size="small"
class="bot-btn"
@@ -168,13 +127,13 @@
</div>
<div
class="info-onmask"
- @click="checkDetail(item, 'inactive')"
+ @click="checkDetail(item, 'activeNotInstall')"
>
鏌ョ湅璇︽儏
</div>
<div class="mask-btn">
<el-button
- @click="donwload(item)"
+ @click="donwload(item,1)"
type="primary"
class="bot-btn"
>瀹夎</el-button
@@ -247,16 +206,16 @@
鏈�鏂扮増鏈�:{{ item.remoteVersion }}
</div>
</div>
+ <!-- v-if="!item.isDefault" -->
<div
class="info-onmask"
@click="checkDetail(item,'active')"
- v-if="!item.isDefault"
>
鏌ョ湅璇︽儏
</div>
<div class="mask-btn">
<el-button
- v-if="!item.isDefault"
+ v-show="!item.isDefault"
@click="unLoad(item)"
type="primary"
size="small"
@@ -548,78 +507,12 @@
</div>
</div>
</div>
- <el-drawer
- title="涓嬭浇"
- :visible.sync="actDrawerShow"
- :direction="direction"
- >
- <div class="drawer-content">
- <div class="current-step">
- <el-steps
- align-center
- :active="actStep"
- finish-status="success"
- >
- <el-step title="娣诲姞婵�娲荤爜"></el-step>
- <el-step title="婵�娲绘垚鍔�"></el-step>
- </el-steps>
- </div>
-
- <div v-if="actStep == 0">
- <div class="act-code">
- <p>浣跨敤婵�娲荤爜灏嗘柊鐨勭畻娉曟坊鍔犲埌鎮ㄧ殑璐︽埛</p>
- <el-input
- v-model="activeCode"
- placeholder="00000-00000-00000-00000-00000"
- @blur="getCodeDetail"
- ></el-input>
- </div>
- <div class="text-right">
- <el-button type="primary" @click="actived"
- >婵�娲�</el-button
- >
- </div>
- </div>
- <div v-else-if="actStep == 1">
- <ul class="desc">
- <li>
- <label>婵�娲荤爜:</label>
- <span>{{ activedSdkOrApp.activateCode }}</span>
- </li>
- <li>
- <label>浜у搧鍚嶇О:</label>
- <span>{{ activedSdkOrApp.productName }}</span>
- </li>
- <li>
- <label>閰嶇疆璇︽儏:</label>
- <span>{{ activedSdkOrApp.setting }}</span>
- </li>
- <li>
- <label>鏈嶅姟鍒版湡鏃�:</label>
- <span>{{ activedSdkOrApp.expireTime }}</span>
- </li>
- <li>
- <label>璁稿彲璇�:</label>
- <span>{{ activedSdkOrApp.licence }}</span>
- </li>
- <!-- <li>
- <label>璁惧ID:</label>
- <span>3342-235f-ret55-fdsg</span>
- </li>-->
- </ul>
- <div class="text-right">
- <el-button type="primary" @click="checkMyAlgorith"
- >纭畾</el-button
- >
- <p class="tip">鎻愮ず锛氳鍦ㄢ�滃凡婵�娲烩�濅腑鏌ョ湅骞跺畨瑁呯畻娉�</p>
- </div>
- </div>
- </div>
- </el-drawer>
+ <!-- -->
+
</el-tab-pane>
<el-tab-pane name="update">
<span slot="label">
- <el-badge class="update-badge" :value="updateNum"
+ <el-badge class="update-badge" :value="updateNum" :hidden="updateNum==0"
>鏇存柊</el-badge
>
</span>
@@ -681,7 +574,7 @@
>
<el-button
v-if="item.isUpgrade"
- @click="donwload(item)"
+ @click="donwload(item,0)"
type="warning"
size="small"
class="bot-btn"
@@ -935,21 +828,16 @@
<span>{{ productDetail.productName }}</span>
</el-tooltip></div>
<div class="tags">
- <!-- <span
- class="tag"
- v-for="(id, index) in curCheckTarget.productLabelId"
- :key="index+'i'"
- >{{showNameById(id)}}</span> -->
<el-tag type="info" size="small" color="#fff" v-if="!isSDKDialog">搴旂敤</el-tag>
<el-tag type="info" size="small" color="#fff" v-if="isSDKDialog">绠楁硶</el-tag>
- <!-- <el-tag type="info" size="small" color="#fff" v-if="!isSDKDialog">杞欢</el-tag> -->
</div>
<div class="btns">
<el-button size="small" type="warning" v-if="needToUpgradeInWin||productDetail.isUpgrade" @click="upgradeSDKinWin" >{{
isUpgrading ? "鍗囩骇涓�.." : "鍗囩骇"
}}</el-button>
- <el-button size="small" type="primary" v-if="isActive" @click="unloadSDKinWin">鍗歌浇</el-button>
- <el-button size="small" type="primary" v-if="!isActive" @click="showInputCode=!showInputCode">婵�娲�</el-button>
+ <el-button size="small" type="primary" v-if="isActive&&!isDefaultApp" @click="unloadSDKinWin">鍗歌浇</el-button>
+ <el-button size="small" type="primary" v-if="!isActive&&!showInstallNotActive" @click="showInputCode=!showInputCode">婵�娲�</el-button>
+ <el-button size="small" type="primary" v-if="!isActive&&showInstallNotActive" @click="downloadSdkInSide">{{isUpgrading?"瀹夎涓�..":"瀹夎"}}</el-button>
<el-button size="small" type="success" v-if="!isSDKDialog&&isActive" @click="openApp">鎵撳紑</el-button>
</div>
@@ -1068,7 +956,6 @@
</div>
</div>
</el-dialog>
- <!-- -->
<el-dialog
:visible.sync="showActivateSuccess"
title="婵�娲绘垚鍔燂紒"
@@ -1185,7 +1072,6 @@
downloadItem: "",
downloading: false,
direction: "rtl",
- actDrawerShow: false,
actStep: 0,
showActivateSuccess:false,
activeCode: "",
@@ -1195,10 +1081,10 @@
installAppPackage: null,
installSdkPackage: null,
isActive:true,
+ isDefaultApp:false,
installPercentage: 0,
unActivedSDKList: [],
unActivedAppList: [],
- // dialogTitle: "",
isSDKDialog:true,
//actSdkId: '',
actType: "",
@@ -1232,6 +1118,7 @@
showInputCode:false,
needToUpgradeInWin:false,
errMsg:"",
+ showInstallNotActive:false
};
},
directives: {
@@ -1262,7 +1149,7 @@
batchUpdate(type) {
if (type == "sdk") {
this.hasNewVersionSdk.forEach((sdk) => {
- this.donwload(sdk);
+ this.donwload(sdk,0);
});
} else {
this.hasNewVersionApp.forEach((app) => {
@@ -1278,20 +1165,25 @@
checkDetail(item,type) {
if (type =='inactive') {
this.isActive =false
+ this.showInstallNotActive = false
this.showInputCode = false
- }else{
+ }else if (type =='active'){
this.showInputCode = false
+ this.showInstallNotActive = false
this.isActive =true
+ }else if (type =='activeNotInstall'){
+ this.showInputCode = false
+ this.isActive =false
+ this.showInstallNotActive = true
}
+ this.checkIsDefOrNot(item.id)
this.needToUpgradeInWin = item.isUpgrade?true:false
this.resetStack()
- // this.productDetail = item;
if (item.sdk_type===undefined) {
this.isSDKDialog=false
}else{
this.isSDKDialog=true
}
- // debugger
this.productDetailVisible = true;
let _this = this;
getAppDetail({ id: item.id }).then((res) => {
@@ -1312,8 +1204,8 @@
},
checkInWindow(item){
this.backStack.push([this.productDetail, this.otherProducts])
- // debugger
this.backDisable = false
+ this.checkIsDefOrNot(item.id)
let _this = this;
getAppDetail({ id: item.id }).then((res) => {
@@ -1334,17 +1226,23 @@
_this.otherProducts = res.data.randoms;
});
},
-
+ checkIsDefOrNot(id){
+ if (id.length>10) {
+ this.isDefaultApp=false
+ }else {
+ this.isDefaultApp=true
+ }
+ },
backwards(){
if (this.backStack.length ==0) {
this.backDisable = true
- // forwardDisable:false,
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) {
@@ -1369,7 +1267,6 @@
}
},
-
//绂荤嚎瀹夎
offlineInstall() {
this.installDialogVisible = false;
@@ -1415,6 +1312,11 @@
installApp({ path: app.id })
.then((res) => {
if (res && res.success) {
+ _this.$notify({
+ title: "鎴愬姛",
+ message: "瀹夎搴旂敤鎴愬姛",
+ type: "success",
+ });
setTimeout(() => {
if (action == "upgrade") {
app.upgradeLoading = false;
@@ -1496,6 +1398,11 @@
},
"*"
);
+ _this.$notify({
+ title: "鎴愬姛",
+ message: "鍗歌浇搴旂敤鎴愬姛",
+ type: "success",
+ });
}
})
.catch((e) => {
@@ -1507,19 +1414,11 @@
console.log(e);
});
},
- // actSdk (id) {
- // this.actSdkId = id;
- // this.actDrawerShow = true;
- // this.actStep = 0;
- // this.activeCode = '';
- // this.activedSdkOrApp = this.newActInfo()
- // },
+
actSdkOrApp(item, type = "sdk") {
this.checkDetail(item, 'inactive')
this.actType = type;
- // debugger
this.actId = item.id;
- // this.actDrawerShow = true;
this.actStep = 0;
this.activeCode = "";
this.activedSdkOrApp = this.newActInfo();
@@ -1527,6 +1426,7 @@
cancelActivate(){
this.showInputCode= false
+ this.activeCode = ""
},
newActInfo() {
return {
@@ -1554,51 +1454,56 @@
},
actived() {
let _this = this;
+ if (this.activeCode.trim()=="") {
+ this.$notify({
+ type: "error",
+ message: "婵�娲荤爜涓嶈兘涓虹┖",
+ });
+ return
+ }
+ if (this.actType == "sdk") {
+ //婵�娲荤畻娉�
+ actPageAlg(this.actId, this.activeCode)
+ .then((res) => {
+ if (res.data.isSuccess) {
+ this.productDetailVisible = false
+ _this.activedSdkOrApp = res.data.successMsg;
this.showActivateSuccess=true
-
- // if (this.actType == "sdk") {
- // //婵�娲荤畻娉�
- // actPageAlg(this.actId, this.activeCode)
- // .then((res) => {
- // if (res.data.isSuccess) {
- // this.productDetailVisible = false
- // _this.activedSdkOrApp = res.data.successMsg;
- // this.showActivateSuccess=true
- // _this.actStep++;
- // _this.getUnActivedList();
- // _this.getAllSdk();
- // } else {
- // _this.$notify({
- // type: "error",
- // message: res.data.failMsg.failMsg,
- // });
- // }
- // })
- // .catch((e) => {
- // console.log(e);
- // });
- // } else if (this.actType == "app") {
- // //婵�娲诲簲鐢�
- // actApp(this.actId, this.activeCode)
- // .then((res) => {
- // if (res.data.isSuccess) {
- // this.productDetailVisible = false
- // _this.activedSdkOrApp = res.data.successMsg;
- // this.showActivateSuccess=true
- // _this.actStep++;
- // _this.getUnActivedAppList();
- // _this.getAllApps();
- // } else {
- // _this.$notify({
- // type: "error",
- // message: res.data.failMsg.failMsg,
- // });
- // }
- // })
- // .catch((e) => {
- // console.log(e);
- // });
- // }
+ _this.actStep++;
+ _this.getUnActivedList();
+ _this.getAllSdk();
+ } else {
+ _this.$notify({
+ type: "error",
+ message: res.data.failMsg.failMsg,
+ });
+ }
+ })
+ .catch((e) => {
+ console.log(e);
+ });
+ } else if (this.actType == "app") {
+ //婵�娲诲簲鐢�
+ actApp(this.actId, this.activeCode)
+ .then((res) => {
+ if (res.data.isSuccess) {
+ this.productDetailVisible = false
+ _this.activedSdkOrApp = res.data.successMsg;
+ this.showActivateSuccess=true
+ _this.actStep++;
+ _this.getUnActivedAppList();
+ _this.getAllApps();
+ } else {
+ _this.$notify({
+ type: "error",
+ message: res.data.failMsg.failMsg,
+ });
+ }
+ })
+ .catch((e) => {
+ console.log(e);
+ });
+ }
},
getCodeDetail() {},
checkMyAlgorith() {
@@ -1643,7 +1548,7 @@
});
},
openApp(){
- let message = 'toOpenApp?'+this.productDetail.productBaseId;
+ let message = 'toOpenApp?' + this.productDetail.productBaseId;
window.parent.postMessage({
msg: message
}, "*")
@@ -1708,6 +1613,11 @@
.then((res) => {
if (res && res.success) {
sdk.unloadLoading = false;
+ this.$notify({
+ title: "鎴愬姛",
+ message: "鍗歌浇瀹屾垚",
+ type: "success",
+ });
_this.getAllSdk();
window.parent.postMessage(
{
@@ -1759,14 +1669,14 @@
this.appUpgreading = true;
}else{
downloadSdk({path:this.productDetail.productBaseId}).then((res)=>{
+ this.needToUpgradeInWin=false
+ this.productDetail.isUpgrade = false
+ this.isUpgrading = !this.isUpgrading;
this.$notify({
title: "鎴愬姛",
message: "鍗囩骇瀹屾垚",
type: "success",
});
- this.needToUpgradeInWin=false
- this.productDetail.isUpgrade = false
- this.isUpgrading = !this.isUpgrading;
}).catch((err)=>{
this.$notify({
title: "鍗囩骇澶辫触",
@@ -1781,21 +1691,43 @@
},
-
- donwload(item) {
+ downloadSdkInSide(){
+ this.downloadItem = this.productDetail.productBaseId;
+ this.isUpgrading = true
+ downloadSdk({ path: this.productDetail.productBaseId })
+ .then((rsp) => {
+ this.productDetailVisible = false
+ this.downloadItem = "";
+ this.$notify({
+ type: "success",
+ message: "绠楁硶宸插畨瑁�"
+ });
+ this.isUpgrading=false
+ })
+ .catch((err) => {
+ this.$notify({
+ type: "warning",
+ message: err.data,
+ });
+ this.downloadItem = "";
+ this.isUpgrading=false
+ });
+ // 寮�鍚嚜鍔ㄥ埛鏂�
+ this.sdkUpgreading = true;
+ },
+ donwload(item,typ) {
item.upgradeLoading = true;
- //this.downloading = true;
this.downloadItem = item.id;
downloadSdk({ path: item.id })
.then((rsp) => {
- // this.$notify({
- // type: "success",
- // message: "绠楁硶宸插畨瑁�"
- // });
item.upgradeLoading = false;
//this.downloading = false;
this.downloadItem = "";
+ this.$notify({
+ type: "success",
+ message: typ==1? "绠楁硶瀹夎鎴愬姛":"绠楁硶鍗囩骇鎴愬姛"
+ });
})
.catch((err) => {
this.$notify({
@@ -1810,7 +1742,6 @@
this.sdkUpgreading = true;
},
inputBlur(item) {
- // console.log(item, '淇敼鍚嶇О')
this.$set(item, "isEdit", false);
},
handleTabClick() {},
@@ -1909,8 +1840,6 @@
}
button{
- // margin-right: 6px;
- // background-color: #ecf5ff;
font-size: 18px;
line-height: 12px;
}
@@ -1937,15 +1866,10 @@
width: 443px;
height: 277px;
- // background: aquamarine;
}
img{
max-width: 90%;
-
margin-top: 28px;
-
-
-
}
}
}
@@ -1953,7 +1877,6 @@
float: left;
width: 43%;
margin: 0 0.5%;
- // background-color: lightgoldenrodyellow;
height: 330px;
background-color: rgba(253, 253, 253, 1);
position: relative;
@@ -2003,8 +1926,9 @@
margin-bottom: 10px;
.el-input{
float: left;
- width: 64%;
- margin-bottom: 8px;
+ width: 63%;
+ margin-bottom: 8px;
+ margin-right: 10px;
}
el-button{
float: left;
@@ -2020,18 +1944,16 @@
font-size: 16px;
margin-left: 24px;
- // height: 30px;
border-bottom: 3px solid #3d68e1;
width: fit-content;
- // margin-bottom: 8px;
height: 26px;
margin-bottom: 8px;
}
.text {
- height: 156px;
- overflow: auto;
- padding: 0 15px 0px 15px;
+ height: 156px;
+ overflow: auto;
+ padding: 0 15px 0px 15px;
.single-desc {
@@ -2055,13 +1977,11 @@
margin: 0 0.5%;
border-radius: 2px;
float: left;
- // background-color: lightblue;
.part-title {
display: block;
line-height: 35px;
font-size: 16px;
margin-left: 24px;
- // height: 30px;
border-bottom: 3px solid #3d68e1;
width: fit-content;
margin-bottom: 10px;
@@ -2078,6 +1998,8 @@
background-color: rgba(242, 242, 242, 1.3);
margin: 5px 12px 0 12px;
font-size: 12px;
+ line-height: 18px;
+
}
margin-bottom: 12px;
}
@@ -2088,7 +2010,6 @@
float: left;
background-color: rgba(253, 253, 253, 1);
width: 49%;
- // background-color: lightgoldenrodyellow;
margin: 0 0.5%;
border-radius: 2px;
@@ -2097,7 +2018,6 @@
line-height: 35px;
font-size: 16px;
margin-left: 24px;
- // height: 30px;
border-bottom: 3px solid #3d68e1;
width: fit-content;
margin-bottom: 5px;
@@ -2113,7 +2033,6 @@
height: 165px;
width: 130px;
float: left;
- // text-align: center;
border-radius: 10px;
box-shadow: 0px 5px 14px rgba(0, 0, 0, 0.0666666666666667);
position: relative;
@@ -2123,21 +2042,13 @@
margin: 8px;
}
.icon {
- // width: 100%;
- // height: 68px;
- // width: 68px;
- // position: absolute;
- // margin: 0 auto;
margin: 0 auto;
- // top: 21%;
- // left: 26%;
img {
- // display: block;
max-width: 60px;
max-height: 60px;
position: absolute;
- top: 20%;
- left: 26%;
+ top: 20%;
+ left: 26%;
}
.icon-name {
text-align: center;
--
Gitblit v1.8.0