作者 xuyangjie

完善登录验证

@@ -98,6 +98,7 @@ App({ @@ -98,6 +98,7 @@ App({
98 98
99 globalData: { 99 globalData: {
100 baseUrl: "https://english.brofirst.cn/api/", 100 baseUrl: "https://english.brofirst.cn/api/",
  101 + imgBaseUrl: "https://english.brofirst.cn",
101 userInfo: null 102 userInfo: null
102 } 103 }
103 }) 104 })
@@ -77,11 +77,15 @@ Component({ @@ -77,11 +77,15 @@ Component({
77 // 密码 77 // 密码
78 gopassword() { 78 gopassword() {
79 // console.log('111') 79 // console.log('111')
  80 + var type = 'text'
  81 + if(this.data.password){
  82 + type = 'safe-password'
  83 + }
80 this.setData({ 84 this.setData({
81 password: !this.data.password, 85 password: !this.data.password,
82 - type: 'safe-password'  
83 - 86 + type,
84 }) 87 })
  88 +
85 }, 89 },
86 } 90 }
87 }) 91 })
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <input type="text" placeholder="请输入账号" bindinput="bindadmin" value="{{admin}}" /> 9 <input type="text" placeholder="请输入账号" bindinput="bindadmin" value="{{admin}}" />
10 </view> 10 </view>
11 <view class="input"> 11 <view class="input">
12 - <input type="{{type}}" placeholder="请输入密码" bindinput="bindpassword" value="{{pwd}}"/> 12 + <input type="{{type}}" password='{{!password}}' placeholder="请输入密码" bindinput="bindpassword" value="{{pwd}}"/>
13 <image src="/img/ic_eye_s@2x.png" wx:if="{{password}}" bindtap="gopassword"></image> 13 <image src="/img/ic_eye_s@2x.png" wx:if="{{password}}" bindtap="gopassword"></image>
14 <image src="/img/ic_eye_n@2x.png" wx:else bindtap="gopassword"></image> 14 <image src="/img/ic_eye_n@2x.png" wx:else bindtap="gopassword"></image>
15 </view> 15 </view>
@@ -15,10 +15,12 @@ Page({ @@ -15,10 +15,12 @@ Page({
15 uploaderNum: 0, 15 uploaderNum: 0,
16 showUpload: true, 16 showUpload: true,
17 imglist: [], 17 imglist: [],
  18 + http_url:'',
18 19
19 Count:0,//总题数 20 Count:0,//总题数
20 current:0,//当前题号 21 current:0,//当前题号
21 today_id:'',//今日任务id 22 today_id:'',//今日任务id
  23 + match_id:'',//比赛任务id
22 all_data:[],//全部题目 24 all_data:[],//全部题目
23 today_data:{ 25 today_data:{
24 "today_subject_id": 4,//题目ID 26 "today_subject_id": 4,//题目ID
@@ -43,28 +45,31 @@ Page({ @@ -43,28 +45,31 @@ Page({
43 'type':0,//题目类型:1=用户上传图片,2=用户上传音频, 45 'type':0,//题目类型:1=用户上传图片,2=用户上传音频,
44 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】' 46 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】'
45 }, 47 },
  48 + alterType:false,//弹窗状态
  49 + alterData:{},//弹窗数据
  50 + taskType:'',//任务类型 比赛任务 今日任务
  51 + TodayTaskType:''//1 打卡 0 补卡
46 }, 52 },
47 - changePlayState(){  
48 - this.selectComponent("audio").changePlayState 53 + PlayState(){
  54 + this.selectComponent("#audio").changePlayState()
49 }, 55 },
50 //下一题 56 //下一题
51 gotoday(){ 57 gotoday(){
52 -  
53 - if(this.data.answer.type == 1 || this.data.imglist.length == 0 ){//图片 58 + if(this.data.answer.type == 1 && this.data.imglist.length == 0 ){//图片
54 wx.showToast({ 59 wx.showToast({
55 title: "请上传图片完成答题", 60 title: "请上传图片完成答题",
56 icon: 'none' 61 icon: 'none'
57 }) 62 })
58 return; 63 return;
59 } 64 }
60 - if(this.data.answer.type == 2 || this.data.musicHttp == ''){//录音文件 65 + if(this.data.answer.type == 2 && this.data.musicHttp == ''){//录音文件
61 wx.showToast({ 66 wx.showToast({
62 title: "请录音完成答题", 67 title: "请录音完成答题",
63 icon: 'none' 68 icon: 'none'
64 }) 69 })
65 return; 70 return;
66 } 71 }
67 - 72 + var index = this.data.current
68 var current = this.data.current*1+1;//答题题号 73 var current = this.data.current*1+1;//答题题号
69 74
70 var file = [];//答题文件 75 var file = [];//答题文件
@@ -77,28 +82,41 @@ Page({ @@ -77,28 +82,41 @@ Page({
77 this.data.answer.file_url = file 82 this.data.answer.file_url = file
78 83
79 var data = this.data.answer;//当前做完的题目答案 84 var data = this.data.answer;//当前做完的题目答案
80 - var arr = this.data.allAnswer.push(data)//全部做完的题目答案 85 + this.data.allAnswer.push(data)//全部做完的题目答案
81 86
  87 + if(this.data.current == this.data.Count){//判断题目是否全部答完
  88 + this.TodayTask()
  89 + return
  90 + }
82 //下一题答案 91 //下一题答案
  92 + if(this.data.taskType == "today"){ //今日任务
83 let answer = { 93 let answer = {
84 - 'today_subject_id': this.data.all_data[current].today_subject_id, //'题目ID', 94 + 'today_subject_id': this.data.all_data[index].today_subject_id, //'题目ID',
85 'type':0,//题目类型:1=用户上传图片,2=用户上传音频, 95 'type':0,//题目类型:1=用户上传图片,2=用户上传音频,
86 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】' 96 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】'
87 } 97 }
  98 + }else if(this.data.taskType == "match"){//比赛任务
  99 + let answer = {
  100 + 'match_subject_id': res.data.List[0].match_subject_id, //'题目ID',
  101 + 'type':0,//题目类型:1=用户上传图片,2=用户上传音频,
  102 + 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】'
  103 + }
  104 + }
  105 +
88 106
89 - if(this.data.all_data[current].type == 2){ // 需要用户上传图片 107 + if(this.data.all_data[index].type == 2){ // 需要用户上传图片
90 answer.type = 1 108 answer.type = 1
91 - }else if(this.data.all_data[current].type == 3){ // 需要用户上传录音 109 + }else if(this.data.all_data[index].type == 3){ // 需要用户上传录音
92 answer.type = 2 110 answer.type = 2
93 }else{ 111 }else{
94 - answer.type = 0 112 + answer.type = ''
95 } 113 }
96 114
97 this.setData({ 115 this.setData({
98 - today_data:this.data.all_data[current],//下一题 116 + today_data:this.data.all_data[index],//下一题
99 current:current, 117 current:current,
100 answer:answer, 118 answer:answer,
101 - allAnswer:arr, 119 + allAnswer:this.data.allAnswer,
102 uploaderList:[],//下一题后图片置空 120 uploaderList:[],//下一题后图片置空
103 imglist:[],//下一题后图片置空 121 imglist:[],//下一题后图片置空
104 musicHttp:'',//下一题后录音文件置空 122 musicHttp:'',//下一题后录音文件置空
@@ -111,10 +129,27 @@ Page({ @@ -111,10 +129,27 @@ Page({
111 //答题提交 129 //答题提交
112 TodayTask(){ 130 TodayTask(){
113 clearInterval(time) 131 clearInterval(time)
114 - var temporary = (time_num/60).toFixed(2);  
115 - app.post("today/TodayTask", {today_id:this.data.today_id,json:this.data.allAnswer,learn_time:temporary,type:1}).then(res => { 132 + var data = {}//提交参数
  133 + var url = '' //接口地址
  134 + //判断任务类型
  135 + if(this.data.taskType == "today"){ //今日任务
  136 + url = 'today/TodayTask'
  137 + data = {today_id:this.data.today_id,json:all_data,learn_time:temporary,type:this.data.TodayTaskType}
  138 + }else if(this.data.taskType == "match"){//比赛任务
  139 + url = 'match/MatchTask'
  140 + data = {match_id:this.data.match_id,json:all_data,learn_time:temporary}
  141 + }
  142 + var temporary = Math.ceil(time_num/60);//学习事件
  143 + var all_data = JSON.stringify(this.data.allAnswer)
  144 + app.post(url,data ).then(res => {
116 if(res.code == 1){ 145 if(res.code == 1){
117 console.log(res) 146 console.log(res)
  147 + this.TodayTaskWindow()
  148 + }else{
  149 + wx.showToast({
  150 + title: res.msg,
  151 + icon: 'none'
  152 + })
118 } 153 }
119 }).catch(err => { 154 }).catch(err => {
120 wx.showToast({ 155 wx.showToast({
@@ -127,22 +162,68 @@ Page({ @@ -127,22 +162,68 @@ Page({
127 * 生命周期函数--监听页面加载 162 * 生命周期函数--监听页面加载
128 */ 163 */
129 onLoad: function (options) { 164 onLoad: function (options) {
130 - this.data.today_id = options.id 165 +
  166 + if(options.type == "today"){//今日任务
  167 + this.setData({
  168 + today_id:options.id,
  169 + })
  170 + this.TodayQuestion()
  171 + }else if(options.type == "match"){//比赛任务
  172 + this.setData({
  173 + match_id:options.id,
  174 + })
131 this.TodayQuestion() 175 this.TodayQuestion()
132 - const innerAudioContext = wx.createInnerAudioContext()  
133 - innerAudioContext.autoplay = true 176 + }
134 this.setData({ 177 this.setData({
135 - innerAudioContext, 178 + taskType:options.type,
  179 + TodayTaskType:options.type,
  180 + http_url:app.globalData.imgBaseUrl,
  181 + today_id:options.id,
136 }) 182 })
137 var that = this; 183 var that = this;
138 time = setInterval(function(){ 184 time = setInterval(function(){
139 time_num++ 185 time_num++
140 },1000) 186 },1000)
141 }, 187 },
  188 + //提交完成弹窗
  189 + TodayTaskWindow(){
  190 + var data = {}//提交参数
  191 + var url = '' //接口地址
  192 + if(this.data.taskType == "today"){ //今日任务
  193 + url = 'today/TodayTaskWindow'
  194 + data = {TodayClockId:this.data.today_id}
  195 + }else if(this.data.taskType == "match"){//比赛任务
  196 + url = 'match/MatchTask'
  197 + data = {MatchClockId:this.data.match_id}
  198 + }
  199 + app.post(url,data).then(res => {
  200 + if(res.code == 1){
  201 + console.log(res)
  202 + this.setData({
  203 + alterData:res.data
  204 + })
  205 + this.setData({
  206 + alterType:true
  207 + })
  208 + }
  209 + }).catch(err => {
  210 + wx.showToast({
  211 + title: err.msg,
  212 + icon: 'none'
  213 + })
  214 + })
  215 + },
  216 + //完成任务返回首页
  217 + gototram(){
  218 +
  219 + wx.switchTab({
  220 + url: '/pages/index/index',
  221 + })
  222 + },
142 //获取今日任务列表 223 //获取今日任务列表
143 TodayQuestion(){ 224 TodayQuestion(){
144 var that = this; 225 var that = this;
145 - app.post("today/TodayQuestion", {today_id:this.data.today_id}).then(res => { 226 + app.post("match/MatchQuestion", {today_id:this.data.match_id}).then(res => {
146 if(res.code == 1){ 227 if(res.code == 1){
147 console.log(res) 228 console.log(res)
148 229
@@ -151,13 +232,46 @@ Page({ @@ -151,13 +232,46 @@ Page({
151 'type':0,//题目类型:1=用户上传图片,2=用户上传音频, 232 'type':0,//题目类型:1=用户上传图片,2=用户上传音频,
152 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】' 233 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】'
153 } 234 }
  235 + if( res.data.List[0].type == 2){ // 需要用户上传图片
  236 + answer.type = 1
  237 + }else if( res.data.List[0].type == 3){ // 需要用户上传录音
  238 + answer.type = 2
  239 + }else{
  240 + answer.type = ''
  241 + }
  242 + this.setData({
  243 + today_data:res.data.List[0],//第一题
  244 + all_data:res.data.List,//全部题
  245 + Count:res.data.Count,//总题数
  246 + current:1,//当前题数
  247 + answer,
  248 + })
  249 + }
  250 + }).catch(err => {
  251 + wx.showToast({
  252 + title: err.msg,
  253 + icon: 'none'
  254 + })
  255 + })
  256 + },
  257 + //比赛任务
  258 + TodayQuestion(){
  259 + var that = this;
  260 + app.post("match/MatchQuestion", {match_id:this.data.today_id}).then(res => {
  261 + if(res.code == 1){
  262 + console.log(res)
154 263
  264 + let answer = {
  265 + 'match_subject_id': res.data.List[0].match_subject_id, //'题目ID',
  266 + 'type':0,//题目类型:1=用户上传图片,2=用户上传音频,
  267 + 'file_url': [] //'图片/音频 【多张图 , 分割 拼接字符串】'
  268 + }
155 if( res.data.List[0].type == 2){ // 需要用户上传图片 269 if( res.data.List[0].type == 2){ // 需要用户上传图片
156 answer.type = 1 270 answer.type = 1
157 }else if( res.data.List[0].type == 3){ // 需要用户上传录音 271 }else if( res.data.List[0].type == 3){ // 需要用户上传录音
158 answer.type = 2 272 answer.type = 2
159 }else{ 273 }else{
160 - answer.type = 0 274 + answer.type = ''
161 } 275 }
162 this.setData({ 276 this.setData({
163 today_data:res.data.List[0],//第一题 277 today_data:res.data.List[0],//第一题
@@ -318,9 +432,14 @@ Page({ @@ -318,9 +432,14 @@ Page({
318 } 432 }
319 }) 433 })
320 }, 434 },
321 - //上传请求 435 + //文件上传请求
322 upload_file(data,type){ 436 upload_file(data,type){
  437 + var that = this;
323 wx.uploadFile({ 438 wx.uploadFile({
  439 + header:{
  440 + 'content-type': 'application/json',
  441 + 'token': wx.getStorageSync('token') ? wx.getStorageSync('token') : ''
  442 + },
324 url: app.globalData.baseUrl + 'common/upload', //接口地址 443 url: app.globalData.baseUrl + 'common/upload', //接口地址
325 filePath: data, //要上传文件资源的路径 (本地路径) 444 filePath: data, //要上传文件资源的路径 (本地路径)
326 name: 'file', //文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 445 name: 'file', //文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容
@@ -329,16 +448,17 @@ Page({ @@ -329,16 +448,17 @@ Page({
329 }, 448 },
330 success(res) { 449 success(res) {
331 wx.hideLoading(); 450 wx.hideLoading();
  451 + console.log(res.data)
332 var str = res.data 452 var str = res.data
333 var file = JSON.parse(str); 453 var file = JSON.parse(str);
334 - if(type == 'img'){  
335 - let imglist = that.data.imglist.concat(file.data.save_path) 454 + if(type == 'img'){ //图片文件
  455 + let imglist = that.data.imglist.concat(file.data.url)
336 that.setData({ 456 that.setData({
337 imglist: imglist 457 imglist: imglist
338 }) 458 })
339 - }else{ 459 + }else{//mp3文件
340 that.setData({ 460 that.setData({
341 - musicHttp: file.data.save_path 461 + musicHttp: file.data.url
342 }) 462 })
343 } 463 }
344 } 464 }
@@ -378,12 +498,12 @@ Page({ @@ -378,12 +498,12 @@ Page({
378 that.upload_file(res.tempFilePath)//上传录音文件 498 that.upload_file(res.tempFilePath)//上传录音文件
379 }) 499 })
380 }, 500 },
  501 + //录音播放事件
381 play_voice(){ 502 play_voice(){
382 // console.log("播放录音") 503 // console.log("播放录音")
383 this.setData({ 504 this.setData({
384 soundType:3,//录音结束 505 soundType:3,//录音结束
385 }) 506 })
386 -  
387 innerAudioContext.src = this.data.musicUrl 507 innerAudioContext.src = this.data.musicUrl
388 innerAudioContext.onPlay(() => { // 监听音频播放事件 508 innerAudioContext.onPlay(() => { // 监听音频播放事件
389 console.log('开始播放') 509 console.log('开始播放')
@@ -393,16 +513,17 @@ Page({ @@ -393,16 +513,17 @@ Page({
393 console.log(res.errCode) 513 console.log(res.errCode)
394 }) 514 })
395 }, 515 },
  516 + //录音暂停事件
396 pause_voice(){ 517 pause_voice(){
397 this.setData({ 518 this.setData({
398 soundType:2,//录音结束 519 soundType:2,//录音结束
399 }) 520 })
400 console.log("暂停录音") 521 console.log("暂停录音")
401 - InnerAudioContext.pause()  
402 - InnerAudioContext.onPause(() => { // 监听音频暂停事件 522 + innerAudioContext.pause()
  523 + innerAudioContext.onPause(() => { // 监听音频暂停事件
403 console.log('暂停播放') 524 console.log('暂停播放')
404 }) 525 })
405 - InnerAudioContext.offError((res) => { // 取消监听音频加载中事件 526 + innerAudioContext.offError((res) => { // 取消监听音频加载中事件
406 console.log(res.errMsg) 527 console.log(res.errMsg)
407 console.log(res.errCode) 528 console.log(res.errCode)
408 }) 529 })
@@ -3,16 +3,16 @@ @@ -3,16 +3,16 @@
3 <video src="{{today_data.video_file}}" loop show-fullscreen-btn="{{false}}"></video> 3 <video src="{{today_data.video_file}}" loop show-fullscreen-btn="{{false}}"></video>
4 </view> 4 </view>
5 <!-- 音频 --> 5 <!-- 音频 -->
6 -<view class="audio" wx:if="{{today_data.audio_file}}" id="audio"> 6 +<view class="audio" wx:if="{{today_data.audio_file}}" >
7 <!-- <audio controls src="http://m10.music.126.net/20210728150904/ef325f8ac68a3710a2c7cfec82a70096/ymusic/045e/000b/0f0f/34bf44037a7a4cb160928e5a21c314a0.mp3"></audio> --> 7 <!-- <audio controls src="http://m10.music.126.net/20210728150904/ef325f8ac68a3710a2c7cfec82a70096/ymusic/045e/000b/0f0f/34bf44037a7a4cb160928e5a21c314a0.mp3"></audio> -->
8 8
9 <view style="width:686rpx;margin:0 auto"> 9 <view style="width:686rpx;margin:0 auto">
10 - <slider-audio audio-src="{{today_data.audio_file}}" audioName="{{today_data.title}}"></slider-audio> 10 + <slider-audio audio-src="{{today_data.audio_file}}" id="audio" audioName="{{today_data.title}}"></slider-audio>
11 </view> 11 </view>
12 </view> 12 </view>
13 13
14 <!-- 播放音频 --> 14 <!-- 播放音频 -->
15 -<view class="audio_play" bindtap="changePlayState" wx:if="{{today_data.audio_file && today_data.type != 3}}"> 15 +<view class="audio_play" bindtap="PlayState" wx:if="{{today_data.audio_file && today_data.type != 3}}">
16 <image class="audio_img" src="../../img/ic_voice56@2x.png"></image> 16 <image class="audio_img" src="../../img/ic_voice56@2x.png"></image>
17 </view> 17 </view>
18 18
@@ -38,11 +38,11 @@ @@ -38,11 +38,11 @@
38 </view> 38 </view>
39 39
40 <!-- 音频录制 --> 40 <!-- 音频录制 -->
41 -<view class="recording" wx:if="{{today_data.type == 3}}" > 41 +<view class="recording" wx:if="{{today_data.type == 3}}">
42 <view class="art"> 42 <view class="art">
43 <!-- //录音状态 0未录音 1开始录音 2录音完成 3播放录音 --> 43 <!-- //录音状态 0未录音 1开始录音 2录音完成 3播放录音 -->
44 <view> 44 <view>
45 - <image src="/img/ic_voice40@2x.png" bindtap="changePlayState" wx:if="{{today_data.audio_file && today_data.type == 3}}"></image> 45 + <image src="/img/ic_voice40@2x.png" bindtap="PlayState" wx:if="{{today_data.audio_file && today_data.type == 3}}"></image>
46 </view> 46 </view>
47 <image src="/img/ic_rec_n@2x.png" wx:if="{{soundType != 1 }}" bindtap="startRecord"></image> 47 <image src="/img/ic_rec_n@2x.png" wx:if="{{soundType != 1 }}" bindtap="startRecord"></image>
48 <image src="/img/ic_rec_s@2x.png" wx:if="{{soundType == 1}}" bindtap="stopRecord"></image> 48 <image src="/img/ic_rec_s@2x.png" wx:if="{{soundType == 1}}" bindtap="stopRecord"></image>
@@ -74,4 +74,39 @@ @@ -74,4 +74,39 @@
74 <text>{{Count}}</text> 74 <text>{{Count}}</text>
75 </view> 75 </view>
76 76
77 -<view class="box-end" bindtap="gotoday">Next</view>  
  77 +<view class="box-end" bindtap="gotoday">{{current == Count ? '完成打卡' : 'Next'}}</view>
  78 +
  79 +<view class="alter" wx:if="{{alterType}}">
  80 + <view class="mask">
  81 + <image src="/img/img_star@2x.png"></image>
  82 + </view>
  83 + <view class="denglu" wx:if="alterType">
  84 + <view>恭喜你</view>
  85 + <view wx:if="{{alterData.score}}">获得积分<text>{{alterData.score}}</text> </view>
  86 + <view class="text_bar">
  87 + <view>
  88 + <view>
  89 + <text>{{alterData.score}}</text>
  90 + <text>分</text>
  91 + </view>
  92 + <text>今日学习时长</text>
  93 + </view>
  94 + <view>
  95 + <view>
  96 + <text>{{alterData.readwords}}</text>
  97 + <text>个</text>
  98 + </view>
  99 + <text>打卡单词</text>
  100 + </view>
  101 + <view>
  102 + <view>
  103 + <text>{{alterData.readbook}}</text>
  104 + <text>本</text>
  105 + </view>
  106 + <text>打卡英语书</text>
  107 + </view>
  108 + </view>
  109 + <text>{{alterData.Happy}}</text>
  110 + <view class="button" bindtap="gototram">开心收下</view>
  111 + </view>
  112 +</view>
@@ -45,10 +45,17 @@ swiper{ @@ -45,10 +45,17 @@ swiper{
45 border-radius: 36rpx; 45 border-radius: 36rpx;
46 width: 686rpx; 46 width: 686rpx;
47 height:272rpx; 47 height:272rpx;
48 - padding: 80rpx 0; 48 + padding: 80rpx 140rpx;
49 text-align: center; 49 text-align: center;
50 margin: 0 auto; 50 margin: 0 auto;
51 margin-top:120rpx; 51 margin-top:120rpx;
  52 + display: flex;
  53 + justify-content: space-between;
  54 + align-items: flex-end;
  55 +}
  56 +.art>view{
  57 + width: 80rpx;
  58 + height: 80rpx;
52 } 59 }
53 .art image{ 60 .art image{
54 width: 80rpx; 61 width: 80rpx;
@@ -140,3 +147,81 @@ swiper{ @@ -140,3 +147,81 @@ swiper{
140 border-radius: 50%; 147 border-radius: 50%;
141 margin-top: 54rpx; 148 margin-top: 54rpx;
142 } 149 }
  150 +.essay image{
  151 + width: 100%;
  152 +}
  153 +
  154 +/* */
  155 +.alter{
  156 + background: rgba(0, 0, 0, .6);
  157 + position: fixed;
  158 + top: 0;
  159 + left: 0;
  160 + width: 100%;
  161 + height: 100%;
  162 +}
  163 +
  164 +.denglu {
  165 + position: fixed;
  166 + top: 18%;
  167 + left: 50%;
  168 + transform: translateX(-50%);
  169 + text-align: center;
  170 + width: 622rpx;
  171 + border-radius: 48rpx;
  172 + background: #fff;
  173 +}
  174 +.mask image{
  175 + position: absolute;
  176 + top: 0;
  177 + z-index: 9999;
  178 + width: 100%;
  179 + height: 750rpx;
  180 +}
  181 +.denglu{
  182 + padding: 100rpx 50rpx 50rpx 50rpx;
  183 +}
  184 +.denglu>view:nth-child(1) {
  185 + font-size: 52rpx;
  186 + font-weight: 500;
  187 +}
  188 +.denglu>view:nth-child(2){
  189 + margin-top: 50rpx;
  190 +}
  191 +.denglu>view:nth-child(2)>text {
  192 + font-size: 50rpx;
  193 + margin-top: 44rpx;
  194 + color: #FD9327;
  195 +}
  196 +.button {
  197 + width: 422rpx;
  198 + height: 100rpx;
  199 + line-height: 100rpx;
  200 + text-align: center;
  201 + font-size: 32rpx;
  202 + font-weight: 600;
  203 + margin: 64rpx auto;
  204 + border-radius: 96rpx;
  205 + background: rgba(255, 200, 61, 1);
  206 +}
  207 +.text_bar{
  208 + display: flex;
  209 + justify-content: space-between;
  210 + align-items: center;
  211 + margin-top: 88rpx;
  212 +}
  213 +.text_bar>view{
  214 + margin-top: 0;
  215 +}
  216 +.text_bar>view>view>text:first-child{
  217 + font-size: 40rpx;
  218 + color: #000;
  219 +}
  220 +.text_bar>view>view>text:last-child{
  221 + font-size: 24rpx;
  222 + color: #000;
  223 +}
  224 +.text_bar>view>text{
  225 + font-size: 24rpx;
  226 + color: #C4C4C4;
  227 +}
@@ -7,9 +7,8 @@ Page({ @@ -7,9 +7,8 @@ Page({
7 admin: "", // 账号 7 admin: "", // 账号
8 pwd: "", //密码 8 pwd: "", //密码
9 login: false, 9 login: false,
10 - clockData: "" //打卡数据  
11 -  
12 - 10 + clockData: "", //打卡数据
  11 + token:''
13 }, 12 },
14 onShow() { 13 onShow() {
15 let token = wx.getStorageSync('token') 14 let token = wx.getStorageSync('token')
@@ -18,9 +17,13 @@ Page({ @@ -18,9 +17,13 @@ Page({
18 this.setData({ 17 this.setData({
19 login: true 18 login: true
20 }) 19 })
  20 + }else{
  21 + this.IndexMyData()
21 } 22 }
  23 + this.setData({
  24 + token
  25 + })
22 this.getlist() 26 this.getlist()
23 - this.IndexMyData()  
24 }, 27 },
25 // 关闭 28 // 关闭
26 myevent() { 29 myevent() {
@@ -69,6 +72,12 @@ Page({ @@ -69,6 +72,12 @@ Page({
69 // }) 72 // })
70 // }, 73 // },
71 bindRask() { 74 bindRask() {
  75 + if(!this.data.token){
  76 + this.setData({
  77 + login:true
  78 + })
  79 + return
  80 + }
72 wx.navigateTo({ 81 wx.navigateTo({
73 url: '/pages/mission/mission', 82 url: '/pages/mission/mission',
74 }) 83 })
@@ -11,15 +11,15 @@ @@ -11,15 +11,15 @@
11 <text class="title">您已坚持打卡{{clockData.clock_number}}天</text> 11 <text class="title">您已坚持打卡{{clockData.clock_number}}天</text>
12 <view class="box-z"> 12 <view class="box-z">
13 <view class="box-0"> 13 <view class="box-0">
14 - <view class="box-1">{{clockData.reading}}<text>分</text></view> 14 + <view class="box-1">{{token ? clockData.reading : 0}}<text>分</text></view>
15 <view class="box-2">阅读时长</view> 15 <view class="box-2">阅读时长</view>
16 </view> 16 </view>
17 <view class="box-0"> 17 <view class="box-0">
18 - <view class="box-1">{{clockData.readwords}}<text>个</text></view> 18 + <view class="box-1">{{token ? clockData.readwords : 0}}<text>个</text></view>
19 <view class="box-2">阅读单词</view> 19 <view class="box-2">阅读单词</view>
20 </view> 20 </view>
21 <view class="box-0"> 21 <view class="box-0">
22 - <view class="box-1">{{clockData.readbook}}<text>本</text></view> 22 + <view class="box-1">{{token ? clockData.readbook : 0}}<text>本</text></view>
23 <view class="box-2">阅读英语书</view> 23 <view class="box-2">阅读英语书</view>
24 </view> 24 </view>
25 </view> 25 </view>
@@ -15,8 +15,16 @@ Page({ @@ -15,8 +15,16 @@ Page({
15 // 今日 15 // 今日
16 gotoday(e) { 16 gotoday(e) {
17 let id = e.currentTarget.dataset.id 17 let id = e.currentTarget.dataset.id
  18 + let type = e.currentTarget.dataset.type
  19 + if(!id){
  20 + wx.showToast({
  21 + title: "今日已打卡",
  22 + icon: 'none'
  23 + })
  24 + return
  25 + }
18 wx.navigateTo({ 26 wx.navigateTo({
19 - url: '/pages/first/first?id=' + id, 27 + url: '/pages/first/first?id=' + id + "&type=1" + "&type=" + type,
20 }) 28 })
21 29
22 }, 30 },
@@ -24,6 +32,13 @@ Page({ @@ -24,6 +32,13 @@ Page({
24 goCeping(e) { 32 goCeping(e) {
25 console.log(e) 33 console.log(e)
26 let id = e.currentTarget.dataset.id 34 let id = e.currentTarget.dataset.id
  35 + if(!id){
  36 + wx.showToast({
  37 + title: "今日已打卡",
  38 + icon: 'none'
  39 + })
  40 + return
  41 + }
27 wx.navigateTo({ 42 wx.navigateTo({
28 url: '/pages/question/question?id=' + id, 43 url: '/pages/question/question?id=' + id,
29 }) 44 })
@@ -43,7 +58,6 @@ Page({ @@ -43,7 +58,6 @@ Page({
43 if (res.code == 1) { 58 if (res.code == 1) {
44 that.setData({ 59 that.setData({
45 raskData: res.data 60 raskData: res.data
46 -  
47 }) 61 })
48 } 62 }
49 }).catch(err => { 63 }).catch(err => {
@@ -91,6 +105,24 @@ Page({ @@ -91,6 +105,24 @@ Page({
91 * 用户点击右上角分享 105 * 用户点击右上角分享
92 */ 106 */
93 onShareAppMessage: function () { 107 onShareAppMessage: function () {
  108 + var now = new Date();
  109 + var date = now.getFullYear() + "-" +((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate();
  110 + var user_id = ''
  111 + app.post('index/getUserId',{}).then(res => {
  112 + if(res.code == 1){
  113 + user_id = res.data.user_id
  114 + }
  115 + }).catch(err => {
  116 + wx.showToast({
  117 + title: err.msg,
  118 + icon: 'none'
  119 + })
  120 + })
  121 +
  122 + return {
  123 + title: "BC HOUSE",
  124 + path:`/pages/partake/partake?date=${date}&user_id=${user_id}`
  125 + }
94 126
95 } 127 }
96 }) 128 })
1 <!--今日任务 --> 1 <!--今日任务 -->
2 -<view class="cast" style="background:rgba(113,116,132,1);" bindtap="gotoday" data-id="{{raskData.Today.today_id}}"> 2 +<view class="cast" style="background:rgba(113,116,132,1);" bindtap="gotoday" data-type="today" data-id="{{raskData.Today.today_id}}">
3 <view class="cast-1">今日任务 3 <view class="cast-1">今日任务
4 <view class="cast-2">{{raskData.Today.type==2?'未打卡':'已完成'}}</view> 4 <view class="cast-2">{{raskData.Today.type==2?'未打卡':'已完成'}}</view>
5 </view> 5 </view>
@@ -8,11 +8,11 @@ @@ -8,11 +8,11 @@
8 <image src="/img/ic_date_dangri@2x.png"></image> 8 <image src="/img/ic_date_dangri@2x.png"></image>
9 </view> 9 </view>
10 <view class="cast-logos"> 10 <view class="cast-logos">
11 - <image src="/img/ic_date.png" bindtap="goCalend"></image> 11 + <image src="/img/ic_date.png" catchtap="goCalend"></image>
12 </view> 12 </view>
13 </view> 13 </view>
14 <!-- 比赛任务 --> 14 <!-- 比赛任务 -->
15 -<view class="cast" style="background:rgba(109,134,157,1);" bindtap="gotoday" data-id="{{raskData.Match.match_id}}"> 15 +<view class="cast" style="background:rgba(109,134,157,1);" bindtap="gotoday" data-type="match" data-id="{{raskData.Match.match_id}}">
16 <view class="cast-1">比赛任务 16 <view class="cast-1">比赛任务
17 <view class="cast-2">{{raskData.Match.type==2?'未打卡':'已完成'}}</view> 17 <view class="cast-2">{{raskData.Match.type==2?'未打卡':'已完成'}}</view>
18 </view> 18 </view>
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <image src="/img/ic_date_bisai@2x.png"></image> 21 <image src="/img/ic_date_bisai@2x.png"></image>
22 </view> 22 </view>
23 <view class="cast-logos"> 23 <view class="cast-logos">
24 - <image src="/img/ic_date.png" bindtap="goCalend"></image> 24 + <image src="/img/ic_date.png" catchtap="goCalend"></image>
25 </view> 25 </view>
26 </view> 26 </view>
27 <!-- 测评任务 --> 27 <!-- 测评任务 -->
@@ -34,13 +34,16 @@ @@ -34,13 +34,16 @@
34 <image src="/img/img_ceping@2x.png" style="width:100rpx;height:100rpx"></image> 34 <image src="/img/img_ceping@2x.png" style="width:100rpx;height:100rpx"></image>
35 </view> 35 </view>
36 <view class="cast-logos"> 36 <view class="cast-logos">
37 - <image src="/img/ic_date.png" bindtap="goCalend"></image> 37 + <image src="/img/ic_date.png" catchtap="goCalend"></image>
38 </view> 38 </view>
39 </view> 39 </view>
40 40
41 41
42 <!-- --> 42 <!-- -->
43 -<view class="footer"> 43 +<view class="footer" >
44 分享到 44 分享到
  45 + <button open-type="share" class="share">
  46 +
45 <image src="/img/ic_wechat@2x.png"></image> 47 <image src="/img/ic_wechat@2x.png"></image>
  48 + </button>
46 </view> 49 </view>
@@ -51,9 +51,19 @@ @@ -51,9 +51,19 @@
51 font-size: 28rpx; 51 font-size: 28rpx;
52 color:rgba(139,139,141,1); 52 color:rgba(139,139,141,1);
53 margin-left:-60rpx; 53 margin-left:-60rpx;
  54 + display: flex;
  55 + justify-content: center;
  56 + align-items: center;
54 } 57 }
55 .footer image{ 58 .footer image{
56 width: 80rpx; 59 width: 80rpx;
57 height: 80rpx; 60 height: 80rpx;
58 vertical-align: middle; 61 vertical-align: middle;
59 } 62 }
  63 +.share{
  64 + background: none;
  65 + width: 80rpx !important;
  66 + height: 80rpx;
  67 + padding: 0;
  68 + margin-left: 20rpx;
  69 +}
@@ -54,7 +54,12 @@ Page({ @@ -54,7 +54,12 @@ Page({
54 * 生命周期函数--监听页面加载 54 * 生命周期函数--监听页面加载
55 */ 55 */
56 onLoad: function (options) { 56 onLoad: function (options) {
  57 + let token = wx.getStorageSync('token')
  58 + if (token == '') {
  59 +
  60 + }else{
57 this.MessageList() 61 this.MessageList()
  62 + }
58 }, 63 },
59 //获取通知列表 64 //获取通知列表
60 MessageList(){ 65 MessageList(){
1 // pages/08/08.js 1 // pages/08/08.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - box:[  
9 - {  
10 - num:221,  
11 - box_1:'分',  
12 - box_2:'阅读时长'  
13 - },  
14 - {  
15 - num:500,  
16 - box_1:'个',  
17 - box_2:'阅读单词' 9 + alterData:{
  10 +
18 }, 11 },
19 - {  
20 - num:23,  
21 - box_1:'本',  
22 - box_2:'阅读英语书'  
23 - }  
24 - ]  
25 }, 12 },
26 gotoday(){ 13 gotoday(){
27 wx.switchTab({ 14 wx.switchTab({
@@ -32,7 +19,22 @@ Page({ @@ -32,7 +19,22 @@ Page({
32 * 生命周期函数--监听页面加载 19 * 生命周期函数--监听页面加载
33 */ 20 */
34 onLoad: function (options) { 21 onLoad: function (options) {
35 - 22 + this.ShareGetUser(options.date,options.user_id)
  23 + },
  24 + ShareGetUser(date,user_id){
  25 + app.post('index/ShareGetUser',{date:'',user_id:user_id}).then(res => {
  26 + if(res.code == 1){
  27 + console.log(res)
  28 + this.setData({
  29 + alterData:res.data
  30 + })
  31 + }
  32 + }).catch(err => {
  33 + wx.showToast({
  34 + title: err.msg,
  35 + icon: 'none'
  36 + })
  37 + })
36 }, 38 },
37 39
38 /** 40 /**
@@ -3,14 +3,22 @@ @@ -3,14 +3,22 @@
3 </view> 3 </view>
4 <view class="stu-box"> 4 <view class="stu-box">
5 <view class="stu-1"> 5 <view class="stu-1">
6 - <image src="/img/99.png"></image> 6 + <image src="{{alterData.UserAvatar}}"></image>
7 </view> 7 </view>
8 - <view class="title">小丽</view>  
9 - <view class="stu-2">2021年05月06日在BC HOUSE学习</view> 8 + <view class="title">{{alterData.UserNickname}}</view>
  9 + <view class="stu-2">{{alterData.Date}}在BC HOUSE学习</view>
10 <view class="box-z"> 10 <view class="box-z">
11 - <view class="box-0" wx:for="{{box}}">  
12 - <view class="box-1">{{item.num}}<text>{{item.box_1}}</text></view>  
13 - <view class="box-2">{{item.box_2}}</view> 11 + <view class="box-0" >
  12 + <view class="box-1">{{alterData.Reading}}<text>分钟</text></view>
  13 + <view class="box-2">坚持学习</view>
  14 + </view>
  15 + <view class="box-0" >
  16 + <view class="box-1">{{alterData.Readbook}}<text>本</text></view>
  17 + <view class="box-2">阅读英语书</view>
  18 + </view>
  19 + <view class="box-0" >
  20 + <view class="box-1">{{alterData.UserNickname}}<text>分钟</text></view>
  21 + <view class="box-2">今日学习</view>
14 </view> 22 </view>
15 </view> 23 </view>
16 24
@@ -25,7 +25,8 @@ Page({ @@ -25,7 +25,8 @@ Page({
25 admin: "", // 账号 25 admin: "", // 账号
26 pwd: "", //密码 26 pwd: "", //密码
27 login: false, 27 login: false,
28 - meData:{} 28 + meData:{},
  29 + token:''
29 }, 30 },
30 /** 31 /**
31 * 生命周期函数--监听页面加载 32 * 生命周期函数--监听页面加载
@@ -36,12 +37,15 @@ Page({ @@ -36,12 +37,15 @@ Page({
36 onShow() { 37 onShow() {
37 let token = wx.getStorageSync('token') 38 let token = wx.getStorageSync('token')
38 if (token == '') { 39 if (token == '') {
39 -  
40 this.setData({ 40 this.setData({
41 login: true 41 login: true
42 }) 42 })
43 - } 43 + }else{
44 this.getMe() 44 this.getMe()
  45 + }
  46 + this.setData({
  47 + token
  48 + })
45 }, 49 },
46 // 关闭 50 // 关闭
47 myevent() { 51 myevent() {
@@ -51,11 +55,23 @@ Page({ @@ -51,11 +55,23 @@ Page({
51 }, 55 },
52 56
53 getmy() { 57 getmy() {
  58 + if(!this.data.token){
  59 + this.setData({
  60 + login:true
  61 + })
  62 + return
  63 + }
54 wx.navigateTo({ 64 wx.navigateTo({
55 url: '/pages/means/means', 65 url: '/pages/means/means',
56 }) 66 })
57 }, 67 },
58 getmenu(e) { 68 getmenu(e) {
  69 + if(!this.data.token){
  70 + this.setData({
  71 + login:true
  72 + })
  73 + return
  74 + }
59 let id = e.currentTarget.dataset.id 75 let id = e.currentTarget.dataset.id
60 var data = JSON.stringify(this.data.meData) // 个人信息转换成字符串 76 var data = JSON.stringify(this.data.meData) // 个人信息转换成字符串
61 if (id == 1) { 77 if (id == 1) {
@@ -3,11 +3,11 @@ @@ -3,11 +3,11 @@
3 </navigator> 3 </navigator>
4 <view class="top"> 4 <view class="top">
5 <view class="top-1"> 5 <view class="top-1">
6 - <image src="{{meData.avatar}}"></image> 6 + <image src="{{token ? meData.avatar : '../../img/ic_head@2x.png'}}"></image>
7 <view class="bigtitle">{{meData.nickname}}</view> 7 <view class="bigtitle">{{meData.nickname}}</view>
8 - <text class="t3" bindtap="getmy">查看并编辑个人资料</text> 8 + <text class="t3" bindtap="getmy">{{token ? '查看并编辑个人资料' : '您还没有登录,请进行登录'}}</text>
9 </view> 9 </view>
10 - <view class="right">积分·{{meData.score}}</view> 10 + <view class="right">积分·{{token ? meData.score : '0'}}</view>
11 </view> 11 </view>
12 <view class="contents"> 12 <view class="contents">
13 <view class="cont" wx:for="{{cont}}" wx:key='key'> 13 <view class="cont" wx:for="{{cont}}" wx:key='key'>
@@ -46,6 +46,8 @@ @@ -46,6 +46,8 @@
46 "scripts": {}, 46 "scripts": {},
47 "isGameTourist": false, 47 "isGameTourist": false,
48 "appid": "wxb717767cdf314ea2", 48 "appid": "wxb717767cdf314ea2",
  49 + "simulatorType": "wechat",
  50 + "simulatorPluginLibVersion": {},
49 "condition": { 51 "condition": {
50 "plugin": { 52 "plugin": {
51 "list": [] 53 "list": []
@@ -13,18 +13,6 @@ @@ -13,18 +13,6 @@
13 "miniprogram": { 13 "miniprogram": {
14 "list": [ 14 "list": [
15 { 15 {
16 - "name": "pages/first/first",  
17 - "pathName": "pages/first/first",  
18 - "query": "",  
19 - "scene": null  
20 - },  
21 - {  
22 - "name": "pages/second/second",  
23 - "pathName": "pages/second/second",  
24 - "query": "",  
25 - "scene": null  
26 - },  
27 - {  
28 "name": "pages/three/three", 16 "name": "pages/three/three",
29 "pathName": "pages/three/three", 17 "pathName": "pages/three/three",
30 "query": "", 18 "query": "",
@@ -569,6 +557,12 @@ @@ -569,6 +557,12 @@
569 "pathName": "pages/first/first", 557 "pathName": "pages/first/first",
570 "query": "id=1", 558 "query": "id=1",
571 "scene": null 559 "scene": null
  560 + },
  561 + {
  562 + "name": "pages/mission/mission",
  563 + "pathName": "pages/mission/mission",
  564 + "query": "",
  565 + "scene": null
572 } 566 }
573 ] 567 ]
574 } 568 }