Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
d98b76d9
Commit
d98b76d9
authored
Mar 27, 2018
by
Junling Bu
Browse files
没有登录则跳转到专门的登录页面。
parent
6bd5ec12
Changes
6
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/auth/login/login.js
View file @
d98b76d9
var
api
=
require
(
'
../../../config/api.js
'
);
var
util
=
require
(
'
../../../utils/util.js
'
);
var
user
=
require
(
'
../../../services/user.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
...
...
@@ -26,7 +29,20 @@ Page({
// 页面关闭
},
startLogin
:
function
()
{
wxLogin
()
{
user
.
checkLogin
().
catch
(()
=>
{
user
.
loginByWeixin
().
then
(
res
=>
{
wx
.
navigateBack
({
delta
:
1
})
}).
catch
((
err
)
=>
{
util
.
showErrorToast
(
'
微信登录失败
'
);
});
});
},
accountLogin
:
function
()
{
var
that
=
this
;
if
(
that
.
data
.
password
.
length
<
1
||
that
.
data
.
username
.
length
<
1
)
{
...
...
litemall-wx/pages/auth/login/login.wxml
View file @
d98b76d9
...
...
@@ -19,12 +19,14 @@
<image class="code-img" src="https://dl.reg.163.com/cp?pd=yanxuan_web&pkid=SkeBZeG&random=1489903563234"></image>
</view>
<button type="default" class="login-btn" bindtap="
star
tLogin">登录</button>
<button type="default" class="login-btn" bindtap="
accoun
tLogin">
账号
登录</button>
<view class="form-item-text">
<navigator url="/pages/auth/register/register" class="register">注册账号</navigator>
<navigator url="/pages/auth/reset/reset" class="reset">忘记密码</navigator>
</view>
<button type="primary" class="login-btn" bindtap="wxLogin">微信直接登录</button>
</view>
</view>
\ No newline at end of file
litemall-wx/pages/ucenter/index/index.js
View file @
d98b76d9
...
...
@@ -51,6 +51,47 @@ Page({
});
},
goOrder
()
{
user
.
checkLogin
().
then
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/ucenter/order/order
"
});
})
.
catch
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/auth/login/login
"
});
});
},
goCoupon
()
{
user
.
checkLogin
().
then
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/ucenter/coupon/coupon
"
});
})
.
catch
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/auth/login/login
"
});
});
},
goCollect
()
{
user
.
checkLogin
().
then
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/ucenter/collect/collect
"
});
})
.
catch
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/auth/login/login
"
});
});
},
goFootprint
()
{
user
.
checkLogin
().
then
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/ucenter/footprint/footprint
"
});
})
.
catch
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/auth/login/login
"
});
});
},
goAddress
()
{
user
.
checkLogin
().
then
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/ucenter/address/address
"
});
})
.
catch
(()
=>
{
wx
.
navigateTo
({
url
:
"
/pages/auth/login/login
"
});
});
},
exitLogin
:
function
()
{
wx
.
showModal
({
title
:
''
,
...
...
litemall-wx/pages/ucenter/index/index.wxml
View file @
d98b76d9
...
...
@@ -8,64 +8,64 @@
<view class="user-menu">
<view class="item">
<
navigator url="/pages/ucenter/order/order" class="a
">
<
view class="a" bindtap="goOrder
">
<text class="icon order"></text>
<text class="txt">我的订单</text>
</
navigator
>
</
view
>
</view>
<view class="item">
<
navigator url="/pages/ucenter/coupon/coupon" class="a
">
<
view class="a" bindtap="goCoupon
">
<text class="icon coupon"></text>
<text class="txt">优惠券</text>
</
navigator
>
</
view
>
</view>
<!-- <view class="item no-border">
<
navigator url="url"
class="a">
<
view
class="a">
<text class="icon gift"></text>
<text class="txt">礼品卡</text>
</
navigator
>
</
view
>
</view> -->
<view class="item">
<
navigator url="/pages/ucenter/collect/collect" class="a
">
<text class="icon
address
"></text>
<
view class="a" bindtap="goCollect
">
<text class="icon
collect
"></text>
<text class="txt">我的收藏</text>
</
navigator
>
</
view
>
</view>
<view class="item">
<
navigator url="/pages/ucenter/footprint/footprint" class="a
">
<
view class="a" bindtap="goFootprint
">
<text class="icon security"></text>
<text class="txt">我的足迹</text>
</
navigator
>
</
view
>
</view>
<!-- <view class="item no-border">
<
navigator url="url"
class="a">
<
view
class="a">
<text class="icon kefu"></text>
<text class="txt">会员福利</text>
</
navigator
>
</
view
>
</view> -->
<view class="item">
<
navigator url="../address/address" class="a
">
<
view class="a" bindtap="goAddress
">
<text class="icon address"></text>
<text class="txt">地址管理</text>
</
navigator
>
</
view
>
</view>
<!-- <view class="item">
<
navigator url="url"
class="a">
<
view
class="a">
<text class="icon security"></text>
<text class="txt">账号安全</text>
</
navigator
>
</
view
>
</view> -->
<!-- <view class="item no-border">
<
navigator url="url"
class="a">
<
view
class="a">
<text class="icon kefu"></text>
<text class="txt">联系客服</text>
</
navigator
>
</
view
>
</view> -->
<!-- <view class="item item-bottom">
<
navigator url="url"
class="a">
<
view
class="a">
<text class="icon help"></text>
<text class="txt">帮助中心</text>
</
navigator
>
</
view
>
</view> -->
</view>
...
...
litemall-wx/pages/ucenter/index/index.wxss
View file @
d98b76d9
...
...
@@ -101,6 +101,11 @@ page{
background-size: 52.803rpx;
}
.user-menu .icon.collect{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/ucenter-sdf6a55ee56-f2c2b9c2f0.png) 0 -62.4997rpx no-repeat;
background-size: 52.803rpx;
}
.user-menu .icon.gift{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/ucenter-sdf6a55ee56-f2c2b9c2f0.png) 0 -187.5rpx no-repeat;
background-size: 52.803rpx;
...
...
litemall-wx/utils/util.js
View file @
d98b76d9
...
...
@@ -37,8 +37,8 @@ function request(url, data = {}, method = "GET") {
if
(
res
.
data
.
errno
==
401
)
{
//需要登录后才可以操作
wx
.
switchTab
({
url
:
'
/pages/
ucenter/index/index
'
wx
.
navigateTo
({
url
:
'
/pages/
auth/login/login
'
});
}
else
{
resolve
(
res
.
data
);
...
...
Write
Preview
Supports
Markdown
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