init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,254 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--[1.6.48]-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>图片</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
||||
<link rel="stylesheet" href="__PUBLIC__/css/system-gallery.css?v=1.0.3">
|
||||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
||||
<script charset="utf-8" src="__PUBLIC__/js/system-gallery.js?v=1.0.3"></script>
|
||||
<style>
|
||||
.image_slide_show {
|
||||
display: block;
|
||||
font-size: 80px;
|
||||
font-weight: 100;
|
||||
color: #bbb;
|
||||
width: 210px;
|
||||
height: 130px;
|
||||
text-align: center;
|
||||
line-height: 126px;
|
||||
margin-right: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.file_label > input {
|
||||
width: 100px;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.close::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.image_slide_show:hover > .close {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.close:hover {
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
body, html {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
i {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.banner_wrap {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
||||
<link rel="stylesheet" href="__PUBLIC__/css/system-gallery.css?v=1.0.3">
|
||||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
||||
<script charset="utf-8" src="__PUBLIC__/js/system-gallery.js?v=1.0.3"></script>
|
||||
<div id="app" v-cloak>
|
||||
<form id="form" style="padding: 20px 0 100px;">
|
||||
<p>注意:该设置在2.0.0版本及之后的版本将无效</p>
|
||||
<div style="display: none">
|
||||
<input type="file" name="image" id="image">
|
||||
<input type="hidden" name="image_id">
|
||||
</div>
|
||||
<div class="pic_set">
|
||||
<div style="margin-left: 53px">
|
||||
<el-button type="primary" size="small" @click="localImage">本地图片</el-button>
|
||||
<el-button type="primary" size="small" @click="selectImage('image')">图库图片</el-button>
|
||||
<i style="color: #c2ccd1;font-size: 15px;">建议尺寸:414 x 204,或等比例图片</i>
|
||||
</div>
|
||||
<div style="display: flex;padding: 10px 50px;flex-wrap: wrap;">
|
||||
<div class="banner_wrap" v-for="(item,index) in bannerList">
|
||||
<img :src="item.image" class="image_slide_show">
|
||||
<span class="close" @click="del(index)">X</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<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>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
showSelectImage: false,
|
||||
actFileName: '',
|
||||
bannerList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectFile: function (item) {
|
||||
if (item.length) {
|
||||
$('input[name="'+this.actFileName+'"]').val('');
|
||||
$("input[name='" + this.actFileName + "_id']").val(item[0].id);
|
||||
this.addBanner(item[0].path);
|
||||
}
|
||||
this.showSelectImage = false;
|
||||
},
|
||||
selectImage: function (actName) {
|
||||
this.actFileName = actName;
|
||||
this.showSelectImage = true;
|
||||
},
|
||||
localImage:function () {
|
||||
$('#image').click();
|
||||
},
|
||||
del: function (index) {
|
||||
var that = this;
|
||||
this.$confirm("确认要删除该图片吗?", "温馨提示", {
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
that.$loading({
|
||||
lock: true,
|
||||
text: '删除中,请等待',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
});
|
||||
var bannerList = JSON.parse(JSON.stringify(that.bannerList));
|
||||
$.post("{:U('delSlideShow')}", {
|
||||
id: bannerList[index].id
|
||||
}, function (res) {
|
||||
$('input[name="'+this.actFileName+'"]').val('');
|
||||
that.$loading().close();
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
bannerList.splice(index, 1);
|
||||
that.bannerList = [];
|
||||
that.bannerList = bannerList;
|
||||
} else {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
addBanner:function (path) {
|
||||
var fd = new FormData(document.getElementById('form'));
|
||||
var that = this;
|
||||
that.$loading({
|
||||
lock: true,
|
||||
text: '上传中,请等待',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
});
|
||||
$.ajax({
|
||||
url: "{:U('addSlideShow')}",
|
||||
type: "POST",
|
||||
data: fd,
|
||||
processData: false, // jQuery不要去处理发送的数据
|
||||
contentType: false, // jQuery不要去设置Content-Type请求头
|
||||
success: function (res) {
|
||||
that.$loading().close();
|
||||
if (res.status == 1) {
|
||||
var bannerList = JSON.parse(JSON.stringify(that.bannerList));
|
||||
var obj = {
|
||||
id: res.id,
|
||||
image: path
|
||||
}
|
||||
bannerList.unshift(obj);
|
||||
that.bannerList = [];
|
||||
that.bannerList = bannerList;
|
||||
that.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
duration: 1000,
|
||||
});
|
||||
} else {
|
||||
that.$message({
|
||||
type: 'error',
|
||||
message: res.msg,
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
},
|
||||
error:function () {
|
||||
that.$loading().close();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
$("input[type='file']").on('change', function () {
|
||||
if (this.files.length) {
|
||||
var that = this;
|
||||
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 () {
|
||||
app.addBanner(this.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
created: function () {
|
||||
console.log(1)
|
||||
var that = this;
|
||||
$.post("{:U('getBanner')}", {}, function (res) {
|
||||
if (res.status == 1) {
|
||||
that.bannerList = res.data;
|
||||
} else {
|
||||
that.$message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
在新工单中引用
屏蔽一个用户