userRecommand.js
1.07 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
import urlAlias from '../url'
import request from '../request'
const {
recommandList
} = urlAlias
const state = {
recommandList: []
}
const mutations = {
INIT: (state, list) => {
state.recommandList = list
}
}
let goodsList = []
const actions = {
getRecommandList({ commit }, param) {
request({
url: recommandList,
data: param,
success: (res) => {
console.log('ReccomandList请求结果',res.data)
// console.log(res.data.data)
// const Res={...res.data.data.list,...data.data.list}
const data = res.data.data
for (let index = 0; index < data.length; index++) {
goodsList = [...goodsList, ...data[index].list]
}
commit('INIT', goodsList)
},
fail: (res) => {
uni.showToast({
title: '数据加载完了',
icon: 'none'
})
console.log('fail status === > ', res)
},
complete: (res) => {
console.log('complete status === > ', res)
}
})
}
}
export default {
namespaced: true,
state,
mutations,
actions
}