fix:添加宝宝图片

上级 17d22bce
<template>
<div>
<el-container>
<el-main>
<el-table border :data="picList" v-loading="loading">
<el-table-column prop="id" label="序号" width="100" sortable></el-table-column>
<el-table-column prop="picName" label="图片名字" width="240" show-overflow-tooltip></el-table-column>
<el-table-column align="center">
<template slot-scope="props">
<img :src="props.row.picUrl" alt="图片" height="100px" />
</template>
</el-table-column>
<el-table-column label="创建时间" width="170">
<template slot-scope="props">
{{ props.row.createTime | dateFormat }}
</template>
</el-table-column>
</el-table>
<el-pagination class="pagination" background :key="elementui_page_component_key" :current-page.sync="currentPage" :page-size="pageSize" :total="total" @current-change="handleCurrentChange"></el-pagination>
</el-main>
</el-container>
</div>
</template>
<script>
import axios from 'axios'
export default {
name: 'MyPic',
data() {
return {
// 用户列表数据
picList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 9,
total: 0,
formInline: {
question: '',
},
}
},
watch: {
'formInline.question'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('lastPage', this.currentPage)
this.initCartList()
}
},
},
created() {
this.$nextTick(() => {
const foo = this.$route.query.back
const add = this.$route.query.add
if (foo === 'back' && add != 'add') {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') || ''
} else {
localStorage.setItem('lastPage', 1)
localStorage.setItem('lastQuestion', '')
this.currentPage = 1
this.formInline.question = ''
}
// 调用请求数据的方法
this.initCartList()
})
},
mounted() {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion')
this.elementui_page_component_key++
},
methods: {
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
params: {
id: id,
},
})
this.initCartList()
this.loading = false
},
refreshPage() {
location.reload()
},
gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id)
},
addChat() {
this.$router.push('/home/addChat/')
},
async initCartList() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/picInfo/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
},
})
if (res.code === 200) {
this.picList = res.result.records
this.total = res.result.total
localStorage.setItem('lastPage', this.currentPage)
localStorage.setItem('lastQuestion', this.formInline.question)
}
this.loading = false
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.initCartList()
},
},
}
</script>
<style lang="less" scoped>
.el-header {
background-color: #b3c0d1;
color: #333;
line-height: 60px;
}
.el-aside {
color: #333;
}
.pagination {
margin-top: 16px;
text-align: right;
}
.header-button-item {
margin-right: 15px;
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>
\ No newline at end of file
<template>
<h4 class="text-center">权限管理</h4>
</template>
<script>
export default {
name: 'MyRights',
}
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
......@@ -12,10 +12,10 @@
<span slot="title">用户管理</span>
</el-menu-item>
</router-link>
<router-link to="/home/rights">
<el-menu-item index="/rights" class="left-aside-item">
<router-link to="/home/pic">
<el-menu-item index="/pic" class="left-aside-item">
<i class="el-icon-setting"></i>
<span slot="title">权限管理</span>
<span slot="title">图片管理</span>
</el-menu-item>
</router-link>
<router-link to="/home/goods">
......
......@@ -7,7 +7,7 @@ import Login from '@/components/MyLogin.vue'
import Home from '@/components/MyHome.vue'
import Users from '@/components/menus/MyUsers.vue'
import Rights from '@/components/menus/MyRights.vue'
import Pic from '@/components/menus/MyPic.vue'
import Goods from '@/components/menus/MyGoods.vue'
import Orders from '@/components/menus/MyOrders.vue'
import Chat from '@/components/menus/MyChat.vue'
......@@ -41,8 +41,8 @@ const router = new VueRouter({
component: Users
},
{
path: 'rights',
component: Rights
path: 'pic',
component: Pic
},
{
path: 'goods',
......
export default['/home', '/home/users', '/home/rights']
export default['/home', '/home/users', '/home/pic']
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册