Index content / bug completed, method of login checking in store/index.js added

This commit is contained in:
Vion
2022-01-22 13:29:19 +08:00
parent 60c6a6b8b4
commit debf618d7e
9 changed files with 307 additions and 275 deletions

View File

@@ -6,7 +6,7 @@
<div class="ts-banner-swiper-container">
<swiper :options="headerSwiperOption">
<swiper-slide>
<a href="#" target="_blank">
<a href="/" target="_blank">
<picture>
<source media="(max-width: 768px)" srcset="/images/banner/one.jpg">
<source media="(min-width: 769px)" srcset="/images/banner/pc-banner1.png">
@@ -16,7 +16,7 @@
</swiper-slide>
<swiper-slide>
<a href="#" target="_blank">
<a href="/" target="_blank">
<picture>
<source media="(max-width: 768px)" srcset="/images/banner/two.jpg">
<source media="(min-width: 769px)" srcset="/images/banner/pc-banner2.png">
@@ -26,7 +26,7 @@
</swiper-slide>
<swiper-slide>
<a href="#" target="_blank">
<a href="/" target="_blank">
<picture>
<source media="(max-width: 768px)" srcset="/images/banner/three.jpg">
<source media="(min-width: 769px)" srcset="/images/banner/pc-banner3.png">
@@ -36,7 +36,7 @@
</swiper-slide>
<swiper-slide>
<a href="#" target="_blank">
<a href="/" target="_blank">
<picture>
<source media="(max-width: 768px)" srcset="/images/banner/four.jpg">
<source media="(min-width: 769px)" srcset="/images/banner/pc-banner4.png">
@@ -952,7 +952,12 @@
catimage: "/images/cat/one.jpg",
productimage: "/images/cat/star-1.png",
detail:'为10柔软细腻慕斯 适合离乳期幼猫舔食',
price:77',
price:372',
productList:[
{
productCode : "80240008F24"
}
]
},
{
title: "幼猫成长专属",
@@ -960,7 +965,12 @@
catimage: "/images/cat/two.jpg",
productimage: "/images/cat/star-2.png",
detail:'支持幼猫自身保护力 为快速生长提供足够能量',
price:147',
price:33',
productList:[
{
productCode : "20030040"
}
]
},
{
title: "室内成猫专属",
@@ -968,7 +978,12 @@
catimage: "/images/cat/three.jpg",
productimage: "/images/cat/star-3.png",
detail:'高易消化蛋白 减少粪便量和异味',
price:'¥140',
price:'¥157',
productList:[
{
productCode : "21100200"
}
]
},
{
title: "英短成猫专属",
@@ -976,7 +991,12 @@
catimage: "/images/cat/four.jpg",
productimage: "/images/cat/star-4.png",
detail:'增强肌肉质量 支持骨骼与关节健康',
price:183',
price:402',
productList:[
{
productCode : "23040450"
}
]
},
],
@@ -988,85 +1008,62 @@
catimage: "/images/dog/one.jpg",
productimage: "/images/dog/star-1.png",
detail:'柔软细腻慕斯 适合离乳期幼犬舔食',
price:77',
price:359',
productList:[
{
productCode : "81220020F12"
}
]
},
{
title: "贵宾成犬专属",
video:"/images/dog/two.mp4",
catimage: "/images/dog/two.jpg",
productimage: "/images/cat/star-2.png",
productimage: "/images/dog/star-2.png",
detail:'护肤靓毛 理想体态',
price:241',
price:562',
productList:[
{
productCode : "14200300"
}
]
},
{
title: "小型犬成犬专属",
video:"/images/dog/three.mp4",
catimage: "/images/dog/three.jpg",
productimage: "/images/cat/star-3.png",
productimage: "/images/dog/star-3.png",
detail:'亮泽被毛 呵护牙齿',
price:121',
price:57',
productList:[
{
productCode : "16020080"
}
]
},
{
title: "离乳期全价奶糕",
video:"/images/dog/four.mp4",
catimage: "/images/dog/four.jpg",
productimage: "/images/cat/star-4.png",
productimage: "/images/dog/star-4.png",
detail:'高易再水合颗粒 帮助增强保护健康成长',
price:88',
price:263',
productList:[
{
productCode : "17220400"
}
]
},
],
rccontair: [
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: 1,
catimage: require("../assets/image/rc-cat.png"),
},
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: "2",
catimage: require("../assets/image/rc-cat.png"),
},
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: "2",
catimage: require("../assets/image/rc-cat.png"),
},
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: "2",
catimage: require("../assets/image/rc-cat.png"),
},
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: "2",
catimage: require("../assets/image/rc-dog.png"),
},
{
title: "皇家英国短毛猫全价湿粮",
price:'¥123.45',
ordernum: "2",
catimage: require("../assets/image/rc-dog.png"),
},
// {
// title: "皇家英国短毛猫全价湿粮",
// price:'¥123.45',
// ordernum: "2",
// catimage: require("../assets/image/rc-dog.png"),
// },
// {
// title: "皇家英国短毛猫全价湿粮",
// price:'¥123.45',
// ordernum: "2",
// catimage: require("../assets/image/rc-dog.png"),
// },
],
rccontair: [
{
title: "",
price:'',
ordernum: 1,
catimage: "",
},
],
headerSwiperOption: {
loop: true,

View File

@@ -99,6 +99,10 @@
</div>
</div>
<div class="online bold"></div>
<div class="ts-btn" v-if="!islogin">
<div class="ts-standard-btn center" @click="logout">退出登录</div>
</div>
</div>
</div>
@@ -141,6 +145,7 @@ import Myheader from '~/components/header.vue'
import MyFooter from '~/components/rc-footer.vue'
import FixRight from "~/components/fixed-right.vue";
import tabs from "@/components/tabs.vue";
import { mapMutations } from "vuex";
export default {
middleware: 'metaTitle',
// middleware: 'metaTitle',
@@ -150,7 +155,7 @@ export default {
userlog:false,
islogin:false,
dialogInfo1:false,
userid:null,
userid:null,
usertitle:'',
rcvalue:5000,
usermessage:'关注皇家爱宠荟,修改个人资料',
@@ -211,24 +216,30 @@ export default {
},
methods: {
userinter(){
let user= localStorage.getItem("userInfo");
if(user==undefined||user==null||user==''){
this.$message({
type: 'warning',
message: '您还未登录'
});
return
}else{
this.$router.push({
path: "/personal/integral/",
query: {
stype: 1,
},
});
}
},
...mapMutations(["logoutSystem","checkIsLogin"]),
logout() {
this.logoutSystem();
this.$router.push({
path: "/",
});
},
userinter(){
let user= this.checkIsLogin();
if(!user){
this.$message({
type: 'warning',
message: '您还未登录'
});
return
} else {
this.$router.push({
path: "/personal/integral/",
query: {
stype: 1,
},
});
}
},
findall(){
console.log('PPP');
console.log(this.userid.length);
@@ -304,64 +315,58 @@ obligation(item,index){
open(){
},
ifadroind(){
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)) {
if(this.userlog==true){
this.usermessage='关注皇家爱宠荟,修改个人资料',
this.dialogInfo1=true;
}else{
this.dialogInfo1=false;
this.usermessage='关注皇家爱宠荟,兑换更多福利';
}
}else{
this.dialogInfo1=false;
window.location.href="weixin://dl/business/?t=BE1OA2AngRs";
}
},
ifadroind(){
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)) {
if(this.userlog==true){
this.usermessage='关注皇家爱宠荟,修改个人资料',
this.dialogInfo1=true;
}else{
this.dialogInfo1=false;
this.usermessage='关注皇家爱宠荟,兑换更多福利';
}
return false;
} else {
this.dialogInfo1=false;
return true;
}
},
openaddress(item,index){
console.log(item,index);
let user= localStorage.getItem("userInfo");
if(user==undefined||user==null||user==''){
console.log('---=');
this.$message({
type: 'warning',
message: '您还未登录'
});
return
let user= localStorage.getItem("userInfo");
if(user==undefined||user==null||user==''){
this.$message({
type: 'warning',
message: '您还未登录'
});
return
}else{
if(item.title=='收货地址'){
this.$router.push({
path: `/useraddress/openaddress/`
})
console.log('这是地址的跳转');
}
if(item.title=='收货地址'){
this.$router.push({
path: `/useraddress/openaddress/`
})
}
if(index==0){
this.userlog=true
this.ifadroind();
let isMobile = this.ifadroind();
if(isMobile)
window.location.href="weixin://dl/business/?t=BE1OA2AngRs";
}
if(index==1){
this.$router.push({
path: `/personal/discount/`
})
console.log('这是地址的跳转');
}
if(index==1){
this.$router.push({
path: `/personal/discount/`
})
}
}
},
@@ -372,43 +377,37 @@ this.$router.push({
}
},
mounted() {
console.log(this.islogin)
console.log(this.userid);
let userwidth=0;
this.ifadroind();
let user= JSON.parse(localStorage.getItem("userInfo"));
console.log(user)
if(user!==null){
console.log('11')
this.userid=user.data;
console.log(this.userid);
this.usertitle=this.userid.memberName;
this.rcrcord=this.userid.availiblePoint;
if(this.userid.memberLevel==1){
let userlength=this.userid.availiblePoint.toString().length;
this.userimage=require('../../assets/image/rc-new.png');
this.userorder='新手铲屎官';
this.uservalue=5000; //新手总积分
this.rcvalue=this.uservalue-this.userid.availiblePoint; //新手总积分减去本身的积分
if(userlength==1||userlength==2||userlength==3||userlength==4){
userwidth=this.userid.availiblePoint/100
console.log(userwidth);
}
}
else if(this.userid.memberLevel==2){
this.userimage=require('../../assets/image/rc-new2.png');
this.userorder='资深铲屎官';
this.uservalue=10000;
this.rcvalue=this.uservalue-this.userid.availiblePoint;
userwidth=this.userid.availiblePoint/100
}else if( this.userid.memberLevel==3){
this.userimage=require('../../assets/image/rc-new1.png');
this.userorder='金牌铲屎官';
this.usrnewlist=this.goldmedal;
userwidth=100
}
let user= this.checkIsLogin();
if(user){
this.userid=user.data;
this.islogin=false;
this.usertitle=this.userid.memberName;
this.rcrcord=this.userid.availiblePoint;
if(this.userid.memberLevel==1){
let userlength=this.userid.availiblePoint.toString().length;
this.userimage=require('../../assets/image/rc-new.png');
this.userorder='新手铲屎官';
this.uservalue=5000; //新手总积分
this.rcvalue=this.uservalue-this.userid.availiblePoint; //新手总积分减去本身的积分
if(userlength==1||userlength==2||userlength==3||userlength==4){
userwidth=this.userid.availiblePoint/100
console.log(userwidth);
}
}
else if(this.userid.memberLevel==2){
this.userimage=require('../../assets/image/rc-new2.png');
this.userorder='资深铲屎官';
this.uservalue=10000;
this.rcvalue=this.uservalue-this.userid.availiblePoint;
userwidth=this.userid.availiblePoint/100
}else if( this.userid.memberLevel==3){
this.userimage=require('../../assets/image/rc-new1.png');
this.userorder='金牌铲屎官';
this.usrnewlist=this.goldmedal;
userwidth=100
}
this.$refs.userblock.style.width=userwidth+'%';
let tagEle=document.querySelector('.ts-point-tag');
if(tagEle){
@@ -418,17 +417,13 @@ this.$router.push({
tagEleLeft=0;
tagEle.style.left=tagEleLeft+"%";
}
} else{
console.log('---');
this.userid=[];
} else {
this.userid='';
}
if(this.userid==undefined ||this.userid==''||this.userid==null){
console.log(this.userid)
this.islogin=true;
}
if(this.userid==undefined ||this.userid==''||this.userid==null){
this.islogin=true;
}
},

View File

@@ -732,13 +732,20 @@ export default {
openclose() {
this.dialogInfo1 = false;
},
selectproduce() {
this.$router.push({
path: "/productdetails/producted",
query: {
stype: 1,
},
});
selectproduce(item,index){
if(item.productList[0]==undefined){
item.productlist[0].productCode=0;
}
if(item.productList[0]==undefined){
item.productlist[0]=[];
}
this.$router.push({
path: "/productdetails/producted",
query: {
stype: 1,
productCode:item.productList[0].productCode
},
});
},
ifadroind() {
var sUserAgent = navigator.userAgent.toLowerCase();

View File

@@ -14,6 +14,7 @@
show-action
placeholder="请输入搜索关键词"
@search="onSearch"
@cancel="onCancel"
class="rc-keyword"
>
<template #action>
@@ -664,14 +665,20 @@ export default {
element.checked = false;
});
},
selectproduce(item) {
this.$router.push({
path: "/productdetails/producted",
query: {
stype: 1,
productCode: item.productList[0].productCode,
},
});
selectproduce(item,index){
if(item.productList[0]==undefined){
item.productlist[0].productCode=0;
}
if(item.productList[0]==undefined){
item.productlist[0]=[];
}
this.$router.push({
path: "/productdetails/producted",
query: {
stype: 1,
productCode:item.productList[0].productCode
},
});
},
checkRxGoods(toggleSwitch){
let _self = this;
@@ -769,6 +776,10 @@ export default {
onSearch(e) {
this.usetmessage(this.activeIndex1, this.value);
},
onCancel() {
debugger;
this.value='';
},
selectGoods(item, index, onlyRefreshCategory) {
this.activeIndex1 = index;
this.resetAllOptions();