| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>点亮五菱</title>
- <!--引入 element-ui 的样式,-->
- <link rel="stylesheet"
- href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
- <!-- 必须先引入vue, 后使用element-ui -->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
- <!-- 引入element 的组件库-->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
- <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
- <!-- <script>
- var vConsole = new window.VConsole();
- </script> -->
- </head>
- <style>
- body {
- margin: 0;
- padding: 0;
- }
- .box {
- width: 100vw;
- height: 100vh;
- box-sizing: border-box;
- background: #FAFAFA;
- }
- .page6 {
- width: 100vw;
- height: 100vh;
- background: url('./img/wl_bg.png') no-repeat center;
- background-size: 100vw 100vh;
- background-repeat: no-repeat;
- }
- .wl_no {
- width: 100%;
- margin-top: 260px;
- }
- .wl_btn {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- margin-top: 150px;
- }
- .image_wrapper {
- position: relative;
- display: inline-block;
- }
- .image_wrapper img {
- height: 68px;
- display: block;
- /* 移除图片底部间隙 */
- }
- .btn_text {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- font-weight: 500;
- font-size: 20px;
- color: #FFFFFF;
- }
- .ask {
- background: #FEC99D;
- }
- .step {
- display: flex;
- justify-content: center;
- align-items: center;
- padding-top: 27px;
- }
- .step span {
- font-size: 14px;
- color: #BC7E4B;
- }
- .step_line {
- width: 30px;
- height: 1px;
- background: #BC7E4B;
- margin: 0 5px;
- }
- .ask_btn {
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 10px;
- margin-top: 20px;
- }
- .ask_btn img {
- width: 50px;
- height: 50px;
- }
- .activity_box {
- width: 100%;
- background: #FEE8D0;
- border-radius: 20px 20px 0 0;
- padding: 20px 15px;
- box-sizing: border-box;
- margin-top: 20px;
- }
- .lottery {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px;
- box-sizing: border-box;
- background: #FFFFFF;
- border-radius: 15px;
- margin-bottom: 15px;
- }
- .award {
- display: flex;
- align-items: center;
- gap: 10px;
- }
- .award_ac {
- width: 58px;
- height: 58px;
- background: #F5E3D4;
- border-radius: 10px;
- }
- .award_tip {
- font-size: 14px;
- color: #999999;
- }
- .award_title {
- font-weight: 500;
- font-size: 16px;
- color: #FF765B;
- padding-bottom: 5px;
- }
- .award_btn {
- font-weight: 500;
- font-size: 14px;
- color: #FFFFFF;
- padding: 3px 8px;
- background: #CCCCCC;
- border-radius: 13px;
- }
- .award_btn_ac {
- font-weight: 500;
- font-size: 14px;
- color: #FFFFFF;
- padding: 3px 8px;
- background: #FF7979;
- border-radius: 13px;
- }
- .prize_dialog {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- /* 半透明黑色 */
- z-index: 1000;
- /* 确保遮罩层在顶部 */
- transition: opacity 0.5s ease;
- /* 可选:添加透明度过渡效果 */
- }
- .dialog_body {
- width: 100%;
- height: 100%;
- z-index: 1001;
- /* 确保遮罩层在顶部 */
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .dialog_bg {
- width: 275px;
- height: 370px;
- position: relative;
- }
- .qrcode {
- width: 125px;
- height: 125px;
- position: absolute;
- bottom: 260px;
- }
- .save_btn {
- padding: 15px 77px;
- background: #FFFFFF;
- border-radius: 29px;
- font-weight: 500;
- font-size: 14px;
- color: #222222;
- margin-top: 20px;
- }
- .activity_title {
- font-weight: bold;
- font-size: 14px;
- color: #CB4E35;
- padding-top: 5px;
- }
- .activity_msg {
- font-size: 14px;
- color: #CB4E35;
- }
- </style>
- <body>
- <div id="box" class="box">
- <div class="page6">
- <img class="wl_no" v-if="!lightData.wxcpLightenClientList.length" src="./img/wl_no.png" />
- <img class="wl_no" v-else-if="lightData.wxcpLightenClientList.length = 1" src="./img/light_one.png" />
- <img class="wl_no" v-else-if="lightData.wxcpLightenClientList.length = 2" src="./img/light_two.png" />
- <img class="wl_no" v-else-if="lightData.wxcpLightenClientList.length = 3" src="./img/light_three.png" />
- <img class="wl_no" v-else-if="lightData.wxcpLightenClientList.length = 4" src="./img/light_four.png" />
- <img class="wl_no" v-else-if="lightData.wxcpLightenClientList.length = 5" src="./img/light_five.png" />
- <div class="wl_btn" @click="handleAsk">
- <div class="image_wrapper">
- <img class="btn_img" src="./img/wl_btn.png" />
- <div class="btn_text">{{lightData.wxcpLightenClientList.length == 5 ? '点亮成功,解锁终极大奖' : '邀请好友点亮'}}</div>
- </div>
- </div>
- </div>
- <div class="ask">
- <div class="step">
- <span>1.生成海报</span>
- <span class="step_line"></span>
- <span>2.邀请好友</span>
- <span class="step_line"></span>
- <span>3.完成任务</span>
- </div>
- <div class="ask_btn">
- <img src="./img/ask_btn.png" />
- <img src="./img/ask_btn.png" />
- <img src="./img/ask_btn.png" />
- <img src="./img/ask_btn.png" />
- <img src="./img/ask_btn.png" />
- </div>
- <div class="activity_box">
- <div class="lottery">
- <div class="award">
- <div class="award_ac"></div>
- <div class="award_tip">
- <div class="award_title">好运抽奖</div>
- <div>每邀请1人点亮即可抽奖1次</div>
- </div>
- </div>
- <div :class="lightData.raffle1Num ? 'award_btn_ac' : 'award_btn'">{{lightData.raffle1Num ? '去抽奖' : '未完成'}}
- </div>
- </div>
- <div class="lottery">
- <div class="award">
- <div class="award_ac"></div>
- <div class="award_tip">
- <div class="award_title">终极大奖</div>
- <div>完全点亮即可抽取终极大奖!</div>
- </div>
- </div>
- <div :class="lightData.raffle2Num ? 'award_btn_ac' : 'award_btn'">{{lightData.raffle2Num ? '去抽奖' : '未完成'}}
- </div>
- </div>
- <div class="activity_title">活动信息</div>
- <div class="activity_msg" v-html="lightData.wxcpLighten.activityInfo"></div>
- </div>
- </div>
- <!-- 邀请弹窗 -->
- <div class="prize_dialog" v-if="showAskDialog">
- <div class="dialog_body">
- <img class="dialog_bg" :src="lightData.urlPost" />
- <!-- <img class="dialog_bg" src="./img/ask_bg.png" />
- <img class="qrcode" src="./img/prize-bg.png" /> -->
- <div class="save_btn" @click="saveImage">保存图片</div>
- </div>
- </div>
- </div>
- </body>
- <script>
- new Vue({
- el: '#box',
- data () {
- return {
- httpUrl: '',
- bId: null,
- env: '',
- showAskDialog: false,
- lightData: {
- wxcpLightenClientList: []
- },
- }
- },
- created () {
- this.bId = this.getQueryParam('bId')
- this.env = this.getQueryParam('env')
- if (!this.env || this.env === 'prod') {
- this.httpUrl = 'https://wlapi.wefanbot.com'
- } else {
- // this.httpUrl = 'http://test.wefanbot.com:18993'
- this.httpUrl = 'http://192.168.1.147:18993'
- }
- this.ifH5Type()
- },
- methods: {
- ifH5Type () {
- if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
- if (!this.getQueryParam('externalUserid')) {
- this.gerQwAuth(this.bId);
- } else {
- this.lightenShare()
- }
- } else {
- // 走授权操作
- this.getAuth();
- }
- },
- getAuth () {
- // 获取url上的code
- let code = this.getQueryParam('code')
- if (code) {
- fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- localStorage.setItem('openId', data.openId)
- this.ifH5Type()
- }
- })
- } else {
- let redirect_uri = window.location.href
- // code 不存在,走微信网页授权逻辑
- let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
- window.location.replace(url)
- }
- },
- // 企微授权
- gerQwAuth (bId) {
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
- fetch(this.httpUrl + `/p/insuite/p/getOAUrl?openId=${openId}&bId=${bId}`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- window.location.replace(data)
- } else {
- this.$message({
- message: msg,
- type: 'warning'
- })
- }
- })
- },
- lightenShare () {
- let externalUserid = this.getQueryParam('externalUserid')
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
- const headers = new Headers();
- headers.append('police', 110);
- fetch(this.httpUrl + `/scrm/v1/wxcp-lighten-share/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
- method: 'GET',
- headers: headers
- })
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- this.lightData = data
- console.log('dd', this.lightData.wxcpLightenClientList);
- } else {
- this.$message({
- message: msg,
- })
- }
- })
- },
- handleAsk () {
- if (this.lightData.wxcpLightenClientList.length < 5) {
- this.showAskDialog = true
- } else {
- this.$message({
- message: '解锁终极大奖',
- })
- }
- },
- // 保存图片
- saveImage () {
- const link = document.createElement('a')
- link.href = this.lightData.urlPost
- link.download = 'urlPost.jpg'
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- this.showAskDialog = false
- },
- // 截取url中的数据
- getQueryParam (paramName) {
- // 获取当前URL的查询字符串部分
- const queryString = window.location.search;
- // 创建一个URLSearchParams对象
- const urlParams = new URLSearchParams(queryString);
- // 返回指定参数的值,如果不存在则返回null
- return urlParams.get(paramName);
- },
- }
- })
- </script>
- </html>
|