Browse Source

综合调整

bayi 2 năm trước cách đây
mục cha
commit
916f129b3a

+ 3 - 3
app.json

@@ -22,14 +22,14 @@
   "tabBar": {
     "custom": true,
     "list": [{
-      "pagePath": "pages/my/index",
-      "text": "我的"
-    }, {
       "pagePath": "pages/index/index",
       "text": "推荐"
     }, {
       "pagePath": "pages/works/index",
       "text": "作品"
+    }, {
+      "pagePath": "pages/my/index",
+      "text": "我的"
     }]
   },
   "window": {

+ 5 - 5
components/activityList/index.wxml

@@ -39,26 +39,26 @@
         <view class="top">
           <view class="userBox">
             <view class="secondUser">
-              <image src="{{item.userList[1].avatar}}" class="avatar" />
+              <image src="{{item.userList[1].avatar||'/static/nullAvatar.png'}}" class="avatar" />
             </view>
             <view class="nickName textOver">{{item.userList[1].nickName||item.userList[1].eid}}</view>
           </view>
           <view class="userBox">
             <view class="firstUser">
-              <image src="{{item.userList[0].avatar}}" class="avatar" />
+              <image src="{{item.userList[0].avatar||'/static/nullAvatar.png'}}" class="avatar" />
             </view>
             <view class="nickName textOver">{{item.userList[0].nickName||item.userList[0].eid}}</view>
           </view>
           <view class="userBox">
             <view class="thirdUser">
-              <image src="{{item.userList[2].avatar}}" class="avatar" />
+              <image src="{{item.userList[2].avatar||'/static/nullAvatar.png'}}" class="avatar" />
             </view>
             <view class="nickName textOver">{{item.userList[2].nickName||item.userList[2].eid}}</view>
           </view>
         </view>
         <view class="btm">
           <view class="userBox" wx:for="{{5}}" wx:key="index" wx:for-item="items">
-            <image src="{{item.userList[index+3].avatar}}" class="avatar" />
+            <image src="{{item.userList[index+3].avatar||'/static/nullAvatar.png'}}" class="avatar" />
             <view class="nickName textOver">
               {{item.userList[index+3].nickName||item.userList[index+3].eid||'请你来挑战'}}
             </view>
@@ -81,7 +81,7 @@
         <view class="row" wx:for="{{3}}" wx:key="index" wx:for-item='items'>
           <view class="left">
             <image src="/static/{{index+1}}-1.png" class="stand" />
-            <image src="{{item.userList[index].avatar}}" class="avatar" />
+            <image src="{{item.userList[index].avatar||'/static/nullAvatar.png'}}" class="avatar" />
             <view class="nickName textOver">{{item.userList[index].nickName||item.userList[index].eid}}
             </view>
           </view>

+ 4 - 5
components/videoPreview/index.less

@@ -3,13 +3,13 @@
   background-color: white;
   border-radius: 32rpx;
   box-shadow: rgba(99, 99, 99, 0.1) 0px 2px 8px 0px;
-  padding-bottom: 20rpx;
+  padding-bottom: 30rpx;
 
   .workHead {
     display: flex;
     justify-content: space-between;
     align-items: center;
-    padding: 20rpx;
+    padding: 20rpx 20rpx 8rpx;
 
     .wH-left {
       display: flex;
@@ -213,11 +213,10 @@
   }
 
   .workFooter {
-    margin-top: 15rpx;
     display: flex;
     justify-content: space-between;
     align-items: center;
-    padding: 14rpx 20rpx 0rpx;
+    padding: 20rpx 20rpx 8rpx;
 
     .mangeL-box {
       display: flex;
@@ -238,7 +237,7 @@
 
   .toReading {
     width: 166rpx;
-    margin: 30rpx auto 0rpx;
+    margin: 14rpx auto 0rpx;
     display: flex;
     align-items: center;
     justify-content: center;

+ 4 - 5
components/videoPreview/index.wxss

@@ -3,13 +3,13 @@
   background-color: white;
   border-radius: 32rpx;
   box-shadow: rgba(99, 99, 99, 0.1) 0px 2px 8px 0px;
-  padding-bottom: 20rpx;
+  padding-bottom: 30rpx;
 }
 .work .workHead {
   display: flex;
   justify-content: space-between;
   align-items: center;
-  padding: 20rpx;
+  padding: 20rpx 20rpx 8rpx;
 }
 .work .workHead .wH-left {
   display: flex;
@@ -182,11 +182,10 @@
   text-align: center;
 }
 .work .workFooter {
-  margin-top: 15rpx;
   display: flex;
   justify-content: space-between;
   align-items: center;
-  padding: 14rpx 20rpx 0rpx;
+  padding: 20rpx 20rpx 8rpx;
 }
 .work .workFooter .mangeL-box {
   display: flex;
@@ -203,7 +202,7 @@
 }
 .work .toReading {
   width: 166rpx;
-  margin: 30rpx auto 0rpx;
+  margin: 14rpx auto 0rpx;
   display: flex;
   align-items: center;
   justify-content: center;

+ 40 - 40
custom-tab-bar/index.js

@@ -1,47 +1,47 @@
 // custom-tab-bar/index.js
 Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {
+  /**
+   * 组件的属性列表
+   */
+  properties: {
 
-    },
+  },
 
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        selected: 0,
-        color: "#999999",
-        selectedColor: "#32CA69",
-        listTab: [{
-            "pagePath": "/pages/my/index",
-            "text": "我的",
-            "iconPath": "/static/my.png",
-            "selectedIconPath": "/static/my2.png"
-        }, {
-            "pagePath": "/pages/index/index",
-            "text": "推荐",
-            "iconPath": "/static/tj.png",
-            "selectedIconPath": "/static/tj2.png"
-        }, {
-            "pagePath": "/pages/works/index",
-            "text": "作品",
-            "iconPath": "/static/zp.png",
-            "selectedIconPath": "/static/zp2.png"
-        }]
-    },
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    selected: 0,
+    color: "#999999",
+    selectedColor: "#32CA69",
+    listTab: [{
+      "pagePath": "/pages/my/index",
+      "text": "我的",
+      "iconPath": "/static/my.png",
+      "selectedIconPath": "/static/my2.png"
+    }, {
+      "pagePath": "/pages/index/index",
+      "text": "推荐",
+      "iconPath": "/static/tj.png",
+      "selectedIconPath": "/static/tj2.png"
+    }, {
+      "pagePath": "/pages/works/index",
+      "text": "作品",
+      "iconPath": "/static/zp.png",
+      "selectedIconPath": "/static/zp2.png"
+    }]
+  },
 
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        switchTab(e) {
-            const data = e.currentTarget.dataset;
-            const url = data.path;
-            wx.switchTab({
-                url
-            });
-        }
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    switchTab(e) {
+      const data = e.currentTarget.dataset;
+      const url = data.path;
+      wx.switchTab({
+        url
+      });
     }
+  }
 })

+ 1 - 7
pages/childClassify/index.js

@@ -18,24 +18,21 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-    let title = '搜索'
     // 没有二级分类
     if (options.id) {
       this.setData({
         childType: options.id
       })
-      title = options.title
       this.resetData()
     } else if (options.list) {
       let categoryList = JSON.parse(decodeURIComponent(options.list))
       this.setData({
         categoryList
       })
-      title = this.data.categoryList[this.data.currentIndex].title
       this.resetData()
     }
     wx.setNavigationBarTitle({
-      title
+      title: options.title || '搜索'
     })
     this.setData({
       type: options.type,
@@ -58,9 +55,6 @@ Page({
       scrollTop: 0,
       currentIndex: currentTarget.dataset.index
     })
-    wx.setNavigationBarTitle({
-      title: this.data.categoryList[this.data.currentIndex].title
-    })
     this.resetData()
   },
   setSearch({

+ 9 - 8
pages/childClassify/index.less

@@ -71,20 +71,19 @@
       display: flex;
       align-items: center;
       justify-content: space-between;
-      padding: 28rpx 20rpx;
+      padding: 8rpx 12rpx;
       box-sizing: border-box;
       background-color: white;
       border-radius: 20rpx;
       margin-bottom: 20rpx;
 
       .left {
+        flex: 1;
         display: flex;
         align-items: center;
-        justify-content: space-between;
-
         .cover {
-          width: 144rpx;
-          height: 80rpx;
+          width: 230rpx;
+          height: 128rpx;
           border-radius: 8rpx;
         }
 
@@ -122,9 +121,10 @@
         }
 
         .work {
-          margin-left: 26rpx;
+          margin-left: 16rpx;
+
           .title {
-            width: 340rpx;
+            width: 270rpx;
             font-size: 32rpx;
             font-weight: bold;
             margin-bottom: 10rpx;
@@ -156,7 +156,8 @@
       }
 
       .goRead {
-        padding: 6rpx 32rpx 8rpx;
+        padding: 6rpx 28rpx 8rpx;
+        // width: 300rpx;
         color: white;
         font-size: 32rpx;
         background-image: linear-gradient(270deg, #33C3FF 0%, #81C7FF 100%, #14C962 100%);

+ 7 - 7
pages/childClassify/index.wxss

@@ -64,20 +64,20 @@
   display: flex;
   align-items: center;
   justify-content: space-between;
-  padding: 28rpx 20rpx;
+  padding: 8rpx 12rpx;
   box-sizing: border-box;
   background-color: white;
   border-radius: 20rpx;
   margin-bottom: 20rpx;
 }
 .classBox .worksList .worksBox .left {
+  flex: 1;
   display: flex;
   align-items: center;
-  justify-content: space-between;
 }
 .classBox .worksList .worksBox .left .cover {
-  width: 144rpx;
-  height: 80rpx;
+  width: 230rpx;
+  height: 128rpx;
   border-radius: 8rpx;
 }
 .classBox .worksList .worksBox .left .audioCover {
@@ -110,10 +110,10 @@
   border-radius: 50%;
 }
 .classBox .worksList .worksBox .left .work {
-  margin-left: 26rpx;
+  margin-left: 16rpx;
 }
 .classBox .worksList .worksBox .left .work .title {
-  width: 340rpx;
+  width: 270rpx;
   font-size: 32rpx;
   font-weight: bold;
   margin-bottom: 10rpx;
@@ -138,7 +138,7 @@
   color: #666666;
 }
 .classBox .worksList .worksBox .goRead {
-  padding: 6rpx 32rpx 8rpx;
+  padding: 6rpx 28rpx 8rpx;
   color: white;
   font-size: 32rpx;
   background-image: linear-gradient(270deg, #33C3FF 0%, #81C7FF 100%, #14C962 100%);

+ 7 - 6
pages/index/index.less

@@ -59,25 +59,27 @@
     justify-content: space-between;
 
     .type {
-      padding: 14rpx 0rpx;
+      padding: 10rpx 0rpx;
       width: 200rpx;
       box-sizing: border-box;
       text-align: center;
       border: 1rpx solid #9f9f9fa4;
       border-radius: 50rpx;
       color: #1A1A1A;
-      font-size: 24rpx;
+      font-size: 28rpx;
     }
 
     .currentType {
       border: none;
+      color: white;
       box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
-      background-color: white;
+      background-color: #00C657;
       font-weight: bold;
     }
 
     .search {
-      padding: 8rpx 20rpx;
+      font-size: 0rpx;
+      padding: 14rpx 14rpx;
       text-align: center;
       border: 1rpx solid #9f9f9fa4;
       border-radius: 50rpx;
@@ -88,5 +90,4 @@
       }
     }
   }
-}
-
+}

+ 1 - 1
pages/index/index.wxml

@@ -19,7 +19,7 @@
     </scroll-view>
     <!-- 展示类型选择 -->
     <view class="selectType {{isFixed?'isFixed2':''}}" bindtap="selectType">
-      <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>优秀作品展播</view>
+      <view class="type {{currentType=='1'?'currentType':''}}" data-type='1'>作品展播</view>
       <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>官方推荐</view>
       <view class="type {{currentType=='3'?'currentType':''}}" data-type='3'>官方活动</view>
       <view class="search" bindtap="jumpSearch">

+ 6 - 4
pages/index/index.wxss

@@ -50,23 +50,25 @@
   justify-content: space-between;
 }
 .recommend .selectType .type {
-  padding: 14rpx 0rpx;
+  padding: 10rpx 0rpx;
   width: 200rpx;
   box-sizing: border-box;
   text-align: center;
   border: 1rpx solid #9f9f9fa4;
   border-radius: 50rpx;
   color: #1A1A1A;
-  font-size: 24rpx;
+  font-size: 28rpx;
 }
 .recommend .selectType .currentType {
   border: none;
+  color: white;
   box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
-  background-color: white;
+  background-color: #00C657;
   font-weight: bold;
 }
 .recommend .selectType .search {
-  padding: 8rpx 20rpx;
+  font-size: 0rpx;
+  padding: 14rpx 14rpx;
   text-align: center;
   border: 1rpx solid #9f9f9fa4;
   border-radius: 50rpx;

+ 1 - 1
pages/my/index.wxml

@@ -1,5 +1,5 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
-<navigationBar title="我的"></navigationBar>
+<navigationBar></navigationBar>
 <view class="container seat">
   <!-- 用户信息 -->
   <view class="userBox">

+ 46 - 33
pages/reading/index.js

@@ -37,6 +37,8 @@ Page({
     videoInfo: {},
     currentRow: null,
     state: false,
+    // 示例播放状态
+    exampleState: false,
     // 是否静音播放视频
     muted: false,
     countDown: {
@@ -95,6 +97,20 @@ Page({
     wsEngine.onErrorResult((res) => {
       console.log("===收到错误结果=============", res)
     });
+    this.innerAudioContext = wx.createInnerAudioContext();
+    this.resultAudioContext = wx.createInnerAudioContext();
+    this.resultAudioContext.onEnded(res => {
+      this.setData({
+        exampleState: false
+      })
+      this.stopMediaState()
+    })
+    this.resultAudioContext.onStop((res) => {
+      this.setData({
+        exampleState: false
+      })
+      this.stopMediaState()
+    });
   },
   // 获取阅读内容
   async getreadInfo(videoId, reset = false) {
@@ -118,7 +134,6 @@ Page({
     if (!this.data.videoInfo.userReadExtend || this.data.videoInfo.userReadExtend.resourcesType == 0) {
       this.videoContext = wx.createVideoContext('myVideo')
     } else {
-      this.innerAudioContext = wx.createInnerAudioContext();
       this.innerAudioContext.src = videoInfo.userRead.originVideo
       this.innerAudioContext.onEnded(res => {
         this.finishRecord()
@@ -142,13 +157,11 @@ Page({
       return
     }
     if (this.data.readingReset) {
-      if (!this.data.videoInfo.userReadExtend || this.data.videoInfo.userReadExtend.resourcesType == 0) {
-        this.stopMediaState()
-      }
-      this.clearReset()
       this.getHeight()
     }
+    this.stopMediaState()
     this.setData({
+      readingReset: false,
       'countDown.state': true
     })
     this.stl = setInterval(() => {
@@ -348,15 +361,6 @@ Page({
       })
     })
   },
-  // 测试的
-  pkResult() {
-    wx.redirectTo({
-      url: `/pages/score/index?readingType=${this.data.readingType}`
-    })
-    /* wx.redirectTo({
-      url: `/pages/pkResult/index`,
-    }) */
-  },
   // 字体换行
   startRecording() {
     if (this.data.currentRow == null) {
@@ -381,30 +385,39 @@ Page({
   },
   // 视频播放结束
   videoEnd() {
+    console.log('视频播放结束触发的');
     this.finishRecord()
   },
   videoPlay() {
-    if (this.data.readingReset) {
-      console.log(this.resultAudioContext, 'videoPlay');
-      if (this.resultAudioContext) {
-        this.resultAudioContext.stop()
+    if (this.data.videoInfo.userReadExtend.resourcesType == 1) {
+      if (this.data.exampleState) {
+        this.setData({
+          exampleState: false
+        })
+        return this.resultAudioContext.stop()
       }
+      this.resultAudioContext.src = this.data.readingReset ? this.data.readDetail.tempFilePath : this.data.videoInfo.userRead.audioPath;
+      this.resultAudioContext.play();
       this.setData({
-        muted: true
+        exampleState: true
       })
-      this.resultAudioContext = wx.createInnerAudioContext();
-      this.resultAudioContext.src = this.data.readDetail.tempFilePath; // 这里可以是录音的临时路径
-      this.resultAudioContext.play();
-    }
-  },
-  // 清除试听状态
-  clearReset() {
-    if (this.resultAudioContext) {
-      this.resultAudioContext.stop()
+    } else {
+      if (this.data.readingReset) {
+        this.resultAudioContext.src = this.data.readDetail.tempFilePath;
+        this.resultAudioContext.play();
+        this.setData({
+          muted: true,
+          exampleState: true
+        })
+      } else {
+        this.setData({
+          muted: false,
+          exampleState: true
+        })
+      }
+      this.videoContext.play()
     }
-    this.setData({
-      readingReset: false
-    })
+    this.startRecording()
   },
   // 控制视频或音频的播放状态
   async playMediaState() {
@@ -426,9 +439,9 @@ Page({
     if (!this.data.videoInfo.userReadExtend || this.data.videoInfo.userReadExtend.resourcesType == 0) {
       this.videoContext.stop()
       this.videoContext.seek(0)
-    } else {
-      this.innerAudioContext.stop()
     }
+    this.innerAudioContext.stop()
+    this.resultAudioContext.stop()
   },
   // 获取设备高度与行高度
   getHeight() {

+ 2 - 1
pages/reading/index.less

@@ -90,7 +90,7 @@
       position: absolute;
       top: 0rpx;
       width: 100%;
-      height: 80rpx;
+      height: 50rpx;
       z-index: 10;
       background: linear-gradient(to bottom, rgb(255, 255, 255), rgba(255, 255, 255, 0.4))
     }
@@ -104,6 +104,7 @@
       box-sizing: border-box;
 
       .row {
+        min-height: 60rpx;
         padding: 18rpx 0rpx;
         font-size: 40rpx;
       }

+ 6 - 6
pages/reading/index.wxml

@@ -1,8 +1,8 @@
 <view class="readingBox">
   <block wx:if="{{!videoInfo.userReadExtend||videoInfo.userReadExtend.resourcesType==0}}">
-    <image src="{{videoInfo.userRead.coverImg}}" class='poster' wx:if="{{!state&&!readingReset}}" />
-    <video id="myVideo" src="{{videoInfo.userRead.originVideo}}" bindended='videoEnd'
-      show-center-play-btn="{{readingReset}}" bindplay='videoPlay' muted="{{muted}}"></video>
+    <image src="{{videoInfo.userRead.coverImg}}" class='poster' wx:if="{{!state&&!exampleState}}" bindtap="videoPlay" />
+    <video id="myVideo" src="{{state?videoInfo.userRead.originVideo:videoInfo.userRead.videoPath}}" bindended='videoEnd'
+      show-center-play-btn="{{readingReset}}" controls="{{false}}" muted="{{muted}}"></video>
   </block>
   <view class="audio" wx:else>
     <image src="{{videoInfo.userRead.coverImg}}" class="audioBg" mode="" />
@@ -10,14 +10,15 @@
     <view class="audioPlay" style="background-image: url({{videoInfo.userReadExtend.backgroundVirtualImg}});">
       <image src="/static/audioBg.png" class="audioPlayBg {{state?'circle':''}}" />
       <image src="/static/zhen.png" class="audioPlayZhen" />
-      <image src="{{videoInfo.userRead.coverImg}}" bindtap='videoPlay' class="cover {{state?'circle':''}}" mode="" />
+      <image src="{{videoInfo.userRead.coverImg}}" bindtap='videoPlay' class="cover {{state||exampleState?'circle':''}}"
+        mode="" />
     </view>
   </view>
   <view class="contentBox" wx:if="{{!readingReset}}">
     <view class="articleMask"></view>
     <scroll-view class="content" scroll-y enhanced show-scrollbar="{{false}}" scroll-top="{{scrollTop}}"
       scroll-with-animation>
-      <view style="height: 180rpx;"></view>
+      <view style="height: 100rpx;"></view>
       <view class="row {{currentRow==index?'currentRow':''}}" wx:for="{{article}}" wx:key="id">{{item.text}}
       </view>
       <view style="height: {{contentH}}rpx;"></view>
@@ -84,7 +85,6 @@
   </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="setCountDown" />
     <view class="text">

+ 2 - 1
pages/reading/index.wxss

@@ -80,7 +80,7 @@
   position: absolute;
   top: 0rpx;
   width: 100%;
-  height: 80rpx;
+  height: 50rpx;
   z-index: 10;
   background: linear-gradient(to bottom, #ffffff, rgba(255, 255, 255, 0.4));
 }
@@ -93,6 +93,7 @@
   box-sizing: border-box;
 }
 .readingBox .contentBox .content .row {
+  min-height: 60rpx;
   padding: 18rpx 0rpx;
   font-size: 40rpx;
 }

BIN
static/nullAvatar.png