kuaiying_wx/pages/invite_incentive/invite_incentive.js
2025-03-04 15:25:38 +08:00

81 lines
2.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var e = getApp();
Page({
data: {
inviteCount: 0,
rewardCount: 0,
countdown: "3天12时30分20秒",
number: 0,
uuid:wx.getStorageSync("uuid"),
},
onLoad: function(e) {
wx.showShareMenu({
withShareTicket: !0,
menus: [ "shareAppMessage", "shareTimeline" ]
}), console.log(1), this.startCountdown();
},
startCountdown: function() {
var e = this, n = 30422e4;
setTimeout(function t() {
var o = Math.floor(n / 864e5) + "天" + Math.floor(n % 864e5 / 36e5) + "时" + Math.floor(n % 36e5 / 6e4) + "分" + Math.floor(n % 6e4 / 1e3) + "秒";
e.setData({
countdown: o
}), (n -= 1e3) >= 0 ? setTimeout(t, 1e3) : e.setData({
countdown: "活动已结束"
});
}, 1e3);
},
onReady: function() {},
onShow: function() {
var n = this;
e.getUserInfo().then(function() {
console.log(wx.getStorageSync("invitees_count"), "人"), console.log(10 * wx.getStorageSync("invitees_count"), "次"),
n.setData({
inviteCount: wx.getStorageSync("invitees_count"),
rewardCount: 10 * wx.getStorageSync("invitees_count"),
number: wx.getStorageSync("balance")
});
}).catch(function(e) {
console.error("An error occurred:", e);
});
},
copyPath: function () {
const path = '/pages/index/index?uuid=' + this.data.uuid;
wx.setClipboardData({
data: path,
success: function (res) {
wx.showToast({
title: '复制成功',
icon: 'success',
duration: 1500
});
}
});
},
onHide: function() {},
onUnload: function() {},
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function() {
return {
title: "推荐一款免费又超好用的AI视频文案创作工具分享给大家一起使用",
path: "/pages/index/index?uuid=" + wx.getStorageSync("uuid"),
imageUrl: "/images/share.jpg",
success: function(e) {
wx.showToast({
title: "分享成功",
icon: "success",
duration: 2e3
});
},
fail: function(e) {
wx.showToast({
title: "分享失败",
icon: "none",
duration: 2e3
});
}
};
}
});