|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="enterprise min-container">
|
|
<div class="enterprise min-container">
|
|
<div class="header-title">公司概况
|
|
<div class="header-title">公司概况
|
|
- <Button type="primary" size="large" class="fr" @click="isDetail=false" v-if="$route.query.companyId">修改信息</Button>
|
|
|
|
|
|
+ <Button type="primary" size="large" class="fr" @click="isDetail=false" v-if="companyId">修改信息</Button>
|
|
</div>
|
|
</div>
|
|
<baseForm :form="form" ref="base-form" :isDetail="isDetail" />
|
|
<baseForm :form="form" ref="base-form" :isDetail="isDetail" />
|
|
<div class="header-title">视频介绍</div>
|
|
<div class="header-title">视频介绍</div>
|
|
@@ -10,7 +10,7 @@
|
|
<introPicForm :form="form" ref="intro-form" :isDetail="isDetail" />
|
|
<introPicForm :form="form" ref="intro-form" :isDetail="isDetail" />
|
|
<div class="actions-w">
|
|
<div class="actions-w">
|
|
<Button type="primary" size="large" class="submit-btn" @click="handleSubmitClick" v-if="!isDetail">提交</Button>
|
|
<Button type="primary" size="large" class="submit-btn" @click="handleSubmitClick" v-if="!isDetail">提交</Button>
|
|
- <Button size="large" @click="cancle" v-if="$route.query.companyId && !isDetail">取消</Button>
|
|
|
|
|
|
+ <Button size="large" @click="cancle" v-if="companyId && !isDetail">取消</Button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -21,6 +21,8 @@ import * as CompanyApi from '@/api/company'
|
|
import baseForm from './components/baseForm'
|
|
import baseForm from './components/baseForm'
|
|
import videoForm from './components/videoForm'
|
|
import videoForm from './components/videoForm'
|
|
import introPicForm from './components/introPicForm'
|
|
import introPicForm from './components/introPicForm'
|
|
|
|
+import { getAdmin } from '@/libs/token'
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -39,6 +41,12 @@ export default {
|
|
videoForm,
|
|
videoForm,
|
|
introPicForm
|
|
introPicForm
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ companyId () {
|
|
|
|
+ let admin = getAdmin().admin
|
|
|
|
+ return this.$route.query.companyId || admin.belongCompanyId
|
|
|
|
+ }
|
|
|
|
+ },
|
|
mounted () {
|
|
mounted () {
|
|
this.getCompanyDetail()
|
|
this.getCompanyDetail()
|
|
},
|
|
},
|
|
@@ -47,7 +55,6 @@ export default {
|
|
return this.validate()
|
|
return this.validate()
|
|
},
|
|
},
|
|
async validate () {
|
|
async validate () {
|
|
- this.$refs['base-form'].validate()
|
|
|
|
let res = await Promise.all([this.$refs['base-form'].validate()])
|
|
let res = await Promise.all([this.$refs['base-form'].validate()])
|
|
let item = res.find(item => !item)
|
|
let item = res.find(item => !item)
|
|
if (item === false) {
|
|
if (item === false) {
|
|
@@ -58,16 +65,19 @@ export default {
|
|
},
|
|
},
|
|
async submit () {
|
|
async submit () {
|
|
await Promise.all([this.$refs['base-form'].submit(), this.$refs['video-form'].submit(), this.$refs['intro-form'].submit()])
|
|
await Promise.all([this.$refs['base-form'].submit(), this.$refs['video-form'].submit(), this.$refs['intro-form'].submit()])
|
|
- return CompanyApi.addCompany(this.form)
|
|
|
|
|
|
+ let api = this.form.companyId ? CompanyApi.updateCompany : CompanyApi.addCompany
|
|
|
|
+ return api(this.form).then(() => {
|
|
|
|
+ this.$Message.success('修改成功')
|
|
|
|
+ })
|
|
},
|
|
},
|
|
cancle () {
|
|
cancle () {
|
|
window.location.reload()
|
|
window.location.reload()
|
|
},
|
|
},
|
|
getCompanyDetail () {
|
|
getCompanyDetail () {
|
|
- if (!this.$route.query.companyId) return
|
|
|
|
- CompanyApi.getCompanyDetail(this.$route.query.companyId).then(res => {
|
|
|
|
|
|
+ if (!this.companyId) return
|
|
|
|
+ CompanyApi.getCompanyDetail(this.companyId).then(res => {
|
|
this.isDetail = true
|
|
this.isDetail = true
|
|
- this.form = res.data
|
|
|
|
|
|
+ this.form = res.data.company
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|