TeachingSet.c3514496.js 5.1 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["TeachingSet"],{"1e95":function(t,e,a){},3354:function(t,e,a){},"4ca3":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"teachingset"},[a("m-header"),a("van-search",{attrs:{shape:"round",placeholder:"搜小区、学校",background:"transparent","show-action":""},on:{search:t.onSearch},model:{value:t.search_value,callback:function(e){t.search_value=e},expression:"search_value"}},[a("div",{attrs:{slot:"action"},on:{click:t.onSearch},slot:"action"},[t._v("搜索")])]),a("el-amap",{attrs:{zoom:t.zoom,events:t.amapEvents(),plugin:t.plugin,center:t.center}},t._l(t.markers,function(t,e){return a("el-amap-marker",{key:e,attrs:{clickable:!0,events:t.events,position:t.position}})}),1),a("van-cell-group",[a("van-field",{attrs:{type:"textarea",rows:"1",autosize:"",disabled:!0,label:"教学地址",placeholder:"详情地址"},model:{value:t.addressDetail,callback:function(e){t.addressDetail=e},expression:"addressDetail"}}),a("van-field",{attrs:{type:"text",label:"教学点名称",placeholder:"请输入名称"},model:{value:t.teachingSchool,callback:function(e){t.teachingSchool=e},expression:"teachingSchool"}})],1),a("div",{staticClass:"button-group"},[a("van-button",{attrs:{type:"primary",round:"",size:"large"},on:{click:t.onSubmit}},[t._v("确认")])],1)],1)},i=[],s=(a("386d"),a("28a5"),a("7f7f"),a("6e6e")),o=a("9afb"),r={name:"teachingset",components:{MHeader:s["a"]},data:function(){var t=this;return{type:this.$route.query.type,search_value:"",zoom:12,center:[114.34371,30.55939],markers:[],searchResult:[],plugin:[{pName:"Geolocation",events:{init:function(e){"create"==t.type&&e.getCurrentPosition(function(e,a){a&&a.position&&(t.lng=a.position.lng,t.lat=a.position.lat,t.center=[t.lng,t.lat],t.loaded=!0,t.$nextTick())})}}},{pName:"ToolBar",events:{init:function(){}}}],searchOption:{pageSize:1,pageIndex:1,autoFitView:!0},addressDetail:null,teachingSchool:null,lnglat:null}},mounted:function(){document.title="教学点设置";var t=this.$route.query;if(t.Authorization&&(localStorage.setItem("Authorization",decodeURI(t.Authorization)),localStorage.setItem("userInfo",decodeURI(t.Authorization))),"update"==t.type){this.addressDetail=t.address,this.teachingSchool=t.name,this.lnglat=t.longitudeLatitude;var e=t.longitudeLatitude.split(",");this.center=[e[0],e[1]],this.markers.push({position:[e[0],e[1]],events:this.markerEvents()})}},methods:{amapEvents:function(){return{complete:function(){}}},onSubmit:function(){var t=this;this.addressDetail?this.teachingSchool?"create"==this.type?Object(o["s"])({name:this.teachingSchool,address:this.addressDetail,longitudeLatitude:this.lnglat}).then(function(e){var a=e.data;200==a.code?(t.$toast("添加成功"),t.$router.push("/teachingSchool")):t.$toast(a.msg)}):"update"==this.type&&Object(o["u"])({id:this.$route.query.id,name:this.teachingSchool,address:this.addressDetail,longitudeLatitude:this.lnglat}).then(function(e){var a=e.data;200==a.code?(t.$toast("修改成功"),t.$router.push("/teachingSchool")):t.$toast(a.msg)}):this.$toast("请输入教学点名称"):this.$toast("请选择教学地点")},onSearch:function(){var t=this;if(this.search_value){this.markers=[];var e=new AMap.PlaceSearch(this.searchOption);e.search(this.search_value,function(e,a){if(a&&a.poiList&&a.poiList.count){var n=a.poiList.pois[0];t.searchResult.push(n),t.markers.push({position:[n.location.lng,n.location.lat],events:t.markerEvents(n)}),t.center=[n.location.lng,n.location.lat]}else if(void 0===a.poiList)throw new Error(a)})}},markerEvents:function(){var t=this;return{click:function(e){var a=new AMap.Geocoder;a.getAddress(e.lnglat,function(a,n){"complete"===a&&n.regeocode?(t.lnglat=e.lnglat.lng+","+e.lnglat.lat,t.addressDetail=n.regeocode.formattedAddress):t.$toast("请重新选择地址")})}}}}},l=r,c=(a("9049"),a("2877")),u=Object(c["a"])(l,n,i,!1,null,"19a3a253",null);e["default"]=u.exports},5115:function(t,e,a){"use strict";var n=a("3354"),i=a.n(n);i.a},"6e6e":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"mheader"},[a("header",{staticClass:"m-nav-header",class:[t.isFixed?"fixed":""]},[a("div",{directives:[{name:"show",rawName:"v-show",value:t.isBack,expression:"isBack"}],staticClass:"m-nav-bar__left",on:{click:t.goBack}},[a("van-icon",{staticClass:"arrow-left",attrs:{name:"arrow-left"}})],1),a("div",{staticClass:"m-nav-bar__title"},[t._t("default",[t._v(t._s(t.name?t.name:this.$route.meta.descrition))])],2),a("div",{staticClass:"m-nav-bar__right"},[t._t("right")],2)])])},i=[],s={name:"mheader",props:{name:String,isBack:{type:Boolean,default:!0},isFixed:{type:Boolean,default:!0},backUrl:{type:Object,default:function(){return{callBack:null,path:"",params:{}}}}},methods:{goBack:function(){var t=this.backUrl;"function"==typeof t.callBack?t.callBack():t.path?this.$router.push({path:t.path,query:t.params}):history.go(-1)}}},o=s,r=(a("5115"),a("2877")),l=Object(r["a"])(o,n,i,!1,null,"61d0e2e4",null);e["a"]=l.exports},9049:function(t,e,a){"use strict";var n=a("1e95"),i=a.n(n);i.a}}]);