添加积分模块

This commit is contained in:
axlrose2333 2023-02-24 14:45:02 +08:00
parent 309eccc116
commit c0fd22bd3f
5 changed files with 520 additions and 6 deletions

12
src/api/integral.js Normal file
View File

@ -0,0 +1,12 @@
import service from '@/utils/request'
const api = {
// 积分
getIntegralList : data => {
return service({
url: '/integral/list',
method: 'get',
params:data
})
}
}
export default api

206
src/utils/city.json Normal file
View File

@ -0,0 +1,206 @@
[
{
"ProID": 1,
"name": "北京市",
"ProSort": 1,
"ProRemark": "直辖市"
},
{
"ProID": 2,
"name": "天津市",
"ProSort": 2,
"ProRemark": "直辖市"
},
{
"ProID": 3,
"name": "河北省",
"ProSort": 5,
"ProRemark": "省份"
},
{
"ProID": 4,
"name": "山西省",
"ProSort": 6,
"ProRemark": "省份"
},
{
"ProID": 5,
"name": "内蒙古自治区",
"ProSort": 32,
"ProRemark": "自治区"
},
{
"ProID": 6,
"name": "辽宁省",
"ProSort": 8,
"ProRemark": "省份"
},
{
"ProID": 7,
"name": "吉林省",
"ProSort": 9,
"ProRemark": "省份"
},
{
"ProID": 8,
"name": "黑龙江省",
"ProSort": 10,
"ProRemark": "省份"
},
{
"ProID": 9,
"name": "上海市",
"ProSort": 3,
"ProRemark": "直辖市"
},
{
"ProID": 10,
"name": "江苏省",
"ProSort": 11,
"ProRemark": "省份"
},
{
"ProID": 11,
"name": "浙江省",
"ProSort": 12,
"ProRemark": "省份"
},
{
"ProID": 12,
"name": "安徽省",
"ProSort": 13,
"ProRemark": "省份"
},
{
"ProID": 13,
"name": "福建省",
"ProSort": 14,
"ProRemark": "省份"
},
{
"ProID": 14,
"name": "江西省",
"ProSort": 15,
"ProRemark": "省份"
},
{
"ProID": 15,
"name": "山东省",
"ProSort": 16,
"ProRemark": "省份"
},
{
"ProID": 16,
"name": "河南省",
"ProSort": 17,
"ProRemark": "省份"
},
{
"ProID": 17,
"name": "湖北省",
"ProSort": 18,
"ProRemark": "省份"
},
{
"ProID": 18,
"name": "湖南省",
"ProSort": 19,
"ProRemark": "省份"
},
{
"ProID": 19,
"name": "广东省",
"ProSort": 20,
"ProRemark": "省份"
},
{
"ProID": 20,
"name": "海南省",
"ProSort": 24,
"ProRemark": "省份"
},
{
"ProID": 21,
"name": "广西壮族自治区",
"ProSort": 28,
"ProRemark": "自治区"
},
{
"ProID": 22,
"name": "甘肃省",
"ProSort": 21,
"ProRemark": "省份"
},
{
"ProID": 23,
"name": "陕西省",
"ProSort": 27,
"ProRemark": "省份"
},
{
"ProID": 24,
"name": "新疆维吾尔自治区",
"ProSort": 31,
"ProRemark": "自治区"
},
{
"ProID": 25,
"name": "青海省",
"ProSort": 26,
"ProRemark": "省份"
},
{
"ProID": 26,
"name": "宁夏回族自治区",
"ProSort": 30,
"ProRemark": "自治区"
},
{
"ProID": 27,
"name": "重庆市",
"ProSort": 4,
"ProRemark": "直辖市"
},
{
"ProID": 28,
"name": "四川省",
"ProSort": 22,
"ProRemark": "省份"
},
{
"ProID": 29,
"name": "贵州省",
"ProSort": 23,
"ProRemark": "省份"
},
{
"ProID": 30,
"name": "云南省",
"ProSort": 25,
"ProRemark": "省份"
},
{
"ProID": 31,
"name": "西藏自治区",
"ProSort": 29,
"ProRemark": "自治区"
},
{
"ProID": 32,
"name": "台湾省",
"ProSort": 7,
"ProRemark": "省份"
},
{
"ProID": 33,
"name": "澳门特别行政区",
"ProSort": 33,
"ProRemark": "特别行政区"
},
{
"ProID": 34,
"name": "香港特别行政区",
"ProSort": 34,
"ProRemark": "特别行政区"
}
]

View File

@ -216,11 +216,13 @@ function addExamFunc(data) {
<el-table :data="item.course_sub" >
<el-table-column align="left" label="ID" width="60" prop="course_subsection_id" />
<el-table-column align="left" label="子章节名称" min-width="60" prop="name" />
<el-table-column align="left" label="课件名称" min-width="60" prop="url_name" />
<el-table-column align="left" label="课件名称" min-width="60" prop="url">
<template #default="scope">{{scope.row.url?scope.row.url:'未上传课件'}}</template>
</el-table-column>
<el-table-column align="left" label="章节习题" min-width="60" prop="is_contain_exercise">
<el-table-column align="left" label="章节试卷" min-width="60" prop="exam_id">
<template #default="scope">
{{scope.row.is_contain_exercise === 0?'未添加习题':scope.row.is_contain_exercise}}
{{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}}
</template>
</el-table-column>
<el-table-column align="left" label="章节价格" min-width="60" prop="price" />

View File

@ -0,0 +1,294 @@
<script setup>
//
import api from '@/api/order'
import capi from '@/api/course'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
// import { toSQLLine } from '@/utils/stringFun'
// import WarningBar from '@/components/warningBar/warningBar.vue'
// import coursePool from './components/coursePool.vue'
// import exercisesPool from '@/view/course/components/exercisesPool.vue'
import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
// store
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
//
const path = ref(import.meta.env.VITE_BASE_API)
// const typeList = custom.getExercisesTypeList()
const queryParams = ref({
teacherId:0,
page:1,
pageSize:10,
status:'',
province:''
})
const tableData = ref([])
const deleteVisible = ref(false)
const total = ref(0)
const dialogFormVisible = ref(false)
const dialogTitle = ref('')
const form =ref({})
const rules = ref({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }]
})
const content = ref(null)
// const options = ref([]) //
const exam_types = ref([])
const exam_ids = ref([])
import cityList from '@/utils/city.json';
// const cityList = ref([])
//
onMounted(() => {
getIntegralList()
})
const stateList = ref([
{
name:'正常',
value:1
},
{
name:'冻结',
value:2
}
])
//
async function getIntegralList() {
const res = await api.getIntegralList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
total.value = res.data.total
}
}
function onSubmit() {
getIntegralList()
}
const onReset = () => {
queryParams.value = {
pageIndex:1,
pageSize:10,
name:'',
status:'',
subject:''
}
}
function openDialog(type) {
// let params = {}
switch (type){
case 'add':
dialogTitle.value = '新增试卷'
form.value = {}
break;
case 'edit':
// params.question_id = question_id.value
dialogTitle.value = '编辑试卷'
break;
}
dialogFormVisible.value = true
// router.push({name:'addCourse',params})
}
async function onDelete() {
const ids = exam_ids.value
const res = await api.delExamination({ exam_ids:ids })
if (res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
deleteVisible.value = false
getIntegralList()
}
}
const handleSelectionChange = (val) => {
exam_ids.value = val.map((item) => {
return item.exam_id
})
}
function deleteExamFunc(row) {
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.delExamination({
exam_ids:[row.exam_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
getIntegralList()
}
},() => {
})
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = val
getIntegralList()
}
function handleSizeChange(val) {
queryParams.value.pageSize = val
getIntegralList()
}
function closeDialog(){
dialogFormVisible.value = false
exam_types.value = []
form.value = {}
}
async function enterDialog() { //
form.value.teacher_id = 0
form.value.exam_type = exam_types.value.map((item) => {
return item = parseInt(item)
})
form.value.duration = parseInt(form.value.duration)
// return
const params = {
...form.value
}
params.question_ids = JSON.stringify(form.value.question_ids)
params.course_ids = JSON.stringify(form.value.course_ids)
let func_name = 'addExamination'
if(form.value.exam_id) { //
func_name = 'editExamination'
}
const res = await api[func_name](params)
if(res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
closeDialog()
getIntegralList()
}
}
function viewOrderFunc(row) { //
router.push({name:'viewOrder',params:{order_id:row.order_id}})
}
function getStateName(state) {
let str = ''
switch (state){
case 1:
str = '正常'
break;
case 2:
str = '冻结'
break;
}
return str
}
</script>
<template>
<div>
<!-- 搜索框-->
<div class="gva-search-box">
<el-form ref="searchForm" :inline="true" :model="queryParams">
<el-form-item label="状态">
<el-select v-model="queryParams.status" filterable placeholder="请选择">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="所属区域">
<el-select v-model="queryParams.province" filterable placeholder="请选择">
<el-option
v-for="item in cityList"
:key="item.ProID"
:label="item.name"
:value="item.ProID"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格数据-->
<div class="gva-table-box">
<!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="order_id" sortable="custom" />
<el-table-column align="center" label="姓名" min-width="150" prop="nickname" />
<el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="所属区域" min-width="150" prop="phone" />
<el-table-column align="center" label="剩余积分" min-width="150" prop="phone" />
<el-table-column align="center" label="累计积分" min-width="150" prop="phone" />
<el-table-column align="center" label="邀请好友(分)" min-width="150" prop="phone" />
<el-table-column align="center" label="购买课程(分)" min-width="150" prop="phone" />
<el-table-column align="center" label="累计消费(分)" min-width="150" prop="phone" />
<el-table-column align="center" label="抽奖(分)" min-width="150" prop="phone" />
<el-table-column align="center" label="竞拍(分)" min-width="150" prop="phone" />
<el-table-column align="center" label="状态" >
<template #default="scope">
<div>{{getStateName(scope.row.status)}}</div>
</template>
</el-table-column>
<el-table-column align="center" label="提交时间" min-width="150" >
<template #default="scope">
{{formatDate(scope.row.CreatedAt)}}
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button
icon="edit"
size="small"
type="primary"
link
@click="viewOrderFunc(scope.row)"
>冻结</el-button>
<el-button
icon="delete"
size="small"
type="danger"
link
@click="deleteExamFunc(scope.row)"
>解冻</el-button>
</template>
</el-table-column>
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="queryParams.page"
:page-size="queryParams.pageSize"
:page-sizes="[10, 30, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.e-img{
width: 150px;
height: 100px;
}
.option-item{
display: flex;
align-items: center;
margin-bottom: 10px;
}
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>

View File

@ -90,9 +90,9 @@ function getStateName(state) {
</div>
</div>
<!-- 操作区域-->
<div class="action-box">
<div class="pay-btn">去付款</div>
</div>
<!-- <div class="action-box">-->
<!-- <div class="pay-btn">去付款</div>-->
<!-- </div>-->
</div>
</div>