|
@@ -9,11 +9,7 @@ Page({
|
|
|
data: {
|
|
data: {
|
|
|
appAssetsUrl: App.appAssetsUrl,
|
|
appAssetsUrl: App.appAssetsUrl,
|
|
|
appAssetsUrl2: App.appAssetsUrl2,
|
|
appAssetsUrl2: App.appAssetsUrl2,
|
|
|
- userInfo: {
|
|
|
|
|
- avatar: 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLt5DDw9rFVYB2D8bYlMOVqVTdJ2y7WRzVBJy5s3ib5K8nIHQ8iaJrGvEJmjwP3QrhEEHgPnIiccRJvA/132',
|
|
|
|
|
- nickname: '刘微雪',
|
|
|
|
|
- points: 2000
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ userInfo: {},
|
|
|
currentDate: new Date(),
|
|
currentDate: new Date(),
|
|
|
currentYear: new Date().getFullYear(),
|
|
currentYear: new Date().getFullYear(),
|
|
|
currentMonth: new Date().getMonth() + 1,
|
|
currentMonth: new Date().getMonth() + 1,
|
|
@@ -22,103 +18,69 @@ Page({
|
|
|
isCheckedToday: false, // 今天是否已签到
|
|
isCheckedToday: false, // 今天是否已签到
|
|
|
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
|
|
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
|
|
|
calendarDays: [],
|
|
calendarDays: [],
|
|
|
- tasks: [
|
|
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- icon: '/assets/images/user-icon/user1.png',
|
|
|
|
|
- title: '邀请好友',
|
|
|
|
|
- desc: '邀请成功可获得积分奖励',
|
|
|
|
|
- status: '去完成'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 2,
|
|
|
|
|
- icon: '/assets/images/user-icon/user2.png',
|
|
|
|
|
- title: '观看广告',
|
|
|
|
|
- desc: '观看广告可获得积分奖励',
|
|
|
|
|
- count: '(0/3)',
|
|
|
|
|
- status: '去完成'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 3,
|
|
|
|
|
- icon: '/assets/images/user-icon/user3.png',
|
|
|
|
|
- title: '参与课程',
|
|
|
|
|
- desc: '邀请成功可获得积分奖励',
|
|
|
|
|
- status: '去完成'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 4,
|
|
|
|
|
- icon: '/assets/images/user-icon/user4.png',
|
|
|
|
|
- title: '邀请好友',
|
|
|
|
|
- desc: '邀请成功可获得积分奖励',
|
|
|
|
|
- status: '去完成'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
|
|
- */
|
|
|
|
|
- onLoad: function (options) {
|
|
|
|
|
- wx.setNavigationBarTitle({
|
|
|
|
|
- title: '每日签到'
|
|
|
|
|
- });
|
|
|
|
|
- // this.loadCheckinHistory();
|
|
|
|
|
- // this.initCalendar();
|
|
|
|
|
- this.getUserInfo();
|
|
|
|
|
- // this.getCheckDate();
|
|
|
|
|
|
|
+ tasks: [],
|
|
|
|
|
+ totalScore: 0
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
|
|
- */
|
|
|
|
|
- onShow: function () {
|
|
|
|
|
- // 页面显示时重新加载签到状态
|
|
|
|
|
- this.loadCheckinHistory();
|
|
|
|
|
- this.initCalendar();
|
|
|
|
|
|
|
+ loadList() {
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: '努力加载中...',
|
|
|
|
|
+ })
|
|
|
|
|
+ App._post_form('scoreTask/list', '', {
|
|
|
|
|
+ stuId: util.getUserId()
|
|
|
|
|
+ },
|
|
|
|
|
+ function (res) {
|
|
|
|
|
+ if (res.code == 0 && res.data) {
|
|
|
|
|
+ // console.log(res);
|
|
|
|
|
+ let list = res.data.dayTask ? [...res.data.dayTask] : [];
|
|
|
|
|
+ let list1 = res.data.infiniteTask ? [...res.data.infiniteTask] : [];
|
|
|
|
|
+ let list2 = res.data.singleTask ? [...res.data.singleTask] : [];
|
|
|
|
|
+ console.log([...list, ...list1, ...list2]);
|
|
|
|
|
+ that.setData({
|
|
|
|
|
+ tasks: [...list, ...list1, ...list2]
|
|
|
|
|
+ })
|
|
|
|
|
+ // that.setData({
|
|
|
|
|
+ // list: [{
|
|
|
|
|
+ // name: '单次任务',
|
|
|
|
|
+ // children: res.data.singleTask.map(item => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // taskName: item.taskName,
|
|
|
|
|
+ // taskScore: item.taskScore
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }, {
|
|
|
|
|
+ // name: '每日任务',
|
|
|
|
|
+ // children: res.data.dayTask.map(item => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // taskName: item.taskName,
|
|
|
|
|
+ // taskScore: item.taskScore
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }, {
|
|
|
|
|
+ // name: '不限次任务',
|
|
|
|
|
+ // children: res.data.infiniteTask.map(item => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // taskName: item.taskName,
|
|
|
|
|
+ // taskScore: item.taskScore
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }]
|
|
|
|
|
+ // })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 下拉刷新
|
|
|
|
|
- */
|
|
|
|
|
- onPullDownRefresh: function () {
|
|
|
|
|
- this.loadCheckinHistory();
|
|
|
|
|
- this.initCalendar();
|
|
|
|
|
- this.getUserInfo();
|
|
|
|
|
- wx.stopPullDownRefresh();
|
|
|
|
|
|
|
+ onPointsTap() {
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: "/pointExchange/pages/center/center?totalScore=" + this.data.totalScore,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 加载签到历史记录
|
|
|
|
|
- */
|
|
|
|
|
- loadCheckinHistory () {
|
|
|
|
|
- // const currentDate = new Date();
|
|
|
|
|
- // const year = currentDate.getFullYear();
|
|
|
|
|
- // const month = currentDate.getMonth() + 1;
|
|
|
|
|
- // const storageKey = `checkin_${year}_${month}`;
|
|
|
|
|
-
|
|
|
|
|
- // // 从本地存储加载当月签到记录
|
|
|
|
|
- // let checkedDates = wx.getStorageSync(storageKey) || [];
|
|
|
|
|
-
|
|
|
|
|
- // // 确保数据是数组格式
|
|
|
|
|
- // if (!Array.isArray(checkedDates)) {
|
|
|
|
|
- // checkedDates = [];
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- // // 过滤掉无效的日期(大于当月最大天数)
|
|
|
|
|
- // const daysInMonth = new Date(year, month, 0).getDate();
|
|
|
|
|
- // checkedDates = checkedDates.filter(day => day >= 1 && day <= daysInMonth);
|
|
|
|
|
-
|
|
|
|
|
- // this.setData({
|
|
|
|
|
- // checkedDates
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // TODO: 这里可以调用API从服务器获取签到记录
|
|
|
|
|
- this.getCheckinHistoryFromServer();
|
|
|
|
|
- },
|
|
|
|
|
- //获取用户信息
|
|
|
|
|
- getUserInfo () {
|
|
|
|
|
|
|
+ * 查询用户数据根据id
|
|
|
|
|
+ */
|
|
|
|
|
+ getUserInfo() {
|
|
|
let _this = this;
|
|
let _this = this;
|
|
|
let id = util.getUserId();
|
|
let id = util.getUserId();
|
|
|
|
|
+ let openid = wx.getStorageSync("openid");
|
|
|
if (id) {
|
|
if (id) {
|
|
|
let parm = {
|
|
let parm = {
|
|
|
id,
|
|
id,
|
|
@@ -128,12 +90,13 @@ Page({
|
|
|
"application/json",
|
|
"application/json",
|
|
|
JSON.stringify(parm),
|
|
JSON.stringify(parm),
|
|
|
function (res) {
|
|
function (res) {
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ // console.log(res);
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
wx.setStorageSync("USER", res.member);
|
|
wx.setStorageSync("USER", res.member);
|
|
|
_this.setData({
|
|
_this.setData({
|
|
|
userInfo: res.member,
|
|
userInfo: res.member,
|
|
|
});
|
|
});
|
|
|
|
|
+ // _this.loadUser()
|
|
|
} else {
|
|
} else {
|
|
|
wx.removeStorageSync("USER");
|
|
wx.removeStorageSync("USER");
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
@@ -142,34 +105,81 @@ Page({
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: '/pages/login',
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- // 获取已签到日期
|
|
|
|
|
- getCheckDate () {
|
|
|
|
|
- App._get(
|
|
|
|
|
- '/scoreStu/list',
|
|
|
|
|
- { stuId: util.getUserId() }).then(res => {
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ loadData() {
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ App._post_form('scoreStu/totalScore', '', {
|
|
|
|
|
+ stuId: util.getUserId()
|
|
|
|
|
+ },
|
|
|
|
|
+ function (res) {
|
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
|
+ that.setData({
|
|
|
|
|
+ totalScore: res.data
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
|
|
+ */
|
|
|
|
|
+ onLoad: function (options) {
|
|
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
|
|
+ title: '每日签到'
|
|
|
|
|
+ });
|
|
|
|
|
+ this.loadData();
|
|
|
|
|
+ this.getUserInfo();
|
|
|
|
|
+ this.loadList();
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 从服务器获取签到历史(备用)
|
|
|
|
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
*/
|
|
*/
|
|
|
- getCheckinHistoryFromServer () {
|
|
|
|
|
|
|
+ onShow: async function () {
|
|
|
|
|
+ // 页面显示时重新加载签到状态
|
|
|
|
|
+ await this.getCheckinHistoryFromServer();
|
|
|
|
|
+ this.loadData();
|
|
|
|
|
+ this.initCalendar();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 下拉刷新
|
|
|
|
|
+ */
|
|
|
|
|
+ onPullDownRefresh: async function () {
|
|
|
|
|
+ await this.getCheckinHistoryFromServer();
|
|
|
|
|
+ this.loadData();
|
|
|
|
|
+ this.initCalendar();
|
|
|
|
|
+ this.getUserInfo();
|
|
|
|
|
+ wx.stopPullDownRefresh();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从服务器获取签到历史
|
|
|
|
|
+ */
|
|
|
|
|
+ getCheckinHistoryFromServer() {
|
|
|
const userId = util.getUserId();
|
|
const userId = util.getUserId();
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: '加载中...',
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ });
|
|
|
if (!userId) return;
|
|
if (!userId) return;
|
|
|
-
|
|
|
|
|
App._get(
|
|
App._get(
|
|
|
- '/scoreStu/list',
|
|
|
|
|
- {
|
|
|
|
|
- stuId: userId,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ 'user/dayList/' + userId,
|
|
|
|
|
+ {},
|
|
|
(res) => {
|
|
(res) => {
|
|
|
|
|
+ wx.hideLoading();
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
- let data = res.data.map(v => {
|
|
|
|
|
- return parseInt(v.substr(6, 2));
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // let data = res.data.map(v => {
|
|
|
|
|
+ // return parseInt(v.substr(6, 2));
|
|
|
|
|
+ // })
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- checkedDates: data
|
|
|
|
|
|
|
+ checkedDates: res.data || []
|
|
|
});
|
|
});
|
|
|
this.initCalendar();
|
|
this.initCalendar();
|
|
|
}
|
|
}
|
|
@@ -180,7 +190,7 @@ Page({
|
|
|
/**
|
|
/**
|
|
|
* 初始化日历
|
|
* 初始化日历
|
|
|
*/
|
|
*/
|
|
|
- initCalendar () {
|
|
|
|
|
|
|
+ initCalendar() {
|
|
|
// 使用当前系统时间
|
|
// 使用当前系统时间
|
|
|
const date = new Date();
|
|
const date = new Date();
|
|
|
const year = date.getFullYear();
|
|
const year = date.getFullYear();
|
|
@@ -204,26 +214,30 @@ Page({
|
|
|
|
|
|
|
|
// 添加当月日期
|
|
// 添加当月日期
|
|
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
|
|
|
+ let date1 = `${year}${month + 1 > 9 ? month + 1 : '0' + (month + 1)}${day > 9 ? day : '0' + day}`
|
|
|
calendarDays.push({
|
|
calendarDays.push({
|
|
|
day: day,
|
|
day: day,
|
|
|
isEmpty: false,
|
|
isEmpty: false,
|
|
|
isToday: day === today,
|
|
isToday: day === today,
|
|
|
- isChecked: this.data.checkedDates.includes(day)
|
|
|
|
|
|
|
+ isChecked: this.data.checkedDates.includes(date1)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- console.log('aaa', calendarDays, this.data.checkedDates.includes(26))
|
|
|
|
|
|
|
+ let date1 = `${year}${month + 1 > 9 ? month + 1 : '0' + (month + 1)}${today > 9 ? today : '0' + today}`
|
|
|
|
|
+
|
|
|
|
|
+ console.log('date1', date1)
|
|
|
|
|
+ // console.log('aaa', calendarDays, this.data.checkedDates.includes(today))
|
|
|
this.setData({
|
|
this.setData({
|
|
|
calendarDays,
|
|
calendarDays,
|
|
|
currentYear: year,
|
|
currentYear: year,
|
|
|
currentMonth: month + 1,
|
|
currentMonth: month + 1,
|
|
|
today: today,
|
|
today: today,
|
|
|
- isCheckedToday: this.data.checkedDates.includes(today)
|
|
|
|
|
|
|
+ isCheckedToday: this.data.checkedDates.includes(date1)
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 立即签到
|
|
* 立即签到
|
|
|
*/
|
|
*/
|
|
|
- handleCheckin () {
|
|
|
|
|
|
|
+ handleCheckin() {
|
|
|
if (this.data.isCheckedToday) {
|
|
if (this.data.isCheckedToday) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
title: '今日已签到',
|
|
title: '今日已签到',
|
|
@@ -243,106 +257,33 @@ Page({
|
|
|
/**
|
|
/**
|
|
|
* 执行签到操作
|
|
* 执行签到操作
|
|
|
*/
|
|
*/
|
|
|
- performCheckin () {
|
|
|
|
|
|
|
+ performCheckin() {
|
|
|
const userId = util.getUserId();
|
|
const userId = util.getUserId();
|
|
|
const currentDate = new Date();
|
|
const currentDate = new Date();
|
|
|
- // TODO: 调用签到API
|
|
|
|
|
- // App._post_form(
|
|
|
|
|
- // '/api/scoreStu/dailyLogin',
|
|
|
|
|
- // 'application/json',
|
|
|
|
|
- // {
|
|
|
|
|
- // userId: userId,
|
|
|
|
|
- // },
|
|
|
|
|
- // (res) => {
|
|
|
|
|
- // if (res.code === 0) {
|
|
|
|
|
- // this.updateCheckinSuccess(res.data.points || 10);
|
|
|
|
|
- // } else {
|
|
|
|
|
- // wx.hideLoading();
|
|
|
|
|
- // wx.showToast({
|
|
|
|
|
- // title: res.message || '签到失败',
|
|
|
|
|
- // icon: 'none'
|
|
|
|
|
- // });
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // );
|
|
|
|
|
-
|
|
|
|
|
- // 模拟成功签到
|
|
|
|
|
- // setTimeout(() => {
|
|
|
|
|
- this.updateCheckinSuccess(10);
|
|
|
|
|
- // }, 1000);
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 更新签到成功状态
|
|
|
|
|
- */
|
|
|
|
|
- updateCheckinSuccess (points = 10) {
|
|
|
|
|
- // wx.hideLoading();
|
|
|
|
|
-
|
|
|
|
|
- // const today = this.data.today;
|
|
|
|
|
- // const checkedDates = [...this.data.checkedDates, today];
|
|
|
|
|
- // const calendarDays = this.data.calendarDays.map(item => {
|
|
|
|
|
- // if (item.day === today) {
|
|
|
|
|
- // return { ...item, isChecked: true };
|
|
|
|
|
- // }
|
|
|
|
|
- // return item;
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // // 保存到本地存储
|
|
|
|
|
- // const currentDate = new Date();
|
|
|
|
|
- // const year = currentDate.getFullYear();
|
|
|
|
|
- // const month = currentDate.getMonth() + 1;
|
|
|
|
|
- // const storageKey = `checkin_${year}_${month}`;
|
|
|
|
|
- // wx.setStorageSync(storageKey, checkedDates);
|
|
|
|
|
-
|
|
|
|
|
- // this.setData({
|
|
|
|
|
- // checkedDates,
|
|
|
|
|
- // calendarDays,
|
|
|
|
|
- // isCheckedToday: true,
|
|
|
|
|
- // 'userInfo.points': this.data.userInfo.points + points
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // wx.showToast({
|
|
|
|
|
- // title: `签到成功,获得${points}积分`,
|
|
|
|
|
- // icon: 'success'
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // 统计积分(每日登录)
|
|
|
|
|
- // this.addScore();
|
|
|
|
|
- if (!util.getUserId()) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
let _this = this;
|
|
let _this = this;
|
|
|
|
|
+ // TODO: 调用签到API
|
|
|
App._post_form(
|
|
App._post_form(
|
|
|
- 'scoreStu/dailySign',
|
|
|
|
|
- '', {
|
|
|
|
|
- stuId: util.getUserId(),
|
|
|
|
|
- },
|
|
|
|
|
- function (res) {
|
|
|
|
|
- // 积分统计完成
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: `签到成功,获得${points}积分`,
|
|
|
|
|
- icon: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- _this.loadCheckinHistory();
|
|
|
|
|
- _this.initCalendar();
|
|
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 统计积分(每日登录)
|
|
|
|
|
- */
|
|
|
|
|
- addScore: function () {
|
|
|
|
|
- if (!util.getUserId()) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- App._post_form(
|
|
|
|
|
- 'scoreStu/dailyLogin/dailySign',
|
|
|
|
|
- '', {
|
|
|
|
|
- stuId: util.getUserId(),
|
|
|
|
|
- },
|
|
|
|
|
- function (res) {
|
|
|
|
|
- // 积分统计完成
|
|
|
|
|
|
|
+ 'user/dailySign',
|
|
|
|
|
+ 'application/json',
|
|
|
|
|
+ {
|
|
|
|
|
+ stuId: userId
|
|
|
|
|
+ },
|
|
|
|
|
+ async (res) => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ // 积分统计完成
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: `签到成功`,
|
|
|
|
|
+ icon: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ await _this.getCheckinHistoryFromServer();
|
|
|
|
|
+ _this.initCalendar();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wx.hideLoading();
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: res.message || '签到失败',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
@@ -350,14 +291,16 @@ Page({
|
|
|
/**
|
|
/**
|
|
|
* 处理任务点击
|
|
* 处理任务点击
|
|
|
*/
|
|
*/
|
|
|
- handleTaskClick (e) {
|
|
|
|
|
- const taskId = e.currentTarget.dataset.id;
|
|
|
|
|
- const task = this.data.tasks.find(t => t.id == taskId);
|
|
|
|
|
|
|
+ handleTaskClick(e) {
|
|
|
|
|
+ console.log('handleTaskClick', e);
|
|
|
|
|
+ return;
|
|
|
|
|
+ // const taskId = e.currentTarget.dataset.id;
|
|
|
|
|
+ // const task = this.data.tasks.find(t => t.id == taskId);
|
|
|
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: `点击了${task.title}`,
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // wx.showToast({
|
|
|
|
|
+ // title: `点击了${task.title}`,
|
|
|
|
|
+ // icon: 'none'
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
// 根据不同任务跳转到不同页面
|
|
// 根据不同任务跳转到不同页面
|
|
|
switch (taskId) {
|
|
switch (taskId) {
|
|
@@ -376,43 +319,4 @@ Page({
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀请好友
|
|
|
|
|
- */
|
|
|
|
|
- inviteFriend () {
|
|
|
|
|
- wx.showModal({
|
|
|
|
|
- title: '邀请好友',
|
|
|
|
|
- content: '邀请好友注册可获得积分奖励',
|
|
|
|
|
- confirmText: '立即邀请',
|
|
|
|
|
- success: (res) => {
|
|
|
|
|
- if (res.confirm) {
|
|
|
|
|
- // 实现邀请逻辑
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '邀请功能开发中',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 观看广告
|
|
|
|
|
- */
|
|
|
|
|
- watchAd () {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '广告功能开发中',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 参与课程
|
|
|
|
|
- */
|
|
|
|
|
- joinCourse () {
|
|
|
|
|
- wx.navigateTo({
|
|
|
|
|
- url: '/pages/home/index/courseDetail/courseDetail'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
});
|
|
});
|