Commit 1b6d2ec5 authored by 罗超's avatar 罗超

2

parent 61126524
<template> <template>
<view class="navbar" :style="{'padding-top':`${statusBarHeight}px`}"> <view class="navbar" :style="{'padding-top':`${statusBarHeight}px`,'background-color':bg}" :class="{'sticky':isSticky}">
<slot></slot> <slot></slot>
</view> </view>
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
toRef, toRef,
getCurrentInstance, getCurrentInstance,
watch, watch,
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
export default { export default {
setup() { props: {
let data = reactive({ isSticky: {
statusBarHeight:24 type: Boolean,
}); default: true
const os = uni.getSystemInfoSync(); },
data.statusBarHeight=os.statusBarHeight bg:{
return { type: String,
...toRefs(data), default: "#ffffff"
}; }
}, },
}; setup() {
let data = reactive({
statusBarHeight: 24
});
const os = uni.getSystemInfoSync();
data.statusBarHeight = os.statusBarHeight
return {
...toRefs(data),
};
},
};
</script> </script>
<style scoped> <style scoped>
.navbar{ .navbar {
height: 100rpx; height: 100rpx;
} }
.sticky {
position: sticky;
top: 0;
z-index: 999;
}
</style> </style>
...@@ -150,16 +150,13 @@ ...@@ -150,16 +150,13 @@
setTimeout(() => { setTimeout(() => {
emit('next',1) emit('next',1)
}, 500) }, 500)
} }
}, },
todo() { todo() {
emit('next',0) emit('next')
} }
} }
onMounted(() => { onMounted(() => {
// console.log(136, props.item)
}) })
let that = methods; let that = methods;
return { return {
......
...@@ -136,15 +136,13 @@ ...@@ -136,15 +136,13 @@
}) })
return return
} }
//去掉接口
if(data.test==props.item.Answer||props.item.Answer.indexOf(data.test)>-1){ if(data.test==props.item.Answer||props.item.Answer.indexOf(data.test)>-1){
data.type=1 data.type=1
setTimeout(()=>{ setTimeout(()=>{
emit('next') emit('next',1)
},500) },500)
}else{ }else{
data.type=2 data.type=2
console.log(data.isShowExplain)
setTimeout(()=>{ setTimeout(()=>{
data.isShowExplain=true data.isShowExplain=true
},500) },500)
......
...@@ -127,7 +127,6 @@ ...@@ -127,7 +127,6 @@
"selectedColor": "#929292", "selectedColor": "#929292",
"borderStyle": "black", "borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"iconWidth": "30rpx",
"list": [{ "list": [{
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "static/image/index.png", "iconPath": "static/image/index.png",
......
<template> <template>
<view class="indexpage"> <view class="indexpage">
<van-sticky> <navbar class="navbarSticky" bg="#F5F5F5">
<navbar class="navbarSticky"> <view class="navbarCon">
<view class="navbarCon"> <view class="pagetitle" @click="jumpPage('/pages/login/login')">
<view class="pagetitle" @click="jumpPage('/pages/login/login')"> 首页
首页 </view>
<view class="loginBox">
<view class="" v-if="userData && userData.AccountName && userData.AccountId>0">
{{userData.AccountName}}
</view> </view>
<view class="loginBox"> <indexassembly @success='againdata' v-else>
<view class="" v-if="userData && userData.AccountName && userData.AccountId>0"> <view class="flex_start_center">
{{userData.AccountName}} <image
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/login2x.png"
mode="aspectFit" class="loginIcon" id="loadImg"></image>
登录
</view> </view>
<indexassembly @success='againdata' v-else> </indexassembly>
<view class="flex_start_center"> </view>
<image
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/login2x.png"
mode="aspectFit" class="loginIcon" id="loadImg"></image>
登录
</view>
</indexassembly>
</view>
<view class="scanBox"> <view class="scanBox" @click="scan">
<image <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/scan2x.png"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/scan2x.png" mode="aspectFit" class="scanIcon"></image>
mode="aspectFit" class="scanIcon"></image> <view class="scanText">
<view class="scanText"> 签到
签到
</view>
</view> </view>
</view> </view>
</navbar> </view>
</van-sticky> </navbar>
<view class="activeContent" v-if="ActivityList.length >= 0"> <view class="activeContent" v-if="ActivityList.length >= 0">
<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" indicator-color="#CCCCCC" <swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" indicator-color="#CCCCCC"
...@@ -120,7 +117,8 @@ ...@@ -120,7 +117,8 @@
<view class="gardenCon" v-for="(item1,index1) in item.List" :key="index1" id="img"> <view class="gardenCon" v-for="(item1,index1) in item.List" :key="index1" id="img">
<image :src="item1.Img" mode="aspectFill" :id="'img'+index1" <image :src="item1.Img" mode="aspectFill" :id="'img'+index1"
style="width: 100%;height:100%;border-radius: 24rpx 24rpx 0 0;"></image> style="width: 100%;height:100%;border-radius: 24rpx 24rpx 0 0;"></image>
<view class="gardenTextBox" :style="{'background':`linear-gradient(to bottom,${item1.bgcolor},${item1.bgcolor1} , ${item1.bgcolor2})` }"> <view class="gardenTextBox"
:style="{'background':`linear-gradient(to bottom,${item1.bgcolor},${item1.bgcolor1} , ${item1.bgcolor2})` }">
<view class="gardenTitle one_line"> <view class="gardenTitle one_line">
{{item1.Title}} {{item1.Title}}
</view> </view>
...@@ -187,6 +185,16 @@ ...@@ -187,6 +185,16 @@
url: url, url: url,
}); });
}, },
scan() {
// 调起条码扫描
uni.scanCode({
scanType: ['qrCode'],
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
},
async getActivityData() { async getActivityData() {
let res = await getActivityList(data.ActiveMsg); let res = await getActivityList(data.ActiveMsg);
if (res.resultCode == 1) { if (res.resultCode == 1) {
...@@ -197,15 +205,18 @@ ...@@ -197,15 +205,18 @@
proxy.$request("/AppletIndex/GetIndexInfo_V2", {}).then(res => { proxy.$request("/AppletIndex/GetIndexInfo_V2", {}).then(res => {
data.pageData = res.Data data.pageData = res.Data
uni.setStorageSync("indexData", res.Data); uni.setStorageSync("indexData", res.Data);
if(data.pageData.LearningGardenList.length>0){ if (data.pageData.LearningGardenList.length > 0) {
data.pageData.LearningGardenList.forEach((x,y)=>{ data.pageData.LearningGardenList.forEach((x, y) => {
if(x.List.length>0){ if (x.List.length > 0) {
x.List.forEach((item,index)=>{ x.List.forEach((item, index) => {
this.getColor(item.Img,index,y).then(v=>{ this.getColor(item.Img, index, y).then(v => {
data.pageData.LearningGardenList[v.y].List[v.index].bgcolor = v.formatres; data.pageData.LearningGardenList[v.y].List[
data.pageData.LearningGardenList[v.y].List[v.index].bgcolor1 = v.formatres1; v.index].bgcolor = v.formatres;
data.pageData.LearningGardenList[v.y].List[v.index].bgcolor2 = v.formatres2; data.pageData.LearningGardenList[v.y].List[
v.index].bgcolor1 = v.formatres1;
data.pageData.LearningGardenList[v.y].List[
v.index].bgcolor2 = v.formatres2;
}) })
}) })
} }
...@@ -213,10 +224,10 @@ ...@@ -213,10 +224,10 @@
} }
}) })
}, },
async getColor(src,index,y) { async getColor(src, index, y) {
let res = await getImageColor('myCanvas', 'img'+index, src) let res = await getImageColor('myCanvas', 'img' + index, src)
console.log(index,res) console.log(index, res)
let obj={} let obj = {}
obj.formatres = `rgba(${res.r},${res.g},${res.b},0.01)` obj.formatres = `rgba(${res.r},${res.g},${res.b},0.01)`
obj.formatres1 = `rgba(${res.r},${res.g},${res.b},0.6)` obj.formatres1 = `rgba(${res.r},${res.g},${res.b},0.6)`
obj.formatres2 = `rgba(${res.r},${res.g},${res.b},1)` obj.formatres2 = `rgba(${res.r},${res.g},${res.b},1)`
...@@ -229,12 +240,12 @@ ...@@ -229,12 +240,12 @@
methods.getIndexData(); methods.getIndexData();
methods.getActivityData(); methods.getActivityData();
}, },
jumpGarden(id){ jumpGarden(id) {
if(id==1){ if (id == 1) {
uni.navigateTo({ uni.navigateTo({
url:"/pages/learningGarden/learningGardenList" url: "/pages/learningGarden/learningGardenList"
}) })
}else if(id==2){ } else if (id == 2) {
// uni.navigateTo({ // uni.navigateTo({
// url:"/pages/learningGarden/learningGardenList" // url:"/pages/learningGarden/learningGardenList"
// }) // })
...@@ -290,6 +301,7 @@ ...@@ -290,6 +301,7 @@
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #F5F5F5;
} }
.pagetitle { .pagetitle {
......
...@@ -175,8 +175,8 @@ ...@@ -175,8 +175,8 @@
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/piao4.png" alt="" /> src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/piao4.png" alt="" />
<view class="study_Jiyi">记忆时长</view> <view class="study_Jiyi">记忆时长</view>
<view class="study_GoCeshi" @click="goTest(url)">马上去测试</view> <!-- <view class="study_GoCeshi" @click="goTest(url)">马上去测试</view>
<view class="study_GoLearn">再学习一次</view> <view class="study_GoLearn">再学习一次</view> -->
<view class="studyBack" @click="goIndex">返回首页</view> <view class="studyBack" @click="goIndex">返回首页</view>
</view> </view>
</view> </view>
...@@ -230,8 +230,10 @@ ...@@ -230,8 +230,10 @@
}; };
}, },
onLoad(options) { onLoad(options) {
console.log(226, options) // const obj=JSON.parse()
this.url=`/pages/word/test?CourseId=${options.CourseId}&&ChapterId=${options.ChapterId} &&NextChapterId=${options.NextChapterId}`
console.log(226, decodeURIComponent(options.data))
// this.url=`/pages/word/test?CourseId=${options.CourseId}&&ChapterId=${options.ChapterId} &&NextChapterId=${options.NextChapterId}`
} }
} }
</script> </script>
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<script> <script>
import { ref, reactive, toRefs, getCurrentInstance, onMounted } from "vue"; import { ref, reactive, toRefs, getCurrentInstance, onMounted } from "vue";
import {getCurrentTime} from '../../utils/date.js'
import Choice from "../../components/word/choiceQuestion.vue"; import Choice from "../../components/word/choiceQuestion.vue";
import FillIn from "../../components/word/fillInTheBlanks.vue"; import FillIn from "../../components/word/fillInTheBlanks.vue";
export default { export default {
...@@ -58,7 +59,8 @@ export default { ...@@ -58,7 +59,8 @@ export default {
ChapterId: 0, ChapterId: 0,
NextChapterId: 0, NextChapterId: 0,
}, },
curTest: 0, startTime:"",
curTest: 33,
reviewGroupList: [], reviewGroupList: [],
prepGroupList: [], prepGroupList: [],
}); });
...@@ -73,6 +75,14 @@ export default { ...@@ -73,6 +75,14 @@ export default {
}, },
changeSwiper(val) { changeSwiper(val) {
data.curTest = val.detail.current; data.curTest = val.detail.current;
const total=data.reviewGroupList.length+data.prepGroupList.length
console.log(data.curTest,total)
if(data.curTest== total){
// methods.submitWordsTest()
data.curTest=total-1
}
console.log(2,data.curTest,total)
}, },
next(val, item) { next(val, item) {
if (val) { if (val) {
...@@ -82,19 +92,29 @@ export default { ...@@ -82,19 +92,29 @@ export default {
}, },
//提交单词测试 //提交单词测试
submitWordsTest() { submitWordsTest() {
var postMsg = { const indexData = uni.getStorageSync("indexData");
ClassId: 1, let postMsg = {
CourseId: 1, ClassId: indexData.ClassId,
ChapterId: 1, CourseId: data.msg.CourseId,
ExamStartTime: "2021-01-12 10:00:00", ChapterId: data.msg.ChapterId,
ExamStartTime: data.startTime,
Details: data.reviewGroupList, Details: data.reviewGroupList,
}; };
proxy.$request("/AppletWords/SubmitWordsExam", postMsg).then((res) => { proxy.$request("/AppletWords/SubmitWordsExam", postMsg).then((res) => {
console.log("SubmitWordsExam", res); console.log("SubmitWordsExam", res);
const obj={
score:res.Data.Score,
time:2
}
uni.navigateTo({
url:"/pages/word/studyComplete?data="+encodeURIComponent(JSON.stringify(obj))
})
}); });
}, },
}; };
onMounted(() => {}); onMounted(() => {
data.startTime=getCurrentTime()
});
let that = methods; let that = methods;
return { return {
...toRefs(data), ...toRefs(data),
......
...@@ -10,7 +10,8 @@ export let getWeek = (year, month) => { ...@@ -10,7 +10,8 @@ export let getWeek = (year, month) => {
let weekStr = "" let weekStr = ""
let isToday = 0 let isToday = 0
let today = new Date(getToday()).getTime() let today = new Date(getToday()).getTime()
let today2 = new Date(year + '-' + (month < 10 ? '0' + month : month) + '-' + (i < 10 ? '0' + i : i)).getTime() let today2 = new Date(year + '-' + (month < 10 ? '0' + month : month) + '-' + (i < 10 ? '0' + i : i))
.getTime()
if (today === today2) { if (today === today2) {
isToday = 1 isToday = 1
} }
...@@ -37,6 +38,19 @@ export let getToday = (y, m, d) => { ...@@ -37,6 +38,19 @@ export let getToday = (y, m, d) => {
} }
} }
export let getCurrentTime = () => {
let date = new Date()
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let h = date.getHours()
let m = date.getMinutes()
let s = date.getSeconds()
let CurrentTime = year + "-" + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) + ' ' + (
h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s)
return CurrentTime
}
export let getdate = (time, tomorrow) => { export let getdate = (time, tomorrow) => {
let date = new Date(time) let date = new Date(time)
let year = date.getFullYear() let year = date.getFullYear()
......
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