作者 朱振飞

注册优化

1 <template> 1 <template>
2 - <view class="content">  
3 - <view class="studentMsg">  
4 - <view class="item">  
5 - <view class="title">姓名</view>  
6 - <input type="text" v-model="username" class="inpt" placeholder="请输入姓名" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;">  
7 - </view>  
8 - <view class="item">  
9 - <view class="title">邮箱</view>  
10 - <input type="text" v-model="email" class="inpt" placeholder="请输入邮箱" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;">  
11 - </view>  
12 - <view class="item" style="border-bottom:none">  
13 - <view class="title">头像</view>  
14 - <image @click="upload" class="photo" :src="isUpload ? image : '../../static/touxiang_img@2x.png'"></image>  
15 - </view>  
16 - </view>  
17 - <view class="schoolTitle">高中信息</view>  
18 - <view class="studentMsg">  
19 - <view class="item" @click="selhigh">  
20 - <view class="title">高中</view>  
21 - <view class="selectBtn">{{isHighShow? name : '请选择就读高中'}}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
22 - </view>  
23 - <view class="item">  
24 - <view class="title">毕业年份</view>  
25 - <!-- <view class="selectBtn">请选择毕业年份<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view> -->  
26 - <view @click="selDate" style="display: flex;justify-content: space-between;align-items: center;">  
27 - <picker mode="date" :value="date" start="2000-01-01" @change="bindTimeChange">  
28 - <view class="selectBtn">{{isDateShow? date : '请选择毕业年份'}}</view>  
29 - </picker>  
30 - <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>  
31 - </view>  
32 - </view>  
33 - <view class="item" @click="subPopupShow">  
34 - <view class="title">选考科目</view>  
35 - <view class="selectBtn">{{subid.toString()!='' ? subname.toString() : "请选择选考科目"}}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
36 - </view>  
37 - <view class="item" style="border-bottom:none" @click="stylePopupShow">  
38 - <view class="title">升学方式</view>  
39 - <view class="selectBtn">{{isupnameshow? upname : "请选择升学方式"}}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
40 - </view>  
41 - </view>  
42 - <view class="schoolTitle">大学信息</view>  
43 - <view class="studentMsg">  
44 - <view class="item" @click="selcollege">  
45 - <view class="title">就读大学</view>  
46 - <view class="selectBtn">{{isNameShow? collegename : '请选择就读大学'}}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
47 - </view>  
48 - <view class="item">  
49 - <view class="title">所属学院</view>  
50 - <view class="selectBtn" @click="tocollege">{{iscollgegshow? academyname : '请选择所属学院' }}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
51 - </view>  
52 - <view class="item" style="border-bottom:none" @click="tomajor">  
53 - <view class="title">就读专业</view>  
54 - <view class="selectBtn">{{ismajorshow? academyname : '请选择所属专业' }}<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view>  
55 - </view>  
56 - </view>  
57 - <view class="okBtn" @click="collegeregister">注册</view>  
58 - <view class="subPopup" v-if="isSubPopupShow">  
59 - <view class="selectCard">  
60 - <view class="buttonBox">  
61 - <view class="closeBtn" @click="subPopupHide">取消</view>  
62 - <view class="confimBtn" @click="subPopupHide">确定</view>  
63 - </view>  
64 - <view class="subBox">  
65 - <view class="subject" @click="selsub" :class="{active:subid.indexOf(item.id)!=-1}" v-for="(item,index) in sublist" :key="index" :data-id="item.id" :data-name="item.name">{{item.name}}</view>  
66 - </view>  
67 - </view>  
68 - </view>  
69 - <view class="stylePopup" v-if="isStylePopupShow">  
70 - <view class="styleCard">  
71 - <view class="buttonBox">  
72 - <view class="closeBtn" @click="stylePopupHide">取消</view>  
73 - <view class="confimBtn" @click="stylePopupHide">确定</view>  
74 - </view>  
75 - <view class="subBox">  
76 - <view class="subject" :class="{active:upid==item.id}" @click="selup" v-for="(item,index) in uplist" :key="index" :data-id="item.id" :data-name="item.name">{{item.name}}</view>  
77 - </view>  
78 - </view>  
79 - </view>  
80 - </view> 2 + <view class="content">
  3 + <view class="studentMsg">
  4 + <view class="item">
  5 + <view class="title">姓名</view>
  6 + <input type="text" v-model="username" class="inpt" placeholder="请输入姓名" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;" />
  7 + </view>
  8 + <view class="item">
  9 + <view class="title">邮箱</view>
  10 + <input type="text" v-model="email" class="inpt" placeholder="请输入邮箱" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;" />
  11 + </view>
  12 + <view class="item" style="border-bottom:none">
  13 + <view class="title">头像</view>
  14 + <image @click="upload" class="photo" :src="isUpload ? uploadImg : '../../static/touxiang_img@2x.png'"></image>
  15 + </view>
  16 + </view>
  17 + <view class="schoolTitle">高中信息</view>
  18 + <view class="studentMsg">
  19 + <view class="item" @click="selhigh">
  20 + <view class="title">高中</view>
  21 + <view class="selectBtn">
  22 + {{ isHighShow ? name : '请选择就读高中' }}
  23 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  24 + </view>
  25 + </view>
  26 + <view class="item">
  27 + <view class="title">毕业年份</view>
  28 + <!-- <view class="selectBtn">请选择毕业年份<image class="icon" src="../../static/zhuandao_icon@2x.png"></image></view> -->
  29 + <view @click="selDate" style="display: flex;justify-content: space-between;align-items: center;">
  30 + <picker mode="date" :value="date" start="2000-01-01" @change="bindTimeChange">
  31 + <view class="selectBtn">{{ isDateShow ? date : '请选择毕业年份' }}</view>
  32 + </picker>
  33 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  34 + </view>
  35 + </view>
  36 + <view class="item" @click="subPopupShow">
  37 + <view class="title">选考科目</view>
  38 + <view class="selectBtn">
  39 + {{ subid.toString() != '' ? subname.toString() : '请选择选考科目' }}
  40 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  41 + </view>
  42 + </view>
  43 + <view class="item" style="border-bottom:none" @click="stylePopupShow">
  44 + <view class="title">升学方式</view>
  45 + <view class="selectBtn">
  46 + {{ isupnameshow ? upname : '请选择升学方式' }}
  47 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  48 + </view>
  49 + </view>
  50 + </view>
  51 + <view class="schoolTitle">大学信息</view>
  52 + <view class="studentMsg">
  53 + <view class="item" @click="selcollege">
  54 + <view class="title">就读大学</view>
  55 + <view class="selectBtn">
  56 + {{ isNameShow ? collegename : '请选择就读大学' }}
  57 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  58 + </view>
  59 + </view>
  60 + <view class="item">
  61 + <view class="title">所属学院</view>
  62 + <view class="selectBtn" @click="tocollege">
  63 + {{ iscollgegshow ? academyname : '请选择所属学院' }}
  64 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  65 + </view>
  66 + </view>
  67 + <view class="item" style="border-bottom:none" @click="tomajor">
  68 + <view class="title">就读专业</view>
  69 + <view class="selectBtn">
  70 + {{ ismajorshow ? academyname : '请选择所属专业' }}
  71 + <image class="icon" src="../../static/zhuandao_icon@2x.png"></image>
  72 + </view>
  73 + </view>
  74 + </view>
  75 + <view class="okBtn" @click="collegeregister">注册</view>
  76 + <view class="subPopup" v-if="isSubPopupShow">
  77 + <view class="selectCard">
  78 + <view class="buttonBox">
  79 + <view class="closeBtn" @click="subPopupHide">取消</view>
  80 + <view class="confimBtn" @click="subPopupHide">确定</view>
  81 + </view>
  82 + <view class="subBox">
  83 + <view
  84 + class="subject"
  85 + @click="selsub"
  86 + :class="{ active: subid.indexOf(item.id) != -1 }"
  87 + v-for="(item, index) in sublist"
  88 + :key="index"
  89 + :data-id="item.id"
  90 + :data-name="item.name"
  91 + >
  92 + {{ item.name }}
  93 + </view>
  94 + </view>
  95 + </view>
  96 + </view>
  97 + <view class="stylePopup" v-if="isStylePopupShow">
  98 + <view class="styleCard">
  99 + <view class="buttonBox">
  100 + <view class="closeBtn" @click="stylePopupHide">取消</view>
  101 + <view class="confimBtn" @click="stylePopupHide">确定</view>
  102 + </view>
  103 + <view class="subBox">
  104 + <view
  105 + class="subject"
  106 + :class="{ active: upid == item.id }"
  107 + @click="selup"
  108 + v-for="(item, index) in uplist"
  109 + :key="index"
  110 + :data-id="item.id"
  111 + :data-name="item.name"
  112 + >
  113 + {{ item.name }}
  114 + </view>
  115 + </view>
  116 + </view>
  117 + </view>
  118 + </view>
81 </template> 119 </template>
82 120
83 <script> 121 <script>
84 - import app from "../../App.vue" 122 +import app from '../../App.vue';
85 123
86 export default { 124 export default {
87 - data(){  
88 - return{  
89 - isSubPopupShow:false,  
90 - isStylePopupShow:false,  
91 - username:'',  
92 - image:'',  
93 - isUpload:false,  
94 - date: '请选择毕业年份',  
95 - isDateShow: false,  
96 - uplist:[],  
97 - upid:'1',  
98 - subid:[],  
99 - sublist:[],  
100 - collegename:'请选择就读大学',  
101 - isNameShow:false,  
102 - isHighShow:false,  
103 - name:'请选择就读高中',  
104 - subname:[],  
105 - issubnameshow:false,  
106 - upname:'请选择升学方式',  
107 - isupnameshow:false,  
108 - school_id:'',  
109 - uni_id:'',  
110 - academyname:'请选择所属学院',  
111 - iscollgegshow:false,  
112 - majorname:'请选择所属专业',  
113 - ismajorshow:false,  
114 - email:'',  
115 - majorid:'',  
116 - academyid:'',  
117 - chuanimg:''  
118 -  
119 - }  
120 - },  
121 - methods:{  
122 - selDate(){  
123 - this.isDateShow=true  
124 - },  
125 - subPopupShow(){  
126 - this.isSubPopupShow=true  
127 - },  
128 - subPopupHide(){  
129 - this.isSubPopupShow=false  
130 - },  
131 - stylePopupShow(){  
132 - this.isStylePopupShow=true  
133 - },  
134 - stylePopupHide(){  
135 - this.isStylePopupShow=false  
136 - },  
137 - // toSchoolmate(){ 125 + data() {
  126 + return {
  127 + isSubPopupShow: false,
  128 + isStylePopupShow: false,
  129 + username: '',
  130 + image: '',
  131 + isUpload: false,
  132 + date: '请选择毕业年份',
  133 + isDateShow: false,
  134 + uplist: [],
  135 + upid: '1',
  136 + subid: [],
  137 + sublist: [],
  138 + collegename: '请选择就读大学',
  139 + isNameShow: false,
  140 + isHighShow: false,
  141 + name: '请选择就读高中',
  142 + subname: [],
  143 + issubnameshow: false,
  144 + upname: '请选择升学方式',
  145 + isupnameshow: false,
  146 + school_id: '',
  147 + uni_id: '',
  148 + academyname: '请选择所属学院',
  149 + iscollgegshow: false,
  150 + majorname: '请选择所属专业',
  151 + ismajorshow: false,
  152 + email: '',
  153 + majorid: '',
  154 + academyid: '',
  155 + chuanimg: '',
  156 + baseUrl: app.globalData.imageBaseUrl,
  157 + uploadImg: ''
  158 + };
  159 + },
  160 + methods: {
  161 + selDate() {
  162 + this.isDateShow = true;
  163 + },
  164 + subPopupShow() {
  165 + this.isSubPopupShow = true;
  166 + },
  167 + subPopupHide() {
  168 + this.isSubPopupShow = false;
  169 + },
  170 + stylePopupShow() {
  171 + this.isStylePopupShow = true;
  172 + },
  173 + stylePopupHide() {
  174 + this.isStylePopupShow = false;
  175 + },
138 176
139 - // wx.navigateTo({  
140 - // url: "/pages/schoolmate/schoolmate?type="+2  
141 - // })  
142 - // },  
143 - upload(){  
144 - var that = this;  
145 - uni.chooseImage({  
146 - count: 1,  
147 - sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有  
148 - sourceType: ['album'], //从相册选择  
149 - success: function (res) {  
150 - const tempFilePaths = res.tempFilePaths;  
151 - that.image = tempFilePaths[0];  
152 - app.upload('image',res.tempFilePaths[0],"post").then((res)=>{  
153 - // let newimage=that.image  
154 - that.image=res.url;  
155 - that.chuanimg=res.kurl  
156 - console.log(res)  
157 - console.log(that.image)  
158 - console.log(res.url)  
159 - // newimage.push(res.url)  
160 - that.isUpload=true  
161 - }).catch((err)=>{  
162 - console.log(err)  
163 - })  
164 - // console.log("tempFilePaths[0]",tempFilePaths[0]) //能够打印出选中的图片  
165 - // console.log(res)  
166 - // that.head_image=tempFilePaths[0]  
167 - // that.iconcheck = 1;//点击后图片更改状态由0变成1  
168 - },  
169 - error : function(e){  
170 - console.log(e);  
171 - }  
172 - });  
173 - },  
174 - bindTimeChange: function(e) {  
175 - this.date = e.target.value  
176 - },  
177 - getUpType(){  
178 - var that = this  
179 - var url = "university/getAllUp"  
180 - var params = {}  
181 - app.post(url,params,"get").then((res)=>{  
182 - console.log(res)  
183 - that.uplist=res  
184 - }).catch((err)=>{  
185 - console.log(err)  
186 - })  
187 - },  
188 - getAllSub(){  
189 - var that=this  
190 - var url = "university/listSubject"  
191 - var params ={}  
192 - app.post(url,params,"get").then((res)=>{  
193 - that.sublist=res  
194 - console.log(res)  
195 - }).catch((err)=>{  
196 - console.log(err)  
197 - })  
198 - },  
199 - selup(e){  
200 - this.isupnameshow=true  
201 - console.log(e.currentTarget.dataset)  
202 - this.upid=e.currentTarget.dataset.id  
203 - this.upname=e.currentTarget.dataset.name  
204 - },  
205 - selsub(e){  
206 - Array.prototype.remove = function(val) {  
207 - var index = this.indexOf(val);  
208 - if (index > -1) {  
209 - this.splice(index, 1);  
210 - }  
211 - };  
212 - this.issubnameshow=true  
213 - if(this.subid.indexOf(e.currentTarget.dataset.id)!=-1){  
214 - this.subid.remove(e.currentTarget.dataset.id)  
215 - this.subname.remove(e.currentTarget.dataset.name)  
216 - }else{  
217 - this.subid.push(e.currentTarget.dataset.id)  
218 - this.subname.push(e.currentTarget.dataset.name)  
219 - }  
220 - console.log(this.subid) 177 + upload() {
  178 + var that = this;
  179 + uni.chooseImage({
  180 + count: 1,
  181 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  182 + sourceType: ['album'], //从相册选择
  183 + success: function(res) {
  184 + const tempFilePaths = res.tempFilePaths;
  185 + that.image = tempFilePaths[0];
  186 + app.upload('image', res.tempFilePaths[0], 'post')
  187 + .then(res => {
  188 + that.image = res.url;
  189 + that.chuanimg = res.kurl;
  190 + that.uploadImg = that.baseUrl + res.kurl;
  191 + that.isUpload = true;
  192 + })
  193 + .catch(err => {
  194 + console.log(err);
  195 + });
  196 + },
  197 + error: function(e) {
  198 + console.log(e);
  199 + }
  200 + });
  201 + },
  202 + bindTimeChange: function(e) {
  203 + this.date = e.target.value;
  204 + },
  205 + getUpType() {
  206 + var that = this;
  207 + var url = 'university/getAllUp';
  208 + var params = {};
  209 + app.post(url, params, 'get')
  210 + .then(res => {
  211 + console.log(res);
  212 + that.uplist = res;
  213 + })
  214 + .catch(err => {
  215 + console.log(err);
  216 + });
  217 + },
  218 + getAllSub() {
  219 + var that = this;
  220 + var url = 'university/listSubject';
  221 + var params = {};
  222 + app.post(url, params, 'get')
  223 + .then(res => {
  224 + that.sublist = res;
  225 + console.log(res);
  226 + })
  227 + .catch(err => {
  228 + console.log(err);
  229 + });
  230 + },
  231 + selup(e) {
  232 + this.isupnameshow = true;
  233 + console.log(e.currentTarget.dataset);
  234 + this.upid = e.currentTarget.dataset.id;
  235 + this.upname = e.currentTarget.dataset.name;
  236 + },
  237 + selsub(e) {
  238 + Array.prototype.remove = function(val) {
  239 + var index = this.indexOf(val);
  240 + if (index > -1) {
  241 + this.splice(index, 1);
  242 + }
  243 + };
  244 + this.issubnameshow = true;
  245 + if (this.subid.indexOf(e.currentTarget.dataset.id) != -1) {
  246 + this.subid.remove(e.currentTarget.dataset.id);
  247 + this.subname.remove(e.currentTarget.dataset.name);
  248 + } else {
  249 + this.subid.push(e.currentTarget.dataset.id);
  250 + this.subname.push(e.currentTarget.dataset.name);
  251 + }
  252 + console.log(this.subid);
  253 + },
  254 + selcollege() {
  255 + this.isNameShow = true;
  256 + uni.navigateTo({
  257 + url: './selectCollege'
  258 + });
  259 + },
  260 + selhigh() {
  261 + this.isHighShow = true;
  262 + uni.navigateTo({
  263 + url: './selectSchool'
  264 + });
  265 + },
  266 + tocollege() {
  267 + this.iscollgegshow = true;
  268 + var school_id = this.uni_id;
  269 + console.log(school_id);
  270 + uni.navigateTo({
  271 + url: './selectAcademy?uni_id=' + school_id
  272 + });
  273 + },
  274 + tomajor() {
  275 + this.ismajorshow = true;
221 276
222 - },  
223 - selcollege(){  
224 - this.isNameShow=true  
225 - uni.navigateTo({  
226 - url:'./selectCollege'  
227 - })  
228 - },  
229 - selhigh(){  
230 - this.isHighShow=true  
231 - uni.navigateTo({  
232 - url:'./selectSchool'  
233 - })  
234 - },  
235 - tocollege(){  
236 - this.iscollgegshow=true  
237 - var school_id = this.uni_id  
238 - console.log(school_id)  
239 - uni.navigateTo({  
240 - url:'./selectAcademy?uni_id='+school_id  
241 - })  
242 - },  
243 - tomajor(){  
244 - this.ismajorshow=true  
245 -  
246 - uni.navigateTo({  
247 - url:'./selectMajor'  
248 - })  
249 - },  
250 - collegeregister(){  
251 - var that = this  
252 - if(that.username==''){  
253 - uni.showToast({  
254 - title:"姓名不能为空",  
255 - icon:"none"  
256 - })  
257 - return false  
258 - }  
259 - var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/ ;  
260 - if(!reg.test(that.email)){  
261 - uni.showToast({  
262 - title:"请输入正确邮箱",  
263 - icon:"none"  
264 - })  
265 - return false  
266 - }  
267 - if(that.image==''){  
268 - uni.showToast({  
269 - title:"请选择头像",  
270 - icon:"none"  
271 - })  
272 - return false  
273 - }  
274 - if(that.name=='请选择就读高中'){  
275 - uni.showToast({  
276 - title:"请选择高中",  
277 - icon:"none"  
278 - })  
279 - return false  
280 - }  
281 - if(that.date=='请选择毕业年份'){  
282 - uni.showToast({  
283 - title:"请选择毕业年份",  
284 - icon:"none"  
285 - })  
286 - return false  
287 - }  
288 - if(that.subname=='请选择选考科目'){  
289 - uni.showToast({  
290 - title:"请选择选考科目",  
291 - icon:"none"  
292 - })  
293 - return false  
294 - }  
295 - if(that.upname=='请选择升学方式'){  
296 - uni.showToast({  
297 - title:"请选择升学方式",  
298 - icon:"none"  
299 - })  
300 - return false  
301 - }  
302 - if(that.collegename=='请选择就读大学'){  
303 - uni.showToast({  
304 - title:"请选择就读大学",  
305 - icon:"none"  
306 - })  
307 - return false  
308 - }  
309 - if(that.academyname=='请选择所属学院'){  
310 - uni.showToast({  
311 - title:"请选择所属学院",  
312 - icon:"none"  
313 - })  
314 - return false  
315 - }  
316 - if(that.majorname=='请选择所属专业'){  
317 - uni.showToast({  
318 - title:"请选择所属专业",  
319 - icon:"none"  
320 - })  
321 - return false  
322 - }  
323 - var url = "register/register"  
324 - var token = uni.getStorageSync('token')  
325 - var params = {  
326 - token:token,  
327 - level:2,  
328 - nickname:that.username,  
329 - head_image:that.chuanimg,  
330 - school_id:that.school_id,  
331 - email:that.email,  
332 - endtime:that.date,  
333 - subject_ids:that.subid.toString(),  
334 - up_id:that.upid,  
335 - university_id:that.uni_id,  
336 - graduated_id:that.majorid,  
337 - college_id:that.academyid  
338 -  
339 - }  
340 - app.post(url,params,"post").then((res)=>{  
341 - console.log(res)  
342 - // console.log(res)  
343 - uni.showToast({  
344 - title:"注册成功",  
345 - icon:"none"  
346 - })  
347 - setTimeout(() => {  
348 - uni.navigateTo({  
349 - url: "/pages/schoolmate/schoolmate?type="+2  
350 - })  
351 - }, 1500);  
352 - }).catch((err)=>{  
353 - console.log(err)  
354 - if(err.code==0){  
355 - uni.showToast({  
356 - title:err.msg,  
357 - icon:'none'  
358 - })  
359 - }  
360 -  
361 - })  
362 - }  
363 -  
364 - },  
365 - onLoad(){  
366 - this.getUpType()  
367 - this.getAllSub()  
368 - }  
369 -  
370 -} 277 + uni.navigateTo({
  278 + url: './selectMajor'
  279 + });
  280 + },
  281 + collegeregister() {
  282 + var that = this;
  283 + if (that.username == '') {
  284 + uni.showToast({
  285 + title: '姓名不能为空',
  286 + icon: 'none'
  287 + });
  288 + return false;
  289 + }
  290 + var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  291 + if (!reg.test(that.email)) {
  292 + uni.showToast({
  293 + title: '请输入正确邮箱',
  294 + icon: 'none'
  295 + });
  296 + return false;
  297 + }
  298 + if (that.image == '') {
  299 + uni.showToast({
  300 + title: '请选择头像',
  301 + icon: 'none'
  302 + });
  303 + return false;
  304 + }
  305 + if (that.name == '请选择就读高中') {
  306 + uni.showToast({
  307 + title: '请选择高中',
  308 + icon: 'none'
  309 + });
  310 + return false;
  311 + }
  312 + if (that.date == '请选择毕业年份') {
  313 + uni.showToast({
  314 + title: '请选择毕业年份',
  315 + icon: 'none'
  316 + });
  317 + return false;
  318 + }
  319 + if (that.subname == '请选择选考科目') {
  320 + uni.showToast({
  321 + title: '请选择选考科目',
  322 + icon: 'none'
  323 + });
  324 + return false;
  325 + }
  326 + if (that.upname == '请选择升学方式') {
  327 + uni.showToast({
  328 + title: '请选择升学方式',
  329 + icon: 'none'
  330 + });
  331 + return false;
  332 + }
  333 + if (that.collegename == '请选择就读大学') {
  334 + uni.showToast({
  335 + title: '请选择就读大学',
  336 + icon: 'none'
  337 + });
  338 + return false;
  339 + }
  340 + if (that.academyname == '请选择所属学院') {
  341 + uni.showToast({
  342 + title: '请选择所属学院',
  343 + icon: 'none'
  344 + });
  345 + return false;
  346 + }
  347 + if (that.majorname == '请选择所属专业') {
  348 + uni.showToast({
  349 + title: '请选择所属专业',
  350 + icon: 'none'
  351 + });
  352 + return false;
  353 + }
  354 + var url = 'register/register';
  355 + var token = uni.getStorageSync('token');
  356 + var params = {
  357 + token: token,
  358 + level: 2,
  359 + nickname: that.username,
  360 + head_image: that.chuanimg,
  361 + school_id: that.school_id,
  362 + email: that.email,
  363 + endtime: that.date,
  364 + subject_ids: that.subid.toString(),
  365 + up_id: that.upid,
  366 + university_id: that.uni_id,
  367 + graduated_id: that.majorid,
  368 + college_id: that.academyid
  369 + };
  370 + app.post(url, params, 'post')
  371 + .then(res => {
  372 + console.log(res);
  373 + // console.log(res)
  374 + uni.showToast({
  375 + title: '注册成功',
  376 + icon: 'none'
  377 + });
  378 + setTimeout(() => {
  379 + uni.navigateTo({
  380 + url: '/pages/schoolmate/schoolmate?type=' + 2
  381 + });
  382 + }, 1500);
  383 + })
  384 + .catch(err => {
  385 + console.log(err);
  386 + if (err.code == 0) {
  387 + uni.showToast({
  388 + title: err.msg,
  389 + icon: 'none'
  390 + });
  391 + }
  392 + });
  393 + }
  394 + },
  395 + onLoad() {
  396 + this.getUpType();
  397 + this.getAllSub();
  398 + }
  399 +};
371 </script> 400 </script>
372 401
373 <style lang="less"> 402 <style lang="less">
374 -.content{  
375 - padding: 32rpx;  
376 - background:rgba(249,249,249,1);  
377 - font-size: 28rpx;  
378 - .studentMsg{  
379 - background-color: #fff;  
380 - padding: 0rpx 32rpx;  
381 - border-radius:20rpx;  
382 - .item{  
383 - height: 114rpx;  
384 - display: flex;  
385 - justify-content: space-between;  
386 - align-items: center;  
387 - border-bottom: 1rpx solid rgba(238,238,238,1);  
388 - font-size: 28rpx;  
389 - .title{  
390 - // line-height: 114px;  
391 - padding: 30rpx 0;  
392 - // box-sizing: border-box;  
393 - }  
394 - .selectBtn{  
395 - color:rgba(189,196,206,1);  
396 - line-height: 114rpx;  
397 -  
398 - }  
399 - .icon{  
400 - width: 13rpx;  
401 - height: 24rpx;  
402 - margin-left: 8rpx;  
403 - }  
404 - .inpt{  
405 - height: 114rpx;  
406 - text-align: right;  
407 - // width: 250rpx;  
408 - }  
409 - .photo{  
410 - width: 64rpx;  
411 - height: 64rpx;  
412 - margin-top: 20rpx;  
413 - border-radius: 50%;  
414 - }  
415 - }  
416 - }  
417 - .schoolTitle{  
418 - font-size:32rpx;  
419 - color:rgba(45,85,117,1);  
420 - margin-top: 44rpx;  
421 - margin-bottom: 12rpx;  
422 - }  
423 - .okBtn{  
424 - width:686rpx;  
425 - height:80rpx;  
426 - background:rgba(45,85,117,1);  
427 - opacity:1;  
428 - border-radius:8rpx;  
429 - font-size: 28rpx;  
430 - color: #fff;  
431 - line-height: 80rpx;  
432 - text-align: center;  
433 - margin-top: 56rpx;  
434 - }  
435 - .subPopup{  
436 - width: 100%;  
437 - height: 100%;  
438 - background-color: rgba(0, 0, 0, 0.5);  
439 - position: fixed;  
440 - top: 0;  
441 - left: 0;  
442 - right: 0;  
443 - z-index: 999;  
444 - .selectCard{  
445 - width: 750rpx;  
446 - height: 426rpx;  
447 - background:rgba(255,255,255,1);  
448 - // opacity:1;  
449 - border-radius:20px 20px 0px 0px;  
450 - position: absolute;  
451 - bottom: 0;  
452 - .buttonBox{  
453 - display: flex;  
454 - justify-content: space-between;  
455 - padding: 28rpx 30rpx;  
456 - font-size: 28rpx;  
457 - .closeBtn{  
458 - color:rgba(140,145,152,1);  
459 - }  
460 - .confimBtn{  
461 - color:rgba(45,85,117,1);  
462 - }  
463 - }  
464 - .subBox{  
465 - display: flex;  
466 - flex-wrap: wrap;  
467 - justify-content: space-between;  
468 - padding: 16rpx 32rpx;  
469 - .active{  
470 - background:rgba(129,195,191,1);  
471 - border:2rpx solid rgba(129,195,191,1);  
472 - color: #fff;  
473 - }  
474 - }  
475 - .subject{  
476 - width:28%;  
477 - height:56rpx;  
478 - background: #fff;  
479 - border:1rpx solid rgba(6,18,30,1);  
480 - opacity:1;  
481 - border-radius:40rpx;  
482 - text-align: center;  
483 - line-height: 56rpx;  
484 - color:rgba(6,18,30,1);  
485 - font-size: 28rpx;  
486 - margin-bottom: 36rpx;  
487 - }  
488 - }  
489 - }  
490 - .stylePopup{  
491 - width: 100%;  
492 - height: 100%;  
493 - background-color: rgba(0, 0, 0, 0.5);  
494 - position: fixed;  
495 - top: 0;  
496 - left: 0;  
497 - right: 0;  
498 - z-index: 999;  
499 - .styleCard{  
500 - width: 750rpx;  
501 - height: 228rpx;  
502 - background:rgba(255,255,255,1);  
503 - // opacity:1;  
504 - border-radius:20px 20px 0px 0px;  
505 - position: absolute;  
506 - bottom: 0;  
507 - .buttonBox{  
508 - display: flex;  
509 - justify-content: space-between;  
510 - padding: 28rpx 30rpx;  
511 - font-size: 28rpx;  
512 - .closeBtn{  
513 - color:rgba(140,145,152,1);  
514 - }  
515 - .confimBtn{  
516 - color:rgba(45,85,117,1);  
517 - }  
518 - }  
519 - .subBox{  
520 - display: flex;  
521 - flex-wrap: wrap;  
522 - justify-content: space-around;  
523 - padding: 16rpx 32rpx;  
524 - .active{  
525 - background:rgba(129,195,191,1);  
526 - border:2rpx solid rgba(129,195,191,1);  
527 - color: #fff;  
528 - }  
529 - }  
530 - .subject{  
531 - width:28%;  
532 - height:56rpx;  
533 - background: #fff;  
534 - border:1rpx solid rgba(6,18,30,1);  
535 - opacity:1;  
536 - border-radius:40rpx;  
537 - text-align: center;  
538 - line-height: 56rpx;  
539 - color:rgba(6,18,30,1);  
540 - font-size: 28rpx;  
541 - margin-bottom: 36rpx;  
542 - }  
543 - }  
544 - } 403 +.content {
  404 + padding: 32rpx;
  405 + background: rgba(249, 249, 249, 1);
  406 + font-size: 28rpx;
  407 + .studentMsg {
  408 + background-color: #fff;
  409 + padding: 0rpx 32rpx;
  410 + border-radius: 20rpx;
  411 + .item {
  412 + height: 114rpx;
  413 + display: flex;
  414 + justify-content: space-between;
  415 + align-items: center;
  416 + border-bottom: 1rpx solid rgba(238, 238, 238, 1);
  417 + font-size: 28rpx;
  418 + .title {
  419 + // line-height: 114px;
  420 + padding: 30rpx 0;
  421 + // box-sizing: border-box;
  422 + }
  423 + .selectBtn {
  424 + color: rgba(189, 196, 206, 1);
  425 + line-height: 114rpx;
  426 + }
  427 + .icon {
  428 + width: 13rpx;
  429 + height: 24rpx;
  430 + margin-left: 8rpx;
  431 + }
  432 + .inpt {
  433 + height: 114rpx;
  434 + text-align: right;
  435 + // width: 250rpx;
  436 + }
  437 + .photo {
  438 + width: 64rpx;
  439 + height: 64rpx;
  440 + margin-top: 20rpx;
  441 + border-radius: 50%;
  442 + }
  443 + }
  444 + }
  445 + .schoolTitle {
  446 + font-size: 32rpx;
  447 + color: rgba(45, 85, 117, 1);
  448 + margin-top: 44rpx;
  449 + margin-bottom: 12rpx;
  450 + }
  451 + .okBtn {
  452 + width: 686rpx;
  453 + height: 80rpx;
  454 + background: rgba(45, 85, 117, 1);
  455 + opacity: 1;
  456 + border-radius: 8rpx;
  457 + font-size: 28rpx;
  458 + color: #fff;
  459 + line-height: 80rpx;
  460 + text-align: center;
  461 + margin-top: 56rpx;
  462 + }
  463 + .subPopup {
  464 + width: 100%;
  465 + height: 100%;
  466 + background-color: rgba(0, 0, 0, 0.5);
  467 + position: fixed;
  468 + top: 0;
  469 + left: 0;
  470 + right: 0;
  471 + z-index: 999;
  472 + .selectCard {
  473 + width: 750rpx;
  474 + height: 426rpx;
  475 + background: rgba(255, 255, 255, 1);
  476 + // opacity:1;
  477 + border-radius: 20px 20px 0px 0px;
  478 + position: absolute;
  479 + bottom: 0;
  480 + .buttonBox {
  481 + display: flex;
  482 + justify-content: space-between;
  483 + padding: 28rpx 30rpx;
  484 + font-size: 28rpx;
  485 + .closeBtn {
  486 + color: rgba(140, 145, 152, 1);
  487 + }
  488 + .confimBtn {
  489 + color: rgba(45, 85, 117, 1);
  490 + }
  491 + }
  492 + .subBox {
  493 + display: flex;
  494 + flex-wrap: wrap;
  495 + justify-content: space-between;
  496 + padding: 16rpx 32rpx;
  497 + .active {
  498 + background: rgba(129, 195, 191, 1);
  499 + border: 2rpx solid rgba(129, 195, 191, 1);
  500 + color: #fff;
  501 + }
  502 + }
  503 + .subject {
  504 + width: 28%;
  505 + height: 56rpx;
  506 + background: #fff;
  507 + border: 1rpx solid rgba(6, 18, 30, 1);
  508 + opacity: 1;
  509 + border-radius: 40rpx;
  510 + text-align: center;
  511 + line-height: 56rpx;
  512 + color: rgba(6, 18, 30, 1);
  513 + font-size: 28rpx;
  514 + margin-bottom: 36rpx;
  515 + }
  516 + }
  517 + }
  518 + .stylePopup {
  519 + width: 100%;
  520 + height: 100%;
  521 + background-color: rgba(0, 0, 0, 0.5);
  522 + position: fixed;
  523 + top: 0;
  524 + left: 0;
  525 + right: 0;
  526 + z-index: 999;
  527 + .styleCard {
  528 + width: 750rpx;
  529 + height: 228rpx;
  530 + background: rgba(255, 255, 255, 1);
  531 + // opacity:1;
  532 + border-radius: 20px 20px 0px 0px;
  533 + position: absolute;
  534 + bottom: 0;
  535 + .buttonBox {
  536 + display: flex;
  537 + justify-content: space-between;
  538 + padding: 28rpx 30rpx;
  539 + font-size: 28rpx;
  540 + .closeBtn {
  541 + color: rgba(140, 145, 152, 1);
  542 + }
  543 + .confimBtn {
  544 + color: rgba(45, 85, 117, 1);
  545 + }
  546 + }
  547 + .subBox {
  548 + display: flex;
  549 + flex-wrap: wrap;
  550 + justify-content: space-around;
  551 + padding: 16rpx 32rpx;
  552 + .active {
  553 + background: rgba(129, 195, 191, 1);
  554 + border: 2rpx solid rgba(129, 195, 191, 1);
  555 + color: #fff;
  556 + }
  557 + }
  558 + .subject {
  559 + width: 28%;
  560 + height: 56rpx;
  561 + background: #fff;
  562 + border: 1rpx solid rgba(6, 18, 30, 1);
  563 + opacity: 1;
  564 + border-radius: 40rpx;
  565 + text-align: center;
  566 + line-height: 56rpx;
  567 + color: rgba(6, 18, 30, 1);
  568 + font-size: 28rpx;
  569 + margin-bottom: 36rpx;
  570 + }
  571 + }
  572 + }
545 } 573 }
546 -</style>  
  574 +</style>
@@ -72,7 +72,6 @@ @@ -72,7 +72,6 @@
72 72
73 wxGetUserInfo(e) { 73 wxGetUserInfo(e) {
74 let that = this; 74 let that = this;
75 - console.log(e)  
76 // type:1 高中生 2 大学生 75 // type:1 高中生 2 大学生
77 let type = e.currentTarget.dataset.type; 76 let type = e.currentTarget.dataset.type;
78 console.log(type) 77 console.log(type)
@@ -107,6 +106,7 @@ @@ -107,6 +106,7 @@
107 console.log(r) 106 console.log(r)
108 that.session_key = r.session_key; 107 that.session_key = r.session_key;
109 that.openid = r.openid; 108 that.openid = r.openid;
  109 +
110 console.log(that.session_key); 110 console.log(that.session_key);
111 console.log(that.openid) 111 console.log(that.openid)
112 112
@@ -132,7 +132,6 @@ @@ -132,7 +132,6 @@
132 encryptedData: that.encrypted_data, 132 encryptedData: that.encrypted_data,
133 iv: that.iv 133 iv: that.iv
134 } 134 }
135 - console.log(param)  
136 app.post(url, param, "get").then(r => { 135 app.post(url, param, "get").then(r => {
137 uni.setStorageSync('token', r.userInfo.token); 136 uni.setStorageSync('token', r.userInfo.token);
138 137
@@ -121,6 +121,9 @@ export default { @@ -121,6 +121,9 @@ export default {
121 text-align: center; 121 text-align: center;
122 margin-right: 14rpx; 122 margin-right: 14rpx;
123 margin-bottom: 16rpx; 123 margin-bottom: 16rpx;
  124 + overflow: hidden;
  125 + white-space: nowrap;
  126 + text-overflow: ellipsis;
124 } 127 }
125 } 128 }
126 } 129 }
@@ -174,6 +174,8 @@ export default { @@ -174,6 +174,8 @@ export default {
174 color:rgba(6,18,30,1); 174 color:rgba(6,18,30,1);
175 height: 100vh; 175 height: 100vh;
176 font-size: 28rpx; 176 font-size: 28rpx;
  177 + display: flex;
  178 + flex-direction: column;
177 // padding: 0 32rpx; 179 // padding: 0 32rpx;
178 .selectCity{ 180 .selectCity{
179 display: flex; 181 display: flex;
@@ -195,6 +197,9 @@ export default { @@ -195,6 +197,9 @@ export default {
195 .list{ 197 .list{
196 font-size: 28rpx; 198 font-size: 28rpx;
197 padding: 12rpx 32rpx; 199 padding: 12rpx 32rpx;
  200 + flex: 1;
  201 + margin-bottom: 100rpx;
  202 + overflow-y: scroll;
198 .item{ 203 .item{
199 padding: 28rpx 0; 204 padding: 28rpx 0;
200 border-bottom: 1rpx solid rgba(238,238,238,1); 205 border-bottom: 1rpx solid rgba(238,238,238,1);
@@ -170,6 +170,9 @@ export default { @@ -170,6 +170,9 @@ export default {
170 background:rgba(249,249,249,1); 170 background:rgba(249,249,249,1);
171 color:rgba(6,18,30,1); 171 color:rgba(6,18,30,1);
172 height: 100vh; 172 height: 100vh;
  173 + display: flex;
  174 + flex-direction: column;
  175 +
173 // padding: 0 32rpx; 176 // padding: 0 32rpx;
174 .selectCity{ 177 .selectCity{
175 display: flex; 178 display: flex;
@@ -191,6 +194,9 @@ export default { @@ -191,6 +194,9 @@ export default {
191 .list{ 194 .list{
192 font-size: 28rpx; 195 font-size: 28rpx;
193 padding: 12rpx 32rpx; 196 padding: 12rpx 32rpx;
  197 + box-sizing: border-box;
  198 + overflow-y: scroll;
  199 + margin-bottom: 100rpx;
194 .item{ 200 .item{
195 padding: 28rpx 0; 201 padding: 28rpx 0;
196 border-bottom: 1rpx solid rgba(238,238,238,1); 202 border-bottom: 1rpx solid rgba(238,238,238,1);
@@ -70,10 +70,12 @@ @@ -70,10 +70,12 @@
70 word:'', 70 word:'',
71 schoollist:[], 71 schoollist:[],
72 isnulldata:false, 72 isnulldata:false,
73 - token:'' 73 + token:'',
  74 + isRegister: 0,
74 } 75 }
75 }, 76 },
76 onLoad(options){ 77 onLoad(options){
  78 + this.code2Token();
77 this.token=uni.getStorageSync('token') 79 this.token=uni.getStorageSync('token')
78 console.log(options); 80 console.log(options);
79 // this.getschoollist(); 81 // this.getschoollist();
@@ -89,7 +91,22 @@ @@ -89,7 +91,22 @@
89 uni.redirectTo({ 91 uni.redirectTo({
90 url: url 92 url: url
91 }) 93 })
92 - 94 + },
  95 + code2Token(){
  96 + let that = this;
  97 + uni.login({
  98 + success(res) {
  99 + let url = 'common/codeToToken'
  100 + app.post(url,{
  101 + code: res.code
  102 + }).then(r=>{
  103 + console.log()
  104 + uni.setStorageSync('token',r.userInfo.token);
  105 + uni.setStorageSync('isRegister',r.userInfo.is_register);
  106 + that.isRegister = r.userInfo.is_register;
  107 + })
  108 + }
  109 + })
93 }, 110 },
94 111
95 // 获取大学列表 112 // 获取大学列表
@@ -167,9 +184,21 @@ @@ -167,9 +184,21 @@
167 }) 184 })
168 }, 1500); 185 }, 1500);
169 }else{ 186 }else{
170 - wx.navigateTo({  
171 - url:'./searchSchool'  
172 - }) 187 + if(this.isRegister == 0){
  188 + uni.showToast({
  189 + title: '请完善信息后操作',
  190 + icon: 'none'
  191 + })
  192 + setTimeout(() => {
  193 + uni.navigateTo({
  194 + url:'../register/register?istoken='+1
  195 + })
  196 + }, 1500);
  197 + }else{
  198 + wx.navigateTo({
  199 + url:'./searchSchool'
  200 + })
  201 + }
173 } 202 }
174 }, 203 },
175 204
1 <template> 1 <template>
2 - <view class="content">  
3 - <view class="top">  
4 - <view class="search">  
5 - <image class="icon" src="../../static/sousuo_icon@2x.png"></image>  
6 - <input type="text" placeholder="请输入搜索内容" class="input" placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;" style="font-size:28rpx;" v-model="word">  
7 - </view>  
8 - <view class="searchBtn" @click="getschoollist">搜索</view>  
9 - </view>  
10 - <view class="type">  
11 - <view class="paiming" :class="{'active':active1}" @click="paimingShow">排名</view>  
12 - <view class="diqu" :class="{'active':active2}" @click="diquShow">地区</view>  
13 - <view class="paimingPopup" v-if="isPaimingShow">  
14 - <view class="title" @click="selectalllevel">全部</view>  
15 - <view class="item" @click="paimingHide" v-for="(item,index) in levelList" :key="index">{{item.name}}</view>  
16 - <!-- <view class="item" @click="paimingHide">{{item.name}}</view> -->  
17 -  
18 - </view>  
19 - <view class="diquPopup" v-if="isDiquShow">  
20 - <view class="title" @click="selectallprovince">全部地区</view>  
21 - <view class="cont">  
22 - <view class="colum">  
23 - <view class="item" @click="selectprovince" v-for="(item,index) in provinceList" :key="index" :data-id="item.code">{{item.name}}</view>  
24 -  
25 - </view>  
26 - <view class="colum">  
27 - <view class="item" @click="selectcity" v-for="(item,index) in cityList" :key="index" :data-id="item.code">{{item.name}}</view>  
28 -  
29 - </view>  
30 -  
31 - </view>  
32 -  
33 - </view>  
34 - </view>  
35 -  
36 - <view class="contentBox">  
37 - <view class="item" v-for="(item,index) in schoolList" :key="index" @click="godetail(item)">  
38 - <view class="title">{{item.name}}</view>  
39 - <image class="icon" :src="item.icon_image"></image>  
40 - </view>  
41 - </view>  
42 -  
43 - </view> 2 + <view class="content">
  3 + <view class="conet_top">
  4 + <view class="top">
  5 + <view class="search">
  6 + <image class="icon" src="../../static/sousuo_icon@2x.png"></image>
  7 + <input
  8 + type="text"
  9 + placeholder="请输入搜索内容"
  10 + class="input"
  11 + placeholder-style="color:rgba(189,196,206,1);font-size:28rpx;"
  12 + style="font-size:28rpx;"
  13 + v-model="word"
  14 + />
  15 + </view>
  16 + <view class="searchBtn" @click="getschoollist">搜索</view>
  17 + </view>
  18 + <view class="type">
  19 + <view class="paiming" :class="{ active: active1 }" @click="paimingShow">排名</view>
  20 + <view class="diqu" :class="{ active: active2 }" @click="diquShow">地区</view>
  21 + <view class="paimingPopup" v-if="isPaimingShow">
  22 + <view class="title" @click="selectalllevel">全部</view>
  23 + <view class="item" @click="paimingHide" v-for="(item, index) in levelList" :key="index">{{ item.name }}</view>
  24 + <!-- <view class="item" @click="paimingHide">{{item.name}}</view> -->
  25 + </view>
  26 + <view class="diquPopup" v-if="isDiquShow">
  27 + <view class="title" @click="selectallprovince">全部地区</view>
  28 + <view class="cont">
  29 + <view class="colum">
  30 + <view class="item" @click="selectprovince" v-for="(item, index) in provinceList" :key="index" :data-id="item.code">{{ item.name }}</view>
  31 + </view>
  32 + <view class="colum">
  33 + <view class="item" @click="selectcity" v-for="(item, index) in cityList" :key="index" :data-id="item.code">{{ item.name }}</view>
  34 + </view>
  35 + </view>
  36 + </view>
  37 + </view>
  38 + </view>
  39 +
  40 + <view class="contentBox">
  41 + <view class="item" v-for="(item, index) in schoolList" :key="index" @click="godetail(item)">
  42 + <view class="title">{{ item.name }}</view>
  43 + <image class="icon" :src="item.icon_image"></image>
  44 + </view>
  45 + </view>
  46 + </view>
44 </template> 47 </template>
45 48
46 <script> 49 <script>
47 -import app from "../../App.vue"; 50 +import app from '../../App.vue';
48 51
49 export default { 52 export default {
50 - data(){  
51 - return{  
52 - isPaimingShow:false,  
53 - isDiquShow:false,  
54 - active1:false,  
55 - // isDiquShow:false,  
56 - active2:false,  
57 - province_id:"",  
58 - city_id:'',  
59 - level_id:'',  
60 - provinceList:[],  
61 - cityList:[],  
62 - schoolList:[],  
63 - word:'',  
64 - page:'1',  
65 - levelList:[]  
66 - }  
67 - },  
68 - methods:{  
69 - paimingShow(event){  
70 - this.isPaimingShow=true;  
71 - this.isDiquShow=false  
72 - this.active1=true,  
73 - this.active2=false  
74 -  
75 - },  
76 - paimingHide(){  
77 - this.isPaimingShow=false;  
78 - this.active1=false,  
79 - this.active2=false  
80 - },  
81 - diquShow(){  
82 - this.isDiquShow=true;  
83 - this.isPaimingShow=false;  
84 - this.active2=true,  
85 - this.active1=false  
86 -  
87 - },  
88 - diquHide(){  
89 - this.isDiquShow=false,  
90 - this.active1=false,  
91 - this.active2=false  
92 - },  
93 - //获取全部地区(省)  
94 - getAllProvince(){  
95 - var url ="city/getAllProvince"  
96 - var params ={}  
97 - app.post(url,params,"get").then((res)=>{  
98 - this.provinceList=res  
99 - console.log(res)  
100 - }).catch((err)=>{  
101 - console.log(err)  
102 - })  
103 - },  
104 -  
105 - //市  
106 - getAllCity(){  
107 - var url = "city/getCity"  
108 - var params = {  
109 - province_id:this.province_id  
110 - }  
111 - app.post(url,params,"get").then((res)=>{  
112 - console.log(res)  
113 - this.cityList=res  
114 - }).catch((err)=>{  
115 - console.log(err)  
116 - })  
117 - },  
118 - //点击选中的省  
119 - selectprovince(e){  
120 - this.province_id=e.currentTarget.dataset.id  
121 - this.getAllCity()  
122 -  
123 - },  
124 - //点击全部省  
125 - selectallprovince(){  
126 - this.getschoollist()  
127 - this.isDiquShow=false  
128 - },  
129 - //点击选中全部市  
130 - selectallcity(){  
131 - this.getschoollist()  
132 - this.isDiquShow=false  
133 -  
134 - },  
135 - //点击选中的市  
136 - selectcity(e){  
137 - this.city_id=e.currentTarget.dataset.id  
138 - this.getschoollist()  
139 - this.isDiquShow=false  
140 - },  
141 - // getAllSchool(){  
142 - // var url="city/getUniversityByCity"  
143 - // var params ={  
144 - // city_id:this.city_id  
145 - // }  
146 - // app.post(url,params,"get").then((res)=>{  
147 - // console.log(res)  
148 - // this.schoolList=res  
149 - // }).catch((err)=>{  
150 - // console.log(err)  
151 - // })  
152 - // },  
153 - // 获取大学列表  
154 - getschoollist(){  
155 - let that = this;  
156 - var url = 'university/getUniversityList';  
157 - var params = {  
158 - page:that.page,  
159 - size:10,  
160 - word:that.word,  
161 - level_id:that.level_id,  
162 - province_id:that.province_id  
163 - }  
164 - app.post(url, params,"post").then((res) => {  
165 - console.log(res);  
166 - that.schoolList=res  
167 -  
168 - }).catch((err) => {  
169 -  
170 - })  
171 - },  
172 - //获取全部排名  
173 - getAllLevel(){  
174 - let that = this;  
175 - var url = 'university/getUniversityLevel'  
176 - var params={}  
177 - app.post(url,params,"get").then((res)=>{  
178 - that.levelList=res  
179 -  
180 - }).catch((err)=>{  
181 - console.log(err)  
182 - })  
183 - },  
184 - //点击全部排名  
185 - selectalllevel(){  
186 - this.isPaimingShow=false  
187 - this.getschoollist() 53 + data() {
  54 + return {
  55 + isPaimingShow: false,
  56 + isDiquShow: false,
  57 + active1: false,
  58 + // isDiquShow:false,
  59 + active2: false,
  60 + province_id: '',
  61 + city_id: '',
  62 + level_id: '',
  63 + provinceList: [],
  64 + cityList: [],
  65 + schoolList: [],
  66 + word: '',
  67 + page: '1',
  68 + levelList: []
  69 + };
  70 + },
  71 + methods: {
  72 + paimingShow(event) {
  73 + this.isPaimingShow = true;
  74 + this.isDiquShow = false;
  75 + (this.active1 = true), (this.active2 = false);
  76 + },
  77 + paimingHide() {
  78 + this.isPaimingShow = false;
  79 + (this.active1 = false), (this.active2 = false);
  80 + },
  81 + diquShow() {
  82 + this.isDiquShow = true;
  83 + this.isPaimingShow = false;
  84 + (this.active2 = true), (this.active1 = false);
  85 + },
  86 + diquHide() {
  87 + (this.isDiquShow = false), (this.active1 = false), (this.active2 = false);
  88 + },
  89 + //获取全部地区(省)
  90 + getAllProvince() {
  91 + var url = 'city/getAllProvince';
  92 + var params = {};
  93 + app.post(url, params, 'get')
  94 + .then(res => {
  95 + this.provinceList = res;
  96 + console.log(res);
  97 + })
  98 + .catch(err => {
  99 + console.log(err);
  100 + });
  101 + },
188 102
189 - },  
190 - // 进入学校详情页  
191 - godetail(item){  
192 - let id=item.id; 103 + //市
  104 + getAllCity() {
  105 + var url = 'city/getCity';
  106 + var params = {
  107 + province_id: this.province_id
  108 + };
  109 + app.post(url, params, 'get')
  110 + .then(res => {
  111 + console.log(res);
  112 + this.cityList = res;
  113 + })
  114 + .catch(err => {
  115 + console.log(err);
  116 + });
  117 + },
  118 + //点击选中的省
  119 + selectprovince(e) {
  120 + this.province_id = e.currentTarget.dataset.id;
  121 + this.getAllCity();
  122 + },
  123 + //点击全部省
  124 + selectallprovince() {
  125 + this.getschoollist();
  126 + this.isDiquShow = false;
  127 + },
  128 + //点击选中全部市
  129 + selectallcity() {
  130 + this.getschoollist();
  131 + this.isDiquShow = false;
  132 + },
  133 + //点击选中的市
  134 + selectcity(e) {
  135 + this.city_id = e.currentTarget.dataset.id;
  136 + this.getschoollist();
  137 + this.isDiquShow = false;
  138 + },
  139 + // getAllSchool(){
  140 + // var url="city/getUniversityByCity"
  141 + // var params ={
  142 + // city_id:this.city_id
  143 + // }
  144 + // app.post(url,params,"get").then((res)=>{
  145 + // console.log(res)
  146 + // this.schoolList=res
  147 + // }).catch((err)=>{
  148 + // console.log(err)
  149 + // })
  150 + // },
  151 + // 获取大学列表
  152 + getschoollist() {
  153 + let that = this;
  154 + var url = 'university/getUniversityList';
  155 + var params = {
  156 + page: that.page,
  157 + size: 10,
  158 + word: that.word,
  159 + level_id: that.level_id,
  160 + province_id: that.province_id
  161 + };
  162 + app.post(url, params, 'post')
  163 + .then(res => {
  164 + console.log(res);
  165 + that.schoolList = res;
  166 + })
  167 + .catch(err => {});
  168 + },
  169 + //获取全部排名
  170 + getAllLevel() {
  171 + let that = this;
  172 + var url = 'university/getUniversityLevel';
  173 + var params = {};
  174 + app.post(url, params, 'get')
  175 + .then(res => {
  176 + that.levelList = res;
  177 + })
  178 + .catch(err => {
  179 + console.log(err);
  180 + });
  181 + },
  182 + //点击全部排名
  183 + selectalllevel() {
  184 + this.isPaimingShow = false;
  185 + this.getschoollist();
  186 + },
  187 + // 进入学校详情页
  188 + godetail(item) {
  189 + let id = item.id;
193 uni.navigateTo({ 190 uni.navigateTo({
194 - url:'./schoolDetails?id='+id  
195 - })  
196 - },  
197 -  
198 -  
199 - },  
200 - onLoad(){  
201 - this.getAllProvince()  
202 - this.getschoollist()  
203 - this.getAllLevel()  
204 - }  
205 -  
206 -} 191 + url: './schoolDetails?id=' + id
  192 + });
  193 + }
  194 + },
  195 + onLoad() {
  196 + this.getAllProvince();
  197 + this.getschoollist();
  198 + this.getAllLevel();
  199 + }
  200 +};
207 </script> 201 </script>
208 202
209 <style lang="less"> 203 <style lang="less">
210 -.content{  
211 - background-color: rgba(249,249,249,1);  
212 - .top{  
213 - padding: 18rpx 32rpx;  
214 - display: flex;  
215 - background-color: #fff;  
216 - }  
217 - .search{  
218 - // background-color: #fff;  
219 - display: flex;  
220 - // text-align: center;  
221 - align-items: center;  
222 - width:596rpx;  
223 - height:64rpx;  
224 - background:rgba(238,238,238,1);  
225 - opacity:1;  
226 - border-radius:40rpx;  
227 - padding: 0 28rpx;  
228 - box-sizing: border-box;  
229 - .icon{  
230 - width: 30rpx;  
231 - height: 30rpx;  
232 - }  
233 - .input{  
234 - height: 64rpx;  
235 - width: 500rpx;  
236 - text-align: center;  
237 - }  
238 -  
239 - }  
240 - .searchBtn{  
241 - color:rgba(6,18,30,1);  
242 - font-size: 28rpx;  
243 - line-height: 64rpx;  
244 - margin-left: 20rpx;  
245 - }  
246 - .type{  
247 - display: flex;  
248 - color:rgba(6,18,30,1);  
249 - font-size: 24rpx;  
250 - background-color: #fff;  
251 - padding: 24rpx 32rpx;  
252 - margin-top: 2rpx;  
253 - .paiming,.diqu{  
254 - margin-right: 72rpx;  
255 - }  
256 - .paimingPopup,.diquPopup{  
257 - width: 750rpx;  
258 - height: 600rpx;  
259 - position: absolute;  
260 - top: 184rpx;  
261 - left: 0;  
262 - background-color: #fff;  
263 - padding: 22rpx 32rpx;  
264 - box-sizing: border-box;  
265 - z-index: 999;  
266 - box-shadow:0px 4px 4px rgba(0,0,0,0.06);  
267 - border-top: 1rpx solid rgba(249,249,249,1);  
268 - .item{  
269 - margin-bottom: 22rpx;  
270 - // height: 74rpx;  
271 - width: 170rpx;  
272 - }  
273 - .title{  
274 - margin-bottom: 20rpx;  
275 - }  
276 - .cont{  
277 - display: flex;  
278 - // flex-direction: column;  
279 - flex-wrap: wrap;  
280 - justify-content: start;  
281 - .colum{  
282 - overflow: auto;  
283 - height: 500rpx;  
284 - width: 30%;  
285 - }  
286 - }  
287 - }  
288 - .active{  
289 - color: #05849D;  
290 - }  
291 - }  
292 - .contentBox{  
293 - padding: 24rpx 32rpx;  
294 - .item{  
295 - width:686rpx;  
296 - height:160rpx;  
297 - background:rgba(255,255,255,1);  
298 - opacity:1;  
299 - border-radius:8rpx;  
300 - display: flex;  
301 - font-size: 28rpx;  
302 - color:rgba(61,68,77,1);  
303 - justify-content: space-between;  
304 - padding: 0 40rpx;  
305 - box-sizing: border-box;  
306 - margin-bottom: 24rpx;  
307 - .title{  
308 - line-height: 160rpx;  
309 - }  
310 - .icon{  
311 - width: 120rpx;  
312 - height: 120rpx;  
313 - margin-top: 20rpx;  
314 - }  
315 - }  
316 - } 204 +page{
  205 + height: 100%;
  206 + width: 100%;
  207 +}
  208 +.content {
  209 + background-color: rgba(249, 249, 249, 1);
  210 + height: 100%;
  211 + display: flex;
  212 + flex-direction: column;
  213 + .top {
  214 + padding: 18rpx 32rpx;
  215 + display: flex;
  216 + background-color: #fff;
  217 + }
  218 + .search {
  219 + display: flex;
  220 + align-items: center;
  221 + width: 596rpx;
  222 + height: 64rpx;
  223 + background: rgba(238, 238, 238, 1);
  224 + opacity: 1;
  225 + border-radius: 40rpx;
  226 + padding: 0 28rpx;
  227 + box-sizing: border-box;
  228 + .icon {
  229 + width: 30rpx;
  230 + height: 30rpx;
  231 + }
  232 + .input {
  233 + height: 64rpx;
  234 + width: 500rpx;
  235 + text-align: center;
  236 + }
  237 + }
  238 + .searchBtn {
  239 + color: rgba(6, 18, 30, 1);
  240 + font-size: 28rpx;
  241 + line-height: 64rpx;
  242 + margin-left: 20rpx;
  243 + }
  244 + .type {
  245 + display: flex;
  246 + color: rgba(6, 18, 30, 1);
  247 + font-size: 24rpx;
  248 + background-color: #fff;
  249 + padding: 24rpx 32rpx;
  250 + margin-top: 2rpx;
  251 + .paiming,
  252 + .diqu {
  253 + margin-right: 72rpx;
  254 + }
  255 + .paimingPopup,
  256 + .diquPopup {
  257 + width: 750rpx;
  258 + height: 600rpx;
  259 + position: absolute;
  260 + top: 184rpx;
  261 + left: 0;
  262 + background-color: #fff;
  263 + padding: 22rpx 32rpx;
  264 + box-sizing: border-box;
  265 + z-index: 999;
  266 + box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.06);
  267 + border-top: 1rpx solid rgba(249, 249, 249, 1);
  268 + .item {
  269 + margin-bottom: 22rpx;
  270 + // height: 74rpx;
  271 + width: 170rpx;
  272 + }
  273 + .title {
  274 + margin-bottom: 20rpx;
  275 + }
  276 + .cont {
  277 + display: flex;
  278 + // flex-direction: column;
  279 + flex-wrap: wrap;
  280 + justify-content: start;
  281 + .colum {
  282 + overflow: auto;
  283 + height: 500rpx;
  284 + width: 30%;
  285 + }
  286 + }
  287 + }
  288 + .active {
  289 + color: #05849d;
  290 + }
  291 + }
  292 + .contentBox {
  293 + padding: 24rpx 32rpx;
  294 + box-sizing: border-box;
  295 + flex: 1;
  296 + overflow-y: scroll;
  297 + .item {
  298 + width: 686rpx;
  299 + height: 160rpx;
  300 + background: rgba(255, 255, 255, 1);
  301 + opacity: 1;
  302 + border-radius: 8rpx;
  303 + display: flex;
  304 + font-size: 28rpx;
  305 + color: rgba(61, 68, 77, 1);
  306 + justify-content: space-between;
  307 + padding: 0 40rpx;
  308 + box-sizing: border-box;
  309 + margin-bottom: 24rpx;
  310 + .title {
  311 + line-height: 160rpx;
  312 + }
  313 + .icon {
  314 + width: 120rpx;
  315 + height: 120rpx;
  316 + margin-top: 20rpx;
  317 + }
  318 + }
  319 + }
317 } 320 }
318 -</style>  
  321 +</style>
@@ -12,8 +12,6 @@ @@ -12,8 +12,6 @@
12 <!-- <view class="typeitem" @click="schoolShow" :class="{'active':active2}">学校</view> --> 12 <!-- <view class="typeitem" @click="schoolShow" :class="{'active':active2}">学校</view> -->
13 <view class="typeitem" @click="majorShow" :class="{'active':active3}">专业</view> 13 <view class="typeitem" @click="majorShow" :class="{'active':active3}">专业</view>
14 <view class="typeitem" @click="styleShow" :class="{'active':active4}">升学方式</view> 14 <view class="typeitem" @click="styleShow" :class="{'active':active4}">升学方式</view>
15 -  
16 -  
17 <view class="diquPopup" v-if="isDiquShow"> 15 <view class="diquPopup" v-if="isDiquShow">
18 16
19 <view class="cont"> 17 <view class="cont">
@@ -30,7 +28,6 @@ @@ -30,7 +28,6 @@
30 <view class="colum" style="overflow: auto;height: 600rpx;"> 28 <view class="colum" style="overflow: auto;height: 600rpx;">
31 <view class="title" @click="selectschool" :data-id="null">全部学校</view> 29 <view class="title" @click="selectschool" :data-id="null">全部学校</view>
32 <view class="item" @click="selectschool" v-for="(item,index) in schoolList" :key="index" :data-id="item.id">{{item.name}}</view> 30 <view class="item" @click="selectschool" v-for="(item,index) in schoolList" :key="index" :data-id="item.id">{{item.name}}</view>
33 -  
34 </view> 31 </view>
35 32
36 </view> 33 </view>
@@ -47,9 +44,7 @@ @@ -47,9 +44,7 @@
47 <view class="majorPopup" v-if="isMajorShow"> 44 <view class="majorPopup" v-if="isMajorShow">
48 <view class="cont" style="display:flex;flex-direction: column;overflow: auto;height: 600rpx;"> 45 <view class="cont" style="display:flex;flex-direction: column;overflow: auto;height: 600rpx;">
49 <view class="title" @click="selectgraduated" :data-id="null">全部</view> 46 <view class="title" @click="selectgraduated" :data-id="null">全部</view>
50 -  
51 <view class="item" style="width:330rpx" @click="selectgraduated" v-for="(item,index) in graduatedList" :key="index" :data-id="item.id">{{item.name}}</view> 47 <view class="item" style="width:330rpx" @click="selectgraduated" v-for="(item,index) in graduatedList" :key="index" :data-id="item.id">{{item.name}}</view>
52 -  
53 </view> 48 </view>
54 </view> 49 </view>
55 <view class="stylePopup" v-if="isStyleShow"> 50 <view class="stylePopup" v-if="isStyleShow">
@@ -169,7 +164,6 @@ data(){ @@ -169,7 +164,6 @@ data(){
169 page:'1', 164 page:'1',
170 size:'10', 165 size:'10',
171 word:'' 166 word:''
172 -  
173 }, 167 },
174 168
175 graduatedList:[], 169 graduatedList:[],
@@ -379,8 +373,11 @@ methods:{ @@ -379,8 +373,11 @@ methods:{
379 }, 373 },
380 //点击选中的省 374 //点击选中的省
381 selectprovince(e){ 375 selectprovince(e){
382 - this.province_id=e.currentTarget.dataset.id  
383 - this.getAllCity() 376 + if(this.province_id!=e.currentTarget.dataset.id){
  377 + this.province_id=e.currentTarget.dataset.id;
  378 + this.schoolList = [];
  379 + this.getAllCity()
  380 + }
384 381
385 }, 382 },
386 //点击全部省 383 //点击全部省
@@ -396,8 +393,13 @@ methods:{ @@ -396,8 +393,13 @@ methods:{
396 }, 393 },
397 //点击选中的市 394 //点击选中的市
398 selectcity(e){ 395 selectcity(e){
399 - this.city_id=e.currentTarget.dataset.id  
400 - this.getAllSchool() 396 + if(this.city_id!=e.currentTarget.dataset.id){
  397 + this.city_id=e.currentTarget.dataset.id
  398 + this.schoolList = [];
  399 + this.getAllSchool()
  400 + }
  401 +
  402 +
401 }, 403 },
402 todetile(e){ 404 todetile(e){
403 if(uni.getStorageSync('token')==''){ 405 if(uni.getStorageSync('token')==''){