From a4945c89ee72aa8b6f2c0a75653a3256a2b30b4f Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 16 五月 2024 19:02:57 +0800
Subject: [PATCH] 提交一把

---
 company/src/views/login.vue |  365 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 211 insertions(+), 154 deletions(-)

diff --git a/company/src/views/login.vue b/company/src/views/login.vue
index 3293821..9faf637 100644
--- a/company/src/views/login.vue
+++ b/company/src/views/login.vue
@@ -28,169 +28,216 @@
                     </div>
                 </template>
             </div>
-            <el-button :loading="loading" @click="login">鐧�&nbsp;&nbsp;褰�</el-button>
+          <div style="text-align: left;margin-bottom: 15px;font-size: 14px">
+            <el-checkbox :true-label="1" :false-label="0"   v-model="readed"/>
+              鎴戝凡闃呰鍜屽悓鎰忋��<span @click="agreeType=0;title1='鏈嶅姟鍗忚';visible1=true" style="color: dodgerblue;cursor: pointer">鏈嶅姟鍗忚</span>銆嬪拰
+            銆�<span  @click="agreeType=1;title1='闅愮鍗忚';visible1=true" style="color: dodgerblue;cursor: pointer">闅愮鍗忚</span>銆�
+          </div>
+          <el-button :loading="loading" @click="login">鐧�&nbsp;&nbsp;褰�</el-button>
         </div>
+        <el-dialog
+            class="center-title"
+            :title="title1"
+            width="70%"
+            height="70%"
+            text="鐢ㄦ埛鍗忚"
+            :visible.sync="visible1"
+        >
+          <div class="agree-list" v-if="agreeType==0" v-html="agreement0">
+          </div>
+          <div class="agree-list"  v-else v-html="agreement1">
+          </div>
+          <template  v-slot:footer>
+            <el-button type="primary"   @click="readed=1;visible1=false">鍚屾剰</el-button>
+            <el-button @click="visible1=false">杩斿洖</el-button>
+          </template>
+        </el-dialog>
     </div>
+
 </template>
-
 <script>
-    import { mapMutations } from 'vuex'
-    import { getCaptcha, loginByPassword, loginByPhone } from '@/api/system/common'
-    import { sendSms } from '@/api/business/smsEmail'
+import { mapMutations } from 'vuex'
+import { getCaptcha, loginByPassword, loginByPhone } from '@/api/system/common'
+import { sendSms } from '@/api/business/smsEmail'
+import { getAgreement } from '@/api/system/dict'
 
-    export default {
-        name: 'Login',
-        data () {
-            return {
-                systemTitle: process.env.VUE_APP_SYSTEM_TITLE,
-                loading: false,
-                username: '',
-                password: '',
-                phone: '',
-                code: '',
-                active: 1,
-                num: 0,
-                timer: null,
-                // 楠岃瘉鐮�
-                captcha: {
-                    loading: false,
-                    value: '',
-                    uuid: '',
-                    uri: ''
-                }
-            }
-        },
-        methods: {
-            ...mapMutations(['setUserInfo']),
-            handleClick(e) {
-                this.active = e
-                this.username = ''
-                this.password = ''
-                this.phone = ''
-                this.code = ''
-            },
-            send() {
-                if (!this.phone) {
-                    this.$message.warning('璇峰厛杈撳叆鎵嬫満鍙�')
-                    return
-                }
-                var reg = /^1[3456789]\d{9}$/;
-                if (!reg.test(this.phone)) {
-                    this.$message.warning('鎵嬫満鍙蜂笉鍚堟硶')
-                    return
-                }
-                sendSms({
-                    phone: this.phone
-                }).then(res => {
-                    this.num = 60
-                    this.setTimer()
-                })
-            },
-            setTimer () {
-                this.timer = setInterval(() => {
-                    if (this.num === 0) {
-                        this.num = 0
-                        clearInterval(this.timer)
-                        this.timer = null
-                        return
-                    }
-                    this.num -= 1
-                }, 1000)
-            },
-            // 鐧诲綍
-            login () {
-                if (this.loading) {
-                    return
-                }
-                if (this.active === 1) {
-                    if (!this.__check()) {
-                        return
-                    }
-                    this.loading = true
-                    loginByPassword({
-                        username: this.username.trim(),
-                        password: this.password,
-                        code: this.captcha.value.trim(),
-                        uuid: this.captcha.uuid
-                    })
-                        .then(() => {
-                            window.location.href = process.env.VUE_APP_CONTEXT_PATH
-                        })
-                        .catch(e => {
-                            this.refreshCaptcha()
-                            this.$tip.apiFailed(e)
-                        })
-                        .finally(() => {
-                            this.loading = false
-                        })
-                } else {
-                    if (!this.phone) {
-                        this.$tip.error('璇疯緭鍏ユ墜鏈哄彿')
-                        return
-                    }
-                    if (!this.code) {
-                        this.$tip.error('璇疯緭鍏ラ獙璇佺爜')
-                        return
-                    }
-                    this.loading = true
-                    loginByPhone({
-                        phone: this.phone,
-                        code: this.code.trim()
-                    })
-                        .then(() => {
-                            window.location.href = process.env.VUE_APP_CONTEXT_PATH
-                        })
-                        .catch(e => {
-                            this.$tip.apiFailed(e)
-                        })
-                        .finally(() => {
-                            this.loading = false
-                        })
-                }
-            },
-            // 鍒锋柊楠岃瘉鐮�
-            refreshCaptcha () {
-                this.captcha.loading = true
-                getCaptcha()
-                    .then(data => {
-                        this.captcha.uri = data.image
-                        this.captcha.uuid = data.uuid
-                    })
-                    .catch(e => {
-                        this.$tip.apiFailed(e)
-                    })
-                    .finally(() => {
-                        setTimeout(() => {
-                            this.captcha.loading = false
-                        }, 150)
-                    })
-            },
-            // 鐧诲綍鍓嶉獙璇�
-            __check () {
-                if (this.username.trim() === '') {
-                    this.$tip.error('璇疯緭鍏ョ敤鎴峰悕')
-                    return false
-                }
-                if (this.password === '') {
-                    this.$tip.error('璇疯緭鍏ュ瘑鐮�')
-                    return false
-                }
-                if (this.captcha.value.trim() === '') {
-                    this.$tip.error('璇疯緭鍏ュ浘鐗囬獙璇佺爜')
-                    return false
-                }
-                return true
-            }
-        },
-        created () {
-            this.refreshCaptcha()
-            document.title=this.systemTitle
-        }
+export default {
+  name: 'Login',
+  data () {
+    return {
+      title1:'鏈嶅姟鍗忚',
+      systemTitle: process.env.VUE_APP_SYSTEM_TITLE,
+      loading: false,
+      username: '',
+      password: '',
+      phone: '',
+      visible1:false,
+      code: '',
+      readed: 0,
+      agreeType:'',
+      active: 1,
+      num: 0,
+      timer: null,
+      agreement0: '杩欐槸鏈嶅姟鍗忚',
+      agreement1: '杩欐槸闅愮鍗忚',
+      // 楠岃瘉鐮�
+      captcha: {
+        loading: false,
+        value: '',
+        uuid: '',
+        uri: ''
+      }
     }
+  },
+  methods: {
+    ...mapMutations(['setUserInfo']),
+    handleClick (e) {
+      this.active = e
+      this.username = ''
+      this.password = ''
+      this.phone = ''
+      this.code = ''
+    },
+    getAgree () {
+      getAgreement({}).then(res => {
+        if (res && res.length >= 2) {
+          this.agreement0 = res[0]
+          this.agreement1 = res[1]
+        }
+      })
+    },
+    send () {
+      if (!this.phone) {
+        this.$message.warning('璇峰厛杈撳叆鎵嬫満鍙�')
+        return
+      }
+      var reg = /^1[3456789]\d{9}$/
+      if (!reg.test(this.phone)) {
+        this.$message.warning('鎵嬫満鍙蜂笉鍚堟硶')
+        return
+      }
+      sendSms({
+        phone: this.phone
+      }).then(res => {
+        this.num = 60
+        this.setTimer()
+      })
+    },
+    setTimer () {
+      this.timer = setInterval(() => {
+        if (this.num === 0) {
+          this.num = 0
+          clearInterval(this.timer)
+          this.timer = null
+          return
+        }
+        this.num -= 1
+      }, 1000)
+    },
+    // 鐧诲綍
+    login () {
+      if (this.loading) {
+        return
+      }
+      if (this.readed != 1) {
+        this.$message.error('璇峰厛闃呰鍜屽悓鎰忋�婃湇鍔″崗璁�嬪拰銆婇殣绉佸崗璁��')
+        return
+      }
+      if (this.active === 1) {
+        if (!this.__check()) {
+          return
+        }
+        this.loading = true
+        loginByPassword({
+          username: this.username.trim(),
+          password: this.password,
+          code: this.captcha.value.trim(),
+          uuid: this.captcha.uuid
+        })
+          .then(() => {
+            window.location.href = process.env.VUE_APP_CONTEXT_PATH
+          })
+          .catch(e => {
+            this.refreshCaptcha()
+            this.$tip.apiFailed(e)
+          })
+          .finally(() => {
+            this.loading = false
+          })
+      } else {
+        if (!this.phone) {
+          this.$tip.error('璇疯緭鍏ユ墜鏈哄彿')
+          return
+        }
+        if (!this.code) {
+          this.$tip.error('璇疯緭鍏ラ獙璇佺爜')
+          return
+        }
+        this.loading = true
+        loginByPhone({
+          phone: this.phone,
+          code: this.code.trim()
+        })
+          .then(() => {
+            window.location.href = process.env.VUE_APP_CONTEXT_PATH
+          })
+          .catch(e => {
+            this.$tip.apiFailed(e)
+          })
+          .finally(() => {
+            this.loading = false
+          })
+      }
+    },
+    // 鍒锋柊楠岃瘉鐮�
+    refreshCaptcha () {
+      this.captcha.loading = true
+      getCaptcha()
+        .then(data => {
+          this.captcha.uri = data.image
+          this.captcha.uuid = data.uuid
+        })
+        .catch(e => {
+          this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          setTimeout(() => {
+            this.captcha.loading = false
+          }, 150)
+        })
+    },
+    // 鐧诲綍鍓嶉獙璇�
+    __check () {
+      if (this.username.trim() === '') {
+        this.$tip.error('璇疯緭鍏ョ敤鎴峰悕')
+        return false
+      }
+      if (this.password === '') {
+        this.$tip.error('璇疯緭鍏ュ瘑鐮�')
+        return false
+      }
+      if (this.captcha.value.trim() === '') {
+        this.$tip.error('璇疯緭鍏ュ浘鐗囬獙璇佺爜')
+        return false
+      }
+      return true
+    }
+  },
+  created () {
+    this.refreshCaptcha()
+    this.getAgree()
+    document.title = this.systemTitle
+  }
+}
 </script>
 
 <style scoped lang="scss">
     @import "@/assets/style/variables.scss";
+    .agree-list{
+      height: 550px;
+      //max-height: 50%;
+      overflow: auto;
+    }
     $input-gap: 30px;
     .wrap {
         display: flex;
@@ -265,7 +312,7 @@
                 }
             }
             .info-input {
-                margin-bottom: 60px;
+                margin-bottom: 15px;
                 /deep/ .el-input {
                     margin-top: 30px;
                     &:first-child {
@@ -313,4 +360,14 @@
             }
         }
     }
+   ::v-deep .center-title .el-dialog__title {
+      text-align: center;
+      width: 100%;
+      font-size: 18px;
+      font-weight: bold;
+
+    }
+    ::v-deep  .el-dialog__header{
+      text-align: center;
+    }
 </style>

--
Gitblit v1.9.3