titleHead.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="head_contain" :style="{'background': isBackThemeColor ? backgorundThemeColor || '#F1F5F9' : '#fff'}">
  3. <!-- <view class="safeArea" style="height: 58rpx;"></view> -->
  4. <!-- background-color: #3CD9D9 -->
  5. <!-- :style="`height: ${iStatusBarHeight + 'px'};`" -->
  6. <view class="safeArea" :style="`background: ${areaColor}`"></view>
  7. <view class="head_content" :style="{'background':themeColor}">
  8. <view v-if="isShowBack" style="width: 60rpx;height: 60rpx;display: flex;margin-left: 30rpx;align-items: center;" @click="back">
  9. <image src="../static/zancun/ic_arrow_back_im_3x.png" style="width: 21rpx;height: 35rpx;"></image>
  10. </view>
  11. <view v-if="isShowleftTitle" style="height: 60rpx;display: flex;margin-left: 30rpx;align-items: center;">
  12. <text style="font-size: 28rpx;font-family: FontName, FontName-Regular;font-weight: 400;text-align: left;color: #383838;">{{leftTitle}}</text>
  13. </view>
  14. <view v-if="isShowZhuomian" style="height: 60rpx;display: flex;margin-left: 30rpx; align-items: center;" @click="showDetail">
  15. <image src="../static/icons/icon_change@2x.png" style="width: 24rpx;height: 24rpx;"></image>
  16. <text style="margin-left: 5rpx;font-size: 24rpx;font-family: Verdana, Verdana-Regular;font-weight: 400;text-align: center;color: #333333;">{{leftDesc}}</text>
  17. </view>
  18. <view @click="toSelect" style="position: absolute;left: 50%;transform: translateX(-50%); display: flex;width: 390rpx;justify-content: center;align-items: center;">
  19. <view class="title_str" :style="`color: ${titleColor ? titleColor : '#000'};`">{{title}}</view>
  20. <image v-if="isShowDown" src="../static/icons/icon_drop@2x.png" style="width: 30rpx;height: 30rpx; min-width: 30rpx; min-height: 30rpx;margin-left: 10rpx; margin-top: 0rpx;" mode=""></image>
  21. </view>
  22. <view v-if="isShowRightTitle" style="height: 60rpx;display: flex;margin-left: calc(100% - 280rpx);align-items: center;" @click="rightAction">
  23. <text style="opacity: 0.5;font-size: 26rpx;font-family: Verdana, Verdana-Regular;font-weight: 400;text-align: left;color: #383838;">{{rightTitle}}</text>
  24. </view>
  25. <view v-if="isShowShare" class="title_icon" @click="tograb">{{rightDesc}}</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. title: String,
  33. isShowShare: Boolean,
  34. isShowZhuomian: Boolean,
  35. isShowBack: Boolean,
  36. themeColor: String,
  37. leftDesc: String,
  38. isTabbarPage: Boolean,
  39. rightDesc: {
  40. type: String,
  41. default: '分享'
  42. },
  43. isShowDown:Boolean,
  44. iStatusBarHeight: 20,
  45. isBackThemeColor: {
  46. type: Boolean,
  47. default: false
  48. },
  49. areaColor: {
  50. type: String,
  51. default: ''
  52. },
  53. titleColor: {
  54. type: String,
  55. default: ''
  56. },
  57. isShowleftTitle: {
  58. type: Boolean,
  59. default: false
  60. },
  61. leftTitle: {
  62. type: String,
  63. default: '实时天眼'
  64. },
  65. isShowRightTitle: {
  66. type: Boolean,
  67. default: false
  68. },
  69. rightTitle: {
  70. type: String,
  71. default: '提醒设置'
  72. }
  73. },
  74. data() {
  75. return {
  76. backgorundThemeColor: ''
  77. };
  78. },
  79. mounted() {
  80. this.backgorundThemeColor = getApp().globalData.backgorundThemeColor;
  81. // var tempStatusHeight = uni.getStorageSync('iStatusBarHeight')
  82. // if (tempStatusHeight) {
  83. // this.iStatusBarHeight = tempStatusHeight
  84. // }
  85. // else {
  86. // this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight || 44
  87. // uni.setStorageSync('iStatusBarHeight', this.iStatusBarHeight)
  88. // }
  89. // if (this.iStatusBarHeight == 0 || this.iStatusBarHeight == null) {
  90. // this.iStatusBarHeight = 20
  91. // }
  92. // this.iStatusBarHeight = JSON.stringify(uni.getSystemInfoSync().statusBarHeight || 44) + 'px'
  93. // this.$forceUpdate()
  94. // uni.showModal({
  95. // content: JSON.stringify(this.iStatusBarHeight)
  96. // })
  97. },
  98. methods: {
  99. tograb() {
  100. this.$emit('share', '')
  101. },
  102. showDetail(){
  103. this.$emit('showDetail',"")
  104. },
  105. toSelect(){
  106. this.$emit('toSelect',"")
  107. },
  108. rightAction() {
  109. this.$emit('rightAction')
  110. }
  111. },
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. .head_contain {
  116. width: 100%;
  117. display: flex;
  118. flex-direction: column;
  119. .safeArea {
  120. margin-top: 0;
  121. height: 44px;
  122. }
  123. @media screen and (max-height: 736px) {
  124. .safeArea {
  125. margin-top: 0;
  126. height: 20px;
  127. }
  128. }
  129. .head_content {
  130. margin-top: 0;
  131. width: 100%;
  132. height: 88rpx;
  133. display: flex;
  134. flex-direction: row;
  135. position: relative;
  136. align-items: center;
  137. }
  138. .title_str {
  139. text-align: center;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. font-size: 34rpx;
  144. font-family: Verdana, "Verdana-Bold";
  145. font-weight: 700;
  146. color: #000000;
  147. }
  148. .title_icon {
  149. height: 88rpx;
  150. position: absolute;
  151. right: 20rpx;
  152. text-align: center;
  153. font-size: 23rpx;
  154. text-align: center;
  155. }
  156. }
  157. </style>