Ver Fonte

登录页面调整

yuedefeng há 6 anos atrás
pai
commit
e8d99b79ed

+ 142 - 10
src/dashoo.cn/frontend_web/src/pages/login.vue

@@ -17,15 +17,8 @@
 
         </div>
       </div>
-
     </sticky>
 
-    <!--<el-menu v-if="activeIndex==1 || activeIndex==2" :default-active="activeIndex" @select="handleSelect" mode="horizontal">
-      <el-menu-item index="0">登录</el-menu-item>
-      <el-menu-item index="1">通知中心</el-menu-item>
-      <el-menu-item index="2">文件下载中心</el-menu-item>
-    </el-menu>-->
-
     <!--<div class="back-width1" style="margin-top: 10px" v-if="activeIndex==0">
       <el-carousel>
         <el-carousel-item key="1">
@@ -295,6 +288,145 @@
 </template>
 
 <script>
+  import Vue from 'vue'
+  import Component from 'class-component'
+  import Sticky from '@/components/Sticky'
+  @Component({
+    data () {
+      // form model
+      // TODO: remove default values
+      const model = {
+        username: '',
+        password: ''
+      }
+
+      // form validate rules
+      const rules = {
+        username: [{
+          required: true,
+          message: '请输入用户名'
+        }],
+        password: [{
+          required: true,
+          message: '请输入密码'
+        }]
+      }
+
+      return {
+        loginMode: 1,
+        model: model,
+        rules: rules,
+        error: null,
+        loading: false,
+        noticeList: [], //通知列表
+        fileList: [], //文档列表
+        activeName: 'first',
+        activeIndex: '0',
+      }
+    },
+
+    created () {
+      this.initNoticeListData()
+      this.initFileListData()
+    },
+    components: {
+      Sticky
+    },
+    methods: {
+      //获取通知列表
+      initNoticeListData() {
+        let _this = this
+        //传递列名
+        const params = {
+          colName: "NoticeTab"
+        }
+        _this.$axios.get("/document/getdocumentnameandtime", {params})
+          .then(function (response) {
+            _this.noticeList = response.data
+          })
+          .catch(function (error) {
+            console.log(error);
+          });
+      },
+      //获取文件列表
+      initFileListData() {
+        let _this = this
+        //传递列名
+        const params = {
+          colName: "DocTab"
+        }
+        _this.$axios.get("/document/getdocumentnameandtime", {params})
+          .then(function (response) {
+            _this.fileList = response.data
+          })
+          .catch(function (error) {
+            console.log(error);
+          });
+      },
+      //下载文件
+      DownloadFile(row){
+        let val = row.FileURL
+        let urlArr = val.split('|')
+        location.href = "http://" + urlArr[0]
+      },
+      //格式化时间
+      jstimehandle(val) {
+        if (val === '') {
+          return '----'
+        } else if (val === '0001-01-01T08:00:00+08:00') {
+          return '----'
+        } else if (val === '5000-01-01T23:59:59+08:00') {
+          return '永久'
+        } else {
+          val = val.replace('T', ' ')
+          return val.substring(0, 10)
+        }
+      },
+      handleSelect (key, keyPath) {
+        this.activeIndex = key
+      }
+    }
+
+  })
+  export default class Login extends Vue {
+    layout() {
+      return 'empty'
+    }
+    login() {
+      this.logging = true
+      this.$refs.user.validate(async (valid) => {
+        try {
+          if (valid) {
+            await this.$store.dispatch('auth/login', {
+              fields: {
+                username: this.model.username.replace(/(^\s*)|(\s*$)/g, ""),
+                password: this.model.password.replace(/(^\s*)|(\s*$)/g, "")
+              }
+            })
+            if (process.env.appclient == 'lims') {
+              this.$router.push(this.$route.query.page || '/')
+            } else if (process.env.appclient == 'cellbank') {
+              this.$router.push(this.$route.query.page || '/indexdqm')
+            } else {
+              this.$router.push(this.$route.query.page || '/')
+            }
+          }
+        } catch (e) {
+          // this.$message.warning(e.message)
+          this.$message.warning('账号或密码错误')
+        } finally {
+          this.logging = false
+        }
+      })
+    }
+    logout() {
+      this.$store.dispatch('logout')
+    }
+  }
+
+</script>
+
+<!--<script>
 import Sticky from '@/components/Sticky'
 
 export default {
@@ -417,9 +549,9 @@ export default {
     //格式化时间
     jstimehandle(val) {
       if (val === '') {
-        return '----'
+        return '&#45;&#45;&#45;&#45;'
       } else if (val === '0001-01-01T08:00:00+08:00') {
-        return '----'
+        return '&#45;&#45;&#45;&#45;'
       } else if (val === '5000-01-01T23:59:59+08:00') {
         return '永久'
       } else {
@@ -430,7 +562,7 @@ export default {
   }
 
 }
-</script>
+</script>-->
 
 <style lang="scss" scoped>
   @import '../assets/styles/base/variables';

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/logingf.vue

@@ -175,7 +175,7 @@
     }
 
   })
-  export default class Login extends Vue {
+  export default class Logingf extends Vue {
     layout() {
       return 'empty'
     }