home-page.vue 12.1 KB
Newer Older
786817560's avatar
786817560 committed
1
<!--
786817560's avatar
786817560 committed
2
   * @Descrip: 主页
786817560's avatar
786817560 committed
3 4
 * @Author: your name
 * @Date: 2019-10-10 14:25:15
786817560's avatar
786817560 committed
5
 * @LastEditTime: 2019-10-16 12:42:19
786817560's avatar
786817560 committed
6 7 8 9
 * @LastEditors: Please set LastEditors
   -->
<template>
  <h-view id="homePage" class="public-style" title="徐工租赁">
786817560's avatar
786817560 committed
10
    <h-header :proportion="[7,9,0]" class="bar-custom">
786817560's avatar
786817560 committed
11 12
      <div slot="left" class="h-header-btn">
        <!-- <i class="ion-ios-arrow-back" /> -->
786817560's avatar
786817560 committed
13
        <img class="locations" src="@/assets/homePage/location.png" alt="" @click="location">
786817560's avatar
786817560 committed
14
        <span class="home-city">{{ city }}</span>
786817560's avatar
786817560 committed
15
      </div>
786817560's avatar
786817560 committed
16
      <div slot="center" @click="getLocation">徐工租赁</div>
786817560's avatar
786817560 committed
17 18 19 20 21 22 23 24 25 26
    </h-header>
    <h-content>
      <swipe :interval="5000" class="hls-swipe">
        <swipe-item class="hls-swipe">
          <img src="@/assets/homePage/banner1.png" alt="">
        </swipe-item>
        <swipe-item class="hls-swipe">
          <img src="@/assets/homePage/banner2.png" alt="">
        </swipe-item>
      </swipe>
786817560's avatar
786817560 committed
27
      <div class="functions">
786817560's avatar
786817560 committed
28
        <function-item
786817560's avatar
786817560 committed
29 30
          v-for="item in moduleSeparateList.slice(0,4)" :key="item.moduleId" :functionIcon="item.moduleIcon"
          :functionName="item.moduleName"
786817560's avatar
786817560 committed
31
          :data="item" @clickFunction="goModuleFunction"/>
786817560's avatar
786817560 committed
32 33
      </div>

李晓兵's avatar
李晓兵 committed
34
      <!--  <div class="middle-box">
786817560's avatar
786817560 committed
35 36 37 38 39 40 41
        <header>常用应用</header>
        <div class="function">
          <function-item
            v-for="(item,index) in functionList" :key="index" :functionIcon="item.functionIcon"
            :functionName="item.functionName"
            :data="item" class="function-item vue-1px" @clickFunction="goFunctionHome"/>
        </div>
李晓兵's avatar
李晓兵 committed
42
      </div>-->
786817560's avatar
786817560 committed
43 44 45 46 47 48 49 50 51
      <div class="center-pic">
        <div class="left-pic">
          <img src="@/assets/homePage/1 copy@2x.png" alt="">
        </div>
        <div class="right-pic">
          <img src="@/assets/homePage/2 copy@2x.png" alt="">
          <img src="@/assets/homePage/3 copy@2x.png" alt="">
        </div>
      </div>
786817560's avatar
786817560 committed
52
      <div class="guessing">猜你喜欢</div>
786817560's avatar
786817560 committed
53 54 55 56 57 58 59
      <list-item :item-height="110">
        <item>
          <div slot="name" class="item-pic">
            <img src="@/assets/homePage/WechatIMG2 Copy@2x.png" alt="">
          </div>
          <div slot="content" class="item-content">
            <div class="top">***起重机 <span class="hot">热门</span></div>
786817560's avatar
786817560 committed
60 61 62
            <div class="center"> <span class="firsts">经销商</span> <span class="seconds">xxx代理商</span></div>
            <div class="center"> <span class="firsts">参数项</span> <span class="seconds">GTZ226</span></div>
            <div class="center"> <span class="firsts">地址</span> <span class="seconds">江苏省徐州市云龙区</span></div>
786817560's avatar
786817560 committed
63 64 65 66 67 68 69 70
          </div>
        </item>
        <item>
          <div slot="name" class="item-pic">
            <img src="@/assets/homePage/WechatIMG3 Copy@2x.png" alt="">
          </div>
          <div slot="content" class="item-content">
            <div class="top">***起重机 <span class="hot">热门</span></div>
786817560's avatar
786817560 committed
71 72 73
            <div class="center"> <span class="firsts">经销商</span> <span class="seconds">xxx代理商</span></div>
            <div class="center"> <span class="firsts">参数项</span> <span class="seconds">GTZ226</span></div>
            <div class="center"> <span class="firsts">地址</span> <span class="seconds">江苏省徐州市云龙区</span></div>
786817560's avatar
786817560 committed
74 75 76
          </div>
        </item>
      </list-item>
786817560's avatar
786817560 committed
77
      <div class="bank" style="height: 60px;width: 100%"/>
786817560's avatar
786817560 committed
78 79 80 81
    </h-content>
  </h-view>
</template>
<script>
786817560's avatar
786817560 committed
82
import functionState from './functionState'
786817560's avatar
786817560 committed
83 84 85 86
export default {
  name: 'HomePage',
  data () {
    return {
786817560's avatar
786817560 committed
87
      city: '',
786817560's avatar
786817560 committed
88
      province: '',
786817560's avatar
786817560 committed
89 90 91 92
      user_bp_status: '',
      user_bp_class: '',
      bp_id: '',
      moduleSeparateList: [],
786817560's avatar
786817560 committed
93 94
      functionList: [
        {
786817560's avatar
786817560 committed
95 96
          functionIcon: require('@/assets/userBind/np.png'),
          functionName: '用户绑定',
786817560's avatar
786817560 committed
97 98 99
          functionState: 'UserBind',
        },
        {
786817560's avatar
786817560 committed
100 101
          functionIcon: require('@/assets/intoApproval/introduce.png'),
          functionName: '进件审批',
786817560's avatar
786817560 committed
102 103 104
          functionState: 'IntoList',
        },
        {
786817560's avatar
786817560 committed
105 106
          functionIcon: require('@/assets/intoApproval/introduce.png'),
          functionName: '经销商签约',
786817560's avatar
786817560 committed
107 108
          functionState: 'ContractList',
        },
786817560's avatar
786817560 committed
109 110 111 112 113
        {
          functionIcon: require('@/assets/intoApproval/introduce.png'),
          functionName: '合同签约',
          functionState: 'ContractSigning',
        },
786817560's avatar
786817560 committed
114 115 116 117 118
      ],
    }
  },
  computed: {},
  watch: {},
786817560's avatar
786817560 committed
119 120 121
  created () {
    this.getLocation()
  },
786817560's avatar
786817560 committed
122 123 124 125 126 127 128 129
  beforeRouteEnter (to, from, next) {
    next(vm => {
      // if (from.name === 'Login') {
      vm.moduleSeparateList = [...functionState.moduleSeparateList]
      vm.userQuery()
    //  }
    })
  },
786817560's avatar
786817560 committed
130 131
  methods:
 {
786817560's avatar
786817560 committed
132 133
   // 定位
   getLocation () {
786817560's avatar
786817560 committed
134 135 136 137 138
     let vm = this
     var geolocation = new BMap.Geolocation()
     geolocation.getCurrentPosition(function (res) {
       //  debugger
       if (this.getStatus() === 0) {
786817560's avatar
786817560 committed
139 140 141 142 143 144 145 146 147 148 149
         console.log('定位。。。。', res.address)
         // 判断是否是手动选择过定位
         if (window.localStorage.getItem('province')) {
           console.log('ssss', window.localStorage.getItem('province'))
           vm.city = window.localStorage.getItem('city')
           vm.province = window.localStorage.getItem('province')
         } else {
           // 没有就定位当前位置
           vm.city = res.address.city
           vm.province = res.address.province
         }
786817560's avatar
786817560 committed
150 151
       }
     }, {enableHighAccuracy: true})
786817560's avatar
786817560 committed
152
   },
786817560's avatar
786817560 committed
153
   goFunctionHome (data) {
李晓兵's avatar
李晓兵 committed
154 155 156
     this.$router.push({
       name: data.functionState,
     })
李晓兵's avatar
李晓兵 committed
157
     /* if (data.functionState === 'NaturePersonReadOnly') {
786817560's avatar
786817560 committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
       if (this.user_bp_status !== 'APPROVING' && this.user_bp_class === 'NP') {
         this.$router.push({
           name: 'NaturePersonReadOnly',
           params: {
             'bp_id': this.bp_id,
           },
         })
       } else if (this.user_bp_status !== 'APPROVING' && this.user_bp_class === 'ORG') {
         this.$router.push({
           name: 'EnterpriseReadOnly',
           params: {
             'bp_id': this.bp_id,
           },
         })
       } else {
         this.hlsPopup.showLongCenter('您的绑定申请还在流程中')
       }
     } else {
       this.$router.push({
         name: data.functionState,
       })
李晓兵's avatar
李晓兵 committed
179
     } */
786817560's avatar
786817560 committed
180
   },
786817560's avatar
786817560 committed
181
   goModuleFunction (data) {
李晓兵's avatar
李晓兵 committed
182 183 184
     this.$router.push({
       name: data.moduleState,
     })
786817560's avatar
786817560 committed
185
   },
786817560's avatar
786817560 committed
186 187
   location () {
     this.$router.push({
786817560's avatar
786817560 committed
188
       name: 'Location',
786817560's avatar
786817560 committed
189 190 191 192
       params: {
         province: this.province,
         city: this.city,
       },
786817560's avatar
786817560 committed
193
     })
786817560's avatar
786817560 committed
194
   },
786817560's avatar
786817560 committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
   // 用户信息查询
   userQuery () {
     let vm = this
     let url = $config.basePath + 'user_query'
     let param = {
       'phone': window.localStorage.getItem('user_phone'),
     }
     vm.$post(url, param).then(function (res) {
       if (res.result === 'S') {
         vm.user_bp_status = res.info.user_bp_status
         vm.user_bp_class = res.info.user_bp_class
         vm.bp_id = res.info.user_bp_id
       }
     })
   },
786817560's avatar
786817560 committed
210 211 212 213
 },
}
</script>
<style lang='less' scoped>
786817560's avatar
786817560 committed
214
@import "../../styles/vue-1px";
786817560's avatar
786817560 committed
215
#homePage {
786817560's avatar
786817560 committed
216 217 218 219 220 221
  .home-city {
    white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
  }
  .h-header .h-header-left .h-header-btn:first-of-type {
786817560's avatar
786817560 committed
222
    padding-left: 0.2rem;
786817560's avatar
786817560 committed
223
}
786817560's avatar
786817560 committed
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
.functions {
        height: 82px;
        width: 100%;
        background: #fff;
         padding-top: 10px;
        display: flex;
        justify-content: space-between;

        &:before {
          content: ''
        }

        &:after {
          content: ''
        }

        .function-item {
          text-align: center;
        }

      }
.middle-box {
      margin-top: 8px;
      background: white;

      header {
        height: 33px;
        display: flex;
        align-items: center;
        line-height: 100%;
        color: #5D98F6;
        position: relative;

        &:before {
          content: '';
          width: 4px;
          height: 15px;
          margin-right: 9px;
          margin-left: 10px;
          background-image: linear-gradient(-180deg, #5D98F6 0%, #76BCEE 100%);
          border-radius: 2px;
        }

        &:after {
          .setBottomLine()
        }

        span {
          font-size: 12px;
          color: #878A8D;
          position: absolute;
          right: 15px;
        }
      }
      .function{
        display: flex;
        flex-wrap: wrap;

        .function-item {
          width: 25%;
          height: 89px;
          font-size: 12px;
          // border: 1px solid rgba(169,169,169,0.1); /*no*/
          /deep/ img {
            height: 30px;
            width: 30px;
            margin: 23px 28px 9px 33px;
          }

          &:before {
            .setBottomLine();
          }

          &:after {
            .setRightLine();
          }
        }
      }
    }
786817560's avatar
786817560 committed
303 304
.h-header .h-header-center div{
  text-align: left!important;
786817560's avatar
786817560 committed
305 306 307 308 309
}
    .locations {
        height: 24px;
        width: 24px;
    }
786817560's avatar
786817560 committed
310
    .hls-swipe {
786817560's avatar
786817560 committed
311
        // height: 208px;
786817560's avatar
786817560 committed
312 313 314 315
        width: 100vw;
        // overflow: hidden;
        img {
            width: 100vw;
786817560's avatar
786817560 committed
316
            // height: 100%;
786817560's avatar
786817560 committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
        }
      }
    .function{
        display: flex;
        flex-wrap: wrap;

        .function-item {
          width: 25%;
          height: 89px;
          font-size: 12px;
          // border: 1px solid rgba(169,169,169,0.1); /*no*/
          /deep/ img {
            height: 30px;
            width: 30px;
            margin: 23px 28px 9px 33px;
          }

        //   &:before {
        //     .setBottomLine();
        //   }

        //   &:after {
        //     .setRightLine();
        //   }
        }
      }
      .center-pic {
李晓兵's avatar
李晓兵 committed
344
        margin-top: 6px;
786817560's avatar
786817560 committed
345
        //   position: relative;
786817560's avatar
786817560 committed
346
          width: 100%;
786817560's avatar
786817560 committed
347 348
        //   height: 228px;
        //   overflow: hidden;
786817560's avatar
786817560 committed
349 350 351 352 353 354
          display: flex;
          flex-direction: row;
          .left-pic {
              width: 41.6%;
              margin-left: 4px;
              img {
786817560's avatar
786817560 committed
355 356
                   max-width: 100%;
                   height: auto;
786817560's avatar
786817560 committed
357 358 359 360 361 362 363 364
              }
          }
          .right-pic {
              width: 55.2%;
              display: flex;
              flex-direction: column;
              margin-left: 4px;
              img {
786817560's avatar
786817560 committed
365 366
                  max-width: 100%;
                   height: auto;
786817560's avatar
786817560 committed
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
              }
              img:nth-of-type(2) {
                  margin-top: 4px;
              }
          }
      }
      .guessing {
        //   width: 67px;
          height: 22px;
          font-family: PingFangSC-Semibold;
          font-size: 16px;
          color: #00469C;
          font-weight: 600;
          letter-spacing: 0.57px;
          padding: 8px 0 8px 12px;
          background: #fff;
          box-sizing:content-box
      }
      .item-pic {
          width: 110px;
          height: 110px;
          img {
              width: 100%;
              height: 100%;
          }
      }
      .item-content {
786817560's avatar
786817560 committed
394
          // width: 90%;
786817560's avatar
786817560 committed
395 396 397 398 399 400 401 402 403 404
          height: 110px;
        //   border: 1px solid #ccc;
          .top {
            font-family: PingFangSC-Semibold;
            font-size: 16px;
            color: #00469C;
            letter-spacing: 0.57px;
            font-weight: 600;
            margin-top: 10px;
            .hot {
786817560's avatar
786817560 committed
405 406 407 408
                display: inline-block;
                height: 14px;
                line-height: 14px;
                // width: 32px;
786817560's avatar
786817560 committed
409 410 411 412 413 414
                border: 1px solid #FF8214;
                border-radius: 2px;
                font-family: PingFangSC-Semibold;
                font-size: 11px;
                color: #FF8214;
                letter-spacing: 0.46px;
786817560's avatar
786817560 committed
415
                margin-left: 6px;
786817560's avatar
786817560 committed
416 417 418 419 420 421 422 423
            }
          }
          .center {
              margin-top: 6px;
              font-family: PingFangSC-Semibold;
              font-size: 13px;
              color: rgba(56,63,69,0.60);
              letter-spacing: 0.5px;
786817560's avatar
786817560 committed
424 425 426 427
              .firsts {
                  display: inline-block;
                  width: 44px;
              }
786817560's avatar
786817560 committed
428 429 430 431 432 433 434 435 436 437 438 439
              .seconds {
                  margin-left: 16px;
                  font-weight: 600;
                  font-family: PingFangSC-Semibold;
                  font-size: 13px;
                  color: #383F45;
                  letter-spacing: 0.5px;
              }
          }
      }
}
</style>