createArticle.vue 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div>
  7. <div class="app-container">
  8. <el-tabs type="border-card">
  9. <el-tab-pane label="文章">
  10. <el-form label-width="100px" class="clearfix" :model="form" ref="form" :element-loading-text="loadingText" :rules="artilcrules">
  11. <el-row>
  12. <el-col :span="23">
  13. <el-form-item label="文章标题:" required prop="act_name">
  14. <el-input v-model="form.act_name"></el-input>
  15. </el-form-item>
  16. <el-form-item label="文章内容:" required prop="act_content">
  17. <keep-alive>
  18. <neditor ref="neditor"
  19. id="editor"
  20. v-bind:r_content="form.act_content" @content_changed="paragraphContentChanged">
  21. </neditor>
  22. </keep-alive>
  23. </el-form-item>
  24. <el-form-item label="封面图片:">
  25. <el-radio v-model="radio" label="1" @click.native.prevent="select()" >单图</el-radio>
  26. <el-radio v-model="radio" label="2" @click.native.prevent="clickitem()" >三图</el-radio>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-col :span="3">
  30. <div>
  31. <el-upload
  32. :element-loading-text="loadingText"
  33. class="avatar-uploader"
  34. :data="uploadData"
  35. action="https://upload.qiniup.com"
  36. :show-file-list="false"
  37. :on-error="handleAvatarError"
  38. :on-success="handleAvatarSuccess"
  39. :before-upload="beforeAvatarUpload">
  40. <img v-if="form.org_logo" :src="form.org_logo" class="avatar">
  41. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  42. </el-upload>
  43. </div>
  44. </el-col>
  45. <!-- 第二章图片 -->
  46. <el-col :span="3">
  47. <div v-if="picshow">
  48. <el-upload
  49. :element-loading-text="loadingText"
  50. class="avatar-uploader"
  51. :data="uploadData"
  52. action="https://upload.qiniup.com"
  53. :show-file-list="false"
  54. :on-error="handleAvatartwoError"
  55. :on-success="handleAvatartwoSuccess"
  56. :before-upload="beforeAvatartwoUpload">
  57. <img v-if="this.imageUrl" :src="this.imageUrl" class="avatar">
  58. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  59. </el-upload>
  60. </div>
  61. </el-col>
  62. <!-- 第三张图片 -->
  63. <el-col :span="3">
  64. <div v-if="picshow">
  65. <el-upload
  66. :element-loading-text="loadingText"
  67. class="avatar-uploader"
  68. :data="uploadData"
  69. action="https://upload.qiniup.com"
  70. :show-file-list="false"
  71. :on-error="handleAvatarlastError"
  72. :on-success="handleAvatarlastSuccess"
  73. :before-upload="beforeAvatarlastUpload">
  74. <img v-if="imageUrlLast" :src="imageUrlLast" class="avatar">
  75. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  76. </el-upload>
  77. </div>
  78. </el-col>
  79. </el-form-item>
  80. <el-form-item label="所属分类:" prop="act_type">
  81. <el-select v-model="form.act_type" placeholder="请先选择文章所属分类" @change="changeActtype()">
  82. <el-option
  83. v-for="item in options"
  84. :key="item.id"
  85. :label="item.name"
  86. :value="item.id">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. <el-row :span="24">
  93. <el-col :span="24">
  94. <el-form-item>
  95. <el-button size="small" type="primary" style="width: 100px" @click="submitForm('form');">发布</el-button>
  96. <el-button size="small" style="width: 100px" @click="preview('form')">预览</el-button>
  97. <el-button size="small" style="width: 100px" @click="save('form');centerdraftVisible = false">保存草稿</el-button>
  98. <el-button size="small" style="width: 100px" @click="centercancelVisible = true">取消</el-button>
  99. </el-form-item>
  100. </el-col>
  101. </el-row>
  102. </el-form>
  103. </el-tab-pane>
  104. <el-tab-pane label="视频">
  105. <el-form label-width="100px" class="clearfix" :rules="rules" :model="form" ref="vidoform">
  106. <el-row>
  107. <el-col :span="24">
  108. <div style="margin-bottom: 100px">
  109. <el-form-item required prop="vio_upload">
  110. <div class="video-select" v-if="show">
  111. <el-upload
  112. class="upload-demo"
  113. :data="uploadFileData"
  114. action="https://upload.qiniup.com"
  115. :on-change="handleChange"
  116. :on-success="handleSuccess"
  117. :on-error="handleError"
  118. :before-upload="beforeUploadFile"
  119. accept="video/x-flv,video/mpeg,video/avi,video/x-ms-wmv,video/quicktime,.asf,.rm,.rmvb,video/x-matroska,video/x-m4v,video/mp4">
  120. <el-button size="small" type="primary" v-if="show">点击上传</el-button>
  121. <div slot="tip" class="el-upload__tip" v-if="show">支持大多视频文件格式,大小不超过2G</div>
  122. </el-upload>
  123. </div>
  124. <div class="video" v-if="shows">
  125. <img v-if="form.vio_upload" :src="form.vio_upload+'?vframe/jpg/offset/1/w/300/h/200'" class="avatar" id="upvideo">
  126. </div>
  127. <div id="upvideo"></div>
  128. </el-form-item>
  129. </div>
  130. <el-form-item label="视频标题:" required prop="vid_name">
  131. <el-input v-model="form.vid_name"></el-input>
  132. </el-form-item>
  133. <el-form-item label="视频封面:">
  134. <el-upload class="avatar-uploader" :show-file-list="false"
  135. :on-success="handlevioSuccess"
  136. :before-upload="beforevidoFile"
  137. :on-change="handleChange"
  138. action="https://upload.qiniup.com"
  139. :data="uploadvidoData">
  140. <img v-if="form.vid_pic" :src="form.vid_pic" class="avatar">
  141. <img v-if="form.vio_upload" :src="form.vio_upload+'?vframe/jpg/offset/1/w/300/h/200'" class="avatar">
  142. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  143. </el-upload>
  144. </el-form-item>
  145. <div class="eltip">
  146. 视频封面若不上传,系统会根据视频内容进行自动截取<br>
  147. 目前支持PNG和JPG格式,图片大小不能超过1MB
  148. </div>
  149. <el-form-item label="所属分类:" required prop="vid_type">
  150. <el-select v-model="form.vid_type">
  151. <el-option
  152. v-for="item in options"
  153. :key="item.id"
  154. :label="item.name"
  155. :value="item.id">
  156. </el-option>
  157. </el-select>
  158. </el-form-item>
  159. <el-row :span="24">
  160. <el-col :span="24">
  161. <el-form-item>
  162. <el-button size="small" type="primary" style="width: 100px" @click="SumitVido('vidoform');centerDialogVisible = false">发布</el-button>
  163. <el-button size="small" style="width: 100px" @click="Savedraft('vidoform');centerdraftVisible = false">保存草稿</el-button>
  164. <el-button size="small" style="width: 100px" @click="centercancelVisible = true">取消</el-button>
  165. </el-form-item>
  166. </el-col>
  167. </el-row>
  168. </el-col>
  169. </el-row>
  170. </el-form>
  171. </el-tab-pane>
  172. </el-tabs>
  173. </div>
  174. </div>
  175. <el-dialog
  176. title="发布成功"
  177. :visible.sync="centerDialogVisible"
  178. width="30%"
  179. center>
  180. <span slot="footer" class="dialog-footer">
  181. <el-button @click="gotolink()">再发一条</el-button>
  182. <el-button type="primary" @click="gobacklist">返回文章列表</el-button>
  183. </span>
  184. </el-dialog>
  185. <el-dialog
  186. title="保存草稿成功"
  187. :visible.sync = "centerdraftVisible"
  188. width="30%"
  189. center>
  190. <span slot="footer" class="dialog-footer">
  191. <el-button type="primary" @click="gobacklist">返回文章列表</el-button>
  192. </span>
  193. </el-dialog>
  194. <el-dialog
  195. title="提示"
  196. :visible.sync = "centercancelVisible"
  197. width="30%"
  198. center>
  199. <span style="center">是否确定取消编辑此文章/视频</span>
  200. <span slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="confirm()" >确认</el-button>
  202. <el-button @click="centercancelVisible = false">取消</el-button>
  203. </span>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import BreadCrumb from '../components/bread-crumb'
  209. import { quillEditor } from 'vue-quill-editor'
  210. import 'quill/dist/quill.core.css'
  211. import 'quill/dist/quill.snow.css'
  212. import 'quill/dist/quill.bubble.css'
  213. import Neditor from '@/components/Neditor'
  214. import {submitForm,getArticleType,addVido,Savedraft,previewArticle,save,getEditArticleContent} from '@/api/act/submitinfo'
  215. import { getToken } from '@/api/qiniu'
  216. import { getFileExtension} from '@/utils/tools'
  217. export default {
  218. name: 'createArticle',
  219. components:{
  220. BreadCrumb,
  221. Neditor,
  222. },
  223. data(){
  224. return {
  225. crumbs: [
  226. { path: false, name: '文章管理' },
  227. { path: '/articles/createArticle', name: '发布文章' }
  228. ],
  229. radio:'1',
  230. options: [],
  231. value: '',
  232. picshow:false,
  233. content: '',
  234. editorOption: {},
  235. company:"",
  236. fileList: [],
  237. form:{
  238. act_name:'',
  239. act_content:'',
  240. act_picture:'',
  241. act_category:'',
  242. org_logo:'',
  243. act_type:'',
  244. file:'',
  245. vid_pic:"",
  246. vio_upload:"",
  247. vid_name:"",
  248. vid_type:"",
  249. },
  250. acttypes:[],
  251. imageUrl:'',
  252. imageUrlLast:'',
  253. formloading:false,
  254. formsubmit:false,
  255. qiniuDomain: 'https://images.shengws.com/',
  256. uploading:false,
  257. loadingText:'',
  258. uploadData: { token: '', key: '' },
  259. uploadFileData:{token:'',key:''},
  260. uploadvidoData:{token:'',key:''},
  261. centerDialogVisible: false,
  262. centerdraftVisible:false,
  263. centercancelVisible:false,
  264. modlevidel:'',
  265. show:true,
  266. shows:false,
  267. rules: {
  268. vid_name: [{required: true, message: "视频标题不能为空"},],
  269. vio_upload: [{required: true,message:"请上传视频"}],
  270. vid_type: [{required: true,message:"所属分类不能为空"}]
  271. },
  272. artilcrules:{
  273. act_name: [{required: true, message: "文章标题不能为空"},],
  274. act_content: [{required: true,message:"文章内容不能为空"}],
  275. act_type: [{required: true,message:"所属分类不能为空"}]
  276. },
  277. vidoform:[],
  278. }
  279. },
  280. created(){
  281. this.getArticleType();
  282. this.getEditArticleContent();
  283. },
  284. methods: {
  285. //第一个图片
  286. handleAvatarSuccess(res, file) {
  287. this.form.org_logo = this.qiniuDomain + res.url;
  288. },
  289. handleAvatarError(err, file, fileList) {
  290. this.$message.error(err);
  291. return false
  292. },
  293. beforeAvatarUpload(file) {
  294. const isJPG = file.type === 'image/jpeg';
  295. const isLt2M = file.size / 1024 / 1024 < 2;
  296. if (!isJPG) {
  297. this.$message.error('上传头像图片只能是 JPG 格式!');
  298. }
  299. if (!isLt2M) {
  300. this.$message.error('上传头像图片大小不能超过 2MB!');
  301. }
  302. var date = new Date()
  303. var ext = getFileExtension(file.name)
  304. var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
  305. this.uploading = true;
  306. this.loadingText = '封面图片上传中'
  307. const _self = this
  308. return new Promise((resolve, reject) => {
  309. getToken().then(response => {
  310. const tokentree = response.data.data.uptoken
  311. console.log("token是什么?",tokentree)
  312. _self._data.uploadData.token = tokentree;
  313. _self._data.uploadData.key = key;
  314. resolve(true)
  315. }).catch(err => {
  316. reject(false)
  317. this.uploading = false;
  318. })
  319. })
  320. },
  321. //监听图片获取富文本前三张图片
  322. paragraphContentChanged: function(content) {
  323. var images = [],temp;
  324. console.log("监听获取的文章内容是什么?",content)
  325. var patt = /<img[^>]+src=['"]([^'"]+)['"]+/g;
  326. while ((temp = patt.exec(content)) != null) {
  327. images.push(temp[1]);
  328. }
  329. console.log("图片数组",images);
  330. console.log("数组长度",images.length)
  331. if(images.length != ""){
  332. this.form.org_logo = images[0];
  333. this.imageUrl = images[1];
  334. this.imageUrlLast = images [2];
  335. }
  336. },
  337. //第二个图片
  338. handleAvatartwoSuccess(res, file) {
  339. this.imageUrl = this.qiniuDomain + res.url;
  340. },
  341. handleAvatartwoError(err, file, fileList) {
  342. this.$message.error(err);
  343. this.uploading = false;
  344. return false
  345. },
  346. beforeAvatartwoUpload(file) {
  347. const isJPG = file.type === 'image/jpeg';
  348. const isLt2M = file.size / 1024 / 1024 < 2;
  349. if (!isJPG) {
  350. this.$message.error('上传头像图片只能是 JPG 格式!');
  351. }
  352. if (!isLt2M) {
  353. this.$message.error('上传头像图片大小不能超过 2MB!');
  354. }
  355. var date = new Date()
  356. var ext = getFileExtension(file.name)
  357. var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
  358. this.uploading = true;
  359. this.loadingText = '封面图片上传中'
  360. const _self = this
  361. return new Promise((resolve, reject) => {
  362. getToken().then(response => {
  363. const tokentwo = response.data.data.uptoken
  364. console.log("第二章图片的token是什么?",tokentwo)
  365. _self._data.uploadData.token = tokentwo;
  366. _self._data.uploadData.key = key;
  367. resolve(true)
  368. }).catch(err => {
  369. reject(false)
  370. this.uploading = false;
  371. })
  372. })
  373. //return isJPG && isLt2M;
  374. },
  375. //第三张图片
  376. handleAvatarlastSuccess(res, file) {
  377. // this.imageUrlLast = URL.createObjectURL(file.raw);
  378. this.imageUrlLast = this.qiniuDomain + res.url;
  379. },
  380. handleAvatarlastError(err, file, fileList) {
  381. this.$message.error(err);
  382. this.uploading = false;
  383. return false
  384. },
  385. beforeAvatarlastUpload(file) {
  386. console.log("冷醒是",file.type)
  387. const isJPG = file.type === 'image/jpeg';
  388. const isLt2M = file.size / 1024 / 1024 < 2;
  389. if (!isJPG) {
  390. this.$message.error('上传头像图片只能是 JPG 格式!');
  391. }
  392. if (!isLt2M) {
  393. this.$message.error('上传头像图片大小不能超过 2MB!');
  394. }
  395. var date = new Date()
  396. var ext = getFileExtension(file.name)
  397. var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
  398. this.loadingText = '封面图片上传中'
  399. const _self = this
  400. return new Promise((resolve, reject) => {
  401. getToken().then(response => {
  402. const token = response.data.data.uptoken
  403. console.log("token是什么?",token)
  404. _self._data.uploadData.token = token
  405. _self._data.uploadData.key = key
  406. resolve(true)
  407. }).catch(err => {
  408. reject(false)
  409. })
  410. })
  411. },
  412. //视频上传
  413. handleChange(file, fileList) {
  414. this.form.file = file.raw
  415. },
  416. handleSuccess(res,file,fileList){
  417. this.$message.success("视频上传成功")
  418. this.form.vio_upload = this.qiniuDomain + res.url;
  419. console.log("是什么",this.form.vio_upload)
  420. this.show=false;
  421. this.shows = true;
  422. },
  423. handlevioSuccess(res,file,fileList){
  424. this.form.vid_pic = this.qiniuDomain + res.url;
  425. },
  426. changeImg(url){
  427. console.log("路径是多少?",url)
  428. },
  429. handleError(err, file, fileList) {
  430. this.$message.error("视频上传失败")
  431. },
  432. beforeUploadFile(file) {
  433. const isLt2M = file.size / 1024 / 1024 < 2048;
  434. if (!isLt2M) {
  435. this.$message.error('上传视频大小不能超过 2G!');
  436. }
  437. var date = new Date()
  438. var ext = getFileExtension(file.name)
  439. var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
  440. const _self = this
  441. return new Promise((resolve, reject) => {
  442. getToken().then(response => {
  443. const token = response.data.data.uptoken
  444. //console.log("token2是什么?",token)
  445. _self._data.uploadFileData.token = token
  446. _self._data.uploadFileData.key = key
  447. resolve(true)
  448. }).catch(err => {
  449. reject(false)
  450. })
  451. })
  452. },
  453. beforevidoFile(file){
  454. var fileType = file.type
  455. const isJPG = fileType.indexOf("image") > -1;
  456. const isLt2M = file.size / 1024 / 1024 < 2;
  457. if (!isJPG) {
  458. this.$message.error("只能上传图片");
  459. return false;
  460. }
  461. if (!isLt2M) {
  462. this.$message.error("图片大小不能超过 2MB!");
  463. return false;
  464. }
  465. var date = new Date()
  466. var ext = getFileExtension(file.name)
  467. var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
  468. const _self = this
  469. return new Promise((resolve, reject) => {
  470. getToken().then(response => {
  471. const token = response.data.data.uptoken
  472. //console.log("token2是什么?",token)
  473. _self._data.uploadvidoData.token = token
  474. _self._data.uploadvidoData.key = key
  475. resolve(true)
  476. }).catch(err => {
  477. reject(false)
  478. })
  479. })
  480. },
  481. select(){
  482. this.picshow = false
  483. },
  484. clickitem(){
  485. this.picshow = true
  486. },
  487. handleRemove(file, fileList) {
  488. console.log(file, fileList);
  489. },
  490. handlePreview(file) {
  491. console.log(file);
  492. },
  493. handleExceed(files, fileList) {
  494. this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
  495. },
  496. beforeRemove(file, fileList) {
  497. return this.$confirm(`确定移除 ${ file.name }?`);
  498. },
  499. changeActtype(){
  500. console.log("所属分类",this.form.act_type)
  501. },
  502. submitForm(formName){
  503. this.form.act_content = this.$refs.neditor.content;
  504. console.log("文章内容",this.$refs.neditor.content)
  505. this.$refs[formName].validate((valid)=>{
  506. if(valid){
  507. submitForm(this.form).then(response => {
  508. if(response.data.state == 1){
  509. this.centerDialogVisible = true;
  510. var articles = response.data.data.articles;
  511. console.log("返回的数据是啥?",articles);
  512. }
  513. })
  514. }
  515. });
  516. },
  517. getArticleType(){
  518. getArticleType().then(response =>{
  519. console.log(response.data.state)
  520. if(response.data.state === 1){
  521. var category = response.data.data.category
  522. this.options = response.data.data.category
  523. //console.log("文章内容:",category)
  524. //console.log("文章",this.options)
  525. }
  526. })
  527. },
  528. gotolink(){
  529. this.centerDialogVisible = false;
  530. this.form.act_name = "";
  531. this.form.act_content = "";
  532. this.form.act_picture = "";
  533. this.form.act_category = '';
  534. this.form.org_logo = "";
  535. this.form.act_type = "";
  536. this.form.file = "";
  537. this.form.vid_pic = "";
  538. this.form.vio_upload = "";
  539. this.form.vid_name = "";
  540. this.form.vid_type = "";
  541. this.show=true;
  542. },
  543. gobacklist(){
  544. this.$router.push({path:'/articles/articleList'})
  545. },
  546. SumitVido(formName){
  547. this.$refs[formName].validate((valid)=>{
  548. if(valid){
  549. addVido(this.form).then(response=>{
  550. if(response.data.state == 1){
  551. this.centerDialogVisible = true;
  552. var vido = response.data.data.vido;
  553. console.log("返回数据",vido)
  554. }
  555. });
  556. }
  557. });
  558. },
  559. Savedraft(formName){
  560. this.$refs[formName].validate((valid)=>{
  561. if(valid){
  562. Savedraft(this.form).then(response=>{
  563. if(response.data.state==1){
  564. this.centerdraftVisible = true;
  565. var savedraft = response.data.data.savedraft;
  566. console.log("保存草稿数据",savedraft)
  567. }
  568. });
  569. }
  570. });
  571. },
  572. preview(formName){
  573. this.form.act_content = this.$refs.neditor.content;
  574. console.log("文章内容",this.$refs.neditor.content)
  575. this.$refs[formName].validate((valid)=>{
  576. if(valid){
  577. // console.log("内容是什么?",this.form)
  578. // this.$router.push({path:'/articles/articlePreview'})
  579. previewArticle(this.form).then(response=>{
  580. if(response.data.state ==1){
  581. var art = response.data.data.art
  582. console.log("act的数据是",art);
  583. this.$router.push({path:'/articles/articlePreview'})
  584. }
  585. });
  586. }
  587. });
  588. },
  589. save(formName){
  590. this.form.act_content = this.$refs.neditor.content;
  591. console.log("文章内容",this.$refs.neditor.content);
  592. this.$refs[formName].validate((valid)=>{
  593. if(valid){
  594. save(this.form).then(response=>{
  595. if(response.data.state ==1){
  596. this.centerdraftVisible = true;
  597. var articles = response.data.data.articles;
  598. console.log("返回的数据是",articles)
  599. }
  600. });
  601. }
  602. });
  603. },
  604. confirm(){
  605. this.$router.push({path:"/articles/articleList"})
  606. },
  607. getEditArticleContent(){
  608. const id = this.$route.params && this.$route.params.id;
  609. // console.log("预览返回id是多少?",id)
  610. getEditArticleContent(id,this.form).then(response=>{
  611. if(response.data.state ==1){
  612. var articles = response.data.data.articles;
  613. this.form.act_name = articles.title;
  614. this.form.act_content = articles.content;
  615. // this.form.vio_upload = articles.imgs;
  616. this.form.act_type = articles.class_id;
  617. this.form.org_logo = articles.imgs;
  618. console.log("预览返回的数据",articles)
  619. console.log("预览返回的图片",this.form.vid_pic)
  620. }
  621. })
  622. }
  623. },
  624. }
  625. </script>
  626. <style scoped>
  627. .avatar-uploader{
  628. border: 1px solid #d9d9d9;
  629. border-radius: 6px;
  630. cursor: pointer;
  631. overflow: hidden;
  632. width: 140px;
  633. height: 140px;
  634. }
  635. .avatar-uploader{
  636. border-color: #f0f2f5;
  637. }
  638. .avatar-uploader-icon {
  639. font-size: 25px;
  640. color: #8c939d;
  641. width: 140px;
  642. height: 140px;
  643. line-height: 140px;
  644. text-align: center;
  645. }
  646. .avatar {
  647. width: 178px;
  648. height: 178px;
  649. display: block;
  650. }
  651. /*视频*/
  652. .video-select {
  653. padding: 150px 0 30px;
  654. background: url("/static/images/video_load.png") no-repeat;
  655. background-position: center 0;
  656. background-size: 192px 132px;
  657. text-align: center;
  658. width: 200px;
  659. height: 200px;
  660. position: relative;
  661. left: 500px;
  662. margin-bottom: 1px;
  663. }
  664. .video{
  665. padding: 150px 0 30px;
  666. background-position: center 0;
  667. background-size: 192px 132px;
  668. text-align: center;
  669. width: 200px;
  670. height: 200px;
  671. left: 500px;
  672. margin-bottom: 60px;
  673. margin-top: -140px;
  674. }
  675. .eltip{
  676. font-size: 12px;
  677. position: relative;
  678. left: 80px;
  679. margin-bottom: 20px;
  680. }
  681. </style>