Authored by htoooth

add comment list

  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 +
  8 + <CommentScrollView ref="commentList"></CommentScrollView>
  9 + </div>
  10 + </YohoActionSheet>
  11 +</template>
  12 +
  13 +
  14 +<script>
  15 +import {Loading} from 'cube-ui';
  16 +import CommentScrollView from './comment-scroll-view';
  17 +
  18 +export default {
  19 + name: 'CommentActionSheetPage',
  20 + components: {
  21 + Loading,
  22 + CommentScrollView
  23 + },
  24 + data() {
  25 + return {
  26 + };
  27 + },
  28 + methods: {
  29 + click() {
  30 + this.$refs.actionSheet.show();
  31 + this.$refs.commentList.click();
  32 + }
  33 + }
  34 +};
  35 +</script>
  36 +
  37 +<style>
  38 + .content {
  39 + width: 100%;
  40 + height: 80vh;
  41 + background-color: white;
  42 + }
  43 +
  44 + .loading {
  45 + position: absolute;
  46 + left: 50%;
  47 + top: 50%;
  48 + transform: translate(-50%, -50%);
  49 + }
  50 +
  51 +</style>
  1 +<template>
  2 + <div class="comment-scroll-view">
  3 + <div class="header">{{ count }}评论
  4 + </div>
  5 + <Scroll class="scroll-wrapper" ref="scroll" :options="scrollOptions">
  6 + <div v-for="i in list" class="item">huangtao {{i}}</div>
  7 + </Scroll>
  8 + <div class="footer">
  9 + <div class="input">评论</div>
  10 + </div>
  11 + </div>
  12 +</template>
  13 +
  14 +<script>
  15 +
  16 +import {Scroll} from 'cube-ui';
  17 +
  18 +export default {
  19 + name: 'CommentScrollView',
  20 + components: {
  21 + Scroll
  22 + },
  23 + data() {
  24 + return {
  25 + list: [],
  26 + scrollOptions: {
  27 + bounce: false
  28 + }
  29 + };
  30 + },
  31 + computed: {
  32 + count() {
  33 + return this.list.length > 0 ? this.list.length + '条' : '';
  34 + }
  35 + },
  36 + methods: {
  37 + click() {
  38 + this.$nextTick(() => {
  39 + this.initData();
  40 + this.forceUpdate();
  41 + }, 1000);
  42 + },
  43 + forceUpdate() {
  44 + this.$refs.scroll.forceUpdate();
  45 + },
  46 + initData() {
  47 + console.log('click')
  48 + for (let i = 0; i < 100; i++) {
  49 + this.list.push(i);
  50 + }
  51 + }
  52 + }
  53 +};
  54 +
  55 +</script>
  56 +
  57 +<style lang="scss" scoped>
  58 +
  59 +.comment-scroll-view {
  60 + display: flex;
  61 + flex-direction: column;
  62 + width: 100%;
  63 + height: 100%;
  64 +}
  65 +
  66 +.header {
  67 + width: 100%;
  68 + height: 88px;
  69 + border-bottom: 2px solid #e0e0e0;
  70 + text-align: center;
  71 + line-height: 88px;
  72 + font-size: 32px;
  73 +}
  74 +
  75 +.scroll-wrapper {
  76 + flex: 1;
  77 +}
  78 +
  79 +.item {
  80 + background-color: white;
  81 +}
  82 +
  83 +.footer {
  84 + width: 100%;
  85 + height: 100px;
  86 + border-top: 2px solid #e0e0e0;
  87 + display: flex;
  88 + justify-content: center;
  89 + align-items: center;
  90 +}
  91 +
  92 +.input {
  93 + width: 690px;
  94 + height: 72px;
  95 + background-color: #f0f0f0;
  96 + border: 1px solid #e0e0e0;
  97 + border-radius: 8px;
  98 + font-size: 24px;
  99 + color: #b0b0b0;
  100 + padding: 18px 0 18px 22px;
  101 +}
  102 +</style>
@@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
10 <Products></Products> 10 <Products></Products>
11 </div> 11 </div>
12 <div class="share"> 12 <div class="share">
13 - <WidgetIconBtn type="msg"></WidgetIconBtn>  
14 - <WidgetIconBtn type="zan"></WidgetIconBtn> 13 + <WidgetIconBtn class="item" type="msg" text="100" :option="option" @click="onCommentClick"></WidgetIconBtn>
  14 + <WidgetIconBtn class="item" type="fav" text="100" :option="option" @click="onFavClick"></WidgetIconBtn>
15 </div> 15 </div>
16 </div> 16 </div>
17 </div> 17 </div>
@@ -29,13 +29,23 @@ export default { @@ -29,13 +29,23 @@ export default {
29 data() { 29 data() {
30 return { 30 return {
31 text: '很好,能抢到真的不容易!整体感觉很舒服,庆幸下手一定要快准狠!如果能够再抢到一双就更好了,下次加买很多双,很好,能抢到真的不容易!整体感觉很舒服,庆幸下手一定要快准狠!如果能够再抢到一双就更好了,下次加买很多双', 31 text: '很好,能抢到真的不容易!整体感觉很舒服,庆幸下手一定要快准狠!如果能够再抢到一双就更好了,下次加买很多双,很好,能抢到真的不容易!整体感觉很舒服,庆幸下手一定要快准狠!如果能够再抢到一双就更好了,下次加买很多双',
32 - isLimitHeight: true 32 + isLimitHeight: true,
  33 + option: {
  34 + emitName: 'click',
  35 + color: 'white'
  36 + }
33 }; 37 };
34 }, 38 },
35 methods: { 39 methods: {
36 onClick() { 40 onClick() {
37 console.log('展开'); 41 console.log('展开');
38 this.isLimitHeight = false; 42 this.isLimitHeight = false;
  43 + },
  44 + onCommentClick() {
  45 + this.$emit('on-comment-click', {});
  46 + },
  47 + onFavClick() {
  48 + this.$emit('on-favorite-click', {});
39 } 49 }
40 }, 50 },
41 }; 51 };
@@ -58,6 +68,8 @@ export default { @@ -58,6 +68,8 @@ export default {
58 } 68 }
59 69
60 .product-wrapper { 70 .product-wrapper {
  71 + display: flex;
  72 + justify-content: space-between;
61 height: 166px; 73 height: 166px;
62 padding: 0 28px; 74 padding: 0 28px;
63 } 75 }
@@ -72,4 +84,13 @@ export default { @@ -72,4 +84,13 @@ export default {
72 .link { 84 .link {
73 color: #4a90e2; 85 color: #4a90e2;
74 } 86 }
  87 +
  88 +.share {
  89 + height: 100px;
  90 + margin-top: 86px;
  91 +}
  92 +
  93 +.item {
  94 + margin-left: 50px;
  95 +}
75 </style> 96 </style>
1 <template> 1 <template>
2 <div class="order-wrapper"> 2 <div class="order-wrapper">
3 - <!-- <Test class="test"></Test> -->  
4 <Slide :data="list" 3 <Slide :data="list"
5 :loop="false" 4 :loop="false"
6 :autoPlay="false" 5 :autoPlay="false"
@@ -24,7 +23,7 @@ @@ -24,7 +23,7 @@
24 23
25 <AvatarHeader class="avatar-wrapper"></AvatarHeader> 24 <AvatarHeader class="avatar-wrapper"></AvatarHeader>
26 25
27 - <DescFooter class="footer-wrapper"></DescFooter> 26 + <DescFooter class="footer-wrapper" @on-comment-click="onCommentClick"></DescFooter>
28 </div> 27 </div>
29 </template> 28 </template>
30 29
@@ -34,15 +33,13 @@ import {Slide} from 'cube-ui'; @@ -34,15 +33,13 @@ import {Slide} from 'cube-ui';
34 import AvatarHeader from './avatar-header'; 33 import AvatarHeader from './avatar-header';
35 import DescFooter from './desc-footer'; 34 import DescFooter from './desc-footer';
36 35
37 -// const img = require('statics/image/showorder/test.png')  
38 -  
39 export default { 36 export default {
40 name: 'ShowOrderItem', 37 name: 'ShowOrderItem',
41 components: { 38 components: {
42 AvatarHeader, 39 AvatarHeader,
43 DescFooter, 40 DescFooter,
44 Slide, 41 Slide,
45 - SlideItem: Slide.Item 42 + SlideItem: Slide.Item,
46 }, 43 },
47 data() { 44 data() {
48 return { 45 return {
@@ -70,6 +67,9 @@ export default { @@ -70,6 +67,9 @@ export default {
70 }, 67 },
71 slideChangeHandler(currentPageIndex) { 68 slideChangeHandler(currentPageIndex) {
72 this.currentPageIndex = currentPageIndex; 69 this.currentPageIndex = currentPageIndex;
  70 + },
  71 + onCommentClick() {
  72 + this.$emit('on-comment-click', {});
73 } 73 }
74 } 74 }
75 }; 75 };
1 1
2 2
3 export default [{ 3 export default [{
4 - path: '/order/:id',  
5 - name: 'order', 4 + path: '/mapp/showorder/:id',
  5 + name: 'showorder',
6 6
7 component: () => import(/* webpackChunkName: "order" */ './order') 7 component: () => import(/* webpackChunkName: "order" */ './order')
8 }]; 8 }];
@@ -13,9 +13,11 @@ @@ -13,9 +13,11 @@
13 :options="scrollOpts" 13 :options="scrollOpts"
14 > 14 >
15 <SlideItem v-for="i in list"> 15 <SlideItem v-for="i in list">
16 - <OrderSlideItem></OrderSlideItem> 16 + <OrderSlideItem @on-comment-click="onComment"></OrderSlideItem>
17 </SlideItem> 17 </SlideItem>
18 </Slide> 18 </Slide>
  19 +
  20 + <CommentActionSheet ref="actionsheet"></CommentActionSheet>
19 </Layout> 21 </Layout>
20 </template> 22 </template>
21 23
@@ -23,6 +25,7 @@ @@ -23,6 +25,7 @@
23 25
24 import {Slide} from 'cube-ui'; 26 import {Slide} from 'cube-ui';
25 import OrderSlideItem from './components/order-slide-item'; 27 import OrderSlideItem from './components/order-slide-item';
  28 +import CommentActionSheet from './components/comment-action-sheet';
26 29
27 export default { 30 export default {
28 name: 'ShowOrderPage', 31 name: 'ShowOrderPage',
@@ -30,6 +33,7 @@ export default { @@ -30,6 +33,7 @@ export default {
30 Slide, 33 Slide,
31 SlideItem: Slide.Item, 34 SlideItem: Slide.Item,
32 OrderSlideItem, 35 OrderSlideItem,
  36 + CommentActionSheet
33 }, 37 },
34 data() { 38 data() {
35 return { 39 return {
@@ -71,6 +75,10 @@ export default { @@ -71,6 +75,10 @@ export default {
71 }, 75 },
72 clickHandler(e) { 76 clickHandler(e) {
73 console.log(e); 77 console.log(e);
  78 + },
  79 + onComment() {
  80 + console.log('ok');
  81 + this.$refs.actionsheet.click();
74 } 82 }
75 } 83 }
76 }; 84 };