123456789101112131415161718192021222324 |
- const CODE_KEY = 'WECHAT_CODE'
- export function setCode(code){
- window.localStorage.setItem(CODE_KEY,code || '')
- }
- export function getCode(){
- return window.localStorage.getItem(CODE_KEY) || ''
- }
- export function removeCode(){
- return window.localStorage.removeItem(CODE_KEY)
- }
- export function getParameterByName(name) {
- var url = window.location.href;
- name = name.replace(/[\[\]]/g, '\\$&');
- var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
- var results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- }
|