diff --git a/pages/home/home.vue b/pages/home/home.vue index 33f82ce..f76dae3 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -63,15 +63,14 @@ - + - {{item.title}} + {{value.title}} - {{item.value}} - - 小时 + {{value.value}} + {{value.unit}} @@ -85,7 +84,7 @@ - 1 + {{status.ing}} @@ -97,7 +96,7 @@ - 36 + {{status.wait}} @@ -109,7 +108,7 @@ - 366 + {{status.end}} @@ -146,7 +145,7 @@ - + @@ -163,23 +162,33 @@ fontSize: "28rpx", fontWeight: "500" }, - dataList: [{ - title: "今日服务数量", - value: 6, - type: 0 - }, { - title: "本月服务数量", - value: 36, - type: 0 - }, { - title: "今日服务工时", - value: 6, - type: 1 - }, { - title: "本月服务工时", - value: 136, - type: 1 - }], + dataList: { + todayServe: { + title: "今日服务数量", + value: 0, + unit: "位" + }, + monthServe: { + title: "本月服务数量", + value: 0, + unit: "位" + }, + todayHour: { + title: "今日服务工时", + value: 0, + unit: "小时" + }, + monthHour: { + title: "本月服务工时", + value: 0, + unit: "小时" + }, + }, + status: { + wait: 0, + ing: 0, + end: 0, + }, infoList: [] } }, @@ -197,7 +206,14 @@ async getStatistic() { let res = await this.$u.api.statistic() - console.log(res); + this.dataList.monthHour.value = res.month_hour_total + this.dataList.monthServe.value = res.month_serve_total + this.dataList.todayHour.value = res.today_hour_total + this.dataList.todayServe.value = res.today_serve_total + + this.status.wait = res.wait + this.status.ing = res.ing + this.status.end = res.end }, async getRemind() { let res = await this.$u.api.noticeList() diff --git a/pages/list/list.vue b/pages/list/list.vue index f99343b..38702f3 100644 --- a/pages/list/list.vue +++ b/pages/list/list.vue @@ -90,7 +90,7 @@ - + @@ -285,6 +285,10 @@ align-items: center; } + /deep/.u-load-more-wrap { + padding: 10px 0; + } + .search { width: 710rpx; height: 70rpx; diff --git a/pages/login/login.vue b/pages/login/login.vue index adc2f36..0f10a32 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -81,19 +81,17 @@ this.getInfo(); }) }, - getInfo() { - this.$u.api.me().then(res => { - this.$u.vuex("vuex_user", res); - - uni.showToast({ - icon: "none", - title: `欢迎回来,${res.name}`, - }); - + async getInfo() { + await this.$store.dispatch('me') + uni.showToast({ + icon: "none", + title: `欢迎回来,${this.vuex_user.name}`, + }); + setTimeout(() => { uni.switchTab({ url: "/pages/home/home" }); - }) + }, 1500) }, }, computed: {}, diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index cb2655d..96c3455 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -12,8 +12,8 @@ 头像 - + + diff --git a/pages/todayNursing/todayNursing.vue b/pages/todayNursing/todayNursing.vue index 83ba09b..bef7495 100644 --- a/pages/todayNursing/todayNursing.vue +++ b/pages/todayNursing/todayNursing.vue @@ -71,7 +71,7 @@ - + diff --git a/store/index.js b/store/index.js index 1754399..40b92e7 100644 --- a/store/index.js +++ b/store/index.js @@ -66,6 +66,13 @@ const store = new Vuex.Store({ uni.removeStorageSync("lifeData") } + }, + + actions: { + async me(context, payload) { + let res = await Vue.prototype.$u.api.me() + Vue.prototype.$u.vuex('vuex_user', res) + } } })