下拉刷新更新

This commit is contained in:
GaoHao
2025-01-08 16:18:20 +08:00
parent c8dbc0f550
commit 7cbadc5638
9 changed files with 167 additions and 166 deletions

View File

@@ -13,13 +13,13 @@
<view class="text-gray">{{item.content}}</view>
</view>
</view>
<emprty-card v-if="!data.msgList.length" />
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import { onLoad,onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { selectMessageByUserId } from '@/api/me/message.js';
let data = reactive({
@@ -42,26 +42,25 @@
state: 5
}
let res = await selectMessageByUserId(params)
console.log(res)
uni.hideLoading()
uni.stopPullDownRefresh();
if (data.page === 1) {
if (data.page == 1) {
data.msgList = res.list
uni.stopPullDownRefresh();
return
}
data.msgList = [...data.msgList, ...res.list]
}
// function onReachBottom () {
// data.page = data.page + 1;
// getMsg()
// }
// function onPullDownRefresh () {
// data.page = 1;
// // this.msgList = []
// getMsg()
// }
onReachBottom(() => {
data.page = data.page + 1;
getMsg()
})
onPullDownRefresh(() => {
data.page = 1;
data.msgList = []
getMsg()
})
</script>
<style lang="scss" scoped>

View File

@@ -7,9 +7,6 @@
<up-cell title="支付宝账号">
<template #right-icon> <up-input border="none" v-model="data.zhiFuBao" placeholder="请输入要绑定的支付宝手机号"></up-input> </template>
</up-cell>
<up-cell title="身份证号码">
<template #right-icon> <up-input border="none" v-model="data.certNum" placeholder="请输入要绑定身份证号码"></up-input> </template>
</up-cell>
</up-cell-group>
<button :class="data.zhiFuBao&&data.zhiFuBaoName?'confirm-btn':'confirm-btn1'" @click="toLogin"
:disabled="logining">绑定账户</button>
@@ -30,14 +27,12 @@
let data = reactive({
zhiFuBao: '',
zhiFuBaoName: '',
certNum: '',
logining: false
})
onLoad(() => {
this.zhiFuBao = uni.getStorageSync('userInfo').zhiFuBao;
this.zhiFuBaoName = uni.getStorageSync('userInfo').zhiFuBaoName;
this.certNum = uni.getStorageSync('userInfo').certNo;
})
function inputChange(e) {
@@ -46,9 +41,6 @@
}
async function toLogin() {
console.log(data.zhiFuBaoName)
console.log(data.zhiFuBao)
console.log(data.certNum)
if (!data.zhiFuBaoName) {
uni.showToast({
@@ -60,24 +52,17 @@
title: '请设置收款人支付宝账号',
icon: 'none'
})
} else if (!data.certNum) {
uni.showToast({
title: '请设置收款人身份证账号',
icon: 'none'
})
} else {
data.logining = true
let res = await updateUser({
zhiFuBao: data.zhiFuBao,
certName: data.zhiFuBaoName,
certNum: data.certNum,
})
if( res) {
data.logining = false
let userInfo = uni.getStorageSync('userInfo')
userInfo.zhiFuBao = data.zhiFuBao
userInfo.zhiFuBaoName = data.zhiFuBaoName
userInfo.certNo = data.certNum
uni.setStorageSync('userInfo', userInfo)
uni.showToast({
title: '修改成功',

View File

@@ -94,7 +94,7 @@
<script setup>
import { reactive, nextTick, ref } from 'vue';
import { onReady,onLoad,onShow } from '@dcloudio/uni-app'
import { onReady,onLoad,onShow,onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { selectUserMoney, selectPayDetails, canCash, state, withdraw } from '@/api/me/withdraw.js';
import { commonType } from '@/api/init.js';
@@ -144,18 +144,18 @@
})
getCanCash()
})
onReachBottom(() => {
if (data.page * data.limit < data.totalCount) {
data.page = data.page + 1;
data.getMoneyDetail();
}
})
onPullDownRefresh(() => {
data.page = 1;
data.list = []
data.getMoneyDetail();
})
// onReachBottom: function() {
// if (this.page * this.limit < this.totalCount) {
// this.page = this.page + 1;
// this.getMoneyDetail();
// }
// },
// onPullDownRefresh: function() {
// this.page = 1;
// // that.list = []
// this.getMoneyDetail();
// },
/**
* 获取看广告状态
*/
@@ -252,6 +252,9 @@
if (res.list.length > 0) {
data.list = [...data.list, ...res.list];
}
setTimeout(() => {
uni.stopPullDownRefresh();
}, 500);
})
}

View File

@@ -23,7 +23,7 @@
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import { onLoad,onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { queryUserMoneyDetails } from '@/api/me/withdraw.js';
let data = reactive({
@@ -59,19 +59,23 @@
if ( res.records.length > 0) {
data.list = [...data.list,...res.records];
}
setTimeout(() => {
uni.stopPullDownRefresh();
}, 500);
})
}
// onReachBottom: function() {
// if (this.page*this.limit < this.totalCount) {
// this.page = this.page + 1;
// this.getMoney();
// }
// }
// onPullDownRefresh: function() {
// this.page = 1;
// // that.list = []
// this.getMoney();
// }
onReachBottom(() => {
if (data.page*data.limit < data.totalCount) {
data.page = data.page + 1;
getMoney();
}
})
onPullDownRefresh(() => {
data.page = 1;
data.list = []
data.getMoney();
})
</script>
<style lang='scss' scoped>