Commit ecdc0e16 authored by xinzhedeai's avatar xinzhedeai

add: 培训演练表单

parent 36754da2
html,
body {
letter-spacing: 0.01rem;
background-color: #fff;
overflow-x: hidden;
}
.wrapper {
/* padding: 0.2rem; */
background-color: #fff;
}
.header {
padding: 0.2rem;
background: #fff;
}
.header .title {
font-weight: bold;
font-size: 0.32rem;
color: #000000;
display: flex;
justify-content: start;
align-items: center;
gap: 0.2rem;
padding: 0.3rem 0.3rem;
}
.header .title img {
width: 0.51rem;
height: 0.52rem;
}
.detail {
width: 100%;
/* height: 1.88rem; */
background: #f5f6fa;
border-radius: 0.01rem;
/* padding-left: 0.2rem; */
padding: 0.3rem;
margin-bottom: 0.2rem;
display: flex;
align-items: start;
flex-direction: column;
justify-content: space-around;
/* padding-bottom: 0.1rem;
gap: 0.1rem; */
}
.detail .van-col {
font-family: PingFang SC;
font-weight: 500;
font-size: 0.28rem;
color: #737373;
}
.detail span {
font-family: PingFang SC;
font-weight: 500;
font-size: 0.28rem;
color: #737373;
}
.detail .detail_link {
position: absolute;
right: 0.3rem;
font-size: 0.26rem;
color: #1081e3;
cursor: pointer;
}
.func_btn {
width: 7.12rem;
height: 0.8rem;
background: #1081e3;
border-radius: 0.1rem;
font-family: PingFang SC;
font-weight: 500;
font-size: 0.3rem;
color: #ffffff;
margin: 0 auto;
border-width: 0;
margin-left: 0.2rem;
cursor: pointer;
}
.func_btn span {
font-size: 0.5rem;
vertical-align: -0.05rem;
margin-right: 0.1rem;
}
.tag {
display: inline-block;
width: 1.9rem;
height: 0.42rem;
line-height: 0.42rem;
text-align: center;
border-radius: 21px;
font-weight: 500;
font-size: 0.28rem;
color: #ffffff;
}
.green {
background: #00b55e;
}
.yellow {
background: rgba(255, 148, 21, 1);
}
.red {
background: rgba(255, 33, 49, 1);
}
/* 添加以下样式 */
.van-tabs__line {
background-color: #1989fa;
}
.blue-text {
color: #1989fa;
font-weight: 500;
}
.van-list {
background: #fff;
border-radius: 8px;
margin: 0 0.1rem;
}
.subNavWrapper .van-cell {
padding: 12px 10px;
}
.van-tab {
color: #000;
}
.van-tab__text {
font-weight: bold;
font-size: 0.3rem;
/* color: #000; */
}
.van-tab--active {
color: #1081e3;
}
.van-field__label {
font-weight: bold;
}
.van-field__control {
color: #737373;
}
.navToBtn {
color: #5b5b5b;
font-size: 0.36rem;
margin-top: 0.04rem;
position: absolute;
right: 0;
}
[v-cloak] {
display: none;
}
/* 基础重置样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
/* 去除移动端点击高亮 */
}
body {
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
font-size: 16px;
background-color: #f8f9fa;
}
/* 表单容器 */
.form-container {
max-width: 750px;
/* 移动端最大宽度 */
margin: .05rem auto .2rem;
padding: 0 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
/* 表单单项 */
.form-item {
display: flex;
align-items: center;
/* 垂直居中 */
height: 50px;
padding: 0 12px;
border-bottom: 1px solid #f0f2f5;
}
/* 最后一项去除下边框 */
.form-item:last-child {
border-bottom: none;
}
/* 表单标题 */
.form-label {
flex-shrink: 0;
/* 防止标题被压缩 */
width: 1.8rem;
/* 标题固定宽度,可根据需求调整 */
color: #333;
font-size: .15rem;
text-align: left;
/* 标题左对齐 */
}
/* 输入框容器 */
.form-input-wrap {
flex: 1;
/* 占据剩余空间 */
height: 100%;
display: flex;
align-items: center;
padding-left: 0.2rem;
}
/* 输入框样式 */
.form-input {
width: 100%;
height: .56rem;
/* 输入框高度小于容器,留出垂直空间 */
border: none;
outline: none;
font-size: .15rem;
color: #666;
}
/* 输入框placeholder样式 */
.form-input::placeholder {
color: #999;
font-size: .14rem;
}
/* 输入框聚焦效果 */
.form-input:focus {
color: #262626;
}
.imager-item-title {
height: .5rem;
line-height: .5rem;
/* padding: 0 .12rem !important; */
font-size: .14rem !important;
margin-left: .24rem !important;
/* border-bottom: 1px solid #f0f2f5; */
margin-bottom: .15rem !important;
font-weight: 400;
}
.save-btn {
width: 98%;
background: #1890ff;
color: #fff;
border: none;
padding: 7px 20px;
border-radius: 3px;
font-size: 16px;
cursor: pointer;
margin-bottom: .4rem;
}
.textareaEle {
width: 100%;
border: 1px solid #CACACA;
font-size: .28rem;
border-radius: .05rem;
padding: .15rem;
}
.merchant-icon {
width: 100%;
}
.date-wrapper .van-cell {
padding-left: 0;
margin-top: -.23rem;
}
/* 必填标题 */
.title_require {
position: relative;
padding: 0;
margin: 0;
/* margin-top: 0.1rem; */
/* padding-left: 0.2rem; */
font-size: .28rem;
}
.title_require::before {
position: absolute;
content: '*';
color: #ee0a24;
font-size: .14rem;
left: -10px;
top: 50%;
transform: translateY(-50%);
}
.selector {
width: 4rem;
height: 0.6rem;
font-size: 0.3rem;
border: 1px solid #d7d7d7;
background-color: #fff;
}
input:disabled {
background-color: #fff;
}
select:disabled {
border: none;
/* 移除默认箭头 */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* 调整右侧内边距,防止文字溢出 */
padding-right: 25px;
/* 可选:统一背景色 */
background-color: white;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover" />
<title>培训演练</title>
<!-- 在 includeHead.js 之后添加环境判断 -->
<script src="../sdk/includeHead.js"></script>
<script type="text/javascript" src="../sdk/axios_http3.js"></script>
</head>
<body>
<div id="app" class="page_wrapper" v-cloak>
<div class="third-layer">
<!-- form开始 -->
<div class="form-container">
<div class="form-item">
<span class="form-label title_require">培训标题</span>
<div class="form-input-wrap">
<input type="text" v-model="formData.contactName" class="form-input" placeholder="">
</div>
</div>
<div class="form-item">
<span class="form-label title_require">培训演练类别</span>
<div class="form-input-wrap">
<select class="selector" v-model="formData.industryType" :disabled="flag=='XQ'">
<option v-for="(item, i) in 10" :key="i" :label="item.industryName" :value="item.id">
</option>
</select>
</div>
</div>
<div class="form-item">
<span class="form-label title_require">培训人数(人)</span>
<div class="form-input-wrap">
<input type="text" v-model="formData.contactDetails" class="form-input" placeholder="">
</div>
</div>
<div class="form-item">
<span class="form-label title_require">培训人</span>
<div class="form-input-wrap">
<input type="text" v-model="formData.contactDetails" class="form-input" placeholder="">
</div>
</div>
<div class="form-item date-wrapper">
<span class="form-label title_require">培训日期</span>
<div class="form-input-wrap">
<van-field readonly v-model="formData.date" placeholder="" class="form-input"
@click="showDatePicker=true" />
</div>
</div>
<van-popup v-model="showDatePicker" position="bottom">
<van-datetime-picker type="date" :min-date="minDate" :max-date="maxDate"
@confirm="onDateConfirm" @cancel="showDatePicker = false" />
</van-popup>
<div>
<h5 class="imager-item-title title_require">
<span style="font-weight: 500;font-size: 0.28rem;color: #333;">请上传图片(最多6张)</span>
<span></span>
</h5>
<div>
<van-uploader v-model="formData.photos" :max-count="6" multiple
:after-read="handleFileUpload" class="uploader-wrapper" />
</div>
</div>
<!-- form结束 -->
<button class="save-btn" style="margin-left: 50%; transform: translateX(-50%);"
@click="submitForm">提交</button>
</div>
</div>
</body>
</html>
\ No newline at end of file
/**
* author: dabao
* date: 2024-03-15
* description: 商户首页
*/
var VUE = null
window.addEventListener("load", function () {
VUE = new Vue({
el: '#app',
data() {
return {
flag: 'XQ',
flag: 'ADD',
showDatePicker: false, // 控制日期选择器显示
minDate: new Date(gemhoUtil.getTargetDateYMD()), // 最小可选日期
maxDate: new Date(2099, 11, 31), // 最大可选日期
// 日期选择的最小范围,这里设置为当前日期的前 10 年
// maxDate: new Date(new Date().getFullYear() + 10, 11),
// 新增以下数据
formData: {
submitDate: gemhoUtil.getTargetDateYMD(),
createDate: gemhoUtil.getTargetDateYMD(),
date: gemhoUtil.getTargetDateYMD(),
phone: '',
area: '',
businessHours: '',
type: '', // 新增类型字段
},
merId: '',
merInformation: { // 新增商户信息对象
},
}
},
created() {
let params = gemhoUtil.getUrlParams()
console.log(params);
this.merId = params.merId
},
mounted() {
this.getShopInfo() // 获取商户信息
},
// watch: {
// 'formData.date': {
// handler(newVal) {
// console.log('date 属性变化:', newVal);
// },
// deep: true // 深度监听对象属性
// }
// },
methods: {
gotoPage(stringifyUrl) {
let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`)
gemhoUtil.navigatePage(url, '跳转中...')
},
// 确认日期选择
onDateConfirm(date) {
// 将 Date 对象格式化为 YYYY-MM-DD 字符串
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
this.formData.date = `${year}-${month}-${day}`;
this.showDatePicker = false;
},
// 文件上传处理
handleFileUpload(file) {
console.log('上传文件:', file);
// 此处可添加实际文件上传逻辑
},
navTo(url) {
// gemhoUtil.nav2asd(url)
let params = gemhoUtil.getUrlParams()
if (url == 'check_info') {
params = {
...params,
flag: 'ADD',
pageName: '_shanghu_home'
}
}
let strurl = gemhoUtil.setParameter(`_${url}.html`, params)
gemhoUtil.navigatePage(strurl, '跳转中...')
},
submitForm() {
if (!this.formData.content) {
vant.Dialog.alert({
message: '安全建议不可为空',
})
return;
}
vant.Toast.loading({
message: '正在处理...',
forbidClick: true,
loadingType: 'spinner',
});
var reqParam = {
merId: this.merId,
...this.formData,
}
// var url = "/gq/checkRecord/safeCheckRecord"
http3.post('/gq/consumer', reqParam).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
// this.formData = {
// submitDate: gemhoUtil.getTargetDateYMD(),
// createDate: gemhoUtil.getTargetDateYMD(),
// phone: '',
// area: '',
// businessHours: '',
// type: '', // 新增类型字段
// content: '',
// photos: [],
// contactName: '',
// contactDetails: '',
// },
location.reload()
// gemhoUtil.navigatePage(`${this.pageName}.html${window.location.search}`, '操作完成,跳转中...')
})
},
//获取商户信息
getShopInfo() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 11,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
merId: this.merId,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
this.merInformation = { ...this.merInformation, ...result.data }
}
}
)
}, 0)
},
}
});
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment