Browse Source

优化模块名称

zyh
Gaoxs 4 years ago
parent
commit
99fcfdbc5b
  1. 12
      components/colorui/components/cu-custom.vue
  2. 58
      pages/home/components/Banner.vue
  3. 13
      pages/home/index.vue

12
components/colorui/components/cu-custom.vue

@ -1,5 +1,4 @@
<template>
<view>
<view class="cu-custom" :style="[{height:CustomBar + 'px'}]">
<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
<view class="action" @tap="BackPage" v-if="isBack">
@ -12,7 +11,6 @@
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
@ -26,10 +24,11 @@
name: 'cu-custom',
computed: {
style() {
console.log(this)
var StatusBar = this.StatusBar;
var CustomBar = this.CustomBar;
var bgImage = this.bgImage;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;background:${this.bgColor} ;`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
@ -61,5 +60,12 @@
</script>
<style>
.fixed{
position: fixed;
top:0;
left:0;
right:0;
z-index: 99;
}
</style>

58
pages/home/components/Banner.vue

@ -43,34 +43,36 @@
let bgcolor = item.bgcolor;
//
if (bgcolor === '') {
let ctx = uni.createCanvasContext('colorThief', that);
if (0 === that.webviewId || ctx.webviewId === that.webviewId) {
that.webviewId = ctx.webviewId;
uni.getImageInfo({
src: item.pic,
success: function (image) {
ctx.drawImage(image.path, 0, 0, image.width, image.height);
ctx.draw(true, function (e) {
uni.canvasGetImageData({
canvasId: 'colorThief',
x: 0,
y: 0,
width: parseInt(image.width),
height: parseInt(image.height),
success(res) {
let bgcolor = colorThief(res.data)
.color()
.getHex();
that.$set(item, 'bgcolor', bgcolor);
that.$emit('getbgcolor', bgcolor);
}
},
that
);
});
}
});
}
// let ctx = uni.createCanvasContext('colorThief', that);
// if (0 === that.webviewId || ctx.webviewId === that.webviewId) {
// that.webviewId = ctx.webviewId;
// uni.getImageInfo({
// src: item.pic,
// success: function (image) {
// ctx.drawImage(image.path, 0, 0, image.width, image.height);
// ctx.draw(true, function (e) {
// uni.canvasGetImageData({
// canvasId: 'colorThief',
// x: 0,
// y: 0,
// width: parseInt(image.width),
// height: parseInt(image.height),
// success(res) {
// let bgcolor = colorThief(res.data)
// .color()
// .getHex();
// that.$set(item, 'bgcolor', bgcolor);
// that.$emit('getbgcolor', bgcolor);
// }
// },
// that
// );
// });
// }
// });
// }
that.$set(item, 'bgcolor', '#c40414');
that.$emit('getbgcolor', '#c40414');
} else {
that.$set(item, 'bgcolor', bgcolor);
that.$emit('getbgcolor', bgcolor);

13
pages/home/index.vue

@ -15,7 +15,7 @@
<!-- </view>-->
<view class="head_box " :style="{ background: bgcolor }" :class="{ active: bgcolor }">
<cu-custom :isBack="true" >
<cu-custom :isBack="true" :bgColor="bgcolor">
<block slot="backText">
<text class="nav-title shopro-selector-rect">{{ 'YSHOP商城' }}</text>
</block>
@ -31,8 +31,7 @@
</view>
</view>
<Banner :detail="banner" v-if="banner.length>0" @getbgcolor="getbgcolor"></Banner>
<uni-notice-bar scrollable="true" @click="goRoll(singNew)" single="true" :speed="10" showIcon="true"
:text="singNew.info"></uni-notice-bar>
<uni-notice-bar scrollable="true" @click="goRoll(singNew)" single="true" :speed="10" showIcon="true" :text="singNew.info"></uni-notice-bar>
<view class="content_box home_content_box">
<!-- 菜单 -->
<Menu :list="menus"></Menu>
@ -447,4 +446,12 @@
.home_content_box {
margin-top: -10rpx;
}
.head_box {
}
.nav-title {
margin-left: 20rpx;
line-height: 40px;
}
</style>

Loading…
Cancel
Save