|
@@ -10,9 +10,15 @@
|
|
|
<div class="n">M</div>
|
|
|
<el-input class="i" v-model="moreText" placeholder="请输入内容"></el-input>
|
|
|
</div>
|
|
|
+ <div class="sn-op">
|
|
|
+ <div class="n">N</div>
|
|
|
+ <el-input class="i" v-model="newsUrl" placeholder="请输入链接"></el-input>
|
|
|
+ </div>
|
|
|
<div slot="footer">
|
|
|
<el-button class="xl-form-btn t1" @click="confirmHandle">保存</el-button>
|
|
|
- <el-button class="xl-form-btn t3" @click="addHandle">添加一条</el-button>
|
|
|
+ <el-button class="xl-form-btn t3" @click="unshiftHandle">前+1</el-button>
|
|
|
+ <el-button class="xl-form-btn t3" @click="addHandle">后+1</el-button>
|
|
|
+ <el-button class="xl-form-btn t4" @click="updateHandle">采集</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -24,31 +30,50 @@ export default {
|
|
|
return {
|
|
|
newsList: [],
|
|
|
moreText: '',
|
|
|
+ newsUrl: '',
|
|
|
}
|
|
|
},
|
|
|
computed: {},
|
|
|
created() {
|
|
|
- this.$api.other.admnewslist().then(res => {
|
|
|
- const allData = res || {}
|
|
|
- const newsList = allData.news || []
|
|
|
- this.newsList = newsList.map(item => {
|
|
|
- return {text: item}
|
|
|
- })
|
|
|
- this.moreText = allData.jt || ''
|
|
|
- })
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ fetchData () {
|
|
|
+ this.$api.other.admnewslist().then(res => {
|
|
|
+ const allData = res || {}
|
|
|
+ const newsList = allData.news || []
|
|
|
+ this.newsList = newsList.map(item => {
|
|
|
+ return {text: item}
|
|
|
+ })
|
|
|
+ this.moreText = allData.jt || ''
|
|
|
+ })
|
|
|
+ },
|
|
|
delHandle (index) {
|
|
|
let newsList = [...this.newsList]
|
|
|
newsList.splice(index, 1)
|
|
|
this.newsList = [...newsList]
|
|
|
},
|
|
|
+ unshiftHandle () {
|
|
|
+ let newsList = [...this.newsList]
|
|
|
+ newsList.unshift({text: ''})
|
|
|
+ this.newsList = [...newsList]
|
|
|
+ },
|
|
|
addHandle () {
|
|
|
let newsList = [...this.newsList]
|
|
|
newsList.push({text: ''})
|
|
|
this.newsList = [...newsList]
|
|
|
},
|
|
|
+ updateHandle () {
|
|
|
+ this.$msg(`您确定要采集吗?`, 'confirm', () => {
|
|
|
+ this.$api.other.admnewscollect({
|
|
|
+ link: this.newsUrl,
|
|
|
+ }).then(data => {
|
|
|
+ this.$msgs(`已采集!`)
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
confirmHandle() {
|
|
|
this.$msg(`您确定要保存吗?`, 'confirm', () => {
|
|
|
const news = this.newsList.map(item => {
|