index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view>
  3. <view class="search-box ddflex">
  4. <view class="search-input ddflex fflex">
  5. <image src="/static/images/ssico.png"></image>
  6. <input @confirm="searchFn" confirm-type="search" @input="searchFn" v-model="searchVal" class="fflex"
  7. placeholder="请输入关键词" />
  8. </view>
  9. </view>
  10. <view style="height: 120rpx;"></view>
  11. <view class="ddflex" style="padding: 30rpx;">
  12. <view class="poster-item" v-for="item in pageList" @click="jumpDetail(item)">
  13. <image class="poster-item-pic" :src="item.pic" mode="aspectFill"></image>
  14. <view class="poster-item-title tover">{{item.title?item.title:'未命名'}}</view>
  15. <view class="zhuanfa">编辑</view>
  16. <!-- <view class="poster-item-use">2056 人正在使用</view> -->
  17. </view>
  18. </view>
  19. <view class="nodata nosp bgfff" v-if="pageList.length==0">
  20. <image src="/static/images/empty_sp.png"></image>
  21. <text>暂无海报</text>
  22. </view>
  23. <view class="act-create" @click="showBtn">
  24. <image src="../static/images/add.png"></image>
  25. <view>发布</view>
  26. </view>
  27. <view class="ceng" v-if="isShowbtn" @click="hideBtn"></view>
  28. <view class="side ddflex" v-if="isShowbtn">
  29. <view class="li" @click="jumpUrl('/library/longPosterService/longPosterService')">
  30. <image src="/static/images/ll_dt.png"></image>
  31. <view>年度账单</view>
  32. </view>
  33. <view class="li" @click="jumpUrl('/library/longPosterService/longPosterService2')">
  34. <image src="/static/images/ll_cz.png"></image>
  35. <view>日/月/年报</view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. const app = getApp();
  42. const req = require("../../utils/request.js");
  43. export default {
  44. components: {},
  45. props: {},
  46. data() {
  47. return {
  48. searchVal:'',
  49. isShowbtn:false,
  50. searchVal:'',
  51. isShow: false,
  52. pageList: [],
  53. isLoad: true,
  54. form: {
  55. page: 1,
  56. limit: 10
  57. },
  58. }
  59. },
  60. async onLoad(options) {
  61. await req.silenceLogin()
  62. this.getPageList(true);
  63. },
  64. onShow() {
  65. },
  66. onHide() {
  67. this.hideBtn()
  68. },
  69. onReachBottom: function() {
  70. this.form.page++;
  71. this.getPageList(false);
  72. },
  73. methods: {
  74. jumpUrl(url){
  75. uni.navigateTo({
  76. url:url
  77. })
  78. },
  79. // 获取海报
  80. getPageList(isShow){
  81. if (!this.isLoad) return false;
  82. this.isLoad = false;
  83. let form = this.form;
  84. form.code = 'poster_long'
  85. form.search = this.searchVal?this.searchVal:null
  86. req.loadIng('加载中')
  87. req.getRequest('/api/material/library',form,res => {
  88. this.isShow = true;
  89. res = res?res.list:[]
  90. if (res && res.length == 10) {
  91. this.isLoad = true;
  92. }
  93. if (this.form.page > 1) {
  94. res = this.pageList.concat(res);
  95. }
  96. this.pageList = res;
  97. uni.hideLoading()
  98. },isShow);
  99. },
  100. // 搜索
  101. searchFn(){
  102. this.isLoad = true
  103. this.form.page = 1
  104. this.getPageList()
  105. },
  106. showBtn() {
  107. this.isShowbtn = true;
  108. },
  109. hideBtn() {
  110. this.isShowbtn = false;
  111. },
  112. download(url){
  113. uni.downloadFile({
  114. url: url, //仅为示例,并非真实的资源
  115. success: (res) => {
  116. console.log(res)
  117. if (res.statusCode === 200) {
  118. console.log('下载成功');
  119. var oA = document.createElement("a");
  120. oA.download = ''; // 设置下载的文件名,默认是'下载'
  121. oA.href = res.tempFilePath; //临时路径再保存到本地
  122. document.body.appendChild(oA);
  123. oA.click();
  124. oA.remove(); // 下载之后把创建的元素删除
  125. req.msg('已保存')
  126. }
  127. }
  128. });
  129. },
  130. jumpDetail(item){
  131. if(item.cateCode=='nianduzhangdan'){
  132. this.jumpUrl('/library/longPosterService/longPosterService?id='+item.id)
  133. }
  134. if(item.cateCode=='lipeiribao'){
  135. this.jumpUrl('/library/longPosterService/longPosterService2?id='+item.id)
  136. }
  137. }
  138. },
  139. mounted() {
  140. },
  141. onPageScroll: function(e) {
  142. }
  143. }
  144. </script>
  145. <style>
  146. @import "./index.css";
  147. </style>