Commit d460e8cf by 钟乾明

u: 优化开发环境配置

parent 61a0da9d
...@@ -4,8 +4,39 @@ ...@@ -4,8 +4,39 @@
<meta charset='utf-8'> <meta charset='utf-8'>
<meta name='viewport' content='initial-scale=1.0, maximum-scale=1.0, user-scalable=0'> <meta name='viewport' content='initial-scale=1.0, maximum-scale=1.0, user-scalable=0'>
<title>简历</title> <title>简历</title>
<script src='miniapp://common/js/qing/qing.js'></script> <!-- <script src='miniapp://common/js/qing/qing.js'></script>-->
<!-- <script src='https://staging.jffctest.com/public/js/qing/latest/qing.js'></script>--> <!-- <script src='https://staging.jffctest.com/public/js/qing/latest/qing.js'></script>-->
<script>
console.log('开始引入库>>');
const ua = window.navigator.userAgent.toLocaleLowerCase();
if (ua.indexOf('qing') > -1) {
console.log('ua qing>>')
if (ua.indexOf('miniapp') > -1) {
console.log('ua 云之家小程序>>')
document.write('<scr' + 'ipt src="miniapp://common/js/qing/qing.js"></scr' + 'ipt>');
sessionStorage.setItem('runClientEnv', 'miniapp');
} else {
console.log('轻应用>>');
const testFlags = ['test', 'localhost', '192.168'];// 测试环境的url标志
if (testFlags.some(flag => location.origin.includes(flag))) {
sessionStorage.setItem('env', 'test');
} else {
sessionStorage.setItem('env', 'prod');
}
const qingUrl = sessionStorage.getItem('env') === 'test' ? 'https://staging.jffctest.com/public/js/qing/latest/qing.js' : 'https://portal.cndrealty.com/public/js/qing/latest/qing.js';
document.write('<scr' + 'ipt src="'+qingUrl+'"></scr' + 'ipt>');
// 轻应用从url上取ticket
let urlParamStr = location.href.split('?')[ 1 ] || '';
urlParamStr = urlParamStr.split('/')[ 0 ] || ''; // 截止/。用于去除尾部 /
urlParamStr = urlParamStr.split('#')[ 0 ] || ''; // 截止#。用于去除尾部 #
const urlParams = new URLSearchParams(((location.href.split('?')[ 1 ] || '').split('/')[ 0 ] || '').split('#')[ 0 ]);
// 从url上取ticket 存至全局
sessionStorage.setItem('ticket', urlParams.get('ticket') || '');
sessionStorage.setItem('runClientEnv', 'qing');
}
}
</script>
</head> </head>
<body> <body>
<div class='header'> <div class='header'>
......
...@@ -71,6 +71,17 @@ let config = { ...@@ -71,6 +71,17 @@ let config = {
note: ['jobstarttime', 'jobendtime'], note: ['jobstarttime', 'jobendtime'],
}, },
}, },
mVoList: {
name: '干部考核',
type: RENDER_TYPE.G,
img: 'cadre',
list: {
title: 'year',
note: 'result',
chilkey: ['attachmentName', 'attachmentFile'],
children: 'attachmentArray',
},
},
cadreEvaluationVoList: { cadreEvaluationVoList: {
name: '干部考核', name: '干部考核',
type: RENDER_TYPE.G, type: RENDER_TYPE.G,
......
...@@ -62,7 +62,7 @@ const config = { ...@@ -62,7 +62,7 @@ const config = {
loginuserid: '46000011', loginuserid: '46000011',
appkey: 'd504275e', appkey: 'd504275e',
uid: 'hqhuang@cndrealty.com', uid: 'hqhuang@cndrealty.com',
token:'yzj_6082c32a80f913acd16a0e8e9364914d', token:'yzj_199aa82fe0a735a740f446f4d1929e03',
baseUrl: 'https://staging.jffctest.com/', baseUrl: 'https://staging.jffctest.com/',
}; };
......
...@@ -8,7 +8,7 @@ import createWatermark from './lib/wmSVG'; ...@@ -8,7 +8,7 @@ import createWatermark from './lib/wmSVG';
import { setWaterMark } from './lib/wmCanvas'; import { setWaterMark } from './lib/wmCanvas';
console.log('开始>>', qing); console.log('开始>>', window.qing);
const PhotoSwipe = require('./lib/photoswipe.min').PhotoSwipe; const PhotoSwipe = require('./lib/photoswipe.min').PhotoSwipe;
const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min').PhotoSwipeUI_Default; const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min').PhotoSwipeUI_Default;
...@@ -447,7 +447,7 @@ function render(data) { ...@@ -447,7 +447,7 @@ function render(data) {
header.innerText = resumeBaseVo.username; header.innerText = resumeBaseVo.username;
name.innerText = resumeBaseVo.username; name.innerText = resumeBaseVo.username;
switch (jobGradeType) { switch (jobGradeType) {
case '1': case '1'://物业C级人员
// showToast('C级人员'); // showToast('C级人员');
var RENDER_ITEM = { var RENDER_ITEM = {
// 基础信息 // 基础信息
...@@ -465,7 +465,7 @@ function render(data) { ...@@ -465,7 +465,7 @@ function render(data) {
familyVoList: configuration.renderItem.familyVoList, familyVoList: configuration.renderItem.familyVoList,
// 干部考核 - // 干部考核 -
cadreEvaluationVoList: configuration.renderItem.cadreEvaluationVoList, cadreEvaluationVoList: configuration.renderItem.cadreEvaluationVoList,
// 绩效信息 // 绩效信息 员工考核
assessVoList: configuration.renderItem.assessVoList, assessVoList: configuration.renderItem.assessVoList,
// 奖惩信息 // 奖惩信息
rewardPunishVoList: configuration.renderItem.rewardPunishVoList rewardPunishVoList: configuration.renderItem.rewardPunishVoList
...@@ -481,7 +481,7 @@ function render(data) { ...@@ -481,7 +481,7 @@ function render(data) {
} }
} }
break; break;
case '2': case '2'://物业D级人员
// showToast('D级人员'); // 基础信息 当前任职 历史任职 绩效信息 奖惩信息 // showToast('D级人员'); // 基础信息 当前任职 历史任职 绩效信息 奖惩信息
var RENDER_ITEM = { var RENDER_ITEM = {
resumeBaseVo: configuration.renderItem.resumeBaseVo, resumeBaseVo: configuration.renderItem.resumeBaseVo,
...@@ -502,7 +502,7 @@ function render(data) { ...@@ -502,7 +502,7 @@ function render(data) {
} }
break; break;
case '3': case '3'://房开人员
var RENDER_ITEM = { var RENDER_ITEM = {
// 基础信息 // 基础信息
resumeBaseVo: configuration.renderItem.resumeBaseVo, resumeBaseVo: configuration.renderItem.resumeBaseVo,
...@@ -523,7 +523,7 @@ function render(data) { ...@@ -523,7 +523,7 @@ function render(data) {
//奖惩 //奖惩
rewardPunishVoList: configuration.renderItem.rewardPunishVoList rewardPunishVoList: configuration.renderItem.rewardPunishVoList
}; };
console.log('房开人员', RENDER_ITEM); console.log('房开人员展示的模块>>', RENDER_ITEM);
// // showToast('房开人员'); // // showToast('房开人员');
for (let r in RENDER_ITEM) { for (let r in RENDER_ITEM) {
if (data[ r ]) { if (data[ r ]) {
...@@ -592,7 +592,7 @@ function renderer(renderTemp, data) { ...@@ -592,7 +592,7 @@ function renderer(renderTemp, data) {
case RENDER_TYPE.G: // 干部考核 case RENDER_TYPE.G: // 干部考核
container.appendChild(listGRenderer(renderTemp.list, data)); container.appendChild(listGRenderer(renderTemp.list, data));
break; break;
case RENDER_TYPE.D: case RENDER_TYPE.D://员工考核
container.appendChild(listDRenderer(renderTemp.list, data)); container.appendChild(listDRenderer(renderTemp.list, data));
// container.appendChild(listJXRenderer(renderTemp.list, data));//新版绩效 // container.appendChild(listJXRenderer(renderTemp.list, data));//新版绩效
...@@ -630,10 +630,6 @@ function itemRenderer(title, value, extra = '') { ...@@ -630,10 +630,6 @@ function itemRenderer(title, value, extra = '') {
</div>`; </div>`;
} }
function function_name() {
}
// 物业页面 // 物业页面
function propertyRenderer(renderTemp, data) { function propertyRenderer(renderTemp, data) {
let type = renderTemp.type; let type = renderTemp.type;
...@@ -656,7 +652,7 @@ function propertyRenderer(renderTemp, data) { ...@@ -656,7 +652,7 @@ function propertyRenderer(renderTemp, data) {
case RENDER_TYPE.G: // 干部考核 case RENDER_TYPE.G: // 干部考核
container.appendChild(listGRenderer(renderTemp.list, data)); container.appendChild(listGRenderer(renderTemp.list, data));
break; break;
case RENDER_TYPE.D: case RENDER_TYPE.D:// 员工考核
container.appendChild(propertyListDRenderer(renderTemp.list, data)); container.appendChild(propertyListDRenderer(renderTemp.list, data));
break; break;
case RENDER_TYPE.E: case RENDER_TYPE.E:
...@@ -821,6 +817,130 @@ function listCRenderer(list, data) { ...@@ -821,6 +817,130 @@ function listCRenderer(list, data) {
return renderWrap(temp, data.length > 3); return renderWrap(temp, data.length > 3);
} }
//绩效考核渲染 员工考核
function listDRenderer(list, data) {
// console.log('绩效', {list,data})
//旧版绩效
// console.log('月度渲染>>', { list, data })
let temp = ``;
if (data && data.length) {
assFileList = [];
data.forEach((item, index) => {
let sub = '';
let note = list.note;
// console.log('propertyListDRenderer',list);
// if (list.subTitle) {
// list.subTitle.forEach((s, i) => {
// sub += (i && '|') || '';
// sub += item[s] || '无';
// });
// }
// if (note instanceof Object && note.length) {
// let t1 = data[index][list.note[0]];
// let t2 = data[index][list.note[1]];
// temp += itemRenderer(
// `${
// item[list.title]
// }<p class="item__content-sub-title">${sub}</p>`,
// `<span class="item__content-note">${t1}至${nowOrNot(
// t2
// )}</span>`
// );
// } else {
// temp += itemRenderer(
// `${item[list.title]}年`,
// `<span class="item__content-note">${item[note]}</span>`
// );
// }
//新增月度数据
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class='item__content-note t-black'>${item[ note ]} </span>`,
`${(item.months && item.months.length) || (item.attachmentArray && item.attachmentArray.length) ? 'has-children text-left' : 'text-left'}`
);
if ((item.months && item.months.length) || (item.attachmentArray && item.attachmentArray.length)) {
temp += '<div class="children_box">';
if (item.attachmentArray && item.attachmentArray.length) {
let sortChildren = item.attachmentArray.sort((a, b) => {
return a.attachmentName.localeCompare(b.attachmentName);
});
console.log('jx-sortChildren>>>', sortChildren);
sortChildren.forEach((items) => {
temp += itemRenderer(
`<span class='ass_file_link' data-url='${items.attachmentFile}'>${renderFileIcon(items.attachmentFile)}${renderFileName(items.attachmentName)}</span>`,
'',
'children_content'
);
assFileList.push(items.attachmentFile);
});
}
if (item.months && item.months.length) {
item.months.forEach((itemM, indexM) => {
temp += itemRenderer(
`<span class='child_row_title_dot'>·</span><span>${itemM.month}</span>`,
`<span class='item__content-note'>${itemM.assgrade}</span>`,
'text-left'
);
});
}
temp += '</div>';
}
});
} else {
temp = noDataRenderer();
}
return renderWrap(temp, data.length > 3);
// 新版
// let temp = ``;
// if (data && data.length) {
// data.forEach((item, index) => {
// temp +=
// `<div>
// <div class="frist-row flex-between">
// <div class="flex-row">
// ${item.children.length>0? `<div class="icon_img ${index==0?'icon_02_img':'icon_01_img'}"></div>`:''}
// <div>${item.assyear}</div>
// </div>
// <div>${item.assgrade}</div>
// </div>`
// temp += `<div class="second-box ${index==0?'box-block':'box-none'}">`
// item.children && item.children.forEach((item1) => {
// temp +=
// `<div class="second-row flex-between">
// <div class="flex-start">
// <div class="title-text">${item1.asstype}</div>
// </div>
// <div>${item1.assgrade}</div>
// </div>`
// // item1.children&&item1.children.forEach((item2)=>{
// // temp +=
// // `<div class="third-row flex-between">
// // <div class="flex-start">
// // <div class="title-text"><span class="dot-icon">·</span>${item2[list.title]}</div>
// // </div>
// // <div>${item2[list.note]}</div>
// // </div>`
// // })
// })
// temp += `</div>`
// temp += `</div>`
//
// });
// } else {
// temp = noDataRenderer();
// }
//
// return renderWrap(temp, data.length > 3);
}
function listERenderer(list, data) { function listERenderer(list, data) {
let temp = ``; let temp = ``;
...@@ -873,6 +993,91 @@ function listFRenderer(list, data) { ...@@ -873,6 +993,91 @@ function listFRenderer(list, data) {
return renderWrap(temp, data.length > 3); return renderWrap(temp, data.length > 3);
} }
//干部测评渲染
/**
* @description 干部测评渲染
* @param {*} list 渲染配置项 来自common.js
* @param {*} data 数据
*
*
* */
function listGRenderer(list, data) {
let temp = ``;
if (data && data.length) {
let cadreFile = [];
data.forEach((item, index) => {
let note = list.note;
let chil = list.chilkey;
let children = item[ list.children ]; //附件
let halfArr = item.halfArr;
// 有附件或有半年度
if ((chil instanceof Array && children) || (halfArr && halfArr.length)) {
let childrenHtml = ``;
// 文件名称排序
let sortChildren = children ? children.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
}) : [];
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content'
);
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
// 半年度
if (halfArr) {
halfArr.forEach((items) => {
childrenHtml += itemRenderer(
`· 半年度`,
`<span class="item__content-note t-black half_value">${items.result || ''}</span>`,
'children_content half_content'
);
// 半年度文件名称排序
let halfattAchmentArray = items.attachmentArray || [];
let sortChildren = halfattAchmentArray.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
});
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content half_content'
);
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
});
}
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class="item__content-note t-black ">${item[ note ] || ''}</span>`,
`${childrenHtml ? 'has-children text-left' : 'text-left'}`
);
if (childrenHtml) {
temp += `<div class="children_box">${childrenHtml}</div>`;
}
} else {
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class="item__content-note t-black">${item[ note ]}</span>`
);
}
});
cadreFileList = cadreFile;
} else {
temp = noDataRenderer();
}
return renderWrap(temp, data.length > 3);
}
// 绩效列表 // 绩效列表
let performanceArr = [], let performanceArr = [],
...@@ -2181,87 +2386,9 @@ function renderFileName(attachmentName) { ...@@ -2181,87 +2386,9 @@ function renderFileName(attachmentName) {
} }
//干部测评渲染
function listGRenderer(list, data) {
let temp = ``;
if (data && data.length) {
let cadreFile = [];
data.forEach((item, index) => {
let note = list.note;
let chil = list.chilkey;
let children = item[ list.children ]; //附件
let halfArr = item.halfArr;
// 有附件或有半年度
if ((chil instanceof Array && children) || (halfArr && halfArr.length)) {
let childrenHtml = ``;
// 文件名称排序
let sortChildren = children ? children.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
}) : [];
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content'
);
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
// 半年度
if (halfArr) {
halfArr.forEach((items) => {
childrenHtml += itemRenderer(
`· 半年度`,
`<span class="item__content-note t-black half_value">${items.result || ''}</span>`,
'children_content half_content'
);
// 半年度文件名称排序
let halfattAchmentArray = items.attachmentArray || [];
let sortChildren = halfattAchmentArray.sort((a, b) => {
return a[ list.chilkey[ 0 ] ].localeCompare(b[ list.chilkey[ 0 ] ]);
});
sortChildren.forEach((items) => {
childrenHtml += itemRenderer(
`<span class="file_link"> ${renderFileIcon(items[ list.chilkey[ 1 ] ])} ${renderFileName(items[ list.chilkey[ 0 ] ])}</span>`,
'',
'children_content half_content'
);
cadreFile.push(items[ list.chilkey[ 1 ] ]);
});
});
}
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class="item__content-note t-black ">${item[ note ] || ''}</span>`,
`${childrenHtml ? 'has-children text-left' : 'text-left'}`
);
if (childrenHtml) {
temp += `<div class="children_box">${childrenHtml}</div>`;
}
} else {
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class="item__content-note t-black">${item[ note ]}</span>`
);
}
});
cadreFileList = cadreFile;
} else {
temp = noDataRenderer();
}
return renderWrap(temp, data.length > 3);
}
function addFileEvent() { function addFileEvent() {
console.log('xxx');
let file_note = document.getElementsByClassName('file_link'); let file_note = document.getElementsByClassName('file_link');
// console.log('assFileList>>', assFileList) // console.log('assFileList>>', assFileList)
for (let i = 0; i < file_note.length; i++) { for (let i = 0; i < file_note.length; i++) {
...@@ -2270,9 +2397,7 @@ function addFileEvent() { ...@@ -2270,9 +2397,7 @@ function addFileEvent() {
} }
function addAssFileEvent() { function addAssFileEvent() {
console.log('--------------------------');
let file_note = document.getElementsByClassName('ass_file_link'); let file_note = document.getElementsByClassName('ass_file_link');
console.log('assFileList>>', assFileList);
for (let i = 0; i < file_note.length; i++) { for (let i = 0; i < file_note.length; i++) {
registerEvent(file_note[ i ], assFileList[ i ]); registerEvent(file_note[ i ], assFileList[ i ]);
} }
...@@ -2332,130 +2457,6 @@ function registerEvent(clickNode, data) { ...@@ -2332,130 +2457,6 @@ function registerEvent(clickNode, data) {
} }
//绩效考核渲染
function listDRenderer(list, data) {
// console.log('绩效', {list,data})
//旧版绩效
// console.log('月度渲染>>', { list, data })
let temp = ``;
if (data && data.length) {
assFileList = [];
data.forEach((item, index) => {
let sub = '';
let note = list.note;
// console.log('propertyListDRenderer',list);
// if (list.subTitle) {
// list.subTitle.forEach((s, i) => {
// sub += (i && '|') || '';
// sub += item[s] || '无';
// });
// }
// if (note instanceof Object && note.length) {
// let t1 = data[index][list.note[0]];
// let t2 = data[index][list.note[1]];
// temp += itemRenderer(
// `${
// item[list.title]
// }<p class="item__content-sub-title">${sub}</p>`,
// `<span class="item__content-note">${t1}至${nowOrNot(
// t2
// )}</span>`
// );
// } else {
// temp += itemRenderer(
// `${item[list.title]}年`,
// `<span class="item__content-note">${item[note]}</span>`
// );
// }
//新增月度数据
temp += itemRenderer(
`${item[ list.title ]}年`,
`<span class='item__content-note t-black'>${item[ note ]} </span>`,
`${(item.months && item.months.length) || (item.attachmentArray && item.attachmentArray.length) ? 'has-children text-left' : 'text-left'}`
);
if ((item.months && item.months.length) || (item.attachmentArray && item.attachmentArray.length)) {
temp += '<div class="children_box">';
if (item.attachmentArray && item.attachmentArray.length) {
let sortChildren = item.attachmentArray.sort((a, b) => {
return a.attachmentName.localeCompare(b.attachmentName);
});
console.log('jx-sortChildren>>>', sortChildren);
sortChildren.forEach((items) => {
temp += itemRenderer(
`<span class='ass_file_link' data-url='${items.attachmentFile}'>${renderFileIcon(items.attachmentFile)}${renderFileName(items.attachmentName)}</span>`,
'',
'children_content'
);
assFileList.push(items.attachmentFile);
});
}
if (item.months && item.months.length) {
item.months.forEach((itemM, indexM) => {
temp += itemRenderer(
`<span class='child_row_title_dot'>·</span><span>${itemM.month}</span>`,
`<span class='item__content-note'>${itemM.assgrade}</span>`,
'text-left'
);
});
}
temp += '</div>';
}
});
} else {
temp = noDataRenderer();
}
return renderWrap(temp, data.length > 3);
// 新版
// let temp = ``;
// if (data && data.length) {
// data.forEach((item, index) => {
// temp +=
// `<div>
// <div class="frist-row flex-between">
// <div class="flex-row">
// ${item.children.length>0? `<div class="icon_img ${index==0?'icon_02_img':'icon_01_img'}"></div>`:''}
// <div>${item.assyear}</div>
// </div>
// <div>${item.assgrade}</div>
// </div>`
// temp += `<div class="second-box ${index==0?'box-block':'box-none'}">`
// item.children && item.children.forEach((item1) => {
// temp +=
// `<div class="second-row flex-between">
// <div class="flex-start">
// <div class="title-text">${item1.asstype}</div>
// </div>
// <div>${item1.assgrade}</div>
// </div>`
// // item1.children&&item1.children.forEach((item2)=>{
// // temp +=
// // `<div class="third-row flex-between">
// // <div class="flex-start">
// // <div class="title-text"><span class="dot-icon">·</span>${item2[list.title]}</div>
// // </div>
// // <div>${item2[list.note]}</div>
// // </div>`
// // })
// })
// temp += `</div>`
// temp += `</div>`
//
// });
// } else {
// temp = noDataRenderer();
// }
//
// return renderWrap(temp, data.length > 3);
}
// 物业 // 物业
function propertyListARenderer(list, data, extra = '') { function propertyListARenderer(list, data, extra = '') {
...@@ -2576,13 +2577,11 @@ function propertyListCRenderer(list, data) { ...@@ -2576,13 +2577,11 @@ function propertyListCRenderer(list, data) {
} }
function propertyListDRenderer(list, data) { function propertyListDRenderer(list, data) {
// console.log('奇怪的',data,list)
let temp = ``; let temp = ``;
if (data && data.length) { if (data && data.length) {
data.forEach((item, index) => { data.forEach((item, index) => {
let sub = ''; let sub = '';
let note = list.note; let note = list.note;
// console.log('propertyListDRenderer',list);
if (list.subTitle) { if (list.subTitle) {
list.subTitle.forEach((s, i) => { list.subTitle.forEach((s, i) => {
sub += (i && '|') || ''; sub += (i && '|') || '';
...@@ -2760,7 +2759,13 @@ function getDateFormat(date) { ...@@ -2760,7 +2759,13 @@ function getDateFormat(date) {
// let month = now.getMonth(); // 得到月份 // let month = now.getMonth(); // 得到月份
// let date = now.getDate(); // 得到日期 // let date = now.getDate(); // 得到日期
} }
/**
* @description 重新过滤数据
* @param {*} item 模块名称
* @param {*} data 模块数据
* @param {*} isAssessNew 是否是新版绩效
* @return {*} 过滤后的数据
* */
// 重新过滤数据 // 重新过滤数据
function filterData(item, data, isAssessNew) { function filterData(item, data, isAssessNew) {
let assessData = data; let assessData = data;
...@@ -2880,8 +2885,6 @@ function filterData(item, data, isAssessNew) { ...@@ -2880,8 +2885,6 @@ function filterData(item, data, isAssessNew) {
}); });
} }
}); });
} }
} }
......
...@@ -33,8 +33,7 @@ window.customEvt = { ...@@ -33,8 +33,7 @@ window.customEvt = {
var customEvt = window.customEvt var customEvt = window.customEvt
var qing = window.qing var qing = window.qing
console.log('qing---1'); qing&&qing.ready(function () {
qing.ready(function () {
// 重写左侧返回按钮 // 重写左侧返回按钮
qing.call('defback', { qing.call('defback', {
success: function () { success: function () {
......
import axios from 'axios'; import axios from 'axios';
var originAdapter = axios.defaults.adapter; var originAdapter = axios.defaults.adapter;
console.log('r process.env.PACK_ENV>>', process.env.PACK_ENV);
axios.defaults.adapter = function(config) { axios.defaults.adapter = function(config) {
if (!/^https?/.test(config.url)) { // 区分美信云cordova环境、云之家qing环境
if (!process.env.PACK_ENV||process.env.PACK_ENV === 'dev') {
return originAdapter(config); return originAdapter(config);
} else {
if (sessionStorage.getItem('runClientEnv') === 'qing') {
console.log('轻应用request config>>', config);
return request(config);
}
if (!/^https?/.test(config.url)) {
console.log('is https>>');
return originAdapter(config);
}
return request(config);
} }
return request(config);
}; };
function isObject(value) { function isObject(value) {
...@@ -33,15 +45,12 @@ function params2object(url) { ...@@ -33,15 +45,12 @@ function params2object(url) {
if (typeof url === 'object') { if (typeof url === 'object') {
return url; return url;
} else if (typeof url === 'string') { } else if (typeof url === 'string') {
url url.replace(/^.*\?|#.*$/g, '').split('&').forEach((n) => {
.replace(/^.*\?|#.*$/g, '') n = n.split('=');
.split('&') if (n.length === 2) {
.forEach((n) => { params[ n[ 0 ] ] = decodeURIComponent(n[ 1 ]);
n = n.split('='); }
if (n.length === 2) { });
params[ n[ 0 ] ] = decodeURIComponent(n[ 1 ]);
}
});
} }
return params; return params;
} }
...@@ -67,18 +76,16 @@ function request(opt) { ...@@ -67,18 +76,16 @@ function request(opt) {
opt.url = opt.url =
opt.url.split('?')[ 0 ] + opt.url.split('?')[ 0 ] +
'?' + '?' +
Object.keys(urlParams) Object.keys(urlParams).map((key) => {
.map((key) => { var val = urlParams[ key ];
var val = urlParams[ key ]; if (isObject(val)) {
if (isObject(val)) { val = JSON.stringify(val);
val = JSON.stringify(val); val = encodeURIComponent(val);
val = encodeURIComponent(val); } else if (/[^\x00-\xff]/.test(val)) {
} else if (/[^\x00-\xff]/.test(val)) { val = encodeURIComponent(val);
val = encodeURIComponent(val); }
} return key + '=' + val;
return key + '=' + val; }).join('&');
})
.join('&');
// post非json即是form。 // post非json即是form。
if (opt.method.toLowerCase() === 'post') { if (opt.method.toLowerCase() === 'post') {
...@@ -107,21 +114,20 @@ function request(opt) { ...@@ -107,21 +114,20 @@ function request(opt) {
opt.headers = opt.headers || {}; opt.headers = opt.headers || {};
const headers = {}; const headers = {};
// headers字段值必须是字符串型 // headers字段值必须是字符串型
Object.keys(opt.headers) Object.keys(opt.headers).forEach(function(key) {
.forEach(function(key) { var val = opt.headers[ key ];
var val = opt.headers[ key ]; if (val) {
if (val) { var type = typeof val;
var type = typeof val; if (type !== 'string') {
if (type !== 'string') { val = val + '';
val = val + '';
}
// 因content-type可能存在大小写不规范,这里先过滤掉,后面根据serializer统一添加
var _key = key.toLowerCase();
if (_key !== 'content-type') {
headers[ _key ] = val;
}
} }
}); // 因content-type可能存在大小写不规范,这里先过滤掉,后面根据serializer统一添加
var _key = key.toLowerCase();
if (_key !== 'content-type') {
headers[ _key ] = val;
}
}
});
// 根据serializer统一添加content-type // 根据serializer统一添加content-type
headers[ 'content-type' ] = serializer === 'json' ? 'application/json' : 'application/x-www-form-urlencoded'; headers[ 'content-type' ] = serializer === 'json' ? 'application/json' : 'application/x-www-form-urlencoded';
opt.headers = headers; opt.headers = headers;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment