selectMajor.vue
2.8 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
<template>
<view class="content">
<!-- <view class="top">
<view class="search">
<image class="icon" src="../../static/sousuo_icon@2x.png"></image>
<input type="text" placeholder="请输入搜索内容" class="input" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;">
</view>
<view class="searchBtn">搜索</view>
</view> -->
<view class="contentBox">
<view class="item" v-for="(item,index) in majorlist" :key="index" @click="selmajor" :data-item="item">{{item.name}}</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data(){
return{
majorlist:[]
}
},
methods:{
getAllMajor(){
var that = this
var url = "university/getGraduated"
var params = {}
app.post(url,params,"get").then((res)=>{
that.majorlist=res
console.log(res)
}).catch((err)=>{
console.log(err)
})
},
selmajor(e){
console.log(e.currentTarget.dataset)
// this.school_id=e.currentTarget.dataset.id.id
var name = e.currentTarget.dataset.item.name
var id = e.currentTarget.dataset.item.id
//this.$emit('school_id',this.school_id)
// var id = this.school_id
let pages = getCurrentPages();
let prevPage = pages[ pages.length - 2 ]
prevPage.$vm.majorname=name
prevPage.$vm.majorid=id
console.log(name)
// prevPage.$vm.name = name
uni.navigateBack()
}
},
onLoad(){
this.getAllMajor()
}
}
</script>
<style lang="less">
page{
background-color: #f9f9f9;
}
.content{
// background-color: rgba(249,249,249,1);
.top{
padding: 18rpx 32rpx;
display: flex;
background-color: #fff;
}
.search{
// background-color: #fff;
display: flex;
// text-align: center;
align-items: center;
width:596rpx;
height:64rpx;
background:rgba(238,238,238,1);
opacity:1;
border-radius:40rpx;
padding: 0 28rpx;
box-sizing: border-box;
.icon{
width: 30rpx;
height: 30rpx;
}
.input{
height: 64rpx;
width: 500rpx;
text-align: center;
}
}
.searchBtn{
color:rgba(6,18,30,1);
font-size: 28rpx;
line-height: 64rpx;
margin-left: 20rpx;
}
.contentBox{
width: 750rpx;
// height: ;
display: flex;
flex-wrap: wrap;
padding: 24rpx 18rpx 24rpx 32rpx;
.item{
width:220rpx;
height:112rpx;
background:rgba(255,255,255,1);
box-shadow:0rpx 2rpx 4rpx rgba(0,0,0,0.06);
opacity:1;
border-radius:8rpx;
font-size: 24rpx;
color:rgba(45,85,117,1);
padding: 0 38rpx;
line-height: 112rpx;
box-sizing: border-box;
text-align: center;
margin-right: 14rpx;
margin-bottom: 16rpx;
}
}
}
</style>