zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
  <div>
    <Row :gutter="30">
      <Col
        span="4"
        v-for="(item, index) in linkList"
        :key="index"
        v-if="
          (item.title !== '拼团频道' && item.title !== '签到') ||
          $route.name !== 'renovation'
        "
      >
        <div
          class="card"
          :class="{ active: selectedIndex == index }"
          @click="handleLink(item, index)"
        >
          <Icon size="24" :type="item.icon" />
          <p>{{ item.title }}</p>
        </div>
      </Col>
      <!-- 外部链接,只有pc端跳转 -->
      <Col span="4">
        <div
          v-if="linkVisible"
          class="card"
          :class="{ active: selectedIndex == linkList.length }"
          @click="handleLink(linkItem, linkList.length)"
        >
          <Icon size="24" :type="linkItem.icon" />
          <p>{{ linkItem.title }}</p>
        </div>
      </Col>
    </Row>
  </div>
</template>
<script>
export default {
  data() {
    return {
      linkList: [
        // 链接列表
        {
          title: "首页",
          icon: "md-home",
          ___type: "home",
        },
        {
          title: "购物车",
          icon: "md-cart",
          ___type: "cart",
        },
        {
          title: "收藏商品",
          icon: "md-heart",
          ___type: "collection",
        },
        {
          title: "我的订单",
          icon: "md-document",
          ___type: "order",
        },
        {
          title: "个人中心",
          icon: "md-person",
          ___type: "user",
        },
        {
          title: "拼团频道",
          icon: "md-flame",
          ___type: "group",
        },
        {
          title: "秒杀频道",
          icon: "md-flame",
          ___type: "seckill",
        },
        {
          title: "领券中心",
          icon: "md-pricetag",
          ___type: "coupon",
        },
        {
          title: "签到",
          icon: "md-happy",
          ___type: "sign",
        },
        {
          title: "小程序直播",
          icon: "ios-videocam",
          ___type: "live",
        },
        {
          title: "砍价",
          icon: "md-share-alt",
          ___type: "kanjia",
        },
        {
          title: "积分商城",
          icon: "ios-basket",
          ___type: "point",
        },
      ],
      linkItem: {
        title: "外部链接",
        icon: "ios-link",
        ___type: "link",
        url: "",
      },
      linkVisible: true, // 是否显示外部链接
      selectedIndex: 9999999, // 已选index
    };
  },
  created(){
    // console.log(window.location.href)
    let urls = window.location.href
    if(urls.indexOf('/floorList/renovation') != -1){
      this.linkList.forEach((items,indexs)=>{
        if(items.title == '砍价'){
          this.linkList.splice(indexs,1)
        }
      })
      this.linkList.forEach((item,index)=>{
        if(item.title == '小程序直播'){
          this.linkList.splice(index,1)
        }
      })
      this.linkList.forEach((itemss,indexss)=>{
        if(itemss.title == '积分商城'){
          this.linkList.splice(indexss,1)
        }
      })
      this.linkVisible = true
    }else{
      this.linkVisible = false
    }
 
  },
  methods: {
    handleLink(val, index) {
      val = { ...val, ___type: "other" };
      this.selectedIndex = index;
      this.$emit("selected", [val]);
    },
  },
};
</script>
<style lang="scss" scoped>
@import "../style.scss";
.card {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 20px 0;
  margin: 10px 0;
  text-align: center;
  transition: 0.35s;
  cursor: pointer;
  /deep/ p {
    margin: 10px 0;
  }
  border: 1px solid #ededed;
}
.card:hover {
  background: #ededed;
}
.active {
  background: #ededed;
}
</style>