Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
b34af048
Commit
b34af048
authored
Jul 25, 2022
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业用户功能
parent
adc60526
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
137 additions
and
8 deletions
+137
-8
src/api/live.js
+6
-1
src/api/memberInfo.js
+6
-1
src/components/common/SelectEnterpriseAccount/index.vue
+75
-0
src/components/tabbarPage.vue
+4
-0
src/pages/home/index.vue
+9
-0
src/pages/index/index.vue
+6
-0
src/pages/login/index.vue
+30
-6
src/pages/login/main.json
+1
-0
No files found.
src/api/live.js
View file @
b34af048
...
...
@@ -75,7 +75,12 @@ export default {
},
// 获取个人资料
getUserInfo
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/get_user_info`
)
let
enterpriseAccountInfo
=
wx
.
getStorageSync
(
"enterpriseAccount"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"enterpriseAccount"
))
:
""
;
let
mainUserId
=
""
;
if
(
enterpriseAccountInfo
)
{
mainUserId
=
enterpriseAccountInfo
.
customerId
}
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/get_user_info?mainUserId=
${
mainUserId
}
`
)
},
imgToBase64
(
data
){
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/common/read_remote_file?url=
${
data
}
`
)
...
...
src/api/memberInfo.js
View file @
b34af048
...
...
@@ -4,7 +4,12 @@ export default {
// 获取个人资料
getUserInfo
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/get_user_info`
)
let
enterpriseAccountInfo
=
wx
.
getStorageSync
(
"enterpriseAccount"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"enterpriseAccount"
))
:
""
;
let
mainUserId
=
""
;
if
(
enterpriseAccountInfo
)
{
mainUserId
=
enterpriseAccountInfo
.
customerId
}
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/get_user_info?mainUserId=
${
mainUserId
}
`
)
},
getV3PortalShopCard
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/portal_card`
);
...
...
src/components/common/SelectEnterpriseAccount/index.vue
0 → 100644
View file @
b34af048
<
template
>
<!-- 选择企业账号 -->
<div
class=
"SelectEnterpriseAccount"
>
<van-popup
:show=
"show"
round
:close-on-click-overlay=
"false"
position=
"bottom"
>
<van-picker
title=
"选择企业登录"
:columns=
"masterAccount"
:value-key=
"'customerName'"
:show-toolbar=
"true"
@
confirm=
"confirm"
/>
</van-popup>
</div>
</
template
>
<
script
type=
"text/ecmascript-6"
>
// import { setEnterpriseAccount } from "~/plugins/auth";
export
default
{
name
:
"SelectEnterpriseAccount"
,
data
()
{
return
{
show
:
false
,
masterAccount
:
[],
};
},
components
:
{},
computed
:
{},
created
()
{},
mounted
()
{
this
.
list1
;
},
methods
:
{
open
(
val
)
{
this
.
masterAccount
=
val
;
console
.
log
(
this
.
masterAccount
,
'----this.masterAccount'
)
this
.
show
=
true
;
},
close
()
{
this
.
show
=
false
;
},
confirm
(
val
)
{
console
.
log
(
val
.
target
.
value
,
"------------41"
);
// 选择数据
this
.
$emit
(
"confirm"
,
val
.
target
.
value
);
wx
.
setStorage
({
key
:
"enterpriseAccount"
,
data
:
JSON
.
stringify
(
val
.
target
.
value
)
});
this
.
close
();
},
},
};
</
script
>
<
style
lang=
"scss"
>
.SelectEnterpriseAccount
{
.van-popup
{
height
:
40vh
;
.van-picker__toolbar{
.van-picker__cancel{
opacity
:
0
;
}
.van-picker__confirm
{
color
:
var
(
--main-color
);
}
}
}
}
</
style
>
src/components/tabbarPage.vue
View file @
b34af048
...
...
@@ -57,6 +57,10 @@ export default {
this
.
params
=
this
.
$options
.
data
.
call
(
this
).
params
let
ss
=
wx
.
getStorageSync
(
"sessionid"
);
this
.
ss
=
ss
?
`&sessionid=
${
ss
}
`
:
""
;
let
enterpriseAccount
=
wx
.
getStorageSync
(
"enterpriseAccount"
);
if
(
enterpriseAccount
)
{
this
.
ss
+=
enterpriseAccount
?
`&enterpriseAccount=
${
enterpriseAccount
}
`
:
""
;
}
if
(
!
ss
)
{
this
.
params
+=
this
.
params
.
includes
(
"logOut"
)
?
""
:
"&logOut=true"
;
...
...
src/pages/home/index.vue
View file @
b34af048
...
...
@@ -351,6 +351,9 @@ export default {
wx
.
removeStorage
({
key
:
"openid"
});
wx
.
removeStorage
({
key
:
"enterpriseAccount"
});
}
this
.
options
=
wx
.
getStorageSync
(
"becomeInfo"
);
this
.
changeLocation
=
options
.
changeLocation
||
''
...
...
@@ -379,6 +382,9 @@ export default {
wx
.
removeStorage
({
key
:
"openid"
});
wx
.
removeStorage
({
key
:
"enterpriseAccount"
});
}
// 获取页面数据
if
(
this
.
mpApp
.
globalData
.
pageList
)
{
...
...
@@ -889,6 +895,9 @@ export default {
wx
.
removeStorage
({
key
:
"openid"
});
wx
.
removeStorage
({
key
:
"enterpriseAccount"
});
}
log
.
info
(
JSON
.
stringify
(
result
),
that
,
'tztztz初始化'
)
if
(
result
.
data
.
gifts
!==
null
&&
result
.
data
.
gifts
.
length
>
0
)
{
...
...
src/pages/index/index.vue
View file @
b34af048
...
...
@@ -62,6 +62,9 @@ export default {
if
(
wx
.
getStorageSync
(
"sessionid"
)){
this
.
params
+=
`&sessionid=
${
wx
.
getStorageSync
(
"sessionid"
)}
`
;
}
if
(
wx
.
getStorageSync
(
"enterpriseAccount"
)){
this
.
params
+=
`&enterpriseAccount=
${
wx
.
getStorageSync
(
"enterpriseAccount"
)}
`
;
}
let
pageUrl
=
forUrlAddKey
(
decodeURIComponent
(
this
.
link
+
this
.
page
+
this
.
params
));
// let pageUrl = this.link+this.page+this.params;
return
pageUrl
;
...
...
@@ -229,6 +232,9 @@ export default {
wx
.
removeStorage
({
key
:
"openid"
});
wx
.
removeStorage
({
key
:
"enterpriseAccount"
});
}
else
if
(
options
.
from
&&
options
.
from
==
"address"
)
{
log
.
info
(
'options.from == "address"'
)
// 来自小程序地址页面
...
...
src/pages/login/index.vue
View file @
b34af048
...
...
@@ -73,6 +73,8 @@
<div
class=
"cancelLogin"
@
click=
"cancelLogin"
>
暂不登录
</div>
</div>
</div>
<!-- 选择企业 -->
<SelectEnterpriseAccount
ref=
"SelectEnterpriseAccount"
@
confirm=
"getEnterpriseAccount"
></SelectEnterpriseAccount>
</div>
</
template
>
...
...
@@ -92,6 +94,7 @@ import text from '@/components/content/text'
import
richText
from
"../../components/basicTool/rich-text"
;
import
interval
from
'@/components/basicTool/interval/index.vue'
import
partition
from
'@/components/basicTool/partition/index.vue'
import
SelectEnterpriseAccount
from
"@/components/common/SelectEnterpriseAccount"
const
app
=
getApp
();
const
{
log
}
=
app
;
export
default
{
...
...
@@ -103,7 +106,8 @@ export default {
ThemeDataPlant
,
loginLogo
,
loginBox
,
loginUserAgreement
loginUserAgreement
,
SelectEnterpriseAccount
},
data
()
{
return
{
...
...
@@ -764,6 +768,10 @@ export default {
},
// 账号密码登录
loginIn
(
val
)
{
wx
.
setStorage
({
key
:
"enterpriseAccount"
,
data
:
""
});
console
.
log
(
val
,
'-----------loginIn'
)
log
.
info
(
val
,
'-----------loginIn'
)
if
(
val
.
account
==
""
)
{
...
...
@@ -791,11 +799,20 @@ export default {
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
pushPageType
();
console
.
log
(
this
.
mpApp
.
globalData
.
shopInfo
,
"------------------this.mpApp.globalData.shopInfo"
)
if
(
this
.
mpApp
.
globalData
.
shopInfo
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
this
.
$refs
.
SelectEnterpriseAccount
.
open
(
res
.
data
.
data
.
masterAccount
);
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
}
else
{
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
pushPageType
();
}
}
else
{
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
})
}
...
...
@@ -819,6 +836,13 @@ export default {
}
});
},
getEnterpriseAccount
(
val
)
{
console
.
log
(
val
,
'----getEnterpriseAccount'
)
if
(
val
)
{
this
.
backParams
+=
`&enterpriseAccount=
${
wx
.
getStorageSync
(
"enterpriseAccount"
)}
`
}
this
.
pushPageType
();
},
}
};
</
script
>
...
...
src/pages/login/main.json
View file @
b34af048
...
...
@@ -3,6 +3,7 @@
"usingComponents"
:
{
"van-checkbox"
:
"/static/vant/checkbox/index"
,
"van-popup"
:
"/static/vant/popup/index"
,
"van-picker"
:
"/static/vant/picker/index"
,
"van-icon"
:
"/static/vant/icon/index"
,
"photo-gallery"
:
"/static/nativeComponents/PhotoGallery/index"
,
"notice"
:
"/static/nativeComponents/Notice/index"
...
...
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