From e3c2f393e6080b5e34c5eb22fb6ed6271e1317bd Mon Sep 17 00:00:00 2001
From: 黄何裕 <1053952480@qq.com>
Date: 星期五, 26 七月 2024 08:58:51 +0800
Subject: [PATCH] 登录页面接口封装

---
 src/permission.js               |   84 ++--
 vue.config.js                   |  147 +++++----
 src/api/user.js                 |    3 
 src/views/integral/index.vue    |  106 +++++++
 src/views/login/index.vue       |  167 +++++++---
 src/views/student/index.vue     |   18 
 src/router/index.js             |   12 
 .env.development                |    2 
 /dev/null                       |   25 -
 src/views/home/index.vue        |   26 +
 src/views/rollCall/index.vue    |  115 +++++++
 src/main.js                     |   50 +-
 src/api/student.js              |   48 +++
 src/utils/graphql.js            |   63 ++++
 package.json                    |   14 
 src/views/development/index.vue |    8 
 16 files changed, 653 insertions(+), 235 deletions(-)

diff --git a/.env.development b/.env.development
index de583d0..3796388 100644
--- a/.env.development
+++ b/.env.development
@@ -2,4 +2,4 @@
 ENV = 'development'
 
 # base api
-VUE_APP_BASE_API = '/dev-api'
+VUE_APP_BASE_API = 'http://192.168.3.88:18080/dream_test'
diff --git a/mock/index.js b/mock/index.js
deleted file mode 100644
index c514c13..0000000
--- a/mock/index.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const Mock = require('mockjs')
-const { param2Obj } = require('./utils')
-
-const user = require('./user')
-const table = require('./table')
-
-const mocks = [
-  ...user,
-  ...table
-]
-
-// for front mock
-// please use it cautiously, it will redefine XMLHttpRequest,
-// which will cause many of your third-party libraries to be invalidated(like progress event).
-function mockXHR() {
-  // mock patch
-  // https://github.com/nuysoft/Mock/issues/300
-  Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
-  Mock.XHR.prototype.send = function() {
-    if (this.custom.xhr) {
-      this.custom.xhr.withCredentials = this.withCredentials || false
-
-      if (this.responseType) {
-        this.custom.xhr.responseType = this.responseType
-      }
-    }
-    this.proxy_send(...arguments)
-  }
-
-  function XHR2ExpressReqWrap(respond) {
-    return function(options) {
-      let result = null
-      if (respond instanceof Function) {
-        const { body, type, url } = options
-        // https://expressjs.com/en/4x/api.html#req
-        result = respond({
-          method: type,
-          body: JSON.parse(body),
-          query: param2Obj(url)
-        })
-      } else {
-        result = respond
-      }
-      return Mock.mock(result)
-    }
-  }
-
-  for (const i of mocks) {
-    Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response))
-  }
-}
-
-module.exports = {
-  mocks,
-  mockXHR
-}
-
diff --git a/mock/mock-server.js b/mock/mock-server.js
deleted file mode 100644
index 8941ec0..0000000
--- a/mock/mock-server.js
+++ /dev/null
@@ -1,81 +0,0 @@
-const chokidar = require('chokidar')
-const bodyParser = require('body-parser')
-const chalk = require('chalk')
-const path = require('path')
-const Mock = require('mockjs')
-
-const mockDir = path.join(process.cwd(), 'mock')
-
-function registerRoutes(app) {
-  let mockLastIndex
-  const { mocks } = require('./index.js')
-  const mocksForServer = mocks.map(route => {
-    return responseFake(route.url, route.type, route.response)
-  })
-  for (const mock of mocksForServer) {
-    app[mock.type](mock.url, mock.response)
-    mockLastIndex = app._router.stack.length
-  }
-  const mockRoutesLength = Object.keys(mocksForServer).length
-  return {
-    mockRoutesLength: mockRoutesLength,
-    mockStartIndex: mockLastIndex - mockRoutesLength
-  }
-}
-
-function unregisterRoutes() {
-  Object.keys(require.cache).forEach(i => {
-    if (i.includes(mockDir)) {
-      delete require.cache[require.resolve(i)]
-    }
-  })
-}
-
-// for mock server
-const responseFake = (url, type, respond) => {
-  return {
-    url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
-    type: type || 'get',
-    response(req, res) {
-      console.log('request invoke:' + req.path)
-      res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
-    }
-  }
-}
-
-module.exports = app => {
-  // parse app.body
-  // https://expressjs.com/en/4x/api.html#req.body
-  app.use(bodyParser.json())
-  app.use(bodyParser.urlencoded({
-    extended: true
-  }))
-
-  const mockRoutes = registerRoutes(app)
-  var mockRoutesLength = mockRoutes.mockRoutesLength
-  var mockStartIndex = mockRoutes.mockStartIndex
-
-  // watch files, hot reload mock server
-  chokidar.watch(mockDir, {
-    ignored: /mock-server/,
-    ignoreInitial: true
-  }).on('all', (event, path) => {
-    if (event === 'change' || event === 'add') {
-      try {
-        // remove mock routes stack
-        app._router.stack.splice(mockStartIndex, mockRoutesLength)
-
-        // clear routes cache
-        unregisterRoutes()
-
-        const mockRoutes = registerRoutes(app)
-        mockRoutesLength = mockRoutes.mockRoutesLength
-        mockStartIndex = mockRoutes.mockStartIndex
-
-        console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed  ${path}`))
-      } catch (error) {
-        console.log(chalk.redBright(error))
-      }
-    }
-  })
-}
diff --git a/mock/table.js b/mock/table.js
deleted file mode 100644
index bd0e013..0000000
--- a/mock/table.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const Mock = require('mockjs')
-
-const data = Mock.mock({
-  'items|30': [{
-    id: '@id',
-    title: '@sentence(10, 20)',
-    'status|1': ['published', 'draft', 'deleted'],
-    author: 'name',
-    display_time: '@datetime',
-    pageviews: '@integer(300, 5000)'
-  }]
-})
-
-module.exports = [
-  {
-    url: '/vue-admin-template/table/list',
-    type: 'get',
-    response: config => {
-      const items = data.items
-      return {
-        code: 20000,
-        data: {
-          total: items.length,
-          items: items
-        }
-      }
-    }
-  }
-]
diff --git a/mock/user.js b/mock/user.js
deleted file mode 100644
index 7555338..0000000
--- a/mock/user.js
+++ /dev/null
@@ -1,84 +0,0 @@
-
-const tokens = {
-  admin: {
-    token: 'admin-token'
-  },
-  editor: {
-    token: 'editor-token'
-  }
-}
-
-const users = {
-  'admin-token': {
-    roles: ['admin'],
-    introduction: 'I am a super administrator',
-    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
-    name: 'Super Admin'
-  },
-  'editor-token': {
-    roles: ['editor'],
-    introduction: 'I am an editor',
-    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
-    name: 'Normal Editor'
-  }
-}
-
-module.exports = [
-  // user login
-  {
-    url: '/vue-admin-template/user/login',
-    type: 'post',
-    response: config => {
-      const { username } = config.body
-      const token = tokens[username]
-
-      // mock error
-      if (!token) {
-        return {
-          code: 60204,
-          message: 'Account and password are incorrect.'
-        }
-      }
-
-      return {
-        code: 20000,
-        data: token
-      }
-    }
-  },
-
-  // get user info
-  {
-    url: '/vue-admin-template/user/info\.*',
-    type: 'get',
-    response: config => {
-      const { token } = config.query
-      const info = users[token]
-
-      // mock error
-      if (!info) {
-        return {
-          code: 50008,
-          message: 'Login failed, unable to get user details.'
-        }
-      }
-
-      return {
-        code: 20000,
-        data: info
-      }
-    }
-  },
-
-  // user logout
-  {
-    url: '/vue-admin-template/user/logout',
-    type: 'post',
-    response: _ => {
-      return {
-        code: 20000,
-        data: 'success'
-      }
-    }
-  }
-]
diff --git a/mock/utils.js b/mock/utils.js
deleted file mode 100644
index 95cc27d..0000000
--- a/mock/utils.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @param {string} url
- * @returns {Object}
- */
-function param2Obj(url) {
-  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
-  if (!search) {
-    return {}
-  }
-  const obj = {}
-  const searchArr = search.split('&')
-  searchArr.forEach(v => {
-    const index = v.indexOf('=')
-    if (index !== -1) {
-      const name = v.substring(0, index)
-      const val = v.substring(index + 1, v.length)
-      obj[name] = val
-    }
-  })
-  return obj
-}
-
-module.exports = {
-  param2Obj
-}
diff --git a/package.json b/package.json
index 2413824..b2b8d29 100644
--- a/package.json
+++ b/package.json
@@ -14,15 +14,26 @@
     "test:ci": "npm run lint && npm run test:unit"
   },
   "dependencies": {
+    "apollo-boost": "^0.4.9",
+    "apollo-cache-inmemory": "^1.6.6",
+    "apollo-client": "^2.6.10",
+    "apollo-link": "^1.2.14",
+    "apollo-link-context": "^1.0.20",
+    "apollo-link-http": "^1.5.17",
     "axios": "0.18.1",
     "core-js": "3.6.5",
+    "cors": "^2.8.5",
     "element-ui": "2.13.2",
+    "graphql": "^16.9.0",
+    "graphql-tag": "^2.12.6",
     "js-cookie": "2.2.0",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
     "path-to-regexp": "2.4.0",
     "vue": "2.6.10",
+    "vue-apollo": "^3.1.2",
     "vue-router": "3.0.6",
+    "vue-wechat-login": "0.0.1",
     "vuex": "3.1.0"
   },
   "devDependencies": {
@@ -48,7 +59,8 @@
     "serve-static": "1.13.2",
     "svg-sprite-loader": "4.1.3",
     "svgo": "1.2.2",
-    "vue-template-compiler": "2.6.10"
+    "vue-template-compiler": "2.6.10",
+    "vue-wxlogin": "^1.0.5"
   },
   "browserslist": [
     "> 1%",
diff --git a/src/api/student.js b/src/api/student.js
new file mode 100644
index 0000000..b82eddd
--- /dev/null
+++ b/src/api/student.js
@@ -0,0 +1,48 @@
+import apolloClient from "@/utils/graphql";
+import gql from "graphql-tag";
+
+export function getData(params) {
+  return apolloClient.query({
+    query: gql`
+      query vars($staffId: Int!, $keyword: String, $pageIn: PageIn!) {
+        findPlayerByStaff(
+          staffId: $staffId
+          keyword: $keyword
+          pageIn: $pageIn
+        ) {
+          ls {
+            id
+            name
+            gender
+            mobile
+            user {
+              id
+              name
+              wxOaOpenId
+            }
+            accs {
+              id
+              voucher {
+                id
+                voucherType
+                name
+              }
+              qty
+              freezeQty
+              amt
+              beginDate
+              endDate
+              modifyTime
+            }
+          }
+          pageOut {
+            total
+            index
+            size
+          }
+        }
+      }
+    `,
+    variables: params,
+  });
+}
diff --git a/src/api/user.js b/src/api/user.js
index 8ff4389..f9ac995 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -2,12 +2,11 @@
 
 export function login(data) {
   return request({
-    url: '/vue-admin-template/user/login',
+    url: '/wx/web/login',
     method: 'post',
     data
   })
 }
-
 export function getInfo(token) {
   return request({
     url: '/vue-admin-template/user/info',
diff --git a/src/main.js b/src/main.js
index 6ed0252..09153ea 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,20 +1,26 @@
-import Vue from 'vue'
+import Vue from "vue";
 
-import 'normalize.css/normalize.css' // A modern alternative to CSS resets
+import "normalize.css/normalize.css"; // A modern alternative to CSS resets
 
-import ElementUI from 'element-ui'
-import 'element-ui/lib/theme-chalk/index.css'
+import ElementUI from "element-ui";
+import "element-ui/lib/theme-chalk/index.css";
 // import locale from 'element-ui/lib/locale/lang/en' // lang i18n
-import locale from 'element-ui/lib/locale/lang/zh-CN';
-import '@/styles/index.scss' // global css
+import locale from "element-ui/lib/locale/lang/zh-CN";
+import "@/styles/index.scss"; // global css
 
-import App from './App'
-import store from './store'
-import router from './router'
+import App from "./App";
+import store from "./store";
+import router from "./router";
 
-import '@/icons' // icon
-import '@/permission' // permission control
+import "@/icons"; // icon
+import "@/permission"; // permission control
 
+// const cors = require('cors');
+// // 澶勭悊璺ㄥ煙璇锋眰
+// App.use(cors());
+// // 澶勭悊璇锋眰
+// App.use(express.json());//express.json=bodyParser.json
+// App.use(express.urlencoded({ extended: true }));
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api
@@ -23,21 +29,17 @@
  * Currently MockJs will be used in the production environment,
  * please remove it before going online ! ! !
  */
-if (process.env.NODE_ENV === 'production') {
-  const { mockXHR } = require('../mock')
-  mockXHR()
-}
+// if (process.env.NODE_ENV === 'production') {
+//   const { mockXHR } = require('../mock')
+//   mockXHR()
+// }
+Vue.use(ElementUI, { locale });
 
-// set ElementUI lang to EN
-Vue.use(ElementUI, { locale })
-// 濡傛灉鎯宠涓枃鐗� element-ui锛屾寜濡備笅鏂瑰紡澹版槑
-// Vue.use(ElementUI,{ locale: zhCn })
-
-Vue.config.productionTip = false
+Vue.config.productionTip = false;
 
 new Vue({
-  el: '#app',
+  el: "#app",
   router,
   store,
-  render: h => h(App)
-})
+  render: (h) => h(App),
+});
diff --git a/src/permission.js b/src/permission.js
index fa1ea19..d5d1418 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -10,53 +10,53 @@
 
 const whiteList = ['/login'] // no redirect whitelist
 
-router.beforeEach(async(to, from, next) => {
-  // start progress bar
-  NProgress.start()
+// router.beforeEach(async(to, from, next) => {
+//   // start progress bar
+//   NProgress.start()
 
-  // set page title
-  document.title = getPageTitle(to.meta.title)
+//   // set page title
+//   document.title = getPageTitle(to.meta.title)
 
-  // determine whether the user has logged in
-  const hasToken = getToken()
+//   // determine whether the user has logged in
+//   const hasToken = getToken()
 
-  if (hasToken) {
-    if (to.path === '/login') {
-      // if is logged in, redirect to the home page
-      next({ path: '/' })
-      NProgress.done()
-    } else {
-      const hasGetUserInfo = store.getters.name
-      if (hasGetUserInfo) {
-        next()
-      } else {
-        try {
-          // get user info
-          await store.dispatch('user/getInfo')
+//   if (hasToken) {
+//     if (to.path === '/login') {
+//       // if is logged in, redirect to the home page
+//       next({ path: '/' })
+//       NProgress.done()
+//     } else {
+//       const hasGetUserInfo = store.getters.name
+//       if (hasGetUserInfo) {
+//         next()
+//       } else {
+//         try {
+//           // get user info
+//           await store.dispatch('user/getInfo')
 
-          next()
-        } catch (error) {
-          // remove token and go to login page to re-login
-          await store.dispatch('user/resetToken')
-          Message.error(error || 'Has Error')
-          next(`/login?redirect=${to.path}`)
-          NProgress.done()
-        }
-      }
-    }
-  } else {
-    /* has no token*/
+//           next()
+//         } catch (error) {
+//           // remove token and go to login page to re-login
+//           await store.dispatch('user/resetToken')
+//           Message.error(error || 'Has Error')
+//           next(`/login?redirect=${to.path}`)
+//           NProgress.done()
+//         }
+//       }
+//     }
+//   } else {
+//     /* has no token*/
 
-    if (whiteList.indexOf(to.path) !== -1) {
-      // in the free login whitelist, go directly
-      next()
-    } else {
-      // other pages that do not have permission to access are redirected to the login page.
-      next(`/login?redirect=${to.path}`)
-      NProgress.done()
-    }
-  }
-})
+//     if (whiteList.indexOf(to.path) !== -1) {
+//       // in the free login whitelist, go directly
+//       next()
+//     } else {
+//       // other pages that do not have permission to access are redirected to the login page.
+//       next(`/login?redirect=${to.path}`)
+//       NProgress.done()
+//     }
+//   }
+// })
 
 router.afterEach(() => {
   // finish progress bar
diff --git a/src/router/index.js b/src/router/index.js
index b056c34..b771c56 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -109,6 +109,18 @@
         name: 'Development',
         component: () => import('@/views/development/index'),
         meta: { title: '鎴愰暱', icon: 'tree' }
+      },
+      {
+        path: 'integral',
+        name: 'Integral',
+        component: () => import('@/views/integral/index'),
+        meta: { title: '绉垎', icon: 'tree' }
+      },
+      {
+        path: 'rollCall',
+        name: 'RollCall',
+        component: () => import('@/views/rollCall/index'),
+        meta: { title: '鐐硅瘎', icon: 'tree' }
       }
     ]
   },
diff --git a/src/utils/graphql.js b/src/utils/graphql.js
new file mode 100644
index 0000000..3356605
--- /dev/null
+++ b/src/utils/graphql.js
@@ -0,0 +1,63 @@
+// import ApolloClient from 'apollo-boost';
+
+// const apolloClient = new ApolloClient({
+//   uri: 'http://127.0.0.1:7001/graphql'
+// })
+
+// export default apolloClient;
+// 瀹氫箟涓嶅悓璇锋眰鍦板潃
+const EFORMURI = "http://192.168.3.88:18080/dream_test/graphql";
+const IOTURI = "https://www.9village.cn/dream_test" + "/graphql";
+// import ApolloClient from 'apollo-boost' //寮曞叆apollo-boost鎻掍欢
+import { ApolloClient } from "apollo-client";
+import { createHttpLink } from "apollo-link-http";
+import { InMemoryCache } from "apollo-cache-inmemory";
+import { ApolloLink } from "apollo-link";
+
+const httpLink = createHttpLink({
+  uri: EFORMURI, //閰嶇疆api璋冪敤杩炴帴
+});
+
+const middlewareLink = new ApolloLink((operation, forward) => {
+  operation.setContext({
+    headers: {
+      Authorization: 'eyJhbGciOiJIUzI1NiJ9.eyJleHBUaW1lIjoiMjAyNC8wNy8yNSAxMTozOSIsInVzZXJJZCI6MSwianRpIjoiZGVkZWRlMWQtYTU4MC00NDkxLWI0YzAtMjA5ODRjYTk3NmE3IiwiaWF0IjoxNzIxODcxNTYyLCJzdWIiOiJ5Y2wiLCJleHAiOjE3MjE4Nzg3NjJ9.gvEk8RHvJD7QQjr83XVwPe9msqEeVITXg3hIJRaNubI',
+      staffId: "1680",
+      playerId: '3350',
+    },
+  }); //request鎷︽埅鍣�
+
+  return forward(operation).map((response) => {
+    return response;
+  }); //response鎷︽埅鍣紝浣嗘槸姝ゅ骞朵笉鑳藉閿欒鍝嶅簲杩涜鎷︽埅
+});
+
+const authLink = middlewareLink.concat(httpLink);
+
+const defaultOptions = {
+  watchQuery: {
+    fetchPolicy: "network-only",
+    errorPolicy: "ignore",
+  },
+  query: {
+    fetchPolicy: "network-only",
+    errorPolicy: "all",
+  },
+};
+
+const apolloClient = new ApolloClient({
+  link: authLink,
+  cache: new InMemoryCache(),
+  connectToDevTools: true,
+  defaultOptions: defaultOptions,
+});
+// const apolloClient = new ApolloClient({
+//   uri: 'https://countries.trevorblades.com/',
+//   headers:{
+//     Authorization: 'eyJhbGciOiJIUzI1NiJ9.eyJleHBUaW1lIjoiMjAyNC8wNy8yNSAxMTozOSIsInVzZXJJZCI6MSwianRpIjoiZGVkZWRlMWQtYTU4MC00NDkxLWI0YzAtMjA5ODRjYTk3NmE3IiwiaWF0IjoxNzIxODcxNTYyLCJzdWIiOiJ5Y2wiLCJleHAiOjE3MjE4Nzg3NjJ9.gvEk8RHvJD7QQjr83XVwPe9msqEeVITXg3hIJRaNubI',
+//     staffId: "1680",
+//     playerId: '3350',
+//   }
+// })
+//瀵煎嚭瀹炰緥
+export default apolloClient;
diff --git a/src/views/development/index.vue b/src/views/development/index.vue
index 5fec51d..c619222 100644
--- a/src/views/development/index.vue
+++ b/src/views/development/index.vue
@@ -65,20 +65,20 @@
             element-loading-text="Loading"
             fit
           >
-            <el-table-column label="瀛﹀憳">
+            <el-table-column label="璇剧▼">
               <template slot-scope=""> xxxxx </template>
             </el-table-column>
             <el-table-column label="鏃堕棿" width="80">
               <template slot-scope=""> 鐢� </template>
             </el-table-column>
-            <el-table-column label="鏍囬" width="200">
+            <el-table-column label="瀛﹀憳鏁�" width="200">
               <template slot-scope=""> 10086 </template>
             </el-table-column>
-            <el-table-column label="鐐硅瘎鑰佸笀" width="200">
+            <el-table-column label="宸茶褰曟暟" width="200">
               <template slot-scope=""> asfiaf </template>
             </el-table-column>
             <el-table-column label="鎿嶄綔" width="">
-              <template slot-scope=""> 鏌ョ湅 </template>
+              <template slot-scope=""> 璁板綍 </template>
             </el-table-column>
           </el-table>
         </el-tab-pane>
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 33e5ab6..6e57039 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -5,16 +5,28 @@
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
+import { mapGetters } from "vuex";
+import { login } from "@/api/user";
 
 export default {
-  name: 'Dashboard',
+  name: "Dashboard",
   computed: {
-    ...mapGetters([
-      'name'
-    ])
-  }
-}
+    ...mapGetters(["name"]),
+  },
+  created() {
+    this.getUserDate();
+  },
+  methods: {
+    getUserDate() {
+      console.log(123);
+      login({
+        code: "031xHA00064oxS1Es0200cRzRF2xHA0t",
+      }).then((res) => {
+       console.log(res);
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
diff --git a/src/views/integral/index.vue b/src/views/integral/index.vue
new file mode 100644
index 0000000..f2ff00c
--- /dev/null
+++ b/src/views/integral/index.vue
@@ -0,0 +1,106 @@
+<template>
+    <div class="app-container">
+      <el-tabs v-model="activeName" @tab-click="handleClick">
+        <el-tab-pane label="鎸夊鍛�" name="first">
+          <div style="display: flex; flex-direction: row-reverse">
+            <div style="width: 300px">
+              <el-input
+                placeholder="鎸夋爣棰樻悳绱�"
+                v-model="input3"
+                class="input-with-select"
+                size="small"
+              >
+                <el-button slot="append" icon="el-icon-search"></el-button>
+              </el-input>
+            </div>
+          </div>
+          <el-table
+            v-loading="listLoading"
+            :data="list"
+            element-loading-text="Loading"
+            fit
+          >
+            <el-table-column label="濮撳悕">
+              <template slot-scope=""> xxxxx </template>
+            </el-table-column>
+            <el-table-column label="绉垎" width="80">
+              <template slot-scope=""> 鐢� </template>
+            </el-table-column>
+            <el-table-column label="鏇存柊鏃堕棿" width="200">
+              <template slot-scope=""> 10086 </template>
+            </el-table-column>
+            <el-table-column label="鎿嶄綔" width="">
+              <template slot-scope=""> 鍏戞崲 鍙戞斁 </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+        <el-tab-pane label="鎸夌彮绾�" name="fourth">
+          <div style="display: flex; flex-direction: row-reverse">
+            <div style="width: 300px">
+              <el-input
+                placeholder="鎸夊鍛樺悕绉版悳绱�"
+                v-model="input3"
+                class="input-with-select"
+                size="small"
+              >
+                <el-button slot="append" icon="el-icon-search"></el-button>
+              </el-input>
+            </div>
+          </div>
+          <el-table
+            v-loading="listLoading"
+            :data="list"
+            element-loading-text="Loading"
+            fit
+          >
+            <el-table-column label="鐝骇">
+              <template slot-scope=""> xxxxx </template>
+            </el-table-column>
+            <el-table-column label="瀛﹀憳浜烘暟" width="80">
+              <template slot-scope=""> 鐢� </template>
+            </el-table-column>
+            <el-table-column label="鎿嶄綔" width="">
+              <template slot-scope=""> 鍙戞斁 </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+  </template>
+  
+  <script>
+  import { getList } from "@/api/table";
+  
+  export default {
+    filters: {
+      statusFilter(status) {
+        const statusMap = {
+          published: "success",
+          draft: "gray",
+          deleted: "danger",
+        };
+        return statusMap[status];
+      },
+    },
+    data() {
+      return {
+        list: null,
+        listLoading: true,
+        activeName: "first",
+      };
+    },
+    created() {
+      this.fetchData();
+    },
+    methods: {
+      fetchData() {
+        this.listLoading = true;
+        getList().then((response) => {
+          this.list = response.data.items;
+          this.listLoading = false;
+        });
+      },
+    },
+  };
+  </script>
+  
\ No newline at end of file
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 1db2464..e100b53 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -1,7 +1,13 @@
 <template>
   <div class="login-container">
-    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
-
+    <!-- <el-form
+      ref="loginForm"
+      :model="loginForm"
+      :rules="loginRules"
+      class="login-form"
+      auto-complete="on"
+      label-position="left"
+    >
       <div class="title-container">
         <h3 class="title">Login Form</h3>
       </div>
@@ -37,100 +43,144 @@
           @keyup.enter.native="handleLogin"
         />
         <span class="show-pwd" @click="showPwd">
-          <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
+          <svg-icon
+            :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
+          />
         </span>
       </el-form-item>
 
-      <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
+      <el-button
+        :loading="loading"
+        type="primary"
+        style="width: 100%; margin-bottom: 30px"
+        @click.native.prevent="handleLogin"
+        >Login</el-button
+      >
 
       <div class="tips">
-        <span style="margin-right:20px;">username: admin</span>
+        <span style="margin-right: 20px">username: admin</span>
         <span> password: any</span>
       </div>
-
-    </el-form>
+    </el-form> -->
+    <div class="wxLogin">
+      <el-card class="main_wx">
+        <wxlogin
+          :appid="appid"
+          :redirect_uri="redirect_uri"
+          scope="snsapi_login"
+          :href="href"
+          :state="state"
+        ></wxlogin>
+        <el-button @click="handleLogin">寮�鍙戠幆澧冧笓鐢ㄥ伔娓℃寜閽�</el-button>
+      </el-card>
+    </div>
   </div>
 </template>
 
 <script>
-import { validUsername } from '@/utils/validate'
-
+import { validUsername } from "@/utils/validate";
+import wxlogin from "vue-wxlogin";
 export default {
-  name: 'Login',
+  name: "Login",
+  components: { wxlogin },
   data() {
     const validateUsername = (rule, value, callback) => {
       if (!validUsername(value)) {
-        callback(new Error('Please enter the correct user name'))
+        callback(new Error("Please enter the correct user name"));
       } else {
-        callback()
+        callback();
       }
-    }
+    };
     const validatePassword = (rule, value, callback) => {
       if (value.length < 6) {
-        callback(new Error('The password can not be less than 6 digits'))
+        callback(new Error("The password can not be less than 6 digits"));
       } else {
-        callback()
+        callback();
       }
-    }
+    };
     return {
+      appid: "wx7103925df6236723",
+      redirect_uri: encodeURIComponent("https://www.9village.cn"),
+      state: "1",
+      href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgICB3aWR0aDogMTQwcHg7CiAgICAgICAgICBoZWlnaHQ6IDE0MHB4OwogICAgICAgIH0=", // 鑷畾涔夋牱寮忛摼鎺�
       loginForm: {
-        username: 'admin',
-        password: '111111'
+        username: "admin",
+        password: "111111",
       },
       loginRules: {
-        username: [{ required: true, trigger: 'blur', validator: validateUsername }],
-        password: [{ required: true, trigger: 'blur', validator: validatePassword }]
+        username: [
+          { required: true, trigger: "blur", validator: validateUsername },
+        ],
+        password: [
+          { required: true, trigger: "blur", validator: validatePassword },
+        ],
       },
       loading: false,
-      passwordType: 'password',
-      redirect: undefined
-    }
+      passwordType: "password",
+      redirect: undefined,
+    };
   },
   watch: {
     $route: {
-      handler: function(route) {
-        this.redirect = route.query && route.query.redirect
+      handler: function (route) {
+        this.redirect = route.query && route.query.redirect;
       },
-      immediate: true
-    }
+      immediate: true,
+    },
+  },
+  mounted() {
+    this.getWeChatUrl();
   },
   methods: {
+    getWeChatUrl() {
+      // api.wachatQrUrl().then(res => {
+      //   if (res && res.code === '0000') {
+      //     const data = res.data
+      //     this.appid = data.appId
+      //     this.redirect_uri = data.wxCallbackUrl + 'weChatLogin'
+      //   }
+      // })
+    },
     showPwd() {
-      if (this.passwordType === 'password') {
-        this.passwordType = ''
+      if (this.passwordType === "password") {
+        this.passwordType = "";
       } else {
-        this.passwordType = 'password'
+        this.passwordType = "password";
       }
       this.$nextTick(() => {
-        this.$refs.password.focus()
-      })
+        this.$refs.password.focus();
+      });
     },
     handleLogin() {
-      this.$refs.loginForm.validate(valid => {
-        if (valid) {
-          this.loading = true
-          this.$store.dispatch('user/login', this.loginForm).then(() => {
-            this.$router.push({ path: this.redirect || '/' })
-            this.loading = false
-          }).catch(() => {
-            this.loading = false
-          })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    }
-  }
-}
+      this.$router.push({ path: "/educational/student" });
+      // this.$refs.loginForm.validate((valid) => {
+      //   if (valid) {
+      //     this.loading = true;
+      //     this.$store
+      //       .dispatch("user/login", this.loginForm)
+      //       .then(() => {
+      //         this.$router.push({ path: this.redirect || "/" });
+      //         this.loading = false;
+      //       })
+      //       .catch(() => {
+      //         this.loading = false;
+      //       });
+      //   } else {
+      //     console.log("error submit!!");
+      //     return false;
+      //   }
+      // });
+    },
+  },
+};
 </script>
 
 <style lang="scss">
 /* 淇input 鑳屾櫙涓嶅崗璋� 鍜屽厜鏍囧彉鑹� */
 /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
 
-$bg:#283443;
-$light_gray:#fff;
+$bg: #283443;
+$light_gray: #fff;
 $cursor: #fff;
 
 @supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
@@ -141,6 +191,9 @@
 
 /* reset element-ui css */
 .login-container {
+  display: flex;
+  align-items: center;
+  justify-content: center;
   .el-input {
     display: inline-block;
     height: 47px;
@@ -170,12 +223,18 @@
     color: #454545;
   }
 }
+#weixin{
+    /* background-color: #fcf; */
+    display: flex;
+    justify-content: center;
+    margin-top: -20px;
+}
 </style>
 
 <style lang="scss" scoped>
-$bg:#2d3a4b;
-$dark_gray:#889aa4;
-$light_gray:#eee;
+$bg: #ffffff;
+$dark_gray: #889aa4;
+$light_gray: #eee;
 
 .login-container {
   min-height: 100%;
diff --git a/src/views/rollCall/index.vue b/src/views/rollCall/index.vue
new file mode 100644
index 0000000..a42846b
--- /dev/null
+++ b/src/views/rollCall/index.vue
@@ -0,0 +1,115 @@
+<template>
+    <div class="app-container">
+      <el-tabs v-model="activeName" @tab-click="handleClick">
+        <el-tab-pane label="鎸夊鍛�" name="first">
+          <div style="display: flex; flex-direction: row-reverse">
+            <div style="width: 300px">
+              <el-input
+                placeholder="鎸夋爣棰樻悳绱�"
+                v-model="input3"
+                class="input-with-select"
+                size="small"
+              >
+                <el-button slot="append" icon="el-icon-search"></el-button>
+              </el-input>
+            </div>
+          </div>
+          <el-table
+            v-loading="listLoading"
+            :data="list"
+            element-loading-text="Loading"
+            fit
+          >
+            <el-table-column label="濮撳悕">
+              <template slot-scope=""> xxxxx </template>
+            </el-table-column>
+            <el-table-column label="璇惧寘/浼氬憳鍗�" width="80">
+              <template slot-scope=""> 鐢� </template>
+            </el-table-column>
+            <el-table-column label="涓婅鏃ユ湡" width="200">
+              <template slot-scope=""> 10086 </template>
+            </el-table-column>
+            <el-table-column label="璇剧▼鏃堕暱" width="200">
+              <template slot-scope=""> 10086 </template>
+            </el-table-column>
+            <el-table-column label="寮�濮嬫椂闂�" width="200">
+              <template slot-scope=""> 10086 </template>
+            </el-table-column>
+            <el-table-column label="璇炬秷鏁伴噺" width="200">
+              <template slot-scope=""> 10086 </template>
+            </el-table-column>
+            <el-table-column label="鎿嶄綔" width="">
+              <template slot-scope=""> 鍏戞崲 鍙戞斁 </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+        <el-tab-pane label="鎸夌彮绾�" name="fourth">
+          <div style="display: flex; flex-direction: row-reverse">
+            <div style="width: 300px">
+              <el-input
+                placeholder="鎸夊鍛樺悕绉版悳绱�"
+                v-model="input3"
+                class="input-with-select"
+                size="small"
+              >
+                <el-button slot="append" icon="el-icon-search"></el-button>
+              </el-input>
+            </div>
+          </div>
+          <el-table
+            v-loading="listLoading"
+            :data="list"
+            element-loading-text="Loading"
+            fit
+          >
+            <el-table-column label="鐝骇">
+              <template slot-scope=""> xxxxx </template>
+            </el-table-column>
+            <el-table-column label="瀛﹀憳浜烘暟" width="80">
+              <template slot-scope=""> 鐢� </template>
+            </el-table-column>
+            <el-table-column label="鎿嶄綔" width="">
+              <template slot-scope=""> 鍙戞斁 </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+  </template>
+  
+  <script>
+  import { getList } from "@/api/table";
+  
+  export default {
+    filters: {
+      statusFilter(status) {
+        const statusMap = {
+          published: "success",
+          draft: "gray",
+          deleted: "danger",
+        };
+        return statusMap[status];
+      },
+    },
+    data() {
+      return {
+        list: null,
+        listLoading: true,
+        activeName: "first",
+      };
+    },
+    created() {
+      this.fetchData();
+    },
+    methods: {
+      fetchData() {
+        this.listLoading = true;
+        getList().then((response) => {
+          this.list = response.data.items;
+          this.listLoading = false;
+        });
+      },
+    },
+  };
+  </script>
+  
\ No newline at end of file
diff --git a/src/views/student/index.vue b/src/views/student/index.vue
index 333ecdc..568500f 100644
--- a/src/views/student/index.vue
+++ b/src/views/student/index.vue
@@ -6,8 +6,8 @@
       <el-tab-pane label="宸茶繃鏈�" name="third" />
       <el-tab-pane label="宸插仠鐢�" name="fourth" />
     </el-tabs>
-    <div style="display: flex; flex-direction: row-reverse;">
-      <div style="width: 300px;">
+    <div style="display: flex; flex-direction: row-reverse">
+      <div style="width: 300px">
         <el-input
           placeholder="鎸夊鍚嶆悳绱�"
           v-model="input3"
@@ -39,6 +39,7 @@
       <el-table-column label="璐︽埛" width="">
         <template slot-scope=""> asfiaf </template>
       </el-table-column>
+      {{ accountList }}
       <!-- <el-table-column label="Author" width="110" align="center">
         <template slot-scope="scope">
           <span>{{ scope.row.author }}</span>
@@ -65,7 +66,7 @@
 </template>
 
 <script>
-import { getList } from "@/api/table";
+import { getData } from "@/api/student";
 
 export default {
   filters: {
@@ -83,6 +84,15 @@
       list: null,
       listLoading: true,
       activeName: "first",
+      data: {
+        staffId: "1680",
+        keyword: "",
+        pageIn: {
+          //鍙�夛紝濡傛灉鏄垎椤垫煡璇紝闇�瑕佸姞涓娿��
+          index: 1, //蹇呴��
+          size: 20, //姣忛〉鐨勫ぇ灏忋�傞粯璁�20
+        },
+      },
     };
   },
   created() {
@@ -91,7 +101,7 @@
   methods: {
     fetchData() {
       this.listLoading = true;
-      getList().then((response) => {
+      getData(this.data).then((response) => {
         this.list = response.data.items;
         this.listLoading = false;
       });
diff --git a/vue.config.js b/vue.config.js
index 4856ed0..159032f 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,19 +1,19 @@
-'use strict'
-const path = require('path')
-const defaultSettings = require('./src/settings.js')
+"use strict";
+const path = require("path");
+const defaultSettings = require("./src/settings.js");
 
 function resolve(dir) {
-  return path.join(__dirname, dir)
+  return path.join(__dirname, dir);
 }
 
-const name = defaultSettings.title || 'vue Admin Template' // page title
+const name = defaultSettings.title || "vue Admin Template"; // page title
 
 // If your port is set to 80,
 // use administrator privileges to execute the command line.
 // For example, Mac: sudo npm run
 // You can change the port by the following methods:
 // port = 9528 npm run dev OR npm run dev --port = 9528
-const port = process.env.port || process.env.npm_config_port || 9528 // dev port
+const port = process.env.port || process.env.npm_config_port || 9528; // dev port
 
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
@@ -24,19 +24,29 @@
    * In most cases please use '/' !!!
    * Detail: https://cli.vuejs.org/config/#publicpath
    */
-  publicPath: '/',
-  outputDir: 'dist',
-  assetsDir: 'static',
-  lintOnSave: process.env.NODE_ENV === 'development',
+  publicPath: "/",
+  outputDir: "dist",
+  assetsDir: "static",
+  lintOnSave: process.env.NODE_ENV === "development",
   productionSourceMap: false,
   devServer: {
     port: port,
     open: true,
     overlay: {
       warnings: false,
-      errors: true
+      errors: true,
     },
-    before: require('./mock/mock-server.js')
+    proxy: {
+      [process.env.VUE_APP_BASE_API]: {
+        // 鍖归厤鎵�鏈変互 '/dev-api'寮�澶寸殑璇锋眰璺緞
+        target: "http://192.168.3.88:18080/dream_test", //绫讳技浜嶯ginx鍙嶅悜浠g悊
+        changeOrigin: true, // 鏀寔璺ㄥ煙
+        pathRewrite: {
+          // 閲嶅啓璺緞: 鍘绘帀璺緞涓紑澶寸殑'/dev-api'
+          ["^" + process.env.VUE_APP_BASE_API]: "",
+        },
+      },
+    },
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that
@@ -44,80 +54,75 @@
     name: name,
     resolve: {
       alias: {
-        '@': resolve('src')
-      }
-    }
+        "@": resolve("src"),
+      },
+    },
   },
   chainWebpack(config) {
     // it can improve the speed of the first screen, it is recommended to turn on preload
-    config.plugin('preload').tap(() => [
+    config.plugin("preload").tap(() => [
       {
-        rel: 'preload',
+        rel: "preload",
         // to ignore runtime.js
         // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
         fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
-        include: 'initial'
-      }
-    ])
+        include: "initial",
+      },
+    ]);
 
     // when there are many pages, it will cause too many meaningless requests
-    config.plugins.delete('prefetch')
+    config.plugins.delete("prefetch");
 
     // set svg-sprite-loader
+    config.module.rule("svg").exclude.add(resolve("src/icons")).end();
     config.module
-      .rule('svg')
-      .exclude.add(resolve('src/icons'))
-      .end()
-    config.module
-      .rule('icons')
+      .rule("icons")
       .test(/\.svg$/)
-      .include.add(resolve('src/icons'))
+      .include.add(resolve("src/icons"))
       .end()
-      .use('svg-sprite-loader')
-      .loader('svg-sprite-loader')
+      .use("svg-sprite-loader")
+      .loader("svg-sprite-loader")
       .options({
-        symbolId: 'icon-[name]'
+        symbolId: "icon-[name]",
       })
-      .end()
+      .end();
 
-    config
-      .when(process.env.NODE_ENV !== 'development',
-        config => {
-          config
-            .plugin('ScriptExtHtmlWebpackPlugin')
-            .after('html')
-            .use('script-ext-html-webpack-plugin', [{
+    config.when(process.env.NODE_ENV !== "development", (config) => {
+      config
+        .plugin("ScriptExtHtmlWebpackPlugin")
+        .after("html")
+        .use("script-ext-html-webpack-plugin", [
+          {
             // `runtime` must same as runtimeChunk name. default is `runtime`
-              inline: /runtime\..*\.js$/
-            }])
-            .end()
-          config
-            .optimization.splitChunks({
-              chunks: 'all',
-              cacheGroups: {
-                libs: {
-                  name: 'chunk-libs',
-                  test: /[\\/]node_modules[\\/]/,
-                  priority: 10,
-                  chunks: 'initial' // only package third parties that are initially dependent
-                },
-                elementUI: {
-                  name: 'chunk-elementUI', // split elementUI into a single package
-                  priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-                  test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
-                },
-                commons: {
-                  name: 'chunk-commons',
-                  test: resolve('src/components'), // can customize your rules
-                  minChunks: 3, //  minimum common number
-                  priority: 5,
-                  reuseExistingChunk: true
-                }
-              }
-            })
-          // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
-          config.optimization.runtimeChunk('single')
-        }
-      )
-  }
-}
+            inline: /runtime\..*\.js$/,
+          },
+        ])
+        .end();
+      config.optimization.splitChunks({
+        chunks: "all",
+        cacheGroups: {
+          libs: {
+            name: "chunk-libs",
+            test: /[\\/]node_modules[\\/]/,
+            priority: 10,
+            chunks: "initial", // only package third parties that are initially dependent
+          },
+          elementUI: {
+            name: "chunk-elementUI", // split elementUI into a single package
+            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+            test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
+          },
+          commons: {
+            name: "chunk-commons",
+            test: resolve("src/components"), // can customize your rules
+            minChunks: 3, //  minimum common number
+            priority: 5,
+            reuseExistingChunk: true,
+          },
+        },
+      });
+      // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
+      config.optimization.runtimeChunk("single");
+    });
+  },
+};

--
Gitblit v1.8.0