yujialong 2 years ago
parent 9fef54b793
commit 088dc619a4
  1. 19
      src/libs/util.js
  2. 5
      src/mixins/page/index.js
  3. 150
      src/pages/article/add/index.vue
  4. 4
      src/pages/article/list/index.vue
  5. 5
      src/pages/column/add/index.vue
  6. 6
      src/pages/column/list/index.vue
  7. 1
      src/plugins/requests/index.js

@ -175,25 +175,6 @@ const util = {
Message.closeAll();
return Message.error({ message, showClose: true, offset: (document.documentElement.clientHeight - 40) / 2, duration });
},
// 登录互踢
getToken() {
if (process.env.NODE_ENV != "production") {
if (store.state.user.dataTime && !logout) {
axios.get(`${api.queryToken}?token=${_local.get(Setting.tokenKey)}`).then(res => {
if (store.state.user.dataTime && (res.data.message != store.state.user.dataTime)) {
logout || Message.error("您已在另一台设备登录,本次登录已下线!");
logout = true;
setTimeout(() => {
_local.remove(Setting.storeKey);
_local.remove(Setting.tokenKey);
location.reload();
}, 1500);
}
}).catch(err => {
});
}
}
},
debounce(fn, delay) { // 防抖
let timeout = null;
return function() {

@ -9,7 +9,6 @@ export default {
userId: +this.$store.state.user.userId,
site: this.$store.state.content.site,
columnId: +this.$route.query.id,
listStyleId: +this.$route.query.listStyleId,
id: '',
diaVisible: false,
curModule: 0,
@ -45,7 +44,6 @@ export default {
if (form && form.link && !form.link.site) form.link.site = siteId
if (form && type === 'column' && !form.site) form.site = siteId
})
console.log(555, this.modules)
// 查询页面详情
this.$post(`${this.api.findPage}?columnId=${this.columnId}`).then(({ data }) => {
if (data.length) {
@ -102,8 +100,7 @@ export default {
json: this.handleJson()
}).then(res => {
load.close()
const item = ColumnConst.pageStyle.find(e => e.id == this.listStyleId)
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136') + `/#/${item ? item.path : 'home'}?id=${this.columnId}&preview=1&siteId=${this.$route.query.siteId}`)
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136/front') + `/#/${this.$route.query.path}?id=${this.columnId}&preview=1&siteId=${this.$route.query.siteId}`)
}).catch(err => {
load.close()
})

@ -44,8 +44,7 @@
ref="column"
v-model="form.columnId"
:options="columns"
:props="columnProps"
clearable></el-cascader>
:props="columnProps"></el-cascader>
</el-form-item>
<el-form-item v-if="form.articleTemplate === 25" prop="classificationId" label="所属分类">
<el-select style="width: 234px;" v-model="form.classificationId">
@ -120,7 +119,7 @@
></el-input>
</el-form-item>
</div>
<div v-if="form.articleTemplate === 22" class="item-line">
<div v-if="form.articleTemplate === 22 || form.articleTemplate === 23" class="item-line">
<el-form-item prop="edit" label="编辑">
<el-input
placeholder="请输入编辑"
@ -170,7 +169,7 @@
</el-form-item>
</template>
<div v-if="form.articleTemplate === 22" class="item-line">
<div v-if="form.articleTemplate === 22 || form.articleTemplate === 23" class="item-line">
<el-form-item prop="source" label="所属分类">
<el-select style="width: 234px;" v-model="form.classificationId">
<template v-for="item in classifications">
@ -198,7 +197,7 @@
<el-button class="set-btn" type="primary" @click="setLabel">设置</el-button>
</el-form-item>
</div>
<el-form-item v-if="form.articleTemplate === 22" prop="summary" label="摘要">
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 23" prop="summary" label="摘要">
<el-input
style="width: 940px"
type="textarea"
@ -223,7 +222,7 @@
</div>
</el-upload>
</el-form-item>
<el-form-item prop="bannerImg" label="Banner图(选填)" style="flex: 1;">
<el-form-item v-if="form.articleTemplate !== 23" prop="bannerImg" label="Banner图(选填)" style="flex: 1;">
<el-upload
class="avatar-uploader avatar-uploader-lg"
accept=".jpg,.png,.jpeg,.gif"
@ -239,15 +238,16 @@
</div>
</el-upload>
</el-form-item>
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 25" prop="mainBody" label="正文">
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 23 || form.articleTemplate === 25" prop="mainBody" label="正文">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" />
</el-form-item>
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 25" prop="file" label="文件上传">
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 23 || form.articleTemplate === 25" prop="file" label="文件上传">
<el-upload
:before-upload="fileBeforeUpload"
:on-remove="handleRemove"
:on-success="uploadSuccessFile"
:action="this.api.upload"
:file-list="fileList"
:file-list="form.fileList"
:data="{
quote: form.title,
site: site.siteName,
@ -281,19 +281,19 @@
</el-form-item>
<template v-if="form.connectionType === 3">
<el-form-item prop="siteSelection" label="站点选择">
<el-select v-model="form.siteSelection">
<el-select v-model="form.siteSelection" @change="getOtherColumn">
<el-option
v-for="item in sites"
:key="item.id"
:label="item.name"
:label="item.siteName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="栏目">
<el-cascader
v-model="links"
:options="columns"
v-model="otherLink"
:options="otherColumns"
:props="columnProps"
clearable></el-cascader>
</el-form-item>
@ -385,7 +385,6 @@
<script>
import Setting from '@/setting'
import util from '@/libs/util'
import ColumnConst from '@/const/column'
import { mapState } from 'vuex'
import Editor from '@tinymce/tinymce-vue'
import editorConfig from './editor'
@ -397,7 +396,9 @@ export default {
site: this.$store.state.content.site,
userId: this.$store.state.user.userId,
nameRepeat: false,
sites: ColumnConst.sites,
sites: [],
otherColumns: [],
otherLink: [],
detailStyle: [],
columns: [],
columnProps: {
@ -436,7 +437,6 @@ export default {
isRelease: 0,
mainBody: '',
releaseTime: new Date(),
// releaseTime: '',
source: '',
summary : '',
title: '',
@ -444,6 +444,7 @@ export default {
connectionType : 1,
linkAddress: '',
siteSelection: 1,
fileList: []
},
rules: {
title: [
@ -478,10 +479,10 @@ export default {
],
},
columnInfo: {},
fileList: [],
editorConfig,
submiting: false, //
pass: false,
uploading: 0,
updateTime: 0,
cropperModel: false,
isUpload: false,
@ -559,6 +560,7 @@ export default {
])
this.getList()
this.form.id ? this.getData() : this.getColumn()
this.getSite()
this.getLabel()
this.getTemplate()
},
@ -606,15 +608,25 @@ export default {
//
getData() {
this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => {
data.lableId = data.lableId.split(',').map(e => +e)
data.lableId = data.lableId ? data.lableId.split(',').map(e => +e) : []
if (data.activityStartTime && data.activityEndTime) data.time = [data.activityStartTime, data.activityEndTime]
//
if (data.fileList) {
data.fileList.map(e => {
e.name = e.fileName
})
}
this.form = data
// if (data.articleTemplate === 3 && data.connectionType !== 2 && data.linkAddress) this.links = data.linkAddress.split(',').map(e => +e)
//
if (data.articleTemplate === 24 && data.connectionType !== 2 && data.linkAddress) {
const links = data.linkAddress.split(',').map(e => +e)
if (data.connectionType === 1) this.links = links
if (data.connectionType === 3) this.otherLink = links
data.linkAddress = ''
}
data.siteSelection && this.getOtherColumn()
this.originalName = data.title
this.getColumn()
// const { file } = data
// if (file) this.fileList = [{name: file, url: file}] //
this.getFile()
}).catch(err => {})
},
//
@ -634,6 +646,28 @@ export default {
this.getClassification()
}).catch(err => {})
},
//
getSite() {
this.$post(this.api.site, {
page: 1,
limit: 1000,
siteName: ''
}).then(({ data }) => {
this.sites = data.records
}).catch(e => {})
},
//
getOtherColumn() {
this.$post(this.api.listWithTree, {
siteId: this.form.siteSelection,
columnName: '',
templateId: '',
typeId : '',
isSort: 1
}).then(({ data }) => {
this.otherColumns = data
}).catch(err => {})
},
//
getTemplate() {
this.$post(this.api.individualTemplateDetailsStyle).then(({ data }) => {
@ -642,7 +676,6 @@ export default {
result.find(n => n.style === e.style) || result.push(e)
})
this.detailStyle = result
console.log("🚀 ~ file: index.vue ~ line 642 ~ this.$post ~ data", result)
}).catch(err => {})
},
//
@ -772,15 +805,6 @@ export default {
this.nameRepeat = false
}
},
//
getFile() {
this.$post(`${this.api.theAttachmentUnderTheQueryColumn}?contentId=${this.form.id}`).then(({ data }) => {
data.map(e => {
e.name = e.fileName
})
this.fileList = data
}).catch(err => {})
},
//
customUpload(data) {
const blob = this.dataURItoBlob(data)
@ -880,9 +904,13 @@ export default {
url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => {}).catch(e => {})
this.form.bannerImg = res.url
},
//
fileBeforeUpload(file) {
this.uploading++
},
//
uploadSuccessFile(res) {
console.log("🚀 ~ file: index.vue ~ line 739 ~ handleRemove ~ e", res, this.fileList)
this.uploading--
this.form.id ?
this.$post(this.api.saveContentFile, {
contentId: this.form.id,
@ -892,20 +920,20 @@ export default {
fileName: res.original,
filePath: res.url
}).then(({ data }) => {
this.fileList.push({
this.form.fileList.push({
name: res.original,
url: res.url,
id: data
})
}).catch(res => {}) :
this.fileList.push({
this.form.fileList.push({
name: res.original,
url: res.url
})
},
//
preview() {
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136') + `/#/article?id=${this.form.id}&siteId=${this.form.siteId}`)
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136/front') + `/#/article?id=${this.form.id}&siteId=${this.form.siteId}`)
},
//
back() {
@ -930,28 +958,46 @@ export default {
const form = JSON.parse(JSON.stringify(this.form))
if (!form.title) return util.errorMsg('请填写标题')
if (this.nameRepeat) return util.errorMsg('该标题已重复!')
// if (!form.releaseTime && isRelease) return util.errorMsg('')
// if (!form.titleImg && isRelease) return util.errorMsg('')
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1]
// if (form.articleTemplate === 24 && form.connectionType !== 2) {
// const { links } = this
// if (!links.length && form.connectionType === 1 && isRelease) return util.errorMsg('')
// if (!links.length && form.connectionType === 3 && isRelease) return util.errorMsg('')
// form.linkAddress = links.join()
// }
// if (((form.templateStatus && form.articleTemplate === 2) || !form.templateStatus) && !form.mainBody && isRelease) return util.errorMsg('')
if (form.articleTemplate === 25) {
if (!form.time.length && isRelease) return util.errorMsg('请选择起止时间')
form.activityStartTime = form.time[0]
form.activityEndTime = form.time[1]
const tId = form.articleTemplate
//
if (isRelease) {
if (tId !== 25) {
if (!form.releaseTime) return util.errorMsg('请选择发布日期')
}
if (tId === 22 || tId === 23) {
if (!form.titleImg ) return util.errorMsg('请上传封面')
}
if (tId === 25) {
if (!form.time.length && isRelease) return util.errorMsg('请选择起止时间')
form.activityStartTime = form.time[0]
form.activityEndTime = form.time[1]
}
if (tId === 24 && form.connectionType !== 2) {
if (form.connectionType === 1) {
if (!this.links.length) return util.errorMsg('请选择站内链接')
}
if (!this.otherLink.length && form.connectionType === 3) {
if (!this.otherLink.length) return util.errorMsg('请选择栏目')
}
}
if ((tId === 22 || tId === 23 || tId === 25) && !form.mainBody) return util.errorMsg('请输入正文')
}
if (this.uploading) return util.errorMsg('文件正在上传,请上传完成后再发布')
if (form.connectionType === 1) {
form.linkAddress = this.links.join()
} else if (form.connectionType === 3) {
form.linkAddress = this.otherLink.join()
}
const { columnId, bannerImg, file, titleImg } = form
const { columnId, bannerImg, fileList, titleImg } = form
const fileId = []
if (typeof columnId === 'object') form.columnId = columnId[columnId.length - 1] // id
// idurlid
if (bannerImg) fileId.push(bannerImg.substr(bannerImg.lastIndexOf('/') + 1))
if (file) fileId.push(file.substr(file.lastIndexOf('/') + 1))
if (titleImg) fileId.push(titleImg.substr(titleImg.lastIndexOf('/') + 1))
fileList && fileList.map(e => {
e.url && fileId.push(e.url.substr(e.url.lastIndexOf('/') + 1))
})
form.lableId = form.lableId.join(',')
//
fileId.map(e => {
@ -976,7 +1022,7 @@ export default {
} else {
this.$post(this.api.saveArticle, form).then(({ data }) => {
//
this.fileList.map(e => {
form.fileList.map(e => {
this.$post(this.api.saveContentFile, {
contentId: data,
editorId: this.userId,

@ -38,7 +38,7 @@
<el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id">
<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"></el-table-column>
<el-table-column v-if="settings[1].show" prop="title" label="标题" align="center" min-width="150"></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[2].show" prop="columnName" label="栏目" align="center" min-width="120"></el-table-column>
<el-table-column v-if="settings[3].show" prop="typeId" label="栏目类型" align="center" min-width="100">
<template slot-scope="scope">
@ -289,7 +289,7 @@ export default {
},
//
preview(row) {
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136') + `/#/article?id=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}`)
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136/front') + `/#/article?id=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}`)
},
//
edit(row) {

@ -671,11 +671,12 @@ export default {
const { listStyleId } = this.form
this.$post(this.api[this.id ? 'updatePage' : 'savePage'], {
columnId,
state: 0,
state: 1,
sort: 1,
founderId: this.userId,
editorId: this.userId,
jsonBeforeEditing: Modules[this.pageStyle.find(e => e.id === listStyleId).path]
jsonBeforeEditing: Modules[this.pageStyle.find(e => e.id === listStyleId).path],
theEditedJson: Modules[this.pageStyle.find(e => e.id === listStyleId).path],
}).then(res => {}).catch(err => {})
}
}

@ -25,7 +25,7 @@
<el-table v-loading="listLoading" ref="table" :data="list" default-expand-all class="table" header-align="center" @selection-change="handleSelectionChange" @select-all="selectAll" row-key="id">
<el-table-column v-if="settings[0].show" type="selection" width="50" align="center" :reserve-selection="true"></el-table-column>
<el-table-column prop="columnName" label="名称" min-width="140"></el-table-column>
<el-table-column prop="columnName" show-overflow-tooltip label="名称" min-width="140"></el-table-column>
<el-table-column v-if="settings[1].show" prop="typeId" label="栏目类型" min-width="100">
<template slot-scope="scope">
{{ types.find(e => e.id == scope.row.typeId) && types.find(e => e.id == scope.row.typeId).name }}
@ -294,11 +294,11 @@ export default {
const item = this.pageStyle.find(e => e.id == row.listStyleId)
if (item) path = item.path
}
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136') + `/#/${row.typeId === 3 ? row.path : 'column'}?id=${row.id}&siteId=${row.siteId}`)
window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136/front') + `/#/${row.typeId === 3 ? row.path : 'column'}?id=${row.id}&siteId=${row.siteId}`)
},
//
page(row) {
this.$router.push(`${row.path}?id=${row.id}&listStyleId=${row.listStyleId}&siteId=${row.siteId}`)
this.$router.push(`${row.path}?id=${row.id}&path=${row.path}&siteId=${row.siteId}`)
},
//
batchDel() {

@ -14,7 +14,6 @@ service.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"
// 请求拦截器
service.interceptors.request.use(config => {
util.getToken();
let token = util.local.get(Setting.tokenKey);
config.headers.captcha = ''
return config;

Loading…
Cancel
Save