From f3115fe7c8be3254a431401f2173e0ddb648aef2 Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Tue, 6 Feb 2024 12:42:46 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=E5=AF=BB=E7=9C=8B=E7=82=B9=E5=92=8C?= =?UTF-8?q?=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/favorite.js | 71 + api/lottery.js | 31 + api/order.js | 4 +- api/store.js | 7 + api/user.js | 6 + api/video.js | 50 + assets/css/style.less | 13 +- components/CheckboxIcon.vue | 55 + components/CheckboxIcon_bak20240206.vue | 57 + components/CitySelect.vue | 6 +- components/CouponListWindow.vue | 122 -- components/CouponPop.vue | 75 - components/Coupons.vue | 10 +- components/chose-city/chose-city.vue | 9 +- components/drag-button/drag-button.vue | 142 -- components/ls-swiper/index.md | 40 - components/ls-swiper/index.vue | 180 -- .../components/mescroll-empty.vue | 3 +- main.js | 2 + manifest.json | 325 ++- package.json | 2 + pages.json | 135 +- pages/cart.vue | 309 +++ pages/cart_bak20240206.vue | 307 +++ pages/cart_bak_for_vue2.vue | 238 +++ pages/foodInfomation/foodInfomation.vue | 973 --------- pages/foodInfomation/foodInfomationDetail.vue | 210 -- pages/foodInfomation/information.vue | 163 -- pages/home/index.vue | 67 +- pages/order/MyOrder/index.vue | 10 +- pages/order/OrderSubmission/index.vue | 12 +- pages/shop/GoodsCon/index.vue | 44 +- pages/shop/GoodsCon/index_bak20240206.vue | 1894 +++++++++++++++++ pages/shop/ShoppingCart/index.vue | 701 ------ pages/user/Message/Message.vue | 5 +- pages/user/User/index.vue | 218 +- .../user/address/AddressManagement/index.vue | 4 +- pages/user/coupon/GetCoupon/index.vue | 107 - pages/user/coupon/UserCoupon/index.vue | 79 - pages/user/promotion/CashRecord/index.vue | 162 -- pages/user/promotion/UserPromotion/index.vue | 2 +- pagesInn/inn/innHome.vue | 59 +- pkg-video/views/city.vue | 163 ++ pkg-video/views/lottery-log.vue | 122 ++ pkg-video/views/lottery.vue | 341 +++ pkg-video/views/watch.vue | 360 ++++ pkg_product/views/giftList.vue | 5 +- pkg_product/views/healthList.vue | 4 +- pkg_product/views/landMark.vue | 61 - pkg_product/views/season-bak.vue | 246 --- pkg_user/views/bankCardList.vue | 5 +- pkg_user/views/myFavorite.vue | 551 +++++ pkg_user/views/personalData.vue | 241 +-- pkg_user/views/withdrawal.vue | 2 +- pkg_user/views/withdrawalLog.vue | 98 + utils/index.js | 49 +- utils/request.js | 28 +- v4/components/@lucky-canvas/uni/LICENSE | 201 -- v4/components/@lucky-canvas/uni/README.md | 138 -- .../@lucky-canvas/uni/lucky-grid.vue | 317 --- .../@lucky-canvas/uni/lucky-wheel.vue | 255 --- v4/components/@lucky-canvas/uni/package.json | 53 - .../@lucky-canvas/uni/slot-machine.vue | 214 -- v4/components/@lucky-canvas/uni/utils.js | 82 - v4/components/lucky-canvas/LICENSE | 201 -- v4/components/lucky-canvas/README.md | 42 - v4/components/lucky-canvas/index.js | 1 - v4/components/lucky-canvas/package.json | 96 - v4/components/lucky-canvas/types/index.d.ts | 761 ------- v4/views/luck/logs.vue | 117 - v4/views/luck/luck.vue | 382 ---- v4/views/luck/receive.vue | 159 -- wenwan/views/store.vue | 7 +- 73 files changed, 5324 insertions(+), 6887 deletions(-) create mode 100644 api/favorite.js create mode 100644 api/lottery.js create mode 100644 api/video.js create mode 100644 components/CheckboxIcon.vue create mode 100644 components/CheckboxIcon_bak20240206.vue delete mode 100644 components/CouponListWindow.vue delete mode 100644 components/CouponPop.vue delete mode 100644 components/drag-button/drag-button.vue delete mode 100644 components/ls-swiper/index.md delete mode 100644 components/ls-swiper/index.vue create mode 100644 pages/cart.vue create mode 100644 pages/cart_bak20240206.vue create mode 100644 pages/cart_bak_for_vue2.vue delete mode 100644 pages/foodInfomation/foodInfomation.vue delete mode 100644 pages/foodInfomation/foodInfomationDetail.vue delete mode 100644 pages/foodInfomation/information.vue create mode 100644 pages/shop/GoodsCon/index_bak20240206.vue delete mode 100644 pages/shop/ShoppingCart/index.vue delete mode 100644 pages/user/coupon/GetCoupon/index.vue delete mode 100644 pages/user/coupon/UserCoupon/index.vue delete mode 100644 pages/user/promotion/CashRecord/index.vue create mode 100644 pkg-video/views/city.vue create mode 100644 pkg-video/views/lottery-log.vue create mode 100644 pkg-video/views/lottery.vue create mode 100644 pkg-video/views/watch.vue delete mode 100644 pkg_product/views/landMark.vue delete mode 100644 pkg_product/views/season-bak.vue create mode 100644 pkg_user/views/myFavorite.vue create mode 100644 pkg_user/views/withdrawalLog.vue delete mode 100644 v4/components/@lucky-canvas/uni/LICENSE delete mode 100644 v4/components/@lucky-canvas/uni/README.md delete mode 100644 v4/components/@lucky-canvas/uni/lucky-grid.vue delete mode 100644 v4/components/@lucky-canvas/uni/lucky-wheel.vue delete mode 100644 v4/components/@lucky-canvas/uni/package.json delete mode 100644 v4/components/@lucky-canvas/uni/slot-machine.vue delete mode 100644 v4/components/@lucky-canvas/uni/utils.js delete mode 100644 v4/components/lucky-canvas/LICENSE delete mode 100644 v4/components/lucky-canvas/README.md delete mode 100644 v4/components/lucky-canvas/index.js delete mode 100644 v4/components/lucky-canvas/package.json delete mode 100644 v4/components/lucky-canvas/types/index.d.ts delete mode 100644 v4/views/luck/logs.vue delete mode 100644 v4/views/luck/luck.vue delete mode 100644 v4/views/luck/receive.vue diff --git a/api/favorite.js b/api/favorite.js new file mode 100644 index 0000000..81fe382 --- /dev/null +++ b/api/favorite.js @@ -0,0 +1,71 @@ +import request from '@/utils/request' + +/** + * 商品是否已收藏 + * */ +export function checkProduct(productId, uniqueId) { + return request.get('/product/hasFavorite', {productId, uniqueId}) +} + +/** + * 添加收藏商品 + * */ +export function addProduct(productId, uniqueId) { + return request.post('/collection/product/add', {productId, uniqueId}) +} + +/** + * 取消收藏商品 + * */ +export function removeProduct(productId, uniqueId) { + return request.post('/collection/product/remove', {productId, uniqueId}) +} + +/** + * 收藏商品列表 + * */ +export function getProductList(page = 1, limit = 10) { + return request.get('/collection/product/list', {page, limit}) +} + +/** + * 添加收藏店铺 + * */ +export function addStore(hotelId) { + return request.post('/collection/hotel/add', {hotelId}) +} + +/** + * 取消收藏店铺 + * */ +export function removeStore(hotelId){ + return request.post('/collection/hotel/remove',{hotelId}) +} + +/** + * 收藏店铺列表 + * */ +export function getStoreList(page = 1, limit = 10) { + return request.get('/collection/hotel/list', {page, limit}) +} + +/** + * 添加收藏视频 + * */ +export function addVideo(videoId) { + return request.post('/collection/video/add', {videoId}) +} + +/** + * 收藏视频列表 + * */ +export function getVideoList(page = 1, limit = 10) { + return request.get('/collection/video/list', {page, limit}) +} + +/** + * 移除收藏项目 + * */ +export function removeFavorite(ids) { + return request.post('/collection/delete', ids) +} \ No newline at end of file diff --git a/api/lottery.js b/api/lottery.js new file mode 100644 index 0000000..14b42b6 --- /dev/null +++ b/api/lottery.js @@ -0,0 +1,31 @@ +import request from '@/utils/request' + +/** + * 抽奖活动信息 + * */ +export function getDetail() { + return request.get('/lottery/dice/detail') +} + +/** + * 抽奖 + * */ +export function getPrize() { + return request.post('/lottery/dice/draw') +} + +/** + * 领奖 + * */ +export function takePrize(lotteryRecordId){ + return request.post('/lottery/takePrize',{lotteryRecordId}) +} + +/** + * 抽奖记录 + * @param page 页码 + * @param limit 每页条数 + * */ +export function getLogs(page = 1, limit = 10) { + return request.get('/lottery/dice/records',{page,limit}) +} \ No newline at end of file diff --git a/api/order.js b/api/order.js index 8684475..7d5d3e2 100644 --- a/api/order.js +++ b/api/order.js @@ -8,9 +8,9 @@ import request from "@/utils/request"; * @param cartId * @returns {*} */ -export function postOrderConfirm(cartId) { +export function postOrderConfirm(cartId,lotteryRecordId='') { return request.post("/order/confirm", { - cartId + cartId,lotteryRecordId }); } diff --git a/api/store.js b/api/store.js index ab0fe2f..85721a5 100644 --- a/api/store.js +++ b/api/store.js @@ -97,6 +97,13 @@ export function getProductPoster(id) { }); } +/** + * 购物车分组列表 + * */ +export function getCartGroup() { + return request.get('/cart/listGroup') +} + /* * 购物车 添加 * */ diff --git a/api/user.js b/api/user.js index 915083b..07dcb0a 100644 --- a/api/user.js +++ b/api/user.js @@ -393,6 +393,12 @@ export function getWithdrawalRecordList(q) { return request.get("/list", q); } +export function payoutLog(page, limit = 3, status) { + let param = {page,limit} + if (status) param.status = status + return request.get('/extract/listGroup', param) +} + /* * 提现银行 * */ diff --git a/api/video.js b/api/video.js new file mode 100644 index 0000000..a570bc7 --- /dev/null +++ b/api/video.js @@ -0,0 +1,50 @@ +import request from '@/utils/request' + +/** + * 寻看点获取随机视频 + * */ +export function randomList(param) { + return request.get('/video/random', param) +} + +/** + * 获取城市列表 + * */ +export function getVideoCity() { + return request.get('/video/cityList') +} + +/** + * 视频点赞 + * */ +export function likeVideo(videoId) { + return request.post('/video/like', {videoId}) +} + +/** + * 视频取消点赞 + * */ +export function removeLikeVideo(videoId) { + return request.post('/video/removeLike', {videoId}) +} + +/** + * 视频取消收藏 + * */ +export function removeFavoriteVideo(videoId) { + return request.post('/video/removeFavorite', {videoId}) +} + +/** + * 获取评论 + * */ +export function getReplyList(id, page, limit = 10) { + return request.get(`/video/replyList/${id}`, {page, limit}) +} + +/** + * 发布评论 + * */ +export function submitReply(videoId, comment) { + return request.post('/video/reply', {videoId, comment}) +} \ No newline at end of file diff --git a/assets/css/style.less b/assets/css/style.less index cc317ad..1dff01f 100644 --- a/assets/css/style.less +++ b/assets/css/style.less @@ -278,9 +278,8 @@ page { } .noCommodity .noPictrue { - width: 4.14*100rpx; - height: 3.36*100rpx; - margin: 0 auto 0.3*100rpx auto; + width: 496rpx; + height: 450rpx; } .noCommodity .noPictrue .image { @@ -2035,8 +2034,8 @@ page { } .shoppingCart .noCart .pictrue { - width: 4.14*100rpx; - height: 3.36*100rpx; + width: 420rpx; + height: 418rpx; margin: 0 auto; } @@ -2406,8 +2405,8 @@ page { } .user .wrapper .myOrder .title .allOrder { - font-size: 0.26*100rpx; - color: #666; + font-size: 26rpx; + color: #999; } .user .wrapper .myOrder .title .allOrder .iconfont { diff --git a/components/CheckboxIcon.vue b/components/CheckboxIcon.vue new file mode 100644 index 0000000..29228c1 --- /dev/null +++ b/components/CheckboxIcon.vue @@ -0,0 +1,55 @@ + + + + + \ No newline at end of file diff --git a/components/CheckboxIcon_bak20240206.vue b/components/CheckboxIcon_bak20240206.vue new file mode 100644 index 0000000..faebedb --- /dev/null +++ b/components/CheckboxIcon_bak20240206.vue @@ -0,0 +1,57 @@ + + + + + \ No newline at end of file diff --git a/components/CitySelect.vue b/components/CitySelect.vue index f7e84eb..e876bbd 100644 --- a/components/CitySelect.vue +++ b/components/CitySelect.vue @@ -81,15 +81,11 @@ diff --git a/components/CouponPop.vue b/components/CouponPop.vue deleted file mode 100644 index e975caf..0000000 --- a/components/CouponPop.vue +++ /dev/null @@ -1,75 +0,0 @@ - - diff --git a/components/Coupons.vue b/components/Coupons.vue index 8a4ec3c..54ba702 100644 --- a/components/Coupons.vue +++ b/components/Coupons.vue @@ -1,6 +1,6 @@ @@ -47,7 +47,7 @@ export default { this.isOpen = !this.isOpen }, goGoods() { - uni.switchTab({url:'/pages/home/landMark'}) + uni.switchTab({url: '/pages/home/landMark'}) // this.$global.navToGoods(this.data.productId) }, selectCoupon() { @@ -72,7 +72,7 @@ export default { .coupons__cover { width: 100%; - height: 300rpx; + height: auto; } .coupons__section { diff --git a/components/chose-city/chose-city.vue b/components/chose-city/chose-city.vue index 51c3395..ef66fb6 100644 --- a/components/chose-city/chose-city.vue +++ b/components/chose-city/chose-city.vue @@ -58,7 +58,7 @@ :key="index" v-if="type===0" @click="goStore(item.hotelId)"> - + {{ item.hotelName }} @@ -486,12 +486,13 @@ export default { } .name { - padding-bottom: 10rpx; - font-size: 24rpx; + padding-bottom: 8rpx; + font-size: 22rpx; + line-height: 1.3; } .text { - padding-bottom: 10rpx; + padding-bottom: 8rpx; font-size: 16rpx; } } diff --git a/components/drag-button/drag-button.vue b/components/drag-button/drag-button.vue deleted file mode 100644 index eb5d78d..0000000 --- a/components/drag-button/drag-button.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - - diff --git a/components/ls-swiper/index.md b/components/ls-swiper/index.md deleted file mode 100644 index 42bb102..0000000 --- a/components/ls-swiper/index.md +++ /dev/null @@ -1,40 +0,0 @@ -# 轮播组件 - -# 基础式 - - -# 链式 - - -# 卡片式 - - -# props -参数名 | 说明 | 类型 | 默认值 ------------------|-------------------------------------------------- -|-------------|------------ -list | 轮播数据 | Array | 必输 -imgKey | 轮播数据key(图片url属性) | String | 必输 (自定义模式,非必输) -autoplay | 是否自动播放 | Boolean | false -loop | 是否循环 | Boolean | false -autoplay | 是否自动播放 | Boolean | false -dots | 是否显示轮播点 | Boolean | false -crown | 卡片特效 (中间突出,两边缩放特效) | Boolean | false -interval | 播放时间间隔 | Number | 2000 -duration | 滑动速度 | Number | 1500 -bottom | 轮播点下边距 | Number | 10 (单位:px,设计图建议以375px为准) -height | 高度 | Number | 200 (单位:px,设计图建议以375px为准) -previousMargin | 图片前边距 | Number | 0 (单位:px,设计图建议以375px为准) -nextMargin | 图片后间距 | Number | 0 (单位:px,设计图建议以375px为准) -imgRadius | 图片圆角 | Number | 0 (单位:px,设计图建议以375px为准) -imgWidth | 图片宽度 | String | 100% -@clickItem | 点击事件 | Function | -@change | 切换事件 | Function | - -# 自定义 - - - - -如有其他需求,可在插槽内编写自定义内容, 自动覆盖原图片样式。 \ No newline at end of file diff --git a/components/ls-swiper/index.vue b/components/ls-swiper/index.vue deleted file mode 100644 index c4aebff..0000000 --- a/components/ls-swiper/index.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - - - diff --git a/components/mescroll-uni/components/mescroll-empty.vue b/components/mescroll-uni/components/mescroll-empty.vue index 1cb84c8..a0347eb 100644 --- a/components/mescroll-uni/components/mescroll-empty.vue +++ b/components/mescroll-uni/components/mescroll-empty.vue @@ -7,7 +7,8 @@ import MescrollEmpty from '@/components/mescroll-uni/components/mescroll-empty.v --> + diff --git a/pages/user/address/AddressManagement/index.vue b/pages/user/address/AddressManagement/index.vue index 99261d2..1fe6d5c 100644 --- a/pages/user/address/AddressManagement/index.vue +++ b/pages/user/address/AddressManagement/index.vue @@ -50,9 +50,9 @@ - + - + diff --git a/pages/user/coupon/GetCoupon/index.vue b/pages/user/coupon/GetCoupon/index.vue deleted file mode 100644 index 2432c18..0000000 --- a/pages/user/coupon/GetCoupon/index.vue +++ /dev/null @@ -1,107 +0,0 @@ - - diff --git a/pages/user/coupon/UserCoupon/index.vue b/pages/user/coupon/UserCoupon/index.vue deleted file mode 100644 index 95254b4..0000000 --- a/pages/user/coupon/UserCoupon/index.vue +++ /dev/null @@ -1,79 +0,0 @@ - - diff --git a/pages/user/promotion/CashRecord/index.vue b/pages/user/promotion/CashRecord/index.vue deleted file mode 100644 index 11d9ea3..0000000 --- a/pages/user/promotion/CashRecord/index.vue +++ /dev/null @@ -1,162 +0,0 @@ - - - - diff --git a/pages/user/promotion/UserPromotion/index.vue b/pages/user/promotion/UserPromotion/index.vue index fe5116f..2b3b37d 100644 --- a/pages/user/promotion/UserPromotion/index.vue +++ b/pages/user/promotion/UserPromotion/index.vue @@ -129,7 +129,7 @@ export default { this.$yrouter.push("/pages/user/promotion/Poster/index"); }, goCashRecord() { - this.$yrouter.push("/pages/user/promotion/CashRecord/index"); + this.$yrouter.push('/pkg_user/views/withdrawalLog'); }, goPromoterList() { this.$yrouter.push("/pages/user/promotion/PromoterList/index"); diff --git a/pagesInn/inn/innHome.vue b/pagesInn/inn/innHome.vue index c377f21..0a31fc9 100644 --- a/pagesInn/inn/innHome.vue +++ b/pagesInn/inn/innHome.vue @@ -42,16 +42,29 @@ inn.guaranteeValue }}元 - - - + + + + + + + + + + + {{ favoriteCount }} + + + @@ -221,13 +234,12 @@ import { import {formatDateTime} from "@/utils"; import {getUrlParam} from "@/utils/common.js"; import imgBox from '@/components/imageTypeSet/imagebox.vue' -import dragButton from "@/components/drag-button/drag-button.vue"; import cookie from "@/utils/store/cookie"; +import {addStore, removeStore} from "@/api/favorite"; export default { components: { - imgBox, - dragButton + imgBox }, data() { return { @@ -249,7 +261,9 @@ export default { posterUrl: "", // 分享海报 id: null, partnerId: null, - isLike: false //点赞 + isLike: false, //点赞 + isFavorite: false, + favoriteCount: 0 } }, //必须在页面加 onPageScroll(e){} ,才能滑动显示背景 @@ -537,6 +551,8 @@ export default { getHotelDetail(that.id).then((res) => { that.inn = res.data; that.isLike = res.data.zanVo !== null; + that.isFavorite = res.data.hasFavorite + that.favoriteCount = res.data.favoriteCount }).catch((err) => { }).finally(() => { @@ -546,6 +562,8 @@ export default { getHomeHotelDetail(that.id).then((res) => { that.inn = res.data; that.isLike = res.data.zanVo !== null; + that.isFavorite = res.data.hasFavorite + that.favoriteCount = res.data.favoriteCount }).catch((err) => { }).finally(() => { @@ -643,6 +661,21 @@ export default { } else { this.$dialog.error('电话为空'); } + }, + async doneFavorite() { + if (this.isFavorite) { + const res = await removeStore(this.id) + if (res.success) { + this.isFavorite = false + this.favoriteCount = res.data.favoriteCount + } + } else { + const res = await addStore(this.id) + if (res.success) { + this.isFavorite = true + this.favoriteCount = res.data.favoriteCount + } + } } } } diff --git a/pkg-video/views/city.vue b/pkg-video/views/city.vue new file mode 100644 index 0000000..eebc40a --- /dev/null +++ b/pkg-video/views/city.vue @@ -0,0 +1,163 @@ + + + + + \ No newline at end of file diff --git a/pkg-video/views/lottery-log.vue b/pkg-video/views/lottery-log.vue new file mode 100644 index 0000000..8efa5db --- /dev/null +++ b/pkg-video/views/lottery-log.vue @@ -0,0 +1,122 @@ + + + + + \ No newline at end of file diff --git a/pkg-video/views/lottery.vue b/pkg-video/views/lottery.vue new file mode 100644 index 0000000..481efaa --- /dev/null +++ b/pkg-video/views/lottery.vue @@ -0,0 +1,341 @@ + + + + + \ No newline at end of file diff --git a/pkg-video/views/watch.vue b/pkg-video/views/watch.vue new file mode 100644 index 0000000..9fbc589 --- /dev/null +++ b/pkg-video/views/watch.vue @@ -0,0 +1,360 @@ + + + + + \ No newline at end of file diff --git a/pkg_product/views/giftList.vue b/pkg_product/views/giftList.vue index c707759..3cc45de 100644 --- a/pkg_product/views/giftList.vue +++ b/pkg_product/views/giftList.vue @@ -80,7 +80,10 @@ export default { noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5 auto: true, empty: { - tip: '暂无商品' // 提示 + tip: '', // 提示 + icon:this.$VUE_APP_RESOURCES_URL+'/20240102232724024787.png', + width:381, + height:348 } }, downOption: { diff --git a/pkg_product/views/healthList.vue b/pkg_product/views/healthList.vue index 37f401c..dc2024f 100644 --- a/pkg_product/views/healthList.vue +++ b/pkg_product/views/healthList.vue @@ -56,9 +56,9 @@ - - + diff --git a/pkg_product/views/landMark.vue b/pkg_product/views/landMark.vue deleted file mode 100644 index 01ed8e2..0000000 --- a/pkg_product/views/landMark.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pkg_product/views/season-bak.vue b/pkg_product/views/season-bak.vue deleted file mode 100644 index 88a375b..0000000 --- a/pkg_product/views/season-bak.vue +++ /dev/null @@ -1,246 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pkg_user/views/bankCardList.vue b/pkg_user/views/bankCardList.vue index 2de47fd..9c06186 100644 --- a/pkg_user/views/bankCardList.vue +++ b/pkg_user/views/bankCardList.vue @@ -65,7 +65,10 @@ export default { noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5 auto: true, empty: { - tip: '暂无银行卡' // 提示 + tip: '', // 提示 + icon:this.$VUE_APP_RESOURCES_URL+'/20240102232713117485.png', + width:458, + height:356 // btnText:'点击刷新' } }, diff --git a/pkg_user/views/myFavorite.vue b/pkg_user/views/myFavorite.vue new file mode 100644 index 0000000..ee37e90 --- /dev/null +++ b/pkg_user/views/myFavorite.vue @@ -0,0 +1,551 @@ + + + + + \ No newline at end of file diff --git a/pkg_user/views/personalData.vue b/pkg_user/views/personalData.vue index f73259a..997aa66 100644 --- a/pkg_user/views/personalData.vue +++ b/pkg_user/views/personalData.vue @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/pkg_user/views/withdrawal.vue b/pkg_user/views/withdrawal.vue index ee87cbc..b387f81 100644 --- a/pkg_user/views/withdrawal.vue +++ b/pkg_user/views/withdrawal.vue @@ -144,7 +144,7 @@ export default { return this.$force2Decimal(sxf); }, goCashRecord() { - this.$yrouter.push("/pages/user/promotion/CashRecord/index"); + this.$yrouter.push('/pkg_user/views/withdrawalLog'); }, clearNoNum: function (value) { diff --git a/pkg_user/views/withdrawalLog.vue b/pkg_user/views/withdrawalLog.vue new file mode 100644 index 0000000..888dc88 --- /dev/null +++ b/pkg_user/views/withdrawalLog.vue @@ -0,0 +1,98 @@ + + + + + \ No newline at end of file diff --git a/utils/index.js b/utils/index.js index a3a3b62..8925a24 100644 --- a/utils/index.js +++ b/utils/index.js @@ -85,6 +85,47 @@ export function formatDateTime(time, format) { }); } +export function timeNow(updateTime) { + if (updateTime === null) { + return '' + } + let now = new Date().getTime() + let second = Math.floor((now - updateTime) / (1000)) + let minute = Math.floor(second / 60) + let hour = Math.floor(minute / 60) + let day = Math.floor(hour / 24) + let month = Math.floor(day / 31) + let year = Math.floor(month / 12) + + console.log(hour); + console.log(minute); + if (year > 0) { + return year + '年前' + } else if (month > 0) { + return month + '月前' + } else if (day > 0) { + let ret = day + '天前' + if (day >= 7 && day < 14) { + ret = '1周前' + } else if (day >= 14 && day < 21) { + ret = '2周前' + } else if (day >= 21 && day < 28) { + ret = '3周前' + } else if (day >= 28 && day < 31) { + ret = '4周前' + } + return ret + } else if (hour > 0) { + return hour + '小时前' + } else if (minute > 0) { + return minute + '分钟前' + } else if (second > 0) { + return second + '秒前' + } else { + return '刚刚' + } +} + export function diffDay(start, end) { var dateBegin = new Date(start.replace(/-/g, "/")); var dateEnd = new Date(end.replace(/-/g, "/")); @@ -426,7 +467,7 @@ export const handleGetUserInfo = () => { } if (url == '/pages/home/index' || url == '/pages/shop/GoodsClass/index' || url == - '/pages/shop/ShoppingCart/index' || url == '/pages/user/User/index') { + '/pages/cart' || url == '/pages/user/User/index') { switchTab({ path: `${url}`, query @@ -559,7 +600,7 @@ export const handleLoginStatus = (location, complete, fail, success) => { }) // if (isAuth) { // // 有token - // if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') { + // if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/cart' || path == '/pages/user/User/index') { // // switchTab({ // // path: parseUrl(location), // // }) @@ -612,7 +653,7 @@ export async function routerPermissions(url, type) { login(loginInfo).then(res => { // 登录成功,跳转到需要跳转的页面 store.commit("updateAuthorizationPage", false); - if (path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') { + if (path == '/pages/cart' || path == '/pages/user/User/index') { return } if (type == 'reLaunch') { @@ -646,7 +687,7 @@ export async function routerPermissions(url, type) { }) } else { // 跳转到登录页面或者授权页面 - // path == '/pages/shop/ShoppingCart/index' || + // path == '/pages/cart' || if ( path == '/pages/user/User/index') { switchTab({ path, diff --git a/utils/request.js b/utils/request.js index 9636122..b46aeb5 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,6 +1,6 @@ import Fly from "flyio/dist/npm/wx"; -import { handleLoginFailure } from "@/utils"; -import { VUE_APP_API_URL } from "@/config"; +import {handleLoginFailure} from "@/utils"; +import {VUE_APP_API_URL} from "@/config"; import cookie from "@/utils/store/cookie"; const fly = new Fly() @@ -17,20 +17,20 @@ fly.interceptors.response.use( console.log('发送请求失败', error) console.log('————————') handleLoginFailure(); - return Promise.reject({ msg: "未登录", toLogin: true }); + return Promise.reject({msg: "未登录", toLogin: true}); } if (error.status == 401) { console.log('————————') console.log('登录失效 401', error) console.log('————————') handleLoginFailure(); - return Promise.reject({ msg: "未登录", toLogin: true }); + return Promise.reject({msg: "未登录", toLogin: true}); } return Promise.reject(error); } ); -const defaultOpt = { login: true }; +const defaultOpt = {login: true}; function baseRequest(options) { @@ -45,7 +45,7 @@ function baseRequest(options) { } // 结构请求需要的参数 - const { url, params, data, login, ...option } = options + const {url, params, data, login, ...option} = options // 发起请求 return fly.request(url, params || data, { @@ -53,15 +53,21 @@ function baseRequest(options) { }).then(res => { const data = res.data || {}; if (res.status !== 200) { - return Promise.reject({ msg: "请求失败", res, data }); + return Promise.reject({msg: "请求失败", res, data}); } if ([401, 403].indexOf(data.status) !== -1) { handleLoginFailure(); - return Promise.reject({ msg: res.data.msg, res, data, toLogin: true }); + return Promise.reject({msg: res.data.msg, res, data, toLogin: true}); } else if (data.status === 200) { return Promise.resolve(data, res); } else { - return Promise.reject({ msg: res.data.msg, res, data }); + uni.showToast({ + title: res.data.msg, + icon: 'none', + success() { + } + }) + return Promise.reject({msg: res.data.msg, res, data}); } }); } @@ -81,7 +87,7 @@ const request = ["post", "put", "patch"].reduce((request, method) => { */ request[method] = (url, data = {}, options = {}) => { return baseRequest( - Object.assign({ url, data, method }, defaultOpt, options) + Object.assign({url, data, method}, defaultOpt, options) ); }; return request; @@ -97,7 +103,7 @@ const request = ["post", "put", "patch"].reduce((request, method) => { */ request[method] = (url, params = {}, options = {}) => { return baseRequest( - Object.assign({ url, params, method }, defaultOpt, options) + Object.assign({url, params, method}, defaultOpt, options) ); }; }); diff --git a/v4/components/@lucky-canvas/uni/LICENSE b/v4/components/@lucky-canvas/uni/LICENSE deleted file mode 100644 index 254bc4b..0000000 --- a/v4/components/@lucky-canvas/uni/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [2021] [Li Dong Qi] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/v4/components/@lucky-canvas/uni/README.md b/v4/components/@lucky-canvas/uni/README.md deleted file mode 100644 index 643a751..0000000 --- a/v4/components/@lucky-canvas/uni/README.md +++ /dev/null @@ -1,138 +0,0 @@ -
- -
- logo -

lucky-canvas 抽奖插件

-

一个基于 JavaScript 的跨平台 ( 大转盘 / 九宫格 / 老虎机 ) 抽奖插件

-

- - stars - - - forks - - - author - - - license - -

-
- - -|适配框架|npm下载量|CDN使用量| -| :-: | :-: | :-: | -|[`JS` / `JQ` 中使用](https://100px.net/usage/js.html)|downloads|downloads| -|[`Vue` 中使用](https://100px.net/usage/vue.html)|downloads|downloads| -|[`React` 中使用](https://100px.net/usage/react.html)|downloads|-| -|[`UniApp` 中使用](https://100px.net/usage/uni.html)|downloads|-| -|[`Taro3.x` 中使用](https://100px.net/usage/taro.html)|downloads|-| -|[`微信小程序` 中使用](https://100px.net/usage/wx.html)|downloads|-| - -
- -## 官方文档 & Demo演示 - -> **中文**:[https://100px.net](https://100px.net) - -> **English**:**If anyone can help translate the document, please contact me** `ldq404@qq.com` - -
- -## 在 uni-app 中使用 - -### 1. 安装插件 - -- 你可以选择通过 `HBuilderX` 导入插件: [https://ext.dcloud.net.cn/plugin?id=3499](https://ext.dcloud.net.cn/plugin?id=3499) - -- 也可以选择通过 `npm` / `yarn` 安装 - -```shell -# npm 安装: -npm install @lucky-canvas/uni - -# yarn 安装: -yarn add @lucky-canvas/uni -``` - -
- -### 2. 引入并使用 - -```html - - - - - - -``` - -```js -// npm 下载会默认到 node_modules 里面,直接引入包名即可 -import LuckyWheel from '@lucky-canvas/uni/lucky-wheel' // 大转盘 -import LuckyGrid from '@lucky-canvas/uni/lucky-grid' // 九宫格 - -// 如果你是通过 HBuilderX 导入插件,那你需要指定一下路径 -// import LuckyWheel from '@/components/@lucky-canvas/uni/lucky-wheel' // 大转盘 -// import LuckyGrid from '@/components/@lucky-canvas/uni/lucky-grid' // 九宫格 - -export default { - // 注册组件 - components: { LuckyWheel, LuckyGrid }, -} -``` - -
- -### 3. 我提供了一个最基本的 demo 供你用于尝试 - -由于 uni-app 渲染 md 的时候会出问题,所以我把 demo 代码放到了文档里 - -- [https://100px.net/document/uni-app.html](https://100px.net/document/uni-app.html) - -
- -### **4. 补充说明** - -- [**如果用着顺手, 可以在 Github 上面点个 支持一下(●'◡'●)**](https://github.com/buuing/lucky-canvas) - -- 另外: 如果你修复了某些bug或兼容, 欢迎提给我, 我会把你展示到官网的贡献者列表当中 - - -
- -### 5. 常见问题 - -1. 转盘层级太高了, 我的弹窗盖不住怎么办? - -> 答: 因为小程序里canvas是原生组件顶层渲染, 我无法控制canvas的层级, 如果你想盖住它也肯简单, 你可以百度搜索``组件 - -2. 你这些素材, 图片组件从哪下载? - -> 答: 官网里的任何图片素材, 所使用到的图片资源均为学习交流使用, 请勿将其用于商业用途, 由此产生的任何商业纠纷我这边概不负责 - -3. xxx属性怎么使用? xxx方法怎么调用? - -> 答: 自己去看文档, 不然难道要我把代码给你写好吗? - -4. 这个属性的效果与官网的描述不一致? - -> 答: 可能有bug, 你可以去github上的issues去提问 (请认真填写模板) - -5. 为什么这个插件不支持app和其他小程序 - -> 答: 没时间, 但是希望志同道合的同学来一起参与uniapp的兼容开发 - ---- - -作者留言: 为了使我自己保持心情愉悦, 低于5星的提问我用浏览器插件都屏蔽了 diff --git a/v4/components/@lucky-canvas/uni/lucky-grid.vue b/v4/components/@lucky-canvas/uni/lucky-grid.vue deleted file mode 100644 index 0c5444f..0000000 --- a/v4/components/@lucky-canvas/uni/lucky-grid.vue +++ /dev/null @@ -1,317 +0,0 @@ - - - - - diff --git a/v4/components/@lucky-canvas/uni/lucky-wheel.vue b/v4/components/@lucky-canvas/uni/lucky-wheel.vue deleted file mode 100644 index 50bdb4d..0000000 --- a/v4/components/@lucky-canvas/uni/lucky-wheel.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - - - diff --git a/v4/components/@lucky-canvas/uni/package.json b/v4/components/@lucky-canvas/uni/package.json deleted file mode 100644 index e8895cf..0000000 --- a/v4/components/@lucky-canvas/uni/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "_from": "@lucky-canvas/uni", - "_id": "@lucky-canvas/uni@0.0.10", - "_inBundle": false, - "_integrity": "sha512-1K7SPr0FT1PfHRYXEh9CwOA/UqayxQosOA8wkZ3w3dfpoB8dij8Y6QGPKjHOMvHRRD1qFU3AEY7XVytjuktVaw==", - "_location": "/@lucky-canvas/uni", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "@lucky-canvas/uni", - "name": "@lucky-canvas/uni", - "escapedName": "@lucky-canvas%2funi", - "scope": "@lucky-canvas", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/@lucky-canvas/uni/-/uni-0.0.10.tgz", - "_shasum": "c1b98bb1875049b11840b7f4aa6bfa1f0230fab2", - "_spec": "@lucky-canvas/uni", - "_where": "/Users/ldq/Desktop/temp/test", - "author": { - "name": "ldq", - "email": "ldq404@qq.com" - }, - "bundleDependencies": false, - "dependencies": { - "lucky-canvas": "~1.7.19" - }, - "deprecated": false, - "description": "uni-app【大转盘 / 九宫格 / 老虎机】抽奖插件", - "files": [ - "lucky-wheel.vue", - "lucky-grid.vue", - "slot-machine.vue", - "utils.js", - "demo.vue" - ], - "keywords": [ - "uni-app抽奖" - ], - "license": "Apache-2.0", - "name": "@lucky-canvas/uni", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "0.0.10" -} diff --git a/v4/components/@lucky-canvas/uni/slot-machine.vue b/v4/components/@lucky-canvas/uni/slot-machine.vue deleted file mode 100644 index e40279b..0000000 --- a/v4/components/@lucky-canvas/uni/slot-machine.vue +++ /dev/null @@ -1,214 +0,0 @@ - - - - - diff --git a/v4/components/@lucky-canvas/uni/utils.js b/v4/components/@lucky-canvas/uni/utils.js deleted file mode 100644 index 3b11952..0000000 --- a/v4/components/@lucky-canvas/uni/utils.js +++ /dev/null @@ -1,82 +0,0 @@ -let windowWidth = uni.getSystemInfoSync().windowWidth -// uni-app@2.9起, 屏幕最多适配到960, 超出则按375计算 -if (windowWidth > 960) windowWidth = 375 - -export const rpx2px = (value) => { - if (typeof value === 'string') value = Number(value.replace(/[a-z]*/g, '')) - return windowWidth / 750 * value -} - -export const changeUnits = (value) => { - return Number(value.replace(/^(\-*[0-9.]*)([a-z%]*)$/, (value, num, unit) => { - switch (unit) { - case 'px': - num *= 1 - break - case 'rpx': - num = rpx2px(num) - break - default: - num *= 1 - break - } - return num - })) -} - -export const resolveImage = async (img, canvas, srcName = 'src', resolveName = '$resolve') => { - let imgObj - // 区分 H5 和小程序 - if (window) { - imgObj = new Image() - } else { - imgObj = canvas.createImage() - } - // 成功回调 - imgObj.onload = () => { - img[resolveName](imgObj) - } - // 失败回调 - imgObj.onerror = (err) => { - console.error(err) - // img['$reject']() - } - // 设置src - imgObj.src = img[srcName] -} - -// 旧版canvas引入图片的方法 -// export const resolveImage = async (res, img, imgName = 'src', resolveName = '$resolve') => { -// const src = img[imgName] -// const $resolve = img[resolveName] -// // #ifdef MP -// // 如果是base64就调用base64src()方法把图片写入本地, 然后渲染临时路径 -// if (/^data:image\/([a-z]+);base64,/.test(src)) { -// const path = await base64src(src) -// $resolve({ ...res.detail, path }) -// return -// } -// // #endif -// // 如果是本地图片, 直接返回 -// if (src.indexOf('http') !== 0) { -// $resolve({ ...res.detail, path:src }) -// return -// } -// // 如果是网络图片, 则通过getImageInfo()方法获取图片宽高 -// uni.getImageInfo({ -// src: src, -// success: (imgObj) => $resolve(imgObj), -// fail: () => console.error('API `uni.getImageInfo` 加载图片失败', src) -// }) -// } - -export function getImage(canvasId, canvas) { - return new Promise((resolve, reject) => { - uni.canvasToTempFilePath({ - canvas, - canvasId, - success: res => resolve(res), - fail: err => reject(err) - }, this) - }) -} diff --git a/v4/components/lucky-canvas/LICENSE b/v4/components/lucky-canvas/LICENSE deleted file mode 100644 index 254bc4b..0000000 --- a/v4/components/lucky-canvas/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [2021] [Li Dong Qi] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/v4/components/lucky-canvas/README.md b/v4/components/lucky-canvas/README.md deleted file mode 100644 index 368a43d..0000000 --- a/v4/components/lucky-canvas/README.md +++ /dev/null @@ -1,42 +0,0 @@ - - -
- logo -

lucky-canvas 抽奖插件

-

一个基于 JavaScript 的跨平台 ( 大转盘 / 九宫格 / 老虎机 ) 抽奖插件

-

- - stars - - - forks - - - author - - - license - -

-
- -
- -## 官方文档 & Demo演示 - -> **中文**:[https://100px.net/usage/js.html](https://100px.net/usage/js.html) - -> **English**:**If anyone can help translate the document, please contact me** `ldq404@qq.com` - - -
- -## 在 JS / TS 中使用 - -- [跳转官网 查看详情](https://100px.net/usage/js.html) - -
- -## 🙏🙏🙏 点个Star - -**如果您觉得这个项目还不错, 可以在 [Github](https://github.com/buuing/lucky-canvas) 上面帮我点个`star`, 支持一下作者 ☜(゚ヮ゚☜)** diff --git a/v4/components/lucky-canvas/index.js b/v4/components/lucky-canvas/index.js deleted file mode 100644 index 458f0dc..0000000 --- a/v4/components/lucky-canvas/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/index.umd.js') diff --git a/v4/components/lucky-canvas/package.json b/v4/components/lucky-canvas/package.json deleted file mode 100644 index 27f87a8..0000000 --- a/v4/components/lucky-canvas/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "_from": "lucky-canvas@~1.7.19", - "_id": "lucky-canvas@1.7.19", - "_inBundle": false, - "_integrity": "sha512-Gh6JZg0mc0ej9eG/UdTxwAY/OV2LsOXOF0XOK1lgCfdhMZM3TSphFi65zGL5lTVbFn9mNhieT6X3f3NNL3ihKg==", - "_location": "/lucky-canvas", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "lucky-canvas@~1.7.19", - "name": "lucky-canvas", - "escapedName": "lucky-canvas", - "rawSpec": "~1.7.19", - "saveSpec": null, - "fetchSpec": "~1.7.19" - }, - "_requiredBy": [ - "/@lucky-canvas/uni" - ], - "_resolved": "https://registry.npmjs.org/lucky-canvas/-/lucky-canvas-1.7.19.tgz", - "_shasum": "8983bd1739bb9b228768470508ab4e5c84b8df33", - "_spec": "lucky-canvas@~1.7.19", - "_where": "/Users/ldq/Desktop/temp/test/node_modules/@lucky-canvas/uni", - "author": { - "name": "ldq", - "email": "ldq404@qq.com" - }, - "bugs": { - "url": "https://github.com/LuckDraw/lucky-canvas/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "一个基于原生 js 的(大转盘 / 九宫格 / 老虎机)抽奖插件", - "devDependencies": { - "@babel/core": "^7.12.3", - "@babel/plugin-transform-runtime": "^7.16.4", - "@babel/preset-env": "^7.12.1", - "@babel/runtime": "^7.16.3", - "@rollup/plugin-commonjs": "^16.0.0", - "@rollup/plugin-eslint": "^8.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^10.0.0", - "@rollup/plugin-typescript": "^6.1.0", - "@typescript-eslint/parser": "^4.14.0", - "babel-plugin-external-helpers": "^6.22.0", - "babel-preset-latest": "^6.24.1", - "core-js": "^3.19.2", - "eslint": "^7.18.0", - "eslint-plugin-prettier": "^3.3.1", - "prettier": "^2.2.1", - "rollup": "^2.33.1", - "rollup-plugin-babel": "^4.4.0", - "rollup-plugin-delete": "^2.0.0", - "rollup-plugin-dts": "^3.0.2", - "rollup-plugin-livereload": "^2.0.0", - "rollup-plugin-serve": "^1.1.0", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.30.0", - "tslib": "^2.3.1", - "typescript": "^4.0.5" - }, - "files": [ - "dist", - "types", - "index.js" - ], - "homepage": "https://100px.net", - "jsdelivr": "dist/index.umd.js", - "keywords": [ - "大转盘抽奖", - "九宫格抽奖", - "老虎机抽奖", - "抽奖插件", - "js抽奖", - "移动端抽奖", - "canvas抽奖" - ], - "license": "Apache-2.0", - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "name": "lucky-canvas", - "repository": { - "type": "git", - "url": "git+https://github.com/LuckDraw/lucky-canvas.git", - "directory": "packages/lucky-canvas" - }, - "scripts": { - "build": "rollup --config rollup.config.build.js", - "dev": "rollup --config rollup.config.dev.js -w" - }, - "types": "types/index.d.ts", - "unpkg": "dist/index.umd.js", - "version": "1.7.19" -} diff --git a/v4/components/lucky-canvas/types/index.d.ts b/v4/components/lucky-canvas/types/index.d.ts deleted file mode 100644 index 81cb994..0000000 --- a/v4/components/lucky-canvas/types/index.d.ts +++ /dev/null @@ -1,761 +0,0 @@ -declare type FontItemType = { - text: string; - top?: string | number; - fontColor?: string; - fontSize?: string; - fontStyle?: string; - fontWeight?: string; - lineHeight?: string; -}; -declare type FontExtendType = { - wordWrap?: boolean; - lengthLimit?: string | number; - lineClamp?: number; -}; -declare type ImgType = HTMLImageElement | HTMLCanvasElement; -declare type ImgItemType = { - src: string; - top?: string | number; - width?: string; - height?: string; - formatter?: (img: ImgType) => ImgType; - $resolve?: Function; - $reject?: Function; -}; -declare type BorderRadiusType = string | number; -declare type BackgroundType = string; -declare type ShadowType = string; -declare type ConfigType = { - nodeType?: number; - flag: 'WEB' | 'MP-WX' | 'UNI-H5' | 'UNI-MP' | 'TARO-H5' | 'TARO-MP'; - el?: string; - divElement?: HTMLDivElement; - canvasElement?: HTMLCanvasElement; - ctx: CanvasRenderingContext2D; - dpr: number; - handleCssUnit?: (num: number, unit: string) => number; - rAF?: Function; - setTimeout: Function; - setInterval: Function; - clearTimeout: Function; - clearInterval: Function; - beforeCreate?: Function; - beforeResize?: Function; - afterResize?: Function; - beforeInit?: Function; - afterInit?: Function; - beforeDraw?: Function; - afterDraw?: Function; - afterStart?: Function; -}; -declare type RequireKey = 'width' | 'height'; -declare type UserConfigType = Partial> & Required>; -declare type Tuple = Res['length'] extends Len ? Res : Tuple; - -interface WatchOptType { - handler?: () => Function; - immediate?: boolean; - deep?: boolean; -} - -declare class Lucky { - protected readonly version: string; - protected readonly config: ConfigType; - protected readonly ctx: CanvasRenderingContext2D; - protected htmlFontSize: number; - protected rAF: Function; - protected boxWidth: number; - protected boxHeight: number; - protected data: { - width: string | number; - height: string | number; - }; - /** - * 公共构造器 - * @param config - */ - constructor(config: string | HTMLDivElement | UserConfigType, data: { - width: string | number; - height: string | number; - }); - /** - * 初始化组件大小/单位 - */ - protected resize(): void; - /** - * 初始化方法 - */ - protected initLucky(): void; - /** - * 鼠标点击事件 - * @param e 事件参数 - */ - protected handleClick(e: MouseEvent): void; - /** - * 根标签的字体大小 - */ - protected setHTMLFontSize(): void; - clearCanvas(): void; - /** - * 设备像素比 - * window 环境下自动获取, 其余环境手动传入 - */ - protected setDpr(): void; - /** - * 重置盒子和canvas的宽高 - */ - private resetWidthAndHeight; - /** - * 根据 dpr 缩放 canvas 并处理位移 - */ - protected zoomCanvas(): void; - /** - * 从 window 对象上获取一些方法 - */ - private initWindowFunction; - /** - * 异步加载图片并返回图片的几何信息 - * @param src 图片路径 - * @param info 图片信息 - */ - protected loadImg(src: string, info: ImgItemType, resolveName?: string): Promise; - /** - * 公共绘制图片的方法 - * @param imgObj 图片对象 - * @param rectInfo: [x轴位置, y轴位置, 渲染宽度, 渲染高度] - */ - protected drawImage(ctx: CanvasRenderingContext2D, imgObj: ImgType, ...rectInfo: [...Tuple, ...Partial>]): void; - /** - * 获取长度 - * @param length 将要转换的长度 - * @return 返回长度 - */ - protected getLength(length: string | number | undefined): number; - /** - * 转换单位 - * @param { string } value 将要转换的值 - * @param { number } denominator 分子 - * @return { number } 返回新的字符串 - */ - protected changeUnits(value: string, denominator?: number): number; - /** - * 计算图片的渲染宽高 - * @param imgObj 图片标签元素 - * @param imgInfo 图片信息 - * @param maxWidth 最大宽度 - * @param maxHeight 最大高度 - * @return [渲染宽度, 渲染高度] - */ - protected computedWidthAndHeight(imgObj: ImgType, imgInfo: ImgItemType, maxWidth: number, maxHeight: number): [number, number]; - /** - * 转换并获取宽度 - * @param width 将要转换的宽度 - * @param maxWidth 最大宽度 - * @return 返回相对宽度 - */ - protected getWidth(width: string | number | undefined, maxWidth: number): number; - /** - * 转换并获取高度 - * @param height 将要转换的高度 - * @param maxHeight 最大高度 - * @return 返回相对高度 - */ - protected getHeight(height: string | number | undefined, maxHeight: number): number; - /** - * 获取相对(居中)X坐标 - * @param width - * @param col - */ - protected getOffsetX(width: number, maxWidth?: number): number; - protected getOffscreenCanvas(width: number, height: number): { - _offscreenCanvas: HTMLCanvasElement; - _ctx: CanvasRenderingContext2D; - } | void; - /** - * 添加一个新的响应式数据 (临时) - * @param data 数据 - * @param key 属性 - * @param value 新值 - */ - $set(data: object, key: string | number, value: any): void; - /** - * 添加一个属性计算 (临时) - * @param data 源数据 - * @param key 属性名 - * @param callback 回调函数 - */ - protected $computed(data: object, key: string, callback: Function): void; - /** - * 添加一个观察者 create user watcher - * @param expr 表达式 - * @param handler 回调函数 - * @param watchOpt 配置参数 - * @return 卸载当前观察者的函数 (暂未返回) - */ - protected $watch(expr: string | Function, handler: Function | WatchOptType, watchOpt?: WatchOptType): Function; -} - -declare type PrizeFontType$2 = FontItemType & FontExtendType; -declare type ButtonFontType$1 = FontItemType & {}; -declare type BlockImgType$2 = ImgItemType & { - rotate?: boolean; -}; -declare type PrizeImgType$2 = ImgItemType & {}; -declare type ButtonImgType$1 = ImgItemType & {}; -declare type BlockType$2 = { - padding?: string; - background?: BackgroundType; - imgs?: Array; -}; -declare type PrizeType$2 = { - range?: number; - background?: BackgroundType; - fonts?: Array; - imgs?: Array; -}; -declare type ButtonType$1 = { - radius?: string; - pointer?: boolean; - background?: BackgroundType; - fonts?: Array; - imgs?: Array; -}; -declare type DefaultConfigType$2 = { - gutter?: string | number; - offsetDegree?: number; - speed?: number; - speedFunction?: string; - accelerationTime?: number; - decelerationTime?: number; - stopRange?: number; -}; -declare type DefaultStyleType$2 = { - background?: BackgroundType; - fontColor?: PrizeFontType$2['fontColor']; - fontSize?: PrizeFontType$2['fontSize']; - fontStyle?: PrizeFontType$2['fontStyle']; - fontWeight?: PrizeFontType$2['fontWeight']; - lineHeight?: PrizeFontType$2['lineHeight']; - wordWrap?: PrizeFontType$2['wordWrap']; - lengthLimit?: PrizeFontType$2['lengthLimit']; - lineClamp?: PrizeFontType$2['lineClamp']; -}; -declare type StartCallbackType$1 = (e: MouseEvent) => void; -declare type EndCallbackType$2 = (prize: object) => void; -interface LuckyWheelConfig { - width: string | number; - height: string | number; - blocks?: Array; - prizes?: Array; - buttons?: Array; - defaultConfig?: DefaultConfigType$2; - defaultStyle?: DefaultStyleType$2; - start?: StartCallbackType$1; - end?: EndCallbackType$2; -} - -declare class LuckyWheel extends Lucky { - private blocks; - private prizes; - private buttons; - private defaultConfig; - private defaultStyle; - private _defaultConfig; - private _defaultStyle; - private startCallback?; - private endCallback?; - private Radius; - private prizeRadius; - private prizeDeg; - private prizeRadian; - private rotateDeg; - private maxBtnRadius; - private startTime; - private endTime; - private stopDeg; - private endDeg; - private FPS; - /** - * 游戏当前的阶段 - * step = 0 时, 游戏尚未开始 - * step = 1 时, 此时处于加速阶段 - * step = 2 时, 此时处于匀速阶段 - * step = 3 时, 此时处于减速阶段 - */ - private step; - /** - * 中奖索引 - * prizeFlag = undefined 时, 处于开始抽奖阶段, 正常旋转 - * prizeFlag >= 0 时, 说明stop方法被调用, 并且传入了中奖索引 - * prizeFlag === -1 时, 说明stop方法被调用, 并且传入了负值, 本次抽奖无效 - */ - private prizeFlag; - private ImageCache; - /** - * 大转盘构造器 - * @param config 配置项 - * @param data 抽奖数据 - */ - constructor(config: UserConfigType, data: LuckyWheelConfig); - protected resize(): void; - protected initLucky(): void; - /** - * 初始化数据 - * @param data - */ - private initData; - /** - * 初始化属性计算 - */ - private initComputed; - /** - * 初始化观察者 - */ - private initWatch; - /** - * 初始化 canvas 抽奖 - */ - init(): Promise; - private initImageCache; - /** - * canvas点击事件 - * @param e 事件参数 - */ - protected handleClick(e: MouseEvent): void; - /** - * 根据索引单独加载指定图片并缓存 - * @param cellName 模块名称 - * @param cellIndex 模块索引 - * @param imgName 模块对应的图片缓存 - * @param imgIndex 图片索引 - */ - private loadAndCacheImg; - private drawBlock; - /** - * 开始绘制 - */ - protected draw(): void; - /** - * 刻舟求剑 - */ - private carveOnGunwaleOfAMovingBoat; - /** - * 对外暴露: 开始抽奖方法 - */ - play(): void; - /** - * 对外暴露: 缓慢停止方法 - * @param index 中奖索引 - */ - stop(index?: number): void; - /** - * 实际开始执行方法 - * @param num 记录帧动画执行多少次 - */ - private run; - /** - * 换算渲染坐标 - * @param x - * @param y - */ - protected conversionAxis(x: number, y: number): [number, number]; -} - -declare type PrizeFontType$1 = FontItemType & FontExtendType; -declare type ButtonFontType = FontItemType & FontExtendType; -declare type BlockImgType$1 = ImgItemType & {}; -declare type PrizeImgType$1 = ImgItemType & { - activeSrc?: string; -}; -declare type ButtonImgType = ImgItemType & {}; -declare type BlockType$1 = { - borderRadius?: BorderRadiusType; - background?: BackgroundType; - padding?: string; - paddingTop?: string | number; - paddingRight?: string | number; - paddingBottom?: string | number; - paddingLeft?: string | number; - imgs?: Array; -}; -declare type CellType = { - x: number; - y: number; - col?: number; - row?: number; - borderRadius?: BorderRadiusType; - background?: BackgroundType; - shadow?: ShadowType; - fonts?: Array; - imgs?: Array; -}; -declare type PrizeType$1 = CellType & { - range?: number; - disabled?: boolean; -}; -declare type ButtonType = CellType & { - callback?: Function; -}; -declare type DefaultConfigType$1 = { - gutter?: number; - speed?: number; - accelerationTime?: number; - decelerationTime?: number; -}; -declare type DefaultStyleType$1 = { - borderRadius?: BorderRadiusType; - background?: BackgroundType; - shadow?: ShadowType; - fontColor?: PrizeFontType$1['fontColor']; - fontSize?: PrizeFontType$1['fontSize']; - fontStyle?: PrizeFontType$1['fontStyle']; - fontWeight?: PrizeFontType$1['fontWeight']; - lineHeight?: PrizeFontType$1['lineHeight']; - wordWrap?: PrizeFontType$1['wordWrap']; - lengthLimit?: PrizeFontType$1['lengthLimit']; - lineClamp?: PrizeFontType$1['lineClamp']; -}; -declare type ActiveStyleType = { - background?: BackgroundType; - shadow?: ShadowType; - fontColor?: PrizeFontType$1['fontColor']; - fontSize?: PrizeFontType$1['fontSize']; - fontStyle?: PrizeFontType$1['fontStyle']; - fontWeight?: PrizeFontType$1['fontWeight']; - lineHeight?: PrizeFontType$1['lineHeight']; -}; -declare type RowsType = number; -declare type ColsType = number; -declare type StartCallbackType = (e: MouseEvent, button?: ButtonType) => void; -declare type EndCallbackType$1 = (prize: object) => void; -interface LuckyGridConfig { - width: string | number; - height: string | number; - rows?: RowsType; - cols?: ColsType; - blocks?: Array; - prizes?: Array; - buttons?: Array; - button?: ButtonType; - defaultConfig?: DefaultConfigType$1; - defaultStyle?: DefaultStyleType$1; - activeStyle?: ActiveStyleType; - start?: StartCallbackType; - end?: EndCallbackType$1; -} - -declare class LuckyGrid extends Lucky { - private rows; - private cols; - private blocks; - private prizes; - private buttons; - private button?; - private defaultConfig; - private defaultStyle; - private activeStyle; - private _defaultConfig; - private _defaultStyle; - private _activeStyle; - private startCallback?; - private endCallback?; - private cellWidth; - private cellHeight; - private startTime; - private endTime; - private currIndex; - private stopIndex; - private endIndex; - private demo; - private timer; - private FPS; - /** - * 游戏当前的阶段 - * step = 0 时, 游戏尚未开始 - * step = 1 时, 此时处于加速阶段 - * step = 2 时, 此时处于匀速阶段 - * step = 3 时, 此时处于减速阶段 - */ - private step; - /** - * 中奖索引 - * prizeFlag = undefined 时, 处于开始抽奖阶段, 正常旋转 - * prizeFlag >= 0 时, 说明stop方法被调用, 并且传入了中奖索引 - * prizeFlag === -1 时, 说明stop方法被调用, 并且传入了负值, 本次抽奖无效 - */ - private prizeFlag; - private cells; - private prizeArea; - private ImageCache; - /** - * 九宫格构造器 - * @param config 配置项 - * @param data 抽奖数据 - */ - constructor(config: UserConfigType, data: LuckyGridConfig); - protected resize(): void; - protected initLucky(): void; - /** - * 初始化数据 - * @param data - */ - private initData; - /** - * 初始化属性计算 - */ - private initComputed; - /** - * 初始化观察者 - */ - private initWatch; - /** - * 初始化 canvas 抽奖 - */ - init(): Promise; - private initImageCache; - /** - * canvas点击事件 - * @param e 事件参数 - */ - protected handleClick(e: MouseEvent): void; - /** - * 根据索引单独加载指定图片并缓存 - * @param cellName 模块名称 - * @param cellIndex 模块索引 - * @param imgName 模块对应的图片缓存 - * @param imgIndex 图片索引 - */ - private loadAndCacheImg; - /** - * 绘制九宫格抽奖 - */ - protected draw(): void; - /** - * 处理背景色 - * @param x - * @param y - * @param width - * @param height - * @param background - * @param isActive - */ - private handleBackground; - /** - * 刻舟求剑 - */ - private carveOnGunwaleOfAMovingBoat; - /** - * 对外暴露: 开始抽奖方法 - */ - play(): void; - /** - * 对外暴露: 缓慢停止方法 - * @param index 中奖索引 - */ - stop(index?: number): void; - /** - * 实际开始执行方法 - * @param num 记录帧动画执行多少次 - */ - private run; - /** - * 计算奖品格子的几何属性 - * @param { array } [...矩阵坐标, col, row] - * @return { array } [...真实坐标, width, height] - */ - private getGeometricProperty; - /** - * 换算渲染坐标 - * @param x - * @param y - */ - protected conversionAxis(x: number, y: number): [number, number]; -} - -declare type PrizeFontType = FontItemType & FontExtendType; -declare type BlockImgType = ImgItemType & {}; -declare type PrizeImgType = ImgItemType; -declare type BlockType = { - borderRadius?: BorderRadiusType; - background?: BackgroundType; - padding?: string; - paddingTop?: string | number; - paddingRight?: string | number; - paddingBottom?: string | number; - paddingLeft?: string | number; - imgs?: Array; -}; -declare type PrizeType = { - borderRadius?: BorderRadiusType; - background?: BackgroundType; - fonts?: Array; - imgs?: Array; -}; -declare type SlotType = { - order?: number[]; - speed?: number; - direction?: 1 | -1; -}; -declare type DefaultConfigType = { - /** - * vertical 为纵向旋转 - * horizontal 为横向旋转 - */ - mode?: 'vertical' | 'horizontal'; - /** - * 当排列方向 = `vertical`时 - * 1 bottom to top - * -1 top to bottom - * 当排列方向 = `horizontal`时 - * 1 right to left - * -1 left to right - */ - direction?: 1 | -1; - rowSpacing?: number; - colSpacing?: number; - speed?: number; - accelerationTime?: number; - decelerationTime?: number; -}; -declare type DefaultStyleType = { - borderRadius?: BorderRadiusType; - background?: BackgroundType; - fontColor?: PrizeFontType['fontColor']; - fontSize?: PrizeFontType['fontSize']; - fontStyle?: PrizeFontType['fontStyle']; - fontWeight?: PrizeFontType['fontWeight']; - lineHeight?: PrizeFontType['lineHeight']; - wordWrap?: PrizeFontType['wordWrap']; - lengthLimit?: PrizeFontType['lengthLimit']; - lineClamp?: PrizeFontType['lineClamp']; -}; -declare type EndCallbackType = (prize: PrizeType | undefined) => void; -interface SlotMachineConfig { - width: string | number; - height: string | number; - blocks?: Array; - prizes?: Array; - slots?: Array; - defaultConfig?: DefaultConfigType; - defaultStyle?: DefaultStyleType; - end?: EndCallbackType; -} - -declare class SlotMachine extends Lucky { - private blocks; - private prizes; - private slots; - private defaultConfig; - private _defaultConfig; - private defaultStyle; - private _defaultStyle; - private endCallback; - private _offscreenCanvas?; - private cellWidth; - private cellHeight; - private cellAndSpacing; - private widthAndSpacing; - private heightAndSpacing; - private FPS; - private scroll; - private stopScroll; - private endScroll; - private startTime; - private endTime; - /** - * 游戏当前的阶段 - * step = 0 时, 游戏尚未开始 - * step = 1 时, 此时处于加速阶段 - * step = 2 时, 此时处于匀速阶段 - * step = 3 时, 此时处于减速阶段 - */ - private step; - /** - * 中奖索引 - * prizeFlag = undefined 时, 处于开始抽奖阶段, 正常旋转 - * prizeFlag >= 0 时, 说明stop方法被调用, 并且传入了中奖索引 - * prizeFlag === -1 时, 说明stop方法被调用, 并且传入了负值, 本次抽奖无效 - */ - private prizeFlag; - private prizeArea?; - private ImageCache; - /** - * 老虎机构造器 - * @param config 配置项 - * @param data 抽奖数据 - */ - constructor(config: UserConfigType, data: SlotMachineConfig); - protected resize(): void; - protected initLucky(): void; - /** - * 初始化数据 - * @param data - */ - private initData; - /** - * 初始化属性计算 - */ - private initComputed; - /** - * 初始化观察者 - */ - private initWatch; - /** - * 初始化 canvas 抽奖 - */ - init(): Promise; - private initImageCache; - /** - * 根据索引单独加载指定图片并缓存 - * @param cellName 模块名称 - * @param cellIndex 模块索引 - * @param imgName 模块对应的图片缓存 - * @param imgIndex 图片索引 - */ - private loadAndCacheImg; - /** - * 绘制离屏canvas - */ - protected drawOffscreenCanvas(): void; - /** - * 绘制背景区域 - */ - protected drawBlocks(): SlotMachine['prizeArea']; - /** - * 绘制老虎机抽奖 - */ - protected draw(): void; - /** - * 刻舟求剑 - */ - private carveOnGunwaleOfAMovingBoat; - /** - * 对外暴露: 开始抽奖方法 - */ - play(): void; - stop(index: number | number[]): void; - /** - * 让游戏动起来 - * @param num 记录帧动画执行多少次 - */ - private run; - private displacement; - private displacementWidthOrHeight; -} - -/** - * 切割圆角 - * @param img 将要裁剪的图片对象 - * @param radius 裁剪的圆角半径 - * @returns 返回一个离屏 canvas 用于渲染 - */ -declare const cutRound: (img: ImgType, radius: number) => ImgType; -/** - * 透明度 - * @param img 将要处理的图片对象 - * @param opacity 透明度 - * @returns 返回一个离屏 canvas 用于渲染 - */ -declare const opacity: (img: ImgType, opacity: number) => ImgType; - -export { LuckyGrid, LuckyWheel, SlotMachine, cutRound, opacity }; diff --git a/v4/views/luck/logs.vue b/v4/views/luck/logs.vue deleted file mode 100644 index 320a9aa..0000000 --- a/v4/views/luck/logs.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - diff --git a/v4/views/luck/luck.vue b/v4/views/luck/luck.vue deleted file mode 100644 index ed0212e..0000000 --- a/v4/views/luck/luck.vue +++ /dev/null @@ -1,382 +0,0 @@ - - - - - diff --git a/v4/views/luck/receive.vue b/v4/views/luck/receive.vue deleted file mode 100644 index ae32b3f..0000000 --- a/v4/views/luck/receive.vue +++ /dev/null @@ -1,159 +0,0 @@ - - - - - diff --git a/wenwan/views/store.vue b/wenwan/views/store.vue index 2286135..f17e651 100644 --- a/wenwan/views/store.vue +++ b/wenwan/views/store.vue @@ -149,9 +149,6 @@ - - -