人民医院前端

requestItem.vue 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="item">
  3. <view :class="'head '+statusClass" @click="expand=!expand">
  4. <text :class="'status '+statusClass">{{data.info.status}}</text>
  5. <text class="expand">{{expand?'▼ ':'▶ '}}</text>
  6. <text class="text">{{data.info.method}}</text>
  7. <text class="text" style="max-width:730rpx">{{data.info.url}}</text>
  8. </view>
  9. <view v-if="expand" class="expand-area">
  10. <view class="sitem line">
  11. <text class="text">Url: </text>
  12. <text class="value">{{data.info.url}}</text>
  13. </view>
  14. <view class="sitem line">
  15. <text class="text">SourceUrl: </text>
  16. <text class="value">{{data.info.sourceUrl}}</text>
  17. </view>
  18. <view class="sitem line">
  19. <text class="text">Method: </text>
  20. <text class="value">{{data.info.method}}</text>
  21. </view>
  22. <view class="sitem line">
  23. <text class="text">Status: </text>
  24. <text class="value">{{data.info.status}}</text>
  25. </view>
  26. <view class="sitem">
  27. <text class="text">Options: </text>
  28. <jsObjectText :obj="data.options" />
  29. </view>
  30. <view class="sitem">
  31. <text class="text">Data: </text>
  32. <jsObjectText :obj="data.data" />
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import jsObjectText from './jsObjectText.vue'
  39. export default {
  40. components: {
  41. jsObjectText
  42. },
  43. props: {
  44. data: {
  45. }
  46. },
  47. methods: {
  48. },
  49. computed: {
  50. statusClass() {
  51. if(this.data.info.status < 300 )
  52. return 'success';
  53. if(this.data.info.status < 500)
  54. return 'warn';
  55. if(this.data.info.status >= 500)
  56. return 'error';
  57. return '';
  58. },
  59. },
  60. data() {
  61. return {
  62. expand: false
  63. }
  64. },
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .item {
  69. display: flex;
  70. flex-direction: column;
  71. flex-wrap: wrap;
  72. justify-content: center;
  73. border-bottom: 1px solid #f6f6f6;
  74. width: 750rpx;
  75. .head {
  76. display: flex;
  77. flex-direction: row;
  78. align-items: center;
  79. flex-wrap: wrap;
  80. padding: 8rpx 15rpx;
  81. .text {
  82. font-size: 25rpx;
  83. margin-right: 6rpx;
  84. word-break: break-all;
  85. }
  86. &.success {
  87. background-color: #f1ffe5;
  88. border-bottom-color: #e3ffc2;
  89. .text {
  90. color: #5c3c00;
  91. }
  92. }
  93. &.warn {
  94. background-color: #fffbe5;
  95. border-bottom-color: #fff5c2;
  96. .text {
  97. color: #295c00;
  98. }
  99. }
  100. &.error {
  101. background-color: #fff0f0;
  102. border-bottom-color: #ffd6d6;
  103. .text {
  104. color: #f00;
  105. }
  106. }
  107. .expand {
  108. font-size: 20rpx;
  109. margin-right: 6rpx;
  110. }
  111. }
  112. }
  113. .expand-area {
  114. padding: 10rpx 0;
  115. }
  116. .sitem {
  117. display: flex;
  118. flex-direction: column;
  119. padding: 0 20rpx;
  120. &.line {
  121. flex-direction: row;
  122. }
  123. .text {
  124. font-size: 25rpx;
  125. }
  126. .value {
  127. margin-left: 10rpx;
  128. font-size: 25rpx;
  129. color: #999;
  130. white-space: nowrap;
  131. }
  132. }
  133. .status {
  134. width: 60rpx;
  135. height: 32rpx;
  136. border-radius: 6rpx;
  137. margin-right: 10rpx;
  138. font-size: 26rpx;
  139. color: #fff;
  140. line-height: 32rpx;
  141. text-align: center;
  142. &.error {
  143. background-color: #f96800;
  144. }
  145. &.warn {
  146. background-color: #f9c802;
  147. }
  148. &.success {
  149. background-color: #64ca10;
  150. }
  151. }
  152. </style>