提交 e7bd6163 编写于 作者: Y yurj26

chore: update css

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