ziliao.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="pageContainer">
  3. <view class="page-header">
  4. <view class="content" style="float: none;">
  5. <view class="condition" style="padding-top: 14rpx;margin-top: 0;height:110rpx;">
  6. <u-search placeholder="请输入资料名称" height="40" v-model="studyTitle" @search="handleTableList"
  7. @custom="handleTableList" :clearabled="true" @clear="handleTableList" :show-action="true"
  8. action-text="搜索"></u-search>
  9. </view>
  10. <view class="condition" style="padding-top: 14rpx;margin-top: 0;height:110rpx;">
  11. <u-search placeholder="请输入发布人" height="40" v-model="pubPep" @search="handleTableList"
  12. @custom="handleTableList" :clearabled="true" @clear="handleTableList" :show-action="true"
  13. action-text="搜索"></u-search>
  14. </view>
  15. <view class="condition" style="padding-top: 0rpx;margin-top: 0;height:90rpx;">
  16. <u-cell title="上传时间" :value="calendarStart + ' 至 ' + calendarEnd" style="height: 86rpx"
  17. @click="$refs.calendarRef.show()">
  18. </u-cell>
  19. <tq-calendar ref="calendarRef" type="daterange" @confirm="(e) => {
  20. calendarStart = e[0]
  21. calendarEnd = e[1]
  22. handleSearch()
  23. }">
  24. </tq-calendar>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="body">
  29. <view class="list" v-for="item in tableList" :key="item.id">
  30. <view class="taskList">
  31. <view class="contentBody">
  32. <u-col :span="12">
  33. <u-row style="margin-top: 12rpx;">
  34. <view
  35. style="display:flex;justify-content: center;align-items: center;height: 180px;width: 100%;">
  36. <image v-if="item.studyType == 2" src="@/static/icon/pdficon.svg" class="image"
  37. style="width: 45%; height: 88%;object-fit:fill;"
  38. @click="checkAddClickNum(item)" />
  39. <video v-if="item.studyType == 1" :src="$getImages(item.studyUrl)" class="image"
  40. style="width: 100%; height: 100%;object-fit:fill;" controls
  41. @click="checkAddClickNum(item)">
  42. </video>
  43. </view>
  44. </u-row>
  45. </u-col>
  46. <u-col :span="6">
  47. <u-row style="margin-top: 12rpx;">
  48. <text class="lightgray-text">名称:</text>
  49. <text class="lightgray-text font-weight">{{ item.studyTitle }}</text>
  50. </u-row>
  51. </u-col>
  52. <u-col :span="6">
  53. <u-row>
  54. <text class="lightgray-text">类型:</text>
  55. <text class="lightgray-text">{{ item.studyTypeName }}</text>
  56. </u-row>
  57. </u-col>
  58. <u-col :span="6">
  59. <u-row style="margin-top: 12rpx;">
  60. <text class="lightgray-text">发布人:</text>
  61. <text class="lightgray-text font-weight">
  62. <text>
  63. {{ item.pubPep }}
  64. </text>
  65. </text>
  66. </u-row>
  67. </u-col>
  68. <u-col :span="12">
  69. <u-row style="margin-top: 12rpx;">
  70. <text class="lightgray-text">上传时间:</text>
  71. <text class="lightgray-text font-weight">{{ item.createTime }}</text>
  72. </u-row>
  73. </u-col>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="nodata-warp" v-if="!tableList.length">
  78. <image :src="$getImages('/assetsMobile/images/no-data.png')" class="nodata-image"></image>
  79. </view>
  80. </view>
  81. <u-calendar :show="calendarShow" mode="range" :defaultDate="defaultDate" :maxDate="maxDate" minDate="2023-10-01"
  82. monthNum="24" @confirm="calendarChange" @close="onClose"></u-calendar>
  83. <u-toast ref="uToast" />
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. getList, addClickNum
  89. } from "@/api/accidentStudy/accidentStudy.js"
  90. export default {
  91. components: {},
  92. props: {},
  93. data() {
  94. return {
  95. studyTitle: '',
  96. pubPep: '',
  97. calendarShow: false, // 日历
  98. tableList: [],
  99. calendarShow: false, // 日历
  100. calendarStart: this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'), // 开始时间
  101. calendarEnd: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'), // 结束时间
  102. defaultDate: [this.dayjs().subtract(6, 'day').format('YYYY-MM-DD'), this.dayjs().subtract(0, 'day').format(
  103. 'YYYY-MM-DD')],
  104. page: 1,
  105. size: 10,
  106. total: 0,
  107. maxDate: this.dayjs().subtract(0, 'day').format('YYYY-MM-DD'),
  108. };
  109. },
  110. mounted() {
  111. this.handleTableList();
  112. },
  113. onReachBottom() {
  114. // 滚动到底部
  115. if (this.page * this.size < this.total) {
  116. this.page += 1;
  117. this.handleTableList();
  118. }
  119. },
  120. methods: {
  121. checkTime() {
  122. this.calendarShow = true
  123. },
  124. handleDataDetection(data) {
  125. // 数据检测
  126. return data == null || data == undefined ? "" : data;
  127. },
  128. async handleTableList() {
  129. let obj = {
  130. page: this.page,
  131. size: 10,
  132. startTime: this.calendarStart == "" || this.calendarStart == null ?
  133. undefined : this.calendarStart + ' 00:00:00',
  134. endTime: this.calendarEnd == "" || this.calendarEnd == null ?
  135. undefined : this.calendarEnd + ' 23:59:59',
  136. pubPep: this.handleDataDetection(this.pubPep),
  137. studyTitle: this.handleDataDetection(this.studyTitle),
  138. };
  139. let res = await getList(obj);
  140. if (res.code == "0" && res.data.list) {
  141. this.tableList = res.data.list
  142. this.total = res.data.listtotal;
  143. }
  144. },
  145. async checkAddClickNum(row) {
  146. let obj = {
  147. id: row.id,
  148. }
  149. let res = await addClickNum(obj);
  150. if (row.studyType == 2) {
  151. this.showPdf(row)
  152. }
  153. },
  154. showPdf(item) {
  155. this.download(this.$getImages(item.studyUrl))
  156. },
  157. download(url) {
  158. let u = navigator.userAgent;
  159. let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
  160. let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  161. if (isAndroid) { //android终端
  162. window.open(url);
  163. } else if (isiOS) { //ios终端
  164. window.location.href = url;
  165. }
  166. },
  167. calendarChange(e) {
  168. this.page = 1;
  169. this.tableList = [];
  170. // 修改日期
  171. this.calendarStart = e[0]; // 开始时间
  172. this.calendarEnd = e[1]; // 结束时间
  173. this.calendarShow = false;
  174. this.handleTableList();
  175. },
  176. onClose() {
  177. this.calendarShow = false;
  178. this.handleTableList();
  179. },
  180. },
  181. };
  182. </script>
  183. <style scoped lang="scss">
  184. .page-header {
  185. background-color: #ffffff;
  186. float: left;
  187. width: 100%;
  188. .condition {
  189. position: relative;
  190. /* float: left; */
  191. width: calc(100% - 40rpx);
  192. margin-left: 20rpx;
  193. margin-top: 40rpx;
  194. height: 80rpx;
  195. box-sizing: border-box;
  196. border-top: 1px solid #f0f0f0;
  197. padding: 0 22rpx;
  198. background: #FFFFFF;
  199. .head {
  200. float: left;
  201. height: 100%;
  202. display: flex;
  203. align-items: center;
  204. justify-content: flex-start;
  205. font-size: 28rpx;
  206. font-family: PingFangSC-Regular, PingFang SC;
  207. font-weight: 400;
  208. color: #333333;
  209. }
  210. .claend {
  211. width: 60rpx;
  212. height: 60rpx;
  213. }
  214. .content {
  215. float: right;
  216. height: 100%;
  217. display: flex;
  218. align-items: center;
  219. justify-content: flex-start;
  220. font-size: 28rpx;
  221. font-family: PingFangSC-Regular, PingFang SC;
  222. font-weight: 400;
  223. color: #4971F8;
  224. .datePicker {
  225. width: 500rpx;
  226. /deep/ .uni-date-x--border {
  227. border: none;
  228. }
  229. /deep/ .uniui-calendar {
  230. display: none;
  231. }
  232. }
  233. .icon_color {
  234. color: #333333;
  235. }
  236. }
  237. }
  238. }
  239. .body {
  240. position: relative;
  241. float: left;
  242. width: 100%;
  243. height: calc(100% - 300rpx);
  244. padding: 30rpx 20rpx 0 20rpx;
  245. background-color: #ffffff;
  246. }
  247. .nomore {
  248. float: left;
  249. width: 100%;
  250. text-align: center;
  251. }
  252. .taskList {
  253. position: relative;
  254. float: left;
  255. margin: 0 0 30rpx 0;
  256. width: 87%;
  257. border-radius: 16rpx;
  258. background-color: #ffffff;
  259. padding: 16rpx 30rpx;
  260. }
  261. .contentBody {
  262. position: relative;
  263. float: left;
  264. width: 100%;
  265. background-color: white;
  266. border-bottom-left-radius: 30rpx;
  267. border-bottom-right-radius: 30rpx;
  268. }
  269. .lightgray-text {
  270. font-size: 28rpx;
  271. white-space: nowrap;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. color: #333333;
  275. }
  276. .font-weight {
  277. font-weight: 600;
  278. }
  279. .nodata-warp{
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. padding: 100rpx 0;
  284. .nodata-image{
  285. width: 218rpx;
  286. height: 150rpx;
  287. }
  288. }
  289. </style>