3 lines
27 KiB
JavaScript
3 lines
27 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-agreement-preview-index"],{"0bce":function(t,e,r){var n=r("c86c");e=n(!1),e.push([t.i,"uni-page-body[data-v-450358b0]{background:#fff}body.?%PAGE?%[data-v-450358b0]{background:#fff}.preview-page[data-v-450358b0]{min-height:100vh;padding-bottom:84px;background:#fff;color:#111}.preview-scroll[data-v-450358b0]{height:calc(100vh - 84px)}.preview-content[data-v-450358b0]{padding:14px 16px 30px}.state-text[data-v-450358b0]{padding:28px 0;color:#666;font-size:14px;line-height:1.5;text-align:center}.footer-area[data-v-450358b0]{position:fixed;right:0;bottom:0;left:0;display:flex;justify-content:center;height:84px;padding-top:16px;background:#fff}.return-button[data-v-450358b0]{width:142px;height:34px;padding:0;border:1px solid #bfbfbf;border-radius:19px;background:#fff;color:#111;font-size:14px;line-height:32px}.return-button[data-v-450358b0]::after{border:0}.button-hover[data-v-450358b0]{background:#f6f6f6}",""]),t.exports=e},"0e72":function(t,e,r){"use strict";r.r(e);var n=r("ca8e"),i=r.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);e["default"]=i.a},"142f":function(t,e,r){"use strict";r.r(e);var n=r("d2e7"),i=r.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);e["default"]=i.a},1444:function(t,e,r){var n=r("badb");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var i=r("967d").default;i("33bd6a49",n,!0,{sourceMap:!1,shadowMode:!1})},"234c":function(t,e,r){"use strict";var n=r("1444"),i=r.n(n);i.a},"24f9":function(t,e,r){"use strict";r("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.getContractDetail=function(t){return(0,n.requestGet)("/api/jz_contract/contract_detail",t)},e.getContractList=function(t){return(0,n.requestGet)("/api/jz_contract/contract_list",t)};var n=r("277b")},2634:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){
|
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
e.default=function(){return t};var t={},r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(M){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),s=new O(n||[]);return o(a,"_invoke",{value:k(t,r,s)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(M){return{type:"throw",arg:M}}}t.wrap=l;var h={};function p(){}function v(){}function g(){}var m={};f(m,s,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(E([])));y&&y!==r&&i.call(y,s)&&(m=y);var b=g.prototype=p.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var r;o(this,"_invoke",{value:function(o,a){function s(){return new e((function(r,s){(function r(o,a,s,c){var u=d(t[o],t,a);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==(0,n.default)(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,s,c)}),(function(t){r("throw",t,s,c)})):e.resolve(l).then((function(t){f.value=t,s(f)}),(function(t){return r("throw",t,s,c)}))}c(u.arg)})(o,a,r,s)}))}return r=r?r.then(s,s):s()}})}function k(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return A()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=T(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator["return"]&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function E(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:A}}function A(){return{value:void 0,done:!0}}return v.prototype=g,o(b,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:v,configurable:!0}),v.displayName=f(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),f(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new x(l(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),f(b,u,"Generator"),f(b,s,(function(){return this})),f(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=E,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t},r("6a54"),r("01a2"),r("e39c"),r("bf0f"),r("844d"),r("18f7"),r("de6c"),r("3872e"),r("4e9b"),r("114e"),r("c240"),r("926e"),r("7a76"),r("c9b5"),r("aa9c"),r("2797"),r("8a8d"),r("dc69"),r("f7a5");var n=function(t){return t&&t.__esModule?t:{default:t}}(r("fcf3"))},"277b":function(t,e,r){"use strict";r("6a54");var n=r("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.request=c,e.requestGet=function(t,e){return c(t,"GET",e)},e.requestPost=function(t,e){return c(t,"POST",e)};var i=n(r("fcf3"));r("5c47"),r("0506"),r("bf0f");var o=r("47a5");function a(t){var e=String(t||"");return/^https?:\/\//i.test(e)?e:function(){return"undefined"!==typeof window&&window.location?window.location.protocol+"//"+window.location.host:""}()+("/"===e.charAt(0)?e:"/"+e)}function s(){var t={"content-type":"application/json",is_release:1,"Form-type":"gzh"},e=(0,o.readTokenFromStorage)();return e&&(t["Authori-zation"]="Bearer "+e),t}function c(t,e,r){return new Promise((function(n,o){uni.request({url:a(t),method:e||"GET",data:r||{},header:s(),timeout:15e3,success:function(t){var e=t.data;e&&"object"===(0,i.default)(e)&&void 0!==e.status&&200!==e.status?o(e):n(e)},fail:function(t){o(t)}})}))}},"2a3d":function(t,e,r){"use strict";r.r(e);var n=r("c64a"),i=r("142f");for(var o in i)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(o);r("234c");var a=r("828b"),s=Object(a["a"])(i["default"],n["b"],n["c"],!1,null,"2f0f214c",null,!1,n["a"],void 0);e["default"]=s.exports},"2fdc":function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){try{var s=t[o](a),c=s.value}catch(u){return void r(u)}s.done?e(c):Promise.resolve(c).then(n,i)}r("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function s(t){n(a,i,o,s,c,"next",t)}function c(t){n(a,i,o,s,c,"throw",t)}s(void 0)}))}},r("bf0f")},3471:function(t,e,r){"use strict";r("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var r="undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=(0,n.default)(t))||e&&t&&"number"===typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){c=!0,a=t},f:function(){try{s||null==r["return"]||r["return"]()}finally{if(c)throw a}}}},r("01a2"),r("e39c"),r("bf0f"),r("844d"),r("18f7"),r("de6c"),r("7a76"),r("c9b5");var n=function(t){return t&&t.__esModule?t:{default:t}}(r("5d6b"))},4519:function(t,e,r){"use strict";var n=r("72ca"),i=r.n(n);i.a},"479d":function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){return n}));var n={jyfParser:r("2a3d").default},i=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("v-uni-view",{staticClass:"preview-page"},[r("v-uni-scroll-view",{staticClass:"preview-scroll",attrs:{"scroll-y":!0}},[r("v-uni-view",{staticClass:"preview-content"},[t.loading?r("v-uni-view",{staticClass:"state-text"},[t._v("加载中...")]):t.errorMessage?r("v-uni-view",{staticClass:"state-text",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.loadDetail.apply(void 0,arguments)}}},[t._v(t._s(t.errorMessage))]):r("jyf-parser",{attrs:{html:t.agreementHtml,"tag-style":t.tagStyle,selectable:!0},on:{linkpress:function(e){arguments[0]=e=t.$handleEvent(e),t.handleLinkPress.apply(void 0,arguments)}}})],1)],1),r("v-uni-view",{staticClass:"footer-area"},[r("v-uni-button",{staticClass:"return-button",attrs:{"hover-class":"button-hover"},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.handleBack.apply(void 0,arguments)}}},[t._v("返回")])],1)],1)},o=[]},"47a5":function(t,e,r){"use strict";r("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.extractTokenFromUrl=a,e.getCurrentWebviewUrl=u,e.getH5ReferrerUrl=f,e.readTokenFromStorage=c,e.refreshCurrentWebviewToken=function(t){var e=[],r=String(t||"").trim(),n=String(u()||"").trim(),i=f();r&&e.push(r);n&&-1===e.indexOf(n)&&e.push(n);i&&-1===e.indexOf(i)&&e.push(i);for(var o=0;o<e.length;o+=1){var l=a(e[o]);if(l)return s(l)}return c()},e.saveTokenToStorage=s,r("5c47"),r("a1c1"),r("0c26"),r("5ef2"),r("f7a5"),r("aa9c");function n(t){return String(t||"").trim().replace(/^Bearer\s+/i,"")}function i(t){try{return decodeURIComponent(String(t||"").replace(/\+/g,"%20"))}catch(e){return String(t||"")}}function o(t){var e=["token","remote_token","access_token","Authori-zation","Authorization"],r=String(t||"").replace(/^[?#&]/,"");if(!r)return"";for(var o=r.split("&"),a=0;a<o.length;a+=1){var s=o[a],c=s.indexOf("="),u=i(c>=0?s.slice(0,c):s),f=i(c>=0?s.slice(c+1):"");if(-1!==e.indexOf(u)&&f)return n(f)}return""}function a(t){var e=String(t||"").trim();if(!e)return"";var r=e.indexOf("?");if(-1!==r){var n=e.indexOf("#",r),i=e.slice(r+1,-1===n?e.length:n),a=o(i);if(a)return a}var s=e.indexOf("#");if(-1!==s){var c=e.slice(s+1),u=c.indexOf("?"),f=-1===u?c:c.slice(u+1),l=o(f);if(l)return l}return o(e)}function s(t){var e=n(t);return e?(uni.setStorageSync("LOGIN_STATUS_TOKEN",e),e):""}function c(){return n(uni.getStorageSync("LOGIN_STATUS_TOKEN"))}function u(){return"undefined"!==typeof window&&window.location?window.location.href:""}function f(){return"undefined"!==typeof document&&document.referrer||""}},"72ca":function(t,e,r){var n=r("0bce");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var i=r("967d").default;i("4b0930ad",n,!0,{sourceMap:!1,shadowMode:!1})},b475:function(t,e,r){"use strict";r("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default={userAgentStyles:{blockquote:"margin:5px 0;padding:5px 8px;border-left:3px solid #dbdbdb;background:#f8f8f8;",code:"font-family:monospace;background:#f6f6f6;padding:1px 3px;border-radius:2px;",img:"max-width:100%;height:auto;",ol:"margin:0;padding-left:20px;",p:"margin:0;",table:"border-collapse:collapse;width:100%;",td:"border:1px solid #ddd;padding:4px;",th:"border:1px solid #ddd;padding:4px;",ul:"margin:0;padding-left:20px;",video:"max-width:100%;"}}},badb:function(t,e,r){var n=r("c86c");e=n(!1),e.push([t.i,"@-webkit-keyframes show-data-v-2f0f214c{0%{opacity:0}100%{opacity:1}}@keyframes show-data-v-2f0f214c{0%{opacity:0}100%{opacity:1}}\n\n\n\n",""]),t.exports=e},bbc2:function(t,e,r){"use strict";r.r(e);var n=r("479d"),i=r("0e72");for(var o in i)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(o);r("4519");var a=r("828b"),s=Object(a["a"])(i["default"],n["b"],n["c"],!1,null,"450358b0",null,!1,n["a"],void 0);e["default"]=s.exports},c64a:function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){}));var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("v-uni-view",[t.nodes.length?t._e():t._t("default"),r("v-uni-view",{style:t.showAm+(t.selectable?";user-select:text;-webkit-user-select:text":""),attrs:{id:"top",animation:t.scaleAm},on:{touchstart:function(e){arguments[0]=e=t.$handleEvent(e),t._touchstart.apply(void 0,arguments)},touchmove:function(e){arguments[0]=e=t.$handleEvent(e),t._touchmove.apply(void 0,arguments)},click:function(e){arguments[0]=e=t.$handleEvent(e),t._tap.apply(void 0,arguments)}}},[r("div",{attrs:{id:"rtf"+t.uid}})])],2)},i=[]},ca8e:function(t,e,r){"use strict";r("6a54");var n=r("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,r("5c47"),r("0506"),r("fd3c"),r("8f71"),r("bf0f"),r("dfcf"),r("0c26"),r("a1c1");var i=n(r("fcf3")),o=n(r("2634")),a=n(r("2fdc")),s=n(r("2a3d")),c=r("24f9"),u=r("47a5"),f={components:{"jyf-parser":s.default},data:function(){return{id:"",detailHtml:"",loading:!1,errorMessage:"",tagStyle:{p:"margin:0 0 7px 0;line-height:1.42;text-align:justify;font-size:15px;color:#111;",strong:"font-weight:700;",div:"font-size:15px;line-height:1.45;color:#111;",img:"max-width:100%;height:auto;display:block;",table:"width:100%;border-collapse:collapse;",video:"max-width:100%;"}}},computed:{agreementHtml:function(){return this.detailHtml||"<p>暂无协议内容</p>"}},onLoad:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,u.refreshCurrentWebviewToken)(t.token?"?token="+encodeURIComponent(t.token):""),this.id=t.id||"",uni.setNavigationBarTitle({title:"商户协议预览"}),this.loadDetail()},methods:{loadDetail:function(){var t=this;return(0,a.default)((0,o.default)().mark((function e(){var r,n;return(0,o.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.id){e.next=3;break}return t.errorMessage="协议ID为空",e.abrupt("return");case 3:return t.loading=!0,t.errorMessage="",e.prev=5,e.next=8,(0,c.getContractDetail)({id:t.id});case 8:r=e.sent,n=t.unwrapPayload(r),t.detailHtml=t.normalizeDetailHtml(n),t.setPageTitle(n),e.next=17;break;case 14:e.prev=14,e.t0=e["catch"](5),t.errorMessage=t.getErrorMessage(e.t0,"协议详情加载失败,点击重试");case 17:return e.prev=17,t.loading=!1,e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[5,14,17,20]])})))()},unwrapPayload:function(t){return t&&"object"===(0,i.default)(t)&&void 0!==t.data?t.data:t},normalizeDetailHtml:function(t){var e=this,r=this.pickDetailContent(t);return r?/<[a-z][\s\S]*>/i.test(r)?r:String(r).split(/\n+/).map((function(t){return t.trim()})).filter(Boolean).map((function(t){return"<p>"+e.escapeHtml(t)+"</p>"})).join(""):"<p>暂无协议内容</p>"},pickDetailContent:function(t){if("string"===typeof t)return t;if(!t||"object"!==(0,i.default)(t))return"";for(var e=[t.content,t.contract_content,t.agreement_content,t.html,t.detail,t.body,t.template,t.text,t.data],r=0;r<e.length;r+=1)if("string"===typeof e[r]&&e[r].trim())return e[r];return t.data&&"object"===(0,i.default)(t.data)?this.pickDetailContent(t.data):""},setPageTitle:function(t){if(t&&"object"===(0,i.default)(t)){var e=t.content_name||t.title||t.name||t.contract_name||t.agreement_name||t.contract_title;e&&uni.setNavigationBarTitle({title:String(e)})}},escapeHtml:function(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},getErrorMessage:function(t,e){return t&&t.msg?t.msg:t&&t.message?t.message:"string"===typeof t?t:e},handleLinkPress:function(t){t&&"function"===typeof t.ignore&&t.ignore()},handleBack:function(){var t=getCurrentPages();t.length>1?uni.navigateBack():uni.redirectTo({url:"/pages/agreement/index"})}}};e.default=f},d2e7:function(module,exports,__webpack_require__){"use strict";__webpack_require__("6a54");var _interopRequireDefault=__webpack_require__("f5bd").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createForOfIteratorHelper2=_interopRequireDefault(__webpack_require__("3471"));__webpack_require__("f7a5"),__webpack_require__("c9b5"),__webpack_require__("bf0f"),__webpack_require__("ab80"),__webpack_require__("5ef2"),__webpack_require__("4626"),__webpack_require__("5ac7"),__webpack_require__("5c47"),__webpack_require__("2c10"),__webpack_require__("a1c1"),__webpack_require__("e838"),__webpack_require__("c223"),__webpack_require__("aa9c");var _config=_interopRequireDefault(__webpack_require__("b475")),rpx=uni.getSystemInfoSync().screenWidth/750,_default={name:"parser",data:function(){return{uid:"jyf"+Math.random().toString(36).slice(2),scaleAm:"",showAm:"",imgs:[],nodes:[]}},props:{html:null,autopause:{type:Boolean,default:!0},autosetTitle:{type:Boolean,default:!0},domain:String,gestureZoom:Boolean,lazyLoad:Boolean,selectable:Boolean,tagStyle:Object,showWithAnimation:Boolean,useAnchor:Boolean},watch:{html:function(t){this.setContent(t)}},mounted:function(){this.imgList=[],this.imgList.each=function(t){for(var e=0,r=this.length;e<r;e++)this.setItem(e,t(this[e],e,this))},this.imgList.setItem=function(t,e){if(void 0!=t&&e){if(0==e.indexOf("http")&&this.includes(e)){for(var r,n="",i=0;r=e[i];i++){if("/"==r&&"/"!=e[i-1]&&"/"!=e[i+1])break;n+=Math.random()>.5?r.toUpperCase():r}return n+=e.substr(i),this[t]=n}if(this[t]=e,e.includes("data:image")){var o=e.match(/data:image\/(\S+?);(\S+?),(.+)/);if(!o)return}}},this.html&&this.setContent(this.html)},beforeDestroy:function(){this._destroy()},beforeUnmount:function(){this._destroy()},methods:{_destroy:function(){this._destroyed||(this._destroyed=!0,this._observer&&this._observer.disconnect(),this.imgList&&this.imgList.each((function(t){})),clearInterval(this._timer))},_Dom2Str:function(t){var e,r="",n=(0,_createForOfIteratorHelper2.default)(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;if("text"==i.type)r+=i.text;else{for(var o in r+="<"+i.name,i.attrs||{})r+=" "+o+'="'+i.attrs[o]+'"';i.children&&i.children.length?r+=">"+this._Dom2Str(i.children)+"</"+i.name+">":r+=">"}}}catch(a){n.e(a)}finally{n.f()}return r},_handleHtml:function(t,e){if("string"!=typeof t&&(t=this._Dom2Str(t.nodes||t)),t.includes("rpx")&&(t=t.replace(/[0-9.]+\s*rpx/g,(function(t){return parseFloat(t)*rpx+"px"}))),!e){var r="<style scoped>@keyframes show{0%{opacity:0}100%{opacity:1}}";for(var n in _config.default.userAgentStyles)r+="".concat(n,"{").concat(_config.default.userAgentStyles[n],"}");for(n in this.tagStyle)r+="".concat(n,"{").concat(this.tagStyle[n],"}");r+="</style>",t=r+t}return t},setContent:function(t,e){var r=this;if(t){var n=document.createElement("div");e?this.rtf?this.rtf.appendChild(n):this.rtf=n:(this.rtf&&this.rtf.parentNode.removeChild(this.rtf),this.rtf=n),n.innerHTML=this._handleHtml(t,e);for(var i,o=this.rtf.getElementsByTagName("style"),a=0;i=o[a++];)i.innerHTML=i.innerHTML.replace(/body/g,"#rtf"+this.uid),i.setAttribute("scoped","true");!this._observer&&this.lazyLoad&&IntersectionObserver&&(this._observer=new IntersectionObserver((function(t){for(var e,n=0;e=t[n++];)e.isIntersecting&&(e.target.src=e.target.getAttribute("data-src"),e.target.removeAttribute("data-src"),r._observer.unobserve(e.target))}),{rootMargin:"900px 0px 900px 0px"}));var s=this,c=this.rtf.getElementsByTagName("title");c.length&&this.autosetTitle&&uni.setNavigationBarTitle({title:c[0].innerText}),this.imgList.length=0;for(var u,f=this.rtf.getElementsByTagName("img"),l=0,d=0;u=f[l];l++){u.style.maxWidth="100%";var h=u.getAttribute("src");this.domain&&h&&("/"==h[0]?"/"==h[1]?u.src=(this.domain.includes("://")?this.domain.split("://")[0]:"")+":"+h:u.src=this.domain+h:h.includes("://")||(u.src=this.domain+"/"+h)),u.hasAttribute("ignore")||"A"==u.parentElement.nodeName||(u.i=d++,s.imgList.push(u.src||u.getAttribute("data-src")),u.onclick=function(){var t=!0;this.ignore=function(){return t=!1},s.$emit("imgtap",this),t&&uni.previewImage({current:this.i,urls:s.imgList})}),u.onerror=function(){s.$emit("error",{source:"img",target:this})},s.lazyLoad&&this._observer&&u.src&&0!=u.i&&(u.setAttribute("data-src",u.src),u.removeAttribute("src"),this._observer.observe(u))}var p,v=this.rtf.getElementsByTagName("a"),g=(0,_createForOfIteratorHelper2.default)(v);try{for(g.s();!(p=g.n()).done;){var m=p.value;m.onclick=function(){var t=!0,e=this.getAttribute("href");if(s.$emit("linkpress",{href:e,ignore:function(){return t=!1}}),t&&e)if("#"==e[0])s.useAnchor&&s.navigateTo({id:e.substr(1)});else{if(0==e.indexOf("http")||0==e.indexOf("//"))return!0;uni.navigateTo({url:e})}return!1}}}catch(L){g.e(L)}finally{g.f()}var _=this.rtf.getElementsByTagName("video");s.videoContexts=_;for(var y,b=0;y=_[b++];)y.style.maxWidth="100%",y.style.height="auto",y.onerror=function(){s.$emit("error",{source:"video",target:this})},y.onplay=function(){if(s.autopause)for(var t,e=0;t=s.videoContexts[e++];)t!=this&&t.pause()};var w,x,k=this.rtf.getElementsByTagName("audios"),T=(0,_createForOfIteratorHelper2.default)(k);try{for(T.s();!(w=T.n()).done;){var S=w.value;S.onerror=function(){s.$emit("error",{source:"audio",target:this})}}}catch(L){T.e(L)}finally{T.f()}this.document=this.rtf,e||document.getElementById("rtf"+this.uid).appendChild(this.rtf),this.$nextTick((function(){r.nodes=[1],r.$emit("load")})),setTimeout((function(){return r.showAm=""}),500),clearInterval(this._timer),this._timer=setInterval((function(){var t=[r.rtf.getBoundingClientRect()];r.width=t[0].width,t[0].height==x&&(r.$emit("ready",t[0]),clearInterval(r._timer)),x=t[0].height}),350),this.showWithAnimation&&!e&&(this.showAm="animation:show .5s")}else this.rtf&&!e&&this.rtf.parentNode.removeChild(this.rtf)},getText:function(){arguments.length>0&&void 0!==arguments[0]||this.nodes;return this.rtf.innerText},navigateTo:function(t){if(!this.useAnchor)return t.fail&&t.fail({errMsg:"Anchor is disabled"});if(!t.id)return window.scrollTo(0,this.rtf.offsetTop),t.success&&t.success({errMsg:"pageScrollTo:ok"});var e=document.getElementById(t.id);if(!e)return t.fail&&t.fail({errMsg:"Label not found"});t.scrollTop=this.rtf.offsetTop+e.offsetTop,uni.pageScrollTo(t)},getVideoContext:function(t){if(!t)return this.videoContexts;for(var e=this.videoContexts.length;e--;)if(this.videoContexts[e].id==t)return this.videoContexts[e]},preLoad:function preLoad(html,num){html.constructor==Array&&(html=this._Dom2Str(html));var script="var contain=document.createElement('div');contain.innerHTML='"+html.replace(/'/g,"\\'")+"';for(var imgs=contain.querySelectorAll('img'),i=imgs.length-1;i>="+num+";i--)imgs[i].removeAttribute('src');";eval(script)},_tap:function(t){if(this.gestureZoom&&t.timeStamp-this._lastT<300){var e=t.touches[0].pageY-t.currentTarget.offsetTop;if(this._zoom)this._scaleAm.translateX(0).scale(1).step(),uni.pageScrollTo({scrollTop:(e+this._initY)/2-t.touches[0].clientY,duration:400});else{var r=t.touches[0].pageX-t.currentTarget.offsetLeft;this._initY=e,this._scaleAm=uni.createAnimation({transformOrigin:"".concat(r,"px ").concat(this._initY,"px 0"),timingFunction:"ease-in-out"}),this._scaleAm.scale(2).step(),this._tMax=r/2,this._tMin=(r-this.width)/2,this._tX=0}this._zoom=!this._zoom,this.scaleAm=this._scaleAm.export()}this._lastT=t.timeStamp},_touchstart:function(t){1==t.touches.length&&(this._initX=this._lastX=t.touches[0].pageX)},_touchmove:function(t){var e=t.touches[0].pageX-this._lastX;if(this._zoom&&1==t.touches.length&&Math.abs(e)>20){if(this._lastX=t.touches[0].pageX,this._tX<=this._tMin&&e<0||this._tX>=this._tMax&&e>0)return;this._tX+=e*Math.abs(this._lastX-this._initX)*.05,this._tX<this._tMin&&(this._tX=this._tMin),this._tX>this._tMax&&(this._tX=this._tMax),this._scaleAm.translateX(this._tX).step(),this.scaleAm=this._scaleAm.export()}}}};exports.default=_default}}]); |