From 0961ee5718e67c942937647cf4ee471e236e4edc Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期三, 03 三月 2021 19:04:28 +0800
Subject: [PATCH] 应用中心和更新的逻辑
---
src/pages/ai/index/App.vue | 418 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 318 insertions(+), 100 deletions(-)
diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 10345bb..bea2aa0 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -97,7 +97,7 @@
</div>
<div
class="info-onmask"
- @click="checkDetail(item)"
+ @click="checkDetail(item, 'active')"
>
鏌ョ湅璇︽儏
</div>
@@ -115,7 +115,7 @@
type="warning"
size="small"
class="bot-btn"
- >鍗囩骇</el-button
+ >鍗囩骇1</el-button
>
</div>
</div>
@@ -234,7 +234,8 @@
</div>
<div
class="info-onmask"
- @click="checkDetail(item)"
+ @click="checkDetail(item,'active')"
+ v-if="!item.isDefault"
>
鏌ョ湅璇︽儏
</div>
@@ -253,7 +254,7 @@
type="warning"
size="small"
class="bot-btn"
- >鍗囩骇</el-button
+ >鍗囩骇2</el-button
>
</div>
</div>
@@ -376,7 +377,7 @@
<div class="list-choose-item-left">
<div class="list-complete-item-handle">
<div class="alg-icon svg-wrap">
- <div class="mask" @click="actSdkOrApp(item.id)">
+ <!-- <div class="mask" @click="actSdkOrApp(item.id)">
<span
class="iconfont iconyunxiazai"
style="
@@ -387,6 +388,33 @@
left: 45%;
"
></span>
+ </div> -->
+ <div
+ class="mask"
+ v-if="!item.isDefault || item.isUpgrade"
+ >
+ <div class="left-top">
+ <div>褰撳墠鐗堟湰:{{ item.version }}</div>
+ <div v-if="item.remoteVersion">
+ 鏈�鏂扮増鏈�:{{ item.remoteVersion }}
+ </div>
+ </div>
+ <div
+ class="info-onmask"
+ @click="actSdkOrApp(item)"
+ >
+ 鏌ョ湅璇︽儏
+ </div>
+ <div class="mask-btn">
+ <el-button
+ @click="actSdkOrApp(item)"
+ type="primary"
+ size="small"
+ class="bot-btn"
+ >婵�娲�</el-button
+ >
+
+ </div>
</div>
<img
v-if="item.iconBlob"
@@ -429,9 +457,9 @@
<div class="list-choose-item-left">
<div class="list-complete-item-handle">
<div class="alg-icon svg-wrap">
- <div
+ <!-- <div
class="mask"
- @click="actSdkOrApp(item.id, 'app')"
+ @click="actSdkOrApp(item, 'app')"
>
<span
class="iconfont iconyunxiazai"
@@ -443,6 +471,33 @@
left: 45%;
"
></span>
+ </div> -->
+ <div
+ class="mask"
+ v-if="!item.isDefault || item.isUpgrade"
+ >
+ <div class="left-top">
+ <div>褰撳墠鐗堟湰:{{ item.version }}</div>
+ <div v-if="item.remoteVersion">
+ 鏈�鏂扮増鏈�:{{ item.remoteVersion }}
+ </div>
+ </div>
+ <div
+ class="info-onmask"
+ @click="actSdkOrApp(item,'app')"
+ >
+ 鏌ョ湅璇︽儏
+ </div>
+ <div class="mask-btn">
+ <el-button
+ @click="actSdkOrApp(item,'app')"
+ type="primary"
+ size="small"
+ class="bot-btn"
+ >婵�娲�</el-button
+ >
+
+ </div>
</div>
<img
v-if="item.iconBlob"
@@ -593,7 +648,7 @@
</div>
<div
class="info-onmask"
- @click="checkDetail(item)"
+ @click="checkDetail(item,'active')"
>
鏌ョ湅璇︽儏
</div>
@@ -611,7 +666,7 @@
type="warning"
size="small"
class="bot-btn"
- >鍗囩骇</el-button
+ >鍗囩骇3</el-button
>
</div>
</div>
@@ -680,7 +735,7 @@
</div>
<div
class="info-onmask"
- @click="checkDetail(item)"
+ @click="checkDetail(item,'active')"
>
鏌ョ湅璇︽儏
</div>
@@ -699,7 +754,7 @@
type="warning"
size="small"
class="bot-btn"
- >鍗囩骇</el-button
+ >鍗囩骇4</el-button
>
</div>
</div>
@@ -800,7 +855,7 @@
</div>
<!-- </el-button-group> -->
- <div class="dialog-title" slot="title">{{curCheckTarget.sdk_type===undefined?"搴旂敤璇︽儏":"绠楁硶璇︽儏"}}</div>
+ <div class="dialog-title" slot="title">{{isSDKDialog?"绠楁硶璇︽儏":"搴旂敤璇︽儏"}}</div>
<div class="dialog-content">
<div class="box-top">
<div class="top-left">
@@ -877,16 +932,29 @@
>杞欢</span> -->
</div>
<div class="btns">
- <el-button size="medium" type="warning" @click="upgrade">{{
+ <el-button size="medium" type="warning" v-if="needToUpgradeInWin" @click="upgradeSDKinWin" >{{
isUpgrading ? "鍗囩骇涓�.." : "鍗囩骇"
}}</el-button>
- <el-button size="medium" type="primary" @click="unload"
- >鍗歌浇</el-button
- >
- <el-button size="medium" type="success">鎵撳紑</el-button>
+ <el-button size="medium" type="primary" v-if="isActive" @click="unloadSDKinWin">鍗歌浇</el-button>
+ <el-button size="medium" type="primary" v-if="!isActive" @click="showInputCode=!showInputCode">涓嬭浇婵�娲�</el-button>
+ <el-button size="medium" type="success" v-if="!isSDKDialog">鎵撳紑</el-button>
</div>
+
</div>
</div>
+ <div class="jihuo-input" v-if="showInputCode">
+ <el-input size="small"
+ v-model="activeCode"
+ placeholder="00000-00000-00000-00000-00000"
+ @blur="getCodeDetail"
+ ></el-input>
+ <el-button type="primary" size="small" @click="actived"
+ >婵�娲�</el-button
+ >
+ <el-button type="primary" size="small" @click="cancelActivate"
+ >鍙栨秷</el-button
+ >
+ </div>
<div class="product-intruduction">
<div class="part-title">绠�浠�</div>
<div class="text">
@@ -905,7 +973,7 @@
<div>
{{
productDetail.description === ""
- ? "鏆傛棤鏁版嵁"
+ ? "鏆傛棤鏁版嵁 绱㈤噰鐢ㄥぇ鏁版嵁鏋舵瀯锛屽垎甯冩绱㈡绉掔骇杩斿洖"
: productDetail.description
}}
</div>
@@ -915,7 +983,7 @@
<div>
{{
productDetail.summary === ""
- ? "鏆傛棤鏁版嵁"
+ ? "鏆傛棤鏁版嵁 鍙敮鎸佹捣閲忔暟鎹鏉傛绱㈡绉掔骇杩斿洖锛岃璁℃湁鏅鸿兘妫�绱㈡鍙敮鎸佹捣閲忔暟鎹鏉傛绱㈡妫�绱㈡绉掔骇杩斿洖锛岃璁℃湁鏅鸿兘妫�绱㈡鍙敮鎸佹捣閲忔暟鎹鏉傛绱㈡绉掔骇杩斿洖锛岃璁℃湁鏅�"
: productDetail.summary
}}
</div>
@@ -980,6 +1048,43 @@
</div>
</div>
</div>
+ </div>
+ </div>
+ </el-dialog>
+ <el-dialog
+ title="婵�娲绘垚鍔燂紒"
+ :visible.sync="showActivateSuccess"
+ width="30%"
+ :before-close="handleClose"
+ >
+ <div class="dialog-active">
+ <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>
+ </ul>
+ <div class="text-right">
+ <el-button type="primary" @click="checkMyAlgorith"
+ >纭畾</el-button
+ >
+ <p class="tip">鎻愮ず锛氳鍦ㄢ�滄垜鐨勭畻娉曗�濅腑鏌ョ湅骞跺畨瑁呯畻娉�</p>
</div>
</div>
</el-dialog>
@@ -1062,15 +1167,19 @@
direction: "rtl",
actDrawerShow: false,
actStep: 0,
+ showActivateSuccess:false,
activeCode: "",
isInstall: false,
installDialogVisible: false,
installPackage: {},
installAppPackage: null,
installSdkPackage: null,
+ isActive:true,
installPercentage: 0,
unActivedSDKList: [],
unActivedAppList: [],
+ // dialogTitle: "",
+ isSDKDialog:true,
//actSdkId: '',
actType: "",
actId: "",
@@ -1100,6 +1209,8 @@
forwardStack: [],
backDisable:true,
forwardDisable:true,
+ showInputCode:false,
+ needToUpgradeInWin:false,
};
},
directives: {
@@ -1141,9 +1252,22 @@
this.productDetail = {}
this.otherProducts = []
},
- checkDetail(item) {
+ checkDetail(item,type) {
+ if (type =='inactive') {
+ this.isActive =false
+ this.showInputCode = false
+ }else{
+ this.showInputCode = false
+ this.isActive =true
+ }
+ this.needToUpgradeInWin = item.isUpgrade?true:false
this.resetStack()
this.curCheckTarget = item;
+ if (item.sdk_type===undefined) {
+ this.isSDKDialog=false
+ }else{
+ this.isSDKDialog=true
+ }
// debugger
this.productDetailVisible = true;
let _this = this;
@@ -1162,16 +1286,28 @@
},
checkInWindow(item){
this.backStack.push(this.productDetail)
- console.log(this.backStack);
+ // debugger
this.backDisable = false
this.curCheckTarget = item;
// this.productDetailVisible = true;
let _this = this;
getAppDetail({ id: item.id }).then((res) => {
_this.productDetail = res.data.detail;
+ // debugger
+ this.actId = _this.productDetail.productBaseId
+ let flag=false
+ const allNeedToNew = [...this.hasNewVersionSdk,...hasNewVersionApp]
+ for (let i = 0; i < allNeedToNew.length; i++) {
+ const item = allNeedToNew[i];
+ if (item.id == _this.productDetail.productBaseId) {
+ flag=true
+ }
+ }
+ this.needToUpgradeInWin = true
_this.otherProducts = res.data.randoms;
});
},
+
backwards(){
if (this.backStack.length ==0) {
this.backDisable = true
@@ -1180,7 +1316,6 @@
}
console.log(this.backStack);
- // debugger
this.forwardStack.push(this.productDetail)
this.productDetail = this.backStack.pop()
this.forwardDisable=false
@@ -1194,7 +1329,6 @@
this.forwardDisable=true
return
}
- // debugger
console.log(this.backStack);
this.backStack.push(this.productDetail)
@@ -1239,17 +1373,7 @@
});
});
},
- upgrade() {
- this.isUpgrading = !this.isUpgrading;
- setTimeout(() => {
- this.$notify({
- title: "鎴愬姛",
- message: "鍗囩骇瀹屾垚",
- type: "success",
- });
- this.isUpgrading = !this.isUpgrading;
- }, 1200);
- },
+
downloadApp(app, action) {
if (action == "upgrade") {
app.upgradeLoading = true;
@@ -1324,34 +1448,7 @@
this.storeApps = sArry;
this.hasNewVersionApp = nArry;
},
- //鍗歌浇绠楁硶
- unLoadSdk(sdk) {
- let _this = this;
- this.$confirm("纭畾瑕佸嵏杞借绠楁硶鍚�?", "鎻愮ず")
- .then(() => {
- sdk.unloadLoading = true;
- removeSdk({ sdkId: sdk.id })
- .then((res) => {
- if (res && res.success) {
- sdk.unloadLoading = false;
- _this.getAllSdk();
- window.parent.postMessage(
- {
- msg: "AppUpdate",
- },
- "*"
- );
- }
- })
- .catch((e) => {
- console.log(e);
- sdk.unloadLoading = false;
- });
- })
- .catch((e) => {
- console.log(e);
- });
- },
+
//鍗歌浇搴旂敤
unLoad(app) {
let _this = this;
@@ -1387,13 +1484,19 @@
// this.activeCode = '';
// this.activedSdkOrApp = this.newActInfo()
// },
- actSdkOrApp(id, type = "sdk") {
+ actSdkOrApp(item, type = "sdk") {
+ this.checkDetail(item, 'inactive')
this.actType = type;
- this.actId = id;
- this.actDrawerShow = true;
+ // debugger
+ this.actId = item.id;
+ // this.actDrawerShow = true;
this.actStep = 0;
this.activeCode = "";
this.activedSdkOrApp = this.newActInfo();
+ },
+
+ cancelActivate(){
+ this.showInputCode= false
},
newActInfo() {
return {
@@ -1426,7 +1529,9 @@
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();
@@ -1445,7 +1550,9 @@
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();
@@ -1463,7 +1570,7 @@
},
getCodeDetail() {},
checkMyAlgorith() {
- this.actDrawerShow = false;
+ this.showActivateSuccess = false;
this.activeName = "myAlgorithm";
},
onFileUpload(file) {
@@ -1503,25 +1610,7 @@
});
});
},
- unload() {
- this.$confirm("纭畾瑕佸嵏杞借绠楁硶涔堬紵", "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- this.$message({
- type: "success",
- message: "鍗歌浇鎴愬姛!",
- });
- })
- .catch(() => {
- // this.$message({
- // type: 'info',
- // message: '宸插彇娑堝嵏杞�'
- // });
- });
- },
+
onFileAdded(f) {
this.patchUpdateStatus = "";
@@ -1548,11 +1637,80 @@
//绠楁硶杞欢 宸插畨瑁呭叾涓寘鍚緟鍗囩骇 鏈畨瑁�
item.installed ? installedList.push(obj) : unInstalledList.push(obj);
+ item.isUpgrade ? hasNewVersionList.push(obj): null
});
}
this.installedList = installedList;
this.notInstalledList = unInstalledList;
this.hasNewVersionSdk = hasNewVersionList;
+ },
+ unloadSDKinWin(){
+ let _this = this;
+ this.$confirm("纭畾瑕佸嵏杞借绠楁硶涔堬紵", "鎻愮ず").then(()=>{
+ _this.productDetailVisible = false
+ removeSdk({sdkId:this.productDetail.productBaseId}).then((res)=>{
+ _this.getAllSdk();
+ window.parent.postMessage(
+ {
+ msg: "AppUpdate",
+ },
+ "*"
+ );
+ }).catch((err)=>{
+ console.log(err);
+ })
+ }).catch(()=>{
+
+ })
+ },
+ //鍗歌浇绠楁硶
+ unLoadSdk(sdk) {
+ let _this = this;
+ this.$confirm("纭畾瑕佸嵏杞借绠楁硶鍚�?", "鎻愮ず")
+ .then(() => {
+ sdk.unloadLoading = true;
+ removeSdk({ sdkId: sdk.id })
+ .then((res) => {
+ if (res && res.success) {
+ sdk.unloadLoading = false;
+ _this.getAllSdk();
+ window.parent.postMessage(
+ {
+ msg: "AppUpdate",
+ },
+ "*"
+ );
+ }
+ })
+ .catch((e) => {
+ console.log(e);
+ sdk.unloadLoading = false;
+ });
+ })
+ .catch((e) => {
+ console.log(e);
+ });
+ },
+ upgradeSDKinWin(){
+
+ this.isUpgrading = !this.isUpgrading;
+
+ downloadSdk({path:this.productDetail.productBaseId}).then((res)=>{
+ this.$notify({
+ title: "鎴愬姛",
+ message: "鍗囩骇瀹屾垚",
+ type: "success",
+ });
+ this.isUpgrading = !this.isUpgrading;
+ }).catch((err)=>{
+ this.$notify({
+ title: "鍗囩骇澶辫触",
+ message: err.data,
+ type: "warning",
+ });
+ this.isUpgrading = !this.isUpgrading;
+ })
+ this.sdkUpgreading = true;
},
donwload(item) {
@@ -1675,22 +1833,31 @@
.dialog-content {
.box-top {
- height: 380px;
+ height: 350px;
.top-left {
float: left;
width: 55%;
background-color: rgba(253, 253, 253, 1);
margin: 0 0.5%;
- height: 380px;
+ height: 350px;
.banner {
text-align: center;
- margin-top: 30px;
+ margin-top: 11px;
+
+ // margin-top: 15px;
video {
- margin: 20px auto;
+ margin: 0px auto;
+ margin-top: 25px;
+
width: 443px;
height: 277px;
// background: aquamarine;
+ }
+ img{
+ max-width: 500px;
+ margin-top: 21px;
+
}
}
}
@@ -1699,25 +1866,28 @@
width: 43%;
margin: 0 0.5%;
// background-color: lightgoldenrodyellow;
- height: 380px;
+ height: 350px;
background-color: rgba(253, 253, 253, 1);
position: relative;
+ overflow: hidden;
.summary {
height: 140px;
- margin: 5px;
+ margin: 5px 5px 0 5px;
+
.icon {
margin: 0 5px;
margin-top: 5px;
float: left;
.baseImg{
- max-width: 128px;
- max-height: 128px;
+ max-width: 120px;
+ max-height: 120px;
}
}
+
.right-desc {
float: left;
position: absolute;
- left: 150px;
+ left: 145px;
.name {
font-size: 30px;
// font-weight: bold;
@@ -1730,25 +1900,44 @@
}
}
}
+
}
+ .jihuo-input{
+ margin-left: 10px;
+ margin-bottom: 10px;
+ .el-input{
+ float: left;
+ width: 64%;
+ margin-right: 10px;
+ }
+ el-button{
+ float: left;
+ }
+ }
.product-intruduction {
- height: 230px;
+ height: 200px;
// background-color: lightgrey;
.part-title {
display: block;
- line-height: 35px;
+ line-height: 20px;
+
font-size: 16px;
margin-left: 24px;
// height: 30px;
border-bottom: 3px solid #3d68e1;
width: fit-content;
- margin-bottom: 8px;
- height: 35px;
+ // margin-bottom: 8px;
+ height: 26px;
+margin-bottom: 6px;
}
.text {
- padding: 10px 15px;
+ height: 156px;
+ overflow: auto;
+ padding: 0 15px 0px 15px;
+
+
.single-desc {
- margin-bottom: 10px;
+ margin-bottom: 10px;
}
}
}
@@ -2526,5 +2715,34 @@
}
}
}
+.dialog-active{
+ .desc {
+ padding: 0 30px;
+ margin-bottom: 30px;
+ li {
+ border-bottom: 1px solid #eee;
+ height: 45px;
+ line-height: 45px;
+ font-size: 14px;
+ &:last-child {
+ border-bottom: none;
+ }
+ label {
+ display: inline-block;
+ width: 90px;
+ padding-left: 14px;
+ font-weight: bold;
+ }
+ }
+ }
+ .text-right {
+ padding-right: 30px;
+ text-align: right;
+ .tip {
+ color: #999;
+ line-height: 38px;
+ }
+ }
+}
</style>
--
Gitblit v1.8.0