mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
166 lines
3.7 KiB
Vue
166 lines
3.7 KiB
Vue
<template>
|
||
<div class="rc-fixright-container">
|
||
<div class="rc-fixright">
|
||
<ul>
|
||
<li v-for="(userfixed, index) in fixedlist" :key="index" @click="lianxi(userfixed, index)">
|
||
<img :src="userfixed.catimage" alt="" />
|
||
<span>{{ userfixed.title }}</span>
|
||
</li>
|
||
</ul>
|
||
<div class="tuntop" @click="toTop" v-show="gotop">
|
||
<img src="../assets/image/turntop.png" alt="" />
|
||
<span>回到顶部</span>
|
||
</div>
|
||
</div>
|
||
<el-dialog :visible.sync="customerServerStop" :close-on-click-modal="false">
|
||
<div class="ts-warning-popup">
|
||
<div class="title rc-full-width"><img src="../assets/error.png" alt="" /></div>
|
||
<div class="content rc-full-width rc-text--center rc-margin-y--md">
|
||
<h3>温馨提示</h3>
|
||
<span class="">
|
||
客服因法定春节假期暂停服务,
|
||
<br />
|
||
预计2月10日恢复正常服务
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { mapMutations,mapState } from "vuex";
|
||
export default {
|
||
data(){
|
||
return{
|
||
customerServerStop:false,
|
||
gotop: false,
|
||
loginornot:false,
|
||
fixedlist: [
|
||
{
|
||
title: "购物车",
|
||
catimage: require("../assets/buy.png"),
|
||
|
||
},
|
||
{
|
||
title: "在线客服",
|
||
catimage: require("../assets/service.png"),
|
||
|
||
},
|
||
{
|
||
title: "营养专家",
|
||
catimage: require("../assets/consult.png"),
|
||
|
||
}
|
||
]
|
||
}
|
||
},
|
||
methods:{
|
||
...mapMutations(["checkIsLogin"]),
|
||
lianxi(item,index) {
|
||
// this.checkIsLogin();
|
||
let user = this.userInfo;
|
||
let curMemberId = (user?user.id:'');
|
||
if(item.title=='在线客服'){
|
||
//this.customerServerStop = true;
|
||
/* Stop until 2022-2-10 */
|
||
var option = {
|
||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId, types:'14054'},
|
||
type:3
|
||
}
|
||
dis_livchat(option);
|
||
_hmt.push([
|
||
"_trackCustomEvent",
|
||
"live_chat",
|
||
{
|
||
"type":"cs",
|
||
"member_id": curMemberId,
|
||
}
|
||
])
|
||
|
||
}
|
||
if(item.title=='购物车'){
|
||
if(this.loginornot){
|
||
this.$router.push({
|
||
path: "/userlogin/login",
|
||
});
|
||
} else {
|
||
this.$router.push({
|
||
path: "/myorder/userrecord",
|
||
});
|
||
}
|
||
}
|
||
if(item.title=='营养专家'){
|
||
//this.customerServerStop = true;
|
||
/* Stop until 2022-2-10*/
|
||
var option = {
|
||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId, types:'14053'},
|
||
type:3
|
||
}
|
||
dis_livchat(option);
|
||
_hmt.push([
|
||
"_trackCustomEvent",
|
||
"live_chat",
|
||
{
|
||
"type":"sol",
|
||
"member_id": curMemberId,
|
||
}
|
||
])
|
||
}
|
||
},
|
||
toTop() {
|
||
let top = document.documentElement.scrollTop || document.body.scrollTop;
|
||
// 实现滚动效果
|
||
const timeTop = setInterval(() => {
|
||
document.body.scrollTop = document.documentElement.scrollTop = top -= 400;
|
||
if (top <= 0) {
|
||
clearInterval(timeTop);
|
||
}
|
||
}, 10);
|
||
},
|
||
handleScroll() {
|
||
let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
|
||
if(scrolltop>400)
|
||
{
|
||
this.gotop = true
|
||
}
|
||
else
|
||
{
|
||
this.gotop = false
|
||
}
|
||
}
|
||
},
|
||
computed:{
|
||
...mapState({
|
||
userInfo : state => state.user.userInfo,
|
||
loginState : state => state.login.loginState,
|
||
})
|
||
},
|
||
watch: {
|
||
userInfo(newVal){
|
||
if(newVal && this.loginState){
|
||
this.loginornot = false;
|
||
}else{
|
||
this.loginornot = true;
|
||
}
|
||
}
|
||
},
|
||
mounted(){
|
||
//Check login
|
||
this.checkIsLogin();
|
||
let usernot = this.userInfo;
|
||
//console.log(usernot);
|
||
if(usernot==null ||usernot==undefined){
|
||
this.loginornot=true
|
||
}else{
|
||
this.loginornot=false
|
||
this.usermessage=usernot;
|
||
}
|
||
//Check login end
|
||
window.addEventListener("scroll", this.handleScroll, true);
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="less" scoped></style>
|