Commit edad743b authored by wangwei's avatar wangwei

编写

parent 7738ab17
...@@ -5,7 +5,7 @@ const prodEnv = require('./prod.env'); ...@@ -5,7 +5,7 @@ const prodEnv = require('./prod.env');
module.exports = merge(prodEnv, { module.exports = merge(prodEnv, {
NODE_ENV: '"development"', NODE_ENV: '"development"',
API_URL: '"/"', API_URL: '"/"',
MAX_FILESIZE:'1024*1024*5', MAX_FILESIZE:'1024*1024*10',
IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"', IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"',
INVITE_URL:'"http://wechat.test.singsingenglish.com"', INVITE_URL:'"http://wechat.test.singsingenglish.com"',
}); });
...@@ -3,5 +3,5 @@ module.exports = { ...@@ -3,5 +3,5 @@ module.exports = {
NODE_ENV: '"production"', NODE_ENV: '"production"',
IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"', IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"',
API_URL: '"/"', API_URL: '"/"',
MAX_FILESIZE:'1024*1024*5', MAX_FILESIZE:'1024*1024*10',
} }
...@@ -6,5 +6,5 @@ module.exports = merge(prodEnv, { ...@@ -6,5 +6,5 @@ module.exports = merge(prodEnv, {
NODE_ENV: '"production"', NODE_ENV: '"production"',
IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"', IMAGE_URL_HEAD:'"http://cdn.singsingenglish.com/"',
API_URL: '"/"', API_URL: '"/"',
MAX_FILESIZE:'1024*1024*5', MAX_FILESIZE:'1024*1024*10',
}) })
src/assets/mould/refueling1/radio.png

8.99 KB | W: | H:

src/assets/mould/refueling1/radio.png

3.89 KB | W: | H:

src/assets/mould/refueling1/radio.png
src/assets/mould/refueling1/radio.png
src/assets/mould/refueling1/radio.png
src/assets/mould/refueling1/radio.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
<el-container> <el-container>
<el-header height="80px"> <el-header height="80px">
<div class="head-top"> <div class="head-top">
<el-button size="mini">
课程基本信息编辑
</el-button>
缩放:<el-input-number v-model="bigNum" size="mini" :min="30" :max="150" :step="10"></el-input-number> 缩放:<el-input-number v-model="bigNum" size="mini" :min="30" :max="150" :step="10"></el-input-number>
<el-button size="mini" type="success" style="float: right" @click="setOpen()"> <el-button size="mini" type="success" style="float: right" @click="setOpen()">
编辑当前页参数 编辑当前页参数
...@@ -31,6 +28,7 @@ ...@@ -31,6 +28,7 @@
</div> </div>
</el-aside> </el-aside>
<el-main> <el-main>
<!--爸妈看一看1-->
<div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'look1'"> <div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'look1'">
<div class="look1" :style="{backgroundImage:`url(${mouldImg.look1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}"> <div class="look1" :style="{backgroundImage:`url(${mouldImg.look1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}">
<div class="bg-block"> <div class="bg-block">
...@@ -70,6 +68,7 @@ ...@@ -70,6 +68,7 @@
</div> </div>
</div> </div>
</div> </div>
<!--音频1-->
<div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'radio1'"> <div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'radio1'">
<div class="look1 radio1" :style="{backgroundImage:`url(${selectedMould[nowIndex].content.titleType === 0 ? mouldImg.radio1.bg:mouldImg.radio1.moerduoBg}`,transform:`scale(${bigNum/100},${bigNum/100})`}"> <div class="look1 radio1" :style="{backgroundImage:`url(${selectedMould[nowIndex].content.titleType === 0 ? mouldImg.radio1.bg:mouldImg.radio1.moerduoBg}`,transform:`scale(${bigNum/100},${bigNum/100})`}">
<div class="bg-block" :style="{backgroundImage:`url(${mouldImg.radio1.contentBg}`}"> <div class="bg-block" :style="{backgroundImage:`url(${mouldImg.radio1.contentBg}`}">
...@@ -117,11 +116,15 @@ ...@@ -117,11 +116,15 @@
</div> </div>
</div> </div>
</div> </div>
<!--视频玩一玩1-->
<div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'play1'"> <div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'play1'">
<div class="look1 play1" :style="{backgroundImage:`url(${mouldImg.play1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}"> <div class="look1 play1" :style="{backgroundImage:`url(${mouldImg.play1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}">
<div class="bg-block"> <div class="bg-block">
<div class="video-block"> <div class="video-block">
<img :src="mouldImg.play1.play"/> <div class="icon-class">
<img :src="mouldImg.play1.play"/>
</div>
<video v-if="selectedMould[nowIndex].content.videoUrl.length > 0" :poster="selectedMould[nowIndex].content.banner[0].url" :src="selectedMould[nowIndex].content.videoUrl[0].url"></video>
</div> </div>
<img :src="mouldImg.play1.radio" class="radio-img"/> <img :src="mouldImg.play1.radio" class="radio-img"/>
<img :src="mouldImg.play1.backBtn" class="btn back"/> <img :src="mouldImg.play1.backBtn" class="btn back"/>
...@@ -129,6 +132,7 @@ ...@@ -129,6 +132,7 @@
</div> </div>
</div> </div>
</div> </div>
<!--爸妈秀宝贝1-->
<div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'show1'"> <div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'show1'">
<div class="look1 show1" :style="{backgroundImage:`url(${mouldImg.show1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}"> <div class="look1 show1" :style="{backgroundImage:`url(${mouldImg.show1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}">
<img :src="mouldImg.show1.haiou" class="haiou"/> <img :src="mouldImg.show1.haiou" class="haiou"/>
...@@ -149,7 +153,7 @@ ...@@ -149,7 +153,7 @@
</div> </div>
<div class="text-block"> <div class="text-block">
解释说明: 解释说明:
<div class="text-content">1231231231</div> <div class="text-content" v-html="selectedMould[nowIndex].content.text"></div>
</div> </div>
<div class="sub-block"> <div class="sub-block">
<img :src="mouldImg.show1.subBtn"> <img :src="mouldImg.show1.subBtn">
...@@ -161,169 +165,305 @@ ...@@ -161,169 +165,305 @@
</div> </div>
</div> </div>
</div> </div>
<!--唱学加油包1-->
<div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'refueling1'"> <div v-if="selectedMould[nowIndex] && selectedMould[nowIndex].key === 'refueling1'">
<div class="look1 refueling1" :style="{backgroundImage:`url(${mouldImg.refueling1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}"> <div class="look1 refueling1" :style="{backgroundImage:`url(${mouldImg.refueling1.bg}`,transform:`scale(${bigNum/100},${bigNum/100})`}">
<div class="bg-block"> <div class="bg-block">
<img :src="mouldImg.refueling1.title"> <img :src="mouldImg.refueling1.title">
<div class="content-img"> <div class="content-img" :style="{backgroundImage:selectedMould[nowIndex].content.banner[0] ? `url(${selectedMould[nowIndex].content.banner[0].url}`:''}">
<img :src="mouldImg.refueling1.radio" class="radio-icon"> <img :src="mouldImg.refueling1.radio" class="radio-icon">
</div> </div>
</div> </div>
<div class="bottom-block"> <div class="bottom-block">
<img :src="mouldImg.refueling1.backBtn"/> <img :src="mouldImg.refueling1.backBtn"/>
<img :src="mouldImg.refueling1.next"/> <img :src="mouldImg.refueling1.next" v-if="selectedMould[nowIndex].content.nextType"/>
</div> </div>
</div> </div>
</div> </div>
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
<el-dialog <el-dialog
title="编辑" title="编辑"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:modal="false" :modal="false"
width="30%"> width="30%">
<el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'look1'"> <!--爸妈看一看1-->
<el-form-item label="音频"> <el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'look1'">
<el-upload <el-form-item label="音频">
class="upload-demo" <el-upload
action="/api/public/upload" class="upload-demo"
multiple action="/api/public/upload"
:limit="1" multiple
:on-exceed="handleExceed" :limit="1"
:on-success="uploadSuccess" :on-exceed="handleExceed"
:file-list="selectedMould[nowIndex].content.radioUrl"> :on-success="uploadSuccess"
<el-button size="small" type="primary">点击上传</el-button> :file-list="selectedMould[nowIndex].content.radioUrl">
</el-upload> <el-button size="small" type="primary">点击上传</el-button>
</el-form-item> </el-upload>
<el-form-item label="今日目标"> </el-form-item>
<el-input type="textarea" v-model="selectedMould[nowIndex].content.today" placeholder="今日目标换行输入<br>"></el-input> <el-form-item label="今日目标">
</el-form-item> <el-input type="textarea" v-model="selectedMould[nowIndex].content.today" placeholder="今日目标换行输入<br>"></el-input>
<el-form-item label="陪玩指南"> </el-form-item>
<el-input type="textarea" v-model="selectedMould[nowIndex].content.directory" placeholder="陪玩指南换行输入<br>"></el-input> <el-form-item label="陪玩指南">
</el-form-item> <el-input type="textarea" v-model="selectedMould[nowIndex].content.directory" placeholder="陪玩指南换行输入<br>"></el-input>
<el-form-item label="下一页序号"> </el-form-item>
<el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择"> <el-form-item label="下一页序号">
<el-option <el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择">
v-for="(item,index) in selectedMould" <el-option
:key="index" v-for="(item,index) in selectedMould"
:label="index" :key="index"
:value="index"> :label="index"
</el-option> :value="index">
</el-select> </el-option>
</el-form-item> </el-select>
<el-form-item label="停留时长"> </el-form-item>
<el-input-number v-model="selectedMould[nowIndex].content.timeLang"></el-input-number> <el-form-item label="停留时长">
</el-form-item> <el-input-number v-model="selectedMould[nowIndex].content.timeLang"></el-input-number>
</el-form> </el-form-item>
<el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'radio1'"> </el-form>
<el-form-item label="音频"> <!--音频1-->
<el-upload <el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'radio1'">
class="upload-demo" <el-form-item label="音频">
action="/api/public/upload" <el-upload
multiple class="upload-demo"
:on-exceed="handleExceed" action="/api/public/upload"
:on-success="uploadSuccessRadio1" multiple
:file-list="selectedMould[nowIndex].content.radio"> :on-exceed="handleExceed"
<el-button size="small" type="primary">点击上传</el-button> :on-success="uploadSuccessRadio1"
</el-upload> :file-list="selectedMould[nowIndex].content.radio">
</el-form-item> <el-button size="small" type="primary">点击上传</el-button>
<div v-for="(data,index) in selectedMould[nowIndex].content.radio"> </el-upload>
<el-form-item label="音频名字"> </el-form-item>
<el-input v-model="data.title" placeholder="请输入音频显示标题"></el-input> <div v-for="(data,index) in selectedMould[nowIndex].content.radio">
<el-form-item label="音频名字">
<el-input v-model="data.title" placeholder="请输入音频显示标题"></el-input>
</el-form-item>
<el-form-item label="音频作者">
<el-input v-model="data.lable" placeholder="请输入音频来源作者"></el-input>
</el-form-item>
</div>
<el-form-item label="上一步序号">
<el-select v-model="selectedMould[nowIndex].content.lastIndex" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="下一步序号">
<el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题类型">
<el-select v-model="selectedMould[nowIndex].content.titleType" placeholder="请选择">
<el-option
:value="0"
label="宝贝玩一玩">
</el-option>
<el-option
:value="1"
label="磨耳朵">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="按钮组">
<el-select v-model="selectedMould[nowIndex].content.buttonType" placeholder="请选择">
<el-option
:value="0"
label="返回看一看 + 爸妈秀宝贝">
</el-option>
<el-option
:value="1"
label="返回玩一玩 + 完成今日学习">
</el-option>
<el-option
:value="2"
label="上一页 + 完成今日学习">
</el-option>
<el-option
:value="3"
label="返回玩一玩 + 下一页">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="视频切换">
<el-switch v-model="selectedMould[nowIndex].content.tabVideo.type">
</el-switch>
</el-form-item>
<el-form-item label="视频目标" v-if="selectedMould[nowIndex].content.tabVideo.type">
<el-select v-model="selectedMould[nowIndex].content.tabVideo.index" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="停留时长">
<el-input-number v-model="selectedMould[nowIndex].content.timeLang"></el-input-number>
</el-form-item>
</el-form>
<!--视频玩一玩1-->
<el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'play1'">
<el-form-item label="视频">
<el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFile"
multiple
:limit="1"
:disabled="(fileUid && progress < 99)"
:file-list="selectedMould[nowIndex].content.radio">
<el-button size="small" type="primary" :disabled="(fileUid && progress < 99)">点击上传</el-button>
<div style="width: 300px">
<el-progress v-if="fileUid" :percentage="progress"></el-progress>
</div>
</el-upload>
</el-form-item>
<el-form-item label="视频封面">
<el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileVideo1Banner"
list-type="picture-card"
multiple
:limit="1"
:disabled="(fileUid && progress < 99)"
:file-list="selectedMould[nowIndex].content.radio">
</el-upload>
</el-form-item>
<el-form-item label="是否切换">
<el-switch v-model="selectedMould[nowIndex].content.tabRadio.type">
</el-switch>
</el-form-item>
<el-form-item label="切换目标" v-if="selectedMould[nowIndex].content.tabRadio.type">
<el-select v-model="selectedMould[nowIndex].content.tabRadio.index" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="上一步序号">
<el-select v-model="selectedMould[nowIndex].content.lastIndex" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="下一步序号">
<el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
</el-form>
<!--爸妈秀宝贝1-->
<el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'refueling1'">
<el-form-item label="音频">
<el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileRadio"
multiple
:limit="1"
:disabled="(fileUid && progress < 99)"
:file-list="selectedMould[nowIndex].content.radio">
<el-button size="small" type="primary" :disabled="(fileUid && progress < 99)">点击上传</el-button>
<div style="width: 300px">
<el-progress v-if="fileUid" :percentage="progress"></el-progress>
</div>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="音频作者"> <el-form-item label="图片">
<el-input v-model="data.lable" placeholder="请输入音频来源作者"></el-input> <el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileVideo1Banner"
list-type="picture-card"
multiple
:limit="1"
:disabled="(fileUid && progress < 99)"
:file-list="selectedMould[nowIndex].content.radio">
</el-upload>
</el-form-item> </el-form-item>
</div> <el-form-item label="上一步序号">
<el-form-item label="上一步序号"> <el-select v-model="selectedMould[nowIndex].content.lastIndex" placeholder="请选择">
<el-select v-model="selectedMould[nowIndex].content.lastIndex" placeholder="请选择"> <el-option
<el-option v-for="(item,index) in selectedMould"
v-for="(item,index) in selectedMould" :key="index"
:key="index" :label="index"
:label="index" :value="index">
:value="index"> </el-option>
</el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="下一页">
<el-form-item label="下一步序号"> <el-switch v-model="selectedMould[nowIndex].content.nextType">
<el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择"> </el-switch>
<el-option </el-form-item>
v-for="(item,index) in selectedMould" <el-form-item label="下一步序号" v-if="selectedMould[nowIndex].content.nextType">
:key="index" <el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择">
:label="index" <el-option
:value="index"> v-for="(item,index) in selectedMould"
</el-option> :key="index"
</el-select> :label="index"
</el-form-item> :value="index">
<el-form-item label="标题类型"> </el-option>
<el-select v-model="selectedMould[nowIndex].content.titleType" placeholder="请选择"> </el-select>
<el-option </el-form-item>
:value="0" </el-form>
label="宝贝玩一玩"> <!--唱学加油包1-->
</el-option> <el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'show1'">
<el-option <el-form-item label="说明文字">
:value="1" <el-input type="textarea" :rows="3" v-model="selectedMould[nowIndex].content.text"></el-input>
label="磨耳朵"> </el-form-item>
</el-option> <el-form-item label="解锁限制">
</el-select> <el-switch v-model="selectedMould[nowIndex].content.check">
</el-form-item> </el-switch>
<el-form-item label="按钮组"> </el-form-item>
<el-select v-model="selectedMould[nowIndex].content.buttonType" placeholder="请选择"> <el-form-item label="上一步序号">
<el-option <el-select v-model="selectedMould[nowIndex].content.lastIndex" placeholder="请选择">
:value="0" <el-option
label="返回看一看 + 爸妈秀宝贝"> v-for="(item,index) in selectedMould"
</el-option> :key="index"
<el-option :label="index"
:value="1" :value="index">
label="返回玩一玩 + 完成今日学习"> </el-option>
</el-option> </el-select>
<el-option </el-form-item>
:value="2" <el-form-item label="下一步序号">
label="上一页 + 完成今日学习"> <el-select v-model="selectedMould[nowIndex].content.nextIndex" placeholder="请选择">
</el-option> <el-option
<el-option v-for="(item,index) in selectedMould"
:value="3" :key="index"
label="返回玩一玩 + 下一页"> :label="index"
</el-option> :value="index">
</el-select> </el-option>
</el-form-item> </el-select>
<el-form-item label="视频切换"> </el-form-item>
<el-switch v-model="selectedMould[nowIndex].content.tabVideo.type"> </el-form>
</el-switch> </el-dialog>
</el-form-item>
<el-form-item label="视频目标" v-if="selectedMould[nowIndex].content.tabVideo.type">
<el-select v-model="selectedMould[nowIndex].content.tabVideo.index" placeholder="请选择">
<el-option
v-for="(item,index) in selectedMould"
:key="index"
:label="index"
:value="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="停留时长">
<el-input-number v-model="selectedMould[nowIndex].content.timeLang"></el-input-number>
</el-form-item>
</el-form>
<el-form label-width="100px" v-if="selectedMould[nowIndex] && selectedMould[this.nowIndex].key === 'play1'">
<el-form-item label="音频">
<el-upload
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFile"
multiple
:on-exceed="handleExceed"
:on-success="uploadSuccessRadio1"
:file-list="selectedMould[nowIndex].content.radio">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import mouldImg from '../../util/mouldImgUrl' import mouldImg from '../../util/mouldImgUrl'
import {uploadFileApi} from "../../service/api"; import {uploadFileApi} from "../../service/api";
...@@ -332,32 +472,77 @@ ...@@ -332,32 +472,77 @@
name: "editor", name: "editor",
props:[ props:[
'selectedMould', 'selectedMould',
'editorObj'
], ],
data(){ data(){
return { return {
// 放大缩小参数
bigNum:100, bigNum:100,
// 弹窗参数
dialogVisible:false, dialogVisible:false,
// 当前对象下标
nowIndex:0, nowIndex:0,
// 模板图片集
mouldImg:mouldImg, mouldImg:mouldImg,
// 文件上传Uid
fileUid:null
}
},
mounted(){
console.log(this.editorObj)
},
computed:{
progress(){
return this.$store.state.progressList.find(i=>{return i.id === this.fileUid}).num <100 ? this.$store.state.progressList.find(i=>{return i.id === this.fileUid}).num : 100
} }
}, },
methods:{ methods:{
initPage(){
switch (this.editorObj.type) {
case 0:
this.selectedMould=[]
}
},
// 打开设置弹窗
setOpen(){ setOpen(){
this.dialogVisible = true; this.dialogVisible = true;
}, },
// 上传Banner
uploadFileVideo1Banner(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.selectedMould[this.nowIndex].content.banner[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
})
},
// 上传音频
uploadFileRadio(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.selectedMould[this.nowIndex].content.radio[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
})
},
// 上传视频
uploadFile(a){ uploadFile(a){
uploadFileApi(a.file).then(res=>{ this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.selectedMould[this.nowIndex].content.videoUrl[0]={name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
}) })
}, },
// 列表选择
chooseThat(data){ chooseThat(data){
this.nowIndex = data; this.nowIndex = data;
}, },
// 超出个数显示
handleExceed(){ handleExceed(){
this.$message.error('超出文件限制个数'); this.$message.error('超出文件限制个数');
}, },
// 源生上传成功回调
uploadSuccess(a){ uploadSuccess(a){
this.selectedMould[this.nowIndex].content.radioUrl.push({name:a.data.url,url:process.env.IMAGE_URL_HEAD + a.data.url}) this.selectedMould[this.nowIndex].content.radioUrl.push({name:a.data.url,url:process.env.IMAGE_URL_HEAD + a.data.url})
}, },
// 源生上传成功音频回调
uploadSuccessRadio1(a){ uploadSuccessRadio1(a){
this.selectedMould[this.nowIndex].content.radio.push({name:a.data.url,url:process.env.IMAGE_URL_HEAD + a.data.url,title:'',lable:''}) this.selectedMould[this.nowIndex].content.radio.push({name:a.data.url,url:process.env.IMAGE_URL_HEAD + a.data.url,title:'',lable:''})
} }
...@@ -459,6 +644,14 @@ ...@@ -459,6 +644,14 @@
height: 100%; height: 100%;
width: 1000px; width: 1000px;
position: relative; position: relative;
.icon-class{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.3);
}
img{ img{
position: absolute; position: absolute;
top: 50%; top: 50%;
...@@ -466,6 +659,9 @@ ...@@ -466,6 +659,9 @@
margin-top: -50px; margin-top: -50px;
margin-left: -50px; margin-left: -50px;
} }
video{
width: 1000px;
}
} }
} }
} }
...@@ -601,6 +797,8 @@ ...@@ -601,6 +797,8 @@
position: relative; position: relative;
height: 832px; height: 832px;
background: #333; background: #333;
background-repeat: no-repeat;
background-size: 100% 100%;
margin: 20px; margin: 20px;
border-radius: 8px; border-radius: 8px;
.radio-icon{ .radio-icon{
......
...@@ -23,14 +23,27 @@ ...@@ -23,14 +23,27 @@
</el-card> </el-card>
</div> </div>
</div> </div>
</el-aside> </el-aside>
<el-main> <el-main>
<editor :selectedMould="selectedMould"/> <el-button size="mini" @click="showDialog = true">
课程基本信息编辑
</el-button>
<el-button size="mini">
保存
</el-button>
<editor :selectedMould="selectedMould" :editorObj="editorObj"/>
</el-main> </el-main>
</el-container> </el-container>
<el-dialog> <el-dialog
title="信息编辑"
:modal="false"
:visible.sync="showDialog"
width="30%">
<el-form>
<el-form-item>
</el-form-item>
</el-form>
</el-dialog> </el-dialog>
</el-dialog> </el-dialog>
</template> </template>
...@@ -39,6 +52,8 @@ ...@@ -39,6 +52,8 @@
import addUrl from '../../assets/editor/Group 7.png' import addUrl from '../../assets/editor/Group 7.png'
import {MOULDLIST} from "../../util/resourceMould"; import {MOULDLIST} from "../../util/resourceMould";
import editor from './editor' import editor from './editor'
import {addCategoryApi} from "../../service/api";
export default { export default {
props:[ props:[
'editorObj' 'editorObj'
...@@ -50,6 +65,7 @@ ...@@ -50,6 +65,7 @@
return{ return{
selectedMould:[], selectedMould:[],
addUrl:addUrl, addUrl:addUrl,
showDialog:false,
mouldList:MOULDLIST, mouldList:MOULDLIST,
age:[0,0], age:[0,0],
level:[0,0], level:[0,0],
......
...@@ -143,12 +143,12 @@ const getCategoryUrl = `${_baseUrl}api/admin/category/list/0`; ...@@ -143,12 +143,12 @@ const getCategoryUrl = `${_baseUrl}api/admin/category/list/0`;
export const getCategoryApi = function (pid) { export const getCategoryApi = function (pid) {
return Vue.prototype.$fetch(getCategoryUrl,{'pid':pid}) return Vue.prototype.$fetch(getCategoryUrl,{'pid':pid})
}; };
//删除元素分类 //删除分类
const delCategoryUrl = `${_baseUrl}api/admin/category`; const delCategoryUrl = `${_baseUrl}api/admin/category`;
export const delCategoryApi = function (id) { export const delCategoryApi = function (id) {
return Vue.prototype.$del(`${delCategoryUrl}/${id}`) return Vue.prototype.$del(`${delCategoryUrl}/${id}`)
}; };
//元素排序修改 //分类排序修改
const sortCategoryUrl = `${_baseUrl}api/admin/category/sort`; const sortCategoryUrl = `${_baseUrl}api/admin/category/sort`;
export const sortCategoryApi = function (json) { export const sortCategoryApi = function (json) {
return Vue.prototype.$patch(sortCategoryUrl,json) return Vue.prototype.$patch(sortCategoryUrl,json)
...@@ -158,6 +158,21 @@ const getCateDetailListUrl = `${_baseUrl}api/admin/element/list/0`; ...@@ -158,6 +158,21 @@ const getCateDetailListUrl = `${_baseUrl}api/admin/element/list/0`;
export const getCateListApi = function (id) { export const getCateListApi = function (id) {
return Vue.prototype.$fetch(getCateDetailListUrl,id) return Vue.prototype.$fetch(getCateDetailListUrl,id)
}; };
// 添加元素
const addElementUrl = `${_baseUrl}api/admin/element/add/`;
export const addElementApi = function (json, id) {
return Vue.prototype.$post(`${addElementUrl}${id}`,json)
};
// 查询元素详情
const getElemenetDetailUrl = `${_baseUrl}api/admin/element/`;
export const getElemenetDetailApi = function (id) {
return Vue.prototype.$fetch(`${getElemenetDetailUrl}${id}`)
};
// 编辑元素
const editElementUrl = `${_baseUrl}api/admin/element/`;
export const editElementApi = function (id, json) {
return Vue.prototype.$put(`${editElementUrl}${id}`, json)
};
// 获取单品列表 // 获取单品列表
const getSingleListUrl = `${_baseUrl}api/admin/item/stock/list`; const getSingleListUrl = `${_baseUrl}api/admin/item/stock/list`;
export const getSingleListApi = function (name) { export const getSingleListApi = function (name) {
...@@ -256,8 +271,8 @@ export const getMediaListApi = function (json) { ...@@ -256,8 +271,8 @@ export const getMediaListApi = function (json) {
// const getGoodsListUrl = `${_baseUrl}api/admin/goods/list`; // const getGoodsListUrl = `${_baseUrl}api/admin/goods/list`;
// 文件上传 // 文件上传
const uploadFileUrl = `${_baseUrl}api/public/upload/zone`; const uploadFileUrl = `${_baseUrl}api/public/upload/zone`;
export const uploadFileApi = function (data) { export const uploadFileApi = function (json) {
return Vue.prototype.$upload(uploadFileUrl,data) return Vue.prototype.$upload(uploadFileUrl,json)
}; };
// 获取菜单列表 // 获取菜单列表
const getMenuListUrl = `${_baseUrl}api/admin/category/list/2`; const getMenuListUrl = `${_baseUrl}api/admin/category/list/2`;
......
import axios from 'axios'; import axios from 'axios';
import md5 from 'js-md5'; import md5 from 'js-md5';
import store from "@/store"
import { MessageBox ,Message } from 'element-ui'; import { MessageBox ,Message } from 'element-ui';
import router from '../router' import router from '../router'
import Cookie from '../util/cookie' import Cookie from '../util/cookie'
...@@ -65,29 +66,34 @@ axios.interceptors.response.use( ...@@ -65,29 +66,34 @@ axios.interceptors.response.use(
* @param params * @param params
* @returns {Promise} * @returns {Promise}
*/ */
export function upload(url,data) { export function upload(url,json) {
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
//开启分片 //开启分片
let size = parseInt(Number(data.size)/Number(process.env.MAX_FILESIZE) +1); let size = parseInt(Number(json.file.size)/Number(process.env.MAX_FILESIZE) +1);
let y = 0; let y = 0;
let fun = function(){ let fun = function(){
let formData = new FormData(); let formData = new FormData();
let file = data.slice(y*process.env.MAX_FILESIZE,(y+1)*process.env.MAX_FILESIZE) let file = json.file.slice(y*process.env.MAX_FILESIZE,(y+1)*process.env.MAX_FILESIZE);
console.log(data) console.log(json.file);
formData.append('chunk', y); formData.append('chunk', y);
formData.append('file_name', data.name); formData.append('file_name', json.file.name);
formData.append('count', size); formData.append('count', size);
formData.append('file', file); formData.append('file', file);
axios.post(url,formData,{ headers: { axios.post(url,formData,{ headers: {
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
},timeout:60000}) },timeout:60000,
onUploadProgress: progressEvent => {
let progress = ((Number(progressEvent.loaded) + Number(y*process.env.MAX_FILESIZE)) / Number(json.file.size) * 100| 0);
console.log((Number(progressEvent.loaded), Number(y*process.env.MAX_FILESIZE),progress));
store.dispatch('setProgress',{type: 'change',id: json.file.uid ,num: progress});
},})
.then(response => { .then(response => {
if(response.data.code === 200){ if(response.data.code === 200){
y++; if(y+1<size){
if(y<size){ y++;
fun() fun()
}else{ }else{
y=0;
resolve(response.data.data); resolve(response.data.data);
} }
}else{ }else{
......
...@@ -7,4 +7,7 @@ export default{ ...@@ -7,4 +7,7 @@ export default{
setUserName({commit},name){ setUserName({commit},name){
commit('setUserName',name); commit('setUserName',name);
}, },
setProgress({commit},data){
commit('progress',data);
},
} }
...@@ -14,6 +14,7 @@ export default new vuex.Store({ ...@@ -14,6 +14,7 @@ export default new vuex.Store({
menuList:menu, menuList:menu,
menuType:false, menuType:false,
nowTab:'first', nowTab:'first',
progressList:[],
openedTab:[ openedTab:[
{ {
value:'首页', value:'首页',
......
...@@ -19,6 +19,19 @@ const mutations={ ...@@ -19,6 +19,19 @@ const mutations={
}, },
changeParentRouter(state,data){ changeParentRouter(state,data){
state.menuList.find((a)=>{return a.name === data.name}).routerName = data.to.name state.menuList.find((a)=>{return a.name === data.name}).routerName = data.to.name
},
progress(state,data){
switch (data.type) {
case 'new':
state.progressList.push({num:0,id:data.id});
break;
case 'change':
state.progressList.find((x)=>{return x.id === data.id}).num = data.num;
break;
case 'delete':
delete state.progressList.find((x)=>{return x.id === data.id});
break
}
} }
}; };
export default mutations; export default mutations;
...@@ -41,8 +41,8 @@ export const MOULDLIST = [ ...@@ -41,8 +41,8 @@ export const MOULDLIST = [
name:'玩-video-1', name:'玩-video-1',
key:'play1', key:'play1',
content:{ content:{
videoUrl:'', videoUrl:[],
banner:"", banner:[],
nextIndex:'', nextIndex:'',
lastIndex:'', lastIndex:'',
tabRadio:{ tabRadio:{
...@@ -54,11 +54,24 @@ export const MOULDLIST = [ ...@@ -54,11 +54,24 @@ export const MOULDLIST = [
title:'唱学加油包', title:'唱学加油包',
imgUrl:RefuelingUrl, imgUrl:RefuelingUrl,
name:'加油包-1', name:'加油包-1',
key:'refueling1' key:'refueling1',
content:{
radio:[],
banner:[],
nextIndex:'',
nextType:true,
lastIndex:'',
}
},{ },{
title:'爸妈秀宝贝', title:'爸妈秀宝贝',
imgUrl:showBabyUrl, imgUrl:showBabyUrl,
name:'秀宝贝-1', name:'秀宝贝-1',
key:'show1' key:'show1',
content:{
text:'',
check:true,
nextIndex:'',
lastIndex:'',
}
}, },
]; ];
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