From d98b76d9a26d4eaabaab4622ffd8b7edf67fc3fb Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Tue, 27 Mar 2018 20:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=99=BB=E5=BD=95=E5=88=99?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=B8=93=E9=97=A8=E7=9A=84=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-wx/pages/auth/login/login.js | 18 +++++++++- litemall-wx/pages/auth/login/login.wxml | 4 ++- litemall-wx/pages/ucenter/index/index.js | 41 +++++++++++++++++++++ litemall-wx/pages/ucenter/index/index.wxml | 42 +++++++++++----------- litemall-wx/pages/ucenter/index/index.wxss | 5 +++ litemall-wx/utils/util.js | 4 +-- 6 files changed, 89 insertions(+), 25 deletions(-) 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);