newyear1.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="icon" href="/static/image/logo.png">
  8. <!--<link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css" rel="stylesheet">-->
  9. <link href="/static/plugs/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet">
  10. <link href="/static/plugs/vuetify/vuetify.css" rel="stylesheet">
  11. <title>新年拜帖</title>
  12. <style>
  13. [v-cloak] {
  14. display: none !important;
  15. }
  16. .page{
  17. background-image: url("/static/image/newyear/bg.png");
  18. background-size: 100% 100%;
  19. }
  20. .page2,.page3{
  21. background-image: url("/static/image/newyear/bg2.png");
  22. background-size: 100% 100%;
  23. }
  24. .page1{
  25. display: flex;
  26. flex-direction:column;
  27. align-items: center;
  28. justify-content: center;
  29. }
  30. .page1 .div1{
  31. /**background-image: url("/static/image/newyear/img1.png");**/
  32. background-size: 100% 100%;
  33. width: 50%;
  34. height: 38%;
  35. margin-top: -15%;
  36. padding: 1em;
  37. }
  38. .page1 .div1 .div1-1,.page1 .div1 .div1-3{
  39. background-image: url("/static/image/newyear/img1_1.png");
  40. height: 10%;
  41. width: 100%;
  42. background-size: 100% 100%;
  43. z-index: 10;
  44. position: relative;
  45. }
  46. .page1 .div1 .div1-3{
  47. margin-top:-5%;
  48. z-index: 10;
  49. }
  50. .page1 .div1 .div1-2{
  51. background-image: url("/static/image/newyear/img1_2.png");
  52. height: 85%;
  53. width: 80%;
  54. background-size: 100% 100%;
  55. margin: 0 auto;
  56. margin-top:-5%;
  57. z-index: 1;
  58. }
  59. .page1 .div1 .msg_div{
  60. padding: 0.7em;
  61. display: flex;
  62. flex-direction:row;
  63. }
  64. .page1 .div1 .msg_div .msg1{
  65. width: 1em;
  66. font-size: 0.8em;
  67. }
  68. .page1 .div1 .msg_div .msg2{
  69. height: 100%;
  70. padding: 0.5em;
  71. flex-grow: 1;
  72. text-align: center;
  73. }
  74. .page1 .div1 .msg_div .msg2 img {
  75. width: 70%;
  76. /*object-fit: contain;*/
  77. }
  78. .page2 .div{
  79. padding: 1em;
  80. text-align: center;
  81. height: 100%;
  82. }
  83. .page2 .div .update_btn_div{
  84. margin-top: 2em;
  85. }
  86. .page2 .update_btn_div .btn1,.page2 .image_div .btn ,.page3 .div4 .btn{
  87. background:#e79713;
  88. color: #9a021a;
  89. width: 60%;
  90. text-align: center;
  91. border-radius: 5px;
  92. margin: 0 auto;
  93. padding-top: 0.5em;
  94. padding-bottom: 0.5em;
  95. }
  96. .page2 .input_div textarea{
  97. background:rgba(255, 255, 255, 0.5);
  98. }
  99. .page2 .up_info_div{
  100. text-align: left;
  101. padding-top: 1em;
  102. min-height: 10%;
  103. width: 80%;
  104. margin:0 auto;
  105. font-size: 18px;
  106. word-wrap:break-word;
  107. word-break:normal;
  108. letter-spacing:2px;
  109. color: #e2ae69;
  110. }
  111. .page2 .image_div .upload_img_div{
  112. height: 100%;
  113. position: relative;
  114. }
  115. .page2 .image_div
  116. {
  117. height: 45%;
  118. margin-top: 2em;
  119. }
  120. .page2 .image_div .row{
  121. display: flex;
  122. flex-direction: row;
  123. padding: 0 2.5em;
  124. height: 35%;
  125. }
  126. .page2 .image_div .row div{
  127. flex-grow: 1;
  128. height: 100%;
  129. padding: 0.3em;
  130. }
  131. .page2 .image_div .btn{
  132. font-size: 14px;
  133. height: auto !important;
  134. position: absolute;
  135. bottom: 10%;
  136. width: 70%;
  137. left: 15%;
  138. padding-top: 0.5em;
  139. padding-bottom: 0.5em;
  140. padding-top: 0.3em !important;
  141. padding-bottom: 0.3em !important;
  142. }
  143. #uploadfile{
  144. visibility: hidden;
  145. }
  146. .page3{
  147. padding: 2em;
  148. }
  149. .page3 .div1,.page3 .div3{
  150. padding-top: 2em;
  151. display: flex;
  152. flex-direction: row;
  153. }
  154. .page3 .div1
  155. {
  156. padding-top: 20%;
  157. }
  158. .page3 .div1 .div1-1{
  159. /*flex-grow: 1;*/
  160. width: 40%;
  161. }
  162. .page3 .div1 .div1-2{
  163. width: 60%;
  164. }
  165. .page3 .div3 .div3-1,.page3 .div3 .div3-2{
  166. /*flex-grow: 1;*/
  167. width: 50%;
  168. }
  169. .page3 .div1 .div1-1{
  170. text-align: center;
  171. }
  172. .page3 .div1 .div1-2{
  173. font-weight: bold;
  174. font-size: 20px;
  175. }
  176. .page3 .div2{
  177. padding: 2em;
  178. font-size: 20px;
  179. letter-spacing:2px;
  180. }
  181. .page3 .div3{
  182. padding: 2em;
  183. font-size: 18px;
  184. }
  185. .page3 .div3 .div3-2{
  186. display: flex;
  187. flex-direction: column;
  188. align-items: center;
  189. padding-left: 0.5em;
  190. letter-spacing:2px;
  191. font-size: 18px;
  192. }
  193. .page3 .logo{
  194. width: 40%;
  195. object-fit: contain;
  196. }
  197. .page3 .watch{
  198. width: 80%;
  199. object-fit: contain;
  200. }
  201. .page3 .div4 .btn{
  202. font-size: 20px;
  203. }
  204. audio{
  205. visibility: hidden;
  206. }
  207. .loading{
  208. display: flex;
  209. flex-direction: row;
  210. align-items: center;
  211. color:#e79713;
  212. background: #9a021a;
  213. }
  214. .loading .content{
  215. margin: 0 auto;
  216. }
  217. .loading .content i{
  218. font-size: 100px;
  219. color:#e79713;
  220. }
  221. .hidden{
  222. visibility: hidden;
  223. height: 0px;
  224. overflow: hidden;
  225. }
  226. </style>
  227. </head>
  228. <body>
  229. <div id="app" v-cloak>
  230. <audio src="/static/image/newyear/music1.mp3" loop="loop" preload="auto" id="bg-music">
  231. </audio>
  232. <div v-if="isloading" class="loading">
  233. <div class="content"><v-icon>fa fa-spinner fa-spin</v-icon></div>
  234. </div>
  235. <div :class="{hidden:isloading}">
  236. <div class="page page1">
  237. <div class="div1">
  238. <div class="div1-1">
  239. </div>
  240. <div class="div1-2">
  241. <div class="msg_div" v-if="upinfo">
  242. <div class="msg1">
  243. {{upinfo.userinfo.wname}}祝您新年<br/>:
  244. </div>
  245. <div class="msg2">
  246. <img src="/static/image/newyear/img1_3.png" alt="">
  247. </div>
  248. </div>
  249. </div>
  250. <div class="div1-3">
  251. </div>
  252. </div>
  253. </div>
  254. <div class="page page2">
  255. <div class="div">
  256. <div class="update_btn_div">
  257. <div v-if="isnew">
  258. <div class="btn1" v-if="!isupdateinfo" @click="updateinfo">
  259. 点&nbsp;击&nbsp;修&nbsp;改&nbsp;文&nbsp;字
  260. </div>
  261. <div class="btn1" v-else @click="saveinfo">
  262. 点&nbsp;击&nbsp;保&nbsp;存&nbsp;文&nbsp;字
  263. </div>
  264. </div>
  265. </div>
  266. <div class="up_info_div">
  267. <div v-if="isupdateinfo && isnew">
  268. <div class="input_div">
  269. <v-textarea name="info" v-model="up_info" rows="3" :value="up_info" :hint="up_info_str"></v-textarea>
  270. </div>
  271. </div>
  272. <div v-else>
  273. <pre>{{ up_info }}</pre>
  274. </div>
  275. </div>
  276. <div class="image_div">
  277. <div id="uploadfile_div">
  278. <input type="file" accept="image/*" id="uploadfile">
  279. </div>
  280. <div class="row row1">
  281. <div>
  282. <div class="upload_img_div" id="img1" :style="{ 'background-image': imglist[0] }">
  283. <div class="btn" v-if="isnew" @click="uploadimg" data-index="1">点击上传</div>
  284. </div>
  285. </div>
  286. <div>
  287. <div class="upload_img_div" id="img2" data-index="2">
  288. <div class="btn" v-if="isnew" @click="uploadimg" data-index="2">点击上传</div>
  289. </div>
  290. </div>
  291. </div>
  292. <div class="row row1">
  293. <div>
  294. <div class="upload_img_div" id="img3" data-index="3">
  295. <div class="btn" v-if="isnew" @click="uploadimg" data-index="3">点击上传</div>
  296. </div>
  297. </div>
  298. <div>
  299. <div class="upload_img_div" id="img4" data-index="4">
  300. <div class="btn" v-if="isnew" @click="uploadimg" data-index="4">点击上传</div>
  301. </div>
  302. </div>
  303. </div>
  304. <div class="row row1">
  305. <div>
  306. <div class="upload_img_div" id="img5" data-index="5">
  307. <div class="btn" v-if="isnew" @click="uploadimg" data-index="5">点击上传</div>
  308. </div>
  309. </div>
  310. <div>
  311. <div class="upload_img_div" id="img6" data-index="6">
  312. <div class="btn" v-if="isnew" @click="uploadimg" data-index="6">点击上传</div>
  313. </div>
  314. </div>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. <div class="page page3">
  320. <div class="div1">
  321. <div class="div1-1">
  322. <img src="/static/image/newyear/logo.png" alt="" class="logo">
  323. </div>
  324. <div class="div1-2">
  325. <p>水猫工匠平台</p>
  326. <p>专注于招工找活</p>
  327. </div>
  328. </div>
  329. <div class="div2">
  330. <!--目前平台免费帮工友和老板朋友进行招工找活服务,注册送、用就送、天天送积分!覆盖天津二十万零散工,
  331. 欢迎您对平台多提宝贵意见,我们会逐步完善,水猫工匠平台欢迎您的加入。-->
  332. </div>
  333. <div class="div3">
  334. <div class="div3-1">
  335. <img src="/static/image/newyear/watch.png" alt="" class="watch">
  336. </div>
  337. <div class="div3-2">
  338. 扫描二维码登录水猫工匠平台免费制作自己的拜年贴。
  339. </div>
  340. </div>
  341. <div class="div4" v-if="isnew">
  342. <div class="btn" @click="showresult">点&nbsp;击&nbsp;查&nbsp;看&nbsp;制&nbsp;作&nbsp;预&nbsp;览</div>
  343. </div>
  344. </div>
  345. </div>
  346. </div>
  347. <script>
  348. var info = {php}echo json_encode($info);{/php};
  349. var sharedata = {php}echo json_encode($sharedata);{/php};
  350. </script>
  351. <script src="/static/plugs/vue/vue.js"></script>
  352. <script src="/static/plugs/jquery/jquery.js"></script>
  353. <script src="/static/plugs/vuetify/vuetify.js"></script>
  354. <script src="/static/plugs/wechat/jweixin-1.0.0.js"></script>
  355. <!--<script src="/static/plugs/jssha/sha.js"></script>-->
  356. <script src="/static/plugs/js-sha1/sha1.js"></script>
  357. <!--<script src="/static/plugs/wechat/wx_share_config.js"></script>-->
  358. <script>
  359. var url =window.location.href;
  360. //alert(url)
  361. var string = "jsapi_ticket=" +sharedata.ticket + "&noncestr=" + sharedata.nonceStr+ "&timestamp=" +sharedata. timestamp + "&url=" + url;
  362. sign = sha1(string)
  363. wx.config({
  364. debug:false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  365. appId:sharedata.appid, // 必填,企业号的唯一标识,此处填写企业号corpid
  366. timestamp:sharedata.timestamp , // 必填,生成签名的时间戳
  367. nonceStr:sharedata.nonceStr, // 必填,生成签名的随机串
  368. signature: sign,// 必填,签名,见附录1
  369. jsApiList:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  370. });
  371. wx.error(function(res){
  372. // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
  373. //alert(11)
  374. //alert(JSON.stringify(res));
  375. });
  376. var share_info = {
  377. title:info.title,
  378. desc:info.title,
  379. link:url,
  380. imgUrl:info.previewurl
  381. };
  382. //alert(JSON.stringify(share_info));
  383. </script>
  384. <script src="/static/plugs/wechat/wx_share.js"></script>
  385. <script>
  386. var app = new Vue({
  387. el: '#app',
  388. vuetify: new Vuetify(),
  389. data: {
  390. loading:true,
  391. imglist : [
  392. {id:0,url:'/static/image/newyear/img2_1.png'},
  393. {id:0,url:'/static/image/newyear/img2_2.png'},
  394. {id:0,url:'/static/image/newyear/img2_3.png'},
  395. {id:0,url:'/static/image/newyear/img2_4.png'},
  396. {id:0,url:'/static/image/newyear/img2_5.png'},
  397. {id:0,url:'/static/image/newyear/img2_6.png'},
  398. ],
  399. up_info_str:'个人简介',
  400. up_info:'',
  401. upinfo:false,
  402. info:info,
  403. isnew:true,
  404. isstart:true,
  405. userid:0,
  406. code:'',
  407. isupdateinfo:false,
  408. },
  409. computed: {
  410. isloading: function () {
  411. if(this.loading){
  412. return true
  413. }
  414. if(!this.upinfo){
  415. return true
  416. }
  417. return false
  418. }
  419. },
  420. methods:{
  421. updateinfo(){
  422. this.isupdateinfo=true
  423. },
  424. saveinfo(){
  425. var that = this;
  426. const url = "/index.php/index/party/saveinfo"
  427. const data ={
  428. 'id':this.upinfo.id,
  429. 'info':this.up_info
  430. }
  431. $.ajax({
  432. type: 'POST',
  433. url: url,
  434. data: data,
  435. dataType: "json",
  436. success: function(res){
  437. res = JSON.parse(res);
  438. if(200!=res.code){
  439. alert(res.msg);
  440. }else{
  441. that.isupdateinfo=false
  442. }
  443. }
  444. });
  445. },
  446. initpage(){
  447. var str = window.location.search;
  448. let param = {}
  449. str = str.substr(1);
  450. var strarr = str.split("&");
  451. for(var i=0;i<strarr.length;i++){
  452. var arr1 = strarr[i].split("=");
  453. param[arr1[0]] = arr1[1];
  454. }
  455. this.userid = param.userid;
  456. this.code = param.code;
  457. this.showinfo = 1==param.showinfo?true:false;
  458. this.getupinfo()
  459. this.sethtmlimglist()
  460. this.setimages()
  461. },
  462. distinctArrObj(arr) {
  463. var MyShow=(typeof arr!="object")? [arr] : arr //确保参数总是数组
  464. for (let i = 0; i < MyShow.length; i++) {
  465. if (MyShow[i] == null || MyShow[i] == "" || JSON.stringify(MyShow[i]) == "{}") {
  466. MyShow.splice(i, 1);
  467. i = i - 1;
  468. }
  469. }
  470. return MyShow;
  471. },
  472. getupinfo(){
  473. const url = "/index.php/index/party/partinparty"
  474. const data ={
  475. 'code':this.code,
  476. 'userid':this.userid
  477. }
  478. var that = this;
  479. $.ajax({
  480. type: 'POST',
  481. url: url,
  482. data: data,
  483. dataType: "json",
  484. success: function(res){
  485. res = JSON.parse(res);
  486. if(200!=res.code){
  487. alert(res.msg);
  488. }else{
  489. that.upinfo = res.data;
  490. that.up_info = that.upinfo.info;
  491. if(that.showinfo){
  492. that.isnew = false
  493. }else{
  494. if(that.upinfo.isnew){
  495. that.isnew = true
  496. }else{
  497. if(0==that.upinfo.isover){
  498. that.isnew = true
  499. }else{
  500. that.isnew = false
  501. }
  502. }
  503. }
  504. //that.isnew =that.upinfo.isnew;
  505. if(that.isnew){
  506. that.isupdateinfo=true
  507. }
  508. share_info.desc=that.upinfo.userinfo.wname+"祝您新年快乐"
  509. }
  510. }
  511. });
  512. },
  513. setimages(){
  514. const url = "/index.php/index/party/getpicture"
  515. const data ={
  516. 'partyid':this.info.id,
  517. 'userid':this.userid
  518. }
  519. var that = this;
  520. $.ajax({
  521. type: 'POST',
  522. url: url,
  523. data: data,
  524. dataType: "json",
  525. success: function(res){
  526. res = JSON.parse(res);
  527. if(200!=res.code){
  528. //alert(res.msg);
  529. }else{
  530. const data = res.data;
  531. const list = data.list;
  532. $.each(list,function(index,term){
  533. that.imglist[term.sort-1].id = term.id
  534. that.imglist[term.sort-1].url = term.pictureurl
  535. });
  536. that.sethtmlimglist();
  537. }
  538. }
  539. });
  540. },
  541. sethtmlimglist(){
  542. $.each(this.imglist,function(index,term){
  543. const id = index+1;
  544. //"background-position": "center",
  545. $('.image_div #img'+id).css({'background-image':"url("+term.url+")","background-size":"100% 100%"});
  546. });
  547. },
  548. uploadimg(e){
  549. let index = $(e.target).data('index');
  550. console.log(index);
  551. let id = this.imglist[index-1].id;
  552. let that = this
  553. myFile = $('#uploadfile');
  554. myFile.click()
  555. myFile.unbind().change(function (e) {
  556. url = "/index.php/index/fileoper/uploadfilebydir";
  557. var formData = new window.FormData()
  558. //formData.append('userid', this.userid);
  559. //formData.append('partyid', this.partyid);
  560. //formData.append('id', id);
  561. formData.set('dir', "party");
  562. formData.set('file', document.querySelector('input[type=file]').files[0])
  563. var xhr=new XMLHttpRequest();
  564. xhr.open("post",url);
  565. xhr.send(formData);
  566. xhr.onload=function(){
  567. res = JSON.parse(xhr.response);
  568. if(200!=res.code){
  569. alert(res.resultData);
  570. }else{
  571. myFile.val('')
  572. formData.delete('dir')
  573. formData.delete('file')
  574. var pictureurl = res.resultData;
  575. that.imglist[index-1].url = pictureurl;
  576. that.sethtmlimglist()
  577. that.saveimg(index)
  578. }
  579. }
  580. });
  581. },
  582. saveimg(index){
  583. var that = this
  584. let id = this.imglist[index-1].id;
  585. let imgurl = this.imglist[index-1].url;
  586. var imgdata = {
  587. 'id':id,
  588. 'userid':this.userid,
  589. 'partyid':this.info.id,
  590. 'pictureurl':imgurl,
  591. 'sort':index
  592. };
  593. var url = "/index.php/index/party/savepicture"
  594. $.ajax({
  595. type: 'POST',
  596. url: url,
  597. data: imgdata,
  598. dataType: "json",
  599. success: function(res){
  600. res = JSON.parse(res);
  601. if(200!=res.code){
  602. alert(res.msg);
  603. }else{
  604. const data = res.data;
  605. const id = data.id;
  606. that.imglist[index-1].id = id
  607. }
  608. }
  609. });
  610. },
  611. showresult(){
  612. var data={
  613. 'id':this.upinfo.id
  614. }
  615. var url = "/index.php/index/party/setisoverbyid"
  616. $.ajax({
  617. type: 'POST',
  618. url: url,
  619. data: data,
  620. dataType: "json",
  621. success: function(res){
  622. res = JSON.parse(res);
  623. if(200!=res.code){
  624. alert(res.msg);
  625. }else{
  626. window.location.href = location.href;
  627. $('html ,body').animate({ scrollTop: -10 }, 500);
  628. }
  629. }
  630. });
  631. },
  632. audioAutoPlay() {
  633. let that = this
  634. let audio = document.getElementById("bg-music");
  635. if(this.isWeiXin()){
  636. document.addEventListener('WeixinJSBridgeReady', function() {
  637. that.loading=false
  638. audio.play();
  639. $("body").one("touchstart",function() {
  640. audio.play();
  641. });
  642. })
  643. }else{
  644. audio.addEventListener('canplaythrough', function () {
  645. that.loading=false
  646. audio.play();
  647. //取消加载中
  648. }, false);
  649. }
  650. },
  651. isWeiXin(){
  652. //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
  653. var ua = window.navigator.userAgent.toLowerCase();
  654. //alert(JSON.stringify(ua))
  655. //通过正则表达式匹配ua中是否含有MicroMessenger字符串
  656. if(ua.match(/MicroMessenger/i) == 'micromessenger'){
  657. return true;
  658. } else{
  659. return false;
  660. }
  661. },
  662. },
  663. mounted() {
  664. this.audioAutoPlay();
  665. $('#uploadfile').hide()
  666. this.isstart= this.info.isstart;
  667. const height = $(window).height();
  668. $('.page').height(height);
  669. $('.loading').height(height);
  670. if(!this.isstart){
  671. alert("活动未开始");
  672. }else{
  673. this.initpage();
  674. }
  675. }
  676. })
  677. </script>
  678. </body>
  679. </html>