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

更新ui设计

上级 37eca898
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
</script>
<style lang="scss">
@import "./static/iconfont/iconfont.css";
......@@ -14,6 +14,8 @@ import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
}
page {
background: #f5f5f5;
background-color: #fbfcff;
position: relative;
font-family: PingFang SC-Regular, PingFang SC;
}
</style>
import request from "@/utils/request"
import request from "@/utils/request";
/**
* @brief 移交预约
......@@ -10,8 +10,8 @@ export const transferReservation = (data: any) => {
"/LQKJ.K3.FileSystem.WebApi.WebApiService.Add,LQKJ.K3.FileSystem.WebApi.common.kdsvc",
"GET",
data
)
}
);
};
/**
* @brief 发送验证码
......@@ -23,7 +23,7 @@ export const verification = (Phone: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.Verification,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
{ Phone }
)
);
/**
* @brief 查询日期时间
......@@ -35,4 +35,36 @@ export const selectDateTime = (data: any) =>
"/LQKJ.K3.FileSystem.WebApi.WebApiService.SelectDateTime,LQKJ.K3.FileSystem.WebApi.common.kdsvc",
"POST",
data
)
);
// 所在页面A:办事指南,B移交,C:查阅,D:存放
export const appointmentConfig = (FLOCATIONPAGECOM: any) =>
request(
"/LQKJ.K3.FileSystem.WebApi.WebApiService.AppointmentConfig,LQKJ.K3.FileSystem.WebApi.common.kdsvc",
"POST",
{ FLOCATIONPAGECOM }
);
// 查询预约
export const selectYuYue = (data: any) =>
request(
"/LQKJ.K3.FileSystem.WebApi.WebApiService.SelectYuYue,LQKJ.K3.FileSystem.WebApi.common.kdsvc",
"POST",
data
);
// 取消预约
export const cancelReservation = (data: any) =>
request(
"/LQKJ.K3.FileSystem.WebApi.WebApiService.CancelReservation,LQKJ.K3.FileSystem.WebApi.common.kdsvc",
"POST",
data
);
// 取消预约
export const attachmentDownLoad = (data: any) =>
request(
"/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.AttachmentDownLoad.common.kdsvc",
"POST",
data
);
......@@ -7,6 +7,7 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
AppointmentTime: typeof import('./components/appointmentTime.vue')['default']
Header: typeof import('./components/header/index.vue')['default']
Reservation: typeof import('./components/reservation/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
......
<template>
<view v-if="timeTitle == '选择预约时间'" class="shadow">
<view class="select-time-title">{{ timeTitle }}</view>
<view class="appointment-month">{{ dayjs().month() + 1 }}</view>
<view class="time-list" style="margin-bottom: 32rpx">
<view
v-for="(item, i) in state.list"
:key="i"
:class="item.active ? 'active' : ''"
class="time-item"
@tap="change(item, i)"
>
<view class="date">{{ dayjs(item.date, "MM-DD").format("DD") }}</view>
<view class="week">{{ item.week }}</view>
<view v-show="item.show" class="rest"></view>
<view v-show="isFull(item)" class="rest full"></view>
</view>
</view>
<view class="line">
<view class="sub-line"></view>
</view>
</view>
<view v-else>
<view class="select-time-title">{{ timeTitle }}</view>
<view class="appointment-month">{{ dayjs().month() + 1 }}</view>
<view class="time-list">
<view
v-for="(item, i) in state.list"
:key="i"
:class="item.active ? 'active' : ''"
class="time-item"
@tap="change(item, i)"
>
<view class="date">{{ dayjs(item.date, "MM-DD").format("DD") }}</view>
<view class="week">{{ item.week }}</view>
<view v-show="item.show" class="rest"></view>
<view v-show="isFull(item)" class="rest full"></view>
</view>
</view>
</view>
<view :style="{ padding: timeTitle == '选择预约时间' ? '0 50rpx' : '' }">
<view class="time-btn">
<u-button
:hair-line="false"
shape="circle"
hover-class="none"
:class="state.isDate ? 'active' : ''"
@tap="btnChange('morning')"
>上午</u-button
>
<u-button
:hair-line="false"
shape="circle"
hover-class="none"
:class="state.isDate ? '' : 'active'"
@tap="btnChange('afternoon')"
>下午</u-button
>
</view>
<view class="date-list">
<view
v-for="(item, index) in appointmentTime"
:key="index"
class="date-item"
:style="{
backgroundColor: item.FEntryID === state.FEntryID ? '#DDF3FF' : '',
}"
@tap="gridItem(item)"
>
<view class="time">{{ item.Time }}</view>
<view
class="time-detail"
:style="{ color: item.FREMAINDERNUMBER ? '' : '#999999' }"
>{{ item.FREMAINDERNUMBER ? "可预约" : "已约满" }}</view
>
</view>
</view>
<view v-show="wxtsPrompt" class="wxti-prompt">
<view class="wxti-prompt-detail">温馨提示:</view>
<view class="wxti-prompt-detail">{{ wxtsPrompt }}</view>
</view>
<u-button class="confirm-btn" type="primary" @tap="onConfirm"
>立即预约</u-button
>
<view v-show="show" class="prompt">
<view class="prompt-title">温馨提示:</view>
<view class="prompt-detail">{{ prompt }}</view>
</view>
</view>
</template>
<script setup lang="ts">
import dayjs from "dayjs";
const props = defineProps({
timeTitle: {
type: String,
default: "",
},
show: Boolean,
prompt: String,
wxtsPrompt: String,
current: {
type: Number,
default: 0,
},
disabled: {
type: Boolean,
default: false,
},
btnDisable: {
type: Boolean,
default: false,
},
});
const emits = defineEmits(["change", "onConfirm"]);
const state = reactive({
current: 0,
isDate: true,
FEntryID: null,
list: [] as any,
});
const appointmentTime = computed(() => {
return (
(state.isDate
? state.list[state.current]?.morning
: state.list[state.current]?.afternoon) || []
);
});
const isFull = (row: any) => {
return (
row.afternoon.some((item: any) => {
item.FREMAINDERNUMBER > 0;
}) &&
row.morning.some((item: any) => {
item.FREMAINDERNUMBER > 0;
})
);
};
const change = (item: any, index: number) => {
if (item.active || item.show) return;
state.FEntryID = null;
emits("change", "");
state.current = index;
state.list.forEach((item: any, i: number) => {
if (i === index) item.active = true;
else item.active = false;
});
};
const btnChange = (type: string) => {
// console.log(state.list);
if (type === "morning") state.isDate = true;
else state.isDate = false;
state.FEntryID = null;
};
const gridItem = (item: any) => {
if (item.FREMAINDERNUMBER <= 0) return;
if (state.FEntryID === item.FEntryID) return;
emits("change", item);
state.FEntryID = item.FEntryID;
};
const onConfirm = () => emits("onConfirm");
defineExpose({
...toRefs(state),
});
</script>
<style lang="scss" scoped>
.shadow {
position: sticky;
top: 0;
left: 0;
z-index: 99;
width: 100%;
// height: 244rpx;
padding: 40rpx 50rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 30rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 0rpx 0rpx 30rpx 30rpx;
margin-bottom: 48rpx;
.line {
width: 100%;
display: flex;
justify-content: center;
.sub-line {
width: 80rpx;
height: 0rpx;
text-align: center;
border: 4rpx solid rgba(153, 153, 153, 0.6);
}
}
}
.select-time-title {
text-align: center;
height: 40rpx;
font-size: 32rpx;
font-weight: 400;
color: #222222;
line-height: 40rpx;
// margin-top: 32rpx;
margin-bottom: 16rpx;
}
.appointment-month {
height: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #222222;
line-height: 40rpx;
margin-bottom: 24rpx;
}
.time-list {
height: 92rpx;
display: flex;
box-sizing: border-box;
margin-bottom: 48rpx;
.time-item {
position: relative;
flex-basis: calc(100% / 7);
font-size: 20rpx;
height: 92rpx;
background: #f2f2f2;
border-radius: 8rpx;
margin-right: 20rpx;
color: #222222;
padding: 10rpx 0 8rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
.date {
font-size: 28rpx;
font-weight: 500;
}
.week {
font-size: 400;
}
.rest {
position: absolute;
top: -2%;
right: 3%;
font-size: 20rpx;
color: #5363ff;
transform: scale(0.8);
}
.full {
color: #ff3333;
}
}
& .time-item:last-child {
margin-right: 0;
}
}
.time-btn {
// display: flex;
// justify-content: flex-start;
text-align: center;
.u-btn {
display: inline-block;
text-align: center;
width: 152rpx;
height: 64rpx;
line-height: 64rpx;
background: #f2f2f2;
border: 0;
margin-right: 52rpx;
}
}
.date-list {
min-height: 124rpx;
display: flex;
flex-wrap: wrap;
margin-top: 48rpx;
.date-item {
flex-basis: calc(100% / 3 - 16rpx);
display: flex;
height: 124rpx;
flex-direction: column;
align-items: center;
justify-content: space-between;
margin-right: 24rpx;
margin-bottom: 12rpx;
padding: 24rpx 0;
background: #ffffff;
box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 0, 0, 0.02);
border-radius: 8rpx;
.time {
font-size: 28rpx;
font-weight: 400;
color: #222222;
}
.time-detail {
font-size: 24rpx;
font-weight: 400;
color: #05a8ff;
}
}
& .date-item:nth-child(3n) {
margin-right: 0;
}
}
.confirm-btn {
height: 98rpx;
background: #05a8ff;
border-radius: 16rpx;
margin-top: 84rpx;
}
.wxti-prompt {
height: 84rpx;
margin-top: 48rpx;
.wxti-prompt-detail {
height: 36rpx;
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 36rpx;
}
}
</style>
......@@ -73,7 +73,7 @@
</template>
<script setup lang="ts">
import { toast } from "@/utils/util"
import { toast } from "@/utils/util";
const props = defineProps({
list: {
......@@ -92,13 +92,13 @@ const props = defineProps({
type: Boolean,
default: false,
},
})
});
const emits = defineEmits(["change", "onConfirm"])
const emits = defineEmits(["change", "onConfirm"]);
const uniA: any = uni
const isDate: any = ref(true)
const FID = ref()
const uniA: any = uni;
const isDate: any = ref(true);
const FID = ref();
const state = reactive({
list: props.list as any,
......@@ -115,7 +115,7 @@ const state = reactive({
barWidth: 70,
id: uniA.$u.guid(),
isDate: true,
})
});
const tabBarStyle = computed(() => {
let style = {
......@@ -126,74 +126,74 @@ const tabBarStyle = computed(() => {
"background-color": state.activeColor,
height: state.barHeight + "rpx",
"border-radius": `${state.barHeight / 2}px`,
} as any
return style
})
} as any;
return style;
});
const appointmentTime = computed(() => {
return isDate.value
? state.list[state.current]?.morning
: state.list[state.current]?.afternoon
})
: state.list[state.current]?.afternoon;
});
const change = (item: any, index: number) => {
if (index == state.current) return
FID.value = null
emits("change", "")
state.current = index
if (index == state.current) return;
FID.value = null;
emits("change", "");
state.current = index;
state.list.map((item: any, i: number) => {
if (index === i) {
item.color = "#2979ff"
item.color = "#2979ff";
} else {
item.color = ""
item.color = "";
}
})
}
});
};
const btnChange = (type: string) => {
if (type === "morning") isDate.value = true
else isDate.value = false
}
if (type === "morning") isDate.value = true;
else isDate.value = false;
};
const onConfirm = () => emits("onConfirm")
const onConfirm = () => emits("onConfirm");
const gridItem = (item: any) => {
if (item.FREMAINDERNUMBER <= 0) return
if (props.disabled) return toast("请先完成第一步")
if (FID.value === item.FID) return
emits("change", item)
FID.value = item.FID
}
if (item.FREMAINDERNUMBER <= 0) return;
if (props.disabled) return toast("请先完成第一步");
if (FID.value === item.FID) return;
emits("change", item);
FID.value = item.FID;
};
// 滚动scroll-view,让活动的tab处于屏幕的中间位置
const scrollByIndex = () => {
// 当前活动tab的布局信息,有tab菜单的width和left(为元素左边界到父元素左边界的距离)等信息
let tabInfo: any = state.tabQueryInfo[state.current]
if (!tabInfo) return
let tabInfo: any = state.tabQueryInfo[state.current];
if (!tabInfo) return;
// 当前活动item的中点点到左边的距离减去滑块宽度的一半,即可得到滑块所需的移动距离
let left = tabInfo.left + tabInfo.width / 2 - state.parentLeft
let left = tabInfo.left + tabInfo.width / 2 - state.parentLeft;
// 计算当前活跃item到组件左边的距离
state.scrollBarLeft = left - uni.upx2px(state.barWidth) / 2
state.scrollBarLeft = left - uni.upx2px(state.barWidth) / 2;
if (state.barFirstTimeMove == true) {
setTimeout(() => {
state.barFirstTimeMove = false
}, 100)
state.barFirstTimeMove = false;
}, 100);
}
}
};
watch(
() => state.current,
() => {
nextTick(() => {
scrollByIndex()
})
scrollByIndex();
});
},
{ immediate: true }
)
);
const getTabRect = () => {
// 创建节点查询
let query: any = uni.createSelectorQuery().in(this)
let query: any = uni.createSelectorQuery().in(this);
// 历遍所有tab,这里是执行了查询,最终使用exec()会一次性返回查询的数组结果
for (let i = 0; i < state.list.length; i++) {
......@@ -201,32 +201,32 @@ const getTabRect = () => {
query.select(`#tab-item-${i}`).fields({
size: true,
rect: true,
})
});
}
// 执行查询,一次性获取多个结果
query.exec(
function (res: any) {
state.tabQueryInfo = res
state.tabQueryInfo = res;
// 初始化滚动条和移动bar的位置
scrollByIndex()
scrollByIndex();
}.bind(this)
)
}
);
};
const init = async () => {
// 获取tabs组件的尺寸信息
let tabRect = await uniA.$u.getRect("#" + state.id)
let tabRect = await uniA.$u.getRect("#" + state.id);
// tabs组件距离屏幕左边的宽度
state.parentLeft = tabRect.left
state.parentLeft = tabRect.left;
// tabs组件的宽度
state.componentWidth = tabRect.width
getTabRect()
}
state.componentWidth = tabRect.width;
getTabRect();
};
defineExpose({
...toRefs(state),
init,
})
});
</script>
<style lang="scss" scoped>
......
......@@ -10,19 +10,21 @@
{
"path": "pages/transfer/index",
"style": {
"navigationBarTitleText": "档案移交预约"
"navigationBarTitleText": "档案移交预约",
"navigationStyle": "custom"
}
},
{
"path": "pages/refer/index",
"path": "pages/deposit/index",
"style": {
"navigationBarTitleText": "档案查阅预约"
"navigationBarTitleText": "档案存放预约",
"navigationStyle": "custom"
}
},
{
"path": "pages/deposit/index",
"path": "pages/refer/index",
"style": {
"navigationBarTitleText": "档案存放预约"
"navigationBarTitleText": "档案查阅预约"
}
},
{
......@@ -30,6 +32,38 @@
"style": {
"navigationBarTitleText": "档案移交预约"
}
},
{
"path": "pages/refer/referReservation",
"style": {
"navigationBarTitleText": "档案查阅预约"
}
},
{
"path": "pages/workGuide/index",
"style": {
"navigationBarTitleText": "办事指南",
"navigationStyle": "custom"
}
},
{
"path": "pages/workGuide/lookAll",
"style": {
"navigationBarTitleText": "查看全部"
}
},
{
"path": "pages/workGuide/lookAttr",
"style": {
"navigationBarTitleText": "查看地址"
}
},
{
"path": "pages/myReservation/index",
"style": {
"navigationBarTitleText": "我的预约",
"navigationStyle": "custom"
}
}
],
"globalStyle": {
......
<template>
<view class="bg-header">
<u-image
src="@/static/img/Frame812.png"
width="100%"
height="100%"
border-radius="15"
/>
</view>
<view class="logo">
<u-image :src="LOGO" width="60%" height="300rpx;" border-radius="15" />
<u-image
src="@/static/img/logo.png"
width="100%"
height="240rpx"
border-radius="15"
/>
<view class="logo-detail">档案存放查询</view>
</view>
<view class="container">
<u-form :model="data.formData" ref="form" label-width="150">
<u-form-item prop="name"
><u-input v-model="data.formData.name" placeholder="请输入档案人姓名"
/></u-form-item>
<u-form-item prop="idCard"
><u-input v-model="data.formData.idCard" placeholder="请输入身份证"
/></u-form-item>
</u-form>
<view class="footer">
<u-button @click="submit" size="medium" type="primary">查询</u-button>
<view class="content">
<u-form :model="data.formData" ref="form">
<u-form-item prop="name" :border-bottom="false"
><u-input v-model="data.formData.name" placeholder="请输入档案人姓名"
/></u-form-item>
<u-form-item prop="idCard" :border-bottom="false"
><u-input
v-model="data.formData.idCard"
placeholder="请输入档案人身份证"
/></u-form-item>
</u-form>
<view class="footer">
<u-button @click="submit" size="medium" type="primary">查询</u-button>
</view>
</view>
<view v-show="data.promptStr" class="prompt">
<view class="prompt-title">温馨提示:</view>
<view class="prompt-detail">{{ data.promptStr }}</view>
</view>
</view>
<view class="bg-footer">
<u-image
src="@/static/img/Maskgroup.png"
width="100%"
height="100%"
border-radius="15"
/>
</view>
</template>
<script setup lang="ts">
import { zalert } from "@/utils/util"
import { LOGO } from "@/utils/example"
import { depositReservation } from "@/api/deposit"
import { depositReservation } from "@/api/deposit";
const form = ref()
const uniA: any = uni
const form = ref();
const uniA: any = uni;
const data = reactive({
formData: {
name: "",
......@@ -46,7 +74,7 @@ const data = reactive({
},
{
validator: (rule: any, value: any, callback: any) => {
return uniA.$u.test.idCard(value)
return uniA.$u.test.idCard(value);
},
message: "身份证号不正确",
trigger: ["change", "blur"],
......@@ -63,60 +91,64 @@ const data = reactive({
],
tips: "",
codeDisabled: false,
})
promptStr: "",
});
onReady(() => {
form.value.setRules(data.rules)
})
form.value.setRules(data.rules);
});
const submit = () =>
form.value.validate(async (valid: boolean) => {
if (valid) {
const { data: res } = await depositReservation(data.formData)
zalert(res.msg)
const { data: res } = await depositReservation(data.formData);
data.promptStr = res.msg;
}
})
});
</script>
<style lang="scss" scoped>
page {
background-image: url("https://img2.baidu.com/it/u=460732253,1892860896&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=888");
background-size: cover;
/* 背景图片自适应屏幕大小 */
/* 其他样式设置 */
}
:deep(.uni-page-head-hd) {
display: none;
}
.container {
padding: 30rpx;
position: absolute;
top: 18%;
left: 5%;
width: 90vw;
background-color: #fff;
border-radius: 15rpx;
.contact {
text-align: center;
margin-top: 20rpx;
color: #fa3534;
font-size: 24rpx;
}
top: 492rpx;
left: 12.27%;
width: 568rpx;
opacity: 1;
.footer {
display: flex;
margin-top: 30rpx;
.content {
height: 372rpx;
.contact {
text-align: center;
margin-top: 20rpx;
color: #fa3534;
font-size: 24rpx;
}
:deep(.u-form-item) {
position: relative;
margin-bottom: 48rpx;
background: #ffffff;
padding: 10rpx 36rpx;
box-shadow: 0rpx 8rpx 60rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 16rpx 16rpx 16rpx 16rpx;
opacity: 1;
}
:deep(.u-form-item__message) {
position: absolute;
bottom: -38rpx;
left: -60rpx;
}
.footer {
height: 84rpx;
.u-btn {
width: 100%;
height: 100%;
background-color: #04a7ff;
}
}
}
}
.logo {
display: flex;
justify-content: center;
width: 100%;
height: 100px;
padding-top: 80rpx;
}
</style>
<template>
<view class="bg">
<view class="container">
<view class="my-title">我的预约</view>
<view class="my-content">
<u-tabs
:list="state.list"
:is-scroll="false"
v-model="state.current"
@change="change"
></u-tabs>
<view class="my-list">
<view
v-for="item in list"
:key="item.FID"
class="my-item"
:style="{
backgroundColor: state.FID === item.FID ? '#DDF3FF' : '',
}"
@tap="tapItem(item.FID)"
>
<view class="my-item-left">
<view class="my-time"
>{{ item.WeekdayName }} {{ item.MinDatetime }}</view
>
<view class="my-date">{{
dayjs(item.Date).format("YYYY.MM.DD")
}}</view>
</view>
<view class="my-item-right">{{ item.FHANDLESTATES }}</view>
</view>
</view>
<u-button class="confirm-btn" type="primary" @tap="onConfirm"
>取消预约</u-button
>
</view>
<view class="prompt">
<view class="prompt-title">温馨提示:</view>
<view class="prompt-detail">{{ paramsData?.WXTS?.FCONTENT }}</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import dayjs from "dayjs";
import {
appointmentConfig,
selectYuYue,
cancelReservation,
} from "../../api/transfer";
import { toast, zconfirm } from "@/utils/util";
const state = reactive({
list: [
{
name: "档案查阅",
},
{
name: "档案移交",
},
],
current: 0,
FID: "",
});
const paramsData = ref({} as any);
const list = ref([] as any);
const tapItem = (id: string) => {
if (state.FID === id) return (state.FID = "");
state.FID = id;
};
const change = (e: any) => {
state.current = e;
init();
};
const onConfirm = async () => {
if (!state.FID) return;
zconfirm("确定取消预约?", async (result: boolean) => {
if (result) {
const { data: res } = await cancelReservation({
Fid: state.FID,
Type: state.current,
});
if (res.code === 200) {
console.log(res);
init();
toast("取消预约成功");
}
}
});
};
const initAppointmentConfig = async () => {
const { data: res } = await appointmentConfig("H");
if (res.code === 200) {
if (res.code === 200) {
res.data.forEach((item: any) => {
if (item.hasOwnProperty("WXTS")) {
paramsData.value.WXTS = item.WXTS[0];
}
});
console.log(paramsData.value);
}
}
};
const init = async () => {
console.log(state.current);
const { data: res } = await selectYuYue({
Phone: "18874693873",
Type: state.current,
});
console.log(res);
if (res.code == 200) {
list.value = res.data;
}
};
onMounted(async () => {
await init();
await initAppointmentConfig();
});
</script>
<style lang="scss" scoped>
.bg {
background-color: #05a8ff;
padding-top: 8vh;
}
.container {
position: sticky;
background: #fbfcff;
padding: 40rpx 50rpx;
border-radius: 80rpx 80rpx 0rpx 0rpx;
height: 92vh;
background-color: #fff;
box-sizing: border-box;
.my-title {
width: 100%;
height: 40rpx;
font-size: 32rpx;
font-weight: 400;
color: #222222;
line-height: 40rpx;
margin-bottom: 48rpx;
text-align: center;
padding: 0 20rpx;
}
.my-content {
width: 100%;
text-align: center;
.my-list {
margin-top: 48rpx;
overflow-y: auto;
min-height: 255rpx;
max-height: 780rpx;
.my-item {
padding: 24rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: #ffffff;
box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 0, 0, 0.03);
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin-bottom: 32rpx;
.my-item-left {
width: 148rpx;
height: 72rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
.my-time {
height: 32rpx;
}
.my-date {
width: 148rpx;
height: 32rpx;
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 32rpx;
}
}
.my-item-right {
font-size: 28rpx;
font-weight: 400;
color: #222222;
}
}
}
}
}
.confirm-btn {
height: 98rpx;
background: #05a8ff;
border-radius: 16rpx;
margin-top: 84rpx;
}
</style>
差异被折叠。
差异被折叠。
<template>
<appointmentTime
ref="appointmentTimeRef"
time-title="选择预约时间"
:show="!state.isReservation"
:prompt="state.paramsData?.WXTSX?.FCONTENT"
:wxts-prompt="state.paramsData?.WXTSS?.FCONTENT"
@change="reservationChange"
@on-confirm="onConfirm"
/>
</template>
<script setup lang="ts">
import { selectDateTime, appointmentConfig } from "@/api/transfer";
import { referReservation } from "@/api/refer";
import { zconfirm, toast } from "@/utils/util";
import { useGlobalStore } from "@/store/useStore";
import appointmentTime from "@/components/appointmentTime.vue";
const globalStore = useGlobalStore();
// pages/refer/referReservation
const appointmentTimeRef = ref();
const state = reactive({
paramsData: {} as any,
parmeters: {} as any,
isReservation: false,
fid: "",
});
const list = ref([] as any);
// 选择日期
const reservationChange = (data: any) => {
state.fid = data.FEntryID;
};
// 预约
const onConfirm = () => {
if (!state.fid) return toast("选择预约时间");
zconfirm("确认预约?", async (result: boolean) => {
if (result) {
let params: any = globalStore.referData || "{}";
params.FEntryID = state.fid;
params.Model.FDAPhoneNumber = params.Model.FPhoneNumber;
params.Model.FReferToType = "本人查阅" ? "0" : "1";
params.Model.FReservationQty = "本人查阅"
? 0
: params.Model.FReservationQty;
console.log(params, "params");
const { data: res } = await referReservation({
parmeters: JSON.stringify(params),
});
if (res.code === 200) {
state.isReservation = true;
toast("查阅预约成功");
}
}
});
};
const initAppointmentConfig = async () => {
const { data: res } = await appointmentConfig("I");
if (res.code === 200) {
res.data.forEach((item: any) => {
if (item.hasOwnProperty("WXTSS")) {
state.paramsData.WXTSS = item.WXTSS[0];
}
if (item.hasOwnProperty("WXTSX")) {
state.paramsData.WXTSX = item.WXTSX[0];
}
});
console.log(state.paramsData);
}
};
// 初始化数据
const init = async () => {
let data = {
typeO: "CYYY", // CYYY:查询预约,YJYY:移交预约
};
const { data: res } = await selectDateTime(data);
if (res.code === 200) {
list.value = [];
let flag = true;
res.data.slice(0, 7).map((item: any, i: number) => {
list.value.push({
active: flag && item.FISRESTDAYS === "0" ? true : false,
week: item.WeekdayName,
date: item.Date,
show: item.FISRESTDAYS === "1" ? true : false,
morning: item.data.filter((el: any) => el.TimeType == "0"),
afternoon: item.data.filter((el: any) => el.TimeType == "1"),
});
if (item.FISRESTDAYS === "0") {
appointmentTimeRef.value.current = i;
flag = false;
}
});
appointmentTimeRef.value.list = list.value;
initAppointmentConfig();
// console.log(list.value);
}
};
init();
</script>
<style scoped></style>
<template>
<view class="container">
<u-section
title="第一步:请导入《南山区国有企业退休人员移交人事档案名单汇总表》EXCEL电子版"
:right="false"
style="margin: 20rpx 0"
></u-section>
<u-button
:type="!fileUrl ? 'primary' : 'success'"
size="mini"
style="width: 100%"
@tap="uploadFile"
>{{ !fileUrl ? "导入汇总表格" : "导入汇总表格(已导入)" }}</u-button
<view class="import-title"
>请导入《南山区国有企业退休人员移交人事档案名单汇总表》EXCEL电子版</view
>
<u-section
title="第二步:选择预约时间"
:right="false"
style="margin: 50rpx 0 20rpx 0"
></u-section>
<reservationVue
v-if="flag"
ref="reservationRef"
:list="list"
:disabled="state.disabled"
@change="reservationChange"
/>
<view class="import-btn">
<u-button @tap="uploadFile" size="medium" type="primary">{{
!fileUrl ? "导入汇总表格" : "导入汇总表格(已导入)"
}}</u-button>
</view>
<u-section
title="预约备注"
:right="false"
style="margin: 50rpx 0 10rpx 0"
:show-line="false"
></u-section>
<u-input
v-model="state.remark"
type="textarea"
height="200"
:placeholder-style="{ background: '#fff' }"
/>
<u-button type="primary" style="margin-top: 50rpx" @tap="onConfirm"
>立即预约</u-button
<view class="import-prompt"
>温馨提示:{{ state.paramsData?.WXTSS?.FCONTENT }}</view
>
<appointmentTime
ref="appointmentTimeRef"
time-title="选择上门时间"
:show="state.isReservation"
:prompt="state.paramsData?.WXTSX?.FCONTENT"
@change="reservationChange"
@on-confirm="onConfirm"
/>
</view>
</template>
<script setup lang="ts">
import { baseUrl } from "@/utils/request"
import { useGlobalStore } from "@/store/useStore"
import { hLoading, sLoading, toast, zconfirm } from "@/utils/util"
import { selectDateTime } from "@/api/transfer"
import reservationVue from "@/components/reservation/index.vue"
const uniA: any = uni
const globalStore = useGlobalStore()
const list = ref([] as any)
const flag = ref(true)
const fileUrl = ref()
import { baseUrl } from "@/utils/request";
import { useGlobalStore } from "@/store/useStore";
import { hLoading, sLoading, toast, zconfirm } from "@/utils/util";
import { selectDateTime, appointmentConfig } from "@/api/transfer";
import appointmentTime from "@/components/appointmentTime.vue";
const uniA: any = uni;
const globalStore = useGlobalStore();
const list = ref([] as any);
const fileUrl = ref();
const state = reactive({
current: 0,
barFirstTimeMove: true,
......@@ -69,11 +49,12 @@ const state = reactive({
barWidth: 70,
id: uniA.$u.guid(),
isDate: true,
disabled: true,
fid: undefined,
})
paramsData: {} as any,
isReservation: false,
});
const reservationRef = ref()
const appointmentTimeRef = ref();
const uploadFile = () => {
uni.chooseFile({
......@@ -81,28 +62,28 @@ const uploadFile = () => {
extension: ["xls", "xlsx"],
success(res: any) {
if (res.errMsg == "chooseFile:ok") {
fileUrl.value = res.tempFilePaths[0]
state.disabled = false
fileUrl.value = res.tempFilePaths[0];
}
},
})
}
});
};
// 选择日期
const reservationChange = (data: any) => {
state.fid = data.FID
}
state.fid = data.FEntryID;
};
// 预约
const onConfirm = () => {
if (!state.fid || !fileUrl.value) return toast("请先完成步骤")
if (!state.fid) return toast("请选择上门时间");
if (!fileUrl.value) return toast("请导入excel");
zconfirm("确认预约?", (result: boolean) => {
if (result) {
sLoading()
upload(0)
sLoading();
upload(0);
}
})
}
});
};
const upload = (type: number) => {
uni.uploadFile({
......@@ -112,63 +93,108 @@ const upload = (type: number) => {
filePath: fileUrl.value,
formData: {
parmeters: JSON.stringify(globalStore.transferData),
fid: state.fid,
FEntryID: state.fid,
type,
},
success: (uploadFileRes: any) => {
const res = JSON.parse(uploadFileRes.data)
const res = JSON.parse(uploadFileRes.data);
if (res.code === 200) {
flag.value = false
setTimeout(() => {
init()
toast("预约成功")
}, 300)
state.isReservation = true;
// init();
toast("预约成功");
} else if (res.code === 402) {
zconfirm(res.msg, (e: boolean) => {
if (e) {
upload(1)
upload(1);
}
})
} else toast(res.msg)
hLoading()
});
} else toast(res.msg);
hLoading();
},
})
}
});
};
const initAppointmentConfig = async () => {
const { data: res } = await appointmentConfig("D");
if (res.code === 200) {
res.data.forEach((item: any) => {
if (item.hasOwnProperty("WXTSS")) {
state.paramsData.WXTSS = item.WXTSS[0];
}
if (item.hasOwnProperty("WXTSX")) {
state.paramsData.WXTSX = item.WXTSX[0];
}
});
console.log(state.paramsData);
}
};
// 初始化数据
const init = async () => {
let data = {
typeO: "YJYY", // CYYY:查询预约,YJYY:移交预约
}
const { data: res } = await selectDateTime(data)
};
const { data: res } = await selectDateTime(data);
if (res.code === 200) {
list.value = []
res.data.map((item: any) => {
list.value = [];
let flag = true;
res.data.slice(0, 7).map((item: any, i: number) => {
list.value.push({
active: flag && item.FISRESTDAYS === "0" ? true : false,
week: item.WeekdayName,
date: item.Date,
show: item.FISRESTDAYS === "1" ? true : false,
color: "",
morning: item.data.filter((el: any) => !el.type),
afternoon: item.data.filter((el: any) => el.type),
})
})
flag.value = true
morning: item.data.filter((el: any) => el.TimeType == "0"),
afternoon: item.data.filter((el: any) => el.TimeType == "1"),
});
if (item.FISRESTDAYS === "0") {
appointmentTimeRef.value.current = i;
flag = false;
}
});
appointmentTimeRef.value.list = list.value;
initAppointmentConfig();
console.log(list.value);
}
}
};
onMounted(async () => {
init()
setTimeout(() => {
reservationRef.value.list = list.value
reservationRef.value.init()
}, 200)
})
init();
});
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx 20rpx 0;
padding: 48rpx 52rpx 0;
.import-title {
font-size: 28rpx;
font-weight: 400;
color: #222222;
line-height: 33rpx;
-webkit-background-clip: text;
margin-bottom: 32rpx;
}
.import-btn {
height: 84rpx;
.u-btn {
width: 100%;
height: 100%;
background-color: #04a7ff;
}
}
.import-prompt {
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 36rpx;
margin-top: 24rpx;
margin-bottom: 60rpx;
text-align: center;
}
.flex-container {
position: relative;
display: flex;
......
<template>
<view class="guide-container">
<view class="guide-header">
<view class="guide-title">{{
appointmentConfigType(data?.CLQD?.FRONTENDFIELDS)
}}</view>
<view class="guide-detail">{{ data?.CLQD?.FCONTENT }}</view>
<view class="guide-button">
<u-button
class="custom-style"
shape="circle"
:hair-line="false"
@tap="toLookAll"
>查看全部</u-button
>
</view>
</view>
<view class="guide-map">
<u-image
src="@/static/img/Frame545.png"
width="100%"
height="160rpx"
border-radius="8"
/>
<view class="guide-button" style="margin-top: 32rpx">
<u-button
class="custom-style"
shape="circle"
:hair-line="false"
@tap="toLookAttr"
>查看地址</u-button
>
</view>
</view>
<view class="guide-down-temp">
<view class="down-temp" v-for="(item, index) in data?.MB" :key="index">
<view class="down-temp-title">{{ item.FILENAME.split(".")[0] }}</view>
<u-image
src="../../static/img/Slice.png"
width="44rpx"
height="44rpx"
@tap="downFile(item)"
/>
</view>
</view>
<slot></slot>
</view>
</template>
<script setup lang="ts">
import { appointmentConfigType, toast, zconfirm } from "@/utils/util";
import { attachmentDownLoad } from "@/api/transfer";
import { baseUrl } from "@/utils/request";
const props = defineProps({
title: String,
data: Object,
});
const toLookAll = () => {
uni.navigateTo({ url: "/pages/workGuide/lookAll?title=" + props.title });
};
const toLookAttr = () => {
uni.navigateTo({ url: "/pages/workGuide/lookAttr" });
};
const downFile = async (row: any) => {
zconfirm(`确定下载${row.FILENAME}`, (result: boolean) => {
if (result) {
try {
const url = baseUrl + "/" + row.FILEPATH;
const a = document.createElement("a");
a.href = url;
a.download = row.FILENAME;
a.click();
} catch (error) {
toast("下载失败");
}
}
});
};
</script>
<style lang="scss" scoped>
.guide-container {
position: absolute;
top: 480rpx;
width: 690rpx;
padding-top: 40rpx;
border-radius: 24rpx;
padding-bottom: 198rpx;
.guide-button {
width: 100%;
.custom-style {
width: 160rpx;
height: 60rpx;
color: #05a8ff;
border: 2rpx solid #05a8ff;
}
}
.guide-header {
padding: 32rpx;
// width: 622rpx;
width: 100%;
// height: 268rpx;
background-color: #ffffff;
.guide-title {
width: 288rpx;
height: 50rpx;
font-size: 36rpx;
font-weight: 400;
color: #222222;
line-height: 42rpx;
-webkit-background-clip: text;
}
.guide-detail {
width: 622rpx;
height: 186rpx;
font-size: 32rpx;
font-weight: 400;
color: #666666;
line-height: 48rpx;
overflow-y: auto;
}
}
.guide-map {
margin-top: 72rpx;
}
.guide-down-temp {
margin-top: 32rpx;
padding: 32rpx;
width: 686rpx;
background: #ffffff;
border-radius: 24rpx;
.down-temp {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 24rpx;
.down-temp-title {
width: 80%;
font-size: 32rpx;
font-weight: 400;
color: #222222;
line-height: 36rpx;
}
}
}
}
</style>
<template>
<view class="bg-header">
<u-image
src="@/static/img/Frame812.png"
width="100%"
height="100%"
border-radius="15"
/>
</view>
<view style="margin: 0 30rpx">
<view class="logo">
<u-image
src="@/static/img/logo.png"
width="100%"
height="240rpx"
border-radius="15"
/>
<view class="logo-detail">{{ title }}</view>
</view>
<slot name="body"></slot>
<guide v-if="show" :data="data" :title="title">
<template #default><slot /></template>
</guide>
</view>
</template>
<script setup lang="ts">
defineProps({
title: String,
data: Object,
show: {
type: Boolean,
default: true,
},
});
import guide from "./guide.vue";
</script>
<style scoped></style>
<template>
<workGuide :data="data.paramsData" :title="data.title" :show="false">
<template #body>
<view class="lookAll">
<view class="card" style="padding-top: 40rpx">
<view class="lookAll-title">材料清单:</view>
<view
v-html="data.paramsData?.CLQD?.FCONTENT"
class="lookAll-detail"
></view>
<view class="lookAll-title">办事指南:</view>
<view
v-html="data.paramsData?.BSZN?.FCONTENT"
class="lookAll-detail"
></view>
<view class="lookAll-title">档案要求:</view>
<view
v-html="data.paramsData?.DAYQ?.FCONTENT"
class="lookAll-detail"
></view>
<view class="lookAll-title">办理材料:</view>
<view
v-html="data.paramsData?.BLCL?.FCONTENT"
class="lookAll-detail"
></view>
</view>
</view>
</template>
</workGuide>
</template>
<script setup lang="ts">
import { appointmentConfig } from "@/api/transfer";
import { formattedText } from "@/utils/util";
import workGuide from "@/pages/workGuide/index.vue";
const data = reactive({
paramsData: {} as any,
title: "",
});
const init = async () => {
const { data: res } = await appointmentConfig(
data.title === "档案移交预约" ? "G" : "F"
);
if (res.code === 200) {
res.data.forEach((item: any) => {
if (item.hasOwnProperty("BLCL")) {
data.paramsData.BLCL = item.BLCL[0];
data.paramsData.BLCL.FCONTENT = formattedText(
data.paramsData.BLCL.FCONTENT
);
// console.log(data.paramsData.BLCL.FCONTENT);
}
if (item.hasOwnProperty("BSZN")) {
data.paramsData.BSZN = item.BSZN[0];
data.paramsData.BSZN.FCONTENT = formattedText(
data.paramsData.BSZN.FCONTENT
);
}
if (item.hasOwnProperty("CLQD")) {
data.paramsData.CLQD = item.CLQD[0];
data.paramsData.CLQD.FCONTENT = formattedText(
data.paramsData.CLQD.FCONTENT
);
}
if (item.hasOwnProperty("DAYQ")) {
data.paramsData.DAYQ = item.DAYQ[0];
data.paramsData.DAYQ.FCONTENT = formattedText(
data.paramsData.DAYQ.FCONTENT
);
}
});
}
};
onLoad((options: any) => {
data.title = options.title;
init();
});
</script>
<style lang="scss" scoped>
.lookAll {
position: absolute;
top: 492rpx;
padding-bottom: 72rpx;
.lookAll-title {
font-size: 36rpx;
font-weight: 400;
color: #222222;
margin-bottom: 16rpx;
}
.lookAll-detail {
width: 622rpx;
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 48rpx;
margin-bottom: 32rpx;
}
}
</style>
<template>
<view class="attr-container">
<view class="attr-name">
<u-image src="../../static/img/map.png" width="48rpx" height="48rpx" />
<view class="attr">{{ data.paramsData?.DZMC?.FCONTENT }}</view>
</view>
<u-image
src="../../static/img/attr.png"
width="100%"
height="320rpx"
border-radius="8rpx"
/>
<view class="zy" v-html="data.paramsData?.ZY?.FCONTENT"></view>
<view class="attr-item">
<view class="title">附近公交车站:</view>
<view class="detail">{{ data.paramsData?.FJGJZ?.FCONTENT }}</view>
</view>
<view class="attr-item">
<view class="title">附近地铁站:</view>
<view class="detail">{{ data.paramsData?.FJDTZ?.FCONTENT }}</view>
</view>
<view class="attr-item">
<view class="title">导航搜索:</view>
<view class="detail">{{ data.paramsData?.DHSS?.FCONTENT }}</view>
</view>
<map
class="attr-map"
:latitude="data.paramsData?.JWD?.FCONTENT.split(',')[0]"
:longitude="data.paramsData?.JWD?.FCONTENT.split(',')[1]"
:markers="data.controls"
>
</map>
</view>
</template>
<script setup lang="ts">
import { appointmentConfig } from "@/api/transfer";
import { formattedText } from "@/utils/util";
const data = reactive({
paramsData: {} as any,
title: "",
controls: [
{
id: 1,
latitude: "",
longitude: "",
iconPath: "../../static/img/icon_location.png",
width: 35,
height: 65,
},
],
});
const init = async () => {
const { data: res } = await appointmentConfig("B");
if (res.code === 200) {
res.data.forEach((item: any) => {
if (item.hasOwnProperty("DHSS")) {
data.paramsData.DHSS = item.DHSS[0];
}
if (item.hasOwnProperty("DZMC")) {
data.paramsData.DZMC = item.DZMC[0];
}
if (item.hasOwnProperty("FJDTZ")) {
data.paramsData.FJDTZ = item.FJDTZ[0];
}
if (item.hasOwnProperty("FJGJZ")) {
data.paramsData.FJGJZ = item.FJGJZ[0];
}
if (item.hasOwnProperty("JWD")) {
data.paramsData.JWD = item.JWD[0];
data.controls[0].latitude =
data.paramsData?.JWD?.FCONTENT.split(",")[0];
data.controls[0].longitude =
data.paramsData?.JWD?.FCONTENT.split(",")[1];
console.log(data.paramsData.JWD);
}
if (item.hasOwnProperty("ZY")) {
data.paramsData.ZY = item.ZY[0];
data.paramsData.ZY.FCONTENT = formattedText(
data.paramsData.ZY.FCONTENT
);
}
});
console.log(data.paramsData);
}
};
onLoad(() => {
init();
});
</script>
<style lang="scss" scoped>
.attr-container {
padding: 54rpx 32rpx 94rpx;
.attr-name {
display: flex;
align-items: center;
margin-bottom: 14rpx;
.attr {
height: 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #222222;
line-height: 38rpx;
}
}
.zy {
margin-top: 14rpx;
margin-bottom: 16rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 48rpx;
}
.attr-item {
margin-top: 32rpx;
.title {
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 33rpx;
}
.detail {
margin-top: 8rpx;
font-size: 28rpx;
font-weight: 400;
color: #222222;
line-height: 33rpx;
}
}
.attr-map {
margin-top: 32rpx;
width: 100%;
height: 600rpx;
}
}
</style>
.card {
box-sizing: border-box;
margin: 16rpx;
padding: 16rpx;
border-radius: 8rpx;
border: 1px solid #e4e7ed;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
.card-text {
padding: 20rpx;
// height: 730rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 38rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 24rpx;
opacity: 1;
padding: 18rpx 32rpx 48rpx;
}
.empty {
margin-top: 40rpx;
}
.bg-header {
position: absolute;
top: 0;
width: 100%;
height: 624rpx;
}
.logo {
position: absolute;
top: 128rpx;
left: 270rpx;
width: 212rpx;
height: 316rpx;
.logo-detail {
width: 100%;
height: 44rpx;
font-size: 34rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #222222;
line-height: 44rpx;
-webkit-background-clip: text;
// -webkit-text-fill-color: transparent;
margin-top: 32rpx;
text-align: center;
}
}
.grid-text {
.bg-footer {
position: fixed;
bottom: 0;
width: 100%;
height: 482rpx;
}
.prompt {
width: 100%;
margin-top: 28rpx;
.prompt-title {
height: 44rpx;
font-size: 32rpx;
font-weight: 400;
color: #222222;
line-height: 38rpx;
margin-bottom: 16rpx;
}
.prompt-detail {
// height: 152rpx;
font-size: 28rpx;
margin-top: 4rpx;
color: #303133;
padding: 0 10rpx;
white-space: "nowrap";
text-overflow: "ellipsis";
overflow: "hidden";
font-weight: 400;
color: #999999;
line-height: 48rpx;
}
}
.empty {
margin-top: 40rpx;
.active {
color: #ffffff !important;
background: #05a8ff !important;
}
.code {
width: 190rpx;
height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
text-align: right;
font-weight: 400;
color: #05a8ff;
line-height: 33rpx;
}
import { PersistedStateOptions } from "pinia-plugin-persistedstate"
import { PersistedStateOptions } from "pinia-plugin-persistedstate";
const piniaPersistOption = (key: string, paths?: any[]) => {
const persist: PersistedStateOptions = {
key,
storage: sessionStorage,
paths,
}
return persist
}
};
return persist;
};
export default piniaPersistOption
export default piniaPersistOption;
import { defineStore, createPinia } from "pinia"
import piniaPluginPersistedstate from "pinia-plugin-persistedstate"
import piniaPersistOption from "./config/piniaPersist"
import { defineStore, createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import piniaPersistOption from "./config/piniaPersist";
export const useGlobalStore = defineStore({
id: "globalStore",
state() {
return {
transferData: null,
referData: null,
infoData: {} as any,
}
};
},
getters: {},
actions: {
setTransferData(transferData: any) {
this.transferData = transferData
this.transferData = transferData;
},
setReferData(referData: any) {
this.referData = referData;
},
setInfoData(infoData: string) {
this.infoData = infoData
this.infoData = infoData;
},
},
persist: piniaPersistOption("globalStore"),
})
});
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
export default pinia
export default pinia;
import { hLoading, sLoading, toast } from "./util"
import { hLoading, sLoading, toast } from "./util";
export const baseUrl = "/k3cloud"
export const baseUrl = "/K3Cloud";
// 部署到iis上用的
// export const baseUrl = "https://weixin3.lingqingkeji.com/k3cloud"
// export const baseUrl = "/XiBU"
......@@ -13,11 +13,13 @@ function request(
responseType?: string
) {
return new Promise<any>(function (resolve, reject) {
let header: any
sLoading()
header = { "Content-Type": "application/json" }
url = baseUrl + url
let header: any;
sLoading();
// header = { "Content-Type": "application/json" };
header = {
"Content-Type": "application/x-www-form-urlencoded",
};
url = baseUrl + url;
uni.request({
url,
method,
......@@ -25,33 +27,36 @@ function request(
header,
responseType,
success(res: any) {
hLoading()
hLoading();
if (
res.data.code === 200 ||
res.data.code === 400 ||
res.data.code === 402
res.data.code == 200 ||
res.data.code == 400 ||
res.data.code == 402
) {
resolve(res)
} else if (res.data.code === 500 || res.data.code === 401) {
toast(res.data.msg)
reject(res)
resolve(res);
} else if (res.data.code == 500 || res.data.code == 401) {
toast(res.data.msg);
reject(res);
} else {
console.log(res, "非200错误")
let dd = {};
console.log(res.data.Result, "非200错误");
if (!res.data.hasOwnProperty("code")) return resolve(res.data);
// res.data.has
//其余异样
reject(res)
reject(res);
}
},
fail(err: any) {
hLoading()
hLoading();
//申请失败
uni.showToast({
title: "连接服务器失败",
icon: "none",
})
reject(err)
});
reject(err);
},
})
})
});
});
}
export default request
export default request;
......@@ -8,13 +8,13 @@ export const zconfirm = (msg: string, callBackFun?: any) => {
content: msg,
success(res) {
if (res.confirm) {
callBackFun(true)
callBackFun(true);
} else if (res.cancel) {
callBackFun(false)
callBackFun(false);
}
},
})
}
});
};
export const zalert = (msg: string, callBackFun?: any) => {
uni.showModal({
......@@ -23,11 +23,11 @@ export const zalert = (msg: string, callBackFun?: any) => {
showCancel: false,
success() {
if (callBackFun) {
callBackFun()
callBackFun();
}
},
})
}
});
};
export const toast = (msg: string) => {
uni.showToast({
......@@ -35,77 +35,101 @@ export const toast = (msg: string) => {
duration: 2000,
mask: false,
icon: "none",
})
}
});
};
export const sLoading = (msg: string = "加载中...") => {
uni.showLoading({
title: msg,
mask: true,
})
}
});
};
export const hLoading = () => {
uni.hideLoading()
}
uni.hideLoading();
};
// 防抖
interface DebounceFunc<T extends (...args: any[]) => any> {
(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>
(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>;
}
export function debounce<T extends (...args: any[]) => any>(
fn: T,
delay = 300
): DebounceFunc<T> {
let timer: number | null
let timer: number | null;
return function (this: ThisParameterType<T>, ...args: Parameters<T>) {
if (timer) clearTimeout(timer)
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.call(this, ...args)
}, delay)
} as DebounceFunc<T>
fn.call(this, ...args);
}, delay);
} as DebounceFunc<T>;
}
export const jsonp = function (url: any, data: any) {
console.log(url, data)
console.log(url, data);
return new Promise((resolve, reject) => {
// 1.初始化url
let dataString = url.indexOf("?") === -1 ? "?" : "&"
let callbackName: any = `jsonpCB_${Date.now()}`
url += `${dataString}callback=${callbackName}`
let dataString = url.indexOf("?") === -1 ? "?" : "&";
let callbackName: any = `jsonpCB_${Date.now()}`;
url += `${dataString}callback=${callbackName}`;
if (data) {
// 2.有请求参数,依次添加到url
for (let k in data) {
url += `&${k}=${data[k]}`
url += `&${k}=${data[k]}`;
}
}
console.log(url, "url")
console.log(url, "url");
let scriptNode = document.createElement("script")
scriptNode.src = url
const windows: any = window
let scriptNode = document.createElement("script");
scriptNode.src = url;
const windows: any = window;
// 3. callback
windows[callbackName] = (result: any) => {
result ? resolve(result) : reject("没有返回数据")
delete window[callbackName]
document.body.removeChild(scriptNode)
}
result ? resolve(result) : reject("没有返回数据");
delete window[callbackName];
document.body.removeChild(scriptNode);
};
// 4. 异常情况
scriptNode.addEventListener(
"error",
() => {
reject("接口返回数据失败")
delete window[callbackName]
document.body.removeChild(scriptNode)
reject("接口返回数据失败");
delete window[callbackName];
document.body.removeChild(scriptNode);
},
false
)
);
// 5. 开始请求
document.body.appendChild(scriptNode)
})
}
document.body.appendChild(scriptNode);
});
};
export const appointmentConfigType = (type: string) => {
let str = "";
switch (type) {
case "CLQD":
str = "材料清单";
break;
default:
break;
}
return str;
};
export const formattedText = (text: string) => {
try {
const replacedText = text
.replace(/\\n/g, "<br/>")
.replace(/\\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
return replacedText;
} catch (error) {
return text;
}
};
import { defineConfig } from "vite"
import { resolve } from "path"
import { createSvgIconsPlugin } from "vite-plugin-svg-icons"
import uni from "@dcloudio/vite-plugin-uni"
import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import mkcert from "vite-plugin-mkcert"
import { defineConfig } from "vite";
import { resolve } from "path";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import mkcert from "vite-plugin-mkcert";
export default defineConfig({
plugins: [
......@@ -64,8 +64,9 @@ export default defineConfig({
// target: "https://weixin.lingqingkeji.com:86/",
// secure: false,
// },
"/k3cloud": {
target: "http://192.168.1.168:83/",
"/K3Cloud": {
target: "http://192.168.1.168:83",
// target: "http://192.168.1.61/",
secure: false,
},
"/XiBU": {
......@@ -73,4 +74,4 @@ export default defineConfig({
},
},
},
})
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论