diff --git a/src/core/config.js b/src/core/config.js index f647726..6c9105e 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -1,4 +1,5 @@ const config = { + release: true, storagePrefix: "user_", appId: "wx239055764f21ba10", root: "https://www.anzhuangxiong.com/api.php" diff --git a/src/core/libs/utils.js b/src/core/libs/utils.js index b163c43..9860d8f 100644 --- a/src/core/libs/utils.js +++ b/src/core/libs/utils.js @@ -1,4 +1,5 @@ import $storage from '@/core/storage' +import $config from '@/core/config' function time() { return parseInt(Math.round(new Date() / 1000)); @@ -302,6 +303,12 @@ function callPhone(phoneNumber) { }); } +function modelExceptionHandler(exception) { + if (!$config.release) { + toast(exception); + } +} + export default { time, datetime, @@ -319,4 +326,5 @@ export default { isType, getUrlParams, callPhone, + modelExceptionHandler, } diff --git a/src/core/models/appraise.js b/src/core/models/appraise.js index a7ed702..8f231b9 100644 --- a/src/core/models/appraise.js +++ b/src/core/models/appraise.js @@ -15,7 +15,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, worker(id) { @@ -30,7 +32,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); } }, @@ -63,7 +67,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -94,7 +100,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); } }, diff --git a/src/core/models/cart.js b/src/core/models/cart.js index d8ce7d1..7159dbd 100644 --- a/src/core/models/cart.js +++ b/src/core/models/cart.js @@ -37,7 +37,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -55,7 +57,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -70,7 +74,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); } } diff --git a/src/core/models/order.js b/src/core/models/order.js index 36dfcb8..7e90ca3 100644 --- a/src/core/models/order.js +++ b/src/core/models/order.js @@ -59,7 +59,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -80,7 +82,9 @@ export default { }, }); } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -174,7 +178,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -289,7 +295,9 @@ export default { return resolve(order); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -308,7 +316,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -321,7 +331,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -334,7 +346,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -347,7 +361,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -360,7 +376,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -373,7 +391,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, } diff --git a/src/core/models/service.js b/src/core/models/service.js index 587754f..07e9f9a 100644 --- a/src/core/models/service.js +++ b/src/core/models/service.js @@ -49,7 +49,9 @@ export default { let money = parseFloat(response.data.money); resolve(money > 0 ? money : 0) } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -67,7 +69,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }) }, /** @@ -83,7 +87,9 @@ export default { return resolve(response.msg) } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -99,7 +105,9 @@ export default { return resolve(response.msg) } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -115,7 +123,9 @@ export default { return resolve(response.msg) } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -131,7 +141,9 @@ export default { return resolve(response); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -149,7 +161,9 @@ export default { }); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, distributionCar() { @@ -168,7 +182,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -184,7 +200,9 @@ export default { return resolve(response.data); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, } diff --git a/src/core/models/system.js b/src/core/models/system.js index b4d0e42..af85485 100644 --- a/src/core/models/system.js +++ b/src/core/models/system.js @@ -59,7 +59,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -75,7 +77,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -122,7 +126,9 @@ export default { }); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); } } diff --git a/src/core/models/user.js b/src/core/models/user.js index 0e60fe2..fd247b7 100644 --- a/src/core/models/user.js +++ b/src/core/models/user.js @@ -66,7 +66,9 @@ export default { } else { return reject(response.msg); } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -98,7 +100,9 @@ export default { } else { return reject(response.msg); } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -114,7 +118,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -136,7 +142,9 @@ export default { return resolve(list); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -169,7 +177,9 @@ export default { } else { return reject(response.msg); } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -198,7 +208,9 @@ export default { } else { return reject(response.msg); } - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** @@ -219,7 +231,9 @@ export default { return resolve(response.msg); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); }, /** diff --git a/src/core/models/worker.js b/src/core/models/worker.js index 7ad532f..3f80be1 100644 --- a/src/core/models/worker.js +++ b/src/core/models/worker.js @@ -41,7 +41,9 @@ export default { return resolve(worker); } return reject(response.msg); - }).catch(e => { }); + }).catch(e => { + prototype.$utils.modelExceptionHandler(e); + }); }); } }