123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <div>
- <div class="header">
- <div class="title-card">
- <li class="bg-img" @click="ConfirmBtn({ id: 1, url: '/home' })" :class="getClass(1)">
- <img src="../assets/images/Vector.png" alt="" />
- <linear-text
- text="总览"
- startColor="#95CCFF"
- endColor="#fff"
- fontSize="20px"
-
- />
- </li>
- <ul v-for="(item, index) in titleList" :key="index">
- <li
- class="bg-img"
- @click="ConfirmBtn(item)"
- :class="getClass(item.id)"
- >
- <linear-text
- :text="item.name"
- startColor="#95CCFF"
- endColor="#fff"
- fontSize="20px"
- />
- </li>
- </ul>
- </div>
- <div class="title-card">
- <ul v-for="(item, index) in titleList1" :key="index">
- <li
- class="bg-img"
- @click="ConfirmBtn(item)"
- :class="getClass(item.id)"
- >
- <linear-text
- :text="item.name"
- startColor="#95CCFF"
- endColor="#fff"
- fontSize="20px"
- />
- </li>
- </ul>
- <li class="bg-img" @click="ConfirmBtn(8)" :class="getClass(8)">
- <img src="../assets/images/out.png" alt="" />
- </li>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Image1 from "../assets/images/fxyj2.png";
- import Image2 from "../assets/images/fxyj4.png";
- import Image3 from "../assets/images/fxyj7.png";
- import Image4 from "../assets/images/fxyj8.png";
- export default {
- // eslint-disable-next-line vue/multi-word-component-names
- name: "Headers",
- data() {
- return {
- imgList: [
- { load: Image1 },
- { load: Image2 },
- { load: Image3 },
- { load: Image4 },
- ],
- titleList: [
- {
- name: "基础信息",
- id: 2,
- url: '/basic'
- },
- {
- name: "消防管理",
- id: 3,
- url:'/fire'
- },
- {
- name: "风险预警",
- id: 4,
- },
- ],
- titleList1: [
- {
- name: "警情动态",
- id: 5,
- },
- {
- name: "火灾情况",
- id: 6,
- },
- {
- name: "消防物联网",
- id: 7,
- },
- ],
- test: 1,
- flag: -1,
- };
- },
- mounted() {
- console.log(this.test);
- },
- methods: {
- ConfirmBtn(item) {
- if (item.url && this.$route.path !== item.url) {
- this.flag = item.id
- this.$router.push(item.url)
- <<<<<<< HEAD
- } else if (item.url) {
- =======
- } else if (this.$route.path !== item.url) {
- >>>>>>> de5e4fd (fix: 修复在当前页面重复点击提示未开发的问题)
- alert("【" + item.name + "】模块开发中...")
- }
- },
- getClass(v) {
- return this.flag == v ? "bg-img active" : "bg-img";
- },
- },
- created() {
- console.log(this);
- },
- watch: {
- $route: {
- handler(route) {
- this.flag = route.meta.id
- },
- immediate: true,
- deep: true
- }
- }
- };
- </script>
- <style scoped>
- .header {
- width: 100%;
- height: 120px;
- /* background: url('../assets/top.png') center no-repeat; */
- background: url("../assets/images/top.png") center no-repeat;
- display: flex;
- justify-content: space-between;
- }
- .title-card {
- /* width: 400px; */
- display: flex;
- padding: 40px 20px;
- font-size: 20px;
- }
- img {
- width: 16px;
- height: 15px;
- margin-right: 8px;
- }
- .tab-list {
- width: 100%;
- display: flex;
- justify-content: space-between;
- }
- .bg-img {
- width: 118px;
- height: 48px;
- font-size: 18px;
- background: url("../assets/images/btn.png") no-repeat;
- background-size: 100% 100%;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- padding-left: 10px;
- line-height: 49px;
- }
- .bg-img:hover {
- cursor: pointer;
- }
- /* 选中效果 */
- .active {
- width: 150px;
- height: 48px;
- font-size: 18px;
- background: url("../assets/images/active-btn.png") no-repeat !important;
- background-size: 100% 100%;
- text-align: center;
- line-height: 49px;
- }
- </style>
|