diff --git a/litemall-wx/pages/auth/login/login.js b/litemall-wx/pages/auth/login/login.js index 636994a6..b33a0006 100644 --- a/litemall-wx/pages/auth/login/login.js +++ b/litemall-wx/pages/auth/login/login.js @@ -1,4 +1,7 @@ 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) { diff --git a/litemall-wx/pages/auth/login/login.wxml b/litemall-wx/pages/auth/login/login.wxml index cbeaea98..d2365536 100644 --- a/litemall-wx/pages/auth/login/login.wxml +++ b/litemall-wx/pages/auth/login/login.wxml @@ -19,12 +19,14 @@ - + 注册账号 忘记密码 + + \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/index/index.js b/litemall-wx/pages/ucenter/index/index.js index 962326f1..ff44863b 100644 --- a/litemall-wx/pages/ucenter/index/index.js +++ b/litemall-wx/pages/ucenter/index/index.js @@ -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: '', diff --git a/litemall-wx/pages/ucenter/index/index.wxml b/litemall-wx/pages/ucenter/index/index.wxml index d559dd14..0f402671 100644 --- a/litemall-wx/pages/ucenter/index/index.wxml +++ b/litemall-wx/pages/ucenter/index/index.wxml @@ -8,64 +8,64 @@ - + 我的订单 - + - + 优惠券 - + - - + + 我的收藏 - + - + 我的足迹 - + - + 地址管理 - + diff --git a/litemall-wx/pages/ucenter/index/index.wxss b/litemall-wx/pages/ucenter/index/index.wxss index 529abe17..b437b306 100644 --- a/litemall-wx/pages/ucenter/index/index.wxss +++ b/litemall-wx/pages/ucenter/index/index.wxss @@ -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; diff --git a/litemall-wx/utils/util.js b/litemall-wx/utils/util.js index 0d61329d..9ccff630 100644 --- a/litemall-wx/utils/util.js +++ b/litemall-wx/utils/util.js @@ -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);