slide-list.blade.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. @extends('layouts.base')
  2. @section('title', "轮播图")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/blind-box/views/admin/index.css')}}">
  5. <style>
  6. /* 导航 */
  7. .el-radio-button .el-radio-button__inner,.el-radio-button:first-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;border-left: 0px;}
  8. .el-radio-button__inner{border:0;}
  9. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-main">
  14. <div>
  15. <div class="vue-main-title" style="margin-bottom:20px">
  16. <div class="vue-main-title-left"></div>
  17. <div class="vue-main-title-content" style="flex:0 0 120px">轮播图列表</div>
  18. <div class="vue-main-title-button">
  19. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增轮播图</el-button>
  20. </div>
  21. </div>
  22. <el-table :data="list" style="width: 100%">
  23. <el-table-column label="ID" align="center" prop="id" width="100"></el-table-column>
  24. <el-table-column label="排序" align="center" prop="sort"></el-table-column>
  25. <el-table-column label="轮播图名称" align="center" prop="title"></el-table-column>
  26. <el-table-column label="轮播图片" align="center" prop="img_src">
  27. <template slot-scope="scope">
  28. <div>
  29. <div><img :src="scope.row.img_src" alt="" style="width:80px;height: 50px;"></div>
  30. </div>
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="是否显示" align="center" prop="is_show" >
  34. <template slot-scope="scope">
  35. <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index)"></el-switch>
  36. </template>
  37. {{--<template slot-scope="scope">--}}
  38. {{--<div>--}}
  39. {{--<span v-if="scope.row.is_show==1" style="color:#67C23A;font-weight:600">显示</span>--}}
  40. {{--<span v-if="scope.row.is_show==0" style="color:#E6A23C;font-weight:600">不显示</span>--}}
  41. {{--</div>--}}
  42. {{--</template>--}}
  43. </el-table-column>
  44. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  45. <template slot-scope="scope">
  46. <el-link title="编辑幻灯片" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  47. <i class="iconfont icon-ht_operation_edit"></i>
  48. </el-link>
  49. <el-link title="删除幻灯片" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  50. <i class="iconfont icon-ht_operation_delete"></i>
  51. </el-link>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </div>
  57. <!-- 分页 -->
  58. <div class="vue-page" v-if="total>0">
  59. <el-row>
  60. <el-col align="right">
  61. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  62. :page-size="per_page" :current-page="current_page" background
  63. ></el-pagination>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. </div>
  69. <script>
  70. var app = new Vue({
  71. el: "#app",
  72. delimiters: ['[[', ']]'],
  73. name: 'test',
  74. data() {
  75. return {
  76. order_type:'1',
  77. list:[],
  78. rules: {},
  79. current_page:1,
  80. total:1,
  81. per_page:1,
  82. }
  83. },
  84. created() {
  85. },
  86. mounted() {
  87. this.getData(1);
  88. },
  89. methods: {
  90. getData(page) {
  91. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  92. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.slide.slide-list') !!}',{page:page}).then(function(response) {
  93. if (response.data.result) {
  94. console.log(response.data.data);
  95. this.list = response.data.data.data;
  96. this.current_page=response.data.data.current_page;
  97. this.total=response.data.data.total;
  98. this.per_page=response.data.data.per_page;
  99. loading.close();
  100. } else {
  101. this.$message({
  102. message: response.data.msg,
  103. type: 'error'
  104. });
  105. }
  106. loading.close();
  107. }, function(response) {
  108. this.$message({
  109. message: response.data.msg,
  110. type: 'error'
  111. });
  112. loading.close();
  113. });
  114. },
  115. gotoDetail(item) {
  116. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.slide.slide-edit') !!}`+`&id=`+item.id;
  117. window.location.href = link;
  118. },
  119. search(val) {
  120. this.getData(val);
  121. },
  122. addModal() {
  123. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.slide.slide-add') !!}`;
  124. window.location.href = link;
  125. },
  126. del(id,index) {
  127. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  128. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  129. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.slide.slide-del') !!}',{id:id}).then(function (response) {
  130. if (response.data.result) {
  131. this.list.splice(index,1);
  132. this.$message({type: 'success',message: '删除成功!'});
  133. }
  134. else{
  135. this.$message({type: 'error',message: response.data.msg});
  136. }
  137. loading.close();
  138. this.search(this.current_page)
  139. },function (response) {
  140. this.$message({type: 'error',message: response.data.msg});
  141. loading.close();
  142. }
  143. );
  144. }).catch(() => {
  145. this.$message({type: 'info',message: '已取消删除'});
  146. });
  147. },
  148. gotoOther(type) {
  149. let url = ""
  150. if(type==1) {
  151. //url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}'
  152. }
  153. else if(type==2) {
  154. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.banner') !!}'
  155. }
  156. else if(type==3) {
  157. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}'
  158. }
  159. else if(type==4) {
  160. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.two-advert-list') !!}'
  161. }
  162. else if(type==5) {
  163. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}'
  164. }
  165. if(url) {
  166. window.location.href=url
  167. }
  168. },
  169. // 字符转义
  170. escapeHTML(a) {
  171. a = "" + a;
  172. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  173. },
  174. editStatus(id,index){
  175. let json = {
  176. id:id,
  177. }
  178. json.status = this.list[index].is_show;
  179. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  180. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.slide.edit-slide-status') !!}',json).then(function (response) {
  181. if (response.data.result){
  182. this.$message.success("操作成功");
  183. this.search(this.current_page);
  184. }
  185. else {
  186. this.$message.error( response.data.msg );
  187. }
  188. loading.close();
  189. },function (response) {
  190. this.$message.error(response.data.msg);
  191. loading.close();
  192. }
  193. );
  194. },
  195. },
  196. })
  197. </script>
  198. @endsection