江西小程序管理端
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.

189 lines
3.9 KiB

1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="添加编辑模版"></topNavbar>
  4. <view class="pad">
  5. <view class="card">
  6. <view class="tit flex">
  7. <view class="lab">模板标题</view>
  8. <view class="inputBox my">
  9. <u--input placeholder="请输入内容" border="none" v-model="FormData.title" ></u--input>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="card timeCon" v-for="(item,index) in FormData.tiemArr">
  14. <view class="deleteIcon" @click="deleteFn(item.id)">
  15. <u-icon name="close-circle-fill" color="#ADADAD" size="22"></u-icon>
  16. </view>
  17. <view class="row">
  18. <view class="lab">选择时间段</view>
  19. <view class="flex">
  20. <view class="timeTag" >
  21. <mySelect :value="item.startTime" @click="showTime(item,'startTime')" placeholder="开始时间"></mySelect>
  22. </view>
  23. <view class="line"></view>
  24. <view class="timeTag" @click.capture="showTime(item,'endTime')">
  25. <mySelect :value="item.startTime" @click="showTime(item,'startTime')" placeholder="结束时间"></mySelect>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="row">
  30. <view class="lab">选择人数</view>
  31. <view class="numBox">
  32. <u-number-box v-model="item.people" :max="10"></u-number-box>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="add" @click="addFn">
  37. <view class="addIcon">
  38. <image src="@/static/images/coach/tianjia.png" mode=""></image>
  39. </view>
  40. <view class="text">添加</view>
  41. </view>
  42. <view class="btnBg">保存为模板</view>
  43. </view>
  44. <u-datetime-picker
  45. :show="show"
  46. v-model="value1"
  47. mode="time"
  48. @confirm="confirmTime"
  49. ></u-datetime-picker>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. FormData: {
  57. title: '',
  58. tiemArr: [
  59. {startTime: '',endTime: '', people: 1, id: new Date() * 1}
  60. ]
  61. },
  62. show: false,
  63. value1: ''
  64. }
  65. },
  66. methods: {
  67. addFn() {
  68. let obj = {startTime: '',endTime: '', people: 1, id: new Date() * 1}
  69. this.FormData.tiemArr.push(obj)
  70. },
  71. deleteFn(id) {
  72. let arr = this.FormData.tiemArr
  73. if(arr.length==1) return
  74. let index = arr.findIndex(item=>item.id==id)
  75. if(index==-1) return
  76. arr.splice(index, 1)
  77. },
  78. confirmTime(val) {
  79. console.log(val.value)
  80. this.show = false
  81. },
  82. showTime(item, name) {
  83. this.show = true
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .pageBgImg {
  90. .pad {
  91. .card {
  92. padding: 0 28rpx;
  93. margin-bottom: 20rpx;
  94. &.timeCon {
  95. padding: 28rpx;
  96. }
  97. .tit {
  98. height: 96rpx;
  99. background: #FFFFFF;
  100. border-radius: 16px;
  101. .lab {
  102. width: 172rpx;
  103. font-weight: 500;
  104. color: #333333;
  105. }
  106. .inputBox.my {
  107. flex: 1;
  108. }
  109. }
  110. }
  111. .card {
  112. position: relative;
  113. .deleteIcon {
  114. position: absolute;
  115. right: 20rpx;
  116. top: 20rpx
  117. }
  118. .row {
  119. padding: 12rpx 0;
  120. display: flex;
  121. align-items: center;
  122. .lab {
  123. font-size: 30rpx;
  124. width: 172rpx;
  125. flex-shrink: 0;
  126. }
  127. .flex {
  128. .timeTag {
  129. // padding: 8rpx 14rpx;
  130. background: #F8F8F8;
  131. border-radius: 34rpx;
  132. width: 150rpx;
  133. text-align: center;
  134. height: 52rpx;
  135. line-height: 52rpx;
  136. // width:fit-content;
  137. input {
  138. display: block;
  139. width: 100%;
  140. height: 100%;
  141. font-size: 26rpx;
  142. color: #333333;
  143. }
  144. }
  145. .line {
  146. width: 26rpx;
  147. height: 2rpx;
  148. background: #DADADA;
  149. margin: 0 14rpx;
  150. }
  151. }
  152. }
  153. }
  154. .add {
  155. display: flex;
  156. align-items: center;
  157. justify-content: center;
  158. padding-top: 20rpx;
  159. .addIcon {
  160. width: 36rpx;
  161. height: 36rpx;
  162. }
  163. .text {
  164. font-size: 28rpx;
  165. color: $themC;
  166. margin-left: 10rpx;
  167. }
  168. }
  169. .btnBg {
  170. width: 396rpx;
  171. margin: 96rpx auto 20rpx auto;
  172. }
  173. }
  174. }
  175. </style>