hookehuyr

✨ feat: 新增公用颜色和样式

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: 2022-08-19 17:11:29 4 + * @LastEditTime: 2024-09-30 09:44:55
5 - * @FilePath: /web/src/common/mixin.js 5 + * @FilePath: /hager/src/common/mixin.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 8
...@@ -12,6 +12,11 @@ export default { ...@@ -12,6 +12,11 @@ export default {
12 mounted () { 12 mounted () {
13 document.title = this.$route.meta.title; 13 document.title = this.$route.meta.title;
14 }, 14 },
15 + data () {
16 + return {
17 + top_img_height: '35rem',
18 + };
19 + },
15 methods: { 20 methods: {
16 }, 21 },
17 }, 22 },
......
1 <!-- 1 <!--
2 * @Date: 2024-09-29 10:07:11 2 * @Date: 2024-09-29 10:07:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-29 15:19:21 4 + * @LastEditTime: 2024-09-30 10:06:04
5 * @FilePath: /hager/src/components/common/hagerH1.vue 5 * @FilePath: /hager/src/components/common/hagerH1.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
44 <style lang="less" scoped> 44 <style lang="less" scoped>
45 .hagerH1 { 45 .hagerH1 {
46 .h1 { 46 .h1 {
47 - color: #333; 47 + color: @secondary-color;
48 font-size: 1.75rem; 48 font-size: 1.75rem;
49 font-weight: bold; 49 font-weight: bold;
50 } 50 }
51 .sub { 51 .sub {
52 - color: #03aae3; 52 + color: @primary-color;
53 font-size: 1.25rem; 53 font-size: 1.25rem;
54 font-weight: bold; 54 font-weight: bold;
55 } 55 }
......
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-09-29 14:27:53 4 + * @LastEditTime: 2024-09-30 09:59:51
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -12,20 +12,20 @@ ...@@ -12,20 +12,20 @@
12 <el-col :sm="20" :md="20" :lg="18" :xl="16" style="position: relative;height: 5rem;"> 12 <el-col :sm="20" :md="20" :lg="18" :xl="16" style="position: relative;height: 5rem;">
13 <el-row style=""> 13 <el-row style="">
14 <el-col :sm="16" :md="16" :lg="16" :xl="16"> 14 <el-col :sm="16" :md="16" :lg="16" :xl="16">
15 - <div style="display: flex;height: 5rem; align-items: center; justify-content: space-around;"> 15 + <div class="nav-wrapper">
16 <div>图标</div> 16 <div>图标</div>
17 - <div @click="onClickProduct">产品中心</div> 17 + <div :class="[is_active === 'product' ? 'active' : '', 'item']" @click="onClickProduct">产品中心</div>
18 - <div>解决方案</div> 18 + <div :class="[is_active === 'solution' ? 'active' : '', 'item']" @click="goTo('/solution/index')">解决方案</div>
19 - <div>新闻中心</div> 19 + <div :class="[is_active === '新闻中心' ? 'active' : '', 'item']">新闻中心</div>
20 - <div>招聘信息</div> 20 + <div :class="[is_active === '招聘信息' ? 'active' : '', 'item']">招聘信息</div>
21 - <div>关于海格</div> 21 + <div :class="[is_active === '关于海格' ? 'active' : '', 'item']">关于海格</div>
22 - <div>联系我们</div> 22 + <div :class="[is_active === '联系我们' ? 'active' : '', 'item']">联系我们</div>
23 - <div>首页</div> 23 + <div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div>
24 </div> 24 </div>
25 </el-col> 25 </el-col>
26 <el-col :sm="8" :md="8" :lg="8" :xl="8"> 26 <el-col :sm="8" :md="8" :lg="8" :xl="8">
27 <div style="display: flex; height: 5rem; align-items: center;justify-content: right;"> 27 <div style="display: flex; height: 5rem; align-items: center;justify-content: right;">
28 - <div style="display: flex; align-items: center; border-radius: 1rem; border: 1px solid# f5f5f5; background-color: #e3f1f7; padding: 0.5rem 1rem;"> 28 + <div style="display: flex; align-items: center; border-radius: 1rem; border: 1px solid #f5f5f5; background-color: #e3f1f7; padding: 0.5rem 1rem;">
29 <i class=el-icon-zoom-out></i>&nbsp; 29 <i class=el-icon-zoom-out></i>&nbsp;
30 <input style="border: 0;background-color: #e3f1f7;" placeholder="搜索" /> 30 <input style="border: 0;background-color: #e3f1f7;" placeholder="搜索" />
31 </div> 31 </div>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
54 <div v-for="(item, index) in product_info.product" :key="index" class="product-right-center-item"> 54 <div v-for="(item, index) in product_info.product" :key="index" class="product-right-center-item">
55 <div>{{ item.name }}</div> 55 <div>{{ item.name }}</div>
56 <div> 56 <div>
57 - <div v-for="(p, idx) in item.list" :key="idx">{{ p.name }}</div> 57 + <div @click="goToP(p.id)" v-for="(p, idx) in item.list" :key="idx">{{ p.name }}</div>
58 </div> 58 </div>
59 </div> 59 </div>
60 </div> 60 </div>
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
70 70
71 <script> 71 <script>
72 import mixin from 'common/mixin'; 72 import mixin from 'common/mixin';
73 +import { parseQueryString } from '@/utils/tools';
73 74
74 export default { 75 export default {
75 mixins: [mixin.init], 76 mixins: [mixin.init],
...@@ -198,11 +199,20 @@ export default { ...@@ -198,11 +199,20 @@ export default {
198 } 199 }
199 }], 200 }],
200 product_info: {}, 201 product_info: {},
202 + is_active: '',
201 } 203 }
202 }, 204 },
203 mounted () { 205 mounted () {
204 this.product_info = this.product_menu[0]['info']; 206 this.product_info = this.product_menu[0]['info'];
205 }, 207 },
208 + watch: {
209 + '$route' (to, from) {
210 + this.is_active = to.meta.tag;
211 + // console.warn(from);
212 + // console.warn(location.hash);
213 + // console.warn(parseQueryString(window.location.href));
214 + }
215 + },
206 methods: { 216 methods: {
207 onClickProduct() { 217 onClickProduct() {
208 // 当鼠标悬停时 218 // 当鼠标悬停时
...@@ -213,6 +223,22 @@ export default { ...@@ -213,6 +223,22 @@ export default {
213 }, 223 },
214 closeMenu () { 224 closeMenu () {
215 this.show = false; 225 this.show = false;
226 + },
227 + goTo (path) { // 跳转页面
228 + if (this.$route.path !== path) { // 不能重复点击当前页面
229 + this.$router.push({
230 + path,
231 + });
232 + }
233 + },
234 + goToP (id) {
235 + this.$router.push({
236 + path: '/product/detail',
237 + query: {
238 + id: id
239 + }
240 + });
241 + this.closeMenu();
216 } 242 }
217 } 243 }
218 } 244 }
...@@ -248,5 +274,19 @@ export default { ...@@ -248,5 +274,19 @@ export default {
248 } 274 }
249 } 275 }
250 } 276 }
277 + .nav-wrapper {
278 + display: flex;
279 + height: 5rem;
280 + align-items: center;
281 + justify-content: space-around;
282 + .item {
283 + &:hover {
284 + cursor: pointer;
285 + }
286 + }
287 + .active {
288 + color: @primary-color;
289 + }
290 + }
251 } 291 }
252 </style> 292 </style>
......
1 <!-- 1 <!--
2 * @Date: 2024-09-27 19:49:03 2 * @Date: 2024-09-27 19:49:03
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-29 14:58:52 4 + * @LastEditTime: 2024-09-30 10:04:50
5 * @FilePath: /hager/src/components/hagerCarousel.vue 5 * @FilePath: /hager/src/components/hagerCarousel.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -161,7 +161,7 @@ export default { ...@@ -161,7 +161,7 @@ export default {
161 } 161 }
162 162
163 .thumbnail.active { 163 .thumbnail.active {
164 - border: 2px solid #00f; /* 选中的缩略图边框样式 */ 164 + border: 2px solid @primary-color; /* 选中的缩略图边框样式 */
165 } 165 }
166 166
167 .main-image { 167 .main-image {
......
1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-29 16:11:58 4 + * @LastEditTime: 2024-09-30 09:47:44
5 * @FilePath: /hager/src/route.js 5 * @FilePath: /hager/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -10,7 +10,8 @@ export default [{ ...@@ -10,7 +10,8 @@ export default [{
10 name: '首页', 10 name: '首页',
11 component: () => import('@/views/index'), 11 component: () => import('@/views/index'),
12 meta: { 12 meta: {
13 - title: '海格电器' 13 + title: '海格电器',
14 + tag: 'index'
14 }, 15 },
15 children: [] 16 children: []
16 }, { 17 }, {
...@@ -18,7 +19,8 @@ export default [{ ...@@ -18,7 +19,8 @@ export default [{
18 name: '二级目录', 19 name: '二级目录',
19 component: () => import('@/views/product/index'), 20 component: () => import('@/views/product/index'),
20 meta: { 21 meta: {
21 - title: '海格电器' 22 + title: '海格电器',
23 + tag: 'product'
22 }, 24 },
23 children: [] 25 children: []
24 }, { 26 }, {
...@@ -26,7 +28,8 @@ export default [{ ...@@ -26,7 +28,8 @@ export default [{
26 name: '详情页', 28 name: '详情页',
27 component: () => import('@/views/product/detail'), 29 component: () => import('@/views/product/detail'),
28 meta: { 30 meta: {
29 - title: '海格电器' 31 + title: '海格电器',
32 + tag: 'product'
30 }, 33 },
31 children: [] 34 children: []
32 }, { 35 }, {
...@@ -34,7 +37,8 @@ export default [{ ...@@ -34,7 +37,8 @@ export default [{
34 name: '解决方案', 37 name: '解决方案',
35 component: () => import('@/views/solution/index'), 38 component: () => import('@/views/solution/index'),
36 meta: { 39 meta: {
37 - title: '海格电器' 40 + title: '海格电器',
41 + tag: 'solution'
38 }, 42 },
39 children: [] 43 children: []
40 }, { 44 }, {
...@@ -42,7 +46,8 @@ export default [{ ...@@ -42,7 +46,8 @@ export default [{
42 name: '解决方案详情', 46 name: '解决方案详情',
43 component: () => import('@/views/solution/detail'), 47 component: () => import('@/views/solution/detail'),
44 meta: { 48 meta: {
45 - title: '海格电器' 49 + title: '海格电器',
50 + tag: 'solution'
46 }, 51 },
47 children: [] 52 children: []
48 }] 53 }]
......
1 +// 自定义颜色
2 +@primary-color: #3498db;
3 +@secondary-color: #03467c;
4 +@text-color: #333;
5 +@background-color: #f5f5f5;
1 <!-- 1 <!--
2 * @Date: 2024-08-27 10:06:30 2 * @Date: 2024-08-27 10:06:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-29 17:12:34 4 + * @LastEditTime: 2024-09-30 09:45:01
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <div class="hager-container"> 9 <div class="hager-container">
10 - <el-carousel height="40rem" :interval="8000"> 10 + <el-carousel :height="top_img_height" :interval="8000">
11 <el-carousel-item v-for="item in 4" :key="item"> 11 <el-carousel-item v-for="item in 4" :key="item">
12 <el-image style="width: 100%; height: 100%;" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image> 12 <el-image style="width: 100%; height: 100%;" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image>
13 </el-carousel-item> 13 </el-carousel-item>
...@@ -151,6 +151,13 @@ export default { ...@@ -151,6 +151,13 @@ export default {
151 // boxes[boxes.length - 1].classList.add('other'); 151 // boxes[boxes.length - 1].classList.add('other');
152 // } 152 // }
153 }, 153 },
154 + watch: {
155 + // 监听$route对象的变化
156 + $route(to, from) {
157 + console.log('路由变化了:', to.path);
158 + // 在此处执行你想要的逻辑
159 + }
160 + },
154 methods: { 161 methods: {
155 162
156 } 163 }
......
1 <!-- 1 <!--
2 * @Date: 2024-09-29 14:26:41 2 * @Date: 2024-09-29 14:26:41
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-29 15:44:40 4 + * @LastEditTime: 2024-09-30 10:06:55
5 * @FilePath: /hager/src/views/product/detail.vue 5 * @FilePath: /hager/src/views/product/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
135 box-sizing: border-box; /* 确保padding和border不会影响宽度计算 */ 135 box-sizing: border-box; /* 确保padding和border不会影响宽度计算 */
136 padding-top: 1rem; 136 padding-top: 1rem;
137 background-color: #f0f0f0; 137 background-color: #f0f0f0;
138 - border-top: 4px solid #03aae3; 138 + border-top: 4px solid @primary-color;
139 p { 139 p {
140 line-height: 2; 140 line-height: 2;
141 } 141 }
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
144 .product-info { 144 .product-info {
145 .info-control { 145 .info-control {
146 display: flex; 146 display: flex;
147 - border-bottom: 4px solid #03aae3; 147 + border-bottom: 4px solid @primary-color;
148 padding-bottom: 1rem; 148 padding-bottom: 1rem;
149 margin-top: 2rem; 149 margin-top: 2rem;
150 .control-left { 150 .control-left {
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
159 cursor: pointer; 159 cursor: pointer;
160 } 160 }
161 &.active { 161 &.active {
162 - background-color: #03aae3; 162 + background-color: @primary-color;
163 color: #fff; 163 color: #fff;
164 } 164 }
165 } 165 }
...@@ -177,7 +177,7 @@ export default { ...@@ -177,7 +177,7 @@ export default {
177 span { 177 span {
178 &:hover { 178 &:hover {
179 cursor: pointer; 179 cursor: pointer;
180 - color: #03aae3; 180 + color: @primary-color;
181 text-decoration: underline; 181 text-decoration: underline;
182 } 182 }
183 } 183 }
......
1 <template> 1 <template>
2 <div class="hager-solution-index"> 2 <div class="hager-solution-index">
3 - <el-image style="width: 100%; height: 35rem" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image> 3 + <el-image :style="{ width: '100%', height: top_img_height }" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image>
4 <hager-box class="box-n"> 4 <hager-box class="box-n">
5 <hager-h1 title="行业解决方案" sub="Industry Solutions" style="margin: 2rem 0;"></hager-h1> 5 <hager-h1 title="行业解决方案" sub="Industry Solutions" style="margin: 2rem 0;"></hager-h1>
6 <div> 海格电气产品已广泛应用于电子产品制造业,为其供配电系统稳定、可靠的运行提供可靠保障。 </div> 6 <div> 海格电气产品已广泛应用于电子产品制造业,为其供配电系统稳定、可靠的运行提供可靠保障。 </div>
......
1 /* 1 /*
2 * @Date: 2024-08-26 10:12:56 2 * @Date: 2024-08-26 10:12:56
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-26 15:25:44 4 + * @LastEditTime: 2024-09-30 09:58:00
5 * @FilePath: /hager/vite.config.js 5 * @FilePath: /hager/vite.config.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -77,6 +77,13 @@ return defineConfig({ ...@@ -77,6 +77,13 @@ return defineConfig({
77 // mainFields: [''], // package.json 中,在解析包的入口点时尝试的字段列表。注意,这比从 exports 字段解析的情景导出优先级低:如果一个入口点从 exports 成功解析,主字段将被忽略。 77 // mainFields: [''], // package.json 中,在解析包的入口点时尝试的字段列表。注意,这比从 exports 字段解析的情景导出优先级低:如果一个入口点从 exports 成功解析,主字段将被忽略。
78 extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], // 导入时想要省略的扩展名列表。注意,不 建议忽略自定义导入类型的扩展名(例如:.vue),因为它会干扰 IDE 和类型支持。 78 extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], // 导入时想要省略的扩展名列表。注意,不 建议忽略自定义导入类型的扩展名(例如:.vue),因为它会干扰 IDE 和类型支持。
79 }, 79 },
80 + css: {
81 + preprocessorOptions: {
82 + less: {
83 + additionalData: `@import "@/styles/variables.less";`, // 自动导入变量文件
84 + },
85 + },
86 + },
80 logLevel: 'info', // 调整控制台输出的级别,默认为 'info'。 87 logLevel: 'info', // 调整控制台输出的级别,默认为 'info'。
81 // clearScreen: true, // 设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息。命令行模式下请通过 --clearScreen false 设置。 88 // clearScreen: true, // 设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息。命令行模式下请通过 --clearScreen false 设置。
82 server: { 89 server: {
......