| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- @extends('layouts.base')
- @section('title', '编辑分类广告')
- @section('content')
- <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal/views/admin/index.css')}}">
- <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
- <style>
- th {border-bottom: 1px solid #EBEEF5 !important;}
- .dialog-cover{z-index:2001}
- .dialog-content{z-index:2002}
- </style>
- <div class="all">
- <div id="app" v-cloak>
- <div class="vue-crumbs">
- <a @click="goParent(1)">PC端</a>
- >
- <a @click="goParent(2)">广告管理</a>
- >
- 编辑分类广告
- </div>
- <el-form ref="form" :model="form" :rules="rules" label-width="15%">
- <div class="vue-main">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">编辑分类广告</div>
- </div>
- <div class="vue-main-form">
- <el-form-item label="PC广告图片" prop="pc_adv_img">
- <div class="upload-box" @click="openUpload('pc_adv_img')" v-if="!form.pc_adv_img_src">
- <i class="el-icon-plus" style="font-size:32px"></i>
- </div>
- <div @click="openUpload('pc_adv_img')" class="upload-boxed" v-if="form.pc_adv_img_src" style="height:82px">
- <img :src="form.pc_adv_img_src" alt="" style="width:150px;height:82px;border-radius: 5px;cursor: pointer;">
- <i class="el-icon-close" @click.stop="clearImg('pc_adv_img')" title="点击清除图片"></i>
- <div class="upload-boxed-text">点击重新上传</div>
- </div>
- <div class="tip">
- 建议尺寸: [[form.level==1?'260*470':'1200*400']]
- </div>
- </el-form-item>
- <el-form-item label="跳转链接" prop="pc_adv_url">
- <el-input v-model="form.pc_adv_url" style="width:70%;" placeholder=" 请填写指向的链接 (请以https://开头)"></el-input>
- <div class="tip">请以https://开头</div>
- </el-form-item>
- </div>
- </div>
- </el-form>
- <!-- 分页 -->
- <div class="vue-page">
- <div class="vue-center">
- <el-button type="primary" @click="submitForm('form')" :disabled="btnChangeEnable">提交</el-button>
- <el-button @click="goBack">返回</el-button>
- </div>
- </div>
- <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
- <pop :show="show" @replace="changeLink" @add="parHref"></pop>
- <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
- </div>
- </div>
-
- @include('public.admin.uploadImg')
- @include('public.admin.pop')
- @include('public.admin.program')
- <script>
- var app = new Vue({
- el:"#app",
- delimiters: ['[[', ']]'],
- name: 'test',
- data() {
- let category = {!!json_encode($category?:'{}') !!};
- return{
- show:false,//是否开启公众号弹窗
- pro:false ,//是否开启小程序弹窗
- chooseLink:'',
- chooseMiniLink:'',
- id:category?category.id:0,
- form:{
- level:category?category.level:"",
- pc_adv_img:category?category.pc_adv_img:"",
- pc_adv_img_src:category?category.pc_adv_img_src:"",
- pc_adv_url:category?category.pc_adv_url:""
- },
- btnChangeEnable:false,
- uploadShow:false,
- chooseImgName:'',
- submit_url:'',
- showVisible:false,
-
- loading: false,
- uploadImg1:'',
-
- rules:{
- },
- }
- },
- created() {
-
- },
- mounted() {
- },
- methods: {
- getParam(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return null;
- },
- goParent(level) {
- if(level==1) {
- window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.set.basic') !!}`;
- }
- else if(level==2) {
- window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}`;
- }
- },
-
- submitForm(formName) {
- let that = this;
- this.btnChangeEnable = true;
- let json = {
- pc_adv_img:this.form.pc_adv_img,
- pc_adv_url:this.form.pc_adv_url,
- };
- this.$refs[formName].validate((valid) => {
- if (valid) {
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-info') !!}',{id:this.id,category:json}).then(response => {
- if (response.data.result) {
- this.$message({type: 'success',message: '操作成功!'});
- // this.goBack();
- } else {
- this.$message({message: response.data.msg,type: 'error'});
- }
- loading.close();
- this.btnChangeEnable = false;
- },response => {
- loading.close();
- this.btnChangeEnable = false;
- });
- }
- else {
- console.log('error submit!!');
- this.btnChangeEnable = false;
- return false;
- }
- });
- },
-
- goBack() {
- history.go(-1)
- },
- openUpload(str) {
- this.chooseImgName = str;
- this.uploadShow = true;
- },
- changeProp(val) {
- if(val == true) {
- this.uploadShow = false;
- }
- else {
- this.uploadShow = true;
- }
- },
- sureImg(name,image,image_url) {
- this.form[name] = image;
- this.form[name+'_src'] = image_url;
- },
- clearImg(str) {
- this.form[str] = "";
- this.form[str+'_src'] = "";
- this.$forceUpdate();
- },
- //弹窗显示与隐藏的控制
- changeLink(item){
- this.show=item;
- },
- //当前链接的增加
- parHref(child,confirm){
- this.show=confirm;
- // this.form.link=child;
- this.form[this.chooseLink] = child;
- },
- changeprogram(item){
- this.pro=item;
- },
- parpro(child,confirm){
- this.pro=confirm;
- // this.form.prolink=child;
- this.form[this.chooseMiniLink] = child;
- },
- showLink(type,name) {
- if(type=="link") {
- this.chooseLink = name;
- this.show = true;
- }
- else {
- this.chooseMiniLink = name;
- this.pro = true;
- }
- },
-
- },
- })
- </script>
- @endsection
|