|
@@ -214,14 +214,30 @@ export default {
|
214
|
214
|
})
|
215
|
215
|
},
|
216
|
216
|
receviedMsg (e) {
|
217
|
|
- let res = JSON.parse(e.data)
|
218
|
|
- console.log(res)
|
219
|
|
- this.newData({
|
220
|
|
- name: !res.person.name ? '' : res.person.name,
|
221
|
|
- classId: res.person.typeId,
|
222
|
|
- words: res.taVisitingWords.words,
|
223
|
|
- url: res.audio
|
224
|
|
- })
|
|
217
|
+ const msg = e.data
|
|
218
|
+ if (!msg) {
|
|
219
|
+ return
|
|
220
|
+ }
|
|
221
|
+
|
|
222
|
+ const res = JSON.parse(e.data)
|
|
223
|
+ if (res.type && res.type === 'cmd') {
|
|
224
|
+ // 如果这种类型的消息, 说明是行为控制
|
|
225
|
+ switch (res.data) {
|
|
226
|
+ // 刷新数据
|
|
227
|
+ case 'refresh':
|
|
228
|
+ this.init()
|
|
229
|
+ break
|
|
230
|
+ default:
|
|
231
|
+ break
|
|
232
|
+ }
|
|
233
|
+ } else {
|
|
234
|
+ this.newData({
|
|
235
|
+ name: !res.person.name ? '' : res.person.name,
|
|
236
|
+ classId: res.person.typeId,
|
|
237
|
+ words: res.taVisitingWords.words,
|
|
238
|
+ url: res.audio
|
|
239
|
+ })
|
|
240
|
+ }
|
225
|
241
|
},
|
226
|
242
|
init () { // 初始化
|
227
|
243
|
this.emptyPageDetail()
|