page.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view v-if="isShow">
  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: 140rpx;"></view>
  13. <view class="act-list" v-if="pageList && pageList.length > 0">
  14. <view class="li" v-for="(item, index) in pageList" :key="index" @click="jumpUrl('/library/pageDetail/index?code=' + item.code)">
  15. <view class="imgbox"><image :src="item.pic" mode="aspectFill"></image></view>
  16. <view class="infos fflex">
  17. <view class="stas ddflex">
  18. <view class="fflex">
  19. <view class="act-tit tover">{{ item.title }}</view>
  20. <!-- <view class="tag-box tovers">{{ item.brief }}</view> -->
  21. <view class="area ddflex">
  22. <view>分享 775 | 带来流量 89</view>
  23. </view>
  24. </view>
  25. <button class="act-btn ddflex">
  26. <image style="width: 20rpx;height: 22rpx;margin-right: 10rpx;" src="../static/images/money.png"></image>
  27. 立即分享
  28. </button>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="nodata" v-else>
  34. <image :src="picUrlss + 'empty_dd.png'"></image>
  35. <text>暂无记录~</text>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. const req = require('../../utils/request.js');
  41. const api = require('../../utils/api.js');
  42. const util = require('../../utils/util.js');
  43. const app = getApp();
  44. export default {
  45. components: { },
  46. data() {
  47. return {
  48. picUrlss: req.public.picUrls,
  49. isShow: false,
  50. pageList: [],
  51. isLoad: true,
  52. form: {
  53. page: 1,
  54. limit: 10
  55. },
  56. isLogin: false,
  57. userinfovip: {}
  58. };
  59. },
  60. onLoad() {},
  61. onShow() {
  62. this.isLogin = req.isAuth();
  63. this.getPageList(true);
  64. if (this.isLogin) {
  65. this.getuserVip();
  66. }
  67. },
  68. onReachBottom: function() {
  69. this.form.page++;
  70. this.getPageList(false);
  71. },
  72. onShareAppMessage() {
  73. },
  74. onShareTimeline() {
  75. },
  76. methods: {
  77. jumpUrl(url) {
  78. if (!req.isLogins(true)) {
  79. return;
  80. }
  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. form.rootCode = 'brochure'
  90. uni.showLoading();
  91. req.getRequest(
  92. '/api/material/library',
  93. form,
  94. res => {
  95. this.isShow = true;
  96. res = res?res.list:[]
  97. if (res && res.length == 10) {
  98. this.isLoad = true;
  99. }
  100. if (this.form.page > 1) {
  101. res = this.pageList.concat(res);
  102. }
  103. this.pageList = res;
  104. uni.hideLoading();
  105. },
  106. isShow
  107. );
  108. },
  109. getuserVip() {
  110. req.getRequest('/api/user/levelDetails', {}, data => {
  111. let expireTime = Array;
  112. if (data.expireTime) {
  113. expireTime = data.expireTime.split(' ');
  114. data.expireTime = data.expireTime.replace(/-/g, '/');
  115. } // 解决苹果不兼容---日期
  116. let nowTime = new Date().getTime();
  117. let endTime = new Date(data.expireTime).getTime();
  118. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  119. // console.log(times, nowTime, endTime, data.expireTime);
  120. this.userinfovip = data;
  121. if (times <= 0) {
  122. this.userinfovip.end = true;
  123. } else {
  124. this.userinfovip.end = false;
  125. }
  126. });
  127. },
  128. toActivity(item) {
  129. uni.navigateTo({
  130. url: '/match/activityDetail/activityDetail?id=' + item.id
  131. });
  132. }
  133. }
  134. };
  135. </script>
  136. <style>
  137. @import './page.css';
  138. </style>