hookehuyr

fix 监听屏幕宽度逻辑优化,头部登录状态显示优化

1 /* 1 /*
2 * @Date: 2022-07-26 09:49:54 2 * @Date: 2022-07-26 09:49:54
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-16 10:55:55 4 + * @LastEditTime: 2024-10-21 16:35:25
5 * @FilePath: /hager/src/common/mixin.js 5 * @FilePath: /hager/src/common/mixin.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
25 data () { 25 data () {
26 return { 26 return {
27 top_img_height: '38rem', 27 top_img_height: '38rem',
28 - screenWidth: $('.hagerBox').width(), // 初始化屏幕宽度, xs <768px 28 + screenWidth: $(window).width(), // 初始化屏幕宽度, xs <768px
29 }; 29 };
30 }, 30 },
31 computed: { 31 computed: {
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
35 }, 35 },
36 methods: { 36 methods: {
37 handleResize() { 37 handleResize() {
38 - this.screenWidth = $('.hagerBox').width(); // 更新屏幕宽度 38 + this.screenWidth = $(window).width(); // 更新屏幕宽度
39 if (this.screenWidth < 768) { 39 if (this.screenWidth < 768) {
40 this.top_img_height = '30vh'; 40 this.top_img_height = '30vh';
41 } else { 41 } else {
......
1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 13:42:16 4 + * @LastEditTime: 2024-10-21 16:39:49
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
36 </div> 36 </div>
37 <div @click="goToLogin" class="tooltip"> 37 <div @click="goToLogin" class="tooltip">
38 <el-tooltip class="item" effect="dark" content="用户登录" placement="bottom"> 38 <el-tooltip class="item" effect="dark" content="用户登录" placement="bottom">
39 - <el-image style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E7%99%BB%E9%99%86@2x.png" fit="fit"></el-image> 39 + <el-image v-if="!is_login" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E7%99%BB%E9%99%86@2x.png" fit="fit"></el-image>
40 + <el-image v-else style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E5%B7%B2%E7%99%BB%E5%BD%95@2x.png" fit="fit"></el-image>
40 <!-- <i class=el-icon-user style="font-size: 1.25rem;"></i> --> 41 <!-- <i class=el-icon-user style="font-size: 1.25rem;"></i> -->
41 </el-tooltip> 42 </el-tooltip>
42 </div> 43 </div>
...@@ -111,7 +112,8 @@ ...@@ -111,7 +112,8 @@
111 </div> 112 </div>
112 <div> 113 <div>
113 <el-image @click="goToWeb" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E8%AF%AD%E8%A8%80@2x.png" fit="fit"></el-image>&nbsp;&nbsp; 114 <el-image @click="goToWeb" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E8%AF%AD%E8%A8%80@2x.png" fit="fit"></el-image>&nbsp;&nbsp;
114 - <el-image @click="goToLogin" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E7%99%BB%E9%99%86@2x.png" fit="fit"></el-image> 115 + <el-image v-if="!is_login" @click="goToLogin" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E7%99%BB%E9%99%86@2x.png" fit="fit"></el-image>
116 + <el-image v-else @click="goToLogin" style="width: 1rem; height: 1rem" src="https://cdn.ipadbiz.cn/hager/icon/%E5%B7%B2%E7%99%BB%E5%BD%95@2x.png" fit="fit"></el-image>
115 </div> 117 </div>
116 </div> 118 </div>
117 <div style="display: flex; align-items: center; border-radius: 1rem; border: 1px solid #f5f5f5; background-color: #e3f1f7; padding: 0.5rem 1rem; margin-top: 1rem;"> 119 <div style="display: flex; align-items: center; border-radius: 1rem; border: 1px solid #f5f5f5; background-color: #e3f1f7; padding: 0.5rem 1rem; margin-top: 1rem;">
...@@ -139,7 +141,6 @@ export default { ...@@ -139,7 +141,6 @@ export default {
139 data () { 141 data () {
140 return { 142 return {
141 show: false, 143 show: false,
142 - test1: true,
143 product_menu: [{ 144 product_menu: [{
144 name: '配电产品', 145 name: '配电产品',
145 icon: 'https://cdn.ipadbiz.cn/hager/icon/%E9%85%8D%E7%94%B5%E4%BA%A7%E5%93%81@2x.png', 146 icon: 'https://cdn.ipadbiz.cn/hager/icon/%E9%85%8D%E7%94%B5%E4%BA%A7%E5%93%81@2x.png',
...@@ -292,6 +293,7 @@ export default { ...@@ -292,6 +293,7 @@ export default {
292 margin_top: 0, 293 margin_top: 0,
293 // choose_country: false, // 主动选择了国家地区 294 // choose_country: false, // 主动选择了国家地区
294 keyword: '', 295 keyword: '',
296 + is_login: true,
295 } 297 }
296 }, 298 },
297 watch: { 299 watch: {
......