wangfei il y a 6 ans
Parent
révision
ee5f8dc87d
4 fichiers modifiés avec 36 ajouts et 11 suppressions
  1. 1
    1
      config/index.js
  2. 20
    10
      src/pages/index.vue
  3. 11
    0
      src/store/user/index.js
  4. 4
    0
      src/util/api.js

+ 1
- 1
config/index.js Voir le fichier

@@ -12,7 +12,7 @@ module.exports = {
12 12
     assetsPublicPath: '/',
13 13
     proxyTable: {
14 14
       '/api': {
15
-        target: 'http://localhost:8080',
15
+        target: 'http://192.168.0.67:8080',
16 16
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
17 17
         pathRewrite: {
18 18
           '^/api': '/'

+ 20
- 10
src/pages/index.vue Voir le fichier

@@ -114,7 +114,8 @@ export default {
114 114
           delay: 6000,
115 115
           disableOnInteraction: false
116 116
         }
117
-      }
117
+      },
118
+      num: 1
118 119
     }
119 120
   },
120 121
   computed: {
@@ -152,14 +153,8 @@ export default {
152 153
     this.getInitData()
153 154
     window.setInterval(() => {
154 155
       this.getInitData()
155
-    }, 3600000)
156
-    // window.setTimeout(() => {
157
-    //   this.returnUserList({
158
-    //     firstName: '999',
159
-    //     gender: '1',
160
-    //     show: false
161
-    //   })
162
-    // }, 24000)
156
+    }, 1000 * 60 * 60)
157
+    this.getPersonList()
163 158
   },
164 159
   mounted () {
165 160
     this.$nextTick(() => {
@@ -167,7 +162,8 @@ export default {
167 162
   },
168 163
   methods: {
169 164
     ...mapUserActions([
170
-      'getWeatherInfo'
165
+      'getWeatherInfo',
166
+      'getPerson'
171 167
     ]),
172 168
     ...mapPageActions([
173 169
       'getPagesList'
@@ -193,6 +189,7 @@ export default {
193 189
           this.timeNum = 0
194 190
           window.clearInterval(this.timer)
195 191
           this.showSlide = true
192
+          this.userList = []
196 193
         } else {
197 194
           this.timeNum += 100
198 195
         }
@@ -214,6 +211,19 @@ export default {
214 211
         pageSize: 100
215 212
       })
216 213
     },
214
+    getPersonList () {
215
+      this.getPerson().then(res => {
216
+        console.log(res)
217
+        if (res) {
218
+          this.returnUserList({
219
+            firstName: '111',
220
+            gender: '1',
221
+            show: false
222
+          })
223
+        }
224
+        this.getPersonList()
225
+      })
226
+    },
217 227
     FormatDate (timestamp, fmt) {
218 228
       if (timestamp === '0001-01-01T00:00:00Z') {
219 229
         return ''

+ 11
- 0
src/store/user/index.js Voir le fichier

@@ -80,6 +80,17 @@ export default {
80 80
           reject(res)
81 81
         })
82 82
       })
83
+    },
84
+    getPerson ({ commit }) {
85
+      return new Promise((resolve, reject) => {
86
+        Ajax(api.person.url, {
87
+          method: api.person.method
88
+        }).then(res => {
89
+          resolve(res)
90
+        }).catch((res) => {
91
+          reject(res)
92
+        })
93
+      })
83 94
     }
84 95
   }
85 96
 }

+ 4
- 0
src/util/api.js Voir le fichier

@@ -11,6 +11,10 @@ const $api = {
11 11
   pages: {
12 12
     method: 'get',
13 13
     url: `/api/firsts`
14
+  },
15
+  person: {
16
+    method: 'get',
17
+    url: `/api/person/connection`
14 18
   }
15 19
 }
16 20