You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.5 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="main">
  3. <view class="searchBox">
  4. <searchRow placeholder="请输入模版名称/模版内容" />
  5. </view>
  6. <view class="ul">
  7. <view class="total" v-if="total">{{total}}</view>
  8. <view class="card" v-for="(item,index) in list" @click="chooseTemplate(item)" :class="{active: chooseTemp.id==item.id}">
  9. <view class="row">
  10. <view class="lab">模版名称</view>
  11. <view class="val">{{item.name}}</view>
  12. </view>
  13. <view class="row">
  14. <view class="lab">模版内容</view>
  15. <view class="val">{{item.value}}</view>
  16. </view>
  17. <view class="row" v-if="item.description">
  18. <view class="lab">模版描述</view>
  19. <view class="val">{{item.description}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="btn_poz">
  24. <view class="btnBg" @click="pickTemplate"> </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import { templateList } from '@/config/api.js'
  30. export default {
  31. data() {
  32. return {
  33. list: [],
  34. params: {
  35. name: '',
  36. value: '',
  37. // page: 1,
  38. // size: 2
  39. },
  40. list: [],
  41. total: 0,
  42. chooseTemp: {}
  43. }
  44. },
  45. onLoad() {
  46. this.templateListFn()
  47. },
  48. onPullDownRefresh() {
  49. this.templateListFn(()=>{
  50. uni.stopPullDownRefresh()
  51. })
  52. },
  53. methods: {
  54. async templateListFn(callback) {
  55. const {data: res} = await templateList(this.params)
  56. this.list = res.rows
  57. this.total = res.total
  58. console.log(res)
  59. callback&&callback()
  60. },
  61. chooseTemplate(item) {
  62. this.chooseTemp = item
  63. },
  64. pickTemplate() {
  65. uni.$emit('pickTemplate',this.chooseTemp)
  66. uni.navigateBack()
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .searchBox {
  73. padding: 14rpx 30rpx;
  74. background-color: #fff;
  75. }
  76. .btn_poz {
  77. position: fixed;
  78. bottom: 0;
  79. left: 0;
  80. width: 100%;
  81. height: 100rpx;
  82. display: flex;
  83. justify-content: center;
  84. padding: 0 30px;
  85. background: #f5f5f5;
  86. align-items: center;
  87. .btnBg{
  88. width: 100%;
  89. }
  90. }
  91. .ul {
  92. padding: 0rpx 30rpx 140rpx 30rpx;
  93. .total {
  94. height: 66rpx;
  95. line-height: 66rpx;
  96. font-size: 24rpx;
  97. color: #999;
  98. text-align: right;
  99. }
  100. }
  101. .card {
  102. padding: 20rpx;
  103. margin-bottom: 20rpx;
  104. background-color: #fff;
  105. &.active {
  106. border: 1px solid $themC;
  107. background-color: #dfeaf5;
  108. .row {
  109. color: $themC;
  110. }
  111. }
  112. .row {
  113. display: flex;
  114. font-size: 24rpx;
  115. color: #333;
  116. padding: 20rpx 0;
  117. .lab {
  118. width: 140rpx;
  119. }
  120. .val {
  121. flex: 1;
  122. width: 0;
  123. text-align: right;
  124. }
  125. }
  126. }
  127. </style>