Commit 7b5363b2 authored by 徐一鸣's avatar 徐一鸣

消息与推送管理

parent ce79b10a
......@@ -511,7 +511,7 @@ width: 620px!important;
/* common */
.apass_breadcrumb > .el-breadcrumb {
margin: 15px 0;
padding: 15px 0;
}
.apass_breadcrumb > .el-breadcrumb .el-breadcrumb__inner {
font-size: 14px;
......@@ -638,4 +638,59 @@ width: 620px!important;
/* background: #f4f4f4; */
box-shadow: 8px 0 0 #f4f4f4 inset;
border: 4px solid rgba(0, 0, 0, 0);
}
\ No newline at end of file
}
/* 详情页公共样式 by xuyiming */
.apaas_detail_container {
padding: 0 20px;
}
.apaas_detail_container .main_contaner {
min-height: calc(100vh - 84px - 83px);
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
padding: 30px;
background-color: #fff;
border-radius: 10px;
margin-bottom: 30px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.apaas_detail_container .detail_action {
text-align: right;
margin-top: 50px;
}
.apaas_detail_container .detail_action .el-button + .el-button {
margin-left: 30px;
}
.apaas_detail_container .detail_form {
max-width: 970px;
}
.apaas_detail_container .detail_form .el-input__inner,
.apaas_detail_container .detail_form .el-textarea__inner {
width: 100%;
background-color: #f7f8f9;
}
.apaas_detail_container .detail_form .el-select {
width: 100%;
}
.apaas_detail_container .detail_form.el-form--label-top .el-form-item__label {
padding: 0 0 15px;
font-size: 14px;
line-height: 1;
color: #58617a;
}
.apaas_detail_container .detail_form .el-form-item {
margin-bottom: 30px;
}
.apaas_detail_container .detail_form .textarea_count {
font-size: 14px;
line-height: 1;
color: #a9aec0;
text-align: right;
margin-top: 10px;
}
/* 详情页公共样式 by xuyiming ~~~end */
\ No newline at end of file
......@@ -286,7 +286,7 @@ export default {
.top_fliter {
display: flex;
}
.top_fliter > .filter_list {
.top_fliter .filter_list {
flex-grow: 1;
}
.filter_list > .filter_item {
......@@ -294,10 +294,14 @@ export default {
vertical-align: middle;
margin-top: 15px;
}
.filter_list > .filter_item + .filter_item {
margin-left: 25px;
.filter_list > .filter_item {
margin-right: 15px;
}
.filter_list > .filter_item > .filter_title {
display: inline-block;
vertical-align: middle;
width: 8em;
text-align: right;
font-size: 14px;
font-weight: 700;
color: #242c43;
......@@ -307,7 +311,7 @@ export default {
.filter_list > .filter_item > .filter_title + * {
width: 300px;
}
.top_fliter > .filter_action {
.top_fliter .filter_action {
flex-shrink: 0;
margin-left: 25px;
text-align: right;
......
......@@ -135,20 +135,19 @@ export default {
label: "排序",
prop: "index",
width: 60,
align: "center",
},
{
label: "banner编码",
prop: "code",
type: "button",
callback: this.detailAction,
width: 300,
width: 180,
},
{
label: "banner名称",
prop: "name",
type: "button",
callback: this.detailAction,
width: 300,
width: 240,
},
{
label: "链接地址",
......@@ -348,7 +347,7 @@ export default {
.catch((error) => {
console.log(error);
}); */
},
}, // TODO: 列表待调试
topFilterAction() {
this.initList(this.tempFilter);
},
......
......@@ -289,7 +289,7 @@ export default {
.catch((error) => {
console.log(error);
}); */
},
}, // TODO: 列表待调试
topFilterAction() {
this.initList(this.tempFilter);
},
......
......@@ -281,7 +281,7 @@ export default {
.catch((error) => {
console.log(error);
}); */
},
}, // TODO: 列表待调试
topFilterAction() {
this.initList(this.tempFilter);
},
......
<template>
<div class="apaas_detail_container">
<div class="apass_breadcrumb">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/message' }">
{{ $t("lang.message") }}
</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/message/message_template' }">
{{ $t("lang.message_template") }}
</el-breadcrumb-item>
<el-breadcrumb-item>
{{ pageName }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="main_contaner">
<el-form
ref="detail_form"
class="detail_form"
label-position="top"
:model="detail"
:rules="detail_rules"
>
<el-form-item label="消息模板名称:" prop="name">
<el-input
v-model="detail.name"
placeholder="请输入消息模板名称"
:disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="模板类型:" prop="tpl_type">
<el-select
v-model="detail.tpl_type"
placeholder="请选择模板类型"
:disabled="disabled"
>
<el-option
v-for="item in types"
:label="item.name"
:value="item.value"
:key="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="消息详情:" prop="content">
<el-input
v-model="detail.content"
type="textarea"
placeholder="请输入消息详情,最多可以输入500字。"
maxlength="500"
:disabled="disabled"
></el-input>
<p
class="textarea_count"
v-text="`还可以输入${500 - detail.content.length}字`"
v-if="!disabled"
></p>
</el-form-item>
</el-form>
<div class="apass_button detail_action">
<el-button
type="default"
@click="cancelAction"
:loading="submitLoading"
>
取消
</el-button>
<el-button
type="primary"
@click="primaryAction"
:loading="submitLoading"
>
确定
</el-button>
</div>
</div>
</div>
</template>
<script>
import helper from "@/services/helper.js";
export default {
data: () => ({
pageType: 0, // 0:新增,1:编辑,2:详情
detail: {
name: "",
tpl_type: "",
content: "",
},
detail_rules: {
name: [
{
required: true,
message: "请输入消息模板名称",
trigger: "blur",
},
{
max: 16,
message: "长度小于16个字符",
trigger: "blur",
},
],
tpl_type: [
{
required: true,
message: "请选择模板类型",
trigger: "blur",
},
],
content: [
{
required: true,
message: "请输入消息详情,最多可以输入500字。",
trigger: "blur",
},
],
},
types: [
{
name: "服务推送",
value: 1,
},
{
name: "平台维护",
value: 2,
},
{
name: "版本更新",
value: 3,
},
{
name: "自动消息",
value: 4,
},
],
submitLoading: false,
}),
computed: {
pageName() {
return ["新增", "编辑", "详情"][this.pageType];
},
disabled() {
return this.pageType === 2;
},
},
created() {
if (this.$route.name === "message_template_edit") {
this.pageType = 1;
} else if (this.$route.name === "message_template_detail") {
this.pageType = 2;
}
if (this.pageType !== 0) {
this.getDetail();
}
},
methods: {
getDetail() {
this.$http
.get("/apaas/service/v3/msg/manage/tpl/info", {
params: {
id: this.$route.params.id,
},
})
.then(({ data }) => {
if (data.success == 1) {
let detail = data.data;
this.detail.name = detail.name;
this.detail.tpl_type = detail.tpl_type;
this.detail.content = detail.content;
} else {
this.$message({
message: data.errMsg || "获取详情失败",
type: "warning",
});
}
})
.catch((error) => {
console.log(error);
this.$message({
message: "获取详情失败",
type: "warning",
});
});
},
addTemplate() {
this.$http
.post("/apaas/service/v3/msg/manage/tpl/add", this.detail)
.then(({ data }) => {
if (data.success == 1) {
this.$message({
message: "新增消息模板成功",
type: "success",
});
setTimeout(() => {
this.$router.push("/message/message_template");
}, 500);
} else {
this.$message({
message: data.errMsg || "新增消息模板失败",
type: "warning",
});
}
this.submitLoading = true;
})
.catch((error) => {
console.log(error);
this.$message({
message: "新增消息模板失败",
type: "warning",
});
this.submitLoading = true;
});
},
editTemplate() {
this.$http
.post("/apaas/service/v3/msg/manage/tpl/update", {
id: this.$route.params.id,
...this.detail,
})
.then(({ data }) => {
if (data.success == 1) {
this.$message({
message: "编辑消息模板成功",
type: "success",
});
setTimeout(() => {
this.$router.push("/message/message_template");
}, 200);
} else {
this.$message({
message: data.errMsg || "编辑消息模板失败",
type: "warning",
});
}
this.submitLoading = true;
})
.catch((error) => {
console.log(error);
this.$message({
message: "编辑消息模板失败",
type: "warning",
});
this.submitLoading = true;
});
},
cancelAction() {
this.$router.push("/message/message_template");
},
primaryAction() {
if (this.pageType === 2) {
this.$router.push("/message/message_template");
} else {
this.$refs.detail_form.validate((valid) => {
if (valid) {
this.submitLoading = true;
this.pageType === 1 ? this.editTemplate() : this.addTemplate();
} else {
return false;
}
});
}
},
},
};
</script>
......@@ -40,7 +40,7 @@
<div class="filter_item">
<span class="filter_title">最后更新时间:</span>
<el-date-picker
v-model="topFilter.updata_time"
v-model="topFilter.update_time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
......@@ -69,10 +69,6 @@
<apass-dialog
ref="dialog"
:msg="dialogInfo.msg"
:cancel-text="dialogInfo.cancelText"
:cancel-type="dialogInfo.cancelType"
:cancel="dialogInfo.cancel"
:sunbmit-text="dialogInfo.sunbmitText"
:submit="dialogInfo.submit"
></apass-dialog>
</div>
......@@ -94,34 +90,34 @@ export default {
listTotal: 0,
dialogInfo: {
msg: "",
cancelText: "",
cancelType: "",
cancel: null,
sunbmitText: "",
submit: null,
},
topFilter: {
name: "",
type: "",
updata_time: "",
update_time: "",
},
tempFilter: null,
types: [
{
name: "全部",
value: "",
},
{
name: "服务推送",
value: 0,
value: 1,
},
{
name: "平台维护",
value: 1,
value: 2,
},
{
name: "版本更新",
value: 2,
value: 3,
},
{
name: "自动消息",
value: 3,
value: 4,
},
],
}),
......@@ -143,22 +139,29 @@ export default {
},
{
label: "模板类型",
prop: "type",
prop: "tpl_type",
getText(item) {
return _self.types[item.type || 0].name;
let types = [..._self.types];
types[0] = {
name: "-",
value: "",
};
return types[item.tpl_type || 0].name;
},
width: 100,
align: "center"
width: 160,
align: "center",
},
{
label: "模板详情",
prop: "detail",
prop: "content",
},
{
label: "最后更新时间",
prop: "updata_time",
prop: "update_time",
getText(item) {
let date = item.updata_time || "";
let date = item.update_time || "";
return helper.dateStringTransform(date);
},
align: "center",
......@@ -185,122 +188,27 @@ export default {
},
methods: {
initList(filter) {
let fullFilter = {
...filter,
...this.topFilter,
let params = {
page: filter.page,
size: filter.size,
keyword: this.topFilter.name,
tpl_type: this.topFilter.type,
update_time_s:
(this.topFilter.update_time && this.topFilter.update_time[0]) || "",
update_time_e:
(this.topFilter.update_time && this.topFilter.update_time[1]) || "",
};
this.tempFilter = filter; // filter存档,用于页面刷新
console.log(fullFilter);
// console.log(params);
this.listTotal = 55;
this.listData = [
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["张三", "李四", "王五"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["张三", "李四", "王五"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["张三", "李四", "王五"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["张三", "李四", "王五"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
{
id: "message20200429001",
push_num: "propelling2020001",
name: "服务定向推送的消息",
detail:
"亲爱的用户,根据您的服务调用情况,我们向您推荐地图视频融合服务,欢迎使用!",
users: ["杨过", "小龙女", "冯宝宝"],
updata_time: "2020-07-18T14:25:09+08:00",
},
];
this.tempFilter = filter; // filter存档,用于页面刷新
/* this.$http
.get("/apaas/service/v3/resource/apply/approveList", {
params: {
search: filter.keyword,
page: filter.page,
limit: filter.size,
state: filter.state,
},
})
this.$http
.get("/apaas/service/v3/msg/manage/tpl/list", { params })
.then(({ data }) => {
if (data.success == 1) {
this.listTotal = data.total;
this.listData = data.data;
this.listTotal = (data.data && data.data.total) || 0;
this.listData = (data.data && data.data.list) || [];
} else {
this.$message({
message: data.errMsg || "获取列表失败",
......@@ -310,7 +218,12 @@ export default {
})
.catch((error) => {
console.log(error);
}); */
this.$message({
message: "获取列表失败",
type: "warning",
});
});
},
topFilterAction() {
this.initList(this.tempFilter);
......@@ -319,7 +232,7 @@ export default {
this.topFilter = {
name: "",
type: "",
updata_time: "",
update_time: "",
};
this.initList(this.tempFilter);
......@@ -328,16 +241,47 @@ export default {
this.$refs.dialog.show();
},
addNew() {
console.log("新建模板");
this.$router.push("/message/message_template/add");
},
detailAction(item) {
console.log(`查看${item.name}`);
this.$router.push(`/message/message_template/detail/${item.id}`);
},
editAction(item) {
console.log(`编辑${item.name}`);
this.$router.push(`/message/message_template/edit/${item.id}`);
},
deleteAction(item) {
console.log(`删除${item.name}`);
this.dialogInfo.msg = `
您确认删除这条数据吗?</br>
<span style='color: #e15260;'>删除后无法撤销</span>,您还要继续吗?
`;
this.dialogInfo.submit = () => {
this.$http
.post(`/apaas/service/v3/msg/manage/tpl/delete/${item.id}`)
.then(({ data }) => {
if (data.success == 1) {
this.$message({
message: data.errMsg || `删除${item.name}成功`,
type: "success",
});
this.initList(this.tempFilter);
} else {
this.$message({
message: data.errMsg || `删除${item.name}失败`,
type: "warning",
});
}
})
.catch((error) => {
console.log(error);
this.$message({
message: `删除${item.name}失败`,
type: "warning",
});
});
};
this.$refs.dialog.show();
},
},
};
......
......@@ -32,8 +32,8 @@
<span class="filter_title">状态:</span>
<el-select v-model="topFilter.state" placeholder="请选择">
<el-option label="全部" value=""> </el-option>
<el-option label="推送成功" value="1"> </el-option>
<el-option label="推送失败" value="0"> </el-option>
<el-option label="正常" value="1"> </el-option>
<el-option label="异常" value="2"> </el-option>
</el-select>
</div>
<div class="filter_item">
......@@ -101,7 +101,7 @@ export default {
},
{
label: "推荐位名称",
prop: "name",
prop: "ad_name",
type: "button",
callback: this.detailAction,
align: "center",
......@@ -109,25 +109,30 @@ export default {
},
{
label: "服务个数",
prop: "service_count",
prop: "serv_count",
align: "center",
width: 160,
},
{
label: "服务详情",
prop: "detail",
prop: "service_names",
getText(item) {
let services = item.service_names || [];
return services.map((item) => item.name).join("");
},
},
{
label: "操作人",
prop: "person",
prop: "update_user",
align: "center",
width: 120,
},
{
label: "最后更新 时间",
prop: "updata_time",
prop: "update_time",
getText(item) {
let date = item.updata_time || "";
let date = item.update_time || "";
return helper.dateStringTransform(date);
},
align: "center",
......@@ -149,77 +154,27 @@ export default {
},
methods: {
initList(filter) {
let fullFilter = {
...filter,
...this.topFilter,
let params = {
page: filter.page,
size: filter.size,
name: this.topFilter.name,
state: this.topFilter.state,
uptime_s:
(this.topFilter.update_time && this.topFilter.update_time[0]) || "",
uptime_e:
(this.topFilter.update_time && this.topFilter.update_time[1]) || "",
};
this.tempFilter = filter; // filter存档,用于页面刷新
// console.log(params);
console.log(fullFilter);
this.listTotal = 5;
this.listData = [
{
state: 1,
name: "热门数据",
service_count: 5,
detail:
"水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况",
person: "罗治翔",
updata_time: "2020-07-18T14:25:09+08:00",
},
{
state: 1,
name: "热门数据",
service_count: 5,
detail:
"水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况",
person: "罗治翔",
updata_time: "2020-07-18T14:25:09+08:00",
},
{
state: 0,
name: "热门数据",
service_count: 5,
detail:
"水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况",
person: "罗治翔",
updata_time: "2020-07-18T14:25:09+08:00",
},
{
state: 0,
name: "热门数据",
service_count: 5,
detail:
"水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况",
person: "罗治翔",
updata_time: "2020-07-18T14:25:09+08:00",
},
{
state: 0,
name: "热门数据",
service_count: 5,
detail:
"水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况,水路货物周转量情况",
person: "罗治翔",
updata_time: "2020-07-18T14:25:09+08:00",
},
];
this.tempFilter = filter; // filter存档,用于页面刷新
/* this.$http
.get("/apaas/service/v3/resource/apply/approveList", {
params: {
search: filter.keyword,
page: filter.page,
limit: filter.size,
state: filter.state,
},
})
this.$http
.get("/apaas/service/v3/recommend/manage/featured/list", { params })
.then(({ data }) => {
if (data.success == 1) {
this.listTotal = data.total;
this.listData = data.data;
this.listTotal = (data.data && data.data.total) || 0;
this.listData = (data.data && data.data.data) || [];
} else {
this.$message({
message: data.errMsg || "获取列表失败",
......@@ -229,7 +184,12 @@ export default {
})
.catch((error) => {
console.log(error);
}); */
this.$message({
message: "获取列表失败",
type: "warning",
});
});
},
topFilterAction() {
this.initList(this.tempFilter);
......@@ -244,10 +204,10 @@ export default {
this.initList(this.tempFilter);
},
detailAction(item) {
console.log(`查看${item.name}`);
console.log(`查看${item.ad_name}`);
},
editAction(item) {
console.log(`编辑${item.name}`);
console.log(`编辑${item.ad_name}`);
},
},
};
......
......@@ -404,6 +404,21 @@ export default new Router({
name: "message_template",
component: () => import("@/pages/message-management/message-template/message-template-list"),
},
{
path: "/message/message_template/add", // 新增消息模板
name: "message_template_add",
component: () => import("@/pages/message-management/message-template/message-template-detail"),
},
{
path: "/message/message_template/edit/:id", // 编辑消息模板
name: "message_template_edit",
component: () => import("@/pages/message-management/message-template/message-template-detail"),
},
{
path: "/message/message_template/detail/:id", // 查看消息模板详情
name: "message_template_detail",
component: () => import("@/pages/message-management/message-template/message-template-detail"),
},
],
}, // 消息与推送管理
],
......
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