• 微信小程序会议OA系统


    Flex弹性布局

    Flex弹性布局是一种 CSS3 的布局模式,也叫Flexbox。它可以让容器中的元素按一定比例自动分配空间,使得它们在不同宽度、高度等情况下仍能保持整齐和密集不间隙地排列。

    在使用Flexbox弹性布局时,首先需要创建一个容器和若干个子元素。容器的属性display需要设置为flex或inline-flex以启用Flexbox布局。而子元素的属性则需要使用弹性属性,如flex-grow、flex-shrink、flex-basis等来控制它们的自适应性和布局方式。

    Flexbox弹性布局的优点在于它可以轻松处理不同屏幕尺寸和方向的布局问题,使得网页设计更加灵活和自适应。同时,它也可以很好地结合其他CSS属性和技术,如媒体查询、响应式图片等,来实现更加丰富和复杂的网页设计效果。

    Flexbox

    布局的语法网站:https://www.runoob.com/w3cnote/flex-grammar.html

    Flexbox提供了一系列的CSS属性,用于控制容器和项目的行为。以下是一些常用的属性:

    1. display: 定义一个容器是flex或inline-flex布局。

    2. justify-content: 用来定义项目在主轴上的对齐方式,可以设置的值包括:flex-start, flex-end, center, space-between, space-around。

    3. align-items: 用来定义项目在交叉轴上的对齐方式,可以设置的值包括:flex-start, flex-end, center, baseline, stretch。

    4. flex-direction: 用来定义主轴的方向,可以设置的值包括:row, row-reverse, column, column-reverse。

    5. flex-wrap: 用来定义多行排列时,是否换行,可以设置的值包括:nowrap, wrap, wrap-reverse。

    6. align-content: 用来定义多行排列间的对齐方式,可以设置的值包括:flex-start, flex-end, center, space-between, space-around, stretch。

    7. flex: 项目的综合属性,包括flex-grow, flex-shrink, flex-basis三个属性,用来控制项目在容器中的尺寸和自适应性。

    除了以上属性外,Flexbox还提供了一些其他的属性,如order、align-self、flex-flow等,用于更加细致地控制项目的排列和布局。

    图片解析:

    Flex弹性布局具有以下特点:

    1. 容器内的项目可以沿着主轴和交叉轴自由排列,控制项目的排列和布局非常灵活。

    2. 容器的尺寸可以根据其中的项目自适应变化,适用于响应式设计。

    3. 可以控制项目在主轴和交叉轴上的对齐方式,适用于排版和布局。

    4. 可以通过简单的属性和值的组合实现复杂的布局。

    5. 支持多行排列,可以用来实现栅格布局等网页布局方案。

    6. 可以通过flex-grow、flex-shrink、flex-basis等属性控制项目的尺寸和自适应性。

    总之,Flex弹性布局是现代网页设计中非常流行的一种布局方式,具有强大的控制能力和灵活的布局特性,可以帮助开发者实现各种复杂的排版和布局需求。

    flex-wrap属性

    nowrap(默认):不换行。

    wrap:换行,第一行在上方。

    wrap-reverse:换行,第一行在下方。

    代码如下
    list.wxss
    1. /* pages/vote/list/list.wxss */
    2. .box{
    3. height: 750rpx;
    4. width: 750rpx;
    5. background-color: aquamarine;
    6. display: flex;
    7. /* flex-direction: column-reverse; */
    8. flex-wrap: wrap;
    9. /* flex-flow: row wrap; */
    10. /* justify-content: flex-end; */
    11. align-items: flex-end;
    12. }
    13. view{
    14. height: 180rpx;
    15. width: 100rpx;
    16. border: 1px solid red;
    17. }

     OA会议首页

    点击我们的Shift+Alt+R,选择我们的显示资源管理器,将我们的static静态资源复制到存放代码的区间中

    app.json
    1. {
    2. "pages": [
    3. "pages/index/index",
    4. "pages/meeting/list/list",
    5. "pages/vote/list/list",
    6. "pages/ucenter/index/index",
    7. "pages/logs/logs"
    8. ],
    9. "window": {
    10. "backgroundTextStyle": "light",
    11. "navigationBarBackgroundColor": "#fff",
    12. "navigationBarTitleText": "Weixin",
    13. "navigationBarTextStyle": "black"
    14. },
    15. "tabBar": {
    16. "list": [
    17. {
    18. "pagePath": "pages/index/index",
    19. "text": "首页",
    20. "iconPath": "/static/tabBar/coding.png",
    21. "selectedIconPath": "/static/tabBar/coding-active.png"
    22. },
    23. {
    24. "pagePath": "pages/meeting/list/list",
    25. "iconPath": "/static/tabBar/sdk.png",
    26. "selectedIconPath": "/static/tabBar/sdk-active.png",
    27. "text": "会议"
    28. },
    29. {
    30. "pagePath": "pages/vote/list/list",
    31. "iconPath": "/static/tabBar/template.png",
    32. "selectedIconPath": "/static/tabBar/template-active.png",
    33. "text": "投票"
    34. },
    35. {
    36. "pagePath": "pages/ucenter/index/index",
    37. "iconPath": "/static/tabBar/component.png",
    38. "selectedIconPath": "/static/tabBar/component-active.png",
    39. "text": "设置"
    40. }
    41. ]
    42. },
    43. "style": "v2",
    44. "sitemapLocation": "sitemap.json"
    45. }
    index.js 
    1. // 获取应用实例
    2. const api = require("../../config/api")
    3. // pages/meeting/list/list.js
    4. Page({
    5. /**
    6. * 页面的初始数据
    7. */
    8. data: {
    9. imgSrcs:[]
    10. ,lists: [
    11. {
    12. "id": "1",
    13. "image": "/static/persons/1.jpg",
    14. "title": "对话产品总监 | 深圳·北京PM大会 【深度对话小米/京东/等产品总监】",
    15. "num":"304",
    16. "state":"进行中",
    17. "starttime": "2022-03-13 00:00:00",
    18. "location": "深圳市·南山区"
    19. },
    20. {
    21. "id": "1",
    22. "image": "/static/persons/2.jpg",
    23. "title": "AI WORLD 2016世界人工智能大会",
    24. "num":"380",
    25. "state":"已结束",
    26. "starttime": "2022-03-15 00:00:00",
    27. "location": "北京市·朝阳区"
    28. },
    29. {
    30. "id": "1",
    31. "image": "/static/persons/3.jpg",
    32. "title": "H100太空商业大会",
    33. "num":"500",
    34. "state":"进行中",
    35. "starttime": "2022-03-13 00:00:00",
    36. "location": "大连市"
    37. },
    38. {
    39. "id": "1",
    40. "image": "/static/persons/4.jpg",
    41. "title": "报名年度盛事,大咖云集!2016凤凰国际论坛邀您“与世界对话”",
    42. "num":"150",
    43. "state":"已结束",
    44. "starttime": "2022-03-13 00:00:00",
    45. "location": "北京市·朝阳区"
    46. },
    47. {
    48. "id": "1",
    49. "image": "/static/persons/5.jpg",
    50. "title": "新质生活 · 品质时代 2016消费升级创新大会",
    51. "num":"217",
    52. "state":"进行中",
    53. "starttime": "2022-03-13 00:00:00",
    54. "location": "北京市·朝阳区"
    55. }
    56. ]
    57. },
    58. /**
    59. * 生命周期函数--监听页面加载
    60. */
    61. onLoad(options) {
    62. this.loadSwiperImgs()
    63. },
    64. /**
    65. * 生命周期函数--监听页面初次渲染完成
    66. */
    67. onReady() {
    68. },
    69. /**
    70. * 生命周期函数--监听页面显示
    71. */
    72. onShow() {
    73. },
    74. /**
    75. * 生命周期函数--监听页面隐藏
    76. */
    77. onHide() {
    78. },
    79. /**
    80. * 生命周期函数--监听页面卸载
    81. */
    82. onUnload() {
    83. },
    84. /**
    85. * 页面相关事件处理函数--监听用户下拉动作
    86. */
    87. onPullDownRefresh() {
    88. },
    89. /**
    90. * 页面上拉触底事件的处理函数
    91. */
    92. onReachBottom() {
    93. },
    94. /**
    95. * 用户点击右上角分享
    96. */
    97. onShareAppMessage() {
    98. },
    99. loadSwiperImgs(){
    100. let that=this;
    101. wx.request({
    102. url: api.SwiperImgs,
    103. dataType: 'json',
    104. success(res) {
    105. console.log(res)
    106. that.setData({
    107. imgSrcs:res.data.images
    108. })
    109. }
    110. })
    111. }
    112. })
     index.wxml
    1. <!--index.wxml-->
    2. <view>
    3. <swiper autoplay="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="#00f">
    4. <block wx:for="{{imgSrcs}}" wx:key="text">
    5. <swiper-item>
    6. <view>
    7. <image src="{{item.img}}" class="swiper-item" />
    8. </view>
    9. </swiper-item>
    10. </block>
    11. </swiper>
    12. </view>
    13. <view class="mobi-title">
    14. <text class="mobi-icon"></text>
    15. <text>会议信息</text>
    16. </view>
    17. <block wx:for-items="{{lists}}" wx:for-item="item" wx:key="item.id">
    18. <view class="list" data-id="{{item.id}}">
    19. <view class="list-img">
    20. <image class="video-img" mode="scaleToFill" src="{{item.image}}"></image>
    21. </view>
    22. <view class="list-detail">
    23. <view class="list-title"><text>{{item.title}}</text></view>
    24. <view class="list-tag">
    25. <view class="state">{{item.state}}</view>
    26. <view class="join"><text class="list-num">{{item.num}}</text>人报名</view>
    27. </view>
    28. <view class="list-info"><text>{{item.location}}</text>|<text>{{item.starttime}}</text></view>
    29. </view>
    30. </view>
    31. </block>
    32. <view class="section bottom-line">
    33. <text>到底啦</text>
    34. </view>

     JSON
    1. {
    2. "data": {
    3. "images":[
    4. {
    5. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner1.png",
    6. "text": "1"
    7. },
    8. {
    9. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner2.png",
    10. "text": "2"
    11. },
    12. {
    13. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner3.png",
    14. "text": "3"
    15. },
    16. {
    17. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner4.png",
    18. "text": "4"
    19. },
    20. {
    21. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner5.png",
    22. "text": "5"
    23. },
    24. {
    25. "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner6.png",
    26. "text": "6"
    27. }
    28. ]
    29. },
    30. "statusCode": "200",
    31. "header": {
    32. "content-type":"applicaiton/json;charset=utf-8"
    33. }
    34. }
     index.wxss
    1. page{
    2. height: 100%;
    3. background-color:#efeff4;
    4. }
    5. .swiper-item {
    6. height: 350rpx;
    7. width: 100%;
    8. border-radius: 10rpx;
    9. }
    10. .mobi-title{
    11. font-size: 18px;
    12. margin: 10rpx;
    13. }
    14. .mobi-icon{
    15. background-color: red;
    16. padding: 3rpx;
    17. }
    18. .mobi-title text{
    19. margin-left: 10rpx;
    20. }
    21. .list{
    22. background-color: #fff;
    23. display: flex;
    24. margin:10rpx;
    25. padding:10rpx;
    26. }
    27. .list-img,.video-img{
    28. height: 150rpx;
    29. width: 150rpx;
    30. }
    31. .list-img{
    32. margin:30rpx 0 0 0 ;
    33. }
    34. .list-detail{
    35. margin:0 0 0 10rpx;
    36. }
    37. .list-title{
    38. font-weight: 700;
    39. }
    40. .list-tag{
    41. display: flex;
    42. margin: 10px 0 ;
    43. }
    44. .state{
    45. border: 3px solid lightblue;
    46. padding: 2px;
    47. color: lightblue;
    48. }
    49. .join{
    50. border: 3px solid #fff;
    51. padding: 2px;
    52. margin: 0 0 0 20rpx;
    53. color:gray;
    54. }
    55. .list-num{
    56. color: red;
    57. }
    58. .list-info{
    59. color:gray;
    60. }
    61. .bottom-line{
    62. text-align: center;
    63. margin-bottom: 10px;
    64. }

  • 相关阅读:
    【生日快乐】SpringBoot SpringBoot 基础篇(第一篇) 第4章 SpringBoot 综合案例 4.5 查询客户
    Java程序保存文件时,不允许包含以下内容【 \ \ / : * ? “ <>| 】
    FLASH存储器又称闪存,主要有两种:NorFlash和NandFlash、linux系统flash分区注意事项及制作脚本
    LCR 042.最近的请求次数
    神经网络是一种算法吗,神经网络包括哪些算法
    从发现问题到创造价值 数据智能如何助力商家双11高质量增长?
    Java.lang.Class类 isPrimitive()方法有什么功能呢?
    【AGC】通过AGC认证服务在Android平台实现华为账号登录功能
    Linux 串口应用编程
    DOM节点介绍及获取节点的方式
  • 原文地址:https://blog.csdn.net/djssubddbj/article/details/133895170