home-page.vue 12 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-11-14 09:56:22
786817560's avatar
786817560 committed
6 7 8
 * @LastEditors: Please set LastEditors
   -->
<template>
9
  <h-view id="homePage" class="public-style" title="演示demo">
wjc's avatar
wjc committed
10
    <h-header :proportion="[3,6,1]" :hasBorder="false">
786817560's avatar
786817560 committed
11
      <div slot="left" class="h-header-btn">
wjc's avatar
wjc committed
12 13 14 15 16
        <h2>煤科广场</h2>
      </div>
      <div slot="center" class="search">
        <i class="icon ion-ios-search-strong"/>
        <input placeholder="请输入搜索关键词">
786817560's avatar
786817560 committed
17 18
      </div>
    </h-header>
李晓兵's avatar
李晓兵 committed
19
    <h-content class="has-footer">
wjc's avatar
wjc committed
20
      <!--      <div class="top-wrap"/>
李晓兵's avatar
李晓兵 committed
21
      <div class="top-wrap-white"/>
786817560's avatar
786817560 committed
22 23
      <swipe :interval="5000" class="hls-swipe">
        <swipe-item class="hls-swipe">
jiacheng.mao's avatar
jiacheng.mao committed
24
          <img src="@/assets/homePage/banner6.jpg" alt="">
786817560's avatar
786817560 committed
25 26
        </swipe-item>
        <swipe-item class="hls-swipe">
jiacheng.mao's avatar
jiacheng.mao committed
27
          <img src="@/assets/homePage/banner7.jpg" alt="">
jiacheng.mao's avatar
jiacheng.mao committed
28 29
        </swipe-item>
        <swipe-item class="hls-swipe">
jiacheng.mao's avatar
jiacheng.mao committed
30
          <img src="@/assets/homePage/banner8.jpg" alt="">
786817560's avatar
786817560 committed
31
        </swipe-item>
wjc's avatar
wjc committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
      </swipe>-->
      <div class="card">
        <div class="card-body">
          <h4>Hi,今日为你推荐</h4>
          <div class="time">
            <h2>
              {{ new Date().getDate() }}
            </h2>
            <div class="line"/>
            <div class="date">
              <span>{{ getMonth }}</span>
              <span>{{ new Date().getFullYear() }}</span>
            </div>
          </div>
          <h2>
            学习贯彻习近平新时代中国特色社会主义思想教育主题
          </h2>
        </div>
786817560's avatar
786817560 committed
50

wjc's avatar
wjc committed
51 52 53 54 55 56 57 58 59
      </div>
      <div class="news">
        <div class="news-top">
          <div class="news-top-title">
            集团新闻
          </div>
          <div class="news-top-more" @click="gotoNews()">
            更多 》
          </div>
786817560's avatar
786817560 committed
60
        </div>
wjc's avatar
wjc committed
61 62 63 64 65
        <div class="news-items vue-1px-b">
          <div v-for="(item,index) in newsList" v-if="index<5" :key="item.index" class="news-item">
            <div class="news-item-num">{{ '0'+Number(index+1) }}</div>
            <div class="news-item-title">{{ item.new_title }}</div>
          </div>
786817560's avatar
786817560 committed
66 67
        </div>
      </div>
wjc's avatar
wjc committed
68 69 70 71 72 73 74

      <div class="news-cards">
        <div class="news-card" v-for="item in newCard" key="item.index">
          <div class="news-card-left">
            <div class="news-card-left-title">
              <div class="news-card-left-title-tip">{{item.tip}}</div>
              <div class="news-card-left-title-title">{{item.title}}</div>
李晓兵's avatar
李晓兵 committed
75
            </div>
wjc's avatar
wjc committed
76 77 78 79
            <div class="news-card-left-content">
              <div class="company">{{item.company}}</div>
              <div class="line"></div>
              <div class="company">{{item.time}}</div>
李晓兵's avatar
李晓兵 committed
80
            </div>
wjc's avatar
wjc committed
81 82 83 84 85
          </div>
          <div class="news-card-right">
            <img :src="item.imgUrl">
          </div>
        </div>
李晓兵's avatar
李晓兵 committed
86
      </div>
wjc's avatar
wjc committed
87

786817560's avatar
786817560 committed
88 89 90 91
    </h-content>
  </h-view>
</template>
<script>
92

李晓兵's avatar
李晓兵 committed
93 94 95 96 97 98 99
export default {
  name: 'HomePage',
  data () {
    return {
      user_bp_status: '',
      user_bp_class: '',
      bp_id: '',
linxin's avatar
linxin committed
100
      isVisitor: false,
101
      newsList: [],
wjc's avatar
wjc committed
102 103 104 105
      newCard: [
        {tip: '专题', title: '喜迎二十大·煤科建新功', time: '2023-12-23', company: '中国煤炭科工集团', imgUrl: 'https://manager.ccteg.cn/uploads/images/42bdfb3b46502ccf34990387666b9f55.png'},
        {tip: '媒体聚焦', title: '突破世界级难题、创造世界记录', time: '2023-11-02', company: '中国煤炭科工集团', imgUrl: 'https://manager.ccteg.cn/uploads/images/9928278f516b0a82aecd3d7bc72002a4.png'},
        {tip: '煤科硬核', title: '喜迎二十大·煤科建新功', time: '2023-12-12', company: '中国煤炭科工集团', imgUrl: 'https://manager.ccteg.cn/uploads/images/214a37b186e9cdf9a66c9a35fcbef2ab.png'}],
李晓兵's avatar
李晓兵 committed
106 107
    }
  },
wjc's avatar
wjc committed
108 109 110 111 112 113
  computed: {
    getMonth () {
      const month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Spt', 'Oct', 'Nov', 'Dec']
      return month[new Date().getMonth()].toUpperCase()
    },
  },
李晓兵's avatar
李晓兵 committed
114 115
  watch: {},
  created () {
linxin's avatar
linxin committed
116
    // this.getLocation()
李晓兵's avatar
李晓兵 committed
117 118 119 120
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      // if (from.name === 'Login') {
jiacheng.mao's avatar
jiacheng.mao committed
121 122 123
      if (window.localStorage.getItem('user_phone')) {
        vm.userQuery()
      }
linxin's avatar
linxin committed
124
      // vm.guessingQuery() // 猜你喜欢查询
linxin's avatar
linxin committed
125
      vm.isVisitor = !window.localStorage.getItem('password')
linxin's avatar
linxin committed
126
      // vm.guessingQuery() // 猜你喜欢查询
邹骏's avatar
邹骏 committed
127
      vm.getNews()
李晓兵's avatar
李晓兵 committed
128 129 130
      //  }
    })
  },
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
  methods: {
    // 新闻资讯
    getNews () {
      let url = $config.basePath + 'news_entrance_list'
      let param = {}
      this.$post(url, param).then((res) => {
        this.hlsPopup.hideLoading()
        if (res.result === 'S') {
          this.newsList = res.lists
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    goModuleFunction (data) {
      let vm = this
      if (this.isVisitor && data.moduleState !== 'FinancingTrial') {
        hlsPopup.showConfirm({
          title: '提示',
          content: `请先登录!`,
          onConfirm: data => {
            if (data) {
              vm.$router.push('/login')
邹骏's avatar
邹骏 committed
154 155
            } else {
            }
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
          },
        })
      } else {
        this.$router.push({
          name: data.moduleState,
        })
      }
    },
    gotoNews () {
      this.$router.push({
        name: 'NewsList',
      })
    },
    // 用户信息查询
    userQuery () {
胡's avatar
committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
      // let vm = this
      // let url = $config.basePath + 'user_query'
      // let param = {
      //   'bp_id': window.localStorage.getItem('user_phone'),
      // }
      // vm.hlsPopup.showLoading('数据加载中')
      // vm.$post(url, param).then(function (res) {
      //   vm.hlsPopup.hideLoading()
      //   if (res.result === 'S') {
      //     window.localStorage.setItem('bp_type', res.info.user_bp_type)
      //     // window.localStorage.setItem('user_phone', res.info.user_phone)
      //     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
      //   } else {
      //     hlsPopup.showLongCenter(res.message)
      //   }
jiacheng.mao's avatar
jiacheng.mao committed
188
      // })
胡's avatar
committed
189

wjc's avatar
wjc committed
190 191 192
      this.user_bp_status = JSON.parse(window.localStorage.getItem('now_user_bp_bind_id')).bp_status
      this.user_bp_class = JSON.parse(window.localStorage.getItem('now_user_bp_bind_id')).bp_class
      this.bp_id = JSON.parse(window.localStorage.getItem('now_user_bp_bind_id')).bp_id
193
    },
wjc's avatar
wjc committed
194

195 196 197 198 199 200 201 202 203 204
    // 进入产品明细
    goProductDetail (list) {
      let vm = this
      if (!window.localStorage.getItem('password')) {
        hlsPopup.showConfirm({
          title: '提示',
          content: `请先登录!`,
          onConfirm: data => {
            if (data) {
              vm.$router.push('/login')
李晓兵's avatar
李晓兵 committed
205
            } else {
李晓兵's avatar
李晓兵 committed
206
            }
207 208 209 210 211 212 213 214 215 216 217 218 219
          },
        })
      } else {
        this.$router.push({
          name: 'ProDetailed',
          params: {
            product_id: list.product_id,
            bp_id: list.bp_id,
          },
        })
      }
    },
  },
李晓兵's avatar
李晓兵 committed
220
}
786817560's avatar
786817560 committed
221
</script>
李晓兵's avatar
李晓兵 committed
222
<style lang='less'>
李晓兵's avatar
李晓兵 committed
223 224 225
  @import "../../styles/vue-1px";

  #homePage {
226
    .content {
wjc's avatar
wjc committed
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
      background-image: linear-gradient(180deg, #FFFFFF 0%, #F9F9F9 68%);
      padding: 0 6px;

      .card {
        background: url("../../assets/homePage/home-card@2x.png") no-repeat;
        background-size: 100% 100%;
        height: 160px;

        &-body {
          width: 60%;
          float: right;
          padding: 20px 10px;

          h4 {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.80);
            // text-align: center;
            font-weight: 400;
            margin-bottom: 0;
邹骏's avatar
邹骏 committed
246
          }
786817560's avatar
786817560 committed
247

wjc's avatar
wjc committed
248 249 250 251 252 253
          h2 {
            font-size: 14px;
            color: #FFFFFF;
            font-weight: 700;
            margin-bottom: 0;
          }
李晓兵's avatar
李晓兵 committed
254

wjc's avatar
wjc committed
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
          .time {
            color: #FFFFFF;
            // text-align: center;
            display: flex;
            align-items: center;
            height: 30px;
            margin: 10px 0 16px 0;

            h2 {
              font-size: 27px;
              font-weight: 700;
              color: #FFFFFF;
              margin-bottom: 0;
              margin-right: 5px;
            }
270

wjc's avatar
wjc committed
271 272 273 274
            .line {
              border-left: 1px solid #fff;
              height: 25px
            }
275

wjc's avatar
wjc committed
276 277 278 279 280 281 282
            .date {
              margin-left: 5px;
              display: flex;
              flex-direction: column;
              font-size: 12px;
            }
          }
786817560's avatar
786817560 committed
283 284 285
        }
      }
    }
李晓兵's avatar
李晓兵 committed
286

wjc's avatar
wjc committed
287 288 289 290 291 292
    .h-header .h-header-left .h-header-btn h2 {
      font-size: 18px;
      color: #000000;
      text-align: center;
      font-weight: 700;
      margin-bottom: 0;
李晓兵's avatar
李晓兵 committed
293 294
    }

wjc's avatar
wjc committed
295 296
    .h-header .h-header-left .h-header-btn:first-of-type {
      padding-left: 0.2rem;
786817560's avatar
786817560 committed
297
    }
李晓兵's avatar
李晓兵 committed
298

wjc's avatar
wjc committed
299 300 301 302
    .h-header .h-header-center {
      height: 32px;
      background: #F0F1F3;
      border-radius: 16px;
303

wjc's avatar
wjc committed
304 305 306 307 308 309 310 311
      .search {
        width: 100%;
        height: 32px;
        line-height: 32px;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        padding: 0 15px;
312

wjc's avatar
wjc committed
313 314
        .icon {
          font-size: 18px;
李晓兵's avatar
李晓兵 committed
315
        }
316

wjc's avatar
wjc committed
317 318 319 320
        input {
          background-color: transparent;
          margin-left: 10px;
          width: 100%;
李晓兵's avatar
李晓兵 committed
321 322
        }
      }
李晓兵's avatar
李晓兵 committed
323
    }
786817560's avatar
786817560 committed
324

wjc's avatar
wjc committed
325 326
    .news {
      height: auto;
李晓兵's avatar
李晓兵 committed
327
      width: 100%;
wjc's avatar
wjc committed
328 329 330
      margin: 0 auto 10px;
      border-radius: 10px;
      padding: 10px;
李晓兵's avatar
李晓兵 committed
331

wjc's avatar
wjc committed
332 333
      &-top {
        height: 30px;
李晓兵's avatar
李晓兵 committed
334
        display: flex;
wjc's avatar
wjc committed
335 336
        align-items: center;
        justify-content: space-between;
李晓兵's avatar
李晓兵 committed
337

wjc's avatar
wjc committed
338 339 340 341
        &-title {
          font-size: 16px;
          color: #000000;
          font-weight: 600;
李晓兵's avatar
李晓兵 committed
342 343
        }

wjc's avatar
wjc committed
344 345 346 347
        &-more {
          font-size: 12px;
          color: #C9CACC;
          font-weight: 500;
李晓兵's avatar
李晓兵 committed
348
        }
786817560's avatar
786817560 committed
349
      }
李晓兵's avatar
李晓兵 committed
350

wjc's avatar
wjc committed
351 352
      &-items {
        padding-bottom: 10px;
786817560's avatar
786817560 committed
353
      }
354

wjc's avatar
wjc committed
355 356 357 358 359 360
      &-item {
        height: 30px;
        line-height: 30px;
        display: flex;
        margin: 10px 0;
        width: 100%;
361

wjc's avatar
wjc committed
362 363 364 365 366 367
        &-num {
          font-size: 18px;
          font-weight: 700;
          color: #F6B358;
          margin-right: 10px;
        }
368

wjc's avatar
wjc committed
369 370 371 372 373 374 375 376 377
        &-title {
          font-size: 14px;
          color: #000000;
          letter-spacing: 0.4px;
          font-weight: 400;
          width: 100%;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
李晓兵's avatar
李晓兵 committed
378 379
        }
      }
380

李晓兵's avatar
李晓兵 committed
381 382
    }

wjc's avatar
wjc committed
383 384
    .news-cards{
      .news-card{
李晓兵's avatar
李晓兵 committed
385
        display: flex;
wjc's avatar
wjc committed
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
        align-items: center;
        background: #FFFFFF;
        box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.05);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        &-left{
          width: 70%;
          height: 80px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;

          &-title {
            display: flex;
            height: 20px;
            line-height: 20px;
            font-size: 14px;
            color: #000000;
            font-weight: 500;
            &-tip{
              font-size: 12px;
              font-weight: bold;
              color: #F6B358;
              border: 2px solid #F6B358;
              padding: 2px;
              border-radius: 4px;
              line-height: 14px;
              margin-right: 4px;
              max-width: 60px;
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }
            &-title{
              width: 70%;
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }
          }
          &-content{
            display: flex;
            font-size: 12px;
            align-items: center;
            color: #C9CACC;
            font-weight: 500;
            height: 17px;

            .company{
              margin-right: 4px;
            }
            .line{
              height: 15px;
              border-left: 1px solid #C9CACC;
              margin-right: 4px;
            }
          }
李晓兵's avatar
李晓兵 committed
444 445
        }

wjc's avatar
wjc committed
446 447 448 449 450 451 452
        &-right{
          width: 30%;
          img {
            height: 80px;
            width: 100%;
            border-radius: 4px;
          }
李晓兵's avatar
李晓兵 committed
453 454 455 456
        }
      }
    }
  }
786817560's avatar
786817560 committed
457
</style>