u
This commit is contained in:
1 parent
6c20d0c80d
commit
4aaa93df7d
66 files changed
+4375
-1311
No files matched your search
@@ -1,4 +1,6 @@
|
||||
import request from './index'
|
||||
import { httpPost } from './index'
|
||||
|
||||
const aliyunBucket = import.meta.env.VITE_ALIYUN_BUCKET
|
||||
|
||||
interface LoginParams {
|
||||
orgid: string
|
||||
@@ -7,99 +9,15 @@ interface LoginParams {
|
||||
}
|
||||
|
||||
export function loginApi(params: LoginParams) {
|
||||
return request.postForm('/login.jsp', params)
|
||||
}
|
||||
|
||||
interface GetAutocompleteDataParams {
|
||||
q: string
|
||||
page: number
|
||||
limit: number
|
||||
viewname: string
|
||||
field1: string
|
||||
field2: string
|
||||
userid?: string
|
||||
}
|
||||
|
||||
export function getAutocompleteDataApi(params: GetAutocompleteDataParams) {
|
||||
return request.postForm('/getAutocompleteData.jsp', params)
|
||||
}
|
||||
|
||||
interface GetAutocompleteDataExParams {
|
||||
q: string
|
||||
page: number
|
||||
limit: number
|
||||
viewname: string
|
||||
field1: string
|
||||
field2: string
|
||||
searchcondition: string
|
||||
userid?: string
|
||||
}
|
||||
|
||||
export function getAutocompleteDataExApi(params: GetAutocompleteDataExParams) {
|
||||
return request.postForm('/getAutocompleteDataEx.jsp', params)
|
||||
}
|
||||
|
||||
interface SaveobjtParams {
|
||||
tables: any
|
||||
insertValues: any
|
||||
delValues: any
|
||||
updateValues: any
|
||||
keys: any
|
||||
}
|
||||
|
||||
export function saveobjtApi(params: SaveobjtParams) {
|
||||
return request.postForm('/saveobjt.jsp', params)
|
||||
}
|
||||
|
||||
interface SavesubtableParams {
|
||||
subtable: any
|
||||
subinsertvalue: any
|
||||
subdelvalue: any
|
||||
subupdatevalue: any
|
||||
father: any
|
||||
}
|
||||
export function savesubtableApi(params: SavesubtableParams) {
|
||||
return request.postForm('/savesubtable.jsp', params)
|
||||
}
|
||||
|
||||
interface SearchdataParams {
|
||||
viewname: string
|
||||
searchcondition: string
|
||||
orderfield: string
|
||||
limit?: number
|
||||
}
|
||||
export function searchdataApi(params: SearchdataParams) {
|
||||
return request.postForm('/searchdata.jsp', params)
|
||||
}
|
||||
|
||||
interface SearchdatapageindexParams {
|
||||
viewname: string
|
||||
searchcondition: string
|
||||
userid: string
|
||||
orderfield: string
|
||||
page: number
|
||||
rows: number
|
||||
}
|
||||
|
||||
export function searchdatapageindexApi(params: SearchdatapageindexParams) {
|
||||
return request.postForm(`/searchdatapageindex.jsp`, params)
|
||||
}
|
||||
interface DelSubRecordParams {
|
||||
id: string
|
||||
module: string
|
||||
bucketName: string
|
||||
}
|
||||
export function delSubRecordApi(params: DelSubRecordParams) {
|
||||
return request.postForm('/DelSubRecord.jsp', params)
|
||||
return httpPost('/auth/login', params)
|
||||
}
|
||||
|
||||
interface GetaliyunkeyParams {
|
||||
orgid: string
|
||||
bucket: string
|
||||
}
|
||||
|
||||
export function getaliyunkeyApi(params: GetaliyunkeyParams) {
|
||||
return request.postForm(`/getaliyunkey.jsp`, params)
|
||||
return httpPost('/file/getAliyunKey', params)
|
||||
}
|
||||
|
||||
interface AliyunpluploadParams {
|
||||
@@ -112,82 +30,20 @@ interface AliyunpluploadParams {
|
||||
mx_cate_id: string
|
||||
}
|
||||
export function aliyunpluploadApi(params: AliyunpluploadParams) {
|
||||
return request.postForm(`/aliyunplupload.jsp`, params)
|
||||
return httpPost(`/file/insert`, params)
|
||||
}
|
||||
|
||||
interface LoaddatabysqlParams {
|
||||
sql: string
|
||||
orderfield: string
|
||||
soption: string
|
||||
}
|
||||
export function loaddatabysqlApi(params: LoaddatabysqlParams) {
|
||||
return request.postForm('/loaddatabysql.jsp', params)
|
||||
}
|
||||
interface GetfieldvaluebyidParams {
|
||||
viewname: string
|
||||
desfield: string
|
||||
idfield: string
|
||||
idvalue: string
|
||||
}
|
||||
export function getfieldvaluebyidApi(params: GetfieldvaluebyidParams) {
|
||||
return request.postForm('/getfieldvaluebyid.jsp', params)
|
||||
interface OcrBoxRequest {
|
||||
fileUrl: string
|
||||
}
|
||||
|
||||
interface GetdefaultdataParams {
|
||||
viewname: string
|
||||
}
|
||||
export function getdefaultdataApi(params: GetdefaultdataParams) {
|
||||
return request.postForm('/getdefaultdata.jsp', params)
|
||||
export function recognizeOcrBoxApi(params: OcrBoxRequest) {
|
||||
return httpPost(`/ocr/box`, params)
|
||||
}
|
||||
|
||||
interface GetautoidParams {
|
||||
moduleid: string
|
||||
userid: string
|
||||
}
|
||||
export function getautoidApi(params: GetautoidParams) {
|
||||
return request.postForm('/getautoid.jsp', params)
|
||||
}
|
||||
interface LoaddataParams {
|
||||
soption: string
|
||||
orderfield: string
|
||||
viewname: string
|
||||
searchcondition: string
|
||||
}
|
||||
export function loaddataApi(params: LoaddataParams) {
|
||||
return request.postForm('/loaddata.jsp', params)
|
||||
}
|
||||
|
||||
interface SaveLogParams {
|
||||
mainTable: string
|
||||
strMainUpdate: string
|
||||
strMainDelete: string
|
||||
subTable: string
|
||||
strSubUpdate: string
|
||||
strSubDelete: string
|
||||
recordID: string
|
||||
subID: string
|
||||
Modifyb: string
|
||||
Modifyh: string
|
||||
}
|
||||
export function saveLogApi(params: SaveLogParams) {
|
||||
return request.postForm('/saveLog.jsp', params)
|
||||
}
|
||||
|
||||
interface LoaddataAttachParams {
|
||||
soption: string
|
||||
orderfield: string
|
||||
viewname: string
|
||||
searchcondition: string
|
||||
}
|
||||
|
||||
export function loaddataAttachApi(params: LoaddataAttachParams) {
|
||||
return request.postForm('/loaddata_attach.jsp', params)
|
||||
}
|
||||
|
||||
interface DelObjParams {
|
||||
id: string
|
||||
module: string
|
||||
}
|
||||
export function delObjApi(params: DelObjParams) {
|
||||
return request.postForm('/DelObj.jsp', params)
|
||||
export function deleteAliyunFileApi(fileUrl) {
|
||||
return httpPost(`/file/deleteAliyunFile`, {
|
||||
bucketName: aliyunBucket,
|
||||
mx_mapfilename: fileUrl,
|
||||
})
|
||||
}
|
||||
@@ -103,6 +103,7 @@ function request<T = any>(option: UniApp.RequestOptions): Promise<IResData<T>> &
|
||||
}
|
||||
|
||||
let data: IResData<T>
|
||||
|
||||
try {
|
||||
// 解析最外层响应
|
||||
data = typeof res.data === 'string' ? JSON.parse(res.data) : res.data
|
||||
@@ -119,13 +120,14 @@ function request<T = any>(option: UniApp.RequestOptions): Promise<IResData<T>> &
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
console.log(`解析响应JSON失败:${err}`)
|
||||
toast.fail('响应数据解析失败')
|
||||
return reject(new Error('响应数据解析失败'))
|
||||
}
|
||||
|
||||
if (data.code === 200) {
|
||||
data.success = true
|
||||
|
||||
resolve(data)
|
||||
}
|
||||
else {
|
||||
@@ -134,7 +136,7 @@ function request<T = any>(option: UniApp.RequestOptions): Promise<IResData<T>> &
|
||||
}
|
||||
|
||||
// 登录失效处理
|
||||
if (data.code === 600) {
|
||||
if (data.code === 401) {
|
||||
uni.showToast({ title: '请重新登录', icon: 'none' })
|
||||
|
||||
const pages = getCurrentPages()
|
||||
@@ -150,7 +152,6 @@ function request<T = any>(option: UniApp.RequestOptions): Promise<IResData<T>> &
|
||||
fail: (err) => {
|
||||
if (aborted)
|
||||
return reject(new Error('请求已取消'))
|
||||
console.log(err)
|
||||
toast.fail('网络请求失败,请联系管理人员')
|
||||
|
||||
reject(new Error(err.errMsg || '网络请求失败'))
|
||||
@@ -171,6 +172,7 @@ function request<T = any>(option: UniApp.RequestOptions): Promise<IResData<T>> &
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
function parseFormUrlencoded(str: string) {
|
||||
return str.split('&').reduce((acc, pair) => {
|
||||
const [key, value] = pair.split('=')
|
||||
@@ -244,4 +246,17 @@ request.postForm = <T = any>(url: string, data?: any, option?: UniApp.RequestOpt
|
||||
})
|
||||
}
|
||||
|
||||
export function httpPost<T = any>(url: string, data?: any, option?: UniApp.RequestOptions) {
|
||||
return request<T>({
|
||||
method: 'POST',
|
||||
url,
|
||||
data,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
...(option?.header || {}),
|
||||
},
|
||||
...option,
|
||||
})
|
||||
}
|
||||
|
||||
export default request
|
||||
Reference in new issue
Block a user