739 lines
39 KiB
PHP
739 lines
39 KiB
PHP
@extends('layouts.base')
|
||
@section('title', '编辑文章')
|
||
@section('content')
|
||
<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
|
||
<link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
|
||
|
||
<style>
|
||
.right .el-form-item__label {
|
||
width:27%!important;
|
||
}
|
||
.right .el-form-item__content {
|
||
margin-left:27%!important;
|
||
}
|
||
.right2 .el-form-item__label {
|
||
width:32%!important;
|
||
}
|
||
.right2 .el-form-item__content {
|
||
margin-left:32%!important;
|
||
}
|
||
.navbar-absolute {
|
||
z-index:99
|
||
}
|
||
</style>
|
||
<div class="all">
|
||
<div id="app" v-cloak>
|
||
<div class="vue-crumbs">
|
||
<a @click="goParent()">文章管理</a>
|
||
> {{id?'编辑':'发布'}}文章
|
||
</div>
|
||
<el-form ref="form" :model="form" :rules="rules" label-width="15%">
|
||
<div style="display:flex;width:100%">
|
||
|
||
<div style="flex:1;">
|
||
<div class="vue-head">
|
||
<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="文章标题" prop="title">
|
||
<el-input v-model="form.title" placeholder="请输入文章标题" style="width:70%"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="文章类型" prop="type">
|
||
<div style="line-height:40px">
|
||
<el-radio v-model.number="form.type" :label="0">普通文章</el-radio>
|
||
<el-radio v-model.number="form.type" :label="1">音频文章</el-radio>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="音频链接" prop="audio_link" v-if="form.type">
|
||
<el-input v-model="form.audio_link" placeholder="请输入音频链接" style="width:70%"></el-input>
|
||
<div class="tip">注:如是音频类型文章则从装修页面可以选择链接的地方选择音频文章入口链接</div>
|
||
</el-form-item>
|
||
<el-form-item label="发布作者" prop="author">
|
||
<el-input v-model="form.author" placeholder="请输入发布作者" style="width:70%"></el-input>
|
||
</el-form-item>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="vue-head">
|
||
<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">
|
||
<tinymceee v-model="form.content" ref = "tinymceee" :upload_only_text_area="upload_only_text_area"></tinymceee>
|
||
</div>
|
||
</div>
|
||
<div class="vue-head">
|
||
<div class="vue-main-title">
|
||
<div class="vue-main-title-left"></div>
|
||
<div class="vue-main-title-content">SEO/分享设置</div>
|
||
</div>
|
||
<div class="vue-main-form">
|
||
<el-form-item label="文章关键词" prop="keyword">
|
||
<el-input v-model="form.keyword" placeholder="请输入文章关键词" style="width:70%"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="文章描述" prop="desc">
|
||
<el-input v-model="form.desc" placeholder="请输入文章描述" style="width:70%" type="textarea" :rows="5"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="文章封面" prop="thumb">
|
||
<div class="upload-box" @click="openUpload('thumb')" v-if="!form.thumb_url">
|
||
<i class="el-icon-plus" style="font-size:32px"></i>
|
||
</div>
|
||
<div @click="openUpload('thumb')" class="upload-boxed" v-if="form.thumb_url">
|
||
<img :src="form.thumb_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
|
||
<i class="el-icon-close" @click.stop="clearImg('thumb')" title="点击清除图片"></i>
|
||
<div class="upload-boxed-text">点击重新上传</div>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="原文链接(网页)" prop="link">
|
||
<el-input v-model="form.link" style="width:70%;" placeholder=" 请选择链接"></el-input>
|
||
<el-button @click="showLink('link','link')">选择链接</el-button>
|
||
</el-form-item>
|
||
<el-form-item label="原文链接(小程序)" prop="small_link">
|
||
<el-input v-model="form.small_link" style="width:70%;" placeholder=" 请选择链接"></el-input>
|
||
<el-button @click="showLink('mini','small_link')">选择小程序链接</el-button>
|
||
</el-form-item>
|
||
</div>
|
||
</div>
|
||
<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="是否开启" prop="advs_type">
|
||
<div style="line-height:40px">
|
||
<el-switch v-model="form.advs_type" :active-value="1" :inactive-value="0"></el-switch>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="广告标题" prop="advs_title">
|
||
<el-input v-model="form.advs_title" placeholder="请输入广告标题" style="width:70%"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="广告文字" prop="advs_title_footer">
|
||
<el-input v-model="form.advs_title_footer" placeholder="请输入广告文字" style="width:70%" type="textarea" :rows="5"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="广告图片" prop="advs_img">
|
||
<div class="upload-box" @click="openUpload('advs_img')" v-if="!form.advs_img_url">
|
||
<i class="el-icon-plus" style="font-size:32px"></i>
|
||
</div>
|
||
<div @click="openUpload('advs_img')" class="upload-boxed" v-if="form.advs_img_url">
|
||
<img :src="form.advs_img_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
|
||
<i class="el-icon-close" @click.stop="clearImg('advs_img')" title="点击清除图片"></i>
|
||
<div class="upload-boxed-text">点击重新上传</div>
|
||
</div>
|
||
<div class="tip">建议尺寸:380*130</div>
|
||
</el-form-item>
|
||
<el-form-item label="广告链接(网页)" prop="advs_link">
|
||
<el-input v-model="form.advs_link" style="width:70%;" placeholder=" 请选择链接"></el-input>
|
||
<el-button @click="showLink('link','advs_link')">选择链接</el-button>
|
||
</el-form-item>
|
||
<el-form-item label="广告链接(小程序)" prop="min_app_advs_link">
|
||
<el-input v-model="form.min_app_advs_link" style="width:70%;" placeholder=" 请选择链接"></el-input>
|
||
<el-button @click="showLink('mini','min_app_advs_link')">选择小程序链接</el-button>
|
||
</el-form-item>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="width:350px">
|
||
<div class="vue-head">
|
||
<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">
|
||
<div style="width:100%;text-align:center;margin:20px 0">
|
||
<el-button type="primary" size="small" @click="submitForm('form')">发布</el-button>
|
||
<el-button size="small" @click="goBack">返回列表</el-button>
|
||
</div>
|
||
<el-form-item label="排序" prop="display_order" class="right">
|
||
<el-input v-model="form.display_order" placeholder="请输入排序"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="是否开启" prop="state" class="right">
|
||
<div style="line-height:40px">
|
||
<el-switch v-model="form.state" :active-value="1" :inactive-value="0"></el-switch>
|
||
</div>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="文章logo" prop="article_logo" class="right">
|
||
<div class="upload-box" @click="openUpload('article_logo')" v-if="!form.article_logo_url" style="width:130px;height:80px">
|
||
<i class="el-icon-plus" style="font-size:32px"></i>
|
||
</div>
|
||
<div @click="openUpload('article_logo')" class="upload-boxed" v-if="form.article_logo_url" style="width:130px;height:80px">
|
||
<img :src="form.article_logo_url" alt="" style="width:130px;height:80px;border-radius: 5px;cursor: pointer;">
|
||
<div class="upload-boxed-text">点击重新上传</div>
|
||
</div>
|
||
<div class="tip">建议尺寸:180*64</div>
|
||
</el-form-item>
|
||
|
||
|
||
<el-form-item label="页面设置" prop="effective_time" class="right">
|
||
<el-checkbox :true-label="1" :false-label="0" v-model="form.no_copy_url">禁止复制链接</el-checkbox><br>
|
||
<el-checkbox :true-label="1" :false-label="0" v-model="form.no_share">禁止分享朋友圈</el-checkbox><br>
|
||
<el-checkbox :true-label="1" :false-label="0" v-model="form.no_share_to_friend">禁止分享好友</el-checkbox>
|
||
</el-form-item>
|
||
<el-form-item label="举报按钮" prop="report_enabled" class="right">
|
||
<el-radio v-model.number="form.report_enabled" :label="1">模拟举报(使用有风险)</el-radio>
|
||
<el-radio v-model.number="form.report_enabled" :label="0">不显示</el-radio>
|
||
</el-form-item>
|
||
<el-form-item label="虚拟阅读量" prop="virtual_read_num" class="right">
|
||
<el-input v-model="form.virtual_read_num" placeholder="请输入虚拟阅读量"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="虚拟点赞量" prop="virtual_like_num" class="right">
|
||
<el-input v-model="form.virtual_like_num" placeholder="请输入虚拟点赞量"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="虚拟发布时间" prop="virtual_created_at" class="right">
|
||
<!-- <el-input v-model="form.virtual_created_at" placeholder="请输入虚拟发布时间"></el-input> -->
|
||
<el-date-picker
|
||
v-model="form.virtual_created_at"
|
||
value-format="yyyy-MM-dd HH:mm:ss"
|
||
type="datetime"
|
||
placeholder="选择日期时间">
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
|
||
</div>
|
||
</div>
|
||
@if($wx_article_is_open == 1)
|
||
<div class="vue-head" id="wx_article">
|
||
<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="" prop="" class="right1">
|
||
<el-form-item prop="wx_link">
|
||
<el-input v-model="wx_link" placeholder="请输入微信图文链接地址" style="width:90%" type="textarea" :rows="5"></el-input>
|
||
</el-form-item>
|
||
|
||
</el-form-item>
|
||
<div class="confirm-btn" style=" text-align: center;">
|
||
<el-button type="primary" @click="capture">抓取</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
<div class="vue-head" id="category">
|
||
<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="" prop="" class="right1">
|
||
<el-checkbox-group v-model="form.checklist">
|
||
<span v-for="(item,index) in categorys" :key="index" >
|
||
<el-radio v-model="form.category_id" :label="item.id">[[item.name]]</el-radio><br>
|
||
</span>
|
||
|
||
</el-checkbox-group>
|
||
<div>
|
||
<el-link style="color:#29BA9C" :underline="false" @click="openCategory">
|
||
<i class="el-icon-plus"></i>添加新分类
|
||
</el-link>
|
||
</div>
|
||
</el-form-item>
|
||
<div v-show="is_category">
|
||
|
||
<el-form-item label="新分类名称" prop="category_name" class="right" size="mini">
|
||
<el-input v-model="category_name" placeholder="请输入新分类名称"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label=""size="mini" class="right">
|
||
<el-button size="mini" @click="addCategory">添加分类</el-button>
|
||
</el-form-item>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="vue-head">
|
||
<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="" prop="" class="right1">
|
||
<el-checkbox v-model="all_level" :true-label="1" :false-label="0" @change="changeLevel('all')">全部会员等级</el-checkbox><br>
|
||
<el-checkbox-group v-model="form.show_levels">
|
||
<span>
|
||
<el-checkbox label="0" @change="changeLevel(0)">普通等级</el-checkbox><br>
|
||
</span>
|
||
<span v-for="(item,index) in levels" :key="index" >
|
||
<el-checkbox :label="String(item.id)" @change="changeLevel(item.id)">[[item.level_name]]</el-checkbox><br>
|
||
</span>
|
||
</el-checkbox-group>
|
||
|
||
</el-form-item>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="vue-head">
|
||
<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="奖励方式" prop="reward_mode" class="right2">
|
||
<div style="line-height:40px">
|
||
<el-radio v-model.number="form.reward_mode" :label="0">按次</el-radio>
|
||
<el-radio v-model.number="form.reward_mode" :label="1">按天</el-radio>
|
||
</div>
|
||
</el-form-item>
|
||
<el-form-item label="最高累计奖金" prop="bonus_total" class="right2">
|
||
<el-input v-model="form.bonus_total" placeholder="请输入最高累计奖金">
|
||
<template slot="append">元</template>
|
||
</el-input>
|
||
<div class="tip">已奖励:[[bonus_sum||'0']]元</div>
|
||
</el-form-item>
|
||
<el-form-item label="每人每天奖励" prop="per_person_per_day" class="right2">
|
||
<el-input v-model="form.per_person_per_day" placeholder="请输入每人每天奖励">
|
||
<template slot="append">次</template>
|
||
</el-input>
|
||
</el-form-item>
|
||
<el-form-item label="每人总共奖励" prop="total_per_person" class="right2">
|
||
<el-input v-model="form.total_per_person" placeholder="请输入每人总共奖励">
|
||
<template slot="append">次</template>
|
||
</el-input>
|
||
</el-form-item>
|
||
<el-form-item label="分享一次奖励" prop="point" class="right2">
|
||
<el-input v-model="form.point" placeholder="请输入分享一次奖励">
|
||
<template slot="append">个积分</template>
|
||
</el-input>
|
||
<div style="margin-top:15px">
|
||
<el-input v-model="form.credit" placeholder="请输入分享一次奖励">
|
||
<template slot="append">元余额</template>
|
||
</el-input>
|
||
</div>
|
||
</el-form-item>
|
||
|
||
<div class="tip">奖励规则提示:分享后,好友点击进入后,才算成功分享一次。</div>
|
||
<div class="tip">奖励方式:1、按次,一篇文章同一个浏览者只奖励分享者一次积分/余额(只奖励首次浏览)。</div>
|
||
<div class="tip">2、按天,一篇文章同一个浏览者每天点击浏览,每天奖励分享者一次积分/余额(只奖励每天首次浏览)。</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</el-form>
|
||
<!--end-->
|
||
<!-- 分页 -->
|
||
<!-- <div class="vue-page">
|
||
<div class="vue-center">
|
||
<el-button type="primary" @click="submitForm('form')">提交</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>
|
||
<script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
|
||
@include('Yunshop\Article::admin.tinymceee')
|
||
@include('public.admin.uploadImg')
|
||
@include('public.admin.pop')
|
||
@include('public.admin.program')
|
||
|
||
<script>
|
||
let upload_url = `{!! $upload_url?:'' !!}`
|
||
let id = {!! $id?:'0' !!}
|
||
console.log(id)
|
||
|
||
var app = new Vue({
|
||
el:"#app",
|
||
delimiters: ['[[', ']]'],
|
||
name: 'test',
|
||
data() {
|
||
return{
|
||
upload_only_text_area:'',
|
||
show:false,//是否开启公众号弹窗
|
||
pro:false ,//是否开启小程序弹窗
|
||
chooseLink:'',
|
||
chooseMiniLink:'',
|
||
upload_url:upload_url,
|
||
bonus_sum:'',//已奖励
|
||
wx_link:'',//需要抓取的微信文章链接
|
||
|
||
form:{
|
||
title:'',
|
||
type:'',
|
||
audio_link:'',
|
||
author:'',
|
||
content:'',
|
||
keyword:'',
|
||
desc:'',
|
||
thumb:'',
|
||
link:'',
|
||
small_link:'',
|
||
advs_type:'',
|
||
advs_title:'',
|
||
advs_title_footer:'',
|
||
advs_img:'',
|
||
advs_link:'',
|
||
display_order:'',
|
||
state:1,
|
||
no_copy_url:0,
|
||
no_share:0,
|
||
no_share_to_friend:0,
|
||
report_enabled:0,
|
||
virtual_read_num:'0',
|
||
virtual_like_num:'0',
|
||
virtual_created_at: this.timeStyle(new Date()),
|
||
category_id:'',
|
||
show_levels:[],
|
||
reward_mode:0,
|
||
bonus_total:'0',
|
||
per_person_per_day:'0',
|
||
total_per_person:'0',
|
||
point:'0',
|
||
credit:'0',
|
||
min_app_advs_link:'',
|
||
article_logo:'',
|
||
},
|
||
all_level:1,
|
||
categorys:[],
|
||
levels:[],
|
||
|
||
is_category:false,
|
||
category_name:'',
|
||
|
||
|
||
id:id,
|
||
submit_url:'',
|
||
|
||
uploadShow:false,
|
||
chooseImgName:'',
|
||
chooseIndex:-1,
|
||
type:0,
|
||
|
||
goods_show:false,
|
||
goods_list:[],
|
||
search_goods:{},
|
||
choosed_goods:{},
|
||
choosed_goods_id:'',
|
||
goods_total:1,
|
||
goods_current_page:1,
|
||
goods_per_page:1,
|
||
|
||
rules:{
|
||
name:{ required: true, message: '请输入品牌名称'}
|
||
},
|
||
|
||
}
|
||
},
|
||
created() {
|
||
if(this.id) {
|
||
this.submit_url = "{!! yzWebFullUrl('plugin.article.manager.article-vue.edit') !!}"
|
||
}
|
||
else {
|
||
this.submit_url = "{!! yzWebFullUrl('plugin.article.manager.article-vue.add') !!}"
|
||
}
|
||
this.getData();
|
||
},
|
||
mounted() {
|
||
|
||
},
|
||
methods: {
|
||
//抓取微信文章内容
|
||
capture(){
|
||
if(!this.wx_link) {
|
||
this.$message({type: 'error',message: '抓取链接不能为空!'});
|
||
return
|
||
}
|
||
|
||
|
||
// "http://mp.weixin.qq.com/s?__biz=MjM5NDAwMTA2MA==&mid=2695729619&idx=1&sn=8be0b6bd0210cee0d492ebdf20f7371f&chksm=83d74818b4a0c10ef286b33bb7deb73226125f866ddb5b2781166066a69afef3705eabdb3b85#rd
|
||
let loading = this.$loading({target:document.querySelector("#goods-list"),background: 'rgba(0, 0, 0, 0)'});
|
||
this.$http.post("{!! yzWebFullUrl('plugin.wx-article.api.wx-article.get-wx-article') !!}",{wx_link:this.wx_link}).then(response => {
|
||
var data = response.data;
|
||
|
||
if (data.code == 1) {
|
||
this.$message({message: data.msg,type: 'error'});
|
||
} else {
|
||
app.$refs.tinymceee.hasChange = false;//让其监听改变回显
|
||
this.form.content += data.data.content_html;tinymceee.value = data.data.content_html;
|
||
this.$message({type: 'success',message: data.msg});
|
||
}
|
||
loading.close();
|
||
},response => {
|
||
loading.close();
|
||
});
|
||
},
|
||
getData() {
|
||
|
||
|
||
let json = {}
|
||
if(this.id) {
|
||
json.id = this.id
|
||
}
|
||
let loading = this.$loading({target:document.querySelector("#goods-list"),background: 'rgba(0, 0, 0, 0)'});
|
||
this.$http.post(this.submit_url,json).then(response => {
|
||
if(response.data.result == 1) {
|
||
if (response.data.result) {
|
||
this.categorys = response.data.data.categorys;
|
||
this.levels = response.data.data.levels;
|
||
if(this.id) {
|
||
this.form = response.data.data.article
|
||
}
|
||
if(this.form.show_levels=='' || this.form.show_levels.length==0) {
|
||
this.all_level = 1;
|
||
this.form.show_levels = []
|
||
}
|
||
else {
|
||
this.all_level = 0;
|
||
}
|
||
|
||
} else {
|
||
this.$message({message: response.data.msg,type: 'error'});
|
||
}
|
||
}
|
||
else {
|
||
this.$message.error(response.data.msg)
|
||
}
|
||
|
||
loading.close();
|
||
}, response => {
|
||
console.log(response);
|
||
loading.close();
|
||
});
|
||
},
|
||
openUpload(str,index,type) {
|
||
this.chooseImgName = str;
|
||
this.uploadShow = true;
|
||
this.chooseIndex = index;
|
||
this.type = type;
|
||
},
|
||
changeProp(val) {
|
||
if(val == true) {
|
||
this.uploadShow = false;
|
||
}
|
||
else {
|
||
this.uploadShow = true;
|
||
}
|
||
},
|
||
sureImg(name,image,img_url) {
|
||
if(this.type==1) {
|
||
this.form[name][this.chooseIndex]['img_url'] = image;
|
||
this.form[name][this.chooseIndex]['full_img_url'] = img_url;
|
||
}
|
||
else {
|
||
this.form[name] = image;
|
||
this.form[name+'_url'] = img_url;
|
||
}
|
||
|
||
},
|
||
clearImg(str,index,type) {
|
||
if(!type) {
|
||
this.form[str] = "";
|
||
this.form[str+'_url'] = "";
|
||
}
|
||
else if(type==1){
|
||
this.form[str][index].full_img_url = '';
|
||
this.form[str][index].img_url = '';
|
||
}
|
||
this.$forceUpdate();
|
||
},
|
||
|
||
submitForm(formName) {
|
||
console.log(this.form)
|
||
let json = {
|
||
title:this.form.title,
|
||
type:this.form.type,
|
||
audio_link:this.form.audio_link,
|
||
author:this.form.author,
|
||
content:this.form.content,
|
||
keyword:this.form.keyword,
|
||
desc:this.form.desc,
|
||
thumb:this.form.thumb,
|
||
link:this.form.link,
|
||
small_link:this.form.small_link,
|
||
advs_type:this.form.advs_type,
|
||
advs_title:this.form.advs_title,
|
||
advs_title_footer:this.form.advs_title_footer,
|
||
advs_img:this.form.advs_img,
|
||
advs_link:this.form.advs_link,
|
||
display_order:this.form.display_order,
|
||
state:this.form.state,
|
||
no_copy_url:this.form.no_copy_url,
|
||
no_share:this.form.no_share,
|
||
no_share_to_friend:this.form.no_share_to_friend,
|
||
report_enabled:this.form.report_enabled,
|
||
virtual_read_num:this.form.virtual_read_num,
|
||
virtual_like_num:this.form.virtual_like_num,
|
||
virtual_created_at:this.form.virtual_created_at,
|
||
category_id:this.form.category_id,
|
||
reward_mode:this.form.reward_mode,
|
||
bonus_total:this.form.bonus_total,
|
||
per_person_per_day:this.form.per_person_per_day,
|
||
total_per_person:this.form.total_per_person,
|
||
point:this.form.point,
|
||
credit:this.form.credit,
|
||
min_app_advs_link:this.form.min_app_advs_link,
|
||
article_logo:this.form.article_logo,
|
||
};
|
||
if(this.all_level) {
|
||
json.show_levels = []
|
||
}
|
||
if(this.form.show_levels.length>=0) {
|
||
json.show_levels = this.form.show_levels
|
||
}
|
||
let json1 = {
|
||
article:json
|
||
}
|
||
if(this.id) {
|
||
json1.id = this.id
|
||
}
|
||
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
|
||
this.$http.post(this.submit_url,json1).then(response => {
|
||
if (response.data.result) {
|
||
this.$message({type: 'success',message: '操作成功!'});
|
||
this.goBack();
|
||
} else {
|
||
this.$message({message: response.data.msg,type: 'error'});
|
||
}
|
||
loading.close();
|
||
},response => {
|
||
loading.close();
|
||
});
|
||
}
|
||
else {
|
||
console.log('error submit!!');
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
openCategory() {
|
||
this.is_category = true;
|
||
this.category_name = '';
|
||
},
|
||
|
||
addCategory() {
|
||
|
||
if(!this.category_name) {
|
||
this.$message({type: 'error',message: '分类名不能为空!'});
|
||
return
|
||
}
|
||
let loading = this.$loading({target:document.querySelector("#category"),background: 'rgba(0, 0, 0, 0)'});
|
||
this.$http.post("{!! yzWebFullUrl('plugin.article.manager.article-vue.add-category') !!}",{name:this.category_name}).then(response => {
|
||
if (response.data.result) {
|
||
this.$message({type: 'success',message: '添加成功!'});
|
||
this.is_category = false;
|
||
this.categorys = response.data.data
|
||
} else {
|
||
this.$message({message: response.data.msg,type: 'error'});
|
||
}
|
||
loading.close();
|
||
},response => {
|
||
loading.close();
|
||
});
|
||
},
|
||
changeLevel(val) {
|
||
console.log(val);
|
||
if(val=='all') {
|
||
this.form.show_levels = []
|
||
}
|
||
else {
|
||
if(this.form.show_levels.length>0) {
|
||
this.all_level = 0;
|
||
}
|
||
}
|
||
|
||
},
|
||
isNumber(index,type,key) {
|
||
console.log(this.form[key][index][type])
|
||
if(type=='quantity'){
|
||
this.form[key][index][type] = this.form[key][index][type].replace(/[^\d]/g,'')
|
||
}
|
||
else if(type=='single_consumption'){
|
||
this.form[key][index][type] = this.form[key][index][type].replace(/[^\d]/g,'')
|
||
}
|
||
else if(type=='price') {
|
||
this.form[key][index][type] = this.form[key][index][type].replace(/[^\d.]/g,'')
|
||
this.form[key][index][type] = this.form[key][index][type].replace(/\.{2,}/g, ".");
|
||
this.form[key][index][type] = this.form[key][index][type].replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
||
}
|
||
|
||
},
|
||
// 字符转义
|
||
escapeHTML(a) {
|
||
a = "" + a;
|
||
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'");;
|
||
},
|
||
goBack() {
|
||
history.go(-1)
|
||
},
|
||
goParent() {
|
||
window.location.href = `{!! yzWebFullUrl('plugin.article.manager.article.index') !!}`;
|
||
},
|
||
//弹窗显示与隐藏的控制
|
||
changeLink(item){
|
||
this.show=item;
|
||
},
|
||
//当前链接的增加
|
||
parHref(child,confirm){
|
||
this.show=confirm;
|
||
// this.form.link=child;
|
||
let arr = []
|
||
if(this.chooseLink.indexOf(".") != -1) {
|
||
arr = this.chooseLink.split(".")
|
||
this.form[arr[0]][arr[1]] = child;
|
||
}
|
||
else {
|
||
this.form[this.chooseLink] = child;
|
||
}
|
||
|
||
},
|
||
changeprogram(item){
|
||
this.pro=item;
|
||
},
|
||
parpro(child,confirm){
|
||
this.pro=confirm;
|
||
// this.form.prolink=child;
|
||
let arr = []
|
||
if(this.chooseMiniLink.indexOf(".") != -1) {
|
||
arr = this.chooseMiniLink.split(".")
|
||
this.form[arr[0]][arr[1]] = child;
|
||
}
|
||
else {
|
||
this.form[this.chooseMiniLink] = child;
|
||
}
|
||
|
||
},
|
||
showLink(type,name) {
|
||
if(type=="link") {
|
||
this.chooseLink = name;
|
||
this.show = true;
|
||
}
|
||
else {
|
||
this.chooseMiniLink = name;
|
||
this.pro = true;
|
||
}
|
||
},
|
||
|
||
timeStyle(time) {
|
||
let time1 = new Date(time);
|
||
let y = time1.getFullYear();
|
||
let m = time1.getMonth()+1;
|
||
let d = time1.getDate();
|
||
let h = time1.getHours();
|
||
let mm = time1.getMinutes();
|
||
let s = time1.getSeconds();
|
||
return y+'-'+this.add0(m)+'-'+this.add0(d)+' '+this.add0(h)+':'+this.add0(mm)+':'+this.add0(s);
|
||
},
|
||
add0(m) {
|
||
return m<10?'0'+m:m
|
||
},
|
||
|
||
},
|
||
})
|
||
|
||
</script>
|
||
@endsection
|
||
|
||
|