Commit 8e6b76a6 authored by yuwenwen's avatar yuwenwen

代码调整

parent a8a2a392
......@@ -24,4 +24,13 @@ export function delData(id) {
url: `/bbs/moment/comment/${id}`,
method: 'delete'
})
}
// 置顶/取消置顶
export function isTopData(data){
return request({
url:'/bbs/moment/comment/top',
method:'post',
data
})
}
\ No newline at end of file
......@@ -41,4 +41,13 @@ export function exchange(data){
method:'post',
data
})
}
\ No newline at end of file
}
// 批量兑换
export function batchExchange(data){
return request({
url:'/bbs/points/exchange/batch/exchange',
method:'post',
data
})
}
......@@ -70,3 +70,12 @@ export function updatePointsSetting(data){
data
})
}
// 批量增加积分
export function batchAddPoints(data){
return request({
url:'/bbs/points/user/points/batch/incr',
method:'put',
data
})
}
......@@ -13,13 +13,13 @@
</el-form-item>
</el-form>
<div v-if="selectDataList.length > 0" class="mb20">
<el-tag v-for="tag in selectDataList" :key="tag.userName" closable>
<el-tag v-for="tag in selectDataList" :key="tag.userName" closable style="margin-right: 5px;">
{{ tag.nickName }}
</el-tag>
</div>
<el-table ref="tableRef" row-key="userName" :data="list" @selection-change="handleCheckboxChange"
v-loading="loading">
<el-table-column type="selection" width="60"></el-table-column>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="姓名" prop="nickName" align="center"></el-table-column>
<el-table-column label="用户名" prop="userName" align="center"></el-table-column>
</el-table>
......@@ -126,9 +126,6 @@ export default {
}
},
handleClose() {
// this.selectDataList = [];
// this.list = [];
// this.total = 0;
this.visible = false
},
handleConfirm() {
......
......@@ -71,7 +71,7 @@ export default {
},
handleUserChange(val) {
pointsDetail(val).then(res => {
if (val) {
if (val && res.data) {
this.selectName = res.data.nickName;
}
})
......
......@@ -29,6 +29,8 @@
<el-table-column label="操作" align="center">
<template #default="{ row }">
<el-button type="text" @click="handleDelete(row)">删除</el-button>
<el-button type="text" v-if="!row.isTop" @click="handleTop(row, 1)">置顶</el-button>
<el-button type="text" v-if="row.isTop == 1" @click="handleTop(row, 0)">取消置顶</el-button>
</template>
</el-table-column>
</el-table>
......@@ -41,7 +43,7 @@
</template>
<script>
import { listData, delData } from '@/api/comment';
import { listData, delData, isTopData } from '@/api/comment';
export default {
name: 'Sensitives',
......@@ -91,6 +93,20 @@ export default {
pageSize: 10
}
this.getList()
},
// 置顶/取消置顶
handleTop(row, isTop) {
let text = isTop == '0' ? '取消置顶' : '置顶'
let data = {
isTop,
commentId: row.id
}
this.$modal.confirm(`确认要${text}评论内容为:${row.content}的数据吗?`).then(function () {
return isTopData(data);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
this.getList()
})
}
}
}
......
......@@ -3,10 +3,16 @@
<div class="page-container">
<el-form :model="queryParams" :inline="true" label-width="80px">
<el-form-item label="动态内容">
<el-input placeholder="请输入" v-model="queryParams.content" style="width: 200px;"></el-input>
<el-input placeholder="请输入" v-model="queryParams.content" style="width: 240px;"></el-input>
</el-form-item>
<el-form-item label="话题">
<el-input placeholder="请输入" v-model="queryParams.topicNames" style="width: 200px;"></el-input>
<el-input placeholder="请输入" v-model="queryParams.topicNames" style="width: 240px;"></el-input>
</el-form-item>
<el-form-item label="姓名">
<el-input placeholder="请输入" v-model="queryParams.nickName" style="width: 240px;"></el-input>
</el-form-item>
<el-form-item label="学工号">
<el-input placeholder="请输入" v-model="queryParams.userName" style="width: 240px;"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker placeholder="请选择" type="daterange" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
......@@ -42,7 +48,7 @@
</template>
</el-table-column>
<el-table-column label="话题" align="center" prop="topicNames" width="200"></el-table-column>
<el-table-column label="号" prop="userName" align="center" width="140"></el-table-column>
<el-table-column label="学工号" prop="userName" align="center" width="140"></el-table-column>
<el-table-column label="姓名" prop="nickName" align="center" width="120"></el-table-column>
<el-table-column label="部门(班级)" prop="deptName" align="center" width="120"></el-table-column>
<el-table-column label="上级部门(学院)" prop="fullDeptName" align="center" width="160"></el-table-column>
......
<template>
<el-dialog :visible.sync="visible" v-if="visible" title="批量兑换" :close-on-click-modal="false" width="36%"
class="dialog" @close="handleClose">
<el-form :model="form" ref="formRef" label-position="top" :rules="rules">
<el-form-item label="用户名" prop="userName">
<UserSelectInput v-model="form.userName" :value.sync="form.userName" :multiple="true"
@getValue="getNickName" placeholder="请选择用户"></UserSelectInput>
</el-form-item>
<el-form-item label="商品" prop="goodsCode">
<GoodsSelectInput :value.sync="form.goodsCode" placeholder="请选择兑换商品"></GoodsSelectInput>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</template>
</el-dialog>
</template>
<script>
// import { pointsExchange, exchange } from '@/api/pointsExchange'
import { batchExchange } from '@/api/pointsExchange';
import UserSelectInput from '@/components/UserSelect/input'
import GoodsSelectInput from '@/components/GoodsSelect/input'
export default {
data() {
return {
visible: false,
form: {},
userList: [],
optionList: [],
rules: {
userName: [{ required: true, message: '请选择用户', trigger: ['blur', 'change'] }],
goodsCode: [{ required: true, message: '请选择商品', trigger: ['blur', 'change'] }]
},
disabled: false
}
},
components: {
UserSelectInput,
GoodsSelectInput
},
// watch: {
// "form.userName": {
// handler: function (val, oVal) {
// console.log(val, oVal)
// if (val) {
// this.formatData(val)
// }
// }
// },
// deep: true,
// immediate: true
// },
methods: {
// 打开兑换窗口
openModal(row) {
this.visible = true;
},
getNickName(val, name) {
this.formatData(val, name);
},
formatData(val, name) {
let users = [];
let userNames = val.split(',')
let nickNames = name.split(',')
userNames.forEach((item, index) => {
users.push({ nickName: nickNames[index], userName: item })
})
if (users.length > 0) {
this.form.users = users;
}
},
handleConfirm() {
let { users, goodsCode } = this.form;
let data = {
users,
goodsCode
}
this.$refs.formRef.validate((valid) => {
if (valid) {
batchExchange(data).then(res => {
if (res.code == 200) {
if (res.data.length == 0) {
this.$modal.msgSuccess('批量兑换商品成功')
} else {
let userName = res.data.map((item)=>{
return item.userName;
}).join(',')
let msg = `失败:${res.data.length}条,失败用户:${userName}`
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + msg + "</div>", "结果", { dangerouslyUseHTMLString: true });
}
this.handleClose()
this.$emit('handleOk');
} else {
this.$modal.msgError(res.msg || "批量兑换商品失败");
}
})
}
})
},
handleClose() {
this.form = {}
this.visible = false
}
}
}
</script>
<style lang="scss">
.dialog {
.el-dialog__body {
padding: 0 20px !important;
}
}
</style>
......@@ -10,7 +10,7 @@
<el-input placeholder="请输入" v-model="queryParams.nickName" style="width: 220px;"></el-input>
</el-form-item>
<el-form-item label="兑换商品">
<el-input placeholder="请输入" v-model="queryParams.goodsName" style="width: 220px;"></el-input>
<el-input placeholder="请输入" v-model="queryParams.goodsName" style="width: 220px;"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
......@@ -18,11 +18,10 @@
</el-form-item>
</el-form>
<el-row class="mb10">
<el-col :span="2">
<el-col :span="24">
<el-button type="primary" @click="handleAdd">积分兑换</el-button>
</el-col>
<el-col :span="2">
<el-button type="primary" plain @click="handleExport">导出积分明细</el-button>
<el-button type="primary" plain @click="handleBatchExchange">批量兑换</el-button>
</el-col>
</el-row>
<el-table :data="tableList">
......@@ -40,12 +39,15 @@
</div>
<!-- 积分兑换 -->
<exchange-dialog ref="exchangeDialogRef" @handleOk="handleReset"></exchange-dialog>
<!-- 批量兑换 -->
<batch-exchange ref="batchExchangeRef" @handleOk="handleReset"></batch-exchange>
</div>
</template>
<script>
import { listData, pointsExchange } from '@/api/pointsExchange';
import ExchangeDialog from '../pointsManage/ExchangeDialog.vue';
import BatchExchange from './BatchExchange.vue';
export default {
name: 'PointsExchange',
data() {
......@@ -61,7 +63,8 @@ export default {
}
},
components: {
ExchangeDialog
ExchangeDialog,
BatchExchange
},
created() {
......@@ -105,8 +108,8 @@ export default {
}, `积分明细_${new Date().getTime()}.xlsx`)
},
// 时间段选择
dateChange(val){
if(val.length > 0){
dateChange(val) {
if (val.length > 0) {
this.queryParams['params[startTime]'] = val[0]
this.queryParams['params[endTime]'] = val[1]
}
......@@ -124,7 +127,10 @@ export default {
}
this.dateRange = []
this.getList()
}
},
handleBatchExchange(){
this.$refs.batchExchangeRef.openModal()
},
}
}
</script>
......
<template>
<el-dialog :visible.sync="visible" v-if="visible" title="批量增加积分" :close-on-click-modal="false" width="36%"
class="dialog" @close="handleClose">
<el-form :model="form" ref="formRef" label-position="top" :rules="rules">
<el-form-item label="用户名" prop="userName">
<UserSelectInput v-model="form.userName" :value.sync="form.userName" :multiple="true"
@getValue="getNickName" placeholder="请选择用户"></UserSelectInput>
</el-form-item>
<el-form-item label="积分" prop="points">
<el-input v-model="form.points" placeholder="请输入"></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</template>
</el-dialog>
</template>
<script>
// import { pointsExchange, exchange } from '@/api/pointsExchange'
import { batchAddPoints } from '@/api/pointsManage';
import UserSelectInput from '@/components/UserSelect/input'
export default {
data() {
return {
visible: false,
form: {},
userList: [],
optionList: [],
rules: {
userName: [{ required: true, message: '请选择用户', trigger: ['blur', 'change'] }],
points: [{ required: true, message: '请输入积分', trigger: ['blur', 'change'] }]
},
disabled: false
}
},
components: {
UserSelectInput,
},
// watch: {
// "form.userName": {
// handler: function (val, oVal) {
// console.log(val, oVal)
// if (val) {
// this.formatData(val)
// }
// }
// },
// deep: true,
// immediate: true
// },
methods: {
// 打开兑换窗口
openModal(row) {
this.visible = true;
},
getNickName(val, name) {
this.formatData(val, name);
},
formatData(val, name) {
let users = [];
let userNames = val.split(',')
let nickNames = name.split(',')
userNames.forEach((item, index) => {
users.push({ nickName: nickNames[index], userName: item })
})
if (users.length > 0) {
this.form.users = users;
}
},
handleConfirm() {
let { users, points } = this.form;
let data = {
users,
points
}
this.$refs.formRef.validate((valid) => {
if (valid) {
batchAddPoints(data).then(res => {
if (res.code == 200) {
if (res.data.length == 0) {
this.$modal.msgSuccess('批量添加积分成功')
} else {
let userName = res.data.map((item)=>{
return item.userName;
}).join(',')
let msg = `失败:${res.data.length}条,失败用户:${userName}`
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + msg + "</div>", "结果", { dangerouslyUseHTMLString: true });
}
this.handleClose()
this.$emit('handleOk');
} else {
this.$modal.msgError(res.msg || "批量添加积分失败");
}
})
}
})
},
handleClose() {
this.form = {}
this.visible = false
}
}
}
</script>
<style lang="scss">
.dialog {
.el-dialog__body {
padding: 0 20px !important;
}
}
</style>
......@@ -14,8 +14,12 @@
<el-col :span="2">
<el-button type="primary" @click="handleAdd">积分规则设置</el-button>
</el-col>
<el-col :span="2">
<el-button type="primary" @click="handleBatchAddPonits" plain>批量增加积分</el-button>
</el-col>
</el-row>
<el-table :data="tableList">
<!-- <el-table-column type="selection" width="55" align="center"></el-table-column> -->
<el-table-column label="序号" width="55" type="index" align="center"></el-table-column>
<el-table-column label="用户姓名" prop="nickName" align="center"></el-table-column>
<el-table-column label="用户名" prop="userName" align="center"></el-table-column>
......@@ -40,7 +44,9 @@
<!-- 积分明细 -->
<detail-dialog ref="detailDialogRef"></detail-dialog>
<!-- 积分规则设置 -->
<points-rules-dialog ref="pointsRulesDialogRef"></points-rules-dialog>
<points-rules-dialog ref="pointsRulesDialogRef"></points-rules-dialog>
<!-- 批量增加积分 -->
<batch-add-points ref="batchAddPointsRef" @handleOk="handleReset"></batch-add-points>
</div>
</template>
......@@ -49,6 +55,7 @@ import { listData, delData, addData, editData } from '@/api/pointsManage';
import ExchangeDialog from './ExchangeDialog.vue';
import DetailDialog from './DetailDialog.vue';
import PointsRulesDialog from './PointsRulesDialog.vue';
import BatchAddPoints from './BatchAddPoints.vue';
export default {
name: 'PointsMall',
data() {
......@@ -64,7 +71,8 @@ export default {
components: {
ExchangeDialog,
DetailDialog,
PointsRulesDialog
PointsRulesDialog,
BatchAddPoints
},
created() {
......@@ -162,6 +170,10 @@ export default {
pageSize: 10
}
this.getList()
},
// 批量增加积分弹窗
handleBatchAddPonits() {
this.$refs.batchAddPointsRef.openModal()
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment