AdList.vue 10 KB

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