index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div class="finance2023" :style="'font-size:' + font_size + 'px'">
  3. <!-- 播放键 -->
  4. <svg
  5. class="imgbtn"
  6. @click="play"
  7. :style="{
  8. 'animation-play-state': play_stats ? 'running' : 'paused',
  9. }"
  10. viewBox="0 0 1024 1024"
  11. version="1.1"
  12. xmlns="http://www.w3.org/2000/svg"
  13. p-id="899"
  14. width="32"
  15. height="32"
  16. >
  17. <path
  18. d="M512 17.066667c273.339733 0 494.933333 221.5936 494.933333 494.933333S785.339733 1006.933333 512 1006.933333 17.066667 785.339733 17.066667 512 238.660267 17.066667 512 17.066667z"
  19. opacity=".502"
  20. p-id="900"
  21. ></path>
  22. <path
  23. d="M512 1024C229.2224 1024 0 794.7776 0 512 0 229.2224 229.2224 0 512 0c282.7776 0 512 229.2224 512 512 0 282.7776-229.2224 512-512 512z m0-972.8C257.501867 51.2 51.2 257.501867 51.2 512s206.301867 460.8 460.8 460.8 460.8-206.301867 460.8-460.8S766.498133 51.2 512 51.2z"
  24. fill="#FFFFFF"
  25. p-id="901"
  26. ></path>
  27. <path
  28. d="M530.568533 170.666667c4.8128 34.1504 5.495467 77.2096 41.2672 120.2688 27.4944 32.802133 58.453333 62.173867 79.7696 88.832C679.799467 414.6176 699.733333 458.359467 699.733333 502.784c0 71.0656-34.372267 141.431467-57.770666 180.394667h-10.990934c16.503467-36.898133 49.5104-97.723733 46.7456-162.628267-1.365333-36.232533-15.121067-75.178667-38.485333-103.867733-26.146133-33.501867-70.161067-60.142933-108.663467-62.8736v387.447466c0 30.754133-18.568533 58.7776-45.380266 79.274667C459.0592 841.028267 424.669867 853.333333 394.410667 853.333333c-19.2512 0-37.137067-6.144-49.5104-16.401066-13.073067-10.257067-20.6336-25.275733-20.6336-43.042134 0-28.023467 19.2512-56.046933 45.380266-76.544 26.146133-21.179733 59.136-34.850133 86.647467-34.850133 24.081067 0 44.6976 3.413333 57.088 15.035733V170.666667h17.186133z"
  29. fill="#FFFFFF"
  30. p-id="902"
  31. ></path>
  32. </svg>
  33. <img src="./img/bg2023.jpg" style="width: 100%" />
  34. <div
  35. class="main"
  36. :style="{
  37. height: look_more ? 'auto' : '400px',
  38. }"
  39. >
  40. <p class="users">
  41. 已有<span class="user_num" v-text="totalUser"></span>人参与
  42. </p>
  43. <h3 class="header_title">2023年争做陕西金融好网民倡议书</h3>
  44. <div class="body">
  45. <p class="duan">
  46. 为营造健康和谐的金融舆论环境,弘扬主旋律,传递正能量,现向广大金融网民朋友发出如下倡议:
  47. </p>
  48. <p class="duan">
  49. <b>一、坚守法律底线,争当遵纪守法的金融维护者。</b>
  50. 网络空间不是法外之地,要严格遵守《中华人民共和国中国人民银行法》《中华人民共和国消费者权益保护法》《全国人民代表大会常务委员会关于维护互联网安全的决定》等法律规定,不发布不实金融消息,不传播金融谣言、非法金融广告等违法信息。营造健康向上的金融网络环境,争当遵纪守法的网络金融维护者。
  51. </p>
  52. <p class="duan">
  53. <b>二、加强金融素养,当好素质优良的金融学习者。</b>
  54. 要掌握金融知识,防范各种网络非法集资活动套路,了解金融活动,提高对违法违规金融活动的鉴别和防范能力。不断提升自身金融素养和自我保护意识,成为有风险防范意识、技能提升意识、网络安全意识、责任担当意识的新时代金融好网民。
  55. </p>
  56. <p class="duan">
  57. <b>三、履行社会责任,做好弘扬正能量的金融传播者。</b>
  58. 不信谣、不传谣,不发布、不转发未经证实的可能会给社会和他人造成伤害的金融信息。不发表和传播惑众及危害社会的不良金融信息。主动抵制和举报各种网上非法金融广告、非法集资、电信诈骗、银行卡盗刷以及校园贷、现金贷等现象,坚决同网络违法犯罪活动作斗争,积极维护国家、社会、集体和个人合法权益。互联网金融从业人员要加强行业自律,坚持正确导向,积极传播、弘扬优秀文化和文明,要发挥带动引领作用,做网络文明的传播者和网络正能量的弘扬者。
  59. </p>
  60. <p class="duan">
  61. <b>四、树立正确观念,争做自觉理性的金融消费者。</b>
  62. 要树立理性消费观念,不攀比、不盲从。要根据自身收入水平和消费能力做好收支筹划,量入为出、理性消费,不购买超出自身经济承受能力之物,远离奢靡之风。要建立正确的消费观念,正确规划生活的资金需求,合理合规使用信用卡、小额贷款等消费信贷服务,自觉抵制各类网络信贷。
  63. </p>
  64. <p class="duan">
  65. 广大金融网民朋友们,让我们从现在做起,从自己做起,积极传播正能量,争做金融好网民!
  66. </p>
  67. </div>
  68. <div
  69. class="inset"
  70. :style="{
  71. background: !look_more
  72. ? 'linear-gradient(#ffffff00, #ffffff 45%)'
  73. : '#ffffff00',
  74. }"
  75. >
  76. <div class="bottom_set">
  77. <p class="line_title" v-if="!look_more" @click="look_more = true">
  78. <span style="vertical-align: middle">阅读全文</span>
  79. <svg
  80. viewBox="0 0 1024 1024"
  81. version="1.1"
  82. style="display: inline-block; vertical-align: middle"
  83. xmlns="http://www.w3.org/2000/svg"
  84. width="16"
  85. height="16"
  86. >
  87. <path
  88. fill="#60bf9f"
  89. d="M486.4 537.6C492.8 544 505.6 544 512 544s19.2 0 25.6-6.4l224-224c12.8-12.8 12.8-32 0-44.8s-32-12.8-44.8 0L512 467.2 313.6 262.4C300.8 256 275.2 256 262.4 262.4S256 300.8 262.4 313.6L486.4 537.6z"
  90. ></path>
  91. <path
  92. fill="#60bf9f"
  93. d="M710.4 486.4 512 691.2 313.6 486.4c-12.8-12.8-32-12.8-44.8 0S256 524.8 262.4 537.6l224 224C492.8 768 505.6 768 512 768s19.2 0 25.6-6.4l224-224c12.8-12.8 12.8-32 0-44.8S723.2 480 710.4 486.4z"
  94. ></path>
  95. </svg>
  96. </p>
  97. <p v-if="look_more" @click="look_more = false" class="line_title">
  98. <span style="vertical-align: middle">收起</span>
  99. <svg
  100. viewBox="0 0 1024 1024"
  101. version="1.1"
  102. style="
  103. display: inline-block;
  104. vertical-align: middle;
  105. transform: rotate(180deg);
  106. "
  107. xmlns="http://www.w3.org/2000/svg"
  108. width="16"
  109. height="16"
  110. >
  111. <path
  112. fill="#60bf9f"
  113. d="M486.4 537.6C492.8 544 505.6 544 512 544s19.2 0 25.6-6.4l224-224c12.8-12.8 12.8-32 0-44.8s-32-12.8-44.8 0L512 467.2 313.6 262.4C300.8 256 275.2 256 262.4 262.4S256 300.8 262.4 313.6L486.4 537.6z"
  114. ></path>
  115. <path
  116. fill="#60bf9f"
  117. d="M710.4 486.4 512 691.2 313.6 486.4c-12.8-12.8-32-12.8-44.8 0S256 524.8 262.4 537.6l224 224C492.8 768 505.6 768 512 768s19.2 0 25.6-6.4l224-224c12.8-12.8 12.8-32 0-44.8S723.2 480 710.4 486.4z"
  118. ></path>
  119. </svg>
  120. </p>
  121. <div @click="createhb" class="btn">生成海报</div>
  122. </div>
  123. </div>
  124. </div>
  125. <van-dialog
  126. v-model:show="show"
  127. title=" "
  128. show-cancel-button
  129. :beforeClose="onSubmit"
  130. >
  131. <van-form>
  132. <van-cell-group inset>
  133. <van-field
  134. v-model="username"
  135. name="昵称"
  136. label="昵称"
  137. placeholder="请输入昵称"
  138. :rules="[{ required: true, message: '请填写昵称' }]"
  139. />
  140. </van-cell-group>
  141. </van-form>
  142. </van-dialog>
  143. </div>
  144. </template>
  145. <script setup>
  146. import { saveUser, getTotal } from '@/api/2023.js';
  147. import { ref } from 'vue';
  148. import { showImagePreview, showToast } from 'vant';
  149. // import { onMounted, reactive } from "vue";
  150. // import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
  151. /**
  152. * window.$originData.orginParames.title 页面标题
  153. * window.$originData.orginParames.parameters 固定参数值
  154. * window.$originData.urlParames url参数
  155. */
  156. let s = window.$originData.orginParames.availWidth / 25;
  157. s > 40 ? (s = 40) : '';
  158. const totalUser = ref(0);
  159. const font_size = ref();
  160. const play_stats = ref(false);
  161. const canvas = document.createElement('canvas');
  162. const show = ref(false);
  163. const username = ref(localStorage.getItem('username20230712') || '');
  164. const img_local = localStorage.getItem('hb20230712');
  165. let d2 = undefined;
  166. canvas.width = 750;
  167. canvas.height = 1334;
  168. const audio = new Audio('https://cxzx.smcic.net/topic/tool/media/bgm.mp3');
  169. audio.loop = true; // 循环播放
  170. audio.autoplay = 'autoplay';
  171. audio.oncanplay = () => {
  172. let t = setTimeout(() => {
  173. window.WeixinJSBridge &&
  174. window.WeixinJSBridge.invoke(
  175. 'getNetworkType',
  176. {},
  177. () => {
  178. audio.play();
  179. },
  180. false
  181. );
  182. clearTimeout(t);
  183. }, 500);
  184. };
  185. audio.onplaying = () => (play_stats.value = !audio.paused);
  186. audio.onpause = () => (play_stats.value = !audio.paused);
  187. const play = () => {
  188. if (audio.paused) {
  189. // 播放
  190. audio.play();
  191. } else {
  192. // 暂停
  193. audio.pause();
  194. }
  195. };
  196. const look_more = ref(false);
  197. const createhb = () => {
  198. if (img_local) showImagePreview([img_local]);
  199. else show.value = true;
  200. };
  201. const canvas_init = uname => {
  202. return new Promise(resolve => {
  203. const img = new Image();
  204. img.crossOrigin = '';
  205. // 增加随机数选择图片
  206. img.src =
  207. 'https://cxzx.smcic.net/topic/tool/img/' +
  208. Math.ceil(Math.random() * 2) +
  209. '-1.png';
  210. if (!d2) d2 = canvas.getContext('2d');
  211. img.onload = () => {
  212. d2.drawImage(img, 0, 0, 750, 1334);
  213. d2.font = '38px serif';
  214. d2.fillStyle = '#ffffff';
  215. d2.fillText(uname, 300, 500);
  216. resolve();
  217. };
  218. });
  219. };
  220. const onSubmit = e => {
  221. if (e === 'cancel') return true;
  222. if (!username.value) {
  223. showToast('请输入昵称');
  224. return false;
  225. }
  226. saveUser({
  227. userName: username.value,
  228. }).then(r => {
  229. show.value = false;
  230. canvas_init(r.userName).then(() => {
  231. const imgs = canvas.toDataURL('image/png');
  232. showImagePreview([imgs]);
  233. localStorage.setItem('username20230712', username.value);
  234. localStorage.setItem('hb20230712', imgs);
  235. });
  236. });
  237. };
  238. const getTotalFunc = () => {
  239. getTotal().then(r => {
  240. totalUser.value = r.order;
  241. });
  242. };
  243. getTotalFunc();
  244. setInterval(() => {
  245. getTotalFunc();
  246. }, 5000);
  247. </script>
  248. <style>
  249. /* 按钮动画 */
  250. @-webkit-keyframes rotating {
  251. 0% {
  252. transform: rotate(0deg);
  253. }
  254. to {
  255. transform: rotate(1turn);
  256. }
  257. }
  258. @-moz-keyframes rotating {
  259. 0% {
  260. transform: rotate(0deg);
  261. }
  262. to {
  263. transform: rotate(1turn);
  264. }
  265. }
  266. @-o-keyframes rotating {
  267. 0% {
  268. transform: rotate(0deg);
  269. }
  270. to {
  271. transform: rotate(1turn);
  272. }
  273. }
  274. @keyframes rotating {
  275. 0% {
  276. transform: rotate(0deg);
  277. }
  278. to {
  279. transform: rotate(1turn);
  280. }
  281. }
  282. .finance2023 {
  283. width: 100vw;
  284. height: 100vh;
  285. overflow: auto;
  286. font-weight: 400;
  287. padding-bottom: 1em;
  288. background-color: #268f66;
  289. }
  290. .finance2023 .imgbtn {
  291. position: absolute;
  292. top: 16px;
  293. right: 16px;
  294. z-index: 10;
  295. transform-origin: center;
  296. -webkit-animation: rotating 1.2s linear infinite;
  297. -moz-animation: rotating 1.2s linear infinite;
  298. -o-animation: rotating 1.2s linear infinite;
  299. animation: rotating 1.2s linear infinite;
  300. }
  301. .finance2023 .main {
  302. width: 95%;
  303. overflow: hidden;
  304. margin: 0 auto;
  305. color: #626262;
  306. border-radius: 10px;
  307. padding: 1em 1em 105px 1em;
  308. background-color: #f8eac3;
  309. position: relative;
  310. }
  311. .finance2023 .main .inset {
  312. position: absolute;
  313. bottom: 0;
  314. width: 100%;
  315. left: 0;
  316. display: flex;
  317. flex-direction: column-reverse;
  318. height: 150px;
  319. background: -webkit-linear-gradient(#ffffff00, #ffffff 45%);
  320. background: -o-linear-gradient(#ffffff00, #ffffff 45%);
  321. background: -moz-linear-gradient(#ffffff00, #ffffff 45%);
  322. background: linear-gradient(#ffffff00, #ffffff 45%);
  323. }
  324. .finance2023 .main .inset .bottom_set {
  325. width: 100%;
  326. height: 75px;
  327. background-color: #2e946d;
  328. box-shadow: 0 5px 5px #2e946d;
  329. position: relative;
  330. }
  331. .finance2023 .main .inset .bottom_set .btn {
  332. position: absolute;
  333. top: 50%;
  334. left: 50%;
  335. transform: translate(-50%, -50%);
  336. font-size: 12px;
  337. width: 4rem;
  338. height: 4rem;
  339. text-align: center;
  340. line-height: 4rem;
  341. background-color: #f8eac3;
  342. box-shadow: inset 0 0 5px #7e7764;
  343. border-radius: 50%;
  344. }
  345. .finance2023 .main .line_title {
  346. margin-top: -2em;
  347. text-align: center;
  348. color: #60bf9f;
  349. }
  350. .finance2023 .main .header_title {
  351. text-align: center;
  352. margin-bottom: 0.5em;
  353. }
  354. .finance2023 .main .users {
  355. text-align: right;
  356. color: #5db978;
  357. }
  358. .finance2023 .main .users .user_num {
  359. color: #fb0301;
  360. font-size: 1.5em;
  361. }
  362. .finance2023 .main .body {
  363. padding: 0.5em 1em;
  364. background-color: #ffffff;
  365. border-radius: 5px;
  366. }
  367. .finance2023 .main .body .duan {
  368. text-indent: 2em;
  369. line-height: 1.5em;
  370. }
  371. </style>