任一存 il y a 2 ans
commit
c970ca1b1e

+ 4 - 0
.browserslistrc

@@ -0,0 +1,4 @@
+> 1%
+last 2 versions
+not dead
+not ie 11

+ 0 - 0
.env


+ 3 - 0
.env.dev

@@ -0,0 +1,3 @@
+CLI_MODE=dev
+NODE_ENV=development
+PUBLIC_PATH=/

+ 3 - 0
.env.prod

@@ -0,0 +1,3 @@
+CLI_MODE=prod
+NODE_ENV=production
+PUBLIC_PATH=/

+ 3 - 0
.env.test

@@ -0,0 +1,3 @@
+CLI_MODE=test
+NODE_ENV=production
+PUBLIC_PATH=/

+ 3 - 0
.eslintignore

@@ -0,0 +1,3 @@
+*/libs
+/node_modules
+/.vscode

+ 53 - 0
.eslintrc.js

@@ -0,0 +1,53 @@
+module.exports = {
+  root: true,
+  env: {
+    browser: true,
+    commonjs: true,
+    es6: true,
+    jest: true,
+    jquery: true,
+    node: true,
+  },
+  'extends': [
+    'plugin:vue/vue3-recommended',
+    'eslint:recommended'
+  ],
+  parserOptions: {
+    parser: '@babel/eslint-parser'
+  },
+  rules: {
+    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    'semi': ['error', 'never'],
+    "no-unused-vars": ["warn", {
+      "vars": "all",
+      "args": "after-used",
+      "ignoreRestSiblings": false
+    }],
+    "keyword-spacing": ["error", { "before": true, "after": true }],
+    "object-curly-spacing": ["error", "always"],
+    "space-infix-ops": ["error"],
+    'key-spacing': ["error", {
+      "mode": "strict"
+    }],
+    "comma-spacing": ["error", { "before": false, "after": true }],
+    "func-call-spacing": ["error", "never"],
+    "semi-spacing": ["error", { "before": false, "after": true }],
+    "space-before-blocks": ["error", "always"],
+    'no-trailing-spaces': 'error',
+    'no-multi-spaces': 'error',
+    "indent": ["error", 2],
+    'no-empty': 'off',
+    // 默认不启用:为了避免细微的 bug,最好直接从 Object.prototype 调用挂载于prototype上的方法方法。例如,foo.hasOwnProperty("bar") 应该替换为 Object.prototype.hasOwnProperty.call(foo, "bar")。
+    'no-prototype-builtins': "off",
+  },
+  globals: {
+    api: true,
+    config: true,
+    mapState: true,
+    mapGetters: true,
+    mapMutations: true,
+    store: true,
+    utils: true,
+  }
+}

+ 24 - 0
.gitignore

@@ -0,0 +1,24 @@
+.DS_Store
+node_modules
+/dist
+
+*.zip
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?

+ 4 - 0
README.md

@@ -0,0 +1,4 @@
+## 部署测试环境
+文件存放位置:
+
+访问url:

+ 9 - 0
babel.config.js

@@ -0,0 +1,9 @@
+module.exports = {
+  presets: [
+    '@vue/cli-plugin-babel/preset',
+  ],
+  // plugins: [
+  //   "transform-object-rest-spread",
+  //   "@babel/plugin-proposal-optional-chaining",
+  // ],
+}

+ 20 - 0
jsconfig.json

@@ -0,0 +1,20 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "module": "esnext",
+    "baseUrl": "./",
+    "moduleResolution": "node",
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": [
+      "esnext",
+      "dom",
+      "dom.iterable",
+      "scripthost"
+    ]
+  },
+  "exclude": ["libs", "node_modules"]
+}

+ 33 - 0
package.json

@@ -0,0 +1,33 @@
+{
+  "name": "my-app",
+  "version": "0.0.1",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve --mode dev",
+    "build-test": "vue-cli-service build --mode test",
+    "build-prod": "vue-cli-service build --mode prod",
+    "lint": "vue-cli-service lint"
+  },
+  "dependencies": {
+    "axios": "^1.1.3",
+    "core-js": "^3.8.3",
+    "dayjs": "^1.11.7",
+    "mitt": "^3.0.0",
+    "vue": "^3.2.13",
+    "vue-router": "^4.0.3",
+    "vuex": "^4.0.0"
+  },
+  "devDependencies": {
+    "@babel/core": "^7.12.16",
+    "@babel/eslint-parser": "^7.12.16",
+    "@vue/cli-plugin-babel": "~5.0.0",
+    "@vue/cli-plugin-eslint": "~5.0.0",
+    "@vue/cli-plugin-router": "~5.0.0",
+    "@vue/cli-plugin-vuex": "~5.0.0",
+    "@vue/cli-service": "~5.0.0",
+    "eslint": "^7.32.0",
+    "eslint-plugin-vue": "^8.0.3",
+    "less": "^4.0.0",
+    "less-loader": "^8.0.0"
+  }
+}

+ 22 - 0
public/index.html

@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
+    <link rel="icon" href="<%= BASE_URL %>logo.png">
+    <title>我是标题</title>
+  </head>
+  <body>
+    <!-- <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> -->
+    <noscript>
+      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
+    </noscript>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+
+    <script>
+      // new VConsole()
+    </script>
+  </body>
+</html>

BIN
public/logo.png


+ 114 - 0
src/App.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="comp-root">
+    <router-view />
+    <button
+      class="back"
+      @click="$router.push({naem: $route.meta.parentRouteName})"
+    >
+      <img
+        class=""
+        src="@/assets/images/btn-back.png"
+        alt=""
+        draggable="false"
+      >
+    </button>
+  </div>
+</template>
+
+<script>
+export default {
+  mounted() {
+    this.$mitt.on('test', e => {
+      console.log('test', e)
+    })
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.comp-root {
+  height: 100%;
+  width: 100%;
+  >button.back {
+    position: fixed;
+    width: 70px;
+    height: 72px;
+    right: 30px;
+    bottom: 70px;
+  }
+}
+</style>
+
+<style lang="less">
+// html, body {
+//   overscroll-behavior: none;
+//   overflow: hidden;
+// }
+
+// * {
+//   user-select: none;
+//   -webkit-touch-callout: none;
+// }
+
+#app {
+  height: 100%;
+  width: 100%;
+  position: relative;
+}
+
+// // 360浏览器不支持not()
+// input, textarea {
+//   user-select: initial;
+// }
+
+// 字体
+// @font-face {
+//   font-family: 'Source Han Serif CN';
+//   src: url('@/assets/style/SourceHanSerifCN-Regular.otf');
+// }
+// @font-face {
+//   font-family: 'Source Han Serif CN-Bold';
+//   src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
+// }
+// i {
+//   font-style: italic;
+// }
+
+// 滚动条
+// ::-webkit-scrollbar { background: #dddecc; width: 0.3rem; height: 0.3rem; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
+// ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 0.15rem; }
+// ::-webkit-scrollbar-corner { background: #dddecc; }
+
+// // vue组件过渡效果
+// .fade-out-leave-active {
+//   transition: opacity 1s;
+// }
+// .fade-out-leave-to {
+//   opacity: 0;
+// }
+
+// // 不断渐变显隐 animation
+// .animation-show-hide {
+//   animation: show-hide 1.8s infinite;
+// }
+// @keyframes show-hide {
+//   0% {
+//     opacity: 0;
+//   }
+//   50% {
+//     opacity: 1;
+//   }
+//   100% {
+//     opacity: 0;
+//   }
+// }
+
+// // vue-viewer
+// .viewer-container {
+//   background-color: rgba(0, 0, 0, 80%) !important;
+// }
+// 或者
+// .viewer-backdrop {
+//   background-color: rgba(0, 0, 0, 90%) !important;
+// }
+</style>

+ 17 - 0
src/api.js

@@ -0,0 +1,17 @@
+// import axios from "axios"
+
+// axios({
+//   method: 'post',
+//   url: `${config.backendDir}visit/saveType`,
+//   headers: {
+//     appId: "CA02F83A5FA162B930AA2F962D202F43B0F6DE0B51AD79FEDB03FA8202BB4909330105B3B347510D87C97060C4288280D4A744E00565A4EC",
+//     "Content-Type": "application/json",
+//   },
+//   data: {
+//     moduleType,
+//     type: 'visit',
+//   },
+// })
+
+export default {
+}

BIN
src/assets/images/bg-home.jpg


BIN
src/assets/images/bg-menu.png


BIN
src/assets/images/btn-back.png


BIN
src/assets/images/label-bg.png


BIN
src/assets/images/lion-female.png


BIN
src/assets/images/lion-male.png


+ 59 - 0
src/assets/style/my-reset.css

@@ -0,0 +1,59 @@
+* {
+  /* 阻止safari在用户交互设置一些元素的背景色 */
+  -webkit-tap-highlight-color: transparent;
+  box-sizing: border-box;
+}
+
+html {
+  overflow: hidden;
+  touch-action: none;
+  scroll-behavior: smooth; /* MDN: When this property is specified on the root element, it applies to the viewport instead. This property specified on the body element will not propagate to the viewport.(???) */
+  height: 100%;
+}
+
+body {
+  text-align: justify;
+  height: 100%;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+a {
+  color: initial;
+  text-decoration: initial;
+  outline: none;
+}
+
+button {
+  padding: 0;
+  cursor: pointer;
+  background-color: initial;
+  border: initial;
+  outline: none;
+  white-space: pre;
+}
+
+img {
+  user-select: none;
+}
+
+menu {
+  list-style-type: initial;
+}
+
+li {
+  display: initial;
+}
+
+input {
+  outline: initial;
+  background: initial;
+  border: initial;
+  border-radius: initial;
+  width: initial;
+  height: initial;
+}
+
+td {
+  vertical-align: inherit;
+}

+ 48 - 0
src/assets/style/reset.css

@@ -0,0 +1,48 @@
+/* http://meyerweb.com/eric/tools/css/reset/ 
+   v2.0 | 20110126
+   License: none (public domain)
+*/
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed, 
+figure, figcaption, footer, header, hgroup, 
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	font-size: 100%;
+	font: inherit;
+	vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure, 
+footer, header, hgroup, menu, nav, section {
+	display: block;
+}
+body {
+	line-height: 1;
+}
+ol, ul {
+	list-style: none;
+}
+blockquote, q {
+	quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+	content: '';
+	content: none;
+}
+table {
+	border-collapse: collapse;
+	border-spacing: 0;
+}

+ 2 - 0
src/config.js

@@ -0,0 +1,2 @@
+export default {
+}

+ 44 - 0
src/directives/v-click-outside.js

@@ -0,0 +1,44 @@
+export default {
+  install(app) {
+    app.directive('click-outside', {
+      mounted(el, binding) {
+        function documentHandler(e) {
+          if (el.contains(e.target)) {
+            return false
+          }
+          if (binding.value) {
+            binding.value(e)
+          }
+        }
+        el.__vueClickOutside__ = documentHandler
+        if (binding.modifiers.click) {
+          document.addEventListener('click', documentHandler, {
+            capture: binding.modifiers.capture
+          })
+        }
+        if (binding.modifiers.mousedown) {
+          document.addEventListener('mousedown', documentHandler, {
+            capture: binding.modifiers.capture
+          })
+        }
+        if (binding.modifiers.touchstart) {
+          document.addEventListener('touchstart', documentHandler, {
+            capture: binding.modifiers.capture
+          })
+        }
+      },
+      unMounted(el, binding) {
+        document.removeEventListener('click', el.__vueClickOutside__, {
+          capture: binding.modifiers.capture
+        })
+        document.removeEventListener('mousedown', el.__vueClickOutside__, {
+          capture: binding.modifiers.capture
+        })
+        document.removeEventListener('tarchstart', el.__vueClickOutside__, {
+          capture: binding.modifiers.capture
+        })
+        delete el.__vueClickOutside__
+      }
+    })
+  }
+}

Fichier diff supprimé car celui-ci est trop grand
+ 4 - 0
src/libs/ua-parser.min.js


+ 83 - 0
src/main.js

@@ -0,0 +1,83 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+import router from './router'
+import store from './store'
+import "@/assets/style/reset.css"
+import "@/assets/style/my-reset.css"
+import UAParser from "@/libs/ua-parser.min.js"
+import clickOutside from "@/directives/v-click-outside.js"
+import mitt from "mitt"
+// import 'viewerjs/dist/viewer.css'
+// import VueViewer from 'v-viewer'
+
+console.log(`version: ${process.env.VUE_APP_VERSION}`)
+console.log(`Build time: ${process.env.VUE_APP_UPDATE_TIME}`)
+
+const app = createApp(App)
+
+// 挂载配置信息
+app.config.globalProperties.$config = config
+app.config.globalProperties.$env = process.env
+
+// 挂载消息发布订阅中心
+app.config.globalProperties.$mitt = mitt()
+
+// 解析、挂载浏览器信息
+const uaParser = new UAParser()
+const uaInfo = uaParser.getResult()
+console.log('uaInfo: ', uaInfo)
+app.config.globalProperties.$uaInfo = uaInfo
+if (uaInfo.browser && uaInfo.browser.name === 'WeChat') {
+  app.config.globalProperties.$isWeChat = true
+}
+if (uaInfo.browser && uaInfo.browser.name === 'Safari') {
+  app.config.globalProperties.$isSafari = true
+}
+if (uaInfo.device.type === 'mobile') {
+  app.config.globalProperties.$isMobile = true
+}
+
+// 处理resize事件
+let windowWidthLast = window.innerWidth
+let windowHeightLast = window.innerHeight
+function onResize() {
+  if (window.innerWidth === windowWidthLast) {
+    // 发生了高度变化,认为发生了软键盘显隐
+    if (uaInfo.os.name === 'Android') {
+      if (window.innerHeight < windowHeightLast) {
+        // ...
+      } else if (window.innerHeight > windowHeightLast) {
+        // ...
+      }
+    }
+  }
+  windowWidthLast = window.innerWidth
+  windowHeightLast = window.innerHeight
+}
+window.addEventListener('resize', () => {
+  onResize()
+})
+
+// // 禁用上下文菜单
+// document.oncontextmenu = function(e) {
+//   e.preventDefault()
+// }
+
+// // safari里只能在交互行为的回调中成功地首次调用audio的play方法,所以需要一个全局的audio元素来播放随时可能需要自发播放的音频。
+// const audioNode = document.createElement("audio")
+// audioNode.id = 'global-audio'
+// audioNode.style.display = 'none'
+// audioNode.loop = true
+// document.body.appendChild(audioNode)
+
+app.use(store)
+  .use(router)
+  .use(clickOutside)
+  // .use(VueViewer)
+  // .component('HotSpot', HotSpot)
+  .mount('#app')
+
+// 必须在vue根组件挂载之后执行
+if (app.config.globalProperties.$isMobile) {
+  document.getElementById('app').classList.add('mobile')
+}

+ 98 - 0
src/router/index.js

@@ -0,0 +1,98 @@
+import { createRouter, createWebHashHistory } from 'vue-router'
+import HomeView from '../views/Home.vue'
+import Level2 from '../views/Level2.vue'
+import Level3 from '../views/Level3.vue'
+import WatchView from '../views/Watch.vue'
+import LearnView from '../views/Learn.vue'
+import TravelRecord from '../views/TravelRecord.vue'
+import BagView from '../views/Bag.vue'
+import JagsawGame from '../views/JagsawGame.vue'
+import BuildTown from '../views/BuildTown.vue'
+
+// import store from '@/store/index.js'
+
+const routes = [
+  {
+    path: '/',
+    name: 'HomeView',
+    component: HomeView,
+  },
+  {
+    path: '/l2',
+    name: 'Level2',
+    component: Level2,
+    meta: {
+      parentRouteName: 'HomeView',
+    }
+  },
+  {
+    path: '/l3',
+    name: 'Level3',
+    component: Level3,
+    meta: {
+      parentRouteName: 'Level2',
+    }
+  },
+  {
+    path: '/watch',
+    name: 'WatchView',
+    component: WatchView,
+    meta: {
+      parentRouteName: 'Level3',
+    }
+  },
+  {
+    path: '/learn',
+    name: 'LearnView',
+    component: LearnView,
+    meta: {
+      parentRouteName: 'Level3',
+    }
+  },
+  {
+    path: '/travel-record',
+    name: 'TravelRecord',
+    component: TravelRecord,
+    meta: {
+      parentRouteName: 'Level3',
+    }
+  },
+  {
+    path: '/bag',
+    name: 'BagView',
+    component: BagView,
+    meta: {
+      parentRouteName: 'WatchView',
+    }
+  },
+  {
+    path: '/jigsaw-game',
+    name: 'JagsawGame',
+    component: JagsawGame,
+    meta: {
+      parentRouteName: 'BagView',
+    }
+  },
+  {
+    path: '/build-town',
+    name: 'BuildTown',
+    component: BuildTown,
+    meta: {
+      parentRouteName: 'BagView',
+    }
+  },
+]
+
+const router = createRouter({
+  history: createWebHashHistory(),
+  routes
+})
+
+// router.beforeEach((to, from) => {
+//   // 生产环境下强制每次都从首页进入
+//   if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'HomeView') {
+//     return '/'
+//   }
+// })
+
+export default router

+ 18 - 0
src/store/index.js

@@ -0,0 +1,18 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+    usingChinese: true,
+  },
+  getters: {
+  },
+  mutations: {
+    setUsingChinese(state, value) {
+      state.usingChinese = value
+    },
+  },
+  actions: {
+  },
+  modules: {
+  }
+})

+ 70 - 0
src/utils.js

@@ -0,0 +1,70 @@
+export default {
+  /**
+   * 返回一个自带消抖效果的函数,用res表示。
+   *
+   * fn: 需要被消抖的函数
+   * delay: 消抖时长
+   * isImmediateCall: 是否在一组操作中的第一次调用时立即执行fn
+   * isRememberLastCall:是否在一组中最后一次调用后等delay时长再执行fn
+   */
+  debounce(fn, delay = 250, isImmediateCall = true, isRememberLastCall = true) {
+    console.assert(isImmediateCall || isRememberLastCall, 'isImmediateCall 和 isRememberLastCall 至少应有一个是true,否则没有意义!')
+    let timer = null
+    // 上次调用的时刻
+    let lastCallTime = 0
+
+    if (isImmediateCall && !isRememberLastCall) {
+      return function (...args) {
+        const currentTime = Date.now()
+        if (currentTime - lastCallTime >= delay) {
+          fn.apply(this, args)
+        }
+        lastCallTime = currentTime
+      }
+    } else if (!isImmediateCall && isRememberLastCall) {
+      return function (...args) {
+        if (timer) {
+          clearTimeout(timer)
+        }
+        timer = setTimeout(() => {
+          fn.apply(this, args)
+        }, delay)
+      }
+    } else if (isImmediateCall && isRememberLastCall) {
+      return function (...args) {
+        const currentTime = Date.now()
+        if (currentTime - lastCallTime >= delay) { // 一组操作中的第一次
+          fn.apply(this, args)
+          lastCallTime = currentTime
+          return
+        } else { // 一组中的后续调用
+          if (timer) { // 在此之前存在中间调用
+            lastCallTime = currentTime
+            clearTimeout(timer)
+          }
+          timer = setTimeout(() => {
+            fn.apply(this, args)
+            lastCallTime = 0
+            timer = null
+          }, delay)
+        }
+      }
+    } else {
+      console.error('不应该执行到这里!')
+    }
+  },
+  throttle(fn, interval = 250) {
+    let lastRunTime = 0
+
+    return function (...args) {
+      let elapsedTime = Date.now() - lastRunTime
+      if (elapsedTime < interval) {
+        return null
+      }
+
+      let context = this
+      lastRunTime = Date.now()
+      return fn.apply(context, args)
+    }
+  },
+}

+ 38 - 0
src/views/Bag.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/BuildTown.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 338 - 0
src/views/Home.vue

@@ -0,0 +1,338 @@
+<template>
+  <div
+    class="home"
+  >
+    <div class="lion-male">
+      <img
+        class="lion"
+        src="@/assets/images/lion-male.png"
+        alt=""
+        draggable="false"
+      >
+    </div>
+    <button
+      class="lion-female"
+      @click="isHideMenu = !isHideMenu"
+    >
+      <img
+        class="lion"
+        src="@/assets/images/lion-female.png"
+        alt=""
+        draggable="false"
+      >
+    </button>
+    <menu :class="{hide: isHideMenu}">
+      <div
+        v-for="(item1, idx) in menu"
+        :key="idx"
+        class="level1"
+      >
+        <h2>第{{ idx + 1 }}章&emsp;{{ item1.name }}</h2>
+        <div
+          v-for="(item2, idx) in item1.children"
+          :key="idx"
+          class="level2"
+        >
+          <h3>&ensp;{{ item2.name }}</h3>
+        </div>
+      </div>
+    </menu>
+
+    <button
+      v-for="(item, idx) in menu"
+      :key="idx"
+      class="label"
+      :style="{
+        left: labelPosList.value[idx]?.x + 'px' || '-500px',
+        bottom: labelPosList.value[idx]?.y + 'px' || '-500px',
+      }"
+    >
+      <div
+        :style="{
+          letterSpacing: (6 / item.name.length - 1) * 20 + 'px',
+          marginTop: (6 / item.name.length - 1) * 20 + 'px',
+        }"
+      >
+        {{ item.name }}
+      </div>
+    </button>
+  </div>
+</template>
+
+<script>
+import { onMounted, onUnmounted, watch, ref, reactive, computed } from "vue"
+
+export default {
+  name: 'HomeView',
+  setup() {
+    const bgImgWidth = 1920
+    const bgImgHeight = 1080
+    const labelPosList = reactive({ value: [] })
+    function computeActualWindowRatio() {
+      labelPosList.value = []
+      for (const iterator of menu) {
+        labelPosList.value.push(getLabelPos(iterator.pos))
+      }
+      console.log(labelPosList)
+    }
+    onMounted(() => {
+      computeActualWindowRatio()
+      window.addEventListener('resize', computeActualWindowRatio)
+    })
+    onUnmounted(() => {
+      window.removeEventListener('resize', computeActualWindowRatio)
+    })
+    // true: 实际窗口更宽扁,背景图与实际窗口等宽,上下被裁减
+    // false: 实际窗口更窄高,背景图与实际窗口等高,左右被裁减
+
+    function getLabelPos(posRaw) {
+      if (window.innerWidth / window.innerHeight > bgImgWidth / bgImgHeight) {
+        const scale = window.innerWidth / bgImgWidth
+        return {
+          x: posRaw.x * scale,
+          y: posRaw.y * scale - (bgImgHeight * scale - window.innerHeight) / 2,
+        }
+      } else {
+        const scale = window.innerHeight / bgImgHeight
+        return {
+          x: posRaw.x * scale - (bgImgWidth * scale - window.innerWidth) / 2,
+          y: posRaw.y * scale,
+        }
+      }
+    }
+
+    const isHideMenu = ref(true)
+    const menu = reactive([
+      {
+        name: '桃花源里人家',
+        pos: {
+          x: 540,
+          y: 273,
+        },
+
+        children: [
+          {
+            name: '文化溯源',
+          },
+          {
+            name: '画里乡村',
+          },
+          {
+            name: '水口园林',
+          },
+        ]
+      },
+      {
+        name: '牌坊',
+        pos: {
+          x: 248,
+          y: 414,
+        },
+        children: [
+          {
+            name: '认识牌坊',
+          },
+          {
+            name: '牌坊形制',
+          },
+          {
+            name: '牌坊构造',
+          },
+        ]
+      },
+      {
+        name: '祠堂',
+        pos: {
+          x: 1247,
+          y: 591,
+        },
+        children: [
+          {
+            name: '认识祠堂',
+          },
+          {
+            name: '祠堂的建筑艺术 ①',
+          },
+          {
+            name: '祠堂的建筑艺术 ②',
+          },
+        ]
+      },
+      {
+        name: '民居',
+        pos: {
+          x: 1389,
+          y: 355,
+        },
+        children: [
+          {
+            name: '认识民居',
+          },
+          {
+            name: '民居的营造 ①',
+          },
+          {
+            name: '民居的营造 ②',
+          },
+        ]
+      }, {
+        name: '匠心独运',
+        pos: {
+          x: 928,
+          y: 657,
+        },
+        children: [
+          {
+            name: '榫卯技艺',
+          },
+          {
+            name: '雕刻艺术 ①',
+          },
+          {
+            name: '雕刻艺术 ②',
+          },
+        ]
+      }, {
+        name: '拾遗',
+        pos: {
+          x: 746,
+          y: 446,
+        },
+        children: [
+          {
+            name: '其他建筑类型鉴赏',
+          },
+        ]
+      },
+    ])
+
+    return {
+      labelPosList,
+      isHideMenu,
+      menu,
+    }
+  },
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+  background-image: url(@/assets/images/bg-home.jpg);
+  background-size: cover;
+  background-repeat: no-repeat;
+  background-position: center center;
+  position: relative;
+  >.lion-male {
+    position: absolute;
+    width: 219px;
+    height: 206px;
+    left: 78px;
+    bottom: 48px;
+    >img {
+      position: absolute;
+      left: 0;
+      top: 0;
+      width: 100%;
+      height: 100%;
+    }
+  }
+  >.lion-female {
+    position: absolute;
+    width: 150px;
+    height: 193px;
+    right: 0;
+    top: 129px;
+    >img {
+      position: absolute;
+      left: 0;
+      top: 0;
+      width: 100%;
+      height: 100%;
+    }
+  }
+  >menu {
+    position: absolute;
+    padding-top: 35px;
+    padding-left: 66px;
+    padding-bottom: 25px;
+    width: 360px;
+    height: 765px;
+    top: 12px;
+    right: 22px;
+    background-image: url(@/assets/images/bg-menu.png);
+    background-size: contain;
+    background-repeat: no-repeat;
+    background-position: center center;
+    counter-reset: lalala;
+    transition: all 1s;
+    >.level1 {
+      font-size: 24px;
+      font-family: Source Han Sans CN-Bold, Source Han Sans CN;
+      font-weight: bold;
+      color: #2D241D;
+      line-height: 1.3;
+      margin-bottom: 24px;
+      cursor: pointer;
+      >.level2 {
+        font-size: 18px;
+        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
+        font-weight: 400;
+        color: #2D241D;
+        line-height: 1.3;
+        margin-bottom: 3px;
+        >h3 {
+          counter-increment: lalala;
+          &::before {
+            display: inline-block;
+            content: '第' counter(lalala) '课';
+          }
+        }
+      }
+    }
+    &.hide {
+      transform: translateX(110%);
+    }
+  }
+  >.label {
+    width: 55px;
+    height: 267px;
+    background-image: url(@/assets/images/label-bg.png);
+    background-size: cover;
+    background-repeat: no-repeat;
+    background-position: center center;
+    position: absolute;
+    font-size: 26px;
+    font-family: Source Han Sans CN-Regular, Source Han Sans CN;
+    font-weight: 400;
+    color: #2D241D;
+    writing-mode: vertical-lr;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    >div {
+      transform: translateX(-3px);
+    }
+  }
+}
+</style>

+ 38 - 0
src/views/JagsawGame.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/Learn.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/Level2.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/Level3.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/TravelRecord.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 38 - 0
src/views/Watch.vue

@@ -0,0 +1,38 @@
+<template>
+  <div
+    class="home"
+  >
+    {{ $env.BASE_URL }}
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'HomeView',
+  data() {
+    return {
+    }
+  },
+  computed: {
+    ...mapState([
+    ]),
+  },
+  mounted() {
+    console.log(process.env)
+    this.$mitt.emit('test', { msg: 'home mounted' })
+  },
+  unmounted() {
+  },
+  methods: {
+    ...mapMutations([
+    ]),
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 37 - 0
vue.config.js

@@ -0,0 +1,37 @@
+const webpack = require('webpack')
+const { defineConfig } = require('@vue/cli-service')
+
+process.env.VUE_APP_VERSION = require('./package.json').version
+
+const dayjs = require('dayjs')
+const time = dayjs().format('YYYY-M-D HH:mm:ss')
+process.env.VUE_APP_UPDATE_TIME = time
+
+module.exports = defineConfig({
+  publicPath: process.env.PUBLIC_PATH,
+  productionSourceMap: process.env.CLI_MODE === 'prod' ? false : true,
+  // transpileDependencies: true, // 默认false,表示babel-loader 会忽略所有 node_modules 中的文件
+  configureWebpack: {
+    module: {
+      rules: [
+        // {
+        //   test: /\.cur$/,
+        //   use: {
+        //     loader: 'file-loader'
+        //   }
+        // }
+      ]
+    },
+    plugins: [
+      new webpack.ProvidePlugin({
+        utils: ['/src/utils.js', 'default'],
+        store: ['/src/store/index.js', 'default'],
+        api: ['/src/api.js', 'default'],
+        config: ['/src/config.js', 'default'],
+        mapState: ['vuex', 'mapState'],
+        mapGetters: ['vuex', 'mapGetters'],
+        mapMutations: ['vuex', 'mapMutations'],
+      }),
+    ],
+  },
+})

Fichier diff supprimé car celui-ci est trop grand
+ 6328 - 0
yarn.lock