activityDetail.vue 41 KB

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