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D,iBAAMA,UAAU,kCAAiC,SAC9CqB,aAAgB,EAAhBA,EAAkBS,gCAGvB,iBAAK9B,UAAU,kBAAiB,WAC9B,iBAAMA,UAAU,kCAAiC,SAAC,WAClD,iBAAMA,UAAU,kCAAiC,SAC9CqB,aAAgB,EAAhBA,EAAkBU,uBAGvB,iBAAK/B,UAAU,kBAAiB,WAC9B,iBAAMA,UAAU,kCAAiC,SAAC,WAClD,iBAAMA,UAAU,kCAAiC,SAC9CqB,aAAgB,EAAhBA,EAAkBW,gCAGvB,iBAAKhC,UAAU,kBAAiB,WAC9B,iBAAMA,UAAU,kCAAiC,SAAC,UAClD,iBAAMA,UAAU,kCAAiC,SAC9CqB,aAAgB,EAAhBA,EAAkBY,4BAK3B,iBAAKjC,UAAU,SAAQ,WACrB,gBAAKA,UAAU,oCAAmC,UAChD,iBAAMA,UAAU,qCAAoC,SAAC,aAIrDiB,IACA,iBAAKjB,UAAU,4CAA2C,WACxD,gBAAKkC,I,qiXAAuBlC,UAAU,YACtC,gBACEkC,I,qpGACAlC,UAAU,wBACV6B,QAAS,kBACNM,OAAOC,SAASvB,KACf,qDAAqD,OAM9DY,aAAQ,EAARA,EAAUjB,KAAI,SAACC,GACd,OAAO,SAACZ,EAAgB,CAAgBE,KAAMU,GAAhBA,EAAK4B,IACrC,QAGF,SAACC,EAAA,QAAoB,CACnBC,KAAMpB,EACNqB,WAAY,WACVpB,GAAoB,EACtB,MAIR,C","sources":["webpack:///./src/components/homepage/HomepageTasks/index.tsx"],"sourcesContent":["import * as api from '@/api/homepage';\nimport bg from '@/static/imgs/homepage-task-bg.png';\nimport certificationBtnImg from '@/static/imgs/task-certification-btn.png';\nimport certificationImg from '@/static/imgs/task-certification.png';\nimport { useRequest } from 'ahooks';\nimport { useState } from 'react';\nimport HomepageContribution from '../HomepageContribution';\n\ntype HomepageTaskItemProps = {\n  task: API.Homepage.TaskForList;\n};\n\nconst arraySplit = (jifens: string) => {\n  return jifens.split(',').map((item) => Number(item));\n};\n\nconst HomepageTaskItem: React.FC<HomepageTaskItemProps> = ({ task }) => (\n  <div className=\"flex justify-between items-center mt-10px\">\n    <div className=\"text-hex-4e5969 text-14px w-220px\">\n      <span>{task.title}</span>\n      {task.is_jifen_enabled &&\n        (task.is_fixed ? (\n          <>\n            <span className=\"text-hex-e56a2a\">+{task.jifen}</span>\n            <span>积分 </span>\n          </>\n        ) : (\n          <>\n            <span className=\"text-hex-e56a2a\">\n              +{Math.min(...arraySplit(task.jifens))}\n            </span>\n            <span>积分起 </span>\n          </>\n        ))}\n      {task.is_building_enabled && (\n        <>\n          <span className=\"text-hex-e56a2a\">+{task.building_score}</span>\n          <span>共建值</span>\n        </>\n      )}\n    </div>\n    <div>\n      <a\n        href={task.url}\n        className=\"px-8px py-2px rounded-4px bg-hex-fdf1ea text-hex-e56a2a flex justify-center items-center\"\n        target=\"_blank\"\n        rel=\"noreferrer\"\n      >\n        去完成\n      </a>\n    </div>\n  </div>\n);\n\nconst HomepageTasks: React.FC<{ isBaseVip: boolean }> = ({ isBaseVip }) => {\n  const [showContribution, setShowContribution] = useState<boolean>(false);\n  const { data: buildingOverview } = useRequest(api.getBuildingOverview);\n  const { data: taskList } = useRequest(api.listTasks);\n  return (\n    <div className=\"block\">\n      <div\n        style={{ backgroundImage: `url(${bg})` }}\n        className=\"rounded-t-6px space-y-6px py-16px px-20px\"\n      >\n        <div className=\"flex justify-between items-center\">\n          <div className=\"text-hex-fff header-title text-18px font-500\">\n            社区共建\n          </div>\n          <div\n            className=\"text-hex-e56a2a bg-hex-fff rounded-full text-12px px-8px py-1px cursor-pointer\"\n            onClick={() => {\n              setShowContribution(true);\n            }}\n          >\n            排行榜\n          </div>\n        </div>\n      </div>\n      <div className=\"px-20px pt-20px\">\n        <div className=\"bg-hex-f7f8fa rounded-6px p-10px grid grid-cols-2\">\n          <div className=\"task-total-item\">\n            <span className=\"task-total-item-title text-14px\">\n              今日共建值:\n            </span>\n            <span className=\"task-total-item-count text-14px\">\n              {buildingOverview?.user_today_building_score}\n            </span>\n          </div>\n          <div className=\"task-total-item\">\n            <span className=\"task-total-item-title text-14px\">今日积分:</span>\n            <span className=\"task-total-item-count text-14px\">\n              {buildingOverview?.user_today_jifen}\n            </span>\n          </div>\n          <div className=\"task-total-item\">\n            <span className=\"task-total-item-title text-14px\">总共建值:</span>\n            <span className=\"task-total-item-count text-14px\">\n              {buildingOverview?.user_total_building_score}\n            </span>\n          </div>\n          <div className=\"task-total-item\">\n            <span className=\"task-total-item-title text-14px\">总积分:</span>\n            <span className=\"task-total-item-count text-14px\">\n              {buildingOverview?.user_total_jifen}\n            </span>\n          </div>\n        </div>\n      </div>\n      <div className=\"p-20px\">\n        <div className=\"flex justify-between items-center\">\n          <span className=\"text-hex-1d2129 font-500 text-16px\">待完成任务</span>\n        </div>\n\n        {/* 用户认证 */}\n        {!isBaseVip && (\n          <div className=\"flex justify-between items-center mt-10px\">\n            <img src={certificationImg} className=\"h-22px\" />\n            <img\n              src={certificationBtnImg}\n              className=\"w-58px cursor-pointer\"\n              onClick={() =>\n                (window.location.href =\n                  '/community/user/certification/?utm_source=home_task')\n              }\n            />\n          </div>\n        )}\n\n        {taskList?.map((item) => {\n          return <HomepageTaskItem key={item.uid} task={item} />;\n        })}\n      </div>\n\n      <HomepageContribution\n        open={showContribution}\n        closeModal={() => {\n          setShowContribution(false);\n        }}\n      />\n    </div>\n  );\n};\n\nexport default HomepageTasks;\n"],"names":["HomepageTaskItem","jifens","task","className","title","is_jifen_enabled","is_fixed","jifen","Math","min","split","map","item","Number","is_building_enabled","building_score","href","url","target","rel","isBaseVip","useState","showContribution","setShowContribution","buildingOverview","useRequest","api","data","taskList","style","backgroundImage","bg","onClick","user_today_building_score","user_today_jifen","user_total_building_score","user_total_jifen","src","window","location","uid","HomepageContribution","open","closeModal"],"sourceRoot":""}