@jx3box/jx3box-common-ui 8.3.2 → 8.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/service/design.js +13 -0
- package/src/Breadcrumb.vue +7 -4
- package/src/bread/AdminDrop.vue +117 -0
- package/src/bread/DesignTask.vue +164 -0
- package/vue.config.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@jx3box/jx3box-comment-ui": "^1.8.7",
|
|
34
|
-
"@jx3box/jx3box-common": "^8.2.
|
|
35
|
-
"@jx3box/jx3box-data": "^3.5.
|
|
36
|
-
"@jx3box/jx3box-editor": "^2.1.
|
|
34
|
+
"@jx3box/jx3box-common": "^8.2.11",
|
|
35
|
+
"@jx3box/jx3box-data": "^3.5.8",
|
|
36
|
+
"@jx3box/jx3box-editor": "^2.1.9",
|
|
37
37
|
"@jx3box/reporter": "^0.0.4",
|
|
38
38
|
"axios": "^0.26.1",
|
|
39
39
|
"dayjs": "^1.11.0",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { $cms } from "@jx3box/jx3box-common/js/https";
|
|
2
|
+
|
|
3
|
+
export const createDesignTask = (data) => {
|
|
4
|
+
return $cms().post(`/api/cms/design/task`, data);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const getDesignTask = (params) => {
|
|
8
|
+
return $cms().get(`/api/cms/design/task/log`, { params });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const getConfigBannerTypes = (params) => {
|
|
12
|
+
return $cms().get(`/api/cms/config/banner/types`, { params });
|
|
13
|
+
}
|
package/src/Breadcrumb.vue
CHANGED
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
<i class="el-icon-info"></i>
|
|
46
46
|
<span>反馈</span>
|
|
47
47
|
</a>
|
|
48
|
-
<Adminbutton v-if="adminEnable" class="u-admin" />
|
|
49
|
-
<ListAdmin v-if="topicEnable" />
|
|
48
|
+
<!-- <Adminbutton v-if="adminEnable" class="u-admin" /> -->
|
|
49
|
+
<!-- <ListAdmin v-if="topicEnable" /> -->
|
|
50
50
|
<Admin v-if="adminEnable" :marksOptions="adminMarks" :show-extend="showExtend" :app="slug" :subtypeMap="subtypeMap" />
|
|
51
|
+
<!-- <AdminDrop v-if="adminEnable" /> -->
|
|
51
52
|
<slot name="op-prepend"></slot>
|
|
52
53
|
</div>
|
|
53
54
|
</div>
|
|
@@ -62,6 +63,7 @@ import Admin from "./bread/Admin";
|
|
|
62
63
|
import Crumb from "./bread/Crumb";
|
|
63
64
|
import Adminbutton from "./bread/Adminbutton";
|
|
64
65
|
import ListAdmin from "./bread/ListAdmin";
|
|
66
|
+
import AdminDrop from "./bread/AdminDrop";
|
|
65
67
|
|
|
66
68
|
import { isApp } from "../assets/js/app.js";
|
|
67
69
|
import Bus from "../service/bus";
|
|
@@ -145,8 +147,9 @@ export default {
|
|
|
145
147
|
components: {
|
|
146
148
|
Admin,
|
|
147
149
|
Crumb,
|
|
148
|
-
Adminbutton,
|
|
149
|
-
ListAdmin,
|
|
150
|
+
// Adminbutton,
|
|
151
|
+
// ListAdmin,
|
|
152
|
+
// AdminDrop,
|
|
150
153
|
},
|
|
151
154
|
};
|
|
152
155
|
</script>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="c-admin-drop">
|
|
3
|
+
<el-dropdown trigger="click" @command="handleCommand">
|
|
4
|
+
<el-button type="primary" class="c-admin-button c-admin-drop__button" :size="buttonSize"
|
|
5
|
+
><i class="el-icon-setting"></i> 管理<i class="el-icon-arrow-down el-icon--right"></i>
|
|
6
|
+
</el-button>
|
|
7
|
+
<el-dropdown-menu slot="dropdown">
|
|
8
|
+
<el-dropdown-item v-if="isEditor" command="toggleAdminPanel" icon="el-icon-setting">
|
|
9
|
+
<span>设置</span>
|
|
10
|
+
</el-dropdown-item>
|
|
11
|
+
<el-dropdown-item v-if="isEditor" command="directMessage" icon="el-icon-message">
|
|
12
|
+
<span>私信</span>
|
|
13
|
+
</el-dropdown-item>
|
|
14
|
+
<el-dropdown-item icon="el-icon-upload" command="designTask">
|
|
15
|
+
<span>推送</span>
|
|
16
|
+
</el-dropdown-item>
|
|
17
|
+
</el-dropdown-menu>
|
|
18
|
+
</el-dropdown>
|
|
19
|
+
|
|
20
|
+
<design-task v-model="showDesignTask" :post="post"></design-task>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import Bus from "../../service/bus";
|
|
26
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
27
|
+
import DesignTask from "./DesignTask.vue";
|
|
28
|
+
import { sendMessage } from "../../service/admin";
|
|
29
|
+
export default {
|
|
30
|
+
name: "AdminDrop",
|
|
31
|
+
components: {
|
|
32
|
+
DesignTask
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
buttonSize: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "medium",
|
|
38
|
+
},
|
|
39
|
+
post: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => {},
|
|
42
|
+
},
|
|
43
|
+
userId: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 0,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
showDesignTask: false,
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
computed: {
|
|
54
|
+
isEditor() {
|
|
55
|
+
return User.isEditor();
|
|
56
|
+
},
|
|
57
|
+
sourceId() {
|
|
58
|
+
return this.post?.ID
|
|
59
|
+
},
|
|
60
|
+
sourceType() {
|
|
61
|
+
return this.post?.post_type
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
handleCommand(command) {
|
|
66
|
+
this[command]();
|
|
67
|
+
},
|
|
68
|
+
toggleAdminPanel() {
|
|
69
|
+
Bus.$emit("toggleAdminPanel");
|
|
70
|
+
},
|
|
71
|
+
directMessage() {
|
|
72
|
+
this.$prompt("请输入私信内容", "管理私信", {
|
|
73
|
+
confirmButtonText: "确定",
|
|
74
|
+
cancelButtonText: "取消",
|
|
75
|
+
inputPlaceholder: "请输入私信内容",
|
|
76
|
+
inputValidator: (value) => {
|
|
77
|
+
if (!value) {
|
|
78
|
+
return "请输入私信内容";
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
beforeClose: (action, instance, done) => {
|
|
82
|
+
if (action === "confirm") {
|
|
83
|
+
const data = {
|
|
84
|
+
source_id: String(this.sourceId),
|
|
85
|
+
source_type: this.sourceType,
|
|
86
|
+
user_id: this.userId,
|
|
87
|
+
content: "运营通知:" + instance.inputValue,
|
|
88
|
+
type: "system",
|
|
89
|
+
subtype: "admin_message"
|
|
90
|
+
};
|
|
91
|
+
sendMessage(data).then(() => {
|
|
92
|
+
this.$message.success("私信成功");
|
|
93
|
+
done();
|
|
94
|
+
})
|
|
95
|
+
} else {
|
|
96
|
+
done();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}).catch(() => {})
|
|
100
|
+
},
|
|
101
|
+
designTask() {
|
|
102
|
+
this.showDesignTask = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<style lang="less">
|
|
109
|
+
.c-admin-drop {
|
|
110
|
+
float: right;
|
|
111
|
+
margin-top: -2px;
|
|
112
|
+
margin-right: 10px;
|
|
113
|
+
}
|
|
114
|
+
.c-admin-drop__button {
|
|
115
|
+
padding: 8px 18px !important;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog custom-class="m-design-task" :visible="modelValue" @close="close" title="快捷推送" append-to-body>
|
|
3
|
+
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="80px">
|
|
4
|
+
<el-form-item label="标题" required>
|
|
5
|
+
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
|
6
|
+
</el-form-item>
|
|
7
|
+
<el-form-item label="类型">
|
|
8
|
+
<el-select v-model="form.type" placeholder="请选择类型" style="width:100%;">
|
|
9
|
+
<el-option v-for="item in config" :key="item.id" :label="item.label" :value="item.name"></el-option>
|
|
10
|
+
</el-select>
|
|
11
|
+
</el-form-item>
|
|
12
|
+
<el-form-item label="备注">
|
|
13
|
+
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
|
|
14
|
+
</el-form-item>
|
|
15
|
+
<el-form-item label="星级" class="m-star-line">
|
|
16
|
+
<el-rate v-model="form.star" :colors="colors"></el-rate>
|
|
17
|
+
</el-form-item>
|
|
18
|
+
</el-form>
|
|
19
|
+
|
|
20
|
+
<el-divider content-position="left">
|
|
21
|
+
近期推送
|
|
22
|
+
</el-divider>
|
|
23
|
+
<template v-if="logs && logs.length">
|
|
24
|
+
<el-table :data="logs" border size="small">
|
|
25
|
+
<el-table-column label="推送时间" prop="push_at" align="center">
|
|
26
|
+
<template #default="{row}">
|
|
27
|
+
{{ formatTime(row.push_at) }}
|
|
28
|
+
</template>
|
|
29
|
+
</el-table-column>
|
|
30
|
+
<el-table-column label="推送人" prop="pusher.display_name" align="center"></el-table-column>
|
|
31
|
+
<el-table-column label="星级" prop="star" align="center">
|
|
32
|
+
<template #default="{row}">
|
|
33
|
+
<el-rate v-model="row.star" disabled :colors="colors"></el-rate>
|
|
34
|
+
</template>
|
|
35
|
+
</el-table-column>
|
|
36
|
+
<el-table-column label="备注" prop="remark" align="center"></el-table-column>
|
|
37
|
+
</el-table>
|
|
38
|
+
</template>
|
|
39
|
+
<el-alert v-else title="当前文章暂无历史推送" type="info" show-icon :closable="false"></el-alert>
|
|
40
|
+
<template #footer>
|
|
41
|
+
<el-button @click="close">取 消</el-button>
|
|
42
|
+
<el-button type="primary" @click="onConfirm">确 定</el-button>
|
|
43
|
+
</template>
|
|
44
|
+
</el-dialog>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { createDesignTask, getDesignTask, getConfigBannerTypes } from "../../service/design";
|
|
49
|
+
import {pick} from "lodash";
|
|
50
|
+
import dayjs from "dayjs";
|
|
51
|
+
export default {
|
|
52
|
+
name: "DesignTask",
|
|
53
|
+
props: {
|
|
54
|
+
modelValue: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
post: {
|
|
59
|
+
type: Object,
|
|
60
|
+
default: () => {}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
model: {
|
|
64
|
+
prop: "modelValue",
|
|
65
|
+
event: "update:modelValue"
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:modelValue"],
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
form: {
|
|
71
|
+
title: "",
|
|
72
|
+
remark: "",
|
|
73
|
+
star: 0,
|
|
74
|
+
subtype: "",
|
|
75
|
+
},
|
|
76
|
+
colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
|
|
77
|
+
|
|
78
|
+
logs: [],
|
|
79
|
+
rules: {
|
|
80
|
+
title: [
|
|
81
|
+
{ required: true, message: "请输入标题", trigger: "blur" },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
config: []
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
modelValue(val) {
|
|
89
|
+
if (val) {
|
|
90
|
+
if (this.post) {
|
|
91
|
+
this.form.title = this.post.post_title;
|
|
92
|
+
}
|
|
93
|
+
this.loadLogs();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
mounted() {
|
|
98
|
+
this.loadConfig();
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
close(){
|
|
102
|
+
this.$emit("update:modelValue",false)
|
|
103
|
+
},
|
|
104
|
+
clearForm() {
|
|
105
|
+
this.form = {
|
|
106
|
+
title: "",
|
|
107
|
+
remark: "",
|
|
108
|
+
star: 0,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.$refs?.form?.clearValidate();
|
|
112
|
+
},
|
|
113
|
+
onConfirm() {
|
|
114
|
+
if (!this.post?.ID) return;
|
|
115
|
+
const data = pick(this.post, ["client", "author"]);
|
|
116
|
+
data.title = this.form.title;
|
|
117
|
+
data.remark = this.form.remark;
|
|
118
|
+
data.star = this.form.star;
|
|
119
|
+
data.subtype = this.form.type;
|
|
120
|
+
|
|
121
|
+
data.source_type = this.post?.post_type;
|
|
122
|
+
data.source_id = String(this.post?.ID);
|
|
123
|
+
data.link = `/${this.post?.post_type}/${this.post?.ID}`;
|
|
124
|
+
data.flow = 0;
|
|
125
|
+
|
|
126
|
+
createDesignTask(data).then(() => {
|
|
127
|
+
this.$message.success("提交成功");
|
|
128
|
+
this.close();
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
onCancel() {
|
|
132
|
+
this.close();
|
|
133
|
+
this.clearForm();
|
|
134
|
+
},
|
|
135
|
+
loadLogs() {
|
|
136
|
+
if (!this.post?.ID) return;
|
|
137
|
+
getDesignTask({ source_id: this.post?.ID }).then(res => {
|
|
138
|
+
this.logs = res.data.data || [];
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
loadConfig() {
|
|
142
|
+
getConfigBannerTypes({ _no_page: 1 }).then(res => {
|
|
143
|
+
this.config = res.data.data || [];
|
|
144
|
+
})
|
|
145
|
+
},
|
|
146
|
+
formatTime(time) {
|
|
147
|
+
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<style lang="less">
|
|
154
|
+
.m-design-task {
|
|
155
|
+
.m-star-line {
|
|
156
|
+
.el-form-item__content {
|
|
157
|
+
top: 10px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
.u-time {
|
|
161
|
+
color: #c0c4cc;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
package/vue.config.js
CHANGED
|
@@ -98,7 +98,7 @@ module.exports = {
|
|
|
98
98
|
.rule("images")
|
|
99
99
|
.use("url-loader")
|
|
100
100
|
.loader("url-loader")
|
|
101
|
-
.tap((options) => Object.assign(options, { limit: 10240 }));
|
|
101
|
+
.tap((options) => Object.assign(options, { limit: 10240, esModule: false }));
|
|
102
102
|
|
|
103
103
|
//💝 in-line svg imgs ~
|
|
104
104
|
config.module
|