|
@@ -176,22 +176,43 @@ export default {
|
|
|
imageSize: null
|
|
|
}
|
|
|
},
|
|
|
+ created () {
|
|
|
+ console.log(this.$route)
|
|
|
+ },
|
|
|
mounted () {
|
|
|
- this.getList()
|
|
|
- this.addQuillTitle()
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
|
|
|
- // this.form.type
|
|
|
- let tempTitle = {
|
|
|
- 1: "468px * 552px",
|
|
|
- 2: "456px * 288px",
|
|
|
- 3: "686px * 140px",
|
|
|
- 4: null
|
|
|
+ if (this.$route.query.pageType == 'create') {
|
|
|
+ this.form = {
|
|
|
+ title: null,
|
|
|
+ order: null,
|
|
|
+ coverImage: null,
|
|
|
+ linkUrl: vaildStudentUrl() + '/#/specialdetail',
|
|
|
+ type: this.$route.query.type,
|
|
|
+ status: 1,
|
|
|
+ content: null
|
|
|
+ }
|
|
|
+ this.$refs['form'].resetFields();
|
|
|
}
|
|
|
- this.imageSize = tempTitle[this.form.type]
|
|
|
-
|
|
|
+ this.init()
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ init () {
|
|
|
+ this.getList()
|
|
|
+ this.addQuillTitle()
|
|
|
+
|
|
|
+ // this.form.type
|
|
|
+ let tempTitle = {
|
|
|
+ 1: "468px * 552px",
|
|
|
+ 2: "456px * 288px",
|
|
|
+ 3: "686px * 140px",
|
|
|
+ 4: null
|
|
|
+ }
|
|
|
+ this.imageSize = tempTitle[this.form.type]
|
|
|
+ },
|
|
|
addQuillTitle () {
|
|
|
const oToolBar = document.querySelector('.ql-toolbar'),
|
|
|
aButton = oToolBar.querySelectorAll('button'),
|
|
@@ -233,7 +254,6 @@ export default {
|
|
|
messageTips (title, res) {
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success(title + '成功')
|
|
|
-
|
|
|
this.$router.push({
|
|
|
path: '/contentManager/contentManager',
|
|
|
query: {
|
|
@@ -272,23 +292,27 @@ export default {
|
|
|
this.$refs[formName].resetFields()
|
|
|
},
|
|
|
getList () {
|
|
|
- if (this.pageType == 'create') return false
|
|
|
- newsQueryId({ id: this.$route.query.id }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- let result = res.data
|
|
|
- let form = this.form
|
|
|
- this.form = {
|
|
|
- id: result.id,
|
|
|
- title: result.title,
|
|
|
- order: result.order,
|
|
|
- coverImage: result.coverImage,
|
|
|
- linkUrl: result.linkUrl,
|
|
|
- type: result.type,
|
|
|
- status: result.status,
|
|
|
- content: result.content
|
|
|
+ if (this.pageType == 'create') {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ newsQueryId({ id: this.$route.query.id }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ let result = res.data
|
|
|
+ let form = this.form
|
|
|
+ this.form = {
|
|
|
+ id: result.id,
|
|
|
+ title: result.title,
|
|
|
+ order: result.order,
|
|
|
+ coverImage: result.coverImage,
|
|
|
+ linkUrl: result.linkUrl,
|
|
|
+ type: result.type,
|
|
|
+ status: result.status,
|
|
|
+ content: result.content
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
handleAvatarSuccess (res, file) {
|
|
|
this.form.coverImage = res.data.url
|