提交 e7bd6163 编写于 作者: Y yurj26

chore: update css

上级 d05bb5c2
......@@ -8,14 +8,14 @@
.uni-title-text {
font-size: 30rpx;
font-weight: 500;
font-weight: bold;
}
.uni-subtitle-text {
margin-top: 10rpx;
font-size: 24rpx;
color: #888;
font-weight: 500;
font-weight: bold;
}
.uni-common-mb {
......
......@@ -40,7 +40,7 @@
</text>
</view>
</view>
<view class="uni-list">
<view class="uni-list uni-common-pl">
<checkbox-group @change="checkboxChange" class="checkbox-group">
<checkbox class="uni-list-cell uni-list-cell-pd checkbox" v-for="(item, index) in items"
:key="item.value" :value="item.value" :checked="item.checked"
......
......@@ -16,39 +16,39 @@
data() {
return {
htmlNodes: "",
pageVisible: false,
title: '',
cover : "",
pageVisible: false,
title: '',
cover : "",
post_id : "",
}
},
onLoad(event) {
onLoad(event) {
this.pageVisible = true;
this.post_id = event["post_id"] ?? "";
this.cover = event["cover"] ?? "";
this.title = event["title"] ?? "";
this.post_id = event["post_id"] ?? "";
this.cover = event["cover"] ?? "";
this.title = event["title"] ?? "";
this.getDetail();
},
onUnload() {
this.pageVisible = false;
},
onUnload() {
this.pageVisible = false;
},
methods: {
getDetail() {
uni.request({
url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + this.post_id,
success: (data) => {
success: (data) => {
if(this.pageVisible){
if (data.statusCode == 200) {
const result = data.data as UTSJSONObject
if (data.statusCode == 200) {
const result = data.data as UTSJSONObject
this.htmlNodes = result["content"] as string;
}
}
}
},
fail: () => {
console.log('fail');
}
});
},
},
}
}
</script>
......@@ -76,7 +76,7 @@
font-weight: 400;
line-height: 42rpx;
color: white;
z-index: 11;
/* z-index: 11; */
}
.article-meta {
......
......@@ -6,7 +6,7 @@
</view>
<list class="uni-list" refresher-enabled=true @refresherrefresh="onRefresherrefresh"
:refresher-triggered="refresherTriggered">
<cell v-for="(value, index) in listData" :key="index">
<cell v-for="(value, index) in listData" :key="index">
<view class="uni-list-cell" hover-class="uni-list-cell-hover" @click="goDetail(value)">
<view class="uni-media-list">
<image class="uni-media-list-logo" :src="value.cover"></image>
......@@ -19,20 +19,20 @@
</view>
</view>
</view>
</cell>
<cell class="footer"></cell>
</cell>
<cell class="footer"></cell>
</list>
</view>
</template>
<script>
import JSONObject from 'com.alibaba.fastjson.JSONObject';
import JSONObject from 'com.alibaba.fastjson.JSONObject';
import JSONArray from 'com.alibaba.fastjson.JSONArray';
type Banner = {
cover: string | null,
title: string | null,
post_id: string | null
title: string | null,
post_id: string | null
}
type Item = {
author_name: string,
......@@ -62,7 +62,7 @@
onLoad() {
this.pageVisible = true;
this.getBanner();
this.getList();
this.getList();
},
onUnload() {
this.pageVisible = false;
......@@ -75,17 +75,17 @@
uni.request({
url: 'https://unidemo.dcloud.net.cn/api/banner/36kr',
data: data,
success: data => {
if(this.pageVisible){
success: data => {
if(this.pageVisible){
this.refresherTriggered = false
if (data.statusCode == 200) {
let result = data.data as UTSJSONObject;
let result = data.data as UTSJSONObject;
this.banner = {
cover: result["cover"] as string,
title: result["title"] as string,
title: result["title"] as string,
post_id: result["post_id"] as string
} as Banner;
}
}
}
},
fail: (e) => {
......@@ -94,61 +94,61 @@
});
},
getList() {
let url = "https://unidemo.dcloud.net.cn/api/news?column=id,post_id,title,author_name,cover,published_at";
if (this.last_id != "") {
const minId = (this.last_id).toInt();
const time = new Date().getTime() + '';
const pageSize = 10;
url = url + "&minId=" + minId + "&time=" + time + "&pageSize=" + pageSize;
}
let url = "https://unidemo.dcloud.net.cn/api/news?column=id,post_id,title,author_name,cover,published_at";
if (this.last_id != "") {
const minId = (this.last_id).toInt();
const time = new Date().getTime() + '';
const pageSize = 10;
url = url + "&minId=" + minId + "&time=" + time + "&pageSize=" + pageSize;
}
uni.request({
url: url,
method:"GET",
success: (data) => {
success: (data) => {
if(this.pageVisible){
if (data.statusCode == 200) {
const result = data.data as UTSJSONObject
let list = this.setTime(result);
this.listData = list.concat(this.listData);
console.log("after ",this.listData.size);
this.last_id = listData[0].id + "";
this.refresherTriggered = false;
}
if (data.statusCode == 200) {
const result = data.data as UTSJSONObject
let list = this.setTime(result);
this.listData = list.concat(this.listData);
console.log("after ",this.listData.size);
this.last_id = listData[0].id + "";
this.refresherTriggered = false;
}
}
},
fail: (res) => {
fail: (res) => {
if(this.pageVisible){
console.log('fail', res);
this.refresherTriggered = false
console.log('fail', res);
this.refresherTriggered = false
}
}
});
},
goDetail(e: Item) {
const detail = e;
const post_id = detail.post_id;
const cover = detail.cover;
const title = detail.title;
goDetail(e: Item) {
const detail = e;
const post_id = detail.post_id;
const cover = detail.cover;
const title = detail.title;
uni.navigateTo({
url: 'pages/component/list/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
});
},
bannerClick(e:Banner){
const detail = e;
const post_id = detail.post_id;
const cover = detail.cover;
const title = detail.title;
uni.navigateTo({
url: 'pages/component/list/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
});
},
bannerClick(e:Banner){
const detail = e;
const post_id = detail.post_id;
const cover = detail.cover;
const title = detail.title;
uni.navigateTo({
url: 'pages/component/list/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
});
},
setTime(items: UTSJSONObject): Item[] {
let newItems = [] as Item[];
if (items.isJSONArray()) {
if (items.isJSONArray()) {
const array = items.toJSONObject() as JSONArray;
for (let i = array.size - 1; i >= 0; i--) {
const e = array.get(i) as JSONObject;
const e = array.get(i) as JSONObject;
newItems.push({
author_name: e["author_name"] as string,
cover: e["cover"] as string,
......@@ -161,11 +161,11 @@
}
return newItems;
},
onRefresherrefresh() {
if(this.pageVisible){
onRefresherrefresh() {
if(this.pageVisible){
this.refresherTriggered = true
this.getBanner();
this.getList();
this.getList();
}
}
}
......@@ -195,7 +195,7 @@
font-weight: 400;
line-height: 42rpx;
color: white;
z-index: 11;
/* z-index: 11; */
}
.uni-media-list {
......@@ -211,27 +211,27 @@
height: 140rpx;
}
.uni-media-list-body {
flex: 1;
.uni-media-list-body {
flex: 1;
padding-left: 15rpx;
justify-content: space-around;
}
.uni-media-list-text-top {
/* height: 74rpx; */
font-size: 28rpx;
lines:2;
font-size: 28rpx;
lines:2;
overflow: hidden;
}
.uni-media-list-text-bottom {
display: flex;
flex-direction: row;
flex-direction: row;
justify-content: space-between;
}
.uni-media-list-text {
color: #9D9D9F;
font-size: 25rpx;
}
.uni-media-list-text {
color: #9D9D9F;
font-size: 25rpx;
}
</style>
\ No newline at end of file
......@@ -34,7 +34,7 @@
</text>
</view>
</view>
<view class="uni-list">
<view class="uni-list uni-common-pl">
<radio-group @change="radioChange" class="radio-group">
<radio class="uni-list-cell uni-list-cell-pd radio" v-for="(item, index) in items" :key="item.value"
:class="index < items.length - 1 ? 'uni-list-cell-line': ''" :value="item.value"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册