plat-activity-list.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. @extends('layouts.base')
  2. @section('title', '推广页面')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  6. <style>
  7. .edit-i {
  8. display: none;
  9. }
  10. .el-table_1_column_2:hover .edit-i {
  11. font-weight: 900;
  12. padding: 0;
  13. margin: 0;
  14. display: inline-block;
  15. }
  16. .el-tabs__item, .is-top {
  17. font-size: 16px
  18. }
  19. .el-tabs__active-bar {
  20. height: 3px;
  21. }
  22. /*.el-select .el-input {*/
  23. /* width: 120px;*/
  24. /*}*/
  25. .input-with-select .el-input-group__prepend {
  26. background-color: #fff;
  27. }
  28. </style>
  29. <div class="all">
  30. <div id="app" v-cloak>
  31. <div class="vue-head">
  32. <div class="vue-search">
  33. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  34. <el-form-item label="">
  35. <el-input v-model="search_form.another_name" placeholder="页面名称"></el-input>
  36. </el-form-item>
  37. <el-form-item label="页面类型">
  38. <el-select v-model="search_form.page_type" clearable placeholder="页面类型">
  39. <el-option
  40. v-for="(item,index) in page_type_arr"
  41. :key="index"
  42. :label="item.label"
  43. :value="item.value">
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-button type="primary" @click="changeForm()">搜索</el-button>
  48. </el-form>
  49. </div>
  50. </div>
  51. <div class="vue-main">
  52. <div class="vue-main-form">
  53. <div class="vue-main-title" style="margin-top:-10px">
  54. <div class="title">
  55. <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>页面列表</b>
  56. </div>
  57. </div>
  58. </div>
  59. <div style="margin-bottom:20px">
  60. </div>
  61. <el-table :data="list" style="width: 100%;" align="center" :fit="true" :row-style="{ height: '80px'}">
  62. <el-table-column style="min-height:100px;" min-width="15%" prop="id" label="ID"
  63. align="center"></el-table-column>
  64. <el-table-column style="min-height:100px;" min-width="15%" prop="another_name" label="名称"
  65. align="center"></el-table-column>
  66. <el-table-column min-width="15%" prop="page_type_name" label="页面类型"
  67. align="center"></el-table-column>
  68. <el-table-column min-width="15%" prop="visit_count" label="访问次数" align="center">
  69. </el-table-column>
  70. <el-table-column min-width="15%" label="状态" align="center">
  71. <template slot-scope="scope">
  72. <el-switch
  73. :active-value="1"
  74. :inactive-value="0"
  75. v-model="scope.row.open_state"
  76. active-color="#13ce66"
  77. inactive-color="#545454"
  78. @change="changeOpenState(scope.row)"
  79. >
  80. </el-switch>
  81. </template>
  82. </el-table-column>
  83. <el-table-column min-width="20%" label="操作" align="center">
  84. <template slot-scope="scope">
  85. <el-button type="primary" @click="getIntroduceUrl(scope.row)">推广</el-button>
  86. <el-button type="primary" @click="platDetail(scope.row)">设置</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. </div>
  91. <div class="vue-page" v-if="total > 0">
  92. <el-row>
  93. <el-col align="right">
  94. <el-pagination layout="prev, pager, next,jumper" @current-change="getData" :total="total"
  95. :page-size="per_page" :current-page="current_page" background
  96. ></el-pagination>
  97. </el-col>
  98. </el-row>
  99. </div>
  100. <el-dialog title="推广链接" :visible.sync="introduce_modal.is_show" width="60%">
  101. <template>
  102. <el-tabs v-model="introduce_modal.tab">
  103. <el-tab-pane label="推广链接" name="1">
  104. <el-row style="margin-top: 30px">
  105. <el-col :span="3" style="text-align: right">推广链接</el-col>
  106. <el-col :span="18" style="margin-left: 10px">
  107. <el-input style="width: 60%" v-model="introduce_modal.web_url" disabled></el-input>
  108. <el-button-group>
  109. <el-button @click="copyUrl(introduce_modal.web_url)">复制</el-button>
  110. <el-button @click="webCode(introduce_modal.web_url)">生成二维码</el-button>
  111. </el-button-group>
  112. </el-col>
  113. </el-row>
  114. <div v-if="introduce_modal.web_image" style="width: 100%;margin-top: 30px" align="center">
  115. <el-image :src="introduce_modal.web_image" style="width: 200px;height: 200px;">
  116. </el-image>
  117. </div>
  118. </el-tab-pane>
  119. <el-tab-pane label="小程序路径" name="2">
  120. <el-row style="margin-top: 30px">
  121. <el-col :span="3" style="text-align: right">小程序路径</el-col>
  122. <el-col :span="18" style="margin-left: 10px">
  123. <el-input style="width: 60%" v-model="introduce_modal.mini_url" disabled></el-input>
  124. <el-button-group>
  125. <el-button @click="copyUrl(introduce_modal.mini_url)">复制</el-button>
  126. <el-button @click="miniCode(introduce_modal.mini_url)">生成小程序码</el-button>
  127. </el-button-group>
  128. </el-col>
  129. </el-row>
  130. <div style="width: 100%;margin-top: 30px" align="center">
  131. <el-image v-if="introduce_modal.mini_image" :src="introduce_modal.mini_image"
  132. style="width: 200px;height: 200px;">
  133. </el-image>
  134. </div>
  135. </el-tab-pane>
  136. </el-tabs>
  137. </template>
  138. <span slot="footer" class="dialog-footer">
  139. <el-button @click="introduce_modal.is_show = false">取 消</el-button>
  140. </span>
  141. </el-dialog>
  142. </div>
  143. <!-- 分页 -->
  144. </div>
  145. </div>
  146. <script>
  147. var app = new Vue({
  148. el: "#app",
  149. delimiters: ['[[', ']]'],
  150. name: 'test',
  151. data() {
  152. return {
  153. list: [],
  154. total: 1,
  155. per_page: 1,
  156. current_page: 1,
  157. search_form: {
  158. 'another_name': '',
  159. 'page_type': '',
  160. },
  161. search_data: {},
  162. page_type_arr: [
  163. {value: '1', label: '公众号'},
  164. {value: '2', label: '小程序'},
  165. ],
  166. introduce_modal: {
  167. id: 0,
  168. is_show: false,
  169. web_url: '',
  170. mini_url: '',
  171. web_image: '',
  172. mini_image: '',
  173. tab: "1",
  174. }
  175. }
  176. },
  177. created() {
  178. },
  179. mounted() {
  180. this.changeForm();
  181. },
  182. methods: {
  183. platDetail: function (data) {
  184. var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.plat-activity.edit') !!}" + '&id=' + data.id;
  185. window.open(url);
  186. },
  187. webCode: function (url) {
  188. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.plat-activity.getWebCode') !!}', {
  189. 'url': url
  190. }).then(function (response) {
  191. if (response.data.result) {
  192. this.$message({message: response.data.msg, type: 'success'});
  193. this.getIntroduceUrl({id: this.introduce_modal.id});
  194. } else {
  195. this.$message({message: response.data.msg, type: 'error'});
  196. }
  197. }, function (response) {
  198. this.$message({message: response.data.msg, type: 'error'});
  199. });
  200. },
  201. miniCode: function (url) {
  202. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.plat-activity.getMiniCode') !!}', {
  203. 'url': url, 'activity_id': this.introduce_modal.id
  204. }).then(function (response) {
  205. if (response.data.result) {
  206. this.$message({message: response.data.msg, type: 'success'});
  207. this.getIntroduceUrl({id: this.introduce_modal.id});
  208. } else {
  209. this.$message({message: response.data.msg, type: 'error'});
  210. }
  211. }, function (response) {
  212. this.$message({message: response.data.msg, type: 'error'});
  213. });
  214. },
  215. {{--editCategory: function (data) {--}}
  216. {{-- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&id=' + data.id;--}}
  217. {{-- window.location.href = url;--}}
  218. {{-- // window.open(url);--}}
  219. {{--},--}}
  220. {{--addCategory: function () {--}}
  221. {{-- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&parent_id=' + this.search_data.parent_id;--}}
  222. {{-- window.location.href = url;--}}
  223. {{-- // window.open(url);--}}
  224. {{--},--}}
  225. {{--childList: function (data) {--}}
  226. {{-- var level = data.level + 1;--}}
  227. {{-- var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.index') !!}" + '&level=' + level + '&parent_id=' + data.id;--}}
  228. {{-- window.open(url);--}}
  229. {{--},--}}
  230. // checkEmpty: function (val) {
  231. // if (val != 'undefined' && val != null && val != '0' && val != 0 && val != '') {
  232. // return true;
  233. // }
  234. // return false;
  235. // },
  236. copyUrl: function (url, msg) {
  237. let oInput = document.createElement('input');
  238. oInput.value = url;
  239. document.body.appendChild(oInput);
  240. oInput.select(); // 选择对象;
  241. console.log(oInput.value);
  242. document.execCommand("Copy"); // 执行浏览器复制命令
  243. this.$message({message: msg, type: 'success'});
  244. oInput.remove()
  245. },
  246. openUrl: function (url) {
  247. window.open(url);
  248. },
  249. // showAppModal: function () {
  250. // this.app_list = [];
  251. // this.app_show = true;
  252. // this.app_modal_text1 = true;
  253. // this.app_modal_text2 = false;
  254. // this.showUploaderEl = true;
  255. // },
  256. changeOpenState: function (data) {
  257. var open_state = data.open_state;
  258. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.plat-activity.changeOpenState') !!}', {
  259. 'id': data.id, 'open_state': open_state
  260. }).then(function (response) {
  261. console.log(response);
  262. if (response.data.result) {
  263. this.$message({message: response.data.msg, type: 'success'});
  264. this.search();
  265. } else {
  266. this.$message({message: response.data.msg, type: 'error'});
  267. this.search();
  268. }
  269. }, function (response) {
  270. this.$message({message: response.data.msg, type: 'error'});
  271. this.search();
  272. });
  273. },
  274. getIntroduceUrl: function (data) {
  275. this.introduce_modal.web_url = '';
  276. this.introduce_modal.mini_url = '';
  277. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.plat-activity.getIntroduceUrl') !!}', {
  278. 'id': data.id
  279. }).then(function (response) {
  280. if (response.data.result) {
  281. this.introduce_modal.web_url = response.data.data.web_url;
  282. this.introduce_modal.mini_url = response.data.data.mini_url;
  283. this.introduce_modal.web_image = response.data.data.web_image;
  284. this.introduce_modal.mini_image = response.data.data.mini_image;
  285. this.introduce_modal.id = data.id;
  286. this.introduce_modal.is_show = 1;
  287. } else {
  288. this.$message({message: response.data.msg, type: 'error'});
  289. }
  290. }, function (response) {
  291. this.$message({message: response.data.msg, type: 'error'});
  292. });
  293. },
  294. search: function () {
  295. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.plat-activity.index') !!}', {
  296. 'page': this.current_page,
  297. 'is_json': 1,
  298. 'search_data': this.search_data,
  299. }).then(function (response) {
  300. console.log(response);
  301. if (response.data.result) {
  302. let this_data = response.data.data.list;
  303. this.current_page = this_data.current_page;
  304. this.list = this_data.data;
  305. this.total = this_data.total;
  306. this.per_page = this_data.per_page;
  307. } else {
  308. this.$message({message: response.data.msg, type: 'error'});
  309. }
  310. }, function (response) {
  311. this.$message({message: response.data.msg, type: 'error'});
  312. })
  313. },
  314. getData: function (val) {
  315. this.current_page = val;
  316. this.search();
  317. },
  318. changeForm: function () {
  319. this.search_data = this.search_form;
  320. this.current_page = 1;
  321. this.search();
  322. }
  323. },
  324. })
  325. </script>
  326. @endsection