From 162da8b1d1b3df9387cc9a3662216f02dd79a5bf Mon Sep 17 00:00:00 2001 From: xcw <727612669@qq.com> Date: Tue, 21 Mar 2023 09:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 4 +- components/dynamic-frame.vue | 11 ++-- components/swipers/swiper-pu.vue | 1 - pagesA/my-data/my-data.vue | 79 ++++++++++++++++++++++++---- pagesA/my-watch/my-watch.vue | 2 +- pagesB/course-list/course-list.vue | 2 +- pagesB/course-video/course-video.vue | 2 +- pagesB/play-video/play-video.nvue | 2 +- 8 files changed, 81 insertions(+), 22 deletions(-) diff --git a/App.vue b/App.vue index 51052ba..ebe08b3 100644 --- a/App.vue +++ b/App.vue @@ -5,8 +5,10 @@ projectname:'', // 项目名称 lat:'', // 公司地址维度 lng:'' ,// 公司地址经度 - hostapi:'https://chuanwujia.com' // 域名配置 + hostapi:'https://chuanwujia.com' ,// 域名配置 + hostapiQi:'http://qiniu.chuanwujia.com' //七牛云的域名 }, + // 优先于show方法 onLaunch: ()=> { toolAll.tools.currentContext(); diff --git a/components/dynamic-frame.vue b/components/dynamic-frame.vue index 5790a22..db0ad62 100644 --- a/components/dynamic-frame.vue +++ b/components/dynamic-frame.vue @@ -18,11 +18,12 @@ {{['','','已确认收货','支付成功','签到成功'][showType]}} - + - + + - + 关闭 @@ -62,13 +63,13 @@ }, methods:{ closePop(){ - if(this.showType==5 || this.showType ==6){ + if(this.showType==5 || this.showType ==6 || this.showType == 'nick_name'){ if(this.dynamicObj.content){ this.executeEv(); this.$emit('returnEv',this.dynamicObj); } else { if(this.tempText){ - this.$toolAll.tools.showToast(this.showType==5?'请输入真实姓名':'请输入电话号码') + this.$toolAll.tools.showToast(this.showType==5?'请输入':'请输入') } else { this.executeEv(); } diff --git a/components/swipers/swiper-pu.vue b/components/swipers/swiper-pu.vue index a927ff2..27971d9 100644 --- a/components/swipers/swiper-pu.vue +++ b/components/swipers/swiper-pu.vue @@ -126,7 +126,6 @@ changeBanner(e){ this.currentDot = e.detail.current;//当前的指示点下标 let videoIndex = e.detail.current; - console.log(videoIndex) //切换时要把视频暂停 uni.createVideoContext("video" + (videoIndex),this).pause(); }, diff --git a/pagesA/my-data/my-data.vue b/pagesA/my-data/my-data.vue index df8c62f..45f5509 100644 --- a/pagesA/my-data/my-data.vue +++ b/pagesA/my-data/my-data.vue @@ -3,18 +3,18 @@ - + 头像 - + - + 昵称 - {{userInfo.nickname}} - + {{userInfo.nickname || '未填写'}} + @@ -35,6 +35,7 @@ + @@ -48,35 +49,91 @@ data() { return { showType:5, + baseHttps:`${getApp().globalData.hostapiQi}`, //接口链接 tipsTitle:'真实姓名', + userInfo:{ + headimgurl:'', + nickname:'', + }, //用户信息 realName:'',//真实姓名字段 phone:'',//联系电话 - userInfo:'' } }, onLoad() { this.userInfo = uni.getStorageSync('userInfo'); - this.realName = this.userInfo.real_name; - this.phone = this.userInfo.mobile; + console.log(this.userInfo) }, methods: { + + + // 发起修改 chooseEv(index){ this.showType = index; - this.tipsTitle = index==5?'真实姓名':'电话号码'; - this.$refs.refFrame.ifLogistics = true; - this.$refs.refFrame.ifAnimated = true; if(this.showType==5){ + this.tipsTitle = index==5?'真实姓名':'电话号码'; + this.$refs.refFrame.ifLogistics = true; + this.$refs.refFrame.ifAnimated = true; this.$refs.refFrame.dynamicObj.content = this.realName || ''; this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.realName || '')); } if(this.showType==6){ + this.tipsTitle = index==5?'真实姓名':'电话号码'; + this.$refs.refFrame.ifLogistics = true; + this.$refs.refFrame.ifAnimated = true; + this.$refs.refFrame.dynamicObj.content = this.phone || ''; + this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.phone || '')); + } + + if(this.showType=='avatar'){ + uni.chooseImage({ + count: 1, //默认9 + sourceType: ['album','camera'], //从相册选择 + success: (res)=> { + // 上传图片 + this.uploadImg(res.tempFilePaths[0]); + } + }) + } + if(this.showType=='nick_name'){ + this.tipsTitle = '修改昵称'; + this.$refs.refFrame.ifLogistics = true; + this.$refs.refFrame.ifAnimated = true; this.$refs.refFrame.dynamicObj.content = this.phone || ''; this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.phone || '')); } }, + + // 头像上传 + uploadImg(url){ + uni.showLoading({ + title: '上传中' + }); + this.$requst.upload('/api/file/upload/image',{path:url}).then(res=>{ + if(res.code==0) { + // 确认修改 + this.returnEv(res.data.src) + } + uni.hideLoading(); + }) + }, //确认修改 returnEv(obj){ + console.log(obj) + if(this.showType=='avatar'){ + if(this.userInfo.avatarUrl!=obj){ + // 如果修改后的跟修改前的不一样 + this.setData('headimgurl',obj); + } + this.userInfo.headimgurl = this.baseHttps + obj; + } + if(this.showType=='nick_name'){ + if(this.userInfo.nickname!=obj.content){ + // 如果修改后的跟修改前的不一样 + this.setData('nickname',obj.content); + } + this.userInfo.nickname = obj.content; + } if(this.showType==5){ if(this.realName!=obj.content){ // 如果修改后的跟修改前的不一样 diff --git a/pagesA/my-watch/my-watch.vue b/pagesA/my-watch/my-watch.vue index 1fc13c4..84d8123 100644 --- a/pagesA/my-watch/my-watch.vue +++ b/pagesA/my-watch/my-watch.vue @@ -45,7 +45,7 @@ } }, onLoad() { - this.hostapi = getApp().globalData.hostapi; + this.hostapi = getApp().globalData.hostapiQi; // 获取课程列表 this.getCouresList(); }, diff --git a/pagesB/course-list/course-list.vue b/pagesB/course-list/course-list.vue index 693dd19..723efe2 100644 --- a/pagesB/course-list/course-list.vue +++ b/pagesB/course-list/course-list.vue @@ -46,7 +46,7 @@ }, onLoad(e) { this.course_id = e.id; - this.hostapi = getApp().globalData.hostapi; + this.hostapi = getApp().globalData.hostapiQi; // 获取课程列表 this.getCouresList(); }, diff --git a/pagesB/course-video/course-video.vue b/pagesB/course-video/course-video.vue index de37d63..3961cbd 100644 --- a/pagesB/course-video/course-video.vue +++ b/pagesB/course-video/course-video.vue @@ -75,7 +75,7 @@ } else { this.$store.commit('setFristIn',false); } - this.hostapi = getApp().globalData.hostapi; + this.hostapi = getApp().globalData.hostapiQi; this.course_video_id = op.id; // 获取课程详情 this.getCouresDetail(this.course_video_id); diff --git a/pagesB/play-video/play-video.nvue b/pagesB/play-video/play-video.nvue index 3c8b513..8b4e4c8 100644 --- a/pagesB/play-video/play-video.nvue +++ b/pagesB/play-video/play-video.nvue @@ -61,8 +61,8 @@ }, onUnload() { - console.log('页面销毁了') let course_video_id = this.videoList[this.currentIndex].course_video_id; + console.log(course_video_id,'页面销毁了') if(course_video_id) { let params = { course_video_id:course_video_id,