|
@@ -3,12 +3,12 @@
|
|
|
<el-row type="flex" justify="space-between" class="toolbar">
|
|
|
<!--工具条-->
|
|
|
<el-row type="flex">
|
|
|
- <el-form :inline="true" :model="filters">
|
|
|
+ <el-form :inline="true">
|
|
|
<el-form-item>
|
|
|
- <el-input v-model="filters" placeholder="场景名称" @change="getUsers()"></el-input>
|
|
|
+ <el-input @keydown.enter.native='search' v-model="searchKey" placeholder="场景名称"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" v-on:click="getUsers">查询</el-button>
|
|
|
+ <el-button type="primary" v-on:click="search">查询</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<router-link :to="{name: 'add'}" class="button">添加场景</router-link>
|
|
@@ -16,27 +16,32 @@
|
|
|
<!-- 生成大场景someData -->
|
|
|
<el-row type="flex" class="addScene">
|
|
|
<el-button type="warning" style="margin-right:20px;" @click="logout">登出</el-button>
|
|
|
- <el-input placeholder="输入编码生成someData" v-model="url">
|
|
|
+ <!-- <el-input placeholder="输入编码生成someData" v-model="url">
|
|
|
<template slot="append">
|
|
|
<a :href="'/getSomeData?url=https://my.matterportvr.cn/api/player/models/'+url+'/?format=json'" target="_block">生成</a>
|
|
|
</template>
|
|
|
- </el-input>
|
|
|
+ </el-input> -->
|
|
|
</el-row>
|
|
|
</el-row>
|
|
|
<!-- 表格 -->
|
|
|
<el-table :data="scenes" style="width: 100%" >
|
|
|
- <el-table-column prop="name" width="80" label="场景">
|
|
|
+ <el-table-column prop="sceneCode" width="200" label="场景">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="title" label="名称">
|
|
|
+ <el-table-column prop="sceneTitle" label="名称">
|
|
|
</el-table-column>
|
|
|
<el-table-column fixed="right" label="操作" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <a :href="scope.row.query" target="_blank">查看</a>
|
|
|
- <a :href="scope.row.edit" target="_blank">编辑</a>
|
|
|
- <a @click="delScene(scope.row.name)" target="_blank">删除</a>
|
|
|
+ <a :href="scope.row.webSite" target="_blank">查看</a>
|
|
|
+ <a :href="`${$serverName}/editPage/edit.html?m=${scope.row.sceneCode}`" target="_blank">编辑</a>
|
|
|
+ <a @click="delScene(scope.row.id)" target="_blank">删除</a>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+
|
|
|
+ <div class="p-con">
|
|
|
+ <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="size" layout="prev, pager, next, jumper" :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -45,41 +50,72 @@ export default {
|
|
|
name: 'list',
|
|
|
data () {
|
|
|
return {
|
|
|
- filters: '',
|
|
|
+ searchKey: '',
|
|
|
scenes: [],
|
|
|
- url: ''
|
|
|
+ url: '',
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0,
|
|
|
+ size: 15
|
|
|
}
|
|
|
},
|
|
|
async created () {
|
|
|
this.getScenes()
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ currentPage () {
|
|
|
+ this.getScenes()
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ search () {
|
|
|
+ this.currentPage === 1 ? this.getScenes() : this.currentPage = 1
|
|
|
+ },
|
|
|
+ handleSizeChange (val) {
|
|
|
+ console.log(`每页 ${val} 条`)
|
|
|
+ },
|
|
|
+ handleCurrentChange (val) {
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
+ },
|
|
|
async getScenes () {
|
|
|
- let scenes = (await this.$http.get('/list')).content
|
|
|
- let scenesLast = scenes.pop()
|
|
|
- scenes.unshift(scenesLast)
|
|
|
- this.origin = scenes
|
|
|
- this.scenes = scenes
|
|
|
+ let params = {
|
|
|
+ pageNum: this.currentPage,
|
|
|
+ pageSize: this.size,
|
|
|
+ searchKey: this.searchKey
|
|
|
+ }
|
|
|
+ let res = (await this.$http.post('/manage/scene/list', params))
|
|
|
+ this.scenes = res.data.list
|
|
|
+ this.total = res.data.total
|
|
|
+ this.currentPage = res.data.pageNum
|
|
|
},
|
|
|
async delScene (name) {
|
|
|
if (confirm('删除后将无法恢复!你确定要删除这个场景吗?')) {
|
|
|
- await this.$http.post('/delscene', {name})
|
|
|
+ await this.$http.get(`/manage/scene/removes/${name}`)
|
|
|
this.getScenes()
|
|
|
}
|
|
|
},
|
|
|
logout () {
|
|
|
- window.localStorage.setItem('dcj_token', '')
|
|
|
- this.$router.go(0)
|
|
|
- },
|
|
|
- getUsers () {
|
|
|
- this.scenes = this.origin.filter(item => (~item.name.indexOf(this.filters) || ~item.title.indexOf(this.filters)))
|
|
|
- console.log(this.scenes)
|
|
|
- },
|
|
|
- truncate (arr) {
|
|
|
- var m = arr.slice(0)
|
|
|
- m.splice(m.length - 1, 1)
|
|
|
- return m
|
|
|
+ this.$http({
|
|
|
+ method: 'get',
|
|
|
+ url: '/admin/logout',
|
|
|
+ headers: {
|
|
|
+ Authorization: window.localStorage.getItem('token')
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 5001 || res.code === 5002) return
|
|
|
+ if (res.code === 0) {
|
|
|
+ window.localStorage.setItem('dcj_token', '')
|
|
|
+ this.$token = ''
|
|
|
+ this.$alert('退出成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: action => {
|
|
|
+ window.localStorage.setItem('menu', '')
|
|
|
+ this.$router.push('/login')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -98,6 +134,10 @@ export default {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
.addScene{
|
|
|
- width: 300px;
|
|
|
+ width: 80px;
|
|
|
+ }
|
|
|
+ .p-con{
|
|
|
+ text-align: center;
|
|
|
+ padding: 20px 0;
|
|
|
}
|
|
|
</style>
|