整理权限
This commit is contained in:
parent
6e9a510d3c
commit
bb01b94a52
@ -21,7 +21,7 @@ import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@ -41,7 +41,7 @@ public class SysLoginController
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -58,7 +58,7 @@ public class SysLoginController
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
@ -79,7 +79,7 @@ public class SysLoginController
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
|
@ -52,7 +52,7 @@ public class BrowserController extends BaseController {
|
||||
|
||||
|
||||
@RequestMapping("/import")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:list')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:browser:export')")
|
||||
public AjaxResult importCollect(@RequestParam("htmlFile") MultipartFile htmlFile){
|
||||
logger.debug("开始上传状态是:");
|
||||
SysUser sysUser=getAuthUser();
|
||||
@ -88,33 +88,33 @@ public class BrowserController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导入收藏文章
|
||||
*/
|
||||
public void importHtml(Map<String, String> map,Long menuID,Long userId){
|
||||
for(Entry<String, String> entry : map.entrySet()){
|
||||
try {
|
||||
//获取URL后查询最新的URL信息
|
||||
Map<String, String> result = ImportHtml.getCollectFromUrl(entry.getKey());
|
||||
SqBookmark sqBookmark =new SqBookmark();
|
||||
sqBookmark.setUserid(userId);
|
||||
sqBookmark.setTitle(entry.getValue());
|
||||
sqBookmark.setUrl(entry.getKey());
|
||||
sqBookmark.setUrls(ImportHtml.Urlutils(new URL(entry.getKey())));
|
||||
if(StringUtils.isBlank(result.get("description"))){
|
||||
sqBookmark.setDescription(entry.getValue());
|
||||
}else{
|
||||
sqBookmark.setDescription(result.get("description"));
|
||||
}
|
||||
sqBookmark.setMenuId(menuID);
|
||||
sqBookmark.setCreateTime(new Date());
|
||||
iSqBookmarkService.insertSqBookmark(sqBookmark);
|
||||
} catch (Exception e) {
|
||||
logger.error("导入存储异常:",e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 导入收藏文章
|
||||
// */
|
||||
// public void importHtml(Map<String, String> map,Long menuID,Long userId){
|
||||
// for(Entry<String, String> entry : map.entrySet()){
|
||||
// try {
|
||||
// //获取URL后查询最新的URL信息
|
||||
// Map<String, String> result = ImportHtml.getCollectFromUrl(entry.getKey());
|
||||
// SqBookmark sqBookmark =new SqBookmark();
|
||||
// sqBookmark.setUserid(userId);
|
||||
// sqBookmark.setTitle(entry.getValue());
|
||||
// sqBookmark.setUrl(entry.getKey());
|
||||
// sqBookmark.setUrls(ImportHtml.Urlutils(new URL(entry.getKey())));
|
||||
// if(StringUtils.isBlank(result.get("description"))){
|
||||
// sqBookmark.setDescription(entry.getValue());
|
||||
// }else{
|
||||
// sqBookmark.setDescription(result.get("description"));
|
||||
// }
|
||||
// sqBookmark.setMenuId(menuID);
|
||||
// sqBookmark.setCreateTime(new Date());
|
||||
// iSqBookmarkService.insertSqBookmark(sqBookmark);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("导入存储异常:",e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -44,14 +44,14 @@ public class SqBookmarkController extends BaseController
|
||||
private ISqBookmarkService sqBookmarkService;
|
||||
|
||||
|
||||
/**
|
||||
* 测试通用mapper
|
||||
*/
|
||||
@GetMapping("/selectByID")
|
||||
public TableDataInfo selectByID( Long userID) {
|
||||
List<SqBookmark> list = sqBookmarkService.selectByID(userID);
|
||||
return getDataTable(list);
|
||||
}
|
||||
// /**
|
||||
// * 测试通用mapper
|
||||
// */
|
||||
// @GetMapping("/selectByID")
|
||||
// public TableDataInfo selectByID( Long userID) {
|
||||
// List<SqBookmark> list = sqBookmarkService.selectByID(userID);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 通过url 查询用户 是否已经添加了此书签
|
||||
@ -60,6 +60,7 @@ public class SqBookmarkController extends BaseController
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectByUrlUserID")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:url')")
|
||||
public AjaxResult selectByUrlUserID(String url) {
|
||||
SysUser sysUser=getAuthUser();
|
||||
startPage();
|
||||
@ -76,7 +77,7 @@ public class SqBookmarkController extends BaseController
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectBymenuIdUserID")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:list')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:listsousou')")
|
||||
public TableDataInfo selectBymenuIdUserID(Long menuId,Integer sort,String sousuo) {
|
||||
SysUser sysUser=getAuthUser();
|
||||
startPage();
|
||||
@ -88,7 +89,7 @@ public class SqBookmarkController extends BaseController
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectBydelete")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:list')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:recycle')")
|
||||
public TableDataInfo selectBydelete() {
|
||||
SysUser sysUser=getAuthUser();
|
||||
startPage();
|
||||
@ -101,7 +102,7 @@ public class SqBookmarkController extends BaseController
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectByUseridList")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:list')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:list')")
|
||||
public TableDataInfo selectByUseridList() {
|
||||
SysUser sysUser=getAuthUser();
|
||||
startPage();
|
||||
@ -148,32 +149,33 @@ public class SqBookmarkController extends BaseController
|
||||
/**
|
||||
* 新增书签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:add')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:add')")
|
||||
@Log(title = "书签管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SqBookmark sqBookmark)
|
||||
{
|
||||
SysUser sysUser=getAuthUser();
|
||||
sqBookmark.setUserid(sysUser.getUserId());
|
||||
|
||||
return toAjax(sqBookmarkService.insertSqBookmark(sqBookmark));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改书签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:edit')")
|
||||
@Log(title = "书签管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SqBookmark sqBookmark)
|
||||
{
|
||||
SysUser sysUser=getAuthUser();
|
||||
sqBookmark.setUserid(sysUser.getUserId());
|
||||
return toAjax(sqBookmarkService.updateSqBookmark(sqBookmark));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除书签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:remove')")
|
||||
@Log(title = "书签管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{bookmarkIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] bookmarkIds)
|
||||
|
@ -43,6 +43,7 @@ public class SqMenuController extends BaseController
|
||||
*/
|
||||
|
||||
@GetMapping("/selectMenuByUserID")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:list')")
|
||||
public AjaxResult selecByUserID()
|
||||
{
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
@ -54,6 +55,7 @@ public class SqMenuController extends BaseController
|
||||
* 功能描述:根据MenuId 查询子目录
|
||||
*/
|
||||
@GetMapping("/listByMenuId/{menuId}")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:menuidlist')")
|
||||
public AjaxResult listByMenuId(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
List<SqMenu> list = sqMenuService.listByMenuId(getAuthUser().getUserId(),menuId);
|
||||
@ -63,14 +65,9 @@ public class SqMenuController extends BaseController
|
||||
* 功能描述:根据MenuId 查询子目录
|
||||
*/
|
||||
@PostMapping("/listByMenuIdP")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:menuidlist')")
|
||||
public AjaxResult listByMenuIdP(@RequestParam("menuId") Long menuId)
|
||||
{
|
||||
// try {
|
||||
// Thread.sleep(50000);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
List<SqMenu> list = sqMenuService.listByMenuId(getAuthUser().getUserId(),menuId);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
@ -79,6 +76,7 @@ public class SqMenuController extends BaseController
|
||||
* 查询MenuID单个书签信息
|
||||
*/
|
||||
@GetMapping("/selectByMenuId")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:menuid')")
|
||||
public AjaxResult list(@RequestParam("menuId") Long menuId)
|
||||
{
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
@ -92,6 +90,8 @@ public class SqMenuController extends BaseController
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询书签菜单列表
|
||||
*/
|
||||
@ -129,7 +129,7 @@ public class SqMenuController extends BaseController
|
||||
/**
|
||||
* 新增书签菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:add')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:add')")
|
||||
@Log(title = "书签菜单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SqMenu sqMenu)
|
||||
@ -142,7 +142,7 @@ public class SqMenuController extends BaseController
|
||||
/**
|
||||
* 修改书签菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:edit')")
|
||||
@Log(title = "书签菜单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SqMenu sqMenu)
|
||||
@ -184,7 +184,7 @@ public class SqMenuController extends BaseController
|
||||
/**
|
||||
* 删除书签菜单
|
||||
*/
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:common:remove')")
|
||||
@Log(title = "书签菜单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete/{menuId}")
|
||||
public AjaxResult remove(@PathVariable Long menuId)
|
||||
|
@ -20,7 +20,7 @@ import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
|
@ -1 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="120px" height="120.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M0 241.003303v709.973013h443.733406c0 37.702481 30.565206 68.267687 68.267687 68.267687 37.702481 0 68.267687-30.565206 68.267687-68.267687h443.733407V241.003303H0z" fill="#64798A" /><path d="M62.776971 206.08226h898.443872v681.668819H62.776971z" fill="#EBF0F3" /><path d="M199.773731 80.012266l354.887013 242.000423v565.734017l-341.237849-135.004709z" fill="#E1E6E9" /><path d="M554.660744 214.168548L398.19173 4.755997v654.333317l156.469014 228.657392z" fill="#D5D6DB" /><path d="M789.318346 206.077887v171.008151l51.439111-27.307075 44.133464 27.307075V206.077887z" fill="#E56353" /></svg>
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="420px" height="420px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M0 241.003303v709.973013h443.733406c0 37.702481 30.565206 68.267687 68.267687 68.267687 37.702481 0 68.267687-30.565206 68.267687-68.267687h443.733407V241.003303H0z" fill="#64798A" /><path d="M62.776971 206.08226h898.443872v681.668819H62.776971z" fill="#EBF0F3" /><path d="M199.773731 80.012266l354.887013 242.000423v565.734017l-341.237849-135.004709z" fill="#E1E6E9" /><path d="M554.660744 214.168548L398.19173 4.755997v654.333317l156.469014 228.657392z" fill="#D5D6DB" /><path d="M789.318346 206.077887v171.008151l51.439111-27.307075 44.133464 27.307075V206.077887z" fill="#E56353" /></svg>
|
||||
|
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 857 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1553828490559" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1684" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M898.831744 900.517641 103.816972 900.517641c-36.002982 0-65.363683-29.286-65.363683-65.313541l0-554.949184c0-36.041868 29.361725-65.326844 65.363683-65.326844l795.015795 0c36.002982 0 65.198931 29.284977 65.198931 65.326844l0 554.949184C964.030675 871.231641 934.834726 900.517641 898.831744 900.517641L898.831744 900.517641zM103.816972 255.593236c-13.576203 0-24.711821 11.085476-24.711821 24.662703l0 554.949184c0 13.576203 11.136641 24.662703 24.711821 24.662703l795.015795 0c13.577227 0 24.547069-11.086499 24.547069-24.662703l0-554.949184c0-13.577227-10.970866-24.662703-24.547069-24.662703L103.816972 255.593236 103.816972 255.593236zM664.346245 251.774257c-11.161201 0-20.332071-9.080819-20.332071-20.332071l0-101.278661c0-13.576203-11.047614-24.623817-24.699542-24.623817L383.181611 105.539708c-13.576203 0-24.712845 11.04659-24.712845 24.623817l0 101.278661c0 11.252275-9.041934 20.332071-20.332071 20.332071-11.20111 0-20.319791-9.080819-20.319791-20.332071l0-101.278661c0-35.989679 29.323862-65.275679 65.364707-65.275679l236.133022 0c36.06745 0 65.402569 29.284977 65.402569 65.275679l0 101.278661C684.717202 242.694461 675.636383 251.774257 664.346245 251.774257L664.346245 251.774257zM413.233044 521.725502 75.694471 521.725502c-11.163247 0-20.333094-9.117658-20.333094-20.35663 0-11.252275 9.169847-20.332071 20.333094-20.332071l337.538573 0c11.277858 0 20.319791 9.080819 20.319791 20.332071C433.552835 512.607844 424.510902 521.725502 413.233044 521.725502L413.233044 521.725502zM912.894018 521.725502 575.367725 521.725502c-11.213389 0-20.332071-9.117658-20.332071-20.35663 0-11.252275 9.118682-20.332071 20.332071-20.332071l337.526293 0c11.290137 0 20.332071 9.080819 20.332071 20.332071C933.226089 512.607844 924.184155 521.725502 912.894018 521.725502L912.894018 521.725502zM557.56322 634.217552 445.085496 634.217552c-11.213389 0-20.332071-9.079796-20.332071-20.331048l0-168.763658c0-11.251252 9.118682-20.332071 20.332071-20.332071l112.478747 0c11.290137 0 20.370956 9.080819 20.370956 20.332071l0 168.763658C577.934177 625.137757 568.853357 634.217552 557.56322 634.217552L557.56322 634.217552zM465.417567 593.514525l71.827909 0L537.245476 465.454918l-71.827909 0L465.417567 593.514525 465.417567 593.514525z" p-id="1685" fill="#bfbfbf"></path></svg>
|
||||
<svg t="1615812754211" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21147" width="128" height="128"><path d="M906.666667 214.848H725.333333v-57.6c-2.133333-40.533333-36.266667-70.4-76.8-70.4h-298.666666c-40.533333 2.133333-72.533333 34.133333-72.533334 74.666667v53.333333H117.333333c-40.533333 0-74.666667 34.133333-74.666666 74.666667v554.666666c0 40.533333 34.133333 74.666667 74.666666 74.666667h789.333334c40.533333 0 74.666667-34.133333 74.666666-74.666667v-554.666666c0-40.533333-34.133333-74.666667-74.666666-74.666667zM341.333333 161.514667c2.133333-6.4 6.4-10.666667 12.8-10.666667h296.533334c6.4 0 10.666667 6.4 10.666666 10.666667v53.333333H341.333333v-53.333333z m-224 117.333333h789.333334c6.4 0 10.666667 4.266667 10.666666 10.666667v149.333333H106.666667v-149.333333c0-6.4 4.266667-10.666667 10.666666-10.666667z m490.666667 224v53.333333c0 6.4-4.266667 10.666667-10.666667 10.666667h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667v-53.333333h192z m298.666667 352h-789.333334c-6.4 0-10.666667-4.266667-10.666666-10.666667v-341.333333h245.333333v53.333333c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c40.533333 0 74.666667-34.133333 74.666667-74.666667v-53.333333H917.333333v341.333333c0 6.4-4.266667 10.666667-10.666666 10.666667z" p-id="21148" fill="#1D6EFE"></path></svg>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.3 KiB |
@ -1,187 +1,187 @@
|
||||
<template>
|
||||
<div class="navbar">
|
||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||
|
||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
||||
|
||||
<div class="right-menu">
|
||||
<template v-if="device!=='mobile'">
|
||||
<search id="header-search" class="right-menu-item" />
|
||||
|
||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
</template>
|
||||
|
||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="avatar" class="user-avatar">
|
||||
<i class="el-icon-caret-bottom" />
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<router-link to="/user/profile">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item @click.native="setting = true">
|
||||
<span>布局设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
<span>退出登录</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import Breadcrumb from '@/components/Breadcrumb'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
import RuoYiGit from '@/components/RuoYi/Git'
|
||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Breadcrumb,
|
||||
Hamburger,
|
||||
Screenfull,
|
||||
SizeSelect,
|
||||
Search,
|
||||
RuoYiGit,
|
||||
RuoYiDoc
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'avatar',
|
||||
'device'
|
||||
]),
|
||||
setting: {
|
||||
get() {
|
||||
return this.$store.state.settings.showSettings
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch('settings/changeSetting', {
|
||||
key: 'showSettings',
|
||||
value: val
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleSideBar() {
|
||||
this.$store.dispatch('app/toggleSideBar')
|
||||
},
|
||||
async logout() {
|
||||
this.$confirm('确定注销并退出系统吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar {
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
||||
|
||||
.hamburger-container {
|
||||
line-height: 46px;
|
||||
height: 100%;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
transition: background .3s;
|
||||
-webkit-tap-highlight-color:transparent;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, .025)
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-container {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.errLog-container {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.right-menu {
|
||||
float: right;
|
||||
height: 100%;
|
||||
line-height: 50px;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.right-menu-item {
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
color: #5a5e66;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
&.hover-effect {
|
||||
cursor: pointer;
|
||||
transition: background .3s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, .025)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
margin-right: 30px;
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
|
||||
.user-avatar {
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.el-icon-caret-bottom {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
top: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="navbar">
|
||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||
|
||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
||||
|
||||
<div class="right-menu">
|
||||
<template v-if="device!=='mobile'">
|
||||
<search id="header-search" class="right-menu-item" />
|
||||
|
||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
</template>
|
||||
|
||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="avatar" class="user-avatar">
|
||||
<i class="el-icon-caret-bottom" />
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<router-link to="/user/profile">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item @click.native="setting = true">
|
||||
<span>布局设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
<span>退出登录</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import Breadcrumb from '@/components/Breadcrumb'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
import RuoYiGit from '@/components/RuoYi/Git'
|
||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Breadcrumb,
|
||||
Hamburger,
|
||||
Screenfull,
|
||||
SizeSelect,
|
||||
Search,
|
||||
RuoYiGit,
|
||||
RuoYiDoc
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'avatar',
|
||||
'device'
|
||||
]),
|
||||
setting: {
|
||||
get() {
|
||||
return this.$store.state.settings.showSettings
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch('settings/changeSetting', {
|
||||
key: 'showSettings',
|
||||
value: val
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleSideBar() {
|
||||
this.$store.dispatch('app/toggleSideBar')
|
||||
},
|
||||
async logout() {
|
||||
this.$confirm('确定注销并退出系统吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/content';
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar {
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
||||
|
||||
.hamburger-container {
|
||||
line-height: 46px;
|
||||
height: 100%;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
transition: background .3s;
|
||||
-webkit-tap-highlight-color:transparent;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, .025)
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-container {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.errLog-container {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.right-menu {
|
||||
float: right;
|
||||
height: 100%;
|
||||
line-height: 50px;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.right-menu-item {
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
color: #5a5e66;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
&.hover-effect {
|
||||
cursor: pointer;
|
||||
transition: background .3s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, .025)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
margin-right: 30px;
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
|
||||
.user-avatar {
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.el-icon-caret-bottom {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
top: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -149,6 +149,7 @@ export const constantRoutes = [
|
||||
title: '书签管理',icon:'user',
|
||||
requireAuth: false,
|
||||
},
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '/content',
|
||||
|
@ -13,7 +13,7 @@
|
||||
<br/>
|
||||
<svg-icon icon-class="notebook_1" />
|
||||
<br/>
|
||||
<svg-icon icon-class="notebook_2" />
|
||||
<svg-icon icon-class="tool" style="width: 50px;height: 50px" />
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -1,6 +1,89 @@
|
||||
<template>
|
||||
<div>
|
||||
{{msg}}
|
||||
<div class="main">
|
||||
<div >
|
||||
|
||||
<div class="toolAll">
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="tool" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >书签去重</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="100" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >文件</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="102" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >文件</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="103" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >文件</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="104" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >文件</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 微信丶在线文档等 -->
|
||||
<div class="tool">
|
||||
<svg-icon icon-class="105" class="toolIcon" />
|
||||
<div class="toolName">
|
||||
<span >文件</span>
|
||||
</div>
|
||||
<div class="toolDescription">
|
||||
<span style="">微信丶在线文档等</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -14,6 +97,49 @@
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
<style scoped>
|
||||
.main{
|
||||
background-color: #F4F5F9;
|
||||
}
|
||||
.toolAll{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-items:center;
|
||||
flex-wrap:wrap;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
.tool{
|
||||
background-color: #FFFFFF;
|
||||
width: 180px;
|
||||
height: 120px;
|
||||
border-radius: 10px;
|
||||
margin-left: 48px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.toolIcon{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.toolName{
|
||||
margin-top: 10px
|
||||
}
|
||||
.toolName span{
|
||||
margin-left: 10px;
|
||||
color: #2B2B2B;
|
||||
font-weight: 800;
|
||||
font-size: 17px
|
||||
}
|
||||
.toolDescription{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.toolDescription span{
|
||||
margin-left: 10px;
|
||||
margin-top: 18px;
|
||||
color: #ADB1B9;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<div class="aside-title" @click="gorecycle"><i class="el-icon-delete-solid" style="color: red"></i><span>垃圾桶</span></div>
|
||||
<div class="aside-title" @click="importHtml"><i class="el-icon-s-platform"></i><span>导入书签</span></div>
|
||||
<div class="aside-title"><i class="el-icon-s-comment"></i><span>意见反馈</span></div>
|
||||
<div class="aside-title" @click="ceshi"><i class="el-icon-s-comment"></i><span>测试页面</span></div>
|
||||
<!-- <div class="aside-title" @click="ceshi"><i class="el-icon-s-comment"></i><span>测试页面</span></div>-->
|
||||
<!-- <div class="aside-title" @click="NqEdit"><i class="el-icon-s-comment"></i><span>NqQuillEdit编辑器</span></div>-->
|
||||
<div class="aside-title " style="margin-bottom: 100px" @click="gotool"><i class="el-icon-s-grid"></i><span>工具箱</span></div>
|
||||
|
||||
|
@ -1,206 +1,207 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">若依后台管理系统</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code">
|
||||
<el-input
|
||||
v-model="loginForm.code"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 63%"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width:100%;"
|
||||
@click.native.prevent="handleLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>Copyright © 2018-2019 ruoyi.vip All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
cookiePassword: "",
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "用户名不能为空" }
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "密码不能为空" }
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
|
||||
},
|
||||
loading: false,
|
||||
redirect: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function(route) {
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
});
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm = {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove('rememberMe');
|
||||
}
|
||||
this.$store
|
||||
.dispatch("Login", this.loginForm)
|
||||
.then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" });
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
this.getCode();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url("../assets/image/login-background.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
.el-input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.login-code-img {
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">藏趣云</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code">
|
||||
<el-input
|
||||
v-model="loginForm.code"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 63%"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width:100%;"
|
||||
@click.native.prevent="handleLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>Copyright © 2020-2021 CQY All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
cookiePassword: "",
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "用户名不能为空" }
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "密码不能为空" }
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
|
||||
},
|
||||
loading: false,
|
||||
redirect: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function(route) {
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
});
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm = {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove('rememberMe');
|
||||
}
|
||||
this.$store
|
||||
.dispatch("Login", this.loginForm)
|
||||
.then(() => {
|
||||
this.$router.push({ path: this.redirect || "/content" });
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
this.getCode();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url("../assets/image/2043428.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
.el-input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
opacity: 0.8;
|
||||
}
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.login-code-img {
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user