|
@@ -3,8 +3,11 @@ import OSticky from '@/components/o-sticky'
|
|
import OUpload from '@/components/o-upload'
|
|
import OUpload from '@/components/o-upload'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
import { verifyUrl } from '@/helpers/toolsValidate'
|
|
import { verifyUrl } from '@/helpers/toolsValidate'
|
|
-import { Button, Field, showNotify, showToast } from 'vant'
|
|
|
|
-import { defineComponent, onMounted, reactive } from 'vue'
|
|
|
|
|
|
+import router from '@/router'
|
|
|
|
+import { state } from '@/state'
|
|
|
|
+import { Button, Field, Form, showNotify, showToast } from 'vant'
|
|
|
|
+import { defineComponent, onMounted, reactive, ref, watch } from 'vue'
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
import styles from './add-information.module.less'
|
|
import styles from './add-information.module.less'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
@@ -20,7 +23,10 @@ export default defineComponent({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
emits: ['close', 'getList'],
|
|
emits: ['close', 'getList'],
|
|
- setup(props, { slots, attrs, emit }) {
|
|
|
|
|
|
+ setup(props, { emit }) {
|
|
|
|
+ const route = useRoute()
|
|
|
|
+ const router = useRouter()
|
|
|
|
+ const header = ref('添加资讯')
|
|
const forms = reactive({
|
|
const forms = reactive({
|
|
type: 'HOT_CONSULTATION',
|
|
type: 'HOT_CONSULTATION',
|
|
clientType: 'SCHOOL',
|
|
clientType: 'SCHOOL',
|
|
@@ -65,26 +71,33 @@ export default defineComponent({
|
|
// showNotify({ type: 'primary', message: '修改成功' })
|
|
// showNotify({ type: 'primary', message: '修改成功' })
|
|
}
|
|
}
|
|
|
|
|
|
- emit('close')
|
|
|
|
- emit('getList')
|
|
|
|
|
|
+ // emit('close')
|
|
|
|
+ // emit('getList')
|
|
|
|
+ router.back()
|
|
} catch {
|
|
} catch {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- onMounted(() => {
|
|
|
|
- if (props.selectType === 'update') {
|
|
|
|
- const selectItem = props.selectItem
|
|
|
|
- forms.coverImage = selectItem.coverImage
|
|
|
|
- forms.title = selectItem.title
|
|
|
|
- forms.linkUrl = selectItem.linkUrl
|
|
|
|
- forms.summary = selectItem.summary
|
|
|
|
|
|
+ onMounted(async () => {
|
|
|
|
+ if (route.query.id) {
|
|
|
|
+ header.value = '编辑资讯'
|
|
|
|
+
|
|
|
|
+ const { data } = await request.get(
|
|
|
|
+ '/api-school/sysNewsInformation/detail/' + route.query.id
|
|
|
|
+ )
|
|
|
|
+ console.log(data)
|
|
|
|
+ forms.linkUrl = data.linkUrl
|
|
|
|
+ forms.coverImage = data.coverImage
|
|
|
|
+ forms.summary = data.summary
|
|
|
|
+ forms.title = data.title
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.addInformation}>
|
|
<div class={styles.addInformation}>
|
|
- <OHeader title="添加资讯" desotry={false} />
|
|
|
|
|
|
+ <OHeader title={header.value} desotry={false} />
|
|
|
|
+
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|
|
<i class={[styles.icon, styles.icon1]}></i>请上传封面图片
|
|
<i class={[styles.icon, styles.icon1]}></i>请上传封面图片
|
|
</div>
|
|
</div>
|
|
@@ -93,7 +106,12 @@ export default defineComponent({
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|
|
<i class={[styles.icon, styles.icon2]}></i>资讯标题
|
|
<i class={[styles.icon, styles.icon2]}></i>资讯标题
|
|
</div>
|
|
</div>
|
|
- <Field placeholder="请输入资讯标题" class={styles.field} v-model={forms.title} />
|
|
|
|
|
|
+ <Field
|
|
|
|
+ placeholder="请输入资讯标题"
|
|
|
|
+ class={styles.field}
|
|
|
|
+ v-model={forms.title}
|
|
|
|
+ autofocus={false}
|
|
|
|
+ />
|
|
|
|
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|
|
<i class={[styles.icon, styles.icon3]}></i>内容简介
|
|
<i class={[styles.icon, styles.icon3]}></i>内容简介
|
|
@@ -104,6 +122,7 @@ export default defineComponent({
|
|
rows={2}
|
|
rows={2}
|
|
class={styles.field}
|
|
class={styles.field}
|
|
v-model={forms.summary}
|
|
v-model={forms.summary}
|
|
|
|
+ autofocus={false}
|
|
/>
|
|
/>
|
|
|
|
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|