This commit is contained in:
weiwei committed 2025-04-23 19:16:11 +08:00
commit 446e545f2e
8 files changed
+463 -941

No files matched your search

+3 -3
View File
@@ -38,9 +38,9 @@ VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api/ # 访客线上
#VITE_APP_PROD_SERVICE = http://123.156.228.134:48080/app-api
; #VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api
#VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api
VITE_APP_PROD_SERVICE = http://60.12.184.86:8089/api
VITE_APP_PROD_SERVICE = http://123.156.230.15:8089/api
#VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api # 信创线上
# ******************** end 生产环境 end ********************
VITE_DEV_ENV = dev
# VITE_DEV_ENV = prod
#VITE_DEV_ENV = dev
VITE_DEV_ENV = prod
+105 -203
View File
@@ -1,203 +1,105 @@
<script lang="ts">
import isDevEnv from "./sheep/utils/isDevEnv"
// import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
// onLaunch(() => {})
// onShow(() => {})
// onHide(() => {})
interface TabbarItem {
pagePath: string
text: string
iconPath: string
selectedIconPath: string
launchParam: string[]
auth: string[]
}
const tabbar: TabbarItem[] = [
// {
// pagePath: "pages/tabbar/canteen",
// text: "食堂",
// iconPath: "/static/tabbar/canteen.png",
// selectedIconPath: "/static/tabbar/canteen-select.png",
// launchParam: ["canteen"],
// auth: [],
// },
// {
// pagePath: "pages/tabbar/selfMerchant",
// text: "自营商家",
// iconPath: "/static/tabbar/selfMerchant.png",
// selectedIconPath: "/static/tabbar/selfMerchant-select.png",
// launchParam: ["selfMerchant"],
// auth: [],
// },
// {
// pagePath: "pages/tabbar/coopMerchant",
// text: "合作商家",
// iconPath: "/static/tabbar/coopMerchant.png",
// selectedIconPath: "/static/tabbar/coopMerchant-select.png",
// launchParam: ["selfMerchant"],
// auth: ["user"],
// },
// {
// pagePath: "pages/tabbar/order",
// text: "订单",
// iconPath: "/static/tabbar/order.png",
// selectedIconPath: "/static/tabbar/order-select.png",
// launchParam: ["canteen", "selfMerchant"],
// auth: ["user"],
// },
// {
// pagePath: "pages/tabbar/flowStatistics",
// text: "流水统计",
// iconPath: "/static/tabbar/order.png",
// selectedIconPath: "/static/tabbar/order-select.png",
// launchParam: [],
// auth: ["merchant"],
// },
// {
// pagePath: "pages/tabbar/individualOrder",
// text: "订单",
// iconPath: "/static/tabbar/order.png",
// selectedIconPath: "/static/tabbar/order-select.png",
// launchParam: [],
// auth: ["merchant"],
// },
]
// 获取启动参数
const getLaunchParam = () => {
return new URL(window.location.href).searchParams.get("launchParam")
}
// 设置tabbar项目
const setTabbarItem = (index: number, item: TabbarItem, visible: boolean) => {
uni.setTabBarItem({
index,
pagePath: item.pagePath,
text: item.text,
iconPath: item.iconPath,
selectedIconPath: item.selectedIconPath,
visible,
})
}
// 根据启动参数设置tabbar项目
const setTabbarByLaunchParam = (launchParam: string) => {
tabbar.forEach((item, index) => {
const visible = item.launchParam.includes(launchParam)
setTabbarItem(index, item, visible)
})
}
// 根据用户角色设置tabbar项目
const setTabbarByUserRole = (role: string) => {
tabbar.forEach((item, index) => {
const visible = item.auth.includes(role)
setTabbarItem(index, item, visible)
})
}
export default {
async onLaunch() {
// 环境判断
// const res = await (window as any).CP2.getAppInfo()
// if (res.code == 0) {
// // 不是诗画环境
// const launchParam = getLaunchParam()
// console.log("app launch 启动路径参数", launchParam)
// switch (launchParam) {
// case "canteen":
// uni.switchTab({ url: "/pages/tabbar/canteen" })
// break
// case "selfMerchant":
// uni.switchTab({ url: "/pages/tabbar/selfMerchant" })
// break
// default:
// break
// }
// } else {
// // 是诗画环境
// const userRole = uni.getStorageSync("userRole")
// if (!userRole) return uni.redirectTo({ url: "/pages/user/userRole" })
// if (userRole === "user") return uni.switchTab({ url: "/pages/tabbar/coopMerchant" })
// if (userRole === "merchant") return uni.switchTab({ url: "/pages/tabbar/individualOrder" })
// }
},
onShow() {},
onHide() {},
methods: {
async _initTabbar() {
// if (isDevEnv()) {
// tabbar.forEach((item, index) => {
// setTabbarItem(index, item, true)
// })
// return
// }
// const launchParam = getLaunchParam()
// console.log("tabbar launch 启动路径参数", launchParam)
// const res = await (window as any).CP2.getAppInfo()
// if (res.code == 0) {
// // 不是诗画环境
// if (launchParam) {
// setTabbarByLaunchParam(launchParam)
// } else {
// uni.hideTabBar()
// uni.showToast({ title: "启动参数不合法", icon: "none" })
// }
// } else {
// // 是诗画环境
// const userRole = uni.getStorageSync("userRole")
// switch (userRole) {
// case "user":
// setTabbarByUserRole("user")
// break
// case "merchant":
// setTabbarByUserRole("merchant")
// break
// default:
// uni.hideTabBar()
// uni.showToast({ title: "用户身份未确认", icon: "none" })
// break
// }
// }
},
},
}
</script>
<style lang="scss">
@import "@/sheep/scss/global.scss";
@import url(@/uni_modules/tm-ui/css/remixicon.min.css);
$theme-green: #06be36;
$theme-blue: #0094ff;
$theme-gray: #999;
.botder_btn {
border: 1px solid #999;
color: #999;
font-weight: 500;
font-size: 28rpx;
border-radius: 10rpx;
padding: 8rpx 15rpx;
}
.prefix_title {
font-size: 32rpx;
font-weight: 500;
color: #333;
&::before {
content: "";
display: inline-block;
width: 8rpx;
height: 24rpx;
background: $theme-blue;
border-radius: 4rpx;
margin-right: 10rpx;
}
}
</style>
<script lang="ts">
import isDevEnv from "./sheep/utils/isDevEnv"
// import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
// onLaunch(() => {})
// onShow(() => {})
// onHide(() => {})
interface TabbarItem {
pagePath: string
text: string
iconPath: string
selectedIconPath: string
launchParam: string[]
auth: string[]
}
const tabbar: TabbarItem[] = []
// 获取启动参数
const getLaunchParam = () => {
return new URL(window.location.href).searchParams.get("launchParam")
}
// 设置tabbar项目
const setTabbarItem = (index: number, item: TabbarItem, visible: boolean) => {
uni.setTabBarItem({
index,
pagePath: item.pagePath,
text: item.text,
iconPath: item.iconPath,
selectedIconPath: item.selectedIconPath,
visible,
})
}
// 根据启动参数设置tabbar项目
const setTabbarByLaunchParam = (launchParam: string) => {
tabbar.forEach((item, index) => {
const visible = item.launchParam.includes(launchParam)
setTabbarItem(index, item, visible)
})
}
// 根据用户角色设置tabbar项目
const setTabbarByUserRole = (role: string) => {
tabbar.forEach((item, index) => {
const visible = item.auth.includes(role)
setTabbarItem(index, item, visible)
})
}
export default {
async onLaunch() {
// 检查登录状态
const token = uni.getStorageSync("token")
if (!token) {
uni.navigateTo({
url: "/pages/test/login",
})
return
}
},
onShow() {},
onHide() {},
methods: {
async _initTabbar() {},
},
}
</script>
<style lang="scss">
@import "@/sheep/scss/global.scss";
@import url(@/uni_modules/tm-ui/css/remixicon.min.css);
$theme-green: #06be36;
$theme-blue: #0094ff;
$theme-gray: #999;
.botder_btn {
border: 1px solid #999;
color: #999;
font-weight: 500;
font-size: 28rpx;
border-radius: 10rpx;
padding: 8rpx 15rpx;
}
.prefix_title {
font-size: 32rpx;
font-weight: 500;
color: #333;
&::before {
content: "";
display: inline-block;
width: 8rpx;
height: 24rpx;
background: $theme-blue;
border-radius: 4rpx;
margin-right: 10rpx;
}
}
</style>
+39 -207
View File
@@ -9,61 +9,42 @@
}
},
"pages": [
// {
// "path": "pages/tabbar/canteen",
// "style": {
// "navigationBarTitleText": "食堂",
// "disableScroll": true
// }
// },
// {
// "path": "pages/tabbar/selfMerchant",
// "style": {
// "navigationBarTitleText": "自营商家",
// "disableScroll": true
// }
// },
// {
// "path": "pages/tabbar/coopMerchant",
// "style": {
// "navigationBarTitleText": "合作商家",
// "disableScroll": true
// }
// },
// {
// "path": "pages/tabbar/order",
// "style": {
// "navigationBarTitleText": "订单",
// "disableScroll": true
// }
// },
// {
// "path": "pages/tabbar/flowStatistics",
// "style": {
// "navigationBarTitleText": "流水统计",
// "disableScroll": true
// }
// },
// {
// "path": "pages/tabbar/individualOrder",
// "style": {
// "navigationBarTitleText": "订单",
// "disableScroll": true
// }
// },
// {
// "path": "pages/integrated/visitor/myvisitor",
// "style": {
// "navigationBarTitleText": "访客",
// "disableScroll": true
// }
// },
{
"path": "pages/tabbar/my",
"style": {
"navigationBarTitleText": "我的",
"disableScroll": true
}
},
{
"path": "pages/integrated/visitor/index",
"style": {
"navigationBarTitleText": "访客申请"
}
},
{
"path": "pages/integrated/visitor/myvisitor",
"style": {
"navigationBarTitleText": "申请记录"
}
},
{
"path": "pages/integrated/visitor/myyyvisitor",
"style": {
"navigationBarTitleText": "主动邀约"
}
},
{
"path": "pages/integrated/visitor/myyyvisitorlist",
"style": {
"navigationBarTitleText": "邀约记录"
}
},
{
"path": "pages/integrated/visitor/verify",
"style": {
"navigationBarTitleText": "访客核销"
}
}
],
"subPackages": [
@@ -237,158 +218,7 @@
{
"path": "login",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
}
]
},
{
"root": "pages/wallet",
"pages": [
{
"path": "list",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
},
{
"path": "recharge",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
}
]
},
{
"root": "pages/human-face",
"pages": [
{
"path": "list",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
},
{
"path": "apply",
"style": {
"navigationBarTitleText": "",
"disableScroll": true
}
}
]
},
{
"root": "pages/user",
"pages": [
{
"path": "userRole",
"style": {
"navigationBarTitleText": "用户身份",
"disableScroll": true
}
}
]
},
{
"root": "pages/pay",
"pages": [
{
"path": "scanPay",
"style": {
"navigationBarTitleText": "支付",
"disableScroll": true
}
},
{
"path": "payComplete",
"style": {
"navigationBarTitleText": "支付完成",
"disableScroll": true
}
},
{
"path": "transferMoney",
"style": {
"navigationBarTitleText": "转账",
"disableScroll": true
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "feedback/index",
"style": {
"navigationBarTitleText": "意见反馈"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "visitor/index",
"style": {
"navigationBarTitleText": "访客"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "visitor/myvisitor",
"style": {
"navigationBarTitleText": "访客记录"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "visitor/myyyvisitor",
"style": {
"navigationBarTitleText": "邀约访客"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "visitor/myyyvisitorlist",
"style": {
"navigationBarTitleText": "邀约记录"
}
}
]
},
{
"root": "pages/integrated",
"pages": [
{
"path": "visitor/visitorDetail",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "记录详情"
"navigationBarTitleText": "登录"
}
}
]
@@ -396,12 +226,15 @@
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "小程序",
"navigationBarBackgroundColor": "#1777FF",
"backgroundColor": "#ecf4f9",
"navigationStyle": "custom"
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/integrated/visitor/index",
@@ -415,7 +248,6 @@
"iconPath": "/static/tabbar/my.png",
"selectedIconPath": "/static/tabbar/my-select.png"
},
{
"pagePath": "pages/integrated/visitor/myyyvisitor",
"text": "访客邀约",
@@ -430,7 +262,7 @@
},
{
"pagePath": "pages/integrated/visitor/verify",
"text": "核销",
"text": "访客核销",
"iconPath": "/static/tabbar/my.png",
"selectedIconPath": "/static/tabbar/my-select.png"
},
+140 -113
View File
@@ -221,6 +221,21 @@
</view>
</scroll-view>
<scroll-view scroll-y class="user-list" :style="{ height: '50vh' }">
<view
v-for="user in filteredUserList"
:key="user.userId"
class="user-item"
:class="{ active: selectedUserId === user.userId }"
@tap="selectUser(user)"
>
<text class="user-name">{{ user.name }}</text>
</view>
<view v-if="filteredUserList.length === 0" class="empty-tip">
{{ searchKeyword ? "未找到相关接待人" : "暂无接待人数据" }}
</view>
</scroll-view>
<view class="popup-footer">
<view class="confirm-btn" @tap="confirmUserSelect">确定</view>
</view>
@@ -237,21 +252,21 @@ import deptApi from "@/sheep/api/integrated/dept"
// 表单数据
const formData = reactive({
name: "测试访客",
mobile: "13800138000",
companyName: "测试公司",
isOtherPeople: "1", // 默认有随行人员
isDrive: "1", // 默认有车辆
deptId: "", // 这个需要等部门列表加载后设置
deptName: "",
userId: "", // 这个需要等用户列表加载后设置
userName: "",
vstartDate: "", // 这个会在页面加载时设置
vendDate: "",
type: "1",
checkStatus: "0",
reasonValue: "", // 这个需要等原因列表加载后设置
reasonLabel: "",
name: '测试访客',
mobile: '13800138000',
companyName: '测试公司',
isOtherPeople: '1', // 默认有随行人员
isDrive: '1', // 默认有车辆
deptId: '', // 这个需要等部门列表加载后设置
deptName: '',
receiveId: '', // 这个需要等用户列表加载后设置
userName: '',
vstartDate: '', // 这个会在页面加载时设置
vendDate: '',
type: '1',
checkStatus: '0',
reasonValue: '', // 这个需要等原因列表加载后设置
reasonLabel: '',
})
// 随行人员列表默认数据
@@ -316,9 +331,11 @@ const timeList = computed(() => {
// 过滤后的用户列表
const filteredUserList = computed(() => {
if (!searchKeyword.value) return userList.value
const keyword = searchKeyword.value.toLowerCase()
return userList.value.filter((user) => user.name.toLowerCase().includes(keyword))
if (!searchKeyword.value) return userList.value
const keyword = searchKeyword.value.toLowerCase()
return userList.value.filter(user =>
user.name.toLowerCase().includes(keyword)
)
})
// 获取部门数据
@@ -395,31 +412,31 @@ const goBack = () => {
// 表单验证
const validateForm = () => {
if (!formData.name) {
uni.showToast({ title: "请输入姓名", icon: "none" })
return false
}
if (!formData.mobile) {
uni.showToast({ title: "请输入联系方式", icon: "none" })
return false
}
if (!formData.deptId || !formData.deptName) {
uni.showToast({ title: "请选择到访单位", icon: "none" })
return false
}
if (!formData.userId || !formData.userName) {
uni.showToast({ title: "请选择接待人", icon: "none" })
return false
}
if (!formData.vstartDate || !formData.vendDate) {
uni.showToast({ title: "请选择到访时间", icon: "none" })
return false
}
if (!formData.reasonValue || !formData.reasonLabel) {
uni.showToast({ title: "请选择拜访原因", icon: "none" })
return false
}
return true
if (!formData.name) {
uni.showToast({ title: '请输入姓名', icon: 'none' })
return false
}
if (!formData.mobile) {
uni.showToast({ title: '请输入联系方式', icon: 'none' })
return false
}
if (!formData.deptId || !formData.deptName) {
uni.showToast({ title: '请选择到访单位', icon: 'none' })
return false
}
if (!formData.receiveId || !formData.userName) {
uni.showToast({ title: '请选择接待人', icon: 'none' })
return false
}
if (!formData.vstartDate || !formData.vendDate) {
uni.showToast({ title: '请选择到访时间', icon: 'none' })
return false
}
if (!formData.reasonValue || !formData.reasonLabel) {
uni.showToast({ title: '请选择拜访原因', icon: 'none' })
return false
}
return true
}
// 提交表单
@@ -443,30 +460,30 @@ const handleSubmit = async () => {
uni.hideLoading()
if (code === 0) {
uni.showToast({
title: "提交成功,请耐心等待您的拜访对象接受此次申请",
icon: "none",
duration: 3000,
})
if (code === 0) {
uni.showToast({
title: '提交成功,请耐心等待您的拜访对象接受此次申请',
icon: 'none',
duration: 3000
})
// 延迟返回,让用户能看到提示
setTimeout(() => {
uni.navigateBack()
}, 2000)
} else {
uni.showToast({
title: msg || "提交失败",
icon: "none",
})
}
} catch (error) {
uni.hideLoading()
uni.showToast({
title: "提交失败",
icon: "none",
})
}
// 延迟返回,让用户能看到提示
setTimeout(() => {
uni.navigateBack()
}, 2000)
} else {
uni.showToast({
title: msg || '提交失败',
icon: 'none'
})
}
} catch (error) {
uni.hideLoading()
uni.showToast({
title: '提交失败',
icon: 'none'
})
}
}
// 显示时间选择器
@@ -534,26 +551,26 @@ const selectDept = (dept: any) => {
// 部门选择确认
const confirmDeptSelect = () => {
if (!selectedDeptId.value) {
uni.showToast({
title: "请选择到访单位",
icon: "none",
})
return
}
if (!selectedDeptId.value) {
uni.showToast({
title: '请选择到访单位',
icon: 'none'
})
return
}
// 更新表单数据,同时保存ID和名称
formData.deptId = selectedDeptId.value
formData.deptName = selectedDeptName.value
// 更新表单数据,同时保存ID和名称
formData.deptId = selectedDeptId.value
formData.deptName = selectedDeptName.value
// 清空已选择的接待人
formData.userId = ""
formData.userName = ""
selectedUserName.value = ""
selectedUserId.value = ""
// 清空已选择的接待人
formData.receiveId = ''
formData.userName = ''
selectedUserName.value = ''
selectedUserId.value = ''
// 关闭弹窗
closeDeptPicker()
// 关闭弹窗
closeDeptPicker()
}
// 获取部门下的用户列表
@@ -578,42 +595,42 @@ const selectUser = (user: any) => {
// 用户选择确认
const confirmUserSelect = () => {
if (!selectedUserId.value) {
uni.showToast({
title: "请选择接待人",
icon: "none",
})
return
}
if (!selectedUserId.value) {
uni.showToast({
title: '请选择接待人',
icon: 'none'
})
return
}
// 更新表单数据,同时保存ID和名称
formData.userId = selectedUserId.value
formData.userName = selectedUserName.value
// 更新表单数据,同时保存ID和名称
formData.receiveId = selectedUserId.value
formData.userName = selectedUserName.value
// 关闭弹窗
closeUserPicker()
// 关闭弹窗
closeUserPicker()
}
// 显示用户选择器
const showUserPicker = async () => {
if (!formData.deptId) {
uni.showToast({
title: "请先选择到访单位",
icon: "none",
})
return
}
if (!formData.deptId) {
uni.showToast({
title: '请先选择到访单位',
icon: 'none'
})
return
}
// 如果切换了部门,重新获取用户列表
if (formData.deptId !== currentDeptId.value) {
await getUserList(formData.deptId)
currentDeptId.value = formData.deptId
// 清空选择
selectedUserId.value = ""
selectedUserName.value = ""
}
// 如果切换了部门,重新获取用户列表
if (formData.deptId !== currentDeptId.value) {
await getUserList(formData.deptId)
currentDeptId.value = formData.deptId
// 清空选择
selectedUserId.value = ''
selectedUserName.value = ''
}
showUserPopup.value = true
showUserPopup.value = true
}
// 关闭用户选择器
@@ -660,8 +677,18 @@ onMounted(async () => {
formData.deptId = firstDept.id
formData.deptName = firstDept.name
// 获取该部门的用户列表
await getUserList(firstDept.id)
// 获取该部门的用户列表
await getUserList(firstDept.id)
// 设置默认的接待人(选择第一个用户)
if (userList.value.length > 0) {
const firstUser = userList.value[0]
selectedUserId.value = firstUser.userId
selectedUserName.value = firstUser.name
formData.receiveId = firstUser.userId
formData.userName = firstUser.name
}
}
// 设置默认的接待人(选择第一个用户)
if (userList.value.length > 0) {
+142 -153
View File
@@ -321,170 +321,159 @@ onMounted(() => {
<style lang="scss" scoped>
.visitor-list {
min-height: 100vh;
background: #F7F8FA;
}
.tabs {
display: flex;
background: #fff;
padding: 0 32rpx;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1;
}
flex-direction: column;
height: 100vh;
background-color: #f5f5f5;
.tab-item {
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #666;
position: relative;
&.active {
color: #1989FA;
font-weight: 500;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 40rpx;
height: 4rpx;
background: #1989FA;
border-radius: 2rpx;
.tabs {
display: flex;
background-color: #fff;
padding: 20rpx 0;
position: sticky;
top: 0;
z-index: 100;
border-bottom: 1rpx solid #eee;
.tab-item {
flex: 1;
text-align: center;
padding: 20rpx 0;
font-size: 28rpx;
color: #666;
position: relative;
&.active {
color: #1777FF;
font-weight: bold;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 40rpx;
height: 4rpx;
background-color: #1777FF;
border-radius: 2rpx;
}
}
}
}
}
.list-content {
padding: 108rpx 32rpx 32rpx;
}
.visitor-item {
background: #fff;
border-radius: 12rpx;
padding: 24rpx;
margin-bottom: 20rpx;
&:active {
opacity: 0.8;
}
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.visit-time {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.status-tag {
font-size: 24rpx;
padding: 4rpx 12rpx;
border-radius: 4rpx;
&.status-pending {
background: #FFF3E0;
color: #FF9800;
}
&.status-waiting {
background: #E3F2FD;
color: #2196F3;
}
&.status-visited {
background: #E8F5E9;
color: #4CAF50;
}
&.status-cancelled {
background: #EEEEEE;
color: #9E9E9E;
}
}
.info-row {
display: flex;
margin-bottom: 16rpx;
&:last-child {
margin-bottom: 0;
}
.label {
font-size: 26rpx;
color: #666;
width: 140rpx;
flex-shrink: 0;
}
.value {
font-size: 26rpx;
color: #333;
.list-content {
flex: 1;
height: calc(100vh - 100rpx);
padding: 20rpx;
box-sizing: border-box;
}
&.check-reason {
margin-top: 16rpx;
padding-top: 16rpx;
border-top: 1rpx solid #F5F5F5;
.value {
color: #FF4D4F;
.visitor-item {
background-color: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.visit-time {
font-size: 28rpx;
color: #333;
font-weight: bold;
}
.status-tag {
padding: 4rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.status-pending {
background-color: #fff7e6;
color: #fa8c16;
}
&.status-waiting {
background-color: #e6f7ff;
color: #1890ff;
}
&.status-visited {
background-color: #f6ffed;
color: #52c41a;
}
&.status-cancelled {
background-color: #fff1f0;
color: #f5222d;
}
}
}
.item-content {
.info-row {
display: flex;
margin-bottom: 12rpx;
font-size: 26rpx;
.label {
color: #999;
width: 140rpx;
}
.value {
color: #333;
flex: 1;
}
&.check-reason {
.value {
color: #f5222d;
}
}
}
}
.item-footer {
margin-top: 20rpx;
padding-top: 20rpx;
border-top: 1rpx solid #eee;
.btn-group {
display: flex;
justify-content: flex-end;
gap: 20rpx;
.visit-btn, .cancel-btn {
padding: 10rpx 30rpx;
border-radius: 30rpx;
font-size: 26rpx;
}
.visit-btn {
background-color: #1777FF;
color: #fff;
}
.cancel-btn {
background-color: #fff;
color: #666;
border: 1rpx solid #ddd;
}
}
}
}
}
.item-footer {
margin-top: 20rpx;
padding-top: 20rpx;
border-top: 1rpx solid #F5F5F5;
}
.btn-group {
display: flex;
justify-content: flex-end;
gap: 20rpx;
}
.cancel-btn, .visit-btn {
padding: 12rpx 32rpx;
border-radius: 32rpx;
font-size: 26rpx;
&:active {
opacity: 0.8;
.loading, .no-more, .empty {
text-align: center;
padding: 30rpx;
color: #999;
font-size: 26rpx;
}
}
.cancel-btn {
border: 1rpx solid #DCDEE0;
color: #666;
}
.visit-btn {
background: #1989FA;
color: #fff;
}
.loading, .no-more, .empty {
text-align: center;
font-size: 24rpx;
color: #999;
padding: 20rpx 0;
}
</style>
@@ -46,7 +46,7 @@
</view>
<view class="info-row">
<text class="label">拜访原因:</text>
<text class="value">{{ getReasonText(item.description) }}</text>
<text class="value">{{ getReasonText(item.reasonValue) }}</text>
</view>
</view>
<view class="visitor-footer">
+30 -258
View File
@@ -12,7 +12,6 @@
<view class="m-l-30rpx" v-if="state.userInfo?.sysUser?.userId">
<view class="flex-row items-center">
<text class="sub-text-30">{{ state.userInfo?.sysUser?.name }}</text>
<!-- <text class="iconfont icon-youjiantou color-#666666 m-l-20rpx"></text> -->
</view>
<text class="sub-text-26">ID {{ state.userInfo?.sysUser?.userId }}</text>
</view>
@@ -55,7 +54,6 @@ import { hooks, router, constant } from "@@/index"
import { userApi } from "@@/api"
import isDevEnv from "@/sheep/utils/isDevEnv"
import { usePayStore } from "@/sheep/stores/pay"
// import dd from "gdt-jsapi"
const state = reactive<{
wallet: any[]
@@ -65,26 +63,10 @@ const state = reactive<{
icon: string
router: string
}[]
appInfo: string
}>({
wallet: [],
userInfo: {},
menuList: [
// { text: "扫一扫", icon: "/static/icon/scan.png", router: "" },
// { text: "钱包管理", icon: "/static/icon/service_3.png", router: "/pages/wallet/list" },
// { text: "包厢预定", icon: "/static/icon/service_4.png", router: "/pages/boxes/apply-list" },
// { text: "外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" },
// { text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" },
{ text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" },
// { text: "访客", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/index" },
// { text: "访客记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myvisitor" },
// { text: "访客邀约", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitor" },
// { text: "邀约记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitorlist" },
// { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" },
// { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" }
],
appInfo: "",
menuList: [{ text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" }],
})
// 常量
@@ -126,112 +108,6 @@ const storage = {
}
const login = {
// 检查应用环境并登录
checkAppInfo: async () => {
try {
// 先尝试诗画登录
const shihuaResult = await login.shihuaLogin()
if (shihuaResult) return
// 尝试浙政钉登录
const zhengdingResult = login.zhengdingLogin()
if (zhengdingResult) return
uni.showToast({ title: "当前登录环境未知", icon: "none" })
} catch (error) {
console.error("登录失败:", error)
uni.showToast({ title: "登录失败", icon: "none" })
}
},
// 诗画环境登录
shihuaLogin: async () => {
const appInfo = await (window as any).CP2.getAppInfo()
if (appInfo.code == 0) return false
const userInfo = await (window as any).CP2.getUserInfo()
if (userInfo.code == 0) {
uni.showToast({ title: "获取诗画用户信息失败", icon: "none" })
return false
} else {
const { accountId, sessionId } = userInfo.data
return login.doLogin(1, "", accountId, sessionId)
// return login.doLogin(1, "", "67186e49d63fea141aad6772", "67186e49d63fea141aad6776")
}
},
// 浙政钉登录
zhengdingLogin: () => {
const params = new URL(window.location.href).searchParams
const token = params.get("uabaseToken")
if (token) {
return login.doLogin(2, token, "", "")
}
return false
},
// 执行登录操作 - loginType 1:诗画登录 2:浙政钉登录
doLogin: async (loginType: number, token: string, accountId: string, sessionId: string) => {
const tokenStorage = uni.getStorageSync(STORAGE_KEYS.TOKEN)
const userStorage = uni.getStorageSync(STORAGE_KEYS.USER_INFO)
switch (loginType) {
case 1: // 诗画登录
uni.showLoading({ title: "登录中...", mask: true })
const response = await userApi.authsh({ accountId, sessionId })
if (response.code == 0) {
storage.saveToken({ accessToken: response.data.accessToken })
uni.hideLoading()
uni.showToast({ title: "登录成功", icon: "none" })
const { data: userData } = await userApi.userInfo()
storage.saveUserInfo(userData)
} else {
uni.hideLoading()
storage.clearUserStorage()
if (response.msg == "token已失效") {
uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 })
} else {
uni.showToast({ title: response.msg || "登录失败", icon: "none" })
}
}
break
case 2: // 浙政钉登录
if (isEmpty(tokenStorage) || isEmpty(userStorage)) {
try {
uni.showLoading({ title: "登录中...", mask: true })
const res = await userApi.auth(token)
if (res.code == 0) {
storage.saveToken(res.data)
uni.hideLoading()
uni.showToast({ title: "登录成功", icon: "none" })
const { data: userData } = await userApi.userInfo()
storage.saveUserInfo(userData)
} else {
storage.clearUserStorage()
if (res.msg == "token已失效") {
uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 })
} else {
uni.showToast({ title: res.msg || "登录失败", icon: "none" })
}
}
} catch (error) {
uni.showToast({ title: "登录错误", icon: "none" })
} finally {
uni.hideLoading()
}
}
break
default:
uni.showToast({ title: "当前登录环境未知", icon: "none" })
}
},
// 退出登录
logout: async () => {
const isLogin = await hooks.useCheckLogin()
@@ -242,156 +118,52 @@ const login = {
uni.hideLoading()
uni.showToast({ title: "退出登录成功", icon: "none" })
},
// 切换角色
changeRole: () => {
router.jump("/pages/user/userRole")
},
}
const scanCode = {
// 扫一扫
scan: async () => {
usePayStore().setPayData({})
try {
const decodedString = await scanCode.getScanResult()
if (decodedString) {
scanCode.processScanResult(decodedString)
}
// else {
// uni.showToast({ title: "无效的二维码", icon: "none" })
// }
} catch (error: any) {
// if (error) {
// uni.showToast({ title: error, icon: "none" })
// }
}
},
// 获取扫码结果
getScanResult: async (): Promise<string | undefined> => {
if (isDevEnv()) {
// 开发环境模拟扫码
// const testQrCode = "eyJpZCI6IjE4OTYxNTcyMDc2NDQwNTM1MDYiLCJuYW1lIjoi5rWL6K+V5ZWG5oi3In0=" // 线上-测试超市-收款码
// const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 测试环境-邓本地-新县府超市-收款码
const testQrCode = "eyJpZCI6IjE5MDc2ODQwNTY4NDA4NDMyNjYiLCJuYW1lIjoi5pm66IO95p+c6Ieq6JCl5ZWG5oi3MSJ9" // 测试环境-邓本地-智能柜自营商户1-收款码
uni.showToast({ title: "开发环境不是浙政钉环境,扫码仅供测试,收款商家为测试商户超市", icon: "none" })
return scanCode.decodeBase64(testQrCode)
} else if (state.appInfo == "dd") {
// 浙政钉扫码
const res: any = await (window as any).dd.scan({ type: "all" })
return scanCode.decodeBase64(res.text)
} else if (state.appInfo == "sh") {
// 诗画扫码
const res = await (window as any).CP2.showScanQr({ needResult: 1 })
if (res.code == 1) return scanCode.decodeBase64(res.data.qrCode)
} else {
uni.showToast({ title: "当前环境未知", icon: "none" })
}
},
// 处理扫码结果
processScanResult: (decodedString: string) => {
try {
const decodedJson = JSON.parse(decodedString)
if (decodedJson?.id && decodedJson?.name) {
usePayStore().setPayData(decodedJson)
router.jump("/pages/pay/scanPay")
} else {
uni.showToast({ title: "无效的二维码", icon: "none" })
}
} catch (error) {
uni.showToast({ title: "无效的二维码内容", icon: "none" })
}
},
// 解码base64
decodeBase64: (base64String: string): string | undefined => {
try {
const decodedBinaryString = atob(base64String)
const uint8Array = new Uint8Array(decodedBinaryString.length)
for (let i = 0; i < decodedBinaryString.length; i++) {
uint8Array[i] = decodedBinaryString.charCodeAt(i)
}
const decoder = new TextDecoder("utf-8")
const decodedString = decoder.decode(uint8Array)
console.log("解码结果", decodedString)
return decodedString
} catch (error) {
console.error("Base64 解码失败:", error)
uni.showToast({ title: "无效的二维码", icon: "none" })
return undefined
}
},
// 点击登录
const onTabLogin = () => {
uni.navigateTo({
url: "/pages/test/login",
})
}
// const onTabLogin = () => (isDevEnv() ? router.jump("/pages/test/login") : login.checkAppInfo())
const onTabLogin = () => router.jump("/pages/test/login")
const onTabMenu = async (item: any, index: number) => {
if (index == state.menuList.length - 1) {
router.jump(item.router)
return
}
const isLogin = await hooks.useCheckLogin()
if (isLogin) {
if (item.text === "扫一扫") {
await scanCode.scan()
} else {
router.jump(item.router)
}
// 点击菜单
const onTabMenu = (v: any, i: number) => {
if (v.router) {
uni.navigateTo({
url: v.router,
})
}
}
// 退出登录
const doLogout = async () => {
await login.logout()
const doLogout = () => {
uni.showModal({
title: "提示",
content: "确定要退出登录吗?",
success: async (res) => {
if (res.confirm) {
await login.logout()
}
},
})
}
// 切换角色
const doChangeRole = () => {
login.changeRole()
}
// 初始化配置菜单
const initMenuConfig = () => {
// if (isDevEnv()) {
// state.menuList.push({
// text: "测试-登录",
// icon: "/static/icon/login.png",
// router: "/pages/test/login",
// })
// state.menuList.push({
// text: "测试-角色选择",
// icon: "/static/icon/login.png",
// router: "/pages/user/userRole",
// })
// }
}
onLoad(async () => {
const app = getApp()
app._initTabbar()
// 初始化配置菜单
initMenuConfig()
// 获取应用信息
// state.appInfo = await getAppInfo()
onLoad(() => {
storage.getUserInfo()
})
onShow(() => {
// 获取存储中的用户信息
storage.getUserInfo()
})
</script>
<style lang="scss" scoped>
.service_item:not(:last-child) {
padding-bottom: 40rpx;
border-bottom: 1px solid #fafafa;
margin-bottom: 40rpx;
.service_item {
padding: 20rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
}
</style>
+3 -3
View File
@@ -34,10 +34,10 @@ function showLoading(message: string) {
// 读取token并处理Authorization请求头
const getAuthHeader = (tokenStorage: any) => {
if (isDevEnv()) {
// if (isDevEnv()) {
return tokenStorage?.access_token ? `Bearer ${tokenStorage.access_token}` : null
}
return tokenStorage?.accessToken?.tokenValue ? `Bearer ${tokenStorage.accessToken.tokenValue}` : null
// }
// return tokenStorage?.accessToken?.tokenValue ? `Bearer ${tokenStorage.accessToken.tokenValue}` : null
}
// 浙政钉登录 登录成功返回true,否则返回false