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
1635ddd3
Commit
1635ddd3
authored
Mar 03, 2020
by
sujie@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
e2a031a1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
45 deletions
+120
-45
index.js
components/loginbtn/index.js
+17
-3
api.js
constants/api.js
+5
-5
circleindex.js
service/customer/circleindex.js
+2
-0
websiteindex.js
service/customer/websiteindex.js
+7
-0
index.js
src/pages/clockeditor/index.js
+1
-1
index.js
src/pages/websiteindex/index.js
+60
-26
index.json
src/pages/websiteindex/index.json
+2
-1
index.wxml
src/pages/websiteindex/index.wxml
+4
-1
index.wxss
src/pages/websiteindex/index.wxss
+9
-1
request.js
utilities/request.js
+13
-7
No files found.
components/loginbtn/index.js
View file @
1635ddd3
...
...
@@ -13,6 +13,14 @@ Component({
loginCode
:
{
type
:
String
,
value
:
''
},
type
:{
type
:
Number
,
value
:
1
},
sid
:{
type
:
Number
,
value
:
0
}
},
data
:
{
...
...
@@ -82,9 +90,15 @@ Component({
openid
:
_data
.
user
.
open_id
,
});
LocalStorage
.
setItem
(
'visitor'
,
visitor
);
wx
.
reLaunch
({
url
:
'/ucenter/index'
});
if
(
this
.
data
.
type
==
2
&&
this
.
data
.
sid
>
0
){
wx
.
reLaunch
({
url
:
`/src/pages/websiteindex/index?sid=
${
this
.
data
.
sid
}
`
,
})
}
else
{
wx
.
reLaunch
({
url
:
'/ucenter/index'
});
}
}
else
{
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
...
...
constants/api.js
View file @
1635ddd3
...
...
@@ -200,14 +200,14 @@ const apis = {
websitelikes
:
`
${
api
}
student/website/likes`
,
//点赞
websitecomments
:
`
${
api
}
student/website/comments`
,
//评论和回复
websitecommentslist
:
`
${
api
}
student/website/comments`
,
//获取评论列表
websiteintros
:
`
${
api
}
student
/website/intros`
,
//学校介绍列表
websiteintros
:
`
${
api
}
common
/website/intros`
,
//学校介绍列表
dataconsumer
:
`
${
api
}
common/data/consumer`
,
//c端数据埋点
websitehome
:
`
${
api
}
student
/website/home`
,
//获取微官网基本数据
websitehome
:
`
${
api
}
common
/website/home`
,
//获取微官网基本数据
commonclock
:
`
${
api
}
common/clock`
,
//获取打卡记录
websitecourseshow
:
`
${
api
}
student
/website/course/show`
,
//体验课详情
momentlist
:
`
${
api
}
student
/moment`
,
//C端-课堂瞬间列表
websitecourseshow
:
`
${
api
}
common
/website/course/show`
,
//体验课详情
momentlist
:
`
${
api
}
common
/moment`
,
//C端-课堂瞬间列表
momentdetail
:
`
${
api
}
student/moment/detail`
,
//C端-课堂瞬间详情
newslist
:
`
${
api
}
student
/news`
,
//C端-机构新鲜事列表创
newslist
:
`
${
api
}
common
/news`
,
//C端-机构新鲜事列表创
newsdetail
:
`
${
api
}
student/news/detail`
,
//C端-机构新鲜详情
onlinecourseslist
:
`
${
api
}
student/online_courses`
,
//C端-在线课列表
onlinecoursesdetail
:
`
${
api
}
student/online_courses/detail`
,
//C端-在线课列表详情
...
...
service/customer/circleindex.js
View file @
1635ddd3
...
...
@@ -80,6 +80,7 @@ function newLikeIndex (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
newCommentIndex
(
data
)
{
...
...
@@ -88,6 +89,7 @@ function newCommentIndex (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
joinCircle
(
data
)
{
...
...
service/customer/websiteindex.js
View file @
1635ddd3
...
...
@@ -43,6 +43,7 @@ function websiteintros (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
dataconsumer
(
data
)
{
...
...
@@ -59,6 +60,7 @@ function websitehome (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
commonclock
(
data
)
{
...
...
@@ -66,6 +68,7 @@ function commonclock (data) {
url
:
apis
.
customer
.
websiteindex
.
commonclock
,
data
,
method
:
'GET'
,
notExactly
:
true
,
errorresolve
:
1
,
})
}
...
...
@@ -75,6 +78,7 @@ function websitecourseshow (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
momentlistGet
(
data
)
{
...
...
@@ -83,6 +87,7 @@ function momentlistGet (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
momentdetailGet
(
data
)
{
...
...
@@ -99,6 +104,7 @@ function newslistGet (data) {
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
newsdetailGet
(
data
)
{
...
...
@@ -148,6 +154,7 @@ function websiteBarrage(data){
data
,
method
:
'GET'
,
errorresolve
:
1
,
notExactly
:
true
})
}
function
websitesubjectGet
(
data
){
...
...
src/pages/clockeditor/index.js
View file @
1635ddd3
...
...
@@ -1444,4 +1444,4 @@ Page({
})
}
},
})
\ No newline at end of file
})
src/pages/websiteindex/index.js
View file @
1635ddd3
...
...
@@ -41,7 +41,8 @@ import {
wxAuthorize
,
wxChooseLocation
,
wxOpenSetting
,
wxGetImageInfo
wxGetImageInfo
,
wxLogin
}
from
'../../../utilities/wxApi.js'
;
var
app
=
getApp
();
Page
({
...
...
@@ -148,8 +149,9 @@ Page({
subjectHasmore
:
true
,
subjectListLoading
:
false
,
subjectEmptyPage
:
false
,
subjectTotal
:
''
subjectTotal
:
''
,
unauthorized
:
false
,
loginCode
:
''
,
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
// 当前页面唯一的一个音频容器
...
...
@@ -175,10 +177,49 @@ Page({
if
(
this
.
data
.
sid
==
0
)
{
return
;
}
app
.
getCurrentSchoolStudentId
({
source_id
:
this
.
data
.
sid
,
source_type
:
10
,
}).
then
(()
=>
{
if
(
LocalStorage
.
getItem
(
'visitor'
)){
app
.
getCurrentSchoolStudentId
({
source_id
:
this
.
data
.
sid
,
source_type
:
10
,
}).
then
(()
=>
{
this
.
websitehomeGet
()
this
.
websitecourseshowGet
()
this
.
websiteintrosGet
();
this
.
clockListGet
();
this
.
newslistGet
();
this
.
momentlistGet
();
this
.
onlineCoursesListGet
();
this
.
userShow
();
this
.
websiteBarrage
()
this
.
subjectListGet
(
'init'
)
const
myLocation
=
LocalStorage
.
getItem
(
'myLocation'
);
const
that
=
this
;
wx
.
login
({
success
(
res
)
{
const
sessionCode
=
res
.
code
;
that
.
setData
({
sessionCode
:
sessionCode
})
}
})
wx
.
setNavigationBarColor
({
frontColor
:
'#ffffff'
,
backgroundColor
:
'rgba(255, 255, 255, 0)'
,
animation
:
{
duration
:
0
,
timingFunc
:
'linear'
}
});
})
}
else
{
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
this
.
setData
({
unauthorized
:
true
})
this
.
websitehomeGet
()
this
.
websitecourseshowGet
()
this
.
websiteintrosGet
();
...
...
@@ -189,25 +230,8 @@ Page({
this
.
userShow
();
this
.
websiteBarrage
()
this
.
subjectListGet
(
'init'
)
const
myLocation
=
LocalStorage
.
getItem
(
'myLocation'
);
const
that
=
this
;
wx
.
login
({
success
(
res
)
{
const
sessionCode
=
res
.
code
;
that
.
setData
({
sessionCode
:
sessionCode
})
}
})
wx
.
setNavigationBarColor
({
frontColor
:
'#ffffff'
,
backgroundColor
:
'rgba(255, 255, 255, 0)'
,
animation
:
{
duration
:
0
,
timingFunc
:
'linear'
}
});
})
}
const
myLocation
=
LocalStorage
.
getItem
(
'myLocation'
);
const
that
=
this
;
...
...
@@ -247,6 +271,11 @@ Page({
// })
},
onShow
:
function
()
{
// Do something when page show.
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
if
(
this
.
data
.
needRefresh
)
{
this
.
data
.
clockPage
=
1
;
this
.
data
.
listLoading
=
false
;
...
...
@@ -264,6 +293,11 @@ Page({
}
this
.
resetAudiosPlayStatus
()
clearInterval
(
this
.
data
.
voiceInterval
);
wxLogin
().
then
((
res
)
=>
{
this
.
setData
({
loginCode
:
res
.
code
})
})
},
onUnload
:
function
()
{
this
.
innerAudioContext
.
pause
();
...
...
src/pages/websiteindex/index.json
View file @
1635ddd3
...
...
@@ -22,6 +22,7 @@
"sjd-media-show"
:
"../../../components/sjdmediashow"
,
"scoregetfeedback"
:
"../../../components/scoregetfeedback"
,
"guidecollection"
:
"../../../components/guidecollection"
,
"brick-layout"
:
"../../../components/brickLayout"
"brick-layout"
:
"../../../components/brickLayout"
,
"loginbtn"
:
"../../../components/loginbtn"
}
}
\ No newline at end of file
src/pages/websiteindex/index.wxml
View file @
1635ddd3
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="getUserInfo-btn" wx:if="{{unauthorized}}">
<loginbtn loginCode="{{loginCode}}" type="{{2}}" sid="{{sid}}"/>
</view>
<view class="container" style="{{tabIndex == 2 ? 'background: #F7F4F8;' : ''}}">
<view class="banner-box" id="banner">
<block wx:if="{{!websitehomeEmpty && !bannerEmpty}}">
...
...
@@ -389,4 +392,4 @@
noticecount="{{noticecount}}"
>
</btabbar>
<guidecollection custom="{{1}}"/>
\ No newline at end of file
<guidecollection custom="{{1}}"/>
src/pages/websiteindex/index.wxss
View file @
1635ddd3
...
...
@@ -28,7 +28,15 @@ page{
/* padding: 0 24rpx; */
z-index: 9;
}
.getUserInfo-btn{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 1000;
opacity: 0;
}
.share-btn-wrapper {
position: fixed;
right: 24rpx;
...
...
utilities/request.js
View file @
1635ddd3
...
...
@@ -3,7 +3,7 @@ import {
LocalStorage
}
from
'./index.js'
;
var
app
=
getApp
();
function
wxRequest
({
url
,
data
,
header
,
method
,
dataType
,
responseType
,
errorresolve
,
needToken
,
role
})
{
function
wxRequest
({
url
,
data
,
header
,
method
,
dataType
,
responseType
,
errorresolve
,
needToken
,
role
,
notExactly
})
{
let
visitor
=
LocalStorage
.
getItem
(
'visitor'
)
||
{};
let
user
=
LocalStorage
.
getItem
(
'user'
)
||
{};
let
teacher
=
LocalStorage
.
getItem
(
'teacher'
)
||
{};
...
...
@@ -11,24 +11,31 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres
let
_data
=
data
||
{};
let
_role
=
role
||
'2c'
;
let
_header
=
header
||
{
'
c
ontent-type'
:
'application/x-www-form-urlencoded'
'
C
ontent-type'
:
'application/x-www-form-urlencoded'
};
let
_method
=
method
||
'GEt'
;
let
_dataType
=
dataType
||
'json'
;
let
_responseType
=
responseType
||
'text'
;
let
_errorresolve
=
errorresolve
||
1
;
// 1错误处理通用 2错误处理私用
let
_needToken
=
needToken
===
undefined
?
true
:
needToken
;
//判断接口是否需要token false 不需要 true 需要
let
_notExactly
=
notExactly
;
//判断接口不一定需要token
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
_needToken
)
{
if
(
_role
==
'2c'
)
{
if
(
visitor
.
token
)
{
_header
.
Authorization
=
visitor
.
token
;
}
else
{
// 出现登录窗口或者跳转到登录页面
wx
.
hideLoading
();
if
(
_url
==
'https://qxapi.qingxiao.online/daka/v3/student/comment'
&&
_method
==
'POST'
)
{
reject
();
console
.
log
(
_notExactly
,
'_notExactly_notExactly'
)
if
(
_notExactly
){
// 正常执行
}
else
{
wx
.
hideLoading
();
if
(
_url
==
'https://qxapi.qingxiao.online/daka/v3/student/comment'
&&
_method
==
'POST'
)
{
reject
();
}
return
}
return
}
}
else
if
(
_role
==
'2b'
)
{
let
dakarole
=
LocalStorage
.
getItem
(
'dakarole'
)
||
1
;
...
...
@@ -55,7 +62,6 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres
success
(
res
)
{
const
{
statusCode
,
data
}
=
res
;
if
(
data
.
code
==
40202
){
console
.
log
(
getApp
(),
' getApp()'
)
getApp
().
globalData
.
accountExpired
=
true
;
return
false
;
}
else
{
...
...
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