123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- // 基本信息(包括userAgent、上个页面传递的数据)
- var baseInfo = null,
- // 基础环境信息(包括当前webview)
- baseEnv = null;
-
- // 获取基本信息(包括userAgent、上个页面传递的数据)
- var getBaseInfo = function() {
- // 登录的相关信息
- var userAgent = plus && JSON.parse(plus.storage.getItem("userAgent"))
- return {
- userAgent: userAgent,
- eventInfo: baseEnv.webview.eventInfo,
- patiInfo: baseEnv.webview.patiInfo
- }
- },
- // 获取基础环境信息
- getBaseEnvPromise = function () {
-
- var env = {
- webview: plus&&plus.webview.currentWebview()
- };
- return Promise.resolve().then(function(res) {
- return env;
- });
- };
- // 页面业务处理流程开始
- new Promise(function(resolve, reject) {
- mui.plusReady(function() {
- // plus已经准备好,可以往下执行
- resolve(true);
- });
- })
- .then(function() {
- plus.nativeUI.showWaiting();
- // 获取基础环境信息
- return getBaseEnvPromise().then(function(env) {
- baseEnv = env;
- // 获取登录医生信息
- baseInfo = getBaseInfo();
- })
- })
- .then(function() { //cy
- return getReqPromise('doctor/health_record/medical_detail',{
- medicalNo: baseInfo.eventInfo.medicalNo,patient:baseInfo.patiInfo.code
- },'POST').then(function(res){
- plus.nativeUI.closeWaiting();
- var data = {};
- if(res.status == 200) {
- data = res.medical_detail;
- } else {
- mui.toast(res.msg);
- }
-
- var vm = avalon.define($.extend({},{"$id": "viewController"},{
- data: data
- }));
- avalon.scan();
- }).catch(function(e) {
- plus.nativeUI.closeWaiting();
- console && console.error(e);
- })
- })
- .then(function() {
- function showAutoItems(el) {
- var $item = $(el).closest('[auto-item]');
- if($item.length && $item.is(":hidden")) {
- $item.removeClass('elastic-columns-ignore')
- $item.show();
- showAutoItems($item.parent());
- }
- }
- _.each($('[item-value]'),function(el) {
- var $el = $(el);
- var text = $.trim($el.text());
- if(text) {
- showAutoItems($el);
- }
- })
- })
- .then(function() {
- $('.c-panel').on('click','.c-panel-bar',function() {
- var $panel = $(this).closest('.c-panel'),
- $content = $panel.find('.c-panel-content');
- $('.c-panel.expanding').not($panel[0]).removeClass('expanding').find('.c-panel-content').slideUp();
- $panel.toggleClass('expanding');
- if($panel.hasClass('expanding')) {
- var $container = $panel.find('.card-layout');
- $content.slideDown(function() {
- if($container.length) {
- $container.elasticColumns(
- {
- columns: 2, // the number of colums
- innerMargin: 5, // the gap between two tiles
- outerMargin: 5 // the gap between the tiles and
- // the edge of the container
- });
- }
- });
-
- } else {
- $content.slideUp();
- }
- });
- }).catch(function(e) {
- plus.nativeUI.closeWaiting();
- console && console.error(e);
- })
|