Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online
Commits
6a6ec464
提交
6a6ec464
authored
3月 24, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into enterprise
上级
d569bee3
82336613
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
65 行增加
和
10 行删除
+65
-10
index.js
learnOnline/pages/index/index.js
+64
-9
index.wxml
learnOnline/pages/index/index.wxml
+1
-1
没有找到文件。
learnOnline/pages/index/index.js
浏览文件 @
6a6ec464
...
@@ -4,6 +4,7 @@ const app = getApp()
...
@@ -4,6 +4,7 @@ const app = getApp()
const
util
=
require
(
'../../utils/util.js'
)
const
util
=
require
(
'../../utils/util.js'
)
const
BindPhone
=
require
(
'./bindPhone/bindPhone.js'
)
const
BindPhone
=
require
(
'./bindPhone/bindPhone.js'
)
const
BindAccount
=
require
(
'./bindAccount/bindAccount.js'
)
const
BindAccount
=
require
(
'./bindAccount/bindAccount.js'
)
const
md5
=
require
(
'../../utils/md5.js'
)
Page
({
Page
({
data
:
{
data
:
{
...
@@ -74,16 +75,70 @@ Page({
...
@@ -74,16 +75,70 @@ Page({
})
})
},
},
guestLogin
:
function
()
{
guestLogin
:
function
()
{
wx
.
showModal
({
this
.
accountConfirms
();
title
:
'提示'
,
content
:
'本账户只适用于“体验学习”,正式学习请点击“登录”按钮'
,
// return;
success
:
(
res
)
=>
{
// wx.showModal({
if
(
res
.
confirm
)
{
// title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮',
wx
.
setStorageSync
(
'userInfo'
,
{
"avatarUrl"
:
"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJv5HunMDDhpdaTz7aVXniaeOUxyQxwa9clFnJCm7Y8eP8gbUkF7I9NHSXSDJ1KssdYw9vAKb0v8fQ/132"
,
"nickName"
:
"游客账号"
});
// success: (res) => {
wx
.
setStorageSync
(
'userSession'
,
{
"sessionKey"
:
""
});
// if (res.confirm) {
this
.
goOutSite
();
// wx.setStorageSync('userInfo', { "avatarUrl": "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJv5HunMDDhpdaTz7aVXniaeOUxyQxwa9clFnJCm7Y8eP8gbUkF7I9NHSXSDJ1KssdYw9vAKb0v8fQ/132", "nickName": "游客账号" });
// wx.setStorageSync('userSession', { "sessionKey": "" });
// this.goOutSite();
// }
// }
// });
},
//游客登录
accountConfirms
:
function
(
e
)
{
const
_that
=
this
;
/* 调用接口 - 使用账号登录 */
wx
.
request
({
url
:
util
.
config
.
URL_PATH2
+
'/user_center/login'
,
data
:
{
login_name
:
'18519690645@163.com'
,
password
:
md5
(
'uokoaduw'
+
'123456'
.
split
(
''
).
reverse
().
join
(
''
)
+
'auhgniq'
),
service
:
'applet.ezijing.com'
},
method
:
'POST'
,
header
:
{
'tenant'
:
util
.
config
.
tenant
,
'content-type'
:
'application/x-www-form-urlencoded'
,
'version'
:
util
.
config
.
version
,
'apikey'
:
'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success
:
function
(
res
)
{
if
(
res
.
statusCode
&&
res
.
statusCode
!=
200
)
{
wx
.
showToast
({
title
:
res
.
data
.
message
,
icon
:
'none'
});
return
;
}
wx
.
hideToast
();
wx
.
setStorageSync
(
'userSession'
,
{
sessionKey
:
res
.
data
.
ticket
});
let
_token
=
wx
.
getStorageSync
(
'userSession'
).
sessionKey
if
(
!
_token
)
{
wx
.
reLaunch
({
url
:
'/pages/index/index'
})
return
;
}
}
}
/* 获取用户信息 */
});
wx
.
request
({
url
:
util
.
config
.
URL_PATH1
+
'/user/check-access'
,
data
:
{},
method
:
'GET'
,
header
:
{
token
:
_token
,
tenant
:
util
.
config
.
tenant
,
'apikey'
:
'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
,
'version'
:
util
.
config
.
version
,
unionid
:
wx
.
getStorageSync
(
'union_id'
)
},
success
:
res
=>
{
if
(
res
.
statusCode
!=
200
&&
res
.
statusCode
!=
401
)
{
wx
.
showToast
({
title
:
res
.
data
.
message
,
icon
:
'none'
});
return
;
}
let
_userInfo
=
{
avatarUrl
:
res
.
data
.
avatar
||
'无'
,
nickName
:
res
.
data
.
nickname
||
'游客登录'
}
wx
.
setStorageSync
(
'userInfo'
,
_userInfo
);
_that
.
setData
({
userInfo
:
_userInfo
,
hasUserInfo
:
true
})
_that
.
popupClose
()
_that
.
goOutSite
()
}
})
},
fail
:
function
(
res
)
{
wx
.
hideToast
();
wx
.
showToast
({
title
:
res
,
icon
:
'none'
});
}
})
},
},
/* 手机号绑定 方法 */
/* 手机号绑定 方法 */
accountLogin
:
BindPhone
.
BindPhone
.
accountLogin
,
accountLogin
:
BindPhone
.
BindPhone
.
accountLogin
,
...
...
learnOnline/pages/index/index.wxml
浏览文件 @
6a6ec464
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<image class='logo' src='./icons/hd-logo.png' mode='aspectFit'></image>
<image class='logo' src='./icons/hd-logo.png' mode='aspectFit'></image>
<view class='text'>清控紫荆课堂</view>
<view class='text'>清控紫荆课堂</view>
<button class='btn' open-type='getUserInfo' bindgetuserinfo='getUserInfo'>登录</button>
<button class='btn' open-type='getUserInfo' bindgetuserinfo='getUserInfo'>登录</button>
<
!-- <view class='test-id' bindtap='guestLogin'>游客登录</view> --
>
<
view wx-if='{{isUseAccountLogin}}' class='test-id' bindtap='guestLogin'>游客登录</view
>
<view class='userinfo'>
<view class='userinfo'>
<!-- wx:if='{{!hasUserInfo && canIUse}}' -->
<!-- wx:if='{{!hasUserInfo && canIUse}}' -->
<!-- <block wx:else>
<!-- <block wx:else>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论