Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-12 17:48:25 +08:00
3 changed files with 65 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "jdt-user",
"version": "3.0.14",
"version": "3.0.15",
"private": true,
"description": "",
"templateInfo": {
@@ -9,7 +9,7 @@
"css": "sass"
},
"taroConfig": {
"version": "3.0.14"
"version": "3.0.15"
},
"scripts": {
"build:weapp": "taro build --type weapp",

View File

@@ -121,10 +121,10 @@ const formSubmit = async (e: any) => {
<image class="image" :src="logoImg"></image>
<text class="mp-name">捷兑通 申请</text>
</view>
<view class="trip-msg">
<!-- <view class="trip-msg">
<view class="title"> 获取您的昵称头像 </view>
<view class="trip"> 提供具有辨识度的用户中心界面 </view>
</view>
</view> -->
<form @submit="formSubmit">
<view class="edit">
<view class="avatar edit-box">

View File

@@ -2,6 +2,7 @@
import Taro from "@tarojs/taro";
import UserModal from "@/components/UserModal.vue";
import { ref } from "vue";
import { getPhone, login } from "@/api/user";
import logoImg from "../../../static/logo.jpg";
const isShow = ref(false);
@@ -30,6 +31,60 @@ const getCode = () => {
});
};
const userInfo = ref({
phone: "",
});
const getPhoneNumber = async (e: any) => {
if (!val.value) {
Taro.showToast({
title: "请先阅读并同意用户协议&隐私政策&积分使用规则",
icon: "none",
});
} else {
Taro.showLoading({
title: "授权手机号中",
mask: true,
});
const { code } = e.detail;
const res = await getPhone({
code: code,
});
userInfo.value.phone = res.data.phone;
if (!res.data.phone)
return Taro.showToast({
title: "手机号获取失败",
icon: "none",
});
Taro.login({
success: async (res) => {
Taro.setStorageSync("wx_code", res.code);
const ress = await login({
Code: Taro.getStorageSync("wx_code"),
Phone: userInfo.value.phone,
Referee: Taro.getStorageSync("bind_id") || "",
});
Taro.showToast({
title: ress.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", ress.data.token);
setTimeout(() => {
Taro.removeStorageSync("wx_code");
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
}, 2000);
},
complete: () => {
Taro.hideLoading();
},
});
}
};
const toPage = () => {
if (!val.value)
return Taro.showToast({
@@ -42,7 +97,6 @@ const toPage = () => {
};
const clickText = (type: number, text: string) => {
console.log("点击了协议", type);
Taro.navigateTo({
url: `/pages/users/user_agreement/index?type=${type}&name=${text}`,
});
@@ -57,7 +111,12 @@ const clickText = (type: number, text: string) => {
<view>捷兑通</view>
</view>
<view class="center">
<nut-button type="primary" @click="getCode">手机号一键登录</nut-button>
<nut-button
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>手机号一键登录</nut-button
>
<nut-button style="margin-top: 15px" @click="toPage"
>手机号登录/注册</nut-button
>