Compare commits

..

No commits in common. "10feded7491d11ada1e3e3e9c3f62d23d6f012c6" and "848d29f81e114413284f16cbb3c73e2aeffca552" have entirely different histories.

3 changed files with 13 additions and 28 deletions

View File

@ -4,13 +4,10 @@
<div v-for="(item, index) in dayList" :key="index"> <div v-for="(item, index) in dayList" :key="index">
<div class="inner" style="font-size: medium;"> <div class="inner" style="font-size: medium;">
{{ index + 1 }} {{ index + 1 }}
<el-checkbox v-model="isAvailableArray[index]" v-if="timeList[index].length != 0" label="这天可预约" style="margin-left: 10px;"/> <el-checkbox v-model="isAvailableArray[index]" label="这天可预约" style="margin-left: 10px;"/>
</div> </div>
<!-- 时间段部分 --> <!-- 时间段部分 -->
<div class="time-picker"> <div class="time-picker">
<el-button circle @click="addList(index, 0)" v-if="timeList[index].length == 0"><el-icon>
<Plus />
</el-icon></el-button>
<div v-for="(item, row) in timeList[index]" :key="row" class="box"> <div v-for="(item, row) in timeList[index]" :key="row" class="box">
<span> {{ row + 1 }} 个时间段</span> <span> {{ row + 1 }} 个时间段</span>
<el-time-select v-model="timeList[index][row].startTime" <el-time-select v-model="timeList[index][row].startTime"
@ -43,7 +40,7 @@
<el-button circle @click="addList(index, row)"><el-icon> <el-button circle @click="addList(index, row)"><el-icon>
<Plus /> <Plus />
</el-icon></el-button> </el-icon></el-button>
<el-button circle @click="subList(index, row)" v-if="row >= 0"><el-icon> <el-button circle @click="subList(index, row)" v-if="row + 1 > 1"><el-icon>
<Minus /> <Minus />
</el-icon></el-button> </el-icon></el-button>
</div> </div>
@ -123,16 +120,8 @@ const maxOptions = ref(
const flag = ref(0) // const flag = ref(0) //
var arr = new Array(4) var arr = new Array(4)
const emit = defineEmits(['time-Info']) // const emit = defineEmits(['time-Info']) //
const initTimeList = () => {
for (var i = 0; i < 4; i ++ ) {
timeList.value[i].splice(0)
}
}
onMounted(()=>{ onMounted(()=>{
init() init()
initTimeList()
for(let i=0; i<4; i++) { //开始时初始化人数的数组 for(let i=0; i<4; i++) { //开始时初始化人数的数组
for(let j=0; j<6; j++) { for(let j=0; j<6; j++) {
for(let k=0;k<50;k++) { for(let k=0;k<50;k++) {
@ -175,7 +164,12 @@ const onSubmit =()=> {
} }
const resetForm=()=>{ const resetForm=()=>{
for(let i=0;i<4;i++) { for(let i=0;i<4;i++) {
timeList.value[i].splice(0, timeList.value[i].length) timeList.value[i] = [{
startTime: '',
endTime: '',
minNumValue: '',
maxNumValue: '',
}]
isAvailableArray.value[i] = false isAvailableArray.value[i] = false
} }
} }

View File

@ -15,14 +15,13 @@ const isValidPlus = (val) => {
} }
export const transfer = (val, arr, isAvailableArr) => { export const transfer = (val, arr, isAvailableArr) => {
console.log('这是val:', val)
for (var i = 0; i < val.length; i ++ ) { for (var i = 0; i < val.length; i ++ ) {
for (var j = 0; j < val[i].length; j ++ ) { for (var j = 0; j < val[i].length; j ++ ) {
arr[i][j].timeSlot = val[i][j].startTime + "-" + val[i][j].endTime arr[i][j].timeSlot = val[i][j].startTime + "-" + val[i][j].endTime
arr[i][j].numberRange = "(" + val[i][j].minNumValue + "," + val[i][j].maxNumValue + ")" arr[i][j].numberRange = "(" + val[i][j].minNumValue + "," + val[i][j].maxNumValue + ")"
} }
} }
console.log('这是arr:', arr) // console.log(arr)
for (var i = 0; i < 4; i ++ ) { for (var i = 0; i < 4; i ++ ) {
for (var j = 0; j < 6; j ++ ) { for (var j = 0; j < 6; j ++ ) {
if(isValidPlus(arr[i][j])) { if(isValidPlus(arr[i][j])) {
@ -52,15 +51,9 @@ export const transfer = (val, arr, isAvailableArr) => {
numberRangeArr.push(arr[i][j].numberRange) numberRangeArr.push(arr[i][j].numberRange)
} }
} }
if(val[i].length == 0){ newArr[i].timeSlot = timeSlotArr.join(';')
newArr[i].timeSlot = "00:00-00:00" newArr[i].numberRange = numberRangeArr.join(';')
newArr[i].numberRange = "(0,0)" newArr[i].isAvailable = isAvailableArr[i] ? 1 : 0
newArr[i].isAvailable = 0
}else{
newArr[i].timeSlot = timeSlotArr.join(';')
newArr[i].numberRange = numberRangeArr.join(';')
newArr[i].isAvailable = isAvailableArr[i] ? 1 : 0
}
timeSlotArr = [] timeSlotArr = []
numberRangeArr = [] numberRangeArr = []
} }

View File

@ -37,7 +37,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, reactive, onMounted} from 'vue' import {ref, reactive} from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import {useRouter} from 'vue-router' import {useRouter} from 'vue-router'
import myAxios from '@/api/myAxios'; import myAxios from '@/api/myAxios';
@ -49,8 +49,6 @@
const router = useRouter() const router = useRouter()
const store = userStore() const store = userStore()
const Login = async ()=>{ const Login = async ()=>{
const res: any = await myAxios.post("/user/login",{ const res: any = await myAxios.post("/user/login",{
userAccount: username.value, userAccount: username.value,