Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
e7bd6163
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
Star
91
Fork
164
代码
文件
提交
分支
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 @@
...
@@ -8,14 +8,14 @@
.uni-title-text
{
.uni-title-text
{
font-size
:
30
rpx
;
font-size
:
30
rpx
;
font-weight
:
500
;
font-weight
:
bold
;
}
}
.uni-subtitle-text
{
.uni-subtitle-text
{
margin-top
:
10
rpx
;
margin-top
:
10
rpx
;
font-size
:
24
rpx
;
font-size
:
24
rpx
;
color
:
#888
;
color
:
#888
;
font-weight
:
500
;
font-weight
:
bold
;
}
}
.uni-common-mb
{
.uni-common-mb
{
...
...
pages/component/checkbox/checkbox.uvue
浏览文件 @
e7bd6163
...
@@ -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"
...
...
pages/component/list/detail/detail.uvue
浏览文件 @
e7bd6163
...
@@ -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 {
...
...
pages/component/list/list.uvue
浏览文件 @
e7bd6163
...
@@ -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
pages/component/radio/radio.uvue
浏览文件 @
e7bd6163
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录