d472548f by simon

默认提交

1 parent 5d388639
......@@ -106,7 +106,7 @@ button {
.comp {
bottom: auto;
// top: 56%;
bottom: 30%;
bottom: 20%;
}
}
......

2.87 KB | W: | H:

28.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
let app = getApp();
Page({
data: {
barHeight: app.globalData.barHeight,
navbarData: {
showCapsule: 0, //是否显示左上角图标 1表示显示 0表示不显示
title: '微信授权' //导航栏 中间的标题
},
loginData: null,
authorized: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
parentMemberCode: "",
},
onLoad(options) {},
onReady() {
app.store.clear("sessionId");
let _this = this;
wx.login({
success: function (res) {
_this.data.loginData = res;
}
});
},
bindGetUserInfo(e) {
wx.showLoading();
this.getUserInfo(e.detail);
},
getUserInfo(e) {
let _this = this;
app.globalData.userInfo = e.userInfo;
// console.log("loginData:",_this.data.loginData);
app.post({
url: app.api.register,
sid: false,
data: {
encryptedData: e.encryptedData,
iv: e.iv,
code: _this.data.loginData.code,
parentMemberCode: _this.data.parentMemberCode,
}
}).then((res2) => {
app.store.setItem('sessionId', res2.sessionId);
_this.setData({
authorized: true
})
_this.toIndex();
}).catch((err) => {
console.log("@authorize || err:", err);
})
},
toIndex() {
console.log("@authorize || toIndex ");
setTimeout(() => {
app.router.push({
path: "index",
query: {},
openType: "redirect"
})
wx.hideLoading();
}, 2000);
}
})
{
"usingComponents": {
"navbar": "../../component/navbar/index"
},
"navigationStyle": "custom"
}
@import '../../assets/scss/mixins';
.page {
position: relative;
overflow: hidden;
.bgc {
// background-color: transparent;
// background-color: black;
background-color: #fafafc;
}
.main {
position: relative;
.top-space {
height: 60px;
}
.login {
position: relative;
width: 650px;
margin: 0 auto;
text-align: center;
&-logo {
width: 140px;
height: 140px;
}
&-name {
margin-top: 32px;
font-size: 32px;
color: #333333;
}
&-line {
margin-top: 70px;
width: 650px;
height: 2px;
background-color: #eaeaec;
}
&-title {
margin-top: 40px;
font-size: 32px;
text-align: left;
color: #333333;
}
&-tips {
margin-top: 28px;
font-size: 26px;
text-align: left;
color: #666666;
}
&-btn {
margin-top: 102px;
width: 650px;
height: 90px;
line-height: 90px;
border-radius: 8px;
background-color: #00c200;
font-size: 32px;
color: #ffffff;
}
}
}
}
<navbar navbar-data='{{navbarData}}'></navbar>
<view style='height: {{barHeight}}px'></view>
<view class="page-authorize page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="login">
<image class="login-logo" src="../../image/logo.png" mode="aspectFit" />
<view class="login-name">美赞臣</view>
<view class="login-line"></view>
<view class="login-title">完整体验小程序功能,需要您的微信授权哦</view>
<view class="login-tips">· 获取您的公开信息(昵称、头像等)</view>
<button type="default" class="login-btn" wx:if="{{!authorized}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
确认授权
</button>
</view>
</view>
</view>
......@@ -105,20 +105,19 @@
.tit {
font-size: 40px;
height: 80px;
line-height: 80px;
min-height: 120px;
color: #ffffff;
@extend .bb;
padding: 0 24px;
position: absolute;
width: 100%;
bottom: 0;
@include ellipsis(1);
@include ellipsis(2);
}
.tit-bg {
opacity: .6;
height: 80px;
height: 120px;
color: #ffffff;
position: absolute;
width: 100%;
......@@ -129,18 +128,19 @@
.play {
@extend .fcc;
width: 132px;
height: 132px;
border-radius: 132px;
width: 120px;
height: 120px;
border-radius: 120px;
border: solid #ffffff 6px;
font-weight: normal;
position: absolute;
left: 0;
right: 0;
top: 52px;
top: 32px;
margin: 0 auto;
text-align: center;
font-weight: bold;
background-color: rgba($color: #000000, $alpha: 0.7);
background-color: rgba($color: #000000, $alpha: 0.4);
.iconfont {
font-size: 48px;
......
......@@ -83,20 +83,19 @@
.tit {
font-size: 40px;
height: 80px;
line-height: 80px;
min-height: 120px;
color: #ffffff;
@extend .bb;
padding: 0 24px;
position: absolute;
width: 100%;
bottom: 0;
@include ellipsis(1);
@include ellipsis(2);
}
.tit-bg {
opacity: .6;
height: 80px;
height: 120px;
color: #ffffff;
position: absolute;
width: 100%;
......@@ -107,18 +106,19 @@
.play {
@extend .fcc;
width: 132px;
height: 132px;
border-radius: 132px;
width: 120px;
height: 120px;
border-radius: 120px;
border: solid #ffffff 6px;
font-weight: normal;
position: absolute;
left: 0;
right: 0;
top: 72px;
top: 32px;
margin: 0 auto;
text-align: center;
font-weight: bold;
background-color: rgba($color: #000000, $alpha: 0.7);
background-color: rgba($color: #000000, $alpha: 0.4);
.iconfont {
font-size: 48px;
......
......@@ -58,6 +58,9 @@ Page({
primaryCode: "",
});
},
onShow() {
this.checkAuth();
},
/**
* 基础方法
......@@ -170,6 +173,29 @@ Page({
},
/**
* 检查是否授权
*/
checkAuth() {
let _this = this;
wx.getSetting({
success(res) {
console.log("scope:", res);
if (res.authSetting['scope.userInfo']) {
// 已经授权
} else {
//用户没有授权
wx.login({
success(res) {
app.store.setItem('wxcode', res.code);
_this.showAuth();
}
});
}
}
});
},
/**
* 隐藏蒙层
*/
hideMask() {
......
......@@ -8,7 +8,10 @@
background-color: #af3541;
}
.bg {}
.bg {
width: 100%;
height: auto;
}
.main {
.top-space {
......@@ -51,7 +54,7 @@
.reward {
width: $contentWidth;
margin: 124px auto 0;
margin: 24px auto 0;
&-wrap {
......@@ -65,7 +68,23 @@
}
}
}
}
}
.tips{
font-size: 28px;
color: #ffe6a3;
text-align: center;
width: 100%;
}
.tips1{
margin-top: 36px;
}
.tips2 {
position: fixed;
bottom: 48px;
}
}
......
......@@ -9,6 +9,7 @@
<image class="portrait-bg" mode="widthFix" src="../../image/logo.jpeg" />
<!-- <open-data class="avatar" type="userAvatarUrl"></open-data> -->
</view>
<view class="tips tips1">赞赏家有儿孙</view>
<view class="reward">
<view class="reward-wrap">
<image bindtap="onRewardHandler" data-data="{{item}}" class="reward-wrap-item" wx:for="{{rewardList}}" wx:key="{{index}}" mode="widthFix" src="{{'../../image/reward/m-'+item.price+'.png'}}" />
......@@ -16,4 +17,8 @@
</view>
</view>
</view>
<view class="tips tips2">感谢红包鼓励,我们继续生产好内容!</view>
</view>
<van-popup show="{{ authorizeVisible }}">
<authorize-comp bind:evtcomp="evtcomp"></authorize-comp>
</van-popup>
......