zhuangyp 4 سال پیش
والد
کامیت
c1655bbb81

+ 23 - 0
debug.log

@@ -0,0 +1,23 @@
+[0723/175343.484:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0723/175505.035:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/083722.429:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/083916.501:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/134834.078:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/135016.874:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/135834.082:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/135834.084:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/140334.083:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/141321.600:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/141423.452:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/142242.486:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/142321.605:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/142321.606:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/142418.864:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/142821.605:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/144321.618:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0724/145821.632:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0726/202645.186:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0726/202832.170:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0726/203645.192:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0726/203645.222:ERROR:crash_report_database_win.cc(428)] unexpected header
+[0726/204145.196:ERROR:crash_report_database_win.cc(428)] unexpected header

+ 1 - 1
src/api/user/index.js

@@ -2,7 +2,7 @@ import request from '@/utils/request'
 
 export function login(data) {
   return request({
-    url: '/basic/login/',
+    url: '/workreport/login/',
     method: 'post',
     data
   })

+ 2 - 1
src/router/asyncRouter.js

@@ -1,5 +1,6 @@
 import BasicRouter from './basic/index'
+import WorkreporyRouter from './workreport/index'
 
-const asyncRouter = BasicRouter
+const asyncRouter = BasicRouter.concat(WorkreporyRouter)
 
 export default asyncRouter

+ 1 - 1
src/router/constantRouter.js

@@ -17,7 +17,7 @@ const constantRouter = PersonRouter.concat([
   },
   {
     path: '/login',
-    component: () => import('@/views/login/index'),
+    component: () => import('@/views/login/index1'),
     hidden: true
   },
   {

+ 2 - 20
src/router/index.js

@@ -4,27 +4,9 @@ import Router from 'vue-router'
 Vue.use(Router)
 
 import constantRouter from './constantRouter'
+import asyncRouter from './asyncRouter'
 // import asyncRouter from './asyncRouter'
 
-/**
- * Note: sub-menu only appear when route children.length >= 1
- * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
- *
- * hidden: true                   if set true, item will not show in the sidebar(default is false)
- * alwaysShow: true               if set true, will always show the root menu
- *                                if not set alwaysShow, when item has more than one children route,
- *                                it will becomes nested mode, otherwise not show the root menu
- * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
- * name:'router-name'             the name is used by <keep-alive> (must set!!!)
- * meta : {
-    roles: ['admin','editor']    control the page roles (you can set multiple roles)
-    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
-    icon: 'svg-name'             the icon show in the sidebar
-    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
-    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
-  }
- */
-
 /**
  * constantRoutes
  * a base page that does not have permission requirements
@@ -32,7 +14,7 @@ import constantRouter from './constantRouter'
  */
 
 // export const constantRoutes = constantRouter.concat(asyncRouter)
-export const constantRoutes = constantRouter
+export const constantRoutes = constantRouter.concat(asyncRouter)
 
 // export const asyncRoutes = asyncRouter
 

+ 19 - 0
src/router/workreport/index.js

@@ -0,0 +1,19 @@
+import Layout from '@/layout'
+
+export default [
+  {
+    path: '/workreport',
+    component: Layout,
+    name: 'Workreport',
+    meta: { title: '工作日报', icon: 'home', codename: 'Workreport' },
+    children: [
+      {
+        path: 'list',
+        name: 'WorkreportList',
+        component: () => import('@/views/workreport/list'),
+        meta: { icon: 'home', title: '工作日报', codename: 'Workreport/WorkreportList' }
+        // hidden: true
+      }
+    ]
+  }
+]

+ 2 - 2
src/store/modules/user.js

@@ -45,9 +45,9 @@ const mutations = {
 const actions = {
   // user login
   login({ commit }, userInfo) {
-    const { phone, password } = userInfo
+    const { username, password } = userInfo
     return new Promise((resolve, reject) => {
-      login({ phone: phone.trim(), password: password }).then(response => {
+      login({ username: username.trim(), password: password }).then(response => {
         const data = response
         commit('SET_TOKEN', getToken())
         // setToken(data.token)

+ 326 - 0
src/views/login/index1.vue

@@ -0,0 +1,326 @@
+<template>
+  <div>
+    <div class="top-container">
+      <div class="amtxts-logo" />
+    </div>
+    <div class="login-container">
+      <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
+
+        <div class="title-container">
+          <h4 class="title">龙湾区人大预算监督系统</h4>
+        </div>
+
+        <el-form-item prop="username">
+          <span class="svg-container">
+            <svg-icon icon-class="user" />
+          </span>
+          <el-input
+            ref="username"
+            v-model="loginForm.username"
+            placeholder="用户名"
+            name="username"
+            type="text"
+            tabindex="1"
+            auto-complete="on"
+          />
+        </el-form-item>
+
+        <el-form-item prop="password">
+          <span class="svg-container">
+            <svg-icon icon-class="password" />
+          </span>
+          <el-input
+            :key="passwordType"
+            ref="password"
+            v-model="loginForm.password"
+            :type="passwordType"
+            placeholder="密 码"
+            name="password"
+            tabindex="2"
+            auto-complete="on"
+            @keyup.enter.native="handleLogin"
+          />
+          <span class="show-pwd" @click="showPwd">
+            <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
+          </span>
+        </el-form-item>
+        <el-button :loading="loading" size="medium" type="primary" class="blue-black" style="width:100%;" @click.native.prevent="handleLogin">登 录</el-button>
+
+      </el-form>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import { validUsername } from '@/utils/validate'
+// import amtxts from '@/assets/login/amtxts.png'
+import logo from '@/assets/login/logo.png'
+import { Message } from 'element-ui'
+
+export default {
+  name: 'Login',
+  data() {
+    const validateUsername = (rule, value, callback) => {
+      if (!validUsername(value)) {
+        callback(new Error('请输入正确的用户名'))
+      } else {
+        callback()
+      }
+    }
+    const validatePassword = (rule, value, callback) => {
+      if (value.length < 6) {
+        callback(new Error('密码长度不能少于6位'))
+      } else {
+        callback()
+      }
+    }
+    return {
+      loginForm: {
+        username: process.env.NODE_ENV === 'production' ? '' : '13392951645',
+        password: process.env.NODE_ENV === 'production' ? '' : 'abc.123'
+      },
+      loginRules: {
+        username: [{ required: true, message: '请输入用户名', trigger: 'blur', validator: validateUsername }],
+        password: [{ required: true, message: '请输入密码', trigger: 'blur', validator: validatePassword }]
+      },
+      loading: false,
+      passwordType: 'password',
+      redirect: undefined,
+      logo: logo,
+      dialogFormVisible: false,
+      inputType: {
+        password: {
+          type: 'password',
+          icon: 'eye'
+        },
+        confirmation: {
+          type: 'password',
+          icon: 'eye'
+        }
+      }
+    }
+  },
+  watch: {
+    $route: {
+      handler: function(route) {
+        this.redirect = route.query && route.query.redirect
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    showPwd() {
+      if (this.passwordType === 'password') {
+        this.passwordType = ''
+      } else {
+        this.passwordType = 'password'
+      }
+      this.$nextTick(() => {
+        this.$refs.password.focus()
+      })
+    },
+    showPassword(fieldType) {
+      if (this.inputType[fieldType].type === 'password') {
+        this.inputType[fieldType].type = 'text'
+        this.inputType[fieldType].icon = 'eye-open'
+      } else {
+        this.inputType[fieldType].type = 'password'
+        this.inputType[fieldType].icon = 'eye'
+      }
+    },
+    handleLogin() {
+      this.$refs.loginForm.validate(valid => {
+        if (valid) {
+          this.login(this.loginForm)
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    login(data) {
+    //   this.$router.push({ path: this.redirect || '/' })
+      this.loading = true
+      this.$store.dispatch('user/login', data).then(() => {
+        this.$router.push({ path: this.redirect || '/' })
+        this.loading = false
+      }, () => {
+        Message({
+          message: '无效的用户名或密码!',
+          type: 'error',
+          duration: 3 * 1000
+        })
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    validConfirmation(value) {
+      return this.registerForm.password === value
+    }
+  }
+}
+</script>
+
+<style rel="stylesheet/scss" lang="scss">
+$bg:#2d3a4b;
+$light_gray:#eee;
+
+/* reset element-ui css */
+.login-container {
+  .el-input {
+    display: inline-block;
+    height: 47px;
+    width: 85%;
+    input {
+      // background: transparent;
+      border: 0px;
+      -webkit-appearance: none;
+      border-radius: 0px;
+      padding: 12px 5px 12px 15px;
+      // color: $light_gray;
+      height: 47px;
+      &:-webkit-autofill {
+        -webkit-box-shadow: 0 0 0px 1000px $bg inset !important;
+        -webkit-text-fill-color: #fff !important;
+      }
+    }
+  }
+  .el-form-item {
+    border: 1px solid $light_gray;
+    // background: rgba(0, 0, 0, 0.1);
+    border-radius: 5px;
+    // color: #454545;
+  }
+}
+
+</style>
+
+<style rel="stylesheet/scss" lang="scss" scoped>
+$bg:#2d3a4b;
+$dark_gray:#889aa4;
+$light_gray:#eee;
+.top-container{
+  position: absolute;
+  top:10px;
+  background: transparent;
+  color:white;
+  z-index: 2;
+  // width:99%;
+  .amtxts-logo{
+    div{
+      position: relative;
+      top: -34px;
+      left: 60px;
+    }
+    img{
+      width:50px;
+      height:40px;
+    }
+
+    position: relative;
+    left: 15px;
+    font-size: 14px;
+  }
+  .yt-logo{
+    position: absolute;
+    right:0px;
+  }
+}
+
+.footer-container{
+  position: absolute;
+  background: transparent;
+  z-index: 2;
+  bottom:10px;
+  width:100%;
+  text-align: center;
+  color:white;
+  font-size:12px;
+}
+
+.login-container {
+  position: fixed;
+  height: 100%;
+  width: 100%;
+  background-image: url('~@/assets/login/bg.png');
+  background-size: cover;
+  // background-color: $bg;
+  .form-logo{
+    position: absolute;
+    left: 0;
+    right: 0;
+    width: 490px;
+    height: 60px;
+    margin: 420px auto;
+  }
+  .login-form {
+    position: absolute;
+    left: 0;
+    right: 0;
+    width: 490px;
+    padding: 35px 35px 35px 35px;
+    margin: 120px auto;
+    background:white;
+    border-radius: 4px;
+  }
+  .tips {
+    font-size: 14px;
+    color: #fff;
+    margin-bottom: 10px;
+    span {
+      &:first-of-type {
+        margin-right: 16px;
+      }
+    }
+  }
+  .svg-container {
+    padding: 6px 5px 6px 15px;
+    color: $dark_gray;
+    vertical-align: middle;
+    width: 30px;
+    display: inline-block;
+    &_login {
+      font-size: 20px;
+    }
+  }
+  .title {
+    font-size: 26px;
+    font-weight: 400;
+    // color: $light_gray;
+    margin: 0px auto 30px auto;
+    text-align: center;
+    font-weight: bold;
+    letter-spacing:3px;
+  }
+  .show-pwd {
+    position: absolute;
+    right: 10px;
+    top: 7px;
+    font-size: 16px;
+    color: $dark_gray;
+    cursor: pointer;
+    user-select: none;
+  }
+  .register {
+    margin-bottom: 0;
+    color: rgb(0, 98, 192);
+    font-size:13px;
+    cursor: pointer;
+  }
+}
+.register-contaner {
+  .el-input {
+    display: inline-block;
+  }
+  .show-password {
+    position: absolute;
+    right: 10px;
+    top: 1px;
+    font-size: 16px;
+    color: $dark_gray;
+    cursor: pointer;
+    user-select: none;
+  }
+}
+</style>

+ 43 - 0
src/views/workreport/list.vue

@@ -0,0 +1,43 @@
+<template>
+  <div class="app-container">
+    <el-table :data="tableData" border style="width: 100%">
+      <el-table-column prop="date" label="日期" width="180" />
+      <el-table-column prop="name" label="姓名" width="180" />
+      <el-table-column prop="address" label="地址" />
+    </el-table>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'WorkReportList',
+  data() {
+    return {
+      tableData: [
+        {
+          date: '2016-05-02',
+          name: '王小虎',
+          address: '上海市普陀区金沙江路 1518 弄'
+        },
+        {
+          date: '2016-05-04',
+          name: '王小虎',
+          address: '上海市普陀区金沙江路 1517 弄'
+        },
+        {
+          date: '2016-05-01',
+          name: '王小虎',
+          address: '上海市普陀区金沙江路 1519 弄'
+        },
+        {
+          date: '2016-05-03',
+          name: '王小虎',
+          address: '上海市普陀区金沙江路 1516 弄'
+        }
+      ]
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>