yujialong 1 year ago
parent 26f950cc61
commit 5388145276
  1. 8
      public/styles/css/editor.css
  2. BIN
      public/styles/font/PingFang-Regular.otf
  3. 18
      src/libs/util.js
  4. 768
      src/pages/article/list/index.vue
  5. 5
      src/pages/column/page/deviceIntroBeam.vue
  6. 5
      src/pages/column/page/deviceIntroLayout.vue
  7. 21
      src/pages/column/page/deviceIntroLinear.vue
  8. 208
      src/pages/site/list/index.vue
  9. 3
      src/plugins/auth/index.js
  10. 2
      src/setting.js

@ -6,6 +6,14 @@
font-family: ProximaNova; font-family: ProximaNova;
src: url('./styles/font/ProximaNova-Regular.otf'); src: url('./styles/font/ProximaNova-Regular.otf');
} }
@font-face {
font-family: PingFang;
src: url('./styles/font/PingFang-Regular.otf');
}
@font-face {
font-family: PingFang SC;
src: url('./styles/font/PingFang-Regular.otf');
}
.mce-content-body:not([dir='rtl']) blockquote { .mce-content-body:not([dir='rtl']) blockquote {
padding: 8px 15px; padding: 8px 15px;
border-left: 0; border-left: 0;

@ -1,6 +1,7 @@
import { _local } from "./util.db"; import { _local } from "./util.db";
import { Message } from "element-ui"; import { Message } from "element-ui";
import store from "@/store"; import store from "@/store";
import Setting from '@/setting'
// 文件后缀集合 // 文件后缀集合
const exts = { const exts = {
@ -13,12 +14,17 @@ const util = {
local: _local, local: _local,
// 筛选出有权限的站点 // 筛选出有权限的站点
getSite(list) { getSite(list) {
const result = [] // 开启了动态路由的需要根据权限筛选站点
const auth = store.state.auth.btns if (Setting.dynamicRoute) {
list.map(e => { const result = []
auth.find(n => n.includes(e.siteName)) && result.push(e) const auth = store.state.auth.btns
}) list.map(e => {
return result auth.find(n => n.includes(e.siteName)) && result.push(e)
})
return result
} else {
return list
}
}, },
//返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" //返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss"
formatDate(fmt, date) { formatDate(fmt, date) {

@ -2,92 +2,190 @@
<div class="flex page"> <div class="flex page">
<div style="width: 218px;border-right: 1px solid #EBEDF0"> <div style="width: 218px;border-right: 1px solid #EBEDF0">
<p class="page-name mb">全部栏目</p> <p class="page-name mb">全部栏目</p>
<div style="height: calc(100% - 50px);overflow: auto"> <div style="height: calc(100vh - 190px);overflow: auto">
<el-tree ref="column" :data="columns" highlight-current :expand-on-click-node="false" default-expand-all :props="defaultProps" node-key="id" @node-click="initData"> <el-tree ref="column"
<span class="custom-tree-node" slot-scope="{ node, data }"> :data="columns"
<span class="org-name" :title="node.label">{{ node.label }}</span> highlight-current
:expand-on-click-node="false"
default-expand-all
:props="defaultProps"
node-key="id"
@node-click="initData">
<span class="custom-tree-node"
slot-scope="{ node, data }">
<span class="org-name"
:title="node.label">{{ node.label }}</span>
</span> </span>
</el-tree> </el-tree>
</div> </div>
</div> </div>
<div class="p-l-20" style="width: calc(100% - 219px);"> <div class="p-l-20"
style="width: calc(100% - 219px);">
<div class="tool"> <div class="tool">
<div class="search-wrap"> <div class="search-wrap">
<el-select v-model="field" @change="initData"> <el-select v-model="field"
<el-option @change="initData">
v-for="(item, i) in keywords" <el-option v-for="(item, i) in keywords"
:key="i" :key="i"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<el-input class="keyword" :placeholder="'请输入' + keywords.find(e => e.id === field).name" v-model.trim="keyword" clearable></el-input> <el-input class="keyword"
:placeholder="'请输入' + keywords.find(e => e.id === field).name"
v-model.trim="keyword"
clearable></el-input>
</div> </div>
<div class="actions"> <div class="actions">
<el-dropdown class="setting" trigger="click" :hide-on-click="false"> <el-dropdown class="setting"
<img class="icon" src="@/assets/images/setting.png" alt=""> trigger="click"
:hide-on-click="false">
<img class="icon"
src="@/assets/images/setting.png"
alt="">
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item> <el-dropdown-item>
<el-button @click="resetColumns" type="text">列重置</el-button> <el-button @click="resetColumns"
type="text">列重置</el-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-for="(column, i) in settings" :key="i" :divided="i === 0"> <el-dropdown-item v-for="(column, i) in settings"
:key="i"
:divided="i === 0">
<el-checkbox v-model="column.show">{{ column.name }}</el-checkbox> <el-checkbox v-model="column.show">{{ column.name }}</el-checkbox>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:新增'" type="primary" @click="add" >新增</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:新增'"
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" @click="batchDel">删除</el-button> type="primary"
@click="add">新增</el-button>
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'"
@click="batchDel">删除</el-button>
</div> </div>
</div> </div>
<el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange"> <el-table :data="list"
<el-table-column v-if="settings[0].show" type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> class="table"
<el-table-column type="index" width="60" label="序号" align="center"> ref="table"
header-align="center"
@selection-change="handleSelectionChange"
row-key="id"
@sort-change="sortChange">
<el-table-column v-if="settings[0].show"
type="selection"
width="55"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index"
width="60"
label="序号"
align="center">
<template scope="scope"> <template scope="scope">
<span>{{(page - 1) * pageSize + scope.$index + 1}}</span> <span>{{(page - 1) * pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="settings[1].show" show-overflow-tooltip prop="title" label="标题" align="center" min-width="150"></el-table-column> <el-table-column v-if="settings[1].show"
<el-table-column v-if="settings[2].show" prop="columnName" label="栏目" align="center" min-width="120"></el-table-column> show-overflow-tooltip
<el-table-column v-if="settings[3].show" prop="classificationName" label="所属分类" align="center" min-width="120"></el-table-column> prop="title"
<el-table-column v-if="settings[4].show" prop="typeId" label="栏目类型" align="center" min-width="100"> label="标题"
align="center"
min-width="150"></el-table-column>
<el-table-column v-if="settings[2].show"
prop="columnName"
label="栏目"
align="center"
min-width="120"></el-table-column>
<el-table-column v-if="settings[3].show"
prop="classificationName"
label="所属分类"
align="center"
min-width="120"></el-table-column>
<el-table-column v-if="settings[4].show"
prop="typeId"
label="栏目类型"
align="center"
min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ types.find(e => e.id === scope.row.typeId).name }} {{ types.find(e => e.id === scope.row.typeId).name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="settings[5].show" prop="founderName" label="录入人" align="center" min-width="80"></el-table-column> <el-table-column v-if="settings[5].show"
<el-table-column v-if="settings[6].show" prop="editorName" label="修改人" align="center" min-width="80"></el-table-column> prop="founderName"
<el-table-column v-if="settings[7].show" prop="updateTime" label="修改日期" align="center" min-width="150" sortable="custom"></el-table-column> label="录入人"
<el-table-column v-if="settings[8].show" prop="releaseTime" label="发布日期" align="center" min-width="100" sortable="custom"></el-table-column> align="center"
<el-table-column v-if="settings[9].show" prop="totalBrowsing" label="总浏览" align="center" min-width="70"></el-table-column> min-width="80"></el-table-column>
<el-table-column v-if="settings[10].show" prop="workNumber" label="状态" align="center" min-width="80"> <el-table-column v-if="settings[6].show"
prop="editorName"
label="修改人"
align="center"
min-width="80"></el-table-column>
<el-table-column v-if="settings[7].show"
prop="updateTime"
label="修改日期"
align="center"
min-width="150"
sortable="custom"></el-table-column>
<el-table-column v-if="settings[8].show"
prop="releaseTime"
label="发布日期"
align="center"
min-width="100"
sortable="custom"></el-table-column>
<el-table-column v-if="settings[9].show"
prop="totalBrowsing"
label="总浏览"
align="center"
min-width="70"></el-table-column>
<el-table-column v-if="settings[10].show"
prop="workNumber"
label="状态"
align="center"
min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isRelease ? '已发布' : '草稿' }} {{ scope.row.isRelease ? '已发布' : '草稿' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-auth="'/site/list:' + siteName + ':内容管理:文章管理:置顶'" prop="sequence" label="置顶" align="center" min-width="80" sortable="custom"> <el-table-column v-auth="'/site/list:' + siteName + ':内容管理:文章管理:置顶'"
prop="sequence"
label="置顶"
align="center"
min-width="80"
sortable="custom">
<template slot-scope="scope"> <template slot-scope="scope">
<i v-if="scope.row.isRelease" :class="['squ-icon', scope.row.isTop ? 'el-icon-check' : 'el-icon-close']" @click="sticky(scope.row)"></i> <i v-if="scope.row.isRelease"
:class="['squ-icon', scope.row.isTop ? 'el-icon-check' : 'el-icon-close']"
@click="sticky(scope.row)"></i>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="settings[11].show" label="操作" align="center" width="190"> <el-table-column v-if="settings[11].show"
label="操作"
align="center"
width="190">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:预览'" type="text" @click="preview(scope.row)">预览</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:预览'"
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:编辑'" type="text" @click="edit(scope.row)">编辑</el-button> type="text"
<el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> @click="preview(scope.row)">预览</el-button>
<el-switch <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:编辑'"
v-if="scope.row.isRelease" type="text"
v-auth="'/site/list:' + siteName + ':内容管理:文章管理:禁用'" @click="edit(scope.row)">编辑</el-button>
class="m-l-10" <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'"
v-model="scope.row.isDisable" type="text"
:active-value="0" @click="handleDelete(scope.row)">删除</el-button>
:inactive-value="1" <el-switch v-if="scope.row.isRelease"
@change="switchOff($event, scope.row, scope.$index)"> v-auth="'/site/list:' + siteName + ':内容管理:文章管理:禁用'"
class="m-l-10"
v-model="scope.row.isDisable"
:active-value="0"
:inactive-value="1"
@change="switchOff($event, scope.row, scope.$index)">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> <el-pagination background
@current-change="currentChange"
:current-page="page"
layout="total, prev, pager, next"
:total="total"></el-pagination>
</div> </div>
</div> </div>
</div> </div>
@ -99,325 +197,325 @@ import util from '@/libs/util'
import { mapMutations } from 'vuex' import { mapMutations } from 'vuex'
import ColumnConst from '@/const/column' import ColumnConst from '@/const/column'
export default { export default {
data() { data () {
return { return {
last: this.$route.query.last, // last: this.$route.query.last, //
types: ColumnConst.types, types: ColumnConst.types,
siteName: this.$store.state.content.site.siteName, siteName: this.$store.state.content.site.siteName,
columns: [], columns: [],
defaultProps: { defaultProps: {
value: 'id', value: 'id',
label: 'columnName' label: 'columnName'
},
field: 'title',
keywords: [
{
id: 'title',
name: '标题'
}, },
field: 'title',
keywords: [
{
id: 'title',
name: '标题'
},
{
id: 'founder',
name: '录入人'
},
{
id: 'column',
name: '栏目'
},
{
id: 'editor',
name: '修改人'
}
],
keyword: '',
list: [],
page: 1,
pageSize: 10,
total: 0,
modifiedTimeSort: '',
publicationTimeSort: '',
topSort: '',
multipleSelection: [],
originSettings: [],
settings: [
{
name: '选择框',
show: true
},
{
name: '标题',
show: true
},
{
name: '栏目',
show: true
},
{
name: '所属分类',
show: false
},
{
name: '栏目类型',
show: true
},
{
name: '录入人',
show: true
},
{
name: '修改人',
show: true
},
{
name: '修改日期',
show: true
},
{
name: '发布日期',
show: true
},
{
name: '总浏览',
show: true
},
{
name: '状态',
show: true
},
{
name: '操作',
show: true
}
],
originList: []
};
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
},
mounted() {
this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', id: 'founder',
route: '/site' name: '录入人'
}, },
{ {
name: '内容管理' id: 'column',
name: '栏目'
}, },
{ {
name: '文章管理' id: 'editor',
name: '修改人'
} }
]) ],
this.originSettings = JSON.parse(JSON.stringify(this.settings)) keyword: '',
this.getColumn() list: [],
}, page: 1,
methods: { pageSize: 10,
...mapMutations('content', [ total: 0,
'setColumn' modifiedTimeSort: '',
]), publicationTimeSort: '',
// topSort: '',
getColumn() { multipleSelection: [],
this.$post(this.api.listWithTree, { originSettings: [],
siteId: this.$store.state.content.site.id, settings: [
columnName: '', {
templateId: '', name: '选择框',
typeId : '', show: true
isSort: 1 },
}).then(({ data }) => { {
this.columns = data name: '标题',
this.$nextTick(() => { show: true
this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id) },
this.getData() {
}) name: '栏目',
}).catch(e => {}) show: true
}, },
// {
getData() { name: '所属分类',
const id = this.$refs.column.getCurrentKey() show: false
this.$router.push(`/article?columnId=${id}`).catch(e => {}) },
const { keyword } = this {
const data = { name: '栏目类型',
siteId: this.$store.state.content.site.id, show: true
columnIds: [id], },
pageNum: this.page, {
pageSize: this.pageSize, name: '录入人',
topSort: this.topSort, show: true
title: this.field === 'title' ? keyword : '', },
founder: this.field === 'founder' ? keyword : '', {
column: this.field === 'column' ? keyword : '', name: '修改人',
editor: this.field === 'editor' ? keyword : '' show: true
},
{
name: '修改日期',
show: true
},
{
name: '发布日期',
show: true
},
{
name: '总浏览',
show: true
},
{
name: '状态',
show: true
},
{
name: '操作',
show: true
} }
if (this.modifiedTimeSort !== '') data.modifiedTimeSort = this.modifiedTimeSort ],
if (this.publicationTimeSort !== '') data.publicationTimeSort = this.publicationTimeSort originList: []
this.$post(this.api.queryArticle, data).then(({ data }) => { };
data.records.map(e => { },
e.editing = false watch: {
e.releaseTime = e.releaseTime.split(' ')[0] keyword: function (val) {
}) clearTimeout(this.searchTimer)
this.originList = JSON.parse(JSON.stringify(data.records)) this.searchTimer = setTimeout(() => {
this.list = data.records this.initData()
const total = +data.total }, 500)
this.total = total }
if (this.last) { },
let page = parseInt(total / 10) mounted () {
total % 10 && page++ this.$store.commit('user/setCrumbs', [
this.page = page {
this.last = '' name: '站点管理',
this.getData() route: '/site'
}
}).catch(err => {})
},
//
resetColumns() {
this.settings = JSON.parse(JSON.stringify(this.originSettings))
},
currentChange(val) {
this.page = val
this.getData()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
}, },
// {
submitSequence(row) { name: '内容管理'
const { sequence } = row
if (!sequence) return util.errorMsg('请输入排序')
if (isNaN(sequence)) return util.errorMsg('请输入数字')
this.$post(`${this.api.modifiedSort}?articleId=${row.id}&sequenceNumber=${sequence > this.total ? this.total : sequence}`).then(res => {
this.initData()
}).catch(res => {})
}, },
// {
editSequence(row) { name: '文章管理'
this.list.forEach(e => { }
])
this.originSettings = JSON.parse(JSON.stringify(this.settings))
this.getColumn()
},
methods: {
...mapMutations('content', [
'setColumn'
]),
//
getColumn () {
this.$post(this.api.listWithTree, {
siteId: this.$store.state.content.site.id,
columnName: '',
templateId: '',
typeId: '',
isSort: 1
}).then(({ data }) => {
this.columns = data
this.$nextTick(() => {
this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id)
this.getData()
})
}).catch(e => { })
},
//
getData () {
const id = this.$refs.column.getCurrentKey()
this.$router.push(`/article?columnId=${id}`).catch(e => { })
const { keyword } = this
const data = {
siteId: this.$store.state.content.site.id,
columnIds: [id],
pageNum: this.page,
pageSize: this.pageSize,
topSort: this.topSort,
title: this.field === 'title' ? keyword : '',
founder: this.field === 'founder' ? keyword : '',
column: this.field === 'column' ? keyword : '',
editor: this.field === 'editor' ? keyword : ''
}
if (this.modifiedTimeSort !== '') data.modifiedTimeSort = this.modifiedTimeSort
if (this.publicationTimeSort !== '') data.publicationTimeSort = this.publicationTimeSort
this.$post(this.api.queryArticle, data).then(({ data }) => {
data.records.map(e => {
e.editing = false e.editing = false
e.releaseTime = e.releaseTime.split(' ')[0]
}) })
row.editing = true this.originList = JSON.parse(JSON.stringify(data.records))
}, this.list = data.records
// const total = +data.total
batchDel() { this.total = total
const list = this.multipleSelection if (this.last) {
if (list.length) { let page = parseInt(total / 10)
this.$confirm('确定要删除吗?', '提示', { total % 10 && page++
type: 'warning' this.page = page
}).then(() => { this.last = ''
const data = [] this.getData()
list.map(e => {
data.push('ids=' + e.id)
})
this.$post(`${this.api.deleteArticle}?${data.join('&')}`).then(res => {
this.$refs.table.clearSelection()
util.successMsg("删除成功")
this.getData()
}).catch(res => {})
}).catch(() => {})
} else {
util.errorMsg('请先选择数据 !')
} }
}, }).catch(err => { })
// },
handleDelete(row) { //
resetColumns () {
this.settings = JSON.parse(JSON.stringify(this.originSettings))
},
currentChange (val) {
this.page = val
this.getData()
},
handleSelectionChange (val) {
this.multipleSelection = val
},
initData () {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
//
submitSequence (row) {
const { sequence } = row
if (!sequence) return util.errorMsg('请输入排序')
if (isNaN(sequence)) return util.errorMsg('请输入数字')
this.$post(`${this.api.modifiedSort}?articleId=${row.id}&sequenceNumber=${sequence > this.total ? this.total : sequence}`).then(res => {
this.initData()
}).catch(res => { })
},
//
editSequence (row) {
this.list.forEach(e => {
e.editing = false
})
row.editing = true
},
//
batchDel () {
const list = this.multipleSelection
if (list.length) {
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$post(`${this.api.deleteArticle}?ids=${row.id}`).then(res => { const data = []
util.successMsg('删除成功') list.map(e => {
data.push('ids=' + e.id)
})
this.$post(`${this.api.deleteArticle}?${data.join('&')}`).then(res => {
this.$refs.table.clearSelection()
util.successMsg("删除成功")
this.getData() this.getData()
}).catch(res => {}) }).catch(res => { })
}).catch(() => {}) }).catch(() => { })
}, } else {
// util.errorMsg('请先选择数据 !')
switchOff(val, row) { }
this.$post(`${this.api.articleEnableOrDisable}?id=${row.id}&isDisable=${val}`).then(res => {}).catch((res) => {}) },
}, //
// handleDelete (row) {
add() { this.$confirm('确定要删除吗?', '提示', {
if (!this.columns.length) return util.errorMsg('请添加栏目') type: 'warning'
this.setColumn(this.$refs.column.getCurrentNode()) }).then(() => {
this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) this.$post(`${this.api.deleteArticle}?ids=${row.id}`).then(res => {
}, util.successMsg('删除成功')
// this.getData()
sortChange(column) { }).catch(res => { })
const { order } = column }).catch(() => { })
// 1 },
// 0 1 //
if (column.prop === 'updateTime') { switchOff (val, row) {
this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : '' this.$post(`${this.api.articleEnableOrDisable}?id=${row.id}&isDisable=${val}`).then(res => { }).catch((res) => { })
if (order) { },
this.publicationTimeSort = '' //
this.topSort = '' add () {
} if (!this.columns.length) return util.errorMsg('请添加栏目')
this.setColumn(this.$refs.column.getCurrentNode())
this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`)
},
//
sortChange (column) {
const { order } = column
// 1
// 0 1
if (column.prop === 'updateTime') {
this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
if (order) {
this.publicationTimeSort = ''
this.topSort = ''
} }
if (column.prop === 'releaseTime') { }
this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : '' if (column.prop === 'releaseTime') {
if (order) { this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : ''
this.modifiedTimeSort = '' if (order) {
this.topSort = '' this.modifiedTimeSort = ''
} this.topSort = ''
} }
// 0 1 }
if (column.prop === 'sequence') { // 0 1
this.topSort = order ? order === 'ascending' ? 0 : 1 : '' if (column.prop === 'sequence') {
if (order) { this.topSort = order ? order === 'ascending' ? 0 : 1 : ''
this.publicationTimeSort = '' if (order) {
this.modifiedTimeSort = '' this.publicationTimeSort = ''
} this.modifiedTimeSort = ''
} }
this.getData() }
}, this.getData()
// },
sticky(row) { //
this.$post(`${this.api.articleTopOperation}?articleId=${row.id}&isTop=${row.isTop ? 0 : 1}`).then(res => { sticky (row) {
this.initData() this.$post(`${this.api.articleTopOperation}?articleId=${row.id}&isTop=${row.isTop ? 0 : 1}`).then(res => {
}).catch(res => {}) this.initData()
}, }).catch(res => { })
// },
preview(row) { //
window.open((Setting.isDev ? `http://${location.hostname}:8095` : this.$store.state.content.site.domainName) + `#/article?articleId=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}&id=${row.columnId}`) preview (row) {
}, window.open((Setting.isDev ? `http://${location.hostname}:8095` : this.$store.state.content.site.domainName) + `#/article?articleId=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}&id=${row.columnId}`)
// },
edit(row) { //
this.$router.push(`add?id=${row.id}&columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) edit (row) {
}, this.$router.push(`add?id=${row.id}&columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`)
} },
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.custom-tree-node { .custom-tree-node {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
} }
.name { .name {
display: inline-block; display: inline-block;
max-width: 160px; max-width: 160px;
margin-right: 20px; margin-right: 20px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.squ-icon { .squ-icon {
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
color: #f70000; color: #f70000;
&.el-icon-check { &.el-icon-check {
color: #05991e; color: #05991e;
} }
} }
/deep/.squ-input { /deep/.squ-input {
width: auto; width: auto;
.el-input__inner { .el-input__inner {
width: 60px; width: 60px;
padding: 0 10px; padding: 0 10px;
} }
} }
</style> </style>

@ -69,7 +69,8 @@
</div> </div>
<div class="unit"> <div class="unit">
<h6>{{ modules[4].form.title }}</h6> <div class="title"
v-html="modules[4].form.title"></div>
<img class="pic" <img class="pic"
:src="modules[4].form.pic" :src="modules[4].form.pic"
alt=""> alt="">
@ -203,7 +204,7 @@ export default {
width: 986px; width: 986px;
padding-bottom: 60px; padding-bottom: 60px;
margin: 0 auto; margin: 0 auto;
h6 { .title {
padding-left: 15px; padding-left: 15px;
margin-bottom: 15px; margin-bottom: 15px;
font-size: 20px; font-size: 20px;

@ -71,7 +71,8 @@
</div> </div>
<div class="unit c-wrap"> <div class="unit c-wrap">
<h6>{{ modules[4].form.title }}</h6> <div class="title"
v-html="modules[4].form.title"></div>
<img class="pic" <img class="pic"
:src="modules[4].form.pic" :src="modules[4].form.pic"
alt=""> alt="">
@ -195,7 +196,7 @@ export default {
width: 986px; width: 986px;
padding-bottom: 60px; padding-bottom: 60px;
margin: 0 auto; margin: 0 auto;
h6 { .title {
padding-left: 15px; padding-left: 15px;
margin-bottom: 15px; margin-bottom: 15px;
font-size: 20px; font-size: 20px;

@ -59,14 +59,16 @@
<div class="block intro"> <div class="block intro">
<div class="inner"> <div class="inner">
<div class="left c-wrap"> <div class="left c-wrap">
<h5>{{ modules[3].form.title }}</h5> <div class="title1"
v-html="modules[3].form.title"></div>
<img :src="modules[3].form.pic" <img :src="modules[3].form.pic"
alt=""> alt="">
<div class="cover" <div class="cover"
@click="toSet(3)">点击更改标题与图片</div> @click="toSet(3)">点击更改标题与图片</div>
</div> </div>
<div class="right c-wrap"> <div class="right c-wrap">
<h6>{{ modules[4].form.title }}</h6> <div class="title2"
v-html="modules[4].form.title"></div>
<img :src="modules[4].form.pic" <img :src="modules[4].form.pic"
alt=""> alt="">
<div class="cover" <div class="cover"
@ -194,17 +196,18 @@ export default {
width: 68%; width: 68%;
margin-left: 2%; margin-left: 2%;
} }
h5 { .title1 {
margin-bottom: 15px; margin-bottom: 0.93rem;
font-size: 20px; font-size: 0.88rem;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #2a2a2a; color: #2a2a2a;
} }
h6 {
padding-left: 15px; .title2 {
margin-bottom: 15px; padding-left: 0.93rem;
font-size: 20px; margin-bottom: 0.93rem;
font-size: 0.88rem;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #2a2a2a; color: #2a2a2a;

@ -3,31 +3,58 @@
<div class="tool"> <div class="tool">
<p class="page-name">站点列表</p> <p class="page-name">站点列表</p>
<div class="search-wrap"> <div class="search-wrap">
<el-input placeholder="请输入站点名称" v-model.trim="keyword" clearable @keyup.enter.native="getData"></el-input> <el-input placeholder="请输入站点名称"
v-model.trim="keyword"
clearable
@keyup.enter.native="getData"></el-input>
</div> </div>
</div> </div>
<el-table ref="table" :data="list" class="table" header-align="center" row-key="id"> <el-table ref="table"
<el-table-column type="index" width="60" label="序号" align="center"> :data="list"
class="table"
header-align="center"
row-key="id">
<el-table-column type="index"
width="60"
label="序号"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + (page - 1) * pageSize + 1 }} {{ scope.$index + (page - 1) * pageSize + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="siteName" label="站点名称" align="center"></el-table-column> <el-table-column prop="siteName"
<el-table-column prop="domainName" label="域名" width="400" align="center"> label="站点名称"
align="center"></el-table-column>
<el-table-column prop="domainName"
label="域名"
width="400"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model.trim="scope.row.domainName" placeholder="请输入域名" @change="update(scope.row)"></el-input> <el-input v-model.trim="scope.row.domainName"
placeholder="请输入域名"
@change="update(scope.row)"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="170" align="center"> <el-table-column label="操作"
width="170"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-auth="scope.row.siteName + ':前往网站首页'" type="text" @click="toIndex(scope.row)">前往网站首页</el-button> <el-button v-auth="scope.row.siteName + ':前往网站首页'"
<el-button v-auth="scope.row.siteName + ':内容管理'" type="text" @click="content(scope.row)">内容管理</el-button> type="text"
@click="toIndex(scope.row)">前往网站首页</el-button>
<el-button v-auth="scope.row.siteName + ':内容管理'"
type="text"
@click="content(scope.row)">内容管理</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"></el-pagination> <el-pagination background
layout="total, prev, pager, next"
:total="total"
@current-change="handleCurrentChange"
:current-page="page"></el-pagination>
</div> </div>
</div> </div>
</template> </template>
@ -37,80 +64,105 @@ import { mapState, mapMutations } from 'vuex'
import util from '@/libs/util' import util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
export default { export default {
data() { data () {
return { return {
keyword: '', keyword: '',
page: +this.$route.query.page || 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
list: [] list: []
}; };
}, },
computed: { computed: {
...mapState('auth', [ ...mapState('auth', [
'btns' 'btns'
]) ])
}, },
watch: { watch: {
keyword: function(val) { keyword: function (val) {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => { this.searchTimer = setTimeout(() => {
this.initData() this.initData()
}, 500) }, 500)
}
},
mounted () {
this.getData()
this.$store.commit('user/setCrumbs', [
{
name: '站点管理'
} }
])
// this.updateSite()
},
methods: {
...mapMutations('content', [
'setSite'
]),
//
async updateSite () {
await this.$put(this.api.updateSite, {
id: 1,
siteName: 'IASF英文站点'
})
await this.$put(this.api.updateSite, {
id: 2,
siteName: 'IASF中文站点'
})
await this.$put(this.api.updateSite, {
id: 3,
siteName: 'S³FEL中文站点'
})
await this.$put(this.api.updateSite, {
id: 4,
siteName: 'S³FEL英文站点'
})
await this.$put(this.api.updateSite, {
id: 5,
siteName: 'SRF中文站点'
})
await this.$put(this.api.updateSite, {
id: 6,
siteName: 'SRF英文站点'
})
}, },
mounted() { getData () {
this.$post(this.api.site, {
page: this.page,
limit: this.pageSize,
siteName: this.keyword
}).then(({ data }) => {
const list = util.getSite(data.records)
this.list = list
this.total = list.length
}).catch(e => { })
},
initData () {
this.page = 1
this.getData() this.getData()
this.$store.commit('user/setCrumbs', [
{
name: '站点管理'
}
])
}, },
methods: { handleCurrentChange (val) {
...mapMutations('content', [ this.page = val
'setSite' },
]), //
getData() { async update (row) {
this.$post(this.api.site, { await this.$put(this.api.updateSite, {
page: this.page, id: row.id,
limit: this.pageSize, domainName: row.domainName
siteName: this.keyword })
}).then(({ data }) => { },
const list = util.getSite(data.records) //
this.list = list toIndex (row) {
this.total = list.length window.open((Setting.isDev ? `http://${location.hostname}:8095` : row.domainName) + `#/column?siteId=${row.id}`)
}).catch(e => {}) },
}, //
initData() { content (row) {
this.page = 1 this.setSite(row)
this.getData() this.$router.push(`/column`)
}, },
handleCurrentChange(val) { }
this.page = val
},
//
update(row) {
this.$put(this.api.updateSite, {
id: row.id,
domainName: row.domainName
}).then(res => {
}).catch(e => {})
},
//
toIndex(row) {
window.open((Setting.isDev ? `http://${location.hostname}:8095` : row.domainName) + `#/column?siteId=${row.id}`)
},
//
content(row) {
this.setSite(row)
this.$router.push(`/column`)
},
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>

@ -4,9 +4,12 @@
* 用例<Tag v-auth>text</Tag> <Tag v-auth="''">text</Tag> * 用例<Tag v-auth>text</Tag> <Tag v-auth="''">text</Tag>
* */ * */
import store from '@/store' import store from '@/store'
import Setting from '@/setting'
export default { export default {
inserted(el, binding, vnode) { inserted(el, binding, vnode) {
// 开启了动态路由的需要根据权限筛选
if (!Setting.dynamicRoute) return false
const val = binding.value const val = binding.value
// 如果有传值,判断是否有/,有就说说明传的是完整的值,否则就拿路由拼接传的值;如果没传值,就取按钮名字 // 如果有传值,判断是否有/,有就说说明传的是完整的值,否则就拿路由拼接传的值;如果没传值,就取按钮名字
const text = val && val.includes('/') ? val : vnode.context.$route.path + ':' + (val || el.innerText) const text = val && val.includes('/') ? val : vnode.context.$route.path + ':' + (val || el.innerText)

@ -59,7 +59,7 @@ const Setting = {
// 相同路由,不同参数间进行切换,是否强力更新 // 相同路由,不同参数间进行切换,是否强力更新
sameRouteForceUpdate: false, sameRouteForceUpdate: false,
// 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮) // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮)
dynamicRoute: true dynamicRoute: false
}; };
export default Setting; export default Setting;

Loading…
Cancel
Save