|
@@ -107,30 +107,16 @@ Page({
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- // 刷新资源
|
|
|
- if (myIndex == 2) {
|
|
|
- this.setData({
|
|
|
- videoList: [],
|
|
|
- templates: 'courses'
|
|
|
- }, () => {
|
|
|
- this.getCoursesList();
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
/* 关注和我的需要登陆后查看 */
|
|
|
|
|
|
- getOpenidSessionKey((res) => {}, (error) => {
|
|
|
- console.log('获取信息失败', error)
|
|
|
- wx.setStorageSync('userSourseType', 'normal')
|
|
|
- // this.setData({
|
|
|
- // hide: !this.data.hide
|
|
|
- // })
|
|
|
+ if (!this.data.isLogin) {
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/login/login`
|
|
|
});
|
|
|
return;
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
console.log('继续')
|
|
|
// 刷新关注列表
|
|
|
if (myIndex == 1) {
|
|
@@ -142,6 +128,16 @@ Page({
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
+ // 刷新资源
|
|
|
+ if (myIndex == 2) {
|
|
|
+ this.setData({
|
|
|
+ videoList: [],
|
|
|
+ templates: 'courses'
|
|
|
+ }, () => {
|
|
|
+ this.getCoursesList();
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 刷新我的
|
|
|
if (myIndex == 3) {
|
|
|
this.setData({
|
|
@@ -156,9 +152,9 @@ Page({
|
|
|
|
|
|
|
|
|
},
|
|
|
- showPage: function(){
|
|
|
+ showPage: function () {
|
|
|
let options = this.data.options;
|
|
|
- if (options.index) {
|
|
|
+ if (options && options.index) {
|
|
|
this.updateData(options.index)
|
|
|
} else {
|
|
|
this.updateData(0)
|
|
@@ -204,7 +200,7 @@ Page({
|
|
|
let grade = wx.getStorageSync('grade');
|
|
|
|
|
|
let user = wx.getStorageSync('user');
|
|
|
- if(!this.uid || !grade){
|
|
|
+ if (!this.uid || !grade) {
|
|
|
this.setData({
|
|
|
isGradeShow: true,
|
|
|
options
|
|
@@ -213,10 +209,10 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
this.showPage()
|
|
|
- if(this.uid && !user){
|
|
|
+ if (this.uid && !user) {
|
|
|
console.log('游客状态')
|
|
|
}
|
|
|
- if(this.uid && user){
|
|
|
+ if (this.uid && user) {
|
|
|
console.log('登陆状态')
|
|
|
}
|
|
|
wx.getSystemInfo({
|
|
@@ -243,7 +239,16 @@ Page({
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '小学语文朗读配音'
|
|
|
})
|
|
|
-
|
|
|
+ const userInfo = wx.getStorageSync('user')
|
|
|
+ if (userInfo.wechatName) {
|
|
|
+ this.setData({
|
|
|
+ isLogin: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ isLogin: false
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
onHide: function () {
|
|
@@ -488,11 +493,11 @@ Page({
|
|
|
temp.img = item.iconImg;
|
|
|
temp.plays = item.playAmount;
|
|
|
temp.likes = item.likeAmount;
|
|
|
- temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
+ temp.classId = item.exampleId ? item.exampleId : 1605097720036046;
|
|
|
temp.time = formatDate(item.gmtCreated, 3);
|
|
|
temp.avatar = this.data.userInfo.avatar;
|
|
|
temp.uid = this.uid;
|
|
|
- temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
|
|
|
+ temp.url = item.videoPath;
|
|
|
temp.id = item.id;
|
|
|
// temp.avatar = item.user.avatar;
|
|
|
temp.nickName = this.data.userInfo.wechatName;
|
|
@@ -588,7 +593,7 @@ Page({
|
|
|
isGradeShow: false,
|
|
|
})
|
|
|
getOpenidNoLogin((res) => {
|
|
|
- console.log('getOpenidNoLogin',res)
|
|
|
+ console.log('getOpenidNoLogin', res)
|
|
|
// 登录或注册完成 展示页面
|
|
|
this.showPage()
|
|
|
}, (error) => {
|
|
@@ -597,7 +602,7 @@ Page({
|
|
|
this.setData({
|
|
|
hide: !this.data.hide
|
|
|
})
|
|
|
- },grade);
|
|
|
+ }, grade);
|
|
|
},
|
|
|
|
|
|
getFollowData: function () {
|
|
@@ -641,7 +646,12 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
getCoursesList: function () {
|
|
|
- httpRequestApi.getCourses('PRIMARY_FIRST_GRADE', 1, 10).success(res => {
|
|
|
+ const grade = wx.getStorageSync('grade');
|
|
|
+ const data = {
|
|
|
+ grade,
|
|
|
+ type: 'EXAMPLE'
|
|
|
+ }
|
|
|
+ httpRequestApi.getClassRead(data).success(res => {
|
|
|
console.log('资源', res)
|
|
|
this.setData({
|
|
|
coursesData: res.data.data.list
|
|
@@ -652,8 +662,9 @@ Page({
|
|
|
},
|
|
|
goToReading: function (e) {
|
|
|
console.log('去朗读', e)
|
|
|
+ const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
|
|
|
wx.navigateTo({
|
|
|
- url: `../../pages/main/reading/reading?id=${e.detail.activeId}`
|
|
|
+ url: `../../pages/main/reading/reading?id=${id}`
|
|
|
});
|
|
|
},
|
|
|
|