Przeglądaj źródła

Merge branch 'master' of http://git.ycjcjy.com/welcome/screen

许成详 6 lat temu
rodzic
commit
fa2010a208

+ 4
- 4
config/index.js Wyświetl plik

@@ -12,11 +12,11 @@ module.exports = {
12 12
     assetsPublicPath: '/',
13 13
     proxyTable: {
14 14
       '/api': {
15
-        target: 'http://192.168.0.11', 
15
+        target: 'http://192.168.0.11:8080', 
16 16
         changeOrigin: true,
17
-        // pathRewrite: {
18
-        //   '^/api': '/'
19
-        // },
17
+        pathRewrite: {
18
+          '^/api': '/'
19
+        },
20 20
       },
21 21
     },
22 22
 

+ 1
- 3
src/components/userList/index.vue Wyświetl plik

@@ -1,9 +1,7 @@
1 1
 <template>
2 2
   <div class="components">
3 3
     <ul class="centerLabel userList">
4
-      <item></item>
5
-      <item></item>
6
-      <item></item>
4
+      <item v-for="(user, k) in userList" :key="k" :item="user"></item>
7 5
     </ul>
8 6
   </div>
9 7
 </template>

+ 25
- 25
src/components/userList/userItem.vue Wyświetl plik

@@ -16,42 +16,42 @@ export default {
16 16
       showTimeTamp: 0
17 17
     }
18 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
-  },
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 31
   computed: {
32 32
   },
33 33
   components: {
34 34
   },
35 35
   created () {
36
-    this.resetTime()
36
+    // this.resetTime()
37 37
   },
38 38
   mounted () {
39 39
     this.$nextTick(() => {
40 40
     })
41 41
   },
42 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
-    }
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 55
   }
56 56
 }
57 57
 </script>

+ 4
- 4
src/pages/page3.vue Wyświetl plik

@@ -1,8 +1,8 @@
1 1
 <template>
2 2
   <div class="projectIndex">
3 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">
4
+    <div class="content flex-h">
5
+      <div class="left flex-v" v-if="pageDetail !== null">
6 6
         <div class="weather">
7 7
           <div class="date flex-h">
8 8
             <span>{{currentDate}}</span>
@@ -43,8 +43,8 @@
43 43
           </div>
44 44
         </div>
45 45
       </div>
46
-      <div class="flex-item" v-if="pageDetail !== null">
47
-        <div :hidden="!showSlide">
46
+      <div class="flex-item">
47
+        <div :hidden="!showSlide" v-if="pageDetail !== null">
48 48
           <swiper :options="swiperOption" ref="mySwiper">
49 49
             <swiper-slide class="swiper-slide" v-for="(item, index) in pageDetail.content" :key="index">
50 50
               <img v-if="pageDetail.detail.contentType === 'image'" class="centerLabel" width="100%" height="100%" :src="item.content" alt>

+ 78
- 0
src/pages/test.vue Wyświetl plik

@@ -0,0 +1,78 @@
1
+<template>
2
+<div>
3
+  <img src="../assets/images/bg.jpg" class="centerLabel cover bg" alt>
4
+  <div style="position: relative;z-index: 101;color: #fff;" @click="newData(newinfo)"><span>增加新用户</span></div>
5
+  <div style="position: relative;z-index: 101;color: #fff;" @click="newData(vipAinfo)"><span>增加张先生</span></div>
6
+  <div style="position: relative;z-index: 101;color: #fff;" @click="newData(vipBinfo)"><span>增加王女士</span></div>
7
+  <div style="position: relative;z-index: 101;color: #fff;" @click="newData(vipCinfo)"><span>增加许女士</span></div>
8
+  <div v-if="users.length>0"  style="position: relative;z-index: 101;">
9
+    <ul class="centerLabel userList">
10
+      <!-- <userList :user-list='users'></userList> -->
11
+      <div v-for="(user, k) in users" :key="k" :item="user">
12
+        <span>{{user.firstName}}</span>
13
+        <span>{{user.words}}</span>
14
+      </div>
15
+    </ul>
16
+  </div>
17
+</div>
18
+</template>
19
+
20
+<script>
21
+export default {
22
+  data () {
23
+    return {
24
+      users: [],
25
+      newinfo: {
26
+        firstName: '',
27
+        classId: '1',
28
+        words: '欢迎光临'
29
+      },
30
+      vipAinfo: {
31
+        firstName: '张先生',
32
+        classId: '2',
33
+        words: '您好'
34
+      },
35
+      vipBinfo: {
36
+        firstName: '王女士',
37
+        classId: '2',
38
+        words: '您好~'
39
+      },
40
+      vipCinfo: {
41
+        firstName: '许女士',
42
+        classId: '2',
43
+        words: 'hello'
44
+      }
45
+    }
46
+  },
47
+  methods: {
48
+    newData (info) {
49
+      if (info.classId === '1' && this.users.filter(x => x.classId === '1').length > 0) {
50
+        this.users = this.users.map((x) => {
51
+          if (x.classId === '1') {
52
+            return {...x, createdata: Date.parse(new Date())}
53
+          } else {
54
+            return x
55
+          }
56
+        })
57
+      } else {
58
+        if (this.users.length >= 3) {
59
+          this.users.splice(0, 1)
60
+        }
61
+        this.users = [...this.users, {...info, createdata: Date.parse(new Date())}]
62
+      }
63
+    }
64
+  },
65
+  created () {
66
+    const _that = this
67
+    window.setInterval(() => {
68
+      let dels = _that.users.filter(x => Date.parse(new Date()) - x.createdata > 5000)
69
+      dels.map(x => {
70
+        _that.users.splice(this.users.findIndex(i => i.createdata === x.createdata), 1)
71
+      })
72
+    }, 100)
73
+  }
74
+}
75
+</script>
76
+
77
+<style lang="scss" scoped>
78
+</style>

+ 2
- 2
src/router/index.js Wyświetl plik

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