项目模块—实现抑郁测评(小程序)

script

html 复制代码
<script setup>
import { ref } from "vue";

//控制轮播图页码
let current = ref(0);

//答题逻辑
const add = (value) => {
  if (current.value < 9) {
    current.value = current.value + 1;
  } else {
    uni.switchTab({
      url: "/pages/my/my",
    });
  }
};
</script>

<template>

html 复制代码
<template>
  <view class="box">
    <view class="nar">
      <!-- 利用uview-plus插件中的线性进度条来实现功能 -->
      <u-icon name="arrow-left" color="#000000" size="24"></u-icon>
      <!-- 文字 -->
      <text>抑郁测评专业版</text>
    </view>
    <view>
        <!--利用轮播图实现-->
      <swiper duration="0" :current="current" style="height: 500px">
        <template v-for="(item1, index) in 10">
          <swiper-item @touchmove.stop="" class="swiper">
            <!-- 进度条 -->
            <view class="jindu">
              <text>测评进度</text>
              <view class="progress"
                ><u-line-progress
                  :showText="false"
                  :percentage="(index + 1) * 10"
                  activeColor="#2d8dfe"
                ></u-line-progress
              ></view>
              <text>{{ index + 1 }}/10</text>
            </view>
            <!-- 题目 -->
            <view class="topic">
              <view class="text"
                >你是否经常感到心情低落,或是感到心情郁闷?生活,前景?</view
              >
            </view>
            <!-- 选项 -->
            <view class="options">
              <!-- title -->
              <view class="title"
                ><u-tag text="单选题" type="primary" shape="circle"></u-tag
              ></view>
              <!-- 选项 -->
              <template v-for="item in 4">
                <view @click="add()" class="option"
                  ><view class="text">完全不会</view></view
                >
              </template>
            </view>
          </swiper-item>
        </template>
      </swiper>
    </view>
  </view>
</template>

style

html 复制代码
<style lang="scss" scoped>
.box {
  height: 100vh;
  background: linear-gradient(to bottom, #b6cff3, #f5ecf4);
  .nar {
    padding-top: 40rpx;
    padding-bottom: 40rpx;
    height: 80rpx;
    width: 460rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 20rpx;
    padding-right: 20rpx;
  }
}
//进度样式
.jindu {
  padding-left: 20rpx;
  padding-right: 20rpx;
  padding-top: 20rpx;
  display: flex;
  height: 32rpx;
  align-items: center;
  justify-content: space-between;
  //进度条
  .progress {
    width: 460rpx;
  }
}
//题目样式
.topic {
  background-color: white;
  height: 130rpx;
  margin-left: 20rpx;
  margin-right: 20rpx;
  margin-top: 60rpx;
  border-radius: 10rpx;
  .text {
    padding: 18rpx;
  }
}

//选项样式
.options {
  margin-top: 40rpx;
  margin-left: 20rpx;
  margin-right: 20rpx;
  background-color: #f0eaf4;
  border-radius: 10rpx;
  height: 700rpx;
  //标签title
  .title {
    width: 130rpx;
    padding: 16rpx;
  }
  //具体选项
  .option {
    margin: 16rpx;
    margin-top: 24rpx;
    background-color: #ffffff;
    height: 100rpx;
    border-radius: 10rpx;
    display: flex;
    align-items: center;
    .text {
      padding-left: 16rpx;
    }
  }
  :active.option {
    background-color: #ebf4ff;
    color: #52a2ff;
  }
}
</style>

效果:

相关推荐
道友可好6 分钟前
3 个人,100 万行代码,一行都没人写:OpenAI 的 Harness Engineering 实验
前端·人工智能·后端
W_LuYi18515 分钟前
Tauri + Rust + Vue 3 打造极速轻量桌面应用
java·开发语言·vue.js·rust
winfredzhang22 分钟前
用 Node.js + SQLite + 原生前端写一个本地情绪急救 Web App:情绪降落伞 Mood Parachute
前端·sqlite·node.js·express·情绪管理
qq43569470130 分钟前
Vue03
javascript·vue.js
樱花的浪漫42 分钟前
Typescript、Zod基础
前端·javascript·人工智能·语言模型·自然语言处理·typescript
Bigger1 小时前
记一次坑爹的 Cloudflare Pages 部署:Failed to load module script 是怎么把我的 SPA 搞挂的
前端·ci/cd·浏览器
用户549591657501 小时前
TinyVue Tree树形控件完全指南
vue.js
竹林8181 小时前
监听智能合约事件,我用 wagmi v2 踩了三天坑,终于找到了稳定方案
前端·javascript
星栈1 小时前
Makepad 界面怎么做得更像产品,而不是示例
前端·rust
用户852495071841 小时前
Bun 到底是什么?一个比 Node.js "更快更香"的 JS 运行时
javascript·程序员