['同步线上数据']

This commit is contained in:
2021-11-22 15:35:50 +08:00
12 changed files with 598 additions and 51486 deletions

23
App.vue
View File

@@ -36,12 +36,29 @@
success: modalRes => { success: modalRes => {
if (modalRes.confirm) { if (modalRes.confirm) {
if (plus.os.name == "Android") { if (plus.os.name == "Android") {
plus.runtime.openURL(res.info.download, err => {
uni.showToast({ uni.showToast({
title: err, title: '新版本下载中,将在下载完成后自动为您安装更新包',
icon : 'none' icon : 'none'
}) })
}); uni.downloadFile({
url : res.info.download,
success : apkPick=> {
plus.runtime.install(apkPick.tempFilePath, '', installRES => {
// 安装完成用于提示新版本引导,暂时无用
}, installERR => {
// 安装失败
})
},
fail(err){
uni.showToast({
title: '安装包下载失败,请检查您的网络或稍后重试',
icon : 'none'
})
}
})
// plus.runtime.openURL(res.info.download, err => {
// console.log(err)
// }, 'com.android.browser');
} else{ } else{
uni.showToast({ uni.showToast({
title: 'IOS应用暂未上架请打开测试(TestFlight)工具点击更新', title: 'IOS应用暂未上架请打开测试(TestFlight)工具点击更新',

View File

@@ -28,11 +28,29 @@ const thawlog = (data) => {
url: 'user/account/thawlog', url: 'user/account/thawlog',
method: 'POST', method: 'POST',
data data
}, true)
}
// 获取新的一批水晶
const crystalsBefore = (data) => {
return request({
url: 'user/account/crystals/before',
})
}
// 批量领取水晶
const allThawall = (data) => {
return request({
url: 'user/account/thawall',
method: 'POST',
data
}) })
} }
export { export {
chain, chain,
crystals, crystals,
thawlog thawlog,
crystalsBefore,
allThawall
} }

View File

@@ -2,8 +2,8 @@
"name" : "链商星球", "name" : "链商星球",
"appid" : "__UNI__1F65101", "appid" : "__UNI__1F65101",
"description" : "安徽星煌,链商星球商家工具", "description" : "安徽星煌,链商星球商家工具",
"versionName" : "1.1.9", "versionName" : "1.2.0",
"versionCode" : 119, "versionCode" : 120,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

137
package-lock.json generated
View File

@@ -4,6 +4,138 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"requires": {
"color-convert": "^2.0.1"
}
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"requires": {
"fill-range": "^7.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"enhanced-resolve": {
"version": "5.8.3",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz",
"integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==",
"requires": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"requires": {
"to-regex-range": "^5.0.1"
}
},
"graceful-fs": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"micromatch": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
"integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
"requires": {
"braces": "^3.0.1",
"picomatch": "^2.2.3"
}
},
"picomatch": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw=="
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"requires": {
"lru-cache": "^6.0.0"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"requires": {
"has-flag": "^4.0.0"
}
},
"tapable": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"requires": {
"is-number": "^7.0.0"
}
},
"ts-loader": {
"version": "9.2.6",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.6.tgz",
"integrity": "sha512-QMTC4UFzHmu9wU2VHZEmWWE9cUajjfcdcws+Gh7FhiO+Dy0RnR1bNz0YCHqhI0yRowCE9arVnNxYHqELOy9Hjw==",
"requires": {
"chalk": "^4.1.0",
"enhanced-resolve": "^5.0.0",
"micromatch": "^4.0.0",
"semver": "^7.3.4"
}
},
"uni-read-pages": { "uni-read-pages": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz", "resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
@@ -23,6 +155,11 @@
"version": "3.6.2", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==" "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
} }
} }
} }

View File

@@ -13,6 +13,7 @@
"author": "web唐明明", "author": "web唐明明",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ts-loader": "^9.2.6",
"uni-read-pages": "^1.0.5", "uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.7", "uni-simple-router": "^2.0.7",
"uview-ui": "^1.8.4", "uview-ui": "^1.8.4",

View File

@@ -804,6 +804,13 @@
"navigationBarTitleText": "订单审核", "navigationBarTitleText": "订单审核",
"navigationBarBackgroundColor": "#FFFFFF" "navigationBarBackgroundColor": "#FFFFFF"
} }
}, {
"path": "pages/queue/queue",
"style": {
"navigationBarTitleText": "队列",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -21,8 +21,7 @@
</view> </view>
<block v-if="isAuth"> <block v-if="isAuth">
<view class="ore-lists"> <view class="ore-lists">
<view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" <view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" :style="{left: item.left + '%', top: item.top + '%'}" @click="ledCrystal(index)">
:style="{left: item.left + '%', top: item.top + '%'}" @click="ledCrystal(index)">
<block v-if="item.amount !== null"> <block v-if="item.amount !== null">
<view class="oct-icon"> <view class="oct-icon">
<image src="@/static/icons/crystal-icon.png" mode="widthFix" class="icon" /> <image src="@/static/icons/crystal-icon.png" mode="widthFix" class="icon" />
@@ -37,6 +36,13 @@
<view class="text">发权证<uni-icons type="arrowright" color="#FFFFFF" size="12"></uni-icons> <view class="text">发权证<uni-icons type="arrowright" color="#FFFFFF" size="12"></uni-icons>
</view> </view>
</view> </view>
<view class="oct-float ore-item-key" @click="getAllThawall" v-if="crystalArr.length > 1">
<view class="oct-icon">
<image src="@/static/icons/crystals-icon.png" mode="widthFix" class="icon" />
</view>
<view class="text">一键领取<uni-icons type="arrowright" color="#FFFFFF" size="12"></uni-icons>
</view>
</view>
</view> </view>
</block> </block>
<block v-else> <block v-else>
@@ -121,17 +127,13 @@
</template> </template>
<script> <script>
import { import { chain, crystals, thawlog, crystalsBefore, allThawall } from '@/apis/interfaces/chain'
chain,
crystals,
thawlog
} from '@/apis/interfaces/chain'
import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js' import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'
import lF2 from '@/uni_modules/lime-f2/components/lime-f2/' import lF2 from '@/uni_modules/lime-f2/components/lime-f2/'
import Queue from '@/public/queue'
let queue = new Queue()
export default { export default {
components: { components: { lF2 },
lF2
},
data() { data() {
return { return {
isAuth: false, isAuth: false,
@@ -148,14 +150,15 @@
crystal : 0 crystal : 0
}, },
crystalArr : [], // 待领取 crystalArr : [], // 待领取
allIds: [], // 可领取ids
categoryArr : [], // 推荐列表 categoryArr : [], // 推荐列表
help : {}, // 帮助信息 help : {}, // 帮助信息
userAuth : { // 用户认证状态 userAuth : { // 用户认证状态
certification: false, certification: false,
company : false, company : false,
vip : false vip : false
} },
// 领取贡献值队列
queueState : false
}; };
}, },
onShow() { onShow() {
@@ -229,35 +232,98 @@
}, },
// 领取贡献值 // 领取贡献值
ledCrystal(index) { ledCrystal(index) {
// 播放音频 this.playAudio()
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true; // 领取提示信息
innerAudioContext.src = require('@/static/mp3/crystal.mp3');
// 请求接口
thawlog({
thaw_id: this.crystalArr[index].log_id,
all_ids: this.allIds
}).then(res => {
uni.showToast({ uni.showToast({
image: require('@/static/icons/crystal-icon.png'), image: require('@/static/icons/crystal-icon.png'),
title: '+' + this.crystalArr[index].amount, title: '+' + this.crystalArr[index].amount,
duration: 2000 duration: 2000
}) })
this.$set(this.account, 'crystal', res.crystal)
this.ids = res.all_ids // 处理领取队列
if (JSON.stringify(res.last) === '[]') { queue.enqueue(this.crystalArr[index].log_id)
this.$set(this.crystalArr, index, { if(!this.queueState){
amount: null let queueTime
}) this.queueState = true
this.startQueue(queueTime)
}
// 移出贡献值数据
this.crystalArr.splice(index, 1)
},
// 领取贡献值队列
startQueue(outTime){
outTime = setInterval(() => {
if(queue.isNull()){
clearInterval(outTime)
this.queueState = false
this.getCrystalsBefore()
return return
} }
this.$set(this.crystalArr, index, res.last) queue.front().then(val => {
thawlog({
thaw_id: val,
}).then(res => {
this.$set(this.account, 'crystal', res.crystal)
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: err title: err.message
}) })
}) })
})
queue.dequeue()
}, 500)
},
// 批量领取贡献值
getAllThawall(){
let ids = []
let amounts = 0
ids = this.crystalArr.map(val => {
amounts += Number(val.amount)
return val.log_id
})
allThawall({
all_ids: ids
}).then(res => {
this.playAudio()
// 领取提示信息
uni.showToast({
image: require('@/static/icons/crystals-icon.png'),
title: '+' + amounts.toFixed(2),
duration: 2000
})
this.crystalArr = []
this.$set(this.account, 'crystal', res.crystal)
this.getCrystalsBefore()
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
},
// 刷新贡献值
getCrystalsBefore(){
if(this.crystalArr.length <= 0){
crystalsBefore().then(res => {
this.crystalArr = res.crystal_array
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
},
// 播放领取提示信息
playAudio(){
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = require('@/static/mp3/crystal.mp3');
}, },
// occ信息 // occ信息
getIndex() { getIndex() {
@@ -632,6 +698,12 @@
top: 12%; top: 12%;
} }
.ore-item-key{
@extend .oct-float-item;
left: $margin;
top: 20%;
}
.ore-item { .ore-item {
@extend .oct-float-item; @extend .oct-float-item;
} }

64
pages/queue/queue.vue Normal file
View File

@@ -0,0 +1,64 @@
<template>
<view>
<view class="item" v-for="(item, index) in items" :key="index" @click="onEnqueue(item)">{{item}}入列</view>
</view>
</template>
<script>
import Queue from '@/public/queue'
let queue = new Queue()
export default {
data() {
return {
items: [0,1,2,3,4,5,6,7,8,9],
start: false
};
},
created() {
},
methods:{
onEnqueue(e){
let startTime
queue.enqueue(e)
if(!this.start){
this.start = true
this.startQueue(queue, startTime)
}
},
startQueue(outTime){
outTime = setInterval(() => {
if(queue.isNull()){
clearInterval(outTime)
this.start = false
return
}
queue.front().then(val => {
console.log(val)
// 此处处理对接接口请求
})
queue.dequeue()
}, 1000)
}
}
}
</script>
<style lang="scss">
.item{
margin: $margin;
background: white;
text-align: center;
color: $mian-color;
line-height: 90rpx;
font-weight: bold;
}
.button{
background: white;
margin: $margin;
height: 90rpx;
line-height: 90rpx;
text-align: center;
}
</style>

27
public/queue.ts Normal file
View File

@@ -0,0 +1,27 @@
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
* moduleName: 处理队列
*/
export default class Queue {
constructor(arg: Array) {
this.arrData = arg || []
}
enqueue(el) {
this.arrData.push(el)
}
dequeue(el) {
return this.arrData.shift()
}
front() {
return new Promise((resolve, reject) => {
resolve(this.arrData[0])
})
}
isNull() {
return this.arrData.length === 0
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

0
tsconfig.json Normal file
View File

File diff suppressed because one or more lines are too long