提交 19b7607c 编写于 作者: 檀越@新空间's avatar 檀越@新空间 🐭

整理

上级 e9041296
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
import MyHeader from './subcomponents/MyHeader.vue' import MyHeader from './subcomponents/MyHeader.vue'
// 左侧边栏组件 // 左侧边栏组件
import MyAside from './subcomponents/MyAside.vue' import MyAside from './subcomponents/MyAside.vue'
export default { export default {
name: 'MyHome', name: 'MyHome',
// 注册组件 // 注册组件
...@@ -46,4 +45,4 @@ export default { ...@@ -46,4 +45,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div> <div>
<el-container> <el-container>
<el-header style="text-align: right; font-size: 12px"> <el-header style="text-align: right; font-size: 12px">
<i class="el-icon-refresh header-button-item" @click="refreshPage"></i> <i class="el-icon-refresh header-button-item" @click="refreshPage"></i>
<el-dropdown> <el-dropdown>
<i class="el-icon-setting header-button-item"></i> <i class="el-icon-setting header-button-item"></i>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item>新增</el-dropdown-item> <el-dropdown-item>新增</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<a href="http://qinyingjie.top/" target="_blank" class="header-button-item">kwan</a> <a href="http://qinyingjie.top/" target="_blank" class="header-button-item">kwan</a>
</el-header> </el-header>
<el-main> <el-main>
<el-table :data="userlist" v-loading="loading"> <el-table :data="userlist" v-loading="loading">
<el-table-column prop="id" label="序号" width="50"></el-table-column> <el-table-column prop="id" label="序号" width="50"></el-table-column>
<el-table-column <el-table-column prop="question" label="问题" width="240"></el-table-column>
prop="question" <el-table-column prop="response" label="答案"></el-table-column>
label="问题" <el-table-column label="创建时间" width="170">
width="240" <template slot-scope="props">
></el-table-column> {{ props.row.createTime | dateFormat }}
<el-table-column prop="response" label="答案"></el-table-column> </template>
<el-table-column label="创建时间" width="170"> </el-table-column>
<template slot-scope="props"> <el-table-column prop="详情" label="详情" width="100">
{{ props.row.createTime | dateFormat }} <template slot-scope="props">
</template> <a href="#" @click.prevent="gotoDetail(props.row.id)">详情</a>
</el-table-column> </template>
<el-table-column prop="详情" label="详情" width="100"> </el-table-column>
<template slot-scope="props"> </el-table>
<a href="#" @click.prevent="gotoDetail(props.row.id)">详情</a> <el-pagination
</template> class="pagination"
</el-table-column> background
</el-table> :key="elementui_page_component_key"
<el-pagination :current-page.sync="currentPage"
class="pagination" :page-size="pageSize"
background :total="total"
:key="elementui_page_component_key" @current-change="handleCurrentChange"
:current-page.sync="currentPage" ></el-pagination>
:page-size="pageSize" </el-main>
:total="total" <el-backtop class="backtop"></el-backtop>
@current-change="handleCurrentChange" </el-container>
></el-pagination> </div>
</el-main>
</el-container>
</div>
</template> </template>
<script> <script>
import axios from "axios"; import axios from 'axios';
export default { export default {
name: "MyChat", name: 'MyChat',
data() { data() {
return { return {
// 用户列表数据 // 用户列表数据
userlist: [], userlist: [],
loading: false, loading: false,
elementui_page_component_key: 0, elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem("lastPage")) || 1, currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
}; };
}, },
created() { created() {
// 调用请求数据的方法 // 调用请求数据的方法
this.initCartList(); this.initCartList();
},
mounted() {
this.currentPage = Number(localStorage.getItem("lastPage")) || 1;
this.elementui_page_component_key++;
},
methods: {
refreshPage() {
location.reload();
}, },
gotoDetail(id) { mounted() {
this.$router.push("/home/chatinfo/" + id); this.currentPage = Number(localStorage.getItem('lastPage')) || 1;
this.elementui_page_component_key++;
}, },
methods: {
refreshPage() {
location.reload();
},
gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id);
},
async initCartList() { async initCartList() {
this.loading = true; this.loading = true;
const { data: res } = await axios.get( const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', {
"http://120.79.36.53:8888/chatbot/page", params: {
{ page: this.currentPage,
params: { pageSize: this.pageSize,
page: this.currentPage, },
pageSize: this.pageSize, });
}, if (res.code === 200) {
} this.userlist = res.result.records;
); this.total = res.result.total;
if (res.code === 200) { localStorage.setItem('lastPage', this.currentPage);
this.userlist = res.result.records; }
this.total = res.result.total; this.loading = false;
localStorage.setItem("lastPage", this.currentPage); },
}
this.loading = false;
},
handleCurrentChange(currentPage) { handleCurrentChange(currentPage) {
this.currentPage = currentPage; this.currentPage = currentPage;
this.initCartList(); this.initCartList();
},
}, },
},
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.el-header { .el-header {
background-color: #b3c0d1; background-color: #b3c0d1;
color: #333; color: #333;
line-height: 60px; line-height: 60px;
} }
.el-aside { .el-aside {
color: #333; color: #333;
} }
.pagination { .pagination {
margin-top: 16px; margin-top: 16px;
text-align: right; text-align: right;
} }
.header-button-item { .header-button-item {
margin-right: 15px; margin-right: 15px;
font-size: 20px; font-size: 20px;
}
.backtop {
position: fixed;
bottom: 50px;
right: 50px;
height: 40px;
width: 40px;
line-height: 40px;
text-align: center;
border-radius: 20px;
background-color: #007aff;
color: #fff;
cursor: pointer;
z-index: 999;
}
.backtop:hover {
background-color: #0050a0;
} }
</style> </style>
\ No newline at end of file
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<script> <script>
export default { name: "MyAside" }; export default { name: "MyAside" };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.layout-aside-container { .layout-aside-container {
width: 250px; width: 250px;
...@@ -56,4 +57,4 @@ export default { name: "MyAside" }; ...@@ -56,4 +57,4 @@ export default { name: "MyAside" };
.left-aside-item { .left-aside-item {
font-size: 20px; font-size: 20px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册