Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3b8be9bd
authored
Oct 24, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增朋友圈单页模式拦截
1 parent
9d3daf15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
32 deletions
api/usersApi/UsersApi.js
login/loading/loading.json
utils/share.js
api/usersApi/UsersApi.js
View file @
3b8be9b
import
api
from
'~/utils/request/request'
import
api
from
'~/utils/request/request'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
const
CODE
=
{
const
CODE
=
{
platformEntrance
:
'BUSINESS_ASSISTANT'
,
platformEntrance
:
'BUSINESS_ASSISTANT'
,
productCode
:
'PC00c3'
productCode
:
'PC00c3'
...
@@ -7,20 +9,27 @@ const CODE = {
...
@@ -7,20 +9,27 @@ const CODE = {
class
UsersApi
{
class
UsersApi
{
/**调用后台接口获取用户信息js_code换取sessionId */
/**调用后台接口获取用户信息js_code换取sessionId */
async
wxCodeLogin
()
{
async
wxCodeLogin
()
{
const
{
code
}
=
await
this
.
getWxCode
()
const
appEnter
=
wx
.
getEnterOptionsSync
()
return
await
api
.
post
(
try
{
{
if
(
appEnter
.
scene
===
1154
&&
appEnter
.
mode
===
'singlePage'
)
throw
'login:fail rejected due to no permission currently'
method
:
'scrm.api.sso.wechat.applets.jscode.login'
,
const
{
appId
,
code
code
},
}
=
await
this
.
getWxCode
()
true
return
await
api
.
post
({
)
method
:
'scrm.api.sso.wechat.applets.jscode.login'
,
appId
,
code
},
true
)
}
catch
(
error
)
{
console
.
log
(
error
)
return
Promise
.
reject
()
}
}
}
/**退出登录 */
/**退出登录 */
logout
()
{
logout
()
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.logout'
method
:
'scrm.api.sso.wechat.applets.logout'
},
},
true
true
...
@@ -46,8 +55,7 @@ class UsersApi {
...
@@ -46,8 +55,7 @@ class UsersApi {
delete
detail
.
errMsg
delete
detail
.
errMsg
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
detail
.
loginToken
=
loginToken
detail
.
loginToken
=
loginToken
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.auth.phone'
,
method
:
'scrm.api.sso.wechat.applets.auth.phone'
,
...
detail
,
...
detail
,
platformEntrance
:
'BUSINESS_ASSISTANT'
// 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
platformEntrance
:
'BUSINESS_ASSISTANT'
// 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
...
@@ -58,8 +66,7 @@ class UsersApi {
...
@@ -58,8 +66,7 @@ class UsersApi {
}
}
/**账号密码登录 */
/**账号密码登录 */
async
accountLogin
(
data
=
{})
{
async
accountLogin
(
data
=
{})
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.password.login'
,
method
:
'scrm.api.sso.wechat.applets.password.login'
,
...
data
,
...
data
,
...
CODE
...
CODE
...
@@ -69,8 +76,7 @@ class UsersApi {
...
@@ -69,8 +76,7 @@ class UsersApi {
}
}
/** 手机号获取短信验证码 */
/** 手机号获取短信验证码 */
getSmsCode
(
mobile
)
{
getSmsCode
(
mobile
)
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.sms.get.code'
,
method
:
'scrm.api.sso.wechat.applets.sms.get.code'
,
mobile
mobile
},
},
...
@@ -79,8 +85,7 @@ class UsersApi {
...
@@ -79,8 +85,7 @@ class UsersApi {
}
}
/** 手机号短信验证码登录 */
/** 手机号短信验证码登录 */
phoneSmsLogin
(
data
=
{})
{
phoneSmsLogin
(
data
=
{})
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.sms.login'
,
method
:
'scrm.api.sso.wechat.applets.sms.login'
,
...
data
,
...
data
,
source
:
'MINIAPP'
,
source
:
'MINIAPP'
,
...
@@ -91,8 +96,7 @@ class UsersApi {
...
@@ -91,8 +96,7 @@ class UsersApi {
}
}
/** 获取登录账号列表 */
/** 获取登录账号列表 */
getAccountList
(
sessionId
)
{
getAccountList
(
sessionId
)
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.listSelectAccount'
,
method
:
'scrm.api.sso.wechat.applets.listSelectAccount'
,
...
CODE
,
...
CODE
,
sessionId
sessionId
...
@@ -103,8 +107,7 @@ class UsersApi {
...
@@ -103,8 +107,7 @@ class UsersApi {
/**
/**
* 选择账号登录(手机绑定多个账号时) */
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin
(
data
)
{
selectAccountLogin
(
data
)
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.wechat.applets.selectAccountLogin'
,
method
:
'scrm.api.sso.wechat.applets.selectAccountLogin'
,
...
CODE
,
...
CODE
,
...
data
...
data
...
@@ -114,8 +117,7 @@ class UsersApi {
...
@@ -114,8 +117,7 @@ class UsersApi {
}
}
/**检查sessionId 是否过期 */
/**检查sessionId 是否过期 */
checkSession
()
{
checkSession
()
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.login.status.check'
method
:
'scrm.api.sso.login.status.check'
},
},
true
true
...
@@ -123,8 +125,7 @@ class UsersApi {
...
@@ -123,8 +125,7 @@ class UsersApi {
}
}
/** 超级管理员切换账号 */
/** 超级管理员切换账号 */
adminSelectLogin
(
data
)
{
adminSelectLogin
(
data
)
{
return
api
.
post
(
return
api
.
post
({
{
method
:
'scrm.api.sso.super.administrator.select.login'
,
method
:
'scrm.api.sso.super.administrator.select.login'
,
...
CODE
,
...
CODE
,
...
data
...
data
...
@@ -143,14 +144,13 @@ class UsersApi {
...
@@ -143,14 +144,13 @@ class UsersApi {
/**获取微信用户信息 */
/**获取微信用户信息 */
async
getWXUserInfo
()
{
async
getWXUserInfo
()
{
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
)
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
)
console
.
log
(
wx_user_info
)
if
(
!
wx_user_info
)
{
if
(
!
wx_user_info
)
{
const
data
=
await
this
.
getUserProfile
()
const
data
=
await
this
.
getUserProfile
()
wx
.
$storage
.
set
(
'wx_user_info'
,
data
)
wx
.
$storage
.
set
(
'wx_user_info'
,
data
)
return
data
return
data
}
else
return
wx_user_info
}
else
return
wx_user_info
}
}
/** 手机号授权解析(单纯解析内容返回前端)
/** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
* 传加密信息就解析手机号
*/
*/
...
@@ -169,4 +169,4 @@ class UsersApi {
...
@@ -169,4 +169,4 @@ class UsersApi {
})
})
}
}
}
}
export
default
UsersApi
export
default
UsersApi
\ No newline at end of file
\ No newline at end of file
login/loading/loading.json
View file @
3b8be9b
{
{
"usingComponents"
:
{},
"usingComponents"
:
{},
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
,
"disableScroll"
:
true
}
}
\ No newline at end of file
\ No newline at end of file
utils/share.js
View file @
3b8be9b
...
@@ -52,7 +52,7 @@ class Share {
...
@@ -52,7 +52,7 @@ class Share {
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
path
+=
that
.
setCommonShareQuery
()
path
+=
that
.
setCommonShareQuery
()
if
(
shareQuery
)
path
+=
`&
${
shareQuery
}
`
if
(
shareQuery
)
path
+=
`&
${
shareQuery
}
`
console
.
log
(
'
::
'
,
path
)
console
.
log
(
'
===============
'
,
path
)
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
shareFun
)
shareFun
()
if
(
shareFun
)
shareFun
()
if
(
shareTrackData
)
that
.
reportShareData
(
shareTrackData
)
if
(
shareTrackData
)
that
.
reportShareData
(
shareTrackData
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment