Authored by lea guo

订单列表

... ... @@ -14,25 +14,29 @@ const checkApiMap = url => {
// eslint-disable-next-line space-before-function-paren
const request = async ({ url, method, reqParams = {}, context }) => {
const apiInfo = checkApiMap(url);
const { env, user = {} } = context;
if (!apiInfo) {
return Promise.reject(new Error(`未找到对应的接口:${url}`));
}
// 登陆:取session中用户信息
// 非登录: 可以传参
if (!apiInfo.service) {
Object.assign(reqParams, {
uid: user.uid
? {
toString: () => {
return user.uid;
},
sessionKey: user.sessionKey,
appSessionType: user.appSessionType,
}
: reqParams.uid || 1,
method: apiInfo.api,
});
const { uid, sessionKey, appSessionType } = user;
Object.assign(reqParams, { method: apiInfo.api });
if (uid) {
Object.assign(reqParams, {
uid: {
toString: () => {
return user.uid;
},
sessionKey,
appSessionType,
},
});
}
}
// 开发环境接口调用非延签参数
... ... @@ -72,7 +76,7 @@ const request = async ({ url, method, reqParams = {}, context }) => {
}
};
const catchError = (context, reqParams) => {
const catchCode = (context, reqParams) => {
return result => {
if (result && result.code === 500) {
createReport(context, 'api')(
... ... @@ -88,6 +92,15 @@ const catchError = (context, reqParams) => {
};
};
const catchError = (context, store) => {
return error => {
if (error.code === 401) {
store.commit('SET_NEED_LOGIN', { needLogin: true });
}
return Promise.resolve();
};
};
export const createApi = context => {
return {
get(url, reqParams = {}) {
... ...
... ... @@ -5,9 +5,5 @@ export default [
name: 'channel',
path: '/xianyu/channel',
component: () => import(/* webpackChunkName: "channel" */ './channel/channel')
},
{
path: '/xianyu/home/notice',
component: () => import(/* webpackChunkName: "notice" */ './notice/notice')
}
];
... ...
... ... @@ -4,5 +4,7 @@ import List from './list';
import Product from './product';
import Home from './home';
import Address from './address';
import Notice from './notice';
export default [...Order, ...Common, ...List, ...Product, ...Home, ...Address, ...Notice];
export default [...Order, ...Common, ...List, ...Product, ...Home, ...Address];
... ...
export default [
{
name: 'noticeList',
path: '/xianyu/notice',
component: () => import(/* webpackChunkName: "notice" */ './list/notice')
}
];
... ...
<template>
<div>
<Scroll
ref="recyclelist"
class="list"
:scrool-events="['scroll-end','scroll']"
@scroll="onScroll"
@scroll-end="fetchList">
<div class="content-root">
<div>{{noticeList.length}}{{fetchNoticePage}}</div>
<NoticeItem v-for="(item, index) in noticeList" :key="index" :data="item"></NoticeItem>
</div>
</Scroll>
</div>
</template>
<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions} = createNamespacedHelpers('notice');
import NoticeItem from './noticeItem';
import {
Style,
Scroll,
RecycleList
} from 'cube-ui';
// import { resolve } from 'dns';
export default {
components: {
NoticeItem,
Scroll,
RecycleList,
Style
},
name: 'NoticeListPage',
data(){
return {
data: {},
noMore: false,
scrolling: false,
};
},
created(){
this.fetchNoticeList();
},
// activated(){
// this.fetchList();
// },
// async serverPrefetch(){
// this.fetchNoticeList();
// },
mounted(){
// this.fetchNoticeList();
},
computed: {
...mapState(['noticeList','fetchNoticePage']),
},
methods:{
...mapActions(['fetchNoticeList']),
onScroll(){
this.scrolling = true;
this._scTimer && clearTimeout(this._scTimer);
this._scTimer = setTimeout(() => {
this.scrolling = false;
}, 400);
},
fetchList() {
if (this.noMore) {
return;
}
this.fetchNoticeList({}).then(res => {
if (+this.fetchNoticePage > +get(res, 'data.totalPage')) {
this.noMore = true;
}
this.$nextTick(() => {
this.$refs.scroll.forceUpdate(true);
});
});
}
},
onFetch(){
let items = []
return new Promise((resolve) => {
setTimeout(() => {
for(let i = 0; i < 50; i++){
items.push({
id:i,
contents:'【税率调整】您的商品AIR JORDAN 4 RESET PUSH NONEKJG 2017已经被用户下单,请及时发货'+i,
time:'2018.08.08 17:20'
})
}
resolve(items)
}, 1000)
})
}
}
</script>
<style>
.list{
height: 100%;
width: 100%;
}
.content-root{
height: 100%;
width: 100%;
}
</style>
\ No newline at end of file
... ...
<template>
<div class="notice-root">
<p class="notice-content">【税率调整】您的商品AIR JORDAN 4 RESET PUSH NONEKJG 2017已经被用户下单,请及时发货</p>
<div class="time">
<time> 2018.08.08 17:20</time>
</div>
</div>
</template>
<script>
// export default {
// data(){
// },
// props:[
// ]
// };
// methods: {
// onGo()
// };
</script>
<style>
.notice-root{
margin-left: 40px;
margin-right: 40px;
}
.notice-content{
font-family: 'PingFang-SC-Regular';
font-size: 28px;
color: #000000;
}
.time {
font-size: 28px;
color: #999999;
}
</style>
\ No newline at end of file
... ...
<template>
<LayoutApp :show-back="true">
<div class="body" ref="body">
<List>
</List>
</div>
</LayoutApp>
</template>
<script>
import List from './components/list';
export default {
components: {
List
}
};
</script>
<style>
.body {
height: 100%;
overflow-y: auto;
}
</style>
\ No newline at end of file
... ...
<template>
<div class="agree">
我已阅读并同意 <span class="link">有货卖家协议</span>
<div class="agree" @click="onClick">
<i :class="getClass"></i> 我已阅读并同意 <span class="link">有货卖家协议</span>
</div>
</template>
<script>
export default {
name: 'OrderCheck'
name: 'OrderCheck',
props: {
value: {
type: Boolean,
default: true
}
},
data() {
return {
val: this.value
};
},
computed: {
getClass() {
return {
iconfont: true,
iconcheck_default: !this.val,
iconcheck_full: this.val,
icon_color: this.val
};
}
},
watch: {
value(newVal) {
this.val = newVal;
}
},
methods: {
onClick() {
this.val = !this.val;
this.$emit('input', this.val);
}
}
};
</script>
... ... @@ -18,5 +52,11 @@ export default {
.link {
color: #65ab85;
text-decoration: underline;
text-decoration-color: #65ab85;
}
.icon_color {
color: #002B47;
}
</style>
... ...
... ... @@ -7,7 +7,7 @@
<OrderMargin class="order-item order-margin"></OrderMargin>
<OrderFee class="order-item"></OrderFee>
<AddressInfo class="order-item"></AddressInfo>
<OrderAgree class="order-item"></OrderAgree>
<OrderAgree v-model="agree" class="order-item"></OrderAgree>
</div>
<ConfirmButton :txt="txt" class="footer"></ConfirmButton>
</LayoutApp>
... ... @@ -38,7 +38,8 @@ export default {
},
data() {
return {
txt: '提交'
txt: '提交',
agree: false
};
}
};
... ...
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1569294019297'); /* IE9 */
src: url('iconfont.eot?t=1569294019297#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('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sn8cqaglxBQa9et+/cvsUMDVoY5HnYBED0WB9qdwB9wamPAtEnek5rWx+pyPYAwCNyFKJtWkrjf8PzUCK/YzG9eJe/bGEDwAfPXXqKsSjw2KwZLA5srPzTBWNV+fDVC/Xa6ZuZnk65UhfVaPIOMYRPX1z4+mwUEhGIKFKKTw9rKrtxDgRbUA7BIUZVUCx1MIbQBFwK0wY8LN2hEI3pf3dhSrMKRYwPNGIbgFCC58ChGA9BKcErGEP4BFzK8RN4lBCFQoyT0o8sTL11snB3ZFSCFvQfGkOjk27Z+fYbVrFXnFc7xgs5NGko0rxcvuKIfIgrwqcqRRw4pgEu8DbsewLP1KKRtBbxhyxzTV+UGhomO46MStAC+g80hkZnlsuu8v03rGKvuGPuXPyFHJr1gYKUfAPM1TBuNPdStodPVSLi+JhjGoAL+rAXBQJ8874WjaTUO+T8gYwWuU0N6elNw3u9AhRi/URfHFEx4oonMbHiSyEWCx//02bRLy19x3HZJMra7TtikBe0odit6GNIhmY0uxdamW6pmOk7mQA=') format('woff2'),
url('iconfont.woff?t=1569294019297') format('woff'),
url('iconfont.ttf?t=1569294019297') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1569294019297#iconfont') format('svg'); /* iOS 4.1- */
src: url('iconfont.eot?t=1569393439353'); /* IE9 */
src: url('iconfont.eot?t=1569393439353#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAaoAAsAAAAADawAAAZZAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCEbgqLcIlaATYCJAM8CyAABCAFhG0HgSkbqwtRlFBONtmXkJMNPaIxqz3OKFeUHsAFAGC1gAgAAADwA0QAFxA8T2vt/dEVwzS5NryTCIVKiWapEmkejy2NmRLvf+cSkPJ8eyRPjUihXemnzQX383MgR05PqQm5Cbeff8/3pDfPcvsA/ylDujndXDxqktKpHYSHEOTt8KOoUco2mxyEJEZFmgOeF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LlVcbZRgWLysuNQgOWl98PTW1iGyBflZFvUFadPPRJCZQ+DelrwLWO2enZ2cjIQ4cPHQRm4br6jfpH0Y5373agG60IKECR42CjE9Ewz6ukzGs+RGv3OmYkJ3PSaRAdTCspS1omel0mq6kJy8AyJVnbxpiJZVwr1vaAcYxKLDtWJdqYkGFFR4Pv1zqpRXS0plRTpFrgRh5awiEvRami15BUPwau0MptB/a360HpitFhhC7/aT1soN+2MUziUZxQHuWNqphop5eR1Mhrp8Sn74826kabDfXbaMrBOg0y6HB7KEWkOw7se2DhDABgTjmBwgAA0C6WnQ7FSIwiq+Snm0NRaSct6sIBAGAFrAeAWUoTcR0zaRCRASLvUJ3qtTVo/2evB9nKpR0lasG/5JV+7Use7HI2W1QwpGYOmulCQqGw/X9c1PZ9cJ0nJ8mq4+Al08qdwWmBcE0PoXZqHP+FdDJaCl0s7fXXnRgozPnfigEPFG8CtMSUzKiWwMptgZPYh8yiy4NzfdAoiRRY8OWAaHyDUvkArfEjM6pfsAb9g9Mchcx5Wj1mbqaYOUVICQqWDZjIreEsh2ZMz3sog0rR79SmZ0Avaliz1gi3XIIBbGIH3y1bRJxxtJpdOBcDpSxzaDuQU60icu16nSfdoJZbPTTjGAIpAgpMZiDjCjnL4IuTmcjr3wOlQElhxoTHuM8A8oT/TFNNo4DskptCEw6lv9dVaiHM5xgfjiyNucB8oGijxbjktTpAjtRUFeqdtjouxIvyWvdCP+6ch29S8gJ1UqLFiBUnXhJJJZNcCimlkloaY+te3HgkuPHC9owZF3FaFGMKOI2jKCuafg3g6cYt05xxKvhYCyPbjWVpLidz9UHwfj6vIBD3pQCeBkXj0kx0VR6UGk8RbW9oCAAA') format('woff2'),
url('iconfont.woff?t=1569393439353') format('woff'),
url('iconfont.ttf?t=1569393439353') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1569393439353#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
... ... @@ -31,6 +31,14 @@
content: "\e618";
}
.iconleft:before {
content: "\e617";
}
.iconright:before {
content: "\e638";
}
.iconquestion1:before {
content: "\e630";
}
... ... @@ -43,6 +51,22 @@
content: "\e763";
}
.iconaddress:before {
content: "\e634";
}
.iconcheck_default:before {
content: "\e7cc";
}
.iconcheck:before {
content: "\e7cd";
}
.iconcheck_full:before {
content: "\e7ce";
}
.iconarrow:before {
content: "\e7c4";
}
... ...
... ... @@ -32,6 +32,12 @@ Created by iconfont
<glyph glyph-name="i-add" unicode="&#58904;" d="M910.509 405.585h-378.843v376.925c0 11.2-9.427 20.281-20.626 20.281s-20.626-9.080-20.626-20.281v-376.925h-376.925c-11.2 0-20.281-9.426-20.281-20.626s9.080-20.626 20.281-20.626h376.925v-378.844c0-11.199 9.427-20.281 20.626-20.281s20.626 9.081 20.626 20.281v378.844h378.843c11.199 0 20.281 9.426 20.281 20.626s-9.081 20.626-20.281 20.626z" horiz-adv-x="1024" />
<glyph glyph-name="left" unicode="&#58903;" d="M709.254038-61.195501c-15.286148 0-29.522384 5.878894-40.166815 16.564257L279.38971 345.759047c-1.425466 1.39272-2.537799 2.577708-3.449565 3.846608l-2.304486 2.905166c-11.362792 11.416004-16.945951 24.848944-16.945951 39.068807 0 14.475689 5.708002 28.010961 16.056698 38.110993l392.376529 388.216789c10.612709 10.467399 24.785499 16.236799 39.892569 16.236799 14.772448 0 28.726252-5.599532 39.287795-15.753799 10.497075-10.18599 16.538675-24.390503 16.538675-38.95215 0-14.382569-5.722328-28.009937-16.142655-38.366819L390.732587 390.901177 749.217215 31.473061c10.249435-10.30981 15.909341-23.781636 15.909341-37.994336 0-14.889105-6.05081-28.859281-16.999163-39.333844C737.70809-55.744349 723.878107-61.195501 709.254038-61.195501z" horiz-adv-x="1024" />
<glyph glyph-name="right" unicode="&#58936;" d="M312.56325 834.14421c15.286148 0 29.522384-5.878894 40.166815-16.564257l389.69649-390.391315c1.425466-1.39272 2.537799-2.577708 3.449565-3.846608l2.304486-2.905166c11.362792-11.416004 16.945951-24.848944 16.945951-39.068807 0-14.475689-5.708002-28.010961-16.056698-38.110993L356.692307-44.958702c-10.612709-10.467399-24.785499-16.236799-39.892569-16.236799-14.772448 0-28.726252 5.599532-39.287795 15.753799-10.497075 10.18599-16.538675 24.390503-16.538675 38.95215 0 14.382569 5.722328 28.009937 16.142655 38.366819l353.968777 350.170265L272.59905 741.475648c-10.249435 10.30981-15.909341 23.781636-15.909341 37.994336 0 14.889105 6.051833 28.859281 17.000186 39.333844C284.109198 828.693058 297.939181 834.14421 312.56325 834.14421z" horiz-adv-x="1024" />
<glyph glyph-name="question1" unicode="&#58928;" d="M463.99957 111.647789c0-26.509985 21.490445-48.00043 48.00043-48.00043s48.00043 21.490445 48.00043 48.00043c0 26.509985-21.490445 48.00043-48.00043 48.00043S463.99957 138.157774 463.99957 111.647789zM512-64c-247.039484 0-448 200.960516-448 448S264.960516 832 512 832 960 631.039484 960 384 759.039484-64 512-64zM512 767.712727c-211.584464 0-383.712727-172.128262-383.712727-383.712727 0-211.551781 172.128262-383.712727 383.712727-383.712727 211.551781 0 383.712727 172.159226 383.712727 383.712727C895.712727 595.584464 723.551781 767.712727 512 767.712727zM512 222.304744c-17.664722 0-32.00086 14.336138-32.00086 31.99914l0 54.112297c0 52.352533 39.999785 92.352318 75.32751 127.647359 25.887273 25.919957 52.67249 52.67249 52.67249 74.016718 0 53.343368-43.07206 96.735385-95.99914 96.735385-53.823303 0-95.99914-41.535923-95.99914-94.559333 0-17.664722-14.336138-31.99914-32.00086-31.99914s-32.00086 14.336138-32.00086 31.99914c0 87.423948 71.775299 158.559333 160.00086 158.559333s160.00086-72.095256 160.00086-160.735385c0-47.904099-36.32028-84.191695-71.424378-119.295794-27.839699-27.776052-56.575622-56.511974-56.575622-82.3356l0-54.112297C544.00086 236.671845 529.664722 222.304744 512 222.304744z" horiz-adv-x="1024" />
... ... @@ -41,6 +47,18 @@ Created by iconfont
<glyph glyph-name="back" unicode="&#59235;" d="M718.08-122.464L208 386.016 718.016 896.032l67.36-67.36-442.56-442.56 442.496-441.12-67.264-67.456z" horiz-adv-x="1024" />
<glyph glyph-name="address" unicode="&#58932;" d="M512-128S97.52381 252.586667 97.52381 481.52381a414.47619 414.47619 0 0 0 828.95238 0c0-228.937143-414.47619-609.52381-414.47619-609.52381z m0 950.857143A343.356952 343.356952 0 0 1 170.666667 477.379048C170.666667 286.72 512-30.47619 512-30.47619s341.333333 317.19619 341.333333 507.855238A343.356952 343.356952 0 0 1 512 822.857143z m0-146.285714a195.047619 195.047619 0 1 0-195.047619-195.047619 195.047619 195.047619 0 0 0 195.047619 195.047619z m0-73.142858a121.904762 121.904762 0 1 0-121.904762-121.904761 121.904762 121.904762 0 0 0 121.904762 121.904761z" horiz-adv-x="1024" />
<glyph glyph-name="check_default" unicode="&#59340;" d="M878.545455-104.727273h-733.09091A122.298182 122.298182 0 0 0 23.272727 17.454545v733.09091A122.298182 122.298182 0 0 0 145.454545 872.727273h733.09091A122.298182 122.298182 0 0 0 1000.727273 750.545455v-733.09091A122.298182 122.298182 0 0 0 878.545455-104.727273z m-733.09091 919.272728A64.116364 64.116364 0 0 1 81.454545 750.545455v-733.09091a64.116364 64.116364 0 0 1 64-64h733.09091a64.116364 64.116364 0 0 1 64 64v733.09091A64.116364 64.116364 0 0 1 878.545455 814.545455z" horiz-adv-x="1024" />
<glyph glyph-name="check" unicode="&#59341;" d="M459.985455 214.690909a28.974545 28.974545 0 0 0-20.48 8.494546L256 406.109091a29.090909 29.090909 0 0 0 40.96 41.309091l163.607273-162.909091L721.454545 544.814545a29.090909 29.090909 0 1 0 40.96-41.30909L480.465455 223.185455a28.974545 28.974545 0 0 0-20.48-8.494546zM875.636364-104.727273h-733.090909a122.298182 122.298182 0 0 0-122.181819 122.181818v733.09091A122.298182 122.298182 0 0 0 142.545455 872.727273h733.090909a122.298182 122.298182 0 0 0 122.181818-122.181818v-733.09091A122.298182 122.298182 0 0 0 875.636364-104.727273z m-733.090909 919.272728a64.116364 64.116364 0 0 1-64-64v-733.09091a64.116364 64.116364 0 0 1 64-64h733.090909a64.116364 64.116364 0 0 1 64 64v733.09091a64.116364 64.116364 0 0 1-64 64z" horiz-adv-x="1024" />
<glyph glyph-name="check_full" unicode="&#59342;" d="M878.545455 872.727273h-733.09091A122.298182 122.298182 0 0 1 23.272727 750.545455v-733.09091A122.298182 122.298182 0 0 1 145.454545-104.727273h733.09091A122.298182 122.298182 0 0 1 1000.727273 17.454545v733.09091A122.298182 122.298182 0 0 1 878.545455 872.727273z m-112.872728-369.105455l-282.181818-280.436363a29.090909 29.090909 0 0 0-40.96 0L258.327273 406.109091a29.090909 29.090909 0 0 0 40.96 41.309091l163.607272-162.909091 261.701819 260.305454a29.090909 29.090909 0 1 0 40.96-41.30909z" horiz-adv-x="1024" />
<glyph glyph-name="arrow" unicode="&#59332;" d="M1536 896L768-128 0 896z" horiz-adv-x="1536" />
... ...
import * as Types from './types'
import * as Types from './types';
import { get } from 'lodash';
export default {
async fetchTopicList({ commit, state }, { page, limit }) {
if (state.fetchTopicList) {
return {};
}
page = page || state.fetchTopicPage || 1;
commit(Types.FETCH_NOTICE_LIST_REQUEST, { page });
const result = await this.$api.post('/api/grass/getGrassTopicList', {
page,
limit: limit || 10,
filter: 'Y',
lastedTime: state.fetchTopicLastedTime || void 0
});
if (result && result.code === 200) {
commit(Types.FETCH_NOTICE_LIST_SUCCESS, {
data: result.data,
page
});
} else {
commit(Types.FETCH_NOTICE_LIST_FAILD);
}
return result;
},
}
\ No newline at end of file
async fetchTopicList({ commit, state }, { page, limit }) {
if (state.fetchTopicList) {
return {};
}
page = page || state.fetchTopicPage || 1;
commit(Types.FETCH_NOTICE_LIST_REQUEST, { page });
const result = await this.$api.post('/api/grass/getGrassTopicList', {
page,
limit: limit || 10,
filter: 'Y',
lastedTime: state.fetchTopicLastedTime || void 0
});
if (result && result.code === 200) {
commit(Types.FETCH_NOTICE_LIST_SUCCESS, {
data: result.data,
page
});
} else {
commit(Types.FETCH_NOTICE_LIST_FAILD);
}
return result;
},
};
... ...
... ... @@ -17,4 +17,4 @@ export default function() {
mine: mine()
}
};
}
}
\ No newline at end of file
... ...
... ... @@ -5,8 +5,10 @@ import storeYoho from './yoho';
import storeOrder from './order';
import storeList from './list';
import storeProduct from './product';
import storeHome from './home';
// import storeHome from './home';
import storeAddress from './address';
import storeNotice from './notice';
Vue.use(Vuex);
... ... @@ -18,10 +20,12 @@ export function createStore(context) {
order: storeOrder(),
list: storeList(),
produt: storeProduct(),
home: storeHome(),
// home: storeHome(),
address: storeAddress(),
// notice: storeNotice()
// 买家订单列表
notice: storeNotice(),
},
strict: process.env.NODE_ENV !== 'production',
... ...
import * as Types from './types'
import { get } from 'lodash';
export default {
async fetchNoticeList({ commit, state }) {
console.log("==="+state.fetchNoticeList)
if (state.fetchNoticeList) {
return {};
}
let page = state.fetchNoticePage || 1;
console.log("page:"+page)
commit(Types.FETCH_NOTICE_LIST_REQUEST, { page });
const result = await this.$api.post('/api/ufo/mine/orderSummary', {
// page,
// limit: 10,
// filter: 'Y',
// debug: 'XYZ',
lastedTime: state.fetchNoticeLastedTime || void 0
});
console.log(result)
if (result && result.code === 200) {
commit(Types.FETCH_NOTICE_LIST_SUCCESS, {
data: result.data,
page
});
} else {
commit(Types.FETCH_NOTICE_LIST_FAILD);
}
return result;
},
}
\ No newline at end of file
... ...
import actions from './actions';
import mutations from './mutations';
export default function() {
return {
namespaced: true,
state: {
fetchNoticeList:false,
noticeList:[],
fetchNoticePage: 1,
fetchNoticeLastedTime: 0,
},
actions,
mutations,
modules: {
}
};
}
... ...
import * as Types from './types';
export default {
[Types.FETCH_NOTICE_LIST_REQUEST](state, { page }) {
console.log("page:"+page+"==="+state.fetchNoticeList)
state.fetchNoticeList = false;
if (page === 1) {
state.fetchNoticeLastedTime = 0;
state.fetchNoticePage = 1;
// state.noticeList.length = 0;
}
},
[Types.FETCH_NOTICE_LIST_SUCCESS](state, { data }) {
state.fetchNoticeList = false;
state.fetchNoticePage += 1;
state.fetchNoticeLastedTime = data.lastedTime;
const noticeList = data.noticeList || [];
if (noticeList.length) {
noticeList.forEach(val => {
// if (/imageView/.test(val.topicImageUrl) && !/format/.test(val.topicImageUrl)) {
// val.topicImageUrl += '/format/jpg';
// }
state.noticeList.push(val);
if (!state.noticeInfo[val.id]) {
state.noticeInfo[val.id] = {
//根据接口key 修改
topicId: val.id,
topicName: val.topicName,
topicImageUrl: val.topicImageUrl,
topicDesc: val.topicDesc
};
}
});
}
},
[Types.FETCH_NOTICE_LIST_FAILD](state) {
state.fetchNoticeList = false;
},
}
\ No newline at end of file
... ...
export const FETCH_NOTICE_LIST_REQUEST = 'FETCH_NOTICE_LIST_REQUEST';
export const FETCH_NOTICE_LIST_FAILD = 'FETCH_NOTICE_LIST_FAILD';
export const FETCH_NOTICE_LIST_SUCCESS = 'FETCH_NOTICE_LIST_SUCCESS';
\ No newline at end of file
... ...
export const Types = {
FETCH_ORDER_DETAIL_REQUEST: 'FETCH_ORDER_DETAIL_REQUEST',
FETCH_ORDER_DETAIL_FAIL: 'FETCH_ORDER_DETAIL_FAIL',
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS'
};
export default function() {
return {
namespaced: true,
state: {
orderDetail: {},
fetchOrderDetail: false
},
mutations: {
[Types.FETCH_ORDER_DETAIL_REQUEST](state) {
state.fetchOrderDetail = true;
},
[Types.FETCH_ORDER_DETAIL_SUCCESS](state, data) {
state.fetchOrderDetail = false;
state.orderDetail = data;
},
[Types.FETCH_ORDER_DETAIL_FAIL](state) {
state.fetchOrderDetail = false;
}
},
actions: {
async fetchOrderDetail({ commit }, { tabType = 'sell', orderCode } = {}) {
commit(Types.FETCH_ORDER_DETAIL_REQUEST);
const result = await this.$api.post('', {
tabType,
orderCode: orderCode
});
if (result.code !== 200) {
commit(Types.FETCH_ORDER_DETAIL_FAIL);
return;
}
commit(Types.FETCH_ORDER_DETAIL_SUCCESS, result.data);
}
},
getters: {},
};
}
... ...
... ... @@ -97,9 +97,7 @@ module.exports = {
jsSdk: '//cdn.yoho.cn/js-sdk/1.3.10/jssdk.js',
redis: {
connect: {
host: '192.168.102.49',
// host: '127.0.0.1',
host: '192.168.104.201',
port: '6379',
enable_offline_queue: false,
retry_strategy(options) {
... ... @@ -117,9 +115,8 @@ module.exports = {
}
},
session: {
host: '127.0.0.1',
host: '192.168.104.201',
port: '6379',
pass: '',
prefix: 'yohobuy_session:'
}
},
... ... @@ -272,7 +269,7 @@ if (isProduction) {
}
},
console: {
close: true,
close: false,
level: 'info',
colorize: 'all',
prettyPrint: true,
... ...
... ... @@ -24,4 +24,14 @@ module.exports = {
api: 'ufo.asssets.details',
params: {}
},
'/api/ufo/home/noticelist':{
ufo: true,
api: 'ufo.users.noticeList',
params:{}
},
'/api/ufo/home/favoriteProduct':{
ufo: true,
api: 'ufo.user.favoriteList',
params:{}
}
};
... ...
/**
* param 仅为参数校验使用
*/
module.exports = {
'/api/ufo/invite/friendList': {
ufo: true,
api: 'ufo.invite.code',
params: {},
},
'/api/ufo/invite/recordDetailList': {
ufo: true,
api: 'ufo.invite.getInviteSettlementItemList',
params: {},
},
'/api/yoho/resource': {
service: true,
api: 'operations/api/v5/resource/get',
params: {
content_code: { type: String },
},
},
'/api/union/inviteList': {
api: 'app.union.shareOrder.queryInviteYohoList',
params: {
page: { type: Number },
size: { type: Number },
},
},
'/api/union/queryUnion': {
api: 'app.union.shareOrder.queryUnionTypeByUid',
params: {},
},
'/api/ufo/seller/entryGoodsSizeList': {
accessLog: true,
checkSign: false,
ufo: true,
api: 'ufo.seller.entryGoodsSizeList',
params: {
productId: { type: Number },
limit: { type: Number },
page: { type: Number },
},
},
};
module.exports = {};
... ...
const serviceApi = global.yoho.ServiceAPI;
const ufoAPI = global.yoho.UfoAPI;
const logger = global.yoho.logger;
const _ = require('lodash');
const md5 = require('yoho-md5');
const checkParams = require('../../utils/check-params');
const handleResult = require('../../utils/handle-result');
const apiMaps = require('../../config/api-map');
function checkSign(params, sign) {
delete params.s;
const sortKeys = Object.keys(params).sort();
const str = sortKeys.map(key => {
return `${key}:${encodeURIComponent(params[key])}`;
}).join('_');
const signDiff = md5(`${str}_${str.length}`);
if (sign === signDiff) {
return true;
}
logger.error(`验签不匹配: 提交sign: ${sign}, 服务端sign: ${signDiff}, params: ${JSON.stringify(params)}`);
return false;
}
const errorHandler = require('./error-handler');
module.exports = async(req, res, next) => {
const apiInfo = apiMaps[req.path];
if (!apiInfo) {
return next();
}
let baseParams;
let reqParams = Object.assign({}, req.query, req.body);
req.route = {
path: req.path
};
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
});
const apiInfo = apiMaps[req.path];
if (apiInfo.checkSign) {
if (!checkSign(Object.assign({}, reqParams), reqParams.s)) {
logger.error(`验签失败!uid: ${_.get(req, 'user.uid', '').toString()}, params: ${JSON.stringify(reqParams)}, ip: ${req.yoho.clientIp}`);
return res.json({
code: 400,
message: '验签失败'
});
}
if (!apiInfo) {
return next();
}
const baseParams = {};
delete reqParams.s;
delete reqParams.ts;
req.route = {
path: req.path
};
if (!apiInfo.service) {
baseParams = {
uid: (req.user && req.user.uid) ? {
baseParams.method = apiInfo.api;
}
if (apiInfo.auth) {
if (req.user && req.user.uid) {
baseParams.uid = {
toString: () => {
return req.user.uid || 0;
return req.user.uid;
},
sessionKey: req.user.sessionKey,
appSessionType: req.user.appSessionType
} : 1,
method: apiInfo.api
};
};
}
}
try {
const mergeParams = Object.assign(reqParams, baseParams);
const params = checkParams.getParams(mergeParams, apiInfo);
const cache = req.method.toLowerCase() !== 'get' ? false : apiInfo.cache;
const reqParams = Object.assign({}, req.query, req.body, baseParams);
const params = checkParams.getParams(reqParams, apiInfo, req);
const cache = (req.method.toLowerCase() !== 'get' || apiInfo.auth) ? false : apiInfo.cache;
let method = req.method.toLowerCase() === 'post' ? 'post' : 'get';
let result;
... ... @@ -80,7 +51,7 @@ module.exports = async(req, res, next) => {
if (apiInfo.service) {
result = await apiCtx.get({
api: serviceApi,
url: apiInfo.api,
url: `${apiInfo.api || ''}${apiInfo.path || ''}`,
data: params,
param: {
cache: cache,
... ... @@ -105,16 +76,12 @@ module.exports = async(req, res, next) => {
});
}
if (result) {
return res.json(result);
return res.json(handleResult(result, apiInfo));
}
return res.json({
code: 400
});
} catch (error) {
logger.error(error);
return res.json({
code: error.code || 500,
message: error.message || '服务器错误'
});
return errorHandler.serverError(error, req, res, next);
}
};
... ...
const _ = require('lodash');
module.exports = (result, apiInfo) => {
if (result.code === 200 && _.isObject(apiInfo.fields)) {
let resData = result.data || {};
let data = {};
_.forEach(apiInfo.fields, (v, k) => {
if (!_.has(resData, k) && _.has(v, 'default')) {
data[k] = v.default;
} else {
data[k] = resData[k];
}
});
result.data = data;
}
return result;
};
... ...
This diff could not be displayed because it is too large.