From 0a99b1d5da22b8fdec44d14b12377488091758f9 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 19 Sep 2022 21:02:33 +0200 Subject: Model info page --- assets/sass/_models.sass | 6 ++++ package-lock.json | 30 +++++++++++++++++ package.json | 1 + pages/models/_id.vue | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ pages/models/index.vue | 3 ++ store/models.js | 23 +++++++++++++ 6 files changed, 149 insertions(+) create mode 100644 pages/models/_id.vue create mode 100644 pages/models/index.vue diff --git a/assets/sass/_models.sass b/assets/sass/_models.sass index e69de29..001a4ec 100644 --- a/assets/sass/_models.sass +++ b/assets/sass/_models.sass @@ -0,0 +1,6 @@ +#modelpage + .images + height: 30rem + + .grid-mini + grid-template-rows: 7rem diff --git a/package-lock.json b/package-lock.json index bcf3768..d8c72d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "pug": "^3.0.2", "pug-plain-loader": "^1.1.0", "vue": "^2.6.14", + "vue-3d-model": "^1.4.1", "vue-server-renderer": "^2.6.14", "vue-template-compiler": "^2.6.14", "vue-toastification": "^1.7.14", @@ -17713,6 +17714,11 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/three": { + "version": "0.135.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.135.0.tgz", + "integrity": "sha512-kuEpuuxRzLv0MDsXai9huCxOSQPZ4vje6y0gn80SRmQvgz6/+rI0NAvCRAw56zYaWKMGMfqKWsxF9Qa2Z9xymQ==" + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -18487,6 +18493,17 @@ "csstype": "^3.1.0" } }, + "node_modules/vue-3d-model": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/vue-3d-model/-/vue-3d-model-1.4.1.tgz", + "integrity": "sha512-IQjpqEjK1OLF/0XgF6O++IvOPLinLQ2aWZQFHxPFoTfPlB4vQW2sgv8EJSqpsIYC/wSCdGlP3CEnv9L3aZHlow==", + "dependencies": { + "three": "^0.135.0" + }, + "peerDependencies": { + "vue": ">=2.0.0" + } + }, "node_modules/vue-client-only": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.1.0.tgz", @@ -33795,6 +33812,11 @@ } } }, + "three": { + "version": "0.135.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.135.0.tgz", + "integrity": "sha512-kuEpuuxRzLv0MDsXai9huCxOSQPZ4vje6y0gn80SRmQvgz6/+rI0NAvCRAw56zYaWKMGMfqKWsxF9Qa2Z9xymQ==" + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -34381,6 +34403,14 @@ "csstype": "^3.1.0" } }, + "vue-3d-model": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/vue-3d-model/-/vue-3d-model-1.4.1.tgz", + "integrity": "sha512-IQjpqEjK1OLF/0XgF6O++IvOPLinLQ2aWZQFHxPFoTfPlB4vQW2sgv8EJSqpsIYC/wSCdGlP3CEnv9L3aZHlow==", + "requires": { + "three": "^0.135.0" + } + }, "vue-client-only": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.1.0.tgz", diff --git a/package.json b/package.json index 01a1623..bd01bbf 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "pug": "^3.0.2", "pug-plain-loader": "^1.1.0", "vue": "^2.6.14", + "vue-3d-model": "^1.4.1", "vue-server-renderer": "^2.6.14", "vue-template-compiler": "^2.6.14", "vue-toastification": "^1.7.14", diff --git a/pages/models/_id.vue b/pages/models/_id.vue new file mode 100644 index 0000000..89abf3a --- /dev/null +++ b/pages/models/_id.vue @@ -0,0 +1,86 @@ + + + diff --git a/pages/models/index.vue b/pages/models/index.vue new file mode 100644 index 0000000..3b1b689 --- /dev/null +++ b/pages/models/index.vue @@ -0,0 +1,3 @@ + diff --git a/store/models.js b/store/models.js index e2a0e30..23c612e 100644 --- a/store/models.js +++ b/store/models.js @@ -47,6 +47,29 @@ export const actions = { commit("loadingStatus", false, { root: true }); + return res; + }, + // Find a model by its id + async findModal({ commit }, id) { + commit("loadingStatus", true, { root: true }); + let res = { status: 0, data: null }; + let api = this.$config.api; + + await fetch(`${api}/v1/models/${id}`, { + headers: { + "Content-Type": "application/json", + }, + }) + .then(async (response) => { + res.data = await response.json(); + res.status = response.status; + }) + .catch((e) => { + res.status = e.status; + }); + + commit("loadingStatus", false, { root: true }); + return res; }, }; -- cgit v1.2.3-18-g5258