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

添加绑定用户功能

上级 f43addf4
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ {
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0", "version" : "0.0",
"configurations": [{ "configurations" : [
"default" :
{ {
"default" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"mp-weixin" : "mp-weixin" : {
{
"launchtype" : "local" "launchtype" : "local"
}, },
"type" : "uniCloud" "type" : "uniCloud"
},
{
"openVueDevtools" : true,
"type" : "uni-app:h5"
} }
] ]
} }
...@@ -3,11 +3,15 @@ ...@@ -3,11 +3,15 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script> <script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || var coverSupport =
CSS.supports('top: constant(a)')) 'CSS' in window &&
typeof CSS.supports === 'function' &&
(CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write( document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + '<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' : '') + '" />') (coverSupport ? ', viewport-fit=cover' : '') +
'" />'
)
</script> </script>
<title></title> <title></title>
<!--preload-links--> <!--preload-links-->
...@@ -16,5 +20,7 @@ ...@@ -16,5 +20,7 @@
<body> <body>
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script> <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> </body>
</html> </html>
...@@ -4,7 +4,15 @@ ...@@ -4,7 +4,15 @@
<view class="header"> <view class="header">
<text class="title">登记项目工时</text> <text class="title">登记项目工时</text>
<text class="subtitle" @click="() => calendarRef?.open()">选择日期 {{ date }}</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>
<view class="content"> <view class="content">
...@@ -25,6 +33,8 @@ import { ref, onMounted } from 'vue' ...@@ -25,6 +33,8 @@ import { ref, onMounted } from 'vue'
import formList from './components/formList.vue'; import formList from './components/formList.vue';
const date: any = ref('') const date: any = ref('')
const disabled = ref(false)
const userId = ref()
const placeholderList: any = ref([ const placeholderList: any = ref([
{ placeholder: '项目1' }, { placeholder: '项目1' },
...@@ -143,6 +153,42 @@ const onSubmit = () => { ...@@ -143,6 +153,42 @@ const onSubmit = () => {
}, 100); }, 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 = () => { const login = () => {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
...@@ -160,21 +206,64 @@ const login = () => { ...@@ -160,21 +206,64 @@ const login = () => {
parameters: ["640aea3709a243", "Administrator", "kingdee$2023", 2052] parameters: ["640aea3709a243", "Administrator", "kingdee$2023", 2052]
}, },
success(res: any) { success(res: any) {
uni.hideLoading()
formListRef.value?.map((item: any) => item.initRules()) 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(() => { onMounted(() => {
login() login()
date.value = newDate() date.value = newDate()
// formListRef.value?.map((item: any) => item.initRules())
}) })
</script> </script>
<style scoped> <style lang="scss" scoped>
.queryRecords { .queryRecords {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
...@@ -185,40 +274,61 @@ onMounted(() => { ...@@ -185,40 +274,61 @@ onMounted(() => {
.container { .container {
margin-top: 50rpx; margin-top: 50rpx;
}
.header { .header {
width: 100%; width: 100%;
text-align: center; text-align: center;
}
.title { .title {
display: block; display: block;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.subtitle { .subtitle {
display: block; display: block;
font-size: 28rpx; font-size: 28rpx;
color: rgb(100, 143, 193); color: rgb(100, 143, 193);
margin: 24rpx 0; margin: 24rpx 0;
} }
.title-description { .title-description {
display: block; display: block;
font-size: 24rpx; font-size: 24rpx;
color: #ccc; color: #ccc;
margin: 24rpx 0 60rpx 0; margin: 24rpx 0 60rpx 0;
padding: 20rpx; padding: 20rpx;
} }
.content { .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; box-sizing: border-box;
width: 100%; width: 100%;
padding: 20rpx; padding: 20rpx;
}
} }
.content-list { .content-list {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
...@@ -239,21 +349,21 @@ onMounted(() => { ...@@ -239,21 +349,21 @@ onMounted(() => {
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
margin-top: 50rpx; margin-top: 50rpx;
}
.button button { & button {
width: 240rpx; width: 240rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-weight: bold; font-weight: bold;
} }
.button button:first-child { & button:first-child {
color: rgb(7, 193, 69); color: rgb(7, 193, 69);
background-color: rgb(242, 242, 242); background-color: rgb(242, 242, 242);
} }
.button button:last-child { & button:last-child {
color: #fff; color: #fff;
background-color: rgb(7, 193, 69); background-color: rgb(7, 193, 69);
}
} }
</style> </style>
import { defineConfig } from "vite"; import { defineConfig } from 'vite';
import uni from "@dcloudio/vite-plugin-uni"; import uni from '@dcloudio/vite-plugin-uni';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
...@@ -9,12 +9,20 @@ export default defineConfig({ ...@@ -9,12 +9,20 @@ export default defineConfig({
port: 7879, port: 7879,
open: true, open: true,
strictPort: false, // 端口被占用直接退出 strictPort: false, // 端口被占用直接退出
https: false, // 默认用http方式
proxy: { proxy: {
'/ndr': { '/ndr': {
target: 'http://192.168.0.90/', target: 'http://192.168.0.90/',
}, },
}, },
},
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
}, },
}); });
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论