channel.js
2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import apis from '@/api'
export default {
namespaced: true,
state: {
videoList: [],
carSeriesData: [],
searchList: [],
topicDetail: {},
merchantId: '',
channelStyle: 1,
channelType: ''
},
mutations: {
// 设置视频
['SET_VIDEO_LIST'](state, payload) {
state.videoList = payload.videoList
},
// 设置频道主题详情
['SET_TOPIC_DETAIL'](state, payload) {
state.topicDetail = payload.topicDetail
},
// 设置门店id
['SET_MERCHANT_ID'](state, payload) {
state.merchantId = payload.id
},
// 设置频道主题
['SET_CHANNEL_STYLE'](state, payload) {
state.channelStyle = payload.channelStyle
},
['SET_CHANNEL_TYPE'](state, payload) {
state.channelType = payload.channelType
},
['SET_CARSERI_LIST'](state, payload) {
state.carSeriesData = payload.list || []
},
['SET_SEARCH_LIST'](state, payload) {
let list = []
payload.list?.forEach(item =>{
list.push({id: `${item.id}`, value:item.name})
item.childs?.forEach(ele =>{
list.push({id: `${item.id}-${ele.id}`, value:ele.name})
ele.childs?.forEach(o =>{
list.push({id: `${item.id}-${ele.id}-${o.id}`, value:o.name})
})
})
})
state.searchList = list
},
},
actions: {
// 获取视频列表
getTencentcloudmedialist(conText, payload) {
apis.store.getTencentcloudmedialist({}).then(res => {
if (res.code == 0) {
conText.commit('SET_VIDEO_LIST', { videoList: res.data })
// if (payload.success) {
// payload.success()
// }
}
})
},
//频道主题详情
getTopicDetail(conText, payload) {
apis.store.getTopicDetail(payload).then(res => {
if (res.code == 0) {
conText.commit('SET_TOPIC_DETAIL', { topicDetail: res.data })
}
})
},
//新增或编辑频道主题
addChannelTopic(conText, payload) {
apis.store.addChannelTopic(payload).then(res => {
if (res) {
if (payload.success) {
payload.success(res)
}
}
})
},
getCarSeriList(conText, payload) {
apis.case.getCarSeriesApi({needCarSeries:true}).then(res => {
if(res?.length){
conText.commit('SET_CARSERI_LIST', { list: res })
conText.commit('SET_SEARCH_LIST', { list: res })
}
})
}
}
}