Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
Project
Project
Details
Activity
Releases
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
viitto
mallapp
Commits
d812e117
Commit
d812e117
authored
Jun 04, 2020
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
c62d67bf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
90 deletions
+125
-90
index.vue
components/auth/index.vue
+99
-55
index.vue
pages/index/index.vue
+1
-1
user-center.vue
pages/user-center/user-center.vue
+10
-29
api.js
plugin/api.js
+15
-5
No files found.
components/auth/index.vue
View file @
d812e117
...
...
@@ -2,13 +2,7 @@
<div
class=
"auth-page"
>
<u-popup
v-model=
"showDialog"
mode=
"center"
custom-style=
"padding:0;background:none;"
>
<img
:src=
"pageinfo.pic_url"
mode=
"widthFix"
/>
<button
:style=
"sureStyle"
class=
"hotsopt"
open-type=
"getUserInfo"
@
getuserinfo=
"getUserInfo"
></button>
<button
:style=
"sureStyle"
class=
"hotsopt"
open-type=
"getUserInfo"
@
getuserinfo=
"getUserInfo"
></button>
<button
:style=
"cancelStyle"
class=
"hotsopt"
@
click=
"close"
></button>
</u-popup>
</div>
...
...
@@ -19,8 +13,8 @@ export default {
data
()
{
return
{
pageinfo
:
{},
sureStyle
:
""
,
cancelStyle
:
""
,
sureStyle
:
''
,
cancelStyle
:
''
,
showDialog
:
true
};
},
...
...
@@ -30,20 +24,70 @@ export default {
:
{};
let
x
=
this
.
pageinfo
.
hotspot
;
let
y
=
this
.
pageinfo
.
hotspot_cancel
;
this
.
sureStyle
=
`height:
${
x
.
height
}
rpx;width:
${
x
.
width
}
rpx;left:
${
x
.
left
}
rpx;top:
${
x
.
top
}
rpx;`
;
this
.
cancelStyle
=
`height:
${
y
.
height
}
rpx;width:
${
y
.
width
}
rpx;left:
${
y
.
left
}
rpx;top:
${
y
.
top
}
rpx;`
;
this
.
sureStyle
=
`height:
${
x
.
height
}
rpx;width:
${
x
.
width
}
rpx;left:
${
x
.
left
}
rpx;top:
${
x
.
top
}
rpx;`
;
console
.
log
(
this
.
sureStyle
,
'this.sureStyle'
);
this
.
cancelStyle
=
`height:
${
y
.
height
}
rpx;width:
${
y
.
width
}
rpx;left:
${
y
.
left
}
rpx;top:
${
y
.
top
}
rpx;`
;
},
methods
:
{
getUserInfo
(
e
)
{
if
(
e
.
mp
.
detail
.
userInfo
){
// TODO 实现用户登录
uni
.
setStorageSync
(
"userinfo"
,
e
.
mp
.
detail
.
userInfo
);
this
.
$emit
(
'changeuserinfo'
);
// if(e.mp.detail.userInfo){
// // TODO 实现用户登录
// uni.setStorageSync("userinfo", e.mp.detail.userInfo);
// this.$emit('changeuserinfo');
// }
var
that
=
this
;
uni
.
getProvider
({
service
:
'oauth'
,
success
:
function
(
res
)
{
if
(
~
res
.
provider
.
indexOf
(
'weixin'
))
{
uni
.
login
({
provider
:
'weixin'
,
success
:
res
=>
{
uni
.
getUserInfo
({
provider
:
'weixin'
,
success
:
info
=>
{
//这里请求接口
var
OpenId
=
'ow_7I5XC1-RGwwk8QANBmWKYKmOc'
console
.
log
(
res
,
'请求222'
);
console
.
log
(
info
,
'info'
);
that
.
request2
(
{
url
:
'/api/AppletLogin/Login'
,
data
:
{
Source
:
1
,
OpenId
:
OpenId
,
Name
:
'^O^ 做个好梦^O^'
,
Photo
:
'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLnsYM6ibJ4QzJqibNy4WudZy1HEhia3oIzXFhaGjUHZicDtNZeavGyxkP02ib2LVicpwDC4U7PZUZH6GuA/132'
,
Moblie
:
''
,
SuperiorId
:
0
}
},
res
=>
{
console
.
log
(
res
,
'登录了'
);
if
(
res
.
resultCode
==
1
){
uni
.
setStorageSync
(
"mall_UserInfo"
,
res
.
data
);
that
.
$emit
(
'changeuserinfo'
);
}
}
);
},
fail
:
()
=>
{
uni
.
showToast
({
title
:
'微信登录授权失败'
,
icon
:
'none'
});
}
});
},
fail
:
()
=>
{
uni
.
showToast
({
title
:
'微信登录授权失败'
,
icon
:
'none'
});
}
});
}
else
{
uni
.
showToast
({
title
:
'请先安装微信或升级版本'
,
icon
:
'none'
});
}
}
});
},
close
()
{
this
.
showDialog
=
false
;
...
...
@@ -63,7 +107,7 @@ export default {
border
:
none
;
outline
:
none
;
}
.auth-page
.hotsopt
::after
{
border
:
none
;
.auth-page
.hotsopt
::after
{
border
:
none
;
}
</
style
>
pages/index/index.vue
View file @
d812e117
...
...
@@ -145,7 +145,7 @@ export default {
this
.
indexPageData
=
res
.
data
.
home_pages
.
navs
[
0
].
template
.
data
;
this
.
myPageData
=
res
.
data
;
wx
.
setStorageSync
(
"indexdata"
,
this
.
myPageData
);
//
wx.setStorageSync("indexdata", this.myPageData);
if
(
res
.
data
.
home_pages
.
title
!=
""
)
{
uni
.
setNavigationBarTitle
({
title
:
res
.
data
.
home_pages
.
title
,
...
...
pages/user-center/user-center.vue
View file @
d812e117
...
...
@@ -92,7 +92,8 @@
<Text
style=
"margin-top: 10rpx;"
>
{{
meueData
.
user_center
.
copyright
.
description
}}
</Text>
</view>
</view>
<!--
<auth
v-if=
"showAuth"
@
changeuserinfo=
"reloadUserinfo"
></auth>
-->
<!-- v-if="showAuth" -->
<auth
v-if=
"showAuth"
@
changeuserinfo=
"reloadUserinfo"
></auth>
<tabbars></tabbars>
</view>
...
...
@@ -130,18 +131,14 @@ export default {
},
onLoad
()
{
this
.
navHeight
=
this
.
$navHeight
-
2
;
this
.
u
=
wx
.
getStorageSync
(
'
userinfo'
)
;
this
.
u
=
wx
.
getStorageSync
(
'
basedata'
).
user_info
;
if
(
!
this
.
u
)
{
this
.
u
=
{
nick
N
ame
:
'未登录'
,
nick
n
ame
:
'未登录'
,
avatarUrl
:
''
};
this
.
showAuth
=
true
;
}
this
.
cstyle
=
uni
.
getStorageSync
(
'basedata'
)
?
uni
.
getStorageSync
(
'basedata'
).
cat_style
:
[];
if
(
this
.
cstyle
.
cat_style
==
'4'
)
{
}
},
mounted
()
{
let
currentPages
=
getCurrentPages
();
...
...
@@ -152,7 +149,6 @@ export default {
let
u
=
'/'
+
currentPages
[
currentPages
.
length
-
1
].
route
;
let
pages
=
wx
.
getStorageSync
(
'basedata'
)
?
wx
.
getStorageSync
(
'basedata'
).
bar_title
:
[];
console
.
log
(
wx
.
getStorageSync
(
'basedata'
),
'getetetettt'
);
// pages.forEach(x => {
// if (x.value == u) {
// this.pageTitle = x.new_name ? x.new_name : x.name;
...
...
@@ -161,28 +157,15 @@ export default {
uni
.
setNavigationBarTitle
({
title
:
'用户中心'
});
//this.userinfo();
this
.
getmeue
();
this
.
userinfo
();
},
methods
:
{
goHome
()
{
uni
.
redirectTo
({
url
:
'/pages/index/main'
});
},
//获取用户信息
userinfo
()
{
this
.
request2
(
{
url
:
'/api/Mall/GetUserCenter'
,
data
:
{}
},
res
=>
{
uni
.
hideNavigationBarLoading
();
//this.isloading = false;
}
);
},
//获取菜单配置
getmeue
()
{
userinfo
()
{
uni
.
showNavigationBarLoading
();
this
.
request2
(
{
...
...
@@ -190,26 +173,24 @@ export default {
data
:
{}
},
res
=>
{
console
.
log
(
res
,
'resssssss'
);
uni
.
hideNavigationBarLoading
();
//this.isloading = false;
this
.
meueData
=
res
.
data
.
config
;
this
.
user_info
=
res
.
data
.
user_info
;
}
);
},
goUrl
(
url
)
{
console
.
log
(
url
);
uni
.
navigateTo
({
url
:
url
});
},
reloadUserinfo
()
{
this
.
u
=
uni
.
getStorageSync
(
'userinfo'
);
this
.
userinfo
();
this
.
u
=
this
.
user_info
;
this
.
showAuth
=
false
;
},
login
(
name
)
{
if
(
!
name
)
{
if
(
(
name
&&
name
.
nickname
==
''
)
||!
name
||
!
name
.
nick
name
)
{
this
.
showAuth
=
true
;
}
}
...
...
plugin/api.js
View file @
d812e117
export
default
{
install
(
Vue
,
options
)
{
Vue
.
prototype
.
host
=
"https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
//Vue.prototype.host2 = "http://192.168.0.110:8200"
Vue
.
prototype
.
host2
=
"http://192.168.0.110:8200"
//Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue
.
prototype
.
request
=
function
(
param
,
success
,
failed
)
{
//网络请求
...
...
@@ -48,7 +50,8 @@ export default {
OpenId
:
this
.
GetOpenId
().
OpenId
,
UserId
:
this
.
GetOpenId
().
UserId
,
MiniAppId
:
this
.
GetMiniAppId
(),
msg
:
param
.
data
msg
:
param
.
data
,
token
:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODg5MDg5MjkuMCwiZXhwIjoxNTkxNTAwOTI5LjAsIm1hbGxfdXNlckluZm8iOnsidWlkIjoiMyIsInJlcXVlc3RGcm9tIjoyfX0.wvWlZWUmi-sqoCaxB6C9kdQSvyYyMzvgleFLLRW71Sw'
},
success
:
res
=>
{
if
(
res
.
data
.
resultCode
!=
1
)
{
...
...
@@ -78,9 +81,16 @@ export default {
}
//获取OpenId
Vue
.
prototype
.
GetOpenId
=
function
()
{
let
mall_userinfo
=
wx
.
getStorageSync
(
'mall_UserInfo'
)
var
obj
=
{
OpenId
:
'ow_7I5ZQKhAB66yvOTGI35Xk-Kmg'
,
UserId
:
19992
OpenId
:
''
,
UserId
:
0
}
if
(
mall_userinfo
){
if
(
mall_userinfo
.
OpenId
){
obj
.
OpenId
=
mall_userinfo
.
OpenId
;
obj
.
UserId
=
mall_userinfo
.
UserId
;
}
}
return
obj
}
...
...
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