2258 lines
97 KiB
HTML
2258 lines
97 KiB
HTML
|
{{define "setting_bottom"}}
|
|||
|
<script src="/static/js/functions.js?v=1.0.1"></script>
|
|||
|
<script src="/static/js/chat-lang.js?v=1.0.0"></script>
|
|||
|
<script>
|
|||
|
var ACTION = "{{.action}}";
|
|||
|
let url = getQuery("url")
|
|||
|
if (url != "") ACTION = url;
|
|||
|
var LANG = checkLang();
|
|||
|
var KefuCleanBtn = '{{.KefuCleanBtn}}';
|
|||
|
</script>
|
|||
|
<script>
|
|||
|
var app = new Vue({
|
|||
|
el: '#app',
|
|||
|
delimiters: ["<{", "}>"],
|
|||
|
data: {
|
|||
|
host: getBaseUrl(),
|
|||
|
flyLang: KEFU_LANG[LANG],
|
|||
|
iframeUrl: "/setting_welcome",
|
|||
|
tabIndex: "1-5",
|
|||
|
fullscreenLoading: false,
|
|||
|
loading: null,
|
|||
|
adminAvator: "",
|
|||
|
adminRole: "",
|
|||
|
openIndex: [1, 3],
|
|||
|
tabActive: "basicTab",
|
|||
|
rules: {
|
|||
|
username: [
|
|||
|
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
|||
|
],
|
|||
|
name: [
|
|||
|
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
|||
|
],
|
|||
|
avator: [
|
|||
|
{ required: true, message: '请选择头像', trigger: 'blur' },
|
|||
|
],
|
|||
|
role_id: [
|
|||
|
{ required: true, message: '请选择角色', trigger: 'blur' },
|
|||
|
],
|
|||
|
nickname: [
|
|||
|
{ required: true, message: '请输入昵称', trigger: 'blur' },
|
|||
|
],
|
|||
|
},
|
|||
|
kefuList: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
kefuDialog: false,
|
|||
|
kefuSetting: [],
|
|||
|
kefuForm: {
|
|||
|
id: "",
|
|||
|
name: "",
|
|||
|
password: "",
|
|||
|
avator: "",
|
|||
|
nickname: "",
|
|||
|
role_name: "",
|
|||
|
role_id: "",
|
|||
|
},
|
|||
|
roleList: [],
|
|||
|
configList: [],
|
|||
|
entConfigList: [
|
|||
|
{ conf_name: "百度文本审核(API_KEY),仅开启AI回复时有效", conf_key: "BaiduCheckApiKey", conf_value: "" },
|
|||
|
{ conf_name: "百度文本审核(SECRET_KEY),仅开启AI回复时有效", conf_key: "BaiduCheckSecretKey", conf_value: "" },
|
|||
|
{ conf_name: "百度文本审核时屏蔽流式输出,仅开启AI回复时有效", conf_key: "BaiduCheckDisableStream", conf_value: "" },
|
|||
|
{ conf_name: "百度翻译AppID", conf_key: "BaiduFanyiAppId", conf_value: "" },
|
|||
|
{ conf_name: "百度翻译密钥", conf_key: "BaiduFanyiAppSec", conf_value: "" },
|
|||
|
{ conf_name: "百度翻译(是否自动翻译)", conf_key: "BaiduFanyiAuto", conf_value: "" },
|
|||
|
{ conf_name: "选择翻译源(gpt或baidu)", conf_key: "FanyiSource", conf_value: "" },
|
|||
|
{ conf_name: "微信网页授权回跳域名(例: https://当前域名,http/https必须加)", conf_key: "WechatHost", conf_value: "" },
|
|||
|
{ conf_name: "微信授权文件( 公众号需要验证域名权限 )", conf_key: "WechatAuthFile", conf_value: "" },
|
|||
|
{ conf_name: "微信菜单JSON <a href='/setting_wechat_menu'>可视化编辑</a>", conf_key: "WechatMenu", conf_value: "" },
|
|||
|
{ conf_name: "访客接受营销会员模板ID", conf_key: "WechatCustomerTemplateId", conf_value: "" },
|
|||
|
{ conf_name: "企业微信内部群通知机器人Webhookurl", conf_key: "WorkWechatWebHookUrl", conf_value: "" },
|
|||
|
{ conf_name: "企业微信(CorpId)", conf_key: "WorkWechatCorpid", conf_value: "" },
|
|||
|
{ conf_name: "企业微信应用(AgentId)", conf_key: "WorkWechatAppAgentId", conf_value: "" },
|
|||
|
{ conf_name: "企业微信应用(Secret)", conf_key: "WorkWechatAppSecret", conf_value: "" },
|
|||
|
{ conf_name: "企业微信应用接收消息Token", conf_key: "WorkWechatAppToken", conf_value: "" },
|
|||
|
{ conf_name: "企业微信应用接收消息EncodingAESKey", conf_key: "WorkWechatAppEncodingAESKey", conf_value: "" },
|
|||
|
{ conf_name: "微信小程序AppId (WechatMiniAppId)", conf_key: "WechatMiniAppId", conf_value: "" },
|
|||
|
{ conf_name: "微信小程序AppSecret (WechatMiniAppSecret)", conf_key: "WechatMiniAppSecret", conf_value: "" },
|
|||
|
{ conf_name: "微信小程序Token (WechatMiniToken)", conf_key: "WechatMiniToken", conf_value: "" },
|
|||
|
{ conf_name: "落地域名( 访问后跳转的最终域名,确认该域名已解析绑定到客服平台 )", conf_key: "VisitorLandHost", conf_value: "" },
|
|||
|
{ conf_name: "邮箱(SMTP地址, 例: smtp.qq.com:465)", conf_key: "NoticeEmailSmtp", conf_value: "" },
|
|||
|
{ conf_name: "邮箱(邮箱名, 例: xxxxx@qq.com)", conf_key: "NoticeEmailAddress", conf_value: "" },
|
|||
|
{ conf_name: "邮箱(授权码, 例: ubbabcdefocbfce)", conf_key: "NoticeEmailPassword", conf_value: "" },
|
|||
|
{ conf_name: "关闭用户时提示语", conf_key: "CloseVisitorMessage", conf_value: "" },
|
|||
|
{ conf_name: "访客到来强提醒 (on开启;off关闭)", conf_key: "VisitorForceAlert", conf_value: "off" },
|
|||
|
{ conf_name: "访客新消息强提醒 (on开启;off关闭)", conf_key: "VisitorMessageAlert", conf_value: "off" },
|
|||
|
{ conf_name: "更换客服端新消息提示声音(音频文件路径)", conf_key: "KefuAlertSound", conf_value: "/static/images/alert2.ogg" },
|
|||
|
{ conf_name: "更换客服端新访客提示声音(音频文件路径)", conf_key: "visitorLoginSound", conf_value: "/static/images/alert.mp3" },
|
|||
|
{ conf_name: "企业公告语", conf_key: "VisitorNotice", conf_value: "" },
|
|||
|
{ conf_name: "企业签名简介", conf_key: "KefuIntroduce", conf_value: "" },
|
|||
|
{ conf_name: "常问关键词(以英文逗号,分割)", conf_key: "VisitorQaKeywords", conf_value: "" },
|
|||
|
{ conf_name: "自动欢迎 (on只弹一次;off每次都弹;默认每次都弹)", conf_key: "AutoWelcome", conf_value: "" },
|
|||
|
{ conf_name: "自动弹窗延迟时间(毫秒,比如1000是1秒)", conf_key: "AutoOpenDialogTime", conf_value: "" },
|
|||
|
{ conf_name: "第三方订单列表接口地址", conf_key: "OrdersListApi", conf_value: "" },
|
|||
|
{ conf_name: "智能机器人名称", conf_key: "RobotName", conf_value: "" },
|
|||
|
{ conf_name: "智能机器人头像", conf_key: "RobotAvator", conf_value: "" },
|
|||
|
{ conf_name: "机器人接待方式", conf_key: "RobotStatus", conf_value: "" },
|
|||
|
{ conf_name: "机器人无法回答时提示语", conf_key: "RobotNoAnswer", conf_value: "" },
|
|||
|
{ conf_name: "转接人工客服关键词(多个关键词英文逗号分割,例如:人工,转人工)", conf_key: "TurnToMan", conf_value: "" },
|
|||
|
{ conf_name: "访客自动断线时间(单位秒,默认20分钟)", conf_key: "VisitorTimeout", conf_value: "" },
|
|||
|
{ conf_name: "访客Cookie有效期(单位秒,默认不填是100年)", conf_key: "VisitorCookie", conf_value: "" },
|
|||
|
// {conf_name: "客服同时接待访客数上限(默认不限)", conf_key: "VisitorMaxNum", conf_value: ""},
|
|||
|
{ conf_name: "客服接待访客数上限文案", conf_key: "VisitorMaxNumNotice", conf_value: "" },
|
|||
|
{ conf_name: "访客端关注公众号登录功能(true开启,留空或者false 关闭)", conf_key: "ScanWechatQrcode", conf_value: "" },
|
|||
|
{ conf_name: "访客认证功能接口(访客id进行自有系统认证,填写接口地址)", conf_key: "VisitorAuthApi", conf_value: "" },
|
|||
|
{ conf_name: "客服全部离线时的提示语(留空不提示)", conf_key: "KefuOfflineNotice", conf_value: "" },
|
|||
|
{ conf_name: "企业微信客服机器人回答之前的提示语", conf_key: "QiyeWechatKefuPreRobot", conf_value: "" },
|
|||
|
{ conf_name: "JS接口Hook", conf_key: "JsHook", conf_value: "" },
|
|||
|
{ conf_name: "IFRAME接入(页面标题)", conf_key: "IframePageTitle", conf_value: "" },
|
|||
|
{ conf_name: "IFRAME接入(页面地址)", conf_key: "IframePageUrl", conf_value: "" },
|
|||
|
{ conf_name: "IFRAME接入2(页面标题)", conf_key: "IframePageTitle2", conf_value: "" },
|
|||
|
{ conf_name: "IFRAME接入2(页面地址)", conf_key: "IframePageUrl2", conf_value: "" },
|
|||
|
{ conf_name: "访客消息回调", conf_key: "VisitorMessageCallUrl", conf_value: "" },
|
|||
|
{ conf_name: "客服消息回调", conf_key: "KefuMessageCallUrl", conf_value: "" },
|
|||
|
{ conf_name: "易支付商户ID", conf_key: "Nan66Shopid", conf_value: "" },
|
|||
|
{ conf_name: "易支付API接口地址", conf_key: "Nan66Api", conf_value: "" },
|
|||
|
{ conf_name: "易支付商户密钥", conf_key: "Nan66ShopSecret", conf_value: "" },
|
|||
|
],
|
|||
|
configs: [],
|
|||
|
roleDialog: false,
|
|||
|
noticeList: [],
|
|||
|
wechatWelcomes: [],
|
|||
|
welcomeDialog: false,
|
|||
|
ipblackList: [],
|
|||
|
ipAddress: "",
|
|||
|
ipAddressName: "",
|
|||
|
welcomeForm: {
|
|||
|
content: "",
|
|||
|
keyword: "",
|
|||
|
delay_second: 3,
|
|||
|
},
|
|||
|
// roleForm:{
|
|||
|
// id:"",
|
|||
|
// name:"",
|
|||
|
// method:"",
|
|||
|
// path:"",
|
|||
|
// },
|
|||
|
statistics: {},
|
|||
|
commentStatistics: {},
|
|||
|
modifyPass: {
|
|||
|
old_pass: "",
|
|||
|
new_pass: "",
|
|||
|
confirm_new_pass: ""
|
|||
|
},
|
|||
|
modifyPassRules: {
|
|||
|
new_pass: [
|
|||
|
{ required: true, message: '密码不能为空', trigger: 'blur' },
|
|||
|
],
|
|||
|
confirm_new_pass: [
|
|||
|
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
|||
|
],
|
|||
|
},
|
|||
|
menuStoreShow: false,
|
|||
|
menuAdminShow: false,
|
|||
|
deployTitle: "",
|
|||
|
nickname: "",
|
|||
|
kefuId: "",
|
|||
|
kefuName: "",
|
|||
|
entId: "",
|
|||
|
avatarUrl: "",
|
|||
|
kefuMessages: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
kefuid: "",
|
|||
|
},
|
|||
|
visitorMessages: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
visitor_id: "",
|
|||
|
},
|
|||
|
kefuListAll: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
visitorListAll: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
visitorExtAll: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
rate: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
cateDialog: false,
|
|||
|
cateForm: {
|
|||
|
id: "",
|
|||
|
cate_name: "",
|
|||
|
is_top: 0,
|
|||
|
},
|
|||
|
article: {
|
|||
|
title: "",
|
|||
|
content: "",
|
|||
|
},
|
|||
|
visitor: {
|
|||
|
visitor_id: "",
|
|||
|
refer: "",
|
|||
|
client_ip: "",
|
|||
|
city: "",
|
|||
|
status: "",
|
|||
|
source_ip: "",
|
|||
|
created_at: "",
|
|||
|
osVersion: "",
|
|||
|
browser: "",
|
|||
|
wechat_oauth: "",
|
|||
|
},
|
|||
|
visitorExtra: [],
|
|||
|
articleCate: [],
|
|||
|
articleList: [],
|
|||
|
articleCateId: 0,
|
|||
|
articleDialog: false,
|
|||
|
kefuInfo: {},
|
|||
|
visitorAttrs: {},
|
|||
|
visitorAttrDialog: false,
|
|||
|
visitorMessageDialog: false,
|
|||
|
visitorIdMessage: "",
|
|||
|
visitorSearch: {},
|
|||
|
kefuSearch: {},
|
|||
|
kefuMessageDialog: false,
|
|||
|
welcomeWechatDialog: false,
|
|||
|
kefuIdMessage: "",
|
|||
|
allTags: [],
|
|||
|
editor: null,
|
|||
|
uploadWechatUrl: "/kefu/uploadWechatAuthFile?token=" + localStorage.getItem("token"),
|
|||
|
uploadAvatorUrl: "/kefu/uploadAvator?token=" + localStorage.getItem("token"),
|
|||
|
uploadQdrantUrl: "/kefu/collectUpload?token=" + localStorage.getItem("token"),
|
|||
|
newsList: {},
|
|||
|
newsDialog: false,
|
|||
|
newsForm: {
|
|||
|
id: "",
|
|||
|
tag: "",
|
|||
|
title: "",
|
|||
|
content: "",
|
|||
|
},
|
|||
|
logList: {},
|
|||
|
wechatServerUrl: "",
|
|||
|
wechatVisitorUrl: "",
|
|||
|
visitorUrl: "",
|
|||
|
settingCharge: {
|
|||
|
username: "",
|
|||
|
money: "",
|
|||
|
payment: "alipay",
|
|||
|
},
|
|||
|
|
|||
|
customers: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
KefuCleanBtn: KefuCleanBtn,
|
|||
|
sms: {
|
|||
|
txt: KEFU_LANG[LANG].sendSms,
|
|||
|
disable: false,
|
|||
|
count: 60,
|
|||
|
code: "",
|
|||
|
bind: false,
|
|||
|
},
|
|||
|
//访客监控列表
|
|||
|
monitorList: [],
|
|||
|
// 设置重连时间间隔(单位:毫秒)
|
|||
|
RECONNECT_INTERVAL: 1000,
|
|||
|
// 设置最大重连次数
|
|||
|
MAX_RECONNECT_TIMES: 30,
|
|||
|
reconnectTimes: 0,
|
|||
|
ws: null,
|
|||
|
//机器人客服设置
|
|||
|
robotInfo: {
|
|||
|
name: "",
|
|||
|
avator: "/static/images/robot.png",
|
|||
|
status: 1,
|
|||
|
noAnswer: "",
|
|||
|
transferKefu: "",
|
|||
|
},
|
|||
|
//固定营销话术
|
|||
|
marketing: "",
|
|||
|
//大模型相关
|
|||
|
bigModel: {
|
|||
|
name: "gpt-3.5-turbo-16k",
|
|||
|
embedding: "text-embedding-ada-002",
|
|||
|
},
|
|||
|
//openai
|
|||
|
chatGPT: {
|
|||
|
url: "",
|
|||
|
secret: "",
|
|||
|
prompt: "",
|
|||
|
system: "",
|
|||
|
thirdSearchUrl: "",
|
|||
|
qdrantStatus: "",
|
|||
|
qdrantAICollect: "",
|
|||
|
isHistory: false,
|
|||
|
historyNum: "",
|
|||
|
score: "",
|
|||
|
searchEmptyInterrupt: false,
|
|||
|
revQuestion: "",
|
|||
|
},
|
|||
|
//钉钉
|
|||
|
ding: {
|
|||
|
robotCode: "",
|
|||
|
appKey: "",
|
|||
|
appSecret: "",
|
|||
|
},
|
|||
|
//顾客相关设置
|
|||
|
consumers: {
|
|||
|
dialog: false,
|
|||
|
formRule: {
|
|||
|
realname: [
|
|||
|
{ required: true, message: '称呼不能为空', trigger: 'blur' },
|
|||
|
],
|
|||
|
consumer_sn: [
|
|||
|
{ required: true, message: '唯一ID不能为空', trigger: 'blur' },
|
|||
|
],
|
|||
|
},
|
|||
|
form: {},
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 0,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
//学习库
|
|||
|
learns: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 20,
|
|||
|
list: [],
|
|||
|
},
|
|||
|
//知识库
|
|||
|
articles: {
|
|||
|
page: 1,
|
|||
|
count: 0,
|
|||
|
pagesize: 20,
|
|||
|
list: [],
|
|||
|
orderBy: "",
|
|||
|
search: "",
|
|||
|
},
|
|||
|
keywordFinalReply: "",
|
|||
|
robotCard: "",
|
|||
|
//微信客服
|
|||
|
kefuWework: {
|
|||
|
corpid: "",
|
|||
|
encodingAESKey: "",
|
|||
|
url: "",
|
|||
|
secret: "",
|
|||
|
token: "",
|
|||
|
link: "",
|
|||
|
},
|
|||
|
kefuWeworkList: [],
|
|||
|
//企业微信
|
|||
|
wework: {
|
|||
|
webhook: "",
|
|||
|
corpid: "",
|
|||
|
agentid: "",
|
|||
|
secret: "",
|
|||
|
token: "",
|
|||
|
encodingAESKey: "",
|
|||
|
},
|
|||
|
//微信小程序
|
|||
|
wechatMini: {
|
|||
|
appid: "",
|
|||
|
appsecret: "",
|
|||
|
token: "",
|
|||
|
templateId: "",
|
|||
|
pages: "",
|
|||
|
},
|
|||
|
//微信公众号
|
|||
|
wechatOfficial: {
|
|||
|
appid: "",
|
|||
|
appsecret: "",
|
|||
|
token: "",
|
|||
|
kefuTemplateId: "",
|
|||
|
kefuTemplateColumn: "",
|
|||
|
isReply: "off",
|
|||
|
menu: "",
|
|||
|
},
|
|||
|
//易支付
|
|||
|
yiPay: {
|
|||
|
shopId: "", api: "", notifyUrl: "", shopSecret: "",
|
|||
|
},
|
|||
|
//日期选择器
|
|||
|
pickerOptions: {
|
|||
|
shortcuts: [{
|
|||
|
text: '最近一周',
|
|||
|
onClick(picker) {
|
|||
|
const end = new Date();
|
|||
|
const start = new Date();
|
|||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|||
|
end.setTime(end.getTime() + 3600 * 1000 * 24);
|
|||
|
picker.$emit('pick', [start, end]);
|
|||
|
}
|
|||
|
}, {
|
|||
|
text: '最近一个月',
|
|||
|
onClick(picker) {
|
|||
|
const end = new Date();
|
|||
|
const start = new Date();
|
|||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|||
|
end.setTime(end.getTime() + 3600 * 1000 * 24);
|
|||
|
picker.$emit('pick', [start, end]);
|
|||
|
}
|
|||
|
}, {
|
|||
|
text: '最近三个月',
|
|||
|
onClick(picker) {
|
|||
|
const end = new Date();
|
|||
|
const start = new Date();
|
|||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
|||
|
end.setTime(end.getTime() + 3600 * 1000 * 24);
|
|||
|
picker.$emit('pick', [start, end]);
|
|||
|
}
|
|||
|
}]
|
|||
|
},
|
|||
|
workTimeSetting: {
|
|||
|
workTimeStatus: "no",
|
|||
|
workDay: ['星期一', '星期二', '星期三', '星期四', '星期五'],
|
|||
|
morningWorkTime: ["2024-01-26 08:30", "2024-01-26 12:00"],
|
|||
|
afternoonWorkTime: ["2024-01-26 13:30", "2024-01-26 18:00"],
|
|||
|
otherWorkTime: "",
|
|||
|
afterWorkMessage: "非常抱歉,当前为非工作时间,请在工作时间内(周一至周五,上午[08:30-12:00],下午[13:30-18:00])与我们联系!",
|
|||
|
},
|
|||
|
workDaies: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
|
|||
|
//翻译设置
|
|||
|
fanyiSource: "",
|
|||
|
baiduFanyiAppId: "",
|
|||
|
baiduFanyiAppSec: '',
|
|||
|
baiduFanyiAuto: "",
|
|||
|
//同时接待数上限
|
|||
|
maxReceiveNum: "",
|
|||
|
},
|
|||
|
|
|||
|
methods: {
|
|||
|
|
|||
|
//跳转
|
|||
|
openUrl(url) {
|
|||
|
//window.location.href=url;
|
|||
|
this.iframeUrl = url;
|
|||
|
},
|
|||
|
//跳转
|
|||
|
openSelfUrl(url) {
|
|||
|
window.location.href = url;
|
|||
|
//this.iframeUrl=url;
|
|||
|
},
|
|||
|
//返回
|
|||
|
goBack() {
|
|||
|
window.history.back();
|
|||
|
},
|
|||
|
//初始化数据
|
|||
|
initInfo() {
|
|||
|
console.log("ACTION", ACTION);
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/kefuinfo", "get", {}, function (result) {
|
|||
|
if (result.role_id == 2) {
|
|||
|
_this.menuStoreShow = true;
|
|||
|
}
|
|||
|
if (result.role_id == 1) {
|
|||
|
_this.menuAdminShow = true;
|
|||
|
}
|
|||
|
_this.kefuInfo = result;
|
|||
|
_this.kefuId = result.name;
|
|||
|
_this.kefuName = result.name;
|
|||
|
_this.entId = result.ent_id;
|
|||
|
_this.nickname = result.nickname;
|
|||
|
_this.visitorUrl = _this.host + '/chatIndex?kefu_id=' + result.name + '&ent_id=' + result.ent_id;
|
|||
|
_this.wechatServerUrl = _this.host + '/wechat/server/' + result.ent_id + '/' + result.name;
|
|||
|
_this.wechatVisitorUrl = _this.host + '/wechatIndex?ent_id=' + result.ent_id + '&kefu_id=' + result.name;
|
|||
|
_this.connect();
|
|||
|
});
|
|||
|
if (ACTION == "extend") {
|
|||
|
this.iframeUrl = "extend_fastgpt"
|
|||
|
|
|||
|
}
|
|||
|
if (ACTION == "setting_deploy") {
|
|||
|
|
|||
|
}
|
|||
|
if (ACTION == "setting_avator") {
|
|||
|
this.sendAjax("/kefu/kefuinfo", "get", {}, function (result) {
|
|||
|
_this.kefuInfo = result;
|
|||
|
_this.avatarUrl = result.avator;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
if (ACTION == "setting_kefu_list") {
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
if (!page) page = 1;
|
|||
|
this.kefuListOwnPage(page);
|
|||
|
//let _this=this;
|
|||
|
|
|||
|
//_this.kefuListOwnPage(_this.kefuList.page)
|
|||
|
|
|||
|
this.sendAjax("/kefu/roleList", "get", {}, function (result) {
|
|||
|
_this.roleList = result;
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_user_all") {
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
if (!page) page = 1;
|
|||
|
this.kefuListAllPage(page)
|
|||
|
}
|
|||
|
if (ACTION == "setting_visitor_list") {
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
if (!page) page = 1;
|
|||
|
this.visitorListAllPage(page)
|
|||
|
this.getTags();
|
|||
|
this.getMonitorList();
|
|||
|
}
|
|||
|
if (ACTION == "roles_list") {
|
|||
|
this.sendAjax("/roles", "get", {}, function (result) {
|
|||
|
_this.roleList = result;
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_statistics") {
|
|||
|
this.checkAuth();
|
|||
|
this.sendAjax("/statistics", "get", {}, function (result) {
|
|||
|
_this.statistics = result;
|
|||
|
});
|
|||
|
this.sendAjax("/kefu/commentStatistics", "get", {}, function (result) {
|
|||
|
_this.commentStatistics = result;
|
|||
|
});
|
|||
|
|
|||
|
}
|
|||
|
if (ACTION == "setting_welcome") {
|
|||
|
this.getConfigs();
|
|||
|
this.getWelcomes();
|
|||
|
}
|
|||
|
if (ACTION == "setting_wechat") {
|
|||
|
this.getConfigs(function () {
|
|||
|
_this.getKefuWeworkConfig();
|
|||
|
});
|
|||
|
this.getKefuWeworkList();
|
|||
|
}
|
|||
|
if (ACTION == "setting_ipblack") {
|
|||
|
this.sendAjax("/system/ipblacks", "get", { page: 1, pagesize: 100000 }, function (result) {
|
|||
|
_this.ipblackList = result.list;
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_config") {
|
|||
|
this.sendAjax("/admin/configs", "get", {}, function (result) {
|
|||
|
_this.configList = result;
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_configs") {
|
|||
|
this.sendAjax("/kefu/ent_configs", "get", {}, function (result) {
|
|||
|
var temp = {};
|
|||
|
for (i in result) {
|
|||
|
temp[result[i].conf_key] = result[i];
|
|||
|
}
|
|||
|
console.log(temp);
|
|||
|
for (i in _this.entConfigList) {
|
|||
|
var value = "";
|
|||
|
if (temp[_this.entConfigList[i].conf_key]) {
|
|||
|
value = temp[_this.entConfigList[i].conf_key].conf_value;
|
|||
|
}
|
|||
|
_this.entConfigList[i].conf_value = value;
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_news") {
|
|||
|
this.getNews();
|
|||
|
}
|
|||
|
if (ACTION == "setting_kefu_message") {
|
|||
|
var id = this.getQueryVariable("id");
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
this.kefuMessages.kefuid = id;
|
|||
|
this.kefuMessagesPage(page);
|
|||
|
}
|
|||
|
if (ACTION == "setting_visitor_message") {
|
|||
|
var visitor = this.getQueryVariable("visitor");
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
this.visitorMessages.visitor_id = visitor;
|
|||
|
this.visitorMessagesPage(page);
|
|||
|
this.getVisitorInfo(visitor);
|
|||
|
this.getWechatOauth(visitor);
|
|||
|
}
|
|||
|
if (ACTION == "setting_articles") {
|
|||
|
this.getArticleCate();
|
|||
|
this.getArticle(1);
|
|||
|
this.getLearns(1);
|
|||
|
_this.getConfigs(function () {
|
|||
|
_this.keywordFinalReply = _this.getConfig("KeywordFinalReply");
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_pay_config") {
|
|||
|
_this.getConfigs(function () {
|
|||
|
_this.yiPay.shopId = _this.getConfig("Nan66Shopid");
|
|||
|
_this.yiPay.shopSecret = _this.getConfig("Nan66ShopSecret");
|
|||
|
_this.yiPay.api = _this.getConfig("Nan66Api");
|
|||
|
_this.yiPay.notifyUrl = _this.getConfig("Nan66NotifyUrl");
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_logs") {
|
|||
|
this.getLogs();
|
|||
|
}
|
|||
|
if (ACTION == "setting_robot") {
|
|||
|
this.getRobotInfo();
|
|||
|
_this.getConfigs(function () {
|
|||
|
_this.chatGPT.url = _this.getConfig("chatGPTUrl");
|
|||
|
_this.chatGPT.secret = _this.getConfig("chatGPTSecret");
|
|||
|
_this.chatGPT.prompt = _this.getConfig("chatGPTPrompt");
|
|||
|
_this.chatGPT.system = _this.getConfig("chatGPTSystem");
|
|||
|
_this.chatGPT.thirdSearchUrl = _this.getConfig("ThirdSearchUrl");
|
|||
|
_this.chatGPT.qdrantAICollect = _this.getConfig("QdrantAICollect");
|
|||
|
_this.chatGPT.qdrantStatus = _this.getConfig("QdrantAIStatus");
|
|||
|
_this.chatGPT.score = _this.getConfig("QdrantScore");
|
|||
|
_this.chatGPT.isHistory = _this.getConfig("chatGPTHistory");
|
|||
|
_this.chatGPT.historyNum = _this.getConfig("QdrantHistoryNum");
|
|||
|
_this.chatGPT.isHistory = _this.getConfig("chatGPTHistory");
|
|||
|
_this.chatGPT.searchEmptyInterrupt = _this.getConfig("SearchEmptyInterrupt");
|
|||
|
_this.chatGPT.revQuestion = _this.getConfig("chatGPTRevQuestion");
|
|||
|
_this.ding.appKey = _this.getConfig("DingAppKey");
|
|||
|
_this.ding.appSecret = _this.getConfig("DingAppSecret");
|
|||
|
_this.ding.robotCode = _this.getConfig("DingRobotCode");
|
|||
|
_this.bigModel.name = _this.getConfig("BigModelName");
|
|||
|
if (_this.getConfig("EmbeddingModelName") != "") _this.bigModel.embedding = _this.getConfig("EmbeddingModelName");
|
|||
|
_this.marketing = _this.getConfig("Marketing");
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_llm") {
|
|||
|
this.getRobotInfo();
|
|||
|
_this.getConfigs(function () {
|
|||
|
_this.chatGPT.url = _this.getConfig("chatGPTUrl");
|
|||
|
_this.chatGPT.secret = _this.getConfig("chatGPTSecret");
|
|||
|
_this.chatGPT.prompt = _this.getConfig("chatGPTPrompt");
|
|||
|
_this.chatGPT.system = _this.getConfig("chatGPTSystem");
|
|||
|
_this.chatGPT.thirdSearchUrl = _this.getConfig("ThirdSearchUrl");
|
|||
|
_this.chatGPT.qdrantAICollect = _this.getConfig("QdrantAICollect");
|
|||
|
_this.chatGPT.qdrantStatus = _this.getConfig("QdrantAIStatus");
|
|||
|
_this.chatGPT.score = _this.getConfig("QdrantScore");
|
|||
|
_this.chatGPT.isHistory = _this.getConfig("chatGPTHistory");
|
|||
|
_this.chatGPT.historyNum = _this.getConfig("QdrantHistoryNum");
|
|||
|
_this.chatGPT.isHistory = _this.getConfig("chatGPTHistory");
|
|||
|
_this.chatGPT.searchEmptyInterrupt = _this.getConfig("SearchEmptyInterrupt");
|
|||
|
_this.chatGPT.revQuestion = _this.getConfig("chatGPTRevQuestion");
|
|||
|
_this.bigModel.name = _this.getConfig("BigModelName");
|
|||
|
if (_this.getConfig("EmbeddingModelName") != "") _this.bigModel.embedding = _this.getConfig("EmbeddingModelName");
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_visitor_ext" || ACTION == "setting_service_statistic") {
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
if (!page) page = 1;
|
|||
|
this.visitorExtAllPage(page)
|
|||
|
}
|
|||
|
if (ACTION == "setting_service_statistic") {
|
|||
|
var page = this.getQueryVariable("page");
|
|||
|
if (!page) page = 1;
|
|||
|
this.ratePage(page)
|
|||
|
}
|
|||
|
if (ACTION == "setting_customer") {
|
|||
|
this.getCustomers(1);
|
|||
|
this.getConsumers(1);
|
|||
|
}
|
|||
|
if (ACTION == "setting_marketing") {
|
|||
|
this.sendAjax("/kefu/kefuList", "get", { page: 1, pagesize: 1000000, kefu_name: this.kefuSearch.name }, function (result) {
|
|||
|
var list = [];
|
|||
|
for (var i in result.list) {
|
|||
|
if (result.list[i].pid == 1) {
|
|||
|
list.push(result.list[i])
|
|||
|
}
|
|||
|
}
|
|||
|
_this.kefuList.list = list;
|
|||
|
});
|
|||
|
}
|
|||
|
if (ACTION == "setting_company") {
|
|||
|
this.getWorkTime();
|
|||
|
}
|
|||
|
},
|
|||
|
kefuMessagesPage(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefulist_message", "get", { id: this.kefuMessages.kefuid, page: page, pagesize: 30 }, function (result) {
|
|||
|
var list = result.list;
|
|||
|
_this.kefuMessages.count = result.count;
|
|||
|
for (var i in list) {
|
|||
|
list[i].content = replaceSpecialTag(list[i].content);
|
|||
|
}
|
|||
|
list.sort(function (a, b) {
|
|||
|
return a.id - b.id;
|
|||
|
});
|
|||
|
_this.kefuMessages.list = list;
|
|||
|
_this.kefuMessages.page = result.page;
|
|||
|
_this.kefuMessages.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
visitorMessagesPage(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/visitorlist_message", "get", { visitor_id: this.visitorMessages.visitor_id, page: page }, function (result) {
|
|||
|
var list = result.list;
|
|||
|
for (var i in list) {
|
|||
|
// var visitorAvator=result.list[i].visitor_avator;
|
|||
|
// var kefuAvator=result.list[i].kefu_avator;
|
|||
|
// var visitorName=result.list[i].visitor_name;
|
|||
|
// var kefuName=result.list[i].kefu_name;
|
|||
|
// if(result.list[i].mes_type=='visitor'){
|
|||
|
// result.list[i].kefu_avator=visitorAvator;
|
|||
|
// result.list[i].kefu_name=visitorName;
|
|||
|
// result.list[i].visitor_name=kefuName;
|
|||
|
// result.list[i].visitor_avator=kefuAvator;
|
|||
|
// }
|
|||
|
list[i].content = replaceContent(list[i].content);
|
|||
|
}
|
|||
|
list.sort(function (a, b) {
|
|||
|
return a.id - b.id;
|
|||
|
});
|
|||
|
_this.visitorMessages.list = list;
|
|||
|
_this.visitorMessages.count = result.count;
|
|||
|
_this.visitorMessages.page = result.page;
|
|||
|
_this.visitorMessages.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
kefuListAllPage(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefulist?page=" + page, "get", {}, function (result) {
|
|||
|
_this.kefuListAll.list = result.list;
|
|||
|
_this.kefuListAll.count = result.count;
|
|||
|
_this.kefuListAll.page = result.page;
|
|||
|
_this.kefuListAll.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
kefuListOwnPage(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/kefuList", "get", {
|
|||
|
page: page,
|
|||
|
pagesize: 20,
|
|||
|
kefu_name: this.kefuSearch.name,
|
|||
|
email: this.kefuSearch.email,
|
|||
|
tel: this.kefuSearch.tel,
|
|||
|
}, function (result) {
|
|||
|
for (var i in result.list) {
|
|||
|
result.list[i].updated_at = dateFormat("YYYY-mm-dd HH:MM:SS", new Date(result.list[i].updated_at));
|
|||
|
result.list[i].created_at = dateFormat("YYYY-mm-dd HH:MM:SS", new Date(result.list[i].created_at));
|
|||
|
if (result.list[i].status == 0) {
|
|||
|
result.list[i].status = true;
|
|||
|
} else {
|
|||
|
result.list[i].status = false;
|
|||
|
}
|
|||
|
}
|
|||
|
_this.kefuList.list = result.list;
|
|||
|
_this.kefuList.count = result.count;
|
|||
|
_this.kefuList.page = result.page;
|
|||
|
_this.kefuList.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
visitorListAllPage(page) {
|
|||
|
var _this = this;
|
|||
|
var parames = {
|
|||
|
orderBy: "created_at", pagesize: 15, visitorMessage: this.visitorSearch.message, visitorName: this.visitorSearch.name,
|
|||
|
visitorTag: this.visitorSearch.tag,
|
|||
|
};
|
|||
|
if (this.visitorSearch.updateTime) {
|
|||
|
parames.updateTime = this.visitorSearch.updateTime.join("~");
|
|||
|
}
|
|||
|
if (this.visitorSearch.createTime) {
|
|||
|
parames.createTime = this.visitorSearch.createTime.join("~");
|
|||
|
}
|
|||
|
this.sendAjax("/kefu/visitorList?page=" + page, "get", parames, function (result) {
|
|||
|
for (var i in result.list) {
|
|||
|
result.list[i].updated_at = dateFormat("YYYY-mm-dd HH:MM:SS", new Date(result.list[i].updated_at));
|
|||
|
result.list[i].created_at = dateFormat("YYYY-mm-dd HH:MM:SS", new Date(result.list[i].created_at));
|
|||
|
result.list[i].last_message = replaceSpecialTag(result.list[i].last_message);
|
|||
|
}
|
|||
|
_this.visitorListAll.list = result.list;
|
|||
|
_this.visitorListAll.count = result.count;
|
|||
|
_this.visitorListAll.page = result.page;
|
|||
|
_this.visitorListAll.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
//访客来源
|
|||
|
visitorExtAllPage(page) {
|
|||
|
var _this = this;
|
|||
|
var parames = {
|
|||
|
pagesize: 15,
|
|||
|
page: page,
|
|||
|
title: this.kefuSearch.title,
|
|||
|
refer_title: this.kefuSearch.refer_title,
|
|||
|
};
|
|||
|
this.sendAjax("/kefu/visitorExtList", "get", parames, function (result) {
|
|||
|
_this.visitorExtAll.list = result.list;
|
|||
|
_this.visitorExtAll.count = result.count;
|
|||
|
_this.visitorExtAll.page = result.page;
|
|||
|
_this.visitorExtAll.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
//评价列表
|
|||
|
ratePage(page) {
|
|||
|
var _this = this;
|
|||
|
var parames = { pagesize: 15, page: page };
|
|||
|
this.sendAjax("/kefu/rateList", "get", parames, function (result) {
|
|||
|
_this.rate.list = result.list;
|
|||
|
_this.rate.count = result.count;
|
|||
|
_this.rate.page = result.page;
|
|||
|
_this.rate.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
sendAjax(url, method, params, callback) {
|
|||
|
let _this = this;
|
|||
|
$.ajax({
|
|||
|
type: method,
|
|||
|
url: url,
|
|||
|
data: params,
|
|||
|
headers: {
|
|||
|
"token": localStorage.getItem("token")
|
|||
|
},
|
|||
|
error: function (res) {
|
|||
|
_this.$message({
|
|||
|
message: res.responseText,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
},
|
|||
|
success: function (data) {
|
|||
|
_this.fullscreenLoading = false
|
|||
|
if (data.code == 200 || data.code == 20000) {
|
|||
|
if (data.result != null) {
|
|||
|
callback(data.result);
|
|||
|
} else {
|
|||
|
callback(data);
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
_this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//添加客服的dialog
|
|||
|
addKefu() {
|
|||
|
this.kefuForm = {
|
|||
|
id: "",
|
|||
|
name: "",
|
|||
|
password: "",
|
|||
|
avator: "",
|
|||
|
};
|
|||
|
this.kefuDialog = true;
|
|||
|
},
|
|||
|
//添加分类的dialog
|
|||
|
addCate() {
|
|||
|
this.cateForm = {
|
|||
|
id: "",
|
|||
|
cate_name: "",
|
|||
|
is_top: 0,
|
|||
|
};
|
|||
|
this.cateDialog = true;
|
|||
|
},
|
|||
|
//提交客服表单
|
|||
|
submitKefuForm(formName) {
|
|||
|
let _this = this;
|
|||
|
this.$refs[formName].validate((valid) => {
|
|||
|
if (valid) {
|
|||
|
this.sendAjax("/kefu/kefuInfo", "POST", _this.kefuForm, function (result) {
|
|||
|
_this.kefuDialog = false;
|
|||
|
_this.kefuListOwnPage(_this.kefuList.page);
|
|||
|
});
|
|||
|
} else {
|
|||
|
return false;
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
switchUserStatus: function (status, id) {
|
|||
|
if (status) {
|
|||
|
status = 0;
|
|||
|
} else {
|
|||
|
status = 1;
|
|||
|
}
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/kefuStatus", "POST", { status: status, id: id }, function (result) {
|
|||
|
//_this.kefuListOwnPage(_this.kefuList.page);
|
|||
|
});
|
|||
|
},
|
|||
|
//获取新闻
|
|||
|
getNews(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/other/news", "get", { page: page, pagesize: 20 }, function (result) {
|
|||
|
_this.newsList = result;
|
|||
|
});
|
|||
|
},
|
|||
|
//获取日子列表
|
|||
|
getLogs(page) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/logs", "get", { page: page, pagesize: 20 }, function (result) {
|
|||
|
_this.logList = result;
|
|||
|
});
|
|||
|
},
|
|||
|
//提交表单
|
|||
|
saveNews(formName) {
|
|||
|
let _this = this;
|
|||
|
this.newsForm.content = this.editor.txt.html();
|
|||
|
this.sendAjax("/system/saveNews", "POST", _this.newsForm, function (result) {
|
|||
|
_this.newsDialog = false;
|
|||
|
_this.getNews();
|
|||
|
});
|
|||
|
},
|
|||
|
//删除访客聊天记录
|
|||
|
deleteNews(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除内容, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/system/delNews", "get", { id: id }, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: result.msg
|
|||
|
});
|
|||
|
_this.getNews();
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//提交欢迎表单
|
|||
|
submitWelcomeForm(formName, isWechat) {
|
|||
|
let _this = this;
|
|||
|
if (!isWechat) {
|
|||
|
_this.welcomeForm.content = this.editor.txt.html();
|
|||
|
}
|
|||
|
this.sendAjax("/kefu/notice", "POST", _this.welcomeForm, function (result) {
|
|||
|
_this.welcomeDialog = false;
|
|||
|
_this.welcomeWechatDialog = false;
|
|||
|
_this.getWelcomes();
|
|||
|
});
|
|||
|
},
|
|||
|
//获取客服
|
|||
|
getKefu(kefuId) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/kefuSetting", "GET", { kefu_id: kefuId }, function (result) {
|
|||
|
_this.kefuDialog = true;
|
|||
|
_this.kefuForm = result.user;
|
|||
|
_this.kefuSetting = result.settings;
|
|||
|
_this.maxReceiveNum = _this.getConfigByAdmin("VisitorMaxNum");
|
|||
|
_this.kefuForm.password = "";
|
|||
|
});
|
|||
|
},
|
|||
|
//删除客服
|
|||
|
deleteKefu(kefuId) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除该用户, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/kefuInfo?id=" + kefuId, "DELETE", { id: kefuId }, function (result) {
|
|||
|
_this.kefuDialog = false;
|
|||
|
_this.kefuListOwnPage(_this.kefuList.page);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//删除访客
|
|||
|
deleteVisitor(visitorId) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除访客, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
this.sendAjax("/kefu/delVisitor?visitor_id=" + visitorId, "DELETE", {}, function (result) {
|
|||
|
var page = _this.visitorListAll.page;
|
|||
|
if (!page) page = 1;
|
|||
|
_this.visitorListAllPage(page);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//删除访客聊天记录
|
|||
|
deleteVisitorMessage(visitorId) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将清除访客所有记录, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/delVisitorMessage", "get", { visitor_id: visitorId }, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: '删除成功!'
|
|||
|
});
|
|||
|
var page = _this.visitorListAll.page;
|
|||
|
if (!page) page = 1;
|
|||
|
_this.visitorListAllPage(page);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//获取欢迎
|
|||
|
getWelcomes() {
|
|||
|
var _this = this;
|
|||
|
_this.noticeList = [];
|
|||
|
_this.wechatWelcomes = [];
|
|||
|
this.sendAjax("/kefu/notices", "get", {}, function (result) {
|
|||
|
for (var key in result) {
|
|||
|
if (result[key]['keyword'] == "welcome") {
|
|||
|
_this.noticeList.push(result[key]);
|
|||
|
}
|
|||
|
if (result[key]['keyword'] == "wechat") {
|
|||
|
_this.wechatWelcomes.push(result[key]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
},
|
|||
|
//删除欢迎
|
|||
|
deleteWelcome(id) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/notice?id=" + id, "DELETE", { id: id }, function (result) {
|
|||
|
_this.getWelcomes();
|
|||
|
});
|
|||
|
},
|
|||
|
//删除ip
|
|||
|
deleteIpblack(ip) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/ipblack?ip=" + ip, "DELETE", { ip: ip }, function (result) {
|
|||
|
_this.sendAjax("/system/ipblacks", "get", { page: 1, pagesize: 100000 }, function (result) {
|
|||
|
_this.ipblackList = result.list;
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
// //配置角色权限
|
|||
|
// showAuthDialog(id,name,method,path){
|
|||
|
// this.roleForm.id=id
|
|||
|
// this.roleForm.name=name
|
|||
|
// this.roleForm.method=method
|
|||
|
// this.roleForm.path=path
|
|||
|
// this.roleDialog=true;
|
|||
|
// },
|
|||
|
//设置配置项
|
|||
|
setConfigItem(key, value) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/admin/config", "POST", { key: key, value: value }, function (result) {
|
|||
|
_this.sendAjax("/admin/configs", "get", {}, function (result) {
|
|||
|
_this.configList = result;
|
|||
|
});
|
|||
|
_this.$message({
|
|||
|
message: "更新成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//设置配置项
|
|||
|
setEntConfigItem(name, key, value) {
|
|||
|
let _this = this;
|
|||
|
this.$confirm('此操作修改配置, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/entConfigs", "POST", { name: name, key: key, value: value }, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
_this.setConfig(key, value);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//设置配置项
|
|||
|
setEntConfigItemByAdmin(entId, name, key, value) {
|
|||
|
let _this = this;
|
|||
|
this.$confirm('此操作修改配置, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/system/entConfigs", "POST", { ent_id: entId, name: name, key: key, value: value }, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//设置配置项
|
|||
|
setWelcomeItem(id, content, delay_second) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/updateNotice", "POST", { id: id, content: content, delay_second: delay_second }, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "更新成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
// //提交角色表单
|
|||
|
// submitRoleForm(formName){
|
|||
|
// let _this=this;
|
|||
|
// this.$refs[formName].validate((valid) => {
|
|||
|
// if (valid) {
|
|||
|
// this.sendAjax("/role","POST",_this.roleForm,function(result){
|
|||
|
// _this.roleDialog=false;
|
|||
|
// _this.sendAjax("/roles","get",{},function(result){
|
|||
|
// _this.roleList=result;
|
|||
|
// });
|
|||
|
// _this.$message({
|
|||
|
// message: result.msg,
|
|||
|
// type: 'success'
|
|||
|
// });
|
|||
|
// });
|
|||
|
// } else {
|
|||
|
// return false;
|
|||
|
// }
|
|||
|
// });
|
|||
|
// },
|
|||
|
// //提交首页表单
|
|||
|
// setPageIndex(){
|
|||
|
// let _this=this;
|
|||
|
// this.sendAjax("/about","POST",this.pageindex,function(result){
|
|||
|
// _this.$message({
|
|||
|
// message: "编辑成功",
|
|||
|
// type: 'success'
|
|||
|
// });
|
|||
|
// });
|
|||
|
// },
|
|||
|
//修改密码
|
|||
|
setModifyPass() {
|
|||
|
let _this = this;
|
|||
|
this.$refs['modifyPassForm'].validate((valid) => {
|
|||
|
if (!valid) {
|
|||
|
return false;
|
|||
|
} else {
|
|||
|
this.sendAjax("/kefu/modifypass", "POST", _this.modifyPass, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
_this.modifyPass.new_pass = _this.modifyPass.old_pass = _this.modifyPass.confirm_new_pass = ""
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//修改密码
|
|||
|
setModifyAvatar() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/modifyavator", "POST", { avator: _this.avatarUrl }, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//修改商户资料
|
|||
|
modifyKefuInfo() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/modifyUser", "POST",
|
|||
|
{
|
|||
|
avator: _this.kefuInfo.avator,
|
|||
|
nickname: _this.kefuInfo.nickname,
|
|||
|
company_pic: _this.kefuInfo.company_pic
|
|||
|
}, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
_this.sendAjax("/kefu/kefuinfo", "get", {}, function (result) {
|
|||
|
_this.kefuInfo = result;
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
handleAvatarSuccess(res, file) {
|
|||
|
var _this = this;
|
|||
|
console.log(res, file);
|
|||
|
if (res.code != 200) {
|
|||
|
_this.$message({
|
|||
|
message: res.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
this.kefuInfo.avator = res.result.path;
|
|||
|
},
|
|||
|
handleRobotAvatarSuccess(res, file) {
|
|||
|
var _this = this;
|
|||
|
console.log(res, file);
|
|||
|
if (res.code != 200) {
|
|||
|
_this.$message({
|
|||
|
message: res.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
this.robotInfo.avator = res.result.path;
|
|||
|
},
|
|||
|
beforeAvatarUpload(file) {
|
|||
|
var isLt2M = file.size / 1024 / 1024 < 1;
|
|||
|
if (!isLt2M) {
|
|||
|
this.$message.error('上传头像图片大小不能超过 1MB!');
|
|||
|
}
|
|||
|
return isLt2M;
|
|||
|
},
|
|||
|
handleCompanyPicSuccess(res, file) {
|
|||
|
var _this = this;
|
|||
|
console.log(res, file);
|
|||
|
if (res.code != 200) {
|
|||
|
_this.$message({
|
|||
|
message: res.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
this.kefuInfo.company_pic = getImageUrl(res.result.path, getBaseUrl());
|
|||
|
},
|
|||
|
checkAuth() {
|
|||
|
let _this = this;
|
|||
|
$.ajax({
|
|||
|
type: "post",
|
|||
|
url: "/check_auth",
|
|||
|
headers: {
|
|||
|
"token": localStorage.getItem("token")
|
|||
|
},
|
|||
|
success: function (data) {
|
|||
|
if (data.code != 200) {
|
|||
|
window.location.href = "/ironMan/signInx";
|
|||
|
} else {
|
|||
|
_this.adminAvator = data.result.avator;
|
|||
|
_this.adminRole = data.result.nick_name + "-" + data.result.role_name;
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//获取知识库分类
|
|||
|
getArticleCate() {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/ent/article_cate", "get", {}, function (result) {
|
|||
|
_this.articleCate = result;
|
|||
|
});
|
|||
|
},
|
|||
|
setArticleCate(row) {
|
|||
|
this.articleCateId = row.id;
|
|||
|
this.getArticle(1);
|
|||
|
},
|
|||
|
//排序知识库
|
|||
|
getSortArticle(column) {
|
|||
|
console.log(1111);
|
|||
|
let prop = column.prop;
|
|||
|
let order = column.order == "ascending" ? "asc" : "desc";
|
|||
|
this.articles.prop = prop;
|
|||
|
this.articles.order = order;
|
|||
|
this.getArticle(1);
|
|||
|
},
|
|||
|
//获取知识库
|
|||
|
getArticle(page) {
|
|||
|
var _this = this;
|
|||
|
var params = {};
|
|||
|
params = {
|
|||
|
pagesize: this.articles.pagesize,
|
|||
|
page: page,
|
|||
|
prop: this.articles.prop,
|
|||
|
order: this.articles.order,
|
|||
|
};
|
|||
|
if (this.articleCateId != 0) {
|
|||
|
params.cat_id = this.articleCateId;
|
|||
|
}
|
|||
|
this.sendAjax("/ent/article_list", "get", params, function (result) {
|
|||
|
// result.list=foreachArray(result.list,function(row){
|
|||
|
// row['title']=splitString(row["title"],",,");
|
|||
|
// return row;
|
|||
|
// });
|
|||
|
_this.articles.list = result.list;
|
|||
|
_this.articles.count = result.count;
|
|||
|
_this.articles.pagesize = result.pagesize;
|
|||
|
//_this.articleList=result;
|
|||
|
});
|
|||
|
},
|
|||
|
//导出知识库excel
|
|||
|
getArticleExcel() {
|
|||
|
this.listLoading = this.$loading({
|
|||
|
lock: true,
|
|||
|
text: "正在导出excel",
|
|||
|
});
|
|||
|
var _this = this;
|
|||
|
var params = {};
|
|||
|
params = {
|
|||
|
pagesize: 5000,
|
|||
|
page: 1,
|
|||
|
prop: this.articles.prop,
|
|||
|
order: this.articles.order,
|
|||
|
};
|
|||
|
if (this.articleCateId != 0) {
|
|||
|
params.cat_id = this.articleCateId;
|
|||
|
}
|
|||
|
this.sendAjax("/ent/article_list", "get", params, function (result) {
|
|||
|
let ret = result.list
|
|||
|
if (ret) {
|
|||
|
let data = [['关键词', '回复内容']];
|
|||
|
for (let i in ret) {
|
|||
|
data.push([ret[i].title, ret[i].content]);
|
|||
|
}
|
|||
|
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
|||
|
const workbook = XLSX.utils.book_new();
|
|||
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
|||
|
XLSX.writeFile(workbook, '自动回复.xlsx');
|
|||
|
_this.listLoading.close();
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//
|
|||
|
splitString(str, split) {
|
|||
|
return splitString(str, split);
|
|||
|
},
|
|||
|
//获取营销会员
|
|||
|
getCustomers(page) {
|
|||
|
var _this = this;
|
|||
|
var params = {};
|
|||
|
params = { pagesize: 10, page: page };
|
|||
|
this.sendAjax("/kefu/customerList", "get", params, function (result) {
|
|||
|
_this.customers = result;
|
|||
|
});
|
|||
|
},
|
|||
|
//删除知识库分类
|
|||
|
delArticleCate(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除本分类所有回复, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
var params = { id: id };
|
|||
|
_this.sendAjax("/kefu/delArticleCate", "get", params, function (result) {
|
|||
|
_this.getArticleCate();
|
|||
|
_this.getArticle(1);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//置顶或取消置顶
|
|||
|
setArticleCateTop(id, isTop) {
|
|||
|
var _this = this;
|
|||
|
var params = { id: id, is_top: isTop };
|
|||
|
_this.sendAjax("/kefu/articleCateTop", "get", params, function (result) {
|
|||
|
_this.getArticleCate();
|
|||
|
_this.getArticle(1);
|
|||
|
});
|
|||
|
},
|
|||
|
//删除知识库
|
|||
|
delArticle(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除关键词回复, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
var params = { id: id };
|
|||
|
this.sendAjax("/kefu/delArticle", "get", params, function (result) {
|
|||
|
_this.getArticle(1);
|
|||
|
});
|
|||
|
});
|
|||
|
|
|||
|
},
|
|||
|
//增加知识库分类
|
|||
|
addArticleCate() {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/addArticleCate", "POST", { id: this.cateForm.id, name: this.cateForm.cat_name }, function (data) {
|
|||
|
_this.cateDialog = false;
|
|||
|
_this.getArticleCate();
|
|||
|
});
|
|||
|
},
|
|||
|
//增加文章
|
|||
|
addArticle() {
|
|||
|
var _this = this;
|
|||
|
if (Array.isArray(this.article.title)) {
|
|||
|
this.article.title = this.article.title.join(",");
|
|||
|
} else {
|
|||
|
this.article.title = this.article.title.replace(",", ",");
|
|||
|
}
|
|||
|
if (!this.article.cat_id) {
|
|||
|
this.$message({
|
|||
|
message: "请先创建并选择分类!",
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
this.article.title = trim(this.article.title, ",");
|
|||
|
this.article.content = this.editor.txt.html();
|
|||
|
this.sendAjax("/kefu/addArticle", "POST", this.article, function (data) {
|
|||
|
_this.articleDialog = false;
|
|||
|
if (!_this.article.id) _this.getArticle(1);
|
|||
|
_this.article = {};
|
|||
|
});
|
|||
|
},
|
|||
|
//访客搜索
|
|||
|
searchVisitor() {
|
|||
|
var _this = this;
|
|||
|
_this.visitorListAll.page = 1;
|
|||
|
var parames = {
|
|||
|
pagesize: 15, visitorMessage: this.visitorSearch.message, visitorName: this.visitorSearch.name,
|
|||
|
visitorTag: this.visitorSearch.tag
|
|||
|
};
|
|||
|
if (this.visitorSearch.updateTime) {
|
|||
|
parames.updateTime = this.visitorSearch.updateTime.join("~");
|
|||
|
}
|
|||
|
if (this.visitorSearch.createTime) {
|
|||
|
parames.createTime = this.visitorSearch.createTime.join("~");
|
|||
|
}
|
|||
|
this.sendAjax("/kefu/visitorList?page=" + _this.visitorListAll.page, "get", parames, function (result) {
|
|||
|
_this.visitorListAll.list = result.list;
|
|||
|
_this.visitorListAll.count = result.count;
|
|||
|
_this.visitorListAll.page = result.page;
|
|||
|
_this.visitorListAll.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
//获取所有标签
|
|||
|
getTags() {
|
|||
|
var _this = this;
|
|||
|
sendAjax("/kefu/tags", "GET", {
|
|||
|
}, function (data) {
|
|||
|
_this.allTags = data.result;
|
|||
|
})
|
|||
|
},
|
|||
|
GetRequest() {
|
|||
|
var str = location.href
|
|||
|
var num = str.indexOf("#");
|
|||
|
if (num < 0) {
|
|||
|
return "";
|
|||
|
}
|
|||
|
str = str.substr(num + 1);
|
|||
|
return str;
|
|||
|
},
|
|||
|
getQueryVariable(variable) {
|
|||
|
var query = window.location.search.substring(1);
|
|||
|
var vars = query.split("&");
|
|||
|
for (var i = 0; i < vars.length; i++) {
|
|||
|
var pair = vars[i].split("=");
|
|||
|
if (pair[0] == variable) { return pair[1]; }
|
|||
|
}
|
|||
|
return (false);
|
|||
|
},
|
|||
|
//修改密码
|
|||
|
getVisitorAttr(visitorId) {
|
|||
|
var _this = this;
|
|||
|
_this.visitorAttrDialog = true;
|
|||
|
this.sendAjax("/kefu/visitor_attr", "get", { visitor_id: visitorId }, function (result) {
|
|||
|
_this.visitorAttrs = result;
|
|||
|
});
|
|||
|
},
|
|||
|
switchLang(command) {
|
|||
|
setLocalStorage("lang", command);
|
|||
|
document.location.reload();
|
|||
|
},
|
|||
|
//复制文本
|
|||
|
copyText(text) {
|
|||
|
copyText(text);
|
|||
|
this.$message({
|
|||
|
message: "ok",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
},
|
|||
|
destoryEditor() {
|
|||
|
this.welcomeForm.content = "";
|
|||
|
this.welcomeForm.id = "";
|
|||
|
this.welcomeForm.keyword = "";
|
|||
|
this.newForm = {};
|
|||
|
if (!this.editor) {
|
|||
|
return;
|
|||
|
}
|
|||
|
this.editor.destroy();
|
|||
|
this.editor = null;
|
|||
|
},
|
|||
|
initEditor(idName) {
|
|||
|
if (!idName) idName = "#welcomeEditor";
|
|||
|
const E = window.wangEditor
|
|||
|
this.editor = new E(idName);
|
|||
|
// 配置 server 接口地址
|
|||
|
this.editor.config.uploadImgServer = '/kefu/editorUploadImg?token=' + localStorage.getItem("token");
|
|||
|
this.editor.config.height = 240;
|
|||
|
this.editor.config.uploadImgMaxSize = 1 * 1024 * 1024; // 1M
|
|||
|
this.editor.config.uploadFileName = 'imgfile';
|
|||
|
this.editor.config.uploadImgHooks = {
|
|||
|
// 图片上传并返回了结果,图片插入已成功
|
|||
|
success: function (xhr) {
|
|||
|
console.log('success', xhr)
|
|||
|
},
|
|||
|
// 图片上传并返回了结果,但图片插入时出错了
|
|||
|
fail: function (xhr, editor, resData) {
|
|||
|
console.log('fail', resData)
|
|||
|
},
|
|||
|
// 上传图片出错,一般为 http 请求的错误
|
|||
|
error: function (xhr, editor, resData) {
|
|||
|
console.log('error', xhr, resData)
|
|||
|
},
|
|||
|
// 上传图片超时
|
|||
|
timeout: function (xhr) {
|
|||
|
console.log('timeout')
|
|||
|
},
|
|||
|
// 图片上传并返回了结果,想要自己把图片插入到编辑器中
|
|||
|
// 例如服务器端返回的不是 { errno: 0, data: [...] } 这种格式,可使用 customInsert
|
|||
|
customInsert: function (insertImgFn, result) {
|
|||
|
// result 即服务端返回的接口
|
|||
|
console.log('customInsert', result);
|
|||
|
insertImgFn(getImageUrl(result.data.url, getBaseUrl()));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
let isHTML = false;
|
|||
|
|
|||
|
const { BtnMenu } = E
|
|||
|
class htmlMenu extends BtnMenu {
|
|||
|
constructor(editor) {
|
|||
|
const $elem = E.$(
|
|||
|
`<div class="w-e-menu" style="font-size: 12px">HTML</div>`
|
|||
|
)
|
|||
|
super($elem, editor)
|
|||
|
}
|
|||
|
clickHandler() {
|
|||
|
let source = this.editor.txt.html();
|
|||
|
if (source) {
|
|||
|
isHTML = !isHTML;
|
|||
|
}
|
|||
|
if (isHTML) {
|
|||
|
source = source.replace(/</g, "<").replace(/>/g, ">").replace(/ /g, " ");
|
|||
|
} else {
|
|||
|
source = this.editor.txt.text().replace(/</ig, "<").replace(/>/ig, ">").replace(/ /ig, " ")
|
|||
|
}
|
|||
|
this.editor.txt.html(source);
|
|||
|
this.tryChangeActive();
|
|||
|
// console.log(source);
|
|||
|
}
|
|||
|
tryChangeActive() {
|
|||
|
if (isHTML) {
|
|||
|
this.active()
|
|||
|
} else {
|
|||
|
this.unActive()
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// 注册菜单
|
|||
|
const menuKey = 'htmlMenuKey' // 菜单 key ,各个菜单不能重复
|
|||
|
this.editor.menus.extend('htmlMenuKey', htmlMenu)
|
|||
|
|
|||
|
// 将菜单加入到 editor.config.menus 中
|
|||
|
// 也可以通过配置 menus 调整菜单的顺序,参考【配置菜单】部分的文档
|
|||
|
this.editor.config.menus = this.editor.config.menus.concat(menuKey)
|
|||
|
|
|||
|
//editor.create()
|
|||
|
// this.editor.config.menus = [
|
|||
|
// 'head',
|
|||
|
// 'bold',
|
|||
|
// 'fontSize',
|
|||
|
// 'fontName',
|
|||
|
// 'italic',
|
|||
|
// 'underline',
|
|||
|
// 'strikeThrough',
|
|||
|
// 'indent',
|
|||
|
// 'lineHeight',
|
|||
|
// 'foreColor',
|
|||
|
// 'backColor',
|
|||
|
// 'link',
|
|||
|
// 'justify',
|
|||
|
// 'emoticon',
|
|||
|
// 'table',
|
|||
|
// 'splitLine',
|
|||
|
// 'undo',
|
|||
|
// 'redo',
|
|||
|
// ]
|
|||
|
this.editor.create();
|
|||
|
},
|
|||
|
//上传授权文件后的回调
|
|||
|
uploadWechatAuthfileCallback: function (response, file, fileList) {
|
|||
|
if (response.code != 200) {
|
|||
|
this.$message({
|
|||
|
message: response.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
this.$message({
|
|||
|
message: response.msg,
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
for (var i in this.entConfigList) {
|
|||
|
if (this.entConfigList[i].conf_key == "WechatAuthFile") {
|
|||
|
this.entConfigList[i].conf_value = response.result.path;
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
//获取访客信息
|
|||
|
getVisitorInfo(visitor_id) {
|
|||
|
var _this = this;
|
|||
|
$.ajax({
|
|||
|
type: "get",
|
|||
|
url: "/kefu/visitor",
|
|||
|
data: { visitorId: visitor_id },
|
|||
|
headers: {
|
|||
|
"token": localStorage.getItem("token")
|
|||
|
},
|
|||
|
success: function (data) {
|
|||
|
if (data.result != null) {
|
|||
|
let r = data.result;
|
|||
|
_this.visitor.visitor_id = r.visitor_id;
|
|||
|
_this.visitor.source_ip = r.source_ip;
|
|||
|
_this.visitor.created_at = data.create_time;
|
|||
|
_this.visitor.updated_at = data.last_time;
|
|||
|
_this.visitor.osVersion = data.os_version;
|
|||
|
_this.visitor.browser = data.browser;
|
|||
|
_this.visitor.city = r.city;
|
|||
|
if (r.refer != "") {
|
|||
|
_this.visitor.refer = r.refer
|
|||
|
} else {
|
|||
|
_this.visitor.refer = "-";
|
|||
|
}
|
|||
|
|
|||
|
//_this.visitor.visitor_id=r.visitor_id;
|
|||
|
_this.chatTitle = "#" + r.id + "|" + r.name;
|
|||
|
_this.chatTitleType = "success";
|
|||
|
_this.visitorExtra = [];
|
|||
|
if (r.extra != "") {
|
|||
|
var extra = JSON.parse(b64ToUtf8(r.extra));
|
|||
|
if (typeof extra == "string") {
|
|||
|
extra = JSON.parse(extra);
|
|||
|
}
|
|||
|
for (var key in extra) {
|
|||
|
if (extra[key] == "") {
|
|||
|
extra[key] = "无";
|
|||
|
}
|
|||
|
if (key == "visitorAvatar" || key == "visitorName" || key == "visitorProduct") continue;
|
|||
|
var temp = { key: key, val: extra[key] }
|
|||
|
_this.visitorExtra.push(temp);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
if (data.code != 200) {
|
|||
|
_this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
},
|
|||
|
//获取访客信息
|
|||
|
getWechatOauth(visitor_id) {
|
|||
|
var _this = this;
|
|||
|
$.ajax({
|
|||
|
type: "get",
|
|||
|
url: "/wechat/oauth",
|
|||
|
data: { visitor_id: visitor_id },
|
|||
|
headers: {
|
|||
|
"token": localStorage.getItem("token")
|
|||
|
},
|
|||
|
success: function (data) {
|
|||
|
if (data.code == 400) {
|
|||
|
_this.visitor.wechat_oauth = "未绑定"
|
|||
|
} else {
|
|||
|
_this.visitor.wechat_oauth = "已绑定"
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//关闭服务
|
|||
|
stopServer() {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/system/stop", "get", {}, function (res) {
|
|||
|
_this.$message({
|
|||
|
message: "服务在守护模式下会重启,非守护则直接关闭",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//更新过期时间
|
|||
|
updateUserExpired(kefuName, expiredTime) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/kefuExpiredTime", "POST", { name: kefuName, expired_time: expiredTime }, function (result) {
|
|||
|
_this.kefuListOwnPage(_this.kefuList.page);
|
|||
|
});
|
|||
|
},
|
|||
|
//删除访客聊天记录
|
|||
|
delThisTag(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除tag, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/delThisTag", "get", { tag_id: id }, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: result.msg
|
|||
|
});
|
|||
|
_this.getTags();
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//删除营销会员
|
|||
|
deleteCustomer(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除会员, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/deleteCustomer", "get", { id: id }, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: result.msg
|
|||
|
});
|
|||
|
_this.getCustomers(_this.customers.page);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//导出访客记录
|
|||
|
exportVisitorMessage(visitorId) {
|
|||
|
window.open("/kefu/exportVisitorMessage?token=" + localStorage.getItem("token") + "&visitor_id=" + visitorId)
|
|||
|
},
|
|||
|
//充值
|
|||
|
userCharge(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将为用户充值, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
var data = {
|
|||
|
"kefu_name": _this.settingCharge.username,
|
|||
|
"money": _this.settingCharge.money,
|
|||
|
"payment": _this.settingCharge.payment,
|
|||
|
}
|
|||
|
_this.sendAjax("/system/userCharge", "post", data, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: result.msg
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//生成永久带参二维码
|
|||
|
userWeixinMarketing(kefuName) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将为用户生成永久带参二维码, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
if (!kefuName) {
|
|||
|
kefuName = _this.settingCharge.username;
|
|||
|
}
|
|||
|
var data = {
|
|||
|
"kefu_name": kefuName
|
|||
|
}
|
|||
|
_this.sendAjax("/admin/userMarketingQrcode", "post", data, function (result) {
|
|||
|
var avator = result.logo;
|
|||
|
var html = `
|
|||
|
<div style="width:390px;height: 390px;position: relative">
|
|||
|
<img src="`+ result.url + `" style="width:390px;height: 390px;position: absolute;top: 0;left: 0;"/>
|
|||
|
<img src="`+ avator + `" style="top:50%;margin-top:-30px;left:50%;margin-left:-30px;position:absolute;border:2px solid #fff;width: 60px;height:60px;border-radius: 8px;"/>
|
|||
|
</div>
|
|||
|
`;
|
|||
|
_this.$alert(html, "请将二维码截图保存到本地", {
|
|||
|
dangerouslyUseHTMLString: true,
|
|||
|
});
|
|||
|
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: "请将二维码截图保存到本地"
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//获取短信验证码
|
|||
|
getSmsCode() {
|
|||
|
var _this = this;
|
|||
|
params = { phone: this.kefuInfo.tel };
|
|||
|
this.sendAjax("/kefu/sendSms", "get", params, function (data) {
|
|||
|
_this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
|
|||
|
_this.sms.disable = true;
|
|||
|
_this.sms.txt = _this.sms.count + 's后重发'
|
|||
|
var countDown = setInterval(function () {
|
|||
|
if (_this.sms.count < 1) {
|
|||
|
_this.sms.disable = false;
|
|||
|
_this.sms.txt = _this.flyLang.sendSms;
|
|||
|
_this.sms.count = 60;
|
|||
|
clearInterval(countDown);
|
|||
|
} else {
|
|||
|
_this.sms.disable = true
|
|||
|
_this.sms.txt = --_this.sms.count + 's后重发'
|
|||
|
}
|
|||
|
}, 1000);
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
},
|
|||
|
//绑定手机号
|
|||
|
postBindTel() {
|
|||
|
var _this = this;
|
|||
|
var params = { phone: this.kefuInfo.tel, code: this.sms.code };
|
|||
|
this.sendAjax("/kefu/bindTel", "post", params, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "绑定成功!",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//提交IP黑名单
|
|||
|
postIpBlack() {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/system/ipblacks", "post", {
|
|||
|
ip: this.ipAddress,
|
|||
|
name: this.ipAddressName
|
|||
|
}, function () {
|
|||
|
_this.$message({
|
|||
|
message: "ok",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
_this.sendAjax("/system/ipblacks", "get", { page: 1, pagesize: 100000 }, function (result) {
|
|||
|
_this.ipblackList = result.list;
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//获取监控列表
|
|||
|
getMonitorList() {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/monitorList", "get", {}, function (result) {
|
|||
|
_this.monitorList = result;
|
|||
|
});
|
|||
|
},
|
|||
|
//设置机器人信息
|
|||
|
getRobotInfo() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/robotInfo", "GET", {}, function (result) {
|
|||
|
result.avator = result.avator != "" ? result.avator : _this.kefuInfo.avator;
|
|||
|
result.name = result.name != "" ? result.name : _this.kefuInfo.nickname;
|
|||
|
let status = result.status == "" ? "1" : result.status;
|
|||
|
result.status = status;
|
|||
|
_this.robotInfo = result;
|
|||
|
});
|
|||
|
},
|
|||
|
//设置机器人信息
|
|||
|
setRobotInfo() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/setRobotInfo", "POST", this.robotInfo, function (result) {
|
|||
|
_this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
_this.getRobotInfo();
|
|||
|
});
|
|||
|
},
|
|||
|
//设置机器人卡片
|
|||
|
setRobotCard() {
|
|||
|
let card = this.editor.txt.html();
|
|||
|
this.setEntConfigItem("机器人卡片", "RobotCard", card);
|
|||
|
},
|
|||
|
/**
|
|||
|
* 连接websocket
|
|||
|
*/
|
|||
|
connect() {
|
|||
|
var _this = this;
|
|||
|
var domain = getDomainFromUrl("");
|
|||
|
var protocol = getProtocolFromUrl("");
|
|||
|
var wsProtocol = "ws://";
|
|||
|
if (protocol == "https") {
|
|||
|
wsProtocol = "wss://";
|
|||
|
}
|
|||
|
let ws = new WebSocket(wsProtocol + domain + "/ws_kefu?token=" + localStorage.getItem("token"));
|
|||
|
|
|||
|
ws.onopen = function () {
|
|||
|
console.log('WebSocket 连接已打开');
|
|||
|
_this.reconnectTimes = 0;
|
|||
|
};
|
|||
|
|
|||
|
ws.onclose = function () {
|
|||
|
console.log('WebSocket 连接已关闭');
|
|||
|
// 尝试重连
|
|||
|
_this.reconnect();
|
|||
|
};
|
|||
|
ws.onmessage = function (event) {
|
|||
|
console.log(`收到服务器的消息:${event.data}`);
|
|||
|
// 解析消息
|
|||
|
const message = JSON.parse(event.data);
|
|||
|
//监控列表删除
|
|||
|
if (message.type === 'monitorOffline') {
|
|||
|
let id = message.data.UinqId;
|
|||
|
_this.monitorList = removeObjects(_this.monitorList, "UinqId", id);
|
|||
|
}
|
|||
|
//监控列表增加
|
|||
|
if (message.type === 'monitorOnline') {
|
|||
|
let obj = message.data;
|
|||
|
_this.monitorList.push(obj);
|
|||
|
}
|
|||
|
};
|
|||
|
_this.ws = ws;
|
|||
|
},
|
|||
|
// 尝试重连
|
|||
|
reconnect() {
|
|||
|
var _this = this;
|
|||
|
if (_this.reconnectTimes >= _this.MAX_RECONNECT_TIMES) {
|
|||
|
console.log('重连失败');
|
|||
|
return;
|
|||
|
}
|
|||
|
_this.reconnectTimes++;
|
|||
|
console.log(`正在尝试重连(第 ${_this.reconnectTimes} 次)`);
|
|||
|
setTimeout(function () {
|
|||
|
_this.connect();
|
|||
|
}, _this.RECONNECT_INTERVAL);
|
|||
|
},
|
|||
|
copyText(text) {
|
|||
|
copyText(text);
|
|||
|
this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
},
|
|||
|
replaceSpecialTag(html) {
|
|||
|
return replaceSpecialTag(html);
|
|||
|
},
|
|||
|
//编辑顾客
|
|||
|
getConsumer(row) {
|
|||
|
this.consumers.form = row;
|
|||
|
this.consumers.dialog = true;
|
|||
|
},
|
|||
|
//设置顾客信息
|
|||
|
setConsumerForm(formName) {
|
|||
|
let _this = this;
|
|||
|
this.$refs[formName].validate((valid) => {
|
|||
|
if (!valid) {
|
|||
|
return false;
|
|||
|
} else {
|
|||
|
this.sendAjax("/kefu/setConsumers", "POST", this.consumers.form, function (result) {
|
|||
|
_this.consumers.dialog = false;
|
|||
|
_this.getConsumers(_this.consumers.page);
|
|||
|
_this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//获取顾客列表
|
|||
|
getConsumers(page) {
|
|||
|
let _this = this;
|
|||
|
let params = {};
|
|||
|
params = { pagesize: 10, page: page };
|
|||
|
this.sendAjax("/kefu/consumers", "GET", params, function (result) {
|
|||
|
_this.consumers.count = result.count;
|
|||
|
_this.consumers.list = result.list;
|
|||
|
_this.consumers.page = result.page;
|
|||
|
_this.consumers.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
//删除顾客
|
|||
|
delConsumers(id) {
|
|||
|
var _this = this;
|
|||
|
this.$confirm('此操作将删除顾客, 是否继续?', '提示', {
|
|||
|
confirmButtonText: '确定',
|
|||
|
cancelButtonText: '取消',
|
|||
|
type: 'warning'
|
|||
|
}).then(function () {
|
|||
|
_this.sendAjax("/kefu/delConsumers", "get", { id: id }, function (result) {
|
|||
|
_this.$message({
|
|||
|
type: 'success',
|
|||
|
message: result.msg
|
|||
|
});
|
|||
|
_this.getConsumers(_this.consumers.page);
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//学习库列表
|
|||
|
getLearns(page) {
|
|||
|
let _this = this;
|
|||
|
let params = {};
|
|||
|
params = { pagesize: this.learns.pagesize, page: page };
|
|||
|
this.sendAjax("/kefu/learns", "GET", params, function (result) {
|
|||
|
_this.learns.count = result.count;
|
|||
|
_this.learns.list = result.list;
|
|||
|
_this.learns.page = result.page;
|
|||
|
_this.learns.pagesize = result.pagesize;
|
|||
|
});
|
|||
|
},
|
|||
|
//补充知识库
|
|||
|
learnToArticle(content) {
|
|||
|
this.article.title = content;
|
|||
|
this.article.search_type = 1;
|
|||
|
this.articleDialog = true;
|
|||
|
},
|
|||
|
//切换知识库解决状态
|
|||
|
switchLearnStatus: function (status, id) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/learnStatus", "POST", { status: status, id: id }, function (result) {
|
|||
|
});
|
|||
|
},
|
|||
|
//处理tab切换
|
|||
|
handleTabClick(tab, event) {
|
|||
|
if (tab.name == "learnList") {
|
|||
|
this.getLearns(1);
|
|||
|
}
|
|||
|
if (tab.name == "articleList") {
|
|||
|
this.getArticleCate();
|
|||
|
this.getArticle(1);
|
|||
|
}
|
|||
|
if (tab.name == "robotCard") {
|
|||
|
if (!this.editor) this.initEditor();
|
|||
|
this.editor.txt.html(this.getConfig("RobotCard"));
|
|||
|
}
|
|||
|
//离线时回复
|
|||
|
if (tab.name == "offlineSetting") {
|
|||
|
if (!this.editor) this.initEditor("#offlineSettingEditor");
|
|||
|
this.editor.txt.html(this.getConfig("KefuOfflineNotice"));
|
|||
|
}
|
|||
|
},
|
|||
|
setRobotCardSource() {
|
|||
|
if (this.robotCard != "") {
|
|||
|
this.robotCard = "";
|
|||
|
} else {
|
|||
|
this.robotCard = this.editor.txt.html();
|
|||
|
}
|
|||
|
},
|
|||
|
//获取配置
|
|||
|
getConfigs(callback) {
|
|||
|
var _this = this;
|
|||
|
this.sendAjax("/kefu/ent_configs", "get", {}, function (result) {
|
|||
|
_this.configs = result;
|
|||
|
if (callback) callback();
|
|||
|
});
|
|||
|
},
|
|||
|
getConfig(key) {
|
|||
|
for (index in this.configs) {
|
|||
|
if (key == this.configs[index].conf_key) {
|
|||
|
return this.configs[index].conf_value;
|
|||
|
}
|
|||
|
}
|
|||
|
return "";
|
|||
|
},
|
|||
|
getConfigByAdmin(key) {
|
|||
|
for (index in this.kefuSetting) {
|
|||
|
if (key == this.kefuSetting[index].conf_key) {
|
|||
|
return this.kefuSetting[index].conf_value;
|
|||
|
}
|
|||
|
}
|
|||
|
return "";
|
|||
|
},
|
|||
|
setConfig(key, value) {
|
|||
|
for (index in this.configs) {
|
|||
|
if (key == this.configs[index].conf_key) {
|
|||
|
this.configs[index].conf_value = value;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
return "";
|
|||
|
},
|
|||
|
//获取微信客服配置
|
|||
|
getKefuWeworkConfig() {
|
|||
|
this.kefuWework.corpid = this.getConfig("kefuWeworkCorpid");
|
|||
|
this.kefuWework.secret = this.getConfig("kefuWeworkSecret");
|
|||
|
this.kefuWework.token = this.getConfig("kefuWeworkToken");
|
|||
|
this.kefuWework.encodingAESKey = this.getConfig("kefuWeworkEncodingAESKey");
|
|||
|
this.wework.corpid = this.getConfig("WorkWechatCorpid");
|
|||
|
this.wework.webhook = this.getConfig("WorkWechatWebHookUrl");
|
|||
|
this.wework.agentid = this.getConfig("WorkWechatAppAgentId");
|
|||
|
this.wework.secret = this.getConfig("WorkWechatAppSecret");
|
|||
|
this.wework.encodingAESKey = this.getConfig("WorkWechatAppEncodingAESKey");
|
|||
|
this.wework.token = this.getConfig("WorkWechatAppToken");
|
|||
|
this.wechatMini.appid = this.getConfig("WechatMiniAppId");
|
|||
|
this.wechatMini.appsecret = this.getConfig("WechatMiniAppSecret");
|
|||
|
this.wechatMini.token = this.getConfig("WechatMiniToken");
|
|||
|
this.wechatMini.templateId = this.getConfig("WechatMiniTemplateId");
|
|||
|
this.wechatMini.pages = this.getConfig("WechatMiniPages");
|
|||
|
this.wechatOfficial.appid = this.getConfig("WechatAppId");
|
|||
|
this.wechatOfficial.appsecret = this.getConfig("WechatAppSecret");
|
|||
|
this.wechatOfficial.token = this.getConfig("WechatAppToken");
|
|||
|
this.wechatOfficial.kefuTemplateId = this.getConfig("WechatMessageTemplateId");
|
|||
|
this.wechatOfficial.kefuTemplateColumn = this.getConfig("WechatMessageTemplateColumn");
|
|||
|
this.wechatOfficial.isReply = this.getConfig("WechatKefu");
|
|||
|
this.wechatOfficial.menu = this.getConfig("WechatMenu");
|
|||
|
},
|
|||
|
//获取微信客服列表
|
|||
|
getKefuWeworkList() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/kefuWeworkList", "GET", {}, function (res) {
|
|||
|
let weworkRet = JSON.parse(res);
|
|||
|
console.log(weworkRet);
|
|||
|
if (weworkRet.errcode != 0) {
|
|||
|
_this.$message({
|
|||
|
message: weworkRet.errmsg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
_this.kefuWeworkList = weworkRet.account_list;
|
|||
|
});
|
|||
|
},
|
|||
|
//获取微信客服链接
|
|||
|
getKefuWeworkLink(openKfId) {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/kefuWeworkLink", "GET", { open_kfid: openKfId }, function (res) {
|
|||
|
let weworkRet = JSON.parse(res);
|
|||
|
console.log(weworkRet);
|
|||
|
_this.kefuWework.link = weworkRet.url;
|
|||
|
});
|
|||
|
},
|
|||
|
//生成微信公众号菜单
|
|||
|
mkWechatMenu() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/mkWechatMenu", "GET", {}, function (res) {
|
|||
|
_this.$message({
|
|||
|
message: "创建成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//删除微信公众号菜单
|
|||
|
delWechatMenu() {
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/delWechatMenu", "GET", {}, function (res) {
|
|||
|
_this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
//搜索知识库
|
|||
|
searchArticle() {
|
|||
|
if (!this.articles.search) return;
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/2/searchQuestion", "GET", {
|
|||
|
"ent_id": this.entId,
|
|||
|
"content": this.articles.search,
|
|||
|
}, function (res) {
|
|||
|
console.log(res);
|
|||
|
_this.articles.list = res;
|
|||
|
});
|
|||
|
},
|
|||
|
//上传文件失败
|
|||
|
uploadQdrantSuccess(response, file, fileList) {
|
|||
|
this.loading.close();
|
|||
|
if (response.code == 20000) {
|
|||
|
this.$message({
|
|||
|
message: "上传成功",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: response.msg,
|
|||
|
type: 'error'
|
|||
|
});
|
|||
|
}
|
|||
|
},
|
|||
|
//上传文件失败
|
|||
|
uploadQdrantError() {
|
|||
|
this.loading.close();
|
|||
|
},
|
|||
|
//上传之前
|
|||
|
beforeuploadQdrant(file) {
|
|||
|
if (!this.chatGPT.qdrantAICollect) {
|
|||
|
this.$message.error('管理员开通向量知识库集合权限后才能使用!');
|
|||
|
return false;
|
|||
|
}
|
|||
|
var isLt2M = file.size / 1024 / 1024 < 1;
|
|||
|
if (!isLt2M) {
|
|||
|
this.$message.error('上传文档大小不能超过 1MB!');
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
this.loading = this.$loading({
|
|||
|
lock: true,
|
|||
|
text: "上传中",
|
|||
|
});
|
|||
|
|
|||
|
let ext = file.name.substring(file.name.lastIndexOf(".") + 1);
|
|||
|
if (ext != 'xlsx') {
|
|||
|
this.$message.error('上传文件只能是 .xlsx 格式!');
|
|||
|
this.loading.close();
|
|||
|
return false;
|
|||
|
}
|
|||
|
},
|
|||
|
//设置接待时间
|
|||
|
postWorkTime() {
|
|||
|
let workDay = this.workTimeSetting.workDay.join("|");
|
|||
|
let morningWorkTime = this.workTimeSetting.morningWorkTime.join("|");
|
|||
|
let afternoonWorkTime = this.workTimeSetting.afternoonWorkTime.join("|");
|
|||
|
let otherWorkTime = this.workTimeSetting.otherWorkTime;
|
|||
|
if (otherWorkTime) {
|
|||
|
otherWorkTime = otherWorkTime.join("|");
|
|||
|
}
|
|||
|
let _this = this;
|
|||
|
this.sendAjax("/kefu/postWorkTime", "POST", {
|
|||
|
workDay: workDay,
|
|||
|
morningWorkTime: morningWorkTime,
|
|||
|
afternoonWorkTime: afternoonWorkTime,
|
|||
|
otherWorkTime: otherWorkTime,
|
|||
|
workTimeStatus: this.workTimeSetting.workTimeStatus,
|
|||
|
afterWorkMessage: this.workTimeSetting.afterWorkMessage,
|
|||
|
}, function (res) {
|
|||
|
_this.getWorkTime();
|
|||
|
_this.$message({
|
|||
|
message: "success",
|
|||
|
type: 'success'
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
, getWorkTime() {
|
|||
|
let _this = this;
|
|||
|
this.getConfigs(function () {
|
|||
|
_this.workTimeSetting.workTimeStatus = _this.getConfig("workTimeStatus");
|
|||
|
let morningWorkTime = _this.getConfig("morningWorkTime");
|
|||
|
if (morningWorkTime) {
|
|||
|
_this.workTimeSetting.morningWorkTime = morningWorkTime.split("|");
|
|||
|
}
|
|||
|
let afternoonWorkTime = _this.getConfig("afternoonWorkTime");
|
|||
|
if (afternoonWorkTime) {
|
|||
|
_this.workTimeSetting.afternoonWorkTime = afternoonWorkTime.split("|");
|
|||
|
}
|
|||
|
let otherWorkTime = _this.getConfig("otherWorkTime");
|
|||
|
if (otherWorkTime) {
|
|||
|
_this.workTimeSetting.otherWorkTime = otherWorkTime.split("|");
|
|||
|
}
|
|||
|
let workDay = _this.getConfig("workDay");
|
|||
|
if (workDay) {
|
|||
|
_this.workTimeSetting.workDay = workDay.split("|");
|
|||
|
}
|
|||
|
let afterWorkMessage = _this.getConfig("afterWorkMessage");
|
|||
|
if (afterWorkMessage) {
|
|||
|
_this.workTimeSetting.afterWorkMessage = afterWorkMessage;
|
|||
|
}
|
|||
|
_this.fanyiSource = _this.getConfig("FanyiSource");
|
|||
|
_this.baiduFanyiAuto = _this.getConfig("BaiduFanyiAuto");
|
|||
|
_this.baiduFanyiAppId = _this.getConfig("BaiduFanyiAppId");
|
|||
|
_this.baiduFanyiAppSec = _this.getConfig("BaiduFanyiAppSec");
|
|||
|
});
|
|||
|
},
|
|||
|
},
|
|||
|
|
|||
|
mounted: function () {
|
|||
|
let url = getQuery("url")
|
|||
|
if (url != "") {
|
|||
|
this.iframeUrl = url;
|
|||
|
if (url == "setting_welcome") this.tabIndex = "1-5";
|
|||
|
if (url == "setting_deploy") {
|
|||
|
this.tabIndex = "3-4";
|
|||
|
this.openIndex = [3];
|
|||
|
}
|
|||
|
}
|
|||
|
this.initInfo();
|
|||
|
let tabActive = getQuery("tab");
|
|||
|
if (tabActive != "") this.tabActive = tabActive;
|
|||
|
},
|
|||
|
created: function () {
|
|||
|
// if(ACTION=="setting"){
|
|||
|
// this.showNotice();
|
|||
|
// }
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
</script>
|
|||
|
|
|||
|
</html>
|
|||
|
{{end}}
|