wangfei 6 years ago
parent
commit
00573a9887
4 changed files with 18 additions and 9 deletions
  1. 1
    1
      index.html
  2. 10
    4
      src/pages/index.vue
  3. 5
    2
      src/pages/page2.vue
  4. 2
    2
      src/store/user/index.js

+ 1
- 1
index.html View File

@@ -4,7 +4,7 @@
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
-    <title>myvue</title>
7
+    <title>迎宾系统</title>
8 8
   </head>
9 9
   <body>
10 10
     <div id="app"></div>

+ 10
- 4
src/pages/index.vue View File

@@ -75,6 +75,7 @@
75 75
         </div>
76 76
       </div>
77 77
     </div>
78
+    <audio :src="audioSrc" autoplay :style="{ width: '1px', height: '1px' }" ></audio>
78 79
   </div>
79 80
 </template>
80 81
 
@@ -111,7 +112,8 @@ export default {
111 112
           disableOnInteraction: false
112 113
         }
113 114
       },
114
-      num: 1
115
+      num: 1,
116
+      audioSrc: ''
115 117
     }
116 118
   },
117 119
   computed: {
@@ -188,6 +190,7 @@ export default {
188 190
       this.timeNum = 0
189 191
       window.setTimeout(() => {
190 192
         item.show = true
193
+        this.audioSrc = item.audio
191 194
       }, 100)
192 195
       if (this.userList.length > 2) {
193 196
         this.userList.splice(0, 1)
@@ -225,11 +228,14 @@ export default {
225 228
     },
226 229
     getPersonList () {
227 230
       this.getPerson().then(res => {
228
-        if (res) {
231
+        if (res && res.isShow) {
232
+          const wds = (res.words || '').replace('{{name}}', res.personName)
233
+
229 234
           this.returnUserList({
230 235
             firstName: (res.classId || res.classId === 1) ? '' : res.personName,
231
-            words: res.words.replace('{{name}}', res.personName),
232
-            show: false
236
+            words: wds,
237
+            show: false,
238
+            audio: `http://ycapi.jcjyhn.com/welcome-api/?t=${wds}&rand=${(new Date()).valueOf()}`
233 239
           })
234 240
         }
235 241
         this.getPersonList()

+ 5
- 2
src/pages/page2.vue View File

@@ -195,11 +195,14 @@ export default {
195 195
     },
196 196
     getPersonList () {
197 197
       this.getPersonB().then(res => {
198
-        if (res) {
198
+        if (res && res.isShow) {
199
+          const wds = (res.words || '').replace('{{name}}', res.personName)
200
+
199 201
           this.returnUserList({
200 202
             firstName: (res.classId || res.classId === 1) ? '' : res.personName,
201 203
             words: (res.words || '').replace('{{name}}', res.personName),
202
-            show: false
204
+            show: false,
205
+            audio: `http://ycapi.jcjyhn.com/welcome-api/?t=${wds}`
203 206
           })
204 207
         }
205 208
         this.getPersonList()

+ 2
- 2
src/store/user/index.js View File

@@ -80,7 +80,7 @@ export default {
80 80
         })
81 81
       })
82 82
     },
83
-    getPerson ({ commit }) {
83
+    getPersonB ({ commit }) {
84 84
       return new Promise((resolve, reject) => {
85 85
         Ajax(api.person.url, {
86 86
           method: api.person.method
@@ -91,7 +91,7 @@ export default {
91 91
         })
92 92
       })
93 93
     },
94
-    getPersonB ({ commit }) {
94
+    getPerson ({ commit }) {
95 95
       return new Promise((resolve, reject) => {
96 96
         Ajax(api.person2.url, {
97 97
           method: api.person2.method