This commit is contained in:
duan 2025-01-14 11:41:40 +08:00
commit b9c8f40061
5 changed files with 76 additions and 38 deletions

View File

@ -5,9 +5,9 @@ import http from '@/http/http.js'
*/
export const login = (data) => {
return http.request({
url: '/Login/registerCode',
url: '/Login',
method: 'POST',
params: data
data: data
})
}
@ -23,11 +23,11 @@ export const setSendMsg = (mobile,type) => {
/**
* 注册
*/
export const register = (params) => {
export const register = (data) => {
return http.request({
url: '/Login/registerCode',
url: '/Login/register',
method: 'POST',
params: params
data: data
})
}

View File

@ -107,13 +107,13 @@ function commonsProcess(showLoading, httpReqCallback, isreturm) {
.catch((res) => {
if (res.status == 404) {
infoBox.showErrorToast("接口404").then(() => {});
infoBox.showToast("接口404").then(() => {});
reject();
return;
}
if (res.code == 401) {
infoBox.showErrorToast(res.message || "请登录").then(() => {
infoBox.showToast(res.message || "请登录").then(() => {
uni.redirectTo({
url: "/pages/login/login",
});
@ -121,18 +121,18 @@ function commonsProcess(showLoading, httpReqCallback, isreturm) {
});
}
if (res.code != 0) {
infoBox.showErrorToast(res.msg).then(() => {});
infoBox.showToast(res.msg).then(() => {});
reject();
}
if (res.code == 500) {
infoBox.showErrorToast(res.msg || "服务器异常").then(() => {});
infoBox.showToast(res.msg || "服务器异常").then(() => {});
reject();
}
reqFinishFunc(); // 请求完毕的动作
// 如果没有提示错误, 那么此处提示 异常。
if (!isShowErrorToast) {
infoBox.showErrorToast(`请求网络异常`);
infoBox.showToast(`请求网络异常`);
}
return Promise.reject(res);
@ -233,7 +233,7 @@ function upload(uri, data, file, showLoading = true, extParams = {}) {
})
.catch((err) => {
uni.hideLoading();
infoBox.showErrorToast(`上传失败`);
infoBox.showToast(`上传失败`);
});
});
}

View File

@ -96,9 +96,9 @@
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = count - 1;
data.count = data.count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
data.sendTime = data.count - 1 + '秒后重新获取';
setTimeout(countDown.bind(this), 1000);
}
}

View File

@ -122,14 +122,15 @@
* 验证码倒计时
*/
function countDown() {
console.log(data.count)
if (data.count === 1) {
data.count = 60;
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = count - 1;
data.count = data.count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
data.sendTime = data.count - 1 + '秒后重新获取';
setTimeout(countDown.bind(this), 1000);
}
}

View File

@ -60,11 +60,12 @@
</view>
</view>
<!-- 激励视频广告 -->
<!-- <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
v-slot:default="{ loading, error }" :url-callback="datas.urlCallback" @load="onadload" @close="onadclose"
@error="onaderror">
<view class="ad-error" v-if="error">{{ error }}</view>
</ad-rewarded-video> -->
<view style="width: 0;height: 0;overflow: hidden;">
<!-- 激励视频广告 -->
<ad-rewarded-video v-if="datas.adRewardedShow" ref="adRewarded" adpid="1507000689" :loadnext="true"
:url-callback="datas.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
</ad-rewarded-video>
</view>
</view>
</template>
@ -73,6 +74,7 @@
useCommonStore
} from '@/store/common.js'
const $common = useCommonStore()
import { selectUserMoney, selectPayDetails, canCash, state, withdraw } from '@/api/me/withdraw.js';
import {
reactive,
getCurrentInstance,
@ -80,6 +82,7 @@
} from "vue";
import {
onShow,
onReady,
onReachBottom
} from '@dcloudio/uni-app'
import {
@ -95,9 +98,11 @@
// ios
isExamine: $common.isExamine,
urlCallback: {},
adRewardedVideo: true,
adRewardedShow: true,
adRewardedVideoloadNum: 0,
})
const adRewarded = ref(null);
onShow(() => {
getTaskdata()
getsignIn()
@ -108,24 +113,59 @@
// currentInstance.ctx.$refs.adRewardedVideo.load();
// })
})
//广
onReady(() => {
nextTick(()=>{
data.adRewardedVideoloadNum = 0
adRewarded.value.load();
})
getCanCash()
})
/**
* 获取看广告状态
*/
async function getCanCash() {
canCash().then(res => {
data.isWithdraw = !res;
})
}
/**
* 广告加载失败回调
* @param {Object} e
*/
function onaderror(e) {
if ( data.adRewardedVideoloadNum >=3 ) {
data.adRewardedShow = false;
return
}
data.adRewardedVideoloadNum++
setTimeout(() => {
adRewarded.value.load();
}, 1000); // 10
console.log("广告加载失败")
}
/**
* 广告数据加载成功回调
* @param {Object} e
*/
function onadload(e) {
data.adRewardedShow = true;
console.log('广告数据加载成功');
}
/**
* 广告播放成功回调
* @param {Object} e
*/
async function onadclose(e) {
const detail = e.detail
if (detail && detail.isEnded) {
//
// /sqx_fast/app/ad/state
let res = await this.$Request.getT('app/ad/state', {
extraKey: this.urlCallback.extra
})
this.$Request.getT('/app/common/type/921').then(res => {
if (res.code == 0) {
console.log(res)
uni.showToast({
title: '获得' + res.data.value + '分钟免费时长',
icon: 'none'
})
}
let res = await state({
extraKey: data.urlCallback.extra
})
getCanCash()
} else {
// 退
}
@ -171,7 +211,7 @@
userId: uni.getStorageSync('userId'),
extra: uni.getStorageSync('userId') + "" + new Date().getTime(),
}
currentInstance.ctx.$refs.adRewardedVideo.show();
adRewarded.value.show();
} else {
uni.switchTab({
url: "/pages/index/index"
@ -204,9 +244,6 @@
}
function onadload(e) {
datas.adRewardedVideo = true;
}
//
async function getsignIn() {
let res = await getUserSignData()