|
@@ -113,7 +113,7 @@ Page({
|
|
|
|
|
|
if (!this.data.isLogin) {
|
|
|
wx.navigateTo({
|
|
|
- url: `../../pages/login/login`
|
|
|
+ url: `../../pages/login/login?index=${myIndex}`
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -200,25 +200,37 @@ Page({
|
|
|
}, 2800)
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
- this.uid = wx.getStorageSync('uid');
|
|
|
- let grade = wx.getStorageSync('grade');
|
|
|
+ getOpenidNoLogin((res) => {
|
|
|
+ console.log('getOpenidNoLogin', res)
|
|
|
+ if (!res.data.data.grade) {
|
|
|
+ this.setData({
|
|
|
+ isGradeShow: true,
|
|
|
+ options
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }, (error) => {
|
|
|
+ console.log('获取失败', error)
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
- let user = wx.getStorageSync('user');
|
|
|
- if (!this.uid || !grade) {
|
|
|
+ if (options.scene) {
|
|
|
this.setData({
|
|
|
- isGradeShow: true,
|
|
|
- options
|
|
|
+ workId: options.scene
|
|
|
})
|
|
|
- console.log('没有uid 也不是游客,需要去授权')
|
|
|
- return;
|
|
|
- }
|
|
|
- this.showPage()
|
|
|
- if (this.uid && !user) {
|
|
|
- console.log('游客状态')
|
|
|
- }
|
|
|
- if (this.uid && user) {
|
|
|
- console.log('登陆状态')
|
|
|
}
|
|
|
+ this.uid = wx.getStorageSync('uid');
|
|
|
+ let grade = wx.getStorageSync('grade');
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.showPage();
|
|
|
wx.getSystemInfo({
|
|
|
success: (res) => {
|
|
|
console.log('系统', res)
|
|
@@ -239,32 +251,52 @@ Page({
|
|
|
});
|
|
|
|
|
|
},
|
|
|
- onShow: function (e) {
|
|
|
+ onShow: function () {
|
|
|
console.log('this.data.workId', this.data.workId)
|
|
|
if (this.data.workId) {
|
|
|
|
|
|
+ let id = this.data.workId;
|
|
|
this.setData({
|
|
|
+ workId: null,
|
|
|
myIndex: 0,
|
|
|
videoList: [],
|
|
|
isSwiper: true,
|
|
|
- recommendTotalNo:1
|
|
|
+ recommendTotalNo: 1
|
|
|
})
|
|
|
- httpRequestApi.getClassDetail(this.data.workId).success(res => {
|
|
|
+ httpRequestApi.getClassDetail(id).success(res => {
|
|
|
console.log('有一条数据', res)
|
|
|
let tempList = [];
|
|
|
tempList.push(res.data.data);
|
|
|
- this.formatWorksList(tempList, true);
|
|
|
- this.getHotRecommend()
|
|
|
+ this.setData({
|
|
|
+ videoList: [],
|
|
|
+ isSwiper: true,
|
|
|
+ recommendTotalNo: 1
|
|
|
+ }, () => {
|
|
|
+ this.formatWorksList(tempList, true);
|
|
|
+ this.getHotRecommend()
|
|
|
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
- console.log('页面显示', e)
|
|
|
if (this.data.myIndex === 3) {
|
|
|
this.getUserWorksInfo(1)
|
|
|
}
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '小学语文朗读配音'
|
|
|
})
|
|
|
+ console.log('页面返回页面返回', this.data.fromLoginIndex)
|
|
|
+ if (this.data.fromLoginIndex) {
|
|
|
+ console.log('页面返回页面返回', this.data.fromLoginIndex)
|
|
|
+ let index = this.data.fromLoginIndex;
|
|
|
+ this.setData({
|
|
|
+ fromLoginIndex: null
|
|
|
+ }, () => {
|
|
|
+ this.updateData(0)
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
const userInfo = wx.getStorageSync('user')
|
|
|
if (userInfo.wechatName) {
|
|
|
this.setData({
|
|
@@ -502,7 +534,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- delHideMyWork:function(){
|
|
|
+ delHideMyWork: function () {
|
|
|
this.getMyRead()
|
|
|
},
|
|
|
|
|
@@ -533,7 +565,7 @@ Page({
|
|
|
temp.status = item.status
|
|
|
myWorks.push(temp);
|
|
|
});
|
|
|
- console.log('myWorks',myWorks)
|
|
|
+ console.log('myWorks', myWorks)
|
|
|
this.setData({
|
|
|
videoList: myWorks
|
|
|
})
|
|
@@ -548,6 +580,9 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ touchMove: function (e) {
|
|
|
+ return
|
|
|
+ },
|
|
|
|
|
|
openComment: function (e) {
|
|
|
|
|
@@ -684,5 +719,42 @@ Page({
|
|
|
url: `../../pages/reading/reading?id=${id}`
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ courseCollectTap: function collectClass(e) {
|
|
|
+ console.log('收藏按钮', e);
|
|
|
+ const data = {
|
|
|
+ targetCode: e.target.dataset.id ? e.target.dataset.id : e.currentTarget.dataset.id,
|
|
|
+ favoritesType: e.target.dataset.type ? e.target.dataset.type : e.currentTarget.dataset.type
|
|
|
+ }
|
|
|
+ const index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
|
|
|
+ let str = `coursesData[${index}].isFavorites`
|
|
|
+ httpRequestApi.collectClass(data).success((res) => {
|
|
|
+ console.log('this.data.coursesData[index]', this.data.coursesData[index])
|
|
|
+ this.setData({
|
|
|
+ [str]: !this.data.coursesData[index].isFavorites
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ coursesOpenShare: function coursesOpenShare(e){
|
|
|
+ const obj = e.currentTarget.dataset
|
|
|
+ console.log('分享', obj)
|
|
|
+ console.log('分享', e)
|
|
|
+ if (1) {
|
|
|
+ this.shareDialog = this.selectComponent("#share-dialog");
|
|
|
+ const data = {
|
|
|
+ avatar: obj.avatar,
|
|
|
+ author: obj.author,
|
|
|
+ iconImg: obj.iconImg,
|
|
|
+ title: obj.title,
|
|
|
+ path: `pages/index/index`,
|
|
|
+ scene: obj.id,
|
|
|
+ productId: 1
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ noScroll: 'noScroll'
|
|
|
+ })
|
|
|
+ this.shareDialog.share(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|