梁航:我的匹配接口

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>
<view>
<view class="avatar">
<u-avatar @click="changeAvatar()" :src="avatar"></u-avatar>
<u-avatar @click="changeAvatar()" :src="Info.avatar"></u-avatar>
</view>
<view class="name-edit">
<text>用户名</text>
<u-input border="surround" v-model="username"></u-input>
<u-input border="surround" v-model="Info.username"></u-input>
</view>
<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>
</template>
<script>
export default {
data() {
data(){
return {
username:'',
avatar:''
Info:{
avatar:[],
username:''
}
}
},
methods: {
changeAvatar(){
// uni.uploadFile()
console.log(111);
},
editInfo(){
this.$api.editPersonInfo({
nickname:this.$data.nickname,
avatar:this.$data.avatar,
Headers:wx.getStorageSync('token')
}).then(res => {
console.log(res);
})
uni.chooseImage({
success: (chooseImageRes) => {
this.Info.avatar = chooseImageRes.tempFilePaths.toString() ;
}
});
},
editInfo(data){
let resdata=JSON.stringify(data);
this.$api.editPersonInfo(resdata).then(res => {
console.log(resdata);
console.log(res)
})
},
},
onLoad() {
let that = this
this.$data.username = wx.getStorageSync('nickname')
this.$data.avatar = wx.getStorageSync('avatar')
this.$data.Info.username = wx.getStorageSync('nickname')
this.$data.Info.avatar = wx.getStorageSync('avatar')
}
}

View File

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

View File

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