activityManage.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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!=2&&pcId&&pcId==item.creator" @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. picUrlss:req.public.picUrls,
  56. pageList: [],
  57. isLoad: true,
  58. form: {
  59. page: 1,
  60. limit: 10
  61. },
  62. searchVal:'',
  63. total:0,
  64. saleNo:null,
  65. pcId:null
  66. }
  67. },
  68. async onLoad(opt) {
  69. await req.silenceLogin(opt.saleNo)
  70. this.pcId = req.getStorage('userInfo').pcId
  71. this.getPageList()
  72. },
  73. onShow() {
  74. },
  75. onReachBottom: function() {
  76. this.form.page++;
  77. this.getPageList(false);
  78. },
  79. methods: {
  80. jumpUrl(url){
  81. uni.navigateTo({
  82. url:url
  83. })
  84. },
  85. getPageList(isShow) {
  86. if (!this.isLoad) return false;
  87. this.isLoad = false;
  88. let form = this.form;
  89. if(this.searchVal){
  90. form.search = this.searchVal
  91. }else{
  92. form.search = ''
  93. }
  94. uni.showLoading();
  95. req.getRequest(
  96. '/api/match/page',
  97. form,
  98. res => {
  99. this.total = res.total
  100. res = res?res.list:[]
  101. this.isShow = true;
  102. if (res && res.length == 10) {
  103. this.isLoad = true;
  104. }
  105. if (this.form.page > 1) {
  106. res = this.pageList.concat(res);
  107. }
  108. this.pageList = res;
  109. uni.hideLoading();
  110. },
  111. isShow
  112. );
  113. },
  114. searchFn(){
  115. this.isLoad = true
  116. this.form.page=1
  117. this.getPageList()
  118. },
  119. formatTime(date){
  120. date = new Date(date.replace(/-/g, '/'))
  121. return util.formatTime(date).t3
  122. },
  123. },
  124. mounted() {
  125. },
  126. onPageScroll: function(e) {
  127. }
  128. }
  129. </script>
  130. <style>
  131. @import "./activityManage.css";
  132. </style>