|
@@ -199,17 +199,37 @@ export default { |
|
|
OFF(name, func) { |
|
|
OFF(name, func) { |
|
|
uni.$off(name, func) |
|
|
uni.$off(name, func) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// sortArr(array,num=0){ |
|
|
|
|
|
// let arr = JSON.parse(JSON.stringify(array)) |
|
|
|
|
|
// for(let i = 0;i<arr.length-1-num;i++){ |
|
|
|
|
|
// if(Number(arr[i].classno) < Number(arr[i+1].classno)){ |
|
|
|
|
|
// let item = JSON.parse(JSON.stringify(arr[i])) |
|
|
|
|
|
// let item1 = JSON.parse(JSON.stringify(arr[i+1])) |
|
|
|
|
|
// arr[i] = item1 |
|
|
|
|
|
// arr[i+1] = item |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// if(num < arr.length-1){ |
|
|
|
|
|
// return this.sortArr(arr,num+1) |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// return arr |
|
|
|
|
|
// } |
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
// 拉取指定 code 值的数据源数据 |
|
|
// 拉取指定 code 值的数据源数据 |
|
|
async FETCH_DATASOURCE(code) { |
|
|
async FETCH_DATASOURCE(code) { |
|
|
if (!code) { |
|
|
if (!code) { |
|
|
return [] |
|
|
return [] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return await this.HTTP_GET('learun/adms/datasource/map', { |
|
|
|
|
|
code, |
|
|
|
|
|
ver: '' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
let res = await this.HTTP_GET('learun/adms/datasource/map', {code,ver: ''}) |
|
|
|
|
|
// if(res.data&&res.data.length){ |
|
|
|
|
|
// if(code == "bjsj"){ |
|
|
|
|
|
// console.log({data:this.sortArr(res.data),ver:res.ver}) |
|
|
|
|
|
// return {data:this.sortArr(res.data),ver:res.ver} |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
return res |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 拉取指定规则编号的表单编码数据 |
|
|
// 拉取指定规则编号的表单编码数据 |
|
@@ -229,6 +249,50 @@ export default { |
|
|
|
|
|
|
|
|
return await this.HTTP_GET('learun/adms/annexes/wxfileinfo', fileId) |
|
|
return await this.HTTP_GET('learun/adms/annexes/wxfileinfo', fileId) |
|
|
}, |
|
|
}, |
|
|
|
|
|
//删除指定id的文件信息 |
|
|
|
|
|
async DELETE_FILE(fileId) { |
|
|
|
|
|
if (!fileId) { |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return await this.HTTP_POST('learun/adms/annexes/wxdelete', fileId); |
|
|
|
|
|
}, |
|
|
|
|
|
//获取文件夹下文件列表 |
|
|
|
|
|
async FETCH_FILEList(folderId) { |
|
|
|
|
|
if (!folderId) { |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return await this.HTTP_GET('learun/adms/annexes/wxlist', folderId) |
|
|
|
|
|
}, |
|
|
|
|
|
// 根据文件夹id获取图片列表用于上传组件 |
|
|
|
|
|
async getFileListById(folderId){ |
|
|
|
|
|
if(!folderId){ |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
let wxlist = await this.FETCH_FILEList(folderId),fileList = [] |
|
|
|
|
|
for (const wxfile of wxlist) { |
|
|
|
|
|
const fileInfo = await this.FETCH_FILEINFO(wxfile.F_Id) |
|
|
|
|
|
if (!fileInfo) { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const fileType = fileInfo.F_FileType |
|
|
|
|
|
const fileSize = fileInfo.F_FileSize |
|
|
|
|
|
const fileName = fileInfo.F_FileName |
|
|
|
|
|
|
|
|
|
|
|
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) |
|
|
|
|
|
fileList.push({ |
|
|
|
|
|
path, |
|
|
|
|
|
type: fileType, |
|
|
|
|
|
uid:wxfile.F_Id, |
|
|
|
|
|
folderId:wxfile.F_FolderId, |
|
|
|
|
|
size: fileSize, |
|
|
|
|
|
name:fileName |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
return fileList |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 封装的 GET 请求,集成了验证信息 |
|
|
// 封装的 GET 请求,集成了验证信息 |
|
|
// 返回请求结果或 null |
|
|
// 返回请求结果或 null |
|
@@ -258,11 +322,17 @@ export default { |
|
|
// url 为请求地址 |
|
|
// url 为请求地址 |
|
|
// filePath 为临时文件的路径 |
|
|
// filePath 为临时文件的路径 |
|
|
// formData 为请求附带的提交数据 |
|
|
// formData 为请求附带的提交数据 |
|
|
async HTTP_UPLOAD(filePath, formData) { |
|
|
|
|
|
const [err, res] = await this.UPLOAD('/annexes/wxupload', filePath, formData) |
|
|
|
|
|
|
|
|
async HTTP_UPLOAD(filePath, formData,guid) { |
|
|
|
|
|
const [err, res] = await this.UPLOAD('/learun/adms/annexes/wxupload', filePath, formData,guid) |
|
|
|
|
|
|
|
|
return this.handleResult(err, res) |
|
|
return this.handleResult(err, res) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async HTTP_UPLOAD2(url,filePath, formData) { |
|
|
|
|
|
const [err, res] = await this.UPLOAD(url, filePath, formData) |
|
|
|
|
|
|
|
|
|
|
|
return this.handleResult(err, res) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 封装的文件下载,集成了验证信息 |
|
|
// 封装的文件下载,集成了验证信息 |
|
|
// 返回临时文件路径或 null |
|
|
// 返回临时文件路径或 null |
|
@@ -270,7 +340,7 @@ export default { |
|
|
// url 为请求地址 |
|
|
// url 为请求地址 |
|
|
// formData 为请求附带的提交数据 |
|
|
// formData 为请求附带的提交数据 |
|
|
async HTTP_DOWNLOAD(formData) { |
|
|
async HTTP_DOWNLOAD(formData) { |
|
|
const [err, res] = await this.DOWNLOAD('/annexes/wxdown', formData) |
|
|
|
|
|
|
|
|
const [err, res] = await this.DOWNLOAD('/learun/adms/annexes/wxdown', formData) |
|
|
|
|
|
|
|
|
return this.handleResult(err, res) |
|
|
return this.handleResult(err, res) |
|
|
}, |
|
|
}, |
|
@@ -302,11 +372,12 @@ export default { |
|
|
// 返回结果是一个数组: [error, result] |
|
|
// 返回结果是一个数组: [error, result] |
|
|
// error 表示错误,一般是网络错误,请求很可能根本没有发出 |
|
|
// error 表示错误,一般是网络错误,请求很可能根本没有发出 |
|
|
// result 包含 { statusCode, data } 分别表示状态码、接口返回的数据 |
|
|
// result 包含 { statusCode, data } 分别表示状态码、接口返回的数据 |
|
|
async UPLOAD(url, filePath, formData) { |
|
|
|
|
|
|
|
|
async UPLOAD(url, filePath, formData,guid) { |
|
|
const uploadUrl = this.handleUrl(url) |
|
|
const uploadUrl = this.handleUrl(url) |
|
|
const query = { |
|
|
const query = { |
|
|
loginMark: this.getLoginMark(), |
|
|
loginMark: this.getLoginMark(), |
|
|
token: this.GET_GLOBAL('token') |
|
|
|
|
|
|
|
|
token: this.GET_GLOBAL('token'), |
|
|
|
|
|
folderId:guid |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (formData && typeof formData === 'object') { |
|
|
if (formData && typeof formData === 'object') { |
|
@@ -654,6 +725,7 @@ export default { |
|
|
title: '登录状态无效,正在跳转到登录页…', |
|
|
title: '登录状态无效,正在跳转到登录页…', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
|
|
|
return null |
|
|
this.CLEAR_GLOBAL() |
|
|
this.CLEAR_GLOBAL() |
|
|
uni.reLaunch({ |
|
|
uni.reLaunch({ |
|
|
url: '/pages/login' |
|
|
url: '/pages/login' |
|
@@ -673,20 +745,12 @@ export default { |
|
|
|
|
|
|
|
|
return null |
|
|
return null |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//dyy 2020-03-09 14:50 |
|
|
|
|
|
//请求成功后,返回数据状态码不等于200,请求数据失败 |
|
|
|
|
|
if(result.data && result.data.code !== 200){ |
|
|
|
|
|
|
|
|
if(result.data.code != 200){ |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
if (tips) { |
|
|
|
|
|
const errInfo = (result.data && result.data.info) || '(未知原因)' |
|
|
|
|
|
const errTips = typeof tips === 'string' ? tips : '请求数据时发生错误' |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: `${errTips}: ${errInfo}`, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: result.data.info, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
return null |
|
|
return null |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|