index.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <span>视频管理</span>
  5. </div>
  6. <div class="table-body">
  7. <el-form size="small" :inline="true" flex="dir:left cross:center">
  8. <div class="item-box" flex="dir:left cross:center">
  9. <div class="label">关联方式</div>
  10. <el-select v-model="search.related_type" @change='searchs' class="select" size="small">
  11. <el-option :key="0" label="所有视频" :value="0"></el-option>
  12. <el-option :key="1" label="商品" :value="1"></el-option>
  13. <el-option :key="3" label="地址" :value="3"></el-option>
  14. <!-- <el-option :key="4" label="店铺" :value="4"></el-option> -->
  15. </el-select>
  16. </div>
  17. <div class="item-box" flex="dir:left cross:center">
  18. <el-input size="small" style="width: 200px" v-model="search.video_title" placeholder="请输入视频标题"></el-input>
  19. </div>
  20. <div class="item-box" flex="dir:left cross:center">
  21. <el-input size="small" style="width: 200px" v-model="search.user_nickname" placeholder="请输入会员昵称"></el-input>
  22. </div>
  23. <div class="item-box" flex="dir:left cross:center">
  24. <div class="label">发布时间</div>
  25. <el-date-picker @change="selectedDateTime" size="small" v-model="time" type="datetimerange" value-format="timestamp" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  26. </el-date-picker>
  27. </div>
  28. <div class="item-box" flex="dir:left cross:center">
  29. <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="searchs">搜索
  30. </el-button>
  31. </div>
  32. <div class="item-box" flex="dir:left cross:center" v-if="search.related_type!=0 || search.video_title || search.user_nickname || search.start_time || search.end_time">
  33. <el-button size="small" type="warning" style="padding: 9px 15px !important;" @click="clearSearchs">清除搜索条件
  34. </el-button>
  35. </div>
  36. </el-form>
  37. <el-tabs v-model="activeName" @tab-click="handleClick">
  38. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" @selection-change="handleSelectionChange">
  39. <el-table-column prop="id" label="视频ID" min-width="80" align="center"></el-table-column>
  40. <el-table-column prop="avatar_url,nickname" label="会员" min-width="180" align="center">
  41. <template slot-scope="scope">
  42. <div class="table-info-img-text">
  43. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  44. <div slot="error" class="image-slot">
  45. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  46. </div>
  47. </el-image>
  48. <div class="table-info-text">
  49. <div v-if="scope.row.nickname">{{scope.row.nickname}} [ID: {{scope.row.user_id}}]</div>
  50. <div>{{scope.row.mobile}}</div>
  51. </div>
  52. </div>
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="title" label="标题" min-width="150" align="center">
  56. <template slot-scope="scope">
  57. <div>{{scope.row.title}}</div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="first_frame,video_url" label="发布视频" width="120" align="left">
  61. <template slot-scope="scope">
  62. <div flex="box:first">
  63. <div style="padding-right: 10px;">
  64. <el-tooltip placement="top" effect="light">
  65. <div class="index-video-url" slot="content">
  66. <video :src="scope.row.video_url" controls="controls">
  67. </video>
  68. </div>
  69. <com-image mode="aspectFill" :src="scope.row.first_frame"></com-image>
  70. </el-tooltip>
  71. </div>
  72. </div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="发布时间" prop="created_at" min-width="160" align="center">
  76. <template slot-scope="scope">
  77. <div>{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="关联类型" align="center">
  81. <template slot-scope="scope">
  82. <div v-if="scope.row.related_type==1">
  83. <template v-if="scope.row.goods_list.id">
  84. <el-tooltip placement="top" effect="light" popper-class="atooltip">
  85. <div class="index-related-info" slot="content">
  86. <div class="video-top">
  87. <div style="padding-right: 20px;">
  88. <image style="width: 70px;height: 70px;" mode="aspectFill" :src="scope.row.goods_list.cover_pic"></image>
  89. </div>
  90. <div class="top-right">
  91. <div class="top-title">{{scope.row.goods_list.name}}</div>
  92. <div class="wrapper">
  93. <div>商品id: </div>
  94. <div id="goods">{{scope.row.goods_list.id}}</div>
  95. <el-button type="primary" size="mini" class="to-copy" @click="copyText(scope.row.goods_list.id)">复制</el-button>
  96. </div>
  97. <div class="detail-price">¥{{scope.row.goods_list.price}}</div>
  98. </div>
  99. </div>
  100. </div>
  101. <div>商品</div>
  102. </el-tooltip>
  103. </template>
  104. <template v-else> <div>商品</div> </template>
  105. </div>
  106. <div v-else-if="scope.row.related_type==2">店铺</div>
  107. <div v-else-if="scope.row.related_type==3">地址</div>
  108. <div v-else-if="scope.row.related_type==4">暂无关联</div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="观看人数" prop="look_people_num" align="center">
  112. <template slot-scope="scope">
  113. <div>{{scope.row.look_people_num}}</div>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="分享/观看次数" prop="share_num" align="center">
  117. <template slot-scope="scope">
  118. <div>{{scope.row.share_num||0}}/{{scope.row.look_num||0}}</div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="转化金额" prop="frequency" align="center">
  122. <template slot-scope="scope">
  123. <div>{{scope.row.conversion}}</div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="观看奖励" prop="frequency" align="center">
  127. <template slot-scope="scope">
  128. <div>{{scope.row.reward_money||0}}</div>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="观看积分" prop="frequency" align="center">
  132. <template slot-scope="scope">
  133. <div>{{scope.row.reward_score||0}}</div>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="分红奖励" prop="dividend" align="center">
  137. <template slot-scope="scope">
  138. <div>{{scope.row.dividend}}</div>
  139. </template>
  140. </el-table-column>
  141. <el-table-column fixed="right" label="操作" align="center" width="300">
  142. <template slot-scope="scope">
  143. <el-button @click="goingTop(scope.row.id,scope.row.is_top,scope.$index)" type="text" size="small">{{scope.row.is_top==0?'置顶':'取消置顶'}}</el-button>
  144. <el-button @click="toDetails(scope.row.id,scope.$index)" type="text" size="small">查看详情</el-button>
  145. <el-button @click="joinBlacklist(scope.row.id,scope.$index)" type="text" size="small">加入黑名单</el-button>
  146. </template>
  147. </el-table-column>
  148. </el-table>
  149. </el-tabs>
  150. <!-- 分页器 -->
  151. <div flex="box:last cross:center">
  152. <div></div>
  153. <div>
  154. <el-pagination v-if="list.length > 0" style="display: inline-block;float: right;" background :page-size="pagination.pageSize" @current-change="pageChange" layout="prev, pager, next" :current-page="pagination.current_page" :page-count="pageCount">
  155. </el-pagination>
  156. </div>
  157. </div>
  158. </div>
  159. <!-- 这个是复制用的容器,已隐藏 -->
  160. <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
  161. </el-card>
  162. </div>
  163. <script>
  164. const app = new Vue({
  165. el: '#app',
  166. data: {
  167. page: 1,
  168. avatar: '',
  169. nickname: '',
  170. time: [], //本地存时间,请求时不发送
  171. search: {
  172. related_type: 0,
  173. video_title: null,
  174. user_nickname: null,
  175. start_time: null,
  176. end_time: null,
  177. },
  178. loading: false,
  179. activeName: '-1',
  180. list: [], //列表数据
  181. pagination: null,
  182. select: {
  183. nickname: '',
  184. status: 'first',
  185. },
  186. pageCount: 1,
  187. },
  188. mounted() {
  189. // 获取列表首页数据
  190. this.loadData(this.page, this.search); //获取列表数据
  191. },
  192. methods: {
  193. // 0.0.1 一键复制
  194. copyText(id) {
  195. // var text = document.getElementById("goods").innerText;
  196. var input = document.getElementById("inputs");
  197. input.value = id; // 修改文本框的内容
  198. input.select(); // 选中文本
  199. document.execCommand("copy"); // 执行浏览器复制命令
  200. this.$message.success('已成功复制商品id');
  201. },
  202. //1.0 跳转详情
  203. toDetails(id, index) {
  204. this.$navigate({
  205. r: 'short-video/default/video-detail',
  206. video_id: id
  207. })
  208. },
  209. // 1.1 置顶与取消置顶
  210. goingTop(id, is_top, index) {
  211. let self = this;
  212. let top_data = is_top == 0 ? 1 : 0;
  213. let confirmTitle = is_top == 0 ? '将该视频置顶, 是否继续?' : '取消该视频的置顶, 是否继续?';
  214. self.$confirm(confirmTitle, '提示', {
  215. confirmButtonText: '确定',
  216. cancelButtonText: '取消',
  217. type: 'warning'
  218. }).then(() => {
  219. self.listLoading = true;
  220. console.log(id, '1111')
  221. request({
  222. params: {
  223. r: 'short-video/video/top',
  224. id: id,
  225. is_top: top_data,
  226. },
  227. method: 'get',
  228. }).then(e => {
  229. self.listLoading = false;
  230. if (e.data.code === 0) {
  231. self.$message.success(e.data.msg);
  232. let newTop = is_top == 0 ? 1 : 0;
  233. self.$set(self.list[index], `is_top`, newTop);
  234. // self.list.splice(index, 1);
  235. } else {
  236. self.$message.error(e.data.msg);
  237. }
  238. }).catch(e => {
  239. console.log(e);
  240. });
  241. }).catch(() => {
  242. self.$message.info('已取消')
  243. });
  244. },
  245. // 1.2 加入黑名单
  246. joinBlacklist(id, index) {
  247. let self = this;
  248. self.$confirm('将该视频加入黑名单, 是否继续', '提示', {
  249. confirmButtonText: '确定',
  250. cancelButtonText: '取消',
  251. type: 'warning'
  252. }).then(() => {
  253. self.listLoading = true;
  254. request({
  255. params: {
  256. r: 'short-video/video/join-blacklist',
  257. id: id,
  258. },
  259. method: 'get',
  260. }).then(e => {
  261. self.listLoading = false;
  262. if (e.data.code === 0) {
  263. self.$message.success(e.data.msg);
  264. self.list.splice(index, 1);
  265. } else {
  266. self.$message.error(e.data.msg);
  267. }
  268. }).catch(e => {
  269. console.log(e);
  270. });
  271. }).catch(() => {
  272. self.$message.info('已取消')
  273. });
  274. },
  275. // 1.0 获取视频列表
  276. loadData(page, others) {
  277. this.loading = true;
  278. request({
  279. method: 'get',
  280. params: {
  281. r: 'short-video/default/index',
  282. page: page,
  283. related_type: this.search.related_type,
  284. video_title: this.search.video_title,
  285. user_nickname: this.search.user_nickname,
  286. start_time: this.search.start_time,
  287. end_time: this.search.end_time,
  288. },
  289. method: 'get'
  290. }).then(e => {
  291. this.loading = false;
  292. if (e.data.code === 0) {
  293. this.list = e.data.data.list;
  294. this.pagination = e.data.data.pagination;
  295. this.pageCount = e.data.data.page_count;
  296. } else {
  297. this.$message.error(e.data.msg);
  298. }
  299. }).catch(e => {});
  300. },
  301. pageChange(page) {
  302. this.page = page;
  303. this.loadData(this.page, this.search);
  304. },
  305. handleClick(tab, event) {
  306. this.page = 1;
  307. this.search.status = this.activeName;
  308. this.loadData(this.page, this.search)
  309. },
  310. handleSelectionChange(val) {
  311. let self = this;
  312. self.choose_list = [];
  313. val.forEach(function(item) {
  314. self.choose_list.push(item.id);
  315. })
  316. },
  317. searchs() {
  318. this.page = 1;
  319. this.loadData(this.page, this.search);
  320. },
  321. clearSearchs() {
  322. this.search.related_type = 0;
  323. this.search.video_title = null;
  324. this.search.user_nickname = null;
  325. this.search.start_time = null;
  326. this.search.end_time = null;
  327. this.time = [];
  328. this.page = 1;
  329. this.loadData(this.page, this.search);
  330. },
  331. // 时间搜索选中
  332. selectedDateTime(val) {
  333. console.log(val);
  334. if (val) {
  335. this.search.start_time = val[0] / 1000;
  336. this.search.end_time = val[1] / 1000;
  337. } else {
  338. this.time = [];
  339. this.search.start_time = null;
  340. this.search.end_time = null;
  341. }
  342. this.loadData(1, this.search);
  343. },
  344. }
  345. });
  346. </script>
  347. <style>
  348. .el-tabs__header {
  349. font-size: 16px;
  350. }
  351. .table-body {
  352. padding: 20px;
  353. background-color: #fff;
  354. }
  355. .table-body .el-button {
  356. padding: 0 !important;
  357. border: 0;
  358. margin: 0 5px;
  359. }
  360. .input-item {
  361. width: 250px;
  362. margin: 0 0 20px;
  363. display: inline-block;
  364. }
  365. .input-item .el-input__inner {
  366. border-right: 0;
  367. }
  368. .input-item .el-input__inner:hover {
  369. border: 1px solid #dcdfe6;
  370. border-right: 0;
  371. outline: 0;
  372. }
  373. .input-item .el-input__inner:focus {
  374. border: 1px solid #dcdfe6;
  375. border-right: 0;
  376. outline: 0;
  377. }
  378. .input-item .el-input-group__append {
  379. background-color: #fff;
  380. border-left: 0;
  381. width: 10%;
  382. padding: 0;
  383. }
  384. .input-item .el-input-group__append .el-button {
  385. padding: 0;
  386. }
  387. .input-item .el-input-group__append .el-button {
  388. margin: 0;
  389. }
  390. .batch {
  391. margin: 0 0 20px;
  392. display: inline-block;
  393. }
  394. .batch .el-button {
  395. padding: 9px 15px !important;
  396. }
  397. .item-box {
  398. margin-right: 20px;
  399. }
  400. .item-box .label {
  401. margin-right: 8px;
  402. }
  403. .form-nickname {
  404. width: 180px;
  405. white-space: nowrap;
  406. overflow: hidden;
  407. text-overflow: ellipsis;
  408. }
  409. .index-video-url {
  410. width: 300px;
  411. }
  412. .index-video-url video {
  413. width: 100%;
  414. }
  415. .index-related-info {
  416. width: 500px;
  417. }
  418. .video-top {
  419. width: 100%;
  420. display: flex;
  421. align-items: flex-start;
  422. box-sizing: border-box;
  423. padding: 20px;
  424. /* opacity: .5; */
  425. background-color: #FFFFFF;
  426. }
  427. .video-top .top-right {
  428. line-height: 26px;
  429. }
  430. .video-top .top-right .top-title {
  431. font-size: 18px;
  432. white-space: nowrap;
  433. overflow: hidden;
  434. text-overflow: ellipsis;
  435. width: 360px;
  436. }
  437. .video-top .top-right .wrapper {
  438. display: flex;
  439. /* align-items: flex-start; */
  440. }
  441. .video-top .top-right .wrapper .to-copy {
  442. /* color: #03C5FF; */
  443. margin-left: 20px;
  444. }
  445. .video-top .top-right .detail-price {
  446. color: #BC0100;
  447. font-size: 18px;
  448. font-family: Microsoft YaHei;
  449. font-weight: bold;
  450. }
  451. /* .atooltip {
  452. background: #FFFFFF !important;
  453. border: none !important;
  454. } */
  455. .el-table th>.cell {
  456. color: #333;
  457. font-weight: bold;
  458. font-size: 14px;
  459. }
  460. .el-table__footer-wrapper,
  461. .el-table__header-wrapper {
  462. border-bottom: 1.4px solid #D6D6D6;
  463. }
  464. </style>