Commit 1ec488b3e5e99c44ef4480c1306a567dafb6ff21

Authored by zhiyangdu
1 parent ef652cc8

商品详情页图片懒加载

src/pages/goodDetails/goodDetails.vue
... ... @@ -35,7 +35,7 @@
35 35 }"
36 36 >
37 37 </swiper> -->
38   - <img v-if="goodsInfo && goodsInfo.simg" class="goods-img" :src="goodsInfo.simg" alt=""/>
  38 + <img v-if="goodsInfo && goodsInfo.simg" class="goods-img" v-lazy="goodsInfo.simg" alt=""/>
39 39 <!-- 内容 -->
40 40 <div class="main-box">
41 41 <!-- 标题 -->
... ... @@ -217,7 +217,7 @@ export default {
217 217 }
218 218 }
219 219 },
220   - watch: {
  220 + watch: {
221 221 // 设置页面标题
222 222 title (newVal) {
223 223 if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
... ... @@ -250,18 +250,18 @@ export default {
250 250 }
251 251 }
252 252 },
253   - // 跳转到确认订单详情
  253 + // 跳转到确认订单详情
254 254 jumpToConfirmOrderPage (item) {
255 255 // 判断APP内
256   - if (this.isCNLive.value){
  256 + if (this.isCNLive.value) {
257 257 // (判断app内是否有该方法)type=2为积分加现金模式
258 258 if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jumpToConfirmOrderPage) {
259 259 // 跳转到原生的任务列表
260   - window.webkit.messageHandlers.jumpToConfirmOrderPage.postMessage({ body: { pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type:4} })
  260 + window.webkit.messageHandlers.jumpToConfirmOrderPage.postMessage({ body: { pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type: 4 } })
261 261 } else if (window.obj && window.obj.jumpToConfirmOrderPage) {
262 262 // 跳转到原生的任务列表
263   - window.obj.jumpToConfirmOrderPage(JSON.stringify({ pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type:4 }));
264   - }
  263 + window.obj.jumpToConfirmOrderPage(JSON.stringify({ pointsOrderId: item.id, goodSid: item.goodsid, num: this.stepperValue, type: 4 }));
  264 + }
265 265 }
266 266 },
267 267 // 跳转网家家购买音频协议
... ... @@ -353,65 +353,65 @@ export default {
353 353 }
354 354 },
355 355 // 版本判断
356   - versionJudgment(){
  356 + versionJudgment () {
357 357 if (this.isCNLive.value) {
358   - let options;
359   - if (this.isAndroid.value) {
360   - if (this.ver != "") {
361   - var ver = this.ver ? this.ver.replace(/\.*/g, "") : "";
362   - }
363   - var isVer = 1732;
364   - if (ver > isVer) {
365   - // 调用底部商品数量层
366   - this.opintsPopup();
367   - }else{
368   - // 提示用积分兑换兑换
369   - options = {
370   - message: "当前版本过旧,请升级最新版本",
371   - messageAlign: "center",
372   - confirmButtonText: "去更新",
373   - confirmButtonCallback:this.appUpdate,
374   - showCancelButton: true,
375   - cancelButtonText: "取消"
376   - };
377   - }
378   - } else if (this.isiPhone.value) {
379   - if (this.version != "") {
380   - var version = this.version ? this.version.replace(/\.*/g, "") : "";
381   - }
382   - if (this.mode == "prod") {
383   - var isVer = 189;
384   - } else {
385   - var isVer = 189;
386   - }
387   - if (version > isVer) {
388   - // 调用底部商品数量层
389   - this.opintsPopup();
390   - }else{
391   - // 提示用积分兑换兑换
392   - options = {
393   - message: "当前版本过旧,请升级最新版本",
394   - messageAlign: "center",
395   - confirmButtonText: "去更新",
396   - confirmButtonCallback:this.appUpdate,
397   - showCancelButton: true,
398   - cancelButtonText: "取消"
399   - };
400   - }
  358 + let options;
  359 + if (this.isAndroid.value) {
  360 + if (this.ver != "") {
  361 + var ver = this.ver ? this.ver.replace(/\.*/g, "") : "";
  362 + }
  363 + var isVer = 1732;
  364 + if (ver > isVer) {
  365 + // 调用底部商品数量层
  366 + this.opintsPopup();
  367 + } else {
  368 + // 提示用积分兑换兑换
  369 + options = {
  370 + message: "当前版本过旧,请升级最新版本",
  371 + messageAlign: "center",
  372 + confirmButtonText: "去更新",
  373 + confirmButtonCallback: this.appUpdate,
  374 + showCancelButton: true,
  375 + cancelButtonText: "取消"
  376 + };
  377 + }
  378 + } else if (this.isiPhone.value) {
  379 + if (this.version != "") {
  380 + var version = this.version ? this.version.replace(/\.*/g, "") : "";
  381 + }
  382 + if (this.mode == "prod") {
  383 + var isVer = 189;
  384 + } else {
  385 + var isVer = 189;
  386 + }
  387 + if (version > isVer) {
  388 + // 调用底部商品数量层
  389 + this.opintsPopup();
  390 + } else {
  391 + // 提示用积分兑换兑换
  392 + options = {
  393 + message: "当前版本过旧,请升级最新版本",
  394 + messageAlign: "center",
  395 + confirmButtonText: "去更新",
  396 + confirmButtonCallback: this.appUpdate,
  397 + showCancelButton: true,
  398 + cancelButtonText: "取消"
  399 + };
401 400 }
402   - // 调用showModal层参数
403   - this.$set(this.$parent, "showOptions", options);
404   - // 显示通用浮层
405   - this.$parent.$refs.showModal.showLayer();
406 401 }
  402 + // 调用showModal层参数
  403 + this.$set(this.$parent, "showOptions", options);
  404 + // 显示通用浮层
  405 + this.$parent.$refs.showModal.showLayer();
  406 + }
407 407 },
408 408 // App升级跳转
409   - appUpdate(){
410   - if(this.isiPhone.value){
411   - window.location.href ="http://itunes.apple.com/cn/app/id1337575478?mt=8"
412   - }else if(this.isAndroid.value){
413   - window.location.href ="http://wjj.ys1.cnliveimg.com/download/ac/1723/strike-1.7.3.3-release.apk"
414   - }
  409 + appUpdate () {
  410 + if (this.isiPhone.value) {
  411 + window.location.href = "http://itunes.apple.com/cn/app/id1337575478?mt=8"
  412 + } else if (this.isAndroid.value) {
  413 + window.location.href = "http://wjj.ys1.cnliveimg.com/download/ac/1723/strike-1.7.3.3-release.apk"
  414 + }
415 415 },
416 416 // 兑换
417 417 exchange () {
... ... @@ -419,26 +419,26 @@ export default {
419 419 // 校验登录
420 420 if (this.$parent.checkLogin()) {
421 421 // 实物商品不提示用积分
422   - if (this.goodsInfo.shop_type == 1) {
423   - // 判断安卓版本1.7.3.3展示ios1.9.0显示实物弹出底部数量填写
424   - this.versionJudgment()
425   - // 弹出填写地址
426   - // this.addAddressCallback()
427   - }else{
428   - // 虚拟商品提示用积分兑换
429   - let options = {
430   - title: "",
431   - message: "确定使用" + this.goodsInfo.num + "积分兑换?",
432   - confirmButtonText: "确定",
433   - confirmButtonCallback: this.addIntegralOrderconfirm,
434   - showCancelButton: true,
435   - cancelButtonText: "取消"
436   - };
437   - // 调用showModal层参数
438   - this.$set(this.$parent, "showOptions", options);
439   - // 显示通用浮层
440   - this.$parent.$refs.showModal.showLayer();
441   - }
  422 + if (this.goodsInfo.shop_type == 1) {
  423 + // 判断安卓版本1.7.3.3展示ios1.9.0显示实物弹出底部数量填写
  424 + this.versionJudgment()
  425 + // 弹出填写地址
  426 + // this.addAddressCallback()
  427 + } else {
  428 + // 虚拟商品提示用积分兑换
  429 + let options = {
  430 + title: "",
  431 + message: "确定使用" + this.goodsInfo.num + "积分兑换?",
  432 + confirmButtonText: "确定",
  433 + confirmButtonCallback: this.addIntegralOrderconfirm,
  434 + showCancelButton: true,
  435 + cancelButtonText: "取消"
  436 + };
  437 + // 调用showModal层参数
  438 + this.$set(this.$parent, "showOptions", options);
  439 + // 显示通用浮层
  440 + this.$parent.$refs.showModal.showLayer();
  441 + }
442 442 }
443 443 } else {
444 444 this.$parent.callApp();
... ... @@ -446,11 +446,11 @@ export default {
446 446 },
447 447 // 确定兑换回调
448 448 addIntegralOrderconfirm () {
449   - // isExchange为false才可兑换防止连续点击
450   - if (!this.isExchange) {
451   - // 兑换
452   - this.addIntegralOrder();
453   - }
  449 + // isExchange为false才可兑换防止连续点击
  450 + if (!this.isExchange) {
  451 + // 兑换
  452 + this.addIntegralOrder();
  453 + }
454 454 },
455 455 /**
456 456 * 分享
... ... @@ -620,11 +620,11 @@ export default {
620 620 }
621 621 },
622 622 // 判断值是否大于库存
623   - onChange(value) {
624   - if(this.goodsInfo.stock > -1 && value > this.goodsInfo.stock){
625   - Toast("数量超出范围~")
626   - }
627   -
  623 + onChange (value) {
  624 + if (this.goodsInfo.stock > -1 && value > this.goodsInfo.stock) {
  625 + Toast("数量超出范围~")
  626 + }
  627 +
628 628 },
629 629 },
630 630 //请求数据
... ...
src/pages/healthGoodDetails/healthGoodDetails.vue
... ... @@ -35,7 +35,7 @@
35 35 }"
36 36 >
37 37 </swiper> -->
38   - <img v-if="goodsInfo && goodsInfo.simg" class="goods-img" :src="goodsInfo.simg" alt=""/>
  38 + <img v-if="goodsInfo && goodsInfo.simg" class="goods-img" v-lazy="goodsInfo.simg" alt=""/>
39 39 <!-- 内容 -->
40 40 <div class="main-box">
41 41 <!-- 标题 -->
... ... @@ -303,7 +303,7 @@ export default {
303 303 // 提示用健康值兑换兑换
304 304 let options = {
305 305 title: "",
306   - message: "兑换将会消耗" + this.goodsInfo.num + "健康值" + '<br/>' +"确定兑换吗?",
  306 + message: "兑换将会消耗" + this.goodsInfo.num + "健康值" + '<br/>' + "确定兑换吗?",
307 307 confirmButtonText: "确定",
308 308 confirmButtonCallback: this.addLuckHealthOrderconfirm,
309 309 showCancelButton: true,
... ... @@ -417,7 +417,7 @@ export default {
417 417 addAddressCallback () {
418 418 this.pointsToast_control = true;
419 419 // 礼品兑换弹框派发
420   - this.$refs.itemsInfo.getItemInfo(this.goodsInfo,this.$route.query.id)
  420 + this.$refs.itemsInfo.getItemInfo(this.goodsInfo, this.$route.query.id)
421 421 },
422 422 /**
423 423 * 跳转赚取健康值页面
... ...