function e(e, t, i) {
return !(t.likeArticleList.indexOf(i) < 0);
}
function t(e, t, i) {
return !(t.oprtArticleList.indexOf(i) < 0);
}
var i = require("AF69DFF5BC64A5DFC90FB7F2A9B24571.js"), a = (require("BC6BCCB5BC64A5DFDA0DA4B212F24571.js"),
require("AE450F94BC64A5DFC823679305A24571.js")), o = function(e) {
wx.showLoading({
title: e,
mask: !0
});
}, s = function(e) {
wx.hideLoading(), wx.showToast({
title: e,
icon: "success",
duration: 1e3
});
}, r = function(e) {
wx.hideLoading(), wx.showModal({
title: "网络错误",
content: e,
confirmText: "确定",
showCancel: !1,
success: function(e) {
e.confirm && console.log("网络失败弹窗下,用户点击确定");
}
});
}, n = function(e, t) {
wx.hideLoading(), wx.showModal({
title: e,
content: t,
confirmText: "确定",
showCancel: !1,
success: function(e) {
e.confirm && console.log("接口Code失败弹窗下,用户点击确定");
}
});
}, c = function(e) {
if (200 === e.statusCode) switch (e.data.code) {
case 0:
console.log("网络请求正常:", e);
break;
case -1:
console.warn("登录失败"), n("登录失败", "请稍后重试,或者删除本小程序重新安装使用");
break;
case -2:
console.warn("登录状态失效");
break;
case -3:
console.warn("用户不存在");
break;
case -4:
console.warn("请求参数不合法");
} else console.warn("Http返回状态码错误,接口请求失败"), r("接口请求失败,请检查您的网络连接后重试");
}, l = function(e, t, o) {
e.setData({
userInfo: t.userInfo,
logged: t.logged
}), wx.setStorageSync("userInfo", t.userInfo), console.log("登录成功,用户信息已经写到APP、PAGE和LocalStorage中:", t.userInfo),
o(e, t), i.request({
url: a.service.userInfoUrl,
success: function(i) {
c(i), i.data.user ? (t.userInfo.status = i.data.user.status, e.setData({
userInfo: t.userInfo,
logged: t.logged
}), wx.setStorageSync("userInfo", t.userInfo), console.log("更新用户附加信息已经写到APP、PAGE和LocalStorage中:", t.userInfo)) : console.log("返回结果中数据异常,没有user");
}
});
}, d = function(e, t) {
var i = e.detail.formId;
i && "the formId is a mock one" != i ? wx.request({
url: a.service.formidSubmitUrl,
data: {
formid: i,
openid: t.openId
},
success: function(e) {
console.log("FormID发送成功");
},
fail: function(e) {
console.warn("FormID发送失败");
}
}) : console.log("FormID是模拟的,不用发送");
};
module.exports = {
getNameStr: function(e) {
return e ? e.slice(0, 1) + "**" + e.slice(-1) : " ";
},
getDataJson: function(e) {
var t = JSON.parse(e);
return console.log("解析dataJson: ", t), t;
},
showBusy: o,
showSuccess: s,
showInfomation: function(e) {
wx.hideLoading(), wx.showToast({
title: e,
icon: "success",
image: "/image/util_toast_info.png",
duration: 1500
});
},
showApiErrorModel: n,
showNetErrorModel: r,
restartApp: function() {
wx.reLaunch({
url: "/pages/index/index"
});
},
checkResCode: c,
userLogin: function(e, t, a) {
e.data.logged || (o("正在登录"), i.Session.get() ? i.loginWithCode({
success: function(i) {
s("登录成功"), t.userInfo = i, t.logged = !0, l(e, t, a);
},
fail: function(e) {
console.error(e), r("接口请求失败,请检查您的网络连接后重试");
}
}) : i.login({
success: function(i) {
s("登录成功"), t.userInfo = i, t.logged = !0, l(e, t, a);
},
fail: function(e) {
console.error(e), r("接口请求失败,请检查您的网络连接后重试");
}
}));
},
updateInfoWithLogin: l,
updateUserInfoToPage: function(e, t) {
e.setData({
userInfo: t.userInfo,
logged: t.logged
}), console.log("本地更新Userinfo到页面上:", e.data.userInfo);
},
submitFormId: d,
getArticleList: function(t, i, o, s, n, l) {
if (10 == n) d = a.service.articleForumUrl; else var d = a.service.articleListUrl;
wx.request({
url: d,
data: {
page: o,
size: s,
type: n,
sort: l
},
success: function(s) {
if (c(s), s.data.articles) {
s.data.articles.length == a.setting.pageSize ? t.setData({
loadMore: !0,
nextPage: o + 1,
sensitive: i.sensitive
}) : t.setData({
loadMore: !1,
nextPage: o + 1,
sensitive: i.sensitive
});
for (var r = s.data.articles, n = 0; n < r.length; n++) {
var l = e(0, i, r[n].id);
r[n].isLiked = l, r[n].likeAnim = !1;
var d = 0;
r[n].content.split("\n").forEach(function(e) {
e.length <= 10 ? d++ : d += Math.ceil(e.length / 10);
}), r[n].line = d;
}
1 == o ? t.setData({
articleList: r
}) : t.setData({
articleList: t.data.articleList.concat(r)
}), wx.stopPullDownRefresh();
} else console.log("返回结果中数据异常,没有articles");
},
fail: function(e) {
console.warn("获取列表数据失败", e), r("获取列表数据失败,请检查您的网络连接后重试");
}
});
},
checkIsLiked: e,
checkIsOprted: t,
articleLikeClick: function(e, i, o) {
var s = o.currentTarget.dataset.articleId, n = o.currentTarget.dataset.articleIndex, l = o.currentTarget.dataset.articleLiked;
console.log("点赞按钮事件articleLikeClick", s, n, l), l ? (i.likeArticleList.remove(s),
wx.setStorage({
key: "likeArticleList",
data: i.likeArticleList
}), i.oprtArticleList.push(s), wx.setStorage({
key: "oprtArticleList",
data: i.oprtArticleList
}), console.log("取消扎心成功,已经更新本地缓存"), e.data.articleList[n].likeNum--, e.data.articleList[n].isLiked = !1,
e.data.articleList[n].likeAnim = !1, e.setData({
articleList: e.data.articleList
}), wx.reportAnalytics("like_article", {
like_type: "cancel",
article_id: s
})) : t(e, i, s) ? (i.oprtArticleList.remove(s), wx.setStorage({
key: "oprtArticleList",
data: i.oprtArticleList
}), i.likeArticleList.push(s), wx.setStorage({
key: "likeArticleList",
data: i.likeArticleList
}), console.log("扎心成功,已经更新本地缓存"), e.data.articleList[n].likeNum++, e.data.articleList[n].isLiked = !0,
e.data.articleList[n].likeAnim = !0, e.setData({
articleList: e.data.articleList
}), wx.reportAnalytics("like_article", {
like_type: "like",
article_id: s
})) : wx.request({
url: a.service.articleLikeUrl,
data: {
docId: s
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
毒鸡汤文案类小程序源码分享.zip (97个子文件)
毒鸡汤文案类小程序源码分享
du1
sitemap.json 191B
.DS_Store 10KB
pages
forum
forum.json 199B
forum.wxss 2KB
forum.js 8KB
forum.wxml 2KB
.DS_Store 6KB
index
index.wxml 1KB
index.js 7KB
index.json 165B
index.wxss 175B
cure
poem.wxss 175B
poem.wxml 1KB
poem.json 165B
poem.js 6KB
article
article.js 10KB
article.json 129B
article.wxss 5KB
article.wxml 4KB
mine
about
about.wxss 1KB
about.js 159B
about.json 116B
about.wxml 442B
mine.js 4KB
mine.json 122B
mine.wxss 4KB
mine.wxml 3KB
mypub
mypub.wxml 619B
mypub.js 4KB
mypub.wxss 255B
mypub.json 95B
app.json 2KB
project.config.json 1KB
BC6BCCB5BC64A5DFDA0DA4B212F24571.js 324B
AE450F94BC64A5DFC823679305A24571.js 1000B
289B92E6BC64A5DF4EFDFAE1FAF24571.js 5KB
AF69DFF5BC64A5DFC90FB7F2A9B24571.js 580B
app.js 5KB
template
itemCard.wxml 12KB
shareDialog.wxml 2KB
shareDialog.wxss 0B
itemCard.wxss 0B
image
rank_num_bg.png 2KB
tab_icon_talk_HL.png 387B
tab_icon_poem.png 547B
page_bg.png 11KB
vip-on.png 1KB
share-user-qq.png 3KB
entry.png 149B
tab_icon_game.png 1006B
share-to-shuo.png 2KB
tab_icon_poem_HL.png 807B
tab_icon_rank_HL.png 288B
rank_num_bg_1.png 2KB
zzyc.png 2KB
list_header_poem.png 5KB
share-user.png 2KB
quote.png 948B
tab_icon_mine_HL.png 998B
liked.png 421B
rank_num_bg_2.png 2KB
util_toast_info.png 2KB
share.png 907B
tab_icon_game_HL.png 754B
tab_icon_index_HL.png 603B
comment_user_like.png 414B
share-quan.png 918B
avatar.png 671B
rank_num_bg_3.png 2KB
tab_icon_forum_HL.png 998B
forum_publish.png 5KB
list_header_forum.png 3KB
tab_icon_rank.png 260B
qrcode.jpg 16KB
delete.png 463B
tab_icon_mine.png 1KB
like.png 613B
vip-off.png 1KB
list_header_index.png 5KB
util_toast_success.png 2KB
tab_icon_talk.png 452B
comment_submit.png 736B
list_header_talk.png 3KB
tab_icon_index.png 636B
tab_icon_forum.png 1014B
comment.png 770B
utils
mod.wxs 943B
app.wxss 1.69MB
BB885842BC64A5DFDDEE3045D4034571.js 228B
70480E26BC64A5DF162E662145134571.js 451B
C7D68300BC64A5DFA1B0EB0727C24571.js 659B
C5B798A4BC64A5DFA3D1F0A3A8D24571.js 3KB
71CC79E6BC64A5DF17AA11E1F0B24571.js 10KB
30989775BC64A5DF56FEFF7261E24571.js 2KB
__MACOSX
du1
._image 220B
pages
._.DS_Store 120B
._.DS_Store 120B
共 97 条
- 1
资源评论
小徐博客
- 粉丝: 1973
- 资源: 4139
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功