|  | @@ -3,7 +3,7 @@
 | 
	
		
			
				|  |  |   * @Author: 空白格
 | 
	
		
			
				|  |  |   * @Date: 2022-08-10 11:30:36
 | 
	
		
			
				|  |  |   * @LastEditors: 空白格
 | 
	
		
			
				|  |  | - * @LastEditTime: 2022-08-17 17:23:37
 | 
	
		
			
				|  |  | + * @LastEditTime: 2022-08-23 15:17:05
 | 
	
		
			
				|  |  |   * @FilePath: \veterans_client_web\src\layout\index.vue
 | 
	
		
			
				|  |  |   * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 | 
	
		
			
				|  |  |  -->
 | 
	
	
		
			
				|  | @@ -30,12 +30,16 @@
 | 
	
		
			
				|  |  |              </el-input>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |            <div class="header-box-right-user" v-if="isLogin">
 | 
	
		
			
				|  |  | -            下午好,<router-link class="link" to="/personalcenter">{{
 | 
	
		
			
				|  |  | -              userInfo.userName || userInfo.name
 | 
	
		
			
				|  |  | -            }}</router-link>
 | 
	
		
			
				|  |  | +            {{ getDateText() }}好,<router-link
 | 
	
		
			
				|  |  | +              class="link"
 | 
	
		
			
				|  |  | +              to="/personalcenter"
 | 
	
		
			
				|  |  | +              >{{ userInfo.userName || userInfo.name }}</router-link
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |            <div class="header-box-right-user" v-else>
 | 
	
		
			
				|  |  | -            下午好,请<router-link class="link" to="/login">登录</router-link>
 | 
	
		
			
				|  |  | +            {{ getDateText() }}好,请<router-link class="link" to="/login"
 | 
	
		
			
				|  |  | +              >登录</router-link
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </div>
 | 
	
	
		
			
				|  | @@ -46,7 +50,7 @@
 | 
	
		
			
				|  |  |      <div class="footer" height="100px">
 | 
	
		
			
				|  |  |        <div class="footer-link">
 | 
	
		
			
				|  |  |          <router-link class="link" to="">关于我们</router-link> |
 | 
	
		
			
				|  |  | -        <router-link class="link" to="">加入收藏</router-link> |
 | 
	
		
			
				|  |  | +        <span class="link" to="" @click="addFavorite">加入收藏</span> |
 | 
	
		
			
				|  |  |          <router-link class="link" to="">隐私声明</router-link> |
 | 
	
		
			
				|  |  |          <router-link class="link" to="">网站地图</router-link> |
 | 
	
		
			
				|  |  |          <router-link class="link" to="">联系我们</router-link> |
 | 
	
	
		
			
				|  | @@ -68,8 +72,8 @@ export default {
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  |        searchValue: "",
 | 
	
		
			
				|  |  | -      currentPath: '/',
 | 
	
		
			
				|  |  | -      nowDate: ''
 | 
	
		
			
				|  |  | +      currentPath: "/",
 | 
	
		
			
				|  |  | +      nowDate: "",
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
	
		
			
				|  | @@ -79,16 +83,51 @@ export default {
 | 
	
		
			
				|  |  |      }),
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch: {
 | 
	
		
			
				|  |  | -    '$route'(val) {
 | 
	
		
			
				|  |  | +    $route(val) {
 | 
	
		
			
				|  |  |        if (val.path) {
 | 
	
		
			
				|  |  | -        this.currentPath = val.path
 | 
	
		
			
				|  |  | +        this.currentPath = val.path;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    created() {
 | 
	
		
			
				|  |  | -    this.currentPath = this.$router.history.current.path
 | 
	
		
			
				|  |  | -    this.nowDate = parseTime(new Date(), '{y}年{m}月{d}日 星期{a}')
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +    this.currentPath = this.$router.history.current.path;
 | 
	
		
			
				|  |  | +    this.nowDate = parseTime(new Date(), "{y}年{m}月{d}日 星期{a}");
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  methods: {
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取上午/下午
 | 
	
		
			
				|  |  | +     * @date 2022-08-23
 | 
	
		
			
				|  |  | +     * @returns {any}
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    getDateText() {
 | 
	
		
			
				|  |  | +      let date = new Date();
 | 
	
		
			
				|  |  | +      let hours = date.getHours();
 | 
	
		
			
				|  |  | +      if (hours >= 0 && hours < 12) {
 | 
	
		
			
				|  |  | +        return "上午";
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        return "下午";
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 加入收藏操作
 | 
	
		
			
				|  |  | +     * @date 2022-08-23
 | 
	
		
			
				|  |  | +     * @returns {any}
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    addFavorite() {
 | 
	
		
			
				|  |  | +      let sURL = window.location.href,
 | 
	
		
			
				|  |  | +      sTitle = '贵州退役军人教育培训'
 | 
	
		
			
				|  |  | +      console.log(sURL);
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        window.external.addFavorite(sURL, sTitle);
 | 
	
		
			
				|  |  | +      } catch (e) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +          window.sidebar.addPanel(sTitle, sURL, "");
 | 
	
		
			
				|  |  | +        } catch (e) {
 | 
	
		
			
				|  |  | +          alert("加入收藏失败,请使用Ctrl+D进行添加");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -147,7 +186,7 @@ export default {
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  .main {
 | 
	
		
			
				|  |  | -  background-color: #F4F4F4;
 | 
	
		
			
				|  |  | +  background-color: #f4f4f4;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  .footer {
 | 
	
		
			
				|  |  |    background-color: #659789;
 | 
	
	
		
			
				|  | @@ -166,6 +205,7 @@ export default {
 | 
	
		
			
				|  |  |      .link {
 | 
	
		
			
				|  |  |        color: #fff;
 | 
	
		
			
				|  |  |        margin: 0 5px;
 | 
	
		
			
				|  |  | +      cursor: pointer;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 |