支付接口调用

This commit is contained in:
duan
2024-05-21 16:59:31 +08:00
parent 07a6425ec4
commit 75ac4e967c
20 changed files with 512 additions and 245 deletions

View File

@@ -5,12 +5,20 @@
<view class="onecontent">
<view :style="[{'padding-top':HeighT.customBar +44+'px'}]"></view>
<view class="onecontentbox">
<image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image>
<!-- <button open-type="chooseAvatar" @chooseavatar="uploadImg">
<image class="onecontentboximage" :src="userHeadImg" mode=""></image>
</button> -->
<!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> -->
<button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg">
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 200rxp;height: 200rpx;"></view>
</button>
<view class="onecontentboxitem flex-between">
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="userName" type="text" placeholder="请输入昵称">
<input class="onecontentboxiteminput" v-model="userName" type="nickname" placeholder="请输入昵称">
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
@@ -65,43 +73,72 @@
}
},
methods: {
uploadImg() {
let _this = this
uni.chooseImage({
crop: {
width: 200,
height: 200
},
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: uni.conf.baseUrl + '/common/upload',
filePath: tempFilePaths[0],
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file: chooseImageRes.tempFiles[0],
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
},
})
// uploadImg() {
// let _this = this
// uni.chooseImage({
// crop: {
// width: 200,
// height: 200
// },
// success: (chooseImageRes) => {
// const tempFilePaths = chooseImageRes.tempFilePaths;
// uni.uploadFile({
// url: uni.conf.baseUrl + '/common/upload',
// filePath: tempFilePaths[0],
// header: {
// environment: 'app',
// type: 'android',
// version: '1.7.3',
// },
// name: "file",
// formData: {
// file: chooseImageRes.tempFiles[0],
// },
// success: (uploadFileRes) => {
// let {
// data
// } = JSON.parse(uploadFileRes.data)
// this.userHeadImg = data
// },
// });
// },
// })
// },
uploadImg(e) {
const {
avatarUrl
} = e.detail
console.log(e)
console.log(e.detail)
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file:avatarUrl,
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
},
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.userName
})
if(res.code == 0){
if (res.code == 0) {
uni.navigateBack()
}
}
@@ -180,4 +217,15 @@
}
}
}
.btn{
width: 200rpx;
height: 200rpx;
border-radius: 100%;
padding: 0;
>view{
width: 200rpx;
height: 200rpx;
border-radius: 100%;
}
}
</style>

View File

@@ -3,7 +3,7 @@
<view class="user-info-wrap" @click="clickinformation">
<view style="width: 108rpx; height: 108rpx;border-radius: 50%;">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill" >
:src="userInfo.headImg" mode="aspectFill">
</image>
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-else src="@/static/avatar.png"
mode="aspectFill">
@@ -42,7 +42,7 @@
userInfo: {},
shopInfo: {},
teblist: [],
list:[]
list: []
};
},
onLoad() {
@@ -55,7 +55,7 @@
}
},
methods: {
clickinformation(){
clickinformation() {
uni.pro.navigateTo('user/information')
},
//退出登录
@@ -118,6 +118,7 @@
} catch (e) {}
},
clickinfo(item, index) {
console.log(item, '调试121')
switch (item.jumpType) {
case 'scan': //特殊处理点击
switch (item.value) {
@@ -126,6 +127,9 @@
break;
}
break;
case 'scan_applet':
uni.navigateToMiniProgram(JSON.parse(item.value))
break
case 'relative': //内部页面
uni.pro.navigateTo(item.absUrl)
break;