CreateNewspaper.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  1. <template>
  2. <div class="manage-root newspaper-create">
  3. <Header />
  4. <div class="manage-root-contain">
  5. <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
  6. <div class="manage-root-contain-right">
  7. <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
  8. <div class="create-top">
  9. <div class="common-title-box">
  10. <h3>{{id?'编辑报纸':'创建报纸'}}</h3>
  11. <div class="btn-box" v-if="id||!id&&stepIndex!==2">
  12. <el-button size="small" @click="handleStep('-')" :disabled="stepIndex===0">上一步</el-button>
  13. <el-button type="primary" size="small" @click="handleStep('+')" :disabled="stepIndex===2">下一步</el-button>
  14. </div>
  15. </div>
  16. <el-steps :active="stepIndex" align-center>
  17. <el-step title="报纸信息" description="填写报纸基本信息">
  18. <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
  19. </el-step>
  20. <el-step title="添加内容" description="为报纸添加内容">
  21. <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
  22. </el-step>
  23. <el-step :title="id?'完成编辑':'完成创建'" :description="id?'报纸编辑完成':'报纸创建完成'">
  24. <svg-icon icon-class="dot" slot="icon" class="svg-dot"></svg-icon>
  25. </el-step>
  26. </el-steps>
  27. </div>
  28. <div class="create-bottom">
  29. <template v-if="stepIndex===0">
  30. <el-form :model="newspaperForm" :rules="rulesNewspaper" ref="newspaperForm" label-width="100px" class="registerForm">
  31. <el-form-item label="报纸封面" prop="cover_image_url">
  32. <upload :datafileList="newspaperForm.cover_image_list" :changeFillId="handleAvatarSuccess" :fileName="'cover'" :showList="true" uploadType="image" :filleNumber="1" v-if="!newspaperForm.cover_image_url" styleType="upload" />
  33. <div class="cover-box" v-else @mouseover="Imagemouseover('coverFlag',true)" @mouseout="Imagemouseover('coverFlag',false)">
  34. <el-image :src="newspaperForm.cover_image_url" fit="cover" style="width:200px;height:280px;"></el-image>
  35. <p v-show="coverFlag" @click="handleDeleteFile('cover',0)"><i class="el-icon-delete"></i></p>
  36. </div>
  37. <p class="tips">建议上传宽高为200*280的图</p>
  38. </el-form-item>
  39. <el-form-item label="报纸名称" prop="iss_name">
  40. <el-input v-model="newspaperForm.iss_name" placeholder="请输入报纸名称" @blur="handleTrim('newspaperForm','iss_name')"></el-input>
  41. </el-form-item>
  42. <el-form-item label="出版机构" prop="vendor_name">
  43. <el-select v-model="newspaperForm.vendor_name" filterable allow-create default-first-option placeholder="请选择">
  44. <el-option
  45. v-for="(item,i) in vendorList"
  46. :key="item+i"
  47. :label="item"
  48. :value="item">
  49. </el-option>
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item label="是否合刊" required="" prop="comb_flag">
  53. <el-radio-group v-model="newspaperForm.comb_flag">
  54. <el-radio :label="0">否</el-radio>
  55. <el-radio :label="1">是</el-radio>
  56. </el-radio-group>
  57. </el-form-item>
  58. <el-form-item label="期数" prop="iss_no" class="validity-box" v-if="newspaperForm.comb_flag===0">
  59. <el-input placeholder="请输入" v-model="newspaperForm.iss_no" type="number">
  60. <template slot="append">期</template>
  61. </el-input>
  62. </el-form-item>
  63. <el-form-item label="期数" prop="iss_no_start" class="iss-no-box" v-if="newspaperForm.comb_flag===1">
  64. <el-input v-model="newspaperForm.iss_no_start" type="number" class="iss-start">
  65. <template slot="append">-</template>
  66. </el-input>
  67. <el-input v-model="newspaperForm.iss_no_end" type="number">
  68. <template slot="append">期</template>
  69. </el-input>
  70. </el-form-item>
  71. <el-form-item label="发行日期" prop="release_date">
  72. <el-date-picker
  73. v-model="newspaperForm.release_date"
  74. type="date"
  75. placeholder="选择日期"
  76. value-format="yyyy-MM-dd"
  77. format="yyyy-MM-dd">
  78. </el-date-picker>
  79. </el-form-item>
  80. <el-form-item label="学段" prop="study_phase">
  81. <el-select v-model="newspaperForm.study_phase" placeholder="请选择" @change="getVlList">
  82. <el-option
  83. v-for="item in $studyType"
  84. :key="item.study_phase"
  85. :label="item.study_phase_name"
  86. :value="item.study_phase">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item label="课标词表" prop="vl_id">
  91. <el-select v-model="newspaperForm.vl_id" filterable placeholder="请选择">
  92. <el-option
  93. v-for="item in vlList"
  94. :key="item.id"
  95. :label="item.vl_name"
  96. :value="item.id">
  97. </el-option>
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item label="栏目模板" prop="chn_data">
  101. <el-select v-model="newspaperForm.chn_data" filterable placeholder="请选择" @change="handleChangeChn">
  102. <el-option
  103. v-for="item in tplList"
  104. :key="item.id"
  105. :label="item.tpl_name"
  106. :value="item.chn_data_string">
  107. </el-option>
  108. </el-select>
  109. <a @click="handleLinkChannel" class="tpl-maintain">栏目模板维护</a>
  110. <br/>
  111. <el-input
  112. type="textarea"
  113. :rows="4"
  114. readonly="readonly"
  115. style="margin-top: 20px"
  116. v-model="newspaperForm.chn_data_str">
  117. </el-input>
  118. </el-form-item>
  119. <el-form-item label="标签" prop="info_tag_data">
  120. <el-select v-model="newspaperForm.info_tag_data" multiple filterable allow-create default-first-option placeholder="请选择">
  121. <el-option
  122. v-for="(item,i) in tabsList"
  123. :key="item+i"
  124. :label="item"
  125. :value="item">
  126. </el-option>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item label="简介" prop="iss_note">
  130. <el-input
  131. type="textarea"
  132. :rows="4"
  133. placeholder="请输入简介"
  134. v-model="newspaperForm.iss_note"
  135. maxlength="140"
  136. show-word-limit>
  137. </el-input>
  138. </el-form-item>
  139. <el-form-item label="讲解版" required="" prop="with_addon_flag">
  140. <el-radio-group v-model="newspaperForm.with_addon_flag">
  141. <el-radio :label="0">否</el-radio>
  142. <el-radio :label="1">是</el-radio>
  143. </el-radio-group>
  144. </el-form-item>
  145. <template v-if="newspaperForm.with_addon_flag===1">
  146. <el-divider></el-divider>
  147. <h6>讲解版售价</h6>
  148. <el-form-item label="原价" prop="with_addon_price_org" class="price-box" :key="'with_addon_price'">
  149. <el-input-number v-model="newspaperForm.with_addon_price_org" :min="0" size="small" :precision="2" class="personal-ceil"></el-input-number>
  150. <span class="prepend">¥</span>
  151. <span class="append">元</span>
  152. </el-form-item>
  153. <el-form-item label="优惠价格" prop="has_discount_addon">
  154. <el-radio-group v-model="newspaperForm.has_discount_addon">
  155. <el-radio :label="0">没有</el-radio>
  156. <el-radio :label="1">有</el-radio>
  157. </el-radio-group>
  158. </el-form-item>
  159. <el-form-item label="优惠价格" prop="with_addon_price_sell" class="price-box" v-if="newspaperForm.has_discount_addon===1">
  160. <el-input-number v-model="newspaperForm.with_addon_price_sell" :min="0" size="small" :precision="2" class="personal-ceil"></el-input-number>
  161. <span class="prepend">¥</span>
  162. <span class="append">元</span>
  163. <p class="tips">优惠价格必须低于原价</p>
  164. </el-form-item>
  165. </template>
  166. <el-divider></el-divider>
  167. <h6>普通版售价</h6>
  168. <template>
  169. <el-form-item label="原价" prop="iss_price_org" class="price-box" :key="'iss_price'">
  170. <el-input-number v-model="newspaperForm.iss_price_org" :min="0" size="small" :precision="2" class="personal-ceil"></el-input-number>
  171. <span class="prepend">¥</span>
  172. <span class="append">元</span>
  173. </el-form-item>
  174. <el-form-item label="优惠价格" prop="has_discount">
  175. <el-radio-group v-model="newspaperForm.has_discount">
  176. <el-radio :label="0">没有</el-radio>
  177. <el-radio :label="1">有</el-radio>
  178. </el-radio-group>
  179. </el-form-item>
  180. <el-form-item label="优惠价格" prop="iss_price_sell" class="price-box" v-if="newspaperForm.has_discount===1">
  181. <el-input-number v-model="newspaperForm.iss_price_sell" :min="0" size="small" :precision="2" class="personal-ceil"></el-input-number>
  182. <span class="prepend">¥</span>
  183. <span class="append">元</span>
  184. <p class="tips">优惠价格必须低于原价</p>
  185. </el-form-item>
  186. </template>
  187. </el-form>
  188. </template>
  189. <div v-if="stepIndex===1">
  190. <div class="issue-channel">
  191. <div class="issue-top">
  192. <h4 class="issue-top-left">
  193. 栏目
  194. <span>共 {{issueChannel.channelNumber}} 个栏目 {{issueChannel.articleNumber}} 篇文章</span>
  195. </h4>
  196. <el-button type="primary" size="small">预览</el-button>
  197. </div>
  198. <div class="channel-item" v-for="(item,index) in issueChannel.channelList" :key="index">
  199. <div class="channel-top">
  200. <i class="el-icon-caret-bottom" v-if="item.show" @click="item.show=!item.show"></i>
  201. <i class="el-icon-caret-top" v-else @click="item.show=!item.show"></i>
  202. <span @click="item.show=!item.show">{{item.channelName}}</span>
  203. <el-button type="text" @click="handleArticle('','en')"><i class="el-icon-plus"></i>新增英文内容</el-button>
  204. <el-button type="text" @click="handleArticle('','cn')"><i class="el-icon-plus"></i>新增中文内容</el-button>
  205. </div>
  206. <el-collapse-transition>
  207. <template v-if="item.show">
  208. <draggable
  209. v-model="item.articleList"
  210. chosenClass="chosen"
  211. forceFallback="true"
  212. group="people"
  213. animation="1000"
  214. @start="onStart"
  215. @end="onEnd"
  216. class="article-list"
  217. >
  218. <li v-for="(itema,indexa) in item.articleList" :key="indexa">
  219. <svg-icon icon-class="sort" draggable="true"></svg-icon>
  220. <div class="items">
  221. <h6>{{itema.title}}</h6>
  222. <span>BY {{itema.author}}</span>
  223. <span>创建人:{{itema.creator}}</span>
  224. <span>{{itema.time}}</span>
  225. </div>
  226. <svg-icon icon-class="edit" class="edit-article" @click="handleArticle(itema.id,itema.type)"></svg-icon>
  227. <span class="border"></span>
  228. <i class="el-icon-delete" @click="handleDeleteArticle(item.articleList,indexa)"></i>
  229. </li>
  230. </draggable>
  231. </template>
  232. </el-collapse-transition>
  233. </div>
  234. </div>
  235. </div>
  236. <div v-if="stepIndex===2">
  237. <el-result icon="success" :subTitle="id?'报纸编辑成功':'报纸创建成功'">
  238. <template slot="extra">
  239. <el-button size="small" @click="handleback">返回列表</el-button>
  240. <el-button type="primary" size="small" @click="handleCreate">继续创建</el-button>
  241. </template>
  242. </el-result>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. </template>
  249. <script>
  250. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  251. //例如:import 《组件名称》from ‘《组件路径》';
  252. import Header from "../../../components/Header.vue";
  253. import NavMenu from "../../../components/NavMenu.vue"
  254. import Breadcrumb from '../../../components/Breadcrumb.vue';
  255. import Upload from "../../../components/Upload.vue"
  256. import { getLogin } from "@/api/ajax";
  257. import { mapState } from 'vuex';
  258. import draggable from "vuedraggable";
  259. export default {
  260. //import引入的组件需要注入到对象中才能使用
  261. components: { Header, NavMenu, Breadcrumb, Upload, draggable },
  262. props: {},
  263. data() {
  264. const validateIssNo = (rule, value, callback) => {
  265. if (value === '') {
  266. callback(new Error('请输入期数'));
  267. } else {
  268. let start = this.newspaperForm.iss_no_start
  269. let end = this.newspaperForm.iss_no_end
  270. if (start!==null&&end!==null) {
  271. if(start>=end){
  272. callback(new Error('开始期数需小于结束期数'));
  273. }else{
  274. callback();
  275. }
  276. } else {
  277. callback(new Error('请输入期数'));
  278. }
  279. }
  280. };
  281. const validatePrice = (rule, value, callback) => {
  282. if (value === '') {
  283. callback(new Error('请输入价格'));
  284. } else {
  285. let price = this.newspaperForm.iss_price_org
  286. let currentPrice = this.newspaperForm.iss_price_sell
  287. if (price!==undefined&&currentPrice!==undefined) {
  288. if(price===0&&rule.fullField==='price'){
  289. callback(new Error('原价需大于0'));
  290. }else if(currentPrice>=price&&this.newspaperForm.has_discount){
  291. callback(new Error('优惠价格必须低于原价'));
  292. }else{
  293. callback();
  294. }
  295. } else {
  296. callback(new Error('请输入'));
  297. }
  298. }
  299. };
  300. const validatePrices = (rule, value, callback) => {
  301. if (value === '') {
  302. callback(new Error('请输入价格'));
  303. } else {
  304. let price = this.newspaperForm.with_addon_price_org
  305. let currentPrice = this.newspaperForm.with_addon_price_sell
  306. if (price!==undefined&&currentPrice!==undefined) {
  307. if(price===0&&rule.fullField==='price'){
  308. callback(new Error('原价需大于0'));
  309. }else if(currentPrice>=price&&this.newspaperForm.has_discount_addon){
  310. callback(new Error('优惠价格必须低于原价'));
  311. }else{
  312. callback();
  313. }
  314. } else {
  315. callback(new Error('请输入'));
  316. }
  317. }
  318. };
  319. return {
  320. activeMenuIndex: "newspaper_manage",
  321. breadcrumbList:[
  322. {
  323. icon:'file-list-line',
  324. url:'',
  325. text:''
  326. },
  327. {
  328. icon:'',
  329. url:'',
  330. notLink: true,
  331. text:'内容管理'
  332. },
  333. {
  334. icon:'',
  335. url:'',
  336. text:'报纸管理'
  337. }
  338. ],
  339. id:this.$route.query.id?this.$route.query.id:'',
  340. stepIndex:window.localStorage.getItem('newsStep')?window.localStorage.getItem('newsStep')*1:0, // 步骤索引
  341. coverFlag: false,
  342. newspaperForm:window.localStorage.getItem('newsForm')?JSON.parse(window.localStorage.getItem('newsForm')):{
  343. cover_image_url: '',
  344. cover_image_list: [],
  345. cover_image_id: null,
  346. iss_name: '',
  347. vendor_name: '21世纪报社',
  348. comb_flag: 0,
  349. iss_no: null,
  350. iss_no_start: null,
  351. iss_no_end: null,
  352. release_date: '',
  353. study_phase: null,
  354. vl_id: '',
  355. chn_data: '',
  356. chn_data_str:'',
  357. info_tag_data: [],
  358. iss_note: '',
  359. with_addon_flag: 1,
  360. iss_price_org: null,
  361. iss_price_sell: null,
  362. with_addon_price_org: null,
  363. with_addon_price_sell: null,
  364. has_discount: 1,
  365. has_discount_addon: 1
  366. },
  367. rulesNewspaper:{
  368. iss_name:[
  369. { required: true, message: '请输入报纸名称', trigger: 'blur' }
  370. ],
  371. vendor_name: [
  372. { required: true, message: '请输入出版机构', trigger: 'blur' }
  373. ],
  374. iss_no: [
  375. { required: true, message: '请输入期数', trigger: 'blur' }
  376. ],
  377. iss_no_start: [
  378. { required: true, validator: validateIssNo, trigger: 'blur' }
  379. ],
  380. iss_no_end: [
  381. { required: true, validator: validateIssNo, trigger: 'blur' }
  382. ],
  383. study_phase: [
  384. { required: true, message: '请选择学段', trigger: 'change' }
  385. ],
  386. vl_id: [
  387. { required: true, message: '请选择课标词表', trigger: 'change' }
  388. ],
  389. chn_data: [
  390. { required: true, message: '请选择栏目模板', trigger: 'change' }
  391. ],
  392. iss_price_org:[
  393. { required: true, validator: validatePrice, trigger: 'blur' },
  394. ],
  395. iss_price_sell:[
  396. { required: true, validator: validatePrice, trigger: 'blur' },
  397. ],
  398. with_addon_price_org:[
  399. { required: true, validator: validatePrices, trigger: 'blur' },
  400. ],
  401. with_addon_price_sell:[
  402. { required: true, validator: validatePrices, trigger: 'blur' },
  403. ],
  404. },
  405. vendorList: [], // 出版机构列表
  406. vlList: [], // 课标词表
  407. tplList: [], // 栏目列表
  408. tabsList:['中英双语','少儿必读'],
  409. issueId: '',
  410. issueChannel:{
  411. channelNumber: '12',
  412. articleNumber: '4',
  413. channelList:[
  414. {
  415. channelName: 'FRONT PAGE',
  416. articleList: [
  417. {
  418. title: 'Silly science',
  419. author: 'TEENS',
  420. creator: '张老师',
  421. time: '2012-12-12 12:23',
  422. id: '123',
  423. type: 'cn'
  424. },
  425. {
  426. title: 'Silly science1',
  427. author: 'TEENS',
  428. creator: '张老师',
  429. time: '2012-12-12 12:23',
  430. id: '123',
  431. type: 'en'
  432. },
  433. {
  434. title: 'Silly science2',
  435. author: 'TEENS',
  436. creator: '张老师',
  437. time: '2012-12-12 12:23',
  438. id: '123'
  439. },
  440. {
  441. title: 'Silly science3',
  442. author: 'TEENS',
  443. creator: '张老师',
  444. time: '2012-12-12 12:23'
  445. }
  446. ],
  447. show: true
  448. },
  449. {
  450. channelName: 'STORY LAND',
  451. articleList: [],
  452. show: false
  453. },
  454. {
  455. channelName: 'STORY LAND',
  456. articleList: [],
  457. show: false
  458. },
  459. {
  460. channelName: 'STORY LAND',
  461. articleList: [],
  462. show: false
  463. },
  464. {
  465. channelName: 'STORY LAND',
  466. articleList: [],
  467. show: false
  468. },
  469. {
  470. channelName: 'STORY LAND',
  471. articleList: [],
  472. show: false
  473. },
  474. {
  475. channelName: 'STORY LAND',
  476. articleList: [],
  477. show: false
  478. },
  479. ]
  480. },
  481. drag: false,
  482. }
  483. },
  484. //计算属性 类似于data概念
  485. computed: {
  486. ...mapState(['$studyType']),
  487. },
  488. //监控data中数据变化
  489. watch: {
  490. },
  491. //方法集合
  492. methods: {
  493. // 上一步下一步
  494. handleStep(type){
  495. if(type=='-'){
  496. if(this.stepIndex>0) this.stepIndex--
  497. }else{
  498. if(this.stepIndex===0){
  499. this.$refs['newspaperForm'].validate((valid) => {
  500. if (valid) {
  501. this.handleAddIssue()
  502. } else {
  503. return false;
  504. }
  505. });
  506. }else if(this.stepIndex===1){
  507. this.stepIndex++
  508. }
  509. }
  510. },
  511. // 返回列表
  512. handleback(){
  513. this.$router.push({
  514. path: "/newspaper_manage",
  515. query: {
  516. },
  517. });
  518. },
  519. //继续创建
  520. handleCreate(){
  521. this.$router.replace('/createNewspaper')
  522. location.reload()
  523. },
  524. // 跳转栏目列表
  525. handleLinkChannel(){
  526. window.localStorage.setItem('newsForm',JSON.stringify(this.newspaperForm))
  527. window.localStorage.setItem('newsStep',0)
  528. this.$router.push({
  529. path:'/channelList'
  530. })
  531. },
  532. handleAvatarSuccess(fileList,name) {
  533. if(name==='cover'){
  534. this.newspaperForm.cover_image_list = fileList
  535. this.newspaperForm.cover_image_id = fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_id:''
  536. this.newspaperForm.cover_image_url = fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_url:''
  537. this.$forceUpdate()
  538. }
  539. },
  540. Imagemouseover(item,flag) {
  541. this[item] = flag
  542. },
  543. handleDeleteFile(item,i) {
  544. this.$confirm("确定删除吗?", "提示", {
  545. confirmButtonText: "确定",
  546. cancelButtonText: "取消",
  547. type: "warning",
  548. }).then(() => {
  549. if(item==='cover'){
  550. this.newspaperForm.cover_image_list.splice(i, 1);
  551. this.newspaperForm.cover_image_url = ''
  552. this.newspaperForm.cover_image_id = null
  553. this.$forceUpdate()
  554. }
  555. });
  556. },
  557. handleDeleteArticle(item,i){
  558. this.$confirm("确定删除吗?", "提示", {
  559. confirmButtonText: "确定",
  560. cancelButtonText: "取消",
  561. type: "warning",
  562. }).then(() => {
  563. item.splice(i, 1);
  564. });
  565. },
  566. // 去掉前后空格
  567. handleTrim(form,fild){
  568. this[form][fild] = this[form][fild].trim()
  569. },
  570. // 获取出版机构列表
  571. getVendorList(){
  572. let MethodName = "/PaperServer/Manager/IssueManager/FindVendors";
  573. let data = {
  574. key_word: ''
  575. }
  576. getLogin(MethodName, data)
  577. .then((res) => {
  578. if(res.status===1){
  579. this.vendorList = res.data
  580. }
  581. })
  582. .catch(() => {
  583. });
  584. },
  585. // 课标词表
  586. getVlList(){
  587. this.newspaperForm.vl_id = ''
  588. this.newspaperForm.chn_data = ''
  589. this.newspaperForm.chn_data_str = ''
  590. let MethodName = "/PaperServer/Manager/VocListManager/FindSimplesByCond";
  591. let data = {
  592. study_phase: this.newspaperForm.study_phase
  593. }
  594. getLogin(MethodName, data)
  595. .then((res) => {
  596. if(res.status===1){
  597. this.vlList = res.data
  598. }
  599. })
  600. .catch(() => {
  601. });
  602. let MethodNames = "/PaperServer/Manager/ChannelTplManager/PickChannelTplByCond";
  603. getLogin(MethodNames, data)
  604. .then((res) => {
  605. if(res.status===1){
  606. let tplList = res.data
  607. tplList.forEach(item => {
  608. item.chn_data_string = JSON.stringify(item.chn_data)
  609. });
  610. this.tplList = tplList
  611. }
  612. })
  613. .catch(() => {
  614. });
  615. },
  616. handleChangeChn(){
  617. this.newspaperForm.chn_data_str = JSON.parse(this.newspaperForm.chn_data).join('\n')
  618. },
  619. handleAddIssue(){
  620. let MethodName = "/PaperServer/Manager/IssueManager/AddIssue";
  621. let form = this.newspaperForm
  622. let data = {
  623. iss_cover_id: form.cover_image_id,
  624. iss_name: form.iss_name,
  625. vendor_name: form.vendor_name,
  626. release_date: form.release_date,
  627. comb_flag: form.comb_flag,
  628. iss_no:form.comb_flag===0?form.iss_no:null,
  629. iss_no_start: form.comb_flag===1?form.iss_no_start:null,
  630. iss_no_end: form.comb_flag===1?form.iss_no_end:null,
  631. study_phase: form.study_phase,
  632. vl_id: form.vl_id,
  633. iss_price_org: form.iss_price_org,
  634. iss_price_sell: this.newspaperForm.has_discount===1?form.iss_price_sell:form.iss_price_org,
  635. with_addon_price_org: form.with_addon_price_org,
  636. with_addon_price_sell: this.newspaperForm.has_discount_addon===1?form.with_addon_price_sell:form.with_addon_price_org,
  637. iss_note: form.iss_note,
  638. info_tag_data: form.info_tag_data,
  639. chn_data: JSON.parse(form.chn_data),
  640. with_addon_flag: form.with_addon_flag
  641. }
  642. if(this.id){
  643. MethodName = "/PaperServer/Manager/IssueManager/EditIssue"
  644. data.id = this.id
  645. }
  646. getLogin(MethodName, data)
  647. .then((res) => {
  648. if(res.status===1){
  649. window.localStorage.removeItem('newsForm')
  650. window.localStorage.removeItem('newsStep')
  651. this.issueId = res.data.id
  652. this.stepIndex++
  653. }
  654. })
  655. .catch(() => {
  656. this.loading = false
  657. });
  658. },
  659. getInfo(){
  660. let MethodName = "/PaperServer/Manager/IssueManager/FindIssueById"
  661. let data = {
  662. id: this.id
  663. }
  664. getLogin(MethodName, data)
  665. .then((res) => {
  666. if(res.status===1){
  667. this.newspaperForm = res.data
  668. this.newspaperForm.cover_image_list = []
  669. this.newspaperForm.chn_data = JSON.stringify(res.data.chn_data)
  670. this.newspaperForm.chn_data_str = JSON.parse(res.data.chn_data).join('\n')
  671. this.newspaperForm.cover_image_id = res.data.iss_cover_id
  672. getLogin('/FileServer/GetFileInfo', {
  673. file_id: res.data.iss_cover_id
  674. })
  675. .then((res) => {
  676. if(res.status===1){
  677. this.newspaperForm.cover_image_url = res.file_url
  678. this.$forceUpdate()
  679. }
  680. })
  681. this.newspaperForm.cover_image_list.push[{
  682. id: res.data.iss_cover_id
  683. }]
  684. if(res.data.iss_price_org===res.data.iss_price_sell){
  685. this.$set(this.newspaperForm,'has_discount',0)
  686. }else{
  687. this.$set(this.newspaperForm,'has_discount',1)
  688. }
  689. if(res.data.with_addon_price_org===res.data.with_addon_price_sell){
  690. this.$set(this.newspaperForm,'has_discount_addon',0)
  691. }else{
  692. this.$set(this.newspaperForm,'has_discount_addon',1)
  693. }
  694. }
  695. })
  696. .catch(() => {
  697. });
  698. },
  699. // 跳转文章
  700. handleArticle(id,type){
  701. window.localStorage.setItem('newsForm',JSON.stringify(this.newspaperForm))
  702. window.localStorage.setItem('newsStep',1)
  703. this.$router.push({
  704. path:'/createArticle',
  705. query: {
  706. id: id,
  707. type: type,
  708. articleId: this.id
  709. }
  710. })
  711. },
  712. //开始拖拽事件
  713. onStart() {
  714. this.drag = true;
  715. },
  716. //拖拽结束事件
  717. onEnd() {
  718. this.drag = false;
  719. },
  720. },
  721. //生命周期 - 创建完成(可以访问当前this实例)
  722. async created() {
  723. this.getVendorList()
  724. await this.getVlList()
  725. let obj = {
  726. icon:'',
  727. url:'',
  728. text:'创建报纸'
  729. }
  730. if(this.id){
  731. obj.text = '编辑报纸'
  732. this.getInfo()
  733. }
  734. this.breadcrumbList.push(obj)
  735. },
  736. //生命周期 - 挂载完成(可以访问DOM元素)
  737. mounted() {
  738. },
  739. //生命周期-创建之前
  740. beforeCreated() { },
  741. //生命周期-挂载之前
  742. beforeMount() { },
  743. //生命周期-更新之前
  744. beforUpdate() { },
  745. //生命周期-更新之后
  746. updated() { },
  747. //生命周期-销毁之前
  748. beforeDestory() { },
  749. //生命周期-销毁完成
  750. destoryed() { },
  751. //如果页面有keep-alive缓存功能,这个函数会触发
  752. activated() { }
  753. }
  754. </script>
  755. <style lang="scss" scoped>
  756. /* @import url(); 引入css类 */
  757. .create-top{
  758. background: #FFFFFF;
  759. border-radius: 4px;
  760. padding: 24px;
  761. .common-title-box{
  762. margin-bottom: 4px;
  763. }
  764. }
  765. .create-bottom{
  766. padding: 40px 40px;
  767. margin-top: 16px;
  768. background: #FFFFFF;
  769. border-radius: 4px;
  770. height: calc(100vh - 292px);
  771. overflow: auto;
  772. .tips{
  773. margin: 0;
  774. color: #86909C;
  775. font-size: 12px;
  776. line-height: 20px;
  777. }
  778. .step-table{
  779. border: 1px solid #E5E6EB;
  780. border-collapse: collapse;
  781. font-size: 14px;
  782. line-height: 22px;
  783. color: #1D2129;
  784. text-align: center;
  785. margin-bottom: 24px;
  786. &-header{
  787. background: #F7F8FA;
  788. width: 120px !important;
  789. color: #86909C;
  790. font-weight: 500;
  791. }
  792. td{
  793. height: 40px;
  794. width: 260px;
  795. border: 1px solid #E5E6EB;
  796. &.td1{
  797. width: 130px;
  798. }
  799. }
  800. .step-cascader{
  801. width: 250px;
  802. height: 32px;
  803. line-height: 32px;
  804. }
  805. }
  806. .tpl-maintain{
  807. margin: 0 16px;
  808. color: #4F75FF;
  809. &:hover{
  810. text-decoration: underline;
  811. }
  812. }
  813. h6{
  814. color: #000;
  815. font-size: 16px;
  816. font-weight: 400;
  817. line-height: 24px;
  818. margin: 0 0 16px 0;
  819. }
  820. }
  821. .cover-box{
  822. position: relative;
  823. width: 200px;
  824. height: 280px;
  825. p{
  826. position: absolute;
  827. bottom: 0;
  828. left: 0;
  829. width: 100%;
  830. height: 280px;
  831. line-height: 280px;
  832. font-size: 20px;
  833. text-align: center;
  834. cursor: pointer;
  835. background: rgba(0, 0, 0, 0.3);
  836. color: #F2F3F5;
  837. margin: 0;
  838. }
  839. }
  840. .issue-channel{
  841. .issue-top{
  842. display: flex;
  843. justify-content: space-between;
  844. margin-bottom: 8px;
  845. &-left{
  846. margin: 0;
  847. color: #1D2129;
  848. font-size: 20px;
  849. font-weight: 500;
  850. line-height: 28px;
  851. span{
  852. margin-left: 4px;
  853. color: #86909C;
  854. font-size: 14px;
  855. font-weight: 400;
  856. line-height: 22px;
  857. }
  858. }
  859. }
  860. .channel-item{
  861. border: 1px solid #E5E6EB;
  862. margin: 12px 0;
  863. .channel-top{
  864. display: flex;
  865. padding: 9px 12px;
  866. align-items: center;
  867. .el-icon-caret-bottom,.el-icon-caret-top{
  868. color: #4E5969;
  869. width: 14px;
  870. height: 14px;
  871. cursor: pointer;
  872. }
  873. span{
  874. margin-left: 6px;
  875. flex: 1;
  876. cursor: pointer;
  877. word-break: break-word;
  878. color: #1D2129;
  879. font-size: 14px;
  880. font-weight: 400;
  881. line-height: 22px;
  882. }
  883. .el-button--text{
  884. padding: 2px 12px;
  885. color: #165DFF;
  886. .el-icon-plus{
  887. width: 12px;
  888. height: 12px;
  889. margin-right: 8px;
  890. font-weight: bold;
  891. }
  892. }
  893. }
  894. .article-list{
  895. margin: 0;
  896. padding: 8px;
  897. list-style: none;
  898. background: #F7F8FA;
  899. min-height: 44px;
  900. border-top: 1px solid #E5E6EB;
  901. li{
  902. padding: 13px 20px;
  903. border-bottom: 1px solid #E5E6EB;
  904. display: flex;
  905. align-items: center;
  906. .svg-icon{
  907. width: 16px;
  908. height: 16px;
  909. cursor: move;
  910. }
  911. .edit-article{
  912. cursor: pointer;
  913. }
  914. .items{
  915. flex: 1;
  916. margin: 0 16px;
  917. h6{
  918. font-size: 16px;
  919. font-weight: 500;
  920. line-height: 24px;
  921. margin-bottom: 2px;
  922. word-break: break-word;
  923. }
  924. span{
  925. color: #1D2129;
  926. font-size: 14px;
  927. font-weight: 400;
  928. line-height: 22px;
  929. margin-right: 8px;
  930. }
  931. }
  932. .border{
  933. height: 12px;
  934. width: 1px;
  935. display: block;
  936. background: #E5E6EB;
  937. margin: 0 8px;
  938. }
  939. .el-icon-delete{
  940. font-weight: bold;
  941. cursor: pointer;
  942. }
  943. }
  944. }
  945. }
  946. }
  947. </style>
  948. <style lang="scss">
  949. .newspaper-create{
  950. .validity-box{
  951. // width: 114px;
  952. .el-input-group{
  953. width: 114px;
  954. }
  955. .el-input__inner{
  956. text-align: center;
  957. }
  958. .el-input-group__append{
  959. border: none;
  960. background: #F2F3F5;
  961. padding: 0 8px 0 0;
  962. }
  963. }
  964. .iss-no-box{
  965. .el-form-item__content{
  966. display: flex;
  967. border-radius: 4px;
  968. width: 164px;
  969. }
  970. .el-input-group{
  971. width: 82px;
  972. flex-shrink: 0;
  973. border-radius: 0 4px 4px 0;
  974. overflow: hidden;
  975. }
  976. .el-input__inner{
  977. border-radius: 0;
  978. padding: 0;
  979. text-align: center;
  980. }
  981. .el-input-group__append{
  982. border: none;
  983. background: #F2F3F5;
  984. padding: 0;
  985. border-radius: 0;
  986. width: 34px;
  987. text-align: center;
  988. }
  989. .iss-start{
  990. &.el-input-group{
  991. border-radius: 4px 0 0 4px;
  992. }
  993. .el-input-group__append{
  994. width: 32px;
  995. }
  996. }
  997. }
  998. input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
  999. -webkit-appearance: none !important;
  1000. }
  1001. .el-divider{
  1002. width: 600px;
  1003. }
  1004. .price-box{
  1005. width: 300px;
  1006. display: inline-block;
  1007. .el-form-item__content{
  1008. position: relative;
  1009. .prepend,.append{
  1010. position: absolute;
  1011. left: 44px;
  1012. font-size: 14px;
  1013. line-height: 22px;
  1014. color: #1D2129;
  1015. line-height: 34px;
  1016. }
  1017. .append{
  1018. left: 142px;
  1019. }
  1020. }
  1021. }
  1022. .personal-ceil{
  1023. width: 200px;
  1024. .el-input__inner{
  1025. width: 200px;
  1026. padding: 0 60px;
  1027. }
  1028. }
  1029. }
  1030. </style>