作者 刘晓艳

麦父子折线图

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