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

4
src/pages/article/index.wxml

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

8
src/pages/collection/index.ts

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

4
src/pages/collection/index.wxml

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

8
src/pages/home/index.ts

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

1
src/pages/login/index.json

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

11
src/pages/login/index.ts

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

5
src/pages/login/index.wxml

@ -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 <view
class="page" class="page"
style="background: url('{{imageUrl}}login-bg.png?t={{Timestamp}}') no-repeat top center/100% 624rpx;padding-top:{{menuButtonInfo.bottom}}px;" style="background: url('{{imageUrl}}login-bg.png?t={{Timestamp}}') no-repeat top center/100% 624rpx;padding-top:{{menuButtonInfo.bottom}}px;"
@ -37,7 +40,7 @@
<image class="icon" src="{{imageUrl}}icon-phone.png?t={{Timestamp}}"></image> <image class="icon" src="{{imageUrl}}icon-phone.png?t={{Timestamp}}"></image>
手机号快捷登录 手机号快捷登录
</button> </button>
<view class="visitor" bind:tap="handleVisitor"> <view class="visitor" bind:tap="handleVisitor" wx:if="{{!back}}">
游客访问 游客访问
<van-icon name="arrow" /> <van-icon name="arrow" />
</view> </view>

29
src/pages/my/index.scss

@ -3,24 +3,9 @@ page {
} }
.page { .page {
background: linear-gradient(180deg, #d2f1fe 0%, rgba(244, 248, 249, 0) 100%) no-repeat top center / 100% 682rpx; 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 { .login {
margin: 32rpx 62rpx 0; margin: 32rpx 62rpx 0;
display: flex; display: flex;
align-items: center;
gap: 24rpx; gap: 24rpx;
.upload { .upload {
flex-shrink: 0; flex-shrink: 0;
@ -61,6 +46,20 @@ page {
color: #999999; 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 { .nav-list {
margin: 70rpx 32rpx 0; margin: 70rpx 32rpx 0;
padding: 0 30rpx; padding: 0 30rpx;

2
src/pages/my/index.wxml

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

8
src/pages/search/index.ts

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

4
src/pages/search/index.wxml

@ -23,7 +23,7 @@
/> />
</view> </view>
<view class="tip" wx:if="{{list.length}}">以下为搜到的内容</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> <image class="photo" mode="aspectFill" src="{{item.CoverUrl}}"></image>
<view class="c-container"> <view class="c-container">
<view class="title">{{item.ChapterName}}</view> <view class="title">{{item.ChapterName}}</view>
@ -33,7 +33,7 @@
<view class="stat"> <view class="stat">
<view class="s-item"> <view class="s-item">
<image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image> <image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image>
??? {{item.BrowseNum}}
</view> </view>
</view> </view>
</view> </view>

9
src/pages/topic/index.scss

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

Loading…
Cancel
Save