demand.vue
3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<template>
<view class="page">
<view class="main">
<view class="top">
<image src="../../static/img/supply2.png" @click="toPostDemand()" mode="widthFix"></image>
</view>
<view class="titleall-box">
<view class="title-screen">
<scroll-view scroll-x="true" class="scrollview-box">
<!-- 下方的红线 -->
<!-- <view ref="line" class="line" ></view> -->
<view :class="['title-screen-box',{'red_line':nowShow === 1}]" @click="allPro(1,'全部')">
<view>全部</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 2}]" @click="metalPro(2,'金属')">
<view>金属</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 3}]" @click="devicePro(3,'专用设备')">
<view>专用设备</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 4}]" @click="tranPro(4,'交通运输')">
<view>交通运输</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 5}]" @click="elecPro(5,'电气机械')">
<view>电气机械</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 6}]" @click="commuPro(6,'电子及通讯')">
<view>电子及通讯</view>
</view>
</scroll-view>
<view class="title-screen-box" style="background-color: #fff;margin-right: 0;text-align: center;">
<view class="title-screen-box-btn">
<image src="../../static/supply.png"></image>
</view>
</view>
</view>
</view>
<view class="recommend-info">
<view class="goods-list">
<view class="list" @click="ArticleDetails(item)" v-for="(item,index) in demandList" :key="index">
<view class="title-tag">
<view class="tag">
{{item.subTitle}}
</view>
<view class="tag-small">
{{item.subTitle}}
</view>
</view>
<view class="price-info">
<view class="user-price">
<view class="goods-city">
<image src="../../static/image/default_logo.jpg"></image>{{item.comanyName}}
</view>
<view class="goods-city-img">
<image src="../../static/right2.png"></image>
</view>
</view>
<view class="vip-price">
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
demandList: [],
nowShow: 1
}
},
onLoad() {
let that = this
this.getDemandList()
this.allPro()
},
methods: {
// 点击全部
allPro(index, name) {
let that = this
this.nowShow = index
console.log(name)
},
// 点击金属
metalPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击专用设备
devicePro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击交通运输
tranPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击电气机械
elecPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击电子及通讯
commuPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 获取全部需求数据
getDemandList() {
let that = this
that.API.getDemandList({
pageSize: 50,
}).then(res => {
console.log(res)
that.demandList = res.data.list
})
},
ArticleDetails(it) {
uni.navigateTo({
url: `/pages/ArticleDetails/ArticleDetails?data=${JSON.stringify(it)}`
})
},
// 去需求发布页面
toPostDemand() {
uni.navigateTo({
url: '/pages/postDemand/postDemand'
})
}
}
};
</script>
<style scoped lang="scss">
@import 'demand.scss';
</style>