mirror of https://github.com/veypi/OneAuth.git
parent
bcbfc0380a
commit
aae799c7fa
@ -1,3 +0,0 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
@ -1,5 +0,0 @@
|
||||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
@ -1 +0,0 @@
|
||||
src/libs/wwLogin.js
|
@ -1,23 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/essential',
|
||||
'@vue/standard',
|
||||
'@vue/typescript/recommended'
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020
|
||||
},
|
||||
rules: {
|
||||
'object-curly-spacing': 0,
|
||||
'space-before-function-paren': 0,
|
||||
'@typescript-eslint/camelcase': 0,
|
||||
'@typescript-eslint/no-empty-function': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
.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?
|
@ -1,24 +0,0 @@
|
||||
# oaf
|
||||
|
||||
## Project setup
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
yarn serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "oaf",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@veypi/one-icon": "^1.0.1",
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.6.5",
|
||||
"js-base64": "^3.6.0",
|
||||
"vue": "^2.6.11",
|
||||
"vue-class-component": "^7.2.3",
|
||||
"vue-m-message": "^3.1.0",
|
||||
"vue-property-decorator": "^9.1.2",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuetify": "^2.4.0",
|
||||
"vuex": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^2.33.0",
|
||||
"@typescript-eslint/parser": "^2.33.0",
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-plugin-typescript": "~4.5.0",
|
||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@vue/eslint-config-standard": "^5.1.2",
|
||||
"@vue/eslint-config-typescript": "^5.0.2",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.0",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"less": "^3.0.4",
|
||||
"less-loader": "^5.0.0",
|
||||
"sass": "^1.32.0",
|
||||
"sass-loader": "^10.0.0",
|
||||
"typescript": "~3.9.3",
|
||||
"vue-cli-plugin-vuetify": "^2.2.2",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"vuetify-loader": "^1.7.0"
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
File diff suppressed because one or more lines are too long
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<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>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
|
||||
</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>
|
@ -1,63 +0,0 @@
|
||||
<template>
|
||||
<v-app @mousewheel.native.prevent="">
|
||||
<v-app-bar
|
||||
app
|
||||
color="primary"
|
||||
dark
|
||||
>
|
||||
<div class="d-flex align-center">
|
||||
<one-icon style="color: aqua;font-size: 56px">glassdoor</one-icon>
|
||||
<span class="font-italic font-weight-bold" style="font-size: 20px">统一认证</span>
|
||||
</div>
|
||||
<v-spacer></v-spacer>
|
||||
</v-app-bar>
|
||||
|
||||
<v-main>
|
||||
<router-view></router-view>
|
||||
</v-main>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import util from '@/libs/util'
|
||||
|
||||
export default Vue.extend({
|
||||
name: 'App',
|
||||
|
||||
components: {},
|
||||
|
||||
data: () => ({
|
||||
//
|
||||
}),
|
||||
|
||||
beforeCreate() {
|
||||
util.title('统一认证')
|
||||
this.$store.dispatch('fetchSelf')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import './assets/common';
|
||||
|
||||
html,
|
||||
body {
|
||||
.full_size;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#app {
|
||||
.full_size;
|
||||
//.none_select;
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
display: none; /* Chrome Safari */
|
||||
}
|
||||
</style>
|
@ -1,65 +0,0 @@
|
||||
import axios from 'axios'
|
||||
import store from '@/store'
|
||||
|
||||
function baseRequests(url: string, method: any = 'GET', query: any, data: any, success: any, fail?: Function) {
|
||||
return axios({
|
||||
url: url,
|
||||
params: query,
|
||||
data: data,
|
||||
method: method,
|
||||
headers: {
|
||||
auth_token: localStorage.auth_token
|
||||
}
|
||||
})
|
||||
.then((res: any) => {
|
||||
if ('auth_token' in res.headers) {
|
||||
localStorage.auth_token = res.headers.auth_token
|
||||
}
|
||||
if (method === 'HEAD') {
|
||||
success(res.headers)
|
||||
} else {
|
||||
success(res.data)
|
||||
}
|
||||
})
|
||||
.catch((e: any) => {
|
||||
if (e.response && e.response.status === 401) {
|
||||
console.log(e)
|
||||
store.dispatch('handleLogout')
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
if (e.response && e.response.status === 500) {
|
||||
return
|
||||
}
|
||||
if (typeof fail === 'function') {
|
||||
fail(e.response)
|
||||
} else if (e.response && e.response.status === 400) {
|
||||
console.log(400)
|
||||
} else {
|
||||
console.log(e.request)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const ajax = {
|
||||
get(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'GET', data, {}, success, fail)
|
||||
},
|
||||
head(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'HEAD', data, {}, success, fail)
|
||||
},
|
||||
delete(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'DELETE', data, {}, success, fail)
|
||||
},
|
||||
post(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'POST', {}, data, success, fail)
|
||||
},
|
||||
put(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'PUT', {}, data, success, fail)
|
||||
},
|
||||
patch(url: '', data = {}, success = {}, fail?: Function) {
|
||||
return baseRequests(url, 'PATCH', {}, data, success, fail)
|
||||
}
|
||||
}
|
||||
|
||||
export default ajax
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 light <light@light-laptop>
|
||||
*
|
||||
* Distributed under terms of the MIT license.
|
||||
*/
|
||||
|
||||
import Vue from 'vue'
|
||||
import {Base64} from 'js-base64'
|
||||
import ajax from './ajax'
|
||||
import store from '@/store'
|
||||
|
||||
export type SuccessFunction<T> = (e: any) => void;
|
||||
export type FailedFunction<T> = (e: any) => void;
|
||||
|
||||
const Code = {
|
||||
42011: '无操作权限',
|
||||
22031: '资源不存在 或 您无权操作该资源'
|
||||
}
|
||||
|
||||
class Interface {
|
||||
private readonly method: Function
|
||||
private readonly api: string
|
||||
private readonly data: any
|
||||
|
||||
constructor(method: Function, api: string, data?: any) {
|
||||
this.method = method
|
||||
this.api = api
|
||||
this.data = data
|
||||
}
|
||||
|
||||
Start(success: SuccessFunction<any>, fail?: FailedFunction<any>) {
|
||||
const newFail = function (data: any) {
|
||||
if (data && data.code === 40001) {
|
||||
// no login
|
||||
store.dispatch('handleLogout')
|
||||
return
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
if (data && data.code > 0 && Code[data.code]) {
|
||||
}
|
||||
if (fail) {
|
||||
fail(data)
|
||||
}
|
||||
}
|
||||
|
||||
const newSuccess = function (data: any) {
|
||||
if (Number(data.status) === 1) {
|
||||
if (success) {
|
||||
success(data.content)
|
||||
}
|
||||
} else {
|
||||
newFail(data)
|
||||
if (data.code === 41001) {
|
||||
store.dispatch('handleLogout')
|
||||
// bus.$emit('log_out')
|
||||
}
|
||||
}
|
||||
}
|
||||
this.method(this.api, this.data, newSuccess, newFail)
|
||||
}
|
||||
}
|
||||
|
||||
const message = {
|
||||
count() {
|
||||
return new Interface(ajax.get, '/api/message/', {
|
||||
count: true,
|
||||
status: 'UnRead'
|
||||
})
|
||||
},
|
||||
get_content(id: number) {
|
||||
return new Interface(ajax.get, '/api/message/' + Number(id))
|
||||
},
|
||||
list(status: string) {
|
||||
return new Interface(ajax.get, '/api/message/', {status})
|
||||
},
|
||||
update(id: number, status: string) {
|
||||
return new Interface(ajax.patch, '/api/message/' + Number(id), {status})
|
||||
}
|
||||
}
|
||||
|
||||
const role = {
|
||||
local: '/api/role/',
|
||||
get(id: number) {
|
||||
return new Interface(ajax.get, this.local + id)
|
||||
},
|
||||
list() {
|
||||
return new Interface(ajax.get, this.local)
|
||||
},
|
||||
update(id: number, props: any) {
|
||||
return new Interface(ajax.patch, this.local + id, props)
|
||||
},
|
||||
create(props: any) {
|
||||
return new Interface(ajax.post, this.local, props)
|
||||
},
|
||||
del(id: number) {
|
||||
return new Interface(ajax.delete, this.local + id)
|
||||
},
|
||||
bind(id: number, aid: number) {
|
||||
return new Interface(ajax.get, this.local + id + '/bind/' + aid)
|
||||
},
|
||||
unbind(id: number, aid: number) {
|
||||
return new Interface(ajax.get, this.local + id + '/unbind/' + aid)
|
||||
}
|
||||
}
|
||||
|
||||
const app = {
|
||||
local: '/api/app/',
|
||||
self() {
|
||||
return new Interface(ajax.get, this.local, {is_self: true})
|
||||
},
|
||||
get(id: string) {
|
||||
return new Interface(ajax.get, this.local + id)
|
||||
},
|
||||
list() {
|
||||
return new Interface(ajax.get, this.local)
|
||||
}
|
||||
}
|
||||
|
||||
const user = {
|
||||
local: '/api/user/',
|
||||
register(username: string, password: string, uuid: string, prop?: any) {
|
||||
const data = Object.assign({
|
||||
username: username,
|
||||
uuid: uuid,
|
||||
password: Base64.encode(password)
|
||||
}, prop)
|
||||
return new Interface(ajax.post, this.local, data)
|
||||
},
|
||||
login(username: string, password: string, uuid: string) {
|
||||
return new Interface(ajax.head, this.local + username, {
|
||||
uid_type: 'username',
|
||||
uuid: uuid,
|
||||
password: Base64.encode(password)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const api = {
|
||||
role: role,
|
||||
app: app,
|
||||
user: user,
|
||||
admin: {
|
||||
auths() {
|
||||
return new Interface(ajax.get, '/api/auth/')
|
||||
},
|
||||
user: {
|
||||
create(props: any) {
|
||||
const p = Object.assign({}, props)
|
||||
p.password = Base64.encode(props.password)
|
||||
return new Interface(ajax.post, '/api/user/', p)
|
||||
},
|
||||
update(user_id: number, props: any) {
|
||||
return new Interface(ajax.patch, '/api/user/' + user_id, props)
|
||||
},
|
||||
enable(user_id: number) {
|
||||
return new Interface(ajax.patch, '/api/user/' + user_id, {
|
||||
status: 'ok'
|
||||
})
|
||||
},
|
||||
disable(user_id: number) {
|
||||
return new Interface(ajax.patch, '/api/user/' + user_id, {
|
||||
status: 'disabled'
|
||||
})
|
||||
},
|
||||
attach_role(user_id: number, props: any) {
|
||||
return new Interface(ajax.post, '/api/user/' + user_id + '/role/', props)
|
||||
},
|
||||
detach_role(user_id: number, id: any) {
|
||||
return new Interface(ajax.delete, '/api/user/' + user_id + '/role/' + id)
|
||||
},
|
||||
reset_pass(user_id: number, password: string) {
|
||||
return new Interface(ajax.patch, '/api/user/' + user_id, {password})
|
||||
}
|
||||
}
|
||||
},
|
||||
auth: {
|
||||
event() {
|
||||
return {
|
||||
local: '/api/user/event/',
|
||||
list() {
|
||||
return new Interface(ajax.get, this.local)
|
||||
},
|
||||
create(title: string, tag: string, start_date: any, end_date: any) {
|
||||
return new Interface(ajax.post, this.local, {title, tag, start_date, end_date})
|
||||
},
|
||||
del(id: number) {
|
||||
return new Interface(ajax.delete, this.local + id)
|
||||
}
|
||||
}
|
||||
},
|
||||
favorite(name: string, tag: string, ok: boolean) {
|
||||
if (ok) {
|
||||
return new Interface(ajax.post, '/api/user/favorite', {name, tag})
|
||||
}
|
||||
return new Interface(ajax.delete, '/api/user/favorite', {name, tag})
|
||||
},
|
||||
get(id: number) {
|
||||
return new Interface(ajax.get, '/api/user/' + id)
|
||||
},
|
||||
search(username: string) {
|
||||
return new Interface(ajax.get, '/api/user/', {
|
||||
username
|
||||
})
|
||||
}
|
||||
},
|
||||
message: message
|
||||
}
|
||||
|
||||
const Api = {
|
||||
install(vue: typeof Vue): void {
|
||||
vue.prototype.$api = api
|
||||
}
|
||||
}
|
||||
export {Api}
|
||||
export default api
|
@ -1,25 +0,0 @@
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.full_size {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.none_select {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.none_border{
|
||||
border: none;
|
||||
}
|
||||
.none_border_input {
|
||||
.ivu-input {
|
||||
.none_border;
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
@ -1 +0,0 @@
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
Before Width: | Height: | Size: 539 B |
@ -1,44 +0,0 @@
|
||||
<template>
|
||||
<div id="wx_reg"></div>
|
||||
</template>
|
||||
<script lang='ts'>
|
||||
import {Component, Vue, Prop} from 'vue-property-decorator'
|
||||
import '@/libs/wwLogin.js'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class WxLogin extends Vue {
|
||||
goto(id: string, app: string, url: string, state?: number, href?: string) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
window.WwLogin({
|
||||
id: 'wx_reg',
|
||||
appid: id,
|
||||
agentid: app,
|
||||
redirect_uri: encodeURIComponent(url),
|
||||
state: state,
|
||||
href: href
|
||||
})
|
||||
}
|
||||
|
||||
@Prop({default: ''})
|
||||
aid = ''
|
||||
|
||||
@Prop({default: ''})
|
||||
app = ''
|
||||
|
||||
@Prop({default: ''})
|
||||
url = ''
|
||||
|
||||
mounted() {
|
||||
this.goto(this.aid, this.app, this.url, new Date().getTime())
|
||||
}
|
||||
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,33 +0,0 @@
|
||||
<template>
|
||||
<v-card class="core" elevation="4">
|
||||
<v-system-bar color="info">
|
||||
<one-icon>mail</one-icon>
|
||||
<v-spacer></v-spacer>
|
||||
<one-icon>user-group</one-icon>
|
||||
<span>*{{ core.user_count }}</span>
|
||||
</v-system-bar>
|
||||
<div></div>
|
||||
</v-card>
|
||||
</template>
|
||||
<script lang='ts'>
|
||||
import {Component, Prop, Vue} from 'vue-property-decorator'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class AppCard extends Vue {
|
||||
@Prop({default: {}})
|
||||
core: any
|
||||
|
||||
mounted() {
|
||||
console.log(this.core)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.core {
|
||||
width: 256px;
|
||||
background: #2c3e50;
|
||||
height: 128px;
|
||||
}
|
||||
</style>
|
@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class Demo extends Vue {
|
||||
mounted() {
|
||||
}
|
||||
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,64 +0,0 @@
|
||||
function padLeftZero(str: string): string {
|
||||
return ('00' + str).substr(str.length)
|
||||
}
|
||||
|
||||
const util = {
|
||||
title: function (title: string) {
|
||||
window.document.title = title ? title + ' - oa' : 'veypi project'
|
||||
},
|
||||
getCookie(name: string) {
|
||||
const reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)')
|
||||
const arr = document.cookie.match(reg)
|
||||
if (arr) {
|
||||
return unescape(arr[2])
|
||||
} else return null
|
||||
},
|
||||
delCookie(name: string) {
|
||||
const exp = new Date()
|
||||
exp.setTime(exp.getTime() - 1)
|
||||
const cval = this.getCookie(name)
|
||||
if (cval !== null) {
|
||||
document.cookie = name + '=' + cval + ';expires=' + exp.toLocaleString()
|
||||
}
|
||||
},
|
||||
setCookie(name: string, value: string, time: number) {
|
||||
const exp = new Date()
|
||||
exp.setTime(exp.getTime() + time)
|
||||
document.cookie =
|
||||
name + '=' + escape(value) + ';expires=' + exp.toLocaleString()
|
||||
},
|
||||
checkLogin() {
|
||||
// return parseInt(this.getCookie('stat')) === 1
|
||||
return Boolean(localStorage.auth_token)
|
||||
},
|
||||
|
||||
formatDate(date: Date, fmt: string) {
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(
|
||||
RegExp.$1,
|
||||
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
|
||||
)
|
||||
}
|
||||
const o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'h+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds()
|
||||
}
|
||||
for (const k in o) {
|
||||
if (new RegExp(`(${k})`).test(fmt)) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
const str = o[k] + ''
|
||||
fmt = fmt.replace(
|
||||
RegExp.$1,
|
||||
RegExp.$1.length === 1 ? str : padLeftZero(str)
|
||||
)
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
}
|
||||
|
||||
export default util
|
@ -1,2 +0,0 @@
|
||||
!function(a,b,c){function d(c){var d=b.createElement("iframe"),e="https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid="+c.appid+"&agentid="+c.agentid+"&redirect_uri="+c.redirect_uri+"&state="+c.state+"&login_type=jssdk";e+=c.style?"&style="+c.style:"",e+=c.href?"&href="+c.href:"",d.src=e,d.frameBorder="0",d.allowTransparency="true",d.scrolling="no",d.width="300px",d.height="400px";var f=b.getElementById(c.id);f.innerHTML="",f.appendChild(d),d.onload=function(){d.contentWindow.postMessage&&a.addEventListener&&(a.addEventListener("message",function(b){
|
||||
b.data&&b.origin.indexOf("work.weixin.qq.com")>-1&&(a.location.href=b.data)}),d.contentWindow.postMessage("ask_usePostMessage","*"))}}a.WwLogin=d}(window,document);
|
@ -1,24 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import vuetify from './plugins/vuetify'
|
||||
import {Api} from '@/api'
|
||||
import OneIcon from '@veypi/one-icon'
|
||||
import Message from 'vue-m-message'
|
||||
import 'vue-m-message/dist/index.css'
|
||||
|
||||
Vue.use(Message) // will mount `Vue.prototype.$message`
|
||||
|
||||
// Vue.use(OneIcon, {href: 'https://at.alicdn.com/t/font_2872366_7aws02sx9bl.js'})
|
||||
Vue.use(OneIcon, {href: './icon.js'})
|
||||
Vue.use(Api)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
vuetify,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
@ -1,24 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify/lib/framework'
|
||||
|
||||
Vue.use(Vuetify)
|
||||
|
||||
const light = {
|
||||
primary: '#2196f3',
|
||||
secondary: '#00bcd4',
|
||||
accent: '#3f51b5',
|
||||
error: '#f44336',
|
||||
warning: '#ff5722',
|
||||
info: '#ff9800',
|
||||
success: '#4caf50',
|
||||
reset: '#684bff'
|
||||
}
|
||||
|
||||
export default new Vuetify({
|
||||
theme: {
|
||||
dark: false,
|
||||
themes: {
|
||||
light: light
|
||||
}
|
||||
}
|
||||
})
|
@ -1,57 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter, {RouteConfig} from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
import Demo from '@/views/demo.vue'
|
||||
import Login from '@/views/login.vue'
|
||||
import Register from '@/views/register.vue'
|
||||
import NotFound from '@/views/404.vue'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
// 避免push到相同路径报错
|
||||
// 获取原型对象上的push函数
|
||||
const originalPush = VueRouter.prototype.push
|
||||
// 修改原型对象中的push方法
|
||||
VueRouter.prototype.push = function push(location: any) {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
return originalPush.call(this, location).catch(err => err)
|
||||
}
|
||||
|
||||
const routes: Array<RouteConfig> = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/app',
|
||||
name: 'app',
|
||||
component: Demo
|
||||
},
|
||||
{
|
||||
path: '/login/:uuid?',
|
||||
name: 'login',
|
||||
component: Login
|
||||
},
|
||||
{
|
||||
path: '/register/:uuid?',
|
||||
name: 'register',
|
||||
component: Register
|
||||
},
|
||||
{
|
||||
path: '/wx',
|
||||
name: 'wx',
|
||||
component: () => import('../views/wx.vue')
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: '404',
|
||||
component: NotFound
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
@ -1,13 +0,0 @@
|
||||
import Vue, { VNode } from 'vue'
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
interface Element extends VNode {}
|
||||
// tslint:disable no-empty-interface
|
||||
interface ElementClass extends Vue {}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
declare module '*.js'
|
||||
declare module '*.vue' {
|
||||
import Vue from 'vue'
|
||||
export default Vue
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
declare module 'vuetify/lib/framework' {
|
||||
import Vuetify from 'vuetify'
|
||||
export default Vuetify
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import api from '@/api'
|
||||
import router from '@/router'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
oauuid: '',
|
||||
user: null
|
||||
},
|
||||
mutations: {
|
||||
setOA(state: any, data: any) {
|
||||
state.oauuid = data.uuid
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
fetchSelf({commit}) {
|
||||
api.app.self().Start(d => {
|
||||
commit('setOA', d)
|
||||
})
|
||||
},
|
||||
handleLogout() {
|
||||
localStorage.removeItem('auth_token')
|
||||
router.push({name: 'login'})
|
||||
}
|
||||
},
|
||||
modules: {}
|
||||
})
|
@ -1,14 +0,0 @@
|
||||
// 1. 确保在声明补充的类型之前导入 'vue'
|
||||
import Vue from 'vue'
|
||||
import api from '@/api'
|
||||
|
||||
export type PluginFunction<T> = (Vue: typeof Vue, options?: T) => void;
|
||||
|
||||
// 2. 定制一个文件,设置你想要补充的类型
|
||||
// 在 types/vue.d.ts 里 Vue 有构造函数类型
|
||||
declare module 'vue/types/vue' {
|
||||
// 3. 声明为 Vue 补充的东西
|
||||
interface Vue {
|
||||
$api: typeof api;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<style>
|
||||
</style>
|
||||
<template>
|
||||
<div class='home d-flex justify-center align-center'>
|
||||
<one-icon style="font-size: 100px">404</one-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
import util from '@/libs/util'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class NotFound extends Vue {
|
||||
mounted() {
|
||||
}
|
||||
|
||||
created() {
|
||||
util.title('404')
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,50 +0,0 @@
|
||||
<style>
|
||||
.home {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class='full_size'>
|
||||
<v-row no-gutters class="pa-8">
|
||||
<v-col v-for="(item, key) in apps" :key="key" class="mx-4 my-2">
|
||||
<AppCard :core="item"></AppCard>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
import util from '@/libs/util'
|
||||
import AppCard from '@/components/app.vue'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
AppCard
|
||||
}
|
||||
})
|
||||
export default class Home extends Vue {
|
||||
apps = []
|
||||
|
||||
getApps() {
|
||||
this.$api.app.list().Start(d => {
|
||||
console.log(d)
|
||||
this.apps = d
|
||||
})
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.getApps()
|
||||
}
|
||||
|
||||
created() {
|
||||
}
|
||||
|
||||
beforeCreate() {
|
||||
if (!util.checkLogin()) {
|
||||
this.$router.push({name: 'login', query: this.$route.query, params: this.$route.params})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,21 +0,0 @@
|
||||
<style>
|
||||
</style>
|
||||
<template>
|
||||
<div class='home d-flex justify-center align-center'>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class Demo extends Vue {
|
||||
mounted() {
|
||||
}
|
||||
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,124 +0,0 @@
|
||||
<style>
|
||||
</style>
|
||||
<template>
|
||||
<v-row class="fill-height" align="center" justify="center" style="background: #ebebeb">
|
||||
<v-col cols="12" sm="8" md="6" lg="4" xl="3">
|
||||
<v-card class="elevation-12 mx-5" style="opacity: 0.8">
|
||||
<v-row justify="center">
|
||||
<v-card class="elevation-1 mt-n7 primary" style="width: 80%">
|
||||
<v-card-actions>
|
||||
<v-row>
|
||||
<v-icon
|
||||
style="position: absolute;left: 10px;top:19px;z-index: 1"
|
||||
@click="$router.back()"
|
||||
size="36"
|
||||
>mdi-arrow-left-circle
|
||||
</v-icon>
|
||||
<v-col cols="12" class="text-center">
|
||||
<h1 class="display-2 ">注册</h1>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-row>
|
||||
<v-card-text class="text-center">
|
||||
<v-form ref="form">
|
||||
<v-text-field
|
||||
type="text"
|
||||
prepend-inner-icon="mdi-account-circle"
|
||||
v-model="form.username"
|
||||
label="账号"
|
||||
:rules="ruleInline.user"
|
||||
:counter="16"
|
||||
>
|
||||
</v-text-field>
|
||||
<v-text-field
|
||||
type="password"
|
||||
v-model="form.passwd"
|
||||
label="密码"
|
||||
prepend-inner-icon="mdi-lock"
|
||||
:rules="ruleInline.password"
|
||||
:counter="16"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
type="password"
|
||||
v-model="form.passwdCheck"
|
||||
label="密码"
|
||||
prepend-inner-icon="mdi-lock"
|
||||
:rules="ruleInline.passwordCheck"
|
||||
:counter="16"
|
||||
@keyup.enter="handleSubmit"
|
||||
></v-text-field>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn type="primary" @click="handleSubmit">提交</v-btn>
|
||||
<v-btn @click="handleReset()">重置</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
|
||||
@Component({
|
||||
components: {}
|
||||
})
|
||||
export default class Register extends Vue {
|
||||
form = {
|
||||
passwd: '',
|
||||
passwdCheck: '',
|
||||
email: '',
|
||||
username: ''
|
||||
}
|
||||
|
||||
ruleInline = {
|
||||
user: [
|
||||
(v: string) => !!v || 'required',
|
||||
(v: string) => (v && v.length >= 3 && v.length <= 16) || '长度要求3~16'
|
||||
],
|
||||
password: [
|
||||
(v: string) => !!v || 'required',
|
||||
(v: string) => (v && v.length >= 6 && v.length <= 16) || '长度要求6~16'
|
||||
],
|
||||
passwordCheck: [
|
||||
(v: string) => !!v || 'required',
|
||||
(v: string) => (v && v === this.form.passwd) || '密码不一致'
|
||||
]
|
||||
}
|
||||
|
||||
get app_uuid() {
|
||||
return this.$route.params.uuid || this.$store.state.oauuid
|
||||
}
|
||||
|
||||
handleSubmit() {
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
if (!this.$refs.form.validate()) {
|
||||
return
|
||||
}
|
||||
this.$api.user.register(this.form.username, this.form.passwd, this.app_uuid).Start(
|
||||
() => {
|
||||
this.$message.success('注册成功!')
|
||||
this.$router.push({name: 'login', params: this.$route.params, query: this.$route.query})
|
||||
},
|
||||
(data) => {
|
||||
if (data && data.code === '31011') {
|
||||
this.$message.error('用户名重复')
|
||||
} else {
|
||||
this.$message.error('注册失败')
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
handleReset() {
|
||||
this.form.username = ''
|
||||
this.form.passwd = ''
|
||||
this.form.passwdCheck = ''
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,66 +0,0 @@
|
||||
<template>
|
||||
<div class='home d-flex justify-center align-center'>
|
||||
<wx-login v-if="enable" :aid="aid" :app="agentID" :url="url"></wx-login>
|
||||
<v-overlay :value="!enable">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
size="64"
|
||||
></v-progress-circular>
|
||||
</v-overlay>
|
||||
</div>
|
||||
</template>
|
||||
<script lang='ts'>
|
||||
import {Component, Vue} from 'vue-property-decorator'
|
||||
import WxLogin from '@/components/WxLogin.vue'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
WxLogin
|
||||
}
|
||||
})
|
||||
export default class Wx extends Vue {
|
||||
aid = ''
|
||||
agentID = ''
|
||||
url = ''
|
||||
|
||||
get enable() {
|
||||
return this.uuid && this.aid && this.agentID && this.url
|
||||
}
|
||||
|
||||
get uuid() {
|
||||
return this.$route.query.uuid
|
||||
}
|
||||
|
||||
get code() {
|
||||
return this.$route.query.code
|
||||
}
|
||||
|
||||
get state() {
|
||||
return this.$route.query.state
|
||||
}
|
||||
|
||||
get msg() {
|
||||
return this.$route.query.msg
|
||||
}
|
||||
|
||||
mounted() {
|
||||
if (this.msg) {
|
||||
console.log(this.msg)
|
||||
alert(this.msg)
|
||||
}
|
||||
}
|
||||
|
||||
created() {
|
||||
if (this.uuid) {
|
||||
this.$api.app.get(this.uuid as string).Start(e => {
|
||||
this.url = e.wx.url + '/api/wx/login/' + this.uuid
|
||||
this.aid = e.wx.corp_id
|
||||
this.agentID = e.wx.agent_id
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,40 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"importHelpers": true,
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": 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"
|
||||
]
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
module.exports = {
|
||||
transpileDependencies: [
|
||||
'vuetify'
|
||||
],
|
||||
configureWebpack: {
|
||||
output: {
|
||||
filename: '[name].[hash].js'
|
||||
}
|
||||
},
|
||||
outputDir: '../sub/static',
|
||||
devServer: {
|
||||
host: '0.0.0.0',
|
||||
port: 19520,
|
||||
disableHostCheck: true,
|
||||
proxy: {
|
||||
'^/api': {
|
||||
target: 'http://127.0.0.1:4001',
|
||||
ws: true,
|
||||
changeOrigin: true
|
||||
},
|
||||
'^/media': {
|
||||
target: 'http://127.0.0.1:4001',
|
||||
ws: true,
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue