joinlist.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <image mode="widthFix" style="width: 100%;" :src="post" v-if="post"></image>
  4. <view class="padding flex flex-direction">
  5. <button class="cu-btn bg-green margin-tb-sm lg" @tap="addTrain">添加培训意愿</button>
  6. </view>
  7. <block v-for="(item,index) in plist" :key="index">
  8. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius">
  9. <view class="cu-item shadow padding-top-sm padding-bottom">
  10. <view class="padding-lr flex justify-between align-center">
  11. <view class="basis-lg text-bold text-lg text-cut">{{item.train.title}}</view>
  12. <view class="basis-sm text-cut text-right text-gray text-sm">
  13. <view class="basis-xs text-cut text-right text-red text-sm" @tap="delJoin(index, item.id)">取消报名</view>
  14. </view>
  15. </view>
  16. <view class="padding-lr flex justify-between align-bottom">
  17. <view class="basis-lg text-bold text-df text-cut">
  18. <view class="text-gray">{{item.train.contact}}</view>
  19. </view>
  20. <view class="basis-sm text-cut text-right text-gray text-sm">
  21. {{item.train.mobile}}
  22. </view>
  23. </view>
  24. <view class="padding-lr padding-tb-xs text-cut">
  25. <view class="basis-sm text-cut text-left text-gray text-sm">{{item.train.address}}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </block>
  30. <uni-load-more :status="pstatus"></uni-load-more>
  31. </view>
  32. </template>
  33. <script>
  34. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  35. var _this;
  36. export default {
  37. components: {
  38. uniLoadMore
  39. },
  40. data() {
  41. return {
  42. userinfo: {},
  43. pstatus: 'more',
  44. ppage: 1,
  45. psize: 20,
  46. plist: [],
  47. post: "",
  48. };
  49. },
  50. onLoad: function(){
  51. _this = this;
  52. _this.userinfo = _this.checkLogin("/pages/train/joinlist");
  53. if (_this.userinfo===false){
  54. return false;
  55. }
  56. _this.$req.ajax({
  57. path: "index/getConfig",
  58. data: {
  59. code: "train_post"
  60. }
  61. }).then((data) => {
  62. _this.post = data;
  63. }).catch((err) => {
  64. uni.showModal({
  65. title: '信息提示',
  66. content: err,
  67. showCancel: false
  68. });
  69. });
  70. },
  71. onShow: function() {
  72. _this.ppage = 1;
  73. _this.pstatus = 'more';
  74. _this.plist = [];
  75. _this.getMore();
  76. },
  77. onPullDownRefresh: function() {
  78. _this.ppage = 1;
  79. _this.pstatus = 'more';
  80. _this.plist = [];
  81. _this.getMore();
  82. },
  83. onReachBottom: function() {
  84. if (_this.pstatus !== 'more') {
  85. return;
  86. }
  87. _this.getMore();
  88. },
  89. methods: {
  90. delJoin: function(index,id) {
  91. uni.showModal({
  92. title: '温馨提示',
  93. content: '确定要取消吗?',
  94. success(res) {
  95. if (res.confirm) {
  96. _this.$req.ajax({
  97. path: "train/deljoin",
  98. data: {
  99. id: id,
  100. userid: _this.userinfo.id
  101. }
  102. }).then((data) => {
  103. _this.plist.splice(index, 1);
  104. }).catch((err) => {
  105. uni.showModal({
  106. title: '信息提示',
  107. content: err,
  108. showCancel: false
  109. });
  110. });
  111. }
  112. }
  113. });
  114. },
  115. getMore: function() {
  116. _this.$req.ajax({
  117. path: "train/joinlist",
  118. data: {
  119. ppage: _this.ppage,
  120. psize: _this.psize,
  121. userid: _this.userinfo.id
  122. }
  123. }).then((data) => {
  124. _this.pstatus = data.pstatus;
  125. _this.plist = _this.plist.concat(data.plist);
  126. _this.ppage += 1;
  127. uni.stopPullDownRefresh();
  128. }).catch((err) => {
  129. uni.showModal({
  130. title: '信息提示',
  131. content: err,
  132. showCancel: false
  133. });
  134. });
  135. },
  136. addTrain: function() {
  137. uni.navigateTo({
  138. url: '/pages/train/list'
  139. });
  140. }
  141. }
  142. }
  143. </script>
  144. <style>
  145. </style>