Commit eeb5b235 authored by 徐一鸣's avatar 徐一鸣

SDK示例管理

parent 5e701a5b
<template> <template>
<el-upload <el-upload
ref="upload"
drag drag
action="/apaas/static/file/upload" action="/apaas/static/file/upload"
:data="{ :data="{
...@@ -34,6 +35,11 @@ export default { ...@@ -34,6 +35,11 @@ export default {
default: "", default: "",
}, },
}, },
data() {
return {
preUrl: "",
};
},
computed: { computed: {
fileList() { fileList() {
let list = []; let list = [];
...@@ -68,6 +74,7 @@ export default { ...@@ -68,6 +74,7 @@ export default {
const filtType = this.getFileType(file.name); const filtType = this.getFileType(file.name);
if (filtType === "rar" || filtType === "zip") { if (filtType === "rar" || filtType === "zip") {
this.preUrl = this.url;
return true; return true;
} else { } else {
this.$message.error("仅支持rar和zip格式!"); this.$message.error("仅支持rar和zip格式!");
...@@ -76,6 +83,21 @@ export default { ...@@ -76,6 +83,21 @@ export default {
}, },
uploadSuccess({ data }) { uploadSuccess({ data }) {
this.$emit("change", data); this.$emit("change", data);
// 替换文件后要把旧文件删除掉
if (this.preUrl) {
this.$http
.delete("/apaas/static/file/delete", {
params: {
url: this.preUrl,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.preUrl = "";
}
});
}
}, },
}, },
}; };
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
<el-breadcrumb-item to="/technical_support/doc_manage"> <el-breadcrumb-item to="/technical_support/doc_manage">
开发文档 开发文档
</el-breadcrumb-item> </el-breadcrumb-item>
<el-breadcrumb-item> <el-breadcrumb-item> 文档编辑 - {{ title }} </el-breadcrumb-item>
文档编辑 - {{ title }}
</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
...@@ -31,21 +29,26 @@ ...@@ -31,21 +29,26 @@
<script> <script>
import wangE from "@/components/wangE"; import wangE from "@/components/wangE";
export default { export default {
components: {
wangE,
},
data() { data() {
return { return {
title: "", title: "",
content: "", content: "",
}; };
}, },
components: { computed: {
wangE, id() {
return parseFloat(this.$route.params.id);
},
}, },
created() { created() {
if (this.$route.params.id) { if (this.id) {
this.$http this.$http
.get("/apaas/support/document/get", { .get("/apaas/support/document/get", {
params: { params: {
id: this.$route.params.id, id: this.id,
}, },
}) })
.then(({ data }) => { .then(({ data }) => {
...@@ -63,13 +66,13 @@ export default { ...@@ -63,13 +66,13 @@ export default {
submitAction() { submitAction() {
this.$http this.$http
.put("/apaas/support/document/put", { .put("/apaas/support/document/put", {
id: parseFloat(this.$route.params.id), id: this.id,
content: this.content, content: this.content,
}) })
.then(({ data }) => { .then(({ data }) => {
if (data.success === 1) { if (data.success === 1) {
this.$message.success("保存成功"); this.$message.success("保存成功");
this.$router.push("/technical_support/doc_manage") this.$router.push("/technical_support/doc_manage");
} else { } else {
this.$message.error(data.errMsg || "保存失败"); this.$message.error(data.errMsg || "保存失败");
} }
......
...@@ -250,7 +250,10 @@ export default { ...@@ -250,7 +250,10 @@ export default {
{ max: 20, message: "长度应小于20个字符", trigger: "change" }, { max: 20, message: "长度应小于20个字符", trigger: "change" },
], ],
}, },
detail: "", detail: {
title: "",
content: "",
},
deleteDialogInfo: { deleteDialogInfo: {
msg: "", msg: "",
submit: null, submit: null,
...@@ -424,7 +427,7 @@ export default { ...@@ -424,7 +427,7 @@ export default {
<style> <style>
.doc_manage_detail_dialog .el-dialog__body { .doc_manage_detail_dialog .el-dialog__body {
padding: 10px; padding: 15px;
} }
.doc_manage_detail_dialog .el-dialog__footer { .doc_manage_detail_dialog .el-dialog__footer {
display: none; display: none;
......
...@@ -21,20 +21,15 @@ export default { ...@@ -21,20 +21,15 @@ export default {
sideNavBar, sideNavBar,
}, },
data: () => ({ data: () => ({
activePath: "",
navList: [], navList: [],
}), }),
/* watch: {
"$route.fullPath"(path) {
this.initNavList();
},
}, */
methods: { methods: {
initNavList() { initNavList() {
this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(({ data }) => { this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(({ data }) => {
if (data.success == 1) { if (data.success == 1) {
let menu = data.data[0].Child; let menu = data.data[0].Child;
let nav = []; let nav = [];
let activePath = "";
for (let i = 0; i < menu.length; i++) { for (let i = 0; i < menu.length; i++) {
let first = menu[i]; let first = menu[i];
...@@ -83,8 +78,8 @@ export default { ...@@ -83,8 +78,8 @@ export default {
if (children.length === 0) { if (children.length === 0) {
this.$set(nav[index], "disabled", true); this.$set(nav[index], "disabled", true);
} else { } else {
if (activePath === "") { if (this.activePath === "") {
activePath = children[0].path; this.activePath = children[0].path;
} }
this.$set(nav[index], "path", children[0].path); this.$set(nav[index], "path", children[0].path);
...@@ -97,9 +92,9 @@ export default { ...@@ -97,9 +92,9 @@ export default {
}); });
this.navList = nav; this.navList = nav;
if (activePath && this.$route.params.id === undefined) { if (this.activePath && this.$route.params.id === undefined) {
this.$router.push(activePath); this.$router.push(this.activePath);
} else if (activePath === "") { } else if (this.activePath === "") {
this.$message.error("您尚未创建任何文档"); this.$message.error("您尚未创建任何文档");
} }
}); });
......
<template>
<div class="doc_manage_container">
<div class="apass_breadcrumb">
<el-breadcrumb separator="/">
<el-breadcrumb-item to="/technical_support">
技术支持
</el-breadcrumb-item>
<el-breadcrumb-item to="/technical_support/sdk_manage/example">
SDK管理
</el-breadcrumb-item>
<el-breadcrumb-item>
SDK示例编辑 - {{ detail.example_name }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="editpage">
<wang-e v-model="detail.content"></wang-e>
<div class="apaas_button">
<el-button type="defalut" size="mini" @click="cancelAction">
取消
</el-button>
<el-button type="primary" size="mini" @click="submitAction">
保存
</el-button>
</div>
</div>
</div>
</template>
<script>
import wangE from "@/components/wangE";
export default {
components: {
wangE,
},
data() {
return {
detail: {},
};
},
computed: {
id() {
return parseFloat(this.$route.params.id);
},
},
created() {
if (this.id) {
this.$http
.get("/apaas/support/sdk/example/detail", {
params: {
id: this.id,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.detail = data.data;
}
});
}
},
methods: {
cancelAction() {
this.$router.push("/technical_support/sdk_manage");
},
submitAction() {
this.$http
.put("/apaas/support/sdk/example/put", {
id: this.id,
style_id: this.detail.style_id,
example_name: this.detail.example_name,
content: this.detail.content,
})
.then(({ data }) => {
if (data.success === 1) {
this.$message.success("保存成功");
this.$router.push("/technical_support/sdk_manage/example");
} else {
this.$message.error(data.errMsg || "保存失败");
}
})
.catch((error) => {
console.log(error);
this.$message.error("保存失败");
});
},
},
};
</script>
<style scoped>
.doc_manage_container {
height: 100%;
padding: 0 20px 30px;
box-sizing: border-box;
}
.main_container {
height: calc(100% - 53px);
background-color: #fff;
border-radius: 10px;
}
.editpage {
background-color: #fff;
height: calc(100% - 45px);
margin-bottom: 20px;
box-shadow: 0px 3px 6px 0px #f4f7fc;
border-radius: 12px;
}
.editpage .wangeditor_class {
height: calc(100% - 100px);
padding: 0 20px;
box-sizing: border-box;
}
.apaas_button {
border-top: 1px solid #e3e5ef;
box-sizing: border-box;
text-align: right;
padding-top: 30px;
}
.apaas_button .el-button + .el-button {
margin-right: 30px;
}
</style>
<template> <template>
<div class="doc_manage_container"> <div class="list_container">
<apass-list <apass-list
ref="list" ref="list"
search-placeholder="请输入关键字" search-placeholder="请输入关键字"
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
:list-total="listTotal" :list-total="listTotal"
:list-header="listHeader" :list-header="listHeader"
:list-data="listData" :list-data="listData"
:list-select="true"
@list-action="init" @list-action="init"
@list-select="selectAction"
> >
<el-breadcrumb separator="/" slot="breadcrumb"> <el-breadcrumb separator="/" slot="breadcrumb">
<el-breadcrumb-item to="/technical_support"> <el-breadcrumb-item to="/technical_support">
...@@ -32,12 +34,19 @@ ...@@ -32,12 +34,19 @@
<el-option <el-option
v-for="(item, index) in types" v-for="(item, index) in types"
:key="'top_type_' + index" :key="'top_type_' + index"
:label="item.label" :label="item.style_name"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div class="filter_item">
<span class="filter_title">示例名称:</span>
<el-input
v-model="topFilter.name"
placeholder="请输入示例名称"
></el-input>
</div>
<div class="filter_item"> <div class="filter_item">
<span class="filter_title">最后更新时间:</span> <span class="filter_title">最后更新时间:</span>
<el-date-picker <el-date-picker
...@@ -62,10 +71,92 @@ ...@@ -62,10 +71,92 @@
</div> </div>
</template> </template>
<div class="main_top" slot="main-top"> <div class="main_top_action apaas_button" slot="main-top">
xxx <el-button class="delete_btn" type="danger" @click="deleteSlection">
批量删除
</el-button>
<span class="selected_text">
已选择
<span>{{ selection.length }}</span>
</span>
<a class="clean_btn" @click.prevent="clearSelection">清空</a>
<el-button class="add_btn" type="primary" @click="addNewSdk">
新增SDK类型
</el-button>
</div> </div>
</apass-list> </apass-list>
<apass-dialog
ref="viewDialog"
:title="detailForm.example_name"
class="sdk_manage_detail_dialog"
width="1340px"
>
<div
class="view_content apaas_scroll"
slot="content"
v-html="detailForm.content"
></div>
</apass-dialog>
<apass-dialog
ref="detailDialog"
:title="detailForm.type === 0 ? '新增' : '修改'"
>
<div class="detail_content" slot="content">
<div class="detail_notice">
<p>注:同一文档类型下可维护多个文档名称</p>
</div>
<el-form ref="detailForm" :model="detailForm" :rules="detailFormRules">
<el-form-item label="SDK类型" prop="style_id">
<el-select
v-model="detailForm.style_id"
placeholder="请选择SDK类型"
style="width: 100%;"
>
<el-option
v-for="(item, index) in types"
:key="'detail_type_' + index"
:label="item.style_name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="示例名称" prop="example_name">
<el-input
v-model="detailForm.example_name"
placeholder="请输入示例名称"
></el-input>
</el-form-item>
</el-form>
</div>
<template slot="action">
<el-button
type="primary"
size="mini"
@click="detailEditContent"
style="float: left;"
v-if="detailForm.type === 1"
>
修改文档
</el-button>
<el-button type="defalut" size="mini" @click="detailCancelAction">
取消
</el-button>
<el-button type="primary" size="mini" @click="detailSubmitAction">
确定
</el-button>
</template>
</apass-dialog>
<apass-dialog
ref="deleteDialog"
:msg="deleteDialogInfo.msg"
:submit="deleteDialogInfo.submit"
></apass-dialog>
</div> </div>
</template> </template>
...@@ -73,28 +164,106 @@ ...@@ -73,28 +164,106 @@
import helper from "@/services/helper.js"; import helper from "@/services/helper.js";
import apassList from "@/components/apass-list"; import apassList from "@/components/apass-list";
import apassDialog from "@/components/apass-dialog"; import apassDialog from "@/components/apass-dialog";
import apassUpload from "@/components/apass-upload";
import showMoreFilter from "@/components/show-more-filter"; import showMoreFilter from "@/components/show-more-filter";
export default { export default {
components: { components: {
apassList, apassList,
apassDialog, apassDialog,
apassUpload,
showMoreFilter, showMoreFilter,
}, },
data() { data() {
return { return {
paddingLeft: 25, paddingLeft: 0,
listTotal: 0, listTotal: 0,
listHeader: [{}], listHeader: [
{
label: "示例名称",
prop: "example_name",
type: "button",
callback: this.viewItem,
width: 320,
},
{
label: "SDK类型",
prop: "style_name",
align: "center",
},
{
label: "版本号",
prop: "version",
align: "center",
},
{
label: "是否提供SDK包下载",
prop: "is_sdk",
align: "center",
},
{
label: "操作人",
prop: "user_name",
align: "center",
},
{
label: "最后更新时间",
prop: "updated",
getText: ({ updated }) => this.getTimeText(updated || ""),
align: "center",
},
{
label: "操作",
type: "buttons",
align: "center",
width: 240,
actionList: [
{
label: "修改",
callback: this.editItem,
},
{
label: "删除",
callback: this.deleteItem,
class: "warn",
},
],
},
],
listData: [], listData: [],
topFilter: { topFilter: {
type: "", type: "",
name: "",
time: "", time: "",
}, },
types: [], types: [],
tempFilter: {}, tempFilter: {},
detailForm: {
type: 0, // 0:新增 1:修改
style_id: "",
example_name: "",
content: "",
},
detailFormRules: {
style_id: [
{ required: true, message: "请选择SDK类型", trigger: "change" },
],
example_name: [
{ required: true, message: "请输入示例名称", trigger: "blur" },
{ max: 20, message: "长度应小于20个字符", trigger: "change" },
],
},
deleteDialogInfo: {
msg: "",
submit: null,
},
saveSection: false,
selection: [],
}; };
}, },
created() {
this.getTypes();
},
methods: { methods: {
init(filter) { init(filter) {
let fullFilter = { let fullFilter = {
...@@ -103,13 +272,48 @@ export default { ...@@ -103,13 +272,48 @@ export default {
}; };
this.tempFilter = filter; this.tempFilter = filter;
this.saveSection = true;
this.$http
.get("/apaas/support/sdk/example/list", {
params: {
style: fullFilter.type,
name: fullFilter.name,
start: fullFilter.time && fullFilter.time[0],
end: fullFilter.time && fullFilter.time[1],
limit: fullFilter.size,
page: fullFilter.page,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.listTotal = data.total;
this.listData = data.data || [];
this.$nextTick(() => {
this.selection.forEach((item) => {
let target = this.listData.find((v) => v.id === item.id);
console.log(fullFilter); if (target) {
this.setCurrentRow(target, true);
}
});
this.saveSection = false;
});
}
});
},
getTypes() {
this.$http.get("/apaas/support/sdk/styleNames/list").then(({ data }) => {
if (data.success === 1) {
this.types = data.data || [];
}
});
}, },
topFilterClear() { topFilterClear() {
this.topFilter = { this.topFilter = {
name: "",
type: "", type: "",
name: "",
time: "", time: "",
}; };
this.refreshPage(); this.refreshPage();
...@@ -120,6 +324,262 @@ export default { ...@@ -120,6 +324,262 @@ export default {
refreshPage() { refreshPage() {
this.$refs.list.resetCurrentPage(); this.$refs.list.resetCurrentPage();
}, },
deleteSlection() {
if (this.selection.length) {
let names = [];
let ids = [];
this.selection.forEach((item) => {
names.push(item.example_name);
ids.push(item.id);
});
this.deleteDialogInfo.msg = `您确认要删除${names.join("")}吗?`;
this.deleteDialogInfo.submit = () => {
this.deleteRequest(ids);
};
this.$refs.deleteDialog.show();
} else {
this.$message.warning("您尚未选中任何SDK示例");
}
},
clearSelection() {
this.$refs.list.clearSelection();
},
setCurrentRow(row, flag) {
this.$refs.list.setSelectedRow(row, flag);
},
addNewSdk() {
this.detailForm = {
type: 0,
style_id: (this.types[0] && this.types[0].id) || "",
example_name: "",
content: "",
};
this.$refs.detailDialog.show();
},
viewItem(item) {
this.detailForm = {
type: 1,
};
this.detailRequest(item.id);
this.$refs.viewDialog.show();
},
editItem(item) {
this.detailRequest(item.id);
this.$refs.detailDialog.show();
},
deleteItem(item) {
this.deleteDialogInfo.msg = `确认删除${item.example_name}吗?`;
this.deleteDialogInfo.submit = () => {
this.deleteRequest([item.id]);
};
this.$refs.deleteDialog.show();
},
getTimeText(time) {
return helper.dateStringTransform(time);
},
selectAction(values) {
if (this.saveSection) {
return;
}
let cleanPage = values.length === 0; // 是否清空当前页所有选中
let selection = [...this.selection];
if (cleanPage) {
selection = selection.filter((item) => {
return !this.listData.find((v) => {
return v.id === item.id;
});
});
} else {
selection.push(...values);
}
this.selection = selection;
},
detailEditContent() {
this.$router.push({
name: "technicalSupportSdkExampleDetail",
params: {
id: this.detailForm.id,
},
});
},
detailCancelAction() {
this.$refs.detailDialog.hide();
},
detailSubmitAction() {
this.$refs.detailForm.validate((valid) => {
if (valid) {
if (this.detailForm.type === 0) {
this.addRequest(
{
style_id: this.detailForm.style_id,
example_name: this.detailForm.example_name,
content: this.detailForm.content,
},
(data) => {
this.$router.push({
name: "technicalSupportSdkExampleDetail",
params: {
id: data.id,
},
});
}
);
} else {
this.editRequest(
{
id: this.detailForm.id,
style_id: this.detailForm.style_id,
example_name: this.detailForm.example_name,
content: this.detailForm.content,
},
() => {
this.refreshPage();
this.$refs.detailDialog.hide();
}
);
}
} else {
return false;
}
});
},
detailRequest(id) {
this.$http
.get("/apaas/support/sdk/example/detail", {
params: {
id: id,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.detailForm = {
...data.data,
type: 1,
};
}
});
},
deleteRequest(ids) {
this.$http
.delete("/apaas/support/sdk/example/delete", {
body: {
ids: ids,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.$message.success("删除成功");
this.selection = [];
this.refreshPage();
} else {
this.$message.error("删除失败");
}
})
.catch((error) => {
console.log(error);
this.$message.error("删除失败");
});
},
addRequest(data, callback) {
this.$http
.post("/apaas/support/sdk/example/create", data)
.then(({ data }) => {
if (data.success === 1) {
this.$message.success("新增成功");
typeof callback === "function" && callback(data.data);
} else {
this.$message.error(data.errMsg || "新增失败");
}
})
.catch((error) => {
console.log(error);
this.$message.error("新增失败");
});
},
editRequest(data, callback) {
this.$http
.put("/apaas/support/sdk/example/put", data)
.then(({ data }) => {
if (data.success === 1) {
this.$message.success("修改成功");
typeof callback === "function" && callback();
} else {
this.$message.error(data.errMsg || "修改失败");
}
})
.catch((error) => {
console.log(error);
this.$message.error("修改失败");
});
},
}, },
}; };
</script> </script>
<style>
.list_container {
height: 100%;
}
.main_top_action {
display: flex;
justify-content: flex-start;
align-items: center;
}
.main_top_action .selected_text {
font-size: 14px;
color: #8890a7;
margin-left: 30px;
}
.main_top_action .selected_text > span {
font-weight: bold;
color: #242c43;
margin: 0 3px;
}
.main_top_action .clean_btn {
font-size: 14px;
line-height: 24px;
color: #2b4695;
text-decoration: underline;
cursor: pointer;
user-select: none;
margin-left: 30px;
}
.main_top_action .add_btn {
margin-left: auto;
}
.view_content {
height: 650px;
overflow: auto;
text-align: left;
}
.detail_notice {
display: inline-block;
margin: 10px auto;
background-color: #f4f7fc;
border-radius: 8px;
padding: 10px;
}
.detail_notice > p {
font-size: 12px;
line-height: 16px;
color: #58617a;
padding-left: 20px;
background-image: url("../../../../assets/imgs/ic_tishi.png");
background-repeat: no-repeat;
background-position: left center;
}
</style>
<style>
.sdk_manage_detail_dialog .el-dialog__body {
padding: 15px;
}
.sdk_manage_detail_dialog .el-dialog__footer {
display: none;
}
</style>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
:title="detailForm.type === 0 ? '新增' : '修改'" :title="detailForm.type === 0 ? '新增' : '修改'"
> >
<div class="add_content" slot="content"> <div class="add_content" slot="content">
<el-form ref="addForm" :model="detailForm" :rules="detailFormRules"> <el-form ref="detailForm" :model="detailForm" :rules="detailFormRules">
<el-form-item <el-form-item
label="SDK类型" label="SDK类型"
prop="style_name" prop="style_name"
...@@ -103,10 +103,6 @@ ...@@ -103,10 +103,6 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="SDK包上传" prop="file_url"> <el-form-item label="SDK包上传" prop="file_url">
<!-- <el-input
v-model="detailForm.file_url"
placeholder="支持扩展名:.rar .zip"
></el-input> -->
<apass-upload <apass-upload
v-model="detailForm.file_url" v-model="detailForm.file_url"
tip="支持扩展名:.rar .zip" tip="支持扩展名:.rar .zip"
...@@ -282,11 +278,23 @@ export default { ...@@ -282,11 +278,23 @@ export default {
this.$refs.list.resetCurrentPage(); this.$refs.list.resetCurrentPage();
}, },
deleteSlection() { deleteSlection() {
this.deleteDialogInfo.msg = `确认删除要删除所选项吗?`; if (this.selection.length) {
let names = [];
let ids = [];
this.selection.forEach((item) => {
names.push(item.style_name);
ids.push(item.id);
});
this.deleteDialogInfo.msg = `您确认要删除${names.join("")}吗?`;
this.deleteDialogInfo.submit = () => { this.deleteDialogInfo.submit = () => {
this.deleteRequest(this.selection.map((row) => row.id)); this.deleteRequest(ids);
}; };
this.$refs.deleteDialog.show(); this.$refs.deleteDialog.show();
} else {
this.$message.warning("您尚未选中任何SDK类型");
}
}, },
clearSelection() { clearSelection() {
this.$refs.list.clearSelection(); this.$refs.list.clearSelection();
...@@ -307,6 +315,8 @@ export default { ...@@ -307,6 +315,8 @@ export default {
this.$refs.detailDialog.hide(); this.$refs.detailDialog.hide();
}, },
detailSubmitAction() { detailSubmitAction() {
this.$refs.detailForm.validate((valid) => {
if (valid) {
if (this.detailForm.type === 0) { if (this.detailForm.type === 0) {
this.$http this.$http
.post("/apaas/support/sdk/styles/create", { .post("/apaas/support/sdk/styles/create", {
...@@ -349,16 +359,16 @@ export default { ...@@ -349,16 +359,16 @@ export default {
this.$message.error("修改失败"); this.$message.error("修改失败");
}); });
} }
} else {
return false;
}
});
}, },
editItem(item) { editItem(item) {
this.detailForm = { this.detailForm = {
type: 1, type: 1,
id: item.id,
style_name: item.style_name,
version: item.version,
file_url: item.file_url,
}; };
/* this.$http this.$http
.get("/apaas/support/sdk/styles/detail", { .get("/apaas/support/sdk/styles/detail", {
params: { params: {
id: item.id, id: item.id,
...@@ -366,9 +376,12 @@ export default { ...@@ -366,9 +376,12 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data.success === 1) { if (data.success === 1) {
this.detailForm = data.data; this.detailForm = {
...data.data,
type: 1,
};
} }
}); */ });
this.$refs.detailDialog.show(); this.$refs.detailDialog.show();
}, },
deleteItem(item) { deleteItem(item) {
......
...@@ -99,6 +99,7 @@ export default { ...@@ -99,6 +99,7 @@ export default {
.main_container { .main_container {
flex-grow: 1; flex-grow: 1;
height: calc(100% - 53px); height: calc(100% - 53px);
overflow: hidden;
} }
.download_action { .download_action {
background-color: #fff; background-color: #fff;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
title="SDK中心" title="SDK中心"
imgSrc="tool_ic_kaifawendang" imgSrc="tool_ic_kaifawendang"
:nav-list="navList" :nav-list="navList"
:title-path="navList[0] && navList[0].path" :title-path="activePath"
style="width: 250px;" style="width: 250px;"
></side-nav-bar> ></side-nav-bar>
<div class="main_container"> <div class="main_container">
...@@ -21,45 +21,19 @@ export default { ...@@ -21,45 +21,19 @@ export default {
sideNavBar, sideNavBar,
}, },
data: () => ({ data: () => ({
activePath: "",
navList: [], navList: [],
}), }),
methods: { methods: {
initNavList() { initNavList() {
let activePath = ""; this.$http.get("/apaas/support/sdk/menus").then(({ data }) => {
if (data.success === 1) {
let baseUrl = "/technical_support/sdk"; let baseUrl = "/technical_support/sdk";
let data = [ let menu = data.data || [];
{
name: "JavaScript SDK", this.navList = menu.map((item) => {
id: 1, let children = item.children || [];
children: [
{
name: "在地图上添加图层",
id: 101,
},
{
name: "测测测自己创建测",
id: 102,
},
],
},
{
name: "Android SDK",
id: 2,
children: [
{
name: "Android",
id: 201,
},
{
name: "测测测自己创建测",
id: 202,
},
],
},
];
this.navList = data.map((item) => {
let children = item.children;
let nav = { let nav = {
name: item.name, name: item.name,
path: `${baseUrl}/${item.name}`, path: `${baseUrl}/${item.name}`,
...@@ -69,8 +43,8 @@ export default { ...@@ -69,8 +43,8 @@ export default {
nav.children = children.map((v) => { nav.children = children.map((v) => {
let path = `${baseUrl}/${item.name}/${v.id}`; let path = `${baseUrl}/${item.name}/${v.id}`;
if (activePath === "") { if (this.activePath === "") {
activePath = path; this.activePath = path;
} }
return { return {
...@@ -86,11 +60,13 @@ export default { ...@@ -86,11 +60,13 @@ export default {
return nav; return nav;
}); });
if (activePath && this.$route.params.id === undefined) { if (this.activePath && this.$route.params.id === undefined) {
this.$router.push(activePath); this.$router.push(this.activePath);
} else if (activePath === "") { } else if (this.activePath === "") {
this.$message.error("您尚未创建任何SDK文档"); this.$message.error("您尚未创建任何SDK文档");
} }
}
});
}, },
}, },
mounted() { mounted() {
......
...@@ -257,6 +257,14 @@ export default new Router({ ...@@ -257,6 +257,14 @@ export default new Router({
"@/pages/technical-support/sdk-manage/example/index" "@/pages/technical-support/sdk-manage/example/index"
), ),
}, // SDK示例管理 }, // SDK示例管理
{
path: "/technical_support/sdk_manage/example/:id",
name: "technicalSupportSdkExampleDetail",
component: () =>
import(
"@/pages/technical-support/sdk-manage/example/detail"
),
}, // SDK示例详情
], ],
}, // SDK管理 }, // SDK管理
], ],
......
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