Commit 41b0e7e6 authored by zhanglw's avatar zhanglw

微信群

parent 997da0cd
...@@ -54,6 +54,30 @@ export const HttpReq = { ...@@ -54,6 +54,30 @@ export const HttpReq = {
return res 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 api: null
}, },
// web端接口列表 // web端接口列表
......
<template> <template>
<!-- 表单渲染 --> <!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="900px"> <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 ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="140px">
<el-form-item label="选择分类:" class="form-cell" style="margin: 0"> <el-form-item label="微信群名称:" class="form-cell" prop="title">
<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">
<div class="cell-box"> <div class="cell-box">
<el-input v-model="formData.name" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.name" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="标签:" class="form-cell" prop="tag"> <el-form-item label="排序:" class="form-cell" prop="title">
<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">
<div class="cell-box"> <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" /> <el-input v-model="formData.sort" placeholder="单行输入" 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>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="上传LOGO:" class="form-cell"> <el-form-item label="图片二维码:" class="form-cell">
<div class="cell-box"> <div class="cell-box">
<el-upload <el-upload
ref="uploadLogo" ref="uploadLogo"
...@@ -81,7 +26,7 @@ ...@@ -81,7 +26,7 @@
<div class="eladmin-upload"><i class="el-icon-upload" /> 添加.gif/jpg/jpeg文件 </div> <div class="eladmin-upload"><i class="el-icon-upload" /> 添加.gif/jpg/jpeg文件 </div>
<div slot="tip" class="el-upload__tip">请上传文件,且不超过20M</div> <div slot="tip" class="el-upload__tip">请上传文件,且不超过20M</div>
</el-upload> </el-upload>
<span v-show="formData.imagelink">存放位置:..{{ formData.imagelink }}</span> <span v-show="formData.image">存放位置:..{{ formData.image }}</span>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -96,12 +41,10 @@ import { getToken } from '@/utils/auth' ...@@ -96,12 +41,10 @@ import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common' import { HttpReq } from '@/api/common'
export default { export default {
dicts: ['tools_class'], dicts: ['advert_type'],
data() { data() {
return { return {
uploadHeaders: { 'Authorization': getToken() }, uploadHeaders: { 'Authorization': getToken() },
dialogImgUrl: '',
dialogImgVisible: false,
visible: false, visible: false,
title: '上传小工具', title: '上传小工具',
feature: [], feature: [],
...@@ -109,13 +52,9 @@ export default { ...@@ -109,13 +52,9 @@ export default {
inputValue: '', inputValue: '',
formData: { formData: {
id: null, id: null,
name: '', // 标题 name: '', // 名称
type: '1', // 类型 image: '', // 图片链接
tag: '', sort: '' // 顺序
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
}, },
rules: {} rules: {}
} }
...@@ -132,19 +71,9 @@ export default { ...@@ -132,19 +71,9 @@ export default {
} }
return isLt2M 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) { handleSuccessLOGO(res, file, fileList) {
this.$nextTick(() => { this.$nextTick(() => {
this.formData.imagelink = '/file/' + res.type + '/' + res.realName this.formData.image = '/file/' + res.type + '/' + res.realName
this.$notify({ this.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -160,33 +89,10 @@ export default { ...@@ -160,33 +89,10 @@ export default {
duration: 2500 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() { showView() {
this.visible = true this.visible = true
}, },
hideView() { hideView() {
if (this.$refs.uploadApp) {
this.$refs.uploadApp.clearFiles()
}
if (this.$refs.uploadLogo) { if (this.$refs.uploadLogo) {
this.$refs.uploadLogo.clearFiles() this.$refs.uploadLogo.clearFiles()
} }
...@@ -197,28 +103,37 @@ export default { ...@@ -197,28 +103,37 @@ export default {
this.hideView() this.hideView()
this.formData = { this.formData = {
id: null, id: null,
name: '', // 标题 name: '', // 名称
type: '1', // 类型 image: '', // 图片链接
tag: '', sort: '' // 顺序
link: '', // 下载链接
imagelink: '', // 图片链接
remark: '', // 摘要
url: '' // 链接
} }
}, },
submitForm() { submitForm() {
this.$refs.formViewRef.validate((valid, obj) => { this.$refs.formViewRef.validate((valid, obj) => {
if (valid) { if (valid) {
HttpReq.backstageApi.addApp(this.formData).then((res) => { if (this.formData.id) {
this.$notify({ HttpReq.backstageApi.updateWeixinlink(this.formData).then((res) => {
title: res.message, this.$notify({
type: res.code === 200 ? 'success' : 'error' title: res.message,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
}) })
if (res.code === 200) { } else {
this.cancelView() HttpReq.backstageApi.addWeixinlink(this.formData).then((res) => {
this.$parent.loadData() this.$notify({
} title: res.message,
}) type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
}
} else { } else {
this.$message({ this.$message({
message: '表单信息有误,请核对无误后提交!', message: '表单信息有误,请核对无误后提交!',
...@@ -230,7 +145,9 @@ export default { ...@@ -230,7 +145,9 @@ export default {
loadData(item) { loadData(item) {
this.showView() this.showView()
this.$nextTick(() => { this.$nextTick(() => {
if (item) {
this.formData = item
}
}) })
} }
} }
......
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
<div class="app-container"> <div class="app-container">
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<el-input v-model="query.name" clearable placeholder="请输入工具名称" style="width:280px;" /> <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-date-picker <el-date-picker
v-model="query.start" v-model="query.start"
type="date" type="date"
...@@ -24,12 +17,9 @@ ...@@ -24,12 +17,9 @@
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button> <el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div> </div>
<div class="toolbar"> <div class="toolbar">
<div> <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 style="text-align: right"> <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>
</div> </div>
<!-- 表格 --> <!-- 表格 -->
...@@ -38,22 +28,12 @@ ...@@ -38,22 +28,12 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" /> <el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<!-- <el-table-column prop="id" label="ID" width="100" />--> <!-- <el-table-column prop="id" label="ID" width="100" />-->
<el-table-column prop="name" label="小工具名称" width="500" /> <el-table-column prop="name" label="微信群名称" />
<el-table-column prop="type" label="分类" width="140" :formatter="(row, col, val)=>{return dict.label.tools_class[val]}" /> <el-table-column prop="sort" label="排序" width="100" />
<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="uploadtime" label="最后维护日期" align="center" width="180" /> <el-table-column prop="uploadtime" label="最后维护日期" align="center" width="180" />
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <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-button round @click="toEdit(scope.row)">调整顺序</el-button>
<el-tooltip content="上架"><el-button round plain type="success" icon="el-icon-finished" @click="batchOperate(0, scope.row)" /></el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -102,7 +82,7 @@ export default { ...@@ -102,7 +82,7 @@ export default {
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => { Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
}) })
HttpReq.backstageApi.getAppAll({ HttpReq.backstageApi.getWeixinlinkList({
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
...this.query ...this.query
......
...@@ -41,6 +41,13 @@ module.exports = { ...@@ -41,6 +41,13 @@ module.exports = {
'^/word': 'word' '^/word': 'word'
} }
}, },
'/weixinlink': {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/weixinlink': 'weixinlink'
}
},
'/api': { '/api': {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,
changeOrigin: true, 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