1var ecblib = ecblib || {}; 2ecblib.staffstart = ecblib.staffstart || {}; 3ecblib.staffstart.impl = ecblib.staffstart.impl || {}; 4 5(function() { 6 'use strict'; 7 ecblib.staffstart.impl.articleList = function(_el, _mobile, _option, _conditionFunc) { 8 ecblib.staffstart.util.initGloalVariables(_mobile); 9 10 new Vue({ 11 el: _el, 12 data: function () { 13 return { 14 mobile: _mobile, 15 isShowMenu: false, 16 breadCrumbList: [ 17 { name: 'ããã', url: ecblib.staffstart.uri.home }, 18 { name: 'ããã°ä¸è¦§', url: '#' }, 19 ], 20 sortTypes: [ 21 { id: 'latest-published', name: 'æ°çé ' }, 22 { id: 'pv', name: '人æ°é ' }, 23 ], 24 25 articleLlength: 0, 26 searchConditions: {}, 27 28 selected_tag: null, 29 selected_tags: [], 30 label: null, 31 shop: 0, 32 staff: 0, 33 sort_type: 'latest-published', 34 product_code: null, 35 base_product_code: null, 36 size: [], 37 feature: null, 38 ss_pageindex: null, 39 ss_pageindex_article: null, 40 article_id_array: [], 41 }; 42 }, 43 created: function () { 44 const _self = this; 45 _self.Search(); 46 window.addEventListener("popstate", function() { 47 _self.Search(); 48 }); 49 }, 50 mounted(){ 51 this.getArticles(); 52 }, 53 methods: { 54 getArticles: function () { 55 if(_conditionFunc) { 56 this.searchConditions = _conditionFunc(this); 57 } else { 58 this.searchConditions = { 59 tag_id: this.selected_tags.length > 0 ? this.selected_tags.map(function(i) {return i.tag_id}).join() : null, 60 shop_code: this.shop == 0 ? null : this.shop, 61 user_id: this.staff == 0 ? null : this.staff, 62 label_code: this.label, 63 sort: this.sort_type, 64 product_code: this.product_code, 65 size: this.size, 66 feature: this.feature, 67 ss_pageindex: this.ss_pageindex, 68 }; 69 } 70 this.isShowMenu = false; 71 }, 72 initSearchConditions: function () { 73 this.shop = 0; 74 this.staff = 0; 75 this.label = null; 76 this.size = []; 77 this.feature = null; 78 this.ss_pageindex = null; 79 this.ss_pageindex_article = null; 80 81 this.getArticles(); 82 }, 83 pushHistory: function(){ 84 var params = this.searchConditions; 85 const _self = this; 86 87 let queryStringArray = []; 88 Object.keys(params).forEach( 89 function(i) { 90 if(params[i] === false || params[i] === 0 || (params[i] != '' && params[i] !== null && params[i] !== undefined)) { 91 queryStringArray.push(i + '=' + encodeURI(params[i])); 92 if(i == "tag_id"){ 93 var query_tag_name = ""; 94 _self.selected_tags.forEach((tag) => { query_tag_name += tag.tag_name + ","}); 95 queryStringArray.push("tag_name=" + encodeURI(query_tag_name.slice(0,-1))); 96 } 97 } 98 } 99 ); 100 if(location.href != location.href.substr(0, location.href.indexOf('?')) + '?' + queryStringArray.join('&')){ 101 history.pushState(null, null, location.pathname + '?' + queryStringArray.join('&')); 102 } 103 }, 104 Search: function(){ 105 const _self = this; 106 107 _self.shop = 0; 108 _self.staff = 0; 109 _self.label = null; 110 _self.size = []; 111 _self.feature = null; 112 _self.ss_pageindex = null; 113 _self.ss_pageindex_article = null; 114 115 if (_option) { 116 Object.keys(_option).forEach( 117 function(i) { 118 if (i in _self) { 119 _self[i] = _option[i]; 120 } 121 } 122 ); 123 } 124 const queryParams = ecblib.staffstart.util.queryParams(); 125 if(Object.keys(queryParams).length > 0){
126 Object.keys(queryParams).forEach( 127 function(i) { 128 switch (i){ 129 case "shop_code": 130 _self.shop = queryParams[i]; 131 break; 132 case "label_code": 133 _self.label = queryParams[i]; 134 break; 135 case "size": 136 _self.size = queryParams[i].split(","); 137 break; 138 case "feature": 139 _self.feature = queryParams[i]; 140 break; 141 case "tag_id": 142 var obj = []; 143 queryParams[i].split(",").forEach((id, index) => { 144 obj.push({tag_id : id, tag_name : queryParams["tag_name"].split(",")[index]}); 145 }); 146 _self.selected_tags = obj; 147 break; 148 case "sort": 149 _self.sort_type = queryParams[i]; 150 break; 151 default: 152 if (i in _self) { 153 _self[i] = queryParams[i]; 154 } 155 } 156 } 157 ); 158 } 159 this.getArticles(); 160 }, 161 }, 162 watch: { 163 'sort_type': function () { 164 this.getArticles(); 165 this.pushHistory(); 166 }, 167 'selected_tag': function () { 168 if(this.selected_tag && this.selected_tag.tag_id) { 169 const selectedId = (String)(this.selected_tag.tag_id).split(","); 170 selectedId.forEach((id, index) =>{ 171 if(!this.selected_tags.some(function(i) { return i.tag_id == id; })) { 172 this.selected_tags.push({tag_id: id, tag_name: (String)(this.selected_tag.tag_name).split(",")[index]}); 173 } 174 }); 175 this.getArticles(); 176 this.pushHistory(); 177 } 178 }, 179 'selected_tags': function () { 180 this.getArticles(); 181 this.pushHistory(); 182 }, 183 }, 184 }); 185 }; 186})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.