Commit b8b162ca authored by 付清曌's avatar 付清曌

Merge branch 'feature/beta2' into 'master'

Feature/beta2

See merge request !41
parents 7d17444f c5216180
{"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy":{"size":1382,"mtime":1591613433299,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js":{"size":1542,"mtime":1591685943700,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js":{"size":85,"mtime":1589422331949,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js":{"size":708,"mtime":1591238093271,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js":{"size":1912,"mtime":1591760409358,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js","messages":[],"errorCount":0,"warningCount":0,"output":"import wepy from '@wepy/core';\nimport Notify from '../components/vant/notify/notify';\n\nconst env = 'test'; // 每次上线手动切换成 prod/test\nlet baseUrl = 'https://api-luckii.q-gp.com';\nif (env === 'test') {\n baseUrl = 'https://luckii-qa.liangkebang.net';\n}\nconst request = async (url, options) => {\n const pages = getCurrentPages();\n const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false;\n const defaultOptions = {\n method: 'post',\n header: { 'content-type': 'application/x-www-form-urlencoded' }\n };\n options = { ...defaultOptions, ...options };\n options.header = {\n ...options.header,\n openid: wx.getStorageSync('openId') || ''\n };\n\n url = baseUrl + url;\n\n const isConnected = wx.getStorageSync('onNetworkStatusChange');\n if (!isConnected) {\n wx.showToast({\n title: '无网络',\n icon: 'loading',\n duration: 2000\n });\n return;\n }\n\n return wepy.wx.request({\n url: url,\n data: options.data,\n method: options.method,\n header: options.header\n }).then(res => {\n let msg = res.data.msg || '服务器异常';\n if (res.statusCode === 200) {\n if (res.data.code === 2000) {\n return res.data.data;\n }\n Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop });\n throw new Error(msg + ',请求url:' + url + '请求返回:' + res.data);\n }\n Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop });\n throw new Error(msg + ',请求url:' + url + '请求返回:' + res.data);\n });\n};\n\nconst post = (url, data, header) => {\n const options = {\n method: 'post',\n data,\n header\n };\n if (!header) delete options.header;\n return request(url, options);\n};\n\nconst get = (url, data) => {\n const options = {\n method: 'get',\n data\n };\n return request(url, options);\n};\n\nmodule.exports = {\n post: post,\n get: get,\n request\n};\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js":{"size":98459,"mtime":1591238093273,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy":{"size":775,"mtime":1591668495264,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy":{"size":1449,"mtime":1591613433302,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy":{"size":17057,"mtime":1591613433303,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy":{"size":4240,"mtime":1591613433304,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy":{"size":7858,"mtime":1591613433305,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy":{"size":11372,"mtime":1591613433306,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy":{"size":3928,"mtime":1590659119391,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy":{"size":898,"mtime":1589889870499,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy":{"size":2957,"mtime":1591613433311,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy":{"size":22663,"mtime":1591698017011,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<style lang=\"less\">\n @import \"../style/common\";\n page{\n height: 100%;\n background-color: #000;\n }\n .video-wrapper{\n width: 100%;\n height: 100%;\n }\n #myvideo{\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 0;\n background-color:rgba(0, 0, 0, 0.7);\n }\n .userInfo{\n position: fixed;\n z-index: 10;\n top:100rpx;\n left: 30rpx;\n }\n .userinfo-button {\n width: 80rpx;\n height: 80rpx;\n padding: 0;\n border: none;\n background-color: transparent;\n &::after {\n border: none;\n };\n .userinfo-image {\n width: 80rpx;\n height: 80rpx;\n border-radius: 50%;\n }\n }\n\n .userimage{\n width: 80rpx;\n height: 80rpx;\n border-radius: 50%;\n }\n @-webkit-keyframes fadeout {\n 0% {\n opacity:1 ;\n }\n 100% {\n opacity: 0;\n }\n }\n .content{\n position: absolute;\n z-index: 9;\n bottom: 400rpx;\n width: 100%;\n color: @whitecolor;\n clear: both;\n &.anima {\n animation:fadeout 2s;\n }\n &.hide {\n display: none;\n }\n }\n .leftcont {\n width: 44%;\n float: left;\n font-size: @font-normal;\n margin-left: 30rpx;\n }\n .list-wrapper {\n height: 120rpx;\n }\n .leftcont .img {\n width: 40rpx;\n height: 40rpx;\n border-radius: 50%;\n vertical-align: middle;\n }\n .leftcont .text {\n max-width: 200rpx;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: 10rpx;\n vertical-align: middle;\n border-radius: 20rpx;\n display: inline-block;\n font-size: @font-small;\n box-sizing: border-box;\n padding:6rpx 15rpx;\n background-color:rgba(238, 238, 238, 0.2);\n }\n\n .footer {\n position: absolute;\n z-index: 9;\n bottom: 20rpx;\n width: 100%;\n }\n .footswiper {\n height: 360rpx;\n }\n .list-item{\n width:220rpx;\n /*height: 330rpx;*/\n background-color:@whiteback;\n border-radius: 10rpx;\n transform: scale(0.7,0.7) translateY(65rpx);\n transition: all 0.5s;\n padding:10rpx 10rpx 5rpx 10rpx;\n margin:0 auto;\n margin-top: 2rpx;\n position: relative;\n }\n .list-item image {\n width: 210rpx;\n display: block;\n height: 210rpx;\n margin:0 auto;\n border-radius: 10rpx;\n }\n .list-item .text {\n font-size: @font-small;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; //行数\n -webkit-box-orient: vertical;\n overflow: hidden;\n line-height:24rpx;\n margin-top:10rpx;\n }\n .list-item .price{\n color:@maincolor;\n font-size:@font-common;\n margin-top:2rpx;\n }\n .list-item .buy{\n font-size: 16rpx;\n color:@darkgrey;\n }\n .list-item.subright {\n transform: scale(0.85,0.85) translateY(26rpx) translateX(25rpx);\n }\n .list-item.subleft {\n transform: scale(0.85,0.85) translateY(26rpx) translateX(-25rpx);\n }\n .list-item.select{\n transform: scale(1,1);\n bottom: 2rpx;\n }\n .list-item.delete {\n opacity:0;\n transform:translateY(-220rpx)\n }\n .authmodal{\n width:100%;\n height:100%;\n background-color: rgba(0,0,0,0.7);\n position: fixed;\n z-index:20;\n .wrap {\n width: 90%;\n margin:0 auto;\n position: relative;\n top:200px;\n padding: 50rpx 0;\n background-color: @whiteback;\n border-radius: 20rpx;\n .text {\n color:#333;\n text-align: center;\n padding-top:30rpx;\n padding-bottom: 60rpx;\n }\n button {\n width:80%;\n }\n }\n }\n</style>\n<wxs module=\"tools\" src=\"../common/common.wxs\"></wxs>\n<template>\n <view class=\"video-wrapper\">\n <view id=\"myvideo\">\n <van-notify id=\"van-notify\" />\n <prize-list v-if=\"videoList && videoList.length\" :videoList.sync=\"videoList\" :userAccount=\"mainInfo && mainInfo.account && mainInfo.account.quantity || 0\" :total=\"total\" bindchange=\"changeVideo\" @getAwardsInfo=\"getAwardsInfo\">\n </prize-list>\n </view>\n <view class=\"userInfo\" style=\"{{userImgStyle}}\">\n <button v-if=\"authmodal\" open-type=\"getUserInfo\" bindgetuserinfo=\"getUserInfo\" class=\"userinfo-button\">\n <image class=\"userinfo-image\" src=\"{{userInfo.avatarUrl || '/static/images/user@2x.png'}}\"></image>\n </button>\n <image v-if=\"!authmodal\" @tap=\"showMenu(!showMenus)\" src=\"{{userInfo.avatarUrl || '/static/images/user@2x.png'}}\" mode=\"cover\" class=\"userimage\"></image>\n </view>\n <view>\n <gold type=\"gold\" :des=\"mainInfo && mainInfo.account && mainInfo.account.quantity || 0\" :gold=\"sign\" :isReceive=\"isReceive\"></gold>\n <sign type=\"sign\" des=\"签到\" :sign=\"sign\" @sign-in=\"signIn\"></sign>\n <lottery type=\"lottery\" des=\"抽奖\" @getAwards=\"getAwards\" @getUserInfo=\"getUserInfo\" :authmodal=\"authmodal\"></lottery>\n <share type=\"share\" des=\"分享\"></share>\n </view>\n <view class=\"content {{isActiveDone}}\" >\n <view class=\"leftcont\">\n <swiper\n class=\"list-wrapper\"\n vertical=\"{{true}}\"\n circular=\"{{true}}\"\n display-multiple-items=\"{{activityDisplayItems}}\"\n bindchange=\"onActivityChange\"\n autoplay=\"{{isAuto}}\"\n interval=\"1500\">\n <swiper-item wx:for=\"{{activityList}}\" wx:key=\"index\" catch:touchmove>\n <view class=\"imgwrap\">\n <image class=\"img\" src=\"{{item.avatarUrl}}\"></image>\n <view class=\"text\">{{item.content}}</view>\n </view>\n </swiper-item>\n </swiper>\n </view>\n </view>\n <!-- <view class=\"footer\">\n <swiper\n class=\"footswiper\"\n display-multiple-items=\"{{swiperItem}}\"\n current=\"{{current}}\"\n bindchange=\"moveSwiper\"\n bindanimationfinish=\"swipermoveDone\"\n circular=\"{{circular}}\"\n previous-margin=\"140rpx\"\n next-margin=\"120rpx\"\n catch:touchmove\n >\n bindtouchstart=\"touchStart\"\n bindtouchend=\"touchEnd\"\n <swiper-item wx:for=\"{{list}}\" wx:key=\"index\">\n <view\n data-itemid=\"{{index}}\"\n bindtap=\"toViewPage\"\n data-item=\"{{item}}\"\n class=\"list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length)}}\"\n >\n <image src=\"{{item.imgsrc}}\"></image>\n <view class=\"text\">{{item.text}}</view>\n <p class=\"price\">{{item.price}}</p>\n <p class=\"buy\">{{item.people}}人购买</p>\n </view>\n </swiper-item>\n </swiper>\n </view> -->\n <network v-if=\"isConnected === false\"></network>\n <open-animation v-if=\"showAwardsModal\" :joinRecord=\"mainInfo && mainInfo.joinRecord\"></open-animation>\n <shared-popup v-if=\"showShareModal\" :inviteinfo=\"mainInfo && mainInfo.inviteRecord\" @getSharedGold=\"getSharedGold\"></shared-popup>\n <popup @showMenu=\"showMenu\" :showMenus=\"showMenus\"></popup>\n <van-dialog id=\"van-dialog\"/>\n </view>\n</template>\n\n<script>\n let touchDotX = 0;\n let touchDotY = 0;\n import store from '../store';\n import { mapState, mapActions } from '@wepy/x';\n import wepy from '@wepy/core';\n import Notify from '../components/vant/notify/notify';\n import Dialog from '../components/vant/dialog/dialog';\n import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';\n wepy.page({\n store,\n hooks: {\n\n },\n\n data: {\n list: [], // 商品list\n // 活动信息\n activityList: [],\n activityDisplayItems: 2,\n current: 5, // 商品列表初次展示第几个\n swiperItem: 2,\n videoList: [],\n circular: false, // 商品是否无限循环\n topPage: 0,\n lastPage: 0,\n currentIndex: 5, // 商品当前滑动到第几个\n authmodal: false,\n sign: true,\n userImgStyle: '',\n awards: false,\n showMenus: false,\n inviter: '',\n mainInfo: null,\n showShareModal: false,\n showAwardsModal: false,\n awardsInfo: {},\n isReceive: false,\n isActiveDone: '',\n isAuto: true\n },\n\n computed: {\n ...mapState([ 'isConnected', 'userInfo' ])\n },\n\n methods: {\n ...mapActions([ 'setIsConnected', 'setUserInfo' ]),\n moveSwiper(e) {\n if (e.$wx.detail.source === 'touch') {\n let current = e.$wx.detail.current;\n this.currentIndex = current;\n }\n },\n swipermoveDone(e) {\n function debounce(func, wait) {\n let timeout;\n return function () {\n if (timeout) clearTimeout(timeout);\n\n let callNow = !timeout;\n timeout = setTimeout(func, wait);\n\n if (callNow) func();\n };\n }\n\n if (e.$wx.detail.source === 'touch') {\n let current = e.$wx.detail.current;\n let totalPage = 3;\n let nextlist = [\n {value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},\n {value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},\n {value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},\n {value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},\n {value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}\n ];\n let that = this;\n\n /* if(current <= 2) {\n debounce(setTimeout(function(){\n that.topPage +=1;\n if(that.lastPage+that.topPage >= totalPage) {\n that.circular = true;\n return;\n }\n that.list = [...newlist, ...that.list];\n// that.current = current+1;\n// that.currentIndex = current+1;\n },1000),500);\n } */\n if (current >= this.list.length - 3) {\n debounce(setTimeout(function() {\n that.lastPage += 1;\n if (that.lastPage + that.topPage >= totalPage) {\n that.circular = true;\n return;\n }\n that.list = [...that.list, ...nextlist];\n }, 1000), 500);\n }\n }\n },\n toViewPage(e) {\n let item = e.$wx.currentTarget.dataset.item;\n wx.navigateToMiniProgram({\n appId: 'wx91d27dbf599dff74',\n path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径\n // 有效值 develop(开发版),trial(体验版),release(正式版)\n envVersion: 'release',\n success(res) {\n// console.log('跳转成功');\n }\n });\n },\n touchStart (event) {\n touchDotX = event.touches[0].pageX; // 获取触摸时的原点\n touchDotY = event.touches[0].pageY;\n // console.log(\"起始点的坐标X:\" + touchDotX);\n // console.log(\"起始点的坐标Y:\" + touchDotY);\n },\n touchMove(event) {\n let touchX = event.touches[0].pageX;\n let touchY = event.touches[0].pageY;\n // 如果元素拖动到购物车范围\n let {left, top, bottom, right} = this.shopcarPosition;\n if (touchX > left - 10 && touchX < right + 10) {\n if (touchY > top - 10 && touchY < bottom + 10) {\n this.bigshop = true;\n }\n }\n },\n // 移动结束处理动画\n touchEnd(event) {\n // 手指离开屏幕时记录的坐标\n let touchMoveX = event.changedTouches[0].pageX;\n let touchMoveY = event.changedTouches[0].pageY;\n let current = event.currentTarget.dataset;\n // 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差\n let tmX = touchMoveX - touchDotX;\n let tmY = touchMoveY - touchDotY;\n // 两点横纵坐标差的绝对值\n let absX = Math.abs(tmX);\n let absY = Math.abs(tmY);\n // 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之间的距离\n let delta = Math.sqrt(absX * absX + absY * absY);\n // console.log('起始点和离开点距离:' + delta + 'px');\n // 如果delta超过60px(可以视情况自己微调),判定为手势触发\n if (delta >= 40) {\n // 如果 |x0-x1|<|y0-y1|,即absX<abxY,判定为上下滑动\n if (absX < absY) {\n // 如更tmX<0,即(离开点的X)-(起始点X)小于0 ,判定为下滑\n if (tmY < 0) {\n this.deleteAnimation(current);\n // console.log(\"上滑=====\");\n // 如更tmX>0,即(离开点的X)-(起始点X)大于0 ,判定为上滑\n } else {\n // console.log(\"下滑=====\");\n }\n }\n } else {\n // console.log(\"手势未触发=====\");\n }\n },\n async getUserInfo (e, isFromLottery) {\n if (e.$wx.detail.userInfo) {\n this.setUserInfo(e.$wx.detail.userInfo);\n this.authmodal = false;\n await this.registUser(e.$wx.detail.userInfo);\n if (isFromLottery) {\n this.getAwards();\n }\n }\n },\n changeVideo(e) {\n this.setIsConnected();\n },\n deleteAnimation (current) {\n if (current && current.itemid !== undefined) {\n let list = this.list;\n list = list.map((item, index) => {\n item.select = '';\n if (index === +current.itemid) {\n item.select = true;\n }\n return item;\n });\n this.list = list;\n let that = this;\n // 如果剩下4个就不让他循环了,这时候就一屏显示出来了\n if (list.length <= 4) {\n this.circular = false;\n }\n if (current.itemid >= list.length - 1) {\n this.current = this.currentIndex - 1;\n }\n setTimeout(function() {\n let newlist = that.list.filter((item, index) => index !== +current.itemid);\n // 正常情况下,current.itemid都会比current大一个,因为current有个隐藏元素,当相等或小于的时候就有问题,要重新设置current,最小不能超过0\n if (current.itemid <= that.current) {\n that.current = Math.max(that.current - 1, 0);\n }\n that.list = newlist;\n }, 500);\n }\n },\n signIn: async function() {\n let that = this;\n const tmplIds = [\n 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',\n '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',\n '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'\n ];\n\n const { subscriptionsSetting } = await wepy.wx.getSetting({ withSubscriptions: true });\n if (subscriptionsSetting && (!subscriptionsSetting.mainSwitch || subscriptionsSetting.itemSettings)) {\n let isAlwaysAgree = true;\n if (subscriptionsSetting.itemSettings) {\n const itemKeys = Object.keys(subscriptionsSetting.itemSettings);\n isAlwaysAgree = itemKeys.every(v => subscriptionsSetting.itemSettings[v] === 'accept');\n }\n if (!isAlwaysAgree || !subscriptionsSetting.mainSwitch) {\n try {\n await Dialog.alert({\n message: '点击右上角“...” - 设置 - 消息订阅,开启接收订阅消息并选择所有消息',\n showCancelButton: true,\n confirmButtonText: '去设置'\n });\n await wepy.wx.openSetting();\n } catch (e) {\n console.log(e || e.message);\n }\n return;\n }\n }\n\n wx.requestSubscribeMessage({\n tmplIds: [\n 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',\n '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',\n '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'\n ],\n success (res) {\n console.log('requestSubscribeMessage success', res);\n if (res.errMsg === 'requestSubscribeMessage:ok') {\n // 兼容写法,有时响应中的模板id不是3个\n const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');\n if (rs) {\n that.sign = true;\n setTimeout(async () => {\n const innerAudioContext = wx.createInnerAudioContext();\n innerAudioContext.autoplay = true;\n innerAudioContext.src = '/static/audio/supermarie.mp3';\n innerAudioContext.onPlay(() => {});\n innerAudioContext.onError((res) => {\n console.log(res.errMsg);\n console.log(res.errCode);\n });\n const { coins } = await signIn();\n if (coins === 0) return;\n that.mainInfo.account.quantity = coins;\n }, 1500);\n }\n }\n },\n fail (res) {\n console.log('requestSubscribeMessage fail', res);\n }\n });\n },\n onShareAppMessage: function(res) {\n if (res.from === 'button') {\n console.log('onShareAppMessage2', res.target);\n }\n const openid = wx.getStorageSync('openId');\n return {\n title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,\n path: `/pages/index?openid=${openid}`,\n imageUrl: this.$wepy.awardsInfo.photoUrl,\n success: function(res) {\n let shareId = res.shareTickets[0];\n console.log('shareId', shareId);\n },\n fail: function(res) {\n console.log(res);\n }\n };\n },\n getAwards: function() {\n const { id, photoUrl, quantity, name, chance } = this.awardsInfo;\n if (!id || !this.mainInfo || !this.mainInfo.account) {\n Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });\n return;\n }\n if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {\n Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true });\n return;\n }\n wx.navigateTo({\n url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`\n });\n },\n getAwardsInfo: function(v) {\n this.awardsInfo = v;\n },\n showMenu: function(v) {\n this.showMenus = v;\n },\n getSharedGold: async function(v) {\n this.showShareModal = false;\n await addGold(v);\n let account = this.mainInfo.account || {};\n let quantity = account.quantity || 0;\n this.mainInfo.account.quantity = quantity + v.quantity;\n this.isReceive = true;\n setTimeout(() => {\n if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {\n this.showAwardsModal = true;\n }\n }, 1000);\n },\n getMainInfo: async function() {\n this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));\n this.sign = this.mainInfo && this.mainInfo.signin;\n wx.setStorageSync('hasPhone', this.mainInfo.phone);\n if (this.mainInfo && this.mainInfo.innerActivity) {\n wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);\n } else {\n wx.setStorageSync('innerActivity', '');\n }\n if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {\n this.showShareModal = true;\n } else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {\n this.showAwardsModal = true;\n }\n },\n async registUser(userInfo) {\n if (wx.getStorageSync('isRegister') === false) {\n const params = {\n ...userInfo,\n inviter: this.inviter\n };\n await register(params);\n wx.setStorageSync('isRegister', true);\n }\n },\n async showActivity() {\n // 1期方案先一次取50\n const list = await getActivityFeed({ count: 50 });\n this.activityList = list;\n },\n onActivityChange(e) {\n const lastIndex = this.activityList.length - this.activityDisplayItems;\n if (e.$wx.detail.current === lastIndex) {\n this.isActiveDone = 'anima';\n setTimeout(() => {\n this.isActiveDone = 'anima hide';\n this.isAuto = false;\n }, 2000);\n }\n }\n },\n async onLoad (options) {\n if (options.openid) {\n this.inviter = options.openid;\n }\n let statusHeight = this.$app.$options.globalData.statusBarHeight || '';\n statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');\n\n if (!wx.getStorageSync('openId')) {\n const { code } = await wepy.wx.login();\n let userInfo = await login(code);\n userInfo = userInfo || {};\n wx.setStorageSync('openId', userInfo.openid);\n wx.setStorageSync('isRegister', userInfo.register);\n }\n if (store.state.userInfo) {\n this.userInfo = store.state.userInfo;\n this.registUser(this.userInfo);\n } else {\n const setting = await wepy.wx.getSetting();\n if (setting.authSetting['scope.userInfo']) {\n const { userInfo } = await wepy.wx.getUserInfo();\n this.setUserInfo(userInfo);\n this.registUser(userInfo);\n } else {\n this.authmodal = true;\n }\n }\n this.getMainInfo();\n this.videoList = await getPrizeList();\n this.showActivity();\n },\n async onShow() {\n }\n\n });\n</script>\n<config>\n{\n navigationBarTitleText: '主页',\n usingComponents: {\n 'van-button': '../components/vant/button/index',\n 'prize-list': '\\x7e@/components/custom/prizeList',\n 'van-icon': '../components/vant/icon/index',\n 'sign': '~@/components/custom/sign',\n 'gold': '~@/components/custom/sign',\n 'share': '~@/components/custom/sign',\n 'lottery': '~@/components/custom/sign',\n 'network': '~@/components/custom/network',\n 'open-animation': '~@/components/custom/openAnimation',\n 'popup': '~@/components/custom/popup',\n 'van-notify': '~@/components/vant/notify/index',\n 'shared-popup': '~@/components/custom/sharedPopup',\n 'van-dialog': '~@/components/vant/dialog/index'\n },\n navigationStyle: \"custom\",\n disableScroll: true\n }\n</config>\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy":{"size":253,"mtime":1590498072492,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy":{"size":3225,"mtime":1591697302058,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy":{"size":7810,"mtime":1591755149574,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<style lang=\"less\">\n @import \"../style/common.less\";\n .prize-top {\n background-color: @whiteback;\n padding:30rpx 50rpx;\n .img{\n display: block;\n margin:0 auto;\n width: 400rpx;\n .van-image {\n box-shadow:0 3rpx 13rpx 1rpx rgba(163,163,163,0.38);\n }\n }\n .goodsname{\n padding:25rpx 0;\n font-size: @font-middle;\n }\n .prize-info{\n color:@lightgrey;\n font-size: 26rpx;\n .red {\n color:@redcolor;\n }\n }\n }\n .prize-address {\n padding-top:50rpx;\n .address-title {\n font-size: 32rpx;\n color: @greycolor;\n padding-left:30rpx;\n }\n .address-cont{\n margin-top:20rpx;\n }\n }\n .footerheight {\n height:140rpx;\n }\n .footer{\n width:100%;\n height: 110rpx;\n background-color: @whiteback;\n position: fixed;\n bottom:0;\n left:0;\n .getprize{\n position: absolute;\n width:160rpx;\n height:70rpx;\n color:@whitecolor;\n border-radius: 10rpx;\n background-color: @maincolor;\n right:30rpx;\n top:20rpx;\n line-height: 70rpx;\n text-align: center;\n font-size: @font-large;\n }\n }\n .van-picker .van-picker__cancel,.van-picker .van-picker__confirm{\n color:@maincolor;\n }\n</style>\n<template>\n <!--解决wepy打包之后picker没有toolbar的问题-->\n <import src=\"../components/vant/picker/toolbar.wxml\" />\n <view class=\"prize-wrapper\">\n <view class=\"prize-top\">\n <van-image use-loading-slot src=\"{{prize.photoUrl}}\" class=\"img\" width=\"400rpx\" height=\"400rpx\" radius=\"10rpx\" fit=\"cover\">\n <van-loading slot=\"loading\" type=\"spinner\" size=\"20\" vertical />\n </van-image>\n <view class=\"goodsname\">{{prize.name}}</view>\n <view class=\"prize-info\">中奖概率: {{chance}}</view>\n <view class=\"prize-info\">中奖结果: <text class=\"red\">已中奖</text></view>\n </view>\n <view class=\"prize-address\" v-show=\"!prize.cash\">\n <view class=\"address-title\">添加收货地址</view>\n <view class=\"address-cont\">\n <van-field value=\"{{name}}\" data-form=\"name\" placeholder=\"收货人\" bind:input\t=\"setValue\"></van-field>\n <van-field value=\"{{phone}}\" data-form=\"phone\" placeholder=\"手机号码\" bind:input\t=\"setValue\"></van-field>\n <van-field value=\"{{idNumber}}\" data-form=\"idNumber\" placeholder=\"收货人身份证号\" bind:input\t=\"setValue\"></van-field>\n <van-field value=\"{{cityValue}}\" placeholder=\"所在地区\" bindtap=\"onClose\" is-link readonly></van-field>\n <van-field value=\"{{address}}\" data-form=\"address\" placeholder=\"详细地址:如街道、小区、门牌号、楼栋号等\" bind:input\t=\"setValue\"></van-field>\n </view>\n </view>\n <van-popup show=\"{{ showAddress }}\" position=\"bottom\" bind:close=\"onClose\">\n <van-area area-list=\"{{ areaList }}\" value=\"110101\" bind:confirm=\"getaddress\" bind:cancel=\"onClose\" title=\"请选择地区\"/>\n </van-popup>\n <view class=\"footerheight\"></view>\n <view class=\"footer\">\n <button class=\"getprize\" bindtap=\"goprize\">{{btnfont}}</button>\n </view>\n <van-dialog id=\"van-dialog\"/>\n <van-notify id=\"van-notify\" />\n </view>\n</template>\n<script>\n import wepy from '@wepy/core';\n import Dialog from '../components/vant/dialog/dialog';\n import Notify from '../components/vant/notify/notify';\n import { getOneRaffle, getUserPhone, getPrize } from '../common/api';\n var raffle = require('../common/raffleProbability');\n var area = require('../components/custom/china.js');\n wepy.page({\n data: {\n quantity: 0,\n prize: {},\n name: '',\n phone: '',\n address: '',\n province: '',\n city: '',\n county: '',\n cityValue: '',\n areaList: [],\n showAddress: false,\n joinRecordId: null,\n chance: '',\n btnfont: '领取',\n idNumber: ''\n },\n methods: {\n goprize() {\n if (!this.prize.cash) {\n if (!this.name) {\n Notify({message: '请填写收货人'});\n return;\n }\n let reg = /^1\\d{10}$/;\n if (!this.phone) {\n Notify({message: '请填写手机号码'});\n return;\n }\n if (!reg.test(this.phone)) {\n Notify({message: '请填写正确的手机号码'});\n return;\n }\n if (!this.idNumber) {\n Notify({message: '请填写身份证号'});\n return;\n }\n if (!/^[0-9]+[Xx]?$/.test(this.idNumber)) {\n Notify({message: '请填写正确的身份证号'});\n return;\n }\n if (!this.city) {\n Notify({message: '请选择所在地区'});\n return;\n }\n if (!this.address) {\n Notify({message: '请填写详细地址'});\n return;\n }\n }\n let params = {\n joinRecordId: this.joinRecordId,\n name: this.name,\n phone: this.phone,\n province: this.province,\n city: this.city,\n county: this.county,\n address: this.address,\n idNumber: this.idNumber\n };\n let message = '您所领取的奖品我们将在3到5个工作日内寄出,请您耐心等待,感谢您的参与!';\n let cashmeg = '您所领取的奖品我们将会在几分钟内发出,请您耐心等待,感谢您的参与!';\n let that = this;\n if (this.btnfont !== '领取') return;\n this.btnfont = '...';\n getPrize(params).then(() => {\n this.btnfont = '领取';\n Dialog.alert({\n title: '领取成功',\n message: that.prize.cash ? cashmeg : message\n }).then(() => {\n wx.reLaunch({url: '/pages/index'});\n });\n }).catch(() => {\n this.btnfont = '领取';\n });\n },\n onClose() {\n this.showAddress = !this.showAddress;\n },\n setValue(event) {\n let value = event.$wx.detail;\n let form = event.$wx.currentTarget.dataset.form;\n if (form) this[form] = value;\n },\n getaddress(event) {\n let detail = event.$wx.detail.values;\n this.province = detail[0].name;\n this.city = detail[1].name;\n this.county = detail[2].name;\n this.cityValue = detail[0].name + detail[1].name + detail[2].name;\n this.onClose();\n }\n },\n computed: {\n\n },\n onLoad (query) {\n let joinRecordId = query.joinRecordId || '';\n this.joinRecordId = joinRecordId;\n if (!joinRecordId) Notify({message: '缺少参数错误!'});\n // 请求接口得到数据\n getOneRaffle({joinRecordId: joinRecordId}).then(data => {\n let dat = data || {};\n this.prize = dat.prize;\n this.quantity = dat.quantity;\n this.chance = raffle.getProbability(+dat.quantity, +dat.prize.coinQuantity);\n });\n getUserPhone().then(data => {\n this.phone = data.phone;\n });\n this.areaList = area.areaList;\n /* this.prize = {cash:false,name:'Nintendo Switch任天堂游戏机Nintendo Switch任天堂游戏机',photoUrl:'/static/images/test2.png',coinQuantity:5000};\n this.quantity = 300;\n this.chance = raffle.getProbability(this.quantity,this.prize.coinQuantity); */\n }\n });\n</script>\n<config>\n {\n navigationBarTitleText: '领取奖品',\n \"usingComponents\": {\n \"van-field\": \"../components/vant/field/index\",\n \"van-cell\": \"../components/vant/cell/index\",\n \"van-area\": \"../components/vant/area/index\",\n \"van-popup\": \"../components/vant/popup/index\",\n 'van-dialog': '../components/vant/dialog/index',\n \"van-notify\": \"../components/vant/notify/index\",\n \"van-image\": \"../components/vant/image/index\",\n \"van-loading\": \"../components/vant/loading/index\",\n }\n }\n</config>\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy":{"size":11469,"mtime":1591760199016,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<style lang=\"less\">\n @import \"../style/common.less\";\n .raffle-wrapper {\n width:100%;\n height:100%;\n background-color:@greyback;\n padding-top:40rpx;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n .raffle-content {\n background-color: @whiteback;\n width: 94%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin:0 auto;\n padding:50rpx 50rpx 40rpx 50rpx;\n border-radius: 10rpx;\n box-shadow:0 2rpx 20rpx 0 rgba(188,188,188,0.75);\n .img .van-image {\n box-shadow:0 3rpx 13rpx 1rpx rgba(163,163,163,0.38);\n }\n }\n .goodsinfo {\n margin-top:15rpx;\n overflow: hidden;\n .text {\n font-size: @font-middle;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; //行数\n -webkit-box-orient: vertical;\n overflow: hidden;\n float: left;\n text-align: left;\n width: 65%;\n color: #333;\n }\n .money{\n float: right;\n width:30%;\n color:@maincolor;\n font-size: @font-large;\n text-align: right;\n font-weight:bold;\n }\n }\n .raffle-chance {\n font-size: @font-normal;\n color:@greycolor;\n margin-top:20rpx;\n }\n .raffle-progress {\n font-size: @font-normal;\n color:@greycolor;\n }\n .progress {\n width: 298rpx;\n height:18rpx;\n background-color:@whiteback;\n border:1px solid @maincolor;\n border-radius: 4rpx;\n color:@greycolor;\n display: inline-block;\n position: relative;\n top:3rpx;\n .orange {\n height:100%;\n transition:all 1s;\n background-color: @maincolor;\n }\n }\n .pronumber{\n font-size: @font-small;\n color:@greycolor;\n margin-left:10rpx;\n position: relative;\n top:-3rpx;\n }\n .user-wish {\n padding-left:35rpx;\n font-size: @font-normal;\n color:@darkgrey;\n margin-top:25rpx;\n height:50rpx;\n line-height: 50rpx;\n .checkimg{\n display: inline-block;\n width:24rpx;\n height:24rpx;\n border:3rpx solid #aaa;\n border-radius: 4rpx;\n vertical-align: middle;\n position: relative;\n &.checked{\n background-color: @maincolor;\n border:3rpx solid @maincolor;\n }\n }\n .checkicon {\n position: absolute;\n top:0;\n left:0;\n right:0;bottom:0;margin:0 auto;\n &.hide {\n display: none;\n }\n }\n .checktext{\n margin-left:10rpx;\n position: relative;\n top:3rpx;\n }\n }\n .joinin {\n width:380rpx;\n height:70rpx;\n line-height: 70rpx;\n background-color: @maincolor;\n border-radius:10rpx;\n margin:0 auto;\n margin-top:80rpx;\n font-size: 34rpx;\n color:@whitecolor;\n }\n .innerActivity {\n width:100%;\n height:100%;\n background-color: rgba(0,0,0,0.7);\n position: fixed;\n top:0;left:0;\n animation:fadein .3s linear forwards;\n &.anima {\n animation:fadeout .3s linear forwards;\n }\n &.hide {\n display: none;\n }\n .inner-content {\n width: 70%;\n position: absolute;\n top:30%;\n height:360rpx;\n left:15%;\n background-color: @whiteback;\n box-shadow:0 2rpx 20rpx 0 rgba(144, 144, 144, 0.35);\n border-radius:20rpx;\n }\n .inner-title {\n text-align: center;\n font-size: 34rpx;\n padding-top:50rpx;\n }\n .inner-input {\n background-color: #ddd;\n height:70rpx;\n width:330rpx;\n margin:0 auto;\n line-height:70rpx;\n font-size: 32rpx;\n border-radius:35rpx;\n padding:0 30rpx;\n margin-top:30rpx;\n }\n .error-text {\n color:@redcolor;\n font-size: 22rpx;\n width:390rpx;\n margin:0 auto;\n padding:20rpx 0;\n }\n .inner-footer {\n width:100%;\n height:88rpx;\n position: absolute;\n bottom:0;\n left:0;\n border-top: 1rpx solid #E6E6E6;\n overflow: hidden;\n .button {\n width:50%;\n float: left;\n text-align: center;\n line-height:88rpx;\n }\n .cancel {\n color:@lightgrey;\n font-size: @font-middle;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border-right: 1rpx solid #E6E6E6;\n }\n .confirm {\n color: @maincolor;\n font-size: 34rpx;\n }\n }\n }\n @-webkit-keyframes fadeout {\n from { background: rgba(0, 0, 0, 0.7); opacity: 1;}\n to { background: rgba(0, 0, 0, 0); opacity: 0;}\n }\n @-webkit-keyframes fadein {\n from { background: rgba(0, 0, 0, 0); opacity: 0;}\n to { background: rgba(0, 0, 0, 0.7); opacity: 1;}\n }\n</style>\n<template>\n <view class=\"raffle-wrapper\">\n <view class=\"raffle-content\">\n <van-image use-loading-slot src=\"{{photoUrl}}\" class=\"img\" width=\"610rpx\" height=\"610rpx\" radius=\"10rpx\" fit=\"cover\">\n <van-loading slot=\"loading\" type=\"spinner\" size=\"20\" vertical />\n </van-image>\n <view class=\"goodsinfo\">\n <text class=\"text\">{{name}}</text>\n <text class=\"money\">{{quantity}}克币</text>\n </view>\n <view class=\"raffle-chance\">中奖概率: {{chance}}</view>\n <view class=\"raffle-progress\">开奖进度:\n <view class=\"progress\">\n <view class=\"orange\" style=\"{{progressStyle}}\"></view>\n </view>\n <text class=\"pronumber\">{{progress}}</text>\n </view>\n </view>\n <view class=\"user-wish\" bindtap=\"check\">\n <view class=\"checkimg {{isCheck?'checked':''}}\">\n <van-icon name=\"success\" color=\"#fff\" size=\"24rpx\" class=\"checkicon {{isCheck?'':'hide'}}\"/>\n </view>\n <text class=\"checktext\">我同意花费所有克币参与抽奖,并承诺商品不退货。</text>\n </view>\n <button class=\"joinin\" open-type=\"{{opentype}}\" bindtap=\"joinin\" bindgetphonenumber=\"getPhoneNumber\">{{btnfont}}</button>\n <van-notify id=\"van-notify\" />\n <van-dialog id=\"van-dialog\"/>\n <view class=\"innerActivity {{isInnerDone}}\">\n <view class=\"inner-content\">\n <view class=\"inner-title\">请输入邀请码</view>\n <view>\n <input type=\"text\" class=\"inner-input\" v-model=\"code\">\n </view>\n <view class=\"error-text\" v-show=\"isError\">邀请码错误,请重新输入</view>\n <view class=\"inner-footer\">\n <view class=\"cancel button\" bindtap=\"closeModal\">内测结束再抽</view>\n <view class=\"confirm button\" bindtap=\"checkCode\">确定</view>\n </view>\n </view>\n </view>\n </view>\n</template>\n<script>\n import wepy from '@wepy/core';\n import Notify from '../components/vant/notify/notify';\n import Dialog from '../components/vant/dialog/dialog';\n import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';\n import store from '../store';\n wepy.page({\n store,\n data: {\n progress: '0%',\n progressStyle: '',\n isCheck: true,\n batchId: null,\n quantity: '',\n name: '',\n chance: '',\n photoUrl: '',\n btnfont: '立即参与',\n hasPhone: false,\n isInnerDone: 'hide',\n innerActivity: '',\n isError: false,\n code: ''\n },\n methods: {\n check() {\n this.isCheck = !this.isCheck;\n },\n async getPhoneNumber(e) {\n // 用户获取手机号之前一定要登录\n if (this.btnfont !== '立即参与') { return; }\n let that = this;\n let detail = e.$wx.detail || {};\n function goprize() {\n updateUserPhone(detail).then(() => {\n that.confirmRaff();\n wx.setStorageSync('hasPhone', true);\n that.hasPhone = true;\n }).catch(() => {\n that.btnfont = '立即参与';\n });\n }\n if (detail.encryptedData) {\n this.btnfont = '参与中...';\n wx.checkSession({\n async fail () {\n // session_key 已经失效,需要重新执行登录流程\n const { code } = await wepy.wx.login();\n await login(code);\n goprize();\n }\n });\n } else {\n Notify({message: '参与失败,请重新授权!'});\n }\n },\n async confirmRaff() {\n let title = ['参与成功!', '参与失败!', '参与失败!'];\n let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。'];\n // 如果用户还未注册\n // 用户抽奖之前一定要注册\n let isRegister = wx.getStorageSync('isRegister');\n if (isRegister === false) {\n await register(store.state.userInfo);\n wx.setStorageSync('isRegister', true);\n }\n this.btnfont = '参与中...';\n confirmRaffle({batchId: this.batchId}).then(data => {\n this.btnfont = '立即参与';\n let code = data.joinCode;\n if (code === undefined) code = 3;\n Dialog.alert({\n title: title[code],\n message: message[code]\n }).then(() => {\n wx.reLaunch({url: '/pages/index'});\n });\n }).catch(() => {\n this.btnfont = '立即参与';\n });\n },\n joinin() {\n if (!this.isCheck) {\n Notify({message: '勾选同意后才可以抽奖!'});\n return;\n }\n if (this.hasPhone) {\n // 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal\n if (this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {\n this.showModal();\n } else {\n this.confirmRaff();\n }\n }\n },\n async getProgress(id) {\n let detail = await getAwardsDetail({ prizeId: id });\n detail = detail || {};\n this.batchId = detail.id;\n if (detail.quantity) {\n this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';\n this.progressStyle = 'width:' + this.progress;\n }\n },\n closeModal() {\n this.isInnerDone = 'anima';\n setTimeout(() => {\n this.isInnerDone = 'hide';\n }, 300);\n },\n showModal() {\n this.isInnerDone = '';\n this.isError = false;\n this.code = '';\n },\n checkCode () {\n checkInnerCode({code: this.code}).then(data => {\n if (+data.checkCode === 0) {\n this.closeModal();\n this.confirmRaff();\n } else {\n this.isError = true;\n }\n });\n }\n },\n computed: {\n opentype() {\n if (this.isCheck && !this.hasPhone) {\n return 'getPhoneNumber';\n } else {\n return '';\n }\n }\n },\n watch: {\n code(val) {\n if (!val.length && this.isError) {\n this.isError = false;\n }\n }\n },\n onLoad (query) {\n let {prizeId, quantity, name, chance, photoUrl} = query;\n this.getProgress(prizeId);\n this.hasPhone = wx.getStorageSync('hasPhone');\n this.quantity = quantity || '';\n this.name = name;\n this.chance = chance;\n this.photoUrl = photoUrl;\n this.innerActivity = wx.getStorageSync('innerActivity');\n }\n });\n</script>\n<config>\n {\n navigationBarTitleText: '参与抽奖',\n \"usingComponents\": {\n \"van-notify\": \"../components/vant/notify/index\",\n \"van-image\": \"../components/vant/image/index\",\n \"van-loading\": \"../components/vant/loading/index\",\n \"van-dialog\": \"../components/vant/dialog/index\",\n \"van-icon\": \"../components/vant/icon/index\",\n }\n }\n</config>\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js":{"size":539,"mtime":1590568729968,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/prizeList.wpy":{"size":6673,"mtime":1591686527193,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/prizeList.wpy","messages":[],"errorCount":0,"warningCount":0}}} {"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy":{"size":1382,"mtime":1591613433299,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js":{"size":1542,"mtime":1591685943700,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js":{"size":85,"mtime":1589422331949,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js":{"size":708,"mtime":1591238093271,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js":{"size":1924,"mtime":1591760425112,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js":{"size":98459,"mtime":1591238093273,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy":{"size":775,"mtime":1591668495264,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy":{"size":1449,"mtime":1591613433302,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy":{"size":17057,"mtime":1591613433303,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy":{"size":4240,"mtime":1591613433304,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy":{"size":7858,"mtime":1591613433305,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy":{"size":11372,"mtime":1591613433306,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy":{"size":3928,"mtime":1590659119391,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy":{"size":898,"mtime":1589889870499,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy":{"size":2957,"mtime":1591613433311,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy":{"size":12245,"mtime":1591774419693,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<style lang=\"less\">\n @import \"../style/common\";\n page{\n height: 100%;\n background-color: #000;\n }\n .video-wrapper{\n width: 100%;\n height: 100%;\n }\n #myvideo{\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 0;\n background-color:rgba(0, 0, 0, 0.7);\n }\n .userInfo{\n position: fixed;\n z-index: 10;\n top:100rpx;\n left: 30rpx;\n }\n .userinfo-button {\n width: 80rpx;\n height: 80rpx;\n padding: 0;\n border: none;\n background-color: transparent;\n &::after {\n border: none;\n };\n .userinfo-image {\n width: 80rpx;\n height: 80rpx;\n border-radius: 50%;\n }\n }\n\n .userimage{\n width: 80rpx;\n height: 80rpx;\n border-radius: 50%;\n }\n @-webkit-keyframes fadeout {\n 0% {\n opacity:1 ;\n }\n 100% {\n opacity: 0;\n }\n }\n .authmodal{\n width:100%;\n height:100%;\n background-color: rgba(0,0,0,0.7);\n position: fixed;\n z-index:20;\n .wrap {\n width: 90%;\n margin:0 auto;\n position: relative;\n top:200px;\n padding: 50rpx 0;\n background-color: @whiteback;\n border-radius: 20rpx;\n .text {\n color:#333;\n text-align: center;\n padding-top:30rpx;\n padding-bottom: 60rpx;\n }\n button {\n width:80%;\n }\n }\n }\n</style>\n<template>\n <view class=\"video-wrapper\">\n <view id=\"myvideo\">\n <prize-list v-if=\"videoList && videoList.length\" :videoList.sync=\"videoList\" :userAccount=\"mainInfo && mainInfo.account && mainInfo.account.quantity || 0\" :total=\"total\" bindchange=\"changeVideo\" @getAwardsInfo=\"getAwardsInfo\">\n </prize-list>\n </view>\n <view class=\"userInfo\" style=\"{{userImgStyle}}\">\n <button v-if=\"authmodal\" open-type=\"getUserInfo\" bindgetuserinfo=\"getUserInfo\" class=\"userinfo-button\">\n <image class=\"userinfo-image\" src=\"{{userInfo.avatarUrl || '/static/images/user@2x.png'}}\"></image>\n </button>\n <image v-if=\"!authmodal\" @tap=\"showMenu(!showMenus)\" src=\"{{userInfo.avatarUrl || '/static/images/user@2x.png'}}\" mode=\"cover\" class=\"userimage\"></image>\n </view>\n <view>\n <gold type=\"gold\" :des=\"mainInfo && mainInfo.account && mainInfo.account.quantity || 0\" :gold=\"sign\" :isReceive=\"isReceive\"></gold>\n <sign type=\"sign\" des=\"签到\" :sign=\"sign\" @sign-in=\"signIn\"></sign>\n <lottery type=\"lottery\" des=\"抽奖\" @getAwards=\"getAwards\" @getUserInfo=\"getUserInfo\" :authmodal=\"authmodal\"></lottery>\n <share type=\"share\" des=\"分享\"></share>\n </view>\n <activity-list :activityList=\"activityList\"></activity-list>\n <network v-if=\"isConnected === false\"></network>\n <open-animation v-if=\"showAwardsModal\" :joinRecord=\"mainInfo && mainInfo.joinRecord\"></open-animation>\n <shared-popup v-if=\"showShareModal\" :inviteinfo=\"mainInfo && mainInfo.inviteRecord\" @getSharedGold=\"getSharedGold\"></shared-popup>\n <popup @showMenu=\"showMenu\" :showMenus=\"showMenus\"></popup>\n <!--推荐商品列表-->\n <!--<goods-list :goodsList=\"goodsList\"></goods-list>-->\n <van-dialog id=\"van-dialog\"/>\n <van-notify id=\"van-notify\" />\n </view>\n</template>\n\n<script>\n import store from '../store';\n import { mapState, mapActions } from '@wepy/x';\n import wepy from '@wepy/core';\n import Notify from '../components/vant/notify/notify';\n import Dialog from '../components/vant/dialog/dialog';\n import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';\n wepy.page({\n store,\n data: {\n videoList: [],\n goodsList: [],\n activityList: [],\n authmodal: false,\n sign: true,\n userImgStyle: '',\n awards: false,\n showMenus: false,\n inviter: '',\n mainInfo: null,\n showShareModal: false,\n showAwardsModal: false,\n awardsInfo: {},\n isReceive: false\n },\n\n computed: {\n ...mapState([ 'isConnected', 'userInfo' ])\n },\n\n methods: {\n ...mapActions([ 'setIsConnected', 'setUserInfo' ]),\n async getUserInfo (e, isFromLottery) {\n if (e.$wx.detail.userInfo) {\n this.setUserInfo(e.$wx.detail.userInfo);\n this.authmodal = false;\n await this.registUser(e.$wx.detail.userInfo);\n if (isFromLottery) {\n this.getAwards();\n }\n }\n },\n changeVideo() {\n this.setIsConnected();\n },\n signIn: async function() {\n let that = this;\n const tmplIds = [\n 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',\n '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',\n '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'\n ];\n\n const { subscriptionsSetting } = await wepy.wx.getSetting({ withSubscriptions: true });\n if (subscriptionsSetting && (!subscriptionsSetting.mainSwitch || subscriptionsSetting.itemSettings)) {\n let isAlwaysAgree = true;\n if (subscriptionsSetting.itemSettings) {\n const itemKeys = Object.keys(subscriptionsSetting.itemSettings);\n isAlwaysAgree = itemKeys.every(v => subscriptionsSetting.itemSettings[v] === 'accept');\n }\n if (!isAlwaysAgree || !subscriptionsSetting.mainSwitch) {\n try {\n await Dialog.alert({\n message: '点击右上角“...” - 设置 - 消息订阅,开启接收订阅消息并选择所有消息',\n showCancelButton: true,\n confirmButtonText: '去设置'\n });\n await wepy.wx.openSetting();\n } catch (e) {\n console.log(e || e.message);\n }\n return;\n }\n }\n\n wx.requestSubscribeMessage({\n tmplIds: [\n 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',\n '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',\n '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'\n ],\n success (res) {\n console.log('requestSubscribeMessage success', res);\n if (res.errMsg === 'requestSubscribeMessage:ok') {\n // 兼容写法,有时响应中的模板id不是3个\n const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');\n if (rs) {\n that.sign = true;\n setTimeout(async () => {\n const innerAudioContext = wx.createInnerAudioContext();\n innerAudioContext.autoplay = true;\n innerAudioContext.src = '/static/audio/supermarie.mp3';\n innerAudioContext.onPlay(() => {});\n innerAudioContext.onError((res) => {\n console.log(res.errMsg);\n console.log(res.errCode);\n });\n const { coins } = await signIn();\n if (coins === 0) return;\n that.mainInfo.account.quantity = coins;\n }, 1500);\n }\n }\n },\n fail (res) {\n console.log('requestSubscribeMessage fail', res);\n }\n });\n },\n onShareAppMessage: function(res) {\n if (res.from === 'button') {\n console.log('onShareAppMessage2', res.target);\n }\n const openid = wx.getStorageSync('openId');\n return {\n title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,\n path: `/pages/index?openid=${openid}`,\n imageUrl: this.$wepy.awardsInfo.photoUrl,\n success: function(res) {\n let shareId = res.shareTickets[0];\n console.log('shareId', shareId);\n },\n fail: function(res) {\n console.log(res);\n }\n };\n },\n getAwards: function() {\n const { id, photoUrl, quantity, name, chance } = this.awardsInfo;\n if (!id || !this.mainInfo || !this.mainInfo.account) {\n Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });\n return;\n }\n if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {\n Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true });\n return;\n }\n wx.navigateTo({\n url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`\n });\n },\n getAwardsInfo: function(v) {\n this.awardsInfo = v;\n },\n showMenu: function(v) {\n this.showMenus = v;\n },\n getSharedGold: async function(v) {\n this.showShareModal = false;\n await addGold(v);\n let account = this.mainInfo.account || {};\n let quantity = account.quantity || 0;\n this.mainInfo.account.quantity = quantity + v.quantity;\n this.isReceive = true;\n setTimeout(() => {\n if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {\n this.showAwardsModal = true;\n }\n }, 1000);\n },\n getMainInfo: async function() {\n this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));\n this.sign = this.mainInfo && this.mainInfo.signin;\n wx.setStorageSync('hasPhone', this.mainInfo.phone);\n if (this.mainInfo && this.mainInfo.innerActivity) {\n wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);\n } else {\n wx.setStorageSync('innerActivity', '');\n }\n if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {\n this.showShareModal = true;\n } else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {\n this.showAwardsModal = true;\n }\n },\n async registUser(userInfo) {\n if (wx.getStorageSync('isRegister') === false) {\n const params = {\n ...userInfo,\n inviter: this.inviter\n };\n await register(params);\n wx.setStorageSync('isRegister', true);\n }\n },\n async showActivity() {\n // 1期方案先一次取50\n const list = await getActivityFeed({ count: 50 });\n this.activityList = list;\n }\n\n },\n async onLoad (options) {\n if (options.openid) {\n this.inviter = options.openid;\n }\n let statusHeight = this.$app.$options.globalData.statusBarHeight || '';\n statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');\n\n if (!wx.getStorageSync('openId')) {\n const { code } = await wepy.wx.login();\n let userInfo = await login(code);\n userInfo = userInfo || {};\n wx.setStorageSync('openId', userInfo.openid);\n wx.setStorageSync('isRegister', userInfo.register);\n }\n if (store.state.userInfo) {\n this.userInfo = store.state.userInfo;\n this.registUser(this.userInfo);\n } else {\n const setting = await wepy.wx.getSetting();\n if (setting.authSetting['scope.userInfo']) {\n const { userInfo } = await wepy.wx.getUserInfo();\n this.setUserInfo(userInfo);\n this.registUser(userInfo);\n } else {\n this.authmodal = true;\n }\n }\n this.getMainInfo();\n this.videoList = await getPrizeList();\n this.showActivity();\n },\n async onShow() {\n }\n\n });\n</script>\n<config>\n{\n navigationBarTitleText: '主页',\n usingComponents: {\n 'van-button': '../components/vant/button/index',\n 'prize-list': '\\x7e@/components/custom/prizeList',\n 'van-icon': '../components/vant/icon/index',\n 'sign': '~@/components/custom/sign',\n 'gold': '~@/components/custom/sign',\n 'share': '~@/components/custom/sign',\n 'lottery': '~@/components/custom/sign',\n 'network': '~@/components/custom/network',\n 'open-animation': '~@/components/custom/openAnimation',\n 'popup': '~@/components/custom/popup',\n 'van-notify': '~@/components/vant/notify/index',\n 'shared-popup': '~@/components/custom/sharedPopup',\n 'van-dialog': '~@/components/vant/dialog/index',\n 'goods-list': '../components/custom/goodsList',\n 'activity-list': '../components/custom/activityList'\n },\n navigationStyle: \"custom\",\n disableScroll: true\n }\n</config>\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy":{"size":253,"mtime":1590498072492,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy":{"size":3149,"mtime":1591769504315,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy":{"size":7575,"mtime":1591769504310,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy":{"size":11486,"mtime":1591769504322,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js":{"size":539,"mtime":1590568729968,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/prizeList.wpy":{"size":6673,"mtime":1591760833833,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/prizeList.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/activityList.wpy":{"size":2310,"mtime":1591774452438,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/activityList.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<template>\n <view class=\"content {{isActiveDone}}\" >\n <view class=\"leftcont\">\n <swiper\n class=\"list-wrapper\"\n vertical=\"{{true}}\"\n circular=\"{{true}}\"\n display-multiple-items=\"{{activityDisplayItems}}\"\n bindchange=\"onActivityChange\"\n autoplay=\"{{isAuto}}\"\n interval=\"1500\">\n <swiper-item wx:for=\"{{list}}\" wx:key=\"index\" catch:touchmove>\n <view class=\"imgwrap\">\n <image class=\"img\" src=\"{{item.avatarUrl}}\"></image>\n <view class=\"text\">{{item.content}}</view>\n </view>\n </swiper-item>\n </swiper>\n </view>\n </view>\n</template>\n<script>\n import wepy from '@wepy/core';\n\n wepy.component({\n props: {\n activityList: {\n type: Array,\n default: []\n }\n },\n data: {\n activityDisplayItems: 2,\n isActiveDone: '',\n isAuto: true,\n list: []\n },\n watch: {\n activityList(val) {\n let list = val || [];\n this.list = list;\n }\n },\n methods: {\n onActivityChange(e) {\n const lastIndex = this.list.length - this.activityDisplayItems;\n if (e.$wx.detail.current === lastIndex) {\n this.isActiveDone = 'anima';\n setTimeout(() => {\n this.isActiveDone = 'anima hide';\n this.isAuto = false;\n }, 2000);\n }\n }\n }\n });\n</script>\n<style lang=\"less\">\n @import \"../../style/common\";\n .content{\n position: absolute;\n z-index: 9;\n bottom: 400rpx;\n width: 100%;\n color: @whitecolor;\n clear: both;\n &.anima {\n animation:fadeout 2s;\n }\n &.hide {\n display: none;\n }\n }\n .leftcont {\n width: 44%;\n float: left;\n font-size: @font-normal;\n margin-left: 30rpx;\n }\n .list-wrapper {\n height: 120rpx;\n }\n .leftcont .img {\n width: 40rpx;\n height: 40rpx;\n border-radius: 50%;\n vertical-align: middle;\n }\n .leftcont .text {\n max-width: 200rpx;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: 10rpx;\n vertical-align: middle;\n border-radius: 20rpx;\n display: inline-block;\n font-size: @font-small;\n box-sizing: border-box;\n padding:6rpx 15rpx;\n background-color:rgba(238, 238, 238, 0.2);\n }\n</style>\n<config>\n {}\n</config>\n"}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy":{"size":9050,"mtime":1591773721558,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy","messages":[],"errorCount":0,"warningCount":0,"output":"<wxs module=\"tools\" src=\"../../common/common.wxs\"></wxs>\n<template>\n <view class=\"footer\">\n <swiper\n class=\"footswiper\"\n display-multiple-items=\"{{swiperItem}}\"\n current=\"{{current}}\"\n bindchange=\"moveSwiper\"\n bindanimationfinish=\"swipermoveDone\"\n circular=\"{{circular}}\"\n previous-margin=\"140rpx\"\n next-margin=\"120rpx\"\n catch:touchmove\n >\n <!--bindtouchstart=\"touchStart\"\n bindtouchend=\"touchEnd\"-->\n <swiper-item wx:for=\"{{list}}\" wx:key=\"index\">\n <view\n data-itemid=\"{{index}}\"\n bindtap=\"toViewPage\"\n data-item=\"{{item}}\"\n class=\"list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length)}}\"\n >\n <image src=\"{{item.imgsrc}}\"></image>\n <view class=\"text\">{{item.text}}</view>\n <p class=\"price\">{{item.price}}</p>\n <p class=\"buy\">{{item.people}}人购买</p>\n </view>\n </swiper-item>\n </swiper>\n </view>\n</template>\n<script>\n import wepy from '@wepy/core';\n let touchDotX = 0;\n let touchDotY = 0;\n wepy.component({\n props: {\n goodsList: {\n type: Array,\n default: []\n }\n },\n data: {\n swiperItem: 2,\n current: 5,\n currentIndex: 5, // 商品当前滑动到第几个\n circular: false, // 商品是否无限循环\n topPage: 0,\n lastPage: 0,\n list: []\n },\n watch: {\n goodsList(val) {\n let list = val || [];\n this.list = list;\n }\n },\n methods: {\n moveSwiper(e) {\n if (e.$wx.detail.source === 'touch') {\n let current = e.$wx.detail.current;\n this.currentIndex = current;\n }\n },\n swipermoveDone(e) {\n function debounce(func, wait) {\n let timeout;\n return function () {\n if (timeout) clearTimeout(timeout);\n\n let callNow = !timeout;\n timeout = setTimeout(func, wait);\n\n if (callNow) func();\n };\n }\n\n if (e.$wx.detail.source === 'touch') {\n let current = e.$wx.detail.current;\n let totalPage = 3;\n let nextlist = [\n {value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},\n {value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},\n {value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},\n {value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},\n {value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}\n ];\n let that = this;\n\n /* if(current <= 2) {\n debounce(setTimeout(function(){\n that.topPage +=1;\n if(that.lastPage+that.topPage >= totalPage) {\n that.circular = true;\n return;\n }\n that.list = [...newlist, ...that.list];\n// that.current = current+1;\n// that.currentIndex = current+1;\n },1000),500);\n } */\n if (current >= this.list.length - 3) {\n debounce(setTimeout(function() {\n that.lastPage += 1;\n if (that.lastPage + that.topPage >= totalPage) {\n that.circular = true;\n return;\n }\n that.list = [...that.list, ...nextlist];\n }, 1000), 500);\n }\n }\n },\n toViewPage(e) {\n let item = e.$wx.currentTarget.dataset.item;\n wx.navigateToMiniProgram({\n appId: 'wx91d27dbf599dff74',\n path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径\n // 有效值 develop(开发版),trial(体验版),release(正式版)\n envVersion: 'release',\n success(res) {\n// console.log('跳转成功');\n }\n });\n },\n touchStart (event) {\n touchDotX = event.touches[0].pageX; // 获取触摸时的原点\n touchDotY = event.touches[0].pageY;\n // console.log(\"起始点的坐标X:\" + touchDotX);\n // console.log(\"起始点的坐标Y:\" + touchDotY);\n },\n touchMove(event) {\n let touchX = event.touches[0].pageX;\n let touchY = event.touches[0].pageY;\n // 如果元素拖动到购物车范围\n let {left, top, bottom, right} = this.shopcarPosition;\n if (touchX > left - 10 && touchX < right + 10) {\n if (touchY > top - 10 && touchY < bottom + 10) {\n this.bigshop = true;\n }\n }\n },\n // 移动结束处理动画\n touchEnd(event) {\n // 手指离开屏幕时记录的坐标\n let touchMoveX = event.changedTouches[0].pageX;\n let touchMoveY = event.changedTouches[0].pageY;\n let current = event.currentTarget.dataset;\n // 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差\n let tmX = touchMoveX - touchDotX;\n let tmY = touchMoveY - touchDotY;\n // 两点横纵坐标差的绝对值\n let absX = Math.abs(tmX);\n let absY = Math.abs(tmY);\n // 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之间的距离\n let delta = Math.sqrt(absX * absX + absY * absY);\n // console.log('起始点和离开点距离:' + delta + 'px');\n // 如果delta超过60px(可以视情况自己微调),判定为手势触发\n if (delta >= 40) {\n // 如果 |x0-x1|<|y0-y1|,即absX<abxY,判定为上下滑动\n if (absX < absY) {\n // 如更tmX<0,即(离开点的X)-(起始点X)小于0 ,判定为下滑\n if (tmY < 0) {\n this.deleteAnimation(current);\n // console.log(\"上滑=====\");\n // 如更tmX>0,即(离开点的X)-(起始点X)大于0 ,判定为上滑\n } else {\n // console.log(\"下滑=====\");\n }\n }\n } else {\n // console.log(\"手势未触发=====\");\n }\n },\n deleteAnimation (current) {\n if (current && current.itemid !== undefined) {\n let list = this.list;\n list = list.map((item, index) => {\n item.select = '';\n if (index === +current.itemid) {\n item.select = true;\n }\n return item;\n });\n this.list = list;\n let that = this;\n // 如果剩下4个就不让他循环了,这时候就一屏显示出来了\n if (list.length <= 4) {\n this.circular = false;\n }\n if (current.itemid >= list.length - 1) {\n this.current = this.currentIndex - 1;\n }\n setTimeout(function() {\n let newlist = that.list.filter((item, index) => index !== +current.itemid);\n // 正常情况下,current.itemid都会比current大一个,因为current有个隐藏元素,当相等或小于的时候就有问题,要重新设置current,最小不能超过0\n if (current.itemid <= that.current) {\n that.current = Math.max(that.current - 1, 0);\n }\n that.list = newlist;\n }, 500);\n }\n }\n }\n });\n</script>\n<style lang=\"less\">\n @import \"../../style/common\";\n .footer {\n position: absolute;\n z-index: 9;\n bottom: 20rpx;\n width: 100%;\n }\n .footswiper {\n height: 360rpx;\n }\n .list-item{\n width:220rpx;\n /*height: 330rpx;*/\n background-color:@whiteback;\n border-radius: 10rpx;\n transform: scale(0.7,0.7) translateY(65rpx);\n transition: all 0.5s;\n padding:10rpx 10rpx 5rpx 10rpx;\n margin:0 auto;\n margin-top: 2rpx;\n position: relative;\n }\n .list-item image {\n width: 210rpx;\n display: block;\n height: 210rpx;\n margin:0 auto;\n border-radius: 10rpx;\n }\n .list-item .text {\n font-size: @font-small;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; //行数\n -webkit-box-orient: vertical;\n overflow: hidden;\n line-height:24rpx;\n margin-top:10rpx;\n }\n .list-item .price{\n color:@maincolor;\n font-size:@font-common;\n margin-top:2rpx;\n }\n .list-item .buy{\n font-size: 16rpx;\n color:@darkgrey;\n }\n .list-item.subright {\n transform: scale(0.85,0.85) translateY(26rpx) translateX(25rpx);\n }\n .list-item.subleft {\n transform: scale(0.85,0.85) translateY(26rpx) translateX(-25rpx);\n }\n .list-item.select{\n transform: scale(1,1);\n bottom: 2rpx;\n }\n .list-item.delete {\n opacity:0;\n transform:translateY(-220rpx)\n }\n</style>\n<config>\n {}\n</config>\n"}}}
\ No newline at end of file \ No newline at end of file
<template>
<view class="content {{isActiveDone}}" >
<view class="leftcont">
<swiper
class="list-wrapper"
vertical="{{true}}"
circular="{{true}}"
display-multiple-items="{{activityDisplayItems}}"
bindchange="onActivityChange"
autoplay="{{isAuto}}"
interval="1500">
<swiper-item wx:for="{{list}}" wx:key="index" catch:touchmove>
<view class="imgwrap">
<image class="img" src="{{item.avatarUrl}}"></image>
<view class="text">{{item.content}}</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
props: {
activityList: {
type: Array,
default: []
}
},
data: {
activityDisplayItems: 2,
isActiveDone: '',
isAuto: true,
list: []
},
watch: {
activityList(val) {
let list = val || [];
this.list = list;
}
},
methods: {
onActivityChange(e) {
const lastIndex = this.list.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
this.isActiveDone = 'anima';
setTimeout(() => {
this.isActiveDone = 'anima hide';
this.isAuto = false;
}, 2000);
}
}
}
});
</script>
<style lang="less">
@import "../../style/common";
.content{
position: absolute;
z-index: 9;
bottom: 400rpx;
width: 100%;
color: @whitecolor;
clear: both;
&.anima {
animation:fadeout 2s;
}
&.hide {
display: none;
}
}
.leftcont {
width: 44%;
float: left;
font-size: @font-normal;
margin-left: 30rpx;
}
.list-wrapper {
height: 120rpx;
}
.leftcont .img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
vertical-align: middle;
}
.leftcont .text {
max-width: 200rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10rpx;
vertical-align: middle;
border-radius: 20rpx;
display: inline-block;
font-size: @font-small;
box-sizing: border-box;
padding:6rpx 15rpx;
background-color:rgba(238, 238, 238, 0.2);
}
</style>
<config>
{}
</config>
<wxs module="tools" src="../../common/common.wxs"></wxs>
<template>
<view class="footer">
<swiper
class="footswiper"
display-multiple-items="{{swiperItem}}"
current="{{current}}"
bindchange="moveSwiper"
bindanimationfinish="swipermoveDone"
circular="{{circular}}"
previous-margin="140rpx"
next-margin="120rpx"
catch:touchmove
>
<!--bindtouchstart="touchStart"
bindtouchend="touchEnd"-->
<swiper-item wx:for="{{list}}" wx:key="index">
<view
data-itemid="{{index}}"
bindtap="toViewPage"
data-item="{{item}}"
class="list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length)}}"
>
<image src="{{item.imgsrc}}"></image>
<view class="text">{{item.text}}</view>
<p class="price">{{item.price}}</p>
<p class="buy">{{item.people}}人购买</p>
</view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import wepy from '@wepy/core';
let touchDotX = 0;
let touchDotY = 0;
wepy.component({
props: {
goodsList: {
type: Array,
default: []
}
},
data: {
swiperItem: 2,
current: 5,
currentIndex: 5, // 商品当前滑动到第几个
circular: false, // 商品是否无限循环
topPage: 0,
lastPage: 0,
list: []
},
watch: {
goodsList(val) {
let list = val || [];
this.list = list;
}
},
methods: {
moveSwiper(e) {
if (e.$wx.detail.source === 'touch') {
let current = e.$wx.detail.current;
this.currentIndex = current;
}
},
swipermoveDone(e) {
function debounce(func, wait) {
let timeout;
return function () {
if (timeout) clearTimeout(timeout);
let callNow = !timeout;
timeout = setTimeout(func, wait);
if (callNow) func();
};
}
if (e.$wx.detail.source === 'touch') {
let current = e.$wx.detail.current;
let totalPage = 3;
let nextlist = [
{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},
{value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}
];
let that = this;
/* if(current <= 2) {
debounce(setTimeout(function(){
that.topPage +=1;
if(that.lastPage+that.topPage >= totalPage) {
that.circular = true;
return;
}
that.list = [...newlist, ...that.list];
// that.current = current+1;
// that.currentIndex = current+1;
},1000),500);
} */
if (current >= this.list.length - 3) {
debounce(setTimeout(function() {
that.lastPage += 1;
if (that.lastPage + that.topPage >= totalPage) {
that.circular = true;
return;
}
that.list = [...that.list, ...nextlist];
}, 1000), 500);
}
}
},
toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径
// 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release',
success(res) {
// console.log('跳转成功');
}
});
},
touchStart (event) {
touchDotX = event.touches[0].pageX; // 获取触摸时的原点
touchDotY = event.touches[0].pageY;
// console.log("起始点的坐标X:" + touchDotX);
// console.log("起始点的坐标Y:" + touchDotY);
},
touchMove(event) {
let touchX = event.touches[0].pageX;
let touchY = event.touches[0].pageY;
// 如果元素拖动到购物车范围
let {left, top, bottom, right} = this.shopcarPosition;
if (touchX > left - 10 && touchX < right + 10) {
if (touchY > top - 10 && touchY < bottom + 10) {
this.bigshop = true;
}
}
},
// 移动结束处理动画
touchEnd(event) {
// 手指离开屏幕时记录的坐标
let touchMoveX = event.changedTouches[0].pageX;
let touchMoveY = event.changedTouches[0].pageY;
let current = event.currentTarget.dataset;
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差
let tmX = touchMoveX - touchDotX;
let tmY = touchMoveY - touchDotY;
// 两点横纵坐标差的绝对值
let absX = Math.abs(tmX);
let absY = Math.abs(tmY);
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之间的距离
let delta = Math.sqrt(absX * absX + absY * absY);
// console.log('起始点和离开点距离:' + delta + 'px');
// 如果delta超过60px(可以视情况自己微调),判定为手势触发
if (delta >= 40) {
// 如果 |x0-x1|<|y0-y1|,即absX<abxY,判定为上下滑动
if (absX < absY) {
// 如更tmX<0,即(离开点的X)-(起始点X)小于0 ,判定为下滑
if (tmY < 0) {
this.deleteAnimation(current);
// console.log("上滑=====");
// 如更tmX>0,即(离开点的X)-(起始点X)大于0 ,判定为上滑
} else {
// console.log("下滑=====");
}
}
} else {
// console.log("手势未触发=====");
}
},
deleteAnimation (current) {
if (current && current.itemid !== undefined) {
let list = this.list;
list = list.map((item, index) => {
item.select = '';
if (index === +current.itemid) {
item.select = true;
}
return item;
});
this.list = list;
let that = this;
// 如果剩下4个就不让他循环了,这时候就一屏显示出来了
if (list.length <= 4) {
this.circular = false;
}
if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1;
}
setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid);
// 正常情况下,current.itemid都会比current大一个,因为current有个隐藏元素,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if (current.itemid <= that.current) {
that.current = Math.max(that.current - 1, 0);
}
that.list = newlist;
}, 500);
}
}
}
});
</script>
<style lang="less">
@import "../../style/common";
.footer {
position: absolute;
z-index: 9;
bottom: 20rpx;
width: 100%;
}
.footswiper {
height: 360rpx;
}
.list-item{
width:220rpx;
/*height: 330rpx;*/
background-color:@whiteback;
border-radius: 10rpx;
transform: scale(0.7,0.7) translateY(65rpx);
transition: all 0.5s;
padding:10rpx 10rpx 5rpx 10rpx;
margin:0 auto;
margin-top: 2rpx;
position: relative;
}
.list-item image {
width: 210rpx;
display: block;
height: 210rpx;
margin:0 auto;
border-radius: 10rpx;
}
.list-item .text {
font-size: @font-small;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; //行数
-webkit-box-orient: vertical;
overflow: hidden;
line-height:24rpx;
margin-top:10rpx;
}
.list-item .price{
color:@maincolor;
font-size:@font-common;
margin-top:2rpx;
}
.list-item .buy{
font-size: 16rpx;
color:@darkgrey;
}
.list-item.subright {
transform: scale(0.85,0.85) translateY(26rpx) translateX(25rpx);
}
.list-item.subleft {
transform: scale(0.85,0.85) translateY(26rpx) translateX(-25rpx);
}
.list-item.select{
transform: scale(1,1);
bottom: 2rpx;
}
.list-item.delete {
opacity:0;
transform:translateY(-220rpx)
}
</style>
<config>
{}
</config>
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
border-radius: 50%; border-radius: 50%;
} }
} }
.userimage{ .userimage{
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
...@@ -50,111 +49,6 @@ ...@@ -50,111 +49,6 @@
opacity: 0; opacity: 0;
} }
} }
.content{
position: absolute;
z-index: 9;
bottom: 400rpx;
width: 100%;
color: @whitecolor;
clear: both;
&.anima {
animation:fadeout 2s;
}
&.hide {
display: none;
}
}
.leftcont {
width: 44%;
float: left;
font-size: @font-normal;
margin-left: 30rpx;
}
.list-wrapper {
height: 120rpx;
}
.leftcont .img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
vertical-align: middle;
}
.leftcont .text {
max-width: 200rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10rpx;
vertical-align: middle;
border-radius: 20rpx;
display: inline-block;
font-size: @font-small;
box-sizing: border-box;
padding:6rpx 15rpx;
background-color:rgba(238, 238, 238, 0.2);
}
.footer {
position: absolute;
z-index: 9;
bottom: 20rpx;
width: 100%;
}
.footswiper {
height: 360rpx;
}
.list-item{
width:220rpx;
/*height: 330rpx;*/
background-color:@whiteback;
border-radius: 10rpx;
transform: scale(0.7,0.7) translateY(65rpx);
transition: all 0.5s;
padding:10rpx 10rpx 5rpx 10rpx;
margin:0 auto;
margin-top: 2rpx;
position: relative;
}
.list-item image {
width: 210rpx;
display: block;
height: 210rpx;
margin:0 auto;
border-radius: 10rpx;
}
.list-item .text {
font-size: @font-small;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; //行数
-webkit-box-orient: vertical;
overflow: hidden;
line-height:24rpx;
margin-top:10rpx;
}
.list-item .price{
color:@maincolor;
font-size:@font-common;
margin-top:2rpx;
}
.list-item .buy{
font-size: 16rpx;
color:@darkgrey;
}
.list-item.subright {
transform: scale(0.85,0.85) translateY(26rpx) translateX(25rpx);
}
.list-item.subleft {
transform: scale(0.85,0.85) translateY(26rpx) translateX(-25rpx);
}
.list-item.select{
transform: scale(1,1);
bottom: 2rpx;
}
.list-item.delete {
opacity:0;
transform:translateY(-220rpx)
}
.authmodal{ .authmodal{
width:100%; width:100%;
height:100%; height:100%;
...@@ -181,11 +75,9 @@ ...@@ -181,11 +75,9 @@
} }
} }
</style> </style>
<wxs module="tools" src="../common/common.wxs"></wxs>
<template> <template>
<view class="video-wrapper"> <view class="video-wrapper">
<view id="myvideo"> <view id="myvideo">
<van-notify id="van-notify" />
<prize-list v-if="videoList && videoList.length" :videoList.sync="videoList" :userAccount="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :total="total" bindchange="changeVideo" @getAwardsInfo="getAwardsInfo"> <prize-list v-if="videoList && videoList.length" :videoList.sync="videoList" :userAccount="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :total="total" bindchange="changeVideo" @getAwardsInfo="getAwardsInfo">
</prize-list> </prize-list>
</view> </view>
...@@ -201,65 +93,19 @@ ...@@ -201,65 +93,19 @@
<lottery type="lottery" des="抽奖" @getAwards="getAwards" @getUserInfo="getUserInfo" :authmodal="authmodal"></lottery> <lottery type="lottery" des="抽奖" @getAwards="getAwards" @getUserInfo="getUserInfo" :authmodal="authmodal"></lottery>
<share type="share" des="分享"></share> <share type="share" des="分享"></share>
</view> </view>
<view class="content {{isActiveDone}}" > <activity-list :activityList="activityList"></activity-list>
<view class="leftcont">
<swiper
class="list-wrapper"
vertical="{{true}}"
circular="{{true}}"
display-multiple-items="{{activityDisplayItems}}"
bindchange="onActivityChange"
autoplay="{{isAuto}}"
interval="1500">
<swiper-item wx:for="{{activityList}}" wx:key="index" catch:touchmove>
<view class="imgwrap">
<image class="img" src="{{item.avatarUrl}}"></image>
<view class="text">{{item.content}}</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
<!-- <view class="footer">
<swiper
class="footswiper"
display-multiple-items="{{swiperItem}}"
current="{{current}}"
bindchange="moveSwiper"
bindanimationfinish="swipermoveDone"
circular="{{circular}}"
previous-margin="140rpx"
next-margin="120rpx"
catch:touchmove
>
bindtouchstart="touchStart"
bindtouchend="touchEnd"
<swiper-item wx:for="{{list}}" wx:key="index">
<view
data-itemid="{{index}}"
bindtap="toViewPage"
data-item="{{item}}"
class="list-item {{item.select?'delete':''}} {{tools.computClass(currentIndex,index,list.length)}}"
>
<image src="{{item.imgsrc}}"></image>
<view class="text">{{item.text}}</view>
<p class="price">{{item.price}}</p>
<p class="buy">{{item.people}}人购买</p>
</view>
</swiper-item>
</swiper>
</view> -->
<network v-if="isConnected === false"></network> <network v-if="isConnected === false"></network>
<open-animation v-if="showAwardsModal" :joinRecord="mainInfo && mainInfo.joinRecord"></open-animation> <open-animation v-if="showAwardsModal" :joinRecord="mainInfo && mainInfo.joinRecord"></open-animation>
<shared-popup v-if="showShareModal" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"></shared-popup> <shared-popup v-if="showShareModal" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"></shared-popup>
<popup @showMenu="showMenu" :showMenus="showMenus"></popup> <popup @showMenu="showMenu" :showMenus="showMenus"></popup>
<!--推荐商品列表-->
<!--<goods-list :goodsList="goodsList"></goods-list>-->
<van-dialog id="van-dialog"/> <van-dialog id="van-dialog"/>
<van-notify id="van-notify" />
</view> </view>
</template> </template>
<script> <script>
let touchDotX = 0;
let touchDotY = 0;
import store from '../store'; import store from '../store';
import { mapState, mapActions } from '@wepy/x'; import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core'; import wepy from '@wepy/core';
...@@ -268,22 +114,10 @@ ...@@ -268,22 +114,10 @@
import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js'; import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
wepy.page({ wepy.page({
store, store,
hooks: {
},
data: { data: {
list: [], // 商品list
// 活动信息
activityList: [],
activityDisplayItems: 2,
current: 5, // 商品列表初次展示第几个
swiperItem: 2,
videoList: [], videoList: [],
circular: false, // 商品是否无限循环 goodsList: [],
topPage: 0, activityList: [],
lastPage: 0,
currentIndex: 5, // 商品当前滑动到第几个
authmodal: false, authmodal: false,
sign: true, sign: true,
userImgStyle: '', userImgStyle: '',
...@@ -294,9 +128,7 @@ ...@@ -294,9 +128,7 @@
showShareModal: false, showShareModal: false,
showAwardsModal: false, showAwardsModal: false,
awardsInfo: {}, awardsInfo: {},
isReceive: false, isReceive: false
isActiveDone: '',
isAuto: true
}, },
computed: { computed: {
...@@ -305,122 +137,6 @@ ...@@ -305,122 +137,6 @@
methods: { methods: {
...mapActions([ 'setIsConnected', 'setUserInfo' ]), ...mapActions([ 'setIsConnected', 'setUserInfo' ]),
moveSwiper(e) {
if (e.$wx.detail.source === 'touch') {
let current = e.$wx.detail.current;
this.currentIndex = current;
}
},
swipermoveDone(e) {
function debounce(func, wait) {
let timeout;
return function () {
if (timeout) clearTimeout(timeout);
let callNow = !timeout;
timeout = setTimeout(func, wait);
if (callNow) func();
};
}
if (e.$wx.detail.source === 'touch') {
let current = e.$wx.detail.current;
let totalPage = 3;
let nextlist = [
{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},
{value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}
];
let that = this;
/* if(current <= 2) {
debounce(setTimeout(function(){
that.topPage +=1;
if(that.lastPage+that.topPage >= totalPage) {
that.circular = true;
return;
}
that.list = [...newlist, ...that.list];
// that.current = current+1;
// that.currentIndex = current+1;
},1000),500);
} */
if (current >= this.list.length - 3) {
debounce(setTimeout(function() {
that.lastPage += 1;
if (that.lastPage + that.topPage >= totalPage) {
that.circular = true;
return;
}
that.list = [...that.list, ...nextlist];
}, 1000), 500);
}
}
},
toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径
// 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release',
success(res) {
// console.log('跳转成功');
}
});
},
touchStart (event) {
touchDotX = event.touches[0].pageX; // 获取触摸时的原点
touchDotY = event.touches[0].pageY;
// console.log("起始点的坐标X:" + touchDotX);
// console.log("起始点的坐标Y:" + touchDotY);
},
touchMove(event) {
let touchX = event.touches[0].pageX;
let touchY = event.touches[0].pageY;
// 如果元素拖动到购物车范围
let {left, top, bottom, right} = this.shopcarPosition;
if (touchX > left - 10 && touchX < right + 10) {
if (touchY > top - 10 && touchY < bottom + 10) {
this.bigshop = true;
}
}
},
// 移动结束处理动画
touchEnd(event) {
// 手指离开屏幕时记录的坐标
let touchMoveX = event.changedTouches[0].pageX;
let touchMoveY = event.changedTouches[0].pageY;
let current = event.currentTarget.dataset;
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差
let tmX = touchMoveX - touchDotX;
let tmY = touchMoveY - touchDotY;
// 两点横纵坐标差的绝对值
let absX = Math.abs(tmX);
let absY = Math.abs(tmY);
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之间的距离
let delta = Math.sqrt(absX * absX + absY * absY);
// console.log('起始点和离开点距离:' + delta + 'px');
// 如果delta超过60px(可以视情况自己微调),判定为手势触发
if (delta >= 40) {
// 如果 |x0-x1|<|y0-y1|,即absX<abxY,判定为上下滑动
if (absX < absY) {
// 如更tmX<0,即(离开点的X)-(起始点X)小于0 ,判定为下滑
if (tmY < 0) {
this.deleteAnimation(current);
// console.log("上滑=====");
// 如更tmX>0,即(离开点的X)-(起始点X)大于0 ,判定为上滑
} else {
// console.log("下滑=====");
}
}
} else {
// console.log("手势未触发=====");
}
},
async getUserInfo (e, isFromLottery) { async getUserInfo (e, isFromLottery) {
if (e.$wx.detail.userInfo) { if (e.$wx.detail.userInfo) {
this.setUserInfo(e.$wx.detail.userInfo); this.setUserInfo(e.$wx.detail.userInfo);
...@@ -431,38 +147,9 @@ ...@@ -431,38 +147,9 @@
} }
} }
}, },
changeVideo(e) { changeVideo() {
this.setIsConnected(); this.setIsConnected();
}, },
deleteAnimation (current) {
if (current && current.itemid !== undefined) {
let list = this.list;
list = list.map((item, index) => {
item.select = '';
if (index === +current.itemid) {
item.select = true;
}
return item;
});
this.list = list;
let that = this;
// 如果剩下4个就不让他循环了,这时候就一屏显示出来了
if (list.length <= 4) {
this.circular = false;
}
if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1;
}
setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid);
// 正常情况下,current.itemid都会比current大一个,因为current有个隐藏元素,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if (current.itemid <= that.current) {
that.current = Math.max(that.current - 1, 0);
}
that.list = newlist;
}, 500);
}
},
signIn: async function() { signIn: async function() {
let that = this; let that = this;
const tmplIds = [ const tmplIds = [
...@@ -470,7 +157,6 @@ ...@@ -470,7 +157,6 @@
'_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY', '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ' '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
]; ];
const { subscriptionsSetting } = await wepy.wx.getSetting({ withSubscriptions: true }); const { subscriptionsSetting } = await wepy.wx.getSetting({ withSubscriptions: true });
if (subscriptionsSetting && (!subscriptionsSetting.mainSwitch || subscriptionsSetting.itemSettings)) { if (subscriptionsSetting && (!subscriptionsSetting.mainSwitch || subscriptionsSetting.itemSettings)) {
let isAlwaysAgree = true; let isAlwaysAgree = true;
...@@ -492,7 +178,6 @@ ...@@ -492,7 +178,6 @@
return; return;
} }
} }
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [ tmplIds: [
'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4', 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
...@@ -607,17 +292,8 @@ ...@@ -607,17 +292,8 @@
// 1期方案先一次取50 // 1期方案先一次取50
const list = await getActivityFeed({ count: 50 }); const list = await getActivityFeed({ count: 50 });
this.activityList = list; this.activityList = list;
},
onActivityChange(e) {
const lastIndex = this.activityList.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
this.isActiveDone = 'anima';
setTimeout(() => {
this.isActiveDone = 'anima hide';
this.isAuto = false;
}, 2000);
}
} }
}, },
async onLoad (options) { async onLoad (options) {
if (options.openid) { if (options.openid) {
...@@ -656,7 +332,7 @@ ...@@ -656,7 +332,7 @@
}); });
</script> </script>
<config> <config>
{ {
navigationBarTitleText: '主页', navigationBarTitleText: '主页',
usingComponents: { usingComponents: {
'van-button': '../components/vant/button/index', 'van-button': '../components/vant/button/index',
...@@ -671,7 +347,9 @@ ...@@ -671,7 +347,9 @@
'popup': '~@/components/custom/popup', 'popup': '~@/components/custom/popup',
'van-notify': '~@/components/vant/notify/index', 'van-notify': '~@/components/vant/notify/index',
'shared-popup': '~@/components/custom/sharedPopup', 'shared-popup': '~@/components/custom/sharedPopup',
'van-dialog': '~@/components/vant/dialog/index' 'van-dialog': '~@/components/vant/dialog/index',
'goods-list': '../components/custom/goodsList',
'activity-list': '../components/custom/activityList'
}, },
navigationStyle: "custom", navigationStyle: "custom",
disableScroll: true disableScroll: true
......
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
<van-image use-loading-slot src="{{item.prize.photoUrl}}" class="item-img" width="150rpx" height="150rpx" radius="10rpx" fit="cover"> <van-image use-loading-slot src="{{item.prize.photoUrl}}" class="item-img" width="150rpx" height="150rpx" radius="10rpx" fit="cover">
<van-loading slot="loading" type="spinner" size="20" vertical /> <van-loading slot="loading" type="spinner" size="20" vertical />
</van-image> </van-image>
<!--<image src="{{item.prize.photoUrl}}" class="item-img"></image>-->
<view class="item-right"> <view class="item-right">
<view class="item-title">{{item.prize.name}}</view> <view class="item-title">{{item.prize.name}}</view>
<view class="item-corn">花费: {{item.quantity}}克币</view> <view class="item-corn">花费: {{item.quantity}}克币</view>
......
...@@ -201,11 +201,13 @@ ...@@ -201,11 +201,13 @@
}, },
onLoad (query) { onLoad (query) {
let joinRecordId = query.joinRecordId || ''; this.joinRecordId = query.joinRecordId;
this.joinRecordId = joinRecordId; if (this.joinRecordId === '' || this.joinRecordId === undefined) {
if (!joinRecordId) Notify({message: '缺少参数错误!'}); Notify({message: '缺少参数错误!'});
return;
}
// 请求接口得到数据 // 请求接口得到数据
getOneRaffle({joinRecordId: joinRecordId}).then(data => { getOneRaffle({joinRecordId: this.joinRecordId}).then(data => {
let dat = data || {}; let dat = data || {};
this.prize = dat.prize; this.prize = dat.prize;
this.quantity = dat.quantity; this.quantity = dat.quantity;
...@@ -215,9 +217,6 @@ ...@@ -215,9 +217,6 @@
this.phone = data.phone; this.phone = data.phone;
}); });
this.areaList = area.areaList; this.areaList = area.areaList;
/* this.prize = {cash:false,name:'Nintendo Switch任天堂游戏机Nintendo Switch任天堂游戏机',photoUrl:'/static/images/test2.png',coinQuantity:5000};
this.quantity = 300;
this.chance = raffle.getProbability(this.quantity,this.prize.coinQuantity); */
} }
}); });
</script> </script>
......
...@@ -306,9 +306,9 @@ ...@@ -306,9 +306,9 @@
async confirmRaff() { async confirmRaff() {
let title = ['参与成功!', '参与失败!', '参与失败!']; let title = ['参与成功!', '参与失败!', '参与失败!'];
let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。']; let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。'];
// 如果用户还未注册
// 用户抽奖之前一定要注册 // 用户抽奖之前一定要注册
let isRegister = wx.getStorageSync('isRegister'); let isRegister = wx.getStorageSync('isRegister');
// 如果用户还未注册
if (isRegister === false) { if (isRegister === false) {
await register(store.state.userInfo); await register(store.state.userInfo);
wx.setStorageSync('isRegister', true); wx.setStorageSync('isRegister', true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment