Commit 55a8f35e authored by 张杰's avatar 张杰

代码优化

parent 44bba9e9
{ {
"pages":[ "pages":[
"pages/add_record/index",
"pages/home/teacher/index",
"pages/home/teacher/index",
"pages/add_record/index",
"pages/home/reviewer/index", "pages/home/reviewer/index",
"pages/home/parents/index" "pages/home/parents/index"
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
} }
/* 横向对齐布局样式 两边对齐 */
.kg-flex-row { .kg-flex-row {
justify-content: space-between; justify-content: space-between;
display: flex; display: flex;
...@@ -78,6 +79,17 @@ ...@@ -78,6 +79,17 @@
align-items: center; align-items: center;
} }
/* 纵向对齐布局样式 默认对齐方式*/
.kg-flex-column {
display: flex;
flex-direction: column;
justify-content: space-between;
/* 使这个样式可以拉伸 */
/* flex-grow: 1;
margin-left: 16rpx;
height: 120rpx; */
}
.kg-border { .kg-border {
border: 2rpx solid rgb(190, 190, 190); border: 2rpx solid rgb(190, 190, 190);
border-radius: 6rpx; border-radius: 6rpx;
...@@ -101,4 +113,26 @@ ...@@ -101,4 +113,26 @@
.eat_category_btn.selected { .eat_category_btn.selected {
border-color: #f9aa76; border-color: #f9aa76;
color: #f9aa76; color: #f9aa76;
}
/* 首页顶部 */
.home-header {
height: 180rpx;
margin-left: 32rpx;
margin-right: 32rpx;
}
/* 用户图片 */
.kg-user-icon {
height: 120rpx;
width: 120rpx;
border-radius: 60rpx;
background-color: blueviolet;
}
/* 性别图标 */
.kg-sex-icon {
height: 35rpx;
width: 30rpx;
margin-left: 8rpx;
} }
\ No newline at end of file
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'select',options:['pee','poo','diaper']}}"></template> <template is='quantity_cell' data="{{type:'select',options:['pee','poo','diaper']}}"></template>
<text class='kg-text-normal-gray' style='margin-top:20rpx' space="ensp">pee: 4次 poo: 1次 diaper: 9次</text> <text class='kg-text-normal-gray' style='margin-top:30rpx' space="ensp">pee: 4次 poo: 1次 diaper: 9次</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
......
<!--pages/home/parents/index.wxml--> <!--pages/home/parents/index.wxml-->
<text>pages/home/parents/index.wxml</text> <view class='home-header'>
</view>
...@@ -5,7 +5,7 @@ Page({ ...@@ -5,7 +5,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
signIcon:"https://gomore-wxmall.oss-cn-shanghai.aliyuncs.com/miniapp/hangzhouwanke/tabbar/home/score.png", signIcon:"/src/img/signin.png",
userIcon:"/src/img/defaut_teacher_icon.jpg", userIcon:"/src/img/defaut_teacher_icon.jpg",
}, },
......
<!--pages/home/teacher/index.wxml--> <!--pages/home/teacher/index.wxml-->
<import src='/template/operate_btn/index.wxml'></import> <import src='/template/operate_btn/index.wxml'></import>
<view class='home-header'> <view class='home-header kg-flex-row'>
<image class='home-header-user-icon' src='{{userIcon}}'></image> <template is='userInfo' data="{{userImg:userIcon,title:'向日葵小班-张老师',subTitle:'共19人',sex:''}}">
<view class='home-header-user-info'> </template>
<view class='kg-text-title'>向日葵小班-张老师</view>
<view class='kg-text-normal-gray'>共19人</view>
</view>
<view class='home-header-roll-call'> <view class='home-header-roll-call'>
<image class='roll-call-image' src='{{signIcon}}'></image> <image class='roll-call-image' src='{{signIcon}}'></image>
<view class='roll-call-title'>点名</view> <view class='roll-call-title'>点名</view>
...@@ -20,22 +18,19 @@ ...@@ -20,22 +18,19 @@
<!-- 名字 --> <!-- 名字 -->
<view class='home-student-name'> <view class='home-student-name'>
<view class='kg-text-normal-dark'>张小华</view> <view class='kg-text-normal-dark'>张小华</view>
<image class='home-student-sex' src='/src/img/female.png' mode='aspectFit'></image> <image class='kg-sex-icon' src='/src/img/female.png' mode='aspectFit'></image>
</view> </view>
<!-- 图片 --> <!-- 图片 -->
<view class='home-student-picture-item'> <view class='home-student-picture-item'>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
</view> </view>
<!-- 行为 --> <!-- 行为 -->
<view class='home-student-name' style='justify-content: space-between;margin:0rpx 10rpx;'> <view class='home-student-name' style='justify-content: space-between;margin:0rpx 30rpx;'>
<view wx:for="{{[1,2,3]}}"> <template is='imgTextView' data="{{img:'eat',text:'12' }}"> </template>
<view class='home-student-name'> <template is='imgTextView' data="{{img:'sleep',text:'2' }}"> </template>
<image src='/src/img/eat.png' class='home-student-behavior' mode='aspectFit'></image> <template is='imgTextView' data="{{img:'wc',text:'2' }}"> </template>
<view class='kg-text-normal-dark'>吃饭</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
......
/* pages/home/teacher/index.wxss */ /* pages/home/teacher/index.wxss */
.home-header {
height: 180rpx;
/* background-color: rgb(182, 179, 179); */
display: flex;
flex-direction: row;
align-items: center;
margin-left: 32rpx;
margin-right: 32rpx;
justify-content: space-between;
}
.home-header-user-icon {
height: 120rpx;
width: 120rpx;
border-radius: 60rpx;
background-color: blueviolet;
}
.home-header-user-info {
height: 120rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
/* background-color: burlywood; */
flex-grow: 1;
margin-left: 16rpx;
}
.home-header-roll-call { .home-header-roll-call {
width: 120rpx; width: 120rpx;
height: 80rpx; height: 80rpx;
...@@ -68,12 +38,6 @@ ...@@ -68,12 +38,6 @@
align-items: center; align-items: center;
} }
.home-student-sex {
height: 40rpx;
width: 30rpx;
margin-left: 8rpx;
}
.home-student-behavior { .home-student-behavior {
width: 60rpx; width: 60rpx;
height: 48rpx; height: 48rpx;
......
src/img/eat.png

7.03 KB | W: | H:

src/img/eat.png

1.19 KB | W: | H:

src/img/eat.png
src/img/eat.png
src/img/eat.png
src/img/eat.png
  • 2-up
  • Swipe
  • Onion skin
src/img/female.png

5.69 KB | W: | H:

src/img/female.png

568 Bytes | W: | H:

src/img/female.png
src/img/female.png
src/img/female.png
src/img/female.png
  • 2-up
  • Swipe
  • Onion skin
src/img/wc.png

895 Bytes

<!--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;background-color:white;'> <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>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</view> </view>
</template> </template>
<!-- 添加记录的cell -->
<template name='quantity_cell'> <template name='quantity_cell'>
<view class='kg-flex-row '> <view class='kg-flex-row '>
<view class='g-text-normal-dark'>张小华</view> <view class='g-text-normal-dark'>张小华</view>
...@@ -32,4 +33,48 @@ ...@@ -32,4 +33,48 @@
</view> </view>
</view> </view>
</view> </view>
</template>
<!--
用户信息
输入参数:
userImg:用户图片
sex:性别 f/m (女性/男性)
title:标题
subTitle:副标题
-->
<template name='userInfo'>
<view class='kg-flex-row'>
<image class='kg-user-icon' src='{{userImg}}'></image>
<view class='kg-flex-column' style='margin-left: 16rpx;height: 120rpx;'>
<view class='kg-flex-row'>
<view class='kg-text-title'>{{title}}</view>
<template is="sex" data="{{sex:sex}}"></template>
</view>
<view class='kg-text-normal-gray'>{{subTitle}}</view>
</view>
</view>
</template>
<!--
性别
sex:性别 f/m (女性/男性)
-->
<template name='sex'>
<view class='kg-flex-row'>
<view wx:if="{{sex == 'f'}}">
<image class='kg-sex-icon' src='/src/img/female.png' mode='aspectFit'></image>
</view>
<view wx:elif="{{sex == 'm'}}">
<image class='kg-sex-icon' src='/src/img/male.png' mode='aspectFit'></image>
</view>
</view>
</template>
<!-- 图片+文字 -->
<template name='imgTextView'>
<view class='kg-flex-row'>
<image src='/src/img/{{img}}.png' style='width: 50rpx;height: 40rpx;'></image>
<text class='kg-text-normal-dark' style='margin-left:10rpx'>{{text}}</text>
</view>
</template> </template>
\ No newline at end of file
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