Skip to content

Commit

Permalink
feat: added upload times limited
Browse files Browse the repository at this point in the history
  • Loading branch information
xixiIBN5100 committed Dec 5, 2024
1 parent fb9ebd6 commit e1fcba2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/apis/service/User/verifyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const urlde =
type verifyData = {
stu_id: string,
password :string,
survey: number
survey_id: number
}
const verifyAPI = (data: verifyData ) => {
return request("/api/user/oauth", {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<modal :modal-id="'select'">
<template #title>创建问卷</template>
<template #default>
<span class="flex justify-between items-center">请选择创建问卷的类型
<span class="flex items-center">请选择创建问卷的类型
<el-radio-group v-model="surveyType" style="margin-left: 30px" >
<el-radio-button value="0" size="middle" label="调研问卷" />
<el-radio-button value="1" size="middle" label="投票问卷" />
Expand Down
3 changes: 3 additions & 0 deletions src/pages/View/checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</div>
<div class="divider my-5"></div>
<div class="flex-col p-5 h-auto">
<span class="dark:opacity-80 text-gray-700 dark:text-gray-400 text-sm my-5" v-if="props.minimum_option !== 0">最少选 {{ props.minimum_option }} 个&ensp;</span><span class="dark:opacity-80 text-gray-700 dark:text-gray-400 text-sm my-5" v-if="props.maximum_option !== 0">最多选 {{ props.maximum_option }} 个</span>
<div v-for="item in localOptions" :key="item.serial_num" class="flex items-center gap-10 my-5">
<input type="checkbox" :name="props.serial_num" class="my-5" style="zoom: 140%" :value="item.content" v-model="answerArr"/>
<span v-if="item.content" class="text-sm">{{ item.content }}</span>
Expand Down Expand Up @@ -52,6 +53,8 @@ const props = defineProps<{
otherOption: boolean,
describe: string,
answer: string,
maximum_option: number,
minimum_option: number,
options?: {
content: string;
img: string;
Expand Down
26 changes: 16 additions & 10 deletions src/pages/View/view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
</div>
</div>
</div>
<div class="flex gap-20 items-center my-10 ml-20 mt-20">
<div class="flex gap-20 items-center my-10 ml-20 ">
<span class="text-red-950 dark:text-red-400 dark:opacity-80">截止时间:</span>
<span>{{ time }}</span>
</div>
<div class="flex gap-20 items-center my-10 ml-20 " v-if="formData.daily_limit !== 0">
<span class=" dark:opacity-80 text-gray-700 dark:text-gray-400" >本问卷每天最多提交 <span class="text-red-950 dark:text-red-400 dark:opacity-80">{{ formData.daily_limit }} </span> 次</span>
</div>
<div class="divider my-10"></div>
</template>
</el-skeleton>
Expand All @@ -58,7 +61,7 @@
<skeleton-card></skeleton-card>
</template>
<template #default>
<checkbox v-model:answer="q.answer" v-model:title="q.subject" v-model:options="q.options" v-model:serial_num="q.serial_num" v-model:unique="q.unique" v-model:required="q.required" v-model:other-option="q.other_option" v-model:describe="q.describe" v-model:questionnaireID = "decryptedId"></checkbox>
<checkbox v-model:answer="q.answer" v-model:title="q.subject" v-model:options="q.options" v-model:serial_num="q.serial_num" v-model:unique="q.unique" v-model:required="q.required" v-model:other-option="q.other_option" v-model:describe="q.describe" v-model:questionnaireID = "decryptedId" v-model:minimum_option="q.minimum_option" v-model:maximum_option="q.maximum_option"></checkbox>
</template>
</el-skeleton>
</div>
Expand Down Expand Up @@ -94,13 +97,13 @@
</div>
</div>
<div class="flex justify-center items-center py-50">
<button class="btn w-1/3 bg-red-800 text-red-50 dark:opacity-75" @click="showModal('QuestionnaireSubmit')" v-if="decryptedId !== '' && !isOutDate" >提交问卷</button>
<button class="btn w-1/3 bg-red-800 text-red-50 dark:opacity-75 hover:bg-red-600" @click="showModal('QuestionnaireSubmit')" v-if="decryptedId !== '' && !isOutDate" >提交问卷</button>
</div>
</div>
<modal modal-id="QuestionnaireSubmit">
<template #title><span class="text-red-950 dark:text-red-500">提交问卷</span></template>
<template #title><span class="text-red-950 dark:text-red-500 ">提交问卷</span></template>

<template #default v-if="formData && !formData.verify">
<template #default v-if="formData && !formData.verify || stu_id">
你确认要提交问卷吗?
</template>
<template #default v-else>
Expand All @@ -109,14 +112,14 @@
该问卷提交需要统一登录认证
</div>
<div class="flex-col my-10">
<span>学号 &ensp; &ensp;<input class="dark:bg-customGray_more_shallow input input-bordered shadow-md h-35 my-10 w-2/3" v-modal="verifyData.stu_id" /></span><br/>
<span>学号 &ensp; &ensp;<input class="dark:bg-customGray_more_shallow input input-bordered shadow-md h-35 my-10 w-2/3" v-model="verifyData.stu_id" /></span><br/>
<span>密码 &ensp; &ensp;<input class="dark:bg-customGray_more_shallow input input-bordered shadow-md h-35 my-10 w-2/3" v-model="verifyData.password" /></span>
</div>
</div>
</template>
<template #action>
<button class="btn bg-red-800 text-red-50 w-full" @click="submit" v-if="formData && !formData.verify">确认</button>
<button class="btn bg-red-800 text-red-50 w-full" @click="verify" v-else>确认</button>
<button class="btn bg-red-800 text-red-50 w-full hover:bg-red-600" @click="submit" v-if="formData && !formData.verify || stu_id">确认</button>
<button class="btn bg-red-800 text-red-50 w-full hover:bg-red-600" @click="verify" v-else>确认</button>
</template>
</modal>
</div>
Expand Down Expand Up @@ -159,10 +162,11 @@
const decryptedId = ref<string | null>()
const allowSend = ref(true)
const isOutDate = ref(false)
const verifyData = ref({
const stu_id = localStorage.getItem("stu_id")
const verifyData = ref( {
stu_id: "",
password: "",
survey: decryptedId.value
survey_id: -1
})
const optionStore = useMainStore().useOptionStore()
const questionnaireStore = useMainStore().useQuetionnaireStore()
Expand All @@ -174,6 +178,7 @@
idParam = idParam.replace(/ /g, "+");
decryptedId.value = decryptId(idParam) as string | null;
// console.log(decryptedId.value)
verifyData.value.survey_id = Number(decryptedId.value)
if (decryptedId.value === ""){
ElNotification.error("无效的问卷id")
}
Expand All @@ -185,6 +190,7 @@
useRequest(() => verifyAPI(verifyData.value),{
onSuccess(res){
if(res.code === 200){
localStorage.setItem("stu_id", verifyData.value.stu_id)
submit()
} else {
ElNotification.error(res.msg)
Expand Down

0 comments on commit e1fcba2

Please sign in to comment.