Merge remote-tracking branch 'fitjourney前端代码仓库/master'

# Conflicts:
#	pages.json
#	pages/login/register/register.vue
#	unpackage/dist/cache/.vite/deps/_metadata.json
master
Gary 2 months ago
commit b4be4577ac

@ -102,6 +102,18 @@
"mp-toutiao" : {
"usingComponents" : true
},
// "h5": {
// "devServer": {
// "proxy": {
// "/prefix/api/user/list": {
// "target": "http://47.122.61.54:8084",
// "pathRewrite": {
// "^/prefix": ""
// }
// }
// }
// }
// },
"uniStatistics" : {
"enable" : false
},

@ -30,14 +30,14 @@
</view>
</form>
<!-- 修改成功弹窗 -->
<my-pop-up
<my_pop_up
class="change_tip"
@onClick="onOpenUpClick"
@onClose="onClosePopUPClick"
:is-opened="isOpenPopUp"
:title="title"
:content="content"
></my-pop-up>
></my_pop_up>
</view>
</template>

@ -13,14 +13,14 @@
<!-- 手机号输入 -->
<view class="phone_number_box register_form_item">
<view class="form_input_box">
<input type="text" class="phone_number" v-model="phoneNumber" placeholder="请输入你的电话号码"/>
<input v-model="phonenum" type="text" class="phone_number" placeholder="请输入你的电话号码"/>
</view>
<view class="error_tip" v-if="isPhoneError">*</view>
</view>
<!-- 验证码输入 -->
<view class="captcha_box register_form_item">
<view class="form_input_box captcha_input_box">
<input class="captcha" name="captcha" v-model="code" type="text" placeholder="请输入你的验证码"/>
<input v-model="captchanum" class="captcha" name="captcha" type="text" placeholder="请输入你的验证码"/>
<button class="captcha_button" @click="sendCaptchaEvent"
:style="{color:captchaButtonColor, backgroundColor:captchaButtonBackgroundColor}">
{{captchaButtonText}}
@ -31,7 +31,7 @@
<!-- 密码输入 -->
<view class="passage_box register_form_item">
<view class="form_input_box passage_input_box">
<input type="text" class="passage" :password="isOpened_1" placeholder="请输入你的密码"/>
<input v-model="passagenum" type="text" class="passage" :password="isOpened_1" placeholder="请输入你的密码"/>
<image @click="openEyesEvent_1" class="eyes" :src="eyesStateIcon_1"></image>
</view>
<!-- <view class="error_tip" v-if="isPassageError">*</view> -->
@ -39,7 +39,7 @@
<!-- 确认密码输入 -->
<view class="passage_box register_form_item">
<view class="form_input_box passage_input_box">
<input type="text" class="passage" :password="isOpened_2" placeholder="请再次确认密码"/>
<input v-model="passagesamenum" type="text" class="passage" :password="isOpened_2" placeholder="请再次确认密码"/>
<image @click="openEyesEvent_2" class="eyes" :src="eyesStateIcon_2"></image>
</view>
<view class="error_tip" v-if="isPassageSameError">*</view>
@ -50,93 +50,134 @@
</view>
</form>
<!-- 成功弹窗 -->
<my-pop-up
<my_pop_up
class="register_tip"
@onClick="onOpenUpClick"
@onClick="onOpenUpClick"
@onClose="onClosePopUPClick"
:is-opened="isOpenPopUp"
:title="title"
:isOpened="isOpenPopUp"
:title="title"
:content="content"
></my-pop-up>
></my_pop_up>
</view>
</template>
<script setup>
/*-----------------------------------------------------------外部导入-------------------------------------------*/
import { ref, computed } from 'vue';
import app from "@/App.vue";
const phoneNumber = ref("");//
const code= ref("");//
const isCaptchaError = ref(false);
const isPhoneError = ref(false);
const isPassageSameError = ref(false);
const password = ref("13959885560");
const title = '成功'; //
const content = '注册成功'; //
const isOpenPopUp = ref(false);//
/*-----------------------------------------------------------变量----------------------------------------------*/
/*导入的全局变量*/
const app = getApp();
/*手机号框相关变量*/
const phonenum = ref(); //
const isPhoneError = ref(false);//
/*验证码框相关变量*/
const captchanum = ref(); //
const isCaptchaError = ref(false); //
const isSendCaptcha = ref(false); //
var codeTime = ref(0); //
const captchaButtonBackgroundColor = computed(() => isSendCaptcha.value ? "#ABCBFF" : "#ffffff"); //
const captchaButtonColor = computed(() => isSendCaptcha.value ? "#ffffff" : "#000364");//
const captchaButtonText = computed(() => isSendCaptcha.value ? (codeTime.value+"s后重新发送"):"发送验证码");
/*密码框相关变量*/
const passagenum = ref(); //
const passagesamenum = ref(); //
const isPassageSameError = ref(false);//
const isOpened_1 = ref(true); //
const eyesStateIcon_1 = ref("../../../static/login/register/pictures/closedeyes.png");
const isOpened_2 = ref(true); //
const eyesStateIcon_2 = ref("../../../static/login/register/pictures/closedeyes.png");
//
function sendCaptchaEvent(){
console.log("send captcha");
if (codeTime.value>0){ //
uni.showToast({ //
title: '不能重复获取',
icon:"none"
});
} else{ //
codeTime.value = 60;
isSendCaptcha.value = true;
var timer = setInterval(()=>{
codeTime.value--;
if(codeTime.value<1){
clearInterval(timer);
isSendCaptcha.value = false;
codeTime.value = 0;
}
},1000)
}
//
const serverAddress = app.globalData.fit_journey_login_address + '/phone_code_register/getPhoneCode';
console.log(String(phoneNumber.value));
//
uni.request({
url: serverAddress,
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: {
phone: phoneNumber.value
},
success: (res) => {
console.log(res.data);
},
fail: (err) => {
console.log("请求失败", err);
}
});
/*注册的相关变量*/
const isRegisterSuccess = ref(false); //
/*弹窗相关变量*/
const title = computed(()=>isRegisterSuccess.value? '成功':'错误'); //
const content = computed(()=>isRegisterSuccess.value? '注册成功':'注册失败'); //
const isOpenPopUp = ref(false);//
/*正则表达式相关变量*/
const pMatch = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
/*-----------------------------------------------------------函数----------------------------------------------*/
/*-----验证码相关函数-----*/
function checkPhone(){
var flag=true
//
if (phonenum.value==undefined){
flag = false
uni.showToast({ //
title: '手机号不能为空',
icon:"error",
});
}else if (!pMatch.test(phonenum.value)){
flag = false
// isPhoneError.value = true
uni.showToast({ //
title: '手机号错误',
icon:"error",
});
} else {
isPhoneError.value = false
}
return flag
}
function sendCaptchaEvent(){
//TODO:
console.log("点击发送验证码按钮");
//
if (checkPhone()){
//
if (codeTime.value>0){ //
uni.showToast({ //
title: '不能重复获取',
icon:"none"
});
} else{ //
codeTime.value = 60;
isSendCaptcha.value = true;
var timer = setInterval(()=>{
codeTime.value--;
if(codeTime.value<1){
clearInterval(timer);
isSendCaptcha.value = false;
codeTime.value = 0;
}
},1000)
};
//
uni.request({
// url:app.globalData.fit_journey_login_address+'/phone_code_register/getPhoneCode',
url:'http://47.122.61.54:8084/phone_code_register/getPhoneCode',
method:'POST',
header:{
'Content-Type':'application/x-www-form-urlencoded',
},
data:{
phone:phonenum.value
},
success:(res)=>{
console.log('发送验证码请求成功:'+res.data)
},
fail:(err)=>{
console.log('发送验证码请求失败')
console.log(err)
}
})
}
}
//
/*-----密码码相关函数-----*/
function openEyesEvent_1(){
//TODO:
if (isOpened_1.value)
{
isOpened_1.value = false;
@ -148,8 +189,8 @@ function openEyesEvent_1(){
eyesStateIcon_1.value = "../../../static/login/register/pictures/closedeyes.png";
}
}
//
function openEyesEvent_2(){
//TODO:
if (isOpened_2.value)
{
isOpened_2.value = false;
@ -162,34 +203,101 @@ function openEyesEvent_2(){
}
}
//
/*-----注册按钮相关函数-----*/
function checkSubmit(){
//TODO:
var flag = true
//
if (phonenum.value==undefined){
flag = false
uni.showToast({ //
title: '手机号不能为空',
icon:"error",
});
}else if (!pMatch.test(phonenum.value)){
flag = false
// isPhoneError.value = true
uni.showToast({ //
title: '手机号错误',
icon:"error",
});
} else {
isPhoneError.value = false
}
//
if (passagenum.value==undefined){
flag = false
uni.showToast({ //
title: '密码不能为空',
icon:"error",
});
}else if (passagesamenum.value==undefined){
//
flag = false
uni.showToast({ //
title: '请再输入密码',
icon:"error",
});
}else if (passagenum.value!=passagesamenum.value){
//
flag = false
// isPassageSameError.value = true
uni.showToast({ //
title: '两次密码不相等',
icon:"error",
});
} else{
isPassageSameError.value = false
}
//
if (captchanum.value==undefined){
flag = false
// isCaptchaError.value = true
uni.showToast({ //
title: '验证码为空',
icon:"error",
});
} else{
isCaptchaError.value = false
}
return flag
}
function registerEvent(){
//
const serverAddress = app.globalData.fit_journey_login_address + '/phone_code_register/registerByPhone';
//
uni.request({
url: serverAddress,
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: {
phone: phoneNumber.value,
code: code.value,
password: "13959885560"
},
success: (res) => {
console.log(res.data);
//TODO:(code==200)
},
fail: (err) => {
console.log("请求失败", err);
}
});
isOpenPopUp.value = true; //
//TODO:
//
if (checkSubmit()){
//
uni.request({
// url:app.globalData.fit_journey_login_address+'/phone_code_register/registerByPhone',
url:'http://47.122.61.54:8084/phone_code_register/registerByPhone',
method:'POST',
data:{
code:captchanum.value,
phone:phonenum.value
},
success:(res)=>{
console.log('注册成功:'+res.data)
isRegisterSuccess.value = true
isOpenPopUp.value = true //
},
fail:(err)=>{
console.log('注册失败'+err)
isRegisterSuccess.value = false
isOpenPopUp.value = true //
}
})
}
}
/*-----弹窗相关函数-----*/
function onOpenUpClick(){
//TODO:
uni.navigateTo({
url: '/pages/login/account_login/account_login',
animationType: 'pop-in', //
@ -204,5 +312,158 @@ function onClosePopUPClick(){
</script>
<style lang="scss">
@import '@/static/login/register/css/register.scss';
.register_box{
background-image: url("../../../static/login/register/pictures/background.png");
background-size: cover;
background-position: center;
height: 100vh;
width: auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
object-fit: contain;
//
.return_image{
position: absolute;
left: 16.5%;
right: 80.1%;
top: 8.62%;
bottom: 89.09%;
width: 0.8rem;
height: auto;
object-fit: contain;
}
//
.welcom_words{
position: absolute;
left: 12.4%;
top: 30.8%;
font-family: 'PingFang SC';
font-size: 1.4rem;
color: #000364;
}
//
.soft_name{
position: absolute;
left: 12.4%;
top: 34.5%;
font-family: 'PingFang SC';
font-size: 1rem;
color: #000364;
}
//
.register_form{
position: absolute;
width: 74.5%;
height: 33.6%;
top: 40%;
//
.register_form_item{
height: auto;
margin-bottom: 5%;
.form_input_box{
padding-left: 3%;
padding-right: 3%;
background-color: #D5E9FF;
border-radius: 12px;
}
.error_tip{
margin-top: 0.6vh;
padding-left: 3%;
font-size: 0.8rem;
color: #FF1E1E;
}
}
//
.phone_number_box{
display: flex;
flex-direction: column;
.phone_number{
height: 5.5vh;
padding-left: 11%;
background-image: url("../../../static/login/register/pictures/phone_icon.png");
background-repeat: no-repeat;
background-size: 0.8rem;
background-position: 3% 50%;
background-color: #D5E9FF;
font-size: 0.8rem;
}
}
//
.captcha_box{
display: flex;
flex-direction: column;
.captcha_input_box{
display: flex;
align-items: center;
padding-left: 3%;
background-color: #D5E9FF;
border-radius: 12px;
position: relative;
.captcha{
height: 5.5vh;
padding-left: 11%;
background-image: url("../../../static/login/register/pictures/captcha_icon.png");
background-repeat: no-repeat;
background-size: 0.8rem;
background-position: 4.5% 50%;
font-size: 0.8rem;
}
.captcha_button{
/* 发送验证码 */
width: 5.5rem;
height: 1.9rem;
border-radius: 15px;
font-size: 0.8rem;
color: #000364;
position: absolute;
right: 5%;
}
}
}
//
.passage_box{
display: flex;
flex-direction: column;
.passage_input_box{
display: flex;
align-items: center;
background-color: #D5E9FF;
border-radius: 12px;
position: relative;
.passage{
height: 5.5vh;
padding-left: 11%;
background-image: url("../../../static/login/register/pictures/lock_icon.png");
background-repeat: no-repeat;
background-size: 0.8rem;
background-position: 4.7% 50%;
font-size: 0.8rem;
}
.eyes{
width: 1rem;
height: 1rem;
position: absolute;
right: 13%;
}
}
}
//
.register_button{
display: flex;
align-items: center;
justify-content: center;
margin-top: 8%;
height: 5.5vh;
border-radius: 12px;
background-color: #4A69F7;
color: #FFFCFC;
text-align: center;
font-size: 1.2rem;
}
}
}
</style>

Loading…
Cancel
Save