提交 44884d3d 编写于 作者: 泰斯特Test's avatar 泰斯特Test

init

上级
# 日记类小程序
使用小程序云开发的 AI 日记类小程序。
通过免费调用腾讯 NLP 情感识别,可以识别到用户记录下日记的情绪值并给予情绪币的奖励。
情绪币可以用于打捞别人公开的日记。
主要功能有:情绪排行,写日记,打捞日记。
## 页面展示
![AI日记](https://github.com/amazingTest/miniprogram-Diary/blob/master/img/sample.jpg)
## 直接扫码体验
![AI日记](https://github.com/amazingTest/miniprogram-Diary/blob/master/img/2d-code.jpg)
## 联系我
想获取云函数部分代码的伙伴可以联系 QQ 2311838724
//app.js
App({
onLaunch: function () {
this.globalData = { needToLoadDiaries: true,
shareTitle: '你今天是什么情绪??',
shareImg: '/images/share/emotions.png',
shareCheckBox: {
name: 'changeShareCheckBox',
value: '是否公开(匿名)',
checked: false
},
userData:{},
preparedEmotions: { happy: ['望着一望无际的田野,我们的心难以平静,兴奋不已,因为我感受到了秋天独有的意味,感受到了丰收的喜悦。', '当我一头钻进书堆时,心中的狂喜是难以言喻。', '选对事业可以成就一生,选对朋友可以智能一生,选对环境可以快乐一生,选对伴侣可以幸福一生,选对生活方式可以健康一生!', '当脸上出现笑容的时候,我们的胃我们的肝我们的骨骼,都会感觉到我们的快乐,出现相应的笑容。', '西湖美丽的千年爱情,我希望可以传承,其中的精华,我希望拥有,我们的爱情伟大而平凡,最爱的只有你。', '快乐是一种宝贵的资源,不能光是享用,而不去发掘。', '我此刻心情舒畅,就像蓝天的白云那样安闲、自在。我背起书包,迎着朝阳,蹦蹦跳跳地来到了学校。', '财富名利不会均等,时光对人却很公平,你有金山银山,不一定有寿比南山,他是粗茶布依,也会快乐百年!', '快乐总与宽厚的人相伴,财富总与诚信的人相伴,智慧总与高尚的人相伴,魅力总与幽默的人相伴,健康总与豁达的人相伴!', '愉快的笑声,是精神健康的可靠标志。', '人的心念意境,如能保持开朗清明,则所见,都是美而善的。'], cheerful: ['快乐的人兴趣广泛,不会无所事事。运动是快乐的添加剂,运动会直接带给人快乐。', '成功了,我无法遏止自己的泪水顺着脸颊滚滚流淌!', '平静的湖面激起了浪花,我的心情也像浪花一样欢腾。', '所谓的快乐,是指身体的无痛苦和灵魂的无纷扰。', '真正的快乐是对生活的乐观,对工作的愉快,对事业的兴奋。', '有人说,要让自己快乐,最好的方法是先令别人快乐。', '笑脸,不但可以表答善意,还可以缩短人际间的距离。', '做自己喜欢做的事情,做自己擅长的事情,找回成功的喜悦,找回失去的信心,找到前进动力和方向。', '总有一个人,一直住在心底,却消失在生活里。所以我总觉得生活像一杯咖啡,本来就是苦的,想要过得甜一点,必须自己动手加些方糖。', '在吃饭、睡觉、运动的时候,心中坦然,精神愉快,乃是长寿的秘诀之一。', '当你爱一个人的时候,连折磨也是一种幸福。', '快乐并不需要下流或肉欲。往昔的智者们都认为只有智性的快乐最令人满足而且最能持久。'], angry: ['爱情本来就是一个犯贱项目,爱是没有真理没有真相没有尊严。', '嫉妒归嫉妒,做人不要做狗,在背后诋毁有意思?', '怪我自己没眼力,把你当作人了,早知道就买条狗链套你脖子上了。', '我非找他算账不可,怨恨在胸中滋生着,气恨难忍了。', '装腔作势是生命力旺盛的象征,虚荣心强是年轻的标志。', '女人,别把你妖娆的外表当作犯贱的令牌。男人,别把你桀骜的性格当成自恋的资本。', '原想给世界一个温暖的拥抱,却迎来四面八方的耳光。', '我骂你一句衣冠禽兽,只怕污了畜类的天性。', '这个世界的眼泪太多,愤怒的,悲伤的,绝望的,无辜的,我曾躲在某个寂寞的角落,心照不宣地见证过。', '没事别闭着眼睛说话,不知道的人还以为是诈尸。', '时间真的是个让人讨厌的东西,它不经任何人同意就任意改变了一切。', '做人总是犯贱,有的不会珍惜,没有的总是最想要。', '虽然你身上喷了古龙水,但我还是能隐约闻到一股人渣味儿。', '你要是再欺负我,我就诅咒你,下辈子变成七度空间。', '你还没有进化完全,长的像人真的难为你了。', '每个人都会犯贱,但请注意次数;每个人都会善变,但请注意速度。', '眼里闪烁着一股无法遏止的怒火,牙齿咬得咯咯作响,好似一头被激怒的狮子。', '你不是脑子不好,就是缺根线儿;你心脏挺健康的,就是缺个眼儿。', '打你会打疼我的手,骂你会脏了我的嘴,你滚吧,免得污了我的眼。', '树不要皮,必死无疑,人不要脸,天下无敌。'], sad: ['时光总是旧的,最苍白的想念,最迂回的伤。', '我宁愿优雅的说分手,也不愿狼狈的看着你离开。', '眼睛,不应该用来为伤害你的人哭泣,而应该用来寻找那个正确的人。', '开始难过了,哽咽了,心疼了,说不出话了,心不受控制了。', '有时候,为了避免不必要的失望,你得降低自己的期望值。', '就在刚才我还在一遍一遍的想着和他的将来,可是现在他已经和我没关系了,懂我的难过吗。', '从久伴我到酒伴我,从我爱你到我碍你,从可歌可泣到可搁可弃。', '我们之间动心痛心从始至终都只有我一个人而已。', '别拿谎言来考验爱情,真正的爱情不需要考验。', '有些人已过去,你忘不掉她不代表你还爱她,只是珍惜或怀念当时的美好而已。', '曾经抱紧你的我比国王富有。现在失去你的我比乞丐落魄。', '你用最虚伪的那三个字、换走了我那颗不争气的心。', '天色很黑,你看不见我的眼泪、因为我装无所谓,忍着泪,笑的好狼狈。', '突然好想你,你会在哪里,过得快乐或委屈?', '浮光掠影,淡淡的,染去那悲凉。', '如果你想要却不去拼搏,那么失去了你就别哭泣。', '我慢热是因为怕被欺骗,毕竟每一次投入都是倾尽所有。', '再大的雨,最终会停下。再刺人的伤,也会结痂。', '人生就是一条坎坷曲折的路,即使不断的跌倒。', '在一瞬间曾经所有的梦都幻灭,剩下回忆湿了我的眼。', '必须让自己一直保持神经病的状态,不然一静下来就会难过啊,真是有毛病。', '如果有人问起,就说忘了。不解释,不悲伤,你懂得。', '我也曾路过孤苦,路过无助,途经你的荒芜。']}}
if (!wx.cloud) {
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
} else {
wx.cloud.init({
// env 参数说明:
// env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
// 如不填则使用默认环境(第一个创建的环境)
// env: 'my-env-id',
traceUser: true,
})
}
}
})
{
"cloud": true,
"pages": [
"pages/index/index",
"pages/drift/index",
"pages/rank/index",
"pages/buddhaRank/buddhaRank",
"pages/emotionMoneyRank/emotionMoneyRank",
"pages/salvageRank/salvageRank",
"pages/thumbUpRank/thumbUpRank",
"pages/successiveDiariesRank/successiveDiariesRank",
"pages/my/index",
"pages/myDiaries/myDiaries",
"pages/diaryDetail/diaryDetail",
"pages/userProtocol/userProtocol"
],
"tabBar": {
"color": "#87CEFA",
"selectedColor": "#6495ED",
"borderStyle": "white",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/nav/diary-off.png",
"selectedIconPath": "images/nav/diary-on.png",
"text": "写情绪"
},
{
"pagePath": "pages/drift/index",
"iconPath": "images/nav/drift-off.png",
"selectedIconPath": "images/nav/drift-on.png",
"text": "漂流记"
},
{
"pagePath": "pages/rank/index",
"iconPath": "images/nav/rank-off.png",
"selectedIconPath": "images/nav/rank-on.png",
"text": "排行榜"
},
{
"pagePath": "pages/my/index",
"iconPath": "images/nav/my-off.png",
"selectedIconPath": "images/nav/my-on.png",
"text": "我的"
}
]
},
"window": {
"backgroundColor": "#F6F6F6",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#00BFFF",
"navigationBarTitleText": "绪日记",
"navigationBarTextStyle": "white"
},
"sitemapLocation": "sitemap.json",
"style": "v2"
}
\ No newline at end of file
/**app.wxss**/
.container {
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
button {
background: initial;
}
button:focus{
outline: 0;
}
button::after{
border: none;
}
page {
background: #f6f6f6;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.userinfo, .uploader, .tunnel {
margin-top: 40rpx;
height: 140rpx;
width: 100%;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.1);
border-left: none;
border-right: none;
display: flex;
flex-direction: row;
align-items: center;
transition: all 300ms ease;
}
.userinfo-avatar {
width: 100rpx;
height: 100rpx;
margin: 20rpx;
border-radius: 50%;
background-size: cover;
background-color: white;
}
.userinfo-avatar:after {
border: none;
}
.userinfo-nickname {
font-size: 32rpx;
color: #007aff;
background-color: white;
background-size: cover;
}
.userinfo-nickname::after {
border: none;
}
.uploader, .tunnel {
height: auto;
padding: 0 0 0 40rpx;
flex-direction: column;
align-items: flex-start;
box-sizing: border-box;
}
.uploader-text, .tunnel-text {
width: 100%;
line-height: 52px;
font-size: 34rpx;
color: #007aff;
}
.uploader-container {
width: 100%;
height: 400rpx;
padding: 20rpx 20rpx 20rpx 0;
display: flex;
align-content: center;
justify-content: center;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.uploader-image {
width: 100%;
height: 360rpx;
}
.tunnel {
padding: 0 0 0 40rpx;
}
.tunnel-text {
position: relative;
color: #222;
display: flex;
flex-direction: row;
align-content: center;
justify-content: space-between;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.tunnel-text:first-child {
border-top: none;
}
.tunnel-switch {
position: absolute;
right: 20rpx;
top: -2rpx;
}
.disable {
color: #888;
}
.service {
position: fixed;
right: 40rpx;
bottom: 40rpx;
width: 140rpx;
height: 140rpx;
border-radius: 50%;
background: linear-gradient(#007aff, #0063ce);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
display: flex;
align-content: center;
justify-content: center;
transition: all 300ms ease;
}
.service-button {
position: absolute;
top: 40rpx;
}
.service:active {
box-shadow: none;
}
.request-text {
padding: 20rpx 0;
font-size: 24rpx;
line-height: 36rpx;
word-break: break-all;
}
此差异已折叠。
{
"name": "miniprogram",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"miniprogram-datepicker": "^0.3.0",
"wx-server-sdk": "^1.6.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
stableRankLoaded: false,
stableRank: [],
isOnLoadHappening: false,
currentUserRank: null,
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
stableFilter(stable) {
if(stable.averageEmotionStable){
return true
}else{
return false
}
},
setCurrentRank(stableRank){
let that = this
let currentUserOpenId = app.globalData.openid
for (let i = 0; i < stableRank.length; i++){
let rankOpenId = stableRank[i]._id.openId
if (currentUserOpenId === rankOpenId){
that.setData({
currentUserRank: i
})
return
}
}
},
getRankToast(stableRank){
let that = this
let toast = '加油~'
if (that.data.currentUserRank !== null){
let title = stableRank[that.data.currentUserRank].rankTitle
let realRank = that.data.currentUserRank + 1
let nickName = stableRank[that.data.currentUserRank].nickName
toast = '佛系榜第 ' + realRank + ', ' + title + ' ' + nickName + ''
}else{
toast = '您尚未出现在榜单中,快去写日记吧~'
}
return toast
},
formatRank(result) {
result.forEach((el, index) => {
if (el.averageEmotionStable) {
result[index].averageEmotionStable =
util.round(el.averageEmotionStable, 1)
if (index < 1) {
result[index].rankTitle = '佛系至尊'
} else if (index < 5) {
result[index].rankTitle = '佛系天王'
} else if (index < 10) {
result[index].rankTitle = '佛系护法'
} else if (index < 20) {
result[index].rankTitle = '佛系护卫'
} else {
result[index].rankTitle = '佛系小兵'
}
}else{
console.log('元素不存在 averageEmotionStable 属性!')
}
})
},
onLoad: function() {
let that = this
that.setData({
isOnLoadHappening: true
})
wx.showLoading({
title: '正在加载榜单...',
})
//调用云函数拿佛系榜单
wx.cloud.callFunction({
name: 'getStableRank',
data: {},
success: res => {
let stableRank = res.result.list
stableRank = stableRank.filter(that.stableFilter)
that.formatRank(stableRank)
that.setCurrentRank(stableRank)
that.setData({
stableRankLoaded: true,
stableRank,
isOnLoadHappening: false
})
let rankToast = that.getRankToast(stableRank)
wx.showToast({
title: rankToast,
icon: 'none',
duration: 3500
})
console.log('[云函数] [getStableRank] rank: ', that.data.stableRank)
},
fail: err => {
that.setData({
isOnLoadHappening: false
})
wx.showToast({
title: '加载失败...',
icon: 'none'
})
console.error('[云函数] [getStableRank] 调用失败', err)
}
})
},
onShow: function () {
let that = this
if (!that.data.isOnLoadHappening){
wx.showToast({
title: '顶部下拉可刷新榜单~',
icon: 'none'
})
}
},
onPullDownRefresh: function () {
let that = this
that.setData({
stableRank: []
})
that.onLoad()
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<view class="rankTitle">
佛系风云榜
</view>
<view wx:if="{{stableRankLoaded && stableRank.length < 1}}">
还没有人上榜呢~
</view>
</view>
<view
class="table"
wx:if="{{stableRankLoaded && stableRank.length > 0}}">
<view class="tr bg-w">
<view class="th">排名</view>
<view class="th">称谓</view>
<view class="th ">昵称</view>
<view class="th ">佛系值</view>
</view>
<block
wx:for="{{stableRank}}"
wx:if="{{stableRank.length > 0}}"
wx:key="unique">
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr bg-g'}}"
wx:if="{{index % 2 == 0}}">
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.averageEmotionStable}}%</view>
</view>
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr'}}"
wx:else>
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.averageEmotionStable}}%</view>
</view>
</block>
</view>
/**index.wxss**/
.rankTitle{
color: #6666FF;
font-size: 22px;
margin:50rpx
}
.table {
border: 0px solid darkgray;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
font-size: 30rpx;
width:25%;
justify-content: center;
text-align: center;
}
.bg-w{
background: snow;
}
.bg-g{
background: #E6F3F9;
}
.bg-match{
background: #66CCFF;
}
.bg-match > view{
color: white;
}
.th {
width: 25%;
justify-content: center;
background: #66CCFF;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
// miniprogram/pages/diaryDetail.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
/**
* 页面的初始数据
*/
data: {
isInfoLoaded: false,
diaryId: null,
isDiaryShared:false,
isDiariesNumLoaded: false,
diariesNum: null,
diaryOwner: null,
diaryContent:null,
diaryCreateAt: null,
isEmotionGenerated: false,
emotionPositive: '????',
emotionNegative: '????',
emotionStable: '????',
isEmotionSaved: false,
emotionSaveToast: '',
emotionColor: '#00BFFF',
pageLoadFailed: false,
fromMy: '1', // 是否从 Tab 我的 进入
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let that = this
wx.showLoading({
title: '页面加载中...',
})
let diaryOwner = options.diaryOwner
let diaryId = options.diaryId
let fromMy = options.fromMy
that.setData({
fromMy,
diaryOwner,
diaryId
})
wx.cloud.callFunction({
name: 'getDiary',
data: {
diaryId: that.data.diaryId,
},
success: function (res) {
if (res.result.data.emotionPositive && res.result.data.emotionNegative && res.result.data.emotionStable){
that.setData({
emotionPositive: res.result.data.emotionPositive,
emotionNegative: res.result.data.emotionNegative,
emotionStable: res.result.data.emotionStable,
isDiaryShared: res.result.data.isShared,
isEmotionGenerated: true,
isEmotionSaved: true
})
}
let diaryContent = res.result.data.diary
let diaryCreateAt = util.formatTime(new Date(res.result.data.createAt))
let isDiaryShared = res.result.data.isShared
that.setData({
diaryContent,
diaryCreateAt,
isDiaryShared,
isInfoLoaded: true,
pageLoadFailed: false,
})
},
fail: function (res) {
wx.showToast({
title: '加载失败:(',
icon: 'none'
})
that.setData({
pageLoadFailed: true,
})
console.log(res)
}
})
wx.cloud.callFunction({
name: 'getSpecificDiariesNum',
data: {
openId: app.globalData.openid,
},
success: function (res) {
let diariesNum = res.result.total
that.setData({
diariesNum,
isDiariesNumLoaded: true,
pageLoadFailed: false,
})
// 需要优化
wx.hideLoading()
},
fail: function (res) {
wx.showToast({
title: '加载失败:(',
icon: 'none'
})
that.setData({
pageLoadFailed: true,
})
console.log(res)
}
})
},
generateDiaryEmotion: function() {
let that = this
wx.showLoading({
title: '情绪生成中...',
})
wx.cloud.callFunction({
name: 'getEmotion',
data: {
text: that.data.diaryContent,
},
success: function (res) {
let emotionValid = res && res.result.result.data.positive &&
res.result.result.data.negative && res.result.result.data.emotionStable
if (emotionValid){
that.setData({
emotionPositive: res.result.result.data.positive,
emotionNegative: res.result.result.data.negative,
emotionStable: res.result.result.data.emotionStable,
})
let emotions = [res.result.result.data.positive, res.result.result.data.negative,
res.result.result.data.emotionStable]
let maximun = Math.max.apply(null, emotions)
let emotionColor = ''
let showToasts = []
if (res.result.result.data.negative === maximun){
emotionColor = '#660099'
showToasts = ['阳光总在风雨后~', '请相信会有彩虹~', '伤心只是一时的~',
'明天会变得更好~', '人生不易,何必烦恼~', '坚定内心,克复一切']
} else if (res.result.result.data.positive === maximun){
emotionColor = '#FF9900'
showToasts = ['祝愿你每天能都拥抱快乐~', '没有什么比开心更重要~', '快乐能医治百病~',
'明天会过的更开心~', '快乐是幸福的源泉~', '爱笑的人运气都不会太差~']
} else {
emotionColor = '#00CC00'
showToasts = ['佛系生活每一天~', '心如止水,波澜不惊~', '宁静致远, 知足常乐~',
'不以物喜,不以己悲~', '心态平和,凡事随缘~', '树高千丈,叶落归根~']
}
let emotionSaveToast = util.randomChoiceElement(showToasts)
that.setData({
emotionColor,
isEmotionGenerated: true,
emotionSaveToast
})
that.saveDiaryEmotion()
}else{
wx.showToast({
title: '情绪获取失败 :(',
icon: 'none'
})
}
console.log(res)
},
fail: function (res) {
wx.showToast({
title: '情绪生成失败 :(',
icon: 'none'
})
console.log(res)
}
})
},
saveDiaryEmotion: function() {
let that = this
wx.showLoading({
title: '保存中...',
})
console.log(that.data.isDiaryShared)
wx.cloud.callFunction({
name: 'updateDiary',
data: {
diaryId: that.data.diaryId,
openId: app.globalData.openid,
recommandOpenId: app.globalData.recommandOpenId || app.globalData.userData.recommandOpenId, // 日记推荐人openId
isDiaryShared: that.data.isDiaryShared, // 日记是否公开
emotionPositive: that.data.emotionPositive,
emotionNegative: that.data.emotionNegative,
emotionStable: that.data.emotionStable,
},
success: function (res) {
that.setData({
isEmotionSaved: true
})
let congratsToast = that.data.isDiaryShared ? ' 恭喜您收获了佛系值双倍暴击: ' + that.data.emotionStable * 2 + ' 个情绪币~' : ' 恭喜您收获了与佛系值等额: ' + that.data.emotionStable + ' 个情绪币~'
wx.showToast({
title: that.data.emotionSaveToast + congratsToast,
icon: 'none',
duration: 5000
})
console.log(res)
},
fail: function (res) {
wx.showToast({
title: '保存失败 :(',
icon: 'none'
})
console.log(res)
}
})
},
navigateToDrift() {
wx.switchTab({
url: '../drift/index',
})
},
refreshPage(){
this.onLoad()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
let that = this
if (!that.data.isEmotionGenerated){
wx.showToast({
title: '情绪值可以在「我的情绪」中点开情绪后生成~',
icon:'none',
duration: 5000,
})
} else if (!that.data.isEmotionSaved){
wx.showToast({
title: '情绪值可以在「我的情绪」中点开情绪后生成后保存~',
icon: 'none',
duration: 5000,
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: app.globalData.shareTitle, //自定义转发标题
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--index.wxml-->
<!-- <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
<view class="full-screen">
<div
wx:if="{{isInfoLoaded && isDiariesNumLoaded}}"
class="header">
<text wx:if="{{fromMy !== '1'}}">
{{diaryOwner}}的第 {{diariesNum}} 篇情绪
</text>
<text wx:if="{{fromMy === '1'}}">
{{diaryOwner}}的小情绪
</text>
</div>
<div
wx:if="{{isInfoLoaded && isDiariesNumLoaded}}"
class="diary">
<view class="container">
<text class="dairyCreateAt">
{{diaryCreateAt}}
</text>
</view>
<view class="container">
<text class="dairyContent">
{{diaryContent}}
</text>
</view>
</div>
<view class="emotion" wx:if="{{isInfoLoaded && isDiariesNumLoaded}}">
<text style="color: #FF9900">开心</text>
<text style="color: #660099">难过</text>
<text style="color: #00CC00">佛系</text>
</view>
<view class="emotion" wx:if="{{isInfoLoaded && isDiariesNumLoaded}}">
<image src="../../images/emotion/happy.png"></image>
<image src="../../images/emotion/sad.png"></image>
<image src="../../images/emotion/stable.png"></image>
</view>
<view class="emotion" wx:if="{{isInfoLoaded && isDiariesNumLoaded}}">
<text wx:if="{{isEmotionGenerated}}" style="color: #FF9900">
{{emotionPositive}}%
</text>
<text wx:if="{{!isEmotionGenerated}}" style="color: #FF9900">
{{emotionPositive}}
</text>
<text wx:if="{{isEmotionGenerated}}" style="color: #660099">
{{emotionNegative}}%
</text>
<text wx:if="{{!isEmotionGenerated}}" style="color: #FF9900">
{{emotionPositive}}
</text>
<text wx:if="{{isEmotionGenerated}}" style="color: #00CC00">
{{emotionStable}}%
</text>
<text wx:if="{{!isEmotionGenerated}}" style="color: #FF9900">
{{emotionPositive}}
</text>
</view>
<button
wx:if="{{isInfoLoaded && isDiariesNumLoaded && !isEmotionGenerated && !isEmotionSaved}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 50rpx; margin-bottom: 70rpx"
type="primary"
bindtap="generateDiaryEmotion">
生成情绪值
</button>
<!--生成和保存连成一步了,故暂时不用这个按钮 <button
wx:if="{{isInfoLoaded && isDiariesNumLoaded && isEmotionGenerated && !isEmotionSaved}}"
class="weui-btn"
style="background-color: {{emotionColor}}; margin-top: 50rpx; margin-bottom: 70rpx"
type="primary"
bindtap="saveDiaryEmotion">
保存情绪值
</button> -->
<button
wx:if="{{isInfoLoaded && isDiariesNumLoaded && isEmotionGenerated && !isEmotionSaved}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 30rpx; margin-bottom: 70rpx"
type="primary"
bindtap="saveDiaryEmotion">
生成情绪值
</button>
<view class="shareAndDonate">
<button
wx:if="{{isInfoLoaded && isDiariesNumLoaded && isEmotionGenerated && isEmotionSaved}}"
class="weui-btn"
style="background-color: {{emotionColor}}; margin: 40rpx"
type="primary"
bindtap="navigateToDrift">
去试试打捞情绪
</button>
<button
wx:if="{{isInfoLoaded && isDiariesNumLoaded && isEmotionGenerated && isEmotionSaved}}"
class="weui-btn"
style="background-color: {{emotionColor}}; margin: 40rpx"
type="primary"
open-type="share">
邀请好友写情绪
</button>
</view>
<button
wx:if="{{pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 50rpx;"
type="primary"
bindtap="refreshPage">
刷新页面
</button>
</view>
/* miniprogram/pages/diaryDetail.wxss */
.full-screen{
position: fixed;
height: 100%;
width: 100%;
display:flex;
flex-direction:column;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
.shareAndDonate > button{
flex-direction:row !important;
align-items:flex-start !important;
justify-content:flex-start !important;
}
.header{
color: #6666FF;
font-size: 22px;
margin-bottom:100rpx;
text-align:center;
}
.diary{
/* position: fixed;
height: 100%;
width: 100%; */
background-color: white;
color:cornflowerblue;
margin: 0rpx 50rpx 40rpx 50rpx;
flex-direction:column;
}
.dairyCreateAt{
color: #3366FF;
font-size: 14px
}
.dairyContent{
font-size: 14px;
margin: 10rpx 50rpx 30rpx 50rpx
}
.emotion image{
width: 80rpx;
height: 80rpx;
margin: 0rpx 60rpx 0rpx 60rpx;
float: left;
}
.emotion text{
font-weight: bold;
width: 80rpx;
height: 80rpx;
margin: -20rpx 60rpx 0rpx 60rpx;
float: left;
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
isPageAuthorized: false,
diaryId: '',
diaryOwnerOpenId: '',
diaryContent: '?????????????????????????????',
diaryCreateAt: '???? 年 ?? 月 ?? 日',
diaryAuthor: '??????',
thumbUpNum: '???',
remainedSharedDiariesNum: null,
likeImageSrc:'/images/like/like-off.png',
pageLoadFailed: false,
isInfoLoaded: false,
isOpenIdLoaded: false,
isSalvagingDiariesLoaded: false,
isSalvagingDiaries: false,
likeButtonDisabled: true,
isOnLoadHappening: false,
isRandom: true,
diariesNum: 1,
ownerName: null,
gambleMoney: 100,
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
navigateToDiaryWritting() {
wx.switchTab({
url: '../index/index',
})
},
onShow: function () {
let that = this
if (app.globalData.openid && app.globalData.userInfo) {
that.setData({
isPageAuthorized: true,
isOpenIdLoaded: true,
})
if (!that.data.isOnLoadHappening){
wx.showToast({
title: '顶部下拉可刷新漂流池~',
icon: 'none'
})
}
}
},
onLoad: function() {
wx.showLoading({
title: '页面正在加载中...',
})
let that = this
that.setData({
isOnLoadHappening: true,
})
if (app.globalData.openid && app.globalData.userInfo){
that.setData({
isOpenIdLoaded: true,
isPageAuthorized: true,
})
wx.cloud.callFunction({
name: 'getSharedDiariesNum',
data: {
openId: app.globalData.openid
},
success: function (res) {
if(res){
let remainedSharedDiariesNum = res.result.total
that.setData({
remainedSharedDiariesNum,
isInfoLoaded: true,
pageLoadFailed: false,
isOnLoadHappening:false,
})
wx.hideLoading()
}else{
that.setData({
pageLoadFailed: true
})
wx.showToast({
title: '加载失败:(',
icon: 'none'
})
}
console.log(res)
},
fail: function (res) {
wx.showToast({
title: '数据获取失败 :(',
icon: 'none'
})
that.setData({
isOnLoadHappening: false,
})
console.log(res)
}
})
}else{
that.setData({
pageLoadFailed: true,
isOnLoadHappening: false,
})
wx.showToast({
title: '加载失败:(',
icon: 'none'
})
}
},
getSharedDiaries: function (){
let that = this
that.setData({
isSalvagingDiaries: true
})
wx.showModal({
title: '需要花费 100 情绪币~',
content: '决定好了吗?',
success: function (res) {
if (res.confirm) {
wx.showLoading({
title: '打捞情绪中...',
})
wx.cloud.callFunction({
name: 'salvageDiaries',
data: {
openId: app.globalData.openid,
isRandom: that.data.isRandom,
diariesNum: that.data.diariesNum,
ownerName: that.data.ownerName,
gambleMoney: that.data.gambleMoney
},
success: res => {
if (res){
let result = res.result
if (result == 'notEnoughEmotionMoney') {
wx.showToast({
title: '你的情绪币不足哦~ 快去做任务赚取情绪币吧 :)',
icon: 'none'
})
} else if (result === 'gambleFailed') {
// 埋坑
} else if (result.length < 1){
wx.showToast({
title: '情绪都被你看完啦!快去邀请好友一起写情绪吧 :)',
icon: 'none',
duration: 2500,
})
} else {
let diaryId = result[0]._id
let diaryOwnerOpenId = result[0].openId
// let diaryAuthor = result[0].nickName // 匿名日记
let diaryCreateAt = util.formatTime(new Date(result[0].createAt))
let diaryContent = result[0].diary
let thumbUpNum = result[0].thumbUpNum || 0
that.onLoad()
that.setData({
likeImageSrc: '/images/like/like-off.png',
diaryId,
diaryOwnerOpenId,
// diaryAuthor,
diaryCreateAt,
diaryContent,
thumbUpNum,
likeButtonDisabled: false,
isSalvagingDiariesLoaded: true
})
wx.hideLoading()
}
}else{
wx.showToast({
title: '打捞失败 :(',
})
}
that.setData({
isSalvagingDiaries: false
})
console.log('[云函数] [salvageDiaries]: ', res.result)
},
fail: err => {
console.error('[云函数] [salvageDiaries] 调用失败', err)
wx.showToast({
title: '打捞失败 :(',
icon: 'none'
})
that.setData({
isSalvagingDiaries: false
})
}
})
} else {
wx.showToast({
title: util.randomChoiceElement(['打捞可马虎不得~', '确实要谨慎对待~', '先想清楚再做决定~']),
icon: 'none',
})
that.setData({
isSalvagingDiaries: false
})
}
}
})
},
refreshPage() {
this.onLoad()
},
thumbUpDiary(){
let that = this
if (that.data.likeButtonDisabled){
wx.showToast({
title: util.randomChoiceElement(['我知道你真的特别有爱心~', '赶紧打捞下一篇情绪吧~']),
icon: 'none',
})
}else{
wx.cloud.callFunction({
name: 'updateDiary',
data: {
openId: app.globalData.openid,
diaryId: that.data.diaryId,
diaryOwnerOpenId: that.data.diaryOwnerOpenId,
pushThumbUpList: true
},
success: function (res) {
that.setData({
likeButtonDisabled: true,
likeImageSrc: '/images/like/like-on.png',
thumbUpNum: that.data.thumbUpNum + 1,
})
wx.showToast({
title: util.randomChoiceElement(['感谢您的爱心~ ❥(^_-)', '世界将因你变得更美好~', '赠人玫瑰,手有余香~']),
icon: 'none',
duration: 3000
})
console.log(res)
},
fail: function (res) {
wx.showToast({
title: '点赞失败 :(',
icon: 'none'
})
console.log(res)
}
})
}
},
onPullDownRefresh: function () {
this.refreshPage()
},
formatTime(result){
result.data.forEach((el,index) => {
if (el.createAt) {
result.data[index].createAt = util.formatTime(new Date(el.createAt))
}
})
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view
class="full-screen">
<view class="firstHeader" wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}">
漂流池内剩余 {{remainedSharedDiariesNum}} 篇情绪供您打捞~
</view>
<view class="header" wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}">
{{diaryAuthor}} 的情绪
</view>
<view class="diary" wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}">
<view class="container">
<text style="color: #3366FF; font-size: 14px">
{{diaryCreateAt}}
</text>
</view>
<view class="container" wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}">
<text style="font-size: 14px;margin: 10rpx 20rpx 20rpx 20rpx">
{{diaryContent}}
</text>
</view>
<view class="container" wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}">
<button
class="btn"
bindtap="thumbUpDiary">
<text>
已有 {{thumbUpNum}} 人点赞
</text>
<image src='{{likeImageSrc}}'/>
</button>
</view>
</view>
<button
wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}"
class="weui-btn primary-button"
type="primary"
disabled="{{isSalvagingDiaries}}"
bindtap="getSharedDiaries">
打捞情绪
</button>
<button
wx:if="{{isPageAuthorized && isOpenIdLoaded && !pageLoadFailed && isInfoLoaded}}"
class="weui-btn primary-button"
type="primary"
open-type="share">
邀请好友写情绪
</button>
<!-- <button
wx:if="{{isOpenIdLoaded}}"
class="weui-btn primary-button"
type="primary"
disabled="{{isSalvagingDiaries}}"
bindtap="getSharedDiaries">
打捞授权
</button> -->
<button
wx:if="{{isPageAuthorized && isOpenIdLoaded && pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="refreshPage">
刷新页面
</button>
<button
wx:if="{{!isPageAuthorized}}"
class="weui-btn"
style="background-color: #00BFFF"
type="primary"
bindtap="navigateToDiaryWritting">
先去写篇情绪吧~
</button>
</view>
此差异已折叠。
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
stableRankLoaded: false,
stableRank: [],
isOnLoadHappening: false,
currentUserRank: null,
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
stableFilter(stable) {
if (stable.emotionMoneyHistory){
return true
}else{
return false
}
},
setCurrentRank(stableRank){
let that = this
let currentUserOpenId = app.globalData.openid
for (let i = 0; i < stableRank.length; i++){
let rankOpenId = stableRank[i].openId
if (currentUserOpenId === rankOpenId){
that.setData({
currentUserRank: i
})
return
}
}
},
getRankToast(stableRank){
let that = this
let toast = '加油~'
if (that.data.currentUserRank !== null){
let title = stableRank[that.data.currentUserRank].rankTitle
let realRank = that.data.currentUserRank + 1
let nickName = stableRank[that.data.currentUserRank].nickName
toast = '财富榜第 ' + realRank + ', ' + title + ' ' + nickName + ''
}else{
toast = '您尚未出现在榜单中,快去做任务赚币吧~'
}
return toast
},
formatRank(result) {
result.forEach((el, index) => {
if (el.emotionMoneyHistory) {
result[index].emotionMoneyHistory =
util.round(el.emotionMoneyHistory, 1)
if (index < 1) {
result[index].rankTitle = '情绪至尊'
} else if (index < 5) {
result[index].rankTitle = '情绪天王'
} else if (index < 10) {
result[index].rankTitle = '情绪护法'
} else if (index < 20) {
result[index].rankTitle = '情绪护卫'
} else {
result[index].rankTitle = '情绪小兵'
}
}else{
console.log('元素不存在 emotionMoneyHistory 属性!')
}
})
},
onLoad: function() {
let that = this
that.setData({
isOnLoadHappening: true
})
wx.showLoading({
title: '正在加载榜单...',
})
//调用云函数拿情绪币榜单
wx.cloud.callFunction({
name: 'getEmotionMoneyRank',
data: {},
success: res => {
let stableRank = res.result.data
stableRank = stableRank.filter(that.stableFilter)
that.formatRank(stableRank)
that.setCurrentRank(stableRank)
that.setData({
stableRankLoaded: true,
stableRank,
isOnLoadHappening: false
})
let rankToast = that.getRankToast(stableRank)
wx.showToast({
title: rankToast,
icon: 'none',
duration: 3500
})
console.log('[云函数] [getStableRank] rank: ', that.data.stableRank)
},
fail: err => {
that.setData({
isOnLoadHappening: false
})
wx.showToast({
title: '加载失败...',
icon: 'none'
})
console.error('[云函数] [getStableRank] 调用失败', err)
}
})
},
onShow: function () {
let that = this
if (!that.data.isOnLoadHappening){
wx.showToast({
title: '顶部下拉可刷新榜单~',
icon: 'none'
})
}
},
onPullDownRefresh: function () {
let that = this
that.setData({
stableRank: []
})
that.onLoad()
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<view class="rankTitle">
情绪财富榜
</view>
<view wx:if="{{stableRankLoaded && stableRank.length < 1}}">
还没有人上榜呢~
</view>
</view>
<view
class="table"
wx:if="{{stableRankLoaded && stableRank.length > 0}}">
<view class="tr bg-w">
<view class="th">排名</view>
<view class="th">称谓</view>
<view class="th ">昵称</view>
<view class="th ">情绪总值</view>
</view>
<block
wx:for="{{stableRank}}"
wx:if="{{stableRank.length > 0}}"
wx:key="unique">
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr bg-g'}}"
wx:if="{{index % 2 == 0}}">
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.emotionMoneyHistory}}</view>
</view>
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr'}}"
wx:else>
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.emotionMoneyHistory}}</view>
</view>
</block>
</view>
/**index.wxss**/
.rankTitle{
color: #6666FF;
font-size: 22px;
margin:50rpx
}
.table {
border: 0px solid darkgray;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
font-size: 30rpx;
width:25%;
justify-content: center;
text-align: center;
}
.bg-w{
background: snow;
}
.bg-g{
background: #E6F3F9;
}
.bg-match{
background: #66CCFF;
}
.bg-match > view{
color: white;
}
.th {
width: 25%;
justify-content: center;
background: #66CCFF;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
//index.js
const app = getApp()
var util = require('../../utils/util.js');
Page({
data: {
greeting: '',
userInfo:{isLoaded: false},
inputDiary: '',
inputDiaryChineseWordNum: 0,
isDiaryShared: false,
diarylowerLimit: 10,
diaryUpperLimit: 100,
shareCheckBox: app.globalData.shareCheckBox || {
name: 'changeShareCheckBox',
value: '公开情绪赚双倍情绪币~',
checked: false
},
saveDiaryButtonDisabled: false,
authorizedButtonDisabled: false,
diariesPermitInterval: 1,
pageLoadFailed: false,
frontendFormat: 1,
isfrontendFormatLoaded: false,
emotionRadios: [{value: '我今天真的过得特别开心啊~', name: '开心', checked: true},
{ value: '我今天过得比较难过呢~', name: '难过'},
{ value: '今天真的是气死我了啊!', name: '愤怒' },
{ value: '哈哈哈哈今天心情真是不错~', name: '喜悦' }],
},
onLoad: async function (options) {
let that = this
let recommandOpenId = options.recommandOpenId
//console.log(recommandOpenId)
if (recommandOpenId){
app.globalData.recommandOpenId = recommandOpenId
}else{
// 埋坑
}
wx.showLoading({
title: '页面正在加载中...',
})
let isFromSearch = !(app.globalData.recommandOpenId)
console.log('是否来源于自然搜索(非用户推荐而来): ' + isFromSearch)
// change frontend format
await wx.cloud.callFunction({
name: 'changeFrontendFormat',
data: {isFromSearch},
success: res => {
app.globalData.frontendFormat = res.result
that.setData({
frontendFormat: res.result,
isfrontendFormatLoaded: true,
pageLoadFailed: false
})
console.log('[云函数] [frontendFormat] : ', app.globalData.frontendFormat)
},
fail: err => {
that.setData({
isfrontendFormatLoaded: false,
pageLoadFailed: true
})
console.error('[云函数] [frontendFormat] 调用失败', err)
}
})
// 调用云函数拿 openid
await wx.cloud.callFunction({
name: 'login',
data: {},
success: res => {
console.log('[云函数] [login] user openid: ', res.result.openid)
app.globalData.openid = res.result.openid
that.setData({
pageLoadFailed: false
})
},
fail: err => {
wx.showToast({
title: '您可能是断网了:(',
icon: 'none'
})
that.setData({
pageLoadFailed: true
})
console.error('[云函数] [login] 调用失败', err)
}
})
that.checkAuthSetting();
},
onShow: async function () {
let that = this
that.setData({
saveDiaryButtonDisabled: false,
authorizedButtonDisabled: false
})
that.getGreeting();
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
onRadioChange: function(e){
let that = this
let emotionRadios = [{ value: util.randomChoiceElement(app.globalData.preparedEmotions.happy), name: '开心'},
{ value: util.randomChoiceElement(app.globalData.preparedEmotions.sad), name: '难过' },
{ value: util.randomChoiceElement(app.globalData.preparedEmotions.angry), name: '愤怒' },
{ value: util.randomChoiceElement(app.globalData.preparedEmotions.cheerful), name: '喜悦' }]
that.setData({
inputDiary: e.detail.value,
emotionRadios
})
console.log(e)
},
shareCheckboxChange: function (e) {
let that = this
let isDiaryShared = e.detail.value.length > 0
that.setData({
isDiaryShared
})
// console.log('isDiaryShared值为:', that.data.isDiaryShared)
},
refreshPage(){
this.onLoad()
},
// 判断距离上一篇日记是否已经超过了一天(日期不同即可)
// checkDiaryPermit(openId, diariesPermitInterval){
// let that = this
// // 调用云函数拿 createAt
// wx.cloud.callFunction({
// name: 'checkDiaryPermit',
// data: {
// openId: openId,
// diariesPermitInterval: diariesPermitInterval
// },
// success: res => {
// that.setData({
// isPermitNewDiary: res
// })
// console.log('[云函数] [checkDiaryPermit] : ', res)
// },
// fail: err => {
// console.error('[云函数] [checkDiaryPermit] 调用失败', err)
// }
// })
// },
//获取问候语
getGreeting() {
let greeting = '';
let now = new Date(), hour = now.getHours();
if (hour < 5) { greeting = "你也睡不着吗 ):" }
else if (hour < 9) { greeting = "早上好~" }
else if (hour < 12) { greeting = "上午好~" }
else if (hour < 14) { greeting = "中午好~" }
else if (hour < 17) { greeting = "下午好~" }
else if (hour < 19) { greeting = "傍晚好~" }
else if (hour < 22) { greeting = "晚上好~" }
else { greeting = "早点休息 :)" }
this.setData({
greeting
})
},
// 检测权限,在旧版小程序若未授权会自己弹起授权
checkAuthSetting() {
let that = this
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: async (res) => {
if (res.userInfo) {
const userInfo = res.userInfo
// 将用户数据放在临时对象中,用于后续写入数据库
that.setUserTemp(userInfo)
app.globalData.userInfo = userInfo
}
const userInfo = that.data.userInfo || {}
userInfo.isLoaded = true
that.setData({
userInfo,
isAuthorized: true,
pageLoadFailed: false
})
console.log(that.data)
},
fail: async (res) => {
that.setData({
pageLoadFailed: true
})
console.log(res)
}
})
} else {
this.setData({
userInfo: {
isLoaded: true,
pageLoadFailed: false
}
})
}
wx.hideLoading()
},
fail: (res) => {
that.setData({
pageLoadFailed: true
})
console.log(res)
}
})
},
// 设置临时数据,待 “真正登录” 时将用户数据写入 collection "users" 中
setUserTemp(userInfo = null, isAuthorized = true, cb = () => { }) {
this.setData({
userTemp: userInfo,
isAuthorized,
}, cb)
},
// 查看是否是新用户
// async isNewUser(openId){
// wx.cloud.callFunction({
// name: 'checkUser',
// data: {
// openId: openId
// },
// success: res => {
// console.log('[云函数] [checkUser]: 调用成功', res)
// if (res.total && res.total > 0){
// return false
// }else{
// return true
// }
// },
// fail: err => {
// console.error('[云函数] [checkUser] 调用失败', err)
// return true
// }
// })
// },
// 手动获取用户数据
async bindGetUserInfoNew(e) {
let that = this
if (!e.detail.userInfo){
wx.showToast({
title: '授权一下嘛~',
icon: 'none'
})
}else{
that.setData({
authorizedButtonDisabled: true
})
wx.showToast({
title: '授权成功:)',
})
const userInfo = e.detail.userInfo
// 将用户数据放在临时对象中,用于后续写入数据库
this.setUserTemp(userInfo)
app.globalData.userInfo = userInfo
let createUserData = {
openId: app.globalData.openid,
userInfo: this.data.userTemp
}
if (app.globalData.recommandOpenId){
createUserData.recommandOpenId = app.globalData.recommandOpenId
}
// 调用云函数新建用户
wx.cloud.callFunction({
name: 'createUser',
data: createUserData,
success: res => {
console.log('[云函数] [createUser]: 调用成功', res)
},
fail: err => {
console.error('[云函数] [createUser] 调用失败', err)
}
})
}
},
checkChineseWord: function (str, lowerLimit = this.data.diarylowerLimit, upperLimit = this.data.diaryUpperLimit){
let checkResult = {'status': 'ok', 'showToast': ''}
let re = /[\u4E00-\u9FA5]/g
if (str && re.test(str)){
if (str.match(re).length < lowerLimit){
checkResult.status = 'failed'
checkResult.showToast = '请输入至少 ' + lowerLimit + ' 个汉字~'
return checkResult
} else if (str.match(re).length > upperLimit){
checkResult.status = 'failed'
checkResult.showToast = '最多只能输入 ' + upperLimit + ' 个汉字哦~'
return checkResult
}else{
return checkResult
}
}else{
checkResult.status = 'failed'
checkResult.showToast = '请输入汉字~'
return checkResult
}
},
getChineseWordNum: function(str){
let re = /[\u4E00-\u9FA5]/g
if (str && re.test(str)){
return str.match(re).length
}else{
return 0
}
},
bindDiaryInput: function (e) {
this.setData({
inputDiary: e.detail.value
})
let chineseWordNum = this.getChineseWordNum(this.data.inputDiary)
this.setData({
inputDiaryChineseWordNum: chineseWordNum
})
},
sendDiary: function(){
let that = this
wx.cloud.callFunction({
name: 'sendDiary',
data: {
createAt: new Date(),
nickName: that.data.userTemp.nickName,
gender: that.data.userTemp.gender,
avatarUrl: that.data.userTemp.avatarUrl,
openId: app.globalData.openid,
diary: that.data.inputDiary,
isDiaryShared: that.data.isDiaryShared,
diariesPermitInterval: that.data.diariesPermitInterval,
},
success: function (res) {
if (res.result === 'notPermitted'){
that.setData({
saveDiaryButtonDisabled: false,
})
wx.showToast({
title: '你今天已经写过情绪啦~',
icon: 'none'
})
}else{
app.globalData.needToLoadDiaries = true
wx.showToast({
title: '保存成功',
duration: 1000
})
console.log(res)
let diaryId = res.result._id
let diaryOwner = that.data.userTemp.nickName
wx.showLoading({
title: '页面跳转中...',
})
that.setData({
inputDiary: '',
inputDiaryChineseWordNum: 0
})
wx.navigateTo({
url: '../diaryDetail/diaryDetail?diaryId='
+ diaryId + '&diaryOwner=' + diaryOwner + '&fromMy=0',
})
wx.hideLoading()
}
},
fail: function (res) {
that.setData({
saveDiaryButtonDisabled: false,
})
wx.showToast({
title: '保存失败:(',
icon: 'none'
})
console.log(res)
}
})
},
saveDiary: function(){
let that = this
let inputDiary = that.data.inputDiary
let checkDiaryContent = that.checkChineseWord(inputDiary)
if (checkDiaryContent.status === 'ok'){
wx.requestSubscribeMessage({
tmplIds: ['-csBIWqHbI1ConN8VY5WaXt3lJf60dHJjcOoGjl6I2E'],
success(res) {
if (res['-csBIWqHbI1ConN8VY5WaXt3lJf60dHJjcOoGjl6I2E'] === 'accept'){
console.log('有人接受了签到提醒: ' + app.globalData.openid)
// 更新 User 数据
wx.cloud.callFunction({
name: 'updateUser',
data: {
openId: app.globalData.openid,
isSubscribeMessage: true,
},
success: function (res) {
console.log(res)
},
fail: function (res) {
console.log(res)
}
})
} else if (res['-csBIWqHbI1ConN8VY5WaXt3lJf60dHJjcOoGjl6I2E'] === 'reject'){
console.log('有人拒绝了签到提醒: ' + app.globalData.openid)
}
}
})
wx.showModal({
title: '保存后不可更改哦~',
content: '点击确定保存',
success: function (res) {
if (res.confirm){
that.setData({
saveDiaryButtonDisabled: true,
})
wx.showLoading({
title: '保存中...'
})
that.sendDiary()
}else{
wx.showToast({
title: util.randomChoiceElement(['情绪可马虎不得~', '确实要谨慎对待~', '先想清楚再做决定~']),
icon: 'none',
})
}
}
})
}else{
wx.showToast({
title: checkDiaryContent.showToast,
icon: 'none',
})
}
},
})
{
"usingComponents": {}
}
\ No newline at end of file
<!--index.wxml-->
<view class="full-screen" wx:if="{{isfrontendFormatLoaded}}">
<div
wx:if="{{userInfo.isLoaded}}"
style="color: #6666FF;font-size: 22px; margin-bottom:100rpx">
{{userTemp.nickName ? userTemp.nickName: '陌生人'}}, {{greeting}}
</div>
<div class="weui-cell" wx:if="{{userInfo.isLoaded && frontendFormat === 1 }}">
<div class="weui-cell__bd">
<textarea bindinput="bindDiaryInput" class="weui-textarea" placeholder="用简短的话概括今天的经历与心情" rows="3" fixed='true' style="color: #333399; background-color: #EFEFEF" value="{{inputDiary}}" ></textarea>
<div class="weui-textarea-counter"><span>{{inputDiaryChineseWordNum}}</span>/{{diaryUpperLimit}}</div>
</div>
</div>
<div class="weui-cell" wx:if="{{userInfo.isLoaded && frontendFormat === 0 }}">
<div class="weui-cell__bd">
<textarea disabled='true' placeholder="请在下方选择您的情绪~" bindinput="bindDiaryInput" class="weui-textarea" rows="3" fixed='true' style="color: #333399; background-color: #EFEFEF" value="{{inputDiary}}" ></textarea>
</div>
</div>
<radio-group style="margin-top:30rpx;" wx:if="{{userInfo.isLoaded && frontendFormat === 0 }}" bindchange="onRadioChange">
<radio class="radio" style="margin:10rpx;" wx:key="name" wx:for-items="{{emotionRadios}}" value="{{item.value}}" checked="{{item.checked}}">
<text>{{item.name}} </text>
</radio>
</radio-group>
<checkbox-group style="margin-top:30rpx;" wx:if="{{userInfo.isLoaded}}" bindchange="shareCheckboxChange">
<!-- <label class="checkbox" wx:for="{{items}}"> -->
<checkbox style="width:400rpx;" value="{{shareCheckBox.name}}" checked="{{shareCheckBox.checked}}">
{{shareCheckBox.value}}
</checkbox>
<!-- </label> -->
</checkbox-group>
<button
wx:if="{{!userInfo.isLoaded && pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 80rpx"
type="primary"
bindtap="refreshPage"
>
刷新页面
</button>
<button
wx:if="{{userInfo.isLoaded && isAuthorized && userTemp.nickName}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 80rpx"
type="primary"
disabled="{{saveDiaryButtonDisabled}}"
bindtap="saveDiary">
保存心情
</button>
<button
wx:if="{{userInfo.isLoaded && !isAuthorized && !userTemp.nickName}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 80rpx"
type="primary"
open-type="getUserInfo"
disabled="{{authorizedButtonDisabled}}"
bindgetuserinfo="bindGetUserInfoNew"
>
保存授权
</button>
<view
wx:if="{{userInfo.isLoaded}}"
style="font-size:10px; margin-top: 50rpx" >
<navigator style="align-items: center;" open-type="navigate" url="/pages/userProtocol/userProtocol">
使用本小程序,即表示接受 <text style="color: orange;text-decoration: underline">用户协议</text>
</navigator>
</view>
</view>
<view>
<button
wx:if="{{!isfrontendFormatLoaded && pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 80rpx"
type="primary"
bindtap="refreshPage"
>
刷新页面
</button>
</view>
/**index.wxss**/
page {
background: #f6f6f6;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.userinfo, .uploader, .tunnel {
margin-top: 40rpx;
height: 140rpx;
width: 100%;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.1);
border-left: none;
border-right: none;
display: flex;
flex-direction: row;
align-items: center;
transition: all 300ms ease;
}
.userinfo {
padding-left: 120rpx;
}
.userinfo-avatar {
width: 100rpx;
height: 100rpx;
margin: 20rpx;
border-radius: 50%;
background-size: cover;
background-color: white;
}
.userinfo-avatar[size] {
width: 100rpx;
}
.userinfo-avatar:after {
border: none;
}
.userinfo-nickname {
font-size: 32rpx;
color: #007aff;
background-color: white;
background-size: cover;
text-align: left;
padding-left: 0;
margin-left: 10px;
}
.userinfo-nickname::after {
border: none;
}
.userinfo-nickname-wrapper {
flex: 1;
}
.uploader, .tunnel {
height: auto;
padding: 0 0 0 40rpx;
flex-direction: column;
align-items: flex-start;
box-sizing: border-box;
}
.uploader-text, .tunnel-text {
width: 100%;
line-height: 52px;
font-size: 34rpx;
color: #007aff;
}
.uploader-container {
width: 100%;
height: 400rpx;
padding: 20rpx 20rpx 20rpx 0;
display: flex;
align-content: center;
justify-content: center;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.uploader-image {
width: 100%;
height: 360rpx;
}
.tunnel {
padding: 0 0 0 40rpx;
}
.tunnel-text {
position: relative;
color: #222;
display: flex;
flex-direction: row;
align-content: center;
justify-content: space-between;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.tunnel-text:first-child {
border-top: none;
}
.tunnel-switch {
position: absolute;
right: 20rpx;
top: -2rpx;
}
.disable {
color: #888;
}
.service {
position: fixed;
right: 40rpx;
bottom: 40rpx;
width: 140rpx;
height: 140rpx;
border-radius: 50%;
background: linear-gradient(#007aff, #0063ce);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
display: flex;
align-content: center;
justify-content: center;
transition: all 300ms ease;
}
.service-button {
position: absolute;
top: 40rpx;
}
.service:active {
box-shadow: none;
}
.request-text {
padding: 20rpx 0;
font-size: 24rpx;
line-height: 36rpx;
word-break: break-all;
}
.full-screen{
position: fixed;
height: 100%;
width: 100%;
display:flex;
flex-direction:column;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
.header{
position: fixed;
height: 100%;
width: 100%;
margin-top: 120rpx;
display:flex;
flex-direction:row;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
greeting:'你好',
isPageAuthorized: false,
isUserInfoLoaded: false,
avatarUrl: './user-unlogin.png',
nickName: '陌生人',
},
navigateToDiaryWritting() {
wx.switchTab({
url: '../index/index',
})
},
onPullDownRefresh: function () {
let that = this
that.onShow()
},
refreshPage: function () {
let that = this
that.onShow()
},
onShow: function(){
wx.showLoading({
title: '页面加载中...',
})
let that = this
that.getGreeting()
if (app.globalData.userInfo) {
that.setData({
isPageAuthorized: true,
avatarUrl: app.globalData.userInfo.avatarUrl,
nickName: app.globalData.userInfo.nickName,
})
}
if (app.globalData.openid){
//调用云函数拿用户信息
wx.cloud.callFunction({
name: 'getUser',
data: { openId: app.globalData.openid},
success: res => {
if(res){
let userInfo = res.result.data[0]
if (userInfo.emotionMoney){
userInfo.emotionMoney = util.round(userInfo.emotionMoney, 1)
}
that.setData({
userInfo,
isUserInfoLoaded: true
})
app.globalData.userData = userInfo
wx.hideLoading()
}else{
that.setData({
isUserInfoLoaded: false
})
wx.showToast({
title: '加载失败 :(',
icon: 'none'
})
}
console.log('[云函数] [getUser]: ', res)
},
fail: err => {
that.setData({
isUserInfoLoaded: false
})
wx.showToast({
title: '加载失败 :(',
icon: 'none'
})
console.error('[云函数] [getUser] 调用失败', err)
}
})
}else{
wx.showToast({
title: '页面还没有准备好哦~请刷新一下',
icon: 'none',
duration: 4000
})
}
},
//获取问候语
getGreeting() {
let greeting = '';
let now = new Date(), hour = now.getHours();
if (hour < 5) { greeting = "你也睡不着吗 ):" }
else if (hour < 9) { greeting = "早上好~" }
else if (hour < 12) { greeting = "上午好~" }
else if (hour < 14) { greeting = "中午好~" }
else if (hour < 17) { greeting = "下午好~" }
else if (hour < 19) { greeting = "傍晚好~" }
else if (hour < 22) { greeting = "晚上好~" }
else { greeting = "早点休息 :)" }
this.setData({
greeting
})
},
})
{
"usingComponents": {}
}
\ No newline at end of file
<!--index.wxml-->
<view class="container" >
<!-- 用户 openid -->
<view class="userinfo">
<button
bindtap="navigateToDiaryWritting"
class="userinfo-avatar"
style="background-image: url({{avatarUrl}})"
size="default"
></button>
<view class="userinfo-nickname-wrapper">
<button class="userinfo-nickname" bindtap="navigateToDiaryWritting">
{{nickName}}, {{greeting}}
</button>
</view>
</view>
<!-- 我的情绪 -->
<view class="uploader" wx:if="{{isPageAuthorized && isUserInfoLoaded}}">
<navigator url="../myDiaries/myDiaries" open-type="navigate" class="uploader-text">
<text>我的情绪</text>
</navigator>
</view>
<!-- 我的使命 -->
<view class="uploader" wx:if="{{isPageAuthorized && isUserInfoLoaded}}">
<navigator url="../myMission/myMission" open-type="navigate" class="uploader-text">
<text>我的使命</text>
</navigator>
</view>
<!-- 我的成就 -->
<view class="uploader" wx:if="{{isPageAuthorized && isUserInfoLoaded}}">
<navigator url="../myHonor/myHonor" open-type="navigate" class="uploader-text">
<text>我的成就</text>
</navigator>
</view>
<!-- 情绪提醒 -->
<view class="uploader" wx:if="{{isPageAuthorized && isUserInfoLoaded}}">
<navigator url="../myHonor/myHonor" open-type="navigate" class="uploader-text">
<text>我的成就</text>
</navigator>
</view>
<!-- 我的情绪币 -->
<view wx:if="{{isPageAuthorized && isUserInfoLoaded}}" class="container">
<image src="/images/gold.png"/>
</view>
<view class="emotion-money" wx:if="{{isPageAuthorized && isUserInfoLoaded}}">
<!-- <view class="emotion-money" wx:if="{{isPageAuthorized}}"> -->
<!-- <text>历史情绪币:{{userInfo.emotionMoneyHistory}}</text> -->
<text>我的情绪币:{{userInfo.emotionMoney || 0}}¥</text>
</view>
<button
wx:if="{{!isPageAuthorized && isUserInfoLoaded}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top:150rpx"
type="primary"
bindtap="navigateToDiaryWritting">
先去写篇情绪吧~
</button>
<button
wx:if="{{!isUserInfoLoaded}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top:150rpx"
type="primary"
bindtap="refreshPage">
刷新页面
</button>
</view>
/**index.wxss**/
.emotion-money > text{
font-size: 18px;
color: #007aff;
margin: 30rpx;
}
.emotion-money{
margin: 60rpx 10rpx 60rpx 10rpx;
flex-direction: column
}
.container > image{
margin-top: 60rpx;
width: 100rpx;
height: 100rpx;
}
page {
background: #f6f6f6;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.userinfo, .uploader, .tunnel {
margin-top: 40rpx;
height: 140rpx;
width: 100%;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.1);
border-left: none;
border-right: none;
display: flex;
flex-direction: row;
align-items: center;
transition: all 300ms ease;
}
.userinfo {
padding-left: 120rpx;
}
.userinfo-avatar {
width: 100rpx;
height: 100rpx;
margin: 20rpx;
border-radius: 50%;
background-size: cover;
background-color: white;
}
.userinfo-avatar[size] {
width: 100rpx;
}
.userinfo-avatar:after {
border: none;
}
.userinfo-nickname {
font-size: 32rpx;
color: #007aff;
background-color: white;
background-size: cover;
text-align: left;
padding-left: 0;
margin-left: 10px;
}
.userinfo-nickname::after {
border: none;
}
.userinfo-nickname-wrapper {
flex: 1;
}
.uploader, .tunnel {
height: auto;
padding: 0 0 0 40rpx;
flex-direction: column;
align-items: flex-start;
box-sizing: border-box;
}
.uploader-text, .tunnel-text {
width: 100%;
line-height: 52px;
font-size: 34rpx;
color: #007aff;
}
.uploader-container {
width: 100%;
height: 400rpx;
padding: 20rpx 20rpx 20rpx 0;
display: flex;
align-content: center;
justify-content: center;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.uploader-image {
width: 100%;
height: 360rpx;
}
.tunnel {
padding: 0 0 0 40rpx;
}
.tunnel-text {
position: relative;
color: #222;
display: flex;
flex-direction: row;
align-content: center;
justify-content: space-between;
box-sizing: border-box;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.tunnel-text:first-child {
border-top: none;
}
.tunnel-switch {
position: absolute;
right: 20rpx;
top: -2rpx;
}
.disable {
color: #888;
}
.service {
position: fixed;
right: 40rpx;
bottom: 40rpx;
width: 140rpx;
height: 140rpx;
border-radius: 50%;
background: linear-gradient(#007aff, #0063ce);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
display: flex;
align-content: center;
justify-content: center;
transition: all 300ms ease;
}
.service-button {
position: absolute;
top: 40rpx;
}
.service:active {
box-shadow: none;
}
.request-text {
padding: 20rpx 0;
font-size: 24rpx;
line-height: 36rpx;
word-break: break-all;
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
diaries:[],
pageLoadFailed: false,
},
onLoad: function() {
// 调用云函数拿 openid
// wx.cloud.callFunction({
// name: 'login',
// data: {},
// success: res => {
// console.log('[云函数] [login] user openid: ', res.result.openid)
// app.globalData.openid = res.result.openid
// },
// fail: err => {
// console.error('[云函数] [login] 调用失败', err)
// }
// })
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
navigateToDiaryWritting(){
wx.switchTab({
url: '../index/index',
})
},
onShow: function() {
// 调用云函数拿 openid
wx.cloud.callFunction({
name: 'login',
data: {},
success: res => {
console.log('[云函数] [login] user openid: ', res.result.openid)
app.globalData.openid = res.result.openid
},
fail: err => {
console.error('[云函数] [login] 调用失败', err)
}
})
let that = this
if (app.globalData.needToLoadDiaries){
if (app.globalData.openid){
wx.showLoading({
title: '加载情绪中...',
})
// 调用云函数拿 diaries
wx.cloud.callFunction({
name: 'getDiaries',
data: { _openId: app.globalData.openid },
success: res => {
wx.hideLoading()
app.globalData.needToLoadDiaries = false
that.formatTime(res.result)
that.setData({
pageLoadFailed: false,
diaries: res.result
})
console.log('[云函数] [getDiaries] diaries: ', that.data.diaries)
},
fail: err => {
wx.showToast({
title: '加载失败 :(',
icon: 'none'
})
that.setData({
pageLoadFailed: true
})
console.error('[云函数] [getDiaries] 调用失败', err)
}
})
}else{
wx.showToast({
title: '情绪还没准备好呢~',
icon: 'none',
duration: 3000
})
that.setData({
pageLoadFailed: true
})
}
}else{
wx.showToast({
title: '顶部下拉可刷新情绪~',
icon: 'none',
duration: 3000
})
}
},
refreshPage(){
app.globalData.needToLoadDiaries = true
this.onShow()
},
onPullDownRefresh: function () {
app.globalData.needToLoadDiaries = true
let that = this
that.setData({
diaries: [],
pageLoadFailed: false
})
that.onShow()
},
formatTime(result){
result.data.forEach((el,index) => {
if (el.createAt) {
result.data[index].createAt = util.formatTime(new Date(el.createAt))
}
})
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container" style="color: #6666FF;font-size: 22px; margin:50rpx">
我的情绪
</view>
<view
wx:key="unique"
wx:for="{{diaries.data}}"
wx:if="{{diaries.data.length > 0}}">
<view class="diary">
<navigator
open-type="navigate"
url="/pages/diaryDetail/diaryDetail?diaryId={{item._id}}&diaryOwner={{item.nickName}}&fromMy=1">
<view class="container">
<image class="lock-or-public" wx:if="{{!item.isShared}}" src="/images/lock.png"/>
<view class="container" wx:if="{{item.isShared}}">
<image class="lock-or-public" src="/images/public.png"/>
</view>
<text style="color: #3366FF; font-size: 14px">
{{item.createAt}}
</text>
</view>
<view class="container">
<text style="font-size: 14px;margin: 20rpx 50rpx 50rpx 50rpx">
{{item.diary}}
</text>
<text wx:if="{{item.isShared}}" style="color: #333399; font-size: 14px; margin-bottom: 50rpx">
已有 {{item.thumbUpNum || 0}} 人点赞
</text>
</view>
</navigator>
</view>
</view>
<button
wx:if="{{pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="refreshPage">
刷新页面
</button>
<button
wx:if="{{diaries.data.length == 0}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="navigateToDiaryWritting">
写情绪
</button>
\ No newline at end of file
/**index.wxss**/
.full-screen{
position: fixed;
height: 100%;
width: 100%;
display:flex;
flex-direction:column;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
.diary{
/* position: fixed;
height: 100%;
width: 100%; */
background-color: white;
color:cornflowerblue;
margin: 30rpx 50rpx;
flex-direction:rows;
}
.lock-or-public{
width: 60rpx;
height: 60rpx;
margin-top: 30rpx
}
\ No newline at end of file
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
honorCreateAt: '',
honorContent: '',
pageLoadFailed: false,
},
onShow: function() {
wx.showLoading({
title: '页面加载中...',
icon: 'none'
})
let that = this
if (app.globalData.userData){
that.setData({
userInfo: app.globalData.userData,
pageLoadFailed: false
})
that.getHonorCreateAt()
that.getHonorContent()
wx.hideLoading()
}else{
that.setData({
pageLoadFailed: true
})
wx.showToast({
title: '加载失败...',
icon: 'none'
})
}
},
getHonorCreateAt() {
let that = this
that.setData({
honorCreateAt: util.formatTime(new Date())
})
},
previewDonationImage: function () {
wx.previewImage({
urls: ['cloud://emtionfreecloud-gai22.656d-emtionfreecloud-gai22-1300907052/images/BuddhaDonation.jpg']
});
},
getHonorContent(){
let that = this
let now = new Date()
let userInfo = that.data.userInfo
let accompanyTime = Math.floor((now - new Date(userInfo.createAt)) / (24 * 60 * 60 * 1000)) || 0
let diariesNum = userInfo.diariesNum || 0
let currentSuccessiveDiariesNum = userInfo.currentSuccessiveDiariesNum || 0
let emotionMoneyHistory = userInfo.emotionMoneyHistory || 0
let salvageDiariesNum = userInfo.salvageDiariesNum || 0
let thumbUpDiariesNum = userInfo.thumbUpDiariesNum || 0
let recommandEmotionDiariesNum = userInfo.recommandEmotionDiariesNum || 0
let honorSentence_1 = '不知不觉,我已经与情绪小日记携手度过了 ' + accompanyTime + ' 天。'
let honorSentence_2 = '在这段旅程中,我一共写了 ' + diariesNum + ' 篇情绪,'
let honorSentence_3 = '我现在已经连续坚持 ' + currentSuccessiveDiariesNum + ' 天不断更了。'
let honorSentence_4 = '目前为止,我已经收获了 ' + util.round(emotionMoneyHistory, 1) + ' 枚情绪币,'
let honorSentence_5 = '邀请好友创造了 ' + recommandEmotionDiariesNum + ' 篇情绪,'
let honorSentence_6 = '成功打捞了 ' + salvageDiariesNum + ' 篇情绪,'
let honorSentence_7 = '给其中 ' + thumbUpDiariesNum + ' 篇情绪赠予了我的爱心。'
let honorSentence_8 = '在接下来的日子里,我会与情绪小日记共同前行,为这个世界传播更多的爱与善意。'
let honorContent = honorSentence_1 + honorSentence_2 + honorSentence_3 + honorSentence_4 + honorSentence_5 + honorSentence_6 + honorSentence_7 + honorSentence_8
that.setData({
honorContent
})
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
navigateToDiaryWritting(){
wx.switchTab({
url: '../index/index',
})
},
refreshPage(){
this.onShow()
},
onPullDownRefresh: function () {
},
formatTime(result){
result.data.forEach((el,index) => {
if (el.createAt) {
result.data[index].createAt = util.formatTime(new Date(el.createAt))
}
})
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container" style="color: #6666FF;font-size: 22px; margin:50rpx">
我的成就
</view>
<div
class="diary">
<view class="container">
<text class="dairyCreateAt">
{{honorCreateAt}}
</text>
</view>
<view class="container">
<text class="dairyContent">
{{honorContent}}
</text>
</view>
<view class="container">
<image src="/images/like/like-on.png" style="width:77rpx; height:77rpx; margin:30rpx"></image>
</view>
</div>
<button
wx:if="{{pageLoadFailed}}"
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="refreshPage">
刷新页面
</button>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
bindtap="previewDonationImage">
<text style="color: white" >给情绪小日记善意</text>
</button>
</view>
/*/**index.wxss**/
.full-screen{
position: fixed;
height: 100%;
width: 100%;
display:flex;
flex-direction:column;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
.diary{
/* position: fixed;
height: 100%;
width: 100%; */
background-color: white;
color:cornflowerblue;
margin: 30rpx 50rpx;
flex-direction:rows;
}
.dairyCreateAt{
color: #3366FF;
font-size: 14px
}
.dairyContent{
font-size: 14px;
margin: 10rpx 50rpx 30rpx 50rpx
}
.diary > text{
margin: 50rpx
}
\ No newline at end of file
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
diaries:[],
pageLoadFailed: false,
},
onLoad: function() {
// 调用云函数拿 openid
// wx.cloud.callFunction({
// name: 'login',
// data: {},
// success: res => {
// console.log('[云函数] [login] user openid: ', res.result.openid)
// app.globalData.openid = res.result.openid
// },
// fail: err => {
// console.error('[云函数] [login] 调用失败', err)
// }
// })
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
previewDonationImage: function () {
wx.previewImage({
urls: ['cloud://emtionfreecloud-gai22.656d-emtionfreecloud-gai22-1300907052/images/BuddhaDonation.jpg']
});
},
navigateToDrift(){
wx.switchTab({
url: '../drift/index',
})
},
navigateToRank() {
wx.switchTab({
url: '../rank/index',
})
},
onShow: function() {
},
refreshPage(){
this.onShow()
},
onPullDownRefresh: function () {
},
navigateToDiaryWritting() {
wx.switchTab({
url: '../index/index',
})
},
formatTime(result){
result.data.forEach((el,index) => {
if (el.createAt) {
result.data[index].createAt = util.formatTime(new Date(el.createAt))
}
})
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container" style="color: #6666FF;font-size: 22px; margin:50rpx">
我的使命
</view>
<view class="uploader">
<text class="uploader-text">写心情并生成情绪后将根据佛系值获得情绪币,若选择公开情绪,则可获得双倍情绪币。并且公开的情绪每获得一次点赞时,您将获得 10 情绪币的奖励。</text>
</view>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
bindtap="navigateToDiaryWritting" >
<text style="color: white" >写情绪</text>
</button>
</view>
<view class="uploader">
<text class="uploader-text">邀请好友写情绪,你将获得好友写情绪获得情绪币的 20% 。</text>
</view>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
open-type="share" >
<text style="color: white" >邀请好友写情绪</text>
</button>
</view>
<view class="uploader">
<text class="uploader-text">打捞情绪不仅可以感受别人的喜怒哀乐,也可以以点赞的形式给他人传播您的善意与关怀~ 快去打捞情绪吧!</text>
</view>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
bindtap="navigateToDrift" >
<text style="color: white" >打捞情绪</text>
</button>
</view>
<view class="uploader">
<text class="uploader-text">你是佛系至尊、情绪首富、打捞狂人还是毅力达人?快去排行榜上看看吧!</text>
</view>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
bindtap="navigateToRank" >
<text style="color: white" >查看排行榜</text>
</button>
</view>
<view class="uploader">
<text class="uploader-text">如果有什么话想跟作者说,可以点这个按钮哟~</text>
</view>
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin: 50rpx"
type="primary"
bindtap="previewDonationImage">
<text style="color: white" >给作者善意</text>
</button>
</view>
\ No newline at end of file
/**index.wxss**/
.full-screen{
position: fixed;
height: 100%;
width: 100%;
display:flex;
flex-direction:column;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
}
.uploader, .tunnel {
height: auto;
padding: 0 0 0 40rpx;
flex-direction: column;
align-items: flex-start;
box-sizing: border-box;
}
.uploader-text, .tunnel-text {
width: 100%;
line-height: 40px;
font-size: 34rpx;
color: #007aff;
}
\ No newline at end of file
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
navigateToBuddhaRank(){
wx.navigateTo({
url: '../buddhaRank/buddhaRank',
})
},
navigateToMoneyRank() {
wx.navigateTo({
url: '../emotionMoneyRank/emotionMoneyRank',
})
},
navigateToSalvageRank() {
wx.navigateTo({
url: '../salvageRank/salvageRank',
})
},
navigateToSuccessiveRank() {
wx.navigateTo({
url: '../successiveDiariesRank/successiveDiariesRank',
})
},
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<button
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="navigateToBuddhaRank">
前往佛系榜
</button>
<button
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="navigateToMoneyRank">
前往财富榜
</button>
<button
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="navigateToSalvageRank">
前往捞神榜
</button>
<button
class="weui-btn"
style="background-color: #00BFFF; margin-top: 120rpx"
type="primary"
bindtap="navigateToSuccessiveRank">
前往情毅榜
</button>
</view>
/**index.wxss**/
.rankTitle{
color: #6666FF;
font-size: 22px;
margin:50rpx
}
.table {
border: 0px solid darkgray;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
font-size: 30rpx;
width:25%;
justify-content: center;
text-align: center;
}
.bg-w{
background: snow;
}
.bg-g{
background: #E6F3F9;
}
.bg-match{
background: #66CCFF;
}
.bg-match > view{
color: white;
}
.th {
width: 25%;
justify-content: center;
background: #66CCFF;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
stableRankLoaded: false,
stableRank: [],
isOnLoadHappening: false,
currentUserRank: null,
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
stableFilter(stable) {
if (stable.salvageDiariesNum) {
return true
} else {
return false
}
},
setCurrentRank(stableRank) {
let that = this
let currentUserOpenId = app.globalData.openid
for (let i = 0; i < stableRank.length; i++) {
let rankOpenId = stableRank[i].openId
if (currentUserOpenId === rankOpenId) {
that.setData({
currentUserRank: i
})
return
}
}
},
getRankToast(stableRank) {
let that = this
let toast = '加油~'
if (that.data.currentUserRank !== null) {
let title = stableRank[that.data.currentUserRank].rankTitle
let realRank = that.data.currentUserRank + 1
let nickName = stableRank[that.data.currentUserRank].nickName
toast = '打捞榜第 ' + realRank + ', ' + title + ' ' + nickName + ''
} else {
toast = '您尚未出现在榜单中,快去打捞日记吧~'
}
return toast
},
formatRank(result) {
result.forEach((el, index) => {
if (el.salvageDiariesNum) {
result[index].salvageDiariesNum =
util.round(el.salvageDiariesNum, 1)
if (index < 1) {
result[index].rankTitle = '捞神至尊'
} else if (index < 5) {
result[index].rankTitle = '捞神天王'
} else if (index < 10) {
result[index].rankTitle = '捞神护法'
} else if (index < 20) {
result[index].rankTitle = '捞神护卫'
} else {
result[index].rankTitle = '捞神小兵'
}
} else {
console.log('元素不存在 salvageDiariesNum 属性!')
}
})
},
onLoad: function () {
let that = this
that.setData({
isOnLoadHappening: true
})
wx.showLoading({
title: '正在加载榜单...',
})
//调用云函数拿情绪币榜单
wx.cloud.callFunction({
name: 'getSalvageRank',
data: {},
success: res => {
console.log(res)
let stableRank = res.result.data
stableRank = stableRank.filter(that.stableFilter)
that.formatRank(stableRank)
that.setCurrentRank(stableRank)
that.setData({
stableRankLoaded: true,
stableRank,
isOnLoadHappening: false
})
let rankToast = that.getRankToast(stableRank)
wx.showToast({
title: rankToast,
icon: 'none',
duration: 3500
})
console.log('[云函数] [getStableRank] rank: ', that.data.stableRank)
},
fail: err => {
that.setData({
isOnLoadHappening: false
})
wx.showToast({
title: '加载失败...',
icon: 'none'
})
console.error('[云函数] [getStableRank] 调用失败', err)
}
})
},
onShow: function () {
let that = this
if (!that.data.isOnLoadHappening) {
wx.showToast({
title: '顶部下拉可刷新榜单~',
icon: 'none'
})
}
},
onPullDownRefresh: function () {
let that = this
that.setData({
stableRank: []
})
that.onLoad()
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<view class="rankTitle">
情绪捞神榜
</view>
<view wx:if="{{stableRankLoaded && stableRank.length < 1}}">
还没有人上榜呢~
</view>
</view>
<view
class="table"
wx:if="{{stableRankLoaded && stableRank.length > 0}}">
<view class="tr bg-w">
<view class="th">排名</view>
<view class="th">称谓</view>
<view class="th ">昵称</view>
<view class="th ">打捞次数</view>
</view>
<block
wx:for="{{stableRank}}"
wx:if="{{stableRank.length > 0}}"
wx:key="unique">
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr bg-g'}}"
wx:if="{{index % 2 == 0}}">
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.salvageDiariesNum}}</view>
</view>
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr'}}"
wx:else>
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.salvageDiariesNum}}</view>
</view>
</block>
</view>
/**index.wxss**/
.rankTitle{
color: #6666FF;
font-size: 22px;
margin:50rpx
}
.table {
border: 0px solid darkgray;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
font-size: 30rpx;
width:25%;
justify-content: center;
text-align: center;
}
.bg-w{
background: snow;
}
.bg-g{
background: #E6F3F9;
}
.bg-match{
background: #66CCFF;
}
.bg-match > view{
color: white;
}
.th {
width: 25%;
justify-content: center;
background: #66CCFF;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
//index.js
const app = getApp()
const util = require('../../utils/util.js');
Page({
data: {
stableRankLoaded: false,
stableRank: [],
isOnLoadHappening: false,
currentUserRank: null,
},
onShareAppMessage() {
return {
title: app.globalData.shareTitle,
path: '/pages/index/index?recommandOpenId=' + app.globalData.openid, //分享页面路径
imageUrl: app.globalData.shareImg //分享图片 宽高比 5:4
}
},
stableFilter(stable) {
if (stable.currentSuccessiveDiariesNum) {
return true
} else {
return false
}
},
setCurrentRank(stableRank) {
let that = this
let currentUserOpenId = app.globalData.openid
for (let i = 0; i < stableRank.length; i++) {
let rankOpenId = stableRank[i].openId
if (currentUserOpenId === rankOpenId) {
that.setData({
currentUserRank: i
})
return
}
}
},
getRankToast(stableRank) {
let that = this
let toast = '加油~'
if (that.data.currentUserRank !== null) {
let title = stableRank[that.data.currentUserRank].rankTitle
let realRank = that.data.currentUserRank + 1
let nickName = stableRank[that.data.currentUserRank].nickName
toast = '毅力榜第 ' + realRank + ', ' + title + ' ' + nickName + ''
} else {
toast = '您尚未出现在榜单中,快去坚持写日记吧~'
}
return toast
},
formatRank(result) {
result.forEach((el, index) => {
if (el.currentSuccessiveDiariesNum) {
result[index].currentSuccessiveDiariesNum =
util.round(el.currentSuccessiveDiariesNum, 1)
if (index < 1) {
result[index].rankTitle = '情毅至尊'
} else if (index < 5) {
result[index].rankTitle = '情毅天王'
} else if (index < 10) {
result[index].rankTitle = '情毅护法'
} else if (index < 20) {
result[index].rankTitle = '情毅护卫'
} else {
result[index].rankTitle = '情毅小兵'
}
} else {
console.log('元素不存在 currentSuccessiveDiariesNum 属性!')
}
})
},
onLoad: function () {
let that = this
that.setData({
isOnLoadHappening: true
})
wx.showLoading({
title: '正在加载榜单...',
})
//调用云函数拿情绪币榜单
wx.cloud.callFunction({
name: 'getSuccessiveDiariesRank',
data: {},
success: res => {
let stableRank = res.result.data
stableRank = stableRank.filter(that.stableFilter)
that.formatRank(stableRank)
that.setCurrentRank(stableRank)
that.setData({
stableRankLoaded: true,
stableRank,
isOnLoadHappening: false
})
let rankToast = that.getRankToast(stableRank)
wx.showToast({
title: rankToast,
icon: 'none',
duration: 3500
})
console.log('[云函数] [getStableRank] rank: ', that.data.stableRank)
},
fail: err => {
that.setData({
isOnLoadHappening: false
})
wx.showToast({
title: '加载失败...',
icon: 'none'
})
console.error('[云函数] [getStableRank] 调用失败', err)
}
})
},
onShow: function () {
let that = this
if (!that.data.isOnLoadHappening) {
wx.showToast({
title: '顶部下拉可刷新榜单~',
icon: 'none'
})
}
},
onPullDownRefresh: function () {
let that = this
that.setData({
stableRank: []
})
that.onLoad()
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<view class="rankTitle">
情绪毅力榜
</view>
<view wx:if="{{stableRankLoaded && stableRank.length < 1}}">
还没有人上榜呢~
</view>
</view>
<view
class="table"
wx:if="{{stableRankLoaded && stableRank.length > 0}}">
<view class="tr bg-w">
<view class="th">排名</view>
<view class="th">称谓</view>
<view class="th ">昵称</view>
<view class="th ">连续日记</view>
</view>
<block
wx:for="{{stableRank}}"
wx:if="{{stableRank.length > 0}}"
wx:key="unique">
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr bg-g'}}"
wx:if="{{index % 2 == 0}}">
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.currentSuccessiveDiariesNum}}</view>
</view>
<view
class="{{index === currentUserRank ? 'tr bg-match': 'tr'}}"
wx:else>
<view class="td">{{index + 1}}</view>
<view class="td">{{item.rankTitle}}</view>
<view class="td">{{item.nickName}}</view>
<view class="td">{{item.currentSuccessiveDiariesNum}}</view>
</view>
</block>
</view>
/**index.wxss**/
.rankTitle{
color: #6666FF;
font-size: 22px;
margin:50rpx
}
.table {
border: 0px solid darkgray;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
font-size: 30rpx;
width:25%;
justify-content: center;
text-align: center;
}
.bg-w{
background: snow;
}
.bg-g{
background: #E6F3F9;
}
.bg-match{
background: #66CCFF;
}
.bg-match > view{
color: white;
}
.th {
width: 25%;
justify-content: center;
background: #66CCFF;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
// pages/thumbUpRank/thumbUpRank.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/thumbUpRank/thumbUpRank.wxml-->
<text>pages/thumbUpRank/thumbUpRank.wxml</text>
/* pages/thumbUpRank/thumbUpRank.wxss */
\ No newline at end of file
// miniprogram/pages/userProtocol.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--miniprogram/pages/userProtocol.wxml-->
<div style="color: blue; margin: 20rpx; flex-direction: row">1. 在未经您允许的前提下,您的情绪只对您可见。</div>
<div style="margin: 20rpx; flex-direction: row">2. 选择公开心情即表示您保存的情绪内容可被其他用户在「漂流记」中打捞。</div>
<div style="margin: 20rpx; flex-direction: row">3. 正常情况下,您一天内只能保存一篇情绪且内容无法再次修改,请认真对待每一篇情绪。</div>
<div style="margin: 20rpx; flex-direction: row">4. 情绪评测结果不一定完全准确。</div>
<div style="margin: 20rpx; flex-direction: row">5. 您的部分数据(包括但不限于平均佛系值、打捞次数、情绪币总值)排行如果位于前 50 则会出现在排行榜中。</div>
/* miniprogram/pages/userProtocol.wxss */
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册