fix:bug修复

This commit is contained in:
黄泽群
2026-07-22 17:18:26 +08:00
parent 53f1ebba18
commit 17ab8beefa
6 changed files with 237 additions and 179 deletions
+205 -142
View File
@@ -79,6 +79,18 @@
</up-checkbox>
</view>
<up-toast ref="uToastRef"></up-toast>
<!-- 自定义协议弹窗 -->
<view v-if="showPolicyModal" class="modal-overlay" @click="showPolicyModal = false">
<view class="modal-content" @click.stop>
<view class="modal-title">温馨提示</view>
<view class="modal-message">请您阅读并同意《服务协议》与《隐私政策》</view>
<view class="modal-buttons">
<view class="modal-btn modal-btn-cancel" @click="showPolicyModal = false">取消</view>
<view class="modal-btn modal-btn-confirm" @click="handlePolicyConfirm">同意并登录</view>
</view>
</view>
</view>
</view>
</template>
@@ -109,106 +121,97 @@
const hyyAlipay = uni.requireNativePlugin("Hyy-Alipay");
// #endif
export default {
onLaunch: function() {
console.log("App Launch");
const res = uni.getSystemInfoSync();
uni.setStorageSync("platform", res.platform);
// #ifdef APP-PLUS
// 获取应用版本信息
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
console.log("版本信息", inf.versionCode);
uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
});
let uuid = plus.device.uuid;
// #endif
},
components: {
InputCodeComm,
},
data() {
return {
form: {
name: null,
password: null,
code: null,
},
inputCss: {
height: "80rpx",
background: "#F3F3F3FF",
"border-radius": "30rpx",
border: "0rpx",
"padding-left": "16px",
},
loginWay: "password",
isShow: false, // 是否显示
isPolicy: false, // 是否同意
countdown: false, // 清空倒计时
loading: false,
};
},
methods: {
onBack(){
console.log('onBack',)
uni.switchTab({
url:'/pages/home/home'
})
export default {
onLaunch: function () {
console.log("App Launch");
const res = uni.getSystemInfoSync();
uni.setStorageSync("platform", res.platform);
// #ifdef APP-PLUS
// 获取应用版本信息
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
console.log("版本信息", inf.versionCode);
uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
});
let uuid = plus.device.uuid;
// #endif
},
components: {
InputCodeComm,
},
data() {
return {
form: {
name: null,
password: null,
code: null,
},
aa() {
const nativiPlugin = uni.requireNativePlugin('WITTestUniPlugin');
console.log("隐藏原生tabbar", nativiPlugin)
nativiPlugin.testAsyncFunc({},
(ret) => {
uni.showToast({
title: '调用异步方法 ' + ret,
icon: "none"
})
console.log(ret);
});
inputCss: {
height: "80rpx",
background: "#F3F3F3FF",
"border-radius": "30rpx",
border: "0rpx",
"padding-left": "16px",
},
jumpHome() {
// const sysPlatform = getCurrentSysPlatform();
// if(sysPlatform === "android"){
// uni.switchTab({
// url: '/pages/message/message',
// })
// }else{
uni.switchTab({
url: "/pages/home/home",
loginWay: "password",
isShow: false,
isPolicy: false,
countdown: false,
loading: false,
showPolicyModal: false,
};
},
methods: {
onBack() {
console.log('onBack',)
uni.switchTab({
url: '/pages/home/home'
})
},
aa() {
const nativiPlugin = uni.requireNativePlugin('WITTestUniPlugin');
console.log("隐藏原生tabbar", nativiPlugin)
nativiPlugin.testAsyncFunc({},
(ret) => {
uni.showToast({
title: '调用异步方法 ' + ret,
icon: "none"
})
console.log(ret);
});
// }
},
async loginFun(val = {}) {
const then = this;
const form = this.form;
const params = {};
if (!this.isPolicy) {
uni.showModal({
title: '温馨提示',
content: '请您阅读并同意《服务协议》与《隐私政策》',
confirmText: "同意并登录",
success: (res) => {
if (res.confirm) {
this.isPolicy = true;
this.loginFun(val);
}
}
});
return;
}
let response = val;
if (this.loginWay === "password") {
params.mobile = form.name;
params.password = CryptoJS.MD5(form.password).toString();
response = await loginbypw(params);
}
if (this.loginWay === "code") {
params.mobile = form.name;
params.smsCode = form.code;
response = await loginbysms(params);
}
},
jumpHome() {
// const sysPlatform = getCurrentSysPlatform();
// if(sysPlatform === "android"){
// uni.switchTab({
// url: '/pages/message/message',
// })
// }else{
uni.switchTab({
url: "/pages/home/home",
});
// }
},
async loginFun(val = {}) {
const then = this;
const form = this.form;
const params = {};
if (!this.isPolicy) {
this.showPolicyModal = true;
return;
}
let response = val;
if (this.loginWay === "password") {
params.mobile = form.name;
params.password = CryptoJS.MD5(form.password).toString();
response = await loginbypw(params);
}
if (this.loginWay === "code") {
params.mobile = form.name;
params.smsCode = form.code;
response = await loginbysms(params);
}
const data = response.data;
setStorageFun(TOKEN_NAME, data.token);
@@ -419,48 +422,53 @@
return;
}
hyyAlipay.openAuthScheme({
appId: "2021005183625053", // 支付宝分配给开发者的应用 ID
scheme: "trustbridgeapp", // manifest.json -> "App常用其他设置" -> "UrlSchemes"里设置
},
(res) => {
console.log("支付宝回调", res);
alipayLogin({
isValid: false,
token: res.auth_code,
}).then((response) => {
console.log("支付宝登录接口返回:", response, !response.data.userId);
if (response && response.bizcode === 100) {
if (response.data.userId) {
// 登录
this.loginWay = "alipay";
this.loginFun(response);
} else {
// 去微信注册
uni.navigateTo({
url: `/pages/login_package/bind-phone/bind-phone?token=${response.data.token}&type=2`,
});
}
hyyAlipay.openAuthScheme({
appId: "2021005183625053", // 支付宝分配给开发者的应用 ID
scheme: "trustbridgeapp", // manifest.json -> "App常用其他设置" -> "UrlSchemes"里设置
},
(res) => {
console.log("支付宝回调", res);
alipayLogin({
isValid: false,
token: res.auth_code,
}).then((response) => {
console.log("支付宝登录接口返回:", response, !response.data.userId);
if (response && response.bizcode === 100) {
if (response.data.userId) {
// 登录
this.loginWay = "alipay";
this.loginFun(response);
} else {
this.$refs.uToastRef.show({
type: "error",
message: response.msg || "微信登录失败",
// 去微信注册
uni.navigateTo({
url: `/pages/login_package/bind-phone/bind-phone?token=${response.data.token}&type=2`,
});
}
});
}
);
},
} else {
this.$refs.uToastRef.show({
type: "error",
message: response.msg || "微信登录失败",
});
}
});
}
);
},
computed: {
isIOS() {
// #ifdef APP-PLUS
return uni.getSystemInfoSync().platform === "ios";
// #endif
return false;
},
handlePolicyConfirm() {
this.showPolicyModal = false;
this.isPolicy = true;
this.loginFun();
},
};
},
computed: {
isIOS() {
// #ifdef APP-PLUS
return uni.getSystemInfoSync().platform === "ios";
// #endif
return false;
},
},
};
</script>
<style lang="scss" scoped>
@@ -527,13 +535,68 @@
padding: 0 100rpx;
justify-content: center;
.login_other_item {
display: flex;
flex: 50%;
font-size: 28rpx;
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
}
.login_other_item {
display: flex;
flex: 50%;
font-size: 28rpx;
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
}
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal-content {
width: 500rpx;
background: #fff;
border-radius: 20rpx;
padding:24rpx;
text-align: center;
}
.modal-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
margin-bottom: 30rpx;
}
.modal-message {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 40rpx;
}
.modal-buttons {
display: flex;
}
.modal-btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
}
.modal-btn-cancel {
color: #999;
border-right: 1rpx solid #eee;
}
.modal-btn-confirm {
color: #7934F6;
}
</style>