123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <!-- 蓝色登录页面2 -->
- <template>
- <view style="height:100vh;background: #fff;">
- <view class="img-a">
- <view class="t-b">
- 欢迎使用,
- <br />
- 喵星人智能货柜管理平台
- </view>
- </view>
- <view class="login-view" style="">
- <view class="t-login">
- <form class="cl">
- <view class="t-a">
- <text class="txt">账号</text>
- <input placeholder="请输入账号" v-model="loginForm.username" name="input" />
- </view>
- <view class="t-a">
- <text class="txt">密码</text>
- <input v-model="loginForm.password" type="password" placeholder="请输入密码" name="input" />
- </view>
- <view class="remember">
- <u-checkbox-group>
- <u-checkbox size="30" labelSize="26" labelColor="#666" name="1" v-model="isRemember" @change="remember">记住密码</u-checkbox>
- </u-checkbox-group>
- </view>
- <button @click="handleLogin">登 录</button>
- </form>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { getCurrentInstance,reactive,toRefs,onMounted } from 'vue'
- import {
- sysList
- } from '@/api/system/menu.js'
- import useUserStore from '@/stores/user.js'
- import usePermissionStore from '@/stores/permission.js'
- const userStore = useUserStore()
- const permissionStore = usePermissionStore()
- const {
- proxy
- } = getCurrentInstance();
- const data = reactive({
- loginForm: {
- username: "",
- password: "",
- code: "",
- uuid: ''
- },
- isRemember: true
- })
- const {
- loginForm,
- isRemember
- } = toRefs(data);
- onMounted(() => {
- if (uni.getStorageSync('account')) {
- isRemember.value = true
- let account = JSON.parse(uni.getStorageSync('account'))
- loginForm.value.username = account.username
- loginForm.value.password = account.password
- }
- })
- function remember(e) {
- isRemember.value = e.value
- }
- // 登录方法
- function handleLogin() {
- if (!loginForm.value.username) {
- proxy.$modal.msg('请输入账号~')
- return
- }
- if (!loginForm.value.password) {
- proxy.$modal.msg('请输入密码~')
- return
- }
- pwdLogin()
- }
- // 密码登录
- async function pwdLogin(params) {
- if (isRemember.value) { //记住密码
- let account = {
- username: loginForm.value.username,
- password: loginForm.value.password
- }
- uni.setStorageSync('account', JSON.stringify(account))
- } else {
- uni.setStorageSync('account', '')
- }
- await userStore.Login(loginForm.value)
-
- await permissionStore.GetPermis()
- //判断用户是否有任一菜单权限
- if (permissionStore.permissions_menu && permissionStore.permissions_menu !=
- '[]') {
- proxy.$tab.reLaunch('/pages/globalPages/home')
- } else {
- proxy.$modal.msg('该用户无权限~')
- }
- }
- // 获取系统id
- function getSysId() {
- return new Promise((resolve, reject) => {
- sysList({}).then(res => {
- let sysId = 381638941857029; //默认系统id
- for (var i = 0; i < res.length; i++) {
- let item = res[i];
- if (item.code == 'xy_merc_mini') {
- sysId = item.id
- console.log('系统id:', sysId)
- }
- }
- uni.setStorageSync('sysId', sysId)
- resolve(res)
- }).catch(err => {
- reject(err)
- })
- })
- }
- </script>
- <style lang="scss" scoped>
- .txt {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- .img-a {
- width: 100%;
- height: 450rpx;
- background-image: url(https://cdn.ossfile.mxrvending.com/assets/xy_mana_mini/images/global/opendoor-manage-mini.png);
- background-size: 100%;
- }
- .reg {
- font-size: 28rpx;
- color: #fff;
- height: 90rpx;
- line-height: 90rpx;
- border-radius: 50rpx;
- font-weight: bold;
- background: #f5f6fa;
- color: #000000;
- text-align: center;
- margin-top: 30rpx;
- }
- .login-view {
- width: 100%;
- position: relative;
- margin-top: -120rpx;
- background-color: #ffffff;
- border-radius: 8% 8% 0% 0;
- }
- .t-login {
- width: 600rpx;
- margin: 0 auto;
- font-size: 28rpx;
- padding-top: 80rpx;
- }
- .t-login button {
- font-size: 28rpx;
- background: #2796f2;
- color: #fff;
- height: 90rpx;
- line-height: 90rpx;
- border-radius: 50rpx;
- font-weight: bold;
- }
- .t-login input {
- height: 90rpx;
- line-height: 90rpx;
- margin-bottom: 50rpx;
- border-bottom: 1px solid #e9e9e9;
- font-size: 28rpx;
- }
- .t-login .t-a {
- position: relative;
- }
- .t-b {
- text-align: left;
- font-size: 42rpx;
- color: #ffffff;
- padding: 130rpx 0 0 70rpx;
- font-weight: bold;
- line-height: 70rpx;
- }
- .t-login .t-c {
- position: absolute;
- right: 22rpx;
- top: 22rpx;
- background: #5677fc;
- color: #fff;
- font-size: 24rpx;
- border-radius: 50rpx;
- height: 50rpx;
- line-height: 50rpx;
- padding: 0 25rpx;
- }
- .t-login .t-d {
- text-align: center;
- color: #999;
- margin: 80rpx 0;
- }
- .t-login .t-e {
- text-align: center;
- width: 250rpx;
- margin: 80rpx auto 0;
- }
- .t-login .t-g {
- float: left;
- width: 50%;
- }
- .t-login .t-e image {
- width: 50rpx;
- height: 50rpx;
- }
- .t-login .t-f {
- text-align: center;
- margin: 150rpx 0 0 0;
- color: #666;
- }
- .t-login .t-f text {
- margin-left: 20rpx;
- color: #aaaaaa;
- font-size: 27rpx;
- }
- .t-login .uni-input-placeholder {
- color: #aeaeae;
- }
- .cl {
- zoom: 1;
- }
- .cl:after {
- clear: both;
- display: block;
- visibility: hidden;
- height: 0;
- content: '\20';
- }
- .remember {
- margin-top: 24rpx;
- margin-bottom: 40rpx;
- }
- </style>
|