Commit 8cd16d4b24ca7fda798a8259400bcb08092ca5c4

Authored by
1 parent d46806b9
Exists in master

feat:打卡模板创建

打卡模板创建
1 { 1 {
2 "pages": [ 2 "pages": [
  3 + "pages/login/codeLogin/codeLogin",
3 "pages/index/rank/rank", 4 "pages/index/rank/rank",
4 "pages/index/index", 5 "pages/index/index",
5 - "pages/login/codeLogin/codeLogin",  
6 "pages/index/achievement/achievement", 6 "pages/index/achievement/achievement",
7 "pages/index/newPunch/newPunch", 7 "pages/index/newPunch/newPunch",
8 "pages/mine/record/record", 8 "pages/mine/record/record",
package-lock.json
@@ -8,6 +8,11 @@ @@ -8,6 +8,11 @@
8 "version": "1.10.5", 8 "version": "1.10.5",
9 "resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.5.tgz", 9 "resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.5.tgz",
10 "integrity": "sha512-bAHp9r0ZiRsOqPOLzQHI/ZvkAlXzol1/TFhM70MyghuxkzJTjcDUd8RIfLkCN3c1MCK/PfBGw2an8/afygftCg==" 10 "integrity": "sha512-bAHp9r0ZiRsOqPOLzQHI/ZvkAlXzol1/TFhM70MyghuxkzJTjcDUd8RIfLkCN3c1MCK/PfBGw2an8/afygftCg=="
  11 + },
  12 + "moment": {
  13 + "version": "2.29.4",
  14 + "resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz",
  15 + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
11 } 16 }
12 } 17 }
13 } 18 }
@@ -4,7 +4,8 @@ @@ -4,7 +4,8 @@
4 "description": "计划管家", 4 "description": "计划管家",
5 "main": "app.js", 5 "main": "app.js",
6 "dependencies": { 6 "dependencies": {
7 - "@vant/weapp": "^1.10.5" 7 + "@vant/weapp": "^1.10.5",
  8 + "moment": "^2.29.4"
8 }, 9 },
9 "scripts": { 10 "scripts": {
10 "test": "echo \"Error: no test specified\" && exit 1" 11 "test": "echo \"Error: no test specified\" && exit 1"
pages/index/index.js
@@ -5,6 +5,7 @@ import request from '../../api/request.js' @@ -5,6 +5,7 @@ import request from '../../api/request.js'
5 Page({ 5 Page({
6 data: { 6 data: {
7 active: 1, 7 active: 1,
  8 + taskList: []
8 // bannerList: [], // 轮播图 9 // bannerList: [], // 轮播图
9 }, 10 },
10 checkTabs(e) { 11 checkTabs(e) {
@@ -13,11 +14,37 @@ Page({ @@ -13,11 +14,37 @@ Page({
13 active: index 14 active: index
14 }) //修改参数 15 }) //修改参数
15 }, 16 },
  17 +
  18 + //打卡记录列表
  19 + getTaskList() {
  20 + request({
  21 + url: `/wx/task/cardTaskList`,
  22 + method: 'post',
  23 + data: {
  24 + "oneselfFlag": 1,
  25 + "page": 1,
  26 + "pageSize": 999,
  27 + "userId": wx.getStorageSync("userInfo_id")
  28 + },
  29 + }).then(res => {
  30 + if (res.code == 0) {
  31 + this.setData({
  32 + taskList: res.rows
  33 + })
  34 + } else {
  35 + wx.showToast({
  36 + title: res.msg,
  37 + icon: 'none',
  38 + duration: 1500
  39 + })
  40 + }
  41 + })
  42 + },
16 43
17 //查看排行榜 44 //查看排行榜
18 toRank() { 45 toRank() {
19 - wx.navigateTo({  
20 - url: `../index/rank/rank` 46 + wx.switchTab({
  47 + url: './rank/rank',
21 }) 48 })
22 }, 49 },
23 50
@@ -40,6 +67,7 @@ Page({ @@ -40,6 +67,7 @@ Page({
40 // this.getBannerList() //获取banner 67 // this.getBannerList() //获取banner
41 }, 68 },
42 onShow: function (options) { 69 onShow: function (options) {
  70 + this.getTaskList()
43 this.setData({ 71 this.setData({
44 showAdd: false 72 showAdd: false
45 }) 73 })
pages/index/index.wxml
@@ -13,34 +13,34 @@ @@ -13,34 +13,34 @@
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"> 16 + <view class="card" wx:for="{{taskList}}" wx:key="index" wx:for-item="value">
17 <view class="card_title"> 17 <view class="card_title">
18 <view class="title_L"> 18 <view class="title_L">
19 <image class="title_pic" src="/img/answer/bj.png" alt="" /> 19 <image class="title_pic" src="/img/answer/bj.png" alt="" />
20 </view> 20 </view>
21 <view class="title_R"> 21 <view class="title_R">
22 - <view>英语单词每日打卡</view>  
23 - <view class="grey_font">我发布于09-09 08:21</view> 22 + <view>{{value.taskTitle}}</view>
  23 + <view class="grey_font">开始时间 {{value.startDate}}</view>
24 </view> 24 </view>
25 </view> 25 </view>
26 - <view class="day_font">每日20个英文单词背诵</view>  
27 - <view class="day_font2">已坚持打卡 26 + <view class="day_font">{{value.taskDesc}}</view>
  27 + <!-- <view class="day_font2">已坚持打卡
28 <text class="day_font2_large">1/50 </text>天 28 <text class="day_font2_large">1/50 </text>天
29 - </view> 29 + </view> -->
30 <view> 30 <view>
31 <van-progress percentage="50" color='#3F5EFF' stroke-width="13" pivot-text=' ' /> 31 <van-progress percentage="50" color='#3F5EFF' stroke-width="13" pivot-text=' ' />
32 </view> 32 </view>
33 <view class="flex_font"> 33 <view class="flex_font">
34 <text class="grey_flex">打卡频次:</text> 34 <text class="grey_flex">打卡频次:</text>
35 - 每天 35 + {{value.taskFrequency}}
36 </view> 36 </view>
37 - <view class="flex_font"> 37 + <view class="flex_font" wx:if="{{value.submitCondition != null}}">
38 <text class="grey_flex">打卡要求:</text> 38 <text class="grey_flex">打卡要求:</text>
39 - 需填写单词个数 39 + {{'需要' + value.submitCondition}}
40 </view> 40 </view>
41 <view class="flex_font"> 41 <view class="flex_font">
42 <view class="grey_flex">其他:</view> 42 <view class="grey_flex">其他:</view>
43 - 不允许补卡 43 + {{value.allowRepairCard == 1 ? '允许补卡': '不允许补卡'}}
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">
pages/index/index.wxss
@@ -63,10 +63,10 @@ @@ -63,10 +63,10 @@
63 63
64 .card { 64 .card {
65 width: 90vw; 65 width: 90vw;
66 - height: 400px;  
67 background-color: #fff; 66 background-color: #fff;
68 border-radius: 8vw; 67 border-radius: 8vw;
69 padding: 8vw 7vw; 68 padding: 8vw 7vw;
  69 + margin-bottom: 30px;
70 box-sizing: border-box; 70 box-sizing: border-box;
71 box-shadow: 1px 1px 1px 1px rgb(196, 196, 196); 71 box-shadow: 1px 1px 1px 1px rgb(196, 196, 196);
72 } 72 }
pages/index/newPunch/newPunch.js
1 // pages/index/rank/rank.js 1 // pages/index/rank/rank.js
  2 +import request from '../../../api/request.js'
  3 +import moment from 'moment';
2 Page({ 4 Page({
3 5
4 /** 6 /**
5 * 页面的初始数据 7 * 页面的初始数据
6 */ 8 */
7 data: { 9 data: {
  10 + tempId: 0,
8 form: { 11 form: {
9 - biaoti: '',  
10 - message: '',  
11 - checked: true 12 + taskTitle: '', //任务标题
  13 + taskDesc: '', //任务描述内容
  14 + allowRepairCard: false, //是否允许补卡 1是 2否
  15 + hasData: false, //是否需要提交数据 1是 2否
  16 + // id: '', // 任务ID
  17 + lackNum: '', // 缺卡次数
  18 + remindTime: '', // 打卡提醒时间点
  19 + startDate: '', // 打卡开始时间
  20 + statisticsUnit: '', // 统计单位 hasData=1 时,必传
  21 + submitCondition: '', //提交包含条件:图片、视频、音频
  22 + taskCycle: '', //打卡周期
  23 + taskFileUrl: [], //任务文件(含多个)
  24 + taskFrequency: '', //打卡频次
  25 + userId: '', //所属用户ID
12 }, 26 },
  27 + fileList: [],
13 //弹出层 28 //弹出层
14 //统计单位 29 //统计单位
15 unitShow: false, 30 unitShow: false,
16 - columnsUnit: ['杭州', '宁波', '温州', '嘉兴', '湖州'], 31 + columnsUnit: ['小时', '天', '月'],
17 //开始时间 32 //开始时间
18 startTimeShow: false, 33 startTimeShow: false,
19 columnsStartTime: ['9', '10', '11', '12'], 34 columnsStartTime: ['9', '10', '11', '12'],
  35 + minDate: new Date().getTime(),
  36 + currentDate: new Date().getTime(),
  37 + formatter(type, value) {
  38 + if (type === 'year') {
  39 + return `${value}年`;
  40 + }
  41 + if (type === 'month') {
  42 + return `${value}月`;
  43 + }
  44 + return value;
  45 + },
20 //打卡周期 46 //打卡周期
21 clockCycleShow: false, 47 clockCycleShow: false,
22 - columnsClockCycle: ['30天', '60天', '90天', '120天'], 48 + columnsClockCycle: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
23 //打卡频次 49 //打卡频次
24 clockRateShow: false, 50 clockRateShow: false,
25 columnsClockRate: ['每天', '7天', '一个月'], 51 columnsClockRate: ['每天', '7天', '一个月'],
26 //打卡提醒 52 //打卡提醒
27 clockRemindShow: false, 53 clockRemindShow: false,
28 - columnsClockRemind: ['18:00', '19:00'], 54 + columnsClockRemind: [
  55 + {
  56 + values: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  57 + defaultIndex: 2,
  58 + },
  59 + // 第二列
  60 + {
  61 + values: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00'],
  62 + defaultIndex: 1,
  63 + },
  64 + ],
29 //打卡缺卡提醒 65 //打卡缺卡提醒
30 clockLackShow: false, 66 clockLackShow: false,
31 - columnsClockLack: ['缺卡三天以上', '缺卡十天以上', '缺卡三十天以上'], 67 + columnsClockLack: [1,2,3],
32 //必须包含 68 //必须包含
33 containShow: false, 69 containShow: false,
34 - columnsContain: ['图片', '视频', '音频'], 70 + columnsContain: ['图片'],
  71 + },
  72 + //获取模板详情 / 空模板
  73 + getDetail() {
  74 + request({
  75 + url: `/wx/temp/getTempDetail`,
  76 + method: 'get',
  77 + data: {
  78 + "tempId": this.data.tempId,
  79 + },
  80 + }).then(res => {
  81 + if (res.code == 0) {
  82 + const data = res.data
  83 + this.setData({
  84 + 'form.taskTitle': data.taskTitle
  85 + })
  86 + this.setData({
  87 + 'form.taskDesc': data.taskDesc
  88 + })
  89 + this.setData({
  90 + 'form.allowRepairCard': data.allowRepairCard
  91 + })
  92 + this.setData({
  93 + 'form.hasData': data.hasData
  94 + })
  95 + this.setData({
  96 + 'form.lackNum': data.lackNum
  97 + })
  98 + this.setData({
  99 + 'form.remindTime': data.remindTime
  100 + })
  101 + this.setData({
  102 + 'form.startDate': data.startDate
  103 + })
  104 + this.setData({
  105 + 'form.statisticsUnit': data.statisticsUnit
  106 + })
  107 + this.setData({
  108 + 'form.submitCondition': data.submitCondition
  109 + })
  110 + this.setData({
  111 + 'form.taskCycle': data.taskCycle
  112 + })
  113 + this.setData({
  114 + 'form.taskFileUrl': []
  115 + })
  116 + this.setData({
  117 + 'form.taskFrequency': data.taskFrequency
  118 + })
  119 + } else {
  120 + wx.showToast({
  121 + title: res.msg,
  122 + icon: 'none',
  123 + duration: 1000
  124 + })
  125 + }
  126 + })
35 }, 127 },
36 //输入 128 //输入
37 - onfieldChange() {  
38 - 129 + onfieldChange(e) {
  130 + this.setData({
  131 + 'form.taskTitle': e.detail
  132 + })
  133 + },
  134 + //输入
  135 + onfieldDescChange(e) {
  136 + this.setData({
  137 + 'form.taskDesc': e.detail
  138 + })
  139 + },
  140 + //开关
  141 + onSwitch(e) {
  142 + console.log(e)
  143 + this.setData({
  144 + 'form.hasData': e.detail
  145 + })
  146 + },
  147 + onChange(e) {
  148 + console.log(e)
  149 + this.setData({
  150 + 'form.allowRepairCard': e.detail
  151 + })
  152 + },
  153 + //文件上传
  154 + afterRead(event) {
  155 + const {
  156 + file
  157 + } = event.detail;
  158 + var that = this
  159 + // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  160 + wx.uploadFile({
  161 + url: 'https://market.myjxt.com:51311/file/fileUpload', // 仅为示例,非真实的接口地址
  162 + filePath: file.url,
  163 + name: 'file',
  164 + formData: {
  165 + user: 'test'
  166 + },
  167 + success(res) {
  168 + // 上传完成需要更新 fileList
  169 + const {
  170 + fileList = []
  171 + } = that.data;
  172 + fileList.push({
  173 + ...file,
  174 + url: res.data
  175 + });
  176 + console.log(res,fileList)
  177 + that.setData({
  178 + fileList
  179 + });
  180 + that.setData({
  181 + 'form.taskFileUrl': fileList.map(v => v.url)
  182 + })
  183 + },
  184 + });
39 }, 185 },
40 //开关 186 //开关
41 onswitchChange({ 187 onswitchChange({
@@ -45,11 +191,39 @@ Page({ @@ -45,11 +191,39 @@ Page({
45 'form.checked': detail 191 'form.checked': detail
46 }); 192 });
47 }, 193 },
  194 + //创建
  195 + createTask() {
  196 + console.log(this.data.form)
  197 + request({
  198 + url: `/wx/task/addCardTask`,
  199 + method: 'post',
  200 + data: this.data.form,
  201 + }).then(res => {
  202 + if (res.code == 0) {
  203 + wx.navigateTo({
  204 +    url: '../../mine/record/record'
  205 + })
  206 + }else {
  207 + wx.showToast({
  208 + title: res.msg,
  209 + icon: 'none',
  210 + duration: 1000
  211 + })
  212 + }
  213 + })
  214 + },
48 /** 215 /**
49 * 生命周期函数--监听页面加载 216 * 生命周期函数--监听页面加载
50 */ 217 */
51 onLoad(options) { 218 onLoad(options) {
52 - 219 + this.setData({
  220 + 'form.userId': wx.getStorageSync('userInfo_id')
  221 + })
  222 + this.setData({
  223 + tempId: options.tempId
  224 + }, () => {
  225 + this.getDetail()
  226 + })
53 }, 227 },
54 // 创建完成 228 // 创建完成
55 handleCreate() { 229 handleCreate() {
@@ -81,7 +255,11 @@ Page({ @@ -81,7 +255,11 @@ Page({
81 unitShow: false 255 unitShow: false
82 }) 256 })
83 }, 257 },
84 - changeUnitShow() { 258 + changeUnitShow(e) {
  259 + console.log(e)
  260 + this.setData({
  261 + 'form.statisticsUnit': e.detail.value
  262 + })
85 this.setData({ 263 this.setData({
86 unitShow: false 264 unitShow: false
87 }) 265 })
@@ -99,7 +277,11 @@ Page({ @@ -99,7 +277,11 @@ Page({
99 startTimeShow: false 277 startTimeShow: false
100 }) 278 })
101 }, 279 },
102 - changeStartTimeShow() { 280 + changeStartTimeShow(e) {
  281 + let time = moment(e.detail).format('YYYY-MM-DD')
  282 + this.setData({
  283 + 'form.startDate': time,
  284 + });
103 this.setData({ 285 this.setData({
104 startTimeShow: false 286 startTimeShow: false
105 }) 287 })
@@ -117,7 +299,10 @@ Page({ @@ -117,7 +299,10 @@ Page({
117 clockCycleShow: false 299 clockCycleShow: false
118 }) 300 })
119 }, 301 },
120 - changeClockCycleShow() { 302 + changeClockCycleShow(e) {
  303 + this.setData({
  304 + 'form.taskCycle': e.detail.value
  305 + })
121 this.setData({ 306 this.setData({
122 clockCycleShow: false 307 clockCycleShow: false
123 }) 308 })
@@ -135,7 +320,10 @@ Page({ @@ -135,7 +320,10 @@ Page({
135 clockRateShow: false 320 clockRateShow: false
136 }) 321 })
137 }, 322 },
138 - changeClockRateShow() { 323 + changeClockRateShow(e) {
  324 + this.setData({
  325 + 'form.taskFrequency': e.detail.value
  326 + })
139 this.setData({ 327 this.setData({
140 clockRateShow: false 328 clockRateShow: false
141 }) 329 })
@@ -153,7 +341,10 @@ Page({ @@ -153,7 +341,10 @@ Page({
153 clockRemindShow: false 341 clockRemindShow: false
154 }) 342 })
155 }, 343 },
156 - changeClockRemindShow() { 344 + changeClockRemindShow(e) {
  345 + this.setData({
  346 + 'form.remindTime': e.detail.value[0] + '::' + e.detail.value[1]
  347 + })
157 this.setData({ 348 this.setData({
158 clockRemindShow: false 349 clockRemindShow: false
159 }) 350 })
@@ -171,7 +362,10 @@ Page({ @@ -171,7 +362,10 @@ Page({
171 clockLackShow: false 362 clockLackShow: false
172 }) 363 })
173 }, 364 },
174 - changeClockLackShow() { 365 + changeClockLackShow(e) {
  366 + this.setData({
  367 + 'form.lackNum': e.detail.value
  368 + })
175 this.setData({ 369 this.setData({
176 clockLackShow: false 370 clockLackShow: false
177 }) 371 })
@@ -189,7 +383,10 @@ Page({ @@ -189,7 +383,10 @@ Page({
189 containShow: false 383 containShow: false
190 }) 384 })
191 }, 385 },
192 - changeContainShow() { 386 + changeContainShow(e) {
  387 + this.setData({
  388 + 'form.submitCondition': e.detail.value
  389 + })
193 this.setData({ 390 this.setData({
194 containShow: false 391 containShow: false
195 }) 392 })
pages/index/newPunch/newPunch.json
@@ -7,7 +7,9 @@ @@ -7,7 +7,9 @@
7 "van-switch": "@vant/weapp/switch/index", 7 "van-switch": "@vant/weapp/switch/index",
8 "van-button": "@vant/weapp/button/index", 8 "van-button": "@vant/weapp/button/index",
9 "van-popup": "@vant/weapp/popup/index", 9 "van-popup": "@vant/weapp/popup/index",
10 - "van-picker": "@vant/weapp/picker/index" 10 + "van-picker": "@vant/weapp/picker/index",
  11 + "van-uploader": "@vant/weapp/uploader/index",
  12 + "van-datetime-picker": "@vant/weapp/datetime-picker/index"
11 }, 13 },
12 - "navigationBarTitleText": "自定义打卡" 14 + "navigationBarTitleText": "打卡模板"
13 } 15 }
14 \ No newline at end of file 16 \ No newline at end of file
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">  
4 - <van-cell-group>  
5 - <van-field value="{{ form.biaoti }}" placeholder="请输入标题" border="{{ false }}" bind:change="onfieldChange" />  
6 - </van-cell-group> 3 + <view class="title_card">
  4 + <van-cell-group>
  5 + <van-field value="{{ form.taskTitle }}" placeholder="请输入标题" border="{{ false }}" bind:change="onfieldChange" />
  6 + </van-cell-group>
  7 + <view class="grey_line"></view>
  8 + <view class="box_card">
  9 + <van-cell-group>
  10 + <van-field value="{{ form.taskDesc }}" type="textarea" placeholder="请输入" autosize border="{{ false }}" bind:change="onfieldDescChange" />
  11 + </van-cell-group>
  12 + </view>
  13 + <view class="tip_card">
  14 + <van-uploader accept='image' file-list="{{ fileList }}" deletable="{{ true }}" bind:after-read="afterRead">
  15 + <view class="tip_item">
  16 + <image class="pic" src="/img/answer/tp1.png" alt="" />
  17 + </view>
  18 + </van-uploader>
  19 + <!-- <view class="tip_item">
  20 + <image class="pic" src="/img/answer/sp1.png" alt="" />
  21 + </view>
  22 + <view class="tip_item">
  23 + <image class="pic" src="/img/answer/yp1.png" alt="" />
  24 + </view> -->
  25 + </view>
  26 + </view>
  27 + <view class="white_card">
  28 + <view class="bold_font">需要提交数据</view>
  29 + <view>
  30 + <van-switch checked="{{ form.hasData }}" size='20' active-value='1' inactive-value='2' bind:change="onSwitch" />
  31 + </view>
  32 + </view>
7 <view class="grey_line"></view> 33 <view class="grey_line"></view>
8 - <view class="box_card">  
9 - <van-cell-group>  
10 - <van-field value="{{ form.message }}" type="textarea" placeholder="请输入" autosize border="{{ false }}" />  
11 - </van-cell-group> 34 + <view class="white_card_nopadding">
  35 + <van-cell-group>
  36 + <van-cell title="统计单位" value="{{ form.statisticsUnit }}" is-link label="请选择统计单位" border="{{ false }}" bindtap="openUnitShow" />
  37 + </van-cell-group>
  38 + </view>
  39 + <view class="white_card">
  40 + <view>允许补卡</view>
  41 + <view>
  42 + <van-switch checked="{{ form.allowRepairCard }}" size='20' bind:change="onChange" active-value='1' inactive-value='2' />
  43 + </view>
12 </view> 44 </view>
13 - <view class="tip_card">  
14 - <view class="tip_item">  
15 - <image class="pic" src="/img/answer/tp1.png" alt="" />  
16 - </view>  
17 - <view class="tip_item">  
18 - <image class="pic" src="/img/answer/sp1.png" alt="" />  
19 - </view>  
20 - <view class="tip_item">  
21 - <image class="pic" src="/img/answer/yp1.png" alt="" />  
22 - </view> 45 + <view class="sm_grey_font">
  46 + 开启后,在打卡周期内,学生家长可对未打卡的任务进行补卡。
23 </view> 47 </view>
24 - </view>  
25 - <view class="white_card">  
26 - <view class="bold_font">需要提交数据</view>  
27 - <view>  
28 - <van-switch checked="{{ form.checked }}" size='20' bind:change="onChange" /> 48 + <view class="white_card_nopadding">
  49 + <van-cell-group>
  50 + <van-cell title="开始时间" value="{{ form.startDate }}" is-link border="{{ false }}" bindtap="openStartTimeShow" />
  51 + </van-cell-group>
29 </view> 52 </view>
30 - </view>  
31 - <view class="grey_line"></view>  
32 - <view class="white_card_nopadding">  
33 - <van-cell-group>  
34 - <van-cell title="统计单位" is-link label="请选择统计单位" border="{{ false }}" bindtap="openUnitShow"/>  
35 - </van-cell-group>  
36 - </view>  
37 - <view class="white_card">  
38 - <view>允许补卡</view>  
39 - <view>  
40 - <van-switch checked="{{ form.checked }}" size='20' bind:change="onChange" /> 53 + <view class="white_card_nopadding">
  54 + <van-cell-group>
  55 + <van-cell title="打卡周期" value="{{ form.taskCycle + ' 天'}}" is-link border="{{ false }}" bindtap="openClockCycleShow" />
  56 + </van-cell-group>
  57 + </view>
  58 + <view class="white_card_nopadding">
  59 + <van-cell-group>
  60 + <van-cell title="打卡频次" value="{{ form.taskFrequency }}" is-link border="{{ false }}" bindtap="openClockRateShow" />
  61 + </van-cell-group>
41 </view> 62 </view>
42 - </view>  
43 - <view class="sm_grey_font">  
44 - 开启后,在打卡周期内,学生家长可对未打卡的任务进行补卡。  
45 - </view>  
46 - <view class="white_card_nopadding">  
47 - <van-cell-group>  
48 - <van-cell title="开始时间" value='时间' is-link border="{{ false }}" bindtap="openStartTimeShow"/>  
49 - </van-cell-group>  
50 - </view>  
51 - <view class="white_card_nopadding">  
52 - <van-cell-group>  
53 - <van-cell title="打卡周期" value='90天' is-link border="{{ false }}" bindtap="openClockCycleShow"/>  
54 - </van-cell-group>  
55 - </view>  
56 - <view class="white_card_nopadding">  
57 - <van-cell-group>  
58 - <van-cell title="打卡频次" value='每天' is-link border="{{ false }}" bindtap="openClockRateShow"/>  
59 - </van-cell-group>  
60 - </view>  
61 63
62 - <view class="clearance"></view>  
63 - <view class="white_card_nopadding">  
64 - <van-cell-group>  
65 - <van-cell title="打卡提醒" value='18:00' is-link border="{{ false }}" bindtap="openClockRemindShow"/>  
66 - </van-cell-group>  
67 - </view>  
68 - <view class="white_card_nopadding">  
69 - <van-cell-group>  
70 - <van-cell title="缺卡打卡提醒" value='缺卡三天及以上' is-link border="{{ false }}" bindtap="openClockLackShow"/>  
71 - </van-cell-group>  
72 - </view> 64 + <view class="clearance"></view>
  65 + <view class="white_card_nopadding">
  66 + <van-cell-group>
  67 + <van-cell title="打卡提醒" value="{{ form.remindTime }}" is-link border="{{ false }}" bindtap="openClockRemindShow" />
  68 + </van-cell-group>
  69 + </view>
  70 + <view class="white_card_nopadding">
  71 + <van-cell-group>
  72 + <van-cell title="缺卡打卡提醒" value="{{ form.lackNum + ' 次' }}" is-link border="{{ false }}" bindtap="openClockLackShow" />
  73 + </van-cell-group>
  74 + </view>
73 75
74 - <view class="sm_grey_font">  
75 - 学生如缺卡达到一定条件,将会提醒家长  
76 - </view>  
77 - <view class="white_card_nopadding">  
78 - <van-cell-group>  
79 - <van-cell title="提交时必须包含" value='图片' is-link border="{{ false }}" bindtap="openContainShow"/>  
80 - </van-cell-group>  
81 - </view> 76 + <view class="sm_grey_font">
  77 + 学生如缺卡达到一定条件,将会提醒家长
  78 + </view>
  79 + <view class="white_card_nopadding">
  80 + <van-cell-group>
  81 + <van-cell title="提交时必须包含" value="{{ form.submitCondition }}" is-link border="{{ false }}" bindtap="openContainShow" />
  82 + </van-cell-group>
  83 + </view>
82 84
83 - <view class="clearance"></view>  
84 - <view class="btn">  
85 - <van-button type="info" round block>创建打卡</van-button>  
86 - </view> 85 + <view class="clearance"></view>
  86 + <view class="btn">
  87 + <van-button type="info" round block bindtap="createTask">创建打卡</van-button>
  88 + </view>
87 89
88 <!--统计单位--> 90 <!--统计单位-->
89 - <van-popup  
90 - show="{{ unitShow }}"  
91 - position="bottom"  
92 - custom-style="height: 40%;"  
93 - round  
94 - bind:close="closeUnitShow"  
95 - >  
96 - <van-picker columns="{{ columnsUnit }}" bind:confirm="changeUnitShow" bind:cancel="closeUnitShow" show-toolbar title="统计单位"/> 91 + <van-popup show="{{ unitShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeUnitShow">
  92 + <van-picker columns="{{ columnsUnit }}" bind:confirm="changeUnitShow" bind:cancel="closeUnitShow" show-toolbar title="统计单位" />
97 </van-popup> 93 </van-popup>
98 94
99 <!--开始时间--> 95 <!--开始时间-->
100 - <van-popup  
101 - show="{{ startTimeShow }}"  
102 - position="bottom"  
103 - custom-style="height: 40%;"  
104 - round  
105 - bind:close="closeStartTimeShow"  
106 - >  
107 - <van-picker columns="{{ columnsStartTime }}" bind:confirm="changeStartTimeShow" bind:cancel="closeStartTimeShow" show-toolbar title="开始时间"/> 96 + <van-popup show="{{ startTimeShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeStartTimeShow">
  97 + <!-- <van-picker columns="{{ columnsStartTime }}" bind:confirm="changeStartTimeShow" bind:cancel="closeStartTimeShow" show-toolbar title="开始时间" /> -->
  98 + <van-datetime-picker title="开始时间" type="date" value="{{ form.startTimeShow }}" min-date="{{ minDate }}" bind:confirm="changeStartTimeShow" bind:cancel="closeStartTimeShow" formatter="{{ formatter }}" />
108 </van-popup> 99 </van-popup>
109 100
110 <!--打卡周期--> 101 <!--打卡周期-->
111 - <van-popup  
112 - show="{{ clockCycleShow }}"  
113 - position="bottom"  
114 - custom-style="height: 40%;"  
115 - round  
116 - bind:close="closeClockCycleShow"  
117 - >  
118 - <van-picker columns="{{ columnsClockCycle }}" bind:confirm="changeClockCycleShow" bind:cancel="closeClockCycleShow" show-toolbar title="打卡周期"/> 102 + <van-popup show="{{ clockCycleShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeClockCycleShow">
  103 + <van-picker columns="{{ columnsClockCycle }}" bind:confirm="changeClockCycleShow" bind:cancel="closeClockCycleShow" show-toolbar title="打卡周期" />
119 </van-popup> 104 </van-popup>
120 105
121 <!--打卡频次--> 106 <!--打卡频次-->
122 - <van-popup  
123 - show="{{ clockRateShow }}"  
124 - position="bottom"  
125 - custom-style="height: 40%;"  
126 - round  
127 - bind:close="closeClockRateShow"  
128 - >  
129 - <van-picker columns="{{ columnsClockRate }}" bind:confirm="changeClockRateShow" bind:cancel="closeClockRateShow" show-toolbar title="打卡频次"/> 107 + <van-popup show="{{ clockRateShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeClockRateShow">
  108 + <van-picker columns="{{ columnsClockRate }}" bind:confirm="changeClockRateShow" bind:cancel="closeClockRateShow" show-toolbar title="打卡频次" />
130 </van-popup> 109 </van-popup>
131 110
132 <!--打卡提醒--> 111 <!--打卡提醒-->
133 - <van-popup  
134 - show="{{ clockRemindShow }}"  
135 - position="bottom"  
136 - custom-style="height: 40%;"  
137 - round  
138 - bind:close="closeClockRemindShow"  
139 - >  
140 - <van-picker columns="{{ columnsClockRemind }}" bind:confirm="changeClockRemindShow" bind:cancel="closeClockRemindShow" show-toolbar title="打卡提醒"/> 112 + <van-popup show="{{ clockRemindShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeClockRemindShow">
  113 + <van-picker columns="{{ columnsClockRemind }}" bind:confirm="changeClockRemindShow" bind:cancel="closeClockRemindShow" show-toolbar title="打卡提醒" />
141 </van-popup> 114 </van-popup>
142 115
143 <!--打卡缺卡提醒--> 116 <!--打卡缺卡提醒-->
144 - <van-popup  
145 - show="{{ clockLackShow }}"  
146 - position="bottom"  
147 - custom-style="height: 40%;"  
148 - round  
149 - bind:close="closeClockLackShow"  
150 - >  
151 - <van-picker columns="{{ columnsClockLack }}" bind:confirm="changeClockLackShow" bind:cancel="closeClockLackShow" show-toolbar title="缺卡打卡提醒"/> 117 + <van-popup show="{{ clockLackShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeClockLackShow">
  118 + <van-picker columns="{{ columnsClockLack }}" bind:confirm="changeClockLackShow" bind:cancel="closeClockLackShow" show-toolbar title="缺卡打卡提醒" />
152 </van-popup> 119 </van-popup>
153 120
154 <!-- 必须包含 --> 121 <!-- 必须包含 -->
155 - <van-popup  
156 - show="{{ containShow }}"  
157 - position="bottom"  
158 - custom-style="height: 40%;"  
159 - round  
160 - bind:close="closeContainShow"  
161 - >  
162 - <van-picker columns="{{ columnsContain }}" bind:confirm="changeContainShow" bind:cancel="closeContainShow" show-toolbar title="提交时必须包含"/> 122 + <van-popup show="{{ containShow }}" position="bottom" custom-style="height: 40%;" round bind:close="closeContainShow">
  123 + <van-picker columns="{{ columnsContain }}" bind:confirm="changeContainShow" bind:cancel="closeContainShow" show-toolbar title="提交时必须包含" />
163 </van-popup> 124 </van-popup>
164 </view> 125 </view>
165 \ No newline at end of file 126 \ No newline at end of file
pages/index/rank/rank.js
1 // pages/index/rank/rank.js 1 // pages/index/rank/rank.js
  2 +import request from '../../../api/request.js'
  3 +import moment from 'moment';
2 Page({ 4 Page({
3 5
4 /** 6 /**
5 * 页面的初始数据 7 * 页面的初始数据
6 */ 8 */
7 data: { 9 data: {
8 - rankList: [  
9 - {name: '小米',num: 20},  
10 - {name: '杰瑞',num: 110},  
11 - {name: '王小明',num: 75},  
12 - ] 10 + rankList: [],
  11 + dayTime: '',
  12 + user: {
  13 + id: '',
  14 + name: '',
  15 + nickname: '',
  16 + phone: "",
  17 + token: "",
  18 + }
  19 + },
  20 +
  21 + //排行榜列表
  22 + getRankList() {
  23 + request({
  24 + url: `/wx/task/getSignRank`,
  25 + method: 'post',
  26 + data: {
  27 + "page": 1,
  28 + "pageSize": 999,
  29 + "userId": wx.getStorageSync("userInfo_id")
  30 + },
  31 + }).then(res => {
  32 + if (res.code == 0) {
  33 + this.setData({
  34 + rankList: res.rows
  35 + })
  36 + console.log(this.data.rankList)
  37 + } else {
  38 + wx.showToast({
  39 + title: res.msg,
  40 + icon: 'none',
  41 + duration: 1500
  42 + })
  43 + }
  44 + })
13 }, 45 },
14 -  
15 //去打卡 46 //去打卡
16 toOpen() { 47 toOpen() {
17 wx.navigateTo({ 48 wx.navigateTo({
@@ -22,7 +53,13 @@ Page({ @@ -22,7 +53,13 @@ Page({
22 * 生命周期函数--监听页面加载 53 * 生命周期函数--监听页面加载
23 */ 54 */
24 onLoad(options) { 55 onLoad(options) {
25 - 56 + this.setData({
  57 + 'user': wx.getStorageSync('userInfo')
  58 + })
  59 + this.setData({
  60 + "dayTime": moment(new Date().getTime()).format('YYYY-MM-DD')
  61 + })
  62 + this.getRankList()
26 }, 63 },
27 // 统一返回 64 // 统一返回
28 handleBack() { 65 handleBack() {
pages/index/rank/rank.wxml
1 <!--pages/index/rank/rank.wxml--> 1 <!--pages/index/rank/rank.wxml-->
2 <!-- <view class="rank" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/5f055580-1341-4c52-9154-c3b125c1107a.png')"> --> 2 <!-- <view class="rank" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/null/5f055580-1341-4c52-9154-c3b125c1107a.png')"> -->
3 <view class="rank" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/AdmissionsManageSys/54ec1f3f-dbb4-4660-ba24-4a6731e88def.png')"> 3 <view class="rank" style="background-image: url('https://szyundisk.oss-cn-hangzhou.aliyuncs.com/AdmissionsManageSys/54ec1f3f-dbb4-4660-ba24-4a6731e88def.png')">
4 - <view class="rank_time">更新时间:2022-03-12</view> 4 + <view class="rank_time">更新时间:{{dayTime}}</view>
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="" /> 8 <image class="pic" src="/img/answer/user.png" alt="" />
9 - 陈浩然 9 + {{user.name}}
10 </view> 10 </view>
11 - <view class="red_title">已坚持12天</view>  
12 - <view class="red_title">34次</view> 11 + <view class="red_title">已坚持xx天</view>
  12 + <view class="red_title">xx次</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">
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <image wx:if="{{index == 0}}" class="tem_pic" src="/img/answer/1.png" alt="" /> 24 <image wx:if="{{index == 0}}" class="tem_pic" src="/img/answer/1.png" alt="" />
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 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.name}}</view>
29 </view> 29 </view>
30 <view class="table_R"> 30 <view class="table_R">
pages/index/rank/rank.wxss
@@ -58,6 +58,10 @@ @@ -58,6 +58,10 @@
58 width: 28vw; 58 width: 28vw;
59 display: flex; 59 display: flex;
60 justify-content: space-between; 60 justify-content: space-between;
  61 +
  62 +}
  63 +.L_box {
  64 + width: 50px;
61 } 65 }
62 66
63 .table_item { 67 .table_item {
@@ -81,6 +85,7 @@ @@ -81,6 +85,7 @@
81 .tem_pic { 85 .tem_pic {
82 width: 22px; 86 width: 22px;
83 height: 28px; 87 height: 28px;
  88 + text-align: center;
84 } 89 }
85 .btn { 90 .btn {
86 position: fixed; 91 position: fixed;
pages/login/codeLogin/codeLogin.js
1 // pages/login/codeLogin/codeLogin.js 1 // pages/login/codeLogin/codeLogin.js
2 -var app = getApp(); 2 +// var app = getApp();
  3 +var api = 'https://proxy.shunzhi.net/';
  4 +var api_card = 'https://proxy.shunzhi.net/card/';
  5 +var appid = 'wx186236fdcd93edcc';
3 var util = require('../../../utils/md5.js') 6 var util = require('../../../utils/md5.js')
4 import request from '../../../api/request.js' 7 import request from '../../../api/request.js'
5 Page({ 8 Page({
@@ -21,6 +24,7 @@ Page({ @@ -21,6 +24,7 @@ Page({
21 path: '', //登录后跳转页面 24 path: '', //登录后跳转页面
22 modelShow: false, //完善信息 25 modelShow: false, //完善信息
23 phone: '', //getUserInfo获取到的手机号 26 phone: '', //getUserInfo获取到的手机号
  27 + openId: ''
24 }, 28 },
25 onLoad: function (options) { 29 onLoad: function (options) {
26 console.log('登录页options:', options) 30 console.log('登录页options:', options)
@@ -69,20 +73,25 @@ Page({ @@ -69,20 +73,25 @@ Page({
69 }) 73 })
70 } 74 }
71 request({ 75 request({
72 - url: `h5/user/Oneclicklogin`,  
73 - method: 'get', 76 + url: `/wx/app/oneClickLogin/`+ appid,
  77 + method: 'post',
74 data: { 78 data: {
75 "encryptedData": this.data.encryptedData, 79 "encryptedData": this.data.encryptedData,
76 - "session_key": this.data.session_key, 80 + "sessionKey": this.data.session_key,
77 "iv": this.data.iv, 81 "iv": this.data.iv,
  82 + "openId": this.data.openId
78 }, 83 },
79 }).then(res => { 84 }).then(res => {
80 - if (res.success) { 85 + if (res.code == 0) {
81 if (res.data) { 86 if (res.data) {
82 this.setData({ 87 this.setData({
83 phone: res.data.phone 88 phone: res.data.phone
84 }, () => { 89 }, () => {
85 - this.getUserInfo() 90 + wx.setStorageSync('userInfo', res.data)
  91 + wx.setStorageSync('userInfo_id', res.data.id)
  92 + wx.switchTab({
  93 + url: '/pages/index/rank/rank',
  94 + })
86 }) 95 })
87 } else { 96 } else {
88 wx.showToast({ 97 wx.showToast({
@@ -107,23 +116,23 @@ Page({ @@ -107,23 +116,23 @@ Page({
107 } 116 }
108 }, 117 },
109 getUserInfo() { 118 getUserInfo() {
110 - let that = this  
111 - request({  
112 - url: `h5/user/getuserInfoNew`,  
113 - method: 'get',  
114 - data: {  
115 - // PhoneName: '13355752969'  
116 - PhoneName: this.data.phone  
117 - },  
118 - }).then((res) => {  
119 - if (res.success) {  
120 - if (res.data) {  
121 - wx.setStorageSync('userInfo', res.data)  
122 - wx.setStorageSync('showModal', '') 119 + // let that = this
  120 + // request({
  121 + // url: `h5/user/getuserInfoNew`,
  122 + // method: 'get',
  123 + // data: {
  124 + // // PhoneName: '13355752969'
  125 + // PhoneName: this.data.phone
  126 + // },
  127 + // }).then((res) => {
  128 + // if (res.success) {
  129 + // if (res.data) {
  130 + // wx.setStorageSync('userInfo', res.data)
  131 + // wx.setStorageSync('showModal', '')
123 132
124 - }  
125 - }  
126 - }) 133 + // }
  134 + // }
  135 + // })
127 }, 136 },
128 getOpenId() { 137 getOpenId() {
129 return request({ 138 return request({
@@ -133,10 +142,13 @@ Page({ @@ -133,10 +142,13 @@ Page({
133 code: this.data.loginCode 142 code: this.data.loginCode
134 }, 143 },
135 }).then(res2 => { 144 }).then(res2 => {
136 - // console.log(res2.data);  
137 this.setData({ 145 this.setData({
138 - session_key: JSON.parse(res2.data).session_key 146 + session_key: res2.data.sessionKey
139 }) 147 })
  148 + this.setData({
  149 + openId: res2.data.openid
  150 + })
  151 + console.log(this.data);
140 }) 152 })
141 }, 153 },
142 bindUserName: function (e) { 154 bindUserName: function (e) {
@@ -182,17 +194,16 @@ Page({ @@ -182,17 +194,16 @@ Page({
182 title: '请求中', 194 title: '请求中',
183 }) 195 })
184 wx.request({ 196 wx.request({
185 - url: api + '/wx/app/loginCode', 197 + url: api_card + '/wx/app/loginCode',
186 data: { 198 data: {
187 - captcha: code,  
188 - mobile: username 199 + code: code,
  200 + phone: username
189 }, 201 },
190 - method: 'get', 202 + method: 'post',
191 success: (res) => { 203 success: (res) => {
192 wx.hideLoading(); 204 wx.hideLoading();
193 if (res.data.success) { 205 if (res.data.success) {
194 console.log(res.data) 206 console.log(res.data)
195 - return  
196 if (res.data.data) { 207 if (res.data.data) {
197 this.setData({ 208 this.setData({
198 phone: res.data.data.phone 209 phone: res.data.data.phone
@@ -308,7 +319,7 @@ Page({ @@ -308,7 +319,7 @@ Page({
308 } 319 }
309 }, 320 },
310 getPhoneNumber(e) { 321 getPhoneNumber(e) {
311 - // console.log(e.detail) 322 + console.log(e.detail)
312 if (e.detail.errMsg == 'getPhoneNumber:ok') { 323 if (e.detail.errMsg == 'getPhoneNumber:ok') {
313 this.setData({ 324 this.setData({
314 encryptedData: e.detail.encryptedData, 325 encryptedData: e.detail.encryptedData,
@@ -317,7 +328,6 @@ Page({ @@ -317,7 +328,6 @@ Page({
317 this.login() 328 this.login()
318 }) 329 })
319 } 330 }
320 -  
321 }, 331 },
322 //去查看协议 332 //去查看协议
323 toProtocol() { 333 toProtocol() {
@@ -333,7 +343,7 @@ Page({ @@ -333,7 +343,7 @@ Page({
333 }, 343 },
334 goIndex() { 344 goIndex() {
335 wx.switchTab({ 345 wx.switchTab({
336 - url: '/pages/index/index', 346 + url: '/pages/index/rank/rank',
337 }) 347 })
338 }, 348 },
339 349
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/mine/index.js
@@ -6,7 +6,8 @@ Page({ @@ -6,7 +6,8 @@ Page({
6 * 页面的初始数据 6 * 页面的初始数据
7 */ 7 */
8 data: { 8 data: {
9 - 9 + user_name: '',
  10 + user_phone: '',
10 }, 11 },
11 // 打卡记录 12 // 打卡记录
12 handleRecord(){ 13 handleRecord(){
@@ -21,6 +22,16 @@ Page({ @@ -21,6 +22,16 @@ Page({
21 }) 22 })
22 }, 23 },
23 /** 24 /**
  25 + * 生命周期函数--监听页面加载
  26 + */
  27 + onLoad(options) {
  28 + let userInfo = wx.getStorageSync('userInfo')
  29 + this.setData({
  30 + "user_name": userInfo.name || userInfo.nickname,
  31 + "user_phone": userInfo.phone
  32 + })
  33 + },
  34 + /**
24 * 用户点击右上角分享 35 * 用户点击右上角分享
25 */ 36 */
26 onShareAppMessage: function () { 37 onShareAppMessage: function () {
pages/mine/index.wxml
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 <image class="pic" src="/img/answer/user.png" alt="" /> 4 <image class="pic" src="/img/answer/user.png" alt="" />
5 </view> 5 </view>
6 <view class="title_box"> 6 <view class="title_box">
7 - <view class="title_name">陈浩然</view>  
8 - <view class="grey_title">绍兴市高级中学.20级</view> 7 + <view class="title_name">{{user_name}}</view>
  8 + <view class="grey_title">{{user_phone}}</view>
9 </view> 9 </view>
10 </view> 10 </view>
11 <view class="flex_card"> 11 <view class="flex_card">
pages/mine/record/record.js
1 // pages/index/record/record.js 1 // pages/index/record/record.js
  2 +import request from '../../../api/request.js'
2 Page({ 3 Page({
3 4
4 /** 5 /**
@@ -7,16 +8,65 @@ Page({ @@ -7,16 +8,65 @@ Page({
7 data: { 8 data: {
8 tabindex: 0, 9 tabindex: 0,
9 showAdd: false, 10 showAdd: false,
10 - 11 + taskList: [],
  12 +
11 tempList: [ 13 tempList: [
12 - {name:'自定义模板',url: '/img/answer/zdy.png'},  
13 - {name:'英语模板',url: '/img/answer/english.png'},  
14 - {name:'数学模板',url: '/img/answer/math.png'},  
15 - ] 14 + // {name:'自定义模板',url: '/img/answer/zdy.png'},
  15 + // {name:'英语模板',url: '/img/answer/english.png'},
  16 + // {name:'数学模板',url: '/img/answer/math.png'},
  17 + ]
  18 + },
  19 +
  20 + //打卡记录列表
  21 + getTaskList() {
  22 + request({
  23 + url: `/wx/task/cardTaskList`,
  24 + method: 'post',
  25 + data: {
  26 + "oneselfFlag": this.data.tabindex + 1,
  27 + "page": 1,
  28 + "pageSize": 999,
  29 + "userId": wx.getStorageSync("userInfo_id")
  30 + },
  31 + }).then(res => {
  32 + if (res.code == 0) {
  33 + this.setData({
  34 + taskList: res.rows
  35 + })
  36 + } else {
  37 + wx.showToast({
  38 + title: res.msg,
  39 + icon: 'none',
  40 + duration: 1500
  41 + })
  42 + }
  43 + })
  44 + },
  45 +
  46 + //模板列表
  47 + getTempList() {
  48 + request({
  49 + url: `/wx/temp/tempList`,
  50 + method: 'post',
  51 + data: {},
  52 + }).then(res => {
  53 + if (res.code == 0) {
  54 + this.setData({
  55 + tempList: res.data
  56 + })
  57 + } else {
  58 + wx.showToast({
  59 + title: res.msg,
  60 + icon: 'none',
  61 + duration: 1500
  62 + })
  63 + }
  64 + })
16 }, 65 },
17 66
18 //打卡 67 //打卡
19 toShow(e) { 68 toShow(e) {
  69 + this.getTempList()
20 this.setData({ 70 this.setData({
21 showAdd: true 71 showAdd: true
22 }) 72 })
@@ -28,22 +78,25 @@ Page({ @@ -28,22 +78,25 @@ Page({
28 }) 78 })
29 }, 79 },
30 //选择模板 80 //选择模板
31 - toPunch() { 81 + toPunch(e) {
  82 + let obj = e.currentTarget.dataset
  83 + let id = obj.value ? obj.value.id :0
32 wx.navigateTo({ 84 wx.navigateTo({
33 - url: `../../index/newPunch/newPunch` 85 + url: `../../index/newPunch/newPunch?tempId=${id}`
34 }) 86 })
35 }, 87 },
36 /** 88 /**
37 * 生命周期函数--监听页面加载 89 * 生命周期函数--监听页面加载
38 */ 90 */
39 onLoad(options) { 91 onLoad(options) {
40 - 92 + this.getTaskList()
41 }, 93 },
42 //切换 94 //切换
43 handleTab(e) { 95 handleTab(e) {
44 this.setData({ 96 this.setData({
45 tabindex: e.detail.index 97 tabindex: e.detail.index
46 }) 98 })
  99 + this.getTaskList()
47 }, 100 },
48 // 打卡成果 101 // 打卡成果
49 handleAchievement() { 102 handleAchievement() {
pages/mine/record/record.wxml
@@ -8,34 +8,34 @@ @@ -8,34 +8,34 @@
8 </view> 8 </view>
9 <view class="bck"> 9 <view class="bck">
10 <view class="grey_font">进行中打卡</view> 10 <view class="grey_font">进行中打卡</view>
11 - <view class="card"> 11 + <view class="card" wx:for="{{taskList}}" wx:key="index" wx:for-item="value">
12 <view class="card_title"> 12 <view class="card_title">
13 <view class="title_L"> 13 <view class="title_L">
14 <image class="title_pic" src="/img/answer/bj.png" alt="" /> 14 <image class="title_pic" src="/img/answer/bj.png" alt="" />
15 </view> 15 </view>
16 <view class="title_R"> 16 <view class="title_R">
17 - <view>英语单词每日打卡</view>  
18 - <view class="grey_font">我发布于09-09 08:21</view> 17 + <view>{{value.taskTitle}}</view>
  18 + <view class="grey_font">开始时间 {{value.startDate}}</view>
19 </view> 19 </view>
20 </view> 20 </view>
21 - <view class="day_font">每日20个英文单词背诵</view>  
22 - <view class="day_font2">已坚持打卡 21 + <view class="day_font" >{{value.taskDesc}}</view>
  22 + <!-- <view class="day_font2">已坚持打卡
23 <text class="day_font2_large">1/50 </text>天 23 <text class="day_font2_large">1/50 </text>天
24 - </view> 24 + </view> -->
25 <view> 25 <view>
26 <van-progress percentage="50" color='#3F5EFF' stroke-width="13" pivot-text=' ' /> 26 <van-progress percentage="50" color='#3F5EFF' stroke-width="13" pivot-text=' ' />
27 </view> 27 </view>
28 <view class="flex_font"> 28 <view class="flex_font">
29 <text class="grey_flex">打卡频次:</text> 29 <text class="grey_flex">打卡频次:</text>
30 - 每天 30 + {{value.taskFrequency}}
31 </view> 31 </view>
32 - <view class="flex_font"> 32 + <view class="flex_font" wx:if="{{value.submitCondition != null}}">
33 <text class="grey_flex">打卡要求:</text> 33 <text class="grey_flex">打卡要求:</text>
34 - 需填写单词个数 34 + {{'需要' + value.submitCondition}}
35 </view> 35 </view>
36 <view class="flex_font"> 36 <view class="flex_font">
37 <view class="grey_flex">其他:</view> 37 <view class="grey_flex">其他:</view>
38 - 不允许补卡 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}}"> 41 <view class="blue_font" wx:if="{{tabindex == 1}}">
@@ -58,9 +58,13 @@ @@ -58,9 +58,13 @@
58 <view class="pop_card"> 58 <view class="pop_card">
59 <view class="pop_title">选择模板</view> 59 <view class="pop_title">选择模板</view>
60 <view class="tem_box"> 60 <view class="tem_box">
  61 + <view class="tem_item" bindtap="toPunch" >
  62 + <image class="tem_pic" src="/img/answer/zdy.png" alt="" />
  63 + <view class="tem_font">自定义模板</view>
  64 + </view>
61 <view class="tem_item" wx:for="{{tempList}}" wx:key="index" wx:for-item="value" bindtap="toPunch" data-value="{{value}}"> 65 <view class="tem_item" wx:for="{{tempList}}" wx:key="index" wx:for-item="value" bindtap="toPunch" data-value="{{value}}">
62 - <image class="tem_pic" src="{{value.url}}" alt="" />  
63 - <view class="tem_font">{{value.name}}</view> 66 + <image class="tem_pic" src="{{value.taskBackground}}" alt="" />
  67 + <view class="tem_font">{{value.taskTitle}}</view>
64 </view> 68 </view>
65 </view> 69 </view>
66 </view> 70 </view>