Commit 4468ec30 authored by Mac's avatar Mac

1

parent 1098477f
......@@ -116,7 +116,7 @@
<view class="gardenCon" v-for="(item1,index1) in item.List" :key="index1" id="img">
<image :src="item1.Img" mode="aspectFill"
style="width: 100%;height:100%;border-radius: 24rpx 24rpx 0 0;"></image>
<view class="gardenTextBox" :style="{background:'linear-gradient(to bottom,0deg,'+item1.bgcolor+')'}">
<view class="gardenTextBox" :style="{'background':`linear-gradient(to bottom, rgb(255,255,255,0.3), ${item1.bgcolor})` }">
<view class="gardenTitle one_line">
{{item1.Title}}
</view>
......@@ -193,11 +193,14 @@
proxy.$request("/AppletIndex/GetIndexInfo_V2", {}).then(res => {
data.pageData = res.Data
if(data.pageData.LearningGardenList.length>0){
data.pageData.LearningGardenList.forEach(x=>{
data.pageData.LearningGardenList.forEach((x,y)=>{
if(x.List.length>0){
x.List.forEach((item,index)=>{
this.getColor(item.Img).then(v=>{
item.bgcolor = v;
this.getColor(item.Img,index,y).then(v=>{
console.log(v)
// item.bgcolor = v;
data.pageData.LearningGardenList[v.y].List[v.index].bgcolor = v.formatres;
})
})
}
......@@ -205,11 +208,15 @@
}
})
},
async getColor(src) {
async getColor(src,index,y) {
let res = await getImageColor('myCanvas', 'img', src)
const formatres = `rgba(${res.r},${res.g},${res.b},1)`
let obj={}
obj.formatres = `rgba(${res.r},${res.g},${res.b},1)`
obj.index = index
obj.y = y
// console.log(168, formatres)
return formatres
return obj
},
againdata() {
data.pageData = uni.getStorageSync("userInfo");
......
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