activityDetail.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. <template>
  2. <view class="common_page adffc" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <!-- Canvas组件,用于后台绘制海报,通过绝对定位移出屏幕外 -->
  4. <canvas canvas-id="posterCanvas"
  5. :style="{width: canvasWidth + 'px', height: canvasHeight + 'px', position: 'fixed', top: '-99999px', left: '0'}" />
  6. <cus-header title="公益活动详情" bgColor="transparent"></cus-header>
  7. <image src="https://oss.familydaf.cn/sxsnfile/20251218/811a8863a74d4ed9b86f68284eaff0c9.png" class="top_bg_img" mode="widthFix"></image>
  8. <view class="lunbo">
  9. <up-swiper
  10. :list="imgList"
  11. @change="e => current = e.current"
  12. :autoplay="true"
  13. :interval="2000"
  14. :duration="200"
  15. :circular="true"
  16. imgMode="scaleToFill"
  17. height="440rpx"
  18. >
  19. <template #indicator>
  20. <view class="indicator adf">
  21. <view class="indicator__dot" v-for="(item, index) in imgList" :key="index"
  22. :class="[index === current && 'indicator__dot--active']">
  23. </view>
  24. </view>
  25. </template>
  26. </up-swiper>
  27. </view>
  28. <view class="box box1">
  29. <view class="box1-top">
  30. <text class="box1-top-status" :class="{'end':activityInfo?.activeState==3}">{{statusCfg[activityInfo?.activeState]||'未知'}}</text>
  31. <text class="box1-top-title">{{activityInfo?.activityName||''}}</text>
  32. </view>
  33. <view class="box1-line" style="margin-top: 36rpx;"></view>
  34. <view class="box1-place adfacjb">
  35. <view class="box1-place-left adffcjb">
  36. <text>活动地点</text>
  37. <view class="addr">{{activityInfo?.provinceName||''}}{{activityInfo?.cityName||''}}{{activityInfo?.address||''}}</view>
  38. </view>
  39. <view class="box1-place-right">
  40. <image src="https://oss.familydaf.cn/sxsnfile/20251218/dc3034ff405549059cc52eac7479f0e0.png"></image>
  41. </view>
  42. </view>
  43. <view class="box1-line" style="margin-top: 24rpx;"></view>
  44. <view class="box1-member adfacjb">
  45. <view class="box1-member-left adffc">
  46. <text>招募人数</text>
  47. <view class="num"><text>{{activityInfo?.recruitmentNow}}</text> /{{activityInfo?.recruitmentMax||'不限'}}</view>
  48. </view>
  49. <view class="box1-member-right adffc" @tap="handleReviewMembers">
  50. <view class="review adfac">
  51. <text>查看报名人员</text>
  52. <image src="https://oss.familydaf.cn/sxsnfile/20251218/d22838b7cdae42b5a8e6ebfa01d06445.png"></image>
  53. </view>
  54. <view class="avatars">
  55. <up-avatar-group :urls="avatars" size="30" gap="0.4" :maxCount="3"></up-avatar-group>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="box1-line" style="margin-top: 33rpx;"></view>
  60. <view class="box1-time adffc">
  61. <text>活动时间</text>
  62. <view class="text">{{activityInfo?.activityStartTime}} - {{activityInfo?.activityEndTime}}</view>
  63. </view>
  64. <view class="box1-line" style="margin-top: 30rpx;"></view>
  65. <view class="box1-need adffc">
  66. <text>报名要求</text>
  67. <template v-if="activityInfo?.activityLimit==1">
  68. <view class="text"><text>{{activityInfo?.valueLimit||0}}</text>爱心值</view>
  69. <view class="tip">{{activityInfo?.loveValueContent||''}}</view>
  70. </template>
  71. <template v-else-if="activityInfo?.activityLimit==2">
  72. <view class="text"><text>{{activityInfo?.valueLimit||0}}</text>张专享券</view>
  73. <view class="tip">{{activityInfo?.loveValueContent||''}}</view>
  74. </template>
  75. <template v-else-if="activityInfo?.activityLimit==3">
  76. <view class="text"><text class="mf">免费</text></view>
  77. <view class="tip"></view>
  78. </template>
  79. <div class="box1-need-level">
  80. <div class="box1-need-level-title">报名等级</div>
  81. <div class="box1-need-level-num" :class="{'bxz':!activityInfo?.userLevel}">{{activityInfo?.userLevel?('Lv'+activityInfo?.userLevel):'不限制'}}</div>
  82. </div>
  83. </view>
  84. <view class="box1-line" style="margin-top: 30rpx;"></view>
  85. <view class="box1-info adfacjb">
  86. <view class="box1-info-pre">
  87. <text>年龄限制</text>
  88. <view class="text" v-if="activityInfo?.userAgeMax">{{activityInfo?.userAgeMin}}岁 到 {{activityInfo?.userAgeMax}}岁</view>
  89. <view class="text" v-else>不限制</view>
  90. </view>
  91. <view class="box1-info-pre line">
  92. <text>可获得义工时长</text>
  93. <!-- typeId=='1977564860095348737'为义工活动,义工时长只有义工活动才有 -->
  94. <view class="hour" v-if="activityInfo?.typeId=='1977564860095348737'"><text>{{activityInfo?.serviceHours||0}}</text> 小时</view>
  95. <view class="hour" v-else>无</view>
  96. </view>
  97. </view>
  98. <view class="box1-line" style="margin-top: 30rpx;"></view>
  99. <view class="box1-info adfacjb">
  100. <view class="box1-info-pre">
  101. <text>联系人</text>
  102. <view class="text">{{activityInfo?.contact||''}}/{{activityInfo?.contactPhone||''}}</view>
  103. </view>
  104. <view class="box1-info-pre line">
  105. <text>公益合作</text>
  106. <view class="text">{{activityInfo?.channelName||''}}</view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="box box2">
  111. <view class="box-title">活动详情</view>
  112. <view class="box2-detail" v-if="activityInfo&&activityInfo.activityDetails">
  113. <up-read-more :toggle="true" showHeight="374rpx" :shadowStyle="shadowStyle" color="#989998" fontSize="24rpx" openText="收起" closeText="展开" ref="uReadMore">
  114. <!-- <rich-text :nodes="activityInfo.activityDetails"></rich-text> -->
  115. <u-parse :content="activityInfo.activityDetails" @load="load"></u-parse>
  116. </up-read-more>
  117. </view>
  118. </view>
  119. <view class="bottom">
  120. <view class="time">
  121. 报名时间:{{activityInfo?.signupStartTime}} - {{activityInfo?.signupEndTime}}
  122. </view>
  123. <view class="btns adfacjb">
  124. <view class="left adffcacjc" @tap="showShareOptions">
  125. <up-icon name="share-square" color="#252525" size="48rpx"></up-icon>
  126. <text>分享</text>
  127. </view>
  128. <view class="right" @click="handleApply" v-if="activityInfo?.activeState==1&&activityInfo?.signupState==0">立即报名</view>
  129. <view class="right" @click="handleCancel" v-else-if="activityInfo?.activeState==1&&activityInfo?.signupState==1">取消报名</view>
  130. <view class="right" @click="handleSignup" v-else-if="activityInfo?.activeState==2&&activityInfo?.signupState==1">我要签到</view>
  131. <view class="right" @click="handleFill" v-else-if="activityInfo?.activeState==3&&activityInfo?.signupState==1">填写公益档案</view>
  132. <view class="right end" v-else-if="activityInfo?.activeState==0">活动未开始</view>
  133. <view class="right end" v-else-if="activityInfo?.activeState==1&&activityInfo?.signupState==2">活动已签到</view>
  134. <view class="right end" v-else-if="activityInfo?.activeState==2&&activityInfo?.signupState==2">活动已签到</view>
  135. <view class="right end" v-else-if="activityInfo?.activeState==2&&activityInfo?.signupState==0">活动进行中不可报名</view>
  136. <view class="right end" v-else-if="activityInfo?.activeState==3">活动已结束</view>
  137. <view class="right end" v-else-if="activityInfo?.activeState==4">已报满暂无活动名额</view>
  138. </view>
  139. </view>
  140. <view class="fail" v-if="fail">
  141. <view class="fbox adffcac">
  142. <image class="clock" src="https://oss.familydaf.cn/sxsnfile/20251218/4a47278697174d04bf54b8b691587a9c.png"></image>
  143. <image class="close" src="https://oss.familydaf.cn/sxsnfile/20251218/5e39649ad9d0433c96a491bd040413eb.png" @click="fail=false"></image>
  144. <image class="alert" src="https://oss.familydaf.cn/sxsnfile/20251218/39c584e1f7214b32aab2418272bb8678.png" mode="widthFix"></image>
  145. <view class="texts adffcacjc">
  146. <view class="text">您当前{{activityLimitCfg[activityInfo?.activityLimit]}}不足,无法报名活动</view>
  147. <view class="tip">欢迎联系专属客服,了解更多公益活动,积攒{{activityLimitCfg[activityInfo?.activityLimit]}}</view>
  148. </view>
  149. <image class="down" src="https://oss.familydaf.cn/sxsnfile/20251218/445791524423424da07755060a6d50ad.png"></image>
  150. <view class="user adfacjc">
  151. "善行少年"咨询微信
  152. </view>
  153. <view class="finfo adffcac">
  154. <view class="finfo-code adffcacjc">
  155. <image :src="imageUrl" :show-menu-by-longpress="true"></image>
  156. </view>
  157. <view class="finfo-title">长按识别二维码</view>
  158. <view class="finfo-tip">添加您的专属公益向导</view>
  159. <view class="finfo-btn" @click="toWebView">了解善行少年</view>
  160. <view class="finfo-zblj" @click="fail=false">暂不了解</view>
  161. </view>
  162. </view>
  163. </view>
  164. <view class="share" v-if="share">
  165. <view class="sbox">
  166. <view class="sbox-title">分享给好友</view>
  167. <image class="close" src="https://oss.familydaf.cn/sxsnfile/20251218/bbf9472f744741bf9fcf2a2d4c5c0f11.png" @click="share=false"></image>
  168. <view class="sbox-items adfac">
  169. <view class="sbox-items-pre adffcac">
  170. <button class="share-btn" open-type="share">
  171. <image src="https://oss.familydaf.cn/sxsnfile/20251218/9b409327172b42b5a165e1d4da631753.png"></image>
  172. <text>分享页面</text>
  173. </button>
  174. </view>
  175. <view class="sbox-items-pre adffcac" @click="generatePoster">
  176. <image src="https://oss.familydaf.cn/sxsnfile/20251218/8f7e9292eb054271a03cf5f7d63a6b25.png"></image>
  177. <text>生成海报</text>
  178. </view>
  179. <view class="sbox-items-pre adffcac" @click="shareToTimeline">
  180. <image src="https://oss.familydaf.cn/sxsnfile/20251218/b29cf7f4b77e44458c5abc01ca2ff56e.png"></image>
  181. <text>分享到朋友圈</text>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <!-- 海报展示弹窗 -->
  187. <view class="posterbox adffcacjc" v-if="posterShow">
  188. <!-- 加载状态 -->
  189. <u-loading-icon v-if="posterLoading" text="海报生成中..." size="28" textSize="18" inactiveColor="#ffffff" color="#ffffff"></u-loading-icon>
  190. <!-- 海报生成后的内容 -->
  191. <template v-else>
  192. <!-- 此处不再使用HTML结构,而是直接显示生成的图片 -->
  193. <div class="posterbox-card adffcac">
  194. <image :src="posterUrl" mode="widthFix" class="poster-image"></image>
  195. </div>
  196. <div class="posterbox-menu adfacjb">
  197. <div class="posterbox-menu-pre adffcac" v-for="(item,index) in menuList" :key="index" @click="handleMenuClick(item.type)">
  198. <template v-if="index===0">
  199. <button class="share-btn" open-type="share">
  200. <image :src="item.img"></image>
  201. <text>{{item.title}}</text>
  202. </button>
  203. </template>
  204. <template v-else>
  205. <image :src="item.img"></image>
  206. <text>{{item.title}}</text>
  207. </template>
  208. </div>
  209. </div>
  210. <div class="posterbox-close adfacjc">
  211. <image src="https://oss.familydaf.cn/sxsnfile/20251218/44d55c9cb46a404d9dfc0e4ed106c69d.png" @click="posterShow=false"></image>
  212. </div>
  213. </template>
  214. </view>
  215. </view>
  216. </template>
  217. <script setup name="">
  218. import CusHeader from '@/components/CusHeader/index.vue'
  219. import { onLoad } from '@dcloudio/uni-app';
  220. import { ref, reactive, onMounted, getCurrentInstance ,nextTick } from 'vue'
  221. import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  222. const { proxy } = getCurrentInstance()
  223. const id = ref('')
  224. const activityInfo = ref(null)
  225. const statusCfg = ref({
  226. 0:'未开始',
  227. 1:'报名中',
  228. 4:'报名中',
  229. 2:'进行中',
  230. 3:'已结束'
  231. })
  232. const activityLimitCfg = ref({
  233. 1:'爱心值',
  234. 2:'专享券',
  235. 3:'免费'
  236. })
  237. const imgList = ref([])
  238. const current = ref(0)
  239. const detail = ref('')
  240. const avatars = ref([])
  241. const fail = ref(false)
  242. const share = ref(false)
  243. const uReadMore = ref()
  244. const shadowStyle = ref({
  245. backgroundImage: "none",
  246. paddingTop: "0",
  247. marginTop: "20rpx"
  248. })
  249. // --- 海报生成相关 ---
  250. const posterShow = ref(false) // 控制海报弹窗显示
  251. const posterLoading = ref(false) // 控制海报生成时的加载状态
  252. const posterUrl = ref('') // 存储生成的海报图片临时路径
  253. const canvasWidth = ref(0) // Canvas 宽度
  254. const canvasHeight = ref(0) // Canvas 高度
  255. // 海报上所需的动态数据
  256. const posterData = reactive({
  257. mainImg: 'https://sxsn.ringzle.com/happytree-admin/profile/2025/12/12/e8218de1-d059-4197-b677-f9d2e446971e.png',
  258. title: '《环保知识知多少》让孩子成为健康公益大使',
  259. time: '06.01-12:00 ~ 06.02-12:00',
  260. timeIcon: 'https://oss.familydaf.cn/sxsnfile/20251218/762878799914422d835e505291b9d4c6.png',
  261. address: '深圳市南山区南山街道丰潭路',
  262. addressIcon: 'https://oss.familydaf.cn/sxsnfile/20251218/57539643ab974aef9401d76818e1bf3b.png',
  263. organizer: '锦鲤俱乐部',
  264. organizerIcon: 'https://oss.familydaf.cn/sxsnfile/20251218/47953738adfc46d8b959d7cead7a186e.png',
  265. qrCode: 'https://oss.familydaf.cn/sxsnfile/20251218/4eeb3cf6799141c9853349533c33e529.jpg'
  266. })
  267. const imageUrl = ref('https://oss.familydaf.cn/sxsnfile/20251218/b25745272a52435194dbc3987d5645f2.png')
  268. const menuList = ref([
  269. { img:'https://oss.familydaf.cn/sxsnfile/20251218/533e0ec5511043c6853c4a05b720dadf.png',title:'发送给朋友', type:'shareApp' },
  270. { img:'https://oss.familydaf.cn/sxsnfile/20251218/43a1bf3fc87240a2b33359f10d9d4d19.png',title:'分享到朋友圈', type:'shareTimeline' },
  271. { img:'https://oss.familydaf.cn/sxsnfile/20251218/875a7d2a8f9e47cb813246879b2b0714.png',title:'收藏', type:'favorite' },
  272. { img:'https://oss.familydaf.cn/sxsnfile/20251218/125b3da887974ae2b600ce2ec72c1fbe.png',title:'保存图片', type:'save' },
  273. ])
  274. const load = () => {
  275. nextTick(()=>{
  276. proxy.$refs.uReadMore.init();
  277. })
  278. }
  279. const handleReviewMembers = () => {
  280. uni.navigateTo({
  281. url:'/pagesHome/recruitsNumber?activityId='+activityInfo.value?.id+'&recruitmentMax='+activityInfo.value?.recruitmentMax+'&recruitmentMin='+activityInfo.value?.recruitmentMin
  282. })
  283. }
  284. //立即报名
  285. const handleApply = async () => {
  286. let level = JSON.parse(uni.getStorageSync('userInfo'))?.userLevel;
  287. if(level<activityInfo.value.userLevel) return proxy.$showModal(`很抱歉,当前活动限制报名等级为${activityInfo.value.userLevel}级,您当前等级为${level}级,不满足报名条件。`)
  288. let { loveValue, couponIds } = await getUserLoveTicket();
  289. let url = `/pagesHome/activityApply?activity=${encodeURIComponent(JSON.stringify(activityInfo.value))}`;
  290. if((activityInfo.value?.activityLimit==1&&loveValue<activityInfo?.value.valueLimit)
  291. ||(activityInfo.value?.activityLimit==2&&couponIds?.length<activityInfo?.value.valueLimit)){
  292. fail.value = true;
  293. return
  294. }
  295. uni.navigateTo({ url })
  296. }
  297. //取消报名
  298. const handleCancel = () => {
  299. uni.reLaunch({
  300. url:'/pages/nonprofit?type=1'
  301. })
  302. }
  303. //我要签到
  304. const handleSignup = () => {
  305. uni.reLaunch({
  306. url:'/pages/nonprofit?type=2'
  307. })
  308. }
  309. //填写公益档案
  310. const handleFill = () => {
  311. uni.reLaunch({
  312. url:'/pages/nonprofit?type=3'
  313. })
  314. }
  315. const getUserLoveTicket = () => {
  316. return new Promise(resolve=>{
  317. let userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  318. proxy.$api.get(`/core/activity/signup/userAsset/${userId}/${activityInfo.value?.id}`).then(({data:res})=>{
  319. if(res.code!==0) return proxy.$showToast(res.msg)
  320. resolve({loveValue:res.data?.loveValue||0,couponIds:res.data?.couponIds||0})
  321. })
  322. })
  323. }
  324. onShareAppMessage((res) => {
  325. // 如果是点击海报菜单的“发送给朋友”按钮
  326. if (res.from === 'button' && res.target.id === 'posterShareBtn') {
  327. return {
  328. title: posterData.title,
  329. path: `/pagesHome/activityDetail?shareADId=${id.value}`,
  330. imageUrl: posterUrl.value // 使用生成的海报作为分享图
  331. };
  332. }
  333. // 默认页面右上角分享
  334. const sharerId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  335. return {
  336. title: activityInfo.value?.activityName || '发现一个好物,分享给你!',
  337. path: `/pagesHome/activityDetail?shareADId=${activityInfo.value?.id}&shareUserId=${sharerId}`,
  338. imageUrl: activityInfo.value?.coverFile
  339. };
  340. })
  341. onShareTimeline((res) => {
  342. const sharerId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  343. return {
  344. title: activityInfo.value?.activityName || '发现一个好物,分享给你!',
  345. query: `shareADId=${activityInfo.value?.id}&shareUserId=${sharerId}`,
  346. imageUrl: activityInfo.value?.coverFile
  347. };
  348. })
  349. const showShareOptions = () => {
  350. share.value = true;
  351. }
  352. // 分享到朋友圈(旧逻辑)
  353. const shareToTimeline = () => {
  354. uni.showModal({
  355. title:'温馨提示',
  356. content:'分享到朋友圈请点击页面右上方的“···”标志后选择“分享到朋友圈”进行分享'
  357. })
  358. }
  359. // --- Canvas海报生成核心逻辑 ---
  360. // 1. 触发生成
  361. const generatePoster = async () => {
  362. share.value = false;
  363. posterShow.value = true;
  364. posterLoading.value = true;
  365. posterUrl.value = ''; // 清空旧海报
  366. try {
  367. // 获取设备信息,用于rpx转px
  368. const systemInfo = uni.getSystemInfoSync();
  369. const screenWidth = systemInfo.screenWidth;
  370. const rpxRatio = screenWidth / 750;
  371. // --- 定义尺寸和坐标 (单位: px) ---
  372. // 卡片总宽度为 100% - 220rpx
  373. const cardWidth = screenWidth - 220 * rpxRatio;
  374. const cardPadding = 20 * rpxRatio;
  375. const contentWidth = cardWidth - cardPadding * 2;
  376. const mainImgHeight = 368 * rpxRatio;
  377. const infoTopMargin = 14 * rpxRatio;
  378. const qrCodeWidth = 123 * rpxRatio;
  379. const qrCodeHeight = 123 * rpxRatio;
  380. const rightPartWidth = 163 * rpxRatio;
  381. const leftPartWidth = contentWidth - rightPartWidth;
  382. // 计算总高度
  383. const titleHeight = calculateWrappedTextHeight(posterData.title, 24 * rpxRatio, contentWidth, 36 * rpxRatio);
  384. const infoBlockHeight = 160 * rpxRatio; // 估算下方信息区域高度
  385. const cardHeight = cardPadding * 2 + mainImgHeight + infoTopMargin + infoBlockHeight;
  386. canvasWidth.value = cardWidth;
  387. canvasHeight.value = cardHeight;
  388. // 等待一帧,确保canvas尺寸设置生效
  389. await new Promise(resolve => setTimeout(resolve, 50));
  390. const ctx = uni.createCanvasContext('posterCanvas', proxy);
  391. // --- 下载所有需要的图片 ---
  392. const [mainImg, timeIcon, addressIcon, orgIcon, qrCode] = await Promise.all([
  393. uni.getImageInfo({ src: posterData.mainImg }),
  394. uni.getImageInfo({ src: posterData.timeIcon }),
  395. uni.getImageInfo({ src: posterData.addressIcon }),
  396. uni.getImageInfo({ src: posterData.organizerIcon }),
  397. uni.getImageInfo({ src: posterData.qrCode }),
  398. ]);
  399. // --- 开始绘制 ---
  400. // 1. 绘制白色背景
  401. ctx.fillStyle = '#FFFFFF';
  402. ctx.fillRect(0, 0, cardWidth, cardHeight);
  403. // 2. 绘制主图 (带圆角)
  404. ctx.save(); // 保存当前画布状态
  405. const borderRadius = 16 * rpxRatio; // 16rpx
  406. // 创建圆角矩形路径
  407. ctx.beginPath();
  408. ctx.moveTo(cardPadding + borderRadius, cardPadding);
  409. ctx.lineTo(cardPadding + contentWidth - borderRadius, cardPadding);
  410. ctx.arcTo(cardPadding + contentWidth, cardPadding, cardPadding + contentWidth, cardPadding + borderRadius, borderRadius);
  411. ctx.lineTo(cardPadding + contentWidth, cardPadding + mainImgHeight - borderRadius);
  412. ctx.arcTo(cardPadding + contentWidth, cardPadding + mainImgHeight, cardPadding + contentWidth - borderRadius, cardPadding + mainImgHeight, borderRadius);
  413. ctx.lineTo(cardPadding + borderRadius, cardPadding + mainImgHeight);
  414. ctx.arcTo(cardPadding, cardPadding + mainImgHeight, cardPadding, cardPadding + mainImgHeight - borderRadius, borderRadius);
  415. ctx.lineTo(cardPadding, cardPadding + borderRadius);
  416. ctx.arcTo(cardPadding, cardPadding, cardPadding + borderRadius, cardPadding, borderRadius);
  417. ctx.closePath();
  418. ctx.clip(); // 裁剪后续绘图到此路径
  419. ctx.drawImage(mainImg.path, cardPadding, cardPadding, contentWidth, mainImgHeight);
  420. ctx.restore(); // 恢复画布状态 (移除裁剪路径)
  421. let currentY = cardPadding + mainImgHeight + infoTopMargin;
  422. // 3. 绘制左侧信息
  423. const leftX = cardPadding;
  424. // 3.1 绘制标题 (自动换行)
  425. ctx.font = `bold ${Math.round(24 * rpxRatio)}px "PingFang-SC", sans-serif`;
  426. ctx.fillStyle = '#252525';
  427. currentY += drawWrappedText(ctx, posterData.title, leftX, currentY + 24 * rpxRatio, leftPartWidth, 36 * rpxRatio, 1);
  428. currentY += 12 * rpxRatio; // 标题和下方内容的间距
  429. // 3.2 绘制时间
  430. const iconSize = 24 * rpxRatio;
  431. const textLeftMargin = 10 * rpxRatio;
  432. const infoLineHeight = 36 * rpxRatio;
  433. ctx.drawImage(timeIcon.path, leftX, currentY + (infoLineHeight - iconSize) / 2, iconSize, iconSize);
  434. ctx.font = `bold ${Math.round(20 * rpxRatio)}px "PingFang-SC", sans-serif`;
  435. ctx.fillStyle = '#8B8B8B';
  436. ctx.fillText(posterData.time, leftX + iconSize + textLeftMargin, currentY + 25 * rpxRatio);
  437. currentY += infoLineHeight;
  438. // 3.3 绘制地点
  439. ctx.drawImage(addressIcon.path, leftX, currentY + (infoLineHeight - iconSize) / 2, iconSize, iconSize);
  440. ctx.fillText(posterData.address, leftX + iconSize + textLeftMargin, currentY + 25 * rpxRatio);
  441. currentY += infoLineHeight;
  442. // 3.4 绘制俱乐部
  443. const orgIconSize = 30 * rpxRatio;
  444. ctx.drawImage(orgIcon.path, leftX, currentY + (infoLineHeight - orgIconSize) / 2, orgIconSize, orgIconSize);
  445. ctx.fillText(posterData.organizer, leftX + orgIconSize + textLeftMargin, currentY + 25 * rpxRatio);
  446. // 4. 绘制右侧二维码
  447. const rightX = cardPadding + leftPartWidth;
  448. const qrY = cardPadding + mainImgHeight + infoTopMargin;
  449. ctx.drawImage(qrCode.path, rightX + (rightPartWidth - qrCodeWidth) / 2, qrY, qrCodeWidth, qrCodeHeight);
  450. // 4.1 绘制二维码下方文字
  451. ctx.textAlign = 'center';
  452. ctx.font = `bold ${Math.round(20 * rpxRatio)}px "PingFang-SC", sans-serif`;
  453. ctx.fillStyle = '#8B8B8B';
  454. ctx.fillText('微信扫一扫', rightX + rightPartWidth / 2, qrY + qrCodeHeight + 30 * rpxRatio);
  455. ctx.textAlign = 'left'; // 恢复默认
  456. // --- 生成图片 ---
  457. ctx.draw(false, () => {
  458. uni.canvasToTempFilePath({
  459. canvasId: 'posterCanvas',
  460. success: (res) => {
  461. posterUrl.value = res.tempFilePath;
  462. posterLoading.value = false;
  463. },
  464. fail: (err) => {
  465. console.error('canvasToTempFilePath failed:', err);
  466. proxy.$showToast('海报生成失败,请稍后再试');
  467. posterLoading.value = false;
  468. posterShow.value = false;
  469. }
  470. }, proxy);
  471. });
  472. } catch (error) {
  473. console.error('generatePoster failed:', error);
  474. proxy.$showToast('图片资源加载失败,无法生成海报');
  475. posterLoading.value = false;
  476. posterShow.value = false;
  477. }
  478. }
  479. // Canvas 文本换行绘制函数
  480. // ctx: canvas context, text: 文本, x,y: 起始坐标, maxWidth: 最大宽度, lineHeight: 行高, maxLines: 最大行数
  481. function drawWrappedText(ctx, text, x, y, maxWidth, lineHeight, maxLines = 2) {
  482. let lines = [];
  483. let currentLine = '';
  484. let totalHeight = 0;
  485. for (let i = 0; i < text.length; i++) {
  486. let char = text[i];
  487. let testLine = currentLine + char;
  488. let metrics = ctx.measureText(testLine);
  489. let testWidth = metrics.width;
  490. if (testWidth > maxWidth && i > 0) {
  491. lines.push(currentLine);
  492. currentLine = char;
  493. } else {
  494. currentLine = testLine;
  495. }
  496. }
  497. lines.push(currentLine);
  498. if (lines.length > maxLines) {
  499. lines = lines.slice(0, maxLines);
  500. lines[maxLines - 1] += '...';
  501. }
  502. for (let j = 0; j < lines.length; j++) {
  503. ctx.fillText(lines[j], x, y + j * lineHeight);
  504. totalHeight += lineHeight;
  505. }
  506. return totalHeight;
  507. }
  508. // 辅助函数,用于估算换行后的文本高度
  509. function calculateWrappedTextHeight(text, fontSize, maxWidth, lineHeight) {
  510. // 这是一个简化的估算,实际应使用canvas.measureText
  511. const charsPerLine = Math.floor(maxWidth / (fontSize * 1.1));
  512. const lines = Math.ceil(text.length / charsPerLine);
  513. return lines * lineHeight;
  514. }
  515. // --- 海报下方菜单点击事件 ---
  516. const handleMenuClick = (type) => {
  517. switch(type) {
  518. case 'shareApp':
  519. break;
  520. case 'shareTimeline':
  521. // 同上,提示用户
  522. uni.showToast({ title: '请点击右上角“···”分享到朋友圈', icon: 'none' });
  523. break;
  524. case 'favorite':
  525. uni.showModal({
  526. title: '收藏提示',
  527. content: "请点击右上角 '...' 按钮,然后选择 '添加到我的小程序' 或 '收藏',即可方便下次访问哦!",
  528. showCancel: false, // 通常只保留一个“我知道了”按钮
  529. confirmText: '我知道了'
  530. });
  531. break;
  532. case 'save':
  533. // 保存图片到相册
  534. savePosterToAlbum();
  535. break;
  536. }
  537. }
  538. // 保存海报到相册
  539. const savePosterToAlbum = () => {
  540. if (!posterUrl.value) {
  541. proxy.$showToast('海报图片不存在');
  542. return;
  543. }
  544. uni.saveImageToPhotosAlbum({
  545. filePath: posterUrl.value,
  546. success: () => {
  547. proxy.$showToast('海报已保存到相册');
  548. },
  549. fail: (err) => {
  550. if (err.errMsg.includes('auth deny') || err.errMsg.includes('auth denied')) {
  551. uni.showModal({
  552. title: '授权提示',
  553. content: '需要您授权保存图片到相册',
  554. showCancel: false,
  555. success: () => {
  556. uni.openSetting(); //引导用户去设置页
  557. }
  558. })
  559. } else {
  560. proxy.$showToast('保存失败,请稍后再试');
  561. }
  562. }
  563. })
  564. }
  565. const toWebView = () => {
  566. uni.navigateTo({
  567. url:'/pages/webView?src=https://mp.weixin.qq.com/s/-oQlSBucYU_ifgd1j6eL3A?scene=1&click_id=2'
  568. })
  569. }
  570. const getActivityDetail = (id) => {
  571. proxy.$api.get(`/core/activity/${id}`).then(({data:res})=>{
  572. if(res.code!==0) return proxy.$showToast(res.msg)
  573. activityInfo.value = res.data;
  574. // 更新海报数据
  575. posterData.title = activityInfo.value?.activityName || posterData.title;
  576. posterData.time = `${new Date(activityInfo.value?.activityStartTime).Format('MM.dd-hh:mm') } ~ ${new Date(activityInfo.value?.activityEndTime).Format('MM.dd-hh:mm')}` || posterData.time;
  577. posterData.address = `${activityInfo.value?.provinceName||''}${activityInfo.value?.cityName||''}${activityInfo.value?.address||''}` || posterData.address;
  578. posterData.organizer = activityInfo.value?.channelName || posterData.organizer;
  579. if(activityInfo.value?.coverFile) posterData.mainImg = activityInfo.value?.coverFile;
  580. if(activityInfo.value.signupState==0
  581. &&activityInfo.value.activeState===1
  582. &&activityInfo.value.recruitmentNow==(activityInfo.value.recruitmentMax||99999)){
  583. activityInfo.value.activeState = 4;//已报满暂无活动名额
  584. }
  585. imgList.value = activityInfo.value?.imageFiles&&(activityInfo.value?.imageFiles.split(',')||[])
  586. for(let i=0;i<activityInfo.value.recruitmentNow;i++){
  587. avatars.value.push('https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png')
  588. }
  589. })
  590. }
  591. onLoad(options=>{
  592. id.value = options?.id||options?.shareADId||'';
  593. if(id.value) {
  594. getActivityDetail(id.value)
  595. }
  596. })
  597. </script>
  598. <style scoped lang="scss">
  599. ::v-deep .u-navbar>view{
  600. background: url('https://oss.familydaf.cn/sxsnfile/20251223/d07237024c5e4f00a63b9089abbf5a3c.png') no-repeat;
  601. background-size: 100% 100%;
  602. }
  603. ::v-deep .indicator__dot{
  604. width: 48rpx;
  605. height: 4rpx;
  606. background: #E2E5E9;
  607. border-radius: 2rpx;
  608. margin: 0 8rpx;
  609. }
  610. ::v-deep .indicator__dot--active{
  611. width: 48rpx;
  612. height: 4rpx;
  613. background: #00AE57;
  614. border-radius: 2rpx;
  615. }
  616. ::v-deep .u-swiper__wrapper__item__wrapper__image{
  617. border-radius: 24rpx !important;
  618. }
  619. ::v-deep .u-read-more__toggle{
  620. margin: 20rpx 0 0 0 !important;
  621. }
  622. /* 按钮分享样式 */
  623. .share-btn {
  624. background-color: transparent;
  625. border: none;
  626. padding: 0;
  627. margin: 0;
  628. line-height: 1;
  629. display: flex;
  630. flex-direction: column;
  631. justify-content: center;
  632. align-items: center;
  633. &::after {
  634. border: none;
  635. }
  636. }
  637. .common_page{
  638. padding-bottom: 276rpx;
  639. .lunbo{
  640. width: 100%;
  641. height: 440rpx;
  642. margin-top: 20rpx;
  643. position: relative;
  644. }
  645. .box{
  646. background: linear-gradient(45deg,#FFFFFF 70%,#F2FFE8 100%);
  647. border-radius: 24rpx;
  648. padding: 36rpx 24rpx 30rpx;
  649. margin-top: 20rpx;
  650. position: relative;
  651. &-title{
  652. width: 170rpx;
  653. height: 44rpx;
  654. padding-left: 2rpx;
  655. font-family: PingFang-SC, PingFang-SC;
  656. font-weight: 800;
  657. font-size: 36rpx;
  658. color: #151B29;
  659. line-height: 36rpx;
  660. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/6198fa26a7ff4fc1bce530fbdfaa20db.png');
  661. background-size: 170rpx 31rpx;
  662. background-position: 0 20rpx;
  663. background-repeat: no-repeat;
  664. }
  665. }
  666. .box1{
  667. &-top{
  668. &-status{
  669. padding: 10rpx 20rpx;
  670. background: url('https://oss.familydaf.cn/sxsnfile/20251218/5b591d1c173943dca6e33f950714e5e2.png') no-repeat;
  671. background-size: 100% 100%;
  672. font-family: PingFang-SC, PingFang-SC;
  673. font-weight: bold;
  674. font-size: 24rpx;
  675. color: #151B29;
  676. line-height: 33rpx;
  677. &.end{
  678. background: linear-gradient( 270deg, #FD8A8A 0%, #FE6161 100%);
  679. border-radius: 16px 4px 16px 4px;
  680. color: #FFFFFF;
  681. }
  682. }
  683. &-title{
  684. font-family: PingFang-SC, PingFang-SC;
  685. font-weight: bold;
  686. font-size: 36rpx;
  687. color: #151B29;
  688. line-height: 54rpx;
  689. margin-left: 10rpx;
  690. }
  691. }
  692. &-line{
  693. width: 100%;
  694. height: 1rpx;
  695. background: #E7E7E7;
  696. }
  697. &-place{
  698. &-left{
  699. width: calc(100% - 228rpx);
  700. text{
  701. font-family: PingFangSC, PingFang SC;
  702. font-weight: 400;
  703. font-size: 24rpx;
  704. color: #989998;
  705. line-height: 26rpx;
  706. }
  707. .addr{
  708. width: 100%;
  709. font-family: PingFang-SC, PingFang-SC;
  710. font-weight: bold;
  711. font-size: 26rpx;
  712. color: #151B29;
  713. line-height: 26rpx;
  714. margin-top: 24rpx;
  715. }
  716. }
  717. &-right{
  718. width: 188rpx;
  719. height: 115rpx;
  720. image{
  721. width: 100%;
  722. height: 100%;
  723. }
  724. }
  725. }
  726. &-member{
  727. margin-top: 37rpx;
  728. &-left{
  729. &>text{
  730. font-family: PingFangSC, PingFang SC;
  731. font-weight: 400;
  732. font-size: 24rpx;
  733. color: #989998;
  734. line-height: 26rpx;
  735. }
  736. .num{
  737. font-family: PingFang-SC, PingFang-SC;
  738. font-weight: bold;
  739. font-size: 26rpx;
  740. color: #676775;
  741. line-height: 48rpx;
  742. margin-top: 25rpx;
  743. text{
  744. font-size: 36rpx;
  745. color: #151B29;
  746. }
  747. }
  748. }
  749. &-right{
  750. .review{
  751. text{
  752. font-family: PingFangSC, PingFang SC;
  753. font-weight: 400;
  754. font-size: 24rpx;
  755. color: #989998;
  756. line-height: 26rpx;
  757. }
  758. image{
  759. width: 28rpx;
  760. height: 28rpx;
  761. margin-left: 8rpx;
  762. }
  763. }
  764. .avatars{
  765. margin-top: 27rpx;
  766. display: flex;
  767. justify-content: flex-end;
  768. }
  769. }
  770. }
  771. &-time{
  772. margin-top: 30rpx;
  773. text{
  774. font-family: PingFangSC, PingFang SC;
  775. font-weight: 400;
  776. font-size: 24rpx;
  777. color: #989998;
  778. line-height: 26rpx;
  779. }
  780. .text{
  781. font-family: PingFang-SC, PingFang-SC;
  782. font-weight: bold;
  783. font-size: 26rpx;
  784. color: #151B29;
  785. line-height: 26rpx;
  786. margin-top: 24rpx;
  787. }
  788. }
  789. &-need{
  790. margin-top: 30rpx;
  791. position: relative;
  792. &>text{
  793. font-family: PingFangSC, PingFang SC;
  794. font-weight: 400;
  795. font-size: 24rpx;
  796. color: #989998;
  797. line-height: 26rpx;
  798. }
  799. .text{
  800. margin-top: 30rpx;
  801. font-family: PingFangSC, PingFang SC;
  802. font-weight: 400;
  803. font-size: 24rpx;
  804. color: #676775;
  805. line-height: 26rpx;
  806. text{
  807. font-weight: bold;
  808. font-size: 36rpx;
  809. color: #151B29;
  810. &.mf{
  811. font-size: 26rpx;
  812. }
  813. }
  814. }
  815. .tip{
  816. font-family: PingFangSC, PingFang SC;
  817. font-weight: 400;
  818. font-size: 24rpx;
  819. color: #C9A771;
  820. line-height: 26rpx;
  821. margin-top: 20rpx;
  822. }
  823. &-level{
  824. position: absolute;
  825. left: 50%;
  826. padding-left: 25rpx;
  827. &-title{
  828. font-family: PingFangSC, PingFang SC;
  829. font-weight: 400;
  830. font-size: 24rpx;
  831. color: #989998;
  832. line-height: 26rpx;
  833. }
  834. &-num{
  835. margin-top: 30rpx;
  836. font-family: PingFangSC, PingFang SC;
  837. font-weight: bold;
  838. font-size: 36rpx;
  839. color: #151B29;
  840. line-height: 26rpx;
  841. &.bxz{
  842. font-size: 26rpx;
  843. }
  844. }
  845. }
  846. }
  847. &-info{
  848. margin-top: 30rpx;
  849. &-pre{
  850. width: 50%;
  851. &.line{
  852. border-left: 1rpx solid #E7E7E7;
  853. padding-left: 24rpx;
  854. box-sizing: border-box;
  855. }
  856. &>text{
  857. font-family: PingFangSC, PingFang SC;
  858. font-weight: 400;
  859. font-size: 24rpx;
  860. color: #989998;
  861. line-height: 26rpx;
  862. }
  863. .text{
  864. font-family: PingFang-SC, PingFang-SC;
  865. font-weight: bold;
  866. font-size: 26rpx;
  867. color: #151B29;
  868. line-height: 26rpx;
  869. margin-top: 24rpx;
  870. }
  871. .hour{
  872. margin-top: 24rpx;
  873. font-family: PingFangSC, PingFang SC;
  874. font-weight: 400;
  875. font-size: 24rpx;
  876. color: #676775;
  877. line-height: 26rpx;
  878. text{
  879. font-weight: bold;
  880. font-size: 36rpx;
  881. color: #151B29;
  882. }
  883. }
  884. }
  885. }
  886. }
  887. .box2{
  888. &-detail{
  889. margin-top: 40rpx;
  890. }
  891. }
  892. .bottom{
  893. width: 100%;
  894. height: 256rpx;
  895. background: #FFFFFF;
  896. box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(178,178,178,0.1);
  897. position: fixed;
  898. left: 0;
  899. right: 0;
  900. bottom: 0;
  901. padding: 30rpx 24rpx 0;
  902. box-sizing: border-box;
  903. .time{
  904. padding: 19rpx 24rpx 12rpx;
  905. background: #F8F8F9;
  906. border-radius: 32rpx;
  907. font-family: PingFangSC, PingFang SC;
  908. font-weight: 400;
  909. font-size: 24rpx;
  910. color: #4B545C;
  911. line-height: 33rpx;
  912. }
  913. .btns{
  914. margin-top: 24rpx;
  915. .left{
  916. margin-left: 30rpx;
  917. text{
  918. font-family: PingFangSC, PingFang SC;
  919. font-weight: 400;
  920. font-size: 26rpx;
  921. color: #151B29;
  922. line-height: 26rpx;
  923. margin-top: 17rpx;
  924. }
  925. }
  926. .right{
  927. width: 540rpx;
  928. height: 90rpx;
  929. background: #B7F358;
  930. border-radius: 45rpx;
  931. font-family: PingFang-SC, PingFang-SC;
  932. font-weight: bold;
  933. font-size: 32rpx;
  934. color: #151B29;
  935. line-height: 90rpx;
  936. text-align: center;
  937. letter-spacing: 2rpx;
  938. &.end{
  939. background: #F7F7F7;
  940. }
  941. }
  942. }
  943. }
  944. .fail{
  945. position: fixed;
  946. left: 0;
  947. right: 0;
  948. top: 0;
  949. bottom: 0;
  950. background: rgba(0,0,0,0.4);
  951. display: flex;
  952. flex-direction: column;
  953. justify-content: flex-end;
  954. .fbox{
  955. background: #FFFFFF;
  956. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/f168e863e60b423588821f8aa0388e27.png');
  957. background-repeat: no-repeat;
  958. background-position: top left;
  959. background-size: 100% 399rpx;
  960. border-radius: 24rpx 24rpx 0 0;
  961. position: relative;
  962. padding: 40rpx 30rpx 123rpx;
  963. .clock{
  964. width: 219rpx;
  965. height: 143rpx;
  966. position: absolute;
  967. left: 51rpx;
  968. top: -37rpx;
  969. }
  970. .close{
  971. width: 40rpx;
  972. height: 40rpx;
  973. position: absolute;
  974. top: 40rpx;
  975. right: 36rpx;
  976. }
  977. .alert{
  978. width: 212rpx;
  979. }
  980. .texts{
  981. width: 100%;
  982. margin-top: 69rpx;
  983. background: #FFFFFF;
  984. border-radius: 24rpx;
  985. border: 1rpx dotted #979797;
  986. padding: 36rpx 0;
  987. .text{
  988. font-family: PingFang-SC, PingFang-SC;
  989. font-weight: bold;
  990. font-size: 36rpx;
  991. color: #252525;
  992. line-height: 36rpx;
  993. }
  994. .tip{
  995. font-family: PingFangSC, PingFang SC;
  996. font-weight: 400;
  997. font-size: 24rpx;
  998. color: #676775;
  999. line-height: 26rpx;
  1000. margin-top: 24rpx;
  1001. }
  1002. }
  1003. .down{
  1004. width: 514rpx;
  1005. height: 34rpx;
  1006. margin-top: 20rpx;
  1007. }
  1008. .user{
  1009. width: 100%;
  1010. margin-top: 50rpx;
  1011. box-sizing: border-box;
  1012. font-family: PingFang-SC, PingFang-SC;
  1013. font-weight: bold;
  1014. font-size: 32rpx;
  1015. color: #252525;
  1016. line-height: 32rpx;
  1017. }
  1018. .finfo{
  1019. width: 100%;
  1020. margin-top: 36rpx;
  1021. &-code{
  1022. width: 310rpx;
  1023. height: 310rpx;
  1024. background: #FFFFFF;
  1025. border: 3rpx solid #C5E3FE;
  1026. image{
  1027. width: 244rpx;
  1028. height: 244rpx;
  1029. }
  1030. }
  1031. &-title{
  1032. margin-top: 24rpx;
  1033. font-size: 28rpx;
  1034. color: #252525;
  1035. line-height: 40rpx;
  1036. }
  1037. &-tip{
  1038. margin-top: 10rpx;
  1039. font-size: 24rpx;
  1040. color: #656775;
  1041. line-height: 40rpx;
  1042. }
  1043. &-btn{
  1044. width: calc(100% - 20rpx);
  1045. height: 90rpx;
  1046. background: #B7F358;
  1047. border-radius: 45rpx;
  1048. font-family: PingFang-SC, PingFang-SC;
  1049. font-weight: bold;
  1050. font-size: 32rpx;
  1051. color: #151B29;
  1052. line-height: 90rpx;
  1053. text-align: center;
  1054. margin-top: 48rpx;
  1055. }
  1056. &-zblj{
  1057. font-family: PingFangSC, PingFang SC;
  1058. font-weight: 400;
  1059. font-size: 28rpx;
  1060. color: #989998;
  1061. line-height: 40rpx;
  1062. margin-top: 48rpx;
  1063. padding-bottom: 5rpx;
  1064. border-bottom: 1rpx solid #989998;
  1065. }
  1066. }
  1067. }
  1068. }
  1069. .share{
  1070. position: fixed;
  1071. left: 0;
  1072. right: 0;
  1073. top: 0;
  1074. bottom: 0;
  1075. z-index: 1000;
  1076. background: rgba(0,0,0,0.4);
  1077. display: flex;
  1078. flex-direction: column;
  1079. justify-content: flex-end;
  1080. .sbox{
  1081. position: relative;
  1082. background: #FFFFFF;
  1083. border-radius: 24rpx 24rpx 0rpx 0rpx;
  1084. padding: 50rpx 30rpx 148rpx;
  1085. &-title{
  1086. font-family: PingFang-SC, PingFang-SC;
  1087. font-weight: bold;
  1088. font-size: 36rpx;
  1089. color: #151B29;
  1090. line-height: 36rpx;
  1091. text-align: center;
  1092. }
  1093. .close{
  1094. width: 27rpx;
  1095. height: 27rpx;
  1096. position: absolute;
  1097. top: 50rpx;
  1098. right: 40rpx;
  1099. }
  1100. &-items{
  1101. margin-top: 88rpx;
  1102. &-pre{
  1103. width: calc(100% / 3);
  1104. image{
  1105. width: 94rpx;
  1106. height: 94rpx;
  1107. }
  1108. text{
  1109. font-family: PingFangSC, PingFang SC;
  1110. font-weight: 400;
  1111. font-size: 26rpx;
  1112. color: #252525;
  1113. line-height: 26rpx;
  1114. text-align: center;
  1115. margin-top: 24rpx;
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. .posterbox{
  1122. position: fixed;
  1123. left: 0;
  1124. right: 0;
  1125. top: 0;
  1126. bottom: 0;
  1127. z-index: 1001;
  1128. background: rgba(0,0,0,0.7);
  1129. .posterbox-card{
  1130. width: calc(100% - 220rpx);
  1131. .poster-image {
  1132. width: 100%;
  1133. border-radius: 8px; // 给生成的图片也加个圆角,更美观
  1134. }
  1135. }
  1136. &-menu{
  1137. width: 100%;
  1138. margin-top: 239rpx;
  1139. &-pre{
  1140. width: 25%;
  1141. image{
  1142. width: 103rpx;
  1143. height: 104rpx;
  1144. }
  1145. text{
  1146. font-family: PingFangSC, PingFang SC;
  1147. font-weight: 400;
  1148. font-size: 24rpx;
  1149. color: rgba(255,255,255,0.6);
  1150. line-height: 33rpx;
  1151. margin-top: 32rpx;
  1152. }
  1153. }
  1154. }
  1155. &-close{
  1156. margin-top: 58rpx;
  1157. image{
  1158. width: 64rpx;
  1159. height: 64rpx;
  1160. }
  1161. }
  1162. }
  1163. }
  1164. </style>