yuantianjiao 6 年前
父节点
当前提交
6371c4c4e7
共有 26 个文件被更改,包括 13323 次插入0 次删除
  1. 21
    0
      .gitignore
  2. 21
    0
      README.md
  3. 5
    0
      babel.config.js
  4. 11791
    0
      package-lock.json
  5. 54
    0
      package.json
  6. 二进制
      public/favicon.ico
  7. 17
    0
      public/index.html
  8. 15
    0
      src/App.vue
  9. 88
    0
      src/assets/reset.css
  10. 7
    0
      src/config/index.js
  11. 19
    0
      src/main.js
  12. 17
    0
      src/router.js
  13. 28
    0
      src/store/index.js
  14. 54
    0
      src/store/login.js
  15. 104
    0
      src/store/main.js
  16. 109
    0
      src/store/management.js
  17. 122
    0
      src/store/material.js
  18. 245
    0
      src/store/menuConfig.js
  19. 150
    0
      src/store/reply.js
  20. 121
    0
      src/store/user.js
  21. 117
    0
      src/util/ajax.js
  22. 15
    0
      src/util/api.js
  23. 78
    0
      src/util/share.js
  24. 102
    0
      src/util/util.js
  25. 0
    0
      src/views/supportMain/supportMain.vue
  26. 23
    0
      vue.config.js

+ 21
- 0
.gitignore 查看文件

1
+.DS_Store
2
+node_modules
3
+/dist
4
+
5
+# local env files
6
+.env.local
7
+.env.*.local
8
+
9
+# Log files
10
+npm-debug.log*
11
+yarn-debug.log*
12
+yarn-error.log*
13
+
14
+# Editor directories and files
15
+.idea
16
+.vscode
17
+*.suo
18
+*.ntvs*
19
+*.njsproj
20
+*.sln
21
+*.sw*

+ 21
- 0
README.md 查看文件

1
+# hello-world
2
+
3
+## Project setup
4
+```
5
+npm install
6
+```
7
+
8
+### Compiles and hot-reloads for development
9
+```
10
+npm run serve
11
+```
12
+
13
+### Compiles and minifies for production
14
+```
15
+npm run build
16
+```
17
+
18
+### Lints and fixes files
19
+```
20
+npm run lint
21
+```

+ 5
- 0
babel.config.js 查看文件

1
+module.exports = {
2
+  presets: [
3
+    '@vue/app'
4
+  ]
5
+}

+ 11791
- 0
package-lock.json
文件差异内容过多而无法显示
查看文件


+ 54
- 0
package.json 查看文件

1
+{
2
+  "name": "hello-world",
3
+  "version": "0.1.0",
4
+  "private": true,
5
+  "scripts": {
6
+    "serve": "vue-cli-service serve",
7
+    "build": "vue-cli-service build",
8
+    "lint": "vue-cli-service lint"
9
+  },
10
+  "dependencies": {
11
+    "vue": "^2.5.17",
12
+    "vue-router": "^3.0.1",
13
+    "vuex": "^3.0.1"
14
+  },
15
+  "devDependencies": {
16
+    "@vue/cli-plugin-babel": "^3.0.1",
17
+    "@vue/cli-plugin-eslint": "^3.0.1",
18
+    "@vue/cli-service": "^3.0.1",
19
+    "axios": "^0.18.0",
20
+    "babel-eslint": "^10.0.1",
21
+    "eslint": "^5.8.0",
22
+    "eslint-plugin-vue": "^5.0.0-0",
23
+    "node-sass": "^4.9.0",
24
+    "sass-loader": "^7.0.1",
25
+    "vant": "^1.4.8",
26
+    "vue-template-compiler": "^2.5.17"
27
+  },
28
+  "eslintConfig": {
29
+    "root": true,
30
+    "env": {
31
+      "node": true
32
+    },
33
+    "extends": [
34
+      "plugin:vue/essential",
35
+      "eslint:recommended"
36
+    ],
37
+    "rules": {
38
+      "no-console": 1
39
+    },
40
+    "parserOptions": {
41
+      "parser": "babel-eslint"
42
+    }
43
+  },
44
+  "postcss": {
45
+    "plugins": {
46
+      "autoprefixer": {}
47
+    }
48
+  },
49
+  "browserslist": [
50
+    "> 1%",
51
+    "last 2 versions",
52
+    "not ie <= 8"
53
+  ]
54
+}

二进制
public/favicon.ico 查看文件


+ 17
- 0
public/index.html 查看文件

1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
+    <title>hello-world</title>
9
+  </head>
10
+  <body>
11
+    <noscript>
12
+      <strong>We're sorry but hello-world doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13
+    </noscript>
14
+    <div id="app"></div>
15
+    <!-- built files will be auto injected -->
16
+  </body>
17
+</html>

+ 15
- 0
src/App.vue 查看文件

1
+<template>
2
+  <div id="app">
3
+    <router-view/>
4
+  </div>
5
+</template>
6
+
7
+<style lang="scss">
8
+#app {
9
+  font-family: "Avenir", Helvetica, Arial, sans-serif;
10
+  -webkit-font-smoothing: antialiased;
11
+  -moz-osx-font-smoothing: grayscale;
12
+  text-align: center;
13
+  color: #2c3e50;
14
+}
15
+</style>

+ 88
- 0
src/assets/reset.css 查看文件

1
+@charset "utf-8";
2
+html,body{width:100%;height:100%;-webkit-text-size-adjust:100%;position:relative;color:#333;overflow-x:hidden;font-size:100px;}
3
+@media screen and (max-width:320px){html,body{font-size:85px;}}
4
+@media screen and (min-width:375px){html,body{font-size:100px;}}
5
+@media screen and (min-width:414px){html,body{font-size:110px;}}
6
+*{margin:0;padding:0;color:#000;font-family:"微软雅黑";-webkit-tap-highlight-color:rgba(255,0,0,0);-webkit-font-smoothing:antialiased;}
7
+body *{font-size:.13rem;}
8
+a{text-decoration:none;}
9
+a:hover{cursor:pointer;}
10
+em{font-style:normal;}
11
+li{list-style:none;}
12
+img{border:0;vertical-align:middle;}
13
+table{border-collapse:collapse;border-spacing:0;}
14
+p{word-wrap:break-word;}
15
+b{font-weight:normal;}
16
+input,textarea{border:0;-webkit-appearance:none;}
17
+input[type=input]{-webkit-appearance:none;}
18
+input[type=checkbox]{-webkit-appearance:checkbox;}
19
+.text-overflow-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
20
+.centerLabel{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);}
21
+.flex-h{display:flex;display:-webkit-flex;}
22
+.flex-v{display:flex;display:-webkit-flex;flex-direction:column;-webkit-flex-direction:column;}
23
+.flex-item{flex:1;-webkit-flex:1;position:relative;overflow:hidden;}
24
+*[class*="text-overflowEllipsis-line"]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;}
25
+.text-overflowEllipsis-line2{-webkit-line-clamp:2;}
26
+.text-overflowEllipsis-line3{-webkit-line-clamp:3;}
27
+.text-overflowEllipsis-line4{-webkit-line-clamp:4;}
28
+*[class*="overflow-scroll-y"]{overflow-x:hidden;overflow-y:scroll;-webkit-overflow-scrolling:touch;}
29
+*[class*="overflow-scroll-x"]{overflow-y:hidden;overflow-x:scroll;-webkit-overflow-scrolling:touch;}
30
+.overflow-scroll-y-3d,.overflow-scroll-x-3d{transform:translateZ(0);-webkit-transform:translateZ(0);}
31
+.overflow-scroll-x::-webkit-scrollbar,.overflow-scroll-x-3d::-webkit-scrollbar{width:0;height:0;color:transparent;display:none;}
32
+input:focus,textarea:focus,select:focus {
33
+    outline:none;
34
+}
35
+textarea{
36
+	resize: none;
37
+}
38
+
39
+select{
40
+	direction: rtl;
41
+}
42
+
43
+select option {
44
+    direction: ltr;
45
+}
46
+
47
+*>img.cover{
48
+	width: 100%;
49
+	height: 100%;
50
+	object-fit: cover;
51
+}
52
+
53
+*>img.contain{
54
+	width: 100%;
55
+	height: 100%;
56
+	object-fit: contain;
57
+}
58
+
59
+.mainPage{
60
+	width: 100%;
61
+	height: 100%;
62
+	position: relative;
63
+	background: #fff;
64
+}
65
+
66
+.van-toast div{
67
+	color: white;
68
+}
69
+
70
+.van-picker{
71
+	z-index: 101;
72
+}
73
+
74
+.van-toast i{
75
+	color: white;
76
+}
77
+
78
+::-webkit-scrollbar {
79
+	display: none;
80
+}
81
+
82
+.van-dialog__message {
83
+  text-align: center;
84
+}
85
+
86
+.van-dialog__message .van-dialog__message--has-title{
87
+	text-align: center;
88
+}

+ 7
- 0
src/config/index.js 查看文件

1
+export default {
2
+  appid: 'wx7320287e057bbeee',
3
+  redirect_uri: encodeURIComponent(window.location.href),
4
+  response_type: 'code',
5
+  scope: 'snsapi_userinfo',
6
+  state: '12313'
7
+}

+ 19
- 0
src/main.js 查看文件

1
+import Vue from 'vue'
2
+import App from './App.vue'
3
+import router from './router'
4
+import store from './store/index.js'
5
+import Vant from 'vant'
6
+import 'vant/lib/index.css'
7
+import toolClass from '@/util/util'
8
+const Base64 = require('js-base64').Base64
9
+
10
+Vue.use(Vant)
11
+Vue.prototype.Base64 = Base64
12
+Vue.prototype.toolClass = toolClass
13
+Vue.config.productionTip = false
14
+
15
+new Vue({
16
+  router,
17
+  store,
18
+  render: h => h(App)
19
+}).$mount('#app')

+ 17
- 0
src/router.js 查看文件

1
+import Vue from 'vue'
2
+import Router from 'vue-router'
3
+
4
+Vue.use(Router)
5
+
6
+export default new Router({
7
+  routes: [
8
+    {
9
+      path: '/',
10
+      name: 'supportMain',
11
+      // route level code-splitting
12
+      // this generates a separate chunk (about.[hash].js) for this route
13
+      // which is lazy-loaded when the route is visited.
14
+      component: () => import(/* webpackChunkName: "about" */ './views/supportMain/supportMain.vue')
15
+    }
16
+  ]
17
+})

+ 28
- 0
src/store/index.js 查看文件

1
+import Vue from 'vue'
2
+import Vuex from 'vuex'
3
+
4
+Vue.use(Vuex)
5
+
6
+const store = new Vuex.Store({
7
+  state: {
8
+    loadding: false,
9
+    pageSize: 10,
10
+  }
11
+})
12
+export const modules = {
13
+  login: () => require('./login').default,
14
+  main: () => require('./main').default,
15
+  menuConfig: () => require('./menuConfig').default,
16
+  material: () => require('./material').default,
17
+  management: () => require('./management').default,
18
+  user: () => require('./user').default,
19
+  reply: () => require('./reply').default,
20
+}
21
+
22
+Object.keys(modules).forEach((modKey) => {
23
+  const modNS = modKey.split('/')
24
+  const getMod = modules[modKey]
25
+  store.registerModule(...modNS, getMod())
26
+})
27
+
28
+export default store

+ 54
- 0
src/store/login.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    remember: null,
8
+    userName: '',
9
+    passWord: ''
10
+  },
11
+  mutations: {
12
+    updateRemember (state, data) {
13
+      state.remember = data
14
+    },
15
+    updateUserName (state, data) {
16
+      state.userName = data
17
+    },
18
+    updatePassWord (state, data) {
19
+      state.passWord = data
20
+    }
21
+  },
22
+  actions: {
23
+    login (context, data) {
24
+      console.log(context)
25
+      return new Promise((resolve, reject) => {
26
+        ajax({
27
+          ...api.common.login,
28
+          data: {
29
+            ...data,
30
+          }
31
+        }).then(() => {
32
+          resolve()
33
+        }).catch(reject)
34
+      })
35
+    },
36
+    setRemember ({ commit }, data) {
37
+      localStorage.setItem('remember', data)
38
+      if (data === 'true') {
39
+        data = true
40
+      } else if (data === 'false') {
41
+        data = false
42
+      }
43
+      commit('updateRemember', data)
44
+    },
45
+    setUserName ({ commit }, data) {
46
+      localStorage.setItem('userName', data)
47
+      commit('updateUserName', data)
48
+    },
49
+    setPassWord ({ commit }, data) {
50
+      localStorage.setItem('passWord', data)
51
+      commit('updatePassWord', data)
52
+    },
53
+  }
54
+}

+ 104
- 0
src/store/main.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    menuData: [],
8
+    userInfo: {},
9
+    isBind: false,
10
+    meta: null
11
+  },
12
+  mutations: {
13
+    updateMenu (state, data) {
14
+      state.menuData = data || []
15
+    },
16
+    updateUserInfo (state, data) {
17
+      state.userInfo = data || {}
18
+    },
19
+    updateIsBind (state, data) {
20
+      state.isBind = data
21
+    },
22
+    updateMeta (state, data) {
23
+      state.meta = data
24
+    }
25
+  },
26
+  actions: {
27
+    login (context, data) {
28
+      context
29
+      return new Promise((resolve, reject) => {
30
+        ajax({
31
+          ...api.common.login,
32
+          data: {
33
+            ...data,
34
+          }
35
+        }).then(() => {
36
+          resolve()
37
+        }).catch(reject)
38
+      })
39
+    },
40
+    logOut (context) {
41
+      context
42
+      return new Promise((resolve, reject) => {
43
+        ajax({
44
+          ...api.common.logOut
45
+        }).then(() => {
46
+          resolve()
47
+        }).catch(reject)
48
+      })
49
+    },
50
+    getMainMenu (context, data) {
51
+      return new Promise((resolve, reject) => {
52
+        ajax({
53
+          ...api.common.menu,
54
+          data: {
55
+            ...data,
56
+          }
57
+        }).then((res) => {
58
+          context.commit('updateMenu', res)
59
+          resolve()
60
+        }).catch(reject)
61
+      })
62
+    },
63
+    clearMenu (context) {
64
+      context.commit('updateMenu', '')
65
+    },
66
+    getUserInfo (context) {
67
+      return new Promise((resolve, reject) => {
68
+        ajax({
69
+          ...api.user.getUserInfo
70
+        }).then((res) => {
71
+          context.commit('updateUserInfo', res)
72
+          resolve()
73
+        }).catch(reject)
74
+      })
75
+    },
76
+    changePassWord (context, data) {
77
+      context
78
+      return new Promise((resolve, reject) => {
79
+        ajax({
80
+          ...api.user.changePassWord,
81
+          data: {
82
+            ...data
83
+          }
84
+        }).then(() => {
85
+          resolve()
86
+        }).catch(reject)
87
+      })
88
+    },
89
+    checkBind (context) {
90
+      return new Promise((resolve, reject) => {
91
+        ajax({
92
+          ...api.common.checkBind
93
+        }).then((res) => {
94
+          context.commit('updateIsBind', res)
95
+          resolve()
96
+        }).catch(reject)
97
+      })
98
+    },
99
+    setMeta (context, data) {
100
+      context.commit('updateMeta', data)
101
+
102
+    }
103
+  }
104
+}

+ 109
- 0
src/store/management.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    managementList: [],
8
+    current: 1,
9
+    total: 0,
10
+    authData: {},
11
+    wechatConfig: {}
12
+  },
13
+  mutations: {
14
+    updateManagementList (state, data) {
15
+      state.managementList = data.list || []
16
+      state.total = data.pagenum
17
+    },
18
+    updateCurrent (state, data) {
19
+      state.current = data
20
+    },
21
+    updateAuthData (state, data) {
22
+      state.authData = data || {}
23
+    },
24
+    updateWechatConfig (state, data) {
25
+      state.wechatConfig = data
26
+    },
27
+  },
28
+  actions: {
29
+    getManagementList (context, data) {
30
+      return new Promise((resolve, reject) => {
31
+        ajax({
32
+          ...api.management.getManagementList,
33
+          queryData: {
34
+            ...data
35
+          }
36
+        }).then((res) => {
37
+          context.commit('updateManagementList', res)
38
+          resolve()
39
+        }).catch(reject)
40
+      })
41
+    },
42
+    addManagement (context, data) {
43
+      console.log(context)
44
+      return new Promise((resolve, reject) => {
45
+        ajax({
46
+          ...api.management.addManagement,
47
+          data: {
48
+            ...data
49
+          }
50
+        }).then(() => {
51
+          resolve()
52
+        }).catch(reject)
53
+      })
54
+    },
55
+    deleteManagement (context, data) {
56
+      console.log(context)
57
+      return new Promise((resolve, reject) => {
58
+        ajax({
59
+          ...api.management.deleteManagement,
60
+          urlData: {
61
+            ...data
62
+          }
63
+        }).then(() => {
64
+          resolve()
65
+        }).catch(reject)
66
+      })
67
+    },
68
+    changeCurrent (context, data) {
69
+      context.commit('updateCurrent', data)
70
+    },
71
+    authcode (context) {
72
+      return new Promise((resolve, reject) => {
73
+        ajax({
74
+          ...api.management.authcode
75
+        }).then((res) => {
76
+          context.commit('updateAuthData', res)
77
+          resolve()
78
+        }).catch(reject)
79
+      })
80
+    },
81
+    setAuthcode (context, data) {
82
+      console.log(context)
83
+      return new Promise((resolve, reject) => {
84
+        ajax({
85
+          ...api.management.setAuthcode,
86
+          urlData: {
87
+            ...data
88
+          }
89
+        }).then((res) => {
90
+          context.commit('updateWechatConfig', res)
91
+          resolve()
92
+        }).catch(reject)
93
+      })
94
+    },
95
+    checkAuth (context, data) {
96
+      console.log(context)
97
+      return new Promise((resolve, reject) => {
98
+        ajax({
99
+          ...api.management.checkAuth,
100
+          urlData: {
101
+            ...data
102
+          }
103
+        }).then(() => {
104
+          resolve()
105
+        }).catch(reject)
106
+      })
107
+    }
108
+  }
109
+}

+ 122
- 0
src/store/material.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    img: [],
8
+    view: []
9
+  },
10
+  mutations: {
11
+    updateImg (state, data) {
12
+      state.img = data.list || []
13
+    },
14
+    updateView (state, data) {
15
+      state.view = data || []
16
+    }
17
+  },
18
+  actions: {
19
+    getImg (context, data) {
20
+      return new Promise((resolve, reject) => {
21
+        ajax({
22
+          ...api.material.getImg,
23
+          urlData: {
24
+            ...data,
25
+          },
26
+          queryData: {
27
+            page: 1,
28
+            pagesize: 10000
29
+          }
30
+        }).then(res => {
31
+          res.list = res.list || []
32
+          res.list.forEach((curr) => {
33
+            curr.checked = false
34
+            curr.media_id = curr.MediaId
35
+            curr.url = curr.Url
36
+          })
37
+          context.commit('updateImg', res)
38
+          resolve(res)
39
+        }).catch(reject)
40
+      })
41
+    },
42
+    getView (context, data) {
43
+      // return new Promise((resolve, reject) => {
44
+      //   ajax({
45
+      //     ...api.common.login,
46
+      //     data: {
47
+      //       ...data,
48
+      //     }
49
+      //   }).then(res => {
50
+      //     context.commit('updateList', res)
51
+      //     resolve(res)
52
+      //   }).catch(reject)
53
+      // })
54
+      data = [
55
+        {
56
+          "type": "media_id",
57
+          "name": "图片",
58
+          "media_id": "MEDIA_ID1",
59
+          text: "1",
60
+          url: 'http://mmbiz.qpic.cn/mmbiz_jpg/PiajxSqBRaEIQxibpLbyuSK4TssiajqknJS6dACV5IoTxppdoyfGEYScCFMqV3dgFzf2tGqy2IiciaysTlaZt6zchibA/0?wx_fmt=jpeg'
61
+        },
62
+        {
63
+          "type": "media_id",
64
+          "name": "图片",
65
+          "media_id": "MEDIA_ID1",
66
+          text: "2",
67
+          url: 'http://mmbiz.qpic.cn/mmbiz_jpg/PiajxSqBRaEIQxibpLbyuSK4TssiajqknJS6dACV5IoTxppdoyfGEYScCFMqV3dgFzf2tGqy2IiciaysTlaZt6zchibA/0?wx_fmt=jpeg'
68
+        },
69
+        {
70
+          "type": "media_id",
71
+          "name": "图片",
72
+          "media_id": "MEDIA_ID1",
73
+          text: "3dhkshfhdskjfhjkshdfhdshkjfhshdfihsifjsdnvkhsihfioshifhisohfshi",
74
+          url: 'http://mmbiz.qpic.cn/mmbiz_jpg/PiajxSqBRaEIQxibpLbyuSK4TssiajqknJS6dACV5IoTxppdoyfGEYScCFMqV3dgFzf2tGqy2IiciaysTlaZt6zchibA/0?wx_fmt=jpeg'
75
+        },
76
+      ]
77
+      data.forEach((curr) => {
78
+        curr.checked = false
79
+      })
80
+      context.commit('updateView', data)
81
+    },
82
+    deleteImg (context, data) {
83
+      console.log(context)
84
+      return new Promise((resolve, reject) => {
85
+        ajax({
86
+          ...api.material.deleteImg,
87
+          urlData: {
88
+            ...data
89
+          }
90
+        }).then(() => {
91
+          resolve()
92
+        }).catch(reject)
93
+      })
94
+    },
95
+    addImg (context, data) {
96
+      console.log(context)
97
+      return new Promise((resolve, reject) => {
98
+        ajax({
99
+          ...api.material.addImg,
100
+          data: {
101
+            ...data
102
+          }
103
+        }).then(() => {
104
+          resolve()
105
+        }).catch(reject)
106
+      })
107
+    },
108
+    reflshImg (context, data) {
109
+      console.log(context)
110
+      return new Promise((resolve, reject) => {
111
+        ajax({
112
+          ...api.material.reflshImg,
113
+          urlData: {
114
+            ...data
115
+          }
116
+        }).then(() => {
117
+          resolve()
118
+        }).catch(reject)
119
+      })
120
+    }
121
+  }
122
+}

+ 245
- 0
src/store/menuConfig.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+import Vue from 'vue'
4
+// import { Message } from 'iview'
5
+
6
+const loop = (data, setTrue) => {
7
+  let returnData = {}
8
+  data.mainPlusActive = false
9
+  if (setTrue) {
10
+    if (setTrue.type === 1) {
11
+      data.mainPlusActive = true
12
+    }
13
+  }
14
+  data.button.forEach((currentValue, index) => {
15
+    currentValue.active = false
16
+    currentValue.subPlusActive = false
17
+    if (currentValue.sub_button) {
18
+      currentValue.sub_button.forEach((curr, ind) => {
19
+        curr.active = false
20
+        if (setTrue) {
21
+          if (setTrue.type === 2) {
22
+            if (index === setTrue.parentIndex && ind === setTrue.index) {
23
+              curr.active = true
24
+            }
25
+          }
26
+        }
27
+      })
28
+    }
29
+    if (setTrue) {
30
+      if (setTrue.type === 0) {
31
+        if (index === setTrue.index) {
32
+          currentValue.active = true
33
+        }
34
+      } else if (setTrue.type === 3) {
35
+        if (index === setTrue.index) {
36
+          currentValue.subPlusActive = true
37
+        }
38
+      }
39
+    }
40
+  })
41
+  returnData.mainPlusActive = data.mainPlusActive
42
+  returnData.button = []
43
+  data.button.forEach((currentValue) => {
44
+    if (currentValue.sub_button) {
45
+      currentValue.sub_button.forEach((curr, ind) => {
46
+        currentValue.sub_button.splice(ind, 1, curr)
47
+      })
48
+    }
49
+    returnData.button.push(currentValue)
50
+  })
51
+  return JSON.parse(JSON.stringify(returnData))
52
+}
53
+
54
+export default {
55
+  namespaced: true,
56
+  state: {
57
+    menuJson: {
58
+      'button': [],
59
+      mainPlusActive: false
60
+    },
61
+    changed: false
62
+  },
63
+  mutations: {
64
+    updateMenu (state, data) {
65
+      state.menuJson.button = data.button || []
66
+    },
67
+    updateAddMain (state, data) {
68
+      state.menuJson.button.push(data)
69
+      Vue.set(state.menuJson.button, state.menuJson.button.length - 1, data)
70
+    },
71
+    updateSetMain (state, data) {
72
+      if (data.item) { // data有值时,为修改
73
+        Vue.set(state.menuJson.button, data.index, data.item)
74
+        // state.menuJson.button.splice(data.index, 1, data.item)
75
+      } else { // data为空时,为删除
76
+        state.menuJson.button.splice(data.index, 1)
77
+      }
78
+    },
79
+    updateAddSub (state, data) {
80
+      if (!state.menuJson.button[data.index].sub_button) {
81
+        Vue.set(state.menuJson.button, data.index, {
82
+          ...state.menuJson.button[data.index],
83
+          sub_button: []
84
+        })
85
+      }
86
+      console.log(state.menuJson.button)
87
+      state.menuJson.button[data.index].sub_button.push(data.item)
88
+      loop(state.menuJson)
89
+    },
90
+    updateSetSub (state, data) {
91
+      if (data.item) { // data有值时,为修改
92
+        Vue.set(state.menuJson.button[data.parentIndex].sub_button, data.index, data.item)
93
+      } else { // data为空时,为删除
94
+        state.menuJson.button[data.parentIndex].sub_button.splice(data.index, 1)
95
+      }
96
+    },
97
+    updateMainActive (state, data) {
98
+      data.type = 0
99
+      state.menuJson = loop(state.menuJson, data)
100
+    },
101
+    updateSubActive (state, data) {
102
+      data.type = 2
103
+      state.menuJson = loop(state.menuJson, data)
104
+    },
105
+    updateMainPlusActive (state) {
106
+      state.menuJson = loop(state.menuJson, { type: 1 })
107
+    },
108
+    updateSubPlusActive (state, data) {
109
+      data.type = 3
110
+      state.menuJson = loop(state.menuJson, data)
111
+    },
112
+    clearMenu (state) {
113
+      state.menuJson = loop(state.menuJson)
114
+    },
115
+    updateChanged (state, data) {
116
+      state.changed = data
117
+    },
118
+  },
119
+  actions: {
120
+    getWechatMenu (context) {
121
+      return new Promise((resolve, reject) => {
122
+        ajax({
123
+          ...api.wechatMenu.getWechatMenu
124
+        }).then((res) => {
125
+          let button = []
126
+          if (res) {
127
+            button = res.menu.menu.button
128
+            res.imgList = res.imgList || []
129
+            res.imgList.forEach((c, i) => {
130
+              if (!c) {
131
+                res.imgList.splice(i, 1)
132
+              }
133
+            })
134
+            button.forEach((current) => {
135
+              if (current.type === 'click') {
136
+                current.type = 'text'
137
+                current.value = ((res.keyList.filter(item => (item || { KeyId: '' }).KeyId === current.key) || [])[0] || { Value: '' }).Value
138
+              } else if (current.type === 'media_id') {
139
+                let filter = res.imgList.filter(item => item.MediaId === current.media_id)
140
+                if (filter.length > 0) {
141
+                  current.url = filter[0].Url ? filter[0].Url : ''
142
+                }
143
+              }
144
+              if (current.sub_button) {
145
+                current.sub_button.forEach((curr) => {
146
+                  if (curr.type === 'click') {
147
+                    curr.type = 'text'
148
+                    curr.value = ((res.keyList.filter(item => (item || { KeyId: '' }).KeyId === curr.key) || [])[0] || { Value: '' }).Value
149
+                  } else if (curr.type === 'media_id') {
150
+                    let filter = res.imgList.filter(item => item.MediaId === curr.media_id)
151
+                    if (filter.length > 0) {
152
+                      curr.url = filter[0].Url ? filter[0].Url : ''
153
+                    }
154
+                  }
155
+                })
156
+              }
157
+            })
158
+          }
159
+          context.commit('updateMenu', loop({ button }))
160
+          resolve()
161
+        }).catch(reject)
162
+      })
163
+    },
164
+    clear (context, data) {
165
+      if (data.type === 0) {
166
+        data.index = context.state.menuJson.button.length - 1
167
+        context.commit('updateMainActive', data)
168
+      } else if (data.type === 1) {
169
+        context.commit('updateMainActive', data)
170
+      } else if (data.type === 2) {
171
+        data.index = context.state.menuJson.button[data.parentIndex].sub_button.length - 1
172
+        context.commit('updateSubActive', data)
173
+      } else if (data.type === 3) {
174
+        console.log('click')
175
+        context.commit('updateSubActive', data)
176
+      } else {
177
+        context.commit('clearMenu')
178
+      }
179
+    },
180
+    AddMainMenu (context, data) {
181
+      context.commit('updateAddMain', data)
182
+    },
183
+    SetMainMenu (context, data) {
184
+      context.commit('updateSetMain', data)
185
+    },
186
+    AddSubMenu (context, data) {
187
+      context.commit('updateAddSub', data)
188
+    },
189
+    SetSubMenu (context, data) {
190
+      context.commit('updateSetSub', data)
191
+    },
192
+    mainActive (context, data) {
193
+      context.commit('updateMainActive', data)
194
+    },
195
+    subActive (context, data) {
196
+      context.commit('updateSubActive', data)
197
+    },
198
+    mainPlusActive (context) {
199
+      context.commit('updateMainPlusActive')
200
+    },
201
+    subPlusActive (context, data) {
202
+      context.commit('updateSubPlusActive', data)
203
+    },
204
+    setWechatMenu (context) {
205
+      return new Promise((resolve, reject) => {
206
+        // if (context.state.menuJson.button.length <= 0) {
207
+        //   Message.warning('您未添加任何菜单,请先添加菜单后再进行发布')
208
+        //   reject()
209
+        //   return false
210
+        // }
211
+        let submitData = {
212
+          menu: {}
213
+        }
214
+        submitData.menu = context.state.menuJson
215
+        delete submitData.menu['mainPlusActive']
216
+        submitData.menu.button.forEach((currentValue) => {
217
+          delete currentValue['active']
218
+          delete currentValue['subPlusActive']
219
+          if ((currentValue.sub_button || []).length > 0) {
220
+            delete currentValue['type']
221
+            delete currentValue['media_id']
222
+            delete currentValue['url']
223
+            delete currentValue['value']
224
+            currentValue.sub_button.forEach((curr) => {
225
+              delete curr['active']
226
+            })
227
+          }
228
+        })
229
+        console.log(submitData)
230
+        let str = JSON.stringify(submitData)
231
+        ajax({
232
+          ...api.wechatMenu.setWechatMenu,
233
+          data: {
234
+            WechatJson: str
235
+          }
236
+        }).then(() => {
237
+          resolve()
238
+        }).catch(reject)
239
+      })
240
+    },
241
+    Changed (context, data) {
242
+      context.commit('updateChanged', data)
243
+    }
244
+  }
245
+}

+ 150
- 0
src/store/reply.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    keywordList: [],
8
+    tagList: [],
9
+    RuleName: '',
10
+    AutoType: '',
11
+    MessageContent: '',
12
+    MessageImg: '',
13
+    MessageParagraph: '',
14
+    MessageType: '',
15
+    PairType: '',
16
+    Url: '',
17
+    Subscribe: {}
18
+  },
19
+  mutations: {
20
+    updateKeywordList (state, data) {
21
+      state.keywordList = data.list || []
22
+    },
23
+    updateSubscribe (state, data) {
24
+      state.Subscribe = data.list ? data.list[0] : {}
25
+    },
26
+    updateTagList (state, data) {
27
+      state.tagList = data || []
28
+    },
29
+    updateDetail (state, data) {
30
+      console.log(data)
31
+      state.RuleName = data.RuleName
32
+      state.AutoType = data.AutoType
33
+      state.MessageContent = data.MessageContent
34
+      state.MessageImg = data.MessageImg
35
+      state.MessageParagraph = data.MessageParagraph
36
+      state.MessageType = data.MessageType
37
+      state.PairType = data.PairType
38
+      state.Url = data.Url
39
+      let arr = data.Keywords ? data.Keywords.split(',') : []
40
+      state.tagList = arr
41
+    }
42
+  },
43
+  actions: {
44
+    getKeywordList (context, data) {
45
+      return new Promise((resolve, reject) => {
46
+        ajax({
47
+          ...api.reply.getKeywordList,
48
+          queryData: {
49
+            ...data
50
+          }
51
+        }).then((res) => {
52
+          context.commit('updateKeywordList', res)
53
+          resolve()
54
+        }).catch(reject)
55
+      })
56
+    },
57
+    getSubscribe (context, data) {
58
+      return new Promise((resolve, reject) => {
59
+        ajax({
60
+          ...api.reply.getKeywordList,
61
+          queryData: {
62
+            ...data
63
+          }
64
+        }).then((res) => {
65
+          context.commit('updateSubscribe', res)
66
+          resolve()
67
+        }).catch(reject)
68
+      })
69
+    },
70
+    getReplyDetail (context, data) {
71
+      return new Promise((resolve, reject) => {
72
+        ajax({
73
+          ...api.reply.getReplyDetail,
74
+          urlData: {
75
+            ...data
76
+          }
77
+        }).then((res) => {
78
+          context.commit('updateDetail', res)
79
+          resolve()
80
+        }).catch(reject)
81
+      })
82
+    },
83
+    setReply (context, data) {
84
+      console.log(context)
85
+      return new Promise((resolve, reject) => {
86
+        ajax({
87
+          ...api.reply.setReply,
88
+          data: {
89
+            ...data
90
+          }
91
+        }).then(() => {
92
+          resolve()
93
+        }).catch(reject)
94
+      })
95
+    },
96
+    addReply (context, data) {
97
+      console.log(context)
98
+      return new Promise((resolve, reject) => {
99
+        ajax({
100
+          ...api.reply.addReply,
101
+          data: {
102
+            ...data
103
+          }
104
+        }).then(() => {
105
+          resolve()
106
+        }).catch(reject)
107
+      })
108
+    },
109
+    deleteReply (context, data) {
110
+      console.log(context)
111
+      return new Promise((resolve, reject) => {
112
+        ajax({
113
+          ...api.reply.deleteReply,
114
+          urlData: {
115
+            ...data
116
+          }
117
+        }).then(() => {
118
+          resolve()
119
+        }).catch(reject)
120
+      })
121
+    },
122
+    changeIsUse (context, data) {
123
+      console.log(context)
124
+      return new Promise((resolve, reject) => {
125
+        ajax({
126
+          ...api.reply.changeIsUse,
127
+          urlData: {
128
+            ...data
129
+          }
130
+        }).then(() => {
131
+          resolve()
132
+        }).catch(reject)
133
+      })
134
+    },
135
+    changeTag (context, data) {
136
+      let res
137
+      if (data.type === 'add') {
138
+        context.state.tagList.push(data.data)
139
+        res = context.state.tagList
140
+      } else if (data.type === 'delete') {
141
+        let index = context.state.tagList.indexOf(data.item);
142
+        context.state.tagList.splice(index, 1)
143
+        res = context.state.tagList
144
+      } else {
145
+        res = []
146
+      }
147
+      context.commit('updateTagList', res)
148
+    }
149
+  }
150
+}

+ 121
- 0
src/store/user.js 查看文件

1
+import ajax from '../util/ajax'
2
+import api from '../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    userList: [],
8
+    current: 1,
9
+    total: 0,
10
+    projectList: [],
11
+    oldInfo: {}
12
+  },
13
+  mutations: {
14
+    updateUserList (state, data) {
15
+      state.userList = data.list || []
16
+      state.total = data.pagenum
17
+    },
18
+    updateCurrent (state, data) {
19
+      state.current = data
20
+    },
21
+    updateSysuserInfo (state, data) {
22
+      state.oldInfo = data
23
+    },
24
+    updateProjectList (state, data) {
25
+      state.projectList = data.list || []
26
+    },
27
+  },
28
+  actions: {
29
+    getUserList (context, data) {
30
+      return new Promise((resolve, reject) => {
31
+        ajax({
32
+          ...api.user.getUserList,
33
+          queryData: {
34
+            ...data
35
+          }
36
+        }).then((res) => {
37
+          context.commit('updateUserList', res)
38
+          resolve()
39
+        }).catch(reject)
40
+      })
41
+    },
42
+    changeCurrent(context, data){
43
+      context.commit('updateCurrent', data)
44
+    },
45
+    addUser (context, data) {
46
+      return new Promise((resolve, reject) => {
47
+        ajax({
48
+          ...api.user.addUser,
49
+          data:{
50
+            ...data
51
+          }
52
+        }).then((res) => {
53
+          console.log(res)
54
+          resolve()
55
+        }).catch(reject)
56
+      })
57
+    },
58
+    editUser (context, data) {
59
+      return new Promise((resolve, reject) => {
60
+        ajax({
61
+          ...api.user.editUser,
62
+          data: {
63
+            ...data
64
+          }
65
+        }).then((res) => {
66
+          console.log(res)
67
+          resolve()
68
+        }).catch(reject)
69
+      })
70
+    },
71
+    getSysuserInfo (context, data) {
72
+      return new Promise((resolve, reject) => {
73
+        ajax({
74
+          ...api.user.getSysuserInfo,
75
+          urlData:{
76
+            ...data
77
+          }
78
+        }).then((res) => {
79
+          context.commit('updateSysuserInfo', res)
80
+          resolve(res)
81
+        }).catch(reject)
82
+      })
83
+    },
84
+    getProjectList (context) {
85
+      return new Promise((resolve, reject) => {
86
+        ajax({
87
+          ...api.common.getProjectList,
88
+          queryData: {
89
+            page: 1,
90
+            pagesize: 10000
91
+          }
92
+        }).then((res) => {
93
+          context.commit('updateProjectList', res)
94
+          resolve(res)
95
+        }).catch(reject)
96
+      })
97
+    },
98
+    BindProject (context, data) {
99
+      console.log(context)
100
+      return new Promise((resolve, reject) => {
101
+        ajax({
102
+          ...api.user.BindProject,
103
+          urlData: { ...data }
104
+        }).then(() => {
105
+          resolve()
106
+        }).catch(reject)
107
+      })
108
+    },
109
+    UnBindProject (context, data) {
110
+      console.log(context)
111
+      return new Promise((resolve, reject) => {
112
+        ajax({
113
+          ...api.user.UnBindProject,
114
+          urlData: { ...data }
115
+        }).then(() => {
116
+          resolve()
117
+        }).catch(reject)
118
+      })
119
+    }
120
+  }
121
+}

+ 117
- 0
src/util/ajax.js 查看文件

1
+import axios from 'axios'
2
+import qs from 'qs'
3
+import toolClass from './util'
4
+import router from '@/router'
5
+import { Toast } from 'vant';
6
+
7
+const token = function (headers) {
8
+  let JWT = ''
9
+  if (headers) {
10
+    localStorage.setItem('JWT', headers.authorization)
11
+    JWT = headers.authorization
12
+  }
13
+  const token = JWT ? JWT : localStorage.getItem('JWT') // eslint-disable-line
14
+
15
+  return !token ? '' : token
16
+}
17
+
18
+const Axios = axios.create({
19
+  timeout: 60000,
20
+  responseType: 'json',
21
+  withCredentials: true,
22
+  queryData: {},
23
+  urlData: {},
24
+  headerData: '',
25
+  headers: {
26
+    'Content-Type': 'multipart/form-data',
27
+    'authorization': token()
28
+  }
29
+})
30
+
31
+Axios.interceptors.request.use((config) => {
32
+  config.headers.authorization = token()
33
+  config.headers['Content-Type'] = config.headerData ? config.headerData : 'multipart/form-data'
34
+  // config.urlData = { ...config.urlData,  }
35
+  // 处理请求data,若为get请求,拼到url后面,若为post请求,直接添加到body中
36
+  let urlData = qs.stringify(config.urlData)
37
+  let queryData = qs.stringify(config.queryData)
38
+  // 判断是通过斜杠传参
39
+  if (config.url.indexOf(':') > -1) {
40
+    if (typeof config.urlData === 'object') {
41
+      config.url = replaceURLParams(config.url, config.urlData)
42
+    } else {
43
+      config.url = config.url.slice(0, config.url.indexOf(':')) + urlData
44
+    }
45
+  }
46
+  if (queryData) {
47
+    config.url += '?' + queryData
48
+  }
49
+  if (config.headerData) {
50
+    return config
51
+  } else {
52
+    let fm = new FormData()
53
+    for (let k in config.data) {
54
+      if (Array.isArray(config.data[k])) {
55
+        config.data[k].forEach((v) => {
56
+          fm.append(k, v)
57
+        })
58
+      } else {
59
+        fm.append(k, config.data[k])
60
+      }
61
+    }
62
+    config.data = fm
63
+    return config
64
+  }
65
+}, (error) => {
66
+  console.log(error)
67
+})
68
+
69
+const ajax = (...args) => {
70
+  return new Promise((resolve, reject) => {
71
+    Axios(...args).then(({ data, headers }) => {
72
+      if (headers.authorization) {
73
+        token(headers)
74
+      }
75
+      const { code, message, result } = data
76
+      if (code === 200) {
77
+        resolve(result)
78
+      } else if (code === 401) {
79
+        // console.log(result)
80
+        // reject(code)
81
+        toolClass.getCode(result.appid)
82
+      } else if (code === 406) {
83
+        // console.log(router.history.current.name)
84
+        if (router.history.current.name !== 'bindMobile') {
85
+          router.push({ name: 'bindMobile' })
86
+        }
87
+      } else if (code === 405) {
88
+        // console.log(router.history.current.name)
89
+        // if (router.history.current.name !== 'bindMobile') {
90
+        router.push({ name: 'login' })
91
+        // }
92
+      } else {
93
+        if (message.indexOf("log-error") != -1) {
94
+          console.log(message)
95
+        } else {
96
+          Toast.fail({
97
+            duration: 2000, // 持续展示 toast
98
+            forbidClick: true, // 禁用背景点击
99
+            message: message
100
+          })
101
+        }
102
+        reject(message)
103
+      }
104
+    }).catch(reject)
105
+  })
106
+}
107
+
108
+export default ajax
109
+
110
+export function replaceURLParams (url, params) {
111
+  const args = { ...(params || {}), org: 'MQ' }
112
+
113
+  return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
114
+    const re = new RegExp(`:${k}(?!w)`, 'i')
115
+    return acc.replace(re, args[k])
116
+  }, url)
117
+}

+ 15
- 0
src/util/api.js 查看文件

1
+// const baseUrl = '/api-v2'
2
+const baseUrl = '/api'
3
+const wechat = '/wechat/:org'
4
+const guest = '/guest/:org'
5
+const common = '/common/:org'
6
+
7
+const $api = {
8
+  file: {
9
+    image: { // 图片上传
10
+      method: 'post',
11
+      url: `${baseUrl}${common}/file`
12
+    }
13
+  }
14
+}
15
+export default $api

+ 78
- 0
src/util/share.js 查看文件

1
+import Ajax from './ajax'
2
+import api from './api'
3
+
4
+function wxsdk (params, config) {
5
+  const wx = require('weixin-js-sdk')
6
+  console.log(config)
7
+  const shareData = {
8
+    title: config.title, // 分享标题
9
+    desc: config.desc, // 分享标题
10
+    link: config.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
11
+    imgUrl: config.thu_image // 分享图标
12
+  }
13
+  // 初始化
14
+  return new Promise(function (resolve, reject) {
15
+    Ajax(api.share.share.url, {
16
+      method: api.share.share.method,
17
+      queryData: {
18
+        ...params
19
+      }
20
+    }).then(result => {
21
+      console.log(result)
22
+      let time = parseInt(result.timestamp)
23
+      wx.config({
24
+        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
25
+        appId: result.appId, // 必填,公众号的唯一标识
26
+        timestamp: time, // 必填,生成签名的时间戳
27
+        nonceStr: result.noncestr, // 必填,生成签名的随机串
28
+        signature: result.signature, // 必填,签名,见附录1
29
+        jsApiList: [
30
+          'onMenuShareTimeline',
31
+          'onMenuShareAppMessage',
32
+          'onMenuShareQQ',
33
+          'onMenuShareWeibo',
34
+          'onMenuShareQZone',
35
+          'openLocation',
36
+          'getLocation'
37
+        ]
38
+      })
39
+      wx.ready(function () {
40
+        wx.onMenuShareTimeline(shareData)
41
+        wx.onMenuShareAppMessage(shareData)
42
+        resolve('success')
43
+      })
44
+    }).catch((err) => {
45
+      reject(err)
46
+    })
47
+
48
+    // axios.post(api.share.share.url + '?url=' + params.url)
49
+    //   .then(function (res) {
50
+    //     let result = JSON.parse(res.data)
51
+    //     wx.config({
52
+    //       debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
53
+    //       appId: result.appId, // 必填,公众号的唯一标识
54
+    //       timestamp: result.timestamp, // 必填,生成签名的时间戳
55
+    //       nonceStr: result.noncestr, // 必填,生成签名的随机串
56
+    //       signature: result.signature, // 必填,签名,见附录1
57
+    //       jsApiList: [
58
+    //         'onMenuShareTimeline',
59
+    //         'onMenuShareAppMessage',
60
+    //         'onMenuShareQQ',
61
+    //         'onMenuShareWeibo',
62
+    //         'onMenuShareQZone',
63
+    //         'openLocation'
64
+    //       ]
65
+    //     })
66
+    //     wx.ready(function () {
67
+    //       wx.onMenuShareTimeline(shareData)
68
+    //       wx.onMenuShareAppMessage(shareData)
69
+    //       // resolve()
70
+    //     })
71
+    //   })
72
+    //   .catch(function (error) {
73
+    //     console.log(error)
74
+    //   })
75
+  })
76
+}
77
+
78
+export default wxsdk

+ 102
- 0
src/util/util.js 查看文件

1
+import Ajax from './ajax'
2
+import api from './api'
3
+import wechatConfig from '@/config/index'
4
+const toolClass = {
5
+  dateFormat: (timestamp, fmt) => {
6
+    if (!fmt) {
7
+      fmt = 'yyyy-MM-dd hh:mm'
8
+    }
9
+
10
+    let date = new Date(timestamp)
11
+    var o = {
12
+      'M+': date.getMonth() + 1,
13
+      'd+': date.getDate(),
14
+      'h+': date.getHours(),
15
+      'm+': date.getMinutes(),
16
+      's+': date.getSeconds(),
17
+      'q+': Math.floor((date.getMonth() + 3) / 3),
18
+      'S': date.getMilliseconds()
19
+    }
20
+    if (/(y+)/.test(fmt)) {
21
+      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
22
+    }
23
+    for (var k in o) {
24
+      if (new RegExp('(' + k + ')').test(fmt)) {
25
+        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
26
+      }
27
+    }
28
+    return fmt
29
+  },
30
+  UrlSearch: (urls) => {
31
+    let url = urls // 获取url中"?"符后的字串
32
+    let theRequest = {}
33
+    if (url.indexOf('?') !== -1) {
34
+      let str = url.substr(1)
35
+      let strs = str.split('&')
36
+      for (var i = 0; i < strs.length; i++) {
37
+        theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
38
+      }
39
+    }
40
+    return theRequest
41
+  },
42
+  getCode: (appid) => {
43
+    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${wechatConfig.redirect_uri}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
44
+    window.location.href = url
45
+  },
46
+
47
+  /**
48
+   * caculate the great circle distance
49
+   * 经纬度计算距离
50
+   */
51
+  getGreatCircleDistance: (lat1, lng1, lat2, lng2) => {
52
+    if (lat1 === lat2 && lng1 === lng2) {
53
+      return 0
54
+    }
55
+    var EARTH_RADIUS = 6378137.0//单位M
56
+    var PI = Math.PI
57
+    var radLat1 = lat1 * PI / 180.0
58
+    var radLat2 = lat2 * PI / 180.0
59
+    var a = radLat1 - radLat2
60
+    var b = lng1 * PI / 180.0 - lng2 * PI / 180.0
61
+    var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)))
62
+    s = s * EARTH_RADIUS
63
+    s = Math.round(s * 10000) / 10000.0
64
+    console.log(s)
65
+    return s
66
+  },
67
+  upload (item) {
68
+    return new Promise((resolve, reject) => {
69
+      Ajax({
70
+        ...api.file.image,
71
+        data: { file: item.file },
72
+      }).then((res) => {
73
+        let result = {
74
+          result: res
75
+        }
76
+        if (item.onSuccess) {
77
+          item.onSuccess(result, item.file)
78
+        }
79
+        // console.log(result)
80
+        resolve(result)
81
+      }).catch(reject)
82
+    })
83
+  },
84
+  uploadBase64 (base64) {
85
+    return new Promise((resolve, reject) => {
86
+      Ajax({
87
+        ...api.file.base64,
88
+        queryData: {
89
+          namestr: base64.namestr
90
+        },
91
+        data: { base64str: base64.base64str },
92
+      }).then((res) => {
93
+        let result = {
94
+          result: res
95
+        }
96
+        resolve(result)
97
+      }).catch(reject)
98
+    })
99
+  }
100
+}
101
+
102
+export default toolClass

+ 0
- 0
src/views/supportMain/supportMain.vue 查看文件


+ 23
- 0
vue.config.js 查看文件

1
+module.exports = {
2
+  baseUrl: './',
3
+  // 生产环境是否生成 sourceMap 文件
4
+  productionSourceMap: true,
5
+  chainWebpack: config => config.plugins.delete('named-chunks'),
6
+  devServer: {
7
+    proxy: {
8
+      '/api': {
9
+        target: 'http://wechatconfigdev.ycjcjy.com',
10
+        // target: 'http://192.168.0.62:8080', // wf
11
+        // target: 'http://192.168.0.102:8080', // hyq
12
+        // target: 'http://192.168.0.11', // zys
13
+        // target: 'http://dev.ycjcjy.com', // frp
14
+        changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
15
+        // pathRewrite: {
16
+        //   '^/api': '/api-v2/api'
17
+        // },
18
+      },
19
+    },
20
+    // compress: true,
21
+    disableHostCheck: true,   // That solved it
22
+  }
23
+}