This commit is contained in:
yanran200730
2022-11-08 19:00:14 +08:00
parent e29568c97d
commit 0bf5bbf217
3 changed files with 27 additions and 16 deletions

View File

@@ -118,7 +118,6 @@
}, },
success: (res) => { success: (res) => {
const data = JSON.parse(res.data) const data = JSON.parse(res.data)
console.log(data)
if (data.code === 0) { if (data.code === 0) {
this.photoUrl = data.data[0].split(';')[0] this.photoUrl = data.data[0].split(';')[0]

View File

@@ -6,36 +6,36 @@
<h2>头像</h2> <h2>头像</h2>
<div class="form-item__right"> <div class="form-item__right">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'"></image> <image class="avatar" :src="userInfo.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'"></image>
</button> </button>
</div> </div>
</div> </div>
<div class="form-item"> <div class="form-item">
<h2>昵称</h2> <h2>昵称</h2>
<div class="form-item__right"> <div class="form-item__right">
<input placeholder="请输入昵称" type="nickname" v-model="user.nickName" /> <input placeholder="请输入昵称" type="nickname" v-model="userInfo.nickName" />
</div> </div>
</div> </div>
<div class="form-item"> <div class="form-item">
<h2>手机号</h2> <h2>手机号</h2>
<div class="form-item__right"> <div class="form-item__right">
<input placeholder="请输入手机号" type="number" maxlength="11" v-model="user.phone" /> <input placeholder="请输入手机号" type="number" maxlength="11" v-model="userInfo.phone" />
</div> </div>
</div> </div>
<div class="form-item"> <div class="form-item">
<h2>所在社区</h2> <h2>所在社区</h2>
<picker :range="sqList" range-key="dictName" @change="e => (user.sssq = sqList[e.detail.value].dictName)"> <picker :range="sqList" range-key="dictName" @change="e => (userInfo.sssq = sqList[e.detail.value].dictName)">
<div class="form-item__right"> <div class="form-item__right">
<span :style="{color: user.sssq ? '#333' : '#999'}">{{ user.sssq ? user.sssq : '请输入所在社区' }}</span> <span :style="{color: userInfo.sssq ? '#333' : '#999'}">{{ userInfo.sssq ? userInfo.sssq : '请输入所在社区' }}</span>
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" /> <image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div> </div>
</picker> </picker>
</div> </div>
<div class="form-item"> <div class="form-item">
<h2>所在小区</h2> <h2>所在小区</h2>
<picker :range="xqList" range-key="dictName" @change="e => (user.szxq = xqList[e.detail.value].dictName)"> <picker :range="xqList" range-key="dictName" @change="e => (userInfo.szxq = xqList[e.detail.value].dictName)">
<div class="form-item__right"> <div class="form-item__right">
<span :style="{color: user.szxq ? '#333' : '#999'}">{{ user.szxq ? user.szxq : '请输入所在小区' }}</span> <span :style="{color: userInfo.szxq ? '#333' : '#999'}">{{ userInfo.szxq ? userInfo.szxq : '请输入所在小区' }}</span>
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" /> <image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div> </div>
</picker> </picker>
@@ -77,29 +77,29 @@
methods: { methods: {
save () { save () {
if (!this.user.avatarUrl) { if (!this.userInfo.avatarUrl) {
return this.$toast('请上传头像') return this.$toast('请上传头像')
} }
if (!this.user.nickName) { if (!this.userInfo.nickName) {
return this.$toast('请输入昵称') return this.$toast('请输入昵称')
} }
if (!this.user.phone) { if (!this.userInfo.phone) {
return this.$toast('请输入手机号') return this.$toast('请输入手机号')
} }
if (!this.user.sssq) { if (!this.userInfo.sssq) {
return this.$toast('请选择所在社区') return this.$toast('请选择所在社区')
} }
if (!this.user.szxq) { if (!this.userInfo.szxq) {
return this.$toast('请选择所在小区') return this.$toast('请选择所在小区')
} }
this.$loading() this.$loading()
this.$instance.post('/api/appwechatuser/update-nickName', null, { this.$instance.post('/api/appwechatuser/update-nickName', null, {
params: { params: {
...this.user ...this.userInfo
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {

View File

@@ -20,6 +20,7 @@
export default { export default {
appName: '文明广场', appName: '文明广场',
name: 'AppSquare', name: 'AppSquare',
enablePullDownRefresh: true,
data () { data () {
return { return {
@@ -58,7 +59,10 @@
}, },
getList () { getList () {
if (this.isMore) return if (this.isMore) {
uni.stopPullDownRefresh()
return
}
this.$loading() this.$loading()
this.$instance.post(`/api/appwechatescalation/list`, null, { this.$instance.post(`/api/appwechatescalation/list`, null, {
@@ -72,6 +76,7 @@
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$hideLoading() this.$hideLoading()
uni.stopPullDownRefresh()
if (this.current > 1) { if (this.current > 1) {
this.list = [...this.list, ...res.data.records] this.list = [...this.list, ...res.data.records]
} else { } else {
@@ -89,6 +94,7 @@
this.isMore = true this.isMore = true
} }
}).catch(() => { }).catch(() => {
uni.stopPullDownRefresh()
this.$hideLoading() this.$hideLoading()
}) })
} }
@@ -96,7 +102,13 @@
onReachBottom () { onReachBottom () {
this.getList() this.getList()
} },
onPullDownRefresh() {
this.isMore = false
this.current = 1
this.getList()
},
} }
</script> </script>