index.vue 3.5 KB

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