ba-index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div v-loading="loading">
  3. <div>
  4. <div class="welcome" :style="getEmpBg()">
  5. <h1>Welcome,{{userName}} <!--欢迎您-->
  6. <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><!--您未实名认证,请登录商城系统完善会员资料并上传身份证-->
  7. </h1>
  8. <el-row :gutter="0" class="wel-info">
  9. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
  10. <el-row :gutter="10">
  11. <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Current System Time:{{nowDateTime}}</el-col> <!--当前系统时间-->
  12. </el-row>
  13. </el-col>
  14. </el-row>
  15. </div>
  16. <div style="display: none;">
  17. <el-button type="success" @click="go('/user/ba-index')">Personal Information</el-button><!--个人资料-->
  18. </div>
  19. </div>
  20. <el-carousel trigger="click" :height="bannerHeight+'px'">
  21. <el-carousel-item v-for="(item,key) in slides" :key="key">
  22. <template v-if="item.TYPE==='1'">
  23. <router-link :to="`/shop/ba-index`" target="_self" class="islide">
  24. <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
  25. </router-link>
  26. </template>
  27. <template v-else>
  28. <router-link :to="`/article/detail/${item.CONTENT}`" target="_blank" class="islide">
  29. <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
  30. </router-link>
  31. </template>
  32. </el-carousel-item>
  33. </el-carousel>
  34. <el-row :gutter="10" class="news-c">
  35. <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8" v-for="(item,key) in news" :key="key">
  36. <el-card class="box-card">
  37. <div slot="header" class="clearfix">
  38. <span>{{item.CATE_NAME}}</span>
  39. <el-button type="text" class="box-card-more">
  40. <router-link :to="`/article/list/${item.ID}`">more+</router-link>
  41. </el-button>
  42. </div>
  43. <div v-for="(o,k) in item.LISTS" :key="k" class="text item" v-if="item.LISTS.length>0">
  44. <router-link :to="`/article/detail/${o.ID}`" :title="o.TITLE">{{sub_str(o.TITLE)}}</router-link>
  45. <span>{{tool.formatDate(o.CREATED_AT,false)}}</span>
  46. </div>
  47. <div v-if="item.LISTS.length==0">No content</div><!--暂无内容-->
  48. </el-card>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. </template>
  53. <script>
  54. import network from '@/utils/network'
  55. import tool from '@/utils/tool'
  56. import baseInfo from '@/utils/baseInfo'
  57. import userInfo from '@/utils/userInfo'
  58. import countUp from 'vue-countup-v2'
  59. export default {
  60. name: 'dashboard_ba_index',
  61. components: {
  62. countUp
  63. },
  64. mounted () {
  65. network.getData(`dashboard/ba-index`).then(response => {
  66. this.slides = response.slides
  67. this.news = response.news
  68. this.periodNum = response.periodNum
  69. this.loading = false
  70. this.imgLoad()
  71. })
  72. this.calcTime()
  73. window.addEventListener('resize', () => {
  74. this.imgLoad()
  75. }, false)
  76. },
  77. data () {
  78. return {
  79. loading: false,
  80. tool: tool,
  81. nowTime: tool.getTimestamp(),
  82. userName: userInfo.userName(),
  83. verified: userInfo.baseData().VERIFIED,
  84. slides: [],
  85. news: [],
  86. periodNum: '',
  87. bannerHeight: ''
  88. }
  89. },
  90. computed: {
  91. nowDateTime: function () {
  92. return tool.formatDate(this.nowTime)
  93. }
  94. },
  95. methods: {
  96. getEmpIco () {
  97. return require('@/assets/emp-ico-1.png')
  98. },
  99. getEmpBg () {
  100. return 'backgroundImage:url(' + require('@/assets/emp-bg-1.png') + ')'
  101. },
  102. sub_str (str, len = 15) {
  103. if (str) return str.slice(0, len)
  104. },
  105. calcTime () {
  106. let obj = this
  107. setInterval(function () {
  108. obj.nowTime += 1
  109. }, 1000)
  110. },
  111. go: function (url) {
  112. this.$router.push(url)
  113. },
  114. imgLoad () {
  115. let _this = this
  116. if (_this.$refs.bannerHeight) {
  117. _this.$nextTick(function () {
  118. _this.bannerHeight = _this.$refs.bannerHeight[0].height
  119. })
  120. }
  121. },
  122. imageArticle (imageUrl) {
  123. return tool.getArImage(imageUrl, '/files/')
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. h1 {
  130. margin-top: 0
  131. }
  132. .welcome {
  133. padding-bottom: 10px;
  134. background-repeat: no-repeat;
  135. background-position: right top;
  136. }
  137. .wel-info {
  138. line-height: 36px;
  139. }
  140. .wel-info img {
  141. vertical-align: middle;
  142. }
  143. .news-c .el-col .box-card {
  144. margin-top: 10px;
  145. }
  146. .news-c .el-col:nth-child(3n+1) .box-card {
  147. border-bottom: 4px solid #f34d14;
  148. }
  149. .news-c .el-col:nth-child(3n+2) .box-card {
  150. border-bottom: 4px solid #27a2d3;
  151. }
  152. .news-c .el-col:nth-child(3n+3) .box-card {
  153. border-bottom: 4px solid #1bbc61;
  154. }
  155. .box-card-more {
  156. float: right;
  157. padding: 3px 10px;
  158. border: 1px solid #ddd;
  159. border-radius: 10px;
  160. }
  161. .box-card-more a {
  162. color: #666;
  163. }
  164. .box-card-more:hover {
  165. border-color: #409EFF;
  166. }
  167. .box-card .item {
  168. position: relative;
  169. line-height: 30px;
  170. padding-left: 10px;
  171. }
  172. .box-card .item:before {
  173. content: '';
  174. display: block;
  175. width: 4px;
  176. height: 4px;
  177. background: #f60;
  178. position: absolute;
  179. left: 0px;
  180. top: 14px;
  181. }
  182. .box-card .item:after {
  183. content: '';
  184. display: table;
  185. clear: both;
  186. }
  187. .box-card .item a {
  188. color: #333;
  189. float: left;
  190. }
  191. .box-card .item a:hover {
  192. color: #f60;
  193. }
  194. .box-card .item span {
  195. float: right;
  196. color: #999;
  197. font-size: 12px;
  198. }
  199. .islide {
  200. display: block;
  201. text-align: center;
  202. }
  203. .islide img {
  204. max-width: 100%;
  205. max-height: 330px;
  206. }
  207. </style>