正在显示
12 个修改的文件
包含
2409 行增加
和
776 行删除
@@ -29,11 +29,14 @@ | @@ -29,11 +29,14 @@ | ||
29 | //返回取得的数据 | 29 | //返回取得的数据 |
30 | if (res.data.code == '1') { | 30 | if (res.data.code == '1') { |
31 | resolve(res.data.data); | 31 | resolve(res.data.data); |
32 | - } else { | ||
33 | - uni.showToast({ | ||
34 | - title: res.data.msg, | ||
35 | - icon: 'none' | ||
36 | - }); | 32 | + }else { |
33 | + | ||
34 | + | ||
35 | + | ||
36 | + // uni.showToast({ | ||
37 | + // title: res.data.msg, | ||
38 | + // icon: 'none' | ||
39 | + // }); | ||
37 | reject(res.data); | 40 | reject(res.data); |
38 | } | 41 | } |
39 | }, | 42 | }, |
@@ -45,6 +48,9 @@ | @@ -45,6 +48,9 @@ | ||
45 | }); | 48 | }); |
46 | return promise; | 49 | return promise; |
47 | }, | 50 | }, |
51 | + | ||
52 | + | ||
53 | + | ||
48 | globalData: { | 54 | globalData: { |
49 | userInfo: null, | 55 | userInfo: null, |
50 | baseUrl: 'http://fnsxcx.w.brotop.cn' | 56 | baseUrl: 'http://fnsxcx.w.brotop.cn' |
@@ -58,10 +64,13 @@ | @@ -58,10 +64,13 @@ | ||
58 | title: '上传中', | 64 | title: '上传中', |
59 | }) | 65 | }) |
60 | let url = 'http://fnsxcx.w.brotop.cn/api/common/upload'; | 66 | let url = 'http://fnsxcx.w.brotop.cn/api/common/upload'; |
67 | + | ||
68 | + | ||
61 | let head = { | 69 | let head = { |
62 | - 'token': wx.getStorageSync('token'), | 70 | + 'token':uni.getStorageSync('token'), |
63 | 'XX-Device-Type': '' | 71 | 'XX-Device-Type': '' |
64 | } | 72 | } |
73 | + console.log(head) | ||
65 | let typename = { | 74 | let typename = { |
66 | filetype: filetype | 75 | filetype: filetype |
67 | } | 76 | } |
@@ -95,47 +104,8 @@ | @@ -95,47 +104,8 @@ | ||
95 | }); | 104 | }); |
96 | return promise; | 105 | return promise; |
97 | }, | 106 | }, |
98 | - // 上传图片 | ||
99 | - // upload(file) { | ||
100 | - // var promise = new Promise((resolve, reject) => { | ||
101 | - // let url = 'http://fnsxcx.w.brotop.cn/api/common/upload'; | ||
102 | - // let head = { | ||
103 | - // 'token': uni.getStorageSync('token'), | ||
104 | - // }; | ||
105 | - // // let typename = { | ||
106 | - // // filetype: filetype //其他参数 | ||
107 | - // // }; | ||
108 | - // uni.uploadFile({ | ||
109 | - // url: url, //仅为示例,非真实的接口地址 | ||
110 | - // filePath: file, | ||
111 | - // name: 'file', | ||
112 | - // header: head, | ||
113 | - // // formData: typename, | ||
114 | - // success: function(res) { | ||
115 | - | ||
116 | - // let temdata = JSON.parse(res.data); | ||
117 | - // let urlobj = { | ||
118 | - // url: temdata.data.url, | ||
119 | - // }; | ||
120 | - // resolve(urlobj); | ||
121 | - // uni.hideNavigationBarLoading(); | ||
122 | - // uni.hideLoading(); | ||
123 | - // }, | ||
124 | - // fail: function(res) { | ||
125 | - // console.log(res) | ||
126 | - // reject('网络出错'); | ||
127 | - // uni.hideNavigationBarLoading(); | ||
128 | - // uni.hideLoading(); | ||
129 | - // }, | ||
130 | - // complete: () => { | ||
131 | - // uni.hideNavigationBarLoading(); | ||
132 | - // uni.hideLoading(); | ||
133 | - // } | ||
134 | - // }); | ||
135 | - // }); | ||
136 | - // return promise; | ||
137 | - // } | ||
138 | - | 107 | + |
108 | + | ||
139 | } | 109 | } |
140 | </script> | 110 | </script> |
141 | 111 | ||
@@ -147,6 +117,26 @@ | @@ -147,6 +117,26 @@ | ||
147 | height: 100%; | 117 | height: 100%; |
148 | display: block; | 118 | display: block; |
149 | } | 119 | } |
120 | + | ||
121 | + .viewimg{ | ||
122 | + width:560rpx; | ||
123 | + height:890rpx; | ||
124 | + font-size: 0; | ||
125 | + position:absolute; | ||
126 | + top:50%; | ||
127 | + left:50%; | ||
128 | + transform: translate(-50%,-50%); | ||
129 | + } | ||
130 | + .huifu{ | ||
131 | + color:#333!important; | ||
132 | + margin-left:10rpx; | ||
133 | + } | ||
134 | + .nodata{ | ||
135 | + color:#999; | ||
136 | + font-size: 32rpx; | ||
137 | + text-align: center; | ||
138 | + margin-top:40rpx; | ||
139 | + } | ||
150 | /* 布局 */ | 140 | /* 布局 */ |
151 | .layout_row{ | 141 | .layout_row{ |
152 | display: flex; | 142 | display: flex; |
@@ -308,10 +298,20 @@ | @@ -308,10 +298,20 @@ | ||
308 | transform: translate(-50%,-50%); | 298 | transform: translate(-50%,-50%); |
309 | z-index: 100; | 299 | z-index: 100; |
310 | } | 300 | } |
301 | + .register { | ||
302 | + width: 100%; | ||
303 | + height: 100%; | ||
304 | + background-color: rgba(0, 0, 0, 0.5); | ||
305 | + position: fixed; | ||
306 | + top: 0; | ||
307 | + left: 0; | ||
308 | + right: 0; | ||
309 | + z-index: 999; | ||
310 | + } | ||
311 | /* 海报 */ | 311 | /* 海报 */ |
312 | .canvas_dialog{ | 312 | .canvas_dialog{ |
313 | width: 590upx; | 313 | width: 590upx; |
314 | - position: fixed; | 314 | + position: absolute; |
315 | top: 50%; | 315 | top: 50%; |
316 | left: 50%; | 316 | left: 50%; |
317 | transform: translate(-50%,-50%); | 317 | transform: translate(-50%,-50%); |
@@ -57,16 +57,12 @@ | @@ -57,16 +57,12 @@ | ||
57 | "quickapp" : {}, | 57 | "quickapp" : {}, |
58 | /* 小程序特有相关 */ | 58 | /* 小程序特有相关 */ |
59 | "mp-weixin" : { | 59 | "mp-weixin" : { |
60 | - "appid" : "wx1f51f42105b63343", | 60 | + "appid" : "wx46ceeab70244266f", |
61 | "setting" : { | 61 | "setting" : { |
62 | "urlCheck" : false | 62 | "urlCheck" : false |
63 | }, | 63 | }, |
64 | "usingComponents" : true, | 64 | "usingComponents" : true, |
65 | - "permission" : { | ||
66 | - "scope.userLocation" : { | ||
67 | - "desc" : "" | ||
68 | - } | ||
69 | - } | 65 | + "permission" : {} |
70 | }, | 66 | }, |
71 | "mp-alipay" : { | 67 | "mp-alipay" : { |
72 | "usingComponents" : true | 68 | "usingComponents" : true |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages | 3 | //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
4 | // 发现 | 4 | // 发现 |
5 | // 授权 | 5 | // 授权 |
6 | + | ||
6 | { | 7 | { |
7 | "path": "pages/index/index", | 8 | "path": "pages/index/index", |
8 | "style": { | 9 | "style": { |
@@ -12,6 +13,15 @@ | @@ -12,6 +13,15 @@ | ||
12 | } | 13 | } |
13 | }, | 14 | }, |
14 | { | 15 | { |
16 | + "path": "pages/course/indexvue", | ||
17 | + "style": { | ||
18 | + "navigationBarTitleText": "赋能师成长数据化", | ||
19 | + "navigationBarBackgroundColor": "#fff", | ||
20 | + "navigationBarTextStyle": "black" | ||
21 | + } | ||
22 | + }, | ||
23 | + | ||
24 | + { | ||
15 | "path": "pages/start/start", | 25 | "path": "pages/start/start", |
16 | "style": { | 26 | "style": { |
17 | "navigationBarTitleText": "赋能师成长数据化", | 27 | "navigationBarTitleText": "赋能师成长数据化", |
@@ -19,9 +29,8 @@ | @@ -19,9 +29,8 @@ | ||
19 | "navigationBarTextStyle": "black" | 29 | "navigationBarTextStyle": "black" |
20 | } | 30 | } |
21 | }, | 31 | }, |
22 | - | ||
23 | - | ||
24 | - | 32 | + |
33 | + | ||
25 | // 个人中心 | 34 | // 个人中心 |
26 | { | 35 | { |
27 | "path": "pages/mine/circlepic", | 36 | "path": "pages/mine/circlepic", |
@@ -90,7 +99,7 @@ | @@ -90,7 +99,7 @@ | ||
90 | { | 99 | { |
91 | "path": "pages/course/courseDetail", | 100 | "path": "pages/course/courseDetail", |
92 | "style": { | 101 | "style": { |
93 | - "navigationBarTitleText": "课程详情", | 102 | + "navigationBarTitleText": "关卡详情", |
94 | "navigationBarBackgroundColor": "#fff", | 103 | "navigationBarBackgroundColor": "#fff", |
95 | "navigationBarTextStyle": "black" | 104 | "navigationBarTextStyle": "black" |
96 | } | 105 | } |
@@ -124,6 +133,11 @@ | @@ -124,6 +133,11 @@ | ||
124 | "navigationBarBackgroundColor": "#F8F8F8", | 133 | "navigationBarBackgroundColor": "#F8F8F8", |
125 | "backgroundColor": "#F8F8F8" | 134 | "backgroundColor": "#F8F8F8" |
126 | }, | 135 | }, |
136 | + "permission": { | ||
137 | + "scope.userLocation": { | ||
138 | + "desc": "需要记录打卡时的位置信息" | ||
139 | + } | ||
140 | + }, | ||
127 | "tabBar": { | 141 | "tabBar": { |
128 | "color": "#BDC4CE", | 142 | "color": "#BDC4CE", |
129 | "selectedColor": "#EE8B27", | 143 | "selectedColor": "#EE8B27", |
1 | <template> | 1 | <template> |
2 | <view class="content"> | 2 | <view class="content"> |
3 | 3 | ||
4 | - <view class="nodatabox" v-if="courselist.length==0"> | 4 | + <view class="nodatabox" v-if="courselist.length!=0&&time==true"> |
5 | <view class="noimg"> | 5 | <view class="noimg"> |
6 | <image src="../../static/nodata.png" mode=""></image> | 6 | <image src="../../static/nodata.png" mode=""></image> |
7 | - | ||
8 | </view> | 7 | </view> |
9 | <view class="zanwushu">暂无内容</view> | 8 | <view class="zanwushu">暂无内容</view> |
10 | <view class="gocourse" @click="goindex">快前往首页解锁课程添加内容吧</view> | 9 | <view class="gocourse" @click="goindex">快前往首页解锁课程添加内容吧</view> |
11 | </view> | 10 | </view> |
12 | 11 | ||
13 | <view class="courselist" v-else> | 12 | <view class="courselist" v-else> |
14 | - <view class='courseitem' v-for="(item,index) in courselist" :key="index"> | 13 | + <view class='courseitem' v-for="(item,index) in courselist" :key="index" @click=toCourseIntro(item)> |
15 | <view class="itemtopname flexone"> | 14 | <view class="itemtopname flexone"> |
16 | <text class="itemtitle">{{item.title}}</text> | 15 | <text class="itemtitle">{{item.title}}</text> |
17 | 16 | ||
18 | </view> | 17 | </view> |
19 | <view class="textcontent flexone"> | 18 | <view class="textcontent flexone"> |
20 | <view class="textcontentk textcontentleft flexone"> | 19 | <view class="textcontentk textcontentleft flexone"> |
21 | - 总课时 <text class='kejie'>{{item.lesson}}</text> 课 | 20 | + 总课时 <text class='kejie'>{{item.customs_num}}</text> 课 |
22 | 21 | ||
23 | </view> | 22 | </view> |
24 | <view class="textcontentk textcontentleft youtext flexone"> | 23 | <view class="textcontentk textcontentleft youtext flexone"> |
25 | - 已完成 <text class='kejie'>{{item.user_lesson}}</text> 课 | 24 | + 已完成 <text class='kejie'>{{item.customs_user_num}}</text> 课 |
26 | 25 | ||
27 | </view> | 26 | </view> |
28 | 27 | ||
29 | - <view class="finishimg" v-if="item.state==2"> | 28 | + <view class="finishimg" v-if="item.state==3"> |
30 | <image src="../../static/finish.png" mode=""></image> | 29 | <image src="../../static/finish.png" mode=""></image> |
31 | </view> | 30 | </view> |
32 | </view> | 31 | </view> |
33 | </view> | 32 | </view> |
34 | - | ||
35 | - | ||
36 | - | ||
37 | </view> | 33 | </view> |
38 | - | ||
39 | - | ||
40 | - | ||
41 | - | ||
42 | </view> | 34 | </view> |
43 | </template> | 35 | </template> |
44 | 36 | ||
@@ -49,7 +41,8 @@ | @@ -49,7 +41,8 @@ | ||
49 | return { | 41 | return { |
50 | courselist: [], | 42 | courselist: [], |
51 | page:1, | 43 | page:1, |
52 | - pageNum:10 | 44 | + pageNum:10, |
45 | + time:false | ||
53 | } | 46 | } |
54 | }, | 47 | }, |
55 | methods: { | 48 | methods: { |
@@ -58,6 +51,52 @@ | @@ -58,6 +51,52 @@ | ||
58 | url: '../registerone/registerone' | 51 | url: '../registerone/registerone' |
59 | }) | 52 | }) |
60 | }, | 53 | }, |
54 | + | ||
55 | + // 获取用户信息 | ||
56 | + getuserinfo() { | ||
57 | + let that = this; | ||
58 | + var url = '/api/index/user_info'; | ||
59 | + var params = { | ||
60 | + | ||
61 | + | ||
62 | + } | ||
63 | + app.post(url, params, "post").then((res) => { | ||
64 | + console.log(res); | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + }).catch((err) => { | ||
69 | + console.log(err) | ||
70 | + if (err.msg == '您已被拉黑') { | ||
71 | + wx.showToast({ | ||
72 | + title: err.msg, | ||
73 | + icon: "none" | ||
74 | + }) | ||
75 | + | ||
76 | + setTimeout(function() { | ||
77 | + wx.navigateTo({ | ||
78 | + url: '/pages/start/start' | ||
79 | + }) | ||
80 | + }, 1500) | ||
81 | + } else if (err.msg == '用户未登录') { | ||
82 | + | ||
83 | + wx.showToast({ | ||
84 | + title: '请重新登录', | ||
85 | + icon: 'none' | ||
86 | + }) | ||
87 | + wx.setStorageSync("token", "") | ||
88 | + setTimeout(function(){ | ||
89 | + uni.navigateTo({ | ||
90 | + url:'/pages/start/start' | ||
91 | + }) | ||
92 | + },1500) | ||
93 | + } | ||
94 | + | ||
95 | + | ||
96 | + }) | ||
97 | + }, | ||
98 | + | ||
99 | + | ||
61 | // 获取课程列表 | 100 | // 获取课程列表 |
62 | getcourselist(){ | 101 | getcourselist(){ |
63 | let that=this; | 102 | let that=this; |
@@ -66,22 +105,12 @@ | @@ -66,22 +105,12 @@ | ||
66 | 105 | ||
67 | let param = { | 106 | let param = { |
68 | page: that.page, | 107 | page: that.page, |
69 | - pageNum: that.pageNum | 108 | + pageNum: 10 |
70 | }; | 109 | }; |
71 | 110 | ||
72 | - | ||
73 | - | ||
74 | - | ||
75 | app.post(url, param, 'get').then(r => { | 111 | app.post(url, param, 'get').then(r => { |
76 | - console.log(r) | ||
77 | - that.courselist=r.list | ||
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | ||
84 | - | 112 | + console.log('课程列表',r) |
113 | + that.courselist=that.courselist.concat(r) | ||
85 | 114 | ||
86 | }).catch(err => { | 115 | }).catch(err => { |
87 | console.log(err) | 116 | console.log(err) |
@@ -89,6 +118,35 @@ | @@ -89,6 +118,35 @@ | ||
89 | }) | 118 | }) |
90 | }, | 119 | }, |
91 | 120 | ||
121 | + // 课程介绍 | ||
122 | + toCourseIntro(item){ | ||
123 | + | ||
124 | + // var item=JSON.stringify(item) | ||
125 | + // console.log(item) | ||
126 | + // wx.setStorageSync("item",JSON.stringify(item)) | ||
127 | + // wx.setStorageSync("item", item) | ||
128 | + let token=uni.getStorageSync("token") | ||
129 | + if(token==''){ | ||
130 | + uni.showToast({ | ||
131 | + title:'请先登录', | ||
132 | + icon:'none' | ||
133 | + }) | ||
134 | + setTimeout(function(){ | ||
135 | + uni.navigateTo({ | ||
136 | + url:"/pages/start/start" | ||
137 | + }) | ||
138 | + },1500) | ||
139 | + | ||
140 | + }else{ | ||
141 | + uni.navigateTo({ | ||
142 | + url:"/pages/course/courseIntro?id="+item.id | ||
143 | + }) | ||
144 | + } | ||
145 | + | ||
146 | + | ||
147 | + }, | ||
148 | + | ||
149 | + | ||
92 | // 前往首页 | 150 | // 前往首页 |
93 | goindex(){ | 151 | goindex(){ |
94 | uni.switchTab({ | 152 | uni.switchTab({ |
@@ -97,14 +155,21 @@ | @@ -97,14 +155,21 @@ | ||
97 | }, | 155 | }, |
98 | 156 | ||
99 | }, | 157 | }, |
158 | + | ||
159 | + | ||
100 | 160 | ||
101 | onLaunch: function() { | 161 | onLaunch: function() { |
102 | console.log('App Launch,app启动') | 162 | console.log('App Launch,app启动') |
103 | }, | 163 | }, |
104 | onShow: function() { | 164 | onShow: function() { |
105 | - | 165 | + this.page=1; |
166 | + this.courselist=[]; | ||
106 | console.log('App Show,app展现在前台') | 167 | console.log('App Show,app展现在前台') |
107 | this.getcourselist(); | 168 | this.getcourselist(); |
169 | + this.getuserinfo(); | ||
170 | + setTimeout(function(){ | ||
171 | + this.time=true | ||
172 | + },1000) | ||
108 | }, | 173 | }, |
109 | onHide: function() { | 174 | onHide: function() { |
110 | console.log('App Hide,app不再展现在前台') | 175 | console.log('App Hide,app不再展现在前台') |
@@ -113,6 +178,14 @@ | @@ -113,6 +178,14 @@ | ||
113 | 178 | ||
114 | 179 | ||
115 | }, | 180 | }, |
181 | + | ||
182 | + | ||
183 | + onReachBottom() { | ||
184 | + var newpage = this.page; | ||
185 | + newpage++; | ||
186 | + this.page = newpage | ||
187 | + this.getcourselist() | ||
188 | + }, | ||
116 | } | 189 | } |
117 | </script> | 190 | </script> |
118 | 191 |
@@ -15,10 +15,19 @@ | @@ -15,10 +15,19 @@ | ||
15 | 15 | ||
16 | </view> | 16 | </view> |
17 | 17 | ||
18 | - <view class="picbox" v-else> | 18 | + <view class="picbox flexone" v-else> |
19 | <!-- 上传的图片 --> | 19 | <!-- 上传的图片 --> |
20 | + <view class="flexone"> | ||
21 | + <view class="upload_pic" v-for="(item,index) in image" :key="index"> | ||
22 | + <image :src="item" mode=""></image> | ||
23 | + <view class="closeimg" @click="deleteimg(item)"> | ||
24 | + <image src="../../static/close.png" mode=""></image> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | + </view> | ||
28 | + | ||
20 | <view class="upload_pic" @click="uploadImg()"> | 29 | <view class="upload_pic" @click="uploadImg()"> |
21 | - <image :src="image==''?img:image" mode="widthFix"></image> | 30 | + <image :src="img" mode="widthFix"></image> |
22 | </view> | 31 | </view> |
23 | </view> | 32 | </view> |
24 | </view> | 33 | </view> |
@@ -30,6 +39,15 @@ | @@ -30,6 +39,15 @@ | ||
30 | <view class="send_box">发送</view> | 39 | <view class="send_box">发送</view> |
31 | </view> | 40 | </view> |
32 | 41 | ||
42 | + <view class="register" v-if="sendtrue"> | ||
43 | + <view class="sendwrap"> | ||
44 | + <view class="sendimg"> | ||
45 | + <image src="/static/img_01.png"></image> | ||
46 | + </view> | ||
47 | + <view class="sendsuccess">发送成功</view> | ||
48 | + </view> | ||
49 | + </view> | ||
50 | + | ||
33 | </view> | 51 | </view> |
34 | </template> | 52 | </template> |
35 | 53 | ||
@@ -41,13 +59,19 @@ | @@ -41,13 +59,19 @@ | ||
41 | content:"", | 59 | content:"", |
42 | img:"../../static/addpic.png", | 60 | img:"../../static/addpic.png", |
43 | addpic:true, | 61 | addpic:true, |
44 | - image:'', | 62 | + image:[], |
45 | cimage:'', | 63 | cimage:'', |
46 | // 打卡记录id | 64 | // 打卡记录id |
47 | clock_log_id:'', | 65 | clock_log_id:'', |
48 | //评论父级id | 66 | //评论父级id |
49 | comments_id:'', | 67 | comments_id:'', |
50 | - courseid:'' | 68 | + courseid:'', |
69 | + user_id:'', | ||
70 | + commenttype:'', | ||
71 | + customs_id:'', | ||
72 | + sendtrue:false | ||
73 | + | ||
74 | + | ||
51 | } | 75 | } |
52 | }, | 76 | }, |
53 | methods: { | 77 | methods: { |
@@ -70,7 +94,8 @@ | @@ -70,7 +94,8 @@ | ||
70 | console.log(res.tempFilePaths[0]) | 94 | console.log(res.tempFilePaths[0]) |
71 | app.upload('image', res.tempFilePaths[0],"post").then((res) => { | 95 | app.upload('image', res.tempFilePaths[0],"post").then((res) => { |
72 | console.log('上传文件', res); | 96 | console.log('上传文件', res); |
73 | - that.image=res.url | 97 | + that.image.push(res.url); |
98 | + that.image=that.image | ||
74 | that.cimage=res.kurl | 99 | that.cimage=res.kurl |
75 | 100 | ||
76 | 101 | ||
@@ -82,28 +107,68 @@ | @@ -82,28 +107,68 @@ | ||
82 | fail: function (res) { } | 107 | fail: function (res) { } |
83 | }) | 108 | }) |
84 | }, | 109 | }, |
85 | - | 110 | + deleteimg(item){ |
111 | + // console.log(e) | ||
112 | + // var url=e.currentTarget.dataset.url; | ||
113 | + for(var i=0;i<this.image.length;i++){ | ||
114 | + if(item==this.image[i]){ | ||
115 | + this.image.splice(i,1); | ||
116 | + | ||
117 | + } | ||
118 | + } | ||
119 | + this.image=this.image; | ||
120 | + | ||
121 | + | ||
122 | + }, | ||
86 | //发送 | 123 | //发送 |
87 | send(){ | 124 | send(){ |
88 | let that = this; | 125 | let that = this; |
126 | + if(that.content==''){ | ||
127 | + uni.showToast({ | ||
128 | + title:'请输入评价内容', | ||
129 | + icon:'none' | ||
130 | + }) | ||
131 | + return false | ||
132 | + } | ||
89 | var url = '/api/comments/commit'; | 133 | var url = '/api/comments/commit'; |
90 | var params = { | 134 | var params = { |
91 | clock_log_id:that.clock_log_id, | 135 | clock_log_id:that.clock_log_id, |
92 | comments_id: that.comments_id, | 136 | comments_id: that.comments_id, |
93 | content:that.content, | 137 | content:that.content, |
94 | - images:that.image | 138 | + images:that.image.join(",") |
95 | } | 139 | } |
140 | + console.log(this.clock_log_id) | ||
141 | + console.log(params) | ||
142 | + console.log(this.comments_id) | ||
96 | app.post(url, params).then((res) => { | 143 | app.post(url, params).then((res) => { |
97 | console.log(res); | 144 | console.log(res); |
98 | - uni.showToast({ | ||
99 | - title:'提交成功', | ||
100 | - icon:'none' | ||
101 | - }) | 145 | + // uni.showToast({ |
146 | + // title:'提交成功', | ||
147 | + // icon:'none' | ||
148 | + // }) | ||
149 | + that.sendtrue=true | ||
150 | + console.log(typeof(this.commenttype)) | ||
151 | + console.log(this.commenttype) | ||
102 | setTimeout(function(){ | 152 | setTimeout(function(){ |
103 | - uni.navigateTo({ | ||
104 | - url:'/pages/course/courseDetail?id='+that.courseid | ||
105 | - }) | ||
106 | - }) | 153 | + if(that.commenttype==1){ |
154 | + | ||
155 | + console.log(988765,that.courseid) | ||
156 | + uni.redirectTo({ | ||
157 | + url:'/pages/course/courseDetail?id='+that.customs_id+'&courseid='+that.courseid | ||
158 | + }) | ||
159 | + }else if(that.commenttype==2){ | ||
160 | + console.log(9887) | ||
161 | + uni.redirectTo({ | ||
162 | + url:'/pages/course/recordClock?customs_id='+that.customs_id+'&user_id='+that.user_id+'&courseid='+that.courseid | ||
163 | + }) | ||
164 | + }else if(that.commenttype==3){ | ||
165 | + console.log(9887) | ||
166 | + uni.switchTab({ | ||
167 | + url:'/pages/mine/mine' | ||
168 | + }) | ||
169 | + } | ||
170 | + | ||
171 | + },1500) | ||
107 | }).catch((err) => { | 172 | }).catch((err) => { |
108 | 173 | ||
109 | }) | 174 | }) |
@@ -112,8 +177,32 @@ | @@ -112,8 +177,32 @@ | ||
112 | 177 | ||
113 | onLoad(options) { | 178 | onLoad(options) { |
114 | console.log(options) | 179 | console.log(options) |
115 | - this.clock_log_id=options.id, | ||
116 | - this.courseid=options.courseid | 180 | + this.commenttype=options.commenttype |
181 | + if(options.commenttype==2){ | ||
182 | + this.courseid=options.courseid; | ||
183 | + this.user_id=options.user_id; | ||
184 | + this.clock_log_id=options.clock_log_id; | ||
185 | + | ||
186 | + this.customs_id=options.customs_id | ||
187 | + | ||
188 | + if(options.comments_id!=undefined){ | ||
189 | + this.comments_id=options.comments_id; | ||
190 | + } | ||
191 | + }else if(options.commenttype==1){ | ||
192 | + this.clock_log_id=options.clock_log_id; | ||
193 | + this.courseid=options.courseid | ||
194 | + this.customs_id=options.customs_id | ||
195 | + if(options.comments_id!=undefined){ | ||
196 | + this.comments_id=options.comments_id; | ||
197 | + } | ||
198 | + | ||
199 | + }else{ | ||
200 | + this.clock_log_id=options.clock_log_id; | ||
201 | + this.customs_id=options.customs_id | ||
202 | + if(options.comments_id!=undefined){ | ||
203 | + this.comments_id=options.comments_id; | ||
204 | + } | ||
205 | + } | ||
117 | } | 206 | } |
118 | } | 207 | } |
119 | </script> | 208 | </script> |
@@ -122,6 +211,33 @@ | @@ -122,6 +211,33 @@ | ||
122 | page{ | 211 | page{ |
123 | background-color: #fafbfd; | 212 | background-color: #fafbfd; |
124 | } | 213 | } |
214 | + .sendimg{ | ||
215 | + width:100rpx; | ||
216 | + height:100rpx; | ||
217 | + font-size: 0; | ||
218 | + } | ||
219 | + .sendsuccess{ | ||
220 | + color:#06121E; | ||
221 | + font-size:30rpx; | ||
222 | + margin-top:30rpx; | ||
223 | + } | ||
224 | + .sendwrap{ | ||
225 | + width:446rpx; | ||
226 | + height:256rpx; | ||
227 | + background:rgba(255,255,255,1); | ||
228 | + box-shadow:0rpx 0rpx 6rpx rgba(0,0,0,0.08); | ||
229 | + opacity:1; | ||
230 | + border-radius:8rpx; | ||
231 | + position: absolute; | ||
232 | + top:50%; | ||
233 | + left:50%; | ||
234 | + transform: translate(-50%,-50%); | ||
235 | + display:flex; | ||
236 | + flex-direction: column; | ||
237 | + justify-content: center; | ||
238 | + align-items: center; | ||
239 | + | ||
240 | + } | ||
125 | .picbox{ | 241 | .picbox{ |
126 | margin-top:85rpx; | 242 | margin-top:85rpx; |
127 | } | 243 | } |
@@ -170,8 +286,19 @@ | @@ -170,8 +286,19 @@ | ||
170 | width:200upx; | 286 | width:200upx; |
171 | height:200upx; | 287 | height:200upx; |
172 | font-size:0; | 288 | font-size:0; |
289 | + position: relative; | ||
290 | + margin-right:32rpx; | ||
173 | 291 | ||
174 | - | 292 | + } |
293 | + | ||
294 | + | ||
295 | + .closeimg{ | ||
296 | + width:36rpx; | ||
297 | + height:36rpx; | ||
298 | + font-size: 0; | ||
299 | + position: absolute; | ||
300 | + right:-20rpx; | ||
301 | + top:0 | ||
175 | } | 302 | } |
176 | // 按钮 | 303 | // 按钮 |
177 | .send_wrap{ | 304 | .send_wrap{ |
@@ -3,10 +3,10 @@ | @@ -3,10 +3,10 @@ | ||
3 | <view class="course_detail"> | 3 | <view class="course_detail"> |
4 | <!-- 关卡 --> | 4 | <!-- 关卡 --> |
5 | <view class="checkpoint_wrap layer_between"> | 5 | <view class="checkpoint_wrap layer_between"> |
6 | - <view class="prev_point" v-if="pre!=''" @click="prestep">上一关</view> | ||
7 | - <view class="point_num">第 {{number}} 关</view> | 6 | + <view class="prev_point" v-if="last_customs!=''" @click="prestep">上一关</view> |
7 | + <view class="point_num">{{coursedetail.title}}</view> | ||
8 | 8 | ||
9 | - <view class="prev_point" @click="nextstep" wx:if="next!=''">下一关</view> | 9 | + <view class="prev_point" v-if="next_customs!=''" @click="nextstep" wx:if="next!=''">下一关</view> |
10 | </view> | 10 | </view> |
11 | <!-- 主题 --> | 11 | <!-- 主题 --> |
12 | <view class="theme_wrap"> | 12 | <view class="theme_wrap"> |
@@ -16,77 +16,81 @@ | @@ -16,77 +16,81 @@ | ||
16 | <view class="">{{coursedetail.title}}</view> | 16 | <view class="">{{coursedetail.title}}</view> |
17 | </view> | 17 | </view> |
18 | <!-- 图片 --> | 18 | <!-- 图片 --> |
19 | - <view class="theme_pic" @click="enlargeImg()"> | 19 | + <!-- <view class="theme_pic" @click="enlargeImg()"> |
20 | <image :src="coursedetail.image" mode="widthFix"></image> | 20 | <image :src="coursedetail.image" mode="widthFix"></image> |
21 | - </view> | 21 | + </view> --> |
22 | <!-- 内容 --> | 22 | <!-- 内容 --> |
23 | - <view class="theme_content" v-html="coursedetail.content"> | 23 | + <view class="theme_content"> |
24 | + <!-- v-html="coursedetail.content" --> | ||
24 | <!-- 基值支义们京候么眼革下使叫。南石很样好清少去准连究志议构。调研而手开求况做体式达高心置过。装切此报列明子马世志再部增心。 | 25 | <!-- 基值支义们京候么眼革下使叫。南石很样好清少去准连究志议构。调研而手开求况做体式达高心置过。装切此报列明子马世志再部增心。 |
25 | 般于须子展新五复通可南成群置接。为技经再议制选时据派断这队片全府好。况感速记中上相组低拉素道北始论与。属书研置约适商才联太的七情力类。 | 26 | 般于须子展新五复通可南成群置接。为技经再议制选时据派断这队片全府好。况感速记中上相组低拉素道北始论与。属书研置约适商才联太的七情力类。 |
26 | 你理边率他次与关好期起金志单马切红。主严拉青民解格速七取学复才太马。前属口质次意指有研叫后先按此。 | 27 | 你理边率他次与关好期起金志单马切红。主严拉青民解格速七取学复才太马。前属口质次意指有研叫后先按此。 |
27 | 省每前称非美事起也半专我料叫此没。学想象这志究反规空家很便老。位转信由江空能手立和级各素面亲。认安应活按开重细强说标将研力。生机除打万复办开不场始先值标清。 --> | 28 | 省每前称非美事起也半专我料叫此没。学想象这志究反规空家很便老。位转信由江空能手立和级各素面亲。认安应活按开重细强说标将研力。生机除打万复办开不场始先值标清。 --> |
29 | + <u-parse :content="customcontent" @preview="preview" @navigate="navigate"></u-parse> | ||
30 | + | ||
28 | </view> | 31 | </view> |
29 | - <!-- 图片 --> | ||
30 | - <!-- <view class="theme_pic" @click="enlargeImg()"> | ||
31 | - <image src="../../static/theme_01.png" mode="widthFix"></image> | ||
32 | - </view> --> | 32 | + |
33 | <!-- 按钮 --> | 33 | <!-- 按钮 --> |
34 | - <view class="point_btn" @click="toSubmit()">我要打卡</view> | ||
35 | - <!-- 放大图片 --> | ||
36 | - <!-- <view class="tx_mask" v-if="isShowImg" @click="closeTheme"></view> | ||
37 | - <view class="mask_img" v-if="isShowImg"> | ||
38 | - <image :src="img" mode="widthFix"></image> | ||
39 | - </view> --> | 34 | + <view class="point_btn" v-if="coursedetail.is_clock==1">已打卡</view> |
35 | + <view class="point_btn" @click="toSubmit()" v-else>{{coursedetail.course_is_clock==1?'已打卡':'我要打卡'}}</view> | ||
40 | </view> | 36 | </view> |
41 | <!-- 评论 --> | 37 | <!-- 评论 --> |
42 | <view class="theme_comment"> | 38 | <view class="theme_comment"> |
43 | - <view class="comment_single" v-for="(item,index) in courselist" :key="index"> | 39 | + <view class="comment_single" v-for="(item,index) in courselist" :key="index" v-if="item.is_privacy==2||item.user==true"> |
44 | <!-- 人员信息 --> | 40 | <!-- 人员信息 --> |
45 | <view class="single_people layer_between"> | 41 | <view class="single_people layer_between"> |
46 | <!-- 左侧 --> | 42 | <!-- 左侧 --> |
47 | <view class="people_l layer_nostar"> | 43 | <view class="people_l layer_nostar"> |
48 | <!-- 头像 --> | 44 | <!-- 头像 --> |
49 | - <image :src="item.avatar" mode="" @click="toRecord()"></image> | 45 | + <view class="touxiang"> |
46 | + <image :src="item.user.avatar" mode="" @click="toRecord(item)"></image> | ||
47 | + </view> | ||
48 | + | ||
50 | <view class=""> | 49 | <view class=""> |
51 | <!-- 姓名 --> | 50 | <!-- 姓名 --> |
52 | - <view class="people_name">{{item.nickname}}</view> | 51 | + <view class="people_name">{{item.user.nickname}}</view> |
53 | <!-- 课程进度 --> | 52 | <!-- 课程进度 --> |
54 | - <view class="people_progress">已解锁2课时</view> | 53 | + <view class="people_progress">已解锁{{item.unlock_customs_num}}课时</view> |
55 | </view> | 54 | </view> |
56 | </view> | 55 | </view> |
57 | <!-- 右侧 --> | 56 | <!-- 右侧 --> |
58 | - <view class="people_r" @click="toSubmit()">修改</view> | 57 | + <view class="people_r" @click="changeclock(item)" :data-item="item" v-if="item.isuser==true">修改</view> |
59 | </view> | 58 | </view> |
60 | <!-- 课程信息 --> | 59 | <!-- 课程信息 --> |
61 | <view class="single_course"> | 60 | <view class="single_course"> |
62 | <!-- 课程名称 --> | 61 | <!-- 课程名称 --> |
63 | <view class="layer_star course_name course_single"> | 62 | <view class="layer_star course_name course_single"> |
64 | <image class="course_icon" src="../../static/icon_01.png" mode=""></image> | 63 | <image class="course_icon" src="../../static/icon_01.png" mode=""></image> |
65 | - <view class="">【深潜挑战】 21天专注力挑战</view> | 64 | + <view class="">{{item.course_title}}</view> |
66 | </view> | 65 | </view> |
67 | <view class="layer_star course_single"> | 66 | <view class="layer_star course_single"> |
68 | <image class="course_icon" src="../../static/icon_02.png" mode=""></image> | 67 | <image class="course_icon" src="../../static/icon_02.png" mode=""></image> |
69 | - <view class="">第2课</view> | 68 | + <view class="">{{item.customs_title}}</view> |
70 | </view> | 69 | </view> |
71 | <view class="layer_star no_icon_single"> | 70 | <view class="layer_star no_icon_single"> |
72 | - <view class="">学习时间:2019年12月26日</view> | 71 | + <view class="">学习时间:{{item.createtime}}</view> |
73 | </view> | 72 | </view> |
74 | - <view class="layer_star no_icon_single"> | ||
75 | - <view class="">感悟:{{item.content}}</view> | 73 | + <view class=" no_icon_single ganwu"> |
74 | + <view> | ||
75 | + 感悟: | ||
76 | + </view> | ||
77 | + <text class="">{{item.content}}</text> | ||
76 | </view> | 78 | </view> |
77 | - <view class="layer_star no_icon_single"> | ||
78 | - 完成事件打分: | ||
79 | - <view class="score_picker layer_between">{{item.score[0].score}}</view> | ||
80 | - <!-- <picker mode="selector" :range="completeList" @change="changeComplete"> | ||
81 | - <view class="score_picker layer_between"> | ||
82 | - <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> | ||
83 | - <image src="../../static/start_01.png" mode="widthFix"></image> | 79 | + |
80 | + <view class=" no_icon_single ganwu" v-if="item.images!=null"> | ||
81 | + <view style="width:100rpx;"> | ||
82 | + | ||
83 | + </view> | ||
84 | + <view class="imagebox flexone"> | ||
85 | + <view class="iamgeitem" v-for="(item,indexk) in item.images" :key="indexk" :data-url="item" :data-index="index" :data-indexk="indexk" @click="preivewimg"> | ||
86 | + <image :src="item"></image> | ||
84 | </view> | 87 | </view> |
85 | - </picker> --> | 88 | + </view> |
86 | </view> | 89 | </view> |
87 | - <view class="layer_star no_icon_single"> | ||
88 | - 情绪状态打分: | ||
89 | - <view class="score_picker layer_between">{{item.score[1].score}}</view> | 90 | + |
91 | + <view class="layer_star no_icon_single" v-for="(itemsec,index) in item.clock_score" :key="index"> | ||
92 | + {{itemsec.title}}: | ||
93 | + <view class="score_picker layer_between">{{itemsec.score}}</view> | ||
90 | <!-- <picker mode="selector" :range="completeList" @change="changeComplete"> | 94 | <!-- <picker mode="selector" :range="completeList" @change="changeComplete"> |
91 | <view class="score_picker layer_between"> | 95 | <view class="score_picker layer_between"> |
92 | <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> | 96 | <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> |
@@ -94,47 +98,79 @@ | @@ -94,47 +98,79 @@ | ||
94 | </view> | 98 | </view> |
95 | </picker> --> | 99 | </picker> --> |
96 | </view> | 100 | </view> |
101 | + | ||
97 | <!-- 评论、点赞按钮 --> | 102 | <!-- 评论、点赞按钮 --> |
98 | - <view class="layer_noend" @click="comment" :data-id="item.id"> | ||
99 | - <view class="course_btn justify_between"> | 103 | + <view class="layer_noend"> |
104 | + <view class="course_btn justify_between" @click="comment(item)" :data-id="item.id"> | ||
100 | <image src="../../static/pinglun_icon@2x.png" mode="widthFix"></image> | 105 | <image src="../../static/pinglun_icon@2x.png" mode="widthFix"></image> |
101 | 评论 | 106 | 评论 |
102 | </view> | 107 | </view> |
103 | - <view class="course_btn justify_between" :class="{active:isPoint}" @click="changePoint()" :data-id="item.id"> | ||
104 | - <image :src="isPoint?pointImg2:pointImg1" mode="widthFix"></image> | ||
105 | - 点赞 | 108 | + <view class="course_btn justify_between" :class="{active:item.is_praise==1}" @click="changePoint(item,index)" |
109 | + :data-id="item.id" :data-customsid='item.customs_id'> | ||
110 | + <image :src="item.is_praise==1?pointImg2:pointImg1" mode="widthFix"></image> | ||
111 | + <text v-if="item.is_praise==1">已赞</text> | ||
112 | + <text v-else>点赞</text> | ||
106 | </view> | 113 | </view> |
107 | </view> | 114 | </view> |
108 | - </view> | ||
109 | - <!-- 评论、点赞信息 --> | ||
110 | - <view class="comment_msg"> | ||
111 | - <!-- 点赞人员 --> | ||
112 | - <view class="point_people layer_nostar"> | ||
113 | - <image src="../../static/dianzan_icon@2x.png" mode="widthFix"></image> | ||
114 | - <view class="point_detail flex_wrap_no"> | ||
115 | - <view class="" v-for="(itemone, index) in item.praise_user" :key="index">{{itemone.nickname }},</view> | 115 | + <!-- 评论、点赞信息 --> |
116 | + <view class="comment_msg"> | ||
117 | + <!-- 点赞人员 --> | ||
118 | + <view class="point_people layer_nostar"> | ||
119 | + <image src="../../static/dianzan_icon@2x.png" mode="widthFix" v-if="item.praise_user.length!=0"></image> | ||
120 | + <view class="point_detail flex_wrap_no"> | ||
121 | + <view class="namedianzan" v-for="(itemone, index) in item.praise_user" :key="index">{{itemone.user.nickname}}</view> | ||
122 | + </view> | ||
116 | </view> | 123 | </view> |
117 | - </view> | ||
118 | - <view class="seemore" @click="seemore" :data-id="item.id">查看所有评论</view> | ||
119 | - <!-- 评论信息 --> | ||
120 | - <view class="msg_detail" v-if="showcomment"> | ||
121 | - <view class="detail_single " v-for="(item,index) in commentlist" :key="index" @longtap="del" :data-id="item.id"> | ||
122 | - <text v-if="index==0">{item.user_nickname}:</text> | ||
123 | - <text v-else>{item.user_nickname}回复{{item.re_user_nickname}}</text> | ||
124 | - {{item.content}} | 124 | + <view class="seemore" @click="seemore(item.id,index)" :data-id="item.id" v-if="item.is_comment==1">查看所有评论</view> |
125 | + <!-- 评论信息 --> | ||
126 | + <view class="msg_detail" v-if="item.showcomment"> | ||
127 | + <view class="detail_single " v-for="(itemone,indexk) in commentlist" :key="indexk" @longtap="dele(itemone,indexk)" | ||
128 | + :data-id="itemone.id"> | ||
129 | + <view v-if="itemone.user2" @click="replay(item,itemnone)"> <text>{{itemone.user1.nickname}} <text class="huifu">回复</text> {{itemone.user2.nickname}}</text> {{itemone.content}} | ||
130 | + | ||
131 | + <view class="flexone"> | ||
132 | + <view class="addimg" v-for="(itemimg,index) in itemone.images" :key="index" @click.stop="viewimg(itemimg)"> | ||
133 | + <image class="add_img" :src="itemimg" mode=""></image> | ||
134 | + </view> | ||
135 | + </view> | ||
136 | + </view> | ||
137 | + | ||
138 | + <view v-else @click="replay(item,itemone)"> | ||
139 | + <text>{{itemone.user1.nickname}}:</text>{{itemone.content}} | ||
140 | + | ||
141 | + <view class="flexone"> | ||
142 | + <view class="addimg" v-for="(itemimg,index) in itemone.images" :key="index" @click.stop="viewimg(itemimg)"> | ||
143 | + <image class="add_img" :src="itemimg" mode=""></image> | ||
144 | + </view> | ||
145 | + </view> | ||
146 | + </view> | ||
147 | + | ||
148 | + </view> | ||
149 | + | ||
125 | </view> | 150 | </view> |
126 | </view> | 151 | </view> |
127 | </view> | 152 | </view> |
153 | + | ||
128 | </view> | 154 | </view> |
129 | </view> | 155 | </view> |
130 | - | ||
131 | - | 156 | + |
157 | + | ||
158 | + <!-- 遮罩层 --> | ||
159 | + <view class="register" v-if="showimg" @click="hideshowimg"> | ||
160 | + <view class="viewimg"> | ||
161 | + <image :src="imgurl" mode="aspectFit"></image> | ||
162 | + </view> | ||
163 | + </view> | ||
132 | </view> | 164 | </view> |
133 | </template> | 165 | </template> |
134 | 166 | ||
135 | <script> | 167 | <script> |
168 | + import uParse from '@/components/u-parse/u-parse.vue' | ||
136 | import app from "../../App.vue"; | 169 | import app from "../../App.vue"; |
137 | export default { | 170 | export default { |
171 | + components: { | ||
172 | + uParse | ||
173 | + }, | ||
138 | data() { | 174 | data() { |
139 | return { | 175 | return { |
140 | isShowImg: false, | 176 | isShowImg: false, |
@@ -148,104 +184,182 @@ | @@ -148,104 +184,182 @@ | ||
148 | pointImg2: require("../../static/img_03.png"), | 184 | pointImg2: require("../../static/img_03.png"), |
149 | // 点赞人员 | 185 | // 点赞人员 |
150 | pointList: ['关心', '思想是根基', '陈cc', '莫妮卡', '莫妮卡', '大鹏', '思想是根基', '陈cc', '思想是根基', '陈cc', '莫妮卡'], | 186 | pointList: ['关心', '思想是根基', '陈cc', '莫妮卡', '莫妮卡', '大鹏', '思想是根基', '陈cc', '思想是根基', '陈cc', '莫妮卡'], |
151 | - courseid: '', | 187 | + customs_id: '', |
152 | coursedetail: '', | 188 | coursedetail: '', |
153 | next: '', | 189 | next: '', |
154 | pre: '', | 190 | pre: '', |
155 | number: 1, | 191 | number: 1, |
156 | //是否显示评论 | 192 | //是否显示评论 |
157 | - showcomment:false, | 193 | + |
158 | //所有用户课程列表 | 194 | //所有用户课程列表 |
159 | courselist: [], | 195 | courselist: [], |
160 | - // 自己课程列表, | ||
161 | - | 196 | + //评论列表, |
197 | + commentlist: [], | ||
198 | + last_customs: '', | ||
199 | + next_customs: '', | ||
200 | + courseid: '', | ||
201 | + page: 1, | ||
202 | + customcontent: '', | ||
203 | + imgurl:'', | ||
204 | + showimg:false | ||
205 | + | ||
206 | + | ||
162 | 207 | ||
163 | }; | 208 | }; |
164 | }, | 209 | }, |
165 | methods: { | 210 | methods: { |
166 | - //获取课程详情 | ||
167 | - getcoursedetail() { | ||
168 | - let that = this; | ||
169 | - var url = '/api/course/customs_detail'; | ||
170 | - var params = { | ||
171 | - course_id: that.courseid, | 211 | + preview(src, e) { |
212 | + // do something | ||
213 | + }, | ||
214 | + navigate(href, e) { | ||
215 | + // do something | ||
216 | + }, | ||
217 | + | ||
218 | + // 预览图片 | ||
219 | + viewimg(item){ | ||
220 | + this.imgurl=item; | ||
221 | + this.showimg=true | ||
222 | + }, | ||
223 | + hideshowimg(){ | ||
224 | + this.showimg=false | ||
225 | + }, | ||
226 | + text(details) { | ||
227 | + | ||
228 | + var texts = ''; //待拼接的内容 | ||
229 | + | ||
230 | + while (details.indexOf('<img') != -1) { //寻找img 循环 | ||
231 | + | ||
232 | + texts += details.substring('0', details.indexOf('<img') + 4); //截取到<img前面的内容 | ||
233 | + | ||
234 | + details = details.substring(details.indexOf('<img') + 4); //<img 后面的内容 | ||
235 | + | ||
236 | + if (details.indexOf('style=') != -1 && details.indexOf('style=') < details.indexOf('>')) { | ||
237 | + | ||
238 | + texts += details.substring(0, details.indexOf('style="') + 7) + "max-width:100%;height:auto;margin:0 auto;"; //从 <img 后面的内容 截取到style= 加上自己要加的内容 | ||
172 | 239 | ||
240 | + details = details.substring(details.indexOf('style="') + 7); //style后面的内容拼接 | ||
241 | + | ||
242 | + } else { | ||
243 | + | ||
244 | + texts += ' style="max-width:100%;height:auto;margin:0 auto;" '; | ||
245 | + | ||
246 | + } | ||
173 | } | 247 | } |
174 | - app.post(url, params).then((res) => { | ||
175 | - console.log(res); | ||
176 | - that.coursedetail = res | ||
177 | - that.getcordlist() | ||
178 | - that.getallcordlist() | ||
179 | 248 | ||
249 | + texts += details; //最后拼接的内容 | ||
180 | 250 | ||
181 | - }).catch((err) => { | 251 | + return texts |
182 | 252 | ||
183 | - }) | ||
184 | }, | 253 | }, |
185 | - | ||
186 | - // 获取自己打卡记录 | ||
187 | - getcordlist() { | 254 | + //获关卡详情 |
255 | + getcustomdetail() { | ||
188 | let that = this; | 256 | let that = this; |
189 | - console.log(77889900) | ||
190 | - var url = '/api/clock/clock_log'; | 257 | + var url = '/api/course/customs_detail'; |
191 | var params = { | 258 | var params = { |
192 | - course_id: that.coursedetail.course_id, | ||
193 | - customs_id: that.coursedetail.id | 259 | + customs_id: that.customs_id, |
260 | + | ||
194 | } | 261 | } |
195 | app.post(url, params).then((res) => { | 262 | app.post(url, params).then((res) => { |
196 | - console.log(res); | ||
197 | - that.courselist = res.list | ||
198 | - | 263 | + console.log('8909876654', res); |
264 | + that.coursedetail = res.present_customs; | ||
265 | + that.number = res.num; | ||
266 | + that.last_customs = res.last_customs; | ||
267 | + that.next_customs = res.next_customs; | ||
268 | + var text = this.text(res.present_customs.content); | ||
269 | + this.customcontent = text; | ||
270 | + console.log(this.customcontent) | ||
271 | + // that.getcordlist() | ||
272 | + that.page = 1; | ||
273 | + that.courselist = [] | ||
274 | + that.getallcordlist() | ||
199 | 275 | ||
200 | 276 | ||
201 | }).catch((err) => { | 277 | }).catch((err) => { |
202 | 278 | ||
203 | }) | 279 | }) |
204 | }, | 280 | }, |
281 | + | ||
205 | //获取所有打卡记录 | 282 | //获取所有打卡记录 |
206 | getallcordlist() { | 283 | getallcordlist() { |
207 | let that = this; | 284 | let that = this; |
208 | console.log(77889900) | 285 | console.log(77889900) |
209 | var url = '/api/course/user_clock_list'; | 286 | var url = '/api/course/user_clock_list'; |
210 | var params = { | 287 | var params = { |
211 | - course_id: that.coursedetail.course_id, | ||
212 | - customs_id: that.coursedetail.id | 288 | + |
289 | + customs_id: that.coursedetail.id, | ||
290 | + page: that.page | ||
291 | + | ||
213 | } | 292 | } |
214 | app.post(url, params).then((res) => { | 293 | app.post(url, params).then((res) => { |
215 | console.log(res); | 294 | console.log(res); |
216 | - that.courselist = that.courselist.concat(res.list) | 295 | + var userid = uni.getStorageSync("userid"); |
296 | + console.log('999887', userid) | ||
297 | + for (var obj of res) { | ||
298 | + obj.showcomment = false; | ||
299 | + obj.content=obj.content.split('&hc').join('\n'); | ||
300 | + // obj.praise=false; | ||
301 | + if (obj.user_id == userid) { | ||
302 | + obj.isuser = true | ||
303 | + } else { | ||
304 | + obj.isuser = false | ||
305 | + } | ||
306 | + } | ||
217 | 307 | ||
218 | 308 | ||
309 | + that.courselist = that.courselist.concat(res); | ||
310 | + | ||
311 | + | ||
312 | + that.courselist = that.courselist; | ||
313 | + console.log(that.courselist, '90908080') | ||
314 | + | ||
219 | 315 | ||
220 | }).catch((err) => { | 316 | }).catch((err) => { |
221 | 317 | ||
222 | }) | 318 | }) |
223 | }, | 319 | }, |
320 | + preivewimg(e){ | ||
321 | + let that=this; | ||
322 | + console.log(e) | ||
323 | + let index=e.currentTarget.dataset.index; | ||
324 | + let indexk=e.currentTarget.dataset.indexk; | ||
325 | + console.log(index); | ||
326 | + console.log(indexk) | ||
327 | + | ||
328 | + console.log(that.courselist[index].images) | ||
329 | + uni.previewImage({ | ||
330 | + current:that.courselist[index].images[indexk], | ||
331 | + urls: that.courselist[index].images, | ||
332 | + success: function (res) { }, | ||
333 | + fail: function (res) { }, | ||
334 | + complete: function (res) { }, | ||
335 | + }) | ||
336 | + }, | ||
224 | 337 | ||
225 | // 上一关 | 338 | // 上一关 |
226 | prestep() { | 339 | prestep() { |
227 | var that = this; | 340 | var that = this; |
228 | - that.number++; | ||
229 | - var url = '/api/course/customs_choose'; | 341 | + |
342 | + var url = '/api/course/customs_detail'; | ||
230 | var params = { | 343 | var params = { |
231 | - // course_id: that.courseid, | ||
232 | - // customs_id:that.coursedetail.id | ||
233 | - course_id: 1, | ||
234 | - customs_id: 1 | ||
235 | - | 344 | + customs_id: that.last_customs.id |
236 | } | 345 | } |
237 | app.post(url, params).then((res) => { | 346 | app.post(url, params).then((res) => { |
238 | console.log(res); | 347 | console.log(res); |
239 | - that.next = res.next; | ||
240 | - that.per = res.pre | ||
241 | - if (res.next != '') { | ||
242 | - that.coursedetail = res.next; | ||
243 | - } else( | ||
244 | - uni.showToast({ | ||
245 | - title: '没有下一关了', | ||
246 | - icon: "none" | ||
247 | - }) | ||
248 | - ) | 348 | + that.last_customs = res.last_customs; |
349 | + that.next_customs = res.next_customs; | ||
350 | + that.coursedetail = res.present_customs; | ||
351 | + that.last_customs = res.last_customs; | ||
352 | + that.next_customs = res.next_customs | ||
353 | + that.number = that.number - 1; | ||
354 | + var text = that.text(res.present_customs.content); | ||
355 | + that.customcontent = text; | ||
356 | + console.log(this.customcontent) | ||
357 | + | ||
358 | + | ||
359 | + that.courselist = []; | ||
360 | + that.page = 1; | ||
361 | + that.getallcordlist(); | ||
362 | + | ||
249 | 363 | ||
250 | 364 | ||
251 | 365 | ||
@@ -256,27 +370,43 @@ | @@ -256,27 +370,43 @@ | ||
256 | // 下一关 | 370 | // 下一关 |
257 | nextstep() { | 371 | nextstep() { |
258 | var that = this; | 372 | var that = this; |
259 | - that.number++; | ||
260 | - var url = '/api/course/customs_choose'; | ||
261 | - var params = { | ||
262 | - // course_id: that.courseid, | ||
263 | - // customs_id:that.coursedetail.id | ||
264 | - course_id: 1, | ||
265 | - customs_id: 1 | 373 | + if (that.coursedetail.is_clock == 0) { |
374 | + uni.showToast({ | ||
375 | + title: '您还没有在这一关打卡,无法解锁下一关', | ||
376 | + icon: "none" | ||
377 | + }) | ||
378 | + return false | ||
379 | + } | ||
380 | + | ||
381 | + if (that.next_customs == '') { | ||
266 | 382 | ||
383 | + uni.showToast({ | ||
384 | + title: '没有下一关了', | ||
385 | + icon: "none" | ||
386 | + }) | ||
387 | + return false | ||
388 | + } | ||
389 | + var url = '/api/course/customs_detail'; | ||
390 | + var params = { | ||
391 | + customs_id: that.next_customs.id | ||
267 | } | 392 | } |
268 | app.post(url, params).then((res) => { | 393 | app.post(url, params).then((res) => { |
269 | console.log(res); | 394 | console.log(res); |
270 | - that.next = res.next; | ||
271 | - that.per = res.pre | ||
272 | - if (res.next != '') { | ||
273 | - that.coursedetail = res.next; | ||
274 | - } else( | ||
275 | - uni.showToast({ | ||
276 | - title: '没有下一关了', | ||
277 | - icon: "none" | ||
278 | - }) | ||
279 | - ) | 395 | + |
396 | + // that.next = res.next; | ||
397 | + // that.per = res.pre | ||
398 | + | ||
399 | + that.coursedetail = res.present_customs; | ||
400 | + that.last_customs = res.last_customs; | ||
401 | + that.next_customs = res.next_customs | ||
402 | + that.number++; | ||
403 | + var text = that.text(res.present_customs.content); | ||
404 | + that.customcontent = text; | ||
405 | + console.log(this.customcontent) | ||
406 | + that.courselist = []; | ||
407 | + that.page = 1; | ||
408 | + that.getallcordlist() | ||
409 | + | ||
280 | 410 | ||
281 | 411 | ||
282 | 412 | ||
@@ -286,18 +416,37 @@ | @@ -286,18 +416,37 @@ | ||
286 | }, | 416 | }, |
287 | 417 | ||
288 | // 去打卡记录页 | 418 | // 去打卡记录页 |
289 | - | ||
290 | - | ||
291 | - toRecord() { | 419 | + toRecord(item) { |
420 | + console.log('888', this.courseid) | ||
421 | + var item = item | ||
292 | uni.navigateTo({ | 422 | uni.navigateTo({ |
293 | - url: "/pages/course/recordClock" | 423 | + url: "/pages/course/recordClock?courseid=" + this.courseid + '&user_id=' + item.user_id + '&customs_id=' + this.customs_id |
294 | }) | 424 | }) |
295 | }, | 425 | }, |
296 | // 去提交打卡页 | 426 | // 去提交打卡页 |
297 | toSubmit() { | 427 | toSubmit() { |
428 | + | ||
429 | + | ||
430 | + if(this.coursedetail.course_is_clock==1){ | ||
431 | + wx.showToast({ | ||
432 | + title:'您今天已经打过卡了', | ||
433 | + icon:'none' | ||
434 | + }) | ||
435 | + }else{ | ||
436 | + uni.navigateTo({ | ||
437 | + url: '/pages/course/submitClock?courseid=' + this.courseid + '&custom_id=' + this.coursedetail.id | ||
438 | + }) | ||
439 | + } | ||
298 | 440 | ||
441 | + | ||
442 | + }, | ||
443 | + // 修改打卡 | ||
444 | + changeclock(item) { | ||
445 | + // var item=JSON.stringify(item) | ||
299 | uni.navigateTo({ | 446 | uni.navigateTo({ |
300 | - url: '/pages/course/submitClock?courseid=' + this.courseid + '&custom_id=' + this.coursedetail.id | 447 | + url: '/pages/course/submitClock?clock_log_id=' + item.id + '&change=' + 1 + '&courseid=' + this.courseid + |
448 | + '&custom_id=' + this.coursedetail.id + "&changetype=" + 1 | ||
449 | + | ||
301 | }) | 450 | }) |
302 | }, | 451 | }, |
303 | // 完成事件打分 | 452 | // 完成事件打分 |
@@ -314,81 +463,201 @@ | @@ -314,81 +463,201 @@ | ||
314 | this.isShowImg = false; | 463 | this.isShowImg = false; |
315 | }, | 464 | }, |
316 | // 评论 | 465 | // 评论 |
317 | - comment(e) { | ||
318 | - console.log(e) | ||
319 | - let id = e.currentTarget.dataset.id; | ||
320 | - console.log(id) | 466 | + comment(item) { |
467 | + // console.log(e) | ||
468 | + let clock_log_id = item.id; | ||
469 | + | ||
470 | + uni.navigateTo({ | ||
471 | + url: '/pages/course/courseComment?clock_log_id=' + clock_log_id + '&customs_id=' + item.customs_id + | ||
472 | + '&commenttype=' + 1 | ||
473 | + }) | ||
474 | + }, | ||
475 | + | ||
476 | + // 回复评论 | ||
477 | + replay(item, itemone) { | ||
478 | + console.log('0000', itemone,this.courseid) | ||
479 | + let clock_log_id = item.id; | ||
480 | + | ||
321 | uni.navigateTo({ | 481 | uni.navigateTo({ |
322 | - url: '/pages/course/courseComment?id=' + id + '&courseid=' + this.courseid | 482 | + url: '/pages/course/courseComment?clock_log_id=' + clock_log_id + '&customs_id=' + item.customs_id + |
483 | + '&commenttype=' + 1 + '&comments_id=' + itemone.id+'&courseid='+this.courseid | ||
323 | }) | 484 | }) |
324 | }, | 485 | }, |
486 | + | ||
325 | //查看所有评论 | 487 | //查看所有评论 |
326 | - seemore(e){ | ||
327 | - let id = e.currentTarget.dataset.id; | ||
328 | - let that = this; | ||
329 | - var url = '/api/comments/get_news_comment'; | ||
330 | - var params = { | ||
331 | - clock_log_id: id, | ||
332 | - | ||
333 | - } | ||
334 | - app.post(url, params).then((res) => { | ||
335 | - console.log(res); | ||
336 | - that.commentlsit=res.list; | ||
337 | - that.showcomment=true | ||
338 | - | ||
339 | - | ||
340 | - | ||
341 | - }).catch((err) => { | ||
342 | - | ||
343 | - }) | 488 | + seemore(id, index) { |
489 | + let that = this; | ||
490 | + var url = '/api/comments/comments'; | ||
491 | + var params = { | ||
492 | + clock_log_id: id, | ||
493 | + } | ||
494 | + app.post(url, params).then((res) => { | ||
495 | + console.log(res); | ||
496 | + that.commentlist = res; | ||
497 | + if (res.length == 0) { | ||
498 | + uni.showToast({ | ||
499 | + title: '暂无评论', | ||
500 | + icon: "none" | ||
501 | + }) | ||
502 | + } else { | ||
503 | + that.showcomment = true | ||
504 | + that.courselist.forEach(function(value,indexk,array){ | ||
505 | + if(index==indexk){ | ||
506 | + that.courselist[index].showcomment = !that.courselist[index].showcomment; | ||
507 | + }else{ | ||
508 | + that.courselist[indexk].showcomment=false | ||
509 | + } | ||
510 | + }) | ||
511 | + | ||
512 | + that.courselist = that.courselist; | ||
513 | + } | ||
514 | + | ||
515 | + | ||
516 | + | ||
517 | + }).catch((err) => { | ||
518 | + | ||
519 | + }) | ||
344 | }, | 520 | }, |
521 | + | ||
522 | + | ||
345 | // 长按删除评论 | 523 | // 长按删除评论 |
346 | - del(e){ | ||
347 | - let id = e.currentTarget.dataset.id; | 524 | + dele(item, index) { |
525 | + | ||
526 | + let that = this; | ||
527 | + | ||
348 | uni.showModal({ | 528 | uni.showModal({ |
349 | - title: '提示', | ||
350 | - content: '删除此条评论', | ||
351 | - success: function (res) { | ||
352 | - if (res.confirm) { | ||
353 | - let that = this; | ||
354 | - var url = '/api/comments/del'; | ||
355 | - var params = { | ||
356 | - id:id | ||
357 | - | ||
358 | - } | ||
359 | - app.post(url, params).then((res) => { | ||
360 | - console.log(res); | ||
361 | - uni.showToast({ | ||
362 | - title:'删除成功', | ||
363 | - icon:'none' | ||
364 | - }) | ||
365 | - | ||
366 | - | ||
367 | - | ||
368 | - }).catch((err) => { | ||
369 | - | ||
370 | - }) | ||
371 | - | ||
372 | - } else if (res.cancel) { | ||
373 | - console.log('用户点击取消'); | ||
374 | - } | ||
375 | - } | 529 | + title: '提示', |
530 | + content: '删除此条评论', | ||
531 | + success: function(res) { | ||
532 | + | ||
533 | + if (res.confirm) { | ||
534 | + | ||
535 | + var url = '/api/comments/del'; | ||
536 | + var params = { | ||
537 | + id: item.id | ||
538 | + } | ||
539 | + app.post(url, params).then((res) => { | ||
540 | + console.log(res); | ||
541 | + uni.showToast({ | ||
542 | + title: '删除成功', | ||
543 | + icon: 'none' | ||
544 | + }) | ||
545 | + setTimeout(function() { | ||
546 | + that.commentlist.splice(index, 1) | ||
547 | + that.commentlist = that.commentlist; | ||
548 | + }, 1500) | ||
549 | + | ||
550 | + | ||
551 | + | ||
552 | + }).catch((err) => { | ||
553 | + | ||
554 | + }) | ||
555 | + | ||
556 | + } else if (res.cancel) { | ||
557 | + console.log('用户点击取消'); | ||
558 | + } | ||
559 | + } | ||
376 | }); | 560 | }); |
561 | + | ||
562 | + | ||
377 | }, | 563 | }, |
378 | - | ||
379 | - | 564 | + |
565 | + | ||
566 | + | ||
380 | // 点赞 | 567 | // 点赞 |
381 | - changePoint(e) { | ||
382 | - let id = e.currentTarget.dataset.id; | ||
383 | - this.isPoint = !this.isPoint | 568 | + changePoint(item, index) { |
569 | + console.log(item) | ||
570 | + let that = this; | ||
571 | + that.customs_id = item.customs_id; | ||
572 | + var nickname = uni.getStorageSync("nickname"); | ||
573 | + console.log(nickname) | ||
574 | + | ||
575 | + var url = '/api/praise/praise'; | ||
576 | + var params = { | ||
577 | + clock_log_id: item.id, | ||
578 | + | ||
579 | + } | ||
580 | + app.post(url, params).then((res) => { | ||
581 | + console.log(res); | ||
582 | + that.courselist[index].is_praise = !that.courselist[index].is_praise | ||
583 | + | ||
584 | + if (that.courselist[index].is_praise == 1) { | ||
585 | + uni.showToast({ | ||
586 | + title: '点赞成功', | ||
587 | + icon: 'none' | ||
588 | + }) | ||
589 | + var obj = { | ||
590 | + user: { | ||
591 | + nickname: nickname | ||
592 | + } | ||
593 | + } | ||
594 | + | ||
595 | + that.courselist[index].praise_user.push(obj); | ||
596 | + that.courselist = that.courselist; | ||
597 | + console.log('998877',that.courselist) | ||
598 | + | ||
599 | + | ||
600 | + // that.getcustomdetail() | ||
601 | + | ||
602 | + | ||
603 | + } else { | ||
604 | + uni.showToast({ | ||
605 | + title: '取消点赞成功', | ||
606 | + icon: 'none' | ||
607 | + }) | ||
608 | + console.log(that.courselist) | ||
609 | + | ||
610 | + that.courselist[index].praise_user.forEach(function(value, indexk, array) { | ||
611 | + console.log(that.courselist[index].praise_user[indexk].user.nickname) | ||
612 | + if (that.courselist[index].praise_user[indexk].user.nickname == nickname) { | ||
613 | + | ||
614 | + that.courselist[index].praise_user.splice(indexk, 1) | ||
615 | + } | ||
616 | + }) | ||
617 | + | ||
618 | + that.courselist = that.courselist; | ||
619 | + console.log('998877',that.courselist) | ||
620 | + | ||
621 | + | ||
622 | + } | ||
623 | + | ||
624 | + | ||
625 | + | ||
626 | + }).catch((err) => { | ||
627 | + | ||
628 | + }) | ||
629 | + | ||
384 | }, | 630 | }, |
631 | + | ||
632 | + | ||
633 | + }, | ||
634 | + onShow() { | ||
635 | + this.getcustomdetail(); | ||
636 | + | ||
385 | }, | 637 | }, |
386 | - onShow() {}, | ||
387 | onLoad(options) { | 638 | onLoad(options) { |
388 | console.log(options) | 639 | console.log(options) |
389 | - this.courseid = options.id; | ||
390 | - this.getcoursedetail() | ||
391 | - } | 640 | + this.customs_id = options.id; |
641 | + this.courseid = options.courseid; | ||
642 | + | ||
643 | + | ||
644 | + }, | ||
645 | + onReachBottom() { | ||
646 | + var newpage = this.page; | ||
647 | + newpage++; | ||
648 | + this.page = newpage | ||
649 | + this.getallcordlist() | ||
650 | + }, | ||
651 | + onShareAppMessage(res) { | ||
652 | + let that=this; | ||
653 | + if (res.from === 'button') {// 来自页面内分享按钮 | ||
654 | + console.log(res.target) | ||
655 | + } | ||
656 | + return { | ||
657 | + title: '关卡详情', | ||
658 | + path:'/pages/course/courseIntro?id='+that.courseid | ||
659 | + } | ||
660 | + } | ||
392 | }; | 661 | }; |
393 | </script> | 662 | </script> |
394 | 663 | ||
@@ -396,12 +665,56 @@ | @@ -396,12 +665,56 @@ | ||
396 | page { | 665 | page { |
397 | background-color: #fafbfd; | 666 | background-color: #fafbfd; |
398 | } | 667 | } |
668 | + .imagebox{ | ||
669 | + flex-wrap: wrap; | ||
670 | + width:479rpx; | ||
671 | + } | ||
672 | + .iamgeitem{ | ||
673 | + width:140rpx; | ||
674 | + height:140rpx; | ||
675 | + font-size: 0; | ||
676 | + margin-right:20rpx; | ||
677 | + margin-bottom:20rpx; | ||
678 | + } | ||
679 | + .ganwu{ | ||
680 | + display:flex; | ||
681 | + } | ||
682 | + | ||
683 | + .addimg { | ||
684 | + width: 100rpx; | ||
685 | + height: 100rpx; | ||
686 | + font-size: 0; | ||
687 | + margin-right: 20rpx; | ||
688 | + margin-top: 20rpx; | ||
689 | + } | ||
690 | + | ||
691 | + .namedianzan { | ||
692 | + margin-right: 10rpx; | ||
693 | + } | ||
694 | + | ||
695 | + .layer_noend { | ||
696 | + padding-bottom: 32rpx; | ||
697 | + box-sizing: border-box; | ||
698 | + } | ||
699 | + | ||
700 | + .touxiang { | ||
701 | + width: 92rpx; | ||
702 | + height: 92rpx; | ||
703 | + border-radius: 50%; | ||
704 | + font-size: 0; | ||
705 | + margin-right: 0.32rem; | ||
706 | + } | ||
707 | + | ||
708 | + .touxiang image { | ||
709 | + border-radius: 50%; | ||
710 | + } | ||
399 | 711 | ||
400 | .seemore { | 712 | .seemore { |
401 | color: #ee8b27; | 713 | color: #ee8b27; |
402 | font-weight: 600; | 714 | font-weight: 600; |
403 | - font-size:30rpx; | ||
404 | - margin-top:10rpx; | 715 | + font-size: 30rpx; |
716 | + margin-top: 10rpx; | ||
717 | + margin-bottom: 20rpx; | ||
405 | 718 | ||
406 | } | 719 | } |
407 | 720 | ||
@@ -460,6 +773,7 @@ | @@ -460,6 +773,7 @@ | ||
460 | color: #06121e; | 773 | color: #06121e; |
461 | font-size: 24upx; | 774 | font-size: 24upx; |
462 | text-align: left; | 775 | text-align: left; |
776 | + margin-top:30rpx; | ||
463 | } | 777 | } |
464 | 778 | ||
465 | // 按钮 | 779 | // 按钮 |
@@ -474,6 +788,7 @@ | @@ -474,6 +788,7 @@ | ||
474 | color: #fff; | 788 | color: #fff; |
475 | font-size: 28upx; | 789 | font-size: 28upx; |
476 | margin: 0 auto; | 790 | margin: 0 auto; |
791 | + margin-top:46rpx; | ||
477 | } | 792 | } |
478 | } | 793 | } |
479 | 794 | ||
@@ -486,7 +801,7 @@ | @@ -486,7 +801,7 @@ | ||
486 | background: rgba(255, 255, 255, 1); | 801 | background: rgba(255, 255, 255, 1); |
487 | box-shadow: 0px 0px 6upx rgba(0, 0, 0, 0.04); | 802 | box-shadow: 0px 0px 6upx rgba(0, 0, 0, 0.04); |
488 | border-radius: 8upx; | 803 | border-radius: 8upx; |
489 | - padding: 56upx 32upx; | 804 | + padding: 56upx 32upx 0 32upx; |
490 | margin-bottom: 32upx; | 805 | margin-bottom: 32upx; |
491 | 806 | ||
492 | // 人员信息 | 807 | // 人员信息 |
@@ -533,7 +848,7 @@ | @@ -533,7 +848,7 @@ | ||
533 | 848 | ||
534 | // 课程信息 | 849 | // 课程信息 |
535 | .single_course { | 850 | .single_course { |
536 | - padding: 42upx 0; | 851 | + padding: 42upx 0 0; |
537 | font-size: 28upx; | 852 | font-size: 28upx; |
538 | color: #06121e; | 853 | color: #06121e; |
539 | 854 | ||
@@ -607,12 +922,13 @@ | @@ -607,12 +922,13 @@ | ||
607 | // 评论信息 | 922 | // 评论信息 |
608 | .comment_msg { | 923 | .comment_msg { |
609 | border-top: 1px solid #eee; | 924 | border-top: 1px solid #eee; |
610 | - padding-top: 30upx; | 925 | + // padding-top: 30upx; |
926 | + padding-bottom: 20upx; | ||
611 | 927 | ||
612 | // 点赞人员 | 928 | // 点赞人员 |
613 | .point_people { | 929 | .point_people { |
614 | 930 | ||
615 | - margin-bottom: 28upx; | 931 | + margin-bottom: 20upx; |
616 | 932 | ||
617 | image { | 933 | image { |
618 | width: 32upx; | 934 | width: 32upx; |
@@ -644,6 +960,8 @@ | @@ -644,6 +960,8 @@ | ||
644 | } | 960 | } |
645 | } | 961 | } |
646 | } | 962 | } |
963 | + | ||
964 | + | ||
647 | } | 965 | } |
648 | } | 966 | } |
649 | 967 |
1 | + | ||
1 | <template> | 2 | <template> |
3 | + | ||
2 | <!-- 课程介绍 --> | 4 | <!-- 课程介绍 --> |
3 | <view class="course_intro"> | 5 | <view class="course_intro"> |
4 | <!-- 课程名称 --> | 6 | <!-- 课程名称 --> |
5 | - | ||
6 | - <view class="intro_title">{{ title }}</view> | 7 | + <view class="intro_title">{{item.title}}</view> |
7 | <!-- banner --> | 8 | <!-- banner --> |
8 | <view class="intro_banner"> | 9 | <view class="intro_banner"> |
9 | <view class="banner_box"> | 10 | <view class="banner_box"> |
10 | <image :src="item.image" mode=""></image> | 11 | <image :src="item.image" mode=""></image> |
11 | <!-- 分享 --> | 12 | <!-- 分享 --> |
12 | - <view class="intro_share layout_row" > | 13 | + <view class="intro_share layout_row"> |
13 | <image src="../../static/fenxiang_icon@2x.png" mode="widthFix"></image> | 14 | <image src="../../static/fenxiang_icon@2x.png" mode="widthFix"></image> |
14 | 分享 | 15 | 分享 |
15 | - <button open-type="share"></button> | 16 | + |
17 | + <button class="lj_share" open-type='share'>分享</button> | ||
18 | + | ||
19 | + <!-- <button open-type="share"></button> --> | ||
16 | </view> | 20 | </view> |
17 | </view> | 21 | </view> |
18 | </view> | 22 | </view> |
19 | - | ||
20 | - | ||
21 | - | ||
22 | <!-- 课程介绍 --> | 23 | <!-- 课程介绍 --> |
23 | <view class="course_des"> | 24 | <view class="course_des"> |
24 | <!-- 标题 --> | 25 | <!-- 标题 --> |
25 | <view class="descrip_title">课程介绍</view> | 26 | <view class="descrip_title">课程介绍</view> |
26 | <!-- 介绍内容 --> | 27 | <!-- 介绍内容 --> |
27 | - <view class="intro" v-html="item.content"> | ||
28 | - | 28 | + <view class="intro" id="editorDetail" > |
29 | + <!-- v-html="content" --> | ||
30 | + <u-parse :content="content" @preview="preview" @navigate="navigate" ></u-parse> | ||
31 | + | ||
29 | </view> | 32 | </view> |
30 | 33 | ||
31 | <view class="contentimg"> | 34 | <view class="contentimg"> |
@@ -45,23 +48,37 @@ | @@ -45,23 +48,37 @@ | ||
45 | </template> | 48 | </template> |
46 | 49 | ||
47 | <script> | 50 | <script> |
51 | +import uParse from '@/components/u-parse/u-parse.vue' | ||
48 | import app from "../../App.vue"; | 52 | import app from "../../App.vue"; |
49 | export default { | 53 | export default { |
54 | + components: { | ||
55 | + uParse | ||
56 | + }, | ||
50 | data() { | 57 | data() { |
51 | return { | 58 | return { |
52 | - title: '【深潜挑战】 21天', | 59 | + title: '', |
53 | content:"", | 60 | content:"", |
54 | courseid:'', | 61 | courseid:'', |
55 | item:'', | 62 | item:'', |
63 | + present_customs:'', | ||
64 | + next_customs:'' | ||
65 | + | ||
56 | }; | 66 | }; |
57 | }, | 67 | }, |
58 | methods: { | 68 | methods: { |
69 | + preview(src, e) { | ||
70 | + // do something | ||
71 | + }, | ||
72 | + navigate(href, e) { | ||
73 | + // do something | ||
74 | + }, | ||
59 | // 介绍内容 后台的富文本数据 | 75 | // 介绍内容 后台的富文本数据 |
60 | onEditorReady() { | 76 | onEditorReady() { |
61 | let t = this; | 77 | let t = this; |
62 | uni.createSelectorQuery() | 78 | uni.createSelectorQuery() |
63 | .select('#editorDetail') | 79 | .select('#editorDetail') |
64 | .context(res => { | 80 | .context(res => { |
81 | + console.log(res) | ||
65 | this.editorCtx = res.context; | 82 | this.editorCtx = res.context; |
66 | let content = { | 83 | let content = { |
67 | html: t.content | 84 | html: t.content |
@@ -71,6 +88,61 @@ export default { | @@ -71,6 +88,61 @@ export default { | ||
71 | .exec(); | 88 | .exec(); |
72 | }, | 89 | }, |
73 | 90 | ||
91 | + text(details) { | ||
92 | + | ||
93 | + var texts = '';//待拼接的内容 | ||
94 | + | ||
95 | + while (details.indexOf('<img') != -1) {//寻找img 循环 | ||
96 | + | ||
97 | + texts += details.substring('0', details.indexOf('<img') + 4);//截取到<img前面的内容 | ||
98 | + | ||
99 | + details = details.substring(details.indexOf('<img') + 4);//<img 后面的内容 | ||
100 | + | ||
101 | + if (details.indexOf('style=') != -1 && details.indexOf('style=') < details.indexOf('>')) { | ||
102 | + | ||
103 | + texts += details.substring(0, details.indexOf('style="') + 7) + "max-width:100%;height:auto;margin:0 auto;";//从 <img 后面的内容 截取到style= 加上自己要加的内容 | ||
104 | + | ||
105 | + details = details.substring(details.indexOf('style="') + 7); //style后面的内容拼接 | ||
106 | + | ||
107 | + } else { | ||
108 | + | ||
109 | + texts += ' style="max-width:100%;height:auto;margin:0 auto;" '; | ||
110 | + | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + texts += details;//最后拼接的内容 | ||
115 | + | ||
116 | + return texts | ||
117 | + | ||
118 | + }, | ||
119 | + // 获取课程详情 | ||
120 | + getcoursedetail(){ | ||
121 | + let that = this; | ||
122 | + console.log('00001112222',that.courseid) | ||
123 | + var url = '/api/course/course_detail'; | ||
124 | + var params = { | ||
125 | + course_id: that.courseid, | ||
126 | + | ||
127 | + } | ||
128 | + app.post(url, params,"post").then((res) => { | ||
129 | + console.log('876655',res); | ||
130 | + that.present_customs=res.present_customs; | ||
131 | + that.next_customs=res.next_customs; | ||
132 | + // 把富文本图片给加一个最大宽度 | ||
133 | + | ||
134 | + this.item = res.data; | ||
135 | + var text=this.text(res.data.content) | ||
136 | + this.content=text; | ||
137 | + | ||
138 | + | ||
139 | + | ||
140 | + }).catch((err) => { | ||
141 | + console.log(err) | ||
142 | + | ||
143 | + }) | ||
144 | + }, | ||
145 | + | ||
74 | // 进入课程 | 146 | // 进入课程 |
75 | toDetail(){ | 147 | toDetail(){ |
76 | let token=uni.getStorageSync("token") | 148 | let token=uni.getStorageSync("token") |
@@ -81,14 +153,37 @@ export default { | @@ -81,14 +153,37 @@ export default { | ||
81 | }) | 153 | }) |
82 | 154 | ||
83 | setTimeout(function(){ | 155 | setTimeout(function(){ |
156 | + console.log(9999) | ||
84 | uni.navigateTo({ | 157 | uni.navigateTo({ |
85 | - url:'/pages/index/index' | 158 | + url:'/pages/start/start' |
86 | }) | 159 | }) |
87 | },1500) | 160 | },1500) |
88 | }else{ | 161 | }else{ |
89 | - uni.navigateTo({ | ||
90 | - url:"/pages/course/courseDetail?id="+this.item.id | ||
91 | - }) | 162 | + |
163 | + if(this.present_customs==''){ | ||
164 | + uni.showToast({ | ||
165 | + title:'此课程没有关卡', | ||
166 | + icon:'none' | ||
167 | + }) | ||
168 | + } else if(this.item.is_auth==2){ | ||
169 | + uni.showToast({ | ||
170 | + title:"您没有权限看此课程", | ||
171 | + icon:"none" | ||
172 | + }) | ||
173 | + | ||
174 | + setTimeout(function(){ | ||
175 | + uni.navigateTo({ | ||
176 | + // url:'/pages/start/start?id='+that.courseid+'&type='+1 | ||
177 | + url:'/pages/index/index' | ||
178 | + }) | ||
179 | + },1500) | ||
180 | + | ||
181 | + }else{ | ||
182 | + uni.navigateTo({ | ||
183 | + url:"/pages/course/courseDetail?id="+this.present_customs.id+'&courseid='+this.courseid | ||
184 | + }) | ||
185 | + } | ||
186 | + | ||
92 | } | 187 | } |
93 | 188 | ||
94 | }, | 189 | }, |
@@ -99,55 +194,73 @@ export default { | @@ -99,55 +194,73 @@ export default { | ||
99 | }) | 194 | }) |
100 | }, | 195 | }, |
101 | }, | 196 | }, |
102 | - | ||
103 | - onShareAppMessage(res) { | ||
104 | - if (res.from === 'button') { | ||
105 | - // 来自页面内分享按钮 | ||
106 | - console.log(res.target); | ||
107 | - } | ||
108 | - return { | ||
109 | - title: '自定义分享标题', | ||
110 | - path: '/pages/test/test?id=123' | ||
111 | - }; | 197 | + share(){ |
198 | + | ||
112 | }, | 199 | }, |
200 | + | ||
201 | + | ||
113 | onLoad(options){ | 202 | onLoad(options){ |
114 | - var item=wx.getStorageSync("item"); | ||
115 | - // item=JSON.parse(item); | ||
116 | - console.log(item) | ||
117 | - | 203 | + let that=this; |
204 | + console.log('99999999',options) | ||
118 | 205 | ||
119 | 206 | ||
207 | + this.courseid=options.id; | ||
208 | + console.log('222558774411') | ||
120 | 209 | ||
121 | - // var itemname=JSON.parse(options.item); | ||
122 | - // console.log(item) | ||
123 | - this.item=item | ||
124 | - | ||
125 | - | 210 | + this.getcoursedetail() |
211 | + let token=uni.getStorageSync("token"); | ||
212 | + if(token==''){ | ||
213 | + uni.showToast({ | ||
214 | + title:"请先登陆", | ||
215 | + icon:'none' | ||
216 | + }) | ||
217 | + setTimeout(function(){ | ||
218 | + uni.navigateTo({ | ||
219 | + url:'../start/start?id='+that.courseid+'&type='+1 | ||
220 | + }) | ||
221 | + },1500) | ||
222 | + } | ||
126 | 223 | ||
127 | }, | 224 | }, |
128 | - | ||
129 | - onShareAppMessage: function (res) { | ||
130 | - var that = this; | ||
131 | - | ||
132 | - | ||
133 | - // 来自页面内转发按钮 | ||
134 | - return { | ||
135 | - title: '分享', | ||
136 | - path: "/pages/course/courseIntro?id="+that.item.id | ||
137 | - | ||
138 | - } | ||
139 | - | 225 | + onUnload: function () { |
226 | + uni.reLaunch({ | ||
227 | + url:'/pages/index/index' | ||
228 | + }) | ||
229 | + }, | ||
230 | + | ||
231 | + onShareAppMessage(res) { | ||
232 | + let that=this; | ||
233 | + if (res.from === 'button') {// 来自页面内分享按钮 | ||
234 | + console.log(res.target) | ||
235 | + } | ||
236 | + return { | ||
237 | + title: this.item.title, | ||
238 | + path:'/pages/course/courseIntro?id='+that.courseid | ||
239 | + } | ||
140 | } | 240 | } |
141 | 241 | ||
242 | + | ||
243 | + | ||
142 | }; | 244 | }; |
143 | </script> | 245 | </script> |
144 | 246 | ||
247 | +<style> | ||
248 | + | ||
249 | +</style> | ||
250 | + | ||
145 | <style lang="scss"> | 251 | <style lang="scss"> |
252 | + | ||
253 | + image{ | ||
254 | + display:block; | ||
255 | + width:100%; | ||
256 | + } | ||
146 | .intro{ | 257 | .intro{ |
147 | width:686rpx; | 258 | width:686rpx; |
148 | color:#06121E; | 259 | color:#06121E; |
149 | font-size: 24rpx; | 260 | font-size: 24rpx; |
150 | margin:28rpx auto 0; | 261 | margin:28rpx auto 0; |
262 | + padding-bottom: 150rpx; | ||
263 | + box-sizing: border-box; | ||
151 | } | 264 | } |
152 | .course_intro { | 265 | .course_intro { |
153 | .intro_title { | 266 | .intro_title { |
@@ -5,217 +5,610 @@ | @@ -5,217 +5,610 @@ | ||
5 | <view class="record_people layer_nostar"> | 5 | <view class="record_people layer_nostar"> |
6 | <view class="people_l layer_nostar"> | 6 | <view class="people_l layer_nostar"> |
7 | <!-- 头像 --> | 7 | <!-- 头像 --> |
8 | - <image src="../../static/header.png" mode="" @click="toRecord()"></image> | 8 | + <view class="touxiang"> |
9 | + <image :src="user.avatar" mode="" @click="toRecord()"></image> | ||
10 | + </view> | ||
11 | + | ||
9 | <view class=""> | 12 | <view class=""> |
10 | <!-- 姓名 --> | 13 | <!-- 姓名 --> |
11 | - <view class="people_name">张三</view> | 14 | + <view class="people_name">{{user.nickname}}</view> |
12 | <!-- 课程进度 --> | 15 | <!-- 课程进度 --> |
13 | - <view class="people_progress">已解锁2课时</view> | 16 | + <view class="people_progress">已解锁{{unlock_customs_num}}课时</view> |
14 | </view> | 17 | </view> |
15 | </view> | 18 | </view> |
16 | </view> | 19 | </view> |
17 | <!-- 本次打卡记录 --> | 20 | <!-- 本次打卡记录 --> |
18 | <view class="record_msg"> | 21 | <view class="record_msg"> |
19 | <!-- 课程信息 --> | 22 | <!-- 课程信息 --> |
20 | - <view class="record_course"> | 23 | + <view class="record_course" v-for="(item,index) in courselist" :key="index"> |
21 | <!-- 右侧 --> | 24 | <!-- 右侧 --> |
22 | - <view class="people_r" @click="toSubmit()">修改</view> | 25 | + <!-- <view class="people_r" @click="toSubmit()">修改</view> --> |
23 | <!-- 课程名称 --> | 26 | <!-- 课程名称 --> |
24 | <view class="layer_star course_name course_single"> | 27 | <view class="layer_star course_name course_single"> |
25 | <image class="course_icon" src="../../static/icon_01.png" mode=""></image> | 28 | <image class="course_icon" src="../../static/icon_01.png" mode=""></image> |
26 | - <view class="">【深潜挑战】 21天专注力挑战</view> | 29 | + <view class="coursetitle">{{item.course_title}}</view> |
27 | </view> | 30 | </view> |
28 | <view class="layer_star course_single"> | 31 | <view class="layer_star course_single"> |
29 | <image class="course_icon" src="../../static/icon_02.png" mode=""></image> | 32 | <image class="course_icon" src="../../static/icon_02.png" mode=""></image> |
30 | - <view class="">第2课</view> | 33 | + <view class="coursetitle">{{item.customs_title}}</view> |
31 | </view> | 34 | </view> |
32 | - <view class="layer_star no_icon_single"><view class="">学习时间:2019年12月26日</view></view> | ||
33 | - <view class="layer_star no_icon_single"><view class="">感悟:好</view></view> | ||
34 | <view class="layer_star no_icon_single"> | 35 | <view class="layer_star no_icon_single"> |
35 | - 完成事件打分: | ||
36 | - <picker mode="selector" :range="completeList" @change="changeComplete"> | ||
37 | - <view class="score_picker layer_between"> | ||
38 | - <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> | ||
39 | - <image src="../../static/start_01.png" mode="widthFix"></image> | ||
40 | - </view> | ||
41 | - </picker> | 36 | + <view class="">学习时间:{{item.createtime}}</view> |
42 | </view> | 37 | </view> |
43 | <view class="layer_star no_icon_single"> | 38 | <view class="layer_star no_icon_single"> |
44 | - 情绪状态打分: | ||
45 | - <picker mode="selector" :range="completeList" @change="changeComplete"> | ||
46 | - <view class="score_picker layer_between"> | ||
47 | - <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> | ||
48 | - <image src="../../static/start_01.png" mode="widthFix"></image> | 39 | + <view class="ganwu"><view>感悟:</view><text>{{item.content}}</text> </view> |
40 | + </view> | ||
41 | + <view class=" no_icon_single ganwu" v-if="item.images!=null"> | ||
42 | + <view style="width:100rpx;"> | ||
43 | + | ||
44 | + </view> | ||
45 | + <view class="imagebox flexone"> | ||
46 | + <view class="iamgeitem" v-for="(item,indexk) in item.images" :key="indexk" :data-url="item" :data-index="index" :data-indexk="indexk" @click="preivewimg"> | ||
47 | + <image :src="item"></image> | ||
49 | </view> | 48 | </view> |
50 | - </picker> | 49 | + </view> |
51 | </view> | 50 | </view> |
51 | + <view class="layer_star no_icon_single" v-for="(itemsec,index) in item.clock_score" :key="index"> | ||
52 | + {{itemsec.title}}: | ||
53 | + <view class="score_picker layer_between">{{itemsec.score}}</view> | ||
54 | + | ||
55 | + </view> | ||
56 | + | ||
57 | + | ||
58 | + | ||
52 | <!-- 评论、点赞按钮 --> | 59 | <!-- 评论、点赞按钮 --> |
53 | <view class="layer_noend"> | 60 | <view class="layer_noend"> |
54 | - <view class="course_btn justify_between" @click="toComment()"> | 61 | + <view class="course_btn justify_between" @click="comment" :data-id="item.id"> |
55 | <image src="../../static/pinglun_icon@2x.png" mode="widthFix"></image> | 62 | <image src="../../static/pinglun_icon@2x.png" mode="widthFix"></image> |
56 | 评论 | 63 | 评论 |
57 | </view> | 64 | </view> |
58 | - <view class="course_btn justify_between" :class="{ active: isPoint }" @click="changePoint()"> | ||
59 | - <image :src="isPoint ? pointImg2 : pointImg1" mode="widthFix"></image> | ||
60 | - 点赞 | 65 | + <view class="course_btn justify_between" :class="{active:item.is_praise==1}" @click="changePoint(item,index)" |
66 | + :data-id="item.id"> | ||
67 | + <image :src="item.is_praise==1?pointImg2:pointImg1" mode="widthFix"></image> | ||
68 | + <text v-if="item.is_praise==1">已赞</text> | ||
69 | + <text v-else>点赞</text> | ||
61 | </view> | 70 | </view> |
62 | </view> | 71 | </view> |
72 | + <!-- 评论、点赞信息 --> | ||
73 | + <view class="comment_msg"> | ||
74 | + <!-- 点赞人员 --> | ||
75 | + <view class="point_people layer_nostar"> | ||
76 | + <image src="../../static/dianzan_icon@2x.png" mode="widthFix" v-if="item.praise_user.length!=0"></image> | ||
77 | + <view class="point_detail flex_wrap_no"> | ||
78 | + <view class="namedianzan" v-for="(itemone, index) in item.praise_user" :key="index">{{itemone.user.nickname }}</view> | ||
79 | + </view> | ||
80 | + </view> | ||
81 | + <view class="seemore" @click="seemore(item.id,index)" :data-id="item.id" v-if="item.is_comment==1">查看所有评论</view> | ||
82 | + <!-- 评论信息 --> | ||
83 | + <view class="msg_detail" v-if="item.showcomment==true"> | ||
84 | + <view class="detail_single " v-for="(itemone,indexk) in commentlist" :key="indexk" @longtap="del(itemone,indexk)" | ||
85 | + :data-id="itemone.id"> | ||
86 | + <view v-if="itemone.user2" @click="replay(item,itemnone)"> | ||
87 | + <text>{{itemone.user1.nickname}} <text class="huifu">回复</text> {{itemone.user2.nickname}}</text> | ||
88 | + {{itemone.content}} | ||
89 | + | ||
90 | + <view class="flexone"> | ||
91 | + <view class="addimg" v-for="(itemimg,index) in itemone.images" :key="index" @click.stop="viewimg(itemimg)"> | ||
92 | + <image class="add_img" :src="itemimg" mode=""></image> | ||
93 | + </view> | ||
94 | + </view> | ||
95 | + </view> | ||
96 | + | ||
97 | + <view v-else @click="replay(item,itemone)"> | ||
98 | + <text>{{itemone.user1.nickname}}:</text>{{itemone.content}} | ||
99 | + | ||
100 | + <view class="flexone"> | ||
101 | + <view class="addimg" v-for="(itemimg,index) in itemone.images" :key="index" @click.stop="viewimg(itemimg)"> | ||
102 | + <image class="add_img" :src="itemimg" mode=""></image> | ||
103 | + </view> | ||
104 | + </view> | ||
105 | + </view> | ||
106 | + | ||
107 | + </view> | ||
108 | + | ||
109 | + | ||
110 | + | ||
111 | + </view> | ||
112 | + </view> | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + </view> | ||
117 | + | ||
118 | + | ||
119 | + </view> | ||
120 | + | ||
121 | + <!-- 遮罩层 --> | ||
122 | + <view class="register" v-if="showimg" @click="hideshowimg"> | ||
123 | + <view class="viewimg"> | ||
124 | + <image :src="imgurl" mode="aspectFit"></image> | ||
63 | </view> | 125 | </view> |
64 | </view> | 126 | </view> |
65 | - | ||
66 | - | ||
67 | </view> | 127 | </view> |
68 | </template> | 128 | </template> |
69 | 129 | ||
70 | <script> | 130 | <script> |
71 | -export default { | ||
72 | - data() { | ||
73 | - return { | ||
74 | - completeList: ['1', '2', '3'], | ||
75 | - complete: '', | ||
76 | - // 点赞 | ||
77 | - isPoint:false, | ||
78 | - pointImg1:require("../../static/zan_icon@2x.png"), | ||
79 | - pointImg2:require("../../static/img_03.png"), | ||
80 | - }; | ||
81 | - }, | ||
82 | - methods: { | ||
83 | - // 去提交打卡页 | ||
84 | - toSubmit(){ | ||
85 | - uni.navigateTo({ | ||
86 | - url:"/pages/course/submitClock" | ||
87 | - }) | 131 | + import app from "../../App.vue"; |
132 | + export default { | ||
133 | + data() { | ||
134 | + return { | ||
135 | + completeList: ['1', '2', '3'], | ||
136 | + complete: '', | ||
137 | + // 点赞 | ||
138 | + isPoint: false, | ||
139 | + pointImg1: require("../../static/zan_icon@2x.png"), | ||
140 | + pointImg2: require("../../static/img_03.png"), | ||
141 | + page: 1, | ||
142 | + courseid: '', | ||
143 | + user_id: '', | ||
144 | + courselist: [], | ||
145 | + unlock_customs_num: '', | ||
146 | + user: '', | ||
147 | + customs_id: '', | ||
148 | + commentlist: [], | ||
149 | + imgurl:'', | ||
150 | + showimg:false | ||
151 | + }; | ||
88 | }, | 152 | }, |
89 | - // 去评论页 | ||
90 | - toComment(){ | ||
91 | - uni.navigateTo({ | ||
92 | - url:"/pages/course/courseComment" | ||
93 | - }) | 153 | + methods: { |
154 | + | ||
155 | + // 获取打卡列表 | ||
156 | + getcordlist() { | ||
157 | + let that = this; | ||
158 | + console.log(77889900) | ||
159 | + var url = '/api/course/course_clock_list'; | ||
160 | + var params = { | ||
161 | + user_id: that.user_id, | ||
162 | + course_id: that.courseid, | ||
163 | + page: that.page | ||
164 | + } | ||
165 | + app.post(url, params).then((res) => { | ||
166 | + console.log(res); | ||
167 | + // let userid = uni.getStorageSync("userid") | ||
168 | + for (var obj of res.data) { | ||
169 | + obj.showcomment = false; | ||
170 | + | ||
171 | + | ||
172 | + } | ||
173 | + that.courselist = that.courselist.concat(res.data); | ||
174 | + that.user = res.user; | ||
175 | + that.unlock_customs_num = res.unlock_customs_num | ||
176 | + | ||
177 | + | ||
178 | + that.courselist = that.courselist; | ||
179 | + console.log(that.courselist, '90908080') | ||
180 | + | ||
181 | + | ||
182 | + }).catch((err) => { | ||
183 | + | ||
184 | + }) | ||
185 | + }, | ||
186 | + preivewimg(e){ | ||
187 | + let that=this; | ||
188 | + console.log(e) | ||
189 | + let index=e.currentTarget.dataset.index; | ||
190 | + let indexk=e.currentTarget.dataset.indexk; | ||
191 | + console.log(index); | ||
192 | + console.log(indexk) | ||
193 | + | ||
194 | + console.log(that.courselist[index].images) | ||
195 | + uni.previewImage({ | ||
196 | + current:that.courselist[index].images[indexk], | ||
197 | + urls: that.courselist[index].images, | ||
198 | + success: function (res) { }, | ||
199 | + fail: function (res) { }, | ||
200 | + complete: function (res) { }, | ||
201 | + }) | ||
202 | + }, | ||
203 | + | ||
204 | + // 预览图片 | ||
205 | + viewimg(item){ | ||
206 | + this.imgurl=item; | ||
207 | + this.showimg=true | ||
208 | + }, | ||
209 | + hideshowimg(){ | ||
210 | + this.showimg=false | ||
211 | + }, | ||
212 | + // 评论 | ||
213 | + comment(e) { | ||
214 | + console.log(e) | ||
215 | + let clock_log_id = e.currentTarget.dataset.id; | ||
216 | + | ||
217 | + uni.navigateTo({ | ||
218 | + url: '/pages/course/courseComment?clock_log_id=' + clock_log_id + '&customs_id=' + this.customs_id + | ||
219 | + '&commenttype=' + 2 + '&courseid=' + this.courseid + "&user_id=" + this.user_id | ||
220 | + }) | ||
221 | + }, | ||
222 | + | ||
223 | + // 回复评论 | ||
224 | + replay(item, itemone) { | ||
225 | + console.log('0000', itemone) | ||
226 | + let clock_log_id = item.id; | ||
227 | + | ||
228 | + uni.navigateTo({ | ||
229 | + url: '/pages/course/courseComment?clock_log_id=' + clock_log_id + '&customs_id=' + item.customs_id + | ||
230 | + '&commenttype=' + 2 + '&comments_id=' + itemone.id + '&courseid=' + this.courseid + "&user_id=" + this.user_id | ||
231 | + }) | ||
232 | + }, | ||
233 | + seemore(id, index) { | ||
234 | + | ||
235 | + let that = this; | ||
236 | + var url = '/api/comments/comments'; | ||
237 | + var params = { | ||
238 | + clock_log_id: id, | ||
239 | + } | ||
240 | + app.post(url, params).then((res) => { | ||
241 | + console.log(res); | ||
242 | + that.commentlist = res; | ||
243 | + if (res.length == 0) { | ||
244 | + uni.showToast({ | ||
245 | + title: '暂无评论', | ||
246 | + icon: "none" | ||
247 | + }) | ||
248 | + } else { | ||
249 | + that.courselist.forEach(function(value, indexk, array) { | ||
250 | + if (index == indexk) { | ||
251 | + that.courselist[index].showcomment = !that.courselist[index].showcomment; | ||
252 | + } else { | ||
253 | + that.courselist[indexk].showcomment = false | ||
254 | + } | ||
255 | + }) | ||
256 | + that.courselist = that.courselist; | ||
257 | + console.log(that.courselist) | ||
258 | + } | ||
259 | + | ||
260 | + | ||
261 | + | ||
262 | + }).catch((err) => { | ||
263 | + | ||
264 | + }) | ||
265 | + }, | ||
266 | + | ||
267 | + | ||
268 | + | ||
269 | + | ||
270 | + // 长按删除评论 | ||
271 | + del(item, index) { | ||
272 | + let that = this; | ||
273 | + | ||
274 | + console.log('87665', index) | ||
275 | + uni.showModal({ | ||
276 | + title: '提示', | ||
277 | + content: '删除此条评论', | ||
278 | + success: function(res) { | ||
279 | + | ||
280 | + if (res.confirm) { | ||
281 | + | ||
282 | + var url = '/api/comments/del'; | ||
283 | + var params = { | ||
284 | + id: item.id | ||
285 | + } | ||
286 | + app.post(url, params).then((res) => { | ||
287 | + console.log(res); | ||
288 | + uni.showToast({ | ||
289 | + title: '删除成功', | ||
290 | + icon: 'none' | ||
291 | + }) | ||
292 | + that.commentlist.splice(index, 1) | ||
293 | + that.commentlist = that.commentlist; | ||
294 | + | ||
295 | + }).catch((err) => { | ||
296 | + | ||
297 | + }) | ||
298 | + | ||
299 | + } else if (res.cancel) { | ||
300 | + console.log('用户点击取消'); | ||
301 | + } | ||
302 | + } | ||
303 | + }); | ||
304 | + | ||
305 | + | ||
306 | + }, | ||
307 | + | ||
308 | + // 点赞 | ||
309 | + changePoint(item, index) { | ||
310 | + | ||
311 | + | ||
312 | + let that = this; | ||
313 | + var nickname = uni.getStorageSync("nickname"); | ||
314 | + console.log('99887', that.user) | ||
315 | + var url = '/api/praise/praise'; | ||
316 | + var params = { | ||
317 | + clock_log_id: item.id, | ||
318 | + | ||
319 | + } | ||
320 | + app.post(url, params).then((res) => { | ||
321 | + console.log(res); | ||
322 | + that.courselist[index].is_praise = !that.courselist[index].is_praise | ||
323 | + if (that.courselist[index].is_praise == 1) { | ||
324 | + uni.showToast({ | ||
325 | + title: '点赞成功', | ||
326 | + icon: 'none' | ||
327 | + }) | ||
328 | + | ||
329 | + var obj = { | ||
330 | + user: { | ||
331 | + nickname: nickname | ||
332 | + } | ||
333 | + } | ||
334 | + | ||
335 | + that.courselist[index].praise_user.push(obj); | ||
336 | + that.courselist = that.courselist; | ||
337 | + // that.getcoursedetail | ||
338 | + | ||
339 | + } else { | ||
340 | + uni.showToast({ | ||
341 | + title: '取消点赞成功', | ||
342 | + icon: 'none' | ||
343 | + }) | ||
344 | + | ||
345 | + that.courselist[index].praise_user.forEach(function(value, indexk, array) { | ||
346 | + if (that.courselist[index].praise_user[indexk].user.nickname == nickname) { | ||
347 | + that.courselist[index].praise_user.splice(indexk, 1) | ||
348 | + } | ||
349 | + }) | ||
350 | + | ||
351 | + that.courselist = that.courselist; | ||
352 | + } | ||
353 | + | ||
354 | + }).catch((err) => { | ||
355 | + | ||
356 | + }) | ||
357 | + | ||
358 | + }, | ||
359 | + | ||
94 | }, | 360 | }, |
95 | - // 完成事件打分 | ||
96 | - changeComplete(e) { | ||
97 | - this.complete = e.detail.value; | 361 | + onLoad(options) { |
362 | + console.log(options) | ||
363 | + this.courseid = options.courseid; | ||
364 | + this.user_id = options.user_id; | ||
365 | + this.customs_id = options.customs_id | ||
366 | + this.getcordlist() | ||
367 | + | ||
98 | }, | 368 | }, |
99 | - // 点赞 | ||
100 | - changePoint(){ | ||
101 | - this.isPoint = !this.isPoint | 369 | + onReachBottom() { |
370 | + var newpage = this.page; | ||
371 | + newpage++; | ||
372 | + this.page = newpage | ||
373 | + this.getcordlist() | ||
102 | }, | 374 | }, |
103 | - }, | ||
104 | -}; | 375 | + }; |
105 | </script> | 376 | </script> |
106 | 377 | ||
107 | <style lang="scss"> | 378 | <style lang="scss"> |
108 | - page{ | 379 | + page { |
109 | background-color: #fafbfd; | 380 | background-color: #fafbfd; |
110 | } | 381 | } |
111 | -.record_clock { | ||
112 | - // 打卡人信息 | ||
113 | - .record_people { | ||
114 | - padding: 62upx 32upx; | ||
115 | - height: 254upx; | ||
116 | - background-color: #ee8b27; | ||
117 | - // 左侧 | ||
118 | - .people_l { | ||
119 | - color: #fff; | ||
120 | - // 头像 | ||
121 | - image { | ||
122 | - width: 92upx; | ||
123 | - height: 92upx; | ||
124 | - margin-right: 32upx; | ||
125 | - } | ||
126 | - // 姓名 | ||
127 | - .people_name { | ||
128 | - font-size: 32upx; | ||
129 | - margin-bottom: 12upx; | ||
130 | - } | ||
131 | - // 课程进度 | ||
132 | - .people_progress { | ||
133 | - font-size: 24upx; | ||
134 | - } | ||
135 | - } | 382 | + .imagebox{ |
383 | + flex-wrap: wrap; | ||
384 | + width:479rpx; | ||
136 | } | 385 | } |
137 | - // 本次打卡记录 | ||
138 | - .record_msg { | ||
139 | - padding: 0 32upx; | ||
140 | - .record_course { | ||
141 | - position: relative; | ||
142 | - margin-top: -172upx; | ||
143 | - background-color: #fff; | ||
144 | - box-shadow: 0 0 12upx rgba(0, 0, 0, 0.04); | ||
145 | - border-radius: 8upx; | ||
146 | - padding: 56upx 32upx; | ||
147 | - // 修改按钮 | ||
148 | - .people_r { | ||
149 | - width: 112upx; | ||
150 | - height: 56upx; | ||
151 | - position: absolute; | ||
152 | - top: 56upx; | ||
153 | - right: 32upx; | ||
154 | - border: 1px solid rgba(238, 139, 39, 1); | ||
155 | - border-radius: 8upx; | ||
156 | - color: #ee8b27; | ||
157 | - font-size: 24upx; | ||
158 | - text-align: center; | ||
159 | - line-height: 56upx; | ||
160 | - } | ||
161 | - .course_icon { | ||
162 | - width: 32upx; | ||
163 | - height: 32upx; | ||
164 | - } | ||
165 | - .course_name { | ||
166 | - color: #ee8b27; | ||
167 | - } | ||
168 | - .course_single { | ||
169 | - margin-bottom: 14upx; | 386 | + .iamgeitem{ |
387 | + width:140rpx; | ||
388 | + height:140rpx; | ||
389 | + font-size: 0; | ||
390 | + margin-right:20rpx; | ||
391 | + margin-bottom:20rpx; | ||
392 | + } | ||
393 | + .ganwu{ | ||
394 | + display:flex; | ||
395 | + } | ||
396 | + | ||
397 | + .namedianzan { | ||
398 | + margin-right: 10rpx; | ||
399 | + } | ||
400 | + | ||
401 | + .addimg { | ||
402 | + width: 100rpx; | ||
403 | + height: 100rpx; | ||
404 | + font-size: 0; | ||
405 | + margin-right: 20rpx; | ||
406 | + margin-top: 20rpx; | ||
407 | + } | ||
408 | + | ||
409 | + .touxiang { | ||
410 | + width: 92rpx; | ||
411 | + height: 92rpx; | ||
412 | + border-radius: 50%; | ||
413 | + font-size: 0; | ||
414 | + margin-right: 0.32rem; | ||
415 | + } | ||
416 | + | ||
417 | + .touxiang image { | ||
418 | + border-radius: 50%; | ||
419 | + } | ||
420 | + | ||
421 | + .coursetitle { | ||
422 | + font-size: 28rpx; | ||
423 | + } | ||
424 | + | ||
425 | + .seemore { | ||
426 | + color: #ee8b27; | ||
427 | + font-weight: 600; | ||
428 | + font-size: 30rpx; | ||
429 | + margin-top: 10rpx; | ||
430 | + | ||
431 | + } | ||
432 | + | ||
433 | + .layer_noend { | ||
434 | + padding-bottom: 32rpx; | ||
435 | + box-sizing: border-box; | ||
436 | + } | ||
437 | + | ||
438 | + .record_clock { | ||
439 | + | ||
440 | + // 打卡人信息 | ||
441 | + .record_people { | ||
442 | + padding: 62upx 32upx; | ||
443 | + height: 254upx; | ||
444 | + background-color: #ee8b27; | ||
445 | + | ||
446 | + // 左侧 | ||
447 | + .people_l { | ||
448 | + color: #fff; | ||
449 | + | ||
450 | + // 头像 | ||
170 | image { | 451 | image { |
171 | - margin-right: 20upx; | 452 | + width: 92upx; |
453 | + height: 92upx; | ||
454 | + margin-right: 32upx; | ||
172 | } | 455 | } |
173 | - view{ | ||
174 | - width: 432upx; | ||
175 | - overflow: hidden; | ||
176 | - text-overflow: ellipsis; | ||
177 | - white-space: nowrap; | 456 | + |
457 | + // 姓名 | ||
458 | + .people_name { | ||
459 | + font-size: 32upx; | ||
460 | + margin-bottom: 12upx; | ||
461 | + } | ||
462 | + | ||
463 | + // 课程进度 | ||
464 | + .people_progress { | ||
465 | + font-size: 24upx; | ||
178 | } | 466 | } |
179 | } | 467 | } |
180 | - // 无图标 | ||
181 | - .no_icon_single { | ||
182 | - padding-left: 52upx; | ||
183 | - font-size: 28upx; | ||
184 | - color: #06121e; | ||
185 | - margin-bottom: 14upx; | ||
186 | - // 选择框 | ||
187 | - .score_picker { | ||
188 | - width: 156upx; | ||
189 | - height: 46upx; | ||
190 | - background: rgba(249, 249, 249, 1); | 468 | + } |
469 | + | ||
470 | + // 本次打卡记录 | ||
471 | + .record_msg { | ||
472 | + padding: 0 32upx; | ||
473 | + position: relative; | ||
474 | + margin-top: -172rpx; | ||
475 | + | ||
476 | + .record_course { | ||
477 | + position: relative; | ||
478 | + // margin-top: -172upx; | ||
479 | + background-color: #fff; | ||
480 | + box-shadow: 0 0 12upx rgba(0, 0, 0, 0.04); | ||
481 | + border-radius: 8upx; | ||
482 | + padding: 56upx 32upx 0; | ||
483 | + box-sizing: border-box; | ||
484 | + margin-bottom:26rpx; | ||
485 | + | ||
486 | + // 修改按钮 | ||
487 | + .people_r { | ||
488 | + width: 112upx; | ||
489 | + height: 56upx; | ||
490 | + position: absolute; | ||
491 | + top: 56upx; | ||
492 | + right: 32upx; | ||
493 | + border: 1px solid rgba(238, 139, 39, 1); | ||
191 | border-radius: 8upx; | 494 | border-radius: 8upx; |
192 | - padding: 0 12upx 0 46upx; | ||
193 | - color: #bdc4ce; | 495 | + color: #ee8b27; |
194 | font-size: 24upx; | 496 | font-size: 24upx; |
497 | + text-align: center; | ||
498 | + line-height: 56upx; | ||
499 | + } | ||
500 | + | ||
501 | + .course_icon { | ||
502 | + width: 32upx; | ||
503 | + height: 32upx; | ||
504 | + } | ||
505 | + | ||
506 | + .course_name { | ||
507 | + color: #ee8b27; | ||
508 | + } | ||
509 | + | ||
510 | + .course_single { | ||
511 | + margin-bottom: 14upx; | ||
512 | + | ||
195 | image { | 513 | image { |
196 | - width: 20upx; | 514 | + margin-right: 20upx; |
515 | + } | ||
516 | + | ||
517 | + view { | ||
518 | + width: 432upx; | ||
519 | + overflow: hidden; | ||
520 | + text-overflow: ellipsis; | ||
521 | + white-space: nowrap; | ||
197 | } | 522 | } |
198 | } | 523 | } |
199 | - } | ||
200 | - // 评论、点赞 | ||
201 | - .course_btn { | ||
202 | - padding: 12upx 28upx; | ||
203 | - color: #8C9198; | ||
204 | - font-size: 24upx; | ||
205 | - border: 2upx solid rgba(140, 145, 152, 1); | ||
206 | - border-radius: 8upx; | ||
207 | - margin-left: 24upx; | ||
208 | - margin-top: 34upx; | ||
209 | - image { | ||
210 | - width: 32upx; | ||
211 | - margin-right: 14upx; | 524 | + |
525 | + // 无图标 | ||
526 | + .no_icon_single { | ||
527 | + padding-left: 52upx; | ||
528 | + font-size: 28upx; | ||
529 | + color: #06121e; | ||
530 | + margin-bottom: 14upx; | ||
531 | + | ||
532 | + // 选择框 | ||
533 | + .score_picker { | ||
534 | + width: 156upx; | ||
535 | + height: 46upx; | ||
536 | + background: rgba(249, 249, 249, 1); | ||
537 | + border-radius: 8upx; | ||
538 | + padding: 0 12upx 0 46upx; | ||
539 | + color: #bdc4ce; | ||
540 | + font-size: 24upx; | ||
541 | + | ||
542 | + image { | ||
543 | + width: 20upx; | ||
544 | + } | ||
545 | + } | ||
212 | } | 546 | } |
213 | - } | ||
214 | - .active { | ||
215 | - border-color: #ff7441; | ||
216 | - color: #ff7441; | 547 | + |
548 | + // 评论、点赞 | ||
549 | + .course_btn { | ||
550 | + padding: 12upx 28upx; | ||
551 | + color: #8C9198; | ||
552 | + font-size: 24upx; | ||
553 | + border: 2upx solid rgba(140, 145, 152, 1); | ||
554 | + border-radius: 8upx; | ||
555 | + margin-left: 24upx; | ||
556 | + margin-top: 34upx; | ||
557 | + | ||
558 | + image { | ||
559 | + width: 32upx; | ||
560 | + margin-right: 14upx; | ||
561 | + } | ||
562 | + } | ||
563 | + | ||
564 | + .active { | ||
565 | + border-color: #ff7441; | ||
566 | + color: #ff7441; | ||
567 | + } | ||
568 | + | ||
569 | + // 评论信息 | ||
570 | + .comment_msg { | ||
571 | + border-top: 1px solid #eee; | ||
572 | + padding-bottom: 20rpx; | ||
573 | + // padding-top: 30upx; | ||
574 | + | ||
575 | + // 点赞人员 | ||
576 | + .point_people { | ||
577 | + | ||
578 | + margin-bottom: 20upx; | ||
579 | + | ||
580 | + image { | ||
581 | + width: 32upx; | ||
582 | + width: 32upx; | ||
583 | + margin-right: 22upx; | ||
584 | + border-radius: 50%; | ||
585 | + } | ||
586 | + | ||
587 | + .point_detail { | ||
588 | + color: #bdc4ce; | ||
589 | + font-size: 28upx; | ||
590 | + width: 556upx; | ||
591 | + } | ||
592 | + } | ||
593 | + | ||
594 | + // 评论信息 | ||
595 | + .msg_detail { | ||
596 | + color: #5b5e63; | ||
597 | + font-size: 28upx; | ||
598 | + | ||
599 | + .detail_single { | ||
600 | + margin-bottom: 16upx; | ||
601 | + | ||
602 | + text { | ||
603 | + color: #ee8b27; | ||
604 | + font-weight: 600; | ||
605 | + margin-right: 10upx; | ||
606 | + } | ||
607 | + } | ||
608 | + } | ||
609 | + } | ||
610 | + | ||
217 | } | 611 | } |
218 | } | 612 | } |
219 | } | 613 | } |
220 | -} | ||
221 | </style> | 614 | </style> |
@@ -22,63 +22,91 @@ | @@ -22,63 +22,91 @@ | ||
22 | </view> | 22 | </view> |
23 | <!-- 打卡 --> | 23 | <!-- 打卡 --> |
24 | 24 | ||
25 | - <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange"> | 25 | + <!-- <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange"> |
26 | <view class="clock_single layer_nostar">打卡时间:{{date}}</view> | 26 | <view class="clock_single layer_nostar">打卡时间:{{date}}</view> |
27 | - </picker> | 27 | + </picker> --> |
28 | <view class="clock_single layer_nostar"> | 28 | <view class="clock_single layer_nostar"> |
29 | - 打卡感悟: | 29 | + <text class='dakaganwu'>打卡感悟:</text> |
30 | + | ||
30 | <view class="flex_star"> | 31 | <view class="flex_star"> |
31 | - <textarea v-model="content" value="" placeholder="请输入您的打卡感悟" @input="entertext" /> | ||
32 | - <image class="add_img" :src="image==''?'../../static/tianjia_img@2x.png':image" mode="widthFix" @click="chooseImage"></image> | ||
33 | - | 32 | + <textarea v-model="gantext" value="gantext" placeholder="请输入您的打卡感悟" @input="entertext" maxlength="2000"/> |
33 | + | ||
34 | + <view class="flexone imagebox"> | ||
35 | + | ||
36 | + <view class="addimg" v-for="(item,index) in image" :key="index"> | ||
37 | + <image class="add_img" :src="item" mode=""></image> | ||
38 | + <view class="closeimg" @click="deleteimg" :data-url="item"> | ||
39 | + <image src="../../static/close.png"></image> | ||
40 | + </view> | ||
41 | + </view> | ||
42 | + | ||
43 | + <view class="imgadd"> | ||
44 | + <image class="add_img" src="../../static/addpic.png" mode="widthFix" @click="chooseImage"></image> | ||
45 | + </view> | ||
46 | + </view> | ||
34 | </view> | 47 | </view> |
35 | </view> | 48 | </view> |
36 | <!-- 自我打分 --> | 49 | <!-- 自我打分 --> |
37 | <view class="self_mark"> | 50 | <view class="self_mark"> |
38 | <view class="mark_title">自我打分:</view> | 51 | <view class="mark_title">自我打分:</view> |
39 | - <view class="layer_star no_icon_single"> | ||
40 | - 完成事件打分: | ||
41 | - <picker mode="selector" :range="completeList" @change="changeComplete"> | ||
42 | - <view class="score_picker layer_between"> | ||
43 | - <view>{{ completeList[complete] ? completeList[complete] : '请打分' }}</view> | ||
44 | - <image src="../../static/start_01.png" mode="widthFix"></image> | ||
45 | - </view> | ||
46 | - </picker> | ||
47 | - </view> | ||
48 | - <view class="layer_star no_icon_single"> | ||
49 | - 情绪状态打分: | ||
50 | - <picker mode="selector" :range="feeling" @change="changefeel"> | 52 | + <view class="layer_star no_icon_single" v-for="(item,index) in scorelist" :key="index"> |
53 | + {{item.title}}: | ||
54 | + <picker mode="selector" :range="item.score" @change="changeComplete" :value="item.indexk" :data-index="index"> | ||
51 | <view class="score_picker layer_between"> | 55 | <view class="score_picker layer_between"> |
52 | - <view>{{completeList[feelindex] ? completeList[feelindex] : '请打分' }}</view> | 56 | + <view>{{item.name}}</view> |
53 | <image src="../../static/start_01.png" mode="widthFix"></image> | 57 | <image src="../../static/start_01.png" mode="widthFix"></image> |
54 | </view> | 58 | </view> |
55 | </picker> | 59 | </picker> |
56 | </view> | 60 | </view> |
57 | </view> | 61 | </view> |
58 | <!-- 按钮 --> | 62 | <!-- 按钮 --> |
59 | - <view class="submit_btn" @click="submitClock()">打卡</view> | 63 | + <view v-if="item==''"> |
64 | + <view class="submit_btn" @click="submitClock()" v-if="daka==false">打卡</view> | ||
65 | + <view class="submit_btn" v-else>打卡</view> | ||
66 | + </view> | ||
67 | + | ||
68 | + <view v-else> | ||
69 | + <view class="submit_btn" @click="editClock()" v-if="dakak==false"> | ||
70 | + 修改 | ||
71 | + </view> | ||
72 | + <view class="submit_btn" v-else>修改</view> | ||
73 | + | ||
74 | + </view> | ||
75 | + | ||
60 | <!-- 弹窗 --> | 76 | <!-- 弹窗 --> |
61 | <view class="tx_mask" v-if="isDialog" @click="closeDialog"></view> | 77 | <view class="tx_mask" v-if="isDialog" @click="closeDialog"></view> |
62 | <view class="mask_content" v-if="isContent"> | 78 | <view class="mask_content" v-if="isContent"> |
63 | <view class="content_tips">打卡内容不能为空,请重新编辑</view> | 79 | <view class="content_tips">打卡内容不能为空,请重新编辑</view> |
64 | <view class="content_btn" @click="closeDialog">确定</view> | 80 | <view class="content_btn" @click="closeDialog">确定</view> |
65 | </view> | 81 | </view> |
82 | + | ||
83 | + | ||
66 | <!-- 海报 --> | 84 | <!-- 海报 --> |
67 | - <view class="canvas_dialog" v-if="isCanvas"> | ||
68 | - <canvas style="width: 100%;height: 690;backgroundColor: #FFFFFF" canvas-id="myCanvas"></canvas> | ||
69 | - <!-- 保存、分享按钮 --> | ||
70 | - <view class="layer_around share_group_btn"> | ||
71 | - <view class="layer_around share_btn"> | ||
72 | - <image src="../../static/baocun_icon@2x.png" mode="widthFix"></image> | ||
73 | - 保存图片 | 85 | + <view class="register" v-if="isCanvas"> |
86 | + <view class="canvas_dialog" > | ||
87 | + <!-- <canvas style="width: 100%;height: 690;backgroundColor: #FFFFFF" canvas-id="myCanvas"></canvas> --> | ||
88 | + <view class="topimg"> | ||
89 | + <image :src="posterimg"></image> | ||
74 | </view> | 90 | </view> |
75 | - <view class="layer_around share_btn"> | ||
76 | - <image src="../../static/fenxiang_icon@2x.png" mode="widthFix"></image> | ||
77 | - 立即分享 | ||
78 | - <button open-type="share"></button> | 91 | + <!-- 保存、分享按钮 --> |
92 | + <view class="layer_around share_group_btn"> | ||
93 | + <view class="layer_around share_btn" @click="cancel"> | ||
94 | + <image src="../../static/baocun_icon@2x.png" mode="widthFix"></image> | ||
95 | + 取消 | ||
96 | + </view> | ||
97 | + <view class="layer_around share_btn" @click='baocun'> | ||
98 | + <image src="../../static/baocun_icon@2x.png" mode="widthFix"></image> | ||
99 | + 保存图片 | ||
100 | + <!-- <button open-type="share"></button> --> | ||
101 | + </view> | ||
79 | </view> | 102 | </view> |
80 | </view> | 103 | </view> |
104 | + | ||
105 | + | ||
106 | + | ||
81 | </view> | 107 | </view> |
108 | + | ||
109 | + | ||
82 | </view> | 110 | </view> |
83 | </template> | 111 | </template> |
84 | 112 | ||
@@ -122,7 +150,16 @@ export default { | @@ -122,7 +150,16 @@ export default { | ||
122 | // 传的图片 | 150 | // 传的图片 |
123 | cimage:[], | 151 | cimage:[], |
124 | eventid:'', | 152 | eventid:'', |
125 | - ganid:'' | 153 | + ganid:'', |
154 | + item:'', | ||
155 | + change:'', | ||
156 | + posterimg:'', | ||
157 | + // 打分数组 | ||
158 | + scorelist:[], | ||
159 | + clock_log_id:'', | ||
160 | + changetype:'', | ||
161 | + daka:false, | ||
162 | + dakak:false | ||
126 | 163 | ||
127 | 164 | ||
128 | }; | 165 | }; |
@@ -132,11 +169,39 @@ export default { | @@ -132,11 +169,39 @@ export default { | ||
132 | // 设为隐私 | 169 | // 设为隐私 |
133 | 170 | ||
134 | setpricy(){ | 171 | setpricy(){ |
135 | - this.is_privacy=1 | 172 | + |
173 | + this.is_privacy=1; | ||
174 | + // let that=this; | ||
175 | + // let url='/api/clock/set_privacy' | ||
176 | + // let param = { | ||
177 | + // clock_log_id:this.clock_log_id | ||
178 | + // } | ||
179 | + // app.post(url, param) | ||
180 | + // .then(r => { | ||
181 | + // console.log(r) | ||
182 | + // uni.showToast({ | ||
183 | + // title:'设为隐私成功', | ||
184 | + // icon:'none' | ||
185 | + // }) | ||
186 | + // }) | ||
136 | }, | 187 | }, |
137 | // 取消隐私 | 188 | // 取消隐私 |
138 | cancelpricy(){ | 189 | cancelpricy(){ |
139 | - this.is_privacy=2 | 190 | + this.is_privacy=2; |
191 | + // let that=this; | ||
192 | + // let url='/api/clock/set_privacy' | ||
193 | + | ||
194 | + // let param = { | ||
195 | + // clock_log_id:this.clock_log_id | ||
196 | + // } | ||
197 | + // app.post(url, param) | ||
198 | + // .then(r => { | ||
199 | + // console.log(r) | ||
200 | + // uni.showToast({ | ||
201 | + // title:'取消隐私成功', | ||
202 | + // icon:'none' | ||
203 | + // }) | ||
204 | + // }) | ||
140 | }, | 205 | }, |
141 | 206 | ||
142 | // 获取打分项目 | 207 | // 获取打分项目 |
@@ -144,36 +209,45 @@ export default { | @@ -144,36 +209,45 @@ export default { | ||
144 | let that = this; | 209 | let that = this; |
145 | var url = '/api/clock/score_option'; | 210 | var url = '/api/clock/score_option'; |
146 | var params = { | 211 | var params = { |
147 | - | 212 | + course_id:that.course_id |
148 | } | 213 | } |
149 | app.post(url, params,"post").then((res) => { | 214 | app.post(url, params,"post").then((res) => { |
150 | - //事件id 情感id | ||
151 | - that.eventid=res[0].id, | ||
152 | - that.ganid=res[1].id | ||
153 | - // 完成事件 | ||
154 | - if(res[0].min==res[0].max){ | ||
155 | - that.completeList.push(res[0].min) | ||
156 | - | ||
157 | - }else{ | ||
158 | - for(var i=res[0].min;i<res[0].max;i++){ | ||
159 | - console.log(i) | ||
160 | - that.completeList.push(i) | ||
161 | - } | ||
162 | - } | ||
163 | - // 情感状态 | ||
164 | - | ||
165 | - if(res[1].min==res[1].max){ | ||
166 | - that.feeling.push(res[1].min) | ||
167 | - | ||
168 | - }else{ | ||
169 | - for(var i=res[1].min;i<res[1].max;i++){ | ||
170 | - console.log(i) | ||
171 | - that.feeling.push(i) | ||
172 | - } | ||
173 | - } | ||
174 | - that.feeling=that.feeling; | ||
175 | - console.log(that.feeling) | ||
176 | - | 215 | + |
216 | + for(var obj of res){ | ||
217 | + obj.score=[]; | ||
218 | + obj.name='请打分'; | ||
219 | + obj.indexk=0; | ||
220 | + if(obj.min==obj.max){ | ||
221 | + obj.score.push(obj.max) | ||
222 | + }else{ | ||
223 | + for(var i=obj.min;i<=obj.max;i++){ | ||
224 | + obj.score.unshift(i) | ||
225 | + } | ||
226 | + } | ||
227 | + } | ||
228 | + that.scorelist=res | ||
229 | + | ||
230 | + // 给打分项赋默认值 | ||
231 | + if(that.item!=''){ | ||
232 | + for(var i=0;i<that.scorelist.length;i++){ | ||
233 | + for(var j=0;j<that.item.clock_score.length;j++) | ||
234 | + if(that.scorelist[i].title==that.item.clock_score[j].title){ | ||
235 | + that.scorelist[i].name=that.item.clock_score[j].score; | ||
236 | + for(var k=0;k<that.scorelist[i].score.length;k++){ | ||
237 | + if(that.scorelist[i].score[k]==that.item.clock_score[j].score){ | ||
238 | + that.scorelist[i].indexk=k | ||
239 | + | ||
240 | + } | ||
241 | + } | ||
242 | + } | ||
243 | + } | ||
244 | + // 给打分项赋值 | ||
245 | + that.scorelist.forEach(function(value,index,array){ | ||
246 | + that.scorearr[value.id]=value.name | ||
247 | + }) | ||
248 | + } | ||
249 | + that.scorearr=that.scorearr; | ||
250 | + that.scorelist=that.scorelist | ||
177 | 251 | ||
178 | }).catch((err) => { | 252 | }).catch((err) => { |
179 | 253 | ||
@@ -181,25 +255,18 @@ export default { | @@ -181,25 +255,18 @@ export default { | ||
181 | }, | 255 | }, |
182 | // 完成事件打分 | 256 | // 完成事件打分 |
183 | changeComplete(e) { | 257 | changeComplete(e) { |
184 | - let kid=this.eventid; | ||
185 | - let obj={ | ||
186 | - | ||
187 | - } | ||
188 | - obj[this.eventid]=e.detail.value; | ||
189 | - this.complete = e.detail.value; | ||
190 | - this.scorearr[this.eventid]=e.detail.value; | ||
191 | - console.log(this.scorearr) | ||
192 | - }, | ||
193 | - // 情感状态 | ||
194 | - changefeel(e){ | ||
195 | - let obj={ | ||
196 | - | ||
197 | - } | ||
198 | - obj[this.ganid]=e.detail.value; | ||
199 | - this.feelindex=e.detail.value; | ||
200 | - this.scorearr[this.ganid]=e.detail.value; | 258 | + |
259 | + console.log(e) | ||
260 | + let index=e.currentTarget.dataset.index; | ||
261 | + let indexk=e.detail.value | ||
262 | + let newscorelist=this.scorelist; | ||
263 | + newscorelist[index].name=newscorelist[index].score[indexk]; | ||
264 | + this.scorelist=newscorelist; | ||
265 | + // 传值 | ||
266 | + this.scorearr[newscorelist[index].id]=newscorelist[index].score[indexk]; | ||
201 | console.log(this.scorearr) | 267 | console.log(this.scorearr) |
202 | }, | 268 | }, |
269 | + | ||
203 | // 修改日期 | 270 | // 修改日期 |
204 | getDate(type) { | 271 | getDate(type) { |
205 | const date = new Date(); | 272 | const date = new Date(); |
@@ -222,7 +289,9 @@ export default { | @@ -222,7 +289,9 @@ export default { | ||
222 | 289 | ||
223 | // 输入打卡感悟 | 290 | // 输入打卡感悟 |
224 | entertext(e){ | 291 | entertext(e){ |
225 | - this.gantext=e.detail.value ; | 292 | + let str=e.detail.value; |
293 | + str = str.split('&hc').join('\n'); | ||
294 | + this.gantext=str ; | ||
226 | console.log(this.gantext) | 295 | console.log(this.gantext) |
227 | 296 | ||
228 | }, | 297 | }, |
@@ -237,11 +306,16 @@ export default { | @@ -237,11 +306,16 @@ export default { | ||
237 | console.log(res.tempFilePaths[0]) | 306 | console.log(res.tempFilePaths[0]) |
238 | app.upload('image', res.tempFilePaths[0],"post").then((res) => { | 307 | app.upload('image', res.tempFilePaths[0],"post").then((res) => { |
239 | console.log('上传文件', res); | 308 | console.log('上传文件', res); |
240 | - that.image=res.url | ||
241 | - that.cimage=res.kurl | ||
242 | - | ||
243 | - | ||
244 | - | 309 | + console.log('99887',that.image) |
310 | + let newimage=that.image; | ||
311 | + newimage.push(res.url); | ||
312 | + console.log(newimage) | ||
313 | + console.log(res.url) | ||
314 | + that.iamge=newimage | ||
315 | + // that.image.push(res.url) | ||
316 | + // that.cimage.push(res.kurl) | ||
317 | + // that.image=that.image; | ||
318 | + // that.cimage=that.cimage | ||
245 | }).catch((err) => { | 319 | }).catch((err) => { |
246 | console.log(err) | 320 | console.log(err) |
247 | }) | 321 | }) |
@@ -249,114 +323,372 @@ export default { | @@ -249,114 +323,372 @@ export default { | ||
249 | fail: function (res) { } | 323 | fail: function (res) { } |
250 | }) | 324 | }) |
251 | }, | 325 | }, |
252 | - | ||
253 | - | ||
254 | - | ||
255 | - // 提交 | ||
256 | - | ||
257 | - | ||
258 | 326 | ||
327 | + // 删除图片 | ||
328 | + deleteimg(e){ | ||
329 | + console.log(e) | ||
330 | + var url=e.currentTarget.dataset.url; | ||
331 | + console.log(url) | ||
332 | + for(var i=0;i<this.image.length;i++){ | ||
333 | + if(url==this.image[i]){ | ||
334 | + this.image.splice(i,1); | ||
335 | + // this.cimage.splice(i,1) | ||
336 | + } | ||
337 | + } | ||
338 | + this.image=this.image; | ||
339 | + this.cimage=this.cimage; | ||
340 | + | ||
341 | + }, | ||
259 | 342 | ||
343 | + // 获取详情 | ||
344 | + getcordtail(){ | ||
345 | + let that=this; | ||
346 | + let url='/api/clock/edit_clock_view' | ||
347 | + | ||
348 | + let param = { | ||
349 | + clock_log_id:that.clock_log_id | ||
350 | + } | ||
351 | + app.post(url, param) | ||
352 | + .then(r => { | ||
353 | + console.log(r) | ||
354 | + that.item=r; | ||
355 | + console.log('7896754',that.item) | ||
356 | + | ||
357 | + this.gantext=r.content; | ||
358 | + this.date=r.createtime; | ||
359 | + this.is_privacy=r.is_privacy; | ||
360 | + this.image=r.images==null?[]:r.images; | ||
361 | + this.cimage=r.images==null?[]:r.images; | ||
362 | + | ||
363 | + console.log(this.image) | ||
364 | + | ||
365 | + that.getfenshu() | ||
366 | + | ||
367 | + }) | ||
368 | + }, | ||
260 | 369 | ||
370 | + // 提交 | ||
261 | 371 | ||
262 | submitClock() { | 372 | submitClock() { |
263 | var that = this; | 373 | var that = this; |
374 | + that.daka=true | ||
264 | 375 | ||
265 | if (!that.isClick) { | 376 | if (!that.isClick) { |
266 | - | 377 | + |
267 | if(that.gantext==''){ | 378 | if(that.gantext==''){ |
268 | uni.showToast({ | 379 | uni.showToast({ |
269 | title:'请输入打卡感悟', | 380 | title:'请输入打卡感悟', |
270 | icon:"none" | 381 | icon:"none" |
271 | }) | 382 | }) |
272 | - | 383 | + that.daka=false |
273 | return false | 384 | return false |
274 | } | 385 | } |
275 | - if(that.image==''){ | ||
276 | - uni.showToast({ | ||
277 | - title:'请上传图片', | ||
278 | - icon:"none" | ||
279 | - }) | ||
280 | - | ||
281 | - return false | 386 | + |
387 | + | ||
388 | + for(var obj of that.scorelist){ | ||
389 | + if(obj.name=='请打分'){ | ||
390 | + uni.showToast({ | ||
391 | + title:'请选择打分事项', | ||
392 | + icon:'none' | ||
393 | + }) | ||
394 | + that.daka=false | ||
395 | + return false | ||
396 | + } | ||
282 | } | 397 | } |
283 | - console.log(that.scorearr[that.eventid]) | ||
284 | - if(that.scorearr[that.eventid]==undefined){ | 398 | + uni.showLoading({ |
399 | + title: '加载中' | ||
400 | + }); | ||
401 | + | ||
402 | + var url = '/api/clock/clock'; | ||
403 | + var params = { | ||
404 | + content:that.gantext, | ||
405 | + course_id:that.course_id, | ||
406 | + customs_id:that.customs_id, | ||
407 | + images:that.image.join(","), | ||
408 | + clock_score:JSON.stringify(that.scorearr), | ||
409 | + is_privacy:that.is_privacy, | ||
410 | + } | ||
411 | + app.post(url, params).then((res) => { | ||
412 | + uni.hideLoading(); | ||
413 | + console.log(res); | ||
414 | + | ||
415 | + setTimeout(function(){ | ||
416 | + uni.showToast({ | ||
417 | + title: '打卡成功', | ||
418 | + icon: 'success', | ||
419 | + | ||
420 | + }); | ||
421 | + },200) | ||
422 | + | ||
423 | + | ||
424 | + setTimeout(function() { | ||
425 | + uni.showLoading({ | ||
426 | + title: '海报加载中' | ||
427 | + }); | ||
428 | + }, 800); | ||
429 | + | ||
430 | + | ||
431 | + that.posterimg=res.poster; | ||
432 | + that.savefilecode(); | ||
433 | + | ||
434 | + setTimeout(function(){ | ||
435 | + | ||
436 | + uni.hideLoading(); | ||
437 | + | ||
438 | + that.isCanvas=true; | ||
439 | + },2000) | ||
440 | + | ||
441 | + // setTimeout(function() { | ||
442 | + | ||
443 | + // }, 3500); | ||
444 | + }).catch((err) => { | ||
445 | + console.log(err) | ||
446 | + uni.showToast({ | ||
447 | + title:err.msg, | ||
448 | + icon:'none' | ||
449 | + }) | ||
450 | + | ||
451 | + }) | ||
452 | + } | ||
453 | + | ||
454 | + }, | ||
455 | + | ||
456 | + // 修改打卡 | ||
457 | + editClock(){ | ||
458 | + var that=this; | ||
459 | + console.log('448958989') | ||
460 | + that.dakak=true | ||
461 | + if (!that.isClick) { | ||
462 | + | ||
463 | + if(that.gantext==''){ | ||
464 | + | ||
285 | uni.showToast({ | 465 | uni.showToast({ |
286 | - title:'请选择完成事件打分', | 466 | + title:'请输入打卡感悟', |
287 | icon:"none" | 467 | icon:"none" |
288 | }) | 468 | }) |
469 | + that.dakak=false | ||
289 | return false | 470 | return false |
290 | } | 471 | } |
291 | - if(that.scorearr[that.ganid]==undefined){ | ||
292 | - uni.showToast({ | ||
293 | - title:'请选择情感状态打分', | ||
294 | - icon:"none" | ||
295 | - }) | 472 | + // if(that.image==''){ |
473 | + // uni.showToast({ | ||
474 | + // title:'请上传图片', | ||
475 | + // icon:"none" | ||
476 | + // }) | ||
296 | 477 | ||
297 | - return false | 478 | + // return false |
479 | + // } | ||
480 | + | ||
481 | + for(var obj of that.scorelist){ | ||
482 | + if(obj.name=='请打分'){ | ||
483 | + uni.showToast({ | ||
484 | + title:'请选择打分事项', | ||
485 | + icon:'none' | ||
486 | + }) | ||
487 | + that.dakak=false | ||
488 | + return false | ||
489 | + } | ||
298 | } | 490 | } |
299 | 491 | ||
300 | console.log(that.scorearr) | 492 | console.log(that.scorearr) |
301 | - var url = '/api/clock/clock'; | 493 | + var url = '/api/clock/edit_clock'; |
302 | var params = { | 494 | var params = { |
303 | - type: that.type, | 495 | + id:that.clock_log_id, |
304 | content:that.gantext, | 496 | content:that.gantext, |
305 | course_id:that.course_id, | 497 | course_id:that.course_id, |
306 | customs_id:that.customs_id, | 498 | customs_id:that.customs_id, |
307 | - images:that.cimage, | ||
308 | - array:JSON.stringify(that.scorearr), | 499 | + images:that.image==null?'':that.image.join(","), |
500 | + clock_score:JSON.stringify(that.scorearr), | ||
309 | is_privacy:that.is_privacy, | 501 | is_privacy:that.is_privacy, |
310 | } | 502 | } |
311 | app.post(url, params).then((res) => { | 503 | app.post(url, params).then((res) => { |
504 | + | ||
312 | console.log(res); | 505 | console.log(res); |
313 | - // this.isDialog = true; | ||
314 | - // this.isContent = true; | ||
315 | - uni.showToast({ | ||
316 | - title: '打卡成功', | ||
317 | - icon: 'success', | ||
318 | - duration: 3000 | ||
319 | - }); | 506 | + uni.showToast({ |
507 | + title: '修改成功', | ||
508 | + icon: 'seccess', | ||
509 | + duration:1000 | ||
510 | + }); | ||
511 | + console.log(that.changetype) | ||
512 | + | ||
513 | + setTimeout(function(){ | ||
514 | + if(that.changetype==1){ | ||
515 | + uni.navigateTo({ | ||
516 | + url:"/pages/course/courseDetail?id="+that.customs_id+'&courseid='+that.course_id | ||
517 | + }) | ||
518 | + }else{ | ||
519 | + uni.switchTab({ | ||
520 | + url:'/pages/mine/mine' | ||
521 | + }) | ||
522 | + } | ||
523 | + },1500) | ||
524 | + | ||
320 | 525 | ||
321 | }).catch((err) => { | 526 | }).catch((err) => { |
322 | console.log(err) | 527 | console.log(err) |
323 | 528 | ||
324 | }) | 529 | }) |
325 | - | ||
326 | - // setTimeout(function() { | ||
327 | - // // 海报 | ||
328 | - // t.isCanvas = true; | ||
329 | - // t.isDialog = true; | ||
330 | - // t.getCanvas(); | ||
331 | - // }, 3000); | ||
332 | - } | ||
333 | - | 530 | + } |
334 | }, | 531 | }, |
335 | - // 绘制海报 | ||
336 | - getCanvas() { | ||
337 | - var ctx = uni.createCanvasContext('myCanvas'); | ||
338 | - // 背景图 | ||
339 | - // ctx.drawImage("../../static/bg.png", 0, 0, 375, 550); | ||
340 | - // ctx.save(); | ||
341 | - // // 头像圆 | ||
342 | - // ctx.arc(198, 43, 30, 0, 2 * Math.PI) | ||
343 | - // ctx.arcTo(100, 100, 120, 120, 10) | ||
344 | - // ctx.setFillStyle('#fff') | ||
345 | - // ctx.fill() | ||
346 | - // ctx.save() | ||
347 | - // // 头像 | ||
348 | - // ctx.drawImage("../../static/header.png",173,18,50,50); | ||
349 | - // ctx.save(); | ||
350 | - // // 昵称 | ||
351 | - // var name = "赚钱的小李"; | ||
352 | - // ctx.setFontSize(14); | ||
353 | - // ctx.fillText(name,162,90); | ||
354 | - // ctx.save() | ||
355 | - // // 二维码 | ||
356 | - // ctx.drawImage("../../static/qr.png",120,335,140,140); | ||
357 | - // ctx.save(); | ||
358 | - // ctx.draw(); | 532 | + |
533 | + | ||
534 | + baocun: function () { | ||
535 | + console.log(999) | ||
536 | + var that = this | ||
537 | + uni.getSetting({ | ||
538 | + success(res) { | ||
539 | + if (!res.authSetting['scope.writePhotosAlbum']) { | ||
540 | + uni.authorize({ | ||
541 | + scope: 'scope.writePhotosAlbum', | ||
542 | + success() { //这里是用户同意授权后的回调 | ||
543 | + | ||
544 | + | ||
545 | + uni.saveImageToPhotosAlbum({ | ||
546 | + filePath: that.posterimg, | ||
547 | + success(res) { | ||
548 | + uni.showModal({ | ||
549 | + content: '图片已保存到相册', | ||
550 | + showCancel: false, | ||
551 | + confirmText: '好的', | ||
552 | + confirmColor: '#333', | ||
553 | + success: function (res) { | ||
554 | + if (res.confirm) { | ||
555 | + console.log('用户点击确定'); | ||
556 | + setTimeout(function(){ | ||
557 | + uni.navigateTo({ | ||
558 | + url:"/pages/course/courseDetail?id="+that.customs_id+'&courseid='+that.course_id | ||
559 | + }) | ||
560 | + },1500) | ||
561 | + /* 该隐藏的隐藏 */ | ||
562 | + // that.setData({ | ||
563 | + // maskHidden: false | ||
564 | + // }) | ||
565 | + }else{ | ||
566 | + | ||
567 | + } | ||
568 | + }, | ||
569 | + fail: function (res) { | ||
570 | + | ||
571 | + } | ||
572 | + }) | ||
573 | + } | ||
574 | + }) | ||
575 | + | ||
576 | + | ||
577 | + | ||
578 | + }, | ||
579 | + fail() { //这里是用户拒绝授权后的回调 | ||
580 | + | ||
581 | + uni.showModal({ | ||
582 | + title: '提示', | ||
583 | + content: '您取消授权,无法保存图片,点击确定打开权限', | ||
584 | + success(res) { | ||
585 | + if (res.confirm) { | ||
586 | + console.log('用户点击确定') | ||
587 | + uni.openSetting({ | ||
588 | + success(res) { | ||
589 | + console.log(res.authSetting) | ||
590 | + // res.authSetting = { | ||
591 | + // "scope.userInfo": true, | ||
592 | + // "scope.userLocation": true | ||
593 | + // } | ||
594 | + } | ||
595 | + }) | ||
596 | + } else if (res.cancel) { | ||
597 | + console.log('用户点击取消') | ||
598 | + } | ||
599 | + } | ||
600 | + }) | ||
601 | + | ||
602 | + } | ||
603 | + }) | ||
604 | + } else { //用户已经授权过了 | ||
605 | + | ||
606 | + // console.log(that.data.codeurl) | ||
607 | + uni.saveImageToPhotosAlbum({ | ||
608 | + filePath: that.posterimg, | ||
609 | + success(res) { | ||
610 | + uni.showModal({ | ||
611 | + content: '图片已保存到相册', | ||
612 | + showCancel: false, | ||
613 | + confirmText: '好的', | ||
614 | + confirmColor: '#333', | ||
615 | + success: function (res) { | ||
616 | + if (res.confirm) { | ||
617 | + console.log('用户点击确定'); | ||
618 | + setTimeout(function(){ | ||
619 | + uni.redirectTo({ | ||
620 | + | ||
621 | + url:"/pages/course/courseDetail?id="+that.customs_id+'&courseid='+that.course_id | ||
622 | + }) | ||
623 | + },1500) | ||
624 | + /* 该隐藏的隐藏 */ | ||
625 | + // that.setData({ | ||
626 | + // maskHidden: false | ||
627 | + // }) | ||
628 | + }else{ | ||
629 | + | ||
630 | + } | ||
631 | + }, | ||
632 | + fail: function (res) { | ||
633 | + | ||
634 | + } | ||
635 | + }) | ||
636 | + } | ||
637 | + }) | ||
638 | + } | ||
639 | + } | ||
640 | + }) | ||
641 | + | ||
642 | + }, | ||
643 | + | ||
644 | + savefilecode() { | ||
645 | + let that = this; | ||
646 | + | ||
647 | + uni.downloadFile({ | ||
648 | + url: that.posterimg, | ||
649 | + header: {}, | ||
650 | + success: function (res) { | ||
651 | + console.log('下载图片下载图片下载图片', res) | ||
652 | + var tempFilePath = res.tempFilePath | ||
653 | + //console.log('临时文件地址是:' + tempFilePath) | ||
654 | + uni.saveFile({ | ||
655 | + tempFilePath: tempFilePath, | ||
656 | + success: function (res) { | ||
657 | + console.log(res) | ||
658 | + var saveFilePath = res.savedFilePath; | ||
659 | + that.posterimg=res.savedFilePath | ||
660 | + | ||
661 | + | ||
662 | + console.log('123456855555555', that.posterimg) | ||
663 | + | ||
664 | + }, //可以将saveFilePath写入到页面数据中 | ||
665 | + fail: function (res) { }, | ||
666 | + complete: function (res) { | ||
667 | + console.log('complete后的res数据:') | ||
668 | + }, | ||
669 | + }) //, | ||
670 | + }, | ||
671 | + // fail: function (res) { | ||
672 | + // wx.showModal({ | ||
673 | + // title: '下载失败', | ||
674 | + // content: '请联系管理员', | ||
675 | + // }) | ||
676 | + // }, | ||
677 | + complete: function (res) { }, | ||
678 | + }) | ||
679 | + }, | ||
680 | + //关闭海报 | ||
681 | + | ||
682 | + cancel(){ | ||
683 | + let that=this; | ||
684 | + this.isCanvas=false | ||
685 | + setTimeout(function(){ | ||
686 | + uni.redirectTo({ | ||
687 | + url:"/pages/course/courseDetail?id="+that.customs_id+'&courseid='+that.course_id | ||
688 | + }) | ||
689 | + },100) | ||
359 | }, | 690 | }, |
691 | + | ||
360 | // 关闭弹窗 | 692 | // 关闭弹窗 |
361 | closeDialog() { | 693 | closeDialog() { |
362 | this.isDialog = false; | 694 | this.isDialog = false; |
@@ -366,11 +698,23 @@ export default { | @@ -366,11 +698,23 @@ export default { | ||
366 | 698 | ||
367 | }, | 699 | }, |
368 | onLoad(options) { | 700 | onLoad(options) { |
369 | - console.log(options) | 701 | + console.log('999',options) |
370 | this.customs_id=options.custom_id; | 702 | this.customs_id=options.custom_id; |
371 | this.course_id=options.courseid; | 703 | this.course_id=options.courseid; |
372 | - console.log(this.customs_id); | ||
373 | - console.log(this.course_id) | 704 | + if(options.changetype!=undefined){ |
705 | + this.changetype=options.changetype | ||
706 | + } | ||
707 | + | ||
708 | + if(options.change==1){ | ||
709 | + console.log(8888) | ||
710 | + // var item=JSON.parse(options.item) | ||
711 | + // console.log(item) | ||
712 | + this.clock_log_id=options.clock_log_id; | ||
713 | + | ||
714 | + this.getcordtail() | ||
715 | + } | ||
716 | + | ||
717 | + | ||
374 | this.getfenshu() | 718 | this.getfenshu() |
375 | }, | 719 | }, |
376 | // 分享 | 720 | // 分享 |
@@ -387,11 +731,40 @@ export default { | @@ -387,11 +731,40 @@ export default { | ||
387 | </script> | 731 | </script> |
388 | 732 | ||
389 | <style lang="scss"> | 733 | <style lang="scss"> |
734 | + .register{ | ||
735 | + z-index:9999; | ||
736 | + | ||
737 | + } | ||
738 | + .canvas_dialog{ | ||
739 | + z-index:99999; | ||
740 | + } | ||
390 | .clockimg{ | 741 | .clockimg{ |
391 | width:32rpx; | 742 | width:32rpx; |
392 | height:32rpx; | 743 | height:32rpx; |
393 | font-size: 0; | 744 | font-size: 0; |
394 | } | 745 | } |
746 | + .dakaganwu{ | ||
747 | + width:353rpx; | ||
748 | + } | ||
749 | + .imagebox{ | ||
750 | + flex-wrap: wrap; | ||
751 | + } | ||
752 | + .topimg{ | ||
753 | + width:100%; | ||
754 | + height:905rpx; | ||
755 | + } | ||
756 | + .addimg{ | ||
757 | + position: relative; | ||
758 | + margin-right:32rpx; | ||
759 | + } | ||
760 | + .closeimg{ | ||
761 | + width:36rpx; | ||
762 | + height:36rpx; | ||
763 | + font-size: 0; | ||
764 | + position: absolute; | ||
765 | + right:-20rpx; | ||
766 | + top:0 | ||
767 | + } | ||
395 | .submit_clock { | 768 | .submit_clock { |
396 | border-top: 24upx solid #fafbfd; | 769 | border-top: 24upx solid #fafbfd; |
397 | padding: 50upx 32upx; | 770 | padding: 50upx 32upx; |
@@ -490,6 +863,7 @@ export default { | @@ -490,6 +863,7 @@ export default { | ||
490 | } | 863 | } |
491 | // 分享按钮 | 864 | // 分享按钮 |
492 | .share_group_btn { | 865 | .share_group_btn { |
866 | + margin-top:25rpx; | ||
493 | .share_btn { | 867 | .share_btn { |
494 | width: 192upx; | 868 | width: 192upx; |
495 | height: 62upx; | 869 | height: 62upx; |
1 | <template> | 1 | <template> |
2 | <view class="discovery_wrap"> | 2 | <view class="discovery_wrap"> |
3 | 3 | ||
4 | - <view class="bannerimg"> | 4 | + <!-- <view class="bannerimg"> |
5 | <image :src="bannerimg" mode=""></image> | 5 | <image :src="bannerimg" mode=""></image> |
6 | - </view> | 6 | + </view> --> |
7 | <!-- 轮播图 --> | 7 | <!-- 轮播图 --> |
8 | - <!-- <swiper :indicator-dots="true" :circular="true" :autoplay="true" :interval="3000" indicator-active-color="#fff" indicator-color="rgba(255,255,255,0.5)" :duration="1000"> | ||
9 | - <swiper-item v-for="(item,index) in swiperList" :key="index"> | 8 | + <swiper :indicator-dots="true" :circular="true" :autoplay="true" :interval="3000" indicator-active-color="#fff" indicator-color="rgba(255,255,255,0.5)" :duration="1000"> |
9 | + <swiper-item v-for="(item,index) in bannerimg" :key="index"> | ||
10 | <view class="swiper-item"> | 10 | <view class="swiper-item"> |
11 | <image :src="item.image" mode=""></image> | 11 | <image :src="item.image" mode=""></image> |
12 | </view> | 12 | </view> |
13 | </swiper-item> | 13 | </swiper-item> |
14 | - </swiper> --> | 14 | + </swiper> |
15 | <!-- 推荐课程 --> | 15 | <!-- 推荐课程 --> |
16 | <view class="recommend_course"> | 16 | <view class="recommend_course"> |
17 | <!-- 标题 --> | 17 | <!-- 标题 --> |
@@ -22,7 +22,9 @@ | @@ -22,7 +22,9 @@ | ||
22 | </view> | 22 | </view> |
23 | </view> | 23 | </view> |
24 | <!-- 推荐的课程 --> | 24 | <!-- 推荐的课程 --> |
25 | - <view class="courses_box"> | 25 | + <view class="nodata" v-if="courseList.length==0&&time==true">暂无课程</view> |
26 | + <view class="courses_box" v-else> | ||
27 | + | ||
26 | <view class="courses_list"> | 28 | <view class="courses_list"> |
27 | <view class="courses_single justify_between" :class="{no_bot:noBot == index+1}" v-for="(item,index) in courseList" :key="index" @click="toCourseIntro(item)"> | 29 | <view class="courses_single justify_between" :class="{no_bot:noBot == index+1}" v-for="(item,index) in courseList" :key="index" @click="toCourseIntro(item)"> |
28 | <!-- 左侧 --> | 30 | <!-- 左侧 --> |
@@ -33,7 +35,8 @@ | @@ -33,7 +35,8 @@ | ||
33 | <view class="layout_row course_status"> | 35 | <view class="layout_row course_status"> |
34 | <image src="../../static/index_07.png" mode=""></image> | 36 | <image src="../../static/index_07.png" mode=""></image> |
35 | <view class="status_des" v-if="item.state==1">正在进行</view> | 37 | <view class="status_des" v-if="item.state==1">正在进行</view> |
36 | - <view class="status_des" v-if="item.state==2">已结束</view> | 38 | + <view class="status_des" v-if="item.state==2">未开始</view> |
39 | + <view class="status_des" v-if="item.state==3">已结束</view> | ||
37 | </view> | 40 | </view> |
38 | </view> | 41 | </view> |
39 | <!-- 右侧 --> | 42 | <!-- 右侧 --> |
@@ -55,12 +58,12 @@ | @@ -55,12 +58,12 @@ | ||
55 | swiperList:[ | 58 | swiperList:[ |
56 | 59 | ||
57 | ], | 60 | ], |
58 | - bannerimg:'', | ||
59 | - | 61 | + bannerimg:[], |
60 | courseList:[], | 62 | courseList:[], |
61 | noBot:3, | 63 | noBot:3, |
62 | page:1, | 64 | page:1, |
63 | pageNum:10, | 65 | pageNum:10, |
66 | + time:false | ||
64 | 67 | ||
65 | } | 68 | } |
66 | }, | 69 | }, |
@@ -72,22 +75,13 @@ | @@ -72,22 +75,13 @@ | ||
72 | let url='/api/index/index' | 75 | let url='/api/index/index' |
73 | let Userid = uni.getStorageSync('userid') | 76 | let Userid = uni.getStorageSync('userid') |
74 | let param = { | 77 | let param = { |
75 | - // page: that.page, | ||
76 | - // pageNum: that.pageNum | 78 | + page: that.page, |
79 | + pageNum: 10 | ||
77 | }; | 80 | }; |
78 | 81 | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | app.post(url, param, 'get').then(r => { | 82 | app.post(url, param, 'get').then(r => { |
83 | console.log(r) | 83 | console.log(r) |
84 | - that.courseList=r.list | ||
85 | - | ||
86 | - | ||
87 | - | ||
88 | - | ||
89 | - | ||
90 | - | 84 | + that.courseList=that.courseList.concat(r) |
91 | 85 | ||
92 | }).catch(err => { | 86 | }).catch(err => { |
93 | console.log(err) | 87 | console.log(err) |
@@ -104,18 +98,9 @@ | @@ -104,18 +98,9 @@ | ||
104 | 98 | ||
105 | }; | 99 | }; |
106 | 100 | ||
107 | - | ||
108 | - | ||
109 | - | ||
110 | app.post(url, param, 'get').then(r => { | 101 | app.post(url, param, 'get').then(r => { |
111 | console.log(r) | 102 | console.log(r) |
112 | - | ||
113 | - that.bannerimg=r.image | ||
114 | - | ||
115 | - | ||
116 | - | ||
117 | - | ||
118 | - | 103 | + that.bannerimg=r |
119 | 104 | ||
120 | }).catch(err => { | 105 | }).catch(err => { |
121 | console.log(err) | 106 | console.log(err) |
@@ -129,15 +114,94 @@ | @@ -129,15 +114,94 @@ | ||
129 | // var item=JSON.stringify(item) | 114 | // var item=JSON.stringify(item) |
130 | // console.log(item) | 115 | // console.log(item) |
131 | // wx.setStorageSync("item",JSON.stringify(item)) | 116 | // wx.setStorageSync("item",JSON.stringify(item)) |
132 | - wx.setStorageSync("item", item) | ||
133 | - uni.navigateTo({ | ||
134 | - url:"/pages/course/courseIntro" | 117 | + // wx.setStorageSync("item", item) |
118 | + let token=uni.getStorageSync("token") | ||
119 | + if(token==''){ | ||
120 | + uni.showToast({ | ||
121 | + title:'请先登录', | ||
122 | + icon:'none' | ||
123 | + }) | ||
124 | + setTimeout(function(){ | ||
125 | + uni.navigateTo({ | ||
126 | + url:"/pages/start/start" | ||
127 | + }) | ||
128 | + },1500) | ||
129 | + | ||
130 | + }else{ | ||
131 | + uni.navigateTo({ | ||
132 | + url:"/pages/course/courseIntro?id="+item.id | ||
133 | + }) | ||
134 | + } | ||
135 | + | ||
136 | + | ||
137 | + }, | ||
138 | + | ||
139 | + // 获取用户信息 | ||
140 | + getuserinfo() { | ||
141 | + let that = this; | ||
142 | + var url = '/api/index/user_info'; | ||
143 | + var params = { | ||
144 | + | ||
145 | + | ||
146 | + } | ||
147 | + app.post(url, params, "post").then((res) => { | ||
148 | + console.log(res); | ||
149 | + | ||
150 | + | ||
151 | + | ||
152 | + }).catch((err) => { | ||
153 | + console.log(err) | ||
154 | + if (err.msg == '您已被拉黑') { | ||
155 | + uni.showToast({ | ||
156 | + title: err.msg, | ||
157 | + icon: "none" | ||
158 | + }) | ||
159 | + | ||
160 | + setTimeout(function() { | ||
161 | + uni.navigateTo({ | ||
162 | + url: '/pages/start/start' | ||
163 | + }) | ||
164 | + }, 1500) | ||
165 | + } else if (err.msg == '用户未登录') { | ||
166 | + | ||
167 | + wx.showToast({ | ||
168 | + title: '请重新登录', | ||
169 | + icon: 'none' | ||
170 | + }) | ||
171 | + uni.clearStorageSync(); | ||
172 | + setTimeout(function(){ | ||
173 | + uni.navigateTo({ | ||
174 | + url:'/pages/start/start' | ||
175 | + }) | ||
176 | + },1500) | ||
177 | + } | ||
178 | + | ||
179 | + | ||
135 | }) | 180 | }) |
136 | }, | 181 | }, |
182 | + | ||
137 | }, | 183 | }, |
184 | + | ||
138 | onLoad() { | 185 | onLoad() { |
186 | + | ||
187 | + }, | ||
188 | + onShow: function(){ | ||
189 | + console.log(34437347) | ||
190 | + this.page=1; | ||
191 | + this.courseList=[]; | ||
139 | this.getcourselist(); | 192 | this.getcourselist(); |
140 | - this.getbanner() | 193 | + this.getbanner(); |
194 | + this.getuserinfo(); | ||
195 | + | ||
196 | + setTimeout(function(){ | ||
197 | + this.time=true | ||
198 | + },1000) | ||
199 | + }, | ||
200 | + onReachBottom() { | ||
201 | + var newpage = this.page; | ||
202 | + newpage++; | ||
203 | + this.page = newpage | ||
204 | + this.getcourselist() | ||
141 | }, | 205 | }, |
142 | } | 206 | } |
143 | </script> | 207 | </script> |
@@ -7,16 +7,16 @@ | @@ -7,16 +7,16 @@ | ||
7 | <view class="enteritem flextwo"> | 7 | <view class="enteritem flextwo"> |
8 | <view class="enterleft">昵称</view> | 8 | <view class="enterleft">昵称</view> |
9 | <view class="enterright flexone"> | 9 | <view class="enterright flexone"> |
10 | - <view class="enterword"><input type="text" v-model="nickName" placeholder="请输入昵称" /></view> | ||
11 | - <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> | 10 | + <view class="enterword"><input type="text" v-model="nickName" placeholder="请输入昵称" @input="entername"/></view> |
11 | + <!-- <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> --> | ||
12 | </view> | 12 | </view> |
13 | </view> | 13 | </view> |
14 | 14 | ||
15 | <view class="enteritem flextwo"> | 15 | <view class="enteritem flextwo"> |
16 | <view class="enterleft">绑定手机号</view> | 16 | <view class="enterleft">绑定手机号</view> |
17 | <view class="enterright flexone"> | 17 | <view class="enterright flexone"> |
18 | - <view class="enterword"><input type="number" v-model="phone" maxlength="11" placeholder="请输入绑定手机号" /></view> | ||
19 | - <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> | 18 | + <view class="enterword"><input type="number" v-model="phone" maxlength="11" placeholder="请输入绑定手机号" @input="enterphone"/></view> |
19 | + <!-- <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> --> | ||
20 | </view> | 20 | </view> |
21 | </view> | 21 | </view> |
22 | 22 | ||
@@ -24,9 +24,9 @@ | @@ -24,9 +24,9 @@ | ||
24 | <view class="picker"> | 24 | <view class="picker"> |
25 | <!-- 当前选择:{{array[index]}} --> | 25 | <!-- 当前选择:{{array[index]}} --> |
26 | <view class="enteritem flextwo"> | 26 | <view class="enteritem flextwo"> |
27 | - <view class="enterleft">所在行业</view> | 27 | + <view class="enterleft">所属行业</view> |
28 | <view class="enterright flexone"> | 28 | <view class="enterright flexone"> |
29 | - <view class="enterword">{{ industyname }}</view> | 29 | + <view class="enterword">{{industryName}}</view> |
30 | <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> | 30 | <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> |
31 | </view> | 31 | </view> |
32 | </view> | 32 | </view> |
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | <view class="enteritem flextwo"> | 38 | <view class="enteritem flextwo"> |
39 | <view class="enterleft">职业</view> | 39 | <view class="enterleft">职业</view> |
40 | <view class="enterright flexone"> | 40 | <view class="enterright flexone"> |
41 | - <view class="enterword">{{ occupationname }}</view> | 41 | + <view class="enterword">{{ occupationName }}</view> |
42 | <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> | 42 | <view class="yourow"><image src="../../static/yourow.png" mode=""></image></view> |
43 | </view> | 43 | </view> |
44 | </view> | 44 | </view> |
@@ -59,7 +59,7 @@ export default { | @@ -59,7 +59,7 @@ export default { | ||
59 | // 原数据 | 59 | // 原数据 |
60 | industryStart: [], | 60 | industryStart: [], |
61 | industryarray: [], | 61 | industryarray: [], |
62 | - industyname: '请选择行业', | 62 | + industryName: '请选择行业', |
63 | industyindex: 0, | 63 | industyindex: 0, |
64 | // 行业id | 64 | // 行业id |
65 | industryId: '', | 65 | industryId: '', |
@@ -68,7 +68,7 @@ export default { | @@ -68,7 +68,7 @@ export default { | ||
68 | occupationStart: [], | 68 | occupationStart: [], |
69 | occupationarray: [], | 69 | occupationarray: [], |
70 | occupationindex: 0, | 70 | occupationindex: 0, |
71 | - occupationname: '请选择职业', | 71 | + occupationName: '请选择职业', |
72 | // 职业id | 72 | // 职业id |
73 | occupationId: '', | 73 | occupationId: '', |
74 | // 头像 | 74 | // 头像 |
@@ -76,10 +76,50 @@ export default { | @@ -76,10 +76,50 @@ export default { | ||
76 | // 昵称 | 76 | // 昵称 |
77 | nickName: '', | 77 | nickName: '', |
78 | // 手机号 | 78 | // 手机号 |
79 | - phone: '' | 79 | + phone: '', |
80 | + userinfo:'', | ||
81 | + | ||
80 | }; | 82 | }; |
81 | }, | 83 | }, |
82 | methods: { | 84 | methods: { |
85 | + // 输入姓名 | ||
86 | + entername(e){ | ||
87 | + this.nickName=e.detail.value | ||
88 | + }, | ||
89 | + enterphone(){ | ||
90 | + this.phone=phone | ||
91 | + }, | ||
92 | + | ||
93 | + // 获取用户信息 | ||
94 | + getuserinfo(){ | ||
95 | + let that = this; | ||
96 | + var url = '/api/index/user_info'; | ||
97 | + var params = { | ||
98 | + | ||
99 | + | ||
100 | + } | ||
101 | + app.post(url, params,"post").then((res) => { | ||
102 | + console.log(res); | ||
103 | + that.userinfo=res; | ||
104 | + that.avatarUrl=res.avatar; | ||
105 | + that.userName=res.nickname; | ||
106 | + that.nickName=res.nickname; | ||
107 | + console.log('89900',that.nickname) | ||
108 | + that.phone=res.mobile; | ||
109 | + if(res.profession!=null){ | ||
110 | + that.industryName=res.profession | ||
111 | + } | ||
112 | + if(res.profession!=0){ | ||
113 | + that.occupationName=res.occupation | ||
114 | + } | ||
115 | + | ||
116 | + | ||
117 | + | ||
118 | + }).catch((err) => { | ||
119 | + | ||
120 | + }) | ||
121 | + }, | ||
122 | + | ||
83 | // 修改头像 | 123 | // 修改头像 |
84 | uploadAvatar() { | 124 | uploadAvatar() { |
85 | let t = this; | 125 | let t = this; |
@@ -109,24 +149,25 @@ export default { | @@ -109,24 +149,25 @@ export default { | ||
109 | }, | 149 | }, |
110 | // 选择行业 | 150 | // 选择行业 |
111 | bindindustyChange: function(e) { | 151 | bindindustyChange: function(e) { |
112 | - this.industyname = this.industryarray[e.detail.value]; | ||
113 | - uni.setStorageSync('industyname', this.industyname); | 152 | + this.industryName = this.industryarray[e.detail.value]; |
153 | + uni.setStorageSync('industryName', this.industryName); | ||
114 | // 获取行业id | 154 | // 获取行业id |
115 | this.industryStart.forEach(ele => { | 155 | this.industryStart.forEach(ele => { |
116 | - if (ele.name == this.industyname) { | 156 | + if (ele.name == this.industryName) { |
117 | this.getOccupation(ele.id); | 157 | this.getOccupation(ele.id); |
118 | this.industryId = ele.id; | 158 | this.industryId = ele.id; |
119 | uni.setStorageSync('industryId', ele.id); | 159 | uni.setStorageSync('industryId', ele.id); |
120 | } | 160 | } |
121 | }); | 161 | }); |
162 | + this.occupationName="请选择职业"; | ||
122 | }, | 163 | }, |
123 | // 选择职业 | 164 | // 选择职业 |
124 | bindoccupationchange: function(e) { | 165 | bindoccupationchange: function(e) { |
125 | - this.occupationname = this.occupationarray[e.detail.value]; | ||
126 | - uni.setStorageSync('occupationname', this.occupationname); | 166 | + this.occupationName = this.occupationarray[e.detail.value]; |
167 | + uni.setStorageSync('occupationName', this.occupationName); | ||
127 | // 获取职业id | 168 | // 获取职业id |
128 | this.occupationStart.forEach(ele => { | 169 | this.occupationStart.forEach(ele => { |
129 | - if (ele.name == this.occupationname) { | 170 | + if (ele.name == this.occupationName) { |
130 | this.occupationId = ele.id; | 171 | this.occupationId = ele.id; |
131 | uni.setStorageSync('occupationId', ele.id); | 172 | uni.setStorageSync('occupationId', ele.id); |
132 | } | 173 | } |
@@ -135,47 +176,82 @@ export default { | @@ -135,47 +176,82 @@ export default { | ||
135 | // 获取行业列表 | 176 | // 获取行业列表 |
136 | getIndustry() { | 177 | getIndustry() { |
137 | this.industryarray = []; | 178 | this.industryarray = []; |
138 | - let t = this; | 179 | + let that = this; |
139 | let url = '/api/category/category'; | 180 | let url = '/api/category/category'; |
140 | app.post(url).then(res => { | 181 | app.post(url).then(res => { |
141 | // 行业原数据 | 182 | // 行业原数据 |
142 | - this.industryStart = res.list; | ||
143 | - res.list.forEach(ele => { | ||
144 | - this.industryarray.push(ele.name); | 183 | + that.industryStart = res.list; |
184 | + let arr=[] | ||
185 | + | ||
186 | + res.list.forEach(function(value, index, array) { | ||
187 | + arr.push(value.name); | ||
188 | + if (value.name == that.industryName) { | ||
189 | + that.industyindex = index; | ||
190 | + let id = value.id; | ||
191 | + that.getOccupation(id) | ||
192 | + } | ||
145 | }); | 193 | }); |
194 | + | ||
195 | + that.industryarray=arr | ||
196 | + | ||
146 | }); | 197 | }); |
147 | }, | 198 | }, |
148 | // 获取职业列表 | 199 | // 获取职业列表 |
149 | getOccupation(id) { | 200 | getOccupation(id) { |
150 | - let t = this; | 201 | + let that = this; |
151 | let url = '/api/category/sub_category'; | 202 | let url = '/api/category/sub_category'; |
152 | let params = { | 203 | let params = { |
153 | categoty_id: id | 204 | categoty_id: id |
154 | }; | 205 | }; |
155 | app.post(url, params).then(res => { | 206 | app.post(url, params).then(res => { |
207 | + console.log(res) | ||
156 | this.occupationStart = res.list; | 208 | this.occupationStart = res.list; |
157 | let arr = []; | 209 | let arr = []; |
158 | - res.list.forEach(ele => { | ||
159 | - arr.push(ele.name); | 210 | + |
211 | + res.list.forEach(function(value, index, array) { | ||
212 | + arr.push(value.name); | ||
213 | + if (value.name == that.occupationName) { | ||
214 | + that.occupationindex = index; | ||
215 | + | ||
216 | + } | ||
217 | + | ||
160 | }); | 218 | }); |
161 | this.occupationarray = arr; | 219 | this.occupationarray = arr; |
220 | + console.log(this.occupationarray) | ||
162 | }); | 221 | }); |
163 | }, | 222 | }, |
164 | // 修改个人信息 | 223 | // 修改个人信息 |
165 | submitPerson() { | 224 | submitPerson() { |
166 | let t = this; | 225 | let t = this; |
167 | let url = '/api/user/update'; | 226 | let url = '/api/user/update'; |
168 | - if (t.industryId && t.occupationId && t.nickName && t.phone) { | 227 | + if(t.industryName=='请选择行业'){ |
228 | + uni.showToast({ | ||
229 | + title:'请选择行业', | ||
230 | + icon:'none' | ||
231 | + }) | ||
232 | + | ||
233 | + return false | ||
234 | + } | ||
235 | + if(t.occupationName=='请选择职业'){ | ||
236 | + uni.showToast({ | ||
237 | + title:'请选择职业', | ||
238 | + icon:'none' | ||
239 | + }) | ||
240 | + | ||
241 | + return false | ||
242 | + } | ||
243 | + | ||
244 | + if (t.nickName!='' && t.phone!='') { | ||
169 | let params = { | 245 | let params = { |
170 | avatar: t.avatarUrl, | 246 | avatar: t.avatarUrl, |
171 | nickname: t.nickName, | 247 | nickname: t.nickName, |
172 | mobile: t.phone, | 248 | mobile: t.phone, |
173 | - profession: t.industryId, | ||
174 | - occupation: t.occupationId | 249 | + profession: t.industryName, |
250 | + occupation: t.occupationName | ||
175 | }; | 251 | }; |
176 | app.post(url, params).then(res => { | 252 | app.post(url, params).then(res => { |
177 | uni.showToast({ | 253 | uni.showToast({ |
178 | - title: '修改成功', | 254 | + title: '提交成功', |
179 | icon: 'none', | 255 | icon: 'none', |
180 | duration: 1500 | 256 | duration: 1500 |
181 | }); | 257 | }); |
@@ -203,14 +279,15 @@ export default { | @@ -203,14 +279,15 @@ export default { | ||
203 | this.avatarUrl = uni.getStorageSync('avatarUrl'); | 279 | this.avatarUrl = uni.getStorageSync('avatarUrl'); |
204 | this.nickName = uni.getStorageSync('nickName'); | 280 | this.nickName = uni.getStorageSync('nickName'); |
205 | this.phone = uni.getStorageSync('phone'); | 281 | this.phone = uni.getStorageSync('phone'); |
206 | - if (uni.getStorageSync('industyname')) { | ||
207 | - this.industyname = uni.getStorageSync('industyname'); | 282 | + if (uni.getStorageSync('industryName')) { |
283 | + this.industryName = uni.getStorageSync('industryName'); | ||
208 | } | 284 | } |
209 | - if (uni.getStorageSync('occupationname')) { | ||
210 | - this.occupationname = uni.getStorageSync('occupationname'); | 285 | + if (uni.getStorageSync('occupationName')) { |
286 | + this.occupationName = uni.getStorageSync('occupationName'); | ||
211 | } | 287 | } |
212 | this.industryId = uni.getStorageSync('industryId'); | 288 | this.industryId = uni.getStorageSync('industryId'); |
213 | this.occupationId = uni.getStorageSync('occupationId'); | 289 | this.occupationId = uni.getStorageSync('occupationId'); |
290 | + this.getuserinfo() | ||
214 | }, | 291 | }, |
215 | onHide: function() {} | 292 | onHide: function() {} |
216 | }; | 293 | }; |
@@ -4,9 +4,9 @@ | @@ -4,9 +4,9 @@ | ||
4 | <image src="../../static/toppic.png" mode=""></image> | 4 | <image src="../../static/toppic.png" mode=""></image> |
5 | <view class="topinfo flexone"> | 5 | <view class="topinfo flexone"> |
6 | <view class="topinfoimg"> | 6 | <view class="topinfoimg"> |
7 | - <image src="../../static/header.png" mode=""></image> | 7 | + <image :src="avatar" mode=""></image> |
8 | </view> | 8 | </view> |
9 | - <view class="peoplename">两只老虎</view> | 9 | + <view class="peoplename">{{nickname}}</view> |
10 | </view> | 10 | </view> |
11 | </view> | 11 | </view> |
12 | <view class="circlebox"> | 12 | <view class="circlebox"> |
@@ -40,19 +40,20 @@ | @@ -40,19 +40,20 @@ | ||
40 | <!--#endif--> | 40 | <!--#endif--> |
41 | </view> | 41 | </view> |
42 | 42 | ||
43 | - | 43 | + <!-- |
44 | <view class="atten flex"> | 44 | <view class="atten flex"> |
45 | <view class='attenleft'>注:</view> | 45 | <view class='attenleft'>注:</view> |
46 | <view class='attenright'>黄色代表完成事件打分,蓝色代表情绪状态打分。 | 46 | <view class='attenright'>黄色代表完成事件打分,蓝色代表情绪状态打分。 |
47 | x轴代表分数,y轴代表时间。</view> | 47 | x轴代表分数,y轴代表时间。</view> |
48 | </view> | 48 | </view> |
49 | - | 49 | + --> |
50 | </view> | 50 | </view> |
51 | 51 | ||
52 | </view> | 52 | </view> |
53 | </template> | 53 | </template> |
54 | 54 | ||
55 | <script> | 55 | <script> |
56 | + import app from "../../App.vue"; | ||
56 | import uCharts from '@/components/u-charts/u-charts.js'; | 57 | import uCharts from '@/components/u-charts/u-charts.js'; |
57 | import { | 58 | import { |
58 | isJSON | 59 | isJSON |
@@ -67,10 +68,19 @@ | @@ -67,10 +68,19 @@ | ||
67 | cHeight: '', | 68 | cHeight: '', |
68 | pixelRatio: 1, | 69 | pixelRatio: 1, |
69 | textarea: '', | 70 | textarea: '', |
70 | - sel:1 | 71 | + sel: 1, |
72 | + userName: '', | ||
73 | + avatarUrl: '', | ||
74 | + courseid: '', | ||
75 | + max:'', | ||
76 | + min:'', | ||
77 | + number:'', | ||
78 | + avatar:'', | ||
79 | + nickname:'' | ||
71 | } | 80 | } |
72 | }, | 81 | }, |
73 | - onLoad() { | 82 | + onLoad(options) { |
83 | + this.courseid = options.id | ||
74 | _self = this; | 84 | _self = this; |
75 | //#ifdef MP-ALIPAY | 85 | //#ifdef MP-ALIPAY |
76 | uni.getSystemInfo({ | 86 | uni.getSystemInfo({ |
@@ -88,31 +98,87 @@ | @@ -88,31 +98,87 @@ | ||
88 | this.getServerData(); | 98 | this.getServerData(); |
89 | }, | 99 | }, |
90 | methods: { | 100 | methods: { |
91 | - selitem(e){ | ||
92 | - | ||
93 | - this.sel=e.currentTarget.dataset.id; | 101 | + selitem(e) { |
102 | + | ||
103 | + this.sel = e.currentTarget.dataset.id; | ||
104 | + this.getServerData() | ||
94 | }, | 105 | }, |
95 | getServerData() { | 106 | getServerData() { |
96 | - uni.request({ | ||
97 | - url: 'https://www.ucharts.cn/data.json', | ||
98 | - data: {}, | ||
99 | - success: function(res) { | ||
100 | - console.log(res.data.data) | ||
101 | - let LineA = { | ||
102 | - categories: [], | ||
103 | - series: [] | ||
104 | - }; | ||
105 | - //这里我后台返回的是数组,所以用等于,如果您后台返回的是单条数据,需要push进去 | ||
106 | - LineA.categories = res.data.data.LineA.categories; | ||
107 | - LineA.series = res.data.data.LineA.series; | ||
108 | - _self.textarea = JSON.stringify(res.data.data.LineA); | ||
109 | - _self.showLineA("canvasLineA", LineA); | ||
110 | - }, | ||
111 | - fail: () => { | ||
112 | - _self.tips = "网络错误,小程序端请检查合法域名"; | ||
113 | - }, | ||
114 | - }); | 107 | + let that = this; |
108 | + var url = '/api/clock/score'; | ||
109 | + var params = { | ||
110 | + course_id: that.courseid, | ||
111 | + type: that.sel | ||
112 | + | ||
113 | + } | ||
114 | + app.post(url, params).then((res) => { | ||
115 | + console.log(res); | ||
116 | + | ||
117 | + this.avatar=res.avatar; | ||
118 | + this.nickname=res.nickname; | ||
119 | + | ||
120 | + let LineA = { | ||
121 | + categories: [], | ||
122 | + series: [] | ||
123 | + }; | ||
124 | + | ||
125 | + var data=[]; | ||
126 | + res.data.forEach(function(value,index,array){ | ||
127 | + data.push(value) | ||
128 | + }) | ||
129 | + var time= | ||
130 | +// ["2020-03-23", "2020-03-24","2020-03-25","2020-03-26","2020-03-27","2020-03-28"] | ||
131 | + // var datak=[{name: "完成事件打分", data: [6,8,9]},{name: "情绪状态打分", data: [4,5,6]},{name: "优异度", data: [1,310]}]; | ||
132 | + that.max=Number(res.max)+2; | ||
133 | + that.min=Number(res.min)-2; | ||
134 | + console.log(that.max); | ||
135 | + console.log(that.min) | ||
136 | + that.number=(Number(that.max)-Number(that.min))/2; | ||
137 | + LineA.categories=res.time; | ||
138 | + // LineA.categories=time; | ||
139 | + LineA.series = res.data; | ||
140 | + console.log(LineA); | ||
141 | + _self.textarea = JSON.stringify(LineA); | ||
142 | + _self.showLineA("canvasLineA", LineA); | ||
143 | + | ||
144 | + | ||
145 | + }).catch((err) => { | ||
146 | + | ||
147 | + }) | ||
148 | + | ||
115 | }, | 149 | }, |
150 | + | ||
151 | + | ||
152 | + | ||
153 | + // getServerData() { | ||
154 | + // uni.request({ | ||
155 | + // url: 'https://www.ucharts.cn/data.json', | ||
156 | + // data: {}, | ||
157 | + // success: function(res) { | ||
158 | + // console.log(res.data) | ||
159 | + // console.log(res.data.data) | ||
160 | + // let LineA = { | ||
161 | + // categories: [], | ||
162 | + // series: [] | ||
163 | + // }; | ||
164 | + | ||
165 | + | ||
166 | + // //这里我后台返回的是数组,所以用等于,如果您后台返回的是单条数据,需要push进去 | ||
167 | + // console.log(res.data.data.LineA) | ||
168 | + // LineA.categories = res.data.data.LineA.categories; | ||
169 | + // LineA.series = res.data.data.LineA.series; | ||
170 | + // console.log('87765',LineA) | ||
171 | + // _self.textarea = JSON.stringify(res.data.data.LineA); | ||
172 | + // _self.showLineA("canvasLineA", LineA); | ||
173 | + // }, | ||
174 | + // fail: () => { | ||
175 | + // _self.tips = "网络错误,小程序端请检查合法域名"; | ||
176 | + // }, | ||
177 | + // }); | ||
178 | + // }, | ||
179 | + | ||
180 | + | ||
181 | + | ||
116 | showLineA(canvasId, chartData) { | 182 | showLineA(canvasId, chartData) { |
117 | canvaLineA = new uCharts({ | 183 | canvaLineA = new uCharts({ |
118 | $this: _self, | 184 | $this: _self, |
@@ -146,11 +212,14 @@ | @@ -146,11 +212,14 @@ | ||
146 | yAxis: { | 212 | yAxis: { |
147 | //disabled:true | 213 | //disabled:true |
148 | gridType: 'dash', | 214 | gridType: 'dash', |
149 | - splitNumber: 8, | ||
150 | - min: 10, | ||
151 | - max: 180, | 215 | + splitNumber: this.number, |
216 | + min: this.min, | ||
217 | + max: this.max, | ||
218 | + // splitNumber: 8, | ||
219 | + // min: 0, | ||
220 | + // max: 180, | ||
152 | format: (val) => { | 221 | format: (val) => { |
153 | - return val.toFixed(0) | 222 | + return val.toFixed(0) |
154 | } //如不写此方法,Y轴刻度默认保留两位小数 | 223 | } //如不写此方法,Y轴刻度默认保留两位小数 |
155 | }, | 224 | }, |
156 | width: _self.cWidth * _self.pixelRatio, | 225 | width: _self.cWidth * _self.pixelRatio, |
@@ -167,6 +236,7 @@ | @@ -167,6 +236,7 @@ | ||
167 | canvaLineA.scrollStart(e); | 236 | canvaLineA.scrollStart(e); |
168 | }, | 237 | }, |
169 | moveLineA(e) { | 238 | moveLineA(e) { |
239 | + console.log(e) | ||
170 | canvaLineA.scroll(e); | 240 | canvaLineA.scroll(e); |
171 | }, | 241 | }, |
172 | touchEndLineA(e) { | 242 | touchEndLineA(e) { |
@@ -195,6 +265,10 @@ | @@ -195,6 +265,10 @@ | ||
195 | }) | 265 | }) |
196 | } | 266 | } |
197 | } | 267 | } |
268 | + }, | ||
269 | + onshow() { | ||
270 | + this.userName = uni.getStorageSync('nickName'); | ||
271 | + this.avatarUrl = uni.getStorageSync('avatarUrl'); | ||
198 | } | 272 | } |
199 | } | 273 | } |
200 | </script> | 274 | </script> |
@@ -205,41 +279,48 @@ | @@ -205,41 +279,48 @@ | ||
205 | page { | 279 | page { |
206 | background: #f9f9f9; | 280 | background: #f9f9f9; |
207 | } | 281 | } |
208 | - .atten{ | ||
209 | - color:#8C9198; | ||
210 | - font-size:24upx; | 282 | + .qiun-columns{ |
283 | + width:750rpx; | ||
284 | + } | ||
285 | + .atten { | ||
286 | + color: #8C9198; | ||
287 | + font-size: 24upx; | ||
211 | padding: 32upx 28upx; | 288 | padding: 32upx 28upx; |
212 | } | 289 | } |
213 | - | ||
214 | - .nav{ | ||
215 | - height:84upx; | ||
216 | - width:100%; | 290 | + |
291 | + .nav { | ||
292 | + height: 84upx; | ||
293 | + width: 100%; | ||
217 | } | 294 | } |
218 | - .navitem{ | ||
219 | - width:138upx; | 295 | + |
296 | + .navitem { | ||
297 | + width: 138upx; | ||
220 | text-align: center; | 298 | text-align: center; |
221 | - color:#06121E; | 299 | + color: #06121E; |
222 | font-size: 28upx; | 300 | font-size: 28upx; |
223 | font-weight: bold; | 301 | font-weight: bold; |
224 | } | 302 | } |
225 | - .navactive{ | 303 | + |
304 | + .navactive { | ||
226 | position: relative; | 305 | position: relative; |
227 | - color:#EE8B27 | 306 | + color: #EE8B27 |
228 | } | 307 | } |
229 | - .navactive:after{ | ||
230 | - display:block; | ||
231 | - content:''; | ||
232 | - width:138upx; | ||
233 | - height:1upx; | ||
234 | - background:red ; | 308 | + |
309 | + .navactive:after { | ||
310 | + display: block; | ||
311 | + content: ''; | ||
312 | + width: 138upx; | ||
313 | + height: 1upx; | ||
314 | + background: red; | ||
235 | // position: absolute; | 315 | // position: absolute; |
236 | // bottom:0upx; | 316 | // bottom:0upx; |
237 | // left:50%; | 317 | // left:50%; |
238 | // transform: translateX(-50%); | 318 | // transform: translateX(-50%); |
239 | } | 319 | } |
240 | - .circlebox{ | ||
241 | - width:686upx; | ||
242 | - margin:32upx auto 0; | 320 | + |
321 | + .circlebox { | ||
322 | + width: 686upx; | ||
323 | + margin: 32upx auto 0; | ||
243 | background: #fff; | 324 | background: #fff; |
244 | } | 325 | } |
245 | 326 | ||
@@ -253,8 +334,11 @@ | @@ -253,8 +334,11 @@ | ||
253 | width: 120upx; | 334 | width: 120upx; |
254 | height: 120upx; | 335 | height: 120upx; |
255 | font-size: 0; | 336 | font-size: 0; |
337 | + border-radius: 50%; | ||
338 | + } | ||
339 | + .topinfoimg image{ | ||
340 | + border-radius: 50%; | ||
256 | } | 341 | } |
257 | - | ||
258 | .peoplename { | 342 | .peoplename { |
259 | color: #fff; | 343 | color: #fff; |
260 | font-size: 32upx; | 344 | font-size: 32upx; |
-
请 注册 或 登录 后发表评论