模型绘制页面

This commit is contained in:
yuan 2021-07-07 09:14:31 +08:00
parent 95d0cd03e0
commit ab0d193095
5 changed files with 23 additions and 11 deletions

View File

@ -18,7 +18,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"bjjl-engine-2d": "^1.0.14", "bjjl-engine-2d": "^1.0.15",
"echarts": "^4.7.0", "echarts": "^4.7.0",
"element-ui": "^2.12.0", "element-ui": "^2.12.0",
"file-saver": "^1.3.3", "file-saver": "^1.3.3",

View File

@ -36,6 +36,14 @@ export function updateModelDraftData(data) {
}) })
} }
/** 根据id查询2d模型草稿数据 */
export function getModelDraftData(id) {
return request({
url: `/draft/model2d/${id}`,
method: 'get',
})
}
/** 发布模型 */ /** 发布模型 */
export function publishModelDraft(id) { export function publishModelDraft(id) {
return request({ return request({

View File

@ -1294,7 +1294,7 @@ export const asyncRouter = [
}, },
}, },
{ {
path: 'usermodel/edit', path: 'usermodel/:id/edit',
name: 'userModelEdit', name: 'userModelEdit',
component: UserModelEdit, component: UserModelEdit,
hidden: true hidden: true

View File

@ -114,7 +114,7 @@ export default {
}, },
handleDraw(idx, data) { handleDraw(idx, data) {
this.$router.push({ name: "userModelEdit", params: data }); this.$router.push({ path: `usermodel/${data.id}/edit` });
}, },
handlePublish() {}, handlePublish() {},

View File

@ -3,7 +3,7 @@
</template> </template>
<script> <script>
import { updateModelDraftData } from "@/api/management/model"; import { updateModelDraftData, getModelDraftData } from "@/api/management/model";
export default { export default {
name: "editModel", name: "editModel",
data() { data() {
@ -15,14 +15,18 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log(this.$route.params); this.id = this.$route.params.id;
const params = this.$route.params; this.initModelData();
this.name = params.name;
this.id = params.id;
this.type = params.type || "";
this.model = JSON.parse(params.jsonData || "{}");
}, },
methods: { methods: {
initModelData() {
getModelDraftData(this.id).then(res => {
const data = res.data;
this.name = data.name;
this.type = data.type || "";
this.model = JSON.parse(data.jsonData || "");
});
},
onSave(payload) { onSave(payload) {
console.log(payload); console.log(payload);
const data = { const data = {
@ -35,7 +39,7 @@ export default {
this.$message("保存成功"); this.$message("保存成功");
}) })
.catch(e => { .catch(e => {
console.log(e); this.$message("error", e);
}); });
} }
} }