@xysfe/actui
Version:
A fantastic mobile ui lib implement by Vue
1 lines • 10.7 kB
JavaScript
!function(e,s){"object"==typeof exports&&"object"==typeof module?module.exports=s(require("@xysfe/actui/es/assets/utils/create/index.js"),require("@xysfe/actui/es/assets/utils/helpers.js"),require("@xysfe/actui/es/assets/common/goldlayer.js"),require("@xysfe/actui/es/BScroll/index.js"),require("@xysfe/actui/es/Loading/index.js"),require("@xysfe/actui/es/assets/img/icon-search.png"),require("@xysfe/actui/es/assets/img/icon-nodata.png"),require("@xysfe/actui/es/assets/img/icon-nodata-cps.png"),require("@xysfe/actui/es/assets/img/icon-close.png")):"function"==typeof define&&define.amd?define(["@xysfe/actui/es/assets/utils/create/index.js","@xysfe/actui/es/assets/utils/helpers.js","@xysfe/actui/es/assets/common/goldlayer.js","@xysfe/actui/es/BScroll/index.js","@xysfe/actui/es/Loading/index.js","@xysfe/actui/es/assets/img/icon-search.png","@xysfe/actui/es/assets/img/icon-nodata.png","@xysfe/actui/es/assets/img/icon-nodata-cps.png","@xysfe/actui/es/assets/img/icon-close.png"],s):"object"==typeof exports?exports.DiseaseListLayer=s(require("@xysfe/actui/es/assets/utils/create/index.js"),require("@xysfe/actui/es/assets/utils/helpers.js"),require("@xysfe/actui/es/assets/common/goldlayer.js"),require("@xysfe/actui/es/BScroll/index.js"),require("@xysfe/actui/es/Loading/index.js"),require("@xysfe/actui/es/assets/img/icon-search.png"),require("@xysfe/actui/es/assets/img/icon-nodata.png"),require("@xysfe/actui/es/assets/img/icon-nodata-cps.png"),require("@xysfe/actui/es/assets/img/icon-close.png")):e.DiseaseListLayer=s(e["@xysfe/actui/es/assets/utils/create/index.js"],e["@xysfe/actui/es/assets/utils/helpers.js"],e["@xysfe/actui/es/assets/common/goldlayer.js"],e["@xysfe/actui/es/BScroll/index.js"],e["@xysfe/actui/es/Loading/index.js"],e["@xysfe/actui/es/assets/img/icon-search.png"],e["@xysfe/actui/es/assets/img/icon-nodata.png"],e["@xysfe/actui/es/assets/img/icon-nodata-cps.png"],e["@xysfe/actui/es/assets/img/icon-close.png"])}("undefined"!=typeof self?self:this,function(e,s,t,i,a,n,r,o,c){return function(e){function s(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,s),a.l=!0,a.exports}var t={};return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},s.p="../es",s(s.s=2323)}({1296:function(e,s,t){"use strict";var i=t(159),a=t.n(i),n=t(262),r=t.n(n),o=t(260),c=t.n(o),l=t(40);t.n(l);s.a={name:"ActDiseaseListLayer",components:{ActGoldLayer:a.a,ActLoading:r.a},data:function(){return{zIndex:999,isVisible:!1,diseaseList:[],scroll:null,hasMore:!1,loading:!1,searchKeyword:"",hasSearched:!1,docmHeight:document.documentElement.clientHeight,pickerContentHeight:0,searchHeight:"",isShowActLoading:!1}},props:{paramsData:{type:Object,default:function(){return{}}},title:{type:String,default:"疾病清单"},isCps:{type:Boolean,default:!1},brandColor:{type:String,default:"#8c7fee"},searchEmptyResultTips:{type:String,default:"找不到相关疾病"},searchEmptyResultDesc:{type:String,default:"您可以更换一下疾病名称搜索哦"},placeholder:{type:String,default:"请输入您要查询的疾病名称"}},created:function(){var e=this,s=navigator.userAgent;(s.indexOf("Android")>-1||s.indexOf("Adr")>-1)&&(this.handleResize=function(){if(0!==e.pickerContentHeight){var s=document.body.clientHeight;e.docmHeight>s?(e.$refs.pickerContent.style.height=e.docmHeight-s+"px",e.searchHeight=e.pickerContentHeight+s-e.docmHeight+"px"):(e.$refs.pickerContent.style.height=e.pickerContentHeight+"px",e.searchHeight="100%")}},window.addEventListener("resize",this.handleResize))},beforeDestroy:function(){this.handleResize&&window.removeEventListener("resize",this.handleResize)},methods:{maskClick:function(){this.isVisible=!1},show:function(){this.isVisible=!0,this.diseaseList.length?this.refreshScroll():this.initData()},loadMore:function(){this.hasMore&&!this.loading&&(this.currentPage++,this.fetchData())},initData:function(){this.currentPage=1,this.diseaseList=[],this.fetchData(!0)},fetchData:function(){var e=this,s=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.loading){s&&(this.isShowActLoading=!0),this.loading=!0;var i={filter:{},page:this.currentPage,showNum:20};for(var a in this.paramsData){var n=this.paramsData[a];""!==n&&null!=n&&void 0!==n&&(i[a]=this.paramsData[a])}this.searchKeyword&&(i.filter.name=this.searchKeyword),this.$fetch("/buy/getDiseaseList",i).then(function(s){var i=s.ret,a=s.errmsg,n=s.data;if(0==+i){t&&(e.diseaseList=[],e.scrollTop());var r=n.list||[];e.totalCount=Number(n.count)||0,e.transformDiseaseList(r),e.hasMore=e.diseaseList.length<e.totalCount,e.refreshScroll()}else e.$toast.show(a)}).catch(function(e){console.log(e)}).finally(function(){e.loading=!1,e.isShowActLoading=!1,e.hasSearched=!0})}},transformDiseaseList:function(e){if(this.searchKeyword){var s=this.isCps?"#F05A4B":"#8C7FEE",t=new RegExp("("+this.searchKeyword+")","g");e.forEach(function(e){e.name=e.name.replace(t,'<span style="color: '+s+';">$1</span>')})}this.diseaseList=[].concat(this.diseaseList,e)},clear:function(){this.searchKeyword="",this.resetSearch()},handleSearch:function(){this.resetSearch()},resetSearch:function(){this.currentPage=1,this.fetchData(!1,!0)},refreshScroll:function(){var e=this;this.$nextTick(function(){e.scroll?e.scroll.refresh():(e.scroll=new c.a(e.$refs.tableWrapper,{click:!0,damping:.6}),e.scroll.on("scrollEnd",function(){e.scroll.y<=e.scroll.maxScrollY+50&&e.hasMore&&!e.loading&&e.loadMore()}))})},scrollTop:function(){this.scroll.scrollTo(0,0,300)}},watch:{isVisible:function(e){var s=this;!this.pickerContentHeight&&e&&this.$nextTick(function(){s.pickerContentHeight=Object(l.outerHeight)(s.$refs.pickerContent)})}}}},159:function(e,s){e.exports=t},2323:function(e,s,t){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i=t(28),a=t.n(i),n=t(2324);n.a.install=function(e){e.component(n.a.name,n.a),e.prototype.$createDiseaseListLayer=a()(n.a,e)},s.default=n.a},2324:function(e,s,t){"use strict";function i(e){o||t(2325)}var a=t(1296),n=t(2326),r=t(7),o=!1,c=i,l=Object(r.a)(a.a,n.a,n.b,!1,c,"data-v-3f9273f6",null);l.options.__file="src\\components\\DiseaseListLayer\\src\\index.vue",s.a=l.exports},2325:function(e,s){},2326:function(e,s,t){"use strict";t.d(s,"a",function(){return i}),t.d(s,"b",function(){return a});var i=function(){var e=this,s=e.$createElement,i=e._self._c||s;return i("div",{staticClass:"act-DiseaseListLayer"},[i("act-gold-layer",{attrs:{title:e.title,mask:!0,center:!1,visible:e.isVisible,zIndex:e.zIndex},on:{close:e.maskClick}},[i("div",{ref:"pickerContent",staticClass:"main-content"},[i("div",{staticClass:"gradual-color"}),e._v(" "),i("div",{staticClass:"header-box"},[i("form",{staticClass:"search-box",on:{submit:function(s){return s.preventDefault(),e.handleSearch.apply(null,arguments)}}},[i("img",{staticClass:"search-icon",attrs:{src:t(638),alt:""}}),e._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:e.searchKeyword,expression:"searchKeyword"}],attrs:{type:"text",placeholder:e.placeholder},domProps:{value:e.searchKeyword},on:{keyup:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.handleSearch.apply(null,arguments)},input:function(s){s.target.composing||(e.searchKeyword=s.target.value)}}}),e._v(" "),e.searchKeyword?i("img",{staticClass:"close-icon",attrs:{src:t(795),alt:""},on:{click:e.clear}}):e._e(),e._v(" "),i("button",{staticStyle:{display:"none"},attrs:{type:"submit"}},[e._v("搜索")])])]),e._v(" "),i("div",{staticClass:"search-content"},[i("div",{directives:[{name:"show",rawName:"v-show",value:e.diseaseList&&e.diseaseList.length,expression:"diseaseList && diseaseList.length"}],ref:"content",staticClass:"content"},[i("div",{staticClass:"table-scroll-bg",style:"height: "+2*e.diseaseList.length+"rem"}),e._v(" "),i("div",{staticClass:"content-header"},[i("div",{staticClass:"table-tr"},[i("p",{staticClass:"order"},[e._v("\n 序号\n ")]),e._v(" "),i("p",{staticClass:"disease"},[e._v("\n 疾病名称\n ")])])]),e._v(" "),i("div",{ref:"tableWrapper",staticClass:"table-scroll-warppper"},[i("div",[i("div",{staticClass:"scroll-content"},[i("table",{attrs:{border:"0",cellspacing:"0",cellpadding:"0"}},[i("tbody",e._l(e.diseaseList,function(s,t){return i("tr",{key:t+s.name,staticClass:"table-tr"},[i("td",{staticClass:"order"},[i("div",{staticClass:"item-order"},[e._v("\n "+e._s(t+1)+"\n ")])]),e._v(" "),i("td",{staticClass:"disease disease-desc"},[i("div",{domProps:{innerHTML:e._s(s.name)}})])])}),0)])]),e._v(" "),i("div",{staticStyle:{width:"100%",height:"3rem"}})])])]),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.hasSearched&&0===e.diseaseList.length,expression:"hasSearched && diseaseList.length === 0"}],staticClass:"search-empty"},[e.isCps?i("img",{attrs:{src:t(794)}}):i("img",{attrs:{src:t(786)}}),e._v(" "),i("h4",{staticClass:"tip"},[e._v(e._s(e.searchEmptyResultTips))]),e._v(" "),i("p",{staticClass:"desc"},[e._v(e._s(e.searchEmptyResultDesc))])]),e._v(" "),e.isShowActLoading?i("div",{staticClass:"loading"},[i("act-loading",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}],attrs:{type:"cir3",color:e.brandColor,size:35}})],1):e._e()])])])],1)},a=[];i._withStripped=!0},260:function(e,s){e.exports=i},262:function(e,s){e.exports=a},28:function(s,t){s.exports=e},40:function(e,t){e.exports=s},638:function(e,s){e.exports=n},7:function(e,s,t){"use strict";function i(e,s,t,i,a,n,r,o){e=e||{};var c=typeof e.default;"object"!==c&&"function"!==c||(e=e.default);var l="function"==typeof e?e.options:e;s&&(l.render=s,l.staticRenderFns=t,l._compiled=!0),i&&(l.functional=!0),n&&(l._scopeId=n);var u;if(r?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},l._ssrRegister=u):a&&(u=o?function(){a.call(this,this.$root.$options.shadowRoot)}:a),u)if(l.functional){l._injectStyles=u;var d=l.render;l.render=function(e,s){return u.call(s),d(e,s)}}else{var h=l.beforeCreate;l.beforeCreate=h?[].concat(h,u):[u]}return{exports:e,options:l}}s.a=i},786:function(e,s){e.exports=r},794:function(e,s){e.exports=o},795:function(e,s){e.exports=c}})});