fix some problem and data premission
| | |
| | | package cc.mrbird.febs.common.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | |
| | | private Date updateTime = new Date();; |
| | | |
| | | private Integer version = 1; |
| | | |
| | | @TableField(exist = false) |
| | | private Long currentUser; |
| | | } |
| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.dapp.service.DappUserService; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping(value = "dappUser") |
| | | public class DappUserController { |
| | | public class DappUserController extends BaseController { |
| | | |
| | | private final DappUserService dappUserService; |
| | | |
| | | @RequiresPermissions("admin:view") |
| | | @GetMapping(value = "/list") |
| | | public FebsResponse list(User user, QueryRequest request) { |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | user.setCreateBy(currentUser.getUserId()); |
| | | } |
| | | return new FebsResponse().success().data(getDataTable(dappUserService.findInPage(user, request))); |
| | | } |
| | | |
| | | @RequiresPermissions("admin:add") |
| | | @PostMapping(value = "/add") |
| | |
| | | } |
| | | |
| | | @RequiresPermissions("admin:delete") |
| | | @PostMapping(value = "/delete") |
| | | @PostMapping(value = "/delete/{ids}") |
| | | @ControllerEndpoint(operation = "删除用户", exceptionMessage = "删除用户失败") |
| | | public FebsResponse delete(User user) { |
| | | return null; |
| | | } |
| | | |
| | | @PostMapping(value = "/resetPwd/{id}") |
| | | @ControllerEndpoint(operation = "重置密码", exceptionMessage = "重置密码失败") |
| | | public FebsResponse resetPwd(@PathVariable("id") Long id) { |
| | | return null; |
| | | public FebsResponse delete(@PathVariable("ids") String ids) { |
| | | dappUserService.delete(ids); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |
| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.dapp.entity.DappAccountMoneyChangeEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | @RequestMapping(value = "/fundFlow") |
| | | public FebsResponse fundFlow(DappFundFlowEntity dappFundFlowEntity, QueryRequest request) { |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | dappFundFlowEntity.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.fundFlowInPage(dappFundFlowEntity, request))); |
| | | } |
| | | |
| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.dapp.entity.DappWalletCoinEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappWalletMineEntity; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | @RequestMapping(value = "/walletCoin") |
| | | public FebsResponse walletCoin(DappWalletCoinEntity walletCoin, QueryRequest request) { |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | walletCoin.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.walletCoinInPage(walletCoin, request))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/walletMine") |
| | | public FebsResponse walletMine(DappWalletMineEntity walletMine, QueryRequest request) { |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | walletMine.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.walletMineInPage(walletMine, request))); |
| | | } |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.dapp.entity.DappUserMemberRelateEntity; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DappUserMemberRelateDao extends BaseMapper<DappUserMemberRelateEntity> { |
| | | |
| | | int deleteByUserIds(@Param("list") List<String> id); |
| | | } |
| | |
| | | package cc.mrbird.febs.dapp.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | public interface DappUserService { |
| | | |
| | | IPage<User> findInPage(User user, QueryRequest request); |
| | | |
| | | void add(User user); |
| | | |
| | | void delete(String ids); |
| | | } |
| | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.utils.ShareCodeUtil; |
| | | import cc.mrbird.febs.dapp.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.dto.ApproveDto; |
| | |
| | | import cc.mrbird.febs.dapp.mapper.DappWalletCoinDao; |
| | | import cc.mrbird.febs.dapp.mapper.DappWalletMineDao; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | @Override |
| | | public IPage<DappMemberEntity> selectInPage(DappMemberEntity member, QueryRequest request) { |
| | | Page<DappMemberEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | member.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return dappMemberDao.selectInPage(member, page); |
| | | } |
| | | |
| | |
| | | package cc.mrbird.febs.dapp.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.utils.Md5Util; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappUserMemberRelateEntity; |
| | |
| | | import cc.mrbird.febs.system.entity.UserRole; |
| | | import cc.mrbird.febs.system.mapper.UserMapper; |
| | | import cc.mrbird.febs.system.mapper.UserRoleMapper; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | private final UserRoleMapper userRoleMapper; |
| | | |
| | | @Override |
| | | public IPage<User> findInPage(User user, QueryRequest request) { |
| | | Page<User> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return userMapper.selectDappUserInPage(user, page); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void add(User user) { |
| | | DappMemberEntity member = dappMemberDao.selectMemberInfoByInviteId(user.getInviteId()); |
| | | if(member == null) { |
| | |
| | | userMapper.insert(user); |
| | | |
| | | UserRole userRole = new UserRole(); |
| | | userRole.setRoleId(Long.parseLong(user.getRoleId())); |
| | | userRole.setRoleId(81L); |
| | | userRole.setUserId(user.getUserId()); |
| | | userRoleMapper.insert(userRole); |
| | | |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | DappUserMemberRelateEntity relate = new DappUserMemberRelateEntity(); |
| | | relate.setMemberId(member.getId()); |
| | | relate.setUserId(user.getUserId()); |
| | | relate.setInviteId(user.getInviteId()); |
| | | relate.setCreateUser(currentUser.getUserId()); |
| | | dappUserMemberRelateDao.insert(relate); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(String ids) { |
| | | List<String> idsList = StrUtil.split(ids, ','); |
| | | userMapper.deleteBatchIds(idsList); |
| | | dappUserMemberRelateDao.deleteByUserIds(idsList); |
| | | } |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private String inviteId; |
| | | |
| | | @TableField(exist = false) |
| | | private Long createBy; |
| | | } |
| | |
| | | */ |
| | | List<User> findUserDetail(@Param("user") User user); |
| | | |
| | | IPage<User> selectDappUserInPage(@Param("user") User user, Page<User> page); |
| | | |
| | | } |
| | |
| | | select a.*, b.address address from dapp_fund_flow a |
| | | inner join dapp_member b on a.member_id=b.id |
| | | <where> |
| | | <if test="record.currentUser != null"> |
| | | and b.referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser}) |
| | | </if> |
| | | <if test="record.type != null"> |
| | | and a.type = #{record.type} |
| | | </if> |
| | |
| | | <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity"> |
| | | select * from dapp_member |
| | | <where> |
| | | <if test="record.currentUser != null"> |
| | | and referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser}) |
| | | </if> |
| | | <if test="record.accountStatus != null"> |
| | | and account_status = #{record.accountStatus} |
| | | </if> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.dapp.mapper.DappUserMemberRelateDao"> |
| | | |
| | | |
| | | <delete id="deleteByUserIds"> |
| | | delete from dapp_user_member_relate |
| | | where |
| | | user_id in |
| | | <foreach collection="list" separator="," item="item" open="(" close=")"> |
| | | ${item} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | select a.*, b.address address from dapp_wallet_coin a |
| | | inner join dapp_member b on a.member_id=b.id |
| | | <where> |
| | | <if test="record.currentUser != null"> |
| | | and b.referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser}) |
| | | </if> |
| | | <if test="record.address != '' and record.address != null"> |
| | | and b.address = #{record.address} |
| | | </if> |
| | |
| | | select * from dapp_wallet_mine a |
| | | inner join dapp_member b on a.member_id=b.id |
| | | <where> |
| | | <if test="record.currentUser != null"> |
| | | and b.referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser}) |
| | | </if> |
| | | <if test="record.address != '' and record.address != null"> |
| | | and b.address = #{record.address} |
| | | </if> |
| | |
| | | LEFT JOIN t_user_role ur ON (u.user_id = ur.user_id) |
| | | LEFT JOIN t_role r ON r.role_id = ur.role_id |
| | | WHERE 1 = 1 |
| | | and u.dept_id is not null |
| | | <if test="user.username != null and user.username != ''"> |
| | | AND u.username = #{user.username} |
| | | </if> |
| | |
| | | select user_id userId, dept_id deptId from t_user_data_permission |
| | | where user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectDappUserInPage" resultType="user"> |
| | | select a.*, b.invite_id |
| | | from t_user a |
| | | inner join dapp_user_member_relate b on a.user_id=b.user_id |
| | | <where> |
| | | <if test="user.username != null and user.username != ''"> |
| | | AND (a.username = #{user.username} or b.invite_id = #{user.username}) |
| | | </if> |
| | | <if test="user.createBy != null and user.createBy != ''"> |
| | | AND b.create_user = #{user.createBy} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | url: ctx + 'wallet/walletMine', |
| | | cols: [[ |
| | | {field: 'address', title: '地址', minWidth: 130}, |
| | | {field: 'availableAmount', title: '可用金额', minWidth: 130}, |
| | | {field: 'frozenAmount', title: '冻结金额', minWidth: 130}, |
| | | {field: 'totalAmount', title: '总金额', minWidth: 180} |
| | | {field: 'availableAmount', title: '剩余产量', minWidth: 130}, |
| | | {field: 'totalAmount', title: '总产量', minWidth: 180} |
| | | ]] |
| | | }); |
| | | } |
| | |
| | | <a href="https://tronscan.io/#/address/{{d.address}}" target="_blank">1</a> |
| | | </script> |
| | | <script type="text/html" id="withdraw-option"> |
| | | <span shiro:lacksPermission="user:view,user:update,user:delete"> |
| | | <span shiro:lacksPermission="withdraw:agree,withdraw:disagree"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | {{# if(d.status == 1) { }} |
| | | <a lay-event="agree" shiro:hasPermission="member:accountStatus">审核通过</a> |
| | | <a lay-event="disagree" shiro:hasPermission="member:changeAble">审核驳回</a> |
| | | <a lay-event="agree" shiro:hasPermission="withdraw:agree">审核通过</a> |
| | | <a lay-event="disagree" shiro:hasPermission="withdraw:disagree">审核驳回</a> |
| | | {{# } }} |
| | | </script> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | |
| | | 1: {title: '不可提现'} |
| | | }[d.withdrawAble]; |
| | | }} |
| | | <span shiro:lacksPermission="user:view,user:update,user:delete"> |
| | | <span shiro:lacksPermission="member:accountStatus,member:changeAble,member:withdrawAble"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | <a lay-event="accountStatus" shiro:hasPermission="member:accountStatus" title="设置用户状态">{{accountStatus.title}}</a> |
| | |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="user-table-form"> |
| | | <form class="layui-form layui-table-form" lay-filter="admin-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">用户名</label> |
| | | <!-- <label class="layui-form-label layui-form-label-sm">用户名</label>--> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="username" autocomplete="off" class="layui-input"> |
| | | <input type="text" name="username" autocomplete="off" placeholder="输入用户或者邀请码" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">创建时间</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="createTime" id="user-createTime" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-inline">--> |
| | | <!-- <label class="layui-form-label layui-form-label-sm">创建时间</label>--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <input type="text" name="createTime" id="user-createTime" class="layui-input">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">状态</label> |
| | | <div class="layui-input-inline"> |
| | |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table> |
| | | <table lay-filter="adminTable" lay-data="{id: 'adminTable'}"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | }} |
| | | <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="user-sex"> |
| | | {{# |
| | | var sex = { |
| | | 2: {title: '保密'}, |
| | | 1: {title: '女'}, |
| | | 0: {title: '男'} |
| | | }[d.sex]; |
| | | }} |
| | | <span>{{ sex.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="user-option"> |
| | | <span shiro:lacksPermission="admin:view,admin:update,admin:delete"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | <a lay-event="edit" shiro:hasPermission="admin:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | <a lay-event="del" shiro:hasPermission="admin:delete"><i class="layui-icon febs-edit-area febs-red"></i></a> |
| | | </script> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | |
| | | dropdown.render({ |
| | | elem: $view.find('.action-more'), |
| | | click: function (name, elem, event) { |
| | | var checkStatus = table.checkStatus('userTable'); |
| | | var checkStatus = table.checkStatus('adminTable'); |
| | | if (name === 'add') { |
| | | febs.modal.open('新增用户', 'dappView/admin/add', { |
| | | btn: ['提交', '重置'], |
| | |
| | | }] |
| | | }); |
| | | |
| | | table.on('tool(userTable)', function (obj) { |
| | | table.on('tool(adminTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'del') { |
| | |
| | | } |
| | | }); |
| | | |
| | | table.on('sort(userTable)', function (obj) { |
| | | table.on('sort(adminTable)', function (obj) { |
| | | sortObject = obj; |
| | | tableIns.reload({ |
| | | initSort: obj, |
| | |
| | | |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | treeSelect.revokeNode('dept'); |
| | | sortObject.type = 'null'; |
| | | createTimeTo = null; |
| | | createTimeFrom = null; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'userTable', |
| | | url: ctx + 'user/list', |
| | | id: 'adminTable', |
| | | url: ctx + 'dappUser/list', |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {field: 'username', title: '用户名', minWidth: 100}, |
| | | {title: '性别', templet: '#user-sex'}, |
| | | {field: 'deptName', title: '部门'}, |
| | | {field: 'mobile', title: '手机', minWidth: 165}, |
| | | {field: 'email', title: '邮箱', minWidth: 180}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 100}, |
| | | {title: '状态', templet: '#user-status'}, |
| | | {field: 'lastLoginTime', title: '上次登录时间', minWidth: 100}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 180, sort: true}, |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140} |
| | | ]] |
| | |
| | | } |
| | | |
| | | function getQueryParams() { |
| | | var createTime = $searchForm.find('input[name="createTime"]').val(); |
| | | if (createTime) { |
| | | createTimeFrom = createTime.split(' - ')[0]; |
| | | createTimeTo = createTime.split(' - ')[1]; |
| | | } |
| | | // var createTime = $searchForm.find('input[name="createTime"]').val(); |
| | | // if (createTime) { |
| | | // createTimeFrom = createTime.split(' - ')[0]; |
| | | // createTimeTo = createTime.split(' - ')[1]; |
| | | // } |
| | | return { |
| | | createTimeFrom: createTimeFrom, |
| | | createTimeTo: createTimeTo, |
| | | // createTimeFrom: createTimeFrom, |
| | | // createTimeTo: createTimeTo, |
| | | username: $searchForm.find('input[name="username"]').val().trim(), |
| | | status: $searchForm.find("select[name='status']").val(), |
| | | sex: $searchForm.find("select[name='sex']").val(), |
| | | mobile: $searchForm.find("input[name='mobile']").val().trim(), |
| | | deptId: $searchForm.find("input[name='dept']").val().trim(), |
| | | invalidate_ie_cache: new Date() |
| | | }; |
| | | } |
| | |
| | | febs.alert.warn('所选用户包含当前登录用户,无法删除'); |
| | | return; |
| | | } |
| | | febs.get(ctx + 'user/delete/' + userIds, null, function () { |
| | | febs.post(ctx + 'dappUser/delete/' + userIds, null, function () { |
| | | febs.alert.success('删除用户成功'); |
| | | $query.click(); |
| | | }); |
| | |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#dapp-user-add'), |
| | | validate = layui.validate, |
| | | _deptTree; |
| | |
| | | form.render(); |
| | | |
| | | form.on('submit(dapp-user-add-form-submit)', function (data) { |
| | | var checked = _deptTree.getChecked(false, true); |
| | | var deptIds = []; |
| | | layui.each(checked, function (key, item) { |
| | | deptIds.push(item.id) |
| | | }); |
| | | data.deptIds = deptIds.join(","); |
| | | febs.post(ctx + 'user', data.field, function () { |
| | | febs.post(ctx + 'dappUser/add', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('新增用户成功,初始密码为 1234qwer'); |
| | | $('#febs-user').find('#query').click(); |
| | | $('#febs-admin').find('#query').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-tr"> |
| | | <a id="regist-href">注册账号</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-hide" id="regist-div"> |
| | | <div class="layui-form" lay-filter="regist-form"> |
| | | <div class="layui-anim layui-anim-upbit"> |
| | | <ul class="login-type-tab"> |
| | | <li class="active">账号注册</li> |
| | | </ul> |
| | | <div class="normal-login-form"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-icon label-icon layui-icon-username"></label> |
| | | <input type="text" name="username" minlength="2" maxlength="10" lay-verify="range" |
| | | placeholder="用户名" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-form-item password-block"> |
| | | <label class="layui-icon label-icon layui-icon-password"></label> |
| | | <input type="password" name="password" minlength="6" lay-verify="range" |
| | | placeholder="密码" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-form-item password-block"> |
| | | <label class="layui-icon label-icon layui-icon-password"></label> |
| | | <input type="password" name="passwordB" lay-verify="required" |
| | | placeholder="密码确认" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-fluid" lay-submit |
| | | lay-filter="regist-submit" id="regist"> |
| | | <i style="display: none" |
| | | class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i> |
| | | 立即注册 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-tr"> |
| | | <a id="login-href">已有账号?马上登录</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | layer.msg(r.message); |
| | | loading.hide(); |
| | | initCode(); |
| | | } |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | //提交注册表单 |
| | | form.on('submit(regist-submit)', function (data) { |
| | | if (data.field.password !== data.field.passwordB) { |
| | | layer.msg('两次密码输入不一致!'); |
| | | return; |
| | | } |
| | | var loading = $(this).find('.layui-icon'); |
| | | if (loading.is(":visible")) return; |
| | | loading.show(); |
| | | $.post(ctx + 'regist', data.field, function (r) { |
| | | if (r.code === 200) { |
| | | layer.msg('注册成功,请登录'); |
| | | loading.hide(); |
| | | $view.find('#login-href').trigger('click'); |
| | | } else { |
| | | layer.msg(r.message); |
| | | loading.hide(); |
| | | } |
| | | }); |
| | | return false; |