Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
e7bd6163
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5992
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e7bd6163
编写于
7月 05, 2023
作者:
Y
yurj26
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update css
上级
d05bb5c2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
82 addition
and
82 deletion
+82
-82
common/uni.css
common/uni.css
+2
-2
pages/component/checkbox/checkbox.uvue
pages/component/checkbox/checkbox.uvue
+1
-1
pages/component/list/detail/detail.uvue
pages/component/list/detail/detail.uvue
+16
-16
pages/component/list/list.uvue
pages/component/list/list.uvue
+62
-62
pages/component/radio/radio.uvue
pages/component/radio/radio.uvue
+1
-1
未找到文件。
common/uni.css
浏览文件 @
e7bd6163
...
...
@@ -8,14 +8,14 @@
.uni-title-text
{
font-size
:
30
rpx
;
font-weight
:
500
;
font-weight
:
bold
;
}
.uni-subtitle-text
{
margin-top
:
10
rpx
;
font-size
:
24
rpx
;
color
:
#888
;
font-weight
:
500
;
font-weight
:
bold
;
}
.uni-common-mb
{
...
...
pages/component/checkbox/checkbox.uvue
浏览文件 @
e7bd6163
...
...
@@ -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"
...
...
pages/component/list/detail/detail.uvue
浏览文件 @
e7bd6163
...
...
@@ -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 {
...
...
pages/component/list/list.uvue
浏览文件 @
e7bd6163
...
...
@@ -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
pages/component/radio/radio.uvue
浏览文件 @
e7bd6163
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录