activityDetail.vue 39 KB

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