This commit is contained in:
zmr900709
2020-06-17 12:09:28 +08:00
parent 53b9086f5f
commit b534c2323e
9 changed files with 444 additions and 143 deletions

View File

@@ -8,24 +8,20 @@
<view class="title">手机登录</view>
<view class="labales">
<!-- <text></text> -->
<input type="tel" placeholder="手机号" />
<input type="tel" placeholder="请输入您的手机号" v-model="member_mobile" />
</view>
<view class="labales">
<!-- <text></text> -->
<input type="tel" placeholder="请输入验证码" />
<input type="tel" placeholder="请输入验证码" v-model="sms_code" />
<!-- <text class="identifying" @click="getCode">{{text}}</text> -->
<view class="wrap">
<u-toast ref="uToast"></u-toast>
<u-verification-code :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
<view class="view_getcode" @tap="getCode">{{tips}}</view>
</view>
<identifying @tochange="tochange" :smslog_type="smslog_type" :member_mobile="member_mobile" ></identifying>
</view>
<!-- 服务协议 -->
<view class="pact">
<view></view>
<text>我已详细阅读并同意</text>
<text class="pact_text">用户协议</text>
<text class="pact_text">用户协议 </text>
<text class="pact_text">隐私协议</text>
<text class="pact_text">使用协议</text>
<u-checkbox-group @change="checkboxGroupChange" size="27">
@@ -36,17 +32,17 @@
</view>
<!-- 注册 -->
<view class="more_Login">
<text>新用户点击注册</text>
<text @click="registerUrl()">{{register}}</text>
<text class="other" @click="mask_u">其他方式登录</text>
</view>
<!-- denglu QQ weixin -->
<view class="buttones">
<u-button>{{login}}</u-button>
<u-button @click="loginOn">{{login}}</u-button>
</view>
<u-mask :show="show" @click="show = false">
<view class="warp">
<view class="rect" @tap.stop>
<view class="rect_view">
<view class="rect_view" @click="rect_qq()">
<image src="../../static/pageA/qq.png" class="image"></image>
<view>QQ登录</view>
</view>
@@ -59,26 +55,127 @@
</view>
</u-mask>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import identifying from '@/components/logininput/identifying'
export default {
data() {
return {
list: [{
checked: false,
checked: true,
disabled: false
}],
value: '',
phones : '',
text: '获取验证码',
login: '登录',
register : '新用户点击注册',
show: false,
tips: '',
// refCode: null,
seconds: 60,
member_mobile: '', //手机号
smslog_type : '2',//状态
sms_code : '', //验证码
};
},
onLoad() {
// 数据的请求
this.apiwelcome()
},
methods: {
apiwelcome(){
this.$u.api.sendSmsCode({
}).then((res)=>{
console.log(res)
})
},
// 用户登录
loginOn(){
// console.log("登录")
// console.log(this.member_mobile)
// console.log(this.sms_code)
this.$u.api.phoneLogin({
member_mobile: this.member_mobile,
sms_code: this.sms_code
}).then((res) => {
// console.log(res)
if(res.errCode == 0){
// 缓存用户的信息
uni.setStorage({
key: 'user_info',
data: res.data,
success: function () {
console.log('success');
}
});
// 注册返回参数
this.$refs.uToast.show({
title: res.message,
type: 'success',
url: '/pageA/topick/topick'
})
}
if(res.errCode == 1){
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
},
// qq授权登录
rect_qq(){
console.log("授权Q")
var vm = this;
uni.getProvider({
service: 'oauth',
success: function (res) {
console.log('qq',res) //weixin
if (~res.provider.indexOf('qq')) {
uni.login({
provider: 'qq',
success: function (loginRes) {
console.log(loginRes)
this.getApplogin(loginRes)
vm.$HTTP({
method: 'GET',
baseURL:'https://graph.qq.com/user/get_user_info',
url: '',
data: {
openid:loginRes.authResult.openid,
access_token:loginRes.authResult.access_token,
appid:'101884160'
},
load:true
}).then((data) =>{
console.log(data)
}, (err) => {
console.log(err)
});
}
});
}else{
console.log("错误")
}
}
});
},
// 跳转注册页面
registerUrl(){
uni.navigateTo({
url: '/pageA/register/register'
});
},
// 授权登录
getApplogin(){
console.log("11")
},
// 选中某个复选框时由checkbox时触发
checkboxChange(e) {
//console.log(e);
@@ -90,66 +187,18 @@
mask_u() {
this.show = !this.show
},
// 获取验证码倒计时
getCode() {
console.log("11")
this.loading()
},
loading() {
},
codeChange(text) {
this.tips = text;
},
getCode() {
if (this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码'
})
setTimeout(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
this.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}, 2000);
} else {
this.$u.toast('倒计时结束后再发送');
}
},
end() {
this.$u.toast('倒计时结束');
},
start() {
this.$u.toast('倒计时开始');
tochange(){
}
},
components:{
identifying
}
};
</script>
<style lang="scss" scoped>
.wrap {
background: none;
width: 200rpx;
position: absolute;
right: 0;
top: 0;
bottom: 0;
margin: auto;
font-size: 30rpx;
.view_getcode{
height: 50rpx;
line-height: 50rpx;
font-size: 30rpx;
color: #FF780F!important;
}
}
.warp .view_getcode{
width: 200rpx;
color: #FF780F!important;
}
.login {
// background: url(../../static/pageA/loginbackground.png) no-repeat!important;

View File

@@ -5,15 +5,17 @@
<image class="images" src="../../static/pageA/loginbackground.png"></image>
<view class="backes"></view>
<view class="content">
<view class="title">手机登录</view>
<view class="title">手机注册</view>
<view class="labales">
<!-- <text></text> -->
<input type="tel" placeholder="手机号" />
<input type="tel" placeholder="请输入您的手机号" v-model="member_mobile" />
</view>
<view class="labales">
<!-- <text></text> -->
<input type="tel" placeholder="请输入验证码" />
<text class="identifying">获取验证码</text>
<input type="tel" placeholder="请输入验证码" v-model="sms_code" />
<!-- <text class="identifying" @click="apiwelcome()">获取验证码</text> -->
<!-- 验证码接口的引入 -->
<identifying @tochange="tochange" :smslog_type="smslog_type" :member_mobile="member_mobile" ></identifying>
</view>
<!-- 服务协议 -->
<view class="pact">
@@ -24,7 +26,7 @@
<text class="pact_text">使用协议</text>
<u-checkbox-group @change="checkboxGroupChange" size="27">
<u-checkbox @change="checkboxChange" v-model="item.checked" v-for="(item, index) in list" :key="index" :name="item.name"
shape="circle" size="14" active-color="#19BE6B"></u-checkbox>
shape="circle" size="14" active-color="#19BE6B" ></u-checkbox>
</u-checkbox-group>
</view>
</view>
@@ -34,7 +36,7 @@
<text class="other" @click="mask_u">其他方式登录</text>
</view>
<!-- denglu QQ weixin -->
<u-button>{{login}}</u-button>
<u-button @click="loginIn">{{login}}</u-button>
<u-mask :show="show" @click="show = false">
<view class="warp">
<view class="rect" @tap.stop>
@@ -43,7 +45,7 @@
<view>QQ登录</view>
</view>
<view class="rect_view">
<image src="../../static/pageA/weixin.png" class="image" ></image>
<image src="../../static/pageA/weixin.png" class="image"></image>
<view>微信登录</view>
</view>
<view class="rect_butoon" @click="show = false">取消</view>
@@ -51,22 +53,63 @@
</view>
</u-mask>
</view>
<!-- 提示框 -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import identifying from '@/components/logininput/identifying'
export default {
data() {
return {
list: [{
checked: false,
checked: true,
disabled: false
}],
value: '',
login: '登录',
show: false
login: '注册',
show: false,
member_mobile: '', //手机号
smslog_type : '1',//状态
sms_code : '', //验证码
};
},
onLoad() {
},
methods: {
// 用户注册
loginIn(){
this.$u.api.phoneRegister({
member_mobile: this.member_mobile,
sms_code: this.sms_code
}).then((res) => {
console.log(res)
// console.log(res)
if(res.errCode == 0){
// 缓存用户的信息
uni.setStorage({
key: 'user_info',
data: res.data,
success: function () {
console.log('success');
}
});
// 注册返回参数
this.$refs.uToast.show({
title: res.message,
type: 'success',
url: '/pageA/topick/topick'
})
}
if(res.errCode == 1){
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
},
// 选中某个复选框时由checkbox时触发
checkboxChange(e) {
//console.log(e);
@@ -75,9 +118,19 @@
checkboxGroupChange(e) {
// console.log(e);
},
mask_u(){
mask_u() {
this.show = !this.show
},
// 注册接口
tochange() {
// console.log("调用父组件的方法")
// console.log('2222',this._data.member_mobile)
let member_mobile = this._data.member_mobile
}
},
components: {
identifying
}
};
</script>
@@ -153,8 +206,9 @@
margin-bottom: 90rpx;
height: 70rpx;
line-height: 70rpx;
color: #fff;
}
.labales {
position: relative;
}
@@ -171,10 +225,12 @@
line-height: 20px;
}
}
.uni-input-input, .uni-input-placeholder{
color:#fff!important;
letter-spacing: 2rpx;
}
.uni-input-input,
.uni-input-placeholder {
color: #fff!important;
letter-spacing: 2rpx;
}
.pact text {
font-size: 22rpx;
@@ -194,9 +250,9 @@
.pact {
position: relative;
padding-left: 40rpx;
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
}
.u-checkbox-group {
@@ -243,26 +299,31 @@
zoom: 1;
position: relative;
display: flex;
flex-wrap:wrap;
display: -webkit-flex; /* Safari */
.rect_view{
flex-wrap: wrap;
display: -webkit-flex;
/* Safari */
.rect_view {
width: 100rpx;
height: 100rpx;
.image{
width: 45rpx;
height: 53rpx;
display: inline-block;
.image {
width: 45rpx;
height: 53rpx;
display: inline-block;
}
flex:1;
margin-top: 77rpx;
}
.rect_view:nth-child(2) image{
.rect_view:nth-child(2) image {
width: 57rpx;
height: 45rpx;
}
.rect_butoon{
.rect_butoon {
width: 100%;
position: absolute;
bottom: 0;
@@ -271,38 +332,49 @@
line-height: 85rpx;
border-top: 1px #999999 solid;
}
view{
view {
color: #666;
font-size:24rpx;
font-size: 24rpx;
margin-top: 30rpx;
}
}
.rect_view:nth-child(1) image,.rect_view:nth-child(1) view{
.rect_view:nth-child(1) image,
.rect_view:nth-child(1) view {
float: right;
}
.rect_view:nth-child(1) image{
.rect_view:nth-child(1) image {
margin-right: 20rpx;
}
.rect_view:nth-child(1){
.rect_view:nth-child(1) {
position: relative;
margin-right: 79rpx;
}
.rect_view:nth-child(1) view{
.rect_view:nth-child(1) view {
position: absolute;
bottom: 0;
right: 0;
}
.rect_view:nth-child(2) image,.rect_view:nth-child(2) view{
.rect_view:nth-child(2) image,
.rect_view:nth-child(2) view {
float: left;
}
.rect_view:nth-child(2) image{
.rect_view:nth-child(2) image {
margin-left: 20rpx;
}
.rect_view:nth-child(2){
.rect_view:nth-child(2) {
position: relative;
}
.rect_view:nth-child(2) view{
.rect_view:nth-child(2) view {
position: absolute;
bottom: 0;
left: 0;

View File

@@ -14,7 +14,6 @@
}
},
onLoad() {
},
methods: {