@@ -458,16 +489,20 @@ export default {
},
nameRepeat: false,
sites: [],
- otherColumns: [],
- otherLink: [],
detailStyle: [],
columns: [],
+ articles: [],
+ otherArticles: [],
columnProps: {
checkStrictly: true,
value: 'id',
label: 'columnName'
},
links: [],
+ article: '',
+ otherColumns: [],
+ otherLink: [],
+ otherArticle: '',
form: {
siteId: this.$store.state.content.site.id,
id: this.$route.query.id || '',
@@ -505,7 +540,8 @@ export default {
connectionType : 1,
linkAddress: '',
siteSelection: 1,
- fileList: []
+ fileList: [],
+ isOpen: 1
},
rules: {
title: [
@@ -668,6 +704,22 @@ export default {
e.children.length ? this.getId(e.children, e.ids) : delete e.children
})
},
+ // 文章列表
+ getArticle() {
+ // 站内链接/其他站点链接
+ const inner = this.form.connectionType === 1
+ const id = inner ? this.links[this.links.length - 1] : this.otherLink[this.otherLink.length - 1]
+ this[inner ? 'article' : 'otherArticle'] = ''
+ this.$post(this.api.queryArticle, {
+ siteId: inner ? this.site.id : this.form.siteSelection,
+ columnIds: [id],
+ pageNum: 1,
+ pageSize: 1000,
+ title: ''
+ }).then(({ data }) => {
+ this[inner ? 'articles' : 'otherArticles'] = data.records.filter(e => e.isRelease) // 只显示已发布的文章
+ }).catch(err => {})
+ },
// 获取文章详情
getData() {
this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => {
@@ -681,14 +733,36 @@ export default {
}
// 链接回显
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 = ''
+ const columnArticle = data.linkAddress.split('-')
+ const column = columnArticle[0].split(',').map(e => +e)
+ console.log("🚀 ~ file: index.vue:737 ~ this.$post ~ columnArticle", column)
+
+ const article = columnArticle[1] || '' // 获取文章id(文章id是附在linkAddress最后面的-后面的数字)
+ const { connectionType } = data
+ // 获取文章
+ this.$post(this.api.queryArticle, {
+ siteId: connectionType === 1 ? this.site.id : data.siteSelection,
+ columnIds: [column[column.length - 1]], // 截取走最后面的文章id,最后一个id就是栏目id
+ pageNum: 1,
+ pageSize: 1000,
+ title: ''
+ }).then(res => {
+ this[connectionType === 1 ? 'articles' : 'otherArticles'] = res.data.records
+ // 站内链接/其他站点链接
+ if (connectionType === 1) {
+ this.links = column
+ this.form.linkAddress = ''
+ if (article) this.article = +article
+ } else if (connectionType === 3) {
+ this.otherLink = column
+ this.form.linkAddress = ''
+ if (article) this.otherArticle = +article
+ }
+ }).catch(err => {})
}
- data.siteSelection && this.getOtherColumn()
this.originalName = data.title
this.form = data
+ data.siteSelection && this.getOtherColumn()
this.getColumn()
}).catch(err => {})
},
@@ -701,17 +775,28 @@ export default {
if (!form.templateStatus) {
form.articleTemplate = (data.typeId === 1 || data.typeId === 4) ? data.detailStyleId : 23
}
- // 会议活动
- if (form.articleTemplate === 25) {
- this.rules.titleImg[0].required = false
- this.rules.classificationId[0].required = true
- }
+ this.handleRules()
this.getClassification()
this.$nextTick(() => {
this.updateTime = 0
})
}).catch(err => {})
},
+ // 处理表单验证
+ handleRules() {
+ const { articleTemplate } = this.form
+ // 会议活动
+ if (articleTemplate === 25) {
+ this.rules.titleImg[0].required = false
+ } else {
+ this.rules.titleImg[0].required = true
+ }
+ },
+ // 独立文章模板选择回调
+ styleChange(id) {
+ this.form.articleTemplate = id
+ this.handleRules()
+ },
// 获取站点列表
getSite() {
this.$post(this.api.site, {
@@ -723,7 +808,7 @@ export default {
}).catch(e => {})
},
// 获取指定站点的栏目列表
- getOtherColumn() {
+ getOtherColumn(val) {
this.$post(this.api.listWithTree, {
siteId: this.form.siteSelection,
columnName: '',
@@ -731,6 +816,11 @@ export default {
typeId : '',
isSort: 1
}).then(({ data }) => {
+ if (val) {
+ this.otherArticles = []
+ this.otherArticle = ''
+ this.otherLink = ''
+ }
this.otherColumns = data
}).catch(err => {})
},
@@ -998,9 +1088,9 @@ export default {
},
// 附件删除
handleRemove(e, fileList) {
- e.id && this.$post(`${this.api.delContentFile}?id=${e.id}`).then(res => {
+ e.id ? this.$post(`${this.api.delContentFile}?id=${e.id}`).then(res => {
this.form.fileList = fileList
- }).catch(res => {})
+ }).catch(res => {}) : (this.form.fileList = fileList)
},
// banner上传成功
uploadSuccessBanner(res) {
@@ -1080,7 +1170,7 @@ export default {
if (tId !== 25) {
if (!form.releaseTime) return Util.errorMsg('请选择发布日期')
}
- if (tId === 22 || tId === 23) {
+ if (tId === 22 || tId === 23 || tId === 24) {
if (!form.titleImg ) return Util.errorMsg('请上传封面')
}
if (tId === 25) {
@@ -1101,8 +1191,10 @@ export default {
if (this.uploading) return Util.errorMsg('文件正在上传,请上传完成后再发布')
if (form.connectionType === 1) {
form.linkAddress = this.links.join()
+ if (this.article) form.linkAddress += '-' + this.article
} else if (form.connectionType === 3) {
form.linkAddress = this.otherLink.join()
+ if (this.otherArticle) form.linkAddress += '-' + this.otherArticle
}
const { columnId, bannerImg, fileList, titleImg } = form
const fileId = []
diff --git a/src/pages/column/add/index.vue b/src/pages/column/add/index.vue
index bff048c..f89edd6 100644
--- a/src/pages/column/add/index.vue
+++ b/src/pages/column/add/index.vue
@@ -159,7 +159,7 @@
@@ -242,6 +242,7 @@ export default {
sites: [],
columns: [],
articles: [],
+ otherArticles: [],
columnProps: {
checkStrictly: true,
value: 'id',
@@ -408,7 +409,7 @@ export default {
pageSize: 1000,
title: ''
}).then(({ data }) => {
- this.articles = data.records.filter(e => e.isRelease) // 只显示已发布的文章
+ this[inner ? 'articles' : 'otherArticles'] = data.records.filter(e => e.isRelease) // 只显示已发布的文章
}).catch(err => {})
},
// 获取详情
@@ -422,21 +423,22 @@ export default {
const columnArticle = data.linkAddress.split('-')
const column = columnArticle[0].split(',').map(e => +e)
const article = columnArticle[1] || '' // 获取文章id(文章id是附在linkAddress最后面的-后面的数字)
+ const { connectionType } = data
// 获取文章
this.$post(this.api.queryArticle, {
- siteId: data.connectionType === 1 ? this.site.id : data.siteSelection,
+ siteId: connectionType === 1 ? this.site.id : data.siteSelection,
columnIds: [column[column.length - 1]], // 截取走最后面的文章id,最后一个id就是栏目id
pageNum: 1,
pageSize: 1000,
title: ''
}).then(res => {
- this.articles = res.data.records
+ this[connectionType === 1 ? 'articles' : 'otherArticles'] = res.data.records
// 站内链接/其他站点链接
- if (data.connectionType === 1) {
+ if (connectionType === 1) {
this.links = column
this.form.linkAddress = ''
if (article) this.article = +article
- } else if (data.connectionType === 3) {
+ } else if (connectionType === 3) {
this.otherLink = column
this.form.linkAddress = ''
if (article) this.otherArticle = +article
@@ -496,7 +498,7 @@ export default {
}).catch(e => {})
},
// 获取指定站点的栏目列表
- getOtherColumn() {
+ getOtherColumn(val) {
this.$post(this.api.listWithTree, {
siteId: this.form.siteSelection,
columnName: '',
@@ -504,6 +506,11 @@ export default {
typeId : '',
isSort: 1
}).then(({ data }) => {
+ if (val) {
+ this.otherArticles = []
+ this.otherArticle = ''
+ this.otherLink = ''
+ }
this.otherColumns = data
}).catch(err => {})
},
diff --git a/src/pages/column/page/news.vue b/src/pages/column/page/news.vue
index 7a3d54c..c9231ef 100644
--- a/src/pages/column/page/news.vue
+++ b/src/pages/column/page/news.vue
@@ -299,6 +299,7 @@ export default {
box-shadow: 0px 2px 14px 0px rgba(167,167,167,0.26);
li {
position: relative;
+ min-width: 100px;
padding: 25px 19px;
margin: 0 10px;
font-size: 22px;
diff --git a/src/pages/role/list/index.vue b/src/pages/role/list/index.vue
index e993c32..deada27 100644
--- a/src/pages/role/list/index.vue
+++ b/src/pages/role/list/index.vue
@@ -108,14 +108,15 @@ export default {
},
methods: {
getData() {
- this.$post(this.api.roles, {
- page: this.page,
- limit: this.pageSize,
- name: this.keyword,
- }).then(({ data }) => {
- this.list = data.records
- this.total = +data.total
- }).catch(res => {})
+ this.$post(this.api.roles, {
+ page: this.page,
+ limit: this.pageSize,
+ name: this.keyword,
+ }).then(({ data }) => {
+ const list = data.records.filter(e => e.id !== 1) // 不显示超管
+ this.list = list
+ this.total = data.total == 0 ? 0 : +data.total - 1
+ }).catch(res => {})
},
initData() {
this.$refs.table.clearSelection()
@@ -123,18 +124,18 @@ export default {
this.getData()
},
currentChange(val) {
- this.page = val;
- this.getData();
+ this.page = val
+ this.getData()
},
handleDelete(row) {
- this.$confirm("确定要删除吗?", "提示", {
- type: "warning"
- }).then(() => {
- this.$del(this.api.deleteRole, [row.id]).then(res => {
- util.successMsg("删除成功");
- this.getData();
- }).catch(res => {});
- }).catch(() => {});
+ this.$confirm("确定要删除吗?", "提示", {
+ type: "warning"
+ }).then(() => {
+ this.$del(this.api.deleteRole, [row.id]).then(res => {
+ util.successMsg("删除成功");
+ this.getData()
+ }).catch(res => {})
+ }).catch(() => {})
},
handleSelectionChange(val) {
this.multipleSelection = val;
diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue
index 2090d77..c5f07bc 100644
--- a/src/pages/user/list/index.vue
+++ b/src/pages/user/list/index.vue
@@ -1,6 +1,6 @@
-
+
后台员工账号
@@ -885,6 +885,6 @@ export default {
}
}
.list-wrap {
- width: calc(100% - 219px);
+ width: calc(100% - 231px);
}
\ No newline at end of file
diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js
index 6712b62..e42a6bd 100644
--- a/src/plugins/requests/index.js
+++ b/src/plugins/requests/index.js
@@ -1,134 +1,111 @@
import axios from "axios";
-import util from "@/libs/util";
-import router from "@/router/index";
+import Util from "@/libs/util";
import Setting from "@/setting";
import store from '@/store'
const service = axios.create({
- baseURL: Setting.apiBaseURL,
- timeout: 10000000
+ baseURL: Setting.apiBaseURL,
+ timeout: 10000000
});
// post请求头
service.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
-// service.defaults.withCredentials = true
-
// 请求拦截器
service.interceptors.request.use(config => {
- let token = util.local.get(Setting.tokenKey);
- if (token) config.headers.token = token
- return config;
+ let token = Util.local.get(Setting.tokenKey);
+ if (token) config.headers.token = token
+ return config;
}, err => {
- util.errorMsg({
- message: "退出登陆",
- onClose: function() {
- store.dispatch('user/logout')
- }
- });
- return Promise.reject(err);
+ Util.errorMsg({
+ message: "退出登陆",
+ onClose: function() {
+ store.dispatch('user/logout')
+ }
+ });
+ return Promise.reject(err);
});
// 响应拦截器
service.interceptors.response.use(
- response => {
- const res = response.data;
- if (res.code == 200) {
- return Promise.resolve(res).catch(e => {});
- } else {
- util.errorMsg(res.msg);
- return Promise.reject(res)
- // return Promise.resolve(res).catch(e => {});
- }
- },
- // 服务器状态码不是200的情况
- error => {
- if (error.response.status) {
- switch (error.response.status) {
- // 401: 未登录
- // 未登录则跳转登录页面,并携带当前页面的路径
- // 在登录成功后返回当前页面,这一步需要在登录页操作。
- case 401:
- util.local.remove(Setting.storeKey);
- util.local.remove(Setting.tokenKey);
- util.errorMsg("登录过期,请重新登录");
- setTimeout(() => {
- store.dispatch('user/logout')
- }, 1000);
- break;
- case 500:
- util.errorMsg("网络错误");
- break;
- // 403 token过期
- // 登录过期对用户进行提示
- // 清除本地token和清空vuex中token对象
- // 跳转登录页面
- case 403:
- util.local.remove(Setting.storeKey);
- util.local.remove(Setting.tokenKey);
- util.errorMsg("登录过期,请重新登录");
- // 清除token
- // store.commit('loginSuccess', null);
- // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面
- setTimeout(() => {
- store.dispatch('user/logout')
- }, 1000);
- break;
- // 404请求不存在
- case 404:
- util.errorMsg("网络请求不存在!");
- break;
- case 401001:
- util.errorMsg(error.response.data.msg);
- break;
- // 其他错误,直接抛出错误提示
- default:
- util.errorMsg(error.response.data.msg);
- Promise.reject(res);
- }
- return Promise.reject(error.response);
- }
+ response => {
+ const res = response.data
+ const { code } = res
+ if (code == 200) {
+ return Promise.resolve(res).catch(e => {});
+ } else if (code === 401) {
+ Util.errorMsg(res.msg)
+ setTimeout(() => {
+ store.dispatch('user/logout')
+ }, 1000)
+ return Promise.reject(res)
+ } else {
+ Util.errorMsg(res.msg);
+ return Promise.reject(res)
}
+ },
+ // 服务器状态码不是200的情况
+ error => {
+ if (error.response.status) {
+ switch (error.response.status) {
+ case 500:
+ Util.errorMsg("网络错误");
+ break;
+ // 404请求不存在
+ case 404:
+ Util.errorMsg("网络请求不存在!");
+ break;
+ case 401001:
+ Util.errorMsg(error.response.data.msg);
+ break;
+ // 其他错误,直接抛出错误提示
+ default:
+ Util.errorMsg(error.response.data.msg);
+ Promise.reject(res);
+ }
+ return Promise.reject(error.response);
+ }
+ }
);
function get(url, params) {
- return new Promise((resolve, reject) => {
- service.get(url, { params: params }).then(res => {
- resolve(res);
- }).catch(err => {
- reject(err);
- });
- });
+ return new Promise((resolve, reject) => {
+ service.get(url, { params: params }).then(res => {
+ resolve(res);
+ }).catch(err => {
+ reject(err);
+ });
+ });
}
function post(url, params) {
- return new Promise((resolve, reject) => {
- service.post(url, params).then(res => {
- resolve(res);
- }).catch(err => {
- reject(err.data);
- });
- });
+ return new Promise((resolve, reject) => {
+ service.post(url, params).then(res => {
+ resolve(res);
+ }).catch(err => {
+ reject(err.data);
+ });
+ });
}
function del(url, params) {
- return new Promise((resolve, reject) => {
- service.delete(url, {
- data: params
- }).then(res => {
- resolve(res);
- }).catch(err => {
- reject(err.data);
- });
- });
+ return new Promise((resolve, reject) => {
+ service.delete(url, {
+ data: params
+ }).then(res => {
+ resolve(res);
+ }).catch(err => {
+ reject(err.data);
+ });
+ });
}
function put(url, params) {
- return new Promise((resolve, reject) => {
- service.put(url, params).then(res => {
- resolve(res);
- }).catch(err => {
- reject(err.data);
- });
- });
+ return new Promise((resolve, reject) => {
+ service.put(url, params).then(res => {
+ resolve(res);
+ }).catch(err => {
+ reject(err.data);
+ });
+ });
}
export { get, post, del, put };
\ No newline at end of file
diff --git a/src/setting.js b/src/setting.js
index 1e1d795..ebc8282 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -7,7 +7,7 @@ let host = `${location.origin}/`
if (isDev) {
host = 'http://192.168.31.136:10000/' // 测试服
// host = 'http://192.168.31.51:10000/' // 榕
- // host = 'http://192.168.31.116:10000/' // 赓
+ host = 'http://192.168.31.116:10000/' // 赓
}
const Setting = {
diff --git a/src/styles/page/page.scss b/src/styles/page/page.scss
index bde4751..ce25372 100644
--- a/src/styles/page/page.scss
+++ b/src/styles/page/page.scss
@@ -64,6 +64,7 @@
justify-content: center;
align-items: center;
font-size: 22px;
+ white-space: nowrap;
color: #fff;
background-color: rgba(0, 0, 0, .5);
cursor: pointer;