lzq %!s(int64=6) %!d(string=hai) anos
pai
achega
cbbbf2011a
Modificáronse 3 ficheiros con 183 adicións e 87 borrados
  1. 128 80
      src/base/Login.vue
  2. 47 7
      src/components/ApplyContent.vue
  3. 8 0
      src/components/Top.vue

+ 128 - 80
src/base/Login.vue

@@ -6,8 +6,8 @@
           <span :class="{active:isPhone}" @click="changeTab(0)">手机登录</span>
           <span :class="{active:isEmail}" @click="changeTab(1)">邮箱登录</span>
         </div>
-        <el-form :rules="rules" >
-        <div class="login-line">
+        <el-form :rules="rules">
+          <div class="login-line">
 
         <span class="area-block" v-show="isPhone">
           <el-select v-model="value" placeholder="请选择" class="area-select">
@@ -19,27 +19,27 @@
             </el-option>
           </el-select>
         </span>
-          <input placeholder="请输入您的手机号码" v-show="isPhone" v-model="logData.mobile" />
-          <span v-show="isEmail">
+            <input placeholder="请输入您的手机号码" v-show="isPhone" v-model="logData.mobile"/>
+            <span v-show="isEmail">
           <i class="iconfont icon-tubiao01"></i>
         </span>
-          <input type="text" placeholder="请输入您的邮箱" v-show="isEmail" v-model="logData.email">
-        </div>
-        <div class="login-line">
+            <input type="text" placeholder="请输入您的邮箱" v-show="isEmail" v-model="logData.email">
+          </div>
+          <div class="login-line">
         <span>
           <i class="iconfont icon-mima"></i>
         </span>
-          <input type="password" placeholder="请输入您的密码" class="input" v-model="logData.password">
-        </div>
-        <div class="tip-line">
-          <span class="cursor" @click="changeBox(2)">忘记密码?</span>
-          <div class="switch-box">
-            <span class="cursor" @click="changeBox(1)">立即注册!</span>
+            <input type="password" placeholder="请输入您的密码" class="input" v-model="logData.password">
+          </div>
+          <div class="tip-line">
+            <span class="cursor" @click="changeBox(2)">忘记密码?</span>
+            <div class="switch-box">
+              <span class="cursor" @click="changeBox(1)">立即注册!</span>
+            </div>
+          </div>
+          <div class="submit-line">
+            <el-button @click="postLoginData()">登录</el-button>
           </div>
-        </div>
-        <div class="submit-line">
-          <el-button @click="postLoginData()">登录</el-button>
-        </div>
         </el-form>
       </div>
       <div class="contain" v-show="state=='register'">
@@ -59,22 +59,22 @@
             </el-option>
           </el-select>
         </span>
-
-          <input v-model="postMsgData.mobile" placeholder="请输入您的手机号码" v-show="isPhone" prop="phone"/>
+          <input v-model="postVaildData.mobile" placeholder="请输入您的手机号码" v-show="isPhone" prop="phone"/>
           <span v-show="isEmail">
           <i class="iconfont icon-tubiao01"></i>
         </span>
-          <input type="text" placeholder="请输入您的邮箱" v-show="isEmail" prop="email">
+          <input type="text" v-model="postVaildData.email" placeholder="请输入您的邮箱" v-show="isEmail" prop="email">
         </div>
         <div class="yanz-line">
-          <input type="text" placeholder="请输入验证码" class="input">
-          <button @click="postMsg()">发送验证码</button>
+          <input type="text" placeholder="请输入验证码" class="input" v-model="regData.code">
+          <button @click="postValidMsg()" v-show="!timer" v-text="getCodeNum?'重新发送':'发送验证码'"></button>
+          <button v-show="timer" disabled class="counting">已发送{{count}}</button>
         </div>
         <div class="login-line">
         <span>
           <i class="iconfont icon-mima"></i>
         </span>
-          <input type="password" placeholder="请输入您的密码" class="input">
+          <input type="password" placeholder="请输入您的密码" class="input" v-model="regData.password">
         </div>
         <div class="tip-line">
           <input type="checkbox" id="tips" class="input" v-model="alRead">
@@ -84,7 +84,7 @@
           </div>
         </div>
         <div class="submit-line">
-          <el-button>注册</el-button>
+          <el-button @click="postRegData()">注册</el-button>
         </div>
       </div>
       <div class="contain" v-show="state=='find'">
@@ -93,7 +93,7 @@
           <span :class="{active:isEmail}" @click="changeTab(1)">邮箱找回</span>
         </div>
         <div class="login-line">
-          <span  v-show="isEmail">
+          <span v-show="isEmail">
           <i class="iconfont icon-tubiao01"></i>
         </span>
           <input type="text" placeholder="请输入您的邮箱" v-show="isEmail" prop="email">
@@ -107,7 +107,7 @@
             </el-option>
           </el-select>
         </span>
-          <input placeholder="请输入您的手机号码" v-show="isPhone" v-model="logData.mobile" />
+          <input placeholder="请输入您的手机号码" v-show="isPhone" v-model="logData.mobile"/>
 
         </div>
         <div class="yanz-line" v-show="isPhone">
@@ -120,7 +120,7 @@
         </span>
           <input type="password" placeholder="请输入您的密码" class="input" v-model="logData.password">
         </div>
-        <div class="login-line"  v-show="isPhone">
+        <div class="login-line" v-show="isPhone">
         <span>
           <i class="iconfont icon-mima"></i>
         </span>
@@ -223,7 +223,7 @@ export default {
   name: 'login',
   data () {
     return {
-      usr:{
+      usr: {
         username: ''
       },
       isPhone: true,
@@ -274,27 +274,35 @@ export default {
         password: '',
         redirect_uri: 'http:33.cn'
       },
-      postMsgData: {
+      postVaildData: {
         platkey: 'zhaobi',
         codetype: 'validate',
         area: 86,
         mobile: '',
         param: 'FzmRandom',
-        type: 'sms',
-        extend_param: '',
-        ticket: '',
-        businessId: ''
+        type: ''
+      },
+      regData: {
+        mobile: '',
+        email: '',
+        area: '',
+        password: '',
+        code: '',
+        type: ''
       },
       dialogVisible: false,
       alRead: false,
       rules: {
         phone: [
-          { required: true, message: '请输入手机号', trigger: 'blur' },
+          {required: true, message: '请输入手机号', trigger: 'blur'}
         ],
         region: [
-          { required: true, message: '请选择活动区域', trigger: 'change' }
+          {required: true, message: '请选择活动区域', trigger: 'change'}
         ]
-      }
+      },
+      timer: null,
+      count: '',
+      getCodeNum: false
     }
   },
   methods: {
@@ -320,61 +328,94 @@ export default {
         this.state = 'find'
       }
     },
-
     postLoginData: function () {
-      if(this.isPhone){
+      if (this.isPhone) {
         this.logData.type = 'sms'
-        this.axios.post('https://dev407.33.cn/api/broker/login', qs.stringify(this.logData)).then((res) => {
-          if(res.data.error == 'OK'){
-            localStorage.setItem('userInfo',JSON.stringify(res.data.data))
-            this.usr.username = res.data.data.username
-            this.$store.dispatch('login')
-            console.log(this.$store.state.loginedUser.username)
-          }else{
-            this.notify(res.data.message,'warning')
-          }
-        })
-      }else if(this.isEmail){
+      } else if (this.isEmail) {
         this.logData.type = 'email'
-        this.axios.post('https://dev407.33.cn/api/broker/login', qs.stringify(this.logData)).then((res) => {
-          if(res.data.error == 'OK'){
-            localStorage.setItem('userInfo',JSON.stringify(res.data.data))
-            this.usr.username = res.data.data.username
-            this.$store.dispatch('login')
-            console.log(this.$store.state.loginedUser.username)
-          }else{
-            this.notify(res.data.message,'warning')
-          }
-        })
       }
-
+      this.axios.post('https://dev407.33.cn/api/broker/login', qs.stringify(this.logData)).then((res) => {
+        if (res.data.error == 'OK') {
+          localStorage.setItem('userInfo', JSON.stringify(res.data.data))
+          this.usr.username = res.data.data.username
+          this.$store.dispatch('login')
+          console.log(this.$store.state.loginedUser.username)
+        } else {
+          this.notify(res.data.message, 'warning')
+        }
+      })
     },
-    notify(mes,type) {
+    notify (mes, type) {
       this.$notify({
         title: '提示',
         message: mes,
         type: type
       })
     },
-    postMsg : function () {
-      this.axios.post('https://dev407.33.cn/api/send/newsms', qs.stringify(this.postMsgData)).then((response) => {
-        console.log(response.data)
+    postValidMsg: function () {
+      if (this.isPhone) {
+        this.postVaildData.type = 'sms'
+      } else {
+        this.postVaildData.type = 'email'
+      }
+      this.axios.post('https://dev407.33.cn/api/send/newsms', qs.stringify(this.postVaildData)).then((res) => {
+        console.log(typeof (res.data.code))
+        console.log(res.data.code)
+        console.log(res.data)
+        if (res.data.code === 200) {
+          this.notify('发送成功', 'success')
+          this.getCode()
+        } else {
+          this.notify(res.data.message, 'warning')
+        }
       })
     },
+    getCode () {
+      this.count = 60
+      this.timer = setInterval(() => {
+        if (this.count > 1 && this.count <= 60) {
+          this.count--
+        } else {
+          clearInterval(this.timer)
+          this.timer = null
+          this.getCodeNum = true
+        }
+      }, 1000)
+    },
     read: function () {
       this.dialogVisible = false
       this.alRead = true
+    },
+    postRegData () {
+      if (this.isPhone) {
+        this.regData.type = 'sms'
+        this.regData.mobile = this.postVaildData.mobile
+      } else if (this.isEmail) {
+        this.regData.type = 'email'
+        this.regData.email = this.postVaildData.email
+      }
+      if (this.alRead) {
+        this.axios.post('https://dev407.33.cn/api/broker/register', qs.stringify(this.logData)).then((res) => {
+          if (res.data.error == 'OK') {
+            // localStorage.setItem('userInfo', JSON.stringify(res.data.data))
+            // this.usr.username = res.data.data.username
+            // this.$store.dispatch('login')
+            // console.log(this.$store.state.loginedUser.username)
+          } else {
+            this.notify(res.data.message, 'warning')
+          }
+        })
+      } else {
+        this.notify('请阅读风险提示', 'warning')
+      }
     }
   },
-  computed:{
-    logined(){
+  computed: {
+    logined () {
       return this.$store.state.logined
     }
   },
   mounted () {
-    // this.axios.get('https://dev407.33.cn/api/data/country').then((response) => {
-    //   console.log(response.data)
-    // })
 
   }
 }
@@ -557,6 +598,10 @@ export default {
     cursor: pointer;
   }
 
+  .counting {
+    background-color: #eee;
+  }
+
   }
   .risk {
     text-align: center;
@@ -604,20 +649,23 @@ export default {
 
   }
   }
-  .usr-msg{
+  .usr-msg {
     font-size: 25px;
     color: #1a6fa6;
   }
-  .whole-line{
+
+  .whole-line {
     margin-top: 50px;
-    button{
-      width: 100%;
-      height: 50px;
-      line-height: 50px;
-      border: 1px solid #d2d2d2;
-      background-color: transparent;
-      margin-bottom: 20px;
-      font-size: 18px;
-    }
+
+  button {
+    width: 100%;
+    height: 50px;
+    line-height: 50px;
+    border: 1px solid #d2d2d2;
+    background-color: transparent;
+    margin-bottom: 20px;
+    font-size: 18px;
+  }
+
   }
 </style>

+ 47 - 7
src/components/ApplyContent.vue

@@ -5,18 +5,42 @@
     </div>
     <Steps></Steps>
     <ApplyForm></ApplyForm>
-
+    <div class="dialog">
+    <el-dialog
+      :visible.sync="dialogVisible"
+      width="50%">
+      <p>登录后才可申请经纪商!</p>
+      <button @click="goIndex()">立即登录</button>
+    </el-dialog>
+  </div>
   </div>
 </template>
 
 <script>
-  import Steps from '../components/Steps'
-  import ApplyForm from '../components/ApplyForm'
+import Steps from '../components/Steps'
+import ApplyForm from '../components/ApplyForm'
 
-  export default {
-    name: 'ApplyContent',
-    components: {Steps,ApplyForm}
+export default {
+  name: 'ApplyContent',
+  data () {
+    return {
+      dialogVisible: ''
+    }
+  },
+  components: {Steps, ApplyForm},
+  methods: {
+    goIndex () {
+      this.$router.push('/')
+    }
+  },
+  mounted () {
+    if (this.$store.state.logined) {
+      this.dialogVisible = false
+    } else {
+      this.dialogVisible = true
+    }
   }
+}
 </script>
 
 <style scoped>
@@ -34,6 +58,22 @@
     left: 50%;
     transform: translateX(-50%);
   }
-
+  }
+  .dialog{
+    p{
+      font-size: 24px;
+      color: #1a6fa6;
+    }
+    button{
+      border: 1px solid #e5e5e5;
+      color: #1a6fa6;
+      height: 35px;
+      width: 120px;
+      border-radius: 25px;
+      margin-top: 30px;
+      margin-bottom: 40px;
+      font-size: 16px;
+      font-weight: 700;
+    }
   }
 </style>

+ 8 - 0
src/components/Top.vue

@@ -83,6 +83,14 @@ export default {
     exit: function () {
       this.$store.dispatch('logout')
       localStorage.removeItem('userInfo')
+      this.notify('退出成功','success')
+    },
+    notify(mes,type) {
+      this.$notify({
+        title: '提示',
+        message: mes,
+        type: type
+      })
     }
   },
   mounted () {