var thisWidget; //当前页面业务 function initWidgetView(_thisWidget) { thisWidget = _thisWidget; if (thisWidget.config && thisWidget.config.style) {//适应不同样式 $("body").addClass(thisWidget.config.style); } $("#btnFlyStop").click(function (event) { thisWidget.toRoamLine(); }); $("#btnSelChars").click(function (event) { thisWidget.showHeightChars(); }); var attr = thisWidget.getAttr(); var followedX = attr.camera.followedX || 200 var followedZ = attr.camera.followedZ || 50 //改变视角模式 $("#followedX").val(followedX); $("#followedZ").val(followedZ); $('#cameraType').attr('data-value', attr.camera.type); $('#cameraType').select(); //绑定样式 $('#cameraType').change(function () { $("#tr_followedX").hide(); $("#tr_followedZ").hide(); var attrVal = $(this).attr('data-value'); switch (attrVal) { case "dy"://锁定第一视角 $("#tr_followedX").show(); $("#tr_followedZ").show(); $("#followedX").val(followedX); $("#followedZ").val(followedZ); break; case "sd"://锁定上帝视角 $("#tr_followedZ").show(); var sdZ = Number($("#followedZ").val()); if (sdZ < 500) $("#followedZ").val(500); break; } updateCameraSetting(); }); $('#cameraType').change(); //第一视角 $("#followedX").change(function () { updateCameraSetting(); }); $("#followedZ").change(function () { updateCameraSetting(); }); } //改变视角模式 function updateCameraSetting() { var cameraType = $("#cameraType").attr('data-value'); var followedX = Number($("#followedX").val()); var followedZ = Number($("#followedZ").val()); thisWidget.updateStyle({ camera: { type: cameraType, followedX: followedX, followedZ: followedZ } }); } //显示基本信息,名称、总长、总时间 var _alltime = 100; function showAllInfo(params) { _alltime = params.alltime; $("#td_name").html(params.name); $("#td_alltimes").html(haoutil.str.formatTime(params.alltime)); $("#td_alllength").html(haoutil.str.formatLength(params.alllen)); } //显示实时坐标和时间 function showRealTimeInfo(params) { var val = Math.ceil(params.time * 100 / _alltime); if (val < 1) val = 1; if (val > 100) val = 100; $(".progress-bar").css("width", val + '%').attr('aria-valuenow', val).html(val + '%'); $("#td_jd").html(params.x); $("#td_wd").html(params.y); $("#td_gd").html(haoutil.str.formatLength(params.z)); $("#td_times").html(haoutil.str.formatTime(params.time)); $("#td_length").html(haoutil.str.formatLength(params.len)); if (params.hbgd) $("#td_dmhb").html(haoutil.str.formatLength(params.hbgd)); else $("#td_dmhb").html('未知'); if (params.ldgd) $("#td_ldgd").html(haoutil.str.formatLength(params.ldgd)); else $("#td_ldgd").html('未知'); } //下拉框 (function ($) { //下拉菜单默认参数 var defaluts = { select: "mp_select", select_text: "mp_select_text", select_ul: "mp_select_ul" }; $.fn.extend({ // 下拉菜单 // 下拉菜单 "select": function (options) { var opts = $.extend({}, defaluts, options); return this.each(function () { var that = $(this); //模拟下拉列表 if (that.data("value") !== undefined && that.data("value") !== '') { that.val(that.data("value")); } var _html = []; _html.push("