Commit e5f58745 by suwenbiao

初始化

parents
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# v3test
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "v3test",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^1.6.0",
"element-plus": "^2.4.1",
"vue": "^3.2.13",
"vue-class-component": "^8.0.0-0",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"typescript": "~4.5.5"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<router-view/>
</template>
<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
height: 100vh;
overflow: hidden;
}
*{
margin: 0;
padding:0;
}
</style>
import request from './request.js'
//账号密码登录
function login(data) {
return request('/assistive/login', "GET", data)
}
export default {
login,
}
\ No newline at end of file
import axios from 'axios'
// const baseUrl = 'http://oc-am-api.finezb.com';
const baseUrl = process.env.VUE_APP_BASE_URL;
// const baseUrl = 'http://192.168.3.156:8873';
const request = (url, method, data) => {
var header = {
"Token": sessionStorage.getItem('u_token'),
}
return new Promise((resolve, reject) => {
if (method === 'GET') {
axios({
headers: header,
method: method,
url: baseUrl + url,
params: data
}).then(res => {
if (res.data.code === 200) {
resolve(res);
} else {
resolve(res);
}
})
.catch(err => {
reject(err); //失败
});
} else if (method === 'POST') {
axios({
headers: header,
method: method,
url: baseUrl + url,
data: data
}).then(res => {
if (res.data.code === 200) {
resolve(res);
} else {
resolve(res);
}
})
.catch(err => {
reject(err); //失败
});
}
})
}
export default request
\ No newline at end of file
<template>
<div class="hello">
<div>欢迎登录欧畅云技术支持平台</div>
</div>
</template>
<script lang="ts">
</script>
<style scoped lang="scss">
.hello>div:nth-child(1){
font-size: 50px;
}
</style>
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import store from './store'
const app = createApp(App)
app.use(store)
app.use(router)
app.use(ElementPlus)
app.mount('#app')
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import { getUrlKey } from '@/utils/utils'
import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/register', 'authRedirect'] // no redirect whitelist
const whiteLike = '/subLogin' // 白名单模糊匹配
router.beforeEach(async(to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle(to.meta.title)
// determine whether the user has logged in
const hasToken = getToken()
// console.log(to.path)
if (getUrlKey('token')) {
await store.dispatch('user/occloudLogin', getUrlKey('token'))
}
if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the dashboard page
next({ path: '/' })
NProgress.done()
} else {
// const hasGetUserInfo = store.getters.name
const accountId = store.getters.accountId
// console.log(accountId)
// const hasRoles = store.getters.roles && store.getters.roles.length > 0
if (accountId) {
next()
} else {
try {
// get user info
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
// const { roles } = await store.dispatch('user/getInfo')
const res = await store.dispatch('user/getInfo')
const roles = res.menuList
// generate accessible routes map based on roles
const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
// dynamically add accessible routes
router.addRoutes(accessRoutes)
// hack method to ensure that addRoutes is complete
// set the replace: true, so the navigation will not leave a history record
next({ ...to, replace: true })
// next()
} catch (error) {
// remove token and go to login page to re-login
await store.dispatch('user/resetToken')
Message.error(error || 'Has Error')
next(`/login?redirect=${to.path}`)
NProgress.done()
}
}
}
} else {
/* has no token*/
// 解析子域名登录
if (whiteList.indexOf(to.path) !== -1 || to.path.includes(whiteLike)) {
// in the free login whitelist, go directly
next()
} else {
// other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.path}`)
NProgress.done()
}
}
})
router.afterEach(() => {
// finish progress bar
NProgress.done()
})
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import axios from 'axios'
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
// router.beforeEach((to, from, next) => {
// if (sessionStorage.getItem('u_token')) {
// next()
// } else {
// if (to.name == 'login') {
// next()
// }
// else {
// var alink = to.path.slice(1, 9999).split('/')
// var isHaveKey = /[0-9A-Z]/.test(alink[0])
// var key = alink[0]
// var token = alink[1]
// if (isHaveKey && token) {
// axios({
// headers: {
// "Token": token
// },
// method: 'GET',
// url: process.env.VUE_APP_BASE_URL + '/assistive/getPermission',
// params: { key, token }
// }).then(res => {
// if (res.data.code == 200) {
// sessionStorage.setItem('u_token', res.data.data.token)
// sessionStorage.setItem('u_name', res.data.data.nickname)
// sessionStorage.setItem('u_headUrl', res.data.data.headUrl)
// } else {
// next({ path: `/login/${key}` })
// }
// })
// }else if(isHaveKey && !token){
// next({ path: `/login/${key}` })
// }else{
// next({ name:'login' })
// }
// }
// }
// })
export default router
/* eslint-disable */
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
import { createStore } from 'vuex'
export default createStore({
state: {
},
getters: {
},
mutations: {
},
actions: {
},
modules: {
}
})
<template>
<div class="about">
</div>
</template>
<template>
<el-row class="tac">
<el-menu
active-text-color="#ffd04b"
background-color="#545c64"
default-active="0"
text-color="#fff"
style="width:220px;"
>
<div style="height:50xp;line-height:50px;">
<img style="width:32px;height:32px;vertical-align:middle;margin-right:10px;" src="../assets/logo.png" alt="">
<span style="font-size: 18px;font-weight:bold;color:#fff;position: relative;top:3px;">欧畅云技术支持</span>
</div>
<el-menu-item index="0">
<el-icon><HomeFilled /></el-icon>
<span style="font-size: 16px;">首页</span>
</el-menu-item>
<el-menu-item index="1">
<el-icon><Promotion /></el-icon>
<span style="font-size: 16px;">主播端打包</span>
</el-menu-item>
<el-menu-item index="2">
<el-icon><Tools /></el-icon>
<span style="font-size: 16px;">直播间推流</span>
</el-menu-item>
<el-menu-item index="3">
<el-icon><Tools /></el-icon>
<span style="font-size: 16px;">员工账号</span>
</el-menu-item>
</el-menu>
<welcome></welcome>
</el-row>
</template>
<script lang="ts" setup>
import {
Promotion,
HomeFilled,
Tools,
} from '@element-plus/icons-vue'
import welcome from '../components/welcome.vue'
comments:{
welcome
}
const handleOpen = (key: string, keyPath: string[]) => {
console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
console.log(key, keyPath)
}
</script>
<style>
.tac{
height: 100%;
}
</style>
\ No newline at end of file
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment