This commit is contained in:
Gdpao 2020-08-15 19:14:12 +08:00
parent 55742478b2
commit c2346375c8
8 changed files with 285 additions and 277 deletions

View File

@ -47,6 +47,10 @@ const install = (Vue, vm) => {
// 假设201为token失效这里跳转登录 // 假设201为token失效这里跳转登录
// vm.$u.toast('您还没有登录哦,请先去登录!'); // vm.$u.toast('您还没有登录哦,请先去登录!');
if (res.data.data.action != "memberinfo") { if (res.data.data.action != "memberinfo") {
uni.showToast({
title: "您还没有登录,请先去登录哦!",
icon: "none"
})
setTimeout(() => { setTimeout(() => {
// 此为uView的方法详见路由相关文档 // 此为uView的方法详见路由相关文档
uni.navigateTo({ uni.navigateTo({

View File

@ -3,32 +3,28 @@
<view> <view>
<view class="login"> <view class="login">
<view class="content"> <view class="content">
<view class="title">手机登录</view> <view class="title">请绑定手机号</view>
<view class="labales"> <view class="labales">
<text>手机号</text> <input type="number" maxlength="11" v-model="phone" placeholder="手机号" />
<input type="tel" placeholder="" />
</view> </view>
<view class="labales"> <view class="labales flex-inp">
<text>请输入验证码</text> <input type="number" maxlength="6" placeholder="请输入验证码" v-model="sms_code" />
<input type="tel" placeholder="" /> <button class="identifying" :class="is_sendcode ? 'sended' : ''" @click="getCode" :disabled="is_sendcode">{{ is_sendcode ? time_count + "后可以重新发送" : "发送验证码" }}</button>
<text class="identifying">获取验证码</text>
</view> </view>
<!-- 服务协议 --> <!-- 服务协议 -->
<view class="pact"> <view class="pact">
<view></view> <checkbox-group @change="change">
<checkbox class="check-tit" color="#1ADE00" :checked="checked" />
</checkbox-group>
<text>我已详细阅读并同意</text> <text>我已详细阅读并同意</text>
<text class="pact_text">用户协议</text> <text class="pact_text" v-for="(item,index) in pactList" :key="index" @click="infoPact(index)">
<text class="pact_text">隐私协议</text> {{ item }}
<text class="pact_text">使用协议</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>
</u-checkbox-group>
</view> </view>
</view> </view>
<!-- denglu QQ weixin --> <!-- denglu QQ weixin -->
<u-button>{{login}}</u-button> <view class="btn-login" @click="bindPhone">{{login}}</view>
<u-toast ref="uToast" />
</view> </view>
</view> </view>
</template> </template>
@ -36,80 +32,150 @@
export default { export default {
data() { data() {
return { return {
list: [{ phone: "",
sms_code: "",
login: '绑定',
show: true,
checked: false, checked: false,
disabled: false //
}], timer: null,
value: '', is_sendcode: false, // 60s
login: '注册', time_count: 60,
show: true pactList: [ "《用户协议》", "《隐私协议》", "《使用协议》" ],
}; };
}, },
methods: { methods: {
// checkbox //
checkboxChange(e) { change(e) {
//console.log(e); this.checked = !this.checked;
console.log(this.checked);
}, },
// checkboxcheckbox-group //
checkboxGroupChange(e) { getCode() {
// console.log(e); if (this.$u.test.isEmpty(this.phone)) {
this.$refs.uToast.show({
title: '手机号格式不能为空!',
type: 'error',
})
return;
}
if(!(/^1[3456789]\d{9}$/.test(this.phone))){
this.$refs.uToast.show({
title: '手机号格式不正确!',
type: 'warning',
})
return;
}
this.$u.api.sendSmsCode({
member_mobile: this.phone,
smslog_type: 4,
}).then(res => {
if (res.errCode == 0) {
console.log(res);
this.$refs.uToast.show({
title: res.message,
type: 'success',
})
//
this.getSendCode();
} else {
this.$refs.uToast.show({
title: res.message,
type: 'warning',
})
}
})
}, },
mask_u(){ //
this.show = !this.show bindPhone() {
if (this.$u.test.isEmpty(this.phone)) {
this.$refs.uToast.show({
title: '手机号不能为空!',
type: 'error',
})
return;
}
if(!(/^1[3456789]\d{9}$/.test(this.phone))){
this.$refs.uToast.show({
title: '手机号格式不正确!',
type: 'warning',
})
return;
}
if(this.$u.test.isEmpty(this.sms_code)){
this.$refs.uToast.show({
title: '验证码不能为空!',
type: 'warning',
})
return;
}
if(this.sms_code.length == 0){
this.$refs.uToast.show({
title: '验证码有误!',
type: 'warning',
})
return;
}
if(!this.checked){
this.$refs.uToast.show({
title: '请同意协议!',
type: 'warning',
})
return;
}
this.$u.api.mobileBind({
member_mobile: this.phone,
sms_code: this.sms_code,
}).then(res => {
console.log(res);
if (res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
type: 'success',
})
uni.switchTab({
url: '/pages/index/index'
});
} else {
this.$refs.uToast.show({
title: res.message,
type: 'warning',
})
}
})
},
//
infoPact(index) {
// console.log(index);
uni.navigateTo({
url: '/pageA/pactList/pactList?index=' + index
});
},
// 60s
getSendCode() {
const TIME_COUNT = 60;
if (!this.timer) {
this.time_count = TIME_COUNT;
this.is_sendcode = true;
this.timer = setInterval(() => {
if (this.time_count > 0 && this.time_count <= TIME_COUNT) {
this.time_count--;
} else {
this.is_sendcode = false;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
}, },
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uni-page-wrapper{
background: #fff;
}
.login {
// background: url(../../static/pageA/loginbackground.png) no-repeat!important;
.images {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
}
.backes { page {
background: rgba(0, 0, 0, 0.4); background-color: #fff;
position: fixed;
width: 100%;
height: 100%;
z-index: -1;
}
text {
z-index: 9;
color: #fff;
}
.more_Login {
overflow: hidden;
zoom: 1;
width: 630rpx;
margin: 0 auto;
}
.more_Login text {
display: inline-block;
width: 50%;
float: left;
font-size: 30rpx;
color: rgba(255, 255, 255, 1);
line-height: 36px;
margin: 97rpx 0;
}
.more_Login .other {
text-align: right;
}
} }
.title { .title {
@ -125,162 +191,86 @@
margin: 0 auto; margin: 0 auto;
padding-top: 130rpx; padding-top: 130rpx;
.labales {
position: relative;
display: flex;
align-items: center;
padding: 20rpx;
border-bottom: 1px #BFBFBF solid;
input {
width: 100%;
}
}
.flex-inp {
justify-content: space-between;
margin-top: 70rpx;
}
.labales text { .labales text {
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
} }
.labales {
border-bottom: 1px #BFBFBF solid;
margin-bottom: 90rpx;
}
.labales {
position: relative;
}
.identifying { .identifying {
position: absolute; flex-shrink: 0;
right: 0; font-size: 26rpx;
top: 0;
bottom: 0;
margin: auto;
font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #FF780F !important; color: #FF780F !important;
} border: none;
background-color: #fff;
} }
.pact text { .sended {
color: #666 !important;
}
}
.pact {
display: flex;
align-items: center;
flex-wrap: wrap;
margin: 20rpx 0;
&>text {
font-size: 22rpx; font-size: 22rpx;
font-weight: 400; font-weight: 400;
color: #333; color: #333;
line-height: 36px; }
}
.check-tit {
font-size: 20rpx;
}
::v-deep uni-checkbox .uni-checkbox-input {
width: 24rpx;
height: 24rpx;
border-color: #d1d1d1 !important;
border-radius: 50% !important;
}
::v-deep uni-checkbox .uni-checkbox-input-checked:before {
font-size: 28rpx;
} }
.pact_text { .pact_text {
font-size: 22px; font-size: 22px;
font-weight: 400; font-weight: 400;
color: rgba(129, 188, 253, 1) !important; color: rgba(129, 188, 253, 1) !important;
line-height: 36px;
} }
// .btn-login {
.pact { width: 650rpx;
position: relative; height: 90rpx;
padding-left: 38rpx; margin: 300rpx auto 0;
}
.u-checkbox-group {
position: absolute;
left: 0;
top: 0;
bottom: 0;
margin: auto;
}
.u-checkbox__icon--square {
border-radius: 50rpx !important;
width: 22rpx;
height: 22rpx;
}
.u-btn {
width: 628rpx;
height: 98rpx;
background: rgba(255, 120, 15, 1) !important;
border-radius: 49rpx;
margin: 0 auto;
font-size: 36rpx;
color: rgba(255, 255, 255, 1) !important;
line-height: 36px;
border: 1px #ff780f solid;
outline: none;
border-color: rgba(255, 120, 15, 1) !important;
margin-top: 225rpx;
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.rect {
width: 558rpx;
height: 300rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
zoom: 1;
position: relative;
display: flex;
flex-wrap:wrap;
display: -webkit-flex; /* Safari */
.rect_view{
width: 100rpx;
height: 100rpx;
.image{
width: 45rpx;
height: 53rpx;
display: inline-block;
}
flex:1;
margin-top: 77rpx;
}
.rect_view:nth-child(2) image{
width: 57rpx;
height: 45rpx;
}
.rect_butoon{
width: 100%;
position: absolute;
bottom: 0;
height: 85rpx;
text-align: center; text-align: center;
line-height: 85rpx; line-height: 90rpx;
border-top: 1px #999999 solid; color: #fff;
font-size: 34rpx;
border-radius: 50rpx !important;
background-color: #FF780F;
} }
view{
color: #666;
font-size:24rpx;
margin-top: 30rpx;
} button::after{ border: none; }
}
.rect_view:nth-child(1) image,.rect_view:nth-child(1) view{
float: right;
}
.rect_view:nth-child(1) image{
margin-right: 20rpx;
}
.rect_view:nth-child(1){
position: relative;
margin-right: 79rpx;
}
.rect_view:nth-child(1) view{
position: absolute;
bottom: 0;
right: 0;
}
.rect_view:nth-child(2) image,.rect_view:nth-child(2) view{
float: left;
}
.rect_view:nth-child(2) image{
margin-left: 20rpx;
}
.rect_view:nth-child(2){
position: relative;
}
.rect_view:nth-child(2) view{
position: absolute;
bottom: 0;
left: 0;
}
u-button{
margin-top: 225rpx;
}
</style> </style>

View File

@ -226,14 +226,20 @@
member_nickname: data.userInfo.nickName, member_nickname: data.userInfo.nickName,
member_avatar: data.userInfo.avatarUrl, member_avatar: data.userInfo.avatarUrl,
}).then(res => { }).then(res => {
console.log(res.errCode);
if (res.errCode == 0) { if (res.errCode == 0) {
this.loginIn(res.data.token); this.loginIn(res.data.token);
uni.setStorageSync('user_info',res.data); uni.setStorageSync('user_info',res.data);
this.show = false; this.show = false;
console.log(res.data.member.member_mobilebind);
if(res.data.member.member_mobilebind) {
uni.switchTab({ uni.switchTab({
url: "../../pages/index/index" url: "/pages/index/index"
}) });
} else {
uni.navigateTo({
url: '/pageA/bindinges/bindinges'
});
}
} }
}) })
} }
@ -247,11 +253,11 @@
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: (wxres) => { success: (wxres) => {
console.log(wxres); // console.log(wxres);
uni.getUserInfo({ uni.getUserInfo({
provider: 'weixin', provider: 'weixin',
success: (data) => { success: (data) => {
console.log(data); // console.log(data);
this.$u.api.wechatLogin({ this.$u.api.wechatLogin({
member_wxopenid: data.userInfo.openId, member_wxopenid: data.userInfo.openId,
member_nickname: data.userInfo.nickName, member_nickname: data.userInfo.nickName,
@ -262,9 +268,16 @@
this.loginIn(res.data.token); this.loginIn(res.data.token);
uni.setStorageSync('user_info',res.data); uni.setStorageSync('user_info',res.data);
this.show = false; this.show = false;
console.log(res.data.member.member_mobilebind);
if(res.data.member.member_mobilebind) {
uni.switchTab({ uni.switchTab({
url: "../../pages/index/index" url: "/pages/index/index"
}) });
} else {
uni.navigateTo({
url: '/pageA/bindinges/bindinges'
});
}
} }
}) })
} }

View File

@ -69,7 +69,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.packlist{}
.packlist > view{ .packlist > view{
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;

View File

@ -543,8 +543,8 @@ export default {
reply_id: this.reply_id, reply_id: this.reply_id,
}).then(res => { }).then(res => {
// console.log(res.data); // console.log(res.data);
if (res.errCode == 0) {
this.send_value = ""; this.send_value = "";
if (res.errCode == 0) {
this.comment_num = res.data.num; this.comment_num = res.data.num;
// console.log(this.comment_num); // console.log(this.comment_num);
this.is_edit = false; this.is_edit = false;

View File

@ -266,8 +266,8 @@
success: (res) => { success: (res) => {
console.log(res); console.log(res);
this.is_edit = false; this.is_edit = false;
if (res.data.errCode == 0) {
this.send_value = ""; this.send_value = "";
if (res.data.errCode == 0) {
this.comment_num = res.data.num; this.comment_num = res.data.num;
let p_id = res.data.data.data.pid; let p_id = res.data.data.data.pid;
console.log(this.pid, this.reply_id, this.comment_id); console.log(this.pid, this.reply_id, this.comment_id);

View File

@ -265,14 +265,14 @@
onShow() { onShow() {
this.page = 1; this.page = 1;
if (this.page != 1) { if (this.page != 1) {
this.articleList = [];
} }
this.getArticlelist();
// if (this.hasLogin) { // if (this.hasLogin) {
// this.isNewmembervoucher(); // this.isNewmembervoucher();
// } // }
}, },
onLoad(){ onLoad(){
this.articleList = [];
this.getArticlelist();
this.getSwiper(); this.getSwiper();
// //
if(this.$store.state.hasLogin){ if(this.$store.state.hasLogin){
@ -389,16 +389,18 @@
} }
} }
}, },
// //
getArticlelist() { getArticlelist() {
if (this.page > 1) {
uni.showLoading({ uni.showLoading({
title: "loading..." title: "loading..."
}) })
}
this.$u.api.getArticlelist({ this.$u.api.getArticlelist({
page: this.page, page: this.page,
is_video_img: 0, // 1 2 0 is_video_img: 0, // 1 2 0
}).then(res => { }).then(res => {
// uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
this.status = "loading"; this.status = "loading";
if (res.errCode == 0) { if (res.errCode == 0) {
uni.hideLoading(); uni.hideLoading();