Commit d35668442dfc66fbe8b4bb731b6ec496e64854c5

Authored by
1 parent 8cd16d4b
Exists in master

打卡功能简单版

打卡功能简单版
1 { 1 {
2 "pages": [ 2 "pages": [
  3 + "pages/login/loginNew/loginNew",
3 "pages/login/codeLogin/codeLogin", 4 "pages/login/codeLogin/codeLogin",
  5 + "pages/index/achievement/achievement",
4 "pages/index/rank/rank", 6 "pages/index/rank/rank",
5 "pages/index/index", 7 "pages/index/index",
6 - "pages/index/achievement/achievement",  
7 "pages/index/newPunch/newPunch", 8 "pages/index/newPunch/newPunch",
8 "pages/mine/record/record", 9 "pages/mine/record/record",
9 "pages/mine/index", 10 "pages/mine/index",
img/login_img.png 0 → 100644

84.5 KB

pages/index/achievement/achievement.js
1 // pages/index/achievement/achievement.js 1 // pages/index/achievement/achievement.js
  2 +// 引入插件安装器
  3 +import plugin from '../../../component/v2/plugins/index'
  4 +import week from '../../../component/v2/plugins/week'
  5 +import todo from '../../../component/v2/plugins/todo'
  6 +import request from '../../../api/request.js'
  7 +import moment from 'moment';
  8 +plugin
  9 + .use(week)
  10 + .use(todo)
2 Page({ 11 Page({
3 12
4 - /**  
5 - * 页面的初始数据  
6 - */  
7 - data: {  
8 - calendarConfig: {  
9 - // theme: 'elegant',  
10 - weekMode: true, // 周视图模式  
11 - // highlightToday: true, // 是否高亮显示当天  
12 - // hideHeader: true, // 隐藏日历头部操作栏  
13 - },  
14 - isDisplay:false  
15 - },  
16 - takeoverTap(e) {  
17 - console.log('takeoverTap', e.detail)  
18 - },  
19 - //获取信息  
20 - getInfo(e) {  
21 - // 切换为周视图  
22 - const calendar = this.selectComponent('#calendar').calendar  
23 - console.log(calendar.getCurrentYM())  
24 - calendar.switchView('week', '#calendar').then(() => {})  
25 - return  
26 - // 切换为周视图  
27 - this.setData({  
28 - isDisplay: !this.data.isDisplay  
29 - })  
30 - if (this.data.isDisplay) {  
31 - calendar.switchView('month').then(() => {})  
32 - } else {  
33 - calendar.switchView('week').then(() => {})  
34 - }  
35 - },  
36 - /**  
37 - * 生命周期函数--监听页面加载  
38 - */  
39 - onLoad(options) {  
40 -  
41 - },  
42 - // 统一返回  
43 - handleBack() {  
44 - wx.navigateBack()  
45 - },  
46 - /**  
47 - * 用户点击右上角分享  
48 - */  
49 - onShareAppMessage() {  
50 -  
51 - } 13 + /**
  14 + * 页面的初始数据
  15 + */
  16 + data: {
  17 + calendarConfig: {
  18 + theme: 'elegant',
  19 + weekMode: true, // 周视图模式
  20 + // highlightToday: true, // 是否高亮显示当天
  21 + hideHeader: true, // 隐藏日历头部操作栏
  22 + autoChoosedWhenJump: true, // 设置默认日期及跳转到指定日期后是否需要自动选中
  23 + defaultDate: moment(new Date().getTime()).format('YYYY-MM-DD'), // 默认选中指定某天,如需选中需配置 autoChoosedWhenJump: true
  24 + },
  25 + isDisplay: false,
  26 + calendar: {}, //日历
  27 + valueId: '', //任务ID
  28 + taskVo: {
  29 + allowRepairCard: 0,
  30 + hasData: 0,
  31 + id: 0,
  32 + releaseTime: "",
  33 + signTotal: 0,
  34 + taskCycle: 0,
  35 + taskDesc: "",
  36 + taskFrequency: "",
  37 + taskTitle: "",
  38 + weekDay: ""
  39 + },
  40 + resData: [], //成果数据
  41 + recordVo: {
  42 + commitTime: "",
  43 + files: [],
  44 + signDate: "",
  45 + taskRecordDesc: "",
  46 + taskStatisticsParam: ""
  47 + }, //成果数据当天
  48 + recordVoShow: false,
  49 + dayMoment: 0 , //数据月份
  50 + },
  51 + /**
  52 + * 选择日期后执行的事件
  53 + */
  54 + afterTapDate(e) {
  55 + let date = e.detail.date
  56 + // let month = e.detail.month
  57 + // let year = e.detail.year
  58 + let recordVo = this.data.resData.eventDetails[date - 1].recordVo
  59 + if (recordVo != null) {
  60 + console.log('复制',recordVo)
  61 + this.setData({
  62 + recordVo: recordVo
  63 + })
  64 + this.setData({
  65 + recordVoShow: true
  66 + })
  67 + }else {
  68 + this.setData({
  69 + recordVoShow: false
  70 + })
  71 + }
  72 + },
  73 + //获取信息
  74 + getInfo(doday,isOne=0) {
  75 + request({
  76 + url: `/wx/task/getSignRecord`,
  77 + method: 'get',
  78 + data: {
  79 + // wx.getStorageSync('userInfo_id'),
  80 + "taskId": this.data.valueId,
  81 + "signDate": doday
  82 + },
  83 + }).then(res => {
  84 + if (res.code == 0) {
  85 + this.setData({
  86 + resData: res.data
  87 + })
  88 + this.getV2(res.data)
  89 + if(isOne ==1) {
  90 + let e = {
  91 + detail: {
  92 + date: moment().date(),
  93 + month: moment().month() + 1,
  94 + year: moment().year()
  95 + }
  96 + }
  97 + this.afterTapDate(e)
  98 + }
  99 + } else {
  100 + wx.showToast({
  101 + title: res.msg,
  102 + icon: 'none'
  103 + })
  104 + }
  105 + })
  106 + },
  107 + //初始化日历
  108 + initialize() {
  109 + // 设置待办
  110 + this.setData({
  111 + 'calendar': this.selectComponent('#calendar').calendar
  112 + })
  113 + },
  114 + //显示日历
  115 + getV2(resData) {
  116 + this.setData({
  117 + taskVo: resData.taskVo
  118 + })
  119 + // const calendar = this.selectComponent('#calendar').calendar
  120 + this.data.calendar.setTodos({
  121 + // 待办点标记设置
  122 + pos: 'bottom', // 待办点标记位置 ['top', 'bottom']
  123 + dotColor: 'red', // 待办点标记颜色
  124 + circle: false, // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥
  125 + showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效
  126 + dates: resData.eventDetails
  127 + })
  128 + },
  129 + /**
  130 + * 生命周期函数--监听页面加载
  131 + */
  132 + onLoad(options) {
  133 + this.setData({
  134 + valueId: options.valueId
  135 + })
  136 + },
  137 + // 统一返回
  138 + handleBack() {
  139 + wx.navigateBack()
  140 + },
  141 + /**
  142 + * 生命周期函数--监听页面初次渲染完成
  143 + */
  144 + onReady() {
  145 + this.initialize()
  146 + this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD'),1)
  147 + },
52 }) 148 })
53 \ No newline at end of file 149 \ No newline at end of file
pages/index/achievement/achievement.json
1 { 1 {
2 "usingComponents": { 2 "usingComponents": {
3 "van-icon": "@vant/weapp/icon/index", 3 "van-icon": "@vant/weapp/icon/index",
4 - "calendar": "/component/v2/index"  
5 - } 4 + "calendar": "/component/v2/index",
  5 + "van-popup": "@vant/weapp/popup/index",
  6 + "van-field": "@vant/weapp/field/index",
  7 + "van-image": "@vant/weapp/image/index",
  8 + "van-button": "@vant/weapp/button/index"
  9 + },
  10 + "navigationBarTitleText": "我的成果"
6 } 11 }
7 \ No newline at end of file 12 \ No newline at end of file
pages/index/achievement/achievement.wxml
1 <!--pages/index/achievement/achievement.wxml--> 1 <!--pages/index/achievement/achievement.wxml-->
2 <view class="punch_detail"> 2 <view class="punch_detail">
3 - <calendar id="calendar" config="{{calendarConfig}}" bind:takeoverTap="takeoverTap" /> 3 + <calendar id="calendar" config="{{calendarConfig}}" bind:afterTapDate="afterTapDate"/>
4 <!-- <view class="btn" bindtap="getInfo">按钮</view> --> 4 <!-- <view class="btn" bindtap="getInfo">按钮</view> -->
  5 + <view class="line_grey"></view>
  6 + <view class="card">
  7 + <view class="card_title">{{taskVo.taskTitle}}</view>
  8 + <view class="card_flex">
  9 + <view class="flex_grey">已进行 {{taskVo.signTotal +' / ' +taskVo.taskCycle}} 天</view>
  10 + <view class="flex_grey">打卡频次 : {{taskVo.taskFrequency}}</view>
  11 + <view class="flex_grey">{{taskVo.hasData == 1 ?'允许补卡': '不允许补卡'}}</view>
  12 + </view>
  13 + <view class="card_context">{{taskVo.taskDesc}}</view>
  14 + <view class="grey_font">
  15 + <view>我发布与{{taskVo.weekDay}} {{taskVo.releaseTime}}</view>
  16 + <view class="grey_font_bottom"></view>
  17 + </view>
  18 + </view>
  19 +
  20 + <view class="grey_line"></view>
  21 + <view class="box" wx:if="{{recordVoShow}}">
  22 + <view class="box_title">打卡成果</view>
  23 + <view class="box_blue">本次打卡坚持了<span>{{recordVo.taskStatisticsParam}}分钟</span></view>
  24 + <view class="box_grey">"{{recordVo.taskRecordDesc}}"</view>
  25 + <view class="box_pic">
  26 + <view class="box_img" wx:for="{{recordVo.files}}" wx:key="index" wx:for-item="value">
  27 + <van-image width="100%" height="26vw" fit="fill" src="{{value}}" />
  28 + </view>
  29 + </view>
  30 + </view>
5 </view> 31 </view>
6 \ No newline at end of file 32 \ No newline at end of file
pages/index/achievement/achievement.wxss
@@ -4,4 +4,131 @@ @@ -4,4 +4,131 @@
4 height: 20vw; 4 height: 20vw;
5 background-color: aqua; 5 background-color: aqua;
6 font-size: 5vw; 6 font-size: 5vw;
  7 +}
  8 +.line_grey {
  9 + width: 90vw;
  10 + height: 1px;
  11 + background-color: #999;
  12 + margin: 10px 5vw 20px;
  13 +}
  14 +.card {
  15 + width: 92vw;
  16 + margin-left: 4vw;
  17 +}
  18 +.card_title {
  19 + font-size: 18px;
  20 + color: #556191;
  21 + margin: 15px 0;
  22 +}
  23 +.card_flex {
  24 + display: flex;
  25 +}
  26 +.flex_grey {
  27 + padding: 7px 10px;
  28 + box-sizing: border-box;
  29 + margin: 0 5px 10px 0;
  30 + font-size: 13px;
  31 + background-color: #F4F4F4;
  32 + color: #666666;
  33 + border-radius: 3px;
  34 +}
  35 +.card_context {
  36 + font-size: 16px;
  37 + margin: 10px 0;
  38 +}
  39 +.grey_font {
  40 + font-size: 14px;
  41 + color: #999999;
  42 + margin: 20px 0;
  43 +}
  44 +.grey_font_bottom {
  45 + margin-top: 5px;
  46 +}
  47 +.btn_box {
  48 + display: flex;
  49 + justify-content: space-around;
  50 + position: fixed;
  51 + bottom: 50px;
  52 + width: 100vw;
  53 +}
  54 +.pop_title {
  55 + font-size: 18px;
  56 + font-weight: bold;
  57 + text-align: center;
  58 + margin: 20px 0;
  59 +}
  60 +.pop_flex {
  61 + display: flex;
  62 + justify-content: space-between;
  63 + align-items: center;
  64 + padding: 0 20px;
  65 + box-sizing: border-box;
  66 +}
  67 +.pop_cell {
  68 + width: 40vw;
  69 + display: flex;
  70 + align-items: center;
  71 +}
  72 +.pop_fz {
  73 + width: 70px;
  74 +}
  75 +.pop_btn {
  76 + position: absolute;
  77 + bottom: 30px;
  78 + width: 90vw;
  79 + margin: 0 5vw;
  80 +}
  81 +.pop_tip {
  82 + position: absolute;
  83 + bottom: 90px;
  84 + width: 90vw;
  85 + margin: 0 5vw;
  86 +}
  87 +.pop_pic {
  88 + width: 70px;
  89 + height: 30px;
  90 +}
  91 +.grey_line {
  92 + width: 90vw;
  93 + height: 1px;
  94 + margin: 20vw 5vw 10vw ;
  95 + background-color: #999;
  96 +}
  97 +.box {
  98 + padding: 0 5vw;
  99 + box-sizing: border-box;
  100 + margin-bottom: 20px;
  101 +}
  102 +.box_title {
  103 + font-size: 20px;
  104 + font-weight: bold;
  105 +}
  106 +.box_blue {
  107 + padding: 7px 10px;
  108 + box-sizing: border-box;
  109 + background-color: #EDF5FF;
  110 + color: #333333;
  111 + margin: 15px 0;
  112 + border-radius: 10px;
  113 +}
  114 +.box_blue span {
  115 + color: #3A86F5;
  116 +}
  117 +.box_grey {
  118 + padding: 18px 10px;
  119 + box-sizing: border-box;
  120 + background-color: #FBFBFB;
  121 + color: #666666 ;
  122 + margin: 15px 0;
  123 + border-radius: 10px;
  124 +}
  125 +.box_pic {
  126 + display: flex;
  127 + justify-content: space-between;
  128 + flex-wrap: wrap;
  129 +}
  130 +.box_img {
  131 + width: 26vw;
  132 + margin:0 0 10px;
  133 + border-radius: 10px;
7 } 134 }
8 \ No newline at end of file 135 \ No newline at end of file
pages/index/index.js
@@ -49,15 +49,15 @@ Page({ @@ -49,15 +49,15 @@ Page({
49 }, 49 },
50 50
51 // 打卡成果 51 // 打卡成果
52 - handleAchievement(){ 52 + handleAchievement(e){
53 wx.navigateTo({ 53 wx.navigateTo({
54 - url: '/pages/index/achievement/achievement', 54 + url: '/pages/index/achievement/achievement?valueId='+e.currentTarget.dataset.valueid ,
55 }) 55 })
56 }, 56 },
57 // 去打卡 57 // 去打卡
58 - handleDetail(){ 58 + handleDetail(e){
59 wx.navigateTo({ 59 wx.navigateTo({
60 - url: '/pages/index/punchDetail/punchDetail', 60 + url: '/pages/index/punchDetail/punchDetail?valueId='+e.currentTarget.dataset.valueid ,
61 }) 61 })
62 }, 62 },
63 /** 63 /**
pages/index/index.wxml
1 <view class="main"> 1 <view class="main">
2 - <view class="bck" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/67c3d489-6635-4bef-90f2-03553f56fd0a.png')">  
3 - </view>  
4 - <view class="box">  
5 - <view class="title_name"> 2 + <!-- <view class="bck" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/67c3d489-6635-4bef-90f2-03553f56fd0a.png')">
  3 + </view> -->
6 <!-- 打卡排行榜 --> 4 <!-- 打卡排行榜 -->
  5 + <!-- <view class="box">
  6 + <view class="title_name">
7 </view> 7 </view>
8 <vidw class="title_view" bindtap="toRank">立即查看</vidw> 8 <vidw class="title_view" bindtap="toRank">立即查看</vidw>
9 - <!-- <view class="tabs_css"> 9 + <view class="tabs_css">
10 <view class="{{active == 1?'tabs_item check' :'tabs_item no_check'}}" bindtap="checkTabs" data-index='1'>我的打卡</view> 10 <view class="{{active == 1?'tabs_item check' :'tabs_item no_check'}}" bindtap="checkTabs" data-index='1'>我的打卡</view>
11 <view class="{{active == 2?'tabs_item check' :'tabs_item no_check'}} " bindtap='checkTabs' data-index='2'>我创建的</view> 11 <view class="{{active == 2?'tabs_item check' :'tabs_item no_check'}} " bindtap='checkTabs' data-index='2'>我创建的</view>
12 - </view> --> 12 + </view>
13 <view class="tabs_div"></view> 13 <view class="tabs_div"></view>
14 - </view> 14 + </view> -->
15 <view class="white_box"> 15 <view class="white_box">
16 <view class="card" wx:for="{{taskList}}" wx:key="index" wx:for-item="value"> 16 <view class="card" wx:for="{{taskList}}" wx:key="index" wx:for-item="value">
17 <view class="card_title"> 17 <view class="card_title">
@@ -44,9 +44,9 @@ @@ -44,9 +44,9 @@
44 </view> 44 </view>
45 <view class="grey_line"></view> 45 <view class="grey_line"></view>
46 <view class="blue_font"> 46 <view class="blue_font">
47 - <view bindtap="handleAchievement">打卡成果</view> 47 + <view bindtap="handleAchievement" data-valueId="{{value.id}}">打卡成果</view>
48 <view class="blue_line"></view> 48 <view class="blue_line"></view>
49 - <view bindtap="handleDetail">去打卡</view> 49 + <view bindtap="handleDetail" data-valueId="{{value.id}}">去打卡</view>
50 </view> 50 </view>
51 </view> 51 </view>
52 </view> 52 </view>
pages/index/newPunch/newPunch.js
@@ -28,7 +28,7 @@ Page({ @@ -28,7 +28,7 @@ Page({
28 //弹出层 28 //弹出层
29 //统计单位 29 //统计单位
30 unitShow: false, 30 unitShow: false,
31 - columnsUnit: ['小时', '天', '月'], 31 + columnsUnit: ['分钟', '小时', '个', '篇', '本', '张', '页', '次'],
32 //开始时间 32 //开始时间
33 startTimeShow: false, 33 startTimeShow: false,
34 columnsStartTime: ['9', '10', '11', '12'], 34 columnsStartTime: ['9', '10', '11', '12'],
@@ -67,7 +67,7 @@ Page({ @@ -67,7 +67,7 @@ Page({
67 columnsClockLack: [1,2,3], 67 columnsClockLack: [1,2,3],
68 //必须包含 68 //必须包含
69 containShow: false, 69 containShow: false,
70 - columnsContain: ['图片'], 70 + columnsContain: ['无限制','图片'],
71 }, 71 },
72 //获取模板详情 / 空模板 72 //获取模板详情 / 空模板
73 getDetail() { 73 getDetail() {
@@ -99,7 +99,7 @@ Page({ @@ -99,7 +99,7 @@ Page({
99 'form.remindTime': data.remindTime 99 'form.remindTime': data.remindTime
100 }) 100 })
101 this.setData({ 101 this.setData({
102 - 'form.startDate': data.startDate 102 + 'form.startDate': moment(new Date().getTime()).format('YYYY-MM-DD')
103 }) 103 })
104 this.setData({ 104 this.setData({
105 'form.statisticsUnit': data.statisticsUnit 105 'form.statisticsUnit': data.statisticsUnit
@@ -183,6 +183,17 @@ Page({ @@ -183,6 +183,17 @@ Page({
183 }, 183 },
184 }); 184 });
185 }, 185 },
  186 + //删除
  187 + delFile(event) {
  188 + let [list,index] = [this.data.fileList,event.detail.index]
  189 + list.splice(index,1)
  190 + this.setData({
  191 + fileList:list
  192 + })
  193 + this.setData({
  194 + 'form.taskFileUrl': this.data.fileList.map(v => v.url)
  195 + })
  196 + },
186 //开关 197 //开关
187 onswitchChange({ 198 onswitchChange({
188 detail 199 detail
pages/index/newPunch/newPunch.wxml
1 <!--pages/index/rank/rank.wxml--> 1 <!--pages/index/rank/rank.wxml-->
2 <view class="punch_detail"> 2 <view class="punch_detail">
3 <view class="title_card"> 3 <view class="title_card">
4 - <van-cell-group>  
5 - <van-field value="{{ form.taskTitle }}" placeholder="请输入标题" border="{{ false }}" bind:change="onfieldChange" /> 4 + <van-cell-group border="{{ false }}">
  5 + <van-field value="{{ form.taskTitle }}" placeholder="请输入标题" border="{{ false }}" bind:change="onfieldChange" />
6 </van-cell-group> 6 </van-cell-group>
7 <view class="grey_line"></view> 7 <view class="grey_line"></view>
8 <view class="box_card"> 8 <view class="box_card">
9 - <van-cell-group>  
10 - <van-field value="{{ form.taskDesc }}" type="textarea" placeholder="请输入" autosize border="{{ false }}" bind:change="onfieldDescChange" /> 9 + <van-cell-group border="{{ false }}">
  10 + <van-field value="{{ form.taskDesc }}" type="textarea" placeholder="请输入" autosize border="{{ false }}" bind:change="onfieldDescChange" />
11 </van-cell-group> 11 </van-cell-group>
12 </view> 12 </view>
13 <view class="tip_card"> 13 <view class="tip_card">
14 - <van-uploader accept='image' file-list="{{ fileList }}" deletable="{{ true }}" bind:after-read="afterRead"> 14 + <van-uploader accept='image' file-list="{{ fileList }}" deletable="{{ true }}" bind:after-read="afterRead" bind:delete="delFile">
15 <view class="tip_item"> 15 <view class="tip_item">
16 <image class="pic" src="/img/answer/tp1.png" alt="" /> 16 <image class="pic" src="/img/answer/tp1.png" alt="" />
17 </view> 17 </view>
@@ -31,12 +31,12 @@ @@ -31,12 +31,12 @@
31 </view> 31 </view>
32 </view> 32 </view>
33 <view class="grey_line"></view> 33 <view class="grey_line"></view>
34 - <view class="white_card_nopadding">  
35 - <van-cell-group> 34 + <view class="white_card_nopadding" wx:if="{{form.hasData == 1}}">
  35 + <van-cell-group border="{{ false }}">
36 <van-cell title="统计单位" value="{{ form.statisticsUnit }}" is-link label="请选择统计单位" border="{{ false }}" bindtap="openUnitShow" /> 36 <van-cell title="统计单位" value="{{ form.statisticsUnit }}" is-link label="请选择统计单位" border="{{ false }}" bindtap="openUnitShow" />
37 </van-cell-group> 37 </van-cell-group>
38 </view> 38 </view>
39 - <view class="white_card"> 39 + <view class="white_card" wx:if="{{form.hasData == 1}}">
40 <view>允许补卡</view> 40 <view>允许补卡</view>
41 <view> 41 <view>
42 <van-switch checked="{{ form.allowRepairCard }}" size='20' bind:change="onChange" active-value='1' inactive-value='2' /> 42 <van-switch checked="{{ form.allowRepairCard }}" size='20' bind:change="onChange" active-value='1' inactive-value='2' />
@@ -46,29 +46,29 @@ @@ -46,29 +46,29 @@
46 开启后,在打卡周期内,学生家长可对未打卡的任务进行补卡。 46 开启后,在打卡周期内,学生家长可对未打卡的任务进行补卡。
47 </view> 47 </view>
48 <view class="white_card_nopadding"> 48 <view class="white_card_nopadding">
49 - <van-cell-group> 49 + <van-cell-group border="{{ false }}">
50 <van-cell title="开始时间" value="{{ form.startDate }}" is-link border="{{ false }}" bindtap="openStartTimeShow" /> 50 <van-cell title="开始时间" value="{{ form.startDate }}" is-link border="{{ false }}" bindtap="openStartTimeShow" />
51 </van-cell-group> 51 </van-cell-group>
52 </view> 52 </view>
53 <view class="white_card_nopadding"> 53 <view class="white_card_nopadding">
54 - <van-cell-group> 54 + <van-cell-group border="{{ false }}">
55 <van-cell title="打卡周期" value="{{ form.taskCycle + ' 天'}}" is-link border="{{ false }}" bindtap="openClockCycleShow" /> 55 <van-cell title="打卡周期" value="{{ form.taskCycle + ' 天'}}" is-link border="{{ false }}" bindtap="openClockCycleShow" />
56 </van-cell-group> 56 </van-cell-group>
57 </view> 57 </view>
58 <view class="white_card_nopadding"> 58 <view class="white_card_nopadding">
59 - <van-cell-group> 59 + <van-cell-group border="{{ false }}">
60 <van-cell title="打卡频次" value="{{ form.taskFrequency }}" is-link border="{{ false }}" bindtap="openClockRateShow" /> 60 <van-cell title="打卡频次" value="{{ form.taskFrequency }}" is-link border="{{ false }}" bindtap="openClockRateShow" />
61 </van-cell-group> 61 </van-cell-group>
62 </view> 62 </view>
63 63
64 <view class="clearance"></view> 64 <view class="clearance"></view>
65 <view class="white_card_nopadding"> 65 <view class="white_card_nopadding">
66 - <van-cell-group> 66 + <van-cell-group border="{{ false }}">
67 <van-cell title="打卡提醒" value="{{ form.remindTime }}" is-link border="{{ false }}" bindtap="openClockRemindShow" /> 67 <van-cell title="打卡提醒" value="{{ form.remindTime }}" is-link border="{{ false }}" bindtap="openClockRemindShow" />
68 </van-cell-group> 68 </van-cell-group>
69 </view> 69 </view>
70 <view class="white_card_nopadding"> 70 <view class="white_card_nopadding">
71 - <van-cell-group> 71 + <van-cell-group border="{{ false }}">
72 <van-cell title="缺卡打卡提醒" value="{{ form.lackNum + ' 次' }}" is-link border="{{ false }}" bindtap="openClockLackShow" /> 72 <van-cell title="缺卡打卡提醒" value="{{ form.lackNum + ' 次' }}" is-link border="{{ false }}" bindtap="openClockLackShow" />
73 </van-cell-group> 73 </van-cell-group>
74 </view> 74 </view>
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 学生如缺卡达到一定条件,将会提醒家长 77 学生如缺卡达到一定条件,将会提醒家长
78 </view> 78 </view>
79 <view class="white_card_nopadding"> 79 <view class="white_card_nopadding">
80 - <van-cell-group> 80 + <van-cell-group border="{{ false }}" >
81 <van-cell title="提交时必须包含" value="{{ form.submitCondition }}" is-link border="{{ false }}" bindtap="openContainShow" /> 81 <van-cell title="提交时必须包含" value="{{ form.submitCondition }}" is-link border="{{ false }}" bindtap="openContainShow" />
82 </van-cell-group> 82 </van-cell-group>
83 </view> 83 </view>
pages/index/punchDetail/punchDetail.js
1 -// pages/index/punchDetail/punchDetail.js 1 +// pages/index/achievement/achievement.js
  2 +// 引入插件安装器
  3 +import plugin from '../../../component/v2/plugins/index'
  4 +import week from '../../../component/v2/plugins/week'
  5 +import todo from '../../../component/v2/plugins/todo'
  6 +import request from '../../../api/request.js'
  7 +import moment from 'moment';
  8 +plugin
  9 + .use(week)
  10 + .use(todo)
2 Page({ 11 Page({
3 12
4 /** 13 /**
5 * 页面的初始数据 14 * 页面的初始数据
6 */ 15 */
7 data: { 16 data: {
8 - showEdit: false, //确认打卡  
9 - Clocked: false, //已打卡状态,只是为了演示用  
10 - showSuccess:false 17 + calendarConfig: {
  18 + theme: 'elegant',
  19 + weekMode: true, // 周视图模式
  20 + highlightToday: true, // 是否高亮显示当天
  21 + hideHeader: true, // 隐藏日历头部操作栏
  22 + },
  23 + isDisplay: false,
  24 + clockShow: false,
  25 + form: {
  26 + id: '', //任务ID
  27 + isRepair: 1, //是否补卡1立即打卡2补卡
  28 + repairDate: '', //补卡日期,当isRepair=2时必传,格式:YYYY-MM-dd
  29 + statisticsUnit: '', //统计单位所含内容
  30 + taskDesc: '', //打卡描述内容
  31 + taskFileUrl: [], //任务文件(含多个)
  32 + userId: ''
  33 + },
  34 + fileList: [],
  35 + calendar: {}, //日历
  36 + valueId: '', //任务ID
  37 + taskVo: {
  38 + allowRepairCard: 0,
  39 + hasData: 0,
  40 + id: 0,
  41 + releaseTime: "",
  42 + signTotal: 0,
  43 + taskCycle: 0,
  44 + taskDesc: "",
  45 + taskFrequency: "",
  46 + taskTitle: "",
  47 + weekDay: ""
  48 + },
  49 + resData: [], //成果数据
  50 + recordVo: {
  51 + commitTime: "",
  52 + files: [],
  53 + signDate: "",
  54 + taskRecordDesc: "",
  55 + taskStatisticsParam: ""
  56 + }, //成果数据当天
  57 + recordVoShow: false,
  58 + isToday:true,//是否是今天
11 }, 59 },
12 -  
13 - /**  
14 - * 生命周期函数--监听页面加载 60 + /**
  61 + * 选择日期后执行的事件
15 */ 62 */
16 - onLoad(options) { 63 + afterTapDate(e) {
  64 + let date = e.detail.date
  65 + let isToday = e.detail.isToday
  66 + this.setData({
  67 + isToday
  68 + })
  69 + let recordVo = this.data.resData.eventDetails[date - 1].recordVo
  70 + if (recordVo != null) {
  71 + console.log('复制',recordVo)
  72 + this.setData({
  73 + recordVo: recordVo
  74 + })
  75 + this.setData({
  76 + recordVoShow: true
  77 + })
  78 + }else {
  79 + this.setData({
  80 + recordVoShow: false
  81 + })
  82 + }
  83 + },
  84 + //获取信息
  85 + getInfo(doday) {
  86 + request({
  87 + url: `/wx/task/getSignRecord`,
  88 + method: 'get',
  89 + data: {
  90 + // wx.getStorageSync('userInfo_id'),
  91 + "taskId": this.data.valueId,
  92 + "signDate": doday
  93 + },
  94 + }).then(res => {
  95 + if (res.code == 0) {
  96 + this.setData({
  97 + resData: res.data
  98 + })
  99 + this.getV2(res.data)
  100 + } else {
  101 + wx.showToast({
  102 + title: res.msg,
  103 + icon: 'none'
  104 + })
  105 + }
  106 + })
  107 + },
  108 + //初始化日历
  109 + initialize() {
  110 + // 设置待办
  111 + this.setData({
  112 + 'calendar': this.selectComponent('#calendar').calendar
  113 + })
17 114
18 }, 115 },
19 - // 打卡成果  
20 - handleAchievement(){ 116 + //显示日历
  117 + getV2(resData) {
  118 + this.setData({
  119 + taskVo: resData.taskVo
  120 + })
  121 + // const calendar = this.selectComponent('#calendar').calendar
  122 + this.data.calendar.setTodos({
  123 + // 待办点标记设置
  124 + pos: 'bottom', // 待办点标记位置 ['top', 'bottom']
  125 + dotColor: 'purple', // 待办点标记颜色
  126 + circle: false, // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥
  127 + showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效
  128 + dates: resData.eventDetails
  129 + })
  130 + },
  131 + //成果
  132 + toAchieve(e) {
21 wx.navigateTo({ 133 wx.navigateTo({
22 - url: '/pages/index/achievement/achievement', 134 + url: '../achievement/achievement?valueId='+this.data.valueId,
23 }) 135 })
24 }, 136 },
25 - // 打开打卡信息填写  
26 - handleEdit() {  
27 - console.log(111) 137 + //唤起 打卡
  138 + toClock() {
  139 + let selectData = this.data.calendar.getSelectedDates()
  140 + let doday = selectData[0].year + '-' + selectData[0].month + '-' + selectData[0].date
  141 + console.log(doday)
  142 +
28 this.setData({ 143 this.setData({
29 - showEdit: true 144 + clockShow: true
30 }) 145 })
31 }, 146 },
32 - // 关闭打卡信息填写  
33 - closeEdit() { 147 + //确定-打卡
  148 + toCardTask() {
34 this.setData({ 149 this.setData({
35 - showEdit: false 150 + 'form.id': this.data.valueId
36 }) 151 })
37 - },  
38 - // 提交打卡信息,跳转打卡成功页面  
39 - handleSubmit() {  
40 this.setData({ 152 this.setData({
41 - Clocked: true,  
42 - showEdit: false,  
43 - showSuccess:true 153 + 'form.userId': wx.getStorageSync('userInfo_id')
  154 + })
  155 + console.log(this.data.form)
  156 + request({
  157 + url: `/wx/task/commitCardTask`,
  158 + method: 'post',
  159 + data: this.data.form,
  160 + }).then(res => {
  161 + if (res.code == 0) {
  162 + wx.showToast({
  163 + title: '打卡成功',
  164 + icon: 'none'
  165 + })
  166 + this.closeClockShow()
  167 + } else {
  168 + wx.showToast({
  169 + title: res.msg,
  170 + icon: 'none'
  171 + })
  172 + }
44 }) 173 })
45 }, 174 },
46 - colseSuccess(){ 175 + /**
  176 + * 生命周期函数--监听页面加载
  177 + */
  178 + onLoad(options) {
47 this.setData({ 179 this.setData({
48 - showSuccess:false 180 + valueId: options.valueId
49 }) 181 })
50 }, 182 },
  183 + /**
  184 + * 生命周期函数--监听页面初次渲染完成
  185 + */
  186 + onReady() {
  187 + this.initialize()
  188 + this.getInfo(moment(new Date().getTime()).format('YYYY-MM-DD'))
  189 + },
  190 + // 统一返回
51 handleBack() { 191 handleBack() {
52 wx.navigateBack() 192 wx.navigateBack()
53 }, 193 },
@@ -56,5 +196,79 @@ Page({ @@ -56,5 +196,79 @@ Page({
56 */ 196 */
57 onShareAppMessage() { 197 onShareAppMessage() {
58 198
  199 + },
  200 + //统计单位所含内容
  201 + onStatisChange(e) {
  202 + this.setData({
  203 + 'form.statisticsUnit': e.detail
  204 + })
  205 + },
  206 + //内容
  207 + onTaskDescChange(e) {
  208 + this.setData({
  209 + 'form.taskDesc': e.detail
  210 + })
  211 + },
  212 + //文件上传
  213 + afterRead(event) {
  214 + const {
  215 + file
  216 + } = event.detail;
  217 + var that = this
  218 + // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  219 + wx.uploadFile({
  220 + url: 'https://market.myjxt.com:51311/file/fileUpload', // 仅为示例,非真实的接口地址
  221 + filePath: file.url,
  222 + name: 'file',
  223 + formData: {
  224 + user: 'test'
  225 + },
  226 + success(res) {
  227 + // 上传完成需要更新 fileList
  228 + const {
  229 + fileList = []
  230 + } = that.data;
  231 + fileList.push({
  232 + ...file,
  233 + url: res.data
  234 + });
  235 + console.log(res, fileList)
  236 + that.setData({
  237 + fileList
  238 + });
  239 + that.setData({
  240 + 'form.taskFileUrl': fileList.map(v => v.url)
  241 + })
  242 + },
  243 + });
  244 + },
  245 + //删除
  246 + delFile(event) {
  247 + let [list, index] = [this.data.fileList, event.detail.index]
  248 + list.splice(index, 1)
  249 + this.setData({
  250 + fileList: list
  251 + })
  252 + this.setData({
  253 + 'form.taskFileUrl': this.data.fileList.map(v => v.url)
  254 + })
  255 + },
  256 + //关闭
  257 + closeClockShow() {
  258 + let form = {
  259 + id: '', //任务ID
  260 + isRepair: 1, //是否补卡1立即打卡2补卡
  261 + repairDate: '', //补卡日期,当isRepair=2时必传,格式:YYYY-MM-dd
  262 + statisticsUnit: '', //统计单位所含内容
  263 + taskDesc: '', //打卡描述内容
  264 + taskFileUrl: [], //任务文件(含多个)
  265 + userId: ''
  266 + }
  267 + this.setData({
  268 + form: form
  269 + })
  270 + this.setData({
  271 + clockShow: false
  272 + })
59 } 273 }
60 }) 274 })
61 \ No newline at end of file 275 \ No newline at end of file
pages/index/punchDetail/punchDetail.json
1 { 1 {
2 "usingComponents": { 2 "usingComponents": {
3 "van-icon": "@vant/weapp/icon/index", 3 "van-icon": "@vant/weapp/icon/index",
4 - "van-popup": "@vant/weapp/popup/index"  
5 - } 4 + "calendar": "/component/v2/index",
  5 + "van-popup": "@vant/weapp/popup/index",
  6 + "van-field": "@vant/weapp/field/index",
  7 + "van-uploader": "@vant/weapp/uploader/index",
  8 + "van-button": "@vant/weapp/button/index"
  9 + },
  10 + "navigationBarTitleText": "立即打卡"
6 } 11 }
7 \ No newline at end of file 12 \ No newline at end of file
pages/index/punchDetail/punchDetail.wxml
1 -<!--pages/index/punchDetail/punchDetail.wxml--> 1 +<!--pages/index/achievement/achievement.wxml-->
2 <view class="punch_detail"> 2 <view class="punch_detail">
3 - <!-- 顶部统一返回 -->  
4 - <view class="navigation_back" bindtap="handleBack">  
5 - <van-icon name="arrow-left" /> 3 + <calendar id="calendar" config="{{calendarConfig}}" bind:afterTapDate="afterTapDate"/>
  4 + <!-- <view class="btn" bindtap="getInfo">按钮</view> -->
  5 + <view class="line_grey"></view>
  6 + <view class="card">
  7 + <view class="card_title">{{taskVo.taskTitle}}</view>
  8 + <view class="card_flex">
  9 + <view class="flex_grey">已进行 {{taskVo.signTotal +' / ' +taskVo.taskCycle}} 天</view>
  10 + <view class="flex_grey">打卡频次 : {{taskVo.taskFrequency}}</view>
  11 + <view class="flex_grey">{{taskVo.hasData == 1 ?'允许补卡': '不允许补卡'}}</view>
  12 + </view>
  13 + <view class="card_context">{{taskVo.taskDesc}}</view>
  14 + <view class="grey_font">
  15 + <view>我发布与{{taskVo.weekDay}} {{taskVo.releaseTime}}</view>
  16 + <view class="grey_font_bottom"></view>
  17 + </view>
  18 + </view>
  19 + <view class="btn_box">
  20 + <van-button round color="#F4F4F4" bindtap='toAchieve' custom-style="color: #000;">我的成果</van-button>
  21 + <van-button round type="info" bindtap='toClock' wx:if="{{isToday}}">立即打卡</van-button>
6 </view> 22 </view>
7 - <!-- 已打卡 -->  
8 - <image class="temporary" wx:if="{{Clocked}}" src="/img/_check_in3.png" mode="widthFix" alt="" />  
9 - <!-- 未打卡 -->  
10 - <image class="temporary" wx:else src="/img/_check_in1.png" mode="widthFix" alt="" />  
11 - <!-- 我的成果 -->  
12 - <text class="temporary_box" wx:if="{{!Clocked}}" style="width: 308rpx;height: 100rpx;position: absolute;top: 1412rpx;left: 32rpx;" bindtap="handleAchievement"></text>  
13 - <!-- 立即打卡 -->  
14 - <text class="temporary_box" wx:if="{{!Clocked}}" style="width: 308rpx;height: 100rpx;position: absolute;top: 1412rpx;right: 32rpx;" bindtap="handleEdit"></text>  
15 23
16 - <!-- 立即打卡 -->  
17 - <van-popup show="{{ showEdit }}" position="bottom" custom-style="height: 80%;" bind:close="closeEdit">  
18 - <image class="temporary" src="/img/_check_in2.png" mode="widthFix" alt="" />  
19 - <text class="temporary_box" style="width: 700rpx;height: 100rpx;position: absolute;top: 1452rpx;right: 32rpx;" bindtap="handleSubmit"></text>  
20 - </van-popup>  
21 - <!-- 打卡成果 -->  
22 - <van-popup show="{{ showSuccess }}" custom-style="width:80%;height: 80%;" bind:close="colseSuccess">  
23 - <image class="temporary" src="/img/_check_in4.png" mode="widthFix" alt="" />  
24 - <text class="temporary_box" style="width: 200rpx;height: 60rpx;position: absolute;top: 800rpx;left: 200rpx;" bindtap="colseSuccess"></text> 24 + <!--打卡-->
  25 + <van-popup show="{{ clockShow }}" position="bottom" custom-style="height: 60%;" round bind:close="closeClockShow">
  26 + <view class="pop_title">提交打卡成果</view>
  27 + <view class="pop_flex">
  28 + <view>提交数据</view>
  29 + <view class="pop_cell">
  30 + <view>
  31 + <van-cell-group>
  32 + <van-field value="{{ form.statisticsUnit }}" placeholder="请输入" border="{{ false }}" bind:change="onStatisChange" />
  33 + </van-cell-group>
  34 + </view>
  35 + <view class="pop_fz">分钟</view>
  36 + </view>
  37 + </view>
  38 + <van-field value="{{ form.taskDesc }}" label="" type="textarea" placeholder="填写内容" autosize border="{{ false }}" bind:change="onTaskDescChange"/>
  39 + <view class="pop_tip">
  40 + <van-uploader accept='image' file-list="{{ fileList }}" deletable="{{ true }}" bind:after-read="afterRead" bind:delete="delFile">
  41 + <view class="tip_item">
  42 + <image class="pop_pic" src="/img/answer/tp1.png" alt="" />
  43 + </view>
  44 + </van-uploader>
  45 + <!-- <image class="pop_pic" src="/img/answer/tp1.png" alt="" /> -->
  46 + </view>
  47 + <view class="pop_btn">
  48 + <van-button type="info" block round bindtap="toCardTask">提 交</van-button>
  49 + </view>
25 </van-popup> 50 </van-popup>
26 </view> 51 </view>
27 \ No newline at end of file 52 \ No newline at end of file
pages/index/punchDetail/punchDetail.wxss
1 /* pages/index/punchDetail/punchDetail.wxss */ 1 /* pages/index/punchDetail/punchDetail.wxss */
  2 +/* pages/index/achievement/achievement.wxss */
  3 +.btn {
  4 + width: 20vw;
  5 + height: 20vw;
  6 + background-color: aqua;
  7 + font-size: 5vw;
  8 +}
  9 +.line_grey {
  10 + width: 90vw;
  11 + height: 1px;
  12 + background-color: #999;
  13 + margin: 10px 5vw 20px;
  14 +}
  15 +.card {
  16 + width: 92vw;
  17 + margin-left: 4vw;
  18 +}
  19 +.card_title {
  20 + font-size: 18px;
  21 + color: #556191;
  22 + margin: 15px 0;
  23 +}
  24 +.card_flex {
  25 + display: flex;
  26 +}
  27 +.flex_grey {
  28 + padding: 7px 10px;
  29 + box-sizing: border-box;
  30 + margin: 0 5px 10px 0;
  31 + font-size: 13px;
  32 + background-color: #F4F4F4;
  33 + color: #666666;
  34 + border-radius: 3px;
  35 +}
  36 +.card_context {
  37 + font-size: 16px;
  38 + margin: 10px 0;
  39 +}
  40 +.grey_font {
  41 + font-size: 14px;
  42 + color: #999999;
  43 + margin: 20px 0;
  44 +}
  45 +.grey_font_bottom {
  46 + margin-top: 5px;
  47 +}
  48 +.btn_box {
  49 + display: flex;
  50 + justify-content: space-around;
  51 + position: fixed;
  52 + bottom: 50px;
  53 + width: 100vw;
  54 +}
  55 +.pop_title {
  56 + font-size: 18px;
  57 + font-weight: bold;
  58 + text-align: center;
  59 + margin: 20px 0;
  60 +}
  61 +.pop_flex {
  62 + display: flex;
  63 + justify-content: space-between;
  64 + align-items: center;
  65 + padding: 0 20px;
  66 + box-sizing: border-box;
  67 +}
  68 +.pop_cell {
  69 + width: 40vw;
  70 + display: flex;
  71 + align-items: center;
  72 +}
  73 +.pop_fz {
  74 + width: 70px;
  75 +}
  76 +.pop_btn {
  77 + position: absolute;
  78 + bottom: 30px;
  79 + width: 90vw;
  80 + margin: 0 5vw;
  81 +}
  82 +.pop_tip {
  83 + position: absolute;
  84 + bottom: 90px;
  85 + width: 90vw;
  86 + margin: 0 5vw;
  87 +}
  88 +.pop_pic {
  89 + width: 70px;
  90 + height: 30px;
  91 +}
2 \ No newline at end of file 92 \ No newline at end of file
pages/index/rank/rank.js
@@ -11,10 +11,19 @@ Page({ @@ -11,10 +11,19 @@ Page({
11 dayTime: '', 11 dayTime: '',
12 user: { 12 user: {
13 id: '', 13 id: '',
14 - name: '', 14 + userName: '',
15 nickname: '', 15 nickname: '',
16 phone: "", 16 phone: "",
17 token: "", 17 token: "",
  18 + headImg: ''
  19 + },
  20 + selfData: {
  21 + id: 0,
  22 + isOneSelf: 0,
  23 + signDayNum: 0,
  24 + signPercentage: "",
  25 + signRecordNum: 0,
  26 + userId: 0
18 } 27 }
19 }, 28 },
20 29
@@ -49,6 +58,27 @@ Page({ @@ -49,6 +58,27 @@ Page({
49 url: '/pages/index/index', 58 url: '/pages/index/index',
50 }) 59 })
51 }, 60 },
  61 + //获取个人
  62 + getSelf() {
  63 + request({
  64 + url: `/wx/task/getOneSelf`,
  65 + method: 'get',
  66 + data: {
  67 + "userId": wx.getStorageSync("userInfo_id")
  68 + },
  69 + }).then(res => {
  70 + if (res.code == 0) {
  71 + this.setData({
  72 + selfData: res.data
  73 + })
  74 + } else {
  75 + wx.showToast({
  76 + title: res.msg,
  77 + icon: 'none',
  78 + })
  79 + }
  80 + })
  81 + },
52 /** 82 /**
53 * 生命周期函数--监听页面加载 83 * 生命周期函数--监听页面加载
54 */ 84 */
@@ -59,16 +89,11 @@ Page({ @@ -59,16 +89,11 @@ Page({
59 this.setData({ 89 this.setData({
60 "dayTime": moment(new Date().getTime()).format('YYYY-MM-DD') 90 "dayTime": moment(new Date().getTime()).format('YYYY-MM-DD')
61 }) 91 })
  92 + this.getSelf()
62 this.getRankList() 93 this.getRankList()
63 }, 94 },
64 // 统一返回 95 // 统一返回
65 handleBack() { 96 handleBack() {
66 wx.navigateBack() 97 wx.navigateBack()
67 }, 98 },
68 - /**  
69 - * 用户点击右上角分享  
70 - */  
71 - onShareAppMessage() {  
72 -  
73 - }  
74 }) 99 })
75 \ No newline at end of file 100 \ No newline at end of file
pages/index/rank/rank.wxml
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 <view class="white_box"> 5 <view class="white_box">
6 <view class="title_box"> 6 <view class="title_box">
7 <view class="title_pic"> 7 <view class="title_pic">
8 - <image class="pic" src="/img/answer/user.png" alt="" />  
9 - {{user.name}} 8 + <image class="pic" src="{{user.headImg}}" alt="" />
  9 + {{user.userName != null ? user.userName : user.nickname}}
10 </view> 10 </view>
11 - <view class="red_title">已坚持xx天</view>  
12 - <view class="red_title">xx次</view> 11 + <view class="red_title">已坚持{{selfData.signDayNum}}天</view>
  12 + <view class="red_title">{{selfData.signRecordNum}}次</view>
13 </view> 13 </view>
14 <view class="grey_title"> 14 <view class="grey_title">
15 <view class="table_L"> 15 <view class="table_L">
@@ -25,11 +25,11 @@ @@ -25,11 +25,11 @@
25 <image wx:if="{{index == 1}}" class="tem_pic" src="/img/answer/2.png" alt="" /> 25 <image wx:if="{{index == 1}}" class="tem_pic" src="/img/answer/2.png" alt="" />
26 <image wx:if="{{index == 2}}" class="tem_pic" src="/img/answer/3.png" alt="" /> 26 <image wx:if="{{index == 2}}" class="tem_pic" src="/img/answer/3.png" alt="" />
27 <view class="tem_pic" wx:if="{{index != 0 && index != 1 && index != 2}}">{{index + 1}}</view> 27 <view class="tem_pic" wx:if="{{index != 0 && index != 1 && index != 2}}">{{index + 1}}</view>
28 - <view>{{value.name}}</view> 28 + <view>{{value.userName}}</view>
29 </view> 29 </view>
30 <view class="table_R"> 30 <view class="table_R">
31 - <view class="grey_R">已坚持52天</view>  
32 - <view>120</view> 31 + <view class="grey_R">已坚持{{value.signDayNum}}天</view>
  32 + <view>{{value.signRecordNum}}</view>
33 </view> 33 </view>
34 </view> 34 </view>
35 </view> 35 </view>
pages/index/rank/rank.wxss
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 width: 28vw; 58 width: 28vw;
59 display: flex; 59 display: flex;
60 justify-content: space-between; 60 justify-content: space-between;
61 - 61 + align-items: center;
62 } 62 }
63 .L_box { 63 .L_box {
64 width: 50px; 64 width: 50px;
pages/login/codeLogin/codeLogin.js
@@ -90,7 +90,7 @@ Page({ @@ -90,7 +90,7 @@ Page({
90 wx.setStorageSync('userInfo', res.data) 90 wx.setStorageSync('userInfo', res.data)
91 wx.setStorageSync('userInfo_id', res.data.id) 91 wx.setStorageSync('userInfo_id', res.data.id)
92 wx.switchTab({ 92 wx.switchTab({
93 - url: '/pages/index/rank/rank', 93 + url: '/pages/mine/index',
94 }) 94 })
95 }) 95 })
96 } else { 96 } else {
pages/login/codeLogin/codeLogin.wxml
@@ -7,18 +7,18 @@ @@ -7,18 +7,18 @@
7 <text class="title" selectable="false" space="false" decode="false">欢迎登录</text> 7 <text class="title" selectable="false" space="false" decode="false">欢迎登录</text>
8 </view> 8 </view>
9 <view class="tips_box"> 9 <view class="tips_box">
10 - <!-- <text class="tips" selectable="false" space="false" decode="false">请输入登录资料</text> --> 10 + <text class="tips" selectable="false" space="false" decode="false">请输入登录资料</text>
11 </view> 11 </view>
12 <view class='cont-box'> 12 <view class='cont-box'>
13 - <!-- <view class="phoneBox"> 13 + <view class="phoneBox">
14 <input type='number' placeholder='请输入手机号' bindinput="bindUserName" /> 14 <input type='number' placeholder='请输入手机号' bindinput="bindUserName" />
15 </view> 15 </view>
16 <view class="codeBox"> 16 <view class="codeBox">
17 <input type='number' class="codeInput" placeholder='请输入短信验证码' bindinput="bindCode" /> 17 <input type='number' class="codeInput" placeholder='请输入短信验证码' bindinput="bindCode" />
18 <view class="getCode" bindtap="getCode">{{codeCont}}</view> 18 <view class="getCode" bindtap="getCode">{{codeCont}}</view>
19 - </view> --> 19 + </view>
20 <view class="btnBox"> 20 <view class="btnBox">
21 - <!-- <text class="next button" bindtap='next'>登  录</text> --> 21 + <text class="next button" bindtap='next'>登  录</text>
22 <!-- <navigator url="/pages/login/login" class="vipLogin button">微信登陆</navigator> --> 22 <!-- <navigator url="/pages/login/login" class="vipLogin button">微信登陆</navigator> -->
23 <button class="one_click_btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">微信一键登陆</button> 23 <button class="one_click_btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">微信一键登陆</button>
24 </view> 24 </view>
pages/login/codeLogin/codeLogin.wxss
@@ -126,4 +126,8 @@ @@ -126,4 +126,8 @@
126 126
127 .footer_tips navigator { 127 .footer_tips navigator {
128 display: inline-flex; 128 display: inline-flex;
  129 +}
  130 +
  131 +.van-cell {
  132 + border: none;
129 } 133 }
130 \ No newline at end of file 134 \ No newline at end of file
pages/login/loginNew/loginNew.js 0 → 100644
@@ -0,0 +1,161 @@ @@ -0,0 +1,161 @@
  1 +// pages/login/loginNew/loginNew.js
  2 +import request from '../../../api/request.js'
  3 +var appid = 'wx186236fdcd93edcc';
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + checked: true,
  11 + session_key: '',
  12 + openId: '',
  13 + encryptedData: '',
  14 + iv: '',
  15 + phone: ''
  16 + },
  17 + //多选框
  18 + onChange(e) {
  19 + this.setData({
  20 + checked: e.detail
  21 + })
  22 + },
  23 + //获取session_key
  24 + getOpenId() {
  25 + return request({
  26 + url: `/wx/app/getOpenId/wx186236fdcd93edcc`,
  27 + method: 'get',
  28 + data: {
  29 + code: this.data.loginCode
  30 + },
  31 + }).then(res2 => {
  32 + this.setData({
  33 + session_key: res2.data.sessionKey
  34 + })
  35 + this.setData({
  36 + openId: res2.data.openid
  37 + })
  38 + console.log(this.data);
  39 + })
  40 + },
  41 + getPhoneNumber(e) {
  42 + console.log('?')
  43 + if(!this.data.checked) {
  44 + return wx.showToast({title: '请先阅读并同意用户协议和隐私协议',icon: 'none'})
  45 + }
  46 + console.log(e.detail)
  47 + if (e.detail.errMsg == 'getPhoneNumber:ok') {
  48 + this.setData({
  49 + encryptedData: e.detail.encryptedData,
  50 + iv: e.detail.iv,
  51 + }, () => {
  52 + this.login()
  53 + })
  54 + }
  55 + },
  56 + login() {
  57 + if (!this.data.encryptedData || !this.data.session_key || !this.data.iv) {
  58 + wx.showToast({
  59 + title: '一键登陆失败,请重试',
  60 + icon: 'none',
  61 + duration: 2000
  62 + })
  63 + }
  64 + request({
  65 + url: `/wx/app/oneClickLogin/`+ appid,
  66 + method: 'post',
  67 + data: {
  68 + "encryptedData": this.data.encryptedData,
  69 + "sessionKey": this.data.session_key,
  70 + "iv": this.data.iv,
  71 + "openId": this.data.openId
  72 + },
  73 + }).then(res => {
  74 + if (res.code == 0) {
  75 + if (res.data) {
  76 + this.setData({
  77 + phone: res.data.phone
  78 + }, () => {
  79 + wx.setStorageSync('userInfo', res.data)
  80 + wx.setStorageSync('userInfo_id', res.data.id)
  81 + wx.switchTab({
  82 + url: '/pages/mine/index',
  83 + })
  84 + })
  85 + } else {
  86 + wx.showToast({
  87 + title: '一键登陆失败,请重试',
  88 + icon: 'none',
  89 + duration: 2000
  90 + })
  91 + }
  92 + }
  93 + })
  94 + },
  95 + /**
  96 + * 生命周期函数--监听页面加载
  97 + */
  98 + onLoad() {
  99 + wx.login({
  100 + success: (res) => {
  101 + if (res.code) {
  102 + this.setData({
  103 + loginCode: res.code
  104 + })
  105 + this.getOpenId()
  106 + } else {
  107 + console.log('登录失败!' + res.errMsg)
  108 + }
  109 + }
  110 + })
  111 + },
  112 +
  113 + /**
  114 + * 生命周期函数--监听页面初次渲染完成
  115 + */
  116 + onReady() {
  117 +
  118 + },
  119 +
  120 + /**
  121 + * 生命周期函数--监听页面显示
  122 + */
  123 + onShow() {
  124 +
  125 + },
  126 +
  127 + /**
  128 + * 生命周期函数--监听页面隐藏
  129 + */
  130 + onHide() {
  131 +
  132 + },
  133 +
  134 + /**
  135 + * 生命周期函数--监听页面卸载
  136 + */
  137 + onUnload() {
  138 +
  139 + },
  140 +
  141 + /**
  142 + * 页面相关事件处理函数--监听用户下拉动作
  143 + */
  144 + onPullDownRefresh() {
  145 +
  146 + },
  147 +
  148 + /**
  149 + * 页面上拉触底事件的处理函数
  150 + */
  151 + onReachBottom() {
  152 +
  153 + },
  154 +
  155 + /**
  156 + * 用户点击右上角分享
  157 + */
  158 + onShareAppMessage() {
  159 +
  160 + }
  161 +})
0 \ No newline at end of file 162 \ No newline at end of file
pages/login/loginNew/loginNew.json 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +{
  2 + "usingComponents": {
  3 + "van-button": "@vant/weapp/button/index",
  4 + "van-checkbox": "@vant/weapp/checkbox/index",
  5 + "van-checkbox-group": "@vant/weapp/checkbox-group/index"
  6 + },
  7 + "navigationBarTitleText": "登录"
  8 +}
0 \ No newline at end of file 9 \ No newline at end of file
pages/login/loginNew/loginNew.wxml 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +<!--pages/login/loginNew/loginNew.wxml-->
  2 +<view>
  3 + <view class="box">
  4 + <view class="img_box">
  5 + <image class="pic" src="/img/login_img.png" alt="" />
  6 + </view>
  7 + <view class="box_title">Hey</view>
  8 + <view class="box_grey">欢迎使用自主学习之旅~</view>
  9 + </view>
  10 + <view class="fied_box">
  11 + <view>
  12 + <van-button type="info" block round open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登 录</van-button>
  13 + </view>
  14 + <view class="small_font">
  15 + <van-checkbox value="{{ checked }}" shape="square" bind:change="onChange" icon-size='15'>
  16 + 已同意<text class="blue_font"> 用户协议 </text>和<text class="blue_font"> 隐私协议 </text>
  17 + </van-checkbox>
  18 + </view>
  19 + <van-notify id="van-notify" />
  20 + </view>
  21 +</view>
0 \ No newline at end of file 22 \ No newline at end of file
pages/login/loginNew/loginNew.wxss 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +/* pages/login/loginNew/loginNew.wxss */
  2 +.box {
  3 + display: flex;
  4 + justify-content: center;
  5 + flex-wrap: wrap;
  6 +}
  7 +.img_box {
  8 + width: 60vw;
  9 + height: 60vw;
  10 + margin: 100px 0 30px;
  11 +}
  12 +.pic {
  13 + width: 100%;
  14 + height: 100%;
  15 +}
  16 +.box_title {
  17 + width: 100%;
  18 + text-align: center;
  19 + margin: 15px 0;
  20 + font-weight: bold;
  21 +}
  22 +.box_grey {
  23 + width: 100%;
  24 + text-align: center;
  25 + color: #999;
  26 +}
  27 +.fied_box {
  28 + position: fixed;
  29 + bottom: 40px;
  30 + width: 100%;
  31 + padding: 0 30px;
  32 + box-sizing: border-box;
  33 +}
  34 +.small_font {
  35 + display: flex;
  36 + justify-content: center;
  37 + font-size: 12px;
  38 + margin: 10px 0 0;
  39 +}
  40 +.blue_font {
  41 + color: #3578F9;
  42 + text-decoration:underline;
  43 +}
0 \ No newline at end of file 44 \ No newline at end of file
pages/mine/index.js
@@ -8,6 +8,7 @@ Page({ @@ -8,6 +8,7 @@ Page({
8 data: { 8 data: {
9 user_name: '', 9 user_name: '',
10 user_phone: '', 10 user_phone: '',
  11 + user_img: '',
11 }, 12 },
12 // 打卡记录 13 // 打卡记录
13 handleRecord(){ 14 handleRecord(){
@@ -15,10 +16,12 @@ Page({ @@ -15,10 +16,12 @@ Page({
15 url: '/pages/mine/record/record', 16 url: '/pages/mine/record/record',
16 }) 17 })
17 }, 18 },
18 -// 退出登录 19 + // 退出登录
19 handleLoginOut(){ 20 handleLoginOut(){
  21 + wx.clearStorage()
  22 + wx.clearStorageSync()
20 wx.navigateTo({ 23 wx.navigateTo({
21 - url: '/pages/login/codeLogin/codeLogin', 24 + url: '/pages/login/loginNew/loginNew',
22 }) 25 })
23 }, 26 },
24 /** 27 /**
@@ -27,8 +30,9 @@ Page({ @@ -27,8 +30,9 @@ Page({
27 onLoad(options) { 30 onLoad(options) {
28 let userInfo = wx.getStorageSync('userInfo') 31 let userInfo = wx.getStorageSync('userInfo')
29 this.setData({ 32 this.setData({
30 - "user_name": userInfo.name || userInfo.nickname,  
31 - "user_phone": userInfo.phone 33 + "user_name": userInfo.userName || userInfo.nickname,
  34 + "user_phone": userInfo.phone,
  35 + 'user_img':userInfo.headImg,
32 }) 36 })
33 }, 37 },
34 /** 38 /**
pages/mine/index.wxml
1 <view class="mine" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/89741dbf-cc76-45a6-a3c9-a210eb7deeef.png')"> 1 <view class="mine" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/89741dbf-cc76-45a6-a3c9-a210eb7deeef.png')">
2 <view class="title"> 2 <view class="title">
3 <view> 3 <view>
4 - <image class="pic" src="/img/answer/user.png" alt="" /> 4 + <image class="pic" src="{{user_img}}" alt="" />
5 </view> 5 </view>
6 <view class="title_box"> 6 <view class="title_box">
7 <view class="title_name">{{user_name}}</view> 7 <view class="title_name">{{user_name}}</view>
pages/mine/record/record.js
@@ -23,7 +23,7 @@ Page({ @@ -23,7 +23,7 @@ Page({
23 url: `/wx/task/cardTaskList`, 23 url: `/wx/task/cardTaskList`,
24 method: 'post', 24 method: 'post',
25 data: { 25 data: {
26 - "oneselfFlag": this.data.tabindex + 1, 26 + "oneselfFlag": this.data.tabindex + 1 ,
27 "page": 1, 27 "page": 1,
28 "pageSize": 999, 28 "pageSize": 999,
29 "userId": wx.getStorageSync("userInfo_id") 29 "userId": wx.getStorageSync("userInfo_id")
@@ -99,15 +99,15 @@ Page({ @@ -99,15 +99,15 @@ Page({
99 this.getTaskList() 99 this.getTaskList()
100 }, 100 },
101 // 打卡成果 101 // 打卡成果
102 - handleAchievement() { 102 + handleAchievement(e) {
103 wx.navigateTo({ 103 wx.navigateTo({
104 - url: '/pages/index/achievement/achievement', 104 + url: '/pages/index/achievement/achievement?valueId='+e.currentTarget.dataset.valueid ,
105 }) 105 })
106 }, 106 },
107 // 去打卡 107 // 去打卡
108 - handleDetail() { 108 + handleDetail(e) {
109 wx.navigateTo({ 109 wx.navigateTo({
110 - url: '/pages/index/punchDetail/punchDetail', 110 + url: '/pages/index/punchDetail/punchDetail?valueId='+e.currentTarget.dataset.valueid ,
111 }) 111 })
112 }, 112 },
113 // 统一返回 113 // 统一返回
pages/mine/record/record.wxml
@@ -38,13 +38,13 @@ @@ -38,13 +38,13 @@
38 {{value.allowRepairCard == 1 ? '允许补卡': '不允许补卡'}} 38 {{value.allowRepairCard == 1 ? '允许补卡': '不允许补卡'}}
39 </view> 39 </view>
40 <view class="grey_line"></view> 40 <view class="grey_line"></view>
41 - <view class="blue_font" wx:if="{{tabindex == 1}}">  
42 - <view bindtap="handleAchievement">我的成果</view> 41 + <view class="blue_font" wx:if="{{tabindex == 0}}">
  42 + <view bindtap="handleAchievement" data-valueId="{{value.id}}">我的成果</view>
43 <view class="blue_line"></view> 43 <view class="blue_line"></view>
44 - <view bindtap="handleDetail">去打卡</view> 44 + <view bindtap="handleDetail" data-valueId="{{value.id}}">去打卡</view>
45 </view> 45 </view>
46 <view class="blue_font" wx:else> 46 <view class="blue_font" wx:else>
47 - <view bindtap="handleAchievement">打卡成果</view> 47 + <view bindtap="handleAchievement" data-valueId="{{value.id}}">打卡成果</view>
48 </view> 48 </view>
49 </view> 49 </view>
50 50
pages/mine/record/record.wxss
@@ -21,10 +21,10 @@ @@ -21,10 +21,10 @@
21 21
22 .card { 22 .card {
23 width: 92vw; 23 width: 92vw;
24 - height: 370px;  
25 background-color: #fff; 24 background-color: #fff;
26 border-radius: 8vw; 25 border-radius: 8vw;
27 padding: 8vw; 26 padding: 8vw;
  27 + margin-bottom: 30px;
28 box-sizing: border-box; 28 box-sizing: border-box;
29 box-shadow: 1px 1px 1px 1px rgb(228, 228, 228); 29 box-shadow: 1px 1px 1px 1px rgb(228, 228, 228);
30 } 30 }
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 .blue_font { 96 .blue_font {
97 display: flex; 97 display: flex;
98 justify-content: space-around; 98 justify-content: space-around;
99 - margin-top: 20px; 99 + margin-top: 15px;
100 font-size: 4.1vw; 100 font-size: 4.1vw;
101 color: #458EF8; 101 color: #458EF8;
102 font-weight: 540; 102 font-weight: 540;
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 104
105 .blue_line { 105 .blue_line {
106 width: 1px; 106 width: 1px;
107 - height: 20px; 107 + height: 15px;
108 background-color: #EAEAEA; 108 background-color: #EAEAEA;
109 } 109 }
110 110