my-popup.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <template>
  2. <uni-popup ref="popup" :mask-click="false" maskBackgroundColor="rgba(0, 0, 0, 0.6)">
  3. <swiper ref="swiper" class="swiper" :style="getSwiperStyle()" :current="swiperCurrent"
  4. @change="swiperChange" :indicator-dots="dataList.length > 1" indicator-active-color="rgba(46, 133, 236, 1)"
  5. :autoplay="false" :interval="5000">
  6. <swiper-item v-for="(item, index) in dataList" :key="index">
  7. <!-- 标题 + 图片 + 活动时间 + 活动简介 -->
  8. <view v-if="item.type == 1" class="swiper-item-view uni-column">
  9. <text class="swiper-item-title" v-html="item.data.title"></text>
  10. <view class="swiper-item-main uni-column uni-jcse">
  11. <image mode="aspectFit" class="swiper-item-image" :src="item.data.img"></image>
  12. <view class="swiper-item-time uni-row">
  13. <image mode="aspectFit" class="clock" src="/static/default/clock.png"></image>
  14. <text class="acttime">{{acttime}}</text>
  15. </view>
  16. <view class="swiper-item-content uni-column">
  17. <text class="introduce-content" v-html="item.data.content"></text>
  18. </view>
  19. </view>
  20. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  21. 续</button>
  22. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  23. </view>
  24. <!-- 标题 + 图片 -->
  25. <view v-if="item.type == 2" class="swiper-item-view uni-column">
  26. <text class="swiper-item-title" v-html="item.data.title"></text>
  27. <view class="swiper-item-main uni-column">
  28. <image mode="aspectFit" :style="getImageStyle2(item.data.imgParam)"
  29. :src="item.data.img">
  30. </image>
  31. </view>
  32. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  33. 续</button>
  34. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  35. </view>
  36. <!-- 【成就-奖牌】 标题 + 图片 + 活动简介 -->
  37. <view v-if="item.type == 3" class="swiper-item-view swiper-item-view-bg uni-column">
  38. <text class="swiper-item-title" v-html="item.data.title"></text>
  39. <view class="swiper-item-main uni-column uni-jcse">
  40. <image mode="aspectFit" style="height: 140px; margin-top: 25px;" :src="item.data.img"></image>
  41. <text class="swiper-item-content2" v-html="item.data.content"></text>
  42. </view>
  43. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  44. 续</button>
  45. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  46. </view>
  47. <!-- 【成就-兑换】 标题 + 图片 + 二维码 -->
  48. <view v-if="item.type == 4" class="swiper-item-view swiper-item-view-bg2 uni-jct uni-column">
  49. <view v-if="item.data.sponsorsLogo" class="sponsorsLogo" :style="getSponsorsLogoStyle(item.data.sponsorsLogo)"></view>
  50. <text class="swiper-item-title" v-html="item.data.title"></text>
  51. <view class="swiper-item-main uni-column uni-jcse">
  52. <view class="uni-column uni-jcse" style="height: 50px;">
  53. <text class="swiper-item-content3" v-html="item.data.content"></text>
  54. <text class="swiper-item-content4">【{{item.data.sourceName}}】</text>
  55. </view>
  56. <image class="swiper-item-image2" mode="aspectFit" :src="item.data.img"></image>
  57. <template v-if="[1,3].includes(item.data.exState)">
  58. <!-- verfType: 兑换券展示类型 1 本系统核销 2 赞助商提供码核销 3 赞助商不提供码核销 -->
  59. <uv-qrcode v-if="item.data.verfType==1" ref="qrcode" size="100px" :value="item.data.qrCode">
  60. <!-- <template v-slot:loading>
  61. <text style="color: green;">loading...</text>
  62. </template> -->
  63. </uv-qrcode>
  64. <view v-if="item.data.verfType==2" class="swiper-item-couponNum">券码:{{item.data.otherSerCode}}</view>
  65. <view v-if="item.data.expireTime > 0" class="swiper-item-content4" style="color: #ED0000;">( 有效期至
  66. {{fmtTime(item.data.expireTime, 1)}}
  67. <span v-if="item.data.exState == 3" style="color: #ffaa00; font-size: bold;">已临期</span>
  68. )
  69. </view>
  70. <view v-if="item.data.cDesc.length > 0" class="swiper-item-desc" v-html="item.data.cDesc"></view>
  71. </template>
  72. <view v-if="item.data.exState == 2" class="uni-column uni-jcse" style="height: 100px;">
  73. <text style="color: red;">已兑换</text>
  74. <text class="swiper-item-content4">( 兑换时间 {{fmtTime(item.data.exTime, 3)}} )</text>
  75. </view>
  76. <view v-if="item.data.exState == 4" class="uni-column uni-jcse" style="height: 100px;">
  77. <text style="color: red;">已过期</text>
  78. <text v-if="item.data.expireTime > 0" class="swiper-item-content4">( 过期时间
  79. {{fmtTime(item.data.expireTime, 1)}} )</text>
  80. </view>
  81. </view>
  82. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  83. 续</button>
  84. <button v-else class="swiper-item-button" @click="popupClose">关 闭</button>
  85. </view>
  86. <!-- 【兑换地点 - 单点】标题 + 图片(点击图片打开地图APP进行地点定位) -->
  87. <view v-if="item.type == 5" class="swiper-item-view uni-column">
  88. <text class="swiper-item-title" v-html="item.data.title"></text>
  89. <view class="swiper-item-main uni-column">
  90. <image mode="aspectFit" style="height: 237px; margin-top: 15px; margin-bottom: 25px;"
  91. :src="item.data.img" @click="dealNavClick(item.data.point)">
  92. </image>
  93. </view>
  94. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  95. 续</button>
  96. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  97. </view>
  98. <!-- 通知 -->
  99. <view v-if="item.type == 6" class="swiper-item-view uni-column">
  100. <text class="swiper-item-title" v-html="item.data.title"></text>
  101. <view class="swiper-item-main uni-column uni-jcse">
  102. <!-- mqType 消息类型 2:卡片图片 3:卡片文字 -->
  103. <image v-if="item.data.mqType == 2" mode="aspectFit"
  104. style="height: 237px; margin-bottom: 25px;" :src="item.data.message">
  105. </image>
  106. <text v-if="item.data.mqType == 3" class="swiper-item-message"
  107. v-html="item.data.message"></text>
  108. </view>
  109. <button v-if="index < dataList.length - 1" class="swiper-item-button" style="width: 50%;" @click="swiperNext">继
  110. 续</button>
  111. <view v-else class="uni-row" style="width: 100%;">
  112. <button class="swiper-item-button" style="width: 50%;" @click="popupClose">确 定</button>
  113. <text class="swiper-item-noMoreReminders" @click="onNoMoreRemindersClick">不再提醒</text>
  114. </view>
  115. </view>
  116. <!-- 标题 + HTML内容 + 图片(可为空) -->
  117. <view v-if="item.type == 7" class="swiper-item-view uni-column">
  118. <image v-if="item.data.topLogo" class="swiper-item-topLogo"
  119. :style="getImageStyle(item.data.topLogo)" mode="aspectFit" :src="item.data.topLogo.src"></image>
  120. <text class="swiper-item-title" v-html="item.data.title"></text>
  121. <view class="swiper-item-main uni-column uni-jcse">
  122. <view class="swiper-item-content5">
  123. <view v-if="item.data.content" v-html="item.data.content"></view>
  124. <view class="uni-row uni-jcse" style="margin-top: 20px;">
  125. <image v-for="(item, index) in item.data.imageList" :key="index" mode="aspectFit"
  126. :style="getImageStyle(item)" :src="item.src"></image>
  127. </view>
  128. <view v-if="item.data.memo" style="padding-top: 10px;" v-html="item.data.memo"></view>
  129. </view>
  130. </view>
  131. <image v-if="item.data.bottomLogo" class="swiper-item-bottomLogo" mode="aspectFit"
  132. :style="getImageStyle(item.data.bottomLogo)" :src="item.data.bottomLogo.src"></image>
  133. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  134. 续</button>
  135. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  136. </view>
  137. <!-- 【兑换地点 - 多点】标题 + 头部图片 + 头部memo + 多点导航列表 + 底部memo -->
  138. <view v-if="item.type == 8" class="swiper-item-view uni-column">
  139. <text class="swiper-item-title" v-html="item.data.title"></text>
  140. <image v-if="item.data.topImg" class="" :style="getImageStyle(item.data.topImg)" mode="aspectFit" :src="item.data.topImg.src"></image>
  141. <view v-if="item.data.topMemo" v-html="item.data.topMemo"></view>
  142. <view class="swiper-item-main uni-column uni-jcse">
  143. <view class="swiper-item-content5">
  144. <view v-if="item.data.content" v-html="item.data.content"></view>
  145. <view class="uni-column uni-jcse" style="margin-top: 20px;">
  146. <view class="uni-row uni-jcsb" style="width: 96%; line-height: 30px;" v-for="(point, index) in item.data.pointList" :key="index">
  147. <view class="uni-row uni-jct" style="width: 80%;">
  148. <!-- <text v-if="point.map" class="nowrap" v-html="point.map + ':'"></text> -->
  149. <text v-if="point.name" class="nowrap" v-html="point.map ? (point.map + ':' + point.name) : point.name"></text>
  150. </view>
  151. <view class="uni-row uni-jcsa" style="width: 20%;" @click="dealNavClick(point)">
  152. <image mode="aspectFit" style="width: 10px; height: 15px;" src="/static/common/nav2.png"></image>
  153. <text class="" style="color: #E60012; font-size: 14px;" >导航</text>
  154. </view>
  155. </view>
  156. </view>
  157. <view v-if="item.data.bottomMemo" style="padding-top: 10px;" v-html="item.data.bottomMemo" @click="dealUrlClick(item.data.bottomMemoUrl)"></view>
  158. </view>
  159. </view>
  160. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  161. 续</button>
  162. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  163. </view>
  164. <!-- 警告 -->
  165. <view v-if="item.type == 9" class="swiper-item-view uni-column">
  166. <text class="swiper-item-title" v-html="item.data.title"></text>
  167. <view class="swiper-item-main uni-column uni-jct">
  168. <view class="uni-row">
  169. <image mode="aspectFit" style="width: 58px; height: 64px; margin: 5px 15px;" :src="item.data.iconUrl"></image>
  170. <text style="margin-right: 5px; font-size: 12px; margin-top: 40px;">x</text>
  171. <text style="font-size: 18px; margin-top: 40px;">{{item.data.iconNum}}</text>
  172. </view>
  173. <text class="swiper-item-warn" v-html="item.data.message"></text>
  174. <image mode="aspectFit" style="width: 100px; height: 100px;" :src="item.data.qrCodeUrl"></image>
  175. </view>
  176. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  177. 续</button>
  178. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  179. </view>
  180. </swiper-item>
  181. </swiper>
  182. </uni-popup>
  183. </template>
  184. <script>
  185. import tools from '/common/tools';
  186. // import {
  187. // teamName
  188. // } from '/common/define';
  189. export default {
  190. name: "my-popup",
  191. props: {
  192. dataList: [{}],
  193. acttime: "", // 活动时间
  194. teamType: {
  195. type: Number,
  196. default: -1
  197. },
  198. config: {
  199. type: Object,
  200. default: () => ({
  201. height: ""
  202. })
  203. }
  204. },
  205. emits: ['popup-close', 'noMoreRemindersClick'],
  206. data() {
  207. return {
  208. swiperCurrent: 0, // swiper当前所在滑块的 index
  209. isOpen: false,
  210. // item: {}
  211. };
  212. },
  213. methods: {
  214. getSwiperStyle() {
  215. let styleStr = "";
  216. if (this.config.height != undefined && this.config.height != "") {
  217. styleStr += `height: ${this.config.height};`;
  218. console.log("[getSwiperStyle] style:", styleStr);
  219. }
  220. return styleStr;
  221. },
  222. //当前轮播索引
  223. swiperChange(e) {
  224. const curIndex = e.detail.current;
  225. // console.log("swiperChange", curIndex, this.swiperCurrent);
  226. this.swiperCurrent = curIndex;
  227. },
  228. swiperNext() {
  229. this.swiperCurrent++;
  230. },
  231. popupOpen() {
  232. if (this.dataList.length == 0) {
  233. console.log("[popupOpen] dataList为空,禁止弹窗");
  234. return;
  235. }
  236. this.swiperCurrent = 0;
  237. this.$refs.popup.open();
  238. this.isOpen = true;
  239. },
  240. popupClose() {
  241. this.$refs.popup.close();
  242. this.isOpen = false;
  243. this.$emit('popup-close');
  244. },
  245. fmtTime(timestamp, type = 2) {
  246. return tools.timestampToTime(timestamp * 1000, type);
  247. },
  248. dealNavClick(navPoint) {
  249. const url =
  250. `action://to_map_app?title=${navPoint.name}&latitude=${navPoint.latitude}&longitude=${navPoint.longitude}`;
  251. // window.location.href = url;
  252. tools.appAction(url);
  253. },
  254. dealUrlClick(url) {
  255. if (url != undefined && url.length > 0) {
  256. tools.appAction(url);
  257. }
  258. },
  259. getImageStyle(item) {
  260. let styleStr = "";
  261. let width = "90px";
  262. let height = "90px";
  263. if (item != undefined && item.width != undefined) {
  264. width = item.width;
  265. }
  266. if (item != undefined && item.height != undefined) {
  267. height = item.height;
  268. }
  269. // const width = item.width ?? "90px";
  270. // const height = item.height ?? "90px";
  271. styleStr = `width: ${width}; height: ${height};`;
  272. return styleStr;
  273. },
  274. getImageStyle2(item) {
  275. let styleStr = "";
  276. let height = "237px";
  277. if (item != undefined && item.height != undefined) {
  278. height = item.height;
  279. }
  280. styleStr = `height: ${height}; margin-top: 15px; margin-bottom: 25px;`;
  281. return styleStr;
  282. },
  283. getSponsorsLogoStyle(bgurl) {
  284. return `background-image: url("${bgurl}")`;
  285. },
  286. onNoMoreRemindersClick() {
  287. this.$emit('noMoreRemindersClick');
  288. },
  289. // getTeamName(teamType, teamIndex) {
  290. // return teamName[teamType][teamIndex];
  291. // },
  292. // onItemClick(item) {
  293. // this.data.item = item
  294. // this.$emit('my-combo-list-click', this.data);
  295. // }
  296. }
  297. }
  298. </script>
  299. <style lang="scss" scoped>
  300. .swiper {
  301. width: 90vw;
  302. height: 439px;
  303. background-color: #FEFBF6;
  304. border-radius: 25px;
  305. }
  306. // ::v-deep uni-swiper-item {
  307. // overflow: auto;
  308. // }
  309. .swiper-item-view {
  310. height: 95%;
  311. padding-top: 25px;
  312. // justify-content: space-between;
  313. }
  314. .swiper-item-view-bg {
  315. background-image: url("/static/backgroud/top_colorbar.png"), url("/static/backgroud/oval.png");
  316. background-repeat: no-repeat;
  317. background-position-x: center;
  318. background-position-y: 75px, 190px;
  319. background-size: 80%, 70%;
  320. }
  321. .swiper-item-view-bg2 {
  322. // background-image: url("/static/backgroud/oval.png");
  323. // background-repeat: no-repeat;
  324. // background-position-x: center;
  325. // background-position-y: 198px;
  326. // background-size: 66%;
  327. }
  328. .swiper-item-topLogo {
  329. width: 100px;
  330. height: 100px;
  331. margin-bottom: 18px;
  332. }
  333. .swiper-item-bottomLogo {
  334. width: 100px;
  335. height: 100px;
  336. margin-bottom: 30px;
  337. }
  338. .swiper-item-title {
  339. margin-bottom: 10px;
  340. font-size: 20px;
  341. font-weight: 550;
  342. }
  343. .swiper-item-main {
  344. width: 100%;
  345. flex-grow: 1;
  346. }
  347. .swiper-item-image {
  348. height: 150px;
  349. }
  350. .swiper-item-image2 {
  351. height: 110px;
  352. // margin-top: 5px;
  353. }
  354. .swiper-item-time {
  355. height: 33px;
  356. margin-top: 10px;
  357. padding: 0 25px;
  358. justify-content: space-evenly;
  359. background-color: white;
  360. border: 0.5px solid;
  361. border-color: #e7e7e7;
  362. border-radius: 20px;
  363. box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.13);
  364. }
  365. .swiper-item-content {
  366. width: 80%;
  367. margin-top: 15px;
  368. margin-bottom: 30px;
  369. justify-content: start;
  370. flex-grow: 1;
  371. }
  372. .swiper-item-content2 {
  373. width: 80%;
  374. margin-top: 60px;
  375. margin-bottom: 10px;
  376. // justify-content: center;
  377. text-align: center;
  378. font-size: 14px;
  379. line-height: 40px;
  380. flex-grow: 1;
  381. }
  382. .swiper-item-content3 {
  383. width: 80%;
  384. // margin-top: 5px;
  385. text-align: center;
  386. }
  387. .swiper-item-content4 {
  388. // width: 80%;
  389. text-align: center;
  390. font-size: 12px;
  391. }
  392. .swiper-item-content5 {
  393. width: 80%;
  394. flex-grow: 1;
  395. font-size: 14px;
  396. line-height: 21px;
  397. overflow-y: scroll;
  398. }
  399. .swiper-item-couponNum {
  400. font-size: 16px;
  401. font-weight: 500;
  402. color: #383838;
  403. }
  404. .swiper-item-desc {
  405. width: 80%;
  406. font-size: 12px;
  407. font-weight: 400;
  408. color: #818181;
  409. }
  410. ::v-deep li {
  411. margin-bottom: 5px;
  412. }
  413. .swiper-item-message {
  414. width: 80%;
  415. margin-top: 10px;
  416. margin-bottom: 10px;
  417. // justify-content: center;
  418. text-align: left;
  419. font-size: 14px;
  420. line-height: 21px;
  421. flex-grow: 1;
  422. }
  423. .swiper-item-warn {
  424. width: 80%;
  425. margin-top: 10px;
  426. margin-bottom: 10px;
  427. // justify-content: center;
  428. text-align: left;
  429. font-size: 13px;
  430. line-height: 18px;
  431. // flex-grow: 1;
  432. }
  433. .swiper-item-button {
  434. width: 80%;
  435. height: 38px;
  436. margin-bottom: 25px;
  437. color: #ffffff;
  438. /* font-weight: bold; */
  439. line-height: 38px;
  440. background-color: #2e85ec;
  441. border-radius: 27px;
  442. }
  443. .swiper-item-button2 {
  444. width: 50%;
  445. height: 38px;
  446. margin-bottom: 25px;
  447. color: #ffffff;
  448. /* font-weight: bold; */
  449. line-height: 38px;
  450. background-color: #2e85ec;
  451. border-radius: 27px;
  452. }
  453. .swiper-item-noMoreReminders {
  454. position: absolute;
  455. right: 10px;
  456. width: 80px;
  457. font-size: 12px;
  458. margin-bottom: 25px;
  459. text-align: center;
  460. text-decoration: underline;
  461. }
  462. .acttime {
  463. font-weight: 550;
  464. color: #333333;
  465. font-size: 15px;
  466. }
  467. .clock {
  468. width: 15px;
  469. height: 15px;
  470. margin-right: 10px;
  471. }
  472. .introduce-content {
  473. color: #333333;
  474. font-size: 14px;
  475. line-height: 21px;
  476. flex-grow: 1;
  477. }
  478. .nowrap {
  479. white-space: nowrap;
  480. overflow: hidden;
  481. text-overflow: ellipsis;
  482. }
  483. .sponsorsLogo {
  484. position: absolute;
  485. width: 120px;
  486. // width: 75px;
  487. height: 75px;
  488. left: 18px;
  489. top: 8px;
  490. background-position-x: left;
  491. background-position-y: center;
  492. background-repeat: no-repeat;
  493. background-size: contain;
  494. // background-size: 100% auto;
  495. }
  496. ::v-deep .uni-swiper-dots-horizontal {
  497. bottom: 75px;
  498. }
  499. // ::v-deep .uni-swiper-dot-active {
  500. // background: #ff870e !important;
  501. // }
  502. </style>