更改首页

This commit is contained in:
952108534@qq.com 2022-01-12 17:41:58 +08:00
parent 8c352508cd
commit 99157a3946
3 changed files with 123 additions and 42 deletions

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "smart-admin",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

View File

@ -203,16 +203,34 @@ export const userque = (stype) => {
//标品全部信息
export const biaomessage = (stype,name) => {
console.log(stype);
if(stype.length>1){
console.log("========");
let list={};
stype.map(item=>{
console.log(item);
list=item
})
var str = "?";
for(var key in list){
str = str + key + "=" + list[key] + "&";
}
stype = str.substr(0,str.length-1);
var data = {
petType:stype,
page:1,
row:10
}
return fetch('product/query?petType='+stype, data, 'POST' )
return fetch('product/query'+stype, data, 'POST' )
}else{
console.log('-==');
return fetch('product/query?petType='+stype,data, 'POST' )
}
}
export const searchchanpin = (stype) => {
console.log(stype);
let list={};
stype.map(item=>{
console.log(item);

View File

@ -48,7 +48,7 @@
<div class="pageFullScreen" id="xxxFullScreen" v-show="catproduct">
<!-- 内容 -->
<div class="swiper-container rc-full-width rc-padding-y--md" id="swiper1">
<h2 class="rc-beta rc-text--center">明星猫粮</h2>
<h2 class="rc-beta rc-text--center">{{usertitle}}</h2>
<!-- 轮播图 -->
<swiper :options="swiperOption">
<swiper-slide class="swiper-slide" v-for="(item, key) in catlistvideo" :key="key" >
@ -96,7 +96,7 @@
<div class="online bold"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md">
<h2 class="rc-beta rc-text--center">全价猫湿粮</h2>
<van-tabs @change='userclick' class="van-tabs">
<van-tabs @change='catclick' class="van-tabs">
<van-tab v-for="(item,index) in discoun" :key="index" :title="item.title">
<div class="rc-contair">
<ul class="ts-product-list rc-margin-bottom--lg">
@ -185,7 +185,7 @@
<div class="online bold"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md">
<h2 class="rc-beta rc-text--center">全价猫干粮</h2>
<van-tabs @change='userclick' class="van-tabs">
<van-tabs @change='catclick' class="van-tabs">
<van-tab v-for="(item,index) in discoun" :key="index" :title="item.title">
<div class="rc-contair">
<ul class="ts-product-list rc-margin-bottom--lg">
@ -623,6 +623,7 @@
</div>
</template>
<script>
let vm=null;
import $ from 'jquery'
import Myheader from "~/components/header.vue";
import Myfooter from "~/components/rc-footer.vue";
@ -637,6 +638,8 @@
meta: {title: '首页'},
data(){
return{
useraindex:0,
usertitle:'明星猫粮',
processinformation:[],
catshi:[],
userstype:'',
@ -659,6 +662,7 @@
},
],
anchor:'',
dogshi:[],
catlist:[],
chufanlist:[],
@ -754,35 +758,46 @@ activeInde3:0,
discountlist: [
{
title: "明星猫粮",
catimage: require("../assets/star-cat.png"),
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
catimage: require("../assets/cat.png"),
price:'¥2'
},
{
title: "猫湿粮",
catimage: require("../assets/two.png"),
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
price:'¥12',
catimage: require("../assets/four.png"),
},
{
title: "猫干粮",
catimage: require("../assets/cat.png"),
},
{
title: "明星犬粮",
catimage: require("../assets/six.png"),
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
price:'¥102',
catimage: require("../assets/one.png"),
},
{
title: "犬湿粮",
catimage: require("../assets/three.png"),
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
price:'¥112',
catimage: require("../assets/two.png"),
},
{
title: "犬干粮",
catimage: require("../assets/one.png"),
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
price:'¥112',
catimage: require("../assets/three.png"),
},
{
title: "处方用粮",
catimage: require("../assets/four.png"),
}
detail:'为10月龄及以上英国短毛猫成猫量身打造的精准营养',
price:'¥112',
catimage: require("../assets/six.png"),
},
],
discounchufang: [
@ -929,6 +944,14 @@ activeInde3:0,
prevEl: '.swiper-button-prev'
},
on: {
slideChange(Swiper) {
console.log('onSlideChangeEnd',this);
// vm.ifadroind('','',this.realIndex);
vm.useraindex=this.realIndex;
},
tap() {
console.log('onTap', this);
}
// slideChange() {
// console.log('onSlideChangeEnd', this);
// },
@ -944,6 +967,9 @@ activeInde3:0,
Myfooter,
tabs,
unlogin,
},
created(){
vm=this;
},
mounted(){
this.usermessage= JSON.parse(localStorage.getItem("userInfo"));
@ -963,6 +989,50 @@ activeInde3:0,
window.removeEventListener('scroll', this.scrollToTop);
},
methods:{
ifadroind(item,index,order){
console.log(item,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";
this.activeIndex=index;
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
console.log("当前是电脑打开")
this.usertitle=item.title
this.catlistvideo[order]=item;
this.catproduct=true;
console.log(this.catproduct);
}else{
this.catfood=true;
this.catproduct=false;
let userindex=index
console.log(item,index);
let mingxin=document.querySelector('.pageFullScreen');
console.log(mingxin.offsetTop);
if(item.title=='明星猫粮'){
mingxin.scrollIntoView(true);
}else{
let catshiid=document.querySelectorAll('.selectionswitch');
catshiid[userindex-1].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={
@ -1159,20 +1229,7 @@ activeInde3:0,
},
selectGoods(item,index){
let jump = document.querySelectorAll('.selectionswitch')
let total = jump[index].offsetTop
$('html body').animate({scrollTop: total}, 500);
this.activeIndex=index;
this.catfood=true;
this.catproduct=false;
if(item.title=="猫湿粮"){
this.catproduct=false;
this.catfood=true;
}else if(item.title=="明星猫粮"){
this.catproduct=true;
this.catfood=false;
}
this.ifadroind(item,index,this.useraindex)
},
selectGo(item,index){