activityDetail.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310
  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. // 更新海报数据
  600. posterData.title = activityInfo.value?.activityName || posterData.title;
  601. posterData.time = `${new Date(activityInfo.value?.activityStartTime).Format('MM.dd-hh:mm') } ~ ${new Date(activityInfo.value?.activityEndTime).Format('MM.dd-hh:mm')}` || posterData.time;
  602. posterData.address = `${activityInfo.value?.provinceName||''}${activityInfo.value?.cityName||''}${activityInfo.value?.address||''}` || posterData.address;
  603. posterData.organizer = activityInfo.value?.channelName || posterData.organizer;
  604. if(activityInfo.value?.coverFile) posterData.mainImg = activityInfo.value?.coverFile;
  605. if(activityInfo.value.signupState==0
  606. &&activityInfo.value.activeState===1
  607. &&activityInfo.value.recruitmentNow==(activityInfo.value.recruitmentMax||99999)){
  608. activityInfo.value.activeState = 4;//已报满暂无活动名额
  609. }
  610. imgList.value = activityInfo.value?.imageFiles&&(activityInfo.value?.imageFiles.split(',')||[])
  611. for(let i=0;i<activityInfo.value.recruitmentNow;i++){
  612. avatars.value.push('https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png')
  613. }
  614. })
  615. }
  616. watch(()=>userStore.token,(newVal,oldVal)=>{
  617. if(oldVal!=newVal&&newVal){
  618. setTimeout(()=>{
  619. uni.showToast({
  620. title: '登录成功',
  621. icon: 'success'
  622. });
  623. },200)
  624. nextTick(()=>{
  625. getActivityDetail(id.value)
  626. })
  627. }
  628. })
  629. onLoad(options=>{
  630. id.value = options?.id||options?.shareADId||'';
  631. if(!uni.getStorageSync('token')||!uni.getStorageSync('expaireTime')||(Date.parse(new Date())>(uni.getStorageSync('expaireTime')||0))){
  632. uni.showModal({
  633. title:'温馨提示',
  634. content:'您当前登录已失效或未登录过,是否立即登录?',
  635. success: (res) => {
  636. if(res.confirm){
  637. userStore.openLoginModal()
  638. }else if(res.cancel){
  639. uni.showModal({
  640. title:'温馨提示',
  641. content:'您已取消登录,当前活动详情页面不可查看',
  642. showCancel:false,
  643. confirmText:'返回首页',
  644. success: (res) => {
  645. if(res.confirm){
  646. uni.reLaunch({
  647. url:'/pages/home'
  648. })
  649. }
  650. }
  651. })
  652. }
  653. }
  654. })
  655. return
  656. }
  657. if(id.value) {
  658. getActivityDetail(id.value)
  659. }
  660. })
  661. </script>
  662. <style scoped lang="scss">
  663. ::v-deep .u-navbar>view{
  664. background: url('https://oss.familydaf.cn/sxsnfile/20251223/d07237024c5e4f00a63b9089abbf5a3c.png') no-repeat;
  665. background-size: 100% 100%;
  666. }
  667. ::v-deep .indicator__dot{
  668. width: 48rpx;
  669. height: 4rpx;
  670. background: #E2E5E9;
  671. border-radius: 2rpx;
  672. margin: 0 8rpx;
  673. }
  674. ::v-deep .indicator__dot--active{
  675. width: 48rpx;
  676. height: 4rpx;
  677. background: #00AE57;
  678. border-radius: 2rpx;
  679. }
  680. ::v-deep .u-swiper__wrapper__item__wrapper__image{
  681. border-radius: 24rpx !important;
  682. }
  683. ::v-deep .u-read-more__toggle{
  684. margin: 20rpx 0 0 0 !important;
  685. }
  686. /* 按钮分享样式 */
  687. .share-btn {
  688. background-color: transparent;
  689. border: none;
  690. padding: 0;
  691. margin: 0;
  692. line-height: 1;
  693. display: flex;
  694. flex-direction: column;
  695. justify-content: center;
  696. align-items: center;
  697. &::after {
  698. border: none;
  699. }
  700. }
  701. .common_page{
  702. padding-bottom: 276rpx;
  703. .lunbo{
  704. width: 100%;
  705. height: 440rpx;
  706. margin-top: 20rpx;
  707. position: relative;
  708. }
  709. .box{
  710. background: linear-gradient(45deg,#FFFFFF 70%,#F2FFE8 100%);
  711. border-radius: 24rpx;
  712. padding: 36rpx 24rpx 30rpx;
  713. margin-top: 20rpx;
  714. position: relative;
  715. &-title{
  716. width: 170rpx;
  717. height: 44rpx;
  718. padding-left: 2rpx;
  719. font-family: PingFang-SC, PingFang-SC;
  720. font-weight: 800;
  721. font-size: 36rpx;
  722. color: #151B29;
  723. line-height: 36rpx;
  724. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/6198fa26a7ff4fc1bce530fbdfaa20db.png');
  725. background-size: 170rpx 31rpx;
  726. background-position: 0 20rpx;
  727. background-repeat: no-repeat;
  728. }
  729. }
  730. .box1{
  731. &-top{
  732. &-status{
  733. padding: 10rpx 20rpx;
  734. background: url('https://oss.familydaf.cn/sxsnfile/20251218/5b591d1c173943dca6e33f950714e5e2.png') no-repeat;
  735. background-size: 100% 100%;
  736. font-family: PingFang-SC, PingFang-SC;
  737. font-weight: bold;
  738. font-size: 24rpx;
  739. color: #151B29;
  740. line-height: 33rpx;
  741. &.end{
  742. background: linear-gradient( 270deg, #FD8A8A 0%, #FE6161 100%);
  743. border-radius: 16px 4px 16px 4px;
  744. color: #FFFFFF;
  745. }
  746. }
  747. &-title{
  748. font-family: PingFang-SC, PingFang-SC;
  749. font-weight: bold;
  750. font-size: 36rpx;
  751. color: #151B29;
  752. line-height: 54rpx;
  753. margin-left: 10rpx;
  754. }
  755. }
  756. &-line{
  757. width: 100%;
  758. height: 1rpx;
  759. background: #E7E7E7;
  760. }
  761. &-place{
  762. &-left{
  763. width: calc(100% - 228rpx);
  764. text{
  765. font-family: PingFangSC, PingFang SC;
  766. font-weight: 400;
  767. font-size: 24rpx;
  768. color: #989998;
  769. line-height: 26rpx;
  770. }
  771. .addr{
  772. width: 100%;
  773. font-family: PingFang-SC, PingFang-SC;
  774. font-weight: bold;
  775. font-size: 26rpx;
  776. color: #151B29;
  777. line-height: 26rpx;
  778. margin-top: 24rpx;
  779. }
  780. }
  781. &-right{
  782. width: 188rpx;
  783. height: 115rpx;
  784. image{
  785. width: 100%;
  786. height: 100%;
  787. }
  788. }
  789. }
  790. &-member{
  791. margin-top: 37rpx;
  792. &-left{
  793. &>text{
  794. font-family: PingFangSC, PingFang SC;
  795. font-weight: 400;
  796. font-size: 24rpx;
  797. color: #989998;
  798. line-height: 26rpx;
  799. }
  800. .num{
  801. font-family: PingFang-SC, PingFang-SC;
  802. font-weight: bold;
  803. font-size: 26rpx;
  804. color: #676775;
  805. line-height: 48rpx;
  806. margin-top: 25rpx;
  807. text{
  808. font-size: 36rpx;
  809. color: #151B29;
  810. }
  811. }
  812. }
  813. &-right{
  814. .review{
  815. text{
  816. font-family: PingFangSC, PingFang SC;
  817. font-weight: 400;
  818. font-size: 24rpx;
  819. color: #989998;
  820. line-height: 26rpx;
  821. }
  822. image{
  823. width: 28rpx;
  824. height: 28rpx;
  825. margin-left: 8rpx;
  826. }
  827. }
  828. .avatars{
  829. margin-top: 27rpx;
  830. display: flex;
  831. justify-content: flex-end;
  832. }
  833. }
  834. }
  835. &-time{
  836. margin-top: 30rpx;
  837. text{
  838. font-family: PingFangSC, PingFang SC;
  839. font-weight: 400;
  840. font-size: 24rpx;
  841. color: #989998;
  842. line-height: 26rpx;
  843. }
  844. .text{
  845. font-family: PingFang-SC, PingFang-SC;
  846. font-weight: bold;
  847. font-size: 26rpx;
  848. color: #151B29;
  849. line-height: 26rpx;
  850. margin-top: 24rpx;
  851. }
  852. }
  853. &-need{
  854. margin-top: 30rpx;
  855. position: relative;
  856. &>text{
  857. font-family: PingFangSC, PingFang SC;
  858. font-weight: 400;
  859. font-size: 24rpx;
  860. color: #989998;
  861. line-height: 26rpx;
  862. }
  863. .text{
  864. margin-top: 30rpx;
  865. font-family: PingFangSC, PingFang SC;
  866. font-weight: 400;
  867. font-size: 24rpx;
  868. color: #676775;
  869. line-height: 26rpx;
  870. text{
  871. font-weight: bold;
  872. font-size: 36rpx;
  873. color: #151B29;
  874. &.mf{
  875. font-size: 26rpx;
  876. }
  877. }
  878. }
  879. .tip{
  880. font-family: PingFangSC, PingFang SC;
  881. font-weight: 400;
  882. font-size: 24rpx;
  883. color: #C9A771;
  884. line-height: 26rpx;
  885. margin-top: 20rpx;
  886. }
  887. &-level{
  888. position: absolute;
  889. left: 50%;
  890. padding-left: 25rpx;
  891. &-title{
  892. font-family: PingFangSC, PingFang SC;
  893. font-weight: 400;
  894. font-size: 24rpx;
  895. color: #989998;
  896. line-height: 26rpx;
  897. }
  898. &-num{
  899. margin-top: 30rpx;
  900. font-family: PingFangSC, PingFang SC;
  901. font-weight: bold;
  902. font-size: 36rpx;
  903. color: #151B29;
  904. line-height: 26rpx;
  905. &.bxz{
  906. font-size: 26rpx;
  907. }
  908. }
  909. }
  910. }
  911. &-info{
  912. margin-top: 30rpx;
  913. &-pre{
  914. width: 50%;
  915. &.line{
  916. border-left: 1rpx solid #E7E7E7;
  917. padding-left: 24rpx;
  918. box-sizing: border-box;
  919. }
  920. &>text{
  921. font-family: PingFangSC, PingFang SC;
  922. font-weight: 400;
  923. font-size: 24rpx;
  924. color: #989998;
  925. line-height: 26rpx;
  926. }
  927. .text{
  928. font-family: PingFang-SC, PingFang-SC;
  929. font-weight: bold;
  930. font-size: 26rpx;
  931. color: #151B29;
  932. line-height: 26rpx;
  933. margin-top: 24rpx;
  934. }
  935. .hour{
  936. margin-top: 24rpx;
  937. font-family: PingFangSC, PingFang SC;
  938. font-weight: 400;
  939. font-size: 24rpx;
  940. color: #676775;
  941. line-height: 26rpx;
  942. text{
  943. font-weight: bold;
  944. font-size: 36rpx;
  945. color: #151B29;
  946. }
  947. }
  948. }
  949. }
  950. }
  951. .box2{
  952. &-detail{
  953. margin-top: 40rpx;
  954. ::v-deep p {
  955. text-indent: 0 !important; // 移除首行缩进
  956. // margin-bottom: 1em; // 可以按需调整段落间距
  957. }
  958. }
  959. }
  960. .bottom{
  961. width: 100%;
  962. height: 256rpx;
  963. background: #FFFFFF;
  964. box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(178,178,178,0.1);
  965. position: fixed;
  966. left: 0;
  967. right: 0;
  968. bottom: 0;
  969. padding: 30rpx 24rpx 0;
  970. box-sizing: border-box;
  971. .time{
  972. padding: 19rpx 24rpx 12rpx;
  973. background: #F8F8F9;
  974. border-radius: 32rpx;
  975. font-family: PingFangSC, PingFang SC;
  976. font-weight: 400;
  977. font-size: 24rpx;
  978. color: #4B545C;
  979. line-height: 33rpx;
  980. }
  981. .btns{
  982. margin-top: 24rpx;
  983. .left{
  984. margin-left: 30rpx;
  985. text{
  986. font-family: PingFangSC, PingFang SC;
  987. font-weight: 400;
  988. font-size: 26rpx;
  989. color: #151B29;
  990. line-height: 26rpx;
  991. margin-top: 17rpx;
  992. }
  993. }
  994. .right{
  995. width: 540rpx;
  996. height: 90rpx;
  997. background: #B7F358;
  998. border-radius: 45rpx;
  999. font-family: PingFang-SC, PingFang-SC;
  1000. font-weight: bold;
  1001. font-size: 32rpx;
  1002. color: #151B29;
  1003. line-height: 90rpx;
  1004. text-align: center;
  1005. letter-spacing: 2rpx;
  1006. &.end{
  1007. background: #F7F7F7;
  1008. }
  1009. }
  1010. }
  1011. }
  1012. .fail{
  1013. position: fixed;
  1014. left: 0;
  1015. right: 0;
  1016. top: 0;
  1017. bottom: 0;
  1018. background: rgba(0,0,0,0.4);
  1019. display: flex;
  1020. flex-direction: column;
  1021. justify-content: flex-end;
  1022. .fbox{
  1023. background: #FFFFFF;
  1024. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/f168e863e60b423588821f8aa0388e27.png');
  1025. background-repeat: no-repeat;
  1026. background-position: top left;
  1027. background-size: 100% 399rpx;
  1028. border-radius: 24rpx 24rpx 0 0;
  1029. position: relative;
  1030. padding: 40rpx 30rpx 123rpx;
  1031. .clock{
  1032. width: 219rpx;
  1033. height: 143rpx;
  1034. position: absolute;
  1035. left: 51rpx;
  1036. top: -37rpx;
  1037. }
  1038. .close{
  1039. width: 40rpx;
  1040. height: 40rpx;
  1041. position: absolute;
  1042. top: 40rpx;
  1043. right: 36rpx;
  1044. }
  1045. .alert{
  1046. width: 212rpx;
  1047. }
  1048. .texts{
  1049. width: 100%;
  1050. margin-top: 69rpx;
  1051. background: #FFFFFF;
  1052. border-radius: 24rpx;
  1053. border: 1rpx dotted #979797;
  1054. padding: 36rpx 0;
  1055. .text{
  1056. font-family: PingFang-SC, PingFang-SC;
  1057. font-weight: bold;
  1058. font-size: 36rpx;
  1059. color: #252525;
  1060. line-height: 36rpx;
  1061. }
  1062. .tip{
  1063. font-family: PingFangSC, PingFang SC;
  1064. font-weight: 400;
  1065. font-size: 24rpx;
  1066. color: #676775;
  1067. line-height: 26rpx;
  1068. margin-top: 24rpx;
  1069. }
  1070. }
  1071. .down{
  1072. width: 514rpx;
  1073. height: 34rpx;
  1074. margin-top: 20rpx;
  1075. }
  1076. .user{
  1077. width: 100%;
  1078. margin-top: 50rpx;
  1079. box-sizing: border-box;
  1080. font-family: PingFang-SC, PingFang-SC;
  1081. font-weight: bold;
  1082. font-size: 32rpx;
  1083. color: #252525;
  1084. line-height: 32rpx;
  1085. }
  1086. .finfo{
  1087. width: 100%;
  1088. margin-top: 36rpx;
  1089. &-code{
  1090. width: 310rpx;
  1091. height: 310rpx;
  1092. background: #FFFFFF;
  1093. border: 3rpx solid #C5E3FE;
  1094. image{
  1095. width: 244rpx;
  1096. height: 244rpx;
  1097. }
  1098. }
  1099. &-title{
  1100. margin-top: 24rpx;
  1101. font-size: 28rpx;
  1102. color: #252525;
  1103. line-height: 40rpx;
  1104. }
  1105. &-tip{
  1106. margin-top: 10rpx;
  1107. font-size: 24rpx;
  1108. color: #656775;
  1109. line-height: 40rpx;
  1110. }
  1111. &-btn{
  1112. width: calc(100% - 20rpx);
  1113. height: 90rpx;
  1114. background: #B7F358;
  1115. border-radius: 45rpx;
  1116. font-family: PingFang-SC, PingFang-SC;
  1117. font-weight: bold;
  1118. font-size: 32rpx;
  1119. color: #151B29;
  1120. line-height: 90rpx;
  1121. text-align: center;
  1122. margin-top: 48rpx;
  1123. }
  1124. &-zblj{
  1125. font-family: PingFangSC, PingFang SC;
  1126. font-weight: 400;
  1127. font-size: 28rpx;
  1128. color: #989998;
  1129. line-height: 40rpx;
  1130. margin-top: 48rpx;
  1131. padding-bottom: 5rpx;
  1132. border-bottom: 1rpx solid #989998;
  1133. }
  1134. }
  1135. }
  1136. }
  1137. .share{
  1138. position: fixed;
  1139. left: 0;
  1140. right: 0;
  1141. top: 0;
  1142. bottom: 0;
  1143. z-index: 1000;
  1144. background: rgba(0,0,0,0.4);
  1145. display: flex;
  1146. flex-direction: column;
  1147. justify-content: flex-end;
  1148. .sbox{
  1149. position: relative;
  1150. background: #FFFFFF;
  1151. border-radius: 24rpx 24rpx 0rpx 0rpx;
  1152. padding: 50rpx 30rpx 148rpx;
  1153. &-title{
  1154. font-family: PingFang-SC, PingFang-SC;
  1155. font-weight: bold;
  1156. font-size: 36rpx;
  1157. color: #151B29;
  1158. line-height: 36rpx;
  1159. text-align: center;
  1160. }
  1161. .close{
  1162. width: 27rpx;
  1163. height: 27rpx;
  1164. position: absolute;
  1165. top: 50rpx;
  1166. right: 40rpx;
  1167. }
  1168. &-items{
  1169. margin-top: 88rpx;
  1170. &-pre{
  1171. width: calc(100% / 3);
  1172. image{
  1173. width: 94rpx;
  1174. height: 94rpx;
  1175. }
  1176. text{
  1177. font-family: PingFangSC, PingFang SC;
  1178. font-weight: 400;
  1179. font-size: 26rpx;
  1180. color: #252525;
  1181. line-height: 26rpx;
  1182. text-align: center;
  1183. margin-top: 24rpx;
  1184. }
  1185. }
  1186. }
  1187. }
  1188. }
  1189. .posterbox{
  1190. position: fixed;
  1191. left: 0;
  1192. right: 0;
  1193. top: 0;
  1194. bottom: 0;
  1195. z-index: 1001;
  1196. background: rgba(0,0,0,0.7);
  1197. .posterbox-card{
  1198. width: calc(100% - 220rpx);
  1199. .poster-image {
  1200. width: 100%;
  1201. border-radius: 8px; // 给生成的图片也加个圆角,更美观
  1202. }
  1203. }
  1204. &-menu{
  1205. width: 100%;
  1206. margin-top: 239rpx;
  1207. &-pre{
  1208. width: 25%;
  1209. image{
  1210. width: 103rpx;
  1211. height: 104rpx;
  1212. }
  1213. text{
  1214. font-family: PingFangSC, PingFang SC;
  1215. font-weight: 400;
  1216. font-size: 24rpx;
  1217. color: rgba(255,255,255,0.6);
  1218. line-height: 33rpx;
  1219. margin-top: 32rpx;
  1220. }
  1221. }
  1222. }
  1223. &-close{
  1224. margin-top: 58rpx;
  1225. image{
  1226. width: 64rpx;
  1227. height: 64rpx;
  1228. }
  1229. }
  1230. }
  1231. }
  1232. </style>