| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <?php
- /**
- * @link:http://www.gdqijianshi.com/
- * @copyright: Copyright (c) 2020 广东七件事集团
- * 名片列表页
- * Author: zal
- * Date: 2020-07-09
- * Time: 15:48
- */
- ?>
- <style>
- .link_url {
- text-align: left;
- font-size: 14px;
- }
- .showqr .el-dialog__body {
- text-align: center;
- padding-bottom: 10px;
- }
- .el-dialog {
- min-width: 400px;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>链接列表</span>
- <div style="float: right;margin-top: -5px">
- <el-button type="primary"
- @click="$navigate({r: 'admin/link/edit'})"
- size="small">添加链接
- </el-button>
- </div>
- </div>
- <div class="table-body">
- <el-tabs>
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column prop="id" min-width="30" label="序号" align="center"></el-table-column>
- <el-table-column prop="title" label="标题" min-width="60" align="center"></el-table-column>
- <el-table-column prop="cat_name" label="所属分类" align="center"></el-table-column>
- <el-table-column label="路由" min-width="200" align="center">
- <template slot-scope="scope">
- <!-- <div class="link_url">H5:{{scope.row.h5_route}}</div> -->
- <div class="link_url">{{scope.row.route}}</div>
- </template>
- </el-table-column>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="handle('edit',scope.row)">编辑</el-button>
- <!-- <el-button type="text" @click="handle('destroy',scope.row)">删除</el-button>-->
- <el-tooltip effect="dark" content="复制链接" placement="top">
- <el-button type="text" icon="el-icon-document-copy" class="copy-btn" @click="handle('copy',scope.row)"></el-button>
- </el-tooltip>
- <!-- <el-button type="text">生成二维码</el-button>-->
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
- </div>
- </el-tabs>
- </div>
- </el-card>
- </div>
- <script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- loading: false,
- delLoading: false,
- page: 1,
- pageCount: 0,
- list: []
- },
- mounted() {
- this.getList();
- },
- methods: {
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList();
- },
- toDelete(id) {
- this.$confirm('是否删除此链接分类', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let params = {
- r: 'admin/link/delete'
- };
- request({
- params: params,
- method: 'post',
- data:{
- id
- }
- }).then(e => {
- if (e.data.code == 0) {
- this.$message.success(e.data.msg);
- this.getList();
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'edit':
- let params = {
- r: 'admin/link/edit'
- };
- if (id) params = Object.assign(params, {
- id: id
- });
- navigateTo(params);
- break;
- case 'destroy':
- param = {id: data.id,type};
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send(param)})
- break;
- case 'copy':
- this.copy(data.h5_route);
- break;
- }
- },
- send(params) {
- let self = this;
- request({
- params: {
- r: 'admin/link/delete',
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- getList(params = {}) {
- let self = this;
- self.loading = true;
- let basic_params = {
- r: 'admin/link/index',
- page: self.page,
- };
- params = Object.assign(basic_params, this.search);
- request({
- params: params,
- method: 'post',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.list;
- self.pageCount = e.data.data.page_count;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.loading = false;
- });
- },
- toEdit(id) {
- navigateTo({
- r: 'admin/link/edit',
- id: id
- })
- },
- //复制链接
- copy(url){
- var clipboard = new Clipboard('.copy-btn', {
- text: function () {
- return url;
- }
- });
- clipboard.on('success', function (e) {
- this.ELEMENT.Message.success('复制成功');
- e.clearSelection();
- });
- clipboard.on('error', function (e) {
- this.ELEMENT.Message.success('复制失败,请手动复制');
- });
- },
- qrcode() {
- },
- }
- });
- </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;
- }
-
- .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>
|