许成详 6 年前
父节点
当前提交
03dc0e9b07

+ 5
- 5
config/index.js 查看文件

@@ -12,17 +12,17 @@ module.exports = {
12 12
     assetsPublicPath: '/',
13 13
     proxyTable: {
14 14
       '/api': {
15
-        target: 'http://192.168.0.67:8080', 
15
+        target: 'http://192.168.0.11', 
16 16
         changeOrigin: true,
17
-        pathRewrite: {
18
-          '^/api': '/'
19
-        },
17
+        // pathRewrite: {
18
+        //   '^/api': '/'
19
+        // },
20 20
       },
21 21
     },
22 22
 
23 23
     // Various Dev Server settings
24 24
     host: '0.0.0.0', // can be overwritten by process.env.HOST
25
-    port: 8082, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
25
+    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
26 26
     autoOpenBrowser: false,
27 27
     errorOverlay: true,
28 28
     notifyOnErrors: true,

+ 2
- 2
index.html 查看文件

@@ -4,8 +4,8 @@
4 4
     <meta charset="utf-8">
5 5
     <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
6 6
     <link rel="stylesheet" href="//at.alicdn.com/t/font_948990_7dbjfb2d5yb.css">
7
-    <script src="./static/vconsole.min.js?v=3.3.0"></script>
8
-    <script> var __vcl__111 = new VConsole();</script>
7
+    <!-- <script src="./static/vconsole.min.js?v=3.3.0"></script>
8
+    <script> var __vcl__111 = new VConsole();</script> -->
9 9
     <title>迎宾系统</title>
10 10
   </head>
11 11
   <body>

+ 81
- 0
src/components/userList/index.vue 查看文件

@@ -0,0 +1,81 @@
1
+<template>
2
+  <div class="components">
3
+    <ul class="centerLabel userList">
4
+      <item></item>
5
+      <item></item>
6
+      <item></item>
7
+    </ul>
8
+  </div>
9
+</template>
10
+
11
+<script>
12
+import item from './userItem'
13
+export default {
14
+  name: 'components',
15
+  props: ['userList'],
16
+  data () {
17
+    return {
18
+    }
19
+  },
20
+  computed: {
21
+  },
22
+  components: {
23
+    item
24
+  },
25
+  created () {
26
+  },
27
+  mounted () {
28
+    this.$nextTick(() => {
29
+    })
30
+  },
31
+  methods: {
32
+  }
33
+}
34
+</script>
35
+
36
+<!-- Add "scoped" attribute to limit CSS to this component only -->
37
+<style lang="scss" scoped>
38
+.components {
39
+  width: 100%;
40
+  height: 100%;
41
+  position: relative;
42
+  overflow: hidden;
43
+  .userList {
44
+    width: 35vw;
45
+    overflow: hidden;
46
+    transition: all 0.3s linear;
47
+    -webkit-transition: all 0.3s linear;
48
+    > li {
49
+      width: 100%;
50
+      position: relative;
51
+      overflow: hidden;
52
+      background: rgba(255, 255, 255, 0.15);
53
+      margin: 1.8vh auto 0;
54
+      padding: 9vh 0;
55
+      transform: translateY(100vh);
56
+      -webkit-transform: translateY(100vh);
57
+      transition: all 0.3s linear;
58
+      -webkit-transition: all 0.3s linear;
59
+      &:first-child {
60
+        margin-top: 0;
61
+      }
62
+      &.active {
63
+        transform: translateY(0);
64
+        -webkit-transform: translateY(0);
65
+      }
66
+      span {
67
+        width: 100%;
68
+        display: block;
69
+        color: #fff;
70
+        text-align: center;
71
+        line-height: 1.45;
72
+        font-size: 2.3vw;
73
+        &:first-child {
74
+          font-size: 2.8vw;
75
+          line-height: 1.3;
76
+        }
77
+      }
78
+    }
79
+  }
80
+}
81
+</style>

+ 92
- 0
src/components/userList/userItem.vue 查看文件

@@ -0,0 +1,92 @@
1
+<template>
2
+  <li class="components" :class="{'active': show}">
3
+    <span>{{item.firstName}}</span>
4
+    <span>{{item.words}}</span>
5
+  </li>
6
+</template>
7
+
8
+<script>
9
+export default {
10
+  name: 'components',
11
+  props: ['item'],
12
+  data () {
13
+    return {
14
+      show: false,
15
+      timer: null,
16
+      showTimeTamp: 0
17
+    }
18
+  },
19
+  watch: {
20
+    item (newVal, oldVal) {
21
+      if (!oldVal) {
22
+        this.resetTime()
23
+        return
24
+      }
25
+      window.clearInterval(this.timer)
26
+      this.timer = null
27
+      this.showTimeTamp = 0
28
+      this.resetTime()
29
+    }
30
+  },
31
+  computed: {
32
+  },
33
+  components: {
34
+  },
35
+  created () {
36
+    this.resetTime()
37
+  },
38
+  mounted () {
39
+    this.$nextTick(() => {
40
+    })
41
+  },
42
+  methods: {
43
+    resetTime () {
44
+      this.show = true
45
+      this.timer = window.setInterval(() => {
46
+        this.showTimeTamp += 100
47
+        if (this.showTimeTamp >= 5000) {
48
+          window.clearInterval(this.timer)
49
+          this.timer = null
50
+          this.showTimeTamp = 0
51
+          this.show = false
52
+        }
53
+      }, 100)
54
+    }
55
+  }
56
+}
57
+</script>
58
+
59
+<!-- Add "scoped" attribute to limit CSS to this component only -->
60
+<style lang="scss" scoped>
61
+.components {
62
+  width: 100%;
63
+  position: relative;
64
+  overflow: hidden;
65
+  background: rgba(255, 255, 255, 0.15);
66
+  margin: 1.8vh auto 0;
67
+  padding: 9vh 0;
68
+  transform: translateY(100vh);
69
+  -webkit-transform: translateY(100vh);
70
+  transition: all 0.3s linear;
71
+  -webkit-transition: all 0.3s linear;
72
+  &:first-child {
73
+    margin-top: 0;
74
+  }
75
+  &.active {
76
+    transform: translateY(0);
77
+    -webkit-transform: translateY(0);
78
+  }
79
+  span {
80
+    width: 100%;
81
+    display: block;
82
+    color: #fff;
83
+    text-align: center;
84
+    line-height: 1.45;
85
+    font-size: 2.3vw;
86
+    &:first-child {
87
+      font-size: 2.8vw;
88
+      line-height: 1.3;
89
+    }
90
+  }
91
+}
92
+</style>

+ 0
- 21
src/pages/page1.vue 查看文件

@@ -36,12 +36,8 @@
36 36
 import { createNamespacedHelpers } from 'vuex'
37 37
 import 'swiper/dist/css/swiper.css'
38 38
 import { swiper, swiperSlide } from 'vue-awesome-swiper'
39
-// import videojs from 'video.js'
40
-
41 39
 const { mapActions: mapUserActions } = createNamespacedHelpers('user')
42
-
43 40
 const { mapState: mapPageState, mapActions: mapPageActions } = createNamespacedHelpers('page')
44
-
45 41
 const { mapState: mapNewsState, mapActions: mapNewsActions } = createNamespacedHelpers('news')
46 42
 export default {
47 43
   name: 'projectIndex',
@@ -114,23 +110,6 @@ export default {
114 110
       if (vdo) {
115 111
         vdo.play()
116 112
       }
117
-      // videojs('hj-vdo', {
118
-      //   controls: false,
119
-      //   autoplay: true,
120
-      //   loop: true,
121
-      //   muted: true,
122
-      //   preload: 'auto'
123
-      // })
124
-      // const t = window.setInterval(() => {
125
-      //   if (this.$refs.vdo) {
126
-      //     this.$refs.vdo.play()
127
-      //     window.clearInterval(t)
128
-      //   }
129
-      // }, 2000)
130
-
131
-      // setTimeout(() => {
132
-      //   window.clearInterval(t)
133
-      // }, 60000)
134 113
     })
135 114
   },
136 115
   methods: {

+ 459
- 0
src/pages/page3.vue 查看文件

@@ -0,0 +1,459 @@
1
+<template>
2
+  <div class="projectIndex">
3
+    <img src="../assets/images/bg.jpg" class="centerLabel cover bg" alt>
4
+    <div class="content flex-h" v-if="pageDetail !== null">
5
+      <div class="left flex-v">
6
+        <div class="weather">
7
+          <div class="date flex-h">
8
+            <span>{{currentDate}}</span>
9
+            <span class="flex-item">{{currentWeek}}</span>
10
+            <span>农历{{currentChineseDate}}</span>
11
+          </div>
12
+          <div class="weatherDetail flex-h">
13
+            <div class="imgData" v-if="pageDetail.detail.weatherShow">
14
+              <img :src="weatherIcon(weatherDetail.weather)" width="100%" alt>
15
+              <span>{{tempRange}}</span>
16
+            </div>
17
+            <div class="flex-item">
18
+              <div v-if="weatherDetail">
19
+                <span>今日 {{ weatherDetail.dayweather }}</span>
20
+                <ul>
21
+                  <li>
22
+                    <span>白天</span>
23
+                    <span>{{weatherDetail.daywind}} 风 {{weatherDetail.daypower}}</span>
24
+                  </li>
25
+                  <li>
26
+                    <span>晚上</span>
27
+                    <span>{{weatherDetail.nightwind}} 风 {{weatherDetail.nightpower}}</span>
28
+                  </li>
29
+                </ul>
30
+              </div>
31
+            </div>
32
+          </div>
33
+        </div>
34
+        <div class="flex-item" v-if="pageDetail !== null && pageDetail.notice && pageDetail.notice.length">
35
+          <div>
36
+            <div class="centerLabel notice">
37
+              <span v-html="(pageDetail.notice[0].content || '').replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ')"></span>
38
+              <div>
39
+                <span>{{pageDetail.notice[0].publisher}}</span>
40
+                <span>{{pageDetail.notice[0].publishDate}}</span>
41
+              </div>
42
+            </div>
43
+          </div>
44
+        </div>
45
+      </div>
46
+      <div class="flex-item" v-if="pageDetail !== null">
47
+        <div :hidden="!showSlide">
48
+          <swiper :options="swiperOption" ref="mySwiper">
49
+            <swiper-slide class="swiper-slide" v-for="(item, index) in pageDetail.content" :key="index">
50
+              <img v-if="pageDetail.detail.contentType === 'image'" class="centerLabel" width="100%" height="100%" :src="item.content" alt>
51
+              <video v-if="pageDetail.detail.contentType === 'video'" width="100%" height="100%" id="hj-vdo" autoplay muted loop>
52
+                <source :src="item.content" type="video/mp4">
53
+              </video>
54
+            </swiper-slide>
55
+          </swiper>
56
+        </div>
57
+        <div :hidden="showSlide">
58
+          <ul class="centerLabel userList">
59
+            <li v-for="(item, index) in userList" :key="index" :class="{'active': item.show}">
60
+              <span>{{item.firstName}}</span>
61
+              <span>{{item.words}}</span>
62
+            </li>
63
+          </ul>
64
+        </div>
65
+      </div>
66
+    </div>
67
+  </div>
68
+</template>
69
+
70
+<script>
71
+import { createNamespacedHelpers } from 'vuex'
72
+import 'swiper/dist/css/swiper.css'
73
+import { swiper, swiperSlide } from 'vue-awesome-swiper'
74
+import solarLunar from 'solarLunar'
75
+const { mapState: mapPageState, mapActions: mapPageActions, mapMutations: mapPageMutations } = createNamespacedHelpers('newIndex')
76
+export default {
77
+  name: 'projectIndex',
78
+  data () {
79
+    return {
80
+      userList: [{
81
+        firstName: '111',
82
+        gender: '1',
83
+        show: false
84
+      }, {
85
+        firstName: '111',
86
+        gender: '1',
87
+        show: false
88
+      }, {
89
+        firstName: '111',
90
+        gender: '1',
91
+        show: false
92
+      }],
93
+      currentDate: '',
94
+      currentWeek: '',
95
+      currentChineseDate: '',
96
+      showSlide: true,
97
+      currentTimeTamp: Date.now(),
98
+      activeIndex: 0,
99
+      timer: null,
100
+      timeNum: 0,
101
+      swiperOption: {
102
+        speed: 1000,
103
+        autoplay: {
104
+          delay: 6000,
105
+          disableOnInteraction: false
106
+        }
107
+      },
108
+      num: 1,
109
+      personDelay: null,
110
+      pageTimer: null
111
+    }
112
+  },
113
+  computed: {
114
+    ...mapPageState({
115
+      pageDetail: x => x.pageDetail
116
+    }),
117
+    mySwiper () {
118
+      return this.$refs.mySwiper.swiper
119
+    },
120
+    weatherDetail () {
121
+      let target = JSON.parse(this.pageDetail.weather)
122
+      return !target ? undefined : target.forecasts[0].casts[0]
123
+    },
124
+    tempRange () {
125
+      if (!this.weatherDetail) return ''
126
+      let min, max
127
+      const f = () => (this.weatherDetail.daytemp) - 0 > (this.weatherDetail.nighttemp - 0)
128
+        ? ((min = this.weatherDetail.nighttemp) | (max = this.weatherDetail.daytemp))
129
+        : ((max = this.weatherDetail.nighttemp) | (min = this.weatherDetail.daytemp))
130
+      f()
131
+      return `${min}℃ ~ ${max}℃`
132
+    }
133
+  },
134
+  components: {
135
+    swiper,
136
+    swiperSlide
137
+  },
138
+  created () {
139
+    this.init()
140
+    this.pageTimer = window.setInterval(() => {
141
+      let curMin = new Date().getMinutes() - 0
142
+      let curHour = new Date().getHours() - 0
143
+      let curSec = new Date().getSeconds() - 0
144
+      if (!curMin) { // 整点刷新请求
145
+        if (curHour === 1 && !curSec) { // 1点刷新页面
146
+          window.clearInterval(this.pageTimer)
147
+          window.location.reload()
148
+        }
149
+        this.init()
150
+      }
151
+    }, 1000)
152
+  },
153
+  updated () {
154
+    this.$nextTick(() => {
155
+    })
156
+  },
157
+  methods: {
158
+    ...mapPageActions([
159
+      'getNewIndex'
160
+    ]),
161
+    ...mapPageMutations([
162
+      'emptyPageDetail'
163
+    ]),
164
+    init () { // 初始化
165
+      this.emptyPageDetail()
166
+      this.getDate()
167
+      this.getNewIndex(this.$route.query.id)
168
+    },
169
+    getDate () { // 获取当前时间
170
+      let currentTime = Date.now()
171
+      let weekday = ['日', '一', '二', '三', '四', '五', '六']
172
+      let ChineseDate = solarLunar.lunar2solar(new Date(currentTime).getFullYear(), new Date(currentTime).getMonth(), new Date(currentTime).getDate())
173
+      this.currentWeek = `星期${weekday[new Date(currentTime).getDay()]}`
174
+      this.currentTime = `${new Date(currentTime).getHours().toString().padStart(2, '0')} : ${new Date(currentTime).getMinutes().toString().padStart(2, '0')} : ${new Date(currentTime).getSeconds().toString().padStart(2, '0')}`
175
+      this.currentDate = `${new Date(currentTime).getFullYear()}年${(new Date(currentTime).getMonth() + 1).toString().padStart(2, '0')}月${new Date(currentTime).getDate().toString().padStart(2, '0')}日`
176
+      this.currentChineseDate = `${ChineseDate.monthCn}${ChineseDate.dayCn}`
177
+    },
178
+    weatherIcon (target) { // 返回天气图标
179
+      switch (target) {
180
+        case '晴':
181
+          return require('../assets/images/icon-6.png')
182
+        case '少云':
183
+        case '晴间多云':
184
+        case '多云':
185
+          return require('../assets/images/icon-4.png')
186
+        case '阴':
187
+        case '平静':
188
+          return require('../assets/images/icon-9.png')
189
+        case '有风':
190
+        case '微风':
191
+        case '和风':
192
+        case '清风':
193
+        case '强风/劲风':
194
+        case '疾风':
195
+        case '大风':
196
+        case '烈风':
197
+        case '风暴':
198
+        case '狂爆风':
199
+        case '飓风':
200
+        case '热带风暴':
201
+        case '浮尘':
202
+        case '扬沙':
203
+          return require('../assets/images/icon-1.png')
204
+        case '阵雨':
205
+        case '大雨':
206
+        case '中雨-大雨':
207
+        case '大雨-暴雨':
208
+        case '暴雨-大暴雨':
209
+        case '大暴雨-特大暴雨':
210
+        case '暴雨':
211
+        case '大暴雨':
212
+        case '特大暴雨':
213
+        case '强阵雨':
214
+        case '极端降雨':
215
+        case '雷阵雨':
216
+        case '雷阵雨并伴有冰雹':
217
+          return require('../assets/images/icon-5.png')
218
+        case '毛毛雨/细雨':
219
+        case '小雨':
220
+        case '雨':
221
+        case '中雨':
222
+        case '小雨-中雨':
223
+          return require('../assets/images/icon-3.png')
224
+        case '雨夹雪':
225
+        case '阵雨夹雪':
226
+        case '雨雪天气':
227
+        case '冻雨':
228
+          return require('../assets/images/icon-10.png')
229
+        case '阵雪':
230
+        case '小雪':
231
+        case '中雪':
232
+        case '大雪':
233
+        case '暴雪':
234
+        case '小雪-中雪':
235
+        case '中雪-大雪':
236
+        case '大雪-暴雪':
237
+        case '雪':
238
+          return require('../assets/images/icon-2.png')
239
+        case '沙尘暴':
240
+        case '强沙尘暴':
241
+        case '龙卷风':
242
+        case '雾':
243
+        case '浓雾':
244
+        case '强浓雾':
245
+        case '轻雾':
246
+        case '大雾':
247
+        case '特强浓雾':
248
+        case '霾':
249
+        case '中度霾':
250
+        case '重度霾':
251
+        case '严重霾':
252
+        default:
253
+          return require('../assets/images/icon-1.png')
254
+      }
255
+    }
256
+  }
257
+}
258
+</script>
259
+
260
+<!-- Add "scoped" attribute to limit CSS to this component only -->
261
+<style lang="scss" scoped>
262
+.projectIndex {
263
+  width: 100%;
264
+  height: 100%;
265
+  position: relative;
266
+  overflow: hidden;
267
+  .bg {
268
+    z-index: 1;
269
+  }
270
+  > div {
271
+    width: 100%;
272
+    height: 100%;
273
+    box-sizing: border-box;
274
+    border: 20px solid transparent;
275
+    z-index: 2;
276
+    position: relative;
277
+    overflow: hidden;
278
+    .left {
279
+      width: 35.5%;
280
+      position: relative;
281
+      overflow: hidden;
282
+      > div {
283
+        background: rgba(255, 255, 255, 0.15);
284
+        border-radius: 6px;
285
+      }
286
+      .weather {
287
+        width: 100%;
288
+        position: relative;
289
+        overflow: hidden;
290
+        margin-bottom: 20px;
291
+        padding: 60px 0;
292
+        .date {
293
+          align-items: center;
294
+          span {
295
+            line-height: 1.6;
296
+            font-size: 1.7vw;
297
+            color: #fff;
298
+            text-align: center;
299
+            &:first-child {
300
+              margin-left: 2.4vw;
301
+            }
302
+            &:last-child {
303
+              margin-right: 2.4vw;
304
+            }
305
+          }
306
+        }
307
+        .weatherDetail {
308
+          padding: 0 20px;
309
+          position: relative;
310
+          overflow: hidden;
311
+          margin-top: 18px;
312
+          .imgData {
313
+            width: 12.6vw;
314
+            position: relative;
315
+            overflow: hidden;
316
+            span {
317
+              width: 100%;
318
+              color: #fff;
319
+              font-size: 2vw;
320
+              line-height: 1.5;
321
+              margin-top: 20px;
322
+              display: block;
323
+            }
324
+          }
325
+          > .flex-item {
326
+            > div {
327
+              width: 100%;
328
+              position: relative;
329
+              overflow: hidden;
330
+              > span {
331
+                width: 100%;
332
+                color: #fff;
333
+                font-size: 1.2vw;
334
+                line-height: 1.8;
335
+                white-space: nowrap;
336
+                overflow: hidden;
337
+                text-overflow: ellipsis;
338
+              }
339
+              ul {
340
+                li {
341
+                  border-bottom: 1px solid #b3bcc3;
342
+                  font-size: 0;
343
+                  white-space: nowrap;
344
+                  padding: 6px 0;
345
+                  span {
346
+                    display: inline-block;
347
+                    width: 50%;
348
+                    color: #fff;
349
+                    font-size: 1.3vw;
350
+                    white-space: nowrap;
351
+                    line-height: 1.7;
352
+                  }
353
+                }
354
+              }
355
+            }
356
+          }
357
+        }
358
+      }
359
+      > .flex-item {
360
+        > div {
361
+          width: 100%;
362
+          height: 100%;
363
+          position: relative;
364
+          > .notice {
365
+            width: 100%;
366
+            box-sizing: border-box;
367
+            border-left: 2.4vw solid transparent;
368
+            border-right: 2.4vw solid transparent;
369
+            overflow: hidden;
370
+            h1 {
371
+              text-align: center;
372
+              color: #fff;
373
+              font-size: 1.9vw;
374
+              line-height: 1.6;
375
+              white-space: nowrap;
376
+              overflow: hidden;
377
+              text-overflow: ellipsis;
378
+              font-weight: normal;
379
+            }
380
+            > span {
381
+              width: 100%;
382
+              display: block;
383
+              color: #fff;
384
+              font-size: 1.2vw;
385
+              line-height: 1.6;
386
+              text-align: justify;
387
+              margin-top: 30px;
388
+            }
389
+            div {
390
+              margin-top: 30px;
391
+              span {
392
+                width: 100%;
393
+                display: block;
394
+                text-align: right;
395
+                color: #fff;
396
+                font-size: 1.2vw;
397
+                line-height: 1.6;
398
+              }
399
+            }
400
+          }
401
+        }
402
+      }
403
+    }
404
+    > .flex-item {
405
+      margin-left: 20px;
406
+      position: relative;
407
+      > div {
408
+        width: 100%;
409
+        height: 100%;
410
+        position: relative;
411
+        overflow: hidden;
412
+        border-radius: 6px;
413
+        .swiper-container {
414
+          width: 100%;
415
+          height: 100%;
416
+          position: relative;
417
+        }
418
+        .userList {
419
+          width: 35vw;
420
+          overflow: hidden;
421
+          transition: all 0.3s linear;
422
+          -webkit-transition: all 0.3s linear;
423
+          > li {
424
+            width: 100%;
425
+            position: relative;
426
+            overflow: hidden;
427
+            background: rgba(255, 255, 255, 0.15);
428
+            margin: 1.8vh auto 0;
429
+            padding: 9vh 0;
430
+            transform: translateY(100vh);
431
+            -webkit-transform: translateY(100vh);
432
+            transition: all 0.3s linear;
433
+            -webkit-transition: all 0.3s linear;
434
+            &:first-child {
435
+              margin-top: 0;
436
+            }
437
+            &.active {
438
+              transform: translateY(0);
439
+              -webkit-transform: translateY(0);
440
+            }
441
+            span {
442
+              width: 100%;
443
+              display: block;
444
+              color: #fff;
445
+              text-align: center;
446
+              line-height: 1.45;
447
+              font-size: 2.3vw;
448
+              &:first-child {
449
+                font-size: 2.8vw;
450
+                line-height: 1.3;
451
+              }
452
+            }
453
+          }
454
+        }
455
+      }
456
+    }
457
+  }
458
+}
459
+</style>

+ 2
- 8
src/router/index.js 查看文件

@@ -1,8 +1,7 @@
1 1
 /* eslint-disable */
2 2
 import Vue from 'vue'
3 3
 import Router from 'vue-router'
4
-import page1 from '../pages/page1'
5
-import page2 from '../pages/page2'
4
+import page3 from '../pages/page3'
6 5
 
7 6
 Vue.use(Router)
8 7
 
@@ -10,12 +9,7 @@ let router = new Router({
10 9
   routes: [{
11 10
     path: '/',
12 11
     name: 'index',
13
-    component: page1,
14
-    children: []
15
-  }, {
16
-    path: '/page2',
17
-    name: 'page2',
18
-    component: page2,
12
+    component: page3,
19 13
     children: []
20 14
   }]
21 15
 })

+ 2
- 1
src/store/index.js 查看文件

@@ -34,7 +34,8 @@ const store = new Vuex.Store({
34 34
 export const modules = {
35 35
   user: () => require('./user/index').default,
36 36
   news: () => require('./news/index').default,
37
-  page: () => require('./page/index').default
37
+  page: () => require('./page/index').default,
38
+  newIndex: () => require('./newIndex/index').default
38 39
 }
39 40
 
40 41
 Object.keys(modules).forEach((modKey) => {

+ 32
- 0
src/store/newIndex/index.js 查看文件

@@ -0,0 +1,32 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    pageDetail: null
8
+  },
9
+  mutations: {
10
+    updatePageDetail (state, payload) {
11
+      state.pageDetail = { ...payload.data }
12
+    },
13
+    emptyPageDetail (state) {
14
+      state.pageDetail = null
15
+    }
16
+  },
17
+  actions: {
18
+    getNewIndex ({ commit }, payload) {
19
+      return new Promise((resolve, reject) => {
20
+        Ajax(api.newIndex.url, {
21
+          method: api.newIndex.method,
22
+          urlData: { id: payload }
23
+        }).then(res => {
24
+          commit('updatePageDetail', res)
25
+          resolve(res)
26
+        }).catch((res) => {
27
+          reject(res)
28
+        })
29
+      })
30
+    }
31
+  }
32
+}

+ 4
- 0
src/util/api.js 查看文件

@@ -19,6 +19,10 @@ const $api = {
19 19
   person2: {
20 20
     method: 'get',
21 21
     url: `/api/person/connectionB`
22
+  },
23
+  newIndex: {
24
+    method: 'get',
25
+    url: `/api/screen/fristpage/device/:id`
22 26
   }
23 27
 }
24 28