改为使用vue-cli打包,修改所有的请求方式
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"presets": ["vue-app"]
|
||||
}
|
||||
13
zyplayer-doc-ui/wiki-ui/.editorconfig
Normal file
13
zyplayer-doc-ui/wiki-ui/.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
11
zyplayer-doc-ui/wiki-ui/.env.development
Normal file
11
zyplayer-doc-ui/wiki-ui/.env.development
Normal file
@@ -0,0 +1,11 @@
|
||||
# 开发环境
|
||||
ENV = 'development'
|
||||
|
||||
# base api
|
||||
# VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
|
||||
VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
|
||||
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
|
||||
|
||||
6
zyplayer-doc-ui/wiki-ui/.env.production
Normal file
6
zyplayer-doc-ui/wiki-ui/.env.production
Normal file
@@ -0,0 +1,6 @@
|
||||
# 线上环境
|
||||
ENV = 'production'
|
||||
|
||||
# base api
|
||||
VUE_APP_BASE_API = './'
|
||||
|
||||
22
zyplayer-doc-ui/wiki-ui/.gitignore
vendored
22
zyplayer-doc-ui/wiki-ui/.gitignore
vendored
@@ -1,5 +1,21 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
npm-debug.log
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
.PHONY: dist build
|
||||
install:
|
||||
@npm install
|
||||
|
||||
dev: install
|
||||
@npm run dev
|
||||
|
||||
build:
|
||||
@npm run build
|
||||
5
zyplayer-doc-ui/wiki-ui/babel.config.js
Normal file
5
zyplayer-doc-ui/wiki-ui/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
};
|
||||
10027
zyplayer-doc-ui/wiki-ui/package-lock.json
generated
10027
zyplayer-doc-ui/wiki-ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,40 @@
|
||||
{
|
||||
"name": "element-starter",
|
||||
"description": "A Vue.js project",
|
||||
"author": "yi.shyang@ele.me",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --hot --env.dev",
|
||||
"build": "rimraf dist && webpack -p --progress --hide-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"element-ui": "^2.3.4",
|
||||
"vue": "^2.5.16",
|
||||
"vue-axios": "^2.1.4",
|
||||
"vue-router": "^3.0.6",
|
||||
"wangeditor": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.6.0",
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-loader": "^6.4.0",
|
||||
"babel-preset-vue-app": "^1.2.0",
|
||||
"css-loader": "^0.27.0",
|
||||
"file-loader": "^0.10.1",
|
||||
"html-webpack-plugin": "^2.24.1",
|
||||
"postcss-loader": "^1.3.3",
|
||||
"rimraf": "^2.6.3",
|
||||
"style-loader": "^0.13.2",
|
||||
"url-loader": "^0.5.8",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack": "^2.4.1",
|
||||
"webpack-dev-server": "^2.4.2",
|
||||
"axios": "^0.18.0",
|
||||
"vue-axios": "^2.1.4"
|
||||
}
|
||||
"name": "zyplayer-wiki-ui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve --mode development",
|
||||
"build": "vue-cli-service build --mode production"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
"core-js": "^3.3.2",
|
||||
"echarts": "^4.5.0",
|
||||
"js-cookie": "^2.2.1",
|
||||
"pouchdb": "^7.1.1",
|
||||
"vue": "^2.6.10",
|
||||
"vue-axios": "^2.1.5",
|
||||
"vue-hljs": "^1.1.2",
|
||||
"vue-router": "^3.1.3",
|
||||
"vuex": "^3.1.2",
|
||||
"element-ui": "^2.10.0",
|
||||
"sql-formatter": "^2.3.3",
|
||||
"wangeditor": "^3.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.0.0",
|
||||
"@vue/cli-service": "^4.0.0",
|
||||
"less": "^3.10.3",
|
||||
"less-loader": "^5.0.0",
|
||||
"vue-template-compiler": "^2.6.10"
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer')()
|
||||
]
|
||||
}
|
||||
BIN
zyplayer-doc-ui/wiki-ui/public/favicon-wiki.png
Normal file
BIN
zyplayer-doc-ui/wiki-ui/public/favicon-wiki.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
17
zyplayer-doc-ui/wiki-ui/public/index.html
Normal file
17
zyplayer-doc-ui/wiki-ui/public/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!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-wiki.png">
|
||||
<title>WIKI文档管理系统</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but zyplayer-wiki-ui 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,6 +1,6 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<template v-if="global.fullscreen">
|
||||
<template v-if="fullscreen">
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<el-container v-else>
|
||||
@@ -48,9 +48,12 @@
|
||||
</el-dropdown>
|
||||
</el-header>
|
||||
<el-main style="padding: 0;">
|
||||
<router-view></router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<router-view @loadPageList="loadPageList"
|
||||
@changeExpandedKeys="changeWikiPageExpandedKeys"
|
||||
@switchSpace="switchSpacePage">
|
||||
</router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<!--新建空间弹窗-->
|
||||
<el-dialog title="创建空间" :visible.sync="newSpaceDialogVisible" width="600px" :close-on-click-modal="false">
|
||||
@@ -138,10 +141,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import global from './common/config/global'
|
||||
import toast from './common/lib/common/toast'
|
||||
import userApi from './common/api/user'
|
||||
import pageApi from './common/api/page'
|
||||
|
||||
var app;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -183,13 +185,20 @@
|
||||
upgradeInfo: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fullscreen () {
|
||||
return this.$store.state.global.fullscreen;
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
global.vue.$app = this;
|
||||
this.loadSpaceList();
|
||||
this.checkSystemUpgrade();
|
||||
},
|
||||
methods: {
|
||||
loadPageList(param) {
|
||||
param = param || {};
|
||||
this.doGetPageList(param.parentId, param.node);
|
||||
},
|
||||
createWiki() {
|
||||
if (this.nowClickPath.spaceId > 0) {
|
||||
var param = {
|
||||
@@ -198,17 +207,17 @@
|
||||
};
|
||||
this.$router.push({path: '/page/edit', query: param});
|
||||
} else {
|
||||
toast.warn("请先选择或创建空间");
|
||||
this.$message.warning("请先选择或创建空间");
|
||||
}
|
||||
},
|
||||
changeWikiPageExpandedKeys(pageId) {
|
||||
this.wikiPageExpandedKeys = [pageId];
|
||||
},
|
||||
searchByKeywords() {
|
||||
this.$refs.wikiPageTree.filter(app.searchKeywords);
|
||||
this.$refs.wikiPageTree.filter(this.searchKeywords);
|
||||
},
|
||||
searchByKeywordsNewPage() {
|
||||
var routeUrl = this.$router.resolve({path: '/page/search', query: {keywords: app.searchKeywords}});
|
||||
var routeUrl = this.$router.resolve({path: '/page/search', query: {keywords: this.searchKeywords}});
|
||||
window.open(routeUrl.href, '_blank');
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
@@ -219,7 +228,7 @@
|
||||
handleNodeExpand(node) {
|
||||
if (node.children.length > 0 && node.children[0].needLoad) {
|
||||
console.log("加载节点:", node);
|
||||
app.doGetPageList(node.id, node);
|
||||
this.doGetPageList(node.id, node);
|
||||
}
|
||||
},
|
||||
handlePageDrop(draggingNode, dropNode, dropType, ev) {
|
||||
@@ -234,75 +243,75 @@
|
||||
} else if (dropType == 'after') {
|
||||
param.afterSeq = dropNode.data.seqNo;
|
||||
}
|
||||
this.common.post(this.apilist1.pageChangeParent, param, function (json) {
|
||||
app.doGetPageList(null);
|
||||
});
|
||||
pageApi.pageChangeParent(param).then(res => {
|
||||
this.doGetPageList(null);
|
||||
});
|
||||
},
|
||||
filterPageNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
editSpaceInfo(row) {
|
||||
app.newSpaceForm = {
|
||||
this.newSpaceForm = {
|
||||
id: row.id, name: row.name, spaceExplain: row.spaceExplain,
|
||||
treeLazyLoad: row.treeLazyLoad, openDoc: row.openDoc, type: row.type
|
||||
};
|
||||
app.newSpaceDialogVisible = true;
|
||||
this.newSpaceDialogVisible = true;
|
||||
},
|
||||
deleteSpaceInfo(row) {
|
||||
this.$confirm('确定要删除此空间及下面的所有文档吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
var param = {id: row.id, delFlag: 1};
|
||||
this.common.post(this.apilist1.updateSpace, param, function (json) {
|
||||
app.loadSpaceList();
|
||||
});
|
||||
});
|
||||
this.$confirm('确定要删除此空间及下面的所有文档吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let param = {id: row.id, delFlag: 1};
|
||||
pageApi.updateSpace(param).then(() => {
|
||||
this.loadSpaceList();
|
||||
});
|
||||
});
|
||||
},
|
||||
spaceChangeEvents(data) {
|
||||
if (data == 0) {
|
||||
app.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
app.choiceSpace = app.nowClickPath.spaceId;
|
||||
app.newSpaceDialogVisible = true;
|
||||
this.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
this.choiceSpace = this.nowClickPath.spaceId;
|
||||
this.newSpaceDialogVisible = true;
|
||||
} else if (data == -1) {
|
||||
// 使得选择的空间展示不变
|
||||
app.choiceSpace = app.nowClickPath.spaceId;
|
||||
app.manageSpaceDialogVisible = true;
|
||||
this.choiceSpace = this.nowClickPath.spaceId;
|
||||
this.manageSpaceDialogVisible = true;
|
||||
} else {
|
||||
// 切换空间,重新初始化当前点击项,防止创建保存到之前点击的空间下去了
|
||||
app.nowClickPath = {spaceId: data};
|
||||
for (var i = 0; i < app.spaceList.length; i++) {
|
||||
if (app.spaceList[i].id == data) {
|
||||
app.nowSpaceShow = app.spaceList[i];
|
||||
this.nowClickPath = {spaceId: data};
|
||||
for (var i = 0; i < this.spaceList.length; i++) {
|
||||
if (this.spaceList[i].id == data) {
|
||||
this.nowSpaceShow = this.spaceList[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
app.doGetPageList(null);
|
||||
app.$router.push({path: '/home', query: {spaceId: data}});
|
||||
this.doGetPageList(null);
|
||||
this.$router.push({path: '/home', query: {spaceId: data}});
|
||||
}
|
||||
},
|
||||
loadSpaceList() {
|
||||
this.common.post(this.apilist1.spaceList, {}, function (json) {
|
||||
app.spaceList = json.data || [];
|
||||
pageApi.spaceList({}).then(json => {
|
||||
this.spaceList = json.data || [];
|
||||
var spaceOptions = [];
|
||||
for (var i = 0; i < app.spaceList.length; i++) {
|
||||
for (var i = 0; i < this.spaceList.length; i++) {
|
||||
spaceOptions.push({
|
||||
label: app.spaceList[i].name, value: app.spaceList[i].id
|
||||
label: this.spaceList[i].name, value: this.spaceList[i].id
|
||||
});
|
||||
}
|
||||
app.spaceOptions = spaceOptions;
|
||||
if (app.spaceList.length > 0) {
|
||||
var spaceId = app.spaceList[0].id;
|
||||
app.nowSpaceShow = app.spaceList[0];
|
||||
app.nowClickPath = {spaceId: spaceId};
|
||||
app.choiceSpace = spaceId;
|
||||
app.doGetPageList(null);
|
||||
// 在首页时跳转
|
||||
this.spaceOptions = spaceOptions;
|
||||
if (this.spaceList.length > 0) {
|
||||
var spaceId = this.spaceList[0].id;
|
||||
this.nowSpaceShow = this.spaceList[0];
|
||||
this.nowClickPath = {spaceId: spaceId};
|
||||
this.choiceSpace = spaceId;
|
||||
this.doGetPageList(null);
|
||||
// TODO 在首页时跳转
|
||||
try {
|
||||
if (app.$router.app._route.path == "/home") {
|
||||
app.$router.push({path: '/home', query: {spaceId: spaceId}});
|
||||
if (this.$router.app._route.path == "/home") {
|
||||
this.$router.push({path: '/home', query: {spaceId: spaceId}});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@@ -320,16 +329,16 @@
|
||||
} else {
|
||||
nodePath = "/";
|
||||
}
|
||||
var param = {spaceId: app.nowClickPath.spaceId, parentId: parentId || 0};
|
||||
if (app.nowSpaceShow.treeLazyLoad == 0) {
|
||||
var param = {spaceId: this.nowClickPath.spaceId, parentId: parentId || 0};
|
||||
if (this.nowSpaceShow.treeLazyLoad == 0) {
|
||||
param.parentId = null;
|
||||
}
|
||||
this.common.post(this.apilist1.pageList, param, function (json) {
|
||||
var result = json.data || [];
|
||||
var pathIndex = [];
|
||||
if (app.nowSpaceShow.treeLazyLoad == 0) {
|
||||
pathIndex = result;
|
||||
} else {
|
||||
pageApi.pageList(param).then(json => {
|
||||
var result = json.data || [];
|
||||
var pathIndex = [];
|
||||
if (this.nowSpaceShow.treeLazyLoad == 0) {
|
||||
pathIndex = result;
|
||||
} else {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
var item = result[i];
|
||||
item.parentId = item.parentId || 0;
|
||||
@@ -337,12 +346,12 @@
|
||||
pathIndex.push(item);
|
||||
}
|
||||
}
|
||||
app.createNodePath(pathIndex, nodePath);
|
||||
this.createNodePath(pathIndex, nodePath);
|
||||
if (parentId > 0) {
|
||||
node.children = pathIndex;
|
||||
} else {
|
||||
app.wikiPageList = pathIndex;
|
||||
//app.lastClickNode = {};
|
||||
this.wikiPageList = pathIndex;
|
||||
//this.lastClickNode = {};
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -363,46 +372,46 @@
|
||||
if (command == 'userSignOut') {
|
||||
this.userSignOut();
|
||||
} else if (command == 'aboutDoc') {
|
||||
app.aboutDialogVisible = true;
|
||||
this.aboutDialogVisible = true;
|
||||
} else if (command == 'myInfo') {
|
||||
this.$router.push({path: '/user/myInfo'});
|
||||
} else if (command == 'console') {
|
||||
window.location = this.apilist1.HOST;
|
||||
} else {
|
||||
toast.notOpen();
|
||||
this.$message.warning("暂未开放");
|
||||
}
|
||||
},
|
||||
userSignOut() {
|
||||
this.common.post(this.apilist1.userLogout, {}, function (json) {
|
||||
location.reload();
|
||||
});
|
||||
userApi.userLogout().then(() => {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
onNewSpaceSubmit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
var param = {
|
||||
id: app.newSpaceForm.id,
|
||||
name: app.newSpaceForm.name,
|
||||
type: app.newSpaceForm.type,
|
||||
openDoc: app.newSpaceForm.openDoc,
|
||||
spaceExplain: app.newSpaceForm.spaceExplain,
|
||||
treeLazyLoad: app.newSpaceForm.treeLazyLoad,
|
||||
id: this.newSpaceForm.id,
|
||||
name: this.newSpaceForm.name,
|
||||
type: this.newSpaceForm.type,
|
||||
openDoc: this.newSpaceForm.openDoc,
|
||||
spaceExplain: this.newSpaceForm.spaceExplain,
|
||||
treeLazyLoad: this.newSpaceForm.treeLazyLoad,
|
||||
};
|
||||
this.common.post(this.apilist1.updateSpace, param, function (json) {
|
||||
if (param.id > 0) {
|
||||
app.loadSpaceList();
|
||||
} else {
|
||||
app.spaceList.push(json.data);
|
||||
app.spaceOptions.push({
|
||||
pageApi.updateSpace(param).then(json => {
|
||||
if (param.id > 0) {
|
||||
this.loadSpaceList();
|
||||
} else {
|
||||
this.spaceList.push(json.data);
|
||||
this.spaceOptions.push({
|
||||
label: json.data.name, value: json.data.id
|
||||
});
|
||||
app.nowSpaceShow = json.data;
|
||||
app.nowClickPath = {spaceId: json.data.id};
|
||||
app.choiceSpace = json.data.id;
|
||||
app.doGetPageList(null);
|
||||
this.nowSpaceShow = json.data;
|
||||
this.nowClickPath = {spaceId: json.data.id};
|
||||
this.choiceSpace = json.data.id;
|
||||
this.doGetPageList(null);
|
||||
}
|
||||
app.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
app.newSpaceDialogVisible = false;
|
||||
this.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
this.newSpaceDialogVisible = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -411,9 +420,9 @@
|
||||
this.newSpaceDialogVisible = false;
|
||||
},
|
||||
checkSystemUpgrade() {
|
||||
this.common.post(this.apilist1.systemUpgradeInfo, {}, function (json) {
|
||||
userApi.systemUpgradeInfo({}).then(json => {
|
||||
if (!!json.data) {
|
||||
app.upgradeInfo = json.data;
|
||||
this.upgradeInfo = json.data;
|
||||
console.log("zyplayer-doc发现新版本:"
|
||||
+ "\n升级地址:" + json.data.upgradeUrl
|
||||
+ "\n当前版本:" + json.data.nowVersion
|
||||
@@ -422,17 +431,14 @@
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
init() {
|
||||
|
||||
},
|
||||
switchSpacePage(spaceId) {
|
||||
spaceId = parseInt(spaceId);
|
||||
if (app.choiceSpace == spaceId) {
|
||||
if (this.choiceSpace == spaceId) {
|
||||
return;
|
||||
}
|
||||
app.choiceSpace = spaceId;
|
||||
app.nowClickPath.spaceId = spaceId;
|
||||
this.choiceSpace = spaceId;
|
||||
this.nowClickPath.spaceId = spaceId;
|
||||
this.doGetPageList(null);
|
||||
},
|
||||
}
|
||||
|
||||
11
zyplayer-doc-ui/wiki-ui/src/common/api/common.js
Normal file
11
zyplayer-doc-ui/wiki-ui/src/common/api/common.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Qs from 'qs'
|
||||
import request from './request'
|
||||
|
||||
export default {
|
||||
commonUpload: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/common/upload', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
getUserBaseInfo: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/common/user/base', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
};
|
||||
66
zyplayer-doc-ui/wiki-ui/src/common/api/page.js
Normal file
66
zyplayer-doc-ui/wiki-ui/src/common/api/page.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import Qs from 'qs'
|
||||
import request from './request'
|
||||
|
||||
export default {
|
||||
pageUpdate: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageChangeParent: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/changeParent', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageList: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updatePage: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageDetail: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/detail', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageDelete: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/delete', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageNews: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/news', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageSearchByEs: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/searchByEs', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageLock: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/lock', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageUnlock: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/unlock', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
spaceList: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/space/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updateSpace: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/space/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
getPageUserAuthList: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/auth/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
assignPageUserAuth: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/auth/assign', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updatePageFile: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/file/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageCommentList: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/comment/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updatePageComment: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/comment/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
pageZanList: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/zan/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updatePageZan: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/page/zan/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
xxxxxxxxxxxx: data => {
|
||||
return request({url: 'update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
|
||||
};
|
||||
55
zyplayer-doc-ui/wiki-ui/src/common/api/request.js
Normal file
55
zyplayer-doc-ui/wiki-ui/src/common/api/request.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import axios from 'axios'
|
||||
import vue from '../../main'
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url process.env.APP_BASE_API
|
||||
timeout: 10000,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
withCredentials: true
|
||||
});
|
||||
// 增加不需要验证结果的标记
|
||||
const noValidate = {
|
||||
"/zyplayer-doc-db/executor/execute": true,
|
||||
};
|
||||
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
config.needValidateResult = true;
|
||||
// 增加不需要验证结果的标记
|
||||
if (noValidate[config.url]) {
|
||||
config.needValidateResult = false;
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
if (!!response.message) {
|
||||
vue.$message.error('请求错误:' + response.message);
|
||||
}else {
|
||||
if (!response.config.needValidateResult || response.data.errCode == 200) {
|
||||
return response.data;
|
||||
} else if (response.data.errCode == 400) {
|
||||
vue.$message.error('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
window.location = process.env.VUE_APP_BASE_API + "#/user/login?redirect=" + href;
|
||||
} else if (response.data.errCode == 402) {
|
||||
vue.$router.push("/common/noAuth");
|
||||
} else if (response.data.errCode !== 200) {
|
||||
vue.$message.error(response.data.errMsg || "未知错误");
|
||||
}
|
||||
}
|
||||
return Promise.reject('请求错误');
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error);
|
||||
vue.$message.info('请求错误:' + error.message);
|
||||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
export default service;
|
||||
25
zyplayer-doc-ui/wiki-ui/src/common/api/user.js
Normal file
25
zyplayer-doc-ui/wiki-ui/src/common/api/user.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import Qs from 'qs'
|
||||
import request from './request'
|
||||
|
||||
export default {
|
||||
systemUpgradeInfo: data => {
|
||||
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
userLogin: data => {
|
||||
return request({url: '/login', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
userLogout: () => {
|
||||
return request({url: '/logout', method: 'post', data: Qs.stringify({})});
|
||||
},
|
||||
getSelfUserInfo: () => {
|
||||
return request({url: '/user/info/selfInfo', method: 'post', data: Qs.stringify({})});
|
||||
},
|
||||
getUserBaseInfo: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/common/user/base', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
};
|
||||
|
||||
// userLogin: '/login',
|
||||
// userLogout: '/logout',
|
||||
// getSelfUserInfo: '/user/info/selfInfo',
|
||||
// getUserBaseInfo: '/zyplayer-doc-wiki/common/user/base',
|
||||
@@ -1,40 +0,0 @@
|
||||
var URL = {
|
||||
userLogin: '/login',
|
||||
userLogout: '/logout',
|
||||
getSelfUserInfo: '/user/info/selfInfo',
|
||||
pageUpdate: '/zyplayer-doc-wiki/page/update',
|
||||
pageChangeParent: '/zyplayer-doc-wiki/page/changeParent',
|
||||
pageList: '/zyplayer-doc-wiki/page/list',
|
||||
updatePage: '/zyplayer-doc-wiki/page/update',
|
||||
pageDetail: '/zyplayer-doc-wiki/page/detail',
|
||||
pageDelete: '/zyplayer-doc-wiki/page/delete',
|
||||
pageNews: '/zyplayer-doc-wiki/page/news',
|
||||
pageSearchByEs: '/zyplayer-doc-wiki/page/searchByEs',
|
||||
pageLock: '/zyplayer-doc-wiki/page/lock',
|
||||
pageUnlock: '/zyplayer-doc-wiki/page/unlock',
|
||||
spaceList: '/zyplayer-doc-wiki/space/list',
|
||||
updateSpace: '/zyplayer-doc-wiki/space/update',
|
||||
getPageUserAuthList: '/zyplayer-doc-wiki/page/auth/list',
|
||||
assignPageUserAuth: '/zyplayer-doc-wiki/page/auth/assign',
|
||||
|
||||
updatePageFile: '/zyplayer-doc-wiki/page/file/update',
|
||||
pageCommentList: '/zyplayer-doc-wiki/page/comment/list',
|
||||
updatePageComment: '/zyplayer-doc-wiki/page/comment/update',
|
||||
pageZanList: '/zyplayer-doc-wiki/page/zan/list',
|
||||
updatePageZan: '/zyplayer-doc-wiki/page/zan/update',
|
||||
|
||||
commonUpload: '/zyplayer-doc-wiki/common/upload',
|
||||
getUserBaseInfo: '/zyplayer-doc-wiki/common/user/base',
|
||||
|
||||
systemUpgradeInfo: '/system/info/upgrade',
|
||||
};
|
||||
|
||||
var URL1 = {};
|
||||
|
||||
export default {
|
||||
URL, URL1
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import apilist from './apilist'
|
||||
|
||||
var href = window.location.href;
|
||||
|
||||
var _fn = {
|
||||
href: href,
|
||||
// 本地启动时使用本地接口调试
|
||||
// HOST: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
// HOST1: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
// 也可以直接使用线上的服务调试
|
||||
// HOST: 'http://doc.zyplayer.com/zyplayer-doc-manage',
|
||||
// HOST1: 'http://doc.zyplayer.com/zyplayer-doc-manage',
|
||||
// 打包时使用下面这两行,文件就放在根目录下,所以当前路劲就好
|
||||
HOST: './',
|
||||
HOST1: './',
|
||||
|
||||
mixUrl: function (host, url) {
|
||||
var p;
|
||||
if (!host || !url || _fn.isEmptyObject(url)) {
|
||||
return;
|
||||
}
|
||||
url.HOST = host;
|
||||
for (p in url) {
|
||||
if (url[p].indexOf('http') == -1) {
|
||||
url[p] = host + url[p];
|
||||
}
|
||||
}
|
||||
return url;
|
||||
},
|
||||
//判断是否空对象
|
||||
isEmptyObject: function (obj) { //判断空对象
|
||||
if (typeof obj === "object" && !(obj instanceof Array)) {
|
||||
var hasProp = false;
|
||||
for (var prop in obj) {
|
||||
hasProp = true;
|
||||
break;
|
||||
}
|
||||
if (hasProp) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var apilist1 = _fn.mixUrl(_fn.HOST, apilist.URL);
|
||||
var apilist2 = _fn.mixUrl(_fn.HOST1, apilist.URL1);
|
||||
|
||||
export default {
|
||||
apilist1, apilist2
|
||||
};
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
const user = {
|
||||
isLogin: true,
|
||||
};
|
||||
const vue = {};
|
||||
const fullscreen = false;
|
||||
|
||||
export default {
|
||||
vue,
|
||||
user,
|
||||
fullscreen,
|
||||
}
|
||||
|
||||
90
zyplayer-doc-ui/wiki-ui/src/common/lib/common.js
Normal file
90
zyplayer-doc-ui/wiki-ui/src/common/lib/common.js
Normal file
@@ -0,0 +1,90 @@
|
||||
import vue from '../../main'
|
||||
|
||||
export default {
|
||||
data: {
|
||||
accessToken: '',
|
||||
},
|
||||
setAccessToken: function (token) {
|
||||
this.data.accessToken = token;
|
||||
},
|
||||
getAccessToken: function () {
|
||||
if (!this.data.accessToken) {
|
||||
var arr, reg = new RegExp("(^| )accessToken=([^;]*)(;|$)");
|
||||
if (arr = document.cookie.match(reg)) {
|
||||
this.data.accessToken = unescape(arr[2]);
|
||||
}
|
||||
}
|
||||
return this.data.accessToken;
|
||||
},
|
||||
validateResult: function (res) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!!res.message) {
|
||||
vue.$message('请求错误:' + res.message);
|
||||
} else if (res.data.errCode == 400) {
|
||||
vue.$message('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
window.location = apimix.apilist1.HOST + "#/user/login?redirect=" + href;
|
||||
} else if (res.data.errCode == 402) {
|
||||
vue.$router.push("/common/noAuth");
|
||||
} else if (res.data.errCode !== 200) {
|
||||
vue.$message(res.data.errMsg || "未知错误");
|
||||
} else {
|
||||
resolve(res.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 返回不为空的字符串,为空返回def
|
||||
*/
|
||||
getNotEmptyStr(str, def) {
|
||||
if (isEmpty(str)) {
|
||||
return isEmpty(def) ? "" : def;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
/**
|
||||
* 是否是空对象
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
isEmptyObject(obj) {
|
||||
return isEmpty(obj) || $.isEmptyObject(obj);
|
||||
},
|
||||
/**
|
||||
* 是否是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isEmpty(str) {
|
||||
return (str == "" || str == null || str == undefined);
|
||||
},
|
||||
/**
|
||||
* 是否不是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isNotEmpty(str) {
|
||||
return !isEmpty(str);
|
||||
},
|
||||
/**
|
||||
* param 将要转为URL参数字符串的对象
|
||||
* key URL参数字符串的前缀
|
||||
* encode true/false 是否进行URL编码,默认为true
|
||||
* return URL参数字符串
|
||||
*/
|
||||
objUrlEncode(param, key, encode) {
|
||||
if (param == null) return '';
|
||||
var paramStr = '';
|
||||
var t = typeof (param);
|
||||
if (t == 'string' || t == 'number' || t == 'boolean') {
|
||||
paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param);
|
||||
} else {
|
||||
for (var i in param) {
|
||||
var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i);
|
||||
paramStr += urlEncode(param[i], k, encode);
|
||||
}
|
||||
}
|
||||
return paramStr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
import Qs from 'qs'
|
||||
import global from '../../config/global'
|
||||
import apimix from '../../config/apimix'
|
||||
|
||||
export default {
|
||||
data: {
|
||||
accessToken: '',
|
||||
},
|
||||
setAccessToken: function (token) {
|
||||
this.data.accessToken = token;
|
||||
},
|
||||
getAccessToken: function () {
|
||||
if (!this.data.accessToken) {
|
||||
var arr, reg = new RegExp("(^| )accessToken=([^;]*)(;|$)");
|
||||
if (arr = document.cookie.match(reg)) {
|
||||
this.data.accessToken = unescape(arr[2]);
|
||||
}
|
||||
}
|
||||
return this.data.accessToken;
|
||||
},
|
||||
validateResult: function (res, callback) {
|
||||
if (!!res.message) {
|
||||
global.vue.$message('请求错误:' + res.message);
|
||||
} else if (res.data.errCode == 400) {
|
||||
global.vue.$message('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
window.location = apimix.apilist1.HOST + "#/user/login?redirect=" + href;
|
||||
} else if (res.data.errCode == 402) {
|
||||
global.vue.$router.push("/common/noAuth");
|
||||
} else if (res.data.errCode !== 200) {
|
||||
global.vue.$message(res.data.errMsg || "未知错误");
|
||||
} else {
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
post: function (url, param, callback) {
|
||||
param = param || {};
|
||||
param.accessToken = this.getAccessToken();
|
||||
global.vue.axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
data: Qs.stringify(param),
|
||||
withCredentials: true,
|
||||
}).then((res) => {
|
||||
console.log("ok", res);
|
||||
this.validateResult(res, callback);
|
||||
}).catch((res) => {
|
||||
console.log("error", res);
|
||||
this.validateResult(res);
|
||||
});
|
||||
},
|
||||
postNonCheck: function (url, param, callback) {
|
||||
param = param || {};
|
||||
param.accessToken = this.getAccessToken();
|
||||
global.vue.axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
data: Qs.stringify(param),
|
||||
withCredentials: true,
|
||||
}).then((res) => {
|
||||
console.log("ok", res);
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
}).catch((res) => {
|
||||
console.log("error", res);
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 返回不为空的字符串,为空返回def
|
||||
*/
|
||||
getNotEmptyStr(str, def) {
|
||||
if (isEmpty(str)) {
|
||||
return isEmpty(def) ? "" : def;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
/**
|
||||
* 是否是空对象
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
isEmptyObject(obj) {
|
||||
return isEmpty(obj) || $.isEmptyObject(obj);
|
||||
},
|
||||
/**
|
||||
* 是否是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isEmpty(str) {
|
||||
return (str == "" || str == null || str == undefined);
|
||||
},
|
||||
/**
|
||||
* 是否不是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isNotEmpty(str) {
|
||||
return !isEmpty(str);
|
||||
},
|
||||
/**
|
||||
* param 将要转为URL参数字符串的对象
|
||||
* key URL参数字符串的前缀
|
||||
* encode true/false 是否进行URL编码,默认为true
|
||||
* return URL参数字符串
|
||||
*/
|
||||
objUrlEncode(param, key, encode) {
|
||||
if (param == null) return '';
|
||||
var paramStr = '';
|
||||
var t = typeof (param);
|
||||
if (t == 'string' || t == 'number' || t == 'boolean') {
|
||||
paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param);
|
||||
} else {
|
||||
for (var i in param) {
|
||||
var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i);
|
||||
paramStr += urlEncode(param[i], k, encode);
|
||||
}
|
||||
}
|
||||
return paramStr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import global from '../../config/global'
|
||||
|
||||
/**
|
||||
* 提示工具类
|
||||
* @author
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
export default {
|
||||
notOpen: function () {
|
||||
global.vue.$message({
|
||||
message: '该功能暂未开放,敬请期待!',
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
success: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'success',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
warn: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
error: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'error',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
31
zyplayer-doc-ui/wiki-ui/src/components/layouts/PageView.vue
Normal file
31
zyplayer-doc-ui/wiki-ui/src/components/layouts/PageView.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<router-view @loadPageList="loadPageList" @changeExpandedKeys="changeExpandedKeys" @switchSpace="switchSpace"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'PageView',
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
loadPageList(param) {
|
||||
this.$emit('loadPageList', param);
|
||||
},
|
||||
changeExpandedKeys(param) {
|
||||
this.$emit('changeExpandedKeys', param);
|
||||
},
|
||||
switchSpace(param) {
|
||||
this.$emit('switchSpace', param);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>wiki文档管理系统</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>wiki文档管理系统</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -3,13 +3,9 @@ import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
import App from './App.vue'
|
||||
|
||||
import global from './common/config/global'
|
||||
import apimix from './common/config/apimix'
|
||||
import common from './common/lib/common/common'
|
||||
import toast from './common/lib/common/toast'
|
||||
|
||||
import VueRouter from 'vue-router'
|
||||
import routes from './routes'
|
||||
import store from './store/index'
|
||||
import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
|
||||
@@ -17,43 +13,27 @@ Vue.use(ElementUI);
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(VueAxios, axios);
|
||||
|
||||
// 全局参数
|
||||
Vue.prototype.global = global;
|
||||
// 接口列表
|
||||
Vue.prototype.apilist1 = apimix.apilist1;
|
||||
Vue.prototype.apilist2 = apimix.apilist1;
|
||||
// 公用方法
|
||||
Vue.prototype.common = common;
|
||||
Vue.prototype.toast = toast;
|
||||
Vue.prototype.$store = store;
|
||||
|
||||
const router = new VueRouter({routes});
|
||||
// 路由跳转时判断处理
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title
|
||||
}
|
||||
global.fullscreen = !!to.meta.fullscreen;
|
||||
/* 判断该路由是否需要登录权限 */
|
||||
if (to.matched.some(record => record.meta.requireAuth)) {
|
||||
if (global.user.isLogin) {
|
||||
next();
|
||||
} else {
|
||||
next({path: '/login'});
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
document.title = to.meta.name;
|
||||
}
|
||||
store.commit('global/setFullscreen', !!to.meta.fullscreen);
|
||||
next();
|
||||
});
|
||||
|
||||
new Vue({
|
||||
npm
|
||||
let vue = new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
render(h) {
|
||||
var app = h(App);
|
||||
global.vue = app.context;
|
||||
return app;
|
||||
return h(App);
|
||||
}
|
||||
});
|
||||
export default vue;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,51 +2,38 @@ import Home from './views/home/Home.vue'
|
||||
|
||||
import UserLogin from './views/user/Login.vue'
|
||||
import UserMyInfo from './views/user/MyInfo.vue'
|
||||
import UserRouterView from './views/user/RouterView.vue'
|
||||
import CommonRouterView from './components/layouts/PageView'
|
||||
|
||||
import PageShow from './views/page/Show.vue'
|
||||
import PageEdit from './views/page/Edit.vue'
|
||||
import PageSearch from './views/page/Search.vue'
|
||||
import PageRouterView from './views/page/RouterView.vue'
|
||||
|
||||
import CommonNoAuth from './views/common/NoAuth.vue'
|
||||
|
||||
let routes = [
|
||||
{
|
||||
path: '/home',
|
||||
component: Home,
|
||||
name: '主页',
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
}
|
||||
}, {
|
||||
path: '/user',
|
||||
name: '用户管理',
|
||||
component: UserRouterView,
|
||||
children: [
|
||||
{path: 'login', name: '系统登录',component: UserLogin, meta: {fullscreen: true}},
|
||||
{path: 'myInfo', name: '我的信息',component: UserMyInfo},
|
||||
]
|
||||
}, {
|
||||
path: '/page',
|
||||
name: '页面',
|
||||
component: PageRouterView,
|
||||
children: [
|
||||
{path: 'show', name: '页面内容展示',component: PageShow},
|
||||
{path: 'edit', name: '编辑内容',component: PageEdit},
|
||||
{path: 'search', name: '全局搜索',component: PageSearch, meta: {fullscreen: true}},
|
||||
]
|
||||
}, {
|
||||
path: '/common',
|
||||
name: '',
|
||||
component: UserRouterView,
|
||||
children: [
|
||||
{path: 'noAuth', name: '没有权限',component: CommonNoAuth},
|
||||
]
|
||||
}, {
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
}
|
||||
{
|
||||
path: '/home',
|
||||
component: Home,
|
||||
name: '主页',
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
}
|
||||
}, {
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
}, {
|
||||
path: '/',
|
||||
name: '用户管理',
|
||||
component: CommonRouterView,
|
||||
children: [
|
||||
{path: '/user/login', name: '系统登录', component: UserLogin, meta: {fullscreen: true}},
|
||||
{path: '/user/myInfo', name: '我的信息', component: UserMyInfo},
|
||||
{path: '/page/show', name: '页面内容展示', component: PageShow},
|
||||
{path: '/page/edit', name: '编辑内容', component: PageEdit},
|
||||
{path: '/page/search', name: '全局搜索', component: PageSearch, meta: {fullscreen: true}},
|
||||
{path: '/common/noAuth', name: '没有权限', component: CommonNoAuth},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export default routes;
|
||||
|
||||
11
zyplayer-doc-ui/wiki-ui/src/store/index.js
Normal file
11
zyplayer-doc-ui/wiki-ui/src/store/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import global from './modules/global'
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
global,
|
||||
}
|
||||
});
|
||||
22
zyplayer-doc-ui/wiki-ui/src/store/modules/global.js
Normal file
22
zyplayer-doc-ui/wiki-ui/src/store/modules/global.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
pageTabNameMap: {},
|
||||
fullscreen: false,
|
||||
},
|
||||
getters: {
|
||||
getPageTabNameMap(state) {
|
||||
return state.pageTabNameMap;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
addTableName(state, item) {
|
||||
let sameObj = Object.assign({}, state.pageTabNameMap);
|
||||
sameObj[item.key] = item.val;
|
||||
state.pageTabNameMap = sameObj;
|
||||
},
|
||||
setFullscreen(state, val) {
|
||||
state.fullscreen = val;
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import ElementUI from 'element-ui'
|
||||
@@ -40,10 +40,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
|
||||
var app;
|
||||
import pageApi from '../../common/api/page'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -65,14 +62,13 @@
|
||||
},
|
||||
mounted: function () {
|
||||
this.initQueryParam(this.$route);
|
||||
app = this;
|
||||
},
|
||||
methods: {
|
||||
getSpacePageNews() {
|
||||
this.common.post(this.apilist1.pageNews, this.searchParam, function (json) {
|
||||
app.spacePageNews = json.data || [];
|
||||
app.totalCount = json.total;
|
||||
});
|
||||
pageApi.pageNews(this.searchParam).then(json => {
|
||||
this.spacePageNews = json.data || [];
|
||||
this.totalCount = json.total;
|
||||
});
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.searchParam.pageSize = val;
|
||||
|
||||
@@ -20,18 +20,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
import WangEditor from 'wangeditor'
|
||||
import pageApi from '../../common/api/page'
|
||||
|
||||
window.onunload = function () {
|
||||
app.unlockPage();
|
||||
};
|
||||
window.onbeforeunload = function () {
|
||||
app.unlockPage();
|
||||
};
|
||||
|
||||
var app;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -51,13 +42,19 @@
|
||||
next();
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.initEditor();
|
||||
this.initQueryParam(this.$route);
|
||||
let that = this;
|
||||
window.onunload = function () {
|
||||
that.unlockPage();
|
||||
};
|
||||
window.onbeforeunload = function () {
|
||||
that.unlockPage();
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeToRootPath() {
|
||||
app.parentPath = {spaceId: this.parentPath.spaceId};
|
||||
this.parentPath = {spaceId: this.parentPath.spaceId};
|
||||
},
|
||||
unlockPage() {
|
||||
// 防止各种事件重复调这个接口,只需要调一次就好了
|
||||
@@ -65,8 +62,9 @@
|
||||
return;
|
||||
}
|
||||
this.isUnlock = true;
|
||||
var param = {pageId: app.parentPath.pageId};
|
||||
this.common.post(this.apilist1.pageUnlock, param, function (json) {});
|
||||
var param = {pageId: this.parentPath.pageId};
|
||||
pageApi.pageUnlock(param).then(() => {
|
||||
});
|
||||
},
|
||||
createWikiCancel() {
|
||||
this.$confirm('确定要取消编辑吗?您编辑的内容将不会被保存哦~', '提示', {
|
||||
@@ -74,57 +72,57 @@
|
||||
cancelButtonText: '继续编辑',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
app.unlockPage();
|
||||
app.$router.back();
|
||||
this.unlockPage();
|
||||
this.$router.back();
|
||||
});
|
||||
},
|
||||
createWikiSave(saveAfter) {
|
||||
// 修改内容时强制不能修改父路径,只能在目录上拖动修改
|
||||
var parentId = (this.wikiPage.id > 0) ? '' : app.parentPath.parentId;
|
||||
if (this.common.isEmpty(app.newPageTitle)) {
|
||||
toast.warn("标题不能为空");
|
||||
var parentId = (this.wikiPage.id > 0) ? '' : this.parentPath.parentId;
|
||||
if (!this.newPageTitle) {
|
||||
this.$message.warning("标题不能为空");
|
||||
return;
|
||||
}
|
||||
var preview = this.editor.txt.text();
|
||||
var param = {
|
||||
spaceId: app.parentPath.spaceId,
|
||||
spaceId: this.parentPath.spaceId,
|
||||
parentId: parentId,
|
||||
id: app.wikiPage.id,
|
||||
name: app.newPageTitle,
|
||||
id: this.wikiPage.id,
|
||||
name: this.newPageTitle,
|
||||
content: this.editor.txt.html(),
|
||||
preview: preview,
|
||||
};
|
||||
this.common.post(this.apilist1.updatePage, param, function (json) {
|
||||
toast.success("保存成功!");
|
||||
pageApi.updatePage(param).then(json => {
|
||||
this.$message.success("保存成功!");
|
||||
// 重新加载左侧列表,跳转到展示页面
|
||||
global.vue.$app.doGetPageList(null);
|
||||
app.parentPath.pageId = json.data.id;
|
||||
this.$emit('loadPageList');
|
||||
this.parentPath.pageId = json.data.id;
|
||||
if (saveAfter == 1) {
|
||||
app.$router.push({path: '/page/show', query: app.parentPath});
|
||||
this.$router.push({path: '/page/show', query: this.parentPath});
|
||||
} else {
|
||||
app.loadPageDetail(app.parentPath.pageId);
|
||||
this.loadPageDetail(this.parentPath.pageId);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadPageDetail(pageId) {
|
||||
app.rightContentType = 1;
|
||||
this.rightContentType = 1;
|
||||
var param = {id: pageId};
|
||||
this.common.post(this.apilist1.pageDetail, param, function (json) {
|
||||
app.wikiPage = json.data.wikiPage || {};
|
||||
app.pageContent = json.data.pageContent || {};
|
||||
app.pageFileList = json.data.fileList || [];
|
||||
pageApi.pageDetail(param).then(json => {
|
||||
this.wikiPage = json.data.wikiPage || {};
|
||||
this.pageContent = json.data.pageContent || {};
|
||||
this.pageFileList = json.data.fileList || [];
|
||||
// 内容
|
||||
app.newPageTitle = app.wikiPage.name;
|
||||
app.editor.txt.html(app.pageContent.content || "");
|
||||
this.newPageTitle = this.wikiPage.name;
|
||||
this.editor.txt.html(this.pageContent.content || "");
|
||||
});
|
||||
},
|
||||
cleanPage() {
|
||||
app.wikiPage = {};
|
||||
app.pageContent = {};
|
||||
app.pageFileList = [];
|
||||
app.newPageTitle = "";
|
||||
if (!!app.editor.txt) {
|
||||
app.editor.txt.html("");
|
||||
this.wikiPage = {};
|
||||
this.pageContent = {};
|
||||
this.pageFileList = [];
|
||||
this.newPageTitle = "";
|
||||
if (!!this.editor.txt) {
|
||||
this.editor.txt.html("");
|
||||
}
|
||||
},
|
||||
initQueryParam(to) {
|
||||
@@ -137,13 +135,14 @@
|
||||
} else {
|
||||
this.cleanPage();
|
||||
}
|
||||
var param = {pageId: app.parentPath.pageId};
|
||||
this.common.postNonCheck(this.apilist1.pageLock, param, function (json) {
|
||||
let param = {pageId: this.parentPath.pageId};
|
||||
pageApi.pageLock(param).then(json => {
|
||||
if (json.errCode !== 200) {
|
||||
app.$alert(json.errMsg || '未知错误', '错误', {
|
||||
let that = this;
|
||||
this.$alert(json.errMsg || '未知错误', '错误', {
|
||||
confirmButtonText: '确定',
|
||||
callback: () => {
|
||||
app.$router.back();
|
||||
that.$router.back();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -151,7 +150,7 @@
|
||||
},
|
||||
initEditor() {
|
||||
this.editor = new WangEditor('#newPageContentDiv');
|
||||
this.editor.customConfig.uploadImgServer = this.apilist1.HOST + '/zyplayer-doc-wiki/common/wangEditor/upload';
|
||||
this.editor.customConfig.uploadImgServer = process.env.VUE_APP_BASE_API + '/zyplayer-doc-wiki/common/wangEditor/upload';
|
||||
this.editor.customConfig.zIndex = 100;
|
||||
this.editor.customConfig.uploadFileName = 'files';
|
||||
this.editor.customConfig.uploadImgMaxLength = 1;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
@@ -43,10 +43,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
|
||||
var app;
|
||||
import pageApi from '../../common/api/page'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -68,13 +65,12 @@
|
||||
},
|
||||
mounted: function () {
|
||||
this.initQueryParam(this.$route);
|
||||
app = this;
|
||||
},
|
||||
methods: {
|
||||
getSpacePageNews() {
|
||||
this.common.post(this.apilist1.pageSearchByEs, this.searchParam, function (json) {
|
||||
app.spacePageNews = json.data || [];
|
||||
app.totalCount = json.total;
|
||||
pageApi.pageSearchByEs(this.searchParam).then(json => {
|
||||
this.spacePageNews = json.data || [];
|
||||
this.totalCount = json.total;
|
||||
});
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
||||
@@ -132,9 +132,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
var app;
|
||||
import common from '../../common/lib/common'
|
||||
import pageApi from '../../common/api/page'
|
||||
import userApi from '../../common/api/user'
|
||||
var page = {
|
||||
colorArr: ["#67C23A", "#409EFF", "#E6A23C", "#F56C6C", "#909399", "#303133"],
|
||||
userHeadColor: {},
|
||||
@@ -168,24 +168,23 @@
|
||||
next();
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.initQueryParam(this.$route);
|
||||
if (!!this.parentPath.pageId) {
|
||||
// 延迟设置展开的目录,edit比app先初始化
|
||||
setTimeout(function () {
|
||||
if (!!app.parentPath.spaceId) {
|
||||
setTimeout(() => {
|
||||
if (!!this.parentPath.spaceId) {
|
||||
// 调用父方法切换选择的空间
|
||||
global.vue.$app.switchSpacePage(app.parentPath.spaceId);
|
||||
this.$emit('switchSpace', this.parentPath.spaceId);
|
||||
}
|
||||
global.vue.$app.changeWikiPageExpandedKeys(app.parentPath.pageId);
|
||||
this.$emit('changeExpandedKeys', this.parentPath.pageId);
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
editWiki() {
|
||||
var param = {pageId: app.parentPath.pageId};
|
||||
this.common.post(this.apilist1.pageLock, param, function (json) {
|
||||
app.$router.push({path: '/page/edit', query: app.parentPath});
|
||||
var param = {pageId: this.parentPath.pageId};
|
||||
pageApi.pageLock(param).then(() => {
|
||||
this.$router.push({path: '/page/edit', query: this.parentPath});
|
||||
});
|
||||
},
|
||||
getSearchUserList(query) {
|
||||
@@ -194,14 +193,14 @@
|
||||
}
|
||||
this.pageAuthUserLoading = true;
|
||||
var param = {search: query};
|
||||
this.common.post(this.apilist1.getUserBaseInfo, param, function (json) {
|
||||
app.searchUserList = json.data || [];
|
||||
app.pageAuthUserLoading = false;
|
||||
userApi.getUserBaseInfo(param).then(json => {
|
||||
this.searchUserList = json.data || [];
|
||||
this.pageAuthUserLoading = false;
|
||||
});
|
||||
},
|
||||
addPageAuthUser() {
|
||||
if (this.pageAuthNewUser.length <= 0) {
|
||||
toast.warn("请先选择用户");
|
||||
this.$message.warning("请先选择用户");
|
||||
return;
|
||||
}
|
||||
var userName = "";
|
||||
@@ -224,22 +223,22 @@
|
||||
this.pageAuthNewUser = "";
|
||||
},
|
||||
editWikiAuth() {
|
||||
app.pageAuthNewUser = [];
|
||||
app.pageAuthUserList = [];
|
||||
var param = {pageId: app.wikiPage.id};
|
||||
this.common.post(this.apilist1.getPageUserAuthList, param, function (json) {
|
||||
app.pageAuthUserList = json.data || [];
|
||||
app.pageAuthDialogVisible = true;
|
||||
this.pageAuthNewUser = [];
|
||||
this.pageAuthUserList = [];
|
||||
var param = {pageId: this.wikiPage.id};
|
||||
pageApi.getPageUserAuthList(param).then(json => {
|
||||
this.pageAuthUserList = json.data || [];
|
||||
this.pageAuthDialogVisible = true;
|
||||
});
|
||||
},
|
||||
saveUserPageAuth() {
|
||||
var param = {pageId: app.wikiPage.id, authList: JSON.stringify(app.pageAuthUserList)};
|
||||
this.common.post(this.apilist1.assignPageUserAuth, param, function (json) {
|
||||
toast.success("保存成功!");
|
||||
var param = {pageId: this.wikiPage.id, authList: JSON.stringify(this.pageAuthUserList)};
|
||||
pageApi.assignPageUserAuth(param).then(() => {
|
||||
this.$message.success("保存成功!");
|
||||
});
|
||||
},
|
||||
notOpen() {
|
||||
toast.notOpen();
|
||||
this.$message.warning("暂未开放");
|
||||
},
|
||||
deleteUserPageAuth(row) {
|
||||
var pageAuthUserList = [];
|
||||
@@ -257,63 +256,63 @@
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
var param = {pageId: app.wikiPage.id};
|
||||
this.common.post(this.apilist1.pageDelete, param, function (json) {
|
||||
var param = {pageId: this.wikiPage.id};
|
||||
pageApi.pageDelete(param).then(() => {
|
||||
// 重新加载左侧列表,跳转到展示页面
|
||||
global.vue.$app.doGetPageList(null);
|
||||
app.$router.push({path: '/home', query: {spaceId: app.wikiPage.spaceId}});
|
||||
this.$emit('loadPageList');
|
||||
this.$router.push({path: '/home', query: {spaceId: this.wikiPage.spaceId}});
|
||||
});
|
||||
}).catch(()=>{});
|
||||
},
|
||||
loadPageDetail(pageId) {
|
||||
app.rightContentType = 1;
|
||||
this.rightContentType = 1;
|
||||
var param = {id: pageId};
|
||||
this.common.post(this.apilist1.pageDetail, param, function (json) {
|
||||
pageApi.pageDetail(param).then(json => {
|
||||
var wikiPage = json.data.wikiPage || {};
|
||||
wikiPage.selfZan = json.data.selfZan || 0;
|
||||
app.wikiPage = wikiPage;
|
||||
app.pageContent = json.data.pageContent || {};
|
||||
app.pageFileList = json.data.fileList || [];
|
||||
app.uploadFormData = {pageId: app.wikiPage.id};
|
||||
app.parentPath.spaceId = wikiPage.spaceId;
|
||||
this.wikiPage = wikiPage;
|
||||
this.pageContent = json.data.pageContent || {};
|
||||
this.pageFileList = json.data.fileList || [];
|
||||
this.uploadFormData = {pageId: this.wikiPage.id};
|
||||
this.parentPath.spaceId = wikiPage.spaceId;
|
||||
// 修改最后点击的项,保证刷新后点击编辑能展示编辑的项
|
||||
// if (!app.lastClickNode.id) {
|
||||
// app.lastClickNode = {id: wikiPage.id, nodePath: wikiPage.name};
|
||||
// if (!this.lastClickNode.id) {
|
||||
// this.lastClickNode = {id: wikiPage.id, nodePath: wikiPage.name};
|
||||
// }
|
||||
});
|
||||
this.loadCommentList(pageId);
|
||||
},
|
||||
loadCommentList(pageId) {
|
||||
app.commentList = [];
|
||||
app.cancelCommentUser();
|
||||
this.commentList = [];
|
||||
this.cancelCommentUser();
|
||||
var param = {pageId: pageId};
|
||||
this.common.post(this.apilist1.pageCommentList, param, function (json) {
|
||||
pageApi.pageCommentList(param).then(json => {
|
||||
var commentList = json.data || [];
|
||||
for (var i = 0; i < commentList.length; i++) {
|
||||
commentList[i].color = app.getUserHeadBgColor(commentList[i].createUserId);
|
||||
commentList[i].color = this.getUserHeadBgColor(commentList[i].createUserId);
|
||||
var subCommentList = commentList[i].commentList || [];
|
||||
for (var j = 0; j < subCommentList.length; j++) {
|
||||
var subItem = subCommentList[j];
|
||||
subItem.color = app.getUserHeadBgColor(subItem.createUserId);
|
||||
subItem.color = this.getUserHeadBgColor(subItem.createUserId);
|
||||
}
|
||||
commentList[i].commentList = subCommentList;
|
||||
}
|
||||
app.commentList = commentList;
|
||||
this.commentList = commentList;
|
||||
});
|
||||
},
|
||||
zanPage(yn) {
|
||||
var param = {yn: yn, pageId: app.wikiPage.id};
|
||||
this.common.post(this.apilist1.updatePageZan, param, function (json) {
|
||||
app.wikiPage.selfZan = yn;
|
||||
app.wikiPage.zanNum = app.wikiPage.zanNum + (yn == 1 ? 1 : -1);
|
||||
var param = {yn: yn, pageId: this.wikiPage.id};
|
||||
pageApi.updatePageZan(param).then(() => {
|
||||
this.wikiPage.selfZan = yn;
|
||||
this.wikiPage.zanNum = this.wikiPage.zanNum + (yn == 1 ? 1 : -1);
|
||||
});
|
||||
},
|
||||
showZanPageUser() {
|
||||
app.zanUserDialogVisible = true;
|
||||
app.zanUserList = [];
|
||||
var param = {pageId: app.wikiPage.id};
|
||||
this.common.post(this.apilist1.pageZanList, param, function (json) {
|
||||
app.zanUserList = json.data;
|
||||
this.zanUserDialogVisible = true;
|
||||
this.zanUserList = [];
|
||||
var param = {pageId: this.wikiPage.id};
|
||||
pageApi.pageZanList(param).then(json => {
|
||||
this.zanUserList = json.data;
|
||||
});
|
||||
},
|
||||
recommentUser(id, index) {
|
||||
@@ -323,28 +322,28 @@
|
||||
this.recommentInfo = {};
|
||||
},
|
||||
submitPageComment() {
|
||||
if (app.commentTextInput.length <= 0) {
|
||||
toast.error("请输入评论内容");
|
||||
if (this.commentTextInput.length <= 0) {
|
||||
this.$message.error("请输入评论内容");
|
||||
return;
|
||||
}
|
||||
var param = {
|
||||
pageId: app.wikiPage.id, content: app.commentTextInput,
|
||||
parentId: app.recommentInfo.id
|
||||
pageId: this.wikiPage.id, content: this.commentTextInput,
|
||||
parentId: this.recommentInfo.id
|
||||
};
|
||||
this.common.post(this.apilist1.updatePageComment, param, function (json) {
|
||||
pageApi.updatePageComment(param).then(json => {
|
||||
var data = json.data;
|
||||
data.color = app.getUserHeadBgColor(data.createUserId);
|
||||
app.commentTextInput = "";
|
||||
app.commentList.push(data);
|
||||
data.color = this.getUserHeadBgColor(data.createUserId);
|
||||
this.commentTextInput = "";
|
||||
this.commentList.push(data);
|
||||
});
|
||||
},
|
||||
uploadFileError(err) {
|
||||
toast.error("上传失败," + err);
|
||||
this.$message.error("上传失败," + err);
|
||||
},
|
||||
uploadFileSuccess(response) {
|
||||
this.common.validateResult({data: response}, function () {
|
||||
app.pageFileList.push(response.data);
|
||||
toast.success("上传成功!");
|
||||
common.validateResult({data: response}).then(() => {
|
||||
this.pageFileList.push(response.data);
|
||||
this.$message.success("上传成功!");
|
||||
});
|
||||
},
|
||||
deletePageFile(row) {
|
||||
@@ -353,20 +352,20 @@
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
var param = {id: row.id, delFlag: 1};
|
||||
this.common.post(this.apilist1.updatePageFile, param, function (json) {
|
||||
var pageFileList = [];
|
||||
for (var i = 0; i < app.pageFileList.length; i++) {
|
||||
if (app.pageFileList[i].id != row.id) {
|
||||
pageFileList.push(app.pageFileList[i]);
|
||||
let param = {id: row.id, delFlag: 1};
|
||||
pageApi.updatePageFile(param).then(() => {
|
||||
let pageFileList = [];
|
||||
for (let i = 0; i < this.pageFileList.length; i++) {
|
||||
if (this.pageFileList[i].id != row.id) {
|
||||
pageFileList.push(this.pageFileList[i]);
|
||||
}
|
||||
}
|
||||
app.pageFileList = pageFileList;
|
||||
this.pageFileList = pageFileList;
|
||||
});
|
||||
});
|
||||
},
|
||||
getUserHeadBgColor(userId) {
|
||||
var color = page.userHeadColor[userId];
|
||||
let color = page.userHeadColor[userId];
|
||||
if (!color) {
|
||||
color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
||||
page.userHeadColor[userId] = color;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<template>
|
||||
<div style="padding-top: 50px;" class="user-login-vue">
|
||||
<div style="padding-top: 50px;">
|
||||
<el-form :model="loginParam" :rules="loginRules" ref="loginParam" label-position="left" label-width="0px"
|
||||
class="demo-ruleForm login-container">
|
||||
<h3 class="title">系统登录</h3>
|
||||
<el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-input type="text" v-model="loginParam.username" auto-complete="off" placeholder="账号" @keyup.enter="loginSubmit"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input type="password" v-model="loginParam.password" auto-complete="off" placeholder="密码" @keyup.enter="loginSubmit"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录
|
||||
</el-button>
|
||||
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录</el-button>
|
||||
<!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -19,6 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userApi from '../../common/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -44,14 +44,13 @@
|
||||
},
|
||||
methods: {
|
||||
loginSubmit() {
|
||||
var that = this;
|
||||
this.$refs.loginParam.validate((valid) => {
|
||||
if (!valid) return;
|
||||
that.common.post(that.apilist1.userLogin, that.loginParam, function (json) {
|
||||
if(!!that.redirect) {
|
||||
location.href = decodeURIComponent(that.redirect);
|
||||
userApi.userLogin(this.loginParam).then(() => {
|
||||
if (!!this.redirect) {
|
||||
location.href = decodeURIComponent(this.redirect);
|
||||
} else {
|
||||
that.$router.back();
|
||||
this.$router.back();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -61,7 +60,7 @@
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.user-login-vue .login-container {
|
||||
.login-container {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
@@ -73,12 +72,14 @@
|
||||
border: 1px solid #eaeaea;
|
||||
box-shadow: 0 0 25px #cac6c6;
|
||||
}
|
||||
.user-login-vue .title {
|
||||
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #505458;
|
||||
}
|
||||
.user-login-vue .remember {
|
||||
|
||||
.remember {
|
||||
margin: 0px 0px 35px 0px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<template>
|
||||
<div class="user-my-info-vue">
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>我的信息</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<div class="my-info-vue">
|
||||
<div style="margin: 0 auto;max-width: 1000px;">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">我的信息</div>
|
||||
@@ -21,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var app;
|
||||
import userApi from '../../common/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -29,13 +25,12 @@
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
this.common.post(this.apilist1.getSelfUserInfo, this.searchParam, function (json) {
|
||||
app.userInfo = json.data;
|
||||
userApi.getSelfUserInfo().then(json => {
|
||||
this.userInfo = json.data;
|
||||
});
|
||||
},
|
||||
}
|
||||
@@ -43,7 +38,7 @@
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.user-my-info-vue{}
|
||||
.user-my-info-vue .box-card{margin: 10px;}
|
||||
.my-info-vue{}
|
||||
.my-info-vue .box-card{margin: 10px;}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
12
zyplayer-doc-ui/wiki-ui/vue.config.js
Normal file
12
zyplayer-doc-ui/wiki-ui/vue.config.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
// 官方配置文档:https://webpack.js.org/configuration/dev-server/
|
||||
module.exports = {
|
||||
devServer: {
|
||||
hot: true,
|
||||
disableHostCheck: true,
|
||||
port: 80,
|
||||
host: 'local.zyplayer.com'
|
||||
},
|
||||
publicPath: './',
|
||||
productionSourceMap: false
|
||||
};
|
||||
@@ -1,75 +0,0 @@
|
||||
const resolve = require('path').resolve;
|
||||
const webpack = require('webpack');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const url = require('url');
|
||||
const publicPath = '';
|
||||
|
||||
module.exports = (options = {}) => ({
|
||||
entry: {
|
||||
vendor: './src/vendor',
|
||||
index: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: resolve(__dirname, 'dist'),
|
||||
filename: options.dev ? '[name].js' : 'doc-wiki-[name].js?[chunkhash]',
|
||||
chunkFilename: '[id].js?[chunkhash]',
|
||||
publicPath: options.dev ? '/assets/' : publicPath
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.vue$/,
|
||||
use: ['vue-loader']
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
use: ['babel-loader'],
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader', 'postcss-loader']
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
|
||||
use: [{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 800000
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
names: ['vendor', 'manifest']
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: options.dev ? 'src/index.html':'src/doc-wiki.html',
|
||||
filename: options.dev ? 'index.html':'doc-wiki.html',
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': resolve(__dirname, 'src')
|
||||
},
|
||||
extensions: ['.js', '.vue', '.json', '.css']
|
||||
},
|
||||
devServer: {
|
||||
host: 'local.zyplayer.com',
|
||||
port: 8010,
|
||||
proxy: {
|
||||
'/api/': {
|
||||
target: 'http://local.zyplayer.com:8080',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
historyApiFallback: {
|
||||
index: url.parse(options.dev ? '/assets/' : publicPath).pathname
|
||||
}
|
||||
},
|
||||
devtool: options.dev ? '#eval-source-map' : '#source-map'
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user