activityDetail.vue 41 KB

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