Rorschach 4 years ago
parent
commit
e5b7bf6b80

+ 7 - 1
app.json

@@ -24,7 +24,13 @@
     "pages/vipPage/wechat/wechat"
   ],
   "window": {
-    "navigationStyle": "custom"
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#12C962",
+    "navigationBarTitleText": "小学语文朗读配音",
+    "navigationBarTextStyle": "white",
+    "backgroundColor": "#12C962",
+    "onReachBottomDistance": 50,
+    "enablePullDownRefresh": true
   },
   "debug": false,
   "sitemapLocation": "sitemap.json"

+ 1 - 1
component/statusBar/statusBar.wxss

@@ -4,7 +4,7 @@
     width: 100%;
     top: 0;
     left: 0;
-    height: 45px;
+    height: 90rpx;
     background: #12C962;
     z-index: 999;
     display: flex;

+ 1 - 1
component/video-swiper/index.js

@@ -38,7 +38,7 @@ Component({
         nextQueue: [],
         prevQueue: [],
         curQueue: [],
-        circular: true,
+        circular: false,
         // nextMargin: '400rpx',
         _last: 1,
         _change: -1,

+ 3 - 19
component/video-swiper/index.less

@@ -43,29 +43,13 @@
                             font-size: 30rpx;
                             color: rgba(0, 0, 0, 0.60);
                         }
-
-                        .time {
-                            font-size: 26rpx;
-                            color: rgba(0, 0, 0, 0.60);
-                        }
                     }
 
                 }
 
-                .more_btn {
-                    width: 50rpx;
-                    height: 100%;
-                    margin-right: 20rpx;
-                    display: flex;
-                    align-items: center;
-                    justify-content: space-around;
-
-                    .more_item {
-                        width: 5rpx;
-                        height: 5rpx;
-                        background: rgba(0, 0, 0, 0.60);
-                        border-radius: 50%;
-                    }
+                .time {
+                    font-size: 26rpx;
+                    color: rgba(0, 0, 0, 0.60);
                 }
             }
 

+ 3 - 10
component/video-swiper/index.wxml

@@ -16,19 +16,12 @@
           <image class="avatar" lazy-load="true" src="{{item.avatar}}" />
           <view class="user_right">
             <view class="nickname">{{item.nickName}}</view>
-          <view class="time">
-            <text>发布时间:</text>
-            <text>{{item.time}}</text>
-          </view>
           </view>
             
         </view>
-        <view class="more_btn">
-            <view class="more_item"></view>
-            <view class="more_item"></view>
-            <view class="more_item"></view>
-        </view>
-          
+          <view class="time">
+            <text>发布时间:{{item.time}}</text>
+          </view>
       </view>
       <video 
         id="video_{{index}}" 

+ 1 - 15
component/video-swiper/index.wxss

@@ -40,24 +40,10 @@
   font-size: 30rpx;
   color: rgba(0, 0, 0, 0.6);
 }
-.container .video-swiper .swiper_item .head_box .user_box .user_right .time {
+.container .video-swiper .swiper_item .head_box .time {
   font-size: 26rpx;
   color: rgba(0, 0, 0, 0.6);
 }
-.container .video-swiper .swiper_item .head_box .more_btn {
-  width: 50rpx;
-  height: 100%;
-  margin-right: 20rpx;
-  display: flex;
-  align-items: center;
-  justify-content: space-around;
-}
-.container .video-swiper .swiper_item .head_box .more_btn .more_item {
-  width: 5rpx;
-  height: 5rpx;
-  background: rgba(0, 0, 0, 0.6);
-  border-radius: 50%;
-}
 .container .video-swiper .swiper_item .video_item {
   width: 100%;
   height: 422rpx;

+ 6 - 4
pages/index/index.js

@@ -73,7 +73,8 @@ Page({
     commentList: [],
     commentNum: 0,
     followPageNo: 1,
-    followPageSize: 6
+    followPageSize: 6,
+    coursesData:[]
   },
   jurisdiction: function () {
     //隐藏弹框
@@ -109,10 +110,9 @@ Page({
     if (myIndex == 2) {
       this.setData({
         videoList: [],
-        templates: 'coursestao'
+        templates: 'courses'
       }, () => {
         this.getCoursesList();
-
       })
       return;
     }
@@ -641,10 +641,12 @@ Page({
     })
   },
   getCoursesList: function () {
-    httpRequestApi.getSearchResult('PRESCHOOL', 1, 10).success(res => {
+    httpRequestApi.getCourses('PRIMARY_FIRST_GRADE', 1, 10).success(res => {
       console.log('资源', res)
       this.setData({
         coursesData: res.data.data.list
+      },()=>{
+        console.log(this.data.coursesData)
       })
     })
   },

+ 5 - 3
pages/index/index.wxml

@@ -1,5 +1,5 @@
 <!-- index.wxml -->
-<StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" />
+<!-- <StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" /> -->
 <view class="change_grade" wx:if="{{isGradeShow}}">
   <view class="change_brage_wrapper">
     <text class="title">分龄选择</text>
@@ -29,8 +29,7 @@
   <!-- <import src="/component/follow/follow.wxml" /> -->
   <import src="/component/my/my.wxml" />
   <import src="/templates/courses/courses.wxml" />
-  <!-- 调用组件 -->
-  <template is="{{templates}}" wx:if="{{myIndex === 3}}" data="{{myData: myData,coursesData:coursesData}}"></template>
+ 
   <!-- 顶部导航 -->
   <view class="top-tab">
     <block wx:for="{{tab}}" wx:key="{{index}}">
@@ -59,6 +58,9 @@
   bindloadedmetadata="onLoadedMetaData" -->
   </VideoSwiper>
 
+   <!-- 调用组件 -->
+  <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData}}"></template>
+
   <view class="comment_section" catchtap="commentTap" data-type="blank" wx:if="{{commentShow}}">
   <Comment 
   data-type="list"

+ 2 - 2
pages/index/index.wxss

@@ -24,8 +24,8 @@
 
 .top-tab {
   position: fixed;
-  /* top: 0; */
-  top: 118rpx;
+  top: 0;
+  /* top: 118rpx; */
   width: 100%;
   height: 80rpx;
   background: #12C962;

+ 1 - 9
pages/main/reading/reading.wxml

@@ -32,6 +32,7 @@
         </view>
     </view> -->
 
+</view>
       <VideoSwiper 
   wx:if="{{videoList.length > 0}}"
   class="video-swiper" 
@@ -43,14 +44,5 @@
   bindgoToReading="goToReading"
   bindplay="onPlay"
   >
-    <!-- bindplay="onPlay"
-  bindpause="onPause"
-  bindtimeupdate="onTimeUpdate"
-  bindended="onEnded"
-  binderror="onError"
-  bindwaiting="onWaiting"
-  bindprogress="onProgress"
-  bindloadedmetadata="onLoadedMetaData" -->
   </VideoSwiper>
-</view>
 

+ 2 - 2
pages/main/reading/reading.wxss

@@ -1,6 +1,6 @@
 .readingPage {
-    height: 100%;
-    overflow: hidden;
+    /* height: 100%; */
+    /* overflow: hidden; */
 }
 
 .videoSection {

+ 51 - 1
templates/courses/courses.less

@@ -1,4 +1,54 @@
-.courses_container{
+.courses_container {
     width: 100%;
     height: 100%;
+
+    .course_item {
+        width: 100%;
+        height: 400rpx;
+        background: #fff;
+        // display: flex;
+        // flex-direction: column;
+        // align-items: center;
+
+
+        .course_icon {
+            display: block;
+            width: 704rpx;
+            height: 290rpx;
+            border-radius: 20rpx;
+            margin: 0 auto;
+        }
+
+        .course_info {
+            width: 704rpx;
+            display: flex;
+            flex-direction: row;
+            align-items: center;
+            justify-content: space-between;
+            margin: 17rpx auto;
+
+            .course_title {
+                color: #373737;
+                font-size: 30rpx;
+
+            }
+
+            .course_btn {
+                width: 270rpx;
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                .btn_icon {
+                    width: 56rpx;
+                    height: 56rpx;
+                }
+
+                .btn_text {
+                    font-size: 28rpx;
+                    color: rgba(0, 0, 0, .6);
+                }
+            }
+        }
+
+    }
 }

+ 9 - 9
templates/courses/courses.wxml

@@ -1,18 +1,18 @@
 <!-- <wxs src="../../pages/commonWxs/format.wxs" module="format" /> -->
 <template name="courses">
     <view class="courses_container">
-        <view class="course_item" wx:for="{{coursesData}}" wx:key="{{index}}">
-            <image class="course_icon" src="{{item.iconImg}}" lazy-load="true" />
+        <view class="course_item" bindtap="goToReading" wx:for="{{coursesData}}" data-id="{{item.lesson.id}}" wx:key="index">
+            <image class="course_icon" src="{{item.lesson.iconImg}}" lazy-load="true" />
             <view class="course_info">
-                <text class="course_title">{{item.title}}</text>
+                <text class="course_title">{{item.lesson.title}}</text>
                 <view class="course_btn">
-                    <view class="collect">
-                        <image class="collect_icon" src="../../static/image/collect.png" />
-                        <text class="collect_text">收藏</text>
+                    <view class="collect course_btn">
+                        <image class="collect_icon btn_icon" src="../../static/image/collect.png" />
+                        <text class="collect_text btn_text">收藏</text>
                     </view>
-                    <view class="share">
-                        <image class="share_icon" src="../../static/image/share.png" />
-                        <text class="share_text">分享</text>
+                    <view class="share course_btn">
+                        <image class="share_icon btn_icon" src="../../static/image/share.png" />
+                        <text class="share_text btn_text">分享</text>
                     </view>
                 </view>
             </view>

+ 38 - 0
templates/courses/courses.wxss

@@ -2,3 +2,41 @@
   width: 100%;
   height: 100%;
 }
+.courses_container .course_item {
+  width: 100%;
+  height: 400rpx;
+  background: #fff;
+}
+.courses_container .course_item .course_icon {
+  display: block;
+  width: 704rpx;
+  height: 290rpx;
+  border-radius: 20rpx;
+  margin: 0 auto;
+}
+.courses_container .course_item .course_info {
+  width: 704rpx;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  margin: 17rpx auto;
+}
+.courses_container .course_item .course_info .course_title {
+  color: #373737;
+  font-size: 30rpx;
+}
+.courses_container .course_item .course_info .course_btn {
+  width: 270rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.courses_container .course_item .course_info .course_btn .btn_icon {
+  width: 56rpx;
+  height: 56rpx;
+}
+.courses_container .course_item .course_info .course_btn .btn_text {
+  font-size: 28rpx;
+  color: rgba(0, 0, 0, 0.6);
+}

+ 11 - 12
utils/APIClient.js

@@ -10,11 +10,11 @@ function getProductUrl(action) {
 
 function getBaseUrl(action) {
   return HOST_BASE + action;
-}
+} 
 module.exports = {
   //获取推荐首页信息(推荐课程)
   getIndex(uid) {
-    let url = getProductUrl('wx/index');
+    let url = getBaseUrl('wx/index');
     return request.getInstance().header({
       uid
     }).url(url).send();
@@ -45,7 +45,7 @@ module.exports = {
   },
   // 获取全部课本
   getAllBooks(pageNo, pageSize) {
-    let url = getProductUrl('wx/product');
+    let url = getBaseUrl('wx/product');
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).data({
@@ -55,7 +55,7 @@ module.exports = {
   },
   // 获取课本详情
   getBookDetail(uid, id) {
-    let url = getProductUrl(`wx/product/${id}`);
+    let url = getBaseUrl(`wx/product/${id}`);
     return request.getInstance().header({
       uid
     }).url(url).send();
@@ -63,14 +63,14 @@ module.exports = {
   // 获取单课详情
   getClassDetail(uid, id) {
     // let url = getProductUrl(`wx/lesson/${id}`);
-    let url = getProductUrl(`wx/lesson/info/${id}`);
+    let url = getBaseUrl(`wx/lesson/info/${id}`);
     return request.getInstance().header({
       uid
     }).url(url).send();
   },
   // 检查是否收藏过课程
   classIsLike(uid, data) {
-    let url = getProductUrl(`wx/favorites/isLike`);
+    let url = getBaseUrl(`wx/favorites/isLike`);
     return request.getInstance().header({
       uid
     }).url(url).data(data).send();
@@ -143,12 +143,11 @@ module.exports = {
     }).send();
   },
   // 搜索
-  getSearchResult(grade,pageNo, pageSize) {
-    let url = getProductUrl(`wx/lesson`);
+  getCourses(grade,pageNo, pageSize) {
+    let url = getBaseUrl(`wx/lesson`);
     return request.getInstance().header({
       uid:wx.getStorageSync('uid')
     }).url(url).data({
-      title:'',
       gradeClassify: grade,
       pageNo: pageNo,
       pageSize: pageSize
@@ -232,7 +231,7 @@ module.exports = {
   },
   // 收藏课程
   collectClass(uid, data) {
-    let url = getProductUrl(`wx/favorites`);
+    let url = getBaseUrl(`wx/favorites`);
     return request.getInstance().header({
       uid
     }).url(url).data(data).method('POST').send();
@@ -328,7 +327,7 @@ module.exports = {
   },
   // 我的收藏
   myFavorites() {
-    let url = getProductUrl(`wx/favorites`);
+    let url = getBaseUrl(`wx/favorites`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).send();
@@ -368,7 +367,7 @@ module.exports = {
   // },
   // 找到课程对应的课本
   checkLesson(lessonId) {
-    let url = getProductUrl(`wx/lesson/product/${lessonId}`);
+    let url = getBaseUrl(`wx/lesson/product/${lessonId}`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).url(url).send();