This commit is contained in:
zmr900709
2020-06-19 19:20:33 +08:00
parent 84d15f6b29
commit d384e6d4e7
6 changed files with 441 additions and 133 deletions

View File

@@ -14,16 +14,16 @@
<!-- <text></text> -->
<input type="tel" placeholder="请输入验证码" v-model="sms_code" />
<!-- <text class="identifying" @click="getCode">{{text}}</text> -->
<identifying @tochange="tochange" :smslog_type="smslog_type" :member_mobile="member_mobile" ></identifying>
<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>
<view>
<view></view>
<text>我已详细阅读并同意</text>
<text class="pact_text" v-for="(item,index) in pact_text" :key="index" @click="pact_click(index)"> {{item.text}} </text>
</view>
<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>
@@ -68,17 +68,30 @@
disabled: false
}],
value: '',
phones : '',
phones: '',
text: '获取验证码',
login: '登录',
register : '新用户点击注册',
register: '新用户点击注册',
show: false,
tips: '',
// refCode: null,
seconds: 60,
member_mobile: '', //手机号
smslog_type : '2',//状态
sms_code : '', //验证码
smslog_type: '2', //状态
sms_code: '', //验证码
// 协议渲染
pact_text: [{
"id": '1',
"text": "《用户协议》"
}, {
"id": '2',
"text": "《隐私协议》"
}, {
"id": '3',
"text": "《使用协议》"
},
]
};
},
onLoad() {
@@ -86,36 +99,68 @@
this.apiwelcome()
},
methods: {
apiwelcome(){
apiwelcome() {
this.$u.api.sendSmsCode({
}).then((res)=>{
}).then((res) => {
console.log(res)
})
},
// 协议跳转
pact_click(index){
console.log(index)
uni.navigateTo({
url: '/pageA/pactList/pactList?index=' + index
});
},
// 用户登录
loginOn(){
// console.log("登录")
loginOn() {
console.log("登录")
// console.log(this.member_mobile)
// console.log(this.sms_code)
// 判断手机号是否为空
// 校验手机号
let type_phone = this.$u.test.mobile( this.member_mobile)
if( this.member_mobile == ''){
this.$refs.uToast.show({
title: '手机号不能为空',
type: 'error'
})
return false;
}
if (type_phone == false) {
this.$refs.uToast.show({
title: '手机号格式不正确',
type: 'error'
});
return false;
}
if( this.sms_code == ''){
this.$refs.uToast.show({
title: '验证码不能为空',
type: 'error'
})
return false;
}
this.$u.api.phoneLogin({
member_mobile: this.member_mobile,
sms_code: this.sms_code
}).then((res) => {
console.log(res)
// console.log(res)
if(res.errCode == 0){
if (res.errCode == 0) {
// 缓存用户的信息
uni.setStorage({
key: 'user_info',
data: res.data,
success: function () {
console.log('success');
}
key: 'user_info',
data: res.data,
success: function() {
console.log('success');
}
});
// 存储接口请求所需token
uni.setStorage({
key: 'token',
data: res.data.data.token,
key: 'token',
data: res.data.data.token,
});
// 注册返回参数
this.$refs.uToast.show({
@@ -124,61 +169,61 @@
url: '/pageA/topick/topick'
})
}
if(res.errCode == 1){
if (res.errCode == 1) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
},
// qq授权登录
rect_qq(){
rect_qq() {
console.log("授权Q")
var vm = this;
uni.getProvider({
service: 'oauth',
success: function (res) {
console.log('qq',res) //weixin
success: function(res) {
console.log('qq', res) //weixin
if (~res.provider.indexOf('qq')) {
uni.login({
provider: 'qq',
success: function (loginRes) {
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)
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)
console.log(err)
});
}
});
}else{
} else {
console.log("错误")
}
}
});
},
// 跳转注册页面
registerUrl(){
registerUrl() {
uni.navigateTo({
url: '/pageA/register/register'
});
},
// 授权登录
getApplogin(){
getApplogin() {
console.log("11")
},
// 选中某个复选框时由checkbox时触发
@@ -192,18 +237,17 @@
mask_u() {
this.show = !this.show
},
tochange(){
tochange() {
}
},
components:{
components: {
identifying
}
};
</script>
<style lang="scss" scoped>
.login {
// background: url(../../static/pageA/loginbackground.png) no-repeat!important;
@@ -282,9 +326,7 @@
margin-bottom: 10px;
}
.identifying {
}
.identifying {}
}
.uni-input-input,
@@ -297,23 +339,29 @@
font-size: 22rpx;
font-weight: 400;
color: rgba(255, 255, 255, 1);
line-height: 36px;
// line-height: 36px;
}
.pact>view:first-child {
float: left;
}
.pact_text {
font-size: 22px;
font-weight: 400;
color: rgba(129, 188, 253, 1) !important;
line-height: 36px;
// line-height: 36px;
}
//单选框的样式
.pact {
position: relative;
padding-left: 40rpx;
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
overflow: hidden;
// overflow: hidden; //超出的文本隐藏
// text-overflow: ellipsis; //溢出用省略号显示
// white-space: nowrap; //溢出不换行
}
.u-checkbox-group {

View File

@@ -0,0 +1,74 @@
<template>
<view class="packlist">
<view>
<rich-text class="rict_type" :nodes="document_content"></rich-text>
</view>
</view>
</template>
<script>
var graceRichText = require("../../components/logininput/rictText.js");
export default {
data() {
return {
document_content : ''
}
},
onLoad(option) {
console.log(option)
// 协议类型调用不同的的协议
let typeIindex = option.index;
this.typeIndexRquest(typeIindex)
},
methods: {
unescapeHTML (temp){
temp = "" + temp;
return temp.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
},
typeIndexRquest(typeIindex){
// 3种协议分别是 0 1 2 【agreement用户协议open_store开店协议privacy隐私协议use使用协议】
if(typeIindex == 0){
this.$u.api.documentInfo({
document_code: 'agreement'
}).then((res)=>{
console.log(res)
let data = this.unescapeHTML(res.data.document_content);
this.document_content = data
})
}
if(typeIindex == 1){
this.$u.api.documentInfo({
document_code: 'privacy'
}).then((res)=>{
console.log(res)
let data = this.unescapeHTML(res.data.document_content);
this.document_content = data
})
}
if(typeIindex == 2){
this.$u.api.documentInfo({
document_code: 'use'
}).then((res)=>{
console.log(res)
let data = this.unescapeHTML(res.data.document_content);
this.document_content = data
})
}
}
},
mounted(){
},
components:{}
}
</script>
<style lang="scss" scoped>
.packlist{}
.packlist > view{
width:676px;
font-size:26rpx;
color: #333;
width: 90%;
margin: 0 auto;
}
</style>