From 5c5b50b7eadd93548218e3b6f9d15d9b893b042c Mon Sep 17 00:00:00 2001 From: Leung Date: Sun, 16 Jan 2022 20:42:14 +0800 Subject: [PATCH] Index error fixed, van-swiper unified --- rc-busness/assets/css/global.less | 5 - rc-busness/assets/css/index.less | 2 - rc-busness/pages/index.vue | 489 +++++++++++++++--------------- 3 files changed, 239 insertions(+), 257 deletions(-) diff --git a/rc-busness/assets/css/global.less b/rc-busness/assets/css/global.less index 08663b1b..4b86db4f 100644 --- a/rc-busness/assets/css/global.less +++ b/rc-busness/assets/css/global.less @@ -285,11 +285,6 @@ img, picture { .rc-top{ margin-top: 90px; } - .rc-list__header { - background: none; - padding: .5rem 0; - border-bottom: none; - } .ts-right-arr { border-bottom:1px solid #E1001A; padding-bottom:2px; diff --git a/rc-busness/assets/css/index.less b/rc-busness/assets/css/index.less index 89728579..c6d0c550 100644 --- a/rc-busness/assets/css/index.less +++ b/rc-busness/assets/css/index.less @@ -316,8 +316,6 @@ object-fit: cover; color: #fff; height: 100%; width: 100%; - font-size: 1.25rem; - line-height: 9.375rem; text-align: center; diff --git a/rc-busness/pages/index.vue b/rc-busness/pages/index.vue index d9273711..c1c454d5 100644 --- a/rc-busness/pages/index.vue +++ b/rc-busness/pages/index.vue @@ -42,41 +42,40 @@

{{usertitle}}

- - -
-
- -
- -
+ + +
+
+ +
+ +
{{item.title}}

{{item.detail}}

{{item.price}} 立即购买 -
-
-
-
-
- -
- - - {{item.title}} -

{{item.detail}}

- {{item.price}} -
-
- 立即购买 -
-
- - - +
+
+
+
+
+ +
+ + + {{item.title}} +

{{item.detail}}

+ {{item.price}} +
+
+ 立即购买 +
+
+ +
@@ -707,11 +706,10 @@ import { userquery,postCourseId,biaomessage,userque,searchchanpin } from "../ajax/getData"; const settings = require("@/config"); export default { - middleware: 'metaTitle', - // middleware: 'metaTitle', - meta: {title: '首页'}, - data(){ - return{ + middleware: 'metaTitle', + meta: {title: '首页'}, + data(){ + return{ useraindex:0, usertitle:'明星猫粮', dogtitle:'明星狗粮', @@ -882,7 +880,7 @@ }, ], - discounchufang: [ + discounchufang: [ { title: "消化道", catimage: require("../assets/cat.png"), @@ -1074,19 +1072,19 @@ } }, } - }, - components:{ - Myheader, - Myfooter, - unlogin, - // userswiper - }, - created(){ + }, + components:{ + Myheader, + Myfooter, + unlogin, + // userswiper + }, + created(){ vm=this; - - }, - watch:{ -}, + }, + watch:{ + + }, mounted(){ const that = this this.ifAdoid(); @@ -1102,176 +1100,175 @@ destroyed () { window.removeEventListener('scroll', this.scrollToTop); }, - methods:{ - ifAdoid(item,index){ - //console.log(index); - this.userindex=index; - var sUserAgent = navigator.userAgent.toLowerCase(); - var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; - var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; - var bIsMidp = sUserAgent.match(/midp/i) == "midp"; - var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; - var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; - var bIsAndroid = sUserAgent.match(/android/i) == "android"; - var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; - var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; - - if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { - //console.log("当前是电脑打开") - this.stypechange=false; - //console.log(this.usertitle) + methods:{ + ifAdoid(item,index){ + //console.log(index); + this.userindex=index; + var sUserAgent = navigator.userAgent.toLowerCase(); + var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; + var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; + var bIsMidp = sUserAgent.match(/midp/i) == "midp"; + var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; + var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; + var bIsAndroid = sUserAgent.match(/android/i) == "android"; + var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; + var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; + if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { + console.log("当前是电脑打开") + this.stypechange=false; + //console.log(this.usertitle) - this.catproduct=true; - this.onemao=false; - this.twomao=false; - this.threemao=false; - this.fourmao=false; - this.fivemao=false; - this.sixmao=false; - this.dogshow=false - this.showingBanners=this.banners.pc; - } - else - { - //console.log("当前是手机打开") - this.showingBanners=this.banners.mobile; - this.stypechange=true; - this.onemao=true; - this.twomao=true; - this.threemao=true; - this.fourmao=true; - this.fivemao=true; - this.dogshow=true; - this.catproduct=true - this.sixmao=true; - - } - }, - - ifadroind(item,index,order){ - //console.log(item,index,order); - - - var sUserAgent = navigator.userAgent.toLowerCase(); - var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; - var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; - var bIsMidp = sUserAgent.match(/midp/i) == "midp"; - var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; - var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; - var bIsAndroid = sUserAgent.match(/android/i) == "android"; - var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; - var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; - - if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { - //console.log("当前是电脑打开啊啊啊") - if(item.title=='明星猫粮'){ - this.catproduct=true; - this.twomao=false; - this.threemao=false; - this.fourmao=false; - this.fivemao=false; - this.dogshow=false; - this.sixmao=false; - - this.onemao=false; - - } - if(item.title=='猫湿粮'){ - this.onemao=true; - this.dogshow=false; - //console.log(this.onemao); - this.twomao=false; - this.threemao=false; - this.fourmao=false; - this.fivemao=false; - this.catproduct=false; - - - - }if(item.title=='猫干粮'){ - this.onemao=false; - this.twomao=true; - this.dogshow=false; - this.threemao=false; - this.fourmao=false; - this.chufang=false; - this.catproduct=false; - } - - if(item.title=='犬干粮'){ - this.onemao=false; - this.twomao=false; - this.threemao=false; - this.fourmao=true; - this.chufang=false; - this.dogshow=false; - this.catproduct=false; - } - - if(item.title=='犬湿粮'){ - this.onemao=false; - this.twomao=false; - this.threemao=true; - this.fourmao=false; - this.chufang=false; - this.catproduct=false; - this.dogshow=false; - } - if(item.title=='处方用粮'){ - this.onemao=false; - this.twomao=false; - this.threemao=false; - this.fourmao=false; - this.fivemao=true; - this.dogshow=false; - this.catproduct=false; - } - if(item.title=='明星狗粮'){ - this.onemao=false; - this.twomao=false; - this.threemao=false; - this.fourmao=false; - this.fivemao=false; - this.dogshow=true; - this.catproduct=false; - } - // this.usertitle=item.title - // this.catlistvideo[order]=item; - // this.catproduct=true; - - }else{ - this.catfood=true; - // this.catproduct=false; - let userindex=index - //console.log(item,index); - let mingxin=document.querySelector('.pageFullScreen'); - let dogtop=document.querySelector('.oc-top'); - //console.log(dogtop); - //console.log(mingxin.offsetTop); - if(item.title=='犬湿粮'||item.title=='犬干粮'||item.title=='处方用粮'){ - userindex=userindex-2 - }else{ - userindex=userindex-1 + this.catproduct=true; + this.onemao=false; + this.twomao=false; + this.threemao=false; + this.fourmao=false; + this.fivemao=false; + this.sixmao=false; + this.dogshow=false + this.showingBanners=this.banners.pc; } - if(item.title=='明星猫粮'){ - mingxin.scrollIntoView(true); - }else{ - let catshiid=document.querySelectorAll('.selectionswitch'); - catshiid[userindex].scrollIntoView(true); - } - if(item.title=='明星狗粮') - dogtop.scrollIntoView(true); - // if(item.title=="猫湿粮"){ - // this.catproduct=false; - // this.catfood=true; - // }else if(item.title=="明星猫粮"){ - // this.catproduct=true; - // this.catfood=false; + else + { + console.log("当前是手机打开") + this.showingBanners=this.banners.mobile; + this.stypechange=true; + this.onemao=true; + this.twomao=true; + this.threemao=true; + this.fourmao=true; + this.fivemao=true; + this.dogshow=true; + this.catproduct=true + this.sixmao=true; - // } - //console.log("当前是手机打开") - } - }, + } + }, + + ifadroind(item,index,order){ + //console.log(item,index,order); + + + var sUserAgent = navigator.userAgent.toLowerCase(); + var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; + var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; + var bIsMidp = sUserAgent.match(/midp/i) == "midp"; + var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; + var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; + var bIsAndroid = sUserAgent.match(/android/i) == "android"; + var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; + var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; + + if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { + //console.log("当前是电脑打开啊啊啊") + if(item.title=='明星猫粮'){ + this.catproduct=true; + this.twomao=false; + this.threemao=false; + this.fourmao=false; + this.fivemao=false; + this.dogshow=false; + this.sixmao=false; + + this.onemao=false; + + } + if(item.title=='猫湿粮'){ + this.onemao=true; + this.dogshow=false; + //console.log(this.onemao); + this.twomao=false; + this.threemao=false; + this.fourmao=false; + this.fivemao=false; + this.catproduct=false; + + + + }if(item.title=='猫干粮'){ + this.onemao=false; + this.twomao=true; + this.dogshow=false; + this.threemao=false; + this.fourmao=false; + this.chufang=false; + this.catproduct=false; + } + + if(item.title=='犬干粮'){ + this.onemao=false; + this.twomao=false; + this.threemao=false; + this.fourmao=true; + this.chufang=false; + this.dogshow=false; + this.catproduct=false; + } + + if(item.title=='犬湿粮'){ + this.onemao=false; + this.twomao=false; + this.threemao=true; + this.fourmao=false; + this.chufang=false; + this.catproduct=false; + this.dogshow=false; + } + if(item.title=='处方用粮'){ + this.onemao=false; + this.twomao=false; + this.threemao=false; + this.fourmao=false; + this.fivemao=true; + this.dogshow=false; + this.catproduct=false; + } + if(item.title=='明星狗粮'){ + this.onemao=false; + this.twomao=false; + this.threemao=false; + this.fourmao=false; + this.fivemao=false; + this.dogshow=true; + this.catproduct=false; + } + // this.usertitle=item.title + // this.catlistvideo[order]=item; + // this.catproduct=true; + + }else{ + this.catfood=true; + // this.catproduct=false; + let userindex=index + //console.log(item,index); + let mingxin=document.querySelector('.pageFullScreen'); + let dogtop=document.querySelector('.oc-top'); + //console.log(dogtop); + //console.log(mingxin.offsetTop); + if(item.title=='犬湿粮'||item.title=='犬干粮'||item.title=='处方用粮'){ + userindex=userindex-2 + }else{ + userindex=userindex-1 + } + if(item.title=='明星猫粮'){ + mingxin.scrollIntoView(true); + }else{ + let catshiid=document.querySelectorAll('.selectionswitch'); + catshiid[userindex].scrollIntoView(true); + } + if(item.title=='明星狗粮') + dogtop.scrollIntoView(true); + // if(item.title=="猫湿粮"){ + // this.catproduct=false; + // this.catfood=true; + // }else if(item.title=="明星猫粮"){ + // this.catproduct=true; + // this.catfood=false; + + // } + //console.log("当前是手机打开") + } + }, userdog(item,index){ this.userstype=1; let petType={ @@ -1328,10 +1325,6 @@ this.gotop = false; this.searchBar=true } - } - - - }, toTop() { let top = document.documentElement.scrollTop || document.body.scrollTop; @@ -1445,35 +1438,33 @@ - lianxi(item,index){ - if(item.title=='在线客服'){ - var option = { - customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} - } - dis_livchat(option); - } - if(item.title=='购物车'){ - this.$router.push({ - path: "/myorder/userrecord", - - }); - } - if(item.title=='营养专家'){ - var option = { - customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} - } - dis_livchat(option); - } + lianxi(item,index){ + if(item.title=='在线客服'){ + var option = { + customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} + } + dis_livchat(option); + } + if(item.title=='购物车'){ + this.$router.push({ + path: "/myorder/userrecord", + }); + } + if(item.title=='营养专家'){ + var option = { + customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} + } + dis_livchat(option); + } - }, - userbuy(item){ - let user= localStorage.getItem("userInfo"); - this.courseId(item) - this.$router.push({ - path: "/myorder/userrecord", - - }); - }, + }, + userbuy(item){ + let user= localStorage.getItem("userInfo"); + this.courseId(item) + this.$router.push({ + path: "/myorder/userrecord", + }); + }, selectGoods(item,index){ //console.log(item,index); @@ -1498,9 +1489,7 @@ selectGoo(item,index){ this.activeInde3=index; } - }, - - + } }