Authored by htoooth

add article content

Showing 21 changed files with 97 additions and 111 deletions
@@ -97,7 +97,7 @@ export default { @@ -97,7 +97,7 @@ export default {
97 }, 97 },
98 onExpand() { 98 onExpand() {
99 if (this.data.articleType === 2) { 99 if (this.data.articleType === 2) {
100 - // do popup 100 + this.$emit('on-expand');
101 return; 101 return;
102 } 102 }
103 if (!this.isEllipsis) { 103 if (!this.isEllipsis) {
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <ArticleItemHeader :data="headerData" :lazy="lazy" @on-follow="onFollow"></ArticleItemHeader> 3 <ArticleItemHeader :data="headerData" :lazy="lazy" @on-follow="onFollow"></ArticleItemHeader>
4 <ArticleItemSlide :data="slideData" :lazy="lazy"></ArticleItemSlide> 4 <ArticleItemSlide :data="slideData" :lazy="lazy"></ArticleItemSlide>
5 <ProductGroup v-if="productListData.length" :data="productListData" :lazy="lazy"></ProductGroup> 5 <ProductGroup v-if="productListData.length" :data="productListData" :lazy="lazy"></ProductGroup>
6 - <ArticleItemIntro :data="introData" @on-resize="onResize" @on-resizeing="onResizeing"></ArticleItemIntro> 6 + <ArticleItemIntro :data="introData" @on-resize="onResize" @on-resizeing="onResizeing" @on-expand="onExpand"></ArticleItemIntro>
7 <ArticleItemComment :data="commentData"></ArticleItemComment> 7 <ArticleItemComment :data="commentData"></ArticleItemComment>
8 <div class="line"></div> 8 <div class="line"></div>
9 </div> 9 </div>
@@ -78,6 +78,9 @@ export default { @@ -78,6 +78,9 @@ export default {
78 }, 78 },
79 onFollow(follow) { 79 onFollow(follow) {
80 this.$emit('on-follow', follow); 80 this.$emit('on-follow', follow);
  81 + },
  82 + onExpand() {
  83 + this.$emit('on-expand', {articleId: this.data.relateId, grassId: this.data.articleId});
81 } 84 }
82 }, 85 },
83 components: {ArticleItemHeader, ArticleItemSlide, ArticleItemIntro, ArticleItemComment} 86 components: {ArticleItemHeader, ArticleItemSlide, ArticleItemIntro, ArticleItemComment}
@@ -17,16 +17,20 @@ @@ -17,16 +17,20 @@
17 :data-id="data.articleId" 17 :data-id="data.articleId"
18 @on-resize="onResize(data)" 18 @on-resize="onResize(data)"
19 @on-resizeing="onResizeing(data)" 19 @on-resizeing="onResizeing(data)"
20 - @on-follow="follow => onFollow(data, follow)"></ArticleItem> 20 + @on-follow="follow => onFollow(data, follow)"
  21 + @on-expand="onExpand"></ArticleItem>
21 <div :id="`ph${data.index}`"></div> 22 <div :id="`ph${data.index}`"></div>
22 </template> 23 </template>
23 </LayoutRecycleList> 24 </LayoutRecycleList>
24 <slot name="thumb" v-else></slot> 25 <slot name="thumb" v-else></slot>
  26 +
  27 + <ArticleActionSheet ref="actionSheet"></ArticleActionSheet>
25 </Layout> 28 </Layout>
26 </template> 29 </template>
27 30
28 <script> 31 <script>
29 import ArticleItem from './article-item'; 32 import ArticleItem from './article-item';
  33 +import ArticleActionSheet from '../detail/article-action-sheet';
30 34
31 export default { 35 export default {
32 name: 'Article', 36 name: 'Article',
@@ -117,10 +121,14 @@ export default { @@ -117,10 +121,14 @@ export default {
117 if (data.authorUid === this.currentAuthor.authorUid) { 121 if (data.authorUid === this.currentAuthor.authorUid) {
118 this.currentAuthor.hasAttention = follow ? 'Y' : 'N'; 122 this.currentAuthor.hasAttention = follow ? 'Y' : 'N';
119 } 123 }
  124 + },
  125 + onExpand(params) {
  126 + this.$refs.actionSheet.show(params);
120 } 127 }
121 }, 128 },
122 components: { 129 components: {
123 - ArticleItem 130 + ArticleItem,
  131 + ArticleActionSheet
124 } 132 }
125 }; 133 };
126 </script> 134 </script>
  1 +<template>
  2 + <YohoActionSheet ref="actionSheet" :full="true">
  3 + <ArticleDetail ref="detail" @on-close="onClose"></ArticleDetail>
  4 + </YohoActionSheet>
  5 +</template>
  6 +
  7 +
  8 +<script>
  9 +
  10 +import ArticleDetail from './article-detail';
  11 +
  12 +export default {
  13 + name: 'ArticleActionSheetPage',
  14 + components: {
  15 + ArticleDetail
  16 + },
  17 + data() {
  18 + return {};
  19 + },
  20 + methods: {
  21 + async show(params) {
  22 + await this.$refs.detail.fetch(params);
  23 + this.$refs.actionSheet.show();
  24 + },
  25 + hide() {
  26 + this.$refs.actionSheet.hide();
  27 + },
  28 + onClose() {
  29 + this.hide();
  30 + }
  31 + }
  32 +};
  33 +</script>
  34 +
  35 +
  36 +<style scoped lang="scss">
  37 +.content {
  38 + width: 100%;
  39 + height: 100vh;
  40 + background-color: white;
  41 +}
  42 +</style>
@@ -13,7 +13,7 @@ export default { @@ -13,7 +13,7 @@ export default {
13 name: 'ArticleBar', 13 name: 'ArticleBar',
14 methods: { 14 methods: {
15 close() { 15 close() {
16 - 16 + this.$emit('on-close');
17 } 17 }
18 }, 18 },
19 }; 19 };
1 <template> 1 <template>
2 - <Scroll class="scroll-wrapper" :options="scrollOpts"> 2 + <div class="scroll-wrapper">
3 <Author v-if="articleDetail" :data="articleDetail.getAuthor"></Author> 3 <Author v-if="articleDetail" :data="articleDetail.getAuthor"></Author>
4 4
5 <div class="post-content" v-if="articleDetail"> 5 <div class="post-content" v-if="articleDetail">
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
29 <template v-if="item.relatedReco"> 29 <template v-if="item.relatedReco">
30 <div class="products"> 30 <div class="products">
31 <ProductItem class="product-item" v-for="p in item.relatedReco.goods" :src="p.default_images" :price="p.sales_price" :name="p.product_name"></ProductItem> 31 <ProductItem class="product-item" v-for="p in item.relatedReco.goods" :src="p.default_images" :price="p.sales_price" :name="p.product_name"></ProductItem>
  32 +
  33 + <!--<ProductGroup v-for="p in item.relatedReco.goods" :data="[p]"></ProductGroup>-->
32 </div> 34 </div>
33 </template> 35 </template>
34 </template> 36 </template>
@@ -40,7 +42,7 @@ @@ -40,7 +42,7 @@
40 <Recommend v-if="articleDetail && articleDetail.getRecommendProducts.length > 0"> 42 <Recommend v-if="articleDetail && articleDetail.getRecommendProducts.length > 0">
41 <RecommendProductList :list="articleDetail.getRecommendProducts"></RecommendProductList> 43 <RecommendProductList :list="articleDetail.getRecommendProducts"></RecommendProductList>
42 </Recommend> 44 </Recommend>
43 - </Scroll> 45 + </div>
44 </template> 46 </template>
45 47
46 <script> 48 <script>
@@ -83,13 +85,18 @@ export default { @@ -83,13 +85,18 @@ export default {
83 </script> 85 </script>
84 86
85 <style lang="scss" scoped> 87 <style lang="scss" scoped>
  88 +
  89 +@mixin paddingLR {
  90 + padding-left: 30px;
  91 + padding-right: 30px;
  92 +}
  93 +
86 .scroll-wrapper { 94 .scroll-wrapper {
87 background-color: white; 95 background-color: white;
88 } 96 }
89 97
90 .post-content { 98 .post-content {
91 - padding-left: 30px;  
92 - padding-right: 30px; 99 + @include paddingLR;
93 padding-top: 26px; 100 padding-top: 26px;
94 101
95 /deep/ .normal { 102 /deep/ .normal {
1 <template> 1 <template>
2 <div class="article"> 2 <div class="article">
3 - <ArticleBar class="header"></ArticleBar> 3 + <ArticleBar class="header" @on-close="onClose"></ArticleBar>
4 4
5 - <ArticleBody class="body"></ArticleBody> 5 + <ArticleBody ref="body" class="body"></ArticleBody>
6 6
7 <ArticleFooter class="footer" 7 <ArticleFooter class="footer"
8 v-if="articleDetail" 8 v-if="articleDetail"
9 v-bind="articleDetail.footer" 9 v-bind="articleDetail.footer"
10 - @on-comment-click="onCommentClick"> 10 + @on-comment-click="onCommentClick"
  11 + @on-close="onClose">
11 </ArticleFooter> 12 </ArticleFooter>
12 13
13 <CommentActionSheet ref="actionSheet"></CommentActionSheet> 14 <CommentActionSheet ref="actionSheet"></CommentActionSheet>
@@ -16,10 +17,10 @@ @@ -16,10 +17,10 @@
16 17
17 <script> 18 <script>
18 19
19 -import ArticleBar from './components2/article-bar';  
20 -import ArticleFooter from './components2/article-footer';  
21 -import ArticleBody from './components2/article-body';  
22 -import CommentActionSheet from './components/comment-action-sheet'; 20 +import ArticleBar from './article-bar';
  21 +import ArticleFooter from './article-footer';
  22 +import ArticleBody from './article-body';
  23 +import CommentActionSheet from './comment-action-sheet';
23 import { createNamespacedHelpers } from 'vuex'; 24 import { createNamespacedHelpers } from 'vuex';
24 25
25 const { mapActions, mapState } = createNamespacedHelpers('article'); 26 const { mapActions, mapState } = createNamespacedHelpers('article');
@@ -52,16 +53,21 @@ export default { @@ -52,16 +53,21 @@ export default {
52 }; 53 };
53 }, 54 },
54 mounted() { 55 mounted() {
55 - this.getDetail({  
56 - article_id: this.articleId,  
57 - grass_id: this.grassId  
58 - });  
59 }, 56 },
60 methods: { 57 methods: {
61 onCommentClick() { 58 onCommentClick() {
62 this.$refs.actionSheet.click(); 59 this.$refs.actionSheet.click();
63 }, 60 },
64 - ...mapActions(['getDetail']) 61 + ...mapActions(['getDetail']),
  62 + fetch(params) {
  63 + return this.getDetail({
  64 + article_id: params.articleId,
  65 + grass_id: params.grassId
  66 + });
  67 + },
  68 + onClose() {
  69 + this.$emit('on-close');
  70 + }
65 }, 71 },
66 computed: { 72 computed: {
67 ...mapState(['articleDetail']) 73 ...mapState(['articleDetail'])
@@ -83,6 +89,8 @@ export default { @@ -83,6 +89,8 @@ export default {
83 89
84 .body { 90 .body {
85 flex: 1; 91 flex: 1;
  92 + overflow: auto;
  93 + -webkit-overflow-scrolling: touch;
86 } 94 }
87 95
88 .footer { 96 .footer {
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <WidgetIconBtn class="item" type="star" :text="favoriteCount" :option="option" @click="onFavClick"></WidgetIconBtn> 5 <WidgetIconBtn class="item" type="star" :text="favoriteCount" :option="option" @click="onFavClick"></WidgetIconBtn>
6 <WidgetIconBtn class="item" type="msg" :text="commentCount" :option="option" @click="onComment"></WidgetIconBtn> 6 <WidgetIconBtn class="item" type="msg" :text="commentCount" :option="option" @click="onComment"></WidgetIconBtn>
7 </div> 7 </div>
8 - <div class="close ml20">收起</div> 8 + <div class="close ml20" @click="onClose">收起</div>
9 </div> 9 </div>
10 </template> 10 </template>
11 11
@@ -32,6 +32,9 @@ export default { @@ -32,6 +32,9 @@ export default {
32 }, 32 },
33 onComment() { 33 onComment() {
34 this.$emit('on-comment-click'); 34 this.$emit('on-comment-click');
  35 + },
  36 + onClose() {
  37 + this.$emit('on-close');
35 } 38 }
36 }, 39 },
37 }; 40 };
1 -<template>  
2 - <YohoActionSheet ref="actionSheet" :full="true">  
3 - <div class="content">  
4 - <template v-if="list.length === 0">  
5 - <Loading class="loading" :size="50"></Loading>  
6 - </template>  
7 - <Scroll ref="scroll" :options="scrollOptions">  
8 - <div v-for="i in list" class="item">huangato{{i}}</div>  
9 - </Scroll>  
10 - </div>  
11 - </YohoActionSheet>  
12 -</template>  
13 -  
14 -  
15 -<script>  
16 -import {Scroll, Loading} from 'cube-ui';  
17 -  
18 -export default {  
19 - name: 'ActionSheetPage',  
20 - components: {  
21 - Loading,  
22 - Scroll  
23 - },  
24 - data() {  
25 - return {  
26 - list: [],  
27 - scrollOptions: {  
28 - bounce: false  
29 - }  
30 - };  
31 - },  
32 - methods: {  
33 - click() {  
34 - this.$refs.actionSheet.show();  
35 - setTimeout(() => {  
36 - this.initData();  
37 - this.forceUpdate();  
38 - }, 1000);  
39 - },  
40 - forceUpdate() {  
41 - this.$refs.scroll.forceUpdate();  
42 - },  
43 - initData() {  
44 - for (let i = 0; i < 100; i++) {  
45 - this.list.push(i);  
46 - }  
47 - }  
48 -  
49 - }  
50 -};  
51 -</script>  
52 -  
53 -  
54 -<style>  
55 - .content {  
56 - width: 100%;  
57 - height: 100vh;  
58 - background-color: white;  
59 - }  
60 -  
61 - .item {  
62 - background-color: white;  
63 - }  
64 -  
65 - .loading {  
66 - position: absolute;  
67 - left: 50%;  
68 - top: 50%;  
69 - transform: translate(-50%, -50%);  
70 - }  
71 -  
72 -</style>  
1 -<template>  
2 - <div>  
3 -  
4 - </div>  
5 -</template>  
6 -  
7 -<script>  
8 - export default {  
9 - name: 'TextBody'  
10 - }  
11 -</script>  
12 -  
13 -<style scoped>  
14 -  
15 -</style>  
@@ -3,5 +3,5 @@ export default [{ @@ -3,5 +3,5 @@ export default [{
3 path: '/mapp/showorder/:id', 3 path: '/mapp/showorder/:id',
4 name: 'showorder', 4 name: 'showorder',
5 5
6 - component: () => import(/* webpackChunkName: "order" */ './article-detail') 6 + component: () => import(/* webpackChunkName: "order" */ '../article/components/detail/article-detail')
7 }]; 7 }];
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 25
26 import {Slide} from 'cube-ui'; 26 import {Slide} from 'cube-ui';
27 import OrderSlideItem from './components/order-slide-item'; 27 import OrderSlideItem from './components/order-slide-item';
28 -import CommentActionSheet from './components/comment-action-sheet'; 28 +import CommentActionSheet from '../article/components/detail/comment-action-sheet';
29 29
30 export default { 30 export default {
31 name: 'ShowOrderPage', 31 name: 'ShowOrderPage',
@@ -2060,6 +2060,7 @@ date-now@^0.1.4: @@ -2060,6 +2060,7 @@ date-now@^0.1.4:
2060 dayjs@^1.8.5: 2060 dayjs@^1.8.5:
2061 version "1.8.5" 2061 version "1.8.5"
2062 resolved "http://npm.yohops.com/dayjs/-/dayjs-1.8.5.tgz#0b066770f89a20022218544989f3d23e5e8db29a" 2062 resolved "http://npm.yohops.com/dayjs/-/dayjs-1.8.5.tgz#0b066770f89a20022218544989f3d23e5e8db29a"
  2063 + integrity sha1-CwZncPiaIAIiGFRJifPSPl6Nspo=
2063 2064
2064 de-indent@^1.0.2: 2065 de-indent@^1.0.2:
2065 version "1.0.2" 2066 version "1.0.2"
@@ -4312,6 +4313,7 @@ lodash.debounce@^4.0.8: @@ -4312,6 +4313,7 @@ lodash.debounce@^4.0.8:
4312 lodash.findkey@^4.6.0: 4313 lodash.findkey@^4.6.0:
4313 version "4.6.0" 4314 version "4.6.0"
4314 resolved "http://npm.yohops.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718" 4315 resolved "http://npm.yohops.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718"
  4316 + integrity sha1-gwWOkDtRy7dZ0JzPVG3qPqOcRxg=
4315 4317
4316 lodash.kebabcase@^4.1.1: 4318 lodash.kebabcase@^4.1.1:
4317 version "4.1.1" 4319 version "4.1.1"