diff --git a/web/admin/www/keywordManage.html b/web/admin/www/keywordManage.html
index 189b285..3f9eb09 100644
--- a/web/admin/www/keywordManage.html
+++ b/web/admin/www/keywordManage.html
@@ -33,20 +33,27 @@
Loading...
@@ -120,26 +127,40 @@
// 保存编辑后的关键词入库
function saveEditKeywords(){
- let text = $5('[id=editKeywordText]').val().trim();
+ let text = '';
+ var aiBox = document.getElementById('AI_editBox');
+ var editBox = document.getElementById('editBox');
+ var currentCateid = $5('[id=cross_cateid_select]').val().trim();
+ if(aiBox.style.display !== 'none'){
+ text = document.getElementById('AI_editKeywordText').value.trim();
+ console.log("AI:"+text);
+
+ } else {
+ text = document.getElementById('editKeywordText').value.trim();
+ console.log("normal:"+text);
+ }
+
if(!text){
ciyfn.toast('没有需要保存的关键词');
return;
}
ciyfn.callfunc('ConfirmSaveKeywords',{
- cateid:currentCateid,
- text:text
+ cateid: currentCateid,
+ text: text
},function(res){
if(res.code === 1){
ciyfn.toast(res.msg);
- $5('[id=editBox]').hide();
- $5('[id=editKeywordText]').val('');
+ editBox.style.display = 'none';
+ aiBox.style.display = 'none';
+ document.getElementById('editKeywordText').value = '';
+ document.getElementById('AI_editKeywordText').value = '';
}else{
ciyfn.toast(res.errmsg);
}
});
}
- // 原有批量添加不变
+ //批量添加不变
function BatchAdd() {
var cateid = $5('[id=cross_cateid_select]').val();
var names = $5('[name=cross_dim2]').val().trim();
@@ -164,6 +185,66 @@
}
});
}
-
+
+ //AI相关功能
+ function AIFunction(param) {
+ let text = '';
+ if(param === '修改'){
+ text = $5('[id=editKeywordText]').val().trim();
+ if (!text) {
+ ciyfn.toast('请先生成关键词再使用AI修改');
+ return;
+ }
+ ciyfn.toast('AI正在处理中...', 9999);
+ ciyfn.callfunc('AIFunction', {
+ content: text,
+ param: param
+ }, function (res) {
+ if (res.code === 1) {
+ $5('[id=editKeywordText]').val(res.data);
+ $5('[id=editBox]').show();
+ $5('[id=AI_editBox]').hide();
+ ciyfn.toast('AI ' + param + ' 完成');
+ } else {
+ ciyfn.toast('AI ' + param + ' 失败:' + res.errmsg);
+ }
+ });
+ }else{
+ var cateid = $5('[id=cross_cateid_select]').val();
+ var dim1 = $5('[name=cross_dim1]').val().trim();
+ var dim2 = $5('[name=cross_dim2]').val().trim();
+ var dim3 = $5('[name=cross_dim3]').val().trim();
+ if(!cateid){
+ ciyfn.toast('请选择所属栏目');
+ return;
+ }
+
+ if (!dim2) {
+ ciyfn.toast('请填写核心词');
+ return;
+ }
+
+ ciyfn.toast('AI联想中...', 9999);
+ ciyfn.callfunc('AIFunction', {
+ cateid: cateid,
+ dim1: dim1,
+ dim2: dim2,
+ dim3: dim3,
+ param: param
+ }, function (res) {
+ if (res.code === 1) {
+ $5('[id=AI_editKeywordText]').val(res.data);
+ $5('[id=AI_editBox]').show();
+ $5('[id=editBox]').hide();
+ ciyfn.toast('AI ' + param + ' 完成');
+ } else {
+ ciyfn.toast('AI ' + param + ' 失败:' + res.errmsg);
+ }
+ });
+
+ }
+
+ }
+