sun2511 пре 2 година
родитељ
комит
0d454c9506
5 измењених фајлова са 49 додато и 119 уклоњено
  1. 14 22
      pages/index/index.js
  2. 1 18
      pages/index/index.wxml
  3. 34 77
      pages/reading/reading.js
  4. 0 1
      pages/reading/reading.json
  5. 0 1
      pages/reading/reading.wxml

+ 14 - 22
pages/index/index.js

@@ -33,9 +33,6 @@ import {
 Page({
     data: {
         tab: [{
-                name: '我的',
-                templates: 'my',
-            }, {
                 name: '推荐',
                 templates: 'recommend',
             },
@@ -143,16 +140,13 @@ Page({
         }
 
         /* 关注和我的需要登陆后查看 */
-        console.log(this.data.isLogin, 'zzzzzzzzz');
         if (!this.data.isLogin) {
             wx.navigateTo({
                 url: `../../pages/login/login?index=${myIndex}`
             });
             return;
         }
-
-        console.log('继续')
-            // 刷新关注列表
+        // 刷新关注列表
         if (myIndex == 1) {
             this.setData({
                 videoList: [],
@@ -176,18 +170,17 @@ Page({
             return;
         }
         // 刷新我的
-        if (myIndex == 3) {
-            this.setData({
-                videoList: [],
-                templates: 'my',
-                isSwiper: false
-            }, () => {
-                myInit(this);
-                httpRequestApi.userEvent('MY');
-
-            })
-            return;
-        }
+        /*  if (myIndex == 3) {
+             this.setData({
+                 videoList: [],
+                 templates: 'my',
+                 isSwiper: false
+             }, () => {
+                 myInit(this);
+                 httpRequestApi.userEvent('MY');
+             })
+             return;
+         } */
     },
     showPage: function() {
         let options = this.data.options;
@@ -302,9 +295,8 @@ Page({
         console.log('onload', options);
         let shareUid = options.uid
         getOpenidNoLogin((res) => {
-            console.log('getOpenidNoLogin', res)
-                /**获取权限和订单信息 */
-                // 获取商品信息
+            /**获取权限和订单信息 */
+            // 获取商品信息
             httpRequestApi.getProductActivity().success(res => {
                     wx.setStorageSync('price', res.data.data.price / 100)
                     wx.setStorageSync('productId', res.data.data.id)

+ 1 - 18
pages/index/index.wxml

@@ -1,23 +1,6 @@
 <!-- index.wxml -->
 <!-- <StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" /> -->
 <mp-navigation-bar title="UI组件库"></mp-navigation-bar>
-<!-- <view class="change_grade" wx:if="{{isGradeShow}}">
-    <view class="change_brage_wrapper">
-        <text class="title">分龄选择</text>
-        <view class="change_row">
-            <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_FIRST_GRADE">一年级</view>
-            <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_SECOND_GRADE">二年级</view>
-        </view>
-        <view class="change_row">
-            <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_THREE_GRADE">三年级</view>
-            <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_SENIOR_GRADE">四年级</view>
-        </view>
-        <view class="change_row change_row_single">
-            <view class="change_item" bindtap="changeGrade" data-code="PRESCHOOL">学前班</view>
-            <view class="change_item change_item_blank" data-code="PRESCHOOL"></view>
-        </view>
-    </view>
-</view> -->
 <view class="gradeContainer" catchtouchmove='true' wx:if="{{isGradeShow}}">
     <view class="gradeBox" bindtap="selectGrade">
         <view class="title">年级选择</view>
@@ -39,7 +22,7 @@
 </view>
 <view class="container">
     <!-- 引入组件 -->
-    <import src="/component/my/my.wxml" />
+    <!-- <import src="/component/my/my.wxml" /> -->
     <import src="/templates/courses/courses.wxml" />
     <!-- 顶部导航 -->
     <view class="top-tab" wx:if="{{!isGradeShow}}">

+ 34 - 77
pages/reading/reading.js

@@ -1,6 +1,10 @@
 import httpRequestApi from '../../utils/APIClient';
 const aiengine = require('../../utils/ChivoxAiEngine')
 const sha1 = require('../../utils/sha1');
+import {
+    getUserInfo,
+    getVipInfo
+} from '~/api/user'
 const app = getApp()
 
 import {
@@ -8,6 +12,8 @@ import {
 } from '../../utils/util';
 Page({
     data: {
+        userInfo: {},
+        isVip: false,
         title: '',
         id: '',
         img: '',
@@ -64,26 +70,19 @@ Page({
             console.log('课程信息', res)
             let reg = /\\n/g
             this.setData({
-                    title: res.data.data.userRead.title,
-                    videoUrl: res.data.data.userRead.videoPath,
-                    videoPathTemp: res.data.data.userRead.videoPath,
-                    originVideo: res.data.data.userRead.originVideo,
-                    img: res.data.data.userRead.iconImg,
-                    id: res.data.data.userRead.id,
-                    readingText: res.data.data.userRead.lessonText,
-                    grade: res.data.data.userRead.grade,
-                    exampleId: res.data.data.userRead.exampleId,
-                    summary: res.data.data.userRead.summary,
-                    coverImg: res.data.data.userRead.coverImg,
-                    shareImg: res.data.data.userRead.shareImg,
-                    isActivityRead: res.data.data.isActivityRead,
-                })
-                // 参赛作品,增加数据
-            if (res.data.data.isActivityRead) {
-                httpRequestApi.postActEvent('LESSON').success(res => {
-                    console.log('示范朗读页', res)
-                })
-            }
+                title: res.data.data.userRead.title,
+                videoUrl: res.data.data.userRead.videoPath,
+                videoPathTemp: res.data.data.userRead.videoPath,
+                originVideo: res.data.data.userRead.originVideo,
+                img: res.data.data.userRead.iconImg,
+                id: res.data.data.userRead.id,
+                readingText: res.data.data.userRead.lessonText,
+                grade: res.data.data.userRead.grade,
+                exampleId: res.data.data.userRead.exampleId,
+                summary: res.data.data.userRead.summary,
+                coverImg: res.data.data.userRead.coverImg,
+                shareImg: res.data.data.userRead.shareImg,
+            })
             this.getReadInfo(id)
             httpRequestApi.userIntoPage('pages/reading/reading', '朗读页面').success((res) => {
 
@@ -114,6 +113,7 @@ Page({
         }
     },
     onShow: function() {
+        this.getUserInfo()
         this.videoCtx = wx.createVideoContext('myVideo', this);
         let data = requirePlugin("myPlugin");
         const obj = {
@@ -200,6 +200,15 @@ Page({
         });
 
     },
+    async getUserInfo() {
+        let userInfo = await getUserInfo()
+        let vip = await getVipInfo()
+        console.log(userInfo);
+        this.setData({
+            userInfo,
+            isVip: vip ? true : false
+        })
+    },
     ssRecorderCallback: function(type, data) {
         console.log('录音测评监控回调', type)
         console.log('录音测评监控回调', data)
@@ -251,21 +260,10 @@ Page({
      *      2 录音结束
      ***/
     audioRecord: function() {
-        // 判断是否有权限朗读 不是vip 并且 不是活动作品
-        const isVip = wx.getStorageSync('vip');
-        console.log('判断', !isVip && !this.data.isActivityRead)
-        if (!isVip && !this.data.isActivityRead) {
+        // 判断是否有权限朗读 不是vip并且没有朗读机会
+        const isVip = this.data.isVip
+        if (!isVip && this.data.userInfo.experienceAmount <= 0) {
             this.selectComponent('#readingTips').showModal();
-            /*   const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
-              if (!this.data.isIOS) {
-                  this.setData({
-                      payPrice: wx.getStorageSync('price')
-                  })
-              }
-              this.setData({
-                  authHide: !this.data.authHide,
-                  authImg: `http://reader-wx.ai160.com/images/reader/pay/${imgName}.png`
-              }) */
         } else {
             if (this.recorderManager) {
                 this.recorderManager.stop();
@@ -504,40 +502,6 @@ Page({
         this.videoCtx.play();
         this.innerAudioContext.play();
 
-        /* if (this.data.audioPath) {
-            if (this.data.audioPlaying) {
-                // this.ss.stopPlay();
-            }
-            // this.ss.startPlay(this.data.audioPath);
-            this.videoCtx.stop();
-            this.videoCtx.play();
-
-        } else {
-            const recordSource = this.data.recordSource
-            wx.uploadFile({
-                url: 'https://reader-api.efunbox.cn/file/upload',
-                filePath: recordSource,
-                name: '朗读录音',
-                header: {
-                    uid: wx.getStorageSync('uid')
-                },
-                success: (res) => {
-                    const formateRes = JSON.parse(res.data);
-
-                    let audioPath = formateRes.data;
-                    this.setData({
-                        audioPath,
-                        audioPlaying: true
-                    })
-                    // this.ss.startPlay(audioPath);
-                    // this.videoCtx.seek(0);
-                    this.videoCtx.stop();
-                    console.log('播放器归0')
-                    this.videoCtx.play();
-                    console.log('播放器播放')
-                }
-            })
-        } */
     },
 
     exampleVideoPlay: function() {
@@ -588,7 +552,6 @@ Page({
         })
         const recordSource = this.data.recordSource;
         wx.uploadFile({
-            // url: 'https://reader-api.efunbox.cn/file/upload',
             url: 'https://reader-api.efunbox.cn//file/upload',
             filePath: recordSource,
             name: '朗读录音',
@@ -630,7 +593,6 @@ Page({
                                 this.setData({
                                     flowerNum: res.data.count
                                 })
-                                this.flowerAnimationHandler();
                             }
                             const _data = this.data;
                             const scoreData = {
@@ -651,8 +613,8 @@ Page({
                                 // workId: res.data.data.id, // 有id就塞到第一位
                                 fromReading: true
                             }, () => {
-                                wx.navigateBack({
-                                    delta: 1
+                                wx.redirectTo({
+                                    url: '/pages/userWorks/index'
                                 })
                             })
                         }
@@ -839,11 +801,6 @@ Page({
             [likeNumStr]: this.data.videoList[index].likes + 1
         })
     },
-    flowerAnimationHandler: function() {
-        this.flowerBox = this.selectComponent("#flower-toast");
-        console.log('this.flower', this.flowerBox)
-        this.flowerBox.comeOut();
-    },
     // 获取焦点事件
     inputFocus(e) {
         this.setData({

+ 0 - 1
pages/reading/reading.json

@@ -3,7 +3,6 @@
         "VideoSwiper": "../../../component/video-swiper/index",
         "Comment": "../../../component/comment/comment",
         "StatusBar": "../../../component/statusBar/statusBar",
-        "flowerBox": "../../../component/flowerBox/flowerBox",
         "readingTips": "/component/readingTips/index"
 
     },

+ 0 - 1
pages/reading/reading.wxml

@@ -124,4 +124,3 @@
   </view>
 </view> -->
 <readingTips id="readingTips"></readingTips>
-<flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />