123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <div class="toolBar">
- <div class="item">
- <el-popover placement="left" width="170" trigger="hover">
- <div>
- <div style="text-align: center;font-weight:bold;color:#222;" class="text">扫码进入小程序</div>
- <img
- style="width: 150px; height: 150px"
- src="@/assets/xcxqrcode.jpg"
- alt=""
- />
- </div>
- <div slot="reference">
- <img src="@/assets/qr.png" class="img" alt="" />
- <div class="text">手机端</div>
- </div>
- </el-popover>
- </div>
- <div class="item" v-if="userInfo" @click="go('/cart')">
- <el-badge :value="cartCount || ''">
- <i class="img el-icon-shopping-cart-2"></i>
- <div class="text">购物车</div>
- </el-badge>
- </div>
- <div class="item">
- <el-popover placement="left" width="180" trigger="hover">
- <div style="height: 100px; text-align: center">
- <img
- style="width: 26px; height: 25px; margin-top: 10px"
- src="@/assets/phone.png"
- alt=""
- />
- <div
- style="
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #3f8dfd;
- line-height: 16px;
- "
- >
- 020-87085982
- </div>
- <div
- style="
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- line-height: 24px;
- margin-top: 10px;
- "
- >
- 报名电话
- </div>
- </div>
- <div slot="reference">
- <img src="@/assets/contact.png" class="img" alt="" />
- <div class="text">报名咨询</div>
- </div>
- </el-popover>
- </div>
- <div class="item" @click="scollTop">
- <img src="@/assets/top.png" class="img" alt="" />
- <div class="text">返回顶部</div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters, mapMutations } from "vuex";
- export default {
- name: "ToolBar",
- computed: {
- ...mapGetters(["userInfo", "cartCount"]),
- },
- data() {
- return {
- scrollTimer: null,
- };
- },
- mounted() {
- if (this.$tools.isLogin()) {
- this.getCartCount();
- }
- },
- methods: {
- ...mapMutations(["getCartCount"]),
- go(path) {
- this.$router.push({
- path,
- });
- },
- scollTop() {
- clearInterval(this.scrollTimer);
- this.scrollTimer = setInterval(() => {
- const top = document.documentElement.scrollTop;
- const speed = top / 10;
- if (document.documentElement.scrollTop !== 0) {
- document.documentElement.scrollTop -= speed;
- } else {
- clearInterval(this.scrollTimer);
- }
- }, 16);
- },
- },
- };
- </script>
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style scoped lang="scss">
- .toolBar {
- border: 1px solid #eeeeee;
- box-shadow: 0px 3px 6px 0px rgba(213, 218, 224, 0.8);
- border-radius: 10px;
- padding: 4px;
- position: fixed;
- right: 0;
- top: 380px;
- background: #fff;
- display: flex;
- flex-direction: column;
- z-index: 9999;
- .item {
- cursor: pointer;
- width: 56px;
- height: 80px;
- border-bottom: 1px solid #eeeeee;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: #3f8dfd;
- position: relative;
- &:nth-last-of-type(1) {
- border: 0;
- }
- .img {
- width: 24px;
- font-size: 24px;
- height: 24px;
- display: block;
- margin: 0 auto 5px;
- }
- .text {
- text-align: center;
- word-break: break-all;
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- line-height: 16px;
- }
- .blue {
- font-weight: bold;
- font-size: 14px;
- color: #3f8dfd;
- }
- .el-badge {
- text-align: center;
- }
- }
- }
- </style>
|