Commit 5f123201 authored by 李维's avatar 李维

更新

parent 05f50e69
h3[data-v-574af232]{margin:40px 0 0}ul[data-v-574af232]{list-style-type:none;padding:0}li[data-v-574af232]{display:inline-block;margin:0 10px}a[data-v-574af232]{color:#42b983}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;margin-top:60px} h3[data-v-574af232]{margin:40px 0 0}ul[data-v-574af232]{list-style-type:none;padding:0}li[data-v-574af232]{display:inline-block;margin:0 10px}a[data-v-574af232]{color:#42b983}.cascader-item{width:150px}.button-item{margin-left:10px}.current-selected-text{float:left;font-size:small}
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="./favicon.ico"> <link rel="icon" href="./favicon.ico">
<title>form_vue</title> <title>form_vue</title>
<script defer="defer" src="./js/chunk-vendors.3fe03ee5.js"></script> <script defer="defer" src="./js/chunk-vendors.1ee7d238.js"></script>
<script defer="defer" src="./js/app.c1409b13.js"></script> <script defer="defer" src="./js/app.70a4630e.js"></script>
<link href="./css/app.25c893d8.css" rel="stylesheet"> <link href="./css/chunk-vendors.10dd4e95.css" rel="stylesheet">
<link href="./css/app.041362fc.css" rel="stylesheet">
</head> </head>
<body><noscript><strong>We're sorry but form_vue doesn't work properly without JavaScript enabled. Please enable it to <body><noscript><strong>We're sorry but form_vue doesn't work properly without JavaScript enabled. Please enable it to
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"name": "form_vue", "name": "form_vue",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"axios": "^1.7.2",
"vue": "^2.6.14" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {
...@@ -1283,6 +1284,11 @@ ...@@ -1283,6 +1284,11 @@
"lodash": "^4.17.14" "lodash": "^4.17.14"
} }
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/at-least-node": { "node_modules/at-least-node": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz",
...@@ -1329,6 +1335,16 @@ ...@@ -1329,6 +1335,16 @@
"postcss": "^8.1.0" "postcss": "^8.1.0"
} }
}, },
"node_modules/axios": {
"version": "1.7.2",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.2.tgz",
"integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -1844,6 +1860,17 @@ ...@@ -1844,6 +1860,17 @@
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "8.3.0", "version": "8.3.0",
"resolved": "https://registry.npmmirror.com/commander/-/commander-8.3.0.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-8.3.0.tgz",
...@@ -2541,6 +2568,14 @@ ...@@ -2541,6 +2568,14 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/depd": { "node_modules/depd": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
...@@ -3125,7 +3160,6 @@ ...@@ -3125,7 +3160,6 @@
"version": "1.15.6", "version": "1.15.6",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.6.tgz", "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"dev": true,
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
...@@ -3141,6 +3175,19 @@ ...@@ -3141,6 +3175,19 @@
} }
} }
}, },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/forwarded": { "node_modules/forwarded": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz", "resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz",
...@@ -4416,7 +4463,6 @@ ...@@ -4416,7 +4463,6 @@
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
} }
...@@ -4425,7 +4471,6 @@ ...@@ -4425,7 +4471,6 @@
"version": "2.1.35", "version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"dependencies": { "dependencies": {
"mime-db": "1.52.0" "mime-db": "1.52.0"
}, },
...@@ -5811,6 +5856,11 @@ ...@@ -5811,6 +5856,11 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/pseudomap": { "node_modules/pseudomap": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"build": "vue-cli-service build" "build": "vue-cli-service build"
}, },
"dependencies": { "dependencies": {
"axios": "^1.7.2",
"vue": "^2.6.14" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {
......
<template> <template>
<div id="app"> <div id="app">
<img alt="Vue logo" src="./assets/logo.png"> <div v-show="data.metaSyllabusId" class="el-main">
<HelloWorld msg="Welcome to Your Vue.js App"/> <el-form label-width="120px">
<el-form-item label="绘本: ">
<el-cascader v-model="pidPath" :props="props" @change="handleSelectedChange"></el-cascader>
</el-form-item>
</el-form>
<el-form ref="form" :model="data" label-width="120px">
<el-form-item label="图片: ">
<el-input class="cascader-item" v-model="data.images"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('images')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.images == null" @click="handleClickViewCourseware(data.images)">查看</el-button>
</el-form-item>
<el-form-item label="音频: ">
<el-input class="cascader-item" v-model="data.audio"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('audio')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.audio == null" @click="handleClickViewCourseware(data.audio)">查看</el-button>
</el-form-item>
<el-form-item label="视频: ">
<el-input class="cascader-item" v-model="data.video"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('video')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.video == null" @click="handleClickViewCourseware(data.video)">查看</el-button>
</el-form-item>
<el-form-item label="视频讲解课: ">
<el-input class="cascader-item" v-model="data.tutoringVideo"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('tutoringVideo')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.tutoringVideo == null" @click="handleClickViewCourseware(data.tutoringVideo)">查看</el-button>
</el-form-item>
<el-form-item label="文字内容: ">
<el-input class="cascader-item" v-model="data.texts"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('texts')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.texts == null" @click="handleClickViewCourseware(data.texts)">查看</el-button>
</el-form-item>
<el-form-item label="点读配置: ">
<el-input class="cascader-item" v-model="data.pointReads"></el-input>
<el-button class="button-item" size="small" type="text" @click="handleClickSelectSyllabus('pointReads')">选择</el-button>
<el-button class="button-item" size="small" type="text" :disabled="data.pointReads == null" @click="handleClickViewCourseware(data.pointReads)">查看</el-button>
</el-form-item>
</el-form>
</div>
<el-dialog title="选择内容" :visible.sync="dialogSelectShow" width="500px">
<div class="el-main" style="height: 300px;">
<el-tree :data="treeListData" :props="treeProps" @node-click="handleClickTreeNode" :lazy="true" :load="handleLazyLoadTreeData"></el-tree>
</div>
<div slot="footer" class="dialog-footer">
<span class="current-selected-text">当前选择:{{ currentSelectTreeNode ? currentSelectTreeNode.name : "" }} - {{ currentSelectTreeNode ? currentSelectTreeNode.id : "" }}</span>
<el-button @click="handleClickCancelSelect">取 消</el-button>
<el-button type="primary" @click="handleClickConfirmSelect">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import HelloWorld from './components/HelloWorld.vue' import HelloWorld from './components/HelloWorld.vue'
import { getSyllabusListById, getFirstCoursewareBySyllId, getPidPathName } from '@/api/syllabus'
let id = 0;
export default { export default {
name: 'App', name: 'App',
components: { components: {
HelloWorld HelloWorld
}, },
created() { data() {
this.$setData("{a: 1}") return {
console.log('App created') // 选择内容对话框显示隐藏控制
this.$getData() dialogSelectShow: false,
// 树形列表数据
treeListData: [],
// 树形列表配置
treeProps: {
children: 'children',
label: 'name',
isLeaf: function(data, node) {
return data.has_courseware == "1";
}
},
// 当前选择的树形节点
currentSelectTreeNode: null,
// 打开选择框选择的key值
selectKey: null,
// 表单数据
data: {
parentId: null,
pid_path: null,
metaSyllabusId: null,
images: null,
audio: null,
video: null,
tutoringVideo: null,
texts: null,
pointReads: null,
pid_path: null
},
// 路径
pidPath: [],
// 级联选择器配置
props: {
lazy: true,
async lazyLoad(node, resolve) {
const { value } = node;
const resData = await getSyllabusListById(value)
const children = resData.rows.map(item => ({
value: item.id,
label: item.name,
leaf: item.has_courseware == "1"
}))
resolve(children)
}
}
};
},
async created() {
this.initData()
},
methods: {
// 获取数据
async initData() {
const data = await this.$getData()
if (data) {
this.data = data;
}
// this.pidPath = this.data.pid_path ? this.data.pid_path.split(',') : [];
},
// 选择基础绘本
async handleSelectedChange(value) {
this.data.pid_path = value.join(',');
this.data.metaSyllabusId = value[value.length - 1];
this.data.parentId = value[value.length - 2];
const resData = await getFirstCoursewareBySyllId(this.data.metaSyllabusId);
const parentData = await getSyllabusListById(this.data.parentId);
parentData.rows.forEach(item => {
if (item.name == "图片") {
this.data.images = item.id;
} else if (item.name == "音频") {
this.data.audio = item.id;
} else if (item.name == "视频") {
this.data.video = item.id;
} else if (item.name == "讲解视频") {
this.data.tutoringVideo = item.id;
} else if (item.name == "文字") {
this.data.texts = item.id;
} else if (item.name == "点读") {
this.data.pointReads = item.id;
}
})
this.$setData(this.data)
},
async handleClickSelectSyllabus(key) {
this.selectKey = key;
this.dialogSelectShow = true;
const resData = await getSyllabusListById()
this.treeListData = resData.rows;
// this.$getData().then(data => {
// this.treeListData = data.rows;
// console.log(this.treeListData)
// })
},
handleClickViewCourseware(syllabus_id) {
if(location.href.indexOf('localhost') > -1) {
window.open(`https://ema.iteachabc.com/cps/make?courseId=${syllabus_id}`, '_blank')
} else {
window.open(`./make?courseId=${syllabus_id}`, '_blank')
}
},
// 点击树形列表节点
handleClickTreeNode(node) {
if(node.has_courseware == "1") {
this.currentSelectTreeNode = node;
}
},
// 懒加载树形列表数据
handleLazyLoadTreeData(node, resolve) {
getSyllabusListById(node.data.id).then(data => {
resolve(data.rows)
})
},
// 取消选择
handleClickCancelSelect() {
this.dialogSelectShow = false;
this.treeListData = [];
this.currentSelectTreeNode = null;
this.selectKey = null;
},
// 确定选择
handleClickConfirmSelect() {
this.data[this.selectKey] = this.currentSelectTreeNode.id;
this.dialogSelectShow = false;
this.treeListData = [];
this.currentSelectTreeNode = null;
this.selectKey = null;
},
} }
} }
</script> </script>
<style> <style>
#app { #app {}
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; .cascader-item {
-moz-osx-font-smoothing: grayscale; width: 150px;
text-align: center; }
color: #2c3e50;
margin-top: 60px; .button-item {
margin-left: 10px;
}
.current-selected-text {
float: left;
font-size: small;
} }
</style> </style>
import axios from "axios";
const org = 523;
const dpe_root = 275931;
const base_url = "https://ema.iteachabc.com/api/syllabus/v1";
export const getSyllabusListById = (syllabus_id) => {
return new Promise(async (resolve, reject) => {
const res = await axios.get(`${base_url}/list?orgid=${org}&pid=${syllabus_id?syllabus_id:dpe_root}`);
resolve(res.data);
})
}
export const getFirstCoursewareBySyllId = (syllabus_id) => {
return new Promise(async (resolve, reject) => {
const res = await axios.get(`${base_url}/getdata?syllabusid=${syllabus_id}`);
resolve(res.data);
})
}
export const getCoursewarePageBySyllId = (syllabus_id, page) => {
return new Promise(async (resolve, reject) => {
const res = await axios.get(`${base_url}/getpagedata?syllabusid=${syllabus_id}&page=${page}`);
resolve(res.data);
})
}
export const getAllCoursewareBySyllId = (syllabus_id) => {
return new Promise(async (resolve, reject) => {
const res = await axios.get(`${base_url}/getdatalist?syllabusids=${syllabus_id}`);
resolve(res.data);
})
}
export const getPidPathName = (pid_path) => {
return new Promise(async (resolve, reject) => {
const res = await axios.get(`${base_url}/pathname?pid_path=${pid_path}`);
resolve(res.data);
})
}
\ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue' import App from './App.vue'
Vue.use(ElementUI);
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$getData = () => { Vue.prototype.$getData = () => {
(window).courseware.getData((data) => { return new Promise((resolve, reject) => {
console.log('getData') (window).courseware.getData((data) => {
console.log(data) resolve(data)
}, "default_key")
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment