From bdfabf5a34092c02b5445ad50a0daafcbaa49721 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期三, 30 九月 2020 09:56:45 +0800
Subject: [PATCH] 应用中心商城应用激活
---
src/pages/ai/index/App.vue | 294 +++++++++++++++++++++++++++++++-----------------
src/components/cardWindow.vue | 1
src/api/app.ts | 16 ++
3 files changed, 205 insertions(+), 106 deletions(-)
diff --git a/src/api/app.ts b/src/api/app.ts
index 06b3328..750a2ae 100644
--- a/src/api/app.ts
+++ b/src/api/app.ts
@@ -9,7 +9,7 @@
});
};
-//鑾峰彇搴旂敤涓績鍟嗗煄寰呮縺娲诲垪琛�
+//鑾峰彇搴旂敤涓績鍟嗗煄寰呮縺娲荤畻娉曞垪琛�
export const getUnActivedSdk = () => {
return request({
url: "/data/api-v/sdk/buyList",
@@ -25,7 +25,7 @@
})
}
-//鑾峰彇鍟嗗煄鎵�鏈夊簲鐢�
+//鑾峰彇鍟嗗煄鎵�鏈夊簲鐢�(宸叉縺娲�)
export const findAllApp = () => request({
url: '/data/api-v/app/findAllApp',
method: 'get'
@@ -42,4 +42,14 @@
url: '/data/api-v/app/unInstall',
method: 'post',
data
-})
\ No newline at end of file
+});
+//鑾峰彇鍟嗗煄寰呮縺娲荤殑搴旂敤
+export const getUnActivedApp = ()=> request({
+ url:'/data/api-v/app/buyList',
+ method: 'get'
+});
+//婵�娲诲晢鍩庡簲鐢�
+export const actApp = (appId:String,code:String) => request({
+ url:`/data/api-v/app/active?appId=${appId}&code=${code}`,
+ method:'get'
+});
diff --git a/src/components/cardWindow.vue b/src/components/cardWindow.vue
index 8bf56be..a9c557e 100644
--- a/src/components/cardWindow.vue
+++ b/src/components/cardWindow.vue
@@ -18,6 +18,7 @@
:maxHeight="7000"
:height="defaultHeight"
:width="defaultWidth"
+
>
<div v-if="item.list.length == 1" style="height: calc(100% - 50px)">
<model-card :data="item.list[0]"></model-card>
diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue
index 4256a6c..9982bf5 100644
--- a/src/pages/ai/index/App.vue
+++ b/src/pages/ai/index/App.vue
@@ -51,13 +51,13 @@
</div>
<div class="wrap-box" v-for="(item) in installedList" :key="item.id">
<div class="list-choose-item-left">
- <div class="list-complete-item-handle">
+ <div class="list-complete-item-handle">
<div class="svg-wrap">
<div class="mask flex-center" v-if="!item.isEdit">
<div class="info-onmask">
<div>褰撳墠鐗堟湰:{{item.version}}</div>
</div>
- </div>
+ </div>
<img
class="baseImg"
:src="`data:image/png;base64,${item.iconBlob}`"
@@ -113,41 +113,59 @@
<p class="src-title">搴旂敤杞欢</p>
<div class="flex-list">
<div class="wrap-box" v-for="(item) in installedApps" :key="item.id">
- <div class="list-choose-item-left">
- <div class="list-complete-item-handle">
- <div class="svg-wrap" v-loading="item.unloadLoading" element-loading-text="鍗歌浇涓�" element-loading-background="rgba(0,0,0,.8)">
- <div class="mask" v-if="!item.isDefault">
- <el-button
- v-if="!item.isDefault"
- @click="unLoad(item)"
- type="primary"
- class="bot-btn"
- >鍗歌浇</el-button>
- </div>
- <img class="baseImg" :src="`${item.iconBlob?'data:image/png;base64,'+item.iconBlob:item.icon}`" alt />
+ <div class="list-choose-item-left">
+ <div class="list-complete-item-handle">
+ <div
+ class="svg-wrap"
+ v-loading="item.unloadLoading"
+ element-loading-text="鍗歌浇涓�"
+ element-loading-background="rgba(0,0,0,.8)"
+ >
+ <div class="mask" v-if="!item.isDefault">
+ <el-button
+ v-if="!item.isDefault"
+ @click="unLoad(item)"
+ type="primary"
+ class="bot-btn"
+ >鍗歌浇</el-button>
</div>
- <div class="alg-name">
- <div style="padding:0px 10px 0px 10px;">
- <span v-if="!item.isEdit">{{ item.name }}</span>
- <el-input
- size="small"
- v-model="item.sdk_name"
- v-if="item.isEdit"
- v-focus
- :maxlength="15"
- @blur="inputBlur(item)"
- ></el-input>
- </div>
+ <img
+ class="baseImg"
+ :src="`${item.iconBlob?'data:image/png;base64,'+item.iconBlob:item.icon}`"
+ alt
+ />
+ </div>
+ <div class="alg-name">
+ <div style="padding:0px 10px 0px 10px;">
+ <span v-if="!item.isEdit">{{ item.name }}</span>
+ <el-input
+ size="small"
+ v-model="item.sdk_name"
+ v-if="item.isEdit"
+ v-focus
+ :maxlength="15"
+ @blur="inputBlur(item)"
+ ></el-input>
</div>
</div>
</div>
+ </div>
</div>
<div class="wrap-box" v-for="item in storeApps" :key="item.id">
- <div class="list-choose-item-left ">
+ <div class="list-choose-item-left">
<div class="list-complete-item-handle uninstall">
- <div class="svg-wrap" v-loading="item.installLoading" element-loading-text="瀹夎涓�" element-loading-background="rgba(0,0,0,.8)">
+ <div
+ class="svg-wrap"
+ v-loading="item.installLoading"
+ element-loading-text="瀹夎涓�"
+ element-loading-background="rgba(0,0,0,.8)"
+ >
<div class="mask">
- <el-button type="primary" class="bot-btn" @click="downloadApp(item)">瀹夎</el-button>
+ <el-button
+ type="primary"
+ class="bot-btn"
+ @click="downloadApp(item)"
+ >瀹夎</el-button>
</div>
<img
class="baseImg"
@@ -202,7 +220,7 @@
<div class="list-choose-item-left">
<div class="list-complete-item-handle">
<div class="alg-icon svg-wrap">
- <div class="mask" @click="actSdk(item.id)">
+ <div class="mask" @click="actSdkOrApp(item.id)">
<span
class="iconfont iconyunxiazai"
style="color:#ff6a00;font-size:20px;position:absolute;top:45%;left:45%"
@@ -233,9 +251,39 @@
</div>
<p class="src-title">搴旂敤杞欢</p>
<div class="app-list flex-list">
-
+ <div class="wrap-box" v-for="item in unActivedAppList" :key="item.id">
+ <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,'app')">
+ <span
+ class="iconfont iconyunxiazai"
+ style="color:#ff6a00;font-size:20px;position:absolute;top:45%;left:45%"
+ ></span>
+ </div>
+ <img
+ class="baseImg"
+ :src="item.iconBlob.indexOf(',')>0? item.iconBlob:`data:image/png;base64,${item.iconBlob}`"
+ alt
+ />
+ </div>
+ <div class="alg-name">
+ <div style="padding:0px 10px 0px 10px;">
+ <span v-if="!item.isEdit">{{ item.sdk_name }}</span>
+ <el-input
+ size="small"
+ v-model="item.sdk_name"
+ v-if="item.isEdit"
+ v-focus
+ :maxlength="15"
+ @blur="inputBlur(item)"
+ ></el-input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
-
</div>
<el-drawer title="涓嬭浇" :visible.sync="actDrawerShow" :direction="direction">
<div class="drawer-content">
@@ -263,23 +311,23 @@
<ul class="desc">
<li>
<label>婵�娲荤爜:</label>
- <span>{{activedSdk.activateCode}}</span>
+ <span>{{activedSdkOrApp.activateCode}}</span>
</li>
<li>
<label>浜у搧鍚嶇О:</label>
- <span>{{activedSdk.productName}}</span>
+ <span>{{activedSdkOrApp.productName}}</span>
</li>
<li>
<label>閰嶇疆璇︽儏:</label>
- <span>{{activedSdk.setting}}</span>
+ <span>{{activedSdkOrApp.setting}}</span>
</li>
<li>
<label>鏈嶅姟鍒版湡鏃�:</label>
- <span>{{activedSdk.expireTime}}</span>
+ <span>{{activedSdkOrApp.expireTime}}</span>
</li>
<li>
<label>璁稿彲璇�:</label>
- <span>{{activedSdk.licence}}</span>
+ <span>{{activedSdkOrApp.licence}}</span>
</li>
<!-- <li>
<label>璁惧ID:</label>
@@ -321,8 +369,8 @@
downloadSdk,
installSdk
} from "./api";
-import { getApps,installApp,removeApp } from "@/api/app";
-import { getUnActivedSdk, actPageAlg } from "@/api/app";
+import { getApps, installApp, removeApp, getUnActivedSdk, actPageAlg, getUnActivedApp, actApp } from "@/api/app";
+
import FileUploader from "@/components/subComponents/FileUpload/index";
import TaskManage from "@/Pool/TaskMange";
import VideoManageData from "@/Pool/VideoManageData";
@@ -420,8 +468,11 @@
isInstall: false,
installPercentage: 0,
unActivedSDKList: [],
- actSdkId: '',
- activedSdk: {
+ unActivedAppList: [],
+ //actSdkId: '',
+ actType: '',
+ actId: '',
+ activedSdkOrApp: {
activateCode: '',
productName: '',
setting: '',
@@ -431,8 +482,8 @@
},
// unloadLoading: false,
// installLoading: false,
- installedApps:[],
- storeApps:[]
+ installedApps: [],
+ storeApps: []
}
},
watch: {
@@ -466,73 +517,82 @@
this.findAll();
this.getUser();
this.getUnActivedList();
+ this.getUnActivedAppList();
// this.TaskMange.findAllSdk();
// this.TaskMange.findByType();
this.VideoManageData.init();
},
methods: {
- downloadApp(app){
+ downloadApp (app) {
app.installLoading = true;
let _this = this;
- installApp(app).then(res=>{
- if(res && res.success){
- setTimeout(()=>{
+ installApp(app).then(res => {
+ if (res && res.success) {
+ setTimeout(() => {
app.installLoading = false;
_this.getAllApps();
window.parent.postMessage({
msg: "AppUpdate"
}, '*')
- },3000);
+ }, 3000);
}
})
},
- getAllApps(){
+ getAllApps () {
let _this = this;
_this.installedApps = [];
_this.storeApps = [];
- getApps().then(res=>{
- if(res && res.success){
+ getApps().then(res => {
+ if (res && res.success) {
//_this.storeApps = res.data;
- res.data.forEach(item=>{
- if(item.installed){
- let obj = Object.assign({unloadLoading:false},item)
+ res.data.forEach(item => {
+ if (item.installed) {
+ let obj = Object.assign({ unloadLoading: false }, item)
_this.installedApps.push(obj)
- }else{
- let obj = Object.assign({installLoading:false},item)
+ } else {
+ let obj = Object.assign({ installLoading: false }, item)
_this.storeApps.push(obj)
}
});
- console.log('_this.installedApps',_this.installedApps);
- console.log('_this.storeApps',_this.storeApps);
+ console.log('_this.installedApps', _this.installedApps);
+ console.log('_this.storeApps', _this.storeApps);
}
})
},
//鍗歌浇搴旂敤
- unLoad(app){
+ unLoad (app) {
app.unloadLoading = true;
let _this = this;
- removeApp({appId:app.id}).then(res=>{
-
- if(res && res.success){
- setTimeout(()=>{
+ removeApp({ appId: app.id }).then(res => {
+
+ if (res && res.success) {
+ setTimeout(() => {
app.unloadLoading = false;
_this.getAllApps();
window.parent.postMessage({
msg: "AppUpdate"
}, '*')
- },3000);
+ }, 3000);
}
})
},
- actSdk (id) {
- this.actSdkId = id;
+ // actSdk (id) {
+ // this.actSdkId = id;
+ // this.actDrawerShow = true;
+ // this.actStep = 0;
+ // this.activeCode = '';
+ // this.activedSdkOrApp = this.newActInfo()
+ // },
+ actSdkOrApp (id, type = 'sdk') {
+ this.actType = type;
+ this.actId = id;
this.actDrawerShow = true;
this.actStep = 0;
this.activeCode = '';
- this.activedSdk = this.newActInfo()
+ this.activedSdkOrApp = this.newActInfo()
},
- newActInfo(){
+ newActInfo () {
return {
activateCode: '',
productName: '',
@@ -550,26 +610,54 @@
})
},
+ getUnActivedAppList () {
+ getUnActivedApp().then(res => {
+ if (res.code == 200) {
+ this.unActivedAppList = res.data;
+ }
+ });
+ },
+
installFormat (percentage) {
return percentage === 100 ? '瀹夎鎴愬姛' : `${percentage}%`;
},
actived () {
let _this = this;
- actPageAlg(this.actSdkId, this.activeCode).then(res => {
- if (res.data.isSuccess) {
- _this.activedSdk = res.data.successMsg;
- _this.actStep++;
- _this.getUnActivedList();
- _this.findAllSdk();
- }else{
- _this.$notify({
- type:'error',
- message:res.data.failMsg.failMsg
- });
- }
- }).catch(e => {
- console.log(e)
- })
+ if (this.actType == 'sdk') {
+ //婵�娲荤畻娉�
+ actPageAlg(this.actId, this.activeCode).then(res => {
+ if (res.data.isSuccess) {
+ _this.activedSdkOrApp = res.data.successMsg;
+ _this.actStep++;
+ _this.getUnActivedList();
+ _this.findAllSdk();
+ } 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.activedSdkOrApp = res.data.successMsg;
+ _this.actStep++;
+ _this.getUnActivedAppList();
+ _this.getAllApps();
+ } else {
+ _this.$notify({
+ type: 'error',
+ message: res.data.failMsg.failMsg
+ });
+ }
+ }).catch(e => {
+ console.log(e)
+ });
+ }
},
getCodeDetail () { },
checkMyAlgorith () {
@@ -627,7 +715,7 @@
//瀹夎
installSdk(file).then(res => {
if (res.success) {
-
+
this.isInstall = false;
//this.$refs['progressBar'].style.width = 100%
//this.installPercentage = 100%
@@ -1341,23 +1429,23 @@
color: #606266;
cursor: pointer;
}
-.el-loading-mask .el-loading-spinner{
- top: 40px!important;
+.el-loading-mask .el-loading-spinner {
+ top: 40px !important;
}
-.el-loading-mask .el-loading-spinner svg{
- transform: none!important;
- top: 20px!important;
- left: 40%!important;
+.el-loading-mask .el-loading-spinner svg {
+ transform: none !important;
+ top: 20px !important;
+ left: 40% !important;
}
-.el-loading-mask .el-loading-spinner p.el-loading-text{
- display: block!important;
- text-align: center!important;
- bottom: 10px!important;
- top: 80px!important;
+.el-loading-mask .el-loading-spinner p.el-loading-text {
+ display: block !important;
+ text-align: center !important;
+ bottom: 10px !important;
+ top: 80px !important;
right: 0 !important;
color: #78adf7;
}
-.el-loading-mask .el-loading-spinner .path{
+.el-loading-mask .el-loading-spinner .path {
stroke: #78adf7;
}
.installInfo {
@@ -1647,7 +1735,8 @@
}
}
}
- .store-list,.app-list {
+ .store-list,
+ .app-list {
display: flex;
flex-wrap: wrap;
.wrap-box {
@@ -1801,7 +1890,7 @@
z-index: 1;
border-radius: 3px;
display: none;
- .info-onmask{
+ .info-onmask {
color: #8ecaff;
}
i {
@@ -1893,12 +1982,11 @@
.bot-btn {
flex: 1;
}
- &.flex-center{
+ &.flex-center {
align-items: center;
justify-content: center;
}
}
-
}
.list-choose-item-left-uninstal {
color: darkgray;
@@ -2073,11 +2161,11 @@
max-height: 106px;
}
}
- &.uninstall{
- .svg-wrap{
+ &.uninstall {
+ .svg-wrap {
background-color: #ddd;
}
- .alg-name{
+ .alg-name {
color: darkgray;
}
}
--
Gitblit v1.8.0