diff --git a/common/api/index.js b/common/api/index.js index 4d31aa1..249e57c 100644 --- a/common/api/index.js +++ b/common/api/index.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 16:37:45 * @LastEditors: ch - * @LastEditTime: 2022-03-28 10:16:31 + * @LastEditTime: 2022-03-28 18:09:39 * @Description: file content */ @@ -15,9 +15,9 @@ import {Request, ToAsyncAwait} from '@/common/utils'; const ApiGetBannerData = (params) => ToAsyncAwait(Request.get('/edu-course/carousel/app',params)); -const ApiPostLogin = (data) => ToAsyncAwait(Request.post('/user/login'), data); +const ApiPostLogin = (data) => ToAsyncAwait(Request.post('/user/login', data)); -const ApiGetCode = (params) => ToAsyncAwait(Request.get('/user/login/verificationCode'), params); +const ApiGetCode = (params) => ToAsyncAwait(Request.get('/user/login/verificationCode', params)); export { ApiGetBannerData, diff --git a/common/plugins/msbUniRequest.js b/common/plugins/msbUniRequest.js index 0986f58..0e57e65 100644 --- a/common/plugins/msbUniRequest.js +++ b/common/plugins/msbUniRequest.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 16:36:59 * @LastEditors: ch - * @LastEditTime: 2022-03-28 10:47:00 + * @LastEditTime: 2022-03-28 18:16:44 * @Description: 针对uniapp request请求做了一次封装,使用思维参考axios * * @@ -62,12 +62,13 @@ class MsbUniRequest { throw new Error('没有请求配置,或是request拦截未做return'); } return new Promise((resolve, reject)=>{ - uni.request(option).then(response => { + uni.request(option).then(res => { + const response = res[1]; if(response.statusCode >= 200 && response.statusCode < 400){ - resolve(this.hook.success ? this.hook.success(response[1]) : response); + resolve(this.hook.success ? this.hook.success(response) : response); return false; } - reject(this.hook.error ? this.hook.error(response[1]) : response); + reject(this.hook.error ? this.hook.error(response) : response); }).catch(error => { reject(this.hook.error ? this.hook.error(error) : error); }); @@ -77,16 +78,17 @@ class MsbUniRequest { this.hook[hookName] = cb; } get(url, data, header){ - return this.method({method : 'get', url, data, header}); + console.log(data) + return this.method({method : 'GET', url, data, header}); } post(url, data, header){ - return this.method({method : 'post', url, data, header}); + return this.method({method : 'POST', url, data, header}); } put(url, data, header){ - return this.method({method : 'put', url, data, header}); + return this.method({method : 'PUT', url, data, header}); } delete(url, data){ - return this.method({method : 'delete', url, data, header}); + return this.method({method : 'DELETE', url, data, header}); } } diff --git a/common/utils/requset.js b/common/utils/requset.js index cd7a5ef..05280fb 100644 --- a/common/utils/requset.js +++ b/common/utils/requset.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 17:42:32 * @LastEditors: ch - * @LastEditTime: 2022-03-28 10:50:37 + * @LastEditTime: 2022-03-28 18:15:37 * @Description: 项目接口请求统一处理器,返回一个需要token和不需要token的请求封装方法 */ @@ -15,18 +15,22 @@ const BASE_URL = { 'prod' : '' }; const successIntercept = (response) =>{ + console.log(response) if(response.statusCode === 200){ const result = response.data; - if(result.code === 200){ + if(result.code === 'SUCCESS'){ return result.data; - }else{ + } + if(result.code === 'TOKEN_EXPIRE'){ + uni.navigateTo({url : '/login'}) return result; } + return Promise.reject(result); } return response; } const errorIntercept = (error) =>{ - return {msg:error.errMsg,code:error.statusCode} + return Promise.reject({message:error.errMsg,code:error.statusCode}) } // 不需要token的接口封装 const Request = new MsbUniRequest(); diff --git a/components/UiButton.vue b/components/UiButton.vue index 5232864..f295105 100644 --- a/components/UiButton.vue +++ b/components/UiButton.vue @@ -2,17 +2,19 @@ * @Author: ch * @Date: 2022-03-26 10:06:38 * @LastEditors: ch - * @LastEditTime: 2022-03-26 10:14:12 + * @LastEditTime: 2022-03-28 18:18:15 * @Description: file content --> @@ -20,17 +22,32 @@ export default { .btn{ display: inline-block; font-size: 28rpx; - height: 64rpx; - line-height: 64rpx; + height: 62rpx; + line-height: 62rpx; padding: 0 50rpx; text-align: center; border-radius: 50rpx; - background: linear-gradient(270deg, #FF7F39 0%, #FFA35B 100%); - color: #fff; + &__gradual{ + height: 64rpx; + line-height: 64rpx; + background: linear-gradient(270deg, #FF7F39 0%, #FFA35B 100%); + color: #fff; + } + &__solid{ + height: 64rpx; + line-height: 64rpx; + background: #FF875B; + color: #fff; + } &__line{ background: none; color: #333; border: 1px solid rgb(192, 185, 185); } + &__primaryLine{ + background: none; + color: #FF875B; + border: 1px solid #FF875B; + } } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 58ab021..807a9e4 100644 --- a/manifest.json +++ b/manifest.json @@ -75,7 +75,9 @@ }, "devServer" : { "proxy" : { - "/user/" : "http://192.168.31.102:4500/" + "/user/" : { + "target": "http://192.168.31.102:4500/" + } } } } diff --git a/pages.json b/pages.json index d28781f..1a028f1 100644 --- a/pages.json +++ b/pages.json @@ -3,6 +3,7 @@ "pages": [ { "path": "pages/index/index", + "aliasPath" : "/", "style": { "navigationStyle" : "custom", "backgroundColor" : "#69ADE5" @@ -118,6 +119,18 @@ "navigationBarTitleText": "uni-app" } }, + { + "path": "pages/account/order/paySuccess", + "style": { + "navigationBarTitleText": "支付成功" + } + }, + { + "path": "pages/account/order/payFail", + "style": { + "navigationBarTitleText": "支付失败" + } + }, { "path": "pages/account/order/list", "style": { diff --git a/pages/account/order/payFail.vue b/pages/account/order/payFail.vue new file mode 100644 index 0000000..343f00c --- /dev/null +++ b/pages/account/order/payFail.vue @@ -0,0 +1,45 @@ + + + + \ No newline at end of file diff --git a/pages/account/order/paySuccess.vue b/pages/account/order/paySuccess.vue new file mode 100644 index 0000000..0c9eedf --- /dev/null +++ b/pages/account/order/paySuccess.vue @@ -0,0 +1,50 @@ + + + + \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue index 393ff0c..32f3f79 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-22 15:36:46 * @LastEditors: ch - * @LastEditTime: 2022-03-28 11:06:34 + * @LastEditTime: 2022-03-28 18:28:04 * @Description: file content -->