Commit 3cf9d66e authored by ltz's avatar ltz

merge lvtz_home

parents db646ab8 55b3d87a
......@@ -58,12 +58,43 @@ Page({
push_status: 2,
push_time: '18:00',
sign_up_status: 2,
banner:'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png',
introduce:[],
sign_up_content:''
banner: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png',
introduce: [],
sign_up_content: ''
},
radioname:'',
radioList:[
radioname: '',
radioList: [
],
introduceContent: [
{
title: "训练营是如何开展学习的?",
content: [
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/title-1.png" },
{ type: "text", value: "1.全程陪伴练字教学,我们通过听课+作业+点\r\n评+群内解答等互动形式,提高学习效果\r\n2.国家级书法名师亲自授课,指导你快速学习\r\n正确的握笔姿势和练字方法\r\n3.从零基础讲起,适合小白快速入门,课程系\r\n 统全面,有经验的学员也能得到进一步提高;\r\n4.我们的每一位同学都将得到一对一教师指导,\r\n每天督促学习,陪伴式成长\r\n\r\n适合人群\r\n(1)零基础练字学员\r\n(2)有一点基础,想提升的学员\r\n(3)节假日期间想快速练好字的学员" }
]
},
{
title: "加入训练营孩子能收获什么?",
content: [
{ type: "text", value: "训练营共14关,不仅学习专业的练字技能,\r\n 通关之后将获得机构赠送精美礼品 \r\n(1)价值399元伯尔尼斯电饭锅一台" },
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/ricecooker.png" },
{ type: "text", value: "(2)价值599元小天才电话手表一个" },
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/shoubiao.png" },
]
},
{
title: "教学老师",
content: [
{ type: "text", value: "洛子帅, 书法练字训练营创始人,杭州阳关灿烂教育 \r\n 教学主管,专业书法教师,已帮助3000多人写好字。" },
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/laoshi.png" },
]
},
{
title: "毕业学生作品",
content: [
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/works.png" },
]
}
],
copySubjectCount: 0,
moresetStatus: false,
......@@ -92,7 +123,7 @@ Page({
src: ''
},
},
onLoad: function(options) { // Do some initialize when page load.
onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
const {
id,
......@@ -110,8 +141,7 @@ Page({
'params.class_id': id,
my: my || 0
});
console.log('params',options)
if(tid && tid != 0){
if (tid && tid != 0) {
wx.setNavigationBarTitle({
title: '编辑闯关打卡'
})
......@@ -119,22 +149,22 @@ Page({
}
this.getClassList('init')
},
onShow(){
if(this.data.showRefreshClass){
onShow() {
if (this.data.showRefreshClass) {
this.data.circlehasmore = true,
this.data.circlePage = 1,
this.getClassList('init')
this.data.circlePage = 1,
this.getClassList('init')
}
},
onReady: function() { // Do something when page ready.
onReady: function () { // Do something when page ready.
},
onHide: function() { // Do something when page hide.
onHide: function () { // Do something when page hide.
this.innerAudioContext.pause();
this.resetAudiosPlayStatus()
clearInterval(this.data.voiceInterval);
},
onUnload: function() { // Do something when page close.
onUnload: function () { // Do something when page close.
this.innerAudioContext.pause();
this.setData({
audioStorage: {
......@@ -143,26 +173,27 @@ Page({
})
clearInterval(this.data.voiceInterval);
},
unlockSubjectShow () {
unlockSubjectShow() {
if (this.data.tid == 0) {
return
}
wx.showLoading({
title: '数据加载中...'
});
unlockSubjectShow ({
unlockSubjectShow({
id: this.data.tid,
school_id: this.data.sid,
}).then((res) => {
const {code, data} = res;
if(code == 200) {
const { code, data } = res;
if (code == 200) {
wx.hideLoading();
try {
data.sign_up_content = JSON.parse(data.sign_up_content)
} catch (error) {
}
// const introduce = JSON.parse(data.introduce);
const introduce = data.introduce && typeof data.introduce == "string" ? JSON.parse(data.introduce) : '';
console.log(introduce,' introduce')
// introduce.forEach((ele) => {
// if (ele.type == 'video') {
// ele.poster = ele.value;
......@@ -185,12 +216,13 @@ Page({
push_time: data.push_time,
banner: data.banner || '',
sign_up_status: data.sign_up_status,
introduce: JSON.parse(data.introduce)
introduce
},
copySubjectCount: data.subject_count,
subjectStatus: data.status,
radioname: data.sign_up_content ? data.sign_up_content.radioname : '',
radioList: data.sign_up_content ? data.sign_up_content.radioList : '',
radioname: data.sign_up_content ? data.sign_up_content.radioname : '',
radioList: data.sign_up_content ? data.sign_up_content.radioList : '',
introduceContent: introduce && introduce[0] ? (introduce[0].content || introduce[0].title ? introduce : [{title:'', content: introduce }] ) : ''
})
}
}).catch(() => {
......@@ -215,18 +247,18 @@ Page({
'params.title': value.length > 40 ? value.substr(0, 40) : value
})
},
subjectCountInput (e) {
subjectCountInput(e) {
let {
value
} = e.detail;
if(value>199){
if (value > 199) {
value = 199;
}
this.setData({
'params.subject_count': Number(value)
})
},
psdChange (e) {
psdChange(e) {
const {
value
} = e.detail;
......@@ -234,7 +266,7 @@ Page({
'params.password': value
})
},
maxClockCountInput (e) {
maxClockCountInput(e) {
const {
value
} = e.detail;
......@@ -242,18 +274,18 @@ Page({
'params.max_clock_count': Number(value)
})
},
joinRuleChange (e) {
const {dataset} = e.currentTarget;
joinRuleChange(e) {
const { dataset } = e.currentTarget;
this.setData({
'params.join_rule_type': Number(dataset.type)
})
},
unlockRuleTypeChange (e) {
const {dataset} = e.currentTarget;
unlockRuleTypeChange(e) {
const { dataset } = e.currentTarget;
if (this.data.subjectStatus == 2) {
wx.showToast({
icon: 'none',
title: '闯关主题已发布,不能修改闯关规则'
title: '闯关主题已发布,不能修改闯关规则'
})
return;
}
......@@ -261,7 +293,7 @@ Page({
'params.unlock_rule_type': Number(dataset.type)
})
},
unlockLimitChange (e) {
unlockLimitChange(e) {
const {
value
} = e.detail;
......@@ -309,7 +341,7 @@ Page({
})
}
},
moresetStatusChange () {
moresetStatusChange() {
this.setData({
moresetStatus: !this.data.moresetStatus
})
......@@ -336,7 +368,7 @@ Page({
})
}
},
tipTimeChange(e){
tipTimeChange(e) {
const {
value
} = e.detail;
......@@ -344,9 +376,9 @@ Page({
'params.push_time': value,
})
},
saveLock () {
saveLock() {
const that = this;
if (this.data.params.class_id==0) {
if (this.data.params.class_id == 0) {
wx.showModal({
title: '提示',
content: '请选择班级',
......@@ -402,40 +434,40 @@ Page({
return;
}
if (this.data.params.sign_up_status == 1) {
if(this.data.radioList.length>0){
if (this.data.radioList.length > 0) {
let flag = false;
const nameList = [];
if(!this.data.radioname){
if (!this.data.radioname) {
wx.showToast({
title: '单选项问题名不能为空',
duration: 1500,
icon: 'none',
})
return
return
}
this.data.radioList.forEach((item,index)=>{
this.data.radioList.forEach((item, index) => {
nameList.push(item.name)
if(!item.name){
if (!item.name) {
flag = true;
}
})
if(flag){
if (flag) {
wx.showToast({
title: '选项不能为空',
duration: 1500,
icon: 'none',
})
return
return
}
let narry= new Set(nameList);
let narry = new Set(nameList);
console.log(narry, 'narry')
if(narry.size != nameList.length){
if (narry.size != nameList.length) {
wx.showToast({
title: '选项不能重复',
duration: 1500,
icon: 'none',
})
return
return
}
}
}
......@@ -443,33 +475,39 @@ Page({
return
}
this.data.publishing = true;
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
const { introduceContent } = this.data;
const sjdMediaEditorList = []
for(let i = 0; i<introduceContent.length; i++){
const sjdMediaEditor = this.selectComponent(`#sjd-media-editor${i}`);
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
sjdMediaEditorList.push({title:introduceContent[i].title, content: _content})
}
console.log(sjdMediaEditorList,'sjdMediaEditorList')
const { radioList, radioname } = this.data;
this.data.params.sign_up_content = {
radioname,
radioList,
}
try {
this.data.params.introduce = JSON.stringify(_content);
this.data.params.introduce = JSON.stringify(sjdMediaEditorList);
this.data.params.sign_up_content = JSON.stringify(this.data.params.sign_up_content);
} catch (error) {
}
wx.showLoading('保存中...');
unlockSubjectEditor ({
unlockSubjectEditor({
tid: this.data.clone == 'clone' ? 0 : this.data.tid,
data: this.data.params,
school_id: this.data.sid,
}).then((res) => {
const {code, data} = res;
const { code, data } = res;
if (res.code == 200) {
this.setData({
confirmId: data.id,
......@@ -484,7 +522,7 @@ Page({
wx.hideLoading();
})
},
saveLockConfirm () {
saveLockConfirm() {
wx.redirectTo({
url: `/business/pages/morethemeindex/index?id=${this.data.id}&tid=${this.data.confirmId}&sid=${this.data.sid}&sort=1&sub=&AcSubIndex=`,
})
......@@ -507,7 +545,7 @@ Page({
// perPage: this.data.circlePerpage,
perPage: 200,//重新选择问题,所以这里暂不分页了
school_id: this.data.sid,
my: LocalStorage.getItem('dakarole')==2? 1: this.data.my
my: LocalStorage.getItem('dakarole') == 2 ? 1 : this.data.my
}).then((res) => {
const {
code,
......@@ -519,13 +557,13 @@ Page({
})
if (code != 200) { // 失败的处理
} else {
if (data.total==0) {
if (data.total == 0) {
wx.showModal({
title: '提示',
content: '您还没有班级,请先创建班级',
showCancel: false,
confirmColor: '#65B8F4',
success:function(){
success: function () {
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${that.data.sid}&id=0&from=3`
})
......@@ -536,7 +574,7 @@ Page({
if (data.total) {
this.data.circleTotal = data.total;
}
switch(type){
switch (type) {
case 'init':
data.list = data.list.map(item => {
return {
......@@ -546,9 +584,9 @@ Page({
})
this.setData({
classList: data.list,
selectClass: this.data.id!=0 ? data.list.find(ele => ele.id == this.data.id) : data.list[0],
'params.class_id': this.data.id!=0? this.data.id: data.list[0].id,
id: this.data.id!=0? this.data.id: data.list[0].id
selectClass: this.data.id != 0 ? data.list.find(ele => ele.id == this.data.id) : data.list[0],
'params.class_id': this.data.id != 0 ? this.data.id : data.list[0].id,
id: this.data.id != 0 ? this.data.id : data.list[0].id
})
if (data.total > this.data.classList.length) {
this.data.circlePage = this.data.circlePage + 1;
......@@ -560,7 +598,7 @@ Page({
break;
case 'up': // 页面上拉刷新
let list = this.data.classList;
let _listGet = data.list.map(item=>{
let _listGet = data.list.map(item => {
return {
id: item.id,
title: item.title
......@@ -595,13 +633,13 @@ Page({
},
showClassSelectModal() {
let that = this;
if(this.data.classList.length==0){
if (this.data.classList.length == 0) {
wx.showModal({
title: '提示',
content: '您还没有班级,请先创建班级',
showCancel: false,
confirmColor: '#65B8F4',
success:function(){
success: function () {
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${that.data.sid}&id=0&from=3`
})
......@@ -614,8 +652,8 @@ Page({
})
},
selectClassHandle(e) {
const { item } = e.currentTarget.dataset;
if(item.id == this.data.selectClass.id){
const { item } = e.currentTarget.dataset;
if (item.id == this.data.selectClass.id) {
this.setData({
modelClassAnimate: true
})
......@@ -625,7 +663,7 @@ Page({
modelClassAnimate: false
})
}, 200)
}else{
} else {
this.setData({
selectClass: item,
'params.class_id': item.id,
......@@ -701,7 +739,7 @@ Page({
value,
duration
} = e.detail;
this.innerAudioContext.src = audioorigin(value);
this.innerAudioContext.obeyMuteSwitch = false;
this.resetAudiosPlayStatus();
......@@ -857,42 +895,49 @@ Page({
});
},
checknameIpt(e){
checknameIpt(e) {
const { value } = e.detail;
this.setData({
radioname: value
})
},
itemnameIpt(e){
itemnameIpt(e) {
const { value } = e.detail;
const { index } = e.currentTarget.dataset
this.setData({
[`radioList[${index}].name`]: value
})
},
addCheckItem(e){
introducetitleipt(e){
const { value } = e.detail;
const { index } = e.currentTarget.dataset
this.setData({
[`introduceContent[${index}].title`]: value
})
},
addCheckItem(e) {
const { radioList } = this.data;
const len = radioList.length;
let text = '选项一'
switch (len) {
case 1:
text='选项二'
text = '选项二'
break;
case 2:
text='选项三'
text = '选项三'
break;
case 3:
text='选项四'
text = '选项四'
break;
case 4:
text='选项五'
text = '选项五'
break;
default:
break;
}
radioList.push(
{
name:'',
name: '',
text
}
)
......@@ -900,47 +945,47 @@ Page({
radioList
})
},
delallCheck(){
delallCheck() {
this.setData({
radioList:[]
radioList: []
})
},
addRadio(){
addRadio() {
this.setData({
radioname:'',
radioList:[
radioname: '',
radioList: [
{
name:'',
text:'选项一'
name: '',
text: '选项一'
},
{
name:'',
text:'选项二'
name: '',
text: '选项二'
}
],
})
},
delCheckitme(e){
delCheckitme(e) {
const { index } = e.currentTarget.dataset;
let radioList = JSON.parse(JSON.stringify(this.data.radioList));
radioList.splice(index, 1);
for(let i=0; i<radioList.length; i++){
for (let i = 0; i < radioList.length; i++) {
let text = '选项一'
switch (i) {
case 0:
text='选项一'
text = '选项一'
break;
case 1:
text='选项二'
text = '选项二'
break;
case 2:
text='选项三'
text = '选项三'
break;
case 3:
text='选项四'
text = '选项四'
break;
case 4:
text='选项五'
text = '选项五'
break;
default:
break;
......@@ -951,8 +996,27 @@ Page({
radioList
})
},
// 视频播放相关代码
playvideo(e) {
delIntroduce(e){
const { index } = e.currentTarget.dataset;
let introduceContent = JSON.parse(JSON.stringify(this.data.introduceContent));
introduceContent.splice(index, 1);
this.setData({
introduceContent
})
},
addIntroduce(e){
const { index } = e.currentTarget.dataset;
let introduceContent = JSON.parse(JSON.stringify(this.data.introduceContent));
introduceContent.push({
title: "",
content: []
})
this.setData({
introduceContent
})
},
// 视频播放相关代码
playvideo(e) {
const that = this;
const {
src,
......
......@@ -158,11 +158,21 @@
</view>
<view class="introduce-setting">
<view class="title-box">闯关介绍</view>
<view class="introduce-box">
<view class="content-inputbox">添加闯关介绍</view>
<view class="introduce-box" wx:for="{{introduceContent}}" wx:key="index">
<view class="close-box" data-index="{{index}}" bindtap="delIntroduce">
<image class="" src="{{imageRoot}}2b/themeeditorlock/closexicon.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
</view>
<view class="introduce-title">
<input class="" value="{{item.title}}" type="text" placeholder="请输入标题" placeholder-style="" data-index="{{index}}" placeholder-class="input-placeholder" maxlength="15" focus="false" bindinput="introducetitleipt">
</input>
<view class="tips">点击修改标题,最多15个字</view>
</view>
<view class="sjd-component-box">
<sjd-media-editor content="{{params.introduce}}"
id="sjd-media-editor" sid="{{sid}}"
<sjd-media-editor content="{{item.content}}"
id="sjd-media-editor{{index}}" sid="{{sid}}"
haveAddVoice="{{false}}"
haveAddWxfile="{{false}}"
bind:addVoice="addVoice"
placeholder="{{placeholder}}"
bind:playvoice="playvoice"
......@@ -178,6 +188,7 @@
<!-- bind:posterloaderr="posterloaderr" -->
</view>
</view>
<view class="add-btn" bindtap="addIntroduce">添加板块</view>
</view>
<view class="dialog-modal" wx:if="{{showConfirmDialog}}">
......
......@@ -580,11 +580,42 @@ page{
}
.introduce-setting .introduce-box {
width:100%;
min-height:317rpx;
background:rgba(255,255,255,1);
border:2px dashed rgba(208,208,208,1);
border-radius:10rpx;
padding-bottom: 30rpx;
padding: 36rpx 24rpx 30rpx 24rpx;
position: relative;
margin-bottom: 60rpx;
}
.introduce-setting .introduce-box .close-box{
position: absolute;
top: -25rpx;
right: -25rpx;
}
.introduce-setting .introduce-box .close-box image{
width: 50rpx;
height: 50rpx;
}
.introduce-title {
}
.introduce-title input{
width:390rpx;
height:83rpx;
background:rgba(244,244,244,1);
border-radius:10rpx;
padding: 0 28rpx;
margin: 0 auto;
font-weight: bold;
}
.introduce-title .tips{
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(157,157,157,1);
line-height: 1;
padding: 18rpx 0 22rpx 0;
text-align: center;
}
.introduce-setting .introduce-box .content-inputbox{
font-size:28rpx;
......@@ -594,6 +625,22 @@ page{
text-align: center;
padding: 72rpx 0 83rpx 0;
}
.introduce-setting .add-btn{
width:427rpx;
height:65rpx;
background:rgba(255,255,255,1);
border:2rpx solid rgba(101,184,244,1);
border-radius:33rpx;
font-size:26rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(101,184,244,1);
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
margin-top: 56rpx;
}
.addRadio{
padding: 0 30rpx;
height:68rpx;
......
......@@ -36,6 +36,14 @@ Component({
type: Boolean,
value: false,
},
haveAddVoice:{
type: Boolean,
value: true,
},
haveAddWxfile: {
type: Boolean,
value: true,
},
maxTextBoxLength: {
type: Number,
value: 999
......
......@@ -94,7 +94,7 @@
</view>
<view class="media-type-name">图片</view>
</view>
<view class="media-type-item" bindtap="addVoice" wx:if="{{voiceBoxLength < maxVoiceBoxLength}}">
<view class="media-type-item" bindtap="addVoice" wx:if="{{voiceBoxLength < maxVoiceBoxLength}}" wx:if="{{haveAddVoice}}">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
......@@ -112,7 +112,7 @@
</view>
<view class="media-type-name">视频</view>
</view>
<view class="media-type-item" bindtap="addWxfile" wx:if="{{videoBoxLength < maxVideoBoxLength}}">
<view class="media-type-item" bindtap="addWxfile" wx:if="{{videoBoxLength < maxVideoBoxLength}}" wx:if="{{haveAddWxfile}}">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
......
......@@ -160,7 +160,7 @@ Page({
} catch (e) {
introduce = []
}
data.introduce = introduce;
data.introduce = introduce && introduce[0] ? (introduce[0].content || introduce[0].title ? introduce : [{title:'', content: introduce }] ) : '';
let sign_up_content = {};
try {
sign_up_content = JSON.parse(data.sign_up_content);
......@@ -171,6 +171,7 @@ Page({
wx.setNavigationBarTitle({
title: data.title
})
console.log(data.introduce,'introduce')
this.setData({
moreTheme: data,
sid: data.school_id,
......
......@@ -42,9 +42,13 @@
</view>
<view class="content-box1 content-box2" wx:if="{{tabIndex==0 && moreTheme.introduce.length > 0}}">
<view class="box-title">打卡介绍</view>
<view class="mediabox">
<view class="mediabox" wx:for="{{moreTheme.introduce}}" wx:key="index">
<view class="title-wrapper">
<view class="title">{{item.title}} <view class="title-bg"></view></view>
</view>
<view class="media-box">
<sjd-media-show
content="{{moreTheme.introduce}}"
content="{{item.content}}"
bind:playvoice="playvoice"
bind:pausevoice="pausevoice"
bind:voiceslide="voiceslide"
......@@ -57,8 +61,9 @@
text="详情"
bind:playvideo="playvideo"
defineheight="{{400}}"
>
</sjd-media-show>
>
</sjd-media-show>
</view>
</view>
</view>
<view class="content-box1 content-box2" wx:if="{{tabIndex==1}}">
......
......@@ -24,6 +24,31 @@ page{
.mediabox {
width: 702rpx;
margin: 0 auto;
margin-bottom: 64rpx;
}
.mediabox .title-wrapper{
text-align: center;
}
.mediabox .title{
display: inline-block;
font-size:34rpx;
font-family:PingFang SC;
font-weight:bold;
color:rgba(32,32,32,1);
line-height:1;
text-align: center;
margin: 0 auto;
margin-bottom: 20rpx;
position: relative;
}
.mediabox .title .title-bg{
width: 90%;
height:15rpx;
background:rgba(255,209,70,.4);
border-radius:8rpx;
position: absolute;
left: 0;
bottom: -7rpx;
}
.content-box{
/* width:702rpx; */
......
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