浏览代码

关键词

wangshan 5 年之前
父节点
当前提交
963f83ae65

+ 3 - 0
src/jfw/modules/subscribepay/src/service/afterPay.go

@@ -96,6 +96,9 @@ func (a *AfterPay) SetUserInfo() error {
 			kwscount := a.GetString("kwscount")
 			addtion_kws := a.GetSlice("addition_kws")
 			not_kws := a.GetSlice("not_kws")
+			if len([]rune(kws_name)) > 20 {
+				kws_name = qutil.SubString(kws_name, 0, 20)
+			}
 			_kws := strings.Split(kws_name, " ")
 			if actionType == "SK" { //保存关键词
 				if kwscount != "0" {

+ 17 - 1
src/web/staticres/vipsubscribe/css/keyWord.css

@@ -28,6 +28,7 @@
 .keyWord .add-keyword-container .classify .classify-l {
   font-size: .32rem;
   color: #1d1d1d;
+	width: 2rem;
 }
 
 .keyWord .add-keyword-container .classify .classify-r {
@@ -105,7 +106,7 @@
 }
 
 .keyWord .all-classify-column {
-  border-top: 1px solid transparent;
+/*  border-top: 1px solid transparent;*/
 }
 
 .keyWord .all-classify-column .classify-list {
@@ -129,6 +130,21 @@
 .keyWord .all-classify-column .classify-list .classify-item .classify-item-l {
   font-size: .32rem;
   color: #1d1d1d;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    display: -webkit-inline-box;
+    -webkit-line-clamp: 1;
+    -webkit-box-orient: vertical;
+    width: 4.5rem;
+	    margin-top: -0.05rem;
+}
+.classify .classify-detail{
+    text-overflow: ellipsis;
+    overflow: hidden;
+    display: -webkit-inline-box;
+    -webkit-line-clamp: 1;
+    -webkit-box-orient: vertical;
+    width: 4rem;
 }
 
 .keyWord .all-classify-column .classify-list .classify-item .classify-item-r {

+ 1 - 1
src/web/staticres/vipsubscribe/js/additionWord.js

@@ -135,7 +135,7 @@ $(function(){
         }else{
             _addindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
 			if(addkws_arr[keyWord]!=undefined&&addkws_arr[keyWord]!=_addindex){
-	            weui.toast('您设置的排除词已存在,请调整后再添加。', {
+	            weui.toast('您设置的附加词已存在,请调整后再添加。', {
 	                duration: 2000,
 	                className: 'custom-toast',
 	                callback: function () { console.log('close') }

+ 26 - 0
src/web/staticres/vipsubscribe/js/keyWord.js

@@ -50,6 +50,13 @@ var reloadFunc = function(){
             });
 			return
 		}
+        if(kws_name.length > 20){
+            weui.toast('关键词不能超过20字', {
+                duration: 2000,
+                className: 'custom-toast',
+                callback: function () { console.log('close') }
+            });
+        }
         kws_name = keyWord;
         kws_index = $(".showKeyWord li").length;
         if(kws_index==0){
@@ -113,6 +120,12 @@ var reloadFunc = function(){
             $(".enter.addkeyWord").hide();
             // 还原状态
             $('.enter.addkeyWord > input').val('')
+            //把kws_name,kws_index,addition_kws,not_kws初始化
+            kws_index = 0;
+            kws_name = "";
+            addition_kws = [];
+            not_kws = [];
+			//
             var buttonDOM = $('.enter.addkeyWord .btn button')[0]
             buttonDOM.style.opacity = .5
             buttonDOM.setAttribute("disabled", true)
@@ -178,9 +191,19 @@ var reloadFunc = function(){
                         kws_count -= 1;
                         $(".kws_count").text(kws_count);
                         jQueryDOM.remove();
+						if($(".showKeyWord ul").find('li').length==0){
+			                $(".enter.addkeyWord").find(".btnChoose button").eq(0).html('添加 附加词');
+			                $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 附加词');
+			                $(".enter.addkeyWord").find("input").val("");
+						}
                         hasWords();
                         $('.addKeyWord').show();
                         doSessionData('DK');
+			            //把kws_name,kws_index,addition_kws,not_kws初始化
+			            kws_index = 0;
+			            kws_name = "";
+			            addition_kws = [];
+			            not_kws = [];
                     }else{
 			            weui.toast('无法删除', {
 			                duration: 2000,
@@ -276,6 +299,9 @@ var reloadFunc = function(){
             });
             return
         }
+		if(classify_name.length > 20){
+			classify_name = classify_name.substring(0,20);
+		}
         $(this).removeClass("opacity6");
         $('.classify-r .classify-detail').text(classify_name);
         // 关闭弹框后要重置input内容

+ 1 - 1
src/web/templates/weixin/vipsubscribe/additionWord.html

@@ -21,7 +21,7 @@
             <p class="title">示例:开发(附加词)</p>
             <!-- 添加附加词 -->
             <div class="enter addkeyWord" style="display: none;">
-                <input type="text" class="enterOne" placeholder="请输入附加词" />
+                <input type="text" class="enterOne" maxlength="20" placeholder="请输入附加词" />
                 <div class="btn">
                     <button disabled>确认</button>
                 </div>

+ 2 - 2
src/web/templates/weixin/vipsubscribe/exclusiveWord.html

@@ -21,7 +21,7 @@
             <p class="title">示例:运维(排除词)</p>
             <!-- 添加排除词 -->
             <div class="enter addkeyWord">
-                <input type="text" class="enterOne" placeholder="请输入排除词" />
+                <input type="text" class="enterOne" maxlength="20" placeholder="请输入排除词" />
                 <div class="btn">
                     <button disabled>确认</button>
                 </div>
@@ -71,7 +71,7 @@
 	<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
     <script>
 		initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
-        var not_kws = []//附加
+        var not_kws = []//排除
         var _notkws = "";
         var _notindex = -1;
 		var notkws_arr = {}

+ 21 - 16
src/web/templates/weixin/vipsubscribe/keyWord.html

@@ -20,10 +20,13 @@
             opacity: 0.6;
         }
         .keysexplain{
-            position: absolute;
+            position: fixed;
+		    height: .8rem;
+		    background: rgba(245,244,249,1);
+		    width: 100%;
             font-size: .3rem;
-            top: .18rem;
-            margin-left: .3rem;
+            padding-top: .18rem;
+            padding-left: .3rem;
             color: #888;
         }
         .classifyKeysShow{
@@ -44,6 +47,8 @@
             line-height: 1rem;
             color:#FFFFFF;
             font-size: .32rem;
+			position:fixed;
+			bottom:0px;
         }
 
         .classify-show-pop .weui-dialog .weui-dialog__hd {
@@ -126,7 +131,7 @@
             <section class="content">
                 <!-- 添加关键词 -->
                 <div class="enter addkeyWord" style="display: none;">
-                    <input type="text" class="enterOne" placeholder="请输入关键词" maxlength="100" />
+                    <input type="text" class="enterOne" placeholder="请输入关键词" maxlength="20" />
                     <!-- <textarea style="resize:none;" rows="1"  class="enterOne" name="" id=""  placeholder="请输入关键词" maxlength="100"></textarea> -->
                     <div class="btnChoose" style="display:none;">
                         <button onclick="toappendkey(this)">添加 附加词</button>
@@ -194,7 +199,7 @@
                     <strong class="weui-dialog__title">关键词分类</strong>
                 </div>
                 <div class="weui-dialog__bd">
-                    <input type="text" class="classify-keyword" placeholder="输入分类名称">
+                    <input type="text" class="classify-keyword" maxlength="20" placeholder="输入分类名称">
                 </div>
                 <div class="weui-dialog__ft">
                     <a href="javascript:;" class="dialog__btn dialog__btn_confirm opacity6">确定</a> 
@@ -342,7 +347,7 @@
                 modifyFlag = true;
                 kws_count = sessionStorage.kws_count;
                 $(".kws_count").text(kws_count);
-                ///$('.addKeyWord').hide()
+                $('.addKeyWord').hide();
                 toSetKws();
             }else{
                 //获取用户设置信息类型
@@ -439,7 +444,7 @@
         function toSetKws(){
             //分类列表进入
             if(kws_index==-1){
-                var edhtml = '<input type="text" class="enterOne" placeholder="请输入关键词" maxlength="100">'
+                var edhtml = '<input type="text" class="enterOne" placeholder="请输入关键词" maxlength="20">'
                             +'<div class="btnChoose">'
                 if(addition_kws.length>0){
                     edhtml +='<button onclick="toappendkey(this)">编辑 附加词<i>('+addition_kws.length+')</i></button>'
@@ -474,7 +479,7 @@
                 if(kws_tips==undefined){
                     kws_tips = 0;
                 }
-				if (kws_tips==0&&classify_name.indexOf("未分类")>-1){
+				if (kws_tips==0&&classify_name.indexOf("未分类")>-1&&window.location.search.indexOf("page=2")<0){
 	                //第一次进来分类提示
 	                showMeg();
 					var param = {};
@@ -557,7 +562,7 @@
         }
         //跳转附加词
         function toappendkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=231")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -575,7 +580,7 @@
         }
         //
         function tonotkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=231")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -649,6 +654,11 @@
                     $('.addKeyWord').show();
                     //
                     doSessionData();
+		            //把kws_name,kws_index,addition_kws,not_kws初始化
+		            kws_index = 0;
+		            kws_name = "";
+		            addition_kws = [];
+		            not_kws = [];
                 }else{
 		            weui.toast('保存出错,稍后再试', {
 		                duration: 2000,
@@ -717,14 +727,9 @@
                     a_items[classify_index]["a_key"].splice(kws_index,1);
                 }
             }
-            //把kws_name,kws_index,addition_kws,not_kws初始化
-            kws_index = 0;
-            kws_name = "";
-            addition_kws = [];
-            not_kws = [];
         }
     </script>
-    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}"></script>
+    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}21"></script>
     <script>
         // 设置一条空记录,用户第一次进入添加关键词点击确定时候调用
         function setEmptyHistory() {