Browse Source

bug处理

master
kola-web 3 months ago
parent
commit
cbdb2e5a14
  1. BIN
      src/images/icon-collection-active.png
  2. BIN
      src/images/icon-collection.png
  3. BIN
      src/images/icon-collection1.png
  4. 43
      src/pages/article/index.ts
  5. 4
      src/pages/article/index.wxml
  6. 8
      src/pages/collection/index.ts
  7. 4
      src/pages/collection/index.wxml
  8. 8
      src/pages/home/index.ts
  9. 1
      src/pages/login/index.json
  10. 11
      src/pages/login/index.ts
  11. 5
      src/pages/login/index.wxml
  12. 29
      src/pages/my/index.scss
  13. 2
      src/pages/my/index.wxml
  14. 8
      src/pages/search/index.ts
  15. 4
      src/pages/search/index.wxml
  16. 9
      src/pages/topic/index.scss

BIN
src/images/icon-collection-active.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/images/icon-collection.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 B

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/images/icon-collection1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

43
src/pages/article/index.ts

@ -18,6 +18,7 @@ Page({ @@ -18,6 +18,7 @@ Page({
toastShow: false,
toastType: 3,
currentTime: 0,
},
innerAudioContext: null as WechatMiniprogram.InnerAudioContext | null,
onLoad(options) {
@ -25,6 +26,11 @@ Page({ @@ -25,6 +26,11 @@ Page({
this.setData({
BookId: options.id,
});
if (options.cid) {
this.setData({
ChapterId: options.cid,
});
}
app.waitLogin(false, true).then(() => {
this.getChapterList();
this.getDetail();
@ -78,6 +84,7 @@ Page({ @@ -78,6 +84,7 @@ Page({
time,
});
}
this.handleView();
})
.catch(() => {
this.setData({
@ -86,6 +93,16 @@ Page({ @@ -86,6 +93,16 @@ Page({
});
});
},
handleView() {
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/add-browse-record',
data: {
BookId: this.data.BookId,
ChapterId: this.data.ChapterId,
},
});
},
handleDirectory() {
this.setData({
show: true,
@ -140,7 +157,7 @@ Page({ @@ -140,7 +157,7 @@ Page({
},
handlePlay() {
const { chapter, play } = this.data;
const { chapter, play, currentTime } = this.data;
if (this.innerAudioContext) {
if (play) {
this.innerAudioContext.stop();
@ -148,10 +165,8 @@ Page({ @@ -148,10 +165,8 @@ Page({
}
this.innerAudioContext.stop();
this.innerAudioContext.src = chapter.AudioUrl.url;
this.innerAudioContext.seek(currentTime);
this.innerAudioContext.play();
this.setData({
play: true,
});
const listener = () => {
if (this.innerAudioContext) {
const { currentTime, duration } = this.innerAudioContext;
@ -160,6 +175,8 @@ Page({ @@ -160,6 +175,8 @@ Page({
this.setData({
time,
progress,
currentTime,
play: true,
});
}
};
@ -169,7 +186,12 @@ Page({ @@ -169,7 +186,12 @@ Page({
play: false,
});
});
this.innerAudioContext.onStop(() => {
this.innerAudioContext.onPlay(() => {
this.setData({
play: true,
});
});
this.innerAudioContext.onPause(() => {
this.setData({
play: false,
});
@ -179,9 +201,10 @@ Page({ @@ -179,9 +201,10 @@ Page({
handlePause() {
if (this.innerAudioContext) {
this.innerAudioContext.pause();
this.setData({
play: false,
});
this.innerAudioContext.offTimeUpdate()
this.innerAudioContext.offEnded()
this.innerAudioContext.offPlay()
this.innerAudioContext.offPause()
}
},
formatTime(time: number) {
@ -199,8 +222,8 @@ Page({ @@ -199,8 +222,8 @@ Page({
this.setData({
toastShow: false,
});
wx.reLaunch({
url: '/pages/login/index',
wx.navigateTo({
url: '/pages/login/index?back=1',
});
},
});

4
src/pages/article/index.wxml

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
/>
</view>
<view class="rich">
<mp-html content="{{chapter.Content}}"></mp-html>
<mp-html content="{{chapter.Content}}" scroll-table="{{true}}"></mp-html>
</view>
<view
class="quick-article"
@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
bind:tap="handleSwitchDirectory"
data-id="{{item.Id}}"
>
{{item.ChapterName}}
{{index+1}}.{{item.ChapterName}}
</view>
</view>
</view>

8
src/pages/collection/index.ts

@ -81,6 +81,14 @@ Page({ @@ -81,6 +81,14 @@ Page({
handleBack() {
wx.navigateBack();
},
handleDetail(e) {
const { id } = e.currentTarget.dataset;
app.waitLogin(false, true).then(() => {
wx.navigateTo({
url: `/pages/article/index?id=${id}`,
});
});
},
});
export {};

4
src/pages/collection/index.wxml

@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
</van-nav-bar>
<view class="page" style="padding-top:{{menuButtonInfo.bottom}}px;">
<view class="card" wx:for="{{list}}" wx:key="Id">
<image class="photo" mode="aspectFill" src="{{imageUrl}}place.png?t={{Timestamp}}"></image>
<view class="card" wx:for="{{list}}" wx:key="Id" bind:tap="handleDetail" data-id="{{item.Id}}">
<image class="photo" mode="aspectFill" src="{{item.CoverUrl}}"></image>
<view class="c-container">
<view class="title">{{item.BookName}}</view>
<view class="type">{{item.CateName}}{{item.CateSecondName ? '/'+item.CateSecondName : ''}}</view>

8
src/pages/home/index.ts

@ -35,7 +35,7 @@ Page({ @@ -35,7 +35,7 @@ Page({
});
} else if (bannerItem.configType === '2') {
wx.navigateTo({
url: `/pages/article/index?id=${bannerItem.configContent}`,
url: `/pages/article/index?id=${bannerItem.configContentBookId}&cid=${bannerItem.configContent}`,
});
} else if (bannerItem.configType === '3') {
wx.navigateTo({
@ -76,10 +76,6 @@ Page({ @@ -76,10 +76,6 @@ Page({
this.setData({
feedbackCount: res,
});
wx.showToast({
icon: 'none',
title: '留言成功',
});
});
},
handleRemark() {
@ -94,7 +90,7 @@ Page({ @@ -94,7 +90,7 @@ Page({
}).then(() => {
wx.showToast({
title: '提交成功',
icon: 'success',
icon: 'none',
});
this.setData({
remark: '',

1
src/pages/login/index.json

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
{
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-popup": "@vant/weapp/popup/index"
}
}

11
src/pages/login/index.ts

@ -10,8 +10,14 @@ Page({ @@ -10,8 +10,14 @@ Page({
code: '',
protool: false,
codeText: '发送验证码',
back: false,
},
onLoad(options) {
this.setData({
back: options.back === '1',
});
},
onLoad() {},
getCode() {
if (timer) return;
const mobile = this.data.mobile;
@ -152,6 +158,9 @@ Page({ @@ -152,6 +158,9 @@ Page({
url: '/pages/home/index',
});
},
handleBack() {
wx.navigateBack();
},
});
export {};

5
src/pages/login/index.wxml

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
<van-nav-bar wx:if="{{back}}" title="" border="{{false}}" custom-style="background:transparent" bind:click-left="handleBack" fixed>
<van-icon name="arrow-left" slot="left" color="#000" size="46rpx" />
</van-nav-bar>
<view
class="page"
style="background: url('{{imageUrl}}login-bg.png?t={{Timestamp}}') no-repeat top center/100% 624rpx;padding-top:{{menuButtonInfo.bottom}}px;"
@ -37,7 +40,7 @@ @@ -37,7 +40,7 @@
<image class="icon" src="{{imageUrl}}icon-phone.png?t={{Timestamp}}"></image>
手机号快捷登录
</button>
<view class="visitor" bind:tap="handleVisitor">
<view class="visitor" bind:tap="handleVisitor" wx:if="{{!back}}">
游客访问
<van-icon name="arrow" />
</view>

29
src/pages/my/index.scss

@ -3,24 +3,9 @@ page { @@ -3,24 +3,9 @@ page {
}
.page {
background: linear-gradient(180deg, #d2f1fe 0%, rgba(244, 248, 249, 0) 100%) no-repeat top center / 100% 682rpx;
.no-login {
margin: 32rpx 62rpx 0;
display: flex;
align-items: center;
gap: 24rpx;
.avatar {
width: 160rpx;
height: 160rpx;
}
.name {
font-size: 40rpx;
color: #3795f7;
}
}
.login {
margin: 32rpx 62rpx 0;
display: flex;
align-items: center;
gap: 24rpx;
.upload {
flex-shrink: 0;
@ -61,6 +46,20 @@ page { @@ -61,6 +46,20 @@ page {
color: #999999;
}
}
.no-login {
margin: 32rpx 62rpx 0;
display: flex;
align-items: center;
gap: 24rpx;
.avatar {
width: 160rpx;
height: 160rpx;
}
.name {
font-size: 40rpx;
color: #3795f7;
}
}
.nav-list {
margin: 70rpx 32rpx 0;
padding: 0 30rpx;

2
src/pages/my/index.wxml

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<view class="user">
<view class="name">
{{userInfo.username || '---'}}health_1733302440913576
{{userInfo.username || '---'}}
<image class="icon" src="{{imageUrl}}icon-edit.png?t={{Timestamp}}" bind:tap="handleEditUser"></image>
</view>
<view class="tel">{{userInfo.telephone}}</view>

8
src/pages/search/index.ts

@ -64,6 +64,14 @@ Page({ @@ -64,6 +64,14 @@ Page({
handleBack() {
wx.navigateBack();
},
handleDetail(e) {
const { id } = e.currentTarget.dataset;
app.waitLogin(false, true).then(() => {
wx.navigateTo({
url: `/pages/article/index?id=${id}`,
});
});
},
});
export {};

4
src/pages/search/index.wxml

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
/>
</view>
<view class="tip" wx:if="{{list.length}}">以下为搜到的内容</view>
<view class="card" wx:for="{{list}}" wx:key="index">
<view class="card" wx:for="{{list}}" wx:key="index" bind:tap="handleDetail" data-id="{{item.Id}}">
<image class="photo" mode="aspectFill" src="{{item.CoverUrl}}"></image>
<view class="c-container">
<view class="title">{{item.ChapterName}}</view>
@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
<view class="stat">
<view class="s-item">
<image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image>
???
{{item.BrowseNum}}
</view>
</view>
</view>

9
src/pages/topic/index.scss

@ -36,9 +36,9 @@ page { @@ -36,9 +36,9 @@ page {
.content {
margin-top: 34rpx;
font-size: 40rpx;
font-size: 36rpx;
color: #222222;
line-height: 64rpx;
line-height: 1.4;
}
.btn {
@ -58,11 +58,8 @@ page { @@ -58,11 +58,8 @@ page {
}
.footer {
position: absolute;
bottom: 206rpx;
left: 0;
width: 100%;
padding: 0 88rpx;
padding: 30rpx 88rpx;
box-sizing: border-box;
display: flex;
align-items: center;

Loading…
Cancel
Save