index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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-if="curTabIndex === 1" ref="supervise" />
  43. <log v-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. console.log(option.type) //打印出上个页面传递的参数。
  80. if (option && option.type) {
  81. this.curTabIndex = parseInt(option.type)
  82. }
  83. },
  84. onHide() {
  85. this.curTabIndex = 0
  86. },
  87. created() {
  88. const navData = uni.getMenuButtonBoundingClientRect()
  89. this.height = navData.height + 'px'
  90. this.paddingTop = navData.top + 'px'
  91. },
  92. mounted(option) {
  93. console.log(option)
  94. },
  95. methods: {
  96. // 显示返回
  97. initBack(visible) {
  98. this.showBack = visible
  99. },
  100. // 改变tab
  101. changeTabs(data) {
  102. // console.log(data)
  103. this.curTabIndex = data.index
  104. },
  105. },
  106. }
  107. </script>
  108. <style>
  109. page {
  110. background: #f2f3f5;
  111. }
  112. </style>
  113. <style lang="scss" scoped>
  114. .home {
  115. padding-top: 188rpx;
  116. .nav {
  117. position: absolute;
  118. left: 0;
  119. top: 0;
  120. width: 100%;
  121. height: 284rpx;
  122. background: #3e7ef8;
  123. .title {
  124. position: relative;
  125. text-align: center;
  126. font-size: 32rpx;
  127. font-weight: bold;
  128. color: #ffffff;
  129. .back {
  130. position: absolute;
  131. top: 0;
  132. bottom: 0;
  133. margin: auto;
  134. left: 70rpx;
  135. display: flex;
  136. }
  137. }
  138. }
  139. .main {
  140. position: absolute;
  141. width: 100%;
  142. height: calc(100vh - 188rpx);
  143. background: #ffffff;
  144. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  145. border-radius: 31rpx 31rpx 0 0;
  146. padding: 0 32rpx;
  147. // overflow: auto;
  148. padding-bottom: 64rpx;
  149. .tabs {
  150. border-bottom: 1px solid #cdcdcd;
  151. padding-bottom: 4rpx;
  152. }
  153. }
  154. }
  155. </style>