main
王宇航 2024-05-24 15:40:41 +08:00
parent cbdb6e8afe
commit a7f9e22c50
21 changed files with 943 additions and 31 deletions

View File

@ -80,20 +80,16 @@ public class AppLoginController {
if (StringUtils.isNotEmpty(registerForm.getEmail())) {
//校验邮箱格式
Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
//校验邮箱是否已注册
// Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
AppRegister appRegister = setAppRegister(registerForm);
//校验邮箱是否已注册
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
Assert.isNull(emailUser, "邮箱已注册");
AppRegister appRegister = setAppRegister(registerForm);
redisService.setCacheMapValue(IdUtils.fastUUID(),register.getEmail() , appRegister);
appRegisterService.insertAppRegister(register);
Assert.isNull(emailUser, "邮箱已注册");
redisService.setCacheMapValue(IdUtils.fastUUID(),registerForm.getEmail() , registerForm);
try {
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>"
+ "<p>http://localhost:9204/app/activation/"+ IdUtils.fastUUID() + "/" + register.getEmail() + "</p>"
+ "<p>http://101.133.172.2:9204/app/activation/"+ IdUtils.fastUUID() + "/" + registerForm.getEmail() + "</p>"
+ "</body></html>";
MailUtil.send_mail(registerForm.getEmail(), EM);
@ -111,15 +107,15 @@ public class AppLoginController {
case 1:
return R.fail(201, "您的账号已通过");
case 2:
return R.fail(201, "注册失败,您的账号已被驳回!");
appRegisterService.updateAppRegisterByPhone(register);
break;
}
}else{
AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
}
AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
}
return R.ok(null, "申请成功,请等待审核结果!");
}

View File

@ -0,0 +1,118 @@
package com.ruoyi.app.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.app.domain.vo.AppSkillVo;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.app.domain.AppSkill;
import com.ruoyi.app.service.IAppSkillService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author wyh
* @date 2024-05-24
*/
@RestController
@RequestMapping("/app/skill")
@Api(tags = "标签信息" , description = "标签信息")
public class AppSkillController extends BaseController
{
@Autowired
private IAppSkillService appSkillService;
/**
*
*/
@GetMapping("/list")
@ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET")
public TableDataInfo list(AppSkill appSkill)
{
startPage();
List<AppSkill> list = appSkillService.selectAppSkillList(appSkill);
return getDataTable(list);
}
@GetMapping("/list/tree")
@ApiOperation(value = "查询标签信息", notes = "查询标签信息", httpMethod = "GET")
public AjaxResult listTree(AppSkill appSkill)
{
List<AppSkillVo> list = appSkillService.selectAppSkillTreeList(appSkill);
return AjaxResult.success(list);
}
/**
*
*/
@Log(title = "标签信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppSkill appSkill)
{
List<AppSkill> list = appSkillService.selectAppSkillList(appSkill);
ExcelUtil<AppSkill> util = new ExcelUtil<AppSkill>(AppSkill.class);
util.exportExcel(response, list, "标签信息数据");
}
/**
*
*/
@GetMapping(value = "/{id}")
@ApiOperation(value = "获取标签信息详细信息", notes = "获取标签信息详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appSkillService.selectAppSkillById(id));
}
/**
*
*/
@ApiOperation(value = "新增标签信息", notes = "新增标签信息", httpMethod = "POST")
@Log(title = "标签信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody AppSkill appSkill)
{
return toAjax(appSkillService.insertAppSkill(appSkill));
}
/**
*
*/
@ApiOperation(value = "修改标签信息", notes = "修改标签信息", httpMethod = "PUT")
@Log(title = "标签信息", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody AppSkill appSkill)
{
return toAjax(appSkillService.updateAppSkill(appSkill));
}
/**
*
*/
@Log(title = "标签信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appSkillService.deleteAppSkillByIds(ids));
}
}

View File

@ -54,6 +54,8 @@ public class AppTopicController extends BaseController
return success(list);
}
@GetMapping("/topicList")
@ApiOperation(value = "组装过查询话题信息列表", notes = "组装过查询话题信息列表", httpMethod = "GET")
public TableDataInfo topicList(AppTopic appTopic)
@ -90,7 +92,6 @@ public class AppTopicController extends BaseController
/**
*
*/
@RequiresPermissions("app:topic:add")
@Log(title = "话题信息", businessType = BusinessType.INSERT)
@PostMapping(value = "/add")
@ApiOperation(value = "新增话题信息", notes = "新增话题信息", httpMethod = "POST")
@ -102,7 +103,6 @@ public class AppTopicController extends BaseController
/**
*
*/
@RequiresPermissions("app:topic:edit")
@Log(title = "话题信息", businessType = BusinessType.UPDATE)
@PutMapping(value = "/edit")
@ApiOperation(value = "修改话题信息", notes = "修改话题信息", httpMethod = "PUT")

View File

@ -522,7 +522,7 @@ public class PayController extends BaseController
AlipayTradeAppPayResponse result = null;
try {
//result = alipayService.startPay(orderNo,appOrderArg.getPrice(),appOrderArg.getLevel() == 2 ? 30 : (appOrderArg.getLevel() == 3 ? 365 : 0));
result = alipayService.startPay(orderNo,appOrderArg.getPrice(),1);
result = alipayService.startPay(orderNo,appOrderArg.getPrice(),0);
} catch (AlipayApiException e) {
e.printStackTrace();
}

View File

@ -0,0 +1,85 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_skill
*
* @author wyh
* @date 2024-05-24
*/
public class AppSkill extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 话题id */
private Long id;
/** 标签内容 */
@Excel(name = "标签内容")
private String name;
/** 父级id */
@Excel(name = "父级id")
private Long parentId;
/** 类型0-标签分类1-标签内容 */
/** 类型0-话题分类1-话题数据 */
@Excel(name = "类型0-话题分类1-话题数据")
private String type;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("remark", getRemark())
.append("parentId", getParentId())
.append("type", getType())
.toString();
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppSkill;
import com.ruoyi.app.domain.AppTopic;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class AppSkillVo extends AppSkill {
private static final long serialVersionUID = 1L;
private List<AppSkill> children = new ArrayList<>();
}

View File

@ -62,4 +62,6 @@ public interface AppRegisterMapper
AppRegister selectAppRegisterByphone(@Param("phoneNumber")
String phoneNumber);
int updateAppRegisterByPhone(AppRegister appRegister);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppSkill;
/**
* Mapper
*
* @author wyh
* @date 2024-05-24
*/
public interface AppSkillMapper
{
/**
*
*
* @param id
* @return
*/
public AppSkill selectAppSkillById(Long id);
/**
*
*
* @param appSkill
* @return
*/
public List<AppSkill> selectAppSkillList(AppSkill appSkill);
/**
*
*
* @param appSkill
* @return
*/
public int insertAppSkill(AppSkill appSkill);
/**
*
*
* @param appSkill
* @return
*/
public int updateAppSkill(AppSkill appSkill);
/**
*
*
* @param id
* @return
*/
public int deleteAppSkillById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppSkillByIds(Long[] ids);
}

View File

@ -68,7 +68,7 @@ public interface AppUserMapper
List<AppUserDataVo> selectList(AppUser appUser);
List<Long> listByOrderTime();
void updateAppUserById(@Param("ids")List<Long> ids);
void updateAppUserById();
List<AppUserInfoVo> listUser(AppUser appUser);

View File

@ -44,6 +44,8 @@ public interface IAppRegisterService
*/
public int updateAppRegister(AppRegister appRegister);
public int updateAppRegisterByPhone(AppRegister appRegister);
/**
*
*

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppSkill;
import com.ruoyi.app.domain.vo.AppSkillVo;
/**
* Service
*
* @author wyh
* @date 2024-05-24
*/
public interface IAppSkillService
{
/**
*
*
* @param id
* @return
*/
public AppSkill selectAppSkillById(Long id);
/**
*
*
* @param appSkill
* @return
*/
public List<AppSkill> selectAppSkillList(AppSkill appSkill);
/**
*
*
* @param appSkill
* @return
*/
public int insertAppSkill(AppSkill appSkill);
/**
*
*
* @param appSkill
* @return
*/
public int updateAppSkill(AppSkill appSkill);
/**
*
*
* @param ids
* @return
*/
public int deleteAppSkillByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppSkillById(Long id);
List<AppSkillVo> selectAppSkillTreeList(AppSkill appSkill);
}

View File

@ -14,9 +14,10 @@ public class ScheduledService {
@Scheduled(cron = "0/5 * * * * *")
public void updateUserMember(){
List<Long> ids = appUserMapper.listByOrderTime();
appUserMapper.updateAppUserById();
/*List<Long> ids = appUserMapper.listByOrderTime();
if (ids != null && ids.size() > 0) {
appUserMapper.updateAppUserById(ids);
}
}*/
}
}

View File

@ -101,6 +101,12 @@ public class AppRegisterServiceImpl implements IAppRegisterService
return appRegisterMapper.updateAppRegister(appRegister);
}
@Override
public int updateAppRegisterByPhone(AppRegister appRegister) {
appRegister.setUpdateTime(DateUtils.getNowDate());
return appRegisterMapper.updateAppRegisterByPhone(appRegister);
}
/**
*
*
@ -167,7 +173,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
String email = "653809315@qq.com";
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>"
+ "<p>http://localhost:9204/app/activation/"+ token + "/" + email + "</p>"
+ "<p>http://101.133.172.2:9204/app/activation/"+ token + "/" + email + "</p>"
+ "</body></html>";
try {
MailUtil.send_mail( "653809315@qq.com",EM);

View File

@ -0,0 +1,120 @@
package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppTopic;
import com.ruoyi.app.domain.vo.AppSkillVo;
import com.ruoyi.app.domain.vo.AppTopicVo;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppSkillMapper;
import com.ruoyi.app.domain.AppSkill;
import com.ruoyi.app.service.IAppSkillService;
/**
* Service
*
* @author wyh
* @date 2024-05-24
*/
@Service
public class AppSkillServiceImpl implements IAppSkillService
{
@Autowired
private AppSkillMapper appSkillMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppSkill selectAppSkillById(Long id)
{
return appSkillMapper.selectAppSkillById(id);
}
/**
*
*
* @param appSkill
* @return
*/
@Override
public List<AppSkill> selectAppSkillList(AppSkill appSkill)
{
return appSkillMapper.selectAppSkillList(appSkill);
}
/**
*
*
* @param appSkill
* @return
*/
@Override
public int insertAppSkill(AppSkill appSkill)
{
appSkill.setCreateTime(DateUtils.getNowDate());
return appSkillMapper.insertAppSkill(appSkill);
}
/**
*
*
* @param appSkill
* @return
*/
@Override
public int updateAppSkill(AppSkill appSkill)
{
appSkill.setUpdateTime(DateUtils.getNowDate());
return appSkillMapper.updateAppSkill(appSkill);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppSkillByIds(Long[] ids)
{
return appSkillMapper.deleteAppSkillByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppSkillById(Long id)
{
return appSkillMapper.deleteAppSkillById(id);
}
@Override
public List<AppSkillVo> selectAppSkillTreeList(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);
skill = new AppSkill();
skill.setParentId(appSkillVo.getId());
appSkillVo.setChildren(appSkillMapper.selectAppSkillList(skill));
appSkillVos.add(appSkillVo);
}
return appSkillVos;
}
}

View File

@ -121,4 +121,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAppRegisterByphone" resultType="com.ruoyi.app.domain.AppRegister">
select * from app_register where phone = #{phoneNumber}
</select>
<update id="updateAppRegisterByPhone">
update app_register
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">updateBy = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="username != null">username = #{username},</if>
<if test="prove != null">prove = #{prove},</if>
<if test="avatarUrl != null">avatar_url = #{avatarUrl},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="address != null">address = #{address},</if>
<if test="schoolId != null">school_id = #{schoolId},</if>
<if test="email != null">email = #{email},</if>
<if test="invitationCode != null">invitation_code = #{invitationCode},</if>
status = 0,
</trim>
where phone = #{phone}
</update>
</mapper>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.mapper.AppSkillMapper">
<resultMap type="AppSkill" id="AppSkillResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="updateBy" />
<result property="remark" column="remark" />
<result property="parentId" column="parent_id" />
<result property="type" column="type" />
</resultMap>
<sql id="selectAppSkillVo">
select id, name, create_time, update_time, create_by, updateBy, remark, parent_id, type from app_skill
</sql>
<select id="selectAppSkillList" parameterType="AppSkill" resultMap="AppSkillResult">
<include refid="selectAppSkillVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="type != null "> and type = #{type}</if>
</where>
</select>
<select id="selectAppSkillById" parameterType="Long" resultMap="AppSkillResult">
<include refid="selectAppSkillVo"/>
where id = #{id}
</select>
<insert id="insertAppSkill" parameterType="AppSkill" useGeneratedKeys="true" keyProperty="id">
insert into app_skill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">updateBy,</if>
<if test="remark != null">remark,</if>
<if test="parentId != null">parent_id,</if>
<if test="type != null">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
<if test="parentId != null">#{parentId},</if>
<if test="type != null">#{type},</if>
</trim>
</insert>
<update id="updateAppSkill" parameterType="AppSkill">
update app_skill
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">updateBy = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="type != null">type = #{type},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppSkillById" parameterType="Long">
delete from app_skill where id = #{id}
</delete>
<delete id="deleteAppSkillByIds" parameterType="String">
delete from app_skill where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -211,12 +211,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<update id="updateAppUserById" parameterType="java.lang.Long">
<update id="updateAppUserById">
update app_user set is_member = 1,update_time = now()
where id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
where
is_member = 0
and now() &gt; order_end_time
</update>
<insert id="insertAppUser" parameterType="AppUser" useGeneratedKeys="true" keyProperty="id">
@ -339,7 +338,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hobby != null">hobby = #{hobby},</if>
<if test="city != null">city = #{city},</if>
<if test="other != null">other = #{other},</if>
<if test="isMember != null">is_member = #{isMember},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="orderStartTime != null">order_start_time = #{orderStartTime},</if>
<if test="orderEndTime != null">order_end_time = #{orderEndTime},</if>

View File

@ -139,7 +139,7 @@ public class SysProfileController extends BaseController
return error("文件服务异常,请联系管理员");
}
String url = fileResult.getData().getUrl();
if (userService.updateUserAvatar(loginUser.getUsername(), url))
if (userService.updateUserAvatar(loginUser.getSysUser().getUserName(), url))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", url);

View File

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

View File

@ -9,6 +9,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="邮箱域名" prop="email">
<el-input
v-model="queryParams.email"
placeholder="请输入邮箱域名"
clearable
@keyup.enter.native="handleQuery"
style="width: 200px"
/></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>
@ -84,7 +92,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -169,6 +177,8 @@ export default {
this.form = {
id: null,
name: null,
email: null,
schoolImg : null,
createTime: null,
updateTime: null
};

View File

@ -0,0 +1,281 @@
<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="name">
<el-input
v-model="queryParams.name"
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="父级id" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入父级id"
clearable
@keyup.enter.native="handleQuery"
/>
</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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['app:skill: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: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="skillList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="话题id" align="center" prop="id" />
<el-table-column label="标签内容" align="center" prop="name" />
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="父级id" align="center" prop="parentId" />
<el-table-column label="类型0-标签分类1-标签内容" align="center" prop="type" />
<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:skill:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['app:skill: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="name">
<el-input v-model="form.name" placeholder="请输入标签内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="父级id" prop="parentId">
<el-input v-model="form.parentId" placeholder="请输入父级id" />
</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>
</template>
<script>
import { listSkill, getSkill, delSkill, addSkill, updateSkill } from "@/api/app/skill";
export default {
name: "Skill",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
skillList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
updateBy: null,
parentId: null,
type: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询标签信息列表 */
getList() {
this.loading = true;
listSkill(this.queryParams).then(response => {
this.skillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null,
parentId: null,
type: 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
getSkill(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) {
updateSkill(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSkill(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 delSkill(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('app/skill/export', {
...this.queryParams
}, `skill_${new Date().getTime()}.xlsx`)
}
}
};
</script>