| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <div class="technology-container">
- <div class="nav" stype="height:500px">
- <!--搜索框-->
- <el-row class="search-nav" style="padding: 30px 0 20px 0">
- <el-col :span="6">
- <div class="pull-left" @click="gotoHome" style="cursor: pointer">
- <img class="logo-img" :src="logo_transparent" />
- <span class="logo-title">{{logoTitle}}</span>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="search-nav">
- <div id="search-block " class="">
- <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
- <el-tab-pane v-for="item in searchTypeArr" :label="item.label" :name="item.value" :key="item.value"></el-tab-pane>
- </el-tabs>
- <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
- <el-button class="search-button" slot="append" type="primary" @click="loadTechnologyArticles(1)">搜索</el-button>
- </el-input>
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
- </el-col>
- </el-row>
- <!--TabNav-->
- <!-- <el-tabs v-model="searchType" @tab-click="handleTabClick" class="square-tab">-->
- <!-- <el-tab-pane v-for="item in searchTypeArr" :name="item.value" :key="item.value">-->
- <!-- <span slot="label" style="font-size: 18px">{{item.name}}</span>-->
- <!-- </el-tab-pane>-->
- <!-- </el-tabs>-->
- <div>
- </div>
- </div>
- <div class="container" style="margin: 15px auto">
- <el-row>
- <el-col :span="18" class="project-task">
- <TechnologyCard
- :techArticleList = techArticleList.content v-if="searchType=='0'" @refreshList="loadTechnologyArticles(activePage)">
- </TechnologyCard>
- <TechnologyMG :techArticleList = techArticleList.content v-if="searchType=='1'"></TechnologyMG>
- <el-pagination
- v-if="techArticleList.content&&techArticleList.content.length"
- :page-size="5"
- layout="prev, pager, next"
- :total="techArticleList.totalElements"
- @current-change="handlePageChange"
- :current-page = activePage
- class="pull-right"
- >
- </el-pagination>
- </el-col>
- <!-- <el-col :span="6" class="popular-modules">-->
- <!-- <HotActicle :articleArr="articleArr" @refreshHotArticle="loadHotArticles"/>-->
- <!-- </el-col>-->
- </el-row>
- </div>
- </div>
- </template>
- <script>
- import Http from '@/js/http.js'
- import Apis from '@/js/api.js'
- import SearchBar from '../../components/commons/SearchBar'
- import TechnologyCard from './TechnologyCard'
- import TechnologyMG from './TechnologyMG'
- import {storageGet} from '@/js/index.js'
- import {notify} from "../../constants";
- import {CONFIG} from "../../config";
- export default {
- name: 'TechnologyMore',
- components: {
- SearchBar,
- TechnologyCard,
- TechnologyMG,
- },
- data(){
- return {
- logoTitle:CONFIG.logoTitle,
- logo_transparent:CONFIG.logo_transparent,
- loading: false,
- isLogin: false,
- searchVal: '',
- searchType:'',
- searchTypeArr:[
- {
- "name": "技术文章",
- "value": "0",
- "label":'文章'
- }
- ],
- articleArr:[],
- keyword:"",
- activePage:1,
- techArticleList:{},
- }
- },
- methods:{
- loadData(){
- if (storageGet('user') != null) {
- this.isLogin = true;
- }
- },
- checkLogin() {
- this.checkCreateProjectAuth();
- },
- checkCreateProjectAuth() {
- if (!this.isLogin) {
- console.log("请登录后访问");
- notify('warning', '请登录后访问');
- } else if (this.isLogin) {
- Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
- this.$router.push('/project/create');
- }).catch((error) => {
- notify('error', error.data)
- })
- }
- },
- gotoHome(){
- this.$router.push('/home');
- },
- handleTypeClick(tab){
- this.handleTabClick(tab);
- },
- handleTabClick(tab){
- this.searchType = tab.name
- this.activePage = 1;
- this.searchVal = '';
- this.loadTechnologyArticles(1);
- },
- loadTechnologyArticles(index){
- this.activePage = index;
- let params = {
- "keyword": this.searchVal,//查询条件,分页展示时就不填
- "activePage": this.activePage,//指定页数
- "columnFilters": [
- {
- "field": "type",
- "type": "enums",
- "enums": this.searchTypeArr,
- "value": this.searchType//展示技术文章value为0
- }
- ]
- }
- Http.post(Apis.TECHNOLOGY.GET_MORE, params).then((res) => {
- console.log(res.data.technicalArticlesPage)
- if(res.data.technicalArticlesPage){
- this.techArticleList = res.data.technicalArticlesPage;
- this.searchType = '0';
- }
- else if(res.data.publicationsPage){
- this.techArticleList = res.data.publicationsPage;
- this.searchType = '1';
- }
- console.log(this.techArticleList)
- })
- },
- handlePageChange(index){
- this.activePage = index;
- this.loadTechnologyArticles(index);
- },
- setUserInfo() {
- this.user = storageGet('user') && storageGet('user').userVO;
- }
- },
- mounted() {
- this.loadData();
- this.setUserInfo();
- this.loadTechnologyArticles(1);
- }
- }
- </script>
- <style lang="scss">
- @import "../../style/search-nav.scss";
- .technology-container {
- /deep/ .search-input,/deep/ .releaseBtn{
- margin: 20px 0 0 0 !important;
- }
- .popular-modules {
- padding-left: 15px;
- }
- }
- </style>
|