public
90
public/static/admin/css/app.css
Normal file
@ -0,0 +1,90 @@
|
||||
@charset "utf-8";
|
||||
html,body { background-color: #F8F8F8;}
|
||||
.wrapper { padding: 15px; }
|
||||
.clearfix { zoom: 1; }
|
||||
.clearfix::after { content: ""; height: 0; line-height: 0; display: block; visibility: hidden; clear: both; }
|
||||
|
||||
/** 全局头部 **/
|
||||
.layui-header { z-index: 1000; height: 49px !important; line-height: 49px; border-bottom: 1px solid #f6f6f6; background-color: #FFFFFF; }
|
||||
.layui-header .layui-nav { background: 0 0;}
|
||||
.layui-header .layui-nav .layui-nav-item { height: 49px; line-height: 49px; z-index: 1000; }
|
||||
.layui-header .layui-nav .layui-nav-item a,
|
||||
.layui-header .layui-nav .layui-nav-item .layui-icon { color: #000 !important; }
|
||||
.layui-header .layui-nav-item .layui-icon { font-size: 16px; }
|
||||
.layui-header .layui-this:after { background-color: transparent !important; color: transparent !important; }
|
||||
.layui-header .layui-nav-child dd.layui-this,
|
||||
.layui-header .layui-nav .layui-nav-child dd.layui-this a { background-color: transparent !important; color: #000; }
|
||||
.layui-header .layui-nav-bar,
|
||||
.layui-header .layui-nav-tree .layui-nav-itemed:after { bottom: auto; top: 0 !important; height: 2px; background: #20222a!important; }
|
||||
.layui-header .layui-layout-left { left: 110px; }
|
||||
.layui-header .layui-layout-left .layui-nav-item a { padding-left: 5px; padding-right: 5px; }
|
||||
.layui-header .layui-layout-left .layui-nav-item a .layui-icon { font-size: 18px !important; }
|
||||
.layui-header .userinfo.layui-nav-child { top: 50px !important; }
|
||||
.layui-header .layui-layout-right .layui-nav-more { border-color: #000 transparent transparent; }
|
||||
.layui-header .layui-nav .layui-nav-mored,
|
||||
.layui-header .layui-nav-itemed > a .layui-nav-more { border-color: transparent transparent #000; }
|
||||
|
||||
/** 全局菜单 **/
|
||||
.layui-sidebar::-webkit-scrollbar { width: 0; background-color: #F5F5F5; }
|
||||
.layui-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 2000; height: 100%; overflow-x: hidden; box-shadow: 1px 0px 5px rgb(0 0 0 / 5%); background-color: #FFFFFF; }
|
||||
.layui-sidebar .layui-logo { position: fixed; top: 0; left: 0; z-index: 1100; width: 110px; height: 50px; line-height: 50px; font-size: 16px; text-align: center; color: #FFFFFF; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%); background-color: #FFFFFF; }
|
||||
.layui-sidebar .layui-logo img { height:20px; width: 77px; }
|
||||
.layui-sidebar .layui-side-menu { width: 110px; margin-top: 50px; overflow-y: auto }
|
||||
.layui-sidebar .layui-side-menu li { cursor: pointer; }
|
||||
.layui-sidebar .layui-side-menu li > a { display: block; height: 48px; line-height: 48px; padding: 0 15px; font-size: 14px; color: #666; }
|
||||
.layui-sidebar .layui-side-menu li > a > i { display: inline-block; width: 20px; font-size: 14px; }
|
||||
.layui-sidebar .layui-side-menu li > a.active { color: #3A91FB; background: #EBF4FF; }
|
||||
.layui-sidebar .layui-side-menu li > a:hover { color: #3A91FB; }
|
||||
|
||||
/** 子级菜单 **/
|
||||
.layui-sidebar .layui-side-menu li .child-menu { overflow-y: auto; position: fixed; top: 91px; left: 111px; bottom: 0; z-index: 40; display: none; width: 120px; background: #FFFFFF; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu::-webkit-scrollbar {width: 0;}
|
||||
.layui-sidebar .layui-side-menu li .child-menu dt { height: 50px; line-height: 50px; padding-bottom: 10px; font-size: 14px; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dt strong { display: block; padding-left: 20px; border-bottom: 1px solid #eee; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd { display: block; width: 100%; line-height: 40px; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd a { position: relative; display: block; color: #666; font-size: 13px; padding-left: 24px; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd > a > i { position: absolute; left: 5px; top: 0; display: inline-block; transition: all 0.3s ease-in-out; font-size: 15px; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd a.active { color: #3A91FB; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd a:hover { color: #3A91FB; cursor: pointer; }
|
||||
.layui-sidebar .layui-side-menu li .child-menu dd .child-menu-title:hover { color: #666; }
|
||||
|
||||
/** 全局主体 **/
|
||||
.layui-body {position: absolute; left: 110px; top: 90px; }
|
||||
.layui-body .lay-tabsbody-item { width: 100%; height: 100%; display: none; }
|
||||
.layui-body .lay-iframe { width: 100%; height: 100%; border: 0; }
|
||||
|
||||
/** 页面标签 **/
|
||||
.lay-pagetabs{position: fixed; top: 50px; left: 110px; right: 0; z-index: 999;}
|
||||
.lay-pagetabs{height: 40px; line-height: 40px; padding: 0 80px 0 40px; /*border-bottom: 2px solid #292B34;*/ background-color: #fff; box-sizing: border-box; box-shadow: 0 1px 2px 0 rgba(0,0,0,.1);}
|
||||
.lay-pagetabs .lay-tabs-control{position: absolute; top: 0; width: 40px; height: 100%; text-align: center; cursor: pointer; transition: all .3s; -webkit-transition: all .3s; box-sizing: border-box; border-left: 1px solid #f6f6f6;}
|
||||
.lay-pagetabs .lay-tabs-control:hover{background-color: #f6f6f6;}
|
||||
.lay-pagetabs .layui-icon-prev{left: 0; border-left: none; border-right: 1px solid #f6f6f6;}
|
||||
.lay-pagetabs .layui-icon-next{right: 40px; }
|
||||
.lay-pagetabs .layui-icon-down{right: 0;}
|
||||
|
||||
.lay-tabs-select.layui-nav{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 0; background: none;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-item{line-height: 40px;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-item>a{height: 40px;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-item a{color: #666;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-child{top: 40px; left: auto; right: 0;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-child dd.layui-this,
|
||||
.lay-tabs-select.layui-nav .layui-nav-child dd.layui-this a{background-color: #f2f2f2!important; color: #333;}
|
||||
.lay-tabs-select.layui-nav .layui-nav-more,
|
||||
.lay-tabs-select.layui-nav .layui-nav-bar{display: none;}
|
||||
|
||||
.lay-pagetabs .layui-tab{margin: 0; overflow: hidden;}
|
||||
.lay-pagetabs .layui-tab-title{height: 40px; border: none;}
|
||||
.lay-pagetabs .layui-tab-title li{min-width: 0; line-height: 40px; max-width: 160px; text-overflow: ellipsis; padding-right: 40px; overflow: hidden; border-right: 1px solid #f6f6f6; vertical-align: top;}
|
||||
.lay-pagetabs .layui-tab-title li:first-child{ padding-right: 15px;}
|
||||
.lay-pagetabs .layui-tab-title li:first-child .layui-tab-close{display: none;}
|
||||
.lay-pagetabs .layui-tab-title li .layui-tab-close{position: absolute; right: 8px; top: 50%; margin: -7px 0 0 0; width: 16px; height: 16px; line-height: 16px; border-radius: 50%; font-size: 12px;}
|
||||
.lay-pagetabs .layui-tab-title li:after{content:''; position: absolute; top: 0; left: 0; width: 0; height: 2px; border-radius: 0; background-color: #EBF4FF; transition: all .3s; -webkit-transition: all .3s;}
|
||||
.lay-pagetabs .layui-tab-title li:hover:after{width: 100%;}
|
||||
|
||||
#LAY_app_tabsheader li:hover,
|
||||
#LAY_app_tabsheader li.layui-this{ background-color: #EBF4FF; }
|
||||
#LAY_app_tabsheader li.layui-this:after{width: 100%; border: none; height: 2px; background-color: #3A91FB !important;}
|
||||
#LAY_app_tabsheader .layui-this { color: #3A91FB !important; }
|
||||
#LAY_app_tabsheader li:after { background-color: #3A91FB !important; }
|
||||
|
||||
|
||||
198
public/static/admin/css/goods.css
Normal file
@ -0,0 +1,198 @@
|
||||
.layui-form-label {
|
||||
color: #6a6f6c;
|
||||
width: 100px;
|
||||
}
|
||||
.layui-input-block {
|
||||
margin-left: 130px;
|
||||
}
|
||||
|
||||
.add-spec-value {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
color: #4e8bff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.add-spec-value:hover {
|
||||
color: #0641cb;
|
||||
}
|
||||
|
||||
.goods-img-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: -4px;
|
||||
right: -2px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.goods-li {
|
||||
float: left;
|
||||
opacity: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.goods-img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.goods-img-add {
|
||||
font-size: 60px;
|
||||
vertical-align: middle
|
||||
}
|
||||
.master-image{
|
||||
margin-bottom:4px;
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.goods-spec-img {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.goods-spec-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 16px;
|
||||
line-height: 14px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.goods-spec-value-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 15px;
|
||||
line-height: 20px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.goods-spec-img-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: -2px;
|
||||
right: 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 16px;
|
||||
line-height: 14px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.goods-one-spec-img-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: -2px;
|
||||
right: 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 16px;
|
||||
line-height: 14px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.goods-spec-value-input {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.goods-spec {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
background-color: #f3f5f9;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.goods-spec-div {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.form-label-asterisk {
|
||||
color: red;
|
||||
padding-right: 5px
|
||||
}
|
||||
|
||||
.spec-lists-table th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.spec-lists-table td {
|
||||
text-align: center;
|
||||
}
|
||||
.batch-div{
|
||||
padding-bottom: 10px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.click-a {
|
||||
color: #4685fd;
|
||||
padding-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.batch-spec-title{
|
||||
color: #6a6f6c;
|
||||
float: left;
|
||||
}
|
||||
.unit-tips{
|
||||
float: left;
|
||||
display: block;
|
||||
padding: 9px 0!important;
|
||||
line-height: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.show-video{
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.goods-video-del-x {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: -4px;
|
||||
right: -16px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: hsla(0, 0%, 60%, .6);
|
||||
border-radius: 10px;
|
||||
}
|
||||
127
public/static/admin/css/like.css
Normal file
@ -0,0 +1,127 @@
|
||||
.layui-table-cell {height: auto; }
|
||||
.like-layui-collapse {
|
||||
border-width: 1px;
|
||||
border-style: dashed;
|
||||
border-radius: 2px;
|
||||
border-color: #c4c4c4;
|
||||
}
|
||||
.like-layui-colla-title {
|
||||
position: relative;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
padding: 0 15px 0 35px;
|
||||
color: #333;
|
||||
background-color: #ffffff;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.like-layui-colla-title:hover {
|
||||
color: #2ba1fc;
|
||||
}
|
||||
|
||||
|
||||
.like-layui-form-label{
|
||||
margin: 20px;
|
||||
padding-left: 5px;
|
||||
border-left: solid #2ba1fc 8px;
|
||||
text-align: left;
|
||||
width: 100px
|
||||
}
|
||||
.like-layui-elem-quote {
|
||||
margin-bottom: 10px;
|
||||
padding: 15px;
|
||||
line-height: 22px;
|
||||
border-left: 5px solid #2ba1fc;
|
||||
border-radius: 0 2px 2px 0;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.layui-form-select dl dd.layui-this {
|
||||
background-color: #1E9FFF;
|
||||
}
|
||||
|
||||
.layui-form-onswitch {
|
||||
border-color: #1E9FFF;
|
||||
background-color: #1E9FFF;
|
||||
}
|
||||
|
||||
.layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||
position: absolute;
|
||||
left: -1px;
|
||||
top: -1px;
|
||||
padding: 1px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #1E9FFF;
|
||||
}
|
||||
|
||||
.info_footer {
|
||||
text-align: center;
|
||||
bottom: 20px;
|
||||
left: 40%;
|
||||
font-size:14px;
|
||||
color:rgba(112,112,112,1);
|
||||
font-weight:400;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
|
||||
/** 按钮样式 **/
|
||||
.layui-form-radioed>i {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
.layui-form-radio>i:hover, .layui-form-radioed>i {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
.layui-form-checked[lay-skin=primary] i {
|
||||
border-color: #1E9FFF!important;
|
||||
background-color: #1E9FFF;
|
||||
color: #fff;
|
||||
}
|
||||
.layui-form-checkbox[lay-skin=primary]:hover i {
|
||||
border-color: #1E9FFF;
|
||||
color: #fff;
|
||||
}
|
||||
.layui-btn-primary:hover {
|
||||
border-color: #1E9FFF;
|
||||
color: #333;
|
||||
}
|
||||
.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed > i{
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 文件仓库 FZR **/
|
||||
.file-manager { display: flex; justify-content: flex-start; position: absolute; top: 0; right: 0; left: 0; bottom: 0; background-color: #FFFFFF; }
|
||||
.file-manager .layui-icon-file:before { content: "\e623"; }
|
||||
.file-manager .cate-tree-more { width: 150px; flex-shrink: 0; border-right: 1px #EEEEEE solid; }
|
||||
.file-manager .gallery { flex: 1; }
|
||||
.file-manager .warehouse:after { content: ""; height: 0; line-height: 0; display: block; visibility: hidden; clear: both; }
|
||||
.file-manager .warehouse li { cursor: pointer; width: 120px; height: 127px; float: left; margin: 5px 0 0 10px; text-align: center; position: relative; border-radius: 5px; border: 2px solid #EEEEEE; }
|
||||
.file-manager .warehouse li:hover { border-radius: 5px; background-color: #f1f5fa; }
|
||||
.file-manager .warehouse li.on { border-radius: 5px; border: 2px solid #3B91FF; background-color: #f1f5fa; }
|
||||
.file-manager .warehouse .file-icon { position: relative; margin: 9px auto 0; width: 84px; height: 84px; background-repeat: no-repeat; overflow: hidden; }
|
||||
.file-manager .warehouse .file-image { width: 100%; height: 100%; vertical-align: middle; }
|
||||
.file-manager .warehouse .file-name { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin: 6px 5px 5px; }
|
||||
.file-manager .footer { display: flex; justify-content: space-between; height: 55px; min-height: 55px; align-items: center; padding: 0 30px; position: fixed; bottom: 0; left: 201px; right: 0; border-top: 1px solid #EEEEEE; background-color: #FFFFFF; }
|
||||
.file-manager .footer #page { margin: 0 20px; }
|
||||
.file-manager .empty { width: 100%; text-align: center; margin-top: 70px; }
|
||||
.file-manager .empty i { font-size:120px; color:#EEEEEE; }
|
||||
.file-manager .empty p {font-size: 14px; margin-top: 20px; color:#999; }
|
||||
|
||||
/** 图片上传容器 FZR **/
|
||||
.like-upload-image:after { content: ""; height: 0; line-height: 0; display: block; visibility: hidden; clear: both; }
|
||||
.upload-image-div, .upload-image-elem { position: relative; height: 80px; width: 80px; float: left; opacity: 1; margin: 4px; text-align: center; border: 1px dashed #a0a0a0; background-image: url(/static/admin/images/image.png); background-repeat: no-repeat; background-position: 50% 35%; }
|
||||
.upload-image-div:hover .del-upload-btn { visibility: visible; }
|
||||
.upload-image-div img { width: 100%; height: 100%; box-sizing: border-box; }
|
||||
.add-upload-image { cursor: pointer; position: absolute; z-index: 100; top: 58px; right: -10%; width: 100px; height: 20px; font-size: 8px; line-height: 16px; text-align: center; border-radius: 10px; color: #4e8bff; }
|
||||
.del-upload-btn { visibility: hidden; display: flex; align-items: center; justify-content: center; position: absolute; z-index: 100; top: -11px; right: -9px; width: 20px; height: 20px; cursor: pointer; font-size: 14px; color: #FFFFFF; border-radius: 50%; background: hsla(0, 0%, 60%, .6); }
|
||||
|
||||
/* 视频上传容器 */
|
||||
.like-upload-video:after { content: ""; height: 0; line-height: 0; display: block; visibility: hidden; clear: both; }
|
||||
.upload-video-div, .upload-video-elem { position: relative; height: 80px; width: 80px; float: left; opacity: 1; margin: 4px; text-align: center; border: 1px dashed #a0a0a0; background-image: url(/static/lib/layui/images/other/video.png); background-repeat: no-repeat; background-position: 50% 35%; }
|
||||
.upload-video-div:hover .del-upload-btn { visibility: visible; }
|
||||
.upload-video-div video { width: 100%; height: 100%; box-sizing: border-box; }
|
||||
.add-upload-video { cursor: pointer; position: absolute; z-index: 100; top: 58px; right: -10%; width: 100px; height: 20px; font-size: 8px; line-height: 16px; text-align: center; border-radius: 10px; color: #4e8bff; }
|
||||
BIN
public/static/admin/images/1.jpg
Normal file
|
After Width: | Height: | Size: 185 KiB |
BIN
public/static/admin/images/image.png
Normal file
|
After Width: | Height: | Size: 655 B |
BIN
public/static/admin/images/index.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
public/static/admin/images/mobile_foot.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/static/admin/images/mobile_head.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
public/static/admin/images/nearby_shops.png
Normal file
|
After Width: | Height: | Size: 739 KiB |
BIN
public/static/admin/images/zhibo.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
388
public/static/admin/js/app.js
Normal file
@ -0,0 +1,388 @@
|
||||
/**
|
||||
* NOTE: 核心框架
|
||||
* author: FZR
|
||||
* desc: 大鹏一日同风起, 扶摇直上九万里
|
||||
*/
|
||||
layui.use(["form", "element"], function () {
|
||||
var $ = layui.jquery;
|
||||
var element = layui.element;
|
||||
var $body = $("body");
|
||||
var APP_BODY = "#LAY_app_body";
|
||||
var TABS_HEADER = "#LAY_app_tabsheader>li";
|
||||
var FILTER_TAB_TABS = "lay-layout-tabs";
|
||||
var TABS_BODY = 'lay-tabsbody-item'
|
||||
var SHOW = 'layui-show'
|
||||
//同步路由
|
||||
|
||||
var admin = {
|
||||
tabsPage: {},
|
||||
//关闭当前 pageTabs
|
||||
closeThisTabs: function () {
|
||||
if (!admin.tabsPage.index) return;
|
||||
$(TABS_HEADER).eq(admin.tabsPage.index).find('.layui-tab-close').trigger('click');
|
||||
$(TABS_HEADER).eq(admin.tabsPage.index).trigger('click');
|
||||
},
|
||||
//获取页面标签主体元素
|
||||
tabsBody: function (index) {
|
||||
return $(APP_BODY).find('.' + TABS_BODY).eq(index || 0);
|
||||
}
|
||||
//resize事件管理
|
||||
, resize: function (fn) {
|
||||
var router = layui.router()
|
||||
, key = router.path.join('-');
|
||||
|
||||
if (admin.resizeFn[key]) {
|
||||
$win.off('resize', admin.resizeFn[key]);
|
||||
delete admin.resizeFn[key];
|
||||
}
|
||||
|
||||
if (fn === 'off') return; //如果是清除 resize 事件,则终止往下执行
|
||||
|
||||
fn(), admin.resizeFn[key] = fn;
|
||||
$win.on('resize', admin.resizeFn[key]);
|
||||
}
|
||||
, resizeFn: {}
|
||||
, runResize: function () {
|
||||
var router = layui.router()
|
||||
, key = router.path.join('-');
|
||||
admin.resizeFn[key] && admin.resizeFn[key]();
|
||||
}
|
||||
, delResize: function () {
|
||||
this.resize('off');
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 操作事件
|
||||
*/
|
||||
let events = {
|
||||
// 左右滚动页面标签
|
||||
rollPage: function (type, index) {
|
||||
var tabsHeader = $('#LAY_app_tabsheader')
|
||||
, liItem = tabsHeader.children('li')
|
||||
, scrollWidth = tabsHeader.prop('scrollWidth')
|
||||
, outerWidth = tabsHeader.outerWidth()
|
||||
, tabsLeft = parseFloat(tabsHeader.css('left'));
|
||||
|
||||
//右左往右
|
||||
if (type === 'left') {
|
||||
if (!tabsLeft && tabsLeft <= 0) return;
|
||||
|
||||
//当前的left减去可视宽度,用于与上一轮的页标比较
|
||||
var prefLeft = -tabsLeft - outerWidth;
|
||||
|
||||
liItem.each(function (index, item) {
|
||||
var li = $(item)
|
||||
, left = li.position().left;
|
||||
|
||||
if (left >= prefLeft) {
|
||||
tabsHeader.css('left', -left);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else if (type === 'auto') { //自动滚动
|
||||
(function () {
|
||||
var thisLi = liItem.eq(index), thisLeft;
|
||||
|
||||
if (!thisLi[0]) return;
|
||||
thisLeft = thisLi.position().left;
|
||||
|
||||
//当目标标签在可视区域左侧时
|
||||
if (thisLeft < -tabsLeft) {
|
||||
return tabsHeader.css('left', -thisLeft);
|
||||
}
|
||||
|
||||
//当目标标签在可视区域右侧时
|
||||
if (thisLeft + thisLi.outerWidth() >= outerWidth - tabsLeft) {
|
||||
var subLeft = thisLeft + thisLi.outerWidth() - (outerWidth - tabsLeft);
|
||||
liItem.each(function (i, item) {
|
||||
var li = $(item)
|
||||
, left = li.position().left;
|
||||
|
||||
//从当前可视区域的最左第二个节点遍历,如果减去最左节点的差 > 目标在右侧不可见的宽度,则将该节点放置可视区域最左
|
||||
if (left + tabsLeft > 0) {
|
||||
if (left - tabsLeft > subLeft) {
|
||||
tabsHeader.css('left', -left);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}());
|
||||
} else {
|
||||
//默认向左滚动
|
||||
liItem.each(function (i, item) {
|
||||
var li = $(item)
|
||||
, left = li.position().left;
|
||||
|
||||
if (left + li.outerWidth() >= outerWidth - tabsLeft) {
|
||||
tabsHeader.css('left', -left);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 向右滚动页面标签
|
||||
, leftPage: function () {
|
||||
events.rollPage('left');
|
||||
}
|
||||
// 向左滚动页面标签
|
||||
, rightPage: function () {
|
||||
events.rollPage();
|
||||
}
|
||||
//关闭当前标签页
|
||||
, closeThisTabs: function () {
|
||||
events.rollPage('auto', admin.tabsPage.index);
|
||||
var topAdmin = parent === self ? admin : parent.layui.admin;
|
||||
topAdmin.closeThisTabs();
|
||||
}
|
||||
//关闭其它标签页
|
||||
, closeOtherTabs: function (type) {
|
||||
events.rollPage('auto', 0);
|
||||
var TABS_REMOVE = 'LAY-system-pagetabs-remove';
|
||||
if (type === 'all') {
|
||||
$(TABS_HEADER + ':gt(0)').remove();
|
||||
$(APP_BODY).find('.' + TABS_BODY + ':gt(0)').remove();
|
||||
|
||||
$(TABS_HEADER).eq(0).trigger('click');
|
||||
} else {
|
||||
$(TABS_HEADER).each(function (index, item) {
|
||||
if (index && index != admin.tabsPage.index) {
|
||||
$(item).addClass(TABS_REMOVE);
|
||||
admin.tabsBody(index).addClass(TABS_REMOVE);
|
||||
}
|
||||
});
|
||||
$('.' + TABS_REMOVE).remove();
|
||||
admin.tabsPage.index = 1
|
||||
}
|
||||
}
|
||||
//关闭全部标签页
|
||||
, closeAllTabs: function () {
|
||||
events.closeOtherTabs('all');
|
||||
// 需要删除 layui-body下面的容器, 保留工作台
|
||||
// 菜单切换到控制台的, 可以模拟点击标签, 看看能不能自动切换
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 打开标签(用于侧边菜单点击)
|
||||
* @author FZR
|
||||
* @param url (要打开的URL)
|
||||
* @param text (标签文本)
|
||||
* @param menus_id (数据库中的菜单ID)
|
||||
*/
|
||||
var openTabsPage = function (url, text, menus_id) {
|
||||
var matchTo;
|
||||
var tabs = $("#LAY_app_tabsheader > li");
|
||||
|
||||
// 循环查找是否已存在标签栏中
|
||||
tabs.each(function () {
|
||||
var lay_id = $(this).attr('lay-id');
|
||||
var lay_url = $(this).attr("lay-attr");
|
||||
if (lay_url === url && lay_id === menus_id) {
|
||||
matchTo = true;
|
||||
}
|
||||
});
|
||||
|
||||
// 如果标签不存在则创建
|
||||
if (!matchTo) {
|
||||
setTimeout(function () {
|
||||
$(APP_BODY).find(".lay-tabsbody-item").removeClass("layui-show");
|
||||
$(APP_BODY).append([
|
||||
'<div lay-id="' + menus_id + '" class="lay-tabsbody-item layui-show">'
|
||||
, '<iframe src="' + url + '" class="lay-iframe"></iframe>'
|
||||
, '</div>'
|
||||
].join(''));
|
||||
}, 10);
|
||||
|
||||
element.tabAdd(FILTER_TAB_TABS, {
|
||||
title: text || '新打开标签'
|
||||
, id: menus_id
|
||||
, attr: url
|
||||
});
|
||||
|
||||
} else {
|
||||
//页面已存在,直接切换到页面就行,而不是重新加载新页面
|
||||
$(APP_BODY).find(".lay-tabsbody-item").removeClass("layui-show");
|
||||
$(APP_BODY).find(".lay-tabsbody-item[lay-id=" + menus_id + "]").addClass("layui-show");
|
||||
}
|
||||
|
||||
// 定位到当前Tabs
|
||||
element.tabChange(FILTER_TAB_TABS, menus_id);
|
||||
};
|
||||
|
||||
/**
|
||||
* 标签栏切换点击
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("click", TABS_HEADER, function () {
|
||||
var url = $(this).attr('lay-attr');
|
||||
var text = $(this).children("span").html();
|
||||
var lay_id = $(this).attr('lay-id');
|
||||
var elem = $(".layui-sidebar .layui-side-menu li a[lay-id=" + lay_id + "]");
|
||||
|
||||
// 切换到指定一级菜单
|
||||
elem.parents("li").siblings().find("a").removeClass("active");
|
||||
elem.parents("li").children("a").addClass("active");
|
||||
// 是否存在二级菜单
|
||||
if (elem.parents("li").has("dl").length) {
|
||||
$(".layui-sidebar > .layui-side-menu li dl").css("display", "");
|
||||
elem.parents("li").children("dl").css("display", "block");
|
||||
|
||||
elem.parents("li").children("dl").find("a").removeClass("active");
|
||||
elem.parents("li").children("dl").find("a[lay-id=" + lay_id + "]").addClass("active");
|
||||
$(APP_BODY).css({ "left": "232px" });
|
||||
} else {
|
||||
$(APP_BODY).css({ "left": "110px" });
|
||||
$(".layui-sidebar > .layui-side-menu li > dl").css("display", "");
|
||||
}
|
||||
|
||||
//页面已存在,直接切换到页面就行,而不是重新加载新页面
|
||||
$(APP_BODY).find(".lay-tabsbody-item").removeClass("layui-show");
|
||||
$(APP_BODY).find(".lay-tabsbody-item[lay-id=" + lay_id + "]").addClass("layui-show");
|
||||
});
|
||||
|
||||
/**
|
||||
* 侧边菜单切换(一二级)
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("click", ".layui-sidebar .layui-side-menu li", function () {
|
||||
if (!$(this).children("a").hasClass("active")) {
|
||||
// 一级菜单样式切换
|
||||
$(this).siblings().find("a").removeClass("active");
|
||||
$(this).children("a").addClass("active");
|
||||
// 二级菜单显示或隐藏
|
||||
if ($(this).has("dl").length) {
|
||||
$(".layui-sidebar > .layui-side-menu li dl").css("display", "");
|
||||
$(this).children("dl").css("display", "block");
|
||||
var towSubMenu = $(this).children("dl").find("dd > a");
|
||||
var Node = towSubMenu.eq(0).children("i").length ? towSubMenu.eq(1) : towSubMenu.eq(0);
|
||||
Node.addClass("active");
|
||||
$(APP_BODY).css({ "left": "232px" })
|
||||
|
||||
var id = Node.attr("lay-id");
|
||||
var url = Node.attr("lay-href");
|
||||
var text = Node.html();
|
||||
openTabsPage(url, text, id)
|
||||
} else {
|
||||
$(".layui-sidebar > .layui-side-menu li > dl").css("display", "");
|
||||
$(APP_BODY).css({ "left": "110px" });
|
||||
|
||||
var id = $(this).children("a").attr("lay-id");
|
||||
var url = $(this).children("a").attr("lay-href");
|
||||
var text = $(this).find("cite").html();
|
||||
openTabsPage(url, text, id)
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 三级菜单(显示/隐藏)
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("click", ".layui-sidebar > .layui-side-menu .child-menu-title", function () {
|
||||
if ($(this).children("i").hasClass("layui-icon-triangle-d")) {
|
||||
$(this).children("i").removeClass("layui-icon-triangle-d");
|
||||
$(this).children("i").addClass("layui-icon-triangle-r");
|
||||
$(this).next().stop().slideUp();
|
||||
} else {
|
||||
$(this).children("i").removeClass("layui-icon-triangle-r");
|
||||
$(this).children("i").addClass("layui-icon-triangle-d");
|
||||
$(this).next().stop().slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 三级菜(样式切换)
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("click", ".layui-sidebar > .layui-side-menu .child-menu dd", function () {
|
||||
if (!$(this).children("a").hasClass("child-menu-title")) {
|
||||
$(".layui-sidebar > .layui-side-menu .child-menu dd a").removeClass("active");
|
||||
$(this).children("a").addClass("active");
|
||||
// 打开标签
|
||||
var id = $(this).children("a").attr("lay-id");
|
||||
var url = $(this).children("a").attr("lay-href");
|
||||
var text = $(this).children("a").html();
|
||||
openTabsPage(url, text, id)
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 快捷方式切换
|
||||
*/
|
||||
$body.on("click", ".shortcut-list .shop-item > a", function () {
|
||||
var url = $(this).attr('lay-href');
|
||||
var id = $(this).attr('data-id');
|
||||
var text = $(this).attr('data-txt');
|
||||
console.log('aaaa')
|
||||
openTabsPage(url, text, id)
|
||||
});
|
||||
|
||||
/**
|
||||
* 刷新页面
|
||||
*/
|
||||
$body.on("click", ".layui-header .refresh", function () {
|
||||
var uri = $("#LAY_app_tabsheader li.layui-this").attr("lay-attr");
|
||||
$("#LAY_app_body .lay-tabsbody-item.layui-show .lay-iframe").attr("src", uri);
|
||||
});
|
||||
|
||||
/**
|
||||
* 按键盘全屏或退出全屏
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("keydown", "", function (event) {
|
||||
event = event || window.event || arguments.callee.caller.arguments[0];
|
||||
//按Esc
|
||||
if (event && event.keyCode === 27) {
|
||||
$(".fullscreen").children("i").eq(0).removeClass("layui-icon-screen-restore");
|
||||
}
|
||||
//按F11
|
||||
if (event && event.keyCode === 122) {
|
||||
$(".fullscreen").children("i").eq(0).addClass("layui-icon-screen-restore");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 点击按钮全屏或退出全屏
|
||||
* @author FZR
|
||||
*/
|
||||
$body.on("click", ".fullscreen", function () {
|
||||
var docElm = document.documentElement;
|
||||
if ($(this).children("i").hasClass("layui-icon-screen-restore")) {
|
||||
document.exitFullscreen();
|
||||
$(this).children("i").eq(0).removeClass("layui-icon-screen-restore");
|
||||
} else {
|
||||
docElm.requestFullscreen();
|
||||
$(this).children("i").eq(0).addClass("layui-icon-screen-restore");
|
||||
}
|
||||
});
|
||||
//监听 tabspage 删除
|
||||
element.on('tabDelete(' + FILTER_TAB_TABS + ')', function (obj) {
|
||||
var othis = $(TABS_HEADER + '.layui-this');
|
||||
|
||||
obj.index && admin.tabsBody(obj.index).remove();
|
||||
admin.tabsBody(obj.index).addClass(SHOW).siblings().removeClass(SHOW);
|
||||
events.rollPage('auto', obj.index);
|
||||
if(admin.tabsPage.index == obj.index + 1) return
|
||||
if(othis.index() + 1 == obj.index ) {
|
||||
$(TABS_HEADER).eq(obj.index - 1).trigger('click');
|
||||
}
|
||||
if(othis.index() - 1 == obj.index ) {
|
||||
$(TABS_HEADER).eq(obj.index + 1).trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 点击事件
|
||||
*/
|
||||
$body.on('click', '*[lay-event]', function () {
|
||||
var that = $(this);
|
||||
var attrEvent = that.attr('lay-event');
|
||||
events[attrEvent] && events[attrEvent].call(this, that);
|
||||
});
|
||||
element.on('tab(' + FILTER_TAB_TABS + ')', function (data) {
|
||||
admin.tabsPage.index = data.index;
|
||||
events.rollPage('auto', data.index);
|
||||
});
|
||||
});
|
||||
318
public/static/admin/js/function.js
Normal file
@ -0,0 +1,318 @@
|
||||
var lock = {};
|
||||
var load = {};
|
||||
|
||||
var like = {
|
||||
ajax: function (json) {
|
||||
var load_index = null;
|
||||
if (json.beforeSend === undefined) {
|
||||
if (lock[json.url.replace("/", "_")] !== undefined) {
|
||||
return
|
||||
}
|
||||
lock[json.url.replace("/", "_")] = true;
|
||||
json.beforeSend = function () {
|
||||
load[json.url.replace("/", "_")] = setTimeout(function () {
|
||||
load_index = layer.load(1, {shade: [0.1, "#fff"]})
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
if (json.error === undefined) {
|
||||
json.error = function (res) {
|
||||
layer.msg("网络错误", {offset: "240px", icon: 2, time: 1500}, function () {
|
||||
return
|
||||
})
|
||||
}
|
||||
}
|
||||
if (json.timeout === undefined) {
|
||||
json.timeout = 30000
|
||||
}
|
||||
if (json.type === undefined) {
|
||||
json.type = "get"
|
||||
}
|
||||
json.complete = function (xhr, status) {
|
||||
delete lock[json.url.replace("/", "_")];
|
||||
if (status == "timeout") {
|
||||
layer.msg("请求超时,请重试", {offset: "240px", icon: 2, time: 1500}, function () {
|
||||
if (load_index !== undefined) {
|
||||
layer.close(load_index)
|
||||
}
|
||||
return
|
||||
});
|
||||
return
|
||||
}
|
||||
clearTimeout(load[json.url.replace("/", "_")]);
|
||||
if (load_index !== undefined) {
|
||||
layer.close(load_index)
|
||||
}
|
||||
res = xhr.responseJSON;
|
||||
if (res !== undefined && res.code == -1) {
|
||||
window.location.href = window.location.href
|
||||
}
|
||||
if (res !== undefined && res.code == 0 && res.show == 1) {
|
||||
layer.msg(res.msg, {offset: "240px", icon: 2, time: 1500}, function () {
|
||||
return;
|
||||
})
|
||||
}
|
||||
};
|
||||
$.ajax(json);
|
||||
},
|
||||
tableLists: function (elem, url, cols, where,page = true) {
|
||||
where = where === undefined ? {} : where;
|
||||
page = page === undefined ? true : page;
|
||||
layui.use(['table'], function () {
|
||||
var table = layui.table;
|
||||
table.render({
|
||||
elem: elem
|
||||
, url: url
|
||||
, cols: [cols]
|
||||
, where: where
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: page
|
||||
, parseData: function (res) {
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
setTimeout(function () {
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
keyUpClick: function (elem, target) {
|
||||
$(elem).keyup(function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
$(target).trigger('click');
|
||||
}
|
||||
});
|
||||
},
|
||||
eventClick: function (active) {
|
||||
$(document).on("click", ".layEvent", function () {
|
||||
var type = $(this).attr("lay-event");
|
||||
var obj = $(this).attr("lay-data");
|
||||
|
||||
active[type] ? active[type].call(this, obj) : "";
|
||||
});
|
||||
|
||||
layui.use(["table"], function () {
|
||||
layui.table.on("tool(like-table-lists)", function(obj){
|
||||
var type = obj.event;
|
||||
active[type] ? active[type].call(this, obj) : "";
|
||||
});
|
||||
});
|
||||
},
|
||||
setSelect: function (defaultId, data, targetName, optionName) {
|
||||
layui.use(['form'], function () {
|
||||
var form = layui.form;
|
||||
var selectHtml = '<option value="">请选择'+optionName+'</option>';
|
||||
for (var i in data) {
|
||||
selectHtml += '<option value="' + data[i]['id'] + '">' + data[i]['name'] + '</option>';
|
||||
}
|
||||
$('select[name=' + targetName + ']').html(selectHtml);
|
||||
$('select[name=' + targetName + ']').val(defaultId);
|
||||
form.render('select');
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 上传图片
|
||||
* @author fzr
|
||||
* @param options
|
||||
*/
|
||||
imageUpload: function (options) {
|
||||
var that = options.that;
|
||||
var limit = options.limit || 1;
|
||||
var field = options.field || "image";
|
||||
var content = options.content || '/admin/file/lists?type=10&&shop_id=0';
|
||||
var isSpecImage = options.isSpecImage || false;
|
||||
var specValueTempIds = that.parent().parent().parent().parent().attr('spec-value-temp-ids');
|
||||
|
||||
parent.layer.open({
|
||||
type: 2
|
||||
,title: "上传图片"
|
||||
,shadeClose: true
|
||||
,maxmin: true
|
||||
,anim: 1
|
||||
,shade: 0.3
|
||||
,area: ["90%", "90%"]
|
||||
,content: content,
|
||||
success: function (layero, index) {
|
||||
var iframeNode = $(layero).find("iframe").contents();
|
||||
|
||||
iframeNode.find("#okFile").click(function () {
|
||||
var fileUrls = iframeNode.find("#fileUrl").val();
|
||||
var urls = [];
|
||||
if (fileUrls.length > 0) {
|
||||
urls = fileUrls.split(',');
|
||||
}
|
||||
|
||||
if (urls.length <= 0) {
|
||||
parent.layer.msg("请至少选择一张图片");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (urls.length > limit) {
|
||||
parent.layer.msg("限制只能选"+limit+"张");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSpecImage) {
|
||||
urls.forEach(function (url) {
|
||||
// 商品多规格特殊处理
|
||||
var template = '<div class="upload-image-div">';
|
||||
template += '<img src="'+url+'" alt="img">';
|
||||
template += '<div class="del-upload-btn">x</div>';
|
||||
that.parent().before(template);
|
||||
that.parent().parent().find(".upload-spec-image").val(url);
|
||||
spec_table_data["spec_image[]"+specValueTempIds] = url;
|
||||
});
|
||||
} else {
|
||||
urls.forEach(function (url) {
|
||||
var template = '<div class="upload-image-div" draggable="true">';
|
||||
template += '<img src="'+url+'" alt="img">';
|
||||
template += '<input type="hidden" name="'+field+'" value="'+url+'">';
|
||||
template += '<div class="del-upload-btn">x</div>';
|
||||
that.parent().before(template);
|
||||
});
|
||||
}
|
||||
|
||||
if (limit === 1) that.parent().hide();
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 上传视频
|
||||
* @author fzr
|
||||
* @param options
|
||||
*/
|
||||
videoUpload: function (options) {
|
||||
var that = options.that;
|
||||
var limit = options.limit || 1;
|
||||
var field = options.field || "video";
|
||||
var content = options.content || '/admin/file/lists?type=20';
|
||||
|
||||
parent.layer.open({
|
||||
type: 2
|
||||
,title: "上传视频"
|
||||
,shadeClose: true
|
||||
,maxmin: true
|
||||
,anim: 1
|
||||
,shade: 0.3
|
||||
,area: ["90%", "90%"]
|
||||
,content: content
|
||||
,success: function (layero, index) {
|
||||
var iframeNode = $(layero).find("iframe").contents();
|
||||
iframeNode.find("#okFile").click(function () {
|
||||
var urls = [];
|
||||
iframeNode.find(".warehouse li.on").each(function () {
|
||||
urls.push($(this).attr("lay-href"));
|
||||
});
|
||||
|
||||
if (urls.length <= 0) {
|
||||
parent.layer.msg("请至少选择一个视频");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (urls.length > limit) {
|
||||
parent.layer.msg("限制只能选"+limit+"个");
|
||||
return false;
|
||||
}
|
||||
|
||||
urls.forEach(function (url) {
|
||||
var template = '<div class="upload-video-div">';
|
||||
template += '<video src="'+url+'"></video>';
|
||||
template += '<input type="hidden" name="'+field+'" value="'+url+'">';
|
||||
template += '<div class="del-upload-btn">x</div>';
|
||||
|
||||
that.parent().parent().prepend(template);
|
||||
});
|
||||
|
||||
if (limit === 1) that.parent().hide();
|
||||
parent.layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 删除上传文件
|
||||
* @author fzr
|
||||
*/
|
||||
delUpload: function () {
|
||||
$(document).on("click", ".del-upload-btn", function () {
|
||||
$(this).parent().parent().find(".upload-image-elem").show();
|
||||
$(this).parent().parent().find(".upload-spec-image").val(''); // 商品多规格特殊处理
|
||||
$(this).parent().remove();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 放大图片
|
||||
*/
|
||||
showImg: function (url, xp) {
|
||||
function getImageWidth(url, callback) {
|
||||
var img = new Image();
|
||||
img.src = url;
|
||||
if (img.complete) {
|
||||
callback(img.width, img.height)
|
||||
} else {
|
||||
img.onload = function () {
|
||||
callback(img.width, img.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
xp === undefined ? 500 : xp;
|
||||
getImageWidth(url, function (width, height) {
|
||||
if (height > xp) {
|
||||
var ratio = width / height;
|
||||
height = xp;
|
||||
width = height * ratio
|
||||
}
|
||||
if (width > xp) {
|
||||
var ratio = height / width;
|
||||
width = xp;
|
||||
height = width * ratio
|
||||
}
|
||||
layer.closeAll();
|
||||
layer.open({
|
||||
type: 1,
|
||||
closeBtn: 1,
|
||||
shade: false,
|
||||
title: false,
|
||||
shadeClose: false,
|
||||
area: ["auth", "auth"],
|
||||
content: '<img src="' + url + '" width="' + width + 'px" height="' + height + 'px">'
|
||||
})
|
||||
})
|
||||
},
|
||||
certUpload:function (element, url, domain) {
|
||||
layui.upload.render({
|
||||
elem: element
|
||||
,url: url
|
||||
,accept:'file'
|
||||
,exts:'pem|txt|doc'
|
||||
,done: function(res, index, upload) {
|
||||
var html = '<div class="pay-li">\n' +
|
||||
'<img class="pay-img" ' +
|
||||
'src="/static/common/image/default/upload.png">' +
|
||||
'<a class="pay-img-del-x" style="display: none">x</a>' +
|
||||
'</div>';
|
||||
$(element).prev().val(res.data[1].uri);
|
||||
$(element).after(html);
|
||||
$(element).css('display','none');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||