Commit a503ee83 by limin

1.4.2

1 parent 54b5e8b2
{
"name": "glsx-common",
"version": "1.4.0",
"version": "1.4.2",
"description": "glsx common",
"main": "./dist/glsx-common.js",
"private": false,
......
......@@ -45,9 +45,12 @@ Http.prototype.create = function () {
this.service.interceptors.response.use(
({ data: res, config: { returnAll } }) => {
const {
response: { code_key = 'returnCode', errId = 'errId', code_success_value = '0', data_key = 'data' },
response: { code_key = 'code', errId = 'errId', code_success_value = '0', data_key = 'data' },
alert
} = this.customer
if (returnAll || !alert) {
return res
}
let code = res[code_key]
// let errId = res[errId]
// 特殊的code处理,可以增加
......@@ -58,12 +61,10 @@ Http.prototype.create = function () {
default:
if (alert) {
alert(res.message || res.msg || '出错了,请联系管理员')
} else {
returnAll = true
}
break
}
return returnAll ? res : res[data_key]
return res[data_key]
},
error => {
const { alert } = this.customer
......
......@@ -4,14 +4,13 @@
* @Author: limin
* @Date: 2021-09-06 11:12:07
* @LastEditors: limin
* @LastEditTime: 2021-09-21 14:36:51
* @FilePath: \npm\glsx-common\src\index.js
* @LastEditTime: 2021-10-11 14:13:52
* @FilePath: \glsx-common\src\index.js
*/
import Http from "./http";
import array from "./util.array";
import util from "./util";
// import qiankun from "./qiankun";
import storage from "./storage";
import Postmate from "./postmate";
const utils = { ...util, array, storage };
export { Http, utils, Postmate };
import Http from './http'
import array from './util.array'
import util from './util'
import storage from './storage'
import Postmate from './postmate'
const utils = { ...util, array, storage }
export { Http, utils, Postmate }
......@@ -27,20 +27,6 @@ export const Util = {
},
/**
* 获取当前时间
*/
getCurrentDate: function () {
let time = new Date()
let y = time.getFullYear()
let m = time.getMonth() + 1
let d = time.getDate()
return {
date: y + '/' + m + '/' + d
}
},
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
......@@ -62,28 +48,6 @@ export const Util = {
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {
let date1 = new Date()
let date2 = new Date(date1)
let time = 30
if (day) {
time = day
}
date2.setDate(date1.getDate() + time)
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
}
},
/**
* 字段截取
*/
cutStr: function (str, num) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!