zpj пре 2 година
родитељ
комит
94dd78d14e
5 измењених фајлова са 62 додато и 20 уклоњено
  1. 14 3
      components/en-utils/en-nav/en-nav.vue
  2. 1 1
      pages.json
  3. 17 3
      pages/index/index.vue
  4. 17 0
      pages/me/index.vue
  5. 13 13
      service/router.js

+ 14 - 3
components/en-utils/en-nav/en-nav.vue

@@ -9,7 +9,12 @@
           </text>
         </view>
 
-        <view class="title-text" :style="[{'marginLeft':left +'px'}]">{{title}}</view>
+        <view v-if="!customNav" class="title-text" :style="[{'marginLeft':left +'px'}]">{{title}}</view>
+		
+		<view v-else class="">
+			<slot name="custom"></slot>
+		</view>
+		
         <view  class="right-button button" @click="rightClick">
           <slot name="right" v-if="rightShow">
             <text class="rightName" v-if="rightType===1">{{rightText}}</text>
@@ -18,10 +23,11 @@
         </view>
       </view>
     </view>
-    <view class="box-title">
+	
+    <!-- <view class="box-title">
       <view class="" :style="[{'height': customBarH + 'px', 'padding-top': statusBarH + 'px'}]">
       </view>
-    </view>
+    </view> -->
   </view>
 
 
@@ -45,6 +51,11 @@
         type: String,
         default: ''
       },
+	  customNav:{
+		  type: Boolean,
+		  default: false
+	  },
+	  
       leftShow: {
         type: Boolean,
         default: true

+ 1 - 1
pages.json

@@ -3,7 +3,7 @@
     {
       "path": "pages/index/index",
       "style": {
-        "navigationBarTitleText": "首页演示"
+        "navigationBarTitleText": "首页"
       }
     },
     {

+ 17 - 3
pages/index/index.vue

@@ -1,6 +1,14 @@
 <template>
-	<view class="box-data">
-		首页
+	<view class="index-box">
+		<Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
+			<template>
+				<view slot="custom">11</view>
+			</template>
+		</Nav>
+		
+		<view class="bg-img">
+			
+		</view>
 	</view>
 
 </template>
@@ -29,6 +37,12 @@
 	}
 </script>
 <style lang="scss" scoped>
-
+	.index-box{
+		.bg-img{
+			width: 100%;
+			height: 300rpx;
+			background-color: skyblue;
+		}
+	}
 
 </style>

+ 17 - 0
pages/me/index.vue

@@ -0,0 +1,17 @@
+<template>
+	<view class="me-index-box">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		
+	}
+</script>
+
+<style scoped lang="scss">
+	.me-index-box{
+		
+	}
+</style>

+ 13 - 13
service/router.js

@@ -18,21 +18,21 @@ const router = createRouter({
 const whiteList = ['/pages/login/index']
 
 router.beforeEach((to, from, next) => {
-    let userToken=''
-    if (to.query.token ) {
-        userToken = to.query.token;
-        uni.setStorageSync('token',userToken)
-    }else {
-        userToken = uni.getStorageSync('token')
-    }
+    // let userToken=''
+    // if (to.query.token ) {
+    //     userToken = to.query.token;
+    //     uni.setStorageSync('token',userToken)
+    // }else {
+    //     userToken = uni.getStorageSync('token')
+    // }
     
 
-    if(whiteList.indexOf(to.path)<0 && !userToken){
-        next('/pages/login/index')
-    }else {
-        next();
-    }
-
+    // if(whiteList.indexOf(to.path)<0 && !userToken){
+    //     next('/pages/login/index')
+    // }else {
+    //     next();
+    // }
+	next()
 });
 // 全局路由后置守卫
 router.afterEach((to, from) => {