From 3163e0f0aab3c53184c95ee92fd6db622ecca575 Mon Sep 17 00:00:00 2001
From: maguohua <1264889788@qq.com>
Date: Wed, 15 Feb 2017 17:26:12 +0800
Subject: [PATCH] complete profile
---
README.md | 12 +-
index.html | 8 +
src/page/login/login.vue | 9 +-
src/page/profile/children/balance.vue | 50 +++
src/page/profile/children/benefit.vue | 50 +++
src/page/profile/children/info.vue | 50 +++
src/page/profile/children/points.vue | 50 +++
src/page/profile/children/service.vue | 50 +++
src/page/profile/profile.vue | 352 +++++++++++++++++++--
src/page/shop/children/foodDetail.vue | 1 -
src/router/router.js | 121 +++++--
src/service/getData.js | 84 ++++-
src/service/tempdata/login.js | 56 ++--
src/style/mixin.scss | 1 +
src/test.js | 437 --------------------------
15 files changed, 782 insertions(+), 549 deletions(-)
create mode 100644 src/page/profile/children/balance.vue
create mode 100644 src/page/profile/children/benefit.vue
create mode 100644 src/page/profile/children/info.vue
create mode 100644 src/page/profile/children/points.vue
create mode 100644 src/page/profile/children/service.vue
delete mode 100644 src/test.js
diff --git a/README.md b/README.md
index c4f83e6..cf88e93 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p
- [x] 商家详情页 -- 完成
- [x] 登陆、注册 -- 完成
- [ ] 修改密码
-- [ ] 个人中心
+- [x] 个人中心 -- 完成
- [ ] 帐户信息
- [ ] 服务中心
- [ ] 添加、删除、修改收货地址
@@ -73,6 +73,13 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p
| |-- msite // 商铺列表页
| |-- order // 订单列表页
| |-- profile // 个人中心
+| |--children
+| |--balance //我的余额
+| |--benefit //我的优惠
+| |--info //帐户信息
+| |--points //我的积分
+| |--service //服务中心
+|
| |-- search // 搜索页
| |-- shop // 商铺筛选页
| |-- children
@@ -212,4 +219,7 @@ npm run build
+
+
+
如果觉得不错,请star一下吧 😊
diff --git a/index.html b/index.html
index 812555a..942ca19 100644
--- a/index.html
+++ b/index.html
@@ -112,6 +112,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/page/login/login.vue b/src/page/login/login.vue
index f46bded..d3e2c5d 100644
--- a/src/page/login/login.vue
+++ b/src/page/login/login.vue
@@ -113,10 +113,6 @@
this.validate_token = res.validate_token;
}
},
- changeuserAccount(event){
- console.log(4444)
- console.log(event.target.value)
- },
async mobileLogin(){
if (this.loginWay) {
if (!this.rightPhoneNumber) {
@@ -146,13 +142,12 @@
this.userInfo = await accountLogin(this.userAccount, this.passWord, this.codeNumber);
}
-
- if (this.userInfo.message) {
+ if (!this.userInfo.user_id) {
this.showAlert = true;
this.alertText = this.userInfo.message;
if (!this.loginWay) this.getCaptchaCode();
}else{
- this.RECORD_USERINFO(this.uerInfo);
+ this.RECORD_USERINFO(this.userInfo);
this.$router.go(-1);
}
diff --git a/src/page/profile/children/balance.vue b/src/page/profile/children/balance.vue
new file mode 100644
index 0000000..3fedebe
--- /dev/null
+++ b/src/page/profile/children/balance.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/profile/children/benefit.vue b/src/page/profile/children/benefit.vue
new file mode 100644
index 0000000..3e51e8f
--- /dev/null
+++ b/src/page/profile/children/benefit.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/profile/children/info.vue b/src/page/profile/children/info.vue
new file mode 100644
index 0000000..fe091a9
--- /dev/null
+++ b/src/page/profile/children/info.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/profile/children/points.vue b/src/page/profile/children/points.vue
new file mode 100644
index 0000000..1d6d18a
--- /dev/null
+++ b/src/page/profile/children/points.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/profile/children/service.vue b/src/page/profile/children/service.vue
new file mode 100644
index 0000000..1d6d18a
--- /dev/null
+++ b/src/page/profile/children/service.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/profile/profile.vue b/src/page/profile/profile.vue
index 097dcfd..933e651 100644
--- a/src/page/profile/profile.vue
+++ b/src/page/profile/profile.vue
@@ -1,27 +1,325 @@
-
-
- 首页
- 城市页面
- 商店列表
- 商铺详情
- 搜索
- 登陆
- 确认订单
- 忘记密码
- 个人信息
- 订单列表
- 会员卡
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
3adc5bfcd
+
+
+
+
+ 15800319949
+
+
+
+
+
+
+
+
+
+
+ 0.00元
+ 我的余额
+
+
+ 1个
+ 我的优惠
+
+
+ 1010分
+ 我的积分
+
+
+
+
+
+
+
+
+ 我的订单
+
+
+
+
+
+
+
+
+
+ 积分商城
+
+
+
+
+
+
+
+
+
+ 饿了么会员卡
+
+
+
+
+
+
+
+
+
+
+
+ 服务中心
+
+
+
+
+
+
+
+
+
+ 下载饿了么APP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/page/shop/children/foodDetail.vue b/src/page/shop/children/foodDetail.vue
index 05dfbfb..49ed4e7 100644
--- a/src/page/shop/children/foodDetail.vue
+++ b/src/page/shop/children/foodDetail.vue
@@ -60,7 +60,6 @@
this.satisfy_rate = this.$route.query.satisfy_rate;
this.foods = this.$route.query.foods;
this.shopId = this.$route.query.shopId;
- console.log(this.foods)
},
mixins: [getImgPath],
components: {
diff --git a/src/router/router.js b/src/router/router.js
index 8651dfc..df6a52c 100644
--- a/src/router/router.js
+++ b/src/router/router.js
@@ -15,41 +15,96 @@ const confirmOrder = r => require.ensure([], () => r(require('../page/confirmOrd
const foodDetail = r => require.ensure([], () => r(require('../page/shop/children/foodDetail')), 'foodDetail')
const shopDetail = r => require.ensure([], () => r(require('../page/shop/children/shopDetail')), 'shopDetail')
const shopSafe = r => require.ensure([], () => r(require('../page/shop/children/shopSafe')), 'shopSafe')
+const info = r => require.ensure([], () => r(require('../page/profile/children/info')), 'info')
+const balance = r => require.ensure([], () => r(require('../page/profile/children/balance')), 'balance')
+const benefit = r => require.ensure([], () => r(require('../page/profile/children/benefit')), 'benefit')
+const points = r => require.ensure([], () => r(require('../page/profile/children/points')), 'points')
+const service = r => require.ensure([], () => r(require('../page/profile/children/service')), 'service')
+
export default [{
- path: '/',
- component: App, //顶层路由,对应index.html
- children: [ //二级路由。对应App.vue
- { path: '', redirect: '/home' }, //地址为空时跳转home页面
- { path: '/home', component: home }, //首页城市列表页
- { path: '/city/:cityid', component: city }, //当前选择城市页
- { path: '/msite', component: msite, }, //所有商铺列表页
- { path: '/food', component: food }, //特色商铺列表页
- { path: '/search/:geohash', component: search }, //搜索页
- { path: '/shop', component: shop ,
- children: [
- {
- path: 'foodDetail',
- component: foodDetail,
- },
- {
- path: 'shopDetail',
- component: shopDetail,
- children: [
- {
- path: 'shopSafe',
- component: shopSafe,
- },
- ]
- }
- ]
- }, //商铺详情页
- { path: '/confirmOrder', component: confirmOrder }, //确认订单页
- { path: '/login', component: login }, //登陆注册页
- { path: '/profile', component: profile }, //个人信息页
- { path: '/forget', component: forget }, //修改密码页
- { path: '/order', component: order }, //订单列表页
- { path: '/vipcard', component: vipcard }, //vip卡页
+ path: '/',
+ component: App, //顶层路由,对应index.html
+ children: [ //二级路由。对应App.vue
+ {
+ path: '',
+ redirect: '/home'
+ }, //地址为空时跳转home页面
+ {
+ path: '/home',
+ component: home
+ }, //首页城市列表页
+ {
+ path: '/city/:cityid',
+ component: city
+ }, //当前选择城市页
+ {
+ path: '/msite',
+ component: msite,
+ }, //所有商铺列表页
+ {
+ path: '/food',
+ component: food
+ }, //特色商铺列表页
+ {
+ path: '/search/:geohash',
+ component: search
+ }, //搜索页
+ {
+ path: '/shop',
+ component: shop,
+ children: [{
+ path: 'foodDetail',
+ component: foodDetail,
+ }, {
+ path: 'shopDetail',
+ component: shopDetail,
+ children: [{
+ path: 'shopSafe',
+ component: shopSafe,
+ }, ]
+ }]
+ }, //商铺详情页
+ {
+ path: '/confirmOrder',
+ component: confirmOrder
+ }, //确认订单页
+ {
+ path: '/login',
+ component: login
+ }, //登陆注册页
+ {
+ path: '/profile',
+ component: profile,
+ children: [{
+ path: 'info',
+ component: info,
+ }, {
+ path: 'balance',
+ component: balance,
+ }, {
+ path: 'benefit',
+ component: benefit,
+ }, {
+ path: 'points',
+ component: points,
+ }, {
+ path: 'service',
+ component: service,
+ }]
+ }, //个人信息页
+ {
+ path: '/forget',
+ component: forget
+ }, //修改密码页
+ {
+ path: '/order',
+ component: order
+ }, //订单列表页
+ {
+ path: '/vipcard',
+ component: vipcard
+ }, //vip卡页
]
}]
\ No newline at end of file
diff --git a/src/service/getData.js b/src/service/getData.js
index 928bb73..91e8227 100644
--- a/src/service/getData.js
+++ b/src/service/getData.js
@@ -10,27 +10,37 @@ import * as login from './tempdata/login'
/**
* 获取首页默认地址
*/
-export const cityGuess = () => fetch('GET', '/v1/cities', {type: 'guess'});
+export const cityGuess = () => fetch('GET', '/v1/cities', {
+ type: 'guess'
+});
/**
* 获取首页热门城市
*/
-export const hotcity = () => fetch('GET', '/v1/cities', {type: 'hot'});
+export const hotcity = () => fetch('GET', '/v1/cities', {
+ type: 'hot'
+});
/**
* 获取首页所有城市
*/
-export const groupcity = () => fetch('GET', '/v1/cities', {type: 'group'});
+export const groupcity = () => fetch('GET', '/v1/cities', {
+ type: 'group'
+});
/**
* 获取当前所在城市
*/
export const currentcity = number => fetch('GET', '/v1/cities/' + number, {});
- /**
+/**
* 获取搜索地址
*/
-export const searchplace = (cityid, value) => fetch('GET', '/v1/pois', {type: 'search', city_id: cityid, keyword: value});
+export const searchplace = (cityid, value) => fetch('GET', '/v1/pois', {
+ type: 'search',
+ city_id: cityid,
+ keyword: value
+});
/**
* 获取msite页面地址信息
@@ -40,7 +50,11 @@ export const msiteAdress = geohash => fetch('GET', '/v2/pois/' + geohash, {});
/**
* 获取msite页面食品分类列表
*/
-export const msiteFoodTypes = geohash => fetch('GET', '/v2/index_entry', {geohash, group_type:'1', 'flags[]':'F'});
+export const msiteFoodTypes = geohash => fetch('GET', '/v2/index_entry', {
+ geohash,
+ group_type: '1',
+ 'flags[]': 'F'
+});
/**
* 获取msite商铺列表
@@ -52,42 +66,79 @@ export const shopList = (latitude, longitude, offset, restaurant_category_id = '
supportStr += '&support_ids[]=' + item.id;
}
});
- let data = {latitude, longitude, offset, limit: '20', 'extras[]':'activities', keyword: '', restaurant_category_id, 'restaurant_category_ids[]': restaurant_category_ids, order_by, 'delivery_mode[]':delivery_mode + supportStr};
+ let data = {
+ latitude,
+ longitude,
+ offset,
+ limit: '20',
+ 'extras[]': 'activities',
+ keyword: '',
+ restaurant_category_id,
+ 'restaurant_category_ids[]': restaurant_category_ids,
+ order_by,
+ 'delivery_mode[]': delivery_mode + supportStr
+ };
return fetch('GET', '/shopping/restaurants', data);
-};
+};
/**
* 获取search页面搜索结果
*/
-export const searchRestaurant = (geohash, keyword) => fetch('GET', '/v4/restaurants', {'extras[]':'restaurant_activity', geohash, keyword, type: 'search'});
+export const searchRestaurant = (geohash, keyword) => fetch('GET', '/v4/restaurants', {
+ 'extras[]': 'restaurant_activity',
+ geohash,
+ keyword,
+ type: 'search'
+});
/**
* 获取food页面的 category 种类列表
*/
-export const foodCategory = (latitude, longitude) => fetch('GET', '/shopping/v2/restaurant/category', {latitude, longitude});
+export const foodCategory = (latitude, longitude) => fetch('GET', '/shopping/v2/restaurant/category', {
+ latitude,
+ longitude
+});
/**
* 获取food页面的配送方式
*/
-export const foodDelivery = (latitude, longitude) => fetch('GET', '/shopping/v1/restaurants/delivery_modes', {latitude, longitude, kw: ''});
+export const foodDelivery = (latitude, longitude) => fetch('GET', '/shopping/v1/restaurants/delivery_modes', {
+ latitude,
+ longitude,
+ kw: ''
+});
/**
* 获取food页面的商家属性活动列表
*/
-export const foodActivity = (latitude, longitude) => fetch('GET', '/shopping/v1/restaurants/activity_attributes', {latitude, longitude, kw: ''});
+export const foodActivity = (latitude, longitude) => fetch('GET', '/shopping/v1/restaurants/activity_attributes', {
+ latitude,
+ longitude,
+ kw: ''
+});
/**
* 获取shop页面商铺详情
*/
-export const shopDetails = (shopid, latitude, longitude) => fetch('GET', '/shopping/restaurant/' + shopid, {latitude, longitude:longitude + '&extras[]=activities&extras[]=album&extras[]=license&extras[]=identification&extras[]=statistics'});
+export const shopDetails = (shopid, latitude, longitude) => fetch('GET', '/shopping/restaurant/' + shopid, {
+ latitude,
+ longitude: longitude + '&extras[]=activities&extras[]=album&extras[]=license&extras[]=identification&extras[]=statistics'
+});
/**
* 获取food页面的商家属性活动列表
*/
-export const foodMenu = restaurant_id => fetch('GET', '/shopping/v2/menu', {restaurant_id});
+export const foodMenu = restaurant_id => fetch('GET', '/shopping/v2/menu', {
+ restaurant_id
+});
/**
* 获取商铺评价列表
*/
-export const getRatingList = (offset, tag_name = '') => fetch('GET', '/ugc/v2/restaurants/834828/ratings', {has_content: true,offset,limit: 10, tag_name});
+export const getRatingList = (offset, tag_name = '') => fetch('GET', '/ugc/v2/restaurants/834828/ratings', {
+ has_content: true,
+ offset,
+ limit: 10,
+ tag_name
+});
/**
* 获取商铺评价分数
*/
@@ -111,7 +162,7 @@ export const getcaptchas = () => fetch('POST', '/v1/captchas', {});
/**
* 账号密码登陆
*/
-export const accountLogin = (username, password, captcha_code) => fetch('POST', '/v2/login', {username, password, captcha_code});
+//export const accountLogin = (username, password, captcha_code) => fetch('POST', '/v2/login', {username, password, captcha_code});
@@ -143,3 +194,4 @@ const setpromise = data => {
// export const ratingTags = shopid => setpromise(shop.tage);
export const mobileCode = phone => setpromise(login.validate_token);
export const sendLogin = (code, mobile, validate_token) => setpromise(login.userInfo);
+export const accountLogin = (username, password, captcha_code) => setpromise(login.userInfo);
\ No newline at end of file
diff --git a/src/service/tempdata/login.js b/src/service/tempdata/login.js
index ee26dae..31155e3 100644
--- a/src/service/tempdata/login.js
+++ b/src/service/tempdata/login.js
@@ -1,30 +1,32 @@
-export const validate_token = {"validate_token":"cd8f6585f98d503935bd175295b37ae621c0bf06949a46c226125f28d8efd0a9"};
+export const validate_token = {
+ "validate_token": "cd8f6585f98d503935bd175295b37ae621c0bf06949a46c226125f28d8efd0a9"
+};
export const userInfo = {
- "user_id":109065163,
- "mobile":"13681711254",
- "is_mobile_valid":true,
- "email":"",
- "is_email_valid":false,
- "avatar":"",
- "username":"32f7e5896",
- "is_active":true,
- "brand_member":false,
- "point":960,
- "brand_member_new":0,
- "column_desc":{
- "gift_mall_desc":"0\u5143\u597d\u7269\u5728\u8fd9\u91cc!",
- "game_desc":"\u73a9\u6e38\u620f\u9886\u7ea2\u5305",
- "game_is_show":1,
- "game_link":"https:\/\/gamecenter.faas.ele.me",
- "game_image_hash":"05f108ca4e0c543488799f0c7c708cb1jpeg"
+ "user_id": 109065163,
+ "mobile": "13681711254",
+ "is_mobile_valid": true,
+ "email": "",
+ "is_email_valid": false,
+ "avatar": "",
+ "username": "32f7e5896",
+ "is_active": true,
+ "brand_member": false,
+ "point": 960,
+ "brand_member_new": 0,
+ "column_desc": {
+ "gift_mall_desc": "0\u5143\u597d\u7269\u5728\u8fd9\u91cc!",
+ "game_desc": "\u73a9\u6e38\u620f\u9886\u7ea2\u5305",
+ "game_is_show": 1,
+ "game_link": "https:\/\/gamecenter.faas.ele.me",
+ "game_image_hash": "05f108ca4e0c543488799f0c7c708cb1jpeg"
},
- "pay_without_password":null,
- "delivery_card_expire_days":0,
- "balance":0,
- "payment_quota":50,
- "current_address_id":0,
- "current_invoice_id":0,
- "referal_code":"",
- "gift_amount":2
-};
+ "pay_without_password": null,
+ "delivery_card_expire_days": 0,
+ "balance": 0,
+ "payment_quota": 50,
+ "current_address_id": 0,
+ "current_invoice_id": 0,
+ "referal_code": "",
+ "gift_amount": 2
+};
\ No newline at end of file
diff --git a/src/style/mixin.scss b/src/style/mixin.scss
index 503dc69..781fced 100644
--- a/src/style/mixin.scss
+++ b/src/style/mixin.scss
@@ -1,5 +1,6 @@
$blue: #3190e8;
$bc: #e4e4e4;
+$fc:#fff;
// 背景图片地址和大小
@mixin bis($url) {
diff --git a/src/test.js b/src/test.js
deleted file mode 100644
index ddd9ebd..0000000
--- a/src/test.js
+++ /dev/null
@@ -1,437 +0,0 @@
-webpackJsonp([23], {
- 0: function(t, e, a) {
- t.exports = a(176)
- },
- 113: function(t, e) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- });
- var a = function(t) {
- var e = document.createElement("a");
- e.href = t;
- var a = ["http:", "https:", "eleme:"];
- return a.indexOf(e.protocol) !== -1 && !(e.hostname && !e.hostname.match(/(^|\.)ele(net)?\.me$/))
- };
- e.default = {
- post: function(t, e) {
- var a = {
- method: "POST",
- credentials: "include",
- body: JSON.stringify(e)
- };
- return window.fetch(t, a).then(function(t) {
- var e = t.json();
- return t.ok ? e : e.then(Promise.reject.bind(Promise))
- })
- },
- redirect: function() {
- var t = (new window.UParams).redirect;
- t && a(t) || (t = "/msite/"),
- location.href = t
- }
- }
- },
- 140: function(t, e, a) {
- var s, o, i = {};
- a(559),
- s = a(329),
- o = a(878),
- t.exports = s || {},
- t.exports.__esModule && (t.exports = t.exports.default);
- var c = "function" == typeof t.exports ? t.exports.options || (t.exports.options = {}) : t.exports;
- o && (c.template = o),
- c.computed || (c.computed = {}),
- Object.keys(i).forEach(function(t) {
- var e = i[t];
- c.computed[t] = function() {
- return e
- }
- })
- },
- 176: function(t, e, a) {
- "use strict";
- var s = a(1006)
- , o = babelHelpers.interopRequireDefault(s);
- new Vue({
- el: "body",
- components: {
- App: o.default
- }
- })
- },
- 328: function(t, e, a) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- });
- var s = a(1007)
- , o = babelHelpers.interopRequireDefault(s)
- , i = a(1008)
- , c = babelHelpers.interopRequireDefault(i)
- , n = a(4);
- e.default = {
- components: {
- ElemeHeader: n.ElemeHeader,
- Message: o.default,
- Password: c.default
- },
- data: function() {
- return {
- apihost: "//mainsite-restapi.ele.me",
- current: "message",
- toast: "",
- timer: null,
- showToast: !1,
- isApp: /Eleme/.test(navigator.userAgent)
- }
- },
- computed: {
- headerOpt: function() {
- return {
- message: {
- title: "登录",
- switchName: "密码登录",
- switchTarget: "password"
- },
- password: {
- title: "密码登录",
- switchName: "短信登录",
- switchTarget: "message"
- }
- }[this.current]
- }
- },
- methods: {
- switchTo: function(t) {
- this.current = t
- }
- },
- events: {
- setToast: function(t) {
- var e = this;
- clearTimeout(this.timer),
- this.toast = t,
- this.showToast = !0,
- this.timer = setTimeout(function() {
- e.showToast = !1
- }, 2e3)
- }
- }
- }
- },
- 329: function(t, e) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.default = {
- props: {
- apihost: {
- type: String,
- default: "//mainsite-restapi.ele.me"
- },
- confirmButton: {
- type: Function,
- default: function() {}
- },
- cancelButton: {
- type: Function,
- default: function() {}
- }
- },
- data: function() {
- return {
- captchaCode: "",
- userCaptcha: ""
- }
- },
- computed: {
- captchaImage: function() {
- if (this.captchaCode)
- return this.apihost + "/v1/captchas/" + this.captchaCode
- }
- },
- methods: {
- $fetch: function(t, e) {
- return window.fetch(t, e).then(function(t) {
- var e = t.json();
- return t.status >= 200 && t.status < 300 ? e : e.then(Promise.reject.bind(Promise))
- })
- },
- reloadCaptcha: function() {
- this.$emit("getCaptcha")
- },
- submitCaptcha: function() {
- return this.userCaptcha ? void this.confirmButton(this.userCaptcha, this.captchaCode) : this.$dispatch("setToast", "请填写验证码")
- }
- },
- events: {
- getCaptcha: function() {
- var t = this;
- this.userCaptcha = "",
- this.$fetch(this.apihost + "/v1/captchas", {
- method: "POST",
- credentials: "include"
- }).then(function(e) {
- t.captchaCode = e.code
- }).catch(function() {
- return {}
- })
- }
- }
- }
- },
- 330: function(t, e, a) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- });
- var s = a(140)
- , o = babelHelpers.interopRequireDefault(s)
- , i = a(113)
- , c = babelHelpers.interopRequireDefault(i);
- e.default = {
- components: {
- Captcha: o.default
- },
- props: ["apihost", "current", "is-app"],
- data: function() {
- return {
- isShowLayer: void 0,
- interval: null,
- countdown: 0,
- mobilePhone: "",
- msgCaptcha: "",
- msgToken: ""
- }
- },
- computed: {
- isMobile: function t() {
- var t = /(^(13\d|15[^4,\D]|17[13678]|18\d)\d{8}|170[^346,\D]\d{7})$/;
- return t.test(this.mobilePhone)
- },
- enableShowLayer: function() {
- return !this.isShowLayer && this.isMobile
- },
- buttonText: function() {
- return "undefined" == typeof this.isShowLayer ? "获取验证码" : this.isShowLayer ? "发送中..." : "重新获取"
- }
- },
- methods: {
- showLayer: function() {
- this.enableShowLayer && (this.$broadcast("getCaptcha"),
- this.isShowLayer = !0)
- },
- hideLayer: function() {
- this.isShowLayer = !1
- },
- getMsgCaptcha: function(t) {
- var e = this
- , a = {
- mobile: this.mobilePhone,
- scene: "login",
- type: "sms"
- };
- t && (this.isShowLayer = !1,
- a.captcha_code = t),
- c.default.post(this.apihost + "/v4/mobile/verify_code/send", a).then(function(t) {
- e.setCountdown(),
- e.msgToken = t.validate_token,
- e.isShowLayer = !1
- }).catch(function(t) {
- "NEED_CAPTCHA" === t.name ? e.showLayer() : e.$dispatch("setToast", t.message)
- })
- },
- setCountdown: function() {
- var t = this
- , e = function() {
- if (t.countdown--,
- t.countdown <= 0)
- return clearInterval(t.interval)
- };
- this.countdown = 30,
- this.interval = setInterval(e, 1e3)
- },
- loginByMsg: function() {
- var t = this;
- return this.mobilePhone ? this.isMobile ? this.msgToken ? this.msgCaptcha ? void c.default.post(this.apihost + "/v1/login/app_mobile", {
- validate_token: this.msgToken,
- code: this.msgCaptcha,
- mobile: this.mobilePhone
- }).then(function() {
- c.default.redirect()
- }).catch(function(e) {
- t.msgCaptcha = "",
- t.$dispatch("setToast", e.message)
- }) : this.$dispatch("setToast", "请填写验证码") : this.$dispatch("setToast", "请获取验证码") : this.$dispatch("setToast", "请填写合法的手机号") : this.$dispatch("setToast", "请填写手机号")
- }
- }
- }
- },
- 331: function(t, e, a) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- });
- var s = a(140)
- , o = babelHelpers.interopRequireDefault(s)
- , i = a(1009)
- , c = babelHelpers.interopRequireDefault(i)
- , n = a(113)
- , r = babelHelpers.interopRequireDefault(n);
- e.default = {
- components: {
- Captcha: o.default,
- Switch: c.default
- },
- props: ["apihost", "current", "is-app"],
- data: function() {
- return {
- captchaCode: "",
- userId: "",
- userPw: "",
- userCaptcha: "",
- showPwText: !1
- }
- },
- computed: {
- captchaImage: function() {
- return this.captchaCode ? this.apihost + "/v1/captchas/" + this.captchaCode : void 0
- }
- },
- methods: {
- getCaptchaCode: function() {
- var t = this;
- this.userCaptcha = "",
- r.default.post(this.apihost + "/v1/captchas").then(function(e) {
- t.captchaCode = e.code
- }).catch(function() {
- return {}
- })
- },
- loginByUserId: function() {
- var t = this
- , e = this.captchaCode && this.userCaptcha || !this.captchaCode;
- return this.userId ? this.userPw ? e ? void r.default.post(this.apihost + "/v2/login", {
- username: this.userId,
- password: this.userPw,
- captcha_code: this.userCaptcha
- }).then(function() {
- r.default.redirect()
- }).catch(function(e) {
- t.getCaptchaCode(),
- t.$dispatch("setToast", e.message)
- }) : this.$dispatch("setToast", "请填写验证码") : this.$dispatch("setToast", "密码不能为空") : this.$dispatch("setToast", "手机/邮箱/用户名 不能为空")
- }
- }
- }
- },
- 332: function(t, e) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.default = {
- props: {
- value: {
- type: Boolean,
- twoWay: !0
- }
- },
- methods: {
- switchValue: function() {
- this.value = !this.value
- }
- }
- }
- },
- 448: function(t, e) {},
- 449: function(t, e) {},
- 450: function(t, e) {},
- 559: function(t, e) {},
- 581: function(t, e) {},
- 788: function(t, e) {
- t.exports = "
"
- },
- 789: function(t, e) {
- t.exports = " 温馨提示:未注册饿了么帐号的手机号,登录时将自动注册,且代表您已同意
《用户服务协议》 登录
"
- },
- 790: function(t, e) {
- t.exports = " "
- },
- 878: function(t, e) {
- t.exports = ' '
- },
- 900: function(t, e) {
- t.exports = ' '
- },
- 1006: function(t, e, a) {
- var s, o, i = {};
- a(450),
- s = a(328),
- o = a(788),
- t.exports = s || {},
- t.exports.__esModule && (t.exports = t.exports.default);
- var c = "function" == typeof t.exports ? t.exports.options || (t.exports.options = {}) : t.exports;
- o && (c.template = o),
- c.computed || (c.computed = {}),
- Object.keys(i).forEach(function(t) {
- var e = i[t];
- c.computed[t] = function() {
- return e
- }
- })
- },
- 1007: function(t, e, a) {
- var s, o, i = {};
- a(448),
- s = a(330),
- o = a(789),
- t.exports = s || {},
- t.exports.__esModule && (t.exports = t.exports.default);
- var c = "function" == typeof t.exports ? t.exports.options || (t.exports.options = {}) : t.exports;
- o && (c.template = o),
- c.computed || (c.computed = {}),
- Object.keys(i).forEach(function(t) {
- var e = i[t];
- c.computed[t] = function() {
- return e
- }
- })
- },
- 1008: function(t, e, a) {
- var s, o, i = {};
- a(449),
- s = a(331),
- o = a(790),
- t.exports = s || {},
- t.exports.__esModule && (t.exports = t.exports.default);
- var c = "function" == typeof t.exports ? t.exports.options || (t.exports.options = {}) : t.exports;
- o && (c.template = o),
- c.computed || (c.computed = {}),
- Object.keys(i).forEach(function(t) {
- var e = i[t];
- c.computed[t] = function() {
- return e
- }
- })
- },
- 1009: function(t, e, a) {
- var s, o, i = {};
- a(581),
- s = a(332),
- o = a(900),
- t.exports = s || {},
- t.exports.__esModule && (t.exports = t.exports.default);
- var c = "function" == typeof t.exports ? t.exports.options || (t.exports.options = {}) : t.exports;
- o && (c.template = o),
- c.computed || (c.computed = {}),
- Object.keys(i).forEach(function(t) {
- var e = i[t];
- c.computed[t] = function() {
- return e
- }
- })
- }
-});
--
GitLab