0
点赞
收藏
分享

微信扫一扫

使用微信小程序编写会议OA项目-首页

南柯Taylor 2023-10-17 阅读 8


目录

一.什么是flwx布局

二.flex属性 

三.轮播图后台数据获取及组件使用 

四.首页布局 


一.什么是flwx布局

 

 "pages":[
    "pages/index/index",
    "pages/meeting/list/list",
    "pages/vote/list/list",
    "pages/ucenter/index/index",
    "pages/logs/logs"
  ],
"tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页",
      "iconPath": "/static/tabBar/coding.png",
      "selectedIconPath": "/static/tabBar/coding-active.png"
    },
      {
        "pagePath": "pages/meeting/list/list",
        "iconPath": "/static/tabBar/sdk.png",
        "selectedIconPath": "/static/tabBar/sdk-active.png",
        "text": "会议"
      },
      {
        "pagePath": "pages/vote/list/list",
        "iconPath": "/static/tabBar/template.png",
        "selectedIconPath": "/static/tabBar/template-active.png",
        "text": "投票"
      },
      {
        "pagePath": "pages/ucenter/index/index",
        "iconPath": "/static/tabBar/component.png",
        "selectedIconPath": "/static/tabBar/component-active.png",
        "text": "设置"
      }]
  },

 

<!--pages/vote/list/list.wxml-->
<!-- <text>pages/vote/list/list.wxml</text> -->
<!-- 投票管理 -->
<view class="box">
  <view>1</view>
<view>2</view>
<view>3</view>
<view>4</view>
<view>5</view>
<view>6</view>
<view>7</view>
<view>8</view>
<view>9</view>
<view>10</view>
<view>11</view>
<view>12</view>
</view>
/* pages/vote/list/list.wxss */
.box{
  height: 750rpx;
  width: 750rpx;
  background-color: aqua;
  display: flex;
  /* flex-direction: column; */
  /* flex-direction: column-reverse; */
  flex-wrap: wrap;
  /* flex-flow: row wrap; */
  /* justify-content: flex-end; */
  /* align-items: flex-end; */
}
view{
  height: 100rpx;
  width: 100rpx;
  border: 1px solid red;
}

 

二.flex属性 

 

 

 

 

三.轮播图后台数据获取及组件使用 

// 以下是业务服务器API地址
 // 本机开发API地址
 var WxApiRoot = 'http://localhost:8080/demo/wx/';
 // 测试环境部署api地址
 // var WxApiRoot = 'http://192.168.0.101:8070/demo/wx/';
 // 线上平台api地址
 //var WxApiRoot = 'https://www.oa-mini.com/demo/wx/';
 
 module.exports = {
   IndexUrl: WxApiRoot + 'home/index', //首页数据接口
   SwiperImgs: WxApiRoot+'swiperImgs', //轮播图
   MettingInfos: WxApiRoot+'meeting/list', //会议信息
 };
// 获取应用实例
const app = getApp()
const api=require("../../config/app.js")
Page({
  data: {
   imgSrcs:[]
  },
 loadSwiperImgs(){
    let that=this;
    wx.request({
        url: api.SwiperImgs,
        dataType: 'json',
        success(res) {
          console.log(res)
          that.setData({
              imgSrcs:res.data.images
          })
        }
      })
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
    this.loadSwiperImgs();
  },

 

 

{
  "data": {
    "images":[
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner1.png",
    "text": "1"
  },
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner2.png",
    "text": "2"
  },
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner3.png",
    "text": "3"
  },
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner4.png",
    "text": "4"
  },
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner5.png",
    "text": "5"
  },
  {
    "img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner6.png",
    "text": "6"
  }
]
  },
  "statusCode": "200",
  "header": {
    "content-type":"applicaiton/json;charset=utf-8"
  }
}
<!--index.wxml-->
<view>
  <swiper indicator-dots="true" autoplay="true" >
        <block wx:for="{{imgSrcs}}" wx:key="*text">
          <swiper-item>
            <image src=" {{item.img}}"></image>
          </swiper-item>
        </block>
      </swiper>
</view>

四.首页布局 

lists:[
    {
      "id": "1",
      "image": "/static/persons/1.jpg",
      "title": "对话产品总监 | 深圳·北京PM大会 【深度对话小米/京东/等产品总监】",
      "num":"304",
      "state":"进行中",
      "starttime": "2022-03-13 00:00:00",
      "location": "深圳市·南山区"
    },
    {
      "id": "1",
      "image": "/static/persons/2.jpg",
      "title": "AI WORLD 2016世界人工智能大会",
      "num":"380",
      "state":"已结束",
      "starttime": "2022-03-15 00:00:00",
      "location": "北京市·朝阳区"
    },
    {
      "id": "1",
      "image": "/static/persons/3.jpg",
      "title": "H100太空商业大会",
      "num":"500",
      "state":"进行中",
      "starttime": "2022-03-13 00:00:00",
      "location": "大连市"
    },
    {
      "id": "1",
      "image": "/static/persons/4.jpg",
      "title": "报名年度盛事,大咖云集!2016凤凰国际论坛邀您“与世界对话”",
      "num":"150",
      "state":"已结束",
      "starttime": "2022-03-13 00:00:00",
      "location": "北京市·朝阳区"
    },
    {
      "id": "1",
      "image": "/static/persons/5.jpg",
      "title": "新质生活 · 品质时代 2016消费升级创新大会",
      "num":"217",
      "state":"进行中",
      "starttime": "2022-03-13 00:00:00",
      "location": "北京市·朝阳区"
    }
  ]
<view class="list-info"><text>{{item.address}}</text>|<text>{{item.time}}</text></view>
 <view class="list-info"><text>{{item.location}}</text>|<text>{{item.starttime}}</text></view>
/**index.wxss**/
.mobi-title{
  background-color: green;
  padding: 10px;
}
.mobi-icon{
  border: 1rpx solid red;
  margin-right: 5px;
}
.mobi-title text{
  font-weight: 700;
  color: aqua;
}
.list{
 display: flex;
 align-items: center;
 /* background-color: yellowgreen; */
 border-bottom: 3px solid yellowgreen;
}
.list-img{
padding: 0 10px;
}
.video-img{
  height: 80px;
  width: 80px;
}
.list-detail{

}
.list-title{
font-weight: 700;
margin: 3px 0;
}
.list-tag{
display: flex;
align-items: center;
}
.state{
border: 2px solid red;
padding: 3px 6px;
color: red;
margin:0   5px 10px 0;
}
.join{
color: yellowgreen;
}
.list-num{
  color: aqua;
  font-weight: 700;
}
.list-info{
  color: yellowgreen;
  font-size: 12px;
}

 

 

 

举报

相关推荐

0 条评论