activityDetail.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  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 .indicator__dot{
  600. width: 48rpx;
  601. height: 4rpx;
  602. background: #E2E5E9;
  603. border-radius: 2rpx;
  604. margin: 0 8rpx;
  605. }
  606. ::v-deep .indicator__dot--active{
  607. width: 48rpx;
  608. height: 4rpx;
  609. background: #00AE57;
  610. border-radius: 2rpx;
  611. }
  612. ::v-deep .u-swiper__wrapper__item__wrapper__image{
  613. border-radius: 24rpx !important;
  614. }
  615. ::v-deep .u-read-more__toggle{
  616. margin: 20rpx 0 0 0 !important;
  617. }
  618. /* 按钮分享样式 */
  619. .share-btn {
  620. background-color: transparent;
  621. border: none;
  622. padding: 0;
  623. margin: 0;
  624. line-height: 1;
  625. display: flex;
  626. flex-direction: column;
  627. justify-content: center;
  628. align-items: center;
  629. &::after {
  630. border: none;
  631. }
  632. }
  633. .common_page{
  634. padding-bottom: 276rpx;
  635. .lunbo{
  636. width: 100%;
  637. height: 440rpx;
  638. margin-top: 20rpx;
  639. position: relative;
  640. }
  641. .box{
  642. background: linear-gradient(45deg,#FFFFFF 70%,#F2FFE8 100%);
  643. border-radius: 24rpx;
  644. padding: 36rpx 24rpx 30rpx;
  645. margin-top: 20rpx;
  646. position: relative;
  647. &-title{
  648. width: 170rpx;
  649. height: 44rpx;
  650. padding-left: 2rpx;
  651. font-family: PingFang-SC, PingFang-SC;
  652. font-weight: 800;
  653. font-size: 36rpx;
  654. color: #151B29;
  655. line-height: 36rpx;
  656. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/6198fa26a7ff4fc1bce530fbdfaa20db.png');
  657. background-size: 170rpx 31rpx;
  658. background-position: 0 20rpx;
  659. background-repeat: no-repeat;
  660. }
  661. }
  662. .box1{
  663. &-top{
  664. &-status{
  665. padding: 10rpx 20rpx;
  666. background: url('https://oss.familydaf.cn/sxsnfile/20251218/5b591d1c173943dca6e33f950714e5e2.png') no-repeat;
  667. background-size: 100% 100%;
  668. font-family: PingFang-SC, PingFang-SC;
  669. font-weight: bold;
  670. font-size: 24rpx;
  671. color: #151B29;
  672. line-height: 33rpx;
  673. &.end{
  674. background: linear-gradient( 270deg, #FD8A8A 0%, #FE6161 100%);
  675. border-radius: 16px 4px 16px 4px;
  676. color: #FFFFFF;
  677. }
  678. }
  679. &-title{
  680. font-family: PingFang-SC, PingFang-SC;
  681. font-weight: bold;
  682. font-size: 36rpx;
  683. color: #151B29;
  684. line-height: 54rpx;
  685. margin-left: 10rpx;
  686. }
  687. }
  688. &-line{
  689. width: 100%;
  690. height: 1rpx;
  691. background: #E7E7E7;
  692. }
  693. &-place{
  694. &-left{
  695. width: calc(100% - 228rpx);
  696. text{
  697. font-family: PingFangSC, PingFang SC;
  698. font-weight: 400;
  699. font-size: 24rpx;
  700. color: #989998;
  701. line-height: 26rpx;
  702. }
  703. .addr{
  704. width: 100%;
  705. font-family: PingFang-SC, PingFang-SC;
  706. font-weight: bold;
  707. font-size: 26rpx;
  708. color: #151B29;
  709. line-height: 26rpx;
  710. margin-top: 24rpx;
  711. }
  712. }
  713. &-right{
  714. width: 188rpx;
  715. height: 115rpx;
  716. image{
  717. width: 100%;
  718. height: 100%;
  719. }
  720. }
  721. }
  722. &-member{
  723. margin-top: 37rpx;
  724. &-left{
  725. &>text{
  726. font-family: PingFangSC, PingFang SC;
  727. font-weight: 400;
  728. font-size: 24rpx;
  729. color: #989998;
  730. line-height: 26rpx;
  731. }
  732. .num{
  733. font-family: PingFang-SC, PingFang-SC;
  734. font-weight: bold;
  735. font-size: 26rpx;
  736. color: #676775;
  737. line-height: 48rpx;
  738. margin-top: 25rpx;
  739. text{
  740. font-size: 36rpx;
  741. color: #151B29;
  742. }
  743. }
  744. }
  745. &-right{
  746. .review{
  747. text{
  748. font-family: PingFangSC, PingFang SC;
  749. font-weight: 400;
  750. font-size: 24rpx;
  751. color: #989998;
  752. line-height: 26rpx;
  753. }
  754. image{
  755. width: 28rpx;
  756. height: 28rpx;
  757. margin-left: 8rpx;
  758. }
  759. }
  760. .avatars{
  761. margin-top: 27rpx;
  762. display: flex;
  763. justify-content: flex-end;
  764. }
  765. }
  766. }
  767. &-time{
  768. margin-top: 30rpx;
  769. text{
  770. font-family: PingFangSC, PingFang SC;
  771. font-weight: 400;
  772. font-size: 24rpx;
  773. color: #989998;
  774. line-height: 26rpx;
  775. }
  776. .text{
  777. font-family: PingFang-SC, PingFang-SC;
  778. font-weight: bold;
  779. font-size: 26rpx;
  780. color: #151B29;
  781. line-height: 26rpx;
  782. margin-top: 24rpx;
  783. }
  784. }
  785. &-need{
  786. margin-top: 30rpx;
  787. position: relative;
  788. &>text{
  789. font-family: PingFangSC, PingFang SC;
  790. font-weight: 400;
  791. font-size: 24rpx;
  792. color: #989998;
  793. line-height: 26rpx;
  794. }
  795. .text{
  796. margin-top: 30rpx;
  797. font-family: PingFangSC, PingFang SC;
  798. font-weight: 400;
  799. font-size: 24rpx;
  800. color: #676775;
  801. line-height: 26rpx;
  802. text{
  803. font-weight: bold;
  804. font-size: 36rpx;
  805. color: #151B29;
  806. &.mf{
  807. font-size: 26rpx;
  808. }
  809. }
  810. }
  811. .tip{
  812. font-family: PingFangSC, PingFang SC;
  813. font-weight: 400;
  814. font-size: 24rpx;
  815. color: #C9A771;
  816. line-height: 26rpx;
  817. margin-top: 20rpx;
  818. }
  819. &-level{
  820. position: absolute;
  821. left: 50%;
  822. padding-left: 25rpx;
  823. &-title{
  824. font-family: PingFangSC, PingFang SC;
  825. font-weight: 400;
  826. font-size: 24rpx;
  827. color: #989998;
  828. line-height: 26rpx;
  829. }
  830. &-num{
  831. margin-top: 30rpx;
  832. font-family: PingFangSC, PingFang SC;
  833. font-weight: bold;
  834. font-size: 36rpx;
  835. color: #151B29;
  836. line-height: 26rpx;
  837. &.bxz{
  838. font-size: 26rpx;
  839. }
  840. }
  841. }
  842. }
  843. &-info{
  844. margin-top: 30rpx;
  845. &-pre{
  846. width: 50%;
  847. &.line{
  848. border-left: 1rpx solid #E7E7E7;
  849. padding-left: 24rpx;
  850. box-sizing: border-box;
  851. }
  852. &>text{
  853. font-family: PingFangSC, PingFang SC;
  854. font-weight: 400;
  855. font-size: 24rpx;
  856. color: #989998;
  857. line-height: 26rpx;
  858. }
  859. .text{
  860. font-family: PingFang-SC, PingFang-SC;
  861. font-weight: bold;
  862. font-size: 26rpx;
  863. color: #151B29;
  864. line-height: 26rpx;
  865. margin-top: 24rpx;
  866. }
  867. .hour{
  868. margin-top: 24rpx;
  869. font-family: PingFangSC, PingFang SC;
  870. font-weight: 400;
  871. font-size: 24rpx;
  872. color: #676775;
  873. line-height: 26rpx;
  874. text{
  875. font-weight: bold;
  876. font-size: 36rpx;
  877. color: #151B29;
  878. }
  879. }
  880. }
  881. }
  882. }
  883. .box2{
  884. &-detail{
  885. margin-top: 40rpx;
  886. }
  887. }
  888. .bottom{
  889. width: 100%;
  890. height: 256rpx;
  891. background: #FFFFFF;
  892. box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(178,178,178,0.1);
  893. position: fixed;
  894. left: 0;
  895. right: 0;
  896. bottom: 0;
  897. padding: 30rpx 24rpx 0;
  898. box-sizing: border-box;
  899. .time{
  900. padding: 19rpx 24rpx 12rpx;
  901. background: #F8F8F9;
  902. border-radius: 32rpx;
  903. font-family: PingFangSC, PingFang SC;
  904. font-weight: 400;
  905. font-size: 24rpx;
  906. color: #4B545C;
  907. line-height: 33rpx;
  908. }
  909. .btns{
  910. margin-top: 24rpx;
  911. .left{
  912. margin-left: 30rpx;
  913. text{
  914. font-family: PingFangSC, PingFang SC;
  915. font-weight: 400;
  916. font-size: 26rpx;
  917. color: #151B29;
  918. line-height: 26rpx;
  919. margin-top: 17rpx;
  920. }
  921. }
  922. .right{
  923. width: 540rpx;
  924. height: 90rpx;
  925. background: #B7F358;
  926. border-radius: 45rpx;
  927. font-family: PingFang-SC, PingFang-SC;
  928. font-weight: bold;
  929. font-size: 32rpx;
  930. color: #151B29;
  931. line-height: 90rpx;
  932. text-align: center;
  933. letter-spacing: 2rpx;
  934. &.end{
  935. background: #F7F7F7;
  936. }
  937. }
  938. }
  939. }
  940. .fail{
  941. position: fixed;
  942. left: 0;
  943. right: 0;
  944. top: 0;
  945. bottom: 0;
  946. background: rgba(0,0,0,0.4);
  947. display: flex;
  948. flex-direction: column;
  949. justify-content: flex-end;
  950. .fbox{
  951. background: #FFFFFF;
  952. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/f168e863e60b423588821f8aa0388e27.png');
  953. background-repeat: no-repeat;
  954. background-position: top left;
  955. background-size: 100% 399rpx;
  956. border-radius: 24rpx 24rpx 0 0;
  957. position: relative;
  958. padding: 40rpx 30rpx 123rpx;
  959. .clock{
  960. width: 219rpx;
  961. height: 143rpx;
  962. position: absolute;
  963. left: 51rpx;
  964. top: -37rpx;
  965. }
  966. .close{
  967. width: 40rpx;
  968. height: 40rpx;
  969. position: absolute;
  970. top: 40rpx;
  971. right: 36rpx;
  972. }
  973. .alert{
  974. width: 212rpx;
  975. }
  976. .texts{
  977. width: 100%;
  978. margin-top: 69rpx;
  979. background: #FFFFFF;
  980. border-radius: 24rpx;
  981. border: 1rpx dotted #979797;
  982. padding: 36rpx 0;
  983. .text{
  984. font-family: PingFang-SC, PingFang-SC;
  985. font-weight: bold;
  986. font-size: 36rpx;
  987. color: #252525;
  988. line-height: 36rpx;
  989. }
  990. .tip{
  991. font-family: PingFangSC, PingFang SC;
  992. font-weight: 400;
  993. font-size: 24rpx;
  994. color: #676775;
  995. line-height: 26rpx;
  996. margin-top: 24rpx;
  997. }
  998. }
  999. .down{
  1000. width: 514rpx;
  1001. height: 34rpx;
  1002. margin-top: 20rpx;
  1003. }
  1004. .user{
  1005. width: 100%;
  1006. margin-top: 50rpx;
  1007. box-sizing: border-box;
  1008. font-family: PingFang-SC, PingFang-SC;
  1009. font-weight: bold;
  1010. font-size: 32rpx;
  1011. color: #252525;
  1012. line-height: 32rpx;
  1013. }
  1014. .finfo{
  1015. width: 100%;
  1016. margin-top: 36rpx;
  1017. &-code{
  1018. width: 310rpx;
  1019. height: 310rpx;
  1020. background: #FFFFFF;
  1021. border: 3rpx solid #C5E3FE;
  1022. image{
  1023. width: 244rpx;
  1024. height: 244rpx;
  1025. }
  1026. }
  1027. &-title{
  1028. margin-top: 24rpx;
  1029. font-size: 28rpx;
  1030. color: #252525;
  1031. line-height: 40rpx;
  1032. }
  1033. &-tip{
  1034. margin-top: 10rpx;
  1035. font-size: 24rpx;
  1036. color: #656775;
  1037. line-height: 40rpx;
  1038. }
  1039. &-btn{
  1040. width: calc(100% - 20rpx);
  1041. height: 90rpx;
  1042. background: #B7F358;
  1043. border-radius: 45rpx;
  1044. font-family: PingFang-SC, PingFang-SC;
  1045. font-weight: bold;
  1046. font-size: 32rpx;
  1047. color: #151B29;
  1048. line-height: 90rpx;
  1049. text-align: center;
  1050. margin-top: 48rpx;
  1051. }
  1052. &-zblj{
  1053. font-family: PingFangSC, PingFang SC;
  1054. font-weight: 400;
  1055. font-size: 28rpx;
  1056. color: #989998;
  1057. line-height: 40rpx;
  1058. margin-top: 48rpx;
  1059. padding-bottom: 5rpx;
  1060. border-bottom: 1rpx solid #989998;
  1061. }
  1062. }
  1063. }
  1064. }
  1065. .share{
  1066. position: fixed;
  1067. left: 0;
  1068. right: 0;
  1069. top: 0;
  1070. bottom: 0;
  1071. z-index: 1000;
  1072. background: rgba(0,0,0,0.4);
  1073. display: flex;
  1074. flex-direction: column;
  1075. justify-content: flex-end;
  1076. .sbox{
  1077. position: relative;
  1078. background: #FFFFFF;
  1079. border-radius: 24rpx 24rpx 0rpx 0rpx;
  1080. padding: 50rpx 30rpx 148rpx;
  1081. &-title{
  1082. font-family: PingFang-SC, PingFang-SC;
  1083. font-weight: bold;
  1084. font-size: 36rpx;
  1085. color: #151B29;
  1086. line-height: 36rpx;
  1087. text-align: center;
  1088. }
  1089. .close{
  1090. width: 27rpx;
  1091. height: 27rpx;
  1092. position: absolute;
  1093. top: 50rpx;
  1094. right: 40rpx;
  1095. }
  1096. &-items{
  1097. margin-top: 88rpx;
  1098. &-pre{
  1099. width: calc(100% / 3);
  1100. image{
  1101. width: 94rpx;
  1102. height: 94rpx;
  1103. }
  1104. text{
  1105. font-family: PingFangSC, PingFang SC;
  1106. font-weight: 400;
  1107. font-size: 26rpx;
  1108. color: #252525;
  1109. line-height: 26rpx;
  1110. text-align: center;
  1111. margin-top: 24rpx;
  1112. }
  1113. }
  1114. }
  1115. }
  1116. }
  1117. .posterbox{
  1118. position: fixed;
  1119. left: 0;
  1120. right: 0;
  1121. top: 0;
  1122. bottom: 0;
  1123. z-index: 1001;
  1124. background: rgba(0,0,0,0.7);
  1125. .posterbox-card{
  1126. width: calc(100% - 220rpx);
  1127. .poster-image {
  1128. width: 100%;
  1129. border-radius: 8px; // 给生成的图片也加个圆角,更美观
  1130. }
  1131. }
  1132. &-menu{
  1133. width: 100%;
  1134. margin-top: 239rpx;
  1135. &-pre{
  1136. width: 25%;
  1137. image{
  1138. width: 103rpx;
  1139. height: 104rpx;
  1140. }
  1141. text{
  1142. font-family: PingFangSC, PingFang SC;
  1143. font-weight: 400;
  1144. font-size: 24rpx;
  1145. color: rgba(255,255,255,0.6);
  1146. line-height: 33rpx;
  1147. margin-top: 32rpx;
  1148. }
  1149. }
  1150. }
  1151. &-close{
  1152. margin-top: 58rpx;
  1153. image{
  1154. width: 64rpx;
  1155. height: 64rpx;
  1156. }
  1157. }
  1158. }
  1159. }
  1160. </style>