activityManage.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <view class="search-box ddflex">
  5. <view class="search-input ddflex fflex">
  6. <image src="/static/images/ssico.png"></image>
  7. <input @confirm="searchFn" confirm-type="search" @input="searchFn" v-model="searchVal" class="fflex"
  8. placeholder="请输入关键词" />
  9. </view>
  10. </view>
  11. </view>
  12. <view style="height: 150rpx;"></view>
  13. <view class="title">
  14. 我的活动<text>共{{total}}个</text>
  15. </view>
  16. <view class="padd30" v-if="pageList.length>0">
  17. <view class="act-bar ddflex" v-for="item,index in pageList">
  18. <view class="act-pic">
  19. <image :src="item.pic" mode="aspectFill"></image>
  20. <view class="act-pic-tag" v-if="item.state==0">审核中</view>
  21. <view class="act-pic-tag" v-if="item.state==6">审核失败</view>
  22. </view>
  23. <view class="flex">
  24. <view class="act-title tovers">{{item.title}}</view>
  25. <view class="act-time">活动时间:{{formatTime(item.endTime)}}</view>
  26. <view class="act-bottom ddflex">
  27. <view class="act-bottom-look ddflex">
  28. <image src="../static/images/person.png"></image>
  29. {{item.person}}人
  30. </view>
  31. <view class="act-edit" v-if="item.state==0||item.state==6" @click="jumpUrl('/match/activityEdit/activityEdit?id='+item.id)">修改</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="nodata nosp bgfff" v-else>
  37. <image src="/static/images/empty_sp.png"></image>
  38. <text>暂无活动</text>
  39. </view>
  40. <view class="act-create" @click="jumpUrl('/match/activityEdit/activityEdit')">
  41. <image src="../static/images/add.png"></image>
  42. <view>发布</view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. const app = getApp();
  48. const req = require("../../utils/request.js");
  49. import util from "../../utils/util.js";
  50. export default {
  51. components: {},
  52. props: {},
  53. data() {
  54. return {
  55. pageList: [],
  56. isLoad: true,
  57. form: {
  58. page: 1,
  59. limit: 10
  60. },
  61. searchVal:'',
  62. total:0,
  63. saleNo:null,
  64. pcId:null
  65. }
  66. },
  67. async onLoad(opt) {
  68. await req.silenceLogin(opt.saleNo)
  69. this.pcId = req.getStorage('userInfo').id
  70. this.getPageList()
  71. },
  72. onShow() {
  73. },
  74. onReachBottom: function() {
  75. this.form.page++;
  76. this.getPageList(false);
  77. },
  78. methods: {
  79. jumpUrl(url){
  80. uni.navigateTo({
  81. url:url
  82. })
  83. },
  84. getPageList(isShow) {
  85. if (!this.isLoad) return false;
  86. this.isLoad = false;
  87. let form = this.form;
  88. if(this.searchVal){
  89. form.search = this.searchVal
  90. }else{
  91. form.search = ''
  92. }
  93. uni.showLoading();
  94. req.getRequest(
  95. '/api/match/page',
  96. form,
  97. res => {
  98. this.total = res.total
  99. res = res?res.list:[]
  100. this.isShow = true;
  101. if (res && res.length == 10) {
  102. this.isLoad = true;
  103. }
  104. if (this.form.page > 1) {
  105. res = this.pageList.concat(res);
  106. }
  107. this.pageList = res;
  108. uni.hideLoading();
  109. },
  110. isShow
  111. );
  112. },
  113. searchFn(){
  114. this.isLoad = true
  115. this.form.page=1
  116. this.getPageList()
  117. },
  118. formatTime(date){
  119. date = new Date(date.replace(/-/g, '/'))
  120. return util.formatTime(date).t3
  121. },
  122. },
  123. mounted() {
  124. },
  125. onPageScroll: function(e) {
  126. }
  127. }
  128. </script>
  129. <style>
  130. @import "./activityManage.css";
  131. </style>