Skip to content

Commit cfd23a2

Browse files
committed
修改msite页面
1 parent 356a3bc commit cfd23a2

24 files changed

Lines changed: 705 additions & 215 deletions

File tree

‎src/App.vue‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
<template>
22
<div id="app">
3+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden">
4+
<defs>
5+
<symbol viewBox="0 0 60 60" id="eleme">
6+
<path fill="#3CABFF" fill-rule="evenodd" d="M0 9.375A9.374 9.374 0 0 1 9.375 0h41.25A9.374 9.374 0 0 1 60 9.375v41.25A9.374 9.374 0 0 1 50.625 60H9.375A9.374 9.374 0 0 1 0 50.625V9.375zm35.94 30.204c-5.601 3.147-12.645 1.256-15.834-4.217-3.206-5.501-1.303-12.537 4.25-15.713 4.7-2.689 10.51-1.749 14.127 1.941L27.526 27.89a2.81 2.81 0 0 0-1.037 3.854 2.862 2.862 0 0 0 3.887 1.035l15.988-9.166a17.238 17.238 0 0 0-1.222-2.571c-4.777-8.198-15.358-11.007-23.632-6.275-8.275 4.734-11.11 15.217-6.332 23.415 4.77 8.184 15.322 10.997 23.59 6.297.877-.5 1.654-1.037 2.376-1.623l-1.31-2.248a2.868 2.868 0 0 0-3.893-1.028zm10.824-7.39l-1.418-2.425-4.911 2.798 2.835 4.846 2.454-1.399h.002a2.779 2.779 0 0 0 1.038-3.82z">
7+
</path>
8+
</symbol>
9+
<symbol viewBox="0 0 28 33" id="user">
10+
<path fill-rule="evenodd" d="M20.798 19.289c2.636-2.002 4.215-5.091 4.215-8.437 0-5.886-4.845-10.647-10.808-10.647S3.397 4.966 3.397 10.852c0 3.345 1.578 6.433 4.212 8.435l.264-2.678C4.358 18.32 1.591 21.403.168 25.187l1.478.556v-1.579c-1.485.73-1.485.73-1.501 1.079-.054.188-.054.188-.069.278a2.58 2.58 0 0 0-.026.229 9.112 9.112 0 0 0-.019.4c-.008.265-.014.617-.018 1.039-.005.511-.006 1.037-.006 1.451v.027c-.004 1.732 1.41 3.129 3.154 3.129h22.082a3.18 3.18 0 0 0 3.172-3.153l.011-1.305.008-.897.003-.296.001-.083v-.022-.006-.001l.002-.278-.093-.262c-1.385-3.918-4.203-7.122-7.812-8.88l.263 2.678zm-1.911-2.516l-2.045 1.553 2.309 1.125c2.856 1.392 5.106 3.949 6.218 7.093l-.09-.54V26.033l-.001.083-.003.296-.008.897-.011 1.305c0 .01-.011.021-.013.021H3.161c-.007 0 .005.011.005.032v-.031c0-.404.001-.92.006-1.418.004-.4.01-.732.017-.969.004-.121.008-.212.012-.262l-.006.043c-.009.06-.009.06-.058.229-.01.336-.01.336-1.49 1.063H2.74l.385-1.024c1.141-3.035 3.35-5.495 6.131-6.849l2.309-1.124-2.045-1.554c-1.859-1.412-2.964-3.576-2.964-5.92 0-4.129 3.418-7.488 7.649-7.488s7.649 3.359 7.649 7.488c0 2.344-1.106 4.509-2.966 5.921z" class="path1">
11+
</path>
12+
</symbol>
13+
<symbol viewBox="0 0 32 31" id="shop">
14+
<g fill-rule="evenodd">
15+
<path d="M28.232 1.822C27.905.728 26.97.152 25.759.152H5.588c-1.252 0-1.867.411-2.397 1.415l-.101.243-.443 1.434-.975 3.154-.002.007C.837 9.101.294 10.854.26 10.956l-.059.259c-.231 1.787.337 3.349 1.59 4.448 1.159 1.017 2.545 1.384 3.865 1.384.07 0 .07 0 .132-.002-.01.001-.01.001.061.002 1.32 0 2.706-.367 3.865-1.384a4.96 4.96 0 0 0 .413-.407l-1.043-.946-1.056.931c1.033 1.171 2.51 1.792 4.21 1.801.04.002.088.004.173.004 1.32 0 2.706-.367 3.865-1.384.148-.13.287-.267.418-.411l-1.044-.944-1.057.93c1.033 1.174 2.511 1.796 4.213 1.806.04.002.088.004.173.004 1.32 0 2.706-.367 3.865-1.384.15-.131.29-.27.422-.416l-1.046-.943-1.058.929c1.033 1.177 2.513 1.801 4.218 1.811.04.002.088.004.173.004 1.32 0 2.706-.367 3.865-1.384 1.206-1.058 1.858-2.812 1.676-4.426-.069-.61-.535-2.207-1.354-4.785l-.109-.342a327.554 327.554 0 0 0-1.295-3.966l-.122-.366.014.043h.004zm-2.684.85l.12.361.318.962c.329.999.658 2.011.965 2.973l.108.338c.719 2.262 1.203 3.92 1.24 4.249.08.711-.233 1.553-.735 1.993-.553.485-1.308.685-2.008.685l-.098-.002c-.987-.007-1.695-.306-2.177-.854l-1.044-1.189-1.06 1.175a2.192 2.192 0 0 1-.188.185c-.553.485-1.308.685-2.008.685l-.098-.002c-.985-.007-1.693-.305-2.174-.852l-1.043-1.185-1.059 1.171c-.058.064-.12.125-.186.183-.553.485-1.308.685-2.008.685l-.098-.002c-.984-.007-1.692-.304-2.173-.85L9.101 12.2l-1.058 1.166a2.248 2.248 0 0 1-.184.181c-.553.485-1.307.685-2.008.685l-.061-.001-.131.001c-.701 0-1.455-.2-2.008-.685-.538-.472-.767-1.102-.654-1.971l-1.396-.18 1.338.44c.043-.13.552-1.775 1.425-4.599l.002-.007.975-3.155.443-1.434-1.345-.415 1.245.658c.054-.102.042-.085-.083-.001-.122.082-.143.086-.009.086H25.763c.053 0-.164-.133-.225-.339l.014.043-.004-.001zM5.528 19.48c.778 0 1.408.63 1.408 1.408v7.424a1.408 1.408 0 1 1-2.816 0v-7.424c0-.778.63-1.408 1.408-1.408z">
16+
</path>
17+
<path d="M.28 29.72c0-.707.58-1.28 1.277-1.28h28.155a1.28 1.28 0 0 1 .007 2.56H1.561A1.278 1.278 0 0 1 .28 29.72z">
18+
</path>
19+
<path d="M26.008 19.48c.778 0 1.408.63 1.408 1.408v7.424a1.408 1.408 0 1 1-2.816 0v-7.424c0-.778.63-1.408 1.408-1.408z">
20+
</path>
21+
</g>
22+
</symbol>
23+
<symbol viewBox="0 0 28 33" id="location">
24+
<g fill-rule="evenodd">
25+
<path d="M20.809 21.6L12.9 29.509h1.616l-7.992-7.992a13.003 13.003 0 0 1-.506-.478c-4.25-4.25-4.25-11.14 0-15.389s11.14-4.25 15.389 0c4.25 4.25 4.25 11.14 0 15.389a10.81 10.81 0 0 1-.543.508l-.056.052zm1.56 1.669c.225-.196.443-.401.656-.613 5.142-5.142 5.142-13.48 0-18.622s-13.48-5.142-18.622 0c-5.142 5.142-5.142 13.48 0 18.622.18.18.364.354.553.522l8.753 8.755 8.661-8.664z" class="path1">
26+
</path>
27+
<path d="M9.428 16.739a6.063 6.063 0 1 0 8.573-8.575 6.063 6.063 0 0 0-8.573 8.575zm1.616-1.616a3.776 3.776 0 1 1 5.34-5.341 3.776 3.776 0 0 1-5.34 5.341z" class="path2">
28+
</path>
29+
</g>
30+
</symbol>
31+
<symbol id="star" viewBox="0 0 32 32">
32+
<path class="path1" d="M16 26.382l-8.16 4.992c-1.5 0.918-2.382 0.264-1.975-1.435l2.226-9.303-7.269-6.218c-1.337-1.143-0.987-2.184 0.755-2.322l9.536-0.758 3.667-8.835c0.674-1.624 1.772-1.613 2.442 0l3.667 8.835 9.536 0.758c1.753 0.139 2.082 1.187 0.755 2.322l-7.269 6.218 2.226 9.303c0.409 1.71-0.485 2.347-1.975 1.435l-8.16-4.992z">
33+
</path>
34+
</symbol>
35+
</defs>
36+
</svg>
337
<router-view></router-view>
438
</div>
539
</template>

‎src/components/common/shoplist.vue‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<template>
2+
<ul>
3+
<router-link :to="{path: 'food', query:{}}" v-for="item in shopListArr" tag='li' :key="item.id" class="shop_li">
4+
<section>
5+
<img :src="imgBaseUrl + subImgUrl(item.image_path)" class="shop_img">
6+
</section>
7+
<hgroup class="shop_right">
8+
<header class="shop_detail_header">
9+
<h4 :class="item.is_premium? 'premium': ''" class="" class="shop_title ellipsis">{{item.name}}</h4>
10+
<ul class="shop_detail_ul">
11+
<li v-for="item in item.supports" key="item.id" class="supports">{{item.icon_name}}</li>
12+
</ul>
13+
</header>
14+
<h5></h5>
15+
<h5></h5>
16+
</hgroup>
17+
</router-link>
18+
</ul>
19+
</template>
20+
21+
<script>
22+
23+
import {mapState} from 'vuex'
24+
import {imgBaseUrl} from '../../config/env'
25+
import {msiteShopList} from '../../service/getData'
26+
export default {
27+
data(){
28+
return {
29+
offset: 0, // 批次加载店铺列表,每次加载20个 limit = 20
30+
shopListArr:[], // 店铺列表数据
31+
imgBaseUrl,
32+
}
33+
},
34+
async mounted(){
35+
this.shopListArr = await msiteShopList(this.latitude, this.longitude, this.offset);
36+
},
37+
props: [],
38+
components: {
39+
40+
},
41+
computed: {
42+
...mapState([
43+
'latitude','longitude'
44+
])
45+
},
46+
methods: {
47+
subImgUrl(path){
48+
let suffix;
49+
if (path.indexOf('jpeg') !== -1) {
50+
suffix = '.jpeg'
51+
}else{
52+
suffix = '.png'
53+
}
54+
let url = '/' + path.substr(0,1) + '/' + path.substr(1,2) + '/' + path.substr(3) + suffix;
55+
return url
56+
}
57+
},
58+
watch: {
59+
60+
}
61+
62+
}
63+
</script>
64+
65+
<style lang="scss" scoped>
66+
@import '../../style/mixin.scss';
67+
.shop_li{
68+
display: flex;
69+
border-bottom: 0.025rem solid #f1f1f1;
70+
padding: 0.8rem 0.4rem;
71+
}
72+
.shop_img{
73+
@include wh(2.7rem, 2.7rem);
74+
display: block;
75+
margin-right: 0.3rem;
76+
}
77+
.shop_right{
78+
flex: auto;
79+
.shop_detail_header{
80+
@include fj;
81+
align-items: center;
82+
.shop_title{
83+
@include sc(0.7rem, #333);
84+
font-weight: 700;
85+
width: 8.5rem;
86+
}
87+
.premium{
88+
89+
}
90+
.shop_detail_ul{
91+
display: flex;
92+
.supports{
93+
@include sc(0.5rem, #999);
94+
border: 0.025rem solid #f1f1f1;
95+
padding: 0.04rem;
96+
border-radius: 0.08rem;
97+
margin-left: 0.1rem;
98+
}
99+
}
100+
}
101+
}
102+
103+
</style>

‎src/components/header/head.vue‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<template>
22
<header id='head_top'>
33
<slot name='logo'></slot>
4-
<div class="head_goback" v-if="goBack" @click="$router.go(-1)"></div>
4+
<slot name='search'></slot>
5+
<section class="head_goback" v-if="goBack" @click="$router.go(-1)">
6+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" version="1.1">
7+
<polyline points="12,18 4,9 12,0" style="fill:none;stroke:rgb(255,255,255);stroke-width:2">
8+
</svg>
9+
</section>
510
<router-link to='/login' v-if='signinUp' class="head_login">登陆|注册</router-link>
6-
<div class="title_head" v-if="headTitle">{{headTitle}}</div>
11+
<section class="title_head ellipsis" v-if="headTitle">
12+
<span class="title_text">{{headTitle}}</span>
13+
</section>
14+
<slot name="msite-title"></slot>
715
<slot name="changecity"></slot>
816
</header>
917
</template>
@@ -40,23 +48,29 @@
4048
#head_top{
4149
background-color: $blue;
4250
position: fixed;
51+
z-index: 999999999999;
4352
left: 0;
4453
top: 0;
4554
@include wh(100%, 1.95rem);
4655
}
4756
.head_goback{
4857
left: 0.4rem;
49-
@include wh(0.375rem, 0.7rem);
50-
@include center-top;
51-
@include backimg('../../images/icon_back.png');
58+
@include wh(0.6rem, 0.8rem);
59+
@include ct;
5260
}
5361
.head_login{
5462
right: 0.55rem;
55-
@include sizecolor(0.6rem, #fff);
56-
@include center-top;
63+
@include sc(0.65rem, #fff);
64+
@include ct;
5765
}
5866
.title_head{
59-
@include sizecolor(0.7rem, #fff);
6067
@include center;
68+
width: 50%;
69+
color: #fff;
70+
text-align: center;
71+
.title_text{
72+
@include sc(0.8rem, #fff);
73+
text-align: center;
74+
}
6175
}
6276
</style>

‎src/config/ajax.js‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎src/config/env.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
/**
22
* 配置编译环境和线上环境之间的切换
33
*
4-
* baseUrl : 路由地址域名
4+
* baseUrl: 域名地址
5+
* routerMode: 路由模式
6+
* imgBaseUrl: 图片所在域名地址
57
*
68
*/
7-
let baseUrl;
8-
let routerMode;
9+
let baseUrl;
10+
let routerMode;
11+
const imgBaseUrl = 'https://fuss10.elemecdn.com';
12+
913
if (process.env.NODE_ENV == 'development') {
1014
baseUrl = '';
11-
routerMode = 'history'
15+
routerMode = 'hash'
1216
}else{
1317
baseUrl = 'https://mainsite-restapi.ele.me';
1418
routerMode = 'hash'
1519
}
1620

17-
export {baseUrl, routerMode}
21+
export {baseUrl, routerMode, imgBaseUrl}

‎src/config/fetch.js‎

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,76 @@
11
import {baseUrl} from './env'
22

3-
export default (type = 'GET', url = '', data = {}) => {
4-
return new Promise((resolve, reject) => { //返回一个promise
5-
type = type.toUpperCase();
6-
url = baseUrl + url
7-
let requestObj = {
3+
export default async (type = 'GET', url = '', data = {}) => {
4+
type = type.toUpperCase();
5+
url = baseUrl + url;
6+
7+
if (type == 'GET') {
8+
let dataStr = ''; //数据拼接字符串
9+
Object.keys(data).forEach(key => {
10+
dataStr += key + '=' + data[key] + '&';
11+
})
12+
13+
if (dataStr !== '') {
14+
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
15+
url = url + '?' + dataStr;
16+
}
17+
}
18+
19+
if (window.fetch) {
20+
let requestConfig = {
821
credentials: 'include',
922
method: type,
1023
headers: {
1124
'Accept': 'application/json',
12-
'Content-Type': 'application/json'
25+
'Content-Type': 'application/json'
1326
},
14-
mode: "no-cors",
27+
mode: "cors",
28+
cache: "only-if-cached"
1529
}
1630

17-
if (type == 'GET') {
18-
let dataStr = ''; //数据拼接字符串
19-
Object.keys(data).forEach(key => {
20-
dataStr += key + '=' + data[key] + '&';
21-
})
22-
23-
if (dataStr !== '') {
24-
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
25-
url = url + '?' + dataStr;
26-
}
27-
}else if (type == 'POST') {
28-
Object.defineProperty(requestObj, 'body', {
31+
if (type == 'POST') {
32+
Object.defineProperty(requestConfig, 'body', {
2933
value: JSON.stringify(data)
3034
})
31-
}else {
32-
reject('error type')
35+
}
36+
37+
try {
38+
var response = await fetch(url, requestConfig);
39+
var responseJson = await response.json();
40+
}catch (error){
41+
throw new Error(error)
3342
}
3443

35-
fetch(url, requestObj).then(res => {
36-
if (res.status == 200) {
37-
return res.json()
38-
} else {
39-
return reject(res)
40-
}
41-
}).then(data => {
42-
resolve(data);
43-
}).catch(err => {
44-
reject(err);
45-
});
46-
})
44+
return responseJson
45+
}else{
46+
let requestObj;
47+
if (window.XMLHttpRequest) {
48+
requestObj = new XMLHttpRequest();
49+
} else {
50+
requestObj = new ActiveXObject;
51+
}
52+
53+
let sendData = '';
54+
if (type == 'POST') {
55+
sendData = JSON.stringify(data);
56+
}
57+
58+
requestObj.open(type, url, true);
59+
requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
60+
requestObj.send(sendData);
61+
62+
requestObj.onreadystatechange = () => {
63+
if (requestObj.readyState == 4) {
64+
if (requestObj.status == 200) {
65+
let obj = requestObj.response
66+
if (typeof obj !== 'object') {
67+
obj = JSON.parse(obj);
68+
}
69+
return obj
70+
}else {
71+
throw new Error(requestObj)
72+
}
73+
}
74+
}
75+
}
4776
}

‎src/images/head-logo.jpg‎

-2.86 KB
Binary file not shown.

‎src/images/icon.svg‎

Lines changed: 1 addition & 0 deletions
Loading

‎src/images/icon_back.png‎

-1.48 KB
Binary file not shown.

0 commit comments

Comments
 (0)