Browse Source

ask 接口联调 & 知识库bug处理

master
kola-web 3 days ago
parent
commit
6a4174d392
  1. 2
      project.private.config.json
  2. 30
      src/app.ts
  3. 4
      src/components/star/index.json
  4. 0
      src/components/star/index.scss
  5. 204
      src/components/star/index.ts
  6. 1
      src/components/star/index.wxml
  7. 2
      src/custom-tab-bar/index.ts
  8. BIN
      src/images/icon10.png
  9. BIN
      src/images/icon19.png
  10. BIN
      src/images/icon20.png
  11. BIN
      src/images/icon21.png
  12. BIN
      src/images/icon3.png
  13. BIN
      src/images/icon8.png
  14. BIN
      src/images/icon9.png
  15. BIN
      src/images/none.png
  16. BIN
      src/images/star/icon1.png
  17. BIN
      src/images/star/icon2.png
  18. BIN
      src/images/star/icon3.png
  19. BIN
      src/images/star/icon4.png
  20. BIN
      src/images/star/icon5.png
  21. BIN
      src/images/star/icon6.png
  22. BIN
      src/images/star/icon7.png
  23. BIN
      src/images/star/icon8.png
  24. 3
      src/pages/applyFrom/index.scss
  25. 10
      src/pages/applyFrom/index.ts
  26. 3
      src/pages/applyFrom/index.wxml
  27. 2
      src/pages/applyFromResult/index.scss
  28. 3
      src/pages/applyFromResult/index.ts
  29. 2
      src/pages/applyFromResult/index.wxml
  30. 60
      src/pages/ask/index.scss
  31. 315
      src/pages/ask/index.ts
  32. 104
      src/pages/ask/index.wxml
  33. 36
      src/pages/index/index.scss
  34. 25
      src/pages/index/index.ts
  35. 10
      src/pages/index/index.wxml
  36. 14
      src/pages/knowledge/index.scss
  37. 1
      src/pages/knowledge/index.ts
  38. 3
      src/pages/knowledgeDetail/index.json
  39. 17
      src/pages/knowledgeDetail/index.scss
  40. 25
      src/pages/knowledgeDetail/index.ts
  41. 11
      src/pages/knowledgeDetail/index.wxml
  42. 4
      src/pages/knowledgeDetailVideo/index.json
  43. 32
      src/pages/knowledgeDetailVideo/index.scss
  44. 110
      src/pages/knowledgeDetailVideo/index.ts
  45. 48
      src/pages/knowledgeDetailVideo/index.wxml
  46. 6
      src/pages/login/index.wxml
  47. 7
      src/pages/my/index.scss
  48. 11
      src/pages/my/index.ts
  49. 6
      src/pages/my/index.wxml
  50. 2
      src/patient/pages/home/index.wxml
  51. 2
      typings/index.d.ts

2
project.private.config.json

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
{
"name": "知识夸详情-文章",
"pathName": "pages/knowledgeDetail/index",
"query": "id=9",
"query": "id=15",
"scene": null,
"launchMode": "default"
},

30
src/app.ts

@ -93,21 +93,21 @@ App<IAppOption>({ @@ -93,21 +93,21 @@ App<IAppOption>({
}, 500)
})
},
mpBehavior(data: { PageName: string; doctor?: boolean }) {
let url = '?r=zd/mp-behavior/add'
if (data.doctor) {
url = '?r=zd/doctor/mp-behavior/add'
}
delete data.doctor
wx.ajax({
method: 'POST',
url,
data: data,
loading: false,
showMsg: false,
}).then((res) => {
console.log('res: ', res)
})
mpBehavior(data: { PageName: string }) {
// let url = '?r=zd/mp-behavior/add'
// if (data.doctor) {
// url = '?r=zd/doctor/mp-behavior/add'
// }
// delete data.doctor
// wx.ajax({
// method: 'POST',
// url,
// data: data,
// loading: false,
// showMsg: false,
// }).then((res) => {
// console.log('res: ', res)
// })
},
getUserInfo() {

4
src/components/star/index.json

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

0
src/components/star/index.scss

204
src/components/star/index.ts

@ -0,0 +1,204 @@ @@ -0,0 +1,204 @@
const app = getApp();
/**
* >=min && <=max
* @param min
* @param max
*/
function getRandom(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
}
Component({
options: {},
lifetimes: {
attached() {
const query = wx.createSelectorQuery().in(this);
query
.select("#thumsCanvas")
.fields({ node: true, size: true })
.exec((res) => {
const canvas = res[0].node;
const context = canvas.getContext("2d");
this.setData({
context: context,
});
const dpr = wx.getSystemInfoSync().pixelRatio;
canvas.width = res[0].width * dpr;
canvas.height = res[0].height * dpr;
this.data.width = res[0].width * dpr;
this.data.height = res[0].height * dpr;
// context.fillStyle = "rgba(255, 255, 255, 0)";
const images = [
"star/icon1.png",
"star/icon2.png",
"star/icon3.png",
"star/icon4.png",
"star/icon5.png",
"star/icon6.png",
"star/icon7.png",
"star/icon8.png",
];
const promiseAll = [] as Array<Promise<any>>;
images.forEach((src) => {
const p = new Promise(function (resolve) {
const img = canvas.createImage();
img.onerror = img.onload = resolve.bind(null, img);
img.src = app.globalData.imageUrl + src;
});
promiseAll.push(p);
});
Promise.all(promiseAll).then((imgsList) => {
const imgsLists = imgsList.filter((d) => {
if (d && d.width > 0) return true;
return false;
});
this.setData({
imgsList: imgsLists,
});
if (this.data.imgsList.length == 0) {
// logger.error("imgsList load all error");
wx.showToast({
icon: "none",
title: "imgsList load all error",
});
return;
}
});
});
},
},
properties: {},
data: {
imgsList: [] as WechatMiniprogram.ImageData[],
width: 0,
height: 0,
context: null as any,
scanning: false,
renderList: [],
scaleTime: 0.1, // 百分比
},
methods: {
handleTap() {
this.start();
},
createRender() {
if (this.data.imgsList.length == 0) return null;
const basicScale = [0.6, 0.9, 1.2][getRandom(0, 2)];
const getScale = (diffTime) => {
if (diffTime < this.data.scaleTime) {
return +(diffTime / this.data.scaleTime).toFixed(2) * basicScale;
} else {
return basicScale;
}
};
const context = this.data.context;
// 随机读取一个图片来渲染
const image: any = this.data.imgsList[getRandom(0, this.data.imgsList.length - 1)];
const offset = 20;
const basicX = this.data.width / 2 + getRandom(-offset, offset);
const angle = getRandom(2, 10);
let ratio = getRandom(10, 30) * (getRandom(0, 1) ? 1 : -1);
const getTranslateX = (diffTime) => {
if (diffTime < this.data.scaleTime) {
// 放大期间,不进行摇摆位移
return basicX;
} else {
return basicX + ratio * Math.sin(angle * (diffTime - this.data.scaleTime));
}
};
const getTranslateY = (diffTime) => {
return image.height / 2 + (this.data.height - image.height / 2) * (1 - diffTime);
};
const fadeOutStage = getRandom(14, 18) / 100;
const getAlpha = (diffTime) => {
let left = 1 - +diffTime;
if (left > fadeOutStage) {
return 1;
} else {
return 1 - +((fadeOutStage - left) / fadeOutStage).toFixed(2);
}
};
return (diffTime) => {
// 差值满了,即结束了 0 ---》 1
if (diffTime >= 1) return true;
context.save();
const scale = getScale(diffTime);
// const rotate = getRotate();
const translateX = getTranslateX(diffTime);
const translateY = getTranslateY(diffTime);
context.translate(translateX, translateY);
context.scale(scale, scale);
// context.rotate(rotate * Math.PI / 180);
context.globalAlpha = getAlpha(diffTime);
context.drawImage(image, -image.width / 2, -image.height / 2, image.width, image.height);
context.restore();
};
},
scan() {
this.data.context.clearRect(0, 0, this.data.width, this.data.height);
this.data.context.fillStyle = "rgba(255, 255, 255, 0)";
this.data.context.fillRect(0, 0, 200, 400);
let index = 0;
let length = this.data.renderList.length;
if (length > 0) {
this.requestFrame(this.scan.bind(this));
this.setData({
scanning: true,
});
} else {
this.setData({
scanning: false,
});
}
while (index < length) {
const child = this.data.renderList[index];
if (!child || !child.render || child.render.call(null, (Date.now() - child.timestamp) / child.duration)) {
// 结束了,删除该动画
this.setData({
renderList: [...this.data.renderList].filter((_item, fIndex) => fIndex != index),
});
length--;
} else {
// continue
index++;
}
}
},
start() {
const render = this.createRender();
const duration = getRandom(1500, 3000);
this.setData({
renderList: [
...this.data.renderList,
{
render,
duration,
timestamp: Date.now(),
},
],
});
if (!this.data.scanning) {
this.setData({
scanning: true,
});
this.requestFrame(this.scan.bind(this));
// this.scan.bind(this)();
}
return this;
},
requestFrame(cb) {
return (
this.data.context.requestAnimationFrame ||
(function (callback) {
setTimeout(callback, 1000 / 60);
})(cb)
);
},
},
});

1
src/components/star/index.wxml

@ -0,0 +1 @@ @@ -0,0 +1 @@
<canvas id="thumsCanvas" type="2d" width="200" height="400" style="width: 100px; height: 200px"></canvas>

2
src/custom-tab-bar/index.ts

@ -25,7 +25,7 @@ Component({ @@ -25,7 +25,7 @@ Component({
{
pagePath: '/pages/my/index',
text: '我的',
icon: 'tabbar1-2',
icon: 'tabbar1-3',
iconActive: 'tabbar1-3-active',
},
],

BIN
src/images/icon10.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 741 B

BIN
src/images/icon19.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/images/icon20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

BIN
src/images/icon21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

BIN
src/images/icon3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

After

Width:  |  Height:  |  Size: 955 B

BIN
src/images/icon8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 874 B

BIN
src/images/icon9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 507 B

BIN
src/images/none.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
src/images/star/icon1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/images/star/icon2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
src/images/star/icon3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
src/images/star/icon4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/images/star/icon5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
src/images/star/icon6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
src/images/star/icon7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
src/images/star/icon8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

3
src/pages/applyFrom/index.scss

@ -22,6 +22,7 @@ page { @@ -22,6 +22,7 @@ page {
.label {
flex-shrink: 0;
font-size: 32rpx;
line-height: 1.2;
color: #010105;
width: 7em;
&.required::before {
@ -32,6 +33,7 @@ page { @@ -32,6 +33,7 @@ page {
}
.content {
flex: 1;
line-height: 1.2;
.select {
display: flex;
gap: 24rpx;
@ -72,6 +74,7 @@ page { @@ -72,6 +74,7 @@ page {
}
}
.textarea {
padding: 0;
width: 100%;
font-size: 32rpx;
height: 100rpx;

10
src/pages/applyFrom/index.ts

@ -21,6 +21,7 @@ Page({ @@ -21,6 +21,7 @@ Page({
},
onLoad() {
app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_PREAPPLY' })
app.getUserInfo().then((userInfo) => {
if (userInfo.ApplyIntentionId) {
this.getDetail(userInfo.ApplyIntentionId)
@ -70,6 +71,9 @@ Page({ @@ -70,6 +71,9 @@ Page({
})
},
handlePhoneNumber(e) {
if (!e.detail.encryptedData) {
return
}
wx.ajax({
method: 'POST',
url: '?r=wtx/user/wx-telephone',
@ -79,11 +83,12 @@ Page({ @@ -79,11 +83,12 @@ Page({
},
}).then((res) => {
this.setData({
Telephone: res.Telehpone,
Telephone: res.Telephone,
})
})
},
handleSubmit() {
app.mpBehavior({ PageName: 'BTN_PREAPPLY_SUBMIT' })
const { Id, UserName, Relation, BirthMonth, ProvinceId, CityId, Telephone, Remark, Argument } = this.data
let toast = ''
if (!Telephone) {
@ -132,6 +137,9 @@ Page({ @@ -132,6 +137,9 @@ Page({
})
})
},
handleBack() {
wx.navigateBack()
},
})
export {}

3
src/pages/applyFrom/index.wxml

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<navbar title="基因疗法筛查申请" fixed custom-style="background:{{background}}">
<van-icon name="arrow-left" slot="left" size="18px" color="#000" />
<van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" />
</navbar>
<view
@ -70,6 +70,7 @@ @@ -70,6 +70,7 @@
class="textarea"
placeholder-class="place-textarea"
placeholder="输入说明"
disable-default-padding
></textarea>
</view>
</view>

2
src/pages/applyFromResult/index.scss

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
page {
color: #fafafa;
background-color: rgba(246, 246, 249, 1);
}
.page {
background: linear-gradient(172deg, #ffa340 0%, #ffdcdd 56%, #fafafa 100%) no-repeat top center/100% 726rpx;

3
src/pages/applyFromResult/index.ts

@ -21,6 +21,9 @@ Page({ @@ -21,6 +21,9 @@ Page({
})
})
},
handleBack() {
wx.navigateBack()
},
})
export {}

2
src/pages/applyFromResult/index.wxml

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<navbar fixed custom-style="background:{{background}}">
<van-icon name="arrow-left" slot="left" size="18px" color="#000" />
<van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" />
</navbar>
<view class="page" style="padding-top:{{pageTop}}px">
<view class="container">

60
src/pages/ask/index.scss

@ -145,11 +145,39 @@ page { @@ -145,11 +145,39 @@ page {
.message {
margin-bottom: 32rpx;
padding: 26rpx 32rpx;
background: linear-gradient(13deg, #ffffff 0%, #ffcdca 100%);
background: #fff linear-gradient(to top, #ffffff 0%, #ffcdca 100%) no-repeat top center/ 100% 200rpx;
border-radius: 32rpx;
font-size: 32rpx;
color: rgba(40, 48, 49, 1);
color: rgba(1, 1, 5, 1);
line-height: 48rpx;
white-space: pre-line;
.reference {
margin-top: 24rpx;
font-size: 24rpx;
color: rgba(1, 1, 5, 0.5);
line-height: 32rpx;
}
.m-footer {
border-top: 1px solid rgba(0, 0, 0, 0.04);
margin-top: 32rpx;
padding-top: 24rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.icon {
width: 36rpx;
height: 36rpx;
}
.num {
margin-left: 12rpx;
font-size: 32rpx;
color: rgba(1, 1, 5, 0.4);
line-height: 1px;
&.active {
color: rgba(242, 58, 47, 1);
}
}
}
}
.week {
margin-bottom: 32rpx;
@ -417,10 +445,11 @@ page { @@ -417,10 +445,11 @@ page {
flex-shrink: 0;
padding: 18rpx 30rpx calc(env(safe-area-inset-bottom) + 30rpx);
border-radius: 24rpx 24rpx 0 0;
background-color: #fff;
background-color: rgba(255, 255, 255, 1);
transition: all 0.3s;
height: calc(124rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
box-shadow: 0rpx 2rpx 28rpx 0rpx rgba(0, 0, 0, 0.08);
.unread {
position: absolute;
top: -80rpx;
@ -435,13 +464,6 @@ page { @@ -435,13 +464,6 @@ page {
&.expend {
height: 50vh;
}
.line {
margin: 0 auto;
width: 52rpx;
height: 6rpx;
background: #f2f4f5;
border-radius: 48rpx 48rpx 48rpx 48rpx;
}
.title {
margin-top: 26rpx;
font-size: 32rpx;
@ -465,11 +487,11 @@ page { @@ -465,11 +487,11 @@ page {
}
.tab {
flex-shrink: 0;
padding: 13rpx 22rpx;
font-size: 32rpx;
color: rgba(40, 48, 49, 1);
padding: 14rpx 32rpx;
font-size: 28rpx;
color: rgba(1, 1, 5, 0.6);
border-radius: 129rpx;
background-color: rgba(242, 244, 245, 1);
background-color: rgba(247, 247, 250, 1);
display: flex;
align-items: center;
gap: 8rpx;
@ -485,7 +507,7 @@ page { @@ -485,7 +507,7 @@ page {
}
&.active {
color: #fff;
background: linear-gradient( 180deg, #FC684F 0%, #F33D31 100%);
background: linear-gradient(180deg, #fc684f 0%, #f33d31 100%);
.icon {
display: none;
}
@ -512,7 +534,7 @@ page { @@ -512,7 +534,7 @@ page {
justify-content: center;
color: rgba(255, 255, 255, 1);
border-radius: 6rpx;
background: linear-gradient( 180deg, #FC684F 0%, #F33D31 100%);
background: linear-gradient(180deg, #fc684f 0%, #f33d31 100%);
}
.content {
padding: 0 16rpx;
@ -524,6 +546,12 @@ page { @@ -524,6 +546,12 @@ page {
color: rgba(40, 48, 49, 1);
}
}
.none {
display: block;
margin: 30rpx auto;
width: 344rpx;
max-height: 302rpx;
}
}
}
}

315
src/pages/ask/index.ts

@ -1,26 +1,20 @@ @@ -1,26 +1,20 @@
import dayjs from 'dayjs'
const licia = require('miniprogram-licia')
const app = getApp<IAppOption>()
interface IMessageItem {
msgId: string
msgContentType: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' // 1:文本 2: 出诊时间 3: adl卡片 4: 语音 5: 欢迎语 6:补充真实姓名 7: 提醒完善信息 8: 复诊卡片 9:患者恢复复诊消息
msgContentType: '1' // 1: 文本
msgContent: any
msgVisitTime: string
msgFromType: '1' | '2' // 1: 患者 2: 医生
isPlay?: boolean
welcomeMsg?: {
hotQuestion: Item[]
}
msgCreateTime: string // 消息创建时间
msgCreateTimeName?: string // 消息创建时间
showTime?: boolean
ReVisitInfo?: any
}
interface Item {
questionId: string
question: string
questionId?: string // 问题ID
Reference?: string // 参考资料
LikeTimes?: number // 点赞次数
}
Page({
@ -32,213 +26,167 @@ Page({ @@ -32,213 +26,167 @@ Page({
questionActive: 0,
questionList: [] as any,
questionActiveList: [] as Item[],
questionActiveList: [] as any[],
headerQuestionList: [] as any,
isLoad: false,
isFinish: false,
messageList: [
{
msgId: '1668',
msgContentType: '1',
msgContent: '您最近一次复诊时间是2025年4月23日;我的方案是:血浆置换',
welcomeMsg: '',
msgVisitTimeType: '0',
msgVisitTime: '',
msgFromType: '1',
ReVisitInfo:
'{"loginState":"lszdadaa0ca7fecc7d2ff8dee1091de8c214","visitDate":"2025-04-23","recordId":33,"hormone":2,"traditionalInhibitor":2,"gammaGlobulin":2,"plasmaExchange":1,"bCellInhibitor":2,"fcRnAntagonists":2,"c5ComplementInhibitor":2,"chineseMedicine":2,"other":2,"reVisitSolution":["血浆置换"]}',
msgCreateTime: '2025-05-23 11:58:23',
},
{
msgId: '1668',
msgContentType: '1',
msgContent: '您最近一次复诊时间是2025年4月23日;我的方案是:血浆置换',
welcomeMsg: '',
msgVisitTimeType: '0',
msgVisitTime: '',
msgFromType: '2',
ReVisitInfo:
'{"loginState":"lszdadaa0ca7fecc7d2ff8dee1091de8c214","visitDate":"2025-04-23","recordId":33,"hormone":2,"traditionalInhibitor":2,"gammaGlobulin":2,"plasmaExchange":1,"bCellInhibitor":2,"fcRnAntagonists":2,"c5ComplementInhibitor":2,"chineseMedicine":2,"other":2,"reVisitSolution":["血浆置换"]}',
msgCreateTime: '2025-05-23 11:58:23',
},
] as IMessageItem[],
messageList: [] as IMessageItem[],
nextMsgId: '',
unReadCount: 0,
firstNotReadMsgId: 0,
isVisitAdl: 2,
adlMsgId: 0,
week: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
timeDay: { 1: '上午', 2: '下午' },
LikeTimes: 0,
userInfo: {},
},
innerAudioContext: null as WechatMiniprogram.InnerAudioContext | null,
onLoad() {
this.innerAudioContext = wx.createInnerAudioContext({
useWebAudioImplement: true,
})
app.waitLogin({}).then(() => {
this.getQuestionList()
this.getMessageList()
app.getUserInfo(this, true, (userInfo) => {
onLoad(options) {
app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_FAQ' })
app.getUserInfo().then((userInfo) => {
this.setData({
userInfo,
})
})
})
},
onUnload() {
if (this.innerAudioContext) {
this.innerAudioContext.stop()
this.getQuestionList()
this.getHeaderQuestionList()
if (options.id) {
this.getDetail(options.id)
}
})
},
handleView(index = -1) {
this.setData({
scrollIntoView: index > -1 ? `view${index}` : `place`,
})
},
getDoctorDetail() {
getHeaderQuestionList() {
wx.ajax({
method: 'GET',
url: '?r=zd/message-interact/get-bind-doctor-info',
url: '?r=wtx/common-question/concerned-list',
data: {},
}).then((res) => {
this.setData({
doctorDetail: {
...res,
},
headerQuestionList: res.list,
})
})
},
getDetail(Id: string) {
wx.ajax({
method: 'GET',
url: '?r=wtx/common-question/detail',
data: { Id },
}).then((res) => {
this.handleSendQuestion(res)
})
},
getQuestionList() {
wx.ajax({
method: 'GET',
url: '?r=zd/message-interact/get-question-list',
url: '?r=wtx/common-question/type-list',
data: {},
}).then((res) => {
this.setData({
questionList: res,
questionActiveList: res[0].questionList,
questionList: res.list,
})
this.getQuestionCommonList(this.data.questionActive)
})
},
getMessageList() {
if (this.data.isLoad || this.data.isFinish) return
this.setData({
isLoad: true,
})
const nextMsgId = this.data.nextMsgId
getQuestionCommonList(questionActive: number) {
const QuestionTypeId = this.data.questionList[questionActive].Id
wx.ajax({
method: 'GET',
url: '?r=zd/message-interact/patient-get-message-list',
url: '?r=wtx/common-question/list',
data: {
nextMsgId,
QuestionTypeId,
count: 0,
},
}).then((res) => {
res.messageList.map((item) => {
if (item.msgContentType === '4') {
item.msgContent = JSON.parse(item.msgContent)
}
if (item.msgContentType === '2') {
item.msgVisitTime = item.msgVisitTimeType == 2 ? item.msgVisitTime : JSON.parse(item.msgVisitTime)
}
if (item.msgContentType === '5') {
item.welcomeMsg = JSON.parse(item.welcomeMsg)
}
if (item.msgContentType === '9') {
item.ReVisitInfo = JSON.parse(item.ReVisitInfo)
item.ReVisitInfo.visitDateName = dayjs(item.ReVisitInfo.visitDate).format('YYYY年M月DD日')
}
return item
})
if (this.data.questionActive === questionActive) {
this.setData({
messageList: [...res.messageList.reverse(), ...this.data.messageList],
nextMsgId: res.nextMsgId,
unReadCount: res.unReadCount,
firstNotReadMsgId: res.firstNotReadMsgId,
isVisitAdl: res.isVisitAdl,
adlMsgId: res.adlMsgId,
isLoad: false,
isFinish: nextMsgId === res.nextMsgId,
questionActiveList: res.list,
})
this.filterCreateTime()
if (!nextMsgId) {
this.handleView()
}
})
},
scrolltoupper(e) {
if (e.detail.direction === 'top') {
this.getMessageList()
}
handleHeaderQuestion(e: any) {
const { index } = e.currentTarget.dataset
const { headerQuestionList } = this.data
const question = headerQuestionList[index]
this.handleQuestionClick(question.Id)
this.handleSendQuestion(question)
},
handleHot(e) {
const { index, mindex } = e.currentTarget.dataset
handleQuestion(e: any) {
const { index } = e.currentTarget.dataset
const { questionActiveList } = this.data
const question = questionActiveList[index]
this.handleQuestionClick(question.Id)
this.handleSendQuestion(question)
},
handleSendQuestion(questionItem: any) {
const { messageList } = this.data
const hotList = messageList[mindex].welcomeMsg?.hotQuestion
const hot = hotList?.[index]
this.setData({
messageList: [
...messageList,
{
msgId: '',
msgId: new Date().getTime().toString(),
msgContentType: '1',
msgContent: hot?.question,
msgContent: questionItem.Question,
msgVisitTime: '',
msgFromType: '1',
msgCreateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
},
],
})
this.handleView()
this.sendQuestion(hot?.questionId)
},
handleQuestion(e) {
const { index } = e.currentTarget.dataset
const { questionActiveList, messageList } = this.data
const question = questionActiveList[index]
this.setData({
messageList: [
...messageList,
{
msgId: '',
msgId: new Date().getTime().toString(),
msgContentType: '1',
msgContent: question.question,
msgContent: questionItem.Answer,
questionId: questionItem.Id,
Reference: questionItem.Reference,
LikeTimes: questionItem.LikeTimes,
msgVisitTime: '',
msgFromType: '1',
msgFromType: '2',
msgCreateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
},
],
})
this.sendQuestion(question.questionId)
this.handleView()
},
sendQuestion(questionId) {
handleQuestionClick(Id) {
wx.ajax({
method: 'POST',
url: '?r=zd/message-interact/send-question-message',
data: {
questionId,
url: '?r=wtx/common-question/click',
data: { Id },
})
},
}).then((res) => {
handleLike(e) {
const { index } = e.currentTarget.dataset
const { messageList, LikeTimes } = this.data
const item = messageList[index]
const LikeTimesKey = `messageList[${index}].LikeTimes`
const IsLikeKey = `messageList[${index}].IsLike`
this.setData({
messageList: [
...this.data.messageList,
{
msgId: '',
msgContentType: '1',
msgContent: res,
msgVisitTime: '',
msgFromType: '2',
msgCreateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
},
],
[LikeTimesKey]: Number(item.LikeTimes) + 1,
[IsLikeKey]: true,
LikeTimes: LikeTimes + 1,
})
this.filterCreateTime()
this.handleView()
this.likePost(item.questionId)
},
likePost: licia.debounce(function (this: any, Id) {
const { LikeTimes } = this.data
this.setData({
LikeTimes: 0,
})
wx.ajax({
method: 'POST',
url: '?r=wtx/common-question/like',
data: {
Id,
LikeTimes,
},
})
}, 1000),
formatTime(date: string) {
let msgCreateTimeName = ''
if (dayjs().format('YYYY-MM-DD') === dayjs(date).format('YYYY-MM-DD')) {
@ -279,96 +227,21 @@ Page({ @@ -279,96 +227,21 @@ Page({
const { index } = e.currentTarget.dataset
this.setData({
questionActive: index,
questionActiveList: this.data.questionList[index].questionList,
})
},
handleDoctorDetail() {
const { doctorId } = this.data.doctorDetail
wx.navigateTo({
url: `/pages/doctorDetail/index?id=${doctorId}`,
})
},
handleRead() {
const { firstNotReadMsgId, messageList } = this.data
const index = messageList.findIndex((item) => `${item.msgId}` === `${firstNotReadMsgId}`)
this.handleView(index)
this.setData({
unReadCount: 0,
})
this.getQuestionCommonList(index)
},
handleFooter() {
app.mpBehavior({ PageName: 'BTN_PATIENTINTERACTIONCHOOSEQUESTION' })
this.setData({
expend: !this.data.expend,
})
if (this.data.expend) {
// this.getQuestionList()
setTimeout(() => {
this.handleView()
}, 300)
}
},
handleAdl() {
wx.navigateTo({
url: '/pages/adl/index',
})
},
handleAudio(e) {
const { index } = e.currentTarget.dataset
const { messageList } = this.data
const messageItem = messageList[index]
const { url } = messageItem.msgContent[0]
if (this.innerAudioContext) {
if (messageItem.isPlay) {
this.innerAudioContext.stop()
messageItem.isPlay = false
this.setData({
messageList,
})
return
}
this.innerAudioContext.stop()
this.innerAudioContext.src = url
this.innerAudioContext.play()
messageItem.isPlay = true
this.innerAudioContext.onEnded(() => {
messageItem.isPlay = false
this.setData({
messageList,
})
})
this.setData({
messageList,
})
}
},
handleFillUserInfo() {
wx.navigateTo({
url: '/pages/personalInformation/index',
})
},
handleReferral() {
this.setData({
referralFromShow: true,
})
},
handleReferralReplay(e) {
const params = e.detail
this.setData({
messageList: [
...this.data.messageList,
{
msgId: '',
msgContentType: '9',
msgVisitTime: '',
msgContent: '',
msgFromType: '1',
msgCreateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
ReVisitInfo: {
...params,
visitDateName: dayjs(params.visitDate).format('YYYY年M月DD日'),
},
},
],
})
handleBack() {
wx.navigateBack()
},
})

104
src/pages/ask/index.wxml

@ -1,7 +1,10 @@ @@ -1,7 +1,10 @@
<navbar fixed title="大家都在问" custom-style="background:{{background}}" back>
<van-icon name="arrow-left" slot="left" size="18px" color="#000" />
<van-icon name="arrow-left" slot="left" size="18px" color="#000" bind:tap="handleBack" />
</navbar>
<view class="page" style="background: url('{{imageUrl}}bg1.png?t={{Timestamp}}') no-repeat top center/100% 602rpx;padding-top:{{pageTop+21}}px;">
<view
class="page"
style="background: url('{{imageUrl}}bg1.png?t={{Timestamp}}') no-repeat top center/100% 602rpx;padding-top:{{pageTop+21}}px;"
>
<view class="page-container" id="page-container">
<scroll-view
class="scroll-view"
@ -11,7 +14,6 @@ @@ -11,7 +14,6 @@
scroll-with-animation
bindscrolltoupper="scrolltoupper"
>
<van-loading wx:if="{{isLoad && !isFinish}}" />
<view class="first-ask">
<view class="f-header">
<image class="avatar" src="{{imageUrl}}avatar1.png?t={{Timestamp}}"></image>
@ -19,9 +21,7 @@ @@ -19,9 +21,7 @@
</view>
<view class="f-list">
<view class="content">关于血友病B 的基因治疗相关的问题,您关心哪些?我可以为您解答哦~</view>
<view class="l-item">1.基因疗法适合多大年龄?</view>
<view class="l-item">1.基因疗法适合多大年龄?</view>
<view class="l-item">1.基因疗法适合多大年龄?</view>
<view class="l-item" wx:for="{{headerQuestionList}}" wx:key="Id" bind:tap="handleHeaderQuestion" data-index="{{index}}">{{item.Question}}</view>
</view>
</view>
<view wx:for="{{messageList}}" wx:key="msgId" wx:for-item="message" wx:for-index="mIndex" id="view{{mIndex}}">
@ -52,68 +52,15 @@ @@ -52,68 +52,15 @@
<image class="icon" src="{{imageUrl}}/doctor/icon-down1.png?t={{Timestamp}}"></image>
</view>
</view>
<view class="message" wx:elif="{{message.msgContentType==='1'}}">{{message.msgContent}}</view>
<view class="week" wx:elif="{{message.msgContentType==='2'}}">
<view class="w-title">以下是我的出诊时间</view>
<view class="w-container">
<view wx:if="{{message.msgVisitTimeType==2}}" class="w-content pre-line">{{message.msgVisitTime}}</view>
<block wx:else>
<view class="row" wx:for="{{message.msgVisitTime}}" wx:key="index">
<view class="label">{{week[item.weekday-1]}}</view>
<view class="content">{{timeDay[item.timeType]}}</view>
</view>
</block>
</view>
<view class="message" wx:elif="{{message.msgContentType==='1'}}">
<view>{{message.msgContent || '您的问题我收到啦!我会继续努力,尽快帮您找到答案的~'}}</view>
<view class="reference" wx:if="{{message.Reference}}">{{message.Reference}}</view>
<view class="m-footer" bind:tap="handleLike" data-index="{{mIndex}}">
<image wx:if="{{message.IsLike}}" class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon10.png?t={{Timestamp}}"></image>
<view class="num {{detail.IsLike && 'active'}}" wx:if="{{message.LikeTimes>0}}">
{{message.LikeTimes}}
</view>
<view
class="adl"
wx:elif="{{message.msgContentType==='3'}}"
style="padding-top: {{top+25}}px;background: url({{imageUrl}}/doctor/d_interactive-adl-bg.png?t={{Timestamp}}) no-repeat bottom right / 268rpx 222rpx,#D74D75;"
>
<image
class="title"
src="{{imageUrl}}/doctor/d_interactiveTitle1.png?t={{Timestamp}}"
mode="aspectFit"
></image>
<view class="sub-title">ADL+激素双达标</view>
<view class="btn" bind:tap="handleAdl">点击进入ADL</view>
<view class="tip">建议您定期做ADL测评</view>
</view>
<view
class="audio"
wx:elif="{{message.msgContentType==='4'}}"
bind:tap="handleAudio"
data-index="{{mIndex}}"
>
<image
wx:if="{{message.isPlay}}"
class="icon"
src="{{imageUrl}}/doctor/audio-right.gif?t={{Timestamp}}"
mode="aspectFit"
></image>
<image
wx:else
class="icon"
src="{{imageUrl}}/doctor/audio-right.png?t={{Timestamp}}"
mode="aspectFit"
></image>
{{message.msgContent[0].duration}}''
</view>
<view class="info" wx:elif="{{message.msgContentType==='6'}}">
<view class="content">{{message.msgContent}}</view>
<view class="btn" bind:tap="handleFillUserInfo">提交您的真实姓名</view>
</view>
<view class="info" wx:elif="{{message.msgContentType==='7'}}">
<view class="content">{{message.msgContent}}</view>
<view class="btn" bind:tap="handleFillUserInfo">完善个人信息</view>
</view>
<view class="referral" bind:tap="handleReferral" wx:elif="{{message.msgContentType==='8'}}">
<view class="r-header">
<view class="title">您最近有按照医生的 提醒,定期复诊吗?</view>
<image class="icon" src="{{imageUrl}}5/hostipal.png?t={{Timestamp}}"></image>
</view>
<view class="r-footer">
<view class="btn">已复诊</view>
</view>
</view>
</view>
@ -123,7 +70,7 @@ @@ -123,7 +70,7 @@
<view class="message" wx:if="{{message.msgContentType==='1'}}">{{message.msgContent}}</view>
</view>
<view class="avatar">
<image class="a-img" mode="aspectFill" src="{{userInfo.UserImg}}"></image>
<image class="a-img" mode="aspectFill" src="{{userInfo.Avatar}}"></image>
</view>
</view>
</view>
@ -131,14 +78,9 @@ @@ -131,14 +78,9 @@
</scroll-view>
</view>
<view class="page-footer {{expend && 'expend'}}" catch:tap="handleFooter">
<view class="unread" catch:tap="handleRead" wx:if="{{unReadCount}}">
您有{{unReadCount}}条新消息
<van-icon name="arrow-down" />
</view>
<view class="line"></view>
<view class="title" wx:if="{{!expend}}">
<view class="title">
<image class="icon" src="{{imageUrl}}icon11.png?t={{Timestamp}}"></image>
请选择您要咨询的问题
我要提问
</view>
<view class="tabs" wx:if="{{expend}}">
<view
@ -148,12 +90,7 @@ @@ -148,12 +90,7 @@
catch:tap="handleQuestionTab"
data-index="{{index}}"
>
<image class="icon" src="{{imageUrl}}/doctor/d_interactivePatient-tab{{index%4+1}}.png?t={{Timestamp}}"></image>
<image
class="icon-active"
src="{{imageUrl}}/doctor/d_interactivePatient-tab-active{{index%4+1}}.png?t={{Timestamp}}"
></image>
{{item.typeName}}
{{item.Name}}
</view>
</view>
<view class="list" wx:if="{{expend}}">
@ -165,11 +102,10 @@ @@ -165,11 +102,10 @@
data-index="{{index}}"
>
<view class="order">{{index+1}}</view>
<view class="content">{{item.question}}</view>
<view class="content">{{item.Question}}</view>
<van-icon color="#ADB3B4" name="arrow" />
</view>
<image class="none" src="{{imageUrl}}none.png" mode="widthFix" wx:if="{{!questionActiveList.length}}"></image>
</view>
</view>
</view>
<referralFrom model:show="{{referralFromShow}}" bind:refresh="handleReferralReplay"></referralFrom>

36
src/pages/index/index.scss

@ -80,16 +80,27 @@ @@ -80,16 +80,27 @@
.module-item {
border-radius: 24rpx;
background: #ffffff;
position: relative;
.item-img {
border-radius: 24rpx 24rpx 0 0;
border-radius: 24rpx;
width: 424rpx;
height: 220rpx;
height: 317rpx;
}
.item-title {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
padding: 20rpx;
font-size: 28rpx;
color: #010105;
line-height: 32rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
background-color: #fff;
border-radius: 0 0 24rpx 24rpx;
}
}
}
@ -128,13 +139,18 @@ @@ -128,13 +139,18 @@
display: none;
}
.module-item {
flex-shrink: 0;
padding: 24rpx 32rpx;
width: 424rpx;
box-sizing: border-box;
border-radius: 24rpx;
border: 2rpx solid #ffffff;
background: linear-gradient(12deg, #ffffff 0%, #ffe8e6 100%);
display: flex;
flex-direction: column;
justify-content: space-between;
.item-header {
flex-shrink: 0;
padding-bottom: 24rpx;
display: flex;
align-items: center;
@ -152,19 +168,30 @@ @@ -152,19 +168,30 @@
}
}
.content {
padding: 16rpx 0;
font-size: 28rpx;
color: #010105;
line-height: 48rpx;
height: 96rpx;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.item-footer {
flex-shrink: 0;
display: flex;
justify-content: flex-end;
margin-top: 24rpx;
.star {
font-size: 24rpx;
color: #f23a2f;
display: flex;
align-items: center;
.icon {
width: 24rpx;
flex-shrink: 0;
width: 28rpx;
height: 28rpx;
}
}
@ -173,3 +200,4 @@ @@ -173,3 +200,4 @@
}
}
}
}

25
src/pages/index/index.ts

@ -11,6 +11,7 @@ Page({ @@ -11,6 +11,7 @@ Page({
userInfo: {},
bannerList: [],
knowledgeList: [] as any,
questionList: [] as any,
pageTop: '',
background: 'transparent',
@ -26,6 +27,7 @@ Page({ @@ -26,6 +27,7 @@ Page({
})
this.getBanner()
this.getKnowledgeList()
this.getQuestionList()
})
},
getBanner() {
@ -50,18 +52,32 @@ Page({ @@ -50,18 +52,32 @@ Page({
})
})
},
getQuestionList() {
wx.ajax({
method: 'GET',
url: '?r=wtx/common-question/index-list',
data: {},
}).then((res) => {
this.setData({
questionList: res.list,
})
})
},
onBannerItemTap(e: any) {
app.mpBehavior({ PageName: 'BTN_HOMEBANNER' })
const { path } = e.currentTarget.dataset
wx.navigateTo({
url: path,
})
},
handleKnowledge() {
app.mpBehavior({ PageName: 'BTN_HOMEEDUCATIONALL' })
wx.switchTab({
url: '/pages/knowledge/index',
})
},
handleKnowledgeDetail(e: any) {
app.mpBehavior({ PageName: 'BTN_HOMEEDUCATIONCARD' })
const { index } = e.currentTarget.dataset
const params = this.data.knowledgeList[index]
if (params.Type == 1) {
@ -76,6 +92,15 @@ Page({ @@ -76,6 +92,15 @@ Page({
},
routerTo(e) {
const { url } = e.currentTarget.dataset
let PageName = {
'/pages/applyFrom/index': 'BTN_HOMEPREAPPLYCARD',
}[url]
if (url.includes('/pages/ask/index')) {
PageName = 'BTN_HOMEFAQENTRY'
}
if (PageName) {
app.mpBehavior({ PageName })
}
wx.navigateTo({
url,
})

10
src/pages/index/index.wxml

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
bindtap="handleKnowledgeDetail"
data-index="{{index}}"
>
<image class="item-img" src="{{item.CoverImg}}"></image>
<image class="item-img" mode="aspectFill" src="{{item.CoverImg}}"></image>
<view class="item-title">{{item.Title}}</view>
</view>
</view>
@ -57,16 +57,16 @@ @@ -57,16 +57,16 @@
</view>
</view>
<view class="module-list">
<view class="module-item" bindtap="onModuleItemTap" data-id="1">
<view class="module-item" wx:for="{{questionList}}" wx:key="Id" bindtap="routerTo" data-url="/pages/ask/index?id={{item.Id}}">
<view class="item-header">
<image class="icon" src="{{imageUrl}}icon2.png?t={{Timestamp}}"></image>
<view class="title">基因疗法适合多大年龄?</view>
<view class="title">{{item.Question}}</view>
</view>
<view class="content">目前的治疗方案适合 18 岁以上成人,暂不支持儿童及...</view>
<view class="content">{{item.Answer}}</view>
<view class="item-footer">
<view class="star">
<image class="icon" src="{{imageUrl}}icon3.png?t={{Timestamp}}"></image>
123
{{item.LikeTimes}}
</view>
</view>
</view>

14
src/pages/knowledge/index.scss

@ -7,11 +7,14 @@ page { @@ -7,11 +7,14 @@ page {
.list {
.list-item {
margin-bottom: 24rpx;
padding: 30rpx;
border-radius: 24rpx;
display: flex;
background-color: #fff;
.photo {
flex-shrink: 0;
width: 208rpx;
height: 140rpx;
height: 156rpx;
.photo-img {
width: 100%;
height: 100%;
@ -21,10 +24,19 @@ page { @@ -21,10 +24,19 @@ page {
.wrap {
flex: 1;
padding-left: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 32rpx;
color: rgba(1, 1, 5, 1);
line-height: 44rpx;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.w-footer {
margin-top: 20rpx;

1
src/pages/knowledge/index.ts

@ -13,6 +13,7 @@ Page({ @@ -13,6 +13,7 @@ Page({
},
onShow() {
app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_EDUCATION' })
this.getList()
})
},

3
src/pages/knowledgeDetail/index.json

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
{
"navigationBarTitleText": "知识库详情",
"usingComponents": {
"mp-html": "mp-html"
"mp-html": "mp-html",
"star": "/components/star/index"
}
}

17
src/pages/knowledgeDetail/index.scss

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
.page {
padding: 60rpx 30rpx;
padding: 60rpx 30rpx calc(120rpx + env(safe-area-inset-bottom));
.title {
font-size: 40rpx;
color: rgba(1, 1, 5, 1);
@ -30,6 +30,18 @@ @@ -30,6 +30,18 @@
}
}
}
.animate {
position: fixed;
z-index: 1;
left: 1000000px;
bottom: calc(env(safe-area-inset-bottom) + 80rpx);
transform: translateX(-50%);
width: 200rpx;
height: 400rpx;
&.active {
left: 75%;
}
}
.footer {
position: fixed;
bottom: 0;
@ -59,9 +71,12 @@ @@ -59,9 +71,12 @@
.num {
margin-left: 12rpx;
font-size: 32rpx;
color: rgba(1, 1, 5, 0.4);
&.active {
color: rgba(242, 58, 47, 1);
}
}
}
.line {
height: 28rpx;
width: 1px;

25
src/pages/knowledgeDetail/index.ts

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
const dayjs = require('dayjs')
const licia = require('miniprogram-licia')
const app = getApp<IAppOption>()
@ -6,6 +7,8 @@ Page({ @@ -6,6 +7,8 @@ Page({
id: '',
detail: {} as any,
LikeTimes: 0,
starShow: false,
},
onLoad(options) {
this.setData({
@ -34,16 +37,30 @@ Page({ @@ -34,16 +37,30 @@ Page({
Id: this.data.id,
},
}).then((res) => {
res.UpdateTime = dayjs(res.UpdateTime).format('YYYY-MM-DD')
this.setData({
detail: res,
})
})
},
_timer: null as any,
handleLike() {
this.setData({
'detail.LikeTimes': Number(this.data.detail.LikeTimes) + 1,
'detail.IsLike': true,
LikeTimes: this.data.LikeTimes + 1,
starShow: true,
})
const header = this.selectComponent('#animate')
header.start()
if (this._timer) {
clearInterval(this._timer)
}
this._timer = setTimeout(() => {
this.setData({
starShow: false,
})
}, 2000)
this.likePost()
},
likePost: licia.debounce(function (this: any) {
@ -58,17 +75,17 @@ Page({ @@ -58,17 +75,17 @@ Page({
Id: id,
LikeTimes,
},
}).then(() => {
this.getDetail()
})
}, 1000),
onShareAppMessage() {
this.setData({
'detail.ShareTimes': Number(this.data.detail.ShareTimes) + 1,
'detail.IsShare': true,
})
wx.ajax({
method: 'POST',
url: '?r=wtx/knowledge/share',
data: { Id: this.data.id },
}).then(() => {
this.getDetail()
})
},
})

11
src/pages/knowledgeDetail/index.wxml

@ -8,15 +8,18 @@ @@ -8,15 +8,18 @@
</view>
</view>
<mp-html class="mp-html" content="{{detail.Content}}"></mp-html>
<star id="animate" class="animate {{starShow&&'active'}}"></star>
<view class="footer">
<button class="btn" open-type="share">
<image class="icon" src="{{imageUrl}}icon7.png?t={{Timestamp}}"></image>
<view class="num" wx:if="{{detail.ShareTimes>0}}">{{detail.ShareTimes}}</view>
<image wx:if="{{detail.IsShare}}" class="icon" src="{{imageUrl}}icon7.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon9.png?t={{Timestamp}}"></image>
<view class="num {{detail.IsShare && 'active'}}" wx:if="{{detail.ShareTimes>0}}">{{detail.ShareTimes}}</view>
</button>
<view class="line"></view>
<view class="btn" bindtap="handleLike">
<image class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
<view class="num" wx:if="{{detail.LikeTimes>0}}">{{detail.LikeTimes}}</view>
<image wx:if="{{detail.IsLike}}" class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon10.png?t={{Timestamp}}"></image>
<view class="num {{detail.IsLike && 'active'}}" wx:if="{{detail.LikeTimes>0}}">{{detail.LikeTimes}}</view>
</view>
</view>
</view>

4
src/pages/knowledgeDetailVideo/index.json

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
"navigationStyle": "custom",
"usingComponents": {
"mp-video-swiper": "@miniprogram-component-plus/video-swiper",
"navbar": "/components/navbar/index"
"navbar": "/components/navbar/index",
"van-slider": "@vant/weapp/slider/index",
"star": "/components/star/index"
}
}

32
src/pages/knowledgeDetailVideo/index.scss

@ -11,6 +11,14 @@ @@ -11,6 +11,14 @@
width: 100%;
height: 100%;
}
.play {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90rpx;
height: 104rpx;
}
.swiper-item-footer {
padding: 80rpx 30rpx calc(34rpx + env(safe-area-inset-bottom));
width: 100%;
@ -23,8 +31,15 @@ @@ -23,8 +31,15 @@
font-size: 32rpx;
color: rgba(255, 255, 255, 1);
}
.progress {
margin-top: 24rpx;
.slider-btn {
width: 200vw;
height: 80rpx;
}
}
.container {
margin-top: 32rpx;
margin-top: 24rpx;
width: 100%;
display: flex;
align-items: center;
@ -69,11 +84,26 @@ @@ -69,11 +84,26 @@
margin-top: 6rpx;
font-size: 32rpx;
color: rgba(255, 255, 255, 1);
&.active {
color: rgba(246, 74, 58, 1);
}
}
}
}
}
}
}
}
}
.animate {
position: fixed;
z-index: 10000000;
right: 1000000px;
bottom: calc(env(safe-area-inset-bottom) + 110rpx);
width: 200rpx;
height: 400rpx;
&.active {
right: -20rpx;
}
}

110
src/pages/knowledgeDetailVideo/index.ts

@ -15,6 +15,8 @@ Page({ @@ -15,6 +15,8 @@ Page({
beforeEnd: false,
afterLoading: false,
afterEnd: false,
starShow: false,
},
onLoad(options) {
this.setData({
@ -43,39 +45,43 @@ Page({ @@ -43,39 +45,43 @@ Page({
data: {
Id: this.data.id,
},
}).then((res) => {
}).then(async (res) => {
this.setData({
videoList: [res],
afterLoading: true,
beforeLoading: true,
})
this.playCurrentVideo()
this.getList('before')
this.getList('after')
await this.getList('after')
await this.getList('before')
})
},
getList(sort: 'before' | 'after') {
const { videoList, id, current } = this.data
wx.ajax({
const { id } = this.data
return wx
.ajax({
method: 'GET',
url: '?r=wtx/knowledge/video-sort-list',
data: {
Id: id,
sort,
},
}).then((res) => {
})
.then((res) => {
const { videoList, current } = this.data
if (sort === 'before') {
const newVideoList = [...res.list, ...videoList]
this.setData({
videoList: newVideoList,
beforeLoading: false,
current: newVideoList.length - 1 + current,
current: res.list.length + current,
beforeEnd: res.length === 0,
})
}
if (sort === 'after') {
const newVideoList = [...videoList, ...res.list]
this.setData({
videoList: videoList.concat(res.list),
videoList: newVideoList,
afterLoading: false,
afterEnd: res.length === 0,
})
@ -87,6 +93,7 @@ Page({ @@ -87,6 +93,7 @@ Page({
const { current } = e.detail
this.setData({
current,
starShow: false,
})
if (current === 0 && !beforeLoading && beforeEnd) {
this.setData({
@ -108,6 +115,7 @@ Page({ @@ -108,6 +115,7 @@ Page({
if (!item.ctx) {
item.ctx = wx.createVideoContext(`video-${item.Id}`)
}
item.drag = false
if (index === current) {
item.ctx.play()
} else {
@ -115,15 +123,85 @@ Page({ @@ -115,15 +123,85 @@ Page({
}
})
},
handleLike() {
const { current, videoList } = this.data
const currentVideo = videoList[current]
handlePlay(e: any) {
const { index } = e.currentTarget.dataset
const key = `videoList[${index}].play`
this.setData({
[key]: true,
})
},
handlePause(e: any) {
const { index } = e.currentTarget.dataset
const key = `videoList[${index}].play`
this.setData({
[key]: false,
})
},
handleTimeUpdate(e: any) {
const { index } = e.currentTarget.dataset
const { videoList } = this.data
if (videoList[index].drag) return
const { currentTime, duration } = e.detail
const progress = (currentTime / duration) * 100
const progressKey = `videoList[${index}].progress`
const durationKey = `videoList[${index}].duration`
this.setData({
[progressKey]: progress,
[durationKey]: duration,
})
},
handleCustomPasue(e) {
const { index } = e.currentTarget.dataset
const { videoList } = this.data
videoList[index].ctx.pause()
},
handleCustomPlay(e: any) {
const { index } = e.currentTarget.dataset
const { videoList } = this.data
videoList[index].ctx.play()
},
handleDragStart(e: any) {
const { index } = e.currentTarget.dataset
const key = `videoList[${index}].drag`
this.setData({
[key]: true,
})
},
handleDragEnd(e: any) {
const { index } = e.currentTarget.dataset
const { videoList } = this.data
const duration = videoList[index].duration
const drapProgress = e.detail
const currentTime = (drapProgress / 100) * duration
videoList[index].ctx.seek(currentTime)
const dragKey = `videoList[${index}].drag`
this.setData({
[dragKey]: false,
})
},
_timer: null as any,
handleLike(e: any) {
const { index } = e.currentTarget.dataset
const { videoList } = this.data
const currentVideo = videoList[index]
const LikeTimes = Number(currentVideo.LikeTimes) + 1
const key = `videoList[${current}].LikeTimes`
const key = `videoList[${index}].LikeTimes`
this.setData({
LikeTimes: this.data.LikeTimes + 1,
[key]: LikeTimes,
[`videoList[${index}].IsLike`]: true,
starShow: true,
})
const header = this.selectComponent('#animate')
header.start()
if (this._timer) {
clearInterval(this._timer)
}
this._timer = setTimeout(() => {
this.setData({
starShow: false,
})
}, 2000)
this.likePost()
},
likePost: licia.debounce(function (this: any) {
@ -141,12 +219,16 @@ Page({ @@ -141,12 +219,16 @@ Page({
})
}, 1000),
onShareAppMessage() {
const { current, videoList } = this.data
const currentVideo = videoList[current]
this.setData({
[`videoList[${current}].ShareTimes`]: Number(currentVideo.ShareTimes) + 1,
[`videoList[${current}].IsShare`]: true,
})
wx.ajax({
method: 'POST',
url: '?r=wtx/knowledge/share',
data: { Id: this.data.activeId },
}).then(() => {
this.getDetail()
})
},
handleBack() {

48
src/pages/knowledgeDetailVideo/index.wxml

@ -9,29 +9,59 @@ @@ -9,29 +9,59 @@
id="video-{{item.Id}}"
class="video"
src="{{item.VideoSrc}}"
poster="{{item.CoverImg}}"
loop
object-fit="cover"
enable-play-gesture
enable-progress-gesture
show-center-play-btn="{{false}}"
play-btn-position="center"
controls="{{false}}"
bindprogress="handleProgress"
bindplay="handlePlay"
bindpause="handlePause"
bindtimeupdate="handleTimeUpdate"
data-index="{{index}}"
bind:tap="handleCustomPasue"
></video>
<image
wx:if="{{!item.play}}"
class="play"
class="play"
src="{{imageUrl}}icon19.png?t={{Timestamp}}"
catch:tap="handleCustomPlay"
data-index="{{index}}"
></image>
<view class="swiper-item-footer">
<view class="title">{{item.Title}}{{item.Id}}</view>
<view class="title">{{item.Title}}</view>
<view class="progress">
<van-slider
value="{{item.progress}}"
active-color="#fff"
bar-height="4"
inactive-color="rgba(255, 255, 255, 0.29)"
bind:drag-start="handleDragStart"
bind:change="handleDragEnd"
use-button-slot
data-index="{{index}}"
>
<view class="slider-btn" slot="button"></view>
</van-slider>
</view>
<view class="container">
<view class="user">
<image class="avatar" src="/images/logo1.png"></image>
<image class="avatar" src="{{imageUrl}}logo1.png?t={{Timestamp}}"></image>
<view class="name">基因知识库</view>
</view>
<view class="options">
<button class="o-item" open-type="share">
<image class="icon" src="{{imageUrl}}icon9.png?t={{Timestamp}}"></image>
<view class="num">{{item.ShareTimes}}</view>
<image wx:if="{{item.IsShare}}" class="icon" src="{{imageUrl}}icon7.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon20.png?t={{Timestamp}}"></image>
<view class="num {{item.IsShare && 'active'}}">{{item.ShareTimes}}</view>
</button>
<view class="o-item" bind:tap="handleLike">
<image class="icon" src="{{imageUrl}}icon10.png?t={{Timestamp}}"></image>
<view class="num">{{item.LikeTimes}}</view>
<view class="o-item" bind:tap="handleLike" data-index="{{index}}">
<image wx:if="{{item.IsLike}}" class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon21.png?t={{Timestamp}}"></image>
<view class="num {{item.IsLike && 'active'}}">{{item.LikeTimes}}</view>
</view>
</view>
</view>
@ -39,3 +69,5 @@ @@ -39,3 +69,5 @@
</swiper-item>
</swiper>
</view>
<star id="animate" class="animate {{starShow&&'active'}}"></star>

6
src/pages/login/index.wxml

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<view class="page" style="background: url('/images/bg5.png') no-repeat top center/cover;">
<view class="page" style="background: url('{{imageUrl}}bg5.png?t={{Timestamp}}') no-repeat top center/cover;">
<view class="container">
<image class="logo" src="/images/logo1.png"></image>
<image class="title" src="/images/login-title1.png"></image>
<image class="logo" src="{{imageUrl}}logo1.png?t={{Timestamp}}"></image>
<image class="title" src="{{imageUrl}}login-title1.png?t={{Timestamp}}"></image>
<button class="btn" open-type="getPhoneNumber" bindgetphonenumber="handlePhone">手机号快速授权</button>
</view>
</view>

7
src/pages/my/index.scss

@ -43,10 +43,9 @@ page { @@ -43,10 +43,9 @@ page {
margin-top: 8rpx;
font-size: 28rpx;
color: rgba(1, 1, 5, 0.4);
.num {
font-size: 36rpx;
color: rgba(242, 58, 47, 1);
}
line-height: 36rpx;
display: flex;
align-items: baseline;
}
}
.apply {

11
src/pages/my/index.ts

@ -8,9 +8,12 @@ Page({ @@ -8,9 +8,12 @@ Page({
},
onLoad() {
app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_MY' })
app.getUserInfo().then((userInfo) => {
this.setData({
userInfo,
// 数字变红
Days: userInfo.Days.replace(/(\d+)/g, '<span style="font-size: 20px;color: rgba(242, 58, 47, 1);">$1</span>'),
})
})
})
@ -65,7 +68,13 @@ Page({ @@ -65,7 +68,13 @@ Page({
url,
})
},
handleNone() {
handleNone(e: any) {
const { index } = e.currentTarget.dataset
const PageName = {
1: 'BTN_MY_SWITCHPATIENT',
2: 'BTN_MY_SWITCH_DOCTOR',
}[index]
app.mpBehavior({ PageName })
this.setData({
popupShow: true,
popupType: 'stayTuned',

6
src/pages/my/index.wxml

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
</view>
<view class="day">
今天是陪伴您的第
<text class="num">{{userInfo.Days}}</text>
<rich-text class="rich" nodes="{{Days}}"></rich-text>
</view>
</view>
</view>
@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
<view class="name">切换身份</view>
</view>
<!-- <view class="item" bind:tap="routerTo" data-url="/patient/pages/protocol/index"> -->
<view class="item" bind:tap="handleNone">
<view class="item" bind:tap="handleNone" data-index="1">
<image class="icon" src="{{imageUrl}}icon13.png?t={{Timestamp}}"></image>
<view class="wrap">
<view class="name">我已开启基因治疗</view>
@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
</view>
<image class="icon2" src="{{imageUrl}}icon12.png?t={{Timestamp}}"></image>
</view>
<view class="item" bind:tap="handleNone">
<view class="item" bind:tap="handleNone" data-index="2">
<image class="icon" src="{{imageUrl}}icon14.png?t={{Timestamp}}"></image>
<view class="wrap">
<view class="name">我是医生</view>

2
src/patient/pages/home/index.wxml

@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
<van-icon name="arrow" />
</view>
</view>
<image class="m-card" src="/images/banner1.png"></image>
<image class="m-card" src="{{imageUrl}}banner1.png?t={{Timestamp}}"></image>
</view>
<view class="module2">
<view class="m-header">

2
typings/index.d.ts vendored

@ -44,7 +44,7 @@ interface IAppOption { @@ -44,7 +44,7 @@ interface IAppOption {
getUserInfo: () => Promise<any>
startLogin: () => void
waitLogin: () => Promise<void>
mpBehavior: (data: { PageName: string; doctor?: boolean }) => void
mpBehavior: (data: { PageName: string; type?: 0 | 1 | 2 | 3 }) => void
globalSystemInfo?: globalSystemInfo
[propName: string]: any
}

Loading…
Cancel
Save