梁航:我的匹配接口

This commit is contained in:
hot777zz
2023-11-16 18:16:49 +08:00
parent 126a39edf8
commit 209b3cc1cd
3 changed files with 43 additions and 24 deletions

View File

@@ -1,45 +1,48 @@
<template> <template>
<view> <view>
<view class="avatar"> <view class="avatar">
<u-avatar @click="changeAvatar()" :src="avatar"></u-avatar> <u-avatar @click="changeAvatar()" :src="Info.avatar"></u-avatar>
</view> </view>
<view class="name-edit"> <view class="name-edit">
<text>用户名</text> <text>用户名</text>
<u-input border="surround" v-model="username"></u-input> <u-input border="surround" v-model="Info.username"></u-input>
</view> </view>
<view class="send"> <view class="send">
<u-button @click="editInfo" color="linear-gradient(to right, #E86262, #CC3333)">提交</u-button> <u-button @click="editInfo(Info)" color="linear-gradient(to right, #E86262, #CC3333)">提交</u-button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data(){
return { return {
username:'', Info:{
avatar:'' avatar:[],
username:''
}
} }
}, },
methods: { methods: {
changeAvatar(){ changeAvatar(){
// uni.uploadFile() uni.chooseImage({
console.log(111); success: (chooseImageRes) => {
this.Info.avatar = chooseImageRes.tempFilePaths.toString() ;
}
});
}, },
editInfo(){ editInfo(data){
this.$api.editPersonInfo({ let resdata=JSON.stringify(data);
nickname:this.$data.nickname, this.$api.editPersonInfo(resdata).then(res => {
avatar:this.$data.avatar, console.log(resdata);
Headers:wx.getStorageSync('token') console.log(res)
}).then(res => {
console.log(res);
}) })
} },
}, },
onLoad() { onLoad() {
let that = this let that = this
this.$data.username = wx.getStorageSync('nickname') this.$data.Info.username = wx.getStorageSync('nickname')
this.$data.avatar = wx.getStorageSync('avatar') this.$data.Info.avatar = wx.getStorageSync('avatar')
} }
} }

View File

@@ -23,10 +23,17 @@
data() { data() {
return { return {
titletext:'', titletext:'',
listId:'' listId:'',
matchList:[]
} }
}, },
methods: { methods: {
getMatch(){
this.$api.getMyMatch().then(res => {
this.macthList = res.data.data
console.log(res);
})
}
}, },
onLoad: function (option) { onLoad: function (option) {
@@ -47,9 +54,10 @@
if(this.titletext == '发布的店铺出租'){ if(this.titletext == '发布的店铺出租'){
this.listId = 3 this.listId = 3
} }
if(this.titletext == '我的匹配') if(this.titletext == '我的匹配'){
this.listId = 4 this.listId = 4
this.getMatch()
}
}, },
computed:{ computed:{

View File

@@ -69,7 +69,7 @@ const service = {
header['content-type'] = 'application/x-www-form-urlencoded' header['content-type'] = 'application/x-www-form-urlencoded'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
method: 'put', method: 'post',
url: serverHost + url, url: serverHost + url,
data: data, data: data,
header: header, header: header,
@@ -203,10 +203,18 @@ const apiService = {
resolve(service.get(url)) resolve(service.get(url))
}) })
}, },
//修改个人信息
editPersonInfo(data){ editPersonInfo(data){
const url = `/center/userupdate` const url = `center/userupdate`
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
resolve(service.post(url,data)) resolve(service.putWithFormData(url,data))
})
},
//获取我的匹配
getMyMatch(){
const url = `/center/match/`
return new Promise((resolve,reject) => {
resolve(service.get(url))
}) })
} }
} }