commit 7d92396461aaf961879543c7b4e477f397c4300b Author: caoqianming Date: Wed Jun 2 11:15:10 2021 +0800 首次提交 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6e51dee --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.vue linguist-language=python diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa116e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +unpackage/dist/* +node_modules/* +deploy.sh +package-lock.json +.idea/ +.vscode/ +server/static/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..09310e6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 blackholll + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4e677e --- /dev/null +++ b/README.md @@ -0,0 +1,120 @@ +# 简介 +基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序). + +JWT认证,可使用simple_history实现审计功能,支持swagger + +内置模块有组织机构\用户\角色\岗位\数据字典\文件库\定时任务 + +支持功能权限(控权到每个接口)和简单的数据权限(全部、本级及以下、同级及以下、本人等) + +## 部分截图 +![image](https://github.com/caoqianming/django-vue-admin/blob/master/img/user.png) +![image](https://github.com/caoqianming/django-vue-admin/blob/master/img/dict.png) +![image](https://github.com/caoqianming/django-vue-admin/blob/master/img/task.png) + +## 启动(以下是在windows下开发操作步骤) + + +### django后端 +定位到server文件夹 + +建立虚拟环境 `python -m venv venv` + +激活虚拟环境 `.\venv\scripts\activate` + +安装依赖包 `pip install -r requirements.txt` + +修改数据库连接 `server\settings_dev.py` + +同步数据库 `python manage.py migrate` + +可导入初始数据 `python manage.py loaddata db.json` 或直接使用sqlite数据库(超管账户密码均为admin) + +创建超级管理员 `python manage.py createsuperuser` + +运行服务 `python manage.py runserver 8000` + +### vue前端 +定位到client文件夹 + +安装node.js + +安装依赖包 `npm install --registry=https://registry.npm.taobao.org` + +运行服务 `npm run dev` + +### nginx +修改nginx.conf + +``` +listen 8012 +location /media { + proxy_pass http://localhost:8000; +} +location / { + proxy_pass http://localhost:9528; +} +``` + +运行nginx.exe + +### 运行 +打开localhost:8012即可访问 + +接口文档 localhost:8000/docs + +后台地址 localhost:8000/admin + +### docker-compose 方式运行 + +前端 `./client` 和后端 `./server` 目录下都有Dockerfile,如果需要单独构建镜像,可以自行构建。 + +这里主要说docker-compose启动这种方式。 + +按照注释修改docker-compose.yml文件。里面主要有两个服务,一个是`backend`后端,一个是`frontend`前端。 + +默认是用开发模式跑的后端和前端。如果需要单机部署,又想用docker-compose的话,改为生产模式性能会好些。 + + +启动 +``` +cd +docker-compose up -d +``` + +启动成功后,访问端口同前面的,接口8000端口,前端8012端口,如需改动,自己改docker-compose.yml + +如果要执行里面的命令 +docker-compose exec <服务名> <命令> + +举个栗子: + +如果我要执行后端生成数据变更命令。`python manage.py makemigrations` + +则用如下语句 + +``` +docker-compose exec backend python manage.py makemigrations +``` + +### 理念 +首先得会使用django-rest-framework, 理解vue-element-admin前端方案 + +本项目采用前端路由,后端根据用户角色读取用户权限代码返回给前端,由前端进行加载(核心代码是路由表中的perms属性以及checkpermission方法) + +后端功能权限的核心代码在server/apps/system/permission.py下重写了has_permission方法, 在APIView和ViewSet中定义perms权限代码 + +数据权限因为跟具体业务有关,简单定义了几个规则,重写了has_object_permission方法;根据需要使用即可 + +### 关于定时任务 +使用celery以及django_celery_beat包实现 + +需要安装redis并在默认端口启动, 并启动worker以及beat + +进入虚拟环境并启动worker: `celery -A server worker -l info -P eventlet`, linux系统不用加-P eventlet + +进入虚拟环境并启动beat: `celery -A server beat -l info` + +### 后续 +考虑增加一个简易的工作流模块 + diff --git a/client/.editorconfig b/client/.editorconfig new file mode 100644 index 0000000..ea6e20f --- /dev/null +++ b/client/.editorconfig @@ -0,0 +1,14 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/client/.env.development b/client/.env.development new file mode 100644 index 0000000..0c9b7ed --- /dev/null +++ b/client/.env.development @@ -0,0 +1,14 @@ +# just a flag +ENV = 'development' + +# base api +VUE_APP_BASE_API = 'http://localhost:8000' + +# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, +# to control whether the babel-plugin-dynamic-import-node plugin is enabled. +# It only does one thing by converting all import() to require(). +# This configuration can significantly increase the speed of hot updates, +# when you have a large number of pages. +# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js + +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/client/.env.production b/client/.env.production new file mode 100644 index 0000000..63f069a --- /dev/null +++ b/client/.env.production @@ -0,0 +1,6 @@ +# just a flag +ENV = 'production' + +# base api +VUE_APP_BASE_API = 'http://121.36.23.77:8035' + diff --git a/client/.env.staging b/client/.env.staging new file mode 100644 index 0000000..a8793a0 --- /dev/null +++ b/client/.env.staging @@ -0,0 +1,8 @@ +NODE_ENV = production + +# just a flag +ENV = 'staging' + +# base api +VUE_APP_BASE_API = '/stage-api' + diff --git a/client/.eslintignore b/client/.eslintignore new file mode 100644 index 0000000..e6529fc --- /dev/null +++ b/client/.eslintignore @@ -0,0 +1,4 @@ +build/*.js +src/assets +public +dist diff --git a/client/.eslintrc.js b/client/.eslintrc.js new file mode 100644 index 0000000..c977505 --- /dev/null +++ b/client/.eslintrc.js @@ -0,0 +1,198 @@ +module.exports = { + root: true, + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + env: { + browser: true, + node: true, + es6: true, + }, + extends: ['plugin:vue/recommended', 'eslint:recommended'], + + // add your custom rules here + //it is base on https://github.com/vuejs/eslint-config-vue + rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/singleline-html-element-content-newline": "off", + "vue/multiline-html-element-content-newline":"off", + "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-v-html": "off", + 'accessor-pairs': 2, + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + 'block-spacing': [2, 'always'], + 'brace-style': [2, '1tbs', { + 'allowSingleLine': true + }], + 'camelcase': [0, { + 'properties': 'always' + }], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + 'comma-style': [2, 'last'], + 'constructor-super': 2, + 'curly': [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'eol-last': 2, + 'eqeqeq': ["error", "always", {"null": "ignore"}], + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + 'handle-callback-err': [2, '^(err|error)$'], + 'indent': [2, 2, { + 'SwitchCase': 1 + }], + 'jsx-quotes': [2, 'prefer-single'], + 'key-spacing': [2, { + 'beforeColon': false, + 'afterColon': true + }], + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + 'new-cap': [2, { + 'newIsCap': true, + 'capIsNew': false + }], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-ex-assign': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [2, 'functions'], + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [2, 'functions'], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-return-assign': [2, 'except-parens'], + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-spaced-func': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [2, { + 'defaultAssignment': false + }], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + 'no-with': 2, + 'one-var': [2, { + 'initialized': 'never' + }], + 'operator-linebreak': [2, 'after', { + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + 'padded-blocks': [2, 'never'], + 'quotes': [2, 'single', { + 'avoidEscape': true, + 'allowTemplateLiterals': true + }], + 'semi': [2, 'never'], + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { + 'words': true, + 'nonwords': false + }], + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + 'template-curly-spacing': [2, 'never'], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [2, 'any'], + 'yield-star-spacing': [2, 'both'], + 'yoda': [2, 'never'], + 'prefer-const': 2, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'object-curly-spacing': [2, 'always', { + objectsInObjects: false + }], + 'array-bracket-spacing': [2, 'never'] + } +} diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..9ad28d2 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,16 @@ +.DS_Store +node_modules/ +dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +package-lock.json +tests/**/coverage/ + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln diff --git a/client/.travis.yml b/client/.travis.yml new file mode 100644 index 0000000..f4be7a0 --- /dev/null +++ b/client/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: 10 +script: npm run test +notifications: + email: false diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..35534e1 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,6 @@ +FROM node:10-alpine3.9 as builder +WORKDIR /code +COPY . . +RUN npm install --registry=https://registry.npm.taobao.org && npm run build:prod +FROM nginx:1.19.2-alpine +COPY --from=builder /code/dist /usr/share/nginx/html diff --git a/client/Dockerfile_dev b/client/Dockerfile_dev new file mode 100644 index 0000000..e5fddd2 --- /dev/null +++ b/client/Dockerfile_dev @@ -0,0 +1,6 @@ +FROM node:10-alpine3.9 +ENV NODE_ENV=development +WORKDIR /code +COPY . . +RUN npm install --registry=https://registry.npm.taobao.org +ENTRYPOINT ["npm","run","dev:docker"] \ No newline at end of file diff --git a/client/LICENSE b/client/LICENSE new file mode 100644 index 0000000..6151575 --- /dev/null +++ b/client/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-present PanJiaChen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/client/README-zh.md b/client/README-zh.md new file mode 100644 index 0000000..d248632 --- /dev/null +++ b/client/README-zh.md @@ -0,0 +1,98 @@ +# vue-admin-template + +> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。 + +[线上地址](http://panjiachen.github.io/vue-admin-template) + +[国内访问](https://panjiachen.gitee.io/vue-admin-template) + +目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。 + +## Extra + +如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) + +## 相关项目 + +- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) + +- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) + +- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) + +- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) + +写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目: + +- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2) +- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac) +- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35) +- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56) +- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836) + +## Build Setup + +```bash +# 克隆项目 +git clone https://github.com/PanJiaChen/vue-admin-template.git + +# 进入项目目录 +cd vue-admin-template + +# 安装依赖 +npm install + +# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 +npm install --registry=https://registry.npm.taobao.org + +# 启动服务 +npm run dev +``` + +浏览器访问 [http://localhost:9528](http://localhost:9528) + +## 发布 + +```bash +# 构建测试环境 +npm run build:stage + +# 构建生产环境 +npm run build:prod +``` + +## 其它 + +```bash +# 预览发布环境效果 +npm run preview + +# 预览发布环境效果 + 静态资源分析 +npm run preview -- --report + +# 代码格式检查 +npm run lint + +# 代码格式检查并自动修复 +npm run lint -- --fix +``` + +更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/) + +## Demo + +![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) + +## Browsers support + +Modern browsers and Internet Explorer 10+. + +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| --------- | --------- | --------- | --------- | +| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions + +## License + +[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. + +Copyright (c) 2017-present PanJiaChen diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000..b99f942 --- /dev/null +++ b/client/README.md @@ -0,0 +1,91 @@ +# vue-admin-template + +English | [简体中文](./README-zh.md) + +> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint + +**Live demo:** http://panjiachen.github.io/vue-admin-template + + +**The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`** + +## Build Setup + + +```bash +# clone the project +git clone https://github.com/PanJiaChen/vue-admin-template.git + +# enter the project directory +cd vue-admin-template + +# install dependency +npm install + +# develop +npm run dev +``` + +This will automatically open http://localhost:9528 + +## Build + +```bash +# build for test environment +npm run build:stage + +# build for production environment +npm run build:prod +``` + +## Advanced + +```bash +# preview the release environment effect +npm run preview + +# preview the release environment effect + static resource analysis +npm run preview -- --report + +# code format check +npm run lint + +# code format check and auto fix +npm run lint -- --fix +``` + +Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information + +## Demo + +![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) + +## Extra + +If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) + +For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour)) + +## Related Project + +- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) + +- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) + +- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) + +- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) + +## Browsers support + +Modern browsers and Internet Explorer 10+. + +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| --------- | --------- | --------- | --------- | +| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions + +## License + +[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. + +Copyright (c) 2017-present PanJiaChen diff --git a/client/babel.config.js b/client/babel.config.js new file mode 100644 index 0000000..ba17966 --- /dev/null +++ b/client/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/app' + ] +} diff --git a/client/build/index.js b/client/build/index.js new file mode 100644 index 0000000..0c57de2 --- /dev/null +++ b/client/build/index.js @@ -0,0 +1,35 @@ +const { run } = require('runjs') +const chalk = require('chalk') +const config = require('../vue.config.js') +const rawArgv = process.argv.slice(2) +const args = rawArgv.join(' ') + +if (process.env.npm_config_preview || rawArgv.includes('--preview')) { + const report = rawArgv.includes('--report') + + run(`vue-cli-service build ${args}`) + + const port = 9526 + const publicPath = config.publicPath + + var connect = require('connect') + var serveStatic = require('serve-static') + const app = connect() + + app.use( + publicPath, + serveStatic('./dist', { + index: ['index.html', '/'] + }) + ) + + app.listen(port, function () { + console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) + if (report) { + console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) + } + + }) +} else { + run(`vue-cli-service build ${args}`) +} diff --git a/client/jest.config.js b/client/jest.config.js new file mode 100644 index 0000000..143cdc8 --- /dev/null +++ b/client/jest.config.js @@ -0,0 +1,24 @@ +module.exports = { + moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], + transform: { + '^.+\\.vue$': 'vue-jest', + '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': + 'jest-transform-stub', + '^.+\\.jsx?$': 'babel-jest' + }, + moduleNameMapper: { + '^@/(.*)$': '/src/$1' + }, + snapshotSerializers: ['jest-serializer-vue'], + testMatch: [ + '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' + ], + collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], + coverageDirectory: '/tests/unit/coverage', + // 'collectCoverage': true, + 'coverageReporters': [ + 'lcov', + 'text-summary' + ], + testURL: 'http://localhost/' +} diff --git a/client/jsconfig.json b/client/jsconfig.json new file mode 100644 index 0000000..ed079e2 --- /dev/null +++ b/client/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "baseUrl": "./", + "paths": { + "@/*": ["src/*"] + } + }, + "exclude": ["node_modules", "dist"] +} diff --git a/client/mock/index.js b/client/mock/index.js new file mode 100644 index 0000000..90e2ffe --- /dev/null +++ b/client/mock/index.js @@ -0,0 +1,67 @@ +import Mock from 'mockjs' +import { param2Obj } from '../src/utils' + +import user from './user' +import table from './table' + +const mocks = [ + ...user, + ...table +] + +// for front mock +// please use it cautiously, it will redefine XMLHttpRequest, +// which will cause many of your third-party libraries to be invalidated(like progress event). +export function mockXHR() { + // mock patch + // https://github.com/nuysoft/Mock/issues/300 + Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send + Mock.XHR.prototype.send = function() { + if (this.custom.xhr) { + this.custom.xhr.withCredentials = this.withCredentials || false + + if (this.responseType) { + this.custom.xhr.responseType = this.responseType + } + } + this.proxy_send(...arguments) + } + + function XHR2ExpressReqWrap(respond) { + return function(options) { + let result = null + if (respond instanceof Function) { + const { body, type, url } = options + // https://expressjs.com/en/4x/api.html#req + result = respond({ + method: type, + body: JSON.parse(body), + query: param2Obj(url) + }) + } else { + result = respond + } + return Mock.mock(result) + } + } + + for (const i of mocks) { + Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response)) + } +} + +// for mock server +const responseFake = (url, type, respond) => { + return { + url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`), + type: type || 'get', + response(req, res) { + console.log('request invoke:' + req.path) + res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond)) + } + } +} + +export default mocks.map(route => { + return responseFake(route.url, route.type, route.response) +}) diff --git a/client/mock/mock-server.js b/client/mock/mock-server.js new file mode 100644 index 0000000..4c4cb2a --- /dev/null +++ b/client/mock/mock-server.js @@ -0,0 +1,68 @@ +const chokidar = require('chokidar') +const bodyParser = require('body-parser') +const chalk = require('chalk') +const path = require('path') + +const mockDir = path.join(process.cwd(), 'mock') + +function registerRoutes(app) { + let mockLastIndex + const { default: mocks } = require('./index.js') + for (const mock of mocks) { + app[mock.type](mock.url, mock.response) + mockLastIndex = app._router.stack.length + } + const mockRoutesLength = Object.keys(mocks).length + return { + mockRoutesLength: mockRoutesLength, + mockStartIndex: mockLastIndex - mockRoutesLength + } +} + +function unregisterRoutes() { + Object.keys(require.cache).forEach(i => { + if (i.includes(mockDir)) { + delete require.cache[require.resolve(i)] + } + }) +} + +module.exports = app => { + // es6 polyfill + require('@babel/register') + + // parse app.body + // https://expressjs.com/en/4x/api.html#req.body + app.use(bodyParser.json()) + app.use(bodyParser.urlencoded({ + extended: true + })) + + const mockRoutes = registerRoutes(app) + var mockRoutesLength = mockRoutes.mockRoutesLength + var mockStartIndex = mockRoutes.mockStartIndex + + // watch files, hot reload mock server + chokidar.watch(mockDir, { + ignored: /mock-server/, + ignoreInitial: true + }).on('all', (event, path) => { + if (event === 'change' || event === 'add') { + try { + // remove mock routes stack + app._router.stack.splice(mockStartIndex, mockRoutesLength) + + // clear routes cache + unregisterRoutes() + + const mockRoutes = registerRoutes(app) + mockRoutesLength = mockRoutes.mockRoutesLength + mockStartIndex = mockRoutes.mockStartIndex + + console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`)) + } catch (error) { + console.log(chalk.redBright(error)) + } + } + }) +} diff --git a/client/mock/table.js b/client/mock/table.js new file mode 100644 index 0000000..ba95f76 --- /dev/null +++ b/client/mock/table.js @@ -0,0 +1,29 @@ +import Mock from 'mockjs' + +const data = Mock.mock({ + 'items|30': [{ + id: '@id', + title: '@sentence(10, 20)', + 'status|1': ['published', 'draft', 'deleted'], + author: 'name', + display_time: '@datetime', + pageviews: '@integer(300, 5000)' + }] +}) + +export default [ + { + url: '/vue-admin-template/table/list', + type: 'get', + response: config => { + const items = data.items + return { + code: 20000, + data: { + total: items.length, + items: items + } + } + } + } +] diff --git a/client/mock/user.js b/client/mock/user.js new file mode 100644 index 0000000..f007cd9 --- /dev/null +++ b/client/mock/user.js @@ -0,0 +1,84 @@ + +const tokens = { + admin: { + token: 'admin-token' + }, + editor: { + token: 'editor-token' + } +} + +const users = { + 'admin-token': { + roles: ['admin'], + introduction: 'I am a super administrator', + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', + name: 'Super Admin' + }, + 'editor-token': { + roles: ['editor'], + introduction: 'I am an editor', + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', + name: 'Normal Editor' + } +} + +export default [ + // user login + { + url: '/vue-admin-template/user/login', + type: 'post', + response: config => { + const { username } = config.body + const token = tokens[username] + + // mock error + if (!token) { + return { + code: 60204, + message: 'Account and password are incorrect.' + } + } + + return { + code: 20000, + data: token + } + } + }, + + // get user info + { + url: '/vue-admin-template/user/info\.*', + type: 'get', + response: config => { + const { token } = config.query + const info = users[token] + + // mock error + if (!info) { + return { + code: 50008, + message: 'Login failed, unable to get user details.' + } + } + + return { + code: 20000, + data: info + } + } + }, + + // user logout + { + url: '/vue-admin-template/user/logout', + type: 'post', + response: _ => { + return { + code: 20000, + data: 'success' + } + } + } +] diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..6e839a8 --- /dev/null +++ b/client/package.json @@ -0,0 +1,68 @@ +{ + "name": "vue-admin-template", + "version": "4.2.1", + "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", + "author": "Pan ", + "license": "MIT", + "scripts": { + "dev": "vue-cli-service serve", + "dev:docker": "NODE_ENV=development PORT=80 ./node_modules/.bin/vue-cli-service serve", + "build:prod": "vue-cli-service build", + "build:stage": "vue-cli-service build --mode staging", + "preview": "node build/index.js --preview", + "lint": "eslint --ext .js,.vue src", + "test:unit": "jest --clearCache && vue-cli-service test:unit", + "test:ci": "npm run lint && npm run test:unit", + "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" + }, + "dependencies": { + "@riophae/vue-treeselect": "^0.4.0", + "axios": "0.18.1", + "element-ui": "2.13.0", + "file-saver": "^2.0.2", + "js-cookie": "2.2.0", + "normalize.css": "7.0.0", + "nprogress": "0.2.0", + "path-to-regexp": "2.4.0", + "vue": "2.6.10", + "vue-router": "3.0.6", + "vuex": "3.1.0", + "xlsx": "^0.15.5" + }, + "devDependencies": { + "@babel/core": "7.0.0", + "@babel/register": "7.0.0", + "@vue/cli-plugin-babel": "3.6.0", + "@vue/cli-plugin-eslint": "^3.9.1", + "@vue/cli-plugin-unit-jest": "3.6.3", + "@vue/cli-service": "3.6.0", + "@vue/test-utils": "1.0.0-beta.29", + "autoprefixer": "^9.5.1", + "babel-core": "7.0.0-bridge.0", + "babel-eslint": "10.0.1", + "babel-jest": "23.6.0", + "chalk": "2.4.2", + "connect": "3.6.6", + "eslint": "5.15.3", + "eslint-plugin-vue": "5.2.2", + "html-webpack-plugin": "3.2.0", + "mockjs": "1.0.1-beta3", + "node-sass": "^4.13.1", + "runjs": "^4.3.2", + "sass-loader": "^7.1.0", + "script-ext-html-webpack-plugin": "2.1.3", + "script-loader": "0.7.2", + "serve-static": "^1.13.2", + "svg-sprite-loader": "4.1.3", + "svgo": "1.2.2", + "vue-template-compiler": "2.6.10" + }, + "engines": { + "node": ">=8.9", + "npm": ">= 3.0.0" + }, + "browserslist": [ + "> 1%", + "last 2 versions" + ] +} diff --git a/client/postcss.config.js b/client/postcss.config.js new file mode 100644 index 0000000..10473ef --- /dev/null +++ b/client/postcss.config.js @@ -0,0 +1,8 @@ +// https://github.com/michael-ciniawsky/postcss-load-config + +module.exports = { + 'plugins': { + // to edit target browsers: use "browserslist" field in package.json + 'autoprefixer': {} + } +} diff --git a/client/public/favicon.ico b/client/public/favicon.ico new file mode 100644 index 0000000..34b63ac Binary files /dev/null and b/client/public/favicon.ico differ diff --git a/client/public/index.html b/client/public/index.html new file mode 100644 index 0000000..fa2be91 --- /dev/null +++ b/client/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + <%= webpackConfig.name %> + + + +
+ + + diff --git a/client/src/App.vue b/client/src/App.vue new file mode 100644 index 0000000..ec9032c --- /dev/null +++ b/client/src/App.vue @@ -0,0 +1,11 @@ + + + diff --git a/client/src/api/dict.js b/client/src/api/dict.js new file mode 100644 index 0000000..d46429f --- /dev/null +++ b/client/src/api/dict.js @@ -0,0 +1,57 @@ +import request from '@/utils/request' + +export function getDictTypeList(query) { + return request({ + url: '/system/dicttype/', + method: 'get', + params: query + }) +} +export function createDictType(data) { + return request({ + url: '/system/dicttype/', + method: 'post', + data + }) +} +export function updateDictType(id, data) { + return request({ + url: `/system/dicttype/${id}/`, + method: 'put', + data + }) +} +export function deleteDictType(id) { + return request({ + url: `/system/dicttype/${id}/`, + method: 'delete' + }) +} + +export function getDictList(query) { + return request({ + url: '/system/dict/', + method: 'get', + params: query + }) +} +export function createDict(data) { + return request({ + url: '/system/dict/', + method: 'post', + data + }) +} +export function updateDict(id, data) { + return request({ + url: `/system/dict/${id}/`, + method: 'put', + data + }) +} +export function deleteDict(id) { + return request({ + url: `/system/dict/${id}/`, + method: 'delete' + }) +} diff --git a/client/src/api/file.js b/client/src/api/file.js new file mode 100644 index 0000000..01c683e --- /dev/null +++ b/client/src/api/file.js @@ -0,0 +1,18 @@ +import { getToken } from "@/utils/auth" +import request from '@/utils/request' + +export function upUrl() { + return process.env.VUE_APP_BASE_API + '/file/' +} + +export function upHeaders() { + return { Authorization: "Bearer " + getToken() } +} + +export function getFileList(query) { + return request({ + url: '/file/', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/client/src/api/org.js b/client/src/api/org.js new file mode 100644 index 0000000..2880ec4 --- /dev/null +++ b/client/src/api/org.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +export function getOrgAll() { + return request({ + url: '/system/organization/', + method: 'get' + }) +} +export function getOrgList(query) { + return request({ + url: '/system/organization/', + method: 'get', + params: query + }) +} +export function createOrg(data) { + return request({ + url: '/system/organization/', + method: 'post', + data + }) +} +export function updateOrg(id, data) { + return request({ + url: `/system/organization/${id}/`, + method: 'put', + data + }) +} +export function deleteOrg(id) { + return request({ + url: `/system/organization/${id}/`, + method: 'delete' + }) +} diff --git a/client/src/api/perm.js b/client/src/api/perm.js new file mode 100644 index 0000000..29ebf53 --- /dev/null +++ b/client/src/api/perm.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +export function getPermAll() { + return request({ + url: '/system/permission/', + method: 'get' + }) +} +export function createPerm(data) { + return request({ + url: '/system/permission/', + method: 'post', + data + }) +} +export function updatePerm(id, data) { + return request({ + url: `/system/permission/${id}/`, + method: 'put', + data + }) +} +export function deletePerm(id) { + return request({ + url: `/system/permission/${id}/`, + method: 'delete' + }) +} \ No newline at end of file diff --git a/client/src/api/position.js b/client/src/api/position.js new file mode 100644 index 0000000..2ea116f --- /dev/null +++ b/client/src/api/position.js @@ -0,0 +1,31 @@ +import request from '@/utils/request' + +export function getPositionAll() { + return request({ + url: '/system/position/', + method: 'get' + }) +} + +export function createPosition(data) { + return request({ + url: '/system/position/', + method: 'post', + data + }) +} + +export function updatePosition(id, data) { + return request({ + url: `/system/position/${id}/`, + method: 'put', + data + }) +} + +export function deletePosition(id) { + return request({ + url: `/system/position/${id}/`, + method: 'delete' + }) +} diff --git a/client/src/api/role.js b/client/src/api/role.js new file mode 100644 index 0000000..e25e097 --- /dev/null +++ b/client/src/api/role.js @@ -0,0 +1,38 @@ +import request from '@/utils/request' + +export function getRoutes() { + return request({ + url: '/system/permission/', + method: 'get' + }) +} + +export function getRoleAll() { + return request({ + url: '/system/role/', + method: 'get' + }) +} + +export function createRole(data) { + return request({ + url: '/system/role/', + method: 'post', + data + }) +} + +export function updateRole(id, data) { + return request({ + url: `/system/role/${id}/`, + method: 'put', + data + }) +} + +export function deleteRole(id) { + return request({ + url: `/system/role/${id}/`, + method: 'delete' + }) +} diff --git a/client/src/api/table.js b/client/src/api/table.js new file mode 100644 index 0000000..2752f52 --- /dev/null +++ b/client/src/api/table.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function getList(params) { + return request({ + url: '/vue-admin-template/table/list', + method: 'get', + params + }) +} diff --git a/client/src/api/task.js b/client/src/api/task.js new file mode 100644 index 0000000..1e3b397 --- /dev/null +++ b/client/src/api/task.js @@ -0,0 +1,45 @@ +import request from '@/utils/request' + +export function getptaskList(query) { + return request({ + url: '/system/ptask/', + method: 'get', + params: query + }) +} + +export function getTaskAll() { + return request({ + url: '/system/task/', + method: 'get' + }) +} +export function createptask(data) { + return request({ + url: '/system/ptask/', + method: 'post', + data + }) +} + +export function updateptask(id, data) { + return request({ + url: `/system/ptask/${id}/`, + method: 'put', + data + }) +} + +export function toggletask(id) { + return request({ + url: `/system/ptask/${id}/toggle/`, + method: 'put' + }) +} + +export function deleteptask(id) { + return request({ + url: `/system/ptask/${id}/`, + method: 'delete' + }) +} \ No newline at end of file diff --git a/client/src/api/user.js b/client/src/api/user.js new file mode 100644 index 0000000..8edf3ab --- /dev/null +++ b/client/src/api/user.js @@ -0,0 +1,70 @@ +import request from '@/utils/request' + +export function login(data) { + return request({ + url: '/token/', + method: 'post', + data + }) +} + +export function logout() { + return request({ + url: '/token/black/', + method: 'get' + }) +} + +export function getInfo() { + return request({ + url: '/system/user/info/', + method: 'get' + }) +} + +export function getUserList(query) { + return request({ + url: '/system/user/', + method: 'get', + params: query + }) +} + +export function getUser(id) { + return request({ + url: `/system/user/${id}/`, + method: 'get' + }) +} + +export function createUser(data) { + return request({ + url: '/system/user/', + method: 'post', + data + }) +} + +export function updateUser(id, data) { + return request({ + url: `/system/user/${id}/`, + method: 'put', + data + }) +} + +export function deleteUser(id, data) { + return request({ + url: `/system/user/${id}/`, + method: 'delete', + data + }) +} + +export function changePassword(data) { + return request({ + url: '/system/user/password/', + method: 'put', + data + }) +} diff --git a/client/src/assets/404_images/404.png b/client/src/assets/404_images/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/client/src/assets/404_images/404.png differ diff --git a/client/src/assets/404_images/404_cloud.png b/client/src/assets/404_images/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/client/src/assets/404_images/404_cloud.png differ diff --git a/client/src/components/Breadcrumb/index.vue b/client/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..e65a60d --- /dev/null +++ b/client/src/components/Breadcrumb/index.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/client/src/components/Hamburger/index.vue b/client/src/components/Hamburger/index.vue new file mode 100644 index 0000000..368b002 --- /dev/null +++ b/client/src/components/Hamburger/index.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/client/src/components/Pagination/index.vue b/client/src/components/Pagination/index.vue new file mode 100644 index 0000000..e316e20 --- /dev/null +++ b/client/src/components/Pagination/index.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/client/src/components/SvgIcon/index.vue b/client/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..9a3318e --- /dev/null +++ b/client/src/components/SvgIcon/index.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/client/src/directive/el-table/adaptive.js b/client/src/directive/el-table/adaptive.js new file mode 100644 index 0000000..298daea --- /dev/null +++ b/client/src/directive/el-table/adaptive.js @@ -0,0 +1,42 @@ +import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event' + +/** + * How to use + * ... + * el-table height is must be set + * bottomOffset: 30(default) // The height of the table from the bottom of the page. + */ + +const doResize = (el, binding, vnode) => { + const { componentInstance: $table } = vnode + + const { value } = binding + + if (!$table.height) { + throw new Error(`el-$table must set the height. Such as height='100px'`) + } + const bottomOffset = (value && value.bottomOffset) || 30 + + if (!$table) return + + const height = window.innerHeight - el.getBoundingClientRect().top - bottomOffset + $table.$nextTick(() => { + $table.layout.setHeight(height) + }) +} + +export default { + bind(el, binding, vnode) { + el.resizeListener = () => { + doResize(el, binding, vnode) + } + // parameter 1 is must be "Element" type + addResizeListener(window.document.body, el.resizeListener) + }, + inserted(el, binding, vnode) { + doResize(el, binding, vnode) + }, + unbind(el) { + removeResizeListener(window.document.body, el.resizeListener) + } +} diff --git a/client/src/directive/el-table/index.js b/client/src/directive/el-table/index.js new file mode 100644 index 0000000..d3d4515 --- /dev/null +++ b/client/src/directive/el-table/index.js @@ -0,0 +1,13 @@ +import adaptive from './adaptive' + +const install = function(Vue) { + Vue.directive('el-height-adaptive-table', adaptive) +} + +if (window.Vue) { + window['el-height-adaptive-table'] = adaptive + Vue.use(install); // eslint-disable-line +} + +adaptive.install = install +export default adaptive diff --git a/client/src/icons/index.js b/client/src/icons/index.js new file mode 100644 index 0000000..2c6b309 --- /dev/null +++ b/client/src/icons/index.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import SvgIcon from '@/components/SvgIcon'// svg component + +// register globally +Vue.component('svg-icon', SvgIcon) + +const req = require.context('./svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys().map(requireContext) +requireAll(req) diff --git a/client/src/icons/svg/404.svg b/client/src/icons/svg/404.svg new file mode 100644 index 0000000..6df5019 --- /dev/null +++ b/client/src/icons/svg/404.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/bug.svg b/client/src/icons/svg/bug.svg new file mode 100644 index 0000000..05a150d --- /dev/null +++ b/client/src/icons/svg/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/chart.svg b/client/src/icons/svg/chart.svg new file mode 100644 index 0000000..27728fb --- /dev/null +++ b/client/src/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/clipboard.svg b/client/src/icons/svg/clipboard.svg new file mode 100644 index 0000000..90923ff --- /dev/null +++ b/client/src/icons/svg/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/component.svg b/client/src/icons/svg/component.svg new file mode 100644 index 0000000..207ada3 --- /dev/null +++ b/client/src/icons/svg/component.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/dashboard.svg b/client/src/icons/svg/dashboard.svg new file mode 100644 index 0000000..5317d37 --- /dev/null +++ b/client/src/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/documentation.svg b/client/src/icons/svg/documentation.svg new file mode 100644 index 0000000..7043122 --- /dev/null +++ b/client/src/icons/svg/documentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/drag.svg b/client/src/icons/svg/drag.svg new file mode 100644 index 0000000..4185d3c --- /dev/null +++ b/client/src/icons/svg/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/edit.svg b/client/src/icons/svg/edit.svg new file mode 100644 index 0000000..d26101f --- /dev/null +++ b/client/src/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/education.svg b/client/src/icons/svg/education.svg new file mode 100644 index 0000000..7bfb01d --- /dev/null +++ b/client/src/icons/svg/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/email.svg b/client/src/icons/svg/email.svg new file mode 100644 index 0000000..74d25e2 --- /dev/null +++ b/client/src/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/example.svg b/client/src/icons/svg/example.svg new file mode 100644 index 0000000..46f42b5 --- /dev/null +++ b/client/src/icons/svg/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/excel.svg b/client/src/icons/svg/excel.svg new file mode 100644 index 0000000..74d97b8 --- /dev/null +++ b/client/src/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/exit-fullscreen.svg b/client/src/icons/svg/exit-fullscreen.svg new file mode 100644 index 0000000..485c128 --- /dev/null +++ b/client/src/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/eye-open.svg b/client/src/icons/svg/eye-open.svg new file mode 100644 index 0000000..88dcc98 --- /dev/null +++ b/client/src/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/eye.svg b/client/src/icons/svg/eye.svg new file mode 100644 index 0000000..16ed2d8 --- /dev/null +++ b/client/src/icons/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/form.svg b/client/src/icons/svg/form.svg new file mode 100644 index 0000000..dcbaa18 --- /dev/null +++ b/client/src/icons/svg/form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/fullscreen.svg b/client/src/icons/svg/fullscreen.svg new file mode 100644 index 0000000..0e86b6f --- /dev/null +++ b/client/src/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/guide.svg b/client/src/icons/svg/guide.svg new file mode 100644 index 0000000..b271001 --- /dev/null +++ b/client/src/icons/svg/guide.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/icon.svg b/client/src/icons/svg/icon.svg new file mode 100644 index 0000000..82be8ee --- /dev/null +++ b/client/src/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/international.svg b/client/src/icons/svg/international.svg new file mode 100644 index 0000000..e9b56ee --- /dev/null +++ b/client/src/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/language.svg b/client/src/icons/svg/language.svg new file mode 100644 index 0000000..0082b57 --- /dev/null +++ b/client/src/icons/svg/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/link.svg b/client/src/icons/svg/link.svg new file mode 100644 index 0000000..48197ba --- /dev/null +++ b/client/src/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/list.svg b/client/src/icons/svg/list.svg new file mode 100644 index 0000000..20259ed --- /dev/null +++ b/client/src/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/lock.svg b/client/src/icons/svg/lock.svg new file mode 100644 index 0000000..74fee54 --- /dev/null +++ b/client/src/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/message.svg b/client/src/icons/svg/message.svg new file mode 100644 index 0000000..14ca817 --- /dev/null +++ b/client/src/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/money.svg b/client/src/icons/svg/money.svg new file mode 100644 index 0000000..c1580de --- /dev/null +++ b/client/src/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/nested.svg b/client/src/icons/svg/nested.svg new file mode 100644 index 0000000..06713a8 --- /dev/null +++ b/client/src/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/password.svg b/client/src/icons/svg/password.svg new file mode 100644 index 0000000..e291d85 --- /dev/null +++ b/client/src/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/pdf.svg b/client/src/icons/svg/pdf.svg new file mode 100644 index 0000000..957aa0c --- /dev/null +++ b/client/src/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/people.svg b/client/src/icons/svg/people.svg new file mode 100644 index 0000000..2bd54ae --- /dev/null +++ b/client/src/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/peoples.svg b/client/src/icons/svg/peoples.svg new file mode 100644 index 0000000..aab852e --- /dev/null +++ b/client/src/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/position.svg b/client/src/icons/svg/position.svg new file mode 100644 index 0000000..f89f0e0 --- /dev/null +++ b/client/src/icons/svg/position.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/qq.svg b/client/src/icons/svg/qq.svg new file mode 100644 index 0000000..ee13d4e --- /dev/null +++ b/client/src/icons/svg/qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/search.svg b/client/src/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/client/src/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/shopping.svg b/client/src/icons/svg/shopping.svg new file mode 100644 index 0000000..87513e7 --- /dev/null +++ b/client/src/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/size.svg b/client/src/icons/svg/size.svg new file mode 100644 index 0000000..ddb25b8 --- /dev/null +++ b/client/src/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/skill.svg b/client/src/icons/svg/skill.svg new file mode 100644 index 0000000..a3b7312 --- /dev/null +++ b/client/src/icons/svg/skill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/star.svg b/client/src/icons/svg/star.svg new file mode 100644 index 0000000..6cf86e6 --- /dev/null +++ b/client/src/icons/svg/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/tab.svg b/client/src/icons/svg/tab.svg new file mode 100644 index 0000000..b4b48e4 --- /dev/null +++ b/client/src/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/table.svg b/client/src/icons/svg/table.svg new file mode 100644 index 0000000..0e3dc9d --- /dev/null +++ b/client/src/icons/svg/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/theme.svg b/client/src/icons/svg/theme.svg new file mode 100644 index 0000000..5982a2f --- /dev/null +++ b/client/src/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/tree-table.svg b/client/src/icons/svg/tree-table.svg new file mode 100644 index 0000000..8aafdb8 --- /dev/null +++ b/client/src/icons/svg/tree-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/tree.svg b/client/src/icons/svg/tree.svg new file mode 100644 index 0000000..dd4b7dd --- /dev/null +++ b/client/src/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/user.svg b/client/src/icons/svg/user.svg new file mode 100644 index 0000000..0ba0716 --- /dev/null +++ b/client/src/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/wechat.svg b/client/src/icons/svg/wechat.svg new file mode 100644 index 0000000..c586e55 --- /dev/null +++ b/client/src/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/zip.svg b/client/src/icons/svg/zip.svg new file mode 100644 index 0000000..f806fc4 --- /dev/null +++ b/client/src/icons/svg/zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svgo.yml b/client/src/icons/svgo.yml new file mode 100644 index 0000000..d11906a --- /dev/null +++ b/client/src/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/client/src/layout/components/AppMain.vue b/client/src/layout/components/AppMain.vue new file mode 100644 index 0000000..f6a3286 --- /dev/null +++ b/client/src/layout/components/AppMain.vue @@ -0,0 +1,40 @@ + + + + + + + diff --git a/client/src/layout/components/Navbar.vue b/client/src/layout/components/Navbar.vue new file mode 100644 index 0000000..d053e87 --- /dev/null +++ b/client/src/layout/components/Navbar.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/client/src/layout/components/Sidebar/FixiOSBug.js b/client/src/layout/components/Sidebar/FixiOSBug.js new file mode 100644 index 0000000..bc14856 --- /dev/null +++ b/client/src/layout/components/Sidebar/FixiOSBug.js @@ -0,0 +1,26 @@ +export default { + computed: { + device() { + return this.$store.state.app.device + } + }, + mounted() { + // In order to fix the click on menu on the ios device will trigger the mouseleave bug + // https://github.com/PanJiaChen/vue-element-admin/issues/1135 + this.fixBugIniOS() + }, + methods: { + fixBugIniOS() { + const $subMenu = this.$refs.subMenu + if ($subMenu) { + const handleMouseleave = $subMenu.handleMouseleave + $subMenu.handleMouseleave = (e) => { + if (this.device === 'mobile') { + return + } + handleMouseleave(e) + } + } + } + } +} diff --git a/client/src/layout/components/Sidebar/Item.vue b/client/src/layout/components/Sidebar/Item.vue new file mode 100644 index 0000000..b515f61 --- /dev/null +++ b/client/src/layout/components/Sidebar/Item.vue @@ -0,0 +1,29 @@ + diff --git a/client/src/layout/components/Sidebar/Link.vue b/client/src/layout/components/Sidebar/Link.vue new file mode 100644 index 0000000..eb4dd10 --- /dev/null +++ b/client/src/layout/components/Sidebar/Link.vue @@ -0,0 +1,36 @@ + + + + diff --git a/client/src/layout/components/Sidebar/Logo.vue b/client/src/layout/components/Sidebar/Logo.vue new file mode 100644 index 0000000..7121590 --- /dev/null +++ b/client/src/layout/components/Sidebar/Logo.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/client/src/layout/components/Sidebar/SidebarItem.vue b/client/src/layout/components/Sidebar/SidebarItem.vue new file mode 100644 index 0000000..a418c3d --- /dev/null +++ b/client/src/layout/components/Sidebar/SidebarItem.vue @@ -0,0 +1,95 @@ + + + diff --git a/client/src/layout/components/Sidebar/index.vue b/client/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..fb014a2 --- /dev/null +++ b/client/src/layout/components/Sidebar/index.vue @@ -0,0 +1,54 @@ + + + diff --git a/client/src/layout/components/index.js b/client/src/layout/components/index.js new file mode 100644 index 0000000..97ee3cd --- /dev/null +++ b/client/src/layout/components/index.js @@ -0,0 +1,3 @@ +export { default as Navbar } from './Navbar' +export { default as Sidebar } from './Sidebar' +export { default as AppMain } from './AppMain' diff --git a/client/src/layout/index.vue b/client/src/layout/index.vue new file mode 100644 index 0000000..db22a7b --- /dev/null +++ b/client/src/layout/index.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/client/src/layout/mixin/ResizeHandler.js b/client/src/layout/mixin/ResizeHandler.js new file mode 100644 index 0000000..e8d0df8 --- /dev/null +++ b/client/src/layout/mixin/ResizeHandler.js @@ -0,0 +1,45 @@ +import store from '@/store' + +const { body } = document +const WIDTH = 992 // refer to Bootstrap's responsive design + +export default { + watch: { + $route(route) { + if (this.device === 'mobile' && this.sidebar.opened) { + store.dispatch('app/closeSideBar', { withoutAnimation: false }) + } + } + }, + beforeMount() { + window.addEventListener('resize', this.$_resizeHandler) + }, + beforeDestroy() { + window.removeEventListener('resize', this.$_resizeHandler) + }, + mounted() { + const isMobile = this.$_isMobile() + if (isMobile) { + store.dispatch('app/toggleDevice', 'mobile') + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_isMobile() { + const rect = body.getBoundingClientRect() + return rect.width - 1 < WIDTH + }, + $_resizeHandler() { + if (!document.hidden) { + const isMobile = this.$_isMobile() + store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') + + if (isMobile) { + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + } + } + } +} diff --git a/client/src/main.js b/client/src/main.js new file mode 100644 index 0000000..701c67a --- /dev/null +++ b/client/src/main.js @@ -0,0 +1,44 @@ +import Vue from 'vue' + +import 'normalize.css/normalize.css' // A modern alternative to CSS resets + +import ElementUI from 'element-ui' +import 'element-ui/lib/theme-chalk/index.css' +// import locale from 'element-ui/lib/locale/lang/en' // lang i18n + +import '@/styles/index.scss' // global css + +import App from './App' +import store from './store' +import router from './router' + +import '@/icons' // icon +import '@/permission' // permission control +import tableHeight from '@/directive/el-table/index' +Vue.use(tableHeight) +/** + * If you don't want to use mock-server + * you want to use MockJs for mock api + * you can execute: mockXHR() + * + * Currently MockJs will be used in the production environment, + * please remove it before going online ! ! ! + */ +if (process.env.NODE_ENV === 'production') { + const { mockXHR } = require('../mock') + mockXHR() +} + +// set ElementUI lang to EN +// Vue.use(ElementUI, { locale }) +// 如果想要中文版 element-ui,按如下方式声明 +Vue.use(ElementUI, { size: 'medium' }) +Vue.config.productionTip = false + + +new Vue({ + el: '#app', + router, + store, + render: h => h(App) +}) diff --git a/client/src/permission.js b/client/src/permission.js new file mode 100644 index 0000000..d4a08b6 --- /dev/null +++ b/client/src/permission.js @@ -0,0 +1,73 @@ +import router from './router' +import store from './store' +import { Message } from 'element-ui' +import NProgress from 'nprogress' // progress bar +import 'nprogress/nprogress.css' // progress bar style +import { getToken } from '@/utils/auth' // get token from cookie +import getPageTitle from '@/utils/get-page-title' + +NProgress.configure({ showSpinner: false }) // NProgress Configuration + +const whiteList = ['/login'] // no redirect whitelist + +router.beforeEach(async(to, from, next) => { + // start progress bar + NProgress.start() + + // set page title + document.title = getPageTitle(to.meta.title) + + // determine whether the user has logged in + const hasToken = getToken() + + if (hasToken) { + if (to.path === '/login') { + // if is logged in, redirect to the home page + next({ path: '/' }) + NProgress.done() + } else { + // determine whether the user has obtained his permission perms through getInfo + const hasPerms = store.getters.perms && store.getters.perms.length > 0 + if (hasPerms) { + next() + } else { + try { + // get user info + // note: perms must be a object array! such as: ['admin'] or ,['developer','editor'] + const { perms } = await store.dispatch('user/getInfo') + // generate accessible routes map based on perms + const accessRoutes = await store.dispatch('permission/generateRoutes', perms) + + // dynamically add accessible routes + router.addRoutes(accessRoutes) + + // hack method to ensure that addRoutes is complete + // set the replace: true, so the navigation will not leave a history record + next({ ...to, replace: true }) + } catch (error) { + // remove token and go to login page to re-login + await store.dispatch('user/resetToken') + Message.error(error || 'Has Error') + next(`/login?redirect=${to.path}`) + NProgress.done() + } + } + } + } else { + /* has no token*/ + + if (whiteList.indexOf(to.path) !== -1) { + // in the free login whitelist, go directly + next() + } else { + // other pages that do not have permission to access are redirected to the login page. + next(`/login?redirect=${to.path}`) + NProgress.done() + } + } +}) + +router.afterEach(() => { + // finish progress bar + NProgress.done() +}) diff --git a/client/src/router/index.js b/client/src/router/index.js new file mode 100644 index 0000000..8d33a62 --- /dev/null +++ b/client/src/router/index.js @@ -0,0 +1,195 @@ +import Vue from 'vue' +import Router from 'vue-router' + +Vue.use(Router) + +/* Layout */ +import Layout from '@/layout' + +/** + * Note: sub-menu only appear when route children.length >= 1 + * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html + * + * hidden: true if set true, item will not show in the sidebar(default is false) + * alwaysShow: true if set true, will always show the root menu + * if not set alwaysShow, when item has more than one children route, + * it will becomes nested mode, otherwise not show the root menu + * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb + * name:'router-name' the name is used by (must set!!!) + * meta : { + perms: ['admin','editor'] control the page perms (you can set multiple perms) + title: 'title' the name show in sidebar and breadcrumb (recommend set) + icon: 'svg-name' the icon show in the sidebar + breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) + activeMenu: '/example/list' if set path, the sidebar will highlight the path you set + } + */ + +/** + * constantRoutes + * a base page that does not have permission requirements + * all perms can be accessed + */ +export const constantRoutes = [ + { + path: '/login', + component: () => import('@/views/login/index'), + hidden: true + }, + + { + path: '/404', + component: () => import('@/views/404'), + hidden: true + }, + { + path: '/', + component: Layout, + redirect: '/dashboard', + children: [{ + path: 'dashboard', + name: 'Dashboard', + component: () => import('@/views/dashboard/index'), + meta: { title: '首页', icon: 'dashboard' } + }] + }, + { + path: '/changepassword', + component: Layout, + redirect: '/changepassword', + name: 'ChangePW', + meta: { title: '修改密码', icon: 'tree' }, + hidden:true, + children: [ + { + path: '', + name: 'ChangePassword', + component: () => import('@/views/system/changepassword'), + meta: { title: '修改密码', noCache: true, icon: ''}, + hidden: true + }, + ] + }, + +] + +/** + * asyncRoutes + * the routes that need to be dynamically loaded based on user perms + */ +export const asyncRoutes = [ + { + path: '/system', + component: Layout, + redirect: '/system/user', + name: 'System', + meta: { title: '系统管理', icon: 'example', perms: ['system_manage'] }, + children: [ + { + path: 'user', + name: 'User', + component: () => import('@/views/system/user.vue'), + meta: { title: '用户管理', icon: 'user', perms: ['user_manage'] } + }, + { + path: 'organization', + name: 'Organization', + component: () => import('@/views/system/organization'), + meta: { title: '部门管理', icon: 'tree', perms: ['org_manage'] } + }, + { + path: 'role', + name: 'Role', + component: () => import('@/views/system/role'), + meta: { title: '角色管理', icon: 'lock', perms: ['role_manage'] } + }, + { + path: 'position', + name: 'Postion', + component: () => import('@/views/system/position'), + meta: { title: '岗位管理', icon: 'position', perms: ['position_manage'] } + }, + { + path: 'dict', + name: 'Dict', + component: () => import('@/views/system/dict'), + meta: { title: '数据字典', icon: 'example', perms: ['dict_manage'] } + }, + { + path: 'file', + name: 'File', + component: () => import('@/views/system/file'), + meta: { title: '文件库', icon: 'documentation', perms: ['file_room'] } + }, + { + path: 'task', + name: 'Task', + component: () => import('@/views/system/task'), + meta: { title: '定时任务', icon: 'list', perms: ['ptask_manage'] } + } + ] + }, + { + path: '/develop', + component: Layout, + redirect: '/develop/perm', + name: 'Develop', + meta: { title: '开发配置', icon: 'example', perms: ['dev_set'] }, + children: [ + { + path: 'perm', + name: 'Perm', + component: () => import('@/views/system/perm'), + meta: { title: '权限菜单', icon: 'example', perms: ['perm_manage'] } + }, + { + path: 'form-gen-link', + component: Layout, + children: [ + { + path: 'https://jakhuang.github.io/form-generator/', + meta: { title: '表单设计器', icon: 'link', perms: ['dev_form_gen'] } + } + ] + }, + { + path: 'docs-link', + component: Layout, + children: [ + { + path: process.env.VUE_APP_BASE_API + '/docs/', + meta: { title: '接口文档', icon: 'link', perms: ['dev_docs'] } + } + ] + }, + { + path: 'admin-link', + component: Layout, + children: [ + { + path: process.env.VUE_APP_BASE_API + '/admin/', + meta: { title: 'Django后台', icon: 'link', perms: ['dev_admin'] } + } + ] + } + ] + }, + // 404 page must be placed at the end !!! + { path: '*', redirect: '/404', hidden: true } +] + +const createRouter = () => new Router({ + // mode: 'history', // require service support + scrollBehavior: () => ({ y: 0 }), + routes: constantRoutes +}) + +const router = createRouter() + +// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 +export function resetRouter() { + const newRouter = createRouter() + router.matcher = newRouter.matcher // reset router +} + +export default router diff --git a/client/src/settings.js b/client/src/settings.js new file mode 100644 index 0000000..585109b --- /dev/null +++ b/client/src/settings.js @@ -0,0 +1,16 @@ +module.exports = { + + title: '管理系统', + + /** + * @type {boolean} true | false + * @description Whether fix the header + */ + fixedHeader: false, + + /** + * @type {boolean} true | false + * @description Whether show the logo in sidebar + */ + sidebarLogo: true +} diff --git a/client/src/store/getters.js b/client/src/store/getters.js new file mode 100644 index 0000000..1854b88 --- /dev/null +++ b/client/src/store/getters.js @@ -0,0 +1,10 @@ +const getters = { + sidebar: state => state.app.sidebar, + device: state => state.app.device, + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + perms: state => state.user.perms, + permission_routes: state => state.permission.routes +} +export default getters diff --git a/client/src/store/index.js b/client/src/store/index.js new file mode 100644 index 0000000..6ae5dad --- /dev/null +++ b/client/src/store/index.js @@ -0,0 +1,21 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import getters from './getters' +import app from './modules/app' +import permission from './modules/permission' +import settings from './modules/settings' +import user from './modules/user' + +Vue.use(Vuex) + +const store = new Vuex.Store({ + modules: { + app, + permission, + settings, + user + }, + getters +}) + +export default store diff --git a/client/src/store/modules/app.js b/client/src/store/modules/app.js new file mode 100644 index 0000000..7ea7e33 --- /dev/null +++ b/client/src/store/modules/app.js @@ -0,0 +1,48 @@ +import Cookies from 'js-cookie' + +const state = { + sidebar: { + opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, + withoutAnimation: false + }, + device: 'desktop' +} + +const mutations = { + TOGGLE_SIDEBAR: state => { + state.sidebar.opened = !state.sidebar.opened + state.sidebar.withoutAnimation = false + if (state.sidebar.opened) { + Cookies.set('sidebarStatus', 1) + } else { + Cookies.set('sidebarStatus', 0) + } + }, + CLOSE_SIDEBAR: (state, withoutAnimation) => { + Cookies.set('sidebarStatus', 0) + state.sidebar.opened = false + state.sidebar.withoutAnimation = withoutAnimation + }, + TOGGLE_DEVICE: (state, device) => { + state.device = device + } +} + +const actions = { + toggleSideBar({ commit }) { + commit('TOGGLE_SIDEBAR') + }, + closeSideBar({ commit }, { withoutAnimation }) { + commit('CLOSE_SIDEBAR', withoutAnimation) + }, + toggleDevice({ commit }, device) { + commit('TOGGLE_DEVICE', device) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/client/src/store/modules/permission.js b/client/src/store/modules/permission.js new file mode 100644 index 0000000..1ae691e --- /dev/null +++ b/client/src/store/modules/permission.js @@ -0,0 +1,68 @@ +import { asyncRoutes, constantRoutes } from '@/router' + +/** + * Use meta.perm to determine if the current user has permission + * @param perms + * @param route + */ +function hasPermission(perms, route) { + if (route.meta && route.meta.perms) { + return perms.some(perm => route.meta.perms.includes(perm)) + } else { + return true + } +} + +/** + * Filter asynchronous routing tables by recursion + * @param routes asyncRoutes + * @param perms + */ +export function filterAsyncRoutes(routes, perms) { + const res = [] + + routes.forEach(route => { + const tmp = { ...route } + if (hasPermission(perms, tmp)) { + if (tmp.children) { + tmp.children = filterAsyncRoutes(tmp.children, perms) + } + res.push(tmp) + } + }) + return res +} + +const state = { + routes: [], + addRoutes: [] +} + +const mutations = { + SET_ROUTES: (state, routes) => { + state.addRoutes = routes + state.routes = constantRoutes.concat(routes) + } +} + +const actions = { + generateRoutes({ commit }, perms) { + return new Promise(resolve => { + let accessedRoutes + if (perms.includes('admin')) { + accessedRoutes = asyncRoutes || [] + } else { + accessedRoutes = filterAsyncRoutes(asyncRoutes, perms) + } + commit('SET_ROUTES', accessedRoutes) + resolve(accessedRoutes) + }) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/client/src/store/modules/settings.js b/client/src/store/modules/settings.js new file mode 100644 index 0000000..aab31a2 --- /dev/null +++ b/client/src/store/modules/settings.js @@ -0,0 +1,31 @@ +import defaultSettings from '@/settings' + +const { showSettings, fixedHeader, sidebarLogo } = defaultSettings + +const state = { + showSettings: showSettings, + fixedHeader: fixedHeader, + sidebarLogo: sidebarLogo +} + +const mutations = { + CHANGE_SETTING: (state, { key, value }) => { + if (state.hasOwnProperty(key)) { + state[key] = value + } + } +} + +const actions = { + changeSetting({ commit }, data) { + commit('CHANGE_SETTING', data) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/client/src/store/modules/user.js b/client/src/store/modules/user.js new file mode 100644 index 0000000..3dba2c2 --- /dev/null +++ b/client/src/store/modules/user.js @@ -0,0 +1,108 @@ +import { login, logout, getInfo } from '@/api/user' +import { getToken, setToken, removeToken } from '@/utils/auth' +import { resetRouter } from '@/router' + +const getDefaultState = () => { + return { + token: getToken(), + name: '', + avatar: '', + perms: [] + } +} + +const state = getDefaultState() + +const mutations = { + RESET_STATE: (state) => { + Object.assign(state, getDefaultState()) + }, + SET_TOKEN: (state, token) => { + state.token = token + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + }, + SET_PERMS: (state, perms) => { + state.perms = perms + } +} + +const actions = { + // user login + login({ commit }, userInfo) { + const { username, password } = userInfo + return new Promise((resolve, reject) => { + login({ username: username.trim(), password: password }).then(response => { + const { data } = response + commit('SET_TOKEN', data.access) + setToken(data.access) + resolve() + + }).catch(error => { + reject(error) + }) + }) + }, + + // get user info + getInfo({ commit, state }) { + return new Promise((resolve, reject) => { + getInfo(state.token).then(response => { + const { data } = response + + if (!data) { + reject('验证失败,重新登陆.') + } + + const { perms, name, avatar } = data + + // perms must be a non-empty array + if (!perms || perms.length <= 0) { + reject('没有任何权限!') + } + + commit('SET_PERMS', perms) + commit('SET_NAME', name) + commit('SET_AVATAR', avatar) + resolve(data) + }).catch(error => { + reject(error) + }) + }) + }, + + // user logout + logout({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + removeToken() // must remove token first + resetRouter() + commit('RESET_STATE') + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // remove token + resetToken({ commit }) { + return new Promise(resolve => { + removeToken() // must remove token first + commit('RESET_STATE') + resolve() + }) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/client/src/styles/element-ui.scss b/client/src/styles/element-ui.scss new file mode 100644 index 0000000..0062411 --- /dev/null +++ b/client/src/styles/element-ui.scss @@ -0,0 +1,49 @@ +// cover some element-ui styles + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type="file"] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + + +// to fixed https://github.com/ElemeFE/element/issues/2461 +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block + } +} + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} diff --git a/client/src/styles/index.scss b/client/src/styles/index.scss new file mode 100644 index 0000000..059de63 --- /dev/null +++ b/client/src/styles/index.scss @@ -0,0 +1,124 @@ +@import './variables.scss'; +@import './mixin.scss'; +@import './transition.scss'; +@import './element-ui.scss'; +@import './sidebar.scss'; + +body { + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; +} + +label { + font-weight: 700; +} + +html { + height: 100%; + box-sizing: border-box; +} + +#app { + height: 100%; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +a:focus, +a:active { + outline: none; +} + +a, +a:focus, +a:hover { + cursor: pointer; + color: inherit; + text-decoration: none; +} + +div:focus { + outline: none; +} + +.clearfix { + &:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; + } +} + +// main-container global css +.app-container { + padding: 10px; +} + +.el-table--medium td,   .el-table--medium th { + padding: 2px 0; +} +.el-form-item { + margin-bottom: 16px; +} +.el-card, .el-message { + border-radius: 0px; + overflow: hidden; +} +.el-card__body { + padding: 6px; +} +.el-card__header { + padding: 6px; +} +.el-tabs--border-card>.el-tabs__content { + padding: 6px; +} +.el-dialog__header { + padding: 10px 10px 6px; +} +// .el-dialog{ +// display: flex; +// flex-direction: column; +// margin:0 !important; +// position:absolute; +// top:50%; +// left:50%; +// transform:translate(-50%,-50%); +// /*height:600px;*/ +// max-height:calc(100% - 30px); +// max-width:calc(100% - 30px); +// } +.el-dialog .el-dialog__body{ + // flex:1; + // overflow: auto; + padding: 8px 12px; +} + +.el-form--label-top .el-form-item__label { + line-height: 16px; +} +.el-button+.el-button { + margin-left: 1px; +} +.el-tabs__header { + margin: 0 0 6px; +} +.pagination-container { + padding: 0px 0px; +} +body .el-table th.gutter{ + display: table-cell!important; +} +.el-dialog__footer{ + padding: 6px 6px 6px; +} diff --git a/client/src/styles/mixin.scss b/client/src/styles/mixin.scss new file mode 100644 index 0000000..36b74bb --- /dev/null +++ b/client/src/styles/mixin.scss @@ -0,0 +1,28 @@ +@mixin clearfix { + &:after { + content: ""; + display: table; + clear: both; + } +} + +@mixin scrollBar { + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } +} + +@mixin relative { + position: relative; + width: 100%; + height: 100%; +} diff --git a/client/src/styles/sidebar.scss b/client/src/styles/sidebar.scss new file mode 100644 index 0000000..3dad4c3 --- /dev/null +++ b/client/src/styles/sidebar.scss @@ -0,0 +1,209 @@ +#app { + + .main-container { + min-height: 100%; + transition: margin-left .28s; + margin-left: $sideBarWidth; + position: relative; + } + + .sidebar-container { + transition: width 0.28s; + width: $sideBarWidth !important; + background-color: $menuBg; + height: 100%; + position: fixed; + font-size: 0px; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; + + // reset element-ui css + .horizontal-collapse-transition { + transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; + } + + .scrollbar-wrapper { + overflow-x: hidden !important; + } + + .el-scrollbar__bar.is-vertical { + right: 0px; + } + + .el-scrollbar { + height: 100%; + } + + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } + + .is-horizontal { + display: none; + } + + a { + display: inline-block; + width: 100%; + overflow: hidden; + } + + .svg-icon { + margin-right: 16px; + } + + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } + + // menu hover + .submenu-title-noDropdown, + .el-submenu__title { + &:hover { + background-color: $menuHover !important; + } + } + + .is-active>.el-submenu__title { + color: $subMenuActiveText !important; + } + + & .nest-menu .el-submenu>.el-submenu__title, + & .el-submenu .el-menu-item { + min-width: $sideBarWidth !important; + background-color: $subMenuBg !important; + + &:hover { + background-color: $subMenuHover !important; + } + } + } + + .hideSidebar { + .sidebar-container { + width: 54px !important; + } + + .main-container { + margin-left: 54px; + } + + .submenu-title-noDropdown { + padding: 0 !important; + position: relative; + + .el-tooltip { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-submenu { + overflow: hidden; + + &>.el-submenu__title { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + + .el-submenu__icon-arrow { + display: none; + } + } + } + + .el-menu--collapse { + .el-submenu { + &>.el-submenu__title { + &>span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } + + .el-menu--collapse .el-menu .el-submenu { + min-width: $sideBarWidth !important; + } + + // mobile responsive + .mobile { + .main-container { + margin-left: 0px; + } + + .sidebar-container { + transition: transform .28s; + width: $sideBarWidth !important; + } + + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$sideBarWidth, 0, 0); + } + } + } + + .withoutAnimation { + + .main-container, + .sidebar-container { + transition: none; + } + } +} + +// when menu collapsed +.el-menu--vertical { + &>.el-menu { + .svg-icon { + margin-right: 16px; + } + } + + .nest-menu .el-submenu>.el-submenu__title, + .el-menu-item { + &:hover { + // you can use $subMenuHover + background-color: $menuHover !important; + } + } + + // the scroll bar appears when the subMenu is too long + >.el-menu--popup { + max-height: 100vh; + overflow-y: auto; + + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } + } +} diff --git a/client/src/styles/transition.scss b/client/src/styles/transition.scss new file mode 100644 index 0000000..4cb27cc --- /dev/null +++ b/client/src/styles/transition.scss @@ -0,0 +1,48 @@ +// global transition css + +/* fade */ +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.28s; +} + +.fade-enter, +.fade-leave-active { + opacity: 0; +} + +/* fade-transform */ +.fade-transform-leave-active, +.fade-transform-enter-active { + transition: all .5s; +} + +.fade-transform-enter { + opacity: 0; + transform: translateX(-30px); +} + +.fade-transform-leave-to { + opacity: 0; + transform: translateX(30px); +} + +/* breadcrumb transition */ +.breadcrumb-enter-active, +.breadcrumb-leave-active { + transition: all .5s; +} + +.breadcrumb-enter, +.breadcrumb-leave-active { + opacity: 0; + transform: translateX(20px); +} + +.breadcrumb-move { + transition: all .5s; +} + +.breadcrumb-leave-active { + position: absolute; +} diff --git a/client/src/styles/variables.scss b/client/src/styles/variables.scss new file mode 100644 index 0000000..be55772 --- /dev/null +++ b/client/src/styles/variables.scss @@ -0,0 +1,25 @@ +// sidebar +$menuText:#bfcbd9; +$menuActiveText:#409EFF; +$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 + +$menuBg:#304156; +$menuHover:#263445; + +$subMenuBg:#1f2d3d; +$subMenuHover:#001528; + +$sideBarWidth: 210px; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + menuText: $menuText; + menuActiveText: $menuActiveText; + subMenuActiveText: $subMenuActiveText; + menuBg: $menuBg; + menuHover: $menuHover; + subMenuBg: $subMenuBg; + subMenuHover: $subMenuHover; + sideBarWidth: $sideBarWidth; +} diff --git a/client/src/utils/auth.js b/client/src/utils/auth.js new file mode 100644 index 0000000..392db62 --- /dev/null +++ b/client/src/utils/auth.js @@ -0,0 +1,25 @@ +import Cookies from 'js-cookie' + +const TokenKey = 'token' + +export function getToken() { + return Cookies.get(TokenKey) +} + +export function setToken(token) { + return Cookies.set(TokenKey, token) +} + +export function removeToken() { + return Cookies.remove(TokenKey) +} + +// export function refreshToken() { +// let token = getToken() +// let data = {"token": token} +// return request({ +// url: '/token/refresh/', +// method: 'post', +// data +// }) +// } diff --git a/client/src/utils/get-page-title.js b/client/src/utils/get-page-title.js new file mode 100644 index 0000000..cfe5800 --- /dev/null +++ b/client/src/utils/get-page-title.js @@ -0,0 +1,10 @@ +import defaultSettings from '@/settings' + +const title = defaultSettings.title || '认证系统' + +export default function getPageTitle(pageTitle) { + if (pageTitle) { + return `${pageTitle} - ${title}` + } + return `${title}` +} diff --git a/client/src/utils/index.js b/client/src/utils/index.js new file mode 100644 index 0000000..722c202 --- /dev/null +++ b/client/src/utils/index.js @@ -0,0 +1,384 @@ +/** + * Created by PanJiaChen on 16/11/18. + */ + +/** + * Parse the time to string + * @param {(Object|string|number)} time + * @param {string} cFormat + * @returns {string | null} + */ +export function parseTime(time, cFormat) { + if (arguments.length === 0) { + return null + } + const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + const value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } + return value.toString().padStart(2, '0') + }) + return time_str +} + +/** + * @param {number} time + * @param {string} option + * @returns {string} + */ +export function formatTime(time, option) { + if (('' + time).length === 10) { + time = parseInt(time) * 1000 + } else { + time = +time + } + const d = new Date(time) + const now = Date.now() + + const diff = (now - d) / 1000 + + if (diff < 30) { + return '刚刚' + } else if (diff < 3600) { + // less 1 hour + return Math.ceil(diff / 60) + '分钟前' + } else if (diff < 3600 * 24) { + return Math.ceil(diff / 3600) + '小时前' + } else if (diff < 3600 * 24 * 2) { + return '1天前' + } + if (option) { + return parseTime(time, option) + } else { + return ( + d.getMonth() + + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) + } +} + +/** + * @param {string} url + * @returns {Object} + */ +export function getQueryObject(url) { + url = url == null ? window.location.href : url + const search = url.substring(url.lastIndexOf('?') + 1) + const obj = {} + const reg = /([^?&=]+)=([^?&=]*)/g + search.replace(reg, (rs, $1, $2) => { + const name = decodeURIComponent($1) + let val = decodeURIComponent($2) + val = String(val) + obj[name] = val + return rs + }) + return obj +} + +/** + * @param {string} input value + * @returns {number} output value + */ +export function byteLength(str) { + // returns the byte length of an utf8 string + let s = str.length + for (var i = str.length - 1; i >= 0; i--) { + const code = str.charCodeAt(i) + if (code > 0x7f && code <= 0x7ff) s++ + else if (code > 0x7ff && code <= 0xffff) s += 2 + if (code >= 0xDC00 && code <= 0xDFFF) i-- + } + return s +} + +/** + * @param {Array} actual + * @returns {Array} + */ +export function cleanArray(actual) { + const newArray = [] + for (let i = 0; i < actual.length; i++) { + if (actual[i]) { + newArray.push(actual[i]) + } + } + return newArray +} + +/** + * @param {Object} json + * @returns {Array} + */ +export function param(json) { + if (!json) return '' + return cleanArray( + Object.keys(json).map(key => { + if (json[key] === undefined) return '' + return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) + }) + ).join('&') +} + +/** + * @param {string} url + * @returns {Object} + */ +export function param2Obj(url) { + const search = url.split('?')[1] + if (!search) { + return {} + } + return JSON.parse( + '{"' + + decodeURIComponent(search) + .replace(/"/g, '\\"') + .replace(/&/g, '","') + .replace(/=/g, '":"') + .replace(/\+/g, ' ') + + '"}' + ) +} + +/** + * @param {string} val + * @returns {string} + */ +export function html2Text(val) { + const div = document.createElement('div') + div.innerHTML = val + return div.textContent || div.innerText +} + +/** + * Merges two objects, giving the last one precedence + * @param {Object} target + * @param {(Object|Array)} source + * @returns {Object} + */ +export function objectMerge(target, source) { + if (typeof target !== 'object') { + target = {} + } + if (Array.isArray(source)) { + return source.slice() + } + Object.keys(source).forEach(property => { + const sourceProperty = source[property] + if (typeof sourceProperty === 'object') { + target[property] = objectMerge(target[property], sourceProperty) + } else { + target[property] = sourceProperty + } + }) + return target +} + +/** + * @param {HTMLElement} element + * @param {string} className + */ +export function toggleClass(element, className) { + if (!element || !className) { + return + } + let classString = element.className + const nameIndex = classString.indexOf(className) + if (nameIndex === -1) { + classString += '' + className + } else { + classString = + classString.substr(0, nameIndex) + + classString.substr(nameIndex + className.length) + } + element.className = classString +} + +/** + * @param {string} type + * @returns {Date} + */ +export function getTime(type) { + if (type === 'start') { + return new Date().getTime() - 3600 * 1000 * 24 * 90 + } else { + return new Date(new Date().toDateString()) + } +} + +/** + * @param {Function} func + * @param {number} wait + * @param {boolean} immediate + * @return {*} + */ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} + +/** + * This is just a simple version of deep copy + * Has a lot of edge cases bug + * If you want to use a perfect deep copy, use lodash's _.cloneDeep + * @param {Object} source + * @returns {Object} + */ +export function deepClone(source) { + if (!source && typeof source !== 'object') { + throw new Error('error arguments', 'deepClone') + } + const targetObj = source.constructor === Array ? [] : {} + Object.keys(source).forEach(keys => { + if (source[keys] && typeof source[keys] === 'object') { + targetObj[keys] = deepClone(source[keys]) + } else { + targetObj[keys] = source[keys] + } + }) + return targetObj +} + +/** + * @param {Array} arr + * @returns {Array} + */ +export function uniqueArr(arr) { + return Array.from(new Set(arr)) +} + +/** + * @returns {string} + */ +export function createUniqueString() { + const timestamp = +new Date() + '' + const randomNum = parseInt((1 + Math.random()) * 65536) + '' + return (+(randomNum + timestamp)).toString(32) +} + +/** + * Check if an element has a class + * @param {HTMLElement} elm + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele, cls) { + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) +} + +/** + * Add class to element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function addClass(ele, cls) { + if (!hasClass(ele, cls)) ele.className += ' ' + cls +} + +/** + * Remove class from element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function removeClass(ele, cls) { + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') + ele.className = ele.className.replace(reg, ' ') + } +} + +export function genTree(data) { + const result = [] + if (!Array.isArray(data)) { + return result + } + data.forEach(item => { + delete item.children + }) + const map = {} + data.forEach(item => { + item.label = item.name + if(item.fullname){ + item.label = item.fullname + } + item.value = item.id + map[item.id] = item + }) + data.forEach(item => { + const parent = map[item.parent] + if (parent) { + (parent.children || (parent.children = [])).push(item) + } else { + result.push(item) + } + }) + return result +} + +const arrChange = arr => arr.map(item => { + const res = {} + for (const key in item) { + const _key = key === 'name' ? 'label' : key + res[_key] = Array.isArray(item[key]) ? arrChange(item[key]) : item[key] + } + return res +}) diff --git a/client/src/utils/permission.js b/client/src/utils/permission.js new file mode 100644 index 0000000..217bdeb --- /dev/null +++ b/client/src/utils/permission.js @@ -0,0 +1,27 @@ +import store from '@/store' + +/** + * @param {Array} value + * @returns {Boolean} + * @example see @/views/permission/directive.vue + */ +export default function checkPermission(value) { + if (value && value instanceof Array && value.length > 0) { + const perms = store.getters && store.getters.perms + const permissionperms = value + if (perms.includes('admin')) { + return true + } // 如果是超管,都可以操作 + const hasPermission = perms.some(perm => { + return permissionperms.includes(perm) + }) + + if (!hasPermission) { + return false + } + return true + } else { + console.error(`need perms! Like v-permission="['admin','editor']"`) + return false + } +} diff --git a/client/src/utils/request.js b/client/src/utils/request.js new file mode 100644 index 0000000..da72b1a --- /dev/null +++ b/client/src/utils/request.js @@ -0,0 +1,88 @@ +import axios from 'axios' +import { MessageBox, Message } from 'element-ui' +import store from '@/store' +import { getToken } from '@/utils/auth' + +// create an axios instance +const service = axios.create({ + baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url + // withCredentials: true, // send cookies when cross-domain requests + timeout: 10000 // request timeout +}) + +// request interceptor +service.interceptors.request.use( + config => { + // do something before request is sent + if (store.getters.token) { + // let each request carry token + // ['X-Token'] is a custom headers key + // please modify it according to the actual situation + config.headers['Authorization'] = 'Bearer ' + getToken() + } + return config + }, + error => { + // do something with request error + // console.log(error) // for debug + return Promise.reject(error) + } +) + +// response interceptor +service.interceptors.response.use( + /** + * If you want to get http information such as headers or status + * Please return response => response + */ + + /** + * Determine the request status by custom code + * Here is just an example + * You can also judge the status by HTTP Status Code + */ + response => { + const res = response.data + if(res.code>=200 && res.code<400){ + return res + } + if (res.code === 401) { + if(res.msg.indexOf('No active account')!=-1){ + Message({ + message: '用户名或密码错误', + type: 'error', + duration: 3 * 1000 + }) + }else{ + MessageBox.confirm('认证失败,请重新登陆.', '确认退出', { + confirmButtonText: '重新登陆', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + store.dispatch('user/resetToken').then(() => { + location.reload() + }) + }) + } + + } else if (res.code >= 400) { + Message({ + message: res.msg || '请求出错', + type: 'error', + duration: 3 * 1000 + }) + return Promise.reject(new Error(res.msg || '请求出错')) + } + }, + error => { + // console.log(error,response) // for debug + Message({ + message: "服务器错误", + type: 'error', + duration: 5 * 1000 + }) + return Promise.reject(error) + } +) + +export default service diff --git a/client/src/utils/scroll-to.js b/client/src/utils/scroll-to.js new file mode 100644 index 0000000..c5d8e04 --- /dev/null +++ b/client/src/utils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/client/src/utils/validate.js b/client/src/utils/validate.js new file mode 100644 index 0000000..8d962ad --- /dev/null +++ b/client/src/utils/validate.js @@ -0,0 +1,20 @@ +/** + * Created by PanJiaChen on 16/11/18. + */ + +/** + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path) { + return /^(https?:|mailto:|tel:)/.test(path) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUsername(str) { + const valid_map = ['admin', 'editor'] + return valid_map.indexOf(str.trim()) >= 0 +} diff --git a/client/src/vendor/Export2Excel.js b/client/src/vendor/Export2Excel.js new file mode 100644 index 0000000..d8a2af3 --- /dev/null +++ b/client/src/vendor/Export2Excel.js @@ -0,0 +1,220 @@ +/* eslint-disable */ +import { saveAs } from 'file-saver' +import XLSX from 'xlsx' + +function generateArray(table) { + var out = []; + var rows = table.querySelectorAll('tr'); + var ranges = []; + for (var R = 0; R < rows.length; ++R) { + var outRow = []; + var row = rows[R]; + var columns = row.querySelectorAll('td'); + for (var C = 0; C < columns.length; ++C) { + var cell = columns[C]; + var colspan = cell.getAttribute('colspan'); + var rowspan = cell.getAttribute('rowspan'); + var cellValue = cell.innerText; + if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue; + + //Skip ranges + ranges.forEach(function (range) { + if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) { + for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null); + } + }); + + //Handle Row Span + if (rowspan || colspan) { + rowspan = rowspan || 1; + colspan = colspan || 1; + ranges.push({ + s: { + r: R, + c: outRow.length + }, + e: { + r: R + rowspan - 1, + c: outRow.length + colspan - 1 + } + }); + }; + + //Handle Value + outRow.push(cellValue !== "" ? cellValue : null); + + //Handle Colspan + if (colspan) + for (var k = 0; k < colspan - 1; ++k) outRow.push(null); + } + out.push(outRow); + } + return [out, ranges]; +}; + +function datenum(v, date1904) { + if (date1904) v += 1462; + var epoch = Date.parse(v); + return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); +} + +function sheet_from_array_of_arrays(data, opts) { + var ws = {}; + var range = { + s: { + c: 10000000, + r: 10000000 + }, + e: { + c: 0, + r: 0 + } + }; + for (var R = 0; R != data.length; ++R) { + for (var C = 0; C != data[R].length; ++C) { + if (range.s.r > R) range.s.r = R; + if (range.s.c > C) range.s.c = C; + if (range.e.r < R) range.e.r = R; + if (range.e.c < C) range.e.c = C; + var cell = { + v: data[R][C] + }; + if (cell.v == null) continue; + var cell_ref = XLSX.utils.encode_cell({ + c: C, + r: R + }); + + if (typeof cell.v === 'number') cell.t = 'n'; + else if (typeof cell.v === 'boolean') cell.t = 'b'; + else if (cell.v instanceof Date) { + cell.t = 'n'; + cell.z = XLSX.SSF._table[14]; + cell.v = datenum(cell.v); + } else cell.t = 's'; + + ws[cell_ref] = cell; + } + } + if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); + return ws; +} + +function Workbook() { + if (!(this instanceof Workbook)) return new Workbook(); + this.SheetNames = []; + this.Sheets = {}; +} + +function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; + return buf; +} + +export function export_table_to_excel(id) { + var theTable = document.getElementById(id); + var oo = generateArray(theTable); + var ranges = oo[1]; + + /* original data */ + var data = oo[0]; + var ws_name = "SheetJS"; + + var wb = new Workbook(), + ws = sheet_from_array_of_arrays(data); + + /* add ranges to worksheet */ + // ws['!cols'] = ['apple', 'banan']; + ws['!merges'] = ranges; + + /* add worksheet to workbook */ + wb.SheetNames.push(ws_name); + wb.Sheets[ws_name] = ws; + + var wbout = XLSX.write(wb, { + bookType: 'xlsx', + bookSST: false, + type: 'binary' + }); + + saveAs(new Blob([s2ab(wbout)], { + type: "application/octet-stream" + }), "test.xlsx") +} + +export function export_json_to_excel({ + multiHeader = [], + header, + data, + filename, + merges = [], + autoWidth = true, + bookType = 'xlsx' +} = {}) { + /* original data */ + filename = filename || 'excel-list' + data = [...data] + data.unshift(header); + + for (let i = multiHeader.length - 1; i > -1; i--) { + data.unshift(multiHeader[i]) + } + + var ws_name = "SheetJS"; + var wb = new Workbook(), + ws = sheet_from_array_of_arrays(data); + + if (merges.length > 0) { + if (!ws['!merges']) ws['!merges'] = []; + merges.forEach(item => { + ws['!merges'].push(XLSX.utils.decode_range(item)) + }) + } + + if (autoWidth) { + /*设置worksheet每列的最大宽度*/ + const colWidth = data.map(row => row.map(val => { + /*先判断是否为null/undefined*/ + if (val == null) { + return { + 'wch': 10 + }; + } + /*再判断是否为中文*/ + else if (val.toString().charCodeAt(0) > 255) { + return { + 'wch': val.toString().length * 2 + }; + } else { + return { + 'wch': val.toString().length + }; + } + })) + /*以第一行为初始值*/ + let result = colWidth[0]; + for (let i = 1; i < colWidth.length; i++) { + for (let j = 0; j < colWidth[i].length; j++) { + if (result[j]['wch'] < colWidth[i][j]['wch']) { + result[j]['wch'] = colWidth[i][j]['wch']; + } + } + } + ws['!cols'] = result; + } + + /* add worksheet to workbook */ + wb.SheetNames.push(ws_name); + wb.Sheets[ws_name] = ws; + + var wbout = XLSX.write(wb, { + bookType: bookType, + bookSST: false, + type: 'binary' + }); + saveAs(new Blob([s2ab(wbout)], { + type: "application/octet-stream" + }), `${filename}.${bookType}`); +} diff --git a/client/src/vendor/Export2Zip.js b/client/src/vendor/Export2Zip.js new file mode 100644 index 0000000..db70707 --- /dev/null +++ b/client/src/vendor/Export2Zip.js @@ -0,0 +1,24 @@ +/* eslint-disable */ +import { saveAs } from 'file-saver' +import JSZip from 'jszip' + +export function export_txt_to_zip(th, jsonData, txtName, zipName) { + const zip = new JSZip() + const txt_name = txtName || 'file' + const zip_name = zipName || 'file' + const data = jsonData + let txtData = `${th}\r\n` + data.forEach((row) => { + let tempStr = '' + tempStr = row.toString() + txtData += `${tempStr}\r\n` + }) + zip.file(`${txt_name}.txt`, txtData) + zip.generateAsync({ + type: "blob" + }).then((blob) => { + saveAs(blob, `${zip_name}.zip`) + }, (err) => { + alert('导出失败') + }) +} diff --git a/client/src/views/404.vue b/client/src/views/404.vue new file mode 100644 index 0000000..18eda34 --- /dev/null +++ b/client/src/views/404.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/client/src/views/dashboard/index.vue b/client/src/views/dashboard/index.vue new file mode 100644 index 0000000..bfd075e --- /dev/null +++ b/client/src/views/dashboard/index.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/client/src/views/form/index.vue b/client/src/views/form/index.vue new file mode 100644 index 0000000..f4d66d3 --- /dev/null +++ b/client/src/views/form/index.vue @@ -0,0 +1,85 @@ + + + + + + diff --git a/client/src/views/login/index.vue b/client/src/views/login/index.vue new file mode 100644 index 0000000..2568652 --- /dev/null +++ b/client/src/views/login/index.vue @@ -0,0 +1,237 @@ + + + + + + + diff --git a/client/src/views/nested/menu1/index.vue b/client/src/views/nested/menu1/index.vue new file mode 100644 index 0000000..30cb670 --- /dev/null +++ b/client/src/views/nested/menu1/index.vue @@ -0,0 +1,7 @@ + diff --git a/client/src/views/nested/menu1/menu1-1/index.vue b/client/src/views/nested/menu1/menu1-1/index.vue new file mode 100644 index 0000000..27e173a --- /dev/null +++ b/client/src/views/nested/menu1/menu1-1/index.vue @@ -0,0 +1,7 @@ + diff --git a/client/src/views/nested/menu1/menu1-2/index.vue b/client/src/views/nested/menu1/menu1-2/index.vue new file mode 100644 index 0000000..0c86276 --- /dev/null +++ b/client/src/views/nested/menu1/menu1-2/index.vue @@ -0,0 +1,7 @@ + diff --git a/client/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue b/client/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue new file mode 100644 index 0000000..f87d88f --- /dev/null +++ b/client/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue @@ -0,0 +1,5 @@ + diff --git a/client/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue b/client/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue new file mode 100644 index 0000000..d88789f --- /dev/null +++ b/client/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue @@ -0,0 +1,5 @@ + diff --git a/client/src/views/nested/menu1/menu1-3/index.vue b/client/src/views/nested/menu1/menu1-3/index.vue new file mode 100644 index 0000000..f7cd073 --- /dev/null +++ b/client/src/views/nested/menu1/menu1-3/index.vue @@ -0,0 +1,5 @@ + diff --git a/client/src/views/nested/menu2/index.vue b/client/src/views/nested/menu2/index.vue new file mode 100644 index 0000000..19dd48f --- /dev/null +++ b/client/src/views/nested/menu2/index.vue @@ -0,0 +1,5 @@ + diff --git a/client/src/views/system/changepassword.vue b/client/src/views/system/changepassword.vue new file mode 100644 index 0000000..165c218 --- /dev/null +++ b/client/src/views/system/changepassword.vue @@ -0,0 +1,78 @@ + + \ No newline at end of file diff --git a/client/src/views/system/dict.vue b/client/src/views/system/dict.vue new file mode 100644 index 0000000..273d8a0 --- /dev/null +++ b/client/src/views/system/dict.vue @@ -0,0 +1,370 @@ + + + diff --git a/client/src/views/system/file.vue b/client/src/views/system/file.vue new file mode 100644 index 0000000..b9c70a8 --- /dev/null +++ b/client/src/views/system/file.vue @@ -0,0 +1,134 @@ + + diff --git a/client/src/views/system/organization.vue b/client/src/views/system/organization.vue new file mode 100644 index 0000000..a71f2b6 --- /dev/null +++ b/client/src/views/system/organization.vue @@ -0,0 +1,225 @@ + + + diff --git a/client/src/views/system/perm.vue b/client/src/views/system/perm.vue new file mode 100644 index 0000000..ae8a7cf --- /dev/null +++ b/client/src/views/system/perm.vue @@ -0,0 +1,239 @@ + + + diff --git a/client/src/views/system/position.vue b/client/src/views/system/position.vue new file mode 100644 index 0000000..cffc146 --- /dev/null +++ b/client/src/views/system/position.vue @@ -0,0 +1,211 @@ + + + diff --git a/client/src/views/system/role.vue b/client/src/views/system/role.vue new file mode 100644 index 0000000..a19ebd0 --- /dev/null +++ b/client/src/views/system/role.vue @@ -0,0 +1,301 @@ + + + + + diff --git a/client/src/views/system/task.vue b/client/src/views/system/task.vue new file mode 100644 index 0000000..62797e9 --- /dev/null +++ b/client/src/views/system/task.vue @@ -0,0 +1,410 @@ + + diff --git a/client/src/views/system/user.vue b/client/src/views/system/user.vue new file mode 100644 index 0000000..6e33e4d --- /dev/null +++ b/client/src/views/system/user.vue @@ -0,0 +1,378 @@ + + + diff --git a/client/src/views/table/index.vue b/client/src/views/table/index.vue new file mode 100644 index 0000000..a1ed847 --- /dev/null +++ b/client/src/views/table/index.vue @@ -0,0 +1,79 @@ + + + diff --git a/client/src/views/tree/index.vue b/client/src/views/tree/index.vue new file mode 100644 index 0000000..89c6b01 --- /dev/null +++ b/client/src/views/tree/index.vue @@ -0,0 +1,78 @@ + + + + diff --git a/client/tests/unit/.eslintrc.js b/client/tests/unit/.eslintrc.js new file mode 100644 index 0000000..958d51b --- /dev/null +++ b/client/tests/unit/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + jest: true + } +} diff --git a/client/tests/unit/components/Breadcrumb.spec.js b/client/tests/unit/components/Breadcrumb.spec.js new file mode 100644 index 0000000..1d94c8f --- /dev/null +++ b/client/tests/unit/components/Breadcrumb.spec.js @@ -0,0 +1,98 @@ +import { mount, createLocalVue } from '@vue/test-utils' +import VueRouter from 'vue-router' +import ElementUI from 'element-ui' +import Breadcrumb from '@/components/Breadcrumb/index.vue' + +const localVue = createLocalVue() +localVue.use(VueRouter) +localVue.use(ElementUI) + +const routes = [ + { + path: '/', + name: 'home', + children: [{ + path: 'dashboard', + name: 'dashboard' + }] + }, + { + path: '/menu', + name: 'menu', + children: [{ + path: 'menu1', + name: 'menu1', + meta: { title: 'menu1' }, + children: [{ + path: 'menu1-1', + name: 'menu1-1', + meta: { title: 'menu1-1' } + }, + { + path: 'menu1-2', + name: 'menu1-2', + redirect: 'noredirect', + meta: { title: 'menu1-2' }, + children: [{ + path: 'menu1-2-1', + name: 'menu1-2-1', + meta: { title: 'menu1-2-1' } + }, + { + path: 'menu1-2-2', + name: 'menu1-2-2' + }] + }] + }] + }] + +const router = new VueRouter({ + routes +}) + +describe('Breadcrumb.vue', () => { + const wrapper = mount(Breadcrumb, { + localVue, + router + }) + it('dashboard', () => { + router.push('/dashboard') + const len = wrapper.findAll('.el-breadcrumb__inner').length + expect(len).toBe(1) + }) + it('normal route', () => { + router.push('/menu/menu1') + const len = wrapper.findAll('.el-breadcrumb__inner').length + expect(len).toBe(2) + }) + it('nested route', () => { + router.push('/menu/menu1/menu1-2/menu1-2-1') + const len = wrapper.findAll('.el-breadcrumb__inner').length + expect(len).toBe(4) + }) + it('no meta.title', () => { + router.push('/menu/menu1/menu1-2/menu1-2-2') + const len = wrapper.findAll('.el-breadcrumb__inner').length + expect(len).toBe(3) + }) + // it('click link', () => { + // router.push('/menu/menu1/menu1-2/menu1-2-2') + // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') + // const second = breadcrumbArray.at(1) + // console.log(breadcrumbArray) + // const href = second.find('a').attributes().href + // expect(href).toBe('#/menu/menu1') + // }) + // it('noRedirect', () => { + // router.push('/menu/menu1/menu1-2/menu1-2-1') + // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') + // const redirectBreadcrumb = breadcrumbArray.at(2) + // expect(redirectBreadcrumb.contains('a')).toBe(false) + // }) + it('last breadcrumb', () => { + router.push('/menu/menu1/menu1-2/menu1-2-1') + const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') + const redirectBreadcrumb = breadcrumbArray.at(3) + expect(redirectBreadcrumb.contains('a')).toBe(false) + }) +}) diff --git a/client/tests/unit/components/Hamburger.spec.js b/client/tests/unit/components/Hamburger.spec.js new file mode 100644 index 0000000..01ea303 --- /dev/null +++ b/client/tests/unit/components/Hamburger.spec.js @@ -0,0 +1,18 @@ +import { shallowMount } from '@vue/test-utils' +import Hamburger from '@/components/Hamburger/index.vue' +describe('Hamburger.vue', () => { + it('toggle click', () => { + const wrapper = shallowMount(Hamburger) + const mockFn = jest.fn() + wrapper.vm.$on('toggleClick', mockFn) + wrapper.find('.hamburger').trigger('click') + expect(mockFn).toBeCalled() + }) + it('prop isActive', () => { + const wrapper = shallowMount(Hamburger) + wrapper.setProps({ isActive: true }) + expect(wrapper.contains('.is-active')).toBe(true) + wrapper.setProps({ isActive: false }) + expect(wrapper.contains('.is-active')).toBe(false) + }) +}) diff --git a/client/tests/unit/components/SvgIcon.spec.js b/client/tests/unit/components/SvgIcon.spec.js new file mode 100644 index 0000000..31467a9 --- /dev/null +++ b/client/tests/unit/components/SvgIcon.spec.js @@ -0,0 +1,22 @@ +import { shallowMount } from '@vue/test-utils' +import SvgIcon from '@/components/SvgIcon/index.vue' +describe('SvgIcon.vue', () => { + it('iconClass', () => { + const wrapper = shallowMount(SvgIcon, { + propsData: { + iconClass: 'test' + } + }) + expect(wrapper.find('use').attributes().href).toBe('#icon-test') + }) + it('className', () => { + const wrapper = shallowMount(SvgIcon, { + propsData: { + iconClass: 'test' + } + }) + expect(wrapper.classes().length).toBe(1) + wrapper.setProps({ className: 'test' }) + expect(wrapper.classes().includes('test')).toBe(true) + }) +}) diff --git a/client/tests/unit/utils/formatTime.spec.js b/client/tests/unit/utils/formatTime.spec.js new file mode 100644 index 0000000..24e165b --- /dev/null +++ b/client/tests/unit/utils/formatTime.spec.js @@ -0,0 +1,30 @@ +import { formatTime } from '@/utils/index.js' + +describe('Utils:formatTime', () => { + const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" + const retrofit = 5 * 1000 + + it('ten digits timestamp', () => { + expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分') + }) + it('test now', () => { + expect(formatTime(+new Date() - 1)).toBe('刚刚') + }) + it('less two minute', () => { + expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前') + }) + it('less two hour', () => { + expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前') + }) + it('less one day', () => { + expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前') + }) + it('more than one day', () => { + expect(formatTime(d)).toBe('7月13日17时54分') + }) + it('format', () => { + expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') + expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') + expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') + }) +}) diff --git a/client/tests/unit/utils/parseTime.spec.js b/client/tests/unit/utils/parseTime.spec.js new file mode 100644 index 0000000..41d1b02 --- /dev/null +++ b/client/tests/unit/utils/parseTime.spec.js @@ -0,0 +1,28 @@ +import { parseTime } from '@/utils/index.js' + +describe('Utils:parseTime', () => { + const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" + it('timestamp', () => { + expect(parseTime(d)).toBe('2018-07-13 17:54:01') + }) + it('ten digits timestamp', () => { + expect(parseTime((d / 1000).toFixed(0))).toBe('2018-07-13 17:54:01') + }) + it('new Date', () => { + expect(parseTime(new Date(d))).toBe('2018-07-13 17:54:01') + }) + it('format', () => { + expect(parseTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') + expect(parseTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') + expect(parseTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') + }) + it('get the day of the week', () => { + expect(parseTime(d, '{a}')).toBe('五') // 星期五 + }) + it('get the day of the week', () => { + expect(parseTime(+d + 1000 * 60 * 60 * 24 * 2, '{a}')).toBe('日') // 星期日 + }) + it('empty argument', () => { + expect(parseTime()).toBeNull() + }) +}) diff --git a/client/tests/unit/utils/validate.spec.js b/client/tests/unit/utils/validate.spec.js new file mode 100644 index 0000000..f774905 --- /dev/null +++ b/client/tests/unit/utils/validate.spec.js @@ -0,0 +1,17 @@ +import { validUsername, isExternal } from '@/utils/validate.js' + +describe('Utils:validate', () => { + it('validUsername', () => { + expect(validUsername('admin')).toBe(true) + expect(validUsername('editor')).toBe(true) + expect(validUsername('xxxx')).toBe(false) + }) + it('isExternal', () => { + expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) + expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) + expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false) + expect(isExternal('/dashboard')).toBe(false) + expect(isExternal('./dashboard')).toBe(false) + expect(isExternal('dashboard')).toBe(false) + }) +}) diff --git a/client/vue.config.js b/client/vue.config.js new file mode 100644 index 0000000..a469d28 --- /dev/null +++ b/client/vue.config.js @@ -0,0 +1,128 @@ +'use strict' +const path = require('path') +const defaultSettings = require('./src/settings.js') + +function resolve(dir) { + return path.join(__dirname, dir) +} + +const name = defaultSettings.title || 'vue Admin Template' // page title + +// If your port is set to 80, +// use administrator privileges to execute the command line. +// For example, Mac: sudo npm run +// You can change the port by the following methods: +// port = 9528 npm run dev OR npm run dev --port = 9528 +const port = process.env.port || process.env.npm_config_port || 9528 // dev port + +// All configuration item explanations can be find in https://cli.vuejs.org/config/ +module.exports = { + /** + * You will need to set publicPath if you plan to deploy your site under a sub path, + * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/, + * then publicPath should be set to "/bar/". + * In most cases please use '/' !!! + * Detail: https://cli.vuejs.org/config/#publicpath + */ + publicPath: '/', + outputDir: 'dist', + assetsDir: 'static', + lintOnSave: false, //process.env.NODE_ENV === 'development', + productionSourceMap: false, + devServer: { + port: port, + open: true, + overlay: { + warnings: false, + errors: true + }, + before: require('./mock/mock-server.js') + }, + configureWebpack: { + // provide the app's title in webpack's name field, so that + // it can be accessed in index.html to inject the correct title. + name: name, + resolve: { + alias: { + '@': resolve('src') + } + } + }, + chainWebpack(config) { + config.plugins.delete('preload') // TODO: need test + config.plugins.delete('prefetch') // TODO: need test + + // set svg-sprite-loader + config.module + .rule('svg') + .exclude.add(resolve('src/icons')) + .end() + config.module + .rule('icons') + .test(/\.svg$/) + .include.add(resolve('src/icons')) + .end() + .use('svg-sprite-loader') + .loader('svg-sprite-loader') + .options({ + symbolId: 'icon-[name]' + }) + .end() + + // set preserveWhitespace + config.module + .rule('vue') + .use('vue-loader') + .loader('vue-loader') + .tap(options => { + options.compilerOptions.preserveWhitespace = true + return options + }) + .end() + + config + // https://webpack.js.org/configuration/devtool/#development + .when(process.env.NODE_ENV === 'development', + config => config.devtool('cheap-source-map') + ) + + config + .when(process.env.NODE_ENV !== 'development', + config => { + config + .plugin('ScriptExtHtmlWebpackPlugin') + .after('html') + .use('script-ext-html-webpack-plugin', [{ + // `runtime` must same as runtimeChunk name. default is `runtime` + inline: /runtime\..*\.js$/ + }]) + .end() + config + .optimization.splitChunks({ + chunks: 'all', + cacheGroups: { + libs: { + name: 'chunk-libs', + test: /[\\/]node_modules[\\/]/, + priority: 10, + chunks: 'initial' // only package third parties that are initially dependent + }, + elementUI: { + name: 'chunk-elementUI', // split elementUI into a single package + priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app + test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm + }, + commons: { + name: 'chunk-commons', + test: resolve('src/components'), // can customize your rules + minChunks: 3, // minimum common number + priority: 5, + reuseExistingChunk: true + } + } + }) + config.optimization.runtimeChunk('single') + } + ) + } +} diff --git a/client_mp/.gitignore b/client_mp/.gitignore new file mode 100644 index 0000000..35cab44 --- /dev/null +++ b/client_mp/.gitignore @@ -0,0 +1,4 @@ +unpackage/dist/* +node_modules/* +deploy.sh +package-lock.json \ No newline at end of file diff --git a/client_mp/App.vue b/client_mp/App.vue new file mode 100644 index 0000000..d8c41ed --- /dev/null +++ b/client_mp/App.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/client_mp/LICENSE b/client_mp/LICENSE new file mode 100644 index 0000000..8e39ead --- /dev/null +++ b/client_mp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/client_mp/README.md b/client_mp/README.md new file mode 100644 index 0000000..2a9f00e --- /dev/null +++ b/client_mp/README.md @@ -0,0 +1,133 @@ +

+ logo +

+

uView

+

多平台快速开发的UI框架

+ +[![star](https://gitee.com/xuqu/uView/badge/star.svg?theme=gvp)](https://gitee.com/xuqu/uView/stargazers) +[![fork](https://gitee.com/xuqu/uView/badge/fork.svg?theme=gvp)](https://gitee.com/xuqu/uView/members) +[![stars](https://img.shields.io/github/stars/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView) +[![forks](https://img.shields.io/github/forks/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView) +[![issues](https://img.shields.io/github/issues/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView/issues) +[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com) +[![release](https://img.shields.io/github/v/release/YanxinNet/uView?style=flat-square)](https://gitee.com/xuqu/uView/releases) +[![license](https://img.shields.io/github/license/YanxinNet/uView?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License) + +## 说明 + +uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 + +## [官方文档:https://www.uviewui.com](https://www.uviewui.com) + +### [点击加群交流反馈:1084514613](https://jq.qq.com/?_wv=1027&k=uyZUkSlo) + +## 特性 + +- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序 +- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用 +- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨 +- 众多的常用页面和布局,让您专注逻辑,事半功倍 +- 详尽的文档支持,现代化的演示效果 +- 按需引入,精简打包体积 + + +## 预览 + +您可以通过**微信**扫码,查看最佳的演示效果。 +
+
+ + + +## 友情链接 + +#### **vue-admin-beautiful** —— [企业级、通用型中后台前端解决方案(基于vue/cli 4 最新版,同时支持电脑,手机,平板)](https://github.com/chuzhixin/vue-admin-beautiful) + +#### **vue-admin-beautiful** —— [在线演示](http://beautiful.panm.cn/vue-admin-beautiful/#/index) + +#### **pl-table** —— [ 完美解决 element 万级表格数据渲染卡顿问题](https://github.com/livelyPeng/pl-table) + +#### **luch-request** —— [基于 Promise 开发的 uni-app 跨平台、项目级别的请求库,它有更小的体积,易用的 api,方便简单的自定义能力](https://www.quanzhan.co/luch-request/) +
+ +## 链接 + +- [官方文档](https://uviewui.com/) +- [更新日志](https://uviewui.com/components/changelog.html) +- [升级指南](https://uviewui.com/components/changelog.html) +- [关于我们](https://uviewui.com/cooperation/about.html) + +## 交流反馈 + +欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html) + +## 安装 + +#### **下载地址** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593) + +## 快速上手 + +1. `main.js`引入uView库 +```js +// main.js +import uView from 'uview-ui'; +Vue.use(uView); +``` + +2. `App.vue`引入基础样式(注意style标签需声明scss属性支持) +```css +/* App.vue */ + +``` + +3. `uni.scss`引入全局scss变量文件 +```css +/* uni.scss */ +@import "uview-ui/theme.scss"; +``` + +4. `pages.json`配置easycom规则(按需引入) + +```js +// pages.json +{ + "easycom": { + // 下载安装的方式需要前面的"@/",npm安装的方式无需"@/" + // 下载安装方式 + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + // npm安装方式 + // "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + }, + // 此为本身已有的内容 + "pages": [ + // ...... + ] +} +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + + +## 捐赠uView的研发 + +uView文档和源码全部开源免费,如果您认为uView帮到了您的开发工作,您可以捐赠uView的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。 + + + + +## 版权信息 +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 diff --git a/client_mp/common/classify.data.js b/client_mp/common/classify.data.js new file mode 100644 index 0000000..cb4f75a --- /dev/null +++ b/client_mp/common/classify.data.js @@ -0,0 +1,1087 @@ +export default[ + { + "name": "女装", + "foods": [ + { + "name": "A字裙", + "key": "A字裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/1.jpg", + "cat": 10 + }, + { + "name": "T恤", + "key": "T恤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/2.jpg", + "cat": 10 + }, + { + "name": "半身裙", + "key": "半身裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/3.jpg", + "cat": 10 + }, + { + "name": "衬衫", + "key": "衬衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/4.jpg", + "cat": 10 + }, + { + "name": "短裙", + "key": "短裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg", + "cat": 10 + }, + { + "name": "阔腿裤", + "key": "阔腿裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/6.jpg", + "cat": 10 + }, + { + "name": "连衣裙", + "key": "连衣裙", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/7.jpg", + "cat": 10 + }, + { + "name": "妈妈装", + "key": "妈妈装", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/8.jpg", + "cat": 10 + }, + { + "name": "牛仔裤", + "key": "牛仔裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/9.jpg", + "cat": 10 + }, + { + "name": "情侣装", + "key": "情侣装", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/10.jpg", + "cat": 10 + }, + { + "name": "休闲裤", + "key": "休闲裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/11.jpg", + "cat": 10 + }, + { + "name": "雪纺衫", + "key": "雪纺衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/12.jpg", + "cat": 10 + }, + { + "name": "防晒衣", + "key": "防晒衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/13.jpg", + "cat": 10 + }, + { + "name": "礼服/婚纱", + "key": "礼服婚纱", + "icon": "https://cdn.uviewui.com/uview/common/classify/1/14.jpg", + "cat": 10 + } + ] + }, + { + "name": "美食", + "foods": [ + { + "name": "火锅", + "key": "火锅", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/1.jpg", + "cat": 6 + }, + { + "name": "糕点饼干", + "key": "糕点饼干", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/2.jpg", + "cat": 6 + }, + { + "name": "坚果果干", + "key": "坚果果干", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/3.jpg", + "cat": 6 + }, + { + "name": "酒类", + "key": "酒类", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/4.jpg", + "cat": 6 + }, + { + "name": "辣条", + "key": "辣条", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/5.jpg", + "cat": 6 + }, + { + "name": "大礼包", + "key": "大礼包", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/6.jpg", + "cat": 6 + }, + { + "name": "精品茗茶", + "key": "茶", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/7.jpg", + "cat": 6 + }, + { + "name": "休闲食品", + "key": "休闲食品", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/8.jpg", + "cat": 6 + }, + { + "name": "糖果巧克力", + "key": "糖果巧克力", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/9.jpg", + "cat": 6 + }, + { + "name": "方便速食", + "key": "方便速食", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/10.jpg", + "cat": 6 + }, + { + "name": "营养代餐", + "key": "营养代餐", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/11.jpg", + "cat": 6 + }, + { + "name": "粮油副食", + "key": "粮油", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/12.jpg", + "cat": 6 + }, + { + "name": "生鲜水果", + "key": "水果", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/13.jpg", + "cat": 6 + }, + { + "name": "饮品", + "key": "饮品", + "icon": "https://cdn.uviewui.com/uview/common/classify/2/14.jpg", + "cat": 6 + } + ] + }, + { + "name": "美妆", + "foods": [ + { + "name": "化妆刷", + "key": "化妆刷", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/1.jpg", + "cat": 3 + }, + { + "name": "粉底", + "key": "粉底", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/2.jpg", + "cat": 3 + }, + { + "name": "洗发护发", + "key": "洗发护发", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/3.jpg", + "cat": 3 + }, + { + "name": "美容工具", + "key": "美容工具", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/4.jpg", + "cat": 3 + }, + { + "name": "眼部护理", + "key": "眼部护理", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/5.jpg", + "cat": 3 + }, + { + "name": "眉妆", + "key": "眉妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/6.jpg", + "cat": 3 + }, + { + "name": "卸妆品", + "key": "卸妆品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/7.jpg", + "cat": 3 + }, + { + "name": "基础护肤", + "key": "基础护肤", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/8.jpg", + "cat": 3 + }, + { + "name": "眼妆", + "key": "眼妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/9.jpg", + "cat": 3 + }, + { + "name": "唇妆", + "key": "唇妆", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/10.jpg", + "cat": 3 + }, + { + "name": "面膜", + "key": "面膜", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/11.jpg", + "cat": 3 + }, + { + "name": "沐浴用品", + "key": "沐浴用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/12.jpg", + "cat": 3 + }, + { + "name": "护肤套装", + "key": "护肤套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/13.jpg", + "cat": 3 + }, + { + "name": "防晒品", + "key": "防晒品", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/14.jpg", + "cat": 3 + }, + { + "name": "美甲", + "key": "美甲", + "icon": "https://cdn.uviewui.com/uview/common/classify/3/15.jpg", + "cat": 3 + } + + ] + }, + { + "name": "居家日用", + "foods": [ + { + "name": "垃圾袋", + "key": "垃圾袋", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/1.jpg", + "cat": 4 + }, + { + "name": "纸巾", + "key": "纸巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/2.jpg", + "cat": 4 + }, + { + "name": "驱蚊用品", + "key": "驱蚊用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/3.jpg", + "cat": 4 + }, + { + "name": "收纳神器", + "key": "收纳神器", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/4.jpg", + "cat": 4 + }, + { + "name": "厨房用品", + "key": "厨房用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/5.jpg", + "cat": 4 + }, + { + "name": "厨房烹饪", + "key": "烹饪", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/6.jpg", + "cat": 4 + }, + { + "name": "衣物晾晒", + "key": "衣物晾晒", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/7.jpg", + "cat": 4 + }, + { + "name": "衣物护理", + "key": "衣物护理", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/8.jpg", + "cat": 4 + }, + { + "name": "宠物用品", + "key": "宠物用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/9.jpg", + "cat": 4 + }, + { + "name": "医药保健", + "key": "医药", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/10.jpg", + "cat": 4 + }, + { + "name": "日用百货", + "key": "百货", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/11.jpg", + "cat": 4 + }, + { + "name": "清洁用品", + "key": "清洁", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/12.jpg", + "cat": 4 + }, + { + "name": "绿植园艺", + "key": "绿植", + "icon": "https://cdn.uviewui.com/uview/common/classify/4/13.jpg", + "cat": 4 + } + ] + }, + { + "name": "男装", + "foods": [ + { + "name": "爸爸装", + "key": "爸爸装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/1.jpg", + "cat": 12 + }, + { + "name": "牛仔裤", + "key": "牛仔裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/2.jpg", + "cat": 12 + }, + { + "name": "衬衫", + "key": "衬衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/3.jpg", + "cat": 12 + }, + { + "name": "休闲裤", + "key": "休闲裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/4.jpg", + "cat": 12 + }, + { + "name": "外套", + "key": "外套", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/5.jpg", + "cat": 12 + }, + { + "name": "T恤", + "key": "T恤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/6.jpg", + "cat": 12 + }, + { + "name": "套装", + "key": "套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/7.jpg", + "cat": 12 + }, + { + "name": "运动裤", + "key": "运动裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/8.jpg", + "cat": 12 + }, + { + "name": "马甲/背心", + "key": "马甲背心", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/9.jpg", + "cat": 12 + }, + { + "name": "POLO衫", + "key": "POLO衫", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/10.jpg", + "cat": 12 + }, + { + "name": "商务装", + "key": "商务装", + "icon": "https://cdn.uviewui.com/uview/common/classify/5/11.jpg", + "cat": 12 + } + ] + }, + { + "name": "鞋品", + "foods": [ + { + "name": "单鞋", + "key": "单鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/1.jpg", + "cat": 5 + }, + { + "name": "皮鞋", + "key": "皮鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/2.jpg", + "cat": 5 + }, + { + "name": "帆布鞋", + "key": "帆布鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/3.jpg", + "cat": 5 + }, + { + "name": "北京老布鞋", + "key": "北京老布鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/4.jpg", + "cat": 5 + }, + { + "name": "运动鞋", + "key": "运动鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/5.jpg", + "cat": 5 + }, + { + "name": "拖鞋", + "key": "拖鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/6.jpg", + "cat": 5 + }, + { + "name": "凉鞋", + "key": "凉鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/7.jpg", + "cat": 5 + }, + { + "name": "休闲鞋", + "key": "休闲鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/8.jpg", + "cat": 5 + }, + { + "name": "高跟鞋", + "key": "高跟鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/9.jpg", + "cat": 5 + }, + { + "name": "老人鞋", + "key": "老人鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/10.jpg", + "cat": 5 + }, + { + "name": "懒人鞋", + "key": "懒人鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/6/11.jpg", + "cat": 5 + } + ] + }, + { + "name": "数码家电", + "foods": [ + { + "name": "数据线", + "key": "数据线", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/1.jpg", + "cat": 8 + }, + { + "name": "耳机", + "key": "耳机", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/2.jpg", + "cat": 8 + }, + { + "name": "生活家电", + "key": "家电", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/3.jpg", + "cat": 8 + }, + { + "name": "电风扇", + "key": "电风扇", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/4.jpg", + "cat": 8 + }, + { + "name": "电吹风", + "key": "电吹风", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/5.jpg", + "cat": 8 + }, + { + "name": "手机壳", + "key": "手机壳", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/6.jpg", + "cat": 8 + }, + { + "name": "榨汁机", + "key": "榨汁机", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/7.jpg", + "cat": 8 + }, + { + "name": "小家电", + "key": "小家电", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/8.jpg", + "cat": 8 + }, + { + "name": "数码电子", + "key": "数码", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/9.jpg", + "cat": 8 + }, + { + "name": "电饭锅", + "key": "电饭锅", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/10.jpg", + "cat": 8 + }, + { + "name": "手机支架", + "key": "手机支架", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/11.jpg", + "cat": 8 + }, + { + "name": "剃须刀", + "key": "剃须刀", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/12.jpg", + "cat": 8 + }, + { + "name": "充电宝", + "key": "充电宝", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/13.jpg", + "cat": 8 + }, + { + "name": "手机配件", + "key": "手机配件", + "icon": "https://cdn.uviewui.com/uview/common/classify/7/14.jpg", + "cat": 8 + } + ] + }, + { + "name": "母婴", + "foods": [ + { + "name": "婴童服饰", + "key": "衣服", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/1.jpg", + "cat": 2 + }, + { + "name": "玩具乐器", + "key": "玩具乐器", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/2.jpg", + "cat": 2 + }, + { + "name": "尿不湿", + "key": "尿不湿", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/3.jpg", + "cat": 2 + }, + { + "name": "安抚牙胶", + "key": "安抚牙胶", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/4.jpg", + "cat": 2 + }, + { + "name": "奶瓶奶嘴", + "key": "奶瓶奶嘴", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/5.jpg", + "cat": 2 + }, + { + "name": "孕妈用品", + "key": "孕妈用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/6.jpg", + "cat": 2 + }, + { + "name": "宝宝用品", + "key": "宝宝用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/7.jpg", + "cat": 2 + }, + { + "name": "婴童湿巾", + "key": "湿巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/8.jpg", + "cat": 2 + }, + { + "name": "喂养洗护", + "key": "洗护", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/9.jpg", + "cat": 2 + }, + { + "name": "婴童鞋靴", + "key": "童鞋", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/10.jpg", + "cat": 2 + }, + { + "name": "口水巾", + "key": "口水巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/11.jpg", + "cat": 2 + }, + { + "name": "营养辅食", + "key": "营养", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/12.jpg", + "cat": 2 + }, + { + "name": "婴幼书籍", + "key": "书籍", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/13.jpg", + "cat": 2 + }, + { + "name": "婴儿车", + "key": "婴儿车", + "icon": "https://cdn.uviewui.com/uview/common/classify/8/14.jpg", + "cat": 2 + } + ] + }, + { + "name": "箱包", + "foods": [ + { + "name": "单肩包", + "key": "单肩包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/1.jpg", + "cat": 0 + }, + { + "name": "斜挎包", + "key": "斜挎包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/2.jpg", + "cat": 0 + }, + { + "name": "女包", + "key": "女包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/3.jpg", + "cat": 0 + }, + { + "name": "男包", + "key": "男包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/4.jpg", + "cat": 0 + }, + { + "name": "双肩包", + "key": "双肩包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/5.jpg", + "cat": 0 + }, + { + "name": "小方包", + "key": "小方包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/6.jpg", + "cat": 0 + }, + { + "name": "钱包", + "key": "钱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/7.jpg", + "cat": 0 + }, + { + "name": "旅行箱包", + "key": "旅行箱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/8.jpg", + "cat": 0 + }, + { + "name": "零钱包", + "key": "零钱包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/9.jpg", + "cat": 0 + }, + { + "name": "手提包", + "key": "手提包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/10.jpg", + "cat": 0 + }, + { + "name": "胸包", + "key": "胸包", + "icon": "https://cdn.uviewui.com/uview/common/classify/9/11.jpg", + "cat": 0 + } + ] + }, + { + "name": "内衣", + "foods": [ + { + "name": "袜子", + "key": "袜子", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/1.jpg", + "cat": 11 + }, + { + "name": "吊带背心", + "key": "吊带背心", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/2.jpg", + "cat": 11 + }, + { + "name": "抹胸", + "key": "抹胸", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/3.jpg", + "cat": 11 + }, + { + "name": "内裤", + "key": "内裤", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/4.jpg", + "cat": 11 + }, + { + "name": "文胸", + "key": "文胸", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/5.jpg", + "cat": 11 + }, + { + "name": "文胸套装", + "key": "文胸套装", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/6.jpg", + "cat": 11 + }, + { + "name": "打底塑身", + "key": "打底塑身", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/7.jpg", + "cat": 11 + }, + { + "name": "家居服", + "key": "家居服", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/8.jpg", + "cat": 11 + }, + { + "name": "船袜", + "key": "船袜", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/9.jpg", + "cat": 11 + }, + { + "name": "情侣睡衣", + "key": "情侣睡衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/10.jpg", + "cat": 11 + }, + { + "name": "丝袜", + "key": "丝袜", + "icon": "https://cdn.uviewui.com/uview/common/classify/10/11.jpg", + "cat": 11 + } + ] + }, + { + "name": "文娱车品", + "foods": [ + { + "name": "车市车品", + "key": "车市车品", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/1.jpg", + "cat": 7 + }, + { + "name": "办公文具", + "key": "办公文具", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/2.jpg", + "cat": 7 + }, + { + "name": "考试必备", + "key": "考试必备", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/3.jpg", + "cat": 7 + }, + { + "name": "笔记本", + "key": "笔记本", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/4.jpg", + "cat": 7 + }, + { + "name": "艺术礼品", + "key": "礼品", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/5.jpg", + "cat": 7 + }, + { + "name": "书写工具", + "key": "书写工具", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/6.jpg", + "cat": 7 + }, + { + "name": "车载电器", + "key": "车载电器", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/7.jpg", + "cat": 7 + }, + { + "name": "图书音像", + "key": "图书音像", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/8.jpg", + "cat": 7 + }, + { + "name": "画具画材", + "key": "画具画材", + "icon": "https://cdn.uviewui.com/uview/common/classify/11/9.jpg", + "cat": 7 + } + ] + }, + { + "name": "配饰", + "foods": [ + { + "name": "太阳镜", + "key": "太阳镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/1.jpg", + "cat": 0 + }, + { + "name": "皮带", + "key": "皮带", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/2.jpg", + "cat": 0 + }, + { + "name": "棒球帽", + "key": "棒球帽", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/3.jpg", + "cat": 0 + }, + { + "name": "手表", + "key": "手表", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/4.jpg", + "cat": 0 + }, + { + "name": "发饰", + "key": "发饰", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/5.jpg", + "cat": 0 + }, + { + "name": "项链", + "key": "项链", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/6.jpg", + "cat": 0 + }, + { + "name": "手饰", + "key": "手饰", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/7.jpg", + "cat": 0 + }, + { + "name": "耳环", + "key": "耳环", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/8.jpg", + "cat": 0 + }, + { + "name": "帽子丝巾", + "key": "帽子丝巾", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/9.jpg", + "cat": 0 + }, + { + "name": "眼镜墨镜", + "key": "眼镜墨镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/10.jpg", + "cat": 0 + }, + { + "name": "发带发箍", + "key": "发带发箍", + "icon": "https://cdn.uviewui.com/uview/common/classify/12/11.jpg", + "cat": 0 + } + ] + }, + { + "name": "家装家纺", + "foods": [ + { + "name": "家居饰品", + "key": "家居饰品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/1.jpg", + "cat": 0 + }, + { + "name": "凉席", + "key": "凉席", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/2.jpg", + "cat": 0 + }, + { + "name": "背枕靠枕", + "key": "靠枕", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/3.jpg", + "cat": 0 + }, + { + "name": "床上用品", + "key": "床上用品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/4.jpg", + "cat": 0 + }, + { + "name": "摆件", + "key": "摆件", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/5.jpg", + "cat": 0 + }, + { + "name": "四件套", + "key": "四件套", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/6.jpg", + "cat": 0 + }, + { + "name": "装饰品", + "key": "装饰品", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/7.jpg", + "cat": 0 + }, + { + "name": "卫浴用品", + "key": "卫浴", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/8.jpg", + "cat": 0 + }, + { + "name": "家居家装", + "key": "家具", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/9.jpg", + "cat": 0 + }, + { + "name": "蚊帐", + "key": "蚊帐", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/10.jpg", + "cat": 0 + }, + { + "name": "墙纸贴纸", + "key": "墙纸", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/11.jpg", + "cat": 0 + }, + { + "name": "空调被", + "key": "空调被", + "icon": "https://cdn.uviewui.com/uview/common/classify/13/12.jpg", + "cat": 0 + } + ] + }, + { + "name": "户外运动", + "foods": [ + { + "name": "游泳装备", + "key": "游泳", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/1.jpg", + "cat": 0 + }, + { + "name": "泳镜", + "key": "泳镜", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/2.jpg", + "cat": 0 + }, + { + "name": "户外装备", + "key": "户外", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/3.jpg", + "cat": 0 + }, + { + "name": "健身服饰", + "key": "健身", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/4.jpg", + "cat": 0 + }, + { + "name": "泳衣", + "key": "泳衣", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/5.jpg", + "cat": 0 + }, + { + "name": "瑜伽垫", + "key": "瑜伽垫", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/6.jpg", + "cat": 0 + }, + { + "name": "瑜伽用品", + "key": "瑜伽", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/7.jpg", + "cat": 0 + }, + { + "name": "健身装备", + "key": "健身", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/8.jpg", + "cat": 0 + }, + { + "name": "球迷用品", + "key": "球迷", + "icon": "https://cdn.uviewui.com/uview/common/classify/14/9.jpg", + "cat": 0 + } + ] + } +] \ No newline at end of file diff --git a/client_mp/common/demo.scss b/client_mp/common/demo.scss new file mode 100644 index 0000000..547d5d9 --- /dev/null +++ b/client_mp/common/demo.scss @@ -0,0 +1,86 @@ +/* #ifndef APP-NVUE */ +view, +text { + box-sizing: border-box; +} +/* #endif */ + +/* start--演示页面使用的统一样式--start */ +.u-demo { + padding: 25px 20px; +} + +.u-demo-wrap { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + background-color: rgb(250, 250, 250); + padding: 20px 10px; + border-radius: 3px; +} + +.u-demo-area { + text-align: center; +} + +.u-no-demo-here { + color: $u-tips-color; + font-size: 13px; +} + +.u-demo-result-line { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + padding: 5px 20px; + margin-top: 30px; + border-radius: 5px; + background-color: rgb(240, 240, 240); + color: $u-content-color; + font-size: 16px; + /* #ifndef APP-NVUE */ + word-break: break-word; + display: inline-block; + /* #endif */ + text-align: left; + +} + +.u-demo-title, +.u-config-title { + text-align: center; + font-size: 16px; + font-weight: bold; + margin-bottom: 20px; +} + +.u-config-item { + margin-top: 25px; +} + +.u-config-title { + margin-top: 20px; + padding-bottom: 5px; +} + +.u-item-title { + position: relative; + font-size: 15px; + padding-left: 8px; + line-height: 1; + margin-bottom: 11px; +} + +.u-item-title:after { + position: absolute; + width: 4px; + top: -1px; + height: 16px; + /* #ifndef APP-NVUE */ + content: ''; + /* #endif */ + left: 0; + border-radius: 10px; + background-color: $u-content-color; +} +/* end--演示页面使用的统一样式--end */ diff --git a/client_mp/common/http.api.js b/client_mp/common/http.api.js new file mode 100644 index 0000000..e23e7a9 --- /dev/null +++ b/client_mp/common/http.api.js @@ -0,0 +1,22 @@ +// 如果没有通过拦截器配置域名的话,可以在这里写上完整的URL(加上域名部分) +let hotSearchUrl = '/ebapi/store_api/hot_search'; +let indexUrl = '/ebapi/public_api/index'; + +// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分: +// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F +const install = (Vue, vm) => { + // 此处没有使用传入的params参数 + let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, { + id: 2 + }); + // 此处使用了传入的params参数,一切自定义即可 + let getInfo = (params = {}) => vm.$u.post(indexUrl, params); + + let gettest = (params = {}) => vm.$u.get('/system/test/', params); + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 + vm.$u.api = {getSearch, getInfo, gettest}; +} + +export default { + install +} \ No newline at end of file diff --git a/client_mp/common/http.interceptor.js b/client_mp/common/http.interceptor.js new file mode 100644 index 0000000..6a13702 --- /dev/null +++ b/client_mp/common/http.interceptor.js @@ -0,0 +1,65 @@ +// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token +// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的 +const install = (Vue, vm) => { + Vue.prototype.$u.http.setConfig({ + // baseUrl: 'https://api.youzixy.com', + baseUrl: 'http://127.0.0.1:8000', + // 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data + // 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值 + // originalData: true, + // 设置自定义头部content-type + // header: { + // 'content-type': 'xxx' + // } + showLoading: true, + loadingText: '请求中..', + originalData: true, + loadingTime: 800, + loadingMask: true + }); + // 请求拦截,配置Token等参数 + Vue.prototype.$u.http.interceptor.request = (config) => { + config.header.Authorization = 'Bearer ' + vm.token; + + // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html + // config.header.token = vm.token; + + // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 + // config.header.token = vm.$store.state.token; + + // 方式三,如果token放在了globalData,通过getApp().globalData获取 + // config.header.token = getApp().globalData.username; + + // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 + // const token = uni.getStorageSync('token'); + // config.header.token = token; + + return config; + } + // 响应拦截,判断状态码是否通过 + Vue.prototype.$u.http.interceptor.response = (response) => { + // 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据 + // 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果 + const res = response.data + if( res.code >= 200 && res.code < 300 ) { + // 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么 + return res; + } + else if(res.code === 401){ + vm.$u.toast('验证失败,请重新登录'); + setTimeout(() => { + // 此为uView的方法,详见路由相关文档 + vm.$u.route('/pages/login/login') + }, 1500) + return false; + } + else{ + vm.$u.toast(res.msg); + return false; + } + } +} + +export default { + install +} \ No newline at end of file diff --git a/client_mp/common/index.list.js b/client_mp/common/index.list.js new file mode 100644 index 0000000..7e0f5ed --- /dev/null +++ b/client_mp/common/index.list.js @@ -0,0 +1,585 @@ +module.exports = { + list: [{ + "letter": "A", + "data": [{ + "name": "阿拉斯加", + "mobile": "13588889999", + "keyword": "阿拉斯加ABA13588889999" + }, + { + "name": "阿克苏", + "mobile": "0551-4386721", + "keyword": "阿克苏AKESU0551-4386721" + }, + { + "name": "阿拉善", + "mobile": "4008009100", + "keyword": "阿拉善ALASHAN4008009100" + }, + { + "name": "阿勒泰", + "mobile": "13588889999", + "keyword": "阿勒泰ALETAI13588889999" + }, + { + "name": "阿里", + "mobile": "13588889999", + "keyword": "阿里ALI13588889999" + }, + { + "name": "安阳", + "mobile": "13588889999", + "keyword": "13588889999安阳ANYANG" + } + ] + }, + { + "letter": "B", + "data": [{ + "name": "白城", + "mobile": "该主子没有留电话~", + "keyword": "白城BAICHENG" + }, + { + "name": "白山", + "mobile": "13588889999", + "keyword": "白山BAISHAN13588889999" + }, + { + "name": "白银", + "mobile": "13588889999", + "keyword": "白银BAIYIN13588889999" + }, + { + "name": "保定", + "mobile": "13588889999", + "keyword": "保定BAODING13588889999" + } + ] + }, + { + "letter": "C", + "data": [{ + "name": "沧州", + "mobile": "13588889999", + "keyword": "沧州CANGZHOU13588889999" + }, + { + "name": "长春", + "mobile": "13588889999", + "keyword": "长春CHANGCHUN13588889999" + } + ] + }, + { + "letter": "D", + "data": [{ + "name": "大理", + "mobile": "13588889999", + "keyword": "大理DALI13588889999" + }, + { + "name": "大连", + "mobile": "13588889999", + "keyword": "大连DALIAN13588889999" + } + ] + }, + { + "letter": "E", + "data": [{ + "name": "鄂尔多斯", + "mobile": "13588889999", + "keyword": "鄂尔多斯EERDUOSI13588889999" + }, + { + "name": "恩施", + "mobile": "13588889999", + "keyword": "恩施ENSHI13588889999" + }, + { + "name": "鄂州", + "mobile": "13588889999", + "keyword": "鄂州EZHOU13588889999" + } + ] + }, + { + "letter": "F", + "data": [{ + "name": "防城港", + "mobile": "该主子没有留电话~", + "keyword": "防城港FANGCHENGGANG" + }, + { + "name": "抚顺", + "mobile": "13588889999", + "keyword": "抚顺FUSHUN13588889999" + }, + { + "name": "阜新", + "mobile": "13588889999", + "keyword": "阜新FUXIN13588889999" + }, + { + "name": "阜阳", + "mobile": "13588889999", + "keyword": "阜阳FUYANG13588889999" + }, + { + "name": "抚州", + "mobile": "13588889999", + "keyword": "抚州FUZHOU13588889999" + }, + { + "name": "福州", + "mobile": "13588889999", + "keyword": "福州FUZHOU13588889999" + } + ] + }, + { + "letter": "G", + "data": [{ + "name": "甘南", + "mobile": "13588889999", + "keyword": "甘南GANNAN13588889999" + }, + { + "name": "赣州", + "mobile": "13588889999", + "keyword": "赣州GANZHOU13588889999" + }, + { + "name": "甘孜", + "mobile": "13588889999", + "keyword": "甘孜GANZI13588889999" + } + ] + }, + { + "letter": "H", + "data": [{ + "name": "哈尔滨", + "mobile": "13588889999", + "keyword": "哈尔滨HAERBIN13588889999" + }, + { + "name": "海北", + "mobile": "13588889999", + "keyword": "海北HAIBEI13588889999" + }, + { + "name": "海东", + "mobile": "13588889999", + "keyword": "海东HAIDONG13588889999" + }, + { + "name": "海口", + "mobile": "13588889999", + "keyword": "海口HAIKOU13588889999" + } + ] + }, + { + "letter": "I", + "data": [{ + "name": "ice", + "mobile": "13588889999", + "keyword": "佳木斯JIAMUSI13588889999" + }] + }, + { + "letter": "J", + "data": [{ + "name": "佳木斯", + "mobile": "13588889999", + "keyword": "佳木斯JIAMUSI13588889999" + }, + { + "name": "吉安", + "mobile": "13588889999", + "keyword": "吉安JIAN13588889999" + }, + { + "name": "江门", + "mobile": "13588889999", + "keyword": "江门JIANGMEN13588889999" + } + ] + }, + { + "letter": "K", + "data": [{ + "name": "开封", + "mobile": "13588889999", + "keyword": "开封KAIFENG13588889999" + }, + { + "name": "喀什", + "mobile": "13588889999", + "keyword": "喀什KASHI13588889999" + }, + { + "name": "克拉玛依", + "mobile": "13588889999", + "keyword": "克拉玛依KELAMAYI13588889999" + } + ] + }, + { + "letter": "L", + "data": [{ + "name": "来宾", + "mobile": "13588889999", + "keyword": "来宾LAIBIN13588889999" + }, + { + "name": "兰州", + "mobile": "13588889999", + "keyword": "兰州LANZHOU13588889999" + }, + { + "name": "拉萨", + "mobile": "13588889999", + "keyword": "拉萨LASA13588889999" + }, + { + "name": "乐山", + "mobile": "13588889999", + "keyword": "乐山LESHAN13588889999" + }, + { + "name": "凉山", + "mobile": "13588889999", + "keyword": "凉山LIANGSHAN13588889999" + }, + { + "name": "连云港", + "mobile": "13588889999", + "keyword": "连云港LIANYUNGANG13588889999" + }, + { + "name": "聊城", + "mobile": "18322223333", + "keyword": "聊城LIAOCHENG18322223333" + }, + { + "name": "辽阳", + "mobile": "18322223333", + "keyword": "辽阳LIAOYANG18322223333" + }, + { + "name": "辽源", + "mobile": "18322223333", + "keyword": "辽源LIAOYUAN18322223333" + }, + { + "name": "丽江", + "mobile": "18322223333", + "keyword": "丽江LIJIANG18322223333" + }, + { + "name": "临沧", + "mobile": "18322223333", + "keyword": "临沧LINCANG18322223333" + }, + { + "name": "临汾", + "mobile": "18322223333", + "keyword": "临汾LINFEN18322223333" + }, + { + "name": "临夏", + "mobile": "18322223333", + "keyword": "临夏LINXIA18322223333" + }, + { + "name": "临沂", + "mobile": "18322223333", + "keyword": "临沂LINYI18322223333" + }, + { + "name": "林芝", + "mobile": "18322223333", + "keyword": "林芝LINZHI18322223333" + }, + { + "name": "丽水", + "mobile": "18322223333", + "keyword": "丽水LISHUI18322223333" + } + ] + }, + { + "letter": "M", + "data": [{ + "name": "眉山", + "mobile": "15544448888", + "keyword": "眉山MEISHAN15544448888" + }, + { + "name": "梅州", + "mobile": "15544448888", + "keyword": "梅州MEIZHOU15544448888" + }, + { + "name": "绵阳", + "mobile": "15544448888", + "keyword": "绵阳MIANYANG15544448888" + }, + { + "name": "牡丹江", + "mobile": "15544448888", + "keyword": "牡丹江MUDANJIANG15544448888" + } + ] + }, + { + "letter": "N", + "data": [{ + "name": "南昌", + "mobile": "15544448888", + "keyword": "南昌NANCHANG15544448888" + }, + { + "name": "南充", + "mobile": "15544448888", + "keyword": "南充NANCHONG15544448888" + }, + { + "name": "南京", + "mobile": "15544448888", + "keyword": "南京NANJING15544448888" + }, + { + "name": "南宁", + "mobile": "15544448888", + "keyword": "南宁NANNING15544448888" + }, + { + "name": "南平", + "mobile": "15544448888", + "keyword": "南平NANPING15544448888" + } + ] + }, + { + "letter": "O", + "data": [{ + "name": "欧阳", + "mobile": "15544448888", + "keyword": "欧阳ouyang15544448888" + }] + }, + { + "letter": "P", + "data": [{ + "name": "盘锦", + "mobile": "15544448888", + "keyword": "盘锦PANJIN15544448888" + }, + { + "name": "攀枝花", + "mobile": "15544448888", + "keyword": "攀枝花PANZHIHUA15544448888" + }, + { + "name": "平顶山", + "mobile": "15544448888", + "keyword": "平顶山PINGDINGSHAN15544448888" + }, + { + "name": "平凉", + "mobile": "15544448888", + "keyword": "平凉PINGLIANG15544448888" + }, + { + "name": "萍乡", + "mobile": "15544448888", + "keyword": "萍乡PINGXIANG15544448888" + }, + { + "name": "普洱", + "mobile": "15544448888", + "keyword": "普洱PUER15544448888" + }, + { + "name": "莆田", + "mobile": "15544448888", + "keyword": "莆田PUTIAN15544448888" + }, + { + "name": "濮阳", + "mobile": "15544448888", + "keyword": "濮阳PUYANG15544448888" + } + ] + }, + { + "letter": "Q", + "data": [{ + "name": "黔东南", + "mobile": "15544448888", + "keyword": "黔东南QIANDONGNAN15544448888" + }, + { + "name": "黔南", + "mobile": "15544448888", + "keyword": "黔南QIANNAN15544448888" + }, + { + "name": "黔西南", + "mobile": "15544448888", + "keyword": "黔西南QIANXINAN15544448888" + } + ] + }, + { + "letter": "R", + "data": [{ + "name": "日喀则", + "mobile": "15544448888", + "keyword": "日喀则RIKAZE15544448888" + }, + { + "name": "日照", + "mobile": "15544448888", + "keyword": "日照RIZHAO15544448888" + } + ] + }, + { + "letter": "S", + "data": [{ + "name": "三门峡", + "mobile": "15544448888", + "keyword": "三门峡SANMENXIA15544448888" + }, + { + "name": "三明", + "mobile": "15544448888", + "keyword": "三明SANMING15544448888" + }, + { + "name": "三沙", + "mobile": "15544448888", + "keyword": "三沙SANSHA15544448888" + } + ] + }, + { + "letter": "T", + "data": [{ + "name": "塔城", + "mobile": "15544448888", + "keyword": "塔城TACHENG15544448888" + }, + { + "name": "漯河", + "mobile": "15544448888", + "keyword": "漯河TAHE15544448888" + }, + { + "name": "泰安", + "mobile": "15544448888", + "keyword": "泰安TAIAN15544448888" + } + ] + }, + { + "letter": "W", + "data": [{ + "name": "潍坊", + "mobile": "15544448888", + "keyword": "潍坊WEIFANG15544448888" + }, + { + "name": "威海", + "mobile": "15544448888", + "keyword": "威海WEIHAI15544448888" + }, + { + "name": "渭南", + "mobile": "15544448888", + "keyword": "渭南WEINAN15544448888" + }, + { + "name": "文山", + "mobile": "15544448888", + "keyword": "文山WENSHAN15544448888" + } + ] + }, + { + "letter": "X", + "data": [{ + "name": "厦门", + "mobile": "15544448888", + "keyword": "厦门XIAMEN15544448888" + }, + { + "name": "西安", + "mobile": "15544448888", + "keyword": "西安XIAN15544448888" + }, + { + "name": "湘潭", + "mobile": "15544448888", + "keyword": "湘潭XIANGTAN15544448888" + } + ] + }, + { + "letter": "Y", + "data": [{ + "name": "雅安", + "mobile": "15544448888", + "keyword": "雅安YAAN15544448888" + }, + { + "name": "延安", + "mobile": "15544448888", + "keyword": "延安YANAN15544448888" + }, + { + "name": "延边", + "mobile": "15544448888", + "keyword": "延边YANBIAN15544448888" + }, + { + "name": "盐城", + "mobile": "15544448888", + "keyword": "盐城YANCHENG15544448888" + } + ] + }, + { + "letter": "Z", + "data": [{ + "name": "枣庄", + "mobile": "15544448888", + "keyword": "枣庄ZAOZHUANG15544448888" + }, + { + "name": "张家界", + "mobile": "15544448888", + "keyword": "张家界ZHANGJIAJIE15544448888" + }, + { + "name": "张家口", + "mobile": "15544448888", + "keyword": "张家口ZHANGJIAKOU15544448888" + } + ] + }, + { + "letter": "#", + "data": [{ + "name": "其他.", + "mobile": "16666666666", + "keyword": "echo16666666666" + }] + } + ] +} diff --git a/client_mp/common/locales/en.js b/client_mp/common/locales/en.js new file mode 100644 index 0000000..5bd6f7a --- /dev/null +++ b/client_mp/common/locales/en.js @@ -0,0 +1,21 @@ +export default { + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 + components: { + desc: 'Numerous components cover the various requirements of the development process, and the components are rich in functions and compatible with multiple terminals. Let you integrate quickly, out of the box' + }, + js: { + desc: 'Numerous intimate gadgets are a weapon that you can call upon during the development process, allowing you to dart in your hand and pierce the Yang with a hundred steps' + }, + template: { + desc: 'Collection of many commonly used pages and layouts, reducing the repetitive work of developers, allowing you to focus on logic and get twice the result with half the effort' + }, + nav: { + components: 'Components', + js: 'JS', + template: 'Template' + }, + common: { + intro: 'UI framework for rapid development of multiple platforms', + title: 'uView UI', + }, +} \ No newline at end of file diff --git a/client_mp/common/locales/zh.js b/client_mp/common/locales/zh.js new file mode 100644 index 0000000..1c6b15c --- /dev/null +++ b/client_mp/common/locales/zh.js @@ -0,0 +1,21 @@ +export default { + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 + components: { + desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用' + }, + js: { + desc: '众多的贴心小工具,是你开发过程中召之即来的利器,让你飞镖在手,百步穿杨' + }, + template: { + desc: '收集众多的常用页面和布局,减少开发者的重复工作,让你专注逻辑,事半功倍' + }, + nav: { + components: '组件', + js: '工具', + template: '模板' + }, + common: { + intro: '多平台快速开发的UI框架', + title: 'uView UI', + }, +} \ No newline at end of file diff --git a/client_mp/common/vue-i18n.min.js b/client_mp/common/vue-i18n.min.js new file mode 100644 index 0000000..8d0a5c0 --- /dev/null +++ b/client_mp/common/vue-i18n.min.js @@ -0,0 +1,6 @@ +/*! + * vue-i18n v8.20.0 + * (c) 2020 kazuya kawaguchi + * Released under the MIT License. + */ +var t,e;t=this,e=function(){"use strict";var t=["style","currency","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","localeMatcher","formatMatcher","unit"];function e(t,e){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}var n=Array.isArray;function r(t){return null!==t&&"object"==typeof t}function a(t){return"string"==typeof t}var i=Object.prototype.toString,o="[object Object]";function s(t){return i.call(t)===o}function l(t){return null==t}function c(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=null,a=null;return 1===t.length?r(t[0])||Array.isArray(t[0])?a=t[0]:"string"==typeof t[0]&&(n=t[0]):2===t.length&&("string"==typeof t[0]&&(n=t[0]),(r(t[1])||Array.isArray(t[1]))&&(a=t[1])),{locale:n,params:a}}function u(t){return JSON.parse(JSON.stringify(t))}function h(t,e){return!!~t.indexOf(e)}var f=Object.prototype.hasOwnProperty;function p(t,e){return f.call(t,e)}function m(t){for(var e=arguments,n=Object(t),a=1;a0;)e[n]=arguments[n+1];var r=this.$i18n;return r._t.apply(r,[t,r.locale,r._getMessages(),this].concat(e))},t.prototype.$tc=function(t,e){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];var a=this.$i18n;return a._tc.apply(a,[t,a.locale,a._getMessages(),this,e].concat(n))},t.prototype.$te=function(t,e){var n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).d.apply(e,[t].concat(n))},t.prototype.$n=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).n.apply(e,[t].concat(n))}}(F),F.mixin(g),F.directive("t",{bind:w,update:$,unbind:M}),F.component(v.name,v),F.component(k.name,k),F.config.optionMergeStrategies.i18n=function(t,e){return void 0===e?t:e}}var D=function(){this._caches=Object.create(null)};D.prototype.interpolate=function(t,e){if(!e)return[t];var n=this._caches[t];return n||(n=function(t){var e=[],n=0,r="";for(;n0)h--,u=R,f[W]();else{if(h=0,void 0===n)return!1;if(!1===(n=J(n)))return!1;f[j]()}};null!==u;)if("\\"!==(e=t[++c])||!p()){if(a=U(e),(i=(s=z[u])[a]||s.else||E)===E)return;if(u=i[0],(o=f[i[1]])&&(r=void 0===(r=i[2])?e:r,!1===o()))return;if(u===V)return l}}(t))&&(this._cache[t]=e),e||[]},q.prototype.getPathValue=function(t,e){if(!r(t))return null;var n=this.parsePath(e);if(0===n.length)return null;for(var a=n.length,i=t,o=0;o/,Z=/(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g,K=/^@(?:\.([a-z]+))?:/,Q=/[()]/g,Y={upper:function(t){return t.toLocaleUpperCase()},lower:function(t){return t.toLocaleLowerCase()},capitalize:function(t){return""+t.charAt(0).toLocaleUpperCase()+t.substr(1)}},tt=new D,et=function(t){var e=this;void 0===t&&(t={}),!F&&"undefined"!=typeof window&&window.Vue&&I(window.Vue);var n=t.locale||"en-US",r=!1!==t.fallbackLocale&&(t.fallbackLocale||"en-US"),a=t.messages||{},i=t.dateTimeFormats||{},o=t.numberFormats||{};this._vm=null,this._formatter=t.formatter||tt,this._modifiers=t.modifiers||{},this._missing=t.missing||null,this._root=t.root||null,this._sync=void 0===t.sync||!!t.sync,this._fallbackRoot=void 0===t.fallbackRoot||!!t.fallbackRoot,this._formatFallbackMessages=void 0!==t.formatFallbackMessages&&!!t.formatFallbackMessages,this._silentTranslationWarn=void 0!==t.silentTranslationWarn&&t.silentTranslationWarn,this._silentFallbackWarn=void 0!==t.silentFallbackWarn&&!!t.silentFallbackWarn,this._dateTimeFormatters={},this._numberFormatters={},this._path=new q,this._dataListeners=[],this._componentInstanceCreatedListener=t.componentInstanceCreatedListener||null,this._preserveDirectiveContent=void 0!==t.preserveDirectiveContent&&!!t.preserveDirectiveContent,this.pluralizationRules=t.pluralizationRules||{},this._warnHtmlInMessage=t.warnHtmlInMessage||"off",this._postTranslation=t.postTranslation||null,this.getChoiceIndex=function(t,n){var r=Object.getPrototypeOf(e);if(r&&r.getChoiceIndex)return r.getChoiceIndex.call(e,t,n);var a,i;return e.locale in e.pluralizationRules?e.pluralizationRules[e.locale].apply(e,[t,n]):(a=t,i=n,a=Math.abs(a),2===i?a?a>1?1:0:1:a?Math.min(a,2):0)},this._exist=function(t,n){return!(!t||!n)&&(!l(e._path.getPathValue(t,n))||!!t[n])},"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(a).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,a[t])}),this._initVM({locale:n,fallbackLocale:r,messages:a,dateTimeFormats:i,numberFormats:o})},nt={vm:{configurable:!0},messages:{configurable:!0},dateTimeFormats:{configurable:!0},numberFormats:{configurable:!0},availableLocales:{configurable:!0},locale:{configurable:!0},fallbackLocale:{configurable:!0},formatFallbackMessages:{configurable:!0},missing:{configurable:!0},formatter:{configurable:!0},silentTranslationWarn:{configurable:!0},silentFallbackWarn:{configurable:!0},preserveDirectiveContent:{configurable:!0},warnHtmlInMessage:{configurable:!0},postTranslation:{configurable:!0}};return et.prototype._checkLocaleMessage=function(t,n,r){var i=function(t,n,r,o){if(s(r))Object.keys(r).forEach(function(e){var a=r[e];s(a)?(o.push(e),o.push("."),i(t,n,a,o),o.pop(),o.pop()):(o.push(e),i(t,n,a,o),o.pop())});else if(Array.isArray(r))r.forEach(function(e,r){s(e)?(o.push("["+r+"]"),o.push("."),i(t,n,e,o),o.pop(),o.pop()):(o.push("["+r+"]"),i(t,n,e,o),o.pop())});else if(a(r)){if(X.test(r)){var l="Detected HTML in message '"+r+"' of keypath '"+o.join("")+"' at '"+n+"'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp";"warn"===t?e(l):"error"===t&&function(t,e){"undefined"!=typeof console&&(console.error("[vue-i18n] "+t),e&&console.error(e.stack))}(l)}}};i(n,t,r,[])},et.prototype._initVM=function(t){var e=F.config.silent;F.config.silent=!0,this._vm=new F({data:t}),F.config.silent=e},et.prototype.destroyVM=function(){this._vm.$destroy()},et.prototype.subscribeDataChanging=function(t){this._dataListeners.push(t)},et.prototype.unsubscribeDataChanging=function(t){!function(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)t.splice(n,1)}}(this._dataListeners,t)},et.prototype.watchI18nData=function(){var t=this;return this._vm.$watch("$data",function(){for(var e=t._dataListeners.length;e--;)F.nextTick(function(){t._dataListeners[e]&&t._dataListeners[e].$forceUpdate()})},{deep:!0})},et.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._root.$i18n.vm.$watch("locale",function(e){t.$set(t,"locale",e),t.$forceUpdate()},{immediate:!0})},et.prototype.onComponentInstanceCreated=function(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)},nt.vm.get=function(){return this._vm},nt.messages.get=function(){return u(this._getMessages())},nt.dateTimeFormats.get=function(){return u(this._getDateTimeFormats())},nt.numberFormats.get=function(){return u(this._getNumberFormats())},nt.availableLocales.get=function(){return Object.keys(this.messages).sort()},nt.locale.get=function(){return this._vm.locale},nt.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},nt.fallbackLocale.get=function(){return this._vm.fallbackLocale},nt.fallbackLocale.set=function(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)},nt.formatFallbackMessages.get=function(){return this._formatFallbackMessages},nt.formatFallbackMessages.set=function(t){this._formatFallbackMessages=t},nt.missing.get=function(){return this._missing},nt.missing.set=function(t){this._missing=t},nt.formatter.get=function(){return this._formatter},nt.formatter.set=function(t){this._formatter=t},nt.silentTranslationWarn.get=function(){return this._silentTranslationWarn},nt.silentTranslationWarn.set=function(t){this._silentTranslationWarn=t},nt.silentFallbackWarn.get=function(){return this._silentFallbackWarn},nt.silentFallbackWarn.set=function(t){this._silentFallbackWarn=t},nt.preserveDirectiveContent.get=function(){return this._preserveDirectiveContent},nt.preserveDirectiveContent.set=function(t){this._preserveDirectiveContent=t},nt.warnHtmlInMessage.get=function(){return this._warnHtmlInMessage},nt.warnHtmlInMessage.set=function(t){var e=this,n=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,n!==t&&("warn"===t||"error"===t)){var r=this._getMessages();Object.keys(r).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,r[t])})}},nt.postTranslation.get=function(){return this._postTranslation},nt.postTranslation.set=function(t){this._postTranslation=t},et.prototype._getMessages=function(){return this._vm.messages},et.prototype._getDateTimeFormats=function(){return this._vm.dateTimeFormats},et.prototype._getNumberFormats=function(){return this._vm.numberFormats},et.prototype._warnDefault=function(t,e,n,r,i,o){if(!l(n))return n;if(this._missing){var s=this._missing.apply(null,[t,e,r,i]);if(a(s))return s}if(this._formatFallbackMessages){var u=c.apply(void 0,i);return this._render(e,o,u.params,e)}return e},et.prototype._isFallbackRoot=function(t){return!t&&!l(this._root)&&this._fallbackRoot},et.prototype._isSilentFallbackWarn=function(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn},et.prototype._isSilentFallback=function(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)},et.prototype._isSilentTranslationWarn=function(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn},et.prototype._interpolate=function(t,e,n,r,i,o,c){if(!e)return null;var u,h=this._path.getPathValue(e,n);if(Array.isArray(h)||s(h))return h;if(l(h)){if(!s(e))return null;if(!a(u=e[n]))return null}else{if(!a(h))return null;u=h}return(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,r,"raw",o,c)),this._render(u,i,o,n)},et.prototype._link=function(t,e,n,r,a,i,o){var s=n,l=s.match(Z);for(var c in l)if(l.hasOwnProperty(c)){var u=l[c],f=u.match(K),p=f[0],m=f[1],_=u.replace(p,"").replace(Q,"");if(h(o,_))return s;o.push(_);var g=this._interpolate(t,e,_,r,"raw"===a?"string":a,"raw"===a?void 0:i,o);if(this._isFallbackRoot(g)){if(!this._root)throw Error("unexpected error");var v=this._root.$i18n;g=v._translate(v._getMessages(),v.locale,v.fallbackLocale,_,r,a,i)}g=this._warnDefault(t,_,g,r,Array.isArray(i)?i:[i],a),this._modifiers.hasOwnProperty(m)?g=this._modifiers[m](g):Y.hasOwnProperty(m)&&(g=Y[m](g)),o.pop(),s=g?s.replace(u,g):s}return s},et.prototype._render=function(t,e,n,r){var i=this._formatter.interpolate(t,n,r);return i||(i=tt.interpolate(t,n,r)),"string"!==e||a(i)?i:i.join("")},et.prototype._appendItemToChain=function(t,e,n){var r=!1;return h(t,e)||(r=!0,e&&(r="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(r=n[e]))),r},et.prototype._appendLocaleToChain=function(t,e,n){var r,a=e.split("-");do{var i=a.join("-");r=this._appendItemToChain(t,i,n),a.splice(-1,1)}while(a.length&&!0===r);return r},et.prototype._appendBlockToChain=function(t,e,n){for(var r=!0,i=0;i0;)i[o]=arguments[o+4];if(!t)return"";var s=c.apply(void 0,i),l=s.locale||e,u=this._translate(n,l,this.fallbackLocale,t,r,"string",s.params);if(this._isFallbackRoot(u)){if(!this._root)throw Error("unexpected error");return(a=this._root).$t.apply(a,[t].concat(i))}return u=this._warnDefault(l,t,u,r,i,"string"),this._postTranslation&&null!=u&&(u=this._postTranslation(u,t)),u},et.prototype.t=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this)._t.apply(e,[t,this.locale,this._getMessages(),null].concat(n))},et.prototype._i=function(t,e,n,r,a){var i=this._translate(n,e,this.fallbackLocale,t,r,"raw",a);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.i(t,e,a)}return this._warnDefault(e,t,i,r,[a],"raw")},et.prototype.i=function(t,e,n){return t?(a(e)||(e=this.locale),this._i(t,e,this._getMessages(),null,n)):""},et.prototype._tc=function(t,e,n,r,a){for(var i,o=[],s=arguments.length-5;s-- >0;)o[s]=arguments[s+5];if(!t)return"";void 0===a&&(a=1);var l={count:a,n:a},u=c.apply(void 0,o);return u.params=Object.assign(l,u.params),o=null===u.locale?[u.params]:[u.locale,u.params],this.fetchChoice((i=this)._t.apply(i,[t,e,n,r].concat(o)),a)},et.prototype.fetchChoice=function(t,e){if(!t&&!a(t))return null;var n=t.split("|");return n[e=this.getChoiceIndex(e,n.length)]?n[e].trim():t},et.prototype.tc=function(t,e){for(var n,r=[],a=arguments.length-2;a-- >0;)r[a]=arguments[a+2];return(n=this)._tc.apply(n,[t,this.locale,this._getMessages(),null,e].concat(r))},et.prototype._te=function(t,e,n){for(var r=[],a=arguments.length-3;a-- >0;)r[a]=arguments[a+3];var i=c.apply(void 0,r).locale||e;return this._exist(n[i],t)},et.prototype.te=function(t,e){return this._te(t,this.locale,this._getMessages(),e)},et.prototype.getLocaleMessage=function(t){return u(this._vm.messages[t]||{})},et.prototype.setLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,e)},et.prototype.mergeLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,m({},this._vm.messages[t]||{},e))},et.prototype.getDateTimeFormat=function(t){return u(this._vm.dateTimeFormats[t]||{})},et.prototype.setDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,e),this._clearDateTimeFormat(t,e)},et.prototype.mergeDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,m(this._vm.dateTimeFormats[t]||{},e)),this._clearDateTimeFormat(t,e)},et.prototype._clearDateTimeFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._dateTimeFormatters.hasOwnProperty(r)&&delete this._dateTimeFormatters[r]}},et.prototype._localizeDateTime=function(t,e,n,r,a){for(var i=e,o=r[i],s=this._getLocaleChain(e,n),c=0;c0;)e[n]=arguments[n+1];var i=this.locale,o=null;return 1===e.length?a(e[0])?o=e[0]:r(e[0])&&(e[0].locale&&(i=e[0].locale),e[0].key&&(o=e[0].key)):2===e.length&&(a(e[0])&&(o=e[0]),a(e[1])&&(i=e[1])),this._d(t,i,o)},et.prototype.getNumberFormat=function(t){return u(this._vm.numberFormats[t]||{})},et.prototype.setNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,e),this._clearNumberFormat(t,e)},et.prototype.mergeNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,m(this._vm.numberFormats[t]||{},e)),this._clearNumberFormat(t,e)},et.prototype._clearNumberFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._numberFormatters.hasOwnProperty(r)&&delete this._numberFormatters[r]}},et.prototype._getNumberFormatter=function(t,e,n,r,a,i){for(var o=e,s=r[o],c=this._getLocaleChain(e,n),u=0;u0;)n[i]=arguments[i+1];var o=this.locale,s=null,l=null;return 1===n.length?a(n[0])?s=n[0]:r(n[0])&&(n[0].locale&&(o=n[0].locale),n[0].key&&(s=n[0].key),l=Object.keys(n[0]).reduce(function(e,r){var a;return h(t,r)?Object.assign({},e,((a={})[r]=n[0][r],a)):e},null)):2===n.length&&(a(n[0])&&(s=n[0]),a(n[1])&&(o=n[1])),this._n(e,o,s,l)},et.prototype._ntp=function(t,e,n,r){if(!et.availabilities.numberFormat)return[];if(!n)return(r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e)).formatToParts(t);var a=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),i=a&&a.formatToParts(t);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,r)}return i||[]},Object.defineProperties(et.prototype,nt),Object.defineProperty(et,"availabilities",{get:function(){if(!G){var t="undefined"!=typeof Intl;G={dateTimeFormat:t&&void 0!==Intl.DateTimeFormat,numberFormat:t&&void 0!==Intl.NumberFormat}}return G}}),et.install=I,et.version="8.20.0",et},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueI18n=e(); \ No newline at end of file diff --git a/client_mp/components/page-nav/page-nav.vue b/client_mp/components/page-nav/page-nav.vue new file mode 100644 index 0000000..3f3c0f2 --- /dev/null +++ b/client_mp/components/page-nav/page-nav.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/client_mp/main.js b/client_mp/main.js new file mode 100644 index 0000000..2416414 --- /dev/null +++ b/client_mp/main.js @@ -0,0 +1,64 @@ +import Vue from 'vue'; +import App from './App'; + +Vue.config.productionTip = false; + +App.mpType = 'app'; + +// 此处为演示Vue.prototype使用,非uView的功能部分 +Vue.prototype.vuePrototype = '枣红'; + +// 引入全局uView +import uView from 'uview-ui'; +Vue.use(uView); + +// 此处为演示vuex使用,非uView的功能部分 +import store from '@/store'; + +// 引入uView提供的对vuex的简写法文件 +let vuexStore = require('@/store/$u.mixin.js'); +Vue.mixin(vuexStore); + +// 引入uView对小程序分享的mixin封装 +let mpShare = require('uview-ui/libs/mixin/mpShare.js'); +Vue.mixin(mpShare); + +// i18n部分的配置 +// 引入语言包,注意路径 +import Chinese from '@/common/locales/zh.js'; +import English from '@/common/locales/en.js'; + +// VueI18n +import VueI18n from '@/common/vue-i18n.min.js'; + +// VueI18n +Vue.use(VueI18n); + +const i18n = new VueI18n({ + // 默认语言 + locale: 'zh', + // 引入语言文件 + messages: { + 'zh': Chinese, + 'en': English, + } +}); + +// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填 +Vue.prototype._i18n = i18n; + +const app = new Vue({ + i18n, + store, + ...App +}); + +// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用 +import httpInterceptor from '@/common/http.interceptor.js'; +Vue.use(httpInterceptor, app); + +// http接口API抽离,免于写url或者一些固定的参数 +import httpApi from '@/common/http.api.js'; +Vue.use(httpApi, app); + +app.$mount(); diff --git a/client_mp/manifest.json b/client_mp/manifest.json new file mode 100644 index 0000000..0f3f205 --- /dev/null +++ b/client_mp/manifest.json @@ -0,0 +1,139 @@ +{ + "name" : "client_mp", + "appid" : "__UNI__01C03DB", + "description" : "多平台快速开发的UI框架", + "versionName" : "1.8.2", + "versionCode" : "100", + "transformPx" : false, + "app-plus" : { + // APP-VUE分包,可提APP升启动速度,2.7.12开始支持,兼容微信小程序分包方案,默认关闭 + "optimization" : { + "subPackages" : true + }, + "safearea" : { + "bottom" : { + "offset" : "none" + } + }, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + "usingComponents" : true, + "nvueCompiler" : "uni-app", + "compilerVersion" : 3, + "modules" : {}, + "distribute" : { + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ] + }, + "ios" : {}, + "sdkConfigs" : { + "ad" : {} + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + } + } + }, + "quickapp" : {}, + "mp-weixin" : { + "appid" : "wx126bdbf0c683c357", + "setting" : { + "urlCheck" : false, + "es6" : false, + "minified" : true, + "postcss" : true + }, + "optimization" : { + "subPackages" : true + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true, + "component2" : true + }, + "mp-qq" : { + "optimization" : { + "subPackages" : true + }, + "appid" : "" + }, + "mp-baidu" : { + "usingComponents" : true, + "appid" : "" + }, + "mp-toutiao" : { + "usingComponents" : true, + "appid" : "" + }, + "h5" : { + "template" : "template.h5.html", + "router" : { + "mode" : "hash", + "base" : "" + }, + "optimization" : { + "treeShaking" : { + "enable" : false + } + }, + "title" : "uView UI" + } +} diff --git a/client_mp/package.json b/client_mp/package.json new file mode 100644 index 0000000..58e7ac8 --- /dev/null +++ b/client_mp/package.json @@ -0,0 +1,23 @@ +{ + "name": "uView", + "version": "1.0.0", + "description": "

\r \"logo\"\r

\r

uView

\r

多平台快速开发的UI框架

", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/YanxinNet/uView.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/YanxinNet/uView/issues" + }, + "homepage": "https://github.com/YanxinNet/uView#readme", + "dependencies": { + "vue-i18n": "^8.20.0" + } +} diff --git a/client_mp/pages.json b/client_mp/pages.json new file mode 100644 index 0000000..7e75f62 --- /dev/null +++ b/client_mp/pages.json @@ -0,0 +1,903 @@ +{ + "easycom": { + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + // "condition": { //模式配置,仅开发期间生效 + // "current": 0, //当前激活的模式(list 的索引项) + // "list": [{ + // "name": "test", //模式名称 + // "path": "pages/componentsC/test/index", //启动页面,必选 + // "query": "uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1" //启动参数,在页面的onLoad函数里面得到 + // }] + // }, + "pages": [ + { + "path" : "pages/home/home", + "style" : + { + "navigationBarTitleText": "主页", + "enablePullDownRefresh": false + } + + }, + // 演示-组件 + { + "path": "pages/example/components", + "style": { + "navigationBarTitleText": "组件" + } + }, + // avatarCropper-头像裁剪 + { + "path": "uview-ui/components/u-avatar-cropper/u-avatar-cropper", + "style": { + "navigationBarTitleText": "头像裁剪", + "navigationBarBackgroundColor": "#000000" + } + }, + // 演示-工具 + { + "path": "pages/example/js", + "style": { + "navigationBarTitleText": "工具" + } + }, + // 演示-模板 + { + "path": "pages/example/template", + "style": { + "navigationBarTitleText": "模板" + } + }, + // fullScreen-压窗屏 + { + "path": "uview-ui/components/u-full-screen/u-full-screen", + "style": { + "navigationStyle": "custom", + "app-plus": { + "animationType": "fade-in", + "background": "transparent", + "backgroundColor": "rgba(0,0,0,0)", + "popGesture": "none" + } + } + } + ,{ + "path" : "pages/my/my", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/uview/uview", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/login/login", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ], + "subPackages": [{ + "root": "pages/componentsC", + "pages": [ + // test-测试 + { + "path": "test/index", + "style": { + "navigationBarTitleText": "Test" + // "navigationStyle": "custom" ,// 隐藏系统导航栏 + // "navigationBarTextStyle": "white" // 状态栏字体为白色 + } + }, + // gap-间隔槽 + { + "path": "gap/index", + "style": { + "navigationBarTitleText": "gap-间隔槽" + } + }, + // subsection分段器 + { + "path": "subsection/index", + "style": { + "navigationBarTitleText": "subsection-分段器" + } + }, + // section 查看更多 + { + "path": "section/index", + "style": { + "navigationBarTitleText": "section-查看更多" + } + }, + // link链接 + { + "path": "link/index", + "style": { + "navigationBarTitleText": "link-链接" + } + }, + // mask遮罩层 + { + "path": "mask/index", + "style": { + "navigationBarTitleText": "mask-遮罩层" + } + }, + // countTo数字滚动 + { + "path": "countTo/index", + "style": { + "navigationBarTitleText": "countTo-数字滚动" + } + }, + // color颜色 + { + "path": "color/index", + "style": { + "navigationBarTitleText": "color-颜色" + } + }, + // countDown倒计时 + { + "path": "countDown/index", + "style": { + "navigationBarTitleText": "countDown-倒计时" + } + }, + // progress进度条 + { + "path": "progress/index", + "style": { + "navigationBarTitleText": "progress-进度条" + } + }, + // alertTips警告提示 + { + "path": "alertTips/index", + "style": { + "navigationBarTitleText": "alertTips-警告提示" + } + }, + // badge 徽标数 + { + "path": "badge/index", + "style": { + "navigationBarTitleText": "badge-徽标数" + } + }, + // button按钮 + { + "path": "button/index", + "style": { + "navigationBarTitleText": "button-按钮" + } + }, + // collapse折叠面板 + { + "path": "collapse/index", + "style": { + "navigationBarTitleText": "collapse-折叠面板" + } + }, + // actionSheet操作菜单 + { + "path": "actionSheet/index", + "style": { + "navigationBarTitleText": "actionSheet-操作菜单" + } + }, + // messageInput验证码输入 + { + "path": "messageInput/index", + "style": { + "navigationBarTitleText": "messageInput-验证码输入" + } + }, + // popup弹窗 + { + "path": "popup/index", + "style": { + "navigationBarTitleText": "popup-弹窗" + } + }, + // listCell + { + "path": "cell/index", + "style": { + "navigationBarTitleText": "listCell-列表" + } + }, + // numberBox数字输入框 + { + "path": "numberBox/index", + "style": { + "navigationBarTitleText": "numberBox-步进器" + } + }, + // grid宫格布局 + { + "path": "grid/index", + "style": { + "navigationBarTitleText": "grid-宫格布局" + } + }, + // layout栅格布局 + { + "path": "layout/index", + "style": { + "navigationBarTitleText": "layout-栅格布局" + } + }, + // 加载更多 + { + "path": "loadmore/index", + "style": { + "navigationBarTitleText": "loadmore-加载更多" + } + } + ] + }, + { + "root": "pages/template", + "pages": [ + // wxCenter 仿微信个人中心 + { + "path": "wxCenter/index", + "style": { + "navigationBarTitleText": "wxCenter 仿微信个人中心", + "navigationStyle": "custom" + } + }, + // keyboardPay 自定义键盘支付 + { + "path": "keyboardPay/index", + "style": { + "navigationBarTitleText": "keyboardPay 自定义键盘支付" + } + }, + // douyin 仿抖音 + // { + // "path": "douyin/index", + // "style": { + // "navigationBarTitleText": "douyin 仿抖音" + // } + // }, + // mallMenu商城分类 + { + "path": "mallMenu/index2", + "style": { + "navigationBarTitleText": "mallMenu-商城分类" + } + }, + // mallMenu商城分类 + { + "path": "mallMenu/index1", + "style": { + "navigationBarTitleText": "mallMenu-商城分类" + } + }, + // coupon优惠券 + { + "path": "coupon/index", + "style": { + "navigationBarTitleText": "coupon-优惠券" + } + }, + { + "path": "login/index", + "style": { + "navigationBarTitleText": "美团登录" + } + }, + // 城市选择 + { + "path": "citySelect/index", + "style": { + "navigationBarTitleText": "城市选择" + } + }, + // SubmitBar提交订单栏 + { + "path": "submitBar/index", + "style": { + "navigationBarTitleText": "提交订单栏" + } + }, + // comment评论 + { + "path": "comment/index", + "style": { + "navigationBarTitleText": "评论" + } + }, + // comment评论详情 + { + "path": "comment/reply", + "style": { + "navigationBarTitleText": "评论详情" + } + }, + // order订单 + { + "path": "order/index", + "style": { + "navigationBarTitleText": "订单" + } + }, + // login登录获取验证码 + { + "path": "login/code", + "style": { + "navigationBarTitleText": "登录获取验证码" + } + }, + // address用户地址 + { + "path": "address/index", + "style": { + "navigationBarTitleText": "用户地址" + } + }, + // address添加用户地址 + { + "path": "address/addSite", + "style": { + "navigationBarTitleText": "添加用户地址" + } + } + ] + }, + { + "root": "pages/library", + "pages": [ + // debounce-节流防抖 + { + "path": "debounce/index", + "style": { + "navigationBarTitleText": "throttle | debounce-节流防抖" + } + }, + // deepClone-对象深度克隆 + { + "path": "deepClone/index", + "style": { + "navigationBarTitleText": "deepClone-对象深度克隆" + } + }, + // deepMerge-对象深度合并 + { + "path": "deepMerge/index", + "style": { + "navigationBarTitleText": "deepMerge-对象深度合并" + } + }, + // getRect-元素节点 + { + "path": "getRect/index", + "style": { + "navigationBarTitleText": "getRect-元素节点" + } + }, + // timeFrom-多久之前 + { + "path": "timeFrom/index", + "style": { + "navigationBarTitleText": "timeFrom-多久之前" + } + }, + // globalData-全局变量 + { + "path": "globalVariable/globalData", + "style": { + "navigationBarTitleText": "globalData-全局变量" + } + }, + // prototype-全局变量 + { + "path": "globalVariable/prototype", + "style": { + "navigationBarTitleText": "prototype-全局变量" + } + }, + // vuex-全局变量 + { + "path": "globalVariable/vuex", + "style": { + "navigationBarTitleText": "vuex-全局变量" + } + }, + // globalVariable-全局变量 + { + "path": "globalVariable/index", + "style": { + "navigationBarTitleText": "globalVariable-全局变量" + } + }, + // http-请求 + { + "path": "http/index", + "style": { + "navigationBarTitleText": "http-请求" + } + }, + // test-规则验证 + { + "path": "test/index", + "style": { + "navigationBarTitleText": "test-规则验证" + } + }, + // mpShare-小程序分享 + { + "path": "mpShare/index", + "style": { + "navigationBarTitleText": "mpShare-小程序分享" + } + }, + // color-JS调用颜色 + { + "path": "color/index", + "style": { + "navigationBarTitleText": "color-JS调用颜色" + } + }, + // trim-去除空格 + { + "path": "trim/index", + "style": { + "navigationBarTitleText": "trim-去除空格" + } + }, + // random-随机数生成 + { + "path": "random/index", + "style": { + "navigationBarTitleText": "random-随机数生成" + } + }, + // md5加密 + { + "path": "md5/index", + "style": { + "navigationBarTitleText": "md5-加密" + } + }, + // colorSwitch颜色转换 + { + "path": "colorSwitch/index", + "style": { + "navigationBarTitleText": "colorSwitch-颜色转换" + } + }, + // randomArray数组乱序 + { + "path": "randomArray/index", + "style": { + "navigationBarTitleText": "randomArray-数组乱序" + } + }, + // guid全局唯一标识符 + { + "path": "guid/index", + "style": { + "navigationBarTitleText": "guid-全局唯一标识符" + } + }, + // timeFormat时间格式化 + { + "path": "timeFormat/index", + "style": { + "navigationBarTitleText": "timeFormat-时间格式化" + } + }, // route-路由 + { + "path": "route/index", + "style": { + "navigationBarTitleText": "route-路由" + } + }, + // route-路由跳转 + { + "path": "route/routeTo", + "style": { + "navigationBarTitleText": "route-路由跳转" + } + }, + // queryParams-对象转URL参数 + { + "path": "queryParams/index", + "style": { + "navigationBarTitleText": "queryParams-对象转URL参数" + } + } + ] + }, + { + "root": "pages/componentsA", + "pages": [ + // parse-富文本解析器 + { + "path": "parse/index", + "style": { + "navigationBarTitleText": "parse-富文本解析器" + } + }, + // backTop-返回顶部 + { + "path": "backTop/index", + "style": { + "navigationBarTitleText": "backTop-返回顶部" + } + }, + // calendar-日历 + { + "path": "calendar/index", + "style": { + "navigationBarTitleText": "calendar-日历" + } + }, + // form-表单 + { + "path": "form/index", + "style": { + "navigationBarTitleText": "form-表单" + } + }, + // select-列选择器 + { + "path": "select/index", + "style": { + "navigationBarTitleText": "select-列选择器" + } + }, + // slider-滑动选择器 + { + "path": "slider/index", + "style": { + "navigationBarTitleText": "slider-滑动选择器" + } + }, + // fullScreen-压窗屏 + { + "path": "fullScreen/index", + "style": { + "navigationBarTitleText": "fullScreen-压窗屏" + } + }, + // navbar-自定义导航栏 + { + "path": "navbar/index", + "style": { + // "navigationBarTitleText": "navbar-自定义导航栏", + "navigationStyle": "custom", // 隐藏系统导航栏 + "navigationBarTextStyle": "white" // 状态栏字体为白色 + } + }, + // field-输入框 + { + "path": "field/index", + "style": { + "navigationBarTitleText": "field-输入框" + } + }, + // modal-模态框 + { + "path": "modal/index", + "style": { + "navigationBarTitleText": "modal-模态框" + } + }, + // indexList索引列表 + { + "path": "indexList/index", + "style": { + "navigationBarTitleText": "indexList-索引列表" + } + }, + // empty内容为空 + { + "path": "empty/index", + "style": { + "navigationBarTitleText": "empty-内容为空" + } + }, + // avatarCropper-头像裁剪 + { + "path": "avatarCropper/index", + "style": { + "navigationBarTitleText": "avatarCropper-头像裁剪" + } + }, // noNetwork没有网络 + { + "path": "noNetwork/index", + "style": { + "navigationBarTitleText": "noNetwork-没有网络" + } + }, // icon字体图标 + { + "path": "icon/index", + "style": { + "navigationBarTitleText": "icon-字体图标" + } + }, // avatar-用户头像展示 + { + "path": "avatar/index", + "style": { + "navigationBarTitleText": "avatar-用户头像展示" + } + }, // keyboard键盘 + { + "path": "keyboard/index", + "style": { + "navigationBarTitleText": "keyboard-键盘" + } + }, // 图片懒加载 + { + "path": "lazyLoad/index", + "style": { + "navigationBarTitleText": "lazyLoad-懒加载" + } + }, + // tabs切换 + { + "path": "tabs/index", + "style": { + "navigationBarTitleText": "Tabs-切换" + } + }, + // tag标签 + { + "path": "tag/index", + "style": { + "navigationBarTitleText": "tag-标签" + } + }, + // timeLine时间轴 + { + "path": "timeLine/index", + "style": { + "navigationBarTitleText": "timeLine-时间轴" + } + }, + // toast轻提示 + { + "path": "toast/index", + "style": { + "navigationBarTitleText": "toast-轻提示" + } + }, + // topTips消息提示 + { + "path": "topTips/index", + "style": { + "navigationBarTitleText": "topTips-消息提示" + } + }, + // Code-验证码倒计时 + { + "path": "verificationCode/index", + "style": { + "navigationBarTitleText": "Code-验证码倒计时" + } + } + ] + }, + { + "root": "pages/componentsB", + "pages": [ + // dropdown-下拉菜单 + { + "path": "dropdown/index", + "style": { + "navigationBarTitleText": "dropdown-下拉菜单" + } + }, + // tabbar-底部导航栏 + { + "path": "tabbar/index", + "style": { + "navigationBarTitleText": "tabbar-底部导航栏" + } + }, + // line-线条 + { + "path": "line/index", + "style": { + "navigationBarTitleText": "line-线条" + } + }, + // image-图片 + { + "path": "image/index", + "style": { + "navigationBarTitleText": "image-图片" + } + }, + // card-卡片 + { + "path": "card/index", + "style": { + "navigationBarTitleText": "card-卡片" + } + }, + // divider-分割线 + { + "path": "divider/index", + "style": { + "navigationBarTitleText": "divider-分割线" + } + }, + // picker选择器 + { + "path": "picker/index", + "style": { + "navigationBarTitleText": "picker-选择器" + } + }, // noticeBar通告栏 + { + "path": "noticeBar/index", + "style": { + "navigationBarTitleText": "noticeBar-通告栏" + } + }, + // checkbox-复选框 + { + "path": "checkbox/index", + "style": { + "navigationBarTitleText": "checkbox-复选框" + } + }, + // radio-单选框 + { + "path": "radio/index", + "style": { + "navigationBarTitleText": "radio-单选框" + } + }, + // loading-加载动画 + { + "path": "loading/index", + "style": { + "navigationBarTitleText": "loading-加载动画" + } + }, + // switch-开关选择器 + { + "path": "switch/index", + "style": { + "navigationBarTitleText": "switch-开关选择器" + } + }, + // 骨架屏 + { + "path": "skeleton/index", + "style": { + "navigationBarTitleText": "skeleton-骨架屏" + } + }, // upload上传 + { + "path": "upload/index", + "style": { + "navigationBarTitleText": "upload-上传" + } + }, + // waterfall瀑布流 + // #ifndef MP-TOUTIAO + { + "path": "waterfall/index", + "style": { + "navigationBarTitleText": "waterfall-瀑布流" + } + }, + // #endif + // table表格 + { + "path": "table/index", + "style": { + "navigationBarTitleText": "table-表格" + } + }, + // rate评分 + { + "path": "rate/index", + "style": { + "navigationBarTitleText": "rate-评分" + } + }, + // readMore显示更多 + { + "path": "readMore/index", + "style": { + "navigationBarTitleText": "readMore-查看更多" + } + }, + // search搜索框 + { + "path": "search/index", + "style": { + "navigationBarTitleText": "search-搜索框" + } + }, + // steps步骤条 + { + "path": "steps/index", + "style": { + "navigationBarTitleText": "steps-步骤条" + } + }, + // sticky吸顶 + { + "path": "sticky/index", + "style": { + "navigationBarTitleText": "sticky-吸顶" + } + }, + // swiper轮播图 + { + "path": "swiper/index", + "style": { + "navigationBarTitleText": "swiper-轮播图" + } + }, + // swipeAction-左滑删除 + { + "path": "swipeAction/index", + "style": { + "navigationBarTitleText": "swipeAction-左滑删除" + } + } + ] + } + ], + "preloadRule": { + "pages/example/components": { + "network": "all", + "packages": ["pages/componentsA", "pages/componentsB", "pages/componentsC"] + } + }, + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uView", + "navigationBarBackgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" + }, + "tabBar": { + "color": "#909399", + "selectedColor": "#303133", + "backgroundColor": "#FFFFFF", + "borderStyle": "black", + "list": [{ + "pagePath": "pages/home/home", + "iconPath": "static/uview/example/component.png", + "selectedIconPath": "static/uview/example/component_select.png", + "text": "主页" + }, + { + "pagePath": "pages/uview/uview", + "iconPath": "static/uview/example/js.png", + "selectedIconPath": "static/uview/example/js_select.png", + "text": "uview" + }, + { + "pagePath": "pages/my/my", + "iconPath": "static/uview/example/template.png", + "selectedIconPath": "static/uview/example/template_select.png", + "text": "我的" + } + ] + } +} diff --git a/client_mp/pages/componentsA/avatar/index.vue b/client_mp/pages/componentsA/avatar/index.vue new file mode 100644 index 0000000..2689091 --- /dev/null +++ b/client_mp/pages/componentsA/avatar/index.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/client_mp/pages/componentsA/avatarCropper/index.vue b/client_mp/pages/componentsA/avatarCropper/index.vue new file mode 100644 index 0000000..b98210e --- /dev/null +++ b/client_mp/pages/componentsA/avatarCropper/index.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/client_mp/pages/componentsA/backTop/index.vue b/client_mp/pages/componentsA/backTop/index.vue new file mode 100644 index 0000000..64b115b --- /dev/null +++ b/client_mp/pages/componentsA/backTop/index.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/client_mp/pages/componentsA/calendar/index.vue b/client_mp/pages/componentsA/calendar/index.vue new file mode 100644 index 0000000..e95227f --- /dev/null +++ b/client_mp/pages/componentsA/calendar/index.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/client_mp/pages/componentsA/empty/index.vue b/client_mp/pages/componentsA/empty/index.vue new file mode 100644 index 0000000..8b9d42c --- /dev/null +++ b/client_mp/pages/componentsA/empty/index.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/client_mp/pages/componentsA/field/index.vue b/client_mp/pages/componentsA/field/index.vue new file mode 100644 index 0000000..33781e8 --- /dev/null +++ b/client_mp/pages/componentsA/field/index.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/client_mp/pages/componentsA/form/index.vue b/client_mp/pages/componentsA/form/index.vue new file mode 100644 index 0000000..6288a55 --- /dev/null +++ b/client_mp/pages/componentsA/form/index.vue @@ -0,0 +1,454 @@ + + + + + diff --git a/client_mp/pages/componentsA/fullScreen/index.vue b/client_mp/pages/componentsA/fullScreen/index.vue new file mode 100644 index 0000000..244afc0 --- /dev/null +++ b/client_mp/pages/componentsA/fullScreen/index.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/client_mp/pages/componentsA/icon/index.vue b/client_mp/pages/componentsA/icon/index.vue new file mode 100644 index 0000000..5a65f08 --- /dev/null +++ b/client_mp/pages/componentsA/icon/index.vue @@ -0,0 +1,652 @@ + + + + + diff --git a/client_mp/pages/componentsA/indexList/index.vue b/client_mp/pages/componentsA/indexList/index.vue new file mode 100644 index 0000000..18c1f25 --- /dev/null +++ b/client_mp/pages/componentsA/indexList/index.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/client_mp/pages/componentsA/keyboard/index.vue b/client_mp/pages/componentsA/keyboard/index.vue new file mode 100644 index 0000000..e82b5a6 --- /dev/null +++ b/client_mp/pages/componentsA/keyboard/index.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/client_mp/pages/componentsA/lazyLoad/index.vue b/client_mp/pages/componentsA/lazyLoad/index.vue new file mode 100644 index 0000000..bed40e5 --- /dev/null +++ b/client_mp/pages/componentsA/lazyLoad/index.vue @@ -0,0 +1,253 @@ + + + + + diff --git a/client_mp/pages/componentsA/modal/index.vue b/client_mp/pages/componentsA/modal/index.vue new file mode 100644 index 0000000..54f0ea7 --- /dev/null +++ b/client_mp/pages/componentsA/modal/index.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/client_mp/pages/componentsA/navbar/index.vue b/client_mp/pages/componentsA/navbar/index.vue new file mode 100644 index 0000000..47badd7 --- /dev/null +++ b/client_mp/pages/componentsA/navbar/index.vue @@ -0,0 +1,258 @@ + + + + + + diff --git a/client_mp/pages/componentsA/noNetwork/index.vue b/client_mp/pages/componentsA/noNetwork/index.vue new file mode 100644 index 0000000..0b9a49b --- /dev/null +++ b/client_mp/pages/componentsA/noNetwork/index.vue @@ -0,0 +1,51 @@ + + + + + \ No newline at end of file diff --git a/client_mp/pages/componentsA/parse/index.vue b/client_mp/pages/componentsA/parse/index.vue new file mode 100644 index 0000000..f93ff4a --- /dev/null +++ b/client_mp/pages/componentsA/parse/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/client_mp/pages/componentsA/select/index.vue b/client_mp/pages/componentsA/select/index.vue new file mode 100644 index 0000000..39ad8aa --- /dev/null +++ b/client_mp/pages/componentsA/select/index.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/client_mp/pages/componentsA/slider/index.vue b/client_mp/pages/componentsA/slider/index.vue new file mode 100644 index 0000000..4daf5e0 --- /dev/null +++ b/client_mp/pages/componentsA/slider/index.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/client_mp/pages/componentsA/tabs/index.vue b/client_mp/pages/componentsA/tabs/index.vue new file mode 100644 index 0000000..f702ee5 --- /dev/null +++ b/client_mp/pages/componentsA/tabs/index.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/client_mp/pages/componentsA/tag/index.vue b/client_mp/pages/componentsA/tag/index.vue new file mode 100644 index 0000000..d23b90f --- /dev/null +++ b/client_mp/pages/componentsA/tag/index.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/client_mp/pages/componentsA/test/index.vue b/client_mp/pages/componentsA/test/index.vue new file mode 100644 index 0000000..0748679 --- /dev/null +++ b/client_mp/pages/componentsA/test/index.vue @@ -0,0 +1,90 @@ + + + diff --git a/client_mp/pages/componentsA/timeLine/index.vue b/client_mp/pages/componentsA/timeLine/index.vue new file mode 100644 index 0000000..e8435b8 --- /dev/null +++ b/client_mp/pages/componentsA/timeLine/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/client_mp/pages/componentsA/toast/index.vue b/client_mp/pages/componentsA/toast/index.vue new file mode 100644 index 0000000..d25c068 --- /dev/null +++ b/client_mp/pages/componentsA/toast/index.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/client_mp/pages/componentsA/topTips/index.vue b/client_mp/pages/componentsA/topTips/index.vue new file mode 100644 index 0000000..0b52409 --- /dev/null +++ b/client_mp/pages/componentsA/topTips/index.vue @@ -0,0 +1,57 @@ + + + + + \ No newline at end of file diff --git a/client_mp/pages/componentsA/verificationCode/index.vue b/client_mp/pages/componentsA/verificationCode/index.vue new file mode 100644 index 0000000..01a57ed --- /dev/null +++ b/client_mp/pages/componentsA/verificationCode/index.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/client_mp/pages/componentsB/card/index.vue b/client_mp/pages/componentsB/card/index.vue new file mode 100644 index 0000000..731a5a4 --- /dev/null +++ b/client_mp/pages/componentsB/card/index.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/client_mp/pages/componentsB/checkbox/index.vue b/client_mp/pages/componentsB/checkbox/index.vue new file mode 100644 index 0000000..283ba76 --- /dev/null +++ b/client_mp/pages/componentsB/checkbox/index.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/client_mp/pages/componentsB/divider/index.vue b/client_mp/pages/componentsB/divider/index.vue new file mode 100644 index 0000000..55a9292 --- /dev/null +++ b/client_mp/pages/componentsB/divider/index.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/client_mp/pages/componentsB/dropdown/index.vue b/client_mp/pages/componentsB/dropdown/index.vue new file mode 100644 index 0000000..68c6552 --- /dev/null +++ b/client_mp/pages/componentsB/dropdown/index.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/client_mp/pages/componentsB/image/index.vue b/client_mp/pages/componentsB/image/index.vue new file mode 100644 index 0000000..82f620b --- /dev/null +++ b/client_mp/pages/componentsB/image/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/client_mp/pages/componentsB/line/index.vue b/client_mp/pages/componentsB/line/index.vue new file mode 100644 index 0000000..9d54f54 --- /dev/null +++ b/client_mp/pages/componentsB/line/index.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/client_mp/pages/componentsB/loading/index.vue b/client_mp/pages/componentsB/loading/index.vue new file mode 100644 index 0000000..42bc909 --- /dev/null +++ b/client_mp/pages/componentsB/loading/index.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/client_mp/pages/componentsB/noticeBar/index.vue b/client_mp/pages/componentsB/noticeBar/index.vue new file mode 100644 index 0000000..018074d --- /dev/null +++ b/client_mp/pages/componentsB/noticeBar/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/client_mp/pages/componentsB/picker/index.vue b/client_mp/pages/componentsB/picker/index.vue new file mode 100644 index 0000000..34b0bd0 --- /dev/null +++ b/client_mp/pages/componentsB/picker/index.vue @@ -0,0 +1,199 @@ + + + + + diff --git a/client_mp/pages/componentsB/radio/index.vue b/client_mp/pages/componentsB/radio/index.vue new file mode 100644 index 0000000..d72b12c --- /dev/null +++ b/client_mp/pages/componentsB/radio/index.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/client_mp/pages/componentsB/rate/index.vue b/client_mp/pages/componentsB/rate/index.vue new file mode 100644 index 0000000..16794a6 --- /dev/null +++ b/client_mp/pages/componentsB/rate/index.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/client_mp/pages/componentsB/readMore/index.vue b/client_mp/pages/componentsB/readMore/index.vue new file mode 100644 index 0000000..3003e8f --- /dev/null +++ b/client_mp/pages/componentsB/readMore/index.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/client_mp/pages/componentsB/search/index.vue b/client_mp/pages/componentsB/search/index.vue new file mode 100644 index 0000000..0d08818 --- /dev/null +++ b/client_mp/pages/componentsB/search/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/client_mp/pages/componentsB/skeleton/index.vue b/client_mp/pages/componentsB/skeleton/index.vue new file mode 100644 index 0000000..fbd8146 --- /dev/null +++ b/client_mp/pages/componentsB/skeleton/index.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/client_mp/pages/componentsB/steps/index.vue b/client_mp/pages/componentsB/steps/index.vue new file mode 100644 index 0000000..e14f619 --- /dev/null +++ b/client_mp/pages/componentsB/steps/index.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/client_mp/pages/componentsB/sticky/index.vue b/client_mp/pages/componentsB/sticky/index.vue new file mode 100644 index 0000000..ccd9931 --- /dev/null +++ b/client_mp/pages/componentsB/sticky/index.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/client_mp/pages/componentsB/swipeAction/index.vue b/client_mp/pages/componentsB/swipeAction/index.vue new file mode 100644 index 0000000..9f7b7d0 --- /dev/null +++ b/client_mp/pages/componentsB/swipeAction/index.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/client_mp/pages/componentsB/swiper/index.vue b/client_mp/pages/componentsB/swiper/index.vue new file mode 100644 index 0000000..7d87eba --- /dev/null +++ b/client_mp/pages/componentsB/swiper/index.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/client_mp/pages/componentsB/switch/index.vue b/client_mp/pages/componentsB/switch/index.vue new file mode 100644 index 0000000..3605997 --- /dev/null +++ b/client_mp/pages/componentsB/switch/index.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/client_mp/pages/componentsB/tabbar/index.vue b/client_mp/pages/componentsB/tabbar/index.vue new file mode 100644 index 0000000..a160853 --- /dev/null +++ b/client_mp/pages/componentsB/tabbar/index.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/client_mp/pages/componentsB/table/index.vue b/client_mp/pages/componentsB/table/index.vue new file mode 100644 index 0000000..382c27a --- /dev/null +++ b/client_mp/pages/componentsB/table/index.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/client_mp/pages/componentsB/upload/index.vue b/client_mp/pages/componentsB/upload/index.vue new file mode 100644 index 0000000..ae74a5f --- /dev/null +++ b/client_mp/pages/componentsB/upload/index.vue @@ -0,0 +1,224 @@ + + + + + diff --git a/client_mp/pages/componentsB/waterfall/index.vue b/client_mp/pages/componentsB/waterfall/index.vue new file mode 100644 index 0000000..e7d4ce8 --- /dev/null +++ b/client_mp/pages/componentsB/waterfall/index.vue @@ -0,0 +1,224 @@ + + + + + + + diff --git a/client_mp/pages/componentsC/actionSheet/index.vue b/client_mp/pages/componentsC/actionSheet/index.vue new file mode 100644 index 0000000..ee05688 --- /dev/null +++ b/client_mp/pages/componentsC/actionSheet/index.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/client_mp/pages/componentsC/alertTips/index.vue b/client_mp/pages/componentsC/alertTips/index.vue new file mode 100644 index 0000000..3210dd9 --- /dev/null +++ b/client_mp/pages/componentsC/alertTips/index.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/client_mp/pages/componentsC/badge/index.vue b/client_mp/pages/componentsC/badge/index.vue new file mode 100644 index 0000000..3f4a545 --- /dev/null +++ b/client_mp/pages/componentsC/badge/index.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/client_mp/pages/componentsC/button/index.vue b/client_mp/pages/componentsC/button/index.vue new file mode 100644 index 0000000..52c0801 --- /dev/null +++ b/client_mp/pages/componentsC/button/index.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/client_mp/pages/componentsC/cell/index.vue b/client_mp/pages/componentsC/cell/index.vue new file mode 100644 index 0000000..94b9570 --- /dev/null +++ b/client_mp/pages/componentsC/cell/index.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/client_mp/pages/componentsC/circleProgress/index.vue b/client_mp/pages/componentsC/circleProgress/index.vue new file mode 100644 index 0000000..ed1e7f1 --- /dev/null +++ b/client_mp/pages/componentsC/circleProgress/index.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/client_mp/pages/componentsC/collapse/index.vue b/client_mp/pages/componentsC/collapse/index.vue new file mode 100644 index 0000000..15d58e6 --- /dev/null +++ b/client_mp/pages/componentsC/collapse/index.vue @@ -0,0 +1,142 @@ + + + + + + + diff --git a/client_mp/pages/componentsC/color/index.vue b/client_mp/pages/componentsC/color/index.vue new file mode 100644 index 0000000..01c9fc0 --- /dev/null +++ b/client_mp/pages/componentsC/color/index.vue @@ -0,0 +1,364 @@ + + + + + diff --git a/client_mp/pages/componentsC/countDown/index.vue b/client_mp/pages/componentsC/countDown/index.vue new file mode 100644 index 0000000..45679d4 --- /dev/null +++ b/client_mp/pages/componentsC/countDown/index.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/client_mp/pages/componentsC/countTo/index.vue b/client_mp/pages/componentsC/countTo/index.vue new file mode 100644 index 0000000..4f54e8f --- /dev/null +++ b/client_mp/pages/componentsC/countTo/index.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/client_mp/pages/componentsC/gap/index.vue b/client_mp/pages/componentsC/gap/index.vue new file mode 100644 index 0000000..0ba6347 --- /dev/null +++ b/client_mp/pages/componentsC/gap/index.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/client_mp/pages/componentsC/grid/index.vue b/client_mp/pages/componentsC/grid/index.vue new file mode 100644 index 0000000..e6046fa --- /dev/null +++ b/client_mp/pages/componentsC/grid/index.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/client_mp/pages/componentsC/layout/index.vue b/client_mp/pages/componentsC/layout/index.vue new file mode 100644 index 0000000..8d05468 --- /dev/null +++ b/client_mp/pages/componentsC/layout/index.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/client_mp/pages/componentsC/link/index.vue b/client_mp/pages/componentsC/link/index.vue new file mode 100644 index 0000000..bda7e5d --- /dev/null +++ b/client_mp/pages/componentsC/link/index.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/client_mp/pages/componentsC/loadmore/index.vue b/client_mp/pages/componentsC/loadmore/index.vue new file mode 100644 index 0000000..5631429 --- /dev/null +++ b/client_mp/pages/componentsC/loadmore/index.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/client_mp/pages/componentsC/mask/index.vue b/client_mp/pages/componentsC/mask/index.vue new file mode 100644 index 0000000..420bb76 --- /dev/null +++ b/client_mp/pages/componentsC/mask/index.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/client_mp/pages/componentsC/messageInput/index.vue b/client_mp/pages/componentsC/messageInput/index.vue new file mode 100644 index 0000000..1b7fefd --- /dev/null +++ b/client_mp/pages/componentsC/messageInput/index.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/client_mp/pages/componentsC/numberBox/index.vue b/client_mp/pages/componentsC/numberBox/index.vue new file mode 100644 index 0000000..b9cd13c --- /dev/null +++ b/client_mp/pages/componentsC/numberBox/index.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/client_mp/pages/componentsC/popup/index.vue b/client_mp/pages/componentsC/popup/index.vue new file mode 100644 index 0000000..fc83892 --- /dev/null +++ b/client_mp/pages/componentsC/popup/index.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/client_mp/pages/componentsC/progress/index.vue b/client_mp/pages/componentsC/progress/index.vue new file mode 100644 index 0000000..f154bf5 --- /dev/null +++ b/client_mp/pages/componentsC/progress/index.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/client_mp/pages/componentsC/section/index.vue b/client_mp/pages/componentsC/section/index.vue new file mode 100644 index 0000000..5054192 --- /dev/null +++ b/client_mp/pages/componentsC/section/index.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/client_mp/pages/componentsC/subsection/index.vue b/client_mp/pages/componentsC/subsection/index.vue new file mode 100644 index 0000000..5aa225d --- /dev/null +++ b/client_mp/pages/componentsC/subsection/index.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/client_mp/pages/componentsC/test/index.vue b/client_mp/pages/componentsC/test/index.vue new file mode 100644 index 0000000..33247b0 --- /dev/null +++ b/client_mp/pages/componentsC/test/index.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client_mp/pages/example/components.config.js b/client_mp/pages/example/components.config.js new file mode 100644 index 0000000..ebc6f09 --- /dev/null +++ b/client_mp/pages/example/components.config.js @@ -0,0 +1,389 @@ + +export default [{ + groupName: '基础组件', + groupName_en: 'Basic components', + list: [{ + path: '/pages/componentsC/color/index', + icon: 'color', + title: 'Color 色彩', + title_en: 'Color', + }, { + path: '/pages/componentsA/icon/index', + icon: 'icon', + title: 'Icon 图标', + title_en: 'Icon', + },{ + path: '/pages/componentsB/image/index', + icon: 'image', + title: 'Image 图片', + title_en: 'Image', + }, { + path: '/pages/componentsC/button/index', + icon: 'button', + title: 'Button 按钮', + title_en: 'Button', + }, { + path: '/pages/componentsC/layout/index', + icon: 'layout', + title: 'Layout 布局', + title_en: 'Layout', + }, { + path: '/pages/componentsC/cell/index', + icon: 'cell', + title: 'Cell 单元格', + title_en: 'Cell', + }, { + path: '/pages/componentsC/badge/index', + icon: 'badge', + title: 'Badge 徽标数', + title_en: 'Badge', + }, { + path: '/pages/componentsA/tag/index', + icon: 'tag', + title: 'Tag 标签', + title_en: 'Tag', + }] + }, + { + groupName: '表单组件', + groupName_en: 'Form components', + list: [{ + path: '/pages/componentsA/form/index', + icon: 'form', + title: 'Form 表单', + title_en: 'Form', + }, { + path: '/pages/componentsA/calendar/index', + icon: 'calendar', + title: 'Calendar 日历', + title_en: 'Calendar', + }, { + path: '/pages/componentsA/select/index', + icon: 'select', + title: 'Select 列选择器', + title_en: 'Select', + }, { + path: '/pages/componentsA/keyboard/index', + icon: 'keyboard', + title: 'Keyboard 键盘', + title_en: 'Keyboard', + }, { + path: '/pages/componentsB/picker/index', + icon: 'picker', + title: 'Picker 选择器', + title_en: 'Picker', + }, { + path: '/pages/componentsB/rate/index', + icon: 'rate', + title: 'Rate 评分', + title_en: 'Rate', + }, { + path: '/pages/componentsB/search/index', + icon: 'search', + title: 'Search 搜索', + title_en: 'Search', + }, { + path: '/pages/componentsC/numberBox/index', + icon: 'numberBox', + title: 'NumberBox 步进器', + title_en: 'NumberBox', + }, { + path: '/pages/componentsB/upload/index', + icon: 'upload', + title: 'Upload 上传', + title_en: 'Upload', + }, { + path: '/pages/componentsA/verificationCode/index', + icon: 'verificationCode', + title: 'VerificationCode 验证码倒计时', + title_en: 'VerificationCode', + }, { + path: '/pages/componentsA/field/index', + icon: 'field', + title: 'Field 输入框', + title_en: 'Field', + }, { + path: '/pages/componentsB/checkbox/index', + icon: 'checkbox', + title: 'Checkbox 复选框', + title_en: 'Checkbox', + }, { + path: '/pages/componentsB/radio/index', + icon: 'radio', + title: 'Radio 单选框', + title_en: 'Radio', + }, { + path: '/pages/componentsB/switch/index', + icon: 'switch', + title: 'Switch 开关选择器', + title_en: 'Switch', + }, { + path: '/pages/componentsA/slider/index', + icon: 'slider', + title: 'Slider 滑动选择器', + title_en: 'Slider', + }] + }, { + groupName: '数据组件', + groupName_en: 'Data components', + list: [{ + path: '/pages/componentsC/progress/index', + icon: 'progress', + title: 'Progress 进度条', + title_en: 'Progress', + }, { + path: '/pages/componentsB/table/index', + icon: 'table', + title: 'Table 表格', + title_en: 'Table', + }, { + path: '/pages/componentsC/countDown/index', + icon: 'countDown', + title: 'CountDown 倒计时', + title_en: 'CountDown', + }, { + path: '/pages/componentsC/countTo/index', + icon: 'countTo', + title: 'CountTo 数字滚动', + title_en: 'CountTo', + }] + }, { + groupName: '反馈组件', + groupName_en: 'Feedback components', + list: [{ + path: '/pages/componentsC/actionSheet/index', + icon: 'actionSheet', + title: 'ActionSheet 操作菜单', + title_en: 'ActionSheet', + }, { + path: '/pages/componentsC/alertTips/index', + icon: 'alertTips', + title: 'AlertTips 警告提示', + title_en: 'AlertTips', + }, { + path: '/pages/componentsA/toast/index', + icon: 'toast', + title: 'Toast 消息提示', + title_en: 'Toast', + }, { + path: '/pages/componentsB/noticeBar/index', + icon: 'noticeBar', + title: 'NoticeBar 滚动通知', + title_en: 'NoticeBar', + }, { + path: '/pages/componentsA/topTips/index', + icon: 'topTips', + title: 'TopTips 顶部提示', + title_en: 'TopTips', + }, { + path: '/pages/componentsB/swipeAction/index', + icon: 'swipeAction', + title: 'SwipeAction 滑动单元格', + title_en: 'SwipeAction', + }, { + path: '/pages/componentsC/collapse/index', + icon: 'collapse', + title: 'Collapse 折叠面板', + title_en: 'Collapse', + }, { + path: '/pages/componentsC/popup/index', + icon: 'popup', + title: 'Popup 弹出层', + title_en: 'Popup', + }, { + path: '/pages/componentsA/modal/index', + icon: 'modal', + title: 'Modal 模态框', + title_en: 'Modal', + }, { + path: '/pages/componentsA/fullScreen/index', + icon: 'pressingScreen', + title: 'fullScreen 压窗屏', + title_en: 'fullScreen', + }] + }, { + groupName: '布局组件', + groupName_en: 'Layout components', + list: [{ + path: '/pages/componentsB/line/index', + icon: 'line', + title: 'Line 线条', + title_en: 'Line', + }, { + path: '/pages/componentsB/card/index', + icon: 'card', + title: 'Card 卡片', + title_en: 'Card', + }, { + path: '/pages/componentsC/mask/index', + icon: 'mask', + title: 'Mask 遮罩层', + title_en: 'Mask', + }, + // #ifndef MP-TOUTIAO + { + path: '/pages/componentsA/noNetwork/index', + icon: 'noNetwork', + title: 'NoNetwork 无网络提示', + title_en: 'NoNetwork', + }, + // #endif + { + path: '/pages/componentsC/grid/index', + icon: 'grid', + title: 'Grid 宫格布局', + title_en: 'Grid', + }, { + path: '/pages/componentsB/swiper/index', + icon: 'swiper', + title: 'Swiper 轮播图', + title_en: 'Swiper', + }, { + path: '/pages/componentsA/timeLine/index', + icon: 'timeLine', + title: 'TimeLine 时间轴', + title_en: 'TimeLine', + }, { + path: '/pages/componentsB/skeleton/index', + icon: 'skeleton', + title: 'Skeleton 骨架屏', + title_en: 'Skeleton', + }, { + path: '/pages/componentsB/sticky/index', + icon: 'sticky', + title: 'Sticky 吸顶', + title_en: 'Sticky', + }, + // #ifndef MP-TOUTIAO + { + path: '/pages/componentsB/waterfall/index', + icon: 'waterfall', + title: 'Waterfall 瀑布流', + title_en: 'Waterfall', + }, + // #endif + { + path: '/pages/componentsB/divider/index', + icon: 'divider', + title: 'Divider 分割线', + title_en: 'Divider', + }] + }, { + groupName: '导航组件', + groupName_en: 'Navigation components', + list: [{ + path: '/pages/componentsB/dropdown/index', + icon: 'dropdown', + title: 'Dropdown 下拉菜单', + title_en: 'Dropdown', + },{ + path: '/pages/componentsB/tabbar/index', + icon: 'tabbar', + title: 'Tabbar 底部导航栏', + title_en: 'Tabbar', + },{ + path: '/pages/componentsA/backTop/index', + icon: 'backTop', + title: 'BackTop 返回顶部', + title_en: 'BackTop', + },{ + path: '/pages/componentsA/navbar/index', + icon: 'navbar', + title: 'Navbar 导航栏', + title_en: 'Navbar', + }, { + path: '/pages/componentsA/tabs/index', + icon: 'tabs', + title: 'Tabs 标签', + title_en: 'Tabs', + }, + // #ifndef MP-ALIPAY + { + path: '/pages/template/order/index', + icon: 'tabsSwiper', + title: 'TabsSwiper 全屏选项卡', + title_en: 'TabsSwiper', + }, + // #endif + { + path: '/pages/componentsC/subsection/index', + icon: 'subsection', + title: 'Subsection 分段器', + title_en: 'Subsection', + }, { + path: '/pages/componentsA/indexList/index', + icon: 'indexList', + title: 'IndexList 索引列表', + title_en: 'IndexList', + }, { + path: '/pages/componentsB/steps/index', + icon: 'steps', + title: 'Steps 步骤条', + title_en: 'Steps', + }, { + path: '/pages/componentsA/empty/index', + icon: 'empty', + title: 'Empty 内容为空', + title_en: 'Empty', + }, { + path: '/pages/componentsC/section/index', + icon: 'section', + title: 'Section 查看更多', + title_en: 'Section', + }] + }, { + groupName: '其他组件', + groupName_en: 'Other components', + list: [{ + path: '/pages/componentsA/parse/index', + icon: 'parse', + title: 'Parse 富文本解析器', + title_en: 'Parse', + },{ + path: '/pages/componentsC/messageInput/index', + icon: 'messageInput', + title: 'MessageInput 验证码输入', + title_en: 'MessageInput', + }, { + path: '/pages/componentsA/avatarCropper/index', + icon: 'avatarCropper', + title: 'AvatarCropper 头像裁剪', + title_en: 'AvatarCropper', + }, { + path: '/pages/componentsC/loadmore/index', + icon: 'loadmore', + title: 'Loadmore 加载更多', + title_en: 'Loadmore', + }, { + path: '/pages/componentsB/readMore/index', + icon: 'readMore', + title: 'ReadMore 展开阅读更多', + title_en: 'ReadMore', + }, { + path: '/pages/componentsA/lazyLoad/index', + icon: 'lazyLoad', + title: 'LazyLoad 懒加载', + title_en: 'LazyLoad', + }, { + path: '/pages/componentsC/gap/index', + icon: 'gap', + title: 'Gap 间隔槽', + title_en: 'Gap', + }, { + path: '/pages/componentsA/avatar/index', + icon: 'avatar', + title: 'Avatar 头像', + title_en: 'Avatar', + }, { + path: '/pages/componentsC/link/index', + icon: 'link', + title: 'Link 超链接', + title_en: 'Link', + }, { + path: '/pages/componentsB/loading/index', + icon: 'loading', + title: 'Loading 加载动画', + title_en: 'Loading', + }] + }, +] diff --git a/client_mp/pages/example/components.vue b/client_mp/pages/example/components.vue new file mode 100644 index 0000000..c763ee6 --- /dev/null +++ b/client_mp/pages/example/components.vue @@ -0,0 +1,73 @@ + + + + + + + diff --git a/client_mp/pages/example/js.config.js b/client_mp/pages/example/js.config.js new file mode 100644 index 0000000..7365cab --- /dev/null +++ b/client_mp/pages/example/js.config.js @@ -0,0 +1,120 @@ +export default [ + { + groupName: '网络', + groupName_en: 'Network', + list: [ + { + path: 'http', + icon: 'http', + title: 'Http 请求', + title_en: 'Http', + } + ] + }, + { + groupName: '全局变量', + groupName_en: 'Global variable', + list: [ + { + path: 'globalVariable', + icon: 'globalVariable', + title: 'GlobalVariable 全局变量', + title_en: 'GlobalVariable', + } + ] + }, + { + groupName: '工具库', + groupName_en: 'Tool library', + list: [ + { + path: 'debounce', + icon: 'debounce', + title: 'Throttle | Debounce 节流防抖', + title_en: 'Throttle | Debounce', + }, + { + path: 'deepMerge', + icon: 'deepMerge', + title: 'DeepMerge 对象深度合并', + title_en: 'DeepMerge', + },{ + path: 'deepClone', + icon: 'deepClone', + title: 'DeepClone 对象深度克隆', + title_en: 'DeepClone', + }, + { + path: 'timeFormat', + icon: 'timeFormat', + title: 'TimeFormat 时间格式化', + title_en: 'TimeFormat', + },{ + path: 'timeFrom', + icon: 'timeFrom', + title: 'TimeFrom 多久之前', + title_en: 'TimeFrom', + },{ + path: 'guid', + icon: 'guid', + title: 'Guid 全局唯一id', + title_en: 'Guid', + },{ + path: 'route', + icon: 'route', + title: 'Route 路由跳转', + title_en: 'Route', + },{ + path: 'randomArray', + icon: 'randomArray', + title: 'RandomArray 数组乱序', + title_en: 'RandomArray', + },{ + path: 'colorSwitch', + icon: 'colorSwitch', + title: 'ColorSwitch 颜色转换', + title_en: 'ColorSwitch', + },{ + path: 'color', + icon: 'color', + title: 'Color 颜色值', + title_en: 'Color', + },{ + path: 'queryParams', + icon: 'queryParams', + title: 'QueryParams 对象转URL参数', + title_en: 'QueryParams', + },{ + path: 'test', + icon: 'test', + title: 'Test 规则校验', + title_en: 'Test', + },{ + path: 'md5', + icon: 'md5', + title: 'Md5 md5加密', + title_en: 'Md5', + },{ + path: 'random', + icon: 'random', + title: 'Random 随机数值', + title_en: 'Random', + },{ + path: 'trim', + icon: 'trim', + title: 'Trim 去除空格', + title_en: 'Trim', + },{ + path: 'getRect', + icon: 'getRect', + title: 'GetRect 节点信息', + title_en: 'GetRect', + },{ + path: 'mpShare', + icon: 'mpShare', + title: 'MpShare 小程序分享', + title_en: 'MpShare', + } + ] + } +] \ No newline at end of file diff --git a/client_mp/pages/example/js.vue b/client_mp/pages/example/js.vue new file mode 100644 index 0000000..e9848b8 --- /dev/null +++ b/client_mp/pages/example/js.vue @@ -0,0 +1,69 @@ + + + + + + + diff --git a/client_mp/pages/example/template.config.js b/client_mp/pages/example/template.config.js new file mode 100644 index 0000000..9a4bdc1 --- /dev/null +++ b/client_mp/pages/example/template.config.js @@ -0,0 +1,78 @@ +export default [ + { + groupName: '部件', + groupName_en: 'Parts', + list: [ + { + path: 'coupon', + icon: 'coupon', + title: 'Coupon 优惠券', + title_en: 'Coupon', + } + ] + }, + { + groupName: '页面', + groupName_en: 'Page', + list: [ + { + path: '/pages/template/wxCenter/index', + icon: 'wxCenter', + title: 'WxCenter 仿微信个人中心', + title_en: 'WxCenter', + }, + // { + // path: '/pages/template/douyin/index', + // icon: 'douyin', + // title: 'Douyin 仿抖音', + // }, + { + path: '/pages/template/keyboardPay/index', + icon: 'keyboardPay', + title: 'KeyboardPay 自定义键盘支付模板', + title_en: 'KeyboardPay', + }, + { + path: '/pages/template/mallMenu/index1', + icon: 'mall_menu_1', + title: 'MallMenu 垂直分类(左右独立)', + title_en: 'MallMenu 1', + },{ + path: '/pages/template/mallMenu/index2', + icon: 'mall_menu_2', + title: 'MallMenu 垂直分类(左右联动)', + title_en: 'MallMenu 2', + },{ + path: 'submitBar', + icon: 'submitBar', + title: 'SubmitBar 提交订单栏', + title_en: 'SubmitBar', + },{ + path: 'comment', + icon: 'comment', + title: 'Comment 评论列表', + title_en: 'Comment', + },{ + path: 'order', + icon: 'order', + title: 'Order 订单列表', + title_en: 'Order', + },{ + path: 'login', + icon: 'login', + title: 'Login 登录界面', + title_en: 'Login', + },{ + path: 'address', + icon: 'address', + title: 'Address 收货地址', + title_en: 'Address', + },{ + path: 'citySelect', + icon: 'citySelect', + title: 'CitySelect 城市选择', + title_en: 'CitySelect', + } + ] + } +] \ No newline at end of file diff --git a/client_mp/pages/example/template.vue b/client_mp/pages/example/template.vue new file mode 100644 index 0000000..8fb9ef9 --- /dev/null +++ b/client_mp/pages/example/template.vue @@ -0,0 +1,69 @@ + + + + + + + diff --git a/client_mp/pages/home/home.vue b/client_mp/pages/home/home.vue new file mode 100644 index 0000000..abf0ce3 --- /dev/null +++ b/client_mp/pages/home/home.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/client_mp/pages/library/color/index.vue b/client_mp/pages/library/color/index.vue new file mode 100644 index 0000000..d9faab5 --- /dev/null +++ b/client_mp/pages/library/color/index.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/client_mp/pages/library/colorSwitch/index.vue b/client_mp/pages/library/colorSwitch/index.vue new file mode 100644 index 0000000..3ba04f6 --- /dev/null +++ b/client_mp/pages/library/colorSwitch/index.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/client_mp/pages/library/debounce/index.vue b/client_mp/pages/library/debounce/index.vue new file mode 100644 index 0000000..dbbe447 --- /dev/null +++ b/client_mp/pages/library/debounce/index.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/client_mp/pages/library/deepClone/index.vue b/client_mp/pages/library/deepClone/index.vue new file mode 100644 index 0000000..1d639d2 --- /dev/null +++ b/client_mp/pages/library/deepClone/index.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/client_mp/pages/library/deepMerge/index.vue b/client_mp/pages/library/deepMerge/index.vue new file mode 100644 index 0000000..c967694 --- /dev/null +++ b/client_mp/pages/library/deepMerge/index.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/client_mp/pages/library/getRect/index.vue b/client_mp/pages/library/getRect/index.vue new file mode 100644 index 0000000..91d5687 --- /dev/null +++ b/client_mp/pages/library/getRect/index.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/client_mp/pages/library/globalVariable/globalData.vue b/client_mp/pages/library/globalVariable/globalData.vue new file mode 100644 index 0000000..8f38d6f --- /dev/null +++ b/client_mp/pages/library/globalVariable/globalData.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/client_mp/pages/library/globalVariable/index.vue b/client_mp/pages/library/globalVariable/index.vue new file mode 100644 index 0000000..f9ab949 --- /dev/null +++ b/client_mp/pages/library/globalVariable/index.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/client_mp/pages/library/globalVariable/prototype.vue b/client_mp/pages/library/globalVariable/prototype.vue new file mode 100644 index 0000000..27d3248 --- /dev/null +++ b/client_mp/pages/library/globalVariable/prototype.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/client_mp/pages/library/globalVariable/vuex.vue b/client_mp/pages/library/globalVariable/vuex.vue new file mode 100644 index 0000000..e5c04e9 --- /dev/null +++ b/client_mp/pages/library/globalVariable/vuex.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/client_mp/pages/library/guid/index.vue b/client_mp/pages/library/guid/index.vue new file mode 100644 index 0000000..5c536dd --- /dev/null +++ b/client_mp/pages/library/guid/index.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/client_mp/pages/library/http/index.vue b/client_mp/pages/library/http/index.vue new file mode 100644 index 0000000..fac0708 --- /dev/null +++ b/client_mp/pages/library/http/index.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/client_mp/pages/library/md5/index.vue b/client_mp/pages/library/md5/index.vue new file mode 100644 index 0000000..07a9401 --- /dev/null +++ b/client_mp/pages/library/md5/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/client_mp/pages/library/mpShare/index.vue b/client_mp/pages/library/mpShare/index.vue new file mode 100644 index 0000000..9ad826d --- /dev/null +++ b/client_mp/pages/library/mpShare/index.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/client_mp/pages/library/queryParams/index.vue b/client_mp/pages/library/queryParams/index.vue new file mode 100644 index 0000000..f9acff0 --- /dev/null +++ b/client_mp/pages/library/queryParams/index.vue @@ -0,0 +1,53 @@ + + + + + diff --git a/client_mp/pages/library/random/index.vue b/client_mp/pages/library/random/index.vue new file mode 100644 index 0000000..edd4278 --- /dev/null +++ b/client_mp/pages/library/random/index.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/client_mp/pages/library/randomArray/index.vue b/client_mp/pages/library/randomArray/index.vue new file mode 100644 index 0000000..f1c953d --- /dev/null +++ b/client_mp/pages/library/randomArray/index.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/client_mp/pages/library/route/index.vue b/client_mp/pages/library/route/index.vue new file mode 100644 index 0000000..8cb2d83 --- /dev/null +++ b/client_mp/pages/library/route/index.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/client_mp/pages/library/route/routeTo.vue b/client_mp/pages/library/route/routeTo.vue new file mode 100644 index 0000000..acccaf3 --- /dev/null +++ b/client_mp/pages/library/route/routeTo.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/client_mp/pages/library/test/index.vue b/client_mp/pages/library/test/index.vue new file mode 100644 index 0000000..b0e5f41 --- /dev/null +++ b/client_mp/pages/library/test/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/client_mp/pages/library/timeFormat/index.vue b/client_mp/pages/library/timeFormat/index.vue new file mode 100644 index 0000000..0160911 --- /dev/null +++ b/client_mp/pages/library/timeFormat/index.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/client_mp/pages/library/timeFrom/index.vue b/client_mp/pages/library/timeFrom/index.vue new file mode 100644 index 0000000..e804c19 --- /dev/null +++ b/client_mp/pages/library/timeFrom/index.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/client_mp/pages/library/trim/index.vue b/client_mp/pages/library/trim/index.vue new file mode 100644 index 0000000..5096b8c --- /dev/null +++ b/client_mp/pages/library/trim/index.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/client_mp/pages/login/code.vue b/client_mp/pages/login/code.vue new file mode 100644 index 0000000..d8a81f4 --- /dev/null +++ b/client_mp/pages/login/code.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/client_mp/pages/login/login.vue b/client_mp/pages/login/login.vue new file mode 100644 index 0000000..d73cfea --- /dev/null +++ b/client_mp/pages/login/login.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/client_mp/pages/my/my.vue b/client_mp/pages/my/my.vue new file mode 100644 index 0000000..060abe3 --- /dev/null +++ b/client_mp/pages/my/my.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/client_mp/pages/template/address/addSite.vue b/client_mp/pages/template/address/addSite.vue new file mode 100644 index 0000000..c31340e --- /dev/null +++ b/client_mp/pages/template/address/addSite.vue @@ -0,0 +1,173 @@ +