提交 c64396ed authored 作者: 刘旭's avatar 刘旭

添加绑定用户功能

上级 f43addf4
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
{
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version" : "0.0",
"configurations" : [
{
"default" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"openVueDevtools" : true,
"type" : "uni-app:h5"
}
]
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport =
'CSS' in window &&
typeof CSS.supports === 'function' &&
(CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') +
'" />'
)
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<!-- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> -->
</body>
</html>
......@@ -4,7 +4,15 @@
<view class="header">
<text class="title">登记项目工时</text>
<text class="subtitle" @click="() => calendarRef?.open()">选择日期 {{ date }}</text>
<text class="title-description">*每天工时总数应为8小时;每天最多登记3个项目的工时;最早只能补录单月的工时数据。</text>
<text class="title-description">
*每天工时总数应为8小时;每天最多登记3个项目的工时;最早只能补录单月的工时数据。
</text>
<view class="accout">
<view style="width: 80%;">
<uni-easyinput v-model="userId" :disabled="disabled" placeholder="员工姓名" />
</view>
<button size="mini" @tap="onBind" :disabled="disabled">绑定</button>
</view>
</view>
<view class="content">
......@@ -25,6 +33,8 @@ import { ref, onMounted } from 'vue'
import formList from './components/formList.vue';
const date: any = ref('')
const disabled = ref(false)
const userId = ref()
const placeholderList: any = ref([
{ placeholder: '项目1' },
......@@ -143,6 +153,42 @@ const onSubmit = () => {
}, 100);
}
const onBind = () => {
if (!userId.value) return uni.showToast({
title: '请输入员工姓名',
icon: 'none'
})
let data = {
// ID: 'xh.',
parmeters: {
Model: {
F_LQKJ_FNANEM: {
FName: userId.value
},
F_LQKJ_ID: 'xh.'
}
}
}
uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.addUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
data,
method: 'POST',
success: (res: any) => {
const { data } = res
if (data.code === 200) {
disabled.value = true
return uni.showToast({
title: '绑定成功',
icon: 'none'
})
} else uni.showToast({
title: data.msg,
icon: 'none'
})
},
})
}
const login = () => {
uni.showLoading({
title: '加载中...',
......@@ -160,21 +206,64 @@ const login = () => {
parameters: ["640aea3709a243", "Administrator", "kingdee$2023", 2052]
},
success(res: any) {
uni.hideLoading()
formListRef.value?.map((item: any) => item.initRules())
// getAccessToken()
handleIsExist()
}
})
}
const getAccessToken = () => {
uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.RequestToken,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'GET',
success(res: any) {
console.log(res);
const { access_token } = res.data
localStorage.setItem('token', access_token)
handleIsExist()
}
})
}
const getUserInfo = () => {
uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.Request,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
success(res: any) {
console.log(res);
// const { access_token } = res
// localStorage.setItem('token', access_token)
}
})
}
const handleIsExist = () => {
uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.selectUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'GET',
data: { ID: 'xh.' },
success: (res: any) => {
uni.hideLoading()
const { data } = res
if (data.code === 200) {
console.log(data);
disabled.value = true
} else {
disabled.value = false
userId.value = ''
}
},
})
}
onMounted(() => {
login()
date.value = newDate()
// formListRef.value?.map((item: any) => item.initRules())
})
</script>
<style scoped>
<style lang="scss" scoped>
.queryRecords {
box-sizing: border-box;
width: 100%;
......@@ -185,40 +274,61 @@ onMounted(() => {
.container {
margin-top: 50rpx;
}
.header {
width: 100%;
text-align: center;
}
.header {
width: 100%;
text-align: center;
.title {
display: block;
font-size: 32rpx;
font-weight: bold;
}
.title {
display: block;
font-size: 32rpx;
font-weight: bold;
}
.subtitle {
display: block;
font-size: 28rpx;
color: rgb(100, 143, 193);
margin: 24rpx 0;
}
.subtitle {
display: block;
font-size: 28rpx;
color: rgb(100, 143, 193);
margin: 24rpx 0;
}
.title-description {
display: block;
font-size: 24rpx;
color: #ccc;
margin: 24rpx 0 60rpx 0;
padding: 20rpx;
}
.title-description {
display: block;
font-size: 24rpx;
color: #ccc;
margin: 24rpx 0 60rpx 0;
padding: 20rpx;
}
.content {
box-sizing: border-box;
width: 100%;
padding: 20rpx;
.accout {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
box-sizing: border-box;
line-height: 12px;
padding: 20rpx;
button {
width: 200rpx;
height: 100%;
margin: 0;
font-weight: bold;
color: #fff;
background-color: rgb(7, 193, 69);
margin-left: 20rpx;
}
}
}
.content {
box-sizing: border-box;
width: 100%;
padding: 20rpx;
}
}
.content-list {
margin-bottom: 20rpx;
}
......@@ -239,21 +349,21 @@ onMounted(() => {
align-items: center;
flex-direction: column;
margin-top: 50rpx;
}
.button button {
width: 240rpx;
margin-bottom: 20rpx;
font-weight: bold;
}
& button {
width: 240rpx;
margin-bottom: 20rpx;
font-weight: bold;
}
.button button:first-child {
color: rgb(7, 193, 69);
background-color: rgb(242, 242, 242);
}
& button:first-child {
color: rgb(7, 193, 69);
background-color: rgb(242, 242, 242);
}
.button button:last-child {
color: #fff;
background-color: rgb(7, 193, 69);
& button:last-child {
color: #fff;
background-color: rgb(7, 193, 69);
}
}
</style>
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni()],
server: {
host: '0.0.0.0',
port: 7879,
open: true,
strictPort: false, // 端口被占用直接退出
https: false, // 默认用http方式
proxy: {
'/ndr': {
target: 'http://192.168.0.90/',
},
},
},
plugins: [uni()],
server: {
host: '0.0.0.0',
port: 7879,
open: true,
strictPort: false, // 端口被占用直接退出
proxy: {
'/ndr': {
target: 'http://192.168.0.90/',
},
},
},
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论