Commit 41b0e7e6 authored by zhanglw's avatar zhanglw

微信群

parent 997da0cd
......@@ -54,6 +54,30 @@ export const HttpReq = {
return res
})
},
getWeixinlinkList: function(params) {
return request({
url: 'weixinlink/getAll?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
addWeixinlink: function(data) {
return request({
url: 'weixinlink/add',
method: 'post',
data: data
}).then((res) => {
return res
})
},
updateWeixinlink: function(data) {
return request({
url: 'weixinlink/update',
method: 'post',
data: data
}).then((res) => {
return res
})
},
api: null
},
// web端接口列表
......
<template>
<!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="900px">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="选择分类:" class="form-cell" style="margin: 0">
<div class="cell-box" style="display: flex">
<el-form-item prop="type">
<el-select v-model="formData.type" placeholder="请选择">
<el-option v-for="item in dict.tools_class" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="软件工具名称:" class="form-cell" prop="title">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="140px">
<el-form-item label="微信群名称:" class="form-cell" prop="title">
<div class="cell-box">
<el-input v-model="formData.name" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="标签:" class="form-cell" prop="tag">
<div class="cell-box">
<el-tag
v-for="tag in feature"
:key="tag"
closable
size="small"
:disable-transitions="false"
@close="handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
v-show="inputVisible"
ref="saveTagInput"
v-model="inputValue"
class="input-new-tag"
placeholder="请输入特点标签文本"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
/>
<el-button v-show="!inputVisible && feature.length < 3" plain round class="button-new-tag" icon="el-icon-price-tag" @click="showInput">添加</el-button>
</div>
</el-form-item>
<el-form-item label="介绍说明:" class="form-cell" prop="notes">
<el-form-item label="排序:" class="form-cell" prop="title">
<div class="cell-box">
<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.url" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="上传软件工具:" class="form-cell">
<div class="cell-box">
<el-upload
ref="uploadApp"
:before-upload="beforeUpload"
:headers="uploadHeaders"
:on-success="handleSuccessEXE"
:on-error="handleError"
: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>
<el-input v-model="formData.sort" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="上传LOGO:" class="form-cell">
<el-form-item label="图片二维码:" class="form-cell">
<div class="cell-box">
<el-upload
ref="uploadLogo"
......@@ -81,7 +26,7 @@
<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>
<span v-show="formData.image">存放位置:..{{ formData.image }}</span>
</div>
</el-form-item>
</el-form>
......@@ -96,12 +41,10 @@ import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common'
export default {
dicts: ['tools_class'],
dicts: ['advert_type'],
data() {
return {
uploadHeaders: { 'Authorization': getToken() },
dialogImgUrl: '',
dialogImgVisible: false,
visible: false,
title: '上传小工具',
feature: [],
......@@ -109,13 +52,9 @@ export default {
inputValue: '',
formData: {
id: null,
name: '', // 标题
type: '1', // 类型
tag: '',
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
name: '', // 名称
image: '', // 图片链接
sort: '' // 顺序
},
rules: {}
}
......@@ -132,19 +71,9 @@ export default {
}
return isLt2M
},
handleSuccessEXE(res, file, fileList) {
this.$nextTick(() => {
this.formData.link = '/file/' + res.type + '/' + res.realName
this.$notify({
title: '上传成功!',
type: 'success',
duration: 2500
})
})
},
handleSuccessLOGO(res, file, fileList) {
this.$nextTick(() => {
this.formData.imagelink = '/file/' + res.type + '/' + res.realName
this.formData.image = '/file/' + res.type + '/' + res.realName
this.$notify({
title: '上传成功!',
type: 'success',
......@@ -160,33 +89,10 @@ export default {
duration: 2500
})
},
// 标签
handleClose(tag) {
this.feature.splice(this.feature.indexOf(tag), 1)
this.formData.tag = this.feature.join(';')
},
showInput() {
this.inputVisible = true
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus()
})
},
handleInputConfirm() {
const inputValue = this.inputValue
if (inputValue && !this.feature.filter(item => { return item === inputValue }).length) {
this.feature.push(inputValue)
this.formData.tag = this.feature.join(';')
}
this.inputValue = ''
this.inputVisible = false
},
showView() {
this.visible = true
},
hideView() {
if (this.$refs.uploadApp) {
this.$refs.uploadApp.clearFiles()
}
if (this.$refs.uploadLogo) {
this.$refs.uploadLogo.clearFiles()
}
......@@ -197,28 +103,37 @@ export default {
this.hideView()
this.formData = {
id: null,
name: '', // 标题
type: '1', // 类型
tag: '',
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
name: '', // 名称
image: '', // 图片链接
sort: '' // 顺序
}
},
submitForm() {
this.$refs.formViewRef.validate((valid, obj) => {
if (valid) {
HttpReq.backstageApi.addApp(this.formData).then((res) => {
this.$notify({
title: res.message,
type: res.code === 200 ? 'success' : 'error'
if (this.formData.id) {
HttpReq.backstageApi.updateWeixinlink(this.formData).then((res) => {
this.$notify({
title: res.message,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
} else {
HttpReq.backstageApi.addWeixinlink(this.formData).then((res) => {
this.$notify({
title: res.message,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
}
} else {
this.$message({
message: '表单信息有误,请核对无误后提交!',
......@@ -230,7 +145,9 @@ export default {
loadData(item) {
this.showView()
this.$nextTick(() => {
if (item) {
this.formData = item
}
})
}
}
......
......@@ -2,14 +2,7 @@
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-input v-model="query.name" clearable placeholder="请输入工具名称" style="width:280px;" />
<el-select v-model="query.type" clearable placeholder="请选择分类" style="width: 150px">
<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.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>
<el-input v-model="query.name" clearable placeholder="请输入微信群名称" style="width:280px;" />
<el-date-picker
v-model="query.start"
type="date"
......@@ -24,12 +17,9 @@
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
<div class="toolbar">
<div>
<el-button type="danger" icon="el-icon-download" :disabled="!multipleSelection.length" @click="batchOperate(1, null)">下架</el-button>
<el-button type="success" icon="el-icon-finished" :disabled="!multipleSelection.length" @click="batchOperate(0, null)">上架</el-button>
</div>
<div />
<div style="text-align: right">
<el-button type="primary" icon="el-icon-upload2" @click="toAdd">上传app</el-button>
<el-button type="primary" icon="el-icon-plus" @click="toAdd">新增微信群</el-button>
</div>
</div>
<!-- 表格 -->
......@@ -38,22 +28,12 @@
<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="小工具名称" 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 prop="score" label="下载分数" />
<el-table-column prop="tcount" label="点击数" />
<el-table-column label="是否可下载">
<template slot-scope="scope">
{{ scope.row.download==='0'?'':'' }}
</template>
</el-table-column>
<el-table-column prop="ifUp" label="状态" width="100" />
<el-table-column prop="name" label="微信群名称" />
<el-table-column prop="sort" 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">
<el-tooltip content="下架"><el-button round plain type="danger" icon="el-icon-download" @click="batchOperate(1, scope.row)" /></el-tooltip>
<el-tooltip content="上架"><el-button round plain type="success" icon="el-icon-finished" @click="batchOperate(0, scope.row)" /></el-tooltip>
<el-button round @click="toEdit(scope.row)">调整顺序</el-button>
</template>
</el-table-column>
</el-table>
......@@ -102,7 +82,7 @@ export default {
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
})
HttpReq.backstageApi.getAppAll({
HttpReq.backstageApi.getWeixinlinkList({
pageNum: this.page,
pageSize: this.pageSize,
...this.query
......
......@@ -41,6 +41,13 @@ module.exports = {
'^/word': 'word'
}
},
'/weixinlink': {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/weixinlink': 'weixinlink'
}
},
'/api': {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
......
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