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