Commit 6a8a2996 authored by Mac's avatar Mac

1

parent ad1e0095
......@@ -383,6 +383,8 @@
"path":"personal/studycard"
},{
"path":"personal/cardList"//学习卡中心
},{
"path":"mystudy/mystudy"
}]
},
......
<template>
<canvas v-if="canvasId" :id="canvasId" :canvasId="canvasId" :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"
@touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" @error="error">
</canvas>
</template>
<script>
import uCharts from './u-charts.js';
var canvases = {};
export default {
props: {
chartType: {
required: true,
type: String,
default: 'column'
},
opts: {
required: true,
type: Object,
default () {
return null;
},
},
canvasId: {
type: String,
default: 'u-canvas',
},
cWidth: {
default: 375,
},
cHeight: {
default: 250,
},
pixelRatio: {
type: Number,
default: 1,
},
},
mounted() {
this.init();
},
methods: {
init() {
switch (this.chartType) {
case 'column':
this.initColumnChart();
break;
case 'line':
this.initLineChart();
break;
default:
break;
}
},
initColumnChart() {
canvases[this.canvasId] = new uCharts({
$this: this,
canvasId: this.canvasId,
type: 'column',
legend: true,
fontSize: 11,
background: '#FFFFFF',
pixelRatio: this.pixelRatio,
animation: true,
categories: this.opts.categories,
series: this.opts.series,
enableScroll: true,
xAxis: {
disableGrid: true,
itemCount: 4,
scrollShow: true
},
yAxis: {
//disabled:true
},
dataLabel: true,
width: this.cWidth * this.pixelRatio,
height: this.cHeight * this.pixelRatio,
extra: {
column: {
type: 'group',
}
}
});
},
initLineChart() {
canvases[this.canvasId] = new uCharts({
$this: this,
canvasId: this.canvasId,
type: 'line',
fontSize: 11,
legend: true,
dataLabel: false,
dataPointShape: true,
background: '#FFFFFF',
pixelRatio: this.pixelRatio,
categories: this.opts.categories,
series: this.opts.series,
animation: true,
enableScroll: true,
xAxis: {
type: 'grid',
gridColor: '#CCCCCC',
gridType: 'dash',
dashLength: 8,
itemCount: 4,
scrollShow: true
},
yAxis: {
gridType: 'dash',
gridColor: '#CCCCCC',
dashLength: 8,
splitNumber: 5,
min: 10,
max: 180,
format: (val) => {
return val.toFixed(0) + '元'
}
},
width: this.cWidth * this.pixelRatio,
height: this.cHeight * this.pixelRatio,
extra: {
line: {
type: 'straight'
}
}
});
},
// 这里仅作为示例传入两个参数,cid为canvas-id,newdata为更新的数据,需要更多参数请自行修改
changeData(cid,newdata) {
canvases[cid].updateData({
series: newdata.series,
categories: newdata.categories
});
},
touchStart(e) {
canvases[this.canvasId].showToolTip(e, {
format: function(item, category) {
return category + ' ' + item.name + ':' + item.data
}
});
canvases[this.canvasId].scrollStart(e);
},
touchMove(e) {
canvases[this.canvasId].scroll(e);
},
touchEnd(e) {
canvases[this.canvasId].scrollEnd(e);
},
error(e) {
console.log(e)
}
},
};
</script>
<style scoped>
.charts {
width: 100%;
height: 100%;
flex: 1;
background-color: #FFFFFF;
}
</style>
This diff is collapsed.
This diff is collapsed.
<template>
<scroll-view
:scroll-y="true"
@scroll="scrollHandler"
@scrolltoupper="scrollTopHandler"
style="height: 100vh;">
<view class="mystudy">
<view
class="headStatus"
v-if="scrollTop > 50 "
:style="[
headStyle,
{
zIndex: scrollTop < 10 ? 'unset' : 2,
opacity: scrollTop < 10 ? '100' : scrollTop,
background:'#FFF'
},
]"
>
<view class="arrow" @click="goback">
<u-icon name="arrow-left" size="48" color="#000"></u-icon>
</view>
<view class="title" style="color: #000000;" v-if="scrollTop > 50">{{pageTitle}}</view>
<view class="arrow"></view>
</view>
<view class="goback" @click="goback" :style="{'padding-top':paddingHTop}">
<u-icon name="arrow-left" size="48" color="#121212"></u-icon>
</view>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth= 'gob'></auth>
</view>
</scroll-view>
</template>
<script>
import hParse from "@/components/u-parse/parse.vue";
import auth from "@/components/auth/index.vue";
export default {
data(){
return{
mc:'',
pricecolor:'',
secondary:'',
paddingHTop:0,
id:0,
teacher:{},
windowWidth:0,
scrollTop:0,
headStyle:{},
pageTitle:'教师详情',
UserId:0,
u:{},
showAuth:false,
}
},
components: {
hParse,
auth
},
onLoad(options) {
console.log(options,'options')
if(options && options.ID){
this.id = options.ID
if(uni.getStorageSync("mall_UserInfo")){
this.UserId = uni.getStorageSync("mall_UserInfo").UserId ? uni.getStorageSync("mall_UserInfo").UserId:0
}
}
},
created() {
this.mc = this.$uiConfig.mainColor;
this.pricecolor = this.$uiConfig.pricecolor;
this.secondary = this.$uiConfig.secondary;
this.nav = uni.getMenuButtonBoundingClientRect().top;
this.paddingHTop = this.nav +'px';
this.windowWidth = this.$utils.SystemInfo().windowWidth;
this.headStyle.paddingTop = this.nav +'px';
},
methods:{
clickDescription(e) {
console.log(e);
},
goback(){
uni.navigateBack({})
},
clickHandler(item) {
uni.navigateTo({ url: "/pages/school/courseInfo?GoodsId=" + item.Id });
},
scrollHandler(e) {
this.scrollTop = e.detail.scrollTop;
},
scrollTopHandler() {
this.scrollTop = 0;
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
},
gob(){
this.showAuth = false;
},
}
}
</script>
<style>
.mystudy .headStatus {
overflow: hidden;
position: relative;
width: 140vw;
padding-right: 40vw;
padding-bottom: 10px;
position: fixed;
left: 0;
right: 0;
top: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.mystudy .arrow {
height: 24px;
margin: 5px 10px;
width: 24px;
}
.mystudy .goback{
margin-left: 8px;
position: fixed;
top: 0;
left: 0;
}
</style>
......@@ -28,7 +28,8 @@
<view class="coupond">
<view class="name">{{x.Name}}</view>
<view class="rule">{{x.UseTypeStr}}</view>
<view class="date">{{x.StartDate.split(' ')[0].replace(/-/g,'.')+"-"+x.EndDate.split(' ')[0].replace(/-/g,'.')}}</view>
<view class="date" v-if="x.IndateType==1">领券后{{x.IndateDay}}天过期</view>
<view class="date" v-if="x.IndateType==2">{{x.StartDate.split(' ')[0].replace(/-/g,'.')+"-"+x.EndDate.split(' ')[0].replace(/-/g,'.')}}</view>
</view>
<view class="chosen" :style="{'background':mainColor}" @click="receive(x,i)">
<Text>{{x.IsReceive==1?'已领取':'立即领取'}} </Text>
......
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