更改部分接口传参方式

This commit is contained in:
gyq 2025-07-16 09:38:30 +08:00
parent d1621e78f1
commit 4306ba1900
8 changed files with 698 additions and 690 deletions

View File

@ -5,6 +5,9 @@ export async function init() {
//热搜词
http.request({
url: 'common/type/249',
data: {
type: 249
}
}).then(res => {
if (res.code == 0) {
uni.setStorageSync('moreSearch', res.data.value)
@ -18,6 +21,9 @@ export async function init() {
export const commonType = (num) => {
return http.request({
url: `/common/type/${num}`,
data:{
type: num
}
})
}

View File

@ -14,9 +14,13 @@ export const login = (data) => {
/**
* 发送验证码
*/
export const setSendMsg = (mobile,type) => {
export const setSendMsg = (mobile, type) => {
return http.request({
url: '/Login/sendMsg/' + mobile + '/'+type
url: '/Login/sendMsg/' + mobile + '/' + type,
data: {
phone: mobile,
event: type
}
})
}
@ -72,4 +76,4 @@ export const $bindStatus = (data) => {
method: 'GET',
data: data
})
}
}

View File

@ -17,7 +17,10 @@ export const selectByUserId = (data) => {
export const commonType = (type) => {
return http.request({
url: `/common/type/${type}`,
method: 'GET'
method: 'GET',
data: {
type: type
}
})
}

View File

@ -56,7 +56,10 @@ export function insertHistory(data) {
export function getJinbiBili(data) {
return http.request({
url: 'common/type/914',
data
data: {
...data,
type: 914
}
})
}
@ -140,11 +143,11 @@ export function playStatus(data) {
}
// 获取支付次数提示
export function getPayTips(data){
export function getPayTips(data) {
return http.request({
url: 'course/getRedEnvelopeTips',
method: 'GET',
data
})
}
}

View File

@ -9,14 +9,14 @@ export const h5Config = {
production: 'https://web.hnsiyao.cn',
test: 'https://web-api.hnsiyao.cn',
// local: 'http://192.168.1.21:8100',
local: 'http://192.168.1.43:1333',
local: 'http://192.168.1.31:8080',
}
export const AppConfig = {
production: 'https://dj-api.hnsiyao.cn',
test: 'https://web-api.hnsiyao.cn',
// local: 'http://192.168.1.21:8100',
local: 'http://192.168.1.43:1333',
local: 'http://192.168.1.31:8080',
}
export function returnShareUrl() {

View File

@ -118,8 +118,7 @@ function commonsProcess(showLoading, httpReqCallback, isreturm) {
if (bodyData.code != 0) {
infoBox.showToast(data.message);
return;
return Promise.reject(bodyData);
}
// 加密数据

View File

@ -1,404 +1,403 @@
<template>
<view class="container">
<view class="bg" >
<image src="../../static/default/i_bg.png" style="width: 100%;height:100%" mode="aspectFill"></image>
<view class="bg">
<image src="../../static/default/i_bg.png" style="width: 100%; height: 100%" mode="aspectFill"></image>
</view>
<view class="wrapper u-relative" style="padding-top: 48rpx;box-sizing: border-box;">
<view class="nav" style="width: 100%;height: 96rpx;"></view>
<view class="wrapper u-relative" style="padding-top: 48rpx; box-sizing: border-box">
<view class="nav" style="width: 100%; height: 96rpx"></view>
<view class="input-content">
<view style="font-size: 58rpx;font-weight: bold;color: #333;margin-bottom: 48rpx;">注册</view>
<view style="font-size: 58rpx; font-weight: bold; color: #333; margin-bottom: 48rpx">注册</view>
<view class="cu-form-group">
<view class="title">手机号</view>
<view class="input" style="padding-left: 20rpx;">
<input class="input" type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
<view class="input" style="padding-left: 20rpx">
<input class="input" type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile" @input="inputChange" />
</view>
</view>
<view class="cu-form-group">
<text class="title">验证码</text>
<view class="input flex" style="padding-left: 20rpx;padding-right: 20rpx;">
<input type="number" :value="data.code" placeholder="请输入验证码" maxlength="6" data-key="code"
@input="inputChange" @confirm="toRegister" />
<view class="input flex" style="padding-left: 20rpx; padding-right: 20rpx">
<input type="number" :value="data.code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange" @confirm="toRegister" />
<button class="send-msg" @click="sendMsg" :disabled="data.sending">{{ data.sendTime }}</button>
</view>
</view>
<view class="cu-form-group">
<text class="title">设置密码</text>
<view class="input" style="padding-left: 20rpx;">
<input class="input" type="password" :value="data.password" placeholder="请设置新密码" placeholder-class="input-empty"
maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="toRegister" />
<view class="input" style="padding-left: 20rpx">
<input
class="input"
type="password"
:value="data.password"
placeholder="请设置新密码"
placeholder-class="input-empty"
maxlength="20"
minlength="6"
data-key="password"
@input="inputChange"
@confirm="toRegister"
/>
</view>
</view>
<button class="confirm-btn" @click="toRegister">注册</button>
<button class="confirm-btn" @click="toLogin">登录</button>
</view>
<view class="footerView">
<u-checkbox-group>
<u-checkbox v-model="data.checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
<u-checkbox v-model="data.checked" label-size="24upx" shape="circle" @change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>注册即同意</view>
<!-- 协议地址 -->
<view @click="linkTo('/pages/me/privacy')" style="color: #37A6FF;">隐私政策</view>
<view @click="linkTo('/pages/me/privacy')" style="color: #37a6ff">隐私政策</view>
<view @click="linkTo('/pages/me/agreement')" style="color: #37A6FF;">用户服务协议</view>
<view @click="linkTo('/pages/me/agreement')" style="color: #37a6ff">用户服务协议</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import {setSendMsg,register} from '@/api/login/login.js';
import {commonType} from '@/api/init.js';
import { linkTo } from '@/utils/app.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
isregisterCode: '',
qdCodeion: '', //
checked: false,
})
onLoad(async ( options ) => {
if (uni.getStorageSync('qdCodeion')) { data.qdCodeion = uni.getStorageSync('qdCodeion') }
if (options.qdCode) { data.qdCodeion = options.qdCode }
if (options.invitation ) { data.invitation = options.invitation }
let res = await commonType(3)
data.isregisterCode = res.value
})
/**
* 发送验证码
*/
async function sendMsg () {
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { setSendMsg, register } from '@/api/login/login.js';
import { commonType } from '@/api/init.js';
import { linkTo } from '@/utils/app.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: '',
invitation: '',
isregisterCode: '',
qdCodeion: '', //
checked: false
});
onLoad(async (options) => {
if (uni.getStorageSync('qdCodeion')) {
data.qdCodeion = uni.getStorageSync('qdCodeion');
}
if (options.qdCode) {
data.qdCodeion = options.qdCode;
}
if (options.invitation) {
data.invitation = options.invitation;
}
let res = await commonType(3);
data.isregisterCode = res.value;
});
/**
* 发送验证码
*/
async function sendMsg() {
try {
if (!data.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
})
icon: 'none'
});
} else if (data.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
})
icon: 'none'
});
} else {
uni.showLoading({
title: '正在发送验证码...'
})
let res = await setSendMsg(data.mobile,'login')
uni.hideLoading();
uni.hideToast();
if( res ){
data.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: '请一分钟后再获取验证码'
});
}
}
}
/**
* 验证码倒计时
*/
function countDown() {
console.log(data.count)
if (data.count === 1) {
data.count = 60;
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = data.count - 1;
});
let res = await setSendMsg(data.mobile, 'login');
console.log(res);
data.sending = true;
data.sendTime = data.count - 1 + '秒后重新获取';
setTimeout(countDown.bind(this), 1000);
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
});
countDown();
}
}
/**
* 获取注册值
* @param {Object} e
*/
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
data.checked = e
}
/**
* 登录
*/
function toLogin() {
uni.reLaunch({
url: '/pages/login/login'
} catch (error) {
console.log(error);
uni.showToast({
title: error.message,
icon: 'none',
duration: 1000
});
}
/**
* 注册
*/
async function toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
isregisterCode,
qdCodeion
} = data;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
})
return
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && isregisterCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
data.logining = true;
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
let res = await register({
password: password,
phone: mobile,
msg: code,
inviterCode: invitation,
platform: platform,
qdCode: qdCodeion,
})
if (res.code === 0) {
uni.setStorageSync('token', res.token)
uni.setStorageSync('userInfo', res.user)
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/index'
});
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
uni.hideLoading();
uni.hideLoading();
}
/**
* 验证码倒计时
*/
function countDown() {
console.log(data.count);
if (data.count === 1) {
data.count = 60;
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = data.count - 1;
data.sending = true;
data.sendTime = data.count - 1 + '秒后重新获取';
setTimeout(countDown.bind(this), 1000);
}
}
/**
* 获取注册值
* @param {Object} e
*/
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
data.checked = e;
}
/**
* 登录
*/
function toLogin() {
uni.reLaunch({
url: '/pages/login/login'
});
}
/**
* 注册
*/
async function toRegister() {
const { mobile, password, code, checked, invitation, isregisterCode, qdCodeion } = data;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
});
return;
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
});
return;
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
});
return;
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
});
return;
}
if (invitation.length == 0 && isregisterCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
});
return;
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
});
return;
}
data.logining = true;
uni.showLoading({
title: '注册中...'
});
let platform = '';
// #ifdef APP
platform = 'app';
// #endif
// #ifdef H5
platform = 'h5';
// #endif
let res = await register({
password: password,
phone: mobile,
msg: code,
inviterCode: invitation,
platform: platform,
qdCode: qdCodeion
});
if (res.code === 0) {
uni.setStorageSync('token', res.token);
uni.setStorageSync('userInfo', res.user);
uni.showToast({
title: '注册成功',
icon: 'none'
});
setTimeout(function () {
uni.switchTab({
url: '/pages/index/index'
});
}, 1000);
} else {
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
uni.hideLoading();
}
</script>
<style lang="scss" scoped>
page {
background: #ffffff;
}
*{
box-sizing: border-box;
}
.bg{
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
}
.wrapper{
position: relative;
padding-top: 48rpx;
box-sizing: border-box;
}
.flex{
display: flex;
}
.footerView {
display: flex;
justify-content: center;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #333333;
margin-top: 50rpx;
}
.cuIcon::before{
width: 30rpx;
height: 30rpx;
margin-right: 12rpx;
}
.cuIcon-round::before {
content: "\e6d7";
}
.cuIcon-radiobox:before {
content: "\e75b";
color: #37A6FF;
}
.send-msg {
line-height: initial;
page {
background: #ffffff;
}
* {
box-sizing: border-box;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
}
.wrapper {
position: relative;
padding-top: 48rpx;
box-sizing: border-box;
}
.flex {
display: flex;
}
.footerView {
display: flex;
justify-content: center;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #333333;
margin-top: 50rpx;
}
.cuIcon::before {
width: 30rpx;
height: 30rpx;
margin-right: 12rpx;
}
.cuIcon-round::before {
content: '\e6d7';
}
.cuIcon-radiobox:before {
content: '\e75b';
color: #37a6ff;
}
.send-msg {
flex-shrink: 0;
line-height: initial;
font-weight: 400;
font-size: 28rpx;
color: #ec6f48;
border: none;
background-color: transparent;
margin: 0;
padding: 0;
white-space: nowrap;
}
.send-msg::after {
border: none;
background-color: transparent;
}
.container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #ffffff;
box-sizing: border-box;
}
.wrapper {
min-height: 100vh;
position: relative;
z-index: 90;
}
.input-content {
padding: 0 56rpx;
}
.cu-form-group {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 48rpx;
background-color: transparent;
padding: 0;
.title {
margin-bottom: 32rpx;
font-weight: 400;
font-size: 28rpx;
color: #EC6F48;
border: none;
background-color: transparent;
margin: 0;
padding: 0;
color: #333333;
}
.send-msg::after{
border: none;
background-color: transparent;
}
.container {
position: relative;
.input {
width: 100%;
height: 100%;
overflow: hidden;
background: #ffffff;
box-sizing: border-box;
}
.wrapper {
min-height: 100vh;
position: relative;
z-index: 90;
}
.input-content {
padding: 0 56rpx;
}
.cu-form-group{
// height: 84rpx;
// line-height: 84rpx;
background-color: #fff;
align-items: center;
// padding: 22rpx 32rpx 22rpx 24rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 48rpx;
background-color: transparent;
padding: 0;
.title{
margin-bottom: 32rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
align-items: center;
justify-content: space-between;
input {
height: 84rpx !important;
}
.input{
width: 100%;
// height: 84rpx;
// line-height: 84rpx;
background-color: #fff;
align-items: center;
// padding: 22rpx 32rpx 22rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
input{
height: 84rpx!important;
}
v-deep .uni-input-input{
height: 84rpx!important;
}
v-deep .uni-input-input {
height: 84rpx !important;
}
}
}
.confirm-btn {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
border-radius: 16rpx;
margin-top: 40rpx;
background: #EC6F48;
font-size: 32rpx;
color: #FFFFFF;
.confirm-btn {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
border-radius: 16rpx;
margin-top: 40rpx;
background: #ec6f48;
font-size: 32rpx;
color: #ffffff;
&:after {
border: none;
}
&:after {
border: none;
}
</style>
}
</style>

View File

@ -1,30 +1,37 @@
<template>
<view class="container">
<view class="bg" >
<image src="../../static/default/i_bg.png" style="width: 100%;height:100%" mode="aspectFill"></image>
<view class="bg">
<image src="../../static/default/i_bg.png" style="width: 100%; height: 100%" mode="aspectFill"></image>
</view>
<view class="wrapper u-relative" style="padding-top: 48rpx;box-sizing: border-box;">
<view class="wrapper u-relative" style="padding-top: 48rpx; box-sizing: border-box">
<view class="input-content">
<view style="font-size: 58rpx;font-weight: bold;color: #333;margin-bottom: 48rpx;">注册</view>
<view class="cu-form-group" >
<view style="font-size: 58rpx; font-weight: bold; color: #333; margin-bottom: 48rpx">注册</view>
<view class="cu-form-group">
<view class="title">手机号</view>
<input class="input" type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
<input class="input" type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile" @input="inputChange" />
</view>
<view class="cu-form-group" >
<view class="cu-form-group">
<text class="title">验证码</text>
<view class="input flex">
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code"
@input="inputChange" @confirm="toLogin" />
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange" @confirm="toLogin" />
<button class="send-msg" @click="sendMsg" :disabled="sending">{{ sendTime }}</button>
</view>
</view>
<view class="cu-form-group" >
<view class="cu-form-group">
<text class="title">设置密码</text>
<input class="input" type="password" :value="password" placeholder="请设置新密码" placeholder-class="input-empty"
maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="toLogin" />
<input
class="input"
type="password"
:value="password"
placeholder="请设置新密码"
placeholder-class="input-empty"
maxlength="20"
minlength="6"
data-key="password"
@input="inputChange"
@confirm="toLogin"
/>
</view>
<!-- <view class="cu-form-group"
style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
@ -39,363 +46,350 @@
</view>
<view class="footerView">
<u-checkbox-group>
<u-checkbox v-model="checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
<u-checkbox v-model="checked" label-size="24upx" shape="circle" @change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>同意</view>
<!-- 协议地址 -->
<navigator url="/me/setting/mimi" open-type="navigate" style="color: #37A6FF;">隐私政策</navigator>
<navigator url="/me/setting/mimi" open-type="navigate" style="color: #37a6ff">隐私政策</navigator>
<navigator url="/me/setting/xieyi" open-type="navigate" style="color: #37A6FF;">用户协议</navigator>
<navigator url="/me/setting/xieyi" open-type="navigate" style="color: #37a6ff">用户协议</navigator>
</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import http from '@/http/http.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
registerCode: '',
qdCodeion: '', //
checked: false,
})
onLoad(( options ) => {
let relation = e.invitation
if (relation) {
this.relation = relation;
this.invitation = relation;
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import http from '@/http/http.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: '',
invitation: '',
registerCode: '',
qdCodeion: '', //
checked: false
});
onLoad((options) => {
let relation = e.invitation;
if (relation) {
this.relation = relation;
this.invitation = relation;
}
if (e.qdCode) {
this.qdCodeion = e.qdCode;
}
http.request({
url: 'app/common/type/3',
data: {
type: 3
}
if (e.qdCode) {
this.qdCodeion = e.qdCode
}).then((res) => {
if (res.code == 0) {
this.registerCode = res.data.value;
}
http.request({
url:'app/common/type/3',
}).then(res => {
if (res.code == 0) {
this.registerCode = res.data.value
}
});
});
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
this.checked = e;
}
function showMa() {
//
this.$Request.getT('/common/type/88', { type: 88 }).then((res) => {
if (res.code == 0) {
this.invitation = res.data.value;
}
});
}
function sendMsg() {
const { mobile } = this;
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
});
})
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
this.checked = e
}
function showMa() {
//
this.$Request.getT('/common/type/88').then(res => {
if (res.code == 0) {
this.invitation = res.data.value;
}
} else if (mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
});
}
function sendMsg() {
const {
mobile
} = this;
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
http.request({
url:'app/Login/sendMsg/' + mobile + '/login',
}).then(res => {
if (res.code === 0) {
this.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
})
}
}
function countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
}
function inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
}
function toLogin() {
console.log("123");
uni.reLaunch({
url: '/pages/login/login'
});
}
function toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
registerCode,
qdCodeion
} = this;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
})
return
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
this.logining = true;
} else {
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
title: '正在发送验证码...'
});
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code +
'&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion,
method: 'post'
}).then(res => {
url: 'app/Login/sendMsg/' + mobile + '/login'
}).then((res) => {
if (res.code === 0) {
// this.$queue.remove('invitation');
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
this.sending = true;
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/pages/login/appEq'
})
}, 1000)
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
});
this.countDown();
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
});
}
}
function countDown() {
const { count } = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
}
function inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
}
function toLogin() {
console.log('123');
uni.reLaunch({
url: '/pages/login/login'
});
}
function toRegister() {
const { mobile, password, code, checked, invitation, registerCode, qdCodeion } = this;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
});
return;
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
});
return;
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
});
return;
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
});
return;
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
});
return;
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
});
return;
}
this.logining = true;
uni.showLoading({
title: '注册中...'
});
let platform = '';
// #ifdef APP
platform = 'app';
// #endif
// #ifdef H5
platform = 'h5';
// #endif
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code + '&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion,
method: 'post'
}).then((res) => {
if (res.code === 0) {
// this.$queue.remove('invitation');
uni.setStorageSync('token', res.token);
uni.setStorageSync('userId', res.user.userId);
uni.setStorageSync('phone', res.user.phone);
uni.setStorageSync('invitationCode', res.user.invitationCode);
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode);
}
uni.showToast({
title: '注册成功',
icon: 'none'
});
setTimeout(function () {
uni.navigateTo({
url: '/pages/login/appEq'
});
}, 1000);
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
});
}
</script>
<style lang="scss" scoped>
page {
background: #fff;
page {
background: #fff;
}
* {
box-sizing: border-box;
}
.flex {
display: flex;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
}
.wrapper {
position: relative;
padding-top: 48rpx;
box-sizing: border-box;
}
.footerView {
display: flex;
justify-content: center;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #333333;
// position: absolute;
// left: 0;
// right: 0;
// bottom: 178rpx;
.cuIcon::before {
width: 30rpx;
height: 30rpx;
margin-right: 12rpx;
}
*{
box-sizing: border-box;
.cuIcon-round::before {
content: '\e6d7';
}
.flex{
display: flex;
}
.bg{
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
}
.wrapper{
position: relative;
padding-top: 48rpx;
box-sizing: border-box;
}
.footerView {
display: flex;
justify-content: center;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #333333;
// position: absolute;
// left: 0;
// right: 0;
// bottom: 178rpx;
.cuIcon::before{
width: 30rpx;
height: 30rpx;
margin-right: 12rpx;
}
.cuIcon-round::before {
content: "\e6d7";
}
.cuIcon-radiobox:before {
content: "\e75b";
color: #37A6FF;
}
.cuIcon-radiobox:before {
content: '\e75b';
color: #37a6ff;
}
}
.send-msg {
line-height: initial;
font-weight: 400;
font-size: 28rpx;
color: #EC6F48;
border: none;
background-color: transparent!important;
}
.send-msg::after{
border: none;
.send-msg {
line-height: initial;
font-weight: 400;
font-size: 28rpx;
color: #ec6f48;
border: none;
background-color: transparent !important;
}
.send-msg::after {
border: none;
background-color: transparent;
}
.container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #fff;
}
.wrapper {
position: relative;
z-index: 90;
min-height: 100vh;
}
.input-content {
padding: 0 56rpx;
.cu-form-group {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 48rpx;
background-color: transparent;
}
.container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #fff;
}
.wrapper {
position: relative;
z-index: 90;
min-height: 100vh;
}
.input-content {
padding: 0 56rpx;
.cu-form-group{
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 48rpx;
background-color: transparent;
padding: 0;
.title{
margin-bottom: 32rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.input{
width: 100%;
height: 84rpx;
line-height: 84rpx;
background-color: #fff;
align-items: center;
padding: 22rpx 32rpx 22rpx 24rpx;
}
padding: 0;
.title {
margin-bottom: 32rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.input {
width: 100%;
height: 84rpx;
line-height: 84rpx;
background-color: #fff;
align-items: center;
padding: 22rpx 32rpx 22rpx 24rpx;
}
}
}
.confirm-btn {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
border-radius: 16rpx;
margin-top: 40rpx;
background: #ec6f48;
font-size: 32rpx;
color: #ffffff;
.confirm-btn {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
border-radius: 16rpx;
margin-top: 40rpx;
background: #EC6F48;
font-size: 32rpx;
color: #FFFFFF;
&:after {
border: none;
}
&:after {
border: none;
}
</style>
}
</style>