Showing
4 changed files
with
143 additions
and
18 deletions
@@ -60,13 +60,24 @@ exports.addressAct = (req, res, next) => { | @@ -60,13 +60,24 @@ exports.addressAct = (req, res, next) => { | ||
60 | }).catch(next); | 60 | }).catch(next); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | +/** | ||
64 | + * 新版地区选择 | ||
65 | + */ | ||
63 | exports.addressActVue = (req, res) => { | 66 | exports.addressActVue = (req, res) => { |
64 | res.render('address/address-act-vue', { | 67 | res.render('address/address-act-vue', { |
65 | - vue: true | 68 | + vue: true, |
69 | + localCss: true | ||
66 | }); | 70 | }); |
67 | }; | 71 | }; |
68 | 72 | ||
69 | /** | 73 | /** |
74 | + * TODO DELETE 模拟省数据 | ||
75 | + */ | ||
76 | +exports.provinces = (req, res) => { | ||
77 | + res.json({ "provinces": [{ "name": "北京", "id": "1" }, { "name": "上海", "id": "2" }, { "name": "天津", "id": "3" }, { "name": "重庆", "id": "4" }, { "name": "河北", "id": "5" }, { "name": "山西", "id": "6" }, { "name": "河南", "id": "7" }, { "name": "辽宁", "id": "8" }, { "name": "吉林", "id": "9" }, { "name": "黑龙江", "id": "10" }, { "name": "内蒙古", "id": "11" }, { "name": "江苏", "id": "12" }, { "name": "山东", "id": "13" }, { "name": "安徽", "id": "14" }, { "name": "浙江", "id": "15" }, { "name": "福建", "id": "16" }, { "name": "湖北", "id": "17" }, { "name": "湖南", "id": "18" }, { "name": "广东", "id": "19" }, { "name": "广西", "id": "20" }, { "name": "江西", "id": "21" }, { "name": "四川", "id": "22" }, { "name": "海南", "id": "23" }, { "name": "贵州", "id": "24" }, { "name": "云南", "id": "25" }, { "name": "西藏", "id": "26" }, { "name": "陕西", "id": "27" }, { "name": "甘肃", "id": "28" }, { "name": "青海", "id": "29" }, { "name": "宁夏", "id": "30" }, { "name": "新疆", "id": "31" }, { "name": "台湾", "id": "32" }, { "name": "钓鱼岛", "id": "84" }, { "name": "港澳", "id": "52993" }] }); | ||
78 | +}; | ||
79 | + | ||
80 | +/** | ||
70 | * 修改地址或者添加新地址 | 81 | * 修改地址或者添加新地址 |
71 | * @param req | 82 | * @param req |
72 | * @param res | 83 | * @param res |
@@ -200,6 +211,6 @@ exports.locationList = (req, res, next) => { | @@ -200,6 +211,6 @@ exports.locationList = (req, res, next) => { | ||
200 | addressModel.locationList({ | 211 | addressModel.locationList({ |
201 | uid: req.user.uid | 212 | uid: req.user.uid |
202 | }).then(result => { | 213 | }).then(result => { |
203 | - res.render('address/location-list', Object.assign(result, {layout: false})); | 214 | + res.render('address/location-list', Object.assign(result, { layout: false })); |
204 | }).catch(next); | 215 | }).catch(next); |
205 | }; | 216 | }; |
@@ -133,5 +133,6 @@ router.get('/installment/delBankCard', installment.delBankCard); // 删除绑定 | @@ -133,5 +133,6 @@ router.get('/installment/delBankCard', installment.delBankCard); // 删除绑定 | ||
133 | router.get('/installment/setMasterCard', installment.setMasterCard); // 切换主卡 | 133 | router.get('/installment/setMasterCard', installment.setMasterCard); // 切换主卡 |
134 | 134 | ||
135 | router.get('/address-vact', addressController.addressActVue); // 地址添加页面 | 135 | router.get('/address-vact', addressController.addressActVue); // 地址添加页面 |
136 | +router.get('/provinces.json', addressController.provinces); // TODO 模拟省数据 | ||
136 | 137 | ||
137 | module.exports = router; | 138 | module.exports = router; |
1 | <template> | 1 | <template> |
2 | - <div class="vue-header"> | ||
3 | - | ||
4 | - </div> | 2 | + <header class="yoho-header"> |
3 | + <a :href="headerBack" class="iconfont nav-back"></a> | ||
4 | + <span v-if="showBtn" class="iconfont nav-home"></span> | ||
5 | + <p class="nav-title">{{headerText}}</p> | ||
6 | + </header> | ||
5 | </template> | 7 | </template> |
6 | <style> | 8 | <style> |
7 | - .vue-header { | ||
8 | - height: 90px; | ||
9 | - background-image: linear-gradient(#323232, #414141); | ||
10 | - } | 9 | + |
11 | </style> | 10 | </style> |
12 | <script> | 11 | <script> |
13 | 12 | ||
14 | module.exports = { | 13 | module.exports = { |
14 | + props: { | ||
15 | + headerBack: String, | ||
16 | + headerText: String, | ||
17 | + showBtn: Boolean | ||
18 | + }, | ||
15 | data(){ | 19 | data(){ |
16 | - return{ | ||
17 | - msg:'hello vue' | ||
18 | - } | 20 | + return {}; |
19 | } | 21 | } |
20 | }; | 22 | }; |
21 | 23 |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <header-component></header-component> | ||
4 | - {{msg}} | 3 | + <header-component header-text="地区选择" :show-btn="false"> |
4 | + </header-component> | ||
5 | + <ul class="head-address-ul"> | ||
6 | + <li class="head-address-li">请选择</li> | ||
7 | + <li></li> | ||
8 | + <li></li> | ||
9 | + <li></li> | ||
10 | + </ul> | ||
11 | + <div class="address-container"> | ||
12 | + <div class="address-content"> | ||
13 | + <ul class="address-ul"> | ||
14 | + <li v-for="province in provinces">{{province.name}}</li> | ||
15 | + </ul> | ||
16 | + </div> | ||
17 | + </div> | ||
5 | </div> | 18 | </div> |
6 | </template> | 19 | </template> |
7 | <style> | 20 | <style> |
8 | body { | 21 | body { |
9 | margin: 0; | 22 | margin: 0; |
10 | } | 23 | } |
24 | + | ||
25 | + .head-address-ul { | ||
26 | + margin: 0; | ||
27 | + padding: 0; | ||
28 | + list-style: none; | ||
29 | + overflow: hidden; | ||
30 | + background-color: white; | ||
31 | + font-size: 24px; | ||
32 | + | ||
33 | + li { | ||
34 | + width: 25%; | ||
35 | + display: block; | ||
36 | + float: left; | ||
37 | + height: 80px; | ||
38 | + position: relative; | ||
39 | + line-height: 80px; | ||
40 | + text-align: center; | ||
41 | + } | ||
42 | + | ||
43 | + .head-address-li { | ||
44 | + color: #f23030; | ||
45 | + } | ||
46 | + | ||
47 | + .head-address-li:after { | ||
48 | + width: 60%; | ||
49 | + height: 1px; | ||
50 | + border-bottom: 2px solid #f23030; | ||
51 | + position: absolute; | ||
52 | + bottom: 1px; | ||
53 | + left: 50%; | ||
54 | + content: ''; | ||
55 | + margin-left: -30%; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + .head-address-ul:after { | ||
60 | + content: ''; | ||
61 | + width: 100%; | ||
62 | + height: 1px; | ||
63 | + position: absolute; | ||
64 | + border-bottom: 1px solid #e3e5e9; | ||
65 | + left: 0px; | ||
66 | + bottom: 0px; | ||
67 | + transform: scaleY(0.5); | ||
68 | + -webkit-transform: scaleY(0.5); | ||
69 | + } | ||
70 | + | ||
71 | + .address-container { | ||
72 | + margin: 0px; | ||
73 | + overflow: hidden; | ||
74 | + height: 100%; | ||
75 | + width: 100%; | ||
76 | + | ||
77 | + .address-content { | ||
78 | + transform: translate(0px, 0px) translateZ(0px); | ||
79 | + height: 960px; | ||
80 | + | ||
81 | + .address-ul { | ||
82 | + padding: 0; | ||
83 | + margin: 0; | ||
84 | + list-style: none; | ||
85 | + height: 100%; | ||
86 | + overflow: auto; | ||
87 | + font-size: 24px; | ||
88 | + color: #232326; | ||
89 | + | ||
90 | + li { | ||
91 | + height: 80px; | ||
92 | + line-height: 80px; | ||
93 | + padding-left: 10px; | ||
94 | + position: relative; | ||
95 | + overflow: hidden; | ||
96 | + } | ||
97 | + | ||
98 | + li:after { | ||
99 | + content: ''; | ||
100 | + width: 100%; | ||
101 | + height: 1px; | ||
102 | + position: absolute; | ||
103 | + border-bottom: 1px solid #e3e5e9; | ||
104 | + left: 0px; | ||
105 | + bottom: 0px; | ||
106 | + transform: scaleY(0.5); | ||
107 | + -webkit-transform: scaleY(0.5); | ||
108 | + } | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
11 | </style> | 112 | </style> |
12 | <script> | 113 | <script> |
13 | let headerComponent = require('common/header.vue'); | 114 | let headerComponent = require('common/header.vue'); |
14 | 115 | ||
15 | module.exports = { | 116 | module.exports = { |
16 | - data(){ | ||
17 | - return{ | ||
18 | - msg:'hello vue' | ||
19 | - } | 117 | + data() { |
118 | + return { | ||
119 | + provinces:[] | ||
120 | + }; | ||
20 | }, | 121 | }, |
21 | components: { | 122 | components: { |
22 | headerComponent | 123 | headerComponent |
124 | + }, | ||
125 | + methods: { | ||
126 | + selectProvince() { | ||
127 | + $.get('/home/provinces.json', resultData => { | ||
128 | + this.provinces = resultData.provinces; | ||
129 | + }); | ||
130 | + } | ||
131 | + }, | ||
132 | + created: function() { | ||
133 | + this.selectProvince(); | ||
23 | } | 134 | } |
24 | }; | 135 | }; |
25 | 136 |
-
Please register or login to post a comment