Blame view

public/js/service/service-api.js 1007 Bytes
李奇 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**
 * 前端Ajax请求封装
 * @author LQ <qi.li@yoho.cn>
 * @date 2017/03/14
 */

var $ = require('yoho-jquery');

var reqUrls = {
    history: '/service/history',
    evaluate: '/service/evaluate',
    leaveMsg: '/service/leaveMsg',
    reason: '/service/queryReason'
};

var _ajax = function(method, reqUrl, params) {
    return $.ajax({
        type: method || 'GET',
        url: reqUrl,
        data: params
21
    });
李奇 authored
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
};

/**
 * 历史消息
 * @param params 参数对象
 */
exports.history = function(params) {
    return _ajax('POST', reqUrls.history, params);
};

/**
 * 保存评价
 * @param params 参数对象
 */
exports.evaluate = function(params) {
    return _ajax('POST', reqUrls.evaluate, params);
};

/**
 * 评价原因
 * @param params 参数对象
 */
exports.reason = function(params) {
    return _ajax('POST', reqUrls.reason, params);
};

/**
 * 留言
 * @param params 参数对象
 */
exports.leaveMsg = function(params) {
    return _ajax('POST', reqUrls.leaveMsg, params);
};