|
@@ -1,24 +1,28 @@
|
|
|
<template>
|
|
|
- <el-dialog :visible="dialogVisible" title="分享" width="700px" @close="dialogClose">
|
|
|
+ <el-dialog :visible="dialogVisible" title="分享" width="700px" @close="dialogClose" @closed="dialogClosed">
|
|
|
<div class="share-condition">
|
|
|
<div class="condition-top">
|
|
|
<span>开始日期</span>
|
|
|
<el-date-picker v-model="begin_date" type="date" placeholder="选择日期" style="width: 100%" />
|
|
|
<span>有效期</span>
|
|
|
- <el-input v-model="period_validity" placeholder="请输入有效期" />
|
|
|
+ <el-input v-model.number="effective_days" placeholder="请输入有效期">
|
|
|
+ <span slot="suffix">天</span>
|
|
|
+ </el-input>
|
|
|
<span>作答限时</span>
|
|
|
- <el-input v-model="answer_limit" placeholder="请输入作答限时" />
|
|
|
+ <el-input v-model.number="answer_time_limit_minute" placeholder="请输入作答限时">
|
|
|
+ <span slot="suffix">分钟</span>
|
|
|
+ </el-input>
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
class="condition-bottom"
|
|
|
- :style="{ 'grid-template': `30px 32px / repeat(auto-fill, ${send_mode === sendModes[0].type ? 272 : 300}px` }"
|
|
|
+ :style="{ 'grid-template': `30px 32px / repeat(auto-fill, ${send_type === sendModes[0].type ? 272 : 300}px` }"
|
|
|
>
|
|
|
<span>发送方式</span>
|
|
|
- <el-radio-group v-model="send_mode">
|
|
|
+ <el-radio-group v-model="send_type">
|
|
|
<el-radio v-for="{ type, name } in sendModes" :key="type" :label="type">{{ name }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
- <template v-if="send_mode === sendModes[0].type">
|
|
|
+ <template v-if="send_type === sendModes[0].type">
|
|
|
<span>作答模式</span>
|
|
|
<el-radio-group v-model="answer_mode">
|
|
|
<el-radio v-for="{ type, name } in answerModes" :key="type" :label="type">
|
|
@@ -26,9 +30,9 @@
|
|
|
</el-radio>
|
|
|
</el-radio-group>
|
|
|
</template>
|
|
|
- <template v-if="send_mode === sendModes[1].type">
|
|
|
+ <template v-if="send_type === sendModes[1].type">
|
|
|
<span>访问权限</span>
|
|
|
- <el-radio-group v-model="access_permission">
|
|
|
+ <el-radio-group v-model="access_popedom">
|
|
|
<el-radio v-for="{ type, name } in accessPermissions" :key="type" :label="type">
|
|
|
{{ name }}
|
|
|
</el-radio>
|
|
@@ -37,30 +41,32 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div v-show="send_mode === sendModes[0].type" class="select-course">
|
|
|
+ <div v-show="send_type === sendModes[0].type" class="select-course">
|
|
|
<div class="title">选择课程</div>
|
|
|
<div></div>
|
|
|
</div>
|
|
|
|
|
|
- <div v-show="send_mode === sendModes[1].type" class="generate-condition">
|
|
|
+ <div v-show="send_type === sendModes[1].type" class="generate-condition">
|
|
|
<span>访问人数</span>
|
|
|
- <el-input v-model="visitors_number" placeholder="请输入访问人数" />
|
|
|
- <span>可直接输入人数</span>
|
|
|
- <span :class="{ disabled: access_permission === accessPermissions[0].type }">作答模式</span>
|
|
|
+ <el-input v-model.number="max_person_count" placeholder="不限制">
|
|
|
+ <span slot="suffix">人</span>
|
|
|
+ </el-input>
|
|
|
+ <span class="tips">可直接输入人数</span>
|
|
|
+ <span :class="{ disabled: access_popedom === accessPermissions[0].type }">作答模式</span>
|
|
|
<el-radio-group
|
|
|
v-model="answer_mode"
|
|
|
- :disabled="access_permission === accessPermissions[0].type"
|
|
|
- :class="{ disabled: access_permission === accessPermissions[0].type }"
|
|
|
+ :disabled="access_popedom === accessPermissions[0].type"
|
|
|
+ :class="{ disabled: access_popedom === accessPermissions[0].type }"
|
|
|
>
|
|
|
<el-radio v-for="{ type, name } in answerModes" :key="type" :label="type">{{ name }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
|
|
|
<div slot="footer" class="footer">
|
|
|
- <template v-if="send_mode === sendModes[0].type">
|
|
|
- <el-button type="primary" @click="dialogClose">发送</el-button>
|
|
|
+ <template v-if="send_type === sendModes[0].type">
|
|
|
+ <el-button type="primary" @click="send">发送</el-button>
|
|
|
</template>
|
|
|
- <template v-if="send_mode === sendModes[1].type">
|
|
|
+ <template v-if="send_type === sendModes[1].type">
|
|
|
<el-button @click="generateLink(1)">生成二维码</el-button>
|
|
|
<el-button type="primary" @click="generateLink(2)">生成链接</el-button>
|
|
|
</template>
|
|
@@ -69,9 +75,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { CreateShareRecord } from '@/api/exercise';
|
|
|
+
|
|
|
export default {
|
|
|
name: 'ShareDialog',
|
|
|
props: {
|
|
|
+ exerciseId: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
dialogVisible: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
@@ -79,7 +91,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- send_mode: 1, // 发送方式
|
|
|
+ send_type: 1, // 发送方式
|
|
|
sendModes: [
|
|
|
{
|
|
|
type: 1,
|
|
@@ -95,7 +107,7 @@ export default {
|
|
|
{ type: 1, name: '练习模式' },
|
|
|
{ type: 2, name: '考试模式' },
|
|
|
],
|
|
|
- access_permission: 1, // 访问权限
|
|
|
+ access_popedom: 1, // 访问权限
|
|
|
accessPermissions: [
|
|
|
{
|
|
|
type: 1,
|
|
@@ -106,78 +118,136 @@ export default {
|
|
|
name: '仅作答',
|
|
|
},
|
|
|
], // 访问权限
|
|
|
- visitors_number: '', // 访问人数
|
|
|
- begin_date: '',
|
|
|
- period_validity: 50,
|
|
|
- answer_limit: 30,
|
|
|
+ max_person_count: '', // 访问人数
|
|
|
+ begin_date: this.getNowDate(),
|
|
|
+ effective_days: 50,
|
|
|
+ answer_time_limit_minute: 30,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ getNowDate() {
|
|
|
+ const date = new Date();
|
|
|
+ return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
|
|
|
+ },
|
|
|
generateLink(type) {
|
|
|
- this.$emit('generateLink', type);
|
|
|
+ CreateShareRecord({
|
|
|
+ exercise_id: this.exerciseId,
|
|
|
+ begin_date: this.begin_date,
|
|
|
+ effective_days: this.effective_days,
|
|
|
+ answer_time_limit_minute: this.answer_time_limit_minute,
|
|
|
+ send_type: this.send_type,
|
|
|
+ answer_mode: this.answer_mode,
|
|
|
+ access_popedom: this.access_popedom,
|
|
|
+ max_person_count: this.max_person_count,
|
|
|
+ }).then(({ status, ...data }) => {
|
|
|
+ this.$emit('generateLink', { ...data, type });
|
|
|
+ });
|
|
|
},
|
|
|
+ send() {},
|
|
|
dialogClose() {
|
|
|
this.$emit('update:dialogVisible');
|
|
|
},
|
|
|
+ dialogClosed() {
|
|
|
+ this.send_type = 1;
|
|
|
+ this.answer_mode = 1;
|
|
|
+ this.access_popedom = 1;
|
|
|
+ this.max_person_count = '';
|
|
|
+ this.begin_date = this.getNowDate();
|
|
|
+ this.effective_days = 50;
|
|
|
+ this.answer_time_limit_minute = 30;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.share-condition {
|
|
|
- .condition-top {
|
|
|
- display: grid;
|
|
|
- grid-template: 30px 32px / repeat(auto-fill, 210px);
|
|
|
- grid-auto-flow: column;
|
|
|
- column-gap: 16px;
|
|
|
+.el-dialog {
|
|
|
+ :deep &__header {
|
|
|
+ padding: 16px;
|
|
|
+ border-bottom: 1px solid #ebebeb;
|
|
|
}
|
|
|
|
|
|
- .condition-bottom {
|
|
|
- display: grid;
|
|
|
- grid-auto-flow: column;
|
|
|
- padding: 0 16px;
|
|
|
- margin-top: 36px;
|
|
|
+ :deep &__headerbtn &__close {
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
|
|
|
- .el-radio-group {
|
|
|
- display: flex;
|
|
|
+ :deep &__body {
|
|
|
+ padding: 40px 24px;
|
|
|
+
|
|
|
+ .share-condition {
|
|
|
+ .condition-top {
|
|
|
+ display: grid;
|
|
|
+ grid-template: 30px 32px / repeat(auto-fill, 210px);
|
|
|
+ grid-auto-flow: column;
|
|
|
+ column-gap: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .condition-bottom {
|
|
|
+ display: grid;
|
|
|
+ grid-auto-flow: column;
|
|
|
+ padding: 0 16px;
|
|
|
+ margin-top: 36px;
|
|
|
+
|
|
|
+ .el-radio-group {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-.select-course {
|
|
|
- margin-top: 16px;
|
|
|
-}
|
|
|
+ .select-course {
|
|
|
+ margin-top: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .generate-condition {
|
|
|
+ display: grid;
|
|
|
+ grid-template: 30px 32px 30px / repeat(auto-fill, 300px);
|
|
|
+ grid-auto-flow: column;
|
|
|
+ column-gap: 16px;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 16px;
|
|
|
|
|
|
-.generate-condition {
|
|
|
- display: grid;
|
|
|
- grid-template: 30px 32px 30px / repeat(auto-fill, 300px);
|
|
|
- grid-auto-flow: column;
|
|
|
- column-gap: 16px;
|
|
|
- align-items: center;
|
|
|
- margin-top: 16px;
|
|
|
+ .tips {
|
|
|
+ color: $text-color;
|
|
|
+ }
|
|
|
+
|
|
|
+ .disabled {
|
|
|
+ opacity: 0.5;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- .disabled {
|
|
|
- opacity: 0.5;
|
|
|
+ .el-input {
|
|
|
+ &__suffix-inner {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ height: 100%;
|
|
|
+ margin-right: 5px;
|
|
|
+ color: $font-color;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-.footer {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
+ :deep &__footer {
|
|
|
+ margin-top: 16px;
|
|
|
|
|
|
- .el-button {
|
|
|
- width: 200px;
|
|
|
- height: 34px;
|
|
|
- border-radius: 20px;
|
|
|
+ .footer {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
|
|
|
- + .el-button {
|
|
|
- margin-left: 16px;
|
|
|
- }
|
|
|
+ .el-button {
|
|
|
+ width: 200px;
|
|
|
+ height: 34px;
|
|
|
+ border-radius: 20px;
|
|
|
+
|
|
|
+ + .el-button {
|
|
|
+ margin-left: 16px;
|
|
|
+ }
|
|
|
|
|
|
- &--default {
|
|
|
- color: $main-color;
|
|
|
- background-color: #f3f7ff;
|
|
|
+ &--default {
|
|
|
+ color: $main-color;
|
|
|
+ background-color: #f3f7ff;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|