123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <div class="home-wrapper">
- <!-- <TopSearch :searchVal="searchVal" :searchType="searchType" :searchTypeArr="searchTypeArr"/>-->
- <div class="nav" stype="height:500px">
- <!--搜索框-->
- <el-row class="container search-nav" style="padding: 30px 0 20px 0" :gutter="40">
- <el-col :span="5">
- <div class="pull-left to-mooctest-ranking" @click="handleLogoClick">
- <!-- <img class="logo-img" :src="logo_transparent" :to="'/home'"/>-->
- <!-- <span class="logo-title">{{ logoTitle }}</span>-->
- </div>
- </el-col>
- <el-col :span="15">
- <div class="search-nav-input">
- <div id="search-block ">
- <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
- <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name"
- :name="item.value"
- :key="item.value"></el-tab-pane>
- </el-tabs>
- <div class="search-input">
- <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
- <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
- </el-input>
- </div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
- </el-col>
- </el-row>
- </div>
- <div class="container" style="margin: 20px auto;" v-loading="loading">
- <div class="create-body">
- <div class="title h2">众测应用类型</div>
- <template style="color: black">
- <el-table
- ref="multipleTable"
- :data="curCrowdList"
- tooltip-effect="dark"
- style="width: 100%; font-size: 20px; color: black">
- <el-table-column
- label="图标"
- width="200">
- <template slot-scope="scope"><img :src="scope.row.image" style="width: 50px; height: 50px;"/></template>
- </el-table-column>
- <el-table-column
- prop="name"
- label="名称"
- align="left"
- width="300">
- </el-table-column>
- <el-table-column
- prop="count"
- align="center"
- label="项目数量">
- </el-table-column>
- <el-table-column
- align="center"
- label="操作">
- <template slot-scope="scope">
- <div class="btn btn-small btn-info" @click="goToDetail(scope.row.code)">查看详情</div>
- </template>
- </el-table-column>
- </el-table>
- </template>
- <el-pagination
- v-if="curCrowdList&&curCrowdList.length"
- :page-size="9"
- layout="prev, pager, next"
- :total="totalElements"
- :current-page="activePage"
- @current-change="handlePageChange"
- class="pull-right"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Http from '@/js/http.js';
- import TopSearch from "../../components/commons/TopSearch";
- import {storageGet} from '@/js/index.js'
- import {notify} from "../../constants";
- import Apis from '@/js/api';
- import {CONFIG} from "../../config";
- export default {
- name: "CrowdList",
- props: ['searchVal', 'crowdList'],
- components: {TopSearch},
- data() {
- return {
- logoTitle:CONFIG.logoTitle,
- user: {},
- isLogin: false,
- loading: false,
- // searchVal: '',
- searchType: '0',
- searchTypeArr: [
- {
- "name": "众测",
- "value": "0"
- }],
- curCrowdList: this.crowdList,
- activePage: 1,
- totalElements: 0,
- }
- },
- methods: {
- loadData() {
- if (storageGet('user') != null) {
- this.isLogin = true;
- }
- let url = '/api/common/index/application';
- let params = {
- "keyword": this.searchVal,
- "activePage": this.activePage,
- "columnFilters": [
- {
- "field": "type",
- "type": "enums",
- "enums": this.searchTypeArr,
- "value": this.searchType
- }
- ]
- }
- Http.post(url, params).then((res) => {
- this.curCrowdList = res.data.content;
- this.totalElements = res.data.totalElements;
- })
- },
- checkLogin() {
- this.checkCreateProjectAuth();
- },
- showLoading() {
- this.loading = true
- },
- hideLoading() {
- this.loading = false
- },
- 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)
- })
- }
- },
- handleSearchData() {
- let url = '/api/common/index/application';
- let params = {
- "keyword": this.searchVal,
- "activePage": this.activePage,
- "columnFilters": [
- {
- "field": "type",
- "type": "enums",
- "enums": this.searchTypeArr,
- "value": this.searchType
- }
- ]
- }
- Http.post(url, params).then((res) => {
- this.curCrowdList = res.data.content;
- })
- },
- gotoHome() {
- this.$router.push('/home');
- },
- handleTypeClick(tab) {
- this.searchType = tab.name
- },
- handlePageChange(index) {
- this.activePage = index;
- this.handleSearchData();
- },
- goToDetail(code) {
- this.$router.push({
- name: 'CrowdDetail',
- path:'/crowd/detail',
- query: {code: code}
- })
- },
- setUserInfo() {
- this.user = storageGet('user') && storageGet('user').userVO;
- }
- },
- mounted() {
- this.setUserInfo();
- this.loadData();
- }
- }
- </script>
- <style lang="scss">
- @import "../../style/search-nav.scss";
- .item-template {
- height: 80px;
- }
- </style>
|