|  | @@ -48,6 +48,7 @@
 | 
	
		
			
				|  |  |  /* eslint-disable */
 | 
	
		
			
				|  |  |  import MHeader from '@/components/MHeader'
 | 
	
		
			
				|  |  |  import { schoolAdd, schoolUpdate } from '@/api/teacher'
 | 
	
		
			
				|  |  | +import setLoading from '@/utils/loading'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |      name: 'teachingset',
 | 
	
		
			
				|  |  |      components: { MHeader },
 | 
	
	
		
			
				|  | @@ -124,7 +125,7 @@ export default {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | -        onSubmit() { // 确定提交
 | 
	
		
			
				|  |  | +        async onSubmit() { // 确定提交
 | 
	
		
			
				|  |  |              if(!this.addressDetail) {
 | 
	
		
			
				|  |  |                  this.$toast('请选择教学地点')
 | 
	
		
			
				|  |  |                  return
 | 
	
	
		
			
				|  | @@ -135,11 +136,13 @@ export default {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // 添加教学点
 | 
	
		
			
				|  |  |              if(this.type == 'create') {
 | 
	
		
			
				|  |  | -                schoolAdd({
 | 
	
		
			
				|  |  | +                setLoading(true)
 | 
	
		
			
				|  |  | +                await schoolAdd({
 | 
	
		
			
				|  |  |                      name: this.teachingSchool,
 | 
	
		
			
				|  |  |                      address: this.addressDetail,
 | 
	
		
			
				|  |  |                      longitudeLatitude: this.lnglat
 | 
	
		
			
				|  |  |                  }).then(res => {
 | 
	
		
			
				|  |  | +                    setLoading(false)
 | 
	
		
			
				|  |  |                      let result = res.data
 | 
	
		
			
				|  |  |                      if(result.code == 200) {
 | 
	
		
			
				|  |  |                          this.$toast('添加成功')
 | 
	
	
		
			
				|  | @@ -147,14 +150,18 @@ export default {
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          this.$toast(result.msg)
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                }).catch(() => {
 | 
	
		
			
				|  |  | +                    setLoading(false)
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |              } else if(this.type == 'update') {
 | 
	
		
			
				|  |  | -                schoolUpdate({
 | 
	
		
			
				|  |  | +                setLoading(true)
 | 
	
		
			
				|  |  | +                await schoolUpdate({
 | 
	
		
			
				|  |  |                      id: this.$route.query.id,
 | 
	
		
			
				|  |  |                      name: this.teachingSchool,
 | 
	
		
			
				|  |  |                      address: this.addressDetail,
 | 
	
		
			
				|  |  |                      longitudeLatitude: this.lnglat
 | 
	
		
			
				|  |  |                  }).then(res => {
 | 
	
		
			
				|  |  | +                    setLoading(false)
 | 
	
		
			
				|  |  |                      let result = res.data
 | 
	
		
			
				|  |  |                      if(result.code == 200) {
 | 
	
		
			
				|  |  |                          this.$toast('修改成功')
 | 
	
	
		
			
				|  | @@ -162,6 +169,8 @@ export default {
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          this.$toast(result.msg)
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                }).catch(() => {
 | 
	
		
			
				|  |  | +                    setLoading(false)
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
	
		
			
				|  | @@ -169,7 +178,7 @@ export default {
 | 
	
		
			
				|  |  |              if(!this.search_value) return
 | 
	
		
			
				|  |  |              this.markers = [] // 重置位置
 | 
	
		
			
				|  |  |              let mapSearch = new AMap.PlaceSearch(this.searchOption)
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // 目前只需要搜索第一条数据
 | 
	
		
			
				|  |  |              mapSearch.search(this.search_value, (status, sr) => {
 | 
	
		
			
				|  |  |                  if(sr && sr.poiList && sr.poiList.count) {
 | 
	
	
		
			
				|  | @@ -182,6 +191,8 @@ export default {
 | 
	
		
			
				|  |  |                      this.center = [pois.location.lng, pois.location.lat]
 | 
	
		
			
				|  |  |                  } else if (sr.poiList === undefined) {
 | 
	
		
			
				|  |  |                      throw new Error(sr);
 | 
	
		
			
				|  |  | +                } else if(sr.poiList && sr.poiList.pois.length <= 0) {
 | 
	
		
			
				|  |  | +                    this.$toast('请输入详细地址')
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |          },
 | 
	
	
		
			
				|  | @@ -223,7 +234,6 @@ export default {
 | 
	
		
			
				|  |  |      left: 0;
 | 
	
		
			
				|  |  |      z-index: 99;
 | 
	
		
			
				|  |  |      padding: .1rem .23rem;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  |      .van-cell {
 | 
	
		
			
				|  |  |          padding: .12rem;
 | 
	
		
			
				|  |  |          line-height: .24rem;
 | 
	
	
		
			
				|  | @@ -242,7 +252,8 @@ export default {
 | 
	
		
			
				|  |  |          color: @mColor;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      .van-search__action {
 | 
	
		
			
				|  |  | -        background-color: #89C8C4;
 | 
	
		
			
				|  |  | +        // background-color: #89C8C4;
 | 
	
		
			
				|  |  | +        background-color: #14928A;
 | 
	
		
			
				|  |  |          color: #fff;
 | 
	
		
			
				|  |  |          border-radius: 0.15rem;
 | 
	
		
			
				|  |  |          position: absolute;
 |