From 21869ecf4153538e7068284d9a574a015ac5e872 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 19 Mar 2023 03:26:52 +0000 Subject: [PATCH] style: Format code with prettier Format code with prettier This commit fixes the style issues introduced in 3e663cb according to the output from prettier. Details: https://deepsource.io/gh/School-of-Website-Engineering/STARART/transform/d2b18705-8edd-4e12-9630-6a4f44d02f21/ --- .eslintrc.js | 110 +-- CHANGELOG.md | 126 ++-- CODE_OF_CONDUCT.md | 22 +- README.md | 44 +- babel.config.js | 22 +- jsconfig.json | 11 +- postcss.config.js | 18 +- public/index.html | 423 ++++++----- src/App.vue | 24 +- src/api/index.js | 8 +- src/assets/scss/_media.scss | 29 +- src/assets/scss/_variables.scss | 35 +- src/assets/scss/global.scss | 6 +- src/components/Footer/Footer.vue | 196 +++-- src/components/Header/Header.vue | 207 +++-- src/components/isLoading/index.vue | 363 +++++---- src/main.js | 32 +- src/router/index.js | 77 +- src/router/routes.js | 50 +- src/store/backpack/index.js | 96 +-- src/store/basicValue/index.js | 8 +- src/store/buff/index.js | 84 +-- src/store/exploreNotes/index.js | 110 +-- src/store/foods/index.js | 366 ++++----- src/store/index.js | 22 +- src/store/isShowLoading/index.js | 22 +- src/store/mapEvent/index.js | 66 +- src/store/player/index.js | 104 +-- src/store/runGroupEvent/index.js | 107 ++- src/store/timeState/index.js | 139 ++-- src/store/timer/index.js | 514 ++++++------- src/store/weatherSys/index.js | 112 +-- src/utils/flash.js | 51 +- src/utils/localStorage.js | 31 +- src/utils/request.js | 14 +- src/utils/sessionStorage.js | 31 +- src/views/index/bottomMenu/index.vue | 789 ++++++++++---------- src/views/index/components/bubbleDialog.vue | 166 ++-- src/views/index/components/channel-edit.vue | 76 +- src/views/index/components/dialog.vue | 90 +-- src/views/index/components/eventMap.vue | 188 ++--- src/views/index/components/exploreNotes.vue | 108 +-- src/views/index/event/index.vue | 258 +++---- src/views/index/event/tes.vue | 38 +- src/views/index/globalStatusBar/index.vue | 176 ++--- src/views/index/index.vue | 42 +- src/views/index/shortcutBar/index.vue | 186 +++-- src/views/index/textOutput/index.vue | 96 ++- src/views/openMap/index.vue | 80 +- vue.config.js | 8 +- 50 files changed, 2934 insertions(+), 3047 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9eabd1e..608c8de 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,59 +1,59 @@ module.exports = { - //root: true 用于指定它是最顶层的配置,即它在任何情况下都会被采用,而不会被继承覆盖 - root: true, - //env 指定代码运行的环境 - env : { - browser: true, - node : true, - es2021 : true, - es6 : true - }, - //extends 指定继承的配置 - extends : ["plugin:vue/essential"], - //plugins 指定使用的插件 - plugins : ["@typescript-eslint"], - // parserOptions 指定解析器选项 - parserOptions: { parser: "babel-eslint" }, - plugins : ["vue"], - // rules 指定自定义的规则 - rules : { - //自动对齐上下行等号 - "key-spacing" : ["error", { beforeColon: false, afterColon: true }], - eqeqeq : "off", - curly : "error", - quotes : ["error", "double"], - "arrow-parens" : 0, - "generator-star-spacing" : 0, - "no-unused-vars" : "warn", - "no-debugger" : process.env.NODE_ENV === "production" ? "error" : "off", - indent : [2, 4, { SwitchCase: 1 }], - "space-before-function-paren": ["error", "never"], - "no-constant-condition" : ["warn"], - "no-empty" : ["off"], - "comma-spacing" : ["error", { after: true }], - "key-spacing" : [ - "error", - { - singleLine: {}, - multiLine : { align: "colon" } - } - ], - "object-curly-newline" : ["error", { multiline: true }], - "array-bracket-newline": ["error", { multiline: true }], - curly : ["error", "all"], - quotes : ["error", "double"], - indent : ["error", "tab"], - "brace-style" : ["error", "stroustrup", { allowSingleLine: false }], - "space-infix-ops" : ["error"], - "comma-dangle" : ["warn", "never"] - }, - //overrides 指定某些文件的指定规则 */ - overrides: [ - { - files: ["*.vue"], - rules: { "vue/multi-word-component-names": 0 } - } - ] + //root: true 用于指定它是最顶层的配置,即它在任何情况下都会被采用,而不会被继承覆盖 + root: true, + //env 指定代码运行的环境 + env: { + browser: true, + node: true, + es2021: true, + es6: true, + }, + //extends 指定继承的配置 + extends: ["plugin:vue/essential"], + //plugins 指定使用的插件 + plugins: ["@typescript-eslint"], + // parserOptions 指定解析器选项 + parserOptions: { parser: "babel-eslint" }, + plugins: ["vue"], + // rules 指定自定义的规则 + rules: { + //自动对齐上下行等号 + "key-spacing": ["error", { beforeColon: false, afterColon: true }], + eqeqeq: "off", + curly: "error", + quotes: ["error", "double"], + "arrow-parens": 0, + "generator-star-spacing": 0, + "no-unused-vars": "warn", + "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", + indent: [2, 4, { SwitchCase: 1 }], + "space-before-function-paren": ["error", "never"], + "no-constant-condition": ["warn"], + "no-empty": ["off"], + "comma-spacing": ["error", { after: true }], + "key-spacing": [ + "error", + { + singleLine: {}, + multiLine: { align: "colon" }, + }, + ], + "object-curly-newline": ["error", { multiline: true }], + "array-bracket-newline": ["error", { multiline: true }], + curly: ["error", "all"], + quotes: ["error", "double"], + indent: ["error", "tab"], + "brace-style": ["error", "stroustrup", { allowSingleLine: false }], + "space-infix-ops": ["error"], + "comma-dangle": ["warn", "never"], + }, + //overrides 指定某些文件的指定规则 */ + overrides: [ + { + files: ["*.vue"], + rules: { "vue/multi-word-component-names": 0 }, + }, + ], }; /* diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eebae9..5d773d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,259 +2,223 @@ ## [1.4.1](https://github.com/School-of-Website-Engineering/STARART/compare/v1.4.0...v1.4.1) (2023-02-12) - ### update -* 动态获取版本号,添加游戏主界面路由守卫,添加路由,优化代码 ([ed6c04f](https://github.com/School-of-Website-Engineering/STARART/commit/ed6c04facdf9648e6620cb2a32d6f171726e822b)) - +- 动态获取版本号,添加游戏主界面路由守卫,添加路由,优化代码 ([ed6c04f](https://github.com/School-of-Website-Engineering/STARART/commit/ed6c04facdf9648e6620cb2a32d6f171726e822b)) ### Docs -* **contributor:** contrib-readme-action has updated readme ([27acc46](https://github.com/School-of-Website-Engineering/STARART/commit/27acc46bf1df78a355c6dd00a8e6d4755959251f)) +- **contributor:** contrib-readme-action has updated readme ([27acc46](https://github.com/School-of-Website-Engineering/STARART/commit/27acc46bf1df78a355c6dd00a8e6d4755959251f)) ## [1.4.0](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.6...v1.4.0) (2023-02-11) - ### Features -* 信息动态获取,拆分组件,提升代码可读性,微调快捷栏样式 ([7125354](https://github.com/School-of-Website-Engineering/STARART/commit/7125354a8305446a99753412302bc01da8554be5)) +- 信息动态获取,拆分组件,提升代码可读性,微调快捷栏样式 ([7125354](https://github.com/School-of-Website-Engineering/STARART/commit/7125354a8305446a99753412302bc01da8554be5)) ## [1.3.6](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.5...v1.3.6) (2023-02-11) - ### Code Refactoring -* 使用vuex传递数据以便与后端交互,性能优化 ([b9d44ac](https://github.com/School-of-Website-Engineering/STARART/commit/b9d44acaaab0f9a5fb392585c47e146be59ba92a)) +- 使用 vuex 传递数据以便与后端交互,性能优化 ([b9d44ac](https://github.com/School-of-Website-Engineering/STARART/commit/b9d44acaaab0f9a5fb392585c47e146be59ba92a)) ## [1.3.5](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.4...v1.3.5) (2023-02-07) - ### Bug Fixes -* 修复加载动画快捷栏层级 ([fa83f6d](https://github.com/School-of-Website-Engineering/STARART/commit/fa83f6d117c394fe020eb03083f35801751cce01)) +- 修复加载动画快捷栏层级 ([fa83f6d](https://github.com/School-of-Website-Engineering/STARART/commit/fa83f6d117c394fe020eb03083f35801751cce01)) ## [1.3.4](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.3...v1.3.4) (2023-02-06) - ### update -* 更新页面布局 ([746020d](https://github.com/School-of-Website-Engineering/STARART/commit/746020d86d7f5af5dab577131a3e89304ac9ef7e)) +- 更新页面布局 ([746020d](https://github.com/School-of-Website-Engineering/STARART/commit/746020d86d7f5af5dab577131a3e89304ac9ef7e)) ## [1.3.3](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.2...v1.3.3) (2023-02-06) - ### Reverts -* 回滚故障代码,新布局制作中... ([346e437](https://github.com/School-of-Website-Engineering/STARART/commit/346e437fb55f0c7e5c5229755268a1e5c819a7a8)) +- 回滚故障代码,新布局制作中... ([346e437](https://github.com/School-of-Website-Engineering/STARART/commit/346e437fb55f0c7e5c5229755268a1e5c819a7a8)) ## [1.3.2](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.1...v1.3.2) (2023-02-06) - ### Code Refactoring -* 重构vuex模块代码 ([563f09b](https://github.com/School-of-Website-Engineering/STARART/commit/563f09b382a660ac846f451a94af587780cec601)) +- 重构 vuex 模块代码 ([563f09b](https://github.com/School-of-Website-Engineering/STARART/commit/563f09b382a660ac846f451a94af587780cec601)) ## [1.3.1](https://github.com/School-of-Website-Engineering/STARART/compare/v1.3.0...v1.3.1) (2023-02-06) - ### update -* 更新当前天气与时间的显示 ([e880a1d](https://github.com/School-of-Website-Engineering/STARART/commit/e880a1d4a9e1f9c45a63c49c6f8b27b02d247a16)) +- 更新当前天气与时间的显示 ([e880a1d](https://github.com/School-of-Website-Engineering/STARART/commit/e880a1d4a9e1f9c45a63c49c6f8b27b02d247a16)) ## [1.3.0](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.8...v1.3.0) (2023-02-03) - ### Features -* 更新玩家属性及方法,时间系统,时间加速,时间减缓,时间暂停方法 ([808fd23](https://github.com/School-of-Website-Engineering/STARART/commit/808fd2300fc0879b7411c5f500816d35e3ea4528)) +- 更新玩家属性及方法,时间系统,时间加速,时间减缓,时间暂停方法 ([808fd23](https://github.com/School-of-Website-Engineering/STARART/commit/808fd2300fc0879b7411c5f500816d35e3ea4528)) ## [1.2.8](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.7...v1.2.8) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([bd5117f](https://github.com/School-of-Website-Engineering/STARART/commit/bd5117ff2c6f471322e4e4e3e5df127af4c3292a)) +- **contributor:** contrib-readme-action has updated readme ([bd5117f](https://github.com/School-of-Website-Engineering/STARART/commit/bd5117ff2c6f471322e4e4e3e5df127af4c3292a)) ## [1.2.7](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.6...v1.2.7) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([f18f3a0](https://github.com/School-of-Website-Engineering/STARART/commit/f18f3a0b9f4cd2ffd50f41207ae1075d9a4b0284)) +- **contributor:** contrib-readme-action has updated readme ([f18f3a0](https://github.com/School-of-Website-Engineering/STARART/commit/f18f3a0b9f4cd2ffd50f41207ae1075d9a4b0284)) ## [1.2.6](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.5...v1.2.6) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([126032f](https://github.com/School-of-Website-Engineering/STARART/commit/126032f97173535c8473c341940e8dfe1ac058fe)) -* **contributor:** contrib-readme-action has updated readme ([899076f](https://github.com/School-of-Website-Engineering/STARART/commit/899076f28fe1fd5d3f4b6b6c3f82851eb04227a2)) -* **contributor:** contrib-readme-action has updated readme ([f8aaab3](https://github.com/School-of-Website-Engineering/STARART/commit/f8aaab3e809481244f4310386936fbdc272e8346)) +- **contributor:** contrib-readme-action has updated readme ([126032f](https://github.com/School-of-Website-Engineering/STARART/commit/126032f97173535c8473c341940e8dfe1ac058fe)) +- **contributor:** contrib-readme-action has updated readme ([899076f](https://github.com/School-of-Website-Engineering/STARART/commit/899076f28fe1fd5d3f4b6b6c3f82851eb04227a2)) +- **contributor:** contrib-readme-action has updated readme ([f8aaab3](https://github.com/School-of-Website-Engineering/STARART/commit/f8aaab3e809481244f4310386936fbdc272e8346)) ## [1.2.6](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.5...v1.2.6) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([899076f](https://github.com/School-of-Website-Engineering/STARART/commit/899076f28fe1fd5d3f4b6b6c3f82851eb04227a2)) -* **contributor:** contrib-readme-action has updated readme ([f8aaab3](https://github.com/School-of-Website-Engineering/STARART/commit/f8aaab3e809481244f4310386936fbdc272e8346)) +- **contributor:** contrib-readme-action has updated readme ([899076f](https://github.com/School-of-Website-Engineering/STARART/commit/899076f28fe1fd5d3f4b6b6c3f82851eb04227a2)) +- **contributor:** contrib-readme-action has updated readme ([f8aaab3](https://github.com/School-of-Website-Engineering/STARART/commit/f8aaab3e809481244f4310386936fbdc272e8346)) ## [1.2.5](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.4...v1.2.5) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([5bc5576](https://github.com/School-of-Website-Engineering/STARART/commit/5bc557646900e184cb86ccc0a0ef034e910a7e3c)) -* **contributor:** contrib-readme-action has updated readme ([5ee728a](https://github.com/School-of-Website-Engineering/STARART/commit/5ee728a9ee1bae2c079ed36735ec14bce6af3880)) -* **contributor:** contrib-readme-action has updated readme ([628fa6f](https://github.com/School-of-Website-Engineering/STARART/commit/628fa6f8092102a8cd64fc0f9f461638a9a250df)) +- **contributor:** contrib-readme-action has updated readme ([5bc5576](https://github.com/School-of-Website-Engineering/STARART/commit/5bc557646900e184cb86ccc0a0ef034e910a7e3c)) +- **contributor:** contrib-readme-action has updated readme ([5ee728a](https://github.com/School-of-Website-Engineering/STARART/commit/5ee728a9ee1bae2c079ed36735ec14bce6af3880)) +- **contributor:** contrib-readme-action has updated readme ([628fa6f](https://github.com/School-of-Website-Engineering/STARART/commit/628fa6f8092102a8cd64fc0f9f461638a9a250df)) ## [1.2.5](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.4...v1.2.5) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([5ee728a](https://github.com/School-of-Website-Engineering/STARART/commit/5ee728a9ee1bae2c079ed36735ec14bce6af3880)) -* **contributor:** contrib-readme-action has updated readme ([628fa6f](https://github.com/School-of-Website-Engineering/STARART/commit/628fa6f8092102a8cd64fc0f9f461638a9a250df)) +- **contributor:** contrib-readme-action has updated readme ([5ee728a](https://github.com/School-of-Website-Engineering/STARART/commit/5ee728a9ee1bae2c079ed36735ec14bce6af3880)) +- **contributor:** contrib-readme-action has updated readme ([628fa6f](https://github.com/School-of-Website-Engineering/STARART/commit/628fa6f8092102a8cd64fc0f9f461638a9a250df)) ## [1.2.4](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.3...v1.2.4) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([9fe1841](https://github.com/School-of-Website-Engineering/STARART/commit/9fe184135902afc99bcfc53e9617fc491eff9b48)) -* **contributor:** contrib-readme-action has updated readme ([16bd632](https://github.com/School-of-Website-Engineering/STARART/commit/16bd6329c48812f71db524a03018d0fc7e5def99)) +- **contributor:** contrib-readme-action has updated readme ([9fe1841](https://github.com/School-of-Website-Engineering/STARART/commit/9fe184135902afc99bcfc53e9617fc491eff9b48)) +- **contributor:** contrib-readme-action has updated readme ([16bd632](https://github.com/School-of-Website-Engineering/STARART/commit/16bd6329c48812f71db524a03018d0fc7e5def99)) ## [1.2.3](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.2...v1.2.3) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([fc89a09](https://github.com/School-of-Website-Engineering/STARART/commit/fc89a0903592dcbfc5fa467c34f76a090f029ec8)) -* **contributor:** contrib-readme-action has updated readme ([462f8bc](https://github.com/School-of-Website-Engineering/STARART/commit/462f8bc266ba9ce625c7f4eacc02611bd1249083)) -* **contributor:** contrib-readme-action has updated readme ([5bd65c0](https://github.com/School-of-Website-Engineering/STARART/commit/5bd65c01b33a71ac2f8b02b2ded63a0831687d84)) +- **contributor:** contrib-readme-action has updated readme ([fc89a09](https://github.com/School-of-Website-Engineering/STARART/commit/fc89a0903592dcbfc5fa467c34f76a090f029ec8)) +- **contributor:** contrib-readme-action has updated readme ([462f8bc](https://github.com/School-of-Website-Engineering/STARART/commit/462f8bc266ba9ce625c7f4eacc02611bd1249083)) +- **contributor:** contrib-readme-action has updated readme ([5bd65c0](https://github.com/School-of-Website-Engineering/STARART/commit/5bd65c01b33a71ac2f8b02b2ded63a0831687d84)) ## [1.2.2](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.1...v1.2.2) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([57d1515](https://github.com/School-of-Website-Engineering/STARART/commit/57d1515cc74c3c7ace7733519d3d80ab425eca77)) +- **contributor:** contrib-readme-action has updated readme ([57d1515](https://github.com/School-of-Website-Engineering/STARART/commit/57d1515cc74c3c7ace7733519d3d80ab425eca77)) ## [1.2.2](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.1...v1.2.2) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([57d1515](https://github.com/School-of-Website-Engineering/STARART/commit/57d1515cc74c3c7ace7733519d3d80ab425eca77)) +- **contributor:** contrib-readme-action has updated readme ([57d1515](https://github.com/School-of-Website-Engineering/STARART/commit/57d1515cc74c3c7ace7733519d3d80ab425eca77)) ## [1.2.1](https://github.com/School-of-Website-Engineering/STARART/compare/v1.2.0...v1.2.1) (2023-02-03) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([b7a3572](https://github.com/School-of-Website-Engineering/STARART/commit/b7a357243b2b39511316fa86c1ec3a4b3e3729c5)) +- **contributor:** contrib-readme-action has updated readme ([b7a3572](https://github.com/School-of-Website-Engineering/STARART/commit/b7a357243b2b39511316fa86c1ec3a4b3e3729c5)) ## [1.2.0](https://github.com/School-of-Website-Engineering/STARART/compare/v1.1.2...v1.2.0) (2023-02-02) - ### Features -* 兼容各设备屏幕大小 ([b5f2ec1](https://github.com/School-of-Website-Engineering/STARART/commit/b5f2ec196b8aa0b201df19d4fdeb05a2bad93bb5)) +- 兼容各设备屏幕大小 ([b5f2ec1](https://github.com/School-of-Website-Engineering/STARART/commit/b5f2ec196b8aa0b201df19d4fdeb05a2bad93bb5)) ## [1.1.2](https://github.com/School-of-Website-Engineering/STARART/compare/v1.1.1...v1.1.2) (2023-02-01) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([03d6e4a](https://github.com/School-of-Website-Engineering/STARART/commit/03d6e4a8a94f5fbf3193935683369f4fe9529898)) +- **contributor:** contrib-readme-action has updated readme ([03d6e4a](https://github.com/School-of-Website-Engineering/STARART/commit/03d6e4a8a94f5fbf3193935683369f4fe9529898)) ## [1.1.1](https://github.com/School-of-Website-Engineering/STARART/compare/v1.1.0...v1.1.1) (2023-02-01) - ### update -* 添加媒体查询、更新布局 ([c733536](https://github.com/School-of-Website-Engineering/STARART/commit/c7335369b3b88a3b68f49a0fc0f37804685a9ea2)) +- 添加媒体查询、更新布局 ([c733536](https://github.com/School-of-Website-Engineering/STARART/commit/c7335369b3b88a3b68f49a0fc0f37804685a9ea2)) ## [1.1.0](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.10...v1.1.0) (2023-01-31) - ### Features -* 本地存储更改为会话存储 ([51b81a4](https://github.com/School-of-Website-Engineering/STARART/commit/51b81a4b524abb10bcde48cee255c1627a88cd77)) +- 本地存储更改为会话存储 ([51b81a4](https://github.com/School-of-Website-Engineering/STARART/commit/51b81a4b524abb10bcde48cee255c1627a88cd77)) ## [1.0.10](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.9...v1.0.10) (2023-01-31) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([53b52a2](https://github.com/School-of-Website-Engineering/STARART/commit/53b52a2263cb636ba01e4b99c02a02b6b87de4c0)) +- **contributor:** contrib-readme-action has updated readme ([53b52a2](https://github.com/School-of-Website-Engineering/STARART/commit/53b52a2263cb636ba01e4b99c02a02b6b87de4c0)) ## [1.0.9](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.8...v1.0.9) (2023-01-31) - ### update -* 增加postcss配置、载入动画 ([7b63103](https://github.com/School-of-Website-Engineering/STARART/commit/7b63103136caf5f3e44c351650b4c35d8c3ba799)) +- 增加 postcss 配置、载入动画 ([7b63103](https://github.com/School-of-Website-Engineering/STARART/commit/7b63103136caf5f3e44c351650b4c35d8c3ba799)) ## [1.0.8](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.7...v1.0.8) (2023-01-31) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([6fcc8a1](https://github.com/School-of-Website-Engineering/STARART/commit/6fcc8a15007b47d88a3c3e9baa1ee610589a4c39)) +- **contributor:** contrib-readme-action has updated readme ([6fcc8a1](https://github.com/School-of-Website-Engineering/STARART/commit/6fcc8a15007b47d88a3c3e9baa1ee610589a4c39)) ## [1.0.7](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.6...v1.0.7) (2023-01-30) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([888781f](https://github.com/School-of-Website-Engineering/STARART/commit/888781f38c1fa7edcb8573ce1b7f6815869f7a9b)) +- **contributor:** contrib-readme-action has updated readme ([888781f](https://github.com/School-of-Website-Engineering/STARART/commit/888781f38c1fa7edcb8573ce1b7f6815869f7a9b)) ## [1.0.6](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.5...v1.0.6) (2023-01-28) - ### Bug Fixes -* update to packjson ([84f6693](https://github.com/School-of-Website-Engineering/STARART/commit/84f66939b5e5687fc71a188e2db16097a8942eaf)) +- update to packjson ([84f6693](https://github.com/School-of-Website-Engineering/STARART/commit/84f66939b5e5687fc71a188e2db16097a8942eaf)) ## [1.0.5](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.4...v1.0.5) (2023-01-28) - ### update -* 修改配置文件 ([00f587c](https://github.com/School-of-Website-Engineering/STARART/commit/00f587cbf5fc593e470e4c04da92d4eda5964d6b)) +- 修改配置文件 ([00f587c](https://github.com/School-of-Website-Engineering/STARART/commit/00f587cbf5fc593e470e4c04da92d4eda5964d6b)) ## [1.0.4](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.3...v1.0.4) (2022-12-30) - ### Docs -* **contributor:** contrib-readme-action has updated readme ([58668da](https://github.com/School-of-Website-Engineering/STARART/commit/58668da79a6d5cb447ab8abf9814968f9c5a047f)) +- **contributor:** contrib-readme-action has updated readme ([58668da](https://github.com/School-of-Website-Engineering/STARART/commit/58668da79a6d5cb447ab8abf9814968f9c5a047f)) ## [1.0.3](https://github.com/School-of-Website-Engineering/STARART/compare/v1.0.2...v1.0.3) (2022-12-19) - ### Build System -* **deps:** bump akhilmhdh/contributors-readme-action ([41f22db](https://github.com/School-of-Website-Engineering/STARART/commit/41f22db4674e51e2e15d2b0234329a5f031f4d32)) +- **deps:** bump akhilmhdh/contributors-readme-action ([41f22db](https://github.com/School-of-Website-Engineering/STARART/commit/41f22db4674e51e2e15d2b0234329a5f031f4d32)) ## [1.0.2](https://github.com/School-of-Website-Engineering/Progressive-Tune/compare/v1.0.1...v1.0.2) (2022-12-02) - ### update -* update scss files ([081cc9a](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/081cc9afe7f3751d1fc2271e96ff8dd4b59819bb)) +- update scss files ([081cc9a](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/081cc9afe7f3751d1fc2271e96ff8dd4b59819bb)) ## [1.0.1](https://github.com/School-of-Website-Engineering/Progressive-Tune/compare/v1.0.0...v1.0.1) (2022-12-01) - ### update -* update eslint and prettierrc ([2b8071e](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/2b8071ee72b002452e7028f909a976827f6a0f83)) +- update eslint and prettierrc ([2b8071e](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/2b8071ee72b002452e7028f909a976827f6a0f83)) ## 1.0.0 (2022-12-01) - ### update -* create project in this ([4d63636](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/4d636368168cf91bc29cf29ea24069cf43f43f61)) +- create project in this ([4d63636](https://github.com/School-of-Website-Engineering/Progressive-Tune/commit/4d636368168cf91bc29cf29ea24069cf43f43f61)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index fd396c8..e0bcb7b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/README.md b/README.md index 06a992b..e73cba6 100644 --- a/README.md +++ b/README.md @@ -29,19 +29,19 @@ `STARART-星之往昔` 最开始因为 [@JDSA Ling](https://github.com/LingASDJ) 在 [Rosy-DR-Code-Ling](https://github.com/School-of-Website-Engineering/Rosy-DR-Code-Ling) -项目中了解到“ERR”需要让我们帮忙接管一个文字游戏,也就是海带酒的 `TinyWaste`项目需要优化。我们经过讨论,我们打算参考这个游戏重写一个,并改名为STARART-星之往昔,这个项目也就从这开始了。 +项目中了解到“ERR”需要让我们帮忙接管一个文字游戏,也就是海带酒的 `TinyWaste`项目需要优化。我们经过讨论,我们打算参考这个游戏重写一个,并改名为 STARART-星之往昔,这个项目也就从这开始了。 # Git 规范 ## Git 分支命名 -- `masin`:主分支,负责记录上线版本的迭代,该分支代码与线上代码是完全一致的。 -- `develop`:开发分支,该分支记录相对稳定的版本,所有的 feature 分支和 bugfix 分支都从该分支创建。其它分支为短期分支,其完成功能开发之后需要删除 -- `feature/*`:特性(功能)分支,用于开发新的功能,不同的功能创建不同的功能分支,功能分支开发完成并自测通过之后,需要合并到 develop 分支,之后删除该分支。 -- `bugfix/*`:bug 修复分支,用于修复不紧急的 bug,普通 bug 均需要创建 bugfix 分支开发,开发完成自测没问题后合并到 develop 分支后,删除该分支。 -- `release/*` - :发布分支,用于代码上线准备,该分支从 develop 分支创建,创建之后由测试发布到测试环境进行测试,测试过程中发现 bug 需要在该 release 分支上进行 bug 修复,所有 bug 修复完后,上线之前,需要合并该 release 分支到 masin 分支和 develop 分支。 -- `hotfix/`\*:紧急 bug 修复分支,该分支只有在紧急情况下使用,从 masin 分支创建,用于紧急修复线上 bug,修复完成后,需要合并该分支到 masin 分支以便上线,同时需要再合并到 develop 分支。 +- `masin`:主分支,负责记录上线版本的迭代,该分支代码与线上代码是完全一致的。 +- `develop`:开发分支,该分支记录相对稳定的版本,所有的 feature 分支和 bugfix 分支都从该分支创建。其它分支为短期分支,其完成功能开发之后需要删除 +- `feature/*`:特性(功能)分支,用于开发新的功能,不同的功能创建不同的功能分支,功能分支开发完成并自测通过之后,需要合并到 develop 分支,之后删除该分支。 +- `bugfix/*`:bug 修复分支,用于修复不紧急的 bug,普通 bug 均需要创建 bugfix 分支开发,开发完成自测没问题后合并到 develop 分支后,删除该分支。 +- `release/*` + :发布分支,用于代码上线准备,该分支从 develop 分支创建,创建之后由测试发布到测试环境进行测试,测试过程中发现 bug 需要在该 release 分支上进行 bug 修复,所有 bug 修复完后,上线之前,需要合并该 release 分支到 masin 分支和 develop 分支。 +- `hotfix/`\*:紧急 bug 修复分支,该分支只有在紧急情况下使用,从 masin 分支创建,用于紧急修复线上 bug,修复完成后,需要合并该分支到 masin 分支以便上线,同时需要再合并到 develop 分支。 # Git Commit Message 格式 @@ -49,15 +49,15 @@ ## type 提交类型: -- `revert:` 回滚代码 -- `feat:` 新特性 -- `fix:` 错误修复 -- `improvement:` 功能改进 -- `docs:` 文档修改 -- `perf:`性能修改 -- `test:`测试 -- `refactor:` 代码重构 -- `build:` 其他修改, 比如构建流程, 依赖管理 +- `revert:` 回滚代码 +- `feat:` 新特性 +- `fix:` 错误修复 +- `improvement:` 功能改进 +- `docs:` 文档修改 +- `perf:`性能修改 +- `test:`测试 +- `refactor:` 代码重构 +- `build:` 其他修改, 比如构建流程, 依赖管理 ## subject 提交描述 @@ -67,11 +67,11 @@ ## 相关仓库 -- [Rosy-DR-Code-Ling](https://github.com/School-of-Website-Engineering/Rosy-DR-Code-Ling) — 💌 Rosy-DR-Code-Ling 的 Web 页面 -- [E-commerce](https://github.com/Galaxy-Wish-Star/E-commerce) — 助农电商项目-Vue -- [Magic-Ling-Pixel-Dungeon](https://github.com/AnsdoShip/Magic-Ling-Pixel-Dungeon) — 魔绫像素地牢 -- [SkyHell](https://github.com/LingASDJ/SkyHell) — 天狱之境-TR -- [StarRiver](https://github.com/LingASDJ/StarRiver-EndlessJourney-RW-MODS) — 星河征途-铁锈战争 +- [Rosy-DR-Code-Ling](https://github.com/School-of-Website-Engineering/Rosy-DR-Code-Ling) — 💌 Rosy-DR-Code-Ling 的 Web 页面 +- [E-commerce](https://github.com/Galaxy-Wish-Star/E-commerce) — 助农电商项目-Vue +- [Magic-Ling-Pixel-Dungeon](https://github.com/AnsdoShip/Magic-Ling-Pixel-Dungeon) — 魔绫像素地牢 +- [SkyHell](https://github.com/LingASDJ/SkyHell) — 天狱之境-TR +- [StarRiver](https://github.com/LingASDJ/StarRiver-EndlessJourney-RW-MODS) — 星河征途-铁锈战争 ## 维护者 diff --git a/babel.config.js b/babel.config.js index 04fc5c8..5c2bcb6 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,14 +1,14 @@ -const prodPlugins - = process.env.NODE_ENV === "production" ? ["transform-remove-console"] : []; +const prodPlugins = + process.env.NODE_ENV === "production" ? ["transform-remove-console"] : []; module.exports = { - presets: ["@vue/cli-plugin-babel/preset"], - plugins: [ - ...prodPlugins, - [ - "import", - { libraryName: "vant", libraryDirectory: "es", style: true }, - "vant" - ] - ] + presets: ["@vue/cli-plugin-babel/preset"], + plugins: [ + ...prodPlugins, + [ + "import", + { libraryName: "vant", libraryDirectory: "es", style: true }, + "vant", + ], + ], }; diff --git a/jsconfig.json b/jsconfig.json index 4aafc5f..b6bd4c8 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -5,15 +5,8 @@ "baseUrl": "./", "moduleResolution": "node", "paths": { - "@/*": [ - "src/*" - ] + "@/*": ["src/*"] }, - "lib": [ - "esnext", - "dom", - "dom.iterable", - "scripthost" - ] + "lib": ["esnext", "dom", "dom.iterable", "scripthost"] } } diff --git a/postcss.config.js b/postcss.config.js index 92b0e0c..540850d 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,12 +1,12 @@ // postcss.config.js module.exports = { - plugins: { - "postcss-px2vp": { - viewportWidth(rule) { - const file = rule.source?.input.file; - return file?.includes("vant") ? 375 : 750; - }, - propList: ["*", "!font*", "!line-height", "!letter-spacing"] - } - } + plugins: { + "postcss-px2vp": { + viewportWidth(rule) { + const file = rule.source?.input.file; + return file?.includes("vant") ? 375 : 750; + }, + propList: ["*", "!font*", "!line-height", "!letter-spacing"], + }, + }, }; diff --git a/public/index.html b/public/index.html index 73889e1..caa2315 100644 --- a/public/index.html +++ b/public/index.html @@ -1,217 +1,212 @@ - - - - - - <%= htmlWebpackPlugin.options.title %> - - - - -
- - + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + +
+ + diff --git a/src/App.vue b/src/App.vue index 3b19749..3c011cf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,10 @@ diff --git a/src/api/index.js b/src/api/index.js index b1d22b7..619bd30 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,8 +1,8 @@ import request from "@/utils/request"; //获取 github 仓库最新版本号和版本号列表的 API export function getGithubReleases() { - return request({ - url : "https://api.github.com/repos/School-of-Website-Engineering/STARART/releases", - method: "get" - }); + return request({ + url: "https://api.github.com/repos/School-of-Website-Engineering/STARART/releases", + method: "get", + }); } diff --git a/src/assets/scss/_media.scss b/src/assets/scss/_media.scss index 4932b68..c72a5bd 100644 --- a/src/assets/scss/_media.scss +++ b/src/assets/scss/_media.scss @@ -1,26 +1,31 @@ -$bottomMenu-height: 30vh;//底部菜单 -$Menu-height: 29vh;//底部菜单 +$bottomMenu-height: 30vh; //底部菜单 +$Menu-height: 29vh; //底部菜单 $eventMenu-height: 34vh; //事件菜单 -$event-height: 32vh;//事件 -$globalStatusBar-height: 7vh;//全局状态栏 -$shortcutBar-height: 14vh;//快捷栏 -$textOutput-height: 6vh;//文本输出 +$event-height: 32vh; //事件 +$globalStatusBar-height: 7vh; //全局状态栏 +$shortcutBar-height: 14vh; //快捷栏 +$textOutput-height: 6vh; //文本输出 $body-width: 98%; $border-radius: 5px; -$border: .5px; +$border: 0.5px; -@media screen and (min-width: 480px) { // 移动设备 +@media screen and (min-width: 480px) { + // 移动设备 } -@media screen and (min-width: 481px) and (min-width: 768px) { // iPad、平板电脑 +@media screen and (min-width: 481px) and (min-width: 768px) { + // iPad、平板电脑 } -@media screen and (min-width: 769px) and (min-width: 1024px) { // 小屏幕、笔记本电脑 +@media screen and (min-width: 769px) and (min-width: 1024px) { + // 小屏幕、笔记本电脑 } -@media screen and (min-width: 1025px) and (min-width: 1200px) { // 台式机、大屏幕 +@media screen and (min-width: 1025px) and (min-width: 1200px) { + // 台式机、大屏幕 } -@media screen and (min-width: 1201px) { // 超大屏幕、电视 +@media screen and (min-width: 1201px) { + // 超大屏幕、电视 } diff --git a/src/assets/scss/_variables.scss b/src/assets/scss/_variables.scss index 58766fe..7b66c30 100644 --- a/src/assets/scss/_variables.scss +++ b/src/assets/scss/_variables.scss @@ -1,34 +1,33 @@ $content-width: 1226px; $component-height: 32px; -$font-family-medium: 'PingFangSC-Medium', Helvetica, Tahoma, Arial, 'Microsoft YaHei', - 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif; -$font-family-regular: 'PingFangSC-Regular', Helvetica, Tahoma, Arial, 'Microsoft YaHei', - 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif; +$font-family-medium: "PingFangSC-Medium", Helvetica, Tahoma, Arial, + "Microsoft YaHei", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif; +$font-family-regular: "PingFangSC-Regular", Helvetica, Tahoma, Arial, + "Microsoft YaHei", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif; @mixin font-class($fontFamily, $fontSize, $fontColor, $isBold) { - font-family: $fontFamily; - font-size: $fontSize; - @if $isBold { - font-weight: bold; - } - color: $fontColor; - letter-spacing: 0; + font-family: $fontFamily; + font-size: $fontSize; + @if $isBold { + font-weight: bold; + } + color: $fontColor; + letter-spacing: 0; } @mixin font-large($size: 14px, $color: $white, $isBlod: false) { - @include font-class($font-family-medium, $size, $color, $isBlod); + @include font-class($font-family-medium, $size, $color, $isBlod); } @mixin font-normal($size: 14px, $color: $white, $isBlod: false) { - @include font-class($font-family-regular, $size, $color, $isBlod); + @include font-class($font-family-regular, $size, $color, $isBlod); } /* 居中*/ @mixin center { - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); } - diff --git a/src/assets/scss/global.scss b/src/assets/scss/global.scss index 5f8d699..a84133a 100644 --- a/src/assets/scss/global.scss +++ b/src/assets/scss/global.scss @@ -28,9 +28,9 @@ .van-overlay { //只作用于第二个元素 - &:nth-child(2) { - background-color: rgba(0, 0, 0, .1) !important; - } + &:nth-child(2) { + background-color: rgba(0, 0, 0, 0.1) !important; + } } .dangerMsg { diff --git a/src/components/Footer/Footer.vue b/src/components/Footer/Footer.vue index 6ea9e2b..708ce31 100644 --- a/src/components/Footer/Footer.vue +++ b/src/components/Footer/Footer.vue @@ -1,109 +1,97 @@ + diff --git a/src/components/isLoading/index.vue b/src/components/isLoading/index.vue index dc4beb8..2824dc8 100644 --- a/src/components/isLoading/index.vue +++ b/src/components/isLoading/index.vue @@ -1,31 +1,29 @@ diff --git a/src/main.js b/src/main.js index 3dfb9b6..224b43b 100644 --- a/src/main.js +++ b/src/main.js @@ -5,19 +5,19 @@ import router from "./router"; import "./assets/scss/global.scss"; import "amfe-flexible"; import { - Button, - Col, - Loading, - NoticeBar, - Row, - Tag, - Badge, - icon, - cell, - Overlay, - Popup, - Toast, - List + Button, + Col, + Loading, + NoticeBar, + Row, + Tag, + Badge, + icon, + cell, + Overlay, + Popup, + Toast, + List, } from "vant"; Vue.use(List); @@ -38,7 +38,7 @@ Vue.use(Toast); Vue.prototype.$EventBus = new Vue(); new Vue({ - store, - router, - render: (h) => h(App) + store, + router, + render: (h) => h(App), }).$mount("#app"); diff --git a/src/router/index.js b/src/router/index.js index d7433a7..4d4e04b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -9,56 +9,53 @@ let originPush = VueRouter.prototype.push; let originReplace = VueRouter.prototype.replace; //重写VueRouter.prototype身上的push方法 -VueRouter.prototype.push = function(location, resolve, reject) { - if (reject && resolve) { - originPush.call(this, location, resolve, reject); - } - else { - originPush.call( - this, - location, - () => {}, - () => {} - ); - } +VueRouter.prototype.push = function (location, resolve, reject) { + if (reject && resolve) { + originPush.call(this, location, resolve, reject); + } else { + originPush.call( + this, + location, + () => {}, + () => {} + ); + } }; //重写VueRouter.prototype身上的replace方法 -VueRouter.prototype.replace = function(location, resolve, reject) { - if (reject && resolve) { - originReplace.call(this, location, resolve, reject); - } - else { - originReplace.call( - this, - location, - () => {}, - () => {} - ); - } +VueRouter.prototype.replace = function (location, resolve, reject) { + if (reject && resolve) { + originReplace.call(this, location, resolve, reject); + } else { + originReplace.call( + this, + location, + () => {}, + () => {} + ); + } }; const router = new VueRouter({ - routes, - scrollBehavior() { - return { y: 0 }; - }, - base: process.env.BASE_URL, - mode: "hash" + routes, + scrollBehavior() { + return { y: 0 }; + }, + base: process.env.BASE_URL, + mode: "hash", }); //路由守卫 router.beforeEach((to, from, next) => { - // to: 即将要进入的目标路由对象 - // from: 当前导航正要离开的路由对象 - // next: Function, 一定要调用该方法来resolve这个钩子 - const isShowLoading = sessionStorage.getItem("isShowLoading"); - if (to.path === "/index" && !isShowLoading) { - next({ path: "/mainView" }); - } - else { - next(); - } + // to: 即将要进入的目标路由对象 + // from: 当前导航正要离开的路由对象 + // next: Function, 一定要调用该方法来resolve这个钩子 + const isShowLoading = sessionStorage.getItem("isShowLoading"); + if (to.path === "/index" && !isShowLoading) { + next({ path: "/mainView" }); + } else { + next(); + } }); export default router; diff --git a/src/router/routes.js b/src/router/routes.js index af27cd9..0aaadc3 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,28 +1,26 @@ export default [ - //重定向 - { - path : "/", - redirect: "/mainView" - }, - { - path : "/codeling", - component: () => - import( - /* webpackChunkName: "eggs" */ "@/components/Header/Header.vue" - ), - name: "codeling" - }, - { - path : "/index", - component: () => - import(/* webpackChunkName: "index" */ "@/views/index/index.vue"), - name: "index" - }, - //游戏主界面 - { - path : "/mainView", - component: () => - import(/* webpackChunkName: "game" */ "@/components/isLoading"), - name: "mainView" - } + //重定向 + { + path: "/", + redirect: "/mainView", + }, + { + path: "/codeling", + component: () => + import(/* webpackChunkName: "eggs" */ "@/components/Header/Header.vue"), + name: "codeling", + }, + { + path: "/index", + component: () => + import(/* webpackChunkName: "index" */ "@/views/index/index.vue"), + name: "index", + }, + //游戏主界面 + { + path: "/mainView", + component: () => + import(/* webpackChunkName: "game" */ "@/components/isLoading"), + name: "mainView", + }, ]; diff --git a/src/store/backpack/index.js b/src/store/backpack/index.js index e49c2cd..ce41cf4 100644 --- a/src/store/backpack/index.js +++ b/src/store/backpack/index.js @@ -1,51 +1,51 @@ //背包模块,用于存储游戏中的物品 export default { - namespaced: true, - actions : {}, - mutations : { - //向物品缓存中添加物品 - addItemToCache(state, payload) { - state.backpackCache.push(payload); - }, - //从物品缓存中删除物品 - deleteItemFromCache(state, payload) { - state.backpackCache.splice(payload, 1); - }, - //清空物品缓存 - clearCache(state) { - state.backpackCache = []; - } - }, - state: { - // 玩家拥有的物品缓存 - backpackCache: [], - //背包物品列表 - backpackList : [ - { - itemId : 1, - itemName: "石头", - itemInfo: "一块普通的石头" - }, - { - itemId : 2, - itemName: "便便", - itemInfo: "一块普通的便便" - }, - { - itemId : 3, - itemName: "木棍", - itemInfo: "一根普通的木棍" - }, - { - itemId : 4, - itemName: "洞穴出口", - itemInfo: "一扇普通的洞穴出口" - }, - { - itemId : 5, - itemName: "床", - itemInfo: "一张普通的床" - } - ] - } + namespaced: true, + actions: {}, + mutations: { + //向物品缓存中添加物品 + addItemToCache(state, payload) { + state.backpackCache.push(payload); + }, + //从物品缓存中删除物品 + deleteItemFromCache(state, payload) { + state.backpackCache.splice(payload, 1); + }, + //清空物品缓存 + clearCache(state) { + state.backpackCache = []; + }, + }, + state: { + // 玩家拥有的物品缓存 + backpackCache: [], + //背包物品列表 + backpackList: [ + { + itemId: 1, + itemName: "石头", + itemInfo: "一块普通的石头", + }, + { + itemId: 2, + itemName: "便便", + itemInfo: "一块普通的便便", + }, + { + itemId: 3, + itemName: "木棍", + itemInfo: "一根普通的木棍", + }, + { + itemId: 4, + itemName: "洞穴出口", + itemInfo: "一扇普通的洞穴出口", + }, + { + itemId: 5, + itemName: "床", + itemInfo: "一张普通的床", + }, + ], + }, }; diff --git a/src/store/basicValue/index.js b/src/store/basicValue/index.js index 8819152..7de646a 100644 --- a/src/store/basicValue/index.js +++ b/src/store/basicValue/index.js @@ -1,7 +1,7 @@ // export default { - namespaced: true, - actions : {}, - mutations : {}, - state : {} + namespaced: true, + actions: {}, + mutations: {}, + state: {}, }; diff --git a/src/store/buff/index.js b/src/store/buff/index.js index fc0f7a4..b9ec639 100644 --- a/src/store/buff/index.js +++ b/src/store/buff/index.js @@ -1,45 +1,45 @@ // buff系统模块 export default { - namespaced: true, - state : { - buffTypes: [ - "liveRecovery", - "extremeSport", - "adrenalineRise", - "fullness", - "accurateStrike", - "purifyEnergy" - ], - // buff类型 - buffList: [] - // buff列表 - }, - mutations: { - // 添加buff - addBuff(state, obj) { - state.buffList.push(obj); - }, - // 删除buff - deleteBuff(state, type) { - // 获取buff列表 - const list = state.buffList; - for (let i = 0; i < list.length; i++) { - // 找到要删除的buff - if (list[i].type === type) { - // 删除 - list.splice(i, 1); - } - } - } - }, - actions: { - // 添加buff - addBuff(context, obj) { - context.commit("addBuff", obj); - }, - // 删除buff - deleteBuff(context, type) { - context.commit("deleteBuff", type); - } - } + namespaced: true, + state: { + buffTypes: [ + "liveRecovery", + "extremeSport", + "adrenalineRise", + "fullness", + "accurateStrike", + "purifyEnergy", + ], + // buff类型 + buffList: [], + // buff列表 + }, + mutations: { + // 添加buff + addBuff(state, obj) { + state.buffList.push(obj); + }, + // 删除buff + deleteBuff(state, type) { + // 获取buff列表 + const list = state.buffList; + for (let i = 0; i < list.length; i++) { + // 找到要删除的buff + if (list[i].type === type) { + // 删除 + list.splice(i, 1); + } + } + }, + }, + actions: { + // 添加buff + addBuff(context, obj) { + context.commit("addBuff", obj); + }, + // 删除buff + deleteBuff(context, type) { + context.commit("deleteBuff", type); + }, + }, }; diff --git a/src/store/exploreNotes/index.js b/src/store/exploreNotes/index.js index 9038b0d..a8ee554 100644 --- a/src/store/exploreNotes/index.js +++ b/src/store/exploreNotes/index.js @@ -1,58 +1,58 @@ //探索笔记模块,用于存储游戏中的探索笔记 export default { - namespaced: true, - actions : {}, - mutations : {}, - state : { - noteList: [ - { - noteId : 1, - noteTitle : "探索笔记1", - noteInfo : "探索笔记1的简介", - noteContent: "探索笔记1的内容" - }, - { - noteId : 2, - noteTitle : "探索笔记2", - noteInfo : "探索笔记2的简介", - noteContent: "探索笔记2的内容" - }, - { - noteId : 3, - noteTitle : "探索笔记3", - noteInfo : "探索笔记3的简介", - noteContent: "探索笔记3的内容" - }, - { - noteId : 4, - noteTitle : "探索笔记4", - noteInfo : "探索笔记4的简介", - noteContent: "探索笔记4的内容" - }, - { - noteId : 5, - noteTitle : "探索笔记5", - noteInfo : "探索笔记5的简介", - noteContent: "探索笔记5的内容" - }, - { - noteId : 6, - noteTitle : "探索笔记6", - noteInfo : "探索笔记6的简介", - noteContent: "探索笔记6的内容" - }, - { - noteId : 7, - noteTitle : "探索笔记7", - noteInfo : "探索笔记7的简介", - noteContent: "探索笔记7的内容" - } - ] - }, - getters: { - //获取探索笔记,返回一个对象 - getExploreNotes(state) { - return state.state; - } - } + namespaced: true, + actions: {}, + mutations: {}, + state: { + noteList: [ + { + noteId: 1, + noteTitle: "探索笔记1", + noteInfo: "探索笔记1的简介", + noteContent: "探索笔记1的内容", + }, + { + noteId: 2, + noteTitle: "探索笔记2", + noteInfo: "探索笔记2的简介", + noteContent: "探索笔记2的内容", + }, + { + noteId: 3, + noteTitle: "探索笔记3", + noteInfo: "探索笔记3的简介", + noteContent: "探索笔记3的内容", + }, + { + noteId: 4, + noteTitle: "探索笔记4", + noteInfo: "探索笔记4的简介", + noteContent: "探索笔记4的内容", + }, + { + noteId: 5, + noteTitle: "探索笔记5", + noteInfo: "探索笔记5的简介", + noteContent: "探索笔记5的内容", + }, + { + noteId: 6, + noteTitle: "探索笔记6", + noteInfo: "探索笔记6的简介", + noteContent: "探索笔记6的内容", + }, + { + noteId: 7, + noteTitle: "探索笔记7", + noteInfo: "探索笔记7的简介", + noteContent: "探索笔记7的内容", + }, + ], + }, + getters: { + //获取探索笔记,返回一个对象 + getExploreNotes(state) { + return state.state; + }, + }, }; diff --git a/src/store/foods/index.js b/src/store/foods/index.js index 8ca6f33..87077fb 100644 --- a/src/store/foods/index.js +++ b/src/store/foods/index.js @@ -1,186 +1,186 @@ //vuex中的食物系统模块,用于存储游戏中的食物数据 export default { - namespaced: true, - actions : {}, - mutations : {}, - state : { - foodList: [ - { - name : "水", - rarity: 1, - effect: "补充水分", - price : 0, - hunger: 0, - thirst: 2 - }, - { - name : "核废水", - rarity: 0, - effect: "70%核辐射中毒", - price : 0, - hunger: 0, - thirst: 1 - }, - { - name : "小麦", - rarity: 1, - effect: "无", - price : 10, - hunger: 3, - thirst: 0 - }, - { - name : "花生", - rarity: 1, - effect: "无", - price : 10, - hunger: 5, - thirst: 0 - }, - { - name : "辣椒", - rarity: 2, - effect: "20%肾上腺素飙升", - price : 30, - hunger: 5, - thirst: 0 - }, - { - name : "净水", - rarity: 2, - effect: "可以缓解San", - price : 0, - hunger: 4, - thirst: 1 - }, - { - name : "草药", - rarity: 3, - effect: "治疗效果", - price : 300, - hunger: 1, - thirst: 0 - }, - { - name : "生羊肉", - rarity: 2, - effect: "20%导致食物中毒", - price : 500, - hunger: 5, - thirst: 0 - }, - { - name : "熟羊肉", - rarity: 3, - effect: "治疗和极速效果", - price : 1000, - hunger: 10, - thirst: 0 - }, - { - name : "生鸡肉", - rarity: 1, - effect: "50%导致食物中毒", - price : 200, - hunger: 3, - thirst: 0 - }, - { - name : "熟鸡肉", - rarity: 3, - effect: "治疗和缓解San", - price : 500, - hunger: 12, - thirst: 0 - }, - { - name : "威士忌", - rarity: 4, - effect: "缓解San和认知力减弱", - price : 4000, - hunger: 0, - thirst: 2 - }, - { - name : "啤酒", - rarity: 3, - effect: "San降低,力量暂时提升", - price : 1050, - hunger: 0, - thirst: 3 - }, - { - name : "鸡尾酒", - rarity: 3, - effect: "暂缓饥饿,但San降低", - price : 3000, - hunger: 0, - thirst: 4 - }, - { - name : "萝卜", - rarity: 1, - effect: "无", - price : 80, - hunger: 5, - thirst: 0 - }, - { - name : "面包", - rarity: 2, - effect: "治疗和缓解San", - price : 500, - hunger: 8, - thirst: 0 - }, - { - name : "腐肉", - rarity: 1, - effect: "20%概率饥饿加剧", - price : 20, - hunger: 5, - thirst: 0 - }, - { - name : "生猪肉", - rarity: 3, - effect: "10%导致食物中毒", - price : 600, - hunger: 5, - thirst: 0 - }, - { - name : "熟猪肉", - rarity: 4, - effect: "力量永久提升,缓解San", - price : 3000, - hunger: 15, - thirst: 0 - }, - { - name : "巧克力", - rarity: 5, - effect: "天赋点+1", - price : 4050, - hunger: 10, - thirst: 0 - }, - { - name : "可可豆", - rarity: 3, - effect: "灵巧值永久提升", - price : 2000, - hunger: 3, - thirst: 0 - } - ], - // 金币计算公式 - coinRate: {bronze: 1, silver: 100, gold: 1000} - }, - getters: { - // 食物列表 - foodList: (state) => state.foodList, - // 金币转换汇率 - coinRate: (state) => state.coinRate - } + namespaced: true, + actions: {}, + mutations: {}, + state: { + foodList: [ + { + name: "水", + rarity: 1, + effect: "补充水分", + price: 0, + hunger: 0, + thirst: 2, + }, + { + name: "核废水", + rarity: 0, + effect: "70%核辐射中毒", + price: 0, + hunger: 0, + thirst: 1, + }, + { + name: "小麦", + rarity: 1, + effect: "无", + price: 10, + hunger: 3, + thirst: 0, + }, + { + name: "花生", + rarity: 1, + effect: "无", + price: 10, + hunger: 5, + thirst: 0, + }, + { + name: "辣椒", + rarity: 2, + effect: "20%肾上腺素飙升", + price: 30, + hunger: 5, + thirst: 0, + }, + { + name: "净水", + rarity: 2, + effect: "可以缓解San", + price: 0, + hunger: 4, + thirst: 1, + }, + { + name: "草药", + rarity: 3, + effect: "治疗效果", + price: 300, + hunger: 1, + thirst: 0, + }, + { + name: "生羊肉", + rarity: 2, + effect: "20%导致食物中毒", + price: 500, + hunger: 5, + thirst: 0, + }, + { + name: "熟羊肉", + rarity: 3, + effect: "治疗和极速效果", + price: 1000, + hunger: 10, + thirst: 0, + }, + { + name: "生鸡肉", + rarity: 1, + effect: "50%导致食物中毒", + price: 200, + hunger: 3, + thirst: 0, + }, + { + name: "熟鸡肉", + rarity: 3, + effect: "治疗和缓解San", + price: 500, + hunger: 12, + thirst: 0, + }, + { + name: "威士忌", + rarity: 4, + effect: "缓解San和认知力减弱", + price: 4000, + hunger: 0, + thirst: 2, + }, + { + name: "啤酒", + rarity: 3, + effect: "San降低,力量暂时提升", + price: 1050, + hunger: 0, + thirst: 3, + }, + { + name: "鸡尾酒", + rarity: 3, + effect: "暂缓饥饿,但San降低", + price: 3000, + hunger: 0, + thirst: 4, + }, + { + name: "萝卜", + rarity: 1, + effect: "无", + price: 80, + hunger: 5, + thirst: 0, + }, + { + name: "面包", + rarity: 2, + effect: "治疗和缓解San", + price: 500, + hunger: 8, + thirst: 0, + }, + { + name: "腐肉", + rarity: 1, + effect: "20%概率饥饿加剧", + price: 20, + hunger: 5, + thirst: 0, + }, + { + name: "生猪肉", + rarity: 3, + effect: "10%导致食物中毒", + price: 600, + hunger: 5, + thirst: 0, + }, + { + name: "熟猪肉", + rarity: 4, + effect: "力量永久提升,缓解San", + price: 3000, + hunger: 15, + thirst: 0, + }, + { + name: "巧克力", + rarity: 5, + effect: "天赋点+1", + price: 4050, + hunger: 10, + thirst: 0, + }, + { + name: "可可豆", + rarity: 3, + effect: "灵巧值永久提升", + price: 2000, + hunger: 3, + thirst: 0, + }, + ], + // 金币计算公式 + coinRate: { bronze: 1, silver: 100, gold: 1000 }, + }, + getters: { + // 食物列表 + foodList: (state) => state.foodList, + // 金币转换汇率 + coinRate: (state) => state.coinRate, + }, }; diff --git a/src/store/index.js b/src/store/index.js index 0f44cb0..289ea6a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,15 +13,15 @@ import exploreNotes from "@/store/exploreNotes"; Vue.use(Vuex); export default new Vuex.Store({ - modules: { - isShowLoading, - timer, - player, - foods, - basicValue, - timeState, - weatherSys, - mapEvent, - exploreNotes - } + modules: { + isShowLoading, + timer, + player, + foods, + basicValue, + timeState, + weatherSys, + mapEvent, + exploreNotes, + }, }); diff --git a/src/store/isShowLoading/index.js b/src/store/isShowLoading/index.js index af1d77d..6aca8c0 100644 --- a/src/store/isShowLoading/index.js +++ b/src/store/isShowLoading/index.js @@ -1,14 +1,14 @@ -import {getItem, setItem} from "@/utils/sessionStorage"; +import { getItem, setItem } from "@/utils/sessionStorage"; export default { - namespaced: true, - actions : {}, - mutations : { - //设置显示loading - setIsShowLoading(state, isShowLoading) { - state.isShowLoading = isShowLoading; - setItem("isShowLoading", isShowLoading); - } - }, - state: {isShowLoading: getItem("isShowLoading")} + namespaced: true, + actions: {}, + mutations: { + //设置显示loading + setIsShowLoading(state, isShowLoading) { + state.isShowLoading = isShowLoading; + setItem("isShowLoading", isShowLoading); + }, + }, + state: { isShowLoading: getItem("isShowLoading") }, }; diff --git a/src/store/mapEvent/index.js b/src/store/mapEvent/index.js index 7764706..729203d 100644 --- a/src/store/mapEvent/index.js +++ b/src/store/mapEvent/index.js @@ -1,36 +1,36 @@ //mapEvent.js export default { - namespaced: true, - actions : {}, - mutations : { - // 使用Vuex的commit方法提交一个mutation,将点击组件的数据传入store中,供其他组件使用 - setEventInfo(state, payload) { - state.mapEventInfo = payload; - } - }, - state: { - mapEventInfo: {}, - mapEvent : { - home: { name: "家", things: ["床", "桌子", "工作台"] }, - cave: { - name : "洞穴", - things: ["石头", "便便", "木棍", "洞穴出口"] - }, - ziYin : { name: "只因", things: ["邶贝", "只因你太美", "你干嘛"] }, - youDoWhat : { name: "蛋蛋", things: ["鸡", "太美", "你干嘛"] }, - pigeonNest: { - name : "鸽鸽的窝", - things: [ - "唱", - "跳", - "rap", - "篮球", - "music", - "鸡你太美", - "全民制作人们大家好" - ] - } - } - }, - getters: {} + namespaced: true, + actions: {}, + mutations: { + // 使用Vuex的commit方法提交一个mutation,将点击组件的数据传入store中,供其他组件使用 + setEventInfo(state, payload) { + state.mapEventInfo = payload; + }, + }, + state: { + mapEventInfo: {}, + mapEvent: { + home: { name: "家", things: ["床", "桌子", "工作台"] }, + cave: { + name: "洞穴", + things: ["石头", "便便", "木棍", "洞穴出口"], + }, + ziYin: { name: "只因", things: ["邶贝", "只因你太美", "你干嘛"] }, + youDoWhat: { name: "蛋蛋", things: ["鸡", "太美", "你干嘛"] }, + pigeonNest: { + name: "鸽鸽的窝", + things: [ + "唱", + "跳", + "rap", + "篮球", + "music", + "鸡你太美", + "全民制作人们大家好", + ], + }, + }, + }, + getters: {}, }; diff --git a/src/store/player/index.js b/src/store/player/index.js index 50091c5..4c6e7c2 100644 --- a/src/store/player/index.js +++ b/src/store/player/index.js @@ -1,55 +1,55 @@ //玩家属性值 export default { - namespaced: true, - actions : { - // 玩家的生命(Health)恢复速度上升5% - HealthUp({commit, state}) { - commit("updateHealth", state.Health + 5); - } - }, - mutations: { - //设置玩家属性值 - updateHealth(state, payload) { - state.Health = payload; - }, - updateDefense(state, payload) { - state.Defens = payload; - }, - updateBackpack(state, payload) { - state.Backpack = payload; - }, - updateWater(state, payload) { - state.Water = payload; - }, - updateHungry(state, payload) { - state.Hungry = payload; - }, - updateDex(state, payload) { - state.Dex = payload; - }, - updateChar(state, payload) { - state.Chars = payload; - }, - //设置玩家buff - // 玩家的生命(Health)恢复速度上升5% - HealthUp({commit, state}) { - commit("updateHealth", state.Health + 5); - } - }, - state: { - // 生命值 - Health : 50, - // 防御值 - Defens : 20, - // 背包容量 - Backpack: 5, - // 水量 - Water : 0, - // 饥饿值 - Hungry : 0, - // 当前灵巧值 - Dex : 20, - // 魅力值 - Chars : 20 - } + namespaced: true, + actions: { + // 玩家的生命(Health)恢复速度上升5% + HealthUp({ commit, state }) { + commit("updateHealth", state.Health + 5); + }, + }, + mutations: { + //设置玩家属性值 + updateHealth(state, payload) { + state.Health = payload; + }, + updateDefense(state, payload) { + state.Defens = payload; + }, + updateBackpack(state, payload) { + state.Backpack = payload; + }, + updateWater(state, payload) { + state.Water = payload; + }, + updateHungry(state, payload) { + state.Hungry = payload; + }, + updateDex(state, payload) { + state.Dex = payload; + }, + updateChar(state, payload) { + state.Chars = payload; + }, + //设置玩家buff + // 玩家的生命(Health)恢复速度上升5% + HealthUp({ commit, state }) { + commit("updateHealth", state.Health + 5); + }, + }, + state: { + // 生命值 + Health: 50, + // 防御值 + Defens: 20, + // 背包容量 + Backpack: 5, + // 水量 + Water: 0, + // 饥饿值 + Hungry: 0, + // 当前灵巧值 + Dex: 20, + // 魅力值 + Chars: 20, + }, }; diff --git a/src/store/runGroupEvent/index.js b/src/store/runGroupEvent/index.js index ce21374..8d8bcc9 100644 --- a/src/store/runGroupEvent/index.js +++ b/src/store/runGroupEvent/index.js @@ -2,66 +2,59 @@ //返回一个随机数(1~8) function getRandomNum(Min, Max) { - let Range = Max - Min; - let Rand = Math.random(); - return Min + Math.round(Rand * Range); + let Range = Max - Min; + let Rand = Math.random(); + return Min + Math.round(Rand * Range); } export default { - namespaced: true, - // 定义state - state : { - time: null, - day : null - }, + namespaced: true, + // 定义state + state: { + time: null, + day: null, + }, - // 定义Mutations - mutations: { - setTime(state, { time, day }) { - state.time = time; - state.day = day; - } - }, + // 定义Mutations + mutations: { + setTime(state, { time, day }) { + state.time = time; + state.day = day; + }, + }, - // 定义Actions - actions: { - // 设置时间 - setTime({ commit }, { time, day }) { - commit("setTime", time, day); - }, - // 探险 - Exploring({ commit }) { - let num = getRandomNum(1, 8); - if (num >= 6 && num <= 8) { - let randomNum = getRandomNum(1, 10); - if (randomNum >= 1 && randomNum <= 2) { - console.log("在任何一个资源地图区资源产出翻倍"); - } - else if (randomNum >= 3 && randomNum <= 6) { - console.log("怪物的刷新速度降低20%"); - } - else if (randomNum >= 7 && randomNum <= 8) { - console.log("玩家制造物品的速度提升20"); - } - else if (randomNum === 9) { - console.log("遭到敌袭"); - } - } - else if (num >= 3 && num <= 5) { - // 无逻辑处理 - } - else if (num >= 1 && num <= 2) { - let randomNum = getRandomNum(1, 10); - if (randomNum >= 1 && randomNum <= 4) { - console.log("炎热之时"); - } - else if (randomNum >= 5 && randomNum <= 8) { - console.log("遭到敌袭"); - } - else { - console.log("遇到原住民"); - } - } - } - } + // 定义Actions + actions: { + // 设置时间 + setTime({ commit }, { time, day }) { + commit("setTime", time, day); + }, + // 探险 + Exploring({ commit }) { + let num = getRandomNum(1, 8); + if (num >= 6 && num <= 8) { + let randomNum = getRandomNum(1, 10); + if (randomNum >= 1 && randomNum <= 2) { + console.log("在任何一个资源地图区资源产出翻倍"); + } else if (randomNum >= 3 && randomNum <= 6) { + console.log("怪物的刷新速度降低20%"); + } else if (randomNum >= 7 && randomNum <= 8) { + console.log("玩家制造物品的速度提升20"); + } else if (randomNum === 9) { + console.log("遭到敌袭"); + } + } else if (num >= 3 && num <= 5) { + // 无逻辑处理 + } else if (num >= 1 && num <= 2) { + let randomNum = getRandomNum(1, 10); + if (randomNum >= 1 && randomNum <= 4) { + console.log("炎热之时"); + } else if (randomNum >= 5 && randomNum <= 8) { + console.log("遭到敌袭"); + } else { + console.log("遇到原住民"); + } + } + }, + }, }; diff --git a/src/store/timeState/index.js b/src/store/timeState/index.js index cf2f4b0..7938123 100644 --- a/src/store/timeState/index.js +++ b/src/store/timeState/index.js @@ -1,77 +1,72 @@ //时间当前情景状态 export default { - namespaced: true, - // 提交 mutations 触发修改 - actions : { - setCurrentTime({ commit }, payload) { - commit("SET_CURRENT_TIME", payload); - } - }, - // 修改当前时间所对应的世界状态 , 怪物密度 和 生物密度 - mutations: { - SET_CURRENT_TIME(state, payload) { - state.currentTime = payload; - // 根据当前时间计算世界状态 , 怪物密度 和 生物密度, - // 时间 世界状态 怪物密度值 生物密度值 - // 00:00-04:59 凌晨深夜 4 1 - // 05:00-07:59 黎明到来 3 2 - // 08:00-11:59 早日清晨 2 3 - // 12:00-16:59 晌午时分 1 5 - // 17:00-19:59 傍晚降至 3 2 - // 20:00-23:59 夜幕降临 5 1 + namespaced: true, + // 提交 mutations 触发修改 + actions: { + setCurrentTime({ commit }, payload) { + commit("SET_CURRENT_TIME", payload); + }, + }, + // 修改当前时间所对应的世界状态 , 怪物密度 和 生物密度 + mutations: { + SET_CURRENT_TIME(state, payload) { + state.currentTime = payload; + // 根据当前时间计算世界状态 , 怪物密度 和 生物密度, + // 时间 世界状态 怪物密度值 生物密度值 + // 00:00-04:59 凌晨深夜 4 1 + // 05:00-07:59 黎明到来 3 2 + // 08:00-11:59 早日清晨 2 3 + // 12:00-16:59 晌午时分 1 5 + // 17:00-19:59 傍晚降至 3 2 + // 20:00-23:59 夜幕降临 5 1 - //转化时间为小时与分钟(0:00-23:59)分割":" - let time = state.currentTime.split(":"); - //转化为小时与分钟(0-23)(0-59) - let hour = parseInt(time[0]); - //parseInt() 函数可解析一个字符串,并返回一个整数。 - let minute = parseInt(time[1]); - //计算当前时间的分钟数 - let minuteCount = hour * 60 + minute; - //根据当前时间的分钟数计算世界状态 , 怪物密度 和 生物密度 - if (minuteCount >= 0 && minuteCount < 300) { - state.worldStatus = "凌晨深夜"; - state.monsterDensity = 4; - state.creatureDensity = 1; - } - else if (minuteCount >= 300 && minuteCount < 480) { - state.worldStatus = "黎明到来"; - state.monsterDensity = 3; - state.creatureDensity = 2; - } - else if (minuteCount >= 480 && minuteCount < 720) { - state.worldStatus = "早日清晨"; - state.monsterDensity = 2; - state.creatureDensity = 3; - } - else if (minuteCount >= 720 && minuteCount < 1020) { - state.worldStatus = "晌午时分"; - state.monsterDensity = 1; - state.creatureDensity = 5; - } - else if (minuteCount >= 1020 && minuteCount < 1200) { - state.worldStatus = "傍晚降至"; - state.monsterDensity = 3; - state.creatureDensity = 2; - } - else if (minuteCount >= 1200 && minuteCount < 1440) { - state.worldStatus = "夜幕降临"; - state.monsterDensity = 5; - state.creatureDensity = 1; - } - } - }, - // 存储当前游戏时间, 世界状态 , 怪物密度 和 生物密度 的状态 - state: { - // 当前游戏时间 - //载入timer游戏时间 - currentTime : 0, - // 当前世界状态 - worldStatus : "", - // 当前怪物密度 - monsterDensity : 0, - // 当前生物密度 - creatureDensity: 0 - } + //转化时间为小时与分钟(0:00-23:59)分割":" + let time = state.currentTime.split(":"); + //转化为小时与分钟(0-23)(0-59) + let hour = parseInt(time[0]); + //parseInt() 函数可解析一个字符串,并返回一个整数。 + let minute = parseInt(time[1]); + //计算当前时间的分钟数 + let minuteCount = hour * 60 + minute; + //根据当前时间的分钟数计算世界状态 , 怪物密度 和 生物密度 + if (minuteCount >= 0 && minuteCount < 300) { + state.worldStatus = "凌晨深夜"; + state.monsterDensity = 4; + state.creatureDensity = 1; + } else if (minuteCount >= 300 && minuteCount < 480) { + state.worldStatus = "黎明到来"; + state.monsterDensity = 3; + state.creatureDensity = 2; + } else if (minuteCount >= 480 && minuteCount < 720) { + state.worldStatus = "早日清晨"; + state.monsterDensity = 2; + state.creatureDensity = 3; + } else if (minuteCount >= 720 && minuteCount < 1020) { + state.worldStatus = "晌午时分"; + state.monsterDensity = 1; + state.creatureDensity = 5; + } else if (minuteCount >= 1020 && minuteCount < 1200) { + state.worldStatus = "傍晚降至"; + state.monsterDensity = 3; + state.creatureDensity = 2; + } else if (minuteCount >= 1200 && minuteCount < 1440) { + state.worldStatus = "夜幕降临"; + state.monsterDensity = 5; + state.creatureDensity = 1; + } + }, + }, + // 存储当前游戏时间, 世界状态 , 怪物密度 和 生物密度 的状态 + state: { + // 当前游戏时间 + //载入timer游戏时间 + currentTime: 0, + // 当前世界状态 + worldStatus: "", + // 当前怪物密度 + monsterDensity: 0, + // 当前生物密度 + creatureDensity: 0, + }, }; diff --git a/src/store/timer/index.js b/src/store/timer/index.js index fa95f1f..9ca7f6b 100644 --- a/src/store/timer/index.js +++ b/src/store/timer/index.js @@ -5,275 +5,257 @@ import { addClassName } from "@/utils/flash"; //随机返回字符串 function getRandomWeather() { - let weather = [ - "新的一天开始,进行骰子鉴定", - "新的一天到来,开始骰子鉴定", - "每天开始都会进行骰子鉴定,骰子开始鉴定", - "骰子鉴定开始", - "骰子开始鉴定", - "开始进行骰子鉴定" - ]; - let num = Math.floor(Math.random() * 6); - return weather[num]; + let weather = [ + "新的一天开始,进行骰子鉴定", + "新的一天到来,开始骰子鉴定", + "每天开始都会进行骰子鉴定,骰子开始鉴定", + "骰子鉴定开始", + "骰子开始鉴定", + "开始进行骰子鉴定", + ]; + let num = Math.floor(Math.random() * 6); + return weather[num]; } export default { - namespaced: true, - actions : { - // 改变游戏世界时间,每秒改变一次,初始化时调用 - changeTime({ commit, state }) { - let minutes = state.minutes, - hours = state.hours, - Day = state.toDay; - setInterval(() => { - if (state.speed !== 0) { - minutes++; - if (minutes > 59) { - minutes = 0; - hours++; - } - if (hours > 24) { - Day++; - hours = 0; - //调用weatherSys vuex模块的mutations中的UPDATE_WEATHER_STATUS - store.commit("weatherSys/UPDATE_WEATHER_STATUS"); - addClassName(".time-list", ["alertMsg", ""]); - //调用timer vuex模块的mutations中的runGroup - store.commit("timer/runGroup"); - } - commit("updateTime", { hours, minutes, Day }); - } - }, state.speed * 1000); - }, - // 改变加速倍数 - changeSpeed({ commit }, speed) { - commit("updateSpeed", { speed }); - }, - // 暂停游戏时间 - pauseTime({ commit }) { - commit("pauseTime"); - }, - // 恢复游戏时间 - resumeTime({ commit }) { - commit("updateSpeed", { speed: 1 }); - }, - //添加聊天框 - addChatBox({ commit }, chatBox) { - commit("ADD_CHATBOX", chatBox); - }, - // 删除聊天框 - deleteChatBox({ commit }, index) { - commit("DELETE_CHATBOX", index); - }, - // 更新聊天框 - updateChatBox({ commit }, payload) { - commit("UPDATE_CHATBOX", payload); - } - }, - mutations: { - //设置时间 - // 更新游戏世界时间 - updateTime(state, { hours, minutes, Day }) { - state.hours = hours; - state.minutes = minutes; - state.toDay = Day; - }, - // 更新游戏世界天数 - updateToDay(state, toDay) { - state.toDay = toDay; - }, - // 更新加速参数 - updateSpeed(state, { speed }) { - state.speed = speed; - }, - // 暂停游戏世界时间 - pauseTime(state) { - state.speed = 0; - }, - // 恢复游戏世界时间 - resumeTime(state) { - state.speed = 1; - }, + namespaced: true, + actions: { + // 改变游戏世界时间,每秒改变一次,初始化时调用 + changeTime({ commit, state }) { + let minutes = state.minutes, + hours = state.hours, + Day = state.toDay; + setInterval(() => { + if (state.speed !== 0) { + minutes++; + if (minutes > 59) { + minutes = 0; + hours++; + } + if (hours > 24) { + Day++; + hours = 0; + //调用weatherSys vuex模块的mutations中的UPDATE_WEATHER_STATUS + store.commit("weatherSys/UPDATE_WEATHER_STATUS"); + addClassName(".time-list", ["alertMsg", ""]); + //调用timer vuex模块的mutations中的runGroup + store.commit("timer/runGroup"); + } + commit("updateTime", { hours, minutes, Day }); + } + }, state.speed * 1000); + }, + // 改变加速倍数 + changeSpeed({ commit }, speed) { + commit("updateSpeed", { speed }); + }, + // 暂停游戏时间 + pauseTime({ commit }) { + commit("pauseTime"); + }, + // 恢复游戏时间 + resumeTime({ commit }) { + commit("updateSpeed", { speed: 1 }); + }, + //添加聊天框 + addChatBox({ commit }, chatBox) { + commit("ADD_CHATBOX", chatBox); + }, + // 删除聊天框 + deleteChatBox({ commit }, index) { + commit("DELETE_CHATBOX", index); + }, + // 更新聊天框 + updateChatBox({ commit }, payload) { + commit("UPDATE_CHATBOX", payload); + }, + }, + mutations: { + //设置时间 + // 更新游戏世界时间 + updateTime(state, { hours, minutes, Day }) { + state.hours = hours; + state.minutes = minutes; + state.toDay = Day; + }, + // 更新游戏世界天数 + updateToDay(state, toDay) { + state.toDay = toDay; + }, + // 更新加速参数 + updateSpeed(state, { speed }) { + state.speed = speed; + }, + // 暂停游戏世界时间 + pauseTime(state) { + state.speed = 0; + }, + // 恢复游戏世界时间 + resumeTime(state) { + state.speed = 1; + }, - runGroup(state) { - // 生存评估期--第1天到第7天[准备期] - // 生存鉴定期--第8天到第10天(更多事件和区域解锁) - // 生存高危期--第11天到第13天(更多高危事件和隐藏区域解锁) - // 生存探索期--第14天以上(自由探索开启,无尽的探索才刚刚开始) - let num; - let num2; - if (state.toDay < 7) { - num = Math.floor(Math.random() * 8 + 1); - if (num >= 6) { - num2 = Math.floor(Math.random() * 100 + 1); - if (num2 <= 20) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 在xxxx资源地图区资源产出翻倍!"); - } - else if (num2 <= 45) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 所有怪物的刷新速度降低20%"); - } - else if (num2 <= 80) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 玩家制造物品的速度提升20%"); - } - else { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 我们遇到敌袭,2回合后强制作战"); - } - } - else if (num >= 3) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + num + ") 暂无特殊事件"); - } - else { - num2 = Math.floor(Math.random() * 100 + 1); - if (num2 <= 40) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 今天天气格外炎热,你的口渴程度提升20%"); - } - else if (num2 <= 80) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 我们遇到敌袭,1回合后强制作战"); - } - else { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: getRandomWeather() - }), - (state.message = - "鉴定骰子为:(" + - num + - ") 我们遇到原住民,但对方似乎敌意满满(立刻开始特殊战斗)"); - } - } - } - //第八天开始到第十天 - else if (state.toDay < 10) { - //只往数组添加一次消息 - if (state.toDay === 8) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: "第八天来临" - }); - } + runGroup(state) { + // 生存评估期--第1天到第7天[准备期] + // 生存鉴定期--第8天到第10天(更多事件和区域解锁) + // 生存高危期--第11天到第13天(更多高危事件和隐藏区域解锁) + // 生存探索期--第14天以上(自由探索开启,无尽的探索才刚刚开始) + let num; + let num2; + if (state.toDay < 7) { + num = Math.floor(Math.random() * 8 + 1); + if (num >= 6) { + num2 = Math.floor(Math.random() * 100 + 1); + if (num2 <= 20) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + num + ") 在xxxx资源地图区资源产出翻倍!"); + } else if (num2 <= 45) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + num + ") 所有怪物的刷新速度降低20%"); + } else if (num2 <= 80) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + num + ") 玩家制造物品的速度提升20%"); + } else { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + num + ") 我们遇到敌袭,2回合后强制作战"); + } + } else if (num >= 3) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = "鉴定骰子为:(" + num + ") 暂无特殊事件"); + } else { + num2 = Math.floor(Math.random() * 100 + 1); + if (num2 <= 40) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + + num + + ") 今天天气格外炎热,你的口渴程度提升20%"); + } else if (num2 <= 80) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + num + ") 我们遇到敌袭,1回合后强制作战"); + } else { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: getRandomWeather(), + }), + (state.message = + "鉴定骰子为:(" + + num + + ") 我们遇到原住民,但对方似乎敌意满满(立刻开始特殊战斗)"); + } + } + } + //第八天开始到第十天 + else if (state.toDay < 10) { + //只往数组添加一次消息 + if (state.toDay === 8) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: "第八天来临", + }); + } - state.message = "更多事件和区域解锁"; - } - //第十天开始到第十三天 - else if (state.toDay < 13) { - //只往数组添加一次消息 - if (state.toDay === 10) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: "第十一天开始" - }); - } - state.message = "更多高危事件和隐藏区域解锁"; - } - //第十三天开始到第十四天 - else { - //只往数组添加一次消息 - if (state.toDay === 13) { - //往聊天框里添加消息 - state.chatData.unshift({ - id : state.chatData.length + 1, - text: "第十四天到来" - }); - } - state.message = "自由探索开启,无尽的探索才刚刚开始"; - } - }, - ADD_CHATBOX(state, chatBox) { - // 添加聊天框 - state.chatData.unshift(chatBox); - }, - DELETE_CHATBOX(state, index) { - // 删除聊天框 - state.chatData.splice(index, 1); - }, - UPDATE_CHATBOX(state, payload) { - // 修改聊天框 - state.chatData.splice(payload.index, 1, payload.chatBox); - } - }, + state.message = "更多事件和区域解锁"; + } + //第十天开始到第十三天 + else if (state.toDay < 13) { + //只往数组添加一次消息 + if (state.toDay === 10) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: "第十一天开始", + }); + } + state.message = "更多高危事件和隐藏区域解锁"; + } + //第十三天开始到第十四天 + else { + //只往数组添加一次消息 + if (state.toDay === 13) { + //往聊天框里添加消息 + state.chatData.unshift({ + id: state.chatData.length + 1, + text: "第十四天到来", + }); + } + state.message = "自由探索开启,无尽的探索才刚刚开始"; + } + }, + ADD_CHATBOX(state, chatBox) { + // 添加聊天框 + state.chatData.unshift(chatBox); + }, + DELETE_CHATBOX(state, index) { + // 删除聊天框 + state.chatData.splice(index, 1); + }, + UPDATE_CHATBOX(state, payload) { + // 修改聊天框 + state.chatData.splice(payload.index, 1, payload.chatBox); + }, + }, - state: { - hours : 0, - minutes : 0, - speed : 0.0001, //初始加速为1 - toDay : 1, - message : "准备期 第1天到第7天", - messageInfo: "nisadfads", - chatData : [ - { - id : 1, - text: "动态消息test" - } - ] - }, - getters: { - // 获取游戏世界时间 - worldTime: (state) => { - let hours = 0, - minutes = 0; - hours = state.hours; - minutes = state.minutes; - return `${hours}:${minutes}`; - }, - // 获取当前加速倍数 - speed: (state) => state.speed, - // 获取游戏世界天数 - toDay: (state) => state.toDay - } + state: { + hours: 0, + minutes: 0, + speed: 0.0001, //初始加速为1 + toDay: 1, + message: "准备期 第1天到第7天", + messageInfo: "nisadfads", + chatData: [ + { + id: 1, + text: "动态消息test", + }, + ], + }, + getters: { + // 获取游戏世界时间 + worldTime: (state) => { + let hours = 0, + minutes = 0; + hours = state.hours; + minutes = state.minutes; + return `${hours}:${minutes}`; + }, + // 获取当前加速倍数 + speed: (state) => state.speed, + // 获取游戏世界天数 + toDay: (state) => state.toDay, + }, }; diff --git a/src/store/weatherSys/index.js b/src/store/weatherSys/index.js index 837890a..ac06710 100644 --- a/src/store/weatherSys/index.js +++ b/src/store/weatherSys/index.js @@ -2,67 +2,67 @@ import { addClassName } from "@/utils/flash"; const WEATHER_STATUS = { - SUNNY : "晴天", // 晴天 - RAINY : "雨天", // 雨天 - CLOUDY : "阴天", // 阴天 - THUNDERSTORM: "暴雨", // 暴雨 - LIGHTENING : "雷暴" // 雷暴 + SUNNY: "晴天", // 晴天 + RAINY: "雨天", // 雨天 + CLOUDY: "阴天", // 阴天 + THUNDERSTORM: "暴雨", // 暴雨 + LIGHTENING: "雷暴", // 雷暴 }; // 生成天气状态 export function generateWeatherStatus() { - // 生成随机数 - const randomNum = Math.random(); // 根据随机数返回天气状态 - switch (true) { - case randomNum <= 0.4: - return WEATHER_STATUS.SUNNY; - case randomNum <= 0.75: - return WEATHER_STATUS.RAINY; - case randomNum <= 0.93: - return WEATHER_STATUS.CLOUDY; - case randomNum <= 0.98: - return WEATHER_STATUS.THUNDERSTORM; - default: - return WEATHER_STATUS.LIGHTENING; - } + // 生成随机数 + const randomNum = Math.random(); // 根据随机数返回天气状态 + switch (true) { + case randomNum <= 0.4: + return WEATHER_STATUS.SUNNY; + case randomNum <= 0.75: + return WEATHER_STATUS.RAINY; + case randomNum <= 0.93: + return WEATHER_STATUS.CLOUDY; + case randomNum <= 0.98: + return WEATHER_STATUS.THUNDERSTORM; + default: + return WEATHER_STATUS.LIGHTENING; + } } export default { - namespaced: true, - actions : {}, - mutations : { - // 更新天气状态 - UPDATE_WEATHER_STATUS(state) { - state.weatherStatus = generateWeatherStatus(); - } - }, - state: { - // 默认游戏开始天气状态为晴天 - weatherStatus: WEATHER_STATUS.SUNNY - }, - getters: { - // 获取当前天气状态 - getWeatherStatus(state) { - switch (state.weatherStatus) { - case WEATHER_STATUS.SUNNY: // 根据天气状态添加对应的样式 - addClassName(".weather", ["friendlyMsg", ""]); - break; - case WEATHER_STATUS.RAINY: - addClassName(".weather", ["alertMsg", ""]); - break; - case WEATHER_STATUS.CLOUDY: - addClassName(".weather", ["warnMsg", "cloudy"]); - break; - case WEATHER_STATUS.THUNDERSTORM: - addClassName(".weather", ["warnMsg", ""]); - break; - case WEATHER_STATUS.LIGHTENING: - addClassName(".weather", ["dangerMsg", ""]); - break; - default: - break; - } - return state.weatherStatus; - } - } + namespaced: true, + actions: {}, + mutations: { + // 更新天气状态 + UPDATE_WEATHER_STATUS(state) { + state.weatherStatus = generateWeatherStatus(); + }, + }, + state: { + // 默认游戏开始天气状态为晴天 + weatherStatus: WEATHER_STATUS.SUNNY, + }, + getters: { + // 获取当前天气状态 + getWeatherStatus(state) { + switch (state.weatherStatus) { + case WEATHER_STATUS.SUNNY: // 根据天气状态添加对应的样式 + addClassName(".weather", ["friendlyMsg", ""]); + break; + case WEATHER_STATUS.RAINY: + addClassName(".weather", ["alertMsg", ""]); + break; + case WEATHER_STATUS.CLOUDY: + addClassName(".weather", ["warnMsg", "cloudy"]); + break; + case WEATHER_STATUS.THUNDERSTORM: + addClassName(".weather", ["warnMsg", ""]); + break; + case WEATHER_STATUS.LIGHTENING: + addClassName(".weather", ["dangerMsg", ""]); + break; + default: + break; + } + return state.weatherStatus; + }, + }, }; diff --git a/src/utils/flash.js b/src/utils/flash.js index b5fe969..18a1434 100644 --- a/src/utils/flash.js +++ b/src/utils/flash.js @@ -3,33 +3,30 @@ //第一个参数接收被控制的元素类名 //第二个参数接收需要新增的类名 export const addClassName = (className, newClassName) => { - //获取该类名元素节点 - let classNameNode = document.querySelector(className); - //元素节点存在则遍历新增类名 - if (classNameNode) { - let classNameArr = classNameNode.className.split(" "); - //将原有的类名放进数组 - for (let i = 0; i < newClassName.length; i++) { - //类名不存在原有的时候则新增 - if (!classNameArr.includes(newClassName[i])) { - classNameArr.push(newClassName[i]); // 添加新类名后过两秒自动删除 - setTimeout(() => { - classNameArr.splice( - classNameArr.indexOf(newClassName[i]), - 1 - ); - // 从类名数组中移除新增类名 - let allClassName = classNameArr.join(" "); - // 将所有类名组装成字符串 - classNameNode.className = allClassName; - // 将组装后的字符串赋值 - }, 2100); - } - } - //存在原有的类名,为元素添加新的类名 - let allClassName = classNameArr.join(" "); - classNameNode.className = allClassName; - } + //获取该类名元素节点 + let classNameNode = document.querySelector(className); + //元素节点存在则遍历新增类名 + if (classNameNode) { + let classNameArr = classNameNode.className.split(" "); + //将原有的类名放进数组 + for (let i = 0; i < newClassName.length; i++) { + //类名不存在原有的时候则新增 + if (!classNameArr.includes(newClassName[i])) { + classNameArr.push(newClassName[i]); // 添加新类名后过两秒自动删除 + setTimeout(() => { + classNameArr.splice(classNameArr.indexOf(newClassName[i]), 1); + // 从类名数组中移除新增类名 + let allClassName = classNameArr.join(" "); + // 将所有类名组装成字符串 + classNameNode.className = allClassName; + // 将组装后的字符串赋值 + }, 2100); + } + } + //存在原有的类名,为元素添加新的类名 + let allClassName = classNameArr.join(" "); + classNameNode.className = allClassName; + } }; // //使用方法示例: // //JS中调用: diff --git a/src/utils/localStorage.js b/src/utils/localStorage.js index b4e0981..27ff64a 100644 --- a/src/utils/localStorage.js +++ b/src/utils/localStorage.js @@ -1,25 +1,24 @@ //本地存储模块 //设置 export const getItem = (name) => { - const data = window.localStorage.getItem(name); - try { - // 尝试把data转为js对象 - return JSON.parse(data); - } - catch (err) { - // data不是json格式字符串,直接原样返回 - return data; - } + const data = window.localStorage.getItem(name); + try { + // 尝试把data转为js对象 + return JSON.parse(data); + } catch (err) { + // data不是json格式字符串,直接原样返回 + return data; + } }; //获取 export const setItem = (name, value) => { - // if是对象,把value转为字符串 - if (typeof value === "object") { - value = JSON.stringify(value); - } - window.localStorage.setItem(name, value); + // if是对象,把value转为字符串 + if (typeof value === "object") { + value = JSON.stringify(value); + } + window.localStorage.setItem(name, value); }; //删除 export const removeItem = (name) => { - window.localStorage.removeItem(name); -} + window.localStorage.removeItem(name); +}; diff --git a/src/utils/request.js b/src/utils/request.js index c2a3ede..285f1ef 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -2,18 +2,18 @@ import axios from "axios"; //创建axios实例 const request = axios.create({ - // baseURL: "http://api-toutiao-web.itheima.net", - // headers: { "Content-Type": "application/json;charset=UTF-8" }, - timeout: 7000 // 请求超时时间 + // baseURL: "http://api-toutiao-web.itheima.net", + // headers: { "Content-Type": "application/json;charset=UTF-8" }, + timeout: 7000, // 请求超时时间 }); //请求拦截器 request.interceptors.request.use((config) => { - //在发送请求之前做某事 - return config; + //在发送请求之前做某事 + return config; }); //响应拦截器 request.interceptors.response.use((response) => { - //对响应数据做某事 - return response; + //对响应数据做某事 + return response; }); export default request; diff --git a/src/utils/sessionStorage.js b/src/utils/sessionStorage.js index 88d6e2e..c0a673e 100644 --- a/src/utils/sessionStorage.js +++ b/src/utils/sessionStorage.js @@ -1,25 +1,24 @@ //本地存储模块 //设置 export const getItem = (name) => { - const data = window.sessionStorage.getItem(name); - try { - // 尝试把data转为js对象 - return JSON.parse(data); - } - catch (err) { - // data不是json格式字符串,直接原样返回 - return data; - } + const data = window.sessionStorage.getItem(name); + try { + // 尝试把data转为js对象 + return JSON.parse(data); + } catch (err) { + // data不是json格式字符串,直接原样返回 + return data; + } }; //获取 export const setItem = (name, value) => { - // if是对象,把value转为字符串 - if (typeof value === "object") { - value = JSON.stringify(value); - } - window.sessionStorage.setItem(name, value); + // if是对象,把value转为字符串 + if (typeof value === "object") { + value = JSON.stringify(value); + } + window.sessionStorage.setItem(name, value); }; //删除 export const removeItem = (name) => { - window.sessionStorage.removeItem(name); -} + window.sessionStorage.removeItem(name); +}; diff --git a/src/views/index/bottomMenu/index.vue b/src/views/index/bottomMenu/index.vue index 2433017..b34c69c 100644 --- a/src/views/index/bottomMenu/index.vue +++ b/src/views/index/bottomMenu/index.vue @@ -1,125 +1,125 @@ @@ -226,222 +225,222 @@ export default { @import "@/assets/scss/_color.scss"; .exploreNotes { - margin-top: 75px; - @media only screen and (min-width: 500px) { - margin-top: 0; - } + margin-top: 75px; + @media only screen and (min-width: 500px) { + margin-top: 0; + } } .bagPopupBox { - .bagBoxBarBorder { - border-top-left-radius: 10px; - border-top-right-radius: 10px; - } + .bagBoxBarBorder { + border-top-left-radius: 10px; + border-top-right-radius: 10px; + } - .noteBoxBar { - position: fixed; - z-index: 2; - width: 95.82%; - height: 60px; - border-radius: unset; - align-items: center; - justify-content: space-evenly; - font-size: 16px; - } + .noteBoxBar { + position: fixed; + z-index: 2; + width: 95.82%; + height: 60px; + border-radius: unset; + align-items: center; + justify-content: space-evenly; + font-size: 16px; + } - .bagBoxBar { - position: fixed; - z-index: 2; - width: 95.82%; - height: 60px; - align-items: center; - justify-content: space-evenly; - font-size: 16px; + .bagBoxBar { + position: fixed; + z-index: 2; + width: 95.82%; + height: 60px; + align-items: center; + justify-content: space-evenly; + font-size: 16px; - .mapDescription { - font-size: 20px; - } + .mapDescription { + font-size: 20px; + } - .bagEdit { - position: absolute; - right: 60px; - font-size: 18px; - } - } + .bagEdit { + position: absolute; + right: 60px; + font-size: 18px; + } + } } .bottomLine { - width: $body-width; - height: 6vh; - margin: 0 auto 0; - border: $border solid rgb(114, 50, 221); + width: $body-width; + height: 6vh; + margin: 0 auto 0; + border: $border solid rgb(114, 50, 221); - .time-list { - display: flex; - align-items: center; - justify-content: space-between; - width: 150px; - height: 43px; - margin: auto; - text-align: center; - border-radius: 5px; + .time-list { + display: flex; + align-items: center; + justify-content: space-between; + width: 150px; + height: 43px; + margin: auto; + text-align: center; + border-radius: 5px; - &:nth-child(2) { - width: 210px; - } + &:nth-child(2) { + width: 210px; + } - @media only screen and (min-width: 500px) { - width: 145px; - height: 30px; - line-height: 20px; - } - } + @media only screen and (min-width: 500px) { + width: 145px; + height: 30px; + line-height: 20px; + } + } - .pause { - width: 205px; - height: 44px; - margin: auto; - display: flex; - font-size: 10px; - justify-content: center; - align-items: center; - border-radius: 5px; - @media only screen and (min-width: 500px) { - width: 211px; - height: 30px; - } - } + .pause { + width: 205px; + height: 44px; + margin: auto; + display: flex; + font-size: 10px; + justify-content: center; + align-items: center; + border-radius: 5px; + @media only screen and (min-width: 500px) { + width: 211px; + height: 30px; + } + } } .bottomMenu { - border: $border solid #7232dd; - width: $body-width; - height: $bottomMenu-height; - border-bottom: none; - display: flex; - justify-content: space-around; - margin: 6px auto 0; - position: relative; + border: $border solid #7232dd; + width: $body-width; + height: $bottomMenu-height; + border-bottom: none; + display: flex; + justify-content: space-around; + margin: 6px auto 0; + position: relative; - .bagBox { - width: 100px; - height: 100px; - border: 2mm ridge rgba(50, 220, 132, 0.3); - border-radius: 50%; - position: absolute; - z-index: 1; - top: 50%; - transform: translateY(-50%); + .bagBox { + width: 100px; + height: 100px; + border: 2mm ridge rgba(50, 220, 132, 0.3); + border-radius: 50%; + position: absolute; + z-index: 1; + top: 50%; + transform: translateY(-50%); - img { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - width: 100px; - height: 100px; - z-index: 2; - } + img { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100px; + height: 100px; + z-index: 2; + } - @media only screen and (min-width: 500px) { - width: 50px; - height: 50px; - } + @media only screen and (min-width: 500px) { + width: 50px; + height: 50px; + } - img { - width: 100px; - height: 100px; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - width: 100px; - height: 100px; - z-index: 2; - @media only screen and (min-width: 500px) { - width: 40px; - height: 40px; - } - @media only screen and (max-width: 500px) { - width: 45px; - height: 45px; - } - } - } + img { + width: 100px; + height: 100px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100px; + height: 100px; + z-index: 2; + @media only screen and (min-width: 500px) { + width: 40px; + height: 40px; + } + @media only screen and (max-width: 500px) { + width: 45px; + height: 45px; + } + } + } - .textOutput { - height: $Menu-height; - margin-top: 4px; - width: 300px; - border: $border solid #7232dd; - border-radius: $border-radius; - position: relative; - overflow: auto; - @media only screen and (min-width: 500px) { - width: 43%; - margin-top: 11px; - } - } - .aboutUs { - margin-top: 75px; + .textOutput { + height: $Menu-height; + margin-top: 4px; + width: 300px; + border: $border solid #7232dd; + border-radius: $border-radius; + position: relative; + overflow: auto; + @media only screen and (min-width: 500px) { + width: 43%; + margin-top: 11px; + } + } + .aboutUs { + margin-top: 75px; - @media only screen and (min-width: 500px) { - margin-top: 0; - } - } - .more { - height: $Menu-height; - border: $border solid #7232dd; - border-radius: 5px; - position: relative; - width: 54%; - margin-top: 5px; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: space-around; + @media only screen and (min-width: 500px) { + margin-top: 0; + } + } + .more { + height: $Menu-height; + border: $border solid #7232dd; + border-radius: 5px; + position: relative; + width: 54%; + margin-top: 5px; + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-around; - .archive, - .IllustratedBook, - .exploreNotes, - .aboutUs { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: space-around; - flex-direction: column-reverse; - width: 150px; - height: 55px; - font-size: 10px; - padding: 0; - } - } + .archive, + .IllustratedBook, + .exploreNotes, + .aboutUs { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-around; + flex-direction: column-reverse; + width: 150px; + height: 55px; + font-size: 10px; + padding: 0; + } + } - .menu-head { - width: 60px; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - border: $border solid #7232dd; - border-radius: 5px; - position: absolute; - top: -7px; - left: 6px; + .menu-head { + width: 60px; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + border: $border solid #7232dd; + border-radius: 5px; + position: absolute; + top: -7px; + left: 6px; - z-index: 2; - @media only screen and (min-width: 500px) { - width: 60px; - top: -7px; - left: 6px; - z-index: 2; - } - } + z-index: 2; + @media only screen and (min-width: 500px) { + width: 60px; + top: -7px; + left: 6px; + z-index: 2; + } + } - @media only screen and (min-width: 500px) { - #button-actiive { - width: 120px; - height: 40px; - } - } + @media only screen and (min-width: 500px) { + #button-actiive { + width: 120px; + height: 40px; + } + } } diff --git a/src/views/index/components/bubbleDialog.vue b/src/views/index/components/bubbleDialog.vue index 00e6190..e6ee051 100644 --- a/src/views/index/components/bubbleDialog.vue +++ b/src/views/index/components/bubbleDialog.vue @@ -1,120 +1,120 @@ diff --git a/src/views/index/components/channel-edit.vue b/src/views/index/components/channel-edit.vue index d5cb5b4..c515657 100644 --- a/src/views/index/components/channel-edit.vue +++ b/src/views/index/components/channel-edit.vue @@ -1,53 +1,53 @@ diff --git a/src/views/index/components/dialog.vue b/src/views/index/components/dialog.vue index fbd9618..f437036 100644 --- a/src/views/index/components/dialog.vue +++ b/src/views/index/components/dialog.vue @@ -1,19 +1,19 @@ @@ -50,17 +50,17 @@ export default { @import "@/assets/scss/_media.scss"; @import "@/assets/scss/_color.scss"; .textOutput { - height: $Menu-height; - border: $border solid #7232dd; - border-radius: $border-radius; - position: relative; - width: 43%; - margin-top: 15px; - overflow: auto; + height: $Menu-height; + border: $border solid #7232dd; + border-radius: $border-radius; + position: relative; + width: 43%; + margin-top: 15px; + overflow: auto; } .bubbleDialogue { - width: 100px; - top: 8px; + width: 100px; + top: 8px; } diff --git a/src/views/index/components/eventMap.vue b/src/views/index/components/eventMap.vue index 0840feb..e63da8d 100644 --- a/src/views/index/components/eventMap.vue +++ b/src/views/index/components/eventMap.vue @@ -1,136 +1,138 @@ diff --git a/src/views/index/components/exploreNotes.vue b/src/views/index/components/exploreNotes.vue index 3d438b1..9a4251b 100644 --- a/src/views/index/components/exploreNotes.vue +++ b/src/views/index/components/exploreNotes.vue @@ -1,73 +1,73 @@ diff --git a/src/views/index/event/index.vue b/src/views/index/event/index.vue index 81d63ab..cb9121a 100644 --- a/src/views/index/event/index.vue +++ b/src/views/index/event/index.vue @@ -1,42 +1,42 @@ @@ -72,90 +72,90 @@ export default { @import "@/assets/scss/_color.scss"; .mainflex { - position: relative; - left: 390px; - width: 40px; - display: flex; - flex-wrap: wrap; - margin: 0; - z-index: 2; + position: relative; + left: 390px; + width: 40px; + display: flex; + flex-wrap: wrap; + margin: 0; + z-index: 2; } .menu-list { - width: 18px; - height: 54px; - display: flex; - justify-content: center; - align-items: center; - border: $border solid; - border-radius: 5px; - margin-top: 10px; - padding: 8px; + width: 18px; + height: 54px; + display: flex; + justify-content: center; + align-items: center; + border: $border solid; + border-radius: 5px; + margin-top: 10px; + padding: 8px; - &:active { - background-color: #7232dd; - color: #fff; - } + &:active { + background-color: #7232dd; + color: #fff; + } } .eventMenu { - border: $border solid #7232dd; - width: $body-width; - height: $eventMenu-height; - display: flex; - justify-content: space-around; - margin: 0 auto; + border: $border solid #7232dd; + width: $body-width; + height: $eventMenu-height; + display: flex; + justify-content: space-around; + margin: 0 auto; - .text { - height: $event-height; - border: $border solid #7232dd; - border-radius: $border-radius; - position: relative; - width: 38%; - margin-top: 12px; + .text { + height: $event-height; + border: $border solid #7232dd; + border-radius: $border-radius; + position: relative; + width: 38%; + margin-top: 12px; - .mapBoxContainer { - display: flex; - flex-wrap: wrap; - align-items: center; - overflow: hidden; + .mapBoxContainer { + display: flex; + flex-wrap: wrap; + align-items: center; + overflow: hidden; - .tag { - width: 110px; - height: 80px; - margin: 12px 18px 12px 8px; - font-size: 9px; - text-align: center; - padding: 0; + .tag { + width: 110px; + height: 80px; + margin: 12px 18px 12px 8px; + font-size: 9px; + text-align: center; + padding: 0; - &:nth-child(1) { - margin-left: 120px; - } - } - } - } + &:nth-child(1) { + margin-left: 120px; + } + } + } + } - .event { - height: $event-height; - border: $border solid #7232dd; - border-radius: $border-radius; - position: relative; - width: 59%; - margin-top: 12px; - } + .event { + height: $event-height; + border: $border solid #7232dd; + border-radius: $border-radius; + position: relative; + width: 59%; + margin-top: 12px; + } - .events-head { - display: flex; - justify-content: center; - align-items: center; - width: 59px; - height: 40px; - text-align: center; - border-radius: 5px; - position: absolute; - top: -3px; - left: 6px; - background-color: #fff; - } + .events-head { + display: flex; + justify-content: center; + align-items: center; + width: 59px; + height: 40px; + text-align: center; + border-radius: 5px; + position: absolute; + top: -3px; + left: 6px; + background-color: #fff; + } } diff --git a/src/views/index/event/tes.vue b/src/views/index/event/tes.vue index 97cb8c0..3b09a9a 100644 --- a/src/views/index/event/tes.vue +++ b/src/views/index/event/tes.vue @@ -1,27 +1,27 @@ diff --git a/src/views/index/globalStatusBar/index.vue b/src/views/index/globalStatusBar/index.vue index 70bd202..7a0e9cb 100644 --- a/src/views/index/globalStatusBar/index.vue +++ b/src/views/index/globalStatusBar/index.vue @@ -1,67 +1,55 @@ @@ -70,47 +58,47 @@ export default { @import "@/assets/scss/_color.scss"; .globalStatus { - //媒体查询 手机 - @media only screen and (max-width: 500px) { - height: $globalStatusBar-height; - } + //媒体查询 手机 + @media only screen and (max-width: 500px) { + height: $globalStatusBar-height; + } - //媒体查询 电脑 - @media only screen and (min-width: 500px) { - height: 21px; - } + //媒体查询 电脑 + @media only screen and (min-width: 500px) { + height: 21px; + } - width: $body-width; - margin: 5px 5px 8px; - - .property { - height: 100%; + width: $body-width; + margin: 5px 5px 8px; - .attribute-name { - display: flex; - justify-content: start; - flex-wrap: wrap; - text-align: center; - float: left; + .property { + height: 100%; - //手机端 - @media only screen and (max-width: 500px) { - .van-tag { - margin-right: 18px; - margin-top: 4px; - height: 20px; - } - } + .attribute-name { + display: flex; + justify-content: start; + flex-wrap: wrap; + text-align: center; + float: left; - //电脑端 - @media only screen and (min-width: 500px) { - .van-tag { - margin-right: 18px; - margin-top: 4px; - height: 20px; - } - } - } - } + //手机端 + @media only screen and (max-width: 500px) { + .van-tag { + margin-right: 18px; + margin-top: 4px; + height: 20px; + } + } + + //电脑端 + @media only screen and (min-width: 500px) { + .van-tag { + margin-right: 18px; + margin-top: 4px; + height: 20px; + } + } + } + } } diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 1d08e73..ad73830 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -1,16 +1,16 @@ @@ -36,6 +36,6 @@ export default { @import "@/assets/scss/_color.scss"; body { - background: $white; + background: $white; } diff --git a/src/views/index/shortcutBar/index.vue b/src/views/index/shortcutBar/index.vue index b81b2bc..30c2eb4 100644 --- a/src/views/index/shortcutBar/index.vue +++ b/src/views/index/shortcutBar/index.vue @@ -1,24 +1,22 @@ @@ -37,32 +35,32 @@ export default { @import "@/assets/scss/_color.scss"; .textOutput { - height: $textOutput-height; - width: $body-width; - border: $border solid #7232dd; - position: relative; - margin-top: 10px; + height: $textOutput-height; + width: $body-width; + border: $border solid #7232dd; + position: relative; + margin-top: 10px; - .textOut { - z-index: 1; - width: 70px; - display: flex; - justify-content: center; - align-items: center; - height: 98%; - font-size: 14px; - text-align: center; - border: $border solid #7232dd; - position: absolute; - top: 0px; - left: 0px; - background-color: #fff; - } + .textOut { + z-index: 1; + width: 70px; + display: flex; + justify-content: center; + align-items: center; + height: 98%; + font-size: 14px; + text-align: center; + border: $border solid #7232dd; + position: absolute; + top: 0px; + left: 0px; + background-color: #fff; + } - .van-notice-bar { - width: 585px; - height: 100%; - margin-left: 70px; - } + .van-notice-bar { + width: 585px; + height: 100%; + margin-left: 70px; + } } diff --git a/src/views/openMap/index.vue b/src/views/openMap/index.vue index 3327152..fff8ed9 100644 --- a/src/views/openMap/index.vue +++ b/src/views/openMap/index.vue @@ -1,61 +1,61 @@ diff --git a/vue.config.js b/vue.config.js index d9b4c3b..93ae36d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,7 +1,7 @@ -const {defineConfig} = require("@vue/cli-service"); -module.exports = defineConfig({transpileDependencies: true}); +const { defineConfig } = require("@vue/cli-service"); +module.exports = defineConfig({ transpileDependencies: true }); module.exports = { - publicPath: "/STARART/", - lintOnSave: false + publicPath: "/STARART/", + lintOnSave: false, };