Browse Source

开发朗读赛拦截年级选择

bayi 2 years atrás
parent
commit
81c9d22f58

+ 2 - 1
app.js

@@ -14,7 +14,6 @@ App({
   onLaunch() {
     this.checkIsIos()
     this.getNavbarInfo()
-
   },
   async onShow(options) {
     if (!this.storeBindings) {
@@ -45,6 +44,8 @@ App({
             shareUid
           }
           let userRes = await userLogin(data)
+          console.log(userRes.data.grade);
+
           this.setUser(userRes.data)
           wx.setStorageSync('uid', userRes.data.uid)
           wx.setStorageSync('user', userRes.data)

+ 4 - 0
components/navigationBar/index.js

@@ -25,6 +25,10 @@ Component({
     title: {
       type: String,
       value: '朗读小咖秀',
+    },
+    showNav: {
+      type: Boolean,
+      value: true
     }
   },
   data: {

+ 12 - 10
components/navigationBar/index.wxml

@@ -1,19 +1,21 @@
 <!-- 自定义顶部栏 -->
-<view class="nav-bar" style="height:{{navBarHeight}}px;">
-  <view class="view" style="height:{{menuHeight}}px;top:{{menuTop}}px;">
-    <view class="selectGrade" bindtap="showGrade">{{userInfo.gradeName}}</view>
-    <view class="title">{{title}}</view>
+<block wx:if="{{showNav}}">
+  <view class="nav-bar" style="height:{{navBarHeight}}px;">
+    <view class="view" style="height:{{menuHeight}}px;top:{{menuTop}}px;">
+      <view class="selectGrade" bindtap="showGrade">{{userInfo.gradeName}}</view>
+      <view class="title">{{title}}</view>
+    </view>
   </view>
-</view>
-<!-- 
+  <!-- 
   内容区域:
   自定义顶部栏用的fixed定位,会遮盖到下面内容,注意设置好间距
 -->
-<view class="content" style="margin-top:{{navBarHeight}}px;"></view>
-<view class="headerBg" style="top:{{navBarHeight}}px;"></view>
+  <view class="content" style="margin-top:{{navBarHeight}}px;"></view>
+  <view class="headerBg" style="top:{{navBarHeight}}px;"></view>
+</block>
 
-<view wx:if="{{isGradeShow}}" class="gradeContainer" catchtouchmove='true' style="margin-top:{{navBarHeight}}px;"
-  bindtap="closeGrade">
+<view wx:if="{{isGradeShow}}" class="gradeContainer" catchtouchmove='true'
+  style="margin-top:{{showNav?navBarHeight:0}}px;" bindtap="closeGrade">
   <view class="gradeBox" catchtap="selectGrade">
     <view class="title">请选择年级</view>
     <view class="content">

+ 5 - 2
pages/match/index.js

@@ -27,7 +27,6 @@ Page({
     myActivityUser: {},
     explain: ''
   },
-
   /**
    * 生命周期函数--监听页面加载
    */
@@ -44,13 +43,17 @@ Page({
     })
     // 立刻更新
     this.storeBindings.updateStoreBindings()
+    this.reload()
+  },
+  reload(){
     this.getModelTexts()
     this.getReadRanking()
   },
   // 获取范文
   async getModelTexts() {
+    console.log(this.data.userInfo.grade);
     let bannerList = await getModelTexts({
-      grade: this.data.userInfo.grade || 'PRIMARY_FIRST_GRADE'
+      grade: this.data.userInfo.grade
     })
     this.setData({
       bannerList

+ 2 - 1
pages/match/index.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
-    "worksList": "/components/worksList/index"
+    "worksList": "/components/worksList/index",
+    "navigationBar": "/components/navigationBar/index"
   },
   "navigationBarTitleText": "朗读比赛"
 }

+ 1 - 0
pages/match/index.wxml

@@ -1,4 +1,5 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
+<navigationBar bind:reload='reload' showNav="{{false}}"></navigationBar>
 <view class="matchBox">
   <image src="http://reader-wx.ai160.com/images/reader/v3/enter_banner.jpg" class="headerImg" />
   <view class="rule" bindtap="jumpIntro">

+ 0 - 1
pages/reading/index.wxml

@@ -93,7 +93,6 @@
       </view>
     </view>
   </view>
-
   <view class="controller">
     <image wx:if="{{state}}" src="/static/readingNow.gif" class="readingNow" bindtap="setCountDown" />
     <!-- <image wx:else src="/static/work.png" class="playImg" bindtap="eeeeee" /> -->

+ 1 - 1
utils/request.js

@@ -34,7 +34,7 @@ function request(url, method, data, oldBaseUrl = false) {
         } = result
         if (code == '200') {
           reslove(data)
-        } else if (code == '1102' || code == '1204' || code == '503') {
+        } else if (code == '1102' || code == '1204' || code == '506') {
           console.log(code, '<=====code', message);
           wx.clearStorage()
         } else {