邮箱服务

main
王宇航 2024-05-29 18:13:56 +08:00
parent a7f6500ddd
commit a3ad6227e1
11 changed files with 540 additions and 115 deletions

View File

@ -96,7 +96,7 @@ public class AppLoginController {
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail()); AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
Assert.isNull(emailUser, "邮箱已注册"); Assert.isNull(emailUser, "邮箱已注册");
String uuid = IdUtils.fastUUID(); String uuid = IdUtils.fastUUID();
redisService.setCacheMapValue(uuid,registerForm.getEmail() , registerForm); redisService.setCacheObject(uuid, registerForm);
try { try {
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>" String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>" + "<p>请点击下面的网址确认您的注册:</p>"
@ -250,16 +250,17 @@ public class AppLoginController {
@RequestMapping(path = "/activation/{token}/{email}", method = RequestMethod.GET) @RequestMapping(path = "/activation/{token}/{email}", method = RequestMethod.GET)
public String activation(@PathVariable String token, @PathVariable String email) { public String activation(@PathVariable String token, @PathVariable String email) {
Map<String, Object> cacheMap = redisService.getCacheMap(token); RegisterForm cacheMap = redisService.getCacheObject(token);
if (email.equals(cacheMap.get("email"))) { if (email.equals(cacheMap.getEmail())) {
AppRegister appRegister = (AppRegister) cacheMap.get("email"); /* AppRegister appRegister = (AppRegister) cacheMap.getEmail();
appRegister.setStatus(1); appRegister.setStatus(1);
appRegisterService.updateAppRegister(appRegister); appRegisterService.updateAppRegister(appRegister);*/
/*AppRegister appRegister = appRegisterService.selectAppRegisterByEmail(email);
AppUser appUser = new AppUser(); AppUser appUser = new AppUser();
BeanUtils.copyBeanProp(appUser, appRegister); BeanUtils.copyBeanProp(appUser, appRegister);
appUserService.insertAppUser(appUser); appUserService.insertAppUser(appUser);*/
} }

View File

@ -4,7 +4,9 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.app.domain.AppTopic;
import com.ruoyi.app.domain.vo.AppSkillVo; import com.ruoyi.app.domain.vo.AppSkillVo;
import com.ruoyi.app.domain.vo.AppTopicVo;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -46,14 +48,22 @@ public class AppSkillController extends BaseController
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET") @ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET")
public TableDataInfo list(AppSkill appSkill) public AjaxResult list(AppSkill appSkill)
{ {
startPage();
List<AppSkill> list = appSkillService.selectAppSkillList(appSkill); List<AppSkill> list = appSkillService.selectAppSkillList(appSkill);
return success(list);
}
@GetMapping("/skillList")
@ApiOperation(value = "组装过查询话题信息列表", notes = "组装过查询话题信息列表", httpMethod = "GET")
public TableDataInfo skillList(AppSkill appSkill)
{
List<AppSkillVo> list = appSkillService.skillList(appSkill);
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/list/tree") @GetMapping("/list/tree")
@ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET") @ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET")
public AjaxResult listTree(AppSkill appSkill) public AjaxResult listTree(AppSkill appSkill)

View File

@ -62,4 +62,6 @@ public interface IAppSkillService
List<AppSkillVo> selectAppSkillTreeList(AppSkill appSkill); List<AppSkillVo> selectAppSkillTreeList(AppSkill appSkill);
List<AppSkillVo> skillList(AppSkill appSkill);
} }

View File

@ -117,4 +117,20 @@ public class AppSkillServiceImpl implements IAppSkillService
return appSkillVos; return appSkillVos;
} }
@Override
public List<AppSkillVo> skillList(AppSkill appSkill) {
appSkill.setType("0");
List<AppSkill> list = appSkillMapper.selectAppSkillList(appSkill);
List<AppSkillVo> appSkillVos = new ArrayList<>();
for (AppSkill skill : list) {
AppSkillVo appSkillVo = new AppSkillVo();
BeanUtils.copyProperties(skill,appSkillVo);
appSkill = new AppSkill();
appSkill.setParentId(appSkillVo.getId());
appSkillVo.setChildren(appSkillMapper.selectAppSkillList(appSkill));
appSkillVos.add(appSkillVo);
}
return appSkillVos;
}
} }

View File

@ -260,6 +260,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderEndTime != null">order_end_time,</if> <if test="orderEndTime != null">order_end_time,</if>
<if test="check != null">`check`,</if> <if test="check != null">`check`,</if>
<if test="backGroundImg != null">`back_ground_img`,</if> <if test="backGroundImg != null">`back_ground_img`,</if>
<if test="pushId != null">push_id</if>
<if test="provinceId != null">province_id</if>
<if test="cityId != null">city_id</if>
<if test="townId != null">town_id</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if> <if test="username != null">#{username},</if>
@ -300,6 +304,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderEndTime != null">#{orderEndTime},</if> <if test="orderEndTime != null">#{orderEndTime},</if>
<if test="check != null">#{check},</if> <if test="check != null">#{check},</if>
<if test="backGroundImg != null">#{backGroundImg},</if> <if test="backGroundImg != null">#{backGroundImg},</if>
<if test="pushId != null">#{pushId}</if>
<if test="provinceId != null">#{provinceId}</if>
<if test="cityId != null">#{cityId}</if>
<if test="townId != null">#{townId}</if>
</trim> </trim>
</insert> </insert>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询兑换码列表
export function listCode(query) {
return request({
url: '/app/code/list',
method: 'get',
params: query
})
}
// 查询兑换码详细
export function getCode(id) {
return request({
url: '/app/code/' + id,
method: 'get'
})
}
// 新增兑换码
export function addCode(data) {
return request({
url: '/app/code',
method: 'post',
data: data
})
}
// 修改兑换码
export function updateCode(data) {
return request({
url: '/app/code',
method: 'put',
data: data
})
}
// 删除兑换码
export function delCode(id) {
return request({
url: '/app/code/' + id,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询标签信息列表 // 查询标签信息列表
export function listSkill(query) { export function listSkill(query) {
return request({ return request({
url: '/app/skill/list', url: 'app/app/skill/list',
method: 'get', method: 'get',
params: query params: query
}) })
@ -12,7 +12,7 @@ export function listSkill(query) {
// 查询标签信息详细 // 查询标签信息详细
export function getSkill(id) { export function getSkill(id) {
return request({ return request({
url: '/app/skill/' + id, url: 'app/app/skill/' + id,
method: 'get' method: 'get'
}) })
} }
@ -20,7 +20,7 @@ export function getSkill(id) {
// 新增标签信息 // 新增标签信息
export function addSkill(data) { export function addSkill(data) {
return request({ return request({
url: '/app/skill', url: 'app/app/skill',
method: 'post', method: 'post',
data: data data: data
}) })
@ -29,7 +29,7 @@ export function addSkill(data) {
// 修改标签信息 // 修改标签信息
export function updateSkill(data) { export function updateSkill(data) {
return request({ return request({
url: '/app/skill', url: 'app/app/skill',
method: 'put', method: 'put',
data: data data: data
}) })
@ -38,7 +38,7 @@ export function updateSkill(data) {
// 删除标签信息 // 删除标签信息
export function delSkill(id) { export function delSkill(id) {
return request({ return request({
url: '/app/skill/' + id, url: 'app/app/skill/' + id,
method: 'delete' method: 'delete'
}) })
} }

View File

@ -113,9 +113,15 @@
<el-input v-model="form.email" placeholder="请输入邮箱域名" /> <el-input v-model="form.email" placeholder="请输入邮箱域名" />
</el-form-item> </el-form-item>
<el-form-item label="学校头像" prop="schoolImg"> <el-form-item label="学校头像" prop="schoolImg">
<div class="text-center"> <el-upload
<schoolAvatar /> class="avatar-uploader"
</div> :action="upload.uploadUrl"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="this.form.schoolImg" :src="this.form.schoolImg" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item> </el-form-item>
<!-- <el-form-item label="学校头像">--> <!-- <el-form-item label="学校头像">-->
<!-- <el-upload--> <!-- <el-upload-->
@ -143,7 +149,6 @@
:headers="upload.headers" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:auto-upload="false" :auto-upload="false"
drag drag
@ -219,6 +224,7 @@ export default {
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// //
url: process.env.VUE_APP_BASE_API + "app/school/importData", url: process.env.VUE_APP_BASE_API + "app/school/importData",
uploadUrl: process.env.VUE_APP_BASE_API + "/app/api/oss/upload",
}, },
}; };
}, },
@ -226,6 +232,25 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleAvatarSuccess(res, file) {
console.log(res);
this.form.schoolImg = res.data;
console.log(this.schoolImg);
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
return isJPG && isLt2M;
},
/** 查询学校配置列表 */ /** 查询学校配置列表 */
getList() { getList() {
this.loading = true; this.loading = true;

View File

@ -9,22 +9,6 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="更新人" prop="updateBy">
<el-input
v-model="queryParams.updateBy"
placeholder="请输入更新人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="父级id" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入父级id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -39,52 +23,30 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['app:skill:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="info"
plain plain
icon="el-icon-edit" icon="el-icon-sort"
size="mini" size="mini"
:disabled="single" @click="toggleExpandAll"
@click="handleUpdate" >展开/折叠</el-button>
v-hasPermi="['app:skill:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['app:skill:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['app:skill:export']"
>导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="skillList" @selection-change="handleSelectionChange"> <el-table
<el-table-column type="selection" width="55" align="center" /> v-if="refreshTable"
<el-table-column label="话题id" align="center" prop="id" /> v-loading="loading"
<el-table-column label="标签内容" align="center" prop="name" /> :data="skillList"
<el-table-column label="更新人" align="center" prop="updateBy" /> @selection-change="handleSelectionChange"
<el-table-column label="备注" align="center" prop="remark" /> :default-expand-all="isExpandAll"
<el-table-column label="父级id" align="center" prop="parentId" /> row-key="id"
<el-table-column label="类型0-标签分类1-标签内容" align="center" prop="type" /> :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="标签名称" :show-overflow-tooltip="true" prop="name" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -92,14 +54,12 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['app:skill:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['app:skill:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -112,19 +72,84 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改话题信息对话框 -->
<!-- 添加或修改标签信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标签内容" prop="name"> <el-row>
<el-input v-model="form.name" placeholder="请输入标签内容" /> <el-col :span="24">
</el-form-item> <el-form-item label="标签类型" prop="type">
<el-form-item label="备注" prop="remark"> <el-radio-group v-model="form.type">
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-radio label="0">分类</el-radio>
</el-form-item> <el-radio label="1">标签</el-radio>
<el-form-item label="父级id" prop="parentId"> </el-radio-group>
<el-input v-model="form.parentId" placeholder="请输入父级id" /> </el-form-item>
</el-form-item> </el-col>
<el-col :span="24" v-if="form.type === '0'">
<el-form-item label="标签分类" prop="name">
<el-input v-model="form.name" placeholder="请输入标签分类" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="标签名称" prop="parentId">
<el-select
v-model="form.parentId"
placeholder="请选择标签分类"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="标签名称" prop="name">
<el-input v-model="form.name" placeholder="请输入标签名称" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="openUpdate" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.type === '0'">
<el-form-item label="标签分类" prop="name">
<el-input v-model="form.name" placeholder="请输入话题分类" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="标签名称" prop="parentId">
<el-select
v-model="form.parentId"
placeholder="请选择标签分类"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="标签名称" prop="name">
<el-input v-model="form.name" placeholder="请输入标签名称" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -136,9 +161,13 @@
<script> <script>
import { listSkill, getSkill, delSkill, addSkill, updateSkill } from "@/api/app/skill"; import { listSkill, getSkill, delSkill, addSkill, updateSkill } from "@/api/app/skill";
import Treeselect from "@riophae/vue-treeselect";
import IconSelect from "@/components/IconSelect/index.vue";
export default { export default {
name: "Skill", name: "Skill",
components: { Treeselect, IconSelect },
data() { data() {
return { return {
// //
@ -151,6 +180,8 @@ export default {
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
refreshTable: true,
isExpandAll: false,
// //
total: 0, total: 0,
// //
@ -159,6 +190,8 @@ export default {
title: "", title: "",
// //
open: false, open: false,
openUpdate: false,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -172,19 +205,32 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
} },
options: []
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
getAppSkill(){
// this.loading = true;
this.queryParams.parentId = 0;
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10000;
listSkill(this.queryParams).then(response => {
this.options = response.data || [];
console.log(this.options);
});
},
/** 查询标签信息列表 */ /** 查询标签信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listSkill(this.queryParams).then(response => { listSkill(this.queryParams).then(response => {
this.skillList = response.rows; this.skillList = this.handleTree(response.data, 'id');
this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
@ -204,7 +250,7 @@ export default {
updateBy: null, updateBy: null,
remark: null, remark: null,
parentId: null, parentId: null,
type: null type: '1'
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -227,16 +273,18 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.getAppSkill();
this.open = true; this.open = true;
this.title = "添加标签信息"; this.title = "添加标签信息";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.getAppSkill();
const id = row.id || this.ids const id = row.id || this.ids
getSkill(id).then(response => { getSkill(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.openUpdate = true;
this.title = "修改标签信息"; this.title = "修改标签信息";
}); });
}, },
@ -247,13 +295,14 @@ export default {
if (this.form.id != null) { if (this.form.id != null) {
updateSkill(this.form).then(response => { updateSkill(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.openUpdate = false;
this.getList(); this.getList();
}); });
} else { } else {
addSkill(this.form).then(response => { addSkill(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.queryParams.parentId = null ;
this.getList(); this.getList();
}); });
} }
@ -275,7 +324,14 @@ export default {
this.download('app/skill/export', { this.download('app/skill/export', {
...this.queryParams ...this.queryParams
}, `skill_${new Date().getTime()}.xlsx`) }, `skill_${new Date().getTime()}.xlsx`)
} },
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
} }
}; };
</script> </script>

View File

@ -1,5 +1,3 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@ -25,7 +23,6 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['app:topic:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -50,7 +47,6 @@
row-key="id" row-key="id"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="话题名称" :show-overflow-tooltip="true" prop="name" /> <el-table-column label="话题名称" :show-overflow-tooltip="true" prop="name" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">

View File

@ -1,33 +1,300 @@
<template> <template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="兑换码" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入兑换码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用者" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入使用者"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="更新人" prop="updateBy">
<el-input
v-model="queryParams.updateBy"
placeholder="请输入更新人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="使用时间" prop="userTime">
<el-date-picker clearable
v-model="queryParams.userTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择使用时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<div> <el-row :gutter="10" class="mb8">
<el-input v-model="num" placeholder="请输入兑换码个数" style="width: 200px;" class="filter-item"/> <el-col :span="1.5">
<el-button type="primary" @click="handleSend(num)"></el-button> <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['app:code:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['app:code:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['app:code:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['app:code:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="兑换码" align="center" prop="code" />
<el-table-column label="使用者" align="center" prop="userId" />
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="使用时间" align="center" prop="userTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.userTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['app:code:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['app:code:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改兑换码对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="兑换码" prop="code">
<el-input v-model="form.code" placeholder="请输入兑换码" />
</el-form-item>
<el-form-item label="使用者" prop="userId">
<el-input v-model="form.userId" placeholder="请输入使用者" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="使用时间" prop="userTime">
<el-date-picker clearable
v-model="form.userTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择使用时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script>
import {generCode} from '@/api/app/gener' <script>
import {download} from '@/utils/request' import { listCode, getCode, delCode, addCode, updateCode } from "@/api/app/code";
export default { export default {
name: "Code",
data() { data() {
return { return {
num: 0, //
} loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
codeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
userId: null,
updateBy: null,
userTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
}, },
methods: { methods: {
handleSend(num) { /** 查询兑换码列表 */
getList() {
this.loading = true;
download('/app/pay/generateCode' , {num: num}, '兑换码.xlsx'); listCode(this.queryParams).then(response => {
this.codeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
code: null,
userId: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null,
userTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加兑换码";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCode(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改兑换码";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCode(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCode(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除兑换码编号为"' + ids + '"的数据项?').then(function() {
return delCode(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('app/code/export', {
...this.queryParams
}, `code_${new Date().getTime()}.xlsx`)
} }
}, }
};
}
</script> </script>