activityDetail.vue 41 KB

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