dengzhiguo преди 6 години
родител
ревизия
758ba4cbdb
променени са 3 файла, в които са добавени 27 реда и са изтрити 1 реда
  1. 16 1
      src/js/search.js
  2. 6 0
      webpack.config.js
  3. 5 0
      webpack/entry.config.js

+ 16 - 1
src/js/search.js

@@ -51,6 +51,7 @@ $(function(){
                     		var keyHtml="";
                     		var titleData=dataList[a].title.split(name);
                     		var keyData=dataList[a].keyword.split(name);
+                    		//标题的红色处理
                     		if(titleData.length==1&&titleData[0]==""){
                     			
                     		}else{
@@ -63,6 +64,7 @@ $(function(){
                     				titleHtml=`${titleData[0]}`;
                     			}
                     		}
+                    		//关键字的红色处理
                     		if(keyData.length==1&&keyData[0]==""){
                     			
                     		}else{
@@ -70,7 +72,7 @@ $(function(){
                     				for(var c=0;c<keyData.length-1;c++){
                     					keyHtml+=`${keyData[c]}<span>${name}</span>`;
                     				}
-                    				keyHtml+=`${keyData[titleData.length-1]}`;
+                    				keyHtml+=`${keyData[keyData.length-1]}`;
                     			}else if(keyData[0]!=""){
                     				keyHtml=`${keyData[0]}`;
                     			}
@@ -185,6 +187,19 @@ $(function(){
             }
         })
     }
+    /* 提示 */
+    //提示框渐隐函数    
+    function msg(txt) {
+        if($('.smg').hasClass('active')){
+			return ;
+		}
+        $('.smg').addClass('active');
+        var lit = $('#msg').val(txt);
+        setTimeout(function () {
+            $('.smg').removeClass('active');
+            $('#msg').val('');
+        }, 2000)
+    }
 })
 
 

+ 6 - 0
webpack.config.js

@@ -35,6 +35,12 @@ module.exports = (function () {
             template: './template/index.html',
             chunks: ['index', 'vendors']
         }),
+        new HtmlWebpackPlugin({
+            title: '搜索页',
+            filename: 'html/index.html',
+            template: './template/search.html',
+            chunks: ['search', 'vendors']
+        }),
         // new HtmlWebpackPlugin({
         //     title: '支付跳转页面',
         //     filename: 'html/toPayment.html',

+ 5 - 0
webpack/entry.config.js

@@ -1,6 +1,7 @@
 module.exports = {
     prod: {
         'index': './src/js/newMenu/index.js',
+        'search': './src/js/search.js',
         'aboutUs': './src/js/aboutUs.js',
         // 'APPaboutUs': './src/js/APPaboutUs.js',
         'contactUs': './src/js/contactUs.js',
@@ -61,6 +62,10 @@ module.exports = {
             'webpack/hot/only-dev-server',
             './src/js/newMenu/index.js'
         ],
+        'search': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+            'webpack/hot/only-dev-server',
+            './src/js/search.js'
+        ],
          'aboutUs': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
             'webpack/hot/only-dev-server',
             './src/js/aboutUs.js'