index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-01-16 13:56:57
  6. * @Description: file content
  7. * @FilePath: \opms\pages\schedule\index.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" v-if="showBack" @click="$refs.manage.back()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>日程</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <view class="tabs">
  23. <u-tabs
  24. @change="changeTabs"
  25. lineWidth="8"
  26. :current="curTabIndex"
  27. lineHeight="8"
  28. :scrollable="false"
  29. :list="list"
  30. :lineColor="`url(${lineBg}) 100% 100%`"
  31. :activeStyle="{
  32. color: '#3E7EF8',
  33. fontWeight: 'bold',
  34. }"
  35. :inactiveStyle="{
  36. color: '#969696',
  37. }"
  38. itemStyle="height: 90rpx;"></u-tabs>
  39. </view>
  40. <view class="content">
  41. <manage v-if="curTabIndex === 0" ref="manage" @setBackVisible="initBack()" />
  42. <supervise v-else-if="curTabIndex === 1" ref="supervise" />
  43. <log v-else-if="curTabIndex === 2" ref="log" />
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import manage from './manage'
  50. import supervise from './supervise'
  51. import log from './log'
  52. export default {
  53. name: 'opsIndex',
  54. components: { manage, supervise, log },
  55. data() {
  56. return {
  57. lineBg: require('../../static/images/up.png'),
  58. showBack: false,
  59. height: '',
  60. paddingTop: '',
  61. curTabIndex: 0,
  62. list: [
  63. {
  64. name: '日程管理',
  65. index: 0,
  66. },
  67. {
  68. name: '督办事项',
  69. index: 1,
  70. },
  71. {
  72. name: '工作日志',
  73. index: 2,
  74. },
  75. ],
  76. }
  77. },
  78. onLoad(option) {
  79. if (option && option.type) {
  80. this.curTabIndex = parseInt(option.type)
  81. }
  82. },
  83. onHide() {
  84. this.curTabIndex = 0
  85. },
  86. created() {
  87. const navData = uni.getMenuButtonBoundingClientRect()
  88. this.height = navData.height + 'px'
  89. this.paddingTop = navData.top + 'px'
  90. },
  91. methods: {
  92. // 显示返回
  93. initBack(visible) {
  94. this.showBack = visible
  95. },
  96. // 改变tab
  97. changeTabs(data) {
  98. // console.log(data)
  99. this.curTabIndex = data.index
  100. },
  101. },
  102. }
  103. </script>
  104. <style>
  105. page {
  106. background: #f2f3f5;
  107. }
  108. </style>
  109. <style lang="scss" scoped>
  110. .home {
  111. padding-top: 188rpx;
  112. .nav {
  113. position: absolute;
  114. left: 0;
  115. top: 0;
  116. width: 100%;
  117. height: 284rpx;
  118. background: #3e7ef8;
  119. .title {
  120. position: relative;
  121. text-align: center;
  122. font-size: 32rpx;
  123. font-weight: bold;
  124. color: #ffffff;
  125. .back {
  126. position: absolute;
  127. top: 0;
  128. bottom: 0;
  129. margin: auto;
  130. left: 70rpx;
  131. display: flex;
  132. }
  133. }
  134. }
  135. .main {
  136. position: absolute;
  137. width: 100%;
  138. height: calc(100vh - 188rpx);
  139. background: #ffffff;
  140. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  141. border-radius: 31rpx 31rpx 0 0;
  142. padding: 0 32rpx;
  143. // overflow: auto;
  144. padding-bottom: 64rpx;
  145. .tabs {
  146. border-bottom: 1px solid #cdcdcd;
  147. padding-bottom: 4rpx;
  148. }
  149. }
  150. }
  151. </style>