From a1fb6cd3c3b8a48da4f9393e09718da04f51a373 Mon Sep 17 00:00:00 2001
From: DESKTOP-CVS3R96\我恁爹 <11>
Date: Tue, 15 Nov 2022 09:58:00 +0800
Subject: [PATCH] 11111
---
src/page/home/home.vue | 155 +++++++++++++++++++++++++++++----------------------
1 files changed, 89 insertions(+), 66 deletions(-)
diff --git a/src/page/home/home.vue b/src/page/home/home.vue
index 56be2e9..66896d7 100644
--- a/src/page/home/home.vue
+++ b/src/page/home/home.vue
@@ -30,16 +30,16 @@
</div>
<!-- 公告 -->
<van-skeleton title :row="1" :loading="loading" />
- <div class="announcement" v-if="!loading&&close">
+ <div class="announcement" v-if="!loading && close">
<div class="an_content" @click="$router.push('/newGg')">
<div class="an_left_icon">
<img :src="Announcement" alt />
</div>
- <div class="an_right_message " >
+ <div class="an_right_message ">
<div class="animate">
{{ artList.artTitle }}
</div>
-
+
</div>
</div>
</div>
@@ -47,10 +47,10 @@
<!-- 排行入门 -->
<van-skeleton title :row="2" :loading="loading" />
- <div class="navs" v-if="!loading&&close">
+ <div class="navs" v-if="!loading && close">
<div class="navs_content">
- <div class="chacha" @click="close=false">
+ <div class="chacha" @click="close = false">
<div>
<img :src="clear" />
</div>
@@ -74,7 +74,7 @@
<div class="focus_on" v-if="!loading">
<div class="fo_content">
<div class="top_title">
- {{ '最多关注' }}
+ {{ $t('hj5') }}
</div>
<div class="fo_banner">
<van-swipe class="fo_my-swipe" :autoplay="0" indicator-color="white" @change="onChange">
@@ -109,7 +109,8 @@
</div>
</van-swipe-item> -->
<van-swipe-item v-for="(item, index) in proData" :key="index">
- <div class="item_cont" :class="idx!=2?'item_conts':''" v-for="(item2, idx) in proData[currentIndex]" :key="idx" @click="goDetail(item2)">
+ <div class="item_cont" :class="idx != 2 ? 'item_conts' : ''"
+ v-for="(item2, idx) in proData[currentIndex]" :key="idx" @click="goDetail(item2)">
<div class="top_fo">
<div class="title">
{{ item2.name }}
@@ -126,13 +127,15 @@
<div class="bottom_fo">
<div class="title">
<span class="numberid" style="margin-right: 0.12rem;">{{ item2.symbol }}</span>
- <div v-for="(items,indexs) in Number(item2.pnum.slice(0, 1))" style="width: 0.4rem;height: 0.4rem;display: flex;">
- <img v-if="indexs<3" :src="Huo" alt style="width: 0.4rem;height: 0.4rem;" />
- </div>
-
+ <!-- <div v-for="(items, indexs) in Number(item2.pnum.slice(0, 1))"
+ style="width: 0.4rem;height: 0.4rem;display: flex;">
+ <img v-if="indexs < 3" :src="Huo" alt style="width: 0.4rem;height: 0.4rem;" />
+ </div> -->
+
</div>
<div class="numbers" :class="item2.floatPoint > 0 ? 'gree' : 'redd'">
- <span class="point">{{ item2.pnum
+ <img :src="Huo" alt style="width: 0.4rem;height: 0.4rem;" />
+ <span class="point" style="height: 0.4rem;">{{ item2.pnum
}}</span>
</div>
<div class="percentage">
@@ -154,10 +157,10 @@
<div class="news-tab">
<mt-navbar v-model="news">
<mt-tab-item id="tab_0">
- <span class="tab-name">新闻</span>
+ <span class="tab-name">{{ $t('hj6') }}</span>
</mt-tab-item>
<mt-tab-item id="tab_1">
- <span class="tab-name">经济</span>
+ <span class="tab-name">{{ $t('hj7') }}</span>
</mt-tab-item>
<mt-tab-item id="tab_2">
<span class="tab-name">7×24</span>
@@ -182,13 +185,13 @@
</div>
</div>
</mt-tab-container-item>
- <mt-tab-container-item id="tab_1" >
+ <mt-tab-container-item id="tab_1">
<div class="news-content">
<div class="item-out" v-for="(item, inde) in newsContent4" :key="inde" @click="$router.push({
path: '/newPage', query: {
listid: item.id
}
- })" >
+ })">
<div class="item-times">{{ item.addTime | gettime }}</div>
<div class="titContent" style="-webkit-box-orient: vertical;">{{ item.title }}</div>
</div>
@@ -210,13 +213,10 @@
</div>
</div>
<!-- tab -->
-
<GoToLogin v-show="isGoTo" />
</div>
</template>
-
<script>
-
import AllList from "@/page/list/list-all";
import HomeList from "./components/home-list";
import Echart from "./components/echart.vue";
@@ -236,13 +236,12 @@
import banner3 from "@/assets/img/b3.png";
// import indexData from "./data.json";
import GoToLogin from '@/page/home/components/GoLogin.vue';
-
export default {
components: {
HomeList,
AllList,
GoToLogin,
- Echart
+ Echart,
},
props: {},
data() {
@@ -256,7 +255,7 @@
Huo,
is_login: false,
loading: true,
- close:true,
+ close: true,
proData: [], // 分割好的数据
currentIndex: 0,
bannerImgsArr: [{
@@ -269,22 +268,21 @@
announcementMess: "20202/10 - 交易时间安排",
navsArr: [{
img: Tops,
- title: "行情"
+ title: this.$t('hj1'),
},
{
img: Rumen,
- title: "持仓"
+ title: this.$t('hj2'),
},
{
img: Xuexi,
- title: "新股"
+ title: this.$t('hj3'),
},
{
img: Guanyu,
- title: "我的"
- }
- ],
- artList:[],
+ title: this.$t('hj4'),
+ }],
+ artList: [],
news: "tab_0",
newsContent1: [],
newsContent2: [],
@@ -292,11 +290,21 @@
newsContent4: [],
onlineService: "",
isGoTo: false,
- bannerList:[]
+ bannerList: [],
+ userInfo: [],
};
},
methods: {
-
+ async getUserInfo() {
+ // 获取用户信息
+ let data = await api.getUserInfo();
+ if (data.status === 0) {
+ // 判断是否登录
+ this.$store.state.userInfo = data.data;
+ this.userInfo = data.data;
+ } else {
+ }
+ },
getHuo() {
//123随机
var num = Math.floor(Math.random() * 3 + 1);
@@ -313,6 +321,10 @@
}
},
goDetail(item) {
+ if (this.userInfo.length == 0) {
+ this.$store.commit('dialogVisible', true);
+ return;
+ }
this.$router.push({
path: "/kline",
query: {
@@ -332,41 +344,49 @@
return 0;
}
},
- goJy(index){
+ goJy(index) {
+ if (this.userInfo.length == 0) {
+ this.$store.commit('dialogVisible', true);
+ return;
+ }
switch (index) {
case 0:
- this.$router.push('/list');
+ this.$router.push('/trading-list');
break;
- case 1:
- this.$router.push('/orderlist');
+ case 1:
+ this.$router.push('/warehouse');
break;
- case 2:
- //this.$router.push();
+ case 2:
+ this.$router.push({ path: '/trading-list', query: { listid: 3 } });
break;
- case 3:
+ case 3:
this.$router.push('/user');
break;
-
+
default:
break;
}
+ if (navigator.vibrate) {
+ // 支持
+ navigator.vibrate([55]);
+ }
},
- async getBanner () {
+ async getBanner() {
// 获取显示的banner
let result = await api.getBannerByPlat({ platType: 'm' })
if (result.status === 0) {
this.bannerList = result.data
} else {
- this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': result.msg});
+ this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': result.msg });
}
},
goOnline() {
window.location.href = this.onlineService;
},
- async getArtList(){
+ async getArtList() {
let data = await api.getArtList();
- if(data.status == 0){
+ if (data.status == 0) {
this.artList = data.data.list[0];
}
},
@@ -376,7 +396,7 @@
if (data.status === 0) {
this.onlineService = data.data.onlineService
} else {
- this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
+ this.$store.commit('elAlertShow', { 'elAlertShow': true, 'elAlertText': data.msg });
}
},
async getStock() {
@@ -425,7 +445,7 @@
},
handleSearchClick() {
//this.loading = !this.loading;
- this.$router.push({path:"/trading-list",query:{type:1}});
+ this.$router.push({ path: "/trading-list", query: { type: 1 } });
}
},
filters: {
@@ -463,6 +483,7 @@
this.ProcessData();
},
mounted() {
+ this.getUserInfo();
this.getInfoSite();
this.getNewsList(1);
this.getNewsList(2);
@@ -471,11 +492,11 @@
this.getArtList();
this.getBanner()
-
+
setInterval(() => {
- if(window.localStorage.getItem('USERTOKEN')){
+ if (window.localStorage.getItem('USERTOKEN')) {
this.isGoTo = false;
- }else{
+ } else {
this.isGoTo = !this.isGoTo
}
}, 10000);
@@ -606,7 +627,7 @@
align-content: center;
font-size: 0.29rem;
white-space: nowrap;
- overflow: hidden;
+ overflow: hidden;
// text-overflow:ellipsis;
}
}
@@ -733,7 +754,7 @@
/deep/.van-swipe__indicator--active {
width: 0.35rem !important;
border-radius: 0.23rem;
- background-color: #aec7ec!important;
+ background-color: #aec7ec !important;
}
.fo_banner {
@@ -790,7 +811,7 @@
.numberid {
font-size: 0.28rem;
display: flex;
-
+
line-height: 0.5rem;
}
@@ -816,7 +837,8 @@
text-align: center;
justify-content: center;
}
- .percentage span{
+
+ .percentage span {
height: 0.5rem;
line-height: 0.5rem;
}
@@ -978,19 +1000,20 @@
border: 0.0513rem solid #41AC75;
color: #41AC75;
}
+
.animate {
-padding-left: 20px;
+ padding-left: 20px;
-font-size: 0.29rem;
+ font-size: 0.29rem;
-color: #000;
+ color: #000;
-display: inline-block;
+ display: inline-block;
-white-space: nowrap;
+ white-space: nowrap;
-animation: 10s wordsLoop linear infinite normal;
+ animation: 10s wordsLoop linear infinite normal;
}
@@ -998,21 +1021,21 @@
@keyframes wordsLoop {
-0% {
+ 0% {
transform: translateX(100%);
-webkit-transform: translateX(100%);
-}
+ }
-100% {
+ 100% {
transform: translateX(-100%);
-webkit-transform: translateX(-100%);
-}
+ }
}
@@ -1020,21 +1043,21 @@
@-webkit-keyframes wordsLoop {
-0% {
+ 0% {
transform: translateX(100%);
-webkit-transform: translateX(100%);
-}
+ }
-100% {
+ 100% {
transform: translateX(-100%);
-webkit-transform: translateX(-100%);
-}
+ }
}
</style>
--
Gitblit v1.9.3