作者 xuqiang

提交

... ... @@ -77,37 +77,7 @@
{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom",
"app-plus": {
"subNVues": [
{
"id": "landAlert", // 唯一标识
"path": "pages/index/subnvue/landAlert", // 页面路径
"type": "popup", //这里不需要
"style": {
"zindex":1,
"background": "transparent",
"margin": "auto",
"width": "588rpx",
"height": "836rpx",
"border-radius": "30rpx"
}
},
{
"id": "updateVersion", // 唯一标识
"path": "pages/index/subnvue/updateVersion", // 页面路径
"type": "popup", //这里不需要
"style": {
"zindex":2,
"background": "transparent",
"margin": "auto",
"width": "622rpx",
"height": "699rpx",
"border-radius": "30rpx"
}
}
]
}
"navigationStyle": "custom"
}
},
{
... ...
... ... @@ -240,21 +240,49 @@
</scroll-view>
</view>
<!-- 成为地主弹框区域 -->
<view class="becomeLandWrap">
<view class="closeBtn">
<image style="width: 44rpx;height: 44rpx;" src="../../../static/image/guanbi-70_1@2x.png" mode=""></image>
</view>
<view class="becomeLand">
<view class="becomeLandImg">
<image style="width: 588rpx;height: 656rpx;border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;" :src="becomeLandImg" mode="aspectFill"></image>
<view class="becomeLandWrap" v-if="showBecomeLand">
<view class="becomeLandCon">
<view class="closeBtn" @click="showBecomeLand = false">
<image style="width: 44rpx;height: 44rpx;" src="../../static/image/guanbi-70_1@2x.png" mode=""></image>
</view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="agree">
<text style="text-align: center;line-height: 78rpx;color: #fff;font-size: 32rpx;">成为地主</text>
<view class="becomeLand">
<view class="becomeLandImg">
<image style="width: 588rpx;height: 656rpx;border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;" :src="becomeLandImg" mode="aspectFill"></image>
</view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="agree">
<text style="text-align: center;line-height: 78rpx;color: #fff;font-size: 32rpx;">成为地主</text>
</view>
</view>
</view>
</view>
</view>
<!-- 版本更新弹框区域 -->
<view class="updateVersion" v-if="showUpdateVersion">
<view class="updateVersionCon">
<view class="bg">
<view class="updateTitle">
<text style="text-align: center;color: #35655f;font-size: 32rpx;padding-top: 48rpx;">发现新版本,{{versiondata.newversion}}来啦</text>
</view>
<scroll-view scroll-y class="updateContent">
<text style="font-size: 28rpx;color: #323233;line-height: 40rpx;">{{versiondata.upgradetext}}</text>
</scroll-view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="download">
<text style="font-size: 28rpx;text-align: center;line-height: 72rpx;color: #fff;">{{downloadTxt}}({{versiondata.packagesize}})</text>
</view>
</view>
<image style="width: 188rpx;height: 106rpx;position: fixed;left: 48rpx;top: 426rpx;" src="../../static/image/Vector_1@2x.png" mode=""></image>
<image style="width: 102rpx;height: 76rpx;position: fixed;left: 156rpx;top: 457rpx;" src="../../static/image/Vector@2x.png" mode=""></image>
<image style="width: 240rpx;height: 212rpx;position: fixed;left: 261rpx;top: 327rpx;" src="../../static/image/huojian_1@2x.png" mode=""></image>
<image style="width: 128rpx;height: 80rpx;position: fixed;right: 120rpx;top: 448rpx;" src="../../static/image/Vector_2@2x.png" mode=""></image>
<image style="width: 180rpx;height: 116rpx;position: fixed;right: 48rpx;top: 404rpx;" src="../../static/image/Vector_3@2x.png" mode=""></image>
</view>
<view class="closeBtn" @click="showUpdateVersion = false">
<image style="width: 44rpx;height: 44rpx;" src="../../static/image/guanbi-70_1@2x.png" mode=""></image>
</view>
</view>
</view>
</view>
</template>
... ... @@ -269,6 +297,10 @@
export default {
data() {
return {
downloadTxt:'立即升级',
versiondata:{},
showUpdateVersion:false,
showBecomeLand:false,
markerId:'',
scale:13,//地图缩放级别
mapHeight:0,
... ... @@ -305,6 +337,15 @@
this.statusBarHeight = res.statusBarHeight*2
}
})
//获取成为地主图片
uni.request({
url:'http://app.zhaodizhu.cn/api/common/getConfig',
method:'POST',
data:{type:'1'},
success: (res) => {
this.becomeLandImg = res.data.data.landlord_index
}
})
},
onShow() {
this.notReadNumber = 0
... ... @@ -415,24 +456,15 @@
success: (res) => {
console.log('版本',res)
if(res.data.data.versiondata != null){
// #ifdef APP-PLUS
const subNVue = uni.getSubNVueById('updateVersion');
subNVue.show('none', 250);
// #endif
this.versiondata = res.data.data.versiondata
this.showUpdateVersion = true
}
}
})
//如果登录人是游侠第一次登录弹出成为地主弹框
if(this.userinfo.group_id == '1' && uni.getStorageSync('landAlertFlag') != this.userinfo.id){
uni.setStorage({
key: 'landAlertFlag',
data: this.userinfo.id
});
// #ifdef APP-PLUS
const subNVue = uni.getSubNVueById('landAlert');
subNVue.show('none', 250);
// #endif
this.showBecomeLand = true
}
this.getAllData()
... ... @@ -493,6 +525,91 @@
});
},
download(){
this.showUpdateVersion = false
if (plus.os.name.toLowerCase() == 'ios') {
// 跳转到下载页面
plus.runtime.openURL(this.versiondata.downloadurl)
} else {
var dtask = plus.downloader.createDownload(
this.versiondata.downloadurl, {},
function(d, status) {
uni.showToast({
title: '下载完成',
mask: false,
duration: 1000
});
// 下载完成
if (status == 200) {
plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), {}, e => e, function(error) {
uni.showToast({
title: '安装失败',
mask: false,
duration: 1500
});
})
} else {
uni.showToast({
title: '更新失败',
mask: false,
duration: 1500
});
}
});
try {
dtask.start(); // 开启下载的任务
var prg = 0;
var showLoading = plus.nativeUI.showWaiting("正在下载"); //创建一个showWaiting对象
dtask.addEventListener('statechanged', function(
task,
status
) {
// 给下载任务设置一个监听 并根据状态 做操作
switch (task.state) {
case 1:
showLoading.setTitle("正在下载");
break;
case 2:
showLoading.setTitle("已连接到服务器");
break;
case 3:
prg = parseInt(
(parseFloat(task.downloadedSize) /
parseFloat(task.totalSize)) *
100
);
showLoading.setTitle(" 正在下载" + prg + "% ");
break;
case 4:
plus.nativeUI.closeWaiting();
//下载完成
break;
}
});
} catch (err) {
plus.nativeUI.closeWaiting();
uni.showToast({
title: '更新失败',
mask: false,
duration: 1500
});
}
}
},
agree(){
if(uni.getStorageSync("token")){
const subNVue = uni.getSubNVueById('landAlert')
// 关闭 nvue 子窗体
subNVue.hide('fade-out', 300)
uni.navigateTo({
url:'/pages/my/becomeLand'
})
}else{
uni.navigateTo({
url:"/pages/index/login"
})
}
},
callback(e){
let landId
if(e.direction == 'toBottom'){
... ... @@ -905,4 +1022,83 @@
.serviceItem .serviceTxt{justify-content: center;flex-direction: row;padding-top: 16rpx;}
.serviceTxt .serviceText{font-size: 22rpx;color: #fff;}
.serviceInfo .rightEmp{width: 122rpx;}
/* 成为地主弹框 */
.becomeLandWrap{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0,0,0,0.5);
flex-direction: row;
align-items: center;
justify-content: center;
.becomeLandCon{
.closeBtn{flex-direction: row;height: 80rpx;align-items: center;justify-content: flex-end;}
.becomeLand{
width: 588rpx;
height: 756rpx;
background-color: #fff;
border-radius: 30rpx;
}
.becomeLandImg{
width: 588rpx;height: 656rpx;
}
.bottomBtnWrap{
height: 100rpx;
flex-direction: row;
justify-content: center;
align-items: center;
}
.bottomBtnWrap .bottomBtn{height: 78rpx;width: 250rpx;border-radius: 50rpx;background: #35655f;}
}
}
// 版本更新弹框区域
.updateVersion{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0,0,0,0.5);
flex-direction: row;
justify-content: center;
padding-top: 500rpx;
.updateVersionCon{
.bg{
position: relative;
width: 622rpx;
border-radius: 30rpx;
background-color: #fff;
.updateTitle{
height: 112rpx;
}
.updateContent{
height: 192rpx;
padding: 0 48rpx;
}
.bottomBtnWrap{
height: 120rpx;
flex-direction: row;
justify-content: center;
align-items: center;
.bottomBtn{
width: 526rpx;
height: 72rpx;
opacity: 1;
background-color: #82c7c2;
border-radius: 36rpx;
}
}
}
.closeBtn{
width: 622rpx;
height: 120rpx;
flex-direction: row;
align-items: flex-end;
justify-content: center;
}
}
}
</style>
... ...
<template>
<view>
<view class="closeBtn">
<image style="width: 44rpx;height: 44rpx;" src="../../../static/image/guanbi-70_1@2x.png" mode=""></image>
</view>
<view class="becomeLand">
<view class="becomeLandImg">
<image style="width: 588rpx;height: 656rpx;border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;" :src="becomeLandImg" mode="aspectFill"></image>
</view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="agree">
<text style="text-align: center;line-height: 78rpx;color: #fff;font-size: 32rpx;">成为地主</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data(){
return{
becomeLandImg:''
}
},
onLoad() {
//获取成为地主图片
uni.request({
url:'http://app.zhaodizhu.cn/api/common/getConfig',
method:'POST',
data:{type:'1'},
success: (res) => {
this.becomeLandImg = res.data.data.landlord_index
}
})
},
methods:{
agree(){
if(uni.getStorageSync("token")){
const subNVue = uni.getSubNVueById('landAlert')
// 关闭 nvue 子窗体
subNVue.hide('fade-out', 300)
uni.navigateTo({
url:'/pages/my/becomeLand'
})
}else{
uni.navigateTo({
url:"/pages/index/login"
})
}
}
}
}
</script>
<style>
/* 成为地主弹框 */
.closeBtn{flex-direction: row;height: 80rpx;align-items: center;justify-content: flex-end;}
.becomeLand{
width: 588rpx;
height: 756rpx;
background-color: #fff;
border-radius: 30rpx;
}
.becomeLandImg{
width: 588rpx;height: 656rpx;
}
.bottomBtnWrap{
height: 100rpx;
flex-direction: row;
justify-content: center;
align-items: center;
}
.bottomBtnWrap .bottomBtn{height: 78rpx;width: 250rpx;border-radius: 50rpx;background: #35655f;}
</style>
<template>
<view class="updateVersion">
<view class="bg">
<view class="updateTitle">
<text style="text-align: center;color: #35655f;font-size: 32rpx;padding-top: 48rpx;">发现新版本,{{versiondata.newversion}}来啦</text>
</view>
<scroll-view scroll-y class="updateContent">
<text style="font-size: 28rpx;color: #323233;line-height: 40rpx;">{{versiondata.upgradetext}}</text>
</scroll-view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="download">
<text style="font-size: 28rpx;text-align: center;line-height: 72rpx;color: #fff;">{{downloadTxt}}({{versiondata.packagesize}})</text>
</view>
</view>
<image style="width: 188rpx;height: 106rpx;position: fixed;left: 8rpx;top: 76rpx;" src="../../../static/image/Vector_1@2x.png" mode=""></image>
<image style="width: 102rpx;height: 76rpx;position: fixed;left: 156rpx;top: 107rpx;" src="../../../static/image/Vector@2x.png" mode=""></image>
<image style="width: 240rpx;height: 212rpx;position: fixed;left: 197rpx;top: 0;" src="../../../static/image/huojian_1@2x.png" mode=""></image>
<image style="width: 128rpx;height: 80rpx;position: fixed;right: 120rpx;top: 118rpx;" src="../../../static/image/Vector_2@2x.png" mode=""></image>
<image style="width: 180rpx;height: 116rpx;position: fixed;right: 8rpx;top: 54rpx;" src="../../../static/image/Vector_3@2x.png" mode=""></image>
</view>
<view class="closeBtn" @click="closeUpdateVersion">
<image style="width: 44rpx;height: 44rpx;" src="../../../static/image/guanbi-70_1@2x.png" mode=""></image>
</view>
</view>
</template>
<script>
var apiUrl = 'http://app.zhaodizhu.cn/api'
var version = '1.0'//当前应用版本
export default {
data(){
return{
downloadTxt:'立即升级',
versiondata:{}
}
},
onLoad() {
uni.request({
url:apiUrl + '/common/init',
method:'GET',
data:{
version:version
},
success: (res) => {
console.log('版本',res)
this.versiondata = res.data.data.versiondata
}
})
},
methods:{
closeUpdateVersion(){
const subNVue = uni.getSubNVueById('updateVersion')
// 关闭 nvue 子窗体
subNVue.hide('fade-out',500)
},
download(){
const subNVue = uni.getSubNVueById('updateVersion')
// 关闭 nvue 子窗体
subNVue.hide('fade-out',500)
if (plus.os.name.toLowerCase() == 'ios') {
// 跳转到下载页面
plus.runtime.openURL(this.versiondata.downloadurl)
} else {
var dtask = plus.downloader.createDownload(
this.versiondata.downloadurl, {},
function(d, status) {
uni.showToast({
title: '下载完成',
mask: false,
duration: 1000
});
// 下载完成
if (status == 200) {
plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), {}, e => e, function(error) {
uni.showToast({
title: '安装失败',
mask: false,
duration: 1500
});
})
} else {
uni.showToast({
title: '更新失败',
mask: false,
duration: 1500
});
}
});
try {
dtask.start(); // 开启下载的任务
var prg = 0;
var showLoading = plus.nativeUI.showWaiting("正在下载"); //创建一个showWaiting对象
dtask.addEventListener('statechanged', function(
task,
status
) {
// 给下载任务设置一个监听 并根据状态 做操作
switch (task.state) {
case 1:
showLoading.setTitle("正在下载");
break;
case 2:
showLoading.setTitle("已连接到服务器");
break;
case 3:
prg = parseInt(
(parseFloat(task.downloadedSize) /
parseFloat(task.totalSize)) *
100
);
showLoading.setTitle(" 正在下载" + prg + "% ");
break;
case 4:
plus.nativeUI.closeWaiting();
//下载完成
break;
}
});
} catch (err) {
plus.nativeUI.closeWaiting();
uni.showToast({
title: '更新失败',
mask: false,
duration: 1500
});
}
}
/* if(this.downloadTxt == '下载中'){
return
}
this.downloadTxt = '下载中'
const downloadTask = uni.downloadFile({
url: this.versiondata.downloadurl, //仅为示例,并非真实的资源
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功');
}
}
});
downloadTask.onProgressUpdate((res) => {
console.log('下载进度' + res.progress);
console.log('已经下载的数据长度' + res.totalBytesWritten);
console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
// 测试条件,取消下载任务。
if (res.progress > 50) {
downloadTask.abort();
}
}); */
/* console.log('11111111111111111',this.versiondata.downloadurl)
uni.downloadFile({
url: this.versiondata.downloadurl, //仅为示例,并非真实的资源
success: (res) => {
console.log('下载成功',res);
if (res.statusCode === 200) {
console.log('下载成功');
}
},
fail: (err) => {
console.log('下载失败',err)
}
}); */
}
}
}
</script>
<style lang="scss" scoped>
.updateVersion{
padding-top: 157rpx;
.bg{
position: relative;
width: 622rpx;
height: 424rpx;
border-radius: 30rpx;
background-color: #fff;
.updateTitle{
height: 112rpx;
}
.updateContent{
height: 192rpx;
padding: 0 48rpx;
}
.bottomBtnWrap{
height: 120rpx;
flex-direction: row;
justify-content: center;
align-items: center;
.bottomBtn{
width: 526rpx;
height: 72rpx;
opacity: 1;
background-color: #82c7c2;
border-radius: 36rpx;
}
}
}
.closeBtn{
width: 622rpx;
height: 120rpx;
flex-direction: row;
align-items: flex-end;
justify-content: center;
}
}
</style>
... ... @@ -66,7 +66,7 @@
// 负数为图片超出屏幕底部多少距离后触发懒加载,正数为图片顶部距离屏幕底部多少距离时触发(图片还没出现在屏幕上)
threshold: {
type: [Number, String],
default: 100
default: 3
},
// 淡入淡出动画的过渡时间
duration: {
... ... @@ -97,7 +97,7 @@
},
data() {
return {
isShow: false,
isShow: true,
opacity: 1,
time: this.duration,
loadStatus: '', // 默认是懒加载中的状态
... ...