123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 |
- <template>
- <div class="pages--home">
- <div class="top-search-group flex-c-c center">
- <h1>剑鱼文库,最实用的招投标资料库</h1>
- <search-input @submit="goSubmit"></search-input>
- </div>
- <div class="new-group">
- <div class="flex-r-c">
- <div class="title-group flex-r-c center left">
- <h5>最新文档</h5>
- <i class="el-icon-jy-Frame"></i>
- </div>
- </div>
- <div class="new-list-group must-bottom flex-r-c">
- <div class="flex flex-c-c">
- <div class="list-item flex-r-c" v-for="item in newList1" :key="item.id" @click="goContent(item)">
- <div class="flex flex-r-c center left">
- <i :class="'el-icon-jy-' + item.type" />
- <div class="flex">
- <div class="van-ellipsis">{{item.title}}</div>
- </div>
- </div>
- <div class="right-info flex-r-c center right">
- <i class="el-icon-jy-iconJianYu" />
- <span>{{item.money}}</span>
- </div>
- </div>
- </div>
- <div class="flex flex-c-c">
- <div class="list-item flex-r-c" v-for="item in newList2" :key="item.id" @click="goContent(item)">
- <div class="flex flex-r-c center left">
- <i :class="'el-icon-jy-' + item.type" />
- <div class="flex">
- <div class="van-ellipsis">{{item.title}}</div>
- </div>
- </div>
- <div class="right-info flex-r-c center right">
- <i class="el-icon-jy-iconJianYu" />
- <span>{{item.money}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="hot-down-group">
- <div class="flex-r-c">
- <div class="title-group flex-r-c center left">
- <h5>热门下载</h5>
- <i class="el-icon-jy-Frame-1"></i>
- </div>
- </div>
- <div class="new-list-group flex-r-c">
- <div class="flex flex-c-c">
- <div class="list-item flex-r-c" v-for="item in hotList1" :key="item.id" @click="goContent(item)">
- <div class="flex flex-r-c center left">
- <i :class="'el-icon-jy-' + item.type" />
- <div class="flex">
- <div class="van-ellipsis">{{item.title}}</div>
- </div>
- </div>
- <div class="right-info flex-r-c center right">
- <i class="el-icon-jy-iconJianYu" />
- <span>{{item.money}}</span>
- </div>
- </div>
- </div>
- <div class="flex flex-c-c">
- <div class="list-item flex-r-c" v-for="item in hotList2" :key="item.id" @click="goContent(item)">
- <div class="flex flex-r-c center left">
- <i :class="'el-icon-jy-' + item.type" />
- <div class="flex">
- <div class="van-ellipsis">{{item.title}}</div>
- </div>
- </div>
- <div class="right-info flex-r-c center right">
- <i class="el-icon-jy-iconJianYu" />
- <span>{{item.money}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="keep-group">
- <div class="flex-r-c">
- <div class="title-group flex-r-c center left">
- <h5>精选推荐</h5>
- </div>
- </div>
- <div class="hot-keep-group flex-r-c wrap">
- <div class="card-item flex-r-c" v-for="item in pageData.keep" :key="item.id" @click="goContent(item)">
- <div class="mini-img-group">
- <img :src="item.img" alt="">
- <i :class="'el-icon-jy-' + item.type" />
- </div>
- <div class="flex-c-c">
- <div class="flex">
- <div class="title-text van-multi-ellipsis--l2">{{item.title}}</div>
- </div>
- <div class="flex-c-c info-text">
- <span v-if="item.contribution">贡献者: {{item.contribution}}</span>
- <div class="info-text-group flex-r-c center left">
- <span v-if="item.down">{{item.down}}次下载</span>
- <span v-if="item.page">共{{item.page}}页</span>
- <span v-if="item.size">{{item.size | sizeFormatter}}</span>
- </div>
- </div>
- <div class="money-group flex-r-c center left">
- <i class="el-icon-jy-iconJianYu s20" />
- <span class="red-text">{{item.money}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { Button } from 'element-ui'
- import SearchInput from '../components/Search'
- import { getHomeActivity, getHomeHot } from '../api/modules/home'
- import { recoveryPageData } from '../utils'
- function checkType (type) {
- let typeStr = type
- switch (type) {
- case 1: {
- typeStr = 'word'
- break
- }
- case 2: {
- typeStr = 'pdf'
- break
- }
- case 3: {
- typeStr = 'excel'
- break
- }
- case 4: {
- typeStr = 'ppt'
- break
- }
- case 'doc': {
- typeStr = 'word'
- break
- }
- case 'xls': {
- typeStr = 'excel'
- break
- }
- }
- return typeStr
- }
- function formatData (v) {
- return {
- img: v?.docImg,
- type: checkType(v?.docFileType),
- id: v.docId,
- title: v?.docName || v?.docTitle,
- money: v.price,
- size: v?.docFileSize,
- page: v?.docPageSize,
- down: v?.downTimes,
- contribution: v?.sourceUserId
- }
- }
- export default {
- name: 'home',
- components: {
- SearchInput,
- [Button.name]: Button
- },
- data () {
- return {
- fullscreenLoading: false,
- pageData: {}
- }
- },
- created () {
- this.pageData = recoveryPageData('jy-docs-home-page-pc')
- this.getHome()
- },
- beforeCreate: function () {
- $('body').addClass('view_index')
- },
- beforeDestroy: function () {
- $('body').removeClass('view_index')
- sessionStorage.setItem('jy-docs-home-page-pc', JSON.stringify(this.pageData))
- },
- computed: {
- newList1 () {
- return this.pageData?.new && this.pageData?.new.slice(0, 5)
- },
- newList2 () {
- return this.pageData?.new && this.pageData?.new.slice(5)
- },
- hotList1 () {
- return this.pageData?.hot && this.pageData?.hot.slice(0, 5)
- },
- hotList2 () {
- return this.pageData?.hot && this.pageData?.hot.slice(5)
- }
- },
- methods: {
- goContent (item) {
- const routeData = this.$router.resolve({
- name: 'content',
- params: {
- id: item.id
- }
- })
- window.open(routeData.href, '_blank')
- },
- async getHome () {
- getHomeHot({ sign: 'new', num: 10 }).then(res => {
- if (!res.data.error_msg.length) {
- this.$set(this.pageData, 'new', res.data.data.map((v) => formatData(v)))
- }
- })
- getHomeHot({ sign: 'hot', num: 10 }).then(res => {
- if (!res.data.error_msg.length) {
- this.$set(this.pageData, 'hot', res.data.data.map((v) => formatData(v)))
- }
- })
- getHomeActivity({ code: 3, size: 6, num: 1 }).then(res => {
- if (!res.data.error_msg.length) {
- this.$set(this.pageData, 'keep', res.data.data.map((v) => formatData(v)))
- }
- })
- },
- goSubmit (search) {
- if (!search.text.replace(/\s+/g, '')) {
- return
- }
- this.$router.push({
- name: 'search',
- query: {
- type: search.type,
- text: search.text
- }
- })
- },
- getLoginStatus: function () {
- alert(loginflag)
- }
- }
- }
- </script>
- <style lang="scss">
- .page--docs--index.view_index {
- .page-container {
- background-image: url("~@/assets/images/wenkuBanner.png");
- background-repeat: no-repeat;
- background-color: #fff;
- }
- }
- </style>
- <style scoped lang="scss">
- .pages--home {
- padding-bottom: 40px;
- box-sizing: border-box;
- @include diy-icon('iconJianYu', 24, 24);
- @include diy-icon('pdf', 24);
- @include diy-icon('word', 24);
- @include diy-icon('excel', 24);
- @include diy-icon('ppt', 24);
- .list-item {
- cursor: pointer;
- padding: 18px 0;
- box-sizing: border-box;
- border-bottom: 1px solid #ececec;
- &:hover {
- color: #2CB7CA;
- }
- &:last-child {
- border-bottom-color: transparent;
- }
- i {
- flex-shrink: 0;
- margin-right: 4px;
- }
- .flex {
- min-width: 0;
- }
- .right-info {
- margin-left: 4px;
- flex-shrink: 0;
- color: #1D1D1D;
- font-family: Microsoft YaHei;
- font-size: 16px;
- letter-spacing: 0px;
- text-align: right;
- }
- }
- .card-item {
- cursor: pointer;
- justify-content: flex-start;
- padding: 8px 16px 12px 0;
- box-sizing: border-box;
- &:hover {
- .title-text {
- color: #2ABED1;
- }
- }
- .money-group {
- margin-top: 8px;
- }
- .mini-img-group {
- flex-shrink: 0;
- position: relative;
- border-radius: 4px;
- border: 1px solid #ececec;
- width: 100px;
- height: 124px;
- margin-right: 12px;
- overflow: hidden;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- img {
- width: 100%;
- }
- i {
- position: absolute;
- right: 0;
- bottom: 0;
- }
- }
- .info-text-group {
- span {
- display: inline-block;
- &:last-child {
- &::after {
- content: unset;
- }
- }
- &::after {
- content: "|";
- padding: 0 8px;
- color: #ececec;
- }
- }
- }
- .info-text {
- font-family: Microsoft YaHei;
- font-style: normal;
- font-weight: normal;
- font-size: 14px;
- line-height: 24px;
- color: #999999;
- }
- .red-text {
- color: #FF3A20;
- font-family: Microsoft YaHei;
- font-style: normal;
- font-weight: normal;
- font-size: 18px;
- line-height: 28px;
- }
- .title-text {
- font-family: Microsoft YaHei;
- font-style: normal;
- font-weight: normal;
- font-size: 16px;
- line-height: 24px;
- color: #1D1D1D;
- }
- }
- .van-ellipsis {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .van-multi-ellipsis--l2 {
- display: -webkit-box;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .hot-keep-group {
- .card-item {
- width: 33.33%;
- overflow: hidden;
- }
- }
- }
- @include diy-icon('search', 24);
- @include diy-icon('Frame', 24);
- @include diy-icon('Frame-1', 24);
- .keep-group {
- margin-top: 38px;
- padding-bottom: 50px;
- }
- .new-group {
- margin-top: 54px;
- .flex-c-c {
- padding-right: 24px;
- box-sizing: border-box;
- & + .flex-c-c {
- padding-right: 0;
- padding-left: 24px;
- }
- }
- }
- .hot-down-group {
- border-radius: 12px;
- background: radial-gradient(circle at 50% 50%, #FAEACD 0%, #FFF8EA 100%);
- background-image: url("~@/assets/images/dateGetBg.png");
- background-repeat: no-repeat;
- background-size: 100% 100%;
- width: 100%;
- height: auto;
- padding: 24px;
- padding-bottom: 34px;
- box-sizing: border-box;
- margin-top: 40px;
- .title-group h5 {
- color: #863700;
- }
- .new-list-group {
- background-color: white;
- border-radius: 8px;
- .flex-c-c {
- padding: 20px;
- box-sizing: border-box;
- }
- }
- }
- .title-group {
- margin-bottom: 16px;
- h5 {
- color: #1D1D1D;
- font-family: Microsoft YaHei;
- font-size: 18px;
- line-height: 28px;
- letter-spacing: 0px;
- text-align: left;
- margin-right: 9px;
- }
- }
- .top-search-group {
- width: 100%;
- height: 323px;
- h1 {
- color: #1D1D1D;
- font-family: Microsoft YaHei;
- font-size: 20px;
- line-height: normal;
- letter-spacing: 0px;
- text-align: left;
- margin-bottom: 40px;
- }
- }
- .new-list-group {
- > .flex {
- max-width: 50%;
- }
- &.must-bottom {
- .list-item:last-child {
- border-bottom-color: #ececec;
- }
- }
- }
- </style>
|