index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="web-header snow_is_show">
  3. <!-- 首页 -->
  4. <view class="header-borer snow_is_show flex r_flex_space">
  5. <view class="r_flex_space r_wzjc" @click="onTargetPage(0)">
  6. <img
  7. class="logo-img"
  8. src="/static/background/gs-logo-z.png"
  9. style="width: 28rpx; height: 28rpx; margin: 5rpx"
  10. />
  11. 海南省信息通信有限公司
  12. </view>
  13. <view class="r_flex_space snow_is_show header-right">
  14. <view
  15. class="nav-list r_transform3 r_cursor"
  16. :class="routeName == 'pages/web/home/index' ? 'avtive' : ''"
  17. @click="onTargetPage('pages/web/home/index')"
  18. >
  19. 首页
  20. </view>
  21. <view
  22. class="nav-list r_transform3 r_cursor"
  23. :class="routeName == 'pages/web/product/index' ? 'avtive' : ''"
  24. @click="onTargetPage('pages/web/product/index')"
  25. >
  26. 产品与服务
  27. </view>
  28. <view
  29. class="nav-list r_transform3 r_cursor"
  30. :class="routeName == 'pages/web/dynamic/index' ? 'avtive' : ''"
  31. @click="onTargetPage('pages/web/dynamic/index')"
  32. >
  33. 最新动态
  34. </view>
  35. <view
  36. class="nav-list r_transform3 r_cursor"
  37. :class="routeName == 'pages/web/about/index' ? 'avtive' : ''"
  38. @click="onTargetPage('pages/web/about/index')"
  39. >
  40. 关于我们
  41. </view>
  42. <view
  43. class="nav-list r_transform3 r_cursor"
  44. :class="routeName == 'pages/web/contact/index' ? 'avtive' : ''"
  45. @click="onTargetPage('pages/web/contact/index')"
  46. >
  47. 联系我们
  48. </view>
  49. <view
  50. class="nav-long r_flex_center r_cursor"
  51. @click="
  52. () => {
  53. $toast('暂未开通');
  54. }
  55. "
  56. >
  57. 登录
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import { getTabBarLinks } from "@/core/app";
  65. export default {
  66. /**
  67. * 组件的属性列表
  68. * 用于组件自定义设置
  69. */
  70. props: {
  71. right: {
  72. type: Number,
  73. default: 30,
  74. },
  75. bottom: {
  76. type: Number,
  77. default: 100,
  78. },
  79. },
  80. data() {
  81. return {
  82. // 弹窗显示控制
  83. isShow: false,
  84. transparent: true,
  85. routeName: "",
  86. };
  87. },
  88. computed: {
  89. rightPx() {
  90. return uni.upx2px(this.right);
  91. },
  92. bottomPx() {
  93. return uni.upx2px(this.bottom);
  94. },
  95. },
  96. onLoad(options) {
  97. // console.log("页面参数:", options);
  98. // console.log("当前路径:", this.$page.route);
  99. },
  100. mounted() {
  101. // 获取当前页面路由信息
  102. const pages = getCurrentPages();
  103. const currentPage = pages[pages.length - 1];
  104. // 获取当前页面路径
  105. const route = currentPage.route;
  106. this.routeName = route;
  107. // 检查是否有自定义属性
  108. const checkHasAttribute = (element) => {
  109. return !!element.getAttribute("snow_is_show");
  110. };
  111. const main = document.querySelectorAll(".tran>uni-view") || [];
  112. const paragraphs = [...(main || [])];
  113. paragraphs.forEach((item) => {
  114. // console.log(item, "动画遍历", item.className.includes('snow_is_show'))
  115. const observer = new IntersectionObserver((entries) => {
  116. entries.forEach((entry) => {
  117. if (entry.isIntersecting && !checkHasAttribute(item) && !item.className.includes('snow_is_show')) {
  118. // 元素进入视口
  119. item.classList.add("ld");
  120. item.classList.add("ld-float-btt-in");
  121. item.setAttribute("snow_is_show", true);
  122. }
  123. });
  124. });
  125. observer.observe(item);
  126. });
  127. },
  128. methods: {
  129. /**
  130. * 导航菜单切换事件
  131. */
  132. onToggleShow() {
  133. const app = this;
  134. app.isShow = !app.isShow;
  135. app.transparent = false;
  136. },
  137. /**
  138. * 导航页面跳转
  139. */
  140. onTargetPage(data) {
  141. if (data) {
  142. this.$navTo(data);
  143. }
  144. },
  145. },
  146. };
  147. </script>
  148. <style lang="scss" scoped>
  149. /* 快捷导航 */
  150. .shortcut {
  151. position: fixed;
  152. right: calc(var(--window-right) + var(--right));
  153. bottom: calc(var(--window-bottom) + var(--bottom));
  154. width: 76rpx;
  155. height: 76rpx;
  156. line-height: 1;
  157. z-index: 5;
  158. border-radius: 50%;
  159. }
  160. .avtive {
  161. color: #016fff;
  162. }
  163. .r_wzjc {
  164. font-weight: 900;
  165. }
  166. .header-borer {
  167. font-size: 11rpx;
  168. height: 35rpx;
  169. }
  170. .nav-long {
  171. font-size: 8rpx;
  172. width: 65rpx;
  173. height: 35rpx;
  174. background: #016fff;
  175. border-radius: 0px 0px 0px 0px;
  176. color: #fff;
  177. text-align: center;
  178. }
  179. .web-header {
  180. }
  181. /* 导航菜单元素 */
  182. .nav-list {
  183. padding-top: 6rpx;
  184. font-size: 11rpx;
  185. font-weight: 900;
  186. margin-right: 40rpx;
  187. &:hover {
  188. color: #016fff;
  189. }
  190. }
  191. .nav-item .iconfont {
  192. font-size: 40rpx;
  193. }
  194. /* 导航开关 */
  195. .nav-item__switch {
  196. opacity: 1;
  197. }
  198. .shortcut_click_show {
  199. margin-bottom: 0;
  200. background: #ff5454;
  201. }
  202. /* 显示动画 */
  203. .show_80 {
  204. bottom: 384rpx;
  205. animation: show_80 0.3s forwards;
  206. }
  207. .show_60 {
  208. bottom: 288rpx;
  209. animation: show_60 0.3s forwards;
  210. }
  211. .show_40 {
  212. bottom: 192rpx;
  213. animation: show_40 0.3s forwards;
  214. }
  215. .show_20 {
  216. bottom: 96rpx;
  217. animation: show_20 0.3s forwards;
  218. }
  219. @keyframes show_20 {
  220. from {
  221. bottom: 0;
  222. transform: rotate(0deg);
  223. opacity: 0;
  224. }
  225. to {
  226. bottom: 96rpx;
  227. transform: rotate(360deg);
  228. opacity: 1;
  229. }
  230. }
  231. @keyframes show_40 {
  232. from {
  233. bottom: 0;
  234. transform: rotate(0deg);
  235. opacity: 0;
  236. }
  237. to {
  238. bottom: 192rpx;
  239. transform: rotate(360deg);
  240. opacity: 1;
  241. }
  242. }
  243. @keyframes show_60 {
  244. from {
  245. bottom: 0;
  246. transform: rotate(0deg);
  247. opacity: 0;
  248. }
  249. to {
  250. bottom: 288rpx;
  251. transform: rotate(360deg);
  252. opacity: 1;
  253. }
  254. }
  255. @keyframes show_80 {
  256. from {
  257. bottom: 0;
  258. transform: rotate(0deg);
  259. opacity: 0;
  260. }
  261. to {
  262. bottom: 384rpx;
  263. transform: rotate(360deg);
  264. opacity: 1;
  265. }
  266. }
  267. /* 隐藏动画 */
  268. .hide_80 {
  269. bottom: 0;
  270. animation: hide_80 0.3s;
  271. opacity: 0;
  272. }
  273. .hide_60 {
  274. bottom: 0;
  275. animation: hide_60 0.3s;
  276. opacity: 0;
  277. }
  278. .hide_40 {
  279. bottom: 0;
  280. animation: hide_40 0.3s;
  281. opacity: 0;
  282. }
  283. .hide_20 {
  284. bottom: 0;
  285. animation: hide_20 0.3s;
  286. opacity: 0;
  287. }
  288. @keyframes hide_20 {
  289. from {
  290. bottom: 96rpx;
  291. transform: rotate(360deg);
  292. opacity: 1;
  293. }
  294. to {
  295. bottom: 0;
  296. transform: rotate(0deg);
  297. opacity: 0;
  298. }
  299. }
  300. @keyframes hide_40 {
  301. from {
  302. bottom: 192rpx;
  303. transform: rotate(360deg);
  304. opacity: 1;
  305. }
  306. to {
  307. bottom: 0;
  308. transform: rotate(0deg);
  309. opacity: 0;
  310. }
  311. }
  312. @keyframes hide_60 {
  313. from {
  314. bottom: 288rpx;
  315. transform: rotate(360deg);
  316. opacity: 1;
  317. }
  318. to {
  319. bottom: 0;
  320. transform: rotate(0deg);
  321. opacity: 0;
  322. }
  323. }
  324. @keyframes hide_80 {
  325. from {
  326. bottom: 384rpx;
  327. transform: rotate(360deg);
  328. opacity: 1;
  329. }
  330. to {
  331. bottom: 0;
  332. transform: rotate(0deg);
  333. opacity: 0;
  334. }
  335. }
  336. </style>