fix: 测试打包

This commit is contained in:
wam
2022-12-24 19:31:21 +08:00
parent c2cebb0384
commit 18af8b93bc
4 changed files with 6 additions and 247 deletions

View File

@@ -8,7 +8,7 @@ import DataStatistics from './route.datastatistics'
import { jsonp } from "vue-jsonp";
import { jsonpUrl } from "../config.js";
import { useStore } from "vuex";
import Creative from "./route.creative"; // 创作中心路由
// import Creative from "./route.creative"; // 创作中心路由
const store = useStore();
@@ -43,7 +43,7 @@ const constantRoutes = [
name: 'home',
redirect: '/home/project',
component: () => import(/* webpackChunkName: 'home' */ '@views/Home/Index.vue'),
children: [...ProjectManage, ...TemplateMarket, ...Contact, ...DocumentLibrary, ...DataStatistics, ...Creative]
children: [...ProjectManage, ...TemplateMarket, ...Contact, ...DocumentLibrary, ...DataStatistics]
},
{

View File

@@ -1,241 +0,0 @@
const fs = require('fs')
// const express = require('express')
const fileUpload = require('express-fileupload')
const jimp = require('jimp')
// const { setup_server_asset } = require('./server-asset')
const setup = ({ webSubPath, VERSION, tempPath, cleanWhenReload }) => {
if (cleanWhenReload) {
fs.rmdirSync(tempPath, { recursive: true })
fs.mkdirSync(tempPath)
}
let onBeforeSetupMiddleware = devServer => {
let app = devServer.app
// app.get(`/${webSubPath}-${VERSION}-api/surveyPages`, (req, res) => {
// // console.log('require pages:', req)
// res.json(gen_test_survey_pages(req.query.surveyId))
// })
// app.use(express.urlencoded({ extended: true }))
// app.use(express.json())
app.use(fileUpload())
// setup_server_asset(app, { webSubPath, VERSION })
/**
* @api {post} /shelves-v5-api/upload-panorama 上传全景图
* @apiGroup Uploader
* @apiDescription 生成 panorama, panorama small, panorama thumbnail
*/
app.post(`/${webSubPath}-${VERSION}-api/upload-panorama`, async (req, res) => {
// console.log('upload-panorama', req)
// res.json(gen_test_survey_pages(req.query.surveyId))
if (req.files) {
// console.log(req.files)
let file0 = req.files.file
// {name, data, size, encoding, tempFilePath, truncated, mimetype, md5, mv}
let skey = Math.random().toString(36).substring(2, 10)
let filename = `${skey}-${file0.name}`
let filename_sm = `${skey}-sm-${file0.name}`
let filename_tb = `${skey}-tb-${file0.name}`
let url = `/${webSubPath}-${VERSION}-store/temp/${filename}`
let urlSmall = `/${webSubPath}-${VERSION}-store/temp/${filename_sm}`
let urlThumb = `/${webSubPath}-${VERSION}-store/temp/${filename_tb}`
// console.log(file0)
fs.writeFileSync(`${tempPath}/${filename}`, file0.data)
//
let img = await jimp.read(`${tempPath}/${filename}`)
// img.bitmap.width, height
let h = img.bitmap.height
await img.resize(jimp.AUTO, h / 2)
await img.quality(60).writeAsync(`${tempPath}/${filename_sm}`)
// await img.cover(165 * 2, 165 * 2)
// await img.scale(2)
// await img.resize(165, 165)
// await img.quality(60).writeAsync(`${tempPath}/${filename_tb}`)
await img.cover(165, 165)
await img.writeAsync(`${tempPath}/${filename_tb}`)
res.send({
status: true,
message: 'File is uploaded',
data: {
name: file0.name,
mimetype: file0.mimetype,
size: file0.size,
filename,
url,
urlSmall,
urlThumb,
}
})
} else {
res.send({
status: false,
message: 'No file uploaded'
})
}
})
/**
* @api {post} /shelves-v5-api/upload-txture 上传纹理
* @apiGroup Uploader
* @apiDescription 生成 texture, texture small
*/
app.post(`/${webSubPath}-${VERSION}-api/upload-texture`, async (req, res) => {
// console.log('upload-panorama', req)
// res.json(gen_test_survey_pages(req.query.surveyId))
if (req.files) {
// console.log(req.files)
let file0 = req.files.file
// {name, data, size, encoding, tempFilePath, truncated, mimetype, md5, mv}
let filename = `${Math.random().toString(36).substring(2, 10)}-${file0.name}`
let url = `/${webSubPath}-${VERSION}-store/temp/${filename}`
// console.log(file0)
fs.writeFileSync(`${tempPath}/${filename}`, file0.data)
res.send({
status: true,
message: 'File is uploaded',
data: {
name: file0.name,
mimetype: file0.mimetype,
size: file0.size,
filename,
url,
}
})
} else {
res.send({
status: false,
message: 'No file uploaded'
})
}
})
/**
* @api {post} /shelves-v5-api/upload-image 上传图片
* @apiGroup Uploader
* @apiDescription 生成 image, image thumb
*/
app.post(`/${webSubPath}-${VERSION}-api/upload-image`, async (req, res) => {
if (req.files) {
// console.log(req.files)
let file0 = req.files.file
// console.log(file0)
// {name, data, size, encoding, tempFilePath, truncated, mimetype, md5, mv}
let skey = Math.random().toString(36).substring(2, 10)
let filename = `${skey}-${file0.name}`
let filename_tb = `${skey}-tb-${file0.name}`
let url = `/${webSubPath}-${VERSION}-store/temp/${filename}`
let urlThumb = `/${webSubPath}-${VERSION}-store/temp/${filename_tb}`
// console.log(file0)
fs.writeFileSync(`${tempPath}/${filename}`, file0.data)
let img = await jimp.read(`${tempPath}/${filename}`)
await img.cover(165, 165)
await img.quality(60).writeAsync(`${tempPath}/${filename_tb}`)
res.send({
status: true,
message: 'File is uploaded',
data: {
name: file0.name,
mimetype: file0.mimetype,
size: file0.size,
filename,
url,
urlThumb,
}
})
} else {
// console.log('no file uploaded!', req)
res.send({
status: false,
message: 'No file uploaded'
})
}
})
/**
* @api {post} /shelves-v5-api/upload-model 上传模型
* @apiGroup Uploader
* */
app.post(`/${webSubPath}-${VERSION}-api/upload-model`, async (req, res) => {
// console.log('upload-model', req)
if (req.files) {
// console.log(req.files)
let file0 = req.files.file
// {name, data, size, encoding, tempFilePath, truncated, mimetype, md5, mv}
let filename = `${Math.random().toString(36).substring(2, 10)}-${file0.name}`
let url = `/${webSubPath}-${VERSION}-store/temp/${filename}`
// console.log(file0)
fs.writeFileSync(`${tempPath}/${filename}`, file0.data)
res.send({
status: true,
message: 'File is uploaded',
data: {
name: file0.name,
mimetype: file0.mimetype,
size: file0.size,
filename,
url,
}
})
} else {
res.send({
status: false,
message: 'No file uploaded'
})
}
})
}
return {
onBeforeSetupMiddleware
}
}
module.exports = {
setup
}

View File

@@ -1,13 +1,13 @@
<template>
<div style="height: 100%;">
<!-- <AddWareWithSeparateTextureDemo v-if="modelData" :currentModelData="modelData" /> -->
<AddWareWithSeparateTextureDemo v-if="modelData" :currentModelData="modelData" />
</div>
</template>
<script setup>
import { reactive, ref } from "@vue/reactivity";
import { onMounted } from "@vue/runtime-core";
// import AddWareWithSeparateTextureDemo from "./3d/crossyo/shelves-vue-demo/view/AddWareWithSeparateTextureDemo.vue";
import AddWareWithSeparateTextureDemo from "./3d/crossyo/shelves-vue-demo/view/AddWareWithSeparateTextureDemo.vue";
import { getMaterialsById } from "./api";
import { useRoute } from "vue-router";

View File

@@ -1,13 +1,13 @@
<template>
<div style="height: 100%;">
<!-- <ShopEditorDemo v-if="shopData" :currentShopData="shopData" /> -->
<ShopEditorDemo v-if="shopData" :currentShopData="shopData" />
</div>
</template>
<script setup>
import { reactive, ref } from "@vue/reactivity";
import { onMounted } from "@vue/runtime-core";
// import ShopEditorDemo from "./3d/crossyo/shelves-vue-demo/view/ShopEditorDemo.vue";
import ShopEditorDemo from "./3d/crossyo/shelves-vue-demo/view/ShopEditorDemo.vue";
import { getMaterialsById } from "./api";
import { useRoute } from "vue-router";