| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <div v-loading="loading">
- <div>
- <div class="welcome" :style="getEmpBg()">
- <h1>Welcome,{{userName}} <!--欢迎您-->
- <b v-if="verified==='0'" class="text-danger">You do not have real name authentication, please log in the member system to complete the member information and upload ID card.</b><!--您未实名认证,请登录商城系统完善会员资料并上传身份证-->
- </h1>
- <el-row :gutter="0" class="wel-info">
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
- <el-row :gutter="10">
- <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Current System Time:{{nowDateTime}}</el-col> <!--当前系统时间-->
- </el-row>
- </el-col>
- </el-row>
- </div>
- <div style="display: none;">
- <el-button type="success" @click="go('/user/ba-index')">Personal Information</el-button><!--个人资料-->
- </div>
- </div>
- <el-carousel trigger="click" :height="bannerHeight+'px'">
- <el-carousel-item v-for="(item,key) in slides" :key="key">
- <template v-if="item.TYPE==='1'">
- <router-link :to="`/shop/ba-index`" target="_self" class="islide">
- <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
- </router-link>
- </template>
- <template v-else>
- <router-link :to="`/article/detail/${item.CONTENT}`" target="_blank" class="islide">
- <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
- </router-link>
- </template>
- </el-carousel-item>
- </el-carousel>
- <el-row :gutter="10" class="news-c">
- <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8" v-for="(item,key) in news" :key="key">
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>{{item.CATE_NAME}}</span>
- <el-button type="text" class="box-card-more">
- <router-link :to="`/article/list/${item.ID}`">more+</router-link>
- </el-button>
- </div>
- <div v-for="(o,k) in item.LISTS" :key="k" class="text item" v-if="item.LISTS.length>0">
- <router-link :to="`/article/detail/${o.ID}`" :title="o.TITLE">{{sub_str(o.TITLE)}}</router-link>
- <span>{{tool.formatDate(o.CREATED_AT,false)}}</span>
- </div>
- <div v-if="item.LISTS.length==0">No content</div><!--暂无内容-->
- </el-card>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import network from '@/utils/network'
- import tool from '@/utils/tool'
- import baseInfo from '@/utils/baseInfo'
- import userInfo from '@/utils/userInfo'
- import countUp from 'vue-countup-v2'
- export default {
- name: 'dashboard_ba_index',
- components: {
- countUp
- },
- mounted () {
- network.getData(`dashboard/ba-index`).then(response => {
- this.slides = response.slides
- this.news = response.news
- this.periodNum = response.periodNum
- this.loading = false
- this.imgLoad()
- })
- this.calcTime()
- window.addEventListener('resize', () => {
- this.imgLoad()
- }, false)
- },
- data () {
- return {
- loading: false,
- tool: tool,
- nowTime: tool.getTimestamp(),
- userName: userInfo.userName(),
- verified: userInfo.baseData().VERIFIED,
- slides: [],
- news: [],
- periodNum: '',
- bannerHeight: ''
- }
- },
- computed: {
- nowDateTime: function () {
- return tool.formatDate(this.nowTime)
- }
- },
- methods: {
- getEmpIco () {
- return require('@/assets/emp-ico-1.png')
- },
- getEmpBg () {
- return 'backgroundImage:url(' + require('@/assets/emp-bg-1.png') + ')'
- },
- sub_str (str, len = 15) {
- if (str) return str.slice(0, len)
- },
- calcTime () {
- let obj = this
- setInterval(function () {
- obj.nowTime += 1
- }, 1000)
- },
- go: function (url) {
- this.$router.push(url)
- },
- imgLoad () {
- let _this = this
- if (_this.$refs.bannerHeight) {
- _this.$nextTick(function () {
- _this.bannerHeight = _this.$refs.bannerHeight[0].height
- })
- }
- },
- imageArticle (imageUrl) {
- return tool.getArImage(imageUrl, '/files/')
- }
- }
- }
- </script>
- <style scoped>
- h1 {
- margin-top: 0
- }
- .welcome {
- padding-bottom: 10px;
- background-repeat: no-repeat;
- background-position: right top;
- }
- .wel-info {
- line-height: 36px;
- }
- .wel-info img {
- vertical-align: middle;
- }
- .news-c .el-col .box-card {
- margin-top: 10px;
- }
- .news-c .el-col:nth-child(3n+1) .box-card {
- border-bottom: 4px solid #f34d14;
- }
- .news-c .el-col:nth-child(3n+2) .box-card {
- border-bottom: 4px solid #27a2d3;
- }
- .news-c .el-col:nth-child(3n+3) .box-card {
- border-bottom: 4px solid #1bbc61;
- }
- .box-card-more {
- float: right;
- padding: 3px 10px;
- border: 1px solid #ddd;
- border-radius: 10px;
- }
- .box-card-more a {
- color: #666;
- }
- .box-card-more:hover {
- border-color: #409EFF;
- }
- .box-card .item {
- position: relative;
- line-height: 30px;
- padding-left: 10px;
- }
- .box-card .item:before {
- content: '';
- display: block;
- width: 4px;
- height: 4px;
- background: #f60;
- position: absolute;
- left: 0px;
- top: 14px;
- }
- .box-card .item:after {
- content: '';
- display: table;
- clear: both;
- }
- .box-card .item a {
- color: #333;
- float: left;
- }
- .box-card .item a:hover {
- color: #f60;
- }
- .box-card .item span {
- float: right;
- color: #999;
- font-size: 12px;
- }
- .islide {
- display: block;
- text-align: center;
- }
- .islide img {
- max-width: 100%;
- max-height: 330px;
- }
- </style>
|