Commit db4c9cf8 authored by 张杰's avatar 张杰

饮食

parent 70bc625d
{ {
"pages":[ "pages":[
"pages/home/teacher/index",
"pages/add_record/index", "pages/add_record/index",
"pages/home/teacher/index",
"pages/home/reviewer/index", "pages/home/reviewer/index",
"pages/home/parents/index" "pages/home/parents/index"
......
...@@ -17,8 +17,44 @@ Page({ ...@@ -17,8 +17,44 @@ Page({
selectIndex:0, selectIndex:0,
inputModel: [ inputModel: [
] ],
selectPic: []
},
//添加图片
addPicture: function(e) {
var that = this;
// 选择图片
wx.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
for (var i in res.tempFilePaths) {
that.data.selectPic.push(res.tempFilePaths[i])
}
that.setData({
selectPic: that.data.selectPic
});
}
})
},
previewPic:function(e) {
var current = this.data.selectPic[e.target.dataset.index]
wx.previewImage({
current: current,
urls: this.data.selectPic
})
},
//删除图片
deleteImg:function(e) {
var that = this
that.data.selectPic.splice(e.currentTarget.dataset.index,1)
that.setData({
selectPic: that.data.selectPic
})
}, },
tapCategory: function(e) { tapCategory: function(e) {
......
<!-- pages/add_record/index.wxml --> <!-- pages/add_record/index.wxml -->
<import src='/template/operate_btn/index.wxml'></import> <import src='/template/operate_btn/index.wxml'></import>
<view class='kg-separater ' style='height:2rpx;'></view> <view class='kg-separater ' style='height:2rpx;'></view>
<view class="segmentedControl"> <view class="segmentedControl">
<!-- 循环遍历 --> <!-- 循环遍历 -->
...@@ -17,7 +15,9 @@ ...@@ -17,7 +15,9 @@
<!-- 分类选项 --> <!-- 分类选项 -->
<view class="category"> <view class="category">
<view wx:for="{{categorys}}"> <view wx:for="{{categorys}}">
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tapCategory' data-index='{{index}}'>{{item}}</view> <view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tapCategory' data-index='{{index}}'>
{{item}}
</view>
</view> </view>
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
...@@ -29,6 +29,19 @@ ...@@ -29,6 +29,19 @@
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
<template is="section_header" data="{{title:'今日拍照'}}"></template> <template is="section_header" data="{{title:'今日拍照'}}"></template>
<view class='home-student-picture-item' style='padding-left:20rpx;padding-bottom:40rpx;'>
<!-- 选择的图片 -->
<view wx:for="{{selectPic}}">
<view class='add_picture_view'>
<image src='{{item}}' class='add_picture' bindtap='previewPic' data-index='{{index}}' mode='aspectFill'></image>
<image src='/src/img/cancel.png' class='delete' bindtap='deleteImg' data-index='{{index}}'></image>
</view>
</view>
<!-- 添加图片按钮 -->
<view class='add_picture_view' bindtap='addPicture'>
<image src='/src/img/take_photo.png' class='add_picture'></image>
</view>
</view>
</scroll-view> </scroll-view>
</view> </view>
<view hidden='{{controlIndex != 1}}'>睡觉</view> <view hidden='{{controlIndex != 1}}'>睡觉</view>
......
/* pages/add_record/index.wxss */ /* pages/add_record/index.wxss */
@import "../home/teacher/index.wxss"
/*LXSegmentedControl容器*/ /*LXSegmentedControl容器*/
.segmentedControl { .segmentedControl {
/*水平居中*/ /*水平居中*/
margin: 10px auto; margin: 10px auto;
/*边框为2px 主色调为蓝*/ /*边框为2px 主色调为蓝*/
border: 1px solid #f9aa76; border: 1px solid #f9aa76;
/*圆角6px*/ /*圆角6px*/
border-radius: 6px; border-radius: 6px;
/*控件宽度*/ /*控件宽度*/
width: calc(100vw - 20px); width: calc(100vw - 20px);
/*控件高度*/ /*控件高度*/
height: 30px; height: 30px;
} }
/*普通文本*/ /*普通文本*/
.segmentedControl text { .segmentedControl text {
/*水平排列*/ /*水平排列*/
float: left; float: left;
/*宽度为控件宽度的1/3 再减去2px的右边框*/ /*宽度为控件宽度的1/3 再减去2px的右边框*/
width: calc((100vw - 20px) / 3 - 1px); width: calc((100vw - 20px) / 3 - 1px);
/*字体大小*/ /*字体大小*/
font-size: 14px; font-size: 14px;
/*主色调*/ /*主色调*/
color: #f9aa76; color: #f9aa76;
/*行高,与控件高度相等*/ /*行高,与控件高度相等*/
line-height: 30px; line-height: 30px;
/*文本水平居中*/ /*文本水平居中*/
text-align: center; text-align: center;
/*右边距*/ /*右边距*/
border-right: 1px solid #f9aa76; border-right: 1px solid #f9aa76;
} }
/*选中状态文本*/ /*选中状态文本*/
.segmentedControl text.selected { .segmentedControl text.selected {
/*同主色调*/ /*同主色调*/
background-color: #f9aa76; background-color: #f9aa76;
/*前景色为白色*/ /*前景色为白色*/
color: white; color: white;
} }
/*最后一个分组按钮*/ /*最后一个分组按钮*/
.segmentedControl text.last { .segmentedControl text.last {
/*不必右边框*/ /*不必右边框*/
border-right: 0; border-right: 0;
/*高度也不必减少2px,就是控件高度的1/3*/ /*高度也不必减少2px,就是控件高度的1/3*/
width: calc((100vw - 20px) / 3); width: calc((100vw - 20px) / 3);
} }
.category { .category {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
padding: 20rpx 20rpx 0rpx; padding: 20rpx 20rpx 0rpx;
margin-right: -40rpx; margin-right: -40rpx;
justify-content: flex-start; justify-content: flex-start;
} }
.add_picture_view {
position: relative;
width: calc(100vw / 4 + 30rpx);
height: calc(100vw / 4 + 30rpx);
margin-right: 30rpx;
}
.add_picture {
border-width: 1rxp;
position: absolute;
left: 0rpx;
bottom: 0rpx;
width: calc(100vw / 4);
height: calc(100vw / 4);
}
.delete {
position: absolute;
/* background:#ccc; */
opacity: 1;
top: 0rpx;
right: 0rpx;
width: 60rpx;
height: 60rpx;
}
/* pages/home/teacher/index.wxss */ /* pages/home/teacher/index.wxss */
.home-header { .home-header {
height: 180rpx; height: 180rpx;
/* background-color: rgb(182, 179, 179); */ /* background-color: rgb(182, 179, 179); */
...@@ -82,12 +83,10 @@ ...@@ -82,12 +83,10 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
} }
.home-student-picture { .home-student-picture {
width:calc(100vw / 4.5); width:calc(100vw / 4.5);
height:calc(100vw / 4.5); height:calc(100vw / 4.5);
margin-left:20rpx margin-left:20rpx;
} }
\ No newline at end of file
<!--template/operate_btn/index.wxml--> <!--template/operate_btn/index.wxml-->
<template name="operate_btn"> <template name="operate_btn">
<view style='position:fixed;bottom: 0rpx;height:140rpx;'> <view style='position:fixed;bottom: 0rpx;height:140rpx;background-color:white;'>
<view class='kg-separater' style='height:4rpx;'></view> <view class='kg-separater' style='height:4rpx;'></view>
<view class='kg-operate-btn-bg'> <view class='kg-operate-btn-bg'>
<button class='kg-operate-btn kg-btn-no-border' bindtap='operateTap'>{{title}}</button> <button class='kg-operate-btn kg-btn-no-border' bindtap='operateTap'>{{title}}</button>
</view> </view>
</view> </view>
</template> </template>
<!--通用的分区标题--> <!--通用的分区标题-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment