提交 e2516771 authored 作者: GOD_ZYX's avatar GOD_ZYX

增加 游客登录,直接写死一个 sessionKey

上级 79af5fa6
......@@ -2,6 +2,6 @@
App({
onLaunch: function () {
wx.showLoading({ title: '页面启动中...', mask: true });
wx.redirectTo({ url: '/pages/index/index' });
// wx.redirectTo({ url: '/pages/index/index' });
}
})
\ No newline at end of file
......@@ -58,6 +58,18 @@ Page({
}
})
},
guestLogin: function () {
wx.showModal({
title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮',
success: (res) => {
if (res.confirm) {
wx.setStorageSync('userInfo', { "avatarUrl": "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJv5HunMDDhpdaTz7aVXniaeOUxyQxwa9clFnJCm7Y8eP8gbUkF7I9NHSXSDJ1KssdYw9vAKb0v8fQ/132", "nickName": "游客账号" });
wx.setStorageSync('userSession', { "sessionKey": "EOlbKKzWol0meLnDQOZb8g==" });
this.goOutSite();
}
}
});
},
/* 手机号绑定 方法 */
timer: BindPhone.BindPhone.timer,
popupShow: BindPhone.BindPhone.popupShow,
......
......@@ -6,6 +6,7 @@
<image class='logo' src='./icons/hd-logo.png' mode='aspectFit'></image>
<view class='text'>清控紫荆课堂</view>
<button class='btn' open-type='getUserInfo' bindgetuserinfo='getUserInfo'>登录</button>
<view class='test-id' bindtap='guestLogin'>游客登录</view>
<view class='userinfo'>
<!-- wx:if='{{!hasUserInfo && canIUse}}' -->
<!-- <block wx:else>
......
......@@ -6,3 +6,4 @@
.container .logo { position: absolute; z-index: 1; top: 233rpx; left: 50%; width: 344rpx; height: 47rpx; -webkit-transform: translateX(-50%); transform: translateX(-50%); }
.container .text { position: absolute; z-index: 1; top: 303rpx; left: 0; width: 100%; color: #fff; font-size: 54rpx; letter-spacing: 14rpx; line-height: 54rpx; text-align: center; font-weight: 300; }
.container .btn { position: absolute; left: 50%; bottom: 253rpx; width: 500rpx; height: 80rpx; line-height: 80rpx; font-size: 30rpx; font-weight: 300; color: #fff; background: #b49441; -webkit-transform: translateX(-50%); transform: translateX(-50%); }
.test-id { position: absolute; left: 0; bottom: 200rpx; width: 100%; font-size: 28rpx; color: #fff; text-align: center; }
\ No newline at end of file
......@@ -11,7 +11,7 @@ Page({
/* 我的学分 */
goMyScore: function () { wx.navigateTo({ url: '/pages/learnSystem/myScore/myScore' }) },
/* 退出系统 */
outSystem: function () { wx.reLaunch({ url: '/pages/index/index' }) },
outSystem: function () { wx.setStorageSync('userInfo', {}); wx.setStorageSync('userSession', {}); wx.reLaunch({ url: '/pages/index/index' }) },
/* 输出信息 */
printMsg: function (detail) { console.log(detail.status) }
})
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论