Authored by ccbikai

扩展对象优化

@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 * 拦截跳转, 在这里给将要打开的页面设置一下 header 样式 2 * 拦截跳转, 在这里给将要打开的页面设置一下 header 样式
3 * @return {[type]} 3 * @return {[type]}
4 */ 4 */
5 -const $ = require('jquery');  
6 const yoho = require('yoho'); 5 const yoho = require('yoho');
7 const parse = require('yoho-qs/parse'); // 提供解析函数 6 const parse = require('yoho-qs/parse'); // 提供解析函数
8 7
@@ -232,7 +231,7 @@ const matchHeader = (path, qs, titleMap) => { @@ -232,7 +231,7 @@ const matchHeader = (path, qs, titleMap) => {
232 231
233 const intercept = (url) => { 232 const intercept = (url) => {
234 if (yoho.isApp) { 233 if (yoho.isApp) {
235 - let titleMap = $.extend({}, defaultTitleMap); 234 + let titleMap = Object.assign({}, defaultTitleMap);
236 let [path, qs] = url.split('?'); 235 let [path, qs] = url.split('?');
237 236
238 qs = parse(qs); 237 qs = parse(qs);
@@ -81,7 +81,7 @@ class Modal { @@ -81,7 +81,7 @@ class Modal {
81 } 81 }
82 } 82 }
83 83
84 -$.extend(Modal, { 84 +Object.assign(Modal, {
85 alert: (text, title)=> { 85 alert: (text, title)=> {
86 const modal = new Modal({ 86 const modal = new Modal({
87 text: text, 87 text: text,
@@ -23,11 +23,11 @@ function tip(param) { @@ -23,11 +23,11 @@ function tip(param) {
23 }; 23 };
24 24
25 if (typeof param === 'string') { 25 if (typeof param === 'string') {
26 - $.extend(viewData, { 26 + Object.assign(viewData, {
27 txt: param 27 txt: param
28 }); 28 });
29 } else { 29 } else {
30 - $.extend(viewData, param); 30 + Object.assign(viewData, param);
31 } 31 }
32 32
33 const tipView = `<div class="tip-box"><div class="tip">${viewData.txt}</div></div>`; 33 const tipView = `<div class="tip-box"><div class="tip">${viewData.txt}</div></div>`;
@@ -3,7 +3,7 @@ var $ = require('jquery'); @@ -3,7 +3,7 @@ var $ = require('jquery');
3 var interceptClick = require('common/intercept-click'); 3 var interceptClick = require('common/intercept-click');
4 4
5 $(() => { 5 $(() => {
6 - const header = $.extend({}, interceptClick.defaultTitleMap[1]); 6 + const header = Object.assign({}, interceptClick.defaultTitleMap[1]);
7 7
8 header.title.des = '关于'; 8 header.title.des = '关于';
9 yoho.updateNavigationBar({ 9 yoho.updateNavigationBar({
@@ -41,7 +41,7 @@ $(() => { @@ -41,7 +41,7 @@ $(() => {
41 }); 41 });
42 }); 42 });
43 43
44 - const header = $.extend({}, interceptClick.defaultTitleMap[3]); 44 + const header = Object.assign({}, interceptClick.defaultTitleMap[3]);
45 45
46 header.title.des = '意见反馈'; 46 header.title.des = '意见反馈';
47 header.right = { 47 header.right = {
1 -const $ = require('jquery');  
2 const yoho = require('yoho'); 1 const yoho = require('yoho');
3 const interceptClick = require('common/intercept-click'); 2 const interceptClick = require('common/intercept-click');
4 const Modal = require('common/modal'); 3 const Modal = require('common/modal');
@@ -19,7 +18,7 @@ exports.applySuccuss = function(type, applyId) { @@ -19,7 +18,7 @@ exports.applySuccuss = function(type, applyId) {
19 let kind = config[type]; 18 let kind = config[type];
20 19
21 let goStatusPage = function() { 20 let goStatusPage = function() {
22 - let header = $.extend({}, interceptClick.defaultTitleMap[1]); 21 + let header = Object.assign({}, interceptClick.defaultTitleMap[1]);
23 22
24 header.left.action = location.origin + '/me/return'; 23 header.left.action = location.origin + '/me/return';
25 header.title.des = `${kind.name}状态`; 24 header.title.des = `${kind.name}状态`;
@@ -26,7 +26,7 @@ const yoho = { @@ -26,7 +26,7 @@ const yoho = {
26 /** 26 /**
27 * storage 27 * storage
28 */ 28 */
29 - storage: window.localStorage, 29 + storage: window.localStorage || {},
30 30
31 /** 31 /**
32 * JS 与 APP 共享的对象 32 * JS 与 APP 共享的对象
@@ -214,7 +214,7 @@ @@ -214,7 +214,7 @@
214 } 214 }
215 }, 215 },
216 updateNavBar() { 216 updateNavBar() {
217 - const header = $.extend({}, interceptClick.defaultTitleMap[5]); 217 + const header = Object.assign({}, interceptClick.defaultTitleMap[5]);
218 218
219 header.defaultSelectedIndex = '1'; 219 header.defaultSelectedIndex = '1';
220 header.right.des = this.editmodel ? '完成' : '编辑'; 220 header.right.des = this.editmodel ? '完成' : '编辑';
@@ -229,7 +229,7 @@ @@ -229,7 +229,7 @@
229 } 229 }
230 }, 230 },
231 updateNavBar() { 231 updateNavBar() {
232 - const header = $.extend({}, interceptClick.defaultTitleMap[5]); 232 + const header = Object.assign({}, interceptClick.defaultTitleMap[5]);
233 233
234 header.defaultSelectedIndex = '0'; 234 header.defaultSelectedIndex = '0';
235 header.right.des = this.editmodel ? '完成' : '编辑'; 235 header.right.des = this.editmodel ? '完成' : '编辑';
@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 }, 99 },
100 methods: { 100 methods: {
101 updateNavBar() { 101 updateNavBar() {
102 - const header = $.extend({}, interceptClick.defaultTitleMap[2]); 102 + const header = Object.assign({}, interceptClick.defaultTitleMap[2]);
103 103
104 header.title.des = '订单详情'; 104 header.title.des = '订单详情';
105 setTimeout(() => { 105 setTimeout(() => {
@@ -272,6 +272,8 @@ @@ -272,6 +272,8 @@
272 yohoAPI.goPay({ 272 yohoAPI.goPay({
273 orderid: order.orderCode, 273 orderid: order.orderCode,
274 amount: order.amount 274 amount: order.amount
  275 + }, () => {
  276 + yohoAPI.storage.orderReload = true;
275 }); 277 });
276 }, 278 },
277 applyRefund() { 279 applyRefund() {
@@ -91,7 +91,6 @@ @@ -91,7 +91,6 @@
91 if (!document.hidden) { 91 if (!document.hidden) {
92 if (yohoAPI.storage.orderReload) { 92 if (yohoAPI.storage.orderReload) {
93 this.reload(); 93 this.reload();
94 - delete yohoAPI.storage.orderReload;  
95 } 94 }
96 } 95 }
97 }); 96 });
@@ -108,6 +107,8 @@ @@ -108,6 +107,8 @@
108 this.orderList = []; 107 this.orderList = [];
109 108
110 this.getOrderData(); 109 this.getOrderData();
  110 +
  111 + delete yohoAPI.storage.orderReload;
111 }, 112 },
112 getOrderData() { 113 getOrderData() {
113 this.busy = true; 114 this.busy = true;
@@ -254,6 +255,8 @@ @@ -254,6 +255,8 @@
254 yohoAPI.goPay({ 255 yohoAPI.goPay({
255 orderid: order.orderCode, 256 orderid: order.orderCode,
256 amount: order.amount 257 amount: order.amount
  258 + }, () => {
  259 + yohoAPI.storage.orderReload = true;
257 }); 260 });
258 }, 261 },
259 dropDown(elementId) { 262 dropDown(elementId) {