From 53dc2bac460d2ff210aa9523717753ae1fd2c159 Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期二, 26 十一月 2024 17:27:44 +0800 Subject: [PATCH] 添加运维端首页 --- pages/login/index.vue | 45 ++++++++++++++++++++++++++++++++------------- 1 files changed, 32 insertions(+), 13 deletions(-) diff --git a/pages/login/index.vue b/pages/login/index.vue index 29b5709..80a0138 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -1,10 +1,16 @@ <script setup> import { wxLoginApi,adminLoginApi } from '../../api/index.js' import { onMounted,ref } from 'vue' + import { BASE_URL } from '../../config/baseUrl.js'; + const baseUrl = ref(BASE_URL) const loginType = ref(1) //用户登录选项,1:微信登录,0:管理员登录(账号密码) function changeLoginType(){ loginType.value = loginType.value == 1 ? 0 : ( loginType.value == 0 ? 1 : '') + // uni.showToast({ + // title:'该功能正在升级中', + // icon:'none' + // }) } //进入页面判断是否存在openid,存在直接跳转首页 onMounted(() =>{ @@ -56,23 +62,28 @@ pwdType.value = str == 'pwd' ? 'text' : ( str == 'text' ? 'password' : 'text') } async function adminLogin(){ - uni.redirectTo({ - url:'/pages/adminPlatform/home' - }) - // await adminLoginApi(form.value).then((res) =>{ - // console.log('管理员登录响应',res) - // if(res.code == 200){ - // uni.redirectTo({ + // uni.redirectTo({ // url:'/pages/adminPlatform/home' // }) - // } - // }) + + await adminLoginApi(form.value).then((res) =>{ + console.log('管理员登录响应',res) + if(res.code == 200){ + uni.setStorageSync('maintainId',JSON.stringify(res.data.id)) + uni.setStorageSync('token',res.data.token) + console.log() + uni.redirectTo({ + url:'/pagesAdmin/adminPlatform/home' + }) + } + }) } </script> <template> <view class="container"> <view class="content"> - <view class="top" style="background-image:url('../../static/images/login/top_bg.png')"> + <view class="top"> + <image class="top-bg" :src="baseUrl + '/upload' + '/qingYuan/images/20241126/2f56a2a7ecfd2544dec5978d2687383e.png'" mode="widthFix"></image> <view class="top--title"> <image class="logo" src="../../static/images/login/logo.png "></image> <view class="text">清源直饮水运维平台</view> @@ -133,13 +144,21 @@ justify-content: center; align-items: center; height:450rpx; - background-size:100% auto; - background-repeat: no-repeat; - background-position:top; + position: relative; + z-index:1; + // background-size:100% auto; + // background-repeat: no-repeat; + // background-position:top; + .top-bg{ + width:100%; + position: absolute; + top:0; + } .top--title{ display: flex; justify-content: center; align-items: center; + z-index:2; .logo{ width:80rpx; height:80rpx; -- Gitblit v1.9.3