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

34
App.vue
View File

@ -4,9 +4,9 @@
globalData: {
im: {}
},
computed: {
...mapState(["hasLogin"])
},
computed: {
...mapState(["hasLogin"])
},
onLaunch() {
getApp().globalData.im = this.imService
// token
@ -16,23 +16,23 @@
this.loginIn(res.data);
}
})
// token
if (this.hasLogin) {
this.refreshToken_function();
}
// token
if (this.hasLogin) {
this.refreshToken_function();
}
},
methods: {
...mapMutations(['loginIn']),
// token
refreshToken_function(){
this.$u.api.refreshToken({}).then((res) => {
// console.log(res);
if (res.errCode == 0) {
let token = res.data.token;
uni.setStorageSync('token', token);//toke
}
})
},
// token
refreshToken_function(){
this.$u.api.refreshToken({}).then((res) => {
// console.log(res);
if (res.errCode == 0) {
let token = res.data.token;
uni.setStorageSync('token', token);//toke
}
})
},
}
}
</script>

View File

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

View File

@ -3,32 +3,28 @@
<view>
<view class="login">
<view class="content">
<view class="title">手机登录</view>
<view class="title">请绑定手机号</view>
<view class="labales">
<text>手机号</text>
<input type="tel" placeholder="" />
<input type="number" maxlength="11" v-model="phone" placeholder="手机号" />
</view>
<view class="labales">
<text>请输入验证码</text>
<input type="tel" placeholder="" />
<text class="identifying">获取验证码</text>
<view class="labales flex-inp">
<input type="number" maxlength="6" placeholder="请输入验证码" v-model="sms_code" />
<button class="identifying" :class="is_sendcode ? 'sended' : ''" @click="getCode" :disabled="is_sendcode">{{ is_sendcode ? time_count + "后可以重新发送" : "发送验证码" }}</button>
</view>
<!-- 服务协议 -->
<view class="pact">
<view></view>
<checkbox-group @change="change">
<checkbox class="check-tit" color="#1ADE00" :checked="checked" />
</checkbox-group>
<text>我已详细阅读并同意</text>
<text class="pact_text">用户协议</text>
<text class="pact_text">隐私协议</text>
<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>
</u-checkbox-group>
<text class="pact_text" v-for="(item,index) in pactList" :key="index" @click="infoPact(index)">
{{ item }}
</text>
</view>
</view>
<!-- denglu QQ weixin -->
<u-button>{{login}}</u-button>
<view class="btn-login" @click="bindPhone">{{login}}</view>
<u-toast ref="uToast" />
</view>
</view>
</template>
@ -36,81 +32,151 @@
export default {
data() {
return {
list: [{
checked: false,
disabled: false
}],
value: '',
login: '注册',
show: true
phone: "",
sms_code: "",
login: '绑定',
show: true,
checked: false,
//
timer: null,
is_sendcode: false, // 60s
time_count: 60,
pactList: [ "《用户协议》", "《隐私协议》", "《使用协议》" ],
};
},
methods: {
// checkbox
checkboxChange(e) {
//console.log(e);
},
// checkboxcheckbox-group
checkboxGroupChange(e) {
// console.log(e);
},
mask_u(){
this.show = !this.show
},
//
change(e) {
this.checked = !this.checked;
console.log(this.checked);
},
//
getCode() {
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',
})
}
})
},
//
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>
<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 {
background: rgba(0, 0, 0, 0.4);
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;
}
}
page {
background-color: #fff;
}
.title {
font-size: 36rpx;
@ -124,163 +190,87 @@
z-index: 99999;
margin: 0 auto;
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 {
font-size: 30rpx;
color: #999;
}
.labales {
border-bottom: 1px #BFBFBF solid;
margin-bottom: 90rpx;
}
.labales {
position: relative;
}
.identifying {
position: absolute;
right: 0;
top: 0;
bottom: 0;
margin: auto;
font-size: 30rpx;
flex-shrink: 0;
font-size: 26rpx;
font-weight: 500;
color: #FF780F!important;
color: #FF780F !important;
border: none;
background-color: #fff;
}
}
.pact text {
font-size: 22rpx;
font-weight: 400;
color: #333;
line-height: 36px;
.sended {
color: #666 !important;
}
}
.pact {
display: flex;
align-items: center;
flex-wrap: wrap;
margin: 20rpx 0;
&>text {
font-size: 22rpx;
font-weight: 400;
color: #333;
}
}
.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 {
font-size: 22px;
font-weight: 400;
color: rgba(129, 188, 253, 1) !important;
line-height: 36px;
}
//
.pact {
position: relative;
padding-left: 38rpx;
}
.btn-login {
width: 650rpx;
height: 90rpx;
margin: 300rpx auto 0;
text-align: center;
line-height: 90rpx;
color: #fff;
font-size: 34rpx;
border-radius: 50rpx !important;
background-color: #FF780F;
}
.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;
line-height: 85rpx;
border-top: 1px #999999 solid;
}
view{
color: #666;
font-size:24rpx;
margin-top: 30rpx;
}
}
.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;
}
button::after{ border: none; }
</style>

View File

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

View File

@ -29,9 +29,9 @@ export default {
document_code: 'agreement'
}).then((res)=>{
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data;
})
@ -41,9 +41,9 @@ export default {
document_code: 'privacy'
}).then((res)=>{
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data
})
@ -53,9 +53,9 @@ export default {
document_code: 'use'
}).then((res)=>{
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data
})
@ -69,7 +69,6 @@ export default {
</script>
<style lang="scss" scoped>
.packlist{}
.packlist > view{
width: 90%;
margin: 0 auto;

View File

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

View File

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

View File

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