酷炫直播运营系统小程序版本

page-head.vue 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template name="page-head">
  2. <view class="topBar" :class="bg_jb?'bg_jb':''" :style="'padding-top:'+buttonTop+'px;height:'+statusNavBarHeight+'px;color:'+color">
  3. <slot v-if="slotFlag"></slot>
  4. <template v-else>
  5. <view class="back" :style="'height:'+buttonHeight+'px'" v-if="isBack" @click="back">
  6. </view>
  7. <text class="topBar_title" :style="'top:'+buttonTop+'px;line-height:'+buttonHeight+'px'">{{title}}</text>
  8. </template>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name:"page-head",
  14. props: {
  15. title: {
  16. type: String,
  17. default: "问星数据 - 抖音版"
  18. },
  19. background:{
  20. type:String,
  21. default:"#f2f2f2"
  22. },
  23. color:{
  24. type:String,
  25. default:"#666666"
  26. },
  27. isBack:{
  28. type:Boolean,
  29. default:false
  30. },
  31. slotFlag:{
  32. type:Boolean,
  33. default:false
  34. },
  35. bg_jb:{
  36. type:Boolean,
  37. default:false
  38. }
  39. },
  40. data() {
  41. return {
  42. buttonTop:this.$store.state.systemInfo.safeAreaInsets.top,
  43. statusNavBarHeight:this.$store.state.systemInfo.safeAreaTop,
  44. buttonHeight:this.$store.state.systemInfo.statusBarHeight,
  45. };
  46. },
  47. methods:{
  48. back(){
  49. let pages = getCurrentPages(); //页面对象
  50. let prevpage = pages[pages.length - 2];
  51. if(prevpage) {
  52. uni.navigateBack()
  53. }else {
  54. uni.redirectTo({
  55. url:'../pages/index/index?page=homePage'
  56. })
  57. }
  58. }
  59. }
  60. }
  61. </script>
  62. <style>
  63. .topBar{
  64. position: fixed;
  65. left: 0;
  66. top: 0rpx;
  67. width: 100%;
  68. height: var(--status-bar-height);;
  69. color: #FFFFFF;
  70. z-index: 999;
  71. box-sizing: border-box;
  72. background: #333947;
  73. }
  74. .bg_jb{
  75. background: linear-gradient(180deg, #27282F 0%, #585C6D 100%);
  76. }
  77. .topBar_title{
  78. font-size: 32rpx;
  79. line-height: 44rpx;
  80. position: absolute;
  81. width: 50%;
  82. left: 0;
  83. right: 0;
  84. margin:auto;
  85. text-align: center;
  86. }
  87. .back {
  88. width: 80rpx;
  89. height: 40rpx;
  90. margin-left: 10rpx;
  91. position: relative;
  92. }
  93. .back_image{
  94. width: 34rpx;
  95. height: 34rpx;
  96. position: absolute;
  97. top: 50%;
  98. transform: translateY(-50%);
  99. }
  100. </style>