/* * @Author: 派大星 * @Date: 2021-04-02 15:09:51 * @LastEditors: 派大星 * @LastEditTime: 2021-06-07 14:11:38 * @Description: */ // 通用js文件 function ajaxReturn(obj) { if (typeof $ == 'undefined') { console.error('未找到可用的jquery'); } if (typeof layer == 'undefined') { console.error('未找到可用的layer模块'); } let data = {}; if (!obj.isJson) { $.each(obj.data, (index, field) => { data[field.name] = field.value; }); } else { data = obj.data; } let index = layer.load(1, { shade: [0.1, '#000'] //0.1透明度的白色背景 }); $.ajax({ type: obj.method, url: obj.url, dataType: 'json', data: data, success(res) { // console.log(typeof res) layer.close(index); let shift = res.status ? 0 : 6; layer.msg(res.msg, { shift }, () => { if (res.status) { obj.success(res); } else { obj.fail(); } }); } }); } // 蜘蛛切换效果 jQuery(".top_slideBox").slide({ titCell: ".hd ul", mainCell: ".bd ", autoPage: true, effect: "left", }); $("img").error(function () { $(this).remove(); $(this).data("original", "http://shyux.oss-cn-chengdu.aliyuncs.com/images/test.png"); });