BusinessCard.js
1.9 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
import {GetBusinessCardInfo,UpdateBusinessCardInfo,GetCardBackgroundTmpsList,AddOrUpdateCardBackground,DeleteCardBackgroud} from '../services/businessCard';
export default {
namespace: 'BusinessCard',
state: {
CardBackgroundList: {},
cardAllInfo:{},//名片所有信息
},
effects: {
*GetBusinessCardInfo({ payload, callback, error }, { call, put }) {
const { data } = yield call(GetBusinessCardInfo, payload);
if (data.userInfo) {
if (callback) callback(data.userInfo);
yield put({ type: 'updateCardAllInfo' ,payload:{item:data}});
} else {
error && error("没有查出下相应数据")
}
},
*UpdateBusinessCardInfo({ payload, callback, error }, { call, put }) {
const { data } = yield call(UpdateBusinessCardInfo, payload);
if (data.status === true) {
if (callback) callback(data.data);
} else {
error && error(data)
}
},
*GetCardBackgroundTmpsList({ payload, callback, error }, { call, put }) {
const { data } = yield call(GetCardBackgroundTmpsList, payload);
if (data.status === true) {
if (callback) callback(data.data);
} else {
error && error(data)
}
},
*AddOrUpdateCardBackground({ payload, callback, error }, { call, put }) {
const { data } = yield call(AddOrUpdateCardBackground, payload);
if (data.status === true) {
if (callback) callback(data.data);
} else {
error && error(data)
}
},
*DeleteCardBackgroud({ payload, callback, error }, { call, put }) {
const { data } = yield call(DeleteCardBackgroud, payload);
if (data.status === true) {
if (callback) callback(data.data);
} else {
error && error(data)
}
}
},
reducers: {
updateCardAllInfo(state, { payload }) {
return { ...state, cardAllInfo: payload.item };
},
},
subscriptions: {
},
};