master
lion 2 days ago
parent 77b33be4a7
commit 5f7358dfb2

@ -500,6 +500,18 @@
this.getList()
},
async getList() {
const filter = [{
key: 'course_id',
op: 'eq',
value: this.select.course_id
}]
if (this.select.status !== '' && this.select.status !== null && this.select.status !== undefined) {
filter.push({
key: 'status',
op: 'eq',
value: this.select.status
})
}
const res = await index({
page: this.select.page,
page_size: this.select.page_size,
@ -514,15 +526,7 @@
type: this.select.type,
sort_name: 'score',
sort_type: this.select.sort_type,
filter: [{
key: 'course_id',
op: 'eq',
value: this.select.course_id
}, {
key: 'status',
op: 'eq',
value: this.select.status
}]
filter
})
this.list = res.data
this.total = res.total
@ -577,6 +581,19 @@
_export['user.idcard'] = '身份证号'
_export['score'] = '评分'
const filter = [{
key: 'course_id',
op: 'eq',
value: this.select.course_id
}]
if (this.select.status !== '' && this.select.status !== null && this.select.status !== undefined) {
filter.push({
key: 'status',
op: 'eq',
value: this.select.status
})
}
download(
'/api/admin/course-signs/index',
'get', {
@ -592,15 +609,7 @@
sort_name: 'score',
sort_type: this.select.sort_type,
export_fields: _export,
filter: [{
key: 'course_id',
op: 'eq',
value: this.select.course_id
}, {
key: 'status',
op: 'eq',
value: this.select.status
}],
filter,
is_export: 1,
page: 1,
page_size: 999

@ -16,9 +16,18 @@
</div>
</div>
<div class="code">
<div v-if="imgSrc">
<img :src="imgSrc"></img>
<div class="code">
<div v-if="imgSrc">
<img :src="imgSrc" />
</div>
<div v-else class="empty-code">
<p>{{ loading ? '加载中...' : '暂无二维码' }}</p>
<el-button
v-if="!loading"
type="primary"
:loading="generating"
@click="generateCode"
>生成二维码</el-button>
</div>
</div>
</div>
@ -35,7 +44,7 @@
</div>
</template>
<script>
<script>
import {getQrCode} from "@/api/course"
export default {
components: {
@ -46,29 +55,67 @@
isShow: false,
form: {
settings: '',
},
},
row:{},
rules: {},
imgSrc:''
rules: {},
imgSrc:'',
loading: false,
generating: false
}
},
created() {},
methods: {
async getCode() {
const res = await getQrCode({
id: this.row.id,
})
this.imgSrc = res.msg
if (!this.row.id) {
this.imgSrc = ''
return
}
this.loading = true
this.imgSrc = ''
try {
// 500
const res = await getQrCode({
id: this.row.id,
generate: 0
}, false)
this.imgSrc = res.msg || ''
} catch (e) {
this.imgSrc = ''
} finally {
this.loading = false
}
},
async generateCode() {
if (!this.row.id || this.generating) {
return
}
this.generating = true
try {
const res = await getQrCode({
id: this.row.id,
generate: 1
})
this.imgSrc = res.msg || ''
if (this.imgSrc) {
this.$message.success('二维码生成成功')
}
} catch (e) {
// request
} finally {
this.generating = false
}
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (newVal) {
this.getCode()
} else {
this.row = {}
} else {
this.row = {}
this.imgSrc = ''
this.loading = false
this.generating = false
}
},
}
@ -88,7 +135,7 @@
}
.code {
height: 200px;
min-height: 200px;
text-align: center;
img {
@ -96,4 +143,17 @@
height: 200px;
}
}
</style>
.empty-code {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 200px;
p {
margin-bottom: 16px;
color: #909399;
}
}
</style>

Loading…
Cancel
Save