Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ App({
selectedIconPath: "/pages/images/icon/activity_icon.png",
selected: true
},
{
pagePath: "/pages/mood/mood",
text: "心情",
iconPath: "/pages/images/icon/mood_icon.png",
selectedIconPath: "/pages/images/icon/mood_icon.png",
selected: false
},
{
pagePath: "/pages/discover/discover",
text: "发现",
Expand Down
87 changes: 44 additions & 43 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
{
"pages": [
"pages/activity/activity",
"pages/weather/weather",
"pages/map/map",
"pages/account/account",
"pages/trace/trace",
"pages/friends/friends",
"pages/friends_showPeople/friends_showPeople",
"pages/discover/discover",
"pages/discoverPOI/discoverPOI",
"pages/checkin/checkin",
"pages/error/error",
"pages/showpeople/showpeople",
"pages/mood/mood",
"pages/moodstatistics/moodstatistics",
"pages/privacy/privacy",
"pages/aboutus/aboutus",
"pages/recordmood/recordmood",
"pages/categorysta/categorysta",
"pages/districtsta/districtsta",
"pages/placesta/placesta",
"pages/chooseArea/chooseArea",
"pages/otherMood/otherMood",
"pages/qrcode/qrcode",
"pages/tabbar/tabbar",
"pages/showtops/showtops"
],
"window": {
"window": {
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "微信接口功能演示",
"backgroundColor": "#ffffff",
"backgroundTextStyle": "light"
},
"enablePullDownRefresh": true
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"debug": true
{
"pages": [
"pages/activity/activity",
"pages/weather/weather",
"pages/map/map",
"pages/account/account",
"pages/trace/trace",
"pages/friends/friends",
"pages/friends_showPeople/friends_showPeople",
"pages/discover/discover",
"pages/discoverPOI/discoverPOI",
"pages/checkin/checkin",
"pages/error/error",
"pages/showpeople/showpeople",
"pages/mood/mood",
"pages/moodstatistics/moodstatistics",
"pages/privacy/privacy",
"pages/aboutus/aboutus",
"pages/recordmood/recordmood",
"pages/categorysta/categorysta",
"pages/districtsta/districtsta",
"pages/placesta/placesta",
"pages/chooseArea/chooseArea",
"pages/otherMood/otherMood",
"pages/qrcode/qrcode",
"pages/tabbar/tabbar",
"pages/showtops/showtops",
"pages/moodcalender/moodcalender"
],
"window": {
"window": {
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "微信接口功能演示",
"backgroundColor": "#ffffff",
"backgroundTextStyle": "light"
},
"enablePullDownRefresh": true
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"debug": true
}
85 changes: 6 additions & 79 deletions pages/mood/mood.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Page({
url: '../moodstatistics/moodstatistics'
})
},
goToMoodCalender: function(){
wx.navigateTo({
url: '../moodcalender/moodcalender',
})
},
goToRecordMood_7: function(){
wx.navigateTo({
url: '../otherMood/otherMood?moodId=7'
Expand Down Expand Up @@ -95,31 +100,7 @@ Page({
url: '../recordmood/recordmood?moodId=6'
})
},
classifyByDate: function () {
var that = this;
var tempClassifyByDate = [];
var currentDate = '';
var currentClass = {};
for (var i = 0; i < this.data.history_mood.length; i++) {
if (currentDate != this.data.history_mood[i].date){
console.log(currentDate)
console.log(this.data.history_mood[i].date)
if (currentClass.date){
tempClassifyByDate.push(currentClass);
}
currentClass = {};
currentClass.date = this.data.history_mood[i].date;
currentDate = this.data.history_mood[i].date;

currentClass['moodList'] = [];
}
currentClass['moodList'].push(this.data.history_mood[i]);
console.log(currentClass+'..')
}
tempClassifyByDate.push(currentClass);
console.log(tempClassifyByDate)
this.setData({classifiedMoods: tempClassifyByDate,});
},

/**
* 生命周期函数--监听页面加载
*/
Expand Down Expand Up @@ -203,60 +184,6 @@ Page({
}
}
//获取历史数据
var history_mood = wx.getStorageSync('history_mood');
var that = this;
var oldDatetmp = wx.getStorageSync('timestamp_mood');
var oldDate = 0;
var nowDate = (Date.parse(new Date()) / 1000);
if (oldDatetmp == "") oldDate = 0;
else oldDate = oldDatetmp;

if (history_mood != "" && ((nowDate - oldDate) < 86400)) {
this.setData({history_mood: history_mood});
console.log('历史')
console.log(history_mood)
this.classifyByDate();
}
else{
wx.request({
url: 'https://40525433.fudan-mini-program.com/cgi-bin/MoodHistory',
data:{
openid: app.globalData.openid,
sessionid: app.globalData.sessionid,
},
method: 'POST',
success: function (res) {
if(res.data.status == 'ERROR'){
wx.showToast({
title: '获取历史心情失败',
icon:'loading'
})
}
else{
console.log(res)
wx.setStorageSync('timestamp_mood', (Date.parse(new Date()) / 1000));
var temp_history_mood = [];
for (var i = 0; i < res.data.moods.length; i++){

res.data.moods[i].date = res.data.moods[i]['datetime'].split(" ")[0];
res.data.moods[i].time = res.data.moods[i]['datetime'].split(" ")[1];
var temp_table = {}
temp_table = res.data.moods[i];
temp_table['simpletime'] = res.data.moods[i].datetime.substring(11, 19)
temp_table['logoPath'] = '../images/mood/'+res.data.moods[i].mood_id+'.png';
temp_history_mood.push(temp_table);
}
that.setData({
history_mood: temp_history_mood,
});
wx.setStorageSync('history_mood', temp_history_mood);
console.log(wx.getStorageSync('history_mood'))
console.log(temp_history_mood)
that.classifyByDate();
}
}
})
}
},
/**
* 生命周期函数--监听页面隐藏
Expand Down
Empty file modified pages/mood/mood.json
100755 → 100644
Empty file.
40 changes: 4 additions & 36 deletions pages/mood/mood.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@
<view style="padding:0% 10% 2% 10%">
<view style="display: flex;flex-direction:row;;">
<view style="flex:1" class='two_button_left'>
<button class="button_my"bindtap="goToMoodStatistics" style="flex:1" >我的心情</button>
<button class="button_my"bindtap="goToMoodStatistics" style="flex:1">心情统计</button>
</view>
<view style="flex:1" class='two_button_right'>
<button class="button_my"bindtap="goToMoodCalender" style="flex:1" >心情日历</button>
</view>

</view>
Expand All @@ -111,39 +114,4 @@
{{award_text_1}}<span style="color: blue">{{con_day}}</span>{{award_text_2}}
</view>

<view>
<text style="font-size:150%; position:relative;left:5%; color:blue">
Timeline
</text>
</view>

<view class='topic-main'>
<block wx:for="{{classifiedMoods}}" wx:key="date">
<view class="date" style="text-align:right">
<text class='datetext'>{{item.date}}</text>
</view>
<block wx:for="{{item.moodList}}">
<view class='item_view' style="width:{{windowWidth*0.9}}px">
<view class="topic-item" catchtap="redictDetail">
<image class="member-square" src="{{item.logoPath}}" background-size="cover"></image>
<view class="topic-info">
<view class="topic-inner">
<view class="topic-left">
<view class="topic-title">
<text>{{item.mood_text}}</text>
</view>
<view>
<text class="member-nickname">心情寄语:{{item.text}}</text>
</view>
<view>
<text class="node-name">{{item.time}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</block>
</block>
</view>
</view>
3 changes: 3 additions & 0 deletions pages/mood/mood.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
.two_button_left{
margin-right: 20rpx;
}
.two_button_right{
margin-right: 20rpx;
}
.button_my{
color: black;
border: 1px solid #D1D1D1;
Expand Down
Loading