|
@@ -52,7 +52,7 @@ Page({
|
|
|
myIndex: 0,
|
|
|
followData: [],
|
|
|
recommendPageNo: 1,
|
|
|
- recommendPageSize: 12,
|
|
|
+ recommendPageSize: 3,
|
|
|
recommendTotalNo: 1,
|
|
|
myData: {},
|
|
|
templates: '',
|
|
@@ -72,7 +72,7 @@ Page({
|
|
|
commentList: [],
|
|
|
commentNum: 0,
|
|
|
followPageNo: 1,
|
|
|
- followPageSize: 6,
|
|
|
+ followPageSize: 3,
|
|
|
coursePageNo: 1,
|
|
|
coursesData: [],
|
|
|
updateId: 0 // 刷新id
|
|
@@ -102,6 +102,7 @@ Page({
|
|
|
// 获取推荐列表
|
|
|
if (myIndex == 0) {
|
|
|
this.setData({
|
|
|
+ recommendPageNo:1,
|
|
|
videoList: [],
|
|
|
isSwiper: true
|
|
|
}, () => {
|
|
@@ -159,6 +160,33 @@ Page({
|
|
|
},
|
|
|
showPage: function () {
|
|
|
let options = this.data.options;
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ httpRequestApi.getClassDetail(id).success(res => {
|
|
|
+ console.log('有一条数据', res)
|
|
|
+ let tempList = [];
|
|
|
+ tempList.push(res.data.data);
|
|
|
+ this.setData({
|
|
|
+ videoList: [],
|
|
|
+ isSwiper: true,
|
|
|
+ recommendTotalNo: 1
|
|
|
+ }, () => {
|
|
|
+ this.formatWorksList(tempList, true);
|
|
|
+ this.getHotRecommend();
|
|
|
+ // return;
|
|
|
+ })
|
|
|
+ // this.showPage()
|
|
|
+ })
|
|
|
+ }
|
|
|
if (options && options.index) {
|
|
|
this.updateData(options.index)
|
|
|
} else {
|
|
@@ -202,6 +230,17 @@ Page({
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
console.log('onload', options);
|
|
|
+ if (options.scene) {
|
|
|
+ this.setData({
|
|
|
+ workId: options.scene
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (options.readId) {
|
|
|
+ this.setData({
|
|
|
+ workId: options.readId
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
getOpenidNoLogin((res) => {
|
|
|
console.log('getOpenidNoLogin', res)
|
|
|
if (!res.data.data.grade) {
|
|
@@ -237,16 +276,7 @@ Page({
|
|
|
});
|
|
|
|
|
|
|
|
|
- if (options.scene) {
|
|
|
- this.setData({
|
|
|
- workId: options.scene
|
|
|
- })
|
|
|
- }
|
|
|
- if (options.readId) {
|
|
|
- this.setData({
|
|
|
- workId: options.readId
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
this.uid = wx.getStorageSync('uid');
|
|
|
let grade = wx.getStorageSync('grade');
|
|
|
|
|
@@ -262,8 +292,16 @@ Page({
|
|
|
success: (res) => {
|
|
|
console.log('系统', res)
|
|
|
|
|
|
- let winH = res.windowHeight * res.pixelRatio;
|
|
|
- let minusNumber = (winH * 920) / 1206;
|
|
|
+ console.log('nextMargin', res.pixelRatio)
|
|
|
+ console.log('windowHeight', res.windowHeight)
|
|
|
+ console.log('windowWidth', res.windowWidth)
|
|
|
+ // let ratio = res.pixelRatio;
|
|
|
+ let ratio = (res.screenHeight / res.screenWidth) * 1.1;
|
|
|
+ console.log('比例系数', ratio)
|
|
|
+ let winH = res.windowHeight * ratio;
|
|
|
+ let x1 = 465 * ratio;
|
|
|
+ let x2 = 603 * ratio;
|
|
|
+ let minusNumber = (winH * x1) / x2;
|
|
|
let nextMargin = parseInt(winH - minusNumber);
|
|
|
app.globalData.nextMargin = nextMargin;
|
|
|
|
|
@@ -279,34 +317,6 @@ Page({
|
|
|
|
|
|
},
|
|
|
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
|
|
|
- })
|
|
|
- httpRequestApi.getClassDetail(id).success(res => {
|
|
|
- console.log('有一条数据', res)
|
|
|
- let tempList = [];
|
|
|
- tempList.push(res.data.data);
|
|
|
- this.setData({
|
|
|
- videoList: [],
|
|
|
- isSwiper: true,
|
|
|
- recommendTotalNo: 1
|
|
|
- }, () => {
|
|
|
- this.formatWorksList(tempList, true);
|
|
|
- this.getHotRecommend()
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- // this.showPage()
|
|
|
- })
|
|
|
- }
|
|
|
if (this.data.myIndex === 3) {
|
|
|
this.getUserWorksInfo(1)
|
|
|
}
|
|
@@ -316,7 +326,6 @@ Page({
|
|
|
console.log('页面返回页面返回', this.data.fromLoginIndex)
|
|
|
if (this.data.fromLoginIndex) {
|
|
|
console.log('页面返回页面返回', this.data.fromLoginIndex)
|
|
|
-
|
|
|
let index = this.data.fromLoginIndex;
|
|
|
let userInfo = wx.getStorageSync('user');
|
|
|
this.setData({
|
|
@@ -324,7 +333,6 @@ Page({
|
|
|
isLogin: userInfo.wechatName ? true : false
|
|
|
}, () => {
|
|
|
this.updateData(0)
|
|
|
-
|
|
|
})
|
|
|
}
|
|
|
// const userInfo = wx.getStorageSync('user')
|
|
@@ -365,9 +373,9 @@ Page({
|
|
|
// 组装list
|
|
|
formatWorksList(list, notSet) {
|
|
|
const tempList = [];
|
|
|
- list.forEach((item,index) => {
|
|
|
- if(index === 1){
|
|
|
- console.log('设置当前id',item.id)
|
|
|
+ list.forEach((item, index) => {
|
|
|
+ if (index === list.length - 2 && list.length > 2) {
|
|
|
+ console.log('设置当前id', item.id)
|
|
|
this.setData({
|
|
|
updateId: item.userRead.id
|
|
|
})
|
|
@@ -390,14 +398,18 @@ Page({
|
|
|
temp.nickName = item.user.wechatName;
|
|
|
temp.isLike = item.isLike;
|
|
|
temp.isFavorite = item.isFavorites;
|
|
|
- // this.data.videoList.push(temp);
|
|
|
+ temp.isEfun = item.user.profession === '官方' ? true : false;
|
|
|
+ temp.hasTag = item.userRead.tag && item.userRead.tag !== 'EXAMPLE' ? true : false;
|
|
|
+ temp.tagUrl = item.userRead.tag ? item.userRead.tag === 'HOT' ? '../../static/index/hot_tag.png' : '../../static/index/new_tag.png' : ''
|
|
|
+ this.data.videoList.push(temp);
|
|
|
tempList.push(temp);
|
|
|
});
|
|
|
- if (!notSet) {
|
|
|
- this.setData({
|
|
|
- videoList: tempList
|
|
|
- })
|
|
|
- }
|
|
|
+ console.log('当前list', this.data.videoList)
|
|
|
+ // if (!notSet) {
|
|
|
+ this.setData({
|
|
|
+ videoList: tempList
|
|
|
+ })
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
|
// 获取用户信息
|
|
@@ -451,13 +463,6 @@ Page({
|
|
|
return userInfo;
|
|
|
},
|
|
|
videoChange: function (e) {
|
|
|
- console.log('到了底部到了底部', e)
|
|
|
- console.log('到了底部到了底部', e.detail.index)
|
|
|
- console.log('到了底部到了底部', e.detail._last)
|
|
|
- console.log('到了底部到了底部', e.detail.direction)
|
|
|
- // if (e.detail.nextQueue.length === 1) {
|
|
|
- console.log('当前ID',e.detail.activeId);
|
|
|
- console.log('目标ID',this.data.updateId);
|
|
|
if (e.detail.activeId === this.data.updateId) {
|
|
|
console.log('应该刷新')
|
|
|
if (this.data.myIndex === 1) {
|