作者 刘晓艳

麦父子折线图

1 //app.js 1 //app.js
2 App({ 2 App({
3 - onLaunch: function () {  
4 - // 展示本地存储能力  
5 - var logs = wx.getStorageSync('logs') || []  
6 - logs.unshift(Date.now())  
7 - wx.setStorageSync('logs', logs)  
8 -  
9 - // 登录  
10 - wx.login({  
11 - success: res => {  
12 - // 发送 res.code 到后台换取 openId, sessionKey, unionId  
13 - } 3 + post: function (url, data, headerParams) {
  4 + wx.showNavigationBarLoading()
  5 + wx.showLoading({
  6 + title: '',
14 }) 7 })
15 - // 获取用户信息  
16 - wx.getSetting({  
17 - success: res => {  
18 - if (res.authSetting['scope.userInfo']) {  
19 - // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框  
20 - wx.getUserInfo({  
21 - success: res => {  
22 - // 可以将 res 发送给后台解码出 unionId  
23 - this.globalData.userInfo = res.userInfo  
24 -  
25 - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回  
26 - // 所以此处加入 callback 以防止这种情况  
27 - if (this.userInfoReadyCallback) {  
28 - this.userInfoReadyCallback(res)  
29 - }  
30 - } 8 + var promise = new Promise((resolve, reject) => {
  9 + let that = this;
  10 + let postData = data;
  11 + let baseUrl = 'http://maifuzi.w.bronet.cn/api/';
  12 + let header = {
  13 + 'content-type': 'application/x-www-form-urlencoded'
  14 + }
  15 + header = Object.assign(header, headerParams)
  16 + wx.request({
  17 + url: baseUrl + url,
  18 + data: postData,
  19 + method: 'POST',
  20 + header: header,
  21 + success: function (res) {
  22 + resolve(res)
  23 + setTimeout(function () {
  24 + wx.hideLoading()
  25 + }, 600)
  26 + wx.hideNavigationBarLoading()
  27 + },
  28 + error: function (e) {
  29 + reject('');
  30 + wx.hideLoading()
  31 + wx.hideNavigationBarLoading()
  32 + wx.showModal({
  33 + title: '',
  34 + content: res.data.msg,
  35 + showCancel: false
31 }) 36 })
32 } 37 }
33 - }  
34 - }) 38 + })
  39 + });
  40 + wx.hideLoading()
  41 + return promise;
35 }, 42 },
36 globalData: { 43 globalData: {
37 userInfo: null 44 userInfo: null
1 { 1 {
2 "pages": [ 2 "pages": [
3 - "pages/mall/charge/charge",  
4 - "pages/mall/mall", 3 + "pages/start/start",
  4 + "pages/mall/success/success",
  5 + "pages/my/personalInfo/personalInfo",
5 "pages/signIn/dailySignIn/dailySignIn", 6 "pages/signIn/dailySignIn/dailySignIn",
6 - "pages/signIn/daySignIn/daySignIn",  
7 "pages/signIn/Weight/Weight", 7 "pages/signIn/Weight/Weight",
8 - "pages/signIn/bodyWeght/bodyWeght",  
9 - "pages/my/my", 8 + "pages/mall/mall",
10 "pages/signIn/signIn", 9 "pages/signIn/signIn",
11 - "pages/index/index",  
12 - "pages/logs/logs" 10 + "pages/register/register",
  11 + "pages/mall/addAddress/addAddress",
  12 + "pages/mall/addressManagement/addressManagement",
  13 + "pages/signIn/WeightData/WeightData",
  14 + "pages/my/myDataDetail/myDataDetail",
  15 + "pages/my/myData/myData",
  16 + "pages/my/my",
  17 + "pages/my/myFile/myFile",
  18 + "pages/mall/charge/charge",
  19 + "pages/signIn/daySignIn/daySignIn",
  20 + "pages/signIn/bodyWeght/bodyWeght"
13 ], 21 ],
14 "window": { 22 "window": {
15 "backgroundTextStyle": "light", 23 "backgroundTextStyle": "light",
16 "navigationBarBackgroundColor": "#FFAD50", 24 "navigationBarBackgroundColor": "#FFAD50",
17 "navigationBarTitleText": "麦夫子", 25 "navigationBarTitleText": "麦夫子",
18 "navigationBarTextStyle": "#FFFFFF" 26 "navigationBarTextStyle": "#FFFFFF"
  27 + },
  28 + "tabBar": {
  29 + "selectedColor": "#EEA625",
  30 + "list": [
  31 + {
  32 + "pagePath": "pages/signIn/signIn",
  33 + "text": "签到",
  34 + "iconPath": "images/nav01@2x.png",
  35 + "selectedIconPath": "images/nav02@2x.png"
  36 + },
  37 + {
  38 + "pagePath": "pages/mall/mall",
  39 + "text": "积分商城",
  40 + "iconPath": "images/nav03@2x.png",
  41 + "selectedIconPath": "images/nav04@2x.png"
  42 + },
  43 + {
  44 + "pagePath": "pages/my/my",
  45 + "text": "我的",
  46 + "iconPath": "images/nav05@2x.png",
  47 + "selectedIconPath": "images/nav06@2x.png"
  48 + }
  49 + ]
19 } 50 }
20 } 51 }
@@ -78,14 +78,12 @@ input, textarea { @@ -78,14 +78,12 @@ input, textarea {
78 /* fontIcon */ 78 /* fontIcon */
79 @font-face { 79 @font-face {
80 font-family: 'iconfont'; /* project id 921699 */ 80 font-family: 'iconfont'; /* project id 921699 */
81 - src: url('//at.alicdn.com/t/font_921699_itl48k5kvp.eot');  
82 - src: url('//at.alicdn.com/t/font_921699_itl48k5kvp.eot?#iefix') format('embedded-opentype'),  
83 - url('//at.alicdn.com/t/font_921699_itl48k5kvp.woff') format('woff'),  
84 - url('//at.alicdn.com/t/font_921699_itl48k5kvp.ttf') format('truetype'),  
85 - url('//at.alicdn.com/t/font_921699_itl48k5kvp.svg#iconfont') format('svg'); 81 + src: url('//at.alicdn.com/t/font_921699_3ksf6ogpoj.eot');
  82 + src: url('//at.alicdn.com/t/font_921699_3ksf6ogpoj.eot?#iefix') format('embedded-opentype'),
  83 + url('//at.alicdn.com/t/font_921699_3ksf6ogpoj.woff') format('woff'),
  84 + url('//at.alicdn.com/t/font_921699_3ksf6ogpoj.ttf') format('truetype'),
  85 + url('//at.alicdn.com/t/font_921699_3ksf6ogpoj.svg#iconfont') format('svg');
86 } 86 }
87 -  
88 -  
89 .iconfont { 87 .iconfont {
90 font-family:"iconfont" !important; 88 font-family:"iconfont" !important;
91 font-size:16px; 89 font-size:16px;
@@ -94,4 +92,36 @@ input, textarea { @@ -94,4 +92,36 @@ input, textarea {
94 -moz-osx-font-smoothing: grayscale; 92 -moz-osx-font-smoothing: grayscale;
95 } 93 }
96 94
  95 +.icon-fangkuai:before { content: "\e646"; }
  96 +
  97 +.icon-tubiao201:before { content: "\e638"; }
  98 +
  99 +.icon-xiangyoujiantou:before { content: "\e662"; }
  100 +
  101 +.icon-weibiaoti4:before { content: "\e604"; }
  102 +
  103 +.icon-xuanze:before { content: "\e656"; }
  104 +
  105 +.icon-artboard61:before { content: "\e788"; }
  106 +
  107 +.icon-renzheng:before { content: "\e611"; }
  108 +
  109 +.icon-fang:before { content: "\e691"; }
  110 +
97 .icon-arrow-right:before { content: "\e600"; } 111 .icon-arrow-right:before { content: "\e600"; }
  112 +
  113 +.icon-guanyu:before { content: "\e650"; }
  114 +
  115 +.icon-xuanze2:before { content: "\e6c3"; }
  116 +
  117 +.icon-xuanze1:before { content: "\e676"; }
  118 +
  119 +.icon-xiala:before { content: "\e798"; }
  120 +
  121 +.icon-ios-vip:before { content: "\e601"; }
  122 +
  123 +.icon-c_jifen:before { content: "\e8b7"; }
  124 +
  125 +.icon-duihuanchenggong-:before { content: "\e606"; }
  126 +
  127 +.icon-icon-test:before { content: "\e61e"; }
1 -//index.js  
2 -//获取应用实例  
3 -const app = getApp()  
4 -  
5 -Page({  
6 - data: {  
7 - motto: 'Hello World',  
8 - userInfo: {},  
9 - hasUserInfo: false,  
10 - canIUse: wx.canIUse('button.open-type.getUserInfo')  
11 - },  
12 - //事件处理函数  
13 - bindViewTap: function() {  
14 - wx.navigateTo({  
15 - url: '../logs/logs'  
16 - })  
17 - },  
18 - onLoad: function () {  
19 - if (app.globalData.userInfo) {  
20 - this.setData({  
21 - userInfo: app.globalData.userInfo,  
22 - hasUserInfo: true  
23 - })  
24 - } else if (this.data.canIUse){  
25 - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回  
26 - // 所以此处加入 callback 以防止这种情况  
27 - app.userInfoReadyCallback = res => {  
28 - this.setData({  
29 - userInfo: res.userInfo,  
30 - hasUserInfo: true  
31 - })  
32 - }  
33 - } else {  
34 - // 在没有 open-type=getUserInfo 版本的兼容处理  
35 - wx.getUserInfo({  
36 - success: res => {  
37 - app.globalData.userInfo = res.userInfo  
38 - this.setData({  
39 - userInfo: res.userInfo,  
40 - hasUserInfo: true  
41 - })  
42 - }  
43 - })  
44 - }  
45 - },  
46 - getUserInfo: function(e) {  
47 - console.log(e)  
48 - app.globalData.userInfo = e.detail.userInfo  
49 - this.setData({  
50 - userInfo: e.detail.userInfo,  
51 - hasUserInfo: true  
52 - })  
53 - }  
54 -})  
1 -<!--index.wxml-->  
2 -<view class="container">  
3 - <view class="userinfo">  
4 - <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>  
5 - <block wx:else>  
6 - <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>  
7 - <text class="userinfo-nickname">{{userInfo.nickName}}</text>  
8 - </block>  
9 - </view>  
10 - <view class="usermotto">  
11 - <text class="user-motto">{{motto}}</text>  
12 - </view>  
13 -</view>  
1 -/**index.wxss**/  
2 -.userinfo {  
3 - display: flex;  
4 - flex-direction: column;  
5 - align-items: center;  
6 -}  
7 -  
8 -.userinfo-avatar {  
9 - width: 128rpx;  
10 - height: 128rpx;  
11 - margin: 20rpx;  
12 - border-radius: 50%;  
13 -}  
14 -  
15 -.userinfo-nickname {  
16 - color: #aaa;  
17 -}  
18 -  
19 -.usermotto {  
20 - margin-top: 200px;  
21 -}  
1 -//logs.js  
2 -const util = require('../../utils/util.js')  
3 -  
4 -Page({  
5 - data: {  
6 - logs: []  
7 - },  
8 - onLoad: function () {  
9 - this.setData({  
10 - logs: (wx.getStorageSync('logs') || []).map(log => {  
11 - return util.formatTime(new Date(log))  
12 - })  
13 - })  
14 - }  
15 -})  
1 -{  
2 - "navigationBarTitleText": "查看启动日志"  
3 -}  
1 -<!--logs.wxml-->  
2 -<view class="container log-list">  
3 - <block wx:for="{{logs}}" wx:for-item="log">  
4 - <text class="log-item">{{index + 1}}. {{log}}</text>  
5 - </block>  
6 -</view>  
1 -.log-list {  
2 - display: flex;  
3 - flex-direction: column;  
4 - padding: 40rpx;  
5 -}  
6 -.log-item {  
7 - margin: 10rpx;  
8 -}  
1 // pages/mall/charge/charge.js 1 // pages/mall/charge/charge.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + goods_id: '',
  10 + orderInfo: '',
  11 + goods_num: '',
  12 + price: '',
  13 + total_price: '',
  14 + remark: '',
  15 + address_list: ''
8 16
9 }, 17 },
  18 + //商品数量
  19 + getNum(e) {
  20 + this.setData({
  21 + goods_num: e.detail.value
  22 + })
  23 + this.getTotalPrice()
  24 + },
  25 + //计算总额
  26 + getTotalPrice() {
  27 + var goods_num = this.data.goods_num
  28 + var price = this.data.price
  29 + this.setData({
  30 + total_price: goods_num * price
  31 + })
  32 + },
  33 + //备注
  34 + remark(e) {
  35 + this.setData({
  36 + remark: e.detail.value
  37 + })
  38 + },
  39 + //商品详情
  40 + goodsDetail() {
  41 + let url = 'portal/Goods/goodsOrder'
  42 + let params = {
  43 + id: this.data.goods_id,
  44 + }
  45 + let header = {
  46 + "XX-Token": wx.getStorageSync('token'),
  47 + }
  48 + app.post(url, params, header).then((res) => {
  49 + console.log(res)
  50 + if (res.data.code == 20000) {
  51 + this.setData({
  52 + orderInfo: res.data.data,
  53 + price: res.data.data.price
  54 + })
  55 + }
  56 + this.getPrice()
  57 + })
  58 + },
  59 + //默认数量1
  60 + getPrice() {
  61 + var count = this.data.goods_num
  62 + if (count == '') {
  63 + this.setData({
  64 + goods_num: 1
  65 + })
  66 + this.getTotalPrice()
  67 + }
  68 + },
  69 + //地址管理
  70 + addressList() {
  71 + var goods_id = this.data.goods_id
  72 + wx.navigateTo({
  73 + url: '../addressManagement/addressManagement?goods_id=' + goods_id,
  74 + })
  75 + },
  76 +
  77 + //获得地址
  78 + getAddress() {
  79 + let url = 'portal/Goods/address'
  80 + let params = {}
  81 + let header = {
  82 + "XX-Token": wx.getStorageSync('token'),
  83 + }
  84 + app.post(url, params, header).then((res) => {
  85 + let address = res.data.data
  86 + for (let i = 0; i < address.length; i++) {
  87 + if (address[i].status == 1) {
  88 + this.setData({
  89 + address_list: address[i]
  90 + })
  91 + }
  92 + }
  93 + console.log(this.data.address_list)
  94 + })
  95 + },
  96 +
  97 + //地址详情
  98 + getAddressDetail() {
  99 + let url = 'portal/Goods/addressChoose'
  100 + let params = {
  101 + id: this.data.address_id
  102 + }
  103 + let header = {
  104 + "XX-Token": wx.getStorageSync('token'),
  105 + }
  106 + app.post(url, params, header).then((res) => {
  107 + this.setData({
  108 + address_list: res.data.data
  109 + })
  110 + console.log(this.data.address_list)
  111 + })
  112 + },
  113 +
  114 + //立即兑换
  115 + goBuy(e) {
  116 + var address_id = e.currentTarget.dataset.address_id
  117 + if (this.data.goods_num <= 0) {
  118 + wx.showToast({
  119 + title: '请输入正确数量',
  120 + icon: 'none'
  121 + })
  122 + } else if (address_id == '') {
  123 + wx.showToast({
  124 + title: '请添加地址',
  125 + icon: 'none'
  126 + })
  127 + } else {
  128 + let url = 'portal/Goods/orderPost'
  129 + let params = {
  130 + goods_id: e.currentTarget.dataset.goods_id,
  131 + address_id: address_id,
  132 + remark: this.data.remark,
  133 + count: this.data.goods_num,
  134 + price: this.data.total_price
  135 + }
  136 + let header = {
  137 + "XX-Token": wx.getStorageSync('token'),
  138 + }
  139 + app.post(url, params, header).then((res) => {
  140 + console.log(res)
  141 + if (res.data.code == 40000) {
  142 + wx.showToast({
  143 + title: res.data.msg,
  144 + icon: 'none',
  145 + })
  146 + } else if (res.data.code == 40001) {
  147 + wx.showToast({
  148 + title: res.data.msg,
  149 + icon: 'none',
  150 + })
  151 + } else if (res.data.code == 40002) {
  152 + wx.showToast({
  153 + title: res.data.msg,
  154 + icon: 'none',
  155 + })
  156 + } else {
  157 + wx.navigateTo({
  158 + url: '../success/success',
  159 + })
  160 + // wx.showToast({
  161 + // title: '购买成功',
  162 + // success: function() {
  163 + // setTimeout(function() {
  164 + // wx.switchTab({
  165 + // url: '../../mall/mall',
  166 + // })
  167 + // }, 2000)
  168 + // }
  169 + // })
  170 + }
  171 + })
  172 + }
  173 + },
  174 +
10 175
11 /** 176 /**
12 * 生命周期函数--监听页面加载 177 * 生命周期函数--监听页面加载
13 */ 178 */
14 - onLoad: function (options) { 179 + onLoad: function(options) {
  180 + this.setData({
  181 + goods_id: options.goods_id,
  182 + address_id: options.address_id
  183 + })
  184 + console.log(this.data.address_id)
  185 + if (options.address_id) {
  186 + this.getAddressDetail()
  187 + } else {
  188 + this.getAddress()
  189 + }
  190 + this.goodsDetail()
  191 +
15 192
16 }, 193 },
17 194
18 /** 195 /**
19 * 生命周期函数--监听页面初次渲染完成 196 * 生命周期函数--监听页面初次渲染完成
20 */ 197 */
21 - onReady: function () { 198 + onReady: function() {
22 199
23 }, 200 },
24 201
25 /** 202 /**
26 * 生命周期函数--监听页面显示 203 * 生命周期函数--监听页面显示
27 */ 204 */
28 - onShow: function () {  
29 - 205 + onShow: function() {
  206 + this.goodsDetail()
30 }, 207 },
31 208
32 /** 209 /**
33 * 生命周期函数--监听页面隐藏 210 * 生命周期函数--监听页面隐藏
34 */ 211 */
35 - onHide: function () { 212 + onHide: function() {
36 213
37 }, 214 },
38 215
39 /** 216 /**
40 * 生命周期函数--监听页面卸载 217 * 生命周期函数--监听页面卸载
41 */ 218 */
42 - onUnload: function () { 219 + onUnload: function() {
43 220
44 }, 221 },
45 222
46 /** 223 /**
47 * 页面相关事件处理函数--监听用户下拉动作 224 * 页面相关事件处理函数--监听用户下拉动作
48 */ 225 */
49 - onPullDownRefresh: function () { 226 + onPullDownRefresh: function() {
50 227
51 }, 228 },
52 229
53 /** 230 /**
54 * 页面上拉触底事件的处理函数 231 * 页面上拉触底事件的处理函数
55 */ 232 */
56 - onReachBottom: function () { 233 + onReachBottom: function() {
57 234
58 }, 235 },
59 236
60 /** 237 /**
61 * 用户点击右上角分享 238 * 用户点击右上角分享
62 */ 239 */
63 - onShareAppMessage: function () { 240 + onShareAppMessage: function() {
64 241
65 } 242 }
66 }) 243 })
1 <!--pages/mall/charge/charge.wxml--> 1 <!--pages/mall/charge/charge.wxml-->
2 <view class='content_box'> 2 <view class='content_box'>
3 - <view class='list_box'> 3 + <view class='list_box null_data' wx:if="{{address_list==''}}" bindtap='addressList'>请添加地址</view>
  4 + <view class='list_box' bindtap='addressList' wx:else>
4 <view class='item_list'> 5 <view class='item_list'>
5 <view> 6 <view>
6 <view> 7 <view>
7 - <text>向昱筱</text>  
8 - <text>13252648165</text> 8 + <text class='user_name'>{{address_list.name}}</text>
  9 + <text>{{address_list.mobile}}</text>
9 </view> 10 </view>
10 - <view>天津市和平区气象台路1088号中环公寓</view> 11 + <view class='list_info'>{{address_list.province}}{{address_list.address}}</view>
11 </view> 12 </view>
12 <view class='iconfont icon-arrow-right'></view> 13 <view class='iconfont icon-arrow-right'></view>
13 </view> 14 </view>
@@ -17,21 +18,55 @@ @@ -17,21 +18,55 @@
17 <view class='item_list'> 18 <view class='item_list'>
18 <view class='list_info_box'> 19 <view class='list_info_box'>
19 <view class='list_img'> 20 <view class='list_img'>
20 - <image src='/images/good.png'></image> 21 + <image src='{{orderInfo.image}}'></image>
21 </view> 22 </view>
22 <view> 23 <view>
23 - <view>百草味 肉干肉脯 白芝麻猪肉脯</view>  
24 - <view>100克</view> 24 + <view class='good_title'>{{orderInfo.goods_name}}</view>
  25 + <view class='good_info'>{{orderInfo.content}}</view>
25 <view class='good_num_box'> 26 <view class='good_num_box'>
26 - <text>  
27 - <text class='good_num'>150</text>  
28 - <text>积分</text>  
29 - </text>  
30 - <text class='original_price'>250积分</text> 27 + <text class='good_num'>{{orderInfo.now_price}}积分</text>
  28 + <text class='original_price'>{{orderInfo.before_price}}积分</text>
31 </view> 29 </view>
32 </view> 30 </view>
33 </view> 31 </view>
34 <view class=''>X1</view> 32 <view class=''>X1</view>
35 </view> 33 </view>
36 </view> 34 </view>
  35 + <view class='list_box'>
  36 + <view class='item_list'>
  37 + <view>金额</view>
  38 + <view>{{total_price}}积分</view>
  39 + </view>
  40 + <view class='item_list'>
  41 + <view>数量</view>
  42 + <view class='num'>
  43 + <input type='number' placeholder='请输入数量' bindinput='getNum' value='{{goods_num}}'></input>
  44 + </view>
  45 + </view>
  46 + </view>
  47 + <view class='list_box'>
  48 + <view class='list_title'>备注</view>
  49 + <view class='item_list'>
  50 + <view class='list_input'>
  51 + <textarea placeholder='请填写备注' bindinput='remark'></textarea>
  52 + </view>
  53 + </view>
  54 + </view>
  55 +</view>
  56 +<view class='item_list charge_list'>
  57 + <view>
  58 + <text class='iconfont icon-c_jifen'></text>
  59 + <text>积分兑换</text>
  60 + </view>
  61 + <view>
  62 + <!-- <text class='iconfont icon-xuanze'></text> -->
  63 + <text class='iconfont icon-xuanze1'></text>
  64 + </view>
  65 +</view>
  66 +<view class='bottom_box'>
  67 + <view>
  68 + <text>实付金额 : </text>
  69 + <text class='good_num'>{{total_price}}积分</text>
  70 + </view>
  71 + <view class='charge_btn' bindtap='goBuy' data-goods_id='{{orderInfo.id}}' data-address_id='{{address_list.id}}'>立即兑换</view>
37 </view> 72 </view>
@@ -12,8 +12,9 @@ page { @@ -12,8 +12,9 @@ page {
12 background: #fff; 12 background: #fff;
13 border-radius: 20rpx; 13 border-radius: 20rpx;
14 margin-bottom: 16rpx; 14 margin-bottom: 16rpx;
15 - padding: 30rpx; 15 + padding: 0 30rpx 30rpx 30rpx;
16 box-sizing: border-box; 16 box-sizing: border-box;
  17 + overflow: hidden;
17 } 18 }
18 19
19 .item_list { 20 .item_list {
@@ -22,25 +23,135 @@ page { @@ -22,25 +23,135 @@ page {
22 justify-content: space-between; 23 justify-content: space-between;
23 font-size: 26rpx; 24 font-size: 26rpx;
24 color: #1a1a1a; 25 color: #1a1a1a;
  26 + padding-top: 30rpx;
  27 + padding-bottom: 30rpx;
  28 + border-bottom: 1rpx solid #ebebeb;
25 } 29 }
26 30
  31 +.item_list:last-child {
  32 + border: 0;
  33 + margin-top: 0;
  34 + padding-bottom: 0;
  35 +}
  36 +.null_data{
  37 + font-size: 36rpx;
  38 + padding-top: 20rpx;
  39 + box-sizing: border-box;
  40 +}
  41 +.icon-arrow-right{
  42 + font-size: 28rpx;
  43 + color: #ccc;
  44 +}
27 .list_title { 45 .list_title {
28 font-size: 30rpx; 46 font-size: 30rpx;
29 font-weight: bold; 47 font-weight: bold;
30 color: #26363a; 48 color: #26363a;
31 - margin-bottom: 30rpx; 49 + margin-top: 30rpx;
32 } 50 }
33 -.list_info_box{ 51 +.user_name{
  52 + margin-right: 20rpx;
  53 +}
  54 +.list_info_box {
34 display: flex; 55 display: flex;
35 align-items: center; 56 align-items: center;
36 } 57 }
37 -.list_img{ 58 +.list_info{
  59 + margin-top: 30rpx;
  60 +}
  61 +.list_img {
38 width: 128rpx; 62 width: 128rpx;
39 height: 128rpx; 63 height: 128rpx;
40 border-radius: 5rpx; 64 border-radius: 5rpx;
41 margin-right: 30rpx; 65 margin-right: 30rpx;
42 } 66 }
43 -.list_img image{ 67 +
  68 +.list_img image {
44 width: 100%; 69 width: 100%;
45 height: 100%; 70 height: 100%;
46 -}  
  71 +}
  72 +
  73 +.good_title {
  74 + font-size: 26rpx;
  75 + font-weight: bold;
  76 + color: #1a1a1a;
  77 +}
  78 +
  79 +.good_info {
  80 + font-size: 26rpx;
  81 + color: #666;
  82 + margin: 12rpx 0;
  83 +}
  84 +
  85 +.good_num {
  86 + font-size: 32rpx;
  87 + color: #f78708;
  88 + font-weight: bold;
  89 +}
  90 +
  91 +.original_price {
  92 + font-size: 26rpx;
  93 + color: #a5a6a8;
  94 + text-decoration: line-through;
  95 + margin-left: 25rpx;
  96 +}
  97 +.num input{
  98 + text-align: right;
  99 +}
  100 +.list_input {
  101 + width: 100%;
  102 +}
  103 +
  104 +.list_input textarea {
  105 + width: 100%;
  106 + font-size: 28rpx;
  107 + min-height: 120rpx;
  108 +}
  109 +
  110 +.charge_list {
  111 + background: #fff;
  112 + padding: 30rpx !important;
  113 + font-size: 30rpx;
  114 + color: #252729;
  115 +}
  116 +
  117 +.icon-c_jifen {
  118 + color: #ffad50;
  119 + font-size: 40rpx;
  120 + margin-right: 30rpx;
  121 +}
  122 +
  123 +.icon-xuanze {
  124 + font-size: 40rpx;
  125 + color: #e5e5ea;
  126 +}
  127 +
  128 +.icon-xuanze1 {
  129 + font-size: 38rpx;
  130 + color: #ffad50;
  131 +}
  132 +
  133 +.bottom_box {
  134 + width: 100%;
  135 + height: 100rpx;
  136 + background: #fff;
  137 + font-size: 24rpx;
  138 + color: #666;
  139 + position: fixed;
  140 + bottom: 0;
  141 + left: 0;
  142 + display: flex;
  143 + align-items: center;
  144 + justify-content: space-between;
  145 + padding-left: 30rpx;
  146 +}
  147 +
  148 +.charge_btn {
  149 + width: 250rpx;
  150 + height: 100%;
  151 + background: #ffad50;
  152 + font-size: 36rpx;
  153 + color: #fff;
  154 + display: flex;
  155 + align-items: center;
  156 + justify-content: center;
  157 +}
1 // pages/mall/mall.js 1 // pages/mall/mall.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + goods_list: []
  10 + },
  11 + //产品列表
  12 + goodsList() {
  13 + let url = 'portal/Goods/index'
  14 + let params = {}
  15 + app.post(url, params).then((res) => {
  16 + console.log(res)
  17 + if (res.data.code == 20000) {
  18 + this.setData({
  19 + goods_list: res.data.data
  20 + })
  21 + }
  22 + })
  23 + },
  24 + //
  25 + goBuy(e) {
  26 + var goods_id = e.currentTarget.dataset.id
  27 + wx.navigateTo({
  28 + url: '../mall/charge/charge?goods_id=' + goods_id,
  29 + })
9 }, 30 },
10 -  
11 /** 31 /**
12 * 生命周期函数--监听页面加载 32 * 生命周期函数--监听页面加载
13 */ 33 */
14 - onLoad: function (options) {  
15 - 34 + onLoad: function(options) {
  35 + this.goodsList()
16 }, 36 },
17 37
18 /** 38 /**
19 * 生命周期函数--监听页面初次渲染完成 39 * 生命周期函数--监听页面初次渲染完成
20 */ 40 */
21 - onReady: function () { 41 + onReady: function() {
22 42
23 }, 43 },
24 44
25 /** 45 /**
26 * 生命周期函数--监听页面显示 46 * 生命周期函数--监听页面显示
27 */ 47 */
28 - onShow: function () { 48 + onShow: function() {
29 49
30 }, 50 },
31 51
32 /** 52 /**
33 * 生命周期函数--监听页面隐藏 53 * 生命周期函数--监听页面隐藏
34 */ 54 */
35 - onHide: function () { 55 + onHide: function() {
36 56
37 }, 57 },
38 58
39 /** 59 /**
40 * 生命周期函数--监听页面卸载 60 * 生命周期函数--监听页面卸载
41 */ 61 */
42 - onUnload: function () { 62 + onUnload: function() {
43 63
44 }, 64 },
45 65
46 /** 66 /**
47 * 页面相关事件处理函数--监听用户下拉动作 67 * 页面相关事件处理函数--监听用户下拉动作
48 */ 68 */
49 - onPullDownRefresh: function () { 69 + onPullDownRefresh: function() {
50 70
51 }, 71 },
52 72
53 /** 73 /**
54 * 页面上拉触底事件的处理函数 74 * 页面上拉触底事件的处理函数
55 */ 75 */
56 - onReachBottom: function () { 76 + onReachBottom: function() {
57 77
58 }, 78 },
59 79
60 /** 80 /**
61 * 用户点击右上角分享 81 * 用户点击右上角分享
62 */ 82 */
63 - onShareAppMessage: function () { 83 + onShareAppMessage: function() {
64 84
65 } 85 }
66 }) 86 })
1 <!--pages/mall/mall.wxml--> 1 <!--pages/mall/mall.wxml-->
2 <view class='goods_box'> 2 <view class='goods_box'>
3 - <view class='good_item' wx:for='{{[1,1,1,1,1]}}'> 3 + <view class='good_item' wx:for='{{goods_list}}' wx:key=''>
4 <view class='good_img'> 4 <view class='good_img'>
5 - <image src='/images/good.png'></image> 5 + <image src='{{item.image}}'></image>
6 </view> 6 </view>
7 <view class='good_info_box'> 7 <view class='good_info_box'>
8 - <view class='good_title'>红枣酿造酒贵族经典</view>  
9 - <view class='good_info'>奶油味夏威夷果200g/袋</view> 8 + <view class='good_title'>{{item.goods_name}}</view>
  9 + <view class='good_info'>{{item.content}}</view>
10 <view class='good_num_box'> 10 <view class='good_num_box'>
11 <view> 11 <view>
12 - <text class='good_num'>150</text> 12 + <text class='good_num'>{{item.now_price}}</text>
13 <text>积分</text> 13 <text>积分</text>
14 </view> 14 </view>
15 - <view class='original_price'>250积分</view> 15 + <view class='original_price'>{{item.before_price}}积分</view>
16 </view> 16 </view>
17 - <view class='charge_btn'>立即兑换</view> 17 + <view class='charge_btn' bindtap='goBuy' data-id='{{item.id}}'>立即兑换</view>
18 </view> 18 </view>
19 </view> 19 </view>
20 </view> 20 </view>
1 // pages/my/my.js 1 // pages/my/my.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + avatar:'',
  10 + user_nickname:'',
  11 + user_status:''
  12 + },
8 13
  14 + //我的健康档案
  15 + myFile() {
  16 + wx.navigateTo({
  17 + url: '../my/myFile/myFile',
  18 + })
  19 + },
  20 + //我的积分管理
  21 + myIntegral() {
  22 + wx.navigateTo({
  23 + url: '../my/myDataDetail/myDataDetail',
  24 + })
  25 + },
  26 +
  27 + //
  28 + getData() {
  29 + let url = 'portal/User/my'
  30 + let params = {}
  31 + let header = {
  32 + "XX-Token": wx.getStorageSync('token')
  33 + }
  34 + app.post(url, params, header).then((res) => {
  35 + console.log(res)
  36 + if (res.data.code == 20000) {
  37 + this.setData({
  38 + avatar: res.data.data.avatar,
  39 + user_nickname: res.data.data.user_nickname,
  40 + user_status: res.data.data.user_status
  41 + })
  42 + }
  43 + })
9 }, 44 },
10 45
11 /** 46 /**
12 * 生命周期函数--监听页面加载 47 * 生命周期函数--监听页面加载
13 */ 48 */
14 - onLoad: function (options) {  
15 - 49 + onLoad: function(options) {
  50 + this.getData()
16 }, 51 },
17 52
18 /** 53 /**
19 * 生命周期函数--监听页面初次渲染完成 54 * 生命周期函数--监听页面初次渲染完成
20 */ 55 */
21 - onReady: function () { 56 + onReady: function() {
22 57
23 }, 58 },
24 59
25 /** 60 /**
26 * 生命周期函数--监听页面显示 61 * 生命周期函数--监听页面显示
27 */ 62 */
28 - onShow: function () { 63 + onShow: function() {
29 64
30 }, 65 },
31 66
32 /** 67 /**
33 * 生命周期函数--监听页面隐藏 68 * 生命周期函数--监听页面隐藏
34 */ 69 */
35 - onHide: function () { 70 + onHide: function() {
36 71
37 }, 72 },
38 73
39 /** 74 /**
40 * 生命周期函数--监听页面卸载 75 * 生命周期函数--监听页面卸载
41 */ 76 */
42 - onUnload: function () { 77 + onUnload: function() {
43 78
44 }, 79 },
45 80
46 /** 81 /**
47 * 页面相关事件处理函数--监听用户下拉动作 82 * 页面相关事件处理函数--监听用户下拉动作
48 */ 83 */
49 - onPullDownRefresh: function () { 84 + onPullDownRefresh: function() {
50 85
51 }, 86 },
52 87
53 /** 88 /**
54 * 页面上拉触底事件的处理函数 89 * 页面上拉触底事件的处理函数
55 */ 90 */
56 - onReachBottom: function () { 91 + onReachBottom: function() {
57 92
58 }, 93 },
59 94
60 /** 95 /**
61 * 用户点击右上角分享 96 * 用户点击右上角分享
62 */ 97 */
63 - onShareAppMessage: function () { 98 + onShareAppMessage: function() {
64 99
65 } 100 }
66 }) 101 })
1 -{}  
  1 +{
  2 + "navigationBarTitleText": "我的"
  3 +}
1 -<!--pages/my/my.wxml-->  
2 -<text>pages/my/my.wxml</text> 1 +<view class='banner_box'>
  2 + <view class='head_img'>
  3 + <image src='{{avatar}}'></image>
  4 + </view>
  5 + <view>{{user_nickname}}</view>
  6 + <view class='state' wx:if='{{user_status==2}}'>
  7 + <image src='/images/vip.png'></image>
  8 + </view>
  9 +</view>
  10 +
  11 +<view class='content_box'>
  12 + <view class='list_box'>
  13 + <view class='item_list' bindtap='myFile'>
  14 + <view>我的健康档案</view>
  15 + <view class='list_input'>
  16 + <text class='iconfont icon-arrow-right'></text>
  17 + </view>
  18 + </view>
  19 + <view class='item_list' bindtap='myIntegral'>
  20 + <view>我的积分管理</view>
  21 + <view class='list_input'>
  22 + <text class='iconfont icon-arrow-right'></text>
  23 + </view>
  24 + </view>
  25 + </view>
  26 +</view>
1 -/* pages/my/my.wxss */  
  1 +@import '../signIn/bodyWeght/bodyWeght';
  2 +.banner_box{
  3 + width: 100%;
  4 + height: 390rpx;
  5 + display: flex;
  6 + align-items: center;
  7 + justify-content: center;
  8 + flex-direction: column;
  9 + font-size: 28rpx;
  10 + color: #000000;
  11 +}
  12 +.head_img{
  13 + width: 120rpx;
  14 + height: 120rpx;
  15 + margin-bottom: 20rpx;
  16 + border-radius: 50%;
  17 + overflow: hidden;
  18 +}
  19 +.head_img image{
  20 + width:100%;
  21 + height: 100%;
  22 +}
  23 +.state{
  24 + width: 149rpx;
  25 + height: 54rpx;
  26 + margin-top: 20rpx;
  27 +}
  28 +.state image{
  29 + width: 100%;
  30 + height: 100%;
  31 +}
1 // pages/signIn/Weight/Weight.js 1 // pages/signIn/Weight/Weight.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + weight_data: '',
  10 + record: [],
  11 + rote: 0,
  12 + show_weight: '',
  13 + show:false,
  14 + },
  15 + showTips() {
  16 + let that = this;
  17 + let show = this.data.show;
  18 + if (!show) {
  19 + that.setData({
  20 + show: !that.data.show
  21 + })
  22 + setTimeout(function() {
  23 + that.setData({
  24 + show: !that.data.show
  25 + })
  26 + }, 3000)
  27 + }
  28 + },
  29 +
  30 + //
  31 + getData() {
  32 + let url = 'portal/Sign/weekSign'
  33 + let header = {
  34 + "XX-Token": wx.getStorageSync('token')
  35 + }
  36 + let params = {}
  37 + app.post(url, params, header).then((res) => {
  38 + console.log(res)
  39 + let rote = parseInt(res.data.data.param.angle) - 90
  40 + if (rote > 90) {
  41 + rote = 90
  42 + } else if (rote < -90) {
  43 + rote = -90
  44 + }
  45 + if (res.data.code == 20000) {
  46 + this.setData({
  47 + weight_data: res.data.data.param,
  48 + record: res.data.data.record,
  49 + rote: rote,
  50 + show_weight: res.data.data.param.show_weight
  51 + })
  52 +
  53 + }
  54 +
  55 + })
  56 + },
8 57
  58 + //添加记录
  59 + addRecord() {
  60 + wx.navigateTo({
  61 + url: '../bodyWeght/bodyWeght?show_weight=' + this.data.show_weight,
  62 + })
9 }, 63 },
10 64
  65 +
11 /** 66 /**
12 * 生命周期函数--监听页面加载 67 * 生命周期函数--监听页面加载
13 */ 68 */
14 - onLoad: function (options) {  
15 - 69 + onLoad: function(options) {
  70 + this.getData()
16 }, 71 },
17 72
18 /** 73 /**
19 * 生命周期函数--监听页面初次渲染完成 74 * 生命周期函数--监听页面初次渲染完成
20 */ 75 */
21 - onReady: function () { 76 + onReady: function() {
22 77
23 }, 78 },
24 79
25 /** 80 /**
26 * 生命周期函数--监听页面显示 81 * 生命周期函数--监听页面显示
27 */ 82 */
28 - onShow: function () { 83 + onShow: function() {
29 84
30 }, 85 },
31 86
32 /** 87 /**
33 * 生命周期函数--监听页面隐藏 88 * 生命周期函数--监听页面隐藏
34 */ 89 */
35 - onHide: function () { 90 + onHide: function() {
36 91
37 }, 92 },
38 93
39 /** 94 /**
40 * 生命周期函数--监听页面卸载 95 * 生命周期函数--监听页面卸载
41 */ 96 */
42 - onUnload: function () { 97 + onUnload: function() {
43 98
44 }, 99 },
45 100
46 /** 101 /**
47 * 页面相关事件处理函数--监听用户下拉动作 102 * 页面相关事件处理函数--监听用户下拉动作
48 */ 103 */
49 - onPullDownRefresh: function () { 104 + onPullDownRefresh: function() {
50 105
51 }, 106 },
52 107
53 /** 108 /**
54 * 页面上拉触底事件的处理函数 109 * 页面上拉触底事件的处理函数
55 */ 110 */
56 - onReachBottom: function () { 111 + onReachBottom: function() {
57 112
58 }, 113 },
59 114
60 /** 115 /**
61 * 用户点击右上角分享 116 * 用户点击右上角分享
62 */ 117 */
63 - onShareAppMessage: function () { 118 + onShareAppMessage: function() {
64 119
65 } 120 }
66 }) 121 })
1 -<!--pages/signIn/Weight/Weight.wxml-->  
2 -<text>pages/signIn/Weight/Weight.wxml</text> 1 +<!--pages/weight/weight.wxml-->
  2 +<view class='z_container'>
  3 + <view class='top_watch'>
  4 + <view class='todayData'>
  5 + <view class='now_data'>孕{{weight_data.pregnant_week}}周+{{weight_data.day}}天</view>
  6 + <view class='now_weight'>{{weight_data.weight}}</view>
  7 + </view>
  8 + <view class='images_box'>
  9 + <image src='http://maifuzi.w.bronet.cn/themes/simpleboot3/public/assets/images/aele03@2x.png'></image>
  10 + </view>
  11 + <!--顶部数据 -->
  12 + <view class='data_1 data'>{{weight_data.bashBoard[0]}}Kg</view>
  13 + <view class='data_2 data'>{{weight_data.bashBoard[1]}}Kg</view>
  14 + <view class='data_3 data'>{{weight_data.bashBoard[2]}}Kg</view>
  15 + <view class='data_4 data'>{{weight_data.bashBoard[3]}}Kg</view>
  16 + <!--指针 -->
  17 + <image src='http://maifuzi.w.bronet.cn/themes/simpleboot3/public/assets/images/zhizhen.png' class='zhizhen' style='transform: rotate({{rote}}deg);'></image>
  18 + </view>
  19 + <!--topData -->
  20 + <view class='top_data'>
  21 + <view class='left_data'>
  22 + <view class='top_direc'>
  23 + {{weight_data.increase}}
  24 + <view class='danwei'>kg</view>
  25 + </view>
  26 + <view class='top_label'>
  27 + 较孕前增长
  28 + </view>
  29 + </view>
  30 + <view class='right_data'>
  31 + <view class='top_direc'>
  32 + {{weight_data.overplus}}
  33 + <view class='danwei'>kg</view>
  34 + </view>
  35 + <view class='top_label' bindtap='showTips'>
  36 + <text>剩余配额</text>
  37 + <view class='tips'>!</view>
  38 + </view>
  39 + </view>
  40 + <view class='latestips {{show?"show":""}}'>
  41 + <view class='tips_box'>为整个孕期目标增长体重与目前已经增长体重的差值。</view>
  42 + </view>
  43 +
  44 + </view>
  45 + <!--container -->
  46 + <view class='record_container'>
  47 + <!--添加记录-->
  48 + <view class='add_icon' bindtap='addRecord' data->
  49 + <image src='http://maifuzi.w.bronet.cn/themes/simpleboot3/public/assets/images/aicon02@2x.png'></image>
  50 + </view>
  51 + <!--记录列表-->
  52 + <view class='record_label'>
  53 + <view class='label_item'>孕期</view>
  54 + <view class='label_item'>体重 kg</view>
  55 + <view class='label_item'>状态 </view>
  56 + </view>
  57 + <view class='record_lists'>
  58 + <block wx:for="{{record}}" wx:key="" >
  59 + <view class='record_list'>
  60 + <view class='record_list_item'>孕{{weight_data.pregnant_week}}周+{{item.day}}天</view>
  61 + <view class='record_list_item'>{{item.weight}}</view>
  62 + <view class='record_list_item'>{{item.status}}</view>
  63 + </view>
  64 + </block>
  65 + </view>
  66 + </view>
  67 + <view class='biaozhu'>注:算法数据来源于美国医学研究所(IOM)</view>
  68 +</view>
  69 +<view class='mask' wx:if="{{mask}}" bindtap='closefirst'>
  70 + <!--初始测量提示框 -->
  71 + <view class='tongyi_toast' wx:if="{{showtype==6}}">
  72 + <view class='toast_container'>
  73 + <view class='shengming'>体重测量的正确姿势:</view>
  74 + <view class='detail'>早上起床后;排空大小便;穿同样的衣服;尽量在吃早饭之前。因为这样称体重,受外界影响比较小,会比较准确。</view>
  75 + </view>
  76 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  77 + </view>
  78 +
  79 + <!--正常 -->
  80 + <view class='tongyi_toast' wx:if="{{showtype=='3'}}">
  81 + <view class='toast_container'>
  82 + <view class='detail'>{{sign_mbi}}</view>
  83 + </view>
  84 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  85 + </view>
  86 + <!--超轻 -->
  87 + <view class='tongyi_toast' wx:if="{{showtype=='1'}}">
  88 + <view class='toast_container'>
  89 + <view class='detail'>您目前体重过轻,为不影响您和宝宝的健康,需为身体增加能量,加强营养,您可在公众号图文消息中查看孕妇体重过轻如何增重。</view>
  90 + </view>
  91 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  92 + </view>
  93 + <!--偏轻 -->
  94 + <view class='tongyi_toast' wx:if="{{showtype=='2'}}">
  95 + <view class='toast_container'>
  96 + <view class='detail'>您目前体重偏低,为不影响您和宝宝的健康,需为身体增加能量,加强营养,您可在公众号图文消息中查看体重偏低如何增重。</view>
  97 + </view>
  98 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  99 + </view>
  100 + <!--超重-->
  101 + <view class='tongyi_toast' wx:if="{{showtype=='4'}}">
  102 + <view class='toast_container'>
  103 + <view class='detail'>您目前体重偏重,为了不影响您和宝宝的健康,建议控制体重增长速度,少食多餐适当运动,您可在公众号图文消息中查看孕期如何合理饮食。</view>
  104 + </view>
  105 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  106 + </view>
  107 + <view class='tongyi_toast' wx:if="{{showtype=='5'}}">
  108 + <view class='toast_container'>
  109 + <view class='detail'>您目前体重超重,为了不影响您和宝宝的健康,建议减重,为避免发生妊娠期合并症,适当运动,您可在公众号图文消息中查看孕期如何科学减重。</view>
  110 + </view>
  111 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  112 + </view>
  113 + <!--点击提示 -->
  114 + <view class='tongyi_toast' wx:if="{{showtype=='8'}}">
  115 + <view class='toast_container'>
  116 + <view class='detail'>{{sign_mbi}}</view>
  117 + </view>
  118 + <view class='liaojie' bindtap='closefirst'>知道了</view>
  119 + </view>
  120 +</view>
1 -/* pages/signIn/Weight/Weight.wxss */  
  1 +/* pages/weight/weight.wxss */
  2 +
  3 +.z_container {
  4 + height: 100vh;
  5 + overflow: hidden;
  6 + background: linear-gradient(#ffad50, #ffc685);
  7 +}
  8 +
  9 +.top_watch {
  10 + height: 240rpx;
  11 + width: 370rpx;
  12 + margin: 0 auto;
  13 + position: relative;
  14 +}
  15 +
  16 +.top_watch image {
  17 + width: 100%;
  18 + height: 100%;
  19 +}
  20 +
  21 +.top_watch .data {
  22 + position: absolute;
  23 + color: #fff;
  24 + font-size: 25rpx;
  25 + z-index: 15;
  26 +}
  27 +
  28 +.data_1 {
  29 + top: 100rpx;
  30 + left: -30rpx;
  31 + transform: rotate(-58deg);
  32 +}
  33 +
  34 +.data_2 {
  35 + top: 17rpx;
  36 + transform: rotate(-18deg);
  37 + left: 80rpx;
  38 +}
  39 +
  40 +.data_3 {
  41 + top: 22rpx;
  42 + transform: rotate(18deg);
  43 + right: 71rpx;
  44 +}
  45 +
  46 +.data_4 {
  47 + top: 101rpx;
  48 + transform: rotate(54deg);
  49 + right: -32rpx;
  50 +}
  51 +
  52 +.images_box {
  53 + width: 100%;
  54 + height: 185rpx;
  55 + position: absolute;
  56 + bottom: 0;
  57 + left: 50%;
  58 + transform: translateX(-50%);
  59 +}
  60 +
  61 +.top_data {
  62 + margin: 13rpx 95rpx 0 118rpx;
  63 + display: flex;
  64 + justify-content: space-between;
  65 + color: #fff;
  66 + position: relative;
  67 +}
  68 +
  69 +.latestips {
  70 + width: 400rpx;
  71 + height: 110rpx;
  72 + background: #fff;
  73 + position: absolute;
  74 + top: 25rpx;
  75 + left: -80rpx;
  76 + border-radius: 10rpx;
  77 + opacity: 0;
  78 + transition: 1s;
  79 +}
  80 +
  81 +.latestips.show {
  82 + opacity: 1;
  83 +}
  84 +
  85 +.tips_box {
  86 + width: 100%;
  87 + height: 100%;
  88 + position: relative;
  89 + box-sizing: border-box;
  90 + padding: 0rpx 10rpx 5rpx 13rpx;
  91 + display: flex;
  92 + align-items: center;
  93 + font-size: 28rpx;
  94 + color: #ffad50;
  95 +}
  96 +
  97 +.tips_box:after {
  98 + content: '';
  99 + display: block;
  100 + bottom: 8rpx;
  101 + right: -22rpx;
  102 + position: absolute;
  103 + width: 0;
  104 + height: 0;
  105 + border-left: 24rpx solid #fff;
  106 + border-top: 10rpx solid transparent;
  107 + border-bottom: 10rpx solid transparent;
  108 +}
  109 +
  110 +.top_direc {
  111 + display: flex;
  112 + color: #fff;
  113 + font-size: 64rpx;
  114 + height: 90rpx;
  115 + font-weight: bold;
  116 + align-items: center;
  117 +}
  118 +
  119 +.danwei {
  120 + font-size: 34rpx;
  121 + display: flex;
  122 + align-items: flex-end;
  123 + justify-content: center;
  124 + height: 64rpx;
  125 + font-weight: normal;
  126 + margin-left: 20rpx;
  127 +}
  128 +
  129 +.top_label {
  130 + font-size: 30rpx;
  131 + display: flex;
  132 + align-items: center;
  133 + justify-content: center;
  134 +}
  135 +
  136 +.tips {
  137 + width: 48rpx;
  138 + height: 48rpx;
  139 + border-radius: 50%;
  140 + background-color: #fff;
  141 + color: #ddd;
  142 + display: flex;
  143 + align-items: center;
  144 + margin-left: 15rpx;
  145 + justify-content: center;
  146 +}
  147 +
  148 +.record_container {
  149 + width: 670rpx;
  150 + height: 570rpx;
  151 + background-color: #fff;
  152 + margin: 0 auto;
  153 + margin-top: 60rpx;
  154 + border-radius: 10rpx;
  155 + position: relative;
  156 + padding: 0 15rpx;
  157 + padding-top: 60rpx;
  158 + box-sizing: border-box;
  159 + margin-bottom: 4rpx;
  160 +}
  161 +
  162 +.add_icon {
  163 + background: #fff;
  164 + border-radius: 50%;
  165 + width: 120rpx;
  166 + height: 120rpx;
  167 + padding: 10rpx;
  168 + display: flex;
  169 + align-items: center;
  170 + justify-content: center;
  171 + position: absolute;
  172 + left: 50%;
  173 + top: -50rpx;
  174 + transform: translateX(-50%);
  175 +}
  176 +
  177 +.add_icon image {
  178 + width: 100%;
  179 + height: 100%;
  180 +}
  181 +
  182 +.record_label {
  183 + font-size: 34rpx;
  184 + color: #333;
  185 + font-weight: bold;
  186 + display: flex;
  187 + justify-content: space-between;
  188 + border-bottom: 1rpx solid #d8d8d8;
  189 +}
  190 +
  191 +.label_item, .record_list_item {
  192 + height: 88rpx;
  193 + display: flex;
  194 + flex: 1;
  195 + align-items: center;
  196 + justify-content: center;
  197 +}
  198 +
  199 +.type_icon {
  200 + width: 28rpx;
  201 + height: 28rpx;
  202 + margin-right: 8rpx;
  203 +}
  204 +
  205 +.record_lists {
  206 + height: 430rpx;
  207 + overflow-y: auto;
  208 +}
  209 +
  210 +.record_list {
  211 + font-size: 30rpx;
  212 + color: #666;
  213 + display: flex;
  214 + border-bottom: 1rpx solid #d8d8d8;
  215 +}
  216 +
  217 +.record_list:last-child {
  218 + border: none;
  219 +}
  220 +
  221 +.zhengchang {
  222 + color: #56dca5;
  223 + display: none;
  224 +}
  225 +
  226 +.chaoqing {
  227 + color: #78d2df;
  228 + display: none;
  229 +}
  230 +
  231 +.chaozhong {
  232 + color: #aa6e6e;
  233 +}
  234 +
  235 +.biaozhu {
  236 + font-size: 26rpx;
  237 + color: #fff;
  238 + padding: 10rpx 73rpx;
  239 +}
  240 +
  241 +image.zhizhen {
  242 + width: 14rpx;
  243 + position: absolute;
  244 + bottom: 0;
  245 + z-index: 15;
  246 + height: 193rpx;
  247 + left: 50%;
  248 + top: 50%;
  249 + margin: -75rpx 0 0 -7rpx;
  250 + transform-origin: bottom;
  251 + -webkit-transform-origin: bottom;
  252 + transform: rotate(0deg);
  253 + transition: 1s;
  254 +}
  255 +
  256 +.weight_type {
  257 + display: none;
  258 +}
  259 +
  260 +.weight_type.active {
  261 + display: block;
  262 +}
  263 +
  264 +.todayData {
  265 + text-align: center;
  266 + color: #fff;
  267 + position: absolute;
  268 + top: 140rpx;
  269 + width: 100%;
  270 + font-size: 30rpx;
  271 +}
  272 +
  273 +.now_weight {
  274 + font-size: 64rpx;
  275 + line-height: 64rpx;
  276 + font-weight: bold;
  277 +}
  278 +
  279 +.mask {
  280 + width: 100%;
  281 + height: 100%;
  282 + display: flex;
  283 + position: fixed;
  284 + top: 0;
  285 + left: 0;
  286 + background: rgba(0, 0, 0, 0.3);
  287 + z-index: 20;
  288 +}
  289 +
  290 +.tongyi_toast {
  291 + width: 560rpx;
  292 + margin: 0 auto;
  293 + margin-top: 423rpx;
  294 + background: #fff;
  295 + border-radius: 10rpx;
  296 + overflow: hidden;
  297 + position: absolute;
  298 + left: 50%;
  299 + transform: translateX(-50%);
  300 + padding-bottom: 100rpx;
  301 +}
  302 +
  303 +.toast_container {
  304 + padding: 24rpx;
  305 + font-size: 30rpx;
  306 + text-align: center;
  307 + color: #666;
  308 + line-height: 52rpx;
  309 +}
  310 +
  311 +.shengming {
  312 + text-align: center;
  313 + margin-bottom: 10rpx;
  314 +}
  315 +
  316 +.liaojie {
  317 + height: 100rpx;
  318 + border-top: 1rpx #e5e5e5 solid;
  319 + display: flex;
  320 + align-items: center;
  321 + justify-content: center;
  322 + font-size: 36rpx;
  323 + color: #02bb00;
  324 + position: absolute;
  325 + bottom: 0;
  326 + left: 0;
  327 + right: 0;
  328 +}
1 // pages/signIn/bodyWeght/bodyWeght.js 1 // pages/signIn/bodyWeght/bodyWeght.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + weight: '',
  10 + currentTime:'',
  11 + },
  12 + //
  13 + getWeightData(e) {
  14 + this.setData({
  15 + weight: e.detail.value
  16 + })
  17 + },
  18 + //
  19 + saveInfo() {
  20 + let url = 'portal/Sign/weekSignPost'
  21 + let header = {
  22 + "XX-Token": wx.getStorageSync('token')
  23 + }
  24 + let params = {
  25 + weight: this.data.weight
  26 + }
  27 + app.post(url, params, header).then((res) => {
  28 + console.log(res)
  29 + if (res.data.code == 20000) {
  30 + wx.switchTab({
  31 + url: '../../signIn/signIn',
  32 + })
  33 + }
  34 + })
  35 + },
8 36
  37 + //
  38 + listDetail() {
  39 + wx.navigateTo({
  40 + url: '../WeightData/WeightData',
  41 + })
9 }, 42 },
10 43
11 /** 44 /**
12 * 生命周期函数--监听页面加载 45 * 生命周期函数--监听页面加载
13 */ 46 */
14 - onLoad: function (options) { 47 + onLoad: function(options) {
  48 + var year = new Date().getFullYear()
  49 + var month = new Date().getMonth()+1
  50 + var day = new Date().getDate()
  51 + this.setData({
  52 + currentTime: year + '年' + month + '月' + day+'日',
  53 + weight:options.show_weight
  54 + })
15 55
16 }, 56 },
17 57
18 /** 58 /**
19 * 生命周期函数--监听页面初次渲染完成 59 * 生命周期函数--监听页面初次渲染完成
20 */ 60 */
21 - onReady: function () { 61 + onReady: function() {
22 62
23 }, 63 },
24 64
25 /** 65 /**
26 * 生命周期函数--监听页面显示 66 * 生命周期函数--监听页面显示
27 */ 67 */
28 - onShow: function () { 68 + onShow: function() {
29 69
30 }, 70 },
31 71
32 /** 72 /**
33 * 生命周期函数--监听页面隐藏 73 * 生命周期函数--监听页面隐藏
34 */ 74 */
35 - onHide: function () { 75 + onHide: function() {
36 76
37 }, 77 },
38 78
39 /** 79 /**
40 * 生命周期函数--监听页面卸载 80 * 生命周期函数--监听页面卸载
41 */ 81 */
42 - onUnload: function () { 82 + onUnload: function() {
43 83
44 }, 84 },
45 85
46 /** 86 /**
47 * 页面相关事件处理函数--监听用户下拉动作 87 * 页面相关事件处理函数--监听用户下拉动作
48 */ 88 */
49 - onPullDownRefresh: function () { 89 + onPullDownRefresh: function() {
50 90
51 }, 91 },
52 92
53 /** 93 /**
54 * 页面上拉触底事件的处理函数 94 * 页面上拉触底事件的处理函数
55 */ 95 */
56 - onReachBottom: function () { 96 + onReachBottom: function() {
57 97
58 }, 98 },
59 99
60 /** 100 /**
61 * 用户点击右上角分享 101 * 用户点击右上角分享
62 */ 102 */
63 - onShareAppMessage: function () { 103 + onShareAppMessage: function() {
64 104
65 } 105 }
66 }) 106 })
@@ -3,18 +3,18 @@ @@ -3,18 +3,18 @@
3 <view class='list_box'> 3 <view class='list_box'>
4 <view class='item_list'> 4 <view class='item_list'>
5 <view>测量日期</view> 5 <view>测量日期</view>
6 - <view class='list_input'>2018年12月19日</view> 6 + <view class='list_input'>{{currentTime}}</view>
7 </view> 7 </view>
8 <view class='item_list'> 8 <view class='item_list'>
9 - <view>测量日期</view>  
10 - <view class='list_input'><input placeholder='请输入当天体重kg' placeholder-class='input_color'></input></view> 9 + <view>测量体重</view>
  10 + <view class='list_input'><input placeholder='请输入当天体重kg' placeholder-class='input_color' bindinput='getWeightData' value='{{weight}}'></input></view>
11 </view> 11 </view>
12 </view> 12 </view>
13 <view class='list_box'> 13 <view class='list_box'>
14 - <view class='item_list'> 14 + <view class='item_list' bindtap='listDetail'>
15 <view>我的体重数据</view> 15 <view>我的体重数据</view>
16 <view class='list_input'><text class='iconfont icon-arrow-right'></text></view> 16 <view class='list_input'><text class='iconfont icon-arrow-right'></text></view>
17 </view> 17 </view>
18 </view> 18 </view>
19 </view> 19 </view>
20 -<view class='bottom_btn'>保存</view>  
  20 +<view class='bottom_btn' bindtap='saveInfo'>保存</view>
1 // pages/signIn/dailySignIn/dailySignIn.js 1 // pages/signIn/dailySignIn/dailySignIn.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + status: '',
  10 + background: '',
  11 + music: '',
  12 + music_name: '',
  13 + score: '',
  14 + backgroundAudioManager:''
  15 + },
  16 + getData() {
  17 + let url = 'portal/Sign/day_sign'
  18 + let params = {
  19 + status: this.data.status
  20 + }
  21 + let header = {
  22 + "XX-Token": wx.getStorageSync('token')
  23 + }
  24 + app.post(url, params, header).then((res) => {
  25 + if (res.data.code == 20000) {
  26 + this.setData({
  27 + background: res.data.data.background,
  28 + music: res.data.data.music,
  29 + music_name: res.data.data.music_name,
  30 + score: res.data.data.score,
  31 + title: res.data.data.title
  32 + })
  33 + const backgroundAudioManager = wx.getBackgroundAudioManager()
  34 + backgroundAudioManager.src = res.data.data.music
  35 + backgroundAudioManager.title='每日一签'
  36 + this.setData({
  37 + backgroundAudioManager: backgroundAudioManager
  38 + })
  39 + }
  40 + })
9 }, 41 },
10 42
  43 + //
  44 + stop(){
  45 + wx.stopBackgroundAudio(backgroundAudioManager)
  46 + },
11 /** 47 /**
12 * 生命周期函数--监听页面加载 48 * 生命周期函数--监听页面加载
13 */ 49 */
14 - onLoad: function (options) {  
15 - 50 + onLoad: function(options) {
  51 + this.setData({
  52 + status: options.sign
  53 + })
  54 + this.getData()
16 }, 55 },
17 56
18 /** 57 /**
19 * 生命周期函数--监听页面初次渲染完成 58 * 生命周期函数--监听页面初次渲染完成
20 */ 59 */
21 - onReady: function () { 60 + onReady: function() {
22 61
23 }, 62 },
24 63
25 /** 64 /**
26 * 生命周期函数--监听页面显示 65 * 生命周期函数--监听页面显示
27 */ 66 */
28 - onShow: function () { 67 + onShow: function() {
29 68
30 }, 69 },
31 70
32 /** 71 /**
33 * 生命周期函数--监听页面隐藏 72 * 生命周期函数--监听页面隐藏
34 */ 73 */
35 - onHide: function () { 74 + onHide: function() {
36 75
37 }, 76 },
38 77
39 /** 78 /**
40 * 生命周期函数--监听页面卸载 79 * 生命周期函数--监听页面卸载
41 */ 80 */
42 - onUnload: function () { 81 + onUnload: function() {
43 82
44 }, 83 },
45 84
46 /** 85 /**
47 * 页面相关事件处理函数--监听用户下拉动作 86 * 页面相关事件处理函数--监听用户下拉动作
48 */ 87 */
49 - onPullDownRefresh: function () { 88 + onPullDownRefresh: function() {
50 89
51 }, 90 },
52 91
53 /** 92 /**
54 * 页面上拉触底事件的处理函数 93 * 页面上拉触底事件的处理函数
55 */ 94 */
56 - onReachBottom: function () { 95 + onReachBottom: function() {
57 96
58 }, 97 },
59 98
60 /** 99 /**
61 * 用户点击右上角分享 100 * 用户点击右上角分享
62 */ 101 */
63 - onShareAppMessage: function () { 102 + onShareAppMessage: function() {
64 103
65 } 104 }
66 }) 105 })
1 <!--pages/signIn/dailySignIn/dailySignIn.wxml--> 1 <!--pages/signIn/dailySignIn/dailySignIn.wxml-->
2 <view class='content_box'> 2 <view class='content_box'>
3 - <view class='hint_box'>累计天数:That Girl——Olly Murs——24HRS(deluxe)</view> 3 + <view class='hint_box'>歌曲名称 : {{music_name}}</view>
4 <view class='list_img'> 4 <view class='list_img'>
5 - <image src='/images/img.png'></image> 5 + <image src='{{background}}'></image>
6 </view> 6 </view>
7 <view class='list_info'> 7 <view class='list_info'>
8 - <view>冬天太冷了,记得多穿几条秋裤,还有保暖~~~</view>  
9 - <view>——麦夫子</view> 8 + <view>{{title}}</view>
10 </view> 9 </view>
11 </view> 10 </view>
12 -<view class='bottom_box'>恭喜您签到成功,积分+5</view>  
  11 +<!-- <view bindtap='stop'>停止播放</view> -->
  12 +<view class='bottom_box'>恭喜您签到成功,积分+{{score}}</view>
1 // pages/signIn/daySignIn/daySignIn.js 1 // pages/signIn/daySignIn/daySignIn.js
  2 +var util = require('../../../utils/util.js');
  3 +const app = getApp()
2 Page({ 4 Page({
3 5
4 /** 6 /**
5 * 页面的初始数据 7 * 页面的初始数据
6 */ 8 */
7 data: { 9 data: {
  10 + sign: '',
  11 + popup_state: true,
  12 + currentTime: '',
  13 + is_week: '',
  14 + hint: '尚未到达签到时间',
  15 + state: false
  16 + },
  17 +
  18 + //签到
  19 + getData() {
  20 + let url = 'portal/Sign/daySign'
  21 + let params = {}
  22 + let header = {
  23 + "XX-Token": wx.getStorageSync('token')
  24 + }
  25 + app.post(url, params, header).then((res) => {
  26 + console.log(res)
  27 + // if (res.data.data.is_week == 1) {
  28 + // wx.navigateTo({
  29 + // url: '../../signIn/Weight/Weight',
  30 + // })
  31 + // }
  32 + if (res.data.code == 20000) {
  33 + this.setData({
  34 + all: res.data.data.all,
  35 + last: res.data.data.last,
  36 + longest: res.data.data.longest,
  37 + morning: res.data.data.morning,
  38 + noon: res.data.data.noon,
  39 + night: res.data.data.night,
  40 + sleep: res.data.data.sleep,
  41 + })
  42 + }
  43 + })
  44 + },
8 45
  46 + //签到
  47 + signIn() {
  48 + if (this.data.sign == 0) {
  49 + wx.showToast({
  50 + title: '未到打卡时间',
  51 + icon: 'none'
  52 + })
  53 + this.setData({
  54 + state: false
  55 + })
  56 + } else if (this.data.sign == -1) {
  57 + wx.showToast({
  58 + title: '当前时段已打卡',
  59 + icon: 'none'
  60 + })
  61 + this.setData({
  62 + state: false
  63 + })
  64 + } else {
  65 + let url = 'portal/Sign/daySignPost'
  66 + let params = {
  67 + status: this.data.sign
  68 + }
  69 + let header = {
  70 + "XX-Token": wx.getStorageSync('token')
  71 + }
  72 + app.post(url, params, header).then((res) => {
  73 + console.log(res)
  74 + if (res.data.code == 20000) {
  75 + this.getData()
  76 + this.setData({
  77 + state: false
  78 + })
  79 + if (res.data.data.day_sign == 1) {
  80 + var sign = this.data.sign
  81 + wx.navigateTo({
  82 + url: '../dailySignIn/dailySignIn?sign=' + sign,
  83 + })
  84 + }else{
  85 + wx.showToast({
  86 + title: '打卡成功',
  87 + })
  88 + }
  89 + } else if (res.data.code == 40000) {
  90 + wx.showToast({
  91 + title: res.data.msg,
  92 + icon: 'none'
  93 + })
  94 + this.setData({
  95 + state: false
  96 + })
  97 + } else if (res.data.code == 40002) {
  98 + wx.showToast({
  99 + title: res.data.msg,
  100 + icon: 'none'
  101 + })
  102 + this.setData({
  103 + state: false
  104 + })
  105 + }
  106 + })
  107 + }
  108 + },
  109 +
  110 + //
  111 + popupConfirm() {
  112 + this.setData({
  113 + popup_state: false
  114 + })
9 }, 115 },
10 116
11 /** 117 /**
12 * 生命周期函数--监听页面加载 118 * 生命周期函数--监听页面加载
13 */ 119 */
14 - onLoad: function (options) {  
15 - 120 + onLoad: function(options) {
  121 + console.log(options.sign)
  122 + this.setData({
  123 + sign: options.sign,
  124 + })
  125 + if (this.data.sign == 1) {
  126 + this.setData({
  127 + hint: '已进入早打卡时间范围',
  128 + state: true
  129 + })
  130 + } else if (this.data.sign == 2) {
  131 + this.setData({
  132 + hint: '已进入午打卡时间范围',
  133 + state: true
  134 + })
  135 + } else if (this.data.sign == 3) {
  136 + this.setData({
  137 + hint: '已进入晚打卡时间范围',
  138 + state: true
  139 + })
  140 + } else if (this.data.sign == 4) {
  141 + this.setData({
  142 + hint: '已进入睡前打卡时间范围',
  143 + state: true
  144 + })
  145 + }
  146 + this.getData()
  147 + var hour = new Date().getHours()
  148 + var minute = new Date().getMinutes()
  149 + var second = new Date().getSeconds()
  150 + this.setData({
  151 + currentTime: hour + ':' + minute + ":" + second
  152 + })
  153 + // 调用函数时,传入new Date()参数,返回值是日期和时间
  154 + var time = util.formatTime(new Date());
  155 + console.log(time)
  156 + // 再通过setData更改Page()里面的data,动态更新页面的数据
  157 + this.setData({
  158 + time: time
  159 + });
16 }, 160 },
17 161
18 /** 162 /**
19 * 生命周期函数--监听页面初次渲染完成 163 * 生命周期函数--监听页面初次渲染完成
20 */ 164 */
21 - onReady: function () { 165 + onReady: function() {
22 166
23 }, 167 },
24 168
25 /** 169 /**
26 * 生命周期函数--监听页面显示 170 * 生命周期函数--监听页面显示
27 */ 171 */
28 - onShow: function () {  
29 - 172 + onShow: function() {
  173 + this.getData()
30 }, 174 },
31 175
32 /** 176 /**
33 * 生命周期函数--监听页面隐藏 177 * 生命周期函数--监听页面隐藏
34 */ 178 */
35 - onHide: function () { 179 + onHide: function() {
36 180
37 }, 181 },
38 182
39 /** 183 /**
40 * 生命周期函数--监听页面卸载 184 * 生命周期函数--监听页面卸载
41 */ 185 */
42 - onUnload: function () { 186 + onUnload: function() {
43 187
44 }, 188 },
45 189
46 /** 190 /**
47 * 页面相关事件处理函数--监听用户下拉动作 191 * 页面相关事件处理函数--监听用户下拉动作
48 */ 192 */
49 - onPullDownRefresh: function () { 193 + onPullDownRefresh: function() {
50 194
51 }, 195 },
52 196
53 /** 197 /**
54 * 页面上拉触底事件的处理函数 198 * 页面上拉触底事件的处理函数
55 */ 199 */
56 - onReachBottom: function () { 200 + onReachBottom: function() {
57 201
58 }, 202 },
59 203
60 /** 204 /**
61 * 用户点击右上角分享 205 * 用户点击右上角分享
62 */ 206 */
63 - onShareAppMessage: function () { 207 + onShareAppMessage: function() {
64 208
65 } 209 }
66 }) 210 })
@@ -3,17 +3,17 @@ @@ -3,17 +3,17 @@
3 <view class='banner_item'>累计天数</view> 3 <view class='banner_item'>累计天数</view>
4 <view class='banner_item'>连续天数</view> 4 <view class='banner_item'>连续天数</view>
5 <view class='banner_item'>最长连续</view> 5 <view class='banner_item'>最长连续</view>
6 - <view class='banner_item banner_value'>3</view>  
7 - <view class='banner_item banner_value'>2</view>  
8 - <view class='banner_item banner_value'>1</view> 6 + <view class='banner_item banner_value'>{{all}}</view>
  7 + <view class='banner_item banner_value'>{{last}}</view>
  8 + <view class='banner_item banner_value'>{{longest}}</view>
9 </view> 9 </view>
10 <view class='content_box'> 10 <view class='content_box'>
11 <view class='list_info'>稳定血糖,从规律饮食开始!</view> 11 <view class='list_info'>稳定血糖,从规律饮食开始!</view>
12 - <view class='circle_box'> 12 + <view class="circle_box {{state?'circle_active':''}}" bindtap='signIn'>
13 <view>签到</view> 13 <view>签到</view>
14 - <view class='time_info'>07:23:34</view> 14 + <view class='time_info'>{{currentTime}}</view>
15 </view> 15 </view>
16 - <view class='list_info'>已进入早打卡时间范围</view> 16 + <view class='list_info'>{{hint}}</view>
17 </view> 17 </view>
18 <view class='footer_box'> 18 <view class='footer_box'>
19 <view class='footer_item'> 19 <view class='footer_item'>
@@ -24,20 +24,26 @@ @@ -24,20 +24,26 @@
24 </view> 24 </view>
25 <view class='footer_item footer_time'> 25 <view class='footer_item footer_time'>
26 <view class='footer_info'> 26 <view class='footer_info'>
27 - <view>2018/10/19</view>  
28 - <view>7:23:13</view> 27 + <view>{{morning==null? '未打卡' :morning}}</view>
29 </view> 28 </view>
30 <view class='footer_info'> 29 <view class='footer_info'>
31 - <view>2018/10/19</view>  
32 - <view>7:23:13</view> 30 + <view>{{noon==null?'未打卡':noon}}</view>
33 </view> 31 </view>
34 <view class='footer_info'> 32 <view class='footer_info'>
35 - <view>2018/10/19</view>  
36 - <view>7:23:13</view> 33 + <view>{{night==null?'未打卡':night}}</view>
37 </view> 34 </view>
38 <view class='footer_info'> 35 <view class='footer_info'>
39 - <view>2018/10/19</view>  
40 - <view>7:23:13</view> 36 + <view>{{sleep==null?'未打卡':sleep}}</view>
  37 + </view>
  38 + </view>
  39 +</view>
  40 +<!-- 弹窗 -->
  41 +<view class='mask_box' wx:if='{{popup_state}}'>
  42 + <view class='popuo_box'>
  43 + <view class='popup_title'>温馨提示</view>
  44 + <view class='popup_content'>请确定餐前血糖值已检测</view>
  45 + <view class='popup_btn_box'>
  46 + <view class='popup_btn' bindtap='popupConfirm'>确认</view>
41 </view> 47 </view>
42 </view> 48 </view>
43 </view> 49 </view>
@@ -36,8 +36,8 @@ @@ -36,8 +36,8 @@
36 .circle_box { 36 .circle_box {
37 width: 300rpx; 37 width: 300rpx;
38 height: 300rpx; 38 height: 300rpx;
39 - background: linear-gradient(100deg, rgba(255, 201, 136, 0.8), #ffad50);  
40 - box-shadow: 0rpx 15rpx 30rpx 0rpx rgba(255, 211, 160, 1); 39 + background: linear-gradient(to right, #ece599, #e7c366);
  40 + box-shadow: 0rpx 15rpx 30rpx 0rpx #e7c366;
41 border-radius: 50%; 41 border-radius: 50%;
42 display: flex; 42 display: flex;
43 align-items: center; 43 align-items: center;
@@ -47,6 +47,11 @@ @@ -47,6 +47,11 @@
47 color: #fff; 47 color: #fff;
48 } 48 }
49 49
  50 +.circle_active {
  51 + background: linear-gradient(to right, rgba(255, 201, 136, 0.8), #ffad50);
  52 + box-shadow: 0rpx 15rpx 30rpx 0rpx rgba(255, 211, 160, 1);
  53 +}
  54 +
50 .time_info { 55 .time_info {
51 font-size: 32rpx; 56 font-size: 32rpx;
52 margin-top: 35rpx; 57 margin-top: 35rpx;
@@ -94,7 +99,70 @@ @@ -94,7 +99,70 @@
94 text-align: center; 99 text-align: center;
95 } 100 }
96 101
97 -.footer_info view{ 102 +.footer_info view {
  103 + width: 100%;
  104 + text-align: center;
  105 + padding: 0 20rpx;
  106 +}
  107 +
  108 +/* */
  109 +
  110 +.mask_box {
  111 + width: 100%;
  112 + height: 100%;
  113 + background-color: RGBA(0, 0, 0, 0.6);
  114 + position: fixed;
  115 + top: 0;
  116 + left: 0;
  117 + display: flex;
  118 + align-items: center;
  119 + justify-content: center;
  120 + z-index: 100;
  121 +}
  122 +
  123 +.popuo_box {
  124 + width: 646rpx;
  125 + height: 450rpx;
  126 + background-color: #fff;
  127 + border-radius: 36rpx;
  128 + font-size: 36rpx;
  129 + overflow: hidden;
  130 + display: flex;
  131 + align-items: center;
  132 + justify-content: center;
  133 + flex-direction: column;
  134 + /* padding: 40rpx auto 30rpx auto; */
  135 +}
  136 +
  137 +.popup_title {
  138 + font-size: 26rpx;
  139 + color: #000;
  140 + margin: 30rpx;
  141 + text-align: center;
  142 +}
  143 +
  144 +.popup_content {
98 width: 100%; 145 width: 100%;
  146 + padding: 0 30rpx;
  147 + font-size: 32rpx;
  148 + color: #000;
99 text-align: center; 149 text-align: center;
100 -}  
  150 + margin-top: 40rpx;
  151 +}
  152 +
  153 +.popup_item {
  154 + margin-bottom: 20rpx;
  155 +}
  156 +
  157 +.popup_btn {
  158 + width: 260rpx;
  159 + height: 80rpx;
  160 + background: linear-gradient(0deg, rgba(255, 173, 80, 1), rgba(255, 191, 118, 1));
  161 + border-radius: 40rpx;
  162 + font-size: 30rpx;
  163 + color: #fff;
  164 + display: flex;
  165 + align-items: center;
  166 + justify-content: center;
  167 + margin-top: 80rpx;
  168 +}
1 // pages/signIn/signIn.js 1 // pages/signIn/signIn.js
  2 +const app = getApp()
  3 +var formatTime = require('../../utils/util.js')
2 Page({ 4 Page({
3 5
4 /** 6 /**
5 * 页面的初始数据 7 * 页面的初始数据
6 */ 8 */
7 data: { 9 data: {
  10 + state: false,
  11 + start_time: '',
  12 + slogan: '',
  13 + end_time: '',
  14 + is_week: ''
  15 + },
  16 +
  17 + //首页信息
  18 + getData() {
  19 + var that = this
  20 + var time = parseInt(new Date().getHours());
  21 + let url = '/portal/Sign/index'
  22 + let params = {}
  23 + let header = {
  24 + "XX-Token": wx.getStorageSync('token')
  25 + }
  26 + app.post(url, params, header).then((res) => {
  27 + if (res.data.code == 20000) {
  28 + that.setData({
  29 + slogan: res.data.data.slogan,
  30 + start_time: res.data.data.start_time,
  31 + end_time: res.data.data.end_time,
  32 + sign: res.data.data.sign,
  33 + is_week: res.data.data.is_week,
  34 + })
  35 + }
  36 + })
  37 + },
  38 +
  39 + //签到
  40 + signIn() {
  41 + var sign = this.data.sign
  42 + var is_week = this.data.is_week
  43 + if (is_week == 1) {
  44 + wx.navigateTo({
  45 + url: '../signIn/Weight/Weight',
  46 + })
  47 + } else {
  48 + wx.navigateTo({
  49 + url: '../signIn/daySignIn/daySignIn?sign=' + sign,
  50 + })
  51 + }
  52 + // if (sign == 0) {
  53 + // wx.showToast({
  54 + // title: '未到打卡时间',
  55 + // icon: 'none'
  56 + // })
  57 + // } else if (sign ==-1) {
  58 + // wx.showToast({
  59 + // title: '当前时段已打卡',
  60 + // icon: 'none'
  61 + // })
  62 + // } else {
  63 +
  64 + // }
  65 +
8 66
9 }, 67 },
10 68
11 /** 69 /**
12 * 生命周期函数--监听页面加载 70 * 生命周期函数--监听页面加载
13 */ 71 */
14 - onLoad: function (options) {  
15 - 72 + onLoad: function(options) {
  73 + this.getData()
16 }, 74 },
17 75
18 /** 76 /**
19 * 生命周期函数--监听页面初次渲染完成 77 * 生命周期函数--监听页面初次渲染完成
20 */ 78 */
21 - onReady: function () { 79 + onReady: function() {
22 80
23 }, 81 },
24 82
25 /** 83 /**
26 * 生命周期函数--监听页面显示 84 * 生命周期函数--监听页面显示
27 */ 85 */
28 - onShow: function () {  
29 - 86 + onShow: function() {
  87 + this.getData()
30 }, 88 },
31 89
32 /** 90 /**
33 * 生命周期函数--监听页面隐藏 91 * 生命周期函数--监听页面隐藏
34 */ 92 */
35 - onHide: function () { 93 + onHide: function() {
36 94
37 }, 95 },
38 96
39 /** 97 /**
40 * 生命周期函数--监听页面卸载 98 * 生命周期函数--监听页面卸载
41 */ 99 */
42 - onUnload: function () { 100 + onUnload: function() {
43 101
44 }, 102 },
45 103
46 /** 104 /**
47 * 页面相关事件处理函数--监听用户下拉动作 105 * 页面相关事件处理函数--监听用户下拉动作
48 */ 106 */
49 - onPullDownRefresh: function () { 107 + onPullDownRefresh: function() {
50 108
51 }, 109 },
52 110
53 /** 111 /**
54 * 页面上拉触底事件的处理函数 112 * 页面上拉触底事件的处理函数
55 */ 113 */
56 - onReachBottom: function () { 114 + onReachBottom: function() {
57 115
58 }, 116 },
59 117
60 /** 118 /**
61 * 用户点击右上角分享 119 * 用户点击右上角分享
62 */ 120 */
63 - onShareAppMessage: function () { 121 + onShareAppMessage: function() {
64 122
65 } 123 }
66 }) 124 })
1 <!--pages/signIn/signIn.wxml--> 1 <!--pages/signIn/signIn.wxml-->
2 -<text>pages/signIn/signIn.wxml</text> 2 +<view class='content_box'>
  3 + <view class='hint_info'>{{slogan}}</view>
  4 + <view class="circle_box circle_active {{state?'':''}}" bindtap='signIn'>
  5 + <view>签到</view>
  6 + <view class='list_img'>
  7 + <image src='http://maifuzi.w.bronet.cn/themes/simpleboot3/public/assets/images/aele01@2x.png'></image>
  8 + </view>
  9 + <view class='list_img img2'>
  10 + <image src='http://maifuzi.w.bronet.cn/themes/simpleboot3/public/assets/images/aele02@2x.png'></image>
  11 + </view>
  12 + </view>
  13 + <view class='list_time'>签到时间:{{start_time}} -- {{end_time}}</view>
  14 +</view>
1 -/* pages/signIn/signIn.wxss */  
  1 +/* pages/signIn/signIn.wxss */
  2 +.content_box{
  3 + width: 100%;
  4 + height: 100%;
  5 + position: fixed;
  6 + top: 0;
  7 + left: 0;
  8 + display: flex;
  9 + align-items: center;
  10 + justify-content: space-between;
  11 + flex-direction: column;
  12 + padding: 100rpx 0 160rpx 0;
  13 +}
  14 +.hint_info {
  15 + font-size: 36rpx;
  16 + color: #fc961e;
  17 + padding: 0 160rpx;
  18 + text-align: center;
  19 + /* margin: 100rpx 0; */
  20 +}
  21 +
  22 +.circle_box {
  23 + width: 300rpx;
  24 + height: 300rpx;
  25 + background: linear-gradient(to right, #ece599, #e7c366);
  26 + box-shadow: 0rpx 15rpx 30rpx 0rpx #e7c366;
  27 + border-radius: 50%;
  28 + display: flex;
  29 + align-items: center;
  30 + justify-content: center;
  31 + flex-direction: column;
  32 + font-size: 48rpx;
  33 + color: #fff;
  34 + margin: 0 auto;
  35 + position: relative;
  36 + margin-top: 50rpx;
  37 +}
  38 +
  39 +.circle_active {
  40 + background: linear-gradient(to right, rgba(255, 201, 136, 0.8), #ffad50);
  41 + box-shadow: 0rpx 15rpx 30rpx 0rpx rgba(255, 211, 160, 1);
  42 +}
  43 +
  44 +.list_img {
  45 + width: 473rpx;
  46 + height: 287rpx;
  47 + position: absolute;
  48 + bottom: -220rpx;
  49 +}
  50 +.img2{
  51 + bottom: 0;
  52 + left: -69rpx;
  53 +}
  54 +.list_img image,.img2 image{
  55 + width: 100%;
  56 + height: 100%;
  57 +}
  58 +.list_time{
  59 + font-size: 32rpx;
  60 + color: #EEA625;
  61 + margin-top: 300rpx;
  62 + text-align: center;
  63 +}
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 "ignore": [] 4 "ignore": []
5 }, 5 },
6 "setting": { 6 "setting": {
7 - "urlCheck": true, 7 + "urlCheck": false,
8 "es6": true, 8 "es6": true,
9 "postcss": true, 9 "postcss": true,
10 "minified": true, 10 "minified": true,
@@ -12,8 +12,8 @@ @@ -12,8 +12,8 @@
12 }, 12 },
13 "compileType": "miniprogram", 13 "compileType": "miniprogram",
14 "libVersion": "2.4.0", 14 "libVersion": "2.4.0",
15 - "appid": "wx48319d952ea4e37f",  
16 - "projectname": "%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9", 15 + "appid": "wxba11d129e245cbf4",
  16 + "projectname": "%E9%BA%A6%E5%A4%AB%E5%AD%90",
17 "debugOptions": { 17 "debugOptions": {
18 "hidedInDevtools": [] 18 "hidedInDevtools": []
19 }, 19 },
@@ -27,13 +27,23 @@ @@ -27,13 +27,23 @@
27 "current": -1, 27 "current": -1,
28 "list": [] 28 "list": []
29 }, 29 },
  30 + "plugin": {
  31 + "current": -1,
  32 + "list": []
  33 + },
30 "game": { 34 "game": {
31 "currentL": -1, 35 "currentL": -1,
32 "list": [] 36 "list": []
33 }, 37 },
34 "miniprogram": { 38 "miniprogram": {
35 - "current": -1,  
36 - "list": [] 39 + "current": 0,
  40 + "list": [
  41 + {
  42 + "id": -1,
  43 + "name": "line",
  44 + "pathName": "pages/signIn/WeightData/WeightData"
  45 + }
  46 + ]
37 } 47 }
38 } 48 }
39 } 49 }
1 -const formatTime = date => { 1 +function formatTime(date) {
2 const year = date.getFullYear() 2 const year = date.getFullYear()
3 const month = date.getMonth() + 1 3 const month = date.getMonth() + 1
4 const day = date.getDate() 4 const day = date.getDate()