index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <!-- <div class="nowTime">
  6. <i class="fa fa-clock-o"></i>
  7. {{currentTime}}
  8. </div> -->
  9. <el-form :inline="true">
  10. <el-form-item>
  11. <el-date-picker
  12. v-model="date"
  13. :editable="false"
  14. format="yyyy-MM-dd"
  15. value-format="yyyy-MM-dd"
  16. @change="getDesktopList"
  17. :clearable="false"
  18. type="date"
  19. :placeholder="this.$t('optiondate')"
  20. ></el-date-picker>
  21. </el-form-item>
  22. <el-form-item style="float:right;">
  23. <span style="color:#aaa;font-size:12px;">{{ $t('yuanGongAnZhuangKeHuDuanLingDaoJiKeChaKanGongZuoZhuoMianYuanChengJianGuan') }}</span>
  24. <el-link type="primary" :underline="false" href="http://gsgj.ttkuaiban.com/download.html" target="_blank">{{ $t('keHuDuanXiaZai') }}</el-link>
  25. </el-form-item>
  26. </el-form>
  27. </el-col>
  28. <!-- 卡片列表 -->
  29. <div>
  30. <el-col :span="24" v-if="desktopList.length == 0" style="padding: 200px 0;text-align:center;cursor:pointer">
  31. <el-link :underline="false" type="primary" @click="getHavePic">{{ $t('jinRiZanWuJieTuDianJiChaKanJinQi') }}</el-link>
  32. </el-col>
  33. <el-col :span="6" v-for="(item, index) in desktopList" :key="index" class="one_div">
  34. <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
  35. <div class="one_card_img">
  36. <el-image :src="item.pic_url" class="image" lazy>
  37. <div slot="error" class="image-slot">
  38. <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
  39. </div>
  40. </el-image>
  41. <div :id="'over'+index" class="over">
  42. <el-button type="primary" plain @click.native="jumpTo(item.id)">
  43. <i class="fa fa-link"></i> {{ $t('suoYouJieTu') }}
  44. </el-button>
  45. </div>
  46. </div>
  47. <div class="one_card_txt">
  48. <!-- -1-未知 null 0-研发,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 9-聊天 -->
  49. <span>{{converType(item.pic_type == null ? 0 : item.pic_type+1)}}</span>
  50. <div class="bottom clearfix">
  51. <el-link>
  52. <i class="fa fa-circle"></i>
  53. {{item.name}}
  54. </el-link>
  55. <time class="time">{{item.time}}</time>
  56. </div>
  57. </div>
  58. </el-card>
  59. </el-col>
  60. </div>
  61. </section>
  62. </template>
  63. <script>
  64. import util from "../../common/js/util";
  65. export default {
  66. data() {
  67. return {
  68. filters: {
  69. keyName: ""
  70. },
  71. user: JSON.parse(sessionStorage.getItem("user")),
  72. date: util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
  73. timer: "",
  74. currentTime: util.formatDate.format(
  75. new Date(new Date()),
  76. "yyyy-MM-dd hh:mm:ss"
  77. ),
  78. desktopList: []
  79. };
  80. },
  81. methods: {
  82. getTime() {
  83. var _this = this; //声明一个变量指向Vue实例this,保证作用域一致
  84. this.timer = setInterval(function() {
  85. _this.currentTime = util.formatDate.format(
  86. new Date(new Date()),
  87. "yyyy-MM-dd hh:mm:ss"
  88. );
  89. }, 1000);
  90. },
  91. //获取项目列表
  92. getDesktopList() {
  93. this.listLoading = true;
  94. this.http.post(
  95. this.port.desktop.list,
  96. {date: this.date},
  97. res => {
  98. this.listLoading = false;
  99. if (res.code == "ok") {
  100. console.log("项目列表",this.desktopList);
  101. this.desktopList = res.data;
  102. } else {
  103. this.$message({
  104. message: res.msg,
  105. type: "error"
  106. });
  107. }
  108. },
  109. error => {
  110. this.listLoading = false;
  111. this.$message({
  112. message: error,
  113. type: "error"
  114. });
  115. });
  116. },
  117. // 获取最近有数据的日期
  118. getHavePic() {
  119. this.http.post(
  120. this.port.desktop.getScreenshotDate,
  121. {date: new Date()},
  122. res => {
  123. if (res.code == "ok") {
  124. if(res.data != null) {
  125. this.date = res.data;
  126. this.getDesktopList();
  127. }
  128. } else {
  129. this.$message({
  130. message: res.msg,
  131. type: "error"
  132. });
  133. }
  134. },
  135. error => {
  136. this.$message({
  137. message: error,
  138. type: "error"
  139. });
  140. });
  141. },
  142. jumpTo(id) {
  143. this.$router.push("/desktop/" + id + "/" + this.date);
  144. },
  145. //类型枚举转换
  146. converType(type) {
  147. switch (type) {
  148. case 0:
  149. return this.$t('qiTaGongZuo');
  150. case 1:
  151. return this.$t('yanFa');
  152. case 2:
  153. return this.$t('shangWang');
  154. case 3:
  155. return this.$t('wenDang');
  156. case 4:
  157. return this.$t('sheJi');
  158. case 5:
  159. return this.$t('meiGong');
  160. case 6:
  161. return this.$t('yunYing');
  162. case 7:
  163. return this.$t('kanXiaoShuo');
  164. case 8:
  165. return this.$t('yingShiYuLe');
  166. case 9:
  167. return this.$t('tingYinLe');
  168. case 10:
  169. return this.$t('liaoTian');
  170. default:
  171. return this.$t('weiZhi');
  172. }
  173. }
  174. },
  175. created() {
  176. this.getTime();
  177. },
  178. mounted() {
  179. this.getDesktopList();
  180. },
  181. beforeDestroy() {
  182. if (this.timer) {
  183. clearInterval(this.timer);
  184. }
  185. }
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. .nowTime {
  190. height: 35px;
  191. line-height: 28px;
  192. font-size: 18px;
  193. color: #20a0ff;
  194. margin-left: 10px;
  195. i {
  196. margin-right: 10px;
  197. }
  198. }
  199. .one_div {
  200. padding: 15px;
  201. .one_card {
  202. .one_card_img {
  203. position: relative;
  204. .image {
  205. width: 100%;
  206. }
  207. .over {
  208. display: none;
  209. width: 100%;
  210. height: 98%;
  211. background: rgba(0, 0, 0, 0.2);
  212. position: absolute;
  213. top: 0;
  214. text-align: center;
  215. }
  216. }
  217. .one_card_txt {
  218. padding: 13px;
  219. .bottom {
  220. margin-top: 13px;
  221. line-height: 12px;
  222. i {
  223. color: #9ed0ff;
  224. margin-right: 5px;
  225. }
  226. .time {
  227. float: right;
  228. margin-top: 2px;
  229. color: #999;
  230. }
  231. }
  232. }
  233. }
  234. .one_card:hover {
  235. .one_card_img {
  236. .over {
  237. display: block !important;
  238. }
  239. }
  240. }
  241. }
  242. </style>
  243. <style lang="scss">
  244. .image {
  245. .el-image__inner {
  246. height: 11.6vw !important;
  247. }
  248. }
  249. .one_card_img {
  250. .over {
  251. .el-button {
  252. margin-top: 25%;
  253. }
  254. }
  255. }
  256. </style>