Merge branch 'youda' of http://123.207.203.228:3000/shang/yfs into youda
This commit is contained in:
commit
d072e93523
|
|
@ -47,6 +47,7 @@ const defaultConfig = {
|
|||
"exchange_times": "2",
|
||||
"balance_name": "钻石",
|
||||
"balance_icon": "https://image.zfunbox.cn/app/icons/20250412/a482b527477e74f8a18ec02ebc7f0b4e.png",
|
||||
|
||||
"currency1_name": "UU币",
|
||||
"currency1_icon": "https://image.zfunbox.cn/app/icons/20250412/3d1741965e9439372d1ce101bd110616.png",
|
||||
"currency2_name": "达达券",
|
||||
|
|
@ -54,11 +55,12 @@ const defaultConfig = {
|
|||
"win_audio": "https://image.zfunbox.cn/app/20250407/14ba53d367e1d131a344c6fd5cc0e28e.mp3",
|
||||
"applet_version": "v1.0.3",
|
||||
"sign_in_spend_limit": "1",
|
||||
"show_dadajuan_limit": "0",
|
||||
"waimai_box_id": "1049",
|
||||
"daily_free_draw_id": "1050",
|
||||
"cabinet_exchange_limit": "0",
|
||||
"daily_coupon_limit": "0",
|
||||
"update_time": 1744550962
|
||||
"update_time": 1745379501
|
||||
},
|
||||
version: wx_version
|
||||
};
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@
|
|||
|
||||
<view v-if="tabList[tabCur].id == 1" class="bt-fixed">
|
||||
<template v-if="subTab[subTabCur].id != 4">
|
||||
<view v-if="subTab[subTabCur].id != 6 && listData.length && is_exchange == '1'" class="btn center"
|
||||
<view v-if="subTab[subTabCur].id != 6 && is_exchange == '1' && show_dadajuan" class="btn center"
|
||||
@click="open('changePop')">达达券</view>
|
||||
<view v-if="subTab[subTabCur].id != 2" class="btn2 center" @click="open('sendPop')">发货</view>
|
||||
<view v-if="subTab[subTabCur].id != 6" class="btn center" @click="open('model')">上锁</view>
|
||||
|
|
@ -410,7 +410,8 @@ export default {
|
|||
canReload: false,
|
||||
zhanshiMoney: 0,
|
||||
isAgree: false,
|
||||
is_exchange: '0'
|
||||
is_exchange: '0',
|
||||
show_dadajuan: false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
|
@ -885,6 +886,9 @@ export default {
|
|||
|
||||
this.freightData = res.data.yufei
|
||||
}
|
||||
if (res.data.show_dadajuan != null) {
|
||||
this.show_dadajuan = res.data.show_dadajuan
|
||||
}
|
||||
|
||||
this.listData = this.listData.concat(res.data.data)
|
||||
this.mescroll.endByPage(res.data.data.length, res.data.last_page)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<view class="all">
|
||||
<view v-if="isCanUse">
|
||||
<!-- 小程序登录界面 -->
|
||||
<view v-if="isCanUse && isMpWeixin">
|
||||
<view>
|
||||
<view class="header">
|
||||
<image :src="$img1('common/logo.png?x=1')"></image>
|
||||
|
|
@ -30,17 +31,10 @@
|
|||
</view>
|
||||
|
||||
<view class="btn-list">
|
||||
<view @click="$customRouter.navigateTo('/pages/shouye/index', {}, 'switchTab')" class="cancel">
|
||||
<view @click="navigateBack()" class="cancel">
|
||||
拒绝
|
||||
</view>
|
||||
|
||||
<button v-if="isAgree" class="bottom center" type="primary" withCredentials="true" lang="zh_CN"
|
||||
@click="getUserProfile">
|
||||
<text>授权登录</text>
|
||||
</button>
|
||||
|
||||
<button v-else 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>
|
||||
|
|
@ -48,6 +42,57 @@
|
|||
</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" />
|
||||
<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>
|
||||
<image v-else :src="$img1('common/check.png')" lazy-load></image>
|
||||
</view>
|
||||
<view class="agree-r">
|
||||
我已阅读并同意
|
||||
<text @click.stop="$customRouter.navigateTo('/pages/guize/guize', {type: 4})">
|
||||
《用户协议》
|
||||
</text>
|
||||
和
|
||||
<text @click.stop="$customRouter.navigateTo('/pages/guize/guize', {type: 5})">
|
||||
《隐私政策》
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn-list">
|
||||
<view @click="navigateBack()" class="cancel">
|
||||
拒绝
|
||||
</view>
|
||||
<view class="bottom center" @click="phoneLogin">
|
||||
<text>登录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="font-size: 20rpx;color: #979797;position: fixed;bottom: 20rpx;right:47rpx;">version:v1.0.3
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -62,21 +107,47 @@ export default {
|
|||
avatarUrl: null,
|
||||
isCanUse: uni.getStorageSync('isCanUse') || true, //默认为true
|
||||
code: '',
|
||||
isAgree: false
|
||||
isAgree: false,
|
||||
// H5手机号登录相关数据
|
||||
isMpWeixin: false, // 是否为小程序环境
|
||||
mobile: '', // 手机号
|
||||
verifyCode: '', // 验证码
|
||||
countdown: 0, // 发送验证码倒计时
|
||||
timer: null, // 倒计时定时器
|
||||
codeSent: false // 是否已发送验证码
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
// 判断当前环境
|
||||
// #ifdef MP-WEIXIN
|
||||
this.isMpWeixin = true;
|
||||
// #endif
|
||||
|
||||
//默认加载
|
||||
// this.login();
|
||||
// console.log(window.location.href, option);
|
||||
if (option != null) {
|
||||
if (option.code != null) {
|
||||
//登录
|
||||
// this.h5Login(option.code);
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
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) {
|
||||
|
|
@ -89,8 +160,134 @@ export default {
|
|||
// #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('https://test.zfunbox.cn/api/v2/account/sendSms', {
|
||||
phone: this.mobile
|
||||
});
|
||||
|
||||
if (res.status == 1) {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 标记已发送验证码(仅当前会话有效)
|
||||
this.codeSent = true;
|
||||
|
||||
// 开始倒计时
|
||||
this.countdown = 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'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '发送验证码失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
console.error('发送验证码失败:', error);
|
||||
}
|
||||
},
|
||||
// 手机号登录
|
||||
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);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 处理登录成功后的重定向逻辑
|
||||
|
|
@ -142,125 +339,128 @@ export default {
|
|||
|
||||
return true;
|
||||
},
|
||||
wxUserProfile() {
|
||||
var that = this
|
||||
uni.getUserProfile({
|
||||
desc: '用于向用户发送商品', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
lang: 'zh_CN',
|
||||
success: res => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function (loginRes) {
|
||||
that.req({
|
||||
url: 'login',
|
||||
data: {
|
||||
code: loginRes.code,
|
||||
nickname: '',
|
||||
headimg: '',
|
||||
pid: uni.getStorageSync('pid')
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
uni.setStorageSync('token', res.data)
|
||||
that.$c.msg("登录成功")
|
||||
|
||||
// 检查重定向URL
|
||||
const redirectUrl = uni.getStorageSync('redirect')
|
||||
|
||||
if (redirectUrl) {
|
||||
// 清除重定向信息
|
||||
uni.removeStorageSync('redirect')
|
||||
|
||||
// 使用公共方法处理重定向
|
||||
that.handleRedirect(redirectUrl);
|
||||
} else {
|
||||
// 无重定向页面,检查是否需要绑定手机号
|
||||
setTimeout(() => {
|
||||
that.getdata();
|
||||
}, 1000)
|
||||
}
|
||||
} else {
|
||||
that.$c.msg("登录失败!" + res.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
that.$c.msg("登录失败,网络错误!" + e.msg)
|
||||
console.log(e, '登录失败', e);
|
||||
|
||||
},
|
||||
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, '登录');
|
||||
console.log(e, '用于向用户发送商品');
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
that.$c.msg("登录失败,申请获取微信用户数据失败")
|
||||
console.log(e, '获取微信用户数据失败');
|
||||
|
||||
},
|
||||
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')
|
||||
});
|
||||
|
||||
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, '获取微信用户数据失败');
|
||||
}
|
||||
},
|
||||
h5Login(code) {
|
||||
var that = this;
|
||||
that.req({
|
||||
url: 'h5login',
|
||||
data: {
|
||||
async h5Login(code) {
|
||||
try {
|
||||
const res = await this.$request.post('h5login', {
|
||||
code: code,
|
||||
pid: uni.getStorageSync('pid')
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
uni.setStorageSync('token', res.data)
|
||||
});
|
||||
|
||||
if (res.status == 1) {
|
||||
uni.setStorageSync('token', res.data);
|
||||
|
||||
// 检查重定向URL
|
||||
const redirectUrl = uni.getStorageSync('redirect');
|
||||
|
||||
if (redirectUrl) {
|
||||
// 清除重定向信息
|
||||
uni.removeStorageSync('redirect');
|
||||
|
||||
// 检查重定向URL
|
||||
const redirectUrl = uni.getStorageSync('redirect')
|
||||
|
||||
if (redirectUrl) {
|
||||
// 清除重定向信息
|
||||
uni.removeStorageSync('redirect')
|
||||
|
||||
// 使用公共方法处理重定向
|
||||
that.handleRedirect(redirectUrl);
|
||||
} else {
|
||||
// 无重定向页面,检查是否需要绑定手机号
|
||||
setTimeout(() => {
|
||||
that.getdata();
|
||||
}, 1000)
|
||||
}
|
||||
// 使用公共方法处理重定向
|
||||
this.handleRedirect(redirectUrl);
|
||||
} else {
|
||||
// 无重定向页面,检查是否需要绑定手机号
|
||||
setTimeout(() => {
|
||||
this.getdata();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('H5登录失败:', error);
|
||||
}
|
||||
},
|
||||
h5UserProfile() {
|
||||
var that = this;
|
||||
console.log('进入h5')
|
||||
console.log('进入h5');
|
||||
this.$c.msg('暂未开放登录');
|
||||
// window.location.href = this.$wxloginPage;
|
||||
},
|
||||
getdata() {
|
||||
let that = this
|
||||
that.req({
|
||||
url: 'user',
|
||||
success(res) {
|
||||
if (res.status == 1 && res.data.userinfo != null && res.data.userinfo.mobile_is == 0) {
|
||||
console.log("判断用户有没有手机号", res.data.userinfo.mobile_is);
|
||||
// 使用新的路由守卫方法跳转到绑定页面
|
||||
that.$customRouter.navigateTo('/pages/user/bangding', {}, 'navigateTo');
|
||||
} else {
|
||||
// 使用新的路由守卫方法跳转到用户首页
|
||||
that.$customRouter.navigateTo('/pages/user/index', {}, 'navigateTo');
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -299,9 +499,54 @@ export default {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
.code-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.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;
|
||||
|
||||
.icon {
|
||||
width: 32rpx;
|
||||
|
|
@ -353,6 +598,9 @@ export default {
|
|||
border-radius: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #CDEF27;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user