Commit ed83cd7d authored by lvtz's avatar lvtz

fix

parent ce5a107a
......@@ -136,7 +136,6 @@ Page({
likesObj: {},
commentsObj: {},
schoolInfo: '',
auditStatus: 3, // 1未申请2审核中3已通过
studentStatus: 1,
noUser: false,
commenteditor: false, // 评论input框
......@@ -222,7 +221,6 @@ Page({
if (options.scene) {
let sceneQuery = scenQueryGet(options.scene);
const {
i,
t,
c
} = sceneQuery;
......@@ -236,7 +234,6 @@ Page({
})
}
this.setData({
id: i,
tid: t,
pagefrom: '',
advertisementshow: true,
......@@ -244,7 +241,6 @@ Page({
})
} else {
const {
id,
tid,
sid,
pagefrom,
......@@ -272,7 +268,6 @@ Page({
})
}
this.setData({
id,
tid,
sid: sid || 0,
pagefrom: pagefrom ? pagefrom : '',
......@@ -283,7 +278,7 @@ Page({
})
}
app.getCurrentSchoolStudentId({
source_id: this.data.id,
source_id: this.data.sid,
source_type: 7,
}).then(() => {
this.userShow();
......@@ -519,7 +514,7 @@ Page({
// 跟打卡之后积分获取弹窗有关的操作
userShow() {
studentidentity({
class_id: this.data.id,
school_id: this.data.sid,
}).then((res) => {
wx.hideLoading();
const {
......@@ -528,7 +523,6 @@ Page({
} = res;
if (code == 200 && data) {
this.setData({
auditStatus: data.audit_status,
noUser: data.is_visitor,
studentId: data.student_id,
})
......@@ -537,14 +531,11 @@ Page({
this.getModesDetail();
} else {
this.setData({
auditStatus: 1,
noUser: true
})
}
}).catch(() => {
this.setData({
auditStatus: 1,
})
})
},
judgeIsSchoolStudent (sid) {
......@@ -2390,7 +2381,7 @@ Page({
this.websitehomeGet(data.school_id);
this.getSubjects(refresh);
this.schoolInfoGet(data.school_id)
this.getCircleDetail(data.class_id);
// this.getCircleDetail(data.class_id);
const visitor = LocalStorage.getItem('visitor');
activityLog({
type: 22,
......
......@@ -52,8 +52,7 @@
<view class="time">{{themeSelect.created_at}}</view>
</view>
<view class=""
wx:if="{{(!noUser && auditStatus == 3) || themeSelect.is_encrypt == 0}}">
<view wx:if="{{noUser || themeSelect.is_encrypt == 0}}">
<view class="{{detailExpand ? 'sjd-media-show-box noheight' : 'sjd-media-show-box'}}"
wx:if="{{themeSelect.content.length > 0}}">
<sjd-media-show content="{{themeSelect.content}}" bind:playvoice="playvoice"
......
import {
subjectList,
clockClasses,
} from '../../../service/customer/mytask.js';
import {
mixedthemeList
} from '../../../service/customer/circleindex.js';
import { mixedthemeList } from "../../../service/customer/circleindex.js";
import {
getActivities,
activityLog,
rankrecord
} from '../../../service/common.js';
import {
LocalStorage,
} from '../../../utilities/index.js';
import {
mineClassList
} from '../../../service/customer/circleindex.js';
import {
noticeread,
} from '../../../service/customer/mynews.js';
import {
userShow,
} from '../../../service/customer/themeindex.js';
import {
studentidentity
} from '../../../service/customer/signup.js'
} from "../../../service/common.js";
import { LocalStorage } from "../../../utilities/index.js";
import { noticeread } from "../../../service/customer/mynews.js";
import { userShow } from "../../../service/customer/themeindex.js";
import { studentidentity } from "../../../service/customer/signup.js";
var app = getApp();
Page({
data: {
id: 0,
sid: 0,
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
localImageRoot: "../../../images/",
mixedthemeList: [],
mixedthemeTotal: 0,
page: 1,
perPage: 10,
hasmore: true,
emptyPage: false,
listLoading: false,
schoolInfo:'',
schoolInfo: "",
from: 0, // 1 机构首页 2 班级列表
activtySchoolInfo: {
sid: 0,
id: 0,
tid: 0,
name: ''
name: ""
},
statusTab: [
{tabname: "待提交作业", statusType: 1},
{tabname: "已结束作业", statusType: 2}
{ tabname: "待提交作业", statusType: 1 },
{ tabname: "已结束作业", statusType: 2 }
],
statusType: 1
},
onLoad: function (options) {
const {
sid
} = options;
onLoad: function(options) {
const { sid } = options;
this.setData({
sid
});
this.queryActivtySchoolInfo(sid);
const visitor = LocalStorage.getItem('visitor');
const visitor = LocalStorage.getItem("visitor");
if (this.data.sid == 0) {
return;
}
app.getCurrentSchoolStudentId({
source_id: this.data.sid,
source_type: 10,
}).then(() => {
this.data.page = 1;
this.setData({
hasmore: true,
app
.getCurrentSchoolStudentId({
source_id: this.data.sid,
source_type: 10
})
this.themeListGet('init');
})
.then(() => {
this.data.page = 1;
this.setData({
hasmore: true
});
this.themeListGet("init");
});
activityLog({
type: 22,
open_id: visitor && visitor.openid,
school_id:this.data.sid,
remark: ''
})
school_id: this.data.sid,
remark: ""
});
this.getclockRankingList();
},
queryActivtySchoolInfo (sid) {
queryActivtySchoolInfo(sid) {
let activtySchoolInfo = null;
getActivities().then((res) => {
activtySchoolInfo = res.data.list.find((ele) => ele.sid == sid);
getActivities().then(res => {
activtySchoolInfo = res.data.list.find(ele => ele.sid == sid);
if (activtySchoolInfo) {
this.setData({
activtySchoolInfo
})
});
}
})
this.userShow()
});
this.userShow();
},
onShow: function () {
this.getclockRankingList();
},
onShow: function() {},
getclockRankingList() {
const visitor = LocalStorage.getItem('visitor');
const visitor = LocalStorage.getItem("visitor");
rankrecord({
school_id: this.data.sid,
page: 1,
perPage: 1,
type: 1,
consumer_id: visitor && visitor.id,
}).then((res) => {
const {
code,
data
} = res;
let myrate = 100;
if (code != 200) { // 失败的处理
} else {
if (data.total) {
const {
my_rank,
total
} = data;
myrate = total == 0 ? 100 : 100 - (Math.floor((my_rank && my_rank.index || 0) / data.total * 100));
if(myrate<80){
myrate = 80;
}
consumer_id: visitor && visitor.id
})
.then(res => {
const { code, data } = res;
let myrate = 100;
if (code != 200) {
// 失败的处理
} else {
if (data.total) {
const { my_rank, total } = data;
myrate =
total == 0
? 100
: 100 -
Math.floor(
(((my_rank && my_rank.index) || 0) / data.total) * 100
);
if (myrate < 80) {
myrate = 80;
}
}
}
}
this.setData({
myrate
})
}).catch((e) => {
this.setData({
listLoading: false
this.setData({
myrate
});
})
})
.catch(e => {
this.setData({
listLoading: false
});
});
},
userShow () {
const visitor = LocalStorage.getItem('visitor');
userShow() {
studentidentity({
school_id: this.data.sid
}).then((res) => {
const {data, code} = res;
if (code == 200 && data) {
this.setData({
userInfo: data.student,
noUserinfo: data.is_visitor,
})
}else{
this.setData({
noUserinfo: true
})
}
}).then(() => {
})
.then(res => {
const { data, code } = res;
if (code == 200 && data) {
this.setData({
userInfo: data.student,
noUserinfo: data.is_visitor
});
} else {
this.setData({
noUserinfo: true
});
}
})
.then(() => {});
},
onPullDownRefresh: function () {
onPullDownRefresh: function() {
this.setData({
hasmore: true,
// page: 1,
})
hasmore: true
});
this.data.page = 1;
this.themeListGet('down')
this.themeListGet("down");
},
onReachBottom: function () {
this.themeListGet('up')
onReachBottom: function() {
this.themeListGet("up");
},
subjectStatusShift (e) {
const {statustype} = e.currentTarget.dataset;
if(statustype == this.data.statusType){
return
subjectStatusShift(e) {
const { statustype } = e.currentTarget.dataset;
if (statustype == this.data.statusType) {
return;
}
this.data.mixedthemeTotal = 0;
this.data.page = 1;
this.setData({
statusType: statustype,
hasmore: true,
}, () => {
this.themeListGet('init');
})
this.setData(
{
statusType: statustype,
hasmore: true
},
() => {
this.themeListGet("init");
}
);
},
themeListGet(type) {
let that = this;
......@@ -189,150 +174,172 @@ Page({
return;
}
if (this.data.listLoading) {
return
return;
}
this.setData({
listLoading: true
})
});
mixedthemeList({
page: this.data.page,
perPage: this.data.perPage,
type: this.data.statusType,
sort_type: 1,
school_id:this.data.sid
}).then((res) => {
const {
code,
data
} = res;
this.setData({
listLoading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total) {
this.data.mixedthemeTotal = data.total;
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
mixedthemeList : [data.list]
})
if (this.data.mixedthemeTotal > this.caculateArrLength(this.data.mixedthemeList)) {
let page = this.data.page + 1;
this.data.page = page;
} else { // 没有更多了
school_id: this.data.sid
})
.then(res => {
const { code, data } = res;
this.setData({
listLoading: false
});
if (code != 200) {
// 失败的处理
} else {
if (data.total) {
this.data.mixedthemeTotal = data.total;
}
switch (type) {
case "init": //页面进来第一次加载
this.setData({
hasmore: false
})
}
break;
case 'down': // 页面下拉刷新
this.setData({
mixedthemeList: [data.list]
})
if (this.data.mixedthemeTotal > this.caculateArrLength(this.data.mixedthemeList)) {
let page = this.data.page + 1;
this.data.page = page;
} else { // 没有更多了
mixedthemeList: [data.list]
});
if (
this.data.mixedthemeTotal >
this.caculateArrLength(this.data.mixedthemeList)
) {
let page = this.data.page + 1;
this.data.page = page;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
break;
case "down": // 页面下拉刷新
this.setData({
hasmore: false
})
}
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
this.setData({
[`mixedthemeList[${this.data.page - 1}]`]: data.list
})
if (this.data.mixedthemeTotal > this.caculateArrLength(this.data.mixedthemeList)) {
let page = this.data.page + 1;
this.data.page = page;
} else { // 没有更多了
mixedthemeList: [data.list]
});
if (
this.data.mixedthemeTotal >
this.caculateArrLength(this.data.mixedthemeList)
) {
let page = this.data.page + 1;
this.data.page = page;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
wx.stopPullDownRefresh();
break;
case "up": // 页面上拉刷新
this.setData({
hasmore: false
})
}
break;
default:
break;
}
if (this.caculateArrLength(this.data.mixedthemeList) == 0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false
})
[`mixedthemeList[${this.data.page - 1}]`]: data.list
});
if (
this.data.mixedthemeTotal >
this.caculateArrLength(this.data.mixedthemeList)
) {
let page = this.data.page + 1;
this.data.page = page;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
break;
default:
break;
}
if (this.caculateArrLength(this.data.mixedthemeList) == 0) {
this.setData({
emptyPage: true
});
} else {
this.setData({
emptyPage: false
});
}
}
}
}).catch((e) => {
this.setData({
listLoading: false
})
})
.catch(e => {
this.setData({
listLoading: false
});
});
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
})
_length = _length + ele.length;
});
return _length;
},
goClock (e) {
const {dataset: {theme}} = e.currentTarget;
goClock(e) {
const {
dataset: { theme }
} = e.currentTarget;
this.themeNoticeRead(theme);
if(theme.subject_type == 1){
wx.navigateTo({
url: `/src/pages/themeindex/landpage?&tid=${theme.id}&sid=${this.data.sid}`
})
}else if(theme.subject_type == 2){
wx.navigateTo({
url: `/src/pages/calendarthemeindex/landpage?&tid=${theme.id}&sid=${this.data.sid}`
})
}else if(theme.subject_type == 3){
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${theme.class_id}&tid=${theme.id}&sid=${this.data.sid}`
})
if (theme.subject_type == 1) {
if (theme.is_join == 1) {
wx.navigateTo({
url: `/src/pages/themeindex/index?&tid=${theme.id}&sid=${this.data.sid}`
});
} else {
wx.navigateTo({
url: `/src/pages/themeindex/landpage?&tid=${theme.id}&sid=${this.data.sid}`
});
}
} else if (theme.subject_type == 2) {
if (theme.is_join == 1) {
wx.navigateTo({
url: `/src/pages/calendarthemeindex/index?&tid=${theme.id}&sid=${this.data.sid}`
});
} else {
wx.navigateTo({
url: `/src/pages/calendarthemeinde/landpage?&tid=${theme.id}&sid=${this.data.sid}`
});
}
} else if (theme.subject_type == 3) {
if (theme.is_join == 1) {
wx.navigateTo({
url: `/src/pages/morethemeindex/index?tid=${theme.id}&sid=${this.data.sid}`
});
} else {
wx.navigateTo({
url: `/src/pages/sharemoretheme/index?tid=${theme.id}&sid=${this.data.sid}`
});
}
}
},
// 任务列表
goTaskList () {
wx.navigateTo({
url: `/src/pages/tasklist/index?sid=${this.data.sid}`
})
},
// 已读未读处理
themeNoticeRead(item){
themeNoticeRead(item) {
noticeread({
type:item.subject_type==3?6:3,
id:item.id,
type: item.subject_type == 3 ? 6 : 3,
id: item.id,
school_id: this.data.sid
}).then((res) => {
const {
code,
data
} = res;
}).then(res => {
const { code, data } = res;
if (code == 200) {
}
})
});
},
goGrowthRecord(){
if(this.data.noUserinfo){
goGrowthRecord() {
if (this.data.noUserinfo) {
wx.showToast({
title: '您还未加入该校区',
title: "您还未加入该校区",
duration: 2000,
icon: 'none'
})
return
icon: "none"
});
return;
}
const visitor = LocalStorage.getItem('visitor');
const visitor = LocalStorage.getItem("visitor");
const userInfo = this.data.userInfo;
wx.navigateTo({
url: `/src/pages/growthrecord/index?consumerId=${userInfo.id}&sid=${this.data.sid}`,
})
url: `/src/pages/growthrecord/index?consumerId=${userInfo.id}&sid=${this.data.sid}`
});
}
})
\ No newline at end of file
});
......@@ -7,9 +7,5 @@
},
"navigationBarTitleText": "我的作业",
"enablePullDownRefresh": true,
"onReachBottomDistance": 100,
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black",
"backgroundColor": "#fff",
"backgroundTextStyle": "dark"
"onReachBottomDistance": 100
}
\ No newline at end of file
<!--business/pages/mytask/index.wxml-->
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="nav-custombox">
<view class="nav-title-box">
......@@ -23,18 +21,11 @@
<view class="title">{{item.title}}</view>
</view>
<view class="static-box">
<text class="" >共{{item.class_students_count}}学员</text>
<text>共{{item.class_students_count}}学员</text>
<text class="divideline" >|</text>
<text class="" >已提交{{item.clock_record_count}}人</text>
</view>
<!-- <view class="clockstatus wait" wx:if="{{!item.is_clock}}">
<image class="dianpinicon" src="{{imageRoot}}2c/circleindex/notclock.png?{{imageVersion}}"></image>
<text class="clockstatic" >未提交</text>
<text>已提交{{item.clock_record_count}}人</text>
</view>
<view class="clockstatus success" wx:if="{{item.is_clock}}">
<image class="dianpinicon" src="{{imageRoot}}2c/circleindex/isclock.png?{{imageVersion}}"></image>
<text class="clockstatic" >已提交</text>
</view> -->
<view class="clockstatus" wx:if="{{statusType==1}}">去提交</view>
<view class="clockstatus disabled" wx:if="{{statusType==2 && !item.is_clock}}">已结束</view>
<view class="clockstatus disabled" wx:if="{{statusType==2 && item.is_clock}}">已打卡</view>
......@@ -47,27 +38,18 @@
<view class="title">{{item.title}}</view>
</view>
<view class="static-box">
<text class="">共{{item.days}}天</text>
<text>共{{item.days}}天</text>
<text class="divideline" >|</text>
<text class="" >{{item.all_record_count}}人参与</text>
<text>{{item.all_record_count}}人参与</text>
<text class="divideline" >•</text>
<text class="" >已打卡{{item.today_record_count}}次</text>
</view>
<!-- <view class="clockstatus wait" wx:if="{{!item.is_clock}}">
<image class="dianpinicon" src="{{imageRoot}}2c/circleindex/notclock.png?{{imageVersion}}"></image>
<text class="clockstatic" >未打卡</text>
<text>已打卡{{item.today_record_count}}次</text>
</view>
<view class="clockstatus success" wx:if="{{item.is_clock}}">
<image class="dianpinicon" src="{{imageRoot}}2c/circleindex/isclock.png?{{imageVersion}}"></image>
<text class="clockstatic" >已打卡</text>
</view> -->
<view class="clockstatus" wx:if="{{statusType==1}}">去提交</view>
<view class="clockstatus disabled" wx:if="{{statusType==2 && !item.is_clock}}">已结束</view>
<view class="clockstatus disabled" wx:if="{{statusType==2 && item.is_clock}}">已打卡</view>
<view class="themestatus" wx:if="{{item.days <= item.today_days}}">已完成</view>
<view class="progress-box">
<view class="progress" style="width: {{filter.calculateRate(item.today_days, item.days)}}%"></view>
<view class="progressdesc" wx:if="{{item.days > item.today_days}}" style="left: {{filter.calculateRate(item.today_days, item.days)}}%">
......@@ -84,14 +66,11 @@
<view class="title">{{item.title}}</view>
</view>
<view class="static-box">
<text class="" >共{{item.class_student_count}}名学员</text>
<text>共{{item.class_student_count}}名学员</text>
<text class="divideline" >|</text>
<text class="">已闯{{item.my_clock_count}}个关卡</text>
<text>已闯{{item.my_clock_count}}个关卡</text>
</view>
<view class="clockstatus" wx:if="{{statusType==1}}">去提交</view>
<!-- <view class="clockstatus" wx:if="{{statusType==2 && item.unlock_limit - item.my_today_unlock_count>0}}">
剩余闯关次数:{{item.unlock_limit - item.my_today_unlock_count}}
</view> -->
<view class="clockstatus disabled" wx:if="{{statusType==2}}">已结束</view>
</block>
</view>
......@@ -100,12 +79,10 @@
<list-loading loading="{{listLoading}}"></list-loading>
</view>
<view class="empty-content-box" wx:else>
<empty-content text="还没有更多哦" emptyimg="common/empty/empty_no.png" width="263" height="219"></empty-content>
<empty-content text="暂无作业~" emptyimg="common/empty/empty_no.png" width="263" height="219"></empty-content>
</view>
<!-- <view class="tasklistbtn" bindtap="goTaskList">任务列表</view> -->
<view class="" wx:if="{{sid == activtySchoolInfo.sid}}">
<view wx:if="{{sid == activtySchoolInfo.sid}}">
<activity-bar
classid="{{activtySchoolInfo.id}}"
sid="{{activtySchoolInfo.sid}}"
......
page{
height: 100%;
min-height: 10vh;
}
.container{
padding: 110rpx 0 70rpx;
......@@ -196,26 +196,6 @@ page{
box-shadow: 0 6rpx 0 0 rgba(224,224,224,1);
color: #AAAAAA;
}
/* .clockstatus image{
width: 23rpx;
height: 23rpx;
margin-right: 10rpx;
}
.clockstatus.wait text {
font-size: 24rpx;
color: #FF9797;
letter-spacing: 2rpx;
}
.clockstatus.success text {
font-size: 24rpx;
color: #898A88;
letter-spacing: 2rpx;
}
.clockstatus.warn text {
font-size: 24rpx;
color: #FFC02A;
letter-spacing: 2rpx;
} */
.static-box text.divideline {
margin: 0 20rpx;
background-color: #fff;
......
......@@ -4,562 +4,499 @@ import {
audioorigin,
imagify,
newScenQueryGet
} from '../../../utilities/index.js';
import {
wxPreviewImage
} from '../../../utilities/wxApi.js';
} from "../../../utilities/index.js";
import { wxPreviewImage } from "../../../utilities/wxApi.js";
import {
unlockmodesdetail,
unlockclassstudent,
unlockmodesubjects,
modeStudent,
unlockCollectionInfo,
} from '../../../service/customer/morethemeindex.js';
import {
getwechatmobile
} from '../../../service/customer/activity.js';
import {
userShow,
} from '../../../service/customer/themeindex.js';
import {
activityLog
} from '../../../service/common.js';
import {
studentidentity
} from '../../../service/customer/signup.js'
unlockCollectionInfo
} from "../../../service/customer/morethemeindex.js";
import { getwechatmobile } from "../../../service/customer/activity.js";
import { userShow } from "../../../service/customer/themeindex.js";
import { activityLog } from "../../../service/common.js";
import { studentidentity } from "../../../service/customer/signup.js";
var app = getApp();
Page({
mixins: [require('../../../mixins/myMins/audioCallback')],
mixins: [require("../../../mixins/myMins/audioCallback")],
data: {
localImageRoot: '../../../images/',
localImageRoot: "../../../images/",
imageRoot: app.globalData.imageRoot,
password: '',
password: "",
dailogShow: false,
moreTheme: null,
student: '',
student: "",
pageShow: false,
tabIndex: 1,
subjects:'',
subjects: "",
sid: 0,
studentsList: [],
infogetShow: false,
sessionCode: '',
name: '',
mobile: '',
sessionCode: "",
name: "",
mobile: "",
submitting: false,
isVisitor: true,
videostatus: {
preSrc: '',
currentSrc: '',
preSrc: "",
currentSrc: "",
videoShow: false,
videoId: '',
src: ''
videoId: "",
src: ""
},
audioStorage: {},
raddioexpand: false,
selectedRadio: '',
selectedRadio: "",
maxIndex: 5
},
onLoad: function (options) { // Do some initialize when page load.
onLoad: function(options) {
const that = this;
if (options.scene) {
let sceneQuery = newScenQueryGet(options.scene);
if (sceneQuery.type == 1) {
const {
t,
} = sceneQuery.queryObj;
const { t } = sceneQuery.queryObj;
this.setData({
tid: t || 0
})
});
} else if (sceneQuery.type == 2) {
this.setData({
tid: sceneQuery.queryObj[0] || 0
})
});
}
} else {
const {
tid
} = options;
const { tid } = options;
this.setData({
tid: tid || 0
})
});
}
app.getCurrentSchoolStudentId({
source_id: this.data.tid,
source_type: 9,
}).then((data) => {
that.setData({
isVisitor: data.student.formal_school_student ? false : true,
app
.getCurrentSchoolStudentId({
source_id: this.data.tid,
source_type: 9
})
that.getModeStudent();
})
.then(data => {
that.setData({
isVisitor: data.student.formal_school_student ? false : true
});
that.getModeStudent();
});
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
});
}
})
},
onReady: function () { // Do something when page ready.
// this.doAnimation()
});
},
onShow: function (options) { // Do something when page show.
// this.getStudent();
onShow: function(options) {
this.getModesDetail();
},
onShareAppMessage: function () {
onShareAppMessage: function() {
return {
title: this.data.moreTheme.title,
path: `src/pages/sharemoretheme/index?tid=${this.data.tid}`,
// imageUrl: imagify(this.data.moreTheme.banner || 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png')
imageUrl: 'https://cdn.img.shangjiadao.cn/source/images/dakav4/morethemeindex/unlockindex1.png'
}
},
onHide: function () { // Do something when page hide.
},
onUnload: function () { // Do something when page close.
imageUrl:
"https://cdn.img.shangjiadao.cn/source/images/dakav4/morethemeindex/unlockindex1.png"
};
},
// 获取闯关参与学列表
getModeStudent () {
// 获取闯关参与学列表
getModeStudent() {
modeStudent({
mode_id: this.data.tid
}).then((res) => {
}).then(res => {
const { code, data } = res;
if (code == 200) {
this.setData({
studentsList: data.list.splice(0, 8),
})
studentsList: data.list.splice(0, 8)
});
}
})
});
},
expandsigncontentbox () {
expandsigncontentbox() {
this.setData({
raddioexpand: !this.data.raddioexpand,
raddioexpand: !this.data.raddioexpand
});
},
selectradio (e) {
selectradio(e) {
const name = e.currentTarget.dataset.name;
if (this.data.selectedRadio == name) {
this.setData({
selectedRadio: '',
})
selectedRadio: ""
});
} else {
this.setData({
selectedRadio: name,
})
selectedRadio: name
});
}
},
// 解锁模式详情
getModesDetail() {
unlockmodesdetail(this.data.tid).then((res) => {
wx.hideLoading();
const {
code,
data
} = res;
if (code == 200) {
this.getSubjects();
let introduce = [];
try {
introduce = JSON.parse(data.introduce);
} catch (e) {
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);
} catch (e) {
sign_up_content = {}
unlockmodesdetail(this.data.tid)
.then(res => {
wx.hideLoading();
const { code, data } = res;
if (code == 200) {
this.getSubjects();
let introduce = [];
try {
introduce = JSON.parse(data.introduce);
} catch (e) {
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);
} catch (e) {
sign_up_content = {};
}
data.sign_up_content = sign_up_content;
wx.setNavigationBarTitle({
title: data.title
});
console.log(data.introduce, "introduce");
this.setData({
moreTheme: data,
sid: data.school_id
});
const visitor = LocalStorage.getItem("visitor");
activityLog({
type: 22,
open_id: visitor && visitor.openid,
school_id: data.school_id,
remark: ""
});
}
data.sign_up_content = sign_up_content;
wx.setNavigationBarTitle({
title: data.title
})
console.log(data.introduce,'introduce')
this.setData({
moreTheme: data,
sid: data.school_id,
})
const visitor = LocalStorage.getItem('visitor');
activityLog({
type: 22,
open_id: visitor && visitor.openid,
school_id: data.school_id,
remark: ''
})
}
}).catch((err) => {
})
})
.catch(err => {});
},
goMoretheme(e) {
const {
item
} = e.currentTarget.dataset;
const { item } = e.currentTarget.dataset;
if (this.data.moreTheme.join_rule_type == 2) {
this.setData({
dailogShow: true
})
return false
});
return false;
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
});
},
passwordInput(e) {
const {
value
} = e.detail;
const { value } = e.detail;
this.setData({
password: value,
})
password: value
});
},
cancle() {
this.setData({
dailogShow: false
})
});
},
sure() {
if (this.data.password == this.data.moreTheme.password) {
wx.showToast({
title: '密码正确',
icon: 'none',
title: "密码正确",
icon: "none",
duration: 2000
})
});
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
} else {
wx.showToast({
title: '密码错误',
icon: 'none',
title: "密码错误",
icon: "none",
duration: 2000
})
});
this.setData({
password: ''
})
password: ""
});
}
},
gowebsiteindex () {
gowebsiteindex() {
wx.redirectTo({
url: `/src/pages/websiteindex/index?sid=${this.data.sid}`
})
});
},
handleTap(e){
handleTap(e) {
const index = e.currentTarget.dataset.index;
this.setData({
tabIndex: index
})
});
},
getSubjects() {
unlockmodesubjects({
mode_id: this.data.tid
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
this.setData({
subjects:data.list
})
}
}).catch((err) => {
wx.hideLoading()
})
.then(res => {
const { code, data } = res;
if (code == 200) {
this.setData({
subjects: data.list
});
}
})
.catch(err => {
wx.hideLoading();
});
},
gojoin () {
gojoin() {
const moreThemeInfo = this.data.moreTheme;
if (this.data.isVisitor) { // 是游客
if (moreThemeInfo.sign_up_status == 1) { // 设置信息收集项
if (this.data.moreTheme.my_clock_count > 0) { // 解过锁了
if (this.data.isVisitor) {
// 是游客
if (moreThemeInfo.sign_up_status == 1) {
// 设置信息收集项
if (this.data.moreTheme.my_clock_count > 0) {
// 解过锁了
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
} else {
if (moreThemeInfo.info_collection_count > 0) { // 填过信息报名项
if (moreThemeInfo.info_collection_count > 0) {
// 填过信息报名项
if (this.data.moreTheme.join_rule_type == 2) {
this.setData({
dailogShow: true
})
return false
});
return false;
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?sid=${this.data.sid}`
});
} else { // 没填过信息报名项
} else {
// 没填过信息报名项
this.setData({
infogetShow: true,
})
infogetShow: true
});
}
}
} else { // 没有设置信息收集项
if (this.data.moreTheme.my_clock_count > 0) { // 解过锁了
} else {
// 没有设置信息收集项
if (this.data.moreTheme.my_clock_count > 0) {
// 解过锁了
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
} else {
if (this.data.moreTheme.join_rule_type == 2) {
this.setData({
dailogShow: true
})
return false
});
return false;
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
}
}
} else { // 不是游客
if (this.data.moreTheme.my_clock_count > 0) { // 解过锁了
} else {
// 不是游客
if (this.data.moreTheme.my_clock_count > 0) {
// 解过锁了
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
} else {
if (this.data.moreTheme.join_rule_type == 2) {
this.setData({
dailogShow: true
})
return false
});
return false;
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
url: `/src/pages/morethemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
});
}
}
},
// gojoin () {
// const moreThemeInfo = this.data.moreTheme;
// console.log(this.data.isVisitor, 'this.data.isVisitor');
// if (this.data.isVisitor) { // 是游客
// if (moreThemeInfo.info_collection_count > 0) {
// if (this.data.moreTheme.password) {
// this.setData({
// dailogShow: true
// })
// return false
// }
// wx.redirectTo({
// url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
// });
// } else {
// if (this.data.moreTheme.my_unlock_count > 0) { // 解过锁了
// wx.redirectTo({
// url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
// });
// } else {
// if (moreThemeInfo.sign_up_status == 1) { // 开启信息收集项
// this.setData({
// infogetShow: true,
// })
// } else if (moreThemeInfo.sign_up_status == 2) { // 开启信息收集项 关闭信息收集项 判断有没有密码 有密码输入密码 没密码直接进入打卡页面
// if (this.data.moreTheme.password) {
// this.setData({
// dailogShow: true
// })
// return false
// }
// wx.redirectTo({
// url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
// });
// }
// }
// }
// } else { // 不是游客
// if (this.data.moreTheme.my_unlock_count > 0) { // 解过锁了
// wx.redirectTo({
// url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
// });
// } else {
// if (this.data.moreTheme.password) {
// this.setData({
// dailogShow: true
// })
// return false
// }
// wx.redirectTo({
// url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
// });
// }
// }
// },
getPhoneNumber(e) {
const that = this;
const {
encryptedData,
iv
} = e.detail;
if(!encryptedData){
const { encryptedData, iv } = e.detail;
if (!encryptedData) {
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
});
}
})
return
});
return;
}
// 开始
wx.showLoading({
title: '手机号码获取中...',
})
title: "手机号码获取中..."
});
getwechatmobile({
code: that.data.sessionCode,
encryptData:encryptedData,
encryptData: encryptedData,
iv
}).then((res) => {
wx.hideLoading();
const {
code,
data
} = res;
if (code == 200 && data && data.mobile) {
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
this.setData({
mobile: data.mobile
})
} else {
})
.then(res => {
wx.hideLoading();
const { code, data } = res;
if (code == 200 && data && data.mobile) {
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
});
}
});
this.setData({
mobile: data.mobile
});
} else {
wx.showToast({
title: "手机号获取失败,请手动填写获重新获取"
});
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
});
}
});
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: '手机号获取失败,请手动填写获重新获取'
})
title: "手机号获取失败,请手动填写获重新获取"
});
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
});
}
})
}
}).catch((err) => {
wx.hideLoading();
wx.showToast({
title: '手机号获取失败,请手动填写获重新获取'
})
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
})
});
});
// 结束
},
sureGetInfo () {
sureGetInfo() {
const that = this;
if (this.data.name.trim() == '') {
if (this.data.name.trim() == "") {
wx.showToast({
title: '请输入姓名',
icon: 'none',
title: "请输入姓名",
icon: "none",
duration: 1000
})
});
return;
}
if (this.data.mobile.trim() == '') {
if (this.data.mobile.trim() == "") {
wx.showToast({
title: '手机号不能为空',
icon: 'none',
title: "手机号不能为空",
icon: "none",
duration: 1000
})
});
return;
}
if (!/^1[3456789]{1}[0-9]{9}$/.test(this.data.mobile)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none',
title: "请输入正确的手机号",
icon: "none",
duration: 1000
})
});
return;
}
if (this.data.moreTheme.sign_up_content.radioname && this.data.selectedRadio == '') {
if (
this.data.moreTheme.sign_up_content.radioname &&
this.data.selectedRadio == ""
) {
wx.showToast({
title: `请选择${that.data.moreTheme.sign_up_content.radioname}`,
icon: 'none',
icon: "none",
duration: 1000
})
});
return;
}
if (this.data.submitting) {
return;
}
this.setData({
submitting: true,
})
submitting: true
});
unlockCollectionInfo({
mode_id: this.data.tid,
name: this.data.name,
mobile: this.data.mobile,
content: this.data.moreTheme.sign_up_content.radioname == '' ? '' : JSON.stringify({
value: this.data.selectedRadio,
radio: this.data.moreTheme.sign_up_content,
}),
}).then((res) => {
const { code, data } = res;
this.setData({
submitting: false,
})
if (code == 200) {
wx.showToast({
title: '报名成功',
icon: 'success',
duration: 1000
})
content:
this.data.moreTheme.sign_up_content.radioname == ""
? ""
: JSON.stringify({
value: this.data.selectedRadio,
radio: this.data.moreTheme.sign_up_content
})
})
.then(res => {
const { code, data } = res;
this.setData({
infogetShow: false,
'moreTheme.info_collection_count': this.data.moreTheme.info_collection_count + 1
submitting: false
});
if (this.data.moreTheme.join_rule_type == 2) {
if (code == 200) {
wx.showToast({
title: "报名成功",
icon: "success",
duration: 1000
});
this.setData({
dailogShow: true
})
return false
infogetShow: false,
"moreTheme.info_collection_count":
this.data.moreTheme.info_collection_count + 1
});
if (this.data.moreTheme.join_rule_type == 2) {
this.setData({
dailogShow: true
});
return false;
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
});
}
wx.navigateTo({
url: `/src/pages/morethemeindex/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}`
});
}
}).catch(() => {
this.setData({
submitting: false,
})
})
.catch(() => {
this.setData({
submitting: false
});
});
},
closeinfoget () {
closeinfoget() {
this.setData({
infogetShow: false,
infogetShow: false
});
},
nameInput (e) {
nameInput(e) {
this.setData({
name: e.detail.value
})
});
},
mobileInput (e) {
mobileInput(e) {
this.setData({
mobile: e.detail.value
})
});
},
goqrcode () {
goqrcode() {
wx.navigateTo({
url: `/src/pages/invitationcard/index?id=${this.data.moreTheme.class_id}&tid=${this.data.tid}&pagefrom=sharermorethemeindex`
})
});
},
previewbanner () {
previewbanner() {
const that = this;
if (!that.data.moreTheme.banner) {
return;
......@@ -567,22 +504,18 @@ Page({
wxPreviewImage({
urls: [that.data.moreTheme.banner],
current: that.data.moreTheme.banner
})
});
},
// 视频播放相关代码
playvideo(e) {
const that = this;
const {
src,
from,
mode
} = e.detail;
const { src, from, mode } = e.detail;
this.setData({
'videostatus.videoId': src,
'videostatus.videoShow': true,
'videostatus.src': src,
'videostatus.mode': mode || 'mp4',
})
"videostatus.videoId": src,
"videostatus.videoShow": true,
"videostatus.src": src,
"videostatus.mode": mode || "mp4"
});
that.videoContext = wx.createVideoContext(src);
that.videoContext.play();
// setTimeout(() => {
......@@ -590,9 +523,7 @@ Page({
// }, 500)
},
screenchange(e) {
const {
fullScreen
} = e.detail;
const { fullScreen } = e.detail;
// if (!fullScreen) { // 退出全屏时的操作
// this.setData({
// 'videostatus.videoId': '',
......@@ -603,37 +534,38 @@ Page({
},
closeVideo() {
this.setData({
'videostatus.videoId': '',
'videostatus.videoShow': false,
'videostatus.src': '',
})
"videostatus.videoId": "",
"videostatus.videoShow": false,
"videostatus.src": ""
});
},
// 视频播放相关代码
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
voiceIntervalPlay(value) { // 初始化录音的状态
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) {
audioStorage[value].play = false;
audioStorage[value].currentTime = 0;
this.setData({
audioStorage
})
});
clearInterval(this.data.voiceInterval);
}
}, 1000);
this.setData({
voiceInterval
})
});
},
// 跟录音相关的操作
showMoreList(){
showMoreList() {
this.setData({
maxIndex: this.data.maxIndex > 5 ? 5 : (this.data.subjects.length || 999)
})
maxIndex: this.data.maxIndex > 5 ? 5 : this.data.subjects.length || 999
});
}
})
\ No newline at end of file
});
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