| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>视频管理</span>
- </div>
- <div class="table-body">
- <el-form size="small" :inline="true" flex="dir:left cross:center">
- <div class="item-box" flex="dir:left cross:center">
- <div class="label">关联方式</div>
- <el-select v-model="search.related_type" @change='searchs' class="select" size="small">
- <el-option :key="0" label="所有视频" :value="0"></el-option>
- <el-option :key="1" label="商品" :value="1"></el-option>
- <el-option :key="3" label="地址" :value="3"></el-option>
- <!-- <el-option :key="4" label="店铺" :value="4"></el-option> -->
- </el-select>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-input size="small" style="width: 200px" v-model="search.video_title" placeholder="请输入视频标题"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-input size="small" style="width: 200px" v-model="search.user_nickname" placeholder="请输入会员昵称"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <div class="label">发布时间</div>
- <el-date-picker @change="selectedDateTime" size="small" v-model="time" type="datetimerange" value-format="timestamp" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
- </el-date-picker>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="searchs">搜索
- </el-button>
- </div>
- <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">
- <el-button size="small" type="warning" style="padding: 9px 15px !important;" @click="clearSearchs">清除搜索条件
- </el-button>
- </div>
- </el-form>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" @selection-change="handleSelectionChange">
- <el-table-column prop="id" label="视频ID" min-width="80" align="center"></el-table-column>
- <el-table-column prop="avatar_url,nickname" label="会员" min-width="180" align="center">
- <template slot-scope="scope">
- <div class="table-info-img-text">
- <el-image class="table-info-img circle" :src="scope.row.avatar_url">
- <div slot="error" class="image-slot">
- <com-image src="/resources/img/common/default-avatar.png"></com-image>
- </div>
- </el-image>
- <div class="table-info-text">
- <div v-if="scope.row.nickname">{{scope.row.nickname}} [ID: {{scope.row.user_id}}]</div>
- <div>{{scope.row.mobile}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="title" label="标题" min-width="150" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.title}}</div>
- </template>
- </el-table-column>
- <el-table-column prop="first_frame,video_url" label="发布视频" width="120" align="left">
- <template slot-scope="scope">
- <div flex="box:first">
- <div style="padding-right: 10px;">
- <el-tooltip placement="top" effect="light">
- <div class="index-video-url" slot="content">
- <video :src="scope.row.video_url" controls="controls">
- </video>
- </div>
- <com-image mode="aspectFill" :src="scope.row.first_frame"></com-image>
- </el-tooltip>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="发布时间" prop="created_at" min-width="160" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- </template>
- </el-table-column>
- <el-table-column label="关联类型" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.related_type==1">
- <template v-if="scope.row.goods_list.id">
- <el-tooltip placement="top" effect="light" popper-class="atooltip">
- <div class="index-related-info" slot="content">
- <div class="video-top">
- <div style="padding-right: 20px;">
- <image style="width: 70px;height: 70px;" mode="aspectFill" :src="scope.row.goods_list.cover_pic"></image>
- </div>
- <div class="top-right">
- <div class="top-title">{{scope.row.goods_list.name}}</div>
- <div class="wrapper">
- <div>商品id: </div>
- <div id="goods">{{scope.row.goods_list.id}}</div>
- <el-button type="primary" size="mini" class="to-copy" @click="copyText(scope.row.goods_list.id)">复制</el-button>
- </div>
- <div class="detail-price">¥{{scope.row.goods_list.price}}</div>
- </div>
- </div>
- </div>
- <div>商品</div>
- </el-tooltip>
- </template>
- <template v-else> <div>商品</div> </template>
- </div>
- <div v-else-if="scope.row.related_type==2">店铺</div>
- <div v-else-if="scope.row.related_type==3">地址</div>
- <div v-else-if="scope.row.related_type==4">暂无关联</div>
- </template>
- </el-table-column>
- <el-table-column label="观看人数" prop="look_people_num" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.look_people_num}}</div>
- </template>
- </el-table-column>
- <el-table-column label="分享/观看次数" prop="share_num" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.share_num||0}}/{{scope.row.look_num||0}}</div>
- </template>
- </el-table-column>
- <el-table-column label="转化金额" prop="frequency" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.conversion}}</div>
- </template>
- </el-table-column>
- <el-table-column label="观看奖励" prop="frequency" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.reward_money||0}}</div>
- </template>
- </el-table-column>
- <el-table-column label="观看积分" prop="frequency" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.reward_score||0}}</div>
- </template>
- </el-table-column>
- <el-table-column label="分红奖励" prop="dividend" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.dividend}}</div>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="操作" align="center" width="300">
- <template slot-scope="scope">
- <el-button @click="goingTop(scope.row.id,scope.row.is_top,scope.$index)" type="text" size="small">{{scope.row.is_top==0?'置顶':'取消置顶'}}</el-button>
- <el-button @click="toDetails(scope.row.id,scope.$index)" type="text" size="small">查看详情</el-button>
- <el-button @click="joinBlacklist(scope.row.id,scope.$index)" type="text" size="small">加入黑名单</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tabs>
- <!-- 分页器 -->
- <div flex="box:last cross:center">
- <div></div>
- <div>
- <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">
- </el-pagination>
- </div>
- </div>
- </div>
- <!-- 这个是复制用的容器,已隐藏 -->
- <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- page: 1,
- avatar: '',
- nickname: '',
- time: [], //本地存时间,请求时不发送
- search: {
- related_type: 0,
- video_title: null,
- user_nickname: null,
- start_time: null,
- end_time: null,
- },
- loading: false,
- activeName: '-1',
- list: [], //列表数据
- pagination: null,
- select: {
- nickname: '',
- status: 'first',
- },
- pageCount: 1,
- },
- mounted() {
- // 获取列表首页数据
- this.loadData(this.page, this.search); //获取列表数据
- },
- methods: {
- // 0.0.1 一键复制
- copyText(id) {
- // var text = document.getElementById("goods").innerText;
- var input = document.getElementById("inputs");
- input.value = id; // 修改文本框的内容
- input.select(); // 选中文本
- document.execCommand("copy"); // 执行浏览器复制命令
- this.$message.success('已成功复制商品id');
- },
- //1.0 跳转详情
- toDetails(id, index) {
- this.$navigate({
- r: 'short-video/default/video-detail',
- video_id: id
- })
- },
- // 1.1 置顶与取消置顶
- goingTop(id, is_top, index) {
- let self = this;
- let top_data = is_top == 0 ? 1 : 0;
- let confirmTitle = is_top == 0 ? '将该视频置顶, 是否继续?' : '取消该视频的置顶, 是否继续?';
- self.$confirm(confirmTitle, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.listLoading = true;
- console.log(id, '1111')
- request({
- params: {
- r: 'short-video/video/top',
- id: id,
- is_top: top_data,
- },
- method: 'get',
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- let newTop = is_top == 0 ? 1 : 0;
- self.$set(self.list[index], `is_top`, newTop);
- // self.list.splice(index, 1);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- }).catch(() => {
- self.$message.info('已取消')
- });
- },
- // 1.2 加入黑名单
- joinBlacklist(id, index) {
- let self = this;
- self.$confirm('将该视频加入黑名单, 是否继续', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.listLoading = true;
- request({
- params: {
- r: 'short-video/video/join-blacklist',
- id: id,
- },
- method: 'get',
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- self.list.splice(index, 1);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- }).catch(() => {
- self.$message.info('已取消')
- });
- },
- // 1.0 获取视频列表
- loadData(page, others) {
- this.loading = true;
- request({
- method: 'get',
- params: {
- r: 'short-video/default/index',
- page: page,
- related_type: this.search.related_type,
- video_title: this.search.video_title,
- user_nickname: this.search.user_nickname,
- start_time: this.search.start_time,
- end_time: this.search.end_time,
- },
- method: 'get'
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.list = e.data.data.list;
- this.pagination = e.data.data.pagination;
- this.pageCount = e.data.data.page_count;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {});
- },
- pageChange(page) {
- this.page = page;
- this.loadData(this.page, this.search);
- },
- handleClick(tab, event) {
- this.page = 1;
- this.search.status = this.activeName;
- this.loadData(this.page, this.search)
- },
- handleSelectionChange(val) {
- let self = this;
- self.choose_list = [];
- val.forEach(function(item) {
- self.choose_list.push(item.id);
- })
- },
- searchs() {
- this.page = 1;
- this.loadData(this.page, this.search);
- },
- clearSearchs() {
- this.search.related_type = 0;
- this.search.video_title = null;
- this.search.user_nickname = null;
- this.search.start_time = null;
- this.search.end_time = null;
- this.time = [];
- this.page = 1;
- this.loadData(this.page, this.search);
- },
- // 时间搜索选中
- selectedDateTime(val) {
- console.log(val);
- if (val) {
- this.search.start_time = val[0] / 1000;
- this.search.end_time = val[1] / 1000;
- } else {
- this.time = [];
- this.search.start_time = null;
- this.search.end_time = null;
- }
- this.loadData(1, this.search);
- },
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
- .item-box {
- margin-right: 20px;
- }
- .item-box .label {
- margin-right: 8px;
- }
- .form-nickname {
- width: 180px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .index-video-url {
- width: 300px;
- }
- .index-video-url video {
- width: 100%;
- }
- .index-related-info {
- width: 500px;
- }
- .video-top {
- width: 100%;
- display: flex;
- align-items: flex-start;
- box-sizing: border-box;
- padding: 20px;
- /* opacity: .5; */
- background-color: #FFFFFF;
- }
- .video-top .top-right {
- line-height: 26px;
- }
- .video-top .top-right .top-title {
- font-size: 18px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 360px;
- }
- .video-top .top-right .wrapper {
- display: flex;
- /* align-items: flex-start; */
- }
- .video-top .top-right .wrapper .to-copy {
- /* color: #03C5FF; */
- margin-left: 20px;
- }
- .video-top .top-right .detail-price {
- color: #BC0100;
- font-size: 18px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- }
- /* .atooltip {
- background: #FFFFFF !important;
- border: none !important;
- } */
- .el-table th>.cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper,
- .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- </style>
|