add line log list

This commit is contained in:
Jay 2018-12-04 00:16:07 +08:00
parent 88733e23bc
commit f6a1b5a6c0
4 changed files with 74 additions and 4 deletions

View File

@ -0,0 +1,17 @@
<template>
<div>
<sui-image :src="'https://bot.trj.tw/image/line_log_image/' + image" class="img-item"/>
</div>
</template>
<style lang="less" scope>
.img-item {
width: 250px;
}
</style>
<script>
export default {
props: ['image']
}
</script>

View File

@ -0,0 +1,21 @@
<template>
<div>
<TextItem v-if="type === 'text'" :message="msg" />
<ImageItem v-if="type === 'image'" :image="msg" />
</div>
</template>
<script>
import TextItem from './text-item.vue'
import ImageItem from './image-item.vue'
export default {
props: ['type', 'msg'],
components: {
TextItem,
ImageItem
},
data () {
return {}
}
}
</script>

View File

@ -0,0 +1,9 @@
<template>
<div>{{ message }}</div>
</template>
<script>
export default {
props: ['message']
}
</script>

View File

@ -1,16 +1,39 @@
<template>
<sui-container>
<div>test </div>
<sui-segment>
<sui-list divided>
<sui-list-item v-for="it in list" :key="it.id">
<sui-list-header>{{ it.user_name }}</sui-list-header>
<MessageItem :type="it.type" :msg="it.message" />
</sui-list-item>
</sui-list>
</sui-segment>
</sui-container>
</template>
<script>
import MessageItem from './components/message-item.vue'
import axios from 'axios'
export default {
name: 'LineLog',
data () {
return {}
components: {
MessageItem
},
mounted () {}
data () {
return {
list: []
}
},
mounted () {
let self = this
axios({
method: 'get',
url: 'https://bot.trj.tw/api/line/logs?max=100',
withCredentials: true
}).then(res => res.data).then(data => {
self.list = data.list
}).catch(err => console.log(err))
}
}
</script>