Waste/Waste.Web.Entry/wwwroot/js/main.js

97 lines
2.5 KiB
JavaScript
Raw Permalink Normal View History

2021-05-27 16:58:40 +08:00
layui.use(['jquery', 'laydate','layer'], function () {
var laydate = layui.laydate;
var layer = layui.layer;
$("input[class*=ydatetime]").each(function () {
laydate.render({
elem: this,
format: 'yyyy/MM/dd'
});
});
$("input[class*=ysdatetime]").each(function () {
laydate.render({
elem: this,
type: 'datetime',
format:'yyyy/MM/dd HH:mm:ss'
});
});
$("input[data-time='ydatetime']").each(function () {
laydate.render({
elem: this,
range: '~',
calendar: false,
format: 'yyyy/MM/dd'
});
});
$("input[data-time='ysdatetime']").each(function () {
laydate.render({
elem: this,
range: '~',
calendar: false,
type:'datetime',
format: 'yyyy/MM/dd HH:mm:ss'
});
});
$("body").on("click", "img[data-src='preview']", function () {
preview(this);
});
//ͼƬԤ<C6AC><D4A4>
function preview(obj) {
layer.photos({
photos: {
"title": "ͼƬԤ<C6AC><D4A4>",
"id": 1,
"start": 0,
"data": [
{
"alt": "",
"pid": 1,
"src": obj.src,
"thumb": ""
}
]
}
})
}
function previewimg(src) {
layer.photos({
photos: {
"title": "ͼƬԤ<C6AC><D4A4>",
"id": 1,
"start": 0,
"data": [
{
"alt": "",
"pid": 1,
"src": src,
"thumb": ""
}
]
}
});
}
$("body").on("click", "video[data-src='preview']", function () {
layer.open({
type: 1,
title:"<22><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>",
offset:'15px',
content: '<video src="' + this.src +'" controls="controls"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7></video>'
});
});
function getImageWidth(url, callback) {
var img = new Image();
img.src = url;
//<2F><><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6A3AC>ֱ<EFBFBD>ӷ<EFBFBD><D3B7>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (img.complete) {
callback(img.width, img.height);
} else {
img.onload = function () {
callback(img.width, img.height);
}
}
}
})