Browse Source

1.0 接口联调

master
kola-web 1 week ago
parent
commit
09522ac3a2
  1. 10
      src/app.json
  2. 97
      src/app.ts
  3. 10
      src/components/popup/index.wxml
  4. 5
      src/doc/pages/doc1/index.json
  5. 0
      src/doc/pages/doc1/index.scss
  6. 8
      src/doc/pages/doc1/index.ts
  7. 2
      src/doc/pages/doc1/index.wxml
  8. BIN
      src/images/checkbox.png
  9. 20
      src/pages/home/index.scss
  10. 121
      src/pages/home/index.ts
  11. 63
      src/pages/home/index.wxml
  12. 10
      src/pages/information/index.scss
  13. 33
      src/pages/information/index.ts
  14. 33
      src/pages/information/index.wxml
  15. 26
      src/pages/informationDetail/index.scss
  16. 74
      src/pages/informationDetail/index.ts
  17. 27
      src/pages/informationDetail/index.wxml
  18. 3
      src/pages/login/index.json
  19. 117
      src/pages/login/index.ts
  20. 32
      src/pages/login/index.wxml
  21. 12
      src/pages/message/index.ts
  22. 2
      src/pages/message/index.wxml
  23. 4
      src/pages/my/index.json
  24. 121
      src/pages/my/index.ts
  25. 41
      src/pages/my/index.wxml
  26. 3
      src/pages/start/index.json
  27. 0
      src/pages/start/index.scss
  28. 21
      src/pages/start/index.ts
  29. 0
      src/pages/start/index.wxml
  30. 3
      src/pages/webview/index.json
  31. 0
      src/pages/webview/index.scss
  32. 14
      src/pages/webview/index.ts
  33. 1
      src/pages/webview/index.wxml
  34. 72
      src/utils/page.ts
  35. 8
      typings/index.d.ts

10
src/app.json

@ -1,12 +1,20 @@ @@ -1,12 +1,20 @@
{
"$schema": "https://dldir1.qq.com/WechatWebDev/editor-extension/wx-json/app.schema.json",
"pages": [
"pages/start/index",
"pages/home/index",
"pages/login/index",
"pages/my/index",
"pages/information/index",
"pages/informationDetail/index",
"pages/message/index"
"pages/message/index",
"pages/webview/index"
],
"subPackages": [
{
"root": "doc",
"pages": ["pages/doc1/index"]
}
],
"preloadRule": {},
"window": {

97
src/app.ts

@ -22,13 +22,13 @@ App<IAppOption>({ @@ -22,13 +22,13 @@ App<IAppOption>({
// pro
// appid:wxa4a28b299df7d921
// url: 'https://m.shizhong.hbsaas.com',
// upFileUrl: 'https://m.shizhong.hbsaas.com/',
// imageUrl: 'https://m.shizhong.hbsaas.com/api/shizhong/',
// url: 'https://m.xd.hbsaas.com',
// upFileUrl: 'https://m.xd.hbsaas.com/',
// imageUrl: 'https://m.xd.hbsaas.com/api/shizhong/',
loginState: '',
isLogin: 0,
isAnswer: '0',
loginType: 0,
scene: null,
@ -42,16 +42,17 @@ App<IAppOption>({ @@ -42,16 +42,17 @@ App<IAppOption>({
wx.login({
success: (res) => {
console.log(res)
console.log(res);
wx.ajax({
method: 'GET',
url: '?r=xd/user/init-login',
data: {
code: res.code,
},
}).then((res) => {
}).then((res: any) => {
this.globalData.loginState = res.loginState;
this.globalData.isLogin = res.isLogin || 999;
this.globalData.isLogin = res.isLogin;
this.globalData.loginType = res.loginType;
});
},
});
@ -66,40 +67,68 @@ App<IAppOption>({ @@ -66,40 +67,68 @@ App<IAppOption>({
this.globalData.scene = parseScene(options.query.scene);
}
},
waitLogin(waitLoginState = false, requireLogin = false, bakcPath = '') {
let time: number;
waitLogin({ type = 0 } = { type: 'any' }) {
return new Promise((resolve) => {
time = setInterval(() => {
const { isLogin, loginState } = this.globalData;
if (loginState) {
clearInterval(time);
if (waitLoginState) {
resolve(true);
} else if (isLogin === 0 || !isLogin) {
this.globalData.backPath = bakcPath;
wx.reLaunch({ url: '/pages/login/index' });
} else if (requireLogin && isLogin === 999) {
this.globalData.backPath = bakcPath;
wx.reLaunch({ url: '/pages/login/index' });
} else {
resolve(true);
const checkLogin = () => {
if (this.globalData.loginState) {
if (this.checkLoginType(type)) {
resolve();
}
return;
}
}, 500);
setTimeout(() => {
checkLogin();
}, 500);
};
checkLogin();
});
},
getUserInfo(self: WechatMiniprogram.Page.Instance<any, any>, callback?: (res: any) => void) {
wx.ajax({
checkLoginType(type: 0 | 1 | 2 | 'any') {
const { loginType, isLogin } = this.globalData;
if (type === 'any') {
return true;
}
if (isLogin !== 1) {
if (type === 0) {
return true;
}
wx.reLaunch({
url: '/pages/login/index',
});
return false;
}
if (loginType !== type) {
const typePageUrl = {
2: '/pages/index/index',
}[type as 2];
wx.reLaunch({
url: typePageUrl,
});
return false;
}
return true;
},
getUserInfo(type: 0 | 1 | 2): Promise<never> {
const url = {
2: '?r=xd/doctor/index/get-doctor',
}[type];
return wx.ajax({
method: 'GET',
url: '?r=shizhong/account/get-info',
url,
data: {},
}).then((res) => {
if (self) {
self.setData({
userInfo: res,
});
}
callback?.(res);
}) as Promise<never>;
},
mpBehavior(data) {
wx.ajax({
method: 'POST',
url: '?r=xd/doctor/index/operate-action-submit',
data: data,
loading: false,
showMsg: false,
});
},
getMenuInfo(self) {

10
src/components/popup/index.wxml

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
>
<view
class="popup1"
style="background: url('/images/bg4.png') no-repeat top center/100% 304rpx"
style="background: url('{{imageUrl}}bg4.png?t={{Timestamp}}') no-repeat top center/100% 304rpx"
wx:if="{{type==='popup1'}}"
>
<view class="container">
@ -33,14 +33,14 @@ @@ -33,14 +33,14 @@
</view>
</view>
<view class="popup2" wx:if="{{type==='popup2'}}">
<image class="p-img" src="/images/bg5.png" show-menu-by-longpress></image>
<image class="p-img" src="{{imageUrl}}bg5.png?t={{Timestamp}}" 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>
<image class="p-img" src="{{imageUrl}}bg6.png?t={{Timestamp}}" 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>
<image class="p-img" src="{{imageUrl}}bg7.png?t={{Timestamp}}" show-menu-by-longpress></image>
</view>
<image wx:if="{{params.close}}" class="close" src="/images/icon11.png" bind:tap="handleCancel"></image>
<image wx:if="{{params.close}}" class="close" src="{{imageUrl}}icon11.png?t={{Timestamp}}" bind:tap="handleCancel"></image>
</van-popup>

5
src/doc/pages/doc1/index.json

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
{
"navigationStyle": "default",
"navigationBarTitleText": "隐私协议保护政策",
"usingComponents": {}
}

0
src/doc/pages/doc1/index.scss

8
src/doc/pages/doc1/index.ts

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
const _app = getApp<IAppOption>();
Page({
data: {},
onLoad() {},
});
export {}

2
src/doc/pages/doc1/index.wxml

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
<!--pages/story/index.wxml-->
<text>pages/story/index.wxml</text>

BIN
src/images/checkbox.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

20
src/pages/home/index.scss

@ -43,6 +43,7 @@ page { @@ -43,6 +43,7 @@ page {
font-size: 28rpx;
color: rgba(173, 172, 178, 1);
.tag {
margin-left: 10rpx;
display: inline-block;
font-size: 24rpx;
color: rgba(255, 255, 255, 1);
@ -108,11 +109,15 @@ page { @@ -108,11 +109,15 @@ page {
}
.ad {
margin-top: 32rpx;
.ad-img {
display: block;
width: 100%;
.swiper {
height: 224rpx;
box-shadow: 0 4rpx 22rpx 0 rgba(0, 0, 0, 0.03);
.ad-img {
display: block;
width: 100%;
height: 224rpx;
border-radius: 24rpx;
box-shadow: 0 4rpx 22rpx 0 rgba(0, 0, 0, 0.03);
}
}
}
.list {
@ -145,7 +150,7 @@ page { @@ -145,7 +150,7 @@ page {
border-radius: 12rpx;
}
.wrap {
padding: 12rpx 0 0 24rpx;
padding: 12rpx 24rpx 0 24rpx;
flex: 1;
display: flex;
flex-direction: column;
@ -179,6 +184,11 @@ page { @@ -179,6 +184,11 @@ page {
display: flex;
align-items: center;
gap: 12rpx;
background-color: transparent;
padding: 0;
&::after {
border: none;
}
.icon {
width: 36rpx;
height: 36rpx;

121
src/pages/home/index.ts

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
import dayjs from 'dayjs';
const app = getApp<IAppOption>();
Page({
@ -10,9 +12,112 @@ Page({ @@ -10,9 +12,112 @@ Page({
popupParams: {
close: true,
} as any,
userInfo: {},
unReadMsgCount: 0,
bannerList: [],
list: [] as any[],
total: 0,
pagination: {
page: 1,
pages: 1,
count: 1,
},
},
onShow() {
app.waitLogin({ type: 2 }).then(() => {
// this.getNotice();
this.getBanner();
this.getList();
app.getUserInfo(2).then((userInfo) => {
this.setData({
userInfo,
});
});
});
},
handleWebview() {
const encodeUrl = encodeURIComponent('https://dct.meddb.cn');
wx.navigateTo({
url: `/pages/webview/index?url=${encodeUrl}`,
});
},
getNotice() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-unread-msg-count',
data: {},
}).then((res) => {
this.setData({
unReadMsgCount: res.unReadMsgCount,
});
});
},
handleNotice() {
wx.navigateTo({
url: '/pages/message/index',
});
},
getBanner() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-banner',
data: {
count: 0,
},
}).then((res) => {
this.setData({
bannerList: res.list,
});
});
},
handleBanner(e) {
const { index } = e.currentTarget.dataset;
const { LinkUrl } = this.data.bannerList[index];
wx.navigateTo({
url: LinkUrl,
fail() {
wx.switchTab({
url: LinkUrl,
});
},
});
},
onLoad() {
// app.waitLogin().then(() => {});
getList(newPage = 1) {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-latest-material',
data: {
page: newPage,
},
}).then((res) => {
res.list.forEach((item) => {
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
});
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
total: res.count,
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
onReachBottom() {
const { page, pages } = this.data.pagination;
if (pages > page) {
this.getList(page + 1);
}
},
handleDetail(e: any) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/informationDetail/index?id=${id}`,
});
},
handlePopupOk() {
const { popupType } = this.data;
@ -23,6 +128,18 @@ Page({ @@ -23,6 +128,18 @@ Page({
popupShow: false,
});
},
onShareAppMessage(e) {
if (e.from === 'button') {
const { Title, CoverImgUrl, Id } = e.target.dataset.params;
app.mpBehavior({ PositionId: '1', OperateType: '3', OperateId: Id });
return {
title: Title,
path: `/pages/informationDetail/index?id=${Id}`,
imageUrl: CoverImgUrl,
};
}
return {};
},
});
export {};

63
src/pages/home/index.wxml

@ -1,65 +1,74 @@ @@ -1,65 +1,74 @@
<navbar fixed custom-style="background:{{background}}" back>
<image class="page-title" slot="left" src="/images/title2.png"></image>
<image class="page-title" slot="left" src="{{imageUrl}}title2.png?t={{Timestamp}}"></image>
</navbar>
<view
class="page"
style="background: url('/images/bg2.png') no-repeat top center/100% 616rpx;padding-top: {{pageTop + 20}}px;"
style="background: url('{{imageUrl}}bg2.png?t={{Timestamp}}') no-repeat top center/100% 616rpx;padding-top: {{pageTop + 20}}px;"
>
<view class="user">
<button class="avatar-wrapper">
<image
class="avatar"
src="https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567"
></image>
<image class="avatar" src="{{userInfo.Img}}"></image>
</button>
<view class="wrap">
<view class="nickname">XX医生</view>
<view class="nickname">{{userInfo.welcome}},{{userInfo.Name}}</view>
<view class="hostipal">
北京天坛医院
<view class="tag">三甲</view>
{{userInfo.HospitalName}}
<view class="tag">{{userInfo.HospitalClassificationName}}{{userInfo.HospitalLevel}}</view>
</view>
</view>
</view>
<view class="banner">
<view class="banner" bind:tap="handleWebview">
<view class="title">甲状腺眼突登记研究项目</view>
<view class="btn">点此进入EDC系统</view>
</view>
<view class="message" style="background: url('/images/bg3.png') no-repeat top center/100% 150rpx">
<view class="content dot">
<view
class="message"
wx:if="{{unReadMsgCount > 0}}"
style="background: url('{{imageUrl}}bg3.png?t={{Timestamp}}') no-repeat top center/100% 150rpx"
bind:tap="handleNotice"
>
<view class="content {{unReadMsgCount > 0 && 'dot'}}">
您有
<text class="num">5</text>
<text class="num">{{unReadMsgCount}}</text>
条新消息待查看
</view>
</view>
<view class="ad">
<image class="ad-img" src="/images/banner1.png"></image>
<swiper class="swiper">
<swiper-item
class="swiper-item"
wx:for="{{bannerList}}"
wx:key="Id"
bind:tap="handleBanner"
data-index="{{index}}"
>
<image class="ad-img" src="{{item.ImgUrl}}"></image>
</swiper-item>
</swiper>
</view>
<view class="list">
<view class="list-header">
<image class="title" src="/images/title3.png"></image>
<image class="title" src="{{imageUrl}}title3.png?t={{Timestamp}}"></image>
<view class="more">
查看全部
<van-icon name="arrow" />
</view>
</view>
<view class="card" bind:tap="handleDetail">
<image
class="photo"
src="https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567"
></image>
<view class="card" bind:tap="handleDetail" wx:for="{{list}}" wx:key="Id" data-id="{{item.Id}}">
<image class="photo" src="{{item.CoverImgUrl}}"></image>
<view class="wrap">
<view class="title">替妥尤单抗的作用机制、适用场景、使用方式</view>
<view class="title">{{item.Title}}</view>
<view class="w-footer">
<view class="date">2025-06-17</view>
<view class="date">{{item.PublishTime}}</view>
<view class="options">
<view class="o-item">
<image class="icon" src="/images/icon7.png"></image>
24
</view>
<view class="o-item">
<image class="icon" src="/images/icon8.png"></image>
<image class="icon" src="{{imageUrl}}icon7.png?t={{Timestamp}}"></image>
{{item.ReadCount}}
</view>
<button open-type="share" class="o-item" data-params="{{item}}" catch:tap="handleShare">
<image class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
</button>
</view>
</view>
</view>

10
src/pages/information/index.scss

@ -27,7 +27,7 @@ page { @@ -27,7 +27,7 @@ page {
}
}
.card {
margin: 24rpx 40rpx 0;
margin: 0 40rpx 24rpx;
padding: 12rpx;
background-color: #fff;
border-radius: 24rpx;
@ -39,7 +39,8 @@ page { @@ -39,7 +39,8 @@ page {
border-radius: 12rpx;
}
.wrap {
padding: 12rpx 0 0 24rpx;
padding: 12rpx 24rpx 0 24rpx;
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
@ -72,6 +73,11 @@ page { @@ -72,6 +73,11 @@ page {
display: flex;
align-items: center;
gap: 12rpx;
background-color: transparent;
padding: 0;
&::after {
border: none;
}
.icon {
width: 36rpx;
height: 36rpx;

33
src/pages/information/index.ts

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
const _app = getApp<IAppOption>();
import dayjs from 'dayjs';
const app = getApp<IAppOption>();
Page({
data: {
@ -9,15 +11,22 @@ Page({ @@ -9,15 +11,22 @@ Page({
count: 1,
},
},
onLoad() {},
onLoad() {
app.waitLogin({ type: 2 }).then(() => {
this.getList();
});
},
getList(newPage = 1) {
wx.ajax({
method: 'GET',
url: '?r=wtx/knowledge/list',
url: '?r=xd/doctor/index/get-material-list',
data: {
page: newPage,
},
}).then((res) => {
res.list.forEach((item) => {
item.PublishTime = dayjs(item.PublishTime).format('YYYY-MM-DD');
});
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
total: res.count,
@ -36,11 +45,25 @@ Page({ @@ -36,11 +45,25 @@ Page({
this.getList(page + 1);
}
},
handleDetail() {
handleDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: '/pages/informationDetail/index',
url: `/pages/informationDetail/index?id=${id}`,
});
},
onShareAppMessage(e) {
if (e.from === 'button') {
const { Title, CoverImgUrl, Id } = e.target.dataset.params;
app.mpBehavior({ PositionId: '2', OperateType: '3', OperateId: Id });
return {
title: Title,
path: `/pages/informationDetail/index?id=${Id}`,
imageUrl: CoverImgUrl,
};
}
return {};
},
});
export {};

33
src/pages/information/index.wxml

@ -2,30 +2,27 @@ @@ -2,30 +2,27 @@
<view
class="page"
style="background: url('/images/bg2.png') no-repeat top center/100% 616rpx;padding-top: {{pageTop + 20}}px;"
style="background: url('{{imageUrl}}bg2.png?t={{Timestamp}}') no-repeat top center/100% 616rpx;padding-top: {{pageTop + 20}}px;"
>
<view class="page-tags" style="background:{{background}};top:{{pageTop}}px;">
<view class="tag active">全部</view>
<view class="tag">安全性</view>
<view class="tag">有效性</view>
</view>
<view class="card" bind:tap="handleDetail">
<image
class="photo"
src="https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567"
></image>
<!-- <view class="page-tags" style="background:{{background}};top:{{pageTop}}px;"> -->
<!-- <view class="tag active">全部</view> -->
<!-- <view class="tag">安全性</view> -->
<!-- <view class="tag">有效性</view> -->
<!-- </view> -->
<view class="card" bind:tap="handleDetail" wx:for="{{list}}" wx:key="Id" data-id="{{item.Id}}">
<image class="photo" src="{{item.CoverImgUrl}}"></image>
<view class="wrap">
<view class="title">替妥尤单抗的作用机制、适用场景、使用方式</view>
<view class="title">{{item.Title}}</view>
<view class="w-footer">
<view class="date">2025-06-17</view>
<view class="date">{{item.PublishTime}}</view>
<view class="options">
<view class="o-item">
<image class="icon" src="/images/icon7.png"></image>
24
</view>
<view class="o-item">
<image class="icon" src="/images/icon8.png"></image>
<image class="icon" src="{{imageUrl}}icon7.png?t={{Timestamp}}"></image>
{{item.ReadCount}}
</view>
<button open-type="share" class="o-item" data-params="{{item}}" catch:tap="handleShare">
<image class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
</button>
</view>
</view>
</view>

26
src/pages/informationDetail/index.scss

@ -41,10 +41,18 @@ @@ -41,10 +41,18 @@
width: 84rpx;
height: 84rpx;
}
.content {
font-size: 32rpx;
color: rgba(33, 29, 46, 1);
line-height: 48rpx;
.wrap {
flex: 1;
.content {
font-size: 32rpx;
color: rgba(33, 29, 46, 1);
line-height: 40rpx;
}
.size {
margin-top: 8rpx;
font-size: 28rpx;
color: rgba(173, 172, 178, 1);
}
}
.btn {
flex-shrink: 0;
@ -83,6 +91,16 @@ @@ -83,6 +91,16 @@
color: rgba(140, 117, 208, 1);
line-height: 36rpx;
}
.share {
flex-shrink: 0;
margin: 0;
padding: 0;
background-color: transparent;
line-height: 1;
&::after {
border: none;
}
}
.icon {
width: 40rpx;
height: 40rpx;

74
src/pages/informationDetail/index.ts

@ -1,9 +1,14 @@ @@ -1,9 +1,14 @@
const _app = getApp<IAppOption>();
import dayjs from 'dayjs';
const app = getApp<IAppOption>();
Page({
data: {
doc: '1',
id: '',
detail: {} as any,
fileIcon: {
pdf: 'file-icon1',
doc: 'file-icon2',
@ -15,28 +20,85 @@ Page({ @@ -15,28 +20,85 @@ Page({
none: 'file-icon8',
},
},
onLoad() {},
onLoad(options) {
this.setData({
id: options.id,
});
app.waitLogin({ type: 2 }).then(() => {
app.mpBehavior({ PositionId: '1', OperateType: '1', OperateId: options.id as string });
this.getDetail();
});
},
getDetail() {
wx.ajax({
method: 'GET',
url: '?r=xd/doctor/index/get-material-detail',
data: {
Id: this.data.id,
},
}).then((res) => {
this.setData({
detail: {
...res,
PublishTime: dayjs(res.PublishTime).format('YYYY-MM-DD'),
},
});
});
},
handleDownload() {
const { detail } = this.data;
wx.showLoading({
title: '加载中',
mask: true,
});
app.mpBehavior({ PositionId: '1', OperateType: '1', OperateId: detail.Id as string });
wx.downloadFile({
url: '',
url: detail.FileUrl,
success: (res) => {
if (res.statusCode === 200) {
wx.openDocument({
filePath: res.tempFilePath,
success: () => {
console.log('打开文档成功');
wx.hideLoading();
},
fail: (err) => {
console.error('打开文档失败', err);
wx.showToast({
title: '下载文件失败',
icon: 'none',
});
wx.hideLoading();
},
});
} else {
console.error('下载文件失败', res);
wx.hideLoading();
wx.showToast({
title: '下载文件失败',
icon: 'none',
});
}
},
fail() {
wx.hideLoading();
wx.showToast({
title: '下载文件失败',
icon: 'none',
});
},
});
},
onShareAppMessage(e) {
if (e.from === 'button') {
const { Title, CoverImgUrl, Id } = this.data.detail;
app.mpBehavior({ PositionId: '3', OperateType: '3', OperateId: Id });
return {
title: Title,
path: `/pages/informationDetail/index?id=${Id}`,
imageUrl: CoverImgUrl,
};
}
return {};
},
});
export {};

27
src/pages/informationDetail/index.wxml

@ -1,25 +1,30 @@ @@ -1,25 +1,30 @@
<view class="page">
<view class="title">70年来首款新药! 信达生物替妥尤单抗国内获批上市</view>
<view class="title">{{detail.Title}}</view>
<view class="info">
<view class="date">2025-06-17</view>
<view class="date">{{detail.PublishTime}}</view>
<view class="eye">
<image class="icon" src="/images/icon9.png"></image>
24
<image class="icon" src="{{imageUrl}}icon9.png?t={{Timestamp}}"></image>
{{detail.ReadCount}}
</view>
</view>
<view class="file-card">
<image class="icon" src="/images/file-icon1.png"></image>
<view class="content">关于甲状腺眼病及其疗法</view>
<view class="file-card" wx:if="{{detail.FileUrl}}" bind:tap="handleDownload">
<image class="icon" src="/images/{{fileIcon[detail.FileType] || 'none'}}.png"></image>
<view class="wrap">
<view class="content">{{detail.FileName}}</view>
<view class="size">{{detail.FileSizeName}}</view>
</view>
<view class="btn">下载</view>
</view>
<view class="mp-html">
<mp-html content="{{doc}}"></mp-html>
<mp-html content="{{detail.Content}}"></mp-html>
</view>
<view class="page-footer">
<image class="avatar" src="/images/icon10.png"></image>
<view class="title">TED规范化诊治中心</view>
<view class="icon" src="/images/icon8.png"></view>
<image class="avatar" src="{{imageUrl}}icon10.png?t={{Timestamp}}"></image>
<view class="title">{{detail.CreateWorkerName}}</view>
<button class="share" open-type="share">
<image class="icon" src="{{imageUrl}}icon8.png?t={{Timestamp}}"></image>
</button>
</view>
</view>

3
src/pages/login/index.json

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

117
src/pages/login/index.ts

@ -1,36 +1,40 @@ @@ -1,36 +1,40 @@
const app = getApp<IAppOption>()
let timer = null as null | number
const app = getApp<IAppOption>();
let timer = null as null | number;
Page({
data: {
popupShow: false,
popupType: 'popup4', // 登录失败弹窗
popupParams: {
close: true,
} as any,
showTel: false,
mobile: '',
code: '',
codeText: '发送验证码',
check1: true,
check2: true,
check3: true,
check1: false,
},
onLoad() {},
getCode() {
if (timer) return
const mobile = this.data.mobile
if (timer) return;
const mobile = this.data.mobile;
if (!mobile) {
wx.showToast({
title: '手机号不能为空',
icon: 'none',
})
return
});
return;
}
// 验证手机号
if (!/^1[3-9,]\d{9}$/.test(mobile)) {
wx.showToast({
title: '手机号格式不正确',
icon: 'none',
})
return
});
return;
}
wx.ajax({
method: 'POST',
@ -42,38 +46,43 @@ Page({ @@ -42,38 +46,43 @@ Page({
wx.showToast({
icon: 'none',
title: '验证码已发送~',
})
let time = 60
});
let time = 60;
timer = setInterval(() => {
time--
time--;
this.setData({
codeText: `${time}s后重新发送`,
})
});
if (time <= 0) {
clearInterval(timer as number)
timer = null
clearInterval(timer as number);
timer = null;
this.setData({
codeText: '发送验证码',
})
});
}
}, 1000)
})
}, 1000);
});
},
handleCheck() {
this.setData({
check1: !this.data.check1,
});
},
handleDocRule() {
const { check1, check2, check3 } = this.data
const { check1 } = this.data;
return new Promise((resolve) => {
if (check1 && check2 && check3) {
return resolve(true)
if (check1) {
return resolve(true);
}
wx.showToast({
title: '请同意相关协议',
icon: 'none',
})
})
});
});
},
async handleSubmit() {
await this.handleDocRule()
const { mobile, code } = this.data
await this.handleDocRule();
const { mobile, code } = this.data;
wx.ajax({
method: 'POST',
url: '?r=xd/login/reg-login',
@ -81,12 +90,12 @@ Page({ @@ -81,12 +90,12 @@ Page({
mobile,
code,
},
}).then((_res) => {
this.submitCallback()
})
}).then((res) => {
this.submitCallback(res);
});
},
handleWxSubmit(e: WechatMiniprogram.CustomEvent) {
const { iv, encryptedData } = e.detail
const { iv, encryptedData } = e.detail;
if (iv && encryptedData) {
wx.ajax({
method: 'POST',
@ -95,29 +104,39 @@ Page({ @@ -95,29 +104,39 @@ Page({
iv: encodeURIComponent(iv),
encryptedData: encodeURIComponent(encryptedData),
},
}).then((_res) => {
this.submitCallback()
})
}).then((res) => {
this.submitCallback(res);
});
}
},
submitCallback() {
app.getUserInfo(2).then((res) => {
if (res.PatientId) {
wx.reLaunch({
url: `/patient/pages/index/index`,
})
} else {
wx.navigateTo({
url: `/patient/pages/entryInfo/index?aid=${res.applyIntentionId}`,
})
}
})
submitCallback(res) {
console.log('DEBUGPRINT[79]: index.ts:112: res=', res);
app.globalData.loginType = res.loginType;
app.globalData.isLogin = res.isLogin;
if (res.isLogin == 1 && res.loginType == 2) {
wx.reLaunch({
url: '/pages/home/index',
});
} else {
this.setData({
popupShow: true,
popupType: 'popup4',
popupParams: {
close: true,
},
});
}
},
handleShowTel() {
this.setData({
showTel: !this.data.showTel,
})
});
},
handleLink() {
wx.navigateTo({
url: '/doc/pages/doc1/index',
});
},
})
});
export {}
export {};

32
src/pages/login/index.wxml

@ -1,25 +1,20 @@ @@ -1,25 +1,20 @@
<view
class="page"
style="padding-top: {{pageTop + 60}}px;background:url('/images/bg1.png') no-repeat top center/100% 484rpx;"
style="padding-top: {{pageTop + 60}}px;background:url('{{imageUrl}}bg1.png?t={{Timestamp}}') no-repeat top center/100% 484rpx;"
>
<image class="logo" src="/images/logo1.png"></image>
<image class="page-title" src="/images/title1.png"></image>
<image class="logo" src="{{imageUrl}}logo1.png?t={{Timestamp}}"></image>
<image class="page-title" src="{{imageUrl}}title1.png?t={{Timestamp}}"></image>
<view class="protocol">
<view class="p-title">尊敬的医生您好</view>
<view class="p-content">
在您加入TED规范化诊治中心之前,请您阅读并充分理解
<text class="link">《隐私协议保护政策》</text>
<text class="link" bind:tap="handleLink">《隐私协议保护政策》</text>
,了解您的权益及相关数据处理方法,我们将严格按照法律法规及
<text class="link">《隐私协议保护政策》</text>
<text class="link" bind:tap="handleLink">《隐私协议保护政策》</text>
的相关规定,保证您的个人信息不受侵犯。
</view>
</view>
<button
wx:if="{{check1 && check2 && check3}}"
class="phone"
open-type="getPhoneNumber"
bindgetphonenumber="handleWxSubmit"
>
<button wx:if="{{check1 }}" class="phone" open-type="getPhoneNumber" bindgetphonenumber="handleWxSubmit">
手机号一键登录
</button>
<button wx:else class="phone" bind:tap="handleDocRule">手机号一键登录</button>
@ -27,7 +22,7 @@ @@ -27,7 +22,7 @@
<van-divider class="van-divider" contentPosition="center">或者</van-divider>
</view>
<view class="tel-btn" bind:tap="handleShowTel">
<image class="icon" src="/images/icon1.png"></image>
<image class="icon" src="{{imageUrl}}icon1.png?t={{Timestamp}}"></image>
手机号验证码
</view>
<view class="form" wx:if="{{showTel}}">
@ -56,12 +51,21 @@ @@ -56,12 +51,21 @@
</view>
<view class="signature">
<view class="row">
<image class="check" src="/images/checkbox-active.png"></image>
<image wx:if="{{check1}}" bind:tap="handleCheck" class="check" src="{{imageUrl}}checkbox-active.png?t={{Timestamp}}"></image>
<image wx:else class="check" bind:tap="handleCheck" src="{{imageUrl}}checkbox.png?t={{Timestamp}}"></image>
<view class="r-content">
我特此同意依照此
<text class="link">《隐私协议保护政策》</text>
<text class="link" bind:tap="handleLink">《隐私协议保护政策》</text>
规定收集我的个人敏感信息
</view>
</view>
</view>
</view>
<popup
show="{{popupShow}}"
type="{{popupType}}"
params="{{popupParams}}"
bind:ok="handlePopupOk"
bind:cancel="handlePopupCancel"
></popup>

12
src/pages/message/index.ts

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
const _app = getApp<IAppOption>();
const app = getApp<IAppOption>();
Page({
data: {
@ -9,11 +9,15 @@ Page({ @@ -9,11 +9,15 @@ Page({
count: 1,
},
},
onLoad() {},
onLoad() {
app.waitLogin().then(() => {
this.getList();
});
},
getList(newPage = 1) {
wx.ajax({
method: 'GET',
url: '?r=wtx/knowledge/list',
url: '?r=xd/doctor/index/get-msg-list',
data: {
page: newPage,
},
@ -38,4 +42,4 @@ Page({ @@ -38,4 +42,4 @@ Page({
},
});
export {}
export {};

2
src/pages/message/index.wxml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
</view>
<view class="c-footer">
<view class="btn">去查看</view>
<image class="more" src="/images/icon3.png"></image>
<image class="more" src="{{imageUrl}}icon3.png?t={{Timestamp}}"></image>
</view>
</view>
<view class="card2">

4
src/pages/my/index.json

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
{
"navigationStyle": "custom",
"usingComponents": {}
"usingComponents": {
"popup": "/components/popup/index"
}
}

121
src/pages/my/index.ts

@ -2,19 +2,27 @@ const app = getApp<IAppOption>(); @@ -2,19 +2,27 @@ const app = getApp<IAppOption>();
Page({
data: {
toastShow: false,
toastType: 1,
popupShow: false,
// popupType: 'popup1', // 绑定医生弹窗
// popupType: 'popup2', // 去关注弹窗
// popupType: 'popup3', // 问题反馈弹窗
popupType: 'popup4', // 登录失败弹窗
popupParams: {
close: true,
} as any,
userInfo: {} as any,
},
onShow() {
// app.waitLogin().then(() => {
// app.getUserInfo(this);
// });
app.waitLogin().then(() => {
this.getUserInfo();
});
},
handleCollection() {
wx.navigateTo({
url: '/pages/collection/index',
getUserInfo() {
app.getUserInfo(2).then((userInfo) => {
this.setData({
userInfo,
});
});
},
handleLogin() {
@ -29,12 +37,14 @@ Page({ @@ -29,12 +37,14 @@ Page({
if (res.confirm) {
wx.ajax({
method: 'POST',
url: '?r=shizhong/account/logout',
url: '?r=xd/user/reg-logout',
data: {},
}).then(() => {
app.globalData.isLogin = 0;
app.globalData.isAnswer = '0';
app.waitLogin();
}).then((res) => {
app.globalData.isLogin = res.isLogin;
app.globalData.loginType = res.loginType;
wx.reLaunch({
url: '/pages/start/index',
});
});
}
},
@ -45,48 +55,71 @@ Page({ @@ -45,48 +55,71 @@ Page({
url: '/pages/userInfo/index',
});
},
handleAvatar(e) {
const avatar = e.detail.fileUrl;
wx.ajax({
method: 'POST',
url: '?r=shizhong/account/update-info',
data: {
userName: this.data.userInfo.username,
avatar,
onChooseAvatar(e) {
const { avatarUrl } = e.detail;
const url = `${app.globalData.upFileUrl}?r=file-service/upload-img`;
wx.showLoading({
title: '上传中',
});
wx.uploadFile({
url,
filePath: avatarUrl,
name: 'file',
success: (res) => {
const data = JSON.parse(res.data);
const avatarUrl = data.data.Url;
wx.ajax({
method: 'POST',
url: '?r=xd/doctor/index/update-doctor-img',
data: {
UserImg: avatarUrl,
},
})
.then(() => {
wx.hideLoading();
wx.showToast({
title: '头像更新成功!',
icon: 'none',
});
this.setData({
'userInfo.Img': avatarUrl,
});
})
.catch(() => {
wx.hideLoading();
});
},
fail() {
wx.hideLoading();
},
}).then(() => {
app.getUserInfo(this);
});
},
handleOffice() {
wx.hideTabBar({
success: () => {
this.setData({
toastShow: true,
toastType: 1,
});
},
handleDoc() {
wx.navigateTo({
url: '/doc/pages/doc1/index',
});
},
handleCompanyOffice() {
wx.hideTabBar({
success: () => {
this.setData({
toastShow: true,
toastType: 2,
});
handlePublic() {
this.setData({
popupShow: true,
popupType: 'popup2',
popupParams: {
close: true,
},
});
},
handleToastClose() {
handleQuestion() {
this.setData({
toastShow: false,
popupShow: true,
popupType: 'popup3',
popupParams: {
close: true,
},
});
wx.showTabBar({});
},
handleTopic() {
wx.navigateTo({
url: '/pages/topic/index?back=1',
handlePopupCancel() {
this.setData({
popupShow: false,
});
},
});

41
src/pages/my/index.wxml

@ -4,36 +4,41 @@ @@ -4,36 +4,41 @@
>
<view class="user">
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image
class="avatar"
src="https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567"
></image>
<image class="avatar" src="{{userInfo.Img}}"></image>
</button>
<view class="wrap">
<view class="nickname">XX医生</view>
<view class="nickname">{{userInfo.Name}}</view>
<view class="hostipal">
北京天坛医院
<view class="tag">三甲</view>
{{userInfo.HospitalName}}
<view class="tag">{{userInfo.HospitalClassificationName}}{{userInfo.HospitalLevel}}</view>
</view>
</view>
<image class="edit" src="/images/icon2.png"></image>
<!-- <image class="edit" src="{{imageUrl}}icon2.png?t={{Timestamp}}"></image> -->
</view>
<view class="list">
<view class="list-item">
<image class="icon" src="/images/icon4.png"></image>
<view class="list-item" bind:tap="handleDoc">
<image class="icon" src="{{imageUrl}}icon4.png?t={{Timestamp}}"></image>
<view class="content">隐私协议</view>
<image class="more" src="/images/icon3"></image>
<image class="more" src="{{imageUrl}}icon3?t={{Timestamp}}"></image>
</view>
<view class="list-item">
<image class="icon" src="/images/icon5.png"></image>
<view class="list-item" bind:tap="handlePublic">
<image class="icon" src="{{imageUrl}}icon5.png?t={{Timestamp}}"></image>
<view class="content">关注公众号</view>
<image class="more" src="/images/icon3"></image>
<image class="more" src="{{imageUrl}}icon3?t={{Timestamp}}"></image>
</view>
<view class="list-item">
<image class="icon" src="/images/icon6.png"></image>
<view class="list-item" bind:tap="handleQuestion">
<image class="icon" src="{{imageUrl}}icon6.png?t={{Timestamp}}"></image>
<view class="content">问题反馈</view>
<image class="more" src="/images/icon3"></image>
<image class="more" src="{{imageUrl}}icon3?t={{Timestamp}}"></image>
</view>
</view>
<view class="login-out">退出登录</view>
<view class="login-out" bind:tap="handleLoginOut">退出登录</view>
</view>
<popup
show="{{popupShow}}"
type="{{popupType}}"
params="{{popupParams}}"
bind:ok="handlePopupOk"
bind:cancel="handlePopupCancel"
></popup>

3
src/pages/start/index.json

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
{
"usingComponents": {}
}

0
src/pages/start/index.scss

21
src/pages/start/index.ts

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
const app = getApp<IAppOption>();
Page({
data: {},
onLoad() {
app.waitLogin().then(() => {
const { isLogin, loginType } = app.globalData;
if (isLogin && loginType == 2) {
wx.reLaunch({
url: '/pages/home/index',
});
return;
}
wx.reLaunch({
url: '/pages/login/index',
});
});
},
});
export {};

0
src/pages/start/index.wxml

3
src/pages/webview/index.json

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
{
"usingComponents": {}
}

0
src/pages/webview/index.scss

14
src/pages/webview/index.ts

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

1
src/pages/webview/index.wxml

@ -0,0 +1 @@ @@ -0,0 +1 @@
<web-view src="{{src}}"></web-view>

72
src/utils/page.ts

@ -4,78 +4,78 @@ @@ -4,78 +4,78 @@
* 2app.js onLaunch Page = page
*/
const originalPage = Page
const originalPage = Page;
function page(config: WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>) {
const originalOnLoad = config.onLoad
const originalOnLoad = config.onLoad;
config.onLoad = function (options) {
setImageParams(this)
setNavBar(this)
setImageParams(this);
setNavBar(this);
if (originalOnLoad) {
originalOnLoad.call(this, options)
originalOnLoad.call(this, options);
}
}
};
const originalOnPageScroll = config.onPageScroll
const originalOnPageScroll = config.onPageScroll;
config.onPageScroll = function (options): void {
const scrollTop = options?.scrollTop
let background = 'transparent'
const scrollTop = options?.scrollTop;
let background = 'transparent';
if (Number(scrollTop) > 20) {
background = '#ffffff'
background = '#ffffff';
}
this.setData({
background,
})
});
if (originalOnPageScroll) {
originalOnPageScroll.call(this, options)
originalOnPageScroll.call(this, options);
}
}
};
const originalOnShareAppMessage = config.onShareAppMessage
const originalOnShareAppMessage = config.onShareAppMessage;
config.onShareAppMessage = function (options) {
if (originalOnShareAppMessage) {
return originalOnShareAppMessage.call(this, options)
return originalOnShareAppMessage.call(this, options);
} else {
const date = new Date()
const Timestamp = date.getTime()
const date = new Date();
const Timestamp = date.getTime();
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const url = currentPage.route
const options = currentPage.options
let urlWithArgs = `${url}?`
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const url = currentPage.route;
const options = currentPage.options;
let urlWithArgs = `${url}?`;
for (const key in options) {
const value = options[key]
urlWithArgs += `${key}=${value}&`
const value = options[key];
urlWithArgs += `${key}=${value}&`;
}
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1)
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1);
return {
title: '信达',
title: '甲状腺眼病TED规范化诊治中心',
path: url,
// imageUrl: `${getApp().globalData.imageUrl}1/1.png?t=${Timestamp}`,
}
};
}
}
};
config.handleMakePhoneCall = function () {
wx.makePhoneCall({
phoneNumber: '4008102299',
})
}
return originalPage(config)
});
};
return originalPage(config);
}
function setImageParams(
currPage: WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>,
) {
const date = new Date()
const Timestamp = date.getTime()
const date = new Date();
const Timestamp = date.getTime();
currPage.setData({
imageUrl: getApp().globalData.imageUrl,
Timestamp,
})
});
}
function setNavBar(
@ -84,7 +84,7 @@ function setNavBar( @@ -84,7 +84,7 @@ function setNavBar(
currPage.setData({
background: 'transparent',
pageTop: wx.getMenuButtonBoundingClientRect().bottom,
})
});
}
export default page
export default page;

8
typings/index.d.ts vendored

@ -6,14 +6,16 @@ interface IAppOption { @@ -6,14 +6,16 @@ interface IAppOption {
imageUrl: string;
loginState: string;
isLogin: 0 | 1 | 999;
isAnswer: '0' | '1';
loginType: 0 | 1 | 2;
scene: null | { [key: string]: any };
backPath: string;
};
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback;
waitLogin: (waitLoginState?: boolean, requireLogin?: boolean, backPath?: string) => Promise<any>;
waitLogin: (params?: { type?: 0 | 1 | 2 | 'any' }) => Promise<void>;
checkLoginType: (type: 0 | 1 | 2 | 'any') => boolean;
getMenuInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>) => void;
getUserInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>, arg1?: (arg0: any) => void) => void;
getUserInfo: (type: 0 | 1 | 2) => Promise<never>;
mpBehavior: (data: { PositionId: string; OperateType: string; OperateId: string }) => void;
}
interface IAgaxParams extends WechatMiniprogram.RequestOption {

Loading…
Cancel
Save