2023-8-3

底部导航栏--页面切换

  • 为每一个底部按钮添加界面

每个界面包含一下三个文件(直接复制即可)

最终

  •  设置首页index

更改index包下的index.config.js,设置标题名称

 在app.config.js中设置路由

 在底部导航栏的index文件中设置跳转函数

  •  其它三个界面类似上边的操作

轮播图

  • 在首页界面的index中加入轮播图代码
<View className='index'>
      <Swiper
        className='swiper'
        indicatorColor='#999'
        indicatorActiveColor='#333'
        vertical={false}
        circular
        indicatorDots
        autoplay>
        <SwiperItem className='swiper-item'>
          <image src='http://43.139.94.243/images/ban1.jpg'></image>
        </SwiperItem>
        <SwiperItem className='swiper-item'>
          <image src='http://43.139.94.243/images/ban2.jpg'></image>
        </SwiperItem>
        <SwiperItem className='swiper-item'>
          <image src='http://43.139.94.243/images/ban3.jpg'></image>
        </SwiperItem>
      </Swiper>
  •  在index.scss中调整图片样式

  • 效果 

循环生成菜单及对应内容

  • catagory目录下的index.jsx文件

当前数据一级写死,引用了TaroUI组件


import './index.scss'
import TaBar from '../common/index'
import {Text, View} from "@tarojs/components";
import {Component} from "react";
import { AtTabs, AtTabsPane } from 'taro-ui'

export default class Index extends Component{
  
  constructor() {
    super();
    this.state={
      current:0,
      br:'\n',
      firstCategoryArr: [
        {id: 1, title: "手机产品"},
        {id: 2, title: "时尚耳机"},
        {id: 3, title: "MINI相机"},
        {id: 4, title: "电脑硬盘"},
        {id: 5, title: "鼠标键盘"},
        {id: 6, title: "平板电脑"},
        // {id: 7, title: "手机产品"},
        // {id: 8, title: "时尚耳机"},
        // {id: 9, title: "MINI相机"},
        // {id: 10, title: "电脑硬盘"},
        // {id: 11, title: "鼠标键盘"},
        // {id: 12, title: "平板电脑"},
        // {id: 13, title: "手机产品"},
        // {id: 14, title: "时尚耳机"},
        // {id: 15, title: "MINI相机"},
        // {id: 16, title: "电脑硬盘"},
        // {id: 17, title: "鼠标键盘"},
        // {id: 18, title: "平板电脑"},
      ],
      secondCategoryArr: [
        {pId: 1, id: 111, title: "手机产品1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png'},
        {pId: 1, id: 112, title: "手机产品2",img: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png'},
        {pId: 1, id: 113, title: "手机产品3",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
        {pId: 1, id: 115, title: "手机产品4",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
        {pId: 1, id: 116, title: "手机产品5",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
        {pId: 2, id: 211, title: "时尚耳机1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t10660/330/203667368/1672/801735d7/59c85643N31e68303.png'},
        {pId: 2, id: 212, title: "时尚耳机2",img: 'https://img14.360buyimg.com/jdphoto/s72x72_jfs/t17251/336/1311038817/3177/72595a07/5ac44618Na1db7b09.png'},
        {pId: 2, id: 213, title: "时尚耳机3",img: 'https://img30.360buyimg.com/jdphoto/s72x72_jfs/t5770/97/5184449507/2423/294d5f95/595c3b4dNbc6bc95d.png'},
        {pId: 3, id: 311, title: "MINI相机1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png'},
        {pId: 3, id: 312, title: "MINI相机2",img: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png'},
        {pId: 3, id: 313, title: "MINI相机3",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
        {pId: 4, id: 411, title: "电脑硬盘1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t10660/330/203667368/1672/801735d7/59c85643N31e68303.png'},
        {pId: 4, id: 412, title: "电脑硬盘2",img: 'https://img14.360buyimg.com/jdphoto/s72x72_jfs/t17251/336/1311038817/3177/72595a07/5ac44618Na1db7b09.png'},
        {pId: 4, id: 413, title: "电脑硬盘3",img: 'https://img30.360buyimg.com/jdphoto/s72x72_jfs/t5770/97/5184449507/2423/294d5f95/595c3b4dNbc6bc95d.png'},
        {pId: 5, id: 511, title: "鼠标键盘1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png'},
        {pId: 5, id: 512, title: "鼠标键盘2",img: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png'},
        {pId: 5, id: 513, title: "鼠标键盘3",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
        {pId: 6, id: 611, title: "平板电脑1",img: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png'},
        {pId: 6, id: 612, title: "平板电脑2",img: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png'},
        {pId: 6, id: 613, title: "平板电脑3",img: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'},
      ]

    }
  }

  handleClick=(index)=>{
    this.setState({
      current:index
    })
  }

  render() {
    return (
      <View className='catagory'>
        <AtTabs
          current={this.state.current}
          scroll
          animated={false}
          height='250px'
          tabDirection='vertical'
          tabList={this.state.firstCategoryArr}
          onClick={this.handleClick.bind(this)}>
          {
            this.state.firstCategoryArr.map((firstLeveMenu)=>{
              return(
                <AtTabsPane tabDirection='vertical' current={this.state.current} index={0} className='tabsPane'>
                  {
                    this.state.secondCategoryArr.map((secondLeveMenu)=>{
                      //判断二级菜单的pid==一级菜单id
                      if (firstLeveMenu.id==secondLeveMenu.pId){
                        return(
                          <View className='paneContent'>
                            <image src={secondLeveMenu.img} style='height:80px ; width:80px'></image>
                            <Text>{this.state.br}</Text>
                            <Text>{secondLeveMenu.title}</Text>
                          </View>
                        )
                      }
                    })
                  }
                </AtTabsPane>
              )
            })
          }
        </AtTabs>
        <TaBar current={1}></TaBar>
      </View>
    )
  }
}
  • 效果

  •  显示标题以及图片

在catagroy目录下index.scss中

.tabsPane{
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}
.paneContent{
  text-align: center;
  font-size: 30px;
  border: 1px solid #DDDDDD;
  margin-bottom: 20px;
}
  •  效果

后端取到首页的数据

建立数据库

建立后端获取数据库中的数据

建立springBoot项目

 IDEA打开,配置application.properties文件


server.port=9000
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/16ban?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456

mybatis.mapper-locations=classpath:mapper/*Mapper.xml

logging.level.com.example.weappdemo.mapper=DEBUG

将generatorConfig.xml放置于resource目录下,并完成配置

将Generator类置于weappdemo目录下,修改路径

利用Generator函数生成相关文件

 加入统一返回结果类

 增加控制器controller

小程序应用Taro中的request发送请求

官网中request的用法

 url需要用到花生壳

  •  复制域名地址

 对微信开发者工具可能报域名不合法问题

点击“详情”--“本地设置”---勾选“不校验合法域名”

效果

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
data = ['2023-05-10 20:37:49', '2023-05-10 20:37:50', '2023-05-10 20:37:51', '2023-05-10 20:37:52', '2023-05-10 20:37:53', '2023-05-10 20:37:54', '2023-05-10 20:37:55', '2023-05-10 20:37:56', '2023-05-10 20:37:57', '2023-05-10 20:37:58', '2023-05-10 20:37:59', '2023-05-10 20:38:00', '2023-05-10 20:38:01', '2023-05-10 20:38:02', '2023-05-10 20:38:03', '2023-05-10 20:38:04', '2023-05-10 20:38:05', '2023-05-10 20:38:06', '2023-05-10 20:38:07', '2023-05-10 20:38:08', '2023-05-10 20:38:09', '2023-05-10 20:38:10', '2023-05-10 20:38:11', '2023-05-10 20:38:12', '2023-05-10 20:38:13', '2023-05-10 20:38:14', '2023-05-10 20:38:15', '2023-05-10 20:38:16', '2023-05-10 20:38:17', '2023-05-10 20:38:18', '2023-05-10 20:38:19', '2023-05-10 20:38:20', '2023-05-10 20:38:21', '2023-05-10 20:38:22', '2023-05-10 20:38:23', '2023-05-10 20:38:24', '2023-05-10 20:38:25', '2023-05-10 20:38:26', '2023-05-10 20:38:27', '2023-05-10 20:38:28', '2023-05-10 20:59:25', '2023-05-10 20:59:26', '2023-05-10 20:59:27', '2023-05-10 20:59:28', '2023-05-10 20:59:29', '2023-05-10 20:59:30', '2023-05-10 20:59:31', '2023-05-10 20:59:32', '2023-05-10 20:59:33', '2023-05-10 20:59:34', '2023-05-10 20:59:35', '2023-05-10 20:59:36', '2023-05-10 20:59:37', '2023-05-10 20:59:38', '2023-05-10 20:59:39', '2023-05-10 20:59:40', '2023-05-10 20:59:41', '2023-05-10 20:59:42', '2023-05-10 20:59:43', '2023-05-10 20:59:44', '2023-05-10 20:59:45', '2023-05-10 20:59:46', '2023-05-10 20:59:47', '2023-05-10 20:59:48', '2023-05-10 20:59:49', '2023-05-10 20:59:50', '2023-05-10 20:59:51', '2023-05-10 20:59:52', '2023-05-10 20:59:53', '2023-05-10 20:59:54', '2023-05-10 20:59:55', '2023-05-10 20:59:56', '2023-05-10 20:59:57', '2023-05-10 20:59:58', '2023-05-10 20:59:59', '2023-05-10 21:00:00'] 在data里面我想筛选出2023-05-09 18:04:13到2023-05-09 23:47:24之前的数据也包括2023-05-09 18:04:13和2023-05-09 23:47:24该怎么做
05-25

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值