This commit is contained in:
zpc 2025-05-12 10:54:02 +08:00
parent 21f87c8ed2
commit 5b0462afce
9 changed files with 469 additions and 686 deletions

View File

@ -79,6 +79,8 @@ export default {
uni.removeStorageSync("_click_id");
//
this.$platform.AppLaunch(options);
},
onShow: function () {

View File

@ -8,7 +8,7 @@ import RequestManager from '@/common/request.js'
let configData = null;
let isLoading = false;
let loadPromise = null;
const wx_version = "108";
const wx_version = "110";
// 白名单页面(不需要登录即可访问)
export const whiteList = [

View File

@ -23,7 +23,13 @@ const production = {
loginPage: 'https://api.zfunbox.cn/login.html',
wxAppId: 'wx0e33d80d35e4a3b1'
};
const production_wz = {
// baseUrl: 'https://youda.zfunbox.cn',
baseUrl: 'https://youda.zfunbox.cn',
imageUrl: 'https://image.zfunbox.cn',
loginPage: 'https://youda.zfunbox.cn/login.html',
wxAppId: 'wx0e33d80d35e4a3b1'
};
// 测试环境配置
const testing = {
baseUrl: 'https://testapi.zfunbox.cn',
@ -35,7 +41,7 @@ const testing = {
// 根据环境变量选择对应配置
let currentEnv = testing;
let currentEnv = testing;//production_wz;
// 判断当前环境
// #ifdef H5

View File

@ -126,7 +126,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx683d8a8a499d7ec6",
"appid" : "wx9ade414ae5755f0d",
"setting" : {
"urlCheck" : false,
"es6" : false,

View File

@ -7,7 +7,7 @@
<view class="content">
<view class="navLeft align-center" :style="{ top: $sys().statusBarHeight + 'px' }" @tap="$c.back(1)">
<view class="flex" style="width: 100%">
<view class="title1" style="width: 166rpx; height: 64rpx; margin-top: 5rpx;" @click="jumapSlots()">
<view class="title1" style="width: 166rpx; height: 64rpx; margin-top: 5rpx;" >
<image :src="$img1('common/home_logo.png')" style="width: 166rpx; height: 64rpx;" mode=""></image>
</view>
</view>

View File

@ -1,5 +1,5 @@
<template>
<page-container title="老虎机" :showBack="true">
<page-container title="抽奖特效" :showBack="true">
<view class="content-container">

View File

@ -65,7 +65,9 @@ export default {
},
success(res) {
if (res.status == 1) {
// uni.setStorageSync('token', res.data)
if(res.data!=null&&res.data.token!=null){
uni.setStorageSync('token', res.data.token);
}
uni.showToast({
title: '绑定成功~',
icon: 'success',
@ -111,8 +113,7 @@ export default {
}
.header image {
width: 200rpx;
height: 200rpx;
width: 200rpx; height: 200rpx;
border-radius: 50%;
}

View File

@ -87,14 +87,6 @@
<view class="num">欧气值+{{ item.z_number }}</view>
<!-- <view class="progress">
<view class="progress-inner">
<cmd-progress :percent="item.percentage" :show-info="false"
stroke-color="linear-gradient(90deg, #7836FF 0%, #A465F2 100%)"
:strokeWidth="8"></cmd-progress>
</view>
</view> -->
</view>
<view class="task-r">
@ -129,8 +121,8 @@
{{ item.title }}
</view>
</view>
<view v-if="i==0" class="menu-item relative">
<view v-if="isShowKefu(i)" class="menu-item relative">
<view class="icon">
<image :src="$img1('my/s9.png')" mode=""></image>
</view>
@ -144,9 +136,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <view class="copyright"></view> -->
<!-- #endif -->
<!-- 群聊弹窗 -->
<uni-popup ref="qunliao_show" type="center" maskBackgroundColor="rgba(0,0,0,0.8)">
<view class="pop-ball">
@ -162,125 +152,7 @@
</view>
</uni-popup>
<!-- 星钻充值弹窗 -->
<uni-popup ref="chongzhi_show" type="bottom">
<view class="order animated fadeInUp">
<view class="order_title">
<view class="title">星钻充值</view>
<view class="ca" @click="$refs.chongzhi_show.close()">
<image :src="$img('/static/icon/close1.png')"
style="width: 30rpx; height: 30rpx; margin-top: 14rpx">
</image>
</view>
</view>
<view class="pop_coucent">
<view>选择充值金额</view>
<view class="pop_box">
<view class="common_bg" @click="money_1 = v" v-for="(v, i) in moneyArr" :key="i" :style="{
'background-image': `url(${$img(
money_1 == v
? '/static/img/mine_chong_tab_bg_act.png'
: '/static/img/mine_chong_tab_bg.png'
)})`
}">
<text style="font-size: 32rpx">{{ v }}</text>
</view>
</view>
</view>
<view class="pop_coucent">
<view>输入充值金额</view>
<input type="text" placeholder="请输入金额最低1元" v-model="money_1" placeholder-style="color:#999999" />
</view>
<view class="chong-bt">
<view class="money">需支付:{{ money_1 || 0 }}</view>
<view @click="chongzhi_click" class="pay-btn common_bg" :style="{
'background-image': `url(${$img('/static/img/mine_qrcz.png')})`
}"></view>
</view>
<!-- <view
class="pop_chongzhi"
@click="chongzhi_click"
:style="
'background: url(' +
z_imgPath +
'mine/allBtn_bg.png' +
') no-repeat 0 0 / 100% 100%;'
"
>
确认充值
</view> -->
</view>
</uni-popup>
<!-- 星钻提现 -->
<view class="mengban animated fadeIn" v-if="tixian_show">
<view class="order animated fadeInUp">
<view class="order_title">
<image :src="z_imgPath + 'mine/tx_tips.png'" style="width: 162rpx; height: 47rpx"></image>
<view class="ca" @click="tixian_show = false">
<image :src="z_imgPath + 'mine/qu_close.png?11'"
style="width: 48rpx; height: 48rpx; margin-top: 14rpx">
</image>
</view>
</view>
<view class="pop_head">
<view @click="tixian_index = 1">
<text :class="tixian_index == 1 ? 'xzs' : 'wzs'">微信零钱</text>
<view class="qiehuan_line" v-if="tixian_index == 1"></view>
</view>
<view @click="tixian_index = 2">
<text :class="tixian_index == 2 ? 'xzs' : 'wzs'">支付宝</text>
<view class="qiehuan_line" v-if="tixian_index == 2">
<!-- <image src="../../static/shouye/top.png"></image> -->
</view>
</view>
</view>
<view class="pop_coucent" v-if="tixian_index == 1">
<view>输入提现金额</view>
<view class="flex_center pop_tixian_input">
<input type="number" placeholder="¥请输入金额最低1元" placeholder-style="font-size:24rpx"
:value="money_2" @input="getmoney_2" />
<view style="color: #1ff7f0" @click="money_2 = userinfo.money">
全部提现
</view>
</view>
<view class="flex_center" style="justify-content: space-between">
<view>到账账户</view>
<view style="color: #999999">微信零钱</view>
</view>
</view>
<view class="pop_coucent" style="padding: 0 30rpx" v-if="tixian_index == 2">
<view class="flex_center name_phone">
<view>姓名</view>
<input type="text" placeholder="请输入姓名" @input="getname" />
</view>
<view class="flex_center name_phone">
<view>账户</view>
<input type="text" placeholder="请输入支付宝账号" @input="getnumber" />
</view>
<view style="margin-top: 30rpx">输入提现金额</view>
<view class="flex_center pop_tixian_input" style="border: none">
<input type="number" placeholder="¥请输入金额最低1元" placeholder-style="font-size:24rpx"
:value="money_2" @input="getmoney_2" />
<view style="color: #1ff7f0" @click="money_2 = userinfo.money">
全部提现
</view>
</view>
</view>
<view class="pop_chongzhi" @click="tixian_click" :style="'background: url(' +
z_imgPath +
'mine/allBtn_bg.png' +
') no-repeat 0 0 / 100% 100%;'
">
确认提现
</view>
<!-- <image :src="z_imgPath+'mine/qrtx.png'" class="pop_chongzhi" @click="tixian_click()"></image> -->
</view>
</view>
<!-- <tab-bar :index="4"></tab-bar> -->
</view>
</template>
@ -334,35 +206,13 @@ export default {
title: '用户协议',
icon: 'my/s7.png',
path: '/pages/guize/guize?type=4'
},{
id: 8,
show: true,
title: '退出登录',
icon: 'my/exit.png',
path: ''
},
// {
// id: 2,
// show: true,
// title: '',
// icon: 'my/s2.png',
// path: '/pages/user/hsjl'
// },
// {
// id: 8,
// show: true,
// title: '',
// icon: 'my/s8.png',
// path: '/package/mine/skill-card'
// },
// {
// id: 9,
// show:true,
// title: '',
// icon: '/static/img/2_gsjl.png',
// path: ''
// },
// {
// id: 10,
// show:true,
// title: '',
// icon: '/static/img/2_jsphb.png',
// path: '/pages/shouye/bangdan'
// },
],
//
money_1: '',
@ -391,7 +241,6 @@ export default {
}
],
show: 1,
tixian_show: false,
taskList: []
}
},
@ -402,6 +251,8 @@ export default {
if (e.pid) {
uni.setStorageSync('pid', e.pid)
}
console.log(this.$platform.code);
},
onHide() {
uni.setStorageSync('page', this.$mp.page.route)
@ -437,6 +288,14 @@ export default {
url: '/pages/user/change'
})
},
isShowKefu(index){
if(index==0){
if(this.$platform.code=='MP-WEIXIN'){
return true;
}
}
return false;
},
receiveCoupon() {
const coupon_id = uni.getStorageSync('_ou_coupon_id')
@ -602,40 +461,6 @@ export default {
})
},
chongzhi_click() {
let that = this
that.req({
url: 'recharge',
data: {
money: that.money_1
},
success(res) {
if (res.status == 1) {
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: 'MD5',
paySign: res.data.paySign,
complete(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
uni.showToast({
title: '取消支付',
icon: 'loading',
duration: 1000
})
}
if (res.errMsg == 'requestPayment:ok') {
that.$refs.chongzhi_show.close()
that.getdata()
}
}
})
}
}
})
},
getdata() {
let that = this
@ -694,25 +519,7 @@ export default {
}
})
},
tixian_click() {
let that = this
console.log(that.money_2)
that.req({
url: 'withdraw',
data: {
type: that.tixian_index,
money: that.money_2,
name: that.name,
number: that.number
},
success(res) {
that.money_2 = ''
if (res.status == 0) {
that.tixian_show = false
}
}
})
},
//
toPage(id) {
if (id == 1) {

View File

@ -34,7 +34,8 @@
<view @click="navigateBack()" class="cancel">
拒绝
</view>
<button class="bottom center" type="primary" withCredentials="true" lang="zh_CN" @click="getUserProfile">
<button class="bottom center" type="primary" withCredentials="true" lang="zh_CN"
@click="getUserProfile">
<text>授权登录</text>
</button>
</view>
@ -42,26 +43,27 @@
</view>
</view>
</view>
<!-- H5手机号登录界面 -->
<view v-if="isCanUse && !isMpWeixin">
<view>
<view class="header">
<image :src="$img1('common/logo.png?x=1')"></image>
</view>
<view class="h5-login-form">
<view class="input-item">
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" class="phone-input" />
</view>
<view class="input-item code-item">
<input type="number" v-model="verifyCode" placeholder="请输入验证码" maxlength="6" class="code-input" />
<input type="number" v-model="verifyCode" placeholder="请输入验证码" maxlength="6"
class="code-input" />
<view @click="sendVerifyCode" class="send-code-btn" :class="{ disabled: countdown > 0 }">
{{ countdown > 0 ? countdown + '秒' : '发送验证码' }}
</view>
</view>
<view @click="isAgree = !isAgree" class="agree">
<view class="icon">
<image v-if="isAgree" :src="$img1('common/check_act.png')" lazy-load></image>
@ -78,7 +80,7 @@
</text>
</view>
</view>
<view class="btn-list">
<view @click="navigateBack()" class="cancel">
拒绝
@ -88,7 +90,7 @@
</view>
</view>
</view>
<view style="font-size: 20rpx;color: #979797;position: fixed;bottom: 20rpx;right:47rpx;">version:v1.0.3
</view>
</view>
@ -97,506 +99,471 @@
</template>
<script>
export default {
data() {
return {
z_imgPath: this.$z_img2,
SessionKey: '',
OpenId: '',
nickName: null,
avatarUrl: null,
isCanUse: uni.getStorageSync('isCanUse') || true, //true
code: '',
isAgree: false,
// H5
isMpWeixin: false, //
mobile: '', //
verifyCode: '', //
countdown: 0, //
timer: null, //
codeSent: false //
}
},
onLoad(option) {
//
// #ifdef MP-WEIXIN
this.isMpWeixin = true;
// #endif
//
if (option != null) {
if (option.code != null) {
export default {
data() {
return {
z_imgPath: this.$z_img2,
SessionKey: '',
OpenId: '',
nickName: null,
avatarUrl: null,
isCanUse: uni.getStorageSync('isCanUse') || true, //true
code: '',
isAgree: false,
// H5
isMpWeixin: false, //
mobile: '', //
verifyCode: '', //
countdown: 0, //
timer: null, //
codeSent: false //
}
}
},
onUnload() {
//
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
methods: {
//
navigateBack() {
uni.navigateBack({
delta: 1,
fail: () => {
//
this.$customRouter.navigateTo('/pages/shouye/index', {}, 'switchTab');
}
});
},
//===
getUserProfile(e) {
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
onLoad(option) {
//
// #ifdef MP-WEIXIN
this.wxUserProfile();
this.isMpWeixin = true;
// #endif
},
//
async sendVerifyCode() {
//
if (this.countdown > 0) {
return;
}
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
//
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
//
try {
const res = await this.$request.post('v2/account/sendSms', {
phone: this.mobile
});
if (res.status == 1) {
uni.showToast({
title: '验证码已发送',
icon: 'none'
});
//
this.codeSent = true;
// 使
this.countdown = res.data || 60; // 使60
this.timer = setInterval(() => {
this.countdown--;
if (this.countdown <= 0) {
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} else {
uni.showToast({
title: res.msg || '发送失败,请稍后重试',
icon: 'none'
});
//
if (option != null) {
if (option.code != null) {
}
} catch (error) {
uni.showToast({
title: '发送验证码失败,请稍后重试',
icon: 'none'
});
console.error('发送验证码失败:', error);
}
},
//
async phoneLogin() {
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
onUnload() {
//
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
if (!this.verifyCode) {
return uni.showToast({
title: '请输入验证码',
icon: 'none'
});
}
//
// if (!this.codeSent) {
// return uni.showToast({
// title: '',
// icon: 'none'
// });
// }
//
try {
const res = await this.$request.post('mobileLogin', {
mobile: this.mobile,
code: this.verifyCode,
pid: uni.getStorageSync('pid')
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
},
methods: {
//
navigateBack() {
uni.navigateBack({
delta: 1,
fail: () => {
//
this.$customRouter.navigateTo('/pages/shouye/index', {}, 'switchTab');
}
} else {
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
this.$c.msg("登录请求失败,请稍后重试");
console.error('登录失败:', error);
}
},
/**
* 处理登录成功后的重定向逻辑
* @param {String} redirectUrl 重定向URL
*/
handleRedirect(redirectUrl) {
let that = this;
//
const pages = getCurrentPages();
// redirect URL
if (pages.length > 1) {
const prevPage = pages[pages.length - 2];
// ()
let prevPageUrl = '/' + prevPage.route;
if (prevPage.options && Object.keys(prevPage.options).length > 0) {
const paramStr = Object.keys(prevPage.options)
.map(key => `${key}=${prevPage.options[key]}`)
.join('&');
prevPageUrl += '?' + paramStr;
}
// redirect URLURL
const redirectUrlPath = redirectUrl.split('?')[0];
const prevPageUrlPath = prevPageUrl.split('?')[0];
if (redirectUrlPath === prevPageUrlPath) {
//
console.log('重定向URL与上一页相同直接返回');
setTimeout(() => {
uni.navigateBack();
}, 1000);
return true;
}
}
// URL
setTimeout(() => {
that.$customRouter.navigateTo(redirectUrl).catch(err => {
console.error('重定向跳转失败:', err)
//
that.$customRouter.navigateTo('/pages/user/index')
})
}, 1000);
return true;
},
async wxUserProfile() {
try {
const profileRes = await new Promise((resolve, reject) => {
uni.getUserProfile({
desc: '用于向用户发送商品',
lang: 'zh_CN',
success: resolve,
fail: reject,
complete: (e) => {
console.log(e, '用于向用户发送商品');
}
});
});
try {
const loginRes = await new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: resolve,
fail: (e) => {
this.$c.msg("登录失败,网络错误!" + e.msg);
console.log(e, '登录失败', e);
reject(e);
},
complete: (e) => {
console.log(e, '登录');
}
});
},
//===
getUserProfile(e) {
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
try {
const res = await this.$request.post('login', {
code: loginRes.code,
nickname: '',
headimg: '',
pid: uni.getStorageSync('pid')
}
// #ifdef MP-WEIXIN
this.wxUserProfile();
// #endif
},
//
async sendVerifyCode() {
//
if (this.countdown > 0) {
return;
}
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
//
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
//
try {
const res = await this.$request.post('v2/account/sendSms', {
phone: this.mobile
});
if (res.status == 1) {
uni.showToast({
title: '验证码已发送',
icon: 'none'
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
//
this.codeSent = true;
// 使
this.countdown = res.data || 60; // 使60
this.timer = setInterval(() => {
this.countdown--;
if (this.countdown <= 0) {
clearInterval(this.timer);
this.timer = null;
}
} else {
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
console.error('请求登录失败:', error);
}, 1000);
} else {
uni.showToast({
title: res.msg || '发送失败,请稍后重试',
icon: 'none'
});
}
} catch (error) {
console.error('微信登录失败:', error);
uni.showToast({
title: '发送验证码失败,请稍后重试',
icon: 'none'
});
console.error('发送验证码失败:', error);
}
} catch (error) {
this.$c.msg("登录失败,申请获取微信用户数据失败");
console.log(error, '获取微信用户数据失败');
}
},
async h5Login(code) {
try {
const res = await this.$request.post('h5login', {
code: code,
pid: uni.getStorageSync('pid')
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
},
//
async phoneLogin() {
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
if (!this.verifyCode) {
return uni.showToast({
title: '请输入验证码',
icon: 'none'
});
}
//
// if (!this.codeSent) {
// return uni.showToast({
// title: '',
// icon: 'none'
// });
// }
//
try {
const res = await this.$request.post('mobileLogin', {
mobile: this.mobile,
code: this.verifyCode,
pid: uni.getStorageSync('pid')
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
}
} else {
//
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
this.$c.msg("登录请求失败,请稍后重试");
console.error('登录失败:', error);
}
},
/**
* 处理登录成功后的重定向逻辑
* @param {String} redirectUrl 重定向URL
*/
handleRedirect(redirectUrl) {
let that = this;
//
const pages = getCurrentPages();
// redirect URL
if (pages.length > 1) {
const prevPage = pages[pages.length - 2];
// ()
let prevPageUrl = '/' + prevPage.route;
if (prevPage.options && Object.keys(prevPage.options).length > 0) {
const paramStr = Object.keys(prevPage.options)
.map(key => `${key}=${prevPage.options[key]}`)
.join('&');
prevPageUrl += '?' + paramStr;
}
// redirect URLURL
const redirectUrlPath = redirectUrl.split('?')[0];
const prevPageUrlPath = prevPageUrl.split('?')[0];
if (redirectUrlPath === prevPageUrlPath) {
//
console.log('重定向URL与上一页相同直接返回');
setTimeout(() => {
this.getdata();
uni.navigateBack();
}, 1000);
return true;
}
}
} catch (error) {
console.error('H5登录失败:', error);
}
},
h5UserProfile() {
console.log('进入h5');
this.$c.msg('暂未开放登录');
// window.location.href = this.$wxloginPage;
},
async getdata() {
try {
const res = await this.$request.post('user');
if (res.status == 1 && res.data.userinfo != null && res.data.userinfo.mobile_is == 0) {
console.log("判断用户有没有手机号", res.data.userinfo.mobile_is);
// 使
this.$customRouter.navigateTo('/pages/user/bangding', {}, 'navigateTo');
} else {
// 使
this.$customRouter.navigateTo('/pages/user/index', {}, 'navigateTo');
// URL
setTimeout(() => {
that.$customRouter.navigateTo(redirectUrl).catch(err => {
console.error('重定向跳转失败:', err)
//
that.$customRouter.navigateTo('/pages/user/index')
})
}, 1000);
return true;
},
async wxUserProfile() {
try {
const profileRes = await new Promise((resolve, reject) => {
uni.getUserProfile({
desc: '用于向用户发送商品',
lang: 'zh_CN',
success: resolve,
fail: reject,
complete: (e) => {
console.log(e, '用于向用户发送商品');
}
});
});
try {
const loginRes = await new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: resolve,
fail: (e) => {
this.$c.msg("登录失败,网络错误!" + e.msg);
console.log(e, '登录失败', e);
reject(e);
},
complete: (e) => {
console.log(e, '登录');
}
});
});
try {
const res = await this.$request.post('login', {
code: loginRes.code,
nickname: '',
headimg: '',
pid: uni.getStorageSync('pid')
});
console.log(res, '登录成功');
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
}
} else {
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
console.error('请求登录失败:', error);
}
} catch (error) {
console.error('微信登录失败:', error);
}
} catch (error) {
this.$c.msg("登录失败,申请获取微信用户数据失败");
console.log(error, '获取微信用户数据失败');
}
},
async getdata() {
try {
const res = await this.$request.post('user');
if (res.status == 1 && res.data.userinfo != null && res.data.userinfo.mobile_is == 0) {
console.log("判断用户有没有手机号", res.data.userinfo.mobile_is);
// 使
this.$customRouter.navigateTo('/pages/user/bangding', {}, 'navigateTo');
} else {
// 使
this.$customRouter.navigateTo('/pages/user/index', {}, 'navigateTo');
}
} catch (error) {
console.error('获取用户数据失败:', error);
}
} catch (error) {
console.error('获取用户数据失败:', error);
}
}
}
}
</script>
<style lang="scss">
.all {
min-height: 100vh;
background-color: #FFFFFF;
// background: url($imgurl+'common/pageBg1.png') no-repeat 0 0 / 100% auto;
}
.header {
margin: 0 0 90rpx 50rpx;
padding: 90rpx 0 0;
border-bottom: 1px solid #E8E8E8;
text-align: center;
width: 650rpx;
height: 300rpx;
line-height: 450rpx;
}
.header image {
width: 200rpx;
height: 200rpx;
border-radius: 50%;
}
.content {
margin-left: 50rpx;
margin-bottom: 90rpx;
color: #333333;
}
.content text {
display: block;
margin-top: 28rpx;
}
// H5
.h5-login-form {
padding: 0 50rpx;
.input-item {
height: 90rpx;
border-bottom: 1px solid #E8E8E8;
margin-bottom: 40rpx;
input {
height: 100%;
width: 100%;
font-size: 28rpx;
}
.all {
min-height: 100vh;
background-color: #FFFFFF;
// background: url($imgurl+'common/pageBg1.png') no-repeat 0 0 / 100% auto;
}
.code-item {
display: flex;
justify-content: space-between;
align-items: center;
.code-input {
flex: 1;
.header {
margin: 0 0 90rpx 50rpx;
padding: 90rpx 0 0;
border-bottom: 1px solid #E8E8E8;
text-align: center;
width: 650rpx;
height: 300rpx;
line-height: 450rpx;
}
.header image {
width: 200rpx;
height: 200rpx;
border-radius: 50%;
}
.content {
margin-left: 50rpx;
margin-bottom: 90rpx;
color: #333333;
}
.content text {
display: block;
margin-top: 28rpx;
}
// H5
.h5-login-form {
padding: 0 50rpx;
.input-item {
height: 90rpx;
border-bottom: 1px solid #E8E8E8;
margin-bottom: 40rpx;
input {
height: 100%;
width: 100%;
font-size: 28rpx;
}
}
.send-code-btn {
width: 200rpx;
height: 70rpx;
background-color: #333333;
color: #CDEF27;
font-size: 24rpx;
.code-item {
display: flex;
justify-content: center;
justify-content: space-between;
align-items: center;
border-radius: 12rpx;
&.disabled {
background-color: #cccccc;
color: #ffffff;
.code-input {
flex: 1;
}
.send-code-btn {
width: 200rpx;
height: 70rpx;
background-color: #333333;
color: #CDEF27;
font-size: 24rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 12rpx;
&.disabled {
background-color: #cccccc;
color: #ffffff;
}
}
}
}
}
.agree {
display: flex;
padding: 0 50rpx;
margin: 40rpx 0;
.agree {
display: flex;
padding: 0 50rpx;
margin: 40rpx 0;
.icon {
width: 32rpx;
height: 32rpx;
}
.icon {
width: 32rpx;
height: 32rpx;
}
.agree-r {
flex: 1;
word-wrap: break-word;
word-break: break-all;
padding-left: 20rpx;
line-height: 32rpx;
.agree-r {
flex: 1;
word-wrap: break-word;
word-break: break-all;
padding-left: 20rpx;
line-height: 32rpx;
font-size: 20rpx;
color: #999999;
font-size: 20rpx;
color: #999999;
text {
color: #333333;
text {
color: #333333;
}
}
}
}
.btn-list {
display: flex;
justify-content: space-evenly;
padding: 50rpx 0 0;
.cancel {
width: 200rpx;
height: 80rpx;
box-sizing: border-box;
border-radius: 16rpx;
font-size: 28rpx;
color: #333333;
.btn-list {
display: flex;
justify-content: center;
align-items: center;
background-color: #CDEF27;
// filter: grayscale(1);
}
justify-content: space-evenly;
padding: 50rpx 0 0;
.bottom {
background: #333333;
margin: 0;
width: 416rpx;
height: 80rpx;
text-align: center;
box-sizing: border-box;
border-radius: 16rpx;
font-size: 28rpx;
color: #CDEF27;
display: flex;
justify-content: center;
align-items: center;
.cancel {
width: 200rpx;
height: 80rpx;
box-sizing: border-box;
border-radius: 16rpx;
font-size: 28rpx;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
background-color: #CDEF27;
// filter: grayscale(1);
}
.bottom {
background: #333333;
margin: 0;
width: 416rpx;
height: 80rpx;
text-align: center;
box-sizing: border-box;
border-radius: 16rpx;
font-size: 28rpx;
color: #CDEF27;
display: flex;
justify-content: center;
align-items: center;
}
}
}
</style>