Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
cc931467
Commit
cc931467
authored
Jun 16, 2020
by
付清曌
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/corn2' into 'master'
Feature/corn2 See merge request
!55
parents
aec3a247
2b4b7b8d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
46 deletions
+60
-46
.eslintcache
.eslintcache
+1
-1
api.js
src/common/api.js
+1
-1
raffleProbability.js
src/common/raffleProbability.js
+1
-1
activityList.wpy
src/components/custom/activityList.wpy
+7
-4
goodsList.wpy
src/components/custom/goodsList.wpy
+11
-12
popup.wpy
src/components/custom/popup.wpy
+1
-1
prizeList.wpy
src/components/custom/prizeList.wpy
+2
-2
sign.wpy
src/components/custom/sign.wpy
+2
-2
index.wpy
src/pages/index.wpy
+20
-16
prize.wpy
src/pages/prize.wpy
+8
-4
raffle.wpy
src/pages/raffle.wpy
+6
-2
No files found.
.eslintcache
View file @
cc931467
{"/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"}}}
{"/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":1635,"mtime":1592215601788,"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":665,"mtime":1592213686500,"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":2283,"mtime":1591932403845,"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":1200,"mtime":1591932403848,"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":4345,"mtime":1592215601790,"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":11701,"mtime":1592215601790,"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":3088,"mtime":1591786781412,"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/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":1591776725635,"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":7686,"mtime":1592218750771,"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":12698,"mtime":1592216321629,"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":816,"mtime":1591777292874,"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":7838,"mtime":1592216321628,"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":2430,"mtime":1592215601789,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/activityList.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy":{"size":10585,"mtime":1592215630500,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy":{"size":16109,"mtime":1592216321629,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy","messages":[],"errorCount":0,"warningCount":0}}}
\ No newline at end of file
\ No newline at end of file
src/common/api.js
View file @
cc931467
...
@@ -53,5 +53,5 @@ module.exports = {
...
@@ -53,5 +53,5 @@ module.exports = {
},
},
checkCornCode
(
params
)
{
checkCornCode
(
params
)
{
return
http
.
post
(
'
/api/user/addCoins
'
,
params
);
return
http
.
post
(
'
/api/user/addCoins
'
,
params
);
}
,
}
};
};
src/common/raffleProbability.js
View file @
cc931467
...
@@ -16,7 +16,7 @@ function getProbability (quantity, coinQuantity) {
...
@@ -16,7 +16,7 @@ function getProbability (quantity, coinQuantity) {
var
value2
=
coinQuantity
/
divisor
;
var
value2
=
coinQuantity
/
divisor
;
// 如果分子比分母大说明中奖概率是100%,那么返回中奖概率
// 如果分子比分母大说明中奖概率是100%,那么返回中奖概率
if
(
value
>=
value2
)
{
if
(
value
>=
value2
)
{
return
coinQuantity
+
'
/
'
+
coinQuantity
;
return
'
100%
'
;
}
else
{
}
else
{
return
value
+
'
/
'
+
value2
;
return
value
+
'
/
'
+
value2
;
}
}
...
...
src/components/custom/activityList.wpy
View file @
cc931467
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<swiper
<swiper
class="list-wrapper"
class="list-wrapper"
vertical="{{true}}"
vertical="{{true}}"
circular="{{
tru
e}}"
circular="{{
fals
e}}"
display-multiple-items="{{activityDisplayItems}}"
display-multiple-items="{{activityDisplayItems}}"
bindchange="onActivityChange"
bindchange="onActivityChange"
autoplay="{{isAuto}}"
autoplay="{{isAuto}}"
...
@@ -45,10 +45,13 @@
...
@@ -45,10 +45,13 @@
onActivityChange(e) {
onActivityChange(e) {
const lastIndex = this.list.length - this.activityDisplayItems;
const lastIndex = this.list.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
if (e.$wx.detail.current === lastIndex) {
this.isActiveDone = 'anima';
this.isAuto = false;
// 当最后一个出来的时候等一秒再消失
setTimeout(() => {
setTimeout(() => {
this.isActiveDone = 'anima hide';
this.isActiveDone = 'anima';
this.isAuto = false;
setTimeout(() => {
this.isActiveDone = 'anima hide';
}, 2000);
}, 2000);
}, 2000);
}
}
}
}
...
...
src/components/custom/goodsList.wpy
View file @
cc931467
...
@@ -54,18 +54,18 @@
...
@@ -54,18 +54,18 @@
watch: {
watch: {
goodsList(val) {
goodsList(val) {
/* let list = val || [];
/* let list = val || [];
this.list = list;*/
this.list = list;
*/
}
}
},
},
created() {
created() {
//获取推荐的商品列表
//
获取推荐的商品列表
this.list = [{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
this.list = [{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: 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: 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: 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'},{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'},
{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: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'}
];
];
},
},
methods: {
methods: {
moveSwiper(e) {
moveSwiper(e) {
...
@@ -116,9 +116,8 @@
...
@@ -116,9 +116,8 @@
that.lastPage += 1;
that.lastPage += 1;
if (that.lastPage + that.topPage >= totalPage) {
if (that.lastPage + that.topPage >= totalPage) {
that.circular = true;
that.circular = true;
return;
}
}
//
that.list = [...that.list, ...nextlist];
that.list = [...that.list, ...nextlist];
}, 1000), 500);
}, 1000), 500);
}
}
}
}
...
@@ -200,22 +199,22 @@
...
@@ -200,22 +199,22 @@
if (list.length <= 4) {
if (list.length <= 4) {
this.circular = false;
this.circular = false;
}
}
console.log(current.itemid,
this.currentIndex,this.current,111)
console.log(current.itemid,
this.currentIndex, this.current, 111);
if (current.itemid >= list.length - 1) {
if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1;
this.current = this.currentIndex - 1;
}
}
setTimeout(function() {
setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid);
let newlist = that.list.filter((item, index) => index !== +current.itemid);
// 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
// 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if(newlist.length <= that.swiperItem) {
if
(newlist.length <= that.swiperItem) {
that.swiperItem = newlist.length;
that.swiperItem = newlist.length;
}
}
that.list = newlist;
that.list = newlist;
if (current.itemid - that.current !==
1
) {
if (current.itemid - that.current !==
1
) {
that.current = Math.max(that.current - 1, 0);
that.current = Math.max(that.current - 1, 0);
}
}
//删除完成之后
//
删除完成之后
console.log(current.itemid,
that.currentIndex,that.current,222)
console.log(current.itemid,
that.currentIndex, that.current, 222);
}, 500);
}, 500);
}
}
}
}
...
...
src/components/custom/popup.wpy
View file @
cc931467
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
created() {
created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px');
statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px');
}
,
}
});
});
</script>
</script>
<style lang="less">
<style lang="less">
...
...
src/components/custom/prizeList.wpy
View file @
cc931467
...
@@ -161,8 +161,8 @@
...
@@ -161,8 +161,8 @@
let detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
detail = detail || {};
if (detail.join > detail.quantity) detail.join = detail.quantity;
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity;
const progressFloat = detail.join / detail.quantity
* 100
;
let progress = Math.round(progressFloat
* 100
) + '%';
let progress = Math.round(progressFloat) + '%';
if (progressFloat > 0 && progressFloat < 1) progress = '1%';
if (progressFloat > 0 && progressFloat < 1) progress = '1%';
this.curQueue.forEach(v => {
this.curQueue.forEach(v => {
...
...
src/components/custom/sign.wpy
View file @
cc931467
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
authmodal: {
authmodal: {
type: Boolean,
type: Boolean,
default: false
default: false
}
,
}
},
},
computed: {
computed: {
...mapState(['safeAreaStyle']),
...mapState(['safeAreaStyle']),
...
@@ -185,7 +185,7 @@
...
@@ -185,7 +185,7 @@
showCornModal() {
showCornModal() {
this.$emit('showCorn');
this.$emit('showCorn');
}
}
}
,
}
});
});
</script>
</script>
<style lang="less">
<style lang="less">
...
...
src/pages/index.wpy
View file @
cc931467
...
@@ -205,6 +205,7 @@
...
@@ -205,6 +205,7 @@
import Notify from '../components/vant/notify/notify';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import Dialog from '../components/vant/dialog/dialog';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
let flag = false;
wepy.page({
wepy.page({
store,
store,
data: {
data: {
...
@@ -218,18 +219,18 @@
...
@@ -218,18 +219,18 @@
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
awardsInfo: {},
awardsInfo: {},
isReceive: false, // 是否显示领取克币动画
isReceive: false, // 是否显示领取克币动画
cornModal:false,
cornModal:
false,
cornCode: '', //克币充值码
cornCode: '', //
克币充值码
cornText:'',
cornText:
'',
cornTextShow: false
,
cornTextShow: false
},
},
computed: {
computed: {
...mapState([ 'isConnected', 'userInfo', 'safeAreaStyle' ])
...mapState([ 'isConnected', 'userInfo', 'safeAreaStyle' ])
},
},
watch: {
watch: {
cornCode(val,oldval) {
cornCode(val,
oldval) {
if (val
!==
oldval && this.cornTextShow) {
if (val
!==
oldval && this.cornTextShow) {
this.cornTextShow = false;
this.cornTextShow = false;
}
}
}
}
...
@@ -410,25 +411,24 @@
...
@@ -410,25 +411,24 @@
this.cornModal = false;
this.cornModal = false;
},
},
checkCode() {
checkCode() {
if
(this.cornCode
== '') {
if
(this.cornCode =
== '') {
this.cornText = '请输入克币充值码';
this.cornText = '请输入克币充值码';
this.cornTextShow = true;
this.cornTextShow = true;
return;
return;
}
}
const msg = ['充值码无效,请重新输入','该充值码已被使用,请重新输入'];
const msg = ['充值码无效,请重新输入',
'该充值码已被使用,请重新输入'];
checkCornCode({code:
this.cornCode}).then(data=>
{
checkCornCode({code:
this.cornCode}).then(data =>
{
if
(data.code === 0)
{
if
(data.code === 0)
{
//充值成功
//
充值成功
this.cornModal = false;
this.cornModal = false;
this.mainInfo.account.quantity = data.accountCoins;
this.mainInfo.account.quantity = data.accountCoins;
this.isReceive = true;
this.isReceive = true;
} else {
} else {
const msgindex = data.code
+
2;
const msgindex = data.code
+
2;
this.cornText = msg[msgindex];
this.cornText = msg[msgindex];
this.cornTextShow = true;
this.cornTextShow = true;
}
}
});
});
},
},
resetAddGold() {
resetAddGold() {
this.isReceive = false;
this.isReceive = false;
...
@@ -447,6 +447,8 @@
...
@@ -447,6 +447,8 @@
// 获取openid
// 获取openid
await this.getOpenId();
await this.getOpenId();
this.getMainInfo();
flag = true;
// 获取用户信息并注册
// 获取用户信息并注册
if (this.userInfo.nickName) {
if (this.userInfo.nickName) {
...
@@ -462,18 +464,20 @@
...
@@ -462,18 +464,20 @@
}
}
}
}
// 获取主页信息
this.getMainInfo();
// 获取活动信息
// 获取活动信息
this.showActivity();
this.showActivity();
// 获取奖品列表
// 获取奖品列表
this.videoList = await getPrizeList(options.prizeId);
this.videoList = await getPrizeList(options.prizeId);
},
},
async onShow() {
async onShow() {
// 获取主页信息
if(flag) {
this.getMainInfo();
}
let join = wx.getStorageSync('userJoin');
let join = wx.getStorageSync('userJoin');
if (join === 1) {
if (join === 1) {
wx.removeStorageSync('userJoin');
wx.removeStorageSync('userJoin');
this.getMainInfo();
this.showActivity();
this.showActivity();
}
}
}
}
...
...
src/pages/prize.wpy
View file @
cc931467
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
position: fixed;
position: fixed;
bottom:0;
bottom:0;
left:0;
left:0;
z-index: 9;
.getprize{
.getprize{
position: absolute;
position: absolute;
width:160rpx;
width:160rpx;
...
@@ -58,6 +59,9 @@
...
@@ -58,6 +59,9 @@
font-size: @font-large;
font-size: @font-large;
}
}
}
}
.addtitle{
color:#c8c9cc
}
.van-picker .van-picker__cancel,.van-picker .van-picker__confirm{
.van-picker .van-picker__cancel,.van-picker .van-picker__confirm{
color:@maincolor;
color:@maincolor;
}
}
...
@@ -78,9 +82,9 @@
...
@@ -78,9 +82,9 @@
<view class="address-title">添加收货地址</view>
<view class="address-title">添加收货地址</view>
<view class="address-cont">
<view class="address-cont">
<van-field value="{{name}}" data-form="name" placeholder="收货人" bind:input ="setValue"></van-field>
<van-field value="{{name}}" data-form="name" placeholder="收货人" bind:input ="setValue"></van-field>
<van-field value="{{phone}}" data-form="phone" placeholder="手机号码" bind:input ="setValue"></van-field>
<van-field value="{{phone}}" data-form="phone" placeholder="手机号码" bind:input ="setValue"
maxlength="{{11}}"
></van-field>
<van-field value="{{idNumber}}" data-form="idNumber" placeholder="收货人身份证号" bind:input ="setValue"></van-field>
<van-field value="{{idNumber}}" data-form="idNumber" placeholder="收货人身份证号
(应监管要求,必须填写)
" bind:input ="setValue"></van-field>
<van-
field value="{{cityValue}}" placeholder="所在地区" bindtap="onClose" is-link readonly></van-field
>
<van-
cell title="{{cityValue}}" is-link bindtap="onClose" title-class="{{!city?'addtitle':''}}"></van-cell
>
<van-field value="{{address}}" data-form="address" placeholder="详细地址:如街道、小区、门牌号、楼栋号等" bind:input ="setValue"></van-field>
<van-field value="{{address}}" data-form="address" placeholder="详细地址:如街道、小区、门牌号、楼栋号等" bind:input ="setValue"></van-field>
</view>
</view>
</view>
</view>
...
@@ -112,7 +116,7 @@
...
@@ -112,7 +116,7 @@
province: '',
province: '',
city: '',
city: '',
county: '',
county: '',
cityValue: '',
cityValue: '
所在地区
',
areaList: [],
areaList: [],
showAddress: false,
showAddress: false,
joinRecordId: null,
joinRecordId: null,
...
...
src/pages/raffle.wpy
View file @
cc931467
...
@@ -319,6 +319,10 @@
...
@@ -319,6 +319,10 @@
await register(store.state.userInfo);
await register(store.state.userInfo);
wx.setStorageSync('isRegister', true);
wx.setStorageSync('isRegister', true);
}
}
if (!this.batchId) {
Notify({message: '数据加载中,请稍后重试!'});
return;
}
this.btnfont = '参与中...';
this.btnfont = '参与中...';
confirmRaffle({batchId: this.batchId}).then(data => {
confirmRaffle({batchId: this.batchId}).then(data => {
this.btnfont = '立即参与';
this.btnfont = '立即参与';
...
@@ -358,8 +362,8 @@
...
@@ -358,8 +362,8 @@
this.batchId = detail.id;
this.batchId = detail.id;
if (detail.quantity) {
if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity;
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity;
const progressFloat = detail.join / detail.quantity
* 100
;
this.progress = Math.round(progressFloat
* 100
) + '%';
this.progress = Math.round(progressFloat) + '%';
// 当进度介于0 - 1之间时显示1
// 当进度介于0 - 1之间时显示1
if (progressFloat > 0 && progressFloat < 1) this.progress = '1%';
if (progressFloat > 0 && progressFloat < 1) this.progress = '1%';
this.progressStyle = 'width:' + this.progress;
this.progressStyle = 'width:' + this.progress;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment