模型绘制页面

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": {
"axios": "^0.21.1",
"bjjl-engine-2d": "^1.0.14",
"bjjl-engine-2d": "^1.0.15",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"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) {
return request({

View File

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

View File

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

View File

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