Browse Source

1.0页面开发

master
kola-web 2 weeks ago
parent
commit
67274c1b90
  1. 83
      src/components/global-toast/index.scss
  2. 39
      src/components/global-toast/index.ts
  3. 32
      src/components/global-toast/index.wxml
  4. 0
      src/components/popup/index.json
  5. 93
      src/components/popup/index.scss
  6. 57
      src/components/popup/index.ts
  7. 46
      src/components/popup/index.wxml
  8. BIN
      src/images/bg4.png
  9. BIN
      src/images/bg5.png
  10. BIN
      src/images/bg6.png
  11. BIN
      src/images/bg7.png
  12. BIN
      src/images/file-icon2.png
  13. BIN
      src/images/file-icon3.png
  14. BIN
      src/images/file-icon4.png
  15. BIN
      src/images/file-icon5.png
  16. BIN
      src/images/file-icon6.png
  17. BIN
      src/images/file-icon7.png
  18. BIN
      src/images/file-icon8.png
  19. BIN
      src/images/icon11.png
  20. 10
      src/pages/article/index.json
  21. 257
      src/pages/article/index.scss
  22. 349
      src/pages/article/index.ts
  23. 125
      src/pages/article/index.wxml
  24. 8
      src/pages/classify/index.json
  25. 137
      src/pages/classify/index.scss
  26. 200
      src/pages/classify/index.ts
  27. 102
      src/pages/classify/index.wxml
  28. 7
      src/pages/collection/index.json
  29. 60
      src/pages/collection/index.scss
  30. 94
      src/pages/collection/index.ts
  31. 40
      src/pages/collection/index.wxml
  32. 3
      src/pages/home/index.json
  33. 20
      src/pages/home/index.ts
  34. 8
      src/pages/home/index.wxml
  35. 1
      src/pages/information/index.wxml
  36. 32
      src/pages/informationDetail/index.ts
  37. 5
      src/pages/longPicture/index.json
  38. 3
      src/pages/longPicture/index.scss
  39. 17
      src/pages/longPicture/index.ts
  40. 1
      src/pages/longPicture/index.wxml
  41. 7
      src/pages/protocol/index.json
  42. 3
      src/pages/protocol/index.scss
  43. 10
      src/pages/protocol/index.ts
  44. 3
      src/pages/protocol/index.wxml
  45. 7
      src/pages/search/index.json
  46. 106
      src/pages/search/index.scss
  47. 78
      src/pages/search/index.ts
  48. 58
      src/pages/search/index.wxml
  49. 6
      src/pages/switchLogin/index.json
  50. 161
      src/pages/switchLogin/index.scss
  51. 95
      src/pages/switchLogin/index.ts
  52. 35
      src/pages/switchLogin/index.wxml
  53. 8
      src/pages/topic/index.json
  54. 219
      src/pages/topic/index.scss
  55. 146
      src/pages/topic/index.ts
  56. 100
      src/pages/topic/index.wxml
  57. 7
      src/pages/userInfo/index.json
  58. 56
      src/pages/userInfo/index.scss
  59. 59
      src/pages/userInfo/index.ts
  60. 42
      src/pages/userInfo/index.wxml

83
src/components/global-toast/index.scss

@ -1,83 +0,0 @@ @@ -1,83 +0,0 @@
.popup1 {
padding: 110rpx 0 0;
width: 651rpx;
height: 820rpx;
box-sizing: border-box;
.title {
font-size: 40rpx;
color: #222222;
font-weight: bold;
text-align: center;
}
.code {
margin: 48rpx auto 0;
display: block;
width: 304rpx;
height: 304rpx;
}
.tip {
margin-top: 40rpx;
font-size: 32rpx;
color: #65686c;
text-align: center;
}
.close {
margin: 120rpx auto 0;
display: block;
width: 72rpx;
height: 72rpx;
}
}
.popup3 {
.badge {
position: relative;
z-index: 1;
display: block;
margin: 0 auto;
width: 264rpx;
height: 264rpx;
}
.container {
margin-top: -130rpx;
padding: 136rpx 44rpx 0;
width: 622rpx;
height: 632rpx;
box-sizing: border-box;
background: linear-gradient(180deg, #e7f8ff 0%, #ffffff 100%);
border-radius: 36rpx 36rpx 36rpx 36rpx;
.title {
font-size: 48rpx;
color: #222222;
font-weight: bold;
text-align: center;
}
.tip {
margin-top: 24rpx;
font-size: 36rpx;
color: #65686c;
line-height: 56rpx;
}
.btn1 {
margin-top: 44rpx;
font-size: 36rpx;
color: #ffffff;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
.btn2 {
margin-top: 16rpx;
padding: 16rpx 32rpx;
font-size: 32rpx;
color: #3795f7;
text-align: center;
}
}
}

39
src/components/global-toast/index.ts

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
const _app = getApp<IAppOption>();
// pages/story/a.ts
Component({
/**
*
*/
properties: {
show: {
type: Boolean,
value: false,
},
type: {
type: Number,
value: 0,
},
params: {
type: Object,
value: {},
},
},
/**
*
*/
data: {},
/**
*
*/
methods: {
handleConform() {
this.triggerEvent('conform');
},
handleClose() {
this.triggerEvent('close');
},
},
});

32
src/components/global-toast/index.wxml

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
<van-popup show="{{ show }}" wx:if="{{type===1}}" custom-style="background: transparent;" bind:close="handleClose">
<view
class="popup1"
style="background: url('{{imageUrl}}popup1-bg.png?t={{Timestamp}}') no-repeat top center/100% 691rpx"
>
<view class="title">关注适中信息微信公众号</view>
<image class="code" src="{{imageUrl}}{{params.mpPicture}}?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="tip">长按识别二维码关注</view>
<image class="close" src="{{imageUrl}}icon-close.png?t={{Timestamp}}" bind:tap="handleClose"></image>
</view>
</van-popup>
<van-popup show="{{ show }}" wx:if="{{type===2}}" custom-style="background: transparent;" bind:close="handleClose">
<view class="popup1" style="background: url('{{imageUrl}}popup1-bg.png?t={{Timestamp}}') no-repeat top center/100%">
<view class="title">添加适中信息企业微信</view>
<image class="code" src="{{imageUrl}}{{params.qwPicture}}?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="tip">长按识别二维码添加</view>
<image class="close" src="{{imageUrl}}icon-close.png?t={{Timestamp}}" bind:tap="handleClose"></image>
</view>
</van-popup>
<van-popup show="{{ show }}" wx:if="{{type===3}}" custom-style="background: transparent;" bind:close="handleClose">
<view class="popup3">
<image class="badge" src="{{imageUrl}}badge.png?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="container">
<view class="title">该账号未开通阅读权益</view>
<view class="tip">此小程序暂时仅供经邀请的企业用户使用,请使用有权益的手机号登录。</view>
<view class="btn1" bind:tap="handleConform">换个手机号登录</view>
<view class="btn2" bind:tap="handleClose">取消</view>
</view>
</view>
</van-popup>

0
src/components/global-toast/index.json → src/components/popup/index.json

93
src/components/popup/index.scss

@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
.popup1 {
padding: 220rpx 0 0;
width: 630rpx;
box-sizing: border-box;
.container {
padding: 32rpx;
background: linear-gradient(180deg, #ebe4ff 0%, #ffffff 100%);
border-radius: 24rpx;
.user {
padding: 24rpx;
display: flex;
align-items: center;
border-radius: 24rpx;
background-color: #fff;
.avatar-wrapper {
flex-shrink: 0;
padding: 0;
margin: 0;
width: 108rpx;
height: 108rpx;
gap: 16rpx;
outline: none;
border: 2px solid #fff;
border-radius: 50%;
&::after {
border: none;
}
.avatar {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.wrap {
flex: 1;
padding-left: 24rpx;
.nickname {
font-size: 36rpx;
font-weight: bold;
color: rgba(1, 1, 5, 1);
}
.hostipal {
margin-top: 16rpx;
line-height: 1;
font-size: 28rpx;
color: rgba(173, 172, 178, 1);
.tag {
display: inline-block;
font-size: 24rpx;
color: rgba(255, 255, 255, 1);
padding: 2rpx 10rpx;
background: #8c75d0;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
}
}
}
}
}
.popup2 {
width: 590rpx;
height: 880rpx;
.p-img {
width: 100%;
height: 100%;
}
}
.popup3 {
width: 590rpx;
height: 880rpx;
.p-img {
width: 100%;
height: 100%;
}
}
.popup4 {
width: 590rpx;
height: 620rpx;
.p-img {
width: 100%;
height: 100%;
}
}
.close {
margin: 48rpx auto 0;
display: block;
width: 84rpx;
height: 84rpx;
}

57
src/components/popup/index.ts

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
import { wxPromiseWrapper } from 'XrFrame/core/utils'
const app = getApp<IAppOption>()
Component({
properties: {
show: {
type: Boolean,
value: false,
},
type: String,
params: {
type: Object,
value() {
return {}
},
},
},
data: {
popup1Check1: false,
imageUrl: app.globalData.imageUrl,
Timestamp: app.globalData.Timestamp,
},
methods: {
handleOk() {
const { type } = this.data
if (type === 'argument' && !this.data.popup1Check1) {
wx.showToast({
title: '请同意隐私政策',
icon: 'none',
})
return
}
this.triggerEvent('ok')
},
handleCancel() {
this.triggerEvent('cancel')
},
routerTo(e: any) {
const { url } = e.currentTarget.dataset
wx.navigateTo({
url,
})
},
handlePopup1Check1() {
if (this.data.popup1Check1) {
app.mpBehavior({ PageName: 'BTN_PATIENTPRIVACY' })
}
},
handleSelectStatus(e) {
const { status } = e.currentTarget.dataset
this.triggerEvent('ok', { type: 'selectStatusComplete', status })
},
},
})

46
src/components/popup/index.wxml

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
<van-popup
wx:if="{{show}}"
bind:click-overlay="handleCancel"
round
z-index="{{100000}}"
show="{{ true }}"
custom-style="background:transparent;"
position="{{params.position || 'center'}}"
safe-area-inset-bottom="{{false}}"
root-portal
>
<view
class="popup1"
style="background: url('/images/bg4.png') no-repeat top center/100% 304rpx"
wx:if="{{type==='popup1'}}"
>
<view class="container">
<view class="user">
<button class="avatar-wrapper">
<image
class="avatar"
src="https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567"
></image>
</button>
<view class="wrap">
<view class="nickname">XX医生</view>
<view class="hostipal">
北京天坛医院
<view class="tag">三甲</view>
</view>
</view>
</view>
</view>
</view>
<view class="popup2" wx:if="{{type==='popup2'}}">
<image class="p-img" src="/images/bg5.png" show-menu-by-longpress></image>
</view>
<view class="popup3" wx:if="{{type==='popup3'}}">
<image class="p-img" src="/images/bg6.png" show-menu-by-longpress></image>
</view>
<view class="popup4" wx:if="{{type==='popup4'}}">
<image class="p-img" src="/images/bg7.png" show-menu-by-longpress></image>
</view>
<image wx:if="{{params.close}}" class="close" src="/images/icon11.png" bind:tap="handleCancel"></image>
</van-popup>

BIN
src/images/bg4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

BIN
src/images/bg5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

BIN
src/images/bg6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

BIN
src/images/bg7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
src/images/file-icon2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/images/file-icon3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/images/file-icon4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/images/file-icon5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/images/file-icon6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/images/file-icon7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/images/file-icon8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/images/icon11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

10
src/pages/article/index.json

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
{
"navigationStyle": "default",
"navigationBarTitleText": "详情",
"usingComponents": {
"van-slider": "@vant/weapp/slider/index",
"van-popup": "@vant/weapp/popup/index",
"mp-html": "mp-html",
"global-toast":"/components/global-toast/index"
}
}

257
src/pages/article/index.scss

@ -1,257 +0,0 @@ @@ -1,257 +0,0 @@
.page {
padding: 48rpx 20rpx 200rpx;
.page-title {
font-size: 44rpx;
color: #222222;
font-weight: bold;
line-height: 48rpx;
}
.page-info {
display: flex;
align-items: center;
justify-content: space-between;
.page-date {
margin-top: 24rpx;
font-size: 28rpx;
color: #999999;
}
.view-num {
font-size: 28rpx;
color: #999999;
display: flex;
align-items: center;
gap: 12rpx;
.icon {
width: 28rpx;
height: 28rpx;
}
}
}
.audio-bar {
margin-top: 32rpx;
padding: 32rpx;
--slider-disabled-opacity: 1;
background-color: #f9fafb;
border-radius: 24rpx;
.a-header {
display: flex;
align-items: center;
justify-content: space-between;
.wrap {
line-height: 1;
.name {
font-size: 32rpx;
color: #000000;
font-weight: bold;
}
.date {
margin-top: 12rpx;
font-size: 24rpx;
color: #65686c;
}
}
.icon {
width: 64rpx;
height: 64rpx;
}
}
.progress {
display: block;
margin-top: 30rpx;
.custom-button {
position: relative;
flex-shrink: 0;
width: 20rpx;
height: 20rpx;
background: #ffffff;
border-radius: 50%;
border: 2rpx solid #3795f7;
box-sizing: border-box;
&::after {
content: '';
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 64rpx;
height: 64rpx;
background-color: transparent;
}
}
}
}
.rich {
margin-top: 32rpx;
}
.quick-article {
margin-top: 24rpx;
padding: 26rpx 32rpx;
background: #f9fafb;
line-height: 48rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
color: #3795f7;
font-size: 36rpx;
.label {
color: #3795f7;
}
}
.type {
margin-top: 48rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 24rpx;
.label {
font-size: 32rpx;
color: #999999;
}
.item {
padding: 6rpx 24rpx;
border-radius: 40rpx;
font-size: 32rpx;
color: #fff;
background-color: #3795f7;
}
}
.footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 30rpx 30rpx calc(30rpx + env(safe-area-inset-bottom));
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 -6rpx 32.8rpx rgba(0, 0, 0, 0.1);
background: #ffffff;
.item {
position: relative;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
font-size: 36rpx;
.icon {
width: 56rpx;
height: 56rpx;
}
.item-tip {
position: absolute;
left: 0;
top: -45rpx;
transform: translateY(-100%);
padding: 16rpx 32rpx;
font-size: 36rpx;
color: #ffffff;
background: rgba(0, 0, 0, 0.8);
border-radius: 8rpx 8rpx 8rpx 8rpx;
white-space: nowrap;
.close {
position: absolute;
top: -12rpx;
right: -12rpx;
width: 36rpx;
height: 36rpx;
}
&::after {
content: '';
position: absolute;
bottom: -10rpx;
left: 40%;
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
border-top: 12rpx solid rgba(0, 0, 0, 0.9);
}
}
}
}
}
.popup-directory {
.p-close-line {
padding: 36rpx 32rpx;
display: flex;
justify-content: flex-end;
.option {
font-size: 32rpx;
color: #999999;
.icon {
margin-left: 10rpx;
width: 24rpx;
height: 24rpx;
transform: rotate(180deg);
}
}
}
.p-title {
padding: 0 32rpx;
font-size: 44rpx;
color: #222222;
font-weight: bold;
}
.p-type {
padding: 32rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
.label {
font-size: 32rpx;
color: #999999;
}
.item {
border-radius: 40rpx;
font-size: 32rpx;
color: #3795f7;
}
}
.p-scroll {
max-height: 50vh;
font-size: 36rpx;
.row {
padding: 32rpx;
position: relative;
&::after {
position: absolute;
bottom: 0;
left: 32rpx;
content: '';
width: calc(100% - 64rpx);
height: 1px;
background-color: #f0f0f0;
}
&:last-of-type::after {
display: none;
}
&.current {
background: rgba(55, 149, 247, 0.06);
}
}
.place-row {
height: 120rpx;
}
}
}

349
src/pages/article/index.ts

@ -1,349 +0,0 @@ @@ -1,349 +0,0 @@
import { decryptData } from '@/utils/crypto';
const app = getApp<IAppOption>();
Page({
data: {
show: false,
BookId: '',
ChapterId: '',
chapterList: [],
book: {} as any,
chapter: {} as any,
prevAndNext: {} as any,
progress: 0,
url: 'http://m10.music.126.net/20241126110303/3f2481d2d6d50acd2009359539eadda0/ymusic/5353/0f0f/0358/d99739615f8e5153d77042092f07fd77.mp3',
play: false,
time: '00:00/00:00',
currentTime: 0,
drag: false,
chapterTip: false,
toastShow: false,
toastType: 3,
previewImg: true,
listener: false,
globalStop: false,
},
BackgroundAudioManager: null as WechatMiniprogram.BackgroundAudioManager | null,
onLoad(options) {
this.BackgroundAudioManager = wx.getBackgroundAudioManager();
this.setData({
BookId: options.id,
globalStop: this.BackgroundAudioManager.paused,
});
if (options.cid) {
this.setData({
ChapterId: options.cid,
});
}
const previewImg = !['mac', 'windows'].includes(wx.getDeviceInfo().platform);
this.setData({
previewImg,
});
app.waitLogin(false, true).then(() => {
this.getChapterList();
this.getDetail();
});
},
getChapterList() {
wx.ajax({
method: 'GET',
url: '?r=shizhong/book/chapter-list',
data: {
BookId: this.data.BookId,
},
}).then((res) => {
this.setData({
chapterList: res.list,
});
});
},
getDetail() {
wx.ajax({
method: 'GET',
url: '?r=shizhong/book/detail',
data: {
BookId: this.data.BookId,
ChapterId: this.data.ChapterId,
},
showMsg: false,
})
.then((res) => {
if (res.chapter.content_encrypt === 1) {
res.chapter.Content = decryptData(res.chapter.Content);
}
this.setData({
book: {
...res.book,
PublishDate: res.book.PublishTime.split(' ')[0],
},
chapter: res.chapter,
prevAndNext: {
prev: Array.isArray(res.prevAndNext.prev) ? null : res.prevAndNext.prev,
next: Array.isArray(res.prevAndNext.next) ? null : res.prevAndNext.next,
},
ChapterId: res.chapter.Id,
show: !this.data.ChapterId,
});
if (res.chapter.AudioUrl?.url) {
const time = `00:00/${this.formatTime(res.chapter.AudioUrl.duration)}`;
this.setData({
time,
});
}
wx.setNavigationBarTitle({
title: res.book.BookName,
});
this.handleView();
this.initBackgroundAudioManager();
})
.catch((err) => {
if (err.data.code === 403) {
this.setData({
toastShow: true,
toastType: 3,
});
}
});
},
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,
});
},
handleSwitchDirectory(e) {
const { id } = e.currentTarget.dataset;
this.setData({
ChapterId: id,
});
this.getDetail();
this.onClose();
},
onClose() {
const chapterTip = !wx.getStorageSync('chapterTip');
this.setData({
show: false,
chapterTip,
});
if (chapterTip) {
setTimeout(() => {
this.handleTipClsoe();
}, 5000);
}
},
handleCollect() {
const { Id } = this.data.book;
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/collect',
data: { BookId: Id },
}).then(() => {
wx.showToast({
title: '您已收藏这本书,可在我的页查看',
icon: 'none',
});
this.setData({
[`book.IsCollect`]: 1,
});
});
},
handleUnCollect() {
const { Id } = this.data.book;
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/cancel-collect',
data: { BookId: Id },
}).then(() => {
wx.showToast({
title: '取消收藏',
icon: 'none',
});
this.setData({
[`book.IsCollect`]: 0,
});
});
},
initBackgroundAudioManager() {
const { chapter } = this.data;
if (this.BackgroundAudioManager) {
if (this.BackgroundAudioManager.src === chapter.AudioUrl.url && !this.BackgroundAudioManager.paused) {
this.setData({
play: true,
});
this.backgroundAudioManagerListener();
} else {
this.backgroundAudioManagerListener();
this.setData({
play: false,
progress: 0,
currentTime: 0,
});
}
}
},
backgroundAudioManagerListener() {
const { chapter } = this.data;
if (!this.BackgroundAudioManager) return;
const timeUpdateListener = () => {
const isCurrent = this.BackgroundAudioManager?.src === chapter.AudioUrl.url;
if (this.BackgroundAudioManager && !this.data.drag && this.data.play && isCurrent) {
const { currentTime, duration } = this.BackgroundAudioManager;
const time = `${this.formatTime(currentTime)}/${this.formatTime(duration)}`;
const progress = (currentTime / duration) * 100;
this.setData({
time,
progress,
currentTime,
});
}
};
const endedListener = () => {
const time = `00:00/${this.formatTime(chapter.AudioUrl.duration)}`;
this.setData({
play: false,
progress: 0,
time,
currentTime: 0,
globalStop: true,
});
};
const playListener = () => {
const isCurrent = this.BackgroundAudioManager?.src === chapter.AudioUrl.url;
if (!isCurrent) return;
this.setData({
play: true,
});
};
const pauseListener = () => {
this.setData({
play: false,
});
};
const stopListener = () => {
const time = `00:00/${this.formatTime(chapter.AudioUrl.duration)}`;
this.setData({
play: false,
globalStop: true,
progress: 0,
time,
currentTime: 0,
});
};
this.BackgroundAudioManager.onTimeUpdate(timeUpdateListener);
this.BackgroundAudioManager.onEnded(endedListener);
this.BackgroundAudioManager.onPlay(playListener);
this.BackgroundAudioManager.onPause(pauseListener);
this.BackgroundAudioManager.onStop(stopListener);
this.setData({
listener: true,
});
},
handlePlay() {
const { chapter, currentTime, play, listener, globalStop } = this.data;
if (play) return;
if (this.BackgroundAudioManager) {
if (this.BackgroundAudioManager.src !== chapter.AudioUrl.url || globalStop) {
this.BackgroundAudioManager.title = chapter.ChapterName;
this.BackgroundAudioManager.coverImgUrl = chapter.CoverUrl;
this.BackgroundAudioManager.src = chapter.AudioUrl.url;
} else {
this.BackgroundAudioManager.play();
this.BackgroundAudioManager.seek(this.BackgroundAudioManager.currentTime || currentTime);
}
if (!listener) {
this.backgroundAudioManagerListener();
}
}
this.setData({
globalStop: false,
});
},
handlePause() {
const { play } = this.data;
if (this.BackgroundAudioManager && play) {
this.setData({
play: false,
});
this.BackgroundAudioManager.pause();
}
},
handleDragStart() {
this.setData({
drag: true,
});
},
handleDragEnd() {
this.setData({
drag: false,
});
if (this.data.play) {
this.BackgroundAudioManager?.seek(this.data.currentTime);
}
},
handleDrag(e: any) {
const current = e.detail.value;
const duration = this.BackgroundAudioManager?.duration || this.data.chapter.AudioUrl.duration;
const currentTime = (current / 100) * duration;
const time = `${this.formatTime(currentTime)}/${this.formatTime(duration)}`;
this.setData({
time,
currentTime,
});
},
formatTime(time: number) {
const minutes = Math.floor(time / 60);
const seconds = Math.floor(time % 60);
return `${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds}`;
},
handleAuthClose() {
this.setData({
toastShow: false,
});
wx.navigateBack({
fail() {
wx.reLaunch({
url: '/pages/classify/index',
});
},
});
},
handleAuthConform() {
const { BookId, ChapterId } = this.data;
const backPath = `/pages/article/index?id=${BookId}&cid=${ChapterId}`;
app.globalData.backPath = backPath;
wx.navigateTo({
url: '/pages/login/index?back=1',
});
},
handleType() {
wx.redirectTo({
url: `/pages/classify/index?id=${this.data.chapter.CateId}`,
});
},
handleTipClsoe() {
if (this.data.chapterTip) {
wx.setStorageSync('chapterTip', 'open');
}
this.setData({
chapterTip: false,
});
},
});
export {};

125
src/pages/article/index.wxml

@ -1,125 +0,0 @@ @@ -1,125 +0,0 @@
<page-meta page-style="{{ show ? 'overflow: hidden;' : '' }}" />
<view class="page">
<view class="page-title">{{chapter.ChapterName}}</view>
<view class="page-info">
<view class="page-date">{{book.PublishDate}}</view>
<!-- <view class="view-num">
<image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image>
{{~~book.OperateNum + ~~book.BrowseNum}}
</view> -->
</view>
<view class="audio-bar" wx:if="{{chapter.AudioUrl}}">
<view class="a-header">
<view class="wrap">
<view class="name">概要解读</view>
<view class="date">{{time}}</view>
</view>
<image
bind:tap="handlePause"
wx:if="{{play}}"
class="icon"
src="{{imageUrl}}icon-stop.png?t={{Timestamp}}"
></image>
<image bind:tap="handlePlay" wx:else class="icon" src="{{imageUrl}}icon-play.png?t={{Timestamp}}"></image>
</view>
<van-slider
class="progress"
custom-class="progress"
step="0.001"
value="{{progress}}"
bar-height="12rpx"
active-color="#3795F7"
inactive-color="#FFFFFF"
use-button-slot
bind:drag-start="handleDragStart"
bind:drag-end="handleDragEnd"
bind:drag="handleDrag"
>
<view class="custom-button" slot="button"></view>
</van-slider>
</view>
<view class="rich">
<mp-html
content="{{chapter.Content}}"
scroll-table="{{true}}"
preview-img="{{previewImg}}"
show-img-menu="{{false}}"
></mp-html>
</view>
<view
class="quick-article"
wx:if="{{prevAndNext.prev}}"
bind:tap="handleSwitchDirectory"
data-id="{{prevAndNext.prev.Id}}"
>
<text class="label">上一篇:</text>
{{prevAndNext.prev.ChapterName}}
</view>
<view
class="quick-article"
wx:if="{{prevAndNext.next}}"
bind:tap="handleSwitchDirectory"
data-id="{{prevAndNext.next.Id}}"
>
<text class="label">下一篇:</text>
{{prevAndNext.next.ChapterName}}
</view>
<view class="type" wx:if="{{chapter.CateName}}" bind:tap="handleType">
<view class="label">分类</view>
<view class="item">{{chapter.CateName}}</view>
</view>
<view class="footer">
<view class="item" bind:tap="handleDirectory">
<image class="icon" src="{{imageUrl}}icon-directory.png?t={{Timestamp}}"></image>
目录
<view class="item-tip" catch:tap="handleTipClsoe" wx:if="{{chapterTip}}">
查看全文目录,可点击这里
<image class="close" src="{{imageUrl}}item-tip-close.png?t={{Timestamp}}"></image>
</view>
</view>
<view class="item" wx:if="{{book.IsCollect===1}}" bind:tap="handleUnCollect">
<image class="icon" src="{{imageUrl}}icon-collection-active.png?t={{Timestamp}}"></image>
取消收藏
</view>
<view class="item" wx:else bind:tap="handleCollect">
<image class="icon" src="{{imageUrl}}icon-collection1.png?t={{Timestamp}}"></image>
收藏
</view>
</view>
</view>
<van-popup show="{{ show }}" round position="bottom" bind:close="onClose">
<view class="popup-directory">
<view class="p-close-line" bind:tap="onClose">
<view class="option">
目录收起
<image class="icon" src="{{imageUrl}}fold-up.png?t={{Timestamp}}"></image>
</view>
</view>
<view class="p-title">{{book.BookName}}</view>
<view class="p-type" wx:if="{{chapter.CateName}}" bind:tap="handleType">
<view class="label">分类:</view>
<view class="item">{{chapter.CateName}}</view>
</view>
<scroll-view class="p-scroll" scroll-y scroll-into-view="row{{ChapterId}}">
<view
class="row {{ChapterId === item.Id && 'current'}} row{{ item.Id }}"
wx:for="{{chapterList}}"
wx:key="Id"
bind:tap="handleSwitchDirectory"
data-id="{{item.Id}}"
>
{{index+1}}. {{item.ChapterName}}
</view>
<view class="place-row"></view>
</scroll-view>
</view>
</van-popup>
<global-toast
show="{{toastShow}}"
type="{{toastType}}"
bind:close="handleAuthClose"
bind:conform="handleAuthConform"
></global-toast>

8
src/pages/classify/index.json

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
{
"navigationStyle": "default",
"navigationBarTitleText": "",
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"van-divider": "@vant/weapp/divider/index"
}
}

137
src/pages/classify/index.scss

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
page {
background-color: #f3f4f5;
}
.page {
padding-top: 100rpx;
padding-bottom: 80rpx;
.scroll {
position: fixed;
top: 0;
left: 0;
z-index: 100000000000;
width: 100%;
background-color: #fff;
}
.nav {
padding: 0 16rpx;
display: flex;
background-color: #fff;
&::-webkit-scrollbar {
display: none;
}
.nav-item {
flex-shrink: 0;
padding: 32rpx 16rpx;
font-size: 36rpx;
color: #222222;
line-height: 36rpx;
&.active {
font-size: 36rpx;
color: #3795f7;
font-weight: bold;
position: relative;
&::after {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
content: '';
width: 44rpx;
height: 8rpx;
background: #3795f7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
}
}
}
.types {
padding: 32rpx 32rpx 0;
display: flex;
gap: 16rpx;
flex-wrap: wrap;
.type {
min-width: 160rpx;
padding: 8rpx 10rpx;
box-sizing: border-box;
font-size: 32rpx;
color: #65686c;
line-height: 40rpx;
background-color: #fff;
border-radius: 8rpx;
text-align: center;
&.active {
color: #fff;
background-color: #3795f7;
}
}
}
.der {
margin-top: 32rpx;
font-size: 28rpx;
color: #999999;
text-align: center;
}
.card {
margin: 32rpx 32rpx 24rpx;
padding: 24rpx;
display: flex;
gap: 24rpx;
background: linear-gradient(173deg, #ffffff 0%, #eff7ff 100%);
border-radius: 24rpx 24rpx 24rpx 24rpx;
border: 2rpx solid #ffffff;
&:last-of-type {
margin-bottom: 0;
}
.photo {
flex-shrink: 0;
width: 218rpx;
height: 218rpx;
border-radius: 16rpx;
}
.c-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 36rpx;
color: #222222;
font-weight: bold;
line-height: 48rpx;
}
.type {
margin-top: 16rpx;
flex: 1;
font-size: 32rpx;
color: #999999;
}
.stat {
margin-top: 42rpx;
display: flex;
align-items: center;
justify-content: space-between;
gap: 40rpx;
.s-item {
display: flex;
align-items: center;
gap: 8rpx;
font-size: 28rpx;
color: #999999;
.icon {
width: 32rpx;
height: 32rpx;
}
&.active {
color: #3795f7;
}
}
}
}
}
.none {
display: block;
margin: 30rpx auto;
width: 80%;
}
}

200
src/pages/classify/index.ts

@ -1,200 +0,0 @@ @@ -1,200 +0,0 @@
const app = getApp<IAppOption>();
Page({
data: {
background: 'transparent',
list: [],
pagination: {
page: 1,
pages: 1,
count: 1,
},
recommendList: [],
recommendPagination: {
page: 1,
pages: 1,
count: 0,
},
cateList: [] as any,
CateId: '',
CateSecondId: '',
cateSecondList: [] as any,
scrollIntoView: '',
},
onLoad(options) {
this.setData({
CateId: options.id || '',
});
app.waitLogin().then(() => {
this.getCateList();
this.cateCallback(this.data.CateId, this.data.CateSecondId);
});
},
getCateList() {
wx.ajax({
method: 'GET',
url: '?r=shizhong/book/cate-list',
data: {},
}).then((res) => {
this.setData({
cateList: res,
});
if (this.data.CateId) {
this.setData({
cateSecondList: res.find((item: any) => item.Id === this.data.CateId)?.Children || [],
scrollIntoView: `nav-item${this.data.CateId}`,
});
}
});
},
handleCate(e) {
const { index } = e.currentTarget.dataset;
if (typeof index === 'number') {
this.setData({
CateId: this.data.cateList[index].Id,
CateSecondId: '',
cateSecondList: this.data.cateList[index].Children,
});
} else {
this.setData({ CateId: '', CateSecondId: '', cateSecondList: [] });
}
this.cateCallback(this.data.CateId, this.data.CateSecondId);
},
handleSecondCate(e) {
const { index } = e.currentTarget.dataset;
if (typeof index === 'number') {
this.setData({
CateSecondId: this.data.cateSecondList[index].Id,
});
} else {
this.setData({ CateSecondId: '' });
}
this.cateCallback(this.data.CateId, this.data.CateSecondId);
},
cateCallback(CateId, CateSecondId) {
this.setData({
list: [],
pagination: {
page: 1,
pages: 1,
count: 1,
},
recommendList: [],
recommendPagination: {
page: 1,
pages: 1,
count: this.data.CateSecondId ? 1 : 0,
},
});
this.getList(1, CateId, CateSecondId);
if (CateId && CateSecondId) {
this.getRecommendList(1, CateId, CateSecondId);
}
},
getList(newPage = 1, CateId, CateSecondId) {
wx.ajax({
method: 'GET',
url: `?r=shizhong/book/list`,
data: {
page: newPage,
CateId,
CateSecondId,
},
}).then((res) => {
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
getRecommendList(newPage = 1, CateId, CateSecondId) {
wx.ajax({
method: 'GET',
url: '?r=shizhong/book/recommend-list',
data: {
CateId,
CateSecondId,
page: newPage,
},
}).then((res) => {
const recommendList = res.page === 1 ? res.list : [...this.data.recommendList, ...res.list];
this.setData({
recommendList,
recommendPagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
onReachBottom() {
const { page, pages } = this.data.pagination;
const { page: rPage, pages: rPages } = this.data.recommendPagination;
if (pages > page && this.data.list.length) {
this.getList(page + 1, this.data.CateId, this.data.CateSecondId);
} else if (rPages > rPage && this.data.recommendList.length && this.data.CateId && this.data.CateSecondId) {
this.getRecommendList(rPage + 1, this.data.CateId, this.data.CateSecondId);
}
},
handleCollect(e) {
const { index, list } = e.currentTarget.dataset;
const { Id } = this.data[list][index];
app.waitLogin(false, true).then(() => {
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/collect',
data: { BookId: Id },
}).then(() => {
wx.showToast({
title: '您已收藏这本书,可在我的页查看',
icon: 'none',
});
this.setData({
[`${list}[${index}].IsCollect`]: '1',
});
});
});
},
handleUnCollect(e) {
const { index, list } = e.currentTarget.dataset;
const { Id } = this.data[list][index];
app.waitLogin(false, true).then(() => {
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/cancel-collect',
data: { BookId: Id },
}).then(() => {
wx.showToast({
title: '取消收藏',
icon: 'none',
});
this.setData({
[`${list}[${index}].IsCollect`]: '0',
});
});
});
},
handleDetail(e) {
const { id } = e.currentTarget.dataset;
const backPath = `/pages/article/index?id=${id}`;
app.waitLogin(false, true, backPath).then(() => {
wx.navigateTo({
url: backPath,
});
});
},
handleBack() {
wx.navigateBack();
},
});
export {};

102
src/pages/classify/index.wxml

@ -1,102 +0,0 @@ @@ -1,102 +0,0 @@
<view class="page">
<scroll-view class="scroll" scroll-x scroll-into-view="{{scrollIntoView}}">
<view class="nav">
<view class="nav-item {{!CateId && 'active'}}" bind:tap="handleCate">全部</view>
<view
class="nav-item {{CateId=== item.Id &&'active'}}"
wx:for="{{cateList}}"
wx:key="Id"
bind:tap="handleCate"
data-index="{{index}}"
id="nav-item{{item.Id}}"
>
{{item.CateName}}
</view>
</view>
</scroll-view>
<view class="types" wx:if="{{CateId && cateSecondList.length}}">
<view class="type {{!CateSecondId && 'active'}}" bind:tap="handleSecondCate">全部</view>
<view
class="type {{CateSecondId=== item.Id && 'active'}}"
wx:for="{{cateSecondList}}"
wx:key="Id"
bind:tap="handleSecondCate"
data-index="{{index}}"
>
{{item.CateName}}
</view>
</view>
<view class="card" wx:for="{{list}}" wx:key="Id" data-id="{{item.Id}}" bind:tap="handleDetail">
<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>
<view class="stat">
<view class="s-item">
<!-- <image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image> -->
阅读 {{~~item.OperateNum + ~~item.BrowseNum}}
</view>
<view
class="s-item active"
wx:if="{{item.IsCollect === '1'}}"
catch:tap="handleUnCollect"
data-index="{{index}}"
data-list="list"
>
<image class="icon" src="{{imageUrl}}icon-collection-active.png?t={{Timestamp}}"></image>
已收藏
</view>
<view class="s-item" wx:else catch:tap="handleCollect" data-index="{{index}}" data-list="list">
<image class="icon" src="{{imageUrl}}icon-collection.png?t={{Timestamp}}"></image>
收藏
</view>
</view>
</view>
</view>
<block wx:if="{{pagination.page >= pagination.pages}}">
<view class="der" wx:if="{{recommendList.length}}">— — 以下为本分类下其他内容 — —</view>
<view class="card" wx:for="{{recommendList}}" 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>
<view class="stat">
<view class="s-item">
<!-- <image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image> -->
阅读 {{~~item.OperateNum + ~~item.BrowseNum}}
</view>
<view
class="s-item active"
wx:if="{{item.IsCollect === '1'}}"
catch:tap="handleUnCollect"
data-index="{{index}}"
data-list="recommendList"
>
<image class="icon" src="{{imageUrl}}icon-collection-active.png?t={{Timestamp}}"></image>
已收藏
</view>
<view class="s-item" wx:else catch:tap="handleCollect" data-index="{{index}}" data-list="recommendList">
<image class="icon" src="{{imageUrl}}icon-collection.png?t={{Timestamp}}"></image>
收藏
</view>
</view>
</view>
</view>
</block>
<view class="pagintion">
<image
class="none"
src="{{imageUrl}}none.png?t={{Timestamp}}"
wx:if="{{pagination.count==0 && recommendPagination.count==0}}"
></image>
<van-divider
contentPosition="center"
wx:elif="{{pagination.page<pagination.pages || recommendPagination.page < recommendPagination.pages}}"
>
<van-loading />
加载中...
</van-divider>
<van-divider contentPosition="center" wx:else>没有更多了</van-divider>
</view>
</view>

7
src/pages/collection/index.json

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
{
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-icon": "@vant/weapp/icon/index",
"pagination":"/components/pagination/index"
}
}

60
src/pages/collection/index.scss

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
page {
background-color: #f3f4f5;
}
.page {
margin: 50rpx 32rpx 0;
padding-bottom: 80rpx;
.card {
padding: 24rpx;
display: flex;
gap: 24rpx;
background: linear-gradient(173deg, #ffffff 0%, #eff7ff 100%);
border-radius: 24rpx 24rpx 24rpx 24rpx;
border: 2rpx solid #ffffff;
.photo {
flex-shrink: 0;
width: 218rpx;
height: 218rpx;
border-radius: 16rpx;
}
.c-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 36rpx;
color: #222222;
font-weight: bold;
line-height: 48rpx;
}
.type {
flex: 1;
margin-top: 16rpx;
font-size: 32rpx;
color: #999999;
}
.stat {
margin-top: 42rpx;
display: flex;
align-items: center;
justify-content: space-between;
gap: 40rpx;
.s-item {
display: flex;
align-items: center;
gap: 8rpx;
font-size: 28rpx;
color: #999999;
.icon {
width: 32rpx;
height: 32rpx;
}
&.active {
color: #3795f7;
}
}
}
}
}
}

94
src/pages/collection/index.ts

@ -1,94 +0,0 @@ @@ -1,94 +0,0 @@
const app = getApp<IAppOption>();
Page({
data: {
background: 'transparent',
pagination: {
page: 1,
pages: 1,
count: 1,
},
list: [],
},
onLoad() {
app.waitLogin(false, true).then(() => {
this.getList();
});
},
getList(newPage = 1) {
wx.ajax({
method: 'GET',
url: `?r=shizhong/book/collect-list`,
data: {
page: newPage,
},
}).then((res) => {
res.list.forEach((item) => {
item.IsCollect = '1';
});
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
onReachBottom() {
const { page, pages } = this.data.pagination;
if (pages > page && this.data.list.length) {
this.getList(page + 1);
}
},
handleCollect(e) {
const { index, list } = e.currentTarget.dataset;
const { BookId } = this.data[list][index];
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/collect',
data: { BookId },
}).then(() => {
wx.showToast({
title: '您已收藏这本书,可在我的页查看',
icon: 'none',
});
this.setData({
[`${list}[${index}].IsCollect`]: '1',
});
});
},
handleUnCollect(e) {
const { index, list } = e.currentTarget.dataset;
const { BookId } = this.data[list][index];
wx.ajax({
method: 'POST',
url: '?r=shizhong/book/cancel-collect',
data: { BookId },
}).then(() => {
wx.showToast({
title: '取消收藏',
icon: 'none',
});
this.setData({
[`${list}[${index}].IsCollect`]: '0',
});
});
},
handleBack() {
wx.navigateBack();
},
handleDetail(e) {
const { id } = e.currentTarget.dataset;
app.waitLogin(false, true).then(() => {
wx.navigateTo({
url: `/pages/article/index?id=${id}`,
});
});
},
});
export {};

40
src/pages/collection/index.wxml

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
<van-nav-bar
title="我的收藏"
border="{{false}}"
custom-style="background:{{background}}"
bind:click-left="handleBack"
fixed
>
<van-icon name="arrow-left" slot="left" color="#000" size="46rpx" />
</van-nav-bar>
<view class="page" style="padding-top:{{menuButtonInfo.bottom}}px;">
<view class="card" wx:for="{{list}}" wx:key="Id" bind:tap="handleDetail" data-id="{{item.BookId}}">
<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>
<view class="stat">
<view class="s-item">
<!-- <image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image> -->
阅读 {{~~item.OperateNum + ~~item.BrowseNum}}
</view>
<view
class="s-item active"
wx:if="{{item.IsCollect === '1'}}"
catch:tap="handleUnCollect"
data-index="{{index}}"
data-list="list"
>
<image class="icon" src="{{imageUrl}}icon-collection-active.png?t={{Timestamp}}"></image>
已收藏
</view>
<view class="s-item" wx:else catch:tap="handleCollect" data-index="{{index}}" data-list="list">
<image class="icon" src="{{imageUrl}}icon-collection.png?t={{Timestamp}}"></image>
收藏
</view>
</view>
</view>
</view>
<pagination pagination="{{pagination}}"></pagination>
</view>

3
src/pages/home/index.json

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
{
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"navbar": "/components/navbar/index"
"navbar": "/components/navbar/index",
"popup": "/components/popup/index"
}
}

20
src/pages/home/index.ts

@ -1,10 +1,28 @@ @@ -1,10 +1,28 @@
const app = getApp<IAppOption>();
Page({
data: {},
data: {
popupShow: false,
// popupType: 'popup1', // 绑定医生弹窗
// popupType: 'popup2', // 去关注弹窗
// popupType: 'popup3', // 问题反馈弹窗
popupType: 'popup4', // 登录失败弹窗
popupParams: {
close: true,
} as any,
},
onLoad() {
// app.waitLogin().then(() => {});
},
handlePopupOk() {
const { popupType } = this.data;
},
handlePopupCancel() {
const { popupType } = this.data;
this.setData({
popupShow: false,
});
},
});
export {};

8
src/pages/home/index.wxml

@ -66,3 +66,11 @@ @@ -66,3 +66,11 @@
</view>
</view>
</view>
<popup
show="{{popupShow}}"
type="{{popupType}}"
params="{{popupParams}}"
bind:ok="handlePopupOk"
bind:cancel="handlePopupCancel"
></popup>

1
src/pages/information/index.wxml

@ -32,4 +32,3 @@ @@ -32,4 +32,3 @@
</view>
<pagination pagination="{{pagination}}"></pagination>
</view>

32
src/pages/informationDetail/index.ts

@ -3,8 +3,40 @@ const _app = getApp<IAppOption>(); @@ -3,8 +3,40 @@ const _app = getApp<IAppOption>();
Page({
data: {
doc: '1',
fileIcon: {
pdf: 'file-icon1',
doc: 'file-icon2',
docx: 'file-icon3',
pptx: 'file-icon4',
xls: 'file-icon5',
xlsx: 'file-icon6',
ppt: 'file-icon7',
none: 'file-icon8',
},
},
onLoad() {},
handleDownload() {
wx.downloadFile({
url: '',
success: (res) => {
if (res.statusCode === 200) {
wx.openDocument({
filePath: res.tempFilePath,
success: () => {
console.log('打开文档成功');
},
fail: (err) => {
console.error('打开文档失败', err);
},
});
} else {
console.error('下载文件失败', res);
}
},
});
},
});
export {};

5
src/pages/longPicture/index.json

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
{
"navigationStyle": "default",
"navigationBarTitleText": "详情",
"usingComponents": {}
}

3
src/pages/longPicture/index.scss

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
.banner {
width: 100%;
}

17
src/pages/longPicture/index.ts

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
const _app = getApp<IAppOption>();
Page({
data: {
url: '',
},
onLoad(options) {
const { url } = options;
if (url) {
this.setData({
url: decodeURIComponent(url),
});
}
},
});
export {};

1
src/pages/longPicture/index.wxml

@ -1 +0,0 @@ @@ -1 +0,0 @@
<image class="banner" mode="widthFix" src="{{url}}"></image>

7
src/pages/protocol/index.json

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
{
"navigationBarTitleText": "用户隐私协议",
"navigationStyle": "default",
"usingComponents": {
"mp-html": "mp-html"
}
}

3
src/pages/protocol/index.scss

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
.page {
padding: 32rpx;
}

10
src/pages/protocol/index.ts

File diff suppressed because one or more lines are too long

3
src/pages/protocol/index.wxml

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
<view class="page">
<mp-html content="{{content}}" scroll-table="{{true}}"></mp-html>
</view>

7
src/pages/search/index.json

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
{
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-icon": "@vant/weapp/icon/index",
"pagination":"/components/pagination/index"
}
}

106
src/pages/search/index.scss

@ -1,106 +0,0 @@ @@ -1,106 +0,0 @@
page {
background-color: #f3f4f5;
}
.page {
padding-bottom: 80rpx;
.search {
margin: 34rpx 32rpx 0;
padding: 0 0 0 24rpx;
display: flex;
align-items: center;
background: linear-gradient(158deg, #ffffff 0%, #f2f9fe 100%);
border-radius: 106rpx 106rpx 106rpx 106rpx;
border: 1px solid #ffffff;
.icon {
width: 36rpx;
height: 36rpx;
}
.input {
flex: 1;
padding: 16rpx;
line-height: 40rpx;
font-size: 28rpx;
}
.place-input {
color: #c9cdd4;
}
}
.tip {
margin: 52rpx 32rpx 0;
font-size: 28rpx;
color: #222222;
font-weight: bold;
}
.card {
padding: 24rpx;
margin: 24rpx 32rpx 0;
display: flex;
gap: 24rpx;
background: linear-gradient(173deg, #ffffff 0%, #eff7ff 100%);
border-radius: 24rpx 24rpx 24rpx 24rpx;
border: 2rpx solid #ffffff;
.photo {
flex-shrink: 0;
width: 218rpx;
height: 218rpx;
border-radius: 16rpx;
}
.c-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 36rpx;
color: #222222;
font-weight: bold;
line-height: 48rpx;
}
.book-name {
flex: 1;
padding-top: 20rpx;
font-size: 32rpx;
color: #999999;
}
.c-footer {
margin-top: 20px;
display: flex;
justify-content: space-between;
gap: 20rpx;
.type {
font-size: 32rpx;
color: #999999;
}
.stat {
flex-shrink: 0;
.s-item {
display: flex;
align-items: center;
gap: 8rpx;
font-size: 28rpx;
color: #999999;
.icon {
width: 32rpx;
height: 32rpx;
}
}
}
}
}
}
.empty-search {
.e-icon {
margin: 186rpx auto 0;
display: block;
width: 217rpx;
height: 236rpx;
}
.content {
margin-top: 44rpx;
font-size: 32rpx;
line-height: 48rpx;
color: #999999;
text-align: center;
}
}
}

78
src/pages/search/index.ts

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
const app = getApp<IAppOption>();
Page({
data: {
background: 'transparent',
focus: false,
Search: '',
pagination: {
page: 1,
pages: 1,
count: 1,
},
list: [],
},
onLoad() {
app.waitLogin().then(() => {
this.setData({
focus: true,
});
});
},
handleInput() {
this.setData({
'pagination.count': 1,
});
},
handleSearch() {
if (!this.data.Search) {
wx.showToast({
title: '请输入搜索内容',
icon: 'none',
});
return;
}
this.getList();
},
getList(newPage = 1) {
wx.ajax({
method: 'GET',
url: `?r=shizhong/book/search-list`,
data: {
page: newPage,
Search: this.data.Search,
},
}).then((res) => {
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
onReachBottom() {
const { page, pages } = this.data.pagination;
if (pages > page && this.data.list.length) {
this.getList(page + 1);
}
},
handleBack() {
wx.navigateBack();
},
handleDetail(e) {
const { id, cid } = e.currentTarget.dataset;
const backPath = `/pages/article/index?id=${id}&cid=${cid}`;
app.waitLogin(false, true, backPath).then(() => {
wx.navigateTo({
url: backPath,
});
});
},
});
export {};

58
src/pages/search/index.wxml

@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
<van-nav-bar
title="搜索"
border="{{false}}"
custom-style="background:{{background}}"
bind:click-left="handleBack"
fixed
>
<van-icon name="arrow-left" slot="left" color="#000" size="46rpx" />
</van-nav-bar>
<view class="page" style="padding-top:{{menuButtonInfo.bottom}}px;">
<view class="search">
<image class="icon" src="{{imageUrl}}icon-search.png?t={{Timestamp}}"></image>
<input
type="text"
class="input"
model:value="{{Search}}"
focus="{{focus}}"
placeholder-class="place-input"
confirm-type="search"
bindconfirm="handleSearch"
placeholder="请输入要搜索的内容"
bindinput="handleInput"
/>
</view>
<view class="tip" wx:if="{{list.length}}">以下为搜到的内容</view>
<view
class="card"
wx:for="{{list}}"
wx:key="index"
bind:tap="handleDetail"
data-id="{{item.BookId}}"
data-cid="{{item.ChapterId}}"
>
<image class="photo" mode="aspectFill" src="{{item.CoverUrl}}"></image>
<view class="c-container">
<view class="title">{{item.ChapterName}}</view>
<view class="book-name">{{item.BookName}}</view>
<view class="c-footer">
<view class="type">{{item.CateName}}{{item.CateSecondName ? '/'+item.CateSecondName : ''}}</view>
<view class="stat">
<view class="s-item">
<!-- <image class="icon" src="{{imageUrl}}icon-eye.png?t={{Timestamp}}"></image> -->
阅读 {{~~item.OperateNum + ~~item.BrowseNum}}
</view>
</view>
</view>
</view>
</view>
<view class="empty-search" wx:if="{{Search && pagination.count==='0'}}">
<image class="e-icon" src="{{imageUrl}}empty-1.png?t={{Timestamp}}"></image>
<view class="content">
抱歉,未搜到相关内容
<view></view>
换个词试试吧
</view>
</view>
<pagination wx:elif="{{list.length}}" pagination="{{pagination}}"></pagination>
</view>

6
src/pages/switchLogin/index.json

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

161
src/pages/switchLogin/index.scss

@ -1,161 +0,0 @@ @@ -1,161 +0,0 @@
.page {
.container {
margin-top: 336rpx;
padding: 64rpx 32rpx 0;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.76) 0%, #ffffff 100%) no-repeat top center/100% 186rpx;
border-radius: 32rpx;
.tel {
.input {
padding: 24rpx 48rpx;
background-color: #f4f7fa;
border-radius: 96rpx;
font-size: 32rpx;
}
.place-input {
color: #babdc1;
}
}
.code-row {
margin-top: 32rpx;
display: flex;
align-items: center;
gap: 30rpx;
.code {
flex: 1;
padding: 24rpx 48rpx;
background-color: #f4f7fa;
border-radius: 96rpx;
font-size: 32rpx;
}
.place-code {
color: #babdc1;
}
.btn {
flex-shrink: 0;
padding: 24rpx;
width: 7em;
text-align: center;
color: #fff;
font-size: 32rpx;
background-color: #3795f7;
border-radius: 96rpx;
}
}
.protool {
margin-top: 56rpx;
display: flex;
align-items: center;
font-size: 28rpx;
color: #999;
.radio {
transform: scale(0.7);
}
.link {
color: #3795f7;
}
}
.submit {
margin-top: 88rpx;
padding: 22rpx;
text-align: center;
font-size: 36rpx;
color: #fff;
line-height: 44rpx;
background: linear-gradient(90deg, #134df6 36%, #3795f7 100%);
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
.tel-btn {
margin: 78rpx auto 0;
padding: 12rpx 44rpx;
border-radius: 52rpx;
width: 352rpx;
font-size: 32rpx;
line-height: 40rpx;
color: rgba(153, 153, 153, 1);
display: flex;
gap: 12rpx;
align-items: center;
justify-content: center;
outline: none;
.icon {
width: 28rpx;
height: 40rpx;
}
&::after {
border: none;
outline: none;
}
}
.visitor {
margin-top: 196rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
line-height: 1;
color: #3795f7;
}
}
}
.popup {
padding: 33rpx 0 0;
.popup-container {
padding: 280rpx 48rpx 0;
width: 622rpx;
height: 490rpx;
box-sizing: border-box;
background: linear-gradient(180deg, #e7f8ff 0%, #ffffff 100%);
border-radius: 32rpx;
position: relative;
.badge {
position: absolute;
left: 0;
top: -33px;
width: 246rpx;
height: 286rpx;
}
.title {
position: absolute;
top: 50rpx;
right: 28rpx;
width: 338rpx;
height: 164rpx;
}
.conform {
height: 88rpx;
text-align: center;
background: #3795f7;
line-height: 88rpx;
font-size: 36rpx;
color: #FFFFFF;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
.cancel{
margin-top: 10rpx;
font-size: 32rpx;
color: #999999;
text-align: center;
line-height: 88rpx;
}
}
}

95
src/pages/switchLogin/index.ts

@ -1,95 +0,0 @@ @@ -1,95 +0,0 @@
const app = getApp<IAppOption>();
let timer: number | null = 0;
Page({
data: {
menuButtonInfo: {},
mobile: '',
code: '',
codeText: '发送验证码',
},
onLoad() {},
getCode() {
if (timer) return;
const mobile = this.data.mobile;
if (!mobile) {
wx.showToast({
title: '手机号不能为空',
icon: 'none',
});
return;
}
// 验证手机号
if (!/^1[3-9,]\d{9}$/.test(mobile)) {
wx.showToast({
title: '手机号格式不正确',
icon: 'none',
});
return;
}
wx.ajax({
method: 'POST',
url: '?r=shizhong/login/send-verify-code',
data: {
mobile,
},
}).then(() => {
wx.showToast({
icon: 'none',
title: '验证码已发送~',
});
let time = 60;
timer = setInterval(() => {
time--;
this.setData({
codeText: `${time}s后重新发送`,
});
if (time <= 0) {
clearInterval(timer as number);
timer = null;
this.setData({
codeText: '发送验证码',
});
}
}, 1000);
});
},
handleSubmit() {
const { mobile, code } = this.data;
if (!mobile) {
wx.showToast({
title: '请输入手机号',
icon: 'none',
});
return;
}
if (!code) {
wx.showToast({
title: '请输入验证码',
icon: 'none',
});
return;
}
wx.ajax({
method: 'POST',
url: '?r=shizhong/login/reg-login',
data: {
mobile,
code,
},
}).then(() => {
this.submitCallback();
});
},
submitCallback() {
app.globalData.isLogin = 1;
wx.reLaunch({
url: '/pages/home/index',
});
},
handleBack(){
wx.navigateBack()
}
});
export {};

35
src/pages/switchLogin/index.wxml

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<van-nav-bar
right-text="按钮"
left-arrow
fixed
custom-style="background:transparent;"
bind:click-left="handleBack"
/>
<view
class="page"
style="background: url('{{imageUrl}}login-bg.png?t={{Timestamp}}') no-repeat top center/100% 624rpx;padding-top:{{menuButtonInfo.bottom}}px;"
>
<view class="container">
<view class="tel">
<input
type="number"
model:value="{{mobile}}"
placeholder-class="place-input"
class="input"
placeholder="请输入手机号"
/>
</view>
<view class="code-row">
<input
type="text"
placeholder="请输入验证码"
class="code"
placeholder-class="place-code"
model:value="{{code}}"
type="number"
/>
<view class="btn" bind:tap="getCode">{{codeText}}</view>
</view>
<view class="submit" bind:tap="handleSubmit">切换账号</view>
</view>
</view>

8
src/pages/topic/index.json

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
{
"usingComponents": {
"van-progress": "@vant/weapp/progress/index",
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-icon": "@vant/weapp/icon/index",
"van-popup": "@vant/weapp/popup/index"
}
}

219
src/pages/topic/index.scss

@ -1,219 +0,0 @@ @@ -1,219 +0,0 @@
page {
background: #f3f4f5 linear-gradient(180deg, #d2f1fe 0%, rgba(244, 248, 249, 0) 100%) no-repeat top center/100% 442rpx;
}
.page {
min-height: 100vh;
overflow: hidden;
.swiper {
width: 100%;
height: 1632rpx;
box-sizing: border-box;
}
.topic {
position: relative;
margin: 16rpx 48rpx;
padding: 48rpx 40rpx 0;
box-sizing: border-box;
background: #ffffff;
box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(188, 188, 188, 0.18);
border-radius: 24rpx 24rpx 24rpx 24rpx;
&::before {
content: '';
position: absolute;
bottom: -50rpx;
left: 52rpx;
width: calc(100% - 104rpx);
height: 50rpx;
background: rgba(55, 149, 247, 0.24);
border-radius: 0 0 24rpx 24rpx;
}
&::after {
content: '';
position: absolute;
bottom: -30rpx;
left: 22rpx;
width: calc(100% - 44rpx);
height: 30rpx;
background: rgba(55, 149, 247, 0.8);
border-radius: 0 0 24rpx 24rpx;
}
.order {
font-size: 60rpx;
color: #3795f7;
font-weight: bold;
.all {
font-size: 44rpx;
color: #cdcdcd;
}
}
.progress {
margin-top: 26rpx;
}
.content {
margin-top: 34rpx;
font-size: 36rpx;
color: #222222;
line-height: 64rpx;
white-space: pre-line;
}
.btn {
margin-top: 32rpx;
font-size: 36rpx;
color: #65686c;
line-height: 88rpx;
text-align: center;
height: 88rpx;
background: #f4f7fa;
border-radius: 84rpx 84rpx 84rpx 84rpx;
&.active {
color: #ffffff;
background: #3795f7;
}
}
.footer {
width: 100%;
padding: 60rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
.prev {
flex: 1;
font-size: 36rpx;
color: #3795f7;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
.icon {
margin-right: 16rpx;
width: 44rpx;
height: 44rpx;
}
}
.submit {
width: 290rpx;
height: 88rpx;
font-size: 36rpx;
color: #ffffff;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
text-align: center;
line-height: 88rpx;
font-weight: normal;
}
}
}
.end {
position: relative;
margin: 272rpx 48rpx 16rpx;
padding: 70rpx 52rpx 84rpx;
box-sizing: border-box;
background: #ffffff;
box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(188, 188, 188, 0.18);
border-radius: 24rpx 24rpx 24rpx 24rpx;
.badge {
display: block;
margin: 0 auto;
width: 217rpx;
height: 182rpx;
}
.title {
font-size: 40rpx;
color: #222222;
font-weight: bold;
text-align: center;
}
.content {
margin-top: 30rpx;
font-size: 32rpx;
color: #222222;
}
.codes {
margin-top: 30rpx;
display: flex;
justify-content: space-between;
.c-item {
.code {
width: 246rpx;
height: 246rpx;
}
.name {
margin-top: 4rpx;
text-align: center;
font-size: 28rpx;
color: #222222;
}
}
}
.btn {
margin-top: 54rpx;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 36rpx;
color: #fff;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
}
}
.relove {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
width: 388rpx;
height: 350rpx;
background: rgba(0, 0, 0, 0.67);
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
text-align: center;
.icon {
width: 84rpx;
height: 84rpx;
}
.content {
margin-top: 26rpx;
font-size: 40rpx;
color: #ffffff;
}
}
.start {
padding: 710rpx 32rpx 0;
width: 654rpx;
height: 860rpx;
box-sizing: border-box;
.btn {
width: 596rpx;
height: 88rpx;
font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
}

146
src/pages/topic/index.ts

@ -1,146 +0,0 @@ @@ -1,146 +0,0 @@
const app = getApp<IAppOption>();
// const licia = require('miniprogram-licia');
Page({
data: {
nav: 0,
percentage: 0,
question: [] as { questionId: string; title: string; answer?: '1' | '2' }[],
back: false,
start: true,
end: false,
answerList: [
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['非常了解', '一般了解', '完全不了解'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
],
},
onLoad(options) {
this.setData({
back: options.back === '1',
});
app.waitLogin(true).then(() => {
this.getList();
});
},
getList() {
wx.ajax({
method: 'GET',
url: '?r=shizhong/account/get-question',
data: {},
}).then((res) => {
this.setData({
question: res,
});
});
},
handleEnd() {
app.waitLogin().then(() => {
wx.reLaunch({
url: '/pages/home/index',
});
});
},
// handleBtn: licia.debounce(function (e) {
// const { index, id } = e.currentTarget.dataset;
// const { question, nav } = this.data;
// question[index].answer = id;
// this.setData({
// question,
// nav: nav === question.length - 1 ? nav : nav + 1,
// percentage: ((nav + 1) / question.length) * 100,
// });
// }, 200),
handleBtn(e) {
const { index, id } = e.currentTarget.dataset;
const { question, nav } = this.data;
// 防止重复点击
if (question[index].answer && nav > index) return;
question[index].answer = id;
this.setData({
question,
nav: nav === question.length - 1 ? nav : nav + 1,
percentage: ((nav + 1) / question.length) * 100,
});
},
handlePrev() {
this.setData({
nav: this.data.nav - 1,
});
},
handleSubmit() {
const answer = this.data.question.map((item) => {
return {
qId: item.questionId,
answer: item.answer,
};
});
wx.ajax({
method: 'POST',
url: '?r=shizhong/account/answer-question',
data: {
answer: JSON.stringify(answer),
},
}).then(() => {
this.setData({
end: true,
});
});
},
bindtransition() {
this.setData({
nav: this.data.nav,
});
},
catchTouchMove() {
return false;
},
handleStart() {
this.setData({ start: false });
},
handleBack() {
if (this.data.end) {
wx.navigateBack();
} else {
wx.showModal({
title: '确认退出?',
content: '还差一点就完成了,退出会清空所有答题,确认现在要退出吗?',
cancelText: '退出',
confirmText: '继续答题',
success: (res) => {
if (res.cancel) {
if (this.data.back) {
wx.navigateBack();
} else {
wx.reLaunch({
url: '/pages/home/index',
});
}
}
},
});
}
},
});
export {};

100
src/pages/topic/index.wxml

@ -1,100 +0,0 @@ @@ -1,100 +0,0 @@
<view
class="page"
style="background: url('{{imageUrl}}topic{{end?'-end':''}}-bg.png?t={{Timestamp}}') no-repeat left {{menuButtonInfo.bottom+102}}rpx /100% 1284rpx;"
>
<van-nav-bar 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>
<swiper
class="swiper"
current="{{nav}}"
bindtransition="bindtransition"
style="margin-top:{{menuButtonInfo.bottom+73}}px;"
wx:if="{{!end}}"
>
<swiper-item wx:for="{{question}}" wx:key="index" wx:for-item="questionItem" catch:touchmove="catchTouchMove">
<view class="topic">
<view class="order">
{{index + 1}}/
<text class="all">{{question.length}}</text>
</view>
<view class="progress">
<van-progress
percentage="{{percentage}}"
show-pivot="{{false}}"
stroke-width="{{8}}"
track-color="#F4F7FA"
color="#3795F7"
/>
</view>
<view class="content">{{questionItem.title}}</view>
<view
class="btn {{questionItem.answer==='1' && 'active'}}"
bind:tap="handleBtn"
data-id="1"
data-index="{{index}}"
>
{{answerList[index][0]}}
</view>
<view
class="btn {{questionItem.answer==='2' && 'active'}}"
bind:tap="handleBtn"
data-id="2"
data-index="{{index}}"
>
{{answerList[index][1]}}
</view>
<view
class="btn {{questionItem.answer==='3' && 'active'}}"
bind:tap="handleBtn"
data-id="3"
data-index="{{index}}"
>
{{answerList[index][2]}}
</view>
<view class="footer">
<view class="prev" bind:tap="handlePrev" wx:if="{{index>0}}">
<image class="icon" src="{{imageUrl}}icon-prev.png?t={{Timestamp}}"></image>
上一题
</view>
<view
class="submit"
wx:if="{{index === question.length-1 && question[question.length-1].answer}}"
bind:tap="handleSubmit"
>
提交
</view>
</view>
</view>
</swiper-item>
<swiper-item></swiper-item>
</swiper>
<view class="end" wx:if="{{end}}">
<image class="badge" src="{{imageUrl}}topic-start-badge.png?t={{Timestamp}}"></image>
<view class="title">
提交成功
<view></view>
感谢您的参与!
</view>
<view class="content">
欢迎使用适中健康信息小程序,您将看到一个查有可依、科学性、体系化的健康信息世界,化零为整,随时查阅。
</view>
<view class="codes">
<view class="c-item">
<image class="code" src="{{imageUrl}}topic-start-code1.png?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="name">关注公众号</view>
</view>
<view class="c-item">
<image class="code" src="{{imageUrl}}topic-start-code2.png?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="name">关注企微号</view>
</view>
</view>
<view class="btn" bind:tap="handleEnd">现在体验</view>
</view>
</view>
<van-popup show="{{ start }}" custom-style="background:transparent" round>
<view class="start" style="background: url('{{imageUrl}}topic-start.png?t={{Timestamp}}') no-repeat center /100%;">
<view class="btn" bind:tap="handleStart">开始答题</view>
</view>
</van-popup>

7
src/pages/userInfo/index.json

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
{
"navigationStyle": "default",
"navigationBarTitleText": "个人信息",
"usingComponents": {
"uploadFile": "/components/uploadFile/index"
}
}

56
src/pages/userInfo/index.scss

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
page {
background-color: #f3f4f5;
}
.page {
padding: 32rpx;
.container {
border-radius: 16rpx;
background-color: #fff;
.row {
padding: 36rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #f0f0f0;
&:last-of-type {
border: none;
}
&.small {
padding: 24rpx 32rpx;
}
.label {
font-size: 36rpx;
color: #222222;
}
.wrap {
flex: 1;
display: flex;
justify-content: flex-end;
.avatar {
position: relative;
width: 100rpx;
height: 100rpx;
.a-img {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.icon {
position: absolute;
bottom: 0;
right: 0;
width: 32rpx;
height: 32rpx;
}
}
.input {
text-align: right;
font-size: 36rpx;
}
.place-input {
color: #babdc1;
}
}
}
}
}

59
src/pages/userInfo/index.ts

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
const app = getApp<IAppOption>();
Page({
data: {
username: '',
userInfo: {} as any,
},
onLoad() {
app.waitLogin().then(() => {
app.getUserInfo(this);
});
},
handleFile(e) {
const avatar = e.detail.fileUrl;
this.setData({
'userInfo.avatar': avatar,
});
this.updateUserInfo();
},
handleInputBlur(e) {
this.setData({
username: e.detail.value,
});
},
handleInputBlurPass(e) {
if (e.detail.pass) {
this.setData({
[`userInfo.username`]: this.data.username,
});
this.updateUserInfo();
}
},
updateUserInfo() {
const { avatar, username } = this.data.userInfo;
if (!username) {
wx.showToast({
title: '请输入用户名',
icon: 'none',
});
return;
}
wx.ajax({
method: 'POST',
url: '?r=shizhong/account/update-info',
data: {
userName: username,
avatar,
},
}).then(() => {
app.getUserInfo(this);
wx.showToast({
title: '保存成功',
icon: 'none',
});
});
},
});
export {};

42
src/pages/userInfo/index.wxml

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
<view class="page">
<view class="container">
<view class="row small">
<view class="label">头像</view>
<view class="wrap">
<uploadFile
class="avatar"
chooseAvatar
data-key="Img"
bind:file="handleFile"
>
<image
wx:if="{{userInfo.avatar}}"
class="a-img"
src="{{userInfo.avatar}}"
></image>
<image
wx:else
class="a-img"
src="{{imageUrl}}user.png?t={{Timestamp}}"
></image>
<image class="icon" src="{{imageUrl}}icon-pic.png?t={{Timestamp}}"></image>
</uploadFile>
</view>
</view>
<view class="row">
<view class="label">昵称</view>
<view class="wrap">
<input
class="input"
type="nickname"
value="{{userInfo.username}}"
placeholder-class="place-input"
placeholder="请输入昵称"
data-key="username"
bindblur="handleInputBlur"
bindnicknamereview="handleInputBlurPass"
></input>
</view>
</view>
</view>
</view>
Loading…
Cancel
Save