|
|
@@ -11,8 +11,8 @@ import './main.css'
|
|
|
import './swiper.css'
|
|
|
|
|
|
|
|
|
-import Vconsole from 'vconsole';
|
|
|
-new Vconsole();
|
|
|
+// import Vconsole from 'vconsole';
|
|
|
+// new Vconsole();
|
|
|
|
|
|
|
|
|
// 初始化vue-amap
|
|
|
@@ -136,30 +136,44 @@ Vue.prototype.$http = {
|
|
|
|
|
|
|
|
|
|
|
|
-Vue.prototype.preview = function (index, list) {
|
|
|
+Vue.prototype.preview = function(index, list) {
|
|
|
var imgList = []
|
|
|
|
|
|
var sequence = Promise.resolve();
|
|
|
|
|
|
- list.forEach(function (item) {
|
|
|
- sequence = sequence.then(function () {
|
|
|
- return getImg(item.img, window.innerWidth - 30, window.innerHeight - 30);
|
|
|
- }).then(function (data) {
|
|
|
- var jsonp = {
|
|
|
- img: item.img,
|
|
|
- width: data.width,
|
|
|
- height: data.height,
|
|
|
- };
|
|
|
- if (item.title) {
|
|
|
- jsonp.title = item.title
|
|
|
-
|
|
|
- if (item.money) {
|
|
|
- jsonp.money = item.money
|
|
|
+ list.forEach(function(item) {
|
|
|
+ if (item.img) {
|
|
|
+ sequence = sequence.then(function() {
|
|
|
+ return getImg(item.img, window.innerWidth - 30, window.innerHeight - 30);
|
|
|
+ }).then(function(data) {
|
|
|
+ var jsonp = {
|
|
|
+ img: item.img,
|
|
|
+ width: data.width,
|
|
|
+ height: data.height,
|
|
|
+ };
|
|
|
+ if (item.title) {
|
|
|
+ jsonp.title = item.title
|
|
|
+
|
|
|
+ if (item.money) {
|
|
|
+ jsonp.money = item.money
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- imgList.push(jsonp);
|
|
|
- return Promise.resolve();
|
|
|
- });
|
|
|
+ imgList.push(jsonp);
|
|
|
+ return Promise.resolve();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ sequence = sequence.then(function() {
|
|
|
+ return getImg(item, window.innerWidth - 30, window.innerHeight - 30);
|
|
|
+ }).then(function(data) {
|
|
|
+ var jsonp = {
|
|
|
+ img: item,
|
|
|
+ width: data.width,
|
|
|
+ height: data.height,
|
|
|
+ };
|
|
|
+ imgList.push(jsonp);
|
|
|
+ return Promise.resolve();
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
sequence.then(() => {
|
|
|
this.$preview({ nowIndex: index, List: imgList })
|