<template>
  <view class="school-list">
	  <view class="good" v-for="(cx, ci) in g" :key="ci" @click="clickHandler(cx)">
		  <view class="good-img">
		    <image mode="aspectFill" :src="cx.cover_pic" style="width: 100%; height: 100%;border-radius: 4px;" ></image>
		  </view>
		  <view class="good-r" :style="{'width': (windowWidth -15 - 125 -26)+'px'}">
			  <view class="good-name" v-if="setting.is_show_goods_name==1">
			    <view
			      v-if="cx.marketingLogo.iswords && cx.marketingLogo.iswords==1&& cx.marketingLogo.words!=''"
			      class="Logo"
			      :style="{color: cx.marketingLogo.wordsColor,
			  						background:cx.marketingLogo.wordsBack ,}"
			    >{{cx.marketingLogo.words}}</view>
			    <image
			      v-if="cx.marketingLogo.iswords&&cx.marketingLogo.iswords==2&& cx.marketingLogo.ico!=''"
			      mode="heightFix"
			      :src="cx.marketingLogo.ico"
			      style=" height: 12px;margin-right: 5px"
			    />
			    {{ cx.name }}
			  </view>
			  <view class="good-r-b">
				  <view class="good-rb-box">
					  <u-rate
					    :current="cx.course_score!=null &&cx.course_score>0?cx.course_score:'5'"
					    active-color="#FEC471" inactive-color="#DDDDDD"
					    active-icon="star"
					    inactive-icon="star-o"
					    size="20"
					  	:disabled="true"
					  ></u-rate>
					  <text class="good-rb-text">{{cx.course_score!=null &&cx.course_score>0?cx.course_score.toFixed(1):'5.0'}}分</text>
				  </view>
				  <view class="good-rb-box" v-if="cx.is_pay==false && cx.price!=0">
					  <!-- <text style="font-size: 10px;color: #999999;text-decoration:line-through;margin-right: 2px;margin-top: 2px;">￥{{cx.original_price}}</text> -->
					  <text :style="{'font-size': '11px','color': pricecolor,'margin-top':'2px'}">￥</text>
					  <text :style="{'font-size': '16px','color': pricecolor}">{{cx.price.split('.')[0]}}</text>
				  </view>
				  <view class="good-rb-box" v-if="cx.is_pay==true&& cx.price!=0">
					  <text :style="{'font-size': '14px','color': pricecolor}">已购买</text>
				  </view>
				  <view v-if="cx.price==0" style="font-size: 13px;color: #999999;">免费</view>
			  </view>
		  </view>
	  </view>
    
    <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
  </view>
</template>

<script>

import auth from "@/components/auth/index.vue";
export default {
  components: {
    auth,
  },
  props: ["list"],
  data() {
    return {
      g: [],
      
      showAuth: false,
      u: {},
      sku: {},
      mainColor: "",
	  pricecolor:'',
      setting: {},
	  windowWidth:0,
    };
  },
  mounted() {
    this.g = this.list;
    this.mainColor = this.$uiConfig.mainColor;
    this.pricecolor = this.$uiConfig.pricecolor;
    this.initConfig();
	this.windowWidth = this.$utils.SystemInfo().windowWidth;
  },
  watch: {
    list: {
      deep: true,
      immediate: true,
      handler: function (newVal, oldVal) {
        this.g = newVal;
      },
    },
  },
  methods: {
    initConfig() {
      this.setting = uni.getStorageSync("basedata").mall.setting;
    },
    clickHandler(item) {
      uni.navigateTo({ url: "/pages/school/courseInfo?GoodsId=" + item.id });
    },
    reloadUserinfo() {
      this.u = uni.getStorageSync("mall_UserInfo");
      // this.showAuth = false;
    },
    //关闭登录窗口
    gbAuth() {
      this.showAuth = false;
    },
  },
};
</script>

<style>
.school-list  .good{
	background: #fff;
	padding: 10px 13px;
	display: flex;
	flex-direction: row;
	font-family: aa;
	
}
.school-list .good-img{
	width: 125px;
	height: 70px;
	border-radius: 4px;
	box-shadow:0 4px 10px 1px #D2D2D2;
}
.school-list .good-r{
	margin-left: 15px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 3px;
}
.school-list .good .good-name {
  /* height: 37px; */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 3px;
  font-size: 14px;
  color: #1B1D1E;
  
}
.school-list .good-r-b{
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	
}
.school-list .good-rb-box{
	display: flex;
	flex-direction: row;
	align-items: center;
}
.school-list .good-rb-text{
	font-size: 11px;
	color: #999999;
	margin-top: 3px;
	margin-left: 2px;
}
</style>
