<commit_before>// share config control
import { emptyHtml } from 'utils/utils';
import { getQueryString } from 'utils/utils';

import logo from 'assets/images/logo-icon.png';

function onMenuShareTimeline(title, link, imgUrl, success, cancel) {
  wx.onMenuShareTimeline({
    title, // 分享标题
    link, // 分享链接
    imgUrl,
    success,
    cancel,
  });
}

function onMenuShareOther(title, desc, link, imgUrl, success, cancel) {
  // 分享给朋友
  wx.onMenuShareAppMessage({
    title, // 分享标题
    desc, // 分享描述
    link, // 分享链接
    imgUrl,
    type: '', // 分享类型,music、video或link，不填默认为link
    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
    success,
    cancel,
  });

  // 分享给QQ
  wx.onMenuShareQQ({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });

  // 分享给微博
  wx.onMenuShareWeibo({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });

  // 分享给QQ空间
  wx.onMenuShareQZone({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });
}

const domain = window.document.domain;
const shareConfig = {
  config: (type, data, user) => {
    let title = '80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！';
    let timeLineTitle = '';
    let desc = '';
    let link = `http://${domain}/public_share.html?type=${type}`;
    let imgUrl = '';
    let success = data.success ? data.success : () => {};
    let cancel = data.cancel ? data.cancel : () => {};
    const uid = getQueryString('uid');

    switch (type) {
      case 'app': {
        const { name } = data;
        title = `${name ? name : ''}邀请您加入健康商信APP`;
        timeLineTitle = `${name ? name : ''}邀请您加入健康商信APP，80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        desc = `80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        link = `${link}&name=${name ? name : ''}`;
        imgUrl = `${domain}${logo}`;
        break;
      }
      case 'card': {
        const { id, avatar, nickname, company, position } = data;
        title = `${nickname}的健康商信名片`;
        timeLineTitle = `${nickname}的健康商信名片，点击查看详情；80万健康行业资源平台邀请您加入！`;
        desc = `点击查看详情；${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}邀请你加入80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = avatar;
        break;
      }
      case 'momment': {
        const { id, nickname, title:cmsTitle, content, pictures, company, position } = data;
        title = cmsTitle ? cmsTitle : (content.trim() !== '' ? emptyHtml(content) : `分享${nickname}的健康商信动态`);
        timeLineTitle = `${emptyHtml(content)}分享${nickname}的健康商信动态.健康产业APP：${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享动态，邀请您也来分享`;
        desc = `健康商信APP：${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享动态，邀请您也来分享`;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = pictures.length > 0 ? pictures[0] : `${domain}${logo}`;
        break;
      }
      case 'note': {
        const { id, nickname, content, pictures, company, position } = data;
        title = `${user ? user.nickname : nickname}分享了一条群公告`;
        timeLineTitle = `${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享群公告，点击了解详情`;
        desc = timeLineTitle;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = pictures.length > 0 ? pictures[0] : `${domain}${logo}`;
        break;
      }
      case 'jk_group': {
        const { id, name, head } = data;
        title = `${user ? user.nickname : ''}邀请您加入${name}`;
        timeLineTitle = `${user ? `${user.company}.${user.position}.${user.nickname}` : ``}邀请您加入健康商信${name}`;
        desc = timeLineTitle;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = head;
        break;
      }
      default: {
      }
    }

    // title limit: 30, content limit: 50
    title = title.substring(0, 30);
    desc = desc.substring(0, 50);
    timeLineTitle = timeLineTitle.substring(0, 50);

    onMenuShareTimeline(timeLineTitle, link, imgUrl, success, cancel);
    onMenuShareOther(title, desc, link, imgUrl, success, cancel);

    // share config for QQ
    window.setShareInfo && window.setShareInfo({
      title,
      summary: desc,
      pic: imgUrl,
      url: link,
    });

    return {
      title, desc, link, imgUrl
    };
  },

  share: (type, data, user) => {
    // add weixin here to double check for weixin config
    wx.ready(shareConfig.config(type, data, user));

    return shareConfig.config(type, data, user);
  },
};

export default shareConfig;<commit_msg>. fix share config show err<commit_after>// share config control
import { emptyHtml } from 'utils/utils';
import { getQueryString } from 'utils/utils';

import logo from 'assets/images/logo-icon.png';

function onMenuShareTimeline(title, link, imgUrl, success, cancel) {
  wx.onMenuShareTimeline({
    title, // 分享标题
    link, // 分享链接
    imgUrl,
    success,
    cancel,
  });
}

function onMenuShareOther(title, desc, link, imgUrl, success, cancel) {
  // 分享给朋友
  wx.onMenuShareAppMessage({
    title, // 分享标题
    desc, // 分享描述
    link, // 分享链接
    imgUrl,
    type: '', // 分享类型,music、video或link，不填默认为link
    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
    success,
    cancel,
  });

  // 分享给QQ
  wx.onMenuShareQQ({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });

  // 分享给微博
  wx.onMenuShareWeibo({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });

  // 分享给QQ空间
  wx.onMenuShareQZone({
    title,
    desc,
    link,
    imgUrl,
    success,
    cancel,
  });
}

const domain = window.document.domain;
const shareConfig = {
  config: (type, data, user) => {
    let title = '80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！';
    let timeLineTitle = '';
    let desc = '';
    let link = `http://${domain}/public_share.html?type=${type}`;
    let imgUrl = '';
    let success = data.success ? data.success : () => {};
    let cancel = data.cancel ? data.cancel : () => {};
    const uid = getQueryString('uid');

    switch (type) {
      case 'app': {
        const { name } = data;
        title = `${name ? name : ''}邀请您加入健康商信APP`;
        timeLineTitle = `${name ? name : ''}邀请您加入健康商信APP，80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        desc = `80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        link = `${link}&name=${name ? name : ''}`;
        imgUrl = `${domain}${logo}`;
        break;
      }
      case 'card': {
        const { id, avatar, nickname, company, position } = data;
        title = `${nickname}的健康商信名片`;
        timeLineTitle = `${nickname}的健康商信名片，点击查看详情；80万健康行业资源平台邀请您加入！`;
        desc = `点击查看详情；${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}邀请你加入80万行业资源平台，找讲师、找厂家、找经销商就上健康商信！`;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = avatar;
        break;
      }
      case 'momment': {
        const { id, nickname, title:cmsTitle, content, pictures, company, position } = data;
        title = cmsTitle ? cmsTitle : (content.trim() !== '' ? emptyHtml(content) : `分享${nickname}的健康商信动态`);
        timeLineTitle = `${emptyHtml(content)}分享${nickname}的健康商信动态.健康产业APP：${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享动态，邀请您也来分享`;
        desc = `健康商信APP：${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享动态，邀请您也来分享`;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = pictures.length > 0 ? pictures[0] : `${domain}${logo}`;
        break;
      }
      case 'note': {
        const { id, nickname, content, pictures, company, position } = data;
        title = `${user ? user.nickname : nickname}分享了一条群公告`;
        timeLineTitle = `${user ? `${user.company}.${user.position}.${user.nickname}` : `${company}.${position}.${nickname}`}在分享群公告，点击了解详情`;
        desc = timeLineTitle;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = pictures.length > 0 ? pictures[0] : `${domain}${logo}`;
        break;
      }
      case 'jk_group': {
        const { id, name, head } = data;
        title = `${user ? user.nickname : ''}邀请您加入${name}`;
        timeLineTitle = `${user ? `${user.company}.${user.position}.${user.nickname}` : ``}邀请您加入健康商信${name}`;
        desc = timeLineTitle;
        link = `${link}&id=${id}&uid=${uid}`;
        imgUrl = head;
        break;
      }
      default: {
      }
    }

    // title limit: 30, content limit: 50
    title = title.substring(0, 30);
    desc = desc.substring(0, 50);
    timeLineTitle = timeLineTitle.substring(0, 50);

    onMenuShareTimeline(timeLineTitle, link, imgUrl, success, cancel);
    onMenuShareOther(title, desc, link, imgUrl, success, cancel);

    // share config for QQ
    window.setShareInfo && window.setShareInfo({
      title,
      summary: desc,
      pic: imgUrl,
      url: link,
    });

    return {
      title, desc, link, imgUrl
    };
  },

  share: (type, data, user) => {
    // add weixin here to double check for weixin config
    wx.ready(() => {
      shareConfig.config(type, data, user);
    });

    return shareConfig.config(type, data, user);
  },
};

export default shareConfig;
{'fraction_non_alphanumeric': 0.17969687057027586, 'fraction_numerical': 0.005888125613346418, 'mean_word_length': 2.7636438243742307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2725106', 'n_tokens_mistral': 3482, 'n_tokens_neox': 3840, 'n_words': 613}