|
@@ -0,0 +1,182 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="60px" :insertSlotArr="[1]">
|
|
|
+ <div class="scoped-textarea" slot="OI1">
|
|
|
+ <div class="st-text">洪楼科技</div>
|
|
|
+ <tinymce ref="refContent" v-model="content" :height="500" />
|
|
|
+ </div>
|
|
|
+ </base-form>
|
|
|
+ <div class="xl-form scoped-bottom">
|
|
|
+ <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
|
|
|
+ <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import Tinymce from '@/components/Tinymce'
|
|
|
+export default {
|
|
|
+ components: { Tinymce },
|
|
|
+ mixins,
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ formData: [],
|
|
|
+ loading: true,
|
|
|
+ cObj: {},
|
|
|
+ content: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ const query = this.$route.query
|
|
|
+ if (query.id) {
|
|
|
+ this.$api.house.admncplandetail({id: query.id}).then(res => {
|
|
|
+ let curData = res || {}
|
|
|
+ this.cObj = curData || {}
|
|
|
+ this.content = curData.content || ''
|
|
|
+ this.getDef()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.content = '<p>这里开始</p>\n<p> </p>\n<p style=\"margin: 10px 16px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; clear: both; min-height: 1em; color: #333333; font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif; font-size: 17px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: 0.544px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; line-height: 2em; text-indent: 2em; text-align: center;\"><span style=\"margin: 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; font-size: 16px;\"><span style=\"margin: 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; letter-spacing: 2px;\">-END-</span></span></p>\n<p><span style=\"margin: 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: #333333; font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; orphans: 2; text-align: justify; text-indent: 34px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; letter-spacing: 2px;\"><img class=\"wscnph\" src=\"https://img2.honglounews.com/20210603040359-8175.gif\" /></span></p>'
|
|
|
+ this.getDef()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getDef() {
|
|
|
+ const params = { ...this.cObj }
|
|
|
+ this.formData = [
|
|
|
+ { label: '标题', key: 'title', rules: 1 },
|
|
|
+ { label: '分类', key: 'plan_type', rules: 1, type: 'select', class: 'c-2', options: this.$dictData.plan_type, changeHandle: this.cateChange },
|
|
|
+ { label: '作者', key: 'author', class: 'c-2' },
|
|
|
+ { label: '主图', key: 'pri_image', type: 'cuImg',
|
|
|
+ options: {
|
|
|
+ w: 500,
|
|
|
+ h: 350,
|
|
|
+ }, class: 'c-2' },
|
|
|
+ { label: '状态', key: 'hide_status', type: 'select', class: 'c-2', options: this.$dictData.hide_status },
|
|
|
+ { label: '时间', key: 'create_at', type: 'datePicker', type2: 'date'},
|
|
|
+ ]
|
|
|
+ this.setDefaultValue(params)
|
|
|
+ },
|
|
|
+ cateChange (val) {
|
|
|
+ // let params = {...this.$refs.ruleForm.baseForm}
|
|
|
+ // let imgURL= ''
|
|
|
+ // if (val === 'hlzt') imgURL= 'http://icon.honglounews.com/news_hlzt.jpg'
|
|
|
+ // if (val === 'hljy' || val === 'xqsc') imgURL= 'http://icon.honglounews.com/news_hljy.jpg'
|
|
|
+ // if (val === 'bkfx') imgURL= 'http://icon.honglounews.com/news_bkfx.jpg'
|
|
|
+ // if (val === 'lppc') imgURL= 'http://icon.honglounews.com/news_lppc.jpg'
|
|
|
+ // if (val === 'lpwd') imgURL= 'http://icon.honglounews.com/news_lpwd.jpg'
|
|
|
+
|
|
|
+ // if (val === 'hlpd') imgURL= 'http://icon.honglounews.com/news_hlpd.jpg'
|
|
|
+ // if (val === 'lszt') imgURL= 'http://icon.honglounews.com/news_lszt.jpg'
|
|
|
+ // if (val === 'zcjd') imgURL= 'http://icon.honglounews.com/news_zcjd.jpg'
|
|
|
+ // if (val === 'esf') imgURL= 'http://icon.honglounews.com/news_esf.jpg'
|
|
|
+ // if (val === 'lsdt') imgURL= 'http://icon.honglounews.com/news_lsdt.jpg'
|
|
|
+ // if (val === 'scfx') imgURL= 'http://icon.honglounews.com/news_scfx.jpg'
|
|
|
+ // params.pri_image = imgURL
|
|
|
+ // this.setDefaultValue(params)
|
|
|
+ },
|
|
|
+ fileChange (file) {
|
|
|
+ let reader = new FileReader();
|
|
|
+ let rs = reader.readAsArrayBuffer(file);
|
|
|
+ let blob = null;
|
|
|
+ reader.onload = (e) => {
|
|
|
+ if (typeof e.target.result === 'object') {
|
|
|
+ blob = new Blob([e.target.result])
|
|
|
+ } else {
|
|
|
+ blob = e.target.result
|
|
|
+ }
|
|
|
+ console.log(Object.prototype.toString.call(blob));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ close(str) {
|
|
|
+ if (str === 'confirm') {
|
|
|
+ this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ const newForm = { ...oldform }
|
|
|
+ if (this.cObj.id) newForm.id = this.cObj.id
|
|
|
+ if (newForm.estate_id_list && newForm.estate_id_list.length > 0) {
|
|
|
+ newForm.estate_id_list = newForm.estate_id_list.join(',')
|
|
|
+ } else {
|
|
|
+ newForm.estate_id_list = ''
|
|
|
+ }
|
|
|
+ let apiStr = 'admncplanadd'
|
|
|
+ if (newForm.id) apiStr = 'admncplanedit'
|
|
|
+ if (this.content) {
|
|
|
+ newForm.content = this.content
|
|
|
+ } else {
|
|
|
+ this.$msg('请输入资讯文章内容')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ newForm.news_type = 'adminadd'
|
|
|
+ this.$api.house[apiStr](newForm).then(data => {
|
|
|
+ this.$msgs(newForm.id ? '编辑成功' : '新增成功')
|
|
|
+ this.$emit('close', newForm)
|
|
|
+ this.$router.push('/news/other')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$emit('close')
|
|
|
+ this.$router.push('/news/other')
|
|
|
+ this.setDefaultValue()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import '../../styles/libEdit.scss';
|
|
|
+.app-container {
|
|
|
+ background: #f9f9f9;
|
|
|
+}
|
|
|
+.lib-edit {
|
|
|
+ width: 900px;
|
|
|
+ padding: 20px 20px 60px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background: #fff;
|
|
|
+ ::v-deep .el-form-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ ::v-deep .el-date-editor.el-input {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.scoped-textarea {
|
|
|
+ width: 100%;
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ .st-text {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 1px;
|
|
|
+ right: 14px;
|
|
|
+ background: #fff;
|
|
|
+ font-size: 12px;
|
|
|
+ z-index: 9;
|
|
|
+ height: 16px;
|
|
|
+ line-height: 16px;
|
|
|
+ padding-left: 10px;
|
|
|
+ padding-right: 10px;
|
|
|
+ color: #595959;
|
|
|
+ user-select: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.scoped-bottom {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ background: #fff;
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-left: 50%;
|
|
|
+ padding-bottom: 20px;
|
|
|
+ padding-top: 20px;
|
|
|
+ border-top: 1px solid #dcdcdc;
|
|
|
+ z-index: 10;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .el-drawer__body {
|
|
|
+ padding-bottom: 30px;
|
|
|
+}
|
|
|
+</style>
|