@evm-angular/cms
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -213,5 +213,6 @@ (function (global, factory) { | ||
var loader_1 = utilsInst.loading(); | ||
this.getPhoneArticles({ | ||
this.getCMSarticleByCIdMethod({ | ||
cId: column.id, | ||
limit: 1 | ||
currentPage: 1, | ||
pageSize: 1 | ||
}).subscribe(function (res) { | ||
@@ -218,0 +219,0 @@ if (res && res.data && res.data.totalCount == 1) { |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/common/http"),require("@nsalaun/ng-logger"),require("rxjs/observable/ErrorObservable"),require("rxjs/operators"),require("rxjs/util/TimeoutError"),require("@angular/common")):"function"==typeof define&&define.amd?define("@evm-angular/cms",["exports","@angular/core","@angular/common/http","@nsalaun/ng-logger","rxjs/observable/ErrorObservable","rxjs/operators","rxjs/util/TimeoutError","@angular/common"],r):r((e["evm-angular"]=e["evm-angular"]||{},e["evm-angular"].cms={}),e.ng.core,e.ng.common.http,e.ngLogger,e.Rx.Observable,e.Rx.Observable.prototype,e.Rx.TimeoutError,e.ng.common)}(this,function(exports,core,http,ngLogger,ErrorObservable,operators,TimeoutError,common){"use strict";var CMS_CONFIG=new core.InjectionToken("CMS_CONFIG"),CmsService=function(){function CmsService(e,r,t){this.http=e,this.logger=r,this.opts=t,this.timeout=this.opts.timeout||5e3,this.serverUri=this.opts.serverUri}return Object.defineProperty(CmsService.prototype,"serverUri",{get:function(){return this._serverUri||this.logger.warn(CmsService.TAG+" serverUrl为空"),this._serverUri?this._serverUri:""},set:function(e){if(e){/http:\/\/[^:\/]+(:\d+)?/i.test(e)?this._serverUri=e:(this.logger.warn(CmsService.TAG+"cms接口服务器地址不符合规则->/http:\\/\\/[^:\\/]+(:\\d+)?/i"),this._serverUri="")}else this._serverUri=""},enumerable:!0,configurable:!0}),CmsService.prototype.queryChildrenColumnById=function(e){var r=this,t=e.cId,o=e.level,i=void 0===o?1:o,n=this.serverUri+"/EMSP_CMS/queryChildrenColumnById?cId="+t+"&level="+i;return this.http.get(n).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"QueryChildrenColumnById")}))},CmsService.prototype.getCMSarticleByCIdMethod=function(e){var r=this,t=e.cId,o=e.currentPage,i=void 0===o?1:o,n=e.pageSize,s=void 0===n?10:n,a=this.serverUri+"/EMSP_CMS/getCMSarticleByCId?cId="+t+"¤tPage="+i+"&pageSize="+s;return this.http.get(a).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"GetCMSarticleByCIdMethod")}))},CmsService.prototype.getPhoneArticles=function(e){var r=this,t=e.cId,o=e.direction,i=e.articleId,n=e.limit,s=void 0===n?10:n,a=this.serverUri+"/EMSP_CMS/getPhoneArticles?cId="+t+"&limit="+s;return o&&(a+="&direction="+o),i&&(a+="&articleId="+i),this.http.get(a).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"GetPhoneArticles")}))},CmsService.prototype.getArticle=function(_a){var _this=this,articleId=_a.articleId,query="{queryBy:'articleId',articleId:'"+articleId+"',fetchField:'Content,Title,ID'}",url=this.serverUri+"/EMSP_CMS/getArticle?requestJson="+encodeURIComponent(query);return this.http.get(url,{responseType:"text"}).pipe(operators.timeout(this.timeout),operators.map(function(article){var JSON_PROTECTION_PREFIX=/^\)\]\}',?\n/;function doubleEscape(e){return e=(e=(e=(e=e.replace(/\n/g,"\\\\n")).replace(/\t/g,"\\\\t")).replace(/\r/g,"\\\\r")).replace(/"/g,'"')}article=article.replace(JSON_PROTECTION_PREFIX,"").trim(),article=doubleEscape(article);var obj=eval("("+article+")"),RE_CMS_IMAGE=/<img[^>]+src="(\/EMSP_CMS[^"]+)"/gi;return obj&&obj.data&&obj.data.length&&obj.data[0].content&&(obj.data[0].content=obj.data[0].content.replace(RE_CMS_IMAGE,function(e,r){return'<img src="'+_this.serverUri+r+'"'})),obj}),operators.catchError(function(e){return _this.handleErrorContainer(e,"GetArticle")}))},CmsService.prototype.handleErrorContainer=function(e,r){return this.handleError(e,r)},CmsService.prototype.handleError=function(e,r){var t;return e.error instanceof ErrorEvent?(console.error("An error occurred:"+e.error.message),t="没有网络连接,请检查网络设置"):e instanceof TimeoutError.TimeoutError?(console.error("An error occurred: "+e.message),t="网络连接超时"):(console.error("Backend returned code "+e.status+", body was: "+JSON.stringify(e.error)),t=0==e.status?"没有网络连接,请检查网络设置":"服务端报错:"+e.message),new ErrorObservable.ErrorObservable({message:t,type:r})},CmsService.prototype.getMediaUrl=function(e){return/playurl=([^&]+)/i.test(e)&&(e=RegExp.$1),e},CmsService.prototype.openVideoWithParam=function(e){var r=e.url,t=e.name,o=e.isLive,i=this.getMediaUrl(r);console.log(CmsService.TAG+" openVideoWithParam() url = "+i);try{var n={successCallback:function(){console.log("Video was closed without error.")},errorCallback:function(e){console.log("Error! "+e)},orientation:"landscape",movie:t,isLive:o||!1,shouldAutoClose:!0};window.plugins.evmLiveStreamingMedia.playVideo(i,n)}catch(s){console.error(CmsService.TAG+" openVideoWithParam() error:"+s.message)}},CmsService.prototype.openArticle=function(e){var r=e.article,t=e.navCtrl,o=e.articlePage;switch(r.type){case"图文":t.push(o,{aid:r.id});break;case"视频":case"链接":case"全屏视频":var i=this.getMediaUrl(r.url);this.openVideoWithParam({url:i,name:r.text,isLive:!1})}},CmsService.prototype.updateArticleHits=function(e){var r=e.articleId,t=this.serverUri+"/EMSP_CMS/updateArticleHits?articleId="+r;return this.http.get(t)},CmsService.prototype.getColumnUrl=function(e){var r;if(e&&e.imgList&&e.imgList.length){var t=e.imgList[0].url;/^(http|https)/.test(t)&&(r=t)}return r},CmsService.prototype.openColumn=function(e){var r=this,t=e.column,o=e.utilsInst,i=e.navCtrl,n=e.navListPage,s=void 0===n?"NavListPage":n,a=e.listPage,c=void 0===a?"ListPage":a,l=e.articlePage,u=void 0===l?"ArticlePage":l,p=this.getColumnUrl(t);if(p)p=p.replace(/&/gi,"&"),console.log(CmsService.TAG+" openColumn() open external link is "+p),o.openInBrowser(p,"_blank");else if(t&&t.children&&t.children.length)i.push(s,{cId:t.id,columnName:t.columnName});else{var m=o.loading();this.getPhoneArticles({cId:t.id,limit:1}).subscribe(function(e){e&&e.data&&1==e.data.totalCount?(m.dismiss(),r.openArticle({article:e.data.content[0],articlePage:u,navCtrl:i})):(m.dismiss(),i.push(c,{cId:t.id,columnName:t.columnName}))},function(e){console.error(CmsService.TAG+" openColumn() load column article list failure: "+e.message),o.toast("打开栏目失败,请稍后重试!")})}},CmsService}();CmsService.TAG="[EVM/CmsService]",CmsService.decorators=[{type:core.Injectable}],CmsService.ctorParameters=function(){return[{type:http.HttpClient},{type:ngLogger.Logger},{type:undefined,decorators:[{type:core.Inject,args:[CMS_CONFIG]}]}]};var CmsModule=function(){function r(){}return r.forRoot=function(e){return{ngModule:r,providers:[CmsService,{provide:CMS_CONFIG,useValue:e||{}}]}},r}();CmsModule.decorators=[{type:core.NgModule,args:[{imports:[common.CommonModule,http.HttpClientModule]}]}],exports.CmsModule=CmsModule,exports.CmsService=CmsService,exports.ɵa=CMS_CONFIG,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/common/http"),require("@nsalaun/ng-logger"),require("rxjs/observable/ErrorObservable"),require("rxjs/operators"),require("rxjs/util/TimeoutError"),require("@angular/common")):"function"==typeof define&&define.amd?define("@evm-angular/cms",["exports","@angular/core","@angular/common/http","@nsalaun/ng-logger","rxjs/observable/ErrorObservable","rxjs/operators","rxjs/util/TimeoutError","@angular/common"],r):r((e["evm-angular"]=e["evm-angular"]||{},e["evm-angular"].cms={}),e.ng.core,e.ng.common.http,e.ngLogger,e.Rx.Observable,e.Rx.Observable.prototype,e.Rx.TimeoutError,e.ng.common)}(this,function(exports,core,http,ngLogger,ErrorObservable,operators,TimeoutError,common){"use strict";var CMS_CONFIG=new core.InjectionToken("CMS_CONFIG"),CmsService=function(){function CmsService(e,r,t){this.http=e,this.logger=r,this.opts=t,this.timeout=this.opts.timeout||5e3,this.serverUri=this.opts.serverUri}return Object.defineProperty(CmsService.prototype,"serverUri",{get:function(){return this._serverUri||this.logger.warn(CmsService.TAG+" serverUrl为空"),this._serverUri?this._serverUri:""},set:function(e){if(e){/http:\/\/[^:\/]+(:\d+)?/i.test(e)?this._serverUri=e:(this.logger.warn(CmsService.TAG+"cms接口服务器地址不符合规则->/http:\\/\\/[^:\\/]+(:\\d+)?/i"),this._serverUri="")}else this._serverUri=""},enumerable:!0,configurable:!0}),CmsService.prototype.queryChildrenColumnById=function(e){var r=this,t=e.cId,o=e.level,i=void 0===o?1:o,n=this.serverUri+"/EMSP_CMS/queryChildrenColumnById?cId="+t+"&level="+i;return this.http.get(n).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"QueryChildrenColumnById")}))},CmsService.prototype.getCMSarticleByCIdMethod=function(e){var r=this,t=e.cId,o=e.currentPage,i=void 0===o?1:o,n=e.pageSize,s=void 0===n?10:n,a=this.serverUri+"/EMSP_CMS/getCMSarticleByCId?cId="+t+"¤tPage="+i+"&pageSize="+s;return this.http.get(a).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"GetCMSarticleByCIdMethod")}))},CmsService.prototype.getPhoneArticles=function(e){var r=this,t=e.cId,o=e.direction,i=e.articleId,n=e.limit,s=void 0===n?10:n,a=this.serverUri+"/EMSP_CMS/getPhoneArticles?cId="+t+"&limit="+s;return o&&(a+="&direction="+o),i&&(a+="&articleId="+i),this.http.get(a).pipe(operators.timeout(this.timeout),operators.catchError(function(e){return r.handleErrorContainer(e,"GetPhoneArticles")}))},CmsService.prototype.getArticle=function(_a){var _this=this,articleId=_a.articleId,query="{queryBy:'articleId',articleId:'"+articleId+"',fetchField:'Content,Title,ID'}",url=this.serverUri+"/EMSP_CMS/getArticle?requestJson="+encodeURIComponent(query);return this.http.get(url,{responseType:"text"}).pipe(operators.timeout(this.timeout),operators.map(function(article){var JSON_PROTECTION_PREFIX=/^\)\]\}',?\n/;function doubleEscape(e){return e=(e=(e=(e=e.replace(/\n/g,"\\\\n")).replace(/\t/g,"\\\\t")).replace(/\r/g,"\\\\r")).replace(/"/g,'"')}article=article.replace(JSON_PROTECTION_PREFIX,"").trim(),article=doubleEscape(article);var obj=eval("("+article+")"),RE_CMS_IMAGE=/<img[^>]+src="(\/EMSP_CMS[^"]+)"/gi;return obj&&obj.data&&obj.data.length&&obj.data[0].content&&(obj.data[0].content=obj.data[0].content.replace(RE_CMS_IMAGE,function(e,r){return'<img src="'+_this.serverUri+r+'"'})),obj}),operators.catchError(function(e){return _this.handleErrorContainer(e,"GetArticle")}))},CmsService.prototype.handleErrorContainer=function(e,r){return this.handleError(e,r)},CmsService.prototype.handleError=function(e,r){var t;return e.error instanceof ErrorEvent?(console.error("An error occurred:"+e.error.message),t="没有网络连接,请检查网络设置"):e instanceof TimeoutError.TimeoutError?(console.error("An error occurred: "+e.message),t="网络连接超时"):(console.error("Backend returned code "+e.status+", body was: "+JSON.stringify(e.error)),t=0==e.status?"没有网络连接,请检查网络设置":"服务端报错:"+e.message),new ErrorObservable.ErrorObservable({message:t,type:r})},CmsService.prototype.getMediaUrl=function(e){return/playurl=([^&]+)/i.test(e)&&(e=RegExp.$1),e},CmsService.prototype.openVideoWithParam=function(e){var r=e.url,t=e.name,o=e.isLive,i=this.getMediaUrl(r);console.log(CmsService.TAG+" openVideoWithParam() url = "+i);try{var n={successCallback:function(){console.log("Video was closed without error.")},errorCallback:function(e){console.log("Error! "+e)},orientation:"landscape",movie:t,isLive:o||!1,shouldAutoClose:!0};window.plugins.evmLiveStreamingMedia.playVideo(i,n)}catch(s){console.error(CmsService.TAG+" openVideoWithParam() error:"+s.message)}},CmsService.prototype.openArticle=function(e){var r=e.article,t=e.navCtrl,o=e.articlePage;switch(r.type){case"图文":t.push(o,{aid:r.id});break;case"视频":case"链接":case"全屏视频":var i=this.getMediaUrl(r.url);this.openVideoWithParam({url:i,name:r.text,isLive:!1})}},CmsService.prototype.updateArticleHits=function(e){var r=e.articleId,t=this.serverUri+"/EMSP_CMS/updateArticleHits?articleId="+r;return this.http.get(t)},CmsService.prototype.getColumnUrl=function(e){var r;if(e&&e.imgList&&e.imgList.length){var t=e.imgList[0].url;/^(http|https)/.test(t)&&(r=t)}return r},CmsService.prototype.openColumn=function(e){var r=this,t=e.column,o=e.utilsInst,i=e.navCtrl,n=e.navListPage,s=void 0===n?"NavListPage":n,a=e.listPage,c=void 0===a?"ListPage":a,l=e.articlePage,u=void 0===l?"ArticlePage":l,p=this.getColumnUrl(t);if(p)p=p.replace(/&/gi,"&"),console.log(CmsService.TAG+" openColumn() open external link is "+p),o.openInBrowser(p,"_blank");else if(t&&t.children&&t.children.length)i.push(s,{cId:t.id,columnName:t.columnName});else{var m=o.loading();this.getCMSarticleByCIdMethod({cId:t.id,currentPage:1,pageSize:1}).subscribe(function(e){e&&e.data&&1==e.data.totalCount?(m.dismiss(),r.openArticle({article:e.data.content[0],articlePage:u,navCtrl:i})):(m.dismiss(),i.push(c,{cId:t.id,columnName:t.columnName}))},function(e){console.error(CmsService.TAG+" openColumn() load column article list failure: "+e.message),o.toast("打开栏目失败,请稍后重试!")})}},CmsService}();CmsService.TAG="[EVM/CmsService]",CmsService.decorators=[{type:core.Injectable}],CmsService.ctorParameters=function(){return[{type:http.HttpClient},{type:ngLogger.Logger},{type:undefined,decorators:[{type:core.Inject,args:[CMS_CONFIG]}]}]};var CmsModule=function(){function r(){}return r.forRoot=function(e){return{ngModule:r,providers:[CmsService,{provide:CMS_CONFIG,useValue:e||{}}]}},r}();CmsModule.decorators=[{type:core.NgModule,args:[{imports:[common.CommonModule,http.HttpClientModule]}]}],exports.CmsModule=CmsModule,exports.CmsService=CmsService,exports.ɵa=CMS_CONFIG,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=evm-angular-cms.umd.min.js.map |
@@ -311,5 +311,7 @@ import { InjectionToken, Inject, Injectable, NgModule } from '@angular/core'; | ||
let /** @type {?} */ loader = utilsInst.loading(); | ||
this.getPhoneArticles({ | ||
// 请求下栏目下是否有多篇文章 | ||
this.getCMSarticleByCIdMethod({ | ||
cId: column.id, | ||
limit: 1 | ||
currentPage: 1, | ||
pageSize: 1 | ||
}).subscribe((res) => { | ||
@@ -316,0 +318,0 @@ if (res && res.data && res.data.totalCount == 1) { |
@@ -215,5 +215,6 @@ import { InjectionToken, Inject, Injectable, NgModule } from '@angular/core'; | ||
var loader_1 = utilsInst.loading(); | ||
this.getPhoneArticles({ | ||
this.getCMSarticleByCIdMethod({ | ||
cId: column.id, | ||
limit: 1 | ||
currentPage: 1, | ||
pageSize: 1 | ||
}).subscribe(function (res) { | ||
@@ -220,0 +221,0 @@ if (res && res.data && res.data.totalCount == 1) { |
{ | ||
"$schema": "../../node_modules/ng-packagr/package.schema.json", | ||
"name": "@evm-angular/cms", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Evm cms module for mobile", | ||
@@ -6,0 +6,0 @@ "author": "wuqq@evmtv.com", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
137147
1182