|
@@ -6,24 +6,24 @@
|
|
|
<view class="w-20 h-20 bg-primary rounded-2xl flex items-center justify-center mb-4 mx-auto shadow-card">
|
|
<view class="w-20 h-20 bg-primary rounded-2xl flex items-center justify-center mb-4 mx-auto shadow-card">
|
|
|
<text class="text-3xl font-bold text-white">清</text>
|
|
<text class="text-3xl font-bold text-white">清</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <text class="text-gray-800 text-2xl font-bold">清道夫系统</text>
|
|
|
|
|
|
|
+ <text class="text-gray-800 text-2xl font-bold">绿水青山</text>
|
|
|
<text class="text-gray-500 text-sm mt-2 block">环境服务管理平台</text>
|
|
<text class="text-gray-500 text-sm mt-2 block">环境服务管理平台</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 角色选择 -->
|
|
<!-- 角色选择 -->
|
|
|
- <view class="w-full mb-4">
|
|
|
|
|
- <view class="flex bg-surface rounded-xl p-1 border border-gray-200">
|
|
|
|
|
- <view
|
|
|
|
|
- v-for="item in roleOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- class="flex-1 py-2 text-center text-sm font-medium rounded-lg transition-all"
|
|
|
|
|
- :class="selectedRole === item.value ? 'bg-primary text-white shadow-card' : 'text-gray-500'"
|
|
|
|
|
- @click="selectedRole = item.value"
|
|
|
|
|
- >
|
|
|
|
|
- {{ item.label }}
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+<!-- <view class="w-full mb-4">-->
|
|
|
|
|
+<!-- <view class="flex bg-surface rounded-xl p-1 border border-gray-200">-->
|
|
|
|
|
+<!-- <view-->
|
|
|
|
|
+<!-- v-for="item in roleOptions"-->
|
|
|
|
|
+<!-- :key="item.value"-->
|
|
|
|
|
+<!-- class="flex-1 py-2 text-center text-sm font-medium rounded-lg transition-all"-->
|
|
|
|
|
+<!-- :class="selectedRole === item.value ? 'bg-primary text-white shadow-card' : 'text-gray-500'"-->
|
|
|
|
|
+<!-- @click="selectedRole = item.value"-->
|
|
|
|
|
+<!-- >-->
|
|
|
|
|
+<!-- {{ item.label }}-->
|
|
|
|
|
+<!-- </view>-->
|
|
|
|
|
+<!-- </view>-->
|
|
|
|
|
+<!-- </view>-->
|
|
|
|
|
|
|
|
<!-- 登录表单 -->
|
|
<!-- 登录表单 -->
|
|
|
<view class="w-full bg-white rounded-2xl p-6 shadow-card border border-gray-200">
|
|
<view class="w-full bg-white rounded-2xl p-6 shadow-card border border-gray-200">
|
|
@@ -33,10 +33,10 @@
|
|
|
<!-- 用户名 -->
|
|
<!-- 用户名 -->
|
|
|
<view>
|
|
<view>
|
|
|
<text class="text-sm text-gray-500 block mb-2">用户名</text>
|
|
<text class="text-sm text-gray-500 block mb-2">用户名</text>
|
|
|
- <view class="flex items-center bg-surface rounded-xl px-3 py-3 border border-gray-200">
|
|
|
|
|
- <text class="text-gray-400 mr-2"></text>
|
|
|
|
|
|
|
+ <view class="flex items-center bg-surface rounded-xl px-3 border border-gray-200 login-input-wrap">
|
|
|
|
|
+ <text class="uni-icons uniui-person text-gray-400 mr-2"></text>
|
|
|
<input
|
|
<input
|
|
|
- class="flex-1 bg-transparent text-sm text-gray-800"
|
|
|
|
|
|
|
+ class="flex-1 login-input"
|
|
|
placeholder="请输入用户名"
|
|
placeholder="请输入用户名"
|
|
|
v-model="form.username"
|
|
v-model="form.username"
|
|
|
/>
|
|
/>
|
|
@@ -46,10 +46,10 @@
|
|
|
<!-- 密码 -->
|
|
<!-- 密码 -->
|
|
|
<view>
|
|
<view>
|
|
|
<text class="text-sm text-gray-500 block mb-2">密码</text>
|
|
<text class="text-sm text-gray-500 block mb-2">密码</text>
|
|
|
- <view class="flex items-center bg-surface rounded-xl px-3 py-3 border border-gray-200">
|
|
|
|
|
- <text class="text-gray-400 mr-2"></text>
|
|
|
|
|
|
|
+ <view class="flex items-center bg-surface rounded-xl px-3 border border-gray-200 login-input-wrap">
|
|
|
|
|
+ <text class="uni-icons uniui-locked text-gray-400 mr-2"></text>
|
|
|
<input
|
|
<input
|
|
|
- class="flex-1 bg-transparent text-sm text-gray-800"
|
|
|
|
|
|
|
+ class="flex-1 login-input"
|
|
|
placeholder="请输入密码"
|
|
placeholder="请输入密码"
|
|
|
type="password"
|
|
type="password"
|
|
|
v-model="form.password"
|
|
v-model="form.password"
|
|
@@ -81,7 +81,6 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import { ref, computed, onMounted } from 'vue'
|
|
|
import { useAuthStore } from '../../stores/auth'
|
|
import { useAuthStore } from '../../stores/auth'
|
|
|
-import { showToast } from '../../utils'
|
|
|
|
|
|
|
|
|
|
const authStore = useAuthStore()
|
|
const authStore = useAuthStore()
|
|
|
|
|
|
|
@@ -118,10 +117,11 @@ async function handleLogin() {
|
|
|
|
|
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
try {
|
|
try {
|
|
|
- await authStore.doLogin(form.value.username, form.value.password, selectedRole.value)
|
|
|
|
|
|
|
+ await authStore.doLogin(form.value.username, form.value.password)
|
|
|
uni.switchTab({ url: '/pages/home/home' })
|
|
uni.switchTab({ url: '/pages/home/home' })
|
|
|
} catch (error: any) {
|
|
} catch (error: any) {
|
|
|
- showToast({ title: error.message || '登录失败', icon: 'error' })
|
|
|
|
|
|
|
+ // 请求封装已统一弹出 toast,这里避免重复提示
|
|
|
|
|
+ console.error('登录失败', error)
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
}
|
|
}
|
|
@@ -129,4 +129,22 @@ async function handleLogin() {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
|
|
+.login-input-wrap {
|
|
|
|
|
+ height: 48px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.login-input {
|
|
|
|
|
+ height: 46px;
|
|
|
|
|
+ min-height: 46px;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #1f2937;
|
|
|
|
|
+ background-color: transparent;
|
|
|
|
|
+ border: none;
|
|
|
|
|
+ outline: none;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.login-input::placeholder {
|
|
|
|
|
+ color: #9ca3af;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|