下拉刷新更新

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

@ -41,3 +41,13 @@ export const forgetPwd = (data) => {
})
}
/**
* 绑定
*/
export const bind = (data) => {
return http.request({
url: '/Login/registerCode',
method: 'POST',
params: data
})
}

View File

@ -1,27 +1,26 @@
<template>
<view class="containerView">
<view class="cu-form-group"
style="margin: 30upx;border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<view class="cu-form-group" >
<view class="title">手机号</view>
<input type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
<input type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
</view>
<view class="cu-form-group"
style="margin: 30upx;border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<view class="cu-form-group" >
<text class="title">验证码</text>
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange"
<input type="number" :value="data.code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange"
@confirm="toLogin" />
<button class="send-msg" @click="sendMsg" :disabled="sendIng">{{ sendTime }}</button>
<button class="send-msg" @click="sendMsg" :disabled="data.sendIng">{{ data.sendTime }}</button>
</view>
<button class="confirm-btn" @click="toLogin" :disabled="loginIng">立即绑定</button>
<button class="confirm-btn" @click="toLogin">立即绑定</button>
</view>
</template>
<script>
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import {setSendMsg,forgetPwd} from '@/api/login/login.js';
import { setSendMsg, bind} from '@/api/login/login.js';
let data = reactive({
mobile: '',
code: '',
@ -30,8 +29,7 @@
sendTime: '获取验证码',
count: 60,
type: '',
})
})
onLoad((option) => {
if (option.type) {
data.type = option.type
@ -55,113 +53,116 @@
data.count = count - 1;
data.sendIng = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
setTimeout(countDown.bind(this), 1000);
}
}
function sendMsg() {
const {
mobile
} = data;
if (!mobile) {
data.$queue.showToast("请输入手机号");
async function sendMsg() {
const { mobile } = data;
if (!data.mobile) {
uni.showToast({ title: '请输入手机号', icon: 'none', })
} else if (mobile.length !== 11) {
data.$queue.showToast("请输入正确的手机号");
uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
} else {
data.$queue.showLoading("正在发送验证码...");
http.request({
url: 'app/Login/sendMsg/' + mobile + '/gzg',
}).then(res => {
if (res.code === 0) {
data.sendIng = true;
uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
data.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
uni.showLoading({
title: '正在发送验证码...'
})
let res = await setSendMsg(data.mobile,'gzg')
uni.hideLoading();
console.log(res)
if (res.code == 0) {
data.sendIng = true;
uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
}
}
function toLogin() {
async function toLogin() {
const {
mobile,
code
} = data;
let userId = this.$queue.getData("userId");
if (!mobile) {
if (!data.mobile) {
uni.showToast({ title: '请输入手机号', icon: 'none', })
} else if (mobile.length !== 11) {
} else if (data.mobile.length !== 11) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
} else if (!code) {
} else if (!data.code) {
uni.showToast({ title: '请输入验证码', icon: 'none', })
} else {
uni.showLoading({ title: '正在绑定中...' })
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
'';
let openidheadimgurl = this.$queue.getData('openidheadimgurl') ? this.$queue.getData(
'openidheadimgurl') : '';
let invitation = this.$queue.getData('inviterCode') ? this.$queue.getData('inviterCode') : '';
let userId = this.$queue.getData('userId') ? this.$queue.getData('userId') : '';
http.request({
url: `app/Login/registerCode`,
method: 'post',
data: {
let res = await bind({
phone: mobile,
wxId: openId,
userId: userId,
inviterCode: invitation,
avatar: openidheadimgurl,
userName: openidnickname,
// wxId: openId,
// userId: userId,
// inviterCode: invitation,
// avatar: openidheadimgurl,
// userName: openidnickname,
msg: code
}
}).then(res => {
if (res.code === 0) {
this.$queue.setData("token", res.token);
this.$queue.setData('userId', res.user.userId);
this.$queue.setData('userName', res.user.userName);
this.$queue.setData('phone', res.user.phone);
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
'../../static/logo.png');
this.$queue.showToast('绑定成功');
uni.showToast({ title: '绑定成功', icon: 'none', })
setTimeout(function() {
uni.navigateBack()
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '绑定失败',
content: res.msg,
});
}
uni.hideLoading();
});
})
uni.hideLoading();
uni.setStorageSync('token', res.token)
uni.setStorageSync('userInfo', res.user)
uni.showToast({ title: '绑定成功', icon: 'none', })
setTimeout(function() {
uni.navigateBack()
}, 1000)
}
}
</script>
<style lang='scss'>
<style lang='scss' scoped>
page {
background: #ffffff;
}
.cu-form-group{
background-color: #ffffff;
padding: 1rpx 30rpx;
display: flex;
align-items: center;
min-height: 80rpx;
justify-content: space-between;
margin: 30rpx;
border: 2rpx solid whitesmoke;
margin-bottom: 40rpx;
border-radius: 60rpx
}
.title{
text-align: justify;
padding-right: 30rpx;
font-size: 30rpx;
position: relative;
height: 60rpx;
line-height: 60rpx;
flex-shrink: 0;
}
uni-input{
flex: 1;
font-size: 15px;
color: #555;
padding-right: 10px;
}
.send-msg {
border-radius: 30px;
color: white;
height: 30px;
font-size: 14px;
line-height: 30px;
background: #557EFD;
border-radius: 30px;
color: white;
height: 30px;
font-size: 14px;
line-height: 30px;
background: #ff7581;
}
.containerView {
@ -178,14 +179,14 @@
.confirm-btn {
width: 600upx;
height: 80upx;
line-height: 80upx;
border-radius: 60upx;
margin-top: 32upx;
background: #557EFD;
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70px;
background: #ff7581;
color: #ffffff;
font-size: 32upx;
font-size: 16px;
&:after {
border-radius: 60px;

View File

@ -74,7 +74,7 @@
title: '验证码发送成功请注意查收',
icon: 'none',
})
data.countDown();
countDown();
} else {
uni.showModal({
showCancel: false,
@ -98,7 +98,7 @@
data.count = count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
setTimeout(countDown.bind(this), 1000);
}
}

View File

@ -81,13 +81,11 @@
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (data.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
@ -103,7 +101,7 @@
icon: 'none',
duration: 1000
})
data.countDown();
countDown();
} else {
uni.showModal({
showCancel: false,
@ -130,7 +128,7 @@
data.count = count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
setTimeout(countDown.bind(this), 1000);
}
}

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>

View File

@ -5,10 +5,10 @@
<up-image src="/static/share/share-bg.png" alt="" width="100%" mode="widthFix"></up-image>
<view class="top-title">
<view>
<up-image src="/static/share/title.png" alt="" width="544rpx" mode="widthFix"></up-image>
<up-image src="/static/share/title.png" alt="" width="550rpx" height="92rpx" mode="widthFix"></up-image>
</view>
<view style="padding-right:70rpx;justify-content: flex-end">
<up-image src="/static/share/rule.png" alt="" width="400rpx" mode="widthFix"></up-image>
<up-image src="/static/share/rule.png" alt="" width="430rpx" height="92rpx" mode="widthFix"></up-image>
</view>
</view>
@ -101,7 +101,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 { updateUser } from '@/api/me/withdraw.js';
import { selectInviteMoney, selectInviteByUserIdLists, selectBannerList } from '@/api/share/index.js';
import { commonType } from '@/api/init.js';
@ -329,14 +329,15 @@
});
}
// onReachBottom() {
// if(data.isEnd||data.loading){
// return
// }
// data.page+=1
// getInviter()
// }
onReachBottom(() => {
if(data.isEnd||data.loading){
return
}
data.page+=1
getInviter()
})
</script>