lzq 6 gadi atpakaļ
vecāks
revīzija
b1c3571e74
3 mainītis faili ar 77 papildinājumiem un 138 dzēšanām
  1. 18 95
      src/App.vue
  2. 33 15
      src/base/Login.vue
  3. 26 28
      src/components/Top.vue

+ 18 - 95
src/App.vue

@@ -1,98 +1,21 @@
 <template>
-	<div class="top">
-		<div class="wrap">
-			<div class="logo">
-				<img src="../../static/images/mainLogo.png" alt="" class="fl">
-				<!--<img src="" alt="">-->
-			</div>
-			<ul class="nav fl">
-				<li class="active">
-					<span>首页</span></li>
-					<li class="">
-						<span>申请经纪商</span>
-						<i class="hot">HOT</i>
-					</li>
-				</ul>
-			</div>
+  <div id="app">
+    <router-view/>
+  </div>
+</template>
 
-		</div>
+<script>
+  export default {
+    name: 'App'
+  }
+</script>
 
-	</template>
-
-	<script>
-	export default {
-		name: "Top",
-		data(){
-			return{
-
-			}
-		}
-	}
-	</script>
-
-	<style scoped>
-	.top{
-		height: 75px;
-		width: 100%;
-		position: absolute;
-		top: 0;
-		left: 0;
-		background-color: rgba(0, 0, 0, 0.2);
-		z-index: 100;
-	}
-	.logo{
-		float: left;
-		width: 98px;
-		line-height: 75px;
-		height: 75px;
-		margin-right: 55px;
-		display: flex;
-		align-items: center;
-	}
-	.logo>img{
-		width: 100%;
-	}
-	.nav li{
-		float:left;
-		width: 118px;
-		line-height: 75px;
-		font-size: 14px;
-		color:#fff;
-		position: relative;
-	}
-	.nav li:hover{
-		cursor: pointer;
-	}
-	.nav .active{
-		background-color: #fff;
-		color: #1a6fa6;;
-	}
-	.hot{
-		position: absolute;
-		background-color: #ff4e00;
-		color: #fff;
-		display: block;
-		width: 38px;
-		height: 18px;
-		line-height: 18px;
-		font-size: 12px;
-		border-radius: 2px;
-		top: 8px;
-		right: 0;
-	}
-	.hot:after{
-		content: "";
-		width: 0;
-		height: 0;
-		position: absolute;
-		z-index: -1;
-		bottom: 0;
-		left: 30%;
-		border-left: 5px solid transparent;
-		border-right: 5px solid transparent;
-		border-top: 14px solid #ff4e00;
-		margin-bottom: -8px;
-		transform: rotate(30deg);
-	}
-
-	</style>
+<style>
+  #app {
+    font-family: 'Avenir', Helvetica, Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    text-align: center;
+    color: #2c3e50;
+  }
+</style>

+ 33 - 15
src/base/Login.vue

@@ -38,7 +38,7 @@
           </div>
         </div>
         <div class="submit-line">
-          <el-button @click="check()">登录</el-button>
+          <el-button @click="postLoginData()">登录</el-button>
         </div>
         </el-form>
       </div>
@@ -213,7 +213,7 @@ export default {
       value: '0',
       input: '',
       logData: {
-        type: 'sms',
+        type: '',
         area: 86,
         mobile: '',
         email: '',
@@ -269,25 +269,43 @@ export default {
         this.state = 'find'
       }
     },
-    check:function(){
-      let pNum = this.logData.mobile
-      if(pNum==''){
-        alert('请输入您的手机号')
-      }else if(pNum ){
 
+    postLoginData: function () {
+      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){
+        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')
+          }
+        })
       }
 
     },
-    postLoginData: function () {
-      this.axios.post('https://dev407.33.cn/api/broker/login', qs.stringify(this.logData)).then((res) => {
-        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)
-
+    notify(mes,type) {
+      this.$notify({
+        title: '提示',
+        message: mes,
+        type: type
       })
     },
-    postMsg: function () {
+    postMsg : function () {
       this.axios.post('https://dev407.33.cn/api/send/newsms', qs.stringify(this.postMsgData)).then((response) => {
         console.log(response.data)
       })

+ 26 - 28
src/components/Top.vue

@@ -30,38 +30,37 @@ export default {
       topchange: 'topone',
       src1: '../../static/images/mainLogo.png',
       src2: '../../static/images/logo2.png',
-      index:true,
-      apply:false
+      index: true,
+      apply: false
     }
   },
-  computed:{
-    logined(){
-     return this.$store.state.logined
+  computed: {
+    logined () {
+      return this.$store.state.logined
     },
-    username(){
+    username () {
       return this.$store.state.loginedUser.username
     }
 
   },
   methods: {
     goApply: function (route) {
-      this.$router.push('/' + route);
-      if(route == 'apply'){
-        this.apply = true;
-        this.index = false;
+      this.$router.push('/' + route)
+      if (route == 'apply') {
+        this.apply = true
+        this.index = false
         this.topchange = 'toptwo'
-        this.scrolled = true;
-      }
-      else{
-        this.apply = false;
-        this.index = true;
+        this.scrolled = true
+      } else {
+        this.apply = false
+        this.index = true
       }
     },
     handleScroll () {
-      if(this.$route.path == '/apply'){
+      if (this.$route.path == '/apply') {
         this.topchange = 'toptwo'
         this.scrolled = true
-      }else{
+      } else {
         if (window.scrollY > 0) {
           this.topchange = 'toptwo'
           this.scrolled = true
@@ -71,22 +70,21 @@ export default {
         }
       }
     },
-    exit:function(){
+    exit: function () {
       this.$store.dispatch('logout')
-      localStorage.removeItem('userInfo');
-}
+      localStorage.removeItem('userInfo')
+    }
   },
   mounted () {
-    window.addEventListener('scroll', this.handleScroll);
-    if(this.$route.path == '/apply'){
-      this.apply = true;
-      this.index = false;
+    window.addEventListener('scroll', this.handleScroll)
+    if (this.$route.path == '/apply') {
+      this.apply = true
+      this.index = false
       this.topchange = 'toptwo'
       this.scrolled = true
-    }
-    else{
-      this.apply = false;
-      this.index = true;
+    } else {
+      this.apply = false
+      this.index = true
     }
   }
 }