index.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. // nova-werun/pages/home/share/index.js
  2. const qiniuUploader = require("../../../../utils/qiniuUploader");
  3. const Parse = getApp().Parse;
  4. const company = getApp().globalData.company;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. //屏幕高度
  11. statusBarHeight: 0, // 状态栏高度
  12. screenHeight: 0, // 屏幕高度
  13. customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
  14. bottomNavHeight: 0, // 底部导航栏高度
  15. contentHeight: 0, // 可用内容高度
  16. contentHeight2: 0,
  17. contentpadding: 0, //顶部padding高度
  18. sharList: [],
  19. images: [
  20. 'https://file-cloud.fmode.cn/qpFbRRSZrO/20250102/gtontq125800552.jpg?imageView2/1/w/200/h/200',
  21. 'https://file-cloud.fmode.cn/qpFbRRSZrO/20250102/8e1ps0125800358.jpg?imageView2/1/w/200/h/200',
  22. 'https://file-cloud.fmode.cn/qpFbRRSZrO/20250102/l5321n125800284.jpg?imageView2/1/w/200/h/200',
  23. 'https://file-cloud.fmode.cn/qpFbRRSZrO/20250102/j1p6l7125757884.jpg?imageView2/1/w/200/h/200'
  24. ],
  25. randomImage: '',
  26. saveimage: '',
  27. uptokenURL: '',
  28. domain: '',
  29. uploadURL: ''
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. // 计算
  36. const systemInfo = wx.getSystemInfoSync();
  37. const statusBarHeight = systemInfo.statusBarHeight || 0;
  38. const screenHeight = systemInfo.screenHeight || 0;
  39. const custom = wx.getMenuButtonBoundingClientRect();
  40. const customHeight = custom.height + 10 + 2 || 0;
  41. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  42. const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
  43. const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  44. this.setData({
  45. statusBarHeight,
  46. screenHeight,
  47. customHeight,
  48. bottomNavHeight,
  49. contentpadding,
  50. contentHeight
  51. });
  52. this.order()
  53. this.showRandomImage()
  54. },
  55. /**
  56. * 生命周期函数--监听页面初次渲染完成
  57. */
  58. onReady: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面显示
  62. */
  63. onShow: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide: function () {
  69. },
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload: function () {
  74. },
  75. /**
  76. * 页面相关事件处理函数--监听用户下拉动作
  77. */
  78. onPullDownRefresh: function () {
  79. },
  80. /**
  81. * 页面上拉触底事件的处理函数
  82. */
  83. onReachBottom: function () {
  84. },
  85. /**
  86. * 用户点击右上角分享
  87. */
  88. onShareAppMessage: function () {
  89. },
  90. //获取当天运动数据
  91. async order() {
  92. const currentUser = Parse.User.current();
  93. let ActivityDataquery = new Parse.Query('ActivityData');
  94. // ActivityDataquery.equalTo('user', currentUser.id);
  95. ActivityDataquery.equalTo('company', company);
  96. ActivityDataquery.equalTo('type', 'today');
  97. ActivityDataquery.notEqualTo('isDeleted', true);
  98. // 获取今天的日期
  99. const today = new Date();
  100. const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // 今天的开始时间
  101. const todayEnd = new Date(todayStart);
  102. todayEnd.setHours(23, 59, 59, 999); // 今天的结束时间
  103. // 在查询条件中添加对 createdAt 的限制
  104. ActivityDataquery.greaterThanOrEqualTo('createdAt', todayStart);
  105. ActivityDataquery.lessThanOrEqualTo('createdAt', todayEnd);
  106. ActivityDataquery.include('user');
  107. // 根据 steps 字段进行降序排序
  108. ActivityDataquery.descending('steps');
  109. let r = await ActivityDataquery.find();
  110. let todayList = r.map(item => {
  111. let itemData = item.toJSON();
  112. // 获取当前时间并格式化
  113. const now = new Date();
  114. const formattedTime = `${now.getFullYear()}/${String(now.getMonth() + 1).padStart(2, '0')}/${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
  115. itemData.currentTime = formattedTime; // 将当前时间添加到 item 中
  116. return itemData;
  117. });
  118. let sharList = []
  119. todayList.forEach((item, index) => {
  120. if (item.user.objectId == currentUser.id) {
  121. sharList.push({
  122. ...item, // 包含用户数据
  123. rank: index + 1 // 计算排名(index 从 0 开始,所以加 1)
  124. });
  125. }
  126. })
  127. this.setData({
  128. sharList
  129. });
  130. this.saveImage()
  131. console.log(this.data.sharList);
  132. },
  133. //随机展示图片
  134. showRandomImage: function () {
  135. const randomIndex = Math.floor(Math.random() * this.data.images.length);
  136. this.setData({
  137. randomImage: this.data.images[randomIndex]
  138. });
  139. },
  140. //绘制canvas
  141. rpxToPx(rpx) {
  142. const systemInfo = wx.getSystemInfoSync();
  143. return rpx * (systemInfo.windowWidth / 750);
  144. },
  145. getImageInfo(url) {
  146. console.log(url);
  147. return new Promise((result) => {
  148. wx.getImageInfo({
  149. src: url, //服务器返回的图片地址
  150. success: function (res) {
  151. // res.path是网络图片的本地地址
  152. let Path = res.path;
  153. result(Path)
  154. },
  155. fail(err) {
  156. console.log(err);
  157. result()
  158. }
  159. });
  160. })
  161. },
  162. //rpx
  163. async saveImage() {
  164. // console.log('运行了');
  165. const canvas = wx.createCanvasContext('myCanvas');
  166. const width = this.rpxToPx(670);
  167. const height = this.rpxToPx(1100);
  168. // console.log(width, height);
  169. canvas.width = this.rpxToPx(670);
  170. canvas.height = this.rpxToPx(1100);
  171. const backgroundImage2 = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/bt19fm050427168.png');
  172. // 绘制背景图片
  173. canvas.drawImage(backgroundImage2, 0, 0, width, height);
  174. // 加载背景图片
  175. const backgroundImage1 = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/1r3o3q045323287.png');
  176. // 绘制背景图片
  177. canvas.drawImage(backgroundImage1, 0, 0, width, height);
  178. // 绘制背景
  179. // canvas.setFillStyle('#CAE1FD'); // 背景色
  180. // canvas.fillRect(0, 0, width, height);
  181. canvas.setFillStyle('#0178EE');
  182. // let mainimage = await this.getImageInfo(this.data.randomImage)
  183. let avatar = Parse.User.current()?.get('avatar')
  184. console.log('avatar', avatar);
  185. let userAvatar = await this.getImageInfo(avatar)
  186. console.log('userAvatar', userAvatar);
  187. //主图片
  188. // canvas.drawImage(mainimage, 0, 0, width, this.rpxToPx(500)); // 调整图片高度
  189. //头像
  190. if (userAvatar) {
  191. // 绘制带圆角的头像
  192. const avatarX = this.rpxToPx(40);
  193. const avatarY = this.rpxToPx(540);
  194. const avatarSize = this.rpxToPx(83);
  195. const radius = avatarSize / 2; // 半径为头像大小的一半
  196. // 绘制圆角矩形
  197. canvas.save(); // 保存当前状态
  198. canvas.beginPath(); // 开始路径
  199. canvas.moveTo(avatarX + radius, avatarY); // 左上角
  200. canvas.lineTo(avatarX + avatarSize - radius, avatarY); // 上边
  201. canvas.arc(avatarX + avatarSize - radius, avatarY + radius, radius, 1.5 * Math.PI, 0, false); // 右上角
  202. canvas.lineTo(avatarX + avatarSize, avatarY + avatarSize - radius); // 右边
  203. canvas.arc(avatarX + avatarSize - radius, avatarY + avatarSize - radius, radius, 0, 0.5 * Math.PI, false); // 右下角
  204. canvas.lineTo(avatarX + radius, avatarY + avatarSize); // 下边
  205. canvas.arc(avatarX + radius, avatarY + avatarSize - radius, radius, 0.5 * Math.PI, Math.PI, false); // 左下角
  206. canvas.lineTo(avatarX, avatarY + radius); // 左边
  207. canvas.arc(avatarX + radius, avatarY + radius, radius, Math.PI, 1.5 * Math.PI, false); // 左上角
  208. canvas.closePath(); // 关闭路径
  209. canvas.clip(); // 剪切
  210. // 绘制头像
  211. canvas.drawImage(userAvatar, avatarX, avatarY, avatarSize, avatarSize); // 头像位置和大小
  212. canvas.restore(); // 恢复状态
  213. }
  214. // 绘制昵称和时间
  215. const nickname = this.data.sharList[0].user.nickname;
  216. const currentTime = this.data.sharList[0].currentTime;
  217. const rank = this.data.sharList[0].rank;
  218. const steps = this.data.sharList[0].steps || 0;
  219. const distance = this.data.sharList[0].distance || 0;
  220. canvas.setFontSize(this.rpxToPx(30));
  221. canvas.fillText(nickname, this.rpxToPx(140), this.rpxToPx(580)); // 昵称位置
  222. // console.log('昵称加载成功');
  223. canvas.setFontSize(this.rpxToPx(28));
  224. canvas.fillText(currentTime, this.rpxToPx(140), this.rpxToPx(610)); // 时间位置
  225. // console.log('时间加载成功');
  226. // 绘制其他文本
  227. canvas.setFontSize(this.rpxToPx(55));
  228. canvas.fillText('梦想家', this.rpxToPx(40), this.rpxToPx(720));
  229. // console.log('梦想家加载成功');
  230. canvas.setFontSize(this.rpxToPx(30));
  231. canvas.fillText('用汗水实现想象,用脚步丈量梦想', this.rpxToPx(40), this.rpxToPx(780));
  232. // console.log('汗水加载成功');
  233. // 绘制排名、步数和公里数
  234. canvas.setFontSize(this.rpxToPx(22));
  235. // canvas.fillText('今日排名: ' + rank, 20, 400);
  236. canvas.fillText('今日排名', this.rpxToPx(40), this.rpxToPx(840));
  237. // console.log('排名加载成功');
  238. // canvas.fillText('今日步数: ' + steps, 20, 420);
  239. canvas.fillText('今日步数', this.rpxToPx(180), this.rpxToPx(840));
  240. // console.log('步数加载成功');
  241. // canvas.fillText('公里数: ' + distance + 'km', 20, 430);
  242. canvas.fillText('公里数', this.rpxToPx(320), this.rpxToPx(840));
  243. // console.log('公里数加载成功');
  244. canvas.setFontSize(this.rpxToPx(34));
  245. canvas.fillText(rank, this.rpxToPx(70), this.rpxToPx(900));
  246. canvas.fillText(steps, this.rpxToPx(180), this.rpxToPx(900));
  247. canvas.fillText(distance + 'km', this.rpxToPx(320), this.rpxToPx(900));
  248. // 加载二维码图片
  249. const qrCodeImage = await this.getImageInfo('https://file-cloud.fmode.cn/qpFbRRSZrO/20250113/t2vst6051431547.png');
  250. // 绘制二维码
  251. canvas.drawImage(qrCodeImage, width - this.rpxToPx(140), height - this.rpxToPx(160), this.rpxToPx(120), this.rpxToPx(120));
  252. canvas.setFillStyle('#0178EE');
  253. canvas.setFontSize(this.rpxToPx(28));
  254. canvas.fillText('长按二维码加入跑团', width - this.rpxToPx(420), height - this.rpxToPx(120));
  255. canvas.fillText('和我一起运动', width - this.rpxToPx(380), height - this.rpxToPx(80));
  256. // 完成绘制
  257. canvas.draw(false, () => {
  258. console.log('123');
  259. wx.canvasToTempFilePath({
  260. canvasId: 'myCanvas',
  261. success: (res) => {
  262. console.log('绘制完成', res);
  263. this.setData({
  264. saveimage: res.tempFilePath
  265. });
  266. this.getUptoken()
  267. console.log(this.data.saveimage);
  268. },
  269. fail: (err) => {
  270. console.error('canvasToTempFilePath 失败', err);
  271. }
  272. });
  273. });
  274. },
  275. uploadImageToServer() {
  276. const that = this;
  277. const tempFilePath = this.data.saveimage; // 获取本地临时文件路径
  278. qiniuUploader.upload(
  279. tempFilePath, // 本地文件路径
  280. (res) => {
  281. const imageURL = res.imageURL; // 上传成功后的网络地址
  282. console.log('上传成功,网络地址:', imageURL);
  283. that.setData({
  284. saveimage: imageURL // 更新 saveimage 为网络地址
  285. });
  286. },
  287. (error) => {
  288. console.error('上传失败:', error);
  289. }, {
  290. region: "SCN", // 七牛云区域
  291. uploadURL: that.data.uploadURL, // 上传地址
  292. domain: that.data.domain, // 域名
  293. uptoken: that.data.uptokenURL, // 上传凭证
  294. }
  295. );
  296. console.log('saveimage', this.data.saveimage);
  297. },
  298. async getUptoken() {
  299. let res = await Parse.Cloud.run('qiniu_uptoken', {
  300. company: company
  301. })
  302. this.setData({
  303. uptokenURL: res.uptoken,
  304. domain: res.domain,
  305. uploadURL: res.zoneUrl
  306. })
  307. this.uploadImageToServer()
  308. console.log(this.data.uptokenURL, this.data.domain, this.data.uploadURL);
  309. },
  310. //px
  311. // saveImage() {
  312. // // console.log('运行了');
  313. // const canvas = wx.createCanvasContext('myCanvas');
  314. // const width = 335;
  315. // const height = 550;
  316. // // console.log(width, height);
  317. // canvas.width = 335;
  318. // canvas.height = 550;
  319. // // 绘制背景
  320. // canvas.setFillStyle('#CAE1FD'); // 背景色
  321. // canvas.fillRect(0, 0, width, height);
  322. // canvas.setFillStyle('#0178EE');
  323. // // 加载主图片
  324. // wx.getImageInfo({
  325. // src: this.data.randomImage,
  326. // success: (res) => {
  327. // canvas.drawImage(res.path, 0, 0, width, 250); // 调整图片高度
  328. // // console.log('主图片加载成功');
  329. // // 加载用户头像
  330. // wx.getImageInfo({
  331. // src: this.data.sharList[0].user.avatar,
  332. // success: (avatarRes) => {
  333. // // 绘制带圆角的头像
  334. // const avatarX = 20;
  335. // const avatarY = 270;
  336. // const avatarSize = 42.5;
  337. // const radius = avatarSize / 2; // 半径为头像大小的一半
  338. // // 绘制圆角矩形
  339. // canvas.save(); // 保存当前状态
  340. // canvas.beginPath(); // 开始路径
  341. // canvas.moveTo(avatarX + radius, avatarY); // 左上角
  342. // canvas.lineTo(avatarX + avatarSize - radius, avatarY); // 上边
  343. // canvas.arc(avatarX + avatarSize - radius, avatarY + radius, radius, 1.5 * Math.PI, 0, false); // 右上角
  344. // canvas.lineTo(avatarX + avatarSize, avatarY + avatarSize - radius); // 右边
  345. // canvas.arc(avatarX + avatarSize - radius, avatarY + avatarSize - radius, radius, 0, 0.5 * Math.PI, false); // 右下角
  346. // canvas.lineTo(avatarX + radius, avatarY + avatarSize); // 下边
  347. // canvas.arc(avatarX + radius, avatarY + avatarSize - radius, radius, 0.5 * Math.PI, Math.PI, false); // 左下角
  348. // canvas.lineTo(avatarX, avatarY + radius); // 左边
  349. // canvas.arc(avatarX + radius, avatarY + radius, radius, Math.PI, 1.5 * Math.PI, false); // 左上角
  350. // canvas.closePath(); // 关闭路径
  351. // canvas.clip(); // 剪切
  352. // // 绘制头像
  353. // canvas.drawImage(avatarRes.path, avatarX, avatarY, avatarSize, avatarSize); // 头像位置和大小
  354. // canvas.restore(); // 恢复状态
  355. // // console.log('头像加载成功');
  356. // // 绘制昵称和时间
  357. // const nickname = this.data.sharList[0].user.nickname;
  358. // const currentTime = this.data.sharList[0].currentTime;
  359. // const rank = this.data.sharList[0].rank;
  360. // const steps = this.data.sharList[0].steps || 0;
  361. // const distance = this.data.sharList[0].distance || 0;
  362. // canvas.setFontSize(15);
  363. // canvas.fillText(nickname, 70, 290); // 昵称位置
  364. // // console.log('昵称加载成功');
  365. // canvas.setFontSize(14);
  366. // canvas.fillText(currentTime, 70, 305); // 时间位置
  367. // // console.log('时间加载成功');
  368. // // 绘制其他文本
  369. // canvas.setFontSize(27.5);
  370. // canvas.fillText('梦想家', 20, 360);
  371. // // console.log('梦想家加载成功');
  372. // canvas.setFontSize(15);
  373. // canvas.fillText('用汗水实现想象,用脚步丈量梦想', 20, 390);
  374. // // console.log('汗水加载成功');
  375. // // 绘制排名、步数和公里数
  376. // canvas.setFontSize(14);
  377. // // canvas.fillText('今日排名: ' + rank, 20, 400);
  378. // canvas.fillText('今日排名', 20, 420);
  379. // // console.log('排名加载成功');
  380. // // canvas.fillText('今日步数: ' + steps, 20, 420);
  381. // canvas.fillText('今日步数', 120, 420);
  382. // // console.log('步数加载成功');
  383. // // canvas.fillText('公里数: ' + distance + 'km', 20, 430);
  384. // canvas.fillText('公里数', 220, 420);
  385. // // console.log('公里数加载成功');
  386. // canvas.setFontSize(20);
  387. // canvas.fillText(rank, 40, 450);
  388. // canvas.fillText(steps, 122, 450);
  389. // canvas.fillText(distance + 'km', 222, 450);
  390. // // 绘制二维码(如果有)
  391. // canvas.setFillStyle('red'); // 示例二维码
  392. // canvas.fillRect(width - 70, height - 80, 60, 60); // QR 位置
  393. // // console.log('二维码绘制');
  394. // canvas.setFillStyle('#0178EE');
  395. // canvas.setFontSize(14);
  396. // canvas.fillText('长按二维码加入跑团', width - 210, height - 60);
  397. // canvas.fillText('和我一起运动', width - 190, height - 40);
  398. // // 完成绘制
  399. // canvas.draw(false, () => {
  400. // console.log('123');
  401. // wx.canvasToTempFilePath({
  402. // canvasId: 'myCanvas',
  403. // success: (res) => {
  404. // console.log('绘制完成', res);
  405. // this.setData({
  406. // saveimage: res.tempFilePath
  407. // });
  408. // console.log(this.data.saveimage);
  409. // },
  410. // fail: (err) => {
  411. // console.error('canvasToTempFilePath 失败', err);
  412. // }
  413. // });
  414. // });
  415. // },
  416. // fail: () => {
  417. // console.error('用户头像加载失败');
  418. // }
  419. // });
  420. // },
  421. // fail: () => {
  422. // console.error('主图片加载失败');
  423. // }
  424. // });
  425. // },
  426. //点击保存图片
  427. async savepic() {
  428. await this.saveImage()
  429. const imagePath = this.data.saveimage; // 获取保存的图片路径
  430. if (imagePath) {
  431. // 调用保存图片到相册的方法
  432. wx.saveImageToPhotosAlbum({
  433. filePath: imagePath,
  434. success: () => {
  435. wx.showToast({
  436. title: '图片已保存到相册',
  437. icon: 'success'
  438. });
  439. },
  440. fail: (err) => {
  441. console.error('保存失败', err);
  442. wx.showToast({
  443. title: '保存失败',
  444. icon: 'none'
  445. });
  446. }
  447. });
  448. } else {
  449. wx.showToast({
  450. title: '没有可保存的图片',
  451. icon: 'none'
  452. });
  453. }
  454. },
  455. //保存图片到相册
  456. savepic2: function () {
  457. let that = this;
  458. wx.canvasToTempFilePath({
  459. x: 0,
  460. y: 0,
  461. width: 670,
  462. height: 1100,
  463. destWidth: 670,
  464. destHeight: 1100,
  465. canvasId: 'myCanvas',
  466. success: function (result) {
  467. wx.getSetting({
  468. success(res) {
  469. if (!res.authSetting['scope.writePhotosAlbum']) {
  470. wx.authorize({
  471. scope: 'scope.writePhotosAlbum',
  472. success() {
  473. //这里是用户同意授权后的回调
  474. // that.saveImgToLocal();
  475. wx.saveImageToPhotosAlbum({
  476. filePath: result.tempFilePath,
  477. success(res) {
  478. wx.showToast({
  479. title: '图片已保存到相册',
  480. icon: 'success'
  481. });
  482. }
  483. })
  484. },
  485. fail() { //这里是用户拒绝授权后的回调
  486. wx.showToast({
  487. title: '打开相册授权,才能保存图片哦~',
  488. icon: 'none',
  489. duration: 2000
  490. })
  491. that.setData({
  492. openSettingBtnHidden: false
  493. })
  494. }
  495. })
  496. } else {
  497. //调取小程序当中获取图片
  498. console.log(result.tempFilePath);
  499. wx.saveImageToPhotosAlbum({
  500. filePath: result.tempFilePath,
  501. success(res) {
  502. wx.showToast({
  503. title: '图片已保存到相册',
  504. icon: 'success'
  505. });
  506. }
  507. })
  508. }
  509. }
  510. })
  511. },
  512. fail: function (res) {
  513. console.log(res)
  514. }
  515. })
  516. },
  517. shar() {
  518. wx.downloadFile({
  519. url: this.data.saveimage, //图片服务器地址
  520. success: (res) => {
  521. wx.showShareImageMenu({
  522. path: res.tempFilePath, //转为本地地址showShareImageMenu进行分享
  523. success: (res) => {
  524. uni.hideLoading();
  525. this.modalShare = null;
  526. },
  527. fail: (err) => {
  528. uni.hideLoading();
  529. this.modalShare = null;
  530. },
  531. });
  532. },
  533. });
  534. },
  535. sharecircle() {
  536. console.log('this.data.saveimage', this.data.saveimage);
  537. wx.navigateTo({
  538. url: '../../circle/send-circle/index?image=' + this.data.saveimage // 目标页面的路径
  539. });
  540. }
  541. })