page.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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>分享 {{item.shareCount?item.shareCount:0}} | 浏览 {{item.browseCount?item.browseCount:0}}</view>
  23. </view>
  24. </view>
  25. <button @click.stop="" class="act-btn ddflex" :data-id="item.id" :data-code="item.code" :data-title="item.title" :data-pic="item.pic" open-type="share">
  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. searchVal:'',
  53. form: {
  54. page: 1,
  55. limit: 10
  56. },
  57. isLogin: false,
  58. userInfo:{}
  59. };
  60. },
  61. onLoad() {
  62. this.userInfo = req.getStorage('userInfo')
  63. uni.hideShareMenu()
  64. },
  65. onShow() {
  66. this.isLogin = req.isAuth();
  67. this.getPageList(true);
  68. },
  69. onReachBottom: function() {
  70. this.form.page++;
  71. this.getPageList(false);
  72. },
  73. onShareAppMessage(res) {
  74. if (res.from === 'button') {
  75. this.userBehavior(6,res.target.dataset.id)
  76. return {
  77. title: res.target.dataset.title,
  78. imageUrl: res.target.dataset.pic,
  79. path: '/library/pageDetail/index?code=' + res.target.dataset.code +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'')
  80. };
  81. }
  82. },
  83. methods: {
  84. // 用户行为
  85. userBehavior(type,id) {
  86. var dataP = {};
  87. dataP.type =
  88. 7 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  89. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  90. dataP.bindId = id;
  91. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  92. });
  93. },
  94. jumpUrl(url) {
  95. if (!req.isLogins(true)) {
  96. return;
  97. }
  98. uni.navigateTo({
  99. url: url
  100. });
  101. },
  102. getPageList(isShow) {
  103. if (!this.isLoad) return false;
  104. this.isLoad = false;
  105. let form = this.form;
  106. form.rootCode = 'brochure'
  107. form.search = this.searchVal?this.searchVal:null
  108. uni.showLoading();
  109. req.getRequest(
  110. '/api/material/library',
  111. form,
  112. res => {
  113. this.isShow = true;
  114. res = res?res.list:[]
  115. if (res && res.length == 10) {
  116. this.isLoad = true;
  117. }
  118. if (this.form.page > 1) {
  119. res = this.pageList.concat(res);
  120. }
  121. this.pageList = res;
  122. uni.hideLoading();
  123. },
  124. isShow
  125. );
  126. },
  127. toActivity(item) {
  128. uni.navigateTo({
  129. url: '/match/activityDetail/activityDetail?id=' + item.id
  130. });
  131. },
  132. // 搜索
  133. searchFn(){
  134. this.isLoad = true
  135. this.form.page = 1
  136. this.getPageList()
  137. }
  138. }
  139. };
  140. </script>
  141. <style>
  142. @import './page.css';
  143. </style>