|
|
@@ -5,58 +5,78 @@
|
|
|
@selection-change="handleSelectionChange" @row-click="handleExpand">
|
|
|
<el-table-column type="expand">
|
|
|
<template slot-scope="scope">
|
|
|
- <img :src="scope.row.IMAGE" :alt="scope.row.TITLE">
|
|
|
+ <a v-if="scope.row.TYPE === '1'" :href="getHref(scope.row.CONTENT)" target="_blank" class="islide">
|
|
|
+ <img :src="getImage(scope.row.IMAGE)" width="100px" height="100px" :alt="scope.row.TITLE">
|
|
|
+ </a>
|
|
|
+ <router-link v-else :to="`/article/detail/${scope.row.CONTENT}`" target="_blank" class="islide">
|
|
|
+ <img :src="getImage(scope.row.IMAGE)" width="100px" height="100px" :alt="scope.row.TITLE">
|
|
|
+ </router-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
|
- <el-table-column label="广告标题" prop="TITLE" width="250">
|
|
|
+ <el-table-column label="Ad Title" prop="TITLE" width="250"> <!-- 广告标题 -->
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag type="" size="small" class="no-border">{{scope.row.TITLE}}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="广告位" width="150">
|
|
|
+ <el-table-column label="Ad Location" width="150"> <!-- 广告位 -->
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag type="warning" size="small" class="no-border">{{allData.allLocation[scope.row.LID].LOCATION_NAME}}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="类型">
|
|
|
+ <el-table-column label="Type"> <!-- 类型 -->
|
|
|
<template slot-scope="scope">
|
|
|
<template v-if="scope.row.TYPE === '1'">
|
|
|
- <el-tag type="success">外链</el-tag>
|
|
|
+ <el-tag type="success">External Links</el-tag> <!-- 外链 -->
|
|
|
</template>
|
|
|
<template v-else-if="scope.row.TYPE === '2'">
|
|
|
- <el-tag>文章</el-tag>
|
|
|
+ <el-tag>Article</el-tag> <!-- 文章 -->
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="连接或文章ID" prop="CONTENT" width="120"></el-table-column>
|
|
|
- <el-table-column label="排序" width="100">
|
|
|
+ <el-table-column label="Content" prop="CONTENT" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="scope.row.TYPE === '1'">
|
|
|
+ <el-link type="primary" target="_blank" :href="getHref(scope.row.CONTENT)">{{ scope.row.CONTENT }}</el-link>
|
|
|
+ </div><!-- 链接 -->
|
|
|
+ <div v-else-if="scope.row.TYPE === '2'">
|
|
|
+ <router-link :to="`/article/detail/${scope.row.CONTENT}`" target="_blank" style="cursor: pointer;">{{ getContent(scope.row.CONTENT) }}</router-link>
|
|
|
+ </div><!-- 文章 -->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="Sort" width="100"> <!-- 排序 -->
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.SORT" min="0" max="99" @change="handleChangeSort(scope.row, scope.row.SORT)"
|
|
|
@click.native.stop=""></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="创建人">
|
|
|
+ <el-table-column label="Creator"> <!-- 创建人 -->
|
|
|
<template slot-scope="scope">
|
|
|
{{scope.row.CREATE_ADMIN_NAME}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="创建时间" width="180">
|
|
|
+ <el-table-column label="Created Time" width="180"> <!-- 创建时间 -->
|
|
|
<template slot-scope="scope">
|
|
|
{{tool.formatDate(scope.row.CREATED_AT)}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="修改人">
|
|
|
+ <el-table-column label="Modified By"> <!-- 修改人 -->
|
|
|
<template slot-scope="scope">
|
|
|
{{scope.row.UPDATE_ADMIN_NAME}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="修改时间" width="180">
|
|
|
+ <el-table-column label="Modified Time" width="180"> <!-- 修改时间 -->
|
|
|
<template slot-scope="scope">
|
|
|
{{tool.formatDate(scope.row.UPDATED_AT)}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" label="操作" width="180">
|
|
|
+ <el-table-column label="Status"> <!-- 状态 -->
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="scope.row.STATUS === '1'">Show</div>
|
|
|
+ <div v-else>Hide</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" label="Action" width="180"> <!-- 操作 -->
|
|
|
<template slot-scope="scope">
|
|
|
<el-dropdown size="small" trigger="click" v-if="permission.hasPermission(`ad/ad-delete`) || permission.hasPermission(`ad/edit`)">
|
|
|
<el-button type="primary" size="small" @click.stop="">
|
|
|
@@ -65,6 +85,8 @@
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="edit" @click.native="handleEdit(scope.row)" v-if="permission.hasPermission(`ad/edit`)">Edit</el-dropdown-item>
|
|
|
<el-dropdown-item command="delete" @click.native="handleDelete(scope.row)" v-if="permission.hasPermission(`ad/ad-delete`)">Delete</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="hide" @click.native="handleHide(scope.row)" v-if="permission.hasPermission(`ad/ad-hide`)">Hide</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="un-hide" @click.native="handleUnHide(scope.row)" v-if="permission.hasPermission(`ad/ad-un-hide`)">UnHide</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</template>
|
|
|
@@ -77,9 +99,11 @@
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="delete" @click.native="handleMuliDel()">Delete</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="hide" @click.native="handleMultiHide()">Hide</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">UnHide</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
- <el-button type="primary" size="small" @click="handleAdd" icon="el-icon-plus" v-if="permission.hasPermission(`ad/add`)">添加广告</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="handleAdd" icon="el-icon-plus" v-if="permission.hasPermission(`ad/add`)">Add Ad</el-button>
|
|
|
<pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -93,6 +117,8 @@ import tool from '@/utils/tool'
|
|
|
import store from '@/utils/vuexStore'
|
|
|
import permission from '@/utils/permission'
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
+import {SERVER_API_HTTP_TYPE,SERVER_API_DOMAIN} from '@/utils/config'
|
|
|
+import article from "../article";
|
|
|
|
|
|
export default {
|
|
|
name: 'ad_list',
|
|
|
@@ -112,6 +138,7 @@ export default {
|
|
|
pageSize: 20,
|
|
|
tool: tool,
|
|
|
permission: permission,
|
|
|
+ allArticle: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -136,9 +163,21 @@ export default {
|
|
|
handleDelete (row) {
|
|
|
this.delData(row.ID)
|
|
|
},
|
|
|
+ handleHide (row) {
|
|
|
+ this.hideData(row.ID)
|
|
|
+ },
|
|
|
+ handleUnHide(row) {
|
|
|
+ this.unHideData(row.ID)
|
|
|
+ },
|
|
|
handleMuliDel () {
|
|
|
this.delData()
|
|
|
},
|
|
|
+ handleMultiHide () {
|
|
|
+ this.hideData()
|
|
|
+ },
|
|
|
+ handleMultiUnHide () {
|
|
|
+ this.unHideData()
|
|
|
+ },
|
|
|
handleChangeSort (row, sort) {
|
|
|
network.getData('/ad/sort', {id: row.ID, sort: sort}).then(response => {
|
|
|
this.getData(this.currentPage, this.pageSize)
|
|
|
@@ -149,11 +188,12 @@ export default {
|
|
|
let obj = this
|
|
|
network.getPageData(this, `ad/list/${this.$route.params.lid}`, page, pageSize, null, function (response) {
|
|
|
obj.allData = response
|
|
|
+ obj.allArticle = response.allArticle
|
|
|
})
|
|
|
},
|
|
|
delData (id = null) {
|
|
|
let obj = this
|
|
|
- obj.$confirm('确定删除选定的数据?', 'Notice', {
|
|
|
+ obj.$confirm('Are you sure to delete the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
confirmButtonText: 'confirm', // 确定
|
|
|
cancelButtonText: 'cancel', // 取消
|
|
|
type: 'warning'
|
|
|
@@ -180,6 +220,72 @@ export default {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
+ hideData (id = null) {
|
|
|
+ let obj = this
|
|
|
+ obj.$confirm('Are you sure to hide the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ let selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (let val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ return network.postData(`ad/ad-hide`, {
|
|
|
+ selected: selectedIds
|
|
|
+ })
|
|
|
+ }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getData(obj.currentPage, obj.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ unHideData (id = null) {
|
|
|
+ let obj = this
|
|
|
+ obj.$confirm('Are you sure to un-hide the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ let selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (let val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ return network.postData(`ad/ad-un-hide`, {
|
|
|
+ selected: selectedIds
|
|
|
+ })
|
|
|
+ }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getData(obj.currentPage, obj.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getImage(imageUrl) {
|
|
|
+ return imageUrl.indexOf('http') > -1 ? imageUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
|
|
|
+ },
|
|
|
+ getContent(aid) {
|
|
|
+ let titles = this.allArticle.filter(article => article.ID === aid).map(article => article.TITLE);
|
|
|
+ return titles.length > 0 ? titles[0] : aid;
|
|
|
+ },
|
|
|
+ getHref(link) {
|
|
|
+ return link.indexOf('http') > -1 ? link : 'http://' + link;
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
|