提交 af2e5356 编写于 作者: Yuanzhao.dai's avatar Yuanzhao.dai

Merge branch 'dev-eduadmin-20190222' into dev-followUp-20190312

......@@ -95,14 +95,8 @@ export default {
// 获取用户权限
getUserAuth(token) {
let req = null
if(localStorage.getItem('storageToken')) {
req = {
token: localStorage.getItem('storageToken')
}
} else {
req = {
token: token
}
req = {
token: token
}
vm.GET('common/v1/role',req).then((res) => {
if(res.code == '000000') {
......
......@@ -8,6 +8,7 @@ const createComponent = r => require.ensure([], () => r(require('../views/educat
const roleManager = r => require.ensure([], () => r(require('../views/system/role.vue')),'role')
const addManager = r => require.ensure([], () => r(require('../views/education/add-manager.vue')), 'add-manager')
const itemRole = r => require.ensure([], () => r(require('../views/system/item-role.vue')), 'item-role')
const tree = r => require.ensure([], () => r(require('../views/education/tree.vue')), 'tree')
import followRouters from './follow'
......@@ -45,6 +46,9 @@ export default [{
},{
path: '/item-role',
component: itemRole
},{
path: '/tree',
component: tree
},
followRouters,
]
......
import * as types from './mutations-types'
export const changeToken = ({commit}, data) => {
commit(types.TOKEN, data)
}
export const changeIdType = ({commit}, data) => {
commit(types.ID_TYPE, data)
}
\ No newline at end of file
export const _token = state => state._token
export const idType = state => state.idType
const getters = {
_token: state => state.common._token,
idType: state => state.common.idType
}
export default getters
import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import state from './state'
import mutations from './mutations'
import common from './modules/common'
import getters from './getters'
Vue.use(Vuex)
export default new Vuex.Store({
actions,
getters,
state,
mutations,
modules: {
common
},
getters
})
const common = {
state: {
_token: '',
idType: ''
},
mutations: {
CHANGE_TOKEN: (state, data) => {
state._token = data
},
CHANGE_IDTYPE: (state, data) => {
state.idType = data
}
},
actions: {
changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData)
},
changeIdType({ commit }, idTypeData) {
commit('CHANGE_IDTYPE', idTypeData)
}
}
}
export default common
\ No newline at end of file
export const TOKEN = 'TOKEN'
export const ID_TYPE = 'ID_TYPE'
\ No newline at end of file
import * as types from './mutations-types'
const mutations = {
[types.TOKEN](state, tokenData) {
state._token = tokenData
},
[types.ID_TYPE](state, idTypeData) {
state.idType = idTypeData
}
}
export default mutations
\ No newline at end of file
const state = {
_token: '',
idType: ''
}
export default state
\ No newline at end of file
......@@ -6,17 +6,10 @@ export const envConfig = {
// baseUrl: 'https://dev-sc.yunqueyi.com/',
// // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/',
// apiUrl: 'https://dev-api.yunqueyi.com/',
// webPageUrl: 'https://dev-phome.yunqueyi.com/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// apiUrl: 'https://test1-api.yunqueyi.com/',
// webPageUrl: 'https://test1-phome.yunqueyi.com/'
// baseUrl: 'https://test1-sc.yunqueyi.com/',
//baseUrl: 'https://uat-sc.yunqueyi.com/',
baseUrl: 'http://192.168.110.226:11905/portal/',
apiUrl: 'https://uat-api.yunqueyi.com/',
webPageUrl: 'https://uat-phome.yunqueyi.com/',
qiniuUrl: "http://localhost:10201/contents/admin/qiniu/token",
baseUrl: 'http://localhost:11905/portal/',
qiniuFileUrl: "http://localhost:10201/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
......@@ -27,10 +20,7 @@ export const envConfig = {
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/portal/',
apiUrl: 'https://dev-api.yunqueyi.com/',
webPageUrl: 'https://dev-phome.yunqueyi.com/',
qiniuUrl: "http://localhost:11905/contents/admin/qiniu/token",
qiniuFileUrl: "http://localhost:11905/contents/admin/qiniu/token1",
qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
......@@ -39,9 +29,6 @@ export const envConfig = {
},
test: {
baseUrl: 'https://test1-sc.yunqueyi.com/portal/',
apiUrl: 'https://test1-api.yunqueyi.com/',
webPageUrl: 'https://test1-phome.yunqueyi.com/',
qiniuUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
......@@ -51,9 +38,6 @@ export const envConfig = {
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/portal/',
apiUrl: 'https://uat-api.yunqueyi.com/',
webPageUrl: 'https://uat-phome.yunqueyi.com/',
qiniuUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://videos.yunqueyi.com", // 视频
qiniuImgUrl: "https://file.yunqueyi.com",
......@@ -63,9 +47,6 @@ export const envConfig = {
},
pro: {
baseUrl: 'https://sc.yunqueyi.com/portal/',
apiUrl: 'https://api.yunqueyi.com/',
webPageUrl: 'https://phome.yunqueyi.com/',
qiniuUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://videos.yunqueyi.com",
qiniuImgUrl: "https://file.yunqueyi.com",
......
......@@ -146,20 +146,7 @@ export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url
}
// 获取API服务器域名地址
export function getApiUrl(url) {
return getConfigByEnvType('apiUrl') + url
}
// 获取WEB部署服务器域名地址
export function getWebPageUrl(url) {
return getConfigByEnvType('webPageUrl') + url
}
// 获取七牛token
export function getQiniuToken() {
return getConfigByEnvType('qiniuUrl')
}
export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl')
}
......
import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index'
import { getBaseUrl } from '@/utils/index'
module.exports = {
data: function () {
......@@ -175,27 +175,6 @@ module.exports = {
})
},
// 通用GET请求
API_GET(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
let url = api + this.getUrlPara(para)
return fetch({
url: getApiUrl(url),
method: 'get',
data: para
})
},
// 通用POST请求
API_POST(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
return fetch({
url: getApiUrl(api),
method: 'post',
data: para
})
},
// 从html参数
getUrlKey(name) {
if (decodeURIComponent && location.href) {
......@@ -219,7 +198,7 @@ module.exports = {
}
}
return null
},
}
}
}
import {isEmptyUtils, isNotEmptyUtils, subString} from "./utils";
import fetchQiniu from './fetchQiniu.js';
import { getQiniuToken, getQiniuToken1, uploadVideo, uploadImg } from './index'
import { getQiniuToken1, uploadVideo, uploadImg } from './index'
// let apiUrl = localStorage.getItem("qiniuUrl");
// let fileApiUrl = localStorage.getItem("qiniuFileUrl");
let apiUrl = getQiniuToken()
let fileApiUrl = getQiniuToken1()
//该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
let subscription = null;
......@@ -82,32 +78,6 @@ export const createFilePath = (file, fileName) => {
return filePath;
};
/**
* 获取七牛上传凭证
*
* @return {Promise} token 七牛上传凭证
* */
const doQiniuAction = () => {
console.log('send---'+apiUrl);
return new Promise(function (resolve, reject) {
fetchQiniu(apiUrl,{}, 'GET').then(function (result) {
let token = null;
if (isNotEmptyUtils(result) && result.code == "000000") {
token = result.data.qiniuToken;
resolve(token);
console.log('七牛临时授权成功');
localStorage.setItem('qiniuToken',token);
} else {
reject(result);
console.error('七牛临时授权失败:', result);
}
}).catch(function (error) {
reject();
console.error('七牛临时授权失败:', error);
});
});
};
/**
* 获取七牛上传凭证
*
......
此差异已折叠。
......@@ -306,7 +306,7 @@ export default {
message: "ID为:" + row.id + "的项目删除成功"
});
this.loading = true;
that.getProjectList();
vm.getProjectList();
}
});
},
......
<template>
<div>
<el-tree
:data="data2"
show-checkbox
default-expand-all
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
@check="onChecked"
></el-tree>
<!-- <base1
:data="data2"
show-checkbox
default-expand-all
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
></base1>-->
<span></span>
<div class="buttons">
<el-button @click="getCheckedNodes">通过 node 获取</el-button>
<el-button @click="getCheckedKeys">通过 key 获取</el-button>
<el-button @click="setCheckedNodes">通过 node 设置</el-button>
<el-button @click="setCheckedKeys">通过 key 设置</el-button>
<el-button @click="resetChecked">清空</el-button>
</div>
</div>
</template>
<script>
import { ELTree1 } from "element-ui/lib/checkbox";
// import Vue from 'vue'
// require("element-ui/lib/checkbox"
export default {
// components: {
// base1
// },
mounted() {
// const base1 = Vue.extend(ELTree)
// Vue.component('base1', base1)
},
data() {
return {
data2: [
{
id: 11,
label: "一级 1",
children: [
{
id: 1,
label: "一级 1",
children: [
{
id: 4,
label: "二级 1-1",
children: [
{
id: 9,
label: "三级 1-1-1"
},
{
id: 10,
label: "三级 1-1-2"
}
]
}
]
},
{
id: 2,
label: "一级 2",
children: [
{
id: 5,
label: "二级 2-1"
},
{
id: 6,
label: "二级 2-2"
}
]
},
{
id: 3,
label: "一级 3",
children: [
{
id: 7,
label: "二级 3-1"
},
{
id: 8,
label: "二级 3-2"
}
]
}
]
}
],
defaultProps: {
children: "children",
label: "label"
}
};
},
methods: {
getCheckedNodes() {
console.log(this.$refs.tree.getCheckedNodes());
},
getCheckedKeys() {
console.log(this.$refs.tree.getCheckedKeys());
},
setCheckedNodes() {
this.$refs.tree.setCheckedNodes([
{
id: 5,
label: "二级 2-1"
},
{
id: 9,
label: "三级 1-1-1"
}
]);
},
setCheckedKeys() {
this.$refs.tree.setCheckedKeys([3]);
},
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
},
onChecked() {
let cData = [],
oldData = (this.data2.length && this.data2.slice()) || [],
checkedKeys = this.$refs.tree.getCheckedKeys(),
halfCheckedKeys = this.$refs.tree.getHalfCheckedKeys(),
savedCheckedKeys = this.handlerCheckedData(oldData, checkedKeys).map(
key => {
return { type: 2, key: key };
}
),
savedHalfCheckedKeys = halfCheckedKeys.map(key => {
return { type: 1, key: key };
}),
allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
console.log("treeData", this.data2);
console.log(allSelectedKeys);
},
// 递归删除列表中所有子节点
delSubKeysByNode(node, checkedKeys) {
let idIndex;
if (node.children && node.children.length) {
if (node.children && node.children.length) {
node.children.forEach(elm => {
idIndex = checkedKeys.findIndex(id => {
return id === elm.id;
});
if (idIndex > -1) {
checkedKeys.splice(idIndex, 1);
}
if (elm.children && elm.children.length) {
this.delSubKeysByNode(elm, checkedKeys);
}
});
}
}
},
// 去除子节点
handlerCheckedData(oldData, checkedKeys) {
oldData.forEach(element => {
for (let i = 0; i < checkedKeys.length; i++) {
// 如果此节点被选中,则删除所有子节点
if (element.id === checkedKeys[i]) {
this.delSubKeysByNode(element, checkedKeys);
} else {
if (element.children && element.children.length) {
this.handlerCheckedData(element.children, checkedKeys);
}
}
}
});
return checkedKeys;
}
}
};
</script>
\ No newline at end of file
......@@ -59,24 +59,7 @@ export default {
spanSecondNum: 12,
tableData: [],
count: 0,
messageList:[
// {
// menuName: '审核提醒',
// type: 1,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核未通过',
// type: 2,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核通过',
// type: 3,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// }
]
messageList:[]
}
},
created() {
......
......@@ -57,6 +57,11 @@ export default {
title: '项目管理',
icon: 'el-icon-setting',
index: 'item-manager'
},
{
title: '树',
icon: 'el-icon-setting',
index: 'tree'
}
]
},{
......
......@@ -48,10 +48,12 @@ let treeData = [
id: 11,
name: "一级 1",
label: "一级 1",
isLeaf: "true",
children: [
{
id: 1,
label: "一级 1",
isLeaf: "true",
children: [
{
id: 4,
......@@ -75,14 +77,21 @@ let treeData = [
children: [
{
id: 5,
label: "二级 2-1"
label: "二级 2-1",
children: [],
},
{
id: 6,
label: "二级 2-2"
label: "二级 2-2",
isLeaf: false,
}
]
},
{
id: 4,
label: "一级 4",
isLeaf: false,
},
{
id: 3,
label: "一级 3",
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册