Commit f7af1bcb5936188792145e0884431af80174adcc

Authored by 杨泽宇
1 parent e65b2377

menu style

Showing 1 changed file with 197 additions and 5 deletions
src/views/user/cnlive_login.vue
... ... @@ -94,6 +94,20 @@ const handleCommand = (data: any) => {
94 94 router.push({ path: "/" });
95 95 }
96 96 };
  97 +// 鼠标移入移出菜单效果
  98 +const handleMouseEnter = (ele) => {
  99 + if (ele.target.childNodes[1].classList) {
  100 + ele.target.childNodes[1].classList.add("animated-fast");
  101 + ele.target.childNodes[1].classList.add("fadeInUpMenu");
  102 + ele.target.childNodes[1].style.display = "block";
  103 + }
  104 +};
  105 +const handleMouseLeave = (ele) => {
  106 + if (ele.target.childNodes[1].classList) {
  107 + ele.target.childNodes[1].classList = ["dropdown"];
  108 + ele.target.childNodes[1].style.display = "none";
  109 + }
  110 +};
97 111 onMounted(() => {
98 112 window.localStorage.setItem("isCnlive", true);
99 113 fetch("http://systk.cnlive.com/ocms/.content/function_provider/menu.json", {
... ... @@ -101,6 +115,7 @@ onMounted(() => {
101 115 })
102 116 .then((data) => data.json())
103 117 .then((res) => {
  118 + console.log(res);
104 119 menu.data = res?.menu;
105 120 });
106 121 });
... ... @@ -114,6 +129,7 @@ onMounted(() => {
114 129 <div id="gtco-logo">
115 130 <a href="http://cnlive.com/">
116 131 <img
  132 + height="72"
117 133 src="https://cnlive-resweb.ks3-cn-beijing.ksyuncs.com/sites/cnlive_web/new-images/logo.png"
118 134 alt=""
119 135 />
... ... @@ -121,10 +137,14 @@ onMounted(() =&gt; {
121 137 </div>
122 138  
123 139 <div class="cnlive-list">
124   - <template v-for="(item, index) in menu.data" :key="index">
  140 + <!-- <template v-for="(item, index) in menu.data" :key="index">
125 141 <el-dropdown
126 142 v-if="item.children.length"
127 143 @command="handleCommand"
  144 + @mouseenter="handleMouseEnter"
  145 + @mouseleave="handleMouseLeave"
  146 + :show-timeout="500"
  147 + :hide-timeout="500"
128 148 >
129 149 <span>
130 150 {{ item.title }}
... ... @@ -133,6 +153,7 @@ onMounted(() =&gt; {
133 153 <template #dropdown v-if="item.children.length">
134 154 <el-dropdown-menu v-if="item.children.length">
135 155 <el-dropdown-item
  156 + class="cnlive-dropdown-item"
136 157 v-for="(ele, i) in item.children"
137 158 :key="i"
138 159 :command="ele.url"
... ... @@ -142,7 +163,29 @@ onMounted(() =&gt; {
142 163 </template>
143 164 </el-dropdown>
144 165 <span class="cnlive-single-menu" v-else><a :href="item.url? item.url: '/'">{{item.title}}</a></span>
145   - </template>
  166 + </template> -->
  167 + <div class="text-left menu-1">
  168 + <ul>
  169 + <li
  170 + class="has-dropdown"
  171 + @mouseenter="handleMouseEnter"
  172 + @mouseleave="handleMouseLeave"
  173 + v-for="(item, index) in menu.data"
  174 + :key="index"
  175 + >
  176 + <div class="button fadeInUpMenu">
  177 + <a :href="item.url ? item.url : '/'"
  178 + ><span>{{ item.title }}</span></a
  179 + >
  180 + </div>
  181 + <ul class="dropdown" v-if="item.children.length">
  182 + <li v-for="(ele, i) in item.children" :key="i">
  183 + <a :href="ele.url ? ele.url : '/'">{{ ele.title }}</a>
  184 + </li>
  185 + </ul>
  186 + </li>
  187 + </ul>
  188 + </div>
146 189 </div>
147 190  
148 191 <div class="cnlive-download">
... ... @@ -230,12 +273,15 @@ onMounted(() =&gt; {
230 273 <p>
231 274 网家家APP、Cnlive.com 《信息网络传播视听节目许可证》、许可证号:0105123
232 275 </p>
233   - <p>京ICP证090477号、京ICP备11041453号-1、京公网安备11010802024488号、联系电话:010-65832485</p>
  276 + <p>
  277 + 京ICP证090477号、京ICP备11041453号-1、京公网安备11010802024488号、联系电话:010-65832485
  278 + </p>
234 279 </div>
235 280 </div>
236 281 </template>
237 282  
238 283 <style lang="scss">
  284 +@import "https://ks3-cn-beijing.ksyuncs.com/cnlive-resweb/sites/cnlive_web/css/animate.css";
239 285 .cnlive {
240 286 background-color: #f6f7f9;
241 287 &-nav {
... ... @@ -264,8 +310,10 @@ onMounted(() =&gt; {
264 310 }
265 311 .cnlive-list {
266 312 float: left;
  313 + letter-spacing: 1px;
267 314 margin-top: 20px;
268   - font-weight: 800;
  315 + margin-left: 20px;
  316 + // font-weight: 800;
269 317 .el-dropdown {
270 318 margin-left: 60px;
271 319 font-size: 20px;
... ... @@ -280,7 +328,8 @@ onMounted(() =&gt; {
280 328 text-align: center;
281 329 font-size: 18px;
282 330 padding: 0;
283   - color: white;
  331 + letter-spacing: 1px;
  332 + color: white!important;
284 333 line-height: 46px;
285 334 background-color: #f5a623;
286 335 border-radius: 24px;
... ... @@ -366,6 +415,15 @@ onMounted(() =&gt; {
366 415 position: absolute;
367 416 }
368 417 }
  418 +.gold-color {
  419 + span {
  420 + color: #f5a623;
  421 + }
  422 +}
  423 +.cnlive-dropdown-item {
  424 + width: 160px;
  425 + text-align: center;
  426 +}
369 427 .clearfix {
370 428 zoom: 1;
371 429 }
... ... @@ -373,3 +431,137 @@ onMounted(() =&gt; {
373 431 text-align: left;
374 432 }
375 433 </style>
  434 +
  435 +<style lang="scss" scoped>
  436 +a {
  437 + text-decoration: none;
  438 + // color: #000;
  439 + // *color: #3a3a3a;
  440 + outline: none;
  441 +}
  442 +* {
  443 + -webkit-box-sizing: border-box;
  444 + -moz-box-sizing: border-box;
  445 + box-sizing: border-box;
  446 +}
  447 +.clearfix {
  448 + zoom: 1;
  449 +}
  450 +.clearfix:after {
  451 + display: block;
  452 + content: "clear";
  453 + clear: both;
  454 + line-height: 0;
  455 + visibility: hidden;
  456 +}
  457 +html,
  458 +body {
  459 + background: #f6f7f9;
  460 + min-width: 1346px;
  461 + letter-spacing: 1px;
  462 + font-family: 微软雅黑, "Droid Sans", Arial, sans-serif;
  463 +}
  464 +.gtco-nav .menu-1 {
  465 + float: left;
  466 +}
  467 +.gtco-nav ul li.has-dropdown .dropdown:before {
  468 + bottom: 100%;
  469 + left: 50%;
  470 + border: solid transparent;
  471 + content: " ";
  472 + position: absolute;
  473 + border-width: 8px;
  474 + margin-left: -10px;
  475 + background: url(https://cnlive-resweb.ks3-cn-beijing.ksyuncs.com/sites/cnlive_web/new-images/top-jian.jpg)
  476 + center -2px no-repeat;
  477 + background-size: 20px 12px;
  478 +}
  479 +.gtco-nav ul {
  480 + padding: 0;
  481 + margin: 0;
  482 + list-style: none;
  483 + display: inline;
  484 +}
  485 +.gtco-nav .menu-1 ul li {
  486 + float: left;
  487 + margin-left: 60px;
  488 + position: relative;
  489 +}
  490 +.gtco-nav .menu-1 ul li a {
  491 + color: #333333;
  492 + font-size: 20px;
  493 + // font-weight: bold;
  494 +}
  495 +.gtco-nav .menu-1 ul li.has-dropdown:hover a,
  496 +.gtco-nav .menu-1 ul li.has-dropdown:focus a {
  497 + color: #f5a623;
  498 +}
  499 +.gtco-nav .menu-1 ul li.has-dropdown .button a {
  500 + padding-bottom: 55px;
  501 + padding-right: 20px;
  502 + // padding: 14px 10px;
  503 +}
  504 +.gtco-nav .menu-1 ul li.has-dropdown .dropdown {
  505 + border: 1px solid #ccc;
  506 + width: 160px;
  507 + z-index: 1002;
  508 + // visibility: hidden;
  509 + // opacity: 0;
  510 + position: absolute;
  511 + display: none;
  512 + top: 45px;
  513 + left: -26px;
  514 + text-align: left;
  515 + -webkit-transition: 0s;
  516 + -o-transition: 0s;
  517 + transition: 0s;
  518 + padding: 10px 0;
  519 + margin: 5px 0;
  520 + border: 1px solid #ebeef5;
  521 + border-radius: 4px;
  522 + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  523 + background: #fff;
  524 +}
  525 +.gtco-nav .menu-1 ul li.has-dropdown .dropdown li {
  526 + margin: 0;
  527 + width: 100%;
  528 + text-align: center;
  529 + line-height: 53px;
  530 + height: 53px;
  531 +}
  532 +.gtco-nav .menu-1 ul li.has-dropdown .dropdown li a {
  533 + color: #333;
  534 + font-size: 18px;
  535 + height: 53px;
  536 + line-height: 53px;
  537 + display: block;
  538 + font-weight: normal;
  539 +}
  540 +.gtco-nav .menu-1 ul li.has-dropdown .dropdown li a:hover {
  541 + background: #ecf5ff;
  542 + color: #66b1ff;
  543 +}
  544 +.gtco-nav .menu-1 ul li.has-dropdown:nth-child(1) .dropdown,
  545 +.gtco-nav .menu-1 ul li.has-dropdown:nth-child(2) .dropdown {
  546 + left: -8px;
  547 +}
  548 +/**注册**/
  549 +@keyframes fadeInUpMenu {
  550 + from {
  551 + opacity: 0;
  552 + visibility: hidden;
  553 + -webkit-transform: translate3d(0, 20px, 0);
  554 + transform: translate3d(0, 20px, 0);
  555 + }
  556 + to {
  557 + visibility: visible;
  558 + opacity: 1;
  559 + -webkit-transform: none;
  560 + transform: none;
  561 + }
  562 +}
  563 +.fadeInUpMenu {
  564 + -webkit-animation-name: fadeInUpMenu;
  565 + animation-name: fadeInUpMenu;
  566 +}
  567 +</style>
... ...