Commit 40d6f904 authored by 罗超's avatar 罗超

新增公众号管理

parent e3e196cb
import request from '../../utils/request'
/**
* 获取学习园地列表接口
* @param {JSON参数} data
*/
export function geLearningGardenPage(data) {
return request({
url: '/SchoolGarden/GeLearningGardenPage',
method: 'post',
data
})
}
/**
* 获取学习园地详情
* @param {JSON参数} data
*/
export function getLearningGarden(data) {
return request({
url: '/SchoolGarden/GetLearningGarden',
method: 'post',
data
})
}
/**
* 新增/修改学习园地
* @param {JSON参数} data
*/
export function setLearningGarden(data) {
return request({
url: '/SchoolGarden/SetLearningGarden',
method: 'post',
data
})
}
/**
* 公众号同步
* @param {JSON参数} data
*/
export function getGoodsDataSync(data) {
return request({
url: '/SchoolGarden/GetGoodsData',
method: 'post',
data
})
}
\ No newline at end of file
......@@ -296,5 +296,4 @@ import ActiveTypeForm from '../../components/activity/activeType-from'
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
</style>
\ No newline at end of file
<template>
<div class="page-body">
<q-card>
<q-card-section>
<div>
<span class="text-h6" v-if="addMsg.Id>0">修改</span>
<span class="text-h6" v-if="addMsg.Id==0">新增</span>
<q-btn
color="accent"
style="float:right;"
size="sm"
class="q-mr-md"
label="返回"
@click="goback"
></q-btn>
</div>
</q-card-section>
<q-card-section>
<div
class="row wrap scroll"
style="width:100%;height:calc(100vh - 260px)"
>
<q-input
class="col-12 q-mb-sm"
clearable
filled
v-model="addMsg.Title"
label="标题"
maxlength="50"
/>
<q-input
class="col-12 q-mb-sm"
clearable
filled
v-model="addMsg.LinkUrl"
label="链接"
maxlength="1000"
/>
<q-input
class="col-12 q-mb-sm"
clearable
filled
v-model="addMsg.Digest"
label="摘要"
type="textarea"
maxlength="50"
/>
<div class="col-12 q-mb-sm">
<q-uploader
:style="{ backgroundImage: 'url(' + addMsg.Img + ')' }"
style="width:auto;height:500px;background-repeat:no-repeat;background-size:cover; border:1px solid #eee"
flat
hide-upload-btn
max-files="1"
label="封面图"
accept=".jpg, image/*"
:factory="uploadFile"
auto-upload
>
</q-uploader>
</div>
<div class="col-12">
<div class="q-mb-sm">内容</div>
<div class="col-12">
<Ueditor
:value="ueditor.value"
:config="ueditor.config"
@input="setVal"
ref="ue"
no-margin
:isShowInsertImage="false"
:isShowAttachment="false"
:isShowVoice="false"
></Ueditor>
</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn
label="保存"
color="accent q-px-md"
style="font-weight:400 !important"
@click="saveData"
/>
</q-card-actions>
</q-card>
</div>
</template>
<script>
import {
setLearningGarden,
getLearningGarden
} from "../../../api/OfficialAccounts/index";
import { UploadSelfFile } from "../../../api/common/common";
import Ueditor from "../../../components/editor/UeEditor";
export default {
model: {
prop: "persistent",
event: "input"
},
props: {
saveObj: {
type: Object,
default: () => {
return {};
}
},
persistent: {
type: Boolean,
default: true
}
},
components: {
Ueditor
},
data() {
return {
defaultProps: {
children: "SubList",
label: "Name"
},
addMsg: {
Id: 0,
Title: "",
Img: "",
Content: "",
Digest: "",
LinkUrl: ""
},
//富文本
ueditor: {
value: "",
config: {
initialFrameWidth: null,
initialFrameHeight: 100,
autoHeightEnabled: true,
enableContextMenu: false
}
}
};
},
mounted() {
if (this.$route.query.Id && this.$route.query.Id > 0) {
this.addMsg.Id = this.$route.query.Id;
this.getDetail(this.addMsg.Id);
} else {
this.addMsg.Id = 0;
this.init(null)
}
},
methods: {
goback() {
this.$router.go(-1);
},
getDetail(id) {
getLearningGarden({ Id: id }).then(res => {
this.init(res.Data);
});
},
init(val) {
if (val && val.Id > 0) {
this.addMsg.Id = val.Id;
this.addMsg.Img = val.Img;
this.addMsg.LinkUrl = val.LinkUrl;
this.addMsg.Digest = val.Digest;
this.addMsg.Title = val.Title;
this.addMsg.Content = val.Content;
this.setVal(this.addMsg.Content);
} else {
this.addMsg.Id = 0;
this.addMsg.LinkUrl = "";
this.addMsg.Img = "";
this.addMsg.Digest = "";
this.addMsg.Title = "";
this.addMsg.Content = "";
this.setVal("");
}
},
toggleDig(val) {
this.$emit("input", val);
},
uploadFile(files) {
UploadSelfFile("course", files[0], res => {
if (res.Code == 1) {
this.addMsg.Img = res.FileUrl;
}
});
},
// 富文本
setVal(val) {
this.addMsg.Content = val;
this.ueditor.value = val;
},
saveData() {
setLearningGarden(this.addMsg).then(res => {
if(res.Code==1){
this.Success(res.Message)
this.goback()
}
});
}
}
};
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
<template>
<div class="channelcodeList page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input
@keyup.enter.native="search"
clearable
filled
v-model="msg.Title"
label="标题"
@clear="search"
maxlength="20"
/>
</div>
</div>
</div>
<div class="page-content">
<q-table
:pagination="msg"
:loading="loading"
no-data-label="暂无相关数据"
flat
class="sticky-tow-column-table sticky-right-column-table"
separator="none"
title=""
:data="data"
:columns="columns"
row-key="name"
>
<template v-slot:top="props">
<div class="col-2 q-table__title">学习园地列表</div>
<q-space />
<q-btn
color="accent"
style="float:right;margin-right:0;"
size="sm"
class="q-mr-md"
icon="add"
label="新增"
@click="goDetail(0)"
></q-btn>
<q-btn
color="accent"
style="float:right;margin-right:0;"
size="sm"
class="q-ml-md"
label="公众号同步"
@click="OfficialAccountsSync"
></q-btn>
</template>
<template v-slot:body-cell-Img="props">
<q-td :props="props">
<q-img :src="props.row.Img" :ratio="4 / 3" />
</q-td>
</template>
<template v-slot:body-cell-Digest="props">
<q-td :props="props">
<div
style="width:400px;white-space: pre-line;"
v-html="props.row.Digest"
></div>
</q-td>
</template>
<template v-slot:body-cell-LinkUrl="props">
<q-td :props="props">
<div
style="color:var(--q-color-primary)"
@click="openLink(props.row.LinkUrl)"
>
查看链接
</div>
</q-td>
</template>
<template v-slot:body-cell-optioned="props">
<q-td>
<q-btn
flat
size="xs"
style="color:var(--q-color-primary)"
class="q-mr-xs"
label="查看详情"
@click="goDetail(props.row.Id)"
/>
</q-td>
</template>
<template v-slot:bottom>
<q-pagination
class="full-width justify-end"
v-model="msg.PageIndex"
color="primary"
:max="pageCount"
:input="true"
@input="changePage"
/>
</template>
</q-table>
</div>
</div>
</template>
<script>
import {
geLearningGardenPage,
getGoodsDataSync
} from "../../../api/OfficialAccounts/index";
export default {
meta: {
title: "学习园地"
},
data() {
return {
loading: false,
data: [],
pageCount: 0,
msg: {
PageIndex: 1,
PageSize: 10,
rowsPerPage: 10,
Title: ""
},
columns: [
{
name: "Id",
label: "编号",
field: "Id",
align: "left"
},
{
name: "Title",
label: "标题",
field: "Title",
align: "left",
style: "width: 200px"
},
{
name: "Img",
label: "封面图",
field: "Img",
align: "left"
},
{
name: "Digest",
field: "Digest",
label: "简介",
align: "left"
},
{
name: "LinkUrl",
field: "LinkUrl",
label: "链接地址",
align: "left"
},
{
name: "CreateByName",
field: "CreateByName",
label: "创建人",
align: "left"
},
{
name: "CreateTime",
field: "CreateTime",
label: "创建时间",
align: "left"
},
{
name: "optioned",
label: "操作",
field: "optioned",
align: "center"
}
],
};
},
created() {
this.getList();
},
methods: {
getList() {
this.loading = true;
geLearningGardenPage(this.msg).then(res => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
});
},
openLink(url) {
window.open(url, "_blank");
},
search() {
this.msg.PageIndex = 1;
this.getList();
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getList();
},
//同步
OfficialAccountsSync() {
getGoodsDataSync({}).then(res => {
if (res.Code == 1) {
this.Success(res.Message);
this.search();
}
});
},
goDetail(id) {
this.$router.push({
path: "/enterprise/OfficialAccountsDetail",
query: {
Id: id
}
});
}
}
};
</script>
<style></style>
......@@ -1554,6 +1554,16 @@ const routes = [{
component: () =>
import("pages/enterprise/customer/customer")
},
{
path: "/enterprise/OfficialAccounts", //企微 公众号同步
component: () =>
import("pages/enterprise/OfficialAccounts/OfficialAccountsList")
},
{
path: "/enterprise/OfficialAccountsDetail", //企微 公众号详情
component: () =>
import("pages/enterprise/OfficialAccounts/OfficialAccountsDetail")
},
],
},
......
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