main
parent
06681658fc
commit
0d99fbac80
@ -0,0 +1,8 @@ |
|||||||
|
import request from '@/config/axios' |
||||||
|
|
||||||
|
export const getUserMemberList = async (params) => { |
||||||
|
return await request.get({ |
||||||
|
url: 'http://xj.ahduima.com/xunjia/driver-api/tdSysUserMember/duima/user/member/list', |
||||||
|
params: params |
||||||
|
}) |
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
import request from '@/config/axios' |
||||||
|
export const searchQuestion = async (param) => { |
||||||
|
return await request.get({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/list', |
||||||
|
params: param |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const updateQuestion = async (data) => { |
||||||
|
return await request.put({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/update', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const addQuestion = async (data) => { |
||||||
|
return await request.post({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/add', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const deleteQuestion = async (id) => { |
||||||
|
return await request.delete({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/delete?id=' + id |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const uploadFile = async (data) => { |
||||||
|
return await request.post({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/upload', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const getQuestionSort = async (param) => { |
||||||
|
return await request.get({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/question/sort/list', |
||||||
|
params: param |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const getMjList = async (params) => { |
||||||
|
return await request.get({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/secret/list', |
||||||
|
params: params |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const addMj = async (data) => { |
||||||
|
return await request.post({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/secret/add', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const delMj = async (secretId) => { |
||||||
|
return await request.delete({ |
||||||
|
url: `http://localhost/tiku-api/tiku/xunjia/secret/delete?secretId=${secretId}` |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const clearMj = async (secretId) => { |
||||||
|
return await request.delete({ |
||||||
|
url: `http://localhost/tiku-api/tiku/xunjia/secret/clear?secretId=${secretId}` |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const getMjQuestionList = async (params) => { |
||||||
|
return await request.get({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/secret/question/list', |
||||||
|
params: params |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const addMjQuestion = async (data) => { |
||||||
|
return await request.post({ |
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/secret/question/add', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const delMjQuestion = async (id) => { |
||||||
|
return await request.delete({ |
||||||
|
url: `http://localhost/tiku-api/tiku/xunjia/secret/question/delete?id=${id}` |
||||||
|
}) |
||||||
|
} |
@ -0,0 +1,118 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-form :model="searchForm" label-width="0" inline> |
||||||
|
<el-form-item> |
||||||
|
<el-input v-model="searchForm.phone" placeholder="请输入手机号" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-input v-model="searchForm.name" placeholder="请输入姓名" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button @click="searchList">查询</el-button> |
||||||
|
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<el-table :data="tableData"> |
||||||
|
<el-table-column type="index" width="50" /> |
||||||
|
<el-table-column prop="phone" label="手机号" /> |
||||||
|
<el-table-column prop="name" label="姓名" /> |
||||||
|
<el-table-column prop="mark" label="标记" /> |
||||||
|
<el-table-column label="小程序码" align="center" width="140px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<img :src="row.qrCode" style="width: 100px; height: 100px" /> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="操作" width="120px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-button type="primary" link @click="handleEdit(row)">修改</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="searchForm.pageNo" |
||||||
|
v-model:limit="searchForm.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog title="分销配置" v-model="showDialog" width="500px"> |
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||||
|
<el-form-item label="手机号" prop="phone"> |
||||||
|
<el-input v-model="form.phone" maxlength="11" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="姓名" prop="name"> |
||||||
|
<el-input v-model="form.name" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="标记" prop="mark"> |
||||||
|
<el-input v-model="form.mark" /> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span> |
||||||
|
<el-button @click="showDialog = false">取消</el-button> |
||||||
|
<el-button type="primary" @click="handleSave">确认</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="Resell"> |
||||||
|
const message = useMessage() |
||||||
|
|
||||||
|
const searchForm = ref({ |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 10, |
||||||
|
phone: '', |
||||||
|
name: '' |
||||||
|
}) |
||||||
|
|
||||||
|
const tableData = ref([]) |
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const showDialog = ref(false) |
||||||
|
|
||||||
|
const form = ref({ |
||||||
|
phone: '', |
||||||
|
name: '', |
||||||
|
mark: '' |
||||||
|
}) |
||||||
|
|
||||||
|
const rules = { |
||||||
|
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }], |
||||||
|
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }] |
||||||
|
} |
||||||
|
|
||||||
|
function searchList() { |
||||||
|
searchForm.value.pageNo = 1 |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function getList() { |
||||||
|
console.log(searchForm.value) |
||||||
|
} |
||||||
|
|
||||||
|
function handleAdd() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
function handleEdit(row) { |
||||||
|
form.value = { ...row } |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
|
||||||
|
const formRef = ref(null) |
||||||
|
async function handleSave() { |
||||||
|
if (!formRef.value) return |
||||||
|
const valid = await formRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
// 调用接口 |
||||||
|
showDialog.value = false |
||||||
|
message.success('成功') |
||||||
|
searchList() |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,120 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-form :model="searchForm" inline> |
||||||
|
<el-form-item> |
||||||
|
<el-input v-model="searchForm.phone" placeholder="学员手机号" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button @click="searchList">查询</el-button> |
||||||
|
<el-button type="primary" @click="addVipUser">赠送折扣</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<el-table v-loading="loading" :data="tableList"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="手机号" align="center" prop="phone" min-width="140" /> |
||||||
|
<el-table-column label="折扣描述" align="center" prop="memberName" min-width="140" /> |
||||||
|
<el-table-column label="折后价格" align="center" prop="carName" min-width="100" /> |
||||||
|
<el-table-column label="有效期至" align="center" prop="subjects" min-width="100" /> |
||||||
|
<el-table-column label="截止时间" align="center" prop="endDate" min-width="100" /> |
||||||
|
<el-table-column label="操作人" align="center" prop="" min-width="100" /> |
||||||
|
<el-table-column label="操作时间" align="center" prop="" min-width="100" /> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="searchForm.pageNo" |
||||||
|
v-model:limit="searchForm.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog title="赠送折扣" v-model="showDialog" width="500px"> |
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||||
|
<el-form-item label="手机号" prop="phone"> |
||||||
|
<el-input v-model="form.phone" maxlength="11" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="会员描述" prop="vipType"> |
||||||
|
<el-select v-model="form.vipType" clearable filterable style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span> |
||||||
|
<el-button @click="showDialog = false">取消</el-button> |
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="UserDiscount"> |
||||||
|
import { getUserMemberList } from '@/api/xjapplet/vip' |
||||||
|
|
||||||
|
const message = useMessage() |
||||||
|
|
||||||
|
const searchForm = ref({ |
||||||
|
phone: '', |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 50 |
||||||
|
}) |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const vipTypeOptions = ref([ |
||||||
|
{ label: '普通会员', value: '1' }, |
||||||
|
{ label: 'VIP会员', value: '2' } |
||||||
|
]) |
||||||
|
|
||||||
|
function searchList() { |
||||||
|
searchForm.value.pageNo = 1 |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function getList() { |
||||||
|
loading.value = true |
||||||
|
getUserMemberList(searchForm.value).then((response) => { |
||||||
|
if (response.code === 200) { |
||||||
|
tableList.value = response.data |
||||||
|
total.value = response.total |
||||||
|
loading.value = false |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const showDialog = ref(false) |
||||||
|
const form = ref({ |
||||||
|
phone: '', |
||||||
|
vipType: '' |
||||||
|
}) |
||||||
|
const rules = ref({ |
||||||
|
phone: [{ required: true, message: '请输入用户手机号', trigger: 'blur' }], |
||||||
|
vipType: [{ required: true, message: '请选择会员类型', trigger: 'change' }] |
||||||
|
}) |
||||||
|
|
||||||
|
function addVipUser() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
|
||||||
|
const formRef = ref(null) |
||||||
|
async function sureAdd() { |
||||||
|
if (!formRef.value) return |
||||||
|
const valid = await formRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
// 调用接口 |
||||||
|
showDialog.value = false |
||||||
|
message.success('赠送成功') |
||||||
|
searchList() |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,219 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-row> |
||||||
|
<el-button @click="searchList">查询</el-button> |
||||||
|
<el-button type="primary" @click="addDiscount">新增折扣</el-button> |
||||||
|
</el-row> |
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tableList"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="折扣描述" align="center" prop="desc" min-width="140" /> |
||||||
|
<el-table-column label="折扣价" align="center" prop="discount" /> |
||||||
|
<el-table-column label="有效期" align="center" prop="duration" /> |
||||||
|
<el-table-column label="单位" align="center" prop="unit" /> |
||||||
|
<el-table-column label="状态" align="center"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-switch |
||||||
|
v-model="row.isActive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="启用" |
||||||
|
inactive-text="禁用" |
||||||
|
disabled |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="searchForm.pageNo" |
||||||
|
v-model:limit="searchForm.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog title="折扣详情" v-model="showDialog" width="500px"> |
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||||
|
<el-form-item label="折扣类型" prop="type"> |
||||||
|
<el-select v-model="form.type" style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="item in discountTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="折扣描述"> |
||||||
|
{{ discountDesc }} |
||||||
|
</el-form-item> |
||||||
|
<el-form-item v-if="form.type == 1" label="科目" prop="subject"> |
||||||
|
<el-select v-model="form.subject" style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="item in subjectOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="变量1" prop="param1"> |
||||||
|
<el-select v-model="form.param1" style="width: 100%" clearable> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="变量2" prop="param2"> |
||||||
|
<el-select v-model="form.param2" style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="折扣价" prop="discount"> |
||||||
|
<el-input v-model="form.discount" type="number" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="有效期" prop="duration"> |
||||||
|
<el-input v-model="form.duration" type="number" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="单位" prop="unit"> |
||||||
|
<el-radio-group v-model="form.unit"> |
||||||
|
<el-radio v-for="(item, index) in unitOptions" :key="index" :label="item.value">{{ |
||||||
|
item.label |
||||||
|
}}</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="状态" prop="isActive"> |
||||||
|
<el-switch |
||||||
|
v-model="form.isActive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="启用" |
||||||
|
inactive-text="禁用" |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span> |
||||||
|
<el-button @click="showDialog = false">取消</el-button> |
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="VipDiscount"> |
||||||
|
import { getUserMemberList } from '@/api/xjapplet/vip' |
||||||
|
|
||||||
|
const message = useMessage() |
||||||
|
|
||||||
|
const searchForm = ref({ |
||||||
|
phone: '', |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 50 |
||||||
|
}) |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const discountTypeOptions = [ |
||||||
|
{ |
||||||
|
label: '【$科目】模考首次通过后,在拥有【$会员名1】的情况下,购买【$会员名2】,享折扣价', |
||||||
|
value: 1 |
||||||
|
}, |
||||||
|
{ label: '之前拥有过【$会员名1】,购买【$会员名2】,享折扣价', value: 2 } |
||||||
|
] |
||||||
|
|
||||||
|
const subjectOptions = [ |
||||||
|
{ label: '科一', value: '1' }, |
||||||
|
{ label: '科四', value: '4' } |
||||||
|
] |
||||||
|
|
||||||
|
const unitOptions = [ |
||||||
|
{ label: '天', value: 1 }, |
||||||
|
{ label: '年', value: 3 } |
||||||
|
] |
||||||
|
|
||||||
|
const discountDesc = computed(() => { |
||||||
|
const { type, subject, param1, param2, discount, duration, unit } = form.value |
||||||
|
let baseStr = discountTypeOptions.find((item) => item.value === type).label |
||||||
|
return baseStr |
||||||
|
.replace('$科目', subjectOptions.find((item) => item.value === subject).label) |
||||||
|
.replace( |
||||||
|
'$会员名1', |
||||||
|
vipTypeOptions.value.find((item) => item.value === param1)?.label || '无需会员' |
||||||
|
) |
||||||
|
.replace('$会员名2', vipTypeOptions.value.find((item) => item.value === param2).label) |
||||||
|
.concat( |
||||||
|
`${discount || ''},有效期${duration || 0}${ |
||||||
|
unitOptions.find((item) => item.value === unit).label |
||||||
|
}` |
||||||
|
) |
||||||
|
}) |
||||||
|
|
||||||
|
const vipTypeOptions = ref([ |
||||||
|
{ label: '普通会员', value: '1' }, |
||||||
|
{ label: 'VIP会员', value: '2' } |
||||||
|
]) |
||||||
|
|
||||||
|
function searchList() { |
||||||
|
searchForm.value.pageNo = 1 |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function getList() { |
||||||
|
loading.value = true |
||||||
|
getUserMemberList(searchForm.value).then((response) => { |
||||||
|
if (response.code === 200) { |
||||||
|
tableList.value = response.data |
||||||
|
total.value = response.total |
||||||
|
loading.value = false |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const showDialog = ref(false) |
||||||
|
const form = ref({ |
||||||
|
type: 1, |
||||||
|
subject: '1', |
||||||
|
param1: '1', |
||||||
|
param2: '2', |
||||||
|
discount: undefined, |
||||||
|
duration: undefined, |
||||||
|
unit: 1, |
||||||
|
isActive: 0 |
||||||
|
}) |
||||||
|
const rules = ref({ |
||||||
|
param2: [{ required: true, message: '请选择变量2', trigger: 'change' }], |
||||||
|
discount: [{ required: true, message: '请输入折扣价', trigger: 'blur' }], |
||||||
|
duration: [{ required: true, message: '请输入有效期', trigger: 'blur' }] |
||||||
|
}) |
||||||
|
|
||||||
|
function addDiscount() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
|
||||||
|
const formRef = ref(null) |
||||||
|
async function sureAdd() { |
||||||
|
if (!formRef.value) return |
||||||
|
const valid = await formRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
// 调用接口 |
||||||
|
showDialog.value = false |
||||||
|
message.success('成功') |
||||||
|
searchList() |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,204 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-form :model="searchForm" inline> |
||||||
|
<el-form-item> |
||||||
|
<el-input v-model="searchForm.phone" placeholder="学员手机号" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-select v-model="searchForm.cartype" placeholder="选择车型" clearable filterable> |
||||||
|
<el-option label="小车" value="1001" /> |
||||||
|
<el-option label="摩托车" value="1002" /> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-select v-model="searchForm.vipType" placeholder="选择会员类型" clearable filterable> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button @click="searchList">查询</el-button> |
||||||
|
<el-button type="primary" @click="addVip">新增会员类型</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<el-table v-loading="loading" :data="tableList"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="会员名" align="center" prop="memberName" min-width="140" /> |
||||||
|
<el-table-column label="车型" align="center" prop="carName" /> |
||||||
|
<el-table-column label="科目" align="center" prop="subjects" /> |
||||||
|
<el-table-column label="原价" align="center" prop="price" /> |
||||||
|
<el-table-column label="折扣价" align="center" prop="discount" /> |
||||||
|
<el-table-column label="有效期" align="center" prop="duration" /> |
||||||
|
<el-table-column label="单位" align="center" prop="unit" /> |
||||||
|
<el-table-column label="状态" align="center"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-switch |
||||||
|
v-model="row.isActive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="启用" |
||||||
|
inactive-text="禁用" |
||||||
|
disabled |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="客服赠送" align="center"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-switch |
||||||
|
v-model="row.canGive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="可赠送" |
||||||
|
inactive-text="不可赠送" |
||||||
|
disabled |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="searchForm.pageNo" |
||||||
|
v-model:limit="searchForm.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog title="会员详情" v-model="showDialog" width="500px"> |
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||||
|
<el-form-item label="会员名称" prop="memberName"> |
||||||
|
<el-input v-model="form.memberName" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="车型" prop="cartype"> |
||||||
|
<el-select v-model="form.cartype" style="width: 100%"> |
||||||
|
<el-option label="小车" value="1001" /> |
||||||
|
<el-option label="摩托车" value="1002" /> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="科目" prop="subjects"> |
||||||
|
<el-select v-model="searchForm.subjects" placeholder="多选" multiple style="width: 100%"> |
||||||
|
<el-option label="科一" value="4" /> |
||||||
|
<el-option label="科四" value="1" /> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="原价" prop="price"> |
||||||
|
<el-input v-model="form.price" type="number" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="折扣价" prop="discount"> |
||||||
|
<el-input v-model="form.discount" type="number" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="有效期" prop="duration"> |
||||||
|
<el-input v-model="form.duration" type="number" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="单位" prop="unit"> |
||||||
|
<el-radio-group v-model="form.unit"> |
||||||
|
<el-radio :label="1">天</el-radio> |
||||||
|
<el-radio :label="3">年</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="状态" prop="isActive"> |
||||||
|
<el-switch |
||||||
|
v-model="form.isActive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="启用" |
||||||
|
inactive-text="禁用" |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="客服赠送" prop="canGive"> |
||||||
|
<el-switch |
||||||
|
v-model="form.canGive" |
||||||
|
:active-value="0" |
||||||
|
:inactive-value="1" |
||||||
|
active-text="可赠送" |
||||||
|
inactive-text="不可赠送" |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span> |
||||||
|
<el-button @click="showDialog = false">取消</el-button> |
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="VipType"> |
||||||
|
import { getUserMemberList } from '@/api/xjapplet/vip' |
||||||
|
const message = useMessage() |
||||||
|
const searchForm = ref({ |
||||||
|
phone: '', |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 50 |
||||||
|
}) |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const vipTypeOptions = ref([ |
||||||
|
{ label: '普通会员', value: '1' }, |
||||||
|
{ label: 'VIP会员', value: '2' } |
||||||
|
]) |
||||||
|
|
||||||
|
function searchList() { |
||||||
|
searchForm.value.pageNo = 1 |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function getList() { |
||||||
|
loading.value = true |
||||||
|
getUserMemberList(searchForm.value).then((response) => { |
||||||
|
if (response.code === 200) { |
||||||
|
tableList.value = response.data |
||||||
|
total.value = response.total |
||||||
|
loading.value = false |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const showDialog = ref(false) |
||||||
|
const form = ref({ |
||||||
|
memberName: '', |
||||||
|
cartype: '', |
||||||
|
subjects: [], |
||||||
|
price: '', |
||||||
|
discount: '', |
||||||
|
duration: '', |
||||||
|
unit: 1, |
||||||
|
isActive: 0, |
||||||
|
canGive: 1 |
||||||
|
}) |
||||||
|
const rules = ref({ |
||||||
|
memberName: [{ required: true, message: '请输入会员名称', trigger: 'blur' }], |
||||||
|
cartype: [{ required: true, message: '请输入车型', trigger: 'change' }], |
||||||
|
subjects: [{ required: true, message: '请输入科目', trigger: 'blur' }], |
||||||
|
price: [{ required: true, message: '请输入价格', trigger: 'blur' }], |
||||||
|
discount: [{ required: true, message: '请输入折扣价', trigger: 'blur' }], |
||||||
|
duration: [{ required: true, message: '请输入有效期', trigger: 'blur' }] |
||||||
|
}) |
||||||
|
|
||||||
|
function addVip() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
|
||||||
|
const formRef = ref(null) |
||||||
|
async function sureAdd() { |
||||||
|
if (!formRef.value) return |
||||||
|
const valid = await formRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
// 调用接口 |
||||||
|
showDialog.value = false |
||||||
|
message.success('赠送成功') |
||||||
|
searchList() |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,135 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-form :model="searchForm" inline> |
||||||
|
<el-form-item> |
||||||
|
<el-input v-model="searchForm.phone" placeholder="学员手机号" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-select v-model="searchForm.cartype" placeholder="选择车型" clearable filterable> |
||||||
|
<el-option label="小车" value="1001" /> |
||||||
|
<el-option label="摩托车" value="1002" /> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-select v-model="searchForm.vipType" placeholder="选择会员类型" clearable filterable> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button @click="searchList">查询</el-button> |
||||||
|
<el-button type="primary" @click="addVipUser">赠送会员</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<el-table v-loading="loading" :data="tableList"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="手机号" align="center" prop="phone" min-width="140" /> |
||||||
|
<el-table-column label="会员名" align="center" prop="memberName" min-width="140" /> |
||||||
|
<el-table-column label="车型" align="center" prop="carName" min-width="100" /> |
||||||
|
<el-table-column label="科目" align="center" prop="subjects" min-width="100" /> |
||||||
|
<el-table-column label="开始时间" align="center" prop="startDate" min-width="100" /> |
||||||
|
<el-table-column label="结束时间" align="center" prop="endDate" min-width="100" /> |
||||||
|
<el-table-column label="操作人" align="center" prop="" min-width="100" /> |
||||||
|
<el-table-column label="操作时间" align="center" prop="" min-width="100" /> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="searchForm.pageNo" |
||||||
|
v-model:limit="searchForm.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog title="赠送会员" v-model="showDialog" width="500px"> |
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||||
|
<el-form-item label="手机号" prop="phone"> |
||||||
|
<el-input v-model="form.phone" maxlength="11" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="会员类型" prop="vipType"> |
||||||
|
<el-select v-model="form.vipType" clearable filterable style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="item in vipTypeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span> |
||||||
|
<el-button @click="showDialog = false">取消</el-button> |
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="VipUser"> |
||||||
|
import { getUserMemberList } from '@/api/xjapplet/vip' |
||||||
|
const message = useMessage() |
||||||
|
const searchForm = ref({ |
||||||
|
phone: '', |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 50 |
||||||
|
}) |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const vipTypeOptions = ref([ |
||||||
|
{ label: '普通会员', value: '1' }, |
||||||
|
{ label: 'VIP会员', value: '2' } |
||||||
|
]) |
||||||
|
|
||||||
|
function searchList() { |
||||||
|
searchForm.value.pageNo = 1 |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function getList() { |
||||||
|
loading.value = true |
||||||
|
getUserMemberList(searchForm.value).then((response) => { |
||||||
|
if (response.code === 200) { |
||||||
|
tableList.value = response.data |
||||||
|
total.value = response.total |
||||||
|
loading.value = false |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const showDialog = ref(false) |
||||||
|
const form = ref({ |
||||||
|
phone: '', |
||||||
|
vipType: '' |
||||||
|
}) |
||||||
|
const rules = ref({ |
||||||
|
phone: [{ required: true, message: '请输入用户手机号', trigger: 'blur' }], |
||||||
|
vipType: [{ required: true, message: '请选择会员类型', trigger: 'change' }] |
||||||
|
}) |
||||||
|
|
||||||
|
function addVipUser() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
|
||||||
|
const formRef = ref(null) |
||||||
|
async function sureAdd() { |
||||||
|
if (!formRef.value) return |
||||||
|
const valid = await formRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
// 调用接口 |
||||||
|
showDialog.value = false |
||||||
|
message.success('赠送成功') |
||||||
|
searchList() |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,29 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-tabs v-model="tabIndex"> |
||||||
|
<el-tab-pane label="会员用户" :name="1"> |
||||||
|
<VipUser v-if="tabIndex == 1" /> |
||||||
|
</el-tab-pane> |
||||||
|
<el-tab-pane label="会员类型" :name="2"> |
||||||
|
<VipType v-if="tabIndex == 2" /> |
||||||
|
</el-tab-pane> |
||||||
|
<el-tab-pane label="会员折扣" :name="3"> |
||||||
|
<VipDiscount v-if="tabIndex == 3" /> |
||||||
|
</el-tab-pane> |
||||||
|
<el-tab-pane label="用户折扣" :name="4"> |
||||||
|
<UserDiscount v-if="tabIndex == 4" /> |
||||||
|
</el-tab-pane> |
||||||
|
</el-tabs> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="Vip"> |
||||||
|
import UserDiscount from './components/UserDiscount.vue' |
||||||
|
import VipDiscount from './components/VipDiscount.vue' |
||||||
|
import VipType from './components/VipType.vue' |
||||||
|
import VipUser from './components/VipUser.vue' |
||||||
|
|
||||||
|
const tabIndex = ref(1) |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,257 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<div> |
||||||
|
<el-form size="small" inline label-width="68px" @submit.prevent> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-form-item label="车型"> |
||||||
|
<el-radio-group v-model="queryParams.chexing" @change="searchMj"> |
||||||
|
<el-radio label="C1">小车</el-radio> |
||||||
|
<el-radio label="D">摩托车</el-radio> |
||||||
|
<!-- <el-radio label="B2">货车</el-radio> --> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="科目"> |
||||||
|
<el-radio-group v-model="queryParams.examType" @change="searchMj"> |
||||||
|
<el-radio label="1">科一</el-radio> |
||||||
|
<el-radio label="4">科四</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
</el-row> |
||||||
|
</el-form> |
||||||
|
</div> |
||||||
|
<div style="display: flex; padding: 10px; border: 1px solid #eee; height: calc(100vh - 80px)"> |
||||||
|
<div style="width: 350px; border-right: 1px solid #eee"> |
||||||
|
<div style="display: flex; justify-content: space-between; padding-right: 20px"> |
||||||
|
<div style="font-size: 18px; font-weight: bold">密卷</div> |
||||||
|
<el-button type="text" @click="addMjItem">新增</el-button> |
||||||
|
</div> |
||||||
|
<el-radio-group |
||||||
|
v-model="mjIndex" |
||||||
|
style="width: 100%; display: block; margin-top: 20px" |
||||||
|
@change="getQuestionList" |
||||||
|
> |
||||||
|
<el-radio v-for="(item, index) in mjList" :key="index" :label="index" class="flex-radio"> |
||||||
|
<div style="flex: 1; width: 100px">{{ getMjTitle(index) }}</div> |
||||||
|
<div style="padding-right: 15px"> |
||||||
|
<el-button type="text" @click="removeMj(item)">删除</el-button> |
||||||
|
<el-button type="text" @click="clearMjDetail(item)">清空</el-button> |
||||||
|
</div> |
||||||
|
</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</div> |
||||||
|
<div style="flex: 1; padding-left: 20px; padding-right: 20px"> |
||||||
|
<div |
||||||
|
v-if="mjList.length > 0" |
||||||
|
style="display: flex; justify-content: space-between; align-items: center" |
||||||
|
> |
||||||
|
<div style="font-size: 20px; font-weight: bold"> |
||||||
|
当前密卷:{{ getMjTitle(mjIndex) }} |
||||||
|
</div> |
||||||
|
<div style="margin-left: 10px; margin-right: 10px"> 题目数:{{ tableList.length }} </div> |
||||||
|
<el-button type="primary" @click="addMjDetail">新增密卷试题</el-button> |
||||||
|
</div> |
||||||
|
<el-table v-loading="loading" :data="tableList" style="margin-top: 20px"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" /> |
||||||
|
<el-table-column label="选项" align="left" min-width="140"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<p v-if="row.optA">A:{{ row.optA }}</p> |
||||||
|
<p v-if="row.optB">B:{{ row.optB }}</p> |
||||||
|
<p v-if="row.optC">C:{{ row.optC }}</p> |
||||||
|
<p v-if="row.optD">D:{{ row.optD }}</p> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="答案" align="center" prop="answer" width="100" /> |
||||||
|
<el-table-column label="章节" align="center" prop="sortName" min-width="100" /> |
||||||
|
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" /> |
||||||
|
<el-table-column label="图片" align="center" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<img |
||||||
|
v-if="row.subPic" |
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" |
||||||
|
width="80px" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="100px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-button size="mini" type="text" @click="takeoutMj(row)">移出密卷</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-dialog v-model:visible="showDialog" title="新增试题" width="80%"> |
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 20px"> |
||||||
|
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" /> |
||||||
|
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button> |
||||||
|
</div> |
||||||
|
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)"> |
||||||
|
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" /> |
||||||
|
<el-table-column label="选项" align="left" min-width="140"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<p v-if="row.optA">A:{{ row.optA }}</p> |
||||||
|
<p v-if="row.optB">B:{{ row.optB }}</p> |
||||||
|
<p v-if="row.optC">C:{{ row.optC }}</p> |
||||||
|
<p v-if="row.optD">D:{{ row.optD }}</p> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="答案" align="center" prop="answer" width="100" /> |
||||||
|
<el-table-column label="章节" align="center" prop="sortName" width="180" /> |
||||||
|
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" /> |
||||||
|
<el-table-column label="图片" align="center" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-image |
||||||
|
v-if="row.subPic" |
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" |
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`]" |
||||||
|
style="width: 80px" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="操作" width="100px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-button type="text" @click="sureAddQues(row)">加入密卷</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="SimpleData"> |
||||||
|
import { |
||||||
|
getMjList, |
||||||
|
addMj, |
||||||
|
delMj, |
||||||
|
clearMj, |
||||||
|
getMjQuestionList, |
||||||
|
addMjQuestion, |
||||||
|
delMjQuestion, |
||||||
|
searchQuestion |
||||||
|
} from '@/api/xjapplet/xjdatabase' |
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗 |
||||||
|
|
||||||
|
const queryParams = ref({ |
||||||
|
chexing: 'C1', |
||||||
|
examType: '1' |
||||||
|
}) |
||||||
|
const mjIndex = ref(0) |
||||||
|
const mjList = ref([]) |
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const showDialog = ref(false) |
||||||
|
const quesName = ref('') |
||||||
|
const quesLit = ref([]) |
||||||
|
|
||||||
|
onMounted(() => { |
||||||
|
searchMj() |
||||||
|
}) |
||||||
|
|
||||||
|
function addMjItem() { |
||||||
|
addMj(queryParams.value).then((res) => { |
||||||
|
if (res) { |
||||||
|
searchMj() |
||||||
|
message.success('添加成功') |
||||||
|
} else { |
||||||
|
message.error('添加失败') |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
function getMjTitle(idx) { |
||||||
|
const cjObj = { |
||||||
|
C1: '小车', |
||||||
|
D: '摩托车' |
||||||
|
} |
||||||
|
const kmObj = { |
||||||
|
1: '科一', |
||||||
|
4: '科四' |
||||||
|
} |
||||||
|
return `${cjObj[queryParams.value.chexing]}${kmObj[queryParams.value.examType]}考前密卷 第${ |
||||||
|
idx + 1 |
||||||
|
}套` |
||||||
|
} |
||||||
|
function removeMj(item) { |
||||||
|
message |
||||||
|
.confirm('是否确认删除密卷?') |
||||||
|
.then(function () { |
||||||
|
return delMj(item.secretId) |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
searchMj() |
||||||
|
message.success('删除成功') |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
function clearMjDetail(item) { |
||||||
|
message |
||||||
|
.confirm('是否确认清空密卷题目?') |
||||||
|
.then(function () { |
||||||
|
return clearMj(item.secretId) |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
getQuestionList() |
||||||
|
message.success('清空题目成功') |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
function searchMj() { |
||||||
|
getMjList(queryParams.value).then((resp) => { |
||||||
|
mjList.value = resp || [] |
||||||
|
if (mjList.value.length > 0) { |
||||||
|
mjIndex.value = 0 |
||||||
|
getQuestionList() |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
function addMjDetail() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
function searchQues() { |
||||||
|
searchQuestion({ |
||||||
|
...queryParams.value, |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 1000, |
||||||
|
subTitle: quesName.value |
||||||
|
}).then((response) => { |
||||||
|
quesLit.value = response |
||||||
|
}) |
||||||
|
} |
||||||
|
function takeoutMj(row) { |
||||||
|
message |
||||||
|
.confirm('是否确认将该题移出密卷?') |
||||||
|
.then(function () { |
||||||
|
return delMjQuestion(row.id) |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
getQuestionList() |
||||||
|
message.success('清空题目成功') |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
function getQuestionList() { |
||||||
|
getMjQuestionList({ |
||||||
|
secretId: mjList.value[mjIndex.value].secretId |
||||||
|
}).then((resp) => { |
||||||
|
tableList.value = resp?.sort((pre, cur) => pre.id - cur.id) || [] |
||||||
|
}) |
||||||
|
} |
||||||
|
function sureAddQues(row) { |
||||||
|
addMjQuestion({ |
||||||
|
secretId: mjList.value[mjIndex.value].secretId, |
||||||
|
subId: row.subId |
||||||
|
}) |
||||||
|
.then((resp) => { |
||||||
|
if (resp) { |
||||||
|
message.success('添加成功') |
||||||
|
getQuestionList() |
||||||
|
} |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,177 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-form inline label-width="68px" @submit.prevent> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-form-item label="车型"> |
||||||
|
<el-radio-group v-model="queryParams.chexing"> |
||||||
|
<el-radio label="C1">小车</el-radio> |
||||||
|
<el-radio label="D">摩托车</el-radio> |
||||||
|
<!-- <el-radio label="B2">货车</el-radio> --> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="科目"> |
||||||
|
<el-radio-group v-model="queryParams.examType"> |
||||||
|
<el-radio label="1">科一</el-radio> |
||||||
|
<el-radio label="4">科四</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button |
||||||
|
type="primary" |
||||||
|
@click=" |
||||||
|
() => { |
||||||
|
queryParams.pageNo = 1 |
||||||
|
getQuestionList() |
||||||
|
} |
||||||
|
" |
||||||
|
>查询</el-button |
||||||
|
> |
||||||
|
<el-button type="primary" @click="addMjDetail">新增精选试题</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-row> |
||||||
|
</el-form> |
||||||
|
<el-table v-loading="loading" :data="tableList"> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" /> |
||||||
|
<el-table-column label="选项" align="left" min-width="140"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<p v-if="row.optA">A:{{ row.optA }}</p> |
||||||
|
<p v-if="row.optB">B:{{ row.optB }}</p> |
||||||
|
<p v-if="row.optC">C:{{ row.optC }}</p> |
||||||
|
<p v-if="row.optD">D:{{ row.optD }}</p> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="答案" align="center" prop="answer" width="100" /> |
||||||
|
<el-table-column label="章节" align="center" prop="sortName" min-width="100" /> |
||||||
|
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" /> |
||||||
|
<el-table-column label="图片" align="center" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<img |
||||||
|
v-if="row.subPic" |
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" |
||||||
|
width="80px" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="操作" align="center" width="100px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-button size="small" type="primary" link @click="takeoutMj(row)">移出精选</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="queryParams.pageNo" |
||||||
|
v-model:limit="queryParams.pageSize" |
||||||
|
@pagination="getQuestionList" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-dialog v-model="showDialog" title="新增试题" width="80%"> |
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 20px"> |
||||||
|
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" /> |
||||||
|
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button> |
||||||
|
</div> |
||||||
|
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)"> |
||||||
|
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" /> |
||||||
|
<el-table-column label="选项" align="left" min-width="140"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<p v-if="row.optA">A:{{ row.optA }}</p> |
||||||
|
<p v-if="row.optB">B:{{ row.optB }}</p> |
||||||
|
<p v-if="row.optC">C:{{ row.optC }}</p> |
||||||
|
<p v-if="row.optD">D:{{ row.optD }}</p> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="答案" align="center" prop="answer" width="100" /> |
||||||
|
<el-table-column label="章节" align="center" prop="sortName" width="180" /> |
||||||
|
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" /> |
||||||
|
<el-table-column label="图片" align="center" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-image |
||||||
|
v-if="row.subPic" |
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" |
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`]" |
||||||
|
style="width: 80px" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="操作" width="100px"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<el-button type="primary" link @click="sureAddQues(row)">加入精选</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="SimpleData"> |
||||||
|
import { |
||||||
|
getMjQuestionList, |
||||||
|
addMjQuestion, |
||||||
|
delMjQuestion, |
||||||
|
searchQuestion |
||||||
|
} from '@/api/xjapplet/xjdatabase' |
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗 |
||||||
|
|
||||||
|
const queryParams = ref({ |
||||||
|
chexing: 'C1', |
||||||
|
examType: '1', |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 10 |
||||||
|
}) |
||||||
|
|
||||||
|
const total = ref(0) |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const tableList = ref([]) |
||||||
|
const showDialog = ref(false) |
||||||
|
const quesName = ref('') |
||||||
|
const quesLit = ref([]) |
||||||
|
|
||||||
|
function addMjDetail() { |
||||||
|
showDialog.value = true |
||||||
|
} |
||||||
|
function searchQues() { |
||||||
|
searchQuestion({ |
||||||
|
...queryParams.value, |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 1000, |
||||||
|
subTitle: quesName.value |
||||||
|
}).then((response) => { |
||||||
|
quesLit.value = response.list |
||||||
|
}) |
||||||
|
} |
||||||
|
function takeoutMj(row) { |
||||||
|
message |
||||||
|
.confirm('是否确认将该题移出精选?') |
||||||
|
.then(function () { |
||||||
|
return delMjQuestion(row.id) |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
getQuestionList() |
||||||
|
message.success('清空题目成功') |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
function getQuestionList() { |
||||||
|
getMjQuestionList().then((resp) => { |
||||||
|
tableList.value = resp?.sort((pre, cur) => pre.id - cur.id) || [] |
||||||
|
}) |
||||||
|
} |
||||||
|
function sureAddQues(row) { |
||||||
|
addMjQuestion({ |
||||||
|
subId: row.subId |
||||||
|
}) |
||||||
|
.then((resp) => { |
||||||
|
if (resp) { |
||||||
|
message.success('添加成功') |
||||||
|
getQuestionList() |
||||||
|
} |
||||||
|
}) |
||||||
|
.catch(() => {}) |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,19 @@ |
|||||||
|
<template> |
||||||
|
<el-tabs v-model="tabIndex"> |
||||||
|
<el-tab-pane label="精选题" :name="1"> |
||||||
|
<SimpleData v-if="tabIndex == 1" /> |
||||||
|
</el-tab-pane> |
||||||
|
<el-tab-pane label="密卷" :name="2"> |
||||||
|
<SecretData v-if="tabIndex == 2" /> |
||||||
|
</el-tab-pane> |
||||||
|
</el-tabs> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="VipData"> |
||||||
|
import SimpleData from './conponents/SimpleData.vue' |
||||||
|
import SecretData from './conponents/SecretData.vue' |
||||||
|
|
||||||
|
const tabIndex = ref(1) |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,317 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog |
||||||
|
title="试题" |
||||||
|
:close-on-click-modal="false" |
||||||
|
append-to-body |
||||||
|
v-model="visible" |
||||||
|
width="900px" |
||||||
|
> |
||||||
|
<div> |
||||||
|
<el-form |
||||||
|
ref="dialogFormRef" |
||||||
|
:model="dialogForm" |
||||||
|
:rules="dataRule" |
||||||
|
label-width="auto" |
||||||
|
label-position="right" |
||||||
|
@keyup.enter="dialogFormSubmit()" |
||||||
|
> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="题目" prop="subTitle"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.subTitle" |
||||||
|
maxlength="200" |
||||||
|
placeholder="请输入题目" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="题目关键字" prop="titleWords"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.titleWords" |
||||||
|
maxlength="1000" |
||||||
|
placeholder="请输入" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="专项" prop="categoryTitle"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.categoryTitle" |
||||||
|
maxlength="1000" |
||||||
|
placeholder="请输入" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="章节" prop="sortId"> |
||||||
|
<el-select v-model="dialogForm.sortId" style="width: 100%"> |
||||||
|
<el-option |
||||||
|
v-for="dict in sortOptions" |
||||||
|
:key="dict.sortId" |
||||||
|
:label="dict.sortName" |
||||||
|
:value="dict.sortId" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
|
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="题型" prop="subType"> |
||||||
|
<el-radio-group v-model="dialogForm.subType"> |
||||||
|
<el-radio label="1">判断题</el-radio> |
||||||
|
<el-radio label="2">单选题</el-radio> |
||||||
|
<el-radio label="3">多选题</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
|
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="排序" prop="sort"> |
||||||
|
<el-input v-model="dialogForm.sort" maxlength="20" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="选项A" prop="subTitle"> |
||||||
|
<el-input v-model="dialogForm.optA" maxlength="200" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="选项B" prop="subTitle"> |
||||||
|
<el-input v-model="dialogForm.optB" maxlength="200" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="选项C" prop="subTitle"> |
||||||
|
<el-input v-model="dialogForm.optC" maxlength="200" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="12"> |
||||||
|
<el-form-item label="选项D" prop="subTitle"> |
||||||
|
<el-input v-model="dialogForm.optD" maxlength="200" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="答案" prop="answer"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.answer" |
||||||
|
maxlength="200" |
||||||
|
placeholder="请输入" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="难点分析" prop="infos"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.infos" |
||||||
|
maxlength="1000" |
||||||
|
placeholder="请输入" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="答题技巧" prop="dtjq"> |
||||||
|
<el-input v-model="dialogForm.dtjq" maxlength="1000" placeholder="请输入" clearable /> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
|
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="技巧关键字" prop="jqWords"> |
||||||
|
<el-input |
||||||
|
v-model="dialogForm.jqWords" |
||||||
|
maxlength="1000" |
||||||
|
placeholder="请输入" |
||||||
|
clearable |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="车型" prop="chexing"> |
||||||
|
<span v-if="dialogForm.chexing == 'C1'">小车</span> |
||||||
|
<span v-if="dialogForm.chexing == 'D'">摩托车</span> |
||||||
|
<span v-if="dialogForm.chexing == 'B2'">货车</span> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-form-item label="科目" prop="examType"> |
||||||
|
<span v-if="dialogForm.examType == '1'">科一</span> |
||||||
|
<span v-if="dialogForm.examType == '4'">科四</span> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-form-item label="题目图片" prop="imageUrl"> |
||||||
|
<el-upload |
||||||
|
action="#" |
||||||
|
accept=".png,.jpg,.jpeg,.gif" |
||||||
|
:limit="1" |
||||||
|
:http-request="handleImport" |
||||||
|
:on-exceed="handleExceed" |
||||||
|
:show-file-list="false" |
||||||
|
> |
||||||
|
<img v-if="imgUrl" :src="imgUrl" style="width: 200px" /> |
||||||
|
<i v-else class="el-icon-plus"></i> |
||||||
|
</el-upload> |
||||||
|
</el-form-item> |
||||||
|
</el-row> |
||||||
|
</el-form> |
||||||
|
</div> |
||||||
|
<template #footer> |
||||||
|
<span class="dialog-footer"> |
||||||
|
<el-button plain @click="visible = false">取消</el-button> |
||||||
|
<el-button type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()" |
||||||
|
>确定</el-button |
||||||
|
> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="QuesAddForm"> |
||||||
|
import { addQuestion, updateQuestion, uploadFile, getQuestionSort } from '@/api/xjapplet/xjdatabase' |
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗 |
||||||
|
|
||||||
|
const emit = defineEmits(['update']) |
||||||
|
|
||||||
|
const visible = ref(false) |
||||||
|
const canSubmit = ref(true) |
||||||
|
const imgUrl = ref(undefined) |
||||||
|
const sortOptions = ref([]) |
||||||
|
const dialogForm = ref({ |
||||||
|
id: undefined, |
||||||
|
sort: 0, |
||||||
|
categoryTitle: undefined, |
||||||
|
subTitle: undefined, |
||||||
|
infos: undefined, |
||||||
|
optA: undefined, |
||||||
|
optB: undefined, |
||||||
|
optC: undefined, |
||||||
|
optD: undefined, |
||||||
|
subPic: undefined, |
||||||
|
subType: undefined, |
||||||
|
answer: undefined, |
||||||
|
examType: undefined, |
||||||
|
dtjqPic: undefined |
||||||
|
}) |
||||||
|
|
||||||
|
const dataRule = { |
||||||
|
schoolName: [{ required: true, message: '驾校名称不能为空', trigger: 'blur' }], |
||||||
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }] |
||||||
|
} |
||||||
|
|
||||||
|
const open = (info = undefined) => { |
||||||
|
visible.value = true |
||||||
|
getQuestionChapter(info) |
||||||
|
resetDialogForm() |
||||||
|
if (info) { |
||||||
|
dialogForm.value = { ...info } |
||||||
|
if (dialogForm.value.subPic) { |
||||||
|
imgUrl.value = 'https://ss-cloud.ahduima.com/xjxc/pic/' + dialogForm.value.subPic |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
defineExpose({ |
||||||
|
open |
||||||
|
}) |
||||||
|
|
||||||
|
const getQuestionChapter = (info) => { |
||||||
|
getQuestionSort({ chexing: info.chexing, examType: info.examType }).then((data) => { |
||||||
|
sortOptions.value = data |
||||||
|
}) |
||||||
|
} |
||||||
|
const resetDialogForm = () => { |
||||||
|
dialogForm.value = { |
||||||
|
id: undefined, |
||||||
|
sort: 0, |
||||||
|
subTitle: undefined, |
||||||
|
infos: undefined, |
||||||
|
optA: undefined, |
||||||
|
optB: undefined, |
||||||
|
optC: undefined, |
||||||
|
optD: undefined, |
||||||
|
subPic: undefined, |
||||||
|
subType: undefined, |
||||||
|
answer: undefined, |
||||||
|
examType: undefined, |
||||||
|
dtjqPic: undefined, |
||||||
|
dtjq: undefined, |
||||||
|
jqtp: undefined, |
||||||
|
biaoji: undefined, |
||||||
|
titleWords: undefined, |
||||||
|
jqWords: undefined, |
||||||
|
optaWords: undefined, |
||||||
|
optbWords: undefined, |
||||||
|
optcWords: undefined, |
||||||
|
optdWords: undefined, |
||||||
|
chexing: undefined |
||||||
|
} |
||||||
|
} |
||||||
|
const dialogFormRef = ref(null) |
||||||
|
// 表单提交 |
||||||
|
const dialogFormSubmit = async () => { |
||||||
|
if (!dialogFormRef.value) return |
||||||
|
const valid = await dialogFormRef.value.validate() |
||||||
|
if (!valid) return |
||||||
|
|
||||||
|
if (dialogForm.value.id) { |
||||||
|
updateQuestion(dialogForm.value).then((response) => { |
||||||
|
if (response) { |
||||||
|
message.success('修改成功') |
||||||
|
emit('update') |
||||||
|
visible.value = false |
||||||
|
} |
||||||
|
}) |
||||||
|
} else { |
||||||
|
addQuestion(dialogForm.value).then((response) => { |
||||||
|
if (response) { |
||||||
|
message.success('新增成功') |
||||||
|
visible.value = false |
||||||
|
emit('update') |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
||||||
|
const handleImport = (opt) => { |
||||||
|
const data = new FormData() |
||||||
|
data.append('file', opt.file) |
||||||
|
uploadFile(data).then((resp) => { |
||||||
|
if (resp.code == 200) { |
||||||
|
message.success('文件上传成功') |
||||||
|
dialogForm.value.subPic = resp.data |
||||||
|
imgUrl.value = 'https://ss-cloud.ahduima.com/xjxc/pic/' + dialogForm.value.subPic |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
const handleExceed = (files) => { |
||||||
|
handleImport({ file: files[0] }) |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,156 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container" style="text-align: center"> |
||||||
|
<el-form size="small" :inline="true" label-width="68px" @submit.prevent> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-form-item label="车型"> |
||||||
|
<el-radio-group v-model="queryParams.chexing"> |
||||||
|
<el-radio label="C1">小车</el-radio> |
||||||
|
<el-radio label="D">摩托车</el-radio> |
||||||
|
<el-radio label="B2">货车</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="科目"> |
||||||
|
<el-radio-group v-model="queryParams.examType"> |
||||||
|
<el-radio label="1">科一</el-radio> |
||||||
|
<el-radio label="4">科四</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
|
||||||
|
<el-form-item label="有图片"> |
||||||
|
<el-radio-group v-model="queryParams.isPic"> |
||||||
|
<el-radio :label="true">有</el-radio> |
||||||
|
<el-radio :label="false">无</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
</el-row> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-form-item label="题目"> |
||||||
|
<el-input |
||||||
|
v-model="queryParams.subTitle" |
||||||
|
placeholder="请输入题目" |
||||||
|
clearable |
||||||
|
style="width: 400px" |
||||||
|
@keyup.enter="handleQuery" |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item> |
||||||
|
<el-button type="primary" @click="handleQuery">搜索</el-button> |
||||||
|
<el-button @click="resetQuery">重置</el-button> |
||||||
|
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-row> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tableList" highlight-current-row> |
||||||
|
<el-table-column type="index" width="55" align="center" /> |
||||||
|
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" /> |
||||||
|
<el-table-column label="选项" align="left" min-width="140"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<p v-if="row.optA">A:{{ row.optA }}</p> |
||||||
|
<p v-if="row.optB">B:{{ row.optB }}</p> |
||||||
|
<p v-if="row.optC">C:{{ row.optC }}</p> |
||||||
|
<p v-if="row.optD">D:{{ row.optD }}</p> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="答案" align="center" prop="answer" width="100" /> |
||||||
|
<el-table-column label="车型" align="center" prop="chexing" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<span v-if="row.chexing == 'C1'">小车</span> |
||||||
|
<span v-if="row.chexing == 'D'">摩托车</span> |
||||||
|
<span v-if="row.chexing == 'B2'">货车</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="科目" align="center" prop="examType" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<span v-if="row.examType == '1'">科一</span> |
||||||
|
<span v-if="row.examType == '4'">科四</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="章节" align="center" prop="sortName" min-width="100" /> |
||||||
|
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" /> |
||||||
|
<el-table-column label="图片" align="center" width="100"> |
||||||
|
<template #default="{ row }"> |
||||||
|
<!-- <img v-if="row.subPic" :src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" width="80px"> --> |
||||||
|
<el-image |
||||||
|
v-if="row.subPic" |
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" |
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`]" |
||||||
|
:lazy="true" |
||||||
|
style="width: 80px" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="140"> |
||||||
|
<template #default="scope"> |
||||||
|
<el-button type="primary" link @click="handleEdit(scope.row)">编辑</el-button> |
||||||
|
<el-button type="primary" link @click="handleDelete(scope.row.id)">删除</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
|
||||||
|
<pagination |
||||||
|
v-show="total > 0" |
||||||
|
:total="total" |
||||||
|
v-model:page="queryParams.pageNo" |
||||||
|
v-model:limit="queryParams.pageSize" |
||||||
|
@pagination="getList" |
||||||
|
/> |
||||||
|
<QuestionAddForm ref="dialogAddForm" @update="getList" /> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup name="XjDatabase"> |
||||||
|
import { searchQuestion, deleteQuestion } from '@/api/xjapplet/xjdatabase' |
||||||
|
import QuestionAddForm from './components/QuestionAddForm.vue' |
||||||
|
|
||||||
|
const loading = ref(false) |
||||||
|
const total = ref(0) |
||||||
|
const tableList = ref([]) |
||||||
|
const queryParams = reactive({ |
||||||
|
subTitle: '', |
||||||
|
chexing: 'C1', |
||||||
|
examType: '1', |
||||||
|
isPic: undefined, |
||||||
|
pageNo: 1, |
||||||
|
pageSize: 100 |
||||||
|
}) |
||||||
|
|
||||||
|
function getList() { |
||||||
|
loading.value = true |
||||||
|
searchQuestion(queryParams).then((response) => { |
||||||
|
tableList.value = response.list |
||||||
|
total.value = response.total |
||||||
|
loading.value = false |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
function handleQuery() { |
||||||
|
getList() |
||||||
|
} |
||||||
|
|
||||||
|
function resetQuery() { |
||||||
|
queryParams.subTitle = '' |
||||||
|
handleQuery() |
||||||
|
} |
||||||
|
|
||||||
|
const dialogAddForm = ref(null) |
||||||
|
function handleEdit(item) { |
||||||
|
dialogAddForm.value.open(item) |
||||||
|
} |
||||||
|
|
||||||
|
function handleAdd() { |
||||||
|
dialogAddForm.value.open({ |
||||||
|
examType: queryParams.examType, |
||||||
|
chexing: queryParams.chexing |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
function handleDelete(id) { |
||||||
|
deleteQuestion(id).then(() => { |
||||||
|
getList() |
||||||
|
}) |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped></style> |
Loading…
Reference in new issue