Commit c2b9f592 authored by zhanglw's avatar zhanglw

x

parent 35968a8a
......@@ -5,9 +5,9 @@ export const HttpReq = {
// 后台管理接口列表
backstageApi: {
// 获取所有软件工具
getApp: function(data) {
addApp: function(data) {
return request({
url: 'apps/getApp',
url: 'apps/add',
method: 'post',
data: data
}).then((res) => {
......
......@@ -13,10 +13,10 @@
</el-form-item>
<el-form-item label="软件工具名称:" class="form-cell" prop="title">
<div class="cell-box">
<el-input v-model="formData.title" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.name" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="标签:" class="form-cell" prop="feature">
<el-form-item label="标签:" class="form-cell" prop="tag">
<div class="cell-box">
<el-tag
v-for="tag in feature"
......@@ -42,12 +42,12 @@
</el-form-item>
<el-form-item label="介绍说明:" class="form-cell" prop="notes">
<div class="cell-box">
<el-input v-model="formData.contentAbstract" type="textarea" placeholder="请输入文本" maxlength="300" :autosize="{ minRows: 4, maxRows: 4}" show-word-limit resize="none" class="cell-input" />
<el-input v-model="formData.remark" type="textarea" placeholder="请输入文本" maxlength="300" :autosize="{ minRows: 4, maxRows: 4}" show-word-limit resize="none" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="web页面地址:" class="form-cell" prop="title">
<div class="cell-box">
<el-input v-model="formData.title" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.url" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="上传软件工具:" class="form-cell">
......@@ -55,16 +55,16 @@
<el-upload
ref="uploadApp"
:before-upload="beforeUpload"
:auto-upload="false"
:headers="uploadHeaders"
:on-success="handleSuccess"
:on-success="handleSuccessEXE"
:on-error="handleError"
action="/api/miningManagement/uploadExcelOrFbx"
:data="{}"
:limit="1"
action="/api/localStorage"
>
<div class="eladmin-upload"><i class="el-icon-upload" /> 添加.exe文件 </div>
<div slot="tip" class="el-upload__tip">请上传文件,且不超过20M</div>
</el-upload>
<span v-show="formData.link">存放位置:..{{ formData.link }}</span>
</div>
</el-form-item>
<el-form-item label="上传LOGO:" class="form-cell">
......@@ -72,19 +72,18 @@
<el-upload
ref="uploadLogo"
:before-upload="beforeUpload"
:auto-upload="false"
:headers="uploadHeaders"
:on-success="handleSuccess"
:on-success="handleSuccessLOGO"
:on-error="handleError"
action="/api/miningManagement/uploadExcelOrFbx"
:data="{}"
:limit="1"
action="/api/localStorage/pictures"
>
<div class="eladmin-upload"><i class="el-icon-upload" /> 添加.gif/jpg/jpeg文件 </div>
<div slot="tip" class="el-upload__tip">请上传文件,且不超过20M</div>
</el-upload>
<span v-show="formData.imagelink">存放位置:..{{ formData.imagelink }}</span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button>
......@@ -110,13 +109,12 @@ export default {
inputValue: '',
formData: {
id: null,
title: '', // 标题
name: '', // 标题
type: '1', // 类型
subType: '1',
source: '', // 来源
content: '', // 内容
picture: '', // 图片
contentAbstract: '', // 摘要
tag: '',
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
},
rules: {}
......@@ -126,28 +124,33 @@ export default {
},
methods: {
// 上传
upload() {
this.$refs.uploadApp.submit()
this.$refs.uploadLogo.submit()
},
beforeUpload(file) {
let isLt2M = true
isLt2M = file.size / 1024 / 1024 < 20
if (!isLt2M) {
this.loading = false
this.$message.error('上传文件大小不能超过 100MB!')
}
return isLt2M
},
handleSuccess(res, file, fileList) {
handleSuccessEXE(res, file, fileList) {
this.$nextTick(() => {
this.formData.link = '/file/' + res.type + '/' + res.realName
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
title: '上传成功!',
type: 'success',
duration: 2500
})
if (res.code === 200) {
this.cancelView()
}
})
},
handleSuccessLOGO(res, file, fileList) {
this.$nextTick(() => {
this.formData.imagelink = '/file/' + res.type + '/' + res.realName
this.$notify({
title: '上传成功!',
type: 'success',
duration: 2500
})
})
},
handleError(e, file, fileList) {
const msg = JSON.parse(e.message)
......@@ -156,12 +159,11 @@ export default {
type: 'error',
duration: 2500
})
this.loading = false
},
// 标签
handleClose(tag) {
this.feature.splice(this.feature.indexOf(tag), 1)
this.formData.feature = this.feature.join(';')
this.formData.tag = this.feature.join(';')
},
showInput() {
this.inputVisible = true
......@@ -173,7 +175,7 @@ export default {
const inputValue = this.inputValue
if (inputValue && !this.feature.filter(item => { return item === inputValue }).length) {
this.feature.push(inputValue)
this.formData.feature = this.feature.join(';')
this.formData.tag = this.feature.join(';')
}
this.inputValue = ''
this.inputVisible = false
......@@ -193,41 +195,30 @@ export default {
},
cancelView() {
this.hideView()
this.formData = {
id: null,
name: '', // 标题
type: '1', // 类型
tag: '',
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
}
},
submitForm(isRelease) {
submitForm() {
this.$refs.formViewRef.validate((valid, obj) => {
if (valid) {
if (this.formData.newsPageId) {
HttpReq.backstageApi.updateNewsPage(this.formData).then((res) => {
HttpReq.backstageApi.addApp(this.formData).then((res) => {
this.$notify({
title: res.msg,
title: res.message,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
} else {
HttpReq.backstageApi.addNewsPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
}
} else {
this.$message({
message: '表单信息有误,请核对无误后提交!',
......
......@@ -7,10 +7,19 @@
<el-option v-for="item in dict.tools_class" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="query.tag" clearable placeholder="请输入标签名称" style="width:280px;" />
<el-select v-model="query.download" clearable placeholder="请选择状态" style="width: 150px">
<el-select v-model="query.ifUp" clearable placeholder="请选择状态" style="width: 150px">
<el-option v-for="item in dict.norm_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<date-range-picker v-model="query.uploadtime" size="mini" start-placeholder="上架开始日期" style="width: 320px" />
<el-date-picker
v-model="query.start"
type="date"
placeholder="选择开始日期"
/>
<el-date-picker
v-model="query.end"
type="date"
placeholder="选择结束日期"
/>
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
......@@ -28,15 +37,18 @@
<el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="id" label="ID" width="100" />
<el-table-column prop="name" label="小工具名称" />
<!-- <el-table-column prop="id" label="ID" width="100" />-->
<el-table-column prop="name" label="小工具名称" width="500" />
<el-table-column prop="type" label="分类" width="140" :formatter="(row, col, val)=>{return dict.label.tools_class[val]}" />
<el-table-column prop="tag" label="标签" />
<el-table-column label="状态" width="100">
<el-table-column prop="score" label="下载分数" />
<el-table-column prop="tcount" label="点击数" />
<el-table-column label="是否可下载">
<template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.norm_status[scope.row.download] }}</div>
{{ scope.row.download==='0'?'':'' }}
</template>
</el-table-column>
<el-table-column prop="ifUp" label="状态" width="100" />
<el-table-column prop="uploadtime" label="最后维护日期" align="center" width="180" />
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
......@@ -53,11 +65,10 @@
</template>
<script>
import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker'
import addPage from './add'
export default {
components: { DateRangePicker, addPage },
components: { addPage },
dicts: ['norm_status', 'tools_class'],
data() {
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment