【微信小程序】无纸化会议OA系统之首页搭建(下)

简介: 【微信小程序】无纸化会议OA系统之首页搭建(下)

二、首页布局搭建


1.底部页面的搭建

一个微信小程序必不可少的就是底部导航栏,所以我们先搭建一个底部导航栏 ,根据微信小程序的开发者文档可知,底部导航栏需要在api.json定义tabBar并做好相应的配置(注意先在pages做好页面的定义)。

底部导航栏没有图标是显得非常单调的,所以我们还要创建一个文件夹名为static用来存放图片

继续在static文件夹下创建一个文件名为tabBar,将我们所需的图标放入,搭配属性iconPath引用图标即可。

{
  "pages":[
    "pages/index/index",
    "pages/meeting/list/list",
    "pages/vote/list/list",
    "pages/ucenter/index/index",
    "pages/pageOne/pageOne",
    "pages/pageTwo/pageTwo",
    "pages/users/user",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Weixin",
    "navigationBarTextStyle":"black"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页",
      "iconPath": "/static/tabBar/coding.png",
      "selectedIconPath": "/static/tabBar/coding-active.png"
    }, {
      "pagePath": "pages/meeting/list/list",
      "text": "会议",
      "iconPath": "/static/tabBar/sdk.png",
      "selectedIconPath": "/static/tabBar/sdk-active.png"
    }, {
      "pagePath": "pages/vote/list/list",
      "text": "投票",
      "iconPath": "/static/tabBar/template.png",
        "selectedIconPath": "/static/tabBar/template-active.png"
    }
    , {
      "pagePath": "pages/ucenter/index/index",
      "text": "设置",
      "iconPath": "/static/tabBar/component.png",
        "selectedIconPath": "/static/tabBar/component-active.png"
    }]
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}


895c455d038a4d868bc6f3f7d30a71ab.gif


2.首页轮播图搭建


2.1.后端接口管理

轮播图这种资源一定是从数据库来的数据,那么我们怎么通过微信小程序开发获取后端呢?

还是一样看官网,通过官网可知我们发送ajax请求是wx.restartMiniProgram(Object object)

其他的东西还是基本与我们发送ajax请求一致的。

为了后期方便维护我们先将所有的后端接口通过一个文件来保存,在根目录下新建config文件夹随后建立api.js文件。

// 以下是业务服务器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', //会议信息
 };


还是一样先定义本机开发的API地址,具体的请求在下面定义方便管理。


2.2.Mock模拟数据

今天不带大家展示请求后端所以我们利用Mock来制造一些“假数据”来模拟一下。

Mock 的入口在工具调试面板顶部的 Tab,点 + 新建规则

f70c695001d8428381587138e2696876.png

08f3170511774f7281ddcc2f51586948.png

Mock模拟的轮播图数据:

{
  "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.js
// 获取应用实例
const app = getApp()
const api = require("../../config/api")
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
          })
        }
      })
  },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
    this.loadSwiperImgs();
  },
})

index.wxml

<!--index.wxml-->
<view class="myswiper">
  <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>


小贴士:

有一部分的友友可能遇到以下问题: http://localhost:8080 不在以下 request 合法域名列表中

a4bc19759fe64e2eb56657ed2d800c3f.png

因为我们现在的小程序开发默认检查安全证书(域名为https)所以我们的请求过不去,我们只需点击微信小程序开发中的详情按钮,再继续点击本地设置不校验合法域名选项打开。

ad2cf0cfbf0c445198e00b30fb2c63d3.png


3.首页会议信息搭建

我们照猫画虎,和我们轮播图的流程一样,定义接口发送ajax再利用Mock模拟数据根据官网提供的组件进行完善。

<view class="mobi-title">
    <text class="mobi-icon"></text>
    <text>会议信息</text>
</view>
<block wx:for-items="{{lists}}" wx:for-item="item" wx:key="item.id">
    <view class="list" data-id="{{item.id}}">
        <view class="list-img">
            <image class="video-img" mode="scaleToFill" src="{{item.image}}"></image>
        </view>
        <view class="list-detail">
            <view class="list-title"><text>{{item.title}}</text></view>
            <view class="list-tag">
                <view class="state">{{item.state}}</view>
                <view class="join"><text class="list-num">{{item.num}}</text>人报名</view>
            </view>
            <view class="list-info"><text>{{item.location}}</text>|<text>{{item.starttime}}</text></view>
        </view>
    </view>
</block>
<view class="mysection">
    <text>到底啦</text>
</view>


// index.js
// 获取应用实例
const app = getApp()
const api = require("../../config/api")
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
          })
        }
      })
  },
    //首页会议信息的ajax
    loadMeetingInfos(){
      let that=this;
      wx.request({
          url: api.MettingInfos,
          dataType: 'json',
          success(res) {
            console.log(res)
            that.setData({
                lists:res.data.lists
            })
          }
        })
    },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
    this.loadSwiperImgs();
    this.loadMeetingInfos();
  },
})

WXSS

/**index.wxss**/
.swiper-item {
  height: 300rpx;
  width: 100%;
  border-radius: 10rpx;
}
/**index.wxss**/
.myswiper{
  padding:0 0 0 25px;
  }
  .mobi-title{
    background-color: rgb(252, 248, 248);
    margin-left: 5px;
  color: gray;
  font-weight: 600;
  }
  .mobi-icon{
    border-left: red solid 1px ;
    margin-right: 3px;
  }
  .list{
    display: flex;
    border-bottom: rgb(233, 231, 231) solid 3px;
  }
  .list-img{
    display: flex;
    align-items: center;
   margin-right: 15px;
  }
  .video-img{
    width: 120rpx;
    height: 120rpx;
  }
  .list-title{
    font-weight: bold;
  }
  .list-tag{
    display: flex;
  }
  .state{
    border: rgb(35, 171, 224) solid 1px;
    color: rgb(35, 171, 224);
    align-items: center;
    width: 65px;
    display: flex;
    justify-content: center;
  }
  .join{
    margin-left: 8px;
    color: lightgray;
  }
  .list-num{
    color: red;
    font-weight: 600;
  }
  .list-info{
    display: flex;
    color: lightgray;
    margin-top: 10px;
  }
  .mysection{
    display: flex;
    justify-content: center;
  }
  .userinfo {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #aaa;
  }
  .userinfo-avatar {
    overflow: hidden;
    width: 128rpx;
    height: 128rpx;
    margin: 20rpx;
    border-radius: 50%;
  }
  .usermotto {
    margin-top: 200px;
  }


Mock模拟的会议信息数据:

{
  "data": {
    "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": "北京市·朝阳区"
        }
      ]
  },
  "statusCode": "200",
  "header": {
    "content-type":"applicaiton/json;charset=utf-8"
  }
}


效果展示

12aa60d14ac649f5bfcfd02f02ba9007.gif

目录
相关文章
|
2月前
|
运维 小程序 前端开发
结合圈层营销策略,打造稳定可靠的圈子app系统,圈子小程序!
圈子系统是一种社交平台,用户可按兴趣、职业等创建或加入“圈子”,进行内容发布、讨论和资源共享。开发时需考虑需求分析、技术选型(如PHP、MySQL)、页面设计、功能实现(注册、登录、发布、评论等)、测试优化及运维管理。圈层营销则通过精准化、高端化的方式传递品牌信息,增强客户归属感。圈子小程序基于微信等平台,具备跨平台、便捷性和社交性,开发过程中需明确需求、选择技术框架、设计页面并确保稳定性和流畅性。
|
30天前
|
小程序 数据安全/隐私保护
跑腿小程序系统源码
这是一款跑腿小程序,带有智能派单、系统派单、同城配送、校园跑腿、预约取件、用户端+骑手端 基于FastAdmin+thinkphp和uniapp开发的优创同城跑腿系统,支持帮取、帮送模式,包含用户端、骑手端、运营后台。
77 32
|
25天前
|
小程序 前端开发 关系型数据库
基于Uniapp+php校园小程序,校园圈子论坛系统功能,校园跑腿二手交流功能设计
校园圈子论坛及综合服务平台集成了校园跑腿、兼职信息、外卖团购、闲置交换、租赁服务、表白墙等多功能模块,提供一站式校园生活解决方案。系统采用uniapp前端和PHP后端开发,支持多城市、多学校切换,配备分站式后台管理,确保稳定性和安全性。通过融云IM SDK实现即时通讯功能,增强用户互动与粘性。适用于大学校园、城市及社区圈子,满足多样化需求,提升便捷体验。
|
25天前
|
存储 小程序 搜索推荐
打造无缝社交体验:多平台适配,开启线上线下陪玩系统小程序社交新时代
通过实施以上策略和行动计划,可以打造出一个无缝社交体验的多平台陪玩社交系统,为用户提供更加便捷、高效、有趣的社交体验,开启线上线下陪玩系统源码社交的新时代。
53 11
|
30天前
|
存储 监控 小程序
TP6+Uni-app框架下,圈子系统小程序的快速上线开发步骤
社交圈子系统多端运营级应用,融合了推荐匹配、语音聊天、IM即时通讯、动态发布、一键约聊、同城交友、附近的人、充值提现、邀请推广等功能,为平台运营提供更多的盈利变现方式。程序源码开源,支持二次开发,根据客户不同应用场景需求,定制个性化解决方案。
53 9
|
24天前
|
小程序 前端开发 关系型数据库
uniapp跨平台框架,陪玩系统并发性能测试,小程序源码搭建开发解析
多功能一体游戏陪练、语音陪玩系统的开发涉及前期准备、技术选型、系统设计与开发及测试优化。首先,通过目标用户分析和竞品分析明确功能需求,如注册登录、预约匹配、实时语音等。技术选型上,前端采用Uni-app支持多端开发,后端选用PHP框架确保稳定性能,数据库使用MySQL保证数据一致性。系统设计阶段注重UI/UX设计和前后端开发,集成WebSocket实现语音聊天。最后,通过功能、性能和用户体验测试,确保系统的稳定性和用户满意度。
|
1月前
|
移动开发 开发框架 小程序
轻松搭建婚恋交友系统源码,H5/小程序/APP自动适配,智能匹配恋爱交友平台快速落地
婚恋交友系统涵盖在线交友、线下活动、专业服务、社交娱乐等,满足用户多样化需求。系统设计简洁易用,提供实名认证、多注册方式及安全保护,确保用户隐私和数据安全。功能丰富,支持图文展示、筛选匹配、聊天互动、虚拟礼物等,提升互动趣味性。平台可分类管理用户、审核信息、智能推荐,优化用户体验。基于TP6+Uni-app框架,实现跨平台同步,支持二次开发,适应不同市场需求。 [了解更多](https://gitee.com/multi-customer-software/jy)
|
30天前
|
小程序 IDE PHP
圈子源码如何打包生成App小程序/开发一个圈子系统软件所需要的费用体现在哪里?
将PHP源码打包成App的过程涉及多个步骤和技术选择。以圈子源码为例,首先明确需求,确定App功能和目标用户群体,并根据需求开发小程序页面,如用户注册、圈子列表等。源码准备阶段确保源码适用于小程序开发,环境配置需安装IDE(如微信开发者工具)及依赖库。最后在IDE中打包小程序并上传至管理平台,通过审核后发布。费用方面,模板开发成本较低,定制开发则更高,具体取决于需求复杂度和第三方服务费用。
73 0
|
1月前
|
小程序 数据挖掘
圈子系统兴趣讨论群组的创建,社群运营的重要性及策略制定,同城交友app、小程序方式的创新
### 圈子系统与社群运营简介 圈子系统是社交平台中的功能模块,允许用户创建和管理兴趣小组,设置名称、规则等,吸引志同道合者加入。通过浏览不同圈子,用户可以选择感兴趣的群体参与。社群运营则通过对具有共同需求或兴趣的用户进行组织和管理,提升品牌影响力和商业价值。有效的社群运营策略包括明确定位、制定策略、持续输出有价值内容、定期举办活动、合理分配角色及数据监测优化,从而增强用户粘性和活跃度。 **圈子系统源码获取:** [链接](https://gitee.com/multi-customer-software/qz)
|
1月前
|
消息中间件 监控 小程序
电竞陪玩系统架构优化设计,陪玩app如何提升系统稳定性,陪玩小程序平台的测试与监控
电竞陪玩系统架构涵盖前端(React/Vue)、后端(Spring Boot/php)、数据库(MySQL/MongoDB)、实时通信(WebSocket)及其他组件(Redis、RabbitMQ、Nginx)。通过模块化设计、微服务架构和云计算技术优化,提升系统性能与可靠性。同时,加强全面测试、实时监控及故障管理,确保系统稳定运行。

热门文章

最新文章