| | |
| | | "mqtt": "4.1.0", |
| | | "pinia": "2.2.2", |
| | | "tslib": "^2.7.0", |
| | | "uview-plus": "^3.3.32", |
| | | "uview-plus": "^3.4.62", |
| | | "vue": "3.4.21", |
| | | "vue-i18n": "^9.14.2" |
| | | }, |
| | |
| | | <script> |
| | | <template> |
| | | <Splash v-if="showSplash" /> |
| | | <div v-else> |
| | | <router-view /> |
| | | </div> |
| | | </template> |
| | | |
| | | export default { |
| | | onLaunch: function () { |
| | | console.log('App Launch') |
| | | }, |
| | | onShow: function () { |
| | | console.log('App Show') |
| | | }, |
| | | onHide: function () { |
| | | console.log('App Hide') |
| | | } |
| | | } |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue' |
| | | import Splash from './components/Splash.vue' |
| | | |
| | | const showSplash = ref(true) |
| | | onMounted(() => { |
| | | setTimeout(() => { |
| | | showSplash.value = false |
| | | }, 5000) |
| | | }) |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // ç»å½æ¹æ³ |
| | | export function login(username, password, code, uuid) { |
| | | export function loginCheckFactory(username, password, factoryId) { |
| | | const data = { |
| | | username, |
| | | password, |
| | | code, |
| | | uuid |
| | | factoryId |
| | | } |
| | | return request({ |
| | | url: '/login', |
| | | headers: { |
| | | isToken: false |
| | | }, |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // æ³¨åæ¹æ³ |
| | | export function register(data) { |
| | | return request({ |
| | | url: '/register', |
| | | url: '/loginCheckFactory', |
| | | headers: { |
| | | isToken: false |
| | | }, |
| | |
| | | }) |
| | | } |
| | | |
| | | // è·åéªè¯ç |
| | | export function getCodeImg() { |
| | | // è·åå
¬å¸å表 |
| | | export function userLoginFacotryList(params) { |
| | | return request({ |
| | | url: '/captchaImage', |
| | | headers: { |
| | | isToken: false |
| | | }, |
| | | url: '/userLoginFacotryList', |
| | | method: 'get', |
| | | timeout: 20000 |
| | | params: params |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="splash-container"> |
| | | <span class="title">ç§æ</span> |
| | | <span class="title1">便æºçæ´»</span> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | // æ éé»è¾ |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .splash-container { |
| | | width: 100vw; |
| | | height: 100vh; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | background: #fff; |
| | | } |
| | | .splash-logo { |
| | | width: 180px; |
| | | height: 180px; |
| | | object-fit: contain; |
| | | } |
| | | .title { |
| | | font-weight: 400; |
| | | font-size: 60px; |
| | | color: #000000; |
| | | } |
| | | .title1 { |
| | | font-weight: 400; |
| | | font-size: 40px; |
| | | color: #000000; |
| | | } |
| | | </style> |
| | |
| | | const config = { |
| | | // baseUrl: 'https://vue.ruoyi.vip/prod-api', |
| | | // baseUrl: 'http://localhost/prod-api', |
| | | baseUrl: 'http://localhost:8080', |
| | | baseUrl: 'http://114.132.189.42:8089', |
| | | //cloudåå°ç½å
³å°å |
| | | // baseUrl: 'http://192.168.10.3:8080', |
| | | // åºç¨ä¿¡æ¯ |
| | |
| | | }, |
| | | "pages": [ |
| | | { |
| | | "path": "pages/splash", |
| | | "style": { |
| | | "navigationBarTitleText": "å¯å¨é¡µ", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/index", |
| | | "style": { |
| | | "navigationBarTitleText": "è¥ä¾ç§»å¨ç«¯æ¡æ¶", |
| | | "navigationBarTitleText": "é¦é¡µ", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | |
| | | "iconPath": "static/images/tabbar/home.png", |
| | | "selectedIconPath": "static/images/tabbar/home_.png", |
| | | "text": "é¦é¡µ" |
| | | }, |
| | | { |
| | | "pagePath": "pages/work", |
| | | "iconPath": "static/images/tabbar/work.png", |
| | | "selectedIconPath": "static/images/tabbar/work_.png", |
| | | "text": "å·¥ä½å°" |
| | | }, |
| | | { |
| | | "pagePath": "pages/template", |
| | | "iconPath": "static/images/tabbar/work.png", |
| | | "selectedIconPath": "static/images/tabbar/work_.png", |
| | | "text": "模æ¿" |
| | | }, |
| | | { |
| | | "pagePath": "pages/mine", |
| | |
| | | <template> |
| | | <view class="content"> |
| | | <image class="logo" src="@/static/logo.png"></image> |
| | | <view class="text-area"> |
| | | <text class="title"> RuoYi-Geek-App</text> |
| | | </view> |
| | | <view class="text-area"> |
| | | <up-text type="primary" text="uview-plus"></up-text> |
| | | </view> |
| | | <view class="charts-box"> |
| | | <qiun-data-charts type="column" :chartData="chartData" /> |
| | | </view> |
| | | <view> |
| | | <view class="currentFactory"> |
| | | <up-text type="primary" :text="userStore.currentFactoryName" @click="show = true" |
| | | class="factoryName" suffixIcon="arrow-right" :iconStyle="iconStyle"></up-text> |
| | | </view> |
| | | <up-picker :show="show" :columns="factoryList" @confirm="changeFactory"></up-picker> |
| | | <view> |
| | | <view class="bg-img"></view> |
| | | </view> |
| | | <view class="bg-img"> |
| | | <up-grid |
| | | :border="false" |
| | | col="4" |
| | | > |
| | | <up-grid-item |
| | | v-for="(listItem,listIndex) in list" |
| | | :key="listIndex" |
| | | > |
| | | <up-icon |
| | | :customStyle="{paddingTop:20+'rpx'}" |
| | | :name="listItem.name" |
| | | :size="22" |
| | | ></up-icon> |
| | | <text class="grid-text">{{listItem.title}}</text> |
| | | </up-grid-item> |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- <view class="select-container">--> |
| | | <!-- <up-picker-data--> |
| | | <!-- class="picker"--> |
| | | <!-- v-model="currentFatoryId"--> |
| | | <!-- title="è¯·éæ©å
¬å¸"--> |
| | | <!-- :options="factoryList"--> |
| | | <!-- valueKey="id"--> |
| | | <!-- labelKey="name">--> |
| | | <!-- </up-picker-data>--> |
| | | <!-- </view>--> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue'; |
| | | import {ref, onMounted, nextTick, reactive} from 'vue'; |
| | | import {userLoginFacotryList} from "@/api/login"; |
| | | import modal from "@/plugins/modal"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | |
| | | const chartData = ref({}); |
| | | |
| | | onMounted(() => { getServerData() }); |
| | | |
| | | function getServerData() { |
| | | // 模æä»æå¡å¨è·åæ°æ®æ¶çå»¶æ¶ |
| | | setTimeout(() => { |
| | | let res = { |
| | | categories: ['2016', '2017', '2018', '2019', '2020', '2021'], |
| | | series: [ |
| | | { |
| | | name: 'ç®æ å¼', |
| | | data: [35, 36, 31, 33, 13, 34], |
| | | }, |
| | | { |
| | | name: '宿é', |
| | | data: [18, 27, 21, 24, 6, 28], |
| | | }, |
| | | ], |
| | | }; |
| | | chartData.value = JSON.parse(JSON.stringify(res)); |
| | | }, 500); |
| | | const userStore = useUserStore() |
| | | const factoryId = ref(''); |
| | | const show = ref(false); |
| | | const factoryList = ref([]); |
| | | const factoryListTem = ref([]); |
| | | const iconStyle = { |
| | | fontSize: '14px', |
| | | color: '#165DFF' |
| | | } |
| | | // å建ååºå¼æ°æ® |
| | | const list = reactive([ |
| | | { |
| | | name: 'photo', |
| | | title: 'å¾ç' |
| | | }, |
| | | { |
| | | name: 'lock', |
| | | title: 'é头' |
| | | }, |
| | | { |
| | | name: 'star', |
| | | title: 'ææ' |
| | | }, |
| | | { |
| | | name: 'hourglass', |
| | | title: 'æ²æ¼' |
| | | }, |
| | | { |
| | | name: 'home', |
| | | title: 'é¦é¡µ' |
| | | }, |
| | | { |
| | | name: 'volume', // 注æï¼è¿éä¿®æ¹äº name ä» 'star' æ¹ä¸º 'volume'ï¼ä»¥é¿å
å表ä¸ä¸¤ä¸ªå
ç´ å
·æç¸åç name |
| | | title: 'é³é' |
| | | }, |
| | | ]); |
| | | // å建对åç»ä»¶çå¼ç¨ |
| | | const uToastRef = ref(null); |
| | | |
| | | function getUserLoginFacotryList() { |
| | | userLoginFacotryList({userName: userStore.nickName}).then(res => { |
| | | // æ£æ¥res.dataæ¯å¦ä¸ºæ°ç» |
| | | factoryList.value[0] = [] |
| | | if (res.data && Array.isArray(res.data)) { |
| | | factoryListTem.value = res.data |
| | | res.data.forEach(item => { |
| | | factoryList.value[0].push(item.deptName) |
| | | }) |
| | | factoryId.value = userStore.currentDeptId |
| | | } else { |
| | | // 妿res.data䏿¯æ°ç»ï¼è®¾ç½®ä¸ºç©ºæ°ç» |
| | | factoryList.value = [] |
| | | } |
| | | }).catch(error => { |
| | | modal.msgError('è·åå
¬å¸å表失败:', error) |
| | | factoryList.value = [] |
| | | }) |
| | | } |
| | | const changeFactory = async (arr) => { |
| | | show.value = false; |
| | | const factoryId = factoryListTem.value[arr.indexs[0]].deptId |
| | | const loginForm = { |
| | | username: userStore.name, |
| | | password: uni.getStorageSync('remembered_password'), |
| | | factoryId: factoryId, |
| | | } |
| | | modal.loading("å·æ°ä¸ï¼è¯·èå¿çå¾
...") |
| | | userStore.loginCheckFactory(loginForm).then(() => { |
| | | modal.closeLoading() |
| | | nextTick(() => { |
| | | loginSuccess() |
| | | }); |
| | | }).catch(() => { |
| | | modal.closeLoading() |
| | | }) |
| | | } |
| | | function loginSuccess(result) { |
| | | uni.reLaunch({ |
| | | url: '/pages/index' |
| | | }); |
| | | } |
| | | |
| | | // å®ä¹æ¹æ³ |
| | | const click = (name) => { |
| | | if (uToastRef.value) { |
| | | uToastRef.value.success(`ç¹å»äºç¬¬${name + 1}个`); // 注æï¼è¿éå 1æ¯å 为é常æä»¬æ¯ä»ç¬¬1个å¼å§è®¡æ°ç |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | // è®¾ç½®ç¨æ·ä¿¡æ¯ |
| | | userStore.getInfo() |
| | | getUserLoginFacotryList() |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style scoped lang="scss"> |
| | | .content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background-color: transparent !important; |
| | | padding: 14px; |
| | | } |
| | | |
| | | .logo { |
| | | height: 200rpx; |
| | | width: 200rpx; |
| | | margin-top: 200rpx; |
| | | margin-left: auto; |
| | | margin-right: auto; |
| | | margin-bottom: 50rpx; |
| | | .currentFactory { |
| | | margin-top: 12px; |
| | | margin-left: 6px; |
| | | font-weight: 400; |
| | | font-size: 14px; |
| | | display: flex; |
| | | } |
| | | |
| | | .text-area { |
| | | display: flex; |
| | | justify-content: center; |
| | | .factoryName { |
| | | width: auto; |
| | | } |
| | | |
| | | .title { |
| | | font-size: 36rpx; |
| | | color: #8f8f94; |
| | | :deep(.u-text) { |
| | | align-items: flex-end; |
| | | } |
| | | |
| | | .charts-box { |
| | | width: 100%; |
| | | height: 300px; |
| | | .bg-img { |
| | | margin-top: 12px; |
| | | width: 100%; |
| | | height: 145px; |
| | | background-color: #ffffff; |
| | | border-radius: 10px 10px 10px 10px; |
| | | } |
| | | .grid-text { |
| | | font-size: 14px; |
| | | color: #909399; |
| | | padding: 10rpx 0 20rpx 0rpx; |
| | | /* #ifndef APP-PLUS */ |
| | | box-sizing: border-box; |
| | | /* #endif */ |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <view class="normal-login-container"> |
| | | <view class="logo-content align-center justify-center flex"> |
| | | <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix"> |
| | | </image> |
| | | <text class="title">è¥ä¾ç§»å¨ç«¯ç»å½</text> |
| | | <view class="logo-content"> |
| | | <!-- <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">--> |
| | | <!-- </image>--> |
| | | <text>è´¦å·å¯ç ç»å½</text> |
| | | </view> |
| | | <view class="login-form-content"> |
| | | <view class="input-item flex align-center"> |
| | | <view class="iconfont icon-user icon"></view> |
| | | <input v-model="loginForm.username" class="input" type="text" placeholder="请è¾å
¥è´¦å·" maxlength="30" /> |
| | | <up-input prefixIcon="account" placeholder="请è¾å
¥è´¦å·" border="bottom" |
| | | @blur="getUserLoginFacotryList" |
| | | maxlength="30" v-model="loginForm.username" clearable></up-input> |
| | | </view> |
| | | <view class="input-item flex align-center"> |
| | | <view class="iconfont icon-password icon"></view> |
| | | <input v-model="loginForm.password" type="password" class="input" placeholder="请è¾å
¥å¯ç " maxlength="20" /> |
| | | <up-input prefixIcon="lock" placeholder="请è¾å
¥å¯ç " border="bottom" maxlength="20" v-model="loginForm.password" clearable type="password"></up-input> |
| | | </view> |
| | | <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled"> |
| | | <view class="iconfont icon-code icon"></view> |
| | | <input v-model="loginForm.code" type="number" class="input" placeholder="请è¾å
¥éªè¯ç " maxlength="4" /> |
| | | <view class="login-code"> |
| | | <image :src="codeUrl" @click="getCode" class="login-code-img"></image> |
| | | </view> |
| | | </view> |
| | | <view class="action-btn"> |
| | | <view class="input-item flex align-center select-container"> |
| | | <up-icon name="tags" size="18"></up-icon> |
| | | <up-picker-data |
| | | v-model="loginForm.factoryId" |
| | | title="è¯·éæ©å
¬å¸" |
| | | :options="factoryList" |
| | | valueKey="id" |
| | | labelKey="name"> |
| | | </up-picker-data> |
| | | </view> |
| | | <view> |
| | | <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">ç»å½</button> |
| | | </view> |
| | | </view> |
| | | |
| | | <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 class="remember-password"> |
| | | <up-checkbox |
| | | :customStyle="{marginBottom: '8px'}" |
| | | label="è®°ä½å¯ç " |
| | | name="agree" |
| | | usedAlone |
| | | v-model:checked="rememberPassword" |
| | | > |
| | | </up-checkbox> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import modal from '@/plugins/modal' |
| | | import { getCodeImg } from '@/api/login' |
| | | import { ref } from "vue"; |
| | | import config from '@/config.js' |
| | | import { userLoginFacotryList} from '@/api/login' |
| | | import { ref, onMounted } from "vue"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { getWxCode } from '@/utils/geek'; |
| | | import { wxLogin } from '@/api/oauth'; |
| | | import { setToken } from '@/utils/auth'; |
| | | const userStore = useUserStore() |
| | | const codeUrl = ref(""); |
| | | const captchaEnabled = ref(true); // æ¯å¦å¼å¯éªè¯ç |
| | | const useWxLogin = ref(false); // æ¯å¦ä½¿ç¨å¾®ä¿¡ç»å½ |
| | | const globalConfig = ref(config); |
| | | const rememberPassword = ref(false); // è®°ä½å¯ç |
| | | const loginForm = ref({ |
| | | username: "admin", |
| | | password: "admin123", |
| | | code: "", |
| | | uuid: '' |
| | | username: "", |
| | | password: "", |
| | | factoryId: "", |
| | | currentFatoryName: "", |
| | | }); |
| | | const factoryList = ref([]) // å
¬å¸å表 |
| | | |
| | | // ä¿åå¯ç å°æ¬å°åå¨ |
| | | function savePassword() { |
| | | if (rememberPassword.value) { |
| | | uni.setStorageSync('remembered_username', loginForm.value.username); |
| | | uni.setStorageSync('remembered_password', loginForm.value.password); |
| | | uni.setStorageSync('remember_password', true); |
| | | } else { |
| | | uni.removeStorageSync('remembered_username'); |
| | | uni.removeStorageSync('remembered_password'); |
| | | uni.setStorageSync('remember_password', false); |
| | | } |
| | | } |
| | | |
| | | // 仿¬å°åå¨å è½½å¯ç |
| | | function loadPassword() { |
| | | const remembered = uni.getStorageSync('remember_password'); |
| | | if (remembered) { |
| | | rememberPassword.value = true; |
| | | const savedUsername = uni.getStorageSync('remembered_username'); |
| | | const savedPassword = uni.getStorageSync('remembered_password'); |
| | | if (savedUsername) { |
| | | loginForm.value.username = savedUsername; |
| | | } |
| | | if (savedPassword) { |
| | | loginForm.value.password = savedPassword; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (useWxLogin.value) { |
| | | getWxCode().then(res => { |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | // è·åå¾å½¢éªè¯ç |
| | | function getCode() { |
| | | getCodeImg().then(res => { |
| | | captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled |
| | | if (captchaEnabled.value) { |
| | | codeUrl.value = 'data:image/gif;base64,' + res.img |
| | | loginForm.value.uuid = res.uuid |
| | | } |
| | | }) |
| | | }; |
| | | function getUserLoginFacotryList() { |
| | | if(loginForm.value.username){ |
| | | userLoginFacotryList({userName:loginForm.value.username}).then(res => { |
| | | // æ£æ¥res.dataæ¯å¦ä¸ºæ°ç» |
| | | if (res.data && Array.isArray(res.data)) { |
| | | // éæ°ç»è£
æ°æ®æ ¼å¼ï¼deptIdåæidï¼deptNameåæname |
| | | factoryList.value = res.data.map(item => ({ |
| | | id: item.deptId, |
| | | name: item.deptName |
| | | })) |
| | | } else { |
| | | // 妿res.data䏿¯æ°ç»ï¼è®¾ç½®ä¸ºç©ºæ°ç» |
| | | factoryList.value = [] |
| | | } |
| | | }).catch(error => { |
| | | modal.msgError('è·åå
¬å¸å表失败:', error) |
| | | factoryList.value = [] |
| | | }) |
| | | }else { |
| | | factoryList.value = [] |
| | | } |
| | | } |
| | | |
| | | async function handleLogin() { |
| | | if (loginForm.value.username === "") { |
| | | modal.msgError("请è¾å
¥æ¨çè´¦å·") |
| | | } else if (loginForm.value.password === "") { |
| | | modal.msgError("请è¾å
¥æ¨çå¯ç ") |
| | | } else if (loginForm.value.code === "" && captchaEnabled.value) { |
| | | modal.msgError("请è¾å
¥éªè¯ç ") |
| | | } else if (loginForm.value.factoryId === "") { |
| | | modal.msgError("è¯·éæ©å
¬å¸") |
| | | } else { |
| | | modal.loading("ç»å½ä¸ï¼è¯·èå¿çå¾
...") |
| | | pwdLogin() |
| | |
| | | }; |
| | | // å¯ç ç»å½ |
| | | async function pwdLogin() { |
| | | userStore.login(loginForm.value).then(() => { |
| | | userStore.loginCheckFactory(loginForm.value).then(() => { |
| | | modal.closeLoading() |
| | | // ç»å½æååä¿åå¯ç |
| | | savePassword(); |
| | | loginSuccess() |
| | | }).catch(() => { |
| | | if (captchaEnabled.value) { |
| | | modal.closeLoading() |
| | | getCode() |
| | | } |
| | | modal.closeLoading() |
| | | }) |
| | | }; |
| | | |
| | |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | // éç§åè®® |
| | | function handlePrivacy() { |
| | | let site = globalConfig.value.appInfo.agreements[0]; |
| | | uni.navigateTo({ |
| | | url: `/pages/common/webview/index?title=${site.title}&url=${site.url}` |
| | | }); |
| | | }; |
| | | // ç¨æ·åè®® |
| | | function handleUserAgrement() { |
| | | let site = globalConfig.value.appInfo.agreements[1] |
| | | uni.navigateTo({ |
| | | url: `/pages/common/webview/index?title=${site.title}&url=${site.url}` |
| | | }); |
| | | }; |
| | | |
| | | getCode(); |
| | | // 页é¢å è½½æ¶æ£æ¥æ¯å¦æä¿åçå¯ç |
| | | onMounted(() => { |
| | | loadPassword(); |
| | | getUserLoginFacotryList() |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | |
| | | |
| | | .logo-content { |
| | | width: 100%; |
| | | font-size: 21px; |
| | | text-align: center; |
| | | padding-top: 15%; |
| | | font-weight: 400; |
| | | font-size: 30px; |
| | | color: #333333; |
| | | margin: 80px 0 0 30px; |
| | | |
| | | image { |
| | | border-radius: 4px; |
| | |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | .u-checkbox { |
| | | margin-left: 34px; |
| | | } |
| | | |
| | | .login-form-content { |
| | | text-align: center; |
| | | margin: 20px auto; |
| | | margin-top: 15%; |
| | | width: 80%; |
| | | margin: 58px auto; |
| | | padding: 0 30px; |
| | | |
| | | .input-item { |
| | | margin: 20px auto; |
| | | background-color: #f5f6f7; |
| | | height: 45px; |
| | | border-radius: 20px; |
| | | .input-item { |
| | | margin: 30px auto; |
| | | height: 45px; |
| | | |
| | | .icon { |
| | | font-size: 38rpx; |
| | | margin-left: 10px; |
| | | color: #999; |
| | | } |
| | | .icon { |
| | | font-size: 38rpx; |
| | | margin-left: 10px; |
| | | color: #999; |
| | | } |
| | | |
| | | .input { |
| | | width: 100%; |
| | | font-size: 14px; |
| | | line-height: 20px; |
| | | text-align: left; |
| | | padding-left: 15px; |
| | | } |
| | | |
| | | } |
| | | .input { |
| | | width: 100%; |
| | | font-size: 14px; |
| | | line-height: 20px; |
| | | text-align: left; |
| | | padding-left: 15px; |
| | | } |
| | | } |
| | | .select-container { |
| | | flex: 1; |
| | | border-bottom: 1px solid #e5e5e5; |
| | | padding: 6px 9px; |
| | | |
| | | :deep(.up-select) { |
| | | border: none; |
| | | background: transparent; |
| | | |
| | | .up-select__label { |
| | | font-size: 14px; |
| | | color: #333; |
| | | } |
| | | |
| | | .up-select__value { |
| | | font-size: 14px; |
| | | color: #333; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .login-btn { |
| | | margin-top: 40px; |
| | | height: 45px; |
| | | margin-top: 60px; |
| | | height: 50px; |
| | | background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%); |
| | | box-shadow: 0px 4px 10px 0px rgba(3,88,185,0.2); |
| | | border-radius: 40px 40px 40px 40px; |
| | | } |
| | | |
| | | .xieyi { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="splash-container"> |
| | | <span class="title">ç§æ</span> |
| | | <span class="title1">便æºçæ´»</span> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted } from 'vue' |
| | | // #ifdef H5 |
| | | import { useRouter } from 'vue-router' |
| | | const router = useRouter() |
| | | // #endif |
| | | onMounted(() => { |
| | | setTimeout(() => { |
| | | // #ifdef H5 |
| | | router.replace({ path: '/pages/login' }) |
| | | // #endif |
| | | // #ifndef H5 |
| | | uni.reLaunch({ url: '/pages/login' }) |
| | | // #endif |
| | | }, 2000) |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .splash-container { |
| | | width: 100vw; |
| | | height: 100vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | align-items: center; |
| | | background: #fff; |
| | | } |
| | | .title { |
| | | font-weight: 400; |
| | | font-size: 60px; |
| | | color: #000000; |
| | | } |
| | | .title1 { |
| | | font-weight: 400; |
| | | font-size: 40px; |
| | | color: #000000; |
| | | } |
| | | </style> |
| | |
| | | import { login, logout, getInfo } from "@/api/login"; |
| | | import {logout, getInfo, loginCheckFactory} from "@/api/login"; |
| | | import { getToken, setToken, removeToken } from "@/utils/auth"; |
| | | import defAva from "@/static/images/profile.jpg"; |
| | | import { defineStore } from "pinia"; |
| | |
| | | export interface LoginForm { |
| | | username: string; |
| | | password: string; |
| | | code: string; |
| | | uuid: string; |
| | | factoryId: string; |
| | | } |
| | | |
| | | const useUserStore = defineStore("user", { |
| | | state: () => ({ |
| | | token: getToken(), |
| | | id: "", |
| | | name: "", |
| | | avatar: "", |
| | | currentFactoryName: "", |
| | | nickName: "", |
| | | roleName: "", |
| | | currentDeptId: "", |
| | | currentLoginTime: "", |
| | | roles: Array(), |
| | | permissions: [], |
| | | }), |
| | | actions: { |
| | | // ç»å½ |
| | | login(userInfo: LoginForm) { |
| | | const username = userInfo.username.trim(); |
| | | const password = userInfo.password; |
| | | const code = userInfo.code; |
| | | const uuid = userInfo.uuid; |
| | | return new Promise((resolve, reject) => { |
| | | login(username, password, code, uuid) |
| | | .then((res: any) => { |
| | | setToken(res.token); |
| | | this.token = res.token; |
| | | resolve(null); |
| | | // é¨é¨ç»å½ |
| | | loginCheckFactory(userInfo: any) { |
| | | const username = userInfo.username.trim() |
| | | const password = userInfo.password |
| | | const factoryId = userInfo.factoryId |
| | | return new Promise((resolve, reject) => { |
| | | loginCheckFactory(username, password, factoryId).then((res: any) => { |
| | | setToken(res.token) |
| | | this.token = res.token |
| | | resolve(null) |
| | | }).catch((error: any) => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | // è·åç¨æ·ä¿¡æ¯ |
| | | getInfo() { |
| | | return new Promise((resolve, reject) => { |
| | | getInfo() |
| | | .then((res: any) => { |
| | | const user = res.user; |
| | | const avatar = |
| | | user.avatar == "" || user.avatar == null |
| | | ? defAva |
| | | : import.meta.env.VITE_APP_BASE_API + user.avatar; |
| | | |
| | | if (res.roles && res.roles.length > 0) { |
| | | // éªè¯è¿åçrolesæ¯å¦æ¯ä¸ä¸ªé空æ°ç» |
| | | this.roles = res.roles; |
| | | this.permissions = res.permissions; |
| | | } else { |
| | | this.roles = ["ROLE_DEFAULT"]; |
| | | } |
| | | this.name = user.userName; |
| | | this.avatar = avatar; |
| | | const user = res.user |
| | | let avatar = user.avatar || "" |
| | | avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar |
| | | if (res.roles && res.roles.length > 0) { // éªè¯è¿åçrolesæ¯å¦æ¯ä¸ä¸ªé空æ°ç» |
| | | this.roles = res.roles |
| | | this.permissions = res.permissions |
| | | } else { |
| | | this.roles = ['ROLE_DEFAULT'] |
| | | } |
| | | this.id = user.userId |
| | | this.name = user.userName |
| | | this.avatar = avatar |
| | | this.currentFactoryName = user.currentFactoryName |
| | | this.nickName = user.nickName |
| | | this.roleName = user.roles[0].roleName |
| | | this.currentDeptId = user.tenantId |
| | | this.currentLoginTime = this.getCurrentTime() |
| | | resolve(res); |
| | | }) |
| | | .catch((error) => { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | getCurrentTime() { |
| | | const now = new Date(); |
| | | const year = now.getFullYear(); // è·å年份 |
| | | const month = String(now.getMonth() + 1).padStart(2, '0'); // æä»½ä»0å¼å§ï¼è¦+1ï¼å¹¶è¡¥é¶ |
| | | const day = String(now.getDate()).padStart(2, '0'); // æ¥æè¡¥é¶ |
| | | const hours = String(now.getHours()).padStart(2, '0'); // å°æ¶è¡¥é¶ |
| | | const minutes = String(now.getMinutes()).padStart(2, '0'); // åéè¡¥é¶ |
| | | const seconds = String(now.getSeconds()).padStart(2, '0'); // ç§æ°è¡¥é¶ |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | |
| | | // @use "sass:math"; |
| | | // @import "sass:math"; |
| | | @import '../tools/functions.scss'; |
| | | // é´è·åºç¡åæ° |
| | | $uni-space-root: 2 !default; |