|
|
@@ -1,16 +1,26 @@
|
|
|
<template>
|
|
|
<div class="integral">
|
|
|
<div class="left-area">
|
|
|
- <img class="wuding" :src="`${config.cdn_url}images/wuding2.png`" alt="">
|
|
|
+ <img class="wuding" :src="`${config.cdn_url}images/wuding2.png`" alt="" />
|
|
|
<ul>
|
|
|
- <li @click="onClickItem(item)" :class="{ active: item.id == active.id }" v-for="item in list" :key="item.id">
|
|
|
+ <li
|
|
|
+ @click="onClickItem(item)"
|
|
|
+ :class="{ active: item.id == active.id }"
|
|
|
+ v-for="item in list"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
<div class="avatar">
|
|
|
- <img :src="item.avatarUrl" alt="">
|
|
|
+ <img :src="item.avatarUrl" alt="" />
|
|
|
</div>
|
|
|
<span>{{ item.nickName }}</span>
|
|
|
|
|
|
<div class="like">
|
|
|
- <img :src="`${config.cdn_url}images/icon_like_${item.id == active.id ? 'active' : 'normal'}.png`" alt="">
|
|
|
+ <img
|
|
|
+ :src="`${config.cdn_url}images/icon_like_${
|
|
|
+ item.id == active.id ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
<span>{{ item.star }}</span>
|
|
|
</div>
|
|
|
<div class="b-line"></div>
|
|
|
@@ -18,64 +28,94 @@
|
|
|
</ul>
|
|
|
<div class="menu">
|
|
|
<div @click="type = 'hot'">
|
|
|
- <img class="hot" :src="`${config.cdn_url}images/btn_hot_${type == 'hot' ? 'active' : 'normal'}.png`" alt="">
|
|
|
+ <img
|
|
|
+ class="hot"
|
|
|
+ :src="`${config.cdn_url}images/btn_hot_${
|
|
|
+ type == 'hot' ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
</div>
|
|
|
<div @click="type = 'plaza'">
|
|
|
- <img class="plaza" :src="`${config.cdn_url}images/btn_square_${type == 'plaza' ? 'active' : 'normal'}.png`"
|
|
|
- alt="">
|
|
|
+ <img
|
|
|
+ class="plaza"
|
|
|
+ :src="`${config.cdn_url}images/btn_square_${
|
|
|
+ type == 'plaza' ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="center-area" @click="toggleLike">
|
|
|
- <img :src="`${config.cdn_url}images/icon_like2_${current.isLike ? 'active' : 'normal'}.png`" alt="">
|
|
|
+ <img
|
|
|
+ :src="`${config.cdn_url}images/icon_like2_${
|
|
|
+ current.isLike ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
<span>{{ current.num }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, watch } from "vue"
|
|
|
-import http from '@/api/http.js'
|
|
|
+import { ref, reactive, watch, unref } from "vue";
|
|
|
+import http from "@/api/http.js";
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-let list = ref([])
|
|
|
-const active = ref({})
|
|
|
-const type = ref('hot')
|
|
|
+let list = ref([]);
|
|
|
+const active = ref({});
|
|
|
+const type = ref("hot");
|
|
|
const current = ref({
|
|
|
isLike: false,
|
|
|
num: 0,
|
|
|
- id: null
|
|
|
-})
|
|
|
-
|
|
|
+ id: null,
|
|
|
+});
|
|
|
|
|
|
const getList = async () => {
|
|
|
let result = (await http.get(`cms/model/getSort/${type.value}`)).data;
|
|
|
- list.value = result.data
|
|
|
-}
|
|
|
+ list.value = result.data;
|
|
|
+};
|
|
|
+
|
|
|
+let ifrDom = document.querySelector("#ifr");
|
|
|
+
|
|
|
+const postMsg = (source, data) => {
|
|
|
+ ifrDom.contentWindow.postMessage(
|
|
|
+ {
|
|
|
+ source,
|
|
|
+ data,
|
|
|
+ },
|
|
|
+ "*"
|
|
|
+ );
|
|
|
+};
|
|
|
|
|
|
const onClickItem = (item) => {
|
|
|
- active.value = item
|
|
|
- getLikeStatus(item)
|
|
|
-}
|
|
|
+ active.value = item;
|
|
|
+ getLikeStatus(item);
|
|
|
+
|
|
|
+ // 切换模型
|
|
|
+ postMsg("ShowUserData", unref(item.id));
|
|
|
+};
|
|
|
|
|
|
const getLikeStatus = async (item) => {
|
|
|
let result = (await http.get(`cms/model/starCheck/${item.id}`)).data.data;
|
|
|
// console.log('-----',result);
|
|
|
- current.value.isLike = result
|
|
|
- current.value.num = item.star
|
|
|
- current.value.id = item.id
|
|
|
-}
|
|
|
+ current.value.isLike = result;
|
|
|
+ current.value.num = item.star;
|
|
|
+ current.value.id = item.id;
|
|
|
+};
|
|
|
|
|
|
const toggleLike = async () => {
|
|
|
- if (!current.value.id) return
|
|
|
- let url = current.value.isLike ? `cms/model/starDel/${current.value.id}` : `cms/model/star/${current.value.id}`
|
|
|
- await http.get(url)
|
|
|
- current.value.isLike = !current.value.isLike
|
|
|
- current.value.num = current.value.num + (current.value.isLike ? +1 : -1)
|
|
|
- active.value.star = current.value.num
|
|
|
-}
|
|
|
+ if (!current.value.id) return;
|
|
|
+ let url = current.value.isLike
|
|
|
+ ? `cms/model/starDel/${current.value.id}`
|
|
|
+ : `cms/model/star/${current.value.id}`;
|
|
|
+ await http.get(url);
|
|
|
+ current.value.isLike = !current.value.isLike;
|
|
|
+ current.value.num = current.value.num + (current.value.isLike ? +1 : -1);
|
|
|
+ active.value.star = current.value.num;
|
|
|
+};
|
|
|
|
|
|
// const like = async (item)=>{
|
|
|
|
|
|
@@ -85,15 +125,15 @@ const toggleLike = async () => {
|
|
|
// list.value = result.data
|
|
|
// }
|
|
|
|
|
|
-
|
|
|
-watch(type, () => {
|
|
|
- getList()
|
|
|
-}, {
|
|
|
- immediate: true
|
|
|
-})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+watch(
|
|
|
+ type,
|
|
|
+ () => {
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ }
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -113,12 +153,12 @@ watch(type, () => {
|
|
|
width: 120%;
|
|
|
}
|
|
|
|
|
|
- >ul {
|
|
|
+ > ul {
|
|
|
height: calc(100% - 8px);
|
|
|
overflow-y: auto;
|
|
|
overflow-x: hidden;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
color: #fff;
|
|
|
font-size: 18px;
|
|
|
font-weight: bold;
|
|
|
@@ -132,18 +172,18 @@ watch(type, () => {
|
|
|
.avatar {
|
|
|
width: 30px;
|
|
|
height: 30px;
|
|
|
- border: 1px solid #FFFFFF;
|
|
|
+ border: 1px solid #ffffff;
|
|
|
border-radius: 4px;
|
|
|
margin-right: 10px;
|
|
|
overflow: hidden;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
font-size: 14px;
|
|
|
text-overflow: ellipsis;
|
|
|
@@ -158,19 +198,24 @@ watch(type, () => {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
font-size: 12px;
|
|
|
font-weight: normal;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.b-line {
|
|
|
- background: linear-gradient(116deg, rgba(99, 84, 61, 0) 0%, rgba(99, 84, 61, 0.3) 50%, rgba(99, 84, 61, 0) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 116deg,
|
|
|
+ rgba(99, 84, 61, 0) 0%,
|
|
|
+ rgba(99, 84, 61, 0.3) 50%,
|
|
|
+ rgba(99, 84, 61, 0) 100%
|
|
|
+ );
|
|
|
width: 80%;
|
|
|
height: 1px;
|
|
|
position: absolute;
|
|
|
@@ -187,7 +232,11 @@ watch(type, () => {
|
|
|
|
|
|
&.active {
|
|
|
position: relative;
|
|
|
- background: linear-gradient(90deg, #961014 0%, rgba(150, 16, 20, 0) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 90deg,
|
|
|
+ #961014 0%,
|
|
|
+ rgba(150, 16, 20, 0) 100%
|
|
|
+ );
|
|
|
|
|
|
.like {
|
|
|
color: $font-active-color;
|
|
|
@@ -202,7 +251,7 @@ watch(type, () => {
|
|
|
width: 18%;
|
|
|
z-index: -1;
|
|
|
|
|
|
- >div {
|
|
|
+ > div {
|
|
|
width: 100%;
|
|
|
margin-top: 20px;
|
|
|
position: relative;
|
|
|
@@ -210,7 +259,7 @@ watch(type, () => {
|
|
|
&::before {
|
|
|
width: 1px;
|
|
|
height: 24px;
|
|
|
- content: '';
|
|
|
+ content: "";
|
|
|
display: inline-block;
|
|
|
position: absolute;
|
|
|
left: 50%;
|
|
|
@@ -219,11 +268,10 @@ watch(type, () => {
|
|
|
background: $font-active-color;
|
|
|
}
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -234,11 +282,11 @@ watch(type, () => {
|
|
|
transform: translateX(-50%);
|
|
|
width: 50px;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
}
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
position: absolute;
|
|
|
right: 0;
|
|
|
top: -2px;
|
|
|
@@ -250,7 +298,7 @@ watch(type, () => {
|
|
|
border-radius: 50%;
|
|
|
overflow: hidden;
|
|
|
display: inline-block;
|
|
|
- background: #C1A97A;
|
|
|
+ background: #c1a97a;
|
|
|
color: #fff;
|
|
|
box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.3);
|
|
|
}
|