Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
wechatapp.shangjiadao.com
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxuelai
wechatapp.shangjiadao.com
Commits
df44c1f1
Commit
df44c1f1
authored
Sep 04, 2019
by
wangxuelai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'授权逻辑修改'
parent
48506a97
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
191 additions
and
29 deletions
+191
-29
app.js
app.js
+3
-1
index.js
components/loginbtn/index.js
+108
-0
index.json
components/loginbtn/index.json
+3
-0
index.wxml
components/loginbtn/index.wxml
+5
-0
index.wxss
components/loginbtn/index.wxss
+11
-0
index.js
src/pages/websiteindex/index.js
+4
-3
index.js
ucenter/index.js
+20
-4
index.json
ucenter/index.json
+2
-1
index.wxml
ucenter/index.wxml
+34
-18
index.wxss
ucenter/index.wxss
+1
-0
index.js
utilities/index.js
+0
-2
No files found.
app.js
View file @
df44c1f1
...
...
@@ -34,7 +34,9 @@ App({
this
.
globalData
.
fromUrl
=
'ucenter/index'
;
this
.
globalData
.
query
=
{};
}
this
.
canEnterSystem
(
path
);
if
(
path
!=
'ucenter/index'
)
{
this
.
canEnterSystem
(
path
);
}
},
onHide
:
function
()
{
// 小程序从前台进入后台时
...
...
components/loginbtn/index.js
0 → 100644
View file @
df44c1f1
var
app
=
getApp
();
import
{
clockSs
}
from
'../../service/common.js'
;
import
{
wxLogin
}
from
'../../utilities/wxApi.js'
;
import
{
LocalStorage
}
from
'../../utilities/index.js'
;
import
constants
from
'../../constants/constants.js'
;
Component
({
properties
:
{
position
:
{
type
:
String
,
value
:
''
},
loginCode
:
{
type
:
String
,
value
:
''
}
},
data
:
{
imageVersion
:
app
.
globalData
.
imageVersion
,
loginCode
:
''
,
needLogin
:
false
,
},
created
()
{
// wxLogin().then((res) => {
// this.setData({
// loginCode: res.code
// })
// })
},
attached
()
{
// wxLogin().then((res) => {
// this.setData({
// loginCode: res.code
// })
// })
},
ready
()
{
const
visitor
=
LocalStorage
.
getItem
(
'visitor'
);
if
(
visitor
&&
visitor
.
token
)
{
this
.
setData
({
needLogin
:
false
,
})
}
else
{
// wxLogin().then((res) => {
// this.setData({
// loginCode: res.code
// })
// })
this
.
setData
({
needLogin
:
true
,
})
}
},
methods
:
{
bindGetUserInfo
(
e
)
{
const
{
iv
,
signature
,
userInfo
,
errMsg
,
encryptedData
}
=
e
.
detail
;
const
that
=
this
;
if
(
that
.
data
.
loading
)
{
return
}
if
(
errMsg
==
'getUserInfo:fail auth deny'
)
{
that
.
setData
({
loading
:
false
})
wx
.
showModal
({
title
:
'提示'
,
content
:
'请确认授权使用更多功能'
,
showCancel
:
false
})
return
;
}
that
.
setData
({
loading
:
true
})
let
visitor
=
{
iv
,
signature
,
userInfo
}
wx
.
showLoading
({
title
:
'授权中...'
,
mask
:
true
})
clockSs
({
data
:
encryptedData
,
code
:
this
.
data
.
loginCode
,
iv
:
iv
}).
then
((
res
)
=>
{
wx
.
hideLoading
();
if
(
res
.
code
==
200
)
{
let
_data
=
res
.
data
;
Object
.
assign
(
visitor
,
{
token
:
`
${
_data
.
tokenType
}
${
_data
.
token
}
`
,
unionid
:
_data
.
user
.
union_id
,
id
:
_data
.
user
.
consumer_id
,
version
:
constants
.
storageVersion
,
openid
:
_data
.
user
.
open_id
,
});
LocalStorage
.
setItem
(
'visitor'
,
visitor
);
wx
.
reLaunch
({
url
:
'/ucenter/index'
});
}
else
{
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
wx
.
showModal
({
title
:
'提示'
,
content
:
'授权失败,请重试'
})
}
}).
catch
(()
=>
{
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
})
},
}
})
\ No newline at end of file
components/loginbtn/index.json
0 → 100644
View file @
df44c1f1
{
"component"
:
true
}
\ No newline at end of file
components/loginbtn/index.wxml
0 → 100644
View file @
df44c1f1
<view class="loginbtn" style="position: {{position}}">
<button wx:if="{{needLogin}}" class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
</button>
<slot></slot>
</view>
\ No newline at end of file
components/loginbtn/index.wxss
0 → 100644
View file @
df44c1f1
.btn {
width: initial;
height: initial;
background-color: transparent;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 3;
}
\ No newline at end of file
src/pages/websiteindex/index.js
View file @
df44c1f1
...
...
@@ -113,11 +113,13 @@ Page({
s
,
}
=
sceneQuery
;
this
.
setData
({
sid
:
s
sid
:
s
,
websitehomeEmpty
:
s
==
0
?
true
:
false
})
}
else
{
this
.
setData
({
sid
:
options
.
sid
sid
:
options
.
sid
,
websitehomeEmpty
:
options
.
sid
==
0
?
true
:
false
})
}
this
.
setData
({
...
...
@@ -1193,7 +1195,6 @@ Page({
tabshow
:
false
})
}
wx
.
createSelectorQuery
().
select
(
'#student-clock'
).
boundingClientRect
(
function
(
rect
)
{
if
(
studentclock
<
businessinfo
){
return
false
;
...
...
ucenter/index.js
View file @
df44c1f1
...
...
@@ -4,7 +4,10 @@ author: wxl
*/
import
{
LocalStorage
}
from
'../utilities/index.js'
;
}
from
'../utilities/index.js'
;
wxLogin
import
{
wxLogin
}
from
'../utilities/wxApi.js'
;
import
{
schoolList
}
from
'../service/business/ucenter.js'
;
...
...
@@ -62,6 +65,7 @@ Page({
// imei: '7280BECE2FC29544172A2B858E9E90D0'
}
},
loginCode
:
''
,
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
const
{
sid
}
=
options
;
...
...
@@ -83,7 +87,11 @@ Page({
remark
:
''
})
}
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
},
onReady
:
function
()
{
// Do something when page ready.
},
...
...
@@ -141,10 +149,18 @@ Page({
this
.
userShow
();
}
this
.
getStudentClassList
();
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
},
onHide
:
function
()
{
// Do something when page hide.
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
},
onUnload
:
function
()
{
// Do something when page close.
...
...
ucenter/index.json
View file @
df44c1f1
...
...
@@ -3,6 +3,7 @@
"navigationBarBackgroundColor"
:
"#FFD146"
,
"usingComponents"
:
{
"btabbar"
:
"../components/ctabbar"
,
"activity-bar"
:
"../../components/activitybar"
"activity-bar"
:
"../../components/activitybar"
,
"loginbtn"
:
"../../components/loginbtn"
}
}
\ No newline at end of file
ucenter/index.wxml
View file @
df44c1f1
...
...
@@ -4,30 +4,34 @@
<image class="bg" src="{{imageRoot}}2c/optimize/header_bg.png?{{imageVersion}}"></image>
<view class="userbox">
<view class="left-box">
<image class="avatar" src="{{filter.imagify(userInfo.avatar, 'image/resize,w_320/format,jpg/quality,q_50')}}"></image>
<text class="nickname">{{userInfo.nickname}}</text>
<image class="avatar" src="{{userInfo.avatar && filter.imagify(userInfo.avatar, 'image/resize,w_320/format,jpg/quality,q_50') || 'https://cdn.img.shangjiadao.cn/qingxiao/biz/image/defaultavatar.png'}}"></image>
<text class="nickname" wx:if="{{userInfo.nickname}}">{{userInfo.nickname}}</text>
<text class="nickname" wx:if="{{!userInfo.nickname}}">点击登录</text>
<loginbtn loginCode="{{loginCode}}"/>
</view>
<view class="right-box">
<view class="right-item" bindtap="toMyNews">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="icon" src="{{imageRoot}}2c/optimize/icon_message.png?{{imageVersion}}"></image>
<view class="red-dot" wx:if="{{noticecount>0}}"></view>
</view>
<view class="right-item" bindtap="toSetting">
<view class="right-item" bindtap="toSetting" wx:if="{{!noUserinfo}}" >
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="icon"
wx:if="{{!noUserinfo}}"
src="{{imageRoot}}2c/optimize/icon_setting.png?{{imageVersion}}"></image>
<image class="icon" src="{{imageRoot}}2c/optimize/icon_setting.png?{{imageVersion}}"></image>
</view>
</view>
</view>
</view>
<view class="scorebox">
<view class="menu-box menu-box-set">
<view class="menu-item" bindtap="goMytask">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -35,6 +39,7 @@
<text class="menuname">我的作业</text>
</view>
<view class="menu-item" bindtap="goGrowthRecord">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -42,6 +47,7 @@
<text class="menuname">我的成长</text>
</view>
<view class="menu-item" bindtap="goMyAchievement">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -52,6 +58,7 @@
<view class="menu-box">
<view class="menu-item" bindtap="goMyCourses">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -59,6 +66,7 @@
<text class="menuname">我的课程</text>
</view>
<view class="menu-item" bindtap="goClassRecord">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -66,6 +74,7 @@
<text class="menuname">上课记录</text>
</view>
<view class="menu-item" bindtap="goMySchedule">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -73,6 +82,7 @@
<text class="menuname">我的课表</text>
</view>
<view class="menu-item" bindtap="goScoreMall">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -80,6 +90,7 @@
<text class="menuname">商城</text>
</view>
<view class="menu-item" bindtap="goMyScoreIndex">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -87,6 +98,7 @@
<text class="menuname">我的积分</text>
</view>
<view class="menu-item" bindtap="toPointsRankList">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -106,6 +118,7 @@
<text class="menuname">意见反馈</text>
</navigator>
<view class="menu-item" wx:if="{{cSchoolTotal > 0}}" bindtap="exchangeSchool">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
...
...
@@ -114,21 +127,24 @@
</view>
</view>
</view>
<view class="" style="padding-top: 76rpx;">
<view class="exchange-identity" bindtap="goTeacher">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<view class="exchange-center">老师登录</view>
</view>
<view class="exchange-identity" bindtap="loginToManager">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<view class="exchange-center">登录/注册机构管理员账号
<loginbtn loginCode="{{loginCode}}" position="relative">
<view class="exchange-identity" bindtap="goTeacher">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<view class="exchange-center">老师登录</view>
</view>
</view>
</loginbtn>
<loginbtn loginCode="{{loginCode}}" position="relative">
<view class="exchange-identity" bindtap="loginToManager">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<view class="exchange-center">登录/注册机构管理员账号
</view>
</view>
</loginbtn>
</view>
<btabbar
...
...
ucenter/index.wxss
View file @
df44c1f1
...
...
@@ -35,6 +35,7 @@ page{
.userbox .right-box {
display: flex;
align-items: center;
position: relative;
}
.userbox .left-box .avatar {
width: 106rpx;
...
...
utilities/index.js
View file @
df44c1f1
...
...
@@ -436,12 +436,10 @@ function debounce(func, wait) {
return
function
()
{
let
context
=
this
;
let
args
=
arguments
;
console
.
log
(
debouncetimeout
);
if
(
debouncetimeout
)
clearTimeout
(
debouncetimeout
);
debouncetimeout
=
setTimeout
(()
=>
{
func
.
apply
(
context
,
args
)
},
wait
);
console
.
log
(
debouncetimeout
,
'debouncetimeout'
);
}
}
export
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment