Browse Source

学员端

master
李双庆 1 year ago
parent
commit
015b5e6c43
  1. 7
      api/member.js
  2. 21
      pages/student/index/index.vue
  3. 8
      pages/student/my/my.vue
  4. 174
      pages/student/my/personal_data.vue
  5. 9
      pages/student/my/update_pass.vue

7
api/member.js

@ -35,4 +35,11 @@ export default {
return res; return res;
}) })
}, },
//修改学员信息
member_edit(data) {
let url = '/member/member_edit'
return http.post(url,data).then(res => {
return res;
})
},
} }

21
pages/student/index/index.vue

@ -5,9 +5,8 @@
</view> </view>
<view class="head"> <view class="head">
<view class="head-img"> <view class="head-img">
<fui-avatar width="136" <fui-avatar width="136" :src="$util.img(member_info.headimg)"></fui-avatar>
src="https://img1.baidu.com/it/u=3598104138,3632108415&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800"></fui-avatar> <view class="head-text">{{member_info.name}}</view>
<view class="head-text">智卓燕</view>
</view> </view>
</view> </view>
<view class="card"> <view class="card">
@ -111,7 +110,7 @@
</template> </template>
<script> <script>
// import user from '@/api/user.js'; import member from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
export default { export default {
components: { components: {
@ -119,13 +118,23 @@
}, },
data() { data() {
return { return {
member_info: [],
} }
}, },
onLoad() { onLoad() {
this.member_init()
}, },
methods: { methods: {
//
member_init() {
member.member().then(res => {
if(res.code == 1){
this.member_info = res.data
}else{
this.member_info = []
}
})
},
details() { details() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/student/index/work_details' url: '/pages/student/index/work_details'

8
pages/student/my/my.vue

@ -9,7 +9,7 @@
<view class="user_section"> <view class="user_section">
<view class="box"> <view class="box">
<view class="left" @click="personal_data"> <view class="left" @click="personal_data">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image> <image class="pic" :src="$util.img(member_info.headimg)"></image>
<view class="name">{{member_info.name}}</view> <view class="name">{{member_info.name}}</view>
</view> </view>
<view class="right" @click="setup"> <view class="right" @click="setup">
@ -24,15 +24,15 @@
<view class="course_box"> <view class="course_box">
<view class="top"> <view class="top">
<view class="item"> <view class="item">
<view class="num">123</view> <view class="num">{{member_info.classes_count}}</view>
<view class="intro">我的课程</view> <view class="intro">我的课程</view>
</view> </view>
<view class="item"> <view class="item">
<view class="num">45</view> <view class="num">{{member_info.sign_count}}</view>
<view class="intro">已上课时</view> <view class="intro">已上课时</view>
</view> </view>
<view class="item"> <view class="item">
<view class="num">45</view> <view class="num">{{member_info.stay_sign_count}}</view>
<view class="intro">待上课时 <view class="intro">待上课时
</view> </view>
</view> </view>

174
pages/student/my/personal_data.vue

@ -5,7 +5,9 @@
<view class="main_section"> <view class="main_section">
<view class="section"> <view class="section">
<view class="item"> <view class="item">
<image @click="changeAvatar()" class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image> <image @click="changeAvatar()" class="pic" :src="$util.img(formData.headimg)" v-if="upload_type == 1">
<image @click="changeAvatar()" class="pic" :src="uploadHeadimg" v-else>
</image>
<view class="btn" @click="changeAvatar()">修改头像</view> <view class="btn" @click="changeAvatar()">修改头像</view>
</view> </view>
</view> </view>
@ -13,7 +15,7 @@
<view class="section"> <view class="section">
<view class="item"> <view class="item">
<view class="title"> <view class="title">
姓名 <text class="required">*</text> 学员姓名 <text class="required">*</text>
</view> </view>
<view class="input"> <view class="input">
<input v-model="formData.name" placeholder="请输入姓名"/> <input v-model="formData.name" placeholder="请输入姓名"/>
@ -25,25 +27,25 @@
账号 <text class="required"></text> 账号 <text class="required"></text>
</view> </view>
<view class="input"> <view class="input">
<input disabled placeholder="暂无" /> <input disabled placeholder="暂无" v-model="formData.username"/>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="title"> <view class="title">
部门 <text class="required"></text> 住址 <text class="required"></text>
</view> </view>
<view class="input"> <view class="input">
<input disabled placeholder="暂无" /> <input placeholder="暂无" v-model="formData.address"/>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="title"> <view class="title">
等级 <text class="required"></text> 课程 <text class="required"></text>
</view> </view>
<view class="input"> <view class="input">
<input disabled placeholder="暂无" /> <input disabled placeholder="暂无" :value="formData.classes_list"/>
</view> </view>
</view> </view>
</view> </view>
@ -55,14 +57,8 @@
</view> </view>
<view class="input"> <view class="input">
<input placeholder="请选择性别" v-model="sex_name" @click="picker_show_sex=true" /> <input placeholder="请选择性别" v-model="sex_name" @click="picker_show_sex=true" />
<fui-picker <fui-picker layer="1" :linkage="true" :options="options_sex_arr" :show="picker_show_sex"
layer="1" @change="changePickerSex" @cancel="picker_sex_show=false"></fui-picker>
:linkage="true"
:options="options_sex_arr"
:show="picker_show_sex"
@change="changePickerSex"
@cancel="picker_sex_show=false"
></fui-picker>
</view> </view>
</view> </view>
@ -72,17 +68,13 @@
</view> </view>
<view class="input"> <view class="input">
<input placeholder="请选择生日" @click="picker_show_birthday=true" v-model="formData.birthday" /> <input placeholder="请选择生日" @click="picker_show_birthday=true" v-model="formData.birthday" />
<fui-date-picker <fui-date-picker :minDate="minDate" :maxDate="maxDate" :show="picker_show_birthday" type="3"
:minDate="minDate" @change="changePickerBirthday" @cancel="picker_show_birthday=false"></fui-date-picker>
:maxDate="maxDate" </view>
:show="picker_show_birthday"
type="3"
@change="changePickerBirthday"
@cancel="picker_show_birthday=false"
></fui-date-picker>
</view> </view>
</view> </view>
<view class="section">
<view class="item"> <view class="item">
<view class="title"> <view class="title">
邮箱 <text class="required">*</text> 邮箱 <text class="required">*</text>
@ -97,28 +89,22 @@
手机 <text class="required">*</text> 手机 <text class="required">*</text>
</view> </view>
<view class="input"> <view class="input">
<input v-model="formData.tel" placeholder="请输入手机" /> <input v-model="formData.mobile" placeholder="请输入手机" />
</view>
</view>
<view class="item">
<view class="title">
微信 <text class="required"></text>
</view>
<view class="input">
<input v-model="formData.wx" placeholder="请输入微信" />
</view> </view>
</view> </view>
</view> </view>
<view class="submet_btn">提交</view>
<view class="submet_btn" @click="submit">提交</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// import user from '@/api/user.js'; import member from '@/api/member.js';
import {Api_url} from "@/common/config.js"; import {
Api_url
} from "@/common/config.js";
import AQTabber from "@/components/AQ/AQTabber" import AQTabber from "@/components/AQ/AQTabber"
@ -128,6 +114,7 @@ export default {
}, },
data() { data() {
return { return {
member_info: [],
formData: { formData: {
images_arr: [], images_arr: [],
name: '', // name: '', //
@ -139,26 +126,36 @@ export default {
}, },
//APi //APi
uploadUrl: `${Api_url}/salesmanapi/common/uploadFile`, uploadUrl: `${Api_url}/file/image`,
// //
picker_show_sex: false, picker_show_sex: false,
sex_name: '请选择', sex_name: '请选择',
options_sex_arr:[ options_sex_arr: [{
{ value: 1, text: '男' }, value: 0,
{ value: 2, text: '女' }, text: '保密'
},{
value: 1,
text: '男'
},
{
value: 2,
text: '女'
},
], ],
// //
minDate: '', minDate: '',
maxDate: '', maxDate: '',
picker_show_birthday: false, picker_show_birthday: false,
upload_type: 1,
uploadHeadimg: '',
} }
}, },
onLoad() { onLoad() {},
},
onShow() { onShow() {
this.init() this.init()
this.member_init()
}, },
methods: { methods: {
@ -166,6 +163,25 @@ export default {
this.getBirthday() this.getBirthday()
}, },
//
member_init() {
member.member().then(res => {
if(res.code == 1){
this.member_info = res.data
this.formData = {...this.member_info}
if(res.data.sex == 0){
this.sex_name = '保密'
}else if(this.formData.sex == 1){
this.sex_name = '男'
}else if(this.formData.sex == 2){
this.sex_name = '女'
}
}else{
this.member_info = []
}
})
},
// //
changeAvatar() { changeAvatar() {
uni.chooseImage({ uni.chooseImage({
@ -180,48 +196,36 @@ export default {
}) })
}, },
async uploadFilePromise(url) { async uploadFilePromise(url) {
console.log('AQ',this.uploadUrl,url) let token = uni.getStorageSync('token') || ''
console.log(token,'AQ', this.uploadUrl, this.$store.state.token)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: this.uploadUrl, // url: this.uploadUrl, //
filePath: url, filePath: url,
name: "file", name: 'file',
formData: { header: {
token: this.$store.state.token, 'token': `${token}`,//token
}, },
success: (e) => { success: (e) => {
console.log('上传成功1',e)
let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}") let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}")
console.log('上传成功2', res) console.log('上传成功2', res)
if (res.code >= 0){ if (res.code == 1) {
this.userInfo.pic = res.data.pic_path this.upload_type = 2
this.editPic(res.data.pic_path) this.formData.headimg = res.data.path
this.uploadHeadimg = res.data.url
} else { } else {
this.$util.showToast({ uni.showToast({
title: res.message title: res.msg,
}); icon: 'none'
})
} }
setTimeout(() => { setTimeout(() => {
resolve(res.data.data); resolve(res.data);
}, 1000); }, 1000);
}, },
}); });
}); });
}, },
//Api
async editPic(pic) {
let res = await salesmanApi.editPic({pic: pic})
if (res.code >= 0) {
this.$util.showToast({
title: '修改成功'
})
} else {
this.$util.showToast({
title: res.message
})
}
},
// //
changePickerSex(e) { changePickerSex(e) {
console.log('监听选择', e) console.log('监听选择', e)
@ -277,12 +281,36 @@ export default {
this.picker_show_birthday = false this.picker_show_birthday = false
}, },
//
submit(){
member.member_edit({
header: this.formData.headimg,
name: this.formData.name,
address: this.formData.address,
gender: this.formData.sex,
birthday: this.formData.birthday,
email: this.formData.email,
phone: this.formData.mobile,
}).then(res => {
if(res.code == 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.main_box { .main_box {
background: #292929; background: #292929;
} }
@ -293,6 +321,7 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: #29d3b4; background: #29d3b4;
.title { .title {
padding: 20rpx 0; padding: 20rpx 0;
font-size: 30rpx; font-size: 30rpx;
@ -314,16 +343,19 @@ export default {
.section { .section {
background-color: #434544; background-color: #434544;
.item { .item {
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.pic { .pic {
width: 82rpx; width: 82rpx;
height: 82rpx; height: 82rpx;
border-radius: 50%; border-radius: 50%;
} }
.btn {} .btn {}
.title { .title {
@ -331,11 +363,13 @@ export default {
align-items: center; align-items: center;
font-size: 26rpx; font-size: 26rpx;
color: #D7D7D7; color: #D7D7D7;
.required { .required {
margin-left: 10rpx; margin-left: 10rpx;
color: red; color: red;
} }
} }
.input { .input {
input { input {
text-align: right; text-align: right;
@ -360,6 +394,4 @@ export default {
} }
</style> </style>

9
pages/student/my/update_pass.vue

@ -11,18 +11,15 @@
为保障您的账号安全修改密码前请填写原密码 为保障您的账号安全修改密码前请填写原密码
</view> </view>
<view style="width: 95%;margin:30rpx auto;"> <view style="width: 95%;margin:30rpx auto;">
<fui-input borderTop placeholder="请输入原登录密码" v-model="password" @input="input" <fui-input borderTop placeholder="请输入原登录密码" v-model="password" backgroundColor="#f2f2f2"></fui-input>
backgroundColor="#f2f2f2"></fui-input>
</view> </view>
</view> </view>
<view v-if="tset_style == 2"> <view v-if="tset_style == 2">
<view style="width: 95%;margin:30rpx auto;"> <view style="width: 95%;margin:30rpx auto;">
<fui-input borderTop placeholder="请设置6-20位新的登录密码" v-model="passwords" @input="input" <fui-input borderTop placeholder="请设置6-20位新的登录密码" v-model="passwords" backgroundColor="#f2f2f2"></fui-input>
backgroundColor="#f2f2f2"></fui-input>
</view> </view>
<view style="width: 95%;margin: auto;"> <view style="width: 95%;margin: auto;">
<fui-input borderTop :padding="['20rpx','32rpx']" v-model="old_password" placeholder="请再次输入新的登录密码" <fui-input borderTop :padding="['20rpx','32rpx']" v-model="old_password" placeholder="请再次输入新的登录密码" backgroundColor="#f2f2f2">
@input="input" backgroundColor="#f2f2f2">
</fui-input> </fui-input>
</view> </view>
</view> </view>

Loading…
Cancel
Save