同步
This commit is contained in:
63
js/about.js
Normal file
63
js/about.js
Normal file
@@ -0,0 +1,63 @@
|
||||
$(function () {
|
||||
var viewer = new Viewer(document.getElementById("viewer"), {
|
||||
button: true,
|
||||
inline: false,
|
||||
zoomable: true,
|
||||
title: true,
|
||||
tooltip: true,
|
||||
minZoomRatio: 0.5,
|
||||
maxZoomRatio: 100,
|
||||
movable: true,
|
||||
interval: 2000,
|
||||
navbar: true,
|
||||
loading: true,
|
||||
});
|
||||
|
||||
// 点击显示图片 box-item
|
||||
$(".box-item").click(function () {
|
||||
// 设置图片
|
||||
$("#viewer").attr("src", $(this).find("img").attr("src"));
|
||||
viewer.show();
|
||||
});
|
||||
|
||||
// 获取通用配置信息
|
||||
function getCommentInfo() {
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
}
|
||||
// 获取首页数据
|
||||
getCommentInfo();
|
||||
|
||||
// 设置首页函数
|
||||
function setIndexData() {
|
||||
const commentObj = JSON.parse(sessionStorage.commentData);
|
||||
if (commentObj.honor.length > 0) {
|
||||
commentObj.honor.forEach((item) => {
|
||||
$("#honor-box").append(`
|
||||
<div class="box-item">
|
||||
<img src=${item.img} alt="">
|
||||
<p class="font-16 mt-20">${item.name}</p>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
}
|
||||
commentObj.partner.forEach((item) => {
|
||||
$("#partner-box").append(`
|
||||
<div class="box-item">
|
||||
<img src="${item.img}" alt="">
|
||||
<h4 class="mt-30">${item.name}</h4>
|
||||
<p class="mt-20">${item.description}</p>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
}
|
||||
});
|
||||
90
js/activities.js
Normal file
90
js/activities.js
Normal file
@@ -0,0 +1,90 @@
|
||||
$(function () {
|
||||
var SysSecond = 20000
|
||||
var InterValObj = null
|
||||
SetRemainTime()
|
||||
InterValObj = window.setInterval(SetRemainTime, 1000); //间隔函数,1秒执行
|
||||
//将时间减去1秒,计算天、时、分、秒
|
||||
function SetRemainTime() {
|
||||
if (SysSecond > 0) {
|
||||
SysSecond = SysSecond - 1;
|
||||
const minite = Math.floor((SysSecond / 60) % 60); //计算分
|
||||
const hour = Math.floor((SysSecond / 3600) % 24); //计算小时
|
||||
const day = Math.floor((SysSecond / 3600) / 24); //计算天
|
||||
$("#day1").text(day >= 10 ? Math.floor((day / 10)) : 0)
|
||||
$("#day2").text(day >= 10 ? (day - Math.floor((day / 10)) * 10) : day)
|
||||
$("#hour1").text(hour >= 10 ? Math.floor((hour / 10)) : 0)
|
||||
$("#hour2").text(hour >= 10 ? (hour - Math.floor((hour / 10) * 10)) : hour)
|
||||
$("#min1").text(minite >= 10 ? Math.floor((minite / 10)) : 0)
|
||||
$("#min2").text(minite >= 10 ? (minite - Math.floor((minite / 10)) * 10) : minite)
|
||||
} else {//剩余时间小于或等于0的时候,就停止间隔函数
|
||||
//这里可以添加倒计时时间为0后需要执行的事件
|
||||
InterValObj = null
|
||||
location.go(0)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开实名认证弹窗
|
||||
function openAuthenticationDialog() {
|
||||
$("#authentication-modal").fadeIn().addClass('show');
|
||||
$(".modal-content").fadeIn().addClass('show');
|
||||
}
|
||||
// 当用户点击关闭按钮或在弹窗外部点击时,隐藏弹窗
|
||||
$(".dia-close, .dialog-box").click(function () {
|
||||
$(".dialog-box").fadeOut().removeClass('show');
|
||||
$('html').removeClass('no-scroll');
|
||||
$('body').removeClass('no-scroll');
|
||||
});
|
||||
|
||||
|
||||
$(".buy-btn").click(function () {
|
||||
$("#authentication-modal").fadeIn().addClass('show');
|
||||
$(".modal-content").fadeIn().addClass('show');
|
||||
})
|
||||
|
||||
$(".cloud-buy-btn").click(function () {
|
||||
$("#buyCloud-modal").fadeIn().addClass('show');
|
||||
$(".modal-content").fadeIn().addClass('show');
|
||||
})
|
||||
// 防止在弹窗内部点击时弹窗被关闭
|
||||
$(".modal-content").click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// 加按钮事件处理程序
|
||||
$('.plus-btn').click(function () {
|
||||
const quantity = parseInt($('#quantity').val());
|
||||
$('#quantity').val(quantity + 1);
|
||||
});
|
||||
|
||||
// 减按钮事件处理程序
|
||||
$('.minus-btn').click(function () {
|
||||
const quantity = parseInt($('#quantity').val());
|
||||
if (quantity > 1) {
|
||||
$('#quantity').val(quantity - 1);
|
||||
}
|
||||
});
|
||||
// 输入事件处理程序
|
||||
$('#quantity').on('input', function () {
|
||||
const quantity = parseInt($('#quantity').val());
|
||||
if (isNaN(quantity) || quantity < 1) {
|
||||
$('#quantity').val(1);
|
||||
}
|
||||
});
|
||||
// 给选项卡元素添加点击事件监听器
|
||||
$('.tab-item').click(function () {
|
||||
// 切换选项卡的 active 样式
|
||||
$('.tab-item').removeClass('active-tab');
|
||||
$(this).addClass('active-tab');
|
||||
|
||||
// 切换对应内容的显示状态
|
||||
|
||||
});
|
||||
$('.cloud-price-box').click(function () {
|
||||
// 切换选项卡的 active 样式
|
||||
$(this).siblings().removeClass('active');
|
||||
$(this).addClass('active');
|
||||
// 切换对应内容的显示状态
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
25
js/ai.js
Normal file
25
js/ai.js
Normal file
@@ -0,0 +1,25 @@
|
||||
(function () {
|
||||
const addonsDom = document.querySelector("#addons_js");
|
||||
if (addonsDom) {
|
||||
const addonsArr = JSON.parse(addonsDom.getAttribute("addons_js")); // 插件列表
|
||||
const arr = addonsArr.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
if (arr.includes("AiKnowledge")) {
|
||||
const script = document.createElement("script");
|
||||
script.src =
|
||||
"/plugins/addon/ai_knowledge/template/clientarea/ai-dialog.js";
|
||||
script.onload = function () {
|
||||
const aiConfig = {
|
||||
page_type: "index",
|
||||
product_id: "",
|
||||
draggable: true,
|
||||
showTrigger: false,
|
||||
position_bottom: "200px",
|
||||
};
|
||||
const aiDialog = new AIDialog(aiConfig);
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
}
|
||||
})();
|
||||
48
js/announce-details.js
Normal file
48
js/announce-details.js
Normal file
@@ -0,0 +1,48 @@
|
||||
$(function () {
|
||||
let url = window.location.href
|
||||
let getqyinfo = url.split('?')[1]
|
||||
let getqys = new URLSearchParams('?' + getqyinfo)
|
||||
const id = getqys.get('id')
|
||||
var announcementData
|
||||
// 获取公告详情
|
||||
function getDetail() {
|
||||
$.ajax({
|
||||
url: `/console/v1/announcement/${id}`,
|
||||
method: 'get',
|
||||
success: function (res) {
|
||||
announcementData = res.data.announcement
|
||||
$('#announce-name').text(`${announcementData.title}`)
|
||||
$('#announce-type').text(`${announcementData.type}`)
|
||||
$('#announce-type').attr('href', `./announce.html?id=${announcementData.addon_idcsmart_announcement_type_id}`)
|
||||
$('.announce-title').text(`${announcementData.title}`)
|
||||
$('.announce-details-time').text(`${formateTimeFun(announcementData.create_time)}`)
|
||||
$('.announce-details-cont').html(`${announcementData.content}`)
|
||||
if (announcementData.prev?.id) {
|
||||
$('#nextAnnounce').append(`
|
||||
<div class="announce-details-page">上一篇:<a href="./announce-details.html?id=${announcementData.prev?.id}">${announcementData.prev?.title}</a></div>
|
||||
`)
|
||||
} else {
|
||||
$('#nextAnnounce').append(`
|
||||
<div class="announce-details-page"></div>
|
||||
`)
|
||||
}
|
||||
if (announcementData.next?.id) {
|
||||
$('#nextAnnounce').append(`
|
||||
<div class="announce-details-page">下一篇:<a href="./announce-details.html?id=${announcementData.next?.id}">${announcementData.next?.title}</a></div>
|
||||
`)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
getDetail()
|
||||
|
||||
|
||||
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + '-';
|
||||
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
||||
D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '';
|
||||
return (Y + M + D);
|
||||
}
|
||||
})
|
||||
142
js/announce.js
Normal file
142
js/announce.js
Normal file
@@ -0,0 +1,142 @@
|
||||
$(function () {
|
||||
let url = window.location.href
|
||||
let getqyinfo = url.split('?')[1]
|
||||
let getqys = new URLSearchParams('?' + getqyinfo)
|
||||
const id = getqys.get('id')
|
||||
const params = {
|
||||
addon_idcsmart_announcement_type_id: '',
|
||||
page: 1, // 当前页数
|
||||
limit: 5
|
||||
}
|
||||
|
||||
var totalPages = 0; // 总页数
|
||||
var visiblePages = 3; // 显示的页码数
|
||||
var pagination = $('.pagination');
|
||||
// 获取公告分类
|
||||
function getTypelist() {
|
||||
$.ajax({
|
||||
url: "/console/v1/announcement/type",
|
||||
method: 'get',
|
||||
success: function (res) {
|
||||
const typeList = res.data.list
|
||||
typeList.forEach((item, index) => {
|
||||
$('#announceHead').append(`
|
||||
<a href="javascript:;" typeId=${item.id}>${item.name}</a>
|
||||
`)
|
||||
})
|
||||
/* 官方公告tab切换 */
|
||||
$('.announce-head a').each(function (ind, el) {
|
||||
// 绑定点击事件
|
||||
$(el).click(function () {
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
params.page = 1
|
||||
params.addon_idcsmart_announcement_type_id = $(el).attr('typeId')
|
||||
getTitleList()
|
||||
});
|
||||
// 默认选中
|
||||
if (id == $(el).attr('typeId')) {
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
params.addon_idcsmart_announcement_type_id = $(el).attr('typeId')
|
||||
getTitleList()
|
||||
}
|
||||
});
|
||||
// 没有默认选第一个
|
||||
if (!id) {
|
||||
$('#announceHead a:first-child').trigger('click')
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
getTypelist()
|
||||
|
||||
// 公告详情
|
||||
function getTitleList() {
|
||||
$.ajax({
|
||||
url: "/console/v1/announcement",
|
||||
method: 'get',
|
||||
data: params,
|
||||
success: function (res) {
|
||||
const titleList = res.data.list
|
||||
$('#totalText').text(`共${res.data.count}项数据`)
|
||||
totalPages = Math.ceil(res.data.count / params.limit)
|
||||
$('.announce-list').empty()
|
||||
titleList.forEach((item) => {
|
||||
$('.announce-list').append(`
|
||||
<div class="announce-item">
|
||||
<p class="announce-item-title font-ell1"><a href="./announce-details.html?id=${item.id}">${item.title}</a></p>
|
||||
<p class="announce-item-time">${formateTimeFun(item.create_time)}</p>
|
||||
</div>
|
||||
`)
|
||||
})
|
||||
renderPagination();
|
||||
}
|
||||
});
|
||||
}
|
||||
// 渲染分页器
|
||||
function renderPagination() {
|
||||
// 清空分页器
|
||||
pagination.empty();
|
||||
// 添加上一页按钮
|
||||
pagination.append('<li><a href="javascript:;" aria-label="Previous"><span aria-hidden="true"><</span></a></li>');
|
||||
|
||||
// 添加第一页
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">1</a></li>');
|
||||
// 添加省略号
|
||||
if (params.page > visiblePages) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-ellipsis">...</a></li>');
|
||||
}
|
||||
|
||||
// 添加中间的页码
|
||||
for (let i = params.page - Math.floor(visiblePages / 2); i <= params.page + Math.floor(visiblePages / 2); i++) {
|
||||
if (i > 1 && i < totalPages) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">' + i + '</a></li>');
|
||||
}
|
||||
}
|
||||
// 添加省略号
|
||||
if (params.page < totalPages - visiblePages + 1) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-ellipsis">...</a></li>');
|
||||
}
|
||||
if (totalPages > 1) {
|
||||
// 添加最后一页
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">' + totalPages + '</a></li>');
|
||||
}
|
||||
// 添加下一页按钮
|
||||
pagination.append('<li><a href="javascript:;" aria-label="Next"><span aria-hidden="true">></span></a></li>');
|
||||
// Add active class to current page
|
||||
pagination.find('.page-number').removeClass('active');
|
||||
pagination.find('.page-number').filter(function () {
|
||||
return parseInt($(this).text()) == params.page;
|
||||
}).addClass('active');
|
||||
}
|
||||
|
||||
// 点击页码时切换页面
|
||||
pagination.on('click', '.page-number', function () {
|
||||
params.page = parseInt($(this).text());
|
||||
getTitleList()
|
||||
});
|
||||
|
||||
// 点击上一页按钮时切换到上一页
|
||||
pagination.on('click', '[aria-label="Previous"]', function () {
|
||||
if (params.page > 1) {
|
||||
params.page--;
|
||||
getTitleList()
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 点击下一页按钮时切换到下一页
|
||||
pagination.on('click', '[aria-label="Next"]', function () {
|
||||
if (params.page < totalPages) {
|
||||
params.page++;
|
||||
getTitleList()
|
||||
}
|
||||
});
|
||||
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + '年';
|
||||
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
|
||||
D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '日';
|
||||
return (Y + M + D);
|
||||
}
|
||||
})
|
||||
51
js/buy_domain.js
Normal file
51
js/buy_domain.js
Normal file
@@ -0,0 +1,51 @@
|
||||
$(function () {
|
||||
// 点击class creat-btn 的时候 弹出购买域名的弹窗
|
||||
$('.creat-btn').click(function () {
|
||||
$('body').css('overflow', 'hidden')
|
||||
$('html').css('overflow', 'hidden')
|
||||
$('.creat-template-box').show()
|
||||
$('.creat-form').animate({ width: '1400px' }, 300)
|
||||
})
|
||||
// 关闭弹窗函数
|
||||
function closeDia() {
|
||||
$('.creat-form').animate({ width: '0px' }, 300)
|
||||
// 带动画的关闭弹窗
|
||||
setTimeout(function () {
|
||||
$('.creat-template-box').hide()
|
||||
// 关闭弹窗后恢复滚动条
|
||||
$('body').css('overflow', 'auto')
|
||||
$('html').css('overflow', 'auto')
|
||||
}, 300)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 点击creat-template-box 和 close-dia-btn 的时候 弹窗消失
|
||||
$('.creat-template-box,.close-dia-btn').click(function () {
|
||||
closeDia()
|
||||
})
|
||||
|
||||
// 点击creat-form 的时候 弹窗不消失
|
||||
$('.creat-form').click(function (e) {
|
||||
e.stopPropagation()
|
||||
})
|
||||
// 点击 user-item 添加 active 类
|
||||
$('.user-item').click(function () {
|
||||
$('.user-item').removeClass('active')
|
||||
$(this).addClass('active')
|
||||
})
|
||||
// 当鼠标移入form-value 的时候 判断是否有 show-tip这个自定义属性
|
||||
$('.form-value').mouseenter(function () {
|
||||
// 如果有 show-tip 这个自定义属性
|
||||
if ($(this).attr('show-tip')) {
|
||||
$('.no-tips').hide()
|
||||
// 把这个值赋值给 input-tip 的内容 解析为html
|
||||
$('.input-tip').html($(this).attr('show-tip'))
|
||||
$('.input-tip').show()
|
||||
} else {
|
||||
$('.input-tip').hide()
|
||||
$('.no-tips').show()
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
95
js/consult.js
Normal file
95
js/consult.js
Normal file
@@ -0,0 +1,95 @@
|
||||
$(function () {
|
||||
// 提交
|
||||
function subConsult() {
|
||||
$.ajax({
|
||||
url: "/console/v1/consult",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': "Bearer" + " " + localStorage.jwt
|
||||
},
|
||||
data: {
|
||||
contact: $('#inputName').val(),
|
||||
company: $('#inputCompany').val(),
|
||||
phone: $('#inputPhone').val(),
|
||||
email: $('#inputEmail').val(),
|
||||
matter: $('#inputQuestion').val()
|
||||
},
|
||||
success: function (res) {
|
||||
showMessage('success', '提交成功!', 2000); // 显示 3 秒钟的成功消息
|
||||
$('#inputName').val("")
|
||||
$('#inputCompany').val("")
|
||||
$('#inputPhone').val("")
|
||||
$('#inputEmail').val("")
|
||||
$('#inputQuestion').val("")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showMessage(type, message, duration) {
|
||||
const alertClass = 'alert-' + type;
|
||||
const html = '<div class="alert ' + alertClass + ' show alert-dismissible" role="alert">' +
|
||||
message +
|
||||
'<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
|
||||
'<span aria-hidden="true">×</span>' +
|
||||
'</button>' +
|
||||
'</div>';
|
||||
const $alert = $(html).appendTo('#alert-container');
|
||||
setTimeout(function () {
|
||||
$alert.alert('close');
|
||||
}, duration);
|
||||
// 清空表单
|
||||
}
|
||||
|
||||
// 表单元素必填验证函数
|
||||
function validateRequired(input) {
|
||||
if (input.val().trim() === '') {
|
||||
input.attr('style', 'border: 1px solid #FF6739;')
|
||||
input.focus();
|
||||
return false;
|
||||
}
|
||||
input.attr('style', 'border: 1px solid #E6EAED;')
|
||||
return true;
|
||||
}
|
||||
|
||||
$('form').submit(function (event) {
|
||||
event.preventDefault(); // 防止表单提交默认行为
|
||||
const name = $("#inputName")
|
||||
const company = $("#inputCompany")
|
||||
const phone = $("#inputPhone")
|
||||
const email = $("#inputEmail")
|
||||
const question = $("#inputQuestion")
|
||||
|
||||
// 验证表单元素
|
||||
if (!validateRequired(name)) {
|
||||
return;
|
||||
}
|
||||
if (phone.val().trim().length === 0 && email.val().trim().length === 0) {
|
||||
phone.attr('style', 'border: 1px solid #FF6739;')
|
||||
phone.focus();
|
||||
return
|
||||
}
|
||||
if (phone.val().trim().length !== 0 || email.val().trim().length !== 0) {
|
||||
const validPhone = /^\d{11}$/.test(phone.val().trim());
|
||||
const validEmail = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/.test(email.val().trim());
|
||||
if (phone.val().trim().length > 0 && !validPhone) {
|
||||
phone.attr('style', 'border: 1px solid #FF6739;')
|
||||
phone.focus();
|
||||
email.attr('style', 'border: 1px solid #E6EAED;')
|
||||
return
|
||||
}
|
||||
if (email.val().trim().length > 0 && !validEmail) {
|
||||
email.attr('style', 'border: 1px solid #FF6739;')
|
||||
email.focus();
|
||||
phone.attr('style', 'border: 1px solid #E6EAED;')
|
||||
return
|
||||
}
|
||||
email.attr('style', 'border: 1px solid #E6EAED;')
|
||||
phone.attr('style', 'border: 1px solid #E6EAED;')
|
||||
}
|
||||
if (!validateRequired(question)) {
|
||||
return;
|
||||
}
|
||||
subConsult()
|
||||
});
|
||||
|
||||
})
|
||||
50
js/document.js
Normal file
50
js/document.js
Normal file
@@ -0,0 +1,50 @@
|
||||
$(function () {
|
||||
let navflag = false;
|
||||
$('.nav-tab').click(function () {
|
||||
$(this).siblings().each(function () {
|
||||
$(this).removeClass('a_active');
|
||||
// $(this).removeClass('a_active');
|
||||
$(this).find('.nav-box').css('height', '0')
|
||||
//关闭右侧箭头
|
||||
if ($(this).attr('class').indexOf('nav-ul') != -1) {
|
||||
$(this).find('.icon-bottom').css('transform', 'rotateZ(0deg)')
|
||||
$(this).find('.icon-bottom').css('transition', 'all .5s')
|
||||
$(this).removeClass('nav-show')
|
||||
// $(this).find('div').removeClass('nav-box')
|
||||
}
|
||||
})
|
||||
//当前选中
|
||||
$(this).addClass('a_active')
|
||||
$(this).find('.li-a').addClass('active')
|
||||
// 打开右侧箭头
|
||||
$(this).find('.icon-bottom').css('transform', 'rotateZ(180deg)')
|
||||
$(this).find('.icon-bottom').css('transition', 'all .5s')
|
||||
$(this).addClass('nav-show')
|
||||
// $(this).find('div').addClass('nav-box')
|
||||
})
|
||||
/* 二级菜单a点击事件 */
|
||||
$(".li-a-a").click(function () {
|
||||
$(".li-a-a").each(function () {
|
||||
$(this).removeClass('active-li-a');
|
||||
})
|
||||
$(this).addClass('active-li-a');
|
||||
})
|
||||
|
||||
|
||||
$('.icon-menu').click(function () {
|
||||
$('.overview').toggle()
|
||||
});
|
||||
|
||||
/* 文档左侧切换效果 */
|
||||
$('.chevron-right-bottom').click(function () {
|
||||
let btn = $(this)
|
||||
$(this).toggleClass('active');
|
||||
$('.nav-div ul li').each(function (ind, el) {
|
||||
if (btn.hasClass('active')) {
|
||||
$(el).addClass('nav-show active').find('.li-a').addClass('active')
|
||||
} else {
|
||||
$(el).removeClass('nav-show active').find('.li-a').removeClass('active')
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
40
js/document_index.js
Normal file
40
js/document_index.js
Normal file
@@ -0,0 +1,40 @@
|
||||
$(function () {
|
||||
// 获取列表
|
||||
function getHelpLlis() {
|
||||
$.ajax({
|
||||
url: "/console/v1/help",
|
||||
method: "get",
|
||||
success: function (res) {
|
||||
res.data.list.forEach((item, index) => {
|
||||
$("#docement-list").append(`
|
||||
<div class="document-box">
|
||||
<div class="document-header">
|
||||
<img src="/web/default/assets/img/document/group-${Math.ceil(
|
||||
Math.random() * 6
|
||||
)}.png" alt="">
|
||||
<h5>${item.name}</h5>
|
||||
</div>
|
||||
<div class="document-cont mt-20" id="document-item${
|
||||
item.id
|
||||
}"></div>
|
||||
</div>
|
||||
`);
|
||||
if (item.helps.length !== 0) {
|
||||
item.helps.slice(0, 6).forEach((helps) => {
|
||||
$(`#document-item${item.id}`).append(`
|
||||
<p class="font-el1"><a href="/plugin/26/helpTotal.htm?id=${helps.id}">${helps.title}</a></p>
|
||||
`);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
getHelpLlis();
|
||||
|
||||
/* 文档搜索 */
|
||||
$(".banner-document .search-btn").click(function () {
|
||||
const val = $("#document-input").val();
|
||||
location.href = `document-result.html?search=${val}`;
|
||||
});
|
||||
});
|
||||
56
js/document_result.js
Normal file
56
js/document_result.js
Normal file
@@ -0,0 +1,56 @@
|
||||
$(function () {
|
||||
// 搜索结果页
|
||||
function getSearchList (keyword) {
|
||||
const val = keyword
|
||||
$('#result-input').val(val)
|
||||
$('.keyword').text(`“${val}”`)
|
||||
$.ajax({
|
||||
url: `/console/v1/help?keywords=${val}`,
|
||||
method: 'get',
|
||||
success: function (res) {
|
||||
const temp = res.data.list.reduce((all, cur) => {
|
||||
const helps = cur.helps.filter(fil => fil.search)
|
||||
all.push(...helps)
|
||||
return all
|
||||
}, [])
|
||||
$('.search-result').html('')
|
||||
if (temp.length > 0) {
|
||||
temp.forEach((item, index) => {
|
||||
$('.keyword-box').show()
|
||||
$('.search-result').append(
|
||||
`
|
||||
<div class="document-details-list">
|
||||
<div class="document-details-item">
|
||||
<a href="/plugin/26/helpTotal.htm?id=${item.id}">
|
||||
<h5 class="font16">${item.title}</h5>
|
||||
</a>
|
||||
<p>
|
||||
${item.des || ''}
|
||||
</p>
|
||||
<div class="mt-10"><span class="font-grey">来自:</span> <span>产品 > 帮助中心</span></div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)
|
||||
})
|
||||
} else {
|
||||
$('.search-result').append(
|
||||
`
|
||||
<div class="common-empty">
|
||||
<img src="./assets/img/empty/empty_08.png" alt="">
|
||||
<p class="des">抱歉,没有搜索到,请重新搜索</p>
|
||||
</div>
|
||||
`
|
||||
)
|
||||
$('.keyword-box').hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
getSearchList(decodeURI(location.search.split('?')[1]?.split('=')[1]));
|
||||
$('#search-btn').click(function () {
|
||||
const keyword = $('#result-input').val()
|
||||
getSearchList(keyword)
|
||||
})
|
||||
|
||||
})
|
||||
82
js/domain.js
Normal file
82
js/domain.js
Normal file
@@ -0,0 +1,82 @@
|
||||
$(function() {
|
||||
const addons_js_arr = JSON.parse(
|
||||
document.querySelector("#addons_js").getAttribute("addons_js")
|
||||
);
|
||||
const arr = addons_js_arr.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
|
||||
// 是否有域名插件
|
||||
const hasDomain = arr.includes("IdcsmartDomain");
|
||||
let jumpUrl = "";
|
||||
if (hasDomain) {
|
||||
// 默认配置
|
||||
$.ajax({
|
||||
url: "/console/v1/idcsmart_domain/config",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status === 200) {
|
||||
const suffix = res.data.default_search_domain || '.com';
|
||||
jumpUrl = res.data.domain_url;
|
||||
$('#default-suffix').html(suffix);
|
||||
$('.domain-url').attr('href', jumpUrl);
|
||||
}
|
||||
},
|
||||
});
|
||||
// 后缀
|
||||
$.ajax({
|
||||
url: "/console/v1/idcsmart_domain/domain_suffix",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status === 200) {
|
||||
const arr = res.data;
|
||||
arr.forEach((item, index) => {
|
||||
$("#suffix-box").append(
|
||||
`
|
||||
<div class="select-box-item">${item.suffix}</div>
|
||||
`
|
||||
)
|
||||
})
|
||||
$('#suffix-box .select-box-item').each((ind, el) => {
|
||||
$(el).removeClass('active');
|
||||
if($(el).text() === $('#default-suffix').text()){
|
||||
$(el).addClass('active')
|
||||
}
|
||||
$(el).click(function () {
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
})
|
||||
})
|
||||
} else {
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
$('#default-suffix').html('.com');
|
||||
['.com','.cn'].forEach((item, index) => {
|
||||
$("#suffix-box").append(
|
||||
`
|
||||
<div class="select-box-item">${item}</div>
|
||||
`
|
||||
)
|
||||
})
|
||||
}
|
||||
$('.search-btn').click(function() {
|
||||
if (hasDomain) {
|
||||
const domain = $('#domain-input').val();
|
||||
const suffix = $('#default-suffix').text();
|
||||
if (!domain) {
|
||||
return;
|
||||
}
|
||||
window.open(`${jumpUrl}&domain=${domain}&suffix=${suffix}`)
|
||||
} else {
|
||||
showMessage('error', '功能暂未开放!', 2000);
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
83
js/feedback.js
Normal file
83
js/feedback.js
Normal file
@@ -0,0 +1,83 @@
|
||||
$(function () {
|
||||
const setIndexData = () => {
|
||||
const commentObj = JSON.parse(sessionStorage.commentData);
|
||||
commentObj.feedback_type.forEach((item, index) => {
|
||||
$("#radioBox").append(`
|
||||
<div class="radio">
|
||||
<input type="radio" name="radioId" id="ptionsRadios${index}" value=${item.id} />
|
||||
<label for="${item.id}">
|
||||
<p class="radio-title">${item.name}</p>
|
||||
<p class="radio-desc">${item.description}</p>
|
||||
</label>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
$("#ptionsRadios0").prop("checked", true);
|
||||
console.log();
|
||||
};
|
||||
|
||||
$("#subBtn").click(function (event) {
|
||||
event.preventDefault(); // 阻止默认的提交行为
|
||||
// 获取表单元素
|
||||
const titleInput = $("#inputTitle");
|
||||
const descriptionInput = $("#inputDescription");
|
||||
// 验证表单元素
|
||||
if (!validateRequired(titleInput)) {
|
||||
return;
|
||||
}
|
||||
if (!validateRequired(descriptionInput)) {
|
||||
return;
|
||||
}
|
||||
subFeedback();
|
||||
$("#ptionsRadios0").prop("checked", true);
|
||||
$("#inputTitle").val("");
|
||||
$("#inputDescription").val("");
|
||||
$("#contactInput").val("");
|
||||
});
|
||||
// 提交
|
||||
function subFeedback() {
|
||||
$.ajax({
|
||||
url: "/console/v1/feedback",
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
data: {
|
||||
type: $('input[name="radioId"]:checked').val(),
|
||||
title: $("#inputTitle").val(),
|
||||
description: $("#inputDescription").val(),
|
||||
attachment: [],
|
||||
contact: $("#contactInput").val(),
|
||||
},
|
||||
success: function (res) {
|
||||
showMessage("success", "提交成功!", 2000); // 显示 3 秒钟的成功消息
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 表单元素必填验证函数
|
||||
function validateRequired(input) {
|
||||
if (input.val().trim() === "") {
|
||||
input.attr("style", "border: 1px solid #FF6739;");
|
||||
input.focus();
|
||||
return false;
|
||||
}
|
||||
input.attr("style", "border: 1px solid #E6EAED;");
|
||||
return true;
|
||||
}
|
||||
// 获取通用配置信息
|
||||
function getCommentInfo() {
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
}
|
||||
getCommentInfo();
|
||||
});
|
||||
208
js/index.js
Normal file
208
js/index.js
Normal file
@@ -0,0 +1,208 @@
|
||||
$(function () {
|
||||
// 获取url地址栏参数函数
|
||||
function getUrlParams() {
|
||||
const url = window.location.href;
|
||||
// 判断是否有参数
|
||||
if (url.indexOf("?") === -1) {
|
||||
return {};
|
||||
}
|
||||
const params = url.split("?")[1];
|
||||
const paramsArr = params.split("&");
|
||||
const paramsObj = {};
|
||||
paramsArr.forEach((item) => {
|
||||
const key = item.split("=")[0];
|
||||
const value = item.split("=")[1];
|
||||
// 解析中文
|
||||
paramsObj[key] = decodeURI(value);
|
||||
});
|
||||
return paramsObj;
|
||||
}
|
||||
//设置cookie
|
||||
function setCookie(c_name, value, expiredays = 1) {
|
||||
const exdate = new Date();
|
||||
exdate.setDate(exdate.getDate() + expiredays);
|
||||
document.cookie =
|
||||
c_name + "=" + value + (";expires=" + exdate.toGMTString());
|
||||
}
|
||||
// 判断首页是否为推荐页面
|
||||
function isRecommend() {
|
||||
const urlParams = getUrlParams();
|
||||
if (urlParams.recommend_c) {
|
||||
setCookie("recommend_c", urlParams.recommend_c);
|
||||
}
|
||||
}
|
||||
isRecommend();
|
||||
// 设置首页函数
|
||||
function setIndexData() {
|
||||
const commentObj = JSON.parse(sessionStorage.commentData);
|
||||
if (commentObj.honor.length > 0) {
|
||||
commentObj.honor.forEach((item) => {
|
||||
$("#certBox").append(`<div class="cert-item">
|
||||
<img src=${item.img} alt="">
|
||||
<p class="mt-20">${item.name}</p>
|
||||
</div>`);
|
||||
});
|
||||
}
|
||||
if (commentObj.partner.length > 0 && commentObj.partner.length <= 3) {
|
||||
commentObj.partner.forEach((item) => {
|
||||
$("#practiceBox").append(`<div class="practice-box">
|
||||
<img src="${item.img}" alt="">
|
||||
<div class="mt-10">${item.description}</div>
|
||||
<p class="tr font-grey mt-20 font12">${item.name}</p>
|
||||
</div>`);
|
||||
});
|
||||
} else if (commentObj.partner.length > 3) {
|
||||
const arr1 = commentObj.partner.slice(0, 3);
|
||||
const arr2 = commentObj.partner.slice(3);
|
||||
arr1.forEach((item) => {
|
||||
$("#practiceBox").append(`<div class="practice-box">
|
||||
<img src="${item.img}" alt="">
|
||||
<div class="mt-10">${item.description}</div>
|
||||
<p class="tr font-grey mt-20 font12">${item.name}</p>
|
||||
</div>`);
|
||||
});
|
||||
$("#morPracticeBox").attr("style", "display: flex;");
|
||||
arr2.forEach((item) => {
|
||||
$("#morPracticeBox").append(` <div class="brand-box">
|
||||
<img src="${item.img}" alt="">
|
||||
</div>`);
|
||||
});
|
||||
}
|
||||
}
|
||||
// 获取通用配置信息
|
||||
function getCommentInfo() {
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
}
|
||||
// 获取首页数据
|
||||
getCommentInfo();
|
||||
var viewer = new Viewer(document.getElementById("viewer"), {
|
||||
button: true,
|
||||
inline: false,
|
||||
zoomable: true,
|
||||
title: true,
|
||||
tooltip: true,
|
||||
minZoomRatio: 0.5,
|
||||
maxZoomRatio: 100,
|
||||
movable: true,
|
||||
interval: 2000,
|
||||
navbar: true,
|
||||
loading: true,
|
||||
});
|
||||
|
||||
// 点击显示图片
|
||||
$(".cert-item,.practice-box,.brand-box").click(function () {
|
||||
// 设置图片
|
||||
$("#viewer").attr("src", $(this).find("img").attr("src"));
|
||||
viewer.show();
|
||||
});
|
||||
|
||||
const mySwiper = new Swiper(".swiper", {
|
||||
loop: true, // 循环模式选项
|
||||
autoplay: true,
|
||||
// 如果需要分页器
|
||||
pagination: {
|
||||
el: ".swiper-pagination",
|
||||
clickable: true,
|
||||
},
|
||||
});
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + "-";
|
||||
M =
|
||||
(date.getMonth() + 1 < 10
|
||||
? "0" + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1) + "-";
|
||||
D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
return Y + M + D;
|
||||
}
|
||||
// 公告列表
|
||||
function getAnnounceList() {
|
||||
$.ajax({
|
||||
url: "/console/v1/announcement",
|
||||
method: "get",
|
||||
data: {
|
||||
page: 1,
|
||||
limit: 5,
|
||||
},
|
||||
success: function (res) {
|
||||
const announceList = res.data.list;
|
||||
announceList.forEach((item, index) => {
|
||||
$("#announceList").append(`
|
||||
<div class="news-item">
|
||||
<div class="fboxRow Ycenter">
|
||||
<div class="number">${index + 1}</div>
|
||||
<a href="./announce-details.html?id=${item.id}">
|
||||
<div class="title font-ell1">${item.title}</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="time">${formateTimeFun(item.create_time)}</div>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
getAnnounceList();
|
||||
// 新闻列表
|
||||
function getNewsList() {
|
||||
$.ajax({
|
||||
url: "/console/v1/news",
|
||||
method: "get",
|
||||
data: {
|
||||
page: 1,
|
||||
limit: 5,
|
||||
},
|
||||
success: function (res) {
|
||||
const announceList = res.data.list;
|
||||
announceList.forEach((item, index) => {
|
||||
$("#newsList").append(`
|
||||
<div class="news-item">
|
||||
<div class="fboxRow Ycenter">
|
||||
<div class="number">${index + 1}</div>
|
||||
<a href="./news-details.html?id=${item.id}">
|
||||
<div class="title font-ell1">${item.title}</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="time">${formateTimeFun(item.create_time)}</div>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
getNewsList();
|
||||
|
||||
$("#myTabs a").click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab("show");
|
||||
});
|
||||
// 跳转函数
|
||||
function goOtherPage(url) {
|
||||
location.href = url;
|
||||
}
|
||||
$("#cloud-box").click(function () {
|
||||
location.href = "cloud.html";
|
||||
});
|
||||
$("#domain-box").click(function () {
|
||||
location.href = "domain.html";
|
||||
});
|
||||
$("#recomment-box").click(function () {
|
||||
location.href = "/home.htm";
|
||||
});
|
||||
$("#logon-box").click(function () {
|
||||
location.href = "/regist.htm";
|
||||
});
|
||||
$("#cps-box").click(function () {
|
||||
location.href = "partner/cps.html";
|
||||
});
|
||||
});
|
||||
111
js/news-classify.js
Normal file
111
js/news-classify.js
Normal file
@@ -0,0 +1,111 @@
|
||||
$(function () {
|
||||
let url = window.location.href
|
||||
let getqyinfo = url.split('?')[1]
|
||||
let getqys = new URLSearchParams('?' + getqyinfo)
|
||||
const id = getqys.get('id')
|
||||
const title = getqys.get('title')
|
||||
$('#newType').text(title)
|
||||
$('#newsText').text(title)
|
||||
var params = {
|
||||
addon_idcsmart_news_type_id: id,
|
||||
page: 1, // 当前页数
|
||||
limit: 10 // 一页几条
|
||||
}
|
||||
var totalPages = 0; // 总页数
|
||||
var visiblePages = 5; // 显示的页码数
|
||||
var pagination = $('.pagination');
|
||||
|
||||
|
||||
|
||||
// 新闻列表
|
||||
function getTitleList() {
|
||||
$.ajax({
|
||||
url: "/console/v1/news",
|
||||
method: 'get',
|
||||
data: params,
|
||||
success: function (res) {
|
||||
const titleList = res.data.list
|
||||
$('#totalText').text(`共${res.data.count}项数据`)
|
||||
totalPages = Math.ceil(res.data.count / params.limit)
|
||||
$('.announce-list').empty()
|
||||
titleList.forEach((item) => {
|
||||
$('.announce-list').append(`
|
||||
<div class="announce-item">
|
||||
<p class="announce-item-title font-ell1"><a href="news-details.html?id=${item.id}">${item.title}</a></p>
|
||||
<p class="announce-item-time">${formateTimeFun(item.create_time)}</p>
|
||||
</div>
|
||||
`)
|
||||
})
|
||||
renderPagination();
|
||||
}
|
||||
});
|
||||
}
|
||||
getTitleList()
|
||||
// 渲染分页器
|
||||
function renderPagination() {
|
||||
// 清空分页器
|
||||
pagination.empty();
|
||||
// 添加上一页按钮
|
||||
pagination.append('<li><a href="javascript:;" aria-label="Previous"><span aria-hidden="true"><</span></a></li>');
|
||||
|
||||
// 添加第一页
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">1</a></li>');
|
||||
// 添加省略号
|
||||
if (params.page > visiblePages) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-ellipsis">...</a></li>');
|
||||
}
|
||||
|
||||
// 添加中间的页码
|
||||
for (let i = params.page - Math.floor(visiblePages / 2); i <= params.page + Math.floor(visiblePages / 2); i++) {
|
||||
if (i > 1 && i < totalPages) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">' + i + '</a></li>');
|
||||
}
|
||||
}
|
||||
// 添加省略号
|
||||
if (params.page < totalPages - visiblePages + 1) {
|
||||
pagination.append('<li><a href="javascript:;" class="page-ellipsis">...</a></li>');
|
||||
}
|
||||
if (totalPages > 1) {
|
||||
// 添加最后一页
|
||||
pagination.append('<li><a href="javascript:;" class="page-number">' + totalPages + '</a></li>');
|
||||
}
|
||||
// 添加下一页按钮
|
||||
pagination.append('<li><a href="javascript:;" aria-label="Next"><span aria-hidden="true">></span></a></li>');
|
||||
// Add active class to current page
|
||||
pagination.find('.page-number').removeClass('active');
|
||||
pagination.find('.page-number').filter(function () {
|
||||
return parseInt($(this).text()) == params.page;
|
||||
}).addClass('active');
|
||||
}
|
||||
|
||||
// 点击页码时切换页面
|
||||
pagination.on('click', '.page-number', function () {
|
||||
params.page = parseInt($(this).text());
|
||||
getTitleList()
|
||||
});
|
||||
|
||||
// 点击上一页按钮时切换到上一页
|
||||
pagination.on('click', '[aria-label="Previous"]', function () {
|
||||
if (params.page > 1) {
|
||||
params.page--;
|
||||
getTitleList()
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 点击下一页按钮时切换到下一页
|
||||
pagination.on('click', '[aria-label="Next"]', function () {
|
||||
if (params.page < totalPages) {
|
||||
params.page++;
|
||||
getTitleList()
|
||||
}
|
||||
});
|
||||
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + '年';
|
||||
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
|
||||
D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '日';
|
||||
return (Y + M + D);
|
||||
}
|
||||
})
|
||||
78
js/news-details.js
Normal file
78
js/news-details.js
Normal file
@@ -0,0 +1,78 @@
|
||||
$(function () {
|
||||
let url = window.location.href;
|
||||
let getqyinfo = url.split("?")[1];
|
||||
let getqys = new URLSearchParams("?" + getqyinfo);
|
||||
const id = getqys.get("id");
|
||||
var news = {};
|
||||
function decodeHTML(html) {
|
||||
var doc = new DOMParser().parseFromString(html, "text/html");
|
||||
return doc.documentElement.textContent;
|
||||
}
|
||||
// 获取新闻详情
|
||||
function getDetail() {
|
||||
$.ajax({
|
||||
url: `/console/v1/news/${id}`,
|
||||
method: "get",
|
||||
success: function (res) {
|
||||
news = res.data.news;
|
||||
$("#announce-name").text(`${news.title}`);
|
||||
$(".announce-title").text(`${news.title}`);
|
||||
$("#announce-type").text(`${news.type}`);
|
||||
$("#announce-type").attr(
|
||||
"href",
|
||||
`./news-classify.html?id=${news.addon_idcsmart_news_type_id}&title=${news.type}`
|
||||
);
|
||||
$(".announce-details-time").text(`${formateTimeFun(news.create_time)}`);
|
||||
// $('.announce-details-cont').html(decodeHTML(`${news.content.replace(/amp;/g, '')}`))
|
||||
$(".announce-details-cont").html(news.content);
|
||||
if (news.prev?.id) {
|
||||
$("#page-box").append(`
|
||||
<div class="announce-details-page">上一篇:<a href="./news-details.html?id=${news.prev?.id}">${news.prev?.title}</a></div>
|
||||
`);
|
||||
}
|
||||
if (news.next?.id) {
|
||||
$("#page-box").append(`
|
||||
<div class="announce-details-page">下一篇:<a href="./news-details.html?id=${news.next?.id}">${news.next?.title}</a></div>
|
||||
`);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
getDetail();
|
||||
getNewList();
|
||||
function getNewList() {
|
||||
$.ajax({
|
||||
url: "/console/v1/news",
|
||||
method: "get",
|
||||
data: {
|
||||
addon_idcsmart_news_type_id: "",
|
||||
page: 1, // 当前页数
|
||||
limit: 5,
|
||||
},
|
||||
success: function (res) {
|
||||
const titleList = res.data.list;
|
||||
titleList.forEach((item, i) => {
|
||||
$(`#newsBox`).append(`
|
||||
<div class="news-item">
|
||||
<div class="news-number">${i + 1}</div>
|
||||
<a class="font-ell1 link-hover" href="news-details.html?id=${
|
||||
item.id
|
||||
}">${item.title}</a>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + "-";
|
||||
M =
|
||||
(date.getMonth() + 1 < 10
|
||||
? "0" + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1) + "-";
|
||||
D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + "";
|
||||
return Y + M + D;
|
||||
}
|
||||
});
|
||||
101
js/news.js
Normal file
101
js/news.js
Normal file
@@ -0,0 +1,101 @@
|
||||
$(function () {
|
||||
var params = {
|
||||
addon_idcsmart_news_type_id: '',
|
||||
page: 1, // 当前页数
|
||||
limit: 6
|
||||
}
|
||||
// 获取新闻分类
|
||||
function getTypelist() {
|
||||
$.ajax({
|
||||
url: "/console/v1/news/type",
|
||||
method: 'get',
|
||||
success: function (res) {
|
||||
const typeList = res.data.list
|
||||
typeList.forEach((item, index) => {
|
||||
if (index === 0) {
|
||||
$('#leftNews-title').text(item.name)
|
||||
$('#leftNews-type').attr('href', `news-classify.html?id=${item.id}&title=${item.name}`)
|
||||
} else {
|
||||
$('#new-type-list').append(`
|
||||
<div class="news-box bottom-news">
|
||||
<div class="news-box-head fboxRow Xbetween">
|
||||
<div class="news-title">${item.name}</div>
|
||||
<a href="news-classify.html?id=${item.id}&title=${item.name}" class="font-grey">更多<span class="font18 iconfont icon-arrow-right"></span></a>
|
||||
</div>
|
||||
<div class="news-list" id='newstype${index}'>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
|
||||
}
|
||||
getTitleList(item.id, index)
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
getTypelist()
|
||||
// 新闻列表
|
||||
function getTitleList(id, index) {
|
||||
params.addon_idcsmart_news_type_id = id
|
||||
if (index === 0) {
|
||||
params.limit = 6
|
||||
} else {
|
||||
params.limit = 3
|
||||
}
|
||||
$.ajax({
|
||||
url: "/console/v1/news",
|
||||
method: 'get',
|
||||
data: params,
|
||||
success: function (res) {
|
||||
const titleList = res.data.list
|
||||
if (index === 0) {
|
||||
const firstNews = res.data.list[0]
|
||||
const arr = res.data.list.slice(1)
|
||||
if (firstNews) {
|
||||
$('#first-news').attr('href', `news-details.html?id=${firstNews.id}`)
|
||||
$('#first-news').append(`
|
||||
<div class="news-index-banner" style="background: url(${firstNews.img}) no-repeat; background-size: 100% 100%;">
|
||||
<div class="news-banner-filter"></div>
|
||||
<div class="news-banner-cont">
|
||||
<h5 class="font18">${firstNews.title}</h5>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
arr.forEach((item, i) => {
|
||||
$('#left-news').append(`
|
||||
<div class="news-item">
|
||||
<div class="news-number">${i + 1}</div>
|
||||
<a class="font-ell1" href="news-details.html?id=${item.id}">
|
||||
<span class="news-text link-hover">${item.title}</span>
|
||||
<span class="news-time">${formateTimeFun(item.create_time)}</span>
|
||||
</a>
|
||||
</div>
|
||||
`)
|
||||
})
|
||||
} else {
|
||||
titleList.forEach((item, i) => {
|
||||
$(`#newstype${index}`).append(`
|
||||
<div class="news-item">
|
||||
<div class="news-number">${i + 1}</div>
|
||||
<a class="font-ell1" href="news-details.html?id=${item.id}">
|
||||
<span class="news-text link-hover">${item.title}</span>
|
||||
<span class="news-time">${formateTimeFun(item.create_time)}</span>
|
||||
</a>
|
||||
</div>
|
||||
`)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formateTimeFun(time) {
|
||||
const date = new Date(time * 1000);
|
||||
Y = date.getFullYear() + '年';
|
||||
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
|
||||
D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '日';
|
||||
return (Y + M + D);
|
||||
}
|
||||
})
|
||||
16
js/product.js
Normal file
16
js/product.js
Normal file
@@ -0,0 +1,16 @@
|
||||
$(function () {
|
||||
// 点击 country-item 时,给当前元素添加 active 类,移除其他元素的 active 类
|
||||
$(".country-item").click(function () {
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
// 设置他父元素的兄弟元素的di index个为显示
|
||||
// 找到他父元素的兄弟元素
|
||||
$(this)
|
||||
.parent()
|
||||
.parent()
|
||||
.find(".hot-list")
|
||||
.eq($(this).index())
|
||||
.addClass("active")
|
||||
.siblings()
|
||||
.removeClass("active");
|
||||
});
|
||||
});
|
||||
30
js/tools.js
Normal file
30
js/tools.js
Normal file
@@ -0,0 +1,30 @@
|
||||
$(function () {
|
||||
var galleryThumbs = new Swiper('.gallery-thumbs', {
|
||||
spaceBetween: 10,
|
||||
slidesPerView: 10,
|
||||
freeMode: true,
|
||||
watchSlidesVisibility: true,
|
||||
watchSlidesProgress: true,
|
||||
noSwiping: true
|
||||
|
||||
});
|
||||
var galleryTop = new Swiper('.gallery-top', {
|
||||
spaceBetween: 10,
|
||||
thumbs: {
|
||||
swiper: galleryThumbs
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
});
|
||||
const mySwiper = new Swiper(".swiper", {
|
||||
loop: true, // 循环模式选项
|
||||
autoplay: true,
|
||||
// 如果需要分页器
|
||||
pagination: {
|
||||
el: ".swiper-pagination",
|
||||
clickable: true,
|
||||
},
|
||||
});
|
||||
})
|
||||
1469
js/viewer.min.js
vendored
Normal file
1469
js/viewer.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user