diff --git a/deploy.config.js b/deploy.config.js index ee400f9..11ba48e 100644 --- a/deploy.config.js +++ b/deploy.config.js @@ -18,10 +18,10 @@ module.exports = { // 环境对象 name: 'szxgl测试环境', // 环境名称 script: 'npm run build:dev', // 打包命令 - host: '120.25.121.117', // 服务器地址 + host: '39.108.110.167', // 服务器地址 port: 22, // 服务器端口号 username: 'front', // 服务器登录用户名 - password: 'Szxgl#3210', // 服务器登录密码 + password: 'XfhdFront', // 服务器登录密码 distPath: 'dist', // 本地打包生成目录 webDir: '/mnt/cdn/scl/webglToy', // webDir: "/mnt/services/tomcat-8090-test/webapps/test/front", // test替换自己实际项目目录 服务器部署路径(不可为空或'/') diff --git a/package.json b/package.json index 56c6bbd..02d16c7 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@babel/core": "^7.13.14", "@babel/plugin-transform-runtime": "^7.13.10", "@babel/preset-env": "^7.13.12", + "@handtracking.io/yoha": "^0.0.7", "@nutui/nutui": "^2.2.15", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", @@ -56,10 +57,14 @@ "axios": "^0.20.0", "babel-eslint": "^10.1.0", "babel-polyfill": "^6.26.0", + "coi-serviceworker": "^0.1.6", + "copy-webpack-plugin": "^4.4.1", "deploy-cli-service": "^1.2.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "glslify": "^7.1.1", + "handtrackjs": "^0.1.5", + "meshline": "^2.0.3", "qrcode": "^1.4.4", "stats.js": "^0.17.0", "style-resources-loader": "^1.3.2", @@ -95,4 +100,4 @@ "not dead", "not ie <= 8" ] -} \ No newline at end of file +} diff --git a/postcss.config.js b/postcss.config.js index 904fc87..58e1535 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -11,7 +11,7 @@ module.exports = { 'postcss-zindex': false }, "postcss-px2rem-exclude": { - remUnit: 37.5,//转换为rem的基准px + remUnit: 75,//转换为rem的基准px remPrecision: 8, //转换精度,小数点后保留位数 // exclude: /node_modules|folder_name/i }, diff --git a/src/assets/images/overlay.png b/src/assets/images/overlay.png new file mode 100644 index 0000000..a6a7b13 Binary files /dev/null and b/src/assets/images/overlay.png differ diff --git a/src/components/ar/hit.vue b/src/components/ar/hit.vue index 0259da2..6eab736 100644 --- a/src/components/ar/hit.vue +++ b/src/components/ar/hit.vue @@ -110,7 +110,7 @@ export default { this.controller = this.renderer.xr.getController(0); this.controller.addEventListener("select", () => { - let moved = new Date().getTime() - that.startTime > 500; + let moved = new Date().getTime() - that.startTime > 165; if (!moved) { this.addPumpkin(); } diff --git a/src/page/index/AR/index.vue b/src/page/index/AR/index.vue index 179e111..c2f5c69 100644 --- a/src/page/index/AR/index.vue +++ b/src/page/index/AR/index.vue @@ -7,34 +7,24 @@ * @FilePath: /xfhd-vue-scaffold/src/page/index/Home/Index.vue --> \ No newline at end of file diff --git a/src/page/index/ARHit/index.vue b/src/page/index/ARHit/index.vue index fcd9587..b680232 100644 --- a/src/page/index/ARHit/index.vue +++ b/src/page/index/ARHit/index.vue @@ -7,34 +7,24 @@ * @FilePath: /xfhd-vue-scaffold/src/page/index/Home/Index.vue --> \ No newline at end of file diff --git a/src/page/index/App.vue b/src/page/index/App.vue index bbef071..7b7e8ab 100644 --- a/src/page/index/App.vue +++ b/src/page/index/App.vue @@ -1,13 +1,16 @@ \ No newline at end of file diff --git a/src/page/index/Camera/index.vue b/src/page/index/Camera/index.vue new file mode 100644 index 0000000..b64137a --- /dev/null +++ b/src/page/index/Camera/index.vue @@ -0,0 +1,237 @@ + + + + + \ No newline at end of file diff --git a/src/page/index/Color/index.vue b/src/page/index/Color/index.vue index 606c820..6a352f1 100644 --- a/src/page/index/Color/index.vue +++ b/src/page/index/Color/index.vue @@ -7,34 +7,24 @@ * @FilePath: /xfhd-vue-scaffold/src/page/index/Home/Index.vue --> \ No newline at end of file diff --git a/src/page/index/HandTrack/index.vue b/src/page/index/HandTrack/index.vue new file mode 100644 index 0000000..464b12d --- /dev/null +++ b/src/page/index/HandTrack/index.vue @@ -0,0 +1,405 @@ + + + + \ No newline at end of file diff --git a/src/page/index/Home/index.vue b/src/page/index/Home/index.vue index 9891b87..7feafbc 100644 --- a/src/page/index/Home/index.vue +++ b/src/page/index/Home/index.vue @@ -7,168 +7,178 @@ * @FilePath: /xfhd-vue-scaffold/src/page/index/Home/Index.vue --> \ No newline at end of file diff --git a/src/page/index/main.js b/src/page/index/main.js index 3d3c4cc..1b26588 100644 --- a/src/page/index/main.js +++ b/src/page/index/main.js @@ -20,9 +20,9 @@ import { } from 'gsap' import '@/assets/css/reset.less' // import imgList from '@/preload/imgList.js' // 预加载资源图 -import weui from 'weui' -import '@/assets/css/weui-2.0.1.css'; -import '@/assets/css/weui-for-work.css' +// import weui from 'weui' +// import '@/assets/css/weui-2.0.1.css'; +// import '@/assets/css/weui-for-work.css' // import VueLazyload from 'vue-lazyload' lazyload 懒加载 // fix swiper6 with vue-awesome-swiper bug @@ -40,7 +40,7 @@ Vue.config.productionTip = false // 挂载工具集 Vue.prototype.$Utils = utils; // 引入 weui -Vue.prototype.$weui = weui +// Vue.prototype.$weui = weui // init xgl plugins utils.initial({ diff --git a/src/page/index/router/index.js b/src/page/index/router/index.js index a7075f4..6ddbfd5 100644 --- a/src/page/index/router/index.js +++ b/src/page/index/router/index.js @@ -12,6 +12,9 @@ import Home from '../Home/index.vue' import Color from '../Color/index.vue' import AR from '../AR/index.vue' import ARHit from '../ARHit/index.vue' +import Camera from '../Camera/index.vue' +import HandTrack from '../HandTrack/index.vue' + Vue.use(VueRouter) @@ -62,6 +65,26 @@ const routes = [ keepAlive: false, // 是否保持活跃 }, }, + { + path: "/camera", + name: "Camera", + component: Camera, + meta: { + title: "camera test", // 标题 + keepAlive: false, // 是否保持活跃 + }, + }, + { + path: "/track", + name: "HandTrack", + component: HandTrack, + meta: { + title: "Hand Track", // 标题 + keepAlive: false, // 是否保持活跃 + }, + }, + + // { // path: "/example", // name: "example", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..be5141a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "strict": true, + "strictNullChecks": true, + "esModuleInterop": true, + "experimentalDecorators": true + }, + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index d9e40a5..8a47eec 100644 --- a/vue.config.js +++ b/vue.config.js @@ -11,6 +11,7 @@ const path = require('path'); const CompressionPlugin = require('compression-webpack-plugin'); const vConsolePlugin = require("vconsole-webpack-plugin"); const TinyimgPlugin = require("tinyimg-webpack-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); function resolve(dir) { return path.join(__dirname, dir); @@ -83,7 +84,54 @@ module.exports = { logged: true })] + // 配置 copy plguins + let copyImg = [ + new CopyWebpackPlugin([ + // This is required so that yoha can load model files etc. + { from: 'node_modules/@handtracking.io/yoha/', to: 'yoha/' }, + // Required for github pages... + { from: 'node_modules/coi-serviceworker/coi-serviceworker.min.js', to: './' }, + ]) + ] + + + + + + + config.plugins = [...config.plugins, + ...pluginsDev, + ...tinyimg, + ...copyImg, + ]; + config.module.rules.push( + // ts加载 + { + test: /\.tsx?$/, + use: [ + { + loader: 'ts-loader', + options: { + transpileOnly: true, + appendTsSuffixTo: [/\.vue$/], + happyPackMode: true // 这个改为true + } + } + ] + }, + //wasm加载 + { + test: /\.wasm$/i, + use: [ + { + loader: 'file-loader', // 解决wasm加载问题 + options: { + name: './static/wasm/[name].[ext]' + } + } + ] + }, //模型加载 { test: /\.(stl|obj|fbx|mtl|glb|gltf)?$/, @@ -102,11 +150,6 @@ module.exports = { }] }) - config.plugins = [...config.plugins, - ...pluginsDev, - ...tinyimg - ]; - // 配置gzip压缩 if (process.env.NODE_ENV === 'production') { return {