Files
Home-Care/hss-home-service/delivery-miniapp/pages/delivery/login/login.vue
comclib c02029a5f3 feat: 初始化居家上门服务系统完整项目代码
- Spring Boot 后端服务 (hss-home-service)
- delivery-miniapp 配送小程序
- website 官网 (Nuxt)
- docs 架构设计文档
- Docker 容器化部署配置

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 09:04:49 +08:00

61 lines
2.1 KiB
Vue

<template>
<view class="login-container">
<view class="logo-area">
<text class="title">居家上门服务</text>
<text class="subtitle">服务人员端</text>
</view>
<view class="form-area">
<input class="input" v-model="username" placeholder="请输入账号" />
<input class="input" v-model="password" type="password" placeholder="请输入密码" />
<button class="login-btn" @click="handleLogin" :disabled="loading">
{{ loading ? '登录中...' : '登录' }}
</button>
</view>
</view>
</template>
<script>
import { BASE_URL } from '@/common/api.js';
export default {
data() {
return { username: '', password: '', loading: false };
},
methods: {
async handleLogin() {
if (!this.username || !this.password) {
uni.showToast({ title: '请输入账号密码', icon: 'none' });
return;
}
this.loading = true;
try {
const res = await uni.request({
url: BASE_URL + '/auth/login',
method: 'POST',
data: { username: this.username, password: this.password, role: 'STAFF' }
});
if (res.data.code === 200) {
uni.setStorageSync('token', res.data.data.token);
uni.setStorageSync('userInfo', res.data.data);
uni.switchTab({ url: '/pages/delivery/index/index' });
} else {
uni.showToast({ title: res.data.message, icon: 'none' });
}
} catch (e) {
uni.showToast({ title: '网络错误', icon: 'none' });
} finally {
this.loading = false;
}
}
}
};
</script>
<style>
.login-container { padding: 80rpx 60rpx; }
.logo-area { text-align: center; margin-bottom: 80rpx; }
.title { font-size: 48rpx; font-weight: bold; display: block; }
.subtitle { font-size: 28rpx; color: #999; margin-top: 10rpx; }
.input { border: 1px solid #ddd; border-radius: 12rpx; padding: 24rpx; margin-bottom: 24rpx; font-size: 30rpx; }
.login-btn { background: #1677ff; color: #fff; border-radius: 12rpx; height: 88rpx; line-height: 88rpx; font-size: 32rpx; margin-top: 40rpx; }
</style>