Browse Source

登录,密码修改

luyanan 6 years ago
parent
commit
ff45e2d8ab

+ 1 - 1
config/index.js

@ -31,7 +31,7 @@ module.exports = {
31 31
     */
32 32
33 33
    // https://webpack.js.org/configuration/devtool/#development
34
    devtool: 'cheap-source-map',
34
    devtool: 'cheap-module-eval-source-map',
35 35
36 36
    // If you have problems debugging vue-files in devtools,
37 37
    // set this to false - it *may* help

+ 38 - 10
src/api/login.js

@ -1,26 +1,29 @@
1 1
import request from '@/utils/request'
2 2
3
export function login(params) {
3
export function login(account, pw, vc) {
4 4
  return request({
5 5
    url: '/ajax/sys/login',
6 6
    method: 'post',
7
    params
7
    data: {
8
      account,
9
      pw,
10
      vc
11
    }
8 12
  })
9 13
}
10 14
11
export function getInfo(params) {
15
export function getInfo() {
12 16
  return request({
13 17
    url: '/ajax/sys/user',
14
    method: 'get',
15
    params
18
    method: 'get'
16 19
  })
17 20
}
18 21
19 22
export function logout() {
20
  // return request({
21
  //   url: '/user/logout',
22
  //   method: 'post'
23
  // })
23
  return request({
24
    url: '/ajax/sys/logout',
25
    method: 'get'
26
  })
24 27
}
25 28
26 29
export function isReg(params) {
@ -31,10 +34,35 @@ export function isReg(params) {
31 34
  })
32 35
}
33 36
34
export function getMsgPhone(params) {
37
// 找回密码
38
export function getResetMsgPhone(params) {
35 39
  return request({
36 40
    url: '/ajax/sys/resetPwMobile',
37 41
    method: 'get',
38 42
    params
39 43
  })
40 44
}
45
46
export function resetPwdByTel(pw, vc) {
47
  return request({
48
    url: '/ajax/sys/resetPasswordWithMobilePhone',
49
    method: 'post',
50
    data: {
51
      pw,
52
      vc
53
    }
54
  })
55
}
56
57
// 修改密码
58
export function changePw(id, oldPw, newPw) {
59
  return request({
60
    url: '/ajax/sys/changePw',
61
    method: 'post',
62
    data: {
63
      id,
64
      oldPw,
65
      newPw
66
    }
67
  })
68
}

+ 1 - 1
src/api/pictureVc.js

@ -1,5 +1,5 @@
1 1
import { comUrl } from '@/utils/index'
2 2
3 3
export function getPictureVC(flag) {
4
  return comUrl + '/ajax/PictureVC?' + new Date().getTime() + '&flag=' + flag
4
  return comUrl + '/ajax/PictureVC?t=' + new Date().getTime() + '&flag=' + flag
5 5
}

+ 34 - 2
src/api/table.js

@ -1,8 +1,40 @@
1 1
import request from '@/utils/request'
2 2
3
export function getList(params) {
3
export function getBridgeList(params) {
4 4
  return request({
5
    url: '/table/list',
5
    url: '/ajax/bridge/byUser',
6
    method: 'get',
7
    params
8
  })
9
}
10
11
export function getBridgeInfo(params) {
12
  return request({
13
    url: '/ajax/bridge/qo',
14
    method: 'get',
15
    params
16
  })
17
}
18
19
export function getBridgeServers(params) {
20
  return request({
21
    url: '/ajax/server/byBridge',
22
    method: 'get',
23
    params
24
  })
25
}
26
27
export function getBridgeDevices(params) {
28
  return request({
29
    url: '/ajax/device/byServer',
30
    method: 'get',
31
    params
32
  })
33
}
34
35
export function getBridgeSensors(params) {
36
  return request({
37
    url: '/ajax/transducer/byDevice',
6 38
    method: 'get',
7 39
    params
8 40
  })

+ 42 - 33
src/permission.js

@ -2,46 +2,55 @@ import router from './router'
2 2
import store from './store'
3 3
import NProgress from 'nprogress' // Progress 进度条
4 4
import 'nprogress/nprogress.css'// Progress 进度条样式
5
// import { Message } from 'element-ui'
6
// import { getToken } from '@/utils/auth' // 验权
5
import { Message } from 'element-ui'
6
import { getSession, getIfLoginUser } from '@/utils/auth' // 验权
7 7
8 8
NProgress.configure({ showSpinner: false })// NProgress Configuration
9 9
10
// const whiteList = ['/login'] // 不重定向白名单
10
const whiteList = ['/login', '/findPwd'] // 不重定向白名单
11
getIfLoginUser()
11 12
router.beforeEach((to, from, next) => {
12 13
  NProgress.start()
13
  // if (getToken()) {
14
  if (to.path === '/login') {
15
    // next({ path: '/' })
16
    NProgress.done() // if current page is dashboard will not trigger  afterEach hook, so manually handle it
17
  } else {
18
    if (store.getters.roles.length === 0) {
19
      store.dispatch('GetUserInfo').then(res => { // 拉取用户信息
20
        // next()
21
        const roles = '1' // note: roles must be a array! such as: ['editor','develop']
22
        store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
23
          router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
24
          next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
25
        })
26
      })
27
      // .catch((err) => {
28
      //   store.dispatch('FedLogOut').then(() => {
29
      //     // Message.error(err || 'Verification failed, please login again')
30
      //     next({ path: '/' })
31
      //   })
32
      // })
14
  setTimeout(() => {
15
    console.log(getSession())
16
    console.log(store.getters.logins)
17
    if (store.getters.logins) {
18
      if (to.path === '/login') {
19
        next({ path: '/' })
20
        NProgress.done()
21
        console.log(1111)
22
      } else {
23
        if (store.getters.roles.indexOf('1') >= 0) {
24
          console.log(2222)
25
          store.dispatch('GetUserInfo').then(res => { // 拉取用户信息
26
            const dataS = res.data
27
            const roles = [dataS.type.toString()]
28
            store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
29
              router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
30
              next({ ...to, replace: true })
31
            })
32
          }).catch(() => {
33
            store.dispatch('FedLogOut').then(() => {
34
              Message.error('登录状态超时,请重新登录')
35
              next({ path: '/' })
36
            })
37
          })
38
        } else {
39
          console.log(33333)
40
          next()
41
        }
42
      }
33 43
    } else {
34
      next()
44
      if (whiteList.indexOf(to.path) !== -1) {
45
        console.log(444444)
46
        next()
47
      } else {
48
        console.log(55555)
49
        next('/login')
50
        NProgress.done()
51
      }
35 52
    }
36
  }
37
  // } else {
38
  //   if (whiteList.indexOf(to.path) !== -1) {
39
  //     next()
40
  //   } else {
41
  //     // next('/login')
42
  //     NProgress.done()
43
  //   }
44
  // }
53
  }, 1000)
45 54
})
46 55
47 56
router.afterEach(() => {

+ 28 - 25
src/router/index.js

@ -8,7 +8,7 @@ Vue.use(Router)
8 8
9 9
/* Layout */
10 10
import Layout from '../views/layout/Layout'
11
// import LayoutC from '../views/layout/LayoutC'
11
import LayoutC from '../views/layout/LayoutC'
12 12
13 13
/** note: submenu only apppear when children.length>=1
14 14
*   detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@ -48,8 +48,25 @@ export const constantRouterMap = [
48 48
      name: 'dashboard',
49 49
      meta: { title: '主页', noCache: true }
50 50
    }]
51
  }
51
  },
52 52
53
  {
54
    path: '/bridgesConsole',
55
    component: LayoutC,
56
    redirect: '/bridgesConsole/bridgeDetail',
57
    name: 'bridgesConsole',
58
    meta: {
59
      noCache: true
60
    },
61
    children: [
62
      {
63
        path: 'bridgeDetail',
64
        name: 'bridgeDetail',
65
        component: () => import('@/views/bridgesConsole/bridgeDetail/index'),
66
        meta: { noCache: true }
67
      }
68
    ]
69
  }
53 70
]
54 71
55 72
// 实例化vue的时候只挂载constantRouter
@ -72,7 +89,8 @@ export const asyncRouterMap = [
72 89
    meta: {
73 90
      title: '用户系统管理',
74 91
      icon: 'peoples',
75
      roles: ['1']
92
      roles: ['1'],
93
      noCache: true
76 94
    },
77 95
    alwaysShow: true,
78 96
    children: [
@ -80,7 +98,7 @@ export const asyncRouterMap = [
80 98
        path: 'infoManage',
81 99
        name: 'infoManage',
82 100
        component: () => import('@/views/peoplesManage/infoManage/index'),
83
        meta: { title: '用户信息管理' }
101
        meta: { title: '用户信息管理', noCache: true }
84 102
      }
85 103
    ]
86 104
  },
@ -92,48 +110,33 @@ export const asyncRouterMap = [
92 110
    meta: {
93 111
      title: '基础信息管理',
94 112
      icon: 'list',
95
      roles: ['1']
113
      roles: ['1'],
114
      noCache: true
96 115
    },
97 116
    children: [
98 117
      {
99 118
        path: 'bridgesInfo',
100 119
        name: 'BridgesInfo',
101 120
        component: () => import('@/views/baseInfoManage/bridgesInfo/index'),
102
        meta: { title: '桥梁信息管理' }
121
        meta: { title: '桥梁信息管理', noCache: true }
103 122
      },
104 123
      {
105 124
        path: 'serversConfig',
106 125
        name: 'ServersConfig',
107 126
        component: () => import('@/views/baseInfoManage/serversConfig/index'),
108
        meta: { title: '采集服务器配置' }
127
        meta: { title: '采集服务器配置', noCache: true }
109 128
      },
110 129
      {
111 130
        path: 'boxesConfig',
112 131
        name: 'BoxesConfig',
113 132
        component: () => import('@/views/baseInfoManage/boxesConfig/index'),
114
        meta: { title: '采集盒配置' }
133
        meta: { title: '采集盒配置', noCache: true }
115 134
      },
116 135
      {
117 136
        path: 'sensorsConfig',
118 137
        name: 'SensorsConfig',
119 138
        component: () => import('@/views/baseInfoManage/sensorsConfig/index'),
120
        meta: { title: '传感器配置' }
121
      }
122
    ]
123
  },
124
125
  {
126
    path: '/bridgesConsole',
127
    component: Layout,
128
    redirect: '/bridgesConsole/bridgeDetail',
129
    meta: {
130
      roles: ['0']
131
    },
132
    children: [
133
      {
134
        path: 'bridgeDetail',
135
        name: 'bridgeDetail',
136
        component: () => import('@/views/bridgesConsole/bridgeDetail/index')
139
        meta: { title: '传感器配置', noCache: true }
137 140
      }
138 141
    ]
139 142
  },

+ 3 - 0
src/store/getters.js

@ -1,8 +1,11 @@
1 1
const getters = {
2 2
  sidebar: state => state.app.sidebar,
3 3
  device: state => state.app.device,
4
  userid: state => state.user.userid,
4 5
  name: state => state.user.name,
5 6
  roles: state => state.user.roles,
7
  logins: state => state.user.logins,
8
  session: state => state.user.session,
6 9
  permission_routers: state => state.permission.routers,
7 10
  addRouters: state => state.permission.addRouters
8 11
}

+ 55 - 41
src/store/modules/user.js

@ -1,41 +1,51 @@
1
import { login, logout } from '@/api/login'
2
// import { getToken, setToken, removeToken } from '@/utils/auth'
1
import { login, logout, getInfo } from '@/api/login'
2
import { getSession, removeSession } from '@/utils/auth'
3 3
4 4
const user = {
5 5
  state: {
6
    userid: '',
6 7
    name: '',
7
    roles: []
8
    roles: [],
9
    logins: '',
10
    session: getSession()
8 11
  },
9
10 12
  mutations: {
13
    SET_USERID: (state, userid) => {
14
      state.userid = userid
15
    },
11 16
    SET_NAME: (state, name) => {
12 17
      state.name = name
13 18
    },
14 19
    SET_ROLES: (state, roles) => {
15 20
      state.roles = roles
21
    },
22
    SET_LOGIN: (state, logins) => {
23
      state.logins = logins
24
    },
25
    SET_SESSION: (state, session) => {
26
      state.session = session
16 27
    }
17 28
  },
18 29
19 30
  actions: {
20 31
    // 用户名登录
21 32
    LoginByUsername({ commit }, userInfo) {
22
      console.log(userInfo)
23 33
      const account = userInfo.username.trim()
24
      const pw = userInfo.password.trim()
25
      const vc = userInfo.imgVerifyCode.trim()
26
      const param = {
27
        account,
28
        pw,
29
        vc
30
      }
34
      const pw = userInfo.password
35
      const vc = userInfo.imgVerifyCode.toLocaleUpperCase()
31 36
      return new Promise((resolve, reject) => {
32
        login(param).then(response => {
33
          console.log(response)
34
          // if (response.success) {
35
          //   const data = response.data
36
          // }
37
          // setToken(response.data.type)
38
          resolve()
37
        login(account, pw, vc).then((response) => {
38
          if (response.success) {
39
            if (response.data) {
40
              const dataS = response.data
41
              if (dataS.active) {
42
                commit('SET_USERID', dataS.id)
43
                commit('SET_ROLES', [dataS.type.toString()])
44
                commit('SET_NAME', dataS.name)
45
              }
46
            }
47
          }
48
          resolve(response)
39 49
        }).catch(error => {
40 50
          reject(error)
41 51
        })
@ -44,32 +54,35 @@ const user = {
44 54
45 55
    // 获取用户信息
46 56
    GetUserInfo({ commit, state }) {
47
      commit('SET_ROLES', '0')
48
      // return new Promise((resolve, reject) => {
49
      //   getInfo().then(response => {
50
      //     if (response.success) {
51
      //       console.log(response)
52
      //     }
53
      //     const data = response.data
54
55
      //     if (data.type) {
56
      //       commit('SET_ROLES', data.type)
57
      //     }
58
      //     // commit('SET_NAME', data.name)
59
      //     // commit('SET_AVATAR', data.avatar)
60
      //     resolve(response)
61
      //   }).catch(error => {
62
      //     reject(error)
63
      //   })
64
      // })
57
      return new Promise((resolve, reject) => {
58
        getInfo().then(response => {
59
          commit('SET_LOGIN', response.success)
60
          if (response.success) {
61
            if (response.data) {
62
              const dataS = response.data
63
              if (dataS.active) {
64
                commit('SET_USERID', dataS.id)
65
                commit('SET_ROLES', [dataS.type.toString()])
66
                commit('SET_NAME', dataS.name)
67
              }
68
            }
69
          }
70
          resolve(response)
71
        }).catch(error => {
72
          reject(error)
73
        })
74
      })
65 75
    },
66 76
67 77
    // 登出
68 78
    LogOut({ commit, state }) {
69 79
      return new Promise((resolve, reject) => {
70
        logout(state.token).then(() => {
71
          commit('SET_ROLES', '')
72
          // removeToken()
80
        logout().then(() => {
81
          commit('SET_USERID', '')
82
          commit('SET_ROLES', [])
83
          commit('SET_NAME', '')
84
          commit('SET_SESSION', '')
85
          removeSession()
73 86
          resolve()
74 87
        }).catch(error => {
75 88
          reject(error)
@ -80,7 +93,8 @@ const user = {
80 93
    // 前端 登出
81 94
    FedLogOut({ commit }) {
82 95
      return new Promise(resolve => {
83
        // removeToken()
96
        commit('SET_SESSION', '')
97
        removeSession()
84 98
        resolve()
85 99
      })
86 100
    }

+ 3 - 22
src/styles/loginform.scss

@ -18,28 +18,6 @@ $light_black:#555;
18 18
    background-image: url('/static/touchwave.png');
19 19
    background-size: 320px 30px;
20 20
  }
21
  .form-wrapper{
22
    width:100%;
23
    height:100%;
24
    display:flex;
25
    justify-content: center;
26
    align-items: center;
27
    .form-contain {
28
      width:420px;
29
      padding:30px 20px;
30
      .form-title {
31
        font-size: 22px;
32
        line-height: 36px;
33
        color:$light_gray;
34
        text-align:center;
35
        margin-bottom:40px;
36
      }
37
      .el-button--primary{
38
        width:100%;
39
      }
40
    }
41
  }
42
43 21
  .step-wrapper{
44 22
    margin-bottom:30px;
45 23
    .el-step__head.is-process{
@ -81,6 +59,9 @@ $light_black:#555;
81 59
    width: 520px;
82 60
    padding: 50px 35px 15px 35px;
83 61
    margin: 120px auto;
62
    .log-btn.el-button--primary {
63
      width:100%;
64
    }
84 65
  }
85 66
  .el-input {
86 67
    display: inline-block;

+ 12 - 12
src/utils/auth.js

@ -1,15 +1,15 @@
1
// import Cookies from 'js-cookie'
1
import store from '@/store'
2
import Cookies from 'js-cookie'
2 3
3
// const TokenKey = 'Admin-Token'
4
export function getSession() {
5
  return Cookies.get('JSESSIONID')
6
}
4 7
5
// export function getToken() {
6
//   return Cookies.get(TokenKey)
7
// }
8
export function removeSession() {
9
  return Cookies.remove('JSESSIONID')
10
}
8 11
9
// export function setToken(token) {
10
//   return Cookies.set(TokenKey, token)
11
// }
12
13
// export function removeToken() {
14
//   return Cookies.remove(TokenKey)
15
// }
12
export function getIfLoginUser() {
13
  store.dispatch('GetUserInfo').then(res => { // 判断是否有登录用户
14
  })
15
}

+ 1 - 1
src/utils/index.js

@ -1,5 +1,5 @@
1 1
/**
2
 * Created by jiachenpan on 16/11/18.
2
 * Created by luyanan on 18/8/13.
3 3
 */
4 4
export const comUrl = 'http://localhost:90'
5 5

+ 11 - 25
src/utils/request.js

@ -3,12 +3,15 @@ import qs from 'qs'
3 3
import { comUrl } from '@/utils/index'
4 4
// import { Message } from 'element-ui'
5 5
// import store from '@/store'
6
// import { getToken } from '@/utils/auth'
6
// import { getSession } from '@/utils/auth'
7 7
8 8
// 创建axios实例
9 9
const service = axios.create({
10
  baseURL: comUrl // api的base_url
10
  baseURL: comUrl, // api的base_url
11 11
  // timeout: 5000 // 请求超时时间
12
  paramsSerializer: function(params) {
13
    return qs.stringify(params, { arrayFormat: 'repeat' })
14
  }
12 15
})
13 16
14 17
// request拦截器
@ -16,15 +19,13 @@ service.interceptors.request.use(config => {
16 19
  // 配置config
17 20
  config.headers.Accept = 'application/json'
18 21
  if (config.method === 'post') {
19
    // if (config.url !== http.sample.list && config.url !== http.manage.kit.save) {
20 22
    config.data = qs.stringify(config.data)
21 23
    // 处理后后台无需添加RequestBody
22
    config.headers['Content-Type'] = 'application/x-www-form-urlencoded charset=UTF-8'
23
    // }
24
    config.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
25
  }
26
  if (localStorage.token) {
27
    config.headers.Authorization = localStorage.token
24 28
  }
25
  // if (store.getters.token) {
26
  //   config.headers['X-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
27
  // }
28 29
  return config
29 30
}, error => {
30 31
  // Do something with request error
@ -46,18 +47,6 @@ service.interceptors.response.use(response => {
46 47
  //       duration: 5 * 1000
47 48
  //     })
48 49
49
  //     // 50008:非法的token 50012:其他客户端登录了  50014:Token 过期了
50
  //     if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
51
  //       MessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
52
  //         confirmButtonText: '重新登录',
53
  //         cancelButtonText: '取消',
54
  //         type: 'warning'
55
  //       }).then(() => {
56
  //         store.dispatch('FedLogOut').then(() => {
57
  //           location.reload()// 为了重新实例化vue-router对象 避免bug
58
  //         })
59
  //       })
60
  //     }
61 50
  //     return Promise.reject('error')
62 51
  //   } else {
63 52
  //     return response.data
@ -76,7 +65,7 @@ service.interceptors.response.use(response => {
76 65
      // 判断data不是Object时,解析成Object
77 66
      // data = JSON.parse(data)
78 67
    }
79
    return data
68
    return response.data
80 69
  } else {
81 70
    // 业务异常
82 71
    console.log(response)
@ -88,7 +77,4 @@ service.interceptors.response.use(response => {
88 77
  return Promise.reject(error)
89 78
})
90 79
91
export default {
92
  service,
93
  comUrl
94
}
80
export default service

+ 1 - 1
src/utils/validate.js

@ -1,5 +1,5 @@
1 1
/**
2
 * Created by jiachenpan on 16/11/18.
2
 * Created by luyanan on 18/8/13.
3 3
 */
4 4
5 5
export function isvalidUsername(str) {

+ 0 - 101
src/views/bridgesConsole/birdgeLists/index.vue

@ -1,101 +0,0 @@
1
<template>
2
  <div class="dashboard-editor-container">
3
    <el-row class="panel-group" :gutter="40">
4
      <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col" v-for="item in [0,1,2,3,4]" :key="item.id" @click.native="goToDashboardC">
5
        <div class='card-panel'>
6
          <div class="card-panel-icon-wrapper">
7
            <div class="card-image" style="background-image: url(/static/touchwave.png);"></div>
8
          </div>
9
          <div class="card-panel-description">
10
            <div class="card-panel-text">桥梁名称 <span>山东青岛跨海大桥A段</span></div>
11
            <div class="card-panel-text">未读报警 10条</div>
12
          </div>
13
        </div>
14
      </el-col>
15
    </el-row>
16
    <div class="pagination-container">
17
      <el-pagination background current-page="1" :page-sizes="[10,20,30, 50]" page-size="20" layout="total, sizes, prev, pager, next, jumper" total="60">
18
      </el-pagination>
19
    </div>
20
  </div>
21
</template>
22
23
<script>
24
25
export default {
26
  components: {
27
28
  },
29
  methods: {
30
    goToDashboardC() {
31
      this.$router.push({ path: 'dashboardC' })
32
    }
33
    // @size-change="handleSizeChange" @current-change="handleCurrentChange"
34
    // handleSizeChange(val) {
35
    //   this.listQuery.limit = val
36
    //   this.getList()
37
    // },
38
    // handleCurrentChange(val) {
39
    //   this.listQuery.page = val
40
    //   this.getList()
41
    // }
42
  }
43
}
44
</script>
45
46
<style rel="stylesheet/scss" lang="scss" scoped>
47
.dashboard-editor-container{
48
  padding: 32px;
49
  .panel-group {
50
    margin-top: 18px;
51
    .card-panel-col{
52
      margin-bottom: 32px;
53
    }
54
    .card-panel {
55
      cursor: pointer;
56
      padding: 15px;
57
      font-size: 12px;
58
      position: relative;
59
      overflow: hidden;
60
      color: #666;
61
      background: #fff;
62
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
63
      border-color: rgba(0, 0, 0, .05);
64
      &:hover {
65
        .card-panel-icon-wrapper {
66
          color: #fff;
67
        }
68
      }
69
      .card-panel-icon-wrapper {
70
        margin: 10px 0;
71
        transition: all 0.38s ease-out;
72
        border-radius: 6px;
73
      }
74
      .card-image{
75
        width: 100%;
76
        max-width: 280px;
77
        margin: auto;
78
        height: 160px;
79
        border: 1px solid #d0d0d0;
80
        background-position: center;
81
        background-size: cover;
82
      }
83
      .card-panel-icon {
84
        font-size: 48px;
85
      }
86
      .card-panel-description {
87
        font-weight: bold;
88
        margin-top:12px;
89
        .card-panel-text {
90
          line-height: 24px;
91
          color: rgba(0, 0, 0, 0.45);
92
          font-size: 16px;
93
        }
94
        .card-panel-num {
95
          font-size: 20px;
96
        }
97
      }
98
    }
99
  }
100
}
101
</style>

+ 34 - 62
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog01.vue

@ -5,59 +5,47 @@
5 5
        <el-col :xs="24" :sm="18" :lg="16">
6 6
          <el-row>
7 7
            <el-col :span="12">
8
              <el-form-item label="桥梁编号">000000001</el-form-item>
8
              <el-form-item label="桥梁编号">{{dataInfo.code}}</el-form-item>
9 9
            </el-col>
10 10
            <el-col :span="12">
11
              <el-form-item label="桥梁简称">青岛跨海大桥A段</el-form-item>
11
              <el-form-item label="桥梁简称">{{dataInfo.shortName}}</el-form-item>
12 12
            </el-col>
13 13
            <el-col :span="24">
14
              <el-form-item label="桥梁全称">山东省青岛市胶州跨海大桥A段</el-form-item>
14
              <el-form-item label="桥梁全称">{{dataInfo.name}}</el-form-item>
15 15
            </el-col>
16 16
            <el-col :span="24">
17
              <el-form-item label="桥梁位置信息">山东省青岛市胶州</el-form-item>
17
              <el-form-item label="桥梁位置信息">{{dataInfo.addrCode}}</el-form-item>
18 18
            </el-col>
19 19
            <el-col :span="12">
20
              <el-form-item label="地理位置信息">青岛跨海大桥南侧</el-form-item>
20
              <el-form-item label="地理位置信息">{{dataInfo.location}}</el-form-item>
21 21
            </el-col>
22 22
            <el-col :span="12">
23
              <el-form-item label="桥梁开通日期">2018/07/21</el-form-item>
23
              <el-form-item label="桥梁开通日期">{{dataInfo.serviceDay}}</el-form-item>
24 24
            </el-col>
25 25
            <el-col :span="24">
26
              <el-form-item label="维护单位">青岛拉升阶段拉升阶段是觉得了科技有限公司</el-form-item>
26
              <el-form-item label="维护单位">{{dataInfo.org}}</el-form-item>
27 27
            </el-col>
28 28
            <el-col :span="12">
29
              <el-form-item label="维护单位电话">40988923-328</el-form-item>
29
              <el-form-item label="维护单位电话">{{dataInfo.phone}}</el-form-item>
30 30
            </el-col>
31 31
            <el-col :span="12">
32
              <el-form-item label="维护单位电邮">23142121@163.com</el-form-item>
32
              <el-form-item label="维护单位电邮">{{dataInfo.email}}</el-form-item>
33 33
            </el-col>
34 34
          </el-row>
35 35
        </el-col>
36 36
        <el-col :xs="24" :sm="6" :lg="8">
37 37
          <div style="width:100%">
38
            <img src="/static/touchwave.png" alt="桥梁图片" width="90%">
38
            <img :src="dataInfo.img" alt="桥梁图片" width="90%">
39 39
          </div>
40 40
        </el-col>
41
      </el-row>
42
      <el-table :data="tableData" border style="width: 100%;margin:15px 0">
43
        <el-table-column v-for="item in tableRow" :key="item.id"
44
          :prop="item.prop"
45
          :label="item.label">
46
        </el-table-column>
47
      </el-table>
48
      <el-row>
49
        <el-col :span="24">
41
        <el-col :span="24" v-if="dataInfo.descp">
50 42
          <el-form-item label="大桥描述" class="el-to-block"><br />
51
            <div class="textarea-div">
52
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.
53
            </div>
43
            <div class="textarea-div">{{dataInfo.descp}}</div>
54 44
          </el-form-item>
55 45
        </el-col>
56
        <el-col :span="24">
46
        <el-col :span="24" v-if="dataInfo.remark">
57 47
          <el-form-item label="备注" class="el-to-block"><br />
58
            <div class="textarea-div">
59
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.
60
            </div>
48
            <div class="textarea-div">{{dataInfo.remark}}</div>
61 49
          </el-form-item>
62 50
        </el-col>
63 51
        <el-col :span="24" class="el-btn-col">
@ -71,50 +59,34 @@
71 59
</template>
72 60
73 61
<script>
62
import { getBridgeInfo } from '@/api/table'
74 63
75 64
export default {
65
  props: {
66
    bridgeId: {
67
      type: String
68
    }
69
  },
76 70
  data() {
77 71
    return {
78 72
      dialogTableVisible: false,
79
      tableRow: [{
80
        prop: 'date',
81
        label: '维护负责人'
82
      }, {
83
        prop: 'name',
84
        label: '职位'
85
      }, {
86
        prop: 'address',
87
        label: '所在机构'
88
      }, {
89
        prop: 'address2',
90
        label: '联系电话'
91
      }, {
92
        prop: 'address3',
93
        label: '联系邮箱'
94
      }],
95
      tableData: [{
96
        date: '王明',
97
        name: '工程师',
98
        address: '上海市普陀区金沙江路 1518 弄',
99
        address2: '15795223636',
100
        address3: '26586466@qq.com'
101
      }, {
102
        date: '王明',
103
        name: '工程师',
104
        address: '上海市普陀区金沙江路 1518 弄',
105
        address2: '15795223636',
106
        address3: '26586466@qq.com'
107
      }, {
108
        date: '王明',
109
        name: '工程师',
110
        address: '上海市普陀区金沙江路 1518 弄',
111
        address2: '15795223636',
112
        address3: '26586466@qq.com'
113
      }]
73
      dataInfo: ''
114 74
    }
115 75
  },
76
  created() {
77
    this.bridgeInfo()
78
  },
116 79
  methods: {
117
80
    bridgeInfo() {
81
      const param = {
82
        id: this.bridgeId
83
      }
84
      getBridgeInfo(param).then(res => {
85
        if (res.success) {
86
          this.dataInfo = res.data
87
        }
88
      })
89
    }
118 90
  }
119 91
}
120 92
</script>

+ 4 - 6
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog02.vue

@ -6,19 +6,17 @@
6 6
          <div class="list-item">
7 7
            <el-row>
8 8
              <el-col :span="12">
9
                <el-form-item label="服务器编号">000000001</el-form-item>
9
                <el-form-item label="服务器编号">{{item.code}}</el-form-item>
10 10
              </el-col>
11 11
              <el-col :span="12">
12
                <el-form-item label="采集器数量">2</el-form-item>
12
                <el-form-item label="采集器数量">{{item.devices}}</el-form-item>
13 13
              </el-col>
14 14
              <el-col :span="24">
15
                <el-form-item label="所属桥梁">青岛跨海大桥</el-form-item>
15
                <el-form-item label="所属桥梁">{{item.bridgeId}}</el-form-item>
16 16
              </el-col>
17 17
              <el-col :span="24">
18 18
                <el-form-item label="备注" class="el-to-block"><br />
19
                  <div class="textarea-div">
20
                  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.
21
                  </div>
19
                  <div class="textarea-div">{{item.remark}}</div>
22 20
                </el-form-item>
23 21
              </el-col>
24 22
            </el-row>

+ 27 - 35
src/views/bridgesConsole/bridgeDetail/components/updateLoginPwd.vue

@ -1,6 +1,9 @@
1 1
<template>
2 2
  <el-dialog title="修改登录密码" ref="ruleForm" :visible.sync="dialogTableVisible" width="460px">
3 3
    <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm">
4
      <el-form-item prop="oldpass">
5
        <el-input type="password" v-model="ruleForm2.oldpass" placeholder="请输入您的旧密码" auto-complete="off"></el-input>
6
      </el-form-item>
4 7
      <el-form-item prop="pass">
5 8
        <el-input type="password" v-model="ruleForm2.pass" placeholder="请设置您的新密码" auto-complete="off"></el-input>
6 9
      </el-form-item>
@ -18,6 +21,8 @@
18 21
</template>
19 22
20 23
<script>
24
import { changePw } from '@/api/login'
25
import { Alert } from 'element-ui'
21 26
22 27
export default {
23 28
  data() {
@ -45,10 +50,14 @@ export default {
45 50
    return {
46 51
      dialogTableVisible: false,
47 52
      ruleForm2: {
53
        oldpass: '',
48 54
        pass: '',
49 55
        checkPass: ''
50 56
      },
51 57
      rules2: {
58
        oldpass: [
59
          { required: true, message: '请输入您的旧密码', trigger: 'blur' }
60
        ],
52 61
        pass: [
53 62
          { validator: validatePass, trigger: 'blur' }
54 63
        ],
@ -62,41 +71,24 @@ export default {
62 71
    resetPwd(formName) {
63 72
      this.$refs[formName].validate((valid) => {
64 73
        if (valid) {
65
          // this.$axios.post(httpUrl.hQuery.sign.resetpw, {
66
          //   code: this.resetCode,
67
          //   pw: this.ruleForm2.pass
68
          // }).then(res => {
69
          //   console.log(res);
70
          //   if (res.success) {
71
          //     this.$alert('您可以使用新密码登录您的账户了', '恭喜您,您的密码重置成功!', {
72
          //       confirmButtonText: '重新登录',
73
          //       type: 'success',
74
          //       center: true,
75
          //       callback: action => {
76
          //         if (action === 'confirm') {
77
          //           this.$router.push({path: '/loginPlat'});
78
          //         };
79
          //       }
80
          //     });
81
          //   } else {
82
          //     if (res.code === -600001) {
83
          //       this.$alert('小提示:邮件内的链接有效时长为10分钟', '很抱歉,当前的链接已失效。', {
84
          //         confirmButtonText: '重新找回密码',
85
          //         type: 'warning',
86
          //         center: true,
87
          //         callback: action => {
88
          //           if (action === 'confirm') {
89
          //             this.stepFisrt = true;
90
          //             this.stepSecond = false;
91
          //             this.stepThird = false;
92
          //             this.stepVal = 0;
93
          //           };
94
          //         }
95
          //       });
96
          //       return;
97
          //     };
98
          //   };
99
          // });
74
          const params = {
75
            oldPw: this.ruleForm2.oldpass,
76
            newpw: this.ruleForm2.checkPass
77
          }
78
          changePw(params).then((res) => {
79
            if (res.success) {
80
              Alert('提示', '密码修改成功!', {
81
                confirmButtonText: '确定',
82
                type: 'success',
83
                center: true
84
                // callback: action => {
85
                //   if (action === 'confirm') {
86
                //     this.$router.push({path: '/loginPlat'})
87
                //   }
88
                // }
89
              })
90
            }
91
          })
100 92
        } else {
101 93
          return false
102 94
        }

+ 1 - 1
src/views/bridgesConsole/bridgeDetail/index.vue

@ -24,7 +24,7 @@
24 24
            <span>实时监测</span>
25 25
          </div>
26 26
          <el-row>
27
            <line-chart :chart-data="lineChartData"></line-chart>
27
            <!-- <line-chart :chart-data="lineChartData"></line-chart> -->
28 28
          </el-row>
29 29
        </el-card>
30 30
      </el-col>

+ 1 - 54
src/views/dashboard/admin/index.vue

@ -1,70 +1,17 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3
  超级管理员,欢迎您
4
   <!--  <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
5
      <line-chart :chart-data="lineChartData"></line-chart>
6
    </el-row> -->
7
8
   <!--  <el-row :gutter="32">
9
      <el-col :xs="24" :sm="24" :lg="8">
10
        <div class="chart-wrapper">
11
          <raddar-chart></raddar-chart>
12
        </div>
13
      </el-col>
14
      <el-col :xs="24" :sm="24" :lg="8">
15
        <div class="chart-wrapper">
16
          <pie-chart></pie-chart>
17
        </div>
18
      </el-col>
19
      <el-col :xs="24" :sm="24" :lg="8">
20
        <div class="chart-wrapper">
21
          <bar-chart></bar-chart>
22
        </div>
23
      </el-col>
24
    </el-row> -->
3
    超级管理员,欢迎您
25 4
  </div>
26 5
</template>
27 6
28 7
29 8
<script>
30
import LineChart from './components/LineChart'
31
32
const lineChartData = {
33
  newVisitis: {
34
    expectedData: [100, 120, 161, 134, 105, 160, 165],
35
    actualData: [120, 82, 91, 154, 162, 140, 145]
36
  },
37
  messages: {
38
    expectedData: [200, 192, 120, 144, 160, 130, 140],
39
    actualData: [180, 160, 151, 106, 145, 150, 130]
40
  },
41
  purchases: {
42
    expectedData: [80, 100, 121, 104, 105, 90, 100],
43
    actualData: [120, 90, 100, 138, 142, 130, 130]
44
  },
45
  shoppings: {
46
    expectedData: [130, 140, 141, 142, 145, 150, 160],
47
    actualData: [120, 82, 91, 154, 162, 140, 130]
48
  }
49
}
50
51 9
export default {
52 10
  name: 'dashboard-admin',
53
  components: {
54
    LineChart
55
  },
56 11
  created() {
57 12
    this.toPath()
58 13
  },
59
  data() {
60
    return {
61
      lineChartData: lineChartData.newVisitis
62
    }
63
  },
64 14
  methods: {
65
    handleSetLineChartData(type) {
66
      this.lineChartData = lineChartData[type]
67
    },
68 15
    toPath() {
69 16
      this.$router.push({ path: '/peoplesManage/infoManage' })
70 17
    }

+ 1 - 1
src/views/dashboard/index.vue

@ -23,7 +23,7 @@ export default {
23 23
    ])
24 24
  },
25 25
  created() {
26
    if (this.roles.includes('0')) {
26
    if (this.roles.indexOf('1') === -1) {
27 27
      this.currentRole = 'otherDashboard'
28 28
    }
29 29
  }

+ 39 - 14
src/views/dashboard/other/index.vue

@ -1,13 +1,13 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3 3
    <el-row class="panel-group" :gutter="40">
4
      <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col" v-for="item in [0,1,2,3,4]" :key="item.id" @click.native="goToDashboardC">
4
      <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col" v-for="item in dataList" :key="item.index" @click.native="goToDashboardC(item.id)">
5 5
        <div class='card-panel'>
6 6
          <div class="card-panel-icon-wrapper">
7
            <div class="card-image" style="background-image: url(/static/touchwave.png);"></div>
7
            <div class="card-image" :style="{ backgroundImage: 'url(/data/bridge'+ item.img +')'}"></div>
8 8
          </div>
9 9
          <div class="card-panel-description">
10
            <div class="card-panel-text">桥梁名称 <span>山东青岛跨海大桥A段</span></div>
10
            <div class="card-panel-text">桥梁名称 <span>{{item.shortName}}</span></div>
11 11
            <div class="card-panel-text">未读报警 10条</div>
12 12
          </div>
13 13
        </div>
@ -16,37 +16,62 @@
16 16
    <div class="pagination-container">
17 17
      <el-pagination
18 18
        background
19
        @size-change="handleSizeChange"
20 19
        @current-change="handleCurrentChange"
21
        :current-page.sync="currentPage"
22
        :page-size="4"
20
        :page-size="9"
23 21
        layout="prev, pager, next, jumper"
24
        :total="10">
22
        :total="total">
25 23
      </el-pagination>
26 24
    </div>
27 25
  </div>
28 26
</template>
29 27
30 28
<script>
29
import { getBridgeList } from '@/api/table'
31 30
32 31
export default {
33 32
  data() {
34 33
    return {
35
      currentPage: 1
34
      listParameters: {},
35
      total: 0,
36
      dataList: [],
37
      ifDefault: false
36 38
    }
37 39
  },
40
  created() {
41
    this.listParameters = {
42
      active: 1,
43
      pageSize: 10,
44
      pageNo: 1
45
    }
46
    this.getBridgeLists()
47
  },
38 48
  components: {
39
40 49
  },
41 50
  methods: {
42
    goToDashboardC() {
43
      this.$router.push({ path: '/bridgesConsole' })
51
    getBridgeLists() {
52
      const param = this.listParameters
53
      getBridgeList(param).then(res => {
54
        if (res.success) {
55
          if (res.data.data.length === 0) {
56
            this.ifDefault = true
57
          } else {
58
            this.ifDefault = false
59
          }
60
          this.dataList = res.data.data
61
          // this.disposeData(res.data.data);
62
          this.total = res.data.total
63
        }
64
      })
44 65
    },
45
    handleSizeChange(val) {
46
      console.log(`每页 ${val} 条`)
66
    goToDashboardC(id) {
67
      this.$router.push({
68
        path: '/bridgesConsole/bridgeDetail',
69
        query: { bridgeId: id }
70
      })
47 71
    },
48 72
    handleCurrentChange(val) {
49
      console.log(`当前页: ${val}`)
73
      this.expertParameters.pageNo = val
74
      this.getBridgeLists()
50 75
    }
51 76
  }
52 77
}

+ 75 - 82
src/views/findPwd/index.vue

@ -2,8 +2,8 @@
2 2
  <div class="login-container">
3 3
    <div class="logo-wrapper"></div>
4 4
    <div class="form-wrapper">
5
      <div class="form-contain">
6
        <p class="form-title">找回密码</p>
5
      <div class="form-contain login-form">
6
        <h3 class="title">找回密码</h3>
7 7
        <div class="step-wrapper">
8 8
          <el-steps :active="stepVal" finish-status="success" align-center>
9 9
            <el-step title="输入手机号"></el-step>
@ -25,13 +25,13 @@
25 25
             </el-input>
26 26
            </el-form-item>
27 27
            <el-form-item>
28
              <el-button type="primary" :disabled="isDisabl" @click="nextStep('ruleForm')">下一步</el-button>
28
              <el-button class="log-btn" type="primary" :disabled="isDisabl" @click="nextStep('ruleForm')">下一步</el-button>
29 29
            </el-form-item>
30 30
            <el-form-item class="el-form-find">
31 31
              <el-button type="text" @click="goLogin">又想起来了</el-button>
32 32
            </el-form-item>
33 33
          </el-form>
34
          <el-form v-show="stepThird" :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm">
34
          <el-form v-show="stepSecond" :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm">
35 35
            <el-form-item prop="pass">
36 36
              <el-input type="password" v-model="ruleForm2.pass" placeholder="请设置您的新密码" auto-complete="off"></el-input>
37 37
            </el-form-item>
@ -39,7 +39,7 @@
39 39
              <el-input type="password" v-model="ruleForm2.checkPass" placeholder="请再次输入密码确认" auto-complete="off"></el-input>
40 40
            </el-form-item>
41 41
            <el-form-item>
42
              <el-button type="primary" :disabled="isDisabl" @click="resetPwd('ruleForm2')">重置密码</el-button>
42
              <el-button type="primary" :disabled="isDisabl" @click.native.prevent="resetPwd('ruleForm2')">重置密码</el-button>
43 43
            </el-form-item>
44 44
          </el-form>
45 45
        </div>
@ -49,7 +49,7 @@
49 49
</template>
50 50
51 51
<script>
52
  import { isReg, getMsgPhone } from '@/api/login'
52
  import { isReg, getResetMsgPhone, resetPwdByTel } from '@/api/login'
53 53
  import '@/styles/loginform.scss'
54 54
55 55
  export default {
@ -94,7 +94,7 @@
94 94
        resetCode: '',
95 95
        stepVal: 0,
96 96
        stepFisrt: true,
97
        stepThird: false,
97
        stepSecond: false,
98 98
        isDisabl: false,
99 99
        ruleForm: {
100 100
          phoneNum: '',
@ -122,66 +122,65 @@
122 122
        }
123 123
      }
124 124
    },
125
    created() {
126
      // this.platId = Cookies.get('platId')
127
      // this.resetStepNum = util.urlParse('step')
128
      // this.resetCode = util.urlParse('sc')
129
      if (this.resetStepNum === '2') {
130
        this.stepFisrt = false
131
        this.stepThird = true
132
        this.stepVal = 2
133
      }
134
    },
135 125
    methods: {
136 126
      nextStep(formName) {
137 127
        this.$refs[formName].validate((valid) => {
138 128
          if (valid) {
139
            // this.$axios.post(httpUrl.hQuery.sign.reqResetPw, {
140
            //   id: this.platId,
141
            //   mail: this.ruleForm.mail,
142
            //   url: httpUrl.platUrl + '/#/findPwd?step=2&sc'
143
            // }).then(res => {
144
            //   console.log(res)
145
            //   if (res.success) {
146
            //     this.stepFisrt = false
147
            //     this.stepVal = 1
148
            //   } else {
149
            //     let errorCode = [{
150
            //       code: -600001,
151
            //       msg: '用户不存在'
152
            //     }, {
153
            //       code: -600002,
154
            //       msg: '发送邮箱错误'
155
            //     }]
156
            //     for (let i = 0 i < errorCode.length i++) {
157
            //       if (res.code === errorCode[i].code) {
158
            //         this.$message.error(errorCode[i].msg)
159
            //         return
160
            //       }
161
            //     }
162
            //   }
163
            // })
129
            this.stepFisrt = false
130
            this.stepSecond = true
131
            this.stepVal = 1
164 132
          } else {
165 133
            return false
166 134
          }
167 135
        })
168 136
      },
169 137
      userRegisterOk() {
170
        isReg(this.ruleForm.phoneNum).then(res => {
138
        const me = this
139
        const account = this.ruleForm.phoneNum
140
        isReg({ account }).then(res => {
171 141
          if (res.success) {
172 142
            if (res.data === true) {
173
              this.$message({
143
              me.sendMsgDisabled = false
144
              me.phoneCodeBol = false
145
              me.$message({
174 146
                message: '该账号不存在,请检查后重试',
175 147
                type: 'warning'
176 148
              })
149
            } else {
150
              me.getResetMsgPhone()
151
              me.sendMsgDisabled = true
152
              me.phoneCodeBol = true
153
              const interval = window.setInterval(function() {
154
                if ((me.seconds--) <= 0) {
155
                  me.seconds = 60
156
                  me.sendMsgDisabled = false
157
                  me.phoneCodeBol = false
158
                  window.clearInterval(interval)
159
                }
160
              }, 1000)
177 161
            }
178 162
          }
179 163
        })
180 164
      },
181
      getPhoneLogin() {
182
        getMsgPhone(this.ruleForm.phoneNum, true).then((res) => {
183
          if (res.success) {
184
            this.phoneResBackLogin = res.data
165
      getResetMsgMsgPhone() {
166
        const me = this
167
        const account = this.ruleForm.phoneNum
168
        const checkExists = true
169
        getResetMsgPhone({ account, checkExists }).then((res) => {
170
          if (!res.success) {
171
            if (res.code === -60000) {
172
              me.sendMsgDisabled = false
173
              me.phoneCodeBol = false
174
              me.$message({
175
                message: '该账号不存在,请检查后重试',
176
                type: 'warning'
177
              })
178
            } else {
179
              me.$message({
180
                message: res.detailMsg,
181
                type: 'warning'
182
              })
183
            }
185 184
          }
186 185
        })
187 186
      },
@ -215,40 +214,34 @@
215 214
      resetPwd(formName) {
216 215
        this.$refs[formName].validate((valid) => {
217 216
          if (valid) {
218
            // this.$axios.post(httpUrl.hQuery.sign.resetpw, {
219
            //   code: this.resetCode,
220
            //   pw: this.ruleForm2.pass
221
            // }).then(res => {
222
            //   console.log(res)
223
            //   if (res.success) {
224
            //     this.$alert('您可以使用新密码登录您的账户了', '恭喜您,您的密码重置成功!', {
225
            //       confirmButtonText: '重新登录',
226
            //       type: 'success',
227
            //       center: true,
228
            //       callback: action => {
229
            //         if (action === 'confirm') {
230
            //           this.$router.push({path: '/loginPlat'})
231
            //         }
232
            //       }
233
            //     })
234
            //   } else {
235
            //     if (res.code === -600001) {
236
            //       this.$alert('小提示:邮件内的链接有效时长为10分钟', '很抱歉,当前的链接已失效。', {
237
            //         confirmButtonText: '重新找回密码',
238
            //         type: 'warning',
239
            //         center: true,
240
            //         callback: action => {
241
            //           if (action === 'confirm') {
242
            //             this.stepFisrt = true
243
            //             this.stepThird = false
244
            //             this.stepVal = 0
245
            //           }
246
            //         }
247
            //       })
248
            //       return
249
            //     }
250
            //   }
251
            // })
217
            resetPwdByTel(this.ruleForm.msgVC, this.ruleForm2.pass).then((res) => {
218
              if (res.success) {
219
                this.$alert('提示', '密码已重置,快去登录吧!', {
220
                  confirmButtonText: '确定',
221
                  type: 'success',
222
                  center: true,
223
                  callback: action => {
224
                    if (action === 'confirm') {
225
                      this.$router.push({ path: '/login' })
226
                    }
227
                  }
228
                })
229
              } else {
230
                this.$alert('提示', '密码重置失败!', {
231
                  confirmButtonText: '重新找回密码',
232
                  type: 'warning',
233
                  center: true,
234
                  callback: action => {
235
                    if (action === 'confirm') {
236
                      this.stepFisrt = true
237
                      this.stepSecond = false
238
                      this.stepVal = 0
239
                    }
240
                  }
241
                })
242
                return
243
              }
244
            })
252 245
          } else {
253 246
            return false
254 247
          }

+ 5 - 5
src/views/layout/components/AppMain.vue

@ -1,8 +1,8 @@
1 1
<template>
2 2
  <section class="app-main">
3 3
    <transition name="fade" mode="out-in">
4
      <!-- <router-view :key="key"></router-view> -->
5
      <router-view></router-view>
4
      <router-view :key="key"></router-view>
5
      <!-- <router-view></router-view> -->
6 6
    </transition>
7 7
  </section>
8 8
</template>
@ -11,9 +11,9 @@
11 11
export default {
12 12
  name: 'AppMain',
13 13
  computed: {
14
    // key() {
15
    //   return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
16
    // }
14
    key() {
15
      return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
16
    }
17 17
  }
18 18
}
19 19
</script>

+ 1 - 1
src/views/layout/components/TopNavbar.vue

@ -5,7 +5,7 @@
5 5
    </div>
6 6
    <el-dropdown class="avatar-container" trigger="click">
7 7
      <div class="avatar-wrapper">
8
      	<div>您好,{ name }</div>
8
      	<div>您好,{{ name }}</div>
9 9
        <i class="el-icon-caret-bottom"></i>
10 10
      </div>
11 11
      <el-dropdown-menu class="user-dropdown" slot="dropdown">

+ 37 - 7
src/views/login/index.vue

@ -13,7 +13,7 @@
13 13
        <span class="svg-container">
14 14
          <svg-icon icon-class="password"></svg-icon>
15 15
        </span>
16
        <el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on"
16
        <el-input name="password" :type="pwdType" v-model="loginForm.password" autoComplete="on"
17 17
          placeholder="请输入登录密码"></el-input>
18 18
          <span class="show-pwd" @click="showPwd"><svg-icon icon-class="eye" /></span>
19 19
      </el-form-item>
@ -25,7 +25,7 @@
25 25
        <img slot="append" :src="imgVcUrl" @click="changeImgVc" /></el-input>
26 26
      </el-form-item>
27 27
      <el-form-item>
28
        <el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">登录</el-button>
28
        <el-button class="log-btn" type="primary" :loading="loading" @click.native.prevent="handleLogin" @keyup.enter.native="handleLogin">登录</el-button>
29 29
      </el-form-item>
30 30
      <el-form-item class="el-form-find">
31 31
        <el-button type="text" @click.native.prevent="goBackPwd">忘记密码?</el-button>
@ -35,7 +35,7 @@
35 35
</template>
36 36
37 37
<script>
38
// import { isvalidUsername } from '@/utils/validate'
38
import { Message } from 'element-ui'
39 39
import { getPictureVC } from '@/api/pictureVc'
40 40
import '@/styles/loginform.scss'
41 41
@ -83,14 +83,44 @@ export default {
83 83
      }
84 84
    },
85 85
    handleLogin() {
86
      alert(111)
87 86
      this.$refs.loginForm.validate(valid => {
88 87
        if (valid) {
89 88
          this.loading = true
90
          this.$store.dispatch('LoginByUsername', this.loginForm).then(() => {
91
            alert(333)
89
          this.$store.dispatch('LoginByUsername', this.loginForm).then((response) => {
92 90
            this.loading = false
93
            this.$router.push({ path: '/' })
91
            if (response.success) {
92
              if (response.data) {
93
                const dataS = response.data
94
                if (dataS.active) {
95
                  this.$store.dispatch('GetUserInfo').then(res => {
96
                  })
97
                  this.$router.push({ path: '/' })
98
                } else {
99
                  Message.error('您的账号已经被禁用')
100
                  return
101
                }
102
              } else {
103
                Message.error('登录账号与密码不匹配')
104
                return
105
              }
106
            } else {
107
              const errorCode = [{
108
                code: -60001,
109
                msg: '图形验证码不存在'
110
              }, {
111
                code: -60002,
112
                msg: '图形验证码超时'
113
              }, {
114
                code: -60003,
115
                msg: '图形验证码不正确'
116
              }]
117
              for (let i = 0; i < errorCode.length; i++) {
118
                if (response.code === errorCode[i].code) {
119
                  Message.error(errorCode[i].msg)
120
                  return
121
                }
122
              }
123
            }
94 124
          }).catch(() => {
95 125
            this.loading = false
96 126
          })