Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wandouchengzhang_coach
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
石盼盼
wandouchengzhang_coach
Commits
28b06958
Commit
28b06958
authored
Nov 10, 2020
by
吴颖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'修改页面登录'
parent
945588be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
279 additions
and
289 deletions
+279
-289
app.js
app.js
+124
-129
project.config.json
project.config.json
+153
-159
base.js
utils/base.js
+2
-1
No files found.
app.js
View file @
28b06958
import
{
Base
}
from
'
./utils/base.js
'
;
import
{
Base
}
from
'
./utils/base.js
'
;
const
base
=
new
Base
()
const
base
=
new
Base
()
App
({
App
({
onLaunch
:
function
()
{
onLaunch
:
function
()
{
this
.
isReload
()
// 小程序是否有新版本
this
.
isReload
()
// 小程序是否有新版本
this
.
getSessionKey
()
// 获取token
this
.
getSessionKey
()
// 获取token
},
},
// 小程序是否有新版本
// 小程序是否有新版本
isReload
:
function
()
{
isReload
:
function
()
{
let
that
=
this
let
that
=
this
if
(
wx
.
canIUse
(
'
getUpdateManager
'
))
{
if
(
wx
.
canIUse
(
'
getUpdateManager
'
))
{
const
updateManager
=
wx
.
getUpdateManager
()
const
updateManager
=
wx
.
getUpdateManager
()
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
if
(
res
.
hasUpdate
)
{
if
(
res
.
hasUpdate
)
{
updateManager
.
onUpdateReady
(
function
()
{
updateManager
.
onUpdateReady
(
function
()
{
wx
.
showModal
({
wx
.
showModal
({
title
:
'
更新提示
'
,
title
:
'
更新提示
'
,
content
:
'
新版本已经准备好,是否重启应用?
'
,
content
:
'
新版本已经准备好,是否重启应用?
'
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
updateManager
.
applyUpdate
()
updateManager
.
applyUpdate
()
}
}
}
}
})
})
})
})
updateManager
.
onUpdateFailed
(
function
()
{
updateManager
.
onUpdateFailed
(
function
()
{
wx
.
showModal
({
wx
.
showModal
({
title
:
'
已经有新版本了哟~
'
,
title
:
'
已经有新版本了哟~
'
,
content
:
'
新版本已经上线啦,请您删除当前小程序,重新搜索打开!
'
content
:
'
新版本已经上线啦,请您删除当前小程序,重新搜索打开!
'
})
})
})
})
}
}
})
})
}
else
{
}
else
{
wx
.
showModal
({
wx
.
showModal
({
title
:
'
提示
'
,
title
:
'
提示
'
,
content
:
'
当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试!
'
content
:
'
当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试!
'
})
})
}
}
},
},
// 将token从缓存中 赋值到全局变量
// 获取sessionkey 提交后台换取基本openid unionid
getToken
:
function
()
{
getSessionKey
:
function
(
cb
)
{
try
{
let
that
=
this
var
token
=
wx
.
getStorageSync
(
'
token
'
)
wx
.
login
({
if
(
token
)
{
success
:
function
(
res
)
{
this
.
globalData
.
token
=
token
that
.
codeChangeToken
(
res
.
code
,
cb
)
}
}
}
catch
(
e
)
{
}
})
},
},
// 获取sessionkey 提交后台换取基本openid unionid
// sessionkey 换取token
getSessionKey
:
function
(
cb
)
{
codeChangeToken
(
code
,
cb
)
{
let
that
=
this
let
that
=
this
wx
.
login
({
wx
.
request
({
success
:
function
(
res
)
{
url
:
'
https://wandoutiyu.test.xueyoubangedu.com/api/getsessionkey
'
,
that
.
codeChangeToken
(
res
.
code
,
cb
)
data
:
{
}
code
:
code
})
},
},
header
:
{
// sessionkey 换取token
'
app
'
:
'
coach
'
codeChangeToken
(
code
,
cb
)
{
},
// 发起网络请求
method
:
'
GET
'
,
let
that
=
this
success
:
function
(
res
)
{
let
params
=
{
if
(
res
.
data
.
meta
.
code
===
200
)
{
data
:
{
try
{
url
:
'
getsessionkey
'
,
wx
.
setStorageSync
(
'
token
'
,
res
.
data
.
data
.
token
)
code
:
code
}
catch
(
e
)
{
},
console
.
log
(
'
token缓存失败
'
)
callback
:
(
data
)
=>
{
}
try
{
that
.
globalData
.
token
=
res
.
data
.
data
.
token
wx
.
setStorageSync
(
'
token
'
,
data
.
token
)
typeof
cb
==
'
function
'
&&
cb
()
}
catch
(
e
)
{
}
else
{
console
.
log
(
'
token缓存失败
'
)
console
.
log
(
res
)
}
}
that
.
globalData
.
token
=
data
.
token
}
typeof
cb
==
'
function
'
&&
cb
()
})
},
}
// 保存用户信息
}
saveUserInfo
:
function
(
info
,
cb
)
{
base
.
newRequest
(
params
)
let
that
=
this
},
wx
.
checkSession
({
// 保存用户信息
success
()
{
saveUserInfo
:
function
(
info
,
cb
)
{
wx
.
request
({
let
that
=
this
url
:
'
https://wandoutiyu.test.xueyoubangedu.com/api/saveinfo
'
,
wx
.
checkSession
({
data
:
{
success
()
{
encryptedData
:
encodeURIComponent
(
info
.
encryptedData
),
let
params
=
{
iv
:
encodeURIComponent
(
info
.
iv
),
data
:
{
token
:
wx
.
getStorageSync
(
'
token
'
)
url
:
'
saveinfo
'
,
},
encryptedData
:
encodeURIComponent
(
info
.
encryptedData
),
header
:
{
iv
:
encodeURIComponent
(
info
.
iv
),
'
app
'
:
'
coach
'
token
:
wx
.
getStorageSync
(
'
token
'
)
},
},
method
:
'
POST
'
,
type
:
'
POST
'
,
success
:
function
(
res
)
{
callback
:
data
=>
{
if
(
res
.
data
.
meta
.
code
==
200
)
{
// if (res.data.meta.code == 200) {
that
.
globalData
.
userInfo
=
res
.
data
.
data
;
wx
.
showToast
({
wx
.
setStorageSync
(
'
userInfo
'
,
res
.
data
.
data
)
title
:
'
已授权
'
,
}
else
{
icon
:
'
none
'
,
console
.
log
(
res
.
data
.
meta
.
message
)
duration
:
1000
wx
.
showToast
({
})
title
:
res
.
data
.
meta
.
message
,
that
.
globalData
.
userInfo
=
data
;
icon
:
'
none
'
,
wx
.
setStorageSync
(
'
userInfo
'
,
data
)
duration
:
2000
// }
})
// else {
}
// wx.showToast({
typeof
cb
==
'
function
'
&&
cb
()
// title: res.data.meta.message,
},
// icon: 'none',
fail
:
function
()
{}
// duration: 1000
})
// })
},
// }
fail
()
{
// session_key 已经失效,需要重新执行登录流程
typeof
cb
==
'
function
'
&&
cb
()
that
.
getSessionKey
(()
=>
that
.
saveUserInfo
(
info
,
cb
))
}
}
}
})
base
.
newRequest
(
params
)
},
},
fail
()
{
// session_key 已经失效,需要重新执行登录流程
that
.
getSessionKey
(()
=>
that
.
saveUserInfo
(
info
,
cb
))
globalData
:
{
}
extAppid
:
'
wx6e6eaca9cc1c406d
'
,
// 当前appid
})
userInfo
:
''
,
//微信user信息
},
userTel
:
''
,
// 手机号
token
:
''
,
backurl
:
''
// 全局跳转页面路径
}
globalData
:
{
extAppid
:
'
wx6e6eaca9cc1c406d
'
,
// 当前appid
userInfo
:
''
,
//微信user信息
userTel
:
''
,
// 手机号
token
:
''
,
backurl
:
''
// 全局跳转页面路径
}
})
})
\ No newline at end of file
project.config.json
View file @
28b06958
{
{
"description"
:
"项目配置文件"
,
"description"
:
"项目配置文件"
,
"packOptions"
:
{
"packOptions"
:
{
"ignore"
:
[]
"ignore"
:
[]
},
},
"setting"
:
{
"setting"
:
{
"urlCheck"
:
false
,
"urlCheck"
:
false
,
"es6"
:
true
,
"es6"
:
true
,
"enhance"
:
false
,
"enhance"
:
false
,
"postcss"
:
true
,
"postcss"
:
true
,
"preloadBackgroundData"
:
false
,
"preloadBackgroundData"
:
false
,
"minified"
:
true
,
"minified"
:
true
,
"newFeature"
:
false
,
"newFeature"
:
false
,
"coverView"
:
true
,
"coverView"
:
true
,
"nodeModules"
:
false
,
"nodeModules"
:
false
,
"autoAudits"
:
false
,
"autoAudits"
:
false
,
"showShadowRootInWxmlPanel"
:
true
,
"showShadowRootInWxmlPanel"
:
true
,
"scopeDataCheck"
:
false
,
"scopeDataCheck"
:
false
,
"uglifyFileName"
:
false
,
"uglifyFileName"
:
false
,
"checkInvalidKey"
:
true
,
"checkInvalidKey"
:
true
,
"checkSiteMap"
:
true
,
"checkSiteMap"
:
true
,
"uploadWithSourceMap"
:
true
,
"uploadWithSourceMap"
:
true
,
"compileHotReLoad"
:
false
,
"compileHotReLoad"
:
false
,
"babelSetting"
:
{
"babelSetting"
:
{
"ignore"
:
[],
"ignore"
:
[],
"disablePlugins"
:
[],
"disablePlugins"
:
[],
"outputPath"
:
""
"outputPath"
:
""
},
},
"useIsolateContext"
:
true
,
"useIsolateContext"
:
true
,
"useCompilerModule"
:
false
,
"useCompilerModule"
:
false
,
"userConfirmedUseCompilerModuleSwitch"
:
false
"userConfirmedUseCompilerModuleSwitch"
:
false
},
},
"compileType"
:
"miniprogram"
,
"compileType"
:
"miniprogram"
,
"libVersion"
:
"2.14.0"
,
"libVersion"
:
"2.14.0"
,
"appid"
:
"wx6e6eaca9cc1c406d"
,
"appid"
:
"wx6e6eaca9cc1c406d"
,
"projectname"
:
"wandouchengzhang_coach"
,
"projectname"
:
"wandouchengzhang_coach"
,
"debugOptions"
:
{
"debugOptions"
:
{
"hidedInDevtools"
:
[]
"hidedInDevtools"
:
[]
},
},
"scripts"
:
{},
"scripts"
:
{},
"isGameTourist"
:
false
,
"isGameTourist"
:
false
,
"simulatorType"
:
"wechat"
,
"simulatorType"
:
"wechat"
,
"simulatorPluginLibVersion"
:
{},
"simulatorPluginLibVersion"
:
{},
"condition"
:
{
"condition"
:
{
"search"
:
{
"search"
:
{
"current"
:
-1
,
"list"
:
[]
"list"
:
[]
},
},
"conversation"
:
{
"conversation"
:
{
"list"
:
[]
"current"
:
-1
,
},
"list"
:
[]
"plugin"
:
{
},
"list"
:
[]
"plugin"
:
{
},
"current"
:
-1
,
"game"
:
{
"list"
:
[]
"list"
:
[]
},
},
"game"
:
{
"gamePlugin"
:
{
"current"
:
-1
,
"list"
:
[]
"list"
:
[]
},
},
"miniprogram"
:
{
"gamePlugin"
:
{
"list"
:
[
"current"
:
-1
,
{
"list"
:
[]
"id"
:
-1
,
},
"name"
:
"pages/tabbar/personal/personal"
,
"miniprogram"
:
{
"pathName"
:
"pages/tabbar/personal/personal"
,
"current"
:
-1
,
"query"
:
""
,
"list"
:
[
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/tabbar/personal/personal"
,
"id"
:
-1
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"name"
:
"pages/tabbar/personal/personal"
,
"query"
:
""
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/tabbar/personal/personal"
,
"id"
:
-1
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"name"
:
"pages/my/parents/parents"
,
"query"
:
""
,
"pathName"
:
"pages/my/parents/parents"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/my/parents/parents"
,
"id"
:
-1
,
"pathName"
:
"pages/my/parents/parents"
,
"name"
:
"pages/tabbar/personal/personal"
,
"query"
:
""
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/tabbar/personal/personal"
,
"id"
:
-1
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"name"
:
"pages/my/teachingArea/teachingArea"
,
"query"
:
""
,
"pathName"
:
"pages/my/teachingArea/teachingArea"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/my/teachingArea/teachingArea"
,
"id"
:
-1
,
"pathName"
:
"pages/my/teachingArea/teachingArea"
,
"name"
:
"pages/index/classManagement/classManagement"
,
"query"
:
""
,
"pathName"
:
"pages/index/classManagement/classManagement"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/index/classManagement/classManagement"
,
"id"
:
-1
,
"pathName"
:
"pages/index/classManagement/classManagement"
,
"name"
:
"pages/index/courseInstant/courseInstant"
,
"query"
:
""
,
"pathName"
:
"pages/index/courseInstant/courseInstant"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/index/courseInstant/courseInstant"
,
"id"
:
7
,
"pathName"
:
"pages/index/courseInstant/courseInstant"
,
"name"
:
"pages/index/classDetail/classDetail"
,
"query"
:
""
,
"pathName"
:
"pages/index/classDetail/classDetail"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
7
,
{
"name"
:
"pages/index/classDetail/classDetail"
,
"id"
:
-1
,
"pathName"
:
"pages/index/classDetail/classDetail"
,
"name"
:
"pages/team/teamDetail/teamDetail"
,
"query"
:
""
,
"pathName"
:
"pages/team/teamDetail/teamDetail"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/team/teamDetail/teamDetail"
,
"id"
:
-1
,
"pathName"
:
"pages/team/teamDetail/teamDetail"
,
"name"
:
"pages/index/performance/performance"
,
"query"
:
""
,
"pathName"
:
"pages/index/performance/performance"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/index/performance/performance"
,
"id"
:
-1
,
"pathName"
:
"pages/index/performance/performance"
,
"name"
:
"pages/index/evaluation/evaluation"
,
"query"
:
""
,
"pathName"
:
"pages/index/evaluation/evaluation"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"pages/index/evaluation/evaluation"
,
"id"
:
-1
,
"pathName"
:
"pages/index/evaluation/evaluation"
,
"name"
:
"个人中心"
,
"query"
:
""
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"scene"
:
null
"query"
:
""
,
},
"scene"
:
null
{
},
"id"
:
-1
,
{
"name"
:
"个人中心"
,
"id"
:
-1
,
"pathName"
:
"pages/tabbar/personal/personal"
,
"name"
:
"pages/tabbar/class/class"
,
"query"
:
""
,
"pathName"
:
"pages/tabbar/class/class"
,
"scene"
:
null
"scene"
:
null
},
}
{
]
"id"
:
-1
,
}
"name"
:
"pages/tabbar/class/class"
,
}
"pathName"
:
"pages/tabbar/class/class"
,
"scene"
:
null
}
]
}
}
}
}
\ No newline at end of file
utils/base.js
View file @
28b06958
...
@@ -9,12 +9,13 @@ class Base {
...
@@ -9,12 +9,13 @@ class Base {
if
(
!
params
.
type
)
{
if
(
!
params
.
type
)
{
params
.
type
=
'
GET
'
params
.
type
=
'
GET
'
}
}
var
cur_url
=
that
.
baseUrl
+
params
.
data
.
url
var
cur_url
=
that
.
baseUrl
+
params
.
url
// if (flag) {
// if (flag) {
// params.url = params.url;
// params.url = params.url;
// } else {
// } else {
// params.url = that.baseUrl + params.url;
// params.url = that.baseUrl + params.url;
// }
// }
console
.
log
(
cur_url
)
wx
.
request
({
wx
.
request
({
url
:
cur_url
,
url
:
cur_url
,
data
:
params
.
data
,
data
:
params
.
data
,
...
...
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