Commit db9ef5ca 吴良建

初步完成

1 个父辈 a2112175
<script>
<script>
import {
transformImageCodeToUri
} from "@/utils/image_utils.js";
import common from '@/utils/common.js'
import http from '@/utils/http.js'
import app_config from '@/utils/app.js'
......@@ -41,25 +45,6 @@
// #endif
}
})
//获取配置
let local_ic = await uni.getStorageSync('info_config_key')
if (local_ic) {
common.info_config = JSON.parse(local_ic)
}
console.debug('---0000------', common.info_config)
let ic_res = await http.gql({
query: 'query{info_config}'
})
let info_config = ic_res.data.info_config
if (info_config) {
common.info_config = info_config
await uni.setStorageSync('info_config_key', JSON.stringify(info_config))
console.log(common.info_config);
} else {
console.debug('---获取后台配置失败---')
}
},
onShow: function() {
......@@ -88,7 +73,7 @@
},
methods: {
async antoLogin() {
var appToken = uni.getStorageSync('appToken') || ""
var appToken = loginHelper.getAppToken() || ""
console.log("antoLogin " + JSON.stringify(appToken))
if (appToken) {
var mac_code = uni.getSystemInfoSync().deviceId
......@@ -113,7 +98,8 @@
loginHelper.logout()
}
}
} else {
loginHelper.logout()
}
}
}
......
<template>
<view>
<view style="display: flex; justify-content: space-between; width: 100%; margin-top: 30rpx;">
<text class="title_text" style="width: 20%;">赛事</text>
<view style="display: flex; justify-content: space-between;">
<text class="title_text">主</text>
<text class="title_text"
style="flex: 1; display: flex; margin-left: 30rpx; margin-right: 30rpx;">比分(半场)</text>
<text class="title_text">客</text>
</view>
<text class="title_text" style="color: #6f83fc; width: 20%;">{{getWinTypeName()}}</text>
</view>
<view v-for="(item, index) in data_array" :class="index % 2 == 0 ?'item_bg' : 'item_bg_two'" :key="index">
<view style="display: flex; width: 16%; flex-direction: column;
justify-content: center; align-items: center;">
<text class="text1">{{competition[item.Id[1]].ShortName}}</text>
<text class="text1">{{utils.dateFormatYear2(item.Date)}}</text>
</view>
<view style="display: flex; width: 100%; flex: 1; font-size: 16px;
flex-direction: row;">
<text :style="'color:' + getTeamNameColor(item.Id[2],item)"
style="flex: 1; text-align: right;">{{Team[item.Id[2]].ShortName}}</text>
<view style="margin-left: 30rpx; margin-right: 30rpx; ">
<text
style="font-size: 18px; color: #666; font-weight: bold;">{{item.ScoreAll[0] + ":" + item.ScoreAll[1]}}</text>
<text style="font-size: 14px; margin-left: 6rpx;
color: #999; padding-top: 5px">{{"["+item.Half+"]"}}</text>
</view>
<text :style="'color:' + getTeamNameColor(item.Id[3],item)"
style="flex: 1; text-align: left;">{{Team[item.Id[3]].ShortName}}</text>
</view>
<view class="item_win_text" :style="'background-color:' + getTeamNameColor(HomeId, item)"
@click="switchWinType()">
<text>{{getWinTypeInfo(HomeId, item)}}</text>
</view>
</view>
</view>
</template>
<script>
import utils from '../utils/utils.js';
export default {
name: "AnalysisList",
data() {
return {
winTypeArray: ["胜平负", "进球", "半全场"],
utils,
winTypeIndex: 0
};
},
props: {
data_array: {
type: Array,
default: () => []
},
competition: {
type: Object,
default: () => ({})
},
Team: {
type: Object,
default: () => ({})
},
HomeId: {
type: Number,
default: 0
}
},
watch: {
data_array: function(newVal, oldVal) {
console.log('属性值变为:', newVal);
this.data_array = newVal
}
},
methods: {
checkTramWin(id, item, score) { // 判断是赢是输是平
var index1 = item.Id[2] === id ? 0 : 1;
var index2 = item.Id[3] === id ? 1 : 0;
if (score[index1] > [index2]) {
return "胜";
} else if (score[index1] == score[index2]) {
return "平";
} else {
return "负";
}
},
getWinTypeInfo(id, item) {
switch (this.winTypeIndex) {
case 0:
return this.checkTramWin(id, item, item.ScoreAll);
case 1:
return (item.ScoreAll[0] + item.ScoreAll[1]) + "球"
case 2:
return this.checkTramWin(id, item, item.Half.split('-')) + this.checkTramWin(id, item, item
.ScoreAll)
}
},
getTeamNameColor(id, item) {
if (this.HomeId !== id) {
return "#888888"
} else {
var index1 = item.Id[2] === id ? 0 : 1;
var index2 = item.Id[2] === id ? 1 : 0;
var home = item.ScoreAll[index1]
if (item.ScoreAll[index1] > item.ScoreAll[index2]) {
return "#ff6858";
} else if (item.ScoreAll[index1] == item.ScoreAll[index2]) {
return "#82c866";
} else {
return "#6f83fc";
}
}
},
getWinTypeName() {
return this.winTypeArray[this.winTypeIndex]
},
switchWinType() {
this.winTypeIndex++
if (this.winTypeIndex >= this.winTypeArray.length) {
this.winTypeIndex = 0
}
}
},
mounted() {
console.log(Array.isArray(this.data_array) )
}
}
</script>
<style>
.red {
color: #ff6858;
}
.green {
color: #82c866;
}
.blue {
color: #6f83fc;
}
.title_text {
text-align: center;
font-size: 24rpx;
color: #b2b2b2;
}
.item_bg {
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
padding-top: 15rpx;
padding-bottom: 15rpx;
padding-left: 15rpx;
padding-right: 15rpx;
background-color: #fafafa;
}
.item_bg_two {
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
padding-top: 15rpx;
padding-bottom: 15rpx;
padding-left: 15rpx;
padding-right: 15rpx;
background-color: white;
}
.item_win_text {
width: 16%;
text-align: center;
border-radius: 2px;
padding: 1px 0px;
font-size: 12px;
background-color: rgb(145, 187, 128);
color: rgb(255, 255, 255);
}
.text1 {
text-align: center;
font-size: 12px;
color: #999;
}
.text2 {
text-align: center;
font-size: 12px;
color: #b2b2b2;
}
</style>
<template>
<view>
<scroll-view>
<view>
<view v-for="(key, index) in keySet" :key="index">
<view class="header-item">
{{key + ' ' + utils.getweekDay(key)}}
</view>
<view v-for="(item, index) in data_map.get(key)" :key="item.Id" class="match_item"
onclick="event.stopPropagation();" @click="goToMatch(item)">
<view style="display: flex; flex-direction: row;
justify-content: space-between; width: 100%; ">
<view style="display: flex; flex: 1; ">
<text class="match_text">{{item.GameName}}</text>
<text class="match_time_text"
style="margin-left: 32rpx;">{{getMatchTime(item.MatchTime)}}</text>
</view>
<view>
<text class="match_info_text">{{item.MatchState}}</text>
</view>
<view style="display: flex; flex-direction: row-reverse; flex: 1;">
<view v-if="item.MatchState != '完'">
<view v-show="item.SportsInfoCount != 0" style="display: flex;flex-direction: row;
justify-content: right;
background: #5589FF;
color: white;
align-items: center;
padding-left: 16rpx;
border-radius: 26rpx 0rpx 0rpx 26rpx;">
<text>{{item.SportsInfoCount + "条情报"}}</text>
<image style="width: 40rpx; height: 40rpx;"
src="../static/tab_icons/ic_in@2x.png"></image>
</view>
</view>
<text v-else class="match_info_text"
style="margin-left: 32rpx;">{{getMatchInfo(item)}}</text>
</view>
</view>
<view style="display: flex; justify-content: space-between; ">
<view @click.stop="follow_action(item, index)" style="padding-top: 32rpx;">
<image class="follow_iv" v-show="item.isFollow"
src="../static/tab_icons/follow01.png" />
<image class="follow_iv" v-show="!item.isFollow"
src="../static/tab_icons/follow02.png" />
</view>
<view
style=" display: flex; align-items: center; width: 100%; justify-content: space-between;">
<view
style="display: flex; flex: 1; flex-direction: row-reverse; ; width: 100%; margin-right: 75rpx; align-items: center;">
<text v-show="item.HostYellow" class="yellow_p">{{item.HostYellow}}</text>
<text v-show="item.HostRed" class="reb_p">{{item.HostRed}}</text>
<text class="name-text">{{item.HostName}}</text>
</view>
<view>
<text class="score"
v-if="item.QcBf">{{getHostScore(item) + ":" + getGuestScore(item)}}</text>
<text v-else class="vs_text" style="min-width: 60rpx;">VS</text>
</view>
<view
style="flex: 1; display: flex; width: 100%; margin-left: 75rpx; align-items: center;">
<text class="name-text">{{item.GuestName}}</text>
<text v-show="item.GuestRed" class="reb_p">{{item.GuestRed}}</text>
<text v-show="item.GuestYellow" class="yellow_p">{{item.GuestYellow}}</text>
</view>
</view>
<view class="follow_iv"></view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import utils from "../utils/utils.js";
import followHelper from '../utils/followHelper.js';
import common from '../utils/common';
export default {
name: "MatchList",
props: {
data_info: [Array],
},
data() {
return {
data_in : this.data_info,
utils,
data_map: new Map(),
keySet: []
};
},
methods: {
getHostScore(item) {
if (item.QcBf && item.QcBf.length > 0) {
var split = item.QcBf.split('-')
return split[0]
}
return "-"
},
getGuestScore(item) {
if (item.QcBf && item.QcBf.length > 0) {
var split = item.QcBf.split('-')
return split[1]
}
return "-"
},
getMatchTime(time) {
return utils.dateFormatHoursMinutes(time)
},
getMatchInfo(item) {
if (item.BcBf) {
return "半场:" + item.BcBf
}
return ""
},
async follow_action(match,index) {
this.$emit("updateItem", match.Id , index)
await followHelper.follow_action(match)
await this.handlerData()
},
async handlerData() {
//获取关注的比赛
var follow_list = await followHelper.getFollowList()
this.data_map.clear()
for (var i = 0; i < this.data_in.length; i++) {
var moudle = this.data_in[i]
if (moudle) {
var mId = moudle.Id
var same = follow_list.some(function(item, index) {
return item.Id === mId
})
if (same) {
moudle.isFollow = true
} else {
moudle.isFollow = false
}
var list = this.data_map.get(moudle.IssueName)
if (!list) {
list = []
}
list.push(moudle)
this.data_map.set(moudle.IssueName, list)
}
}
this.keySet.length = 0
this.keySet.push(...this.data_map.keys())
},
onRefreshInfo() {
this.handlerData()
},
goToMatch(match) {
console.log("Detail:" + JSON.stringify(match))
let gameid = match.Sportsdt.SportsdtMatchId
if (gameid) {
uni.navigateTo({
url: `/pages/analysis/analysis?info=${JSON.stringify(gameid)}`
})
}
}
},
mounted() {
this.handlerData()
}
}
</script>
<style>
.content {
width: 100%;
height: 100%;
}
.match_item {
margin: 32rpx;
padding-left: 24rpx;
padding-top: 24rpx;
padding-bottom: 24rpx;
background: #F3F3F3;
border-radius: 24rpx;
}
.follow_iv {
width: 44rpx;
height: 44rpx;
}
.match_text {
font-size: 30rpx;
font-weight: 400;
color: #FF9139;
}
.match_time_text {
font-size: 30rpx;
font-weight: 400;
color: #333333;
}
.centered-component {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.match_info_text {
height: 42rpx;
max-height: 42rpx;
font-size: 30rpx;
font-weight: 400;
color: #AAAAAA;
line-height: 42rpx;
}
.vs_text {
font-size: 36rpx;
font-weight: bold;
color: #777777;
}
.score {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.yellow_p {
background: #FF9139;
border-radius: 4rpx;
padding-left: 2rpx;
padding-right: 2rpx;
font-size: 30rpx;
font-weight: bold;
color: #FFFFFF;
margin-left: 5rpx;
margin-right: 5rpx;
height: 34rpx;
line-height: 34rpx;
text-align: center;
}
.red_p {
background: #F02626;
border-radius: 4rpx;
padding-left: 2rpx;
padding-right: 2rpx;
font-size: 30rpx;
font-weight: bold;
margin-left: 5rpx;
margin-right: 5rpx;
color: #FFFFFF;
height: 34rpx;
line-height: 34rpx;
text-align: center;
}
.sports_info_count_text {
font-size: 30rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 42rpx;
}
.header-item {
height: 44rpx;
margin-right: 9px;
line-height: 17px;
position: sticky;
z-index: 9999;
top: auto;
left: 0;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-size: 32rpx;
font-weight: 500;
color: #333333;
line-height: 44rpx;
}
.name-text {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
</style>
{
"name" : "JinQiuSports",
"name" : "金球体育",
"appid" : "__UNI__E81960F",
"description" : "",
"description" : "金球体育",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
......@@ -68,5 +68,11 @@
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
"vueVersion" : "2",
"h5" : {
"router" : {
"mode" : "history"
},
"template" : "template.h5.html"
}
}
......@@ -3,104 +3,101 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#25CDAA"
"navigationBarTitleText": "首页",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#04764E"
}
}, {
"path": "pages/study/study",
"style": {
"navigationBarTitleText": "研究",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#04764E"
}
}, {
"path": "pages/info/info",
"style": {
"navigationBarTitleText": "情报",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#04764E"
}
}, {
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/login_pwd/login_pwd",
"style": {
"navigationBarTitleText": "账号登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/login_yzm/login_yzm",
"style": {
"navigationBarTitleText": "验证码登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/suggest/suggest",
"style": {
"navigationBarTitleText": "提建议",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/settings/settings",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/logout/logout",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/notitle_webview/notitle_webview",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/normal_webview/normal_webview",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/analysis/analysis",
"style": {
"navigationBarTitleText": "分析",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#04764E"
}
}
,{
"path" : "pages/study/study",
"style" :
{
"navigationBarTitleText": "研究",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#25CDAA"
}
}
,{
"path" : "pages/info/info",
"style" :
{
"navigationBarTitleText": "情报",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#25CDAA"
}
}
,{
"path" : "pages/mine/mine",
"style" :
{
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/login_pwd/login_pwd",
"style" :
{
"navigationBarTitleText": "账号登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/login_yzm/login_yzm",
"style" :
{
"navigationBarTitleText": "验证码登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/suggest/suggest",
"style" :
{
"navigationBarTitleText": "提建议",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/settings/settings",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/logout/logout",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/notitle_webview/notitle_webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/normal_webview/normal_webview",
"path" : "pages/test/test",
"style" :
{
"navigationBarTitleText": "",
......@@ -110,41 +107,40 @@
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"backgroundColor": "#F8F8F8",
"selectedColor": "#0a1b31",
"color": "#999999",
"list": [
{
"text": "首页",
"iconPath": "static/tab_icons/Home02.png",
"selectedIconPath": "static/tab_icons/Home01.png",
"pagePath": "pages/index/index"
},
{
"text": "研究",
"iconPath": "static/tab_icons/gc02.png",
"selectedIconPath": "static/tab_icons/gc01.png",
"pagePath": "pages/study/study"
},
{
"text": "情报",
"iconPath": "static/tab_icons/qb02.png",
"selectedIconPath": "static/tab_icons/qb01.png",
"pagePath": "pages/info/info"
},
{
"text": "我的",
"iconPath": "static/tab_icons/wd02.png",
"selectedIconPath": "static/tab_icons/wd01.png",
"pagePath": "pages/mine/mine"
}
]
"navigationBarBackgroundColor": "#04764E",
"backgroundColor": "#F5F5F5"
},
"tabBar": {
"backgroundColor": "#F8F8F8",
"selectedColor": "#0a1b31",
"color": "#999999",
"list": [{
"text": "首页",
"iconPath": "static/tab_icons/ic_shouye_off@2x.png",
"selectedIconPath": "static/tab_icons/ic_shouye_on@2x.png",
"pagePath": "pages/index/index"
},
{
"text": "研究",
"iconPath": "static/tab_icons/ic_yanjiu_off@2x.png",
"selectedIconPath": "static/tab_icons/ic_yanjiu_on@2x.png",
"pagePath": "pages/study/study"
},
{
"text": "情报",
"iconPath": "static/tab_icons/ic_qingbao_off@2x.png",
"selectedIconPath": "static/tab_icons/ic_qingbao_on@2x.png",
"pagePath": "pages/info/info"
},
{
"text": "我的",
"iconPath": "static/tab_icons/ic_person_off@2x.png",
"selectedIconPath": "static/tab_icons/ic_person_on@2x.png",
"pagePath": "pages/mine/mine"
}
]
},
"uniIdRouter": {}
}
<template>
<view class="content">
<view>
<v-tabs v-model="current" :tabs="tabs" @change="changeTab" line-height="5rpx" line-color="#25CDAA"></v-tabs>
<v-tabs class="tab_c" v-model="current" :tabs="tabs" @change="changeTab"
line-height="8rpx" line-color="#04764E"
color="#AAAAAA" activeColor="#04764E" height="88rpx"></v-tabs>
<z-swiper style="padding-top: 100rpx;" ref="zSwiper" v-model="tabs" @slideChange="onSwiperChange"
:options="options">
<z-swiper-item v-for="(item, index) in tabs" :key="item" style="min-height: 90vh;">
<view v-if="match_map.get(item) && match_map.get(item).length > 0 " style="width: 100vw;">
<MatchList :data_info="match_map.get(item)" ref="MatchListRef" :key="index" @updateItem ="updateItem"></MatchList>
</view>
<view style="width: 100vw; height: 80vh; align-items: center; display: flex; justify-content: center;"
v-else>
<text>暂无比赛</text>
</view>
</z-swiper-item>
</z-swiper>
</view>
</template>
<script>
import MatchList from '../../components/MatchList.vue'
import {
default as http
} from "@/utils/http.js";
import common from '../../utils/common';
import followHelper from '../../utils/followHelper.js';
export default {
components: {
MatchList
},
data() {
return {
current: 0,
tabs: ['关注', '国内', '新闻新闻', '军事', '国内', '新闻', '军事', '国内', '新闻']
match_map: new Map(),
options: {
autoHeight: true,
centeredSlides: true,
centeredSlidesBounds: true,
initialSlide: 1
},
current: 1,
tabs: []
}
},
onLoad() {
async onLoad() {
let infoRes = await http.gql({
"query": `{
liveScore(lotIds: "72,45",order:[["MatchTime","desc"]], limit:100) {
count
matchs {
Id
InfoId
LotteryId
IssueName
MatchTime
MatchNumber
HostName
HostRed
HostYellow
GuestName
GuestRed
GuestYellow
GameName
QcBf
BcBf
HostTeam {
LogoFullPath
}
GuestTeam {
LogoFullPath
}
MatchState
MatchRound
PreTotalScore
Temperature
SportsInjury
SportsInfoCount
Sportsdt {
SportsdtMatchId
}
}
}
} `
})
let matchs = infoRes.data.liveScore.matchs
if (this.match_map.size > 0) {
this.match_map.clear()
}
this.tabs.length = 0
var followList = await followHelper.getFollowList()
this.match_map.set("关注", followList)
let zhongyao = []
let wancheng = []
for (let m of matchs) {
if (m.MatchState === "完") {
wancheng.push(m)
} else if(m.MatchState === "未"){
zhongyao.push(m)
}
}
zhongyao.sort((item1, item2) => (new Date(item1.IssueName) - new Date(item2.IssueName)))
this.match_map.set("重要", zhongyao)
this.match_map.set("完赛", wancheng)
for (let m of matchs) {
if (m.GameName) {
var list = this.match_map.get(m.GameName)
if (!list) {
list = []
}
list.push(m)
this.match_map.set(m.GameName, list)
}
}
for (const [key, value] of this.match_map.entries()) {
console.log(key, value.length);
}
this.tabs.push(...this.match_map.keys())
},
methods: {
methods: {
updateItem(id, index) {
console.log("id:" + id + "index:" + index)
var list = this.match_map.get(this.tabs[this.current])
var follow_list = followHelper.getFollowList()
var same = follow_list.some(function(item, index) {
return item.Id === id
})
if (same) {
list[index].isFollow = true
} else {
list[index].isFollow = false
}
console.log(list[index])
},
async startRealTime() {
let query_data = `query{
getlivedata
}`
let result = await http.gql({
query: query_data
})
console.log(result)
if (result && result.data && result.data.getlivedata) {
var liveData = result.data.getlivedata.LiveData
var zhongyao = this.match_map.get("重要")
for (let m of zhongyao) {
if (m && m.Sportsdt &&
m.Sportsdt.SportsdtMatchId
) {
var live = liveData[m.Sportsdt.SportsdtMatchId]
if (live) {
m.QcBf = live.ScoreAll[0] + "-" + live.ScoreAll[1]
m.BcBf = live.Score[0] + "-" + live.Score[1]
m.HostRed = live.RedCard[0]
m.HostYellow = live.YellowCard[0]
m.GuestRed = live.RedCard[1]
m.GuestYellow = live.YellowCard[1]
}
}
}
ref.onRefreshInfo(zhongyao)
console.log(zhongyao)
}
},
onSwiperChange(swiper) {
this.current = swiper.activeIndex
console.log("---》" + this.tabs[this.current] +"--"+ this.match_map.get(this.tabs[this.current]))
console.log('onSwiperChange:' + swiper.activeIndex)
var ref = this.$refs.MatchListRef[this.current]
console.log(this.$refs.MatchListRef)
if (this.current === 0) {
var followList = followHelper.getFollowList()
ref.onRefreshInfo(followList)
} else {
var data = this.match_map.get(this.tabs[this.current])
ref.onRefreshInfo(data)
}
},
changeTab(index) {
console.log('当前选中的项:' + index)
this.$refs.zSwiper.swiper.slideTo(index); //切换到第一个slide,速度为1秒
}
}
}
......@@ -31,6 +215,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #F5F5F5;
}
.logo {
......@@ -51,4 +236,9 @@
font-size: 36rpx;
color: #8f8f94;
}
.tab_c {
position: fixed;
z-index: 4;
}
</style>
<template>
<view>
<z-swiper ref="zSwiper" v-model="match_list"
@slideChange="onSwiperChange" :options="options">
<z-swiper ref="zSwiper" v-model="match_list" @slideChange="onSwiperChange" :options="options">
<z-swiper-item v-for="(item, index) in match_list" :key="item.Id" :custom-style="{width:'46%'}">
<view class="match-info"
:style="{'background-color': (select_index === index)
? '#25CDAA' : '#ffffff'}" @click="change_match(item, index)">
<view :class="select_index === index ? 'match-info' : 'match-info-unselect'"
@click="change_match(item, index)">
<view style="display: flex; justify-content: space-between; width: 100%;">
<text class="title-text-one"
:style="{'color': (select_index === index)
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}" @click="change_match(item, index)">{{deal_match_time(item)}}</text>
<text class="title-text-one"
:style="{'color': (select_index === index)
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}" @click="change_match(item, index)">{{item.MatchState}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.HostTeam.LogoFullPath" />
<text class="title-text-two"
:style="{'color': (select_index === index)
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}">{{item.HostName}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.GuestTeam.LogoFullPath" />
<text class="title-text-two"
:style="{'color': (select_index === index)
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}">{{item.GuestName}}</text>
</view>
</view>
......@@ -38,12 +32,20 @@
<view v-if="info_item.Info">
<view v-for="(strInfo, index) in info_item.Info" style="display: flex; flex-direction: row;">
<view class="text-index">{{index + 1}}</view>
<view v-for="(strInfo, index) in info_item.Info"
style="display: flex; flex-direction: row; margin: 35rpx; float: left;">
<view>
<text class="text-item">{{strInfo}}</text>
<text class="text-index-c">
{{index + 1}}
</text>
</view>
<text class="text-item">{{strInfo}}</text>
</view>
</view>
......@@ -71,14 +73,15 @@
options: {
slidesPerView: 'auto'
},
info_options: {
info_options: {
autoHeight: true,
centeredSlides: true,
centeredSlidesBounds: true
},
load_status: 0,
match_list: [],
view_point: null,
select_index : 0,
view_point: null,
select_index: 0,
}
},
methods: {
......@@ -113,7 +116,7 @@
},
change_match(item, index) {
this.$refs.zSwiperInfo.swiper.slideTo(index); //切换到第一个slide,速度为1秒
}
},
async onLoad() {
......@@ -143,14 +146,27 @@
.match-info {
display: flex;
flex-direction: column;
margin: 10rpx;
padding: 10rpx;
background-color: #25CDAA;
}
margin-top: 32rpx;
margin-left: 32rpx;
padding: 24rpx;
background: linear-gradient(135deg, #34C592 0%, #287E60 100%);
border-radius: 16rpx;
}
.match-info-unselect {
display: flex;
flex-direction: column;
margin-top: 32rpx;
margin-left: 32rpx;
padding: 24rpx;
border-radius: 16rpx;
border: 2rpx solid #04764E;
}
.team-logo {
width: 20px;
height: 20px;
width: 40rpx;
height: 40rpx;
border-radius: 10px;
}
......@@ -163,35 +179,37 @@
font-size: 25rpx;
}
.text-index {
width: 56rpx;
height: 56rpx;
margin: 11px;
background-color: #F5F5F5;
color: #888888;
font-size: 14px;
border-radius: 56rpx;
line-height: 56rpx;
.text-index-c{
width: 42rpx;
height: 42rpx;
margin: 22rpx;
background-color: #5589FF;
color: white;
float: left;
font-size: 28rpx;
border-radius: 100%;
line-height: 42rpx;
text-align: center;
}
.text-item {
color: #333333;
font-size: 16px;
text-align: justify;
border-radius: 20px;
line-height: 20px;
}
.title-text-one {
font-size: 13px;
color: white;
}
.title-text-two {
font-size: 18rpx;
margin-left: 6px;
color: white;
font-weight: 700;
font-size: 30rpx;
font-weight: 400;
color: #333333;
line-height: 42rpx;
}
.title-text-one {
font-size: 30rpx;
color: white;
font-weight: 400;
}
.title-text-two {
font-size: 36rpx;
margin-left: 6px;
color: white;
font-weight: 500;
}
</style>
......@@ -102,8 +102,10 @@
.Result
.FaceImageCode);
loginHelper.login(result.data.ydn_login.Result,result.data.ydn_login.AppToken)
loginHelper.login(result.data.ydn_login.Result , result.data.ydn_login.AppToken)
console.log("login")
uni.navigateBack();
return
} else {
uni.showToast({
icon: "none",
......
......@@ -19,25 +19,11 @@
</view>
</view>
<view style="border-top-left-radius: 30rpx;
border-bottom-left-radius: 30rpx; background: linear-gradient(to right, #e3b66a, #f6dc9f);
padding-left: 26rpx;
padding-right: 20rpx;
padding-top: 12rpx;
padding-bottom: 12rpx; font-size: 28rpx; color: #FFFFFF;" @click="gotoMember()">我的会员</view>
</view>
</view>
<view style="background-color: white; border-radius: 10rpx;
margin-left: 34rpx; margin-right: 34rpx;
padding-left: 20rpx ; padding-right: 20rpx; margin-top: 10%; align-self: center;">
<view class="qh-list-c" @click="gotoMyOrder()">
<view style="display: flex;">
<image src="../../static/mine_icons/mine_order_icon.png" style="width: 50rpx; height: 50rpx;" />
<text class="list-text">我的订单</text>
</view>
<image src="../../static/mine_icons/mine_right_arrow.png" style="width: 40rpx; height: 40rpx;" />
</view>
<view class="qh-list-c" @click="gotoSuggest()">
<view style="display: flex;">
......@@ -189,9 +175,8 @@
},
onShow: function() {
var userInfo = uni.getStorageSync("userInfo")
if (userInfo) {
loginHelper.login(userInfo);
var userInfo = loginHelper.getUserInfo()
if (userInfo) {
this.headIcon = userInfo.FaceImageCode
this.userName = userInfo.NickName
} else {
......
......@@ -29,9 +29,7 @@ export default {
},
onReady() {
let appInfo = app_config.app_info;
let token = uni.getStorageSync('uni_cookie');
let header = {
'Cookie': token,
AppVersion: encodeURI(JSON.stringify(appInfo))
}
// #ifdef APP-PLUS
......
......@@ -29,9 +29,7 @@ export default {
},
onReady() {
let appInfo = app_config.app_info;
let token = uni.getStorageSync('uni_cookie');
let header = {
'Cookie': token,
AppVersion: encodeURI(JSON.stringify(appInfo))
}
// #ifdef APP-PLUS
......
......@@ -32,7 +32,8 @@
</view>
</view>
<button style="background-color: white; margin: 35rpx; color: #469bf4;" @click="bindLogout()"> {{ this.hasLogin ? "退出登录" : '登陆/注册' }}</button>
<button style="background-color: white; margin: 35rpx; color: #469bf4;" @click="bindLogout()">
{{ this.hasLogin ? "退出登录" : '登陆/注册' }}</button>
</view>
</template>
......@@ -53,12 +54,14 @@
data() {
return {
app_config,
hasLogin : false,
updateInfoStr : "已是最新版本",
versionData : null,
versionName : app_config.app_info.AppName,
}
},
onShow() {
this.hasLogin = loginHelper.hasLogin()
console.log("onShow");
this.updateVersion();
},
......@@ -67,7 +70,7 @@
{
loginHelper.logout();
uni.reLaunch({
url: '/pages/user/user'
url: '/pages/mine/mine'
})
}
},
......
<template>
<view>
<z-swiper ref="zSwiper" v-model="match_list" @slideChange="onSwiperChange" :options="options">
<z-swiper-item v-for="(item, index) in match_list" :key="item.Id" :custom-style="{width:'46%'}">
<view class="match-info" :style="{'background-color': (select_index === index)
? '#25CDAA' : '#ffffff'}" @click="change_match(item, index)">
<z-swiper-item v-for="(item, index) in match_list" :key="item.Id" :custom-style="{width:'48%'}">
<view :class="select_index === index ? 'match-info' : 'match-info-unselect'"
@click="change_match(item, index)">
<view style="display: flex; justify-content: space-between; width: 100%;">
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}" @click="change_match(item, index)">{{deal_match_time(item)}}</text>
? '#ffffff' : '#777777'}" @click="change_match(item, index)">{{deal_match_time(item)}}</text>
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}" @click="change_match(item, index)">{{item.MatchState}}</text>
? '#ffffff' : '#777777'}" @click="change_match(item, index)">{{item.MatchState}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.HostTeam.LogoFullPath" />
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}">{{item.HostName}}</text>
? '#ffffff' : '#333333'}">{{item.HostName}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.GuestTeam.LogoFullPath" />
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#101010'}">{{item.GuestName}}</text>
? '#ffffff' : '#333333'}">{{item.GuestName}}</text>
</view>
</view>
</z-swiper-item>
......@@ -28,19 +28,13 @@
<z-swiper ref="zSwiperInfo" v-model="match_list" @slideChange="onSwiperInfoChange" :options="info_options">
<z-swiper-item v-for="(info_item, index) in match_list" :key="info_item.Id">
<MatchEventStatistics ref="child" v-if="info_item.MatchState !== '未'" :data_info="info_item" />
<MatchEventAnalysis ref="child" v-else="info_item.MatchState === '未'" :data_info="info_item" />
<z-swiper-item v-for="(info_item, index) in match_list" :key="info_item.Id">
<MatchEventAnalysis ref="child" :data_info="info_item" />
</z-swiper-item>
</z-swiper>
</view>
</template>
......@@ -51,6 +45,8 @@
import MatchEventStatistics from "@/components/match-list/MatchEventStatistics.vue";
import MatchEventAnalysis from "@/components/match-list/MatchEventAnalysis.vue";
import common from '../../utils/common';
export default {
components: {
MatchEventStatistics,
......@@ -73,11 +69,13 @@
},
methods: {
onSwiperChange(swiper) {
this.select_index = swiper.activeIndex
this.select_index = swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
},
onSwiperInfoChange(swiper) {
this.select_index = swiper.activeIndex
this.select_index = swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
},
deal_match_time(match) {
......@@ -87,23 +85,8 @@
return match.GameName + ' ' + bj_time.substring(5, 16)
},
deal_viewpoint(item) {
var info = []
if (item) {
let viewpoint = JSON.parse(item.JcInfo)
if (viewpoint) {
info.push(...viewpoint.HostGood)
info.push(...viewpoint.HostBad)
info.push(...viewpoint.GuestGood)
info.push(...viewpoint.GuestBad)
}
}
return info
},
change_match(item, index) {
this.$refs.zSwiperInfo.swiper.slideTo(index); //切换到第一个slide,速度为1秒
}
},
async onLoad() {
......@@ -113,7 +96,7 @@
count
matchs {
Id
InfoId
InfoId
YiqiuMatchId
LotteryId
IssueName
......@@ -144,18 +127,17 @@
let matchs = infoRes.data.liveScore.matchs
if (this.match_list.length > 0) {
this.match_list.length = 0
}
for (let m of matchs) {
if (m.YiqiuMatchId) {
this.match_list.push(m)
}
}
for (let m of matchs) {
if (m.SportsInfoCount > 0) {
m.Info = this.deal_viewpoint(m)
this.match_list.push(m)
}
}
if (this.match_list.length > 0) {
this.select_index = 0
}
console.log("==========>>>", this.match_list)
console.log("==========>>>", JSON.stringify(this.match_list))
}
}
</script>
......@@ -163,15 +145,30 @@
<style>
.match-info {
display: flex;
flex-direction: column;
min-width: 400;
margin-top: 32rpx;
margin-left: 32rpx;
padding: 24rpx;
background: linear-gradient(135deg, #34C592 0%, #287E60 100%);
border-radius: 16rpx;
}
.match-info-unselect {
display: flex;
flex-direction: column;
margin: 10rpx;
padding: 10rpx;
background-color: #25CDAA;
margin-top: 32rpx;
min-width: 400;
margin-left: 32rpx;
padding: 24rpx;
border-radius: 16rpx;
border: 2rpx solid #04764E;
}
.team-logo {
width: 20px;
height: 20px;
width: 40rpx;
height: 40rpx;
border-radius: 10px;
}
......@@ -205,14 +202,17 @@
}
.title-text-one {
font-size: 13px;
color: white;
font-size: 28rpx;
color: white;
white-space: nowrap;
font-weight: 400;
}
.title-text-two {
font-size: 18rpx;
font-size: 36rpx;
margin-left: 6px;
color: white;
font-weight: 700;
color: white;
white-space: nowrap;
font-weight: 500;
}
</style>
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

13.6 KB | 宽: | 高:

51.6 KB | 宽: | 高:

static/loading_icon.gif
static/loading_icon.gif
static/loading_icon.gif
static/loading_icon.gif
  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.5 KB | 宽: | 高:

636.4 KB | 宽: | 高:

static/logo.png
static/logo.png
static/logo.png
static/logo.png
  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.2 KB | 宽: | 高:

1.4 KB | 宽: | 高:

static/tab_icons/follow01.png
static/tab_icons/follow01.png
static/tab_icons/follow01.png
static/tab_icons/follow01.png
  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.2 KB | 宽: | 高:

1.1 KB | 宽: | 高:

static/tab_icons/follow02.png
static/tab_icons/follow02.png
static/tab_icons/follow02.png
static/tab_icons/follow02.png
  • 两方对比
  • 交换覆盖
  • 透明覆盖
......@@ -5,11 +5,10 @@ if (uni) {
export default {
app: "150414001",
secret: "5C7B92CF77E1535BE41F45A0F04057EA",
ppolicy_app : 'http://www.qianhaiyilan.cn/ppolicy_app.html' ,// 隐私政策
ppolicy_user : 'http://www.qianhaiyilan.cn/ppolicy_user.html' , // 用户协议
ppolicy_app : 'http://www.qianhaiyilan.cn/ppolicy_jqty.html' ,// 隐私政策
ppolicy_user : 'http://www.qianhaiyilan.cn/ppolicy_jqty.html' , // 用户协议
server_url: {
app_host: "https://app.ydniu.com/",
app_host: "http://81.71.82.24/",
// 192.168.1.97
//app_host:"http://192.168.1.97:4000/",
},
......
const common = {
statusBarH: 0,
info_config: null,
info_config: null
}
export default common
import loginHelper from './loginHelper.js';
import utils from './utils.js';
let Follow_List = null
const followHelper = {
getFollowList() {
if (!loginHelper.hasLogin()) {
return []
}
if(!Follow_List) {
Follow_List = []
let temp_data = uni.getStorageSync('follow_list_key')
console.log(temp_data)
if (temp_data.length > 0) {
let temp_list = JSON.parse(temp_data)
Follow_List.push(...temp_list)
}
for (var i = 0; i < Follow_List.length; i++) {
var item = Follow_List[i]
if (utils.diffCurrentDay(item.MatchTime) >= 7) {
Follow_List.splice(i, 1);
}
}
let follow_str = JSON.stringify(Follow_List)
uni.setStorageSync('follow_list_key', follow_str)
}
console.log(Follow_List)
return Follow_List;
},
async follow_action(match) {
if (!loginHelper.hasLogin()) {
uni.showToast({
icon: "none",
title: "未登录",
});
return []
}
var index_flag = Follow_List.some(function(item, index) {
if (item.Id === match.Id) {
Follow_List.splice(index, 1);
}
return item.Id === match.Id;
})
let follow_str = JSON.stringify(Follow_List)
await uni.setStorageSync('follow_list_key', follow_str)
if (index_flag) {
uni.showToast({
title: "已取关"
})
match.isFollow = false
} else {
Follow_List.push(match)
match.isFollow = true
uni.showToast({
title: "已关注"
})
}
return Follow_List;
}
}
export default followHelper
......@@ -3,13 +3,13 @@ let info = null;
const loginHelper = {
login(userInfo, appToken) {
console.log("login" + hasLogin)
console.log("login" + userInfo + "appToken:" + appToken)
uni.setStorageSync("appToken", appToken);
uni.setStorageSync("userName", userInfo.NickName);
uni.setStorageSync("headIcon", userInfo.FaceImageCode);
uni.setStorageSync('userInfo', userInfo)
hasLogin = true;
info = userInfo;
info = userInfo;
},
logout() {
console.log("logout" + hasLogin)
......@@ -21,6 +21,12 @@ const loginHelper = {
info = null;
},
hasLogin() {
info = uni.getStorageSync('userInfo')
if(info) {
hasLogin = true
} else {
hasLogin = false
}
return hasLogin;
},
getDefaultHeadIcon() {
......@@ -31,6 +37,9 @@ const loginHelper = {
info = uni.getStorageSync('userInfo')
}
return info;
},
getAppToken() {
return uni.getStorageSync("appToken");
}
}
......
......@@ -32,6 +32,15 @@ const utils = {
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
},
dateFormatHoursMinutes(time) {
let date = new Date(time);
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
return hours + ":" + minutes;
},
dateFormatYear(time) {
let date = new Date(time);
let year = date.getFullYear();
......@@ -43,6 +52,17 @@ const utils = {
return year + "-" + month + "-" + day;
},
dateFormatYear2(time) {
let date = new Date(time);
let year = date.getFullYear() % 100;
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
// 拼接
return year + "/" + month + "/" + day;
},
getTimeByISO(time) {
let temp_data = new Date(time).toJSON()
let bj_time = new Date(+new Date(temp_data) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(
......@@ -138,6 +158,22 @@ const utils = {
break;
}
return result
},
diffCurrentDay(time) {
// 将时间字符串转换为 Date 对象
var targetDate = new Date(time);
// 获取当前时间
const currentDate = new Date();
// 计算当前时间与目标时间之间的差距(以毫秒为单位)
const timeDifference = currentDate.getTime() - targetDate.getTime();
// 计算差距的天数
const daysDifference = Math.abs(Math.floor(timeDifference / (1000 * 3600 * 24)));
return daysDifference
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!