gyh change

This commit is contained in:
Gdpao
2020-07-31 08:45:30 +08:00
parent 8bb1cdfd39
commit d817d0c28b
15 changed files with 708 additions and 460 deletions

View File

@@ -43,11 +43,11 @@
<u-mask :show="show" @click="show = false">
<view class="warp">
<view class="rect" @tap.stop>
<view class="rect_view" @click="rect_qq()">
<view class="rect_view" @click="loginOther(1)">
<image src="../../static/pageA/qq.png" class="image"></image>
<view>QQ登录</view>
</view>
<view class="rect_view">
<view class="rect_view" @click="loginOther(2)">
<image src="../../static/pageA/weixin.png" class="image"></image>
<view>微信登录</view>
</view>
@@ -61,7 +61,9 @@
</template>
<script>
import identifying from '@/components/logininput/identifying'
import { mapMutations } from 'vuex';
import {
mapMutations
} from 'vuex';
export default {
data() {
return {
@@ -83,29 +85,43 @@
sms_code: '', //验证码
// 协议渲染
pact_text: [{
"id": '1',
"text": "《用户协议》"
}, {
"id": '2',
"text": "《隐私协议》"
}, {
"id": '3',
"text": "《使用协议》"
},
]
"id": '1',
"text": "《用户协议》"
}, {
"id": '2',
"text": "《隐私协议》"
}, {
"id": '3',
"text": "《使用协议》"
}, ],
temp_url: "", // 上个页面路径
pagesArr: ["pages/mine/index"], // 特殊路径
};
},
onLoad() {
// 数据的请求
this.apiwelcome();
},
onShow() {
let pages = getCurrentPages();
let prePage = pages[pages.length - 2];
this.temp_url = prePage.route;
// console.log(this.temp_url);
},
// 切断正常返回
onBackPress(e) {
console.log(1, e);
if (this.pagesArr.includes(this.temp_url) && !this.hasLogin) {
uni.switchTab({
url: '../../pages/index/index'
})
return true;
}
},
methods: {
...mapMutations(['loginIn']),
apiwelcome() {
this.$u.api.sendSmsCode({
}).then((res) => {
this.$u.api.sendSmsCode({}).then((res) => {
console.log(res)
})
},
@@ -189,8 +205,7 @@
// type: 'success',
// url: '/pageA/topick/topick'
// })
}
if (res.errCode == 1) {
} else {
this.$refs.uToast.show({
title: res.message,
type: 'error'
@@ -199,40 +214,75 @@
})
},
// qq授权登录
rect_qq() {
console.log("授权QQ")
var vm = this;
loginOther(type) {
var me = this;
uni.getProvider({
service: 'oauth',
success: function(res) {
console.log('qq', res) //weixin
if (~res.provider.indexOf('qq')) {
success: (res) => {
if (type == 1) {
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)
});
success: (qqres) => {
console.log(qqres);
uni.getUserInfo({
provider: 'qq',
success: (data) => {
console.log(data);
this.$u.api.qqLogin({
member_qqopenid: data.userInfo.openId,
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);
this.show = false;
uni.switchTab({
url: "../../pages/index/index"
})
}
})
}
})
},
fail: (e) => {
console.log(e);
}
});
} else {
console.log("错误")
uni.login({
provider: 'weixin',
success: (wxres) => {
console.log(wxres);
uni.getUserInfo({
provider: 'weixin',
success: (data) => {
console.log(data);
this.$u.api.wechatLogin({
member_wxopenid: data.userInfo.openId,
member_nickname: data.userInfo.nickName,
member_avatar: data.userInfo.avatarUrl,
}).then(res => {
console.log(res);
if (res.errCode == 0) {
this.loginIn(res.data.token);
this.show = false;
uni.switchTab({
url: "../../pages/index/index"
})
}
})
}
})
},
fail: (e) => {
console.log(e);
}
});
}
},
fail: (e) => {
console.log(e);
}
});
},
@@ -242,10 +292,6 @@
url: '/pageA/register/register'
});
},
// 授权登录
getApplogin() {
console.log("11")
},
// 选中某个复选框时由checkbox时触发
checkboxChange(e) {
//console.log(e);

View File

@@ -62,10 +62,14 @@ export default {
<style lang="scss" scoped>
.packlist{}
.packlist > view{
width:676px;
font-size:26rpx;
color: #333;
width: 90%;
margin: 0 auto;
padding: 16upx 0;
font-size: 26upx;
color: #333;
}
.rict_type {
text-indent: 1rem;
line-height: 1.2;
}
</style>

View File

@@ -10,7 +10,7 @@
</view>
<!-- 标签 -->
<view class="tab_lable">
<view :class="{'cur': rSelect.indexOf(index)!=-1}" v-for="(item,index) in tab_lables" :key="index" @click="tapClick(index)">{{item.name}}</view>
<view :class="{'cur': rSelect.indexOf(index)!=-1}" v-for="(item,index) in tab_lables" :key="index" @click="tapClick(index,item.id)">{{item.name}}</view>
</view>
<!-- 提交按钮 -->
<view class="submites" @click="toHomePage">{{submites}}</view>
@@ -30,12 +30,12 @@
show: false,
tab_lables: [],
submites: '选好了进入首页',
rSelect:[]
rSelect:[],
list: [],
};
},
onLoad(){
// 标签的列表展示
console.log("11111222")
this.$u.api.labelList({
}).then((res) => {
@@ -59,14 +59,17 @@
this.show = !this.show
},
// 点击切换颜色
tapClick(index) {
console.log(index)
tapClick(index,id) {
// console.log(id);
if (this.rSelect.indexOf(index) == -1) {
console.log(index) //打印下标
this.rSelect.push(index); //选中添加到数组里
this.rSelect.push(index);
this.list.push(id); //选中添加到数组里
} else {
this.rSelect.splice(this.rSelect.indexOf(index), 1); //取消
this.list.splice(this.rSelect.indexOf(id), 1); //取消
}
// console.log(this.rSelect);
// console.log(this.list);
},
toHomePage() {
uni.switchTab({

View File

@@ -1,45 +1,76 @@
<template>
<view class="welcome">
<!-- 倒计时跳过 -->
<remaining></remaining>
<remaining v-if="guidePages"></remaining>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
import remaining from '@/components/remaining/remaining';
export default {
computed: {
...mapState(['hasLogin', 'token'])
},
data() {
return {
guidePages: true
}
},
onLoad() {
onLoad() {
this.loadExecution();
},
methods: {
},
mounted(){
},
components:{}
loadExecution() {
/**
* 获取本地存储中launchFlag的值
* 若存在,说明不是首次启动,直接进入首页;
* 若不存在,说明是首次启动,进入引导页;
*/
// 获取本地存储中launchFlag标识
const value = uni.getStorageSync('launchFlag') || "";
// console.log(value, this.hasLogin);
if (value) {
this.guidePages = false;
if (this.hasLogin) {
uni.switchTab({
url: '../../pages/index/index'
});
} else {
// launchFlag=true直接跳转到首页
uni.navigateTo({
url: '../../pageA/login/login'
});
}
} else {
// launchFlag!=true显示引导页
this.guidePages = true;
}
}
}
}
</script>
<style>
.welcome {}
.welcome_jumpes{
.welcome_jumpes {
width: 90rpx;
height: 35rpx;
opacity:0.5;
border-radius:18rpx;
opacity: 0.5;
border-radius: 18rpx;
position: absolute;
right: 37rpx;
top: 34rpx;
font-size:20rpx;
font-size: 20rpx;
text-align: center;
line-height: 35rpx;
color: #fff;
background: #C4CAC6;
}
.welcome_images {
width: 100%;
position: fixed;