joinlist.vue 6.4 KB

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