|
@@ -1,7 +1,9 @@
|
|
|
//index.js
|
|
|
//获取应用实例
|
|
|
// 获取授权登录
|
|
|
-
|
|
|
+import {
|
|
|
+ actionRecord
|
|
|
+} from '~/api/global'
|
|
|
import {
|
|
|
getOpenidSessionKey
|
|
|
} from '../../utils/httpUtil';
|
|
@@ -91,12 +93,12 @@ Page({
|
|
|
isIos: null,
|
|
|
temporaryGrade: null
|
|
|
},
|
|
|
- jurisdiction: function() {
|
|
|
+ jurisdiction: function () {
|
|
|
//隐藏弹框
|
|
|
this.setData({
|
|
|
- hide: !this.data.hide
|
|
|
- })
|
|
|
- //登录页信息
|
|
|
+ hide: !this.data.hide
|
|
|
+ })
|
|
|
+ //登录页信息
|
|
|
this.updateData(0)
|
|
|
},
|
|
|
// 隐藏升级弹窗
|
|
@@ -111,14 +113,14 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
//tab点击
|
|
|
- switcher: function({
|
|
|
+ switcher: function ({
|
|
|
currentTarget
|
|
|
}) {
|
|
|
if (currentTarget.dataset.index === this.data.myIndex) return;
|
|
|
this.updateData(currentTarget.dataset.index);
|
|
|
},
|
|
|
// 根据index 更新template
|
|
|
- updateData: function(index) {
|
|
|
+ updateData: function (index) {
|
|
|
let myIndex = parseInt(index);
|
|
|
this.setData({
|
|
|
myIndex,
|
|
@@ -182,7 +184,7 @@ Page({
|
|
|
return;
|
|
|
} */
|
|
|
},
|
|
|
- showPage: function() {
|
|
|
+ showPage: function () {
|
|
|
let options = this.data.options;
|
|
|
if (this.data.workId) {
|
|
|
// 需要在推荐第一个上插入一条分享或者刚朗读完数据
|
|
@@ -254,7 +256,7 @@ Page({
|
|
|
}
|
|
|
}, 2800)
|
|
|
},
|
|
|
- onLoad: function(options) {
|
|
|
+ onLoad: function (options) {
|
|
|
if (wx.getStorageSync('uid')) {
|
|
|
this.setData({
|
|
|
isLogin: true
|
|
@@ -265,17 +267,17 @@ Page({
|
|
|
/**获取权限和订单信息 */
|
|
|
// 获取商品信息
|
|
|
httpRequestApi.getProductActivity().success(res => {
|
|
|
- wx.setStorageSync('price', res.data.data.price / 100)
|
|
|
- wx.setStorageSync('productId', res.data.data.id)
|
|
|
- if (options.type && options.type === 'iphone') {
|
|
|
- this.setData({
|
|
|
- payPrice: res.data.data.price / 100
|
|
|
- })
|
|
|
- }
|
|
|
- }).fail(error => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
- // 获取用户权限
|
|
|
+ wx.setStorageSync('price', res.data.data.price / 100)
|
|
|
+ wx.setStorageSync('productId', res.data.data.id)
|
|
|
+ if (options.type && options.type === 'iphone') {
|
|
|
+ this.setData({
|
|
|
+ payPrice: res.data.data.price / 100
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).fail(error => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ // 获取用户权限
|
|
|
this.getHelpAuth()
|
|
|
if (!res.data.data.grade) {
|
|
|
this.setData({
|
|
@@ -294,17 +296,17 @@ Page({
|
|
|
}
|
|
|
// 获取商品信息
|
|
|
httpRequestApi.getProductActivity().success(res => {
|
|
|
- wx.setStorageSync('price', res.data.data.price / 100)
|
|
|
- wx.setStorageSync('productId', res.data.data.id)
|
|
|
- if (options.type && options.type === 'iphone') {
|
|
|
- this.setData({
|
|
|
- payPrice: res.data.data.price / 100
|
|
|
- })
|
|
|
- }
|
|
|
- }).fail(error => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
- // 获取用户权限
|
|
|
+ wx.setStorageSync('price', res.data.data.price / 100)
|
|
|
+ wx.setStorageSync('productId', res.data.data.id)
|
|
|
+ if (options.type && options.type === 'iphone') {
|
|
|
+ this.setData({
|
|
|
+ payPrice: res.data.data.price / 100
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).fail(error => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ // 获取用户权限
|
|
|
this.getHelpAuth()
|
|
|
}
|
|
|
this.setData({
|
|
@@ -399,7 +401,7 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onShow: function() {
|
|
|
+ onShow: function () {
|
|
|
let grade = wx.getStorageSync('grade');
|
|
|
this.setData({
|
|
|
gradeActivity: grade
|
|
@@ -439,7 +441,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- onHide: function() {
|
|
|
+ onHide: function () {
|
|
|
const str = 'hotData.inputFocus'
|
|
|
this.setData({
|
|
|
[str]: false
|
|
@@ -448,7 +450,7 @@ Page({
|
|
|
/* 两个接口维护同一个数组,手动的结束后添加算法的 */
|
|
|
// 推荐页信息 获取消息和手动推荐内容
|
|
|
// 获取热门作品 算法出来的
|
|
|
- getHotRecommend: function() {
|
|
|
+ getHotRecommend: function () {
|
|
|
let grade = wx.getStorageSync('grade')
|
|
|
let pageNo = this.data.recommendPageNo;
|
|
|
let pageSize = this.data.recommendPageSize;
|
|
@@ -518,15 +520,15 @@ Page({
|
|
|
// tempList.push(temp);
|
|
|
});
|
|
|
console.log('当前list', this.data.videoList)
|
|
|
- // if (!notSet) {
|
|
|
+ // if (!notSet) {
|
|
|
this.setData({
|
|
|
- videoList: this.data.videoList
|
|
|
- })
|
|
|
- // }
|
|
|
+ videoList: this.data.videoList
|
|
|
+ })
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
|
// 获取用户信息
|
|
|
- getUserWorksInfo: function(flag) {
|
|
|
+ getUserWorksInfo: function (flag) {
|
|
|
if (flag) {
|
|
|
httpRequestApi.getUserWorksInfo().success(res => {
|
|
|
const userInfo = this.formatGrade(res.data.data.user);
|
|
@@ -580,7 +582,7 @@ Page({
|
|
|
}
|
|
|
return userInfo;
|
|
|
},
|
|
|
- videoChange: function(e) {
|
|
|
+ videoChange: function (e) {
|
|
|
if (e.detail.activeId === this.data.updateId) {
|
|
|
console.log('应该刷新')
|
|
|
if (this.data.myIndex === 1) {
|
|
@@ -603,7 +605,7 @@ Page({
|
|
|
|
|
|
},
|
|
|
// 触底加载
|
|
|
- onReachBottom: function() {
|
|
|
+ onReachBottom: function () {
|
|
|
if (this.data.myIndex === 2) {
|
|
|
this.setData({
|
|
|
coursePageNo: this.data.coursePageNo + 1
|
|
@@ -627,17 +629,17 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onPullDownRefresh: function() {
|
|
|
+ onPullDownRefresh: function () {
|
|
|
//当前在团购页下拉加载
|
|
|
this.updateData(this.data.myIndex)
|
|
|
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|
|
- //模拟加载
|
|
|
- setTimeout(function() {
|
|
|
+ //模拟加载
|
|
|
+ setTimeout(function () {
|
|
|
wx.hideNavigationBarLoading() //完成停止加载
|
|
|
wx.stopPullDownRefresh() //停止下拉刷新
|
|
|
}, 1000);
|
|
|
},
|
|
|
- goToMessage: function() {
|
|
|
+ goToMessage: function () {
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/social/insideMessage/insideMessage`
|
|
|
});
|
|
@@ -647,10 +649,10 @@ Page({
|
|
|
[str]: 0
|
|
|
})
|
|
|
},
|
|
|
- goToService: function() {
|
|
|
+ goToService: function () {
|
|
|
httpRequestApi.userEvent('SERVICE');
|
|
|
},
|
|
|
- toMyCollage: function(e) {
|
|
|
+ toMyCollage: function (e) {
|
|
|
if (app.globalData.isIOS) {
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/groupPage/my-group/my-group?title=我的助力`
|
|
@@ -662,19 +664,19 @@ Page({
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- toMyCourse: function() {
|
|
|
+ toMyCourse: function () {
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/user/mycourse/mycourse?title=我的课程`
|
|
|
});
|
|
|
},
|
|
|
- goToFlower: function() {
|
|
|
+ goToFlower: function () {
|
|
|
wx.navigateTo({
|
|
|
url: `../../pages/social/littleFlower/littleFlower`
|
|
|
});
|
|
|
httpRequestApi.userEvent('INTEGRAL');
|
|
|
|
|
|
},
|
|
|
- signInBtn: function(e) {
|
|
|
+ signInBtn: function (e) {
|
|
|
this.setData({
|
|
|
indexSignDialog: false
|
|
|
})
|
|
@@ -684,13 +686,13 @@ Page({
|
|
|
})
|
|
|
this.goToFlower();
|
|
|
},
|
|
|
- missionBtn: function() {
|
|
|
+ missionBtn: function () {
|
|
|
this.setData({
|
|
|
indexMissionDialog: false
|
|
|
})
|
|
|
this.goToFlower();
|
|
|
},
|
|
|
- getUserAuth: function() {
|
|
|
+ getUserAuth: function () {
|
|
|
httpRequestApi.getUserAuth().success(res => {
|
|
|
console.log(res)
|
|
|
const str = 'myData.isVIP'
|
|
@@ -705,11 +707,11 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- delHideMyWork: function() {
|
|
|
+ delHideMyWork: function () {
|
|
|
this.getMyRead()
|
|
|
},
|
|
|
// 获取我的朗读
|
|
|
- getMyRead: function() {
|
|
|
+ getMyRead: function () {
|
|
|
httpRequestApi.myRead().success(res => {
|
|
|
console.log(123123, res)
|
|
|
console.log('mydata', this.data.myData)
|
|
@@ -766,7 +768,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
// 评论区点击
|
|
|
- commentTap: function(e) {
|
|
|
+ commentTap: function (e) {
|
|
|
console.log('点击评论区', e)
|
|
|
if (e.target.dataset.type === 'blank') {
|
|
|
if (this.data.commentShow && this.data.commentId) {
|
|
@@ -782,11 +784,11 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- touchMove: function(e) {
|
|
|
+ touchMove: function (e) {
|
|
|
return
|
|
|
},
|
|
|
// 打开评论
|
|
|
- openComment: function(e) {
|
|
|
+ openComment: function (e) {
|
|
|
//
|
|
|
console.log('id', e.detail.activeId)
|
|
|
console.log('id', e)
|
|
@@ -794,17 +796,17 @@ Page({
|
|
|
commentShow: !this.data.commentShow,
|
|
|
commentId: e.detail.activeId,
|
|
|
commentIndex: e.detail.activeIndex
|
|
|
- // commentList: []
|
|
|
+ // commentList: []
|
|
|
});
|
|
|
// this.getReply(e.detail.activeId);
|
|
|
},
|
|
|
// 获取评论信息
|
|
|
- getReply: function(columnId) {
|
|
|
+ getReply: function (columnId) {
|
|
|
debugger
|
|
|
// let columnId = this.data.id;
|
|
|
console.log(123123123, columnId)
|
|
|
- // let pageNo = this.data.pageNo;
|
|
|
- // let pageSize = this.data.pageSize;
|
|
|
+ // let pageNo = this.data.pageNo;
|
|
|
+ // let pageSize = this.data.pageSize;
|
|
|
httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
|
|
|
console.log('reply', res)
|
|
|
const commentList = res.data.data.list;
|
|
@@ -831,7 +833,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
// 发布回复
|
|
|
- sendReply: function(e) {
|
|
|
+ sendReply: function (e) {
|
|
|
console.log('triger', e.detail.content);
|
|
|
let data = {
|
|
|
columnId: this.data.commentId,
|
|
@@ -849,13 +851,13 @@ Page({
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- gradeTap: function() {
|
|
|
+ gradeTap: function () {
|
|
|
// console.log("组件回调,返回上一页");
|
|
|
this.setData({
|
|
|
isGradeShow: true
|
|
|
})
|
|
|
},
|
|
|
- onShareAppMessage: function(res) {
|
|
|
+ onShareAppMessage: function (res) {
|
|
|
if (res.from === 'button') {
|
|
|
return {
|
|
|
title: '请欣赏我的课文朗读作品,点赞+评论。',
|
|
@@ -869,15 +871,15 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- openShare: function(e) {
|
|
|
+ openShare: function (e) {
|
|
|
console.log('点击分享', e)
|
|
|
- /* this.setData({
|
|
|
- shareTitle: e.detail.currentTarget.dataset.title,
|
|
|
- shareId: e.detail.currentTarget.dataset.id,
|
|
|
- shareImg: e.detail.currentTarget.dataset.shareimg,
|
|
|
- goToShare: true,
|
|
|
- ifTapActivity: e.detail.currentTarget.dataset.activity
|
|
|
- }) */
|
|
|
+ /* this.setData({
|
|
|
+ shareTitle: e.detail.currentTarget.dataset.title,
|
|
|
+ shareId: e.detail.currentTarget.dataset.id,
|
|
|
+ shareImg: e.detail.currentTarget.dataset.shareimg,
|
|
|
+ goToShare: true,
|
|
|
+ ifTapActivity: e.detail.currentTarget.dataset.activity
|
|
|
+ }) */
|
|
|
},
|
|
|
// 选择年纪
|
|
|
selectGrade({
|
|
@@ -893,7 +895,7 @@ Page({
|
|
|
console.log(code);
|
|
|
},
|
|
|
// 修改年级
|
|
|
- changeGrade: function(e) {
|
|
|
+ changeGrade: function (e) {
|
|
|
const grade = this.data.temporaryGrade
|
|
|
if (!grade) {
|
|
|
return wx.showToast({
|
|
@@ -917,7 +919,7 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
- getFollowData: function() {
|
|
|
+ getFollowData: function () {
|
|
|
httpRequestApi.getFollowWorks(this.data.followPageNo, this.data.followPageSize).success(res => {
|
|
|
if (res.data.data.totalSize === 0) {
|
|
|
this.setData({
|
|
@@ -940,7 +942,7 @@ Page({
|
|
|
httpRequestApi.userEvent('SUBSCRIBE');
|
|
|
},
|
|
|
// 点击用户头像区域
|
|
|
- headTapHandler: function(e) {
|
|
|
+ headTapHandler: function (e) {
|
|
|
console.log('点击头像', e)
|
|
|
let tapId = e.detail.activeId;
|
|
|
// 点击头像既关注 测试
|
|
@@ -948,7 +950,7 @@ Page({
|
|
|
console.log(res)
|
|
|
})
|
|
|
},
|
|
|
- getCoursesList: function() {
|
|
|
+ getCoursesList: function () {
|
|
|
const grade = wx.getStorageSync('grade');
|
|
|
const data = {
|
|
|
pageNo: this.data.coursePageNo,
|
|
@@ -968,7 +970,7 @@ Page({
|
|
|
})
|
|
|
httpRequestApi.userEvent('RESOURCES');
|
|
|
},
|
|
|
- goToReading: function(e) {
|
|
|
+ goToReading: function (e) {
|
|
|
console.log('去朗读', e)
|
|
|
const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
|
|
|
const index = e.currentTarget.dataset.index;
|
|
@@ -1029,16 +1031,16 @@ Page({
|
|
|
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
|
|
|
- // tip: this.data.tip,
|
|
|
- }
|
|
|
- // console.log(data)
|
|
|
+ avatar: obj.avatar,
|
|
|
+ author: obj.author,
|
|
|
+ iconImg: obj.iconImg,
|
|
|
+ title: obj.title,
|
|
|
+ path: `pages/index/index`,
|
|
|
+ scene: obj.id,
|
|
|
+ productId: 1
|
|
|
+ // tip: this.data.tip,
|
|
|
+ }
|
|
|
+ // console.log(data)
|
|
|
this.setData({
|
|
|
noScroll: 'noScroll',
|
|
|
shareTitle: obj.title,
|
|
@@ -1048,7 +1050,7 @@ Page({
|
|
|
this.shareDialog.share(data);
|
|
|
}
|
|
|
},
|
|
|
- collectTap: function(e) {
|
|
|
+ collectTap: function (e) {
|
|
|
const index = e.detail.index;
|
|
|
let str = `videoList[${index}].isFavorite`;
|
|
|
let str2 = `videoList[${index}].favoritesAmount`;
|
|
@@ -1058,7 +1060,7 @@ Page({
|
|
|
[str2]: favoritesAmount
|
|
|
})
|
|
|
},
|
|
|
- likeTap: function(e) {
|
|
|
+ likeTap: function (e) {
|
|
|
console.log('点赞', e)
|
|
|
const index = e.detail.index;
|
|
|
let likeStr = `videoList[${index}].isLike`;
|
|
@@ -1068,7 +1070,7 @@ Page({
|
|
|
[likeNumStr]: this.data.videoList[index].likes + 1
|
|
|
})
|
|
|
},
|
|
|
- addShareAmount: function(e) {
|
|
|
+ addShareAmount: function (e) {
|
|
|
let str = `videoList[${e.detail.index}].shareAmount`;
|
|
|
this.setData({
|
|
|
[str]: this.data.videoList[e.detail.index].shareAmount + 1
|
|
@@ -1079,16 +1081,20 @@ Page({
|
|
|
*/
|
|
|
goToActivity() {
|
|
|
httpRequestApi.postActEvent('BANNER').success(res => {
|
|
|
- console.log('活动banner', res)
|
|
|
- })
|
|
|
- // wx.navigateTo({
|
|
|
- // url: `../activity/index/index`
|
|
|
- // // url: `../activity/rule/rule`
|
|
|
- // });
|
|
|
+ console.log('活动banner', res)
|
|
|
+ })
|
|
|
wx.navigateTo({
|
|
|
url: `../activity/goodList/goodList`
|
|
|
});
|
|
|
},
|
|
|
+ async goToCard() {
|
|
|
+ await actionRecord({
|
|
|
+ action: 'NEW_YEAR_ACTIVITY_BANNER'
|
|
|
+ })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/activityList/index',
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* banner点击
|
|
|
*/
|
|
@@ -1319,20 +1325,20 @@ Page({
|
|
|
sc.onload = () => {
|
|
|
ctx.drawImage(sc, 12, 220, 20, 20)
|
|
|
ctx.fillText('收藏', 36, 238)
|
|
|
- //分享
|
|
|
+ //分享
|
|
|
let fx = canvas.createImage();
|
|
|
fx.src = '/static/index/share.png'
|
|
|
fx.onload = () => {
|
|
|
ctx.drawImage(fx, 78, 220, 22, 22)
|
|
|
ctx.fillText('分享', 104, 238)
|
|
|
- //点赞
|
|
|
+ //点赞
|
|
|
let dz = canvas.createImage();
|
|
|
dz.src = video.isLike ? '/static/index/heart_colored.png' : '/static/index/heart.png'
|
|
|
|
|
|
dz.onload = () => {
|
|
|
ctx.drawImage(dz, 258, 222, 22, 22)
|
|
|
ctx.fillText(video.likes, 284, 238)
|
|
|
- //评论
|
|
|
+ //评论
|
|
|
let pl = canvas.createImage();
|
|
|
pl.src = '/static/index/comment.png'
|
|
|
pl.onload = () => {
|
|
@@ -1362,7 +1368,7 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- onShareTimeline: function() {
|
|
|
+ onShareTimeline: function () {
|
|
|
return {
|
|
|
title: '终于找到适合孩子的朗读神器了!动画配音,边玩边学!',
|
|
|
query: `uid=${wx.getStorageSync('uid')}`,
|