红绿项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

219 lines
5.0 KiB

<template>
<view class="goods_con">
<navigation :showBack="false">
Home
</navigation>
<!-- #ifdef H5 -->
<view class="top_item" @click="goDown()">
<view class="one">
<view class="white">
<image :src="logoUrl" mode="aspectFit"></image>
</view>
<view class="dtext">
Open With An App
</view>
</view>
<image src="../../../static/home/[email protected]" mode="aspectFit" class="dimg"></image>
</view>
<!-- #endif -->
<u-swiper :list="list" height="1000" mode="none"></u-swiper>
<view class="goods_list_con">
<view class="good_item" v-for="item,index in goods_list" :key="item.index" @click="goGoodsDetail(item.id)">
<image :src="$constant.APP+item.goodsImgThumbUrl" mode="aspectFit"></image>
<view class="text">
{{item.goodsName}}
</view>
<view class="price">
{{currencySymbol}} {{item.goodsPrice}}
</view>
</view>
</view>
</view>
</template>
<script>
import api from '@/utils/api'
import utils from '@/utils'
import md5 from 'js-md5'
import store from '@/store'
import cont from "@/components/navigation/navigation.vue"
export default {
data() {
return {
logoUrl: '',
androidUrl: '',
// banner
list: [],
// 商品
goods_list: [],
ticket: '',
currencySymbol: '',
currentBalance: '',
}
},
onLoad() {
this.currencySymbol = uni.getStorageSync('siteInfo').currencySymbol;
const post = api.withdrawConfig({
"ticket": uni.getStorageSync('logInfo').data,
})
post.then(res => {
if (res.data != undefined) {
this.currentBalance = res.data.currentBalance;
uni.setStorage({
key: 'currentBalance',
data: this.currentBalance,
success: function() {
console.log('success')
}
});
}
})
.catch(e => {
console.log(e)
})
// #ifdef APP-PLUS
this.appVersion();
// #endif
this.openGame();
this.currencySymbol = uni.getStorageSync('siteInfo').currencySymbol;
this.androidUrl = uni.getStorageSync('siteInfo').androidUrl;
this.ticket = uni.getStorageSync('logInfo').data;
this.init();
},
onReady() {
},
methods: {
// 校驗版本號
appVersion() {
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
console.log('当前版本号' + wgtinfo.versionCode)
console.log('服务器版本号:' + res.data.versionId)
console.log((wgtinfo.versionCode < res.data.versionId))
var param = {
'appId': 'android',
'versionCode': wgtinfo.versionName,
}
console.log(param, "版本号版本号版本号")
const post = api.appVersion(param)
post.then(d => {
console.log('zzzzzzzzzzzzzz')
console.log(d)
this.upgradeInfo = d.data
if (d.data.isUpgrade != undefined && d.data.isUpgrade) {
this.upgrade = true
this.close_mask = false
} else {
this.upgrade = false
//this.isFirstLogin()
}
})
.catch((e) => {
console.log(e)
})
});
},
openGame() {
const post = api.info()
post.then(d => {
// uni.setStorage({
// key: 'Gamestatus',
// data: d.data.gameMenuStatus,
// });
if (d.data.gameMenuStatus == 'close') {
uni.setTabBarItem({
index: 2,
text: 'Order',
pagePath: '/pages/menu/order/index',
iconPath: '/static/tabbar/dorder.png',
selectedIconPath: '/static/tabbar/dorderS.png'
})
} else if (d.data.gameMenuStatus == 'open') {
uni.setTabBarItem({
index: 2,
text: 'Game',
pagePath: "/pages/menu/color/index",
iconPath: "/static/tabbar/[email protected]",
selectedIconPath: "/static/tabbar/[email protected]"
})
}
})
.catch((e) => {
console.log(e)
})
},
goDown() {
// #ifdef H5
window.location.href = this.androidUrl;
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(this.androidUrl);
// #endif
},
goGoodsDetail(i) {
uni.navigateTo({
url: 'goodsDetail/index?id=' + i
})
},
init() {
const post = api.banner({})
.then(res => {
this.list = res.data;
for (var i = 0; i < this.list.length; i++) {
this.list[i].adImgPath = this.$constant.APP + this.list[i].adImgPath
}
}).catch(err => {
console.log(err)
})
const post2 = api.goodsList({})
.then(res => {
this.goods_list = res.data;
for (var i = 0; i < this.goods_list.length; i++) {
this.goods_list[i].goodsPrice = parseFloat(this.goods_list[i].goodsPrice).toFixed(2)
}
}).catch(err => {
console.log(err)
})
// 获取logo
const siteInfo = api.siteInfo()
siteInfo.then(d => {
let that = this
uni.setStorage({
key: 'siteInfo',
data: d.data,
success: function() {
console.log('success')
that.logoUrl = d.data.siteDomain + d.data.siteLogo
}
});
})
.catch((e) => {
console.log(e)
})
},
},
}
</script>
<style>
@import './index.css';
</style>