activityDetail.vue 38 KB

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