1.4.5.2
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<second-menu>
|
||||
<menu-item href="/settings/user-ui/posts" :class="{active: secondMenuItem == 'index'}">文章列表</menu-item>
|
||||
<menu-item href="/settings/user-ui/posts/create" :class="{active: secondMenuItem == 'create'}">创建文章</menu-item>
|
||||
</second-menu>
|
||||
@@ -0,0 +1,4 @@
|
||||
#editor {
|
||||
height: 30em;
|
||||
}
|
||||
/*# sourceMappingURL=create.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["create.less"],"names":[],"mappings":"AAAA;EACC,YAAA","file":"create.css"}
|
||||
@@ -0,0 +1,61 @@
|
||||
{$layout}
|
||||
{$template "../menu"}
|
||||
{$template "menu"}
|
||||
|
||||
{$var "header"}
|
||||
<link href="/js/quill/quill.snow.css" rel="stylesheet">
|
||||
<script src="/js/quill/quill.min.js"></script>
|
||||
{$end}
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="body" v-model="body"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>所属产品 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="productCode">
|
||||
<option value="">[所属产品]</option>
|
||||
<option v-for="product in products" :value="product.code">{{product.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章分类 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="categoryId">
|
||||
<option value="0">[选择分类]</option>
|
||||
<option v-for="category in categories" :value="category.id">{{category.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章标题 *</td>
|
||||
<td>
|
||||
<input type="text" name="subject" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文章类型 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="type" v-model="type">
|
||||
<option value="normal">常规</option>
|
||||
<option value="url">URL</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="type == 'url'">
|
||||
<td>URL *</td>
|
||||
<td>
|
||||
<input type="text" name="url" maxlength="200"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="type == 'normal'">
|
||||
<td>内容 *</td>
|
||||
<td>
|
||||
<div id="editor"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,33 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifySuccess("保存成功", "/settings/user-ui/posts")
|
||||
|
||||
this.type = "normal"
|
||||
|
||||
// reference: https://quilljs.com/docs/modules/toolbar/
|
||||
this.body = ""
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
let quill = new Quill('#editor', {
|
||||
theme: 'snow',
|
||||
modules: {
|
||||
toolbar: [
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
[{'header': 1}, {'header': 2}],
|
||||
[{'list': 'ordered'}, {'list': 'bullet'}],
|
||||
[{'indent': '-1'}, {'indent': '+1'}],
|
||||
[{'direction': 'rtl'}],
|
||||
[{'size': ['small', false, 'large', 'huge']}],
|
||||
[{'header': [1, 2, 3, 4, 5, 6, false]}],
|
||||
[{'color': []}, {'background': []}],
|
||||
[{'font': []}],
|
||||
[{'align': []}],
|
||||
['link', 'image'],
|
||||
['clean']
|
||||
]
|
||||
}
|
||||
})
|
||||
quill.on("text-change", function () {
|
||||
that.body = quill.root.innerHTML
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
#editor {
|
||||
height: 30em;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{$layout}
|
||||
{$template "../menu"}
|
||||
{$template "menu"}
|
||||
|
||||
|
||||
<not-found-box v-if="posts.length == 0">暂时还没有文章。</not-found-box>
|
||||
|
||||
<div v-if="posts.length > 0">
|
||||
<table class="ui table selectable celled">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th class="two wide">所属产品</th>
|
||||
<th class="two wide">文章分类</th>
|
||||
<th class="three wide">创建时间</th>
|
||||
<th class="width6">状态</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="post in posts">
|
||||
<td> <a :href="Tea.url('.post', {postId: post.id})">{{post.subject}}</a>
|
||||
<div v-if="post.type == 'url'">
|
||||
<grey-label>URL</grey-label>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{post.productName}}</td>
|
||||
<td>
|
||||
<span v-if="post.category != null && post.category.id > 0">{{post.category.name}}</span>
|
||||
<span v-else class="disabled">已删除</span>
|
||||
</td>
|
||||
<td>{{post.createdTime}}</td>
|
||||
<td>
|
||||
<span v-if="post.isPublished" class="green">已发布</span>
|
||||
<span v-else>未发布</span>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="Tea.url('.post', {postId: post.id})">详情</a>
|
||||
<a href="" @click.prevent="deletePost(post.id)">删除</a>
|
||||
<a href="" @click.prevent="publishPost(post.id)" v-if="!post.isPublished">发布</a>
|
||||
<span v-else class="disabled">发布</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<page-box></page-box>
|
||||
27
EdgeAdmin/web/views/@default/settings/user-ui/posts/index.js
Normal file
27
EdgeAdmin/web/views/@default/settings/user-ui/posts/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
Tea.context(function () {
|
||||
this.deletePost = function (postId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定删除此文章吗?", function () {
|
||||
that.$post(".delete")
|
||||
.params({
|
||||
postId: postId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successRefresh("发布成功")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.publishPost = function (postId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定发布此文章吗?", function () {
|
||||
that.$post(".publish")
|
||||
.params({
|
||||
postId: postId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successRefresh("发布成功")
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,44 @@
|
||||
{$layout}
|
||||
{$template "../menu"}
|
||||
{$template "menu"}
|
||||
|
||||
<p class="comment" style="padding: 0"><a :href="Tea.url('.update', { postId: post.id })">[修改文章]</a> </p>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>所属产品</td>
|
||||
<td>{{post.productName}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章分类</td>
|
||||
<td>
|
||||
<span v-if="post.category != null && post.category.id > 0">{{post.category.name}}</span>
|
||||
<span v-else class="disabled">已删除</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章标题</td>
|
||||
<td>
|
||||
{{post.subject}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文章类型</td>
|
||||
<td>
|
||||
<span v-if="post.type == 'url'">URL</span>
|
||||
<span v-if="post.type == 'normal'">常规</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="post.type == 'url'">
|
||||
<td>URL</td>
|
||||
<td>
|
||||
{{post.url}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="post.type == 'normal'">
|
||||
<td>内容</td>
|
||||
<td>
|
||||
<div v-html="post.body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,4 @@
|
||||
#editor {
|
||||
height: 30em;
|
||||
}
|
||||
/*# sourceMappingURL=update.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["update.less"],"names":[],"mappings":"AAAA;EACC,YAAA","file":"update.css"}
|
||||
@@ -0,0 +1,62 @@
|
||||
{$layout}
|
||||
{$template "../menu"}
|
||||
{$template "menu"}
|
||||
|
||||
{$var "header"}
|
||||
<link href="/js/quill/quill.snow.css" rel="stylesheet">
|
||||
<script src="/js/quill/quill.min.js"></script>
|
||||
{$end}
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="postId" :value="post.id"/>
|
||||
<input type="hidden" name="body" v-model="body"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>所属产品 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="productCode" v-model="post.productCode">
|
||||
<option value="">[所属产品]</option>
|
||||
<option v-for="product in products" :value="product.code">{{product.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章分类 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="categoryId" v-model="post.categoryId">
|
||||
<option value="0">[选择分类]</option>
|
||||
<option v-for="category in categories" :value="category.id">{{category.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">文章标题 *</td>
|
||||
<td>
|
||||
<input type="text" name="subject" ref="focus" v-model="post.subject"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文章类型 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="type" v-model="post.type">
|
||||
<option value="normal">常规</option>
|
||||
<option value="url">URL</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="post.type == 'url'">
|
||||
<td>URL *</td>
|
||||
<td>
|
||||
<input type="text" name="url" maxlength="200" v-model="post.url"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="post.type == 'normal'">
|
||||
<td>内容 *</td>
|
||||
<td>
|
||||
<div id="editor" v-html="post.body"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,33 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifySuccess("保存成功", Tea.url(".post", { postId: this.post.id }))
|
||||
|
||||
this.type = "normal"
|
||||
|
||||
// reference: https://quilljs.com/docs/modules/toolbar/
|
||||
this.body = this.post.body
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
let quill = new Quill('#editor', {
|
||||
theme: 'snow',
|
||||
modules: {
|
||||
toolbar: [
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
[{'header': 1}, {'header': 2}],
|
||||
[{'list': 'ordered'}, {'list': 'bullet'}],
|
||||
[{'indent': '-1'}, {'indent': '+1'}],
|
||||
[{'direction': 'rtl'}],
|
||||
[{'size': ['small', false, 'large', 'huge']}],
|
||||
[{'header': [1, 2, 3, 4, 5, 6, false]}],
|
||||
[{'color': []}, {'background': []}],
|
||||
[{'font': []}],
|
||||
[{'align': []}],
|
||||
['link', 'image'],
|
||||
['clean']
|
||||
]
|
||||
}
|
||||
})
|
||||
quill.on("text-change", function () {
|
||||
that.body = quill.root.innerHTML
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
#editor {
|
||||
height: 30em;
|
||||
}
|
||||
Reference in New Issue
Block a user