collegegerencenter.vue
8.9 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<template>
<view class="content">
<view class="card">
<view class="item">
<view class="name">姓名</view>
<input v-model="username" type="text" class="cont" :placeholder="userinfolist.nickname=='undefinde'? '' : userinfolist.nickname" placeholder-style="text-align: right;font-size:28rpx;" style="width:146rpx;text-align: right">
<!-- <view class="cont">爱学习的王笑笑</view> -->
</view>
<!-- <view class="item">
<view class="name">邮箱</view>
<input v-model="email" type="text" class="cont" placeholder="{{userinfolist.email}}" placeholder-style="text-align: right;font-size:28rpx;" style="width:220rpx;text-align: right">
</view> -->
<view class="item" style="border:none">
<view class="name">头像</view>
<image class="photo" @click="upload" :src="isUpload ? image : userinfolist.head_image"></image>
</view>
</view>
<view class="title">高中信息</view>
<view class="card">
<view class="item">
<view class="name">高中</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.school_info.name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">毕业年份</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.endtime}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">高考学科</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
语数外
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">选考科目</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.subject_list[0].name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">升学方式</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.up_info.name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
</view>
<view class="title">大学信息</view>
<view class="card">
<view class="item">
<view class="name">就读大学</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.university_info.name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">所属学院</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.college_info.name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
<view class="item">
<view class="name">就读专业</view>
<!-- <input type="text" class="cont" placeholder="爱学习的王笑笑" placeholder-style="text-align: right;font-size:28rpx;color:#BDC4CE" style="width:200rpx"> -->
<view class="cont">
{{userinfolist.graduated_info.name}}
<image class="icon" src="../../static/dizhi_btn@2x2.png"></image>
</view>
</view>
</view>
<view class="btn" @click="update">保存</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data(){
return{
username:'',
image:'',
image2:'',
isUpload:false,
userinfolist:[],
school_id:'',
name:'',
email:'',
date: '2020',
isDateShow:false
}
},
methods:{
getuserinfo(){
var that = this
var url = "student/getMyInfo"
var token = uni.getStorageSync('token')
var params = {
token:token
}
app.post(url,params,"get").then((res)=>{
console.log(res)
that.userinfolist=res
}).catch((err)=>{
console.log(err)
})
},
upload(){
var that = this;
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
const tempFilePaths = res.tempFilePaths;
that.image = tempFilePaths[0];
app.upload('image',res.tempFilePaths[0],"post").then((res)=>{
// let newimage=that.image
that.image=app.globalData.imageBaseUrl+res.url
that.image2=res.url
console.log(res)
console.log(that.image)
console.log(res.url)
// newimage.push(res.url)
that.isUpload=true
}).catch((err)=>{
console.log(err)
})
// console.log("tempFilePaths[0]",tempFilePaths[0]) //能够打印出选中的图片
// console.log(res)
// that.head_image=tempFilePaths[0]
// that.iconcheck = 1;//点击后图片更改状态由0变成1
},
error : function(e){
console.log(e);
}
});
},
bindTimeChange(e){
this.date = e.target.value
},
update(){
var that = this
var url = "student/updateStudentInfo"
var token = uni.getStorageSync('token')
var params= {
token:token,
nickname:that.username=='' ? that.userinfolist.nickname : that.username,
head_image:that.image2=='' ? that.userinfolist.head_image : that.image2
}
app.post(url,params,"post").then((res)=>{
console.log(res)
res.head_image=that.image
res.nickname=that.username
uni.showToast({
title:'个人信息保存成功',
icon:'none'
})
setTimeout(() => {
uni.navigateBack()
},1500);
}).catch((err)=>{
console.log(err)
if(err.code==0){
uni.showToast({
title:err.msg,
icon:'none'
})
}
})
}
},
onLoad(){
this.getuserinfo()
}
}
</script>
<style lang="less">
.content{
background-color: rgba(249,249,249,1);
padding: 32rpx 32rpx 40rpx;
// height: 100vh;
.card{
width:686rpx;
// height:428rpx;
background:rgba(255,255,255,1);
opacity:1;
border-radius:20rpx;
margin: 0 auto;
.item{
width: 622rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 0;
box-sizing: border-box;
font-size: 28rpx;
margin: 0 auto;
border-bottom: 1rpx solid rgba(238,238,238,1);
.cont{
display: flex;
align-items: center;
}
.photo{
width: 64rpx;
height: 64rpx;
border-radius: 50%;
}
.icon{
width: 11rpx;
height: 22rpx;
margin-left: 12rpx;
}
}
}
.title{
color:rgba(45,85,117,1);
font-size: 32rpx;
margin-top: 44rpx;
margin-bottom: 12rpx;
}
.btn{
width:684rpx;
height:80rpx;
background:rgba(45,85,117,1);
opacity:1;
border-radius:8rpx;
color: #fff;
line-height: 80rpx;
text-align: center;
margin: 0 auto;
margin-top: 66rpx;
}
}
</style>