| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import * as constants from './constants';
- import { fromJS } from 'immutable';
- import * as config from '../../../common/config.js';
- import axios from '../../../common/axios_auth.js';
- import qs from 'qs';
- //获得公司详情
- export const getCompanyDetail = (key,error) => {
- return (dispatch) => {
- axios.get(config.CLD2API + '/contact/companyDetail/'+key).then((res) => {
- const data = res.data;
- if (data.code === 200) {
- dispatch({
- type: constants.CHANGE_COMPANY_DETAIL,
- data: data.data,
- });
- } else {
- error('公司详情请求失败');
- }
- }).catch((e) => {
- error('公司详情请求失败');
- })
- }
- };
- //loading
- export const changeLoading = () => {
- return (dispatch) => {
- dispatch({
- type: constants.CHANGE_COMPANYDETAIL_LOADING,
- data: true,
- });
- }
- }
- //
- export const modifyCompany = (name,value,title,error) => {
- return (dispatch) => {
- let data = {
- 'field':name,
- 'value': value,
- };
-
- axios.post(config.CLD2API + '/contact/modifyCompany', qs.stringify(data)).then((res) => {
- const data = res.data;
- if (data.code === 200) {
- // dispatch({
- // type: constants.CHANGE_COMPANY_DETAIL,
- // data: data.data,
- // });
- } else {
- error(`更新${title}失败`);
- }
- }).catch((e) => {
- error(`更新${title}失败`);
- })
- }
- }
|