xuzhiheng 6 lat temu
rodzic
commit
502b59fead

+ 30 - 2
src/jfw/modules/app/src/web/staticres/jyapp/wx_dataExport/js/keyWord.js

@@ -109,7 +109,35 @@ $(function(){
         $('.modify span').each(function(item){
             $('.modify span')[0].contentEditable = true
         });
-        // console.log($(this).parent().siblings().find('span').text())
+        var keyWord = $(this).prev().children().find(".key").text();
+        for(var i in keyWordArr){
+            if(keyWordArr[i].keyWord === keyWord){
+                var str = "";
+                var strs = "";
+                if(keyWordArr[i].appended !== undefined){
+                    var appended = keyWordArr[i].appended.length;
+                    if(appended < 1){
+                        str =  "添加 附加词";
+                    }else{
+                        str = "编辑 附加词 ("+appended+")";
+                    }
+                }else{
+                    str =  "添加 附加词";
+                }
+                $(this).parent().next().find(".addAdjunctWord").text(str);
+                if(keyWordArr[i].exclude !== undefined){
+                    var exclude = keyWordArr[i].exclude.length;
+                    if(exclude < 1){
+                        strs = "添加 排除词";
+                    }else{
+                        strs = "编辑 排除词 ("+exclude+")";
+                    }
+                }else{
+                    strs = "添加 排除词";
+                }
+                $(this).parent().next().find(".addExclusion").text(strs);
+            }
+        }
         $(this).parent().hide();
         $(this).parent().siblings().css('display','block')
     });
@@ -143,7 +171,7 @@ $(function(){
         var $this = $(this);
         var keyWord = $(this).siblings('span').text();
         var keyWords = $(this).parent().prev().find('.key').text();
-        if ($('.addkeyWord input.enterOne').val().length < 1) {
+        if ($(this).parent().find("span").html().length < 1) {
 
             weui.toast('关键词不能为空', {
                 duration: 2000,

+ 12 - 1
src/jfw/modules/app/src/web/templates/dataExport/dataExport_keyWord.html

@@ -128,7 +128,7 @@
     </div>
     <script src="{{Msg "seo" "cdn"}}/jyapp/wx_dataExport/js/zepto.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/jyapp/wx_dataExport/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
-    <script src="/jyapp/wx_dataExport/js/keyWord.js?v={{Msg "seo" "version"}}21"></script>
+    <script src="/jyapp/wx_dataExport/js/keyWord.js?v={{Msg "seo" "version"}}23"></script>
     <script>
         var keyWordArr = [];
         if(localStorage.keyWord !== "" && localStorage.keyWord !== undefined){
@@ -282,6 +282,17 @@
         $(".app-back").on("click", function () {
             history.back();
         });
+        //
+        $(".showKeyWord ul li .one").each(function () {
+            var dom = $(this).children().find("p.addition").html();
+            if(dom === ""){
+                $(this).children().find("p.addition").parent().remove();
+            }
+            var doms = $(this).children().find("p.exclusion").html();
+            if(doms === ""){
+                $(this).children().find("p.exclusion").parent().remove();
+            }
+        });
 
     </script>
 </body>

+ 30 - 3
src/jfw/modules/app/src/web/templates/dataExport/dataExport_keyWordInput.html

@@ -119,6 +119,36 @@
             $(".problemPop").css("display", 'flex');
         });
 
+        // 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
+        $('.addkeyWord input.enterOne').on('input', function() {
+            if ($(this).val().length >= 100) {
+                var s = $(this).val().slice(0,100)
+                $(this).val(s)
+
+                weui.toast('关键词不能超过100字', {
+                    duration: 2000,
+                    className: 'text-overflow100',
+                    callback: function(){ console.log('close') }
+                });
+                return
+            }
+
+            var buttonDOM = $(this).siblings()[1].children[0];
+            if ($(this).val().length >= 1) {
+                buttonDOM.style.opacity = 1;
+                buttonDOM.removeAttribute("disabled");
+                //
+                $(this).next().find(".appended").prop("disabled", false);
+                $(this).next().find(".exclude").prop("disabled", false);
+            } else {
+                buttonDOM.style.opacity = .5;
+                buttonDOM.setAttribute("disabled", true);
+                //
+                $(this).next().find(".appended").prop("disabled", true);
+                $(this).next().find(".exclude").prop("disabled", true);
+            }
+        });
+
         // 添加 按钮的点击事件
         $('.addkeyWord .btn .save').on('click', function () {
             var keyWord = $('.addkeyWord input.enterOne').val();
@@ -156,9 +186,6 @@
         })
     });
 
-
-
-
     if($(".enterOne").val()!==""){
         $('.enter.addkeyWord .btnChoose .appended').prop("disabled", false);
         $('.enter.addkeyWord .btnChoose .exclude').prop("disabled", false);

+ 30 - 2
src/web/staticres/wx_dataExport/js/keyWord.js

@@ -110,7 +110,35 @@ $(function(){
         $('.modify span').each(function(item){
             $('.modify span')[0].contentEditable = true
         });
-        // console.log($(this).parent().siblings().find('span').text())
+        var keyWord = $(this).prev().children().find(".key").text();
+        for(var i in keyWordArr){
+            if(keyWordArr[i].keyWord === keyWord){
+                var str = "";
+                var strs = "";
+                if(keyWordArr[i].appended !== undefined){
+                    var appended = keyWordArr[i].appended.length;
+                    if(appended < 1){
+                        str =  "添加 附加词";
+                    }else{
+                        str = "编辑 附加词 ("+appended+")";
+                    }
+                }else{
+                    str =  "添加 附加词";
+                }
+                $(this).parent().next().find(".addAdjunctWord").text(str);
+                if(keyWordArr[i].exclude !== undefined){
+                    var exclude = keyWordArr[i].exclude.length;
+                    if(exclude < 1){
+                        strs = "添加 排除词";
+                    }else{
+                        strs = "编辑 排除词 ("+exclude+")";
+                    }
+                }else{
+                    strs = "添加 排除词";
+                }
+                $(this).parent().next().find(".addExclusion").text(strs);
+            }
+        }
         $(this).parent().hide();
         $(this).parent().siblings().css('display','block')
     });
@@ -144,7 +172,7 @@ $(function(){
         var $this = $(this);
         var keyWord = $(this).siblings('span').text();
         var keyWords = $(this).parent().prev().find('.key').text();
-        if ($('.addkeyWord input.enterOne').val().length < 1) {
+        if ($(this).parent().find("span").html().length < 1) {
 
             weui.toast('关键词不能为空', {
                 duration: 2000,

+ 21 - 23
src/web/templates/weixin/dataExport/dataExport_appended.html

@@ -84,30 +84,28 @@
             window.onload = function(){
                 backListen();
             };
-        }
-        //
-        // 监听浏览器回退事件
-        function backListen () {
-            if (window.history && window.history.pushState) {
-                $(window).on('popstate', function () { // 点击后退会触发popstate事件
-                    var hashLocation = location.hash; // 获取点击后的页面的hash值
-                    var hashSplit = hashLocation.split("#!/"); // 将哈希值装进数组(这里可以在控制台打印看效果)
-                    var hashName = hashSplit[1]; // 取数组的第一个
-
-                    // 点击后的页面哈希值与上一个页面不同,借助这个区别可以判断是否离开了页面,从而做一些操作
-                    if (hashName !== '') {
-                        var hash = window.location.hash;
-                        if (hash === '') { // 如果当前页面没有哈希值
-
-                            sessionStorage.removeItem("flag"); // 这里我做了清除sessionStorage的操作
-
-                            // 强行回退一步,就不用多点一次了😎
-                            history.go(-2); // 直接跳过没有哈希值的页面,就不会出现要点两次才能回到真正的上一页了
+            // 监听浏览器回退事件
+            function backListen () {
+                if (window.history && window.history.pushState) {
+                    $(window).on('popstate', function () { // 点击后退会触发popstate事件
+                        var hashLocation = location.hash; // 获取点击后的页面的hash值
+                        var hashSplit = hashLocation.split("#!/"); // 将哈希值装进数组(这里可以在控制台打印看效果)
+                        var hashName = hashSplit[1]; // 取数组的第一个
+
+                        // 点击后的页面哈希值与上一个页面不同,借助这个区别可以判断是否离开了页面,从而做一些操作
+                        if (hashName !== '') {
+                            var hash = window.location.hash;
+                            if (hash === '') { // 如果当前页面没有哈希值
+
+                                sessionStorage.removeItem("flag"); // 这里我做了清除sessionStorage的操作
+
+                                history.go(-2);
+                            }
                         }
-                    }
-                });
-                // 将含有哈希值的页面,强行插入浏览器历史记录中,此时相当于该页面有两个url在历史记录中,一个是有hash的,一个是没有hash的。
-                window.history.pushState('forward', null, '#');
+                    });
+                    // 将含有哈希值的页面,强行插入浏览器历史记录中,此时相当于该页面有两个url在历史记录中,一个是有hash的,一个是没有hash的。
+                    window.history.pushState('forward', null, '#');
+                }
             }
         }
         //

+ 3 - 1
src/web/templates/weixin/dataExport/dataExport_industry.html

@@ -218,7 +218,7 @@
 
         $('.reset').on('click',function(){
             $('.list ul li dl dt').removeClass('active');
-            $('.list ul li dl dd').removeClass('active')
+            $('.list ul li dl dd').removeClass('active');
         });
         //
         $(".all span").on('click', function () {
@@ -258,6 +258,7 @@
                     if($(this).attr("data-value") === industry[i]){
                         $(this).addClass("active");
                     }
+                    isDtSelected (this);
                 })
             }
             $(".list ul li").find("dd.active").each(function(){
@@ -285,6 +286,7 @@
                 $(_this).parent().find('dt').addClass('active');
             }
         }
+        //
 
     </script>
 </body>

+ 15 - 1
src/web/templates/weixin/dataExport/dataExport_keyWord.html

@@ -92,7 +92,7 @@
     </div>
     <script src="{{Msg "seo" "cdn"}}/wx_dataExport/js/zepto.js?v={{Msg "seo" "version"}}"></script>
     <script src="{{Msg "seo" "cdn"}}/wx_dataExport/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
-    <script src="{{Msg "seo" "cdn"}}/wx_dataExport/js/keyWord.js?v={{Msg "seo" "version"}}21"></script>
+    <script src="{{Msg "seo" "cdn"}}/wx_dataExport/js/keyWord.js?v={{Msg "seo" "version"}}30"></script>
     <script>
         initShare({{.T.signature}},{{.T.openid}},2,"jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
         var keyWordArr = [];
@@ -204,6 +204,7 @@
             }
             $('.showKeyWord > ul').prepend(keyWordHtml);
             //
+
         }
         //
         if($(".enterOne").val()!==""){
@@ -245,6 +246,19 @@
         $('.addkeyWord .btn .close').on('click', function () {
             window.history.back();
         });
+        //
+        $(".showKeyWord ul li .one").each(function () {
+            var dom = $(this).children().find("p.addition").html();
+            if(dom === ""){
+                $(this).children().find("p.addition").parent().remove();
+            }
+            var doms = $(this).children().find("p.exclusion").html();
+            if(doms === ""){
+                $(this).children().find("p.exclusion").parent().remove();
+            }
+        });
+        //
+
 
     </script>
 </body>