123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <view class="normal-login-container">
- <view class="logo-content">
- <image :src="imagePath" mode="aspectFit" class="logo-image"></image>
- <text class="title">金邻助家</text>
- </view>
- <image
- src="/static/13779@1x.png"
- mode="widthFix"
- class="house-illustration"
- ></image>
- <view class="slogan-content">
- <text class="slogan-text">着力打造全国居家服务行业标准</text>
- <text class="slogan-text">和建立综合信用评价体系</text>
- </view>
- <!-- 波浪容器 -->
- <view class="wave-container">
- <image src="/static/Vector 1@1x.png" mode="widthFix" class="wave-img"></image>
- <image src="/static/Vector 2@1x.png" mode="widthFix" class="wave-img"></image>
- </view>
- <view class="actions-container">
- <up-button
- custom-style="{ 'background-color': '#623F34', 'color': '#FFFFFF', 'border-radius': '25px', 'height': '50px', 'line-height': '50px', 'fontSize': '18px' }"
- class="login-button"
- @click="handleLogin"
- >微信授权登录</up-button
- >
- <view class="xieyi text-center">
- <text class="text-grey1">登录即代表同意</text>
- <text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
- <text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, reactive, onMounted } from 'vue'
- import { useRouter } from 'vue-router' // 根据实际情况选择路由库
- import store from '@/store'
- const imagePath = '/static/9efd1.png' // Path to the logo image (red tree)
- // 获取全局配置
- // const globalConfig = getApp().globalData.config;
- const register = ref(false) // 用户注册开关
- const loginForm = reactive({
- username: '',
- password: '',
- code: '',
- uuid: '',
- })
- // const codeUrl = ref(""); // Not used in the new design
- // const captchaEnabled = ref(true); // Not used in the new design
- const router = useRouter()
- // 用户注册 - assuming this might be needed later, keeping it
- const handleUserRegister = () => {
- router.push('/pages/register') // 替换为实际的路由跳转逻辑
- }
- // 隐私协议
- const handlePrivacy = () => {
- uni.navigateTo({
- url: '/pages_home/pages/login/index',
- })
- }
- // 用户协议
- const handleUserAgrement = () => {
- uni.navigateTo({
- url: '/pages_home/pages/login/user',
- })
- }
- // 登录方法
- const handleLogin = async () => {
- uni.showLoading({
- title: '登录中,请耐心等待...',
- }) // 使用uni-app的loading方法替代$modal.loading
- // 获取服务商信息
- uni.getProvider({
- service: 'oauth',
- success: (res) => {
- console.log(res)
- },
- })
- // 获取code
- uni.login({
- provider: 'weixin',
- success: (res) => {
- if (res.code == 500) {
- uni.showLoading({
- title: '系统暂未开发,敬请期待',
- })
- } else if (res.code == 400) {
- uni.showLoading({
- title: '系统暂未开放',
- })
- }
- loginForm.code = res.code
- // 获取用户信息
- uni.getUserInfo({
- success: (res) => {
- console.log('用户信息', res)
- },
- })
- pwdLogin()
- uni.hideLoading()
- },
- })
- }
- // 密码登录
- const pwdLogin = async () => {
- if (!store) {
- console.error('Store is not defined')
- return
- }
- store.dispatch('Login', loginForm).then(() => {
- // uni.hideLoading(); // 关闭加载提示
- loginSuccess()
- })
- }
- // 登录成功后,处理函数
- const loginSuccess = () => {
- store.dispatch('GetInfo').then((res) => {
- console.log(store.state.user.userOrWorker, '>>>>99')
- if (store.state.user.userOrWorker == 0) {
- uni.reLaunch({
- url: '/pages/UserSelection',
- })
- return
- }
- uni.setStorageSync('userType', store.state.user.userOrWorker)
- uni.switchTab({
- url: '/pages/index',
- })
- })
- }
- // 页面加载时
- onMounted(() => {
- uni.setStorageSync('userType', 0)
- // open(); // Popup related, removed
- })
- </script>
- <style lang="scss" scoped>
- page {
- height: 100vh;
- width: 100%;
- }
- .normal-login-container {
- width: 100%;
- height: 100vh;
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- // background: linear-gradient(180deg, #ffa485 0%, #f6b053 100%);
- overflow: hidden;
- }
- .logo-content {
- margin-top: 177rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
-
- .logo-image {
- width: 90rpx;
- height: 90rpx;
- margin-bottom: 20rpx;
- }
-
- .title {
- font-family: PingFang SC;
- font-size: 38rpx;
- font-weight: 600;
- line-height: 38rpx;
- color: #ffffff;
- text-align: center;
- }
- }
- .house-illustration {
- width: 560rpx;
- margin-top: 60rpx;
- margin-bottom: 40rpx;
- }
- .slogan-content {
- text-align: center;
-
- .slogan-text {
- font-size: 28rpx;
- color: #593931;
- line-height: 38rpx;
- display: block;
- }
- }
- .actions-container {
- width: 100%;
- padding: 0 80rpx;
- position: absolute;
- bottom: 80rpx;
- left: 0;
- z-index: 2;
-
- .login-button {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- border-radius: 44rpx !important;
- background-color: #623f34 !important;
- color: #ffffff !important;
- font-size: 32rpx !important;
- font-weight: 400;
- }
-
- .xieyi {
- margin-top: 24rpx;
- text-align: center;
-
- .text-grey1 {
- font-size: 24rpx;
- color: #333333;
- }
-
- .text-blue {
- font-size: 24rpx;
- color: #1a88ff;
- margin: 0 4rpx;
- }
- }
- }
- /* 波浪区域样式 */
- .wave-container {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 300rpx;
- overflow: hidden;
- z-index: 1;
- .wave-img {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 100%;
- &:first-child {
- opacity: 0.4;
- mix-blend-mode: multiply;
- }
- &:last-child {
- transform: translateY(20rpx);
- }
- }
- }
- </style>
|