add cms reference

master
luoyang 6 years ago
parent 823fe881a8
commit 1af0a9890e

@ -109,6 +109,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) {
$scope.saveArticle = function () {
$scope.article.reference =$scope.reference;
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: resp.data.article_id});
}, function (resp) {
@ -119,7 +120,10 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) {
$scope.article = article.data;
$scope.reference = JSON.parse($scope.article.reference);
$scope.saveArticle = function () {
$scope.article.reference =$scope.reference;
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: $stateParams.articleId});
}, function (resp) {

@ -20,7 +20,7 @@
<label class="col-md-2 control-label" for="kw-input">HTML Keywords</label>
<div class="col-md-10">
<input ng-model="article.page_keywords" type="text" name="title" id="kw-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(重要0不允许跳转 1跳转编辑内容 2跳转到外链)</p>
<p ng-if="catId=='app_ad'"class="small text-warning">(重要0不允许跳转 1跳转到外链)</p>
</div>
</div>
<div class="form-group">
@ -40,7 +40,27 @@
<p ng-if="catId=='app_ad'"class="small text-warning">(若有外链,则填,否则留空)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Type</label>
<div class="col-md-10">
<input ng-model="reference.ad_type" type="text" name="title" id="type-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告封面 type=0时 为图片地址 type=1时 为视频地址)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Mode</label>
<div class="col-md-10">
<input ng-model="reference.expire_date" type="text" name="title" id="expire_date-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告过期时间 格式为: 2018/10/01 00:00:00)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Duration time</label>
<div class="col-md-10">
<input ng-model="reference.duration_time" type="text" name="title" id="duration_time-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告展示时间(s))</p>
</div>
</div>
</form>
<div class="form-group">
<label class="control-label">Content</label>

@ -31,7 +31,7 @@
<th>Title</th>
<th>Add Time</th>
<th>Published</th>
<th>Recommended</th>
<!-- <th>Recommended</th>-->
<th>Operation</th>
</tr>
</thead>
@ -44,11 +44,11 @@
<i class="fa" ng-class="{'fa-check text-success':article.publish_status,'fa-remove text-danger':!article.publish_status}"></i>
</a>
</td>
<td>
<!-- <td>
<a role="button" ng-click="toggleArticleRecommended(article)" title="Toggle recommended">
<i class="fa" ng-class="{'fa-check text-success':article.recommended,'fa-remove text-danger':!article.recommended}"></i>
</a>
</td>
</td>-->
<td>
<a ui-sref=".edit_article({articleId:article.article_id})" title="edit"><i class="fa fa-edit"></i></a>
<a ui-sref=".article_view({articleId:article.article_id})" title="preview"><i class="fa fa-eye"></i></a>

Loading…
Cancel
Save