Skip to content

Commit 806e24c

Browse files
committed
FIXME fix ISSUE 50 選單選取當日日期改以當日api替換fatch 資料
原因: 目前的API主要有2組 api/v1/records/summary/?uid=UUID&template=heartFailure&start_date=2020-07-15&end_date=2020-07-24;` api/v1/records/past-days/?uid=UUID&template=heartFailure&range=this-month 當是期選擇器 選取單日時 api/v1/records/summary/?uid=UUID&template=heartFailure&start_date=2020-08-18&end_date=2020-08-18;只會取道當日單筆資料 需要改用api/v1/records/past-days/?uid=UUID&template=heartFailure&range=today` 但是當日期不為當日就無法了 (目前的解法,我看了超久才發現QQ,一直以為是bug) 可能需要將條件改為 日期 (CC @shc261392 ) api/v1/records/past-days/?uid=UUID&template=heartFailure&range=2020-08-18
1 parent 4076635 commit 806e24c

File tree

3 files changed

+88
-19
lines changed

3 files changed

+88
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logboard-frontend",
3-
"version": "0.1.0",
3+
"version": "0.1.6",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",

src/components/DateSelectBar.vue

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export default {
7272
} else {
7373
// this.GetAPI("this-week");
7474
// this.GetAPI("this-week");
75+
console.log("no change");
7576
}
7677
} else {
7778
if (this.$route.name !== "dashboard") {
@@ -228,7 +229,7 @@ export default {
228229
});
229230
} else if (mode == "today") {
230231
this.$store.dispatch("fetchToDaysApi");
231-
this.$store.dispatch("fetchRawDataApi");
232+
// this.$store.dispatch("fetchRawDataApi");
232233
} else {
233234
this.$store.dispatch("fetchDaysApi", {
234235
// range: "this-week"
@@ -272,11 +273,27 @@ export default {
272273
// start_date: new Date(start).toISOString().substring(0, 10),
273274
// end_date: new Date(end).toISOString().substring(0, 10)
274275
// });
275-
this.GetAPI(
276-
"Summary",
277-
new Date(start).toISOString().substring(0, 10),
278-
new Date(end).toISOString().substring(0, 10)
279-
);
276+
if (start == end) {
277+
//FIXME
278+
279+
if (
280+
new Date(start).getMonth() == new Date().getMonth() &&
281+
new Date().getDay(start) == new Date().getDay()
282+
) {
283+
console.log("$sstart,end tore", start, end); // -> 1
284+
//等於當日 FIX ISSUE 50
285+
this.$store.dispatch("fetchToDaysApi");
286+
}
287+
//FIXME
288+
// 執行TO(被選中的單日)Day
289+
} else {
290+
this.GetAPI(
291+
"Summary",
292+
new Date(start).toISOString().substring(0, 10),
293+
new Date(end).toISOString().substring(0, 10)
294+
);
295+
}
296+
280297
console.log(
281298
"dateselectDateformat",
282299
new Date(start).toISOString().substring(0, 10),

src/components/DateSelectBarMobile.vue

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,61 @@ export default {
7777
// selectTemplateList: function() {
7878
// console.log("selectTemplateList change");
7979
// },
80+
// selectValue: function () {
81+
// this.$store.commit("updateSelectTemplate", this.selectValue);
82+
// this.GetAPI("this-week");
83+
// console.log("selectValue change" + this.selectValue);
84+
// },
8085
selectValue: function () {
86+
////確保 症狀包選擇後可以顯示在對應的組件頁面
8187
this.$store.commit("updateSelectTemplate", this.selectValue);
8288
this.GetAPI("this-week");
83-
console.log("selectValue change" + this.selectValue);
89+
if (this.selectValue == "healthDeclaration") {
90+
if (this.$route.name !== "camps") {
91+
this.$router.push({
92+
name: "camps",
93+
});
94+
} else {
95+
// this.GetAPI("this-week");
96+
// this.GetAPI("this-week");
97+
console.log("no change");
98+
}
99+
} else {
100+
if (this.$route.name !== "dashboard") {
101+
this.$router.push({
102+
name: "dashboard",
103+
});
104+
} else {
105+
console.log("selectValue change" + this.selectValue);
106+
}
107+
}
84108
},
85109
options: function () {
86110
console.log("options change");
87111
},
88-
selectDateformatStart: function () {
89-
console.log("selectDateformatStart change back", this.selectDateformatStart);
112+
selectDateformatStart: function () {
113+
console.log(
114+
"selectDateformatStart change back",
115+
this.selectDateformatStart
116+
);
90117
},
91118
selectDateformatEnd: function () {
92119
console.log("selectDateformatEnd change back", this.selectDateformatEnd);
93120
},
94121
selectDateformat: function () {
95-
this.dateValue=[new Date(this.selectDateformatStart),new Date(this.selectDateformatEnd)]
96-
console.log("selectDateformat change back", new Date(this.selectDateformatStart));
97-
console.log("selectDateformat change back", this.selectDateformat,this.dateValue);
122+
this.dateValue = [
123+
new Date(this.selectDateformatStart),
124+
new Date(this.selectDateformatEnd),
125+
];
126+
console.log(
127+
"selectDateformat change back",
128+
new Date(this.selectDateformatStart)
129+
);
130+
console.log(
131+
"selectDateformat change back",
132+
this.selectDateformat,
133+
this.dateValue
134+
);
98135
},
99136
},
100137
created() {
@@ -104,7 +141,7 @@ export default {
104141
// selectTemplateList() {
105142
// return this.$store.state.templateList;
106143
// },
107-
selectDateformat() {
144+
selectDateformat() {
108145
return this.$store.state.selectDateformat;
109146
},
110147
selectDateformatStart() {
@@ -251,11 +288,26 @@ export default {
251288
// start_date: new Date(start).toISOString().substring(0, 10),
252289
// end_date: new Date(end).toISOString().substring(0, 10)
253290
// });
254-
this.GetAPI(
255-
"Summary",
256-
new Date(start).toISOString().substring(0, 10),
257-
new Date(end).toISOString().substring(0, 10)
258-
);
291+
if (start == end) {
292+
//FIXME
293+
294+
if (
295+
new Date(start).getMonth() == new Date().getMonth() &&
296+
new Date().getDay(start) == new Date().getDay()
297+
) {
298+
console.log("$sstart,end tore", start, end); // -> 1
299+
//等於當日 FIX ISSUE 50
300+
this.$store.dispatch("fetchToDaysApi");
301+
}
302+
//FIXME
303+
// 執行TO(被選中的單日)Day
304+
} else {
305+
this.GetAPI(
306+
"Summary",
307+
new Date(start).toISOString().substring(0, 10),
308+
new Date(end).toISOString().substring(0, 10)
309+
);
310+
}
259311
console.log(
260312
"dateselectDateformat",
261313
new Date(start).toISOString().substring(0, 10),

0 commit comments

Comments
 (0)