|
@@ -74,7 +74,7 @@ Page({
|
|
|
commentNum: 0,
|
|
|
followPageNo: 1,
|
|
|
followPageSize: 6,
|
|
|
- coursesData:[]
|
|
|
+ coursesData: []
|
|
|
},
|
|
|
jurisdiction: function () {
|
|
|
//隐藏弹框
|
|
@@ -123,9 +123,12 @@ Page({
|
|
|
getOpenidSessionKey((res) => {}, (error) => {
|
|
|
console.log('获取信息失败', error)
|
|
|
wx.setStorageSync('userSourseType', 'normal')
|
|
|
- this.setData({
|
|
|
- hide: !this.data.hide
|
|
|
- })
|
|
|
+ // this.setData({
|
|
|
+ // hide: !this.data.hide
|
|
|
+ // })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `../../pages/login/login`
|
|
|
+ });
|
|
|
return;
|
|
|
});
|
|
|
console.log('继续')
|
|
@@ -153,19 +156,12 @@ Page({
|
|
|
|
|
|
|
|
|
},
|
|
|
- onLoad: function (options) {
|
|
|
- this.uid = wx.getStorageSync('uid');
|
|
|
- wx.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- console.log('系统', res)
|
|
|
- this.setData({
|
|
|
- winH: res.windowHeight,
|
|
|
- devicePixelRatio: res.pixelRatio
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ showPage: function(){
|
|
|
+ let options = this.data.options;
|
|
|
if (options.index) {
|
|
|
this.updateData(options.index)
|
|
|
+ } else {
|
|
|
+ this.updateData(0)
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
if (wx.getStorageSync('uid')) {
|
|
@@ -203,51 +199,51 @@ Page({
|
|
|
}
|
|
|
}, 2800)
|
|
|
},
|
|
|
- onShow: function () {
|
|
|
- wx.setNavigationBarTitle({
|
|
|
- title: '小学语文朗读配音'
|
|
|
- })
|
|
|
- // this.init();
|
|
|
- getOpenidNoLogin((res) => {
|
|
|
- let winH = this.data.winH * this.data.devicePixelRatio;
|
|
|
- // let minusNumber = 860;
|
|
|
- let minusNumber = (winH * 920) / 1206;
|
|
|
-
|
|
|
- // if(winH < 510){
|
|
|
- // minusNumber = 400;
|
|
|
- // }
|
|
|
- // let nextMargin = parseInt(winH *(1 - (834 / winH)) );
|
|
|
- let nextMargin = parseInt(winH - minusNumber);
|
|
|
-
|
|
|
- console.log(123, winH)
|
|
|
- console.log(321, nextMargin)
|
|
|
- this.setData({
|
|
|
- nextMargin: nextMargin + 'rpx'
|
|
|
- })
|
|
|
- app.globalData.nextMargin = nextMargin;
|
|
|
- this.updateData(0)
|
|
|
- // hotInit(this)
|
|
|
- }, (error) => {
|
|
|
- // console.log(error)
|
|
|
+ onLoad: function (options) {
|
|
|
+ this.uid = wx.getStorageSync('uid');
|
|
|
+ let grade = wx.getStorageSync('grade');
|
|
|
|
|
|
- wx.setStorageSync('userSourseType', 'normal')
|
|
|
+ let user = wx.getStorageSync('user');
|
|
|
+ if(!this.uid || !grade){
|
|
|
this.setData({
|
|
|
- hide: !this.data.hide
|
|
|
+ isGradeShow: true,
|
|
|
+ options
|
|
|
})
|
|
|
+ console.log('没有uid 也不是游客,需要去授权')
|
|
|
return;
|
|
|
- });
|
|
|
- if (this.data.myIndex === 0) {
|
|
|
- // 从修改信息页面退回
|
|
|
- // this.getUserWorksInfo(true);
|
|
|
}
|
|
|
- this.setData({
|
|
|
- statusbarobj: {
|
|
|
- isshowbtn: true, //是否显示按钮
|
|
|
- title: "小学语文课文朗读", //标题
|
|
|
- },
|
|
|
- grade: wx.getStorageSync('grade') ? wx.getStorageSync('grade') : '2'
|
|
|
+ this.showPage()
|
|
|
+ if(this.uid && !user){
|
|
|
+ console.log('游客状态')
|
|
|
+ }
|
|
|
+ if(this.uid && user){
|
|
|
+ console.log('登陆状态')
|
|
|
+ }
|
|
|
+ wx.getSystemInfo({
|
|
|
+ success: (res) => {
|
|
|
+ console.log('系统', res)
|
|
|
+
|
|
|
+ let winH = res.windowHeight * res.pixelRatio;
|
|
|
+ let minusNumber = (winH * 920) / 1206;
|
|
|
+ let nextMargin = parseInt(winH - minusNumber);
|
|
|
+ app.globalData.nextMargin = nextMargin;
|
|
|
|
|
|
+ this.setData({
|
|
|
+ winH: winH,
|
|
|
+ devicePixelRatio: res.pixelRatio,
|
|
|
+ nextMargin: nextMargin + 'rpx'
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ onShow: function () {
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
+ title: '小学语文朗读配音'
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
|
|
|
onHide: function () {
|
|
@@ -263,37 +259,37 @@ Page({
|
|
|
uid
|
|
|
).success((res) => {
|
|
|
// 点击切换按钮时 只刷新我的课程和未读消息 官方推荐和热门不加载
|
|
|
- /* const recommendRes = res.data.data;
|
|
|
- console.log(res)
|
|
|
- recommendRes.hotReader.forEach(item => {
|
|
|
- const temp = {};
|
|
|
- temp.title = item.userRead ? item.userRead.title : '';
|
|
|
- temp.img = item.userRead.iconImg;
|
|
|
- temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
|
|
|
- temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
|
|
|
- temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
|
|
|
- temp.classId = item.userRead.lessonId;
|
|
|
- temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
|
- temp.avatar = item.user ? item.user.avatar : '';
|
|
|
- temp.uid = item.user ? item.user.uid : '';
|
|
|
- temp.url = item.userRead.originVideo;
|
|
|
- temp.type = item.userRead.type;
|
|
|
- // temp.avatar = item.user.avatar;
|
|
|
- temp.nickName = item.user ? item.user.wechatName : '';
|
|
|
- temp.id = item.userRead.id;
|
|
|
- temp.isLike = item.isLike;
|
|
|
- temp.isFavorite = item.isFavorites;
|
|
|
- this.data.videoList.push(temp);
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- videoList: this.data.videoList
|
|
|
- }) */
|
|
|
+ /* const recommendRes = res.data.data;
|
|
|
+ console.log(res)
|
|
|
+ recommendRes.hotReader.forEach(item => {
|
|
|
+ const temp = {};
|
|
|
+ temp.title = item.userRead ? item.userRead.title : '';
|
|
|
+ temp.img = item.userRead.iconImg;
|
|
|
+ temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
|
|
|
+ temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
|
|
|
+ temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
|
|
|
+ temp.classId = item.userRead.lessonId;
|
|
|
+ temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
|
+ temp.avatar = item.user ? item.user.avatar : '';
|
|
|
+ temp.uid = item.user ? item.user.uid : '';
|
|
|
+ temp.url = item.userRead.originVideo;
|
|
|
+ temp.type = item.userRead.type;
|
|
|
+ // temp.avatar = item.user.avatar;
|
|
|
+ temp.nickName = item.user ? item.user.wechatName : '';
|
|
|
+ temp.id = item.userRead.id;
|
|
|
+ temp.isLike = item.isLike;
|
|
|
+ temp.isFavorite = item.isFavorites;
|
|
|
+ this.data.videoList.push(temp);
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ videoList: this.data.videoList
|
|
|
+ }) */
|
|
|
this.getHotRecommendSecond(1, 5)
|
|
|
})
|
|
|
},
|
|
|
// 获取热门作品 算法出来的
|
|
|
getHotRecommendSecond: function (pageNo, pageSize) {
|
|
|
- let grade = 'PRIMARY_FIRST_GRADE'
|
|
|
+ let grade = wx.getStorageSync('grade')
|
|
|
httpRequestApi.getHotRecommendSecond(grade, pageNo, pageSize).success(res => {
|
|
|
console.log(res)
|
|
|
const recommendRes = res.data.data.list;
|
|
@@ -307,7 +303,7 @@ Page({
|
|
|
temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
|
|
|
temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
|
|
|
temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
|
|
|
- temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
+ temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
|
temp.avatar = item.user.avatar;
|
|
|
temp.profession = item.user.profession;
|
|
@@ -477,7 +473,7 @@ Page({
|
|
|
// 获取我的朗读
|
|
|
getMyRead: function () {
|
|
|
httpRequestApi.myRead().success(res => {
|
|
|
- console.log(123123,res)
|
|
|
+ console.log(123123, res)
|
|
|
console.log('mydata', this.data.myData)
|
|
|
const myList = res.data.data;
|
|
|
if (myList.length === 0) return;
|
|
@@ -492,7 +488,7 @@ 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.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
temp.time = formatDate(item.gmtCreated, 3);
|
|
|
temp.avatar = this.data.userInfo.avatar;
|
|
|
temp.uid = this.uid;
|
|
@@ -538,7 +534,7 @@ Page({
|
|
|
console.log('reply', res)
|
|
|
const commentList = res.data.data.list;
|
|
|
const commentNum = res.data.data.totalSize;
|
|
|
- console.log('评论数量',commentNum)
|
|
|
+ console.log('评论数量', commentNum)
|
|
|
commentList.forEach((item) => {
|
|
|
const temp = {};
|
|
|
temp.nickName = item.user.wechatName;
|
|
@@ -590,24 +586,18 @@ Page({
|
|
|
wx.setStorageSync('grade', grade)
|
|
|
this.setData({
|
|
|
isGradeShow: false,
|
|
|
- grade: grade
|
|
|
})
|
|
|
-
|
|
|
- let gradeText = '一年级';
|
|
|
- switch (e.target.dataset.code) {
|
|
|
- case '0':
|
|
|
- gradeText = '学前班';
|
|
|
- break;
|
|
|
- case '1':
|
|
|
- gradeText = '一年级';
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- gradeText = '二年级';
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- gradeText = '三年级';
|
|
|
- break;
|
|
|
- }
|
|
|
+ getOpenidNoLogin((res) => {
|
|
|
+ console.log('getOpenidNoLogin',res)
|
|
|
+ // 登录或注册完成 展示页面
|
|
|
+ this.showPage()
|
|
|
+ }, (error) => {
|
|
|
+ console.log('获取失败')
|
|
|
+ wx.setStorageSync('userSourseType', 'normal')
|
|
|
+ this.setData({
|
|
|
+ hide: !this.data.hide
|
|
|
+ })
|
|
|
+ },grade);
|
|
|
},
|
|
|
|
|
|
getFollowData: function () {
|
|
@@ -627,7 +617,7 @@ Page({
|
|
|
temp.img = item.userRead.iconImg;
|
|
|
temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
|
|
|
temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
|
|
|
- temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
+ temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
|
|
|
temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
|
temp.avatar = item.user ? item.user.avatar : '';
|
|
|
temp.uid = item.user ? item.user.uid : '';
|
|
@@ -655,13 +645,13 @@ Page({
|
|
|
console.log('资源', res)
|
|
|
this.setData({
|
|
|
coursesData: res.data.data.list
|
|
|
- },()=>{
|
|
|
+ }, () => {
|
|
|
console.log(this.data.coursesData)
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
goToReading: function (e) {
|
|
|
- console.log('去朗读',e)
|
|
|
+ console.log('去朗读', e)
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/main/reading/reading?id=${e.detail.activeId}`
|
|
|
});
|