invitationUser.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  1. <template>
  2. <view class="content">
  3. <view class="margin-lr-sm margin-top padding" style="background: #FFFFFF;border-radius: 20upx;">
  4. <view class="flex align-center" style="position: relative;">
  5. <!-- <image :src="avatar?avatar:'../../static/image/logo.png'"
  6. style="width: 72upx;height: 72upx;border-radius: 12upx;"></image> -->
  7. <view class="margin-left-sm">
  8. <view class="text-sm" style="color: #fe6b01;"><text class="text-bold"
  9. style="font-size: 60upx;">{{peopleNum?peopleNum:'0'}}</text>人</view>
  10. <view style="color: #999999;">已成功邀请人数</view>
  11. </view>
  12. <view style="color: #999999;position:absolute;right:0rpx;top:0rpx;" @click="bindTo('/my/invite/reward')">邀请奖励</view>
  13. </view>
  14. </view>
  15. <!-- v-bind:style="{backgroundImage: 'url('+backgroundImage+')'}" -->
  16. <view class="view1" v-if="globalImages" v-bind:style="{backgroundImage: `url(${globalImages}images/logo.jpg)`}">
  17. <!-- <view style="padding-top: 1100upx;" @longpress="logoTime(avatar)">
  18. <view style="width: 100%;height: 150upx;display: flex;background: #FFFFFF;padding: 20upx 10upx;">
  19. <image :src="avatar?avatar:'../../static/image/logo.png'"
  20. style="border-radius: 100upx;width: 100upx;height: 100upx;margin-left: 30upx;"></image>
  21. <view class="login-view-text1" style="margin-left: 30upx;width: 59%;">
  22. <view style="color: #000000;font-size: 16px;">{{ nickName }}</view>
  23. <view style="color: #000000; font-size: 12px;margin-top: 20upx;">邀请码:{{invitationCode}}</view>
  24. </view>
  25. <canvas canvas-id="qrcode" style="width: 140upx;height: 130upx;" />
  26. </view>
  27. </view> -->
  28. </view>
  29. <view style="display: flex;flex-direction: row; padding: 40upx;justify-content: center;">
  30. <!-- #ifdef H5 -->
  31. <button @click="share()" type="default"
  32. style="background-color: #FFCB49;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 50%;">文案推广</button>
  33. <button @tap="showModal()" type="default"
  34. style="background-color: #FF5808;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 50%; margin-left: 40upx;">生成海报</button>
  35. <!-- #endif -->
  36. <!-- #ifdef APP-PLUS -->
  37. <button v-if="isShowWxAPPShare=='是'" @click="shareWeiXin()" type="default"
  38. style="background-color: #FFCB49;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 50%;">文案推广</button>
  39. <button v-if="isShowWxAPPShare=='否'" @click="sharAPPUrl()" type="default"
  40. style="background-color: #FFCB49;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 50%;">文案推广</button>
  41. <button @tap="showModal()" type="default"
  42. style="background-color: #FF5808;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 50%; margin-left: 40upx;">生成海报</button>
  43. <!-- #endif -->
  44. <!-- #ifdef MP-WEIXIN -->
  45. <button open-type="share"
  46. style="background-color: #fff;font-size: 16px;width: 40%;">一键分享</button>
  47. <!-- <button @click="share()" type="default" style="background-color: #FFCB49;font-size: 16px;font-weight: bold;color: #FFFFFF; width: 40%;">文案推广</button> -->
  48. <button @tap="onSaveImg()" type="default"
  49. style="background-color: #fe6b01;font-size: 16px;color: #FFFFFF; width: 40%;">生成海报</button>
  50. <!-- #endif -->
  51. <!-- 生成海报 -->
  52. <!-- 图片展示由自己实现 -->
  53. <view class="flex_row_c_c modalView" :class="qrShow?'show':''" @tap="hideQr()">
  54. <view class="flex_column">
  55. <view class="backgroundColor-white padding1vh border_radius_10px">
  56. <image :src="poster.finalPath || ''" mode="widthFix" class="posterImage"></image>
  57. </view>
  58. <view class="flex_row marginTop2vh">
  59. <!-- #ifdef H5 -->
  60. <button type="primary" size="mini">长按上方图片保存</button>
  61. <!-- #endif -->
  62. <!-- #ifndef H5 -->
  63. <button type="primary" size="mini" @tap.prevent.stop="saveImage()">保存图片</button>
  64. <!-- #endif -->
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 画布 -->
  69. <view class="hideCanvasView">
  70. <canvas class="hideCanvas" canvas-id="default_PosterCanvasId"
  71. :style="{width: (poster.width||10) + 'px', height: (poster.height||10) + 'px'}"></canvas>
  72. </view>
  73. </view>
  74. <!-- #ifndef MP-WEIXIN -->
  75. <tki-qrcode ref="qrcode" :val="url" :size="200" background="#fff" foreground="#000" pdground="#000"
  76. :onval="true" :loadMake="true" @result="qrR" :show="false"></tki-qrcode>
  77. <view class="cu-modal" :class="modalName == 'Image' ? 'show' : ''" @tap="hideModal">
  78. <view class="cu-dialog" v-if="backgroundImage && erweimapath && haibaoShow" @tap="hideModal">
  79. <view class="bg-img">
  80. <wm-poster @success="posterSuccess" :imgSrc="backgroundImage" :Referrer="'我的邀请码:'+invitationCode"
  81. :QrSrc="erweimapath" :Title="tuiguang" :LineType="false"></wm-poster>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- #endif -->
  86. <!-- #ifdef MP-WEIXIN -->
  87. <view @tap="hideModal" :class="modalName == 'Image' ? 'show' : ''" class="modal"
  88. style="text-align: center;display: flex;justify-content: center;">
  89. <view style="width:100%;margin: auto;">
  90. <image :src="h5SaveImg" mode="widthFix" style="width: 90%;"></image>
  91. </view>
  92. </view>
  93. <canvas canvas-id="poster" class="poster_canvas"></canvas>
  94. <!-- #endif -->
  95. </view>
  96. </template>
  97. <script>
  98. let settingWritePhotosAlbum = false;
  99. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
  100. import appShare from '@/utils/share.js';
  101. import wmPoster from '@/components/wm-poster/wm-posterorders.vue';
  102. import uQRCode from "../../js_sdk/Sansnn-uQRCode/uqrcode.js"
  103. import _app from '../../js_sdk/QuShe-SharerPoster/QS-SharePoster/app.js';
  104. import configdata from '../../common/config.js';
  105. // import {
  106. // getSharePoster
  107. // } from '../../js_sdk/QuShe-SharerPoster/QS-SharePoster/QS-SharePoster.js';
  108. export default {
  109. components: {
  110. tkiQrcode,
  111. wmPoster,
  112. // getSharePoster
  113. },
  114. data() {
  115. return {
  116. erweimapath: '',
  117. poster: {},
  118. qrShow: false,
  119. haibaoImg: null,
  120. haibaoShow: false,
  121. modalName: '',
  122. canvasId: 'default_PosterCanvasId',
  123. imageUrl: '',
  124. userImageUrl: '',
  125. isShowWxAPPShare: '否',
  126. nickName: '',
  127. invitationCode: '',
  128. backgroundImage: '',
  129. tuiguang: '',
  130. tuiguang1: '',
  131. url: '',
  132. peopleNum: '',
  133. appurl: '',
  134. avatar: ''
  135. };
  136. },
  137. onLoad() {
  138. this.getBackImageList();
  139. this.getYaoNum()
  140. this.avatar = this.$queue.getData('image_url');
  141. // if (!avatar) {
  142. // this.userImageUrl = avatar
  143. // } else {
  144. // this.userImageUrl = '../../static/image/logo.png';
  145. // }
  146. this.$Request.getT('/app/common/type/276').then(res => {
  147. if (res.code === 0) {
  148. this.tuiguang = res.data.value;
  149. }
  150. });
  151. this.$Request.getT('/app/common/type/277').then(res => {
  152. if (res.code === 0) {
  153. this.tuiguangImg = res.data.value;
  154. }
  155. });
  156. //文案推广
  157. // this.$Request.getT('/app/common/type/101').then(res => {
  158. // if (res.code === 0) {
  159. // if (res.data && res.data.value) {
  160. // this.tuiguang1 = res.data.value;
  161. // }
  162. // }
  163. // });
  164. //检测书否开启APP微信分享
  165. this.$Request.getT('/app/common/type/136').then(res => {
  166. if (res.code === 0) {
  167. if (res.data && res.data.value) {
  168. this.isShowWxAPPShare = res.data.value;
  169. }
  170. }
  171. });
  172. this.invitationCode = this.$queue.getData('invitationCode');
  173. //#ifndef H5
  174. this.$Request.getT('/app/common/type/25').then(res => {
  175. if (res.code === 0) {
  176. if (res.data && res.data.value) {
  177. this.url = res.data.value+ '?invitation=' + this
  178. .invitationCode;
  179. }
  180. }
  181. });
  182. //#endif
  183. //#ifdef H5
  184. this.$Request.getT('/app/common/type/25').then(ress => {
  185. if (ress.code === 0) {
  186. if (ress.data && ress.data.value) {
  187. this.url = ress.data.value+ '/?invitation=' + this
  188. .invitationCode;
  189. }
  190. } else {
  191. this.url = this.$queue.publicYuMing() + 'pageA/applogin/userphone?invitation=' + this
  192. .invitationCode;
  193. }
  194. });
  195. //#endif
  196. let userName = this.$queue.getData('nickName');
  197. if (userName && userName !== 'undefined') {
  198. this.nickName = userName;
  199. } else {
  200. this.nickName = '游客';
  201. }
  202. },
  203. onShareAppMessage(res) {
  204. return {
  205. path: '/pages/index/index?invitation=' + this.invitationCode, //这是为了传参 onload(data){let id=data.id;}
  206. title: this.tuiguang,
  207. imageUrl: this.tuiguangImg
  208. }
  209. },
  210. /*
  211. * uniapp微信小程序分享页面到微信朋友圈
  212. */
  213. onShareTimeline(res) {
  214. return {
  215. path: '/pages/index/index?invitation=' + this.invitationCode, //这是为了传参 onload(data){let id=data.id;}
  216. title: this.tuiguang,
  217. imageUrl: this.tuiguangImg
  218. }
  219. },
  220. methods: {
  221. bindTo(name) {
  222. let token = this.$queue.getData("token");
  223. if (token) {
  224. uni.navigateTo({
  225. url: name
  226. })
  227. }
  228. },
  229. //获取我邀请的人数
  230. getYaoNum() {
  231. this.$Request.getT('/app/user/queryInviterCount', {}).then(res => {
  232. if (res.code === 0) {
  233. this.peopleNum = res.data
  234. }
  235. });
  236. },
  237. posterSuccess(haibaoImg) {
  238. this.haibaoImg = haibaoImg;
  239. this.modalName = 'Image';
  240. },
  241. showModal() {
  242. console.log(this.url)
  243. if (!this.haibaoImg) {
  244. this.haibaoShow = true;
  245. this.$queue.showLoading('海报生成中...');
  246. } else {
  247. this.modalName = 'Image';
  248. }
  249. },
  250. hideModal() {
  251. this.modalName = null;
  252. },
  253. qrR(path) {
  254. this.erweimapath = path;
  255. },
  256. getBackImageList() {
  257. this.$Request.getT('/app/banner/selectBannerList?state=-1&classify=5').then(res => {
  258. if (res.code === 0) {
  259. this.backgroundImage = res.data[0].imageUrl;
  260. }
  261. });
  262. this.make();
  263. },
  264. make() {
  265. uQRCode.make({
  266. canvasId: 'default_PosterCanvasId',
  267. componentInstance: this,
  268. text: this.url,
  269. size: 68,
  270. margin: 4,
  271. backgroundColor: '#ffffff',
  272. foregroundColor: '#000000',
  273. fileType: 'jpg',
  274. correctLevel: uQRCode.errorCorrectLevel.H,
  275. success: res => {
  276. console.log(res)
  277. }
  278. })
  279. },
  280. shareWeiXin() {
  281. // this.$Request.getT('/app/common/type/103').then(res => {
  282. // console.log(res,'11111')
  283. // if (res.code === 0) {
  284. // console.log(res,'0000000000')
  285. // if (res.data && res.data.value) {
  286. let relationId = this.invitationCode;
  287. let shareData = {
  288. shareUrl: this.url + '?relationId=' + relationId,
  289. // shareUrl: this.$queue.publicYuMing() + '/pagesA/applogin/userphone',
  290. shareTitle: this.tuiguang,
  291. shareContent: '邀请码:' + relationId + ',' + this.tuiguang,
  292. shareImg: this.$queue.publicYuMing() + '/logo.png',
  293. type: 0
  294. };
  295. appShare(shareData, res => {
  296. console.log('分享成功回调', res);
  297. });
  298. // }
  299. // }
  300. // });
  301. },
  302. share() {
  303. this.sharurl();
  304. },
  305. sharAPPUrl() {
  306. let that = this;
  307. let relationId = this.invitationCode;
  308. uni.showModal({
  309. title: '文案推广',
  310. // content: this.tuiguang1 + relationId + '\n' + this.url,
  311. content: this.url,
  312. showCancel: true,
  313. cancelText: '关闭',
  314. confirmText: '一键复制',
  315. success: res => {
  316. if (res.confirm) {
  317. uni.setClipboardData({
  318. // data: this.tuiguang1 + relationId + '\n' + this.url,
  319. data: this.url,
  320. success: function() {
  321. console.log('success');
  322. that.$queue.showToast('文案复制成功');
  323. }
  324. });
  325. }
  326. }
  327. });
  328. },
  329. sharurl() {
  330. let that = this;
  331. // this.$queue.showLoading('加载中...');
  332. let relationId = this.invitationCode;
  333. uni.showModal({
  334. title: '文案推广',
  335. // content: this.tuiguang1 + relationId + '\n' + this.url,
  336. content: this.url,
  337. showCancel: true,
  338. cancelText: '关闭',
  339. confirmText: '一键复制',
  340. success: res => {
  341. if (res.confirm) {
  342. uni.setClipboardData({
  343. // data: this.tuiguang1 + relationId + '\n' + this.url,
  344. data: this.url,
  345. success: function() {
  346. console.log('success');
  347. that.$queue.showToast('复制成功');
  348. }
  349. });
  350. }
  351. }
  352. });
  353. },
  354. logoTime(urlList) {
  355. uni.previewImage({
  356. current: 0,
  357. urls: urlList,
  358. loop: true,
  359. longPressActions: {
  360. itemList: ['收藏'],
  361. itemColor: "#007AFF"
  362. }
  363. })
  364. },
  365. goList() {
  366. let userId = this.$queue.getData('userId');
  367. this.$Request.getT('/app/invite/selectInviteAndPoster?userId=' + userId).then(res => {
  368. if (res.code === 0) {
  369. // if (res.data.user.imageUrl) {
  370. // this.userImageUrl = res.data.user.imageUrl;
  371. // } else {
  372. // this.userImageUrl = '/static/img/common/logo.jpg';
  373. // }
  374. if (res.data.user.nickName) {
  375. this.nickName = res.data.user.nickName;
  376. } else {
  377. this.nickName = res.data.user.phone;
  378. }
  379. this.invitationCode = res.data.user.invitationCode;
  380. this.imageUrl = res.data.url;
  381. }
  382. });
  383. },
  384. async shareFc() {
  385. let _this = this;
  386. try {
  387. const d = await getSharePoster({
  388. type: 'testShareType',
  389. backgroundImage: _this.backgroundImage,
  390. posterCanvasId: _this.canvasId, //canvasId
  391. delayTimeScale: 20, //延时系数
  392. drawArray: ({
  393. bgObj,
  394. type,
  395. bgScale
  396. }) => {
  397. const dx = bgObj.width * 0.3;
  398. const fontSize = bgObj.width * 0.045;
  399. const lineHeight = bgObj.height * 0.04;
  400. //可直接return数组,也可以return一个promise对象, 但最终resolve一个数组, 这样就可以方便实现后台可控绘制海报
  401. return new Promise((rs, rj) => {
  402. rs([{
  403. type: 'custom',
  404. setDraw(Context) {
  405. Context.setFillStyle('black');
  406. Context.setGlobalAlpha(0.3);
  407. Context.fillRect(0, bgObj.height - bgObj
  408. .height * 0.2, bgObj.width, bgObj
  409. .height * 0.2);
  410. Context.setGlobalAlpha(1);
  411. }
  412. },
  413. {
  414. type: 'text',
  415. fontStyle: 'italic',
  416. text: '邀请码:' + _this.invitationCode,
  417. size: fontSize,
  418. color: 'white',
  419. alpha: 1,
  420. textAlign: 'left',
  421. textBaseline: 'middle',
  422. infoCallBack(textLength) {
  423. return {
  424. dx: bgObj.width - textLength - fontSize,
  425. dy: bgObj.height - lineHeight * 3
  426. }
  427. },
  428. serialNum: 0,
  429. id: 'tag1' //自定义标识
  430. },
  431. {
  432. type: 'qrcode',
  433. text: _this.url,
  434. size: bgObj.width * 0.2,
  435. dx: bgObj.width * 0.05,
  436. dy: bgObj.height - bgObj.width * 0.25
  437. }
  438. ]);
  439. })
  440. },
  441. setCanvasWH: ({
  442. bgObj,
  443. type,
  444. bgScale
  445. }) => { // 为动态设置画布宽高的方法,
  446. _this.poster = bgObj;
  447. }
  448. });
  449. //_app.log('海报生成成功, 时间:' + new Date() + ', 临时路径: ' + d.poster.tempFilePath)
  450. _this.poster.finalPath = d.poster.tempFilePath;
  451. _this.qrShow = true;
  452. } catch (e) {
  453. _app.hideLoading();
  454. }
  455. },
  456. saveImage() {
  457. uni.saveImageToPhotosAlbum({
  458. filePath: this.poster.finalPath,
  459. success(res) {
  460. _app.showToast('保存成功');
  461. }
  462. })
  463. },
  464. hideQr() {
  465. this.qrShow = false;
  466. },
  467. // 微信小程序保存图片
  468. async onSaveImg() {
  469. // #ifdef MP-WEIXIN
  470. let imgUrl = await this.createPoster();
  471. uni.showLoading({
  472. title: '海报下载中'
  473. });
  474. if (settingWritePhotosAlbum) {
  475. uni.getSetting({
  476. success: res => {
  477. if (res.authSetting['scope.writePhotosAlbum']) {
  478. uni.saveImageToPhotosAlbum({
  479. filePath: imgUrl,
  480. success: () => {
  481. uni.hideLoading();
  482. uni.showToast({
  483. title: '保存成功'
  484. });
  485. }
  486. });
  487. } else {
  488. uni.showModal({
  489. title: '提示',
  490. content: '请先在设置页面打开“保存相册”使用权限',
  491. confirmText: '去设置',
  492. cancelText: '算了',
  493. success: data => {
  494. if (data.confirm) {
  495. uni.hideLoading();
  496. uni.openSetting();
  497. }
  498. }
  499. });
  500. }
  501. }
  502. });
  503. } else {
  504. uni.hideLoading();
  505. settingWritePhotosAlbum = true;
  506. uni.authorize({
  507. scope: 'scope.writePhotosAlbum',
  508. success: () => {
  509. uni.saveImageToPhotosAlbum({
  510. filePath: imgUrl,
  511. success: () => {
  512. uni.hideLoading();
  513. uni.showToast({
  514. title: '保存成功'
  515. });
  516. }
  517. });
  518. }
  519. });
  520. }
  521. // #endif
  522. },
  523. //生成海报
  524. createPoster() {
  525. let that = this;
  526. return new Promise((resolve, reject) => {
  527. uni.showLoading({
  528. title: '海报生成中'
  529. });
  530. const canvasWidth = 375;
  531. const padding = 20;
  532. const contentSpacing = 20;
  533. const qrSize = 80;
  534. const imageWidth = canvasWidth - padding * 2;
  535. // 背景图高度,实际生成后你可以根据比例做更精准调整
  536. const imageHeight = 500;
  537. const textBlockHeight = 100;
  538. const canvasHeight = padding * 2 + imageHeight + contentSpacing + textBlockHeight;
  539. const ctx = uni.createCanvasContext('poster');
  540. // 白底背景
  541. ctx.setFillStyle("#FFFFFF");
  542. ctx.fillRect(0, 0, canvasWidth, canvasHeight);
  543. // 下载背景图
  544. let imgUrl = that.backgroundImage;
  545. uni.downloadFile({
  546. url: imgUrl,
  547. success: (res) => {
  548. if (res.statusCode === 200) {
  549. // 下载二维码
  550. const qrUrl = that.config("APIHOST1") + '/app/invite/mpCreateQr?invitationCode=' + that.invitationCode;
  551. uni.downloadFile({
  552. url: qrUrl,
  553. success: (res2) => {
  554. if (res2.statusCode === 200) {
  555. // 1. 绘制图片
  556. const imageX = padding;
  557. const imageY = padding;
  558. ctx.drawImage(res.tempFilePath, imageX, imageY, imageWidth, imageHeight);
  559. // 2. 绘制底部内容(图片底下 margin-top: 20px)
  560. const contentY = imageY + imageHeight + contentSpacing;
  561. // 左侧文字
  562. ctx.setFontSize(14);
  563. ctx.setFillStyle('#333');
  564. ctx.setTextAlign('left');
  565. ctx.fillText("我的邀请码", padding, contentY + 20);
  566. ctx.setFontSize(12);
  567. ctx.setFillStyle('#666');
  568. ctx.fillText("长按识别图中二维码", padding, contentY + 45);
  569. // 右侧二维码
  570. const qrX = canvasWidth - qrSize - padding;
  571. const qrY = contentY;
  572. ctx.drawImage(res2.tempFilePath, qrX, qrY, qrSize, qrSize);
  573. // 3. 绘制完成
  574. ctx.draw(true, () => {
  575. uni.canvasToTempFilePath({
  576. canvasId: 'poster',
  577. width: canvasWidth,
  578. height: canvasHeight,
  579. success: (res) => {
  580. uni.hideLoading();
  581. resolve(res.tempFilePath);
  582. },
  583. fail: (err) => {
  584. console.error('生成失败', err);
  585. uni.hideLoading();
  586. reject();
  587. }
  588. });
  589. });
  590. } else {
  591. uni.hideLoading();
  592. uni.showToast({
  593. title: '二维码下载失败',
  594. icon: 'none'
  595. });
  596. }
  597. },
  598. fail: (err) => {
  599. console.log(err);
  600. uni.hideLoading();
  601. uni.showToast({
  602. title: '二维码下载失败',
  603. icon: 'none'
  604. });
  605. }
  606. });
  607. } else {
  608. uni.hideLoading();
  609. uni.showToast({
  610. title: '背景图下载失败',
  611. icon: 'none'
  612. });
  613. }
  614. },
  615. fail: (err) => {
  616. console.log(err);
  617. uni.hideLoading();
  618. uni.showToast({
  619. title: '背景图下载失败',
  620. icon: 'none',
  621. });
  622. }
  623. });
  624. });
  625. },
  626. config: function(name) {
  627. var info = null;
  628. if (name) {
  629. var name2 = name.split("."); //字符分割
  630. if (name2.length > 1) {
  631. info = configdata[name2[0]][name2[1]] || null;
  632. } else {
  633. info = configdata[name] || null;
  634. }
  635. if (info == null) {
  636. let web_config = cache.get("web_config");
  637. if (web_config) {
  638. if (name2.length > 1) {
  639. info = web_config[name2[0]][name2[1]] || null;
  640. } else {
  641. info = web_config[name] || null;
  642. }
  643. }
  644. }
  645. }
  646. return info;
  647. },
  648. }
  649. }
  650. </script>
  651. <style>
  652. .modal {
  653. position: fixed;
  654. top: 0;
  655. right: 0;
  656. bottom: 0;
  657. left: 0;
  658. z-index: 1110;
  659. opacity: 0;
  660. outline: 0;
  661. text-align: center;
  662. -ms-transform: scale(1.185);
  663. transform: scale(1.185);
  664. backface-visibility: hidden;
  665. perspective: 2000upx;
  666. background: rgba(0, 0, 0, 0.6);
  667. transition: all 0.3s ease-in-out 0s;
  668. pointer-events: none;
  669. }
  670. .modal.show {
  671. opacity: 1;
  672. transition-duration: 0.3s;
  673. -ms-transform: scale(1);
  674. transform: scale(1);
  675. overflow-x: hidden;
  676. overflow-y: auto;
  677. pointer-events: auto;
  678. }
  679. page {
  680. background: #F5F5F5;
  681. }
  682. .view1 {
  683. height: 1080rpx;
  684. border-radius: 15upx;
  685. background-size: 100% 100%;
  686. backgroundRepeat: repeat;
  687. margin: 20upx 20upx 0 20upx;
  688. }
  689. .hideCanvasView {
  690. position: relative;
  691. }
  692. .hideCanvas {
  693. position: fixed;
  694. top: -99999upx;
  695. left: -99999upx;
  696. z-index: -99999;
  697. }
  698. .flex_row_c_c {
  699. display: flex;
  700. flex-direction: row;
  701. justify-content: center;
  702. align-items: center;
  703. }
  704. .modalView {
  705. width: 100%;
  706. height: 100%;
  707. position: fixed;
  708. top: 0;
  709. left: 0;
  710. right: 0;
  711. bottom: 0;
  712. opacity: 0;
  713. outline: 0;
  714. transform: scale(1.2);
  715. perspective: 2500upx;
  716. background: rgba(0, 0, 0, 0.6);
  717. transition: all .3s ease-in-out;
  718. pointer-events: none;
  719. backface-visibility: hidden;
  720. z-index: 999;
  721. }
  722. .modalView.show {
  723. opacity: 1;
  724. transform: scale(1);
  725. pointer-events: auto;
  726. }
  727. .flex_column {
  728. display: flex;
  729. flex-direction: column;
  730. }
  731. .backgroundColor-white {
  732. background-color: white;
  733. }
  734. .border_radius_10px {
  735. border-radius: 10px;
  736. }
  737. .padding1vh {
  738. padding: 1vh;
  739. }
  740. .posterImage {
  741. width: 60vw;
  742. }
  743. .flex_row {
  744. display: flex;
  745. flex-direction: row;
  746. }
  747. .marginTop2vh {
  748. margin-top: 2vh;
  749. }
  750. .poster_canvas {
  751. width: 750upx;
  752. height: 1334upx;
  753. position: fixed;
  754. top: -10000upx;
  755. left: 0;
  756. }
  757. </style>