joinlist.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view>
  3. <image mode="widthFix" style="width: 100%;" :src="post" v-if="post"></image>
  4. <view class="topArea">
  5. <button class="topArea-btn" @tap="addTrain">添加培训意愿</button>
  6. </view>
  7. <view class="course">
  8. <view class="courseCard" v-for="(item,index) in plist" :key="index">
  9. <!-- <view class="courseLeft"></view> -->
  10. <view class="courseRight">
  11. <view class="courseCard-header">
  12. <view class="header-title">{{item.train.title}}</view>
  13. <image class="header-icon" src="../../static/images/index/applyCancel.png" mode="widthFix" @tap="delJoin(index, item.id)">
  14. </image>
  15. </view>
  16. <view class="courseCard-item">{{item.train.contact}}</view>
  17. <view class="courseCard-item">{{item.train.mobile}}</view>
  18. <view class="courseCard-item">{{item.train.address}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="padding flex flex-direction" v-if="false">
  23. <button class="cu-btn bg-green margin-tb-sm lg" @tap="addTrain">添加培训意愿</button>
  24. </view>
  25. <block v-for="(item,index) in plist" :key="index" v-if="false">
  26. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius">
  27. <view class="cu-item shadow padding-top-sm padding-bottom">
  28. <view class="padding-lr flex justify-between align-center">
  29. <view class="basis-lg text-bold text-lg text-cut">{{item.train.title}}</view>
  30. <view class="basis-sm text-cut text-right text-gray text-sm">
  31. <view class="basis-xs text-cut text-right text-red text-sm" @tap="delJoin(index, item.id)">
  32. 取消报名</view>
  33. </view>
  34. </view>
  35. <view class="padding-lr flex justify-between align-bottom">
  36. <view class="basis-lg text-bold text-df text-cut">
  37. <view class="text-gray">{{item.train.contact}}</view>
  38. </view>
  39. <view class="basis-sm text-cut text-right text-gray text-sm">
  40. {{item.train.mobile}}
  41. </view>
  42. </view>
  43. <view class="padding-lr padding-tb-xs text-cut">
  44. <view class="basis-sm text-cut text-left text-gray text-sm">{{item.train.address}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. </block>
  49. <uni-load-more :status="pstatus"></uni-load-more>
  50. </view>
  51. </template>
  52. <script>
  53. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  54. var _this;
  55. export default {
  56. components: {
  57. uniLoadMore
  58. },
  59. data() {
  60. return {
  61. userinfo: {},
  62. pstatus: 'more',
  63. ppage: 1,
  64. psize: 20,
  65. plist: [],
  66. post: "",
  67. };
  68. },
  69. onLoad: function() {
  70. _this = this;
  71. _this.userinfo = _this.checkLogin("/pages/train/joinlist");
  72. if (_this.userinfo === false) {
  73. return false;
  74. }
  75. _this.$req.ajax({
  76. path: "index/getConfig",
  77. data: {
  78. code: "train_post"
  79. }
  80. }).then((data) => {
  81. _this.post = data;
  82. }).catch((err) => {
  83. uni.showModal({
  84. title: '信息提示',
  85. content: err,
  86. showCancel: false
  87. });
  88. });
  89. },
  90. onShow: function() {
  91. _this.ppage = 1;
  92. _this.pstatus = 'more';
  93. _this.plist = [];
  94. _this.getMore();
  95. },
  96. onPullDownRefresh: function() {
  97. _this.ppage = 1;
  98. _this.pstatus = 'more';
  99. _this.plist = [];
  100. _this.getMore();
  101. },
  102. onReachBottom: function() {
  103. if (_this.pstatus !== 'more') {
  104. return;
  105. }
  106. _this.getMore();
  107. },
  108. methods: {
  109. delJoin: function(index, id) {
  110. uni.showModal({
  111. title: '温馨提示',
  112. content: '确定要取消吗?',
  113. success(res) {
  114. if (res.confirm) {
  115. _this.$req.ajax({
  116. path: "train/deljoin",
  117. data: {
  118. id: id,
  119. userid: _this.userinfo.id
  120. }
  121. }).then((data) => {
  122. _this.plist.splice(index, 1);
  123. }).catch((err) => {
  124. uni.showModal({
  125. title: '信息提示',
  126. content: err,
  127. showCancel: false
  128. });
  129. });
  130. }
  131. }
  132. });
  133. },
  134. getMore: function() {
  135. _this.$req.ajax({
  136. path: "train/joinlist",
  137. data: {
  138. ppage: _this.ppage,
  139. psize: _this.psize,
  140. userid: _this.userinfo.id
  141. }
  142. }).then((data) => {
  143. _this.pstatus = data.pstatus;
  144. _this.plist = _this.plist.concat(data.plist);
  145. _this.ppage += 1;
  146. uni.stopPullDownRefresh();
  147. }).catch((err) => {
  148. uni.showModal({
  149. title: '信息提示',
  150. content: err,
  151. showCancel: false
  152. });
  153. });
  154. },
  155. addTrain: function() {
  156. uni.navigateTo({
  157. url: '/pages/train/list'
  158. });
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. .topArea {
  165. margin-top: 40rpx;
  166. padding: 0 26rpx;
  167. .topArea-btn {
  168. height: 90rpx;
  169. line-height: 90rpx;
  170. border-radius: 10rpx;
  171. background-color: #CA151C;
  172. color: #FFFFFF;
  173. font-size: 33rpx;
  174. }
  175. }
  176. .course {
  177. margin-top: 48rpx;
  178. padding: 0 26rpx;
  179. .courseCard {
  180. margin-bottom: 26rpx;
  181. // height: 276rpx;
  182. background-color: #FFFFFF;
  183. border-radius: 12rpx;
  184. display: flex;
  185. overflow: hidden;
  186. // .courseLeft {
  187. // width: 8rpx;
  188. // height: 100%;
  189. // background-color: #009600;
  190. // }
  191. .courseRight {
  192. flex: 1;
  193. padding: 22rpx 48rpx;
  194. font-size: 28rpx;
  195. color: #747474;
  196. display: flex;
  197. flex-direction: column;
  198. justify-content: space-between;
  199. border-left: 5px solid #009600;
  200. .courseCard-header {
  201. // margin-bottom: 10rpx;
  202. display: flex;
  203. align-items: center;
  204. justify-content: space-between;
  205. .header-title {
  206. width: 70%;
  207. font-size: 40rpx;
  208. font-weight: 600;
  209. color: #383838;
  210. overflow: hidden;
  211. text-overflow: ellipsis;
  212. -webkit-line-clamp: 1;
  213. display: -webkit-box;
  214. -webkit-box-orient: vertical;
  215. }
  216. .header-icon {
  217. width: 144rpx;
  218. }
  219. }
  220. .courseCard-item {
  221. margin-top: 25rpx;
  222. overflow: hidden;
  223. text-overflow: ellipsis;
  224. -webkit-line-clamp: 1;
  225. display: -webkit-box;
  226. -webkit-box-orient: vertical;
  227. }
  228. }
  229. }
  230. }
  231. </style>