Explorar o código

登陆字体

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing %!s(int64=6) %!d(string=hai) anos
pai
achega
ad18ce17d8
Modificáronse 1 ficheiros con 133 adicións e 135 borrados
  1. 133 135
      src/dashoo.cn/frontend_web/src/pages/login.vue

+ 133 - 135
src/dashoo.cn/frontend_web/src/pages/login.vue

@@ -36,15 +36,15 @@
               <el-menu size="small" :default-active="activeIndex+''" @select="handleSelect" mode="horizontal">
                 <el-menu-item index="0">
                   <i class="el-icon-tickets"></i>
-                  <span>登录</span>
+                  <span><b>登录</b></span>
                 </el-menu-item>
                 <el-menu-item index="1">
                   <i class="el-icon-bell"></i>
-                  <span>通知中心</span>
+                  <span><b>通知通告</b></span>
                 </el-menu-item>
                 <el-menu-item index="2">
                   <i class="el-icon-document"></i>
-                  <span>文件下载中心</span>
+                  <span><b>资料下载</b></span>
                 </el-menu-item>
               </el-menu>
               <el-row>
@@ -189,13 +189,13 @@
 </template>
 
 <script>
-import Vue from "vue";
-import Component from "class-component";
-import Sticky from "@/components/Sticky";
-import api from "@/api/rtxservice/rtx";
+import Vue from 'vue'
+import Component from 'class-component'
+import Sticky from '@/components/Sticky'
+import api from '@/api/rtxservice/rtx'
 import SIdentify from '@/components/VCode.vue'
 @Component({
-  data() {
+  data () {
     const validateVerifycode = (rule, value, callback) => {
       if (value === '') {
         callback(new Error('请输入验证码'))
@@ -208,35 +208,35 @@ import SIdentify from '@/components/VCode.vue'
     // form model
     // TODO: remove default values
     const model = {
-      username: "",
-      password: "",
-      verifycode:""
-    };
+      username: '',
+      password: '',
+      verifycode: ''
+    }
 
     // form validate rules
     const rules = {
       username: [
         {
           required: true,
-          trigger: 'blur', 
-          message: "请输入用户名"
+          trigger: 'blur',
+          message: '请输入用户名'
         }
       ],
       password: [
         {
           required: true,
-          trigger: 'blur', 
-          message: "请输入密码"
+          trigger: 'blur',
+          message: '请输入密码'
         }
       ],
-       verifycode: [
-          { 
-            required: true, 
-            trigger: 'blur', 
-            validator: validateVerifycode 
-          }
+      verifycode: [
+        {
+          required: true,
+          trigger: 'blur',
+          validator: validateVerifycode
+        }
       ]
-    };
+    }
 
     return {
       loginMode: 2,
@@ -244,19 +244,19 @@ import SIdentify from '@/components/VCode.vue'
       rules: rules,
       error: null,
       loading: false,
-      noticeList: [], //通知列表
-      fileList: [], //文档列表
-      activeName: "first",
-      activeIndex: "0",
+      noticeList: [], // 通知列表
+      fileList: [], // 文档列表
+      activeName: 'first',
+      activeIndex: '0',
       flag: 0,
       identifyCode: '',
       identifyCodes: '1234567890'
-    };
+    }
   },
 
-  created() {
-    this.initNoticeListData();
-    this.initFileListData();
+  created () {
+    this.initNoticeListData()
+    this.initFileListData()
     this.identifyCode = ''
     this.makeCode(this.identifyCodes, 4)
   },
@@ -265,188 +265,186 @@ import SIdentify from '@/components/VCode.vue'
     SIdentify
   },
   methods: {
-      // 生成随机数
-    randomNum(min, max) {
+    // 生成随机数
+    randomNum (min, max) {
       return Math.floor(Math.random() * (max - min) + min)
     },
     // 切换验证码
-    refreshCode() {
+    refreshCode () {
       this.identifyCode = ''
       this.makeCode(this.identifyCodes, 4)
     },
     // 生成四位随机验证码
-    makeCode(o, l) {
+    makeCode (o, l) {
       for (let i = 0; i < l; i++) {
-        this.identifyCode += this.identifyCodes[
-          this.randomNum(0, this.identifyCodes.length)
-        ]
+        this.identifyCode += this.identifyCodes[this.randomNum(0, this.identifyCodes.length)]
       }
     },
-    //获取通知列表
-    initNoticeListData() {
-      let _this = this;
-      //传递列名
+    // 获取通知列表
+    initNoticeListData () {
+      let _this = this
+      // 传递列名
       const params = {
-        colName: "NoticeTab"
-      };
+        colName: 'NoticeTab'
+      }
       _this.$axios
-        .get("/document/getdocumentnameandtime", { params })
-        .then(function(response) {
-          _this.noticeList = response.data;
+        .get('/document/getdocumentnameandtime', { params })
+        .then(function (response) {
+          _this.noticeList = response.data
+        })
+        .catch(function (error) {
+          console.log(error)
         })
-        .catch(function(error) {
-          console.log(error);
-        });
     },
-    //获取文件列表
-    initFileListData() {
-      let _this = this;
-      //传递列名
+    // 获取文件列表
+    initFileListData () {
+      let _this = this
+      // 传递列名
       const params = {
-        colName: "DocTab"
-      };
+        colName: 'DocTab'
+      }
       _this.$axios
-        .get("/document/getdocumentnameandtime", { params })
-        .then(function(response) {
-          _this.fileList = response.data;
+        .get('/document/getdocumentnameandtime', { params })
+        .then(function (response) {
+          _this.fileList = response.data
+        })
+        .catch(function (error) {
+          console.log(error)
         })
-        .catch(function(error) {
-          console.log(error);
-        });
     },
-    //下载文件
-    DownloadFile(row) {
-      let val = row.FileURL;
-      let urlArr = val.split("|");
-      location.href = "http://" + urlArr[0];
+    // 下载文件
+    DownloadFile (row) {
+      let val = row.FileURL
+      let urlArr = val.split('|')
+      location.href = 'http://' + urlArr[0]
     },
-    getDownloadFile(val) {
-      let urlArr = val.split("|")
+    getDownloadFile (val) {
+      let urlArr = val.split('|')
       let retUrl = urlArr[0]
-      //内网服务器专用
+      // 内网服务器专用
       if (process.client && retUrl.indexOf('/upfile') === 0) {
         const myDomain = window.location.host
         retUrl = myDomain + '/' + retUrl
       }
-      return "http://" + retUrl
+      return 'http://' + retUrl
     },
-    //格式化时间
-    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 "永久";
+    // 格式化时间
+    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);
+        val = val.replace('T', ' ')
+        return val.substring(0, 10)
       }
     },
-    handleSelect(key, keyPath) {
-      this.activeIndex = key;
+    handleSelect (key, keyPath) {
+      this.activeIndex = key
     },
-    isChrome() {
-      //取得浏览器的userAgent字符串
-      let userAgent = navigator.userAgent;
+    isChrome () {
+      // 取得浏览器的userAgent字符串
+      let userAgent = navigator.userAgent
 
-      //判断是否Chrome浏览器
-      if (userAgent.indexOf("Chrome") > -1) {
-        return true;
+      // 判断是否Chrome浏览器
+      if (userAgent.indexOf('Chrome') > -1) {
+        return true
       } else {
-        return false;
+        return false
       }
     },
 
-    loginall() {
-      if (this.loginMode == 1) {
-        this.login();
+    loginall () {
+      if (this.loginMode === 1) {
+        this.login()
       } else {
-        this.$refs.user.validate((valid)=> {
-          if(valid){
-            this.loginptr();
-          } 
+        this.$refs.user.validate((valid) => {
+          if (valid) {
+            this.loginptr()
+          }
         })
       }
     },
-    loginptr() {
+    loginptr () {
       let params = {
         username: this.model.username,
         password: this.model.password
-      };
+      }
       api
         .rtxLogin(params, this.$axios)
         .then(res => {
           if (res.data.items === 1) {
-            this.flag = 1;
-            this.login();
+            this.flag = 1
+            this.login()
           } else if (res.data.items === 2) {
-            this.flag = 2;
-            this.login();
-          }else if (res.data.items === 3) {
-            this.$message.warning("您无权限登陆本系统");
-          }else {
-            this.$message.warning("账号或密码错误");
+            this.flag = 2
+            this.login()
+          } else if (res.data.items === 3) {
+            this.$message.warning('您无权限登陆本系统')
+          } else {
+            this.$message.warning('账号或密码错误')
           }
           this.identifyCode = ''
           this.makeCode(this.identifyCodes, 4)
         })
         .catch(err => {
-          this.$message.warning("账号或密码错误");
-          console.error(err);
+          this.$message.warning('账号或密码错误')
+          console.error(err)
           this.identifyCode = ''
           this.makeCode(this.identifyCodes, 4)
-        });
+        })
     }
   }
 })
 export default class Login extends Vue {
-  layout() {
-    return "empty";
+  layout () {
+    return 'empty'
   }
-  login() {
+  login () {
     if (!this.isChrome()) {
       this.$alert(
-        "请用谷歌浏览器、360浏览器(极速模式)等,Chrome内核浏览器打开本系统",
-        "不支持的浏览器",
+        '请用谷歌浏览器、360浏览器(极速模式)等,Chrome内核浏览器打开本系统',
+        '不支持的浏览器',
         {}
-      );
-      return false;
+      )
+      return false
     }
-    this.logging = true;
+    this.logging = true
     this.$refs.user.validate(async valid => {
       try {
         if (valid) {
-          await this.$store.dispatch("auth/login", {
+          await this.$store.dispatch('auth/login', {
             fields: {
-              username: this.model.username.replace(/(^\s*)|(\s*$)/g, ""),
-              password: this.model.password.replace(/(^\s*)|(\s*$)/g, ""),
+              username: this.model.username.replace(/(^\s*)|(\s*$)/g, ''),
+              password: this.model.password.replace(/(^\s*)|(\s*$)/g, ''),
               flag: this.flag
             }
-          });
-          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");
+          })
+          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 || "/");
+            this.$router.push(this.$route.query.page || '/')
           }
         }
       } catch (e) {
-        if(e.response.status==777){
-          this.$message.warning("您无权限登录本系统");
-        }else{
-          this.$message.warning("账号或密码错误");
+        if (e.response.status === 777) {
+          this.$message.warning('您无权限登录本系统')
+        } else {
+          this.$message.warning('账号或密码错误')
         }
         this.identifyCode = ''
         this.makeCode(this.identifyCodes, 4)
       } finally {
-        this.logging = false;
+        this.logging = false
       }
-    });
+    })
   }
-  logout() {
-    this.$store.dispatch("logout");
+  logout () {
+    this.$store.dispatch('logout')
   }
 }
 </script>