提交 4d19a7cd 编写于 作者: zhongyao.qiao's avatar zhongyao.qiao

feat 配置更新

上级 ccbc4196
因为 它太大了无法显示 源差异 。您可以改为 查看blob
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getReportUrl, getWorkApi } from '@/utils/index' import { getBaseUrl, getReportUrl, getWorkApi } from '@/utils/index'
import { CryptoJS } from '@/plugins/aes' import { CryptoJS } from '@/plugins/aes'
import 'jsencrypt' import JSEncrypt from 'jsencrypt/bin/jsencrypt'
import { getPubKey } from '@/utils/account/accountApi'; import { getPubKey } from '@/utils/account/accountApi';
...@@ -14,12 +14,12 @@ module.exports = { ...@@ -14,12 +14,12 @@ module.exports = {
} }
}, },
created: function () { created: function () {
// let query = this.$router.query // let query = this.$router.query
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null // this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null // this.token = this.getUrlKey('token') || (query && query.token) || null
}, },
mounted: function() { mounted: function () {
}, },
methods: { methods: {
...@@ -29,34 +29,34 @@ module.exports = { ...@@ -29,34 +29,34 @@ module.exports = {
var aesKey = ""; var aesKey = "";
var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strLen = strList.length; var strLen = strList.length;
for(var i=0; i<len; i++){ for (var i = 0; i < len; i++) {
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) ); aesKey += strList.charAt(Math.floor(Math.random() * strLen));
}; };
return aesKey; return aesKey;
}, },
// 加密传参,发送请求 // 加密传参,发送请求
sendEncryptRequest(content, cb){ sendEncryptRequest(content, cb) {
content = JSON.stringify(content); // 后端要求转 string content = JSON.stringify(content); // 后端要求转 string
// debugger; // debugger;
if(pubKey){ // pubKey获取过就不用再获取了 if (pubKey) { // pubKey获取过就不用再获取了
let params = this.formatContent(content, pubKey); let params = this.formatContent(content, pubKey);
cb && cb(params); cb && cb(params);
}else{ } else {
this.handleGetPubKey(content, cb); this.handleGetPubKey(content, cb);
} }
}, },
// get public key // get public key
handleGetPubKey(content, cb){ handleGetPubKey(content, cb) {
getPubKey().then(res => { getPubKey().then(res => {
// console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res) // console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res)
if(res.code == '000000'){ if (res.code == '000000') {
pubKey = res.data; pubKey = res.data;
if(cb){ if (cb) {
let params = this.formatContent(content, pubKey); let params = this.formatContent(content, pubKey);
cb && cb(params); cb && cb(params);
} }
}else{ } else {
this.$message({ this.$message({
message: (res && res.message) || '接口出错', message: (res && res.message) || '接口出错',
type: 'warning' type: 'warning'
}); });
...@@ -81,11 +81,11 @@ module.exports = { ...@@ -81,11 +81,11 @@ module.exports = {
AesEncrypt(content, aesKey) { AesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey); let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content); let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7}); let encrypted = CryptoJS.AES.encrypt(sContent, sKey, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString(); return encrypted.toString();
}, },
// RSA encrypt // RSA encrypt
RsaEncrypt(aesKey, pubKey){ RsaEncrypt(aesKey, pubKey) {
let _encrypt = new JSEncrypt(); let _encrypt = new JSEncrypt();
let boss_public_key = pubKey; let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key); _encrypt.setPublicKey(boss_public_key);
...@@ -108,12 +108,12 @@ module.exports = { ...@@ -108,12 +108,12 @@ module.exports = {
return '' return ''
}, },
setRouterParm(paramList){ setRouterParm(paramList) {
let parm = {}; let parm = {};
if(paramList.length<=1){ if (paramList.length <= 1) {
return ''; return '';
} }
for(let i=1;i<paramList.length;i++){ for (let i = 1; i < paramList.length; i++) {
parm[paramList[i].key] = paramList[i].value; parm[paramList[i].key] = paramList[i].value;
} }
return parm; return parm;
...@@ -121,12 +121,12 @@ module.exports = { ...@@ -121,12 +121,12 @@ module.exports = {
// 拼接多个参数 // 拼接多个参数
getUrlParmByCode(paramList) { getUrlParmByCode(paramList) {
if ( paramList.length <= 1) { if (paramList.length <= 1) {
return '' return ''
} }
let dataStr = '' let dataStr = ''
let list = []; let list = [];
for( let i = 1; i < paramList.length; i ++) { for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value) list.push(paramList[i].key + '=' + paramList[i].value)
} }
dataStr = list.join('&') dataStr = list.join('&')
...@@ -145,7 +145,7 @@ module.exports = { ...@@ -145,7 +145,7 @@ module.exports = {
// 根据条件排序 // 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) { async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return; if (pageSize <= 0) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符 let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this, let _this = this,
para = { para = {
...@@ -159,22 +159,22 @@ module.exports = { ...@@ -159,22 +159,22 @@ module.exports = {
setEntry: 'headers', setEntry: 'headers',
} }
let url = 'contents/searchKeyword/searchContent' let url = 'contents/searchKeyword/searchContent'
let csourceData = await this.GET(url, para).then(res => { let csourceData = await this.GET(url, para).then(res => {
// _this.searchText = '' // _this.searchText = ''
if (res.code == '000000') { if (res.code == '000000') {
// 课程 // 课程
if(searchCategory.indexOf('1') >= 0) { if (searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || [] sourceData = (res.data && res.data.contentAppModels) || []
} }
if(searchCategory.indexOf('2') >= 0) { if (searchCategory.indexOf('2') >= 0) {
// sourceData = [] // sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || []) sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
} }
if(searchCategory.indexOf('3') >= 0) { if (searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || [] sourceData = (res.data && res.data.pCourseDoctorModels) || []
} }
if(searchCategory.indexOf('4') >= 0) { if (searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents sourceData = res.data.educationContents
} }
} }
...@@ -182,18 +182,18 @@ module.exports = { ...@@ -182,18 +182,18 @@ module.exports = {
}) })
return csourceData return csourceData
}, },
setEventByModuleCode(itemData){ setEventByModuleCode(itemData) {
let modeCode = itemData.appModuleInfo.code || ''; let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : '' let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') { if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = '' paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) { } else if (modeCode === 'M100' || modeCode === 'M300') {
// 支持多个参数 // 支持多个参数
let urlPara = this.getUrlParmByCode(paramList); let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){ if (paramList[0]) {
if( paramList[0].value.indexOf("?") == -1){ if (paramList[0].value.indexOf("?") == -1) {
paramList[0].value += urlPara paramList[0].value += urlPara
} }
} }
...@@ -203,25 +203,25 @@ module.exports = { ...@@ -203,25 +203,25 @@ module.exports = {
let v = paramList[0]['value']; let v = paramList[0]['value'];
let query = this.setRouterParm(paramList); let query = this.setRouterParm(paramList);
paramList = [{ paramList = [{
url:v, url: v,
query:query query: query
}] }]
this.$router.push({ this.$router.push({
path: v, path: v,
query: query query: query
}) })
//alert(this.token); //alert(this.token);
return 'NO' return 'NO'
} }
if(typeof paramList === 'string' && !paramList){ if (typeof paramList === 'string' && !paramList) {
paramList = [] paramList = []
} }
return paramList; return paramList;
}, },
// 通用GET请求 // 通用GET请求
GET(api, para, callback,str) { GET(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
url = encodeURI(url); url = encodeURI(url);
return fetch({ return fetch({
...@@ -230,31 +230,31 @@ module.exports = { ...@@ -230,31 +230,31 @@ module.exports = {
data: para data: para
}) })
}, },
reportGET(api, para, callback,str) { reportGET(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
url = encodeURI(url); url = encodeURI(url);
return fetch({ return fetch({
url: getReportUrl(url), url: getReportUrl(url),
method: 'get', method: 'get',
data: para data: para
}) })
}, },
// saas-GET请求 // saas-GET请求
saasGET(api, para) { saasGET(api, para) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({ return fetch({
headers: { headers: {
sysCode: 9, sysCode: 9,
}, },
url: getWorkApi(api), url: getWorkApi(api),
method: 'get', method: 'get',
params: para params: para
}) })
}, },
// 通用DELETE请求 // 通用DELETE请求
DELETE(api, para, callback,str) { DELETE(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
return fetch({ return fetch({
...@@ -291,32 +291,32 @@ module.exports = { ...@@ -291,32 +291,32 @@ module.exports = {
}, },
// 通用saas-POST请求 // 通用saas-POST请求
saasPOST(api, para, cType) { saasPOST(api, para, cType) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let header = {} let header = {}
if(cType) { if (cType) {
header['Content-Type'] = cType; header['Content-Type'] = cType;
} }
return fetch({ return fetch({
headers: { headers: {
sysCode: 9, sysCode: 9,
...header ...header
}, },
url: getWorkApi(api), url: getWorkApi(api),
method: 'post', method: 'post',
data: para data: para
}) })
},
// 通用saas-PUT请求
saasPUT(api, para) {
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'put',
data: para
})
}, },
// 通用saas-PUT请求
saasPUT(api, para) {
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'put',
data: para
})
},
// 从html参数 // 从html参数
getUrlKey(name) { getUrlKey(name) {
if (decodeURIComponent && location.href) { if (decodeURIComponent && location.href) {
......
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getReportUrl, getWorkApi, getCmsUrl } from '@/utils/index' import { getBaseUrl, getReportUrl, getWorkApi, getCmsUrl } from '@/utils/index'
import { CryptoJS } from '@/plugins/aes' import { CryptoJS } from '@/plugins/aes'
import JSEncrypt from 'jsencrypt' import JSEncrypt from 'jsencrypt/bin/jsencrypt'
import { getPubKey } from '@/utils/account/accountApi'; import { getPubKey } from '@/utils/account/accountApi';
...@@ -14,11 +14,11 @@ module.exports = { ...@@ -14,11 +14,11 @@ module.exports = {
} }
}, },
created: function () { created: function () {
// let query = this.$router.query // let query = this.$router.query
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null // this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null // this.token = this.getUrlKey('token') || (query && query.token) || null
}, },
mounted: function() { mounted: function () {
}, },
methods: { methods: {
...@@ -29,33 +29,33 @@ module.exports = { ...@@ -29,33 +29,33 @@ module.exports = {
var aesKey = ""; var aesKey = "";
var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strLen = strList.length; var strLen = strList.length;
for(var i=0; i<len; i++){ for (var i = 0; i < len; i++) {
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) ); aesKey += strList.charAt(Math.floor(Math.random() * strLen));
}; };
return aesKey; return aesKey;
}, },
// 加密传参,发送请求 // 加密传参,发送请求
sendEncryptRequest(content, cb){ sendEncryptRequest(content, cb) {
content = JSON.stringify(content); // 后端要求转 string content = JSON.stringify(content); // 后端要求转 string
// debugger; // debugger;
if(pubKey){ // pubKey获取过就不用再获取了 if (pubKey) { // pubKey获取过就不用再获取了
let params = this.formatContent(content, pubKey); let params = this.formatContent(content, pubKey);
cb && cb(params); cb && cb(params);
}else{ } else {
this.handleGetPubKey(content, cb); this.handleGetPubKey(content, cb);
} }
}, },
// get public key // get public key
handleGetPubKey(content, cb){ handleGetPubKey(content, cb) {
getPubKey().then(res => { getPubKey().then(res => {
// console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res) // console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res)
if(res.code == '000000'){ if (res.code == '000000') {
pubKey = res.data; pubKey = res.data;
if(cb){ if (cb) {
let params = this.formatContent(content, pubKey); let params = this.formatContent(content, pubKey);
cb && cb(params); cb && cb(params);
} }
}else{ } else {
this.$message({ this.$message({
message: (res && res.message) || '接口出错', message: (res && res.message) || '接口出错',
type: 'warning' type: 'warning'
...@@ -81,11 +81,11 @@ module.exports = { ...@@ -81,11 +81,11 @@ module.exports = {
AesEncrypt(content, aesKey) { AesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey); let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content); let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7}); let encrypted = CryptoJS.AES.encrypt(sContent, sKey, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString(); return encrypted.toString();
}, },
// RSA encrypt // RSA encrypt
RsaEncrypt(aesKey, pubKey){ RsaEncrypt(aesKey, pubKey) {
let _encrypt = new JSEncrypt(); let _encrypt = new JSEncrypt();
let boss_public_key = pubKey; let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key); _encrypt.setPublicKey(boss_public_key);
...@@ -108,12 +108,12 @@ module.exports = { ...@@ -108,12 +108,12 @@ module.exports = {
return '' return ''
}, },
setRouterParm(paramList){ setRouterParm(paramList) {
let parm = {}; let parm = {};
if(paramList.length<=1){ if (paramList.length <= 1) {
return ''; return '';
} }
for(let i=1;i<paramList.length;i++){ for (let i = 1; i < paramList.length; i++) {
parm[paramList[i].key] = paramList[i].value; parm[paramList[i].key] = paramList[i].value;
} }
return parm; return parm;
...@@ -121,12 +121,12 @@ module.exports = { ...@@ -121,12 +121,12 @@ module.exports = {
// 拼接多个参数 // 拼接多个参数
getUrlParmByCode(paramList) { getUrlParmByCode(paramList) {
if ( paramList.length <= 1) { if (paramList.length <= 1) {
return '' return ''
} }
let dataStr = '' let dataStr = ''
let list = []; let list = [];
for( let i = 1; i < paramList.length; i ++) { for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value) list.push(paramList[i].key + '=' + paramList[i].value)
} }
dataStr = list.join('&') dataStr = list.join('&')
...@@ -145,7 +145,7 @@ module.exports = { ...@@ -145,7 +145,7 @@ module.exports = {
// 根据条件排序 // 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) { async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return; if (pageSize <= 0) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符 let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this, let _this = this,
para = { para = {
...@@ -164,17 +164,17 @@ module.exports = { ...@@ -164,17 +164,17 @@ module.exports = {
// _this.searchText = '' // _this.searchText = ''
if (res.code == '000000') { if (res.code == '000000') {
// 课程 // 课程
if(searchCategory.indexOf('1') >= 0) { if (searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || [] sourceData = (res.data && res.data.contentAppModels) || []
} }
if(searchCategory.indexOf('2') >= 0) { if (searchCategory.indexOf('2') >= 0) {
// sourceData = [] // sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || []) sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
} }
if(searchCategory.indexOf('3') >= 0) { if (searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || [] sourceData = (res.data && res.data.pCourseDoctorModels) || []
} }
if(searchCategory.indexOf('4') >= 0) { if (searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents sourceData = res.data.educationContents
} }
} }
...@@ -183,17 +183,17 @@ module.exports = { ...@@ -183,17 +183,17 @@ module.exports = {
return csourceData return csourceData
}, },
setEventByModuleCode(itemData){ setEventByModuleCode(itemData) {
let modeCode = itemData.appModuleInfo.code || ''; let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : '' let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') { if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = '' paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) { } else if (modeCode === 'M100' || modeCode === 'M300') {
// 支持多个参数 // 支持多个参数
let urlPara = this.getUrlParmByCode(paramList); let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){ if (paramList[0]) {
if( paramList[0].value.indexOf("?") == -1){ if (paramList[0].value.indexOf("?") == -1) {
paramList[0].value += urlPara paramList[0].value += urlPara
} }
} }
...@@ -203,17 +203,17 @@ module.exports = { ...@@ -203,17 +203,17 @@ module.exports = {
let v = paramList[0]['value']; let v = paramList[0]['value'];
let query = this.setRouterParm(paramList); let query = this.setRouterParm(paramList);
paramList = [{ paramList = [{
url:v, url: v,
query:query query: query
}] }]
this.$router.push({ this.$router.push({
path: v, path: v,
query: query query: query
}) })
//alert(this.token); //alert(this.token);
return 'NO' return 'NO'
} }
if(typeof paramList === 'string' && !paramList){ if (typeof paramList === 'string' && !paramList) {
paramList = [] paramList = []
} }
return paramList; return paramList;
...@@ -221,7 +221,7 @@ module.exports = { ...@@ -221,7 +221,7 @@ module.exports = {
// 通用GET请求 // 通用GET请求
GET(api, para, callback, str, noLoading) { GET(api, para, callback, str, noLoading) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
url = encodeURI(url); url = encodeURI(url);
return fetch({ return fetch({
...@@ -233,29 +233,29 @@ module.exports = { ...@@ -233,29 +233,29 @@ module.exports = {
}, },
reportGET(api, para, callback, str) { reportGET(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
url = encodeURI(url); url = encodeURI(url);
return fetch({ return fetch({
url: getReportUrl(url), url: getReportUrl(url),
method: 'get', method: 'get',
data: para, data: para,
}) })
}, },
// saas-GET请求 // saas-GET请求
saasGET(api, para) { saasGET(api, para) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({ return fetch({
headers: { headers: {
sysCode: 9, sysCode: 9,
}, },
url: getWorkApi(api), url: getWorkApi(api),
method: 'get', method: 'get',
params: para params: para
}) })
}, },
// 通用DELETE请求 // 通用DELETE请求
DELETE(api, para, callback,str) { DELETE(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
return fetch({ return fetch({
...@@ -302,32 +302,32 @@ module.exports = { ...@@ -302,32 +302,32 @@ module.exports = {
}, },
// 通用saas-POST请求 // 通用saas-POST请求
saasPOST(api, para, cType) { saasPOST(api, para, cType) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE" // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let header = {} let header = {}
if(cType) { if (cType) {
header['Content-Type'] = cType; header['Content-Type'] = cType;
} }
return fetch({ return fetch({
headers: { headers: {
sysCode: 9, sysCode: 9,
...header ...header
}, },
url: getWorkApi(api), url: getWorkApi(api),
method: 'post', method: 'post',
data: para data: para
}) })
},
// 通用saas-PUT请求
saasPUT(api, para) {
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'put',
data: para
})
}, },
// 通用saas-PUT请求
saasPUT(api, para) {
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'put',
data: para
})
},
// 从html参数 // 从html参数
getUrlKey(name) { getUrlKey(name) {
if (decodeURIComponent && location.href) { if (decodeURIComponent && location.href) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册