es-nav-title.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view>
  3. <block v-if="mode=='cover'">
  4. <cover-view class="es-fix-top">
  5. <cover-view class="top-img"></cover-view>
  6. <cover-view class="top-close flex x-ac" >
  7. <cover-image @tap="close" class="es-w-18 es-h-31" src="/static/images/other/ret-white.png" ></cover-image>
  8. <cover-view @tap="close" class="es-fw-500 es-c-white es-fs-30 ">返回</cover-view>
  9. </cover-view>
  10. <cover-view class="es-h-88"></cover-view>
  11. <es-top></es-top>
  12. </cover-view>
  13. </block>
  14. <block v-else-if="mode=='fav'">
  15. <cover-view class="es-fix-top">
  16. <!-- <cover-image class="top-img" src="/static/image/home/home_top_bg.png"></cover-image> -->
  17. <cover-view class="top-img"></cover-view>
  18. <cover-view class="top-close flex x-ac" >
  19. <cover-image @tap="close" class="es-w-18 es-h-31" src="/static/images/other/ret-white.png" ></cover-image>
  20. <cover-view @tap="close" class="es-fw-500 es-c-white es-fs-30 ">返回</cover-view>
  21. </cover-view>
  22. <cover-view class="es-h-88" ></cover-view>
  23. <es-top></es-top>
  24. </cover-view>
  25. </block>
  26. <block v-else>
  27. <view class="es-fix-top">
  28. <cover-view class="top-img1" ></cover-view>
  29. <es-top></es-top>
  30. <es-nav-title-base :title="title" :left="left"></es-nav-title-base>
  31. </view>
  32. </block>
  33. <block v-if="bg!='none'">
  34. <es-top></es-top>
  35. <view class="es-h-88"></view>
  36. </block>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. name: "es-nav-title",
  42. data() {
  43. return {
  44. top_color: 'rgba(0,0,0,0)',
  45. h:44,
  46. };
  47. },
  48. props: [
  49. 'title', 'bg', 'left', 'mode'
  50. ],
  51. created: function() {
  52. },
  53. methods: {
  54. close: function() {
  55. const pages = getCurrentPages();
  56. const currentPageIndex = pages.length - 1; // 当前页面的索引
  57. const targetPageIndex = 1; // 假设要返回到首页(页面 A)
  58. // 计算需要返回的层数
  59. const delta = currentPageIndex - targetPageIndex;
  60. console.log("qxj dalta:"+delta);
  61. uni.navigateBack({
  62. delta: delta,
  63. animationType: 'pop-out',
  64. animationDuration: 200
  65. });
  66. },
  67. scrollBody:function(e){
  68. let top = e.scrollTop / this.h;
  69. this.top_color = 'rgba(255,92,3, ' + top + ')';
  70. }
  71. }
  72. }
  73. </script>
  74. <style>
  75. .es-fix-top {
  76. font-weight: 620;
  77. font-family: PingFang SC;
  78. color: white;
  79. z-index: 1000;
  80. position: fixed;
  81. /* background-size: 100% auto;
  82. background-repeat: no-repeat; */
  83. }
  84. .es-h-88 {
  85. height: 44px;
  86. }
  87. .top-img {
  88. width: 100%;
  89. height: 500rpx;
  90. position: absolute;
  91. background: #FF5C03;
  92. }
  93. .top-img1 {
  94. width:100%;
  95. height: var(--status-bar-height);
  96. position: absolute;
  97. overflow: hidden;
  98. background: #fff;
  99. }
  100. .top-close {
  101. left: 30rpx;
  102. position: absolute;
  103. bottom: 0rpx;
  104. width: 100rpx;
  105. height: 80rpx;
  106. }
  107. .title-box{
  108. left: 0rpx;
  109. position: absolute;
  110. top: 0rpx;
  111. right: 130rpx;
  112. height: 80rpx;
  113. }
  114. .navTitle{
  115. left: calc(50% - 80rpx);
  116. top:10rpx;
  117. position: absolute;
  118. width: 80rpx;
  119. height: 70rpx;
  120. line-height: 70rpx;
  121. color: #fff;
  122. font-size: 30rpx;
  123. font-weight: 500;
  124. }
  125. </style>