index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view :class="divClass">
  3. <view class="ph">
  4. <view v-if="isBack" class="ph-img" @tap="backClick()">
  5. <image v-if="backIcon == 'back'" mode="widthFix" src="./img/back_brown.png"></image>
  6. <image v-if="backIcon == 'white'" mode="widthFix" src="./img/while_brown.png"></image>
  7. </view>
  8. <view class="ph-title" :style="titleStyle">{{title}}</view>
  9. <view class="ph-right fx-r fx-bc" v-if="isRenwu" @click="intoTaskListClick()">
  10. <image src="./img/liebiao.png"></image>
  11. <view class="phr-name">任务列表</view>
  12. </view>
  13. <view class="ph-right fx-r fx-bc" v-if="isSearch" @click="intoSearchClick()">
  14. <image src="/static/img/search_black.png"></image>
  15. <view class="phr-name"></view>
  16. </view>
  17. <slot></slot>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import {mapState,mapMutations} from 'vuex';
  23. export default {
  24. computed: mapState(['user']),
  25. name: 'index',
  26. props: {
  27. title: {
  28. type: String,
  29. default: "辣物"
  30. },
  31. backIcon: {
  32. type: String,
  33. default: "back"
  34. },
  35. divClass: {
  36. type: String,
  37. default: "page-header"
  38. },
  39. titleStyle: {
  40. type: String,
  41. default: ""
  42. },
  43. isBack: {
  44. type: Boolean,
  45. default: false
  46. },
  47. isRenwu: {
  48. type: Boolean,
  49. default: false
  50. },
  51. isSearch:{
  52. type: Boolean,
  53. default: false
  54. }
  55. },
  56. data() {
  57. return {
  58. }
  59. },
  60. mounted() {
  61. },
  62. methods: {
  63. backClick() {
  64. uni.navigateBack({
  65. delta: 1,
  66. })
  67. },
  68. intoTaskListClick() {
  69. this.$emit('onTask',{});
  70. },
  71. intoSearchClick:function(){
  72. this.$emit('onSearch',{});
  73. }
  74. }
  75. };
  76. </script>
  77. <style>
  78. .page-header {
  79. background: #fff;
  80. z-index: 999999;
  81. position: fixed;
  82. left: 0;
  83. right: 0;
  84. box-sizing: border-box;
  85. }
  86. .ph {
  87. padding: 44px 15px 0px;
  88. height: 46px;
  89. display: flex;
  90. align-items: center;
  91. }
  92. .ph-img {
  93. width: 30px;
  94. height: 30px;
  95. line-height: 30px;
  96. text-align: center;
  97. position: absolute;
  98. z-index: 99;
  99. }
  100. .ph-img image {
  101. width: 10px;
  102. height: 10px;
  103. }
  104. .ph-title {
  105. width: calc(100% - 44px);
  106. height: 46px;
  107. line-height: 46px;
  108. text-align: center;
  109. color: #3F3E3E;
  110. font-size: 18px;
  111. font-weight: 600;
  112. position: absolute;
  113. }
  114. .ph-right {
  115. margin-left: auto;
  116. position: absolute;
  117. right: 15px;
  118. text-align: center;
  119. color: #333;
  120. }
  121. .ph-right image {
  122. width: 14px;
  123. height: 14px;
  124. }
  125. .phr-name {
  126. color: #3F3E3E;
  127. font-size: 14px;
  128. margin-left: 4px;
  129. }
  130. </style>