Browse Source

bug fix + 活动页面

dev
kola-web 7 hours ago
parent
commit
957454fa40
  1. 31
      src/components/popup/index.scss
  2. BIN
      src/images/icon47.png
  3. BIN
      src/images/icon48.png
  4. 16
      src/pages/health/index.ts
  5. 4
      src/pages/heartForm/index.ts
  6. 26
      src/pages/hotTopicDetail/index.scss
  7. 44
      src/pages/hotTopicDetail/index.wxml
  8. 4
      src/pages/index/index.ts
  9. 15
      src/pages/login/index.scss
  10. 4
      src/pages/login/index.ts
  11. 43
      src/pages/login/index.wxml
  12. 4
      src/pages/my/index.ts
  13. 2
      src/pages/myWall/index.wxml
  14. 36
      src/pages/wall/index.scss
  15. 8
      src/pages/wall/index.wxml
  16. 16
      src/pages/wallDetail/index.scss
  17. 3
      src/pages/wallDetail/index.wxml
  18. 13
      src/pages/wallForm/index.scss
  19. 56
      src/pages/wallForm/index.ts
  20. 61
      src/pages/wallForm/index.wxml
  21. 11
      src/utils/tools.wxs

31
src/components/popup/index.scss

@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
font-size: 36rpx;
color: rgba(100, 116, 139, 1);
line-height: 52rpx;
white-space: nowrap;
}
.code {
margin: 70rpx auto 0;
@ -148,35 +149,9 @@ @@ -148,35 +149,9 @@
text-align: center;
}
.code {
margin: 52rpx auto 0;
display: block;
width: 348rpx;
height: 348rpx;
}
}
}
}
.popup5 {
.popup-container {
.container {
padding-top: 572rpx;
width: 690rpx;
height: 720rpx;
border-radius: 42rpx;
box-sizing: border-box;
.btn {
display: block;
margin: 0 auto;
width: 626rpx;
height: 96rpx;
font-size: 40rpx;
color: rgba(255, 255, 255, 1);
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(270deg, #439fc7 0%, #2f82a9 100%);
border-radius: 24rpx 24rpx 24rpx 24rpx;
width: 100%;
height: 100%;
}
}
}

BIN
src/images/icon47.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

BIN
src/images/icon48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

16
src/pages/health/index.ts

@ -437,10 +437,18 @@ Page({ @@ -437,10 +437,18 @@ Page({
},
}).then(() => {
if (!userInfo.isHeartRateTips) {
this.setData({
popupShow: true,
popupType: 'popup1',
})
if (userInfo.isFollow == 1) {
wx.showToast({
icon: 'none',
title: '设置成功,我们将在每周五下午7点提醒您记录',
duration: 3000,
})
} else {
this.setData({
popupShow: true,
popupType: 'popup1',
})
}
}
this.setData({
['userInfo.isHeartRateTips']: !userInfo.isHeartRateTips,

4
src/pages/heartForm/index.ts

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
import dayjs from "dayjs"
const app = getApp<IAppOption>()
Page({
@ -11,7 +13,7 @@ Page({ @@ -11,7 +13,7 @@ Page({
id: '',
heartRate: '',
recordDateTime: '',
recordDateTime: dayjs().format("YYYY-MM-DD HH:mm"),
datetimePickerShow: false,
datetimeValue: Date.now(),
maxDate: Date.now(),

26
src/pages/hotTopicDetail/index.scss

@ -113,23 +113,45 @@ page { @@ -113,23 +113,45 @@ page {
line-height: 32rpx;
box-sizing: border-box;
}
.content {
.title {
margin-top: 32rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.content {
margin-top: 12rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
line-height: 52rpx;
.c-topic {
display: inline;
font-size: 32rpx;
color: rgba(47, 130, 169, 1);
}
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.tags {
margin-top: 24rpx;
display: flex;
flex-wrap: wrap;
flex-wrap: nowrap;
gap: 16rpx;
overflow-x: auto;
overflow-y: hidden;
&::-webkit-scrollbar {
display: none;
}
.tag {
flex-shrink: 0;
padding: 0 24rpx;
height: 48rpx;
font-size: 24rpx;

44
src/pages/hotTopicDetail/index.wxml

@ -29,13 +29,24 @@ @@ -29,13 +29,24 @@
<view class="date">{{item.publishTime}}</view>
</view>
</view>
<view class="hot" wx:if="{{item.isRecommend===1}}" style="background: url('{{imageUrl}}bg11.png?t={{Timestamp}}') no-repeat top center/100%">热门推荐</view>
<view
class="hot"
wx:if="{{item.isRecommend===1}}"
style="background: url('{{imageUrl}}bg11.png?t={{Timestamp}}') no-repeat top center/100%"
>
热门推荐
</view>
<view class="title">{{item.title}}</view>
<view class="content">
<view class="c-topic" wx:for="{{item.topics}}" wx:key="topicId" wx:for-item="topic">#{{topic.topicName}}</view>
<view class="c-topic" wx:for="{{item.topics}}" wx:key="topicId" wx:for-item="topic">
#{{topic.topicName}}
</view>
{{item.content}}
</view>
<view class="tags" wx:if="{{item.categories && item.categories.length}}">
<view class="tag" wx:for="{{item.categories}}" wx:key="categoryId" wx:for-item="cate">{{cate.categoryName}}</view>
<view class="tag" wx:for="{{item.categories}}" wx:key="categoryId" wx:for-item="cate">
{{cate.categoryName}}
</view>
</view>
<!-- 单图 -->
<image
@ -59,13 +70,26 @@ @@ -59,13 +70,26 @@
<image class="play-icon" src="{{imageUrl}}icon17.png?t={{Timestamp}}"></image>
</view>
<!-- 多图/视频混合 -->
<view
wx:if="{{item.attachments.length>1}}"
class="photo9"
>
<view class="p-item" wx:for="{{item.attachments}}" wx:for-item="att" wx:key="id" catch:tap="handlePreviewMedia" data-index="{{index}}" data-attachments="{{item.attachments}}">
<image class="p-img" mode="aspectFill" src="{{att.attachmentType==2 ? att.videoCoverUrl : att.attachmentUrl}}"></image>
<image class="play-icon" wx:if="{{att.attachmentType==2}}" src="{{imageUrl}}icon17.png?t={{Timestamp}}"></image>
<view wx:if="{{item.attachments.length>1}}" class="photo9">
<view
class="p-item"
wx:for="{{item.attachments}}"
wx:for-item="att"
wx:key="id"
catch:tap="handlePreviewMedia"
data-index="{{index}}"
data-attachments="{{item.attachments}}"
>
<image
class="p-img"
mode="aspectFill"
src="{{att.attachmentType==2 ? att.videoCoverUrl : att.attachmentUrl}}"
></image>
<image
class="play-icon"
wx:if="{{att.attachmentType==2}}"
src="{{imageUrl}}icon17.png?t={{Timestamp}}"
></image>
</view>
</view>
<view class="footer">

4
src/pages/index/index.ts

@ -10,7 +10,7 @@ Page({ @@ -10,7 +10,7 @@ Page({
} as any,
userInfo: {} as any,
days: 0,
days: 1,
cateList: [] as Array<{ CateId: string; CateName: string }>,
activeCateId: '',
picTextList: [] as Array<any>,
@ -125,7 +125,7 @@ Page({ @@ -125,7 +125,7 @@ Page({
method: 'GET',
url: '?r=psvt/patient/my-info',
}).then((res: any) => {
let days = 0
let days = 1
if (res.firstOpenTime) {
const first = new Date(res.firstOpenTime.replace(/-/g, '/'))
const now = new Date()

15
src/pages/login/index.scss

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
}
.container {
margin-top: 440rpx;
padding: 74rpx 40rpx;
padding: 54rpx 40rpx;
background-color: #fff;
border-radius: 32rpx 32rpx 0 0;
.tip {
@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
height: 390rpx;
}
.phone-btn {
margin: 124rpx 0 0;
margin: 144rpx 0 0;
height: 96rpx;
line-height: 96rpx;
text-align: center;
@ -46,7 +46,14 @@ @@ -46,7 +46,14 @@
margin-top: 56rpx;
font-size: 32rpx;
color: rgba(47, 130, 169, 1);
text-align: center;
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
.icon {
width: 24rpx;
height: 40rpx;
}
}
.form {
margin-top: 32rpx;
@ -70,8 +77,8 @@ @@ -70,8 +77,8 @@
}
.code {
margin-left: 24rpx;
padding: 0 32rpx;
flex-shrink: 0;
width: 212rpx;
height: 68rpx;
border-radius: 24rpx;
font-size: 28rpx;

4
src/pages/login/index.ts

@ -6,7 +6,7 @@ Page({ @@ -6,7 +6,7 @@ Page({
menuTop: 0,
checked: false,
codeText: '发送验证码',
codeText: '验证码',
showTel: false,
mobile: '',
@ -58,7 +58,7 @@ Page({ @@ -58,7 +58,7 @@ Page({
clearInterval(timer as number)
timer = null
this.setData({
codeText: '发送验证码',
codeText: '验证码',
})
}
}, 1000)

43
src/pages/login/index.wxml

@ -1,19 +1,23 @@ @@ -1,19 +1,23 @@
<view class="page" style="background: url('{{imageUrl}}bg1.png?t={{Timestamp}}') no-repeat top center/100%;padding-top: {{menuTop}}px;">
<view
class="page"
style="background: url('{{imageUrl}}bg1.png?t={{Timestamp}}') no-repeat top center/100%;padding-top: {{menuTop}}px;"
>
<image class="logo" src="{{imageUrl}}logo1.png?t={{Timestamp}}"></image>
<view class="container">
<view class="tip">请先阅读并同意相关协议。立即加入后,我们将为您提供更匹配的科普内容与服务支持。</view>
<button wx:if="{{checked}}" class="phone-btn" open-type="getPhoneNumber" bindgetphonenumber="handleWxSubmit">
<image class="icon" src="{{imageUrl}}icon1.png?t={{Timestamp}}"></image>
手机号快捷登录
</button>
<button wx:else class="phone-btn" bind:tap="handleWxCheck">
<image class="icon" src="{{imageUrl}}icon1.png?t={{Timestamp}}"></image>
手机号快捷登录
</button>
<view class="switch" bind:tap="handleShowTel">或输入手机号</view>
<block wx:if="{{!showTel}}">
<button wx:if="{{checked}}" class="phone-btn" open-type="getPhoneNumber" bindgetphonenumber="handleWxSubmit">
<image class="icon" src="{{imageUrl}}icon1.png?t={{Timestamp}}"></image>
手机号快捷登录
</button>
<button wx:else class="phone-btn" bind:tap="handleWxCheck">
<image class="icon" src="{{imageUrl}}icon1.png?t={{Timestamp}}"></image>
手机号快捷登录
</button>
</block>
<view class="form" wx:if="{{showTel}}">
<view class="row">
<input type="number" model:value="{{mobile}}" class="input" placeholder="请输入手机号" />
<input type="number" focus="{{showTel}}" model:value="{{mobile}}" class="input" placeholder="请输入手机号" />
</view>
<view class="row">
<input type="number" model:value="{{code}}" class="input" placeholder="请输入验证码" />
@ -22,22 +26,21 @@ @@ -22,22 +26,21 @@
<view wx:if="{{checked}}" class="submit" bind:tap="handleSubmit">立即加入</view>
<view wx:else class="submit" bind:tap="handleWxCheck">立即加入</view>
</view>
<view class="switch" wx:if="{{showTel}}" bind:tap="handleShowTel">
<image class="icon" src="{{imageUrl}}icon47.png?t={{Timestamp}}"></image>
手机号一键注册
</view>
<view class="switch" wx:else bind:tap="handleShowTel">或输入手机号</view>
<view class="argument">
<view class="a-col">
<checkbox class="check" checked="{{checked}}" bind:tap="handleCheck">
<view class="check-content">
我已阅读并同意
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=2">
《用户协议》
</view>
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=2">《用户协议》</view>
以及
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=1">
《隐私政策》
</view>
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=1">《隐私政策》</view>
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=3">
《法律声明》
</view>
<view class="link" catch:tap="handleLink" data-url="/doc/pages/doc1/index?active=3">《法律声明》</view>
并同意平台基于服务需要收集和使用我的必要个人信息。
</view>
</checkbox>

4
src/pages/my/index.ts

@ -3,7 +3,7 @@ const app = getApp() @@ -3,7 +3,7 @@ const app = getApp()
Page({
data: {
userInfo: {} as any,
days: 0,
days: 1,
},
onShow() {
app.waitLogin({ type: 1 }).then(() => {
@ -15,7 +15,7 @@ Page({ @@ -15,7 +15,7 @@ Page({
method: 'GET',
url: '?r=psvt/patient/my-info',
}).then((res) => {
let days = 0
let days = 1
if (res.firstOpenTime) {
const first = new Date(res.firstOpenTime.replace(/-/g, '/'))
const now = new Date()

2
src/pages/myWall/index.wxml

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
</view>
</view>
<view class="date">{{item.dateText}}</view>
<view class="rejected" wx:if="{{item.postStatus === 3 && item.rejectReason}}">
<view class="rejected" wx:if="{{item.postStatus == 3 && item.rejectReason}}">
<image class="icon" src="{{imageUrl}}icon39.png?t={{Timestamp}}"></image>
<view class="blod">驳回原因:</view>
{{item.rejectReason}}

36
src/pages/wall/index.scss

@ -106,7 +106,7 @@ page { @@ -106,7 +106,7 @@ page {
padding: 36rpx 32rpx 12rpx;
border-radius: 32rpx;
border: 2rpx solid #f1f5f9;
background: rgba(255, 255, 255, 0.70);
background: rgba(255, 255, 255, 0.7);
box-shadow: 0 16rpx 48rpx -8rpx rgba(0, 99, 132, 0.06);
box-sizing: border-box;
.user {
@ -133,33 +133,55 @@ page { @@ -133,33 +133,55 @@ page {
}
.hot {
position: absolute;
top: 0;
right: 0;
top: -12rpx;
right: 36rpx;
padding: 8rpx 0 0 44rpx;
font-size: 28rpx;
color: rgba(255, 255, 255, 1);
width: 180rpx;
height: 68rpx;
width: 104rpx;
height: 48rpx;
line-height: 32rpx;
box-sizing: border-box;
}
.content {
.title {
margin-top: 32rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.content {
margin-top: 12rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
line-height: 52rpx;
.c-topic {
display: inline;
font-size: 32rpx;
color: rgba(47, 130, 169, 1);
}
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.tags {
margin-top: 24rpx;
display: flex;
flex-wrap: wrap;
flex-wrap: nowrap;
gap: 16rpx;
overflow-x: auto;
overflow-y: hidden;
&::-webkit-scrollbar {
display: none;
}
.tag {
flex-shrink: 0;
padding: 0 24rpx;
height: 48rpx;
font-size: 24rpx;

8
src/pages/wall/index.wxml

@ -48,13 +48,13 @@ @@ -48,13 +48,13 @@
<view class="date">{{item.publishTime}}</view>
</view>
</view>
<view
class="hot"
wx:if="{{item.isRecommend===1}}"
style="background: url('{{imageUrl}}bg11.png?t={{Timestamp}}') no-repeat top center/100%"
>
热门推荐
</view>
style="background: url('{{imageUrl}}bg16.png?t={{Timestamp}}') no-repeat top center/100%"
></view>
<view class="title">{{item.title}}</view>
<view class="content">
<view
class="c-topic"

16
src/pages/wallDetail/index.scss

@ -61,10 +61,16 @@ page { @@ -61,10 +61,16 @@ page {
}
}
}
.content {
.title {
margin-top: 32rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
font-weight: bold;
}
.content {
margin-top: 12rpx;
font-size: 32rpx;
color: rgba(24, 28, 30, 1);
line-height: 52rpx;
.c-topic {
display: inline;
@ -75,9 +81,15 @@ page { @@ -75,9 +81,15 @@ page {
.tags {
margin-top: 24rpx;
display: flex;
flex-wrap: wrap;
flex-wrap: nowrap;
gap: 16rpx;
overflow-x: auto;
overflow-y: hidden;
&::-webkit-scrollbar {
display: none;
}
.tag {
flex-shrink: 0;
padding: 0 24rpx;
height: 48rpx;
font-size: 24rpx;

3
src/pages/wallDetail/index.wxml

@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
<view class="date">{{post.publishTime}}</view>
</view>
</view>
<view class="title">{{post.title}}</view>
<view class="content">
<view
class="c-topic"
@ -108,7 +109,7 @@ @@ -108,7 +109,7 @@
<view class="op" bind:tap="handleCommentLike" data-id="{{item.id}}" data-index="{{pIndex}}">
<image
class="icon"
src="{{imageUrl}}{{item.hasLiked ? 'icon9-1' : 'icon9'}}.png?t={{Timestamp}}"
src="{{imageUrl}}{{item.hasLiked ? 'icon9-active' : 'icon9'}}.png?t={{Timestamp}}"
></image>
<view class="num">{{item.likeCount || 0}}</view>
</view>

13
src/pages/wallForm/index.scss

@ -68,6 +68,19 @@ page { @@ -68,6 +68,19 @@ page {
.txa-place {
color: rgba(148, 163, 184, 1);
}
.limit {
margin-bottom: 30rpx;
margin-top: 32rpx;
display: flex;
align-items: center;
gap: 12rpx;
font-size: 28rpx;
color: rgba(186, 26, 26, 1);
.icon {
width: 32rpx;
height: 32rpx;
}
}
.topic-list {
display: flex;
flex-wrap: nowrap;

56
src/pages/wallForm/index.ts

@ -29,26 +29,26 @@ Page({ @@ -29,26 +29,26 @@ Page({
this.setData({ isEdit: true, editPostId: options.id })
}
app.waitLogin({ type: 1 }).then(() => {
this.getTopicList()
this.getCategoryList()
const listReady = Promise.all([this.getTopicList(), this.getCategoryList()])
if (this.data.isEdit) {
this.getPostDetail()
listReady.then(() => {
this.getPostDetail()
})
}
})
},
getTopicList() {
wx.ajax({
return wx.ajax({
method: 'GET',
url: '?r=psvt/topic/top-list',
}).then((res: any) => {
this.setData({
topicList: res.list || [],
selectedTopics: this.computeSelectedTopics(this.data.selectedTopicIds, res.list || []),
})
})
},
getCategoryList() {
wx.ajax({
return wx.ajax({
method: 'GET',
url: '?r=psvt/wall/index-category',
}).then((res: any) => {
@ -80,16 +80,20 @@ Page({ @@ -80,16 +80,20 @@ Page({
url: item.attachmentUrl || '',
}
})
// Build selectedTopics directly from the post detail, which already carries
// topicName. We must NOT rely on topicList.find() here because topic/top-list
// only returns the top-10 by weight, so a post's topics may not be in it.
const selectedTopics = (res.topics || []).map((t: any) => ({
id: Number(t.topicId),
topicName: t.topicName || '',
}))
this.setData({
title: res.title || '',
content: res.content || '',
visibility: res.visibility || 1,
selectedTopicIds: (res.topics || []).map((t: any) => t.topicId),
selectedTopics: this.computeSelectedTopics(
(res.topics || []).map((t: any) => t.topicId),
this.data.topicList,
),
selectedCategoryIds: (res.categories || []).map((c: any) => c.categoryId),
selectedTopicIds: selectedTopics.map((t: any) => t.id),
selectedTopics,
selectedCategoryIds: (res.categories || []).map((c: any) => Number(c.categoryId)),
fileList,
})
})
@ -103,27 +107,29 @@ Page({ @@ -103,27 +107,29 @@ Page({
handleTopicTap(e: any) {
const id = Number(e.currentTarget.dataset.id)
const selectedTopicIds = [...this.data.selectedTopicIds]
const selectedTopics = [...this.data.selectedTopics]
const index = selectedTopicIds.indexOf(id)
if (index > -1) {
selectedTopicIds.splice(index, 1)
selectedTopics.splice(index, 1)
} else {
selectedTopicIds.push(id)
const topic = this.data.topicList.find((t: any) => Number(t.id) === id)
if (topic) {
selectedTopicIds.push(id)
selectedTopics.push({ id: Number(topic.id), topicName: topic.topicName })
}
}
this.setData({
selectedTopicIds,
selectedTopics: this.computeSelectedTopics(selectedTopicIds, this.data.topicList),
})
this.setData({ selectedTopicIds, selectedTopics })
},
handleRemoveTopic(e: any) {
const id = Number(e.currentTarget.dataset.id)
const selectedTopicIds = this.data.selectedTopicIds.filter((tid) => tid !== id)
this.setData({
selectedTopicIds,
selectedTopics: this.computeSelectedTopics(selectedTopicIds, this.data.topicList),
})
},
computeSelectedTopics(ids: number[], list: any[]) {
return ids.map((id) => list.find((t) => String(t.id) === String(id))).filter((t) => t)
const index = this.data.selectedTopicIds.indexOf(id)
if (index === -1) return
const selectedTopicIds = [...this.data.selectedTopicIds]
const selectedTopics = [...this.data.selectedTopics]
selectedTopicIds.splice(index, 1)
selectedTopics.splice(index, 1)
this.setData({ selectedTopicIds, selectedTopics })
},
showTopicPopup() {
this.setData({ topicShow: true })

61
src/pages/wallForm/index.wxml

@ -13,9 +13,23 @@ @@ -13,9 +13,23 @@
>
<view class="form">
<view class="upload-wrap">
<uploadFile fileList="{{fileList}}" fileType="mix" maxNum="{{9}}" bind:setData="handleSetData" bind:deleteFile="handleDeleteFile"></uploadFile>
<uploadFile
fileList="{{fileList}}"
fileType="mix"
maxNum="{{9}}"
bind:setData="handleSetData"
bind:deleteFile="handleDeleteFile"
></uploadFile>
</view>
<input type="text" class="title" placeholder-class="title-place" placeholder="请添加标题" maxlength="{{50}}" value="{{title}}" bindinput="onTitleInput" />
<input
type="text"
class="title"
placeholder-class="title-place"
placeholder="请添加标题"
maxlength="{{50}}"
value="{{title}}"
bindinput="onTitleInput"
/>
<view class="selected-topics" wx:if="{{selectedTopics.length}}">
<view class="s-item" wx:for="{{selectedTopics}}" wx:key="id" bind:tap="handleRemoveTopic" data-id="{{item.id}}">
#{{item.topicName}}
@ -28,9 +42,20 @@ @@ -28,9 +42,20 @@
placeholder="分享你的经历、心得或问题,帮助更多病友..."
value="{{content}}"
bindinput="onContentInput"
maxlength="{{500}}"
></textarea>
<view class="limit" wx:if="{{content.length>=500}}">
<image class="icon" src="{{imageUrl}}icon48.png?t={{Timestamp}}"></image>
最多可输入500字
</view>
<view class="topic-list">
<view class="t-item" wx:for="{{topicList}}" wx:key="id" bind:tap="handleTopicTap" data-id="{{item.id}}">
<view
class="t-item"
wx:for="{{tools.excludeByIds(topicList, selectedTopicIds)}}"
wx:key="id"
bind:tap="handleTopicTap"
data-id="{{item.id}}"
>
<image class="icon" src="{{imageUrl}}icon18.png?t={{Timestamp}}"></image>
{{item.topicName}}
</view>
@ -40,7 +65,7 @@ @@ -40,7 +65,7 @@
<image class="icon" src="{{imageUrl}}icon18.png?t={{Timestamp}}"></image>
话题
</view>
<view class="total">{{content.length || 0}}/2000</view>
<view class="total">{{content.length || 0}}/500</view>
</view>
</view>
<view class="tag-module">
@ -49,7 +74,15 @@ @@ -49,7 +74,15 @@
内容标签
</view>
<view class="tag-wrap">
<view class="tag {{tools.include(item.id, selectedCategoryIds) ? 'active' : ''}}" wx:for="{{categoryList}}" wx:key="id" bind:tap="handleCategoryTap" data-id="{{item.id}}">{{item.categoryName}}</view>
<view
class="tag {{tools.include(item.id, selectedCategoryIds) ? 'active' : ''}}"
wx:for="{{categoryList}}"
wx:key="id"
bind:tap="handleCategoryTap"
data-id="{{item.id}}"
>
{{item.categoryName}}
</view>
</view>
</view>
<view class="view-module">
@ -59,14 +92,20 @@ @@ -59,14 +92,20 @@
</view>
<view class="v-wrap">
<view class="item {{visibility === 1 ? 'active' : ''}}" bind:tap="handleVisibilityChange" data-value="1">
<image class="icon" src="{{imageUrl}}{{visibility === 1 ? 'icon21-active' : 'icon21'}}.png?t={{Timestamp}}"></image>
<image
class="icon"
src="{{imageUrl}}{{visibility === 1 ? 'icon21-active' : 'icon21'}}.png?t={{Timestamp}}"
></image>
<view class="wrap">
<view class="name">公开</view>
<view class="content">所有用户可见</view>
</view>
</view>
<view class="item {{visibility === 2 ? 'active' : ''}}" bind:tap="handleVisibilityChange" data-value="2">
<image class="icon" src="{{imageUrl}}{{visibility === 2 ? 'icon22-active' : 'icon22'}}.png?t={{Timestamp}}"></image>
<image
class="icon"
src="{{imageUrl}}{{visibility === 2 ? 'icon22-active' : 'icon22'}}.png?t={{Timestamp}}"
></image>
<view class="wrap">
<view class="name">私密</view>
<view class="content">仅自己可见</view>
@ -93,7 +132,13 @@ @@ -93,7 +132,13 @@
<van-icon class="cross" name="cross" bind:tap="topicPopupClose" />
</view>
<view class="tp-list">
<view class="li {{tools.include(item.id, selectedTopicIds) ? 'active' : ''}}" wx:for="{{topicList}}" wx:key="id" bind:tap="handleTopicTap" data-id="{{item.id}}">
<view
class="li {{tools.include(item.id, selectedTopicIds) ? 'active' : ''}}"
wx:for="{{topicList}}"
wx:key="id"
bind:tap="handleTopicTap"
data-id="{{item.id}}"
>
<view class="num">{{index+1}}</view>
<view class="content"># {{item.topicName}}</view>
<view class="total">{{item.postCount}}篇帖子</view>

11
src/utils/tools.wxs

@ -7,7 +7,18 @@ function include(value, arr) { @@ -7,7 +7,18 @@ function include(value, arr) {
return false
}
function excludeByIds(list, ids) {
var result = []
for (var i = 0; i < list.length; i++) {
if (!include(list[i].id, ids)) {
result.push(list[i])
}
}
return result
}
module.exports = {
include: include,
inArray: include,
excludeByIds: excludeByIds,
}

Loading…
Cancel
Save