adList.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <a-row :gutter="10" class="list-pubu">
  3. <a-col :sm="24" style="margin-bottom: 20px;z-index: 10">
  4. <a-card :bordered="false">
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="24">
  8. <a-col :md="10" :sm="10">
  9. <a-form-item label="排序">
  10. <a-radio-group v-model="queryParam.sortType">
  11. <a-radio-button :value="1">按播放数</a-radio-button>
  12. <a-radio-button :value="2">按点赞量</a-radio-button>
  13. <a-radio-button :value="3">按评论数</a-radio-button>
  14. </a-radio-group>
  15. </a-form-item>
  16. </a-col>
  17. <!-- <a-col :md="6" :sm="6">
  18. <a-form-item>
  19. <a-radio-group v-model="queryParam.orderByType">
  20. <a-radio-button value="asc">正序</a-radio-button>
  21. <a-radio-button value="desc">倒序</a-radio-button>
  22. </a-radio-group>
  23. </a-form-item>
  24. </a-col> -->
  25. <a-col :md="8" :sm="8">
  26. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  27. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </div>
  32. <app-ad-modal ref="modalForm"></app-ad-modal>
  33. </a-card>
  34. </a-col>
  35. <vue-waterfall-easy
  36. class="adcover_waterfall_container"
  37. ref="waterfall"
  38. :imgsArr="imgsArr"
  39. @click="handleDetail"
  40. @scrollReachBottom="getData"
  41. style="height: 800px;"
  42. >
  43. <div class="img-info" slot-scope="props">
  44. <div class="some-info">
  45. <ul>
  46. <li>
  47. <b>发布人:</b>
  48. <span>{{ props.value.nickName }}</span>
  49. </li>
  50. <li>
  51. <b>播放:</b>
  52. <span>{{ props.value.playingTime }}</span>
  53. </li>
  54. <li>
  55. <b>评论:</b>
  56. <span>{{ props.value.commentTime }}</span>
  57. </li>
  58. <li>
  59. <b>点赞:</b>
  60. <span>{{ props.value.likeTime }}</span>
  61. </li>
  62. </ul>
  63. </div>
  64. </div>
  65. <div slot="waterfall-over">无更多数据</div>
  66. </vue-waterfall-easy>
  67. <div class="scroll_top">
  68. <a-icon type="to-top" />
  69. </div>
  70. </a-row>
  71. </template>
  72. <script>
  73. import { getAction } from '@/api/manage'
  74. import { filterObj } from '@/utils/util'
  75. import vueWaterfallEasy from 'vue-waterfall-easy'
  76. import AppAdModal from './modules/AppAdModal'
  77. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  78. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  79. import ARow from 'ant-design-vue/es/grid/Row'
  80. import ACol from 'ant-design-vue/es/grid/Col'
  81. import AFormItem from 'ant-design-vue/es/form/FormItem'
  82. import moment from 'moment'
  83. import $ from 'jquery'
  84. let timeout
  85. let currentValue
  86. function fetch(value, callback) {
  87. if (timeout) {
  88. clearTimeout(timeout)
  89. timeout = null
  90. }
  91. currentValue = value
  92. function fake() {}
  93. timeout = setTimeout(fake, 300)
  94. }
  95. $(function() {
  96. $('.scroll_top').click(function() {
  97. $('.vue-waterfall-easy-scroll').animate(
  98. {
  99. scrollTop: 0
  100. },
  101. 500
  102. )
  103. return false
  104. })
  105. $('.vue-waterfall-easy-scroll').scroll(function() {
  106. var top = $('.vue-waterfall-easy-scroll').scrollTop()
  107. if (top >= 100) {
  108. $('.scroll_top').fadeIn()
  109. } else {
  110. $('.scroll_top').fadeOut()
  111. }
  112. })
  113. })
  114. export default {
  115. name: 'waterfall',
  116. data() {
  117. return {
  118. queryParam: {
  119. sortType: 1
  120. },
  121. time: [],
  122. companyData: [],
  123. productData: [],
  124. value: undefined,
  125. imgsArr: [],
  126. pageNo: 1, // request param
  127. url: {
  128. feedsUrl: '/ctop/kuaishouHotPhotoInfo/list',
  129. companySugestUrl: '/ctop/kuaishou/advertiser/companysugest',
  130. productSugestUrl: '/ctop/kuaishou/advertiser/productsugest',
  131. list: '/ctop/kuaishouHotPhotoInfo/list'
  132. },
  133. validatorRules: {
  134. pid: {},
  135. name: {},
  136. code: {}
  137. },
  138. pidField: 'pid',
  139. isCoverStar: false // 收藏
  140. }
  141. },
  142. components: {
  143. AFormItem,
  144. ACol,
  145. ARow,
  146. vueWaterfallEasy,
  147. AppAdModal,
  148. JTreeSelect
  149. },
  150. mixins: [JeecgListMixin],
  151. methods: {
  152. searchQuery() {
  153. this.imgsArr = []
  154. this.ipagination.current = 1
  155. if (this.time != null && this.time.length > 0) {
  156. this.queryParam.start = moment(this.time[0]).format('YYYY-MM-DD')
  157. this.queryParam.end = moment(this.time[1]).format('YYYY-MM-DD')
  158. }
  159. this.getData()
  160. },
  161. searchReset() {
  162. this.queryParam = {
  163. sortType: 1
  164. }
  165. this.imgsArr = []
  166. this.time = []
  167. this.ipagination.current = 1
  168. this.ipagination.pageSize = 20
  169. this.getData()
  170. },
  171. handleProductSearch(value) {
  172. getAction(this.url.productSugestUrl, { product: value }).then(res => {
  173. console.log(res)
  174. if (currentValue === value) {
  175. const result = res.result
  176. const data = []
  177. result.forEach(r => {
  178. data.push({
  179. value: r,
  180. text: r
  181. })
  182. })
  183. this.productData = data
  184. }
  185. })
  186. fetch(value)
  187. },
  188. handleProductChange(value) {
  189. this.value = value
  190. fetch(value, data => (this.productData = data))
  191. },
  192. handleCompanySearch(value) {
  193. getAction(this.url.companySugestUrl, { company: value }).then(res => {
  194. if (currentValue === value) {
  195. const result = res.result
  196. const data = []
  197. result.forEach(r => {
  198. data.push({
  199. value: r,
  200. text: r
  201. })
  202. })
  203. this.companyData = data
  204. }
  205. })
  206. fetch(value)
  207. },
  208. handleCompanyChange(value) {
  209. this.value = value
  210. fetch(value, data => (this.companyData = data))
  211. },
  212. handleDetail(event, { index, value }) {
  213. this.$refs.modalForm.show(value)
  214. this.$refs.modalForm.title = '详情'
  215. },
  216. flushData() {
  217. this.imgsArr = []
  218. this.pageNo = 1
  219. this.getData()
  220. },
  221. modalFormOk() {},
  222. getQueryParams() {
  223. //获取查询条件
  224. var param = Object.assign(this.queryParam)
  225. param.pageNo = this.ipagination.current
  226. param.pageSize = 20
  227. return filterObj(param)
  228. },
  229. getData() {
  230. var params = this.getQueryParams() //查询条件
  231. console.log(params)
  232. getAction(this.url.feedsUrl, params).then(res => {
  233. console.log(res)
  234. this.ipagination.current = this.ipagination.current + 1
  235. if (res.success) {
  236. if (res.result.records.length == 0) {
  237. this.$refs.waterfall.waterfallOver()
  238. return
  239. }
  240. var arr = res.result.records.map(item => {
  241. return {
  242. ...item,
  243. src: item.coverThumbnailUrl
  244. }
  245. })
  246. this.imgsArr = this.imgsArr.concat(arr)
  247. // for (var i = 0; i < res.result.records.length; i++) {
  248. // let arr = {}
  249. // arr.id = res.result.records[i].id
  250. // arr.mid = res.result.records[i].mid
  251. // arr.title = res.result.records[i].title
  252. // arr.play = res.result.records[i].play
  253. // arr.share = res.result.records[i].share
  254. // arr.comment = res.result.records[i].comment
  255. // arr.coverImage = res.result.records[i].coverThumbnailUrl
  256. // arr.src = res.result.records[i].coverThumbnailUrl
  257. // arr.url = res.result.records[i].mainMvUrl
  258. // arr.videoId = res.result.records[i].video_id
  259. // arr.coreUserId = res.result.records[i].core_user_id
  260. // arr.nickName = res.result.records[i].nickName
  261. // arr.headImageUri = res.result.records[i].head_image_uri
  262. // arr.likeCnt = res.result.records[i].like_cnt
  263. // arr.createTime = res.result.records[i].createTime
  264. // this.imgsArr = this.imgsArr.concat(arr)
  265. // }
  266. }
  267. })
  268. }
  269. },
  270. created() {
  271. this.getData()
  272. }
  273. }
  274. </script>
  275. <style lang="scss">
  276. .adcover_waterfall_container {
  277. .img-box {
  278. .img-inner-box {
  279. position: relative;
  280. cursor: pointer;
  281. -webkit-transition: all 0.3s;
  282. transition: all 0.3s;
  283. .img-wraper {
  284. // height: 427px!important;
  285. img {
  286. }
  287. }
  288. .img-info {
  289. position: relative;
  290. // height: 146px!important;
  291. .some-info {
  292. color: rgba(0, 0, 0, 0.65);
  293. padding: 10px;
  294. ul {
  295. margin: 0;
  296. padding: 0;
  297. li {
  298. list-style: none;
  299. padding: 0;
  300. margin: 0;
  301. }
  302. }
  303. }
  304. .cover_star {
  305. position: absolute;
  306. right: 0;
  307. bottom: 0;
  308. padding: 10px;
  309. z-index: 1;
  310. color: rgba(0, 0, 0, 0.65);
  311. .coverStar {
  312. color: red;
  313. }
  314. }
  315. }
  316. }
  317. }
  318. }
  319. .scroll_top {
  320. position: fixed;
  321. z-index: 9;
  322. right: 80px;
  323. bottom: 40px;
  324. display: none;
  325. cursor: pointer;
  326. color: #1890ff;
  327. font-size: 40px;
  328. }
  329. </style>
  330. <style>
  331. .list-pubu .ball-beat {
  332. height: 100px;
  333. }
  334. .list-pubu .loading {
  335. position: fixed !important;
  336. z-index: 10 !important;
  337. left: 60% !important;
  338. bottom: 0 !important;
  339. }
  340. .sider.light {
  341. z-index: 11;
  342. }
  343. </style>