提交 f5623fb0 authored 作者: lidongxu's avatar lidongxu

feat(login): 登录功能完成

登录功能包含工号和密码登录,飞书网页授权登录,飞书客户端静默授权登录
上级 cbaaba4d
......@@ -14,5 +14,5 @@ VITE_APP_ENV = 'development'
VITE_APP_PUBLIC_PATH = '/'
# 第三方服务回调地址
VITE_APP_RedirectURL = 'http://localhost:81/'
VITE_APP_REDIRECT_URL = 'http://localhost:81/'
......@@ -11,5 +11,5 @@ VITE_APP_ENV = 'production'
VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址
VITE_APP_RedirectURL = 'http://sfa.wxl66.cn:86/link/'
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:86/link/'
......@@ -5,10 +5,10 @@ VITE_APP_TITLE = 王小卤-链路中心
VITE_APP_BASE_API = '/api'
# 开发环境配置
VITE_APP_NODE_ENV = 'staging'
VITE_APP_ENV = 'staging'
# 公共资源前缀地址
VITE_APP_PUBLIC_PATH = './'
# 第三方服务回调地址
VITE_APP_REDIRECT_URL = 'http://sfa.test.wxl66.cn:85/link/'
VITE_APP_REDIRECT_URL = 'http://111.198.15.68:85/link/'
import request from '@/utils/request'
// 竞品分析
// 蝉妈妈-各大竞品直播间数据集合
export function getCmmListAPI(params) {
return request({
url: '/bi/oppo/cmm/zbj',
params
})
}
// 生意参谋-各大竞品直播间数据集合
export function getSycmListAPI(params) {
return request({
url: '/bi/oppo/sycm/list',
params
})
}
\ No newline at end of file
import request from '@/utils/request'
// 获取系列数据列表(左侧树)
export const getSeriesListAPI = () => {
return request({
url: '/bi/prd/query/series'
})
}
// 获取商品列表
export const getProductListAPI = (params) => {
return request({
url: '/bi/prd/query',
params
})
}
// 创建商品标签集合
export function createSeriesGoodsTagAPI(data) {
return request({
url: '/bi/prd_tage/core',
method: 'post',
data
})
}
// 查询商品标签集合列表
export function getSeriesGoodsTagListAPI(params) {
return request({
url: '/bi/prd_tage/query/page',
params
})
}
// 查询商品标签详情
export function getPrdTagDetailAPI(params) {
return request({
url: '/bi/prd_tage/query/infos',
params
})
}
// 删除商品标签
export function deleteSeriesGoodsTagAPI(tagId) {
return request({
url: '/bi/prd_tage/core/' + tagId,
method: 'delete'
})
}
\ No newline at end of file
// 电商销售分析数据
import request from '@/utils/request'
// 电商平台明细表
export const getSaleListAPI = (params) => {
return request({
url: '/bi/market/detail/sum_d',
method: 'get',
params
})
}
// export const getQueryList = (params) => {
// return axios({
// url: '/my/search_list',
// method: 'get',
// params
// })
// }
// 电商货需上传表格
export const uploadDemandImportAPI = (data) => {
return request({
url: '/bi/demand/core/import',
method: 'post',
data,
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
\ No newline at end of file
import request from '@/utils/request'
// 查询电商-店铺列表
export function listStore(query) {
return request({
url: '/bi/store/query/list',
method: 'get',
params: query
})
}
// 新增电商-店铺
export function addStore(data) {
return request({
url: '/bi/store/core',
method: 'post',
data: data
})
}
// 修改电商-店铺
export function updateStore(data) {
return request({
url: '/bi/store/core',
method: 'put',
data: data
})
}
import request from '@/utils/request'
import { FS_APPID } from '@/config'
/****************** 飞书相关业务接口 ******************/
// 浏览器端授权飞书登录,回调地址 URL 上带回 code
export const fsOAuthUrl = `https://accounts.feishu.cn/open-apis/authen/v1/authorize?client_id=${FS_APPID}&state=fs&redirect_uri=${import.meta.env.VITE_APP_REDIRECT_URL}`
/**
* 飞书客户端-静默授权获取 code
* @returns {Promise}
*/
export function fsClientAuth() {
return new Promise((resolve, reject) => {
// 客户端内
window.h5sdk.ready(async () => {
if (window.tt?.requestAccess) {
window.tt.requestAccess({
scopeList: [],
appID: FS_APPID,
success: async ({ code }) => {
resolve(code)
}
})
}
})
})
}
/**
* 飞书登录
* @param {*} data { code: 授权码 }
* @returns
*/
export function fsLogin(data) {
return request({
url: '/auth/fs/login',
method: 'POST',
data
})
}
// 账号密码登录
export function login(data) {
return request({
url: '/auth/login',
method: 'post',
data
})
}
// 获取用户详细信息
export function getInfo() {
return request({
url: '/system/user/getInfo'
})
}
// 退出方法
export function logout() {
return request({
url: '/auth/logout',
method: 'delete'
})
}
\ No newline at end of file
import request from '@/utils/request'
// 获取路由
// 获取路由列表
export const getRouters = () => {
return request({
url: '/system/menu/getRouters',
method: 'get'
url: '/system/menu/getRouters'
})
}
\ No newline at end of file
// 项目所有表单开窗查询接口
import request from '@/utils/request'
// 表单开窗查询固定接口(包含查询表单结构和表格对应数据)
const openQueryURL = '/system/general/query/window'
// 获取"考勤配置"开窗+考勤规则数据
export const attendanceOpenFQAPI = (wheres = {}) => {
return request({
url: openQueryURL,
method: 'POST',
data: {
queryId: 3, // (3 号)是和后台约定好的固定类型数字
wheres // wherers 查询条件
}
})
}
import request from '@/utils/request'
// 获取服务信息
export function getServer() {
// 省市区查询
export const getProCityAPI = (params) => {
return request({
url: '/monitor/server',
method: 'get'
url: '/system/site/query/region',
params
})
}
\ No newline at end of file
export * from './common/login'
export * from './common/menu'
export * from './common/region'
export * from './common/openQuery'
// export * from './bi/competitor'
\ No newline at end of file
import request from '@/utils/request'
// 登录方法
export function login(username, password, code, uuid) {
const data = {
username,
password,
code,
uuid
}
return request({
url: '/login',
headers: {
isToken: false,
repeatSubmit: false
},
method: 'post',
data: data
})
}
// 注册方法
export function register(data) {
return request({
url: '/register',
headers: {
isToken: false
},
method: 'post',
data: data
})
}
// 获取用户详细信息
export function getInfo() {
return request({
url: '/system/user/getInfo',
method: 'get'
})
}
// 退出方法
export function logout() {
return request({
url: '/logout',
method: 'post'
})
}
// 获取验证码
export function getCodeImg() {
return request({
url: '/captchaImage',
headers: {
isToken: false
},
method: 'get',
timeout: 20000
})
}
\ No newline at end of file
import request from '@/utils/request'
// 查询缓存详细
export function getCache() {
return request({
url: '/monitor/cache',
method: 'get'
})
}
// 查询缓存名称列表
export function listCacheName() {
return request({
url: '/monitor/cache/getNames',
method: 'get'
})
}
// 查询缓存键名列表
export function listCacheKey(cacheName) {
return request({
url: '/monitor/cache/getKeys/' + cacheName,
method: 'get'
})
}
// 查询缓存内容
export function getCacheValue(cacheName, cacheKey) {
return request({
url: '/monitor/cache/getValue/' + cacheName + '/' + cacheKey,
method: 'get'
})
}
// 清理指定名称缓存
export function clearCacheName(cacheName) {
return request({
url: '/monitor/cache/clearCacheName/' + cacheName,
method: 'delete'
})
}
// 清理指定键名缓存
export function clearCacheKey(cacheKey) {
return request({
url: '/monitor/cache/clearCacheKey/' + cacheKey,
method: 'delete'
})
}
// 清理全部缓存
export function clearCacheAll() {
return request({
url: '/monitor/cache/clearCacheAll',
method: 'delete'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询定时任务调度列表
export function listJob(query) {
return request({
url: '/monitor/job/list',
url: '/schedule/job/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function listJob(query) {
// 查询定时任务调度详细
export function getJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/schedule/job/' + jobId,
method: 'get'
})
}
......@@ -20,7 +20,7 @@ export function getJob(jobId) {
// 新增定时任务调度
export function addJob(data) {
return request({
url: '/monitor/job',
url: '/schedule/job',
method: 'post',
data: data
})
......@@ -29,7 +29,7 @@ export function addJob(data) {
// 修改定时任务调度
export function updateJob(data) {
return request({
url: '/monitor/job',
url: '/schedule/job',
method: 'put',
data: data
})
......@@ -38,7 +38,7 @@ export function updateJob(data) {
// 删除定时任务调度
export function delJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/schedule/job/' + jobId,
method: 'delete'
})
}
......@@ -50,7 +50,7 @@ export function changeJobStatus(jobId, status) {
status
}
return request({
url: '/monitor/job/changeStatus',
url: '/schedule/job/changeStatus',
method: 'put',
data: data
})
......@@ -64,7 +64,7 @@ export function runJob(jobId, jobGroup) {
jobGroup
}
return request({
url: '/monitor/job/run',
url: '/schedule/job/run',
method: 'put',
data: data
})
......
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询调度日志列表
export function listJobLog(query) {
return request({
url: '/monitor/jobLog/list',
url: '/schedule/job/log/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function listJobLog(query) {
// 删除调度日志
export function delJobLog(jobLogId) {
return request({
url: '/monitor/jobLog/' + jobLogId,
url: '/schedule/job/log/' + jobLogId,
method: 'delete'
})
}
......@@ -20,7 +20,7 @@ export function delJobLog(jobLogId) {
// 清空调度日志
export function cleanJobLog() {
return request({
url: '/monitor/jobLog/clean',
url: '/schedule/job/log/clean',
method: 'delete'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询在线用户列表
export function list(query) {
return request({
url: '/monitor/online/list',
url: '/system/online/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function list(query) {
// 强退用户
export function forceLogout(tokenId) {
return request({
url: '/monitor/online/' + tokenId,
url: '/system/online/' + tokenId,
method: 'delete'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询登录日志列表
export function list(query) {
return request({
url: '/monitor/logininfor/list',
url: '/system/logininfor/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function list(query) {
// 删除登录日志
export function delLogininfor(infoId) {
return request({
url: '/monitor/logininfor/' + infoId,
url: '/system/logininfor/' + infoId,
method: 'delete'
})
}
......@@ -20,15 +20,14 @@ export function delLogininfor(infoId) {
// 解锁用户登录状态
export function unlockLogininfor(userName) {
return request({
url: '/monitor/logininfor/unlock/' + userName,
url: '/system/logininfor/unlock/' + userName,
method: 'get'
})
}
// 清空登录日志
export function cleanLogininfor() {
return request({
url: '/monitor/logininfor/clean',
url: '/system/logininfor/clean',
method: 'delete'
})
}
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询操作日志列表
export function list(query) {
return request({
url: '/monitor/operlog/list',
url: '/system/operlog/list',
method: 'get',
params: query
})
......@@ -12,7 +12,7 @@ export function list(query) {
// 删除操作日志
export function delOperlog(operId) {
return request({
url: '/monitor/operlog/' + operId,
url: '/system/operlog/' + operId,
method: 'delete'
})
}
......@@ -20,7 +20,7 @@ export function delOperlog(operId) {
// 清空操作日志
export function cleanOperlog() {
return request({
url: '/monitor/operlog/clean',
url: '/system/operlog/clean',
method: 'delete'
})
}
......@@ -68,7 +68,8 @@ export function delRole(roleId) {
// 查询角色已授权用户列表
export function allocatedUserList(query) {
return request({
url: '/system/role/authUser/allocatedList',
// url: '/system/role/authUser/allocatedList',
url: '/system/user/list',
method: 'get',
params: query
})
......@@ -77,9 +78,12 @@ export function allocatedUserList(query) {
// 查询角色未授权用户列表
export function unallocatedUserList(query) {
return request({
url: '/system/role/authUser/unallocatedList',
url: '/system/user/list',
method: 'get',
params: query
params: {
...query,
existRole: false
}
})
}
......
import request from '@/utils/request'
// 考勤规则-列表
export function listRule(query) {
return request({
url: '/system/kq_rule/list',
method: 'get',
params: query
})
}
// 考勤规则-详细
export function getRule(ruleId) {
return request({
url: '/system/kq_rule/' + ruleId,
method: 'get'
})
}
// 新增考勤规则
export function addRule(data) {
return request({
url: '/system/kq_rule/add',
method: 'post',
data: data
})
}
// 修改考勤规则
export function updateRule(data) {
return request({
url: '/system/kq_rule/put',
method: 'put',
data: data
})
}
// 删除考勤规则
export function delRule(ruleId) {
return request({
url: '/system/kq_rule/' + ruleId,
method: 'delete'
})
}
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
import { parseStrEmpty } from "@/utils";
// 查询用户列表
export function listUser(query) {
......@@ -96,7 +96,7 @@ export function updateUserPwd(oldPassword, newPassword) {
return request({
url: '/system/user/profile/updatePwd',
method: 'put',
data: data
params: data
})
}
......
import request from '@/utils/request'
import request from "@/utils/request";
// 查询生成表数据
export function listTable(query) {
return request({
url: '/tool/gen/list',
method: 'get',
params: query
})
url: "/code/gen/list",
method: "get",
params: query,
});
}
// 查询db数据库列表
export function listDbTable(query) {
return request({
url: '/tool/gen/db/list',
method: 'get',
params: query
})
url: "/code/gen/db/list",
method: "get",
params: query,
});
}
// 查询表详细信息
export function getGenTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
method: 'get'
})
url: "/code/gen/" + tableId,
method: "get",
});
}
// 修改代码生成信息
export function updateGenTable(data) {
return request({
url: '/tool/gen',
method: 'put',
data: data
})
url: "/code/gen",
method: "put",
data: data,
});
}
// 导入表
export function importTable(data) {
return request({
url: '/tool/gen/importTable',
method: 'post',
params: data
})
}
// 创建表
export function createTable(data) {
return request({
url: '/tool/gen/createTable',
method: 'post',
params: data
})
url: "/code/gen/importTable",
method: "post",
params: data,
});
}
// 预览生成代码
export function previewTable(tableId) {
return request({
url: '/tool/gen/preview/' + tableId,
method: 'get'
})
url: "/code/gen/preview/" + tableId,
method: "get",
});
}
// 删除表数据
export function delTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
method: 'delete'
})
url: "/code/gen/" + tableId,
method: "delete",
});
}
// 生成代码(自定义路径)
export function genCode(tableName) {
return request({
url: '/tool/gen/genCode/' + tableName,
method: 'get'
})
url: "/code/gen/genCode/" + tableName,
method: "get",
});
}
// 同步数据库
export function synchDb(tableName) {
return request({
url: '/tool/gen/synchDb/' + tableName,
method: 'get'
})
url: "/code/gen/synchDb/" + tableName,
method: "get",
});
}
// 创建表
export function createTable(data) {
return request({
url: "/tool/gen/createTable",
method: "post",
params: data,
});
}
src/assets/images/login-background.jpg

509.1 KB | W: | H:

src/assets/images/login-background.jpg

140.4 KB | W: | H:

src/assets/images/login-background.jpg
src/assets/images/login-background.jpg
src/assets/images/login-background.jpg
src/assets/images/login-background.jpg
  • 2-up
  • Swipe
  • Onion skin
src/assets/logo/logo.png

5.5 KB | W: | H:

src/assets/logo/logo.png

183.4 KB | W: | H:

src/assets/logo/logo.png
src/assets/logo/logo.png
src/assets/logo/logo.png
src/assets/logo/logo.png
  • 2-up
  • Swipe
  • Onion skin
export const FS_APPID = 'cli_a7dbe3ec7d9e5013'
\ No newline at end of file
import { createWebHistory, createRouter } from 'vue-router'
import { createWebHashHistory, createRouter } from 'vue-router'
/* Layout */
import Layout from '@/layout'
......@@ -161,7 +161,7 @@ export const dynamicRoutes = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHashHistory(),
routes: constantRoutes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
......
// 仅仅用作 store 里初始值
export default {
/**
* 网页标题
......
import auth from '@/plugins/auth'
import router, { constantRoutes, dynamicRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import { getRouters } from '@/api'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink'
......
import { login, logout, getInfo } from '@/api/login'
import { login, fsLogin, getInfo } from '@/api'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { isHttp, isEmpty } from "@/utils/validate"
import defAva from '@/assets/images/profile.jpg'
const useUserStore = defineStore(
export default defineStore(
'user',
{
state: () => ({
......@@ -15,20 +15,31 @@ const useUserStore = defineStore(
permissions: []
}),
actions: {
// 登录
login(userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
/**
* 登录
* @param {*} param { type: 登录方式 data: 登录数据,code / 工号密码 }
* @returns {Promise}
*/
login({ type, data }) {
const { username, password, code } = data
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
if (type === 'upass') {
login({ username, password }).then(res => {
setToken(res.token)
this.token = res.token
resolve()
}).catch(error => {
reject(error)
})
} else if (type === 'fs') {
fsLogin({ code }).then(res => {
setToken(res.access_token)
this.token = res.access_token
resolve()
}).catch(error => {
reject(error)
})
}
})
},
// 获取用户信息
......@@ -58,18 +69,17 @@ const useUserStore = defineStore(
// 退出系统
logOut() {
return new Promise((resolve, reject) => {
logout(this.token).then(() => {
// logout(this.token).then(() => {
this.token = ''
this.roles = []
this.permissions = []
removeToken()
resolve()
}).catch(error => {
reject(error)
})
// }).catch(error => {
// reject(error)
// })
})
}
}
})
export default useUserStore
import { parseTime } from './ruoyi'
export * from './jsencrypt.js'
/**
* 表格时间格式化
......
......@@ -87,7 +87,7 @@ service.interceptors.response.use(res => {
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false;
useUserStore().logOut().then(() => {
location.href = '/index';
location.href = '#/index';
})
}).catch(() => {
isRelogin.show = false;
......
差异被折叠。
......@@ -17,7 +17,7 @@ export default defineConfig(({ mode, command }) => {
},
// vite 相关配置
server: {
port: 80,
port: 8080,
host: true,
open: true,
proxy: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论