当前位置:网站首页>uniapp开发微信小程序-软考刷题小程序
uniapp开发微信小程序-软考刷题小程序
2022-07-30 23:11:00 【Hel1x】
记录一次基于uniapp的微信小程序开发
前言
计算机科学与技术辅修学士的毕业设计
最终决定做微信小程序(比较简单)
刷题小程序方向
软考内容
开发语言
前端uniapp开发
后端django开发
springboot目前不太会,django上手比较快,后端能用就行()
数据库MySQL
框架设计
题库
题库直接从网上爬取
传送门: 记录一次爬虫题库
数据库结构
这个要写可以写好几页,先带过
前端
参考了软考通
功能实现
刷题部分
刷题模式选择
分段器
<view class="practice-title">
<u-subsection :list="list" mode="subsection" :current="current" @change="sectionChange"></u-subsection>
</view>
data
list:['答题模式','背题模式'],
题目滑动显示
使用swpier组件遍历questionList即可实现题目显示
<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>
题号跟随
参考了这篇文章
父子组件传参
swpier组件传值给父组件
父组件传值给导航栏组件
swiper部分,滑动时会调用dexChange函数传值给父组件
<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>
父组件监听后传值给导航栏组件即可实现
选项显示
父组件把每个question传给选项子组件
<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>
刷题导航栏
创建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>
主页面调用组件
<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
错题分析
刷题导航栏功能
使用 uni-popup 组件
安装过程可见本人另外一文
传送门: uni-ui安装
设置
<uni-popup ref="set">
<view class="set-box">
<view class="set" @longpress="copyID">
长按复制该题ID
</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>
css暂时不贴出
效果图
标页码
收藏
登录部分
缓存部分
后端部分
数据库部分
部署
后记
说简单也不简单,说难也不难
233333
2022-07-25 希望早日毕业
未完待续
边栏推荐
- $\text{ARC 145}$
- Successfully resolved ModuleNotFoundError: No module named 'Image'
- [MySQL] Related operations on databases and tables in MySQL
- proemthues 服务发现配置
- HF2022-EzPHP复现
- Go语学习笔记 - gorm使用 - 事务操作 Web框架Gin(十一)
- 2022.7.28
- Go1.18升级功能 - 泛型 从零开始Go语言
- "NIO Cup" 2022 Nioke Summer Multi-School Training Camp 4 DHKLN
- 2sk2225 Substitute 3A/1500V Chinese Documentation【PDF Data Book】
猜你喜欢
随机推荐
【无标题】
mysql跨库关联查询(dblink)
2022.7.28
2022 Nioke Summer Multi-School Training Camp 1 J Serval and Essay
CPM:A large-scale generative chinese pre-trained lanuage model
Go的Gin框架学习
StoneDB 为何敢称业界唯一开源的 MySQL 原生 HTAP 数据库?
Excel basic study notes
A detailed explanation: SRv6 Policy model, calculation and drainage
第十九周进度(了解物联网基础知识)
Apache Doris series: detailed steps for installation and deployment
"Wei cup" school more than 2022 cattle summer camp 4 L.B lack Hole, computational geometry
ZZULIOJ: 1120: the most value to exchange
二进制序列
Py's pdpbox: a detailed introduction to pdpbox, installation, and case application
2022牛客暑期多校训练营1 J Serval and Essay
关于XML的学习(一)
language code table
grub learning
10 个关于自动化发布管理的好处