|
@@ -95,6 +95,15 @@ function toggleDraft(obj, url) {
|
|
|
}
|
|
|
|
|
|
function toggleDisplay(obj, url) {
|
|
|
+ let checkedList = document.querySelectorAll('.display_state:checked');
|
|
|
+ for (let i = 0; i < checkedList.length; i++) {
|
|
|
+ if (checkedList.length == 2) {
|
|
|
+ alert('首頁顯示僅能選擇一筆');
|
|
|
+ obj.checked = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
axios.get(contentApiUrl + url).then(({ data }) => {
|
|
|
frontMatters = [];
|
|
|
contentMatters = [];
|
|
@@ -102,6 +111,7 @@ function toggleDisplay(obj, url) {
|
|
|
const content = _.get(data, "0.content", "");
|
|
|
blocks = parseMd(aa);
|
|
|
editTarget = url;
|
|
|
+
|
|
|
$("#cdisplay").removeAttr("checked");
|
|
|
$("#cdisplay").prop("checked", obj.checked);
|
|
|
updateHeader();
|
|
@@ -156,7 +166,6 @@ function writeMd() {
|
|
|
var imagefil4 = document.querySelector("#cnewownerimg");
|
|
|
var imgcount = 1;
|
|
|
|
|
|
- console.log($("#cfile").val());
|
|
|
if ($("#cfile").val() == "" || $("#cfile").val() == undefined) {
|
|
|
offset1 = 1;
|
|
|
} else {
|
|
@@ -164,7 +173,6 @@ function writeMd() {
|
|
|
imgcount++;
|
|
|
}
|
|
|
|
|
|
- console.log($("#cnewcoverimg").val());
|
|
|
if (
|
|
|
$("#cnewcoverimg").val() == "" ||
|
|
|
$("#cnewcoverimg").val() == undefined
|
|
@@ -175,7 +183,6 @@ function writeMd() {
|
|
|
imgcount++;
|
|
|
}
|
|
|
|
|
|
- console.log($("#cnewcomment").val());
|
|
|
if (
|
|
|
$("#cnewcomment").val() == "" ||
|
|
|
$("#cnewcomment").val() == undefined
|
|
@@ -186,18 +193,8 @@ function writeMd() {
|
|
|
imgcount++;
|
|
|
}
|
|
|
|
|
|
- console.log($("#cnewownerimg").val());
|
|
|
formData.append("image" + imgcount.toString(), imagefil4.files[0]);
|
|
|
|
|
|
- console.log(
|
|
|
- $("#cfile").val(),
|
|
|
- $("#cnewcoverimg").val(),
|
|
|
- $("#cnewcomment").val(),
|
|
|
- $("#cnewownerimg").val()
|
|
|
- );
|
|
|
- console.log(offset1, offset2, offset3);
|
|
|
- console.log(formData);
|
|
|
-
|
|
|
axios
|
|
|
.post("/backstage/multiupload/title", formData, {
|
|
|
headers: {
|
|
@@ -205,9 +202,7 @@ function writeMd() {
|
|
|
},
|
|
|
})
|
|
|
.then(({ data }) => {
|
|
|
- console.log("data", data);
|
|
|
if (data.success == "1") {
|
|
|
- console.log(data.fileurl);
|
|
|
var imglinks = data.fileurl.split(";;;");
|
|
|
if ($("#cfile").val() == "" || $("#cfile").val() == undefined) {
|
|
|
//do nothing
|
|
@@ -635,10 +630,10 @@ function GetMdHeader(result = []) {
|
|
|
rContent += 'meta_description: "' + $("#cmetadsc").val() + '"\n';
|
|
|
rContent += 'title: "' + $("#ctitle").val() + '"\n';
|
|
|
rContent += "date: " + $("#cdate").val() + "\n";
|
|
|
- rContent += "draft: " + !$("#cdraft").is(":checked") + "\n";
|
|
|
+ rContent += "draft: " + $("#cdraft").is(":checked") + "\n";
|
|
|
|
|
|
if ($("#ctype").val() == "news") {
|
|
|
- rContent += 'display: ' + !$("#cdisplay").is(":checked") + '\n';
|
|
|
+ rContent += 'display: ' + $("#cdisplay").is(":checked") + '\n';
|
|
|
}
|
|
|
|
|
|
rContent += 'type: "' + $("#ctype").val() + '"\n';
|
|
@@ -748,7 +743,6 @@ function GetMdHeader(result = []) {
|
|
|
rContent += `${collection_slider_value[0]}\n`;
|
|
|
}
|
|
|
|
|
|
- console.log("rContent", rContent);
|
|
|
} else if (
|
|
|
$("#ctype").val() == "blog" ||
|
|
|
$("#ctype").val() == "maincategories"
|
|
@@ -775,7 +769,7 @@ function GetMdHeader(result = []) {
|
|
|
rContent += 'question_box_intro: "' + $("#cquestionboxintro").val() + '"\n';
|
|
|
}
|
|
|
rContent += "---\n";
|
|
|
-
|
|
|
+ console.log("rContent", rContent);
|
|
|
return rContent;
|
|
|
}
|
|
|
|
|
@@ -1015,32 +1009,24 @@ function ParseProductSection(inContent) {
|
|
|
$("#swfMat").val("");
|
|
|
$("#swfMemo").val("");
|
|
|
if ($("[class='detail']", aa).length > 0) {
|
|
|
- console.log(1);
|
|
|
onodes = $("[class='detail']", aa)[0].childNodes;
|
|
|
for (i = 0; i < onodes.length; i++) {
|
|
|
for (j = 0; j < onodes[i].childNodes.length; j++) {
|
|
|
- console.log(onodes[i].childNodes[j]);
|
|
|
onodes2 = onodes[i].childNodes[j].className;
|
|
|
if (onodes[i].childNodes[j].nodeName != "#text") {
|
|
|
if (onodes2 == "pdprice tw-85") {
|
|
|
- console.log(1);
|
|
|
- console.log(onodes[i].childNodes[j].innerHTML);
|
|
|
$("#swfPrice").val(onodes[i].childNodes[j].innerHTML);
|
|
|
}
|
|
|
if (onodes2 == "pdcolor tw-85") {
|
|
|
- console.log(2);
|
|
|
$("#swfColor").val(onodes[i].childNodes[j].innerHTML);
|
|
|
}
|
|
|
if (onodes2 == "pdsize tw-85") {
|
|
|
- console.log(onodes[i].childNodes[j].innerHTML);
|
|
|
$("#swfSize").val(onodes[i].childNodes[j].innerHTML);
|
|
|
}
|
|
|
if (onodes2 == "pmat tw-85") {
|
|
|
- console.log(onodes[i].childNodes[j].innerHTML);
|
|
|
$("#swfMat").val(onodes[i].childNodes[j].innerHTML);
|
|
|
}
|
|
|
if (onodes2 == "pdmark tw-85") {
|
|
|
- console.log(onodes[i].childNodes[j].innerHTML);
|
|
|
$("#swfMemo").val(onodes[i].childNodes[j].innerHTML);
|
|
|
}
|
|
|
}
|
|
@@ -1064,7 +1050,6 @@ function ParseProductSection(inContent) {
|
|
|
//處理規格圖片
|
|
|
if ($("[class='spec']", aa).length > 0) {
|
|
|
snodes = $("[class='spec']", aa)[0].childNodes;
|
|
|
- console.log(snodes);
|
|
|
//alert(snodes[0].innerHTML);
|
|
|
for (i = 0; i < snodes.length; i++) {
|
|
|
var tmpsrc, tmpw, tmph, ampimg;
|
|
@@ -1250,12 +1235,9 @@ function GenProductSection(mimg, specimg) {
|
|
|
firstimg = true;
|
|
|
for (i = 0; i < mimg.blocks.length; i++) {
|
|
|
block = mimg.blocks[i];
|
|
|
- console.log(block.data);
|
|
|
|
|
|
- console.log(block.data.file.url);
|
|
|
if (block.type == "image") {
|
|
|
iurl = block.data.file.url.split("/");
|
|
|
- console.log("img/" + iurl[iurl.length - 1]);
|
|
|
|
|
|
if (iurl[iurl.length - 1] != "logo2.png") {
|
|
|
if (firstimg) {
|
|
@@ -1313,7 +1295,6 @@ function GenProductSection(mimg, specimg) {
|
|
|
for (i = 0; i < specimg.blocks.length; i++) {
|
|
|
//alert(block.type);
|
|
|
block = specimg.blocks[i];
|
|
|
- console.log(block);
|
|
|
if (block.type == "image") {
|
|
|
iurl = block.data.file.url.split("/");
|
|
|
if (iurl[iurl.length - 1] != "logo2.png") {
|