288 行
12 KiB
HTML
可执行文件
288 行
12 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
||
<style>
|
||
.el-switch {
|
||
margin: 30px;
|
||
}
|
||
|
||
.layui-card-header {
|
||
margin-left: 30px;
|
||
}
|
||
|
||
.layui-card-body {
|
||
margin-left: 115px;
|
||
}
|
||
|
||
.el-button--primary {
|
||
float: right;
|
||
|
||
}
|
||
|
||
.edui-default .edui-toolbar .edui-combox .edui-combox-body {
|
||
line-height: 14px !important;
|
||
}
|
||
|
||
.edui-default .edui-button-body, .edui-splitbutton-body, .edui-menubutton-body, .edui-combox-body {
|
||
line-height: 14px !important;
|
||
}
|
||
</style>
|
||
<div class="" id="plusIndexApp" v-cloak>
|
||
<div class="goods_title">
|
||
<div class="goods_title_inner">
|
||
Plus会员设置 <span style="color:orangered"></span>
|
||
</div>
|
||
</div>
|
||
<el-switch
|
||
v-model="switch_type"
|
||
<if condition="$authArr['switch_operation'] neq true">disabled</if>
|
||
active-text="开"
|
||
inactive-text="关" @change="switch_operation">
|
||
</el-switch><span style="color: red">Plus会员功能的总开关,如果存在Plus会员无法关闭</span>
|
||
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
|
||
<el-tab-pane label="初始化引导设置" name="1">
|
||
<form class="layui-card" id="form_one">
|
||
<input type="hidden" name="type" value="1">
|
||
<div class="layui-card-header">背景图片</div>
|
||
<div class="layui-card-body">
|
||
<label class="file_label">
|
||
<if condition="$authArr['getGalleryImages'] eq true">
|
||
<input type="hidden" name="image_id" value="0">
|
||
<input type="file" name="image"
|
||
placeholder="选择图标" accept="image/png,image/jpeg" d-value="{$info['image']}"/>
|
||
</if>
|
||
<img :src="defaultImg"
|
||
onerror="this.onerror=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<if condition="$authArr['getGalleryImages'] eq true">
|
||
<el-button plain size="small" @click="selectImage('image')"
|
||
icon="el-icon-upload el-icon--right">选择图片
|
||
</el-button>
|
||
|
||
<span class="content-notes">建议上传宽高为128*128(或者等比例)</span>
|
||
</if>
|
||
</div>
|
||
</form>
|
||
<div class="gA_inner layui-form-item" style="align-items: flex-start;">
|
||
<div class="gA_inner03" style="margin-right: 0">
|
||
<span class="layui-form-label">Plus规则:</span>
|
||
</div>
|
||
<div>
|
||
<textarea id="editor" type="text/plain" style="width:600px;height: 400px;"
|
||
name="details">{$plus_info['text']}</textarea>
|
||
</div>
|
||
</div>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="续费引导设置" name="2">
|
||
<form class="layui-card" id="form_two">
|
||
<input type="hidden" name="type" value="2">
|
||
<div class="layui-card-header">背景图片</div>
|
||
<div class="layui-card-body">
|
||
<label class="file_label">
|
||
<if condition="$authArr['getGalleryImages'] eq true">
|
||
<input type="hidden" name="image_two_id" value="0">
|
||
<input type="file" name="image_two"
|
||
placeholder="选择图标" accept="image/png,image/jpeg" d-value="{$info['image']}"/>
|
||
</if>
|
||
<img :src="defaultImg_two"
|
||
onerror="this.onerror=null;this.src='__PUBLIC__/paper/images/wx_add.png'">
|
||
</label>
|
||
<if condition="$authArr['getGalleryImages'] eq true">
|
||
<el-button plain size="small" @click="selectImage('image_two')"
|
||
icon="el-icon-upload el-icon--right">选择图片
|
||
</el-button>
|
||
<span class="content-notes">建议上传宽高为128*128(或者等比例)</span>
|
||
</if>
|
||
</div>
|
||
</form>
|
||
<div class="gA_inner layui-form-item" style="align-items: flex-start;">
|
||
<div class="gA_inner03" style="margin-right: 0">
|
||
<span class="layui-form-label">Plus规则:</span>
|
||
</div>
|
||
<div>
|
||
<textarea id="editor_two" type="text/plain" style="width:600px;height: 400px;"
|
||
name="details">{$plus_info['renew_text']}</textarea>
|
||
</div>
|
||
</div>
|
||
</el-tab-pane>
|
||
<if condition="$authArr['onSubmit'] eq true">
|
||
<el-button type="primary" @click="onSubmit" style=" margin-right: 600px;" id="preser_one">保存</el-button>
|
||
</if>
|
||
</el-tabs>
|
||
<el-dialog title="选择图片" :modal-append-to-body="false" :visible.sync="showSelectImage"
|
||
custom-class="select-image-el-dialog" :top="'10px'">
|
||
<template-select-image :can-select-num="1" @selectfile="selectFile"></template-select-image>
|
||
</el-dialog>
|
||
</div>
|
||
<script type="text/javascript">
|
||
UE.delEditor('editor');
|
||
UE.delEditor('editor_two');
|
||
var ue = UE.getEditor('editor');
|
||
var ue_two = UE.getEditor('editor_two');
|
||
</script>
|
||
<script type="text/javascript">
|
||
new Vue({
|
||
el: '#plusIndexApp',
|
||
data: {
|
||
activeName: '1',
|
||
switch_type: "{$plus_info['switch_type']}" == 2 ? true : false,
|
||
recharge_switch_type: "{$plus_info['recharge_switch_type']}" == 2 ? true : false,
|
||
purchase_switch_type: "{$plus_info['purchase_switch_type']}" == 2 ? true : false,
|
||
showSelectImage: false,
|
||
actFileName: '',
|
||
defaultImg: "{$gallery_path}",
|
||
defaultImg_two: "{$renew_gallery_path}",
|
||
recharge_money: "{$plus_info['recharge_money']}",
|
||
purchase_money: "{$plus_info['purchase_money']}",
|
||
},
|
||
methods: {
|
||
handleClick(tab, event) {
|
||
var that = this;
|
||
var type = tab.name;
|
||
that.activeName = type;
|
||
},
|
||
switch_operation: function () {
|
||
var that = this;
|
||
var switch_type = that.switch_type;
|
||
if (switch_type) {
|
||
var switch_state = 2; //开启
|
||
} else {
|
||
var switch_state = 1; //关闭
|
||
}
|
||
$.ajax({
|
||
url: "{:U('switch_operation')}",
|
||
type: "post",
|
||
data: {switch_state: switch_state},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.switch_type = switch_type;
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
that.switch_type = true
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
}
|
||
})
|
||
},
|
||
selectFile: function (item) {
|
||
this.showSelectImage = false;
|
||
if (!item.length) {
|
||
$("input[name='" + this.actFileName + "']").click();
|
||
} else {
|
||
$("input[name='" + this.actFileName + "_id']").val(item[0].id);
|
||
this.setDefaultImg(item[0].path);
|
||
}
|
||
},
|
||
selectImage: function (actName) {
|
||
this.actFileName = actName;
|
||
this.showSelectImage = true;
|
||
},
|
||
setDefaultImg: function (path) {
|
||
var that = this;
|
||
var activeName = that.activeName
|
||
if (activeName == 1) {
|
||
var fd = new FormData(document.getElementById('form_one'));
|
||
} else if (activeName == 2) {
|
||
var fd = new FormData(document.getElementById('form_two'));
|
||
}
|
||
that.$loading({
|
||
lock: true,
|
||
text: '上传中,请等待',
|
||
spinner: 'el-icon-loading',
|
||
background: 'rgba(255, 255, 255, 0.7)'
|
||
});
|
||
$.ajax({
|
||
url: "{:U('setDefaultImg')}",
|
||
type: "POST",
|
||
data: fd,
|
||
processData: false, // jQuery不要去处理发送的数据
|
||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||
success: function (res) {
|
||
that.$loading().close();
|
||
if (res.status == 1) {
|
||
if (activeName == 1) {
|
||
that.defaultImg = path;
|
||
} else if (activeName == 2) {
|
||
that.defaultImg_two = path;
|
||
}
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
});
|
||
}
|
||
},
|
||
error: function () {
|
||
that.$loading().close();
|
||
}
|
||
})
|
||
},
|
||
//初始化与续费保存
|
||
onSubmit: function () {
|
||
var that = this;
|
||
var activeName = that.activeName
|
||
if (activeName == 1) {
|
||
var text = ue.getContent();
|
||
} else if (activeName == 2) {
|
||
var text = ue_two.getContent();
|
||
} else {
|
||
that.$message({
|
||
type: 'success',
|
||
message: '刷新页面',
|
||
duration: 1000
|
||
})
|
||
return false;
|
||
}
|
||
$.ajax({
|
||
url: "{:U('onSubmit')}",
|
||
type: "post",
|
||
data: {text: text, type: activeName},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
that.$message({
|
||
type: 'success',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
} else {
|
||
that.$message({
|
||
type: 'error',
|
||
message: res.msg,
|
||
duration: 1000
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
},
|
||
mounted: function () {
|
||
var that = this;
|
||
$("input[type='file']").on('change', function () {
|
||
if (this.files.length) {
|
||
var imgObj = this.files[0];
|
||
var imgType = ['image/jpeg', 'image/jpg', 'image/png'];
|
||
if (jQuery.inArray(imgObj.type, imgType) != -1) {
|
||
//是图片
|
||
var reader = new FileReader();
|
||
reader.readAsDataURL(imgObj);
|
||
reader.onload = function () {
|
||
that.setDefaultImg(this.result);
|
||
}
|
||
}
|
||
}
|
||
})
|
||
},
|
||
})
|
||
</script> |