Browse Source

更新记录

newStyle
jyt 2 years ago
parent
commit
d7d7644b3a
5 changed files with 151 additions and 53 deletions
  1. +24
    -0
      src/api/modules/http.js
  2. +6
    -5
      src/components/wechat/WxEditor.vue
  3. +66
    -28
      src/views/contentManage/updateRecord/list.vue
  4. +53
    -18
      src/views/contentManage/updateRecord/update.vue
  5. +2
    -2
      vue.config.js

+ 24
- 0
src/api/modules/http.js View File

@@ -868,4 +868,28 @@ export function updateListApi(data) {
method: 'get',
params: data
})
}
// 更新记录新增
export function updateAddApi(data) {
return request({
url: 'autoSR/api/zkMessage/insertSelective',
method: 'post',
data
})
}
// 更新记录详情
export function updateInfoApi(params) {
return request({
url: 'autoSR/api/zkMessage/findById',
method: 'get',
params
})
}
// 更新记录删除
export function updateDelApi(params) {
return request({
url: 'autoSR/api/zkMessage/deleteById',
method: 'get',
params
})
}

+ 6
- 5
src/components/wechat/WxEditor.vue View File

@@ -9,7 +9,7 @@
<el-upload
class="avatar-uploader"
:action="serverUrl"
name="file"
name="image"
:headers="header"
:show-file-list="false"
:data="uploadData"
@@ -109,14 +109,14 @@
}
}
},
serverUrl: "/mp/wxmaterial/newsImgUpload", // 这里写你要上传的图片服务器地址
serverUrl: "/autoSR/api/appapi/uploadImg", // 这里写你要上传的图片服务器地址
header: {
Authorization: 'Bearer ' + store.getters.access_token
} // 有的图片服务器要求请求头需要有token
}
},
created() {
this.content = this.value.replace(/data-src/g, "src")
},
methods: {
onEditorBlur(editor) {
@@ -141,11 +141,12 @@
// 获取富文本组件实例
let quill = this.$refs.myQuillEditor.quill
// 如果上传成功
if(res.link){
console.log(res)
if(res.data){
// 获取光标所在位置
let length = quill.getSelection().index;
// 插入图片 res.info为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.link)
quill.insertEmbed(length, 'image', res.data)
// 调整光标到最后
quill.setSelection(length + 1)
} else {


+ 66
- 28
src/views/contentManage/updateRecord/list.vue View File

@@ -49,13 +49,13 @@
<!-- 表格 -->
<div class="cen-tab">
<el-table :data="tableData" stripe style="width: 100%">
<el-table-column prop="username" label="标题" align="center"></el-table-column>
<el-table-column prop="imei" label="阅读数" align="center"></el-table-column>
<el-table-column prop="imei" label="发布人" align="center"></el-table-column>
<el-table-column prop="imei" label="发布时间" align="center"></el-table-column>
<el-table-column prop="title" label="标题" align="center"></el-table-column>
<el-table-column prop="pageView" label="阅读数" align="center"></el-table-column>
<el-table-column prop="createUser" label="发布人" align="center"></el-table-column>
<el-table-column prop="createTime" label="发布时间" align="center"></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200">
<template slot-scope="{ row }">
<el-button type="text" @click="modify(row.id)"
<el-button type="text" @click="modify(row.id,row.orgType)"
v-if="con_list_modify">编辑</el-button>
<el-button type="text" @click="remove(row.id)"
v-if="con_list_del">删除</el-button>
@@ -104,17 +104,29 @@ export default {
this.con_list_del = this.permissions["con_list_del"];
},
mounted(){
let data = {
current:1,
size:10,
// zkMessage:{
// orgType:this.selValue
// }
if(this.$route.query.org!=undefined){
this.selValue = this.$route.query.org
}else{
this.selValue = "1"
}
let data = {
current:1,
size:10,
orgType:this.selValue,
}
this.filefindByPage(data)
},
methods: {
selChange() {},
selChange() {
let data = {
current:1,
size:10,
orgType:this.selValue,
startTime:this.time[0],
endTime:this.time[1],
}
this.filefindByPage(data)
},
timeChange() {},
add() {
this.$router.push(
@@ -122,37 +134,63 @@ export default {
)
},
noempty() {
this.current = 1;
this.filefindByPage();
let data = {
current:1,
size:10,
orgType:this.selValue,
startTime:this.time[0],
endTime:this.time[1]
}
this.filefindByPage(data);
},
empty() {
let data = {
current:1,
size:10,
orgType:this.selValue,
startTime:"",
endTime:"",
}
this.time = [];
this.current = 1;
this.filefindByPage();
this.filefindByPage(data);
},
filefindByPage(obj) {
this.$api.http.updateListApi(obj).then((res) => {
console.log(res)
this.tableData = res.data
filefindByPage(data) {
this.$api.http.updateListApi(data).then((res) => {
this.tableData = res.data.records
this.total = res.data.total
});
},
modify(){
modify(id,org){
this.$router.push(
"/contentManage/updateRecord/update"
`/contentManage/updateRecord/update?id=${id}&pj=${org}`
)
},
remove(){

remove(id){
this.$api.http.updateDelApi({id}).then((res) => {
if(res.code == 0){
this.filefindByPage()
this.$message.success("删除成功");
}
});
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.size=val;
this.filefindByPage()
let data = {
current:1,
size:val,
orgType:this.selValue,
}
this.filefindByPage(data)
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.current=val;
this.filefindByPage()
this.current = val;
let data = {
current:val,
size:10,
orgType:this.selValue,
}
this.filefindByPage(data)
}
},
};


+ 53
- 18
src/views/contentManage/updateRecord/update.vue View File

@@ -8,17 +8,24 @@
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="标题" prop="name">
<el-input v-model="ruleForm.name"></el-input>
<el-form-item label="标题" prop="title">
<el-input v-model="ruleForm.title"></el-input>
</el-form-item>
<el-form-item label="更新涉及" prop="type" v-if="isShowPj">
<el-checkbox-group v-model="ruleForm.type">
<el-checkbox label="PC端" name="type"></el-checkbox>
<el-checkbox label="小程序端" name="type"></el-checkbox>
<el-form-item label="更新涉及" prop="seeFlag" v-if="isShowPj">
<!-- <el-checkbox-group v-model="ruleForm.seeFlag">
<el-checkbox label="PC端" name="seeFlag"></el-checkbox>
<el-checkbox label="小程序端" name="seeFlag"></el-checkbox>
</el-checkbox-group> -->
<el-checkbox-group
v-model="ruleForm.seeFlagArray">
<el-checkbox v-for="(item,index) in opt" :label="item.value" :key="index">{{item.label}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="内容" prop="content">
<div class="content">
<div class="content" v-if="ruleForm.content">
<WxEditor v-model="ruleForm.content" :uploadData="uploadData"/>
</div>
<div class="contents" v-if="id==undefined&&ruleForm.content==''">
<WxEditor v-model="ruleForm.content" :uploadData="uploadData"/>
</div>
</el-form-item>
@@ -41,16 +48,21 @@ export default {
name: "updateUpdate",
data() {
return {
id:"",
isShowPj:false,
opt:[
{label:'PC端',value:1},
{label:'小程序端',value:2},
],
ruleForm: {
name: "",
type: [],
title: "",
seeFlagArray: [],
content: "",
},
rules: {
name: [{ required: true, message: "请输入标题名称", trigger: "blur" }],
title: [{ required: true, message: "请输入标题名称", trigger: "blur" }],
content: [{ required: true, message: "请输入内容", trigger: "blur" }],
type: [
seeFlagArray: [
{
type: "array",
required: true,
@@ -61,9 +73,9 @@ export default {
},
uploadData: {
"mediaType": 'image',
"title": 'xxxx',
"introduction": 'sasdaa',
'appId': 'wx8f883dca5ecc5510'
"title": '',
"introduction": '',
'appId': ''
},
};
},
@@ -72,21 +84,36 @@ export default {
},
computed: {},
watch: {},
created() {},
mounted(){
created() {
},
async mounted(){
this.id = this.$route.query.id
if(this.$route.query.pj=="3"){
this.isShowPj = true;
}else{
this.isShowPj =false;
}
if(this.$route.query.id!=undefined){
let s = await this.$api.http.updateInfoApi({id:this.$route.query.id})
this.ruleForm = s.data
}
console.log(this.ruleForm)
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.ruleForm)
this.ruleForm.orgType = this.$route.query.pj
this.$api.http.updateAddApi(this.ruleForm).then((res) => {
if(res.code == 0){
this.$message.success("操作成功");
this.$router.push(
`/contentManage/updateRecord/list?org=${this.$route.query.pj}`
)
}
});
} else {
this.$message.error("操作失败");
}
});
},
@@ -116,6 +143,14 @@ export default {
}
}
}
.contents{
/deep/ #wxEditor{
margin-top: -25px;
.editor{
height: 350px !important;
}
}
}
.btn{
margin-top: 100px;
}


+ 2
- 2
vue.config.js View File

@@ -7,8 +7,8 @@
// const url = 'http://192.168.31.167:9999' //长龙
// const url = 'http://192.168.31.134:9999' //嘉豪
// const url = 'http://192.168.31.100:9999' //王笑
// const url = 'http://62.234.122.43:9999' //正式
const url = 'http://192.168.31.88:9999' //正式
const url = 'http://62.234.122.43:9999' //正式
// const url = 'http://192.168.31.88:9999' //正式
// const url = 'https://zanyong.hfju.com' // 正式域名
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']


Loading…
Cancel
Save