Browse Source

调整

tags/6.2.12
叙述、别离 7 months ago
parent
commit
00639fe8cc
7 changed files with 240 additions and 228 deletions
  1. +34
    -51
      src/admin/js/album.js
  2. +40
    -23
      src/admin/js/global.js
  3. +132
    -84
      src/admin/js/main.js
  4. +0
    -21
      src/admin/templets/catalog_main.htm
  5. +1
    -11
      src/admin/templets/index.htm
  6. +0
    -3
      src/static/web/css/admin.css
  7. +33
    -35
      src/static/web/js/user.album.js

+ 34
- 51
src/admin/js/album.js View File

@@ -39,55 +39,38 @@ function delAlbPicOld(picfile, pid) {
$Obj('galleryedit').removeChild(tgobj);
});
}
(function() {
var nForm = null;
var nFrame = null;
var picnameObj = null;
var vImg = null;
function GetWinPos(w, h) {
var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var systemZoom = width / window.screen.availWidth;
var left = (width - w) / 2 / systemZoom + dualScreenLeft;
var top = (height - h) / 2 / systemZoom + dualScreenTop;
return { left: left, top: top };
function seePicNewAlb(f, imgdid, frname, hpos, acname) {
var newobj = null;
if (f.value == '') return;
vImg = $Obj(imgdid);
picnameObj = document.getElementById('picname');
nFrame = $Nav() == 'IE' ? eval('document.frames.' + frname) : $Obj(frname);
nForm = f.form;
//修改form的action等参数
if (nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmitAlb);
else nForm.removeEventListener("submit", checkSubmitAlb, false);
nForm.action = 'archives_do.php';
nForm.target = frname;
nForm.dopost.value = 'uploadLitpic';
nForm.submit();
picnameObj.value = '';
newobj = $Obj('uploadwait');
if (!newobj) {
newobj = document.createElement("div");
newobj.id = 'uploadwait';
newobj.style.position = 'absolute';
newobj.className = 'uploadwait';
newobj.style.width = 120;
newobj.style.height = 20;
newobj.style.top = hpos;
newobj.style.left = 100;
document.body.appendChild(newobj);
newobj.innerHTML = '<img src="../../static/web/img/loadinglit.gif">';
}
function SeePicNew(f, imgdid, frname, hpos, acname) {
var newobj = null;
if (f.value == '') return;
vImg = $Obj(imgdid);
picnameObj = document.getElementById('picname');
nFrame = $Nav() == 'IE' ? eval('document.frames.' + frname) : $Obj(frname);
nForm = f.form;
//修改form的action等参数
if (nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmit);
else nForm.removeEventListener("submit", checkSubmit, false);
nForm.action = 'archives_do.php';
nForm.target = frname;
nForm.dopost.value = 'uploadLitpic';
nForm.submit();
picnameObj.value = '';
newobj = $Obj('uploadwait');
if (!newobj) {
newobj = document.createElement("div");
newobj.id = 'uploadwait';
newobj.style.position = 'absolute';
newobj.className = 'uploadwait';
newobj.style.width = 120;
newobj.style.height = 20;
newobj.style.top = hpos;
newobj.style.left = 100;
newobj.style.display = 'block';
document.body.appendChild(newobj);
newobj.innerHTML = '<img src="../../static/web/img/loadinglit.gif">';
}
newobj.style.display = 'block';
//提交后还原form的action等参数
nForm.action = acname;
nForm.dopost.value = 'save';
nForm.target = '';
nForm.litpic.disabled = true;
}
});
newobj.style.display = 'block';
//提交后还原form的action等参数
nForm.action = acname;
nForm.dopost.value = 'save';
nForm.target = '';
nForm.litpic.disabled = true;
}

+ 40
- 23
src/admin/js/global.js View File

@@ -1,25 +1,42 @@
(function() {
var BROWSER = {};
var USERAGENT = navigator.userAgent.toLowerCase();
browserVersion({'firefox':'','chrome':'','opera':'','safari':'','maxthon':'','mozilla':'','webkit':''});
if (BROWSER.safari) {
BROWSER.firefox = true;
}
BROWSER.opera = BROWSER.opera ? opera.version() : 0;
function browserVersion(types) {
var other = 1;
for (i in types) {
var v = types[i] ? types[i] : i;
if (USERAGENT.indexOf(v) != -1) {
var re = new RegExp(v + '(\\/|\\s)([\\d\\.]+)', 'ig');
var matches = re.exec(USERAGENT);
var ver = matches != null ? matches[2] : 0;
other = ver !== 0 ? 0 : other;
} else {
var ver = 0;
}
eval('BROWSER.' + i + '= ver');
var BROWSER = {};
var USERAGENT = navigator.userAgent.toLowerCase();
browserVersion({'firefox':'','chrome':'','opera':'','safari':'','maxthon':'','mozilla':'','webkit':''});
if (BROWSER.safari) {
BROWSER.firefox = true;
}
BROWSER.opera = BROWSER.opera ? opera.version() : 0;
function browserVersion(types) {
var other = 1;
for (i in types) {
var v = types[i] ? types[i] : i;
if (USERAGENT.indexOf(v) != -1) {
var re = new RegExp(v + '(\\/|\\s)([\\d\\.]+)', 'ig');
var matches = re.exec(USERAGENT);
var ver = matches != null ? matches[2] : 0;
other = ver !== 0 ? 0 : other;
} else {
var ver = 0;
}
BROWSER.other = other;
eval('BROWSER.' + i + '= ver');
}
BROWSER.other = other;
}
function LoadSuns(ctid, tid) {
if ($DE(ctid).innerHTML.length < 10) {
$DE('img' + tid).className = 'fa fa-minus-square';
fetch('catalog_do.php?dopost=GetSunLists&cid=' + tid).then(resp => resp.text()).then((d) => {
$DE(ctid).innerHTML = d;
});
} else {
showHide(ctid, tid);
}
}
function showHide(objname, tid) {
if ($DE(objname).style.display == "none") {
$DE('img' + tid).className = 'fa fa-minus-square';
$DE(objname).style.display = BROWSER.firefox ? "" : "block";
} else {
$DE('img' + tid).className = 'fa fa-plus-square';
$DE(objname).style.display = "none";
}
});
}

+ 132
- 84
src/admin/js/main.js View File

@@ -1,3 +1,53 @@
var nForm = null;
var nFrame = null;
var picnameObj = null;
var vImg = null;
function GetWinPos(w, h) {
var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var systemZoom = width / window.screen.availWidth;
var left = (width - w) / 2 / systemZoom + dualScreenLeft;
var top = (height - h) / 2 / systemZoom + dualScreenTop;
return { left: left, top: top };
}
function SeePicNew(f, imgdid, frname, hpos, acname) {
var newobj = null;
if (f.value == '') return;
vImg = $Obj(imgdid);
picnameObj = document.getElementById('picname');
nFrame = $Nav() == 'IE' ? eval('document.frames.' + frname) : $Obj(frname);
nForm = f.form;
//修改form的action等参数
if (nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmit);
else nForm.removeEventListener("submit", checkSubmit, false);
nForm.action = 'archives_do.php';
nForm.target = frname;
nForm.dopost.value = 'uploadLitpic';
nForm.submit();
picnameObj.value = '';
newobj = $Obj('uploadwait');
if (!newobj) {
newobj = document.createElement("div");
newobj.id = 'uploadwait';
newobj.style.position = 'absolute';
newobj.className = 'uploadwait';
newobj.style.width = 120;
newobj.style.height = 20;
newobj.style.top = hpos;
newobj.style.left = 100;
newobj.style.display = 'block';
document.body.appendChild(newobj);
newobj.innerHTML = '<img src="../../static/web/img/loadinglit.gif">';
}
newobj.style.display = 'block';
//提交后还原form的action等参数
nForm.action = acname;
nForm.dopost.value = 'save';
nForm.target = '';
nForm.litpic.disabled = true;
}
function SelectMedia(fname) {
var pos = GetWinPos(800,600);
window.open("./dialog/select_media.php?f=" + fname + "&noeditor=yes", "popUpFlashWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + pos.left + ", top=" + pos.top);
@@ -200,7 +250,6 @@ function LoadQuickDiv(e, surl, oname, w, h) {
fetch(surl).then(resp => resp.text()).then((d) => {
newobj.innerHTML = d;
});
}
function ShowCatMap(e, obj, cid, targetId, oldvalue) {
LoadQuickDiv(e, 'archives_do.php?dopost=getCatMap&targetid=' + targetId + '&channelid=' + cid + '&oldvalue=' + oldvalue + '&rnd=' + Math.random(), 'getCatMap', '700px', '500px');
@@ -330,91 +379,105 @@ function CloseModal(modalID) {
})
}
//获取缩略图
$(function() {
var litpicImgSrc = "";
var litpicImg = "";
var currentCID = 0;
var mdlCropperID = "";
var pubAt = 0;
var optCropper = {
preview: ".pv",
crop: function(e) {
$("#cropWidth").text(Math.round(e.detail.height));
$("#cropHeight").text(Math.round(e.detail.width));
if ($(this).cropper("getCroppedCanvas")) {
var dataUrl = $(this).cropper("getCroppedCanvas").toDataURL();
litpicImg = dataUrl;
$("#litPic").attr("src", litpicImg);
}
},
aspectRatio: 4 / 3,
//拖动截取缩略图后,截取的缩略图更新到imageItems中
cropend: function(data) {
//这里的id要单独取出来
var litpicImgSrc = "";
var litpicImg = "";
var mdlCropperID = "";
var optCropper = {
preview: ".pv",
crop: function(e) {
$("#cropWidth").text(Math.round(e.detail.height));
$("#cropHeight").text(Math.round(e.detail.width));
if ($(this).cropper("getCroppedCanvas")) {
var dataUrl = $(this).cropper("getCroppedCanvas").toDataURL();
litpicImg = dataUrl;
$("#litPic").attr("src", litpicImg);
$("#litpic_b64").val(litpicImg);
$("#litPic").attr("src", litpicImg);
}
}
var cropperAspectRatio = {
0: 16 / 9,
1: 4 / 3,
2: 1 / 1,
3: 2 / 3,
4: NaN,
}
function setAspectRatio(ar) {
var opts = optCropper;
opts.aspectRatio = cropperAspectRatio[ar];
$("#cropImg" + mdlCropperID).cropper('destroy').cropper(opts);
}
function okImage(modalID) {
uploadImage(litpicImg);
},
aspectRatio: 4 / 3,
cropend: function(data) {
var dataUrl = $(this).cropper("getCroppedCanvas").toDataURL();
litpicImg = dataUrl;
$("#litPic").attr("src", litpicImg);
CloseModal('GKModal' + modalID);
}
function useDefault(modalID) {
uploadImage(litpicImgSrc);
$("#litPic").attr("src", litpicImgSrc);
CloseModal('GKModal' + modalID);
}
function uploadImage(litpicImgSrc) {
const formData = new FormData()
formData.append('litpic_b64', litpicImgSrc);
fetch('archives_do.php?dopost=upload_base64_image', {
method: 'POST',
body: formData
})
.then(r => {
if (r.ok) {
return r.json()
}
throw new Error(errMsg);
})
.then(d => {
if (d.code == 200) {
$("#picname").val(d.data.image_url);
}
}).catch((error) => {
alert("上传缩略图错误");
});
$("#litpic_b64").val(litpicImg);
}
}
var cropperAspectRatio = {
0: 16 / 9,
1: 4 / 3,
2: 1 / 1,
3: 2 / 3,
4: NaN,
}
function setAspectRatio(ar) {
var opts = optCropper;
opts.aspectRatio = cropperAspectRatio[ar];
$("#cropImg" + mdlCropperID).cropper('destroy').cropper(opts);
}
function okImage(modalID) {
uploadImage(litpicImg);
$("#litPic").attr("src", litpicImg);
CloseModal('GKModal' + modalID);
}
function useDefault(modalID) {
uploadImage(litpicImgSrc);
$("#litPic").attr("src", litpicImgSrc);
CloseModal('GKModal' + modalID);
}
function uploadImage(litpicImgSrc) {
const formData = new FormData()
formData.append('litpic_b64', litpicImgSrc);
fetch('archives_do.php?dopost=upload_base64_image', {
method: 'POST',
body: formData
})
.then(r => {
if (r.ok) {
return r.json()
}
throw new Error(errMsg);
})
.then(d => {
if (d.code == 200) {
$("#picname").val(d.data.image_url);
}
}).catch((error) => {
alert("上传缩略图错误");
});
}
function SetThumb(srcURL) {
var footer = "<p><a href='javascript:useDefault(\"~modalID~\");' class='btn btn-success btn-sm'>使用原图</a><a href='javascript:okImage(\"~modalID~\")' class='btn btn-success btn-sm'>确定</a></p>";
var optButton = `<p><label for="aspectRatio">比例</label><select id="aspectRatio" onchange="setAspectRatio(this.selectedIndex)"><option>16:9</option><option selected>4:3</option><option>1:1</option><option>2:3</option><option>自定义</option></select></p>`;
mdlCropperID = ShowMsg('<div class="float-left" style="width:320px"><p><img id="cropImg~modalID~" src="' + srcURL + '"></p><p>宽度:<span id="cropWidth"></span>px,高度:<span id="cropHeight"></span>px</p>' + optButton + '</div><div class="pv float-right" style="width:200px;height:100px;overflow:hidden"></div>', {
footer: footer,
noClose: false,
title: '图片裁剪',
});
setTimeout(function() {
$("#cropImg" + mdlCropperID).cropper(optCropper);
}, 500);
}
$(document).ready(function() {
$("#togglemenu").click(function() {
if ($("body").attr("class") == "showmenu") {
$("body").attr("class", "hidemenu");
$(this).html('<i class="fa fa-indent"></i>');
} else {
$("body").attr("class", "showmenu");
$(this).html('<i class="fa fa-dedent"></i>');
}
});
$("#btnClearAll").click(function(event) {
litpicImgSrc = "";
litpicImg = "";
$("#picname").val(litpicImg);
$("#litPic").attr("src", "/static/web/img/thumbnail.jpg");
})
//添加图片
$("#iptAddImages").change(function(event) {
var files = event.target.files;
for (var i = 0, f; f = files[i]; i++) {
//如果不是图片忽略
if (!f.type.match('image.*')) {
continue;
}
//将图片渲染到浏览器
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
@@ -431,21 +494,6 @@ $(function() {
}
$("#iptAddImages").val("");
});
//截取缩略图
function SetThumb(srcURL) {
var footer = "<p><a href='javascript:useDefault(\"~modalID~\");' class='btn btn-success btn-sm'>使用原图</a><a href='javascript:okImage(\"~modalID~\")' class='btn btn-success btn-sm'>确定</a></p>";
var optButton = `<p><label for="aspectRatio">比例</label><select id="aspectRatio" onchange="setAspectRatio(this.selectedIndex)"><option>16:9</option><option selected>4:3</option><option>1:1</option><option>2:3</option><option>自定义</option></select></p>`;
mdlCropperID = ShowMsg('<div class="float-left" style="width:320px"><p><img id="cropImg~modalID~" src="' + srcURL + '"></p><p>宽度:<span id="cropWidth"></span>px,高度:<span id="cropHeight"></span>px</p>' + optButton + '</div><div class="pv float-right" style="width:200px;height:100px;overflow:hidden"></div>', {
footer: footer,
noClose: false,
title: '图片裁剪',
});
setTimeout(function() {
$("#cropImg" + mdlCropperID).cropper(optCropper);
}, 500);
}
});
$(document).ready(function() {
if ($.fn.daterangepicker) {
$('.datepicker').daterangepicker({
"singleDatePicker": true,


+ 0
- 21
src/admin/templets/catalog_main.htm View File

@@ -47,26 +47,5 @@
</tr>
</table>
</form>
<script>
function LoadSuns(ctid, tid) {
if ($DE(ctid).innerHTML.length < 10) {
$DE('img' + tid).className = 'fa fa-minus-square';
fetch('catalog_do.php?dopost=GetSunLists&cid=' + tid).then(resp => resp.text()).then((d) => {
$DE(ctid).innerHTML = d;
});
} else {
showHide(ctid, tid);
}
}
function showHide(objname, tid) {
if ($DE(objname).style.display == "none") {
$DE('img' + tid).className = 'fa fa-minus-square';
$DE(objname).style.display = BROWSER.firefox ? "" : "block";
} else {
$DE('img' + tid).className = 'fa fa-plus-square';
$DE(objname).style.display = "none";
}
}
</script>
</body>
</html>

+ 1
- 11
src/admin/templets/index.htm View File

@@ -10,6 +10,7 @@
<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../static/web/css/admin.css">
<script src="../static/web/js/jquery.min.js"></script>
<script src="js/main.js"></script>
</head>
<body class="showmenu">
<?php if (preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT']) || preg_match('/Trident/i',$_SERVER['HTTP_USER_AGENT'])) {?>
@@ -62,16 +63,5 @@
<div class="body-right">
<div class="main"><iframe name="main" src="index_body.php"></iframe></div>
</div>
<script>
$("#togglemenu").click(function() {
if ($("body").attr("class") == "showmenu") {
$("body").attr("class", "hidemenu");
$(this).html('<i class="fa fa-indent"></i>');
} else {
$("body").attr("class", "showmenu");
$(this).html('<i class="fa fa-dedent"></i>');
}
});
</script>
</body>
</html>

+ 0
- 3
src/static/web/css/admin.css View File

@@ -343,9 +343,6 @@ body.hidemenu .body-right {
padding:10px;
background:#f5f5f5
}
#fz-0 {
font-size:0
}
#_fileList,#_verList {
height:360px;
overflow-y:auto


+ 33
- 35
src/static/web/js/user.album.js View File

@@ -1,31 +1,38 @@
(function() {
var startNum = 1;
function MakeUpload(mnum) {
var endNum = 0;
var upfield = document.getElementById("uploadfield");
var pnumObj = document.getElementById("picnum");
var fhtml = "";
var dsel = " checked='checked' ";
var dplay = "display:none";
if (mnum==0) endNum = startNum + Number(pnumObj.value);
else endNum = mnum;
if (endNum>120) endNum = 120;
for (startNum;startNum < endNum;startNum++)
{
if (startNum==1) {
dsel = " checked='checked' ";
dplay = "block";
} else {
dsel = " ";
dplay = "display:none";
}
fhtml = "";
fhtml += "<div class='mb-3'><label class='mb-0'><input type='checkbox' name='isokcheck" + startNum + "' id='isokcheck" + startNum + "' value='1' "+dsel+" onClick='CheckSelTable(" + startNum + ")'> 显示图片" + startNum + "上传框</label></div>";
fhtml += "<div id=\"seltb" + startNum + "\" class='form-group' style=\"" + dplay + "\"><label>图片" + startNum + "上传:</label><div class='input-group mb-3'><input type='text' name='imgfile" + startNum + "' class='form-control' placeholder='请选择图片上传或填写图片地址'><div class='input-group-append'><span class='btn btn-success btn-sm btn-send' onClick=\"SelectImage('addcontent.imgfile" + startNum + "', 'big')\">选择</span></div></div><label>图片" + startNum + "简介:</label><textarea name='imgmsg" + startNum + "' class='form-control'></textarea></div>";
upfield.innerHTML += fhtml;
var startNum = 1;
function MakeUpload(mnum) {
var endNum = 0;
var upfield = document.getElementById("uploadfield");
var pnumObj = document.getElementById("picnum");
var fhtml = "";
var dsel = " checked='checked' ";
var dplay = "display:none";
if (mnum==0) endNum = startNum + Number(pnumObj.value);
else endNum = mnum;
if (endNum>120) endNum = 120;
for (startNum;startNum < endNum;startNum++)
{
if (startNum==1) {
dsel = " checked='checked' ";
dplay = "block";
} else {
dsel = " ";
dplay = "display:none";
}
fhtml = "";
fhtml += "<div class='mb-3'><label class='mb-0'><input type='checkbox' name='isokcheck" + startNum + "' id='isokcheck" + startNum + "' value='1' "+dsel+" onClick='CheckSelTable(" + startNum + ")'> 显示图片" + startNum + "上传框</label></div>";
fhtml += "<div id=\"seltb" + startNum + "\" class='form-group' style=\"" + dplay + "\"><label>图片" + startNum + "上传:</label><div class='input-group mb-3'><input type='text' name='imgfile" + startNum + "' class='form-control' placeholder='请选择图片上传或填写图片地址'><div class='input-group-append'><span class='btn btn-success btn-sm btn-send' onClick=\"SelectImage('addcontent.imgfile" + startNum + "', 'big')\">选择</span></div></div><label>图片" + startNum + "简介:</label><textarea name='imgmsg" + startNum + "' class='form-control'></textarea></div>";
upfield.innerHTML += fhtml;
}
});
}
function checkMuList(psid, cmid) {
if (document.getElementById('pagestyle3').checked) {
document.getElementById('spagelist').style.display = 'none';
} else if (document.getElementById('pagestyle1').checked) {
document.getElementById('spagelist').style.display = 'block';
} else {
document.getElementById('spagelist').style.display = 'none';
}
}
function CheckSelTable(nnum) {
var cbox = document.getElementById('isokcheck'+nnum);
var seltb = document.getElementById('seltb'+nnum);
@@ -42,13 +49,4 @@ function checkSubmit() {
alert("请您选择文档所属栏目");
return false;
}
}
function checkMuList(psid, cmid) {
if (document.getElementById('pagestyle3').checked) {
document.getElementById('spagelist').style.display = 'none';
} else if (document.getElementById('pagestyle1').checked) {
document.getElementById('spagelist').style.display = 'block';
} else {
document.getElementById('spagelist').style.display = 'none';
}
}

Loading…
Cancel
Save