update
18
deploy/server/kbase/css/footer.css
Normal file
@@ -0,0 +1,18 @@
|
||||
#app {
|
||||
margin-top: 100px;
|
||||
}
|
||||
/*
|
||||
* Footer
|
||||
*/
|
||||
.bd-footer {
|
||||
padding: 2.5rem 0;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
background-color: #f9f9f9;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
.bd-footer p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
36
deploy/server/kbase/css/img_enlarge.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.kb_black_overlay {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
z-index: 100;
|
||||
}
|
||||
.kb_img {
|
||||
cursor: pointer;
|
||||
}
|
||||
.kb_enlarge_container {
|
||||
display: none;
|
||||
}
|
||||
.kb_enlarge_preview_img {
|
||||
/*这里我设置的是:预览后放大的图片相对于整个页面定位*/
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
/*宽度设置为页面宽度的70%,高度自适应*/
|
||||
width: 70%;
|
||||
z-index: 200;
|
||||
}
|
||||
/*关闭预览*/
|
||||
.kb_close {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
cursor: pointer;
|
||||
z-index: 200;
|
||||
}
|
||||
1
deploy/server/kbase/css/main.css
Normal file
BIN
deploy/server/kbase/img/ashley.jpg
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
deploy/server/kbase/img/cafe.jpg
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
deploy/server/kbase/img/city.jpg
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
deploy/server/kbase/img/close.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
deploy/server/kbase/img/favicon.png
Normal file
|
After Width: | Height: | Size: 279 B |
BIN
deploy/server/kbase/img/joshua.jpg
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
38
deploy/server/kbase/js/article.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
//
|
||||
data.page = "article";
|
||||
data.aid = utils.getUrlParam("aid");
|
||||
|
||||
// ie Ajax cross domain requests
|
||||
$.support.cors = true;
|
||||
// 使ie支持startsWith
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
return this.indexOf(searchString, position) === position;
|
||||
};
|
||||
}
|
||||
// 使ie支持includes
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function (str) {
|
||||
var returnValue = false;
|
||||
if (this.indexOf(str) !== -1) {
|
||||
returnValue = true;
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
}
|
||||
//
|
||||
// layui.use(['layer', 'form', 'upload'], function(){
|
||||
// var layer = layui.layer;
|
||||
// var form = layui.form;
|
||||
// var upload = layui.upload;
|
||||
// });
|
||||
|
||||
// 初始化
|
||||
support.created();
|
||||
support.mounted();
|
||||
});
|
||||
38
deploy/server/kbase/js/category.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
//
|
||||
data.page = "category";
|
||||
data.cid = utils.getUrlParam("cid");
|
||||
|
||||
// ie Ajax cross domain requests
|
||||
$.support.cors = true;
|
||||
// 使ie支持startsWith
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
return this.indexOf(searchString, position) === position;
|
||||
};
|
||||
}
|
||||
// 使ie支持includes
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function (str) {
|
||||
var returnValue = false;
|
||||
if (this.indexOf(str) !== -1) {
|
||||
returnValue = true;
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
}
|
||||
//
|
||||
// layui.use(['layer', 'form', 'upload'], function(){
|
||||
// var layer = layui.layer;
|
||||
// var form = layui.form;
|
||||
// var upload = layui.upload;
|
||||
// });
|
||||
|
||||
// 初始化
|
||||
support.created();
|
||||
support.mounted();
|
||||
});
|
||||
46
deploy/server/kbase/js/data.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
var data = {
|
||||
//
|
||||
HTTP_HOST: "http://127.0.0.1:8000",
|
||||
STOMP_HOST: "http://127.0.0.1:8000",
|
||||
// HTTP_HOST: "https://api.bytedesk.com",
|
||||
// STOMP_HOST: "https://stomp.bytedesk.com",
|
||||
// 知识库自定义二级域名
|
||||
kbSubdomain: '',
|
||||
// 后台管理员唯一uid
|
||||
adminUid: '',
|
||||
subDomain: 'vip',
|
||||
passport: {
|
||||
token: {
|
||||
access_token: "",
|
||||
expires_in: 0,
|
||||
jti: "",
|
||||
refresh_token: "",
|
||||
scope: "",
|
||||
token_type: ""
|
||||
}
|
||||
},
|
||||
// 当前访客用户名
|
||||
uid: "",
|
||||
username: "",
|
||||
password: "",
|
||||
nickname: "",
|
||||
// 本地存储access_token的key
|
||||
token: "token",
|
||||
client: "web",
|
||||
// 当前页面
|
||||
page: "",
|
||||
// 类别cid
|
||||
cid: "",
|
||||
// 文章aid
|
||||
aid: "",
|
||||
// 搜索内容
|
||||
searchContent: "",
|
||||
// 当前类别
|
||||
currentCategory: Object,
|
||||
// 当前文章
|
||||
currentArticle: Object,
|
||||
articleRate: false
|
||||
};
|
||||
37
deploy/server/kbase/js/faq.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
//
|
||||
data.page = "faq";
|
||||
|
||||
// ie Ajax cross domain requests
|
||||
$.support.cors = true;
|
||||
// 使ie支持startsWith
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
return this.indexOf(searchString, position) === position;
|
||||
};
|
||||
}
|
||||
// 使ie支持includes
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function (str) {
|
||||
var returnValue = false;
|
||||
if (this.indexOf(str) !== -1) {
|
||||
returnValue = true;
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
}
|
||||
//
|
||||
// layui.use(['layer', 'form', 'upload'], function(){
|
||||
// var layer = layui.layer;
|
||||
// var form = layui.form;
|
||||
// var upload = layui.upload;
|
||||
// });
|
||||
|
||||
// 初始化
|
||||
support.created();
|
||||
support.mounted();
|
||||
});
|
||||
544
deploy/server/kbase/js/httpapi.js
Normal file
@@ -0,0 +1,544 @@
|
||||
/**
|
||||
* http rest api
|
||||
* v1.0
|
||||
*/
|
||||
/**
|
||||
* @apiDefine User 用户
|
||||
*
|
||||
* 用户相关接口
|
||||
*/
|
||||
/**
|
||||
* @apiDefine Support 工单
|
||||
*
|
||||
* 意见反馈相关接口
|
||||
*/
|
||||
/**
|
||||
* @apiDefine SubDomainClientParam
|
||||
* @apiParam {String} subDomain 企业号,测试可填写 'vip',上线请填写真实企业号
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*/
|
||||
/**
|
||||
* @apiDefine UserResultSuccess
|
||||
* @apiSuccess {String} uid 用户唯一uid.
|
||||
* @apiSuccess {String} username 用户名.
|
||||
* @apiSuccess {String} nickname 昵称.
|
||||
*/
|
||||
/**
|
||||
* @apiDefine ResponseResultSuccess
|
||||
* @apiSuccess {String} message 返回提示
|
||||
* @apiSuccess {Number} status_code 状态码
|
||||
* @apiSuccess {String} data 返回内容
|
||||
*/
|
||||
var httpapi = {
|
||||
/**
|
||||
* @api {get} /visitor/api/username 生成默认访客账号
|
||||
* @apiName requestUsername
|
||||
* @apiGroup User
|
||||
* @apiVersion 1.5.6
|
||||
* @apiPermission none
|
||||
*
|
||||
* @apiUse SubDomainClientParam
|
||||
*
|
||||
* @apiDescription 1. 首先判断是否已经注册过;
|
||||
* 2. 如果已经注册过,则直接调用登录接口;
|
||||
* 3. 如果没有注册过,则从服务器请求用户名;
|
||||
* 4. FIXME: 暂未考虑浏览器不支持localStorage的情况
|
||||
*
|
||||
* @apiUse UserResultSuccess
|
||||
*/
|
||||
requestUsername: function () {
|
||||
//
|
||||
data.username = localStorage.username;
|
||||
data.password = localStorage.password;
|
||||
if (data.username) {
|
||||
if (data.password == null) {
|
||||
data.password = data.username;
|
||||
}
|
||||
httpapi.login();
|
||||
} else {
|
||||
//
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST + "/visitor/api/username",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
type: "get",
|
||||
data: {
|
||||
subDomain: data.subDomain,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
// 登录
|
||||
data.uid = response.data.uid;
|
||||
data.username = response.data.username;
|
||||
data.password = data.username;
|
||||
data.nickname = response.data.nickname;
|
||||
// 本地存储
|
||||
localStorage.uid = data.uid;
|
||||
localStorage.username = data.username;
|
||||
localStorage.password = data.password;
|
||||
// 登录
|
||||
httpapi.login();
|
||||
},
|
||||
error: function(error) {
|
||||
//Do Something to handle error
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @api {post} /oauth/token 登录
|
||||
* @apiName login
|
||||
* @apiGroup User
|
||||
* @apiVersion 1.5.6
|
||||
* @apiPermission none
|
||||
*
|
||||
* @apiHeader {String} Authorization 值固定写死为: 'Basic Y2xpZW50OnNlY3JldA=='
|
||||
*
|
||||
* @apiParam {String} username 用户名
|
||||
* @apiParam {String} password 密码
|
||||
*
|
||||
* @apiDescription 登录
|
||||
*
|
||||
* @apiSuccess {String} access_token 访问令牌
|
||||
* @apiSuccess {Number} expires_in 过期时间
|
||||
* @apiSuccess {String} jti
|
||||
* @apiSuccess {String} refresh_token 刷新令牌
|
||||
* @apiSuccess {String} scope 固定值:'all'
|
||||
* @apiSuccess {String} token_type 固定值:'bearer'
|
||||
*/
|
||||
login: function () {
|
||||
// console.log('do login: ', data.username, data.password);
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST + "/oauth/token",
|
||||
type: "post",
|
||||
data: {
|
||||
"username": data.username,
|
||||
"password": data.password,
|
||||
"grant_type": "password",
|
||||
"scope": "all"
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader('Authorization', 'Basic Y2xpZW50OnNlY3JldA==');
|
||||
},
|
||||
success:function(response){
|
||||
// console.log("login success: ", response);
|
||||
// 本地存储,
|
||||
data.passport.token = response;
|
||||
// 本地存储
|
||||
localStorage.username = data.username;
|
||||
localStorage.password = data.password;
|
||||
localStorage.subDomain = data.subDomain;
|
||||
// localStorage 存储
|
||||
localStorage.setItem(data.token, JSON.stringify(response));
|
||||
// FIXME: 判断是首页
|
||||
if (data.page === "index") {
|
||||
// 加载帮助类别
|
||||
httpapi.getSupportCategories();
|
||||
// 加载文章
|
||||
httpapi.getArticles();
|
||||
} else if (data.page === "category") {
|
||||
// 加载类别详情
|
||||
httpapi.getCategoryDetail(data.cid);
|
||||
} else if (data.page === "article") {
|
||||
// 加载文章详情
|
||||
httpapi.getArticleDetail(data.aid);
|
||||
} else if (data.page === "search") {
|
||||
// 加载搜索结果
|
||||
httpapi.searchArticle(data.searchContent);
|
||||
}
|
||||
NProgress.done();
|
||||
},
|
||||
error: function(error) {
|
||||
//Do Something to handle error
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 加载系统配置
|
||||
*/
|
||||
getSettings: function () {
|
||||
var hostname = window.location.hostname
|
||||
data.kbSubdomain = hostname.split(".")[0]
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST + "/visitor/api/setting/get",
|
||||
type: "get",
|
||||
data: {
|
||||
sub: data.kbSubdomain,
|
||||
client: data.client
|
||||
},
|
||||
success: function (response) {
|
||||
console.log("get settings:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
data.adminUid = response.data.user.uid
|
||||
$('#supporHometTitle').html(response.data.kbTitle)
|
||||
} else {
|
||||
// alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log("get settings error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {get} /visitor/api/category/support 加载类别
|
||||
* @apiName getSupportCategories
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} uid 后台管理员唯一uid
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 加载类别
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
getSupportCategories: function () {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/visitor/api/category/support?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
type: "get",
|
||||
data: {
|
||||
uid: data.adminUid,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
console.log("get Support categories success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
for (var i = 0; i < response.data.length; i++) {
|
||||
var category = response.data[i];
|
||||
if (data.page === "index") {
|
||||
// 其中href参数&ph=ph为占位符,无实际用途
|
||||
$("#supportCategory").append("<div>" +
|
||||
"<a href='category?uid=" + data.adminUid + "&cid=" + category.cid + "&ph=ph' class='box uk-border-rounded' target='_blank'>" +
|
||||
"<h3>" + category.name + "</h3>" +
|
||||
"</a>" +
|
||||
"</div>");
|
||||
} else if (data.page === "category") {
|
||||
// 分类页面
|
||||
if (category.cid == data.currentCategory.cid) {
|
||||
// 当前分类
|
||||
$("#supportCategory").append("<li><a class=‘uk-text-bold' href='category?uid=" + data.adminUid + "&cid=" + category.cid + "&ph=ph'>" + category.name + "</a> <span uk-icon='icon: chevron-right'></span></li>")
|
||||
} else {
|
||||
// 其他分类
|
||||
$("#supportCategory").append("<li><a href='category?uid=" + data.adminUid + "&cid=" + category.cid + "&ph=ph'>" + category.name + "</a></li>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("get Support categories error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {get} /visitor/api/articles 加载文章
|
||||
* @apiName getArticles
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} uid 后台管理员唯一uid
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 加载类别
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
getArticles: function () {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/visitor/api/articles?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
type: "get",
|
||||
data: {
|
||||
uid: data.adminUid,
|
||||
type: 'support',
|
||||
page: 0,
|
||||
size: 20,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
console.log("get articles success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
if (data.page === "index") {
|
||||
// 首页
|
||||
var hotCount = 0;
|
||||
var latestCount = 0;
|
||||
for (var i = 0; i < response.data.content.length; i++) {
|
||||
var article = response.data.content[i];
|
||||
if (article.recommend) {
|
||||
// 限制最多显示5条
|
||||
if (hotCount >= 5) {
|
||||
continue;
|
||||
} else {
|
||||
hotCount++;
|
||||
}
|
||||
// 其中href参数&ph=ph为占位符,无实际用途
|
||||
$("#supportHotArticle").append("<li>" +
|
||||
"<a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</a>" +
|
||||
"</li>");
|
||||
} else {
|
||||
// 限制最多显示5条
|
||||
if (latestCount >= 5) {
|
||||
continue;
|
||||
} else {
|
||||
latestCount++;
|
||||
}
|
||||
// 其中href参数&ph=ph为占位符,无实际用途
|
||||
$("#supportLatestArtcle").append("<li>" +
|
||||
"<a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</a>" +
|
||||
"</li>");
|
||||
}
|
||||
}
|
||||
} else if (data.page === "category") {
|
||||
// 分类页面
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("get articles error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {get} /api/category/detail 加载类别详情
|
||||
* @apiName getCategoryDetail
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} cid 类别cid
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 加载类别详情
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
getCategoryDetail: function (cid) {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/api/v2/category/detail?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
type: "get",
|
||||
data: {
|
||||
cid: cid,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
console.log("get category detail success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
data.currentCategory = response.data.category;
|
||||
$("#supportCategoryName").text(data.currentCategory.name);
|
||||
$("#supportCategoryName2").text(data.currentCategory.name);
|
||||
//
|
||||
for (var i = 0; i < response.data.articles.length; i++) {
|
||||
var article = response.data.articles[i];
|
||||
$("#supportCategoryArticle").append("<li>" +
|
||||
"<h3><a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</span></a></h3>" +
|
||||
"</li>");
|
||||
}
|
||||
// 加载帮助类别
|
||||
httpapi.getSupportCategories();
|
||||
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("get category detail error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {get} /api/article/detail 加载类别详情
|
||||
* @apiName getArticleDetail
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} aid 文章aid
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 加载类别详情
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
getArticleDetail: function (aid) {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/api/article/detail?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
type: "get",
|
||||
data: {
|
||||
aid: aid,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
console.log("get article detail success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
data.currentArticle = response.data.article;
|
||||
data.currentCategory = data.currentArticle.categories[0];
|
||||
// 面包屑导航breadcrumb
|
||||
$("#supportArticleBreadcrumb").append("<li><a href='category?uid=" + data.adminUid + "&cid=" + data.currentCategory.cid + "&ph=ph'>" + data.currentCategory.name + "</a></li>");
|
||||
$("#supportArticleBreadcrumb").append("<li><span href=''>" + data.currentArticle.title + "</span></li>");
|
||||
// 文章作者
|
||||
$("#supportArticleTitle").html(data.currentArticle.title);
|
||||
$("#supportArticleUserAvatar").attr("src",data.currentArticle.user.avatar);
|
||||
$("#supportArticleUserNickname").html(data.currentArticle.user.nickname);
|
||||
$("#supportArticleUpdatedAt").html(data.currentArticle.createdAt);
|
||||
//
|
||||
$("#supportArticleReadCount").html("阅读次数:" + data.currentArticle.readCount);
|
||||
// 文章内容
|
||||
$("#supportArticleSummary").html(data.currentArticle.summary != null ? data.currentArticle.summary : "");
|
||||
$("#supportArticleContent").html(data.currentArticle.content);
|
||||
// 评价
|
||||
data.articleRate = response.data.rate;
|
||||
$("#supportArticleRateHelpfull").html("<span class='uk-margin-small-right' uk-icon='icon: check; ratio: 0.8'></span>是的(" + data.currentArticle.rateHelpful + ")");
|
||||
$("#supportArticleRateHelpless").html("<span class='uk-margin-small-right uk-inline' uk-icon='icon: close; ratio: 0.8'></span>没有(" + data.currentArticle.rateUseless + ")");
|
||||
// $("#supportArticleRateThanks").html();
|
||||
// 最近阅读
|
||||
if (response.data.recent.length > 0) {
|
||||
//
|
||||
for (var i = 0; i < response.data.recent.length; i++) {
|
||||
var article = response.data.recent[i].article;
|
||||
$("#supportArticleRecent").append("<li><a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</span></a></li>");
|
||||
}
|
||||
} else {
|
||||
$("#supportArticleRecent").append("暂无");
|
||||
}
|
||||
// 相关文章
|
||||
if (response.data.related.length > 0) {
|
||||
//
|
||||
for (var i = 0; i < response.data.related.length; i++) {
|
||||
var article = response.data.related[i];
|
||||
$("#supportArticleRelated").append("<li><a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</span></a></li>");
|
||||
}
|
||||
} else {
|
||||
$("#supportArticleRelated").append("暂无");
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("get article detail error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {get} /api/article/search 搜索文章
|
||||
* @apiName searchArticle
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} content 搜索内容
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 搜索文章
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
searchArticle: function (content) {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/api/article/search2?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
type: "get",
|
||||
data: {
|
||||
uid: data.adminUid,
|
||||
content: content,
|
||||
page: 0,
|
||||
size: 20,
|
||||
client: data.client
|
||||
},
|
||||
success:function(response){
|
||||
console.log("search article success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
//
|
||||
if (response.data.content.length == 0) {
|
||||
// 搜索结果为空
|
||||
$("#supportSearchArticle").append("未找到结果");
|
||||
} else {
|
||||
// 搜索结果不为空
|
||||
for (var i = 0; i < response.data.content.length; i++) {
|
||||
var article = response.data.content[i];
|
||||
$("#supportSearchArticle").append("<li><a href='article?uid=" + data.adminUid + "&aid=" + article.aid + "&ph=ph' target='_blank'>" + article.title + "</a></li>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log("search article detail error:", error);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @api {post} /api/article/rate 评价文章是否有用
|
||||
* @apiName leaveMessage
|
||||
* @apiGroup Support
|
||||
* @apiVersion 1.0
|
||||
* @apiPermission afterLogin
|
||||
*
|
||||
* @apiParam {String} access_token 访问令牌
|
||||
* @apiParam {String} aid 文章aid
|
||||
* @apiParam {String} rate 是否有帮助 boolean, 有: true, 无: false
|
||||
* @apiParam {String} client 固定写死为 'web'
|
||||
*
|
||||
* @apiDescription 评价文章是否有用
|
||||
*
|
||||
* @apiUse ResponseResultSuccess
|
||||
*/
|
||||
rateArticle: function (aid, rate) {
|
||||
$.ajax({
|
||||
url: data.HTTP_HOST +
|
||||
"/api/article/rate?access_token=" +
|
||||
data.passport.token.access_token,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
type: "post",
|
||||
data: JSON.stringify({
|
||||
aid: aid,
|
||||
rate: rate,
|
||||
client: data.client
|
||||
}),
|
||||
success:function(response){
|
||||
console.log("rate article success:", response.data);
|
||||
if (response.status_code === 200) {
|
||||
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
alert("评价失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
41
deploy/server/kbase/js/index.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
//
|
||||
data.page = "index";
|
||||
|
||||
// ie Ajax cross domain requests
|
||||
$.support.cors = true;
|
||||
// 使ie支持startsWith
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
return this.indexOf(searchString, position) === position;
|
||||
};
|
||||
}
|
||||
// 使ie支持includes
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function (str) {
|
||||
var returnValue = false;
|
||||
if (this.indexOf(str) !== -1) {
|
||||
returnValue = true;
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
}
|
||||
//
|
||||
// layui.use(['layer', 'form', 'upload'], function(){
|
||||
// var layer = layui.layer;
|
||||
// var form = layui.form;
|
||||
// var upload = layui.upload;
|
||||
// });
|
||||
NProgress.start();
|
||||
// 初始化
|
||||
support.created();
|
||||
support.mounted();
|
||||
//
|
||||
// $("#supportAdminUid").val(data.adminUid);
|
||||
// $("#supportSearchForm").attr("action", "search");
|
||||
|
||||
});
|
||||
10364
deploy/server/kbase/js/jquery.js
vendored
Normal file
2
deploy/server/kbase/js/layui/2.4.5/css/layui.css
Executable file
2
deploy/server/kbase/js/layui/2.4.5/css/layui.mobile.css
Executable file
2
deploy/server/kbase/js/layui/2.4.5/css/modules/code.css
Executable file
@@ -0,0 +1,2 @@
|
||||
/** layui-v2.4.5 MIT License By https://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
||||
BIN
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/icon-ext.png
Executable file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/icon.png
Executable file
|
After Width: | Height: | Size: 11 KiB |
2
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/layer.css
Executable file
BIN
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/loading-0.gif
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/loading-1.gif
Executable file
|
After Width: | Height: | Size: 701 B |
BIN
deploy/server/kbase/js/layui/2.4.5/css/modules/layer/default/loading-2.gif
Executable file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/font/iconfont.eot
Executable file
473
deploy/server/kbase/js/layui/2.4.5/font/iconfont.svg
Executable file
|
After Width: | Height: | Size: 274 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/font/iconfont.ttf
Executable file
BIN
deploy/server/kbase/js/layui/2.4.5/font/iconfont.woff
Executable file
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/0.gif
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/1.gif
Executable file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/10.gif
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/11.gif
Executable file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/12.gif
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/13.gif
Executable file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/14.gif
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/15.gif
Executable file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/16.gif
Executable file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/17.gif
Executable file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/18.gif
Executable file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/19.gif
Executable file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/2.gif
Executable file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/20.gif
Executable file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/21.gif
Executable file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/22.gif
Executable file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/23.gif
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/24.gif
Executable file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/25.gif
Executable file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/26.gif
Executable file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/27.gif
Executable file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/28.gif
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/29.gif
Executable file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/3.gif
Executable file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/30.gif
Executable file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/31.gif
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/32.gif
Executable file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/33.gif
Executable file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/34.gif
Executable file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/35.gif
Executable file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/36.gif
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/37.gif
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/38.gif
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/39.gif
Executable file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/4.gif
Executable file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/40.gif
Executable file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/41.gif
Executable file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/42.gif
Executable file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/43.gif
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/44.gif
Executable file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/45.gif
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/46.gif
Executable file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/47.gif
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/48.gif
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/49.gif
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/5.gif
Executable file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/50.gif
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/51.gif
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/52.gif
Executable file
|
After Width: | Height: | Size: 777 B |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/53.gif
Executable file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/54.gif
Executable file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/55.gif
Executable file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/56.gif
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/57.gif
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/58.gif
Executable file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/59.gif
Executable file
|
After Width: | Height: | Size: 10 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/6.gif
Executable file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/60.gif
Executable file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/61.gif
Executable file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/62.gif
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/63.gif
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/64.gif
Executable file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/65.gif
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/66.gif
Executable file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/67.gif
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/68.gif
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/69.gif
Executable file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/7.gif
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/70.gif
Executable file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
deploy/server/kbase/js/layui/2.4.5/images/face/71.gif
Executable file
|
After Width: | Height: | Size: 5.2 KiB |