manage.blade.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. @extends('layouts.base')
  2. @section('title', '链接列表')
  3. @section('content')
  4. <style xmlns:v-bind="http://www.w3.org/1999/xhtml">
  5. .rightlist #app .rightlist-head{padding:15px 0;line-height:50px;}
  6. .rightlist #app{margin-left:30px;}
  7. .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
  8. .el-form-item__label{padding-right:30px;}
  9. .mouse-active{cursor:pointer;border:1px dotted #409EFF;border-radius: 4px;}
  10. /* 滑块选择小白点 */
  11. .el-switch.is-checked .el-switch__core::after {left: 100%;margin-left: -17px;}
  12. .el-switch__core::after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;transition: all .3s;width: 16px;height: 16px;background-color: #fff;}
  13. </style>
  14. <link rel="stylesheet" href="//at.alicdn.com/t/font_913727_zrmdutznqpd.css">
  15. <div id="app-share-activity">
  16. <template>
  17. <el-container>
  18. <el-header height="auto">
  19. <div class="">
  20. <h4 class="card-title">链接列表</h4>
  21. <el-button type="primary" icon="el-icon-plus" @click="addLink()">创建链接</el-button>
  22. </div>
  23. </el-header>
  24. {{--表格start--}}
  25. <el-main>
  26. <template>
  27. <el-table :data="list">
  28. <el-table-column align="center" align="center" prop="id" label="ID" width="auto"></el-table-column>
  29. <el-table-column align="center" prop="path" label="页面路径" width="auto"></el-table-column>
  30. <el-table-column align="center" prop="remark" label="备注" width="auto"></el-table-column>
  31. <el-table-column align="center" prop="browse" label="访问次数" width="auto"></el-table-column>
  32. <el-table-column align="center" label="操作">
  33. <template slot-scope="scope">
  34. <a v-bind:href="'{{ yzWebUrl('plugin.link-tool.admin.link.add.index', array('id' => '')) }}'+[[scope.row.id]]" title="编辑">
  35. <i class="el-icon-edit" style="font-size:28px;color:#606266"></i>
  36. </a>
  37. <a href="#" title="删除">
  38. <i class="el-icon-delete" style="font-size:28px;color:#606266" @click="del(scope.row.id)"></i>
  39. </a>
  40. <a href="#">
  41. <i class="iconfont icon-ht_operation_copyline" style="font-size:28px;color:#606266" title="点击复制链接" @click="copy(scope.row,scope.$index,'scheme')"></i>
  42. <el-input v-model="scope.row.copy_link" :ref="'copy'+scope.$index" style="height: 1px;position: absolute;opacity:0;z-index:-2"></el-input>
  43. </a>
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. </template>
  48. </el-main>
  49. {{--表格end--}}
  50. <el-footer>
  51. <el-pagination
  52. layout="prev, pager, next"
  53. @current-change="currentChange"
  54. :current-page.sync="current_page"
  55. :total="page_total"
  56. :page-size="page_size"
  57. background v-loading="loading">
  58. </el-pagination>
  59. </el-footer>
  60. </el-container>
  61. </template>
  62. </div>
  63. <script>
  64. var app = new Vue({
  65. el: '#app-share-activity',
  66. delimiters: ['[[', ']]'],
  67. data() {
  68. let pageList = {!! $pageList ?: '{}'!!};
  69. return {
  70. form : {},
  71. loading : false,
  72. real_search_form: {
  73. 'id' : '',
  74. 'name' : '',
  75. 'create_time' : '',
  76. },
  77. list : pageList.data,
  78. current_page : pageList.current_page,
  79. page_total : pageList.total,
  80. page_size : pageList.per_page,
  81. }
  82. },
  83. methods: {
  84. statusChange(index,row,id) {
  85. this.loading = true;
  86. this.$http.post('{!! yzWebFullUrl('plugin.share-activity.admin.activity.change-status') !!}',{id:id,status:row.status}).then(function (response) {
  87. if (response.data.result){
  88. if(row.status){
  89. this.$message({message: '开启成功',type: 'success'});
  90. }
  91. else {
  92. this.$message({message: '关闭成功',type: 'success'});
  93. }
  94. } else {
  95. this.$message({message: response.data.msg,type: 'error'});
  96. if (this.list[index].status==1){
  97. this.list[index].status = 0;
  98. }
  99. else{
  100. this.list[index].status = 1;
  101. }
  102. }
  103. this.loading = false;
  104. },function (response) {
  105. this.$message({message: response.data.msg,type: 'error'});
  106. if (this.list[index].status==1){
  107. this.list[index].status = 0;
  108. } else{
  109. this.list[index].status = 1;
  110. }
  111. this.loading = false;
  112. });
  113. },
  114. del(id) {
  115. this.$confirm('是否删除', '提示', {
  116. confirmButtonText: '确定',
  117. cancelButtonText: '取消',
  118. type: 'warning'
  119. }).then(() => {
  120. this.$http.post('{!! yzWebFullUrl('plugin.link-tool.admin.link.del.index') !!}',{id:id}).then(function (response) {
  121. if (response.data.result) {
  122. this.$message({
  123. type: 'success',
  124. message: '删除成功!'
  125. });
  126. window.open("{!! yzWebUrl('plugin.link-tool.admin.link.manage.index') !!}", '_self');
  127. }
  128. });
  129. }).catch(() => {
  130. this.$message({
  131. type: 'info',
  132. message: '已取消删除'
  133. });
  134. });
  135. },
  136. addLink(){
  137. window.open("{!! yzWebUrl('plugin.link-tool.admin.link.add.index') !!}", '_self');
  138. },
  139. copy(row,index,type) {
  140. let Url = this.$refs['copy'+index];
  141. console.log(Url)
  142. Url.select(); // 选择对象
  143. document.execCommand("Copy",false);
  144. this.$message({message:"复制成功!",type:"success"});
  145. },
  146. currentChange(val) {
  147. this.loading = true;
  148. this.$http.post('{!! yzWebFullUrl('plugin.share-activity.admin.activity.search') !!}',{page:val,search:this.real_search_form}).then(function (response) {
  149. if (response.data.result){
  150. let datas = response.data.data;
  151. this.page_total = datas.total;
  152. this.list = datas.data;
  153. this.page_size = datas.per_page;
  154. this.current_page = datas.current_page;
  155. }
  156. else {
  157. this.$message({message: response.data.msg,type: 'error'});
  158. }
  159. this.loading = false;
  160. },function (response) {
  161. this.loading = false;
  162. this.$message({message: response.data.msg,type: 'error'});
  163. }
  164. );
  165. }
  166. },
  167. });
  168. </script>
  169. @endsection