Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="nav-bar" :class="scrollTop>navHeight?'nav-bg':''" :style="{height:navHeight+'px'}">
  3. <view class="title"
  4. :style="{paddingTop:searchMarginTop+'px',height:searchHeight+'px',lineHeight:searchHeight+'px'}">
  5. <block v-if="isBack && !isAlipay">
  6. <image :src="`/static/image/icon-back.png`" :style="{height:searchHeight+'px',width:searchHeight+'px'}"
  7. class="back" @click="back(title,type)"></image>
  8. </block>
  9. <text>{{title}}</text>
  10. </view>
  11. </view>
  12. <view class="blank" :style="{height:navHeight+'px'}"></view>
  13. </template>
  14. <script setup lang="ts">
  15. import { msg } from "@/utils/utils";
  16. import {
  17. onMounted,
  18. ref
  19. } from "vue";
  20. const navHeight = ref(0)
  21. const searchMarginTop = ref(0)
  22. const searchHeight = ref(0)
  23. const searchWidth = ref(0)
  24. const isAlipay = ref(false)
  25. onMounted(() => {
  26. const type = uni.getSystemInfoSync().uniPlatform
  27. isAlipay.value = type === 'mp-alipay'
  28. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  29. const {
  30. top,
  31. width,
  32. height,
  33. right
  34. } = menuButtonInfo
  35. uni.getSystemInfo({
  36. success: (res) => {
  37. const {
  38. statusBarHeight
  39. } = res
  40. const margin = top - statusBarHeight
  41. navHeight.value = (height + statusBarHeight + (margin * 2)) //导航栏总高
  42. searchMarginTop.value = statusBarHeight + margin // 状态栏 + 胶囊按钮边距
  43. searchHeight.value = height // 与胶囊按钮同高
  44. searchWidth.value = right - width // 胶囊按钮右边坐标 - 胶囊按钮宽度 = 按钮左边可使用宽度
  45. },
  46. })
  47. })
  48. const props = defineProps({
  49. title: {
  50. type: String,
  51. default: ''
  52. },
  53. type: {
  54. type: String,
  55. default: ''
  56. },
  57. isBack: {
  58. type: Boolean,
  59. default: true
  60. },
  61. scrollTop: {
  62. type: Number,
  63. default: 0
  64. }
  65. })
  66. const back = (title, type) => {
  67. console.log("555555555", title, type)
  68. if (title == "九州ETC" && type) {
  69. uni.redirectTo({
  70. url: `/subpackage/orders/choice-product?type=${type}`
  71. })
  72. } else if (title == "ETC开户新办申请-个人" || title == "ETC开户新办申请-单位" || title == "行驶证信息上传" || title == "微信车主服务" || title == "加购权益产品" || title == "产品详情" || title == "支付账户签约") {
  73. uni.showModal({
  74. content: '当前ETC正在办理中,中断后续可在订单管理中继续办理。',
  75. success: function (res) {
  76. if (res.confirm) {
  77. uni.switchTab({
  78. url: "/pages/order/order"
  79. })
  80. } else if (res.cancel) {
  81. console.log('用户点击取消');
  82. }
  83. }
  84. });
  85. } else {
  86. uni.navigateBack({
  87. delta: 1
  88. })
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .nav-bg {
  94. background: linear-gradient(to right, #13E7C1, #43A1E0);
  95. }
  96. .blank {
  97. width: 100%;
  98. display: none;
  99. }
  100. .nav-bar {
  101. /* background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%); */
  102. position: fixed;
  103. width: 100%;
  104. z-index: 999;
  105. }
  106. .nav-bar .title {
  107. text-align: center;
  108. width: 100%;
  109. font-size: 28rpx;
  110. font-weight: bold;
  111. position: relative;
  112. }
  113. .back {
  114. position: absolute;
  115. left: 10rpx;
  116. }
  117. </style>