|
@@ -110,7 +110,7 @@
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="4"
|
|
|
- readonly="readonly"
|
|
|
+ disabled
|
|
|
style="margin-top: 20px"
|
|
|
v-model="newspaperForm.chn_data_str">
|
|
|
</el-input>
|
|
@@ -186,45 +186,54 @@
|
|
|
</el-form>
|
|
|
</template>
|
|
|
<div v-if="stepIndex===1">
|
|
|
- <div class="issue-channel">
|
|
|
+ <div class="issue-channel" v-if="issueChannel">
|
|
|
<div class="issue-top">
|
|
|
<h4 class="issue-top-left">
|
|
|
栏目
|
|
|
- <span>共 {{issueChannel.channelNumber}} 个栏目 {{issueChannel.articleNumber}} 篇文章</span>
|
|
|
+ <span>共 {{issueChannel.chn_count}} 个栏目 {{issueChannel.art_count}} 篇文章</span>
|
|
|
</h4>
|
|
|
<el-button type="primary" size="small">预览</el-button>
|
|
|
</div>
|
|
|
- <div class="channel-item" v-for="(item,index) in issueChannel.channelList" :key="index">
|
|
|
+ <div class="channel-item" v-for="(item,index) in issueChannel.chn_art_data" :key="index">
|
|
|
<div class="channel-top">
|
|
|
<i class="el-icon-caret-bottom" v-if="item.show" @click="item.show=!item.show"></i>
|
|
|
<i class="el-icon-caret-top" v-else @click="item.show=!item.show"></i>
|
|
|
- <span @click="item.show=!item.show">{{item.channelName}}</span>
|
|
|
- <el-button type="text" @click="handleArticle('','en')"><i class="el-icon-plus"></i>新增英文内容</el-button>
|
|
|
- <el-button type="text" @click="handleArticle('','cn')"><i class="el-icon-plus"></i>新增中文内容</el-button>
|
|
|
+ <div class="channel-top-name">
|
|
|
+ <template v-if="!item.editFlag">
|
|
|
+ <span>{{item.chn_name}}</span>
|
|
|
+ <svg-icon icon-class="edit" class="edit-chn-name" @click="item.editFlag = true"></svg-icon>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-input v-model="item.edit_name"></el-input>
|
|
|
+ <svg-icon icon-class="save-line" class="edit-chn-name" @click="saveChnDate(item.edit_name,index)"></svg-icon>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <el-button type="text" @click="handleArticle('',1,item.chn_name)"><i class="el-icon-plus"></i>新增英文内容</el-button>
|
|
|
+ <el-button type="text" @click="handleArticle('',0,item.chn_name)"><i class="el-icon-plus"></i>新增中文内容</el-button>
|
|
|
</div>
|
|
|
<el-collapse-transition>
|
|
|
<template v-if="item.show">
|
|
|
<draggable
|
|
|
- v-model="item.articleList"
|
|
|
+ v-model="item.arts"
|
|
|
chosenClass="chosen"
|
|
|
forceFallback="true"
|
|
|
group="people"
|
|
|
animation="1000"
|
|
|
@start="onStart"
|
|
|
- @end="onEnd"
|
|
|
+ @end="onEnd()"
|
|
|
class="article-list"
|
|
|
>
|
|
|
- <li v-for="(itema,indexa) in item.articleList" :key="indexa">
|
|
|
+ <li v-for="(itema,indexa) in item.arts" :key="indexa">
|
|
|
<svg-icon icon-class="sort" draggable="true"></svg-icon>
|
|
|
<div class="items">
|
|
|
- <h6>{{itema.title}}</h6>
|
|
|
- <span>BY {{itema.author}}</span>
|
|
|
- <span>创建人:{{itema.creator}}</span>
|
|
|
- <span>{{itema.time}}</span>
|
|
|
+ <h6>{{itema.art_title}}</h6>
|
|
|
+ <span>BY {{itema.art_author}}</span>
|
|
|
+ <span>创建人:{{itema.creator_real_name||itema.creator_user_name}}</span>
|
|
|
+ <span>{{itema.create_time}}</span>
|
|
|
</div>
|
|
|
- <svg-icon icon-class="edit" class="edit-article" @click="handleArticle(itema.id,itema.type)"></svg-icon>
|
|
|
+ <svg-icon icon-class="edit" class="edit-article" @click="handleArticle(itema.id,itema.en_flag,item.chn_name)"></svg-icon>
|
|
|
<span class="border"></span>
|
|
|
- <i class="el-icon-delete" @click="handleDeleteArticle(item.articleList,indexa)"></i>
|
|
|
+ <i class="el-icon-delete" @click="handleDeleteArticle(item.arts,indexa,itema.id)"></i>
|
|
|
</li>
|
|
|
</draggable>
|
|
|
</template>
|
|
@@ -411,77 +420,7 @@ export default {
|
|
|
tplList: [], // 栏目列表
|
|
|
tabsList:['中英双语','少儿必读'],
|
|
|
issueId: '',
|
|
|
- issueChannel:{
|
|
|
- channelNumber: '12',
|
|
|
- articleNumber: '4',
|
|
|
- channelList:[
|
|
|
- {
|
|
|
- channelName: 'FRONT PAGE',
|
|
|
- articleList: [
|
|
|
- {
|
|
|
- title: 'Silly science',
|
|
|
- author: 'TEENS',
|
|
|
- creator: '张老师',
|
|
|
- time: '2012-12-12 12:23',
|
|
|
- id: '123',
|
|
|
- type: 'cn'
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Silly science1',
|
|
|
- author: 'TEENS',
|
|
|
- creator: '张老师',
|
|
|
- time: '2012-12-12 12:23',
|
|
|
- id: '123',
|
|
|
- type: 'en'
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Silly science2',
|
|
|
- author: 'TEENS',
|
|
|
- creator: '张老师',
|
|
|
- time: '2012-12-12 12:23',
|
|
|
- id: '123'
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Silly science3',
|
|
|
- author: 'TEENS',
|
|
|
- creator: '张老师',
|
|
|
- time: '2012-12-12 12:23'
|
|
|
- }
|
|
|
- ],
|
|
|
- show: true
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- {
|
|
|
- channelName: 'STORY LAND',
|
|
|
- articleList: [],
|
|
|
- show: false
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
+ issueChannel: null,
|
|
|
drag: false,
|
|
|
loading: false
|
|
|
}
|
|
@@ -510,7 +449,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
}else if(this.stepIndex===1){
|
|
|
- this.stepIndex++
|
|
|
+ this.handleEditIssue()
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -561,13 +500,19 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- handleDeleteArticle(item,i){
|
|
|
+ handleDeleteArticle(item,i,id){
|
|
|
this.$confirm("确定删除吗?", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
item.splice(i, 1);
|
|
|
+ getLogin('/PaperServer/Manager/ArticleManager/DeleteArticle', {id:id})
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.vendorList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
},
|
|
|
// 去掉前后空格
|
|
@@ -653,18 +598,82 @@ export default {
|
|
|
chn_data: JSON.parse(form.chn_data),
|
|
|
with_addon_flag: form.with_addon_flag
|
|
|
}
|
|
|
- if(this.id){
|
|
|
- MethodName = "/PaperServer/Manager/IssueManager/EditIssue"
|
|
|
- data.id = this.id
|
|
|
+ if(this.id||this.issueId){
|
|
|
+ this.loading = false
|
|
|
+ this.stepIndex++
|
|
|
+ return false
|
|
|
}
|
|
|
getLogin(MethodName, data)
|
|
|
.then((res) => {
|
|
|
this.loading = false
|
|
|
if(res.status===1){
|
|
|
- window.localStorage.removeItem('newsForm')
|
|
|
- window.localStorage.removeItem('newsStep')
|
|
|
- this.issueId = res.data.id
|
|
|
- this.stepIndex++
|
|
|
+ window.localStorage.removeItem('newsForm')
|
|
|
+ window.localStorage.removeItem('newsStep')
|
|
|
+ this.issueId = res.data.id
|
|
|
+ this.stepIndex++
|
|
|
+ let chn_art_data = JSON.parse(JSON.stringify(res.data.chn_art_data))
|
|
|
+ chn_art_data.forEach((item,index)=>{
|
|
|
+ if(index===0){
|
|
|
+ item.show = true
|
|
|
+ }else{
|
|
|
+ item.show = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.issueChannel = {
|
|
|
+ chn_count: res.data.chn_count,
|
|
|
+ art_count: res.data.art_count,
|
|
|
+ chn_art_data: chn_art_data
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleEditIssue(){
|
|
|
+ this.loading = true
|
|
|
+ let MethodName = "/PaperServer/Manager/IssueManager/EditIssue";
|
|
|
+ let form = this.newspaperForm
|
|
|
+ let data = {
|
|
|
+ iss_cover_id: form.cover_image_id,
|
|
|
+ iss_name: form.iss_name,
|
|
|
+ vendor_name: form.vendor_name,
|
|
|
+ release_date: form.release_date,
|
|
|
+ comb_flag: form.comb_flag,
|
|
|
+ iss_no:form.comb_flag===0?form.iss_no:form.iss_no_start,
|
|
|
+ study_phase: form.study_phase,
|
|
|
+ vl_id: form.vl_id,
|
|
|
+ iss_price_org: form.iss_price_org,
|
|
|
+ iss_price_sell: this.newspaperForm.has_discount===1?form.iss_price_sell:form.iss_price_org,
|
|
|
+ with_addon_price_org: form.with_addon_price_org,
|
|
|
+ with_addon_price_sell: this.newspaperForm.has_discount_addon===1?form.with_addon_price_sell:form.with_addon_price_org,
|
|
|
+ iss_note: form.iss_note,
|
|
|
+ info_tag_data: form.info_tag_data,
|
|
|
+ chn_data: JSON.parse(form.chn_data),
|
|
|
+ with_addon_flag: form.with_addon_flag,
|
|
|
+ id: this.id?this.id:this.issueId,
|
|
|
+ chn_art_data: this.issueChannel.chn_art_data
|
|
|
+ }
|
|
|
+ getLogin(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if(res.status===1){
|
|
|
+ window.localStorage.removeItem('newsForm')
|
|
|
+ window.localStorage.removeItem('newsStep')
|
|
|
+ this.stepIndex++
|
|
|
+ let chn_art_data = JSON.parse(JSON.stringify(res.data.chn_art_data))
|
|
|
+ chn_art_data.forEach((item,index)=>{
|
|
|
+ if(index===0){
|
|
|
+ item.show = true
|
|
|
+ }else{
|
|
|
+ item.show = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.issueChannel = {
|
|
|
+ chn_count: res.data.chn_count,
|
|
|
+ art_count: res.data.art_count,
|
|
|
+ chn_art_data: chn_art_data
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -674,7 +683,7 @@ export default {
|
|
|
getInfo(){
|
|
|
let MethodName = "/PaperServer/Manager/IssueManager/FindIssueById"
|
|
|
let data = {
|
|
|
- id: this.id
|
|
|
+ id: this.id?this.id:this.issueId
|
|
|
}
|
|
|
getLogin(MethodName, data)
|
|
|
.then((res) => {
|
|
@@ -685,18 +694,26 @@ export default {
|
|
|
this.newspaperForm.chn_data_str = JSON.parse(res.data.chn_data).join('\n')
|
|
|
this.newspaperForm.cover_image_id = res.data.iss_cover_id
|
|
|
this.newspaperForm.iss_no_start = res.data.iss_no
|
|
|
- getLogin('/FileServer/GetFileInfo', {
|
|
|
- file_id: res.data.iss_cover_id
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if(res.status===1){
|
|
|
- this.newspaperForm.cover_image_url = res.file_url
|
|
|
- this.$forceUpdate()
|
|
|
+ if(res.data.iss_cover_id){
|
|
|
+ if(res.data.iss_cover_id.indexOf('http')===-1){
|
|
|
+ getLogin('/FileServer/GetFileInfo', {
|
|
|
+ file_id: res.data.iss_cover_id
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.newspaperForm.cover_image_url = res.file_url
|
|
|
+ this.$forceUpdate()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.newspaperForm.cover_image_url = res.data.iss_cover_id
|
|
|
}
|
|
|
- })
|
|
|
- this.newspaperForm.cover_image_list.push[{
|
|
|
- id: res.data.iss_cover_id
|
|
|
- }]
|
|
|
+
|
|
|
+ this.newspaperForm.cover_image_list.push[{
|
|
|
+ id: res.data.iss_cover_id
|
|
|
+ }]
|
|
|
+ }
|
|
|
+
|
|
|
if(res.data.iss_price_org===res.data.iss_price_sell){
|
|
|
this.$set(this.newspaperForm,'has_discount',0)
|
|
|
}else{
|
|
@@ -707,21 +724,41 @@ export default {
|
|
|
}else{
|
|
|
this.$set(this.newspaperForm,'has_discount_addon',1)
|
|
|
}
|
|
|
+ let chn_art_data = JSON.parse(JSON.stringify(res.data.chn_art_data))
|
|
|
+ chn_art_data.forEach((item,index)=>{
|
|
|
+ if(!item.hasOwnProperty('arts')){
|
|
|
+ this.$set(item,'arts',[])
|
|
|
+ }
|
|
|
+ item.editFlag = false
|
|
|
+ item.edit_name = item.chn_name
|
|
|
+ if(index===0){
|
|
|
+ item.show = this.issueChannel&&this.issueChannel.chn_art_data&&this.issueChannel.chn_art_data[index]?this.issueChannel.chn_art_data[index].show:true
|
|
|
+ }else{
|
|
|
+ item.show = this.issueChannel&&this.issueChannel.chn_art_data&&this.issueChannel.chn_art_data[index]?this.issueChannel.chn_art_data[index].show:false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.issueChannel = {
|
|
|
+ chn_count: res.data.chn_count,
|
|
|
+ art_count: res.data.art_count,
|
|
|
+ chn_art_data: chn_art_data
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
});
|
|
|
},
|
|
|
// 跳转文章
|
|
|
- handleArticle(id,type){
|
|
|
+ handleArticle(id,type,name){
|
|
|
window.localStorage.setItem('newsForm',JSON.stringify(this.newspaperForm))
|
|
|
window.localStorage.setItem('newsStep',1)
|
|
|
this.$router.push({
|
|
|
path:'/createArticle',
|
|
|
query: {
|
|
|
id: id,
|
|
|
- type: type,
|
|
|
- articleId: this.id
|
|
|
+ en_flag: type?type:0,
|
|
|
+ issueId: this.id?this.id:this.issueId,
|
|
|
+ chn_name: name,
|
|
|
+ isCreate: !this.id?true:''
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -732,7 +769,37 @@ export default {
|
|
|
//拖拽结束事件
|
|
|
onEnd() {
|
|
|
this.drag = false;
|
|
|
+ this.issueChannel.chn_art_data.forEach((item)=>{
|
|
|
+ if(item.arts&&item.arts.length>0){
|
|
|
+ item.arts.forEach((items,indexs)=>{
|
|
|
+ items.art_idx = indexs
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.handleUpdateChnArtData()
|
|
|
+ },
|
|
|
+ // 更新栏目数据
|
|
|
+ handleUpdateChnArtData(){
|
|
|
+ getLogin('/PaperServer/Manager/IssueManager/EditIssueChnArtData', {
|
|
|
+ chn_art_data: this.issueChannel.chn_art_data,
|
|
|
+ id: this.id?this.id:this.issueId
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.getInfo()
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
+ saveChnDate(value,index){
|
|
|
+ // 判断是否有值并且trim
|
|
|
+ if(value&&value.trim()){
|
|
|
+ this.issueChannel.chn_art_data[index].chn_name = value.trim()
|
|
|
+ this.onEnd()
|
|
|
+ }else{
|
|
|
+ this.$message.warning('栏目名称不能为空')
|
|
|
+ }
|
|
|
+ // if(this.issueChannel.chn_art_data[index].)
|
|
|
+ }
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
async created() {
|
|
@@ -879,7 +946,8 @@ export default {
|
|
|
margin: 12px 0;
|
|
|
.channel-top{
|
|
|
display: flex;
|
|
|
- padding: 9px 12px;
|
|
|
+ padding: 0 12px;
|
|
|
+ height: 42px;
|
|
|
align-items: center;
|
|
|
.el-icon-caret-bottom,.el-icon-caret-top{
|
|
|
color: #4E5969;
|
|
@@ -887,15 +955,18 @@ export default {
|
|
|
height: 14px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
- span{
|
|
|
+ &-name{
|
|
|
margin-left: 6px;
|
|
|
flex: 1;
|
|
|
- cursor: pointer;
|
|
|
word-break: break-word;
|
|
|
color: #1D2129;
|
|
|
font-size: 14px;
|
|
|
font-weight: 400;
|
|
|
line-height: 22px;
|
|
|
+ .edit-chn-name{
|
|
|
+ margin-left: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
}
|
|
|
.el-button--text{
|
|
|
padding: 2px 12px;
|
|
@@ -927,6 +998,9 @@ export default {
|
|
|
}
|
|
|
.edit-article{
|
|
|
cursor: pointer;
|
|
|
+ padding: 8px;
|
|
|
+ width: 32px;
|
|
|
+ height: 32px;
|
|
|
}
|
|
|
.items{
|
|
|
flex: 1;
|
|
@@ -951,11 +1025,11 @@ export default {
|
|
|
width: 1px;
|
|
|
display: block;
|
|
|
background: #E5E6EB;
|
|
|
- margin: 0 8px;
|
|
|
}
|
|
|
.el-icon-delete{
|
|
|
font-weight: bold;
|
|
|
cursor: pointer;
|
|
|
+ padding: 8px;
|
|
|
}
|
|
|
}
|
|
|
}
|