AdList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <a-row :gutter="10">
  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 label="行业">
  10. <j-tree-select
  11. v-model="queryParam.industry"
  12. ref="treeSelect"
  13. placeholder="请选择行业"
  14. v-decorator="['pid', validatorRules.pid]"
  15. dict="sys_category,name,id"
  16. pidField="pid"
  17. pidValue="67d69117968be1eecb1e705b399b9d93">
  18. </j-tree-select>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="8" :sm="8">
  22. <a-form-item label="广告主公司">
  23. <a-select
  24. showSearch
  25. v-model="queryParam.company"
  26. placeholder="请输入公司名称"
  27. style="width: 300px"
  28. :defaultActiveFirstOption="false"
  29. :showArrow="false"
  30. :filterOption="false"
  31. @search="handleCompanySearch"
  32. @change="handleCompanyChange"
  33. :notFoundContent="null"
  34. >
  35. <a-select-option v-for="d in companyData" :key="d.value">{{d.text}}</a-select-option>
  36. </a-select>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="8" :sm="8">
  40. <a-form-item label="推广产品">
  41. <a-select
  42. showSearch
  43. v-model="queryParam.product"
  44. placeholder="请输入产品名称"
  45. style="width: 300px"
  46. :defaultActiveFirstOption="false"
  47. :showArrow="false"
  48. :filterOption="false"
  49. @search="handleProductSearch"
  50. @change="handleProductChange"
  51. :notFoundContent="null"
  52. >
  53. <a-select-option v-for="d in productData" :key="d.value">{{d.text}}</a-select-option>
  54. </a-select>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="8" :sm="8">
  58. <a-form-item
  59. label="发布日期"
  60. :labelCol="{lg: {span: 7}, sm: {span: 7}}"
  61. :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
  62. <a-range-picker
  63. name="buildTime"
  64. style="width: 100%"
  65. v-model="time"
  66. />
  67. </a-form-item>
  68. </a-col>
  69. <a-col :md="8" :sm="8">
  70. <a-form-item label="发布人">
  71. <a-input placeholder="请输入发布人昵称" v-model="queryParam.userName"></a-input>
  72. </a-form-item>
  73. </a-col>
  74. </a-row>
  75. <a-row :gutter="24">
  76. <a-col :md="10" :sm="10">
  77. <a-form-item label="排序">
  78. <a-radio-group v-model="queryParam.orderByColumn">
  79. <a-radio-button value="create_time">按抓取时间</a-radio-button>
  80. <a-radio-button value="time">按发布时间</a-radio-button>
  81. <a-radio-button value="view_count">按展示数</a-radio-button>
  82. <a-radio-button value="like_count">按喜欢数</a-radio-button>
  83. <a-radio-button value="comment_count">按评论数</a-radio-button>
  84. </a-radio-group>
  85. </a-form-item>
  86. </a-col>
  87. <a-col :md="6" :sm="6">
  88. <a-form-item>
  89. <a-radio-group v-model="queryParam.orderByType">
  90. <a-radio-button value="asc">正序</a-radio-button>
  91. <a-radio-button value="desc">倒序</a-radio-button>
  92. </a-radio-group>
  93. </a-form-item>
  94. </a-col>
  95. <a-col :md="8" :sm="8">
  96. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  97. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  98. </a-col>
  99. </a-row>
  100. </a-form>
  101. </div>
  102. <app-ad-modal ref="modalForm"></app-ad-modal>
  103. </a-card>
  104. </a-col>
  105. <vue-waterfall-easy ref="waterfall" :imgsArr="imgsArr" @click="handleDetail" @scrollReachBottom="getData"
  106. style="height: 800px;">
  107. <div class="img-info" slot-scope="props">
  108. <p class="some-info">发布人:{{props.value.userName}},质量分:{{props.value.score}}<br/>发布时间:{{props.value.time}}<br/>展示:{{props.value.viewCount}},喜欢:{{props.value.likeCount}},评论:{{props.value.commentCount}}
  109. </p>
  110. </div>
  111. <div slot="waterfall-over">无更多数据</div>
  112. </vue-waterfall-easy>
  113. </a-row>
  114. </template>
  115. <script>
  116. import {getAction} from '@/api/manage'
  117. import {filterObj} from '@/utils/util'
  118. import vueWaterfallEasy from 'vue-waterfall-easy'
  119. import AppAdModal from './modules/AppAdModal'
  120. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  121. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  122. import ARow from "ant-design-vue/es/grid/Row"
  123. import ACol from "ant-design-vue/es/grid/Col"
  124. import AFormItem from "ant-design-vue/es/form/FormItem"
  125. import moment from "moment"
  126. let timeout;
  127. let currentValue;
  128. function fetch(value, callback) {
  129. if (timeout) {
  130. clearTimeout(timeout);
  131. timeout = null;
  132. }
  133. currentValue = value;
  134. function fake() {
  135. }
  136. timeout = setTimeout(fake, 300);
  137. }
  138. export default {
  139. name: 'waterfall',
  140. // mixins:[JeecgListMixin],
  141. data() {
  142. return {
  143. queryParam: {
  144. orderByColumn: 'create_time',
  145. orderByType: 'desc',
  146. start: '',
  147. end: ''
  148. },
  149. time: [],
  150. companyData: [],
  151. productData: [],
  152. value: undefined,
  153. imgsArr: [],
  154. pageNo: 1,// request param
  155. url: {
  156. feedsUrl: '/ctop/adcover/feeds',
  157. companySugestUrl: '/ctop/kuaishou/advertiser/companysugest',
  158. productSugestUrl: '/ctop/kuaishou/advertiser/productsugest',
  159. list: '/ctop/adcover/feeds',
  160. },
  161. validatorRules: {
  162. pid: {},
  163. name: {},
  164. code: {},
  165. },
  166. pidField: "pid"
  167. }
  168. },
  169. components: {
  170. AFormItem,
  171. ACol,
  172. ARow,
  173. vueWaterfallEasy,
  174. AppAdModal,
  175. JTreeSelect,
  176. },
  177. mixins: [JeecgListMixin],
  178. methods: {
  179. searchQuery() {
  180. this.imgsArr = []
  181. this.ipagination.current = 1
  182. if (this.time != null && this.time.length > 0) {
  183. this.queryParam.start = moment(this.time[0]).format('YYYY-MM-DD')
  184. this.queryParam.end = moment(this.time[1]).format('YYYY-MM-DD')
  185. }
  186. this.getData();
  187. },
  188. searchReset() {
  189. this.queryParam = {
  190. orderByColumn: 'create_time',
  191. orderByType: 'desc'
  192. }
  193. this.imgsArr = []
  194. this.time = []
  195. this.ipagination.current = 1
  196. this.ipagination.pageSize = 20
  197. this.getData();
  198. },
  199. handleProductSearch(value) {
  200. getAction(this.url.productSugestUrl, {product: value})
  201. .then((res) => {
  202. console.log(res)
  203. if (currentValue === value) {
  204. const result = res.result;
  205. const data = [];
  206. result.forEach((r) => {
  207. data.push({
  208. value: r,
  209. text: r,
  210. });
  211. });
  212. this.productData = data
  213. }
  214. });
  215. fetch(value);
  216. },
  217. handleProductChange(value) {
  218. this.value = value
  219. fetch(value, data => this.productData = data);
  220. },
  221. handleCompanySearch(value) {
  222. getAction(this.url.companySugestUrl, {company: value})
  223. .then((res) => {
  224. if (currentValue === value) {
  225. const result = res.result;
  226. const data = [];
  227. result.forEach((r) => {
  228. data.push({
  229. value: r,
  230. text: r,
  231. });
  232. });
  233. this.companyData = data
  234. }
  235. });
  236. fetch(value);
  237. },
  238. handleCompanyChange(value) {
  239. this.value = value
  240. fetch(value, data => this.companyData = data);
  241. },
  242. handleDetail(event, {index, value}) {
  243. this.$refs.modalForm.show(value.photoId, value.userId);
  244. this.$refs.modalForm.title = "详情";
  245. },
  246. flushData() {
  247. this.imgsArr = []
  248. this.pageNo = 1
  249. this.getData()
  250. },
  251. modalFormOk() {
  252. },
  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.length == 0) {
  268. this.$refs.waterfall.waterfallOver()
  269. return
  270. }
  271. for (var i = 0; i < res.result.length; i++) {
  272. let arr = {}
  273. arr.coverId = res.result[i].coverId
  274. arr.src = res.result[i].coverUrl
  275. arr.time = res.result[i].time
  276. arr.userName = res.result[i].userName
  277. arr.viewCount = res.result[i].viewCount
  278. arr.likeCount = res.result[i].likeCount
  279. arr.commentCount = res.result[i].commentCount
  280. arr.score = res.result[i].score
  281. arr.userId = res.result[i].userId
  282. arr.photoId = res.result[i].photoId
  283. //arr.href=res.result.records[i].mvUrl
  284. this.imgsArr = this.imgsArr.concat(arr)
  285. }
  286. }
  287. })
  288. },
  289. },
  290. created() {
  291. this.getData()
  292. }
  293. }
  294. </script>
  295. <style scoped>
  296. </style>