activityDetail.vue 39 KB

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