123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <!-- 内容管理 视频管理 -->
- <template>
- <div class="app-container">
- <!-- 搜索 -->
- <el-form inline size="mini">
- <el-form-item label="创建时间:">
- <el-date-picker
- v-model="form.listDate"
- type="datetimerange"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- value-format="yyyy-MM-dd HH:mm:ss"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" @click="getSearch"
- >搜索</el-button
- >
- <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
- <el-button
- type="primary"
- icon="el-icon-plus"
- plain
- @click="getDetail()"
- v-hasPermi="['content:video:add']"
- >新增</el-button
- >
- </el-form-item>
- </el-form>
- <!-- 列表 -->
- <el-table :data="tableData" v-loading="loading">
- <el-table-column
- label="序号"
- type="index"
- align="center"
- ></el-table-column>
- <el-table-column
- label="视频宣传名称"
- prop="name"
- align="center"
- ></el-table-column>
- <el-table-column
- label="更新时间"
- prop="updateTime"
- align="center"
- ></el-table-column>
- <el-table-column
- label="创建时间"
- prop="createTime"
- align="center"
- ></el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="getDetail(scope.row.id, true)"
- >查看</el-button
- >
- <el-button
- type="text"
- @click="getDetail(scope.row.id)"
- v-hasPermi="['content:video:edit']"
- >编辑</el-button
- >
- <el-button
- type="text"
- v-clipboard:copy="getUrl(scope.row)"
- v-clipboard:success="copySuccess"
- >复制链接</el-button
- >
- <el-button type="text" @click="getCode(scope.row.id)"
- >下载二维码</el-button
- >
- <el-button
- type="delete"
- @click="getDelete(scope.row)"
- v-hasPermi="['content:video:delete']"
- >删除</el-button
- >
- <vue-qr
- :text="getUrl(scope.row)"
- :ref="`qrcode` + scope.row.id"
- style="display: none"
- />
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="form.pageNum"
- :limit.sync="form.pageSize"
- @pagination="getList"
- />
- </div>
- </template>
- <script>
- import { change, list } from "@/api/content/video";
- import { dialogCallBack } from "@/utils/DialogUtil";
- import VueQr from "vue-qr";
- export default {
- components: {
- VueQr,
- },
- data() {
- return {
- // 遮罩层
- loading: false,
- // 表单
- form: {
- pageNum: 1,
- pageSize: 10,
- },
- // 总数据
- total: 0,
- // 列表
- tableData: [],
- };
- },
- mounted() {
- this.getList();
- },
- methods: {
- // 列表
- getList() {
- this.loading = true;
- list(this.form).then((res) => {
- if (res.code === 0) {
- this.tableData = res.data.records;
- this.total = res.data.total;
- this.loading = false;
- }
- });
- },
- // 搜索
- getSearch() {
- this.form.pageNum = 1;
- this.getList();
- },
- // 重置
- getRefresh() {
- this.form = {
- pageNum: 1,
- pageSize: 10,
- };
- this.getList();
- },
- // 新增 查看 编辑
- getDetail(id, boolean) {
- this.$router.push({
- path: `/content/video/detail`,
- query: {
- id: id,
- boolean: boolean,
- },
- });
- },
- // H5路径
- getUrl(e) {
- return `${e.copyUrl}pages/devices/detail?clientType=${e.clientType}&id=${e.id}`;
- },
- // 复制成功
- copySuccess() {
- this.$message.success("复制成功!");
- },
- // 下载二维码
- getCode(id) {
- const url = this.$refs["qrcode" + id].$el.src;
- this.$download.saveAs(url, "二维码.png");
- },
- // 删除
- getDelete(row) {
- var that = this;
- dialogCallBack(that, function () {
- that
- .$confirm(`是否删除${row.name}?`, "提示", {
- type: "warning",
- })
- .then(() => {
- change(row.id, 2).then((res) => {
- if (res.code === 0) {
- that.$message.success("删除成功!");
- that.getList();
- }
- });
- });
- });
- },
- },
- };
- </script>
|