123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <view class="container">
- <view class="Wrap">
- <text class="Wraph1">欢迎使用</text>
- </view>
- <view>
- <text>请选择您的身份开始使用</text>
- </view>
- <!-- 用户部分 -->
- <view class="button-group">
- <up-button type="success" shape="circle" class="button" @click="handleBtn(1)">用户</up-button>
- </view>
- <image src="../static/FRAME.png" style="background-color: red;"></image>
- <image src="../static/img_v3_02le_9fee240d-00fc-4f42-9391-4801b614cb9g.png"
- style="background-color: red; width: 80rpx; height: 60rpx;"></image>
- <!-- 志愿者部分 -->
- <view class="button-group">
- <up-button type="success" shape="circle" class="button" @click="handleBtn(2)">志愿者</up-button>
- </view>
- </view>
- </template>
- <script setup>
- import {
- userOrWorker
- } from '@/api/login';
- import store from "@/store"
- const imagePath1 = '/static/志愿者.png';
- const imagePath2 = '/static/用户.png';
- function handleBtn(userType = 0) { // 默认值 0
- const params = {
- userType: userType // 使用传入的 userType
- };
- // 把 userType 存入本地存储
- uni.setStorageSync('userType', userType);
- userOrWorker(params)
- .then(res => {
- // 重新拉取用户信息,储存本地
- store.dispatch('GetInfo').then(() => {
- uni.reLaunch({
- url: '/pages/index'
- });
- })
- })
- .catch(err => {
- console.error('设置失败:', err);
- });
- }
- </script>
- <style scoped>
- .Wrap {
- left: 0rpx;
- top: 0rpx;
- width: 342rpx;
- height: 80rpx;
- opacity: 1;
- background: rgba(0, 0, 0, 0);
- }
- .Wraph1 {
- font-size: 30rpx;
- font-weight: 400;
- letter-spacing: 0rpx;
- line-height: 36rpx;
- color: rgba(45, 58, 78, 1);
- text-align: center;
- vertical-align: middle;
- }
- </style>
|