list.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <block v-for="(item,index) in plist" :key="index">
  4. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius" @tap="join(item.id)">
  5. <view class="cu-item shadow padding-top-sm padding-bottom">
  6. <view class="padding-lr flex justify-between align-center">
  7. <view class="basis-lg text-bold text-lg text-cut">{{item.title}}</view>
  8. </view>
  9. <view class="padding-lr flex justify-between align-bottom">
  10. <view class="basis-lg text-bold text-df text-cut">
  11. <view class="text-gray">{{item.contact}}</view>
  12. </view>
  13. <view class="basis-sm text-cut text-right text-gray text-sm">
  14. {{item.mobile}}
  15. </view>
  16. </view>
  17. <view class="padding-lr padding-tb-xs text-cut">
  18. <view class="basis-sm text-cut text-left text-gray text-sm">{{item.address}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </block>
  23. <uni-load-more :status="pstatus"></uni-load-more>
  24. </view>
  25. </template>
  26. <script>
  27. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  28. var _this;
  29. export default {
  30. components: {
  31. uniLoadMore
  32. },
  33. data() {
  34. return {
  35. userinfo: {},
  36. pstatus: 'more',
  37. ppage: 1,
  38. psize: 20,
  39. plist: []
  40. };
  41. },
  42. onLoad: function(){
  43. _this = this;
  44. _this.userinfo = _this.checkLogin("/pages/train/list");
  45. if (_this.userinfo===false){
  46. return false;
  47. }
  48. _this.getMore();
  49. },
  50. onPullDownRefresh: function() {
  51. _this.ppage = 1;
  52. _this.pstatus = 'more';
  53. _this.plist = [];
  54. _this.getMore();
  55. },
  56. onReachBottom: function() {
  57. if (_this.pstatus !== 'more') {
  58. return;
  59. }
  60. _this.getMore();
  61. },
  62. methods: {
  63. join: function(id) {
  64. uni.showModal({
  65. title: '温馨提示',
  66. content: '确定要添加吗?',
  67. success(res) {
  68. if (res.confirm) {
  69. _this.$req.ajax({
  70. path: "train/join",
  71. data: {
  72. train_id: id,
  73. userid: _this.userinfo.id
  74. }
  75. }).then((data) => {
  76. uni.showModal({
  77. title: '添加成功',
  78. content: '恭喜您已报名成功!具体开班时间视报名人数而定,会有老师统一通知,如需加急或有其他疑问,可同柯老师联系,联系电话18659000595 (微信同号)。',
  79. showCancel: false,
  80. success: (res) => {
  81. if(res.confirm) {
  82. uni.navigateBack();
  83. }
  84. }
  85. });
  86. }).catch((err) => {
  87. uni.showModal({
  88. title: '信息提示',
  89. content: err,
  90. showCancel: false
  91. });
  92. });
  93. }
  94. }
  95. });
  96. },
  97. getMore: function() {
  98. _this.$req.ajax({
  99. path: "train/list",
  100. data: {
  101. ppage: _this.ppage,
  102. psize: _this.psize,
  103. userid: _this.userinfo.id
  104. }
  105. }).then((data) => {
  106. _this.pstatus = data.pstatus;
  107. _this.plist = _this.plist.concat(data.plist);
  108. _this.ppage += 1;
  109. uni.stopPullDownRefresh();
  110. }).catch((err) => {
  111. uni.showModal({
  112. title: '信息提示',
  113. content: err,
  114. showCancel: false
  115. });
  116. });
  117. }
  118. }
  119. }
  120. </script>
  121. <style>
  122. </style>