Commit 61a0da9d by 钟乾明

u: 辅助log

parent aafaec45
Showing with 33 additions and 33 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,13 +56,11 @@ const tipsModal = document.querySelector('.tips__modal');
const tipsmMdalClose = document.querySelector('.tips__close');
app.ready(() => {
initUser()
.then(() => {
console.log('111>>');
initUser().then(() => {
console.log('initUser then>>');
$mas.token = token;
mount();
})
.catch((e) => {
}).catch((e) => {
if (!configuration.product) {
_uid = configuration.uid;
......@@ -87,6 +84,8 @@ app.ready(() => {
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,8 +200,10 @@ async function initUser() {
// 判断是否来自人员详情。
// 如果是从人员详情过来的,需要对employeenumber、uid做强校验。
// 如果不是从人员详情过来的,employeenumber、uid从当前人员的获取。
return Promise.all([app.getUser(), getUserInfoByOid(openId)])
.then(([user, viewee]) => {
return Promise.all([
app.getUser(),
getUserInfoByOid(openId)
]).then(([user, viewee]) => {
if (user.orgType) {
user.extra = {
orgType: user.orgType
......@@ -212,9 +211,9 @@ async function initUser() {
}
// user 查看者
// viewee 被查看者
console.log('user:', user);
console.log('viewee:', 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}` });
......@@ -304,8 +303,7 @@ async function initUser() {
// app.exit();
// }, 2000);
}
})
.catch(e => {
}).catch(e => {
console.log('e:', e.toString());
if (!configuration.product) {
_uid = configuration.uid;
......@@ -345,16 +343,12 @@ function mount() {
customEvt.addEventListener('backbutton', () => {
app.exit();
});
document
.querySelector('.pswp__button--save')
.addEventListener('touchend', evt => {
document.querySelector('.pswp__button--save').addEventListener('touchend', evt => {
evt.stopPropagation();
console.log('保存图片');
app.saveToGallery(photoUrl)
.then(() => {
app.saveToGallery(photoUrl).then(() => {
showToast('保存成功');
})
.catch(() => {
}).catch(() => {
showToast('保存失败');
});
});
......@@ -377,15 +371,13 @@ function mount() {
loginuserid,
userid,
appKey
})
.then(({
}).then(({
data
}) => {
console.log('获取成功>>', url, data);
render(data);
return data;
})
.catch(e => {
}).catch(e => {
console.log('获取失败>>', e);
});
......@@ -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,8 +2742,7 @@ function showToast(txt) {
function attachAtivated(element) {
let els = (typeof element === 'string' &&
document.querySelectorAll(element)) || [element];
Array.from(els)
.forEach(el => {
Array.from(els).forEach(el => {
el.addEventListener('touchstart', function() {
this.classList.add('activated');
});
......
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