Commit aa8d4a03 authored by wangxuelai's avatar wangxuelai

'编辑打卡无班级流程完毕'

parent 5e587664
......@@ -21,7 +21,6 @@ import {
bOssAccess,
} from '../../../service/common.js';
Page({
// mixins: [require('../../../mixins/myMins/audioCallback')],
data: {
maxLength: 500,
maxImgCount: 9,
......@@ -47,6 +46,10 @@ Page({
{ type: "text", value: "洛子帅, 书法练字训练营创始人,杭州阳关灿烂教育 \r\n 教学主管,专业书法教师,已帮助3000多人写好字。" },
{ type: "img", value: "https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2b/themeeditorlock/shoubiao.png" },
],
audioStorage: {},
has_subject: false,
deletePosting: false,
publishing: false,
},
onLoad: function (options) {
const { id, sid } = options;
......@@ -83,7 +86,23 @@ Page({
}).then((res) => {
const { code, data } = res;
if (code == 200) {
console.log(data, 'data');
let content = [];
try {
content = JSON.parse(data.content);
} catch (e) {
content = [];
}
this.setData({
content,
has_subject: data.has_subject,
params: {
title: data.title,
name: data.name,
mobile: data.mobile,
img: data.img,
cover: data.cover,
},
})
}
})
},
......@@ -151,7 +170,9 @@ Page({
}
})
params.content = JSON.stringify(_content);
wx.showLoading('保存中...');
wx.showLoading({
title: '保存中...'
});
editThemeAd(Object.assign(params, {
id: this.data.id,
school_id: this.data.sid
......@@ -160,6 +181,21 @@ Page({
this.data.publishing = false;
wx.hideLoading();
if (res.code == 200) {
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 1000
})
let pages = getCurrentPages();
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (pages.length >= 2) {
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
prevPage.setData({
showRefresh: true,
});
wx.navigateBack({
delta: 1
})
......@@ -239,27 +275,13 @@ Page({
audioStorage[value].innerAudioContext.src = audioorigin(value);
audioStorage[value].innerAudioContext.obeyMuteSwitch = false;
audioStorage[value].innerAudioContext.onWaiting((e)=>{
console.log('等待中');
const { actPalyaudioValue, audioStorage} = this.data;
// if(audioStorage[value].isWaiting){
// return
// }
clearInterval(that.data.voiceInterval);
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
// setTimeout((e)=>{
// this.data.audioStorage[value].isWaiting = false;
// this.setData({
// audioStorage: this.data.audioStorage
// })
// },5000)
})
// audioStorage[value].innerAudioContext.onPlay((e) => {
// console.log('dasdad');
// that.voiceIntervalPlay(value);
// })
})
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
console.log('sss');
const { actPalyaudioValue, audioStorage} = this.data
......@@ -343,25 +365,15 @@ Page({
console.log(value, '等待1111');
if (audioStorage[value] && !audioStorage[value].play) {
const { actPalyaudioValue, audioStorage} = this.data
// if(audioStorage[value].isWaiting){
// return
// }
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
}
// setTimeout((e)=>{
// this.data.audioStorage[value].isWaiting = false;
// this.setData({
// audioStorage: this.data.audioStorage
// })
// },5000)
})
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value].isWaiting) {
console.log('22222222222222222');
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(value);
audioStorage[value].isWaiting = false
......@@ -383,7 +395,6 @@ Page({
audioStorage,
})
});
// audioStorage[value].innerAudioContext.seek(slide);
} else {
if (slide >= audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
......@@ -397,19 +408,6 @@ Page({
}
audioStorage[value].isWaiting = false;
}
// if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// // audioStorage[value].play = false;
// console.log(slide, '播放slide')
// audioStorage[value].innerAudioContext.seek(slide); // audioStorage[value].currentTime
// // audioStorage[value].innerAudioContext.play();
// // clearInterval(this.data.voiceInterval);
// setTimeout(() => {
// audioStorage[value].innerAudioContext.play();
// }, 500)
// this.voiceIntervalPlay(value);
// } else { // 如果当前不是播放状态 则该干嘛干嘛
// // audioStorage[value].innerAudioContext.play();
// }
this.setData({
audioStorage,
})
......@@ -438,19 +436,6 @@ Page({
})
},
slideend (e) {
// const {value, slide} = e.detail;
// let audioStorage = this.data.audioStorage;
// clearInterval(this.slideTimeOut);
// if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// // audioStorage[value].play = false;
// console.log(audioStorage[value].currentTime, '播放')
// audioStorage[value].innerAudioContext.seek(audioStorage[value].currentTime);
// // audioStorage[value].innerAudioContext.play();
// // clearInterval(this.data.voiceInterval);
// this.voiceIntervalPlay(value);
// } else { // 如果当前不是播放状态 则该干嘛干嘛
// // audioStorage[value].innerAudioContext.play();
// }
},
resetAudiosPlayStatus () { // 点击一个录音的时候把其他的录音状态改成暂停状态
let audioStorage = this.data.audioStorage;
......@@ -614,14 +599,59 @@ Page({
});
},
getThemeAdDetail() {
getThemeAdDetail({
delThemeAd () { // 删除落地页模板
const that = this;
if (this.data.has_subject) {
wx.showModal({
title: '这个营销页已经有主题使用,不能删除',
confirmText: '确定',
showCancel: false,
})
return;
}
wx.showModal({
title: '您确定删除这个主题营销页吗?',
cancelText: '取消',
confirmText: '删除',
success(res) {
if (res.confirm) {
that.sureDelThemeAd();
}
}
})
},
sureDelThemeAd() {
if (this.data.deletePosting) {
return;
}
this.data.deletePosting = true;
wx.showLoading({
title: '删除中...'
})
delThemeAd({
id: this.data.id
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.data.deletePosting = false;
if (code == 200) {
console.log(data, 'data');
wx.showToast({
title: '删除成功',
duration: 1000
})
const currentPages = getCurrentPages();
const themeListPage = currentPages.find(ele => ele.route == 'business/pages/themead/list');
const themeListPageIndex = currentPages.findIndex(ele => ele.route == 'business/pages/themead/list');
const delta = currentPages.length - themeListPageIndex - 1;
themeListPage.setData({
showRefresh: true,
})
wx.navigateBack({
delta,
})
}
}).catch(() => {
this.data.deletePosting = false;
})
}
})
\ No newline at end of file
......@@ -74,7 +74,7 @@
<view class="footer-box">
<view class="footer-innerbox">
<view class="btn">删除</view>
<view class="btn" bindtap="delThemeAd">删除</view>
<view class="btn btn-primary" bindtap="saveLock">保存</view>
</view>
</view>
......
import {
judgeIsClock,
clockList,
joinCircle,
circleRemark,
circleDetail,
adInfoGet,
getPrize,
newLikeIndex,
newCommentIndex,
} from "../../../service/customer/circleindex.js";
import {
userShow,
themeDetail,
subjectSignStudents,
subjectStudentSign
} from "../../../service/customer/themeindex.js";
import { wxPreviewImage } from "../../../utilities/wxApi.js";
import {
posterLog,
activityLog,
integralLog,
getActivities
} from "../../../service/common.js";
import { getSchoolDetail } from "../../../service/customer/schoolindex.js";
import {
getwechatmobile,
activityprizestatus
} from "../../../service/customer/activity.js";
getThemeAdDetail
} from "../../../service/business/themead.js";
import { LocalStorage, scenQueryGet, imagify } from "../../../utilities/index.js";
import regexp from "../../../constants/regexp.js";
import { studentidentity } from "../../../service/customer/signup.js";
var app = getApp();
Page({
mixins: [require("../../../mixins/myMins/audioCallback")],
data: {
userInfoDetail: {},
localImageRoot: "../../../images/",
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
id: 0,
circleInfo: {
school_id: 0
},
themeList: [],
themeTotal: 0,
clockTotal: 0,
page: 1,
perPage: 1000,
adInfo: {},
clockPage: 1,
clockPerPage: 10,
hasmore: true,
themeSelect: {},
isClock: false, // true 该主题已经签到 false 该主题未签到
clockList: [],
showPsdDia: false,
showNameSetDia: false,
password: "",
joining: false,
nameSetting: false,
adShow: true,
adGetShow: false,
adMobile: "",
prizeGetting: false,
posterBoxShow: false,
canvasShow: false,
canvasImagePath: "",
personalClockInfo: {},
qrcodeGenerating: false,
audioStorage: {},
concatDiaShow: false,
selfcount: 0,
currentVoice: "", // 当前播放的录音
voiceInterval: null,
clockGetting: false,
pagefrom: "",
selfClockDetail: {},
isexpand: false,
prizeGetting: false,
userguide: false,
userguideb: false,
position: {
shareBtn: {
top: 0,
left: 0
},
clockBtn: {
top: 0,
left: 0
}
},
guideBStep: 1,
backTopValue: false, //返回顶部
attentionAnim: {}, // 创建动画,
timer: null, // 定时器
selfLikesObj: {},
commentsObj: {},
likesObj: {},
commentsObj: {},
schoolInfo: "",
auditStatus: 3, // 1未申请2审核中3已通过
studentStatus: 1,
noUser: false,
commenteditor: false, // 评论input框
commentclock: "", //回复的clock
videostatus: {
preSrc: "",
currentSrc: "",
......@@ -113,1027 +18,292 @@ Page({
videoId: "",
src: ""
},
isExpire: false, // 打卡是否过期
isReaded: false, // 是否阅读完成
painting: null,
datetime: "",
atvDailogShow: false, // 活动
localImageRoot: "../../../images/",
sessionCode: "",
activtySchoolInfo: {
sid: 0,
id: 0,
tid: 0,
name: ""
landPageInfo: {
cover: '',
content: [],
name: '',
mobile: '',
img: '',
title: ''
},
clockFloatBtnShow: false,
receivedPrize: false,
activitybarloaded: false,
autoshowprize: false,
retract: false,
preScrollerToTop: 0,
nextScrollerToTop: 0,
paintingType: "",
pageScene: "",
isSchoolStudent: false,
myBaseinfo: "",
debouncetimeout: null,
countDownPositionTop: 0,
countdownShow: true,
needREfresh: false,
bigindex: undefined,
studentId: "",
id: 0,
sid: 0,
isexpand: true,
modalContact: false,
modelContactAnimate: false,
modalContact: false, //联系弹框
signStudentsTotal: 0,
signStudentsList: []
},
onLoad: function(options, b) {
// Do some initialize when page load.
const visitor = LocalStorage.getItem("visitor");
let that = this;
if (options.scene) {
let sceneQuery = scenQueryGet(options.scene);
const { i, t, c } = sceneQuery;
if (c) {
integralLog({
type: 2,
source_type: 1,
source_id: c,
student_id: app.globalData.currentSchoolStudentId
}).then(res => {});
}
posterLog({
poster_type: 4,
type: 2,
clock_circle_id: i,
clock_subject_id: t
});
this.setData({
id: i,
tid: t,
pagefrom: "",
advertisementshow: true,
pageScene: options.scene || ""
});
} else {
const { id, tid, sid, pagefrom, integral } = options;
const { id, sid } = options;
this.setData({
id,
tid,
sid: sid || 0,
pagefrom: pagefrom ? pagefrom : "",
advertisementshow: true
});
}
app.getCurrentSchoolStudentId({
source_id: this.data.id,
source_type: 7
}).then(() => {
this.setData({
activitybarloaded: true
sid,
});
this.userShow();
this.setData({
hasmore: true
});
this.data.clockPage = 1;
this.setData({
advertisementshow: true,
activitybarloaded: true
});
});
this.subjectSignStudents();
wx.login({
success(res) {
console.log(res,'load')
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
this.getThemeAdDetail();
},
onShow: function(options) {
if (this.data.needREfresh || this.data.needRefresh) {
// TODO
this.data.needRefresh = false;
}
},
queryActivtySchoolInfo(sid) {
let activtySchoolInfo = null;
getActivities().then(res => {
const visitor = LocalStorage.getItem("visitor");
activtySchoolInfo = res.data.list.find(ele => ele.sid == sid);
if (activtySchoolInfo) {
this.setData({
activtySchoolInfo
});
activityLog({
type: 14,
open_id: visitor && visitor.openid,
school_id: this.data.activtySchoolInfo.sid,
remark: ""
});
}
});
},
onReady: function() {
},
adInfoGet() {
adInfoGet({
class_id: this.data.id
}).then(res => {
const { code, data } = res;
if (code == 200 && data) {
if (data.custom == "") {
data.custom = [];
} else {
try {
data.custom = JSON.parse(data.custom);
} catch (error) {
data.custom = [];
}
}
this.setData({
adInfo: data
});
} else {
this.setData({
adInfo: {
custom: []
}
});
}
});
},
onHide: function() {
this.setData({
activitybarloaded: false
});
},
onUnload: function() {
this.setData({
advertisementshow: false,
activitybarloaded: false
});
},
onPullDownRefresh: function() {
this.setData({
hasmore: true,
pagefrom: ""
});
this.data.clockPage = 1;
this.themeDetail();
this.clockListGet("down");
},
onReachBottom: function() {
this.clockListGet("up");
},
// 跟打卡之后积分获取弹窗有关的操作
closefeedback() {
getThemeAdDetail () {
getThemeAdDetail({
id: this.data.id,
}).then((res) => {
const { code, data } = res;
if (code == 200) {
this.setData({
scoreFeedBackStatus: {
integral: 0,
show: false,
scoretype: 2
landPageInfo: {
cover: data.cover,
content: JSON.parse(data.content),
name: data.name,
// mobile: '',
mobile: data.mobile,
img: data.img,
title: data.title
}
});
},
autoclosefeedback() {
setTimeout(() => {
this.setData({
integral: 0,
scoreFeedBackStatus: {
integral: 0,
show: false,
scoretype: 2
})
}
});
}, 2500);
},
onShareAppMessage: function(option) {
const { from, target } = option;
const visitor = LocalStorage.getItem("visitor");
const nickName = (visitor.userInfo && visitor.userInfo.nickName) || "";
let myBaseinfo = this.data.myBaseinfo;
let shareObj = {};
let initShareObj = {
title: `我正在参加【${this.data.circleInfo.title}】的打卡`,
path: `/src/pages/themeindex/landpage?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}&consumerId=${(visitor && visitor.id) || 0}&w=${
app.globalData.currentSchoolStudentId
}`
};
// if (from == "menu") {
shareObj = initShareObj;
app.setSharerLog({
source_type_model: 5,
source_path: "src/pages/beforeinvitation/index",
source_id: this.data.tid,
source_type_model: 5,
param: JSON.stringify({
query: `tid=${this.data.tid}&consumerId=${(visitor && visitor.id) ||
0}&w=${app.globalData.currentSchoolStudentId}`
})
});
// }
console.log(shareObj)
return {
title: shareObj.title,
imageUrl: imagify(this.data.themeSelect.banner || 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png'),
path: shareObj.path
};
},
judgeIsSchoolStudent(sid) {
studentidentity({
school_id: sid
// 播放录音的相关操作
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
voiceIntervalPlay (value) { // 初始化录音的状态
let voiceInterval = setInterval(() => {
let audioStorage = this.data.audioStorage;
let currentTime = ++audioStorage[value].currentTime;
this.setData({
audioStorage
})
.then(res => {
const { data, code } = res;
if (code == 30005) {
if (currentTime >= this.data.audioStorage[value].duration) {
audioStorage[value].play = false;
audioStorage[value].currentTime = 0;
// audioStorage[value].innerAudioContext.seek(0);
// audioStorage[value].innerAudioContext.pause();
this.setData({
isSchoolStudent: false
});
audioStorage
})
clearInterval(this.data.voiceInterval);
}
if (code == 200) {
if (data) {
this.data.myBaseinfo = data.student;
this.setData({
isSchoolStudent: !data.is_visitor
});
} else {
}, 1000);
this.setData({
isSchoolStudent: false
});
}
}
voiceInterval
})
.then(() => {});
},
userShow() {
const visitor = LocalStorage.getItem("visitor");
studentidentity({
class_id: this.data.id
playvoice (e) {
const {value, duration} = e.detail;
const that = this;
// this.innerAudioContext.src = audioorigin(value);
// this.innerAudioContext.obeyMuteSwitch = false;
wx.getNetworkType({
success: (res) => {
if (res.networkType != 'none') {
that.resetAudiosPlayStatus();
clearInterval(that.data.voiceInterval);
let audioStorage = that.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
play: true,
currentTime: 0,
duration,
isWaiting: false,
innerAudioContext: wx.createInnerAudioContext(),
}
audioStorage[value].innerAudioContext.src = audioorigin(value);
audioStorage[value].innerAudioContext.obeyMuteSwitch = false;
audioStorage[value].innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data;
clearInterval(that.data.voiceInterval);
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
.then(res => {
wx.hideLoading();
const { code, data } = res;
if (code == 200 && data) {
this.data.studentStatus = data.student_status || 1;
this.data.userInfoDetail = data;
this.setData({
auditStatus: data.audit_status,
noUser: data.is_visitor,
studentId: data.student_id,
hasmore: true
});
this.data.clockPage = 1;
this.themeDetail();
this.clockListGet("init");
} else {
this.setData({
auditStatus: 1,
noUser: true
});
}
})
.catch(() => {
this.setData({
auditStatus: 1
});
});
},
expandaction() {
this.setData({
isexpand: !this.data.isexpand
});
},
getCircleDetail(id) {
circleDetail({
class_id: id
}).then(res => {
if (res.code == 200) {
let content = [];
try {
content = JSON.parse(res.data.content);
} catch (e) {
content = [];
}
if (res.code == 40000) {
if (res.msg) {
wx.showModal({
title: "提示",
content: "班级已被删除,点击确定返回机构首页",
showCancel: false,
confirmText: "确定",
success(r) {
if (r.confirm) {
wx.reLaunch({
url: `/src/pages/shopindex/index?mid=${res.data.member_id}`
});
}
}
});
// return;
}
}
res.data.content = content;
// res.data.clock_address.tel_parse = JSON.parse(res.data.clock_address.tel);
res.data.school_id = Number(res.data.school_id);
const visitor = LocalStorage.getItem("visitor");
activityLog({
type: 22,
open_id: visitor && visitor.openid,
school_id: res.data.school_id,
remark: ""
});
if (this.data.pageScene) {
activityLog({
type: 26,
open_id: visitor && visitor.openid,
school_id: res.data.school_id,
remark: ""
});
}
this.judgeIsSchoolStudent(res.data.school_id);
this.setData(
{
circleInfo: res.data
},
() => {}
);
}
});
},
themeDetail() {
themeDetail({
subject_id: this.data.tid,
extra: 'land_content'
}).then(res => {
const { data, code, datetime } = res;
this.data.datetime = datetime;
if (code == 200) {
if (!data) {
wx.showModal({
title: "提示",
content: "主题已被删除,点击确定返回班级首页",
showCancel: false,
confirmText: "确定",
success(r) {
if (r.confirm) {
wx.reLaunch({
url: `/src/pages/circleindex/index?id=${this.data.id}`
});
}
}
});
return false;
}
wx.setNavigationBarTitle({
title: data.title
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
console.log('sss');
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(value);
audioStorage[value].isWaiting = false
that.setData({
audioStorage,
})
this.queryActivtySchoolInfo(data.school_id);
this.judgeIsClock(this.data.tid);
this.schoolInfoGet(data.school_id);
this.getCircleDetail(data.class_id);
data.content = JSON.parse(data.content);
const nowTime = new Date(res.datetime.replace(/-/g, "/")).getTime();
const startTime = new Date(
data.homework_set.publish_time.replace(/-/g, "/")
).getTime();
const endTime = new Date(
data.homework_set.end_time.replace(/-/g, "/")
).getTime();
if (nowTime >= startTime && nowTime <= endTime) {
data.themeStatus = 1; // 进行中
} else if (nowTime < startTime) {
data.themeStatus = 2; // 未开始
} else {
data.themeStatus = 3; // 未已结束
}
this.data.isExpire =
new Date(data.homework_set.end_time.replace(/-/g, "/")).getTime() -
new Date(res.datetime).getTime() >
0
? false
: true;
this.setData({
themeSelect: data,
});
}
});
},
judgeIsClock(tid) {
const visitor = LocalStorage.getItem("visitor");
judgeIsClock({
subject_id: tid,
student_id: this.data.studentId,
now_student_id: this.data.studentId
})
.then(res => {
const { code, data } = res;
if (this.data.needREfresh) {
this.data.needREfresh = false;
}
if (code == 200) {
if (!data) {
this.setData({
isClock: false
audioStorage[value].innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[value].isWaiting = false;
audioStorage[value].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
audioStorage,
})
});
// this.positionGet('countdown', (rect) => {
// this.setData({
// countDownPositionTop: rect.top + 30,
// })
// })
} else {
data.imgVideo_parse = JSON.parse(data.video);
data.img_parse = [];
data.video = [];
for (let i = 0; i < data.imgVideo_parse.length; i++) {
if (data.imgVideo_parse[i].type == "image") {
data.img_parse.push(data.imgVideo_parse[i]);
if (audioStorage[value].currentTime == audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
audioStorage[value].play = true;
} else {
data.video.push(data.imgVideo_parse[i]);
audioStorage[value].play = true;
}
audioStorage[value].isWaiting = false;
}
this.setData({
isClock: true,
userInfo: data,
personalClockInfo: data
});
if (
this.data.pagefrom == "clockeditor" &&
this.data.tid != this.data.activtySchoolInfo.tid
) {
audioStorage[value].innerAudioContext.seek(audioStorage[value].currentTime)
setTimeout(() => {
this.generateNewPoster();
}, 1500);
this.setData({
pagefrom: ""
});
}
if (
this.data.tid == this.data.activtySchoolInfo.tid &&
this.data.pagefrom == "clockeditor"
) {
activityprizestatus({
subject_id: this.data.tid
}).then(res => {
const { code, data } = res;
if (!data) {
const that = this;
wx.login({
success(res) {
if (res.code) {
audioStorage[value].innerAudioContext.play();
}, 500)
that.voiceIntervalPlay(value);
that.setData({
sessionCode: res.code,
atvDailogShow: true
});
} else {
}
}
});
const visitor = LocalStorage.getItem("visitor");
activityLog({
type: 9,
open_id: visitor && visitor.openid,
school_id: this.data.activtySchoolInfo.sid,
remark: ""
});
this.setData({
pagefrom: ""
});
audioStorage,
actPalyaudioValue:value
})
} else {
this.generateNewPoster();
}
});
}
}
}
wx.showToast({
title: '暂无网络, 请检查您的网络',
icon: 'none'
})
.catch(err => {
if (this.data.needREfresh) {
this.data.needREfresh = false;
}
});
},
newLikeIndex(clockRecordIds, callback) {
let LikesAndCommentObj = {};
if (clockRecordIds != "") {
newLikeIndex({
clock_record_id: clockRecordIds
}).then(res => {
callback && callback(res);
});
}
},
newCommentIndex(clockRecordIds, callback) {
if (clockRecordIds != "") {
newCommentIndex({
clock_record_id: clockRecordIds,
page: 1,
perPage: 3,
sort: "desc",
type: 1
}).then(res => {
callback && callback(res);
});
}
})
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
});
return _length;
pausevoice (e) {
const {value} = e.detail;
let audioStorage = this.data.audioStorage;
audioStorage[value].play = false;
this.setData({
audioStorage,
})
audioStorage[value].innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
},
clockListGet(type) {
voiceslide (e) {
const {value, slide, duration} = e.detail;
let audioStorage = this.data.audioStorage;
const that = this;
const visitor = LocalStorage.getItem("visitor");
if (!this.data.hasmore) {
return;
}
if (this.data.clockGetting) {
return;
}
this.setData({
clockGetting: true
});
// wx.showLoading({
// title: '数据加载中'
// })
clockList({
page: this.data.clockPage,
perPage: this.data.clockPerPage,
subject_id: this.data.tid,
school_id: this.data.sid,
type: 1,
// hidden_dismissed_class: 1,
now_student_id: this.data.studentId,
is_top: 1
wx.getNetworkType({
success: (res) => {
if (res.networkType != 'none') {
if (!audioStorage[value]) {
audioStorage[value] = {
play: false,
currentTime: slide,
duration,
isWaiting: false,
innerAudioContext: wx.createInnerAudioContext(),
}
audioStorage[value].innerAudioContext.src = audioorigin(value);
audioStorage[value].innerAudioContext.obeyMuteSwitch = false;
audioStorage[value].innerAudioContext.onWaiting((e)=>{
console.log(value, '等待1111');
if (audioStorage[value] && !audioStorage[value].play) {
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
.then(res => {
const { code, data } = res;
this.setData({
clockGetting: false
});
wx.hideLoading();
if (code != 200) {
// 失败的处理
} else {
if (data.total != undefined) {
this.setData({
clockTotal: data.total
});
}
let clockRecordIds = data.list
.map(ele => {
return ele.id;
})
.join(",");
data.list.map(ele => {
ele.video_parse = JSON.parse(ele.video);
ele.audio_parse = JSON.parse(ele.audio);
ele.imageCount = ele.video_parse.filter(
ele => ele.type == "image"
).length;
ele.videoCount = ele.video_parse.length - ele.imageCount;
ele.commentsExpand = false;
ele.likesExpand = false;
ele.commentsLoading = false;
ele.content_100 =
ele.content.length > 100
? ele.content.substr(0, 100) + "..."
: ele.content;
ele.contentexpand = false;
return ele;
});
switch (type) {
case "init": //页面进来第一次加载
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value].isWaiting) {
console.log('22222222222222222');
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(value);
audioStorage[value].isWaiting = false
that.setData({
clockList: [data.list]
});
if (
that.data.clockTotal >
this.caculateArrLength(that.data.clockList)
) {
let clockPage = that.data.clockPage + 1;
this.data.clockPage = clockPage;
} else {
// 没有更多了
this.data.hasmore = false;
}
break;
case "down": // 页面下拉刷新
that.setData({
clockList: [data.list]
});
if (
that.data.clockTotal >
this.caculateArrLength(that.data.clockList)
) {
let clockPage = that.data.clockPage + 1;
this.data.clockPage = clockPage;
} else {
// 没有更多了
this.data.hasmore = false;
}
wx.stopPullDownRefresh();
break;
case "up": // 页面上拉加载
that.setData({
[`clockList[${that.data.clockPage - 1}]`]: data.list
});
if (
that.data.clockTotal >
this.caculateArrLength(that.data.clockList)
) {
let clockPage = that.data.clockPage + 1;
this.data.clockPage = clockPage;
} else {
// 没有更多了
this.data.hasmore = false;
}
break;
default:
break;
}
if (this.caculateArrLength(that.data.clockList) == 0) {
that.setData({
emptyPage: true
});
} else {
that.setData({
emptyPage: false
});
}
this.newCommentIndex(clockRecordIds, function(commentRes) {
let clockPage = that.data.hasmore
? that.data.clockPage - 2
: that.data.clockPage - 1;
if (data.list.length > 0) {
for (let i = 0; i < that.data.clockList[clockPage].length; i++) {
let clockTemp = that.data.clockList[clockPage];
clockTemp.forEach(ele => {
if (commentRes.data.list[ele.id]) {
ele.comments = commentRes.data.list[ele.id];
} else {
ele.comments = {
list: [],
total: 0
};
}
});
}
that.setData({
[`clockList[${clockPage}]`]: that.data.clockList[clockPage]
});
}
});
this.newLikeIndex(clockRecordIds, function(likeRes) {
if (data.list.length > 0) {
let clockPage = that.data.hasmore
? that.data.clockPage - 2
: that.data.clockPage - 1;
for (let i = 0; i < that.data.clockList[clockPage].length; i++) {
likeRes.data.list[
that.data.clockList[clockPage][i].id
].list = likeRes.data.list[
that.data.clockList[clockPage][i].id
].list.splice(0, 15);
let clockTemp = that.data.clockList[clockPage];
clockTemp.forEach(ele => {
if (likeRes.data.list[ele.id]) {
ele.likes = likeRes.data.list[ele.id];
}
});
audioStorage,
})
}
})
audioStorage[value].innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[value].isWaiting = false;
audioStorage[value].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
[`clockList[${clockPage}]`]: that.data.clockList[clockPage]
});
}
});
}
audioStorage,
})
.catch(e => {
this.setData({
clockGetting: false
});
});
},
// 去打卡
goClock(e) {
// 先授权
const visitor = LocalStorage.getItem("visitor");
if (this.data.circleInfo.had_password) {
this.setData({
showPsdDia: true
});
} else {
wx.navigateTo({
url: `/src/pages/themeindex/index?id=${this.data.id}&tid=${this.data.themeSelect.id}&sid=${this.data.sid}`
});
}
},
// 加入圈子输入码相关代码
closepsddia() {
this.setData({
// password: '',
showPsdDia: false
});
},
checkPsd(e) {
const { remark } = e.detail;
this.setData({
remark: remark,
showPsdDia: false,
});
},
// 加入圈子输入码相关代码
// 跟自己的打卡相关的内容
expandAccessment(e) {
const { cid, comments, commentsExpand } = e.detail;
const { bigindex, index } = e.currentTarget.dataset;
let clock = this.data.clockList[bigindex].find(ele => ele.id == cid);
clock.comments = comments;
clock.commentsExpand = commentsExpand;
this.setData({
[`clockList[${bigindex}][${index}]`]: clock
});
},
// 跟自己的打卡相关的内容
// 跟打卡列表组件相关联的操作
delEvaluate(e) {
const { eid, cid, roottype } = e.detail;
const { bigindex, index } = e.currentTarget.dataset;
let clock = this.data.clockList[bigindex].find(ele => ele.id == cid);
if (roottype) {
clock.review[Number(roottype)].comments = clock.review[
Number(roottype)
].comments.filter(ele => ele.id != eid);
} else {
clock.comments.list = clock.comments.list.filter(ele => ele.id != eid);
clock.comments.total--;
}
this.setData({
[`clockList[${bigindex}][${index}]`]: clock
});
},
delClock(e) {
const { cid } = e.detail;
const { bigindex, index } = e.currentTarget.dataset;
const clockList = this.data.clockList[bigindex].filter(
ele => ele.id != cid
);
this.setData({
[`clockList[${bigindex}]`]: clockList
});
},
expandLikes(e) {
const { cid, likes, likesExpand } = e.detail;
this.data.clockList.find(ele => ele.id == cid).likes = likes;
this.data.clockList.find(ele => ele.id == cid).likesExpand = likesExpand;
this.setData({
clockList: this.data.clockList
});
},
expandContent(e) {
const { clock } = e.detail;
this.data.clockList.find(
ele => ele.id == clock.id
).contentexpand = !clock.contentexpand;
this.setData({
clockList: this.data.clockList
});
},
expandAccessment(e) {
const { cid, comments, commentsExpand } = e.detail;
const { bigindex, index } = e.currentTarget.dataset;
let clock = this.data.clockList[bigindex].find(ele => ele.id == cid);
clock.comments = comments;
clock.commentsExpand = commentsExpand;
this.setData({
[`clockList[${bigindex}][${index}]`]: clock
});
},
fingureUp(e) {
const { cid, customerId, nickname, type, integral } = e.detail;
const { bigindex, index } = e.currentTarget.dataset;
let clock = this.data.clockList[bigindex].find(ele => ele.id == cid);
if (type == 2) {
// 取消点赞
if (clock.likes.list.find(ele => ele.student_id == customerId)) {
clock.had_like = 0;
clock.likes.total--;
clock.likes.list = clock.likes.list.filter(
ele => ele.student_id != customerId
);
}
} else if (type == 1) {
// 点赞
clock.had_like = 1;
if (!clock.likes) {
clock.likes = {
list: [
{
student_id: customerId,
nickname: nickname,
remark:
(this.data.personalClockInfo.clock_circle_user &&
this.data.personalClockInfo.clock_circle_user.remark) ||
nickname
}
],
total: 1
};
if (slide >= audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
audioStorage[value].play = false;
audioStorage[value].innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
} else {
if (clock.likes.list.find(ele => ele.student_id == customerId)) {
return false;
audioStorage[value].currentTime = slide;
}
clock.likes.list.push({
student_id: customerId,
nickname: nickname,
remark:
(this.data.personalClockInfo.clock_circle_user &&
this.data.personalClockInfo.clock_circle_user.remark) ||
nickname
});
clock.likes.total++;
audioStorage[value].isWaiting = false;
}
if (integral > 0) {
this.setData({
scoreFeedBackStatus: {
integral: integral,
show: true,
scoretype: 2
}
});
this.autoclosefeedback();
audioStorage,
})
} else {
wx.showToast({
title: '暂无网络, 请检查您的网络',
icon: 'none'
})
}
}
this.setData({
[`clockList[${bigindex}][${index}]`]: clock
});
},
// 跟打卡列表组件相关联的操作
goInviteFriend() {
wx.navigateTo({
url: `/src/pages/invitationcard/index?tid=${this.data.tid}&id=${this.data.id}`
});
})
},
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
voiceIntervalPlay(value) {
// 初始化录音的状态
let voiceInterval = setInterval(() => {
let audioStorage = this.data.audioStorage;
let currentTime = ++audioStorage[value].currentTime;
this.setData({
audioStorage
});
if (currentTime >= this.data.audioStorage[value].duration) {
slidestart (e) {
const {value, slide} = e.detail;
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则先暂停音乐盒计时器 播放按钮状态不需要改
audioStorage[value].innerAudioContext.pause();
audioStorage[value].play = false;
audioStorage[value].currentTime = 0;
this.setData({
audioStorage
});
clearInterval(this.data.voiceInterval);
} else { // 如果当前不是播放状态 则该干嘛干嘛
}
}, 1000);
this.setData({
voiceInterval
});
actPalyaudioValue: value,
audioStorage,
})
},
// 视频播放相关代码
videoplay(e) {
const { video } = e.detail;
wx.navigateTo({
url: `/src/pages/videoplay/index?video=${encodeURIComponent(video)}`
});
slideend (e) {
},
// 视频播放相关代码
schoolInfoGet(id) {
getSchoolDetail(id).then(res => {
const { code, data } = res;
if (code == 200) {
this.data.schoolInfo = data;
// this.setData({
// schoolInfo: data
// })
resetAudiosPlayStatus () { // 点击一个录音的时候把其他的录音状态改成暂停状态
let audioStorage = this.data.audioStorage;
Object.keys(audioStorage).forEach((key) => {
audioStorage[key].play = false;
audioStorage[key].isWaiting = false;
if (audioStorage[key].innerAudioContext) {
audioStorage[key].innerAudioContext.pause();
}
});
},
showcommenteditor(e) {
this.data.bigindex = e.currentTarget.dataset.bigindex;
this.data.clockitemtype = e.currentTarget.dataset.clockitemtype;
this.setData({
commentclock: e.detail,
commenteditor: true
});
audioStorage,
})
},
hidecommenteditor(e) {
const _clockList = this.data.clockList[this.data.bigindex];
const _selfClockDetail = this.data.selfClockDetail;
if (this.data.clockitemtype == "selfclock") {
if (e.detail && e.detail.comment) {
const comment = e.detail.comment;
_selfClockDetail.comments.list.unshift(comment);
//_selfClockDetail.comments.list = _selfClockDetail.comments.list.slice(0, 3);
_selfClockDetail.comments.total += 1;
this.setData({
selfClockDetail: _selfClockDetail
});
}
} else if (this.data.clockitemtype == "clocklist") {
const bigindex = this.data.bigindex;
const _clockList = this.data.clockList[bigindex];
if (e.detail && e.detail.comment) {
const comment = e.detail.comment;
for (let i = 0; i < _clockList.length; i++) {
if (_clockList[i].id == comment.record_id) {
// if (_clockList[i].comments.list.length >= 3) {
// break;
// } else {
_clockList[i].comments.list.unshift(comment);
_clockList[i].comments.list = _clockList[i].comments.list.slice(
0,
3
);
_clockList[i].comments.total += 1;
// }
}
}
}
this.setData({
[`clockList[${bigindex}]`]: _clockList
});
}
const { integral } = e.detail;
if (integral > 0) {
this.setData({
scoreFeedBackStatus: {
integral: integral,
show: true,
scoretype: 2
}
});
this.autoclosefeedback();
delvoice (e) {
const {value} = e.detail;
let audioStorage = this.data.audioStorage;
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 删除录音的操作要把录音销毁掉
audioStorage[value].innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
}
this.setData({
commenteditor: false
// clockList: _clockList,
});
},
// 视频播放相关代码
playvideo(e) {
const that = this;
const { src, from, mode } = e.detail;
this.setData({
"videostatus.videoId": src,
"videostatus.videoShow": true,
"videostatus.src": src,
"videostatus.mode": mode || "mp4"
});
that.videoContext = wx.createVideoContext(src);
that.videoContext.play();
},
screenchange(e) {
const { fullScreen } = e.detail;
},
closeVideo() {
this.setData({
"videostatus.videoId": "",
"videostatus.videoShow": false,
"videostatus.src": ""
});
},
// 视频播放相关代码
// 倒计时完成
// 防止悬浮窗滚动页面滚动,无特殊意义
ture() {},
videoErrorCallback(e) {},
goWebsiteIndex() {
wx.reLaunch({
url: `/src/pages/websiteindex/index?sid=${this.data.circleInfo.school_id}`
});
const visitor = LocalStorage.getItem("visitor");
if (!this.data.isSchoolStudent && this.data.pageScene) {
activityLog({
type: 27,
open_id: visitor && visitor.openid,
school_id: this.data.circleInfo.school_id,
remark: ""
});
}
audioStorage,
})
},
// 跟录音相关的操作
bindModalContact() {
if (this.data.modalContact) {
this.setData({
......@@ -1151,113 +321,31 @@ Page({
});
}
},
bindCall() {
bindCall(e) {
let { mobile } = e.currentTarget.dataset;
const that = this;
wx.makePhoneCall({
phoneNumber: "182224144"
phoneNumber: that.data.landPageInfo.mobile
});
},
// 报名学员
subjectSignStudents() {
subjectSignStudents ({
subject_source_id: this.data.tid,
subject_source_type: 1,
page: 1,
perPage: 6
}).then((res) => {
const {code, data} = res;
if (code != 200) {
}
this.setData({
signStudentsTotal: data.total,
signStudentsList: data.list
})
}).catch((err) => {
console.log(err)
})
},
// 获取手机号 学员报名
getPhoneNumber(e) {
const visitor = LocalStorage.getItem('visitor');
let that = this;
const {
encryptedData,
iv
} = e.detail
if (!encryptedData) {
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 2000
})
return
} else {
}
// wx.showLoading({
// title: '手机号获取中',
// })
getwechatmobile({
code: this.data.sessionCode,
encryptData: encryptedData,
iv
}).then((res) => {
wx.hideLoading();
const { code, data } = res;
if (code == 200 && data && data.mobile) {
this.joinClock(data.mobile)
console.log(res,'res')
} else {
wx.showToast({
title: '手机号获取失败',
icon: 'none',
duration: 2000
})
}
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
}).catch((err) => {
wx.hideLoading()
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
gouse () {
const currentPages = getCurrentPages();
const themeeditorPage = currentPages.find(ele => ele.route == 'business/pages/themeeditor/index');
const themeeditorPageIndex = currentPages.findIndex(ele => ele.route == 'business/pages/themeeditor/index');
const delta = currentPages.length - themeeditorPageIndex - 1;
themeeditorPage.setData({
themeAdInfo: {
id: this.data.id,
title: this.data.landPageInfo.title,
}
})
wx.navigateBack({
delta,
})
},
joinClock(mobile) {
subjectStudentSign ({
subject_source_id: this.data.tid,
subject_source_type: 1,
mobile
}).then((res) => {
const {code, data} = res;
if (code == 200) {
this.goClock()
} else {
wx.showToast({
title: '加入失败'
})
}
}).catch((err) => {
console.log(err)
goedit () {
wx.navigateTo({
url: `/business/pages/themead/index?id=${this.data.id}&sid=${this.data.sid}`
})
}
});
{
"navigationBarTitleText": "",
"usingComponents": {
"sjd-media-show": "../../../components/sjdmediashow",
"clock-item": "../../components/clockitemv2",
"empty-content": "../../../components/emptycontent",
"remark-editor": "../../components/remarkeditor",
"psd-editor": "../../components/psdeditor",
"poster-box": "../../../components/posterbox",
"sjd-bullet": "../../../components/bullet",
"sjd-contact": "../../../components/contact",
"go-top": "../../../components/goTop",
"list-loading": "../../../components/listloading",
"comment-editor": "../../../components/commenteditor",
"canvasdrawer": "/components/canvasdrawer/canvasdrawer",
"activity-bar":"../../../components/activitybar",
"btn-drag":"../../../components/btndrag",
"guidecollection": "../../../components/guidecollection"
"sjd-media-show": "../../../components/sjdmediashow"
}
}
\ No newline at end of file
......@@ -2,24 +2,15 @@
<view class="container">
<view class="section">
<view class="banner-box" >
<image class="banner" src="https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png"></image>
<view class="btn-group">
<button class="btn" open-type="share">分享</button>
<!-- <view class="btn">排行榜</view> -->
<image class="banner" src="{{filter.imagify(landPageInfo.cover)}}"></image>
</view>
<view class="shadow-box"></view>
<view class="title-box">
<view class="title">{{themeSelect.title}}</view>
<view class="time">老师 {{themeSelect.start_time}} 发布</view>
</view>
</view>
<view class="instro-bx" wx:if="{{themeSelect.land_content && themeSelect.land_content.length>0}}">
<view class="instro-bx" wx:if="{{landPageInfo.content && landPageInfo.content.length > 0}}">
<view class="title-box">
<view class="title">介绍</view>
</view>
<view class="media-box">
<sjd-media-show
content="{{themeSelect.land_content}}"
content="{{landPageInfo.content}}"
bind:playvoice="playvoice"
actionsPalyvalue="{{actPalyaudioValue}}"
bind:pausevoice="pausevoice"
......@@ -27,12 +18,12 @@
audioStorage="{{audioStorage}}"
bind:slidestart="slidestart"
bind:slideend="slideend"
widthtext="{{true}}"
widthtext="{{false}}"
expanded="{{isexpand}}"
bind:expandaction="expandaction"
text="点击"
bind:playvideo="playvideo"
defineheight="{{360}}"
expandeddefault="{{false}}"
>
</sjd-media-show>
</view>
......@@ -41,98 +32,14 @@
<view class="section contact-box">
<view class="left">
<image class="avatar" src="https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png" wx:if="{{themeSelect.land_content.teacher.avatar}}"></image>
<image class="avatar" src="{{filter.imagify(landPageInfo.img)}}" wx:if="{{landPageInfo.img}}"></image>
<image class="avatar" src="{{imageRoot}}common/empty/avatar_teacher.png?{{imageVersion}}" wx:else></image>
<view class="nickname">齇老师</view>
<view class="nickname">{{landPageInfo.name}}</view>
</view>
<view class="right" bindtap="bindModalContact">
<view class="btn-contact">联系老师</view>
</view>
</view>
<view class="section clocker-box" wx:if="{{signStudentsTotal>0}}">
<view class="title">他们也在({{signStudentsTotal}}人)</view>
<view class="sub-title">加入打卡跟他们一起养成好习惯</view>
<view class="list">
<view class="item" wx:for="{{signStudentsList}}" wx:key="item.id">
<image class="avatar" src="{{filter.imagify(item.school_student.avatar)}}" wx:if="{{item.school_student.avatar}}"></image>
<image class="avatar" src="{{imageRoot}}common/empty/avatar_user.png?{{imageVersion}}" wx:else></image>
<view class="nickname">{{item.school_student.nickname}}</view>
</view>
</view>
</view>
<!-- <view class="text" bindtap="goInviteFriend">邀请好友</view> -->
<view class="section recomend-clockbox">
<view class="title">精选打卡预览({{clockTotal}}篇打卡)</view>
<block wx:if="{{themeSelect.is_cheat == 0 || (themeSelect.is_cheat == 1 && isClock) || (themeSelect.is_cheat == 1 && !isSchoolStudent) || (clockTotal + selfcount) == 0}}">
<view class="clock-list" wx:if="{{!emptyPage}}">
<block wx:for="{{clockList}}" wx:key="bigindex" wx:for-index="bigindex" wx:for-item="bigitem">
<view class="clock-item" wx:key="index" wx:for="{{bigitem}}">
<clock-item clock="{{item}}"
bind:delClock="delClock"
bind:expandAccessment="expandAccessment"
bind:fingureUp="fingureUp"
cindex="{{index}}"
bigindex="{{bigindex}}"
tid="{{themeSelect.id}}"
cid="{{id}}"
frompage="1"
bind:expandLikes="expandLikes"
bind:expandContent="expandContent"
headerclick="{{true}}"
bind:playvoice="playvoice"
bind:pausevoice="pausevoice"
bind:voiceslide="voiceslide"
audioStorage="{{audioStorage}}"
bind:slidestart="slidestart"
bind:slideend="slideend"
bind:videoplay="videoplay"
bind:delEvaluate="delEvaluate"
bind:showcommenteditor="showcommenteditor"
bind:playvideo="playvideo"
isactivityclock="{{tid == activtySchoolInfo.tid}}"
bind:drawpaint="drawpaint"
bind:integrallogpost="integrallogpost"
data-bigindex="{{bigindex}}"
data-index="{{index}}"
data-clockitemtype="clocklist"
>
</clock-item>
</view>
</block>
<list-loading loading="{{clockGetting}}"></list-loading>
</view>
<view class="empty-content-box" wx:if="{{(clockTotal + selfcount) == 0}}">
<empty-content text="还没有精选打卡内容~" emptyimg="common/empty/empty_c_sraech.png" width="263" height="219"></empty-content>
</view>
</block>
<view class="empty-content-box" wx:else>
<empty-content text="打卡后才能看到其他同学的打卡内容喔~" emptyimg="common/empty/empty_c_sraech.png" width="263" height="219"></empty-content>
</view>
</view>
<view class="footer-box">
<view class="footer-innerbox" wx:if="{{true}}">
<view class="btn btn-inviteinfo">
<image class="avatar" src="https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png"></image>
<view class="info">
<view class="nickname">齇老师</view>
<view class="tip">邀请你加入</view>
</view>
</view>
<!-- <button class="btn btn-clock" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">加入打卡</button> -->
<button class="btn btn-clock" bindtap="goClock">加入打卡</button>
</view>
<view class="footer-innerbox" wx:if="{{!true}}">
<view class="btn btn-home" bindtap="goWebsiteIndex">
<image class="icon-home" src="{{localImageRoot}}common/icon_home.png?{{imageVersion}}"></image>
<view class="tip">学校首页</view>
</view>
<view class="btn btn-clock" bindtap="goClock">去打卡</view>
</view>
</view>
<view class="modal modal-contact {{modelContactAnimate? 'hide': ''}}" hidden="{{!modalContact}}">
<view class="mask" bindtap="bindModalContact"></view>
<view class="modal-content">
......@@ -141,7 +48,7 @@
<image class="icon-opt" src="{{localImageRoot}}2c/themeindex/icon_wx.png?{{imageVersion}}"></image>
<view class="item-title">添加微信</view>
</button>
<view class="opt-item" bindtap="bindCall">
<view class="opt-item" bindtap="bindCall" wx:if="{{landPageInfo.mobile}}">
<image class="icon-opt" src="{{localImageRoot}}2c/themeindex/icon_call.png?{{imageVersion}}"></image>
<view class="item-title">拨打电话</view>
</view>
......@@ -149,23 +56,8 @@
<image class="icon-cancel" src="{{localImageRoot}}2c/themeindex/icon_close.png?{{imageVersion}}" bindtap="bindModalContact"></image>
</view>
</view>
<psd-editor bind:closepsddia="closepsddia" circleid="{{id}}" wx:if="{{showPsdDia}}" bind:checkPsd="checkPsd">
</psd-editor>
<go-top wx:if="{{backTopValue}}"></go-top>
<view class="" data-editor="commenteditor">
<comment-editor wx:if="{{commenteditor}}" prams="{{commentclock}}" bind:hidecommenteditor="hidecommenteditor"
type="2c"></comment-editor>
</view>
<view class="videodialog" wx:if="{{videostatus.videoShow}}">
<view class="videodialogmask" bindtap="closeVideo"></view>
<video class="" binderror="videoErrorCallback" src="{{filter.transformOssVideofy(videostatus.src,videostatus.mode)}}" id="{{videostatus.videoId}}"
initial-time="0" autoplay="false" loop="false" bindplay="" bindpause="" bindended=""
bindtimeupdate="" bindwaiting="" binderror="" bindfullscreenchange="screenchange">
</video>
<view class="bottombtnbox">
<view class="editbtn bottombtn" bindtap="goedit">编辑</view>
<view class="usebtn bottombtn" bindtap="gouse">使用</view>
</view>
<guidecollection/>
</view>
\ No newline at end of file
......@@ -72,7 +72,7 @@ page {
}
.instro-bx {
padding: 20rpx 20rpx 0;
padding: 20rpx 20rpx 20rpx;
}
.instro-bx .title-box {
display: flex;
......@@ -428,3 +428,30 @@ page {
height: 500rpx;
position: relative;
}
.bottombtnbox {
position: fixed;
width: 100%;
left: 0;
bottom: 0;
height: 100rpx;
display: flex;
}
.bottombtnbox .bottombtn{
display: flex;
align-items: center;
justify-content: center;
height: 100rpx;
font-size: 30rpx;
z-index: 5;
box-shadow:0px -2rpx 4rpx 0px rgba(214,205,189,0.5);
}
.bottombtnbox .bottombtn.editbtn {
width: 220rpx;
background-color: #FFFFFF;
color: #666666;
}
.bottombtnbox .bottombtn.usebtn {
width: 530rpx;
background-color: #16B0FD;
color: #fff;
}
\ No newline at end of file
......@@ -30,12 +30,13 @@ Page({
localImageRoot: '../../../images/',
sid: 0,
page: 1,
perPage: 10,
perPage: 100,
hasmore: true,
listLoading: false,
emptyPage: false,
list: [],
total: 0,
showRefresh: false
},
onLoad: function(options) { // Do some initialize when page load.
const { sid } = options;
......@@ -48,6 +49,15 @@ Page({
},
onShow: function() { // Do something when page show.
if (this.data.showRefresh) {
this.setData({
hasmore: true,
listLoading: false,
emptyPage: false,
})
this.getThemeAdList('init');
this.data.showRefresh = false;
}
},
onHide: function() { // Do something when page hide.
},
......@@ -169,17 +179,10 @@ Page({
},
useThemeAd(e) {
const { item } = e.currentTarget.dataset;
console.log(item, 'item');
const currentPages = getCurrentPages();
console.log(currentPages, 'currentPages');
// business/pages/themeeditor/index
const themeeditorPage = currentPages.find(ele => ele.path = 'business/pages/themeeditor/index');
const themeeditorPageIndex = currentPages.findIndex(ele => ele.path = 'business/pages/themeeditor/index');
const themeeditorPage = currentPages.find(ele => ele.route == 'business/pages/themeeditor/index');
const themeeditorPageIndex = currentPages.findIndex(ele => ele.route == 'business/pages/themeeditor/index');
const delta = currentPages.length - themeeditorPageIndex - 1;
console.log(themeeditorPage, 'themeeditorPage');
console.log(themeeditorPageIndex, 'themeeditorPageIndex');
console.log(delta, 'delta');
// if ()
themeeditorPage.setData({
themeAdInfo: {
id: item.id,
......@@ -192,7 +195,13 @@ Page({
},
toEditLandpage () {
wx.navigateTo({
url: `/business/pages/themead/index?sid=${this.data.sid}`
url: `/business/pages/themead/index?id=0&sid=${this.data.sid}`
})
},
viewThemeAd (e) {
const { item } = e.currentTarget.dataset;
wx.navigateTo({
url: `/business/pages/themead/landpage?id=${item.id}&sid=${this.data.sid}`
})
}
})
\ No newline at end of file
......@@ -16,7 +16,7 @@
<view class="status">当前使用</view>
<view class="itembtnbox">
<view class="itembtn" data-item="{{item}}" bindtap="useThemeAd">立即使用</view>
<view class="itembtn">查看模板</view>
<view class="itembtn" data-item="{{item}}" bindtap="viewThemeAd">查看模板</view>
</view>
</view>
</view>
......
......@@ -4,6 +4,7 @@ Page({
data: {
sid: 0,
imageRoot: app.globalData.imageRoot,
localImageRoot: '../../../images/',
imageVersion: app.globalData.imageVersion,
is_cheat: 0,
// is_encrypt: 0,
......@@ -103,17 +104,6 @@ Page({
})
}
},
// encryptswitch() {
// if (Number(this.data.is_encrypt) == 0) {
// this.setData({
// is_encrypt: 1
// })
// } else if (Number(this.data.is_encrypt) == 1) {
// this.setData({
// is_encrypt: 0
// })
// }
// },
readswitch(){
if (Number(this.data.force_status) == 2) {
this.setData({
......
......@@ -2,18 +2,18 @@
<view class="bigtitle">参与打卡方式 (单选)</view>
<view class="section">
<w-cell-group>
<view class="form-itembox borderbottom1px">
<view class="form-itembox borderbottom1px" data-type="1" bindtap="joinruletypeChange">
<view class="form-item ">
<view class="item-l">
<text class="title">任何人都可参与</text>
<text class="title" style="color: #999999">(无通知)</text>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ join_rule_type == 1 }}" color="#65B8F4" size="small" data-type="1" bind:onChange="joinruletypeChange" />
<image class="selectedicon" src="{{localImageRoot}}2b/common/{{join_rule_type == 1 ? 'select1' : 'notselect'}}.png"></image>
</view>
</view>
</view>
<view class="form-itembox borderbottom1px">
<view class="form-itembox borderbottom1px" data-type="2" bindtap="joinruletypeChange">
<view class="form-item ">
<view class="item-l" style="display: block;">
<view>
......@@ -23,29 +23,29 @@
<view wx:if="{{ join_rule_type == 2 }}" style="font-size: 22rpx;color: #999999;"><text wx:for="{{classes}}" wx:for-item="class" wx:key="id">{{class.title}}<text wx:if="{{index < classes.length}}">,</text></text></view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ join_rule_type == 2 }}" color="#65B8F4" size="small" data-type="2" bind:onChange="joinruletypeChange" />
<image class="selectedicon" src="{{localImageRoot}}2b/common/{{join_rule_type == 2 ? 'select1' : 'notselect'}}.png"></image>
</view>
</view>
</view>
<view class="form-itembox borderbottom1px">
<view class="form-itembox borderbottom1px" data-type="3" bindtap="joinruletypeChange">
<view class="form-item ">
<view class="item-l" style="display: block;">
<view class="title">输入密码都可参与</view>
<view style="font-size: 22rpx;color: #999999;" wx:if="{{ join_rule_type == 3 }}">{{join_secret ? '已设置(密码:' + join_secret + ')' : '未设置'}}<text bindtap="changePsd" style="font-size: 22rpx;color: #16B0FD;margin-left: 20rpx">修改</text></view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ join_rule_type == 3 }}" color="#65B8F4" size="small" data-type="3" bind:onChange="joinruletypeChange" />
<image class="selectedicon" src="{{localImageRoot}}2b/common/{{join_rule_type == 3 ? 'select1' : 'notselect'}}.png" ></image>
</view>
</view>
</view>
<view class="form-itembox borderbottom1px">
<view class="form-itembox borderbottom1px" data-type="4" bindtap="joinruletypeChange">
<view class="form-item ">
<view class="item-l" style="display: block;">
<view class="title">指定班级学生参与</view>
<view wx:if="{{ join_rule_type == 4 }}" style="font-size: 22rpx;color: #999999;"><text wx:for="{{classes}}" wx:for-item="class" wx:key="id">{{class.title}}<text wx:if="{{index < (classes.length - 1)}}">,</text></text></view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ join_rule_type == 4 }}" color="#65B8F4" size="small" data-type="4" bind:onChange="joinruletypeChange" />
<image class="selectedicon" src="{{localImageRoot}}2b/common/{{join_rule_type == 4 ? 'select1' : 'notselect'}}.png" ></image>
</view>
</view>
</view>
......
......@@ -21,6 +21,10 @@ page{
/* padding: 10rpx 0; */
margin-bottom: 26rpx;
}
.selectedicon {
width: 38rpx;
height: 38rpx;
}
.usedesc {
color: #999999;
font-size: 22rpx;
......
......@@ -14,7 +14,7 @@ function getThemeAdList (data) { // 获取主题营销页列表
function getThemeAdDetail (data) { // 获取主题营销页详情
return wxRequest({
role: '2b',
url: `apis.business.themeAd.index/${data.id}`,
url: `${apis.business.themeAd.index}/${data.id}`,
data,
method: 'GET',
errorresolve: 1,
......@@ -24,7 +24,7 @@ function editThemeAd (data) { // 新增或修改主题营销模板
const { id } = data;
return wxRequest({
role: '2b',
url: id == 0 ? apis.business.themeAd.index : `apis.business.themeAd.index/${data.id}`,
url: id == 0 ? apis.business.themeAd.index : `${apis.business.themeAd.index}/${data.id}`,
data,
method: id == 0 ? 'POST' : 'PUT',
errorresolve: 1,
......@@ -34,7 +34,7 @@ function delThemeAd (data) { // 新增或修改主题营销模板
const { id } = data;
return wxRequest({
role: '2b',
url: `apis.business.themeAd.index/${data.id}`,
url: `${apis.business.themeAd.index}/${data.id}`,
data,
method: 'DELETE',
errorresolve: 1,
......
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