添加工作台

main
suixy 15 hours ago
parent 4e333fbe16
commit 12a29ee5dd

@ -14,4 +14,5 @@
<style>
/*每个页面公共css */
</style>
* {}
</style>

@ -1,4 +1,7 @@
import App from './App'
import Card from '@/components/Card.vue'
import DictTag from '@/components/DictTag.vue'
import FormItem from '@/components/FormItem.vue'
// #ifndef VUE3
import Vue from 'vue'
@ -17,6 +20,9 @@ import {
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.component('Card', Card)
app.component('DictTag', DictTag)
app.component('FormItem', FormItem)
return {
app
}

@ -1,5 +1,11 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/workbench/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/login/index",
"style": {
@ -7,9 +13,15 @@
}
},
{
"path": "pages/index/index",
"path": "pages/contract/index",
"style": {
"navigationBarTitleText": "uni-app"
"navigationStyle": "custom"
}
},
{
"path": "pages/contract/info",
"style": {
"navigationStyle": "custom"
}
}
],

@ -4,12 +4,12 @@
<view class="form">
<view class="username">
<view class="icon"></view>
<input class="input" autocomplete="off" @input="usernameInput" placeholder="请输入用户名"
<input v-model="loginForm.username" class="input" autocomplete="off" placeholder="请输入用户名"
placeholder-style="color: rgba(25, 132, 238, 0.6);" />
</view>
<view class="password">
<view class="icon"></view>
<input class="input" autocomplete="off" type="password" @input="passwordInput" placeholder="请输入密码"
<input v-model="loginForm.password" class="input" autocomplete="off" type="password" placeholder="请输入密码"
placeholder-style="color: rgba(25, 132, 238, 0.6);" />
</view>
<view class="loginBtn" @tap="login"> </view>
@ -32,16 +32,18 @@
loginApi
} from '@/api/login'
const loginForm = ref({})
const usernameInput = (event) => {
loginForm.value.username = event.detail.value
}
const passwordInput = (event) => {
loginForm.value.password = event.detail.value
}
const login = async () => {
const data = await loginApi(loginForm.value)
if (data) {
setGlobalData('token', data.data.access_token)
uni.setStorageSync('token', data.data.access_token)
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 2000
})
uni.redirectTo({
url: '/pages/workbench/index'
})
}
}
</script>

@ -0,0 +1,166 @@
<template>
<view style="background-color: #F2F3F5;">
<scroll-view scroll-y="true" :style="{height:pageHeight+'px'}" style="position: relative">
<view class="workbenchIcon"></view>
<view class="headPortrait"></view>
<view class="userName">名称</view>
<view class="department">青岛海威物联科技有限公司</view>
<Card class="card1" title="全员">
<view class="viewMore">
查看更多
</view>
<view class="list">
<view v-for="i in list" class="item" @tap="toLink(i.path)">
<view class="iconBg" :style="{backgroundColor :i.color}">
<image width="100%" class="icon" :src="i.icon" mode="aspectFit"></image>
</view>
<view class="name">{{i.name}}</view>
</view>
</view>
</Card>
<Card class="card card2" title="待办">
</Card>
</scroll-view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
computed
} from 'vue';
import {
imgUrl
} from '@/common/config';
const list = computed(() => {
return [{
icon: `${imgUrl}/icon/attendancePunch.png`,
name: '考勤打卡',
color: '#E7F8FD',
path: '/pages/contract/index'
},
{
icon: `${imgUrl}/icon/oa.png`,
name: 'OA审批',
color: '#FFEBE9'
},
]
})
const toLink = (e) => {
uni.navigateTo({
url: e
})
}
const pageHeight = ref()
const sys = uni.getSystemInfoSync()
onMounted(() => {
pageHeight.value = sys.windowHeight
})
</script>
<style scoped lang="scss">
@import "@/uni.scss";
.workbenchIcon {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 785rpx;
background-image: url(#{$img-url}/workbenchIcon.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.headPortrait {
position: absolute;
top: 120rpx;
left: 30rpx;
width: 130rpx;
height: 130rpx;
background-image: url(#{$img-url}/headPortrait.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.userName {
position: absolute;
top: 145rpx;
left: 170rpx;
font-size: 34rpx;
color: #333;
}
.department {
position: absolute;
top: 200rpx;
left: 170rpx;
font-size: 22rpx;
color: #666;
}
.card1 {
margin-top: 300rpx;
position: relative;
.viewMore {
position: absolute;
right: 0%;
top: 0%;
width: 240rpx;
height: 64rpx;
background-image: url(#{$img-url}/icon/viewMore.png);
background-size: 100% 100%;
background-repeat: no-repeat;
line-height: 64rpx;
text-align: right;
padding-right: 30rpx;
color: #fff;
font-size: 24rpx;
}
.content {
.list {
.item {
width: 100rpx;
height: 150rpx;
display: inline-block;
margin-right: 76rpx;
.iconBg {
width: 100rpx;
height: 100rpx;
position: relative;
border-radius: 10rpx;
.icon {
position: absolute;
top: 50%;
left: 50%;
width: 50rpx;
size: 100%;
transform: translate(-50%, -50%);
}
}
.name {
width: 100rpx;
margin-top: 20rpx;
font-size: 24rpx;
color: #333;
white-space: nowrap;
text-align: center
}
}
}
}
}
.card2 {
margin-top: 30rpx;
}
</style>

@ -1,5 +1,4 @@
const globaldata = {
token: '',
const globaldata = {
encryptHeader: 'encrypt-key',
clientId: '428a8310cd442757ae699df5d894f051',
RSA_PUBLIC_KEY: 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==',

@ -14,6 +14,7 @@
/* 图片地址 */
// $img-url: 'https://hw-bm-1307203087.cos.ap-beijing.myqcloud.com';
$img-url: 'https://frp-off.com:47543/appstatic';

@ -19,10 +19,11 @@ const encryptHeader = getGlobalData('encryptHeader');
const baseURL = 'https://frp-off.com:47543'
const getToken = () => {
return getGlobalData('token')
return uni.getStorageSync('token')
}
export function request(options) {
options.headers = options.headers || {}
// 加密
const isEncrypt = options.headers && (options.headers.isEncrypt === 'true' || options.headers.isEncrypt === true);
@ -37,6 +38,7 @@ export function request(options) {
if (getToken() && !isToken) {
options.headers['Authorization'] = 'Bearer ' + getToken();
}
options.headers['clientid'] = getGlobalData('clientId');
return new Promise((resolve, reject) => {
uni.request({
@ -49,11 +51,6 @@ export function request(options) {
let code = res.data.code
let msg = res.data.msg
if (code === 200) {
uni.showToast({
title: msg.length < 10 ? msg : '成功',
icon: 'success',
duration: 2000
})
resolve(res.data)
} else {
if (code === 401) {
@ -62,6 +59,9 @@ export function request(options) {
icon: 'error',
duration: 2000
})
uni.reLaunch({
url: '/pages/login/index'
})
} else {
uni.showToast({
title: msg.length < 10 ? msg : '网络错误请重试',

Loading…
Cancel
Save