activityManage.vue 3.4 KB

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