From 75e8859ce8f31eba1c7e9621175ed51d71456d84 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 13 Sep 2024 15:03:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/my/index.vue | 215 ++++++++++++++++++---- packages/mycourse/courseTxl.vue | 304 ++++++++++++++++++++++++-------- packages/register/index.vue | 301 ++++++++++++++++++++++++------- packages/register/login.vue | 16 +- packages/schoolmate/index.vue | 255 ++++++++++++++++++++++----- 5 files changed, 878 insertions(+), 213 deletions(-) diff --git a/packages/my/index.vue b/packages/my/index.vue index 380d95a..6f22acb 100644 --- a/packages/my/index.vue +++ b/packages/my/index.vue @@ -10,7 +10,11 @@ {{form.sex}} - + + + + {{form.mobile?'修改':'绑定'}} + @@ -25,8 +29,7 @@ - + @@ -48,9 +51,6 @@ 提交 - - 绑定车牌号 @@ -64,6 +64,30 @@ + + + + 联系方式 + + + + + 确定 + + + @@ -78,14 +102,30 @@ }, data() { return { - showPosition: false, - positionList: [], + showMobile: false, + myMobile: '', + myCode: '', + hasSend: false, + sendTimer: null, + count: 60, + inputStyle: { + 'padding': '0rpx 30rpx', + 'height': '80rpx', + 'border': '1rpx solid #dad8d8;', + 'border-radius': '20rpx' + }, + inputSendStyle: { + 'padding': '0rpx 30rpx', + 'height': '80rpx', + 'border': '1rpx solid #dad8d8;', + 'border-radius': '20rpx 0 0 20rpx' + }, form: { }, plateList: [], - showPark: false, - isLocked:false, + showPark: false, + isLocked: false, plate1: '', plateNumber: ['苏', 'E', '', '', '', '', ''], rules: { @@ -113,11 +153,11 @@ trigger: ['blur'], }], email: [{ - validator: (rule, value, callback) => { - if (!this.base.isNull(value)) { - return this.$u.test.email(value); - } else { - return true + validator: (rule, value, callback) => { + if (!this.base.isNull(value)) { + return this.$u.test.email(value); + } else { + return true } }, message: '邮箱不正确', @@ -132,19 +172,82 @@ onShow() { this.getUserInfo() }, - onLoad() { - this.getPosition() + onLoad() {}, + onUnload() { + if (this.sendTimer) { + clearInterval(this.sendTimer); + this.sendTimer = null + } + }, + onHide() { + if (this.sendTimer) { + clearInterval(this.sendTimer); + this.sendTimer = null + } }, methods: { - selectPosition(e) { - this.form.company_position = this.positionList[e[0]]['value'] - + addMobile() { + this.myMobile = this.form.mobile + this.showMobile = true }, - getPosition() { - this.$u.api.getparameter({ - number: 'company_position' + getSmsCode() { + if (this.hasSend) { + return + } + if (this.base.isNull(this.myMobile)) { + this.base.toast('手机号码不能为空') + return + } + if (!this.base.isMobile(this.myMobile)) { + this.base.toast('手机号码错误') + return + } + if (this.myMobile == this.form.mobile && !this.base.isNull(this.form.mobile)) { + this.base.toast('请输入需要变更的手机号码') + return + } + let that = this + this.$u.api.sendSms({ + mobile: this.myMobile }).then(res => { - this.positionList = res.detail + this.base.toast("发送成功") + this.hasSend = true + this.sendTimer = setInterval(function() { + if (that.count > 1) { + that.count-- + } else { + clearInterval(that.sendTimer); + that.sendTimer = null + that.count = 60 + that.hasSend = false; + } + }, 1000) + }) + }, + changeMobile() { + if (this.base.isNull(this.myMobile)) { + this.base.toast('请输入手机号') + return + } + if (this.base.isNull(this.myCode)) { + this.base.toast('请输入验证码') + return + } + let that = this + this.$u.api.bindMobile({ + mobile: this.myMobile, + code: this.myCode, + is_bind: 1 + }).then(res => { + this.base.toast('更改成功', 1500, function() { + that.myMobile = '' + that.myCode = '' + that.showMobile = false + setTimeout(function() { + that.getUserInfo() + }, 1500) + }) + }) }, getUserInfo() { @@ -159,11 +262,11 @@ this.plateList.splice(index, 1) } }) - } + } this.isLocked = false this.$u.vuex('vuex_user', res.user) - }).catch(res=>{ - this.isLocked = false + }).catch(res => { + this.isLocked = false }) }, addPlate() { @@ -177,9 +280,6 @@ delPlate(index) { this.plateList.splice(index, 1) this.saveUser('del') - }, - changeMobile() { - }, plateChange(val) { this.plate1 = val.join('') @@ -204,14 +304,14 @@ if (type == 'del') { this.form.plate = this.plateList.join(",") } - console.log("plateList", this.plateList) + console.log("plateList", this.plateList) let that = this this.$refs.uForm.validate(valid => { - if (valid) { - if(this.isLocked){ - return - } + if (valid) { + if (this.isLocked) { + return + } this.isLocked = true this.$u.api.saveUser(this.form).then(res => { this.showPark = false @@ -239,8 +339,8 @@ }) - }).catch(err=>{ - this.isLocked = false + }).catch(err => { + this.isLocked = false }) } else { console.log('验证失败'); @@ -308,5 +408,46 @@ padding: 0 30rpx; } } + + .login-form { + margin: 100rpx 50rpx; + + &>view { + border-radius: 20rpx; + + &:first-child { + margin-bottom: 50rpx; + } + } + + .sendmsg { + display: flex; + justify-content: space-between; + align-items: center; + + u-input { + width: calc(100% - 200rpx); + + } + + .send { + background: #c69c6d; + color: #fff; + height: 80rpx; + line-height: 80rpx; + border-radius: 0 20rpx 20rpx 0; + width: 200rpx; + text-align: center; + border: 1px solid #c69c6d; + box-sizing: content-box; + } + + .hasSend { + background: #dad8d8; + color: #333; + border: 1px solid #dad8d8; + } + } + } } \ No newline at end of file diff --git a/packages/mycourse/courseTxl.vue b/packages/mycourse/courseTxl.vue index 5d045b9..d718cd6 100644 --- a/packages/mycourse/courseTxl.vue +++ b/packages/mycourse/courseTxl.vue @@ -15,7 +15,7 @@ 班主任 - + {{tea.mobile?tea.mobile:''}} @@ -24,38 +24,48 @@ 如需学员联系方式,请联系班主任 - - - - - - - - - - {{item.name}} - {{item.course_signs[0]['position']}} + + 按照姓名首字母顺序排列,排名不分先后 + + + + + + + + + + {{mess.name}} + {{mess.position}} + + + + {{mess['company_name']||''}} + + + {{mess['company_position']||''}} + - {{item.company_name?item.company_name:''}} - {{item.company_position?item.company_position:''}} - {{item.mobile?item.mobile:''}} - - + + + + + + + + All + + {{item}} + + - - - - - - @@ -68,48 +78,102 @@ }, data() { return { + course_id: '', list: [], teacher: [], studentList: [], show_mobile: false, + current_page: 1, + total_page: 0, + hasData: true, + letter: '', + letterList: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", + "T", "U", "V", "W", "X", "Y", "Z" + ] + } }, onLoad(options) { let that = this this.show_mobile = options.show_mobile == 1 ? true : false - + this.course_id = options.id console.log("this.$refs.txllist", options.show_mobile, this.show_mobile, this.$refs.txllist) - this.$nextTick(function() { - that.$refs.txllist.setShowMobile(options.show_mobile) - }) + // this.$nextTick(function() { + // that.$refs.txllist.setShowMobile(options.show_mobile) + // }) + this.getMyTeachers(options.id) this.getMyCourseTxl(options.id) }, methods: { + scrollGet() { + if (!this.hasData) { + return + } + + if (this.current_page > this.total_page) { + this.base.toast('没有更多了') + return + } + this.current_page = this.current_page + 1 + this.getMyCourseTxl() + }, + changeLetter(e) { + if (e === 'All') { + this.letter = '' + } else { + this.letter = e + } + this.current_page = 1 + this.total_page = 0 + this.hasData = true + this.list = [] + this.getMyCourseTxl() + }, async getMyCourseTxl(id) { + uni.showLoading({ + title: "...", + icon: 'none' + }) const res = await this.$u.api.courseUserList({ - course_id: id, - type: 2 + course_id: this.course_id, + type: 2, + page: this.current_page, + letter: this.letter }) - let _student = [] - let _other = [] - res.list.map(item => { - if (item.course_signs && item.course_signs.length > 0) { - if (!this.base.isNull(item.course_signs[0]['position'])) { - _student.push(item) - } else { - _other.push(item) - } - } else { - _other.push(item) - } + this.total_page = res.list.last_page + + if (res.list.data.length === 0 && this.current_page === 1) { + this.hasData = false + } + this.list.push(...res.list.data) + console.log("qwe", this.list) + uni.hideLoading() + // let _student = [] + // let _other = [] + // res.list.data.map(item => { + // if (item.course_signs && item.course_signs.length > 0) { + // if (!this.base.isNull(item.course_signs[0]['position'])) { + // _student.push(item) + // } else { + // _other.push(item) + // } + // } else { + // _other.push(item) + // } + // }) + // this.studentList = _student + // this.list = _other + }, + async getMyTeachers(id) { + const res = await this.$u.api.courseUserList({ + course_id: this.course_id, + type: 2 }) - this.studentList = _student - this.list = _other this.teacher = res.teacher }, - callPhone(phoneNumber) { - if(this.base.isNull(phoneNumber)){ - return + callPhone(phoneNumber) { + if (this.base.isNull(phoneNumber)) { + return } uni.makePhoneCall({ phoneNumber: phoneNumber, // 电话号码 @@ -128,7 +192,7 @@ \ No newline at end of file diff --git a/packages/register/index.vue b/packages/register/index.vue index ba25acc..1016eee 100644 --- a/packages/register/index.vue +++ b/packages/register/index.vue @@ -1,6 +1,6 @@ @@ -36,18 +68,37 @@ export default { data() { return { - course_id:null, - showSex: false, - showPosition:false, - positionList:[], - dateShow:false, - dateParams: { - year: true, - month: true, - day: true, - hour: false, - minute: false, - second: false + showMobile: false, + myMobile:'', + myCode: '', + hasSend: false, + sendTimer: null, + count: 60, + inputStyle: { + 'padding': '0rpx 30rpx', + 'height': '80rpx', + 'border': '1rpx solid #dad8d8;', + 'border-radius': '20rpx' + }, + inputSendStyle: { + 'padding': '0rpx 30rpx', + 'height': '80rpx', + 'border': '1rpx solid #dad8d8;', + 'border-radius': '20rpx 0 0 20rpx' + }, + + + + course_id: null, + showSex: false, + dateShow: false, + dateParams: { + year: true, + month: true, + day: true, + hour: false, + minute: false, + second: false }, form: { username: '', @@ -69,7 +120,7 @@ sex: [{ required: true, message: '请选择性别', - trigger: ['change','blur'], + trigger: ['change', 'blur'], }], mobile: [{ required: true, @@ -81,13 +132,13 @@ }, message: '手机号码不正确', trigger: ['blur'], - }], - // email: [{ - // validator: (rule, value, callback) => { - // return this.$u.test.email(value); - // }, - // message: '邮箱不正确', - // trigger: ['blur'], + }], + // email: [{ + // validator: (rule, value, callback) => { + // return this.$u.test.email(value); + // }, + // message: '邮箱不正确', + // trigger: ['blur'], // }], } @@ -96,43 +147,113 @@ onReady() { this.$refs.uForm.setRules(this.rules); }, - onLoad(options) { - this.course_id = options.id?options.id:null + onLoad(options) { + this.course_id = options.id ? options.id : null }, - methods: { - selectSex(e) { - this.form.sex = this.sexList[e[0]]['value'] + onUnload() { + if (this.sendTimer) { + clearInterval(this.sendTimer); + this.sendTimer = null + } + }, + onHide() { + if (this.sendTimer) { + clearInterval(this.sendTimer); + this.sendTimer = null + } + }, + methods: { + addMobile() { + // this.myMobile = this.form.mobile + this.showMobile = true }, - // 日期 - dateConfirm(e) { - this.form.birthday = e.year + '-' + e.month + '-' + e.day + getSmsCode() { + if (this.hasSend) { + return + } + if (this.base.isNull(this.myMobile)) { + this.base.toast('手机号码不能为空') + return + } + if (!this.base.isMobile(this.myMobile)) { + this.base.toast('手机号码错误') + return + } + let that = this + this.$u.api.sendSms({ + mobile: this.myMobile + }).then(res => { + this.base.toast("发送成功") + this.hasSend = true + this.sendTimer = setInterval(function() { + if (that.count > 1) { + that.count-- + } else { + clearInterval(that.sendTimer); + that.sendTimer = null + that.count = 60 + that.hasSend = false; + } + }, 1000) + }) }, - - saveUser() { + changeMobile() { + if (this.base.isNull(this.myMobile)) { + this.base.toast('请输入手机号') + return + } + if (this.base.isNull(this.myCode)) { + this.base.toast('请输入验证码') + return + } + let that = this + this.$u.api.bindMobile({ + mobile: this.myMobile, + code: this.myCode, + is_bind: 1 + }).then(res => { + this.base.toast('绑定成功') + this.form.mobile = this.myMobile + // that.myMobile = '' + this.myCode = '' + this.showMobile = false + + }) + }, + selectSex(e) { + this.form.sex = this.sexList[e[0]]['value'] + }, + // 日期 + dateConfirm(e) { + this.form.birthday = e.year + '-' + e.month + '-' + e.day + }, + + saveUser() { let that = this this.$refs.uForm.validate(valid => { - if (valid) { + if (valid) { this.form.name = this.form.username this.$u.api.saveUser(this.form).then(res => { this.$u.api.user().then(res => { - this.$u.vuex('vuex_user', res.user) - this.base.toast("注册成功",2000,function(){ - console.log("that.course_id",that.course_id) - if(that.course_id){ - uni.redirectTo({ - url:'/packages/course/detail?id='+that.course_id - }) - // uni.redirectTo({ - // url:'/pages/course/index' - // }) - }else{ - uni.switchTab({ - url: '/pages/me/index' - }) - } - }) - - + this.$u.vuex('vuex_user', res.user) + this.base.toast("注册成功", 2000, function() { + console.log("that.course_id", that.course_id) + if (that.course_id) { + uni.redirectTo({ + url: '/packages/course/detail?id=' + + that.course_id + }) + // uni.redirectTo({ + // url:'/pages/course/index' + // }) + } else { + uni.switchTab({ + url: '/pages/me/index' + }) + } + }) + + }) }) } else { @@ -151,6 +272,7 @@ padding: 30rpx; height: 100vh; overflow: scroll; + .cbg { position: absolute; top: 0; @@ -181,6 +303,63 @@ border-radius: 30rpx; padding: 20rpx; } + } + .modal { + ::v-deep .u-drawer-bottom { + border-radius: 40rpx; + } + + &-tip { + text-align: center; + padding: 30rpx; + font-size: 32rpx; + } + + &-content { + // height: 400rpx; + padding: 0 30rpx; + } + } + + .login-form { + margin: 100rpx 50rpx; + + &>view { + border-radius: 20rpx; + + &:first-child { + margin-bottom: 50rpx; + } + } + + .sendmsg { + display: flex; + justify-content: space-between; + align-items: center; + + u-input { + width: calc(100% - 200rpx); + + } + + .send { + background: #c69c6d; + color: #fff; + height: 80rpx; + line-height: 80rpx; + border-radius: 0 20rpx 20rpx 0; + width: 200rpx; + text-align: center; + border: 1px solid #c69c6d; + box-sizing: content-box; + } + + .hasSend { + background: #dad8d8; + color: #333; + border: 1px solid #dad8d8; + } + } } } diff --git a/packages/register/login.vue b/packages/register/login.vue index dc033dd..ebfc4c5 100644 --- a/packages/register/login.vue +++ b/packages/register/login.vue @@ -51,6 +51,18 @@ }, onLoad(options) { this.type=options.id?'course':'me' + }, + onUnload() { + if(this.sendTimer){ + clearInterval(this.sendTimer); + this.sendTimer = null + } + }, + onHide() { + if(this.sendTimer){ + clearInterval(this.sendTimer); + this.sendTimer = null + } }, methods: { getSmsCode() { @@ -75,7 +87,9 @@ if (that.count > 1) { that.count-- } else { - clearInterval(that.sendTimer); + clearInterval(that.sendTimer); + that.sendTimer = null + that.count = 60 that.hasSend = false; } }, 1000) diff --git a/packages/schoolmate/index.vue b/packages/schoolmate/index.vue index 1a5cf2e..728b880 100644 --- a/packages/schoolmate/index.vue +++ b/packages/schoolmate/index.vue @@ -1,27 +1,55 @@