Commit a503ee83 by limin

1.4.2

1 parent 54b5e8b2
{ {
"name": "glsx-common", "name": "glsx-common",
"version": "1.4.0", "version": "1.4.2",
"description": "glsx common", "description": "glsx common",
"main": "./dist/glsx-common.js", "main": "./dist/glsx-common.js",
"private": false, "private": false,
......
...@@ -45,9 +45,12 @@ Http.prototype.create = function () { ...@@ -45,9 +45,12 @@ Http.prototype.create = function () {
this.service.interceptors.response.use( this.service.interceptors.response.use(
({ data: res, config: { returnAll } }) => { ({ data: res, config: { returnAll } }) => {
const { 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 alert
} = this.customer } = this.customer
if (returnAll || !alert) {
return res
}
let code = res[code_key] let code = res[code_key]
// let errId = res[errId] // let errId = res[errId]
// 特殊的code处理,可以增加 // 特殊的code处理,可以增加
...@@ -58,12 +61,10 @@ Http.prototype.create = function () { ...@@ -58,12 +61,10 @@ Http.prototype.create = function () {
default: default:
if (alert) { if (alert) {
alert(res.message || res.msg || '出错了,请联系管理员') alert(res.message || res.msg || '出错了,请联系管理员')
} else {
returnAll = true
} }
break break
} }
return returnAll ? res : res[data_key] return res[data_key]
}, },
error => { error => {
const { alert } = this.customer const { alert } = this.customer
......
...@@ -4,14 +4,13 @@ ...@@ -4,14 +4,13 @@
* @Author: limin * @Author: limin
* @Date: 2021-09-06 11:12:07 * @Date: 2021-09-06 11:12:07
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2021-09-21 14:36:51 * @LastEditTime: 2021-10-11 14:13:52
* @FilePath: \npm\glsx-common\src\index.js * @FilePath: \glsx-common\src\index.js
*/ */
import Http from "./http"; import Http from './http'
import array from "./util.array"; import array from './util.array'
import util from "./util"; import util from './util'
// import qiankun from "./qiankun"; import storage from './storage'
import storage from "./storage"; import Postmate from './postmate'
import Postmate from "./postmate"; const utils = { ...util, array, storage }
const utils = { ...util, array, storage }; export { Http, utils, Postmate }
export { Http, utils, Postmate };
...@@ -27,20 +27,6 @@ export const Util = { ...@@ -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) { getUrlParams: function (name) {
...@@ -62,28 +48,6 @@ export const Util = { ...@@ -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) { 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!