| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="content">
- <div class="downloads">
- <div class="download-types noScroll">
- <div class="searchType">
- <input type="text" placeholder="在此处搜索文件" v-model="searchKey" @input="filterTypeChangeHandle" >
- <span class="close" @click="clearSearchText" >
- x
- </span>
- </div>
- <div class="d-type"
- v-for="item in filterTypes"
- :key="item.key"
- @click="switchType(item.key)"
- >
- {{item.title}}
- </div>
- </div>
- <div class="download-type-items">
- <div class="title">
- <span class="text-m text-b">[</span>
- <span class="mark-gold">{{nowTitle}}</span>
- <span class="text-b">]</span>
- 资料下载
- </div>
- <div class="d-type-item"
- v-for="(item,i) in subItems"
- :key="nowKey+'_'+i"
- >
- <a :href="item.src" target="_blank">
- <span class="file">
- <svg-icon class="icon" :icon-class="item.icon?item.icon:'unknownFile'"></svg-icon>
- {{item.title}}
- </span>
- <span class="time">
- {{timestampToTime(item.add_time)}}
- </span>
- </a>
- </div>
- </div>
- </div>
- <div class="downloads-more">
- <div class="more-text">
- 没有找到您需要的资料?
- 请联系我们,我们将竭诚为您服务。
- </div>
- </div>
- </div>
- </template>
- <script>
- import langMap from "@/map/langMap";
- import {timestampToTime} from "@/until/time";
- export default {
- name: "downloads",
- props: {
- lang:{
- default: langMap.lang.cn
- },
- downloads:{
- default: []
- }
- },
- data(){
- return {
- langType: langMap.lang,
- searchKey: '',
- filterTypes: [],
- subItems: [],
- nowTitle: '',
- nowKey: '',
- waitTimer: null,
- }
- },
- created(){
- this.filterTypes = this.downloads;
- this.switchType(this.downloads[0].key);
- },
- watch:{
- downloads(){
- this.filterTypeChangeHandle();
- }
- },
- methods:{
- timestampToTime(){
- return timestampToTime(...arguments);
- },
- switchType(key){
- if (this.nowKey !== key){
- this.nowKey = key;
- let items = this.downloads.find(item=>item.key === key);
- this.subItems = items?items.subItems:[];
- this.nowTitle = `${items?items.title:''}`;
- }
- },
- filterTypeChangeHandle(){
- // 等待700毫秒,防抖
- if (this.waitTimer){
- clearTimeout(this.waitTimer);
- }
- this.waitTimer = setTimeout(()=>{
- this.waitTimer = null;
- let key = this.searchKey;
- if (key){
- // 忽略大小写
- // key = key.toLowerCase();
- this.filterTypes = this.downloads.filter(item=> item.title.indexOf(key) !== -1);
- }else{
- this.filterTypes = this.downloads;
- }
- },700);
- },
- clearSearchText(){
- this.searchKey = '';
- this.filterTypeChangeHandle();
- }
- },
- }
- </script>
- <style scoped>
- .downloads{
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: flex-start;
- }
- .download-types{
- width: 20%;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
- border-right: 1px solid #e5e5e5;
- overflow: auto;
- }
- .download-types .searchType{
- width: 100%;
- height: 40px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- position: relative;
- font-size: 0.95rem;
- }
- .download-types .searchType input{
- width: 100%;
- height: 30px;
- border: 1px solid #e5e5e5;
- border-radius: 5px;
- padding: 0 10px;
- outline: none;
- position: relative;
- }
- .download-types .searchType .close{
- width: 20px;
- height: 20px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- margin-left: 10px;
- cursor: pointer;
- position: absolute;
- right: 10px;
- color: #c54949;
- }
- .download-types .searchType .close:hover{
- color: #ff0000;
- font-size: 1.15rem;
- }
- .d-type{
- width: 100%;
- height: 40px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- border-bottom: 1px solid #e5e5e5;
- cursor: pointer;
- }
- .d-type:hover{
- background-color: #f5f5f5;
- }
- .download-type-items{
- width: 80%;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-start;
- padding: 10px;
- }
- .download-type-items .title{
- width: 100%;
- height: 40px;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- font-size: 1.2rem;
- font-weight: bold;
- color: #333333;
- }
- .download-type-items .d-type-item{
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-start;
- }
- .download-type-items .d-type-item a{
- width: 100%;
- height: 40px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #e5e5e5;
- text-decoration: none;
- color: #333333;
- cursor: pointer;
- padding: 0 10px;
- box-sizing: border-box;
- }
- .download-type-items .d-type-item a:hover{
- background-color: #ce5e5e;
- color: #ffffff;
- }
- .download-type-items .d-type-item a .file{
- width: calc(100% - 200px);
- height: 100%;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- .download-type-items .d-type-item a .file .icon{
- width: 20px;
- height: 20px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- margin-right: 10px;
- }
- .download-type-items .d-type-item a .time{
- width: 200px;
- height: 100%;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- align-items: center;
- }
- </style>
|