提交 e9930a6f authored 作者: lihuihui's avatar lihuihui

update

上级 ed4f6a5c
...@@ -3,7 +3,7 @@ import VueRouter from 'vue-router' ...@@ -3,7 +3,7 @@ import VueRouter from 'vue-router'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [{ path: '*', redirect: '/' }] const routes = [{ path: '*', redirect: '/' }, { path: '/index', component: () => import('./index.vue') }]
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
......
<template>
<div class="main">
111
<a href="https://webapp-pub.ezijing.com/admission/prp/%E6%8A%A5%E5%90%8D%E8%AE%B0%E5%BD%951111.xlsx">下载</a>
<div @click="idShowPopup = true">aaa</div>
<van-popup
round
closeable
close-icon-position="top-right"
v-model="idShowPopup"
position="bottom"
:style="{ height: '30%' }"
class="main_upload"
>
<van-uploader
v-model="fileList"
:before-read="handleBeforeRead"
:after-read="handleAfterRead"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
:max-count="1"
:upload-icon="icon"
>
</van-uploader>
<div class="upload_tips">*仅支持上传文件</div>
<van-button class="upload_btn" @click="idShowPopup = false">确定</van-button>
</van-popup>
</div>
</template>
<script>
import { Toast } from 'vant'
export default {
props: {
stepList: { type: Array },
data: { type: Object }
},
data() {
return {
isUpload: true, // 是否显示批量导入人员按钮
icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/highway/h5/form_add.png',
title: '报名',
checkedPay: false, // 勾选是否跳过按钮
index: 0,
cIndex: 0,
minDate: new Date(),
fileList: [],
idShowPopup: false
}
},
mounted() {
console.log(this.data, 'user_fields')
},
methods: {
// 弹出批量导入人员的弹框
showPopup() {
this.idShowPopup = true
},
// 上传前置处理
handleBeforeRead(file) {
console.log(file, 'ppppp')
if (file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
Toast('请上传正确的文件格式')
return false
}
return true
},
// 上传文件后的处理
handleAfterRead(file) {
console.log(file)
const params = new FormData()
params.append('file', file.file)
// const config = {
// headers: {
// // 添加请求头
// 'Content-Type': 'multipart/form-data'
// }
// }
// 接口请求
// handleAfterRead().then(res => {})
// 此时可以自行将文件上传至服务器
},
isRemoveInfo(item) {
return !!item.find(f => f.enable_edit === false)
},
// 提交
onSubmit() {
const params = {
activity_id: this.data.activityInfo.id,
activity_detail_id: this.data.id,
need_skip: this.checkedPay ? 1 : 0
}
if (this.data.join_rand) {
params.join_rand = this.data.join_rand
}
params.users_info = this.data.user_fields.reduce((a, b) => {
const infos = {}
b.forEach(item => {
infos[item.key] = item.value
})
a.push(infos)
return a
}, [])
// 表单提交company_id
params.users_info.forEach(item => {
if (item.company) {
this.$store.state.allSettings.company_map.forEach(it => {
if (item.company === it.company_name) {
item.company_id = it.id
} else {
item.company_id = ''
}
})
}
})
let flag = false
params.users_info.forEach(item => {
if (item.check_in_time && item.check_out_time) {
if (item.check_in_time >= item.check_out_time) {
Toast('入住时间要早于离店时间')
flag = true
return false
}
}
})
if (flag) {
return false
}
},
// 表单项减少
handleMinus(index) {
this.data.user_fields.splice(index, 1)
},
// 表单项增加
handleAdd() {
const baseUserFields = this.data.user_fields[0].map(item => {
const copyItem = Object.assign({}, item)
copyItem.value = ''
copyItem.enable_edit = true
return copyItem
})
this.data.user_fields.push(baseUserFields)
},
// 点击确定选择时间
onConfirmTime(time) {
this.data.user_fields[this.index][this.cIndex].value = this.bgDate(time)
this.data.user_fields[this.index][this.cIndex].showPicker = false
},
// 日期格式化
bgDate(val) {
const d = new Date(val)
const date = `${d.getFullYear()}-${this.toDo(d.getMonth() + 1)}-${this.toDo(d.getDate())} ${this.toDo(
d.getHours()
)}:${this.toDo(d.getMinutes())}:${this.toDo(d.getSeconds())}`
return date
},
// 时间格式化 时分秒变两位数
toDo(n) {
return n < 10 ? `0${n}` : n
},
// 时间弹窗
showTime(index, cIndex) {
this.data.user_fields[index][cIndex].showPicker = true
this.index = index
this.cIndex = cIndex
},
// 选择弹窗
showSelectPicker(index, cIndex) {
this.data.user_fields[index][cIndex].showPicker = true
this.index = index
this.cIndex = cIndex
},
// 点击确定选择项
onConfirm(value) {
this.data.user_fields[this.index][this.cIndex].value = value
this.data.user_fields[this.index][this.cIndex].showPicker = false
}
}
}
</script>
<style lang="scss" scoped>
.main {
background-color: #f7f7f7;
.main_content {
padding: 0.21rem 0.3rem 4.13rem 0.3rem;
.main_content_banner {
margin-top: 0.84rem;
width: 100%;
}
.main_content_form {
width: 6.9rem;
opacity: 1;
margin-top: 0.32rem;
}
.main_content_form_list {
border-radius: 20px;
margin-top: 0.43rem;
background: #fff;
padding-bottom: 0.68rem;
padding-top: 0.4rem;
.formItemList_item {
.showTime {
cursor: pointer;
}
.showSelectPicker {
cursor: pointer;
}
}
.btn_minus {
float: right;
width: 0.5072rem;
height: 0.5072rem;
margin: 0.3rem 0.3rem 0 0;
cursor: pointer;
}
}
.btn_operate {
margin-top: 0.15rem;
display: flex;
justify-content: flex-end;
align-items: center;
.btn_import {
width: 2.35rem;
height: 0.81rem;
line-height: 0.81rem;
background: rgba(255, 255, 255, 0.39);
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.09);
border-radius: 0.44rem;
font-size: 0.28rem;
font-weight: 400;
color: #333333;
text-align: center;
}
img {
width: 0.5072rem;
height: 0.5072rem;
}
.btn_add {
cursor: pointer;
margin-left: 0.3rem;
margin-right: 0.31rem;
}
}
}
.main_footer {
width: 100%;
height: 1.81rem;
background: #fff;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: flex-start;
flex-direction: column;
.main_footer_top {
font-size: 0.24rem;
font-weight: 400;
color: #999999;
margin-left: 0.8rem;
margin-top: 0.15rem;
}
.main_footer_bottom {
margin-top: -0.18rem;
cursor: pointer;
width: 6.9rem;
display: flex;
justify-content: center;
align-items: center;
.main_content_btn {
background: #b80140;
color: #ffffff;
margin-left: 0.28rem;
margin-top: -0.18rem;
}
.main_content_btn1 {
background: #b80140;
color: #ffffff;
margin-left: 0.28rem;
margin-top: 0.3rem;
}
}
}
.main_upload {
display: flex;
justify-content: space-around;
align-items: center;
flex-direction: column;
.upload_tips {
color: #b80140;
font-size: 0.16rem;
}
.upload_btn {
border-radius: 3rem;
width: 3rem;
background: #b80140;
color: #ffffff;
}
}
}
::v-deep {
.van-checkbox__icon {
border-radius: 3px;
overflow: hidden;
}
.main_content_banner p img {
width: 6.9rem;
height: 100%;
border-radius: 0.1rem;
}
.van-uploader__upload {
width: 120px;
height: 120px;
}
}
</style>
...@@ -66,5 +66,5 @@ const store = new Vuex.Store({ ...@@ -66,5 +66,5 @@ const store = new Vuex.Store({
} }
} }
}) })
store.dispatch('getAllSetting') // store.dispatch('getAllSetting')
export default store export default store
...@@ -8,7 +8,7 @@ export default defineConfig({ ...@@ -8,7 +8,7 @@ export default defineConfig({
plugins: [eslint({ include: '**/*.+(vue|js|jsx|ts|tsx)' }), createVuePlugin()], plugins: [eslint({ include: '**/*.+(vue|js|jsx|ts|tsx)' }), createVuePlugin()],
server: { server: {
open: true, open: true,
host: 'dev.ezijing.com', host: '172.16.50.224',
https: { https: {
key: fs.readFileSync(path.join(__dirname, './https/dev.ezijing.com.key')), key: fs.readFileSync(path.join(__dirname, './https/dev.ezijing.com.key')),
cert: fs.readFileSync(path.join(__dirname, './https/dev.ezijing.com.pem')) cert: fs.readFileSync(path.join(__dirname, './https/dev.ezijing.com.pem'))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论