seimin hai 1 día
pai
achega
1f3524e4fd
Modificáronse 2 ficheiros con 12 adicións e 5 borrados
  1. 8 1
      src/main.js
  2. 4 4
      src/views/AppIndex.vue

+ 8 - 1
src/main.js

@@ -19,7 +19,14 @@ Vue.prototype.$moment = moment
19 19
 // 分钟转为时分
20 20
 Vue.filter('formatHourMinute', (value) => {
21 21
   if (!value) return '0分'
22
-  return moment.utc(value * 60 * 1000).format('HH时mm分')
22
+  const duration = moment.duration(value, 'minutes')
23
+  const hours = Math.floor(duration.asHours())
24
+  const minutes = duration.minutes()
25
+  if (hours) {
26
+    return `${hours}时${minutes}分`
27
+  } else {
28
+    return `${minutes}分`
29
+  }
23 30
 })
24 31
 
25 32
 Vue.config.productionTip = false

+ 4 - 4
src/views/AppIndex.vue

@@ -153,24 +153,24 @@ export default {
153 153
 
154 154
   },
155 155
   provide () {
156
-    console.log('params', this.$route.params)
156
+    console.log('route', this.$route)
157 157
     let hosId, dutyId, parentDutyId
158 158
     if (this.$route.params.queryType === '1') {
159 159
       hosId = undefined
160 160
       dutyId = undefined
161 161
       parentDutyId = undefined
162 162
     } else if (this.$route.params.queryType === '2') {
163
-      hosId = +this.$route.query.hosId
163
+      hosId = this.$route.query.hosId ? +this.$route.query.hosId : undefined
164 164
       dutyId = undefined
165 165
       parentDutyId = undefined
166 166
     } else if (this.$route.params.queryType === '3') {
167 167
       hosId = undefined
168
-      dutyId = +this.$route.query.dutyId
168
+      dutyId = this.$route.query.dutyId ? +this.$route.query.dutyId : undefined
169 169
       parentDutyId = undefined
170 170
     } else if (this.$route.params.queryType === '4') {
171 171
       hosId = undefined
172 172
       dutyId = undefined
173
-      parentDutyId = +this.$route.query.dutyId
173
+      parentDutyId = this.$route.query.dutyId ? +this.$route.query.dutyId : undefined
174 174
     }
175 175
     console.log(parentDutyId, hosId, dutyId)
176 176
     return {