

export default class InviteFriends {
  palette(posterImg, qrcodeImg, userName, avatarUrl, options, explain) {
    //获取图片的长宽
    let posterImgWidth = 0, posterImgHeight = 280;
    let windowWidth = options.windowWidth;
    let windowHeight = options.windowHeight;
    if(options){
      posterImgWidth = options.posterImgWidth ? options.posterImgWidth : 0;
      posterImgHeight = options.posterImgHeight ? options.posterImgHeight : 0;
      if (posterImgHeight > windowHeight){
        posterImgHeight = windowHeight - 200;
      }
    }
    return ({
      width: '750rpx',
      height: windowHeight - 100 + 'px',
      background: '#fff',
      views: [
        {
          type: 'image',
          url: posterImg,
          css: {
            width: windowWidth + 'px',
            height: posterImgHeight + 'px'
          }
        },
        {
          type: 'image',
          url: qrcodeImg,
          css: {
            width: '100rpx',
            height: '100rpx',
            right: '28rpx',
            bottom: '43rpx',
          }
        },
        {
          type: 'image',
          url: avatarUrl,
          css: {
            width: '50rpx',
            height: '50rpx',
            left: '23rpx',
            bottom: '43rpx',
            borderRadius: '25rpx'
          }
        },
         {
          type: 'text',
           text: userName + explain[0],
          css: {
            width: '180rpx',
            left: '82rpx',
            bottom: '83rpx',
            fontSize: '18rpx',
            color: '#333333'
          },
          
        },
        {
          type: 'text',
          text: explain[1],
          css: {
            width: '180rpx',
            left: '82rpx',
            bottom: '63rpx',
            fontSize: '18rpx',
            color: '#333333'
          },

        },
        {
          type: 'text',
          text: explain[2],
          css: {
            width: '180rpx',
            left: '82rpx',
            bottom: '43rpx',
            fontSize: '18rpx',
            color: '#333333'
          },

        },
      ],
    });
  }
}
