支付成功,登录

msb_beta
ch 4 years ago
parent 8797381ba2
commit 6d8fc49aca

@ -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,

@ -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});
}
}

@ -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();

@ -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
-->
<template>
<button class="btn" :class="`btn__${type}`"><slot></slot></button>
<button class="btn" :class="`btn__${type}`" @click="$emit('click')"><slot></slot></button>
</template>
<script>
export default {
props : {
type : String,
default : 'line'
type : {
type : String,
default : 'line' //gradual solid line线 primaryLine
}
}
}
</script>
@ -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;
}
}
</style>

@ -75,7 +75,9 @@
},
"devServer" : {
"proxy" : {
"/user/" : "http://192.168.31.102:4500/"
"/user/" : {
"target": "http://192.168.31.102:4500/"
}
}
}
}

@ -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": {

@ -0,0 +1,45 @@
<!--
* @Author: ch
* @Date: 2022-03-28 17:16:44
* @LastEditors: ch
* @LastEditTime: 2022-03-28 17:35:10
* @Description: file content
-->
<template>
<view>
<image class="icon" src="@/static/order/payFail.png"/>
<view class="title">支付失败</view>
<view class="desc">请重新试试</view>
<UiButton class="btn">返回商品详情</UiButton>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
export default {
components: { UiButton },
}
</script>
<style lang="scss" scoped>
page{
text-align: center;
}
.icon{
width: 400rpx;
height: 256rpx;
margin: 169rpx auto 42rpx;
}
.title{
font-size: 32rpx;
line-height: 44rpx;
color: #333;
}
.desc{
font-size: 24rpx;
line-height: 34rpx;
color: #999;
}
.btn{
margin-top: 74rpx;
}
</style>

@ -0,0 +1,50 @@
<!--
* @Author: ch
* @Date: 2022-03-28 17:16:44
* @LastEditors: ch
* @LastEditTime: 2022-03-28 17:45:51
* @Description: file content
-->
<template>
<view>
<image class="icon" src="@/static/order/paySuccess.png"/>
<view class="title">支付成功</view>
<view class="desc">您的包裹整装待发</view>
<view class="btns">
<UiButton class="btn" type="primaryLine">返回首页</UiButton>
<UiButton class="btn" type="solid">查看订单</UiButton>
</view>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
export default {
components: { UiButton },
}
</script>
<style lang="scss" scoped>
page{
text-align: center;
}
.icon{
width: 400rpx;
height: 256rpx;
margin: 169rpx auto 42rpx;
}
.title{
font-size: 32rpx;
line-height: 44rpx;
color: #333;
}
.desc{
font-size: 24rpx;
line-height: 34rpx;
color: #999;
}
.btns{
margin: 74rpx 105rpx 0;
display: flex;
justify-content: space-between;
}
</style>

@ -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
-->
<template>
@ -23,7 +23,7 @@
@click="getCode">{{tips}}</text>
</u-form-item>
</u--form>
<UiButton class="login--btn" @click="login"></UiButton>
<UiButton class="login--btn" type="gradual" @click="login"></UiButton>
<label class="login--agreement">
<radio class="radio" :checked="checked" @click="checked = !checked" color="#FF875B"/>
同意<text class="link">用户协议</text><text class="link">隐私协议</text>,首次登陆将自动注册
@ -45,6 +45,8 @@ export default {
code : ''
}
},
mounted(){
},
methods : {
codeChange(text) {
this.tips = text;
@ -63,7 +65,7 @@ export default {
const {error, resutl} = await ApiGetCode({phone: this.phone});
uni.hideLoading();
if(error){
uni.$u.toast(error.msg);
uni.$u.toast(error.message);
return false;
}
uni.$u.toast('验证码已发送');
@ -89,10 +91,10 @@ export default {
source : 0
});
if(error){
uni.$u.toast(error.msg);
uni.$u.toast(error.message);
return false;
}
this.$Router.back();
this.$Router.replace('/');
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Loading…
Cancel
Save