fix:项目初始化
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-05-16 10:46:46
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2022-03-31 17:22:51
|
||||
*/
|
||||
const getters = {
|
||||
|
||||
getSystemConfig: state => state.system.config, // 系统配置
|
||||
|
||||
// getTopicList: state => state.recommend.TopicList, // 获取专题列表数据
|
||||
// getTopicSelectList: state => state.recommend.TopicSelectList, // 获取专题列表数据
|
||||
// getHomeTopicSelectList: state => state.recommend.HomeTopicSelectList, // 获取首页专题列表
|
||||
// getVcrightSelectList: state => state.vipCard.VcrightSelectList, // 获取权益管理列表
|
||||
// getCardPosition: state => state.vipCard.cardPosition, // 卡片位置列表
|
||||
// getCouponEnabled: state => state.vipCard.CouponEnabled, // 优惠卷列表
|
||||
|
||||
// getProductData: state => state.activity.productData, // 商品数据
|
||||
// getproductList: state => state.activity.productList, // 遍历后存储的商品列表
|
||||
|
||||
getSeachParam: state => state.videoManagement.seachParam, // 视频列表搜索缓存
|
||||
getMediacatList: state => state.videoManagement.MediacatList, // 专栏管理时使用分类
|
||||
getMediacolumnList: state => state.videoManagement.MediacolumnList, // 编辑视频列表时使用专栏
|
||||
getCategoryList: state => state.videoManagement.CategoryList, // 图文管理使用图文分类管理列表
|
||||
getBloggerList: state => state.videoManagement.BloggerList, // 图文管理使用的博主列表
|
||||
|
||||
getActressList: state => state.videoManagement.ActressList, // 写真列表使用的演员列表
|
||||
getPhotocategoryList: state => state.photoManagement.PhotocategoryList, // 写真列表使用的写真分类列表
|
||||
|
||||
getVcrightList: state => state.vipCard.VcrightList, // 卡片管理使用的会员卡权益列表
|
||||
getGiftbagList:state=>state.vipCard.giftbagList,
|
||||
|
||||
getTopicList: state => state.videoManagement.TopicList, // 获取推荐理由
|
||||
|
||||
getCityList: state => state.loufeng.cityList, // 获取城市列表
|
||||
getCircleCategoryList: state => state.circleManagement.circleCategoryList, // 获取圈子分类
|
||||
getOverAllCatalog: state => state.other.overAllCatalog, // 总览列表使用 总览分类
|
||||
sidebar: state => state.app.sidebar,
|
||||
device: state => state.app.device,
|
||||
visitedViews: state => state.tagsView.visitedViews,
|
||||
token: state => state.user.token,
|
||||
avatar: state => state.user.avatar,
|
||||
roleId: state => state.user.roleId,
|
||||
name: state => state.user.name,
|
||||
getCreator: state => state.user.account,
|
||||
roles: state => state.user.roles,
|
||||
permission_routes: state => state.permission.routes,
|
||||
permission_serviceRoutes: state => state.permission.addRoutes,
|
||||
|
||||
comicsCategoryList:state=>state.comics.comicsCategoryList,//漫画分类
|
||||
comicsTopicList:state=> state.comics.comicsTopicList,//漫画主题
|
||||
comicsTagList:state=>state.comics.comicsTagList,//漫画标签
|
||||
|
||||
|
||||
roleList: state => state.account.roleList
|
||||
}
|
||||
export default getters
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import getters from './getters'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
||||
const modulesFiles = require.context('./modules', true, /\.js$/)
|
||||
|
||||
// you do not need `import app from './modules/app'`
|
||||
// it will auto require all vuex module from modules file
|
||||
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
|
||||
// set './app.js' => 'app'
|
||||
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
|
||||
const value = modulesFiles(modulePath)
|
||||
modules[moduleName] = value.default
|
||||
return modules
|
||||
}, {})
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules,
|
||||
getters
|
||||
})
|
||||
|
||||
export default store
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-10-06 20:37:34
|
||||
* @LastEditors: 江涛
|
||||
* @LastEditTime: 2021-03-03 21:10:30
|
||||
*/
|
||||
const state = {
|
||||
roleList: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_ROLELIST: (state, roleList) => {
|
||||
state.roleList = roleList
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setRoleList: ({ commit }, roleList) => {
|
||||
commit('SET_ROLELIST', roleList)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2021-01-13 18:57:53
|
||||
* @LastEditors: 王涛
|
||||
* @LastEditTime: 2021-01-13 19:13:19
|
||||
*/
|
||||
const state = {
|
||||
productList: [],
|
||||
productData: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_PRODUCTLIST: (state, productList) => {
|
||||
state.productList = productList
|
||||
},
|
||||
SET_PRODUCTDATA: (state, productData) => {
|
||||
state.productData = productData
|
||||
}
|
||||
|
||||
}
|
||||
const actions = {
|
||||
setProductList: ({ commit }, productList) => {
|
||||
commit('SET_PRODUCTDATA', productList)
|
||||
const list = []
|
||||
productList.forEach(item => {
|
||||
list.push({ label: item.name, value: item.id })
|
||||
})
|
||||
commit('SET_PRODUCTLIST', list)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-05-16 10:46:46
|
||||
* @LastEditors: 王涛
|
||||
* @LastEditTime: 2020-10-08 11:09:12
|
||||
*/
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const state = {
|
||||
sidebar: {
|
||||
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
||||
withoutAnimation: false
|
||||
},
|
||||
device: 'desktop'
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
TOGGLE_SIDEBAR: state => {
|
||||
state.sidebar.opened = !state.sidebar.opened
|
||||
state.sidebar.withoutAnimation = false
|
||||
if (state.sidebar.opened) {
|
||||
Cookies.set('sidebarStatus', 1)
|
||||
} else {
|
||||
Cookies.set('sidebarStatus', 0)
|
||||
}
|
||||
},
|
||||
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
||||
Cookies.set('sidebarStatus', 0)
|
||||
state.sidebar.opened = false
|
||||
state.sidebar.withoutAnimation = withoutAnimation
|
||||
},
|
||||
TOGGLE_DEVICE: (state, device) => {
|
||||
state.device = device
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
toggleSideBar({ commit }) {
|
||||
commit('TOGGLE_SIDEBAR')
|
||||
},
|
||||
closeSideBar({ commit }, { withoutAnimation }) {
|
||||
commit('CLOSE_SIDEBAR', withoutAnimation)
|
||||
},
|
||||
toggleDevice({ commit }, device) {
|
||||
commit('TOGGLE_DEVICE', device)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @Author:
|
||||
* @Mail:
|
||||
* @Date: 2021-12-02 23:29:29
|
||||
* @LastEditTime: 2022-05-27 19:44:45
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @FilePath: /web_admin/src/store/modules/circleManagement.js
|
||||
*/
|
||||
const state = {
|
||||
circleCategoryList: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_CIRCLECATEGORYLIST: (state, list) => {
|
||||
state.circleCategoryList = list
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setCircleCategoryList: ({ commit }, list) => {
|
||||
commit('SET_CIRCLECATEGORYLIST', list)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @Author:
|
||||
* @Mail:
|
||||
* @Date: 2022-03-12 15:47:14
|
||||
* @LastEditTime: 2022-03-12 16:46:03
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @FilePath: /comics-admin/src/store/modules/comics.js
|
||||
*/
|
||||
const state = {
|
||||
comicsCategoryList: [],
|
||||
comicsTopicList:[],
|
||||
comicsTagList:[]
|
||||
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_COMICSCATEGORYLIST: (state, param) => {
|
||||
state.comicsCategoryList = param
|
||||
},
|
||||
SET_COMICSTOPICLIST: (state, param) => {
|
||||
state.comicsTopicList = param
|
||||
},
|
||||
SET_COMICSTAGLIST: (state, param) => {
|
||||
state.comicsTagList = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setComicsCategoryList: ({ commit }, param) => {
|
||||
commit('SET_COMICSCATEGORYLIST', param)
|
||||
},
|
||||
setComicsTopicList:({ commit }, param) => {
|
||||
commit('SET_COMICSTOPICLIST', param)
|
||||
},
|
||||
setComicsTagList:({ commit }, param) => {
|
||||
commit('SET_COMICSTAGLIST', param)
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-11-20 16:46:17
|
||||
* @LastEditors: 王涛
|
||||
* @LastEditTime: 2020-11-20 16:47:50
|
||||
*/
|
||||
const state = {
|
||||
cityList: []
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_CITYLIST: (state, param) => {
|
||||
state.cityList = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setCityList: ({ commit }, param) => {
|
||||
commit('SET_CITYLIST', param)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @Author:
|
||||
* @Mail:
|
||||
* @Date: 2022-03-12 15:47:14
|
||||
* @LastEditTime: 2022-03-12 16:46:03
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @FilePath: /novels-admin/src/store/modules/novels.js
|
||||
*/
|
||||
const state = {
|
||||
novelsCategoryList: [],
|
||||
novelsTopicList:[],
|
||||
novelsTagList:[]
|
||||
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_NOVELSCATEGORYLIST: (state, param) => {
|
||||
state.novelsCategoryList = param
|
||||
},
|
||||
SET_NOVELSTOPICLIST: (state, param) => {
|
||||
state.novelsTopicList = param
|
||||
},
|
||||
SET_NOVELSTAGLIST: (state, param) => {
|
||||
state.novelsTagList = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setNovelsCategoryList: ({ commit }, param) => {
|
||||
commit('SET_NOVELSCATEGORYLIST', param)
|
||||
},
|
||||
setNovelsTopicList:({ commit }, param) => {
|
||||
commit('SET_NOVELSTOPICLIST', param)
|
||||
},
|
||||
setNovelsTagList:({ commit }, param) => {
|
||||
commit('SET_NOVELSTAGLIST', param)
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @Author:
|
||||
* @Mail:
|
||||
* @Date: 2021-12-21 15:13:20
|
||||
* @LastEditTime: 2021-12-21 15:14:45
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @FilePath: /web_admin/src/store/modules/other.js
|
||||
*/
|
||||
const state = {
|
||||
overAllCatalog: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_OVERALLCATALOG: (state, list) => {
|
||||
state.overAllCatalog = list
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setOverAllCatalog: ({ commit }, list) => {
|
||||
commit('SET_OVERALLCATALOG', list)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
Executable
+157
@@ -0,0 +1,157 @@
|
||||
// import { getRoleMenuList } from '@/api/account/role'
|
||||
import {
|
||||
getAuth
|
||||
} from '@/api/account/roleList'
|
||||
import {
|
||||
constantRoutes
|
||||
} from '@/router'
|
||||
import {
|
||||
getRoleId
|
||||
} from '@/utils/auth' // get roleId from cookie
|
||||
import {
|
||||
assemblyRoute
|
||||
} from '@/utils/serviceRoute'
|
||||
// import { reject } from 'q'
|
||||
|
||||
import {
|
||||
serverRouter, filterRouts
|
||||
} from '@/utils/roleTreeList'
|
||||
import { getFilterRoutes } from '@/utils/get-page-title'
|
||||
|
||||
/**
|
||||
* Use meta.role to determine if the current user has permission
|
||||
* @param roles
|
||||
* @param route
|
||||
*/
|
||||
function hasPermission (roles, route) {
|
||||
if (route.meta && route.meta.roles) {
|
||||
return roles.some(role => route.meta.roles.includes(role))
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 组装路由
|
||||
* @param {Obejct} params
|
||||
*/
|
||||
function assemblyRouteList (params) {
|
||||
const router = []
|
||||
params.forEach(e => {
|
||||
if (assemblyRoute(e.name)) {
|
||||
let e_new = {
|
||||
path: e.path,
|
||||
name: e.name,
|
||||
meta: {
|
||||
...e.meta,
|
||||
...{
|
||||
apiArr: e.api_url || []
|
||||
}
|
||||
},
|
||||
component: assemblyRoute(e.name)
|
||||
}
|
||||
if (e.children && e.children.length > 0) {
|
||||
e_new = Object.assign({}, e_new, {
|
||||
children: assemblyRouteList(e.children)
|
||||
})
|
||||
}
|
||||
if (e.redirect) {
|
||||
e_new = Object.assign({}, e_new, {
|
||||
redirect: e.redirect
|
||||
})
|
||||
}
|
||||
if (e.alwaysShow) {
|
||||
e_new = Object.assign({}, e_new, {
|
||||
alwaysShow: e.alwaysShow
|
||||
})
|
||||
}
|
||||
if (e.hidden) {
|
||||
e_new = Object.assign({}, e_new, {
|
||||
hidden: true
|
||||
})
|
||||
}
|
||||
router.push(e_new)
|
||||
}
|
||||
})
|
||||
return router
|
||||
}
|
||||
/**
|
||||
* Filter asynchronous routing tables by recursion
|
||||
* @param routes asyncRoutes
|
||||
* @param roles
|
||||
*/
|
||||
export function filterAsyncRoutes (routes, roles) {
|
||||
const res = []
|
||||
routes.forEach(route => {
|
||||
const tmp = {
|
||||
...route
|
||||
}
|
||||
if (hasPermission(roles, tmp)) {
|
||||
if (tmp.children) {
|
||||
tmp.children = filterAsyncRoutes(tmp.children, roles)
|
||||
}
|
||||
res.push(tmp)
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
const state = {
|
||||
routes: [],
|
||||
addRoutes: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_ROUTES: (state, routes) => {
|
||||
// console.log('原有路由:')
|
||||
// console.log(constantRoutes)
|
||||
// console.log('服务端路由:')
|
||||
// console.log(routes)
|
||||
state.addRoutes = routes
|
||||
state.routes = constantRoutes.concat(routes)
|
||||
// console.log('正式路由:')
|
||||
// console.log(state.routes)
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
resetRouter ({ commit }) {
|
||||
commit('SET_ROUTES', [])
|
||||
},
|
||||
generateRoutes ({ commit }, { next, NProgress }) {
|
||||
return new Promise(resolve => {
|
||||
// const a = assemblyRouteList(serverRouter)
|
||||
// console.log(a)
|
||||
// a.push({
|
||||
// path: '*',
|
||||
// redirect: '/404',
|
||||
// hidden: true
|
||||
// })
|
||||
// const newFilterRouts = getFilterRoutes(a, filterRouts)
|
||||
// console.log(newFilterRouts)
|
||||
|
||||
// commit('SET_ROUTES', newFilterRouts)
|
||||
// // commit('SET_ROUTES', a)
|
||||
// resolve(newFilterRouts)
|
||||
const r = parseInt(getRoleId())
|
||||
getAuth({ id: r }).then(res => {
|
||||
//
|
||||
// 组装路由 res 是我服务端存的动态路由表,
|
||||
// 经过这个方法 这个方法组件导入进去,然后设置SET_ROUTES 就生成了导航
|
||||
const a = assemblyRouteList(res.data.router)
|
||||
a.push({
|
||||
path: '*',
|
||||
redirect: '/404',
|
||||
hidden: true
|
||||
})
|
||||
const newFilterRouts = getFilterRoutes(a, filterRouts)
|
||||
commit('SET_ROUTES', newFilterRouts)
|
||||
resolve(newFilterRouts)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2021-01-12 11:17:45
|
||||
* @LastEditors: 江涛
|
||||
* @LastEditTime: 2021-03-24 22:15:24
|
||||
*/
|
||||
const state = {
|
||||
PhotocategoryList: []
|
||||
}
|
||||
const mutations = {
|
||||
|
||||
SET_PHOTOCATEGORYLIST: (state, param) => {
|
||||
state.PhotocategoryList = param
|
||||
},
|
||||
SET_BLOGGERLIST: (state, param) => {
|
||||
state.BloggerList = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setPhotocategoryList: ({ commit }, param) => {
|
||||
commit('SET_PHOTOCATEGORYLIST', param)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
import variables from '@/styles/element-variables.scss'
|
||||
import defaultSettings from '@/settings'
|
||||
|
||||
const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings
|
||||
|
||||
const state = {
|
||||
theme: variables.theme,
|
||||
showSettings: showSettings,
|
||||
tagsView: tagsView,
|
||||
fixedHeader: fixedHeader,
|
||||
sidebarLogo: sidebarLogo
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
CHANGE_SETTING: (state, { key, value }) => {
|
||||
if (state.hasOwnProperty(key)) {
|
||||
state[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
changeSetting({ commit }, data) {
|
||||
commit('CHANGE_SETTING', data)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-10-10 14:27:58
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2022-03-14 15:29:54
|
||||
*/
|
||||
const state = {
|
||||
config: {
|
||||
payGuidPageUrl: undefined, // 支付引导页面地址
|
||||
|
||||
appApi: undefined, // API域名
|
||||
cdns: undefined, // CDN节点
|
||||
coinPrice: undefined, // 金币单价,单位分
|
||||
driverGroup: undefined, // 开车群
|
||||
headerM3U8: undefined, // 片头m3u8
|
||||
id: 0,
|
||||
webImgReq: 'http://resourceyuan.bbaazz.me/', // 图片请求域名(web使用)
|
||||
imgReq: undefined, // 图片请求域名(app使用)
|
||||
imgUpload: undefined, // 图片上传地址
|
||||
inviteAddr: undefined, // 用户邀请地址
|
||||
officialEmail: undefined, // 官方邮箱
|
||||
potatoContact: undefined, // Potato联系方式
|
||||
telegramContact: undefined, // Telegram联系方式
|
||||
videoReq: undefined, // 视频请求地址
|
||||
videoUpload: undefined// 视频上传地址
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_CONFIG: (state, param) => {
|
||||
state.config = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setConfig: ({ commit }, param) => {
|
||||
commit('SET_CONFIG', param)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
const state = {
|
||||
visitedViews: [],
|
||||
cachedViews: ['SalesDetails', 'Mediavideo']
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
ADD_VISITED_VIEW: (state, view) => {
|
||||
if (state.visitedViews.some(v => v.path === view.path)) return
|
||||
state.visitedViews.push(
|
||||
Object.assign({}, view, {
|
||||
title: view.meta.title || 'no-name'
|
||||
})
|
||||
)
|
||||
},
|
||||
|
||||
DEL_VISITED_VIEW: (state, view) => {
|
||||
for (const [i, v] of state.visitedViews.entries()) {
|
||||
if (v.path === view.path) {
|
||||
state.visitedViews.splice(i, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
DEL_OTHERS_VISITED_VIEWS: (state, view) => {
|
||||
state.visitedViews = state.visitedViews.filter(v => {
|
||||
return v.meta.affix || v.path === view.path
|
||||
})
|
||||
},
|
||||
|
||||
DEL_ALL_VISITED_VIEWS: state => {
|
||||
// keep affix tags
|
||||
const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
|
||||
state.visitedViews = affixTags
|
||||
},
|
||||
|
||||
UPDATE_VISITED_VIEW: (state, view) => {
|
||||
for (let v of state.visitedViews) {
|
||||
if (v.path === view.path) {
|
||||
v = Object.assign(v, view)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
addView({ dispatch }, view) {
|
||||
dispatch('addVisitedView', view)
|
||||
},
|
||||
addVisitedView({ commit }, view) {
|
||||
commit('ADD_VISITED_VIEW', view)
|
||||
},
|
||||
|
||||
delView({ dispatch, state }, view) {
|
||||
return new Promise(resolve => {
|
||||
dispatch('delVisitedView', view)
|
||||
resolve({
|
||||
visitedViews: [...state.visitedViews],
|
||||
cachedViews: [...state.cachedViews]
|
||||
})
|
||||
})
|
||||
},
|
||||
delVisitedView({ commit, state }, view) {
|
||||
return new Promise(resolve => {
|
||||
commit('DEL_VISITED_VIEW', view)
|
||||
resolve([...state.visitedViews])
|
||||
})
|
||||
},
|
||||
|
||||
delOthersViews({ dispatch, state }, view) {
|
||||
return new Promise(resolve => {
|
||||
dispatch('delOthersVisitedViews', view)
|
||||
resolve({
|
||||
visitedViews: [...state.visitedViews],
|
||||
cachedViews: [...state.cachedViews]
|
||||
})
|
||||
})
|
||||
},
|
||||
delOthersVisitedViews({ commit, state }, view) {
|
||||
return new Promise(resolve => {
|
||||
commit('DEL_OTHERS_VISITED_VIEWS', view)
|
||||
resolve([...state.visitedViews])
|
||||
})
|
||||
},
|
||||
delAllViews({ dispatch, state }, view) {
|
||||
return new Promise(resolve => {
|
||||
dispatch('delAllVisitedViews', view)
|
||||
resolve({
|
||||
visitedViews: [...state.visitedViews],
|
||||
cachedViews: [...state.cachedViews]
|
||||
})
|
||||
})
|
||||
},
|
||||
delAllVisitedViews({ commit, state }) {
|
||||
return new Promise(resolve => {
|
||||
commit('DEL_ALL_VISITED_VIEWS')
|
||||
resolve([...state.visitedViews])
|
||||
})
|
||||
},
|
||||
updateVisitedView({ commit }, view) {
|
||||
commit('UPDATE_VISITED_VIEW', view)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
import {
|
||||
getToken,
|
||||
setToken,
|
||||
setRoleId,
|
||||
getRoleId,
|
||||
getAccount,
|
||||
setAccount
|
||||
} from '@/utils/auth'
|
||||
import router, {
|
||||
resetRouter
|
||||
} from '@/router'
|
||||
const state = {
|
||||
token: getToken(),
|
||||
roleId: parseInt(getRoleId()), // 权限的id
|
||||
account: getAccount(), // 账号
|
||||
accid: '', // 账号id
|
||||
// avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
||||
// avatar: '/assets/006APoFYly1g4jdw819xwg30dc0dcthr.gif',
|
||||
avatar: require('@/assets/logo.png'),
|
||||
roles: []
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_TOKEN: (state, token) => {
|
||||
setToken(token)
|
||||
state.token = token
|
||||
},
|
||||
SET_ROLEID: (state, roleId) => {
|
||||
setRoleId(roleId)
|
||||
state.roleId = roleId
|
||||
},
|
||||
SET_ACCOUNT: (state, account) => {
|
||||
setAccount(account)
|
||||
state.account = account
|
||||
},
|
||||
SET_ACCID: (state, accid) => {
|
||||
state.accid = accid
|
||||
},
|
||||
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const actions = {
|
||||
login({ commit }, response) {
|
||||
commit('SET_TOKEN', response.token)
|
||||
commit('SET_ROLEID', response.roleId)
|
||||
commit('SET_ACCID', response.accId)
|
||||
commit('SET_ACCOUNT', response.acc)
|
||||
},
|
||||
|
||||
// 登出
|
||||
logout({ commit, dispatch }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLEID', '')
|
||||
commit('SET_ACCOUNT', '')
|
||||
|
||||
commit('SET_ROLES', [])
|
||||
dispatch('permission/resetRouter', null, { root: true })
|
||||
dispatch('tagsView/delAllViews', null, { root: true })
|
||||
|
||||
resetRouter()
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
// remove token
|
||||
resetToken({ commit, dispatch }) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLEID', '')
|
||||
commit('SET_ACCOUNT', '')
|
||||
|
||||
commit('SET_ROLES', [])
|
||||
dispatch('permission/resetRouter', null, {
|
||||
root: true
|
||||
})
|
||||
|
||||
resetRouter()
|
||||
dispatch('tagsView/delAllViews', null, {
|
||||
root: true
|
||||
})
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
// dynamically modify permissions
|
||||
changeRoles({ commit, dispatch }, role) {
|
||||
return new Promise(async resolve => {
|
||||
const token = role + '-token'
|
||||
commit('SET_TOKEN', token)
|
||||
setToken(token)
|
||||
|
||||
const {
|
||||
roles
|
||||
} = await dispatch('getInfo')
|
||||
resetRouter()
|
||||
// generate accessible routes map based on roles
|
||||
const accessRoutes = await dispatch('permission/generateRoutes', roles, {
|
||||
root: true
|
||||
})
|
||||
// dynamically add accessible routes
|
||||
router.addRoutes(accessRoutes)
|
||||
// reset visited views and cached views
|
||||
dispatch('tagsView/delAllViews', null, {
|
||||
root: true
|
||||
})
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2021-01-12 11:17:45
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2022-01-26 13:50:16
|
||||
*/
|
||||
const state = {
|
||||
seachParam: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
param: {
|
||||
actors: undefined, // [],演员
|
||||
bango: undefined, // "string",番号
|
||||
columns: undefined, // 0,专栏
|
||||
country: undefined, // "string",国家
|
||||
end: undefined, // "string",结束时间
|
||||
fileId: undefined, // "string",媒资库ID
|
||||
firstTag: undefined, // "string",一级标签
|
||||
id: undefined, // 0,视频Id
|
||||
priceType: undefined, // 0,收费状态
|
||||
publish: undefined, // "string",视频发布者
|
||||
secondTags: undefined, // "string",二级标签标签
|
||||
start: undefined, // "string",开始时间
|
||||
status: undefined, // 0,视频状态
|
||||
studio: undefined, // "string",工作室/所有者
|
||||
timeRange: undefined, // "string",媒体状态 operatAt(编辑时间)/addedTime(上架时间)/createdAt(创建时间)/updatedAt(更新时间)
|
||||
title: undefined, // "string",标题
|
||||
type: undefined // "string"长视频/短视频
|
||||
}
|
||||
},
|
||||
MediacatList: [],
|
||||
MediacolumnList: [],
|
||||
CategoryList: [],
|
||||
ActressList: [],
|
||||
BloggerList: [],
|
||||
TopicList: []
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_SEACHPARAM: (state, param) => {
|
||||
state.seachParam = param
|
||||
},
|
||||
SET_MEDIACATLIST: (state, param) => {
|
||||
state.MediacatList = param
|
||||
},
|
||||
SET_MEDIACOLUMNLIST: (state, param) => {
|
||||
state.MediacolumnList = param
|
||||
},
|
||||
SET_CATEGORYLIST: (state, param) => {
|
||||
state.CategoryList = param
|
||||
},
|
||||
SET_ACTRESSLIST: (state, param) => {
|
||||
state.ActressList = param
|
||||
},
|
||||
SET_BLOGGERLIST: (state, param) => {
|
||||
state.BloggerList = param
|
||||
},
|
||||
SET_TOPICLIST: (state, param) => {
|
||||
state.TopicList = param
|
||||
}
|
||||
}
|
||||
const actions = {
|
||||
setSeachParam: ({ commit }, param) => {
|
||||
commit('SET_SEACHPARAM', param)
|
||||
},
|
||||
setMediacatList: ({ commit }, param) => {
|
||||
commit('SET_MEDIACATLIST', param)
|
||||
},
|
||||
setMediacolumnList: ({ commit }, param) => {
|
||||
commit('SET_MEDIACOLUMNLIST', param)
|
||||
},
|
||||
setCategoryList: ({ commit }, param) => {
|
||||
commit('SET_CATEGORYLIST', param)
|
||||
},
|
||||
setActressList: ({ commit }, param) => {
|
||||
commit('SET_ACTRESSLIST', param)
|
||||
},
|
||||
setBloggerList: ({ commit }, param) => {
|
||||
commit('SET_BLOGGERLIST', param)
|
||||
},
|
||||
setTopicList: ({ commit }, param) => {
|
||||
commit('SET_TOPICLIST', param)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* @Author: 王涛
|
||||
* @Mail: no
|
||||
* @Date: 2020-10-10 14:27:58
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2022-03-31 17:20:01
|
||||
*/
|
||||
const state = {
|
||||
VcrightList: [],
|
||||
giftbagList: []
|
||||
|
||||
}
|
||||
const mutations = {
|
||||
SET_VCRIGHTLIST: (state, param) => {
|
||||
state.VcrightList = param
|
||||
},
|
||||
SET_GIFTBAGLIST: (state, param) => {
|
||||
state.giftbagList = param
|
||||
}
|
||||
|
||||
}
|
||||
const actions = {
|
||||
setVcrightList: ({ commit }, param) => {
|
||||
commit('SET_VCRIGHTLIST', param)
|
||||
},
|
||||
setGiftbagList: ({ commit }, param) => {
|
||||
commit('SET_GIFTBAGLIST', param)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user