This repository has been archived by the owner on Nov 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 增加"个人资料/修改居住地"; 2. 修改"个人资料"页面样式.
- Loading branch information
Showing
6 changed files
with
173 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
import http from "@/api/api.js"; | ||
/** | ||
* 图片懒加载, 支持背景图片 | ||
*/ | ||
|
||
import _ from "lodash"; | ||
import api from "@/api/api.js"; | ||
|
||
/** | ||
* 绑定事件 | ||
* @author jsonleex <[email protected]> | ||
* @param {DOM} el | ||
* @param {String} type | ||
* @param {Function} func | ||
* @param {Boolean} capture | ||
* @param {Object -> DOM} el | ||
* @param {String} type | ||
* @param {Function} func | ||
* @param {Boolean} capture | ||
*/ | ||
function onEvent(el, type, func, capture = false) { | ||
el.addEventListener(type, func, { | ||
capture: capture | ||
}); | ||
} | ||
/** | ||
* 图片懒加载, 支持背景图片 | ||
*/ | ||
|
||
export default Vue => { | ||
// 图片监听列表 | ||
const listenList = new Map(); | ||
|
||
// 图片缓存列表 | ||
const imageCatche = new Map(); | ||
|
||
const wH = window.innerHeight; | ||
const wW = window.innerWidth; | ||
const wH = window.innerHeight; | ||
|
||
/** | ||
* 判断节点是否在视口内 | ||
|
@@ -36,6 +38,9 @@ export default Vue => { | |
const checkInView = el => { | ||
const rect = el.getBoundingClientRect(); | ||
|
||
/** | ||
* 以三分之一屏高为偏移量 | ||
*/ | ||
return ( | ||
rect.top < wH * 1.3 && | ||
rect.bottom > 1.3 && | ||
|
@@ -52,8 +57,8 @@ export default Vue => { | |
/** | ||
* 获取图片真实链接 | ||
*/ | ||
http | ||
.get(`/files/${file}?q=${q}&json=true`, { | ||
api | ||
.get(`/files/${file}?q=${q}&json=1`, { | ||
// 验证 status ; 屏蔽 404 抛错 | ||
vaildateStatus: s => s === 200 || s === 201 || s === 204 || s === 400 | ||
}) | ||
|
@@ -116,6 +121,9 @@ export default Vue => { | |
updated: addListener | ||
}); | ||
|
||
/** | ||
* 绑定滚动监听, 兼容 ios 和 pc | ||
*/ | ||
[ | ||
"scroll", | ||
"wheel", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.