index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div v-loading="loading">
  3. <div>
  4. <div class="welcome" :style="getEmpBg(myEmpLv['ICON_TYPE'])">
  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-col :xs="24" :sm="24" :md="24" :lg="4" :xl="12">Rank:{{myEmpLv['LEVEL_NAME']!='No Rank'?myEmpLv['LEVEL_NAME']:''}}
  13. <!--<span v-if="myEmpLv['ICON_TYPE']==0">No Rank</span><img
  14. :src="getEmpIco(myEmpLv['ICON_TYPE'])" alt=""
  15. v-for="(o,key) in parseInt(myEmpLv['ICON_NUM'])"
  16. :key="key" v-if="myEmpLv['ICON_TYPE']>0">-->
  17. </el-col><!--聘级-->
  18. <el-col :xs="24" :sm="24" :md="24" :lg="4" :xl="12">Member Level:{{decLvName}}</el-col><!--会员级别-->
  19. <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Current Pay Cycle:{{periodNum}}</el-col><!--当前业绩期-->
  20. <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Remain BV:{{myRemainPv}}</el-col><!--剩余的PV-->
  21. <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Active Deadline Date:{{activeEnd}}</el-col><!--活跃日期截止-->
  22. </el-row>
  23. </el-col>
  24. </el-row>
  25. </div>
  26. <div style="display: none;">
  27. <!-- <el-button type="primary" @click="go('/config/base')">个人设置</el-button>-->
  28. <el-button type="success" @click="go('/user/index')">Personal Information</el-button><!--个人资料-->
  29. <!-- <el-button type="danger" @click="go('/user/rec-user')">开拓会员</el-button>-->
  30. <el-button type="primary" @click="go('/finance/flow-bonus')">Bonus running account</el-button><!--奖金流水-->
  31. <el-button type="warning" @click="go('/finance/withdraw')">Withdraw record</el-button><!--提现明细-->
  32. <el-button type="success" @click="go('/finance/perf')">Previous performance</el-button><!--往期业绩-->
  33. </div>
  34. </div>
  35. <el-carousel trigger="click" :height="bannerHeight+'px'">
  36. <el-carousel-item v-for="(item,key) in slides" :key="key">
  37. <template v-if="item.TYPE==='1'">
  38. <router-link :to="`/shop/index`" target="_self" class="islide">
  39. <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
  40. </router-link>
  41. </template>
  42. <template v-else>
  43. <router-link :to="`/article/detail/${item.CONTENT}`" target="_blank" class="islide">
  44. <img ref="bannerHeight" :src="imageArticle(item.IMAGE)" alt="" @load="imgLoad">
  45. </router-link>
  46. </template>
  47. </el-carousel-item>
  48. </el-carousel>
  49. <el-row :gutter="10" class="news-c">
  50. <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8" v-for="(item,key) in news" :key="key">
  51. <el-card class="box-card">
  52. <div slot="header" class="clearfix">
  53. <span>{{item.CATE_NAME}}</span>
  54. <el-button type="text" class="box-card-more">
  55. <router-link :to="`/article/list/${item.ID}`">more+</router-link>
  56. </el-button>
  57. </div>
  58. <div v-for="(o,k) in item.LISTS" :key="k" class="text item" v-if="item.LISTS.length>0">
  59. <router-link :to="`/article/detail/${o.ID}`" :title="o.TITLE">{{sub_str(o.TITLE)}}</router-link>
  60. <span>{{tool.formatDate(o.CREATED_AT,false)}}</span>
  61. </div>
  62. <div v-if="item.LISTS.length==0">No content</div><!--暂无内容-->
  63. </el-card>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </template>
  68. <script>
  69. import network from '@/utils/network'
  70. import tool from '@/utils/tool'
  71. import baseInfo from '@/utils/baseInfo'
  72. import userInfo from '@/utils/userInfo'
  73. import countUp from 'vue-countup-v2'
  74. export default {
  75. name: 'dashboard_index',
  76. components: {
  77. countUp
  78. },
  79. mounted () {
  80. network.getData(`dashboard/index`).then(response => {
  81. this.myEmpLv.ID = this.baseEmpLevels[response.empLv]['ID']
  82. this.myEmpLv.LEVEL_NAME = this.baseEmpLevels[response.empLv]['LEVEL_NAME']
  83. this.myEmpLv.ICON_TYPE = this.baseEmpLevels[response.empLv]['ICON_TYPE']
  84. this.myEmpLv.ICON_NUM = this.baseEmpLevels[response.empLv]['ICON_NUM']
  85. this.slides = response.slides
  86. this.news = response.news
  87. this.periodNum = response.periodNum
  88. this.decLvName = response.decLvName
  89. this.myRemainPv = response.myRemainPv
  90. this.activeEnd = response.activeEnd
  91. this.loading = false
  92. this.imgLoad()
  93. return network.getData(`dashboard/bonus-num`)
  94. })
  95. if (this.verified === '0') {
  96. // '您未实名认证,请登录商城系统完善会员资料并上传身份证', '请注意'
  97. this.$confirm('You do not have real name authentication, please log in the member system to complete the member information and upload ID card.', 'Please pay attention', {
  98. confirmButtonText: 'Confirm', // 确定
  99. type: 'warning'
  100. }).then(() => {
  101. }).catch(() => {
  102. })
  103. }
  104. this.calcTime()
  105. window.addEventListener('resize', () => {
  106. this.imgLoad()
  107. }, false)
  108. },
  109. data () {
  110. return {
  111. loading: true,
  112. tool: tool,
  113. nowTime: tool.getTimestamp(),
  114. userName: userInfo.userName(),
  115. verified: userInfo.baseData().VERIFIED,
  116. baseEmpLevels: baseInfo.empLevels(),
  117. myEmpLv: {'ID': 0, 'LEVEL_NAME': null, 'ICON_TYPE': 0, 'ICON_NUM': 0},
  118. slides: [],
  119. news: [],
  120. periodNum: '',
  121. decLvName: '',
  122. myRemainPv: '',
  123. activeEnd: '',
  124. bannerHeight: ''
  125. }
  126. },
  127. computed: {
  128. nowDateTime: function () {
  129. return tool.formatDate(this.nowTime)
  130. }
  131. },
  132. methods: {
  133. getEmpIco (type) {
  134. if (type) return require('@/assets/emp-ico-' + type + '.png')
  135. },
  136. getEmpBg (type) {
  137. if (type !== 0) return 'backgroundImage:url(' + require('@/assets/emp-bg-' + type + '.png') + ')'
  138. },
  139. sub_str (str, len = 15) {
  140. if (str) return str.slice(0, len)
  141. },
  142. calcTime () {
  143. let obj = this
  144. setInterval(function () {
  145. obj.nowTime += 1
  146. }, 1000)
  147. },
  148. go: function (url) {
  149. this.$router.push(url)
  150. },
  151. imgLoad () {
  152. let _this = this
  153. if (_this.$refs.bannerHeight) {
  154. _this.$nextTick(function () {
  155. _this.bannerHeight = _this.$refs.bannerHeight[0].height
  156. })
  157. }
  158. },
  159. imageArticle (imageUrl) {
  160. return tool.getArImage(imageUrl, '/files/')
  161. }
  162. }
  163. }
  164. </script>
  165. <style scoped>
  166. h1 {
  167. margin-top: 0
  168. }
  169. .welcome {
  170. padding-bottom: 10px;
  171. background-repeat: no-repeat;
  172. background-position: right top;
  173. }
  174. .wel-info {
  175. line-height: 36px;
  176. }
  177. .wel-info img {
  178. vertical-align: middle;
  179. }
  180. .news-c .el-col .box-card {
  181. margin-top: 10px;
  182. }
  183. .news-c .el-col:nth-child(3n+1) .box-card {
  184. border-bottom: 4px solid #f34d14;
  185. }
  186. .news-c .el-col:nth-child(3n+2) .box-card {
  187. border-bottom: 4px solid #27a2d3;
  188. }
  189. .news-c .el-col:nth-child(3n+3) .box-card {
  190. border-bottom: 4px solid #1bbc61;
  191. }
  192. .box-card-more {
  193. float: right;
  194. padding: 3px 10px;
  195. border: 1px solid #ddd;
  196. border-radius: 10px;
  197. }
  198. .box-card-more a {
  199. color: #666;
  200. }
  201. .box-card-more:hover {
  202. border-color: #409EFF;
  203. }
  204. .box-card .item {
  205. position: relative;
  206. line-height: 30px;
  207. padding-left: 10px;
  208. }
  209. .box-card .item:before {
  210. content: '';
  211. display: block;
  212. width: 4px;
  213. height: 4px;
  214. background: #f60;
  215. position: absolute;
  216. left: 0px;
  217. top: 14px;
  218. }
  219. .box-card .item:after {
  220. content: '';
  221. display: table;
  222. clear: both;
  223. }
  224. .box-card .item a {
  225. color: #333;
  226. float: left;
  227. }
  228. .box-card .item a:hover {
  229. color: #f60;
  230. }
  231. .box-card .item span {
  232. float: right;
  233. color: #999;
  234. font-size: 12px;
  235. }
  236. .islide {
  237. display: block;
  238. text-align: center;
  239. }
  240. .islide img {
  241. max-width: 100%;
  242. max-height: 330px;
  243. }
  244. </style>