Browse Source

合并提交

master
j1ack 3 years ago
parent
commit
89681b0f03
  1. 19
      manifest.json
  2. 280
      pages/home/index.vue
  3. 1
      pages/withdrawal/withdrawal.vue

19
manifest.json

@ -1,6 +1,6 @@
{ {
"name" : "samehome", "name" : "samehome",
"appid" : "__UNI__0CF38A0", "appid" : "__UNI__C4028F6",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "101", "versionCode" : "101",
@ -48,7 +48,22 @@
/* SDK */ /* SDK */
"sdkConfigs" : {} "sdkConfigs" : {}
}, },
"nativePlugins" : {} "nativePlugins" : {
"HF-Step" : {
"__plugin_info__" : {
"name" : "原生计步器(Android和IOS)",
"description" : "计步器,原生计步器插件,安卓,IOS",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=6632",
"android_package_name" : "com.samehome",
"ios_bundle_id" : "com.samehome",
"isCloud" : true,
"bought" : 1,
"pid" : "6632",
"parameters" : {}
}
}
}
}, },
"h5" : { "h5" : {
"publicPath" : "/", "publicPath" : "/",

280
pages/home/index.vue

@ -19,8 +19,6 @@
</u-overlay> </u-overlay>
</view> </view>
<!-- 轮播图 --> <!-- 轮播图 -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" nextMargin="80rpx" circular <u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" nextMargin="80rpx" circular
:autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx"> :autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx">
@ -60,9 +58,14 @@
<view class="steps"> <view class="steps">
<view class="content"> <view class="content">
<view class="title">{{ i18n.TodaySteps }}</view> <view class="title">{{ i18n.TodaySteps }}</view>
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" :change:stepTarget="echarts.receive"
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" :change:stepTarget="echarts.stepTargetReceive"
:change:stepsNum="echarts.receive" style="width: 280rpx;height:280rpx; font-size: 40rpx;"> :change:stepsNum="echarts.receive" style="width: 280rpx;height:280rpx; font-size: 40rpx;">
</view> </view>
<!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> --> <!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> -->
<u-button class="button" color="#00E8A2" @click="closeModalShow=true">{{ i18n.ReceiveEarnings }} <u-button class="button" color="#00E8A2" @click="closeModalShow=true">{{ i18n.ReceiveEarnings }}
</u-button> </u-button>
@ -88,20 +91,23 @@
<video class="video" v-show="videoShow" id="video" :enable-progress-gesture="false" autoplay="true" <video class="video" v-show="videoShow" id="video" :enable-progress-gesture="false" autoplay="true"
:src="videoUrl" controls x5-video-player-type="h5-page" @fullscreenchange="ifStopVideo"></video> :src="videoUrl" controls x5-video-player-type="h5-page" @fullscreenchange="ifStopVideo"></video>
<!-- 通知弹出层 --> <!-- 通知弹出层 -->
<u-popup class="popup" v-if="popupShow" round="32rpx" mode="center" @close="popupShow = false" <view class="">
@open="popupShow = true" bgColor="#211F32" :customStyle="{ <u-popup class="popup" :show="popupShow" round="32rpx" mode="center" @close="popupShow = false"
margin: 'auto 102rpx auto 118rpx', @open="popupShow = true" bgColor="#211F32" :customStyle="{
}"> margin: 'auto 102rpx auto 118rpx',
<view class="content"> }">
<scroll-view scroll-y="true" style="max-height: 288rpx;" scroll-with-animation="true" <view class="content">
@touchmove.stop.prevent=""> <scroll-view scroll-y="true" style="max-height: 288rpx;" scroll-with-animation="true"
<view class="" v-html="contentFirst"></view> @touchmove.stop.prevent="">
</scroll-view> <view class="" v-html="contentFirst"></view>
<u-button class="button" color="#00E8A2" @click="toRead" :throttleTime="500">OK</u-button> </scroll-view>
</view> <u-button class="button" color="#00E8A2" @click="toRead" :throttleTime="500">OK</u-button>
</u-popup> </view>
</u-popup>
</view>
<!-- <view class="" @click="startStep"> <!-- <view class="" @click="startStep">
开始记步 开始记步
</view> </view>
<view class="" @click="startStep"> <view class="" @click="startStep">
@ -122,7 +128,7 @@
// let videoPlayerObj = {}; // let videoPlayerObj = {};
let videoPlayer; let videoPlayer;
let myChart; let myChart;
// let StepCounter = uni.requireNativePlugin('HF-Step-module'); let StepCounter = uni.requireNativePlugin('HF-Step-module');
export default { export default {
name: 'home', name: 'home',
components: { components: {
@ -145,7 +151,7 @@
languageShow: false, languageShow: false,
langTrue: languageData[0].title || 'English', langTrue: languageData[0].title || 'English',
languageData, languageData,
popupShow: true, popupShow: false,
messageList: [], messageList: [],
swiperList: [ swiperList: [
@ -156,22 +162,18 @@
videoList: [], videoList: [],
option: null, option: null,
stepsNum: 0, // stepsNum: 0, //
stepsNumString:'', // stepTarget: 5000, //
stepTarget: 10000, //
myChart: null, myChart: null,
} }
}, },
onLoad() { onLoad() {
this.stepsNum=uni.getStorageSync('coinTypeInfo').system_total_steps
this.stepsNum=parseInt(this.stepsNum)
this.stepsNumString=uni.getStorageSync('coinTypeInfo').system_total_steps
this.baseURL = constant.BASE_URL this.baseURL = constant.BASE_URL
this.getbanner(); this.getbanner();
this.noticeList(); this.noticeList();
this.getUserInfoBalance(); this.getUserInfoBalance();
}, },
onShow() { onShow() {
// this.getSept()
// //
// this.videoList.forEach((item, index) => { // this.videoList.forEach((item, index) => {
// const VideoPlayer = uni.createVideoContext(`video-${index}`, this) // const VideoPlayer = uni.createVideoContext(`video-${index}`, this)
@ -185,9 +187,17 @@
if (uni.getStorageSync('langTrue')) { if (uni.getStorageSync('langTrue')) {
this.langTrue = uni.getStorageSync('langTrue') this.langTrue = uni.getStorageSync('langTrue')
} }
// #ifdef APP-PLUS
this.getSept()
// this.startStep()
// this.resStartStep()
this.updateSteps();
// #endif
// #ifdef H5
this.stepsNum=0;
// #endif
}, },
onHide() { onHide() {
this.stopAllVideoPlay() this.stopAllVideoPlay()
}, },
@ -197,6 +207,48 @@
} }
}, },
methods: { methods: {
//
updateSteps(){
var today=this.$index.formatyymmdd(new Date().getTime());
var stepsNum_date= uni.getStorageSync("stepsNum_date");
var isUpdate=false;
console.log(today)
console.log(uni.getStorageSync("stepsNum_date"))
console.log(stepsNum_date)
if(stepsNum_date){
if(today!=stepsNum_date.date){
uni.setStorageSync("stepsNum_date",null);
}else{
if(this.stepsNum==0){
this.stepsNum=stepsNum_date.stepsNum;
}
if(parseInt(this.stepsNum)>parseInt(stepsNum_date.stepsNum)){
isUpdate=true;
}
}
}else{
isUpdate=true;
}
if(isUpdate){
this.$api.updateSteps({
steps: this.stepsNum
}).then(res => {
console.log(res,'res更新')
uni.setStorageSync("stepsNum_date",{
stepsNum:this.stepsNum,
date:today
});
})
}
console.log(this.stepsNum)
},
bannerClick(i){ bannerClick(i){
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.runtime.openUrl(this.bannerList[i].adUrl) plus.runtime.openUrl(this.bannerList[i].adUrl)
@ -215,42 +267,45 @@
}, },
// //
closeConfirm() { closeConfirm() {
this.$api.updateSteps({ this.$api.receivStepsAward().then(res => {
steps: this.stepsNumString uni.$u.toast(this.$t("markets").Succeeded)
}).then(res => { this.closeModalShow=false
this.$api.receivStepsAward().then(res => {
uni.$u.toast(this.$t("markets").Succeeded)
this.closeModalShow=false
})
}) })
}, },
// //
getSept() { getSept() {
// try{
StepCounter.startStep((res) => { //
console.log(res, '步数res'); StepCounter.startStep((res) => {
this.stepCount = res.stepCount console.log(res, '步数res');
//res.stepCount this.stepCount = res.stepCount
}, (res) => { this.stepsNum=res.stepCount;
console.log(res) this.updateSteps();
let callback = res.callback //res.stepCount
if (callback == "stepStatus") { }, (res) => {
let status = res.status; console.log(res)
if (1 == status) { let callback = res.callback
//gps if (callback == "stepStatus") {
console.log('安卓gps定位服务未开') let status = res.status;
} else if (2 == status || 5 == status) { if (1 == status) {
// //gps
//this.gotoSettings() console.log('安卓gps定位服务未开')
console.log('权限被禁止') } else if (2 == status || 5 == status) {
} else if (3 == status) { //
// //this.gotoSettings()
//this.startStep() console.log('权限被禁止')
console.log('允许运动权限(处理安卓权限问题)') } else if (3 == status) {
//
//this.startStep()
console.log('允许运动权限(处理安卓权限问题)')
}
} }
}
}); });
}catch(e){
console.error("获取步数出错",e)
}
}, },
startStep() { startStep() {
// //
@ -258,9 +313,7 @@
//res.result == true //res.result == true
//res.stepCount //res.stepCount
console.log(res.result) console.log(res.result)
this.stepResult = res.result
console.log(res.stepCount) console.log(res.stepCount)
this.stepResult = res.stepCount
}); });
}, },
resStartStep() { resStartStep() {
@ -294,17 +347,15 @@
if (this.notice[i].isRead == 'no') { if (this.notice[i].isRead == 'no') {
this.contentFirst = this.notice[i].content this.contentFirst = this.notice[i].content
this.noticeId = this.notice[i].id this.noticeId = this.notice[i].id
this.popupShow = true
} }
} }
//
if (!this.noticeId) { if (!this.noticeId) {
this.popupShow = false this.popupShow = false
} }
},
go(url) {
uni.navigateTo({
url: url
})
}, },
//
toRead() { toRead() {
api.noticeRead({ api.noticeRead({
noticeId: this.noticeId noticeId: this.noticeId
@ -315,10 +366,15 @@
console.log(res, '已经读了吗') console.log(res, '已经读了吗')
}) })
}, },
go(url) {
uni.navigateTo({
url: url
})
},
// //
noticeList() { noticeList() {
api.noticeList({}).then(res => { api.noticeList({}).then(res => {
this.notice = res; this.notice = res;
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
@ -421,81 +477,7 @@
}, },
initChart() {
// let myChart = echarts.init(this.$refs.chart);
// console.log(document);
// console.log(this.$refs.chart);
// this.myChart = echarts.init(document.getElementById('chart'));
// this.myChart = echarts.init(this.$refs.chart);
// myChart = echarts.init(document.getElementById('chart'))
this.option = {
title: {
text: this.stepsNum,
//
subtext: "",
//
itemGap: 0,
left: 'center',
top: 'center',
//
textStyle: {
fontSize: '20',
color: '#fff'
},
},
series: [{
name: '环形饼图',
type: 'pie',
radius: ['48%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
itemStyle: {
//
shadowBlur: 30,
shadowColor: '#15141F',
shadowOffsetX: 'center',
shadowOffsetY: 'center'
},
data: [{
value: +this.stepsNum / this.stepTarget,
name: '步数',
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: .2,
color: '#47BDFF'
}, {
offset: .5,
color: '#34AEFF'
}, {
offset: 1,
color: '#0589FF'
}]),
borderRadius: 800,
}
},
{
value: (this.stepTarget - this.stepsNum) / this.stepTarget,
name: '剩余步数',
itemStyle: {
color: '#15141F',
}
}
]
}]
}
// myChart.setOption(this.option, true);
// window.addEventListener('resize', () => {
// myChart.resize();
// });
}
} }
} }
</script> </script>
@ -521,18 +503,24 @@
methods: { methods: {
receive(newValue, oldValue, ownerVm, vm) { receive(newValue, oldValue, ownerVm, vm) {
console.log('newValue', newValue) console.log(newValue,'变化')
this.initEcharts()
// if(!this.myChart){
// this.initEcharts()
// }else{
// this.myChart.setOption(this.option)
// }
},
stepTargetReceive(newValue, oldValue, ownerVm, vm){
}, },
initEcharts() { initEcharts() {
this.initChart() this.initChart()
myChart = echarts.init(document.getElementById('chart')) this.myChart = echarts.init(document.getElementById('chart'))
// view 访 // view 访
myChart.setOption(this.option) this.myChart.setOption(this.option)
}, // console.log('initEcharts')
updateEcharts(newValue, oldValue, ownerInstance, instance) {
// service
myChart.setOption(newValue)
}, },
onClick(event, ownerInstance) { onClick(event, ownerInstance) {
// service // service

1
pages/withdrawal/withdrawal.vue

@ -306,6 +306,7 @@
this.selectCoinInfo = e this.selectCoinInfo = e
this.coinInfo.coinCode = e.enname this.coinInfo.coinCode = e.enname
this.coinInfo.coinCode2 = e.code this.coinInfo.coinCode2 = e.code
this.coinAddress='';
}, },
// //
getWithConfig() { getWithConfig() {

Loading…
Cancel
Save