TeachingSet.4de1224e.js 13 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["TeachingSet"],{3354:function(t,e,r){},3908:function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("433b");var n=r("d399");function a(t){t?n["a"].loading({duration:0,forbidClick:!0,message:"加载中..."}):n["a"].clear()}},"4ca3":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"teachingset"},[r("m-header"),r("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"}},[r("div",{attrs:{slot:"action"},on:{click:t.onSearch},slot:"action"},[t._v("搜索")])]),r("el-amap",{attrs:{zoom:t.zoom,events:t.amapEvents(),plugin:t.plugin,center:t.center}},t._l(t.markers,(function(t,e){return r("el-amap-marker",{key:e,attrs:{clickable:!0,events:t.events,position:t.position}})})),1),r("van-cell-group",[r("van-field",{attrs:{type:"textarea",rows:"1",autosize:"",readonly:"",label:"教学地址",placeholder:"详情地址"},model:{value:t.addressDetail,callback:function(e){t.addressDetail=e},expression:"addressDetail"}}),r("van-field",{attrs:{type:"text",label:"教学点名称",placeholder:"请输入名称"},model:{value:t.teachingSchool,callback:function(e){t.teachingSchool=e},expression:"teachingSchool"}})],1),r("div",{staticClass:"button-group"},[r("van-button",{attrs:{type:"primary",round:"",size:"large"},on:{click:t.onSubmit}},[t._v("确认")])],1)],1)},a=[],o=r("a34a"),i=r.n(o),c=r("6e6e"),s=r("9afb"),u=r("3908");function l(t,e,r,n,a,o,i){try{var c=t[o](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,a)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function i(t){l(o,n,a,i,c,"next",t)}function c(t){l(o,n,a,i,c,"throw",t)}i(void 0)}))}}var f={name:"teachingset",components:{MHeader:c["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,r){r&&r.position&&(t.lng=r.position.lng,t.lat=r.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=h(i.a.mark((function t(){var e=this;return i.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(this.addressDetail){t.next=3;break}return this.$toast("请选择教学地点"),t.abrupt("return");case 3:if(this.teachingSchool){t.next=6;break}return this.$toast("请输入教学点名称"),t.abrupt("return");case 6:if("create"!=this.type){t.next=12;break}return Object(u["a"])(!0),t.next=10,Object(s["G"])({name:this.teachingSchool,address:this.addressDetail,longitudeLatitude:this.lnglat}).then((function(t){Object(u["a"])(!1);var r=t.data;200==r.code?(e.$toast("添加成功"),e.$router.push("/teachingSchool")):e.$toast(r.msg)})).catch((function(){Object(u["a"])(!1)}));case 10:t.next=16;break;case 12:if("update"!=this.type){t.next=16;break}return Object(u["a"])(!0),t.next=16,Object(s["I"])({id:this.$route.query.id,name:this.teachingSchool,address:this.addressDetail,longitudeLatitude:this.lnglat}).then((function(t){Object(u["a"])(!1);var r=t.data;200==r.code?(e.$toast("修改成功"),e.$router.push("/teachingSchool")):e.$toast(r.msg)})).catch((function(){Object(u["a"])(!1)}));case 16:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}(),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,r){if(r&&r.poiList&&r.poiList.count){var n=r.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===r.poiList)throw new Error(r);r.poiList&&r.poiList.pois.length<=0&&t.$toast("请输入详细地址")}}))}},markerEvents:function(){var t=this;return{click:function(e){var r=new AMap.Geocoder;r.getAddress(e.lnglat,(function(r,n){"complete"===r&&n.regeocode?(t.lnglat=e.lnglat.lng+","+e.lnglat.lat,t.addressDetail=n.regeocode.formattedAddress):t.$toast("请重新选择地址")}))}}}}},p=f,d=(r("fb65"),r("2877")),v=Object(d["a"])(p,n,a,!1,null,"d49a7e10",null);e["default"]=v.exports},5115:function(t,e,r){"use strict";var n=r("3354"),a=r.n(n);a.a},"6e6e":function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"mheader"},[r("header",{staticClass:"m-nav-header",class:[t.isFixed?"fixed":""]},[r("div",{directives:[{name:"show",rawName:"v-show",value:t.isBack,expression:"isBack"}],staticClass:"m-nav-bar__left",on:{click:t.goBack}},[r("van-icon",{staticClass:"arrow-left",attrs:{name:"arrow-left"}})],1),r("div",{staticClass:"m-nav-bar__title"},[t._t("default",[t._v(t._s(t.name?t.name:this.$route.meta.descrition))])],2),r("div",{staticClass:"m-nav-bar__right"},[t._t("right")],2)])])},a=[],o={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)}}},i=o,c=(r("5115"),r("2877")),s=Object(c["a"])(i,n,a,!1,null,"61d0e2e4",null);e["a"]=s.exports},9468:function(t,e,r){},"96cf":function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,a="function"===typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(N){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var a=e&&e.prototype instanceof g?e:g,o=Object.create(a.prototype),i=new $(n||[]);return o._invoke=E(t,r,i),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(N){return{type:"throw",arg:N}}}t.wrap=u;var h="suspendedStart",f="suspendedYield",p="executing",d="completed",v={};function g(){}function m(){}function y(){}var w={};w[o]=function(){return this};var b=Object.getPrototypeOf,x=b&&b(b(B([])));x&&x!==r&&n.call(x,o)&&(w=x);var k=y.prototype=g.prototype=Object.create(w);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(a,o,i,c){var s=l(t[a],t,o);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"===typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(h).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(s.arg)}var a;function o(t,n){function o(){return new e((function(e,a){r(t,n,e,a)}))}return a=a?a.then(o,o):o()}this._invoke=o}function E(t,e,r){var n=h;return function(a,o){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===a)throw o;return G()}r.method=a,r.arg=o;while(1){var i=r.delegate;if(i){var c=S(i,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var s=l(t,e,r);if("normal"===s.type){if(n=r.done?d:f,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}function S(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var a=l(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,v;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function $(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function B(t){if(t){var r=t[o];if(r)return r.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){while(++a<t.length)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:G}}function G(){return{value:e,done:!0}}return m.prototype=k.constructor=y,y.constructor=m,m.displayName=s(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},L(_.prototype),_.prototype[i]=function(){return this},t.AsyncIterator=_,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new _(u(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(k),s(k,c,"Generator"),k[o]=function(){return this},k.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){while(e.length){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=B,$.prototype={constructor:$,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(j),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return c.type="throw",c.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},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),v},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),j(r),v}},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 a=n.arg;j(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:B(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=n}catch(a){Function("r","regeneratorRuntime = r")(n)}},a34a:function(t,e,r){t.exports=r("96cf")},fb65:function(t,e,r){"use strict";var n=r("9468"),a=r.n(n);a.a}}]);