|
|
@@ -0,0 +1,120 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <news-item v-for="item in list" :key="item.id" :content="item"></news-item>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import newsItem from '../../components/newsItem';
|
|
|
+export default {
|
|
|
+ components: { newsItem },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ showCall: false,
|
|
|
+ page: 0,
|
|
|
+ last: false,
|
|
|
+ loading: false,
|
|
|
+ list: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getData();
|
|
|
+ this.$bus.on('reachBottom', this.loadmore);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ this.$bus.off('reachBottom', this.loadmore);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ create() {
|
|
|
+ this.$parent.showNoticeDialog().then(() => {
|
|
|
+ this.$router.push({ name: 'createInteract', query: { type: 'qa' } });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ this.loading = true;
|
|
|
+ this.$http
|
|
|
+ .get('/article/all', { query: { mainType: '知识文库' }, sort: 'createdAt,desc' })
|
|
|
+ .then(res => {
|
|
|
+ if (res.first) {
|
|
|
+ this.list = [];
|
|
|
+ }
|
|
|
+ this.list = this.list.concat(res.content);
|
|
|
+ this.last = res.last;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ loadmore() {
|
|
|
+ if (this.loading || this.last) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.page++;
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+.item {
|
|
|
+ .flex-col();
|
|
|
+ padding: 20px 16px 22px 16px;
|
|
|
+ position: relative;
|
|
|
+ &::after {
|
|
|
+ .setBottomLine();
|
|
|
+ left: 16px;
|
|
|
+ right: 16px;
|
|
|
+ }
|
|
|
+ .title {
|
|
|
+ font-size: 16px;
|
|
|
+ color: black;
|
|
|
+ line-height: 24px;
|
|
|
+ font-weight: bold;
|
|
|
+ .ellipsisLn(2);
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ margin-top: 12px;
|
|
|
+ .flex();
|
|
|
+ color: @text3;
|
|
|
+ font-size: 13px;
|
|
|
+ .avatar {
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ margin-left: 6px;
|
|
|
+ }
|
|
|
+ .time {
|
|
|
+ margin-left: 16px;
|
|
|
+ flex-grow: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.btn-fixed {
|
|
|
+ .flex();
|
|
|
+ justify-content: center;
|
|
|
+ position: fixed;
|
|
|
+ right: 16px;
|
|
|
+ border-radius: 22px;
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ .icon {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.btn-call {
|
|
|
+ bottom: calc(132px + var(--safe-bottom));
|
|
|
+ background: #ff9733;
|
|
|
+ box-shadow: 0px 6px 12px -2px rgba(191, 22, 22, 0.08);
|
|
|
+ &:active {
|
|
|
+ background: shade(#ff9733, 10%);
|
|
|
+ }
|
|
|
+}
|
|
|
+.btn-edit {
|
|
|
+ bottom: calc(73px + var(--safe-bottom));
|
|
|
+ background: @prim;
|
|
|
+ box-shadow: 0px 6px 12px -2px rgba(191, 22, 22, 0.08);
|
|
|
+ &:active {
|
|
|
+ background: shade(@prim, 10%);
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|