当前位置:网站首页>uniapp develops WeChat applet - soft exam brushing applet
uniapp develops WeChat applet - soft exam brushing applet
2022-07-30 23:13:00 【Hel1x】
记录一次基于uniapp的微信小程序开发
前言
Graduation project for the Bachelor of Computer Science and Technology Minor
Finally decided to make a WeChat applet(比较简单)
Brush the direction of the applet
Soft exam content
开发语言
前端uniapp开发
后端django开发
springboot目前不太会,django上手比较快,The back end can be used()
数据库MySQL
框架设计
题库
The question bank is crawled directly from the Internet
传送门: 记录一次爬虫题库
数据库结构
This can be written on several pages,先带过
前端
Refer to the soft test pass
功能实现
刷题部分
Brush question mode selection
分段器
<view class="practice-title">
<u-subsection :list="list" mode="subsection" :current="current" @change="sectionChange"></u-subsection>
</view>
data
list:['答题模式','背题模式'],

The topic slides to display
使用swpier组件遍历questionListThe title display can be realized
<swiper class="swipe-box" @change="dexChange" :current="currentIndex">
<swiper-item skip-hidden-item-layout="true" class="swipe-item" v-for="(item,index) in question" :key="index">
<view class="stem">{
{
item.stem}}</view>
</swiper-item>
</swiper>
title follow
参考了这篇文章
父子组件传参
swpierComponents pass values to parent components
The parent component passes values to the navigation bar component
swiper部分,滑动时会调用dexChangeThe function is passed by value to the parent component
<swiper class="swipe-box" @change="dexChange" :current="currentIndex">
<swiper-item skip-hidden-item-layout="true" class="swipe-item" v-for="(item,index) in question" :key="index">
<view class="stem">{
{
item.stem}}</view>
</swiper-item>
</swiper>
This can be achieved by passing a value to the navigation bar component after the parent component listens
选项显示
The parent component puts eachquestionPassed to the options subcomponent
<view v-for="(option,itemindex) in options" class="ball">
<view class="option-item" :class="{isright:(isRight(option,itemindex)),iserror:(isError(option,itemindex))}" @click="chooseOption(itemindex)" :key="index">
{
{
option.option}}.{
{
option.content}}
</view>
</view>
<view v-if="show" class="analysis">
{
{
item.analysis}}
</view>
Brush the title navigation bar

创建BottomBar组件
<template>
<view class="bomBar-box">
<view class="bomBar">
<view class="left">
<slot name="left"></slot>
</view>
<view class="center">
<slot name="center"></slot>
</view>
<view class="right">
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
export default{
name:"BottomBar",
data(){
return{
}
},
}
</script>
<style scoped lang="scss">
.bomBar-box{
display: flex;
justify-content: space-around;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
box-shadow: 0 0 6rpx #9E9E9E;
z-index: 9;
background-color: white;
}
.bomBar{
width: 90vw;
display: flex;
height: 8vh;
// padding-bottom: 20rpx;
font-size: $uni-font-size-sm;
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
align-items: center;
box-sizing: border-box;
}
.left,.right{
height: 8vh;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: space-around;
width: 30vw;
}
.center{
height: 8vh;
flex:1;
display: flex;
justify-content:space-around;
align-items: center;
}
.page-dark{
-webkit-filter:brightness(20%);
// color: $uni-dark-font;
}
</style>
The main page calls the component
<BottomBar>
<template v-slot:left>
<view v-if="favCompu" class="bom-left" @click="favClick">
<u-icon name="star" size="40rpx" color="#7f7f7f"></u-icon>
<view>
收藏
</view>
</view>
<view v-else class="bom-left" @click="favClick">
<u-icon name="star-fill" size="40rpx" color="#ffea47"></u-icon>
<view>
已收藏
</view>
</view>
</template>
<template v-slot:center>
<view @click="openCard" class="bom-center">
<u-icon name="list" size="42rpx" color="#7f7f7f"></u-icon>
<view class="">
{
{
currentIndex}}/{
{
questionList.length}}
</view>
</view>
</template>
<template v-slot:right>
<view @click="openSet" class="bom-right">
<u-icon name="setting" size="46rpx" color="#7f7f7f"></u-icon>
</view>
</template>
</BottomBar>
目前的UI
错题分析
The function of brushing the navigation bar
使用 uni-popup 组件
The installation process can be found in another article of mine
传送门: uni-ui安装
设置
<uni-popup ref="set">
<view class="set-box">
<view class="set" @longpress="copyID">
Long press to copy the questionID
</view>
<view class="set">
开启自动切换
<u-switch v-model="isLoop"></u-switch>
</view>
<view class="set">
暗色模式
<u-switch v-model="isDark"></u-switch>
</view>
</view>
</uni-popup>
cssNot posted for now
效果图
标页码
收藏
登录部分
缓存部分
后端部分
数据库部分
部署
后记
说简单也不简单,说难也不难
233333
2022-07-25 Hope to graduate soon
未完待续
边栏推荐
- ML's shap: Based on FIFA 2018 Statistics (2018 Russia World Cup) team match star classification prediction data set using RF random forest + calculating SHAP value single-sample force map/dependency c
- #Dasctf July Enabler WP
- 2021GDCPC Guangdong University Student Programming Competition B.Byfibonacci
- 软考学习计划
- 数据清洗-使用es的ingest
- [MySQL] DQL related operations
- 反转链表-头插反转法
- leetcode 406. Queue Reconstruction by Height 根据身高重建队列(中等)
- 反转链表-就地逆置法
- IDEA使用技巧
猜你喜欢

Abstract classes and interfaces (study notes)

CPM:A large-scale generative chinese pre-trained lanuage model

# Dasctf 7月赋能赛 WP

EasyExcel综合课程实战

Week 19 Progress (Understanding IoT Basics)

Learning about XML (1)

2022中国物流产业大会暨企业家高峰论坛在杭州举办!

Chapter 8 Intermediate Shell Tools II

#Dasctf July Enabler WP

MySQL索引常见面试题(2022版)
随机推荐
【MySQL】Mysql事务以及权限管理
第十九周进度(了解物联网基础知识)
Day016 Classes and Objects
【LeetCode】70. 爬楼梯 - Go 语言题解
【MySQL】MySQL中对数据库及表的相关操作
2022.7.28
Reverse linked list - in-place inversion method
PS Basic Learning (1)
一文详解:SRv6 Policy模型、算路及引流
Week 19 Progress (Understanding IoT Basics)
基于 Docker Compose 的 Nacos(MySQL 持久化)的搭建
2022.7.30
Mysql进阶优化篇01——四万字详解数据库性能分析工具(深入、全面、详细,收藏备用)
Golang 切片删除指定元素的几种方法
PyTorch模型导出到ONNX文件示例(LeNet-5)
Go1.18升级功能 - 模糊测试Fuzz 从零开始Go语言
ThinkPHP high imitation blue play cloud network disk system source code / docking easy payment system program
Golang go-redis cluster模式下不断创建新连接,效率下降问题解决
MySQL索引常见面试题(2022版)
leetcode 406. Queue Reconstruction by Height 根据身高重建队列(中等)