Commit 61a0da9d by 钟乾明

u: 辅助log

parent aafaec45
Showing with 178 additions and 178 deletions
This diff could not be displayed because it is too large.
...@@ -10,8 +10,7 @@ import { setWaterMark } from './lib/wmCanvas'; ...@@ -10,8 +10,7 @@ import { setWaterMark } from './lib/wmCanvas';
console.log('开始>>', qing); console.log('开始>>', qing);
const PhotoSwipe = require('./lib/photoswipe.min').PhotoSwipe; const PhotoSwipe = require('./lib/photoswipe.min').PhotoSwipe;
const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min') const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min').PhotoSwipeUI_Default;
.PhotoSwipeUI_Default;
const FastClick = require('fastclick'); const FastClick = require('fastclick');
// const IScroll = require('iscroll/build/iscroll-probe') // const IScroll = require('iscroll/build/iscroll-probe')
...@@ -57,36 +56,36 @@ const tipsModal = document.querySelector('.tips__modal'); ...@@ -57,36 +56,36 @@ const tipsModal = document.querySelector('.tips__modal');
const tipsmMdalClose = document.querySelector('.tips__close'); const tipsmMdalClose = document.querySelector('.tips__close');
app.ready(() => { app.ready(() => {
initUser() initUser().then(() => {
.then(() => { console.log('initUser then>>');
console.log('111>>'); $mas.token = token;
$mas.token = token; mount();
mount(); }).catch((e) => {
}) if (!configuration.product) {
.catch((e) => { _uid = configuration.uid;
if (!configuration.product) {
_uid = configuration.uid; loginuserid = configuration.loginuserid;
userid = configuration.userid;
loginuserid = configuration.loginuserid; token = configuration.token;
userid = configuration.userid; appKey = configuration.appKey;
token = configuration.token; } else {
appKey = configuration.appKey; alert(e);
} else { alert('应用启动发生错误,请联系开发人员');
alert(e); }
alert('应用启动发生错误,请联系开发人员'); $mas.token = token;
} mount();
$mas.token = token; //todo 开发环境调试添加水印
mount(); setWaterMark(`黄华强hqhuang@cndrealty.com`, '');
//todo 开发环境调试添加水印 // createWatermark({ content: '黄华强hqhuang@cndrealty.com' });
setWaterMark(`黄华强hqhuang@cndrealty.com`, ''); });
// createWatermark({ content: '黄华强hqhuang@cndrealty.com' });
});
// 取消延迟响应 // 取消延迟响应
FastClick.attach(document.body); FastClick.attach(document.body);
}, configuration.product); }, configuration.product);
function getUrlParamVal(paramName) { function getUrlParamVal(paramName) {
const params = location.search.slice(1); const params = location.search.slice(1);
console.log('location.href>>', location.href);
console.log('链接参数>>', params);
const reg = new RegExp(`(?:^|&)${paramName}=([^&]+)`); const reg = new RegExp(`(?:^|&)${paramName}=([^&]+)`);
if (reg.test(params)) { if (reg.test(params)) {
return decodeURIComponent(RegExp.$1); return decodeURIComponent(RegExp.$1);
...@@ -116,8 +115,7 @@ function getUserInfoByOid(oId) { ...@@ -116,8 +115,7 @@ function getUserInfoByOid(oId) {
opt.success = function(result) { opt.success = function(result) {
const success = (result || {}).success || false; const success = (result || {}).success || false;
const data = (result || {}).data || []; const data = (result || {}).data || [];
if (String(success) if (String(success).toLowerCase() !== 'true') {
.toLowerCase() !== 'true') {
reject(result.error || '获取人员信息失败!'); reject(result.error || '获取人员信息失败!');
return; return;
} }
...@@ -162,8 +160,7 @@ function getPersonInfosByJobNo(jobNos) { ...@@ -162,8 +160,7 @@ function getPersonInfosByJobNo(jobNos) {
opt.success = function(result) { opt.success = function(result) {
var success = (result || {}).success || false; var success = (result || {}).success || false;
var data = (result || {}).data || []; var data = (result || {}).data || [];
if (String(success) if (String(success).toLowerCase() !== 'true' || data.length === 0) {
.toLowerCase() !== 'true' || data.length === 0) {
reject(result.error || '获取人员信息失败!'); reject(result.error || '获取人员信息失败!');
return; return;
} }
...@@ -178,7 +175,7 @@ function getPersonInfosByJobNo(jobNos) { ...@@ -178,7 +175,7 @@ function getPersonInfosByJobNo(jobNos) {
async function initUser() { async function initUser() {
console.log('initUser>>'); console.log('initUser 开始>>');
let openId = getUrlParamVal('openId'); let openId = getUrlParamVal('openId');
const jobNo = getUrlParamVal('uid'); const jobNo = getUrlParamVal('uid');
if (jobNo) { if (jobNo) {
...@@ -203,121 +200,122 @@ async function initUser() { ...@@ -203,121 +200,122 @@ async function initUser() {
// 判断是否来自人员详情。 // 判断是否来自人员详情。
// 如果是从人员详情过来的,需要对employeenumber、uid做强校验。 // 如果是从人员详情过来的,需要对employeenumber、uid做强校验。
// 如果不是从人员详情过来的,employeenumber、uid从当前人员的获取。 // 如果不是从人员详情过来的,employeenumber、uid从当前人员的获取。
return Promise.all([app.getUser(), getUserInfoByOid(openId)]) return Promise.all([
.then(([user, viewee]) => { app.getUser(),
if (user.orgType) { getUserInfoByOid(openId)
user.extra = { ]).then(([user, viewee]) => {
orgType: user.orgType if (user.orgType) {
}; user.extra = {
} orgType: user.orgType
// user 查看者
// viewee 被查看者
console.log('user:', user);
console.log('viewee:', viewee);
//添加水印
// setWaterMark(`${user.cn}${user.uid}`, '');
createWatermark({ content: `${user.cn}${user.uid}` });
// todo:目前先写死房产,待黄延龄确认orgType怎么获取后再将orgType变成动态的。
const extra = {
avatar: viewee.avatar,
employeenumber: viewee.employeenumber,
uid: viewee.uid
}; };
loginuserid = user.employeenumber; }
if (viewee.orgType) { // user 查看者
extra.extra = { // viewee 被查看者
orgType: viewee.orgType console.log('user 查看者:', user);
}; console.log('viewee 被查看者:', viewee);
} console.log('location.href>>', location.href);
userid = isFromPersonDetail ? extra.employeenumber : user.employeenumber; //添加水印
_uid = isFromPersonDetail ? extra.uid : user.uid; // setWaterMark(`${user.cn}${user.uid}`, '');
photoUrl = isFromPersonDetail ? extra.avatar : user.avatar; createWatermark({ content: `${user.cn}${user.uid}` });
if (!userid || !_uid) { // todo:目前先写死房产,待黄延龄确认orgType怎么获取后再将orgType变成动态的。
alert('应用启动发生错误,请联系开发人员'); const extra = {
} avatar: viewee.avatar,
token = user.ssoToken; employeenumber: viewee.employeenumber,
console.log('extra>>', extra); uid: viewee.uid
console.log('configuration>>', configuration); };
loginuserid = user.employeenumber;
console.log('ccAppKey>>', ccAppKey); if (viewee.orgType) {
appKey = extra.appkey || configuration.appkey || ccAppKey; extra.extra = {
console.log('appKey>>', appKey); orgType: viewee.orgType
/* old-code };
let orgType; }
if (!extra.extra) { userid = isFromPersonDetail ? extra.employeenumber : user.employeenumber;
orgType = eval('(' + user.extra + ')').orgType; _uid = isFromPersonDetail ? extra.uid : user.uid;
} else { photoUrl = isFromPersonDetail ? extra.avatar : user.avatar;
orgType = if (!userid || !_uid) {
eval('(' + extra.extra + ')').orgType || alert('应用启动发生错误,请联系开发人员');
eval('(' + user.extra + ')').orgType; }
} token = user.ssoToken;
*/ console.log('extra>>', extra);
const _extra = extra.extra || user.extra || {}; console.log('configuration>>', configuration);
orgType = '' + _extra.orgType;
// 2024-08-08 黄延龄反馈:1是房开 2是物业 合诚待定 console.log('ccAppKey>>', ccAppKey);
// 将物业(原来是6)调整为2,原来是2的怡家园调整为6 appKey = extra.appkey || configuration.appkey || ccAppKey;
console.log('appKey>>', appKey);
switch (orgType) { /* old-code
// 房产 let orgType;
case '1': if (!extra.extra) {
break; orgType = eval('(' + user.extra + ')').orgType;
// 怡家园 } else {
case '6': orgType =
$mas.config({ eval('(' + extra.extra + ')').orgType ||
baseUrl: configuration.baseUrl, eval('(' + user.extra + ')').orgType;
code: configuration.yjyCode }
}); */
url = configuration.methods.yjyResume; const _extra = extra.extra || user.extra || {};
userid = userid.replace('YJY', ''); orgType = '' + _extra.orgType;
_uid = _uid.replace('YJY', ''); // 2024-08-08 黄延龄反馈:1是房开 2是物业 合诚待定
break; // 将物业(原来是6)调整为2,原来是2的怡家园调整为6
// 汇嘉
case '3': switch (orgType) {
$mas.config({ // 房产
baseUrl: configuration.baseUrl, case '1':
code: configuration.hjCode break;
}); // 怡家园
url = configuration.methods.hjResume; case '6':
break; $mas.config({
// 物业 baseUrl: configuration.baseUrl,
case '2': code: configuration.yjyCode
$mas.config({ });
baseUrl: configuration.baseUrl, url = configuration.methods.yjyResume;
code: configuration.wyCode userid = userid.replace('YJY', '');
}); _uid = _uid.replace('YJY', '');
url = configuration.methods.wyResume; break;
break; // 汇嘉
// 合诚 case '3':
case '4': $mas.config({
$mas.config({ baseUrl: configuration.baseUrl,
baseUrl: configuration.baseUrl, code: configuration.hjCode
code: configuration.hcCode });
}); url = configuration.methods.hjResume;
url = configuration.methods.hcResume; break;
break; // 物业
default: case '2':
// alert('权限不足,无法查看简历'); $mas.config({
// app.exit(); baseUrl: configuration.baseUrl,
showToast('暂无数据,请联系管理员'); code: configuration.wyCode
// setTimeout(() => { });
// app.exit(); url = configuration.methods.wyResume;
// }, 2000); break;
} // 合诚
}) case '4':
.catch(e => { $mas.config({
console.log('e:', e.toString()); baseUrl: configuration.baseUrl,
if (!configuration.product) { code: configuration.hcCode
_uid = configuration.uid; });
loginuserid = configuration.loginuserid; url = configuration.methods.hcResume;
userid = configuration.userid; break;
token = configuration.token; default:
appKey = configuration.appKey; // alert('权限不足,无法查看简历');
} else { // app.exit();
alert(e); showToast('暂无数据,请联系管理员');
alert('应用启动发生错误,请联系开发人员'); // setTimeout(() => {
} // app.exit();
}); // }, 2000);
}
}).catch(e => {
console.log('e:', e.toString());
if (!configuration.product) {
_uid = configuration.uid;
loginuserid = configuration.loginuserid;
userid = configuration.userid;
token = configuration.token;
appKey = configuration.appKey;
} else {
alert(e);
alert('应用启动发生错误,请联系开发人员');
}
});
} }
function mount() { function mount() {
...@@ -345,19 +343,15 @@ function mount() { ...@@ -345,19 +343,15 @@ function mount() {
customEvt.addEventListener('backbutton', () => { customEvt.addEventListener('backbutton', () => {
app.exit(); app.exit();
}); });
document document.querySelector('.pswp__button--save').addEventListener('touchend', evt => {
.querySelector('.pswp__button--save') evt.stopPropagation();
.addEventListener('touchend', evt => { console.log('保存图片');
evt.stopPropagation(); app.saveToGallery(photoUrl).then(() => {
console.log('保存图片'); showToast('保存成功');
app.saveToGallery(photoUrl) }).catch(() => {
.then(() => { showToast('保存失败');
showToast('保存成功');
})
.catch(() => {
showToast('保存失败');
});
}); });
});
photo.onclick = openPhoto; photo.onclick = openPhoto;
// 关闭弹窗 // 关闭弹窗
...@@ -377,18 +371,16 @@ function mount() { ...@@ -377,18 +371,16 @@ function mount() {
loginuserid, loginuserid,
userid, userid,
appKey appKey
}) }).then(({
.then(({
data data
}) => { }) => {
console.log('获取成功>>', url, data); console.log('获取成功>>', url, data);
render(data); render(data);
return data; return data;
}) }).catch(e => {
.catch(e => {
console.log('获取失败>>', e); console.log('获取失败>>', e);
}); });
// 获取头像 // 获取头像
renderPhoto(); renderPhoto();
/* /*
...@@ -2145,7 +2137,16 @@ function listenerChange(target, clickNode, i) { ...@@ -2145,7 +2137,16 @@ function listenerChange(target, clickNode, i) {
function isImage(ext) { function isImage(ext) {
return [ return [
'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext.toLowerCase()) !== -1; 'png',
'jpg',
'jpeg',
'bmp',
'gif',
'webp',
'psd',
'svg',
'tiff'
].indexOf(ext.toLowerCase()) !== -1;
} }
//渲染附件图标 //渲染附件图标
...@@ -2741,18 +2742,17 @@ function showToast(txt) { ...@@ -2741,18 +2742,17 @@ function showToast(txt) {
function attachAtivated(element) { function attachAtivated(element) {
let els = (typeof element === 'string' && let els = (typeof element === 'string' &&
document.querySelectorAll(element)) || [element]; document.querySelectorAll(element)) || [element];
Array.from(els) Array.from(els).forEach(el => {
.forEach(el => { el.addEventListener('touchstart', function() {
el.addEventListener('touchstart', function() { this.classList.add('activated');
this.classList.add('activated'); });
}); el.addEventListener('touchmove', function() {
el.addEventListener('touchmove', function() { this.classList.remove('activated');
this.classList.remove('activated');
});
el.addEventListener('touchend', function() {
this.classList.remove('activated');
});
}); });
el.addEventListener('touchend', function() {
this.classList.remove('activated');
});
});
} }
function getDateFormat(date) { function getDateFormat(date) {
......
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