Commit 2d21111e423ee0a1146989c618e39f6781224fef
1 parent
1cae26c6
项目初始化
Showing
136 changed files
with
12573 additions
and
0 deletions
.editorconfig
0 → 100644
.env.development
0 → 100644
.env.production
0 → 100644
.env.staging
0 → 100644
.eslintignore
0 → 100644
.eslintrc.js
0 → 100644
| 1 | +module.exports = { | |
| 2 | + root: true, | |
| 3 | + parserOptions: { | |
| 4 | + parser: 'babel-eslint', | |
| 5 | + sourceType: 'module' | |
| 6 | + }, | |
| 7 | + env: { | |
| 8 | + browser: true, | |
| 9 | + node: true, | |
| 10 | + es6: true, | |
| 11 | + }, | |
| 12 | + extends: ['plugin:vue/recommended', 'eslint:recommended'], | |
| 13 | + | |
| 14 | + // add your custom rules here | |
| 15 | + //it is base on https://github.com/vuejs/eslint-config-vue | |
| 16 | + rules: { | |
| 17 | + "vue/max-attributes-per-line": [2, { | |
| 18 | + "singleline": 10, | |
| 19 | + "multiline": { | |
| 20 | + "max": 1, | |
| 21 | + "allowFirstLine": false | |
| 22 | + } | |
| 23 | + }], | |
| 24 | + "vue/singleline-html-element-content-newline": "off", | |
| 25 | + "vue/multiline-html-element-content-newline":"off", | |
| 26 | + "vue/name-property-casing": ["error", "PascalCase"], | |
| 27 | + "vue/no-v-html": "off", | |
| 28 | + 'accessor-pairs': 2, | |
| 29 | + 'arrow-spacing': [2, { | |
| 30 | + 'before': true, | |
| 31 | + 'after': true | |
| 32 | + }], | |
| 33 | + 'block-spacing': [2, 'always'], | |
| 34 | + 'brace-style': [2, '1tbs', { | |
| 35 | + 'allowSingleLine': true | |
| 36 | + }], | |
| 37 | + 'camelcase': [0, { | |
| 38 | + 'properties': 'always' | |
| 39 | + }], | |
| 40 | + 'comma-dangle': [2, 'never'], | |
| 41 | + 'comma-spacing': [2, { | |
| 42 | + 'before': false, | |
| 43 | + 'after': true | |
| 44 | + }], | |
| 45 | + 'comma-style': [2, 'last'], | |
| 46 | + 'constructor-super': 2, | |
| 47 | + 'curly': [2, 'multi-line'], | |
| 48 | + 'dot-location': [2, 'property'], | |
| 49 | + 'eol-last': 2, | |
| 50 | + 'eqeqeq': ["error", "always", {"null": "ignore"}], | |
| 51 | + 'generator-star-spacing': [2, { | |
| 52 | + 'before': true, | |
| 53 | + 'after': true | |
| 54 | + }], | |
| 55 | + 'handle-callback-err': [2, '^(err|error)$'], | |
| 56 | + 'indent': [2, 2, { | |
| 57 | + 'SwitchCase': 1 | |
| 58 | + }], | |
| 59 | + 'jsx-quotes': [2, 'prefer-single'], | |
| 60 | + 'key-spacing': [2, { | |
| 61 | + 'beforeColon': false, | |
| 62 | + 'afterColon': true | |
| 63 | + }], | |
| 64 | + 'keyword-spacing': [2, { | |
| 65 | + 'before': true, | |
| 66 | + 'after': true | |
| 67 | + }], | |
| 68 | + 'new-cap': [2, { | |
| 69 | + 'newIsCap': true, | |
| 70 | + 'capIsNew': false | |
| 71 | + }], | |
| 72 | + 'new-parens': 2, | |
| 73 | + 'no-array-constructor': 2, | |
| 74 | + 'no-caller': 2, | |
| 75 | + 'no-console': 'off', | |
| 76 | + 'no-class-assign': 2, | |
| 77 | + 'no-cond-assign': 2, | |
| 78 | + 'no-const-assign': 2, | |
| 79 | + 'no-control-regex': 0, | |
| 80 | + 'no-delete-var': 2, | |
| 81 | + 'no-dupe-args': 2, | |
| 82 | + 'no-dupe-class-members': 2, | |
| 83 | + 'no-dupe-keys': 2, | |
| 84 | + 'no-duplicate-case': 2, | |
| 85 | + 'no-empty-character-class': 2, | |
| 86 | + 'no-empty-pattern': 2, | |
| 87 | + 'no-eval': 2, | |
| 88 | + 'no-ex-assign': 2, | |
| 89 | + 'no-extend-native': 2, | |
| 90 | + 'no-extra-bind': 2, | |
| 91 | + 'no-extra-boolean-cast': 2, | |
| 92 | + 'no-extra-parens': [2, 'functions'], | |
| 93 | + 'no-fallthrough': 2, | |
| 94 | + 'no-floating-decimal': 2, | |
| 95 | + 'no-func-assign': 2, | |
| 96 | + 'no-implied-eval': 2, | |
| 97 | + 'no-inner-declarations': [2, 'functions'], | |
| 98 | + 'no-invalid-regexp': 2, | |
| 99 | + 'no-irregular-whitespace': 2, | |
| 100 | + 'no-iterator': 2, | |
| 101 | + 'no-label-var': 2, | |
| 102 | + 'no-labels': [2, { | |
| 103 | + 'allowLoop': false, | |
| 104 | + 'allowSwitch': false | |
| 105 | + }], | |
| 106 | + 'no-lone-blocks': 2, | |
| 107 | + 'no-mixed-spaces-and-tabs': 2, | |
| 108 | + 'no-multi-spaces': 2, | |
| 109 | + 'no-multi-str': 2, | |
| 110 | + 'no-multiple-empty-lines': [2, { | |
| 111 | + 'max': 1 | |
| 112 | + }], | |
| 113 | + 'no-native-reassign': 2, | |
| 114 | + 'no-negated-in-lhs': 2, | |
| 115 | + 'no-new-object': 2, | |
| 116 | + 'no-new-require': 2, | |
| 117 | + 'no-new-symbol': 2, | |
| 118 | + 'no-new-wrappers': 2, | |
| 119 | + 'no-obj-calls': 2, | |
| 120 | + 'no-octal': 2, | |
| 121 | + 'no-octal-escape': 2, | |
| 122 | + 'no-path-concat': 2, | |
| 123 | + 'no-proto': 2, | |
| 124 | + 'no-redeclare': 2, | |
| 125 | + 'no-regex-spaces': 2, | |
| 126 | + 'no-return-assign': [2, 'except-parens'], | |
| 127 | + 'no-self-assign': 2, | |
| 128 | + 'no-self-compare': 2, | |
| 129 | + 'no-sequences': 2, | |
| 130 | + 'no-shadow-restricted-names': 2, | |
| 131 | + 'no-spaced-func': 2, | |
| 132 | + 'no-sparse-arrays': 2, | |
| 133 | + 'no-this-before-super': 2, | |
| 134 | + 'no-throw-literal': 2, | |
| 135 | + 'no-trailing-spaces': 2, | |
| 136 | + 'no-undef': 2, | |
| 137 | + 'no-undef-init': 2, | |
| 138 | + 'no-unexpected-multiline': 2, | |
| 139 | + 'no-unmodified-loop-condition': 2, | |
| 140 | + 'no-unneeded-ternary': [2, { | |
| 141 | + 'defaultAssignment': false | |
| 142 | + }], | |
| 143 | + 'no-unreachable': 2, | |
| 144 | + 'no-unsafe-finally': 2, | |
| 145 | + 'no-unused-vars': [2, { | |
| 146 | + 'vars': 'all', | |
| 147 | + 'args': 'none' | |
| 148 | + }], | |
| 149 | + 'no-useless-call': 2, | |
| 150 | + 'no-useless-computed-key': 2, | |
| 151 | + 'no-useless-constructor': 2, | |
| 152 | + 'no-useless-escape': 0, | |
| 153 | + 'no-whitespace-before-property': 2, | |
| 154 | + 'no-with': 2, | |
| 155 | + 'one-var': [2, { | |
| 156 | + 'initialized': 'never' | |
| 157 | + }], | |
| 158 | + 'operator-linebreak': [2, 'after', { | |
| 159 | + 'overrides': { | |
| 160 | + '?': 'before', | |
| 161 | + ':': 'before' | |
| 162 | + } | |
| 163 | + }], | |
| 164 | + 'padded-blocks': [2, 'never'], | |
| 165 | + 'quotes': [2, 'single', { | |
| 166 | + 'avoidEscape': true, | |
| 167 | + 'allowTemplateLiterals': true | |
| 168 | + }], | |
| 169 | + 'semi': [2, 'never'], | |
| 170 | + 'semi-spacing': [2, { | |
| 171 | + 'before': false, | |
| 172 | + 'after': true | |
| 173 | + }], | |
| 174 | + 'space-before-blocks': [2, 'always'], | |
| 175 | + 'space-before-function-paren': [2, 'never'], | |
| 176 | + 'space-in-parens': [2, 'never'], | |
| 177 | + 'space-infix-ops': 2, | |
| 178 | + 'space-unary-ops': [2, { | |
| 179 | + 'words': true, | |
| 180 | + 'nonwords': false | |
| 181 | + }], | |
| 182 | + 'spaced-comment': [2, 'always', { | |
| 183 | + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] | |
| 184 | + }], | |
| 185 | + 'template-curly-spacing': [2, 'never'], | |
| 186 | + 'use-isnan': 2, | |
| 187 | + 'valid-typeof': 2, | |
| 188 | + 'wrap-iife': [2, 'any'], | |
| 189 | + 'yield-star-spacing': [2, 'both'], | |
| 190 | + 'yoda': [2, 'never'], | |
| 191 | + 'prefer-const': 2, | |
| 192 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | |
| 193 | + 'object-curly-spacing': [2, 'always', { | |
| 194 | + objectsInObjects: false | |
| 195 | + }], | |
| 196 | + 'array-bracket-spacing': [2, 'never'] | |
| 197 | + } | |
| 198 | +} | ... | ... |
.travis.yml
0 → 100644
LICENSE
0 → 100644
| 1 | +MIT License | |
| 2 | + | |
| 3 | +Copyright (c) 2017-present PanJiaChen | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in all | |
| 13 | +copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | +SOFTWARE. | ... | ... |
README-zh.md
0 → 100644
| 1 | +# vue-admin-template | |
| 2 | + | |
| 3 | +> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。 | |
| 4 | + | |
| 5 | +[线上地址](http://panjiachen.github.io/vue-admin-template) | |
| 6 | + | |
| 7 | +[国内访问](https://panjiachen.gitee.io/vue-admin-template) | |
| 8 | + | |
| 9 | +目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。 | |
| 10 | + | |
| 11 | +## Extra | |
| 12 | + | |
| 13 | +如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) | |
| 14 | + | |
| 15 | +## 相关项目 | |
| 16 | + | |
| 17 | +- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) | |
| 18 | + | |
| 19 | +- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) | |
| 20 | + | |
| 21 | +- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) | |
| 22 | + | |
| 23 | +- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) | |
| 24 | + | |
| 25 | +写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目: | |
| 26 | + | |
| 27 | +- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2) | |
| 28 | +- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac) | |
| 29 | +- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35) | |
| 30 | +- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56) | |
| 31 | +- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836) | |
| 32 | + | |
| 33 | +## Build Setup | |
| 34 | + | |
| 35 | +```bash | |
| 36 | +# 克隆项目 | |
| 37 | +git clone https://github.com/PanJiaChen/vue-admin-template.git | |
| 38 | + | |
| 39 | +# 进入项目目录 | |
| 40 | +cd vue-admin-template | |
| 41 | + | |
| 42 | +# 安装依赖 | |
| 43 | +npm install | |
| 44 | + | |
| 45 | +# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 | |
| 46 | +npm install --registry=https://registry.npm.taobao.org | |
| 47 | + | |
| 48 | +# 启动服务 | |
| 49 | +npm run dev | |
| 50 | +``` | |
| 51 | + | |
| 52 | +浏览器访问 [http://localhost:9528](http://localhost:9528) | |
| 53 | + | |
| 54 | +## 发布 | |
| 55 | + | |
| 56 | +```bash | |
| 57 | +# 构建测试环境 | |
| 58 | +npm run build:stage | |
| 59 | + | |
| 60 | +# 构建生产环境 | |
| 61 | +npm run build:prod | |
| 62 | +``` | |
| 63 | + | |
| 64 | +## 其它 | |
| 65 | + | |
| 66 | +```bash | |
| 67 | +# 预览发布环境效果 | |
| 68 | +npm run preview | |
| 69 | + | |
| 70 | +# 预览发布环境效果 + 静态资源分析 | |
| 71 | +npm run preview -- --report | |
| 72 | + | |
| 73 | +# 代码格式检查 | |
| 74 | +npm run lint | |
| 75 | + | |
| 76 | +# 代码格式检查并自动修复 | |
| 77 | +npm run lint -- --fix | |
| 78 | +``` | |
| 79 | + | |
| 80 | +更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/) | |
| 81 | + | |
| 82 | +## 购买贴纸 | |
| 83 | + | |
| 84 | +你也可以通过 购买[官方授权的贴纸](https://smallsticker.com/product/vue-element-admin) 的方式来支持 vue-element-admin - 每售出一张贴纸,我们将获得 2 元的捐赠。 | |
| 85 | + | |
| 86 | +## Demo | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | +## Browsers support | |
| 91 | + | |
| 92 | +Modern browsers and Internet Explorer 10+. | |
| 93 | + | |
| 94 | +| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | | |
| 95 | +| --------- | --------- | --------- | --------- | | |
| 96 | +| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions | |
| 97 | + | |
| 98 | +## License | |
| 99 | + | |
| 100 | +[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. | |
| 101 | + | |
| 102 | +Copyright (c) 2017-present PanJiaChen | ... | ... |
README.md
0 → 100644
| 1 | +# vue-admin-template | |
| 2 | + | |
| 3 | +English | [简体中文](./README-zh.md) | |
| 4 | + | |
| 5 | +> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint | |
| 6 | + | |
| 7 | +**Live demo:** http://panjiachen.github.io/vue-admin-template | |
| 8 | + | |
| 9 | + | |
| 10 | +**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`** | |
| 11 | + | |
| 12 | +## Build Setup | |
| 13 | + | |
| 14 | +```bash | |
| 15 | +# clone the project | |
| 16 | +git clone https://github.com/PanJiaChen/vue-admin-template.git | |
| 17 | + | |
| 18 | +# enter the project directory | |
| 19 | +cd vue-admin-template | |
| 20 | + | |
| 21 | +# install dependency | |
| 22 | +npm install | |
| 23 | + | |
| 24 | +# develop | |
| 25 | +npm run dev | |
| 26 | +``` | |
| 27 | + | |
| 28 | +This will automatically open http://localhost:9528 | |
| 29 | + | |
| 30 | +## Build | |
| 31 | + | |
| 32 | +```bash | |
| 33 | +# build for test environment | |
| 34 | +npm run build:stage | |
| 35 | + | |
| 36 | +# build for production environment | |
| 37 | +npm run build:prod | |
| 38 | +``` | |
| 39 | + | |
| 40 | +## Advanced | |
| 41 | + | |
| 42 | +```bash | |
| 43 | +# preview the release environment effect | |
| 44 | +npm run preview | |
| 45 | + | |
| 46 | +# preview the release environment effect + static resource analysis | |
| 47 | +npm run preview -- --report | |
| 48 | + | |
| 49 | +# code format check | |
| 50 | +npm run lint | |
| 51 | + | |
| 52 | +# code format check and auto fix | |
| 53 | +npm run lint -- --fix | |
| 54 | +``` | |
| 55 | + | |
| 56 | +Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information | |
| 57 | + | |
| 58 | +## Demo | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | +## Extra | |
| 63 | + | |
| 64 | +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) | |
| 65 | + | |
| 66 | +For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour)) | |
| 67 | + | |
| 68 | +## Related Project | |
| 69 | + | |
| 70 | +- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) | |
| 71 | + | |
| 72 | +- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) | |
| 73 | + | |
| 74 | +- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) | |
| 75 | + | |
| 76 | +- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) | |
| 77 | + | |
| 78 | +## Browsers support | |
| 79 | + | |
| 80 | +Modern browsers and Internet Explorer 10+. | |
| 81 | + | |
| 82 | +| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | | |
| 83 | +| --------- | --------- | --------- | --------- | | |
| 84 | +| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions | |
| 85 | + | |
| 86 | +## License | |
| 87 | + | |
| 88 | +[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. | |
| 89 | + | |
| 90 | +Copyright (c) 2017-present PanJiaChen | ... | ... |
babel.config.js
0 → 100644
| 1 | +module.exports = { | |
| 2 | + presets: [ | |
| 3 | + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app | |
| 4 | + '@vue/cli-plugin-babel/preset' | |
| 5 | + ], | |
| 6 | + 'env': { | |
| 7 | + 'development': { | |
| 8 | + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). | |
| 9 | + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. | |
| 10 | + // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html | |
| 11 | + 'plugins': ['dynamic-import-node'] | |
| 12 | + } | |
| 13 | + } | |
| 14 | +} | ... | ... |
dist.zip
0 → 100644
No preview for this file type
jest.config.js
0 → 100644
| 1 | +module.exports = { | |
| 2 | + moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], | |
| 3 | + transform: { | |
| 4 | + '^.+\\.vue$': 'vue-jest', | |
| 5 | + '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': | |
| 6 | + 'jest-transform-stub', | |
| 7 | + '^.+\\.jsx?$': 'babel-jest' | |
| 8 | + }, | |
| 9 | + moduleNameMapper: { | |
| 10 | + '^@/(.*)$': '<rootDir>/src/$1' | |
| 11 | + }, | |
| 12 | + snapshotSerializers: ['jest-serializer-vue'], | |
| 13 | + testMatch: [ | |
| 14 | + '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' | |
| 15 | + ], | |
| 16 | + collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], | |
| 17 | + coverageDirectory: '<rootDir>/tests/unit/coverage', | |
| 18 | + // 'collectCoverage': true, | |
| 19 | + 'coverageReporters': [ | |
| 20 | + 'lcov', | |
| 21 | + 'text-summary' | |
| 22 | + ], | |
| 23 | + testURL: 'http://localhost/' | |
| 24 | +} | ... | ... |
jsconfig.json
0 → 100644
mock/index.js
0 → 100644
| 1 | +const Mock = require('mockjs') | |
| 2 | +const { param2Obj } = require('./utils') | |
| 3 | + | |
| 4 | +const user = require('./user') | |
| 5 | +const table = require('./table') | |
| 6 | + | |
| 7 | +const mocks = [ | |
| 8 | + ...user, | |
| 9 | + ...table | |
| 10 | +] | |
| 11 | + | |
| 12 | +// for front mock | |
| 13 | +// please use it cautiously, it will redefine XMLHttpRequest, | |
| 14 | +// which will cause many of your third-party libraries to be invalidated(like progress event). | |
| 15 | +function mockXHR() { | |
| 16 | + // mock patch | |
| 17 | + // https://github.com/nuysoft/Mock/issues/300 | |
| 18 | + Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send | |
| 19 | + Mock.XHR.prototype.send = function() { | |
| 20 | + if (this.custom.xhr) { | |
| 21 | + this.custom.xhr.withCredentials = this.withCredentials || false | |
| 22 | + | |
| 23 | + if (this.responseType) { | |
| 24 | + this.custom.xhr.responseType = this.responseType | |
| 25 | + } | |
| 26 | + } | |
| 27 | + this.proxy_send(...arguments) | |
| 28 | + } | |
| 29 | + | |
| 30 | + function XHR2ExpressReqWrap(respond) { | |
| 31 | + return function(options) { | |
| 32 | + let result = null | |
| 33 | + if (respond instanceof Function) { | |
| 34 | + const { body, type, url } = options | |
| 35 | + // https://expressjs.com/en/4x/api.html#req | |
| 36 | + result = respond({ | |
| 37 | + method: type, | |
| 38 | + body: JSON.parse(body), | |
| 39 | + query: param2Obj(url) | |
| 40 | + }) | |
| 41 | + } else { | |
| 42 | + result = respond | |
| 43 | + } | |
| 44 | + return Mock.mock(result) | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + for (const i of mocks) { | |
| 49 | + Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response)) | |
| 50 | + } | |
| 51 | +} | |
| 52 | + | |
| 53 | +module.exports = { | |
| 54 | + mocks, | |
| 55 | + mockXHR | |
| 56 | +} | |
| 57 | + | ... | ... |
mock/mock-server.js
0 → 100644
| 1 | +const chokidar = require('chokidar') | |
| 2 | +const bodyParser = require('body-parser') | |
| 3 | +const chalk = require('chalk') | |
| 4 | +const path = require('path') | |
| 5 | +const Mock = require('mockjs') | |
| 6 | + | |
| 7 | +const mockDir = path.join(process.cwd(), 'mock') | |
| 8 | + | |
| 9 | +function registerRoutes(app) { | |
| 10 | + let mockLastIndex | |
| 11 | + const { mocks } = require('./index.js') | |
| 12 | + const mocksForServer = mocks.map(route => { | |
| 13 | + return responseFake(route.url, route.type, route.response) | |
| 14 | + }) | |
| 15 | + for (const mock of mocksForServer) { | |
| 16 | + app[mock.type](mock.url, mock.response) | |
| 17 | + mockLastIndex = app._router.stack.length | |
| 18 | + } | |
| 19 | + const mockRoutesLength = Object.keys(mocksForServer).length | |
| 20 | + return { | |
| 21 | + mockRoutesLength: mockRoutesLength, | |
| 22 | + mockStartIndex: mockLastIndex - mockRoutesLength | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | +function unregisterRoutes() { | |
| 27 | + Object.keys(require.cache).forEach(i => { | |
| 28 | + if (i.includes(mockDir)) { | |
| 29 | + delete require.cache[require.resolve(i)] | |
| 30 | + } | |
| 31 | + }) | |
| 32 | +} | |
| 33 | + | |
| 34 | +// for mock server | |
| 35 | +const responseFake = (url, type, respond) => { | |
| 36 | + return { | |
| 37 | + url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`), | |
| 38 | + type: type || 'get', | |
| 39 | + response(req, res) { | |
| 40 | + console.log('request invoke:' + req.path) | |
| 41 | + res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond)) | |
| 42 | + } | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +module.exports = app => { | |
| 47 | + // parse app.body | |
| 48 | + // https://expressjs.com/en/4x/api.html#req.body | |
| 49 | + app.use(bodyParser.json()) | |
| 50 | + app.use(bodyParser.urlencoded({ | |
| 51 | + extended: true | |
| 52 | + })) | |
| 53 | + | |
| 54 | + const mockRoutes = registerRoutes(app) | |
| 55 | + var mockRoutesLength = mockRoutes.mockRoutesLength | |
| 56 | + var mockStartIndex = mockRoutes.mockStartIndex | |
| 57 | + | |
| 58 | + // watch files, hot reload mock server | |
| 59 | + chokidar.watch(mockDir, { | |
| 60 | + ignored: /mock-server/, | |
| 61 | + ignoreInitial: true | |
| 62 | + }).on('all', (event, path) => { | |
| 63 | + if (event === 'change' || event === 'add') { | |
| 64 | + try { | |
| 65 | + // remove mock routes stack | |
| 66 | + app._router.stack.splice(mockStartIndex, mockRoutesLength) | |
| 67 | + | |
| 68 | + // clear routes cache | |
| 69 | + unregisterRoutes() | |
| 70 | + | |
| 71 | + const mockRoutes = registerRoutes(app) | |
| 72 | + mockRoutesLength = mockRoutes.mockRoutesLength | |
| 73 | + mockStartIndex = mockRoutes.mockStartIndex | |
| 74 | + | |
| 75 | + console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`)) | |
| 76 | + } catch (error) { | |
| 77 | + console.log(chalk.redBright(error)) | |
| 78 | + } | |
| 79 | + } | |
| 80 | + }) | |
| 81 | +} | ... | ... |
mock/table.js
0 → 100644
| 1 | +const Mock = require('mockjs') | |
| 2 | + | |
| 3 | +const data = Mock.mock({ | |
| 4 | + 'items|30': [{ | |
| 5 | + id: '@id', | |
| 6 | + title: '@sentence(10, 20)', | |
| 7 | + 'status|1': ['published', 'draft', 'deleted'], | |
| 8 | + author: 'name', | |
| 9 | + display_time: '@datetime', | |
| 10 | + pageviews: '@integer(300, 5000)' | |
| 11 | + }] | |
| 12 | +}) | |
| 13 | + | |
| 14 | +module.exports = [ | |
| 15 | + { | |
| 16 | + url: '/vue-admin-template/table/list', | |
| 17 | + type: 'get', | |
| 18 | + response: config => { | |
| 19 | + const items = data.items | |
| 20 | + return { | |
| 21 | + code: 20000, | |
| 22 | + data: { | |
| 23 | + total: items.length, | |
| 24 | + items: items | |
| 25 | + } | |
| 26 | + } | |
| 27 | + } | |
| 28 | + } | |
| 29 | +] | ... | ... |
mock/user.js
0 → 100644
| 1 | + | |
| 2 | +const tokens = { | |
| 3 | + admin: { | |
| 4 | + token: 'admin-token' | |
| 5 | + }, | |
| 6 | + editor: { | |
| 7 | + token: 'editor-token' | |
| 8 | + } | |
| 9 | +} | |
| 10 | + | |
| 11 | +const users = { | |
| 12 | + 'admin-token': { | |
| 13 | + roles: ['admin'], | |
| 14 | + introduction: 'I am a super administrator', | |
| 15 | + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', | |
| 16 | + name: 'Super Admin' | |
| 17 | + }, | |
| 18 | + 'editor-token': { | |
| 19 | + roles: ['editor'], | |
| 20 | + introduction: 'I am an editor', | |
| 21 | + avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', | |
| 22 | + name: 'Normal Editor' | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | +module.exports = [ | |
| 27 | + // user login | |
| 28 | + { | |
| 29 | + url: '/vue-admin-template/user/login', | |
| 30 | + type: 'post', | |
| 31 | + response: config => { | |
| 32 | + const { username } = config.body | |
| 33 | + const token = tokens[username] | |
| 34 | + | |
| 35 | + // mock error | |
| 36 | + if (!token) { | |
| 37 | + return { | |
| 38 | + code: 60204, | |
| 39 | + message: 'Account and password are incorrect.' | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + return { | |
| 44 | + code: 20000, | |
| 45 | + data: token | |
| 46 | + } | |
| 47 | + } | |
| 48 | + }, | |
| 49 | + | |
| 50 | + // get user info | |
| 51 | + { | |
| 52 | + url: '/vue-admin-template/user/info\.*', | |
| 53 | + type: 'get', | |
| 54 | + response: config => { | |
| 55 | + const { token } = config.query | |
| 56 | + const info = users[token] | |
| 57 | + | |
| 58 | + // mock error | |
| 59 | + if (!info) { | |
| 60 | + return { | |
| 61 | + code: 50008, | |
| 62 | + message: 'Login failed, unable to get user details.' | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + return { | |
| 67 | + code: 20000, | |
| 68 | + data: info | |
| 69 | + } | |
| 70 | + } | |
| 71 | + }, | |
| 72 | + | |
| 73 | + // user logout | |
| 74 | + { | |
| 75 | + url: '/vue-admin-template/user/logout', | |
| 76 | + type: 'post', | |
| 77 | + response: _ => { | |
| 78 | + return { | |
| 79 | + code: 20000, | |
| 80 | + data: 'success' | |
| 81 | + } | |
| 82 | + } | |
| 83 | + } | |
| 84 | +] | ... | ... |
mock/utils.js
0 → 100644
| 1 | +/** | |
| 2 | + * @param {string} url | |
| 3 | + * @returns {Object} | |
| 4 | + */ | |
| 5 | +function param2Obj(url) { | |
| 6 | + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') | |
| 7 | + if (!search) { | |
| 8 | + return {} | |
| 9 | + } | |
| 10 | + const obj = {} | |
| 11 | + const searchArr = search.split('&') | |
| 12 | + searchArr.forEach(v => { | |
| 13 | + const index = v.indexOf('=') | |
| 14 | + if (index !== -1) { | |
| 15 | + const name = v.substring(0, index) | |
| 16 | + const val = v.substring(index + 1, v.length) | |
| 17 | + obj[name] = val | |
| 18 | + } | |
| 19 | + }) | |
| 20 | + return obj | |
| 21 | +} | |
| 22 | + | |
| 23 | +module.exports = { | |
| 24 | + param2Obj | |
| 25 | +} | ... | ... |
package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "vue-admin-template", | |
| 3 | + "version": "4.4.0", | |
| 4 | + "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", | |
| 5 | + "author": "Pan <panfree23@gmail.com>", | |
| 6 | + "scripts": { | |
| 7 | + "dev": "vue-cli-service serve", | |
| 8 | + "build:prod": "vue-cli-service build", | |
| 9 | + "build:stage": "vue-cli-service build --mode staging", | |
| 10 | + "preview": "node build/index.js --preview", | |
| 11 | + "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", | |
| 12 | + "lint": "eslint --ext .js,.vue src", | |
| 13 | + "test:unit": "jest --clearCache && vue-cli-service test:unit", | |
| 14 | + "test:ci": "npm run lint && npm run test:unit" | |
| 15 | + }, | |
| 16 | + "dependencies": { | |
| 17 | + "axios": "^0.24.0", | |
| 18 | + "core-js": "3.6.5", | |
| 19 | + "crypto-js": "^4.1.1", | |
| 20 | + "element-ui": "2.13.2", | |
| 21 | + "js-cookie": "2.2.0", | |
| 22 | + "normalize.css": "7.0.0", | |
| 23 | + "nprogress": "0.2.0", | |
| 24 | + "path-to-regexp": "2.4.0", | |
| 25 | + "vue": "2.6.10", | |
| 26 | + "vue-quill-editor": "^3.0.6", | |
| 27 | + "vue-router": "3.0.6", | |
| 28 | + "vuex": "3.1.0" | |
| 29 | + }, | |
| 30 | + "devDependencies": { | |
| 31 | + "@vue/cli-plugin-babel": "4.4.4", | |
| 32 | + "@vue/cli-plugin-eslint": "4.4.4", | |
| 33 | + "@vue/cli-plugin-unit-jest": "4.4.4", | |
| 34 | + "@vue/cli-service": "4.4.4", | |
| 35 | + "@vue/test-utils": "1.0.0-beta.29", | |
| 36 | + "autoprefixer": "9.5.1", | |
| 37 | + "babel-eslint": "10.1.0", | |
| 38 | + "babel-jest": "23.6.0", | |
| 39 | + "babel-plugin-dynamic-import-node": "2.3.3", | |
| 40 | + "chalk": "2.4.2", | |
| 41 | + "connect": "3.6.6", | |
| 42 | + "eslint": "6.7.2", | |
| 43 | + "eslint-plugin-vue": "6.2.2", | |
| 44 | + "html-webpack-plugin": "3.2.0", | |
| 45 | + "mockjs": "1.0.1-beta3", | |
| 46 | + "runjs": "4.3.2", | |
| 47 | + "sass": "1.26.8", | |
| 48 | + "sass-loader": "8.0.2", | |
| 49 | + "script-ext-html-webpack-plugin": "2.1.3", | |
| 50 | + "serve-static": "1.13.2", | |
| 51 | + "svg-sprite-loader": "4.1.3", | |
| 52 | + "svgo": "1.2.2", | |
| 53 | + "vue-template-compiler": "2.6.10" | |
| 54 | + }, | |
| 55 | + "browserslist": [ | |
| 56 | + "> 1%", | |
| 57 | + "last 2 versions" | |
| 58 | + ], | |
| 59 | + "engines": { | |
| 60 | + "node": ">=8.9", | |
| 61 | + "npm": ">= 3.0.0" | |
| 62 | + }, | |
| 63 | + "license": "MIT" | |
| 64 | +} | ... | ... |
postcss.config.js
0 → 100644
public/favicon.ico
0 → 100644
No preview for this file type
public/index.html
0 → 100644
| 1 | +<!DOCTYPE html> | |
| 2 | +<html> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
| 7 | + <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | |
| 8 | + <title><%= webpackConfig.name %></title> | |
| 9 | + <script charset="utf-8" src="https://map.qq.com/api/gljs?libraries=tools&v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script> | |
| 10 | + </head> | |
| 11 | + <body> | |
| 12 | + <noscript> | |
| 13 | + <strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | |
| 14 | + </noscript> | |
| 15 | + <div id="app"></div> | |
| 16 | + <!-- built files will be auto injected --> | |
| 17 | + </body> | |
| 18 | +</html> | ... | ... |
src/App.vue
0 → 100644
src/api/AppointmentRecord.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | + | |
| 4 | +//导出数据 | |
| 5 | +export function deriveExcel(data){ | |
| 6 | + return request({ | |
| 7 | + url:'/AppointmentRecord/deriveExcel', | |
| 8 | + method:'post', | |
| 9 | + data | |
| 10 | + }) | |
| 11 | +} | |
| 12 | +//查询指定用户的预约数据 | |
| 13 | +export function GetRecordById(data){ | |
| 14 | + return request({ | |
| 15 | + url:'/AppointmentRecord/GetRecordById', | |
| 16 | + method:'post', | |
| 17 | + data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | +//获取某个用户下面的客户所有预约情况 | |
| 21 | +export function GetRecordByCustomer(data){ | |
| 22 | + return request({ | |
| 23 | + url:'/AppointmentRecord/GetRecordByCustomer', | |
| 24 | + method:'post', | |
| 25 | + data | |
| 26 | + }) | |
| 27 | +} | |
| 28 | +//更新付款时间 | |
| 29 | +export function UpdResultTime(data){ | |
| 30 | + return request({ | |
| 31 | + url:'/AppointmentRecord/UpdResultTime/'+data, | |
| 32 | + method:'post', | |
| 33 | + data | |
| 34 | + }) | |
| 35 | +} | |
| 36 | +// 获取某个用户下面的客户所有预约情况 根据付款时间 | |
| 37 | +export function GetRecordByCustomerX(data){ | |
| 38 | + return request({ | |
| 39 | + url:'/AppointmentRecord/GetRecordByCustomerX', | |
| 40 | + method:'post', | |
| 41 | + data | |
| 42 | + }) | |
| 43 | +} | |
| 44 | +// 用户预约车辆保养 | |
| 45 | +export function ReserveByUser(params) { | |
| 46 | + return request({ | |
| 47 | + url: '/AppointmentRecord/ReserveByUser', | |
| 48 | + method: 'post', | |
| 49 | + data: params | |
| 50 | + }) | |
| 51 | +} | |
| 52 | +//删除信息 支持多个 | |
| 53 | +export function DeleteRecord(params) { | |
| 54 | + return request({ | |
| 55 | + url: `/AppointmentRecord/Delete?${utils.ObjectToQureyParams(params)}`, | |
| 56 | + method: 'post', | |
| 57 | + data: params | |
| 58 | + }) | |
| 59 | +} | |
| 60 | + | |
| 61 | +//获取预约列表 | |
| 62 | +export function GetAppointmentRecord(params) { | |
| 63 | + return request({ | |
| 64 | + url: `/AppointmentRecord/GetAppointmentRecord`, | |
| 65 | + method: 'post', | |
| 66 | + data: params | |
| 67 | + }) | |
| 68 | +} | |
| 69 | + | |
| 70 | +//修改预约信息 | |
| 71 | +export function UpdateRecord(params) { | |
| 72 | + return request({ | |
| 73 | + url: `/AppointmentRecord/Update`, | |
| 74 | + method: 'post', | |
| 75 | + data: params | |
| 76 | + }) | |
| 77 | +} | |
| 78 | +//完成预约操作(线下收款) | |
| 79 | +export function Collection(data) { | |
| 80 | + return request({ | |
| 81 | + url: `/AppointmentRecord/Collection/`+data, | |
| 82 | + method: 'post', | |
| 83 | + data | |
| 84 | + }) | |
| 85 | +} | |
| 86 | +// 修改预约状态 | |
| 87 | +export function UpdateState(data){ | |
| 88 | + return request({ | |
| 89 | + url:'/AppointmentRecord/UpdateState', | |
| 90 | + method:'post', | |
| 91 | + data | |
| 92 | + }) | |
| 93 | +} | ... | ... |
src/api/Introduce.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 添加修改介绍内容 | |
| 4 | +export function AddOrUpdRichTextduce(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/introduce/AddOrUpdRichTextduce', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 根据ID删除富文本消息 | |
| 13 | +export function DelRichTextduce(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/introduce/DelRichTextduce/'+params, | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 查询所有富文本消息 | |
| 23 | +export function GetListRichTextduce(params) { | |
| 24 | + return request({ | |
| 25 | + url: '/introduce/GetListRichTextduce', | |
| 26 | + method: 'post', | |
| 27 | + data: params | |
| 28 | + }) | |
| 29 | +} | ... | ... |
src/api/Partner.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | + | |
| 4 | + | |
| 5 | +//根据ID查询合伙人信息 | |
| 6 | +export function GetPartnerById(data) { | |
| 7 | + return request({ | |
| 8 | + url:'/Partner/GetPartnerById/'+data, | |
| 9 | + method:'post', | |
| 10 | + data | |
| 11 | + }) | |
| 12 | +} | |
| 13 | + | |
| 14 | + | |
| 15 | +//查询合伙人信息 | |
| 16 | +export function GetListPartner(data){ | |
| 17 | + return request({ | |
| 18 | + url:'/Partner/GetList', | |
| 19 | + method:'post', | |
| 20 | + data | |
| 21 | + }) | |
| 22 | +} | |
| 23 | +//新增修改合伙人信息 | |
| 24 | +export function AddOrUpdatePartner(data){ | |
| 25 | + return request({ | |
| 26 | + url:'/Partner/AddOrUpdatePartner', | |
| 27 | + method:'post', | |
| 28 | + data | |
| 29 | + }) | |
| 30 | +} | |
| 31 | +//删除合伙人信息 | |
| 32 | +export function DelPartner(data){ | |
| 33 | + return request({ | |
| 34 | + url:'/Partner/DelPartner/'+data, | |
| 35 | + method:'post', | |
| 36 | + data | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +// 添加修改提现记录 | |
| 41 | +export function AddOrUpdMoney(params) { | |
| 42 | + return request({ | |
| 43 | + url: '/money/AddOrUpdMoney', | |
| 44 | + method: 'post', | |
| 45 | + data: params | |
| 46 | + }) | |
| 47 | +} | |
| 48 | + | |
| 49 | + | |
| 50 | +// 根据ID删除提现记录 | |
| 51 | +export function DelMoney(params) { | |
| 52 | + return request({ | |
| 53 | + url: '/money/DelMoney/'+params, | |
| 54 | + method: 'post', | |
| 55 | + data: params | |
| 56 | + }) | |
| 57 | +} | |
| 58 | + | |
| 59 | + | |
| 60 | +// 查询所有提现记录 | |
| 61 | +export function GetMoneyList(params) { | |
| 62 | + return request({ | |
| 63 | + url: '/money/GetMoneyList', | |
| 64 | + method: 'post', | |
| 65 | + data: params | |
| 66 | + }) | |
| 67 | +} | ... | ... |
src/api/QuestionBank.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +export function getQuestionList(params) { | |
| 4 | + return request({ | |
| 5 | + url: `/QuestionBank/SelectQuestionBankList?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 6 | + method: 'post', | |
| 7 | + data: params | |
| 8 | + }) | |
| 9 | +} | |
| 10 | +//维护题目,包含添加和修改 | |
| 11 | +export function EditQuestion(params) { | |
| 12 | + return request({ | |
| 13 | + url: `/QuestionBank/EditQuestionBankEvent`, | |
| 14 | + method: 'post', | |
| 15 | + data: params | |
| 16 | + }) | |
| 17 | +} | |
| 18 | + | |
| 19 | +export function getQuestionClassList(params) { | |
| 20 | + return request({ | |
| 21 | + url: `/QuestionClass/List?pageIndex=1&pageSize=1000`, | |
| 22 | + method: 'get', | |
| 23 | + }) | |
| 24 | +} | |
| 25 | +//删除题目,标记删除 | |
| 26 | +export function DelQuestionBankEvent(id) { | |
| 27 | + return request({ | |
| 28 | + url: `/QuestionBank/DelQuestionBankEvent/${id}`, | |
| 29 | + method: 'post', | |
| 30 | + }) | |
| 31 | +} | |
| 32 | +//读取题目信息 | |
| 33 | +export function GetQuestionBankById(id) { | |
| 34 | + return request({ | |
| 35 | + url: `/QuestionBank/Get/${id}`, | |
| 36 | + method: 'get', | |
| 37 | + }) | |
| 38 | +} | |
| 0 | 39 | \ No newline at end of file | ... | ... |
src/api/ReservationArea.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 添加可预约区域 | |
| 4 | +export function AddReservationArea(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/ReservationArea/Create', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +//获取可预约区域列表 | |
| 13 | +export function ReservationAreaList(params) { | |
| 14 | + return request({ | |
| 15 | + url: `/ReservationArea/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 16 | + method: 'get', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +//删除预约区域 | |
| 22 | +export function ReservationAreaDelete(id) { | |
| 23 | + return request({ | |
| 24 | + url: `/ReservationArea/Delete?ids=${id}`, | |
| 25 | + method: 'post' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | +//修改预约区域 | |
| 29 | +export function ReservationAreaUpdate(data) { | |
| 30 | + return request({ | |
| 31 | + url: `/ReservationArea/Update`, | |
| 32 | + method: 'post', | |
| 33 | + data | |
| 34 | + }) | |
| 35 | +} | ... | ... |
src/api/ReservationSettings.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 设置可预约信息 | |
| 4 | +export function SettingReservation(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/ReservationSettings/SettingReservation', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | +// 修改系统设置的预约信息 | |
| 12 | +export function UpadteReservation(params) { | |
| 13 | + return request({ | |
| 14 | + url: '/ReservationSettings/UpadteReservation', | |
| 15 | + method: 'post', | |
| 16 | + data: params | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | +//获取可预约时间列表 | |
| 21 | +export function ReservationSettingsList(params) { | |
| 22 | + return request({ | |
| 23 | + url: `/ReservationSettings/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 24 | + method: 'get', | |
| 25 | + data: params | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | ... | ... |
src/api/RobotReservation.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 获取单个信息 | |
| 4 | +export function GetRobot(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/RobotReservation/Get/'+params, | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | +//删除信息 支持多个 | |
| 12 | +export function DeleteRobot(data) { | |
| 13 | + return request({ | |
| 14 | + url: `/RobotReservation/Delete?${utils.ObjectToQureyParams(data)}`, | |
| 15 | + method: 'post', | |
| 16 | + data | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | +//获取列表内容 | |
| 24 | +export function ListRobot(params) { | |
| 25 | + return request({ | |
| 26 | + url: `/RobotReservation/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 27 | + method: 'get', | |
| 28 | + data: params | |
| 29 | + }) | |
| 30 | +} | |
| 31 | + | |
| 32 | +//修改指定数据 Robot | |
| 33 | +export function UpdateRobot(data){ | |
| 34 | + return request({ | |
| 35 | + url:'/RobotReservation/Update', | |
| 36 | + method:'post', | |
| 37 | + data | |
| 38 | + }) | |
| 39 | +} | |
| 40 | + | |
| 41 | +//创建指定数据 Robot | |
| 42 | +export function CreateRobot(data){ | |
| 43 | + return request({ | |
| 44 | + url:'/RobotReservation/Create', | |
| 45 | + method:'post', | |
| 46 | + data | |
| 47 | + }) | |
| 48 | +} | |
| 0 | 49 | \ No newline at end of file | ... | ... |
src/api/TestPaper.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +//编辑试卷 | |
| 3 | +export function EditTestPaper(params) { | |
| 4 | + return request({ | |
| 5 | + url: `/TestPaper/AddTestPaper`, | |
| 6 | + method: 'post', | |
| 7 | + data: params | |
| 8 | + }) | |
| 9 | +} | |
| 10 | + | |
| 11 | +export function getTestPaperList(params) { | |
| 12 | + return request({ | |
| 13 | + url: `/TestPaper/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 14 | + method: 'get', | |
| 15 | + data: params | |
| 16 | + }) | |
| 17 | +} | ... | ... |
src/api/VehicleManagement.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 根据用户ID来获取该用户下面的所有车辆 | |
| 4 | +export function GetVehicleListByUser(data) { | |
| 5 | + return request({ | |
| 6 | + url: `/VehicleManagement/GetVehicleListByUser`, | |
| 7 | + method: 'post', | |
| 8 | + data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | +// 修改为默认车辆 | |
| 12 | +export function UpdateCarDefault(data){ | |
| 13 | + return request({ | |
| 14 | + url:'/VehicleManagement/UpdateCarDefault', | |
| 15 | + method:'post', | |
| 16 | + data | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | ... | ... |
src/api/calculation.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 更改费率 | |
| 4 | +export function UpdateCalculation(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/Calculation/UpdateCalculation', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 查询费率 | |
| 13 | +export function GetModelCalculation(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/Calculation/GetModelCalculation', | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | ... | ... |
src/api/comment.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 回复评论信息 | |
| 4 | +export function ReturnComment(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/Comment/ReturnComment', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 评论信息 | |
| 13 | +export function AddComment(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/Comment/AddComment', | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | +//删除评论信息 | |
| 21 | +export function DelComment(data){ | |
| 22 | + return request({ | |
| 23 | + url:'/Comment/DelComment/'+data, | |
| 24 | + method: 'post', | |
| 25 | + data | |
| 26 | + }) | |
| 27 | +} | |
| 28 | +//查询所有评论信息 | |
| 29 | +export function GetCommentList(data){ | |
| 30 | + return request({ | |
| 31 | + url:'/Comment/GetCommentList', | |
| 32 | + method:'post', | |
| 33 | + data | |
| 34 | + }) | |
| 35 | +} | |
| 36 | +//审核评论数据 | |
| 37 | +export function audit(data){ | |
| 38 | + return request({ | |
| 39 | + url:'/Comment/audit/'+data, | |
| 40 | + method:'post', | |
| 41 | + data | |
| 42 | + }) | |
| 43 | +} | ... | ... |
src/api/deposit.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 查询审核信息 | |
| 4 | +export function GetDeposit(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/Deposit/GetDeposit', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 开启审核 关闭审核 | |
| 13 | +export function UpdDeposit(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/Deposit/UpdDeposit', | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | ... | ... |
src/api/index.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +//读取题目总和 | |
| 4 | +export function GetQuestionTotal(params) { | |
| 5 | + return request({ | |
| 6 | + url: `/QuestionBank/GetQuestionTotal`, | |
| 7 | + method: 'get', | |
| 8 | + }) | |
| 9 | +} | |
| 10 | + | |
| 11 | +//读取试卷总和 | |
| 12 | +export function GetTestPaperTotal(params) { | |
| 13 | + return request({ | |
| 14 | + url: `/TestPaper/GetTestPaperTotal`, | |
| 15 | + method: 'get', | |
| 16 | + }) | |
| 17 | +} | |
| 0 | 18 | \ No newline at end of file | ... | ... |
src/api/meal.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 添加修改套餐 | |
| 4 | +export function AddOrUpdRichTextmeal(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/meal/AddOrUpdRichTextmeal', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 根据ID删除套餐 | |
| 13 | +export function DelRichTextmeal(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/meal/DelRichTextmeal/'+params, | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 查询所有套餐 | |
| 23 | +export function GetListRichTextmeal(params) { | |
| 24 | + return request({ | |
| 25 | + url: '/meal/GetListRichTextmeal', | |
| 26 | + method: 'post', | |
| 27 | + data: params | |
| 28 | + }) | |
| 29 | +} | ... | ... |
src/api/money.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 添加修改提现记录 | |
| 4 | +export function AddOrUpdMoney(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/money/AddOrUpdMoney', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 根据ID删除提现记录 | |
| 13 | +export function DelMoney(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/money/DelMoney/'+params, | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 查询所有提现记录 | |
| 23 | +export function GetMoneyList(params) { | |
| 24 | + return request({ | |
| 25 | + url: '/money/GetMoneyList', | |
| 26 | + method: 'post', | |
| 27 | + data: params | |
| 28 | + }) | |
| 29 | +} | ... | ... |
src/api/partneruser.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | + | |
| 4 | +// 合伙人绑定经理 | |
| 5 | +export function AddOrUpdatePartnerUser(params) { | |
| 6 | + return request({ | |
| 7 | + url: '/partneruser/AddOrUpdatePartnerUser', | |
| 8 | + method: 'post', | |
| 9 | + data: params | |
| 10 | + }) | |
| 11 | +} | |
| 12 | + | |
| 13 | +//根据合伙人ID查询销售经理 | |
| 14 | +export function GetUserList(data){ | |
| 15 | + return request({ | |
| 16 | + url:'/partneruser/GetUserList', | |
| 17 | + method:'post', | |
| 18 | + data | |
| 19 | + }) | |
| 20 | +} | |
| 21 | + | ... | ... |
src/api/record.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 添加修改领取记录 | |
| 4 | +export function AddOrUpdateRecord(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/record/AddOrUpdateRecord', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 根据ID删除领取记录 | |
| 13 | +export function DelRecord(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/record/DelRecord/'+params, | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 查询所有领取记录 | |
| 23 | +export function GetRecordList(params) { | |
| 24 | + return request({ | |
| 25 | + url: '/record/GetRecordList', | |
| 26 | + method: 'post', | |
| 27 | + data: params | |
| 28 | + }) | |
| 29 | +} | ... | ... |
src/api/rulestext.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | +// 添加修改规则 | |
| 4 | +export function AddOrUpdRichTextrule(params) { | |
| 5 | + return request({ | |
| 6 | + url: '/rule/AddOrUpdRichTextrule', | |
| 7 | + method: 'post', | |
| 8 | + data: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 根据ID删除规则 | |
| 13 | +export function DelRichTextrule(params) { | |
| 14 | + return request({ | |
| 15 | + url: '/rule/DelRichTextrule/'+params, | |
| 16 | + method: 'post', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 查询所有规则消息 | |
| 23 | +export function GetListRichTextrule(params) { | |
| 24 | + return request({ | |
| 25 | + url: '/rule/GetListRichTextrule', | |
| 26 | + method: 'post', | |
| 27 | + data: params | |
| 28 | + }) | |
| 29 | +} | ... | ... |
src/api/table.js
0 → 100644
src/api/user.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import utils from '../utils/utils.js' | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | +//修改密码 | |
| 8 | +export function UpdPassword(data){ | |
| 9 | + return request({ | |
| 10 | + url:'/Users/UpdPassword', | |
| 11 | + method:'post', | |
| 12 | + data | |
| 13 | + }) | |
| 14 | +} | |
| 15 | +//添加下级管理员 | |
| 16 | +export function AddSubAdmin(data){ | |
| 17 | + return request({ | |
| 18 | + url:'/Account/AddSubAdmin', | |
| 19 | + method:'post', | |
| 20 | + data | |
| 21 | + }) | |
| 22 | +} | |
| 23 | +//查询下级管理员 | |
| 24 | +export function GetSubAdminList(data){ | |
| 25 | + return request({ | |
| 26 | + url:'/Account/GetSubAdminList', | |
| 27 | + method:'post', | |
| 28 | + data | |
| 29 | + }) | |
| 30 | +} | |
| 31 | +//删除下级管理员 | |
| 32 | +export function DelAdmin(data){ | |
| 33 | + return request({ | |
| 34 | + url:'/Account/DelAdmin/'+data, | |
| 35 | + method:'post', | |
| 36 | + data | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | + | |
| 41 | +// 最新修改固定单量 经理专员 | |
| 42 | +export function UpdateNum(data){ | |
| 43 | + return request({ | |
| 44 | + url:'/Num/UpdateNum', | |
| 45 | + method:'post', | |
| 46 | + data | |
| 47 | + }) | |
| 48 | +} | |
| 49 | + | |
| 50 | +//查询经理专员单量 | |
| 51 | +export function GetModelNum(data){ | |
| 52 | + return request({ | |
| 53 | + url:'/Num/GetModelNum', | |
| 54 | + method:'post', | |
| 55 | + data | |
| 56 | + }) | |
| 57 | +} | |
| 58 | +//付款成功发送短信 | |
| 59 | +export function SendPaymentAppointment(data){ | |
| 60 | + return request({ | |
| 61 | + url:'/Note/SendPaymentAppointment', | |
| 62 | + method:'post', | |
| 63 | + data | |
| 64 | + }) | |
| 65 | +} | |
| 66 | + | |
| 67 | +//拉黑用户 | |
| 68 | +export function Blacklist(data){ | |
| 69 | + return request({ | |
| 70 | + url:'/Users/Blacklist/'+data, | |
| 71 | + method:'post', | |
| 72 | + data | |
| 73 | + }) | |
| 74 | +} | |
| 75 | +//取消拉黑用户 | |
| 76 | +export function NoBlacklist(data){ | |
| 77 | + return request({ | |
| 78 | + url:'/Users/NoBlacklist/'+data, | |
| 79 | + method:'post', | |
| 80 | + data | |
| 81 | + }) | |
| 82 | +} | |
| 83 | +//完成一单预约操作已完成数量增加1 | |
| 84 | +export function UpdnowNum(data){ | |
| 85 | + return request({ | |
| 86 | + url:'/Users/UpdnowNum/'+data, | |
| 87 | + method:'post', | |
| 88 | + data | |
| 89 | + }) | |
| 90 | +} | |
| 91 | +export function login(data) { | |
| 92 | + return request({ | |
| 93 | + url: `/Account/Login?username=${data.username}&password=${data.password}`, | |
| 94 | + method: 'post', | |
| 95 | + data | |
| 96 | + }) | |
| 97 | +} | |
| 98 | +// 新增修改用户信息 | |
| 99 | +export function Save(data){ | |
| 100 | + return request({ | |
| 101 | + url:`/Users/Save`, | |
| 102 | + method:'post', | |
| 103 | + data | |
| 104 | + }) | |
| 105 | +} | |
| 106 | +//修改专员单量设置 | |
| 107 | +export function UpdMisser(data){ | |
| 108 | + return request({ | |
| 109 | + url:`/Users/UpdMisser?${utils.ObjectToQureyParams(data)}`, | |
| 110 | + method:'post', | |
| 111 | + data | |
| 112 | + }) | |
| 113 | +} | |
| 114 | +//修改经理单量设置 | |
| 115 | +export function UpdManage(data){ | |
| 116 | + return request({ | |
| 117 | + url:`/Users/UpdManage?${utils.ObjectToQureyParams(data)}`, | |
| 118 | + method:'post', | |
| 119 | + data | |
| 120 | + }) | |
| 121 | +} | |
| 122 | + | |
| 123 | +// 查询销售经理下面的销售专员 | |
| 124 | +export function GetCommissionerByManage(data){ | |
| 125 | + return request({ | |
| 126 | + url:`/Users/GetCommissionerByManage?${utils.ObjectToQureyParams(data)}`, | |
| 127 | + method:'get', | |
| 128 | + data | |
| 129 | + }) | |
| 130 | +} | |
| 131 | +///获取某个用户下面的所有客户 | |
| 132 | +export function GetUserCustomerView(data){ | |
| 133 | + return request({ | |
| 134 | + url:`/Users/GetUserCustomerView?${utils.ObjectToQureyParams(data)}`, | |
| 135 | + method:'get', | |
| 136 | + data | |
| 137 | + }) | |
| 138 | +} | |
| 139 | + | |
| 140 | +export function getInfo(token) { | |
| 141 | + return request({ | |
| 142 | + url: `/users/userInfo`, | |
| 143 | + method: 'get', | |
| 144 | + params: { | |
| 145 | + token | |
| 146 | + } | |
| 147 | + }) | |
| 148 | +} | |
| 149 | + | |
| 150 | + | |
| 151 | +export function ImportUserByExcel(token) { | |
| 152 | + return request({ | |
| 153 | + url: `/Account/ImportUser`, | |
| 154 | + method: 'post' | |
| 155 | + }) | |
| 156 | +} | |
| 157 | + | |
| 158 | +//获取用户列表 | |
| 159 | +export function GetUserList(params) { | |
| 160 | + return request({ | |
| 161 | + url: `/Users/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 162 | + method: 'get', | |
| 163 | + data: params | |
| 164 | + }) | |
| 165 | +} | |
| 166 | + | |
| 167 | +//获取销售经理用户列表 | |
| 168 | +export function GetUserListBytManager(params) { | |
| 169 | + return request({ | |
| 170 | + url: `/Users/GetUserListBytManager?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`, | |
| 171 | + method: 'post', | |
| 172 | + data:params | |
| 173 | + }) | |
| 174 | +} | |
| 175 | +//导出数据 | |
| 176 | +export function deriveExcel(data){ | |
| 177 | + return request({ | |
| 178 | + url:'/AppointmentRecord/deriveExcel', | |
| 179 | + method:'post', | |
| 180 | + data | |
| 181 | + }) | |
| 182 | +} | |
| 183 | + | |
| 184 | +//修改用户类型 | |
| 185 | +export function UpdateUserType(params) { | |
| 186 | + return request({ | |
| 187 | + url: `/Users/UpdateUserType?UserId=${params.UserId}&UserType=${params.UserType}&ParentUserId=${params.ParentUserId}`, | |
| 188 | + method: 'post', | |
| 189 | + data:params | |
| 190 | + }) | |
| 191 | +} | |
| 192 | +// 删除用户 | |
| 193 | +export function DeleteUser(data){ | |
| 194 | + return request({ | |
| 195 | + url:`/Users/Delete?${utils.ObjectToQureyParams(data)}`, | |
| 196 | + method:'post', | |
| 197 | + data | |
| 198 | + }) | |
| 199 | +} | |
| 200 | + | |
| 201 | + | |
| 202 | +export function logout() { | |
| 203 | + return request({ | |
| 204 | + url: '/vue-admin-template/user/logout', | |
| 205 | + method: 'post' | |
| 206 | + }) | |
| 207 | +} | ... | ... |
src/assets/404_images/404.png
0 → 100644
95.8 KB
src/assets/404_images/404_cloud.png
0 → 100644
4.65 KB
src/components/Breadcrumb/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-breadcrumb class="app-breadcrumb" separator="/"> | |
| 3 | + <transition-group name="breadcrumb"> | |
| 4 | + <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path"> | |
| 5 | + <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span> | |
| 6 | + <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a> | |
| 7 | + </el-breadcrumb-item> | |
| 8 | + </transition-group> | |
| 9 | + </el-breadcrumb> | |
| 10 | +</template> | |
| 11 | + | |
| 12 | +<script> | |
| 13 | +import pathToRegexp from 'path-to-regexp' | |
| 14 | + | |
| 15 | +export default { | |
| 16 | + data() { | |
| 17 | + return { | |
| 18 | + levelList: null | |
| 19 | + } | |
| 20 | + }, | |
| 21 | + watch: { | |
| 22 | + $route() { | |
| 23 | + this.getBreadcrumb() | |
| 24 | + } | |
| 25 | + }, | |
| 26 | + created() { | |
| 27 | + this.getBreadcrumb() | |
| 28 | + }, | |
| 29 | + methods: { | |
| 30 | + getBreadcrumb() { | |
| 31 | + // only show routes with meta.title | |
| 32 | + let matched = this.$route.matched.filter(item => item.meta && item.meta.title) | |
| 33 | + const first = matched[0] | |
| 34 | + | |
| 35 | + if (!this.isDashboard(first)) { | |
| 36 | + matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched) | |
| 37 | + } | |
| 38 | + | |
| 39 | + this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) | |
| 40 | + }, | |
| 41 | + isDashboard(route) { | |
| 42 | + const name = route && route.name | |
| 43 | + if (!name) { | |
| 44 | + return false | |
| 45 | + } | |
| 46 | + return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase() | |
| 47 | + }, | |
| 48 | + pathCompile(path) { | |
| 49 | + // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 | |
| 50 | + const { params } = this.$route | |
| 51 | + var toPath = pathToRegexp.compile(path) | |
| 52 | + return toPath(params) | |
| 53 | + }, | |
| 54 | + handleLink(item) { | |
| 55 | + const { redirect, path } = item | |
| 56 | + if (redirect) { | |
| 57 | + this.$router.push(redirect) | |
| 58 | + return | |
| 59 | + } | |
| 60 | + this.$router.push(this.pathCompile(path)) | |
| 61 | + } | |
| 62 | + } | |
| 63 | +} | |
| 64 | +</script> | |
| 65 | + | |
| 66 | +<style lang="scss" scoped> | |
| 67 | +.app-breadcrumb.el-breadcrumb { | |
| 68 | + display: inline-block; | |
| 69 | + font-size: 14px; | |
| 70 | + line-height: 50px; | |
| 71 | + margin-left: 8px; | |
| 72 | + | |
| 73 | + .no-redirect { | |
| 74 | + color: #97a8be; | |
| 75 | + cursor: text; | |
| 76 | + } | |
| 77 | +} | |
| 78 | +</style> | ... | ... |
src/components/Hamburger/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div style="padding: 0 15px;" @click="toggleClick"> | |
| 3 | + <svg | |
| 4 | + :class="{'is-active':isActive}" | |
| 5 | + class="hamburger" | |
| 6 | + viewBox="0 0 1024 1024" | |
| 7 | + xmlns="http://www.w3.org/2000/svg" | |
| 8 | + width="64" | |
| 9 | + height="64" | |
| 10 | + > | |
| 11 | + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z" /> | |
| 12 | + </svg> | |
| 13 | + </div> | |
| 14 | +</template> | |
| 15 | + | |
| 16 | +<script> | |
| 17 | +export default { | |
| 18 | + name: 'Hamburger', | |
| 19 | + props: { | |
| 20 | + isActive: { | |
| 21 | + type: Boolean, | |
| 22 | + default: false | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + methods: { | |
| 26 | + toggleClick() { | |
| 27 | + this.$emit('toggleClick') | |
| 28 | + } | |
| 29 | + } | |
| 30 | +} | |
| 31 | +</script> | |
| 32 | + | |
| 33 | +<style scoped> | |
| 34 | +.hamburger { | |
| 35 | + display: inline-block; | |
| 36 | + vertical-align: middle; | |
| 37 | + width: 20px; | |
| 38 | + height: 20px; | |
| 39 | +} | |
| 40 | + | |
| 41 | +.hamburger.is-active { | |
| 42 | + transform: rotate(180deg); | |
| 43 | +} | |
| 44 | +</style> | ... | ... |
src/components/SvgIcon/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" /> | |
| 3 | + <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners"> | |
| 4 | + <use :xlink:href="iconName" /> | |
| 5 | + </svg> | |
| 6 | +</template> | |
| 7 | + | |
| 8 | +<script> | |
| 9 | +// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage | |
| 10 | +import { isExternal } from '@/utils/validate' | |
| 11 | + | |
| 12 | +export default { | |
| 13 | + name: 'SvgIcon', | |
| 14 | + props: { | |
| 15 | + iconClass: { | |
| 16 | + type: String, | |
| 17 | + required: true | |
| 18 | + }, | |
| 19 | + className: { | |
| 20 | + type: String, | |
| 21 | + default: '' | |
| 22 | + } | |
| 23 | + }, | |
| 24 | + computed: { | |
| 25 | + isExternal() { | |
| 26 | + return isExternal(this.iconClass) | |
| 27 | + }, | |
| 28 | + iconName() { | |
| 29 | + return `#icon-${this.iconClass}` | |
| 30 | + }, | |
| 31 | + svgClass() { | |
| 32 | + if (this.className) { | |
| 33 | + return 'svg-icon ' + this.className | |
| 34 | + } else { | |
| 35 | + return 'svg-icon' | |
| 36 | + } | |
| 37 | + }, | |
| 38 | + styleExternalIcon() { | |
| 39 | + return { | |
| 40 | + mask: `url(${this.iconClass}) no-repeat 50% 50%`, | |
| 41 | + '-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%` | |
| 42 | + } | |
| 43 | + } | |
| 44 | + } | |
| 45 | +} | |
| 46 | +</script> | |
| 47 | + | |
| 48 | +<style scoped> | |
| 49 | +.svg-icon { | |
| 50 | + width: 1em; | |
| 51 | + height: 1em; | |
| 52 | + vertical-align: -0.15em; | |
| 53 | + fill: currentColor; | |
| 54 | + overflow: hidden; | |
| 55 | +} | |
| 56 | + | |
| 57 | +.svg-external-icon { | |
| 58 | + background-color: currentColor; | |
| 59 | + mask-size: cover!important; | |
| 60 | + display: inline-block; | |
| 61 | +} | |
| 62 | +</style> | ... | ... |
src/icons/index.js
0 → 100644
| 1 | +import Vue from 'vue' | |
| 2 | +import SvgIcon from '@/components/SvgIcon'// svg component | |
| 3 | + | |
| 4 | +// register globally | |
| 5 | +Vue.component('svg-icon', SvgIcon) | |
| 6 | + | |
| 7 | +const req = require.context('./svg', false, /\.svg$/) | |
| 8 | +const requireAll = requireContext => requireContext.keys().map(requireContext) | |
| 9 | +requireAll(req) | ... | ... |
src/icons/svg/dashboard.svg
0 → 100644
| 1 | +<svg width="128" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M27.429 63.638c0-2.508-.893-4.65-2.679-6.424-1.786-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.465 2.662-1.785 1.774-2.678 3.916-2.678 6.424 0 2.508.893 4.65 2.678 6.424 1.786 1.775 3.94 2.662 6.465 2.662 2.524 0 4.678-.887 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm13.714-31.801c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM71.714 65.98l7.215-27.116c.285-1.23.107-2.378-.536-3.443-.643-1.064-1.56-1.762-2.75-2.094-1.19-.33-2.333-.177-3.429.462-1.095.639-1.81 1.573-2.143 2.804l-7.214 27.116c-2.857.237-5.405 1.266-7.643 3.088-2.238 1.822-3.738 4.152-4.5 6.992-.952 3.644-.476 7.098 1.429 10.364 1.905 3.265 4.69 5.37 8.357 6.317 3.667.947 7.143.474 10.429-1.42 3.285-1.892 5.404-4.66 6.357-8.305.762-2.84.619-5.607-.429-8.305-1.047-2.697-2.762-4.85-5.143-6.46zm47.143-2.342c0-2.508-.893-4.65-2.678-6.424-1.786-1.775-3.94-2.662-6.465-2.662-2.524 0-4.678.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.786 1.775 3.94 2.662 6.464 2.662 2.524 0 4.679-.887 6.465-2.662 1.785-1.775 2.678-3.916 2.678-6.424zm-45.714-45.43c0-2.509-.893-4.65-2.679-6.425C68.68 10.01 66.524 9.122 64 9.122c-2.524 0-4.679.887-6.464 2.661-1.786 1.775-2.679 3.916-2.679 6.425 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm32 13.629c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM128 63.638c0 12.351-3.357 23.78-10.071 34.286-.905 1.372-2.19 2.058-3.858 2.058H13.93c-1.667 0-2.953-.686-3.858-2.058C3.357 87.465 0 76.037 0 63.638c0-8.613 1.69-16.847 5.071-24.703C8.452 31.08 13 24.312 18.714 18.634c5.715-5.68 12.524-10.199 20.429-13.559C47.048 1.715 55.333.035 64 .035c8.667 0 16.952 1.68 24.857 5.04 7.905 3.36 14.714 7.88 20.429 13.559 5.714 5.678 10.262 12.446 13.643 20.301 3.38 7.856 5.071 16.09 5.071 24.703z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/example.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M96.258 57.462h31.421C124.794 27.323 100.426 2.956 70.287.07v31.422a32.856 32.856 0 0 1 25.971 25.97zm-38.796-25.97V.07C27.323 2.956 2.956 27.323.07 57.462h31.422a32.856 32.856 0 0 1 25.97-25.97zm12.825 64.766v31.421c30.46-2.885 54.507-27.253 57.713-57.712H96.579c-2.886 13.466-13.146 23.726-26.292 26.291zM31.492 70.287H.07c2.886 30.46 27.253 54.507 57.713 57.713V96.579c-13.466-2.886-23.726-13.146-26.291-26.292z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/eye-open.svg
0 → 100644
| 1 | +<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="128" height="128"><defs><style/></defs><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085zm0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334zm0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333zm0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/eye.svg
0 → 100644
| 1 | +<svg width="128" height="64" xmlns="http://www.w3.org/2000/svg"><path d="M127.072 7.994c1.37-2.208.914-5.152-.914-6.87-2.056-1.717-4.797-1.226-6.396.982-.229.245-25.586 32.382-55.74 32.382-29.24 0-55.74-32.382-55.968-32.627-1.6-1.963-4.57-2.208-6.397-.49C-.17 3.086-.399 6.275 1.2 8.238c.457.736 5.94 7.36 14.62 14.72L4.17 35.96c-1.828 1.963-1.6 5.152.228 6.87.457.98 1.6 1.471 2.742 1.471s2.284-.49 3.198-1.472l12.564-13.983c5.94 4.416 13.021 8.587 20.788 11.53l-4.797 17.418c-.685 2.699.686 5.397 3.198 6.133h1.37c2.057 0 3.884-1.472 4.341-3.68L52.6 42.83c3.655.736 7.538 1.227 11.422 1.227 3.883 0 7.767-.49 11.422-1.227l4.797 17.173c.457 2.208 2.513 3.68 4.34 3.68.457 0 .914 0 1.143-.246 2.513-.736 3.883-3.434 3.198-6.133l-4.797-17.172c7.767-2.944 14.848-7.114 20.788-11.53l12.336 13.738c.913.981 2.056 1.472 3.198 1.472s2.284-.49 3.198-1.472c1.828-1.963 1.828-4.906.228-6.87l-11.65-13.001c9.366-7.36 14.849-14.474 14.849-14.474z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/form.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M84.068 23.784c-1.02 0-1.877-.32-2.572-.96a8.588 8.588 0 0 1-1.738-2.237 11.524 11.524 0 0 1-1.042-2.621c-.232-.895-.348-1.641-.348-2.238V0h.278c.834 0 1.622.085 2.363.256.742.17 1.645.575 2.711 1.214 1.066.64 2.363 1.535 3.892 2.686 1.53 1.15 3.453 2.664 5.77 4.54 2.502 2.045 4.494 3.771 5.977 5.178 1.483 1.406 2.618 2.6 3.406 3.58.787.98 1.274 1.812 1.46 2.494.185.682.277 1.278.277 1.79v2.046H84.068zM127.3 84.01c.278.682.464 1.535.556 2.558.093 1.023-.37 2.003-1.39 2.94-.463.427-.88.832-1.25 1.215-.372.384-.696.704-.974.96a6.69 6.69 0 0 1-.973.767l-11.816-10.741a44.331 44.331 0 0 0 1.877-1.535 31.028 31.028 0 0 1 1.737-1.406c1.112-.938 2.317-1.343 3.615-1.215 1.297.128 2.363.405 3.197.83.927.427 1.923 1.173 2.989 2.239 1.065 1.065 1.876 2.195 2.432 3.388zM78.23 95.902c2.038 0 3.752-.511 5.143-1.534l-26.969 25.83H18.037c-1.761 0-3.684-.47-5.77-1.407a24.549 24.549 0 0 1-5.838-3.709 21.373 21.373 0 0 1-4.518-5.306c-1.204-2.003-1.807-4.07-1.807-6.202V16.495c0-1.79.44-3.665 1.32-5.626A18.41 18.41 0 0 1 5.04 5.562a21.798 21.798 0 0 1 5.213-3.964C12.198.533 14.237 0 16.37 0h53.24v15.984c0 1.62.278 3.367.834 5.242a16.704 16.704 0 0 0 2.572 5.179c1.159 1.577 2.665 2.898 4.518 3.964 1.853 1.066 4.078 1.598 6.673 1.598h20.295v42.325L85.458 92.45c1.02-1.364 1.529-2.856 1.529-4.476 0-2.216-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1c-2.409 0-4.448.789-6.116 2.366-1.668 1.577-2.502 3.474-2.502 5.69 0 2.217.834 4.092 2.502 5.626 1.668 1.535 3.707 2.302 6.117 2.302h52.13zM26.1 47.951c-2.41 0-4.449.789-6.117 2.366-1.668 1.577-2.502 3.473-2.502 5.69 0 2.216.834 4.092 2.502 5.626 1.668 1.534 3.707 2.302 6.117 2.302h52.13c2.409 0 4.47-.768 6.185-2.302 1.715-1.534 2.572-3.41 2.572-5.626 0-2.217-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1zm52.407 64.063l1.807-1.663 3.476-3.196a479.75 479.75 0 0 0 4.587-4.284 500.757 500.757 0 0 1 5.004-4.667c3.985-3.666 8.48-7.758 13.485-12.276l11.677 10.741-13.485 12.404-5.004 4.603-4.587 4.22a179.46 179.46 0 0 0-3.267 3.068c-.88.853-1.367 1.322-1.46 1.407-.463.341-.973.703-1.529 1.087-.556.383-1.112.703-1.668.959-.556.256-1.413.575-2.572.959a83.5 83.5 0 0 1-3.545 1.087 72.2 72.2 0 0 1-3.475.895c-1.112.256-1.946.426-2.502.511-1.112.17-1.854.043-2.224-.383-.371-.426-.464-1.151-.278-2.174.092-.511.278-1.279.556-2.302.278-1.023.602-2.067.973-3.132l1.042-3.005c.325-.938.58-1.577.765-1.918a10.157 10.157 0 0 1 2.224-2.941z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/link.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M115.625 127.937H.063V12.375h57.781v12.374H12.438v90.813h90.813V70.156h12.374z"/><path d="M116.426 2.821l8.753 8.753-56.734 56.734-8.753-8.745z"/><path d="M127.893 37.982h-12.375V12.375H88.706V0h39.187z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/nested.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M.002 9.2c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-5.043-3.58-9.132-7.997-9.132S.002 4.157.002 9.2zM31.997.066h95.981V18.33H31.997V.066zm0 45.669c0 5.044 3.58 9.132 7.998 9.132 4.417 0 7.997-4.088 7.997-9.132 0-3.263-1.524-6.278-3.998-7.91-2.475-1.63-5.524-1.63-7.998 0-2.475 1.632-4 4.647-4 7.91zM63.992 36.6h63.986v18.265H63.992V36.6zm-31.995 82.2c0 5.043 3.58 9.132 7.998 9.132 4.417 0 7.997-4.089 7.997-9.132 0-5.044-3.58-9.133-7.997-9.133s-7.998 4.089-7.998 9.133zm31.995-9.131h63.986v18.265H63.992V109.67zm0-27.404c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-3.263-1.524-6.277-3.998-7.909-2.475-1.631-5.524-1.631-7.998 0-2.475 1.632-4 4.646-4 7.91zm31.995-9.13h31.991V91.4H95.987V73.135z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/password.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M108.8 44.322H89.6v-5.36c0-9.04-3.308-24.163-25.6-24.163-23.145 0-25.6 16.881-25.6 24.162v5.361H19.2v-5.36C19.2 15.281 36.798 0 64 0c27.202 0 44.8 15.281 44.8 38.961v5.361zm-32 39.356c0-5.44-5.763-9.832-12.8-9.832-7.037 0-12.8 4.392-12.8 9.832 0 3.682 2.567 6.808 6.407 8.477v11.205c0 2.718 2.875 4.962 6.4 4.962 3.524 0 6.4-2.244 6.4-4.962V92.155c3.833-1.669 6.393-4.795 6.393-8.477zM128 64v49.201c0 8.158-8.645 14.799-19.2 14.799H19.2C8.651 128 0 121.359 0 113.201V64c0-8.153 8.645-14.799 19.2-14.799h89.6c10.555 0 19.2 6.646 19.2 14.799z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/table.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z"/><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/tree.svg
0 → 100644
| 1 | +<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M126.713 90.023c.858.985 1.287 2.134 1.287 3.447v29.553c0 1.423-.429 2.6-1.287 3.53-.858.93-1.907 1.395-3.146 1.395H97.824c-1.145 0-2.146-.465-3.004-1.395-.858-.93-1.287-2.107-1.287-3.53V93.47c0-.875.19-1.696.572-2.462.382-.766.906-1.368 1.573-1.806a3.84 3.84 0 0 1 2.146-.657h9.725V69.007a3.84 3.84 0 0 0-.43-1.806 3.569 3.569 0 0 0-1.143-1.313 2.714 2.714 0 0 0-1.573-.492h-36.47v23.149h9.725c1.144 0 2.145.492 3.004 1.478.858.985 1.287 2.134 1.287 3.447v29.553c0 .876-.191 1.696-.573 2.463-.38.766-.905 1.368-1.573 1.806a3.84 3.84 0 0 1-2.145.656H51.915a3.84 3.84 0 0 1-2.145-.656c-.668-.438-1.216-1.04-1.645-1.806a4.96 4.96 0 0 1-.644-2.463V93.47c0-1.313.43-2.462 1.288-3.447.858-.986 1.907-1.478 3.146-1.478h9.582v-23.15h-37.9c-.953 0-1.74.356-2.359 1.068-.62.711-.93 1.56-.93 2.544v19.538h9.726c1.239 0 2.264.492 3.074 1.478.81.985 1.216 2.134 1.216 3.447v29.553c0 1.423-.405 2.6-1.216 3.53-.81.93-1.835 1.395-3.074 1.395H4.29c-.476 0-.93-.082-1.358-.246a4.1 4.1 0 0 1-1.144-.657 4.658 4.658 0 0 1-.93-1.067 5.186 5.186 0 0 1-.643-1.395 5.566 5.566 0 0 1-.215-1.56V93.47c0-.437.048-.875.143-1.313a3.95 3.95 0 0 1 .429-1.15c.19-.328.429-.656.715-.984.286-.329.572-.602.858-.821.286-.22.62-.383 1.001-.493.382-.11.763-.164 1.144-.164h9.726V61.619c0-.985.31-1.833.93-2.544.619-.712 1.358-1.068 2.216-1.068h44.335V39.62h-9.582c-1.24 0-2.288-.492-3.146-1.477a5.09 5.09 0 0 1-1.287-3.448V5.14c0-1.423.429-2.627 1.287-3.612.858-.985 1.907-1.477 3.146-1.477h25.743c.763 0 1.478.246 2.145.739a5.17 5.17 0 0 1 1.573 1.888c.382.766.573 1.587.573 2.462v29.553c0 1.313-.43 2.463-1.287 3.448-.859.985-1.86 1.477-3.004 1.477h-9.725v18.389h42.762c.954 0 1.74.355 2.36 1.067.62.711.93 1.56.93 2.545v26.925h9.582c1.239 0 2.288.492 3.146 1.478z"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svg/user.svg
0 → 100644
| 1 | +<svg width="130" height="130" xmlns="http://www.w3.org/2000/svg"><path d="M63.444 64.996c20.633 0 37.359-14.308 37.359-31.953 0-17.649-16.726-31.952-37.359-31.952-20.631 0-37.36 14.303-37.358 31.952 0 17.645 16.727 31.953 37.359 31.953zM80.57 75.65H49.434c-26.652 0-48.26 18.477-48.26 41.27v2.664c0 9.316 21.608 9.325 48.26 9.325H80.57c26.649 0 48.256-.344 48.256-9.325v-2.663c0-22.794-21.605-41.271-48.256-41.271z" stroke="#979797"/></svg> | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/icons/svgo.yml
0 → 100644
| 1 | +# replace default config | |
| 2 | + | |
| 3 | +# multipass: true | |
| 4 | +# full: true | |
| 5 | + | |
| 6 | +plugins: | |
| 7 | + | |
| 8 | + # - name | |
| 9 | + # | |
| 10 | + # or: | |
| 11 | + # - name: false | |
| 12 | + # - name: true | |
| 13 | + # | |
| 14 | + # or: | |
| 15 | + # - name: | |
| 16 | + # param1: 1 | |
| 17 | + # param2: 2 | |
| 18 | + | |
| 19 | +- removeAttrs: | |
| 20 | + attrs: | |
| 21 | + - 'fill' | |
| 22 | + - 'fill-rule' | ... | ... |
src/layout/components/AppMain.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <section class="app-main"> | |
| 3 | + <transition name="fade-transform" mode="out-in"> | |
| 4 | + <router-view :key="key" /> | |
| 5 | + </transition> | |
| 6 | + </section> | |
| 7 | +</template> | |
| 8 | + | |
| 9 | +<script> | |
| 10 | +export default { | |
| 11 | + name: 'AppMain', | |
| 12 | + computed: { | |
| 13 | + key() { | |
| 14 | + return this.$route.path | |
| 15 | + } | |
| 16 | + }, | |
| 17 | + | |
| 18 | +} | |
| 19 | +</script> | |
| 20 | + | |
| 21 | +<style scoped> | |
| 22 | +.app-main { | |
| 23 | + /*50 = navbar */ | |
| 24 | + min-height: calc(100vh - 50px); | |
| 25 | + width: 100%; | |
| 26 | + position: relative; | |
| 27 | + overflow: hidden; | |
| 28 | +} | |
| 29 | +.fixed-header+.app-main { | |
| 30 | + padding-top: 50px; | |
| 31 | +} | |
| 32 | +</style> | |
| 33 | + | |
| 34 | +<style lang="scss"> | |
| 35 | +// fix css style bug in open el-dialog | |
| 36 | +.el-popup-parent--hidden { | |
| 37 | + .fixed-header { | |
| 38 | + padding-right: 15px; | |
| 39 | + } | |
| 40 | +} | |
| 41 | +</style> | ... | ... |
src/layout/components/Navbar.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="navbar"> | |
| 3 | + <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> | |
| 4 | + | |
| 5 | + <breadcrumb class="breadcrumb-container" /> | |
| 6 | + | |
| 7 | + <div class="right-menu"> | |
| 8 | + <el-dropdown class="avatar-container" trigger="click"> | |
| 9 | + <div class="avatar-wrapper"> | |
| 10 | + <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar"> | |
| 11 | + <i class="el-icon-caret-bottom" /> | |
| 12 | + </div> | |
| 13 | + <el-dropdown-menu slot="dropdown" class="user-dropdown"> | |
| 14 | + <router-link to="/"> | |
| 15 | + <el-dropdown-item> | |
| 16 | + Home | |
| 17 | + </el-dropdown-item> | |
| 18 | + </router-link> | |
| 19 | + <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/"> | |
| 20 | + <el-dropdown-item>Github</el-dropdown-item> | |
| 21 | + </a> | |
| 22 | + <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/"> | |
| 23 | + <el-dropdown-item>Docs</el-dropdown-item> | |
| 24 | + </a> | |
| 25 | + <el-dropdown-item divided @click.native="logout"> | |
| 26 | + <span style="display:block;">Log Out</span> | |
| 27 | + </el-dropdown-item> | |
| 28 | + </el-dropdown-menu> | |
| 29 | + </el-dropdown> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | +</template> | |
| 33 | + | |
| 34 | +<script> | |
| 35 | +import { mapGetters } from 'vuex' | |
| 36 | +import Breadcrumb from '@/components/Breadcrumb' | |
| 37 | +import Hamburger from '@/components/Hamburger' | |
| 38 | + | |
| 39 | +export default { | |
| 40 | + components: { | |
| 41 | + Breadcrumb, | |
| 42 | + Hamburger | |
| 43 | + }, | |
| 44 | + computed: { | |
| 45 | + ...mapGetters([ | |
| 46 | + 'sidebar', | |
| 47 | + 'avatar' | |
| 48 | + ]) | |
| 49 | + }, | |
| 50 | + methods: { | |
| 51 | + toggleSideBar() { | |
| 52 | + this.$store.dispatch('app/toggleSideBar') | |
| 53 | + }, | |
| 54 | + async logout() { | |
| 55 | + await this.$store.dispatch('user/logout') | |
| 56 | + this.$router.push(`/login?redirect=${this.$route.fullPath}`) | |
| 57 | + } | |
| 58 | + } | |
| 59 | +} | |
| 60 | +</script> | |
| 61 | + | |
| 62 | +<style lang="scss" scoped> | |
| 63 | +.navbar { | |
| 64 | + height: 50px; | |
| 65 | + overflow: hidden; | |
| 66 | + position: relative; | |
| 67 | + background: #fff; | |
| 68 | + box-shadow: 0 1px 4px rgba(0,21,41,.08); | |
| 69 | + | |
| 70 | + .hamburger-container { | |
| 71 | + line-height: 46px; | |
| 72 | + height: 100%; | |
| 73 | + float: left; | |
| 74 | + cursor: pointer; | |
| 75 | + transition: background .3s; | |
| 76 | + -webkit-tap-highlight-color:transparent; | |
| 77 | + | |
| 78 | + &:hover { | |
| 79 | + background: rgba(0, 0, 0, .025) | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 83 | + .breadcrumb-container { | |
| 84 | + float: left; | |
| 85 | + } | |
| 86 | + | |
| 87 | + .right-menu { | |
| 88 | + float: right; | |
| 89 | + height: 100%; | |
| 90 | + line-height: 50px; | |
| 91 | + | |
| 92 | + &:focus { | |
| 93 | + outline: none; | |
| 94 | + } | |
| 95 | + | |
| 96 | + .right-menu-item { | |
| 97 | + display: inline-block; | |
| 98 | + padding: 0 8px; | |
| 99 | + height: 100%; | |
| 100 | + font-size: 18px; | |
| 101 | + color: #5a5e66; | |
| 102 | + vertical-align: text-bottom; | |
| 103 | + | |
| 104 | + &.hover-effect { | |
| 105 | + cursor: pointer; | |
| 106 | + transition: background .3s; | |
| 107 | + | |
| 108 | + &:hover { | |
| 109 | + background: rgba(0, 0, 0, .025) | |
| 110 | + } | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + .avatar-container { | |
| 115 | + margin-right: 30px; | |
| 116 | + | |
| 117 | + .avatar-wrapper { | |
| 118 | + margin-top: 5px; | |
| 119 | + position: relative; | |
| 120 | + | |
| 121 | + .user-avatar { | |
| 122 | + cursor: pointer; | |
| 123 | + width: 40px; | |
| 124 | + height: 40px; | |
| 125 | + border-radius: 10px; | |
| 126 | + } | |
| 127 | + | |
| 128 | + .el-icon-caret-bottom { | |
| 129 | + cursor: pointer; | |
| 130 | + position: absolute; | |
| 131 | + right: -20px; | |
| 132 | + top: 25px; | |
| 133 | + font-size: 12px; | |
| 134 | + } | |
| 135 | + } | |
| 136 | + } | |
| 137 | + } | |
| 138 | +} | |
| 139 | +</style> | ... | ... |
src/layout/components/Sidebar/FixiOSBug.js
0 → 100644
| 1 | +export default { | |
| 2 | + computed: { | |
| 3 | + device() { | |
| 4 | + return this.$store.state.app.device | |
| 5 | + } | |
| 6 | + }, | |
| 7 | + mounted() { | |
| 8 | + // In order to fix the click on menu on the ios device will trigger the mouseleave bug | |
| 9 | + // https://github.com/PanJiaChen/vue-element-admin/issues/1135 | |
| 10 | + this.fixBugIniOS() | |
| 11 | + }, | |
| 12 | + methods: { | |
| 13 | + fixBugIniOS() { | |
| 14 | + const $subMenu = this.$refs.subMenu | |
| 15 | + if ($subMenu) { | |
| 16 | + const handleMouseleave = $subMenu.handleMouseleave | |
| 17 | + $subMenu.handleMouseleave = (e) => { | |
| 18 | + if (this.device === 'mobile') { | |
| 19 | + return | |
| 20 | + } | |
| 21 | + handleMouseleave(e) | |
| 22 | + } | |
| 23 | + } | |
| 24 | + } | |
| 25 | + } | |
| 26 | +} | ... | ... |
src/layout/components/Sidebar/Item.vue
0 → 100644
| 1 | +<script> | |
| 2 | +export default { | |
| 3 | + name: 'MenuItem', | |
| 4 | + functional: true, | |
| 5 | + props: { | |
| 6 | + icon: { | |
| 7 | + type: String, | |
| 8 | + default: '' | |
| 9 | + }, | |
| 10 | + title: { | |
| 11 | + type: String, | |
| 12 | + default: '' | |
| 13 | + } | |
| 14 | + }, | |
| 15 | + render(h, context) { | |
| 16 | + const { icon, title } = context.props | |
| 17 | + const vnodes = [] | |
| 18 | + | |
| 19 | + if (icon) { | |
| 20 | + if (icon.includes('el-icon')) { | |
| 21 | + vnodes.push(<i class={[icon, 'sub-el-icon']} />) | |
| 22 | + } else { | |
| 23 | + vnodes.push(<svg-icon icon-class={icon}/>) | |
| 24 | + } | |
| 25 | + } | |
| 26 | + | |
| 27 | + if (title) { | |
| 28 | + vnodes.push(<span slot='title'>{(title)}</span>) | |
| 29 | + } | |
| 30 | + return vnodes | |
| 31 | + } | |
| 32 | +} | |
| 33 | +</script> | |
| 34 | + | |
| 35 | +<style scoped> | |
| 36 | +.sub-el-icon { | |
| 37 | + color: currentColor; | |
| 38 | + width: 1em; | |
| 39 | + height: 1em; | |
| 40 | +} | |
| 41 | +</style> | ... | ... |
src/layout/components/Sidebar/Link.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <component :is="type" v-bind="linkProps(to)"> | |
| 3 | + <slot /> | |
| 4 | + </component> | |
| 5 | +</template> | |
| 6 | + | |
| 7 | +<script> | |
| 8 | +import { isExternal } from '@/utils/validate' | |
| 9 | + | |
| 10 | +export default { | |
| 11 | + props: { | |
| 12 | + to: { | |
| 13 | + type: String, | |
| 14 | + required: true | |
| 15 | + } | |
| 16 | + }, | |
| 17 | + computed: { | |
| 18 | + isExternal() { | |
| 19 | + return isExternal(this.to) | |
| 20 | + }, | |
| 21 | + type() { | |
| 22 | + if (this.isExternal) { | |
| 23 | + return 'a' | |
| 24 | + } | |
| 25 | + return 'router-link' | |
| 26 | + } | |
| 27 | + }, | |
| 28 | + methods: { | |
| 29 | + linkProps(to) { | |
| 30 | + if (this.isExternal) { | |
| 31 | + return { | |
| 32 | + href: to, | |
| 33 | + target: '_blank', | |
| 34 | + rel: 'noopener' | |
| 35 | + } | |
| 36 | + } | |
| 37 | + return { | |
| 38 | + to: to | |
| 39 | + } | |
| 40 | + } | |
| 41 | + } | |
| 42 | +} | |
| 43 | +</script> | ... | ... |
src/layout/components/Sidebar/Logo.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="sidebar-logo-container" :class="{'collapse':collapse}"> | |
| 3 | + <transition name="sidebarLogoFade"> | |
| 4 | + <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/"> | |
| 5 | + <img v-if="logo" :src="logo" class="sidebar-logo"> | |
| 6 | + <h1 v-else class="sidebar-title">{{ title }} </h1> | |
| 7 | + </router-link> | |
| 8 | + <router-link v-else key="expand" class="sidebar-logo-link" to="/"> | |
| 9 | + <img v-if="logo" :src="logo" class="sidebar-logo"> | |
| 10 | + <h1 class="sidebar-title">{{ title }} </h1> | |
| 11 | + </router-link> | |
| 12 | + </transition> | |
| 13 | + </div> | |
| 14 | +</template> | |
| 15 | + | |
| 16 | +<script> | |
| 17 | +export default { | |
| 18 | + name: 'SidebarLogo', | |
| 19 | + props: { | |
| 20 | + collapse: { | |
| 21 | + type: Boolean, | |
| 22 | + required: true | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + data() { | |
| 26 | + return { | |
| 27 | + title: 'Vue Admin Template', | |
| 28 | + logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png' | |
| 29 | + } | |
| 30 | + } | |
| 31 | +} | |
| 32 | +</script> | |
| 33 | + | |
| 34 | +<style lang="scss" scoped> | |
| 35 | +.sidebarLogoFade-enter-active { | |
| 36 | + transition: opacity 1.5s; | |
| 37 | +} | |
| 38 | + | |
| 39 | +.sidebarLogoFade-enter, | |
| 40 | +.sidebarLogoFade-leave-to { | |
| 41 | + opacity: 0; | |
| 42 | +} | |
| 43 | + | |
| 44 | +.sidebar-logo-container { | |
| 45 | + position: relative; | |
| 46 | + width: 100%; | |
| 47 | + height: 50px; | |
| 48 | + line-height: 50px; | |
| 49 | + background: #2b2f3a; | |
| 50 | + text-align: center; | |
| 51 | + overflow: hidden; | |
| 52 | + | |
| 53 | + & .sidebar-logo-link { | |
| 54 | + height: 100%; | |
| 55 | + width: 100%; | |
| 56 | + | |
| 57 | + & .sidebar-logo { | |
| 58 | + width: 32px; | |
| 59 | + height: 32px; | |
| 60 | + vertical-align: middle; | |
| 61 | + margin-right: 12px; | |
| 62 | + } | |
| 63 | + | |
| 64 | + & .sidebar-title { | |
| 65 | + display: inline-block; | |
| 66 | + margin: 0; | |
| 67 | + color: #fff; | |
| 68 | + font-weight: 600; | |
| 69 | + line-height: 50px; | |
| 70 | + font-size: 14px; | |
| 71 | + font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif; | |
| 72 | + vertical-align: middle; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + &.collapse { | |
| 77 | + .sidebar-logo { | |
| 78 | + margin-right: 0px; | |
| 79 | + } | |
| 80 | + } | |
| 81 | +} | |
| 82 | +</style> | ... | ... |
src/layout/components/Sidebar/SidebarItem.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div v-if="!item.hidden"> | |
| 3 | + <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> | |
| 4 | + <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> | |
| 5 | + <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> | |
| 6 | + <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> | |
| 7 | + </el-menu-item> | |
| 8 | + </app-link> | |
| 9 | + </template> | |
| 10 | + | |
| 11 | + <el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body> | |
| 12 | + <template slot="title"> | |
| 13 | + <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> | |
| 14 | + </template> | |
| 15 | + <sidebar-item | |
| 16 | + v-for="child in item.children" | |
| 17 | + :key="child.path" | |
| 18 | + :is-nest="true" | |
| 19 | + :item="child" | |
| 20 | + :base-path="resolvePath(child.path)" | |
| 21 | + class="nest-menu" | |
| 22 | + /> | |
| 23 | + </el-submenu> | |
| 24 | + </div> | |
| 25 | +</template> | |
| 26 | + | |
| 27 | +<script> | |
| 28 | +import path from 'path' | |
| 29 | +import { isExternal } from '@/utils/validate' | |
| 30 | +import Item from './Item' | |
| 31 | +import AppLink from './Link' | |
| 32 | +import FixiOSBug from './FixiOSBug' | |
| 33 | + | |
| 34 | +export default { | |
| 35 | + name: 'SidebarItem', | |
| 36 | + components: { Item, AppLink }, | |
| 37 | + mixins: [FixiOSBug], | |
| 38 | + props: { | |
| 39 | + // route object | |
| 40 | + item: { | |
| 41 | + type: Object, | |
| 42 | + required: true | |
| 43 | + }, | |
| 44 | + isNest: { | |
| 45 | + type: Boolean, | |
| 46 | + default: false | |
| 47 | + }, | |
| 48 | + basePath: { | |
| 49 | + type: String, | |
| 50 | + default: '' | |
| 51 | + } | |
| 52 | + }, | |
| 53 | + data() { | |
| 54 | + // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237 | |
| 55 | + // TODO: refactor with render function | |
| 56 | + this.onlyOneChild = null | |
| 57 | + return {} | |
| 58 | + }, | |
| 59 | + methods: { | |
| 60 | + hasOneShowingChild(children = [], parent) { | |
| 61 | + const showingChildren = children.filter(item => { | |
| 62 | + if (item.hidden) { | |
| 63 | + return false | |
| 64 | + } else { | |
| 65 | + // Temp set(will be used if only has one showing child) | |
| 66 | + this.onlyOneChild = item | |
| 67 | + return true | |
| 68 | + } | |
| 69 | + }) | |
| 70 | + | |
| 71 | + // When there is only one child router, the child router is displayed by default | |
| 72 | + if (showingChildren.length === 1) { | |
| 73 | + return true | |
| 74 | + } | |
| 75 | + | |
| 76 | + // Show parent if there are no child router to display | |
| 77 | + if (showingChildren.length === 0) { | |
| 78 | + this.onlyOneChild = { ... parent, path: '', noShowingChildren: true } | |
| 79 | + return true | |
| 80 | + } | |
| 81 | + | |
| 82 | + return false | |
| 83 | + }, | |
| 84 | + resolvePath(routePath) { | |
| 85 | + if (isExternal(routePath)) { | |
| 86 | + return routePath | |
| 87 | + } | |
| 88 | + if (isExternal(this.basePath)) { | |
| 89 | + return this.basePath | |
| 90 | + } | |
| 91 | + return path.resolve(this.basePath, routePath) | |
| 92 | + } | |
| 93 | + } | |
| 94 | +} | |
| 95 | +</script> | ... | ... |
src/layout/components/Sidebar/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div :class="{'has-logo':showLogo}"> | |
| 3 | + <logo v-if="showLogo" :collapse="isCollapse" /> | |
| 4 | + <el-scrollbar wrap-class="scrollbar-wrapper"> | |
| 5 | + <el-menu | |
| 6 | + :default-active="activeMenu" | |
| 7 | + :collapse="isCollapse" | |
| 8 | + :background-color="variables.menuBg" | |
| 9 | + :text-color="variables.menuText" | |
| 10 | + :unique-opened="false" | |
| 11 | + :active-text-color="variables.menuActiveText" | |
| 12 | + :collapse-transition="false" | |
| 13 | + mode="vertical" | |
| 14 | + > | |
| 15 | + <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" v-if="haspermission(route)" /> | |
| 16 | + </el-menu> | |
| 17 | + </el-scrollbar> | |
| 18 | + </div> | |
| 19 | +</template> | |
| 20 | + | |
| 21 | +<script> | |
| 22 | +import { mapGetters } from 'vuex' | |
| 23 | +import Logo from './Logo' | |
| 24 | +import SidebarItem from './SidebarItem' | |
| 25 | +import variables from '@/styles/variables.scss' | |
| 26 | +import {getUser} from '../../../utils/auth.js' | |
| 27 | +export default { | |
| 28 | + data(){ | |
| 29 | + return { | |
| 30 | + permission:this.$store.state.user.permissions | |
| 31 | + } | |
| 32 | + }, | |
| 33 | + methods:{ | |
| 34 | + haspermission(route){ | |
| 35 | + var show = true; | |
| 36 | + var permissions = this.permission; | |
| 37 | + // console.log('permission',permissions); | |
| 38 | + // console.log('meta',route.meta) | |
| 39 | + try{ | |
| 40 | + if(!permissions || !route.meta ) show = true; | |
| 41 | + else if(!route.meta.permissions) show = true; | |
| 42 | + else{ | |
| 43 | + | |
| 44 | + var tmp = false; | |
| 45 | + route.meta.permissions.forEach(item=>{ | |
| 46 | + tmp = permissions.includes(item); | |
| 47 | + }) | |
| 48 | + show = tmp; | |
| 49 | + | |
| 50 | + } | |
| 51 | + }catch(e){ | |
| 52 | + //TODO handle the exception | |
| 53 | + } | |
| 54 | + return show; | |
| 55 | + } | |
| 56 | + }, | |
| 57 | + components: { SidebarItem, Logo }, | |
| 58 | + computed: { | |
| 59 | + ...mapGetters([ | |
| 60 | + 'sidebar' | |
| 61 | + ]), | |
| 62 | + routes() { | |
| 63 | + return this.$router.options.routes | |
| 64 | + }, | |
| 65 | + activeMenu() { | |
| 66 | + const route = this.$route | |
| 67 | + const { meta, path } = route | |
| 68 | + // if set path, the sidebar will highlight the path you set | |
| 69 | + if (meta.activeMenu) { | |
| 70 | + return meta.activeMenu | |
| 71 | + } | |
| 72 | + return path | |
| 73 | + }, | |
| 74 | + showLogo() { | |
| 75 | + return this.$store.state.settings.sidebarLogo | |
| 76 | + }, | |
| 77 | + variables() { | |
| 78 | + return variables | |
| 79 | + }, | |
| 80 | + isCollapse() { | |
| 81 | + return !this.sidebar.opened | |
| 82 | + }, | |
| 83 | + }, | |
| 84 | + created() { | |
| 85 | + } | |
| 86 | +} | |
| 87 | +</script> | ... | ... |
src/layout/components/index.js
0 → 100644
src/layout/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div :class="classObj" class="app-wrapper"> | |
| 3 | + <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> | |
| 4 | + <sidebar class="sidebar-container" /> | |
| 5 | + <div class="main-container"> | |
| 6 | + <div :class="{'fixed-header':fixedHeader}"> | |
| 7 | + <navbar /> | |
| 8 | + </div> | |
| 9 | + <app-main /> | |
| 10 | + </div> | |
| 11 | + </div> | |
| 12 | +</template> | |
| 13 | + | |
| 14 | +<script> | |
| 15 | +import { Navbar, Sidebar, AppMain } from './components' | |
| 16 | +import ResizeMixin from './mixin/ResizeHandler' | |
| 17 | + | |
| 18 | +export default { | |
| 19 | + name: 'Layout', | |
| 20 | + components: { | |
| 21 | + Navbar, | |
| 22 | + Sidebar, | |
| 23 | + AppMain | |
| 24 | + }, | |
| 25 | + mixins: [ResizeMixin], | |
| 26 | + computed: { | |
| 27 | + sidebar() { | |
| 28 | + return this.$store.state.app.sidebar | |
| 29 | + }, | |
| 30 | + device() { | |
| 31 | + return this.$store.state.app.device | |
| 32 | + }, | |
| 33 | + fixedHeader() { | |
| 34 | + return this.$store.state.settings.fixedHeader | |
| 35 | + }, | |
| 36 | + classObj() { | |
| 37 | + return { | |
| 38 | + hideSidebar: !this.sidebar.opened, | |
| 39 | + openSidebar: this.sidebar.opened, | |
| 40 | + withoutAnimation: this.sidebar.withoutAnimation, | |
| 41 | + mobile: this.device === 'mobile' | |
| 42 | + } | |
| 43 | + } | |
| 44 | + }, | |
| 45 | + methods: { | |
| 46 | + handleClickOutside() { | |
| 47 | + this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} | |
| 51 | +</script> | |
| 52 | + | |
| 53 | +<style lang="scss" scoped> | |
| 54 | + @import "~@/styles/mixin.scss"; | |
| 55 | + @import "~@/styles/variables.scss"; | |
| 56 | + | |
| 57 | + .app-wrapper { | |
| 58 | + @include clearfix; | |
| 59 | + position: relative; | |
| 60 | + height: 100%; | |
| 61 | + width: 100%; | |
| 62 | + &.mobile.openSidebar{ | |
| 63 | + position: fixed; | |
| 64 | + top: 0; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + .drawer-bg { | |
| 68 | + background: #000; | |
| 69 | + opacity: 0.3; | |
| 70 | + width: 100%; | |
| 71 | + top: 0; | |
| 72 | + height: 100%; | |
| 73 | + position: absolute; | |
| 74 | + z-index: 999; | |
| 75 | + } | |
| 76 | + | |
| 77 | + .fixed-header { | |
| 78 | + position: fixed; | |
| 79 | + top: 0; | |
| 80 | + right: 0; | |
| 81 | + z-index: 9; | |
| 82 | + width: calc(100% - #{$sideBarWidth}); | |
| 83 | + transition: width 0.28s; | |
| 84 | + } | |
| 85 | + | |
| 86 | + .hideSidebar .fixed-header { | |
| 87 | + width: calc(100% - 54px) | |
| 88 | + } | |
| 89 | + | |
| 90 | + .mobile .fixed-header { | |
| 91 | + width: 100%; | |
| 92 | + } | |
| 93 | +</style> | ... | ... |
src/layout/mixin/ResizeHandler.js
0 → 100644
| 1 | +import store from '@/store' | |
| 2 | + | |
| 3 | +const { body } = document | |
| 4 | +const WIDTH = 992 // refer to Bootstrap's responsive design | |
| 5 | + | |
| 6 | +export default { | |
| 7 | + watch: { | |
| 8 | + $route(route) { | |
| 9 | + if (this.device === 'mobile' && this.sidebar.opened) { | |
| 10 | + store.dispatch('app/closeSideBar', { withoutAnimation: false }) | |
| 11 | + } | |
| 12 | + } | |
| 13 | + }, | |
| 14 | + beforeMount() { | |
| 15 | + window.addEventListener('resize', this.$_resizeHandler) | |
| 16 | + }, | |
| 17 | + beforeDestroy() { | |
| 18 | + window.removeEventListener('resize', this.$_resizeHandler) | |
| 19 | + }, | |
| 20 | + mounted() { | |
| 21 | + const isMobile = this.$_isMobile() | |
| 22 | + if (isMobile) { | |
| 23 | + store.dispatch('app/toggleDevice', 'mobile') | |
| 24 | + store.dispatch('app/closeSideBar', { withoutAnimation: true }) | |
| 25 | + } | |
| 26 | + }, | |
| 27 | + methods: { | |
| 28 | + // use $_ for mixins properties | |
| 29 | + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential | |
| 30 | + $_isMobile() { | |
| 31 | + const rect = body.getBoundingClientRect() | |
| 32 | + return rect.width - 1 < WIDTH | |
| 33 | + }, | |
| 34 | + $_resizeHandler() { | |
| 35 | + if (!document.hidden) { | |
| 36 | + const isMobile = this.$_isMobile() | |
| 37 | + store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') | |
| 38 | + | |
| 39 | + if (isMobile) { | |
| 40 | + store.dispatch('app/closeSideBar', { withoutAnimation: true }) | |
| 41 | + } | |
| 42 | + } | |
| 43 | + } | |
| 44 | + } | |
| 45 | +} | ... | ... |
src/main.js
0 → 100644
| 1 | +import Vue from 'vue' | |
| 2 | + | |
| 3 | +import 'normalize.css/normalize.css' // A modern alternative to CSS resets | |
| 4 | + | |
| 5 | +import ElementUI from 'element-ui' | |
| 6 | +import 'element-ui/lib/theme-chalk/index.css' | |
| 7 | +import locale from 'element-ui/lib/locale/lang/en' // lang i18n | |
| 8 | + | |
| 9 | +import '@/styles/index.scss' // global css | |
| 10 | + | |
| 11 | +import App from './App' | |
| 12 | +import store from './store' | |
| 13 | +import router from './router' | |
| 14 | + | |
| 15 | +import '@/icons' // icon | |
| 16 | +import '@/permission' // permission control | |
| 17 | + | |
| 18 | +// 引入富文本组件 | |
| 19 | +import QuillEditor from 'vue-quill-editor' | |
| 20 | +// 引入富文本组件样式 | |
| 21 | +import 'quill/dist/quill.core.css' | |
| 22 | +import 'quill/dist/quill.snow.css' | |
| 23 | +import 'quill/dist/quill.bubble.css' | |
| 24 | + | |
| 25 | +Vue.use(QuillEditor) | |
| 26 | +/** | |
| 27 | + * If you don't want to use mock-server | |
| 28 | + * you want to use MockJs for mock api | |
| 29 | + * you can execute: mockXHR() | |
| 30 | + * | |
| 31 | + * Currently MockJs will be used in the production environment, | |
| 32 | + * please remove it before going online ! ! ! | |
| 33 | + */ | |
| 34 | +if (process.env.NODE_ENV === 'production') { | |
| 35 | + const { | |
| 36 | + mockXHR | |
| 37 | + } = require('../mock') | |
| 38 | + mockXHR() | |
| 39 | +} | |
| 40 | + | |
| 41 | +// set ElementUI lang to EN | |
| 42 | +//Vue.use(ElementUI, { locale }) | |
| 43 | +// 如果想要中文版 element-ui,按如下方式声明 | |
| 44 | +Vue.use(ElementUI) | |
| 45 | + | |
| 46 | +Vue.config.productionTip = false | |
| 47 | + | |
| 48 | + | |
| 49 | +Vue.component('remote-script', { | |
| 50 | + | |
| 51 | + render: function(createElement) { | |
| 52 | + var self = this; | |
| 53 | + return createElement('script', { | |
| 54 | + attrs: { | |
| 55 | + type: 'text/javascript', | |
| 56 | + src: this.src | |
| 57 | + }, | |
| 58 | + on: { | |
| 59 | + load: function(event) { | |
| 60 | + self.$emit('load', event); | |
| 61 | + }, | |
| 62 | + error: function(event) { | |
| 63 | + self.$emit('error', event); | |
| 64 | + }, | |
| 65 | + readystatechange: function(event) { | |
| 66 | + if (this.readyState == 'complete') { | |
| 67 | + self.$emit('load', event); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + } | |
| 71 | + }); | |
| 72 | + }, | |
| 73 | + | |
| 74 | + props: { | |
| 75 | + src: { | |
| 76 | + type: String, | |
| 77 | + required: true | |
| 78 | + } | |
| 79 | + } | |
| 80 | +}); | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | +new Vue({ | |
| 85 | + el: '#app', | |
| 86 | + router, | |
| 87 | + store, | |
| 88 | + render: h => h(App), | |
| 89 | + components: { | |
| 90 | + App | |
| 91 | + }, | |
| 92 | + template: '<App/>' | |
| 93 | + | |
| 94 | + | |
| 95 | +}) | ... | ... |
src/permission.js
0 → 100644
| 1 | +import router from './router' | |
| 2 | +import store from './store' | |
| 3 | +import { Message } from 'element-ui' | |
| 4 | +import NProgress from 'nprogress' // progress bar | |
| 5 | +import 'nprogress/nprogress.css' // progress bar style | |
| 6 | +import { getToken } from '@/utils/auth' // get token from cookie | |
| 7 | +import getPageTitle from '@/utils/get-page-title' | |
| 8 | + | |
| 9 | +NProgress.configure({ showSpinner: false }) // NProgress Configuration | |
| 10 | + | |
| 11 | +const whiteList = ['/login','/externalInfo'] // no redirect whitelist | |
| 12 | + | |
| 13 | +router.beforeEach(async(to, from, next) => { | |
| 14 | + // start progress bar | |
| 15 | + NProgress.start() | |
| 16 | + | |
| 17 | + // set page title | |
| 18 | + document.title = getPageTitle(to.meta.title) | |
| 19 | + | |
| 20 | + // determine whether the user has logged in | |
| 21 | + const hasToken = getToken() | |
| 22 | + | |
| 23 | + if (hasToken) { | |
| 24 | + if (to.path === '/login') { | |
| 25 | + // if is logged in, redirect to the home page | |
| 26 | + next({ path: '/' }) | |
| 27 | + NProgress.done() | |
| 28 | + } else { | |
| 29 | + const hasGetUserInfo = store.getters.name | |
| 30 | + if (hasGetUserInfo) { | |
| 31 | + next() | |
| 32 | + } else { | |
| 33 | + try { | |
| 34 | + // get user info | |
| 35 | + await store.dispatch('user/getInfo') | |
| 36 | + | |
| 37 | + next() | |
| 38 | + } catch (error) { | |
| 39 | + // remove token and go to login page to re-login | |
| 40 | + await store.dispatch('user/resetToken') | |
| 41 | + Message({ | |
| 42 | + message: error.message, | |
| 43 | + type: 'Has Error', | |
| 44 | + duration: 5 * 1000 | |
| 45 | + }) | |
| 46 | + next(`/login?redirect=${to.path}`) | |
| 47 | + NProgress.done() | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | + } else { | |
| 52 | + /* has no token*/ | |
| 53 | + | |
| 54 | + if (whiteList.indexOf(to.path) !== -1) { | |
| 55 | + // in the free login whitelist, go directly | |
| 56 | + next() | |
| 57 | + } else { | |
| 58 | + // other pages that do not have permission to access are redirected to the login page. | |
| 59 | + next(`/login?redirect=${to.path}`) | |
| 60 | + NProgress.done() | |
| 61 | + } | |
| 62 | + } | |
| 63 | +}) | |
| 64 | + | |
| 65 | +router.afterEach(() => { | |
| 66 | + // finish progress bar | |
| 67 | + NProgress.done() | |
| 68 | +}) | ... | ... |
src/router/index.js
0 → 100644
| 1 | +import Vue from 'vue' | |
| 2 | +import Router from 'vue-router' | |
| 3 | + | |
| 4 | +Vue.use(Router) | |
| 5 | + | |
| 6 | +/* Layout */ | |
| 7 | +import Layout from '@/layout' | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Note: sub-menu only appear when route children.length >= 1 | |
| 11 | + * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html | |
| 12 | + * | |
| 13 | + * hidden: true if set true, item will not show in the sidebar(default is false) | |
| 14 | + * alwaysShow: true if set true, will always show the root menu | |
| 15 | + * if not set alwaysShow, when item has more than one children route, | |
| 16 | + * it will becomes nested mode, otherwise not show the root menu | |
| 17 | + * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb | |
| 18 | + * name:'router-name' the name is used by <keep-alive> (must set!!!) | |
| 19 | + * meta : { | |
| 20 | + roles: ['admin','editor'] control the page roles (you can set multiple roles) | |
| 21 | + title: 'title' the name show in sidebar and breadcrumb (recommend set) | |
| 22 | + icon: 'svg-name'/'el-icon-x' the icon show in the sidebar | |
| 23 | + breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) | |
| 24 | + activeMenu: '/example/list' if set path, the sidebar will highlight the path you set | |
| 25 | + } | |
| 26 | + */ | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * constantRoutes | |
| 30 | + * a base page that does not have permission requirements | |
| 31 | + * all roles can be accessed | |
| 32 | + */ | |
| 33 | +export const constantRoutes = [{ | |
| 34 | + path: '/login', | |
| 35 | + component: () => import('@/views/login/index'), | |
| 36 | + hidden: true | |
| 37 | + }, | |
| 38 | + | |
| 39 | + { | |
| 40 | + path: '/404', | |
| 41 | + component: () => import('@/views/404'), | |
| 42 | + hidden: true | |
| 43 | + }, | |
| 44 | + | |
| 45 | + { | |
| 46 | + path: '/externalInfo', | |
| 47 | + component: () => import('@/views/externalInfo/externalInfo'), | |
| 48 | + hidden: true | |
| 49 | + }, | |
| 50 | + | |
| 51 | + | |
| 52 | + { | |
| 53 | + path: '/', | |
| 54 | + component: Layout, | |
| 55 | + redirect: '/dashboard', | |
| 56 | + children: [{ | |
| 57 | + path: 'dashboard', | |
| 58 | + name: '首页', | |
| 59 | + component: () => import('@/views/dashboard/index'), | |
| 60 | + meta: { | |
| 61 | + title: '首页', | |
| 62 | + icon: 'dashboard' | |
| 63 | + } | |
| 64 | + }] | |
| 65 | + }, | |
| 66 | + | |
| 67 | + | |
| 68 | + { | |
| 69 | + path: '/promotelinks', | |
| 70 | + component: () => import('@/views/promotelinks/promotelinks'), | |
| 71 | + hidden: true | |
| 72 | + }, | |
| 73 | + | |
| 74 | + | |
| 75 | + { | |
| 76 | + path: '/user', | |
| 77 | + component: Layout, | |
| 78 | + redirect: '/user', | |
| 79 | + name: '用户管理', | |
| 80 | + meta: { | |
| 81 | + title: '用户管理', | |
| 82 | + icon: 'el-icon-s-help' | |
| 83 | + }, | |
| 84 | + children: [{ | |
| 85 | + path: 'map', | |
| 86 | + name: 'Table', | |
| 87 | + component: () => import('@/views/user/index'), | |
| 88 | + meta: { | |
| 89 | + title: '所有用户', | |
| 90 | + icon: 'table' | |
| 91 | + } | |
| 92 | + }, | |
| 93 | + { | |
| 94 | + path: 'managerTable', | |
| 95 | + name: 'manager', | |
| 96 | + component: () => import('@/views/user/managerTable'), | |
| 97 | + meta: { | |
| 98 | + title: '客户经理', | |
| 99 | + icon: 'table' | |
| 100 | + } | |
| 101 | + }, | |
| 102 | + { | |
| 103 | + path: 'manager', | |
| 104 | + name: 'manager', | |
| 105 | + component: () => import('@/views/user/manager'), | |
| 106 | + meta: { | |
| 107 | + title: '客户经理下级', | |
| 108 | + icon: 'table' | |
| 109 | + } | |
| 110 | + }, | |
| 111 | + { | |
| 112 | + path: 'commissioner', | |
| 113 | + name: 'manager', | |
| 114 | + component: () => import('@/views/user/commissioner'), | |
| 115 | + meta: { | |
| 116 | + title: '推广专员下级', | |
| 117 | + icon: 'table' | |
| 118 | + } | |
| 119 | + } | |
| 120 | + ] | |
| 121 | + }, | |
| 122 | + // appointment | |
| 123 | + { | |
| 124 | + path: '/appointment', | |
| 125 | + component: Layout, | |
| 126 | + redirect: '/appointment', | |
| 127 | + children: [{ | |
| 128 | + path: 'appointment', | |
| 129 | + name: '预约管理', | |
| 130 | + component: () => import('@/views/appointment/appointment'), | |
| 131 | + meta: { | |
| 132 | + title: '预约管理', | |
| 133 | + icon: 'el-icon-s-help' | |
| 134 | + } | |
| 135 | + }] | |
| 136 | + }, | |
| 137 | + | |
| 138 | + { | |
| 139 | + path: '/appointByUserId', | |
| 140 | + component: Layout, | |
| 141 | + redirect: '/appointByUserId', | |
| 142 | + children: [{ | |
| 143 | + path: 'appointByUserId', | |
| 144 | + name: '查询预约', | |
| 145 | + component: () => import('@/views/appointByUserId/appointByUserId'), | |
| 146 | + meta: { | |
| 147 | + title: '查询预约', | |
| 148 | + icon: 'el-icon-s-help', | |
| 149 | + } | |
| 150 | + }] | |
| 151 | + }, | |
| 152 | + { | |
| 153 | + path: '/AdminManage', | |
| 154 | + component: Layout, | |
| 155 | + redirect: '/AdminManage', | |
| 156 | + meta:{ | |
| 157 | + permissions:['admin']// | |
| 158 | + }, | |
| 159 | + children: [{ | |
| 160 | + path: 'AdminManage', | |
| 161 | + name: '管理员管理', | |
| 162 | + component: () => import('@/views/AdminManage/AdminManage'), | |
| 163 | + meta: { | |
| 164 | + title: '管理员管理', | |
| 165 | + icon: 'el-icon-s-help', | |
| 166 | + // hidden:true | |
| 167 | + } | |
| 168 | + }] | |
| 169 | + }, | |
| 170 | + // 推广链接 | |
| 171 | + // { | |
| 172 | + // path: '/promotelinks', | |
| 173 | + // component: Layout, | |
| 174 | + // redirect: '/promotelinks', | |
| 175 | + // children: [{ | |
| 176 | + // path: 'promotelinks', | |
| 177 | + // name: '推广链接', | |
| 178 | + // component: () => import('@/views/promotelinks/promotelinks'), | |
| 179 | + // meta: { | |
| 180 | + // title: '推广链接', | |
| 181 | + // icon: 'el-icon-s-help' | |
| 182 | + // } | |
| 183 | + // }] | |
| 184 | + // }, | |
| 185 | + // 提现管理 | |
| 186 | + { | |
| 187 | + path: '/moneys', | |
| 188 | + component: Layout, | |
| 189 | + redirect: '/moneys', | |
| 190 | + children: [{ | |
| 191 | + path: 'moneys', | |
| 192 | + name: '提现管理', | |
| 193 | + component: () => import('@/views/moneys/moneys'), | |
| 194 | + meta: { | |
| 195 | + title: '提现管理', | |
| 196 | + icon: 'el-icon-s-help' | |
| 197 | + } | |
| 198 | + }] | |
| 199 | + }, | |
| 200 | + // 外部数据 | |
| 201 | + // { | |
| 202 | + // path: '/externalInfo', | |
| 203 | + // component: Layout, | |
| 204 | + // redirect: '/externalInfo', | |
| 205 | + // children: [{ | |
| 206 | + // path: 'externalInfo', | |
| 207 | + // name: '外部数据', | |
| 208 | + // component: () => import('@/views/externalInfo/externalInfo'), | |
| 209 | + // meta: { | |
| 210 | + // title: '外部数据', | |
| 211 | + // icon: 'el-icon-s-help' | |
| 212 | + // } | |
| 213 | + // }] | |
| 214 | + // }, | |
| 215 | + { | |
| 216 | + path: '/comment', | |
| 217 | + component: Layout, | |
| 218 | + redirect: '/comment', | |
| 219 | + children: [{ | |
| 220 | + path: 'comment', | |
| 221 | + name: '评价管理', | |
| 222 | + component: () => import('@/views/comment/comment'), | |
| 223 | + meta: { | |
| 224 | + title: '评价管理', | |
| 225 | + icon: 'el-icon-s-help' | |
| 226 | + } | |
| 227 | + }] | |
| 228 | + }, | |
| 229 | + | |
| 230 | + // record | |
| 231 | + { | |
| 232 | + path: '/record', | |
| 233 | + component: Layout, | |
| 234 | + redirect: '/record', | |
| 235 | + children: [{ | |
| 236 | + path: 'record', | |
| 237 | + name: '领取记录11', | |
| 238 | + component: () => import('@/views/record/record'), | |
| 239 | + meta: { | |
| 240 | + title: '领取产品记录', | |
| 241 | + icon: 'el-icon-s-help' | |
| 242 | + } | |
| 243 | + }] | |
| 244 | + }, | |
| 245 | + // 合伙人 | |
| 246 | + { | |
| 247 | + path: '/partner', | |
| 248 | + component: Layout, | |
| 249 | + redirect: '/partner', | |
| 250 | + children: [{ | |
| 251 | + path: 'partner', | |
| 252 | + name: '合伙人管理', | |
| 253 | + component: () => import('@/views/partner/partner'), | |
| 254 | + meta: { | |
| 255 | + title: '合伙人管理', | |
| 256 | + icon: 'el-icon-s-help' | |
| 257 | + } | |
| 258 | + }] | |
| 259 | + }, | |
| 260 | + // deposit | |
| 261 | + // { | |
| 262 | + // path: '/deposit', | |
| 263 | + // component: Layout, | |
| 264 | + // redirect: '/deposit', | |
| 265 | + // children: [{ | |
| 266 | + // path: 'deposit', | |
| 267 | + // name: '提现管理', | |
| 268 | + // component: () => import('@/views/deposit/deposit'), | |
| 269 | + // meta: { | |
| 270 | + // title: '提现管理', | |
| 271 | + // icon: 'deposit' | |
| 272 | + // } | |
| 273 | + // }] | |
| 274 | + // }, | |
| 275 | + // // promotion | |
| 276 | + // { | |
| 277 | + // path: '/promotion', | |
| 278 | + // component: Layout, | |
| 279 | + // redirect: '/promotion', | |
| 280 | + // children: [{ | |
| 281 | + // path: 'promotion', | |
| 282 | + // name: '推广管理', | |
| 283 | + // component: () => import('@/views/promotion/promotion'), | |
| 284 | + // meta: { | |
| 285 | + // title: '推广管理', | |
| 286 | + // icon: 'promotion' | |
| 287 | + // } | |
| 288 | + // }] | |
| 289 | + // }, | |
| 290 | + | |
| 291 | + { | |
| 292 | + path: '/system', | |
| 293 | + component: Layout, | |
| 294 | + redirect: '/system', | |
| 295 | + name: '系统设置', | |
| 296 | + meta: { | |
| 297 | + title: '系统设置', | |
| 298 | + icon: 'el-icon-s-help' | |
| 299 | + }, | |
| 300 | + children: [{ | |
| 301 | + path: 'map', | |
| 302 | + name: 'Table', | |
| 303 | + component: () => import('@/views/system/map'), | |
| 304 | + meta: { | |
| 305 | + title: '服务范围设置', | |
| 306 | + icon: 'table' | |
| 307 | + } | |
| 308 | + }, | |
| 309 | + { | |
| 310 | + path: 'calendar', | |
| 311 | + name: 'calendar', | |
| 312 | + component: () => import('@/views/system/calendar'), | |
| 313 | + meta: { | |
| 314 | + title: '可预约时间设置', | |
| 315 | + icon: 'table' | |
| 316 | + } | |
| 317 | + }, | |
| 318 | + { | |
| 319 | + path: 'updpassword', | |
| 320 | + name: 'updpassword', | |
| 321 | + component: () => import('@/views/system/updpassword'), | |
| 322 | + meta: { | |
| 323 | + title: '密码修改', | |
| 324 | + icon: 'table' | |
| 325 | + } | |
| 326 | + }, | |
| 327 | + { | |
| 328 | + path: 'robot', | |
| 329 | + name: 'robot', | |
| 330 | + component: () => import('@/views/system/robot'), | |
| 331 | + meta: { | |
| 332 | + title: '滚屏设置', | |
| 333 | + icon: 'table' | |
| 334 | + } | |
| 335 | + }, | |
| 336 | + { | |
| 337 | + path: 'deduct', | |
| 338 | + name: 'deduct', | |
| 339 | + component: () => import('@/views/system/deduct'), | |
| 340 | + meta: { | |
| 341 | + title: '提成计算', | |
| 342 | + icon: 'table' | |
| 343 | + } | |
| 344 | + }, | |
| 345 | + // { | |
| 346 | + // path: 'introduce', | |
| 347 | + // name: 'introduce', | |
| 348 | + // component: () => import('@/views/system/introduce'), | |
| 349 | + // meta: { | |
| 350 | + // title: '介绍设置', | |
| 351 | + // icon: 'table' | |
| 352 | + // } | |
| 353 | + // }, | |
| 354 | + // rulesstr | |
| 355 | + { | |
| 356 | + path: 'rulesstr', | |
| 357 | + name: 'rulesstr', | |
| 358 | + component: () => import('@/views/system/rulesstr'), | |
| 359 | + meta: { | |
| 360 | + title: '补贴规则设置', | |
| 361 | + icon: 'table' | |
| 362 | + } | |
| 363 | + }, | |
| 364 | + { | |
| 365 | + path: 'missionNum', | |
| 366 | + name: 'missionNum', | |
| 367 | + component: () => import('@/views/system/missionNum'), | |
| 368 | + meta: { | |
| 369 | + title: '任务单量设置', | |
| 370 | + icon: 'table' | |
| 371 | + } | |
| 372 | + }, | |
| 373 | + // meal | |
| 374 | + { | |
| 375 | + path: 'meal', | |
| 376 | + name: 'meal', | |
| 377 | + component: () => import('@/views/system/meal'), | |
| 378 | + meta: { | |
| 379 | + title: '首页广告设置', | |
| 380 | + icon: 'table' | |
| 381 | + } | |
| 382 | + }, | |
| 383 | + // subscribe | |
| 384 | + // { | |
| 385 | + // path: 'subscribe', | |
| 386 | + // name: 'subscribe', | |
| 387 | + // component: () => import('@/views/system/subscribe'), | |
| 388 | + // meta: { | |
| 389 | + // title: '预约谈目', | |
| 390 | + // icon: 'table' | |
| 391 | + // } | |
| 392 | + // }, | |
| 393 | + ] | |
| 394 | + }, | |
| 395 | + // 404 page must be placed at the end !!! | |
| 396 | + { | |
| 397 | + path: '*', | |
| 398 | + redirect: '/404', | |
| 399 | + hidden: true | |
| 400 | + } | |
| 401 | +] | |
| 402 | + | |
| 403 | +const createRouter = () => new Router({ | |
| 404 | + // mode: 'history', // require service support | |
| 405 | + scrollBehavior: () => ({ | |
| 406 | + y: 0 | |
| 407 | + }), | |
| 408 | + routes: constantRoutes | |
| 409 | +}) | |
| 410 | + | |
| 411 | +const router = createRouter() | |
| 412 | + | |
| 413 | +// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 | |
| 414 | +export function resetRouter() { | |
| 415 | + const newRouter = createRouter() | |
| 416 | + router.matcher = newRouter.matcher // reset router | |
| 417 | +} | |
| 418 | + | |
| 419 | +export default router | ... | ... |
src/settings.js
0 → 100644
| 1 | +module.exports = { | |
| 2 | + | |
| 3 | + title: '尚腾汽车养护管家', | |
| 4 | + | |
| 5 | + /** | |
| 6 | + * @type {boolean} true | false | |
| 7 | + * @description Whether fix the header | |
| 8 | + */ | |
| 9 | + fixedHeader: false, | |
| 10 | + | |
| 11 | + /** | |
| 12 | + * @type {boolean} true | false | |
| 13 | + * @description Whether show the logo in sidebar | |
| 14 | + */ | |
| 15 | + sidebarLogo: false | |
| 16 | +} | ... | ... |
src/store/getters.js
0 → 100644
src/store/index.js
0 → 100644
| 1 | +import Vue from 'vue' | |
| 2 | +import Vuex from 'vuex' | |
| 3 | +import getters from './getters' | |
| 4 | +import app from './modules/app' | |
| 5 | +import settings from './modules/settings' | |
| 6 | +import user from './modules/user' | |
| 7 | + | |
| 8 | +Vue.use(Vuex) | |
| 9 | + | |
| 10 | +const store = new Vuex.Store({ | |
| 11 | + modules: { | |
| 12 | + app, | |
| 13 | + settings, | |
| 14 | + user | |
| 15 | + }, | |
| 16 | + getters | |
| 17 | +}) | |
| 18 | + | |
| 19 | +export default store | ... | ... |
src/store/modules/app.js
0 → 100644
| 1 | +import Cookies from 'js-cookie' | |
| 2 | + | |
| 3 | +const state = { | |
| 4 | + sidebar: { | |
| 5 | + opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, | |
| 6 | + withoutAnimation: false | |
| 7 | + }, | |
| 8 | + device: 'desktop' | |
| 9 | +} | |
| 10 | + | |
| 11 | +const mutations = { | |
| 12 | + TOGGLE_SIDEBAR: state => { | |
| 13 | + state.sidebar.opened = !state.sidebar.opened | |
| 14 | + state.sidebar.withoutAnimation = false | |
| 15 | + if (state.sidebar.opened) { | |
| 16 | + Cookies.set('sidebarStatus', 1) | |
| 17 | + } else { | |
| 18 | + Cookies.set('sidebarStatus', 0) | |
| 19 | + } | |
| 20 | + }, | |
| 21 | + CLOSE_SIDEBAR: (state, withoutAnimation) => { | |
| 22 | + Cookies.set('sidebarStatus', 0) | |
| 23 | + state.sidebar.opened = false | |
| 24 | + state.sidebar.withoutAnimation = withoutAnimation | |
| 25 | + }, | |
| 26 | + TOGGLE_DEVICE: (state, device) => { | |
| 27 | + state.device = device | |
| 28 | + } | |
| 29 | +} | |
| 30 | + | |
| 31 | +const actions = { | |
| 32 | + toggleSideBar({ commit }) { | |
| 33 | + commit('TOGGLE_SIDEBAR') | |
| 34 | + }, | |
| 35 | + closeSideBar({ commit }, { withoutAnimation }) { | |
| 36 | + commit('CLOSE_SIDEBAR', withoutAnimation) | |
| 37 | + }, | |
| 38 | + toggleDevice({ commit }, device) { | |
| 39 | + commit('TOGGLE_DEVICE', device) | |
| 40 | + } | |
| 41 | +} | |
| 42 | + | |
| 43 | +export default { | |
| 44 | + namespaced: true, | |
| 45 | + state, | |
| 46 | + mutations, | |
| 47 | + actions | |
| 48 | +} | ... | ... |
src/store/modules/settings.js
0 → 100644
| 1 | +import defaultSettings from '@/settings' | |
| 2 | + | |
| 3 | +const { showSettings, fixedHeader, sidebarLogo } = defaultSettings | |
| 4 | + | |
| 5 | +const state = { | |
| 6 | + showSettings: showSettings, | |
| 7 | + fixedHeader: fixedHeader, | |
| 8 | + sidebarLogo: sidebarLogo | |
| 9 | +} | |
| 10 | + | |
| 11 | +const mutations = { | |
| 12 | + CHANGE_SETTING: (state, { key, value }) => { | |
| 13 | + // eslint-disable-next-line no-prototype-builtins | |
| 14 | + if (state.hasOwnProperty(key)) { | |
| 15 | + state[key] = value | |
| 16 | + } | |
| 17 | + } | |
| 18 | +} | |
| 19 | + | |
| 20 | +const actions = { | |
| 21 | + changeSetting({ commit }, data) { | |
| 22 | + commit('CHANGE_SETTING', data) | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | +export default { | |
| 27 | + namespaced: true, | |
| 28 | + state, | |
| 29 | + mutations, | |
| 30 | + actions | |
| 31 | +} | |
| 32 | + | ... | ... |
src/store/modules/user.js
0 → 100644
| 1 | +import { | |
| 2 | + login, | |
| 3 | + logout, | |
| 4 | + getInfo | |
| 5 | +} from '@/api/user' | |
| 6 | +import { | |
| 7 | + getToken, | |
| 8 | + setToken, | |
| 9 | + removeToken, | |
| 10 | + setUser, | |
| 11 | +} from '@/utils/auth' | |
| 12 | +import { | |
| 13 | + resetRouter | |
| 14 | +} from '@/router' | |
| 15 | + | |
| 16 | +const getDefaultState = () => { | |
| 17 | + return { | |
| 18 | + token: getToken(), | |
| 19 | + name: '', | |
| 20 | + avatar: '', | |
| 21 | + permissions:[] | |
| 22 | + } | |
| 23 | +} | |
| 24 | + | |
| 25 | +const state = getDefaultState() | |
| 26 | + | |
| 27 | +const mutations = { | |
| 28 | + RESET_STATE: (state) => { | |
| 29 | + Object.assign(state, getDefaultState()) | |
| 30 | + }, | |
| 31 | + SET_TOKEN: (state, token) => { | |
| 32 | + state.token = token | |
| 33 | + }, | |
| 34 | + SET_NAME: (state, name) => { | |
| 35 | + state.name = name | |
| 36 | + }, | |
| 37 | + SET_AVATAR: (state, avatar) => { | |
| 38 | + state.avatar = avatar | |
| 39 | + }, | |
| 40 | + SET_PERMISSIONS: (state, p) => { | |
| 41 | + state.permissions = p | |
| 42 | + } | |
| 43 | +} | |
| 44 | + | |
| 45 | +const actions = { | |
| 46 | + // user login | |
| 47 | + login({ | |
| 48 | + commit | |
| 49 | + }, userInfo) { | |
| 50 | + const { | |
| 51 | + username, | |
| 52 | + password | |
| 53 | + } = userInfo | |
| 54 | + return new Promise((resolve, reject) => { | |
| 55 | + login({ | |
| 56 | + username: username.trim(), | |
| 57 | + password: password | |
| 58 | + }).then(response => { | |
| 59 | + console.log(response.data.token) | |
| 60 | + const { | |
| 61 | + data | |
| 62 | + } = response | |
| 63 | + commit('Authorization', data.token) | |
| 64 | + let getUserRole =data.data.id | |
| 65 | + console.log('数据啊啊啊啊',getUserRole) | |
| 66 | + localStorage.setItem('userRole',getUserRole) | |
| 67 | + setToken(data.token) | |
| 68 | + resolve(data) | |
| 69 | + }).catch(error => { | |
| 70 | + reject(error) | |
| 71 | + }) | |
| 72 | + }) | |
| 73 | + }, | |
| 74 | + | |
| 75 | + // get user info | |
| 76 | + getInfo({ | |
| 77 | + commit, | |
| 78 | + state | |
| 79 | + }) { | |
| 80 | + return new Promise((resolve, reject) => { | |
| 81 | + getInfo().then(response => { | |
| 82 | + const { | |
| 83 | + data | |
| 84 | + } = response.data | |
| 85 | + if (!data) { | |
| 86 | + return reject('Verification failed, please Login again.') | |
| 87 | + } | |
| 88 | + const { | |
| 89 | + DisplayName, | |
| 90 | + avatar, | |
| 91 | + permissions | |
| 92 | + } = data | |
| 93 | + // console.log('数据info',data) | |
| 94 | + commit('SET_NAME', DisplayName) | |
| 95 | + commit('SET_AVATAR', avatar) | |
| 96 | + commit('SET_PERMISSIONS', permissions) | |
| 97 | + | |
| 98 | + resolve(data) | |
| 99 | + }).catch(error => { | |
| 100 | + reject(error) | |
| 101 | + }) | |
| 102 | + }) | |
| 103 | + }, | |
| 104 | + | |
| 105 | + | |
| 106 | + // user logout | |
| 107 | + logout({ | |
| 108 | + commit, | |
| 109 | + state | |
| 110 | + }) { | |
| 111 | + return new Promise((resolve, reject) => { | |
| 112 | + logout(state.token).then(() => { | |
| 113 | + removeToken() // must remove token first | |
| 114 | + resetRouter() | |
| 115 | + commit('RESET_STATE') | |
| 116 | + resolve() | |
| 117 | + }).catch(error => { | |
| 118 | + reject(error) | |
| 119 | + }) | |
| 120 | + }) | |
| 121 | + }, | |
| 122 | + | |
| 123 | + // remove token | |
| 124 | + resetToken({ | |
| 125 | + commit | |
| 126 | + }) { | |
| 127 | + return new Promise(resolve => { | |
| 128 | + removeToken() // must remove token first | |
| 129 | + commit('RESET_STATE') | |
| 130 | + resolve() | |
| 131 | + }) | |
| 132 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +export default { | |
| 136 | + namespaced: true, | |
| 137 | + state, | |
| 138 | + mutations, | |
| 139 | + actions | |
| 140 | +} | ... | ... |
src/styles/element-ui.scss
0 → 100644
| 1 | +// cover some element-ui styles | |
| 2 | + | |
| 3 | +.el-breadcrumb__inner, | |
| 4 | +.el-breadcrumb__inner a { | |
| 5 | + font-weight: 400 !important; | |
| 6 | +} | |
| 7 | + | |
| 8 | +.el-upload { | |
| 9 | + input[type="file"] { | |
| 10 | + display: none !important; | |
| 11 | + } | |
| 12 | +} | |
| 13 | + | |
| 14 | +.el-upload__input { | |
| 15 | + display: none; | |
| 16 | +} | |
| 17 | + | |
| 18 | + | |
| 19 | +// to fixed https://github.com/ElemeFE/element/issues/2461 | |
| 20 | +.el-dialog { | |
| 21 | + transform: none; | |
| 22 | + left: 0; | |
| 23 | + position: relative; | |
| 24 | + margin: 0 auto; | |
| 25 | +} | |
| 26 | + | |
| 27 | +// refine element ui upload | |
| 28 | +.upload-container { | |
| 29 | + .el-upload { | |
| 30 | + width: 100%; | |
| 31 | + | |
| 32 | + .el-upload-dragger { | |
| 33 | + width: 100%; | |
| 34 | + height: 200px; | |
| 35 | + } | |
| 36 | + } | |
| 37 | +} | |
| 38 | + | |
| 39 | +// dropdown | |
| 40 | +.el-dropdown-menu { | |
| 41 | + a { | |
| 42 | + display: block | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +// to fix el-date-picker css style | |
| 47 | +.el-range-separator { | |
| 48 | + box-sizing: content-box; | |
| 49 | +} | ... | ... |
src/styles/index.scss
0 → 100644
| 1 | +@import './variables.scss'; | |
| 2 | +@import './mixin.scss'; | |
| 3 | +@import './transition.scss'; | |
| 4 | +@import './element-ui.scss'; | |
| 5 | +@import './sidebar.scss'; | |
| 6 | + | |
| 7 | +body { | |
| 8 | + height: 100%; | |
| 9 | + -moz-osx-font-smoothing: grayscale; | |
| 10 | + -webkit-font-smoothing: antialiased; | |
| 11 | + text-rendering: optimizeLegibility; | |
| 12 | + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; | |
| 13 | +} | |
| 14 | + | |
| 15 | +label { | |
| 16 | + font-weight: 700; | |
| 17 | +} | |
| 18 | + | |
| 19 | +html { | |
| 20 | + height: 100%; | |
| 21 | + box-sizing: border-box; | |
| 22 | +} | |
| 23 | + | |
| 24 | +#app { | |
| 25 | + height: 100%; | |
| 26 | +} | |
| 27 | + | |
| 28 | +*, | |
| 29 | +*:before, | |
| 30 | +*:after { | |
| 31 | + box-sizing: inherit; | |
| 32 | +} | |
| 33 | + | |
| 34 | +a:focus, | |
| 35 | +a:active { | |
| 36 | + outline: none; | |
| 37 | +} | |
| 38 | + | |
| 39 | +a, | |
| 40 | +a:focus, | |
| 41 | +a:hover { | |
| 42 | + cursor: pointer; | |
| 43 | + color: inherit; | |
| 44 | + text-decoration: none; | |
| 45 | +} | |
| 46 | + | |
| 47 | +div:focus { | |
| 48 | + outline: none; | |
| 49 | +} | |
| 50 | + | |
| 51 | +.clearfix { | |
| 52 | + &:after { | |
| 53 | + visibility: hidden; | |
| 54 | + display: block; | |
| 55 | + font-size: 0; | |
| 56 | + content: " "; | |
| 57 | + clear: both; | |
| 58 | + height: 0; | |
| 59 | + } | |
| 60 | +} | |
| 61 | + | |
| 62 | +// main-container global css | |
| 63 | +.app-container { | |
| 64 | + padding: 20px; | |
| 65 | +} | ... | ... |
src/styles/mixin.scss
0 → 100644
| 1 | +@mixin clearfix { | |
| 2 | + &:after { | |
| 3 | + content: ""; | |
| 4 | + display: table; | |
| 5 | + clear: both; | |
| 6 | + } | |
| 7 | +} | |
| 8 | + | |
| 9 | +@mixin scrollBar { | |
| 10 | + &::-webkit-scrollbar-track-piece { | |
| 11 | + background: #d3dce6; | |
| 12 | + } | |
| 13 | + | |
| 14 | + &::-webkit-scrollbar { | |
| 15 | + width: 6px; | |
| 16 | + } | |
| 17 | + | |
| 18 | + &::-webkit-scrollbar-thumb { | |
| 19 | + background: #99a9bf; | |
| 20 | + border-radius: 20px; | |
| 21 | + } | |
| 22 | +} | |
| 23 | + | |
| 24 | +@mixin relative { | |
| 25 | + position: relative; | |
| 26 | + width: 100%; | |
| 27 | + height: 100%; | |
| 28 | +} | ... | ... |
src/styles/sidebar.scss
0 → 100644
| 1 | +#app { | |
| 2 | + | |
| 3 | + .main-container { | |
| 4 | + min-height: 100%; | |
| 5 | + transition: margin-left .28s; | |
| 6 | + margin-left: $sideBarWidth; | |
| 7 | + position: relative; | |
| 8 | + } | |
| 9 | + | |
| 10 | + .sidebar-container { | |
| 11 | + transition: width 0.28s; | |
| 12 | + width: $sideBarWidth !important; | |
| 13 | + background-color: $menuBg; | |
| 14 | + height: 100%; | |
| 15 | + position: fixed; | |
| 16 | + font-size: 0px; | |
| 17 | + top: 0; | |
| 18 | + bottom: 0; | |
| 19 | + left: 0; | |
| 20 | + z-index: 1001; | |
| 21 | + overflow: hidden; | |
| 22 | + | |
| 23 | + // reset element-ui css | |
| 24 | + .horizontal-collapse-transition { | |
| 25 | + transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; | |
| 26 | + } | |
| 27 | + | |
| 28 | + .scrollbar-wrapper { | |
| 29 | + overflow-x: hidden !important; | |
| 30 | + } | |
| 31 | + | |
| 32 | + .el-scrollbar__bar.is-vertical { | |
| 33 | + right: 0px; | |
| 34 | + } | |
| 35 | + | |
| 36 | + .el-scrollbar { | |
| 37 | + height: 100%; | |
| 38 | + } | |
| 39 | + | |
| 40 | + &.has-logo { | |
| 41 | + .el-scrollbar { | |
| 42 | + height: calc(100% - 50px); | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 46 | + .is-horizontal { | |
| 47 | + display: none; | |
| 48 | + } | |
| 49 | + | |
| 50 | + a { | |
| 51 | + display: inline-block; | |
| 52 | + width: 100%; | |
| 53 | + overflow: hidden; | |
| 54 | + } | |
| 55 | + | |
| 56 | + .svg-icon { | |
| 57 | + margin-right: 16px; | |
| 58 | + } | |
| 59 | + | |
| 60 | + .sub-el-icon { | |
| 61 | + margin-right: 12px; | |
| 62 | + margin-left: -2px; | |
| 63 | + } | |
| 64 | + | |
| 65 | + .el-menu { | |
| 66 | + border: none; | |
| 67 | + height: 100%; | |
| 68 | + width: 100% !important; | |
| 69 | + } | |
| 70 | + | |
| 71 | + // menu hover | |
| 72 | + .submenu-title-noDropdown, | |
| 73 | + .el-submenu__title { | |
| 74 | + &:hover { | |
| 75 | + background-color: $menuHover !important; | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + .is-active>.el-submenu__title { | |
| 80 | + color: $subMenuActiveText !important; | |
| 81 | + } | |
| 82 | + | |
| 83 | + & .nest-menu .el-submenu>.el-submenu__title, | |
| 84 | + & .el-submenu .el-menu-item { | |
| 85 | + min-width: $sideBarWidth !important; | |
| 86 | + background-color: $subMenuBg !important; | |
| 87 | + | |
| 88 | + &:hover { | |
| 89 | + background-color: $subMenuHover !important; | |
| 90 | + } | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + .hideSidebar { | |
| 95 | + .sidebar-container { | |
| 96 | + width: 54px !important; | |
| 97 | + } | |
| 98 | + | |
| 99 | + .main-container { | |
| 100 | + margin-left: 54px; | |
| 101 | + } | |
| 102 | + | |
| 103 | + .submenu-title-noDropdown { | |
| 104 | + padding: 0 !important; | |
| 105 | + position: relative; | |
| 106 | + | |
| 107 | + .el-tooltip { | |
| 108 | + padding: 0 !important; | |
| 109 | + | |
| 110 | + .svg-icon { | |
| 111 | + margin-left: 20px; | |
| 112 | + } | |
| 113 | + | |
| 114 | + .sub-el-icon { | |
| 115 | + margin-left: 19px; | |
| 116 | + } | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + .el-submenu { | |
| 121 | + overflow: hidden; | |
| 122 | + | |
| 123 | + &>.el-submenu__title { | |
| 124 | + padding: 0 !important; | |
| 125 | + | |
| 126 | + .svg-icon { | |
| 127 | + margin-left: 20px; | |
| 128 | + } | |
| 129 | + | |
| 130 | + .sub-el-icon { | |
| 131 | + margin-left: 19px; | |
| 132 | + } | |
| 133 | + | |
| 134 | + .el-submenu__icon-arrow { | |
| 135 | + display: none; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + .el-menu--collapse { | |
| 141 | + .el-submenu { | |
| 142 | + &>.el-submenu__title { | |
| 143 | + &>span { | |
| 144 | + height: 0; | |
| 145 | + width: 0; | |
| 146 | + overflow: hidden; | |
| 147 | + visibility: hidden; | |
| 148 | + display: inline-block; | |
| 149 | + } | |
| 150 | + } | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + .el-menu--collapse .el-menu .el-submenu { | |
| 156 | + min-width: $sideBarWidth !important; | |
| 157 | + } | |
| 158 | + | |
| 159 | + // mobile responsive | |
| 160 | + .mobile { | |
| 161 | + .main-container { | |
| 162 | + margin-left: 0px; | |
| 163 | + } | |
| 164 | + | |
| 165 | + .sidebar-container { | |
| 166 | + transition: transform .28s; | |
| 167 | + width: $sideBarWidth !important; | |
| 168 | + } | |
| 169 | + | |
| 170 | + &.hideSidebar { | |
| 171 | + .sidebar-container { | |
| 172 | + pointer-events: none; | |
| 173 | + transition-duration: 0.3s; | |
| 174 | + transform: translate3d(-$sideBarWidth, 0, 0); | |
| 175 | + } | |
| 176 | + } | |
| 177 | + } | |
| 178 | + | |
| 179 | + .withoutAnimation { | |
| 180 | + | |
| 181 | + .main-container, | |
| 182 | + .sidebar-container { | |
| 183 | + transition: none; | |
| 184 | + } | |
| 185 | + } | |
| 186 | +} | |
| 187 | + | |
| 188 | +// when menu collapsed | |
| 189 | +.el-menu--vertical { | |
| 190 | + &>.el-menu { | |
| 191 | + .svg-icon { | |
| 192 | + margin-right: 16px; | |
| 193 | + } | |
| 194 | + .sub-el-icon { | |
| 195 | + margin-right: 12px; | |
| 196 | + margin-left: -2px; | |
| 197 | + } | |
| 198 | + } | |
| 199 | + | |
| 200 | + .nest-menu .el-submenu>.el-submenu__title, | |
| 201 | + .el-menu-item { | |
| 202 | + &:hover { | |
| 203 | + // you can use $subMenuHover | |
| 204 | + background-color: $menuHover !important; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | + // the scroll bar appears when the subMenu is too long | |
| 209 | + >.el-menu--popup { | |
| 210 | + max-height: 100vh; | |
| 211 | + overflow-y: auto; | |
| 212 | + | |
| 213 | + &::-webkit-scrollbar-track-piece { | |
| 214 | + background: #d3dce6; | |
| 215 | + } | |
| 216 | + | |
| 217 | + &::-webkit-scrollbar { | |
| 218 | + width: 6px; | |
| 219 | + } | |
| 220 | + | |
| 221 | + &::-webkit-scrollbar-thumb { | |
| 222 | + background: #99a9bf; | |
| 223 | + border-radius: 20px; | |
| 224 | + } | |
| 225 | + } | |
| 226 | +} | ... | ... |
src/styles/transition.scss
0 → 100644
| 1 | +// global transition css | |
| 2 | + | |
| 3 | +/* fade */ | |
| 4 | +.fade-enter-active, | |
| 5 | +.fade-leave-active { | |
| 6 | + transition: opacity 0.28s; | |
| 7 | +} | |
| 8 | + | |
| 9 | +.fade-enter, | |
| 10 | +.fade-leave-active { | |
| 11 | + opacity: 0; | |
| 12 | +} | |
| 13 | + | |
| 14 | +/* fade-transform */ | |
| 15 | +.fade-transform-leave-active, | |
| 16 | +.fade-transform-enter-active { | |
| 17 | + transition: all .5s; | |
| 18 | +} | |
| 19 | + | |
| 20 | +.fade-transform-enter { | |
| 21 | + opacity: 0; | |
| 22 | + transform: translateX(-30px); | |
| 23 | +} | |
| 24 | + | |
| 25 | +.fade-transform-leave-to { | |
| 26 | + opacity: 0; | |
| 27 | + transform: translateX(30px); | |
| 28 | +} | |
| 29 | + | |
| 30 | +/* breadcrumb transition */ | |
| 31 | +.breadcrumb-enter-active, | |
| 32 | +.breadcrumb-leave-active { | |
| 33 | + transition: all .5s; | |
| 34 | +} | |
| 35 | + | |
| 36 | +.breadcrumb-enter, | |
| 37 | +.breadcrumb-leave-active { | |
| 38 | + opacity: 0; | |
| 39 | + transform: translateX(20px); | |
| 40 | +} | |
| 41 | + | |
| 42 | +.breadcrumb-move { | |
| 43 | + transition: all .5s; | |
| 44 | +} | |
| 45 | + | |
| 46 | +.breadcrumb-leave-active { | |
| 47 | + position: absolute; | |
| 48 | +} | ... | ... |
src/styles/variables.scss
0 → 100644
| 1 | +// sidebar | |
| 2 | +$menuText:#bfcbd9; | |
| 3 | +$menuActiveText:#409EFF; | |
| 4 | +$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 | |
| 5 | + | |
| 6 | +$menuBg:#304156; | |
| 7 | +$menuHover:#263445; | |
| 8 | + | |
| 9 | +$subMenuBg:#1f2d3d; | |
| 10 | +$subMenuHover:#001528; | |
| 11 | + | |
| 12 | +$sideBarWidth: 210px; | |
| 13 | + | |
| 14 | +// the :export directive is the magic sauce for webpack | |
| 15 | +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass | |
| 16 | +:export { | |
| 17 | + menuText: $menuText; | |
| 18 | + menuActiveText: $menuActiveText; | |
| 19 | + subMenuActiveText: $subMenuActiveText; | |
| 20 | + menuBg: $menuBg; | |
| 21 | + menuHover: $menuHover; | |
| 22 | + subMenuBg: $subMenuBg; | |
| 23 | + subMenuHover: $subMenuHover; | |
| 24 | + sideBarWidth: $sideBarWidth; | |
| 25 | +} | ... | ... |
src/utils/auth.js
0 → 100644
| 1 | +import Cookies from 'js-cookie' | |
| 2 | + | |
| 3 | +const TokenKey = 'vue_admin_template_token' | |
| 4 | +const UserInfo='User_Key' | |
| 5 | + | |
| 6 | +export function getToken() { | |
| 7 | + return Cookies.get(TokenKey) | |
| 8 | +} | |
| 9 | + | |
| 10 | +export function setToken(token) { | |
| 11 | + return Cookies.set(TokenKey, token) | |
| 12 | +} | |
| 13 | + | |
| 14 | +export function removeToken() { | |
| 15 | + return Cookies.remove(TokenKey) | |
| 16 | +} | |
| 17 | + | |
| 18 | +export function getUser(){ | |
| 19 | + return Cookies.get(UserInfo) | |
| 20 | +} | |
| 21 | +export function setUser(info){ | |
| 22 | + return Cookie.set(UserInfo,info) | |
| 23 | +} | |
| 24 | +export function removeUser(){ | |
| 25 | + return Cookies.remove(UserInfo) | |
| 26 | +} | ... | ... |
src/utils/get-page-title.js
0 → 100644
src/utils/index.js
0 → 100644
| 1 | +/** | |
| 2 | + * Created by PanJiaChen on 16/11/18. | |
| 3 | + */ | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Parse the time to string | |
| 7 | + * @param {(Object|string|number)} time | |
| 8 | + * @param {string} cFormat | |
| 9 | + * @returns {string | null} | |
| 10 | + */ | |
| 11 | +export function parseTime(time, cFormat) { | |
| 12 | + if (arguments.length === 0 || !time) { | |
| 13 | + return null | |
| 14 | + } | |
| 15 | + const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' | |
| 16 | + let date | |
| 17 | + if (typeof time === 'object') { | |
| 18 | + date = time | |
| 19 | + } else { | |
| 20 | + if ((typeof time === 'string')) { | |
| 21 | + if ((/^[0-9]+$/.test(time))) { | |
| 22 | + // support "1548221490638" | |
| 23 | + time = parseInt(time) | |
| 24 | + } else { | |
| 25 | + // support safari | |
| 26 | + // https://stackoverflow.com/questions/4310953/invalid-date-in-safari | |
| 27 | + time = time.replace(new RegExp(/-/gm), '/') | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + if ((typeof time === 'number') && (time.toString().length === 10)) { | |
| 32 | + time = time * 1000 | |
| 33 | + } | |
| 34 | + date = new Date(time) | |
| 35 | + } | |
| 36 | + const formatObj = { | |
| 37 | + y: date.getFullYear(), | |
| 38 | + m: date.getMonth() + 1, | |
| 39 | + d: date.getDate(), | |
| 40 | + h: date.getHours(), | |
| 41 | + i: date.getMinutes(), | |
| 42 | + s: date.getSeconds(), | |
| 43 | + a: date.getDay() | |
| 44 | + } | |
| 45 | + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { | |
| 46 | + const value = formatObj[key] | |
| 47 | + // Note: getDay() returns 0 on Sunday | |
| 48 | + if (key === 'a') { | |
| 49 | + return ['日', '一', '二', '三', '四', '五', '六'][value] | |
| 50 | + } | |
| 51 | + return value.toString().padStart(2, '0') | |
| 52 | + }) | |
| 53 | + return time_str | |
| 54 | +} | |
| 55 | + | |
| 56 | +/** | |
| 57 | + * @param {number} time | |
| 58 | + * @param {string} option | |
| 59 | + * @returns {string} | |
| 60 | + */ | |
| 61 | +export function formatTime(time, option) { | |
| 62 | + if (('' + time).length === 10) { | |
| 63 | + time = parseInt(time) * 1000 | |
| 64 | + } else { | |
| 65 | + time = +time | |
| 66 | + } | |
| 67 | + const d = new Date(time) | |
| 68 | + const now = Date.now() | |
| 69 | + | |
| 70 | + const diff = (now - d) / 1000 | |
| 71 | + | |
| 72 | + if (diff < 30) { | |
| 73 | + return '刚刚' | |
| 74 | + } else if (diff < 3600) { | |
| 75 | + // less 1 hour | |
| 76 | + return Math.ceil(diff / 60) + '分钟前' | |
| 77 | + } else if (diff < 3600 * 24) { | |
| 78 | + return Math.ceil(diff / 3600) + '小时前' | |
| 79 | + } else if (diff < 3600 * 24 * 2) { | |
| 80 | + return '1天前' | |
| 81 | + } | |
| 82 | + if (option) { | |
| 83 | + return parseTime(time, option) | |
| 84 | + } else { | |
| 85 | + return ( | |
| 86 | + d.getMonth() + | |
| 87 | + 1 + | |
| 88 | + '月' + | |
| 89 | + d.getDate() + | |
| 90 | + '日' + | |
| 91 | + d.getHours() + | |
| 92 | + '时' + | |
| 93 | + d.getMinutes() + | |
| 94 | + '分' | |
| 95 | + ) | |
| 96 | + } | |
| 97 | +} | |
| 98 | + | |
| 99 | +/** | |
| 100 | + * @param {string} url | |
| 101 | + * @returns {Object} | |
| 102 | + */ | |
| 103 | +export function param2Obj(url) { | |
| 104 | + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') | |
| 105 | + if (!search) { | |
| 106 | + return {} | |
| 107 | + } | |
| 108 | + const obj = {} | |
| 109 | + const searchArr = search.split('&') | |
| 110 | + searchArr.forEach(v => { | |
| 111 | + const index = v.indexOf('=') | |
| 112 | + if (index !== -1) { | |
| 113 | + const name = v.substring(0, index) | |
| 114 | + const val = v.substring(index + 1, v.length) | |
| 115 | + obj[name] = val | |
| 116 | + } | |
| 117 | + }) | |
| 118 | + return obj | |
| 119 | +} | ... | ... |
src/utils/qqmap-wx-jssdk.js
0 → 100644
| 1 | +/** | |
| 2 | + * 微信小程序JavaScriptSDK | |
| 3 | + * | |
| 4 | + * @version 1.1 | |
| 5 | + * @date 2019-01-20 | |
| 6 | + */ | |
| 7 | + | |
| 8 | +var ERROR_CONF = { | |
| 9 | + KEY_ERR: 311, | |
| 10 | + KEY_ERR_MSG: 'key格式错误', | |
| 11 | + PARAM_ERR: 310, | |
| 12 | + PARAM_ERR_MSG: '请求参数信息有误', | |
| 13 | + SYSTEM_ERR: 600, | |
| 14 | + SYSTEM_ERR_MSG: '系统错误', | |
| 15 | + WX_ERR_CODE: 1000, | |
| 16 | + WX_OK_CODE: 200 | |
| 17 | +}; | |
| 18 | +var BASE_URL = 'https://apis.map.qq.com/ws/'; | |
| 19 | +var URL_SEARCH = BASE_URL + 'place/v1/search'; | |
| 20 | +var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; | |
| 21 | +var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; | |
| 22 | +var URL_CITY_LIST = BASE_URL + 'district/v1/list'; | |
| 23 | +var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; | |
| 24 | +var URL_DISTANCE = BASE_URL + 'distance/v1/'; | |
| 25 | +var EARTH_RADIUS = 6378136.49; | |
| 26 | +var Utils = { | |
| 27 | + /** | |
| 28 | + * 得到终点query字符串 | |
| 29 | + * @param {Array|String} 检索数据 | |
| 30 | + */ | |
| 31 | + location2query(data) { | |
| 32 | + if (typeof data == 'string') { | |
| 33 | + return data; | |
| 34 | + } | |
| 35 | + var query = ''; | |
| 36 | + for (var i = 0; i < data.length; i++) { | |
| 37 | + var d = data[i]; | |
| 38 | + if (!!query) { | |
| 39 | + query += ';'; | |
| 40 | + } | |
| 41 | + if (d.location) { | |
| 42 | + query = query + d.location.lat + ',' + d.location.lng; | |
| 43 | + } | |
| 44 | + if (d.latitude && d.longitude) { | |
| 45 | + query = query + d.latitude + ',' + d.longitude; | |
| 46 | + } | |
| 47 | + } | |
| 48 | + return query; | |
| 49 | + }, | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 计算角度 | |
| 53 | + */ | |
| 54 | + rad(d) { | |
| 55 | + return d * Math.PI / 180.0; | |
| 56 | + }, | |
| 57 | + /** | |
| 58 | + * 处理终点location数组 | |
| 59 | + * @return 返回终点数组 | |
| 60 | + */ | |
| 61 | + getEndLocation(location){ | |
| 62 | + var to = location.split(';'); | |
| 63 | + var endLocation = []; | |
| 64 | + for (var i = 0; i < to.length; i++) { | |
| 65 | + endLocation.push({ | |
| 66 | + lat: parseFloat(to[i].split(',')[0]), | |
| 67 | + lng: parseFloat(to[i].split(',')[1]) | |
| 68 | + }) | |
| 69 | + } | |
| 70 | + return endLocation; | |
| 71 | + }, | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 计算两点间直线距离 | |
| 75 | + * @param a 表示纬度差 | |
| 76 | + * @param b 表示经度差 | |
| 77 | + * @return 返回的是距离,单位m | |
| 78 | + */ | |
| 79 | + getDistance(latFrom, lngFrom, latTo, lngTo) { | |
| 80 | + var radLatFrom = this.rad(latFrom); | |
| 81 | + var radLatTo = this.rad(latTo); | |
| 82 | + var a = radLatFrom - radLatTo; | |
| 83 | + var b = this.rad(lngFrom) - this.rad(lngTo); | |
| 84 | + var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); | |
| 85 | + distance = distance * EARTH_RADIUS; | |
| 86 | + distance = Math.round(distance * 10000) / 10000; | |
| 87 | + return parseFloat(distance.toFixed(0)); | |
| 88 | + }, | |
| 89 | + /** | |
| 90 | + * 使用微信接口进行定位 | |
| 91 | + */ | |
| 92 | + getWXLocation(success, fail, complete) { | |
| 93 | + wx.getLocation({ | |
| 94 | + type: 'gcj02', | |
| 95 | + success: success, | |
| 96 | + fail: fail, | |
| 97 | + complete: complete | |
| 98 | + }); | |
| 99 | + }, | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 获取location参数 | |
| 103 | + */ | |
| 104 | + getLocationParam(location) { | |
| 105 | + if (typeof location == 'string') { | |
| 106 | + var locationArr = location.split(','); | |
| 107 | + if (locationArr.length === 2) { | |
| 108 | + location = { | |
| 109 | + latitude: location.split(',')[0], | |
| 110 | + longitude: location.split(',')[1] | |
| 111 | + }; | |
| 112 | + } else { | |
| 113 | + location = {}; | |
| 114 | + } | |
| 115 | + } | |
| 116 | + return location; | |
| 117 | + }, | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * 回调函数默认处理 | |
| 121 | + */ | |
| 122 | + polyfillParam(param) { | |
| 123 | + param.success = param.success || function () { }; | |
| 124 | + param.fail = param.fail || function () { }; | |
| 125 | + param.complete = param.complete || function () { }; | |
| 126 | + }, | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * 验证param对应的key值是否为空 | |
| 130 | + * | |
| 131 | + * @param {Object} param 接口参数 | |
| 132 | + * @param {String} key 对应参数的key | |
| 133 | + */ | |
| 134 | + checkParamKeyEmpty(param, key) { | |
| 135 | + if (!param[key]) { | |
| 136 | + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); | |
| 137 | + param.fail(errconf); | |
| 138 | + param.complete(errconf); | |
| 139 | + return true; | |
| 140 | + } | |
| 141 | + return false; | |
| 142 | + }, | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 验证参数中是否存在检索词keyword | |
| 146 | + * | |
| 147 | + * @param {Object} param 接口参数 | |
| 148 | + */ | |
| 149 | + checkKeyword(param){ | |
| 150 | + return !this.checkParamKeyEmpty(param, 'keyword'); | |
| 151 | + }, | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * 验证location值 | |
| 155 | + * | |
| 156 | + * @param {Object} param 接口参数 | |
| 157 | + */ | |
| 158 | + checkLocation(param) { | |
| 159 | + var location = this.getLocationParam(param.location); | |
| 160 | + if (!location || !location.latitude || !location.longitude) { | |
| 161 | + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); | |
| 162 | + param.fail(errconf); | |
| 163 | + param.complete(errconf); | |
| 164 | + return false; | |
| 165 | + } | |
| 166 | + return true; | |
| 167 | + }, | |
| 168 | + | |
| 169 | + /** | |
| 170 | + * 构造错误数据结构 | |
| 171 | + * @param {Number} errCode 错误码 | |
| 172 | + * @param {Number} errMsg 错误描述 | |
| 173 | + */ | |
| 174 | + buildErrorConfig(errCode, errMsg) { | |
| 175 | + return { | |
| 176 | + status: errCode, | |
| 177 | + message: errMsg | |
| 178 | + }; | |
| 179 | + }, | |
| 180 | + | |
| 181 | + /** | |
| 182 | + * | |
| 183 | + * 数据处理函数 | |
| 184 | + * 根据传入参数不同处理不同数据 | |
| 185 | + * @param {String} feature 功能名称 | |
| 186 | + * search 地点搜索 | |
| 187 | + * suggest关键词提示 | |
| 188 | + * reverseGeocoder逆地址解析 | |
| 189 | + * geocoder地址解析 | |
| 190 | + * getCityList获取城市列表:父集 | |
| 191 | + * getDistrictByCityId获取区县列表:子集 | |
| 192 | + * calculateDistance距离计算 | |
| 193 | + * @param {Object} param 接口参数 | |
| 194 | + * @param {Object} data 数据 | |
| 195 | + */ | |
| 196 | + handleData(param,data,feature){ | |
| 197 | + if (feature === 'search') { | |
| 198 | + var searchResult = data.data; | |
| 199 | + var searchSimplify = []; | |
| 200 | + for (var i = 0; i < searchResult.length; i++) { | |
| 201 | + searchSimplify.push({ | |
| 202 | + id: searchResult[i].id || null, | |
| 203 | + title: searchResult[i].title || null, | |
| 204 | + latitude: searchResult[i].location && searchResult[i].location.lat || null, | |
| 205 | + longitude: searchResult[i].location && searchResult[i].location.lng || null, | |
| 206 | + address: searchResult[i].address || null, | |
| 207 | + category: searchResult[i].category || null, | |
| 208 | + tel: searchResult[i].tel || null, | |
| 209 | + adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, | |
| 210 | + city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, | |
| 211 | + district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, | |
| 212 | + province: searchResult[i].ad_info && searchResult[i].ad_info.province || null | |
| 213 | + }) | |
| 214 | + } | |
| 215 | + param.success(data, { | |
| 216 | + searchResult: searchResult, | |
| 217 | + searchSimplify: searchSimplify | |
| 218 | + }) | |
| 219 | + } else if (feature === 'suggest') { | |
| 220 | + var suggestResult = data.data; | |
| 221 | + var suggestSimplify = []; | |
| 222 | + for (var i = 0; i < suggestResult.length; i++) { | |
| 223 | + suggestSimplify.push({ | |
| 224 | + adcode: suggestResult[i].adcode || null, | |
| 225 | + address: suggestResult[i].address || null, | |
| 226 | + category: suggestResult[i].category || null, | |
| 227 | + city: suggestResult[i].city || null, | |
| 228 | + district: suggestResult[i].district || null, | |
| 229 | + id: suggestResult[i].id || null, | |
| 230 | + latitude: suggestResult[i].location && suggestResult[i].location.lat || null, | |
| 231 | + longitude: suggestResult[i].location && suggestResult[i].location.lng || null, | |
| 232 | + province: suggestResult[i].province || null, | |
| 233 | + title: suggestResult[i].title || null, | |
| 234 | + type: suggestResult[i].type || null | |
| 235 | + }) | |
| 236 | + } | |
| 237 | + param.success(data, { | |
| 238 | + suggestResult: suggestResult, | |
| 239 | + suggestSimplify: suggestSimplify | |
| 240 | + }) | |
| 241 | + } else if (feature === 'reverseGeocoder') { | |
| 242 | + var reverseGeocoderResult = data.result; | |
| 243 | + var reverseGeocoderSimplify = { | |
| 244 | + address: reverseGeocoderResult.address || null, | |
| 245 | + latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, | |
| 246 | + longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, | |
| 247 | + adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, | |
| 248 | + city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, | |
| 249 | + district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, | |
| 250 | + nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, | |
| 251 | + province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, | |
| 252 | + street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, | |
| 253 | + street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, | |
| 254 | + recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, | |
| 255 | + rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null | |
| 256 | + }; | |
| 257 | + if (reverseGeocoderResult.pois) {//判断是否返回周边poi | |
| 258 | + var pois = reverseGeocoderResult.pois; | |
| 259 | + var poisSimplify = []; | |
| 260 | + for (var i = 0;i < pois.length;i++) { | |
| 261 | + poisSimplify.push({ | |
| 262 | + id: pois[i].id || null, | |
| 263 | + title: pois[i].title || null, | |
| 264 | + latitude: pois[i].location && pois[i].location.lat || null, | |
| 265 | + longitude: pois[i].location && pois[i].location.lng || null, | |
| 266 | + address: pois[i].address || null, | |
| 267 | + category: pois[i].category || null, | |
| 268 | + adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, | |
| 269 | + city: pois[i].ad_info && pois[i].ad_info.city || null, | |
| 270 | + district: pois[i].ad_info && pois[i].ad_info.district || null, | |
| 271 | + province: pois[i].ad_info && pois[i].ad_info.province || null | |
| 272 | + }) | |
| 273 | + } | |
| 274 | + param.success(data,{ | |
| 275 | + reverseGeocoderResult: reverseGeocoderResult, | |
| 276 | + reverseGeocoderSimplify: reverseGeocoderSimplify, | |
| 277 | + pois: pois, | |
| 278 | + poisSimplify: poisSimplify | |
| 279 | + }) | |
| 280 | + } else { | |
| 281 | + param.success(data, { | |
| 282 | + reverseGeocoderResult: reverseGeocoderResult, | |
| 283 | + reverseGeocoderSimplify: reverseGeocoderSimplify | |
| 284 | + }) | |
| 285 | + } | |
| 286 | + } else if (feature === 'geocoder') { | |
| 287 | + var geocoderResult = data.result; | |
| 288 | + var geocoderSimplify = { | |
| 289 | + title: geocoderResult.title || null, | |
| 290 | + latitude: geocoderResult.location && geocoderResult.location.lat || null, | |
| 291 | + longitude: geocoderResult.location && geocoderResult.location.lng || null, | |
| 292 | + adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, | |
| 293 | + province: geocoderResult.address_components && geocoderResult.address_components.province || null, | |
| 294 | + city: geocoderResult.address_components && geocoderResult.address_components.city || null, | |
| 295 | + district: geocoderResult.address_components && geocoderResult.address_components.district || null, | |
| 296 | + street: geocoderResult.address_components && geocoderResult.address_components.street || null, | |
| 297 | + street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, | |
| 298 | + level: geocoderResult.level || null | |
| 299 | + }; | |
| 300 | + param.success(data,{ | |
| 301 | + geocoderResult: geocoderResult, | |
| 302 | + geocoderSimplify: geocoderSimplify | |
| 303 | + }); | |
| 304 | + } else if (feature === 'getCityList') { | |
| 305 | + var provinceResult = data.result[0]; | |
| 306 | + var cityResult = data.result[1]; | |
| 307 | + var districtResult = data.result[2]; | |
| 308 | + param.success(data,{ | |
| 309 | + provinceResult: provinceResult, | |
| 310 | + cityResult: cityResult, | |
| 311 | + districtResult: districtResult | |
| 312 | + }); | |
| 313 | + } else if (feature === 'getDistrictByCityId') { | |
| 314 | + var districtByCity = data.result[0]; | |
| 315 | + param.success(data, districtByCity); | |
| 316 | + } else if (feature === 'calculateDistance') { | |
| 317 | + var calculateDistanceResult = data.result.elements; | |
| 318 | + var distance = []; | |
| 319 | + for (var i = 0; i < calculateDistanceResult.length; i++){ | |
| 320 | + distance.push(calculateDistanceResult[i].distance); | |
| 321 | + } | |
| 322 | + param.success(data, { | |
| 323 | + calculateDistanceResult: calculateDistanceResult, | |
| 324 | + distance: distance | |
| 325 | + }); | |
| 326 | + } else { | |
| 327 | + param.success(data); | |
| 328 | + } | |
| 329 | + }, | |
| 330 | + | |
| 331 | + /** | |
| 332 | + * 构造微信请求参数,公共属性处理 | |
| 333 | + * | |
| 334 | + * @param {Object} param 接口参数 | |
| 335 | + * @param {Object} param 配置项 | |
| 336 | + * @param {String} feature 方法名 | |
| 337 | + */ | |
| 338 | + buildWxRequestConfig(param, options, feature) { | |
| 339 | + var that = this; | |
| 340 | + options.header = { "content-type": "application/json" }; | |
| 341 | + options.method = 'GET'; | |
| 342 | + options.success = function (res) { | |
| 343 | + var data = res.data; | |
| 344 | + if (data.status === 0) { | |
| 345 | + that.handleData(param, data, feature); | |
| 346 | + } else { | |
| 347 | + param.fail(data); | |
| 348 | + } | |
| 349 | + }; | |
| 350 | + options.fail = function (res) { | |
| 351 | + res.statusCode = ERROR_CONF.WX_ERR_CODE; | |
| 352 | + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | |
| 353 | + }; | |
| 354 | + options.complete = function (res) { | |
| 355 | + var statusCode = +res.statusCode; | |
| 356 | + switch(statusCode) { | |
| 357 | + case ERROR_CONF.WX_ERR_CODE: { | |
| 358 | + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | |
| 359 | + break; | |
| 360 | + } | |
| 361 | + case ERROR_CONF.WX_OK_CODE: { | |
| 362 | + var data = res.data; | |
| 363 | + if (data.status === 0) { | |
| 364 | + param.complete(data); | |
| 365 | + } else { | |
| 366 | + param.complete(that.buildErrorConfig(data.status, data.message)); | |
| 367 | + } | |
| 368 | + break; | |
| 369 | + } | |
| 370 | + default:{ | |
| 371 | + param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); | |
| 372 | + } | |
| 373 | + | |
| 374 | + } | |
| 375 | + }; | |
| 376 | + return options; | |
| 377 | + }, | |
| 378 | + | |
| 379 | + /** | |
| 380 | + * 处理用户参数是否传入坐标进行不同的处理 | |
| 381 | + */ | |
| 382 | + locationProcess(param, locationsuccess, locationfail, locationcomplete) { | |
| 383 | + var that = this; | |
| 384 | + locationfail = locationfail || function (res) { | |
| 385 | + res.statusCode = ERROR_CONF.WX_ERR_CODE; | |
| 386 | + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | |
| 387 | + }; | |
| 388 | + locationcomplete = locationcomplete || function (res) { | |
| 389 | + if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { | |
| 390 | + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | |
| 391 | + } | |
| 392 | + }; | |
| 393 | + if (!param.location) { | |
| 394 | + that.getWXLocation(locationsuccess, locationfail, locationcomplete); | |
| 395 | + } else if (that.checkLocation(param)) { | |
| 396 | + var location = Utils.getLocationParam(param.location); | |
| 397 | + locationsuccess(location); | |
| 398 | + } | |
| 399 | + } | |
| 400 | +}; | |
| 401 | + | |
| 402 | + | |
| 403 | +class QQMapWX { | |
| 404 | + | |
| 405 | + /** | |
| 406 | + * 构造函数 | |
| 407 | + * | |
| 408 | + * @param {Object} options 接口参数,key 为必选参数 | |
| 409 | + */ | |
| 410 | + constructor(options) { | |
| 411 | + if (!options.key) { | |
| 412 | + throw Error('key值不能为空'); | |
| 413 | + } | |
| 414 | + this.key = options.key; | |
| 415 | + }; | |
| 416 | + | |
| 417 | + /** | |
| 418 | + * POI周边检索 | |
| 419 | + * | |
| 420 | + * @param {Object} options 接口参数对象 | |
| 421 | + * | |
| 422 | + * 参数对象结构可以参考 | |
| 423 | + * @see http://lbs.qq.com/webservice_v1/guide-search.html | |
| 424 | + */ | |
| 425 | + search(options) { | |
| 426 | + var that = this; | |
| 427 | + options = options || {}; | |
| 428 | + | |
| 429 | + Utils.polyfillParam(options); | |
| 430 | + | |
| 431 | + if (!Utils.checkKeyword(options)) { | |
| 432 | + return; | |
| 433 | + } | |
| 434 | + | |
| 435 | + var requestParam = { | |
| 436 | + keyword: options.keyword, | |
| 437 | + orderby: options.orderby || '_distance', | |
| 438 | + page_size: options.page_size || 10, | |
| 439 | + page_index: options.page_index || 1, | |
| 440 | + output: 'json', | |
| 441 | + key: that.key | |
| 442 | + }; | |
| 443 | + | |
| 444 | + if (options.address_format) { | |
| 445 | + requestParam.address_format = options.address_format; | |
| 446 | + } | |
| 447 | + | |
| 448 | + if (options.filter) { | |
| 449 | + requestParam.filter = options.filter; | |
| 450 | + } | |
| 451 | + | |
| 452 | + var distance = options.distance || "1000"; | |
| 453 | + var auto_extend = options.auto_extend || 1; | |
| 454 | + var region = null; | |
| 455 | + var rectangle = null; | |
| 456 | + | |
| 457 | + //判断城市限定参数 | |
| 458 | + if (options.region) { | |
| 459 | + region = options.region; | |
| 460 | + } | |
| 461 | + | |
| 462 | + //矩形限定坐标(暂时只支持字符串格式) | |
| 463 | + if (options.rectangle) { | |
| 464 | + rectangle = options.rectangle; | |
| 465 | + } | |
| 466 | + | |
| 467 | + var locationsuccess = function (result) { | |
| 468 | + if (region && !rectangle) { | |
| 469 | + //城市限定参数拼接 | |
| 470 | + requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; | |
| 471 | + } else if (rectangle && !region) { | |
| 472 | + //矩形搜索 | |
| 473 | + requestParam.boundary = "rectangle(" + rectangle + ")"; | |
| 474 | + } else { | |
| 475 | + requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; | |
| 476 | + } | |
| 477 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 478 | + url: URL_SEARCH, | |
| 479 | + data: requestParam | |
| 480 | + }, 'search')); | |
| 481 | + }; | |
| 482 | + Utils.locationProcess(options, locationsuccess); | |
| 483 | + }; | |
| 484 | + | |
| 485 | + /** | |
| 486 | + * sug模糊检索 | |
| 487 | + * | |
| 488 | + * @param {Object} options 接口参数对象 | |
| 489 | + * | |
| 490 | + * 参数对象结构可以参考 | |
| 491 | + * http://lbs.qq.com/webservice_v1/guide-suggestion.html | |
| 492 | + */ | |
| 493 | + getSuggestion(options) { | |
| 494 | + var that = this; | |
| 495 | + options = options || {}; | |
| 496 | + Utils.polyfillParam(options); | |
| 497 | + | |
| 498 | + if (!Utils.checkKeyword(options)) { | |
| 499 | + return; | |
| 500 | + } | |
| 501 | + | |
| 502 | + var requestParam = { | |
| 503 | + keyword: options.keyword, | |
| 504 | + region: options.region || '全国', | |
| 505 | + region_fix: options.region_fix || 0, | |
| 506 | + policy: options.policy || 0, | |
| 507 | + page_size: options.page_size || 10,//控制显示条数 | |
| 508 | + page_index: options.page_index || 1,//控制页数 | |
| 509 | + get_subpois : options.get_subpois || 0,//返回子地点 | |
| 510 | + output: 'json', | |
| 511 | + key: that.key | |
| 512 | + }; | |
| 513 | + //长地址 | |
| 514 | + if (options.address_format) { | |
| 515 | + requestParam.address_format = options.address_format; | |
| 516 | + } | |
| 517 | + //过滤 | |
| 518 | + if (options.filter) { | |
| 519 | + requestParam.filter = options.filter; | |
| 520 | + } | |
| 521 | + //排序 | |
| 522 | + if (options.location) { | |
| 523 | + var locationsuccess = function (result) { | |
| 524 | + requestParam.location = result.latitude + ',' + result.longitude; | |
| 525 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 526 | + url: URL_SUGGESTION, | |
| 527 | + data: requestParam | |
| 528 | + }, "suggest")); | |
| 529 | + }; | |
| 530 | + Utils.locationProcess(options, locationsuccess); | |
| 531 | + } else { | |
| 532 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 533 | + url: URL_SUGGESTION, | |
| 534 | + data: requestParam | |
| 535 | + }, "suggest")); | |
| 536 | + } | |
| 537 | + }; | |
| 538 | + | |
| 539 | + /** | |
| 540 | + * 逆地址解析 | |
| 541 | + * | |
| 542 | + * @param {Object} options 接口参数对象 | |
| 543 | + * | |
| 544 | + * 请求参数结构可以参考 | |
| 545 | + * http://lbs.qq.com/webservice_v1/guide-gcoder.html | |
| 546 | + */ | |
| 547 | + reverseGeocoder(options) { | |
| 548 | + var that = this; | |
| 549 | + options = options || {}; | |
| 550 | + Utils.polyfillParam(options); | |
| 551 | + var requestParam = { | |
| 552 | + coord_type: options.coord_type || 5, | |
| 553 | + get_poi: options.get_poi || 0, | |
| 554 | + output: 'json', | |
| 555 | + key: that.key | |
| 556 | + }; | |
| 557 | + if (options.poi_options) { | |
| 558 | + requestParam.poi_options = options.poi_options | |
| 559 | + } | |
| 560 | + | |
| 561 | + var locationsuccess = function (result) { | |
| 562 | + requestParam.location = result.latitude + ',' + result.longitude; | |
| 563 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 564 | + url: URL_GET_GEOCODER, | |
| 565 | + data: requestParam | |
| 566 | + }, 'reverseGeocoder')); | |
| 567 | + }; | |
| 568 | + Utils.locationProcess(options, locationsuccess); | |
| 569 | + }; | |
| 570 | + | |
| 571 | + /** | |
| 572 | + * 地址解析 | |
| 573 | + * | |
| 574 | + * @param {Object} options 接口参数对象 | |
| 575 | + * | |
| 576 | + * 请求参数结构可以参考 | |
| 577 | + * http://lbs.qq.com/webservice_v1/guide-geocoder.html | |
| 578 | + */ | |
| 579 | + geocoder(options) { | |
| 580 | + var that = this; | |
| 581 | + options = options || {}; | |
| 582 | + Utils.polyfillParam(options); | |
| 583 | + | |
| 584 | + if (Utils.checkParamKeyEmpty(options, 'address')) { | |
| 585 | + return; | |
| 586 | + } | |
| 587 | + | |
| 588 | + var requestParam = { | |
| 589 | + address: options.address, | |
| 590 | + output: 'json', | |
| 591 | + key: that.key | |
| 592 | + }; | |
| 593 | + | |
| 594 | + //城市限定 | |
| 595 | + if (options.region) { | |
| 596 | + requestParam.region = options.region; | |
| 597 | + } | |
| 598 | + | |
| 599 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 600 | + url: URL_GET_GEOCODER, | |
| 601 | + data: requestParam | |
| 602 | + },'geocoder')); | |
| 603 | + }; | |
| 604 | + | |
| 605 | + | |
| 606 | + /** | |
| 607 | + * 获取城市列表 | |
| 608 | + * | |
| 609 | + * @param {Object} options 接口参数对象 | |
| 610 | + * | |
| 611 | + * 请求参数结构可以参考 | |
| 612 | + * http://lbs.qq.com/webservice_v1/guide-region.html | |
| 613 | + */ | |
| 614 | + getCityList(options) { | |
| 615 | + var that = this; | |
| 616 | + options = options || {}; | |
| 617 | + Utils.polyfillParam(options); | |
| 618 | + var requestParam = { | |
| 619 | + output: 'json', | |
| 620 | + key: that.key | |
| 621 | + }; | |
| 622 | + | |
| 623 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 624 | + url: URL_CITY_LIST, | |
| 625 | + data: requestParam | |
| 626 | + },'getCityList')); | |
| 627 | + }; | |
| 628 | + | |
| 629 | + /** | |
| 630 | + * 获取对应城市ID的区县列表 | |
| 631 | + * | |
| 632 | + * @param {Object} options 接口参数对象 | |
| 633 | + * | |
| 634 | + * 请求参数结构可以参考 | |
| 635 | + * http://lbs.qq.com/webservice_v1/guide-region.html | |
| 636 | + */ | |
| 637 | + getDistrictByCityId(options) { | |
| 638 | + var that = this; | |
| 639 | + options = options || {}; | |
| 640 | + Utils.polyfillParam(options); | |
| 641 | + | |
| 642 | + if (Utils.checkParamKeyEmpty(options, 'id')) { | |
| 643 | + return; | |
| 644 | + } | |
| 645 | + | |
| 646 | + var requestParam = { | |
| 647 | + id: options.id || '', | |
| 648 | + output: 'json', | |
| 649 | + key: that.key | |
| 650 | + }; | |
| 651 | + | |
| 652 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 653 | + url: URL_AREA_LIST, | |
| 654 | + data: requestParam | |
| 655 | + },'getDistrictByCityId')); | |
| 656 | + }; | |
| 657 | + | |
| 658 | + /** | |
| 659 | + * 用于单起点到多终点的路线距离(非直线距离)计算: | |
| 660 | + * 支持两种距离计算方式:步行和驾车。 | |
| 661 | + * 起点到终点最大限制直线距离10公里。 | |
| 662 | + * | |
| 663 | + * 新增直线距离计算。 | |
| 664 | + * | |
| 665 | + * @param {Object} options 接口参数对象 | |
| 666 | + * | |
| 667 | + * 请求参数结构可以参考 | |
| 668 | + * http://lbs.qq.com/webservice_v1/guide-distance.html | |
| 669 | + */ | |
| 670 | + calculateDistance(options) { | |
| 671 | + var that = this; | |
| 672 | + options = options || {}; | |
| 673 | + Utils.polyfillParam(options); | |
| 674 | + | |
| 675 | + if (Utils.checkParamKeyEmpty(options, 'to')) { | |
| 676 | + return; | |
| 677 | + } | |
| 678 | + | |
| 679 | + var requestParam = { | |
| 680 | + mode: options.mode || 'walking', | |
| 681 | + to: Utils.location2query(options.to), | |
| 682 | + output: 'json', | |
| 683 | + key: that.key | |
| 684 | + }; | |
| 685 | + | |
| 686 | + if (options.from) { | |
| 687 | + options.location = options.from; | |
| 688 | + } | |
| 689 | + | |
| 690 | + //计算直线距离 | |
| 691 | + if(requestParam.mode == 'straight'){ | |
| 692 | + var locationsuccess = function (result) { | |
| 693 | + var locationTo = Utils.getEndLocation(requestParam.to);//处理终点坐标 | |
| 694 | + var data = { | |
| 695 | + message:"query ok", | |
| 696 | + result:{ | |
| 697 | + elements:[] | |
| 698 | + }, | |
| 699 | + status:0 | |
| 700 | + }; | |
| 701 | + for (var i = 0; i < locationTo.length; i++) { | |
| 702 | + data.result.elements.push({//将坐标存入 | |
| 703 | + distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), | |
| 704 | + duration:0, | |
| 705 | + from:{ | |
| 706 | + lat: result.latitude, | |
| 707 | + lng:result.longitude | |
| 708 | + }, | |
| 709 | + to:{ | |
| 710 | + lat: locationTo[i].lat, | |
| 711 | + lng: locationTo[i].lng | |
| 712 | + } | |
| 713 | + }); | |
| 714 | + } | |
| 715 | + var calculateResult = data.result.elements; | |
| 716 | + var distanceResult = []; | |
| 717 | + for (var i = 0; i < calculateResult.length; i++) { | |
| 718 | + distanceResult.push(calculateResult[i].distance); | |
| 719 | + } | |
| 720 | + return options.success(data,{ | |
| 721 | + calculateResult: calculateResult, | |
| 722 | + distanceResult: distanceResult | |
| 723 | + }); | |
| 724 | + }; | |
| 725 | + | |
| 726 | + Utils.locationProcess(options, locationsuccess); | |
| 727 | + } else { | |
| 728 | + var locationsuccess = function (result) { | |
| 729 | + requestParam.from = result.latitude + ',' + result.longitude; | |
| 730 | + wx.request(Utils.buildWxRequestConfig(options, { | |
| 731 | + url: URL_DISTANCE, | |
| 732 | + data: requestParam | |
| 733 | + },'calculateDistance')); | |
| 734 | + }; | |
| 735 | + | |
| 736 | + Utils.locationProcess(options, locationsuccess); | |
| 737 | + } | |
| 738 | + } | |
| 739 | +}; | |
| 740 | + | |
| 741 | +module.exports = QQMapWX; | |
| 0 | 742 | \ No newline at end of file | ... | ... |
src/utils/request.js
0 → 100644
| 1 | +import axios from 'axios' | |
| 2 | +import { | |
| 3 | + MessageBox, | |
| 4 | + Message | |
| 5 | +} from 'element-ui' | |
| 6 | +import store from '@/store' | |
| 7 | +import { | |
| 8 | + getToken | |
| 9 | +} from '@/utils/auth' | |
| 10 | + | |
| 11 | +// create an axios instance | |
| 12 | +const service = axios.create({ | |
| 13 | + baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url | |
| 14 | + // withCredentials: true, // send cookies when cross-domain requests | |
| 15 | + timeout: 5000 // request timeout | |
| 16 | +}) | |
| 17 | + | |
| 18 | +// request interceptor | |
| 19 | +service.interceptors.request.use( | |
| 20 | + config => { | |
| 21 | + // do something before request is sent | |
| 22 | + | |
| 23 | + if (store.getters.token) { | |
| 24 | + // let each request carry token | |
| 25 | + // ['X-Token'] is a custom headers key | |
| 26 | + // please modify it according to the actual situation | |
| 27 | + config.headers['Authorization'] = getToken() | |
| 28 | + } | |
| 29 | + return config | |
| 30 | + }, | |
| 31 | + error => { | |
| 32 | + // do something with request error | |
| 33 | + console.log(error) // for debug | |
| 34 | + return Promise.reject(error) | |
| 35 | + } | |
| 36 | +) | |
| 37 | + | |
| 38 | +// response interceptor | |
| 39 | +service.interceptors.response.use( | |
| 40 | + /** | |
| 41 | + * If you want to get http information such as headers or status | |
| 42 | + * Please return response => response | |
| 43 | + */ | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Determine the request status by custom code | |
| 47 | + * Here is just an example | |
| 48 | + * You can also judge the status by HTTP Status Code | |
| 49 | + */ | |
| 50 | + response => { | |
| 51 | + const res = response.data | |
| 52 | + | |
| 53 | + // if the custom code is not 20000, it is judged as an error. | |
| 54 | + if (res.code !== 200) { | |
| 55 | + Message({ | |
| 56 | + message: res.message || 'Error', | |
| 57 | + type: 'error', | |
| 58 | + duration: 5 * 1000 | |
| 59 | + }) | |
| 60 | + | |
| 61 | + // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; | |
| 62 | + if (res.code === 50008 || res.code === 50012 || res.code === 50014) { | |
| 63 | + // to re-login | |
| 64 | + MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', | |
| 65 | + 'Confirm logout', { | |
| 66 | + confirmButtonText: 'Re-Login', | |
| 67 | + cancelButtonText: 'Cancel', | |
| 68 | + type: 'warning' | |
| 69 | + }).then(() => { | |
| 70 | + store.dispatch('user/resetToken').then(() => { | |
| 71 | + location.reload() | |
| 72 | + }) | |
| 73 | + }) | |
| 74 | + } | |
| 75 | + return Promise.reject(new Error(res.message || 'Error')) | |
| 76 | + } else { | |
| 77 | + return res | |
| 78 | + } | |
| 79 | + }, | |
| 80 | + error => { | |
| 81 | + console.log('err' + error) // for debug | |
| 82 | + Message({ | |
| 83 | + message: error.message, | |
| 84 | + type: 'error', | |
| 85 | + duration: 5 * 1000 | |
| 86 | + }) | |
| 87 | + return Promise.reject(error) | |
| 88 | + } | |
| 89 | +) | |
| 90 | + | |
| 91 | +export default service | ... | ... |
src/utils/utils.js
0 → 100644
| 1 | +// import { pathToBase64, base64ToPath } from '../js_sdk/image-tools/index.js' | |
| 2 | +const CryptoJS = require('crypto-js'); //引用AES源码js | |
| 3 | +const key = CryptoJS.enc.Utf8.parse("1234123412ABCDEF"); //十六位十六进制数作为密钥 | |
| 4 | +const iv = CryptoJS.enc.Utf8.parse('ABCDEF1234123412'); //十六位十六进制数作为密钥偏移量 | |
| 5 | + | |
| 6 | +const utils = { | |
| 7 | + //加密方法 | |
| 8 | + Encrypt(word) { | |
| 9 | + let srcs = CryptoJS.enc.Utf8.parse(word); | |
| 10 | + let encrypted = CryptoJS.AES.encrypt(srcs, key, { | |
| 11 | + iv: iv, | |
| 12 | + mode: CryptoJS.mode.CBC, | |
| 13 | + padding: CryptoJS.pad.Pkcs7 | |
| 14 | + }); | |
| 15 | + return encrypted.ciphertext.toString().toUpperCase(); | |
| 16 | + }, | |
| 17 | + //解密方法 | |
| 18 | + Decrypt(word) { | |
| 19 | + let encryptedHexStr = CryptoJS.enc.Hex.parse(word); | |
| 20 | + let srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr); | |
| 21 | + let decrypt = CryptoJS.AES.decrypt(srcs, key, { | |
| 22 | + iv: iv, | |
| 23 | + mode: CryptoJS.mode.CBC, | |
| 24 | + padding: CryptoJS.pad.Pkcs7 | |
| 25 | + }); | |
| 26 | + let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8); | |
| 27 | + return decryptedStr.toString(); | |
| 28 | + }, | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + addDate(date, days) { | |
| 34 | + var d = new Date(date) | |
| 35 | + d.setDate(d.getDate() + days) | |
| 36 | + var month = d.getMonth() + 1 | |
| 37 | + var day = d.getDate() | |
| 38 | + if (month < 10) { | |
| 39 | + month = '0' + month | |
| 40 | + } | |
| 41 | + if (day < 10) { | |
| 42 | + day = '0' + day | |
| 43 | + } | |
| 44 | + var val = d.getFullYear() + '-' + month + '-' + day | |
| 45 | + return val | |
| 46 | + }, | |
| 47 | + | |
| 48 | + ObjectToQureyParams(obj) { | |
| 49 | + let arr = [] | |
| 50 | + for (let key in obj) { | |
| 51 | + arr.push(`${key}=${obj[key]}`); | |
| 52 | + } | |
| 53 | + return arr.join('&'); | |
| 54 | + }, | |
| 55 | + formatTime(date, formatStr) { | |
| 56 | + formatStr = formatStr || 'yyyy-MM-dd HH:mm:ss'; | |
| 57 | + date = new Date(date) || new Date(); | |
| 58 | + formatStr = formatStr.replace('yyyy', date.getFullYear()); | |
| 59 | + formatStr = formatStr.replace('MM', (date.getMonth() + 1).toString().padStart(2, '0')); | |
| 60 | + formatStr = formatStr.replace('dd', (date.getDate()).toString().padStart(2, '0')); | |
| 61 | + formatStr = formatStr.replace('HH', (date.getHours()).toString().padStart(2, '0')); | |
| 62 | + formatStr = formatStr.replace('mm', (date.getMinutes()).toString().padStart(2, '0')); | |
| 63 | + formatStr = formatStr.replace('ss', (date.getSeconds()).toString().padStart(2, '0')); | |
| 64 | + formatStr = formatStr.replace('M', (date.getMonth() + 1)); | |
| 65 | + formatStr = formatStr.replace('d', date.getDate()); | |
| 66 | + formatStr = formatStr.replace('H', date.getHours()); | |
| 67 | + formatStr = formatStr.replace('m', date.getMinutes()); | |
| 68 | + formatStr = formatStr.replace('s', date.getSeconds()); | |
| 69 | + return formatStr; | |
| 70 | + }, | |
| 71 | + parseTime(str) { | |
| 72 | + return new Date(str); | |
| 73 | + }, | |
| 74 | + // imagePathToBase64(path){ | |
| 75 | + // return new Promise((resolve,reject)=>{ | |
| 76 | + // pathToBase64(path) | |
| 77 | + // .then(base64 => { | |
| 78 | + // resolve(base64) | |
| 79 | + // }) | |
| 80 | + // .catch(error => { | |
| 81 | + // reject(error) | |
| 82 | + // }) | |
| 83 | + // }); | |
| 84 | + // }, | |
| 85 | + getUrlQueryParam(url, key) { | |
| 86 | + try { | |
| 87 | + let query = url.split('?')[1]; | |
| 88 | + query = query.split('&'); | |
| 89 | + return query.map(t => { | |
| 90 | + return { | |
| 91 | + key: t.split('=')[0], | |
| 92 | + val: t.split('=')[1] | |
| 93 | + } | |
| 94 | + }).find(t => t.key == key).val; | |
| 95 | + } catch (e) { | |
| 96 | + return ''; | |
| 97 | + } | |
| 98 | + | |
| 99 | + } | |
| 100 | + | |
| 101 | +}; | |
| 102 | +export default utils; | ... | ... |
src/utils/validate.js
0 → 100644
| 1 | +/** | |
| 2 | + * Created by PanJiaChen on 16/11/18. | |
| 3 | + */ | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * @param {string} path | |
| 7 | + * @returns {Boolean} | |
| 8 | + */ | |
| 9 | +export function isExternal(path) { | |
| 10 | + return /^(https?:|mailto:|tel:)/.test(path) | |
| 11 | +} | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * @param {string} str | |
| 15 | + * @returns {Boolean} | |
| 16 | + */ | |
| 17 | +export function validUsername(str) { | |
| 18 | + const valid_map = ['admin', 'editor'] | |
| 19 | + return valid_map.indexOf(str.trim()) >= 0 | |
| 20 | +} | ... | ... |
src/views/404.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="wscn-http404-container"> | |
| 3 | + <div class="wscn-http404"> | |
| 4 | + <div class="pic-404"> | |
| 5 | + <img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404"> | |
| 6 | + <img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404"> | |
| 7 | + <img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404"> | |
| 8 | + <img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404"> | |
| 9 | + </div> | |
| 10 | + <div class="bullshit"> | |
| 11 | + <div class="bullshit__oops">OOPS!</div> | |
| 12 | + <div class="bullshit__info">All rights reserved | |
| 13 | + <a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a> | |
| 14 | + </div> | |
| 15 | + <div class="bullshit__headline">{{ message }}</div> | |
| 16 | + <div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div> | |
| 17 | + <a href="" class="bullshit__return-home">Back to home</a> | |
| 18 | + </div> | |
| 19 | + </div> | |
| 20 | + </div> | |
| 21 | +</template> | |
| 22 | + | |
| 23 | +<script> | |
| 24 | + | |
| 25 | +export default { | |
| 26 | + name: 'Page404', | |
| 27 | + computed: { | |
| 28 | + message() { | |
| 29 | + return 'The webmaster said that you can not enter this page...' | |
| 30 | + } | |
| 31 | + } | |
| 32 | +} | |
| 33 | +</script> | |
| 34 | + | |
| 35 | +<style lang="scss" scoped> | |
| 36 | +.wscn-http404-container{ | |
| 37 | + transform: translate(-50%,-50%); | |
| 38 | + position: absolute; | |
| 39 | + top: 40%; | |
| 40 | + left: 50%; | |
| 41 | +} | |
| 42 | +.wscn-http404 { | |
| 43 | + position: relative; | |
| 44 | + width: 1200px; | |
| 45 | + padding: 0 50px; | |
| 46 | + overflow: hidden; | |
| 47 | + .pic-404 { | |
| 48 | + position: relative; | |
| 49 | + float: left; | |
| 50 | + width: 600px; | |
| 51 | + overflow: hidden; | |
| 52 | + &__parent { | |
| 53 | + width: 100%; | |
| 54 | + } | |
| 55 | + &__child { | |
| 56 | + position: absolute; | |
| 57 | + &.left { | |
| 58 | + width: 80px; | |
| 59 | + top: 17px; | |
| 60 | + left: 220px; | |
| 61 | + opacity: 0; | |
| 62 | + animation-name: cloudLeft; | |
| 63 | + animation-duration: 2s; | |
| 64 | + animation-timing-function: linear; | |
| 65 | + animation-fill-mode: forwards; | |
| 66 | + animation-delay: 1s; | |
| 67 | + } | |
| 68 | + &.mid { | |
| 69 | + width: 46px; | |
| 70 | + top: 10px; | |
| 71 | + left: 420px; | |
| 72 | + opacity: 0; | |
| 73 | + animation-name: cloudMid; | |
| 74 | + animation-duration: 2s; | |
| 75 | + animation-timing-function: linear; | |
| 76 | + animation-fill-mode: forwards; | |
| 77 | + animation-delay: 1.2s; | |
| 78 | + } | |
| 79 | + &.right { | |
| 80 | + width: 62px; | |
| 81 | + top: 100px; | |
| 82 | + left: 500px; | |
| 83 | + opacity: 0; | |
| 84 | + animation-name: cloudRight; | |
| 85 | + animation-duration: 2s; | |
| 86 | + animation-timing-function: linear; | |
| 87 | + animation-fill-mode: forwards; | |
| 88 | + animation-delay: 1s; | |
| 89 | + } | |
| 90 | + @keyframes cloudLeft { | |
| 91 | + 0% { | |
| 92 | + top: 17px; | |
| 93 | + left: 220px; | |
| 94 | + opacity: 0; | |
| 95 | + } | |
| 96 | + 20% { | |
| 97 | + top: 33px; | |
| 98 | + left: 188px; | |
| 99 | + opacity: 1; | |
| 100 | + } | |
| 101 | + 80% { | |
| 102 | + top: 81px; | |
| 103 | + left: 92px; | |
| 104 | + opacity: 1; | |
| 105 | + } | |
| 106 | + 100% { | |
| 107 | + top: 97px; | |
| 108 | + left: 60px; | |
| 109 | + opacity: 0; | |
| 110 | + } | |
| 111 | + } | |
| 112 | + @keyframes cloudMid { | |
| 113 | + 0% { | |
| 114 | + top: 10px; | |
| 115 | + left: 420px; | |
| 116 | + opacity: 0; | |
| 117 | + } | |
| 118 | + 20% { | |
| 119 | + top: 40px; | |
| 120 | + left: 360px; | |
| 121 | + opacity: 1; | |
| 122 | + } | |
| 123 | + 70% { | |
| 124 | + top: 130px; | |
| 125 | + left: 180px; | |
| 126 | + opacity: 1; | |
| 127 | + } | |
| 128 | + 100% { | |
| 129 | + top: 160px; | |
| 130 | + left: 120px; | |
| 131 | + opacity: 0; | |
| 132 | + } | |
| 133 | + } | |
| 134 | + @keyframes cloudRight { | |
| 135 | + 0% { | |
| 136 | + top: 100px; | |
| 137 | + left: 500px; | |
| 138 | + opacity: 0; | |
| 139 | + } | |
| 140 | + 20% { | |
| 141 | + top: 120px; | |
| 142 | + left: 460px; | |
| 143 | + opacity: 1; | |
| 144 | + } | |
| 145 | + 80% { | |
| 146 | + top: 180px; | |
| 147 | + left: 340px; | |
| 148 | + opacity: 1; | |
| 149 | + } | |
| 150 | + 100% { | |
| 151 | + top: 200px; | |
| 152 | + left: 300px; | |
| 153 | + opacity: 0; | |
| 154 | + } | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + .bullshit { | |
| 159 | + position: relative; | |
| 160 | + float: left; | |
| 161 | + width: 300px; | |
| 162 | + padding: 30px 0; | |
| 163 | + overflow: hidden; | |
| 164 | + &__oops { | |
| 165 | + font-size: 32px; | |
| 166 | + font-weight: bold; | |
| 167 | + line-height: 40px; | |
| 168 | + color: #1482f0; | |
| 169 | + opacity: 0; | |
| 170 | + margin-bottom: 20px; | |
| 171 | + animation-name: slideUp; | |
| 172 | + animation-duration: 0.5s; | |
| 173 | + animation-fill-mode: forwards; | |
| 174 | + } | |
| 175 | + &__headline { | |
| 176 | + font-size: 20px; | |
| 177 | + line-height: 24px; | |
| 178 | + color: #222; | |
| 179 | + font-weight: bold; | |
| 180 | + opacity: 0; | |
| 181 | + margin-bottom: 10px; | |
| 182 | + animation-name: slideUp; | |
| 183 | + animation-duration: 0.5s; | |
| 184 | + animation-delay: 0.1s; | |
| 185 | + animation-fill-mode: forwards; | |
| 186 | + } | |
| 187 | + &__info { | |
| 188 | + font-size: 13px; | |
| 189 | + line-height: 21px; | |
| 190 | + color: grey; | |
| 191 | + opacity: 0; | |
| 192 | + margin-bottom: 30px; | |
| 193 | + animation-name: slideUp; | |
| 194 | + animation-duration: 0.5s; | |
| 195 | + animation-delay: 0.2s; | |
| 196 | + animation-fill-mode: forwards; | |
| 197 | + } | |
| 198 | + &__return-home { | |
| 199 | + display: block; | |
| 200 | + float: left; | |
| 201 | + width: 110px; | |
| 202 | + height: 36px; | |
| 203 | + background: #1482f0; | |
| 204 | + border-radius: 100px; | |
| 205 | + text-align: center; | |
| 206 | + color: #ffffff; | |
| 207 | + opacity: 0; | |
| 208 | + font-size: 14px; | |
| 209 | + line-height: 36px; | |
| 210 | + cursor: pointer; | |
| 211 | + animation-name: slideUp; | |
| 212 | + animation-duration: 0.5s; | |
| 213 | + animation-delay: 0.3s; | |
| 214 | + animation-fill-mode: forwards; | |
| 215 | + } | |
| 216 | + @keyframes slideUp { | |
| 217 | + 0% { | |
| 218 | + transform: translateY(60px); | |
| 219 | + opacity: 0; | |
| 220 | + } | |
| 221 | + 100% { | |
| 222 | + transform: translateY(0); | |
| 223 | + opacity: 1; | |
| 224 | + } | |
| 225 | + } | |
| 226 | + } | |
| 227 | +} | |
| 228 | +</style> | ... | ... |
src/views/AdminManage/AdminManage.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 20px;"> | |
| 3 | + <el-form :inline="true" :model="form" class="demo-form-inline"> | |
| 4 | + <el-form-item label="用户名"> | |
| 5 | + <el-input v-model="form.username" placeholder="用户名"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item label="密码"> | |
| 8 | + <el-input v-model="form.password" placeholder="密码"></el-input> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item> | |
| 11 | + <el-button type="primary" @click="AddSubmit">添加下级管理</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + </el-form> | |
| 14 | + <el-table :data="tableData" style="width: 100%"> | |
| 15 | + <el-table-column prop="id" label="ID" > | |
| 16 | + <template slot-scope="scope"> | |
| 17 | + {{scope.row.id}} | |
| 18 | + </template> | |
| 19 | + </el-table-column> | |
| 20 | + <el-table-column prop="username" label="用户名" > | |
| 21 | + <template slot-scope="scope"> | |
| 22 | + {{scope.row.username}} | |
| 23 | + </template> | |
| 24 | + </el-table-column> | |
| 25 | + <el-table-column prop="password" label="密码" > | |
| 26 | + <template slot-scope="scope"> | |
| 27 | + {{scope.row.password}} | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + <el-table-column prop="password" label="操作" > | |
| 31 | + <template slot-scope="scope"> | |
| 32 | + <el-button type="warning" @click="DelSubAdmin(scope.row.id)">删除</el-button> | |
| 33 | + </template> | |
| 34 | + </el-table-column> | |
| 35 | + </el-table> | |
| 36 | + <el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-page="Pages" | |
| 37 | + style="text-align: right;margin-top: 10px;"> | |
| 38 | + </el-pagination> | |
| 39 | + </div> | |
| 40 | +</template> | |
| 41 | + | |
| 42 | +<script> | |
| 43 | + import { | |
| 44 | + AddSubAdmin, | |
| 45 | + GetSubAdminList, | |
| 46 | + DelAdmin | |
| 47 | + } from '../../api/user.js' | |
| 48 | + export default { | |
| 49 | + data() { | |
| 50 | + return { | |
| 51 | + tableData: [], | |
| 52 | + model: { | |
| 53 | + "KeyWord": "", | |
| 54 | + "TotalCount": 0, | |
| 55 | + "PageIndex": 1, | |
| 56 | + "PageSize": 20, | |
| 57 | + "Sort": [{ | |
| 58 | + "Field": "", | |
| 59 | + "Type": 0 | |
| 60 | + }] | |
| 61 | + }, | |
| 62 | + form: { | |
| 63 | + "username": "", | |
| 64 | + "password": "" | |
| 65 | + } | |
| 66 | + } | |
| 67 | + }, | |
| 68 | + created() { | |
| 69 | + this.ShowSubAdmin() | |
| 70 | + }, | |
| 71 | + methods: { | |
| 72 | + // 添加下级管理数据 | |
| 73 | + AddSubmit(){ | |
| 74 | + if(this.form.username==''){ | |
| 75 | + this.$message.error('请输入用户名') | |
| 76 | + return | |
| 77 | + } | |
| 78 | + if(this.form.password==''){ | |
| 79 | + this.$message.error('请输入密码') | |
| 80 | + return | |
| 81 | + } | |
| 82 | + AddSubAdmin(this.form).then(res=>{ | |
| 83 | + if(res.data.code==200){ | |
| 84 | + this.$message.success('添加下级管理成功') | |
| 85 | + this.ShowSubAdmin() | |
| 86 | + }else{ | |
| 87 | + this.$message.error('添加下级管理失败') | |
| 88 | + } | |
| 89 | + }) | |
| 90 | + }, | |
| 91 | + Pages(e) { | |
| 92 | + this.model.PageIndex = e | |
| 93 | + this.ShowSubAdmin() | |
| 94 | + }, | |
| 95 | + ShowSubAdmin() { | |
| 96 | + GetSubAdminList(this.model).then(res => { | |
| 97 | + this.tableData = res.data.data.rows | |
| 98 | + this.model.TotalCount = res.data.data.total | |
| 99 | + }) | |
| 100 | + }, | |
| 101 | + DelSubAdmin(id) { | |
| 102 | + DelAdmin(id).then(res => { | |
| 103 | + console.log('数据') | |
| 104 | + if (res.data.code == 200) { | |
| 105 | + this.$message.success('删除下级管理成功') | |
| 106 | + this.ShowSubAdmin() | |
| 107 | + } else { | |
| 108 | + this.$message.error('删除下级管理失败') | |
| 109 | + } | |
| 110 | + }) | |
| 111 | + } | |
| 112 | + } | |
| 113 | + } | |
| 114 | +</script> | |
| 115 | + | |
| 116 | +<style> | |
| 117 | +</style> | ... | ... |
src/views/QuestionBank/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <el-row id="elRow"> | |
| 5 | + <el-col :span="4" :style="{'height':TreeColHeight+'px'}"> | |
| 6 | + <div style="margin-right: 10px;height: 100%;"> | |
| 7 | + <div class="TreeHeader"> | |
| 8 | + <label style="font-size: 18px;">题目分类</label> | |
| 9 | + <el-button type="primary" class="classbtn">添加分类 | |
| 10 | + </el-button> | |
| 11 | + </div> | |
| 12 | + <div :style="{'height':TableColHeight+'px'}" class="areadiv" | |
| 13 | + style="margin:10px 0 0 0;padding: 5px 0 0 0;"> | |
| 14 | + <el-tree :data="treeData" :props="treeData" @node-click="handleNodeClick" class="eltree" :expand-on-click-node=false> | |
| 15 | + </el-tree> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + </el-col> | |
| 19 | + <el-col :span="20"> | |
| 20 | + <div class="grid-content bg-purple-light"> | |
| 21 | + <div class="seetingsDiv" style=""> | |
| 22 | + <el-button type="primary" @click="dialogsubjectlVisible=true">添加题目 | |
| 23 | + </el-button> | |
| 24 | + </div> | |
| 25 | + <div class="areadiv" :style="{'height':TableColHeight+'px'}"> | |
| 26 | + <el-table :data="QuestList" id="QuestionTable" border | |
| 27 | + style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;" | |
| 28 | + :header-cell-class-name="headerStyle" :stripe=true> | |
| 29 | + <el-table-column prop="date" label="ID" width="50"> | |
| 30 | + <template slot-scope="scope"> | |
| 31 | + <span>{{ scope.row.id }}</span> | |
| 32 | + </template> | |
| 33 | + </el-table-column> | |
| 34 | + <el-table-column prop="date" label="题目类型" width="100"> | |
| 35 | + <template slot-scope="scope"> | |
| 36 | + <span style="padding-left: 10px;">{{ scope.row.subjectName }}</span> | |
| 37 | + </template> | |
| 38 | + </el-table-column> | |
| 39 | + <el-table-column prop="QuestionClassName" label="分类" width="100"> | |
| 40 | + <template slot-scope="scope"> | |
| 41 | + <span style="padding-left: 10px;">{{ scope.row.QuestionClassName }}</span> | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + <el-table-column prop="name" label="分数" width="80"> | |
| 45 | + <template slot-scope="scope"> | |
| 46 | + <span style="padding-left: 10px;">{{ scope.row.fraction }}</span> | |
| 47 | + </template> | |
| 48 | + </el-table-column> | |
| 49 | + <el-table-column prop="name" label="单项分数" width="80"> | |
| 50 | + <template slot-scope="scope"> | |
| 51 | + <span style="padding-left: 10px;">{{ scope.row.singleFraction }}</span> | |
| 52 | + </template> | |
| 53 | + </el-table-column> | |
| 54 | + <el-table-column prop="name" label="正确答案" width="80"> | |
| 55 | + <template slot-scope="scope"> | |
| 56 | + <span style="padding-left: 10px;">{{ scope.row.answer }}</span> | |
| 57 | + </template> | |
| 58 | + </el-table-column> | |
| 59 | + <el-table-column prop="name" label="题目" :show-overflow-tooltip=true> | |
| 60 | + <template slot-scope="scope"> | |
| 61 | + <span style="padding-left: 10px;">{{ scope.row.subject }}</span> | |
| 62 | + </template> | |
| 63 | + </el-table-column> | |
| 64 | + <el-table-column prop="name" label="解析" :show-overflow-tooltip=true> | |
| 65 | + <template slot-scope="scope"> | |
| 66 | + <span style="padding-left: 10px;">{{ scope.row.analysis }}</span> | |
| 67 | + </template> | |
| 68 | + </el-table-column> | |
| 69 | + <el-table-column fixed="right" label="操作" width="150"> | |
| 70 | + <template slot-scope="scope"> | |
| 71 | + <el-dropdown @command="(e)=>{handleCommand(e,scope.row.id)}" | |
| 72 | + style="padding-left: 10px;"> | |
| 73 | + <span class="el-dropdown-link"> | |
| 74 | + 操作<i class="el-icon-arrow-down el-icon--right"></i> | |
| 75 | + </span> | |
| 76 | + <template #dropdown> | |
| 77 | + <el-dropdown-menu> | |
| 78 | + <el-dropdown-item command="update">编辑</el-dropdown-item> | |
| 79 | + <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> --> | |
| 80 | + <el-dropdown-item command="del">删除</el-dropdown-item> | |
| 81 | + </el-dropdown-menu> | |
| 82 | + </template> | |
| 83 | + </el-dropdown> | |
| 84 | + </template> | |
| 85 | + </el-table-column> | |
| 86 | + </el-table> | |
| 87 | + <el-pagination background @current-change="currentchange" | |
| 88 | + style="position:static;bottom: 3px;text-align: center;margin-top: 5px;" | |
| 89 | + :page-size="this.parameter.pageSize" layout="total,prev, pager, next" :total="Count"> | |
| 90 | + </el-pagination> | |
| 91 | + <div style="clear: both;"></div> | |
| 92 | + </div> | |
| 93 | + </div> | |
| 94 | + </el-col> | |
| 95 | + </el-row> | |
| 96 | + | |
| 97 | + <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close='closeDialog' width="800px" | |
| 98 | + :close-on-click-modal="false"> | |
| 99 | + <el-form ref="Dataform" :model="Dataform" label-width="60px"> | |
| 100 | + <el-form-item label="题目"> | |
| 101 | + <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input> | |
| 102 | + </el-form-item> | |
| 103 | + <el-form-item label="分类" style="padding-top: 5px;"> | |
| 104 | + <el-cascader v-model="Dataform.QuestionClassId" style="width:400px" :props="{emitPath:false}" | |
| 105 | + :clearable=true :options="QuestionClass"> | |
| 106 | + </el-cascader> | |
| 107 | + </el-form-item> | |
| 108 | + <el-form-item label="题型" style="padding-top: 5px;"> | |
| 109 | + <el-select v-model="Dataform.subjectType" value-key="Dataform.subjectType" | |
| 110 | + @change="changeQuestionType" placeholder="请选择题型"> | |
| 111 | + <el-option label="单选题" :value="1"></el-option> | |
| 112 | + <el-option label="多选题" :value="2"></el-option> | |
| 113 | + <el-option label="主观题" :value="3"></el-option> | |
| 114 | + </el-select> | |
| 115 | + </el-form-item> | |
| 116 | + <el-form-item label="选项" v-show="OptionVisible"> | |
| 117 | + <el-table :data="subjectContent" :show-header="false"> | |
| 118 | + <el-table-column> | |
| 119 | + <template slot-scope="scope"> | |
| 120 | + <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput"> | |
| 121 | + <template slot="prepend">{{scope.row.option}}</template> | |
| 122 | + </el-input> | |
| 123 | + <i class="el-icon-circle-plus el-icon" @click="Addlist"></i> | |
| 124 | + <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index!=0"></i> | |
| 125 | + </template> | |
| 126 | + </el-table-column> | |
| 127 | + </el-table> | |
| 128 | + </el-form-item> | |
| 129 | + <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass"> | |
| 130 | + <el-radio-group v-for="(item,i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible"> | |
| 131 | + <el-radio :label="item.option">{{item.option}}</el-radio> | |
| 132 | + </el-radio-group> | |
| 133 | + <el-checkbox-group v-for="(item,i) in subjectContent" v-model="Dataform.answer" | |
| 134 | + v-if="!GroupVisible"> | |
| 135 | + <el-checkbox style="float: left;" :label="item.option">{{item.option}}</el-checkbox> | |
| 136 | + </el-checkbox-group> | |
| 137 | + </el-form-item> | |
| 138 | + <el-form-item label="分数" v-show="OptionVisible"> | |
| 139 | + <el-input-number :step="1" style="float: left;" :min="0" v-model="Dataform.fraction"> | |
| 140 | + </el-input-number> | |
| 141 | + <div style="float: left;margin-left: 20px;" v-if="!GroupVisible"> | |
| 142 | + <lable style="font-weight: bold;">单项分数:</lable> | |
| 143 | + <el-input-number :step="0.5" :max="Dataform.fraction/2" :min="0" | |
| 144 | + v-model="Dataform.singleFraction"> | |
| 145 | + </el-input-number> | |
| 146 | + </div> | |
| 147 | + </el-form-item> | |
| 148 | + <el-form-item label="解析" style="margin-top: 10px;"> | |
| 149 | + <el-input v-model="Dataform.analysis" :rows="10" type="textarea" placeholder="请输入答案解析" /> | |
| 150 | + </el-form-item> | |
| 151 | + </el-form> | |
| 152 | + <el-button @click="EditQuestionHeadler" style="margin: 10px 0 0 0 ;float:right" type="primary">确定 | |
| 153 | + </el-button> | |
| 154 | + <div style="clear: both;"></div> | |
| 155 | + </el-dialog> | |
| 156 | + </div> | |
| 157 | +</template> | |
| 158 | + | |
| 159 | +<script lang="ts"> | |
| 160 | + import { | |
| 161 | + getQuestionList, | |
| 162 | + EditQuestion, | |
| 163 | + getQuestionClassList, | |
| 164 | + DelQuestionBankEvent, | |
| 165 | + GetQuestionBankById | |
| 166 | + } from '@/api/QuestionBank' | |
| 167 | + import { | |
| 168 | + parseTime | |
| 169 | + } from '@/utils/index.js' | |
| 170 | + export default { | |
| 171 | + filters: {}, | |
| 172 | + data() { | |
| 173 | + return { | |
| 174 | + parameter: { | |
| 175 | + pageIndex: 1, | |
| 176 | + pageSize: 12, | |
| 177 | + sort: "id", | |
| 178 | + sortOrder: 1, | |
| 179 | + keyword: "", | |
| 180 | + QuestionClassId: 0, | |
| 181 | + status: 1 | |
| 182 | + }, | |
| 183 | + Count: 0, | |
| 184 | + QuestList: [], | |
| 185 | + dialogsubjectlVisible: false, | |
| 186 | + OptionVisible: true, | |
| 187 | + GroupVisible: true, | |
| 188 | + Dataform: { | |
| 189 | + subject: "", | |
| 190 | + subjectType: 1, | |
| 191 | + subjectContent: "", | |
| 192 | + QuestionClassId: 0, | |
| 193 | + answer: [], | |
| 194 | + analysis: "", | |
| 195 | + fraction: 0, | |
| 196 | + singleFraction: 0, | |
| 197 | + addTime: "2021-11-12", | |
| 198 | + state: 1 | |
| 199 | + }, | |
| 200 | + subjectContent: [{ | |
| 201 | + option: "A", | |
| 202 | + optionContent: "" | |
| 203 | + }], | |
| 204 | + QuestionClass: [], | |
| 205 | + TreeColHeight: 0, | |
| 206 | + TableColHeight: 0, | |
| 207 | + treeData: [{ | |
| 208 | + value:0, | |
| 209 | + label:"全部" | |
| 210 | + }] | |
| 211 | + } | |
| 212 | + }, | |
| 213 | + created() { | |
| 214 | + | |
| 215 | + }, | |
| 216 | + mounted() { | |
| 217 | + let ContentAreaHight = window.innerHeight - document.getElementById("elRow").offsetTop - 70; | |
| 218 | + this.TableColHeight = ContentAreaHight - document.getElementById("QuestionTable").offsetTop; | |
| 219 | + let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算 | |
| 220 | + this.TreeColHeight = ContentAreaHight; | |
| 221 | + lineNumber = Math.floor(lineNumber / 49) | |
| 222 | + this.parameter.pageSize = lineNumber; | |
| 223 | + this.GetList(); | |
| 224 | + this.getQuestionClassListHeadler(); | |
| 225 | + }, | |
| 226 | + methods: { | |
| 227 | + //表格右边的操作按钮 | |
| 228 | + handleCommand(value, val) { | |
| 229 | + if (value == "update") { | |
| 230 | + this.GetQuestionBankByIdHeadler(val); | |
| 231 | + } | |
| 232 | + if (value == "del") { | |
| 233 | + this.DelQuestionBankEventHeadler(val); | |
| 234 | + } | |
| 235 | + }, | |
| 236 | + //获取选择的题目详细信息 | |
| 237 | + GetQuestionBankByIdHeadler(id) { | |
| 238 | + GetQuestionBankById(id).then(res => { | |
| 239 | + this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容 | |
| 240 | + this.Dataform = res.data.data; //内容赋值 | |
| 241 | + this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项 | |
| 242 | + if (res.data.data.subjectType == 1) { | |
| 243 | + this.Dataform.answer = res.data.data.answer.split(',')[0]; //赋值答案 | |
| 244 | + } else { | |
| 245 | + this.Dataform.answer = res.data.data.answer.split(','); //赋值答案 | |
| 246 | + } | |
| 247 | + this.dialogsubjectlVisible = true; | |
| 248 | + | |
| 249 | + }); | |
| 250 | + }, | |
| 251 | + //关闭弹框的事件 | |
| 252 | + closeDialog() { | |
| 253 | + //初始化数据 | |
| 254 | + this.Dataform = this.$options.data().Dataform; | |
| 255 | + this.subjectContent = this.$options.data().subjectContent; | |
| 256 | + //所有文本框恢复到初始化状态 | |
| 257 | + this.Dataform.answer = []; | |
| 258 | + this.OptionVisible = true; | |
| 259 | + this.GroupVisible = true; | |
| 260 | + }, | |
| 261 | + //选择题目类型来判断是否显示部分表单 | |
| 262 | + changeQuestionType(val) { | |
| 263 | + if (val == 3) { | |
| 264 | + this.OptionVisible = false; | |
| 265 | + } | |
| 266 | + if (val == 2) { | |
| 267 | + this.OptionVisible = true; | |
| 268 | + this.Dataform.answer = []; | |
| 269 | + this.GroupVisible = false; | |
| 270 | + } | |
| 271 | + if (val == 1) { | |
| 272 | + this.Dataform.answer = []; | |
| 273 | + this.OptionVisible = true; | |
| 274 | + this.GroupVisible = true; | |
| 275 | + } | |
| 276 | + }, | |
| 277 | + headerStyle({ | |
| 278 | + row, | |
| 279 | + column, | |
| 280 | + rowIndex, | |
| 281 | + columnIndex | |
| 282 | + }) { | |
| 283 | + return 'tableStyle' | |
| 284 | + }, | |
| 285 | + Addlist() { | |
| 286 | + if (this.subjectContent.length < 4) { | |
| 287 | + var alphabet = String.fromCharCode(64 + parseInt(this.subjectContent.length + 1)); | |
| 288 | + this.subjectContent.push({ | |
| 289 | + "option": alphabet, | |
| 290 | + "title": "" | |
| 291 | + }); | |
| 292 | + } else { | |
| 293 | + this.$confirm('系统暂时只支持4个答案!', '消息') | |
| 294 | + } | |
| 295 | + }, | |
| 296 | + RemoveList(val) { | |
| 297 | + this.subjectContent.splice(val.$index, 1); | |
| 298 | + this.subjectContent.forEach((item, index) => { | |
| 299 | + item.option = String.fromCharCode(64 + parseInt(index + 1)); | |
| 300 | + }) | |
| 301 | + }, | |
| 302 | + handleNodeClick(val) { | |
| 303 | + this.parameter.QuestionClassId = val.value; | |
| 304 | + this.parameter.pageIndex = 1; | |
| 305 | + this.GetList(); | |
| 306 | + }, | |
| 307 | + DelQuestionBankEventHeadler(id) { | |
| 308 | + this.$confirm('确定删除该试题?', '消息', { | |
| 309 | + confirmButtonText: '确认', | |
| 310 | + cancelButtonText: '取消', | |
| 311 | + callback: (action) => { | |
| 312 | + if (action == "confirm") { | |
| 313 | + DelQuestionBankEvent(id).then(res => { | |
| 314 | + if (res.data.code == 200) { | |
| 315 | + this.$confirm(res.data.message, '消息') | |
| 316 | + this.GetList(); | |
| 317 | + } | |
| 318 | + }); | |
| 319 | + } | |
| 320 | + }, | |
| 321 | + }) | |
| 322 | + }, | |
| 323 | + EditQuestionHeadler() { | |
| 324 | + let reg = new RegExp('"', 'g'); | |
| 325 | + //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\""); | |
| 326 | + this.Dataform.subjectContent = this.subjectContent; | |
| 327 | + if (typeof(this.Dataform.answer) != 'string') //判断是否为字符串 | |
| 328 | + this.Dataform.answer = this.Dataform.answer.join(',') | |
| 329 | + var _this = this; | |
| 330 | + EditQuestion(this.Dataform).then(res => { | |
| 331 | + if (res.data.code == 200) { | |
| 332 | + _this.GetList(); | |
| 333 | + this.$message(res.data.message); | |
| 334 | + setTimeout(function() { | |
| 335 | + _this.dialogsubjectlVisible = false; | |
| 336 | + }, 10) | |
| 337 | + } | |
| 338 | + }); | |
| 339 | + }, | |
| 340 | + GetList() { | |
| 341 | + let _this = this; | |
| 342 | + getQuestionList(_this.parameter).then(res => { | |
| 343 | + _this.QuestList = res.data.data.rows; | |
| 344 | + _this.Count = res.data.data.total; | |
| 345 | + _this.$forceUpdate(); | |
| 346 | + }); | |
| 347 | + }, | |
| 348 | + currentchange(page) { | |
| 349 | + this.parameter.pageIndex = page; | |
| 350 | + this.GetList(); | |
| 351 | + }, | |
| 352 | + getQuestionClassListHeadler() { | |
| 353 | + let _this = this; | |
| 354 | + getQuestionClassList().then(res => { | |
| 355 | + var gettree = function(titem) { | |
| 356 | + titem.children = [] | |
| 357 | + let childrenList = res.data.data.filter(u => u.ParentId == titem.value); | |
| 358 | + if (childrenList.length == 0) | |
| 359 | + titem.children = undefined; | |
| 360 | + res.data.data.filter(u => u.ParentId == titem.value).forEach((item, i) => { | |
| 361 | + var model = { | |
| 362 | + value: item.id, | |
| 363 | + label: item.ClassificationName | |
| 364 | + }; | |
| 365 | + gettree(model); | |
| 366 | + titem.children.push(model); | |
| 367 | + }) | |
| 368 | + } | |
| 369 | + res.data.data.filter(u => u.ParentId == 0).forEach((item, i) => { | |
| 370 | + var model = { | |
| 371 | + value: item.id, | |
| 372 | + label: item.ClassificationName | |
| 373 | + }; | |
| 374 | + gettree(model); | |
| 375 | + _this.QuestionClass.push(model); | |
| 376 | + _this.treeData.push(model) | |
| 377 | + }) | |
| 378 | + }); | |
| 379 | + } | |
| 380 | + } | |
| 381 | + } | |
| 382 | +</script> | |
| 383 | +<style scoped="scoped"> | |
| 384 | + /deep/.cell { | |
| 385 | + padding-left: 0px; | |
| 386 | + } | |
| 387 | + /deep/.el-form-item { | |
| 388 | + margin-bottom: 5px; | |
| 389 | + } | |
| 390 | + /deep/.el-radio { | |
| 391 | + margin-right: 10px; | |
| 392 | + } | |
| 393 | + /deep/.el-radio__input.is-checked .el-radio__inner { | |
| 394 | + border-color: #409EFF; | |
| 395 | + background-color: #409EFF; | |
| 396 | + } | |
| 397 | + /deep/.el-radio__input.is-checked+.el-radio__label { | |
| 398 | + color: #409EFF; | |
| 399 | + font-weight: bold; | |
| 400 | + } | |
| 401 | + /deep/.tableStyle { | |
| 402 | + background-color: #304156 !important; | |
| 403 | + color: #fff; | |
| 404 | + font-weight: 400; | |
| 405 | + } | |
| 406 | + .QuestDiv { | |
| 407 | + width: 24%; | |
| 408 | + float: left; | |
| 409 | + min-height: 50px; | |
| 410 | + border: 1px solid #CDCDCD; | |
| 411 | + margin-right: 10px; | |
| 412 | + box-shadow: 0 0 10px #808080; | |
| 413 | + border-radius: 8px; | |
| 414 | + min-height: 100px; | |
| 415 | + background-color: #FFF; | |
| 416 | + opacity: 0.8; | |
| 417 | + margin-bottom: 10px; | |
| 418 | + height: 313px; | |
| 419 | + } | |
| 420 | + .clear { | |
| 421 | + clear: both; | |
| 422 | + margin-bottom: 10px; | |
| 423 | + } | |
| 424 | + .font-color { | |
| 425 | + background-color: #AE1E15 !important; | |
| 426 | + color: #FFF; | |
| 427 | + box-shadow: 0 0 5px #AE1E15; | |
| 428 | + } | |
| 429 | + /deep/.el-input-group__prepend { | |
| 430 | + font-weight: bold; | |
| 431 | + width: 30px; | |
| 432 | + text-align: center; | |
| 433 | + background: #409EFF; | |
| 434 | + color: #FFF; | |
| 435 | + } | |
| 436 | + .optionInput { | |
| 437 | + float: left; | |
| 438 | + width: 620px !important; | |
| 439 | + } | |
| 440 | + .el-icon { | |
| 441 | + font-size: 20px; | |
| 442 | + line-height: 40px; | |
| 443 | + margin: 0 5px; | |
| 444 | + cursor: pointer; | |
| 445 | + color: #409EFF !important; | |
| 446 | + } | |
| 447 | + >>>.subjectContentClass .el-checkbox__label { | |
| 448 | + padding-right: 10px !important; | |
| 449 | + } | |
| 450 | + .seetingsDiv { | |
| 451 | + width: 100%; | |
| 452 | + height: 60px; | |
| 453 | + background: #efefef; | |
| 454 | + line-height: 60px; | |
| 455 | + border-radius: 5px; | |
| 456 | + box-shadow: 0 0 5px #cdcdcd; | |
| 457 | + } | |
| 458 | + .seetingsDiv button { | |
| 459 | + background-color: #304156; | |
| 460 | + border: 0px; | |
| 461 | + margin-left: 10px; | |
| 462 | + box-shadow: 0 0 5px #cdcdcd; | |
| 463 | + float: right; | |
| 464 | + margin-top: 12px; | |
| 465 | + margin-right: 10px; | |
| 466 | + } | |
| 467 | + .areadiv { | |
| 468 | + background-color: #efefef; | |
| 469 | + border-radius: 5px; | |
| 470 | + box-shadow: 0 0 5px #efefef; | |
| 471 | + } | |
| 472 | + .TreeHeader { | |
| 473 | + background-color: #304156; | |
| 474 | + height: 60px; | |
| 475 | + border-radius: 5px; | |
| 476 | + box-shadow: 0 0 10px #efefef; | |
| 477 | + line-height: 60px; | |
| 478 | + color: #FFF; | |
| 479 | + padding-left: 10px; | |
| 480 | + } | |
| 481 | + .classbtn { | |
| 482 | + float: right; | |
| 483 | + margin: 11px 10px 0 0; | |
| 484 | + height: 35px; | |
| 485 | + line-height: 12px; | |
| 486 | + } | |
| 487 | + .eltree { | |
| 488 | + background-color: #efefef; | |
| 489 | + } | |
| 490 | + /deep/.el-tree-node__content { | |
| 491 | + min-height: 40px; | |
| 492 | + } | |
| 493 | +</style> | ... | ... |
src/views/TestPaper/ManualTestPaper.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <el-row :gutter="20"> | |
| 4 | + <el-col :span="6" :style="{'height':contentHeight+'px'}"> | |
| 5 | + <div class="grid-content bg-purple"> | |
| 6 | + <div style="width: 100%;height: 80px;background: red;"> | |
| 7 | + </div> | |
| 8 | + <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1" | |
| 9 | + @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}" | |
| 10 | + infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto"> | |
| 11 | + <li v-for="i in arr1" class="infinite-list-item">{{ i.subject }}</li> | |
| 12 | + <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p> | |
| 13 | + <p v-if="noMore" style="text-align: center;color: #cdcdcd;" class="unmover">没有更多了</p> | |
| 14 | + </li> | |
| 15 | + </draggable> | |
| 16 | + | |
| 17 | + </div> | |
| 18 | + </el-col> | |
| 19 | + <el-col :span="10" :style="{'height':contentHeight+'px'}"> | |
| 20 | + <div class="grid-content bg-purple"> | |
| 21 | + <div class="areahead"> | |
| 22 | + <span v-show="!edit" style="font-weight: bold;">{{ TestPaper.TestPaperTitle }}</span> | |
| 23 | + <el-input v-show="edit" style="width: 400px;" v-model="TestPaper.TestPaperTitle"></el-input> | |
| 24 | + <i :class="{'el-icon-edit': !edit, 'el-icon-check': edit}" @click="edit = !edit" | |
| 25 | + style="margin-left: 5px;cursor: pointer;"></i> | |
| 26 | + </div> | |
| 27 | + <draggable :options="{animation:380}" group="itxst" v-model="arr2" class="infinite-list" @end="end2" | |
| 28 | + @add="ComeHere" :style="{'height':contentHeight-60+'px'}" | |
| 29 | + style="overflow:auto;padding-top: 10px;"> | |
| 30 | + <li v-for="i in arr2" class="infinite-list-item"> | |
| 31 | + <label>[{{i.subjectName}}]{{ i.subject }}</label> | |
| 32 | + <div v-for="item in JSON.parse(i.subjectContent)"> | |
| 33 | + <p class="option-p">{{item.option}}:{{item.optionContent}}</p> | |
| 34 | + </div> | |
| 35 | + </li> | |
| 36 | + </li> | |
| 37 | + </draggable> | |
| 38 | + </div> | |
| 39 | + </el-col> | |
| 40 | + <el-col :span="8" :style="{'height':contentHeight+'px'}"> | |
| 41 | + <div class="grid-content bg-purple"> | |
| 42 | + <div class="areahead">组卷基本信息</div> | |
| 43 | + <el-form ref="form" class="testPaper-manager" :rules="rules" :model="TestPaper" label-width="100px"> | |
| 44 | + <el-form-item label="试卷名称:" class="el-form-item-custom"> | |
| 45 | + {{TestPaper.TestPaperTitle}} | |
| 46 | + </el-form-item> | |
| 47 | + <el-form-item label="题目数量:" class="el-form-item-custom"> | |
| 48 | + {{arr2.length}} | |
| 49 | + </el-form-item> | |
| 50 | + <el-form-item label="题型数量:" class="el-form-item-custom"> | |
| 51 | + <span style="margin-right: 10px;">单选题:{{TestPaper.SingleNumber}}</span> | |
| 52 | + <span style="margin-right: 10px;">多选题:{{TestPaper.MultipleNumber}}</span> | |
| 53 | + <span style="margin-right: 10px;">主观题:{{TestPaper.SubjectiveNumber}}</span> | |
| 54 | + </el-form-item> | |
| 55 | + <el-form-item label="题目总分:" class="el-form-item-custom"> | |
| 56 | + {{TestPaper.TotalScore}} | |
| 57 | + </el-form-item> | |
| 58 | + <el-form-item label="分类" class="el-form-item-custom"> | |
| 59 | + <el-cascader class="testpaper-input" v-model="TestPaper.QuestionClassId" | |
| 60 | + style="width:400px;margin-bottom: 20px;" :props="{emitPath:false}" :clearable=true | |
| 61 | + :options="QuestionClass"> | |
| 62 | + </el-cascader> | |
| 63 | + </el-form-item> | |
| 64 | + <el-form-item label="试卷原价:" prop="OriginalPrice"> | |
| 65 | + <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')" | |
| 66 | + v-model="TestPaper.OriginalPrice" :precision="0"> | |
| 67 | + <template slot="append">元</template> | |
| 68 | + </el-input> | |
| 69 | + </el-form-item> | |
| 70 | + <el-form-item label="试卷现价:" prop="PresentPrice"> | |
| 71 | + <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')" | |
| 72 | + v-model="TestPaper.PresentPrice"> | |
| 73 | + <template slot="append">元</template> | |
| 74 | + </el-input> | |
| 75 | + </el-form-item> | |
| 76 | + <el-form-item label="会员价:" prop="MembershipPrice"> | |
| 77 | + <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')" | |
| 78 | + v-model="TestPaper.MembershipPrice"> | |
| 79 | + <template slot="append">元</template> | |
| 80 | + </el-input> | |
| 81 | + </el-form-item> | |
| 82 | + <el-form-item label="试卷简介:"> | |
| 83 | + <el-input class="testpaper-input" :rows="10" type="textarea" v-model="TestPaper.Describe"> | |
| 84 | + </el-input> | |
| 85 | + </el-form-item> | |
| 86 | + <el-button type="primary" style="float: right;" @click="SubmitTestPaper">保存 | |
| 87 | + </el-button> | |
| 88 | + </el-form> | |
| 89 | + </div> | |
| 90 | + </el-col> | |
| 91 | + </el-row> | |
| 92 | + </div> | |
| 93 | +</template> | |
| 94 | + | |
| 95 | +<script> | |
| 96 | + import draggable from 'vuedraggable' | |
| 97 | + import { | |
| 98 | + getQuestionClassList, | |
| 99 | + getQuestionList | |
| 100 | + } from '@/api/QuestionBank' | |
| 101 | + import { | |
| 102 | + EditTestPaper | |
| 103 | + } from '@/api/TestPaper' | |
| 104 | + export default { | |
| 105 | + //注册draggable组件 | |
| 106 | + components: { | |
| 107 | + draggable, | |
| 108 | + }, | |
| 109 | + data() { | |
| 110 | + return { | |
| 111 | + parameter: { | |
| 112 | + pageIndex: 0, | |
| 113 | + pageSize: 12, | |
| 114 | + sort: "id", | |
| 115 | + sortOrder: 1, | |
| 116 | + keyword: "", | |
| 117 | + QuestionClassId: 0, | |
| 118 | + status: 1 | |
| 119 | + }, | |
| 120 | + contentHeight: 0, | |
| 121 | + count: 0, | |
| 122 | + edit: false, | |
| 123 | + arr1: [], | |
| 124 | + arr2: [], | |
| 125 | + moveId: -1, | |
| 126 | + TestPaper: { | |
| 127 | + TestPaperTitle: "未命名试卷标题", | |
| 128 | + TestPaperClassId: 0, | |
| 129 | + TotalScore: 0, | |
| 130 | + Describe: "", | |
| 131 | + SingleNumber: 0, | |
| 132 | + MultipleNumber: 0, | |
| 133 | + SubjectiveNumber: 0, | |
| 134 | + OriginalPrice: "0", | |
| 135 | + PresentPrice: "0", | |
| 136 | + MembershipPrice: "0", | |
| 137 | + QuestionBankIds: [] | |
| 138 | + }, | |
| 139 | + loading: false, | |
| 140 | + rules: { | |
| 141 | + OriginalPrice: [{ | |
| 142 | + required: true, | |
| 143 | + message: '不能为空' | |
| 144 | + }], | |
| 145 | + PresentPrice: [{ | |
| 146 | + required: true, | |
| 147 | + message: '不能为空' | |
| 148 | + }], | |
| 149 | + MembershipPrice: [{ | |
| 150 | + required: true, | |
| 151 | + message: '不能为空' | |
| 152 | + }] | |
| 153 | + }, | |
| 154 | + QuestionClass: [], | |
| 155 | + treeData: [{ | |
| 156 | + value:0, | |
| 157 | + label:"全部" | |
| 158 | + }] | |
| 159 | + } | |
| 160 | + }, | |
| 161 | + computed: { | |
| 162 | + noMore() { | |
| 163 | + return this.arr1.length >= this.count | |
| 164 | + }, | |
| 165 | + disabled() { | |
| 166 | + return this.loading || this.noMore | |
| 167 | + } | |
| 168 | + }, | |
| 169 | + created() { | |
| 170 | + | |
| 171 | + }, | |
| 172 | + mounted() { | |
| 173 | + //计算页面内容区域的高度 | |
| 174 | + this.contentHeight = window.innerHeight - 90; | |
| 175 | + this.getQuestionClassListHeadler(); | |
| 176 | + //this.GetList(); | |
| 177 | + }, | |
| 178 | + methods: { | |
| 179 | + SubmitTestPaper() { | |
| 180 | + if (this.arr2.length > 0) { | |
| 181 | + EditTestPaper(this.TestPaper).then(res => { | |
| 182 | + if(res.data.code==200){ | |
| 183 | + this.$confirm('组卷成功!', '消息') | |
| 184 | + }else{ | |
| 185 | + this.$confirm('组卷失败!', '消息') | |
| 186 | + } | |
| 187 | + }); | |
| 188 | + } else { | |
| 189 | + this.$confirm('试题未有题目!', '消息') | |
| 190 | + } | |
| 191 | + }, | |
| 192 | + load() { | |
| 193 | + this.loading = true | |
| 194 | + this.parameter.pageIndex += 1; | |
| 195 | + this.GetList(); | |
| 196 | + this.loading = false; | |
| 197 | + }, | |
| 198 | + GetList() { | |
| 199 | + getQuestionList(this.parameter).then(res => { | |
| 200 | + res.data.data.rows.forEach((item, i) => { | |
| 201 | + this.arr1.push(item) | |
| 202 | + }) | |
| 203 | + this.count = res.data.data.total; | |
| 204 | + this.$forceUpdate(); | |
| 205 | + }); | |
| 206 | + }, | |
| 207 | + end1(e, ) { | |
| 208 | + var that = this; | |
| 209 | + if (that.arr1.length < 10) { | |
| 210 | + this.load(); | |
| 211 | + } | |
| 212 | + | |
| 213 | + var items = this.arr2.filter(function(m) { | |
| 214 | + return m.id == that.moveId | |
| 215 | + }) | |
| 216 | + | |
| 217 | + //如果左边 | |
| 218 | + if (items.length < 2) return; | |
| 219 | + this.arr2.splice(e.newDraggableIndex, 1) | |
| 220 | + | |
| 221 | + // SingleNumber:0, | |
| 222 | + // MultipleNumber:0, | |
| 223 | + // SubjectiveNumber:0, | |
| 224 | + }, | |
| 225 | + //从右边移除到左边 | |
| 226 | + RemoveHere(e) { | |
| 227 | + if (e.item._underlying_vm_.subjectType == 1) { | |
| 228 | + this.TestPaper.SingleNumber -= 1; | |
| 229 | + } | |
| 230 | + if (e.item._underlying_vm_.subjectType == 2) { | |
| 231 | + this.TestPaper.MultipleNumber -= 1; | |
| 232 | + } | |
| 233 | + if (e.item._underlying_vm_.subjectType == 3) { | |
| 234 | + this.TestPaper.SubjectiveNumber -= 1; | |
| 235 | + } | |
| 236 | + this.TestPaper.TotalScore -= e.item._underlying_vm_.fraction; | |
| 237 | + this.TestPaper.QuestionBankIds = this.arr2.map(u => u.id); | |
| 238 | + }, | |
| 239 | + //从左边添加到右边 | |
| 240 | + ComeHere(e) { | |
| 241 | + if (e.item._underlying_vm_.subjectType == 1) { | |
| 242 | + this.TestPaper.SingleNumber += 1; | |
| 243 | + } | |
| 244 | + if (e.item._underlying_vm_.subjectType == 2) { | |
| 245 | + this.TestPaper.MultipleNumber += 1; | |
| 246 | + } | |
| 247 | + if (e.item._underlying_vm_.subjectType == 3) { | |
| 248 | + this.TestPaper.SubjectiveNumber += 1; | |
| 249 | + } | |
| 250 | + this.TestPaper.TotalScore += e.item._underlying_vm_.fraction; | |
| 251 | + | |
| 252 | + this.TestPaper.QuestionBankIds = this.arr2.map(u => u.id); | |
| 253 | + }, | |
| 254 | + //右边往左边拖动时的事件 | |
| 255 | + end2(e) { | |
| 256 | + var that = this; | |
| 257 | + var items = this.arr1.filter(function(m) { | |
| 258 | + return m.id == that.moveId | |
| 259 | + }) | |
| 260 | + //如果左边 | |
| 261 | + if (items.length < 2) return; | |
| 262 | + this.arr1.splice(e.newDraggableIndex, 1) | |
| 263 | + }, | |
| 264 | + //move回调方法 | |
| 265 | + onMove(e, originalEvent) { | |
| 266 | + //this.moveId = e.relatedContext.element.id; | |
| 267 | + return true; | |
| 268 | + }, | |
| 269 | + getQuestionClassListHeadler() { | |
| 270 | + let _this = this; | |
| 271 | + getQuestionClassList().then(res => { | |
| 272 | + var gettree = function(titem) { | |
| 273 | + titem.children = [] | |
| 274 | + let childrenList = res.data.data.filter(u => u.ParentId == titem.value); | |
| 275 | + if (childrenList.length == 0) | |
| 276 | + titem.children = undefined; | |
| 277 | + res.data.data.filter(u => u.ParentId == titem.value).forEach((item, i) => { | |
| 278 | + var model = { | |
| 279 | + value: item.id, | |
| 280 | + label: item.ClassificationName | |
| 281 | + }; | |
| 282 | + gettree(model); | |
| 283 | + titem.children.push(model); | |
| 284 | + }) | |
| 285 | + } | |
| 286 | + res.data.data.filter(u => u.ParentId == 0).forEach((item, i) => { | |
| 287 | + var model = { | |
| 288 | + value: item.id, | |
| 289 | + label: item.ClassificationName | |
| 290 | + }; | |
| 291 | + gettree(model); | |
| 292 | + _this.QuestionClass.push(model); | |
| 293 | + _this.treeData.push(model) | |
| 294 | + }) | |
| 295 | + }); | |
| 296 | + } | |
| 297 | + | |
| 298 | + } | |
| 299 | + } | |
| 300 | +</script> | |
| 301 | + | |
| 302 | +<style lang="scss" scoped> | |
| 303 | + .el-row { | |
| 304 | + /* margin-bottom: 20px; */ | |
| 305 | + &:last-child { | |
| 306 | + margin-bottom: 0; | |
| 307 | + } | |
| 308 | + } | |
| 309 | + .el-col { | |
| 310 | + border-radius: 4px; | |
| 311 | + } | |
| 312 | + .bg-purple-dark { | |
| 313 | + background: #99a9bf; | |
| 314 | + } | |
| 315 | + .bg-purple { | |
| 316 | + background: #efefef; | |
| 317 | + } | |
| 318 | + .bg-purple-light { | |
| 319 | + background: #e5e9f2; | |
| 320 | + } | |
| 321 | + .grid-content { | |
| 322 | + border-radius: 4px; | |
| 323 | + min-height: 36px; | |
| 324 | + height: 100%; | |
| 325 | + } | |
| 326 | + .row-bg { | |
| 327 | + padding: 10px 0; | |
| 328 | + background-color: #f9fafc; | |
| 329 | + } | |
| 330 | + .infinite-list { | |
| 331 | + list-style: none; | |
| 332 | + margin: 0px; | |
| 333 | + padding: 0px; | |
| 334 | + &::-webkit-scrollbar { | |
| 335 | + width: 6px; | |
| 336 | + } | |
| 337 | + //滚动条小方块 | |
| 338 | + &::-webkit-scrollbar-thumb { | |
| 339 | + border-radius: 10px; | |
| 340 | + background: #304156; | |
| 341 | + } | |
| 342 | + //滚动条轨道 | |
| 343 | + &::-webkit-scrollbar-track { | |
| 344 | + // border-radius: 10px; | |
| 345 | + height: 100px; | |
| 346 | + background: #cdcdcd; | |
| 347 | + } | |
| 348 | + .infinite-list-item { | |
| 349 | + padding: 10px; | |
| 350 | + min-height: 60px; | |
| 351 | + width: 95%; | |
| 352 | + margin: auto; | |
| 353 | + background-color: #FFF; | |
| 354 | + margin-bottom: 10px; | |
| 355 | + border-radius: 5px; | |
| 356 | + box-shadow: 0 0 5px #cdcdcd; | |
| 357 | + &:first-child { | |
| 358 | + margin-top: 10px; | |
| 359 | + } | |
| 360 | + } | |
| 361 | + } | |
| 362 | + .option-p { | |
| 363 | + line-height: 15px; | |
| 364 | + } | |
| 365 | + .areahead { | |
| 366 | + text-align: center; | |
| 367 | + height: 60px; | |
| 368 | + line-height: 60px; | |
| 369 | + border-bottom: 1px solid #cdcdcd; | |
| 370 | + } | |
| 371 | + .testPaper-manager{ | |
| 372 | + margin: 10px 20px 10px 10px; | |
| 373 | + } | |
| 374 | + .testPaper-manager .el-form-item { | |
| 375 | + margin-bottom: 20px; | |
| 376 | + } | |
| 377 | + .el-form-item-custom { | |
| 378 | + margin-bottom: 0px !important; | |
| 379 | + } | |
| 380 | + .testpaper-input { | |
| 381 | + //max-width: 400px; | |
| 382 | + } | |
| 383 | +</style> | ... | ... |
src/views/TestPaper/TestPaperList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <el-table :data="testpaperlist" id="QuestionTable" border | |
| 4 | + style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;" | |
| 5 | + :header-cell-class-name="headerStyle" :stripe=true> | |
| 6 | + <el-table-column prop="date" label="ID" width="50"> | |
| 7 | + <template slot-scope="scope"> | |
| 8 | + <span>{{ scope.row.id }}</span> | |
| 9 | + </template> | |
| 10 | + </el-table-column> | |
| 11 | + <el-table-column prop="date" label="试卷标题" width="250"> | |
| 12 | + <template slot-scope="scope"> | |
| 13 | + <span>{{ scope.row.TestPaperTitle }}</span> | |
| 14 | + </template> | |
| 15 | + </el-table-column> | |
| 16 | + <el-table-column prop="date" label="试卷总分" width="80"> | |
| 17 | + <template slot-scope="scope"> | |
| 18 | + <span>{{ scope.row.TotalScore }}</span> | |
| 19 | + </template> | |
| 20 | + </el-table-column> | |
| 21 | + <el-table-column prop="date" label="单选题数量" width="100"> | |
| 22 | + <template slot-scope="scope"> | |
| 23 | + <span>{{ scope.row.SingleNumber }}</span> | |
| 24 | + </template> | |
| 25 | + </el-table-column> | |
| 26 | + <el-table-column prop="date" label="多选题数量" width="100"> | |
| 27 | + <template slot-scope="scope"> | |
| 28 | + <span>{{ scope.row.MultipleNumber }}</span> | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column prop="date" label="主观题数量" width="100"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + <span>{{ scope.row.SubjectiveNumber }}</span> | |
| 34 | + </template> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column prop="TestPaperClassId" label="分类" width="100"> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + <span>{{ scope.row.TestPaperClassId }}</span> | |
| 39 | + </template> | |
| 40 | + </el-table-column> | |
| 41 | + <el-table-column prop="name" label="原价" width="80"> | |
| 42 | + <template slot-scope="scope"> | |
| 43 | + <span>{{ scope.row.OriginalPrice/100 }}</span> | |
| 44 | + </template> | |
| 45 | + </el-table-column> | |
| 46 | + <el-table-column prop="name" label="现价" width="80"> | |
| 47 | + <template slot-scope="scope"> | |
| 48 | + <span>{{ scope.row.PresentPrice/100 }}</span> | |
| 49 | + </template> | |
| 50 | + </el-table-column> | |
| 51 | + <el-table-column prop="name" label="会员价" width="80"> | |
| 52 | + <template slot-scope="scope"> | |
| 53 | + <span>{{ scope.row.MembershipPrice/100 }}</span> | |
| 54 | + </template> | |
| 55 | + </el-table-column> | |
| 56 | + <el-table-column prop="name" label="试卷说明" :show-overflow-tooltip=true> | |
| 57 | + <template slot-scope="scope"> | |
| 58 | + <span>{{ scope.row.Describe }}</span> | |
| 59 | + </template> | |
| 60 | + </el-table-column> | |
| 61 | + <el-table-column fixed="right" label="操作" width="150"> | |
| 62 | + <template slot-scope="scope"> | |
| 63 | + <el-dropdown @command="(e)=>{handleCommand(e,scope.row.id)}"> | |
| 64 | + <span class="el-dropdown-link"> | |
| 65 | + 操作<i class="el-icon-arrow-down el-icon--right"></i> | |
| 66 | + </span> | |
| 67 | + <template #dropdown> | |
| 68 | + <el-dropdown-menu> | |
| 69 | + <el-dropdown-item command="update">编辑</el-dropdown-item> | |
| 70 | + <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> --> | |
| 71 | + <el-dropdown-item command="del">删除</el-dropdown-item> | |
| 72 | + </el-dropdown-menu> | |
| 73 | + </template> | |
| 74 | + </el-dropdown> | |
| 75 | + </template> | |
| 76 | + </el-table-column> | |
| 77 | + </el-table> | |
| 78 | + <el-pagination background @current-change="currentchange" | |
| 79 | + style="position:static;bottom: 3px;text-align: center;margin-top: 5px;" :page-size="this.parameter.pageSize" | |
| 80 | + layout="total,prev, pager, next" :total="Count"> | |
| 81 | + </el-pagination> | |
| 82 | + </div> | |
| 83 | +</template> | |
| 84 | + | |
| 85 | +<script> | |
| 86 | + import { | |
| 87 | + getTestPaperList | |
| 88 | + } from '@/api/TestPaper' | |
| 89 | + export default { | |
| 90 | + data() { | |
| 91 | + return { | |
| 92 | + parameter: { | |
| 93 | + pageIndex: 1, | |
| 94 | + pageSize: 12, | |
| 95 | + sort: "id", | |
| 96 | + sortOrder: 1, | |
| 97 | + keyword: "", | |
| 98 | + QuestionClassId: 0, | |
| 99 | + status: 1 | |
| 100 | + }, | |
| 101 | + Count: 0, | |
| 102 | + testpaperlist: [], | |
| 103 | + | |
| 104 | + } | |
| 105 | + }, | |
| 106 | + computed: { | |
| 107 | + | |
| 108 | + }, | |
| 109 | + created() { | |
| 110 | + | |
| 111 | + }, | |
| 112 | + mounted() { | |
| 113 | + let ContentAreaHight = window.innerHeight - document.getElementById("QuestionTable").offsetTop; | |
| 114 | + let lineNumber = ContentAreaHight - 50 - 40; | |
| 115 | + this.parameter.pageSize = Math.floor(lineNumber / 49) | |
| 116 | + this.getTestPaperListHeadler(); | |
| 117 | + }, | |
| 118 | + methods: { | |
| 119 | + getTestPaperListHeadler() { | |
| 120 | + getTestPaperList(this.parameter).then(res => { | |
| 121 | + this.testpaperlist = res.data.data; | |
| 122 | + this.Count = res.data.totalCount; | |
| 123 | + }); | |
| 124 | + }, | |
| 125 | + currentchange(page) { | |
| 126 | + this.parameter.pageIndex = page; | |
| 127 | + this.getTestPaperListHeadler(); | |
| 128 | + }, | |
| 129 | + } | |
| 130 | + } | |
| 131 | +</script> | |
| 132 | + | |
| 133 | +<style> | |
| 134 | +</style> | ... | ... |
src/views/appointByUserId/appointByUserId.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin:10px;"> | |
| 3 | + | |
| 4 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 5 | + <el-form-item label="用户ID"> | |
| 6 | + <el-tooltip class="item" effect="dark" content="已预约的用户编号" placement="top-start"> | |
| 7 | + <el-input v-model="model.UserId" placeholder="用户编号(已预约)"></el-input> | |
| 8 | + </el-tooltip> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item> | |
| 11 | + <el-button type="success" @click="SubmitCard">查询</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item> | |
| 14 | + <el-button type="primary" @click="onSubmit" style="float: right;">导出</el-button> | |
| 15 | + </el-form-item> | |
| 16 | + </el-form> | |
| 17 | + <el-table :data="tableData" style="width: 100%"> | |
| 18 | + <el-table-column prop="date" label="预约设置ID" width="180" v-if="false"> | |
| 19 | + <template slot-scope="scope"> | |
| 20 | + {{scope.row.ReservationId}} | |
| 21 | + </template> | |
| 22 | + </el-table-column> | |
| 23 | + <el-table-column prop="date" label="用户ID" width="80"> | |
| 24 | + <template slot-scope="scope"> | |
| 25 | + {{scope.row.UserId}} | |
| 26 | + </template> | |
| 27 | + </el-table-column> | |
| 28 | + <el-table-column prop="date" label="预约的车辆ID" width="180" v-if="false"> | |
| 29 | + <template slot-scope="scope"> | |
| 30 | + {{scope.row.CarId}} | |
| 31 | + </template> | |
| 32 | + </el-table-column> | |
| 33 | + <el-table-column prop="date" label="用户微信名" width="180"> | |
| 34 | + <template slot-scope="scope"> | |
| 35 | + {{scope.row.UserName}} | |
| 36 | + </template> | |
| 37 | + </el-table-column> | |
| 38 | + <el-table-column prop="date" label="手机号" width="120"> | |
| 39 | + <template slot-scope="scope"> | |
| 40 | + {{scope.row.UserPhone}} | |
| 41 | + </template> | |
| 42 | + </el-table-column> | |
| 43 | + <el-table-column prop="date" label="状态" width="100"> | |
| 44 | + <template slot-scope="scope"> | |
| 45 | + <el-tag type="success"> | |
| 46 | + {{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}} | |
| 47 | + </el-tag> | |
| 48 | + </template> | |
| 49 | + </el-table-column> | |
| 50 | + <el-table-column prop="date" label="车型" width="180"> | |
| 51 | + <template slot-scope="scope"> | |
| 52 | + {{scope.row.CarModel}} | |
| 53 | + </template> | |
| 54 | + </el-table-column> | |
| 55 | + <el-table-column prop="date" label="颜色" width="80"> | |
| 56 | + <template slot-scope="scope"> | |
| 57 | + {{scope.row.CarColour}} | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column prop="date" label="划痕" width="80"> | |
| 61 | + <template slot-scope="scope"> | |
| 62 | + {{scope.row.Scratch}} | |
| 63 | + </template> | |
| 64 | + </el-table-column> | |
| 65 | + <el-table-column prop="date" label="腐蚀" width="80"> | |
| 66 | + <template slot-scope="scope"> | |
| 67 | + {{scope.row.Corrosion}} | |
| 68 | + </template> | |
| 69 | + </el-table-column> | |
| 70 | + <el-table-column prop="date" label="破损" width="80"> | |
| 71 | + <template slot-scope="scope"> | |
| 72 | + {{scope.row.BeDamaged}} | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column prop="date" label="飞漆" width="80"> | |
| 76 | + <template slot-scope="scope"> | |
| 77 | + {{scope.row.FlyingPaint}} | |
| 78 | + </template> | |
| 79 | + </el-table-column> | |
| 80 | + <el-table-column prop="date" label="地址" width="280"> | |
| 81 | + <template slot-scope="scope"> | |
| 82 | + {{scope.row.Address}} | |
| 83 | + </template> | |
| 84 | + </el-table-column> | |
| 85 | + <el-table-column prop="date" label="预约服务时间" width="180"> | |
| 86 | + <template slot-scope="scope"> | |
| 87 | + {{scope.row.MakeTime}} | |
| 88 | + </template> | |
| 89 | + </el-table-column> | |
| 90 | + <el-table-column prop="date" label="添加时间" width="180" v-if="false"> | |
| 91 | + <template slot-scope="scope"> | |
| 92 | + {{scope.row.AddTime}} | |
| 93 | + </template> | |
| 94 | + </el-table-column> | |
| 95 | + <el-table-column prop="date" label="修改时间" width="180" v-if="false"> | |
| 96 | + <template slot-scope="scope"> | |
| 97 | + {{scope.row.UpdateTime}} | |
| 98 | + </template> | |
| 99 | + </el-table-column> | |
| 100 | + <el-table-column prop="date" label="备注"> | |
| 101 | + <template slot-scope="scope"> | |
| 102 | + {{scope.row.Remarks}} | |
| 103 | + </template> | |
| 104 | + </el-table-column> | |
| 105 | + <el-table-column prop="date" label="编辑" width="180" v-if="false"> | |
| 106 | + <template slot-scope="scope"> | |
| 107 | + <el-button type="primary" @click="EidtRecord(scope.row)">编辑</el-button> | |
| 108 | + </template> | |
| 109 | + </el-table-column> | |
| 110 | + <el-table-column prop="date" label="操作" width="220" fixed="right"> | |
| 111 | + <template slot-scope="scope"> | |
| 112 | + <el-button type="danger" @click="DelInfo(scope.row.id)">删除</el-button> | |
| 113 | + <el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true"> | |
| 114 | + 预约结算</el-button> | |
| 115 | + </template> | |
| 116 | + </el-table-column> | |
| 117 | + <!-- <el-table-column prop="date" label="修改状态" width="180"> | |
| 118 | + <template slot-scope="scope"> | |
| 119 | + <el-button type="primary" @click="UpdateState(scope.row.id)">修改状态</el-button> | |
| 120 | + </template> | |
| 121 | + </el-table-column> --> | |
| 122 | + <el-table-column prop="date" label="预约结算" width="180" fixed="right" v-if="false"> | |
| 123 | + <template slot-scope="scope"> | |
| 124 | + <el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true"> | |
| 125 | + 预约结算</el-button> | |
| 126 | + </template> | |
| 127 | + </el-table-column> | |
| 128 | + </el-table> | |
| 129 | + <el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-change='Pages' | |
| 130 | + style="text-align:center;margin-top: 10px;"> | |
| 131 | + </el-pagination> | |
| 132 | + <el-dialog title="提示" width="50%" :visible.sync="dialogVisible"> | |
| 133 | + <el-form ref="form" :model="form" label-width="80px"> | |
| 134 | + <el-form-item label="用户名"> | |
| 135 | + <el-input v-model="form.UserName"></el-input> | |
| 136 | + </el-form-item> | |
| 137 | + <el-form-item label="用户电话"> | |
| 138 | + <el-input v-model="form.UserPhone"></el-input> | |
| 139 | + </el-form-item> | |
| 140 | + <el-form-item label="地址"> | |
| 141 | + <el-input v-model="form.Address"></el-input> | |
| 142 | + </el-form-item> | |
| 143 | + <el-form-item label="备注"> | |
| 144 | + <el-input v-model="form.Remarks"></el-input> | |
| 145 | + </el-form-item> | |
| 146 | + <el-form-item label="车型"> | |
| 147 | + <el-input v-model="form.CarModel"></el-input> | |
| 148 | + </el-form-item> | |
| 149 | + <el-form-item label="颜色"> | |
| 150 | + <el-input v-model="form.CarColour"></el-input> | |
| 151 | + </el-form-item> | |
| 152 | + <el-form-item label="划痕"> | |
| 153 | + <el-radio-group v-model="form.Scratch"> | |
| 154 | + <el-radio label="良好">良好</el-radio> | |
| 155 | + <el-radio label="一般">一般</el-radio> | |
| 156 | + <el-radio label="中等">中等</el-radio> | |
| 157 | + <el-radio label="严重">严重</el-radio> | |
| 158 | + </el-radio-group> | |
| 159 | + </el-form-item> | |
| 160 | + <el-form-item label="腐蚀"> | |
| 161 | + <el-radio-group v-model="form.Corrosion"> | |
| 162 | + <el-radio label="良好">良好</el-radio> | |
| 163 | + <el-radio label="一般">一般</el-radio> | |
| 164 | + <el-radio label="中等">中等</el-radio> | |
| 165 | + <el-radio label="严重">严重</el-radio> | |
| 166 | + </el-radio-group> | |
| 167 | + </el-form-item> | |
| 168 | + <el-form-item label="破损"> | |
| 169 | + <el-radio-group v-model="form.BeDamaged"> | |
| 170 | + <el-radio label="良好">良好</el-radio> | |
| 171 | + <el-radio label="一般">一般</el-radio> | |
| 172 | + <el-radio label="中等">中等</el-radio> | |
| 173 | + <el-radio label="严重">严重</el-radio> | |
| 174 | + </el-radio-group> | |
| 175 | + </el-form-item> | |
| 176 | + <el-form-item label="飞漆"> | |
| 177 | + <el-radio-group v-model="form.FlyingPaint"> | |
| 178 | + <el-radio label="良好">良好</el-radio> | |
| 179 | + <el-radio label="一般">一般</el-radio> | |
| 180 | + <el-radio label="中等">中等</el-radio> | |
| 181 | + <el-radio label="严重">严重</el-radio> | |
| 182 | + </el-radio-group> | |
| 183 | + </el-form-item> | |
| 184 | + </el-form> | |
| 185 | + <span slot="footer" class="dialog-footer"> | |
| 186 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 187 | + <el-button type="primary" @click="SubmitRecord">确 定</el-button> | |
| 188 | + </span> | |
| 189 | + </el-dialog> | |
| 190 | + </div> | |
| 191 | +</template> | |
| 192 | + | |
| 193 | +<script> | |
| 194 | + import { | |
| 195 | + GetRecordById, | |
| 196 | + DeleteRecord, | |
| 197 | + UpdateRecord, | |
| 198 | + Collection, | |
| 199 | + deriveExcel, | |
| 200 | + UpdateState | |
| 201 | + } from '../../api/AppointmentRecord.js' | |
| 202 | + import utils from '../../utils/utils.js' | |
| 203 | + import { | |
| 204 | + ReservationAreaList | |
| 205 | + } from '../../api/ReservationArea.js' | |
| 206 | + export default { | |
| 207 | + data() { | |
| 208 | + return { | |
| 209 | + | |
| 210 | + form: { | |
| 211 | + "id": 0, | |
| 212 | + "ReservationId": 0, | |
| 213 | + "UserId": 0, | |
| 214 | + "UserName": "", | |
| 215 | + "UserPhone": "", | |
| 216 | + "CarId": 0, | |
| 217 | + "CarModel": "", | |
| 218 | + "CarColour": "", | |
| 219 | + "Scratch": "", | |
| 220 | + "Corrosion": "", | |
| 221 | + "BeDamaged": "", | |
| 222 | + "FlyingPaint": "", | |
| 223 | + "Address": "", | |
| 224 | + "State": 0, | |
| 225 | + "Remarks": "", | |
| 226 | + "AddTime": "2022-01-05T07:38:12.364Z", | |
| 227 | + "UpdateTime": "2022-01-05T07:38:12.364Z" | |
| 228 | + }, | |
| 229 | + dialogVisible: false, | |
| 230 | + tableData: [], | |
| 231 | + models: { | |
| 232 | + ids: 0 | |
| 233 | + }, | |
| 234 | + model: { | |
| 235 | + "UserId": 0, | |
| 236 | + "KeyWord": "", | |
| 237 | + "TotalCount": 0, | |
| 238 | + "PageIndex": 1, | |
| 239 | + "PageSize": 10, | |
| 240 | + "Sort": [{ | |
| 241 | + "Field": "", | |
| 242 | + "Type": 0 | |
| 243 | + }] | |
| 244 | + }, | |
| 245 | + StateModel: { | |
| 246 | + "id": 0, | |
| 247 | + "state": 0 | |
| 248 | + } | |
| 249 | + } | |
| 250 | + }, | |
| 251 | + created() { | |
| 252 | + this.ShowRecord() | |
| 253 | + }, | |
| 254 | + methods: { | |
| 255 | + //导出 | |
| 256 | + onSubmit() { | |
| 257 | + deriveExcel(null).then(res => { | |
| 258 | + console.log('导出数据', res) | |
| 259 | + if (res.data.code == 200) { | |
| 260 | + this.$message.success('导出成功') | |
| 261 | + // 派发附件下载 | |
| 262 | + this.exportCostlistp(res.data.data) | |
| 263 | + } else { | |
| 264 | + this.$message.error('导出失败') | |
| 265 | + } | |
| 266 | + }) | |
| 267 | + | |
| 268 | + }, | |
| 269 | + // 派发附件下载 | |
| 270 | + exportCostlistp(url) { | |
| 271 | + let a = document.createElement("a"); | |
| 272 | + a.download = url; | |
| 273 | + a.style.display = "none"; | |
| 274 | + a.href = url | |
| 275 | + document.body.appendChild(a); | |
| 276 | + a.click(); | |
| 277 | + URL.revokeObjectURL(a.href); // 释放URL 对象 | |
| 278 | + document.body.removeChild(a); // 删除 a 标签 | |
| 279 | + }, | |
| 280 | + // 完成预约线下收款 | |
| 281 | + Results(id) { | |
| 282 | + Collection(id).then(res => { | |
| 283 | + console.log('res', res) | |
| 284 | + this.$message.success(res.data.message) | |
| 285 | + this.ShowRecord() | |
| 286 | + }) | |
| 287 | + }, | |
| 288 | + EidtRecord(item) { | |
| 289 | + this.dialogVisible = true | |
| 290 | + console.log('item', item) | |
| 291 | + this.form.id = item.id | |
| 292 | + this.form.ReservationId = item.ReservationId | |
| 293 | + this.form.UserId = item.UserId | |
| 294 | + this.form.CarId = item.CarId | |
| 295 | + this.form.Remarks = item.Remarks | |
| 296 | + this.form.Address = item.Address | |
| 297 | + this.form.UserName = item.UserName | |
| 298 | + this.form.UserPhone = item.UserPhone | |
| 299 | + this.form.CarModel = item.CarModel | |
| 300 | + this.form.CarColour = item.CarColour | |
| 301 | + this.form.Scratch = item.Scratch | |
| 302 | + this.form.Corrosion = item.Corrosion | |
| 303 | + this.form.BeDamaged = item.BeDamaged | |
| 304 | + this.form.FlyingPaint = item.FlyingPaint | |
| 305 | + }, | |
| 306 | + SubmitRecord() { | |
| 307 | + UpdateRecord(this.form).then(res => { | |
| 308 | + console.log('resXiugai', res) | |
| 309 | + if (res.data.code == 200) { | |
| 310 | + this.$message.success('修改成功') | |
| 311 | + this.dialogVisible = false | |
| 312 | + this.ShowRecord() | |
| 313 | + } else { | |
| 314 | + this.$message.watch('修改失败') | |
| 315 | + } | |
| 316 | + }) | |
| 317 | + }, | |
| 318 | + ShowRecord() { | |
| 319 | + GetRecordById(this.model).then(res => { | |
| 320 | + console.log(res) | |
| 321 | + if(res.data.data.total==0){ | |
| 322 | + this.$message.error('暂无数据') | |
| 323 | + return | |
| 324 | + } | |
| 325 | + res.data.data.rows.forEach((item, index) => { | |
| 326 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd") | |
| 327 | + item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd") | |
| 328 | + item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd") | |
| 329 | + }) | |
| 330 | + this.tableData = res.data.data.rows | |
| 331 | + this.model.TotalCount = res.data.data.total | |
| 332 | + }) | |
| 333 | + }, | |
| 334 | + // 状态查询预约情况 | |
| 335 | + SelectedState(e) { | |
| 336 | + console.log('eee', e) | |
| 337 | + this.model.State = parseInt(e) | |
| 338 | + this.model.KeyWord = '' | |
| 339 | + this.model.startdate = '' | |
| 340 | + this.model.enddate = '' | |
| 341 | + this.ShowRecord() | |
| 342 | + }, | |
| 343 | + // 提交查询 | |
| 344 | + SubmitCard() { | |
| 345 | + this.ShowRecord() | |
| 346 | + }, | |
| 347 | + // 删除信息 | |
| 348 | + DelInfo(id) { | |
| 349 | + this.models.ids = id | |
| 350 | + console.log('数据ID', id) | |
| 351 | + DeleteRecord(this.models).then(res => { | |
| 352 | + console.log('删除后的数', res) | |
| 353 | + if (res.data.code == 200) { | |
| 354 | + this.$message.success('删除成功') | |
| 355 | + this.ShowRecord() | |
| 356 | + } else { | |
| 357 | + this.$message.warn('删除失败') | |
| 358 | + } | |
| 359 | + }) | |
| 360 | + }, | |
| 361 | + Pages(e) { | |
| 362 | + this.model.PageIndex = e | |
| 363 | + this.ShowRecord() | |
| 364 | + } | |
| 365 | + | |
| 366 | + } | |
| 367 | + } | |
| 368 | +</script> | |
| 369 | + | |
| 370 | +<style> | |
| 371 | +</style> | ... | ... |
src/views/appointment/appointment.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin:10px;"> | |
| 3 | + | |
| 4 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 5 | + <el-form-item label="关键字"> | |
| 6 | + <el-input v-model="model.KeyWord" placeholder="关键字"></el-input> | |
| 7 | + </el-form-item> | |
| 8 | + <el-form-item label="开始时间"> | |
| 9 | + <el-date-picker v-model="model.startdate" type="date" placeholder="选择日期"> | |
| 10 | + </el-date-picker> | |
| 11 | + </el-form-item> | |
| 12 | + <el-form-item label="至"> | |
| 13 | + <el-date-picker v-model="model.enddate" type="date" placeholder="选择日期"> | |
| 14 | + </el-date-picker> | |
| 15 | + </el-form-item> | |
| 16 | + <el-form-item label="状态"> | |
| 17 | + <el-select v-model="model.State" placeholder="请选择" @change="SelectedState"> | |
| 18 | + <el-option label="查所有" value="-1"></el-option> | |
| 19 | + <el-option label="已预约" value="0"></el-option> | |
| 20 | + <el-option label="已取消" value="1"></el-option> | |
| 21 | + <el-option label="已完成" value="2"> | |
| 22 | + </el-option> | |
| 23 | + </el-select> | |
| 24 | + </el-form-item> | |
| 25 | + <el-form-item> | |
| 26 | + <el-button type="success" @click="SubmitCard">查询</el-button> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item> | |
| 29 | + <el-button type="primary" @click="onSubmit" style="float: right;">导出</el-button> | |
| 30 | + </el-form-item> | |
| 31 | + </el-form> | |
| 32 | + <el-table :data="tableData" style="width: 100%"> | |
| 33 | + <el-table-column prop="date" label="预约设置ID" width="180" v-if="false"> | |
| 34 | + <template slot-scope="scope"> | |
| 35 | + {{scope.row.ReservationId}} | |
| 36 | + </template> | |
| 37 | + </el-table-column> | |
| 38 | + <el-table-column prop="date" label="用户ID" width="80"> | |
| 39 | + <template slot-scope="scope"> | |
| 40 | + {{scope.row.UserId}} | |
| 41 | + </template> | |
| 42 | + </el-table-column> | |
| 43 | + <el-table-column prop="date" label="预约的车辆ID" width="180" v-if="false"> | |
| 44 | + <template slot-scope="scope"> | |
| 45 | + {{scope.row.CarId}} | |
| 46 | + </template> | |
| 47 | + </el-table-column> | |
| 48 | + <el-table-column prop="date" label="用户微信名" width="180"> | |
| 49 | + <template slot-scope="scope"> | |
| 50 | + {{scope.row.UserName}} | |
| 51 | + </template> | |
| 52 | + </el-table-column> | |
| 53 | + <el-table-column prop="date" label="手机号" width="120"> | |
| 54 | + <template slot-scope="scope"> | |
| 55 | + {{scope.row.UserPhone}} | |
| 56 | + </template> | |
| 57 | + </el-table-column> | |
| 58 | + <el-table-column prop="date" label="状态" width="100"> | |
| 59 | + <template slot-scope="scope"> | |
| 60 | + <el-tag type="success"> | |
| 61 | + {{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}} | |
| 62 | + </el-tag> | |
| 63 | + </template> | |
| 64 | + </el-table-column> | |
| 65 | + <el-table-column prop="date" label="车型" width="180"> | |
| 66 | + <template slot-scope="scope"> | |
| 67 | + {{scope.row.CarModel}} | |
| 68 | + </template> | |
| 69 | + </el-table-column> | |
| 70 | + <el-table-column prop="date" label="颜色" width="80"> | |
| 71 | + <template slot-scope="scope"> | |
| 72 | + {{scope.row.CarColour}} | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column prop="date" label="划痕" width="80"> | |
| 76 | + <template slot-scope="scope"> | |
| 77 | + {{scope.row.Scratch}} | |
| 78 | + </template> | |
| 79 | + </el-table-column> | |
| 80 | + <el-table-column prop="date" label="腐蚀" width="80"> | |
| 81 | + <template slot-scope="scope"> | |
| 82 | + {{scope.row.Corrosion}} | |
| 83 | + </template> | |
| 84 | + </el-table-column> | |
| 85 | + <el-table-column prop="date" label="破损" width="80"> | |
| 86 | + <template slot-scope="scope"> | |
| 87 | + {{scope.row.BeDamaged}} | |
| 88 | + </template> | |
| 89 | + </el-table-column> | |
| 90 | + <el-table-column prop="date" label="飞漆" width="80"> | |
| 91 | + <template slot-scope="scope"> | |
| 92 | + {{scope.row.FlyingPaint}} | |
| 93 | + </template> | |
| 94 | + </el-table-column> | |
| 95 | + <el-table-column prop="date" label="地址" width="280"> | |
| 96 | + <template slot-scope="scope"> | |
| 97 | + {{scope.row.Address}} | |
| 98 | + </template> | |
| 99 | + </el-table-column> | |
| 100 | + <el-table-column prop="date" label="预约服务时间" width="180"> | |
| 101 | + <template slot-scope="scope"> | |
| 102 | + {{scope.row.MakeTime}} | |
| 103 | + </template> | |
| 104 | + </el-table-column> | |
| 105 | + <el-table-column prop="date" label="添加时间" width="180" v-if="false"> | |
| 106 | + <template slot-scope="scope"> | |
| 107 | + {{scope.row.AddTime}} | |
| 108 | + </template> | |
| 109 | + </el-table-column> | |
| 110 | + <el-table-column prop="date" label="修改时间" width="180" v-if="false"> | |
| 111 | + <template slot-scope="scope"> | |
| 112 | + {{scope.row.UpdateTime}} | |
| 113 | + </template> | |
| 114 | + </el-table-column> | |
| 115 | + <el-table-column prop="date" label="备注"> | |
| 116 | + <template slot-scope="scope"> | |
| 117 | + {{scope.row.Remarks}} | |
| 118 | + </template> | |
| 119 | + </el-table-column> | |
| 120 | + <el-table-column prop="date" label="编辑" width="180" v-if="false"> | |
| 121 | + <template slot-scope="scope"> | |
| 122 | + <el-button type="primary" @click="EidtRecord(scope.row)">编辑</el-button> | |
| 123 | + </template> | |
| 124 | + </el-table-column> | |
| 125 | + <el-table-column prop="date" label="操作" width="220" fixed="right"> | |
| 126 | + <template slot-scope="scope"> | |
| 127 | + <el-button type="danger" @click="DelInfo(scope.row.id)">删除</el-button> | |
| 128 | + <el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true"> | |
| 129 | + 预约结算</el-button> | |
| 130 | + </template> | |
| 131 | + </el-table-column> | |
| 132 | + <!-- <el-table-column prop="date" label="修改状态" width="180"> | |
| 133 | + <template slot-scope="scope"> | |
| 134 | + <el-button type="primary" @click="UpdateState(scope.row.id)">修改状态</el-button> | |
| 135 | + </template> | |
| 136 | + </el-table-column> --> | |
| 137 | + <el-table-column prop="date" label="预约结算" width="180" fixed="right" v-if="false"> | |
| 138 | + <template slot-scope="scope"> | |
| 139 | + <el-button type="success" @click="Results(scope.row)" :disabled="scope.row.State==0?false:true"> | |
| 140 | + 预约结算</el-button> | |
| 141 | + </template> | |
| 142 | + </el-table-column> | |
| 143 | + </el-table> | |
| 144 | + <el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-change='Pages' | |
| 145 | + style="text-align:center;margin-top: 10px;"> | |
| 146 | + </el-pagination> | |
| 147 | + <el-dialog title="提示" width="50%" :visible.sync="dialogVisible"> | |
| 148 | + <el-form ref="form" :model="form" label-width="80px"> | |
| 149 | + <el-form-item label="用户名"> | |
| 150 | + <el-input v-model="form.UserName"></el-input> | |
| 151 | + </el-form-item> | |
| 152 | + <el-form-item label="用户电话"> | |
| 153 | + <el-input v-model="form.UserPhone"></el-input> | |
| 154 | + </el-form-item> | |
| 155 | + <el-form-item label="地址"> | |
| 156 | + <el-input v-model="form.Address"></el-input> | |
| 157 | + </el-form-item> | |
| 158 | + <el-form-item label="备注"> | |
| 159 | + <el-input v-model="form.Remarks"></el-input> | |
| 160 | + </el-form-item> | |
| 161 | + <el-form-item label="车型"> | |
| 162 | + <el-input v-model="form.CarModel"></el-input> | |
| 163 | + </el-form-item> | |
| 164 | + <el-form-item label="颜色"> | |
| 165 | + <el-input v-model="form.CarColour"></el-input> | |
| 166 | + </el-form-item> | |
| 167 | + <el-form-item label="划痕"> | |
| 168 | + <el-radio-group v-model="form.Scratch"> | |
| 169 | + <el-radio label="良好">良好</el-radio> | |
| 170 | + <el-radio label="一般">一般</el-radio> | |
| 171 | + <el-radio label="中等">中等</el-radio> | |
| 172 | + <el-radio label="严重">严重</el-radio> | |
| 173 | + </el-radio-group> | |
| 174 | + </el-form-item> | |
| 175 | + <el-form-item label="腐蚀"> | |
| 176 | + <el-radio-group v-model="form.Corrosion"> | |
| 177 | + <el-radio label="良好">良好</el-radio> | |
| 178 | + <el-radio label="一般">一般</el-radio> | |
| 179 | + <el-radio label="中等">中等</el-radio> | |
| 180 | + <el-radio label="严重">严重</el-radio> | |
| 181 | + </el-radio-group> | |
| 182 | + </el-form-item> | |
| 183 | + <el-form-item label="破损"> | |
| 184 | + <el-radio-group v-model="form.BeDamaged"> | |
| 185 | + <el-radio label="良好">良好</el-radio> | |
| 186 | + <el-radio label="一般">一般</el-radio> | |
| 187 | + <el-radio label="中等">中等</el-radio> | |
| 188 | + <el-radio label="严重">严重</el-radio> | |
| 189 | + </el-radio-group> | |
| 190 | + </el-form-item> | |
| 191 | + <el-form-item label="飞漆"> | |
| 192 | + <el-radio-group v-model="form.FlyingPaint"> | |
| 193 | + <el-radio label="良好">良好</el-radio> | |
| 194 | + <el-radio label="一般">一般</el-radio> | |
| 195 | + <el-radio label="中等">中等</el-radio> | |
| 196 | + <el-radio label="严重">严重</el-radio> | |
| 197 | + </el-radio-group> | |
| 198 | + </el-form-item> | |
| 199 | + </el-form> | |
| 200 | + <span slot="footer" class="dialog-footer"> | |
| 201 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 202 | + <el-button type="primary" @click="SubmitRecord">确 定</el-button> | |
| 203 | + </span> | |
| 204 | + </el-dialog> | |
| 205 | + </div> | |
| 206 | +</template> | |
| 207 | + | |
| 208 | +<script> | |
| 209 | + import { | |
| 210 | + GetAppointmentRecord, | |
| 211 | + DeleteRecord, | |
| 212 | + UpdateRecord, | |
| 213 | + Collection, | |
| 214 | + deriveExcel, | |
| 215 | + UpdateState, | |
| 216 | + UpdResultTime, | |
| 217 | + } from '../../api/AppointmentRecord.js' | |
| 218 | + import { | |
| 219 | + UpdnowNum, | |
| 220 | + SendPaymentAppointment, | |
| 221 | + } from '../../api/user.js' | |
| 222 | + import utils from '../../utils/utils.js' | |
| 223 | + import { | |
| 224 | + ReservationAreaList | |
| 225 | + } from '../../api/ReservationArea.js' | |
| 226 | + export default { | |
| 227 | + data() { | |
| 228 | + return { | |
| 229 | + | |
| 230 | + form: { | |
| 231 | + "id": 0, | |
| 232 | + "ReservationId": 0, | |
| 233 | + "UserId": 0, | |
| 234 | + "UserName": "", | |
| 235 | + "UserPhone": "", | |
| 236 | + "CarId": 0, | |
| 237 | + "CarModel": "", | |
| 238 | + "CarColour": "", | |
| 239 | + "Scratch": "", | |
| 240 | + "Corrosion": "", | |
| 241 | + "BeDamaged": "", | |
| 242 | + "FlyingPaint": "", | |
| 243 | + "Address": "", | |
| 244 | + "State": 0, | |
| 245 | + "Remarks": "", | |
| 246 | + "AddTime": "2022-01-05T07:38:12.364Z", | |
| 247 | + "UpdateTime": "2022-01-05T07:38:12.364Z" | |
| 248 | + }, | |
| 249 | + dialogVisible: false, | |
| 250 | + tableData: [], | |
| 251 | + models: { | |
| 252 | + ids: 0 | |
| 253 | + }, | |
| 254 | + model: { | |
| 255 | + "State": '-1', | |
| 256 | + "startdate": "", | |
| 257 | + "enddate": "", | |
| 258 | + "KeyWord": "", | |
| 259 | + "TotalCount": 0, | |
| 260 | + "PageIndex": 1, | |
| 261 | + "PageSize": 10, | |
| 262 | + "Sort": [{ | |
| 263 | + "Field": "MakeTime", | |
| 264 | + "Type": 1 | |
| 265 | + }] | |
| 266 | + }, | |
| 267 | + StateModel: { | |
| 268 | + "id": 0, | |
| 269 | + "state": 0 | |
| 270 | + }, | |
| 271 | + // 付款发送短信 | |
| 272 | + paramModel: { | |
| 273 | + "param": "", | |
| 274 | + "mobile": "" | |
| 275 | + } | |
| 276 | + } | |
| 277 | + }, | |
| 278 | + created() { | |
| 279 | + this.ShowRecord() | |
| 280 | + }, | |
| 281 | + methods: { | |
| 282 | + //导出 | |
| 283 | + onSubmit() { | |
| 284 | + deriveExcel(null).then(res => { | |
| 285 | + console.log('导出数据', res) | |
| 286 | + if (res.data.code == 200) { | |
| 287 | + this.$message.success('导出成功') | |
| 288 | + // 派发附件下载 | |
| 289 | + this.exportCostlistp(res.data.data) | |
| 290 | + } else { | |
| 291 | + this.$message.error('导出失败') | |
| 292 | + } | |
| 293 | + }) | |
| 294 | + | |
| 295 | + }, | |
| 296 | + // 派发附件下载 | |
| 297 | + exportCostlistp(url) { | |
| 298 | + let a = document.createElement("a"); | |
| 299 | + a.download = url; | |
| 300 | + a.style.display = "none"; | |
| 301 | + a.href = url | |
| 302 | + document.body.appendChild(a); | |
| 303 | + a.click(); | |
| 304 | + URL.revokeObjectURL(a.href); // 释放URL 对象 | |
| 305 | + document.body.removeChild(a); // 删除 a 标签 | |
| 306 | + }, | |
| 307 | + // 完成预约线下收款 | |
| 308 | + async Results(item) { | |
| 309 | + Collection(item.id).then(res => { | |
| 310 | + this.$message.success(res.data.message) | |
| 311 | + // 完成单数 | |
| 312 | + UpdnowNum(item.UserId).then(res => { | |
| 313 | + console.log('修改后的数据单量', res) | |
| 314 | + if (res.data.code == 200) { | |
| 315 | + console.log('单量完成加1') | |
| 316 | + } else { | |
| 317 | + console.log('单量完成失败') | |
| 318 | + } | |
| 319 | + }) | |
| 320 | + // 付款时间 | |
| 321 | + UpdResultTime(item.id).then(res => { | |
| 322 | + if (res.data.code == 200) { | |
| 323 | + console.log('付款时间更新成功') | |
| 324 | + } else { | |
| 325 | + console.log('付款时间更新失败') | |
| 326 | + } | |
| 327 | + }) | |
| 328 | + // 发送短信 | |
| 329 | + this.paramModel.mobile=item.UserPhone | |
| 330 | + SendPaymentAppointment(this.paramModel).then(res => { | |
| 331 | + console.log('付款数据啊', res) | |
| 332 | + if (res.data.data.code == '000000') { | |
| 333 | + console.log('发送短信成功') | |
| 334 | + } else { | |
| 335 | + console.log('发送短信失败') | |
| 336 | + } | |
| 337 | + }) | |
| 338 | + console.log('付款参数',this.paramModel) | |
| 339 | + this.ShowRecord() | |
| 340 | + | |
| 341 | + }) | |
| 342 | + }, | |
| 343 | + EidtRecord(item) { | |
| 344 | + this.dialogVisible = true | |
| 345 | + console.log('item', item) | |
| 346 | + this.form.id = item.id | |
| 347 | + this.form.ReservationId = item.ReservationId | |
| 348 | + this.form.UserId = item.UserId | |
| 349 | + this.form.CarId = item.CarId | |
| 350 | + this.form.Remarks = item.Remarks | |
| 351 | + this.form.Address = item.Address | |
| 352 | + this.form.UserName = item.UserName | |
| 353 | + this.form.UserPhone = item.UserPhone | |
| 354 | + this.form.CarModel = item.CarModel | |
| 355 | + this.form.CarColour = item.CarColour | |
| 356 | + this.form.Scratch = item.Scratch | |
| 357 | + this.form.Corrosion = item.Corrosion | |
| 358 | + this.form.BeDamaged = item.BeDamaged | |
| 359 | + this.form.FlyingPaint = item.FlyingPaint | |
| 360 | + // this.form.UpdateTime=utils.formatTime(new Date(),"yyyy-MM-dd") | |
| 361 | + }, | |
| 362 | + SubmitRecord() { | |
| 363 | + UpdateRecord(this.form).then(res => { | |
| 364 | + console.log('resXiugai', res) | |
| 365 | + if (res.data.code == 200) { | |
| 366 | + this.$message.success('修改成功') | |
| 367 | + this.dialogVisible = false | |
| 368 | + this.ShowRecord() | |
| 369 | + } else { | |
| 370 | + this.$message.watch('修改失败') | |
| 371 | + } | |
| 372 | + }) | |
| 373 | + }, | |
| 374 | + ShowRecord() { | |
| 375 | + GetAppointmentRecord(this.model).then(res => { | |
| 376 | + console.log(res) | |
| 377 | + if(res.data.data.total>0){ | |
| 378 | + this.$message.success('查询成功') | |
| 379 | + res.data.data.rows.forEach((item, index) => { | |
| 380 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd") | |
| 381 | + item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd") | |
| 382 | + item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd") | |
| 383 | + }) | |
| 384 | + | |
| 385 | + this.tableData = res.data.data.rows | |
| 386 | + this.model.TotalCount = res.data.data.total | |
| 387 | + }else{ | |
| 388 | + this.$message.error('暂无数据') | |
| 389 | + } | |
| 390 | + | |
| 391 | + }) | |
| 392 | + }, | |
| 393 | + // 状态查询预约情况 | |
| 394 | + SelectedState(e) { | |
| 395 | + console.log('eee', e) | |
| 396 | + this.model.State = parseInt(e) | |
| 397 | + this.model.KeyWord = '' | |
| 398 | + this.model.startdate = '' | |
| 399 | + this.model.enddate = '' | |
| 400 | + this.ShowRecord() | |
| 401 | + }, | |
| 402 | + // 提交查询 | |
| 403 | + SubmitCard() { | |
| 404 | + this.ShowRecord() | |
| 405 | + }, | |
| 406 | + // 删除信息 | |
| 407 | + DelInfo(id) { | |
| 408 | + this.models.ids = id | |
| 409 | + console.log('数据ID', id) | |
| 410 | + DeleteRecord(this.models).then(res => { | |
| 411 | + console.log('删除后的数', res) | |
| 412 | + if (res.data.code == 200) { | |
| 413 | + this.$message.success('删除成功') | |
| 414 | + this.ShowRecord() | |
| 415 | + } else { | |
| 416 | + this.$message.warn('删除失败') | |
| 417 | + } | |
| 418 | + }) | |
| 419 | + }, | |
| 420 | + Pages(e) { | |
| 421 | + this.model.PageIndex = e | |
| 422 | + this.ShowRecord() | |
| 423 | + } | |
| 424 | + | |
| 425 | + } | |
| 426 | + } | |
| 427 | +</script> | |
| 428 | + | |
| 429 | +<style> | |
| 430 | +</style> | ... | ... |
src/views/comment/comment.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 4 | + <el-form-item label="用户名"> | |
| 5 | + <el-input v-model="model.KeyWord" placeholder="用户名"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item label="用户ID"> | |
| 8 | + <el-input v-model="model.UserId" placeholder="用户ID"></el-input> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="状态"> | |
| 11 | + <el-select v-model="model.Type" placeholder="状态"> | |
| 12 | + <el-option label="查所有" value="-1"></el-option> | |
| 13 | + <el-option label="未审核" value="0"></el-option> | |
| 14 | + <el-option label="已审核" value="1"></el-option> | |
| 15 | + </el-select> | |
| 16 | + </el-form-item> | |
| 17 | + <el-form-item> | |
| 18 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 19 | + </el-form-item> | |
| 20 | + <el-form-item> | |
| 21 | + <el-button type="success" @click="dialogVisible = true">新增</el-button> | |
| 22 | + </el-form-item> | |
| 23 | + </el-form> | |
| 24 | + <el-table :data="tableData" style="width: 100%"> | |
| 25 | + <el-table-column prop="date" label="ID"> | |
| 26 | + <template slot-scope="scope"> | |
| 27 | + {{scope.row.id}} | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + <el-table-column prop="date" label="用户ID"> | |
| 31 | + <template slot-scope="scope"> | |
| 32 | + {{scope.row.UserId}} | |
| 33 | + </template> | |
| 34 | + </el-table-column> | |
| 35 | + <el-table-column prop="date" label="用户名"> | |
| 36 | + <template slot-scope="scope"> | |
| 37 | + {{scope.row.UserName}} | |
| 38 | + </template> | |
| 39 | + </el-table-column> | |
| 40 | + <el-table-column prop="date" label="评论内容"> | |
| 41 | + <template slot-scope="scope"> | |
| 42 | + {{scope.row.commentContent}} | |
| 43 | + </template> | |
| 44 | + </el-table-column> | |
| 45 | + <el-table-column prop="UserImg" label="用户头像"> | |
| 46 | + <template slot-scope="scope"> | |
| 47 | + <img :src="scope.row.UserImg" style="width: 50px;height: 50px;" /> | |
| 48 | + <!-- {{scope.row.UserImg}} --> | |
| 49 | + </template> | |
| 50 | + </el-table-column> | |
| 51 | + <el-table-column prop="date" label="评论晒图"> | |
| 52 | + <template slot-scope="scope"> | |
| 53 | + <!-- {{scope.row.commentSendImg}} --> | |
| 54 | + <img :src="'https://shangten.yiqituancity.com'+item" v-for="(item,index) in scope.row.commentSendImg" :key="index" | |
| 55 | + style="width: 50px; height: 50px;" /> | |
| 56 | + </template> | |
| 57 | + </el-table-column> | |
| 58 | + <el-table-column prop="date" label="星级"> | |
| 59 | + <template slot-scope="scope"> | |
| 60 | + {{scope.row.commetNum}} | |
| 61 | + </template> | |
| 62 | + </el-table-column> | |
| 63 | + <el-table-column prop="date" label="回复评论"> | |
| 64 | + <template slot-scope="scope"> | |
| 65 | + {{scope.row.ReturnContent}} | |
| 66 | + </template> | |
| 67 | + </el-table-column> | |
| 68 | + <el-table-column prop="date" label="回复人"> | |
| 69 | + <template slot-scope="scope"> | |
| 70 | + {{scope.row.ReturnName}} | |
| 71 | + </template> | |
| 72 | + </el-table-column> | |
| 73 | + <el-table-column prop="date" label="状态"> | |
| 74 | + <template slot-scope="scope"> | |
| 75 | + <el-tag :type="scope.row.Status==0?'success':'warn'"> | |
| 76 | + {{scope.row.Status==0?'正常':'异常'}} | |
| 77 | + </el-tag> | |
| 78 | + </template> | |
| 79 | + </el-table-column> | |
| 80 | + <el-table-column prop="date" label="审核状态"> | |
| 81 | + <template slot-scope="scope"> | |
| 82 | + <el-tag :type="scope.row.Type==0?'warn':'success'"> | |
| 83 | + {{scope.row.Type==0?'未审核':scope.row.Type==1?'已审核':'未知'}} | |
| 84 | + </el-tag> | |
| 85 | + </template> | |
| 86 | + </el-table-column> | |
| 87 | + <el-table-column prop="add_time" label="评论时间"> | |
| 88 | + <template slot-scope="scope"> | |
| 89 | + {{scope.row.add_time}} | |
| 90 | + </template> | |
| 91 | + </el-table-column> | |
| 92 | + <el-table-column prop="date" label="删除"> | |
| 93 | + <template slot-scope="scope"> | |
| 94 | + <el-button type="danger" @click="DelCommentS(scope.row.id)">删除</el-button> | |
| 95 | + </template> | |
| 96 | + </el-table-column> | |
| 97 | + <el-table-column prop="date" label="回复"> | |
| 98 | + <template slot-scope="scope"> | |
| 99 | + <el-button type="success" @click="ReturnHH(scope.row.id)">回复</el-button> | |
| 100 | + </template> | |
| 101 | + </el-table-column> | |
| 102 | + <el-table-column prop="date" label="审核"> | |
| 103 | + <template slot-scope="scope"> | |
| 104 | + <el-button type="primary" @click="SH(scope.row.id)" :disabled="scope.row.Type==1">审核</el-button> | |
| 105 | + </template> | |
| 106 | + </el-table-column> | |
| 107 | + | |
| 108 | + </el-table> | |
| 109 | + <el-pagination | |
| 110 | + background | |
| 111 | + layout="prev, pager, next" | |
| 112 | + :total="model.TotalCount" @current-change="Pages" style="text-align:center;margin-top: 10px;"> | |
| 113 | + </el-pagination> | |
| 114 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="50%"> | |
| 115 | + <el-form ref="form" :model="form" label-width="80px" :rules="formrules"> | |
| 116 | + <el-form-item label="评论人头像" prop="UserImg"> | |
| 117 | + <el-upload class="avatar-uploader" action="https://shangten.yiqituancity.com/api/Upload/upload" | |
| 118 | + :show-file-list="false" :on-success="handleAvatarSuccess"> | |
| 119 | + <img v-if="form.UserImg" :src="'https://shangten.yiqituancity.com'+form.UserImg" class="avatar"> | |
| 120 | + <i v-else class="el-icon-plus avatar-uploader-icon"></i> | |
| 121 | + </el-upload> | |
| 122 | + </el-form-item> | |
| 123 | + <el-form-item label="评论图片" prop="commentSendImg"> | |
| 124 | + <el-upload action="https://shangten.yiqituancity.com/api/Upload/upload" list-type="picture-card" | |
| 125 | + :on-preview="handlePictureCardPreview" :on-remove="handleRemove" :on-success="UpChange" | |
| 126 | + :limit="3"> | |
| 127 | + <i class="el-icon-plus"></i> | |
| 128 | + </el-upload> | |
| 129 | + <el-dialog :visible.sync="dialogVisibleX"> | |
| 130 | + <img width="100%" :src="dialogImageUrl" alt=""> | |
| 131 | + </el-dialog> | |
| 132 | + <!-- <el-input type="text" placeholder="评论图片" v-model="form.commentSendImg"></el-input> --> | |
| 133 | + </el-form-item> | |
| 134 | + <el-form-item label="评论人姓名" prop="UserName"> | |
| 135 | + <el-input type="text" placeholder="请输入姓名" v-model="form.UserName"></el-input> | |
| 136 | + </el-form-item> | |
| 137 | + <el-form-item label="评论人ID" prop="UserId"> | |
| 138 | + <el-input type="text" placeholder="请输入ID" v-model="form.UserId" maxlength="10"></el-input> | |
| 139 | + </el-form-item> | |
| 140 | + <el-form-item label="评论内容" prop="commentContent"> | |
| 141 | + <textarea v-model="form.commentContent" style="width: 100%;height: 50px;" placeholder="请输入内容"></textarea> | |
| 142 | + <!-- <el-input type="text" placeholder="评论内容" v-model="form.commentContent" maxlength="20"></el-input> --> | |
| 143 | + </el-form-item> | |
| 144 | + | |
| 145 | + <el-form-item label="星级" prop="commetNum"> | |
| 146 | + <el-input type="text" placeholder="星级" v-model="form.commetNum" maxlength="1"></el-input> | |
| 147 | + </el-form-item> | |
| 148 | + </el-form> | |
| 149 | + <span slot="footer" class="dialog-footer"> | |
| 150 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 151 | + <el-button type="primary" @click="SubmitAdd">确 定</el-button> | |
| 152 | + </span> | |
| 153 | + </el-dialog> | |
| 154 | + | |
| 155 | + | |
| 156 | + <el-dialog title="提示" :visible.sync="dialogVisibleR" width="50%"> | |
| 157 | + <el-form ref="returnModel" :model="returnModel" label-width="80px" > | |
| 158 | + <el-form-item label="回复内容" prop="ReturnContent"> | |
| 159 | + <el-input type="text" placeholder="请输入内容" v-model="returnModel.ReturnContent"></el-input> | |
| 160 | + </el-form-item> | |
| 161 | + <el-form-item label="回复商家" prop="ReturnName"> | |
| 162 | + <el-input type="text" placeholder="回复商家" v-model="returnModel.ReturnName" maxlength="10"></el-input> | |
| 163 | + </el-form-item> | |
| 164 | + | |
| 165 | + </el-form> | |
| 166 | + <span slot="footer" class="dialog-footer"> | |
| 167 | + <el-button @click="dialogVisibleR = false">取 消</el-button> | |
| 168 | + <el-button type="primary" @click="SubmitHH">确 定</el-button> | |
| 169 | + </span> | |
| 170 | + </el-dialog> | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + </div> | |
| 178 | +</template> | |
| 179 | + | |
| 180 | +<script> | |
| 181 | + import { | |
| 182 | + ReturnComment, | |
| 183 | + AddComment, | |
| 184 | + DelComment, | |
| 185 | + GetCommentList, | |
| 186 | + audit, | |
| 187 | + } from '../../api/comment.js' | |
| 188 | + import utils from '../../utils/utils.js' | |
| 189 | + export default { | |
| 190 | + data() { | |
| 191 | + return { | |
| 192 | + returnModel: { | |
| 193 | + "id": 0, | |
| 194 | + "ReturnContent": "", | |
| 195 | + "ReturnName": "尚腾汽车养护管家" | |
| 196 | + }, | |
| 197 | + dialogImageUrl: '', | |
| 198 | + dialogVisibleR:false, | |
| 199 | + dialogVisibleX: false, | |
| 200 | + dialogVisible: false, | |
| 201 | + | |
| 202 | + formrules: { | |
| 203 | + UserImg: [{ | |
| 204 | + required: true, | |
| 205 | + message: '请选择头像', | |
| 206 | + trigger: 'blur' | |
| 207 | + } | |
| 208 | + //{ pattern:/^[a-zA-Z]w{1,4}$/, message: '以字母开头,长度在2-5之间, 只能包含字符、数字和下划线'} | |
| 209 | + ], | |
| 210 | + UserName: [{ | |
| 211 | + required: true, | |
| 212 | + message: '请输入姓名', | |
| 213 | + trigger: 'blur' | |
| 214 | + } | |
| 215 | + //{ pattern:/^[a-zA-Z]w{1,4}$/, message: '以字母开头,长度在2-5之间, 只能包含字符、数字和下划线'} | |
| 216 | + ], | |
| 217 | + UserId: [{ | |
| 218 | + required: true, | |
| 219 | + message: '请输入ID', | |
| 220 | + trigger: 'blur' | |
| 221 | + }, { | |
| 222 | + pattern: /^[0-9]*$/, | |
| 223 | + message: '请输入数字' | |
| 224 | + }], | |
| 225 | + commentContent: [{ | |
| 226 | + required: true, | |
| 227 | + message: '请输入评论', | |
| 228 | + trigger: 'blur' | |
| 229 | + } | |
| 230 | + //{ pattern:/^[a-zA-Z]w{1,4}$/, message: '以字母开头,长度在2-5之间, 只能包含字符、数字和下划线'} | |
| 231 | + ], | |
| 232 | + commentSendImg: [{ | |
| 233 | + required: true, | |
| 234 | + message: '请选择评论晒图', | |
| 235 | + trigger: 'blur' | |
| 236 | + } | |
| 237 | + //{ pattern:/^[a-zA-Z]w{1,4}$/, message: '以字母开头,长度在2-5之间, 只能包含字符、数字和下划线'} | |
| 238 | + ], | |
| 239 | + commetNum: [{ | |
| 240 | + required: true, | |
| 241 | + message: '请输入星级', | |
| 242 | + trigger: 'blur' | |
| 243 | + } | |
| 244 | + //{ pattern:/^[a-zA-Z]w{1,4}$/, message: '以字母开头,长度在2-5之间, 只能包含字符、数字和下划线'} | |
| 245 | + ], | |
| 246 | + }, | |
| 247 | + tableData: [], | |
| 248 | + model: { | |
| 249 | + "UserId": '0', | |
| 250 | + "Type": '-1', | |
| 251 | + "KeyWord": "", | |
| 252 | + "TotalCount": 0, | |
| 253 | + "PageIndex": 1, | |
| 254 | + "PageSize": 10, | |
| 255 | + "Sort": [{ | |
| 256 | + "Field": "", | |
| 257 | + "Type": 0 | |
| 258 | + }] | |
| 259 | + }, | |
| 260 | + form: { | |
| 261 | + "UserImg": "", | |
| 262 | + "UserName": "", | |
| 263 | + "UserId": 0, | |
| 264 | + "commentContent": "", | |
| 265 | + "commentSendImg": "", | |
| 266 | + "commetNum": 0 | |
| 267 | + }, | |
| 268 | + ImgSrc: [], | |
| 269 | + // AllImg: [] | |
| 270 | + } | |
| 271 | + }, | |
| 272 | + created() { | |
| 273 | + this.ShowComment() | |
| 274 | + }, | |
| 275 | + methods: { | |
| 276 | + Pages(e){ | |
| 277 | + this.model.PageIndex=e | |
| 278 | + this.ShowComment() | |
| 279 | + }, | |
| 280 | + // 审核 | |
| 281 | + SH(id){ | |
| 282 | + audit(id).then(res=>{ | |
| 283 | + if(res.data.code==200){ | |
| 284 | + this.$message.success('审核成功') | |
| 285 | + this.ShowComment() | |
| 286 | + }else{ | |
| 287 | + this.$message.error('审核失败') | |
| 288 | + } | |
| 289 | + }) | |
| 290 | + }, | |
| 291 | + ReturnHH(id){ | |
| 292 | + this.dialogVisibleR=true | |
| 293 | + this.returnModel.id=id | |
| 294 | + }, | |
| 295 | + SubmitHH(){ | |
| 296 | + ReturnComment(this.returnModel).then(res=>{ | |
| 297 | + console.log('数据',res) | |
| 298 | + if(res.data.code==200){ | |
| 299 | + this.$message.success('回复成功') | |
| 300 | + this.dialogVisibleR=false | |
| 301 | + this.ShowComment() | |
| 302 | + }else{ | |
| 303 | + this.$message.error('回复失败') | |
| 304 | + } | |
| 305 | + }) | |
| 306 | + }, | |
| 307 | + DelCommentS(id) { | |
| 308 | + DelComment(id).then(res => { | |
| 309 | + if (res.data.code == 200) { | |
| 310 | + this.$message.success('删除成功') | |
| 311 | + this.ShowComment() | |
| 312 | + } else { | |
| 313 | + this.$message.error('删除失败') | |
| 314 | + } | |
| 315 | + }) | |
| 316 | + }, | |
| 317 | + handleRemove(file, fileList) { | |
| 318 | + console.log(file, fileList); | |
| 319 | + }, | |
| 320 | + handlePictureCardPreview(file) { | |
| 321 | + console.log('数据啊', file) | |
| 322 | + this.dialogImageUrl = file.url; | |
| 323 | + this.dialogVisible = true; | |
| 324 | + }, | |
| 325 | + // 上传change事件 | |
| 326 | + UpChange(res) { | |
| 327 | + console.log('数据', res) | |
| 328 | + this.ImgSrc.push(res.data.data.Uri) | |
| 329 | + this.form.commentSendImg = this.ImgSrc.toString() | |
| 330 | + console.log('数据', this.ImgSrc) | |
| 331 | + }, | |
| 332 | + ShowComment() { | |
| 333 | + GetCommentList(this.model).then(res => { | |
| 334 | + console.log('评论数据', res) | |
| 335 | + res.data.data.rows.forEach((item, index) => { | |
| 336 | + if(item.commentSendImg!=null ||item.commentSendImg!=''){ | |
| 337 | + item.commentSendImg=item.commentSendImg.split(',') | |
| 338 | + } | |
| 339 | + if(item.UserImg.startsWith('https')==false){ | |
| 340 | + item.UserImg='https://shangten.yiqituancity.com'+item.UserImg | |
| 341 | + } | |
| 342 | + item.add_time=utils.formatTime(item.add_time,"yyyy-MM-dd") | |
| 343 | + }) | |
| 344 | + this.tableData = res.data.data.rows | |
| 345 | + console.log('整体数据',this.tableData) | |
| 346 | + this.model.TotalCount = res.data.data.total | |
| 347 | + }) | |
| 348 | + }, | |
| 349 | + onSubmit() { | |
| 350 | + this.ShowComment() | |
| 351 | + }, | |
| 352 | + handleAvatarSuccess(res, file) { | |
| 353 | + console.log('数据', res) | |
| 354 | + this.form.UserImg = res.data.data.Uri | |
| 355 | + // this.imageUrl = URL.createObjectURL(file.raw); | |
| 356 | + }, | |
| 357 | + // handleAvatarSuccessI(res,file){ | |
| 358 | + // this.form.commentSendImg=res.data.data.Uri | |
| 359 | + // }, | |
| 360 | + SubmitAdd() { | |
| 361 | + this.$refs.form.validate((valid) => { | |
| 362 | + if (valid) { | |
| 363 | + AddComment(this.form).then(res => { | |
| 364 | + console.log('添加数据') | |
| 365 | + if (res.data.code == 200) { | |
| 366 | + this.$message.success('添加评论成功') | |
| 367 | + this.dialogVisible = false | |
| 368 | + this.ImgSrc = [] | |
| 369 | + this.ShowComment() | |
| 370 | + } else { | |
| 371 | + this.$message.error('添加评论失败') | |
| 372 | + } | |
| 373 | + }) | |
| 374 | + } | |
| 375 | + }) | |
| 376 | + } | |
| 377 | + | |
| 378 | + | |
| 379 | + } | |
| 380 | + } | |
| 381 | +</script> | |
| 382 | + | |
| 383 | +<style> | |
| 384 | + .avatar-uploader .el-upload { | |
| 385 | + border: 1px dashed #d9d9d9; | |
| 386 | + border-radius: 6px; | |
| 387 | + cursor: pointer; | |
| 388 | + position: relative; | |
| 389 | + overflow: hidden; | |
| 390 | + } | |
| 391 | + | |
| 392 | + .avatar-uploader .el-upload:hover { | |
| 393 | + border-color: #409EFF; | |
| 394 | + } | |
| 395 | + | |
| 396 | + .avatar-uploader-icon { | |
| 397 | + font-size: 28px; | |
| 398 | + color: #8c939d; | |
| 399 | + width: 178px; | |
| 400 | + height: 178px; | |
| 401 | + line-height: 178px; | |
| 402 | + text-align: center; | |
| 403 | + } | |
| 404 | + | |
| 405 | + .avatar { | |
| 406 | + width: 178px; | |
| 407 | + height: 178px; | |
| 408 | + display: block; | |
| 409 | + } | |
| 410 | +</style> | ... | ... |
src/views/dashboard/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="dashboard-container"> | |
| 3 | + <div class="dashboard-text">欢迎您: {{ name }}</div> | |
| 4 | + </div> | |
| 5 | +</template> | |
| 6 | + | |
| 7 | +<script> | |
| 8 | +import { mapGetters } from 'vuex' | |
| 9 | + | |
| 10 | +export default { | |
| 11 | + name: 'Dashboard', | |
| 12 | + computed: { | |
| 13 | + ...mapGetters([ | |
| 14 | + 'name' | |
| 15 | + ]) | |
| 16 | + } | |
| 17 | +} | |
| 18 | +</script> | |
| 19 | + | |
| 20 | +<style lang="scss" scoped> | |
| 21 | +.dashboard { | |
| 22 | + &-container { | |
| 23 | + margin: 30px; | |
| 24 | + background-color: #304156; | |
| 25 | + border-radius: 7px; | |
| 26 | + } | |
| 27 | + &-text { | |
| 28 | + font-size: 18px; | |
| 29 | + line-height: 46px; | |
| 30 | + padding: 0 10px; | |
| 31 | + color: #FFF; | |
| 32 | + } | |
| 33 | +} | |
| 34 | +</style> | ... | ... |
src/views/deposit/deposit.vue
0 → 100644
src/views/externalInfo/externalInfo.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="padding: 10px;" > | |
| 3 | + <div v-if="isshowView==0"> | |
| 4 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 5 | + <el-form-item label="关键字"> | |
| 6 | + <el-input v-model="model.KeyWord" placeholder="关键字"></el-input> | |
| 7 | + </el-form-item> | |
| 8 | + <el-form-item> | |
| 9 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 10 | + </el-form-item> | |
| 11 | + </el-form> | |
| 12 | + <el-table :data="tableData" style="width: 100%"> | |
| 13 | + <el-table-column prop="date" label="ID" > | |
| 14 | + <template slot-scope="scope"> | |
| 15 | + {{scope.row.id}} | |
| 16 | + </template> | |
| 17 | + </el-table-column> | |
| 18 | + <el-table-column prop="beijintupian" label="头像"> | |
| 19 | + <template slot-scope="scope"> | |
| 20 | + <img :src="scope.row.beijintupian" style="width: 50px;height: 50px;" /> | |
| 21 | + <!-- {{scope.row.beijintupian}} --> | |
| 22 | + </template> | |
| 23 | + </el-table-column> | |
| 24 | + <el-table-column prop="date" label="微信名" > | |
| 25 | + <template slot-scope="scope"> | |
| 26 | + {{scope.row.username}} | |
| 27 | + </template> | |
| 28 | + </el-table-column> | |
| 29 | + <el-table-column prop="date" label="别名" > | |
| 30 | + <template slot-scope="scope"> | |
| 31 | + {{scope.row.full_name}} | |
| 32 | + </template> | |
| 33 | + </el-table-column> | |
| 34 | + <el-table-column prop="date" label="用户电话" > | |
| 35 | + <template slot-scope="scope"> | |
| 36 | + {{scope.row.phone}} | |
| 37 | + </template> | |
| 38 | + </el-table-column> | |
| 39 | + <el-table-column prop="date" label="备用电话" > | |
| 40 | + <template slot-scope="scope"> | |
| 41 | + {{scope.row.updphone}} | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + <el-table-column prop="[address]" label="地址" > | |
| 45 | + <template slot-scope="scope"> | |
| 46 | + {{scope.row.address}} | |
| 47 | + </template> | |
| 48 | + </el-table-column> | |
| 49 | + <el-table-column prop="date" label="性别" v-if="false"> | |
| 50 | + <template slot-scope="scope"> | |
| 51 | + <!-- 0--男 1--女 --> | |
| 52 | + <el-tag type="success"> | |
| 53 | + {{scope.row.sex==0?'男':'女'}} | |
| 54 | + </el-tag> | |
| 55 | + </template> | |
| 56 | + </el-table-column> | |
| 57 | + <el-table-column prop="date" label="生日" v-if="false"> | |
| 58 | + <template slot-scope="scope"> | |
| 59 | + {{scope.row.birthday}} | |
| 60 | + </template> | |
| 61 | + </el-table-column> | |
| 62 | + <el-table-column prop="date" label="用户角色" > | |
| 63 | + <template slot-scope="scope"> | |
| 64 | + <el-tag type="success"> | |
| 65 | + {{scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知'}} | |
| 66 | + </el-tag> | |
| 67 | + </template> | |
| 68 | + </el-table-column> | |
| 69 | + <el-table-column prop="date" label="用户状态" > | |
| 70 | + <template slot-scope="scope"> | |
| 71 | + <el-tag :type="scope.row.status==0?'success':'warn'"> | |
| 72 | + {{scope.row.status==0?'使用中':'禁用中'}} | |
| 73 | + </el-tag> | |
| 74 | + </template> | |
| 75 | + </el-table-column> | |
| 76 | + <el-table-column prop="date" label="添加时间" v-if="false"> | |
| 77 | + <template slot-scope="scope"> | |
| 78 | + {{scope.row.add_time}} | |
| 79 | + </template> | |
| 80 | + </el-table-column> | |
| 81 | + <el-table-column prop="date" label="查看直推" > | |
| 82 | + <template slot-scope="scope"> | |
| 83 | + <el-button type="success" @click="SelectOrder(scope.row.id)">查看直推</el-button> | |
| 84 | + </template> | |
| 85 | + </el-table-column> | |
| 86 | + <el-table-column prop="date" label="查看下级" > | |
| 87 | + <template slot-scope="scope"> | |
| 88 | + <el-button type="success" @click="SelectOrderW(scope.row.id)">查看下级</el-button> | |
| 89 | + </template> | |
| 90 | + </el-table-column> | |
| 91 | + </el-table> | |
| 92 | + <el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-page="Pages" | |
| 93 | + style="text-align:right;margin-top:10px;"> | |
| 94 | + </el-pagination> | |
| 95 | + <!-- 折叠面板 --> | |
| 96 | + <el-collapse v-if="isshow==0"> | |
| 97 | + <el-collapse-item title="客户经理直推" name="1" > | |
| 98 | + <div class="zt"> | |
| 99 | + <el-form :inline="true" :model="formCustomer" class="demo-form-inline"> | |
| 100 | + <el-form-item label="开始日期"> | |
| 101 | + <el-date-picker v-model="formCustomer.StartResultTime" type="datetime" placeholder="开始日期"> | |
| 102 | + </el-date-picker> | |
| 103 | + </el-form-item> | |
| 104 | + <el-form-item label="结束日期"> | |
| 105 | + <el-date-picker v-model="formCustomer.EndResultTime" type="datetime" placeholder="结束日期"> | |
| 106 | + </el-date-picker> | |
| 107 | + </el-form-item> | |
| 108 | + <el-form-item label="状态"> | |
| 109 | + <el-select v-model="formCustomer.RecordState" placeholder="预约状态" @change="cs"> | |
| 110 | + <el-option label="查所有" value="-1"></el-option> | |
| 111 | + <el-option label="已预约" value="0"></el-option> | |
| 112 | + <el-option label="已取消" value="1"></el-option> | |
| 113 | + <el-option label="已完成" value="2"></el-option> | |
| 114 | + </el-select> | |
| 115 | + </el-form-item> | |
| 116 | + <el-form-item> | |
| 117 | + <el-button type="primary" @click="onSubmitTime">查询</el-button> | |
| 118 | + </el-form-item> | |
| 119 | + </el-form> | |
| 120 | + <el-table :data="Direct" style="width: 100%"> | |
| 121 | + <el-table-column prop="date" label="ID" width="180"> | |
| 122 | + <template slot-scope="scope"> | |
| 123 | + {{scope.row.Id}} | |
| 124 | + </template> | |
| 125 | + </el-table-column> | |
| 126 | + <el-table-column prop="beijintupian" label="头像" width="180"> | |
| 127 | + <template slot-scope="scope"> | |
| 128 | + <img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" /> | |
| 129 | + </template> | |
| 130 | + </el-table-column> | |
| 131 | + <el-table-column prop="RecordName" label="微信名" width="180"> | |
| 132 | + <template slot-scope="scope"> | |
| 133 | + {{scope.row.RecordName}} | |
| 134 | + </template> | |
| 135 | + </el-table-column> | |
| 136 | + <el-table-column prop="RecordPhone" label="电话号码" width="180"> | |
| 137 | + <template slot-scope="scope"> | |
| 138 | + {{scope.row.RecordPhone}} | |
| 139 | + </template> | |
| 140 | + </el-table-column> | |
| 141 | + <el-table-column prop="date" label="用户名" width="180"> | |
| 142 | + <template slot-scope="scope"> | |
| 143 | + {{scope.row.UserName}} | |
| 144 | + </template> | |
| 145 | + </el-table-column> | |
| 146 | + <el-table-column prop="UserId" label="用户ID" width="180"> | |
| 147 | + <template slot-scope="scope"> | |
| 148 | + {{scope.row.UserId}} | |
| 149 | + </template> | |
| 150 | + </el-table-column> | |
| 151 | + <el-table-column prop="CarId" label="车辆ID" v-if="false"> | |
| 152 | + <template slot-scope="scope"> | |
| 153 | + {{scope.row.CarId}} | |
| 154 | + </template> | |
| 155 | + </el-table-column> | |
| 156 | + | |
| 157 | + <el-table-column prop="date" label="状态" width="180"> | |
| 158 | + <template slot-scope="scope"> | |
| 159 | + <el-tag type="success"> | |
| 160 | + {{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}} | |
| 161 | + </el-tag> | |
| 162 | + </template> | |
| 163 | + </el-table-column> | |
| 164 | + <el-table-column prop="Remarks" label="备注" width="180"> | |
| 165 | + <template slot-scope="scope"> | |
| 166 | + {{scope.row.Remarks}} | |
| 167 | + </template> | |
| 168 | + </el-table-column> | |
| 169 | + <el-table-column prop="date" label="车型" width="180"> | |
| 170 | + <template slot-scope="scope"> | |
| 171 | + {{scope.row.CarModel}} | |
| 172 | + </template> | |
| 173 | + </el-table-column> | |
| 174 | + <el-table-column prop="date" label="颜色" width="180"> | |
| 175 | + <template slot-scope="scope"> | |
| 176 | + {{scope.row.CarColour}} | |
| 177 | + </template> | |
| 178 | + </el-table-column> | |
| 179 | + <el-table-column prop="date" label="划痕" width="180"> | |
| 180 | + <template slot-scope="scope"> | |
| 181 | + {{scope.row.Scratch}} | |
| 182 | + </template> | |
| 183 | + </el-table-column> | |
| 184 | + <el-table-column prop="date" label="腐蚀" width="180"> | |
| 185 | + <template slot-scope="scope"> | |
| 186 | + {{scope.row.Corrosion}} | |
| 187 | + </template> | |
| 188 | + </el-table-column> | |
| 189 | + <el-table-column prop="date" label="破损" width="180"> | |
| 190 | + <template slot-scope="scope"> | |
| 191 | + {{scope.row.BeDamaged}} | |
| 192 | + </template> | |
| 193 | + </el-table-column> | |
| 194 | + <el-table-column prop="date" label="飞漆" width="180"> | |
| 195 | + <template slot-scope="scope"> | |
| 196 | + {{scope.row.FlyingPaint}} | |
| 197 | + </template> | |
| 198 | + </el-table-column> | |
| 199 | + <el-table-column prop="date" label="地址" width="180"> | |
| 200 | + <template slot-scope="scope"> | |
| 201 | + {{scope.row.Address}} | |
| 202 | + </template> | |
| 203 | + </el-table-column> | |
| 204 | + <el-table-column prop="date" label="预约时间" width="180"> | |
| 205 | + <template slot-scope="scope"> | |
| 206 | + {{scope.row.MakeTime}} | |
| 207 | + </template> | |
| 208 | + </el-table-column> | |
| 209 | + <el-table-column prop="date" label="添加时间" width="180" v-if="false"> | |
| 210 | + <template slot-scope="scope"> | |
| 211 | + {{scope.row.AddTime}} | |
| 212 | + </template> | |
| 213 | + </el-table-column> | |
| 214 | + <el-table-column prop="ResultTime" label="付款时间" width="180"> | |
| 215 | + <template slot-scope="scope"> | |
| 216 | + <!-- {{scope.row.RecordTime}} --> | |
| 217 | + {{scope.row.State==2?scope.row.ResultTime:''}} | |
| 218 | + </template> | |
| 219 | + </el-table-column> | |
| 220 | + </el-table> | |
| 221 | + <el-pagination background layout="prev, pager, next" :total="formCustomer.TotalCount" | |
| 222 | + @current-page="PagesCustomer" style="text-align:right;margin-top:10px;"> | |
| 223 | + </el-pagination> | |
| 224 | + </div> | |
| 225 | + </el-collapse-item> | |
| 226 | + <el-collapse-item title="专员推广" name="2"> | |
| 227 | + <div class="xj"> | |
| 228 | + <!-- 经理下级专员 --> | |
| 229 | + <el-table :data="ManageData" style="width: 100%;"> | |
| 230 | + <el-table-column prop="date" label="ID" > | |
| 231 | + <template slot-scope="scope"> | |
| 232 | + {{scope.row.id}} | |
| 233 | + </template> | |
| 234 | + </el-table-column> | |
| 235 | + <el-table-column prop="beijintupian" label="头像"> | |
| 236 | + <template slot-scope="scope"> | |
| 237 | + <img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" /> | |
| 238 | + </template> | |
| 239 | + </el-table-column> | |
| 240 | + <el-table-column prop="username" label="微信名" > | |
| 241 | + <template slot-scope="scope"> | |
| 242 | + {{scope.row.username}} | |
| 243 | + </template> | |
| 244 | + </el-table-column> | |
| 245 | + <el-table-column prop="phone" label="手机号" > | |
| 246 | + <template slot-scope="scope"> | |
| 247 | + {{scope.row.phone}} | |
| 248 | + </template> | |
| 249 | + </el-table-column> | |
| 250 | + <el-table-column prop="type" label="用户角色" > | |
| 251 | + <template slot-scope="scope"> | |
| 252 | + <el-tag type="success"> | |
| 253 | + {{scope.row.type==0?'超级管理员':scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知'}} | |
| 254 | + </el-tag> | |
| 255 | + </template> | |
| 256 | + </el-table-column> | |
| 257 | + <el-table-column prop="full_name" label="别名" > | |
| 258 | + <template slot-scope="scope"> | |
| 259 | + {{scope.row.full_name}} | |
| 260 | + </template> | |
| 261 | + </el-table-column> | |
| 262 | + <el-table-column prop="remark" label="备注" > | |
| 263 | + <template slot-scope="scope"> | |
| 264 | + {{scope.row.remark}} | |
| 265 | + </template> | |
| 266 | + </el-table-column> | |
| 267 | + <el-table-column prop="remark" label="查看推广" > | |
| 268 | + <template slot-scope="scope"> | |
| 269 | + <el-button type="primary" @click="SelectW(scope.row.id)">查看推广</el-button> | |
| 270 | + </template> | |
| 271 | + </el-table-column> | |
| 272 | + | |
| 273 | + </el-table> | |
| 274 | + | |
| 275 | + <!-- 下级推广数据 --> | |
| 276 | + <el-form :inline="true" :model="formCustomerW" class="demo-form-inline" style="margin-top:20px;"> | |
| 277 | + <el-form-item label="开始日期"> | |
| 278 | + <el-date-picker v-model="formCustomerW.StartResultTime" type="datetime" placeholder="开始日期"> | |
| 279 | + </el-date-picker> | |
| 280 | + </el-form-item> | |
| 281 | + <el-form-item label="结束日期"> | |
| 282 | + <el-date-picker v-model="formCustomerW.EndResultTime" type="datetime" placeholder="结束日期"> | |
| 283 | + </el-date-picker> | |
| 284 | + </el-form-item> | |
| 285 | + <el-form-item label="状态"> | |
| 286 | + <el-select v-model="formCustomerW.RecordState" placeholder="预约状态"> | |
| 287 | + <el-option label="查所有" value="-1"></el-option> | |
| 288 | + <el-option label="已预约" value="0"></el-option> | |
| 289 | + <el-option label="已取消" value="1"></el-option> | |
| 290 | + <el-option label="已完成" value="2"></el-option> | |
| 291 | + </el-select> | |
| 292 | + </el-form-item> | |
| 293 | + <el-form-item> | |
| 294 | + <el-button type="primary" @click="onSubmitSub">查询</el-button> | |
| 295 | + </el-form-item> | |
| 296 | + </el-form> | |
| 297 | + <!-- 下级数据展示 --> | |
| 298 | + <el-table :data="SubData" style="width: 100%"> | |
| 299 | + <el-table-column prop="date" label="ID"> | |
| 300 | + <template slot-scope="scope"> | |
| 301 | + {{scope.row.Id}} | |
| 302 | + </template> | |
| 303 | + </el-table-column> | |
| 304 | + <el-table-column prop="beijintupian" label="头像"> | |
| 305 | + <template slot-scope="scope"> | |
| 306 | + <img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" /> | |
| 307 | + </template> | |
| 308 | + </el-table-column> | |
| 309 | + <el-table-column prop="RecordName" label="微信名"> | |
| 310 | + <template slot-scope="scope"> | |
| 311 | + {{scope.row.RecordName}} | |
| 312 | + </template> | |
| 313 | + </el-table-column> | |
| 314 | + <el-table-column prop="RecordPhone" label="电话号码"> | |
| 315 | + <template slot-scope="scope"> | |
| 316 | + {{scope.row.RecordPhone}} | |
| 317 | + </template> | |
| 318 | + </el-table-column> | |
| 319 | + <el-table-column prop="date" label="用户名"> | |
| 320 | + <template slot-scope="scope"> | |
| 321 | + {{scope.row.UserName}} | |
| 322 | + </template> | |
| 323 | + </el-table-column> | |
| 324 | + <el-table-column prop="UserId" label="用户ID" > | |
| 325 | + <template slot-scope="scope"> | |
| 326 | + {{scope.row.UserId}} | |
| 327 | + </template> | |
| 328 | + </el-table-column> | |
| 329 | + <el-table-column prop="CarId" label="车辆ID" v-if="false"> | |
| 330 | + <template slot-scope="scope"> | |
| 331 | + {{scope.row.CarId}} | |
| 332 | + </template> | |
| 333 | + </el-table-column> | |
| 334 | + | |
| 335 | + <el-table-column prop="date" label="状态" > | |
| 336 | + <template slot-scope="scope"> | |
| 337 | + <el-tag type="success"> | |
| 338 | + {{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}} | |
| 339 | + </el-tag> | |
| 340 | + </template> | |
| 341 | + </el-table-column> | |
| 342 | + <el-table-column prop="Remarks" label="备注" > | |
| 343 | + <template slot-scope="scope"> | |
| 344 | + {{scope.row.Remarks}} | |
| 345 | + </template> | |
| 346 | + </el-table-column> | |
| 347 | + <el-table-column prop="date" label="车型" > | |
| 348 | + <template slot-scope="scope"> | |
| 349 | + {{scope.row.CarModel}} | |
| 350 | + </template> | |
| 351 | + </el-table-column> | |
| 352 | + <el-table-column prop="date" label="颜色" > | |
| 353 | + <template slot-scope="scope"> | |
| 354 | + {{scope.row.CarColour}} | |
| 355 | + </template> | |
| 356 | + </el-table-column> | |
| 357 | + <el-table-column prop="date" label="划痕" > | |
| 358 | + <template slot-scope="scope"> | |
| 359 | + {{scope.row.Scratch}} | |
| 360 | + </template> | |
| 361 | + </el-table-column> | |
| 362 | + <el-table-column prop="date" label="腐蚀" > | |
| 363 | + <template slot-scope="scope"> | |
| 364 | + {{scope.row.Corrosion}} | |
| 365 | + </template> | |
| 366 | + </el-table-column> | |
| 367 | + <el-table-column prop="date" label="破损" > | |
| 368 | + <template slot-scope="scope"> | |
| 369 | + {{scope.row.BeDamaged}} | |
| 370 | + </template> | |
| 371 | + </el-table-column> | |
| 372 | + <el-table-column prop="date" label="飞漆" > | |
| 373 | + <template slot-scope="scope"> | |
| 374 | + {{scope.row.FlyingPaint}} | |
| 375 | + </template> | |
| 376 | + </el-table-column> | |
| 377 | + <el-table-column prop="date" label="地址" > | |
| 378 | + <template slot-scope="scope"> | |
| 379 | + {{scope.row.Address}} | |
| 380 | + </template> | |
| 381 | + </el-table-column> | |
| 382 | + <el-table-column prop="date" label="预约时间" > | |
| 383 | + <template slot-scope="scope"> | |
| 384 | + {{scope.row.MakeTime}} | |
| 385 | + </template> | |
| 386 | + </el-table-column> | |
| 387 | + <el-table-column prop="date" label="添加时间" v-if="false"> | |
| 388 | + <template slot-scope="scope"> | |
| 389 | + {{scope.row.AddTime}} | |
| 390 | + </template> | |
| 391 | + </el-table-column> | |
| 392 | + <el-table-column prop="ResultTime" label="付款时间"> | |
| 393 | + <template slot-scope="scope"> | |
| 394 | + <!-- {{scope.row.RecordTime}} --> | |
| 395 | + {{scope.row.State==2?scope.row.ResultTime:''}} | |
| 396 | + </template> | |
| 397 | + </el-table-column> | |
| 398 | + </el-table> | |
| 399 | + <el-pagination background layout="prev, pager, next" :total="formCustomer.TotalCount" | |
| 400 | + @current-page="PagesCustomer" style="text-align:right;margin-top:10px;"> | |
| 401 | + </el-pagination> | |
| 402 | + </div> | |
| 403 | + </el-collapse-item> | |
| 404 | + | |
| 405 | + </el-collapse> | |
| 406 | +</div> | |
| 407 | +<div class="footer" v-else>链接已失效</div> | |
| 408 | + </div> | |
| 409 | +</template> | |
| 410 | + | |
| 411 | +<script> | |
| 412 | + import { | |
| 413 | + GetRecordByCustomerX | |
| 414 | + } from '../../api/AppointmentRecord.js' | |
| 415 | + import utils from '../../utils/utils.js' | |
| 416 | + import { | |
| 417 | + GetCommissionerByManage | |
| 418 | + } from '../../api/user.js' | |
| 419 | + import {GetPartnerById} from '../../api/Partner.js' | |
| 420 | + import { | |
| 421 | + GetUserList | |
| 422 | + } from '../../api/partneruser.js' | |
| 423 | + export default { | |
| 424 | + data() { | |
| 425 | + return { | |
| 426 | + // 0--展示折叠面板 1--不展示折叠面板 | |
| 427 | + isshow:1, | |
| 428 | + Direct: [], | |
| 429 | + // 获取某个用户下面的客户所有预约情况 | |
| 430 | + formCustomer: { | |
| 431 | + "StartResultTime": "", | |
| 432 | + "EndResultTime": "", | |
| 433 | + "UserId": 0, | |
| 434 | + "RecordState": '查所有', | |
| 435 | + "KeyWord": "", | |
| 436 | + "TotalCount": 0, | |
| 437 | + "PageIndex": 1, | |
| 438 | + "PageSize": 20, | |
| 439 | + "Sort": [{ | |
| 440 | + "Field": "id", | |
| 441 | + "Type": 0 | |
| 442 | + }] | |
| 443 | + }, | |
| 444 | + // 获取某个销售专员下的客户所有预约情况 | |
| 445 | + formCustomerW: { | |
| 446 | + "StartResultTime": "", | |
| 447 | + "EndResultTime": "", | |
| 448 | + "UserId": 0, | |
| 449 | + "RecordState": '查所有', | |
| 450 | + "KeyWord": "", | |
| 451 | + "TotalCount": 0, | |
| 452 | + "PageIndex": 1, | |
| 453 | + "PageSize": 20, | |
| 454 | + "Sort": [{ | |
| 455 | + "Field": "id", | |
| 456 | + "Type": 0 | |
| 457 | + }] | |
| 458 | + }, | |
| 459 | + tableData: [], | |
| 460 | + model: { | |
| 461 | + "id": 0, | |
| 462 | + "KeyWord": "", | |
| 463 | + "TotalCount": 0, | |
| 464 | + "PageIndex": 1, | |
| 465 | + "PageSize": 20, | |
| 466 | + "Sort": [{ | |
| 467 | + "Field": "id", | |
| 468 | + "Type": 0 | |
| 469 | + }] | |
| 470 | + }, | |
| 471 | + // 销售经理ID | |
| 472 | + ManageUserId: { | |
| 473 | + UserId: 0, | |
| 474 | + }, | |
| 475 | + // 销售专员数据 | |
| 476 | + ManageData: [], | |
| 477 | + // 销售专员的下级推广数据 | |
| 478 | + SubData: [], | |
| 479 | + //0---展示数据 1---隐藏数据 失效 | |
| 480 | + isshow:0, | |
| 481 | + // 链接失效与否 0--不失效 1--失效 | |
| 482 | + isshowView:0, | |
| 483 | + } | |
| 484 | + }, | |
| 485 | + created() { | |
| 486 | + this.model.id =utils.Decrypt(this.$route.query.id) | |
| 487 | + console.log('数据',this.$route.query.id) | |
| 488 | + console.log('数据2',this.model.id) | |
| 489 | + this.SetShow(this.model.id) | |
| 490 | + this.ShowManager() | |
| 491 | + }, | |
| 492 | + methods: { | |
| 493 | + //根据过期时间显示隐藏 | |
| 494 | + SetShow(id){ | |
| 495 | + GetPartnerById(id).then(res=>{ | |
| 496 | + console.log('时间',res) | |
| 497 | + if(res.data.code==200){ | |
| 498 | + // 没过期 | |
| 499 | + this.isshowView=0 | |
| 500 | + }else{ | |
| 501 | + // 过期了 | |
| 502 | + this.isshowView=1 | |
| 503 | + } | |
| 504 | + console.log('状态',this.isshow) | |
| 505 | + }) | |
| 506 | + }, | |
| 507 | + // 直推提交查询 | |
| 508 | + onSubmitTime() { | |
| 509 | + this.ShowZT() | |
| 510 | + }, | |
| 511 | + // 下级提交查询 | |
| 512 | + onSubmitSub() { | |
| 513 | + this.GetSubData() | |
| 514 | + }, | |
| 515 | + // 查看销售经理下的销售专员 | |
| 516 | + SelectOrderW(id) { | |
| 517 | + this.ManageUserId.UserId = id | |
| 518 | + GetCommissionerByManage(this.ManageUserId).then(res => { | |
| 519 | + console.log('查询客户经理下的推广专员数据', res) | |
| 520 | + if (res.data.code == 200) { | |
| 521 | + if(res.data.data.length==0){ | |
| 522 | + this.$message.error('暂无下级推广专员') | |
| 523 | + }else{ | |
| 524 | + this.$message.success('查询下级推广专员成功') | |
| 525 | + this.ManageData = res.data.data | |
| 526 | + } | |
| 527 | + } else { | |
| 528 | + this.$message.error(res.data.message) | |
| 529 | + } | |
| 530 | + }) | |
| 531 | + }, | |
| 532 | + // 查看推广专员下的所有预约情况 id=推广专员 | |
| 533 | + SelectW(id) { | |
| 534 | + this.formCustomerW.RecordState=-1 | |
| 535 | + this.formCustomerW.UserId = id | |
| 536 | + console.log('wwww') | |
| 537 | + GetRecordByCustomerX(this.formCustomerW).then(res => { | |
| 538 | + console.log('查询出的数据', res) | |
| 539 | + if(res.data.code==200){ | |
| 540 | + this.$message.success('查询下级成功') | |
| 541 | + if (res.data.data.total == 0) { | |
| 542 | + this.$message.error('暂无下级预约数据') | |
| 543 | + } else { | |
| 544 | + res.data.data.rows.forEach((item, index) => { | |
| 545 | + item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss") | |
| 546 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss") | |
| 547 | + item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss") | |
| 548 | + | |
| 549 | + }) | |
| 550 | + this.SubData = res.data.data.rows | |
| 551 | + this.formCustomerW.TotalCount = res.data.data.total | |
| 552 | + } | |
| 553 | + }else{ | |
| 554 | + this.$message.error('查询下级失败') | |
| 555 | + } | |
| 556 | + }) | |
| 557 | + }, | |
| 558 | + // 查询 | |
| 559 | + GetSubData(){ | |
| 560 | + GetRecordByCustomerX(this.formCustomerW).then(res => { | |
| 561 | + console.log('查询出的数据', res) | |
| 562 | + if (res.data.data.total == 0) { | |
| 563 | + this.$message.error('暂无下级预约数据') | |
| 564 | + this.SubData=[] | |
| 565 | + } else { | |
| 566 | + res.data.data.rows.forEach((item, index) => { | |
| 567 | + item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss") | |
| 568 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss") | |
| 569 | + item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss") | |
| 570 | + }) | |
| 571 | + this.SubData = res.data.data.rows | |
| 572 | + this.formCustomerW.TotalCount = res.data.data.total | |
| 573 | + } | |
| 574 | + }) | |
| 575 | + }, | |
| 576 | + // 查看直推订单 | |
| 577 | + SelectOrder(id) { | |
| 578 | + // 销售经理id传给查询销售专员接口 | |
| 579 | + this.formCustomer.UserId = id | |
| 580 | + this.formCustomer.RecordState = -1 | |
| 581 | + GetRecordByCustomerX(this.formCustomer).then(res => { | |
| 582 | + console.log('直推', res) | |
| 583 | + if (res.data.data.total == 0) { | |
| 584 | + this.$message.error('暂无下级预约数据') | |
| 585 | + } else { | |
| 586 | + res.data.data.rows.forEach((item, index) => { | |
| 587 | + item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss") | |
| 588 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss") | |
| 589 | + item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss") | |
| 590 | + }) | |
| 591 | + this.Direct = res.data.data.rows | |
| 592 | + this.formCustomer.TotalCount = res.data.data.total | |
| 593 | + } | |
| 594 | + }) | |
| 595 | + }, | |
| 596 | + //展示直推用户 | |
| 597 | + ShowZT() { | |
| 598 | + GetRecordByCustomerX(this.formCustomer).then(res => { | |
| 599 | + console.log('直推', res) | |
| 600 | + res.data.data.rows.forEach((item, index) => { | |
| 601 | + item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss") | |
| 602 | + item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss") | |
| 603 | + }) | |
| 604 | + this.Direct = res.data.data.rows | |
| 605 | + this.formCustomer.TotalCount = res.data.data.total | |
| 606 | + }) | |
| 607 | + }, | |
| 608 | + Pages(e) { | |
| 609 | + this.model.PageIndex = e | |
| 610 | + this.ShowManager() | |
| 611 | + }, | |
| 612 | + PagesCustomer(e) { | |
| 613 | + this.formCustomer.PageIndex = e | |
| 614 | + this.ShowZT() | |
| 615 | + }, | |
| 616 | + // 查询销售经理 | |
| 617 | + ShowManager() { | |
| 618 | + GetUserList(this.model).then(res => { | |
| 619 | + console.log('数据', res) | |
| 620 | + if(res.data.data.total>0){ | |
| 621 | + this.isshow=0 | |
| 622 | + res.data.data.rows.forEach((item, index) => { | |
| 623 | + item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss") | |
| 624 | + }) | |
| 625 | + this.tableData = res.data.data.rows | |
| 626 | + this.model.TotalCount = res.data.data.total | |
| 627 | + }else{ | |
| 628 | + this.isshow=1 | |
| 629 | + } | |
| 630 | + }) | |
| 631 | + }, | |
| 632 | + onSubmit() { | |
| 633 | + this.ShowManager() | |
| 634 | + } | |
| 635 | + } | |
| 636 | + } | |
| 637 | +</script> | |
| 638 | + | |
| 639 | +<style> | |
| 640 | + .footer{ | |
| 641 | + padding: 10px; | |
| 642 | + } | |
| 643 | +</style> | ... | ... |
src/views/login/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="login-container"> | |
| 3 | + <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> | |
| 4 | + | |
| 5 | + <div class="title-container"> | |
| 6 | + <h3 class="title">尚腾汽车管理后台</h3> | |
| 7 | + </div> | |
| 8 | + | |
| 9 | + <el-form-item prop="username"> | |
| 10 | + <span class="svg-container"> | |
| 11 | + <svg-icon icon-class="user" /> | |
| 12 | + </span> | |
| 13 | + <el-input | |
| 14 | + ref="username" | |
| 15 | + v-model="loginForm.username" | |
| 16 | + placeholder="Username" | |
| 17 | + name="username" | |
| 18 | + type="text" | |
| 19 | + tabindex="1" | |
| 20 | + auto-complete="on" | |
| 21 | + /> | |
| 22 | + </el-form-item> | |
| 23 | + | |
| 24 | + <el-form-item prop="password"> | |
| 25 | + <span class="svg-container"> | |
| 26 | + <svg-icon icon-class="password" /> | |
| 27 | + </span> | |
| 28 | + <el-input | |
| 29 | + :key="passwordType" | |
| 30 | + ref="password" | |
| 31 | + v-model="loginForm.password" | |
| 32 | + :type="passwordType" | |
| 33 | + placeholder="Password" | |
| 34 | + name="password" | |
| 35 | + tabindex="2" | |
| 36 | + auto-complete="on" | |
| 37 | + @keyup.enter.native="handleLogin" | |
| 38 | + /> | |
| 39 | + <span class="show-pwd" @click="showPwd"> | |
| 40 | + <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> | |
| 41 | + </span> | |
| 42 | + </el-form-item> | |
| 43 | + | |
| 44 | + <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button> | |
| 45 | + | |
| 46 | + <div class="tips" v-if="false"> | |
| 47 | + <span style="margin-right:20px;">username: admin</span> | |
| 48 | + <span> password: any</span> | |
| 49 | + </div> | |
| 50 | + | |
| 51 | + </el-form> | |
| 52 | + </div> | |
| 53 | +</template> | |
| 54 | + | |
| 55 | +<script> | |
| 56 | +import { validUsername } from '@/utils/validate' | |
| 57 | +import {setUser} from '../../utils/auth.js' | |
| 58 | +export default { | |
| 59 | + name: 'Login', | |
| 60 | + data() { | |
| 61 | + const validateUsername = (rule, value, callback) => { | |
| 62 | + if (!validUsername(value)) { | |
| 63 | + callback(new Error('Please enter the correct user name')) | |
| 64 | + } else { | |
| 65 | + callback() | |
| 66 | + } | |
| 67 | + } | |
| 68 | + const validatePassword = (rule, value, callback) => { | |
| 69 | + if (value.length < 6) { | |
| 70 | + callback(new Error('The password can not be less than 6 digits')) | |
| 71 | + } else { | |
| 72 | + callback() | |
| 73 | + } | |
| 74 | + } | |
| 75 | + return { | |
| 76 | + loginForm: { | |
| 77 | + username: '', | |
| 78 | + password: '' | |
| 79 | + }, | |
| 80 | + loginRules: { | |
| 81 | + // username: [{ required: true, trigger: 'blur', validator: validateUsername }], | |
| 82 | + // password: [{ required: true, trigger: 'blur', validator: validatePassword }] | |
| 83 | + }, | |
| 84 | + loading: false, | |
| 85 | + passwordType: 'password', | |
| 86 | + redirect: undefined | |
| 87 | + } | |
| 88 | + }, | |
| 89 | + watch: { | |
| 90 | + $route: { | |
| 91 | + handler: function(route) { | |
| 92 | + this.redirect = route.query && route.query.redirect | |
| 93 | + }, | |
| 94 | + immediate: true | |
| 95 | + } | |
| 96 | + }, | |
| 97 | + methods: { | |
| 98 | + showPwd() { | |
| 99 | + if (this.passwordType === 'password') { | |
| 100 | + this.passwordType = '' | |
| 101 | + } else { | |
| 102 | + this.passwordType = 'password' | |
| 103 | + } | |
| 104 | + this.$nextTick(() => { | |
| 105 | + this.$refs.password.focus() | |
| 106 | + }) | |
| 107 | + }, | |
| 108 | + handleLogin() { | |
| 109 | + this.$refs.loginForm.validate(valid => { | |
| 110 | + if (valid) { | |
| 111 | + this.loading = true | |
| 112 | + this.$store.dispatch('user/login', this.loginForm).then((res) => { | |
| 113 | + this.$router.push({ path: this.redirect || '/' }) | |
| 114 | + this.loading = false | |
| 115 | + }).catch(() => { | |
| 116 | + this.loading = false | |
| 117 | + }) | |
| 118 | + } else { | |
| 119 | + console.log('error submit!!') | |
| 120 | + return false | |
| 121 | + } | |
| 122 | + }) | |
| 123 | + } | |
| 124 | + } | |
| 125 | +} | |
| 126 | +</script> | |
| 127 | + | |
| 128 | +<style lang="scss"> | |
| 129 | +/* 修复input 背景不协调 和光标变色 */ | |
| 130 | +/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */ | |
| 131 | + | |
| 132 | +$bg:#283443; | |
| 133 | +$light_gray:#fff; | |
| 134 | +$cursor: #fff; | |
| 135 | + | |
| 136 | +@supports (-webkit-mask: none) and (not (cater-color: $cursor)) { | |
| 137 | + .login-container .el-input input { | |
| 138 | + color: $cursor; | |
| 139 | + } | |
| 140 | +} | |
| 141 | + | |
| 142 | +/* reset element-ui css */ | |
| 143 | +.login-container { | |
| 144 | + .el-input { | |
| 145 | + display: inline-block; | |
| 146 | + height: 47px; | |
| 147 | + width: 85%; | |
| 148 | + | |
| 149 | + input { | |
| 150 | + background: transparent; | |
| 151 | + border: 0px; | |
| 152 | + -webkit-appearance: none; | |
| 153 | + border-radius: 0px; | |
| 154 | + padding: 12px 5px 12px 15px; | |
| 155 | + color: $light_gray; | |
| 156 | + height: 47px; | |
| 157 | + caret-color: $cursor; | |
| 158 | + | |
| 159 | + &:-webkit-autofill { | |
| 160 | + box-shadow: 0 0 0px 1000px $bg inset !important; | |
| 161 | + -webkit-text-fill-color: $cursor !important; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + } | |
| 165 | + | |
| 166 | + .el-form-item { | |
| 167 | + border: 1px solid rgba(255, 255, 255, 0.1); | |
| 168 | + background: rgba(0, 0, 0, 0.1); | |
| 169 | + border-radius: 5px; | |
| 170 | + color: #454545; | |
| 171 | + } | |
| 172 | +} | |
| 173 | +</style> | |
| 174 | + | |
| 175 | +<style lang="scss" scoped> | |
| 176 | +$bg:#2d3a4b; | |
| 177 | +$dark_gray:#889aa4; | |
| 178 | +$light_gray:#eee; | |
| 179 | + | |
| 180 | +.login-container { | |
| 181 | + min-height: 100%; | |
| 182 | + width: 100%; | |
| 183 | + background-color: $bg; | |
| 184 | + overflow: hidden; | |
| 185 | + | |
| 186 | + .login-form { | |
| 187 | + position: relative; | |
| 188 | + width: 520px; | |
| 189 | + max-width: 100%; | |
| 190 | + padding: 160px 35px 0; | |
| 191 | + margin: 0 auto; | |
| 192 | + overflow: hidden; | |
| 193 | + } | |
| 194 | + | |
| 195 | + .tips { | |
| 196 | + font-size: 14px; | |
| 197 | + color: #fff; | |
| 198 | + margin-bottom: 10px; | |
| 199 | + | |
| 200 | + span { | |
| 201 | + &:first-of-type { | |
| 202 | + margin-right: 16px; | |
| 203 | + } | |
| 204 | + } | |
| 205 | + } | |
| 206 | + | |
| 207 | + .svg-container { | |
| 208 | + padding: 6px 5px 6px 15px; | |
| 209 | + color: $dark_gray; | |
| 210 | + vertical-align: middle; | |
| 211 | + width: 30px; | |
| 212 | + display: inline-block; | |
| 213 | + } | |
| 214 | + | |
| 215 | + .title-container { | |
| 216 | + position: relative; | |
| 217 | + | |
| 218 | + .title { | |
| 219 | + font-size: 26px; | |
| 220 | + color: $light_gray; | |
| 221 | + margin: 0px auto 40px auto; | |
| 222 | + text-align: center; | |
| 223 | + font-weight: bold; | |
| 224 | + } | |
| 225 | + } | |
| 226 | + | |
| 227 | + .show-pwd { | |
| 228 | + position: absolute; | |
| 229 | + right: 10px; | |
| 230 | + top: 7px; | |
| 231 | + font-size: 16px; | |
| 232 | + color: $dark_gray; | |
| 233 | + cursor: pointer; | |
| 234 | + user-select: none; | |
| 235 | + } | |
| 236 | +} | |
| 237 | +</style> | ... | ... |
src/views/moneys/moneys.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <el-form :inline="true" :model="moneymodel" class="demo-form-inline"> | |
| 4 | + <el-form-item label="关键字"> | |
| 5 | + <el-input v-model="moneymodel.KeyWord" placeholder="关键字"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item label="状态"> | |
| 8 | + <el-select v-model="moneymodel.status" placeholder="请选择"> | |
| 9 | + <el-option label="成功" value="0"></el-option> | |
| 10 | + <el-option label="失败" value="1"></el-option> | |
| 11 | + </el-select> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item> | |
| 14 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 15 | + </el-form-item> | |
| 16 | + <el-form-item> | |
| 17 | + <el-button type="success" @click="AddOrUpdMoney(null)">新增</el-button> | |
| 18 | + </el-form-item> | |
| 19 | + </el-form> | |
| 20 | + <el-table :data="tableData" style="width: 100%"> | |
| 21 | + <el-table-column prop="id" label="ID" v-if="false"> | |
| 22 | + <template slot-scope="scope"> | |
| 23 | + {{scope.row.id}} | |
| 24 | + </template> | |
| 25 | + </el-table-column> | |
| 26 | + <el-table-column prop="username" label="用户微信名"> | |
| 27 | + <template slot-scope="scope"> | |
| 28 | + {{scope.row.username}} | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column prop="openid" label="OpenId" v-if="false"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + {{scope.row.openid}} | |
| 34 | + </template> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column prop="remark" label="备注" v-if="false"> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + {{scope.row.remark}} | |
| 39 | + </template> | |
| 40 | + </el-table-column> | |
| 41 | + <el-table-column prop="userid" label="用户ID" v-if="false"> | |
| 42 | + <template slot-scope="scope"> | |
| 43 | + {{scope.row.userid}} | |
| 44 | + </template> | |
| 45 | + </el-table-column> | |
| 46 | + <el-table-column prop="oldmoney" label="原金额"> | |
| 47 | + <template slot-scope="scope"> | |
| 48 | + ¥{{scope.row.oldmoney/100}} | |
| 49 | + </template> | |
| 50 | + </el-table-column> | |
| 51 | + <el-table-column prop="nowmoney" label="余额"> | |
| 52 | + <template slot-scope="scope"> | |
| 53 | + ¥{{scope.row.nowmoney/100}} | |
| 54 | + </template> | |
| 55 | + </el-table-column> | |
| 56 | + <el-table-column prop="money" label="提现金额"> | |
| 57 | + <template slot-scope="scope"> | |
| 58 | + ¥{{scope.row.money/100}} | |
| 59 | + </template> | |
| 60 | + </el-table-column> | |
| 61 | + <el-table-column prop="add_time" label="提现时间"> | |
| 62 | + <template slot-scope="scope"> | |
| 63 | + {{scope.row.add_time}} | |
| 64 | + </template> | |
| 65 | + </el-table-column> | |
| 66 | + <el-table-column prop="status" label="状态"> | |
| 67 | + <template slot-scope="scope"> | |
| 68 | + <el-tag :type="scope.row.status==0?'success':'warn'"> | |
| 69 | + {{scope.row.status==0?'成功':'失败'}} | |
| 70 | + </el-tag> | |
| 71 | + </template> | |
| 72 | + </el-table-column> | |
| 73 | + <el-table-column label="编辑" v-if="false"> | |
| 74 | + <template slot-scope="scope"> | |
| 75 | + <el-button type="primary" @click="AddOrUpdMoney(scope.row)">编辑</el-button> | |
| 76 | + </template> | |
| 77 | + </el-table-column> | |
| 78 | + <el-table-column label="删除" v-if="false"> | |
| 79 | + <template slot-scope="scope"> | |
| 80 | + <el-button type="danger" @click="DelMoney(scope.row.id)">删除</el-button> | |
| 81 | + </template> | |
| 82 | + </el-table-column> | |
| 83 | + </el-table> | |
| 84 | + <el-pagination background layout="prev, pager, next" :total="moneymodel.TotalCount" @current-change="Pages" | |
| 85 | + style="text-align:center;margin-top: 10px;"> | |
| 86 | + </el-pagination> | |
| 87 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="30%"> | |
| 88 | + | |
| 89 | + <el-form ref="form" :model="form" label-width="80px" :rules="rules"> | |
| 90 | + <el-form-item label="用户名" prop="username"> | |
| 91 | + <el-input v-model="form.username" placeholder="用户名"></el-input> | |
| 92 | + </el-form-item> | |
| 93 | + <el-form-item label="原提现金额" prop="oldmoney"> | |
| 94 | + <el-input v-model="form.oldmoney" placeholder="原提现金额"></el-input> | |
| 95 | + </el-form-item> | |
| 96 | + <el-form-item label="提现金额" prop="money"> | |
| 97 | + <el-input v-model="form.money" placeholder="提现金额"></el-input> | |
| 98 | + </el-form-item> | |
| 99 | + <el-form-item label="现剩余金额" prop="nowmoney" v-if="false"> | |
| 100 | + <el-input v-model="form.nowmoney"></el-input> | |
| 101 | + </el-form-item> | |
| 102 | + </el-form> | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + <span slot="footer" class="dialog-footer"> | |
| 107 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 108 | + <el-button type="primary" @click="SubmitMoney">确 定</el-button> | |
| 109 | + </span> | |
| 110 | + </el-dialog> | |
| 111 | + </div> | |
| 112 | +</template> | |
| 113 | + | |
| 114 | +<script> | |
| 115 | + import { | |
| 116 | + AddOrUpdMoney, | |
| 117 | + DelMoney, | |
| 118 | + GetMoneyList | |
| 119 | + } from '../../api/money.js' | |
| 120 | + import utils from '../../utils/utils.js' | |
| 121 | + export default { | |
| 122 | + data() { | |
| 123 | + return { | |
| 124 | + dialogVisible: false, | |
| 125 | + rules: { | |
| 126 | + username: [{ | |
| 127 | + required: true, | |
| 128 | + message: '请输入用户名', | |
| 129 | + trigger: 'change' | |
| 130 | + }, | |
| 131 | + ], | |
| 132 | + oldmoney: [{ | |
| 133 | + required: true, | |
| 134 | + message: '请输入金额(元)', | |
| 135 | + trigger: 'change' | |
| 136 | + }, | |
| 137 | + { | |
| 138 | + pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/, | |
| 139 | + message: '请输入数值和小数', | |
| 140 | + trigger: 'blur' | |
| 141 | + } | |
| 142 | + ], | |
| 143 | + money: [{ | |
| 144 | + required: true, | |
| 145 | + message: '请输入金额(元)', | |
| 146 | + trigger: 'change' | |
| 147 | + }, | |
| 148 | + { | |
| 149 | + pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/, | |
| 150 | + message: '请输入数值和小数', | |
| 151 | + trigger: 'blur' | |
| 152 | + } | |
| 153 | + ], | |
| 154 | + }, | |
| 155 | + tableData: [], | |
| 156 | + moneymodel: { | |
| 157 | + "status": 0, | |
| 158 | + "KeyWord": "", | |
| 159 | + "TotalCount": 0, | |
| 160 | + "PageIndex": 1, | |
| 161 | + "PageSize": 10, | |
| 162 | + "Sort": [{ | |
| 163 | + "Field": "", | |
| 164 | + "Type": 0 | |
| 165 | + }] | |
| 166 | + }, | |
| 167 | + form: { | |
| 168 | + "id": 0, | |
| 169 | + "username": "", | |
| 170 | + "remark":'', | |
| 171 | + "openid":'', | |
| 172 | + "userid": 0, | |
| 173 | + "oldmoney": 0, | |
| 174 | + "nowmoney": 0, | |
| 175 | + "money": 0, | |
| 176 | + "add_time": "2022-01-18T02:47:00.549Z", | |
| 177 | + "status": 0 | |
| 178 | + } | |
| 179 | + } | |
| 180 | + }, | |
| 181 | + created() { | |
| 182 | + this.ShowMoneys() | |
| 183 | + }, | |
| 184 | + methods: { | |
| 185 | + // 提交添加或者修改 | |
| 186 | + SubmitMoney() { | |
| 187 | + this.$refs.form.validate((valid) => { | |
| 188 | + if (valid) { | |
| 189 | + this.form.oldmoney = this.form.oldmoney * 100 | |
| 190 | + this.form.money = this.form.money * 100 | |
| 191 | + this.form.nowmoney = parseInt(this.form.oldmoney - this.form.money) | |
| 192 | + AddOrUpdMoney(this.form).then(res => { | |
| 193 | + console.log('哈哈', res) | |
| 194 | + if (res.data.code == 200) { | |
| 195 | + this.$message.success('操作成功') | |
| 196 | + this.dialogVisible = false | |
| 197 | + this.ShowMoneys() | |
| 198 | + } else { | |
| 199 | + this.$message.error('操作失败') | |
| 200 | + } | |
| 201 | + }) | |
| 202 | + } | |
| 203 | + }) | |
| 204 | + }, | |
| 205 | + DelMoney(id) { | |
| 206 | + DelMoney(id).then(res => { | |
| 207 | + console.log('删除数据', res) | |
| 208 | + if (res.code == 200) { | |
| 209 | + this.$message.success('删除成功') | |
| 210 | + this.ShowMoneys() | |
| 211 | + } | |
| 212 | + this.$message.error('删除失败') | |
| 213 | + }) | |
| 214 | + }, | |
| 215 | + Pages(e) { | |
| 216 | + this.moneymodel.PageIndex = e | |
| 217 | + this.ShowMoneys() | |
| 218 | + }, | |
| 219 | + // 展示提现金额 | |
| 220 | + ShowMoneys() { | |
| 221 | + GetMoneyList(this.moneymodel).then(res => { | |
| 222 | + console.log('提现记录', res) | |
| 223 | + res.data.data.rows.forEach((item,index)=>[ | |
| 224 | + item.add_time=utils.formatTime(item.add_time,"yyyy-MM-dd HH:mm:ss") | |
| 225 | + ]) | |
| 226 | + this.tableData = res.data.data.rows | |
| 227 | + this.moneymodel.TotalCount = res.data.data.total | |
| 228 | + }) | |
| 229 | + }, | |
| 230 | + AddOrUpdMoney(obj) { | |
| 231 | + this.dialogVisible = true | |
| 232 | + if (obj == null) { | |
| 233 | + // 新增 | |
| 234 | + this.form.id = 0 | |
| 235 | + this.form.username = '' | |
| 236 | + this.form.oldmoney = 0 | |
| 237 | + this.form.money = 0 | |
| 238 | + this.form.nowmoney = 0 | |
| 239 | + } else { | |
| 240 | + // 修改 | |
| 241 | + this.form.id = obj.id | |
| 242 | + this.form.username = obj.username | |
| 243 | + this.form.oldmoney = obj.oldmoney / 100 | |
| 244 | + this.form.money = obj.money / 100 | |
| 245 | + this.form.nowmoney = obj.nowmoney / 100 | |
| 246 | + } | |
| 247 | + }, | |
| 248 | + onSubmit() { | |
| 249 | + this.ShowMoneys() | |
| 250 | + } | |
| 251 | + } | |
| 252 | + } | |
| 253 | +</script> | |
| 254 | + | |
| 255 | +<style> | |
| 256 | +</style> | ... | ... |
src/views/partner/partner.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="padding: 10px;"> | |
| 3 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 4 | + <el-form-item label="关键字"> | |
| 5 | + <el-input v-model="model.KeyWord" placeholder="关键字"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + | |
| 8 | + <el-form-item> | |
| 9 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 10 | + </el-form-item> | |
| 11 | + <el-form-item> | |
| 12 | + <el-button type="success" @click="addorupdpartner(null)">新增</el-button> | |
| 13 | + </el-form-item> | |
| 14 | + </el-form> | |
| 15 | + <el-table :data="tableData" style="width: 100%"> | |
| 16 | + <el-table-column prop="date" label="ID" v-if="false"> | |
| 17 | + <template slot-scope="scope"> | |
| 18 | + {{scope.row.id}} | |
| 19 | + </template> | |
| 20 | + </el-table-column> | |
| 21 | + <el-table-column prop="partnerName" label="合伙人姓名"> | |
| 22 | + <template slot-scope="scope"> | |
| 23 | + {{scope.row.partnerName}} | |
| 24 | + </template> | |
| 25 | + </el-table-column> | |
| 26 | + <el-table-column prop="remark" label="合伙人备注"> | |
| 27 | + <template slot-scope="scope"> | |
| 28 | + {{scope.row.remark}} | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column prop="status" label="状态"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + <el-tag :type="scope.row.status==0?'success':'warn'"> | |
| 34 | + {{scope.row.status==0?'使用中':'禁用中'}} | |
| 35 | + </el-tag> | |
| 36 | + </template> | |
| 37 | + </el-table-column> | |
| 38 | + <el-table-column prop="add_time" label="添加时间"> | |
| 39 | + <template slot-scope="scope"> | |
| 40 | + {{scope.row.add_time}} | |
| 41 | + </template> | |
| 42 | + </el-table-column> | |
| 43 | + <el-table-column label="查看推广"> | |
| 44 | + <template slot-scope="scope"> | |
| 45 | + <el-button type="primary" @click="RedirectOrder(scope.row.id)">查看推广</el-button> | |
| 46 | + </template> | |
| 47 | + </el-table-column> | |
| 48 | + <el-table-column label="编辑"> | |
| 49 | + <template slot-scope="scope"> | |
| 50 | + <el-button type="success" @click="addorupdpartner(scope.row)">编辑</el-button> | |
| 51 | + </template> | |
| 52 | + </el-table-column> | |
| 53 | + <el-table-column label="删除"> | |
| 54 | + <template slot-scope="scope"> | |
| 55 | + <el-button type="warning" @click="DelPartner(scope.row.id)">删除</el-button> | |
| 56 | + </template> | |
| 57 | + </el-table-column> | |
| 58 | + <el-table-column label="添加推广(经理)"> | |
| 59 | + <template slot-scope="scope"> | |
| 60 | + <el-button type="primary" @click="Addsubordinate(scope.row.id)">推广用户</el-button> | |
| 61 | + </template> | |
| 62 | + </el-table-column> | |
| 63 | + </el-table> | |
| 64 | + <el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-page="Pages" | |
| 65 | + style="text-align: right;margin-top: 10px;"> | |
| 66 | + </el-pagination> | |
| 67 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="50%"> | |
| 68 | + <el-form ref="form" :model="form" label-width="80px" :rules="rulesform"> | |
| 69 | + <el-form-item label="合伙人姓名" prop="partnerName"> | |
| 70 | + <el-input v-model="form.partnerName" placeholder="合伙人姓名" maxlength="12"></el-input> | |
| 71 | + </el-form-item> | |
| 72 | + <el-form-item label="合伙人备注" prop="remark"> | |
| 73 | + <el-input v-model="form.remark" placeholder="合伙人备注" max="20"></el-input> | |
| 74 | + </el-form-item> | |
| 75 | + </el-form> | |
| 76 | + <span slot="footer" class="dialog-footer"> | |
| 77 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 78 | + <el-button type="primary" @click="SubmitPartner">确 定</el-button> | |
| 79 | + </span> | |
| 80 | + </el-dialog> | |
| 81 | + <el-dialog title="新增推广人员" :visible.sync="dialogVisibleX" width="30%"> | |
| 82 | + <el-form ref="formpartner" :model="formpartner" label-width="80px" :rules="partneruserForm"> | |
| 83 | + <el-form-item label="用户ID" prop="User_id"> | |
| 84 | + <el-input type="text" placeholder="请输入用户ID(编号)" v-model="formpartner.User_id"></el-input> | |
| 85 | + </el-form-item> | |
| 86 | + <el-form-item label="合伙人ID" prop="Partner_id" v-if="false"> | |
| 87 | + <el-input type="text" placeholder="请输入合伙人ID" v-model="formpartner.Partner_id" disabled></el-input> | |
| 88 | + </el-form-item> | |
| 89 | + </el-form> | |
| 90 | + <span slot="footer" class="dialog-footer"> | |
| 91 | + <el-button @click="dialogVisibleX = false">取 消</el-button> | |
| 92 | + <el-button type="primary" @click="SubmitPartnerUser">确 定</el-button> | |
| 93 | + </span> | |
| 94 | + </el-dialog> | |
| 95 | + <el-dialog | |
| 96 | + title="外部链接" | |
| 97 | + :visible.sync="dialogVisibleR" | |
| 98 | + width="50%" | |
| 99 | + > | |
| 100 | + <span>外部链接:{{linkR}}</span> | |
| 101 | + <span slot="footer" class="dialog-footer"> | |
| 102 | + <el-button @click="dialogVisibleR = false">取 消</el-button> | |
| 103 | + <el-button type="primary" @click="dialogVisibleR = false">确 定</el-button> | |
| 104 | + </span> | |
| 105 | + </el-dialog> | |
| 106 | + </div> | |
| 107 | +</template> | |
| 108 | + | |
| 109 | +<script> | |
| 110 | + import { | |
| 111 | + GetListPartner, | |
| 112 | + AddOrUpdatePartner, | |
| 113 | + DelPartner | |
| 114 | + } from '../../api/Partner.js' | |
| 115 | + import { | |
| 116 | + AddOrUpdatePartnerUser | |
| 117 | + } from '../../api/partneruser.js' | |
| 118 | + import utils from '../../utils/utils.js' | |
| 119 | + export default { | |
| 120 | + data() { | |
| 121 | + return { | |
| 122 | + dialogVisibleX: false, | |
| 123 | + dialogVisible: false, | |
| 124 | + dialogVisibleR:false, | |
| 125 | + linkR:'', | |
| 126 | + tableData: [], | |
| 127 | + model: { | |
| 128 | + "KeyWord": "", | |
| 129 | + "TotalCount": 0, | |
| 130 | + "PageIndex": 1, | |
| 131 | + "PageSize": 20, | |
| 132 | + "Sort": [{ | |
| 133 | + "Field": "", | |
| 134 | + "Type": 0 | |
| 135 | + }] | |
| 136 | + }, | |
| 137 | + form: { | |
| 138 | + "id": 0, | |
| 139 | + "partnerName": "", | |
| 140 | + "remark": "", | |
| 141 | + "status": 0, | |
| 142 | + "add_time": "2022-01-26T08:46:59.928Z", | |
| 143 | + "update_time": "2022-01-26T08:46:59.928Z", | |
| 144 | + }, | |
| 145 | + rulesform: { | |
| 146 | + partnerName: [{ | |
| 147 | + required: true, | |
| 148 | + message: '请输入合伙人姓名', | |
| 149 | + trigger: 'blur' | |
| 150 | + }] | |
| 151 | + }, | |
| 152 | + // 合伙人绑定销售经理 | |
| 153 | + partneruserForm: { | |
| 154 | + User_id: [{ | |
| 155 | + required: true, | |
| 156 | + message: '请输入用户ID(编号)', | |
| 157 | + trigger: 'blur' | |
| 158 | + }], | |
| 159 | + Partner_id: [{ | |
| 160 | + required: true, | |
| 161 | + message: '请输入合伙人ID', | |
| 162 | + trigger: 'blur' | |
| 163 | + }] | |
| 164 | + }, | |
| 165 | + // 合伙人绑定销售经理 | |
| 166 | + formpartner: { | |
| 167 | + "id": 0, | |
| 168 | + "User_id": 0, | |
| 169 | + "Partner_id": 0, | |
| 170 | + "status": 0 | |
| 171 | + } | |
| 172 | + } | |
| 173 | + }, | |
| 174 | + created() { | |
| 175 | + this.ShowPartner() | |
| 176 | + }, | |
| 177 | + methods: { | |
| 178 | + // 新增销售经理 | |
| 179 | + Addsubordinate(id) { | |
| 180 | + console.log('id', id) | |
| 181 | + this.dialogVisibleX = true | |
| 182 | + this.formpartner.Partner_id = id | |
| 183 | + | |
| 184 | + }, | |
| 185 | + // 合伙人绑定销售经理提交 | |
| 186 | + SubmitPartnerUser() { | |
| 187 | + this.$refs.formpartner.validate((valid) => { | |
| 188 | + if (valid) { | |
| 189 | + AddOrUpdatePartnerUser(this.formpartner).then(res => { | |
| 190 | + console.log('数', res) | |
| 191 | + if (res.data.code == 200) { | |
| 192 | + this.$message.success('绑定销售经理成功') | |
| 193 | + this.dialogVisibleX = false | |
| 194 | + } else { | |
| 195 | + this.$message.error(res.data.message) | |
| 196 | + } | |
| 197 | + }) | |
| 198 | + } | |
| 199 | + }) | |
| 200 | + }, | |
| 201 | + | |
| 202 | + // 查看订单 | |
| 203 | + RedirectOrder(id) { | |
| 204 | + let links='https://shangten.yiqituancity.com/#/externalInfo?id='+utils.Encrypt(id) | |
| 205 | + this.linkR=links | |
| 206 | + this.dialogVisibleR=true | |
| 207 | + // this.$router.push({ | |
| 208 | + // path: '/externalInfo?id=' +id | |
| 209 | + // }) | |
| 210 | + | |
| 211 | + }, | |
| 212 | + Pages(e) { | |
| 213 | + this.model.PageIndex = e | |
| 214 | + this.ShowPartner() | |
| 215 | + }, | |
| 216 | + // 查询所有合伙人信息 | |
| 217 | + ShowPartner() { | |
| 218 | + GetListPartner(this.model).then(res => { | |
| 219 | + console.log('Shuju', res) | |
| 220 | + res.data.data.rows.forEach((item, index) => { | |
| 221 | + item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss") | |
| 222 | + }) | |
| 223 | + this.tableData = res.data.data.rows | |
| 224 | + this.model.TotalCount = res.data.data.total | |
| 225 | + }) | |
| 226 | + }, | |
| 227 | + // 提交编辑修改 | |
| 228 | + SubmitPartner() { | |
| 229 | + this.$refs.form.validate((valid) => { | |
| 230 | + if (valid) { | |
| 231 | + AddOrUpdatePartner(this.form).then(res => { | |
| 232 | + console.log('添加修改数据', res) | |
| 233 | + if (res.data.code == 200) { | |
| 234 | + this.$message.success('操作成功') | |
| 235 | + this.dialogVisible = false | |
| 236 | + this.ShowPartner() | |
| 237 | + } else { | |
| 238 | + this.$message.error('操作失败') | |
| 239 | + } | |
| 240 | + }) | |
| 241 | + } | |
| 242 | + }) | |
| 243 | + }, | |
| 244 | + addorupdpartner(obj) { | |
| 245 | + this.dialogVisible = true | |
| 246 | + if (obj.id > 0) { | |
| 247 | + // 修改 | |
| 248 | + this.form.id = obj.id | |
| 249 | + this.form.partnerName = obj.partnerName | |
| 250 | + this.form.remark = obj.remark | |
| 251 | + this.form.status = obj.status | |
| 252 | + } else { | |
| 253 | + // 新增 | |
| 254 | + this.form.id = 0 | |
| 255 | + this.form.partnerName = '' | |
| 256 | + this.form.remark = '' | |
| 257 | + this.form.status = 0 | |
| 258 | + } | |
| 259 | + }, | |
| 260 | + DelPartner(id) { | |
| 261 | + DelPartner(id).then(res => { | |
| 262 | + if (res.code == 200) { | |
| 263 | + this.$message.success('删除成功') | |
| 264 | + this.ShowPartner() | |
| 265 | + } else { | |
| 266 | + this.$message.error('删除失败') | |
| 267 | + } | |
| 268 | + }) | |
| 269 | + }, | |
| 270 | + // 提交查询 | |
| 271 | + onSubmit() { | |
| 272 | + | |
| 273 | + } | |
| 274 | + } | |
| 275 | + } | |
| 276 | +</script> | |
| 277 | + | |
| 278 | +<style> | |
| 279 | +</style> | ... | ... |
src/views/promotelinks/promotelinks.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container"> | |
| 3 | + | |
| 4 | + </div> | |
| 5 | +</template> | |
| 6 | + | |
| 7 | +<script> | |
| 8 | + export default{ | |
| 9 | + data(){ | |
| 10 | + return{ | |
| 11 | + links:'' | |
| 12 | + } | |
| 13 | + }, | |
| 14 | + created() { | |
| 15 | + let jsons=this.$route.query.forms | |
| 16 | + console.log('数据链接',jsons) | |
| 17 | + }, | |
| 18 | + methods:{ | |
| 19 | + | |
| 20 | + } | |
| 21 | + } | |
| 22 | +</script> | |
| 23 | + | |
| 24 | +<style> | |
| 25 | +</style> | ... | ... |
src/views/promotion/promotion.vue
0 → 100644
src/views/record/record.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <el-form :inline="true" :model="recordmodel" class="demo-form-inline"> | |
| 4 | + <el-form-item label="关键字"> | |
| 5 | + <el-input v-model="recordmodel.KeyWord" placeholder="关键字"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item> | |
| 8 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item> | |
| 11 | + <el-button type="success" @click="AddOrUpdRecord(null)">新增</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + </el-form> | |
| 14 | + <el-table :data="tableData" style="width: 100%"> | |
| 15 | + <el-table-column prop="date" label="ID" width="180" v-if="false"> | |
| 16 | + <template slot-scope="scope"> | |
| 17 | + {{scope.row.id}} | |
| 18 | + </template> | |
| 19 | + </el-table-column> | |
| 20 | + <el-table-column prop="date" label="领取人ID" width="180"> | |
| 21 | + <template slot-scope="scope"> | |
| 22 | + {{scope.row.getUser}} | |
| 23 | + </template> | |
| 24 | + </el-table-column> | |
| 25 | + <el-table-column prop="date" label="领取数量" width="180"> | |
| 26 | + <template slot-scope="scope"> | |
| 27 | + {{scope.row.getNum}} | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + <el-table-column prop="date" label="描述" width="180" v-if="false"> | |
| 31 | + <template slot-scope="scope"> | |
| 32 | + {{scope.row.remark}} | |
| 33 | + </template> | |
| 34 | + </el-table-column> | |
| 35 | + <el-table-column prop="date" label="领取时间" width="180"> | |
| 36 | + <template slot-scope="scope"> | |
| 37 | + {{scope.row.add_time}} | |
| 38 | + </template> | |
| 39 | + </el-table-column> | |
| 40 | + <el-table-column prop="date" label="修改时间" width="180"> | |
| 41 | + <template slot-scope="scope"> | |
| 42 | + {{scope.row.update_time}} | |
| 43 | + </template> | |
| 44 | + </el-table-column> | |
| 45 | + <el-table-column prop="date" label="状态" width="180"> | |
| 46 | + <template slot-scope="scope"> | |
| 47 | + <el-tag :type="scope.row.status==0?'success':'warn'"> | |
| 48 | + {{scope.row.status==0?'正常':'未知'}} | |
| 49 | + </el-tag> | |
| 50 | + </template> | |
| 51 | + </el-table-column> | |
| 52 | + <el-table-column prop="date" label="删除" width="180" v-if="false"> | |
| 53 | + <template slot-scope="scope"> | |
| 54 | + <el-button type="danger" @click="Delinfo(scope.row.id)">删除</el-button> | |
| 55 | + </template> | |
| 56 | + </el-table-column> | |
| 57 | + <el-table-column prop="date" label="编辑" width="180"> | |
| 58 | + <template slot-scope="scope"> | |
| 59 | + <el-button type="primary" @click="AddOrUpdRecord(scope.row)">编辑</el-button> | |
| 60 | + </template> | |
| 61 | + </el-table-column> | |
| 62 | + </el-table> | |
| 63 | + <el-pagination | |
| 64 | + background | |
| 65 | + layout="prev, pager, next" | |
| 66 | + :total="recordmodel.TotalCount" @current-page="Pages" style="text-align: right;margin-top: 10px;"> | |
| 67 | + </el-pagination> | |
| 68 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="50%"> | |
| 69 | + <el-form ref="recordAddUpdModel" :model="recordAddUpdModel" label-width="80px" :rules="rulerecord"> | |
| 70 | + <el-form-item label="用户" prop="getUser"> | |
| 71 | + <el-select v-model="recordAddUpdModel.getUser" placeholder="请选择"> | |
| 72 | + <el-option :label="item.username" :value="item.id" v-for="(item,index) in userlist" | |
| 73 | + :key="index"></el-option> | |
| 74 | + | |
| 75 | + </el-select> | |
| 76 | + </el-form-item> | |
| 77 | + <el-form-item label="领取数量" prop="getNum"> | |
| 78 | + <el-input v-model="recordAddUpdModel.getNum" placeholder="领取数量"></el-input> | |
| 79 | + </el-form-item> | |
| 80 | + <el-form-item label="描述" prop="remark"> | |
| 81 | + <el-input v-model="recordAddUpdModel.remark" placeholder="描述"></el-input> | |
| 82 | + </el-form-item> | |
| 83 | + </el-form> | |
| 84 | + <span slot="footer" class="dialog-footer"> | |
| 85 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 86 | + <el-button type="primary" @click="Submits">确 定</el-button> | |
| 87 | + </span> | |
| 88 | + </el-dialog> | |
| 89 | + </div> | |
| 90 | +</template> | |
| 91 | + | |
| 92 | +<script> | |
| 93 | + import { | |
| 94 | + AddOrUpdateRecord, | |
| 95 | + DelRecord, | |
| 96 | + GetRecordList | |
| 97 | + } from '../../api/record.js' | |
| 98 | + import utils from '../../utils/utils.js' | |
| 99 | + import { | |
| 100 | + GetUserList | |
| 101 | + } from '../../api/user.js' | |
| 102 | + export default { | |
| 103 | + data() { | |
| 104 | + return { | |
| 105 | + dialogVisible: false, | |
| 106 | + rulerecord: { | |
| 107 | + getUser: [{ | |
| 108 | + required: true, | |
| 109 | + message: '请选择用户', | |
| 110 | + trigger: 'blur' | |
| 111 | + }], | |
| 112 | + getNum: [{ | |
| 113 | + required: true, | |
| 114 | + message: '请输入领取数量', | |
| 115 | + trigger: 'blur' | |
| 116 | + }, | |
| 117 | + { | |
| 118 | + required: true, | |
| 119 | + pattern: /^(?:[1-9]\d*)$/, | |
| 120 | + message: '请输入整数', | |
| 121 | + trigger: 'blur' | |
| 122 | + } | |
| 123 | + ], | |
| 124 | + remark: [ | |
| 125 | + { | |
| 126 | + required: true, | |
| 127 | + message: '请输入备注', | |
| 128 | + trigger: 'blur' | |
| 129 | + }, | |
| 130 | + ] | |
| 131 | + }, | |
| 132 | + tableData: [], | |
| 133 | + // 所有用户信息 | |
| 134 | + model: { | |
| 135 | + pageIndex: 1, | |
| 136 | + pageSize: 200, | |
| 137 | + sort: '', | |
| 138 | + sortOrder: '', | |
| 139 | + keyword: '' | |
| 140 | + }, | |
| 141 | + // 领取记录 | |
| 142 | + recordmodel: { | |
| 143 | + "KeyWord": "", | |
| 144 | + "TotalCount": 0, | |
| 145 | + "PageIndex": 1, | |
| 146 | + "PageSize": 20, | |
| 147 | + "Sort": [{ | |
| 148 | + "Field": "", | |
| 149 | + "Type": 0 | |
| 150 | + }] | |
| 151 | + }, | |
| 152 | + formInline: { | |
| 153 | + user: '', | |
| 154 | + region: '' | |
| 155 | + }, | |
| 156 | + // 添加修改 | |
| 157 | + recordAddUpdModel: { | |
| 158 | + "id": 0, | |
| 159 | + "getUser": 0, | |
| 160 | + "getNum": 0, | |
| 161 | + "remark": "", | |
| 162 | + "add_time": "2022-01-07T03:10:23.532Z", | |
| 163 | + "update_time": "2022-01-07T03:10:23.532Z", | |
| 164 | + "status": 0 | |
| 165 | + }, | |
| 166 | + // 用户信息 | |
| 167 | + userlist: [], | |
| 168 | + } | |
| 169 | + }, | |
| 170 | + created() { | |
| 171 | + this.ShowRecordList() | |
| 172 | + this.ShowUserList() | |
| 173 | + }, | |
| 174 | + methods: { | |
| 175 | + onSubmit() { | |
| 176 | + this.ShowUserList() | |
| 177 | + }, | |
| 178 | + Pages(e){ | |
| 179 | + this.recordmodel.pageIndex=e | |
| 180 | + this.ShowRecordList() | |
| 181 | + }, | |
| 182 | + // 删除领取记录 | |
| 183 | + Delinfo(id){ | |
| 184 | + DelRecord(id).then(res=>{ | |
| 185 | + console.log('Shanchu',res) | |
| 186 | + if(res.data.code==200){ | |
| 187 | + this.$message.success('删除成功') | |
| 188 | + this.ShowRecordList() | |
| 189 | + }else{ | |
| 190 | + this.$message.error('删除失败') | |
| 191 | + } | |
| 192 | + }) | |
| 193 | + }, | |
| 194 | + // 提交新增或者修改 | |
| 195 | + Submits() { | |
| 196 | + this.$refs.recordAddUpdModel.validate((valid)=>{ | |
| 197 | + if(valid){ | |
| 198 | + AddOrUpdateRecord(this.recordAddUpdModel).then(res=>{ | |
| 199 | + console.log('res返沪',res) | |
| 200 | + if(res.data.code==200){ | |
| 201 | + this.$message.success('操作') | |
| 202 | + this.ShowRecordList() | |
| 203 | + this.dialogVisible=false | |
| 204 | + }else{ | |
| 205 | + this.$message.error('操作失败') | |
| 206 | + } | |
| 207 | + this.recordAddUpdModel.id = 0 | |
| 208 | + this.recordAddUpdModel.getUser = 0 | |
| 209 | + this.recordAddUpdModel.getNum = 0 | |
| 210 | + this.recordAddUpdModel.remark = '' | |
| 211 | + this.recordAddUpdModel.status = 0 | |
| 212 | + }) | |
| 213 | + } | |
| 214 | + }) | |
| 215 | + }, | |
| 216 | + // 查询所有用户 | |
| 217 | + ShowUserList() { | |
| 218 | + GetUserList(this.model).then(res => { | |
| 219 | + console.log('res', res) | |
| 220 | + this.userlist = res.data.data | |
| 221 | + }) | |
| 222 | + }, | |
| 223 | + // 新增修改 | |
| 224 | + AddOrUpdRecord(obj) { | |
| 225 | + this.dialogVisible = true | |
| 226 | + if (obj == null) { | |
| 227 | + // 新增 | |
| 228 | + this.recordAddUpdModel.id = 0 | |
| 229 | + this.recordAddUpdModel.getUser = 0 | |
| 230 | + this.recordAddUpdModel.getNum = 0 | |
| 231 | + this.recordAddUpdModel.remark = '' | |
| 232 | + this.recordAddUpdModel.status = 0 | |
| 233 | + } else { | |
| 234 | + // 修改 | |
| 235 | + this.recordAddUpdModel.id = obj.id | |
| 236 | + this.recordAddUpdModel.getUser = obj.getUser | |
| 237 | + this.recordAddUpdModel.getNum = obj.getNum | |
| 238 | + this.recordAddUpdModel.remark = obj.remark | |
| 239 | + this.recordAddUpdModel.status = obj.status | |
| 240 | + } | |
| 241 | + }, | |
| 242 | + // 查询所有领取记录 | |
| 243 | + ShowRecordList() { | |
| 244 | + GetRecordList(this.recordmodel).then(res => { | |
| 245 | + console.log('res', res) | |
| 246 | + res.data.data.rows.forEach((item, index) => { | |
| 247 | + item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd") | |
| 248 | + item.update_time = utils.formatTime(item.update_time, "yyyy-MM-dd") | |
| 249 | + }) | |
| 250 | + this.tableData = res.data.data.rows | |
| 251 | + this.recordmodel.TotalCount = res.data.data.total | |
| 252 | + }) | |
| 253 | + } | |
| 254 | + } | |
| 255 | + } | |
| 256 | +</script> | |
| 257 | + | |
| 258 | +<style> | |
| 259 | +</style> | ... | ... |
src/views/system/calendar.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="app" class="app-container"> | |
| 3 | + <div style="width: 1000px;margin: auto;"> | |
| 4 | + <el-button type="success" @click="AddYuYue" style="padding-top: 10px;">添加时间</el-button> | |
| 5 | + <el-button type="primary" @click="UpdYuYue" style="padding-top: 10px;">满员修改</el-button> | |
| 6 | + <el-calendar > | |
| 7 | + <template slot="dateCell" slot-scope="{date, data}" style="padding: 0px;"> | |
| 8 | + <div class="CalenDiv" :class="currentCount(data)>0?'IsSelectDay':'IsNoDay'"> | |
| 9 | + <p class="DataTimeString">{{ data.day.split('-').slice(1).join('-') }}</p> | |
| 10 | + <p class="NumberString">预约名额<label | |
| 11 | + style="margin-left: 10px;font-weight: bold;">{{currentCount(data)}}</label></p> | |
| 12 | + </div> | |
| 13 | + </template> | |
| 14 | + </el-calendar> | |
| 15 | + </div> | |
| 16 | + <el-dialog title="新增" :visible.sync="dialogVisible" width="50%"> | |
| 17 | + <el-form ref="form" :model="form" label-width="80px" :rules="ruleform"> | |
| 18 | + <el-form-item label="可预约人数" prop="ReservedPlaces"> | |
| 19 | + <el-input v-model="form.ReservedPlaces" placeholder="设置预约人数"></el-input> | |
| 20 | + </el-form-item> | |
| 21 | + <el-form-item label="开始预约" prop="TimeOfAppointmentStart"> | |
| 22 | + <el-date-picker type="date" placeholder="选择日期" v-model="form.TimeOfAppointmentStart" | |
| 23 | + style="width: 100%;"></el-date-picker> | |
| 24 | + </el-form-item> | |
| 25 | + <el-form-item label="至" prop="TimeOfAppointmentEnd"> | |
| 26 | + <el-date-picker type="date" placeholder="选择日期" v-model="form.TimeOfAppointmentEnd" | |
| 27 | + style="width: 100%;" ></el-date-picker> | |
| 28 | + </el-form-item> | |
| 29 | + </el-form> | |
| 30 | + <span slot="footer" class="dialog-footer"> | |
| 31 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 32 | + <el-button type="primary" @click="SubmitAdd">确 定</el-button> | |
| 33 | + </span> | |
| 34 | + </el-dialog> | |
| 35 | + <el-dialog title="修改" :visible.sync="dialogVisibleU" width="50%"> | |
| 36 | + <el-form ref="updform" :model="updform" label-width="80px" :rules="ruleformU"> | |
| 37 | + <el-form-item label="可预约人数" prop="ReservedPlaces"> | |
| 38 | + <el-input v-model="updform.ReservedPlaces" placeholder="设置预约人数"></el-input> | |
| 39 | + </el-form-item> | |
| 40 | + <el-form-item label="预约日期" prop="TimeOfAppointment"> | |
| 41 | + <el-date-picker type="date" placeholder="选择日期" v-model="updform.TimeOfAppointment" | |
| 42 | + style="width: 100%;" ></el-date-picker> | |
| 43 | + </el-form-item> | |
| 44 | + </el-form> | |
| 45 | + <span slot="footer" class="dialog-footer"> | |
| 46 | + <el-button @click="dialogVisibleU = false">取 消</el-button> | |
| 47 | + <el-button type="primary" @click="SubmitUpd">确 定</el-button> | |
| 48 | + </span> | |
| 49 | + </el-dialog> | |
| 50 | + </div> | |
| 51 | +</template> | |
| 52 | + | |
| 53 | +<script> | |
| 54 | + import { | |
| 55 | + ReservationSettingsList, | |
| 56 | + SettingReservation, | |
| 57 | + UpadteReservation, | |
| 58 | + } from '../../api/ReservationSettings.js' | |
| 59 | + import utils from '../../utils/utils.js' | |
| 60 | + import { | |
| 61 | + parseTime | |
| 62 | + } from '../../utils/index.js' | |
| 63 | + export default { | |
| 64 | + data() { | |
| 65 | + return { | |
| 66 | + dialogVisibleU: false, | |
| 67 | + dialogVisible: false, | |
| 68 | + model: { | |
| 69 | + pageIndex: 1, | |
| 70 | + pageSize: 20, | |
| 71 | + sort: '', | |
| 72 | + sortOrder: '', | |
| 73 | + keyword: '', | |
| 74 | + | |
| 75 | + }, | |
| 76 | + yuyue: [], | |
| 77 | + // 添加预约时间 | |
| 78 | + form: { | |
| 79 | + "TimeOfAppointmentStart": '', | |
| 80 | + "TimeOfAppointmentEnd": '', | |
| 81 | + "ReservedPlaces": 0 | |
| 82 | + }, | |
| 83 | + // 修改预约时间 | |
| 84 | + updform: { | |
| 85 | + "id": 0, | |
| 86 | + "TimeOfAppointment": "", | |
| 87 | + "ReservedPlaces": 0 | |
| 88 | + }, | |
| 89 | + ruleformU: { | |
| 90 | + ReservedPlaces: [{ | |
| 91 | + required: true, | |
| 92 | + message: '请设置预约名额', | |
| 93 | + trigger: 'blur' | |
| 94 | + }, | |
| 95 | + { | |
| 96 | + pattern: /^[0-9]\d*$/, | |
| 97 | + message: '不允许输入整数以外的值' | |
| 98 | + }, | |
| 99 | + ], | |
| 100 | + TimeOfAppointment: [{ | |
| 101 | + type: 'date', | |
| 102 | + required: true, | |
| 103 | + message: '请选择预约日期', | |
| 104 | + trigger: 'change' | |
| 105 | + }], | |
| 106 | + | |
| 107 | + }, | |
| 108 | + ruleform: { | |
| 109 | + ReservedPlaces: [{ | |
| 110 | + required: true, | |
| 111 | + message: '请设置预约名额', | |
| 112 | + trigger: 'blur' | |
| 113 | + }, | |
| 114 | + { | |
| 115 | + pattern: /^[0-9]\d*$/, | |
| 116 | + message: '不允许输入整数以外的值' | |
| 117 | + }, | |
| 118 | + ], | |
| 119 | + TimeOfAppointmentStart: [{ | |
| 120 | + type: 'date', | |
| 121 | + required: true, | |
| 122 | + message: '请选择开始预约日期', | |
| 123 | + trigger: 'change' | |
| 124 | + }], | |
| 125 | + TimeOfAppointmentEnd: [{ | |
| 126 | + type: 'date', | |
| 127 | + required: true, | |
| 128 | + message: '请选择结束预约日期', | |
| 129 | + trigger: 'change' | |
| 130 | + }], | |
| 131 | + }, | |
| 132 | + } | |
| 133 | + }, | |
| 134 | + created() { | |
| 135 | + this.ShowYuYue() | |
| 136 | + // this.updform.TimeOfAppointment=utls.formatTime(new Date(),"yyyy-MM-dd") | |
| 137 | + }, | |
| 138 | + computed: { | |
| 139 | + currentCount() { | |
| 140 | + return (data) => { | |
| 141 | + let yuyue = this.yuyue; | |
| 142 | + let item = yuyue.find(t => t.TimeOfAppointment == data.day); | |
| 143 | + if (item) { | |
| 144 | + return item.ReservedPlaces | |
| 145 | + } else { | |
| 146 | + return '0'; | |
| 147 | + } | |
| 148 | + } | |
| 149 | + } | |
| 150 | + }, | |
| 151 | + methods: { | |
| 152 | + // 提交新增预约时间 | |
| 153 | + SubmitAdd() { | |
| 154 | + console.log('时间',this.form.TimeOfAppointmentStart) | |
| 155 | + console.log('form',this.form) | |
| 156 | + this.$refs.form.validate((valid) => { | |
| 157 | + if (valid) { | |
| 158 | + SettingReservation(this.form).then(res => { | |
| 159 | + console.log('添加', res) | |
| 160 | + if (res.data.code == 200) { | |
| 161 | + this.$message.success('新增预约时间成功') | |
| 162 | + this.ShowYuYue() | |
| 163 | + this.dialogVisible = false | |
| 164 | + } else { | |
| 165 | + this.$message.error(res.data.message) | |
| 166 | + } | |
| 167 | + }) | |
| 168 | + } | |
| 169 | + }) | |
| 170 | + }, | |
| 171 | + // 提交修改预约时间 | |
| 172 | + SubmitUpd() { | |
| 173 | + this.$refs.updform.validate((valid) => { | |
| 174 | + if (valid) { | |
| 175 | + UpadteReservation(this.updform).then(res => { | |
| 176 | + console.log('添加', res) | |
| 177 | + if (res.data.code == 200) { | |
| 178 | + this.$message.success('修改预约时间成功') | |
| 179 | + this.ShowYuYue() | |
| 180 | + this.dialogVisibleU = false | |
| 181 | + } else { | |
| 182 | + this.$message.error('预约时间不存在,无法进行设置') | |
| 183 | + } | |
| 184 | + }) | |
| 185 | + } | |
| 186 | + }) | |
| 187 | + }, | |
| 188 | + // 添加预约时间 | |
| 189 | + AddYuYue() { | |
| 190 | + this.dialogVisible = true | |
| 191 | + // SettingReservation(this.form).then(res => { | |
| 192 | + // console.log('ceshi', res) | |
| 193 | + // }) | |
| 194 | + }, | |
| 195 | + // 修改预约时间 | |
| 196 | + UpdYuYue() { | |
| 197 | + this.dialogVisibleU = true | |
| 198 | + }, | |
| 199 | + // 查询可预约数据 | |
| 200 | + ShowYuYue() { | |
| 201 | + ReservationSettingsList(this.model).then(res => { | |
| 202 | + console.log('yuyue', res) | |
| 203 | + res.data.data.forEach((item, index) => { | |
| 204 | + item.TimeOfAppointment = utils.formatTime(item.TimeOfAppointment, "yyyy-MM-dd") | |
| 205 | + }) | |
| 206 | + this.yuyue = res.data.data | |
| 207 | + console.log('预约时间', this.yuyue) | |
| 208 | + }) | |
| 209 | + } | |
| 210 | + } | |
| 211 | + } | |
| 212 | +</script> | |
| 213 | + | |
| 214 | +<style less scoped="scoped"> | |
| 215 | + /deep/.el-calendar__title { | |
| 216 | + font-size: 20px; | |
| 217 | + font-weight: bold; | |
| 218 | + } | |
| 219 | + | |
| 220 | + /deep/.el-calendar { | |
| 221 | + background-color: #f2f2f2; | |
| 222 | + box-shadow: 0 0 15px #CDCDCD; | |
| 223 | + border-radius: 10px; | |
| 224 | + } | |
| 225 | + | |
| 226 | + /deep/.el-calendar-day { | |
| 227 | + padding: 0px !important; | |
| 228 | + } | |
| 229 | + | |
| 230 | + /deep/.prev .IsNoDay, | |
| 231 | + .next .IsNoDay { | |
| 232 | + background: #8080805c !important; | |
| 233 | + box-shadow: 0 0 0px #808080 !important; | |
| 234 | + } | |
| 235 | + | |
| 236 | + .CalenDiv { | |
| 237 | + height: calc(100% - 10px); | |
| 238 | + padding: 10px; | |
| 239 | + margin: 10px; | |
| 240 | + box-shadow: 0 0 10px #000; | |
| 241 | + color: #FFF; | |
| 242 | + border-radius: 10px; | |
| 243 | + } | |
| 244 | + | |
| 245 | + .CalenDiv p { | |
| 246 | + margin: 0px; | |
| 247 | + } | |
| 248 | + | |
| 249 | + .DataTimeString { | |
| 250 | + font-size: 22px; | |
| 251 | + font-weight: bold; | |
| 252 | + } | |
| 253 | + | |
| 254 | + .NumberString { | |
| 255 | + font-size: 16px; | |
| 256 | + padding-top: 10px; | |
| 257 | + } | |
| 258 | + | |
| 259 | + .IsSelectDay { | |
| 260 | + background: #27940b !important; | |
| 261 | + } | |
| 262 | + | |
| 263 | + .IsNoDay { | |
| 264 | + background: #94918d !important; | |
| 265 | + } | |
| 266 | +</style> | ... | ... |
src/views/system/deduct.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <!-- 当前费率展示 --> | |
| 4 | + <el-form ref="model" :model="model" label-width="120px" :rules="rules"> | |
| 5 | + <el-form-item label="专员提成金额" prop="CommissionMoney"> | |
| 6 | + <el-input v-model="model.CommissionMoney" placeholder="请输入专员提成金额" ref="CommissionMoney" maxlength="10" @blur="ChangeMoney"> | |
| 7 | + <template slot="append">元</template> | |
| 8 | + </el-input> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="经理提成金额" prop="ManagerMoney"> | |
| 11 | + <el-input v-model="model.ManagerMoney" placeholder="请输入经理提成金额" ref="ManagerMoney" maxlength="10" @blur="ChangeMoney"> | |
| 12 | + <template slot="append">元</template> | |
| 13 | + </el-input> | |
| 14 | + </el-form-item> | |
| 15 | + <el-form-item label="独享金额" > | |
| 16 | + <el-input v-model="Dmoney" placeholder="独享金额" maxlength="10" disabled> | |
| 17 | + <template slot="append">元</template> | |
| 18 | + </el-input> | |
| 19 | + </el-form-item> | |
| 20 | + </el-form> | |
| 21 | + <el-button type="success" @click="Submit" style="margin-left: 40px;">确认更改</el-button> | |
| 22 | + </div> | |
| 23 | +</template> | |
| 24 | + | |
| 25 | +<script> | |
| 26 | + import { | |
| 27 | + UpdateCalculation, | |
| 28 | + GetModelCalculation | |
| 29 | + } from '../../api/calculation.js' | |
| 30 | + export default { | |
| 31 | + data() { | |
| 32 | + return { | |
| 33 | + size: '', | |
| 34 | + rules: { | |
| 35 | + ManagerMoney: [{ | |
| 36 | + required: true, | |
| 37 | + message: '请输入经理提成', | |
| 38 | + trigger: 'blur' | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + pattern: /^\d+(\.\d+)?$/, | |
| 42 | + message: '请输入金额' | |
| 43 | + } | |
| 44 | + ], | |
| 45 | + CommissionMoney: [{ | |
| 46 | + required: true, | |
| 47 | + message: '请输入专员提成', | |
| 48 | + trigger: 'blur' | |
| 49 | + }, | |
| 50 | + { | |
| 51 | + pattern: /^\d+(\.\d+)?$/, | |
| 52 | + message: '请输入金额' | |
| 53 | + } | |
| 54 | + ] | |
| 55 | + }, | |
| 56 | + model: { | |
| 57 | + "id": 0, | |
| 58 | + "CommissionMoney": 0, | |
| 59 | + "ManagerMoney": 0, | |
| 60 | + "add_time": "2022-01-08T21:37:09.691Z", | |
| 61 | + "update_time": "2022-01-08T21:37:09.691Z", | |
| 62 | + "status": 0 | |
| 63 | + }, | |
| 64 | + Dmoney:0, | |
| 65 | + form: { | |
| 66 | + "KeyWord": "", | |
| 67 | + "TotalCount": 0, | |
| 68 | + "PageIndex": 1, | |
| 69 | + "PageSize": 1, | |
| 70 | + "Sort": [{ | |
| 71 | + "Field": "", | |
| 72 | + "Type": 0 | |
| 73 | + }] | |
| 74 | + } | |
| 75 | + } | |
| 76 | + }, | |
| 77 | + created() { | |
| 78 | + this.GetMoney() | |
| 79 | + }, | |
| 80 | + methods: { | |
| 81 | + ChangeMoney(){ | |
| 82 | + this.Dmoney=parseInt(this.model.CommissionMoney)+parseInt(this.model.ManagerMoney) | |
| 83 | + }, | |
| 84 | + // 查询当前费率标准 | |
| 85 | + GetMoney() { | |
| 86 | + GetModelCalculation(this.form).then(res=>{ | |
| 87 | + this.model.CommissionMoney=res.data.data.rows[0].CommissionMoney | |
| 88 | + this.model.ManagerMoney=res.data.data.rows[0].ManagerMoney | |
| 89 | + this.Dmoney=this.model.CommissionMoney+this.model.ManagerMoney | |
| 90 | + }) | |
| 91 | + }, | |
| 92 | + // 确认更改提成费用 | |
| 93 | + Submit() { | |
| 94 | + this.$refs.model.validate((valid) => { | |
| 95 | + if (valid) { | |
| 96 | + UpdateCalculation(this.model).then(res => { | |
| 97 | + console.log('修改数据', res) | |
| 98 | + if (res.data.code == 200) { | |
| 99 | + this.$message.success('更改提成费率成功') | |
| 100 | + } else { | |
| 101 | + this.$message.error('更改失败,请重试') | |
| 102 | + } | |
| 103 | + }) | |
| 104 | + } | |
| 105 | + }) | |
| 106 | + } | |
| 107 | + } | |
| 108 | + } | |
| 109 | +</script> | |
| 110 | + | |
| 111 | +<style> | |
| 112 | + .container { | |
| 113 | + width: 100%; | |
| 114 | + } | |
| 115 | +</style> | ... | ... |
src/views/system/introduce.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container"> | |
| 3 | + <quill-editor ref="myQuillEditor" class="editor" :options="editorOption" v-model="model.richtext" style="height: 500px;"/> | |
| 4 | + <el-button type="primary" @click="BtnClick" style=" margin:50px 0px 10px 10px">发布介绍</el-button> | |
| 5 | + </div> | |
| 6 | +</template> | |
| 7 | + | |
| 8 | +<script> | |
| 9 | + // 工具栏配置 | |
| 10 | + const toolbarOptions = [ | |
| 11 | + ['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线 | |
| 12 | + ['blockquote', 'code-block'], // 引用 代码块 | |
| 13 | + [{ | |
| 14 | + header: 1 | |
| 15 | + }, { | |
| 16 | + header: 2 | |
| 17 | + }], // 1、2 级标题 | |
| 18 | + [{ | |
| 19 | + list: 'ordered' | |
| 20 | + }, { | |
| 21 | + list: 'bullet' | |
| 22 | + }], // 有序、无序列表 | |
| 23 | + [{ | |
| 24 | + script: 'sub' | |
| 25 | + }, { | |
| 26 | + script: 'super' | |
| 27 | + }], // 上标/下标 | |
| 28 | + [{ | |
| 29 | + indent: '-1' | |
| 30 | + }, { | |
| 31 | + indent: '+1' | |
| 32 | + }], // 缩进 | |
| 33 | + // [{'direction': 'rtl'}], // 文本方向 | |
| 34 | + [{ | |
| 35 | + size: ['small', false, 'large', 'huge'] | |
| 36 | + }], // 字体大小 | |
| 37 | + [{ | |
| 38 | + header: [1, 2, 3, 4, 5, 6, false] | |
| 39 | + }], // 标题 | |
| 40 | + [{ | |
| 41 | + color: [] | |
| 42 | + }, { | |
| 43 | + background: [] | |
| 44 | + }], // 字体颜色、字体背景颜色 | |
| 45 | + [{ | |
| 46 | + font: [] | |
| 47 | + }], // 字体种类 | |
| 48 | + [{ | |
| 49 | + align: [] | |
| 50 | + }], // 对齐方式 | |
| 51 | + ['clean'], // 清除文本格式 | |
| 52 | + // ['link', 'image', 'video'] // 链接、图片、视频 | |
| 53 | + ['link', 'image', 'video'] // 链接、图片 | |
| 54 | + ] | |
| 55 | + import { | |
| 56 | + AddOrUpdRichTextduce, | |
| 57 | + DelRichTextduce, | |
| 58 | + GetListRichTextduce | |
| 59 | + } from '../../api/Introduce.js' | |
| 60 | + export default { | |
| 61 | + data() { | |
| 62 | + return { | |
| 63 | + editorOption: { // 编辑框操作事件 | |
| 64 | + theme: 'snow', // or 'bubble' | |
| 65 | + placeholder: '您想发布点什么?', | |
| 66 | + modules: { | |
| 67 | + toolbar: { | |
| 68 | + container: toolbarOptions, | |
| 69 | + | |
| 70 | + } | |
| 71 | + } | |
| 72 | + }, | |
| 73 | + model: { | |
| 74 | + "id": 0, | |
| 75 | + "richtext": "", | |
| 76 | + "add_time": "2022-01-05T08:49:51.139Z", | |
| 77 | + "update_time": "2022-01-05T08:49:51.139Z", | |
| 78 | + "status": 0 | |
| 79 | + } | |
| 80 | + } | |
| 81 | + }, | |
| 82 | + created() { | |
| 83 | + | |
| 84 | + }, | |
| 85 | + methods: { | |
| 86 | + BtnClick() { | |
| 87 | + if (this.model.richtext == '') { | |
| 88 | + this.$message.error('请输入内容') | |
| 89 | + } else { | |
| 90 | + AddOrUpdRichTextduce(this.model).then(res => { | |
| 91 | + console.log('res', res) | |
| 92 | + if(res.data.code==200){ | |
| 93 | + this.$message.success('发布成功') | |
| 94 | + this.model.richtext='' | |
| 95 | + }else{ | |
| 96 | + this.$message.error('发布失败') | |
| 97 | + } | |
| 98 | + }) | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + } | |
| 103 | + } | |
| 104 | +</script> | |
| 105 | + | |
| 106 | +<style> | |
| 107 | +</style> | ... | ... |
src/views/system/map.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="app"> | |
| 3 | + | |
| 4 | + <div style="width:100%;height: calc(100vh - 50px);display: flex;flex-direction: column;"> | |
| 5 | + <div id="container"></div> | |
| 6 | + <div id="toolControl"> | |
| 7 | + <div class="toolItem active" id="marker" title="默认"></div> | |
| 8 | + <div class="toolItem" id="polyline" title="����" style="display: none;"></div> | |
| 9 | + <div class="toolItem" id="polygon" title="选择区域"></div> | |
| 10 | + <div class="toolItem" id="circle" title="Բ��" style="display: none;"></div> | |
| 11 | + <div class="toolItem" id="rectangle" title="����" style="display: none;"></div> | |
| 12 | + <div class="toolItem" id="ellipse" title="��Բ" style="display: none;"></div> | |
| 13 | + </div> | |
| 14 | + <div style="width: 300px;background: #EEEEEE;position: absolute;z-index: 99999;top: 10px;left:10px"> | |
| 15 | + <ul class="AreaList" v-for="(item,i) in datalist"> | |
| 16 | + <li><label class="el-icon-position"></label>{{item.RegionName}}<label | |
| 17 | + class="el-icon-delete delClass" @click="ReservationAreaDeleteHeadler(item.id,i)"></label> | |
| 18 | + </li> | |
| 19 | + </ul> | |
| 20 | + </div> | |
| 21 | + </div> | |
| 22 | + <el-dialog title="请为该区域命名" :visible.sync="dialogAreaVisible" width="400px" :close-on-click-modal="false"> | |
| 23 | + <el-input v-model="ReservationAreaInfo.RegionName" placeholder="请输入区域名称"></el-input> | |
| 24 | + <el-button @click="AddReservationAreaInfo()" style="float: right;margin-top: 10px;">确定</el-button> | |
| 25 | + <div style="clear: both;"></div> | |
| 26 | + </el-dialog> | |
| 27 | + </div> | |
| 28 | +</template> | |
| 29 | +<script> | |
| 30 | + import { | |
| 31 | + AddReservationArea, | |
| 32 | + ReservationAreaList, | |
| 33 | + ReservationAreaDelete | |
| 34 | + } from '@/api/ReservationArea' | |
| 35 | + export default { | |
| 36 | + data() { | |
| 37 | + return { | |
| 38 | + activeType: "marker", | |
| 39 | + dialogAreaVisible: false, | |
| 40 | + datalist: [{ | |
| 41 | + RegionName: "", | |
| 42 | + Region: "", | |
| 43 | + State: 1 | |
| 44 | + }], | |
| 45 | + ReservationAreaInfo: { | |
| 46 | + RegionName: "", | |
| 47 | + Region: "", | |
| 48 | + State: 1 | |
| 49 | + }, | |
| 50 | + parameter: { | |
| 51 | + pageIndex: 1, | |
| 52 | + pageSize: 30, | |
| 53 | + sort: "id", | |
| 54 | + sortOrder: 1, | |
| 55 | + keyword: "", | |
| 56 | + status: 1 | |
| 57 | + }, | |
| 58 | + map: '', | |
| 59 | + polygon: null | |
| 60 | + } | |
| 61 | + }, | |
| 62 | + | |
| 63 | + created() {}, | |
| 64 | + mounted() { | |
| 65 | + this.initMap(); | |
| 66 | + }, | |
| 67 | + methods: { | |
| 68 | + ReservationAreaDeleteHeadler(id, index) { | |
| 69 | + this.$confirm('确定移除该区域?', '消息', { | |
| 70 | + confirmButtonText: '确认', | |
| 71 | + cancelButtonText: '取消', | |
| 72 | + callback: (action) => { | |
| 73 | + if (action == "confirm") { | |
| 74 | + var MapId = "P" + id; | |
| 75 | + ReservationAreaDelete(id).then(res => { | |
| 76 | + if (res.data.code == 200) { | |
| 77 | + this.datalist.splice(index, 1); | |
| 78 | + this.polygon.remove([MapId]); | |
| 79 | + } | |
| 80 | + }); | |
| 81 | + } | |
| 82 | + }, | |
| 83 | + }) | |
| 84 | + }, | |
| 85 | + ReservationAreaList(map, center) { | |
| 86 | + //多边形轮廓点串(LatLng数组) | |
| 87 | + let geometriesInfo = []; | |
| 88 | + let that = this; | |
| 89 | + ReservationAreaList(this.parameter).then(res => { | |
| 90 | + var center = new window.TMap.LatLng(30.65787, 104.06584) | |
| 91 | + this.datalist = res.data.data; | |
| 92 | + this.datalist.forEach(function(item, i) { | |
| 93 | + var path = []; | |
| 94 | + var RegionList = JSON.parse(item.Region); | |
| 95 | + RegionList.forEach(function(Ritem) { | |
| 96 | + path.push(new window.TMap.LatLng(Ritem.lat, Ritem.lng)) | |
| 97 | + }) | |
| 98 | + geometriesInfo.push({ | |
| 99 | + 'id': 'P' + item.id, //该多边形在图层中的唯一标识(删除、更新数据时需要) | |
| 100 | + 'styleId': 'polygon', //绑定样式名 | |
| 101 | + 'paths': path, //多边形轮廓 | |
| 102 | + }); | |
| 103 | + }); | |
| 104 | + console.log('geometriesInfo', geometriesInfo); | |
| 105 | + let polygon = new window.TMap.MultiPolygon({ | |
| 106 | + id: 'polygon-layer', //图层id | |
| 107 | + map: map, //设置多边形图层显示到哪个地图实例中 | |
| 108 | + //多边形样式 | |
| 109 | + styles: { | |
| 110 | + 'polygon': new TMap.PolygonStyle({ | |
| 111 | + 'color': 'rgba(0,125,255,0.3)', //面填充色 | |
| 112 | + 'showBorder': false, //是否显示拔起面的边线 | |
| 113 | + 'borderColor': '#00FFFF' //边线颜色 | |
| 114 | + }) | |
| 115 | + }, | |
| 116 | + //多边形数据 | |
| 117 | + geometries: geometriesInfo | |
| 118 | + }); | |
| 119 | + console.log('polygon', polygon); | |
| 120 | + that.polygon = polygon; | |
| 121 | + console.log('wanggeshabi', this.polygon); | |
| 122 | + }); | |
| 123 | + }, | |
| 124 | + AddReservationAreaInfo() { | |
| 125 | + if (this.ReservationAreaInfo.RegionName == "") { | |
| 126 | + this.$message('区域名称不能为空'); | |
| 127 | + } else { | |
| 128 | + AddReservationArea(this.ReservationAreaInfo).then(res => { | |
| 129 | + if (res.data.code == 200) { | |
| 130 | + this.$confirm('添加区域成功', '消息', { | |
| 131 | + confirmButtonText: '确认', | |
| 132 | + cancelButtonText: '取消', | |
| 133 | + callback: (action) => { | |
| 134 | + this.initMap(); | |
| 135 | + this.dialogAreaVisible = false; | |
| 136 | + }, | |
| 137 | + }) | |
| 138 | + } | |
| 139 | + }); | |
| 140 | + } | |
| 141 | + }, | |
| 142 | + initMap() { | |
| 143 | + let _this = this; | |
| 144 | + document.getElementById('toolControl').addEventListener('click', (e) => { | |
| 145 | + var id = e.target.id; | |
| 146 | + if (id !== 'toolControl') { | |
| 147 | + document.getElementById(this.activeType).className = 'toolItem'; | |
| 148 | + document.getElementById(id).className = 'toolItem active'; | |
| 149 | + this.activeType = id; | |
| 150 | + editor.setActiveOverlay(id); | |
| 151 | + } | |
| 152 | + }); | |
| 153 | + var center = new window.TMap.LatLng(30.65787, 104.06584) | |
| 154 | + // 定义map变量,调用 TMap.Map() 构造函数创建地图 | |
| 155 | + var map = new window.TMap.Map(document.getElementById("container"), { | |
| 156 | + center: center, // 设置地图中心点坐标 | |
| 157 | + zoom: 13 // 设置地图缩放级别 | |
| 158 | + }); | |
| 159 | + this.map = map; | |
| 160 | + this.ReservationAreaList(map, center); | |
| 161 | + | |
| 162 | + var editor = new window.TMap.tools.GeometryEditor({ | |
| 163 | + // TMap.tools.GeometryEditor �ĵ���ַ��https://lbs.qq.com/webApi/javascriptGL/glDoc/glDocEditor | |
| 164 | + map: map, // �༭���ĵ�ͼ���� | |
| 165 | + overlayList: [ | |
| 166 | + // �ɱ༭ͼ�� �ĵ���ַ��https://lbs.qq.com/webApi/javascriptGL/glDoc/glDocEditor#4 | |
| 167 | + { | |
| 168 | + overlay: new window.TMap.MultiMarker({ | |
| 169 | + map: map, | |
| 170 | + }), | |
| 171 | + id: 'marker', | |
| 172 | + }, | |
| 173 | + { | |
| 174 | + overlay: new window.TMap.MultiPolyline({ | |
| 175 | + map: map, | |
| 176 | + }), | |
| 177 | + id: 'polyline', | |
| 178 | + }, | |
| 179 | + { | |
| 180 | + overlay: new window.TMap.MultiPolygon({ | |
| 181 | + map: map, | |
| 182 | + }), | |
| 183 | + id: 'polygon', | |
| 184 | + }, | |
| 185 | + { | |
| 186 | + overlay: new window.TMap.MultiCircle({ | |
| 187 | + map: map, | |
| 188 | + }), | |
| 189 | + id: 'circle', | |
| 190 | + }, | |
| 191 | + { | |
| 192 | + overlay: new window.TMap.MultiRectangle({ | |
| 193 | + map: map, | |
| 194 | + }), | |
| 195 | + id: 'rectangle', | |
| 196 | + }, | |
| 197 | + { | |
| 198 | + overlay: new window.TMap.MultiEllipse({ | |
| 199 | + map: map, | |
| 200 | + }), | |
| 201 | + id: 'ellipse', | |
| 202 | + }, | |
| 203 | + ], | |
| 204 | + actionMode: window.TMap.tools.constants.EDITOR_ACTION.DRAW, // | |
| 205 | + activeOverlayId: 'marker', // | |
| 206 | + snappable: true, // | |
| 207 | + }); | |
| 208 | + | |
| 209 | + editor.on('draw_complete', (geometry) => { | |
| 210 | + console.log(geometry); | |
| 211 | + if (geometry.paths != undefined) { | |
| 212 | + _this.ReservationAreaInfo.Region = JSON.stringify(geometry.paths); | |
| 213 | + _this.dialogAreaVisible = true; | |
| 214 | + } | |
| 215 | + | |
| 216 | + // console.log(geometry[0]) | |
| 217 | + }); | |
| 218 | + } | |
| 219 | + } | |
| 220 | + } | |
| 221 | +</script> | |
| 222 | + | |
| 223 | +<style> | |
| 224 | + #container { | |
| 225 | + width: 100%; | |
| 226 | + display: flex; | |
| 227 | + flex: 1; | |
| 228 | + } | |
| 229 | + #marker { | |
| 230 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_editor.png'); | |
| 231 | + } | |
| 232 | + #polyline { | |
| 233 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/polyline.png'); | |
| 234 | + } | |
| 235 | + #polygon { | |
| 236 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/polygon.png'); | |
| 237 | + } | |
| 238 | + #circle { | |
| 239 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/circle.png'); | |
| 240 | + } | |
| 241 | + #rectangle { | |
| 242 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/rectangle.png'); | |
| 243 | + } | |
| 244 | + #ellipse { | |
| 245 | + background-image: url('https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/ellipse.png'); | |
| 246 | + } | |
| 247 | + #toolControl { | |
| 248 | + position: absolute; | |
| 249 | + top: 10px; | |
| 250 | + left: 0px; | |
| 251 | + right: 0px; | |
| 252 | + margin: auto; | |
| 253 | + width: 110px; | |
| 254 | + z-index: 1001; | |
| 255 | + } | |
| 256 | + .toolItem { | |
| 257 | + width: 50px; | |
| 258 | + height: 50px; | |
| 259 | + float: left; | |
| 260 | + margin: 1px; | |
| 261 | + padding: 4px; | |
| 262 | + border-radius: 3px; | |
| 263 | + background-size: 40px 40px; | |
| 264 | + background-position: 4px 4px; | |
| 265 | + background-repeat: no-repeat; | |
| 266 | + box-shadow: 0 1px 2px 0 #e4e7ef; | |
| 267 | + background-color: #ffffff; | |
| 268 | + border: 1px solid #ffffff; | |
| 269 | + } | |
| 270 | + .toolItem:hover { | |
| 271 | + border-color: #789cff; | |
| 272 | + } | |
| 273 | + .active { | |
| 274 | + border-color: #d5dff2; | |
| 275 | + background-color: #d5dff2; | |
| 276 | + } | |
| 277 | + .AreaList { | |
| 278 | + list-style: none; | |
| 279 | + padding: 0px; | |
| 280 | + margin: 0px; | |
| 281 | + background: none; | |
| 282 | + } | |
| 283 | + .AreaList li { | |
| 284 | + padding: 0 10px; | |
| 285 | + line-height: 40px; | |
| 286 | + height: 40px; | |
| 287 | + font-size: 14px; | |
| 288 | + font-weight: bold; | |
| 289 | + margin-bottom: 10px; | |
| 290 | + border-radius: 5px; | |
| 291 | + background: #304156; | |
| 292 | + color: #fff; | |
| 293 | + box-shadow: 0 0 5px #cdcdcd; | |
| 294 | + } | |
| 295 | + .AreaList li label { | |
| 296 | + margin-right: 10px; | |
| 297 | + } | |
| 298 | + /* .AreaList li:hover { | |
| 299 | + background-color: #409EFF; | |
| 300 | + color: #FFF; | |
| 301 | + } */ | |
| 302 | + .delClass { | |
| 303 | + float: right; | |
| 304 | + line-height: 40px; | |
| 305 | + cursor: pointer; | |
| 306 | + text-align: center; | |
| 307 | + width: 20px; | |
| 308 | + } | |
| 309 | + .delClass:hover { | |
| 310 | + color: #FFF; | |
| 311 | + font-size: 20px; | |
| 312 | + font-weight: bold; | |
| 313 | + text-shadow: 0 0 1px #FFF; | |
| 314 | + } | |
| 315 | +</style> | ... | ... |
src/views/system/meal.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container"> | |
| 3 | + <el-input type="text" placeholder="请输入套餐标题" style="width: 100%;" v-model="model.title" maxlength="15" ref="title"></el-input> | |
| 4 | + <textarea v-model="model.meal" placeholder="请输入套餐内容" | |
| 5 | + style="width: 100%;height: 100px;margin-top: 10px;border: 1px solid #EEEEEE;" ref="meal"></textarea> | |
| 6 | + <el-button type="primary" @click="BtnClick" style=" margin:10px 0px 10px 10px">发布介绍</el-button> | |
| 7 | + </div> | |
| 8 | +</template> | |
| 9 | + | |
| 10 | +<script> | |
| 11 | + import { | |
| 12 | + AddOrUpdRichTextmeal, | |
| 13 | + DelRichTextmeal, | |
| 14 | + GetListRichTextmeal | |
| 15 | + } from '../../api/meal.js' | |
| 16 | + export default { | |
| 17 | + data() { | |
| 18 | + return { | |
| 19 | + | |
| 20 | + model: { | |
| 21 | + "id": 0, | |
| 22 | + "title": "", | |
| 23 | + "meal": "", | |
| 24 | + "add_time": "2022-01-05T10:45:05.324Z", | |
| 25 | + "update_time": "2022-01-05T10:45:05.324Z", | |
| 26 | + "status": 0 | |
| 27 | + } | |
| 28 | + } | |
| 29 | + }, | |
| 30 | + created() { | |
| 31 | + | |
| 32 | + }, | |
| 33 | + methods: { | |
| 34 | + BtnClick() { | |
| 35 | + if (this.model.title == '') { | |
| 36 | + this.$message.error('请输入套餐标题') | |
| 37 | + this.$refs.title.focus() | |
| 38 | + } else if(this.model.meal==''){ | |
| 39 | + this.$message.error('请输入套餐内容') | |
| 40 | + this.$refs.meal.focus() | |
| 41 | + } else{ | |
| 42 | + AddOrUpdRichTextmeal(this.model).then(res => { | |
| 43 | + console.log('res', res) | |
| 44 | + if (res.data.code == 200) { | |
| 45 | + this.$message.success('发布成功') | |
| 46 | + this.model.meal=this.model.title='' | |
| 47 | + } else { | |
| 48 | + this.$message.error('发布失败') | |
| 49 | + } | |
| 50 | + }) | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + } | |
| 55 | + } | |
| 56 | +</script> | |
| 57 | + | |
| 58 | +<style> | |
| 59 | +</style> | ... | ... |
src/views/system/missionNum.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="padding: 10px;"> | |
| 3 | + <!-- 单量设置 --> | |
| 4 | + <div class="header"> | |
| 5 | + <div> | |
| 6 | + <el-row> | |
| 7 | + <el-col :span="1" style="margin-top: 10px;"> | |
| 8 | + <div>经理单量:</div> | |
| 9 | + </el-col> | |
| 10 | + <el-col :span="23"> | |
| 11 | + <div> | |
| 12 | + <el-input v-model="modelnum.managerNum" placeholder="请输入经理单量" :ref="managerNum"></el-input> | |
| 13 | + </div> | |
| 14 | + </el-col> | |
| 15 | + </el-row> | |
| 16 | + </div> | |
| 17 | + <div> | |
| 18 | + <el-row> | |
| 19 | + <el-col :span="1" style="margin-top: 10px;"> | |
| 20 | + <div>专员单量:</div> | |
| 21 | + </el-col> | |
| 22 | + <el-col :span="23"> | |
| 23 | + <div> | |
| 24 | + <el-input v-model="modelnum.commissionerNum" placeholder="请输入专员单量" :ref="commissionerNum"> | |
| 25 | + </el-input> | |
| 26 | + </div> | |
| 27 | + </el-col> | |
| 28 | + </el-row> | |
| 29 | + </div> | |
| 30 | + <div class="btnSubmit" style="text-align: center;"> | |
| 31 | + <el-button type="success" style="width: 100%;" @click="UpdNums">提交</el-button> | |
| 32 | + </div> | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + </div> | |
| 36 | +</template> | |
| 37 | + | |
| 38 | +<script> | |
| 39 | + import { | |
| 40 | + UpdManage, | |
| 41 | + UpdMisser, | |
| 42 | + UpdateNum, | |
| 43 | + GetModelNum, | |
| 44 | + } from '../../api/user.js' | |
| 45 | + export default { | |
| 46 | + data() { | |
| 47 | + return { | |
| 48 | + // nummisser: 0, | |
| 49 | + // nummanager: 0, | |
| 50 | + modelnum: { | |
| 51 | + "id": 0, | |
| 52 | + "managerNum": 0, | |
| 53 | + "commissionerNum": 0, | |
| 54 | + "add_time": "2022-01-30T06:29:14.484Z", | |
| 55 | + "status": 0 | |
| 56 | + }, | |
| 57 | + form: { | |
| 58 | + "KeyWord": "", | |
| 59 | + "TotalCount": 0, | |
| 60 | + "PageIndex": 1, | |
| 61 | + "PageSize": 1, | |
| 62 | + "Sort": [{ | |
| 63 | + "Field": "", | |
| 64 | + "Type": 0 | |
| 65 | + }] | |
| 66 | + } | |
| 67 | + } | |
| 68 | + }, | |
| 69 | + created() { | |
| 70 | + this.ShowNums() | |
| 71 | + }, | |
| 72 | + methods: { | |
| 73 | + ShowNums() { | |
| 74 | + GetModelNum(this.form).then(res=>{ | |
| 75 | + this.modelnum.managerNum=res.data.data.rows[0].managerNum | |
| 76 | + this.modelnum.commissionerNum=res.data.data.rows[0].commissionerNum | |
| 77 | + }) | |
| 78 | + }, | |
| 79 | + // 修改经理专员固定单量 | |
| 80 | + UpdNums() { | |
| 81 | + UpdateNum(this.modelnum).then(res => { | |
| 82 | + if (res.data.code == 200) { | |
| 83 | + this.$message.success('修改单量成功') | |
| 84 | + } else { | |
| 85 | + this.$message.error('修改单量失败') | |
| 86 | + } | |
| 87 | + }) | |
| 88 | + }, | |
| 89 | + // async TwoTyper() { | |
| 90 | + // let managecode = 0 | |
| 91 | + // let missercode = 0 | |
| 92 | + // await UpdManage({ | |
| 93 | + // nummanager: this.nummanager | |
| 94 | + // }).then(res => { | |
| 95 | + // console.log('经理单量', res.data.code) | |
| 96 | + // managecode = res.data.code | |
| 97 | + // }) | |
| 98 | + // await UpdMisser({ | |
| 99 | + // nummisser: this.nummisser | |
| 100 | + // }).then(res => { | |
| 101 | + // console.log('专员单量', res.data.code) | |
| 102 | + // missercode = res.data.code | |
| 103 | + // }) | |
| 104 | + // debugger | |
| 105 | + // if (managecode == 200 && missercode == 200) { | |
| 106 | + // this.$message.success('修改成功') | |
| 107 | + // this.nummanager = 0 | |
| 108 | + // this.nummisser = 0 | |
| 109 | + // } else { | |
| 110 | + // this.$message.error('修改失败') | |
| 111 | + // } | |
| 112 | + // }, | |
| 113 | + | |
| 114 | + // Submit() { | |
| 115 | + // if (this.nummisser != 0 && this.nummanager != 0) { | |
| 116 | + // this.TwoTyper() | |
| 117 | + // } else { | |
| 118 | + // if (this.nummisser != 0) { | |
| 119 | + // UpdMisser({ | |
| 120 | + // nummisser: this.nummisser | |
| 121 | + // }).then(res => { | |
| 122 | + // console.log('专员单量', res) | |
| 123 | + // if (res.data.code == 200) { | |
| 124 | + // this.$message.success('专员单量修改成功') | |
| 125 | + // this.nummisser = 0 | |
| 126 | + // } else { | |
| 127 | + // this.$message.error('专员单量修改失败') | |
| 128 | + // } | |
| 129 | + // }) | |
| 130 | + // } | |
| 131 | + // if (this.nummanager != 0) { | |
| 132 | + // UpdManage({ | |
| 133 | + // nummanager: this.nummanager | |
| 134 | + // }).then(res => { | |
| 135 | + // console.log('经理单量', res) | |
| 136 | + // if (res.data.code == 200) { | |
| 137 | + // this.$message.success('经理单量修改成功') | |
| 138 | + // this.nummanager = 0 | |
| 139 | + // } else { | |
| 140 | + // this.$message.error('经理单量修改失败') | |
| 141 | + // } | |
| 142 | + // }) | |
| 143 | + // } | |
| 144 | + // } | |
| 145 | + | |
| 146 | + // } | |
| 147 | + } | |
| 148 | + } | |
| 149 | +</script> | |
| 150 | + | |
| 151 | +<style> | |
| 152 | + .header>div { | |
| 153 | + margin-top: 10px; | |
| 154 | + } | |
| 155 | +</style> | ... | ... |
src/views/system/robot.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <el-form :inline="true" :model="robotmodel" class="demo-form-inline"> | |
| 4 | + <el-form-item label="关键字"> | |
| 5 | + <el-input v-model="robotmodel.KeyWord" placeholder="关键字"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item> | |
| 8 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item> | |
| 11 | + <el-button type="success" @click="AddOrUpdRobot(null)">新增</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + </el-form> | |
| 14 | + <el-table :data="tableData" style="width: 100%"> | |
| 15 | + <el-table-column prop="id" label="ID"> | |
| 16 | + <template slot-scope="scope"> | |
| 17 | + {{scope.row.id}} | |
| 18 | + </template> | |
| 19 | + </el-table-column> | |
| 20 | + <el-table-column prop="userName" label="用户姓名"> | |
| 21 | + <template slot-scope="scope"> | |
| 22 | + {{scope.row.userName}} | |
| 23 | + </template> | |
| 24 | + </el-table-column> | |
| 25 | + | |
| 26 | + <el-table-column prop="phone" label="联系方式"> | |
| 27 | + <template slot-scope="scope"> | |
| 28 | + {{scope.row.phone}} | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column prop="carModel" label="车型"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + {{scope.row.carModel}} | |
| 34 | + </template> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column prop="ReservationStatus" label="状态"> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + <el-tag :type="scope.row.ReservationStatus=='已预约'?'success':'warn'"> | |
| 39 | + {{scope.row.ReservationStatus}} | |
| 40 | + </el-tag> | |
| 41 | + </template> | |
| 42 | + </el-table-column> | |
| 43 | + <el-table-column label="编辑"> | |
| 44 | + <template slot-scope="scope"> | |
| 45 | + <el-button type="primary" @click="AddOrUpdRobot(scope.row)">编辑</el-button> | |
| 46 | + </template> | |
| 47 | + </el-table-column> | |
| 48 | + <el-table-column label="删除"> | |
| 49 | + <template slot-scope="scope"> | |
| 50 | + <el-button type="danger" @click="DelRobot(scope.row.id)">删除</el-button> | |
| 51 | + </template> | |
| 52 | + </el-table-column> | |
| 53 | + </el-table> | |
| 54 | + <el-pagination background layout="prev, pager, next" :total="TotalCount" @current-page="Pages" | |
| 55 | + style="text-align: right;margin-top: 10px;"> | |
| 56 | + </el-pagination> | |
| 57 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="30%"> | |
| 58 | + | |
| 59 | + <el-form ref="form" :model="form" label-width="80px" :rules="rules"> | |
| 60 | + <el-form-item label="姓名" prop="userName"> | |
| 61 | + <el-input v-model="form.userName" placeholder="请输入姓名"></el-input> | |
| 62 | + </el-form-item> | |
| 63 | + <el-form-item label="电话号码" prop="phone"> | |
| 64 | + <el-input v-model="form.phone" placeholder="请输入电话号码"></el-input> | |
| 65 | + </el-form-item> | |
| 66 | + <el-form-item label="车型" prop="carModel"> | |
| 67 | + <el-input v-model="form.carModel" placeholder="请输入车型"></el-input> | |
| 68 | + </el-form-item> | |
| 69 | + <el-form-item label="状态" prop="ReservationStatus" > | |
| 70 | + <el-select v-model="form.ReservationStatus" placeholder="请选择状态"> | |
| 71 | + <el-option label="已预约" value="已预约"></el-option> | |
| 72 | + <el-option label="已取消" value="已取消"></el-option> | |
| 73 | + <el-option label="已完成" value="已完成"></el-option> | |
| 74 | + </el-select> | |
| 75 | + </el-form-item> | |
| 76 | + </el-form> | |
| 77 | + <span slot="footer" class="dialog-footer"> | |
| 78 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 79 | + <el-button type="primary" @click="SubmitMoney">确 定</el-button> | |
| 80 | + </span> | |
| 81 | + </el-dialog> | |
| 82 | + </div> | |
| 83 | +</template> | |
| 84 | + | |
| 85 | +<script> | |
| 86 | + import { | |
| 87 | + CreateRobot, | |
| 88 | + UpdateRobot, | |
| 89 | + DeleteRobot, | |
| 90 | + ListRobot | |
| 91 | + } from '../../api/RobotReservation.js' | |
| 92 | + import utils from '../../utils/utils.js' | |
| 93 | + export default { | |
| 94 | + data() { | |
| 95 | + return { | |
| 96 | + dialogVisible: false, | |
| 97 | + rules: { | |
| 98 | + userName: [{ | |
| 99 | + required: true, | |
| 100 | + message: '请输入用户名', | |
| 101 | + trigger: 'change' | |
| 102 | + }, ], | |
| 103 | + phone: [{ | |
| 104 | + required: true, | |
| 105 | + message: '请输入手机号', | |
| 106 | + trigger: 'change' | |
| 107 | + }, | |
| 108 | + { | |
| 109 | + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, | |
| 110 | + message: '请输入手机号码', | |
| 111 | + trigger: 'blur' | |
| 112 | + } | |
| 113 | + ], | |
| 114 | + carModel: [{ | |
| 115 | + required: true, | |
| 116 | + message: '请输入车型', | |
| 117 | + trigger: 'change' | |
| 118 | + } | |
| 119 | + ], | |
| 120 | + }, | |
| 121 | + tableData: [], | |
| 122 | + robotmodel: { | |
| 123 | + KeyWord: "", | |
| 124 | + pageIndex: 1, | |
| 125 | + pageSize: 20, | |
| 126 | + sort: '', | |
| 127 | + sortOrder: '', | |
| 128 | + }, | |
| 129 | + TotalCount: 0, | |
| 130 | + form: { | |
| 131 | + "id": 0, | |
| 132 | + "userName": "", | |
| 133 | + "phone": "", | |
| 134 | + "carModel": "", | |
| 135 | + "ReservationStatus": "已预约" | |
| 136 | + } | |
| 137 | + } | |
| 138 | + }, | |
| 139 | + created() { | |
| 140 | + this.ShowRobot() | |
| 141 | + }, | |
| 142 | + methods: { | |
| 143 | + // 提交添加或者修改 | |
| 144 | + SubmitMoney() { | |
| 145 | + this.$refs.form.validate((valid) => { | |
| 146 | + if (valid) { | |
| 147 | + if(this.form.id>0){ | |
| 148 | + UpdateRobot(this.form).then(res=>{ | |
| 149 | + console.log('数据',res) | |
| 150 | + if(res.data.code==200){ | |
| 151 | + this.$message.success('修改成功') | |
| 152 | + this.dialogVisible=false | |
| 153 | + this.ShowRobot() | |
| 154 | + }else{ | |
| 155 | + this.$message.error('修改失败') | |
| 156 | + } | |
| 157 | + }) | |
| 158 | + }else{ | |
| 159 | + CreateRobot(this.form).then(res=>{ | |
| 160 | + console.log('新增',res) | |
| 161 | + if(res.data.code==200){ | |
| 162 | + this.$message.success('新增成功') | |
| 163 | + this.dialogVisible=false | |
| 164 | + this.ShowRobot() | |
| 165 | + }else{ | |
| 166 | + this.$message.error('新增失败') | |
| 167 | + } | |
| 168 | + | |
| 169 | + }) | |
| 170 | + } | |
| 171 | + AddOrUpdMoney(this.form).then(res => { | |
| 172 | + console.log('哈哈', res) | |
| 173 | + if (res.data.code == 200) { | |
| 174 | + this.$message.success('操作成功') | |
| 175 | + this.dialogVisible = false | |
| 176 | + this.ShowMoneys() | |
| 177 | + } else { | |
| 178 | + this.$message.error('操作失败') | |
| 179 | + } | |
| 180 | + }) | |
| 181 | + } | |
| 182 | + }) | |
| 183 | + }, | |
| 184 | + DelRobot(id) { | |
| 185 | + DeleteRobot({ | |
| 186 | + ids:id | |
| 187 | + }).then(res => { | |
| 188 | + console.log('删除数据', res) | |
| 189 | + if (res.code == 200) { | |
| 190 | + this.$message.success('删除成功') | |
| 191 | + this.ShowRobot() | |
| 192 | + }else{ | |
| 193 | + this.$message.error('删除失败') | |
| 194 | + } | |
| 195 | + }) | |
| 196 | + }, | |
| 197 | + Pages(e) { | |
| 198 | + this.robotmodel.pageIndex = e | |
| 199 | + this.ShowRobot() | |
| 200 | + }, | |
| 201 | + // 展示机器人列表 | |
| 202 | + ShowRobot() { | |
| 203 | + ListRobot(this.robotmodel).then(res => { | |
| 204 | + console.log('提现记录', res) | |
| 205 | + this.tableData = res.data.data | |
| 206 | + this.TotalCount = res.data.count | |
| 207 | + }) | |
| 208 | + }, | |
| 209 | + AddOrUpdRobot(obj) { | |
| 210 | + this.dialogVisible = true | |
| 211 | + if (obj == null) { | |
| 212 | + // 新增 | |
| 213 | + this.form.id = 0 | |
| 214 | + this.form.userName = '' | |
| 215 | + this.form.phone = '' | |
| 216 | + this.form.carModel ='' | |
| 217 | + } else { | |
| 218 | + // 修改 | |
| 219 | + this.form.id = obj.id | |
| 220 | + this.form.userName = obj.userName | |
| 221 | + this.form.phone = obj.phone | |
| 222 | + this.form.carModel =obj.carModel | |
| 223 | + this.form.ReservationStatus=obj.ReservationStatus | |
| 224 | + } | |
| 225 | + }, | |
| 226 | + onSubmit() { | |
| 227 | + this.ShowRobot() | |
| 228 | + } | |
| 229 | + } | |
| 230 | + } | |
| 231 | +</script> | |
| 232 | + | |
| 233 | +<style> | |
| 234 | +</style> | ... | ... |
src/views/system/rulesstr.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container"> | |
| 3 | + <textarea v-model="model.texts" placeholder="请输入规则" style="width: 100%;height: 100px;margin: 10px;"></textarea> | |
| 4 | + <el-button type="primary" @click="BtnClick" style=" margin:10px 0px 10px 10px">发布介绍</el-button> | |
| 5 | + </div> | |
| 6 | +</template> | |
| 7 | + | |
| 8 | +<script> | |
| 9 | + | |
| 10 | + import { | |
| 11 | + AddOrUpdRichTextrule, | |
| 12 | + DelRichTextrule, | |
| 13 | + GetListRichTextrule | |
| 14 | + } from '../../api/rulestext.js' | |
| 15 | + export default { | |
| 16 | + data() { | |
| 17 | + return { | |
| 18 | + | |
| 19 | + model: { | |
| 20 | + "id": 0, | |
| 21 | + "texts": "", | |
| 22 | + "add_time": "2022-01-05T10:06:43.243Z", | |
| 23 | + "update_time": "2022-01-05T10:06:43.243Z", | |
| 24 | + "status": 0 | |
| 25 | + } | |
| 26 | + } | |
| 27 | + }, | |
| 28 | + created() { | |
| 29 | + | |
| 30 | + }, | |
| 31 | + methods: { | |
| 32 | + BtnClick() { | |
| 33 | + if (this.model.texts == '') { | |
| 34 | + this.$message.error('请输入规则') | |
| 35 | + } else { | |
| 36 | + AddOrUpdRichTextrule(this.model).then(res => { | |
| 37 | + console.log('res', res) | |
| 38 | + if (res.data.code == 200) { | |
| 39 | + this.$message.success('发布成功') | |
| 40 | + this.model.texts = '' | |
| 41 | + } else { | |
| 42 | + this.$message.error('发布失败') | |
| 43 | + } | |
| 44 | + }) | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + } | |
| 49 | + } | |
| 50 | +</script> | |
| 51 | + | |
| 52 | +<style> | |
| 53 | +</style> | ... | ... |
src/views/system/subscribe.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin:10px;"> | |
| 3 | + <el-button type="success" @click="AddOrUpdSub(null)">新增</el-button> | |
| 4 | + <el-table :data="tableData" style="width: 100%"> | |
| 5 | + <el-table-column prop="date" label="ID" width="180"> | |
| 6 | + <template slot-scope="scope"> | |
| 7 | + {{scope.row.id}} | |
| 8 | + </template> | |
| 9 | + </el-table-column> | |
| 10 | + <el-table-column prop="date" label="车型" width="180"> | |
| 11 | + <template slot-scope="scope"> | |
| 12 | + {{scope.row.carModel}} | |
| 13 | + </template> | |
| 14 | + </el-table-column> | |
| 15 | + <el-table-column prop="date" label="用户" width="180"> | |
| 16 | + <template slot-scope="scope"> | |
| 17 | + {{scope.row.userName}} | |
| 18 | + </template> | |
| 19 | + </el-table-column> | |
| 20 | + <el-table-column prop="date" label="手机号" width="180"> | |
| 21 | + <template slot-scope="scope"> | |
| 22 | + {{scope.row.phone}} | |
| 23 | + </template> | |
| 24 | + </el-table-column> | |
| 25 | + <el-table-column prop="date" label="状态" width="180"> | |
| 26 | + <template slot-scope="scope"> | |
| 27 | + <el-tag type="success"> | |
| 28 | + {{scope.row.ReservationStatus}} | |
| 29 | + </el-tag> | |
| 30 | + </template> | |
| 31 | + </el-table-column> | |
| 32 | + <el-table-column prop="date" label="状态" width="180"> | |
| 33 | + <template slot-scope="scope"> | |
| 34 | + <el-button type="primary" @click="AddOrUpdSub(scope.row)">编辑</el-button> | |
| 35 | + </template> | |
| 36 | + </el-table-column> | |
| 37 | + <el-table-column prop="date" label="状态" width="180"> | |
| 38 | + <template slot-scope="scope"> | |
| 39 | + <el-button type="warning" @click="DelSub(scope.row.id)">删除</el-button> | |
| 40 | + </template> | |
| 41 | + </el-table-column> | |
| 42 | + </el-table> | |
| 43 | + <el-pagination | |
| 44 | + background | |
| 45 | + layout="prev, pager, next" | |
| 46 | + :total="totalcount" @current-page="Pages" style="text-align: right;margin-top: 10px;"> | |
| 47 | + </el-pagination> | |
| 48 | + <el-dialog title="提示" :visible.sync="dialogVisible" width="50%"> | |
| 49 | + <el-form ref="form" :model="form" label-width="80px"> | |
| 50 | + <el-form-item label="姓名"> | |
| 51 | + <el-input v-model="form.userName" maxlength="10"></el-input> | |
| 52 | + </el-form-item> | |
| 53 | + <el-form-item label="电话号码"> | |
| 54 | + <el-input v-model="form.phone" maxlength="20"></el-input> | |
| 55 | + </el-form-item> | |
| 56 | + <el-form-item label="车辆型号"> | |
| 57 | + <el-input v-model="form.carModel" maxlength="10"></el-input> | |
| 58 | + </el-form-item> | |
| 59 | + <el-form-item label="预约状态"> | |
| 60 | + <el-select v-model="form.ReservationStatus" placeholder="请选择状态"> | |
| 61 | + <el-option label="已预约" value="已预约"></el-option> | |
| 62 | + <el-option label="已取消" value="已取消"></el-option> | |
| 63 | + <el-option label="已完成" value="已完成"></el-option> | |
| 64 | + </el-select> | |
| 65 | + </el-form-item> | |
| 66 | + </el-form> | |
| 67 | + <span slot="footer" class="dialog-footer"> | |
| 68 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 69 | + <el-button type="primary" @click="Submit">确 定</el-button> | |
| 70 | + </span> | |
| 71 | + </el-dialog> | |
| 72 | + </div> | |
| 73 | +</template> | |
| 74 | + | |
| 75 | +<script> | |
| 76 | + import { | |
| 77 | + GetRobot, | |
| 78 | + DeleteRobot, | |
| 79 | + ListRobot, | |
| 80 | + UpdateRobot, | |
| 81 | + CreateRobot | |
| 82 | + } from '../../api/RobotReservation.js' | |
| 83 | + export default { | |
| 84 | + data() { | |
| 85 | + return { | |
| 86 | + model:{ | |
| 87 | + ids:0, | |
| 88 | + }, | |
| 89 | + tableData: [], | |
| 90 | + dialogVisible: false, | |
| 91 | + // 机器人预约列表实体 | |
| 92 | + model: { | |
| 93 | + pageIndex: 1, | |
| 94 | + pageSize: 20, | |
| 95 | + sort: '', | |
| 96 | + sortOrder: '', | |
| 97 | + keyword: '' | |
| 98 | + }, | |
| 99 | + totalcount: 0, | |
| 100 | + form: { | |
| 101 | + "id": 0, | |
| 102 | + "userName": "", | |
| 103 | + "phone": "", | |
| 104 | + "carModel": "", | |
| 105 | + "ReservationStatus": "" | |
| 106 | + } | |
| 107 | + } | |
| 108 | + }, | |
| 109 | + created() { | |
| 110 | + this.ShowRobot() | |
| 111 | + }, | |
| 112 | + methods: { | |
| 113 | + Pages(e){ | |
| 114 | + this.model.PageIndex=e | |
| 115 | + this.ShowRobot() | |
| 116 | + }, | |
| 117 | + // 添加修改 | |
| 118 | + AddOrUpdSub(obj) { | |
| 119 | + this.dialogVisible = true | |
| 120 | + if (obj == null) { | |
| 121 | + // 新增 | |
| 122 | + this.form.id = 0 | |
| 123 | + this.form.userName = '' | |
| 124 | + this.form.phone = '' | |
| 125 | + this.form.carModel = '' | |
| 126 | + this.form.ReservationStatus = '' | |
| 127 | + } else { | |
| 128 | + // 修改 | |
| 129 | + this.form.id = obj.id | |
| 130 | + this.form.userName = obj.userName | |
| 131 | + this.form.phone = obj.phone | |
| 132 | + this.form.carModel = obj.carModel | |
| 133 | + this.form.ReservationStatus = obj.ReservationStatus | |
| 134 | + } | |
| 135 | + }, | |
| 136 | + ShowRobot() { | |
| 137 | + ListRobot(this.model).then(res => { | |
| 138 | + console.log('res', res) | |
| 139 | + this.tableData = res.data.data | |
| 140 | + this.totalcount = res.data.data.length | |
| 141 | + }) | |
| 142 | + }, | |
| 143 | + // 提交添加修改 | |
| 144 | + Submit(){ | |
| 145 | + if(this.form.id>0){ | |
| 146 | + // 修改 | |
| 147 | + UpdateRobot(this.form).then(res=>{ | |
| 148 | + if(res.code==200){ | |
| 149 | + this.$message.success('修改成功') | |
| 150 | + this.ShowRobot() | |
| 151 | + this.dialogVisible=false | |
| 152 | + }else{ | |
| 153 | + this.$message.error('修改失败') | |
| 154 | + } | |
| 155 | + }) | |
| 156 | + }else{ | |
| 157 | + // 新增 | |
| 158 | + CreateRobot(this.form).then(res=>{ | |
| 159 | + if(res.code==200){ | |
| 160 | + this.$message.success('新增成功') | |
| 161 | + this.ShowRobot() | |
| 162 | + this.dialogVisible=false | |
| 163 | + }else{ | |
| 164 | + this.$message.error('新增失败') | |
| 165 | + } | |
| 166 | + }) | |
| 167 | + } | |
| 168 | + }, | |
| 169 | + DelSub(id) { | |
| 170 | + this.model.ids=id | |
| 171 | + DeleteRobot(this.model).then(res => { | |
| 172 | + console.log('res', res) | |
| 173 | + if (res.code == 200) { | |
| 174 | + this.$message.success('删除成功') | |
| 175 | + this.ShowRobot() | |
| 176 | + } else { | |
| 177 | + this.$message.error('删除失败') | |
| 178 | + } | |
| 179 | + }) | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | +</script> | |
| 184 | + | |
| 185 | +<style> | |
| 186 | +</style> | ... | ... |
src/views/system/updpassword.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="container" style="margin: 10px;"> | |
| 3 | + <el-form ref="model" :model="model" label-width="80px"> | |
| 4 | + <el-form-item label="原密码"> | |
| 5 | + <el-input v-model="model.oldpassword"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item label="新密码"> | |
| 8 | + <el-input v-model="model.newpassword"></el-input> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item > | |
| 11 | + <el-button type="success" @click="UpdPwd">确认修改</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + </el-form> | |
| 14 | + </div> | |
| 15 | +</template> | |
| 16 | + | |
| 17 | +<script> | |
| 18 | + import { | |
| 19 | + UpdPassword | |
| 20 | + } from '../../api/user.js' | |
| 21 | + import {removeToken,removeUser} from '../../utils/auth.js' | |
| 22 | + export default { | |
| 23 | + data() { | |
| 24 | + return { | |
| 25 | + model: { | |
| 26 | + "id": 0, | |
| 27 | + "oldpassword": '', | |
| 28 | + "newpassword": '' | |
| 29 | + } | |
| 30 | + } | |
| 31 | + }, | |
| 32 | + created() { | |
| 33 | + | |
| 34 | + }, | |
| 35 | + methods: { | |
| 36 | + UpdPwd() { | |
| 37 | + let GetRole = localStorage.getItem("userRole") | |
| 38 | + console.log('www',GetRole) | |
| 39 | + let jsondata=GetRole | |
| 40 | + console.log('用户信息',jsondata) | |
| 41 | + this.model.id=jsondata | |
| 42 | + if(this.model.oldpassword==''){ | |
| 43 | + this.$message.error('请输入原密码') | |
| 44 | + return | |
| 45 | + } | |
| 46 | + if(this.model.newpassword==''){ | |
| 47 | + this.$message.error('请输入新密码') | |
| 48 | + return | |
| 49 | + } | |
| 50 | + UpdPassword(this.model).then(res => { | |
| 51 | + if (res.data.code == 200) { | |
| 52 | + this.$message.success('密码修改成功') | |
| 53 | + this.model.oldpassword='' | |
| 54 | + this.model.newpassword='' | |
| 55 | + removeToken() | |
| 56 | + removeToken() | |
| 57 | + localStorage.removeItem('userRole') | |
| 58 | + setTimeout(()=>{ | |
| 59 | + this.$router.push({ | |
| 60 | + path: '/login' | |
| 61 | + }) | |
| 62 | + },2000) | |
| 63 | + } else { | |
| 64 | + this.$message.error(res.data.message) | |
| 65 | + } | |
| 66 | + }) | |
| 67 | + } | |
| 68 | + } | |
| 69 | + } | |
| 70 | +</script> | |
| 71 | + | |
| 72 | +<style> | |
| 73 | +</style> | ... | ... |
src/views/user/commissioner.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <!-- 专员 --> | |
| 3 | + <div class="container" style="margin:10px;"> | |
| 4 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 5 | + <el-form-item label="推广专员ID"> | |
| 6 | + <el-input v-model="model.UserId" placeholder="推广专员ID"></el-input> | |
| 7 | + </el-form-item> | |
| 8 | + <el-form-item> | |
| 9 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 10 | + </el-form-item> | |
| 11 | + </el-form> | |
| 12 | + <el-table style="margin-top: 5px;" v-loading="listLoading" :data="userlist" element-loading-text="Loading" | |
| 13 | + border fit highlight-current-row> | |
| 14 | + <el-table-column label="用户ID" width="120" align="center"> | |
| 15 | + <template slot-scope="scope"> | |
| 16 | + {{scope.row.id}} | |
| 17 | + </template> | |
| 18 | + </el-table-column> | |
| 19 | + <el-table-column label="用户微信名" align="center"> | |
| 20 | + <template slot-scope="scope"> | |
| 21 | + <span>{{ scope.row.username }}</span> | |
| 22 | + </template> | |
| 23 | + </el-table-column> | |
| 24 | + <el-table-column label="用户角色" align="center"> | |
| 25 | + <template slot-scope="scope"> | |
| 26 | + <el-tag :key="scope.row.type" type="warning" effect="dark"> | |
| 27 | + {{scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'销售专员':scope.row.type==4?'销售经理':'未知'}} | |
| 28 | + </el-tag> | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column label="备注" align="center"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + <span>{{ scope.row.remark }}</span> | |
| 34 | + </template> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column label="用户电话" align="center"> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + <span>{{ scope.row.phone }}</span> | |
| 39 | + </template> | |
| 40 | + </el-table-column> | |
| 41 | + <el-table-column fixed="right" label="操作" width="160"> | |
| 42 | + <template slot-scope="scope"> | |
| 43 | + <!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> --> | |
| 44 | + <el-button type="text" size="small" @click="showUpdate(scope.row.id)" v-show="false">编辑 | |
| 45 | + </el-button> | |
| 46 | + <el-button type="text" size="small" @click="deleteInfo(scope.row.id)">删除 | |
| 47 | + </el-button> | |
| 48 | + </template> | |
| 49 | + </el-table-column> | |
| 50 | + </el-table> | |
| 51 | + <!-- <el-pagination | |
| 52 | + background | |
| 53 | + layout="prev, pager, next" | |
| 54 | + :total="total" style="text-align: right;margin-top: 10px;"> | |
| 55 | + </el-pagination> --> | |
| 56 | + </div> | |
| 57 | +</template> | |
| 58 | + | |
| 59 | +<script> | |
| 60 | + import { | |
| 61 | + GetUserCustomerView, | |
| 62 | + DeleteUser, | |
| 63 | + Save, | |
| 64 | + } from '../../api/user.js' | |
| 65 | + export default { | |
| 66 | + data() { | |
| 67 | + return { | |
| 68 | + userlist: [], | |
| 69 | + listLoading: true, | |
| 70 | + model: { | |
| 71 | + UserId: 0 | |
| 72 | + }, | |
| 73 | + } | |
| 74 | + }, | |
| 75 | + created() { | |
| 76 | + this.ShowCustomer() | |
| 77 | + }, | |
| 78 | + methods: { | |
| 79 | + | |
| 80 | + ShowCustomer() { | |
| 81 | + GetUserCustomerView(this.model).then(res => { | |
| 82 | + console.log('数据', res) | |
| 83 | + if (res.code == 200) { | |
| 84 | + this.userlist = res.data | |
| 85 | + this.listLoading=false | |
| 86 | + } | |
| 87 | + }) | |
| 88 | + }, | |
| 89 | + onSubmit(){ | |
| 90 | + if(this.model.UserId==0){ | |
| 91 | + this.$message.error('请输入专员ID') | |
| 92 | + }else{ | |
| 93 | + this.ShowCustomer() | |
| 94 | + } | |
| 95 | + }, | |
| 96 | + deleteInfo(id){ | |
| 97 | + DeleteUser({ | |
| 98 | + ids:id | |
| 99 | + }).then(res=>{ | |
| 100 | + console.log('res',res) | |
| 101 | + if(res.code==200){ | |
| 102 | + this.$message.success('删除成功') | |
| 103 | + this.ShowCustomer() | |
| 104 | + }else{ | |
| 105 | + this.$message.error('删除失败') | |
| 106 | + } | |
| 107 | + }) | |
| 108 | + } | |
| 109 | + } | |
| 110 | + | |
| 111 | + } | |
| 112 | +</script> | |
| 113 | + | |
| 114 | +<style> | |
| 115 | +</style> | ... | ... |
src/views/user/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="app" class="app-container"> | |
| 3 | + <el-table style="margin-top: 5px;" v-loading="listLoading" :data="userlist" element-loading-text="Loading" | |
| 4 | + border fit highlight-current-row> | |
| 5 | + <el-table-column label="用户ID" width="120" align="center"> | |
| 6 | + <template slot-scope="scope"> | |
| 7 | + {{scope.row.id}} | |
| 8 | + </template> | |
| 9 | + </el-table-column> | |
| 10 | + <el-table-column label="用户微信名" align="center" > | |
| 11 | + <template slot-scope="scope"> | |
| 12 | + <span>{{ scope.row.username }}</span> | |
| 13 | + </template> | |
| 14 | + </el-table-column> | |
| 15 | + <el-table-column label="别名" align="center" v-if="false"> | |
| 16 | + <template slot-scope="scope"> | |
| 17 | + <span>{{ scope.row.full_name }}</span> | |
| 18 | + </template> | |
| 19 | + </el-table-column> | |
| 20 | + <el-table-column label="用户电话" align="center"> | |
| 21 | + <template slot-scope="scope"> | |
| 22 | + <span>{{ scope.row.phone }}</span> | |
| 23 | + </template> | |
| 24 | + </el-table-column> | |
| 25 | + <el-table-column label="备用电话" align="center"> | |
| 26 | + <template slot-scope="scope"> | |
| 27 | + <span>{{ scope.row.updphone }}</span> | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + <el-table-column label="地址" align="center"> | |
| 31 | + <template slot-scope="scope"> | |
| 32 | + <span>{{ scope.row.address }}</span> | |
| 33 | + </template> | |
| 34 | + </el-table-column> | |
| 35 | + <el-table-column label="性别" align="center" v-if="false"> | |
| 36 | + <template slot-scope="scope"> | |
| 37 | + <el-tag :type="scope.row.sex==0?'success':'warn'"> | |
| 38 | + <span>{{ scope.row.sex==0?'男':'女'}}</span> | |
| 39 | + </el-tag> | |
| 40 | + </template> | |
| 41 | + </el-table-column> | |
| 42 | + <el-table-column label="生日" align="center" v-if="false"> | |
| 43 | + <template slot-scope="scope"> | |
| 44 | + <span>{{ scope.row.birthday }}</span> | |
| 45 | + </template> | |
| 46 | + </el-table-column> | |
| 47 | + <!-- <el-table-column label="用户角色" align="center"> | |
| 48 | + <template slot-scope="scope"> | |
| 49 | + <el-tag :key="scope.row.status" type="warning" effect="dark"> | |
| 50 | + {{ scope.row.remark }} | |
| 51 | + </el-tag> | |
| 52 | + </template> | |
| 53 | + </el-table-column> --> | |
| 54 | + <el-table-column label="用户角色" align="center"> | |
| 55 | + <template slot-scope="scope"> | |
| 56 | + <el-tag :key="scope.row.type" type="warning" effect="dark"> | |
| 57 | + {{scope.row.type==0?'超级管理员':scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知' }} | |
| 58 | + </el-tag> | |
| 59 | + </template> | |
| 60 | + </el-table-column> | |
| 61 | + <el-table-column label="用户状态" align="center"> | |
| 62 | + <template slot-scope="scope"> | |
| 63 | + <el-tag :key="scope.row.status" v-if="scope.row.status==='0'" type="success" effect="dark"> | |
| 64 | + 使用中 | |
| 65 | + </el-tag> | |
| 66 | + <el-tag :key="scope.row.status" v-if="scope.row.status==='-99'" type="danger" effect="dark"> | |
| 67 | + 禁用中 | |
| 68 | + </el-tag> | |
| 69 | + </template> | |
| 70 | + </el-table-column> | |
| 71 | + <el-table-column fixed="right" label="操作" width="230"> | |
| 72 | + <template slot-scope="scope"> | |
| 73 | + <el-dropdown @command="(e)=>{handleCommand(e,scope.row.id,scope.row)}"> | |
| 74 | + <span class="el-dropdown-link"> | |
| 75 | + 操作<el-icon class="el-icon--right"> | |
| 76 | + <arrow-down /> | |
| 77 | + </el-icon> | |
| 78 | + </span> | |
| 79 | + <template #dropdown> | |
| 80 | + <el-dropdown-menu> | |
| 81 | + <el-dropdown-item command="a">升级成客户经理 | |
| 82 | + </el-dropdown-item> | |
| 83 | + <el-dropdown-item command="e">升级成推广专员 | |
| 84 | + </el-dropdown-item> | |
| 85 | + <el-dropdown-item command="b">删除</el-dropdown-item> | |
| 86 | + <el-dropdown-item command='c' v-if="false">编辑</el-dropdown-item> | |
| 87 | + <el-dropdown-item command='d' v-if="false">车辆信息</el-dropdown-item> | |
| 88 | + <el-dropdown-item command="f" v-if="scope.row.status==0">拉黑用户</el-dropdown-item> | |
| 89 | + <el-dropdown-item command="g" v-else>取消拉黑</el-dropdown-item> | |
| 90 | + </el-dropdown-menu> | |
| 91 | + </template> | |
| 92 | + </el-dropdown> | |
| 93 | + </template> | |
| 94 | + </el-table-column> | |
| 95 | + </el-table> | |
| 96 | + <el-pagination background layout="prev, pager, next" :total="total" @current-page="Pages" | |
| 97 | + style="text-align: right;margin-top: 10px;"> | |
| 98 | + </el-pagination> | |
| 99 | + <el-dialog title="编辑" :visible.sync="dialogVisible" width="50%"> | |
| 100 | + | |
| 101 | + <el-form ref="form" :model="form" label-width="80px" :rules="rules"> | |
| 102 | + <el-form-item label="账户名" prop="username"> | |
| 103 | + <el-input v-model="form.username"></el-input> | |
| 104 | + </el-form-item> | |
| 105 | + <el-form-item label="身份证号" prop="ID_card" v-if="false"> | |
| 106 | + <el-input v-model="form.ID_card"></el-input> | |
| 107 | + </el-form-item> | |
| 108 | + <el-form-item label="手机号" prop="phone"> | |
| 109 | + <el-input v-model="form.phone"></el-input> | |
| 110 | + </el-form-item> | |
| 111 | + <el-form-item label="地址" prop="address"> | |
| 112 | + <el-input v-model="form.address"></el-input> | |
| 113 | + </el-form-item> | |
| 114 | + <el-form-item label="备注" prop="remark"> | |
| 115 | + <el-input v-model="form.remark"></el-input> | |
| 116 | + </el-form-item> | |
| 117 | + <el-form-item label="性别" prop="sex"> | |
| 118 | + <!-- 0男 1-女 --> | |
| 119 | + <el-select v-model="form.sex" placeholder="请选择"> | |
| 120 | + <el-option label="男" value="0"></el-option> | |
| 121 | + <el-option label="女" value="1"></el-option> | |
| 122 | + </el-select> | |
| 123 | + </el-form-item> | |
| 124 | + <el-form-item label="生日" prop="birthday"> | |
| 125 | + <el-date-picker v-model="form.birthday" type="date" placeholder="选择日期"> | |
| 126 | + </el-date-picker> | |
| 127 | + </el-form-item> | |
| 128 | + </el-form> | |
| 129 | + <span slot="footer" class="dialog-footer"> | |
| 130 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 131 | + <el-button type="primary" @click="UpdSubmit">确 定</el-button> | |
| 132 | + </span> | |
| 133 | + </el-dialog> | |
| 134 | + <el-dialog title="车辆信息" :visible.sync="dialogVisibleCar" width="50%"> | |
| 135 | + | |
| 136 | + <el-table :data="tableData" style="width: 100%"> | |
| 137 | + <el-table-column prop="date" label="ID" width="180" v-if="false"> | |
| 138 | + <template slot-scope="scope"> | |
| 139 | + {{scope.row.id}} | |
| 140 | + </template> | |
| 141 | + </el-table-column> | |
| 142 | + <el-table-column prop="date" label="用户ID" width="180" v-if="false"> | |
| 143 | + <template slot-scope="scope"> | |
| 144 | + {{scope.row.id}} | |
| 145 | + </template> | |
| 146 | + </el-table-column> | |
| 147 | + <el-table-column prop="date" label="车型" width="180"> | |
| 148 | + <template slot-scope="scope"> | |
| 149 | + {{scope.row.CarModel}} | |
| 150 | + </template> | |
| 151 | + </el-table-column> | |
| 152 | + <el-table-column prop="Scratch" label="漆面划痕" width="180"> | |
| 153 | + <template slot-scope="scope"> | |
| 154 | + {{scope.row.Scratch}} | |
| 155 | + </template> | |
| 156 | + </el-table-column> | |
| 157 | + <el-table-column prop="Corrosion" label="漆面腐蚀" width="180"> | |
| 158 | + <template slot-scope="scope"> | |
| 159 | + {{scope.row.Corrosion}} | |
| 160 | + </template> | |
| 161 | + </el-table-column> | |
| 162 | + <el-table-column prop="BeDamaged" label="漆面破损" width="180"> | |
| 163 | + <template slot-scope="scope"> | |
| 164 | + {{scope.row.BeDamaged}} | |
| 165 | + </template> | |
| 166 | + </el-table-column> | |
| 167 | + <el-table-column prop="FlyingPaint" label="沥青飞漆" width="180"> | |
| 168 | + <template slot-scope="scope"> | |
| 169 | + {{scope.row.FlyingPaint}} | |
| 170 | + </template> | |
| 171 | + </el-table-column> | |
| 172 | + <el-table-column prop="CarDefault" label="默认车辆" width="180"> | |
| 173 | + <template slot-scope="scope"> | |
| 174 | + <el-tag :type="scope.row.CarDefault==true?'success':'warn'"> | |
| 175 | + {{scope.row.CarDefault==true?'默认车辆':'非默认车辆'}} | |
| 176 | + </el-tag> | |
| 177 | + </template> | |
| 178 | + </el-table-column> | |
| 179 | + <el-table-column prop="AddTime" label="添加时间" width="180"> | |
| 180 | + <template slot-scope="scope"> | |
| 181 | + {{scope.row.AddTime}} | |
| 182 | + </template> | |
| 183 | + </el-table-column> | |
| 184 | + <el-table-column prop="UpdateTime" label="修改时间" width="180"> | |
| 185 | + <template slot-scope="scope"> | |
| 186 | + {{scope.row.UpdateTime}} | |
| 187 | + </template> | |
| 188 | + </el-table-column> | |
| 189 | + <el-table-column prop="UpdateTime" label="设为默认" width="180"> | |
| 190 | + <template slot-scope="scope"> | |
| 191 | + <el-button type="success" @click="SetDefault(scope.row)">设为默认</el-button> | |
| 192 | + </template> | |
| 193 | + </el-table-column> | |
| 194 | + </el-table> | |
| 195 | + <el-pagination background layout="prev, pager, next" :total="CarModel.TotalCount" @current-page="PagesCar" | |
| 196 | + style="text-align: right;margin-top: 10px;"> | |
| 197 | + </el-pagination> | |
| 198 | + <span slot="footer" class="dialog-footer"> | |
| 199 | + <el-button @click="dialogVisibleCar = false">取 消</el-button> | |
| 200 | + <el-button type="primary" @click="dialogVisibleCar = false">确 定</el-button> | |
| 201 | + </span> | |
| 202 | + </el-dialog> | |
| 203 | + </div> | |
| 204 | +</template> | |
| 205 | +<script> | |
| 206 | + import { | |
| 207 | + GetUserList, | |
| 208 | + UpdateUserType, | |
| 209 | + DeleteUser, | |
| 210 | + Save, | |
| 211 | + Blacklist, | |
| 212 | + NoBlacklist | |
| 213 | + } from '@/api/user' | |
| 214 | + import { | |
| 215 | + GetVehicleListByUser, | |
| 216 | + UpdateCarDefault, | |
| 217 | + } from '../../api/VehicleManagement.js' | |
| 218 | + import utils from '../../utils/utils.js' | |
| 219 | + export default { | |
| 220 | + data() { | |
| 221 | + return { | |
| 222 | + tableData: [], | |
| 223 | + dialogVisible: false, | |
| 224 | + dialogVisibleCar: false, | |
| 225 | + dialogVisiblecommissioner:false, | |
| 226 | + rules: { | |
| 227 | + username: [{ | |
| 228 | + required: true, | |
| 229 | + message: '请输入账户名', | |
| 230 | + trigger: 'blur' | |
| 231 | + }], | |
| 232 | + ID_card: [{ | |
| 233 | + required: true, | |
| 234 | + message: '请输入身份证号码', | |
| 235 | + trigger: 'blur' | |
| 236 | + }, { | |
| 237 | + min: 6, | |
| 238 | + max: 30, | |
| 239 | + message: '长度在 6 到 30 个字符' | |
| 240 | + }, { | |
| 241 | + pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/, | |
| 242 | + message: '请输入正确的身份证号码' | |
| 243 | + }], | |
| 244 | + phone: [{ | |
| 245 | + required: true, | |
| 246 | + message: '请输入电话号码', | |
| 247 | + trigger: 'blur' | |
| 248 | + }, { | |
| 249 | + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, | |
| 250 | + message: '请输入正确的手机号格式' | |
| 251 | + }], | |
| 252 | + address: [{ | |
| 253 | + required: true, | |
| 254 | + message: '请输入地址', | |
| 255 | + trigger: 'blur' | |
| 256 | + }], | |
| 257 | + sex: [{ | |
| 258 | + required: true, | |
| 259 | + message: '请选择年龄', | |
| 260 | + trigger: 'blur' | |
| 261 | + }], | |
| 262 | + birthday: [{ | |
| 263 | + required: true, | |
| 264 | + message: '请选择生日', | |
| 265 | + trigger: 'blur' | |
| 266 | + }], | |
| 267 | + | |
| 268 | + }, | |
| 269 | + userlist: [], | |
| 270 | + listLoading: true, | |
| 271 | + parameter: { | |
| 272 | + pageIndex: 1, | |
| 273 | + pageSize: 10, | |
| 274 | + sort: "id", | |
| 275 | + sortOrder: 2, | |
| 276 | + keyword: "", | |
| 277 | + status: 1 | |
| 278 | + }, | |
| 279 | + total: 0, | |
| 280 | + updateType: { | |
| 281 | + UserId: 0, | |
| 282 | + UserType: 2, | |
| 283 | + ParentUserId: 0 | |
| 284 | + }, | |
| 285 | + form: { | |
| 286 | + "ParentUserId": 0, | |
| 287 | + "InviteeUserId": 0, | |
| 288 | + "beijintupian": "", | |
| 289 | + "birthday": "", | |
| 290 | + "ID_card": "", | |
| 291 | + "address": "", | |
| 292 | + "id": 0, | |
| 293 | + "username": "", | |
| 294 | + "password": "", | |
| 295 | + "author": "", | |
| 296 | + "status": "", | |
| 297 | + "type": 0, | |
| 298 | + "full_name": "", | |
| 299 | + "add_time": "2022-01-20T13:27:24.548Z", | |
| 300 | + "update_time": "2022-01-20T13:27:24.548Z", | |
| 301 | + "remark": "", | |
| 302 | + "avatar": "", | |
| 303 | + "phone": "", | |
| 304 | + "openid": "", | |
| 305 | + "sex": "", | |
| 306 | + "balance": 0 | |
| 307 | + }, | |
| 308 | + CarModel: { | |
| 309 | + "UserId": 0, | |
| 310 | + "KeyWord": "", | |
| 311 | + "TotalCount": 0, | |
| 312 | + "PageIndex": 1, | |
| 313 | + "PageSize": 10, | |
| 314 | + "Sort": [{ | |
| 315 | + "Field": "id", | |
| 316 | + "Type": 0 | |
| 317 | + }] | |
| 318 | + }, | |
| 319 | + // 默认 | |
| 320 | + CarDefaultModel: { | |
| 321 | + "id": 0, | |
| 322 | + "UserId": 0 | |
| 323 | + } | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + | |
| 327 | + created() {}, | |
| 328 | + mounted() { | |
| 329 | + this.GetUserListHeadler(); | |
| 330 | + }, | |
| 331 | + methods: { | |
| 332 | + Pages(e) { | |
| 333 | + this.parameter.pageIndex = e | |
| 334 | + this.GetUserListHeadler() | |
| 335 | + }, | |
| 336 | + PagesCar(e) { | |
| 337 | + this.CarModel.PageIndex = e | |
| 338 | + this.ShowCar() | |
| 339 | + }, | |
| 340 | + GetUserListHeadler() { | |
| 341 | + GetUserList(this.parameter).then(res => { | |
| 342 | + res.data.data.forEach((item, index) => { | |
| 343 | + item.birthday = utils.formatTime(item.birthday, "yyyy-MM-dd") | |
| 344 | + }) | |
| 345 | + this.userlist = res.data.data | |
| 346 | + console.log('经理', this.userlist) | |
| 347 | + this.listLoading = false; | |
| 348 | + }); | |
| 349 | + }, | |
| 350 | + handleCommand(value, val, item) { | |
| 351 | + if (value == "a") { | |
| 352 | + this.UpdateUserTypeHeadler(val); | |
| 353 | + } | |
| 354 | + if (value == "b") { | |
| 355 | + this.DelUserHeadler(val) | |
| 356 | + } | |
| 357 | + if (value == "c") { | |
| 358 | + this.UpdateUserHeadler(item) | |
| 359 | + } | |
| 360 | + if (value == "d") { | |
| 361 | + this.ShowCar(val) | |
| 362 | + } | |
| 363 | + if(value =="e"){ | |
| 364 | + this.UpdateUserType(val) | |
| 365 | + } | |
| 366 | + if(value=='f'){ | |
| 367 | + // 拉黑 | |
| 368 | + this.BlacklistSubmit(val) | |
| 369 | + } | |
| 370 | + if(value=='g'){ | |
| 371 | + // 取消拉黑 | |
| 372 | + this.NoBlacklistSubmit(val) | |
| 373 | + } | |
| 374 | + }, | |
| 375 | + BlacklistSubmit(id){ | |
| 376 | + // 拉黑 | |
| 377 | + Blacklist(id).then(res=>{ | |
| 378 | + if(res.data.code==200){ | |
| 379 | + this.$message.success('拉黑成功') | |
| 380 | + this.GetUserListHeadler() | |
| 381 | + }else{ | |
| 382 | + this.$message.error('拉黑失败') | |
| 383 | + } | |
| 384 | + }) | |
| 385 | + }, | |
| 386 | + NoBlacklistSubmit(id){ | |
| 387 | + // 取消拉黑 | |
| 388 | + NoBlacklist(id).then(res=>{ | |
| 389 | + if(res.data.code==200){ | |
| 390 | + this.$message.success('取消拉黑成功') | |
| 391 | + this.GetUserListHeadler() | |
| 392 | + }else{ | |
| 393 | + this.$message.error('取消拉黑失败') | |
| 394 | + } | |
| 395 | + }) | |
| 396 | + }, | |
| 397 | + UpdateUserType(UserId){ | |
| 398 | + // 修改成销售专员 | |
| 399 | + this.updateType = { | |
| 400 | + UserId: UserId, | |
| 401 | + UserType: 3, | |
| 402 | + ParentUserId: 0 | |
| 403 | + }; | |
| 404 | + this.$confirm('确定把该用户升级成推广专员?', '消息', { | |
| 405 | + confirmButtonText: '确认', | |
| 406 | + cancelButtonText: '取消', | |
| 407 | + callback: (action) => { | |
| 408 | + if (action == "confirm") { | |
| 409 | + UpdateUserType(this.updateType).then(res => { | |
| 410 | + if (res.data.code == 200) { | |
| 411 | + this.$confirm('该用户已升级成推广专员', '消息', { | |
| 412 | + confirmButtonText: '确认', | |
| 413 | + cancelButtonText: '取消', | |
| 414 | + callback: (action) => { | |
| 415 | + this.GetUserListHeadler(); | |
| 416 | + }, | |
| 417 | + }) | |
| 418 | + } else { | |
| 419 | + this.$confirm('升级成推广专员失败', '消息', { | |
| 420 | + confirmButtonText: '确认', | |
| 421 | + cancelButtonText: '取消' | |
| 422 | + }) | |
| 423 | + } | |
| 424 | + }); | |
| 425 | + } | |
| 426 | + }, | |
| 427 | + }) | |
| 428 | + }, | |
| 429 | + // 设为默认车辆 | |
| 430 | + SetDefault(item) { | |
| 431 | + console.log('数据', item) | |
| 432 | + if (item.CarDefault == true) { | |
| 433 | + this.$message.error('该车辆已是默认车辆') | |
| 434 | + } else { | |
| 435 | + this.CarDefaultModel.id = item.id | |
| 436 | + this.CarDefaultModel.UserId = this.CarModel.UserId | |
| 437 | + UpdateCarDefault(this.CarDefaultModel).then(res => { | |
| 438 | + console.log('默认', res) | |
| 439 | + if(res.data.code==200){ | |
| 440 | + this.$message.success('修改默认车辆成功') | |
| 441 | + this.ShowCar() | |
| 442 | + }else{ | |
| 443 | + this.$message.error(res.data.message) | |
| 444 | + } | |
| 445 | + }) | |
| 446 | + } | |
| 447 | + }, | |
| 448 | + // 查询车辆信息 | |
| 449 | + ShowCar(id) { | |
| 450 | + console.log('车辆ID', id) | |
| 451 | + this.CarModel.UserId = id | |
| 452 | + this.dialogVisibleCar = true | |
| 453 | + GetVehicleListByUser(this.CarModel).then(res => { | |
| 454 | + console.log('车辆信息', res) | |
| 455 | + if (res.data.code == 200) { | |
| 456 | + res.data.data.rows.forEach((item, index) => { | |
| 457 | + item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss") | |
| 458 | + item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd HH:mm:ss") | |
| 459 | + }) | |
| 460 | + this.tableData = res.data.data.rows | |
| 461 | + this.CarModel.TotalCount = res.data.data.total | |
| 462 | + } | |
| 463 | + }) | |
| 464 | + }, | |
| 465 | + UpdSubmit() { | |
| 466 | + // 修改提交信息 | |
| 467 | + this.$refs.form.validate((valid) => { | |
| 468 | + if (valid) { | |
| 469 | + Save(this.form).then(res => { | |
| 470 | + console.log('提交', res) | |
| 471 | + if (res.data.code == 200) { | |
| 472 | + this.$message.success('修改成功') | |
| 473 | + this.dialogVisible = false | |
| 474 | + this.GetUserListHeadler() | |
| 475 | + } else { | |
| 476 | + this.$message.error('修改失败') | |
| 477 | + } | |
| 478 | + }) | |
| 479 | + } | |
| 480 | + }) | |
| 481 | + }, | |
| 482 | + // 修改信息 | |
| 483 | + UpdateUserHeadler(item) { | |
| 484 | + console.log('item', item) | |
| 485 | + this.dialogVisible = true | |
| 486 | + this.form.birthday = item.birthday | |
| 487 | + this.form.ID_card = item.ID_card | |
| 488 | + this.form.address = item.address | |
| 489 | + this.form.id = item.id | |
| 490 | + this.form.username = item.username | |
| 491 | + this.form.add_time = item.add_time | |
| 492 | + this.form.update_time = item.update_time | |
| 493 | + this.form.remark = item.remark | |
| 494 | + this.form.phone = item.phone | |
| 495 | + this.form.sex = item.sex | |
| 496 | + // ------------------- | |
| 497 | + this.form.InviteeUserId = item.InviteeUserId | |
| 498 | + this.form.ParentUserId = item.ParentUserId | |
| 499 | + this.form.beijintupian = item.beijintupian | |
| 500 | + this.form.password = item.password | |
| 501 | + this.form.author = item.author | |
| 502 | + this.form.status = item.status | |
| 503 | + this.form.type = item.type | |
| 504 | + this.form.full_name = item.full_name | |
| 505 | + this.form.avatar = item.avatar | |
| 506 | + this.form.openid = item.openid | |
| 507 | + this.form.balance = item.balance | |
| 508 | + }, | |
| 509 | + DelUserHeadler(Id) { | |
| 510 | + DeleteUser({ | |
| 511 | + ids: Id | |
| 512 | + }).then(res => { | |
| 513 | + console.log('res', res) | |
| 514 | + if (res.data.code == 200) { | |
| 515 | + this.$message.success('删除成功') | |
| 516 | + this.GetUserListHeadler() | |
| 517 | + } else { | |
| 518 | + this.$message.error('删除失败') | |
| 519 | + } | |
| 520 | + }) | |
| 521 | + }, | |
| 522 | + UpdateUserTypeHeadler(UserId) { | |
| 523 | + this.updateType = { | |
| 524 | + UserId: UserId, | |
| 525 | + UserType: 4, | |
| 526 | + ParentUserId: 0 | |
| 527 | + }; | |
| 528 | + this.$confirm('确定把该用户升级成客户经理?', '消息', { | |
| 529 | + confirmButtonText: '确认', | |
| 530 | + cancelButtonText: '取消', | |
| 531 | + callback: (action) => { | |
| 532 | + if (action == "confirm") { | |
| 533 | + UpdateUserType(this.updateType).then(res => { | |
| 534 | + if (res.data.code == 200) { | |
| 535 | + this.$confirm('该用户已升级成客户经理', '消息', { | |
| 536 | + confirmButtonText: '确认', | |
| 537 | + cancelButtonText: '取消', | |
| 538 | + callback: (action) => { | |
| 539 | + this.GetUserListHeadler(); | |
| 540 | + }, | |
| 541 | + }) | |
| 542 | + } else { | |
| 543 | + this.$confirm('升级成客户经理失败', '消息', { | |
| 544 | + confirmButtonText: '确认', | |
| 545 | + cancelButtonText: '取消' | |
| 546 | + }) | |
| 547 | + } | |
| 548 | + }); | |
| 549 | + } | |
| 550 | + }, | |
| 551 | + }) | |
| 552 | + } | |
| 553 | + } | |
| 554 | + } | |
| 555 | +</script> | |
| 556 | + | |
| 557 | +<style> | |
| 558 | +</style> | ... | ... |
src/views/user/manager.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <!-- 经理 --> | |
| 3 | + <div class="container" style="margin:10px;"> | |
| 4 | + <el-form :inline="true" :model="model" class="demo-form-inline"> | |
| 5 | + <el-form-item label="客户经理ID"> | |
| 6 | + <el-input v-model="model.UserId" placeholder="客户经理ID"></el-input> | |
| 7 | + </el-form-item> | |
| 8 | + <el-form-item> | |
| 9 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 10 | + </el-form-item> | |
| 11 | + </el-form> | |
| 12 | + <el-table style="margin-top: 5px;" v-loading="listLoading" :data="userlist" element-loading-text="Loading" | |
| 13 | + border fit highlight-current-row> | |
| 14 | + <el-table-column label="用户ID" width="120" align="center"> | |
| 15 | + <template slot-scope="scope"> | |
| 16 | + {{scope.row.id}} | |
| 17 | + </template> | |
| 18 | + </el-table-column> | |
| 19 | + <el-table-column label="用户微信名" align="center"> | |
| 20 | + <template slot-scope="scope"> | |
| 21 | + <span>{{ scope.row.username }}</span> | |
| 22 | + </template> | |
| 23 | + </el-table-column> | |
| 24 | + <el-table-column label="用户角色" align="center"> | |
| 25 | + <template slot-scope="scope"> | |
| 26 | + <el-tag :key="scope.row.type" type="warning" effect="dark"> | |
| 27 | + {{scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'销售专员':scope.row.type==4?'销售经理':'未知'}} | |
| 28 | + </el-tag> | |
| 29 | + </template> | |
| 30 | + </el-table-column> | |
| 31 | + <el-table-column label="备注" align="center"> | |
| 32 | + <template slot-scope="scope"> | |
| 33 | + <span>{{ scope.row.remark }}</span> | |
| 34 | + </template> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column label="用户电话" align="center"> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + <span>{{ scope.row.phone }}</span> | |
| 39 | + </template> | |
| 40 | + </el-table-column> | |
| 41 | + <el-table-column fixed="right" label="操作" width="160"> | |
| 42 | + <template slot-scope="scope"> | |
| 43 | + <!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> --> | |
| 44 | + <el-button type="text" size="small" @click="deleteInfo(scope.row.id)">删除 | |
| 45 | + </el-button> | |
| 46 | + </template> | |
| 47 | + </el-table-column> | |
| 48 | + </el-table> | |
| 49 | + <!-- <el-pagination | |
| 50 | + background | |
| 51 | + layout="prev, pager, next" | |
| 52 | + :total="total" @current-page="Pages" style="text-align: right;margin-top: 10px;"> | |
| 53 | + </el-pagination> --> | |
| 54 | + </div> | |
| 55 | +</template> | |
| 56 | + | |
| 57 | +<script> | |
| 58 | + import { | |
| 59 | + GetCommissionerByManage, | |
| 60 | + DeleteUser | |
| 61 | + } from '../../api/user.js' | |
| 62 | + export default { | |
| 63 | + data() { | |
| 64 | + return { | |
| 65 | + userlist: [], | |
| 66 | + listLoading: true, | |
| 67 | + model: { | |
| 68 | + UserId: 0 | |
| 69 | + }, | |
| 70 | + total:0 | |
| 71 | + } | |
| 72 | + }, | |
| 73 | + created() { | |
| 74 | + this.ShowCommisser() | |
| 75 | + }, | |
| 76 | + methods: { | |
| 77 | + ShowCommisser() { | |
| 78 | + GetCommissionerByManage(this.model).then(res => { | |
| 79 | + console.log('数据', res) | |
| 80 | + if (res.code == 200) { | |
| 81 | + this.userlist = res.data.data | |
| 82 | + this.listLoading=false | |
| 83 | + } | |
| 84 | + }) | |
| 85 | + }, | |
| 86 | + onSubmit(){ | |
| 87 | + if(this.model.UserId==0){ | |
| 88 | + this.$message.error('请输入经理ID') | |
| 89 | + }else{ | |
| 90 | + this.$message.success('查询成功') | |
| 91 | + this.ShowCommisser() | |
| 92 | + } | |
| 93 | + }, | |
| 94 | + deleteInfo(id){ | |
| 95 | + DeleteUser({ | |
| 96 | + ids:id | |
| 97 | + }).then(res=>{ | |
| 98 | + console.log('res',res) | |
| 99 | + if(res.code==200){ | |
| 100 | + this.$message.success('删除成功') | |
| 101 | + this.ShowCommisser() | |
| 102 | + }else{ | |
| 103 | + this.$message.error('删除失败') | |
| 104 | + } | |
| 105 | + }) | |
| 106 | + } | |
| 107 | + } | |
| 108 | + | |
| 109 | + } | |
| 110 | +</script> | |
| 111 | + | |
| 112 | +<style> | |
| 113 | +</style> | ... | ... |
src/views/user/managerTable.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div id="app" class="app-container"> | |
| 3 | + <el-form :inline="true" :model="parameter" class="demo-form-inline"> | |
| 4 | + <el-form-item label="关键字"> | |
| 5 | + <el-input v-model="parameter.keyword" placeholder="关键字"></el-input> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item> | |
| 8 | + <el-button type="primary" @click="onSubmit">查询</el-button> | |
| 9 | + </el-form-item> | |
| 10 | + </el-form> | |
| 11 | + <el-table style="margin-top: 5px;" v-loading="listLoading" :data="userlist" element-loading-text="Loading" | |
| 12 | + border fit highlight-current-row> | |
| 13 | + <el-table-column label="用户ID" width="120" align="center"> | |
| 14 | + <template slot-scope="scope"> | |
| 15 | + {{scope.row.id}} | |
| 16 | + </template> | |
| 17 | + </el-table-column> | |
| 18 | + <!-- <el-table-column label="用户账号" align="center"> | |
| 19 | + <template slot-scope="scope"> | |
| 20 | + <span>{{ scope.row.username }}</span> | |
| 21 | + </template> | |
| 22 | + </el-table-column> --> | |
| 23 | + <el-table-column label="用户微信名" align="center"> | |
| 24 | + <template slot-scope="scope"> | |
| 25 | + <span>{{ scope.row.username }}</span> | |
| 26 | + </template> | |
| 27 | + </el-table-column> | |
| 28 | + <el-table-column label="别名" align="center" v-if="false"> | |
| 29 | + <template slot-scope="scope"> | |
| 30 | + <span>{{ scope.row.full_name }}</span> | |
| 31 | + </template> | |
| 32 | + </el-table-column> | |
| 33 | + <el-table-column label="用户电话" align="center"> | |
| 34 | + <template slot-scope="scope"> | |
| 35 | + <span>{{ scope.row.phone }}</span> | |
| 36 | + </template> | |
| 37 | + </el-table-column> | |
| 38 | + <el-table-column label="备用电话" align="center"> | |
| 39 | + <template slot-scope="scope"> | |
| 40 | + <span>{{ scope.row.updphone }}</span> | |
| 41 | + </template> | |
| 42 | + </el-table-column> | |
| 43 | + <el-table-column label="地址" align="center"> | |
| 44 | + <template slot-scope="scope"> | |
| 45 | + <span>{{ scope.row.address }}</span> | |
| 46 | + </template> | |
| 47 | + </el-table-column> | |
| 48 | + <el-table-column label="性别" align="center" v-if="false"> | |
| 49 | + <template slot-scope="scope"> | |
| 50 | + <el-tag :type="scope.row.sex==0?'success':'warn'"> | |
| 51 | + <span>{{ scope.row.sex==0?'男':'女'}}</span> | |
| 52 | + </el-tag> | |
| 53 | + </template> | |
| 54 | + </el-table-column> | |
| 55 | + <el-table-column label="生日" align="center" v-if="false"> | |
| 56 | + <template slot-scope="scope"> | |
| 57 | + <span>{{ scope.row.birthday }}</span> | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column label="用户角色" align="center"> | |
| 61 | + <template slot-scope="scope"> | |
| 62 | + <el-tag :key="scope.row.status" type="warning" effect="dark"> | |
| 63 | + 客户经理 | |
| 64 | + </el-tag> | |
| 65 | + </template> | |
| 66 | + </el-table-column> | |
| 67 | + <el-table-column label="用户状态" align="center"> | |
| 68 | + <template slot-scope="scope"> | |
| 69 | + <el-tag :key="scope.row.status" v-if="scope.row.status==='0'" type="success" effect="dark"> | |
| 70 | + 使用中 | |
| 71 | + </el-tag> | |
| 72 | + <el-tag :key="scope.row.status" v-if="scope.row.status==='-99'" type="danger" effect="dark"> | |
| 73 | + 禁用中 | |
| 74 | + </el-tag> | |
| 75 | + </template> | |
| 76 | + </el-table-column> | |
| 77 | + <el-table-column fixed="right" label="操作" width="250"> | |
| 78 | + <template slot-scope="scope"> | |
| 79 | + <!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> --> | |
| 80 | + <el-button type="text" size="small" @click="showUpdate(scope.row)">编辑 | |
| 81 | + </el-button> | |
| 82 | + <el-button type="text" size="small" @click="deleteInfo(scope.row.id)">删除 | |
| 83 | + </el-button> | |
| 84 | + <el-button type="text" size="small" @click="ShowCar(scope.row.id)">设为默认 | |
| 85 | + </el-button> | |
| 86 | + <el-button type="text" size="small" v-if="scope.row.status==0" @click="BlacklistSubmit(scope.row.id)">拉黑用户 | |
| 87 | + </el-button> | |
| 88 | + <el-button type="text" size="small" v-else @click="NoBlacklistSubmit(scope.row.id)">取消拉黑 | |
| 89 | + </el-button> | |
| 90 | + </template> | |
| 91 | + </el-table-column> | |
| 92 | + </el-table> | |
| 93 | + <el-pagination background layout="prev, pager, next" :total="total" @current-page="Pages" | |
| 94 | + style="text-align: right;margin-top: 10px;"> | |
| 95 | + </el-pagination> | |
| 96 | + <el-dialog title="编辑" :visible.sync="dialogVisible" width="50%"> | |
| 97 | + | |
| 98 | + <el-form ref="form" :model="form" label-width="80px" :rules="rules"> | |
| 99 | + <el-form-item label="账户名" prop="username"> | |
| 100 | + <el-input v-model="form.username"></el-input> | |
| 101 | + </el-form-item> | |
| 102 | + <el-form-item label="身份证号" prop="ID_card" v-if="false"> | |
| 103 | + <el-input v-model="form.ID_card"></el-input> | |
| 104 | + </el-form-item> | |
| 105 | + <el-form-item label="手机号" prop="phone"> | |
| 106 | + <el-input v-model="form.phone"></el-input> | |
| 107 | + </el-form-item> | |
| 108 | + <el-form-item label="地址" prop="address"> | |
| 109 | + <el-input v-model="form.address"></el-input> | |
| 110 | + </el-form-item> | |
| 111 | + <el-form-item label="备注" prop="remark"> | |
| 112 | + <el-input v-model="form.remark"></el-input> | |
| 113 | + </el-form-item> | |
| 114 | + <el-form-item label="性别" prop="sex"> | |
| 115 | + <!-- 0男 1-女 --> | |
| 116 | + <el-select v-model="form.sex" placeholder="请选择"> | |
| 117 | + <el-option label="男" value="0"></el-option> | |
| 118 | + <el-option label="女" value="1"></el-option> | |
| 119 | + </el-select> | |
| 120 | + </el-form-item> | |
| 121 | + <el-form-item label="生日" prop="birthday"> | |
| 122 | + <el-date-picker v-model="form.birthday" type="date" placeholder="选择日期"> | |
| 123 | + </el-date-picker> | |
| 124 | + </el-form-item> | |
| 125 | + </el-form> | |
| 126 | + | |
| 127 | + <span slot="footer" class="dialog-footer"> | |
| 128 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
| 129 | + <el-button type="primary" @click="UpdSubmit">确 定</el-button> | |
| 130 | + </span> | |
| 131 | + </el-dialog> | |
| 132 | + <el-dialog title="车辆信息" :visible.sync="dialogVisibleCar" width="50%"> | |
| 133 | + | |
| 134 | + <el-table :data="tableData" style="width: 100%"> | |
| 135 | + <el-table-column prop="date" label="ID" width="180" v-if="false"> | |
| 136 | + <template slot-scope="scope"> | |
| 137 | + {{scope.row.id}} | |
| 138 | + </template> | |
| 139 | + </el-table-column> | |
| 140 | + <el-table-column prop="date" label="用户ID" width="180" v-if="false"> | |
| 141 | + <template slot-scope="scope"> | |
| 142 | + {{scope.row.id}} | |
| 143 | + </template> | |
| 144 | + </el-table-column> | |
| 145 | + <el-table-column prop="date" label="车型" width="180"> | |
| 146 | + <template slot-scope="scope"> | |
| 147 | + {{scope.row.CarModel}} | |
| 148 | + </template> | |
| 149 | + </el-table-column> | |
| 150 | + <el-table-column prop="Scratch" label="漆面划痕" width="180"> | |
| 151 | + <template slot-scope="scope"> | |
| 152 | + {{scope.row.Scratch}} | |
| 153 | + </template> | |
| 154 | + </el-table-column> | |
| 155 | + <el-table-column prop="Corrosion" label="漆面腐蚀" width="180"> | |
| 156 | + <template slot-scope="scope"> | |
| 157 | + {{scope.row.Corrosion}} | |
| 158 | + </template> | |
| 159 | + </el-table-column> | |
| 160 | + <el-table-column prop="BeDamaged" label="漆面破损" width="180"> | |
| 161 | + <template slot-scope="scope"> | |
| 162 | + {{scope.row.BeDamaged}} | |
| 163 | + </template> | |
| 164 | + </el-table-column> | |
| 165 | + <el-table-column prop="FlyingPaint" label="沥青飞漆" width="180"> | |
| 166 | + <template slot-scope="scope"> | |
| 167 | + {{scope.row.FlyingPaint}} | |
| 168 | + </template> | |
| 169 | + </el-table-column> | |
| 170 | + <el-table-column prop="CarDefault" label="默认车辆" width="180"> | |
| 171 | + <template slot-scope="scope"> | |
| 172 | + <el-tag :type="scope.row.CarDefault==true?'success':'warn'"> | |
| 173 | + {{scope.row.CarDefault==true?'默认车辆':'非默认车辆'}} | |
| 174 | + </el-tag> | |
| 175 | + </template> | |
| 176 | + </el-table-column> | |
| 177 | + <el-table-column prop="AddTime" label="添加时间" width="180"> | |
| 178 | + <template slot-scope="scope"> | |
| 179 | + {{scope.row.AddTime}} | |
| 180 | + </template> | |
| 181 | + </el-table-column> | |
| 182 | + <el-table-column prop="UpdateTime" label="修改时间" width="180"> | |
| 183 | + <template slot-scope="scope"> | |
| 184 | + {{scope.row.UpdateTime}} | |
| 185 | + </template> | |
| 186 | + </el-table-column> | |
| 187 | + <el-table-column prop="UpdateTime" label="设为默认" width="180"> | |
| 188 | + <template slot-scope="scope"> | |
| 189 | + <el-button type="success" @click="SetDefault(scope.row)">设为默认</el-button> | |
| 190 | + </template> | |
| 191 | + </el-table-column> | |
| 192 | + </el-table> | |
| 193 | + <el-pagination background layout="prev, pager, next" :total="CarModel.TotalCount" @current-page="PagesCar" | |
| 194 | + style="text-align: right;margin-top: 10px;"> | |
| 195 | + </el-pagination> | |
| 196 | + <span slot="footer" class="dialog-footer"> | |
| 197 | + <el-button @click="dialogVisibleCar = false">取 消</el-button> | |
| 198 | + <el-button type="primary" @click="dialogVisibleCar = false">确 定</el-button> | |
| 199 | + </span> | |
| 200 | + </el-dialog> | |
| 201 | + </div> | |
| 202 | +</template> | |
| 203 | +<script> | |
| 204 | + import { | |
| 205 | + GetUserListBytManager, | |
| 206 | + DeleteUser, | |
| 207 | + Save, | |
| 208 | + Blacklist, | |
| 209 | + NoBlacklist | |
| 210 | + } from '@/api/user' | |
| 211 | + import { | |
| 212 | + GetVehicleListByUser, | |
| 213 | + UpdateCarDefault, | |
| 214 | + } from '../../api/VehicleManagement.js' | |
| 215 | + import utils from '../../utils/utils.js' | |
| 216 | + export default { | |
| 217 | + data() { | |
| 218 | + return { | |
| 219 | + tableData: [], | |
| 220 | + dialogVisible: false, | |
| 221 | + dialogVisibleCar: false, | |
| 222 | + CarModel: { | |
| 223 | + "UserId": 0, | |
| 224 | + "KeyWord": "", | |
| 225 | + "TotalCount": 0, | |
| 226 | + "PageIndex": 1, | |
| 227 | + "PageSize": 10, | |
| 228 | + "Sort": [{ | |
| 229 | + "Field": "id", | |
| 230 | + "Type": 0 | |
| 231 | + }] | |
| 232 | + }, | |
| 233 | + // 默认 | |
| 234 | + CarDefaultModel: { | |
| 235 | + "id": 0, | |
| 236 | + "UserId": 0 | |
| 237 | + }, | |
| 238 | + rules: { | |
| 239 | + username: [{ | |
| 240 | + required: true, | |
| 241 | + message: '请输入账户名', | |
| 242 | + trigger: 'blur' | |
| 243 | + }], | |
| 244 | + // ID_card: [{ | |
| 245 | + // required: true, | |
| 246 | + // message: '请输入身份证号码', | |
| 247 | + // trigger: 'blur' | |
| 248 | + // }, { | |
| 249 | + // min: 6, | |
| 250 | + // max: 30, | |
| 251 | + // message: '长度在 6 到 30 个字符' | |
| 252 | + // }, { | |
| 253 | + // pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/, | |
| 254 | + // message: '请输入正确的身份证号码' | |
| 255 | + // }], | |
| 256 | + phone: [{ | |
| 257 | + required: true, | |
| 258 | + message: '请输入电话号码', | |
| 259 | + trigger: 'blur' | |
| 260 | + }, { | |
| 261 | + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, | |
| 262 | + message: '请输入正确的手机号格式' | |
| 263 | + }], | |
| 264 | + address: [{ | |
| 265 | + required: true, | |
| 266 | + message: '请输入地址', | |
| 267 | + trigger: 'blur' | |
| 268 | + }], | |
| 269 | + sex: [{ | |
| 270 | + required: true, | |
| 271 | + message: '请选择年龄', | |
| 272 | + trigger: 'blur' | |
| 273 | + }], | |
| 274 | + birthday: [{ | |
| 275 | + required: true, | |
| 276 | + message: '请选择生日', | |
| 277 | + trigger: 'blur' | |
| 278 | + }], | |
| 279 | + | |
| 280 | + }, | |
| 281 | + userlist: [], | |
| 282 | + listLoading: true, | |
| 283 | + parameter: { | |
| 284 | + pageIndex: 1, | |
| 285 | + pageSize: 10, | |
| 286 | + sort: "id", | |
| 287 | + sortOrder: 2, | |
| 288 | + keyword: "", | |
| 289 | + status: 1 | |
| 290 | + }, | |
| 291 | + total: 0, | |
| 292 | + form: { | |
| 293 | + "ParentUserId": 0, | |
| 294 | + "InviteeUserId": 0, | |
| 295 | + "beijintupian": "", | |
| 296 | + "birthday": "", | |
| 297 | + "ID_card": "", | |
| 298 | + "address": "", | |
| 299 | + "id": 0, | |
| 300 | + "username": "", | |
| 301 | + "password": "", | |
| 302 | + "author": "", | |
| 303 | + "status": "", | |
| 304 | + "type": 0, | |
| 305 | + "full_name": "", | |
| 306 | + "add_time": "2022-01-20T13:27:24.548Z", | |
| 307 | + "update_time": "2022-01-20T13:27:24.548Z", | |
| 308 | + "remark": "", | |
| 309 | + "avatar": "", | |
| 310 | + "phone": "", | |
| 311 | + "openid": "", | |
| 312 | + "sex": "", | |
| 313 | + "balance": 0 | |
| 314 | + } | |
| 315 | + } | |
| 316 | + }, | |
| 317 | + | |
| 318 | + created() {}, | |
| 319 | + mounted() { | |
| 320 | + this.GetUserListBytManagerHeadler(); | |
| 321 | + }, | |
| 322 | + methods: { | |
| 323 | + // 拉黑用户 | |
| 324 | + BlacklistSubmit(id){ | |
| 325 | + Blacklist(id).then(res=>{ | |
| 326 | + console.log('数据',res) | |
| 327 | + if(res.data.code==200){ | |
| 328 | + this.$message.success('拉黑成功') | |
| 329 | + this.GetUserListBytManagerHeadler() | |
| 330 | + }else{ | |
| 331 | + this.$message.error('拉黑失败') | |
| 332 | + } | |
| 333 | + }) | |
| 334 | + }, | |
| 335 | + NoBlacklistSubmit(id){ | |
| 336 | + NoBlacklist(id).then(res=>{ | |
| 337 | + if(res.data.code==200){ | |
| 338 | + this.$message.success('取消拉黑成功') | |
| 339 | + this.GetUserListBytManagerHeadler() | |
| 340 | + }else{ | |
| 341 | + this.$message.error('取消拉黑失败') | |
| 342 | + } | |
| 343 | + }) | |
| 344 | + }, | |
| 345 | + // 修改信息 | |
| 346 | + showUpdate(item) { | |
| 347 | + this.dialogVisible = true | |
| 348 | + this.form.birthday = item.birthday | |
| 349 | + this.form.ID_card = item.ID_card | |
| 350 | + this.form.address = item.address | |
| 351 | + this.form.id = item.id | |
| 352 | + this.form.username = item.username | |
| 353 | + this.form.add_time = item.add_time | |
| 354 | + this.form.update_time = item.update_time | |
| 355 | + this.form.remark = item.remark | |
| 356 | + this.form.phone = item.phone | |
| 357 | + this.form.sex = item.sex | |
| 358 | + // ------------------- | |
| 359 | + this.form.InviteeUserId = item.InviteeUserId | |
| 360 | + this.form.ParentUserId = item.ParentUserId | |
| 361 | + this.form.beijintupian = item.beijintupian | |
| 362 | + this.form.password = item.password | |
| 363 | + this.form.author = item.author | |
| 364 | + this.form.status = item.status | |
| 365 | + this.form.type = item.type | |
| 366 | + this.form.full_name = item.full_name | |
| 367 | + this.form.avatar = item.avatar | |
| 368 | + this.form.openid = item.openid | |
| 369 | + this.form.balance = item.balance | |
| 370 | + }, | |
| 371 | + // 设为默认车辆 | |
| 372 | + SetDefault(item) { | |
| 373 | + console.log('数据', item) | |
| 374 | + if (item.CarDefault == true) { | |
| 375 | + this.$message.error('该车辆已是默认车辆') | |
| 376 | + } else { | |
| 377 | + this.CarDefaultModel.id = item.id | |
| 378 | + this.CarDefaultModel.UserId = this.CarModel.UserId | |
| 379 | + UpdateCarDefault(this.CarDefaultModel).then(res => { | |
| 380 | + console.log('默认', res) | |
| 381 | + if (res.data.code == 200) { | |
| 382 | + this.$message.success('修改默认车辆成功') | |
| 383 | + this.ShowCar() | |
| 384 | + } else { | |
| 385 | + this.$message.error(res.data.message) | |
| 386 | + } | |
| 387 | + }) | |
| 388 | + } | |
| 389 | + }, | |
| 390 | + PagesCar(e) { | |
| 391 | + this.CarModel.PageIndex = e | |
| 392 | + this.ShowCar() | |
| 393 | + }, | |
| 394 | + // 查询车辆信息 | |
| 395 | + ShowCar(id) { | |
| 396 | + console.log('车辆ID', id) | |
| 397 | + this.CarModel.UserId = id | |
| 398 | + this.dialogVisibleCar = true | |
| 399 | + GetVehicleListByUser(this.CarModel).then(res => { | |
| 400 | + console.log('车辆信息', res) | |
| 401 | + if (res.data.code == 200) { | |
| 402 | + res.data.data.rows.forEach((item, index) => { | |
| 403 | + item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss") | |
| 404 | + item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd HH:mm:ss") | |
| 405 | + }) | |
| 406 | + this.tableData = res.data.data.rows | |
| 407 | + this.CarModel.TotalCount = res.data.data.total | |
| 408 | + } | |
| 409 | + }) | |
| 410 | + }, | |
| 411 | + UpdSubmit() { | |
| 412 | + // 信息修改提交 | |
| 413 | + this.$refs.form.validate((valid) => { | |
| 414 | + if (valid) { | |
| 415 | + Save(this.form).then(res => { | |
| 416 | + console.log('提交', res) | |
| 417 | + if (res.data.code == 200) { | |
| 418 | + this.$message.success('修改成功') | |
| 419 | + this.dialogVisible = false | |
| 420 | + this.GetUserListBytManagerHeadler() | |
| 421 | + } else { | |
| 422 | + this.$message.error('修改失败') | |
| 423 | + } | |
| 424 | + }) | |
| 425 | + } | |
| 426 | + }) | |
| 427 | + }, | |
| 428 | + Pages(e) { | |
| 429 | + this.parameter.pageIndex = e | |
| 430 | + this.GetUserListBytManagerHeadler() | |
| 431 | + }, | |
| 432 | + onSubmit() { | |
| 433 | + this.GetUserListBytManagerHeadler() | |
| 434 | + }, | |
| 435 | + deleteInfo(id) { | |
| 436 | + DeleteUser({ | |
| 437 | + ids: id | |
| 438 | + }).then(res => { | |
| 439 | + console.log('res', res) | |
| 440 | + if (res.data.code == 200) { | |
| 441 | + this.$message.success('删除成功') | |
| 442 | + this.GetUserListBytManagerHeadler() | |
| 443 | + } else { | |
| 444 | + this.$message.error('删除失败') | |
| 445 | + } | |
| 446 | + }) | |
| 447 | + }, | |
| 448 | + GetUserListBytManagerHeadler() { | |
| 449 | + GetUserListBytManager(this.parameter).then(res => { | |
| 450 | + this.total = res.data.data.total | |
| 451 | + res.data.data.rows.forEach((item, index) => { | |
| 452 | + item.birthday = utils.formatTime(item.birthday, "yyyy-MM-dd") | |
| 453 | + }) | |
| 454 | + this.userlist = res.data.data.rows; | |
| 455 | + this.listLoading = false; | |
| 456 | + }); | |
| 457 | + } | |
| 458 | + } | |
| 459 | + } | |
| 460 | +</script> | |
| 461 | + | |
| 462 | +<style> | |
| 463 | +</style> | ... | ... |
src/views/user/userlist.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <el-upload | |
| 4 | + class="upload-demo" | |
| 5 | + action="/api/Account/ImportUser" | |
| 6 | + :on-preview="handlePreview" | |
| 7 | + :on-remove="handleRemove" | |
| 8 | + :before-remove="beforeRemove" | |
| 9 | + multiple | |
| 10 | + :limit="3" | |
| 11 | + :on-exceed="handleExceed" | |
| 12 | + :file-list="fileList"> | |
| 13 | + <el-button size="small" type="primary">导入用户</el-button> | |
| 14 | + </el-upload> | |
| 15 | + </div> | |
| 16 | +</template> | |
| 17 | + | |
| 18 | +<script> | |
| 19 | + import { | |
| 20 | + ImportUserByExcel | |
| 21 | + } from '@/api/user' | |
| 22 | + export default { | |
| 23 | + methods:{ | |
| 24 | + ImportUser(){ | |
| 25 | + | |
| 26 | + } | |
| 27 | + } | |
| 28 | + } | |
| 29 | +</script> | |
| 30 | + | |
| 31 | +<style> | |
| 32 | +</style> | ... | ... |
tests/unit/.eslintrc.js
0 → 100644
tests/unit/components/Breadcrumb.spec.js
0 → 100644
| 1 | +import { mount, createLocalVue } from '@vue/test-utils' | |
| 2 | +import VueRouter from 'vue-router' | |
| 3 | +import ElementUI from 'element-ui' | |
| 4 | +import Breadcrumb from '@/components/Breadcrumb/index.vue' | |
| 5 | + | |
| 6 | +const localVue = createLocalVue() | |
| 7 | +localVue.use(VueRouter) | |
| 8 | +localVue.use(ElementUI) | |
| 9 | + | |
| 10 | +const routes = [ | |
| 11 | + { | |
| 12 | + path: '/', | |
| 13 | + name: 'home', | |
| 14 | + children: [{ | |
| 15 | + path: 'dashboard', | |
| 16 | + name: 'dashboard' | |
| 17 | + }] | |
| 18 | + }, | |
| 19 | + { | |
| 20 | + path: '/menu', | |
| 21 | + name: 'menu', | |
| 22 | + children: [{ | |
| 23 | + path: 'menu1', | |
| 24 | + name: 'menu1', | |
| 25 | + meta: { title: 'menu1' }, | |
| 26 | + children: [{ | |
| 27 | + path: 'menu1-1', | |
| 28 | + name: 'menu1-1', | |
| 29 | + meta: { title: 'menu1-1' } | |
| 30 | + }, | |
| 31 | + { | |
| 32 | + path: 'menu1-2', | |
| 33 | + name: 'menu1-2', | |
| 34 | + redirect: 'noredirect', | |
| 35 | + meta: { title: 'menu1-2' }, | |
| 36 | + children: [{ | |
| 37 | + path: 'menu1-2-1', | |
| 38 | + name: 'menu1-2-1', | |
| 39 | + meta: { title: 'menu1-2-1' } | |
| 40 | + }, | |
| 41 | + { | |
| 42 | + path: 'menu1-2-2', | |
| 43 | + name: 'menu1-2-2' | |
| 44 | + }] | |
| 45 | + }] | |
| 46 | + }] | |
| 47 | + }] | |
| 48 | + | |
| 49 | +const router = new VueRouter({ | |
| 50 | + routes | |
| 51 | +}) | |
| 52 | + | |
| 53 | +describe('Breadcrumb.vue', () => { | |
| 54 | + const wrapper = mount(Breadcrumb, { | |
| 55 | + localVue, | |
| 56 | + router | |
| 57 | + }) | |
| 58 | + it('dashboard', () => { | |
| 59 | + router.push('/dashboard') | |
| 60 | + const len = wrapper.findAll('.el-breadcrumb__inner').length | |
| 61 | + expect(len).toBe(1) | |
| 62 | + }) | |
| 63 | + it('normal route', () => { | |
| 64 | + router.push('/menu/menu1') | |
| 65 | + const len = wrapper.findAll('.el-breadcrumb__inner').length | |
| 66 | + expect(len).toBe(2) | |
| 67 | + }) | |
| 68 | + it('nested route', () => { | |
| 69 | + router.push('/menu/menu1/menu1-2/menu1-2-1') | |
| 70 | + const len = wrapper.findAll('.el-breadcrumb__inner').length | |
| 71 | + expect(len).toBe(4) | |
| 72 | + }) | |
| 73 | + it('no meta.title', () => { | |
| 74 | + router.push('/menu/menu1/menu1-2/menu1-2-2') | |
| 75 | + const len = wrapper.findAll('.el-breadcrumb__inner').length | |
| 76 | + expect(len).toBe(3) | |
| 77 | + }) | |
| 78 | + // it('click link', () => { | |
| 79 | + // router.push('/menu/menu1/menu1-2/menu1-2-2') | |
| 80 | + // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') | |
| 81 | + // const second = breadcrumbArray.at(1) | |
| 82 | + // console.log(breadcrumbArray) | |
| 83 | + // const href = second.find('a').attributes().href | |
| 84 | + // expect(href).toBe('#/menu/menu1') | |
| 85 | + // }) | |
| 86 | + // it('noRedirect', () => { | |
| 87 | + // router.push('/menu/menu1/menu1-2/menu1-2-1') | |
| 88 | + // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') | |
| 89 | + // const redirectBreadcrumb = breadcrumbArray.at(2) | |
| 90 | + // expect(redirectBreadcrumb.contains('a')).toBe(false) | |
| 91 | + // }) | |
| 92 | + it('last breadcrumb', () => { | |
| 93 | + router.push('/menu/menu1/menu1-2/menu1-2-1') | |
| 94 | + const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') | |
| 95 | + const redirectBreadcrumb = breadcrumbArray.at(3) | |
| 96 | + expect(redirectBreadcrumb.contains('a')).toBe(false) | |
| 97 | + }) | |
| 98 | +}) | ... | ... |
tests/unit/components/Hamburger.spec.js
0 → 100644
| 1 | +import { shallowMount } from '@vue/test-utils' | |
| 2 | +import Hamburger from '@/components/Hamburger/index.vue' | |
| 3 | +describe('Hamburger.vue', () => { | |
| 4 | + it('toggle click', () => { | |
| 5 | + const wrapper = shallowMount(Hamburger) | |
| 6 | + const mockFn = jest.fn() | |
| 7 | + wrapper.vm.$on('toggleClick', mockFn) | |
| 8 | + wrapper.find('.hamburger').trigger('click') | |
| 9 | + expect(mockFn).toBeCalled() | |
| 10 | + }) | |
| 11 | + it('prop isActive', () => { | |
| 12 | + const wrapper = shallowMount(Hamburger) | |
| 13 | + wrapper.setProps({ isActive: true }) | |
| 14 | + expect(wrapper.contains('.is-active')).toBe(true) | |
| 15 | + wrapper.setProps({ isActive: false }) | |
| 16 | + expect(wrapper.contains('.is-active')).toBe(false) | |
| 17 | + }) | |
| 18 | +}) | ... | ... |
tests/unit/components/SvgIcon.spec.js
0 → 100644
| 1 | +import { shallowMount } from '@vue/test-utils' | |
| 2 | +import SvgIcon from '@/components/SvgIcon/index.vue' | |
| 3 | +describe('SvgIcon.vue', () => { | |
| 4 | + it('iconClass', () => { | |
| 5 | + const wrapper = shallowMount(SvgIcon, { | |
| 6 | + propsData: { | |
| 7 | + iconClass: 'test' | |
| 8 | + } | |
| 9 | + }) | |
| 10 | + expect(wrapper.find('use').attributes().href).toBe('#icon-test') | |
| 11 | + }) | |
| 12 | + it('className', () => { | |
| 13 | + const wrapper = shallowMount(SvgIcon, { | |
| 14 | + propsData: { | |
| 15 | + iconClass: 'test' | |
| 16 | + } | |
| 17 | + }) | |
| 18 | + expect(wrapper.classes().length).toBe(1) | |
| 19 | + wrapper.setProps({ className: 'test' }) | |
| 20 | + expect(wrapper.classes().includes('test')).toBe(true) | |
| 21 | + }) | |
| 22 | +}) | ... | ... |
tests/unit/utils/formatTime.spec.js
0 → 100644
| 1 | +import { formatTime } from '@/utils/index.js' | |
| 2 | + | |
| 3 | +describe('Utils:formatTime', () => { | |
| 4 | + const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" | |
| 5 | + const retrofit = 5 * 1000 | |
| 6 | + | |
| 7 | + it('ten digits timestamp', () => { | |
| 8 | + expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分') | |
| 9 | + }) | |
| 10 | + it('test now', () => { | |
| 11 | + expect(formatTime(+new Date() - 1)).toBe('刚刚') | |
| 12 | + }) | |
| 13 | + it('less two minute', () => { | |
| 14 | + expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前') | |
| 15 | + }) | |
| 16 | + it('less two hour', () => { | |
| 17 | + expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前') | |
| 18 | + }) | |
| 19 | + it('less one day', () => { | |
| 20 | + expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前') | |
| 21 | + }) | |
| 22 | + it('more than one day', () => { | |
| 23 | + expect(formatTime(d)).toBe('7月13日17时54分') | |
| 24 | + }) | |
| 25 | + it('format', () => { | |
| 26 | + expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') | |
| 27 | + expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') | |
| 28 | + expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') | |
| 29 | + }) | |
| 30 | +}) | ... | ... |
tests/unit/utils/param2Obj.spec.js
0 → 100644
| 1 | +import { param2Obj } from '@/utils/index.js' | |
| 2 | +describe('Utils:param2Obj', () => { | |
| 3 | + const url = 'https://github.com/PanJiaChen/vue-element-admin?name=bill&age=29&sex=1&field=dGVzdA==&key=%E6%B5%8B%E8%AF%95' | |
| 4 | + | |
| 5 | + it('param2Obj test', () => { | |
| 6 | + expect(param2Obj(url)).toEqual({ | |
| 7 | + name: 'bill', | |
| 8 | + age: '29', | |
| 9 | + sex: '1', | |
| 10 | + field: window.btoa('test'), | |
| 11 | + key: '测试' | |
| 12 | + }) | |
| 13 | + }) | |
| 14 | +}) | ... | ... |
tests/unit/utils/parseTime.spec.js
0 → 100644
| 1 | +import { parseTime } from '@/utils/index.js' | |
| 2 | + | |
| 3 | +describe('Utils:parseTime', () => { | |
| 4 | + const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" | |
| 5 | + it('timestamp', () => { | |
| 6 | + expect(parseTime(d)).toBe('2018-07-13 17:54:01') | |
| 7 | + }) | |
| 8 | + it('timestamp string', () => { | |
| 9 | + expect(parseTime((d + ''))).toBe('2018-07-13 17:54:01') | |
| 10 | + }) | |
| 11 | + it('ten digits timestamp', () => { | |
| 12 | + expect(parseTime((d / 1000).toFixed(0))).toBe('2018-07-13 17:54:01') | |
| 13 | + }) | |
| 14 | + it('new Date', () => { | |
| 15 | + expect(parseTime(new Date(d))).toBe('2018-07-13 17:54:01') | |
| 16 | + }) | |
| 17 | + it('format', () => { | |
| 18 | + expect(parseTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') | |
| 19 | + expect(parseTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') | |
| 20 | + expect(parseTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') | |
| 21 | + }) | |
| 22 | + it('get the day of the week', () => { | |
| 23 | + expect(parseTime(d, '{a}')).toBe('五') // 星期五 | |
| 24 | + }) | |
| 25 | + it('get the day of the week', () => { | |
| 26 | + expect(parseTime(+d + 1000 * 60 * 60 * 24 * 2, '{a}')).toBe('日') // 星期日 | |
| 27 | + }) | |
| 28 | + it('empty argument', () => { | |
| 29 | + expect(parseTime()).toBeNull() | |
| 30 | + }) | |
| 31 | + | |
| 32 | + it('null', () => { | |
| 33 | + expect(parseTime(null)).toBeNull() | |
| 34 | + }) | |
| 35 | +}) | ... | ... |
tests/unit/utils/validate.spec.js
0 → 100644
| 1 | +import { validUsername, isExternal } from '@/utils/validate.js' | |
| 2 | + | |
| 3 | +describe('Utils:validate', () => { | |
| 4 | + it('validUsername', () => { | |
| 5 | + expect(validUsername('admin')).toBe(true) | |
| 6 | + expect(validUsername('editor')).toBe(true) | |
| 7 | + expect(validUsername('xxxx')).toBe(false) | |
| 8 | + }) | |
| 9 | + it('isExternal', () => { | |
| 10 | + expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) | |
| 11 | + expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) | |
| 12 | + expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false) | |
| 13 | + expect(isExternal('/dashboard')).toBe(false) | |
| 14 | + expect(isExternal('./dashboard')).toBe(false) | |
| 15 | + expect(isExternal('dashboard')).toBe(false) | |
| 16 | + }) | |
| 17 | +}) | ... | ... |
vue.config.js
0 → 100644
| 1 | +'use strict' | |
| 2 | +const path = require('path') | |
| 3 | +const defaultSettings = require('./src/settings.js') | |
| 4 | + | |
| 5 | +function resolve(dir) { | |
| 6 | + return path.join(__dirname, dir) | |
| 7 | +} | |
| 8 | + | |
| 9 | +const name = defaultSettings.title || 'vue Admin Template' // page title | |
| 10 | + | |
| 11 | +// If your port is set to 80, | |
| 12 | +// use administrator privileges to execute the command line. | |
| 13 | +// For example, Mac: sudo npm run | |
| 14 | +// You can change the port by the following methods: | |
| 15 | +// port = 9528 npm run dev OR npm run dev --port = 9528 | |
| 16 | +const port = process.env.port || process.env.npm_config_port || 9528 // dev port | |
| 17 | + | |
| 18 | +// All configuration item explanations can be find in https://cli.vuejs.org/config/ | |
| 19 | +module.exports = { | |
| 20 | + /** | |
| 21 | + * You will need to set publicPath if you plan to deploy your site under a sub path, | |
| 22 | + * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/, | |
| 23 | + * then publicPath should be set to "/bar/". | |
| 24 | + * In most cases please use '/' !!! | |
| 25 | + * Detail: https://cli.vuejs.org/config/#publicpath | |
| 26 | + */ | |
| 27 | + publicPath: '/', | |
| 28 | + outputDir: 'dist', | |
| 29 | + assetsDir: 'static', | |
| 30 | + lintOnSave: process.env.NODE_ENV === 'development', | |
| 31 | + productionSourceMap: false, | |
| 32 | + devServer: { | |
| 33 | + port: port, | |
| 34 | + open: true, | |
| 35 | + overlay: { | |
| 36 | + warnings: false, | |
| 37 | + errors: true | |
| 38 | + }, | |
| 39 | + proxy: { | |
| 40 | + '/development': { | |
| 41 | + // target: `http://localhost:8031/`, //后台服务地址 | |
| 42 | + // target: `https://shangteng.antissoft.com/`, | |
| 43 | + target: `https://shangten.yiqituancity.com/`, | |
| 44 | + changeOrigin: true, | |
| 45 | + pathRewrite: { | |
| 46 | + '^/development': '' | |
| 47 | + } | |
| 48 | + }, | |
| 49 | + '/api': { | |
| 50 | + // target: `http://localhost:8031/`, //后台服务地址 | |
| 51 | + // target: `https://shangteng.antissoft.com/`, | |
| 52 | + target: `https://shangten.yiqituancity.com/`, | |
| 53 | + changeOrigin: true, | |
| 54 | + pathRewrite: {} | |
| 55 | + } | |
| 56 | + }, | |
| 57 | + }, | |
| 58 | + configureWebpack: { | |
| 59 | + // provide the app's title in webpack's name field, so that | |
| 60 | + // it can be accessed in index.html to inject the correct title. | |
| 61 | + name: name, | |
| 62 | + resolve: { | |
| 63 | + alias: { | |
| 64 | + '@': resolve('src') | |
| 65 | + } | |
| 66 | + } | |
| 67 | + }, | |
| 68 | + chainWebpack(config) { | |
| 69 | + // it can improve the speed of the first screen, it is recommended to turn on preload | |
| 70 | + config.plugin('preload').tap(() => [{ | |
| 71 | + rel: 'preload', | |
| 72 | + // to ignore runtime.js | |
| 73 | + // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171 | |
| 74 | + fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], | |
| 75 | + include: 'initial' | |
| 76 | + }]) | |
| 77 | + | |
| 78 | + // when there are many pages, it will cause too many meaningless requests | |
| 79 | + config.plugins.delete('prefetch') | |
| 80 | + | |
| 81 | + // set svg-sprite-loader | |
| 82 | + config.module | |
| 83 | + .rule('svg') | |
| 84 | + .exclude.add(resolve('src/icons')) | |
| 85 | + .end() | |
| 86 | + config.module | |
| 87 | + .rule('icons') | |
| 88 | + .test(/\.svg$/) | |
| 89 | + .include.add(resolve('src/icons')) | |
| 90 | + .end() | |
| 91 | + .use('svg-sprite-loader') | |
| 92 | + .loader('svg-sprite-loader') | |
| 93 | + .options({ | |
| 94 | + symbolId: 'icon-[name]' | |
| 95 | + }) | |
| 96 | + .end() | |
| 97 | + | |
| 98 | + config | |
| 99 | + .when(process.env.NODE_ENV !== 'development', | |
| 100 | + config => { | |
| 101 | + config | |
| 102 | + .plugin('ScriptExtHtmlWebpackPlugin') | |
| 103 | + .after('html') | |
| 104 | + .use('script-ext-html-webpack-plugin', [{ | |
| 105 | + // `runtime` must same as runtimeChunk name. default is `runtime` | |
| 106 | + inline: /runtime\..*\.js$/ | |
| 107 | + }]) | |
| 108 | + .end() | |
| 109 | + config | |
| 110 | + .optimization.splitChunks({ | |
| 111 | + chunks: 'all', | |
| 112 | + cacheGroups: { | |
| 113 | + libs: { | |
| 114 | + name: 'chunk-libs', | |
| 115 | + test: /[\\/]node_modules[\\/]/, | |
| 116 | + priority: 10, | |
| 117 | + chunks: 'initial' // only package third parties that are initially dependent | |
| 118 | + }, | |
| 119 | + elementUI: { | |
| 120 | + name: 'chunk-elementUI', // split elementUI into a single package | |
| 121 | + priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app | |
| 122 | + test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm | |
| 123 | + }, | |
| 124 | + commons: { | |
| 125 | + name: 'chunk-commons', | |
| 126 | + test: resolve('src/components'), // can customize your rules | |
| 127 | + minChunks: 3, // minimum common number | |
| 128 | + priority: 5, | |
| 129 | + reuseExistingChunk: true | |
| 130 | + } | |
| 131 | + } | |
| 132 | + }) | |
| 133 | + // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk | |
| 134 | + config.optimization.runtimeChunk('single') | |
| 135 | + } | |
| 136 | + ) | |
| 137 | + } | |
| 138 | +} | ... | ... |