Commit 424f3c98 authored by 张俊's avatar 张俊

应用详情

parent 639a1b45
......@@ -53,7 +53,7 @@ export default {
this.$emit("delete-action", this.data);
},
intoDetail() {
this.$router.push(`${this.detailsUrl}${this.data.up_userid}`);
this.$router.push(`${this.detailsUrl}${this.data.app_id}`);
},
},
};
......
......@@ -7,10 +7,10 @@
<p class="info_title">
<span>{{ data.name }}</span>
<span class="bs" v-if="data.aqdetail" @click="subevent(0)">一键部署</span>
<span class="info_fix" v-if="data.yydetail" @click="subevent(1)">我要编辑</span>
<span class="right gap" v-if="data.yydetail">|</span>
<span class="right underline" v-if="data.yydetail" @click="subevent(2)" title="申请下线至开发者应用">申请下线</span>
<span class="right undersell" v-if="data.yydetail" @click="subevent(3)">申请下架</span>
<span class="info_fix" v-if="data.fxdetail" @click="subevent(1)">我要编辑</span>
<span class="right gap" v-if="data.yydetail||data.xxdetail">|</span>
<span class="right underline" v-if="data.xxdetail" @click="subevent(2)" title="申请下线至开发者应用">{{data.xxdetail}}</span>
<span class="right undersell" v-if="data.yydetail" @click="subevent(3)">{{data.yydetail}}</span>
<span class="right undersell undermy" v-if="data.bsdetail" @click="subevent(4)">申请密钥</span>
<span class="info_fix" v-if="data.fixed" @click="goto_page(data.fixedurl)">我要修改</span>
</p>
......@@ -61,11 +61,11 @@ export default {
}else if(val == 1){
this.$emit('editapp')
}else if(val == 2){
this.$emit('unline',0)
this.$emit('unline',this.data)
}else if(val == 3){
this.$emit('unsell',1)
this.$emit('unsell',this.data)
}else if(val == 4){
this.$emit('applymy',1)
this.$emit('applymy')
}
},
goto_page(url){
......
......@@ -33,6 +33,10 @@ export default {
type: String,
required: true,
},
is_app_detail:{
type: Boolean,
default: false,
}
},
data: () => ({
commentsTtotal: 0,
......@@ -75,16 +79,31 @@ export default {
this.init();
},
init() {
if(this.is_app_detail){
var temp = {
params: {
page: this.currentPage,
limit: this.pageSize,
},
}
}else{
var temp = {
params: {
page: this.currentPage,
size: this.pageSize,
},
}
}
this.$http
.get(this.url, {
params: {
page: this.currentPage,
size: this.pageSize,
},
})
.get(this.url, temp)
.then(({ data }) => {
this.commentsTtotal = data.total;
this.commentsList = data.data;
if(this.is_app_detail){
this.commentsTtotal = data.data.overview.total;
this.commentsList = data.data.list;
}else{
this.commentsTtotal = data.total;
this.commentsList = data.data;
}
})
.catch(function(error) {
console.log(error);
......
......@@ -53,10 +53,12 @@
:border="border"
@select="select"
@select-all="selectAll"
v-infinite-scroll="asynload"
:defaultSelections="defaultSelections"
element-loading-text="加载中..."
:empty-text="emptyText"
:stripe="stripe"
:style="{height:isLoad,overflow:isLoad?'auto':''}"
row-key="id"
:show-header="showHeader"
default-expand-all
......@@ -264,6 +266,10 @@ export default {
"v-apaas-table-filter": TableFilter
},
props: {
//是否控制5行显示
isLoad:'',
//是否滚动加载
asyn_load1:{ type: Boolean, default: false },
// 表格型号:mini,medium,small
size: { type: String, default: "medium" },
loading: { type: Boolean, default: false },
......@@ -429,6 +435,12 @@ export default {
}
},
methods: {
asynload(){
console.log('111');
if(this.asyn_load1){
this.$emit("load_data");
}
},
//本地删除
deleteLocal(val) {
this.selectedTabsPage.splice(val.$index, 1);
......
......@@ -127,6 +127,8 @@ export default {
this.$message.error("上传图片大小不能超过 10MB!");
}
return isJPG && isLt10M;
} else {
}
},
handleAvatarSuccess(response, file, fileList) {
......@@ -147,6 +149,14 @@ export default {
});
}
this.$emit("getNewList", this.fileArray);
} else {
if (response.success == 1) {
this.fileArray.push({
url: response.data,
name: file.name
});
}
this.$emit("getNewList", this.fileArray);
}
this.hideUpload = fileList.length >= this.max;
},
......
......@@ -4,6 +4,10 @@ import store from "@/store";
import Vue from 'vue'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
Vue.use(mavonEditor)
import VueResource from "vue-resource";
Vue.use(VueResource);
......
......@@ -257,7 +257,7 @@ export default {
desc:data.description,
person:data.create_user,
date:data.create_date,
ip:transform_func(data.ip_whitelist),
ip:this.transform_func(data.ip_whitelist),
domain:data.domain_name
}
})
......
......@@ -24,18 +24,16 @@
</div>
</div>
<div class="type_box_select">
<info-list
:list_arr="list_arr"
v-if="now_service == 0"
>
<div class="appcode" v-html="appcode" slot="app_code"></div>
</info-list>
<mavon-editor v-model="list_arr" :boxShadow="false" :toolbarsFlag="false" :subfield="subfield" :defaultOpen="preview" :editable="false" v-if="now_service == 0"/>
<div v-if="now_service == 1&&now_user == 0">
<p style="color:#8890a7;">镜像列表:</p>
<table-um
:headers="header_arr"
url="imagearr"
:datas="image_arr"
:asyn_load1="asynLoad"
isLoad="255px"
@load_data="load_data"
@actiondelete="actiondelete"
></table-um>
<p>
......@@ -53,19 +51,33 @@
</el-form-item>
<el-form-item>
<p class="formname">上传镜像包:</p>
<upload-file :multiple="false" :max="1" :drag="true" :list="imgList" @getNewList="getNewList"></upload-file>
<!-- <upload-file :multiple="false" :max="1" :drag="true" :list="imgList" directory="app" @getNewList="getNewList"></upload-file> -->
<el-upload
class="upload-demo"
drag
action="/apaas/hubApi/image/upload"
:file-list="form.fileList"
ref="upload"
:auto-upload="false"
:on-success="upload_success"
:on-error="upload_error"
:data="anotherData"
:multiple="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
</el-form-item>
</el-form>
</div>
<div class="savebtn" v-if="addImageFlag">
<el-button>保存</el-button>
<el-button>取消</el-button>
<el-button @click="submit_form('form')">保存</el-button>
<el-button @click="addImageFlag=false">取消</el-button>
</div>
</div>
<div v-if="now_service == 2&&now_user == 0">
<p style="color:#8890a7;">压缩包:</p>
<p><img src="@/assets/imgs/ic_olddata.png" alt="">{{oldpag_name}} <span class="download">下载原压缩包</span> </p>
<p><img src="@/assets/imgs/ic_olddata.png" alt="" style="margin-right: 10px;">{{oldpag_name}} <span class="download" @click="down_load_zip">下载原压缩包</span> </p>
<p style="color:#8890a7;margin:20px 0;">上传新的压缩包:</p>
<div class="uploadtips">
<p style="margin-left:-11px;"><i class="el-icon-warning-outline"></i>压缩包上传提示:</p>
......@@ -73,15 +85,32 @@
<p>2.上述文件必须按照上述名称进行命名;</p>
<p>3.请将文件夹压缩为“.zip”、“.tgz”、“.tar.gz”格式,如:名称为redis-ha的文件夹压缩为redis-ha.zip。</p>
</div>
<upload-file :multiple="false" :max="1" :drag="true" :list="imgList1" @getNewList="getNewList1"></upload-file>
<el-upload
class="upload-demo"
drag
action="/apaas/hubApi/market/updateChart"
:file-list="fileList"
ref="upload1"
:auto-upload="false"
:on-success="upload_success"
:on-error="upload_error"
:data="anotherData1"
:multiple="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
<div class="savebtn">
<el-button>保存</el-button>
<el-button @click="save_zip">保存</el-button>
<el-button>取消</el-button>
</div>
</div>
<div v-if="(now_service == 3&&now_user == 0)||(now_service == 1&&now_user !== 0)">
<service-tab-comments url="sjfw"></service-tab-comments>
<service-tab-comments
:is_app_detail="is_app_detail"
:data="commentsData"
:url="commentsUrl">
</service-tab-comments>
</div>
</div>
......@@ -102,6 +131,7 @@ import dialogAction from "@/components/dialog-action";
import uploadFile from '@/components/upload_file'
import serviceTabComments from '@/components/service-tabs/service-tab-comments'
import { getRole } from "@/utils/common";
import { mapGetters,mapState } from 'vuex'
export default {
components: {
infoList,
......@@ -115,22 +145,36 @@ export default {
return {
now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员
buy_style: 0,
oldpag_name:'镜像文件002.rar',
preview:'preview',
subfield:false,
image_arr:[],
now_page:1,
total:0,
anotherData:{},
anotherData1:{},
asynLoad:false,
oldpag_name:'',
imgList: [],
imgList1: [],
is_app_detail:true,
commentsData:{
avgScore:0,
scoreStatic:{},
},
commentsUrl:'',
form:{
name: '',
fileList:'',
fileList:[],
taps:''
},
fileList:'',
fileList:[],
rules:{
name:[
{required: true, message: '请输入镜像名称', trigger: 'blur'}
],
taps:[
{required: true, message: '请输入镜像标签', trigger: 'blur'}
],
]
},
tipsOptions: {
title:'',
......@@ -146,21 +190,54 @@ export default {
],
service_header_arr: {
name: "",
first: [],
second: [],
yydetail: true,
first: [
{
"name": "在线状态",
"text": ""
},
{
"name": "应用类型",
"text": ""
},
{
"name": "业务领域",
"text": ""
}
],
second: [
{
"name": "申请类型",
"text": ""
},
{
"name": "申请开发次数",
"text": ""
},
{
"name": "申请部署次数",
"text": ""
},
{
"name":"创建时间",
"text":""
}
],
yydetail: '',
xxdetail:'',
aqdetail: true,
fxdetail:false,
url:'',
},
now_service: 0,
header_arr: [
{
prop: "jxmc",
prop: "name",
label: "镜像名称",
minWidth: "33.33%",
align: "center",
},
{
prop: "bbh",
prop: "tag",
label: "版本号",
minWidth: "33.33%",
align: "center",
......@@ -179,63 +256,136 @@ export default {
},
],
list_arr: [
{
title: "应用简介:",
info: "",
},
{
title: "功能简介:",
info: "",
},
{
title: "应用场景:",
info: "",
},
{
title: "应用参数:",
info: "",
type: "solt",
solt_name: "app_code",
},
],
list_arr: '',
appcode: "",
addImageFlag:false
};
},
computed:{
...mapGetters([
'level',
]),
...mapState(['userInfo']),
},
watch: {
},
created() {
this.now_user = this.$store.state.role;
getRole().then((data) => {
this.now_user = data;
this.$store.commit("rolefun", data);
this.getServiceInfo();
this.getServiceBaseInfo();
});
if(this.userInfo){
this.now_user = this.level
}else{
this.getCurrentUser()
}
this.asynLoad=false
this.commentsUrl = `/apaas/hubApi/market/comments/${this.$route.params.id}`
this.getServiceInfo();
this.getServiceBaseInfo();
this.get_image_list()
this.get_options()
this.get_file_name()
},
mounted() {},
methods: {
getNewList(val) {
console.log(val);
this.form.fileList = ""
this.form.fileList = url.map((v,k)=>{
return v.url
}).join(';')
console.log(this.form.fileList)
},
getNewList1(val) {
console.log(val);
this.fileList = ""
this.fileList = url.map((v,k)=>{
return v.url
}).join(';')
console.log(this.fileList)
},
getCurrentUser() {
this.$api.user.getNowUser().then(({ data }) => {
if (data.success == 1) {
console.log("--- user info ---");
console.log(data.data);
console.log("--- user info ---");
this.$store.commit("userInfofun", data.data);
this.now_user = this.level
console.log(this.level);
} else {
console.log(data.errMsg);
}
});
},
addImage(){
this.addImageFlag = true
},
down_load_zip(){
const a = document.createElement('a'); // 创建a标签
a.setAttribute('download', '');// download属性
a.setAttribute('href', '/apaas/hubApi/market/download/'+this.$route.params.id);// href链接
a.click();// 自执行点击事件
},
get_options(){
this.$http.get(`/apaas/hubApi/market/comments/${this.$route.params.id}?limit=10&page=1`)
.then((response)=>{
if(response.data.success==1){
console.log(response);
var temp = {}
response.data.data.overview.detail_counts.forEach(e => {
temp[e.score]=e.count
});
this.commentsData={
avgScore:response.data.data.overview.ave,
scoreStatic:temp,
}
}
})
},
submit_form(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.anotherData = {
image_name:this.form.name,
tag:this.form.taps
}
console.log(this.anotherData);
this.$refs['upload'].submit()
} else {
console.log('error submit!!');
return false;
}
});
},
save_zip(){
this.anotherData1 = {
app_id:this.$route.params.id
}
console.log(this.anotherData1);
this.$refs['upload1'].submit()
},
upload_success(response, file, fileList){
if(response.success == 1){
this.$message.success('上传成功')
this.get_image_list()
}else{
this.$message.error(response.errMsg)
}
},
upload_error(){
this.$message.error('上传失败')
},
load_data(){
console.log(2222);
this.asynLoad=false
if(5*this.now_page<this.total){
this.now_page = this.now_page + 1
this.get_image_list()
}
},
get_image_list(){
this.$http.get(`/apaas/hubApi/image/imageUpList?page=${this.now_page}&size=5`)
.then((response)=>{
if(response.data.success==1){
console.log(response);
this.asynLoad=true
this.image_arr.push(...response.data.data)
this.total = response.data.total
}
})
},
get_file_name(){
this.$http.get(`/apaas/hubApi/market/chartsName/${this.$route.params.id}`)
.then((response)=>{
if(response.data.success==1){
console.log(response);
this.oldpag_name = response.data.data
}
})
},
actiondelete(){
this.tipsOptions= {
title:'',
......@@ -251,11 +401,25 @@ export default {
};
this.$refs.myConfirm.showModel();
},
change_up_state(url,state){
this.$http.put(`${url}/${this.$route.params.id}/${state}`).then((response)=>{
if(response.data.success == 1){
this.$message.success('申请成功')
setTimeout(()=>{
this.getServiceInfo()
},1000)
}else{
this.$message.error('申请失败')
}
}).catch((res)=>{
this.$message.error('申请失败')
})
},
deploy(){
console.log('0000');
},
editapp(){
console.log('11111');
this.$router.push(`${this.$route.path.split('detail')[0]}edit/${this.$route.params.id}`)
},
unline(val){
console.log(val);
......@@ -266,11 +430,23 @@ export default {
btnCancelText: "",
position: "",
}
this.tipsOptions.message="该操作会将该应用从应用商店的平台应用区域下线至开发者应用区域,下线前需向超级管理员发送通知,超级管理员通过后此应用将下线至开发者应用区域。"
this.tipsOptions.btnSubmitText="发送通知"
if(val.xxdetail == '申请下线'){
this.tipsOptions.message="该操作会将该应用从应用商店的平台应用区域下线至开发者应用区域,下线前需向超级管理员发送通知,超级管理员通过后此应用将下线至开发者应用区域。"
this.tipsOptions.btnSubmitText="发送通知"
}
if(val.xxdetail == '申请上线'){
this.tipsOptions.message="该操作会将该应用从应用商店开发者应用上线至平台应用"
this.tipsOptions.btnSubmitText="确认"
}
this.tipsOptions.position="left"
this.tipsOptions.confirmSubmit = () => {
console.log("deleteItem - ");
if(val.xxdetail == '申请下线'){
this.change_up_state('/apaas/hubApi/market/platformStatus',3)
}
if(val.xxdetail == '申请上线'){
this.change_up_state('/apaas/hubApi/market/platformStatus',1)
}
this.$refs.myConfirm.hideModel();
};
this.$refs.myConfirm.showModel();
......@@ -284,35 +460,79 @@ export default {
btnCancelText: "",
position: "",
}
this.tipsOptions.message="申请下架应用需要向组织管理员发送通知,组织管理员通过下架请求后该应用将从应用商店下架。"
this.tipsOptions.btnSubmitText="发送通知"
if(val.yydetail == '申请下架'){
this.tipsOptions.message="申请下架应用需要向组织管理员发送通知,组织管理员通过下架请求后该应用将从应用商店下架。"
this.tipsOptions.btnSubmitText="发送通知"
}
if(val.yydetail == '申请上架'){
this.tipsOptions.message="申请下架应用需要向组织管理员发送通知,组织管理员通过上架请求后该应用将在应用商店上架。"
this.tipsOptions.btnSubmitText="确认"
}
this.tipsOptions.confirmSubmit = () => {
console.log("deleteItem - ");
if(val.yydetail == '申请下架'){
this.change_up_state('/apaas/hubApi/market/deployStatus',3)
}
if(val.yydetail == '申请上架'){
this.change_up_state('/apaas/hubApi/market/deployStatus',1)
}
this.$refs.myConfirm.hideModel();
};
this.$refs.myConfirm.showModel();
},
getServiceInfo() {
this.$http
.get("/static/appdetail.json")
.get("/apaas/hubApi/market/baseInfo?id="+this.$route.params.id)
.then((response) => {
let data = response.data.data;
this.$set(this.service_header_arr, "name", data.appInfo.name);
this.$set(this.service_header_arr, "first", data.appInfo.first);
this.$set(this.service_header_arr, "second", data.appInfo.second);
if(response.data.success){
let data = response.data.data;
this.$set(this.service_header_arr, "name", data.app_name+'V'+data.version);
this.$set(this.service_header_arr['first'][0], "text", data.online_state_name);
this.$set(this.service_header_arr['first'][1], "text", data.type_name);
this.$set(this.service_header_arr['first'][2], "text", data.ywly_name);
this.$set(this.service_header_arr['second'][0], "text", data.apply_type_name);
this.$set(this.service_header_arr['second'][1], "text", data.apply_times+'');
this.$set(this.service_header_arr['second'][2], "text", data.deploy_times+'');
this.$set(this.service_header_arr['second'][3], "text", data.create_date);
this.$set(this.service_header_arr, "yydetail", '');
this.$set(this.service_header_arr, "xxdetail", '');
if(data.up_deploy_status==0){
this.$set(this.service_header_arr, "yydetail", '申请上架');
}else if(data.up_deploy_status==2){
this.$set(this.service_header_arr, "yydetail", '申请下架');
}
if(data.up_platform_status==0){
this.$set(this.service_header_arr, "xxdetail", '申请上线');
}else if(data.up_platform_status==2){
this.$set(this.service_header_arr, "xxdetail", '申请下线');
}
if(this.now_user == 0){
this.$set(this.service_header_arr, "fxdetail", true);
}
if(this.now_user == 1){
this.$set(this.service_header_arr, "xxdetail", '');
this.$set(this.service_header_arr, "yydetail", '');
this.$set(this.service_header_arr, "fxdetail", '');
this.$set(this.service_header_arr, "aqdetail", false);
}
if(this.now_user == 2){
this.$set(this.service_header_arr, "xxdetail", '');
this.$set(this.service_header_arr, "yydetail", '');
this.$set(this.service_header_arr, "aqdetail", true);
}
this.$set(this.service_header_arr, "url", data.logo);
}
})
.catch(function(response) {});
},
getServiceBaseInfo() {
this.$http
.get("/static/appdetail.json")
.get("/apaas/hubApi/market/readme/"+this.$route.params.id)
.then((response) => {
let data = response.data.data;
this.$set(this.list_arr[0], "info", data.appbaseinfo.intorduce);
this.$set(this.list_arr[1], "info", data.appbaseinfo.action);
this.$set(this.list_arr[2], "info", data.appbaseinfo.use);
this.appcode = data.appbaseinfo.appcode;
this.list_arr = data
})
.catch(function(response) {});
},
......
......@@ -233,7 +233,7 @@ export default {
getNewList(val) {
console.log(val);
this.form.fileList = ""
this.form.fileList = url.map((v,k)=>{
this.form.fileList = val.map((v,k)=>{
return v.url
}).join(';')
console.log(this.form.fileList)
......
......@@ -564,7 +564,7 @@ export default {
getNewList(val) {
console.log(val);
this.form.fileList = "";
this.form.fileList = url
this.form.fileList = val
.map((v, k) => {
return v.url;
})
......@@ -574,7 +574,7 @@ export default {
getNewList1(val) {
console.log(val);
this.fileList = "";
this.fileList = url
this.fileList = val
.map((v, k) => {
return v.url;
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment