-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af52891
commit ab79b1d
Showing
12 changed files
with
288 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.page-search{ | ||
width: 80%; | ||
margin: 0 auto; | ||
} | ||
|
||
.page-search .search-result-list{ | ||
width: 70%; | ||
} | ||
|
||
.page-search .search-result-list .list-item{ | ||
|
||
} | ||
|
||
.page-search .search-result-list .item-img{ | ||
width:160px; | ||
height:220px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
export { }; | ||
// serialize data e.g. {a:"abc",b:"123"} -> "a=abc&b=123" | ||
export function serialize(data: any, isTraditional: boolean = false): string { | ||
let arr = []; | ||
if (typeof data == "object") { | ||
for (let key in data) { | ||
if (data[key] != null) { | ||
let item = data[key]; | ||
if (isTraditional && item instanceof Array) { | ||
arr.push(item.map(function (field) { | ||
return encodeURIComponent(key) + "=" + encodeURIComponent(field); | ||
}).join("&")); | ||
} else { | ||
arr.push(encodeURIComponent(key) + "=" + encodeURIComponent(item)); | ||
} | ||
} | ||
} | ||
return arr.join("&"); | ||
} | ||
return ''; | ||
} | ||
/** | ||
* reverse serialize data e.g. "a=abc&b=123" -> {"a":"abc","b":"123"} | ||
* @param {string} str | ||
* @param {boolean} isTraditional if true e.g. "a=abc&b=123&b=456" -> {"a":"abc","b":["123","456"]} | ||
*/ | ||
export function reSerialize(str: string, isTraditional = true): object { | ||
let s = decodeURIComponent(str); | ||
|
||
return s.split("&").reduce(function (prev:any, cur) { | ||
let flag = cur.indexOf("="); | ||
let key = cur.slice(0, flag); | ||
let val = cur.slice(flag + 1); | ||
|
||
if (isTraditional) { | ||
if (prev[key]) { | ||
prev[key] instanceof Array ? prev[key].push(val) : prev[key] = [prev[key], val]; | ||
} else { | ||
prev[key] = val; | ||
} | ||
} else { | ||
prev[key] = val; | ||
} | ||
|
||
return prev; | ||
}, {}); | ||
} |
Oops, something went wrong.