hrtml引入
```
<!-- 引入自定义css/js -->
{include file="../application/templates/pc/phpwcpcmb/header_common.html" /}
{include file="../application/templates/pc/phpwcpcmb/footer_common.html" /}
```
头部
```
<!-- layui-css -->
<link rel="stylesheet" type="text/css" href="__RES__/phpwcjscss/layui/css/layui.css" />
<!-- 字体图标库 -->
<link rel="stylesheet" type="text/css" href="__STATIC__/font-awesome/css/font-awesome.min.css">
<!-- jquery-js -->
<script type="text/javascript" src="__RES__/phpwcjscss/jquery/jquery-3.1.1.js"></script>
<script type="text/javascript" src="__RES__/phpwcjscss/jquery/jquery.SuperSlide.2.1.3"></script>
<!-- layui-js -->
<script type="text/javascript" src="__RES__/phpwcjscss/layui/layui.js"></script>
<!--一键复制JS-->
<script type="text/javascript" src="__RES__/phpwcjscss/clipboard/clipboard.js"></script>
```
尾部
```
<!--加载layui JS开始-->
<script>
;!function(){
//无需再执行layui.use()方法加载模块,直接使用即可
var form = layui.form
,layer = layui.layer;
}();
layui.use('element', function(){
var element = layui.element;
//一些事件监听
element.on('tab(demo)', function(data){
console.log(data);
});
});
</script>
<script>
layui.use('form', function(){
var form = layui.form;
});
</script>
<script>
// 时间选择器(不含分秒)
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#time_t' //指定元素
,min: '2020-01-01' //最小可选日期
,max: '2099-12-30' //最大可选日期
});
});
</script>
<script>
// 时间选择器(包含分秒)
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#time_s' //指定元素
,type: 'datetime'
});
});
</script>
<script>
// 图片上传a
layui.use('upload', function(){
var $ = layui.jquery
,upload = layui.upload;
// 普通图片上传
var uploadInst = upload.render({
elem: '#imga'
,url: '/phpurl/img_file.php' //改成您自己的上传接口
//,url: './source/plugin/phpwc_weike/inc/api/post_file.php' //改成您自己的上传接口
//预读本地文件示例,不支持ie8
,before: function(obj){
obj.preview(function(index, file, result){
$('#imga_demo').attr('src', result); //图片链接(base64)
});
}
// 上传后回调
,done: function(res){
layer.closeAll('loading');
layer.msg("上传成功!");
$('input[name="imgaurl"]').val(res.msg);
}
});
});
</script>
<script>
// 图片上传b
layui.use('upload', function(){
var $ = layui.jquery
,upload = layui.upload;
// 普通图片上传
var uploadInst = upload.render({
elem: '#imgb'
,url: '/phpurl/img_file.php' //改成您自己的上传接口
//预读本地文件示例,不支持ie8
,before: function(obj){
obj.preview(function(index, file, result){
$('#imgb_demo').attr('src', result); //图片链接(base64)
});
}
// 上传后回调
,done: function(res){
layer.closeAll('loading');
layer.msg("上传成功!");
$('input[name="imgburl"]').val(res.msg);
}
});
});
</script>
<script>
// 图片上传c
layui.use('upload', function(){
var $ = layui.jquery
,upload = layui.upload;
// 普通图片上传
var uploadInst = upload.render({
elem: '#imgc'
,url: '/phpurl/img_file.php' //改成您自己的上传接口
//预读本地文件示例,不支持ie8
,before: function(obj){
obj.preview(function(index, file, result){
$('#imgc_demo').attr('src', result); //图片链接(base64)
});
}
// 上传后回调
,done: function(res){
layer.closeAll('loading');
layer.msg("上传成功!");
$('input[name="imgcurl"]').val(res.msg);
}
});
});
</script>
<script>
// 图片上传z
layui.use('upload', function(){
var $ = layui.jquery
,upload = layui.upload;
// 普通图片上传
var uploadInst = upload.render({
elem: '#imgz'
,url: '/phpurl/img_file.php' //改成您自己的上传接口
//预读本地文件示例,不支持ie8
,before: function(obj){
obj.preview(function(index, file, result){
$('#imgz_demo').attr('src', result); //图片链接(base64)
});
}
// 上传后回调
,done: function(res){
layer.closeAll('loading');
layer.msg("上传成功!");
$('input[name="imgzurl"]').val(res.msg);
}
});
});
</script>
<!--加载layui JS结束-->
<script>
var clipboard = new ClipboardJS('.btn');
/*复制成功或失败后提示,不需要可删除*/
clipboard.on('success', function(e) {
alert('复制成功,快去使用吧!');
});
clipboard.on('error', function(e) {
console.log('复制失败了,可能浏览器不支持。');
});
/*复制成功或失败后提示,不需要可删除*/
</script>
```