Browse Source

init

master
kola-web 3 months ago
commit
6dc5b680f1
  1. 12
      .editorconfig
  2. 5
      .gitignore
  3. 10
      .neoconf.json
  4. 28
      .prettierrc
  5. 10
      .vscode/settings.json
  6. 1
      2024-10-31.md
  7. 26
      README.md
  8. 5
      dist.nu
  9. 8
      dist.ps1
  10. 4
      dist.sh
  11. 28
      eslint.config.mjs
  12. 3
      index.d.ts
  13. 24
      package.json
  14. 3111
      pnpm-lock.yaml
  15. 56
      project.config.json
  16. 225
      project.private.config.json
  17. 39
      src/app.json
  18. 1
      src/app.scss
  19. 125
      src/app.ts
  20. 20
      src/components/pagination/index.js
  21. 6
      src/components/pagination/index.json
  22. 6
      src/components/pagination/index.scss
  23. 6
      src/components/pagination/index.wxml
  24. 4
      src/custom-tab-bar/index.json
  25. 130
      src/custom-tab-bar/index.scss
  26. 74
      src/custom-tab-bar/index.ts
  27. 33
      src/custom-tab-bar/index.wxml
  28. BIN
      src/images/tabbar/add.png
  29. BIN
      src/images/tabbar/tab-active1.png
  30. BIN
      src/images/tabbar/tab-active2.png
  31. BIN
      src/images/tabbar/tab-active3.png
  32. BIN
      src/images/tabbar/tab-active4.png
  33. BIN
      src/images/tabbar/tab1.png
  34. BIN
      src/images/tabbar/tab2.png
  35. BIN
      src/images/tabbar/tab3.png
  36. BIN
      src/images/tabbar/tab4.png
  37. 3
      src/pages/home/index.json
  38. 0
      src/pages/home/index.scss
  39. 6
      src/pages/home/index.ts
  40. 2
      src/pages/home/index.wxml
  41. 3
      src/pages/my/index.json
  42. 0
      src/pages/my/index.scss
  43. 6
      src/pages/my/index.ts
  44. 2
      src/pages/my/index.wxml
  45. 1
      src/sdk/Easemob-chat-4.1.4.js
  46. 1
      src/sdk/Easemob-chat-4.1.5.js
  47. 1
      src/sdk/Easemob-chat-4.1.7.js
  48. 1
      src/sdk/Easemob-chat-4.2.0.js
  49. 1
      src/sdk/Easemob-chat-4.2.1.js
  50. 1
      src/sdk/Easemob-chat-4.3.0.js
  51. 1
      src/sdk/Easemob-chat-4.3.1.js
  52. 7367
      src/sdk/Easemob-chat.d.ts
  53. 7
      src/sitemap.json
  54. 58
      src/utils/component.ts
  55. 2
      src/utils/dayjs/day-zh-cn.js
  56. 24
      src/utils/dayjs/relativeTime.d.ts
  57. 1
      src/utils/dayjs/relativeTime.js
  58. 54
      src/utils/page.ts
  59. 71
      src/utils/request.ts
  60. 64
      src/utils/util.ts
  61. 12
      src/utils/util.wxs
  62. 37
      src/utils/webIM/Dispatcher.js
  63. 48
      src/utils/webIM/Observe.js
  64. 266
      src/utils/webIM/WebIM.js
  65. 88
      src/utils/webIM/WebIMConfig.js
  66. 2
      src/utils/webIM/broadcast.js
  67. 30
      tsconfig.json
  68. 73
      typings/index.d.ts

12
.editorconfig

@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

5
.gitignore vendored

@ -0,0 +1,5 @@
node_modules
src/images/.svn
miniprogram_npm
.idea
.DS_Store

10
.neoconf.json

@ -0,0 +1,10 @@
{
"emmet_language_server": {
"init_options": {
"preferences": {
"css.intUnit": "rpx",
"css.floatUnitr": "rpx"
}
}
}
}

28
.prettierrc

@ -0,0 +1,28 @@
{
"$schema":"https://json.schemastore.org/prettierrc.json",
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "all",
"arrowParens": "always",
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "ignore",
"singleAttributePerLine": false,
"overrides": [
{
"files": "*.wxml",
"options": { "parser": "html" }
},
{
"files": "*.wxss",
"options": { "parser": "css" }
},
{
"files": "*.wxs",
"options": { "parser": "babel" }
}
]
}

10
.vscode/settings.json vendored

@ -0,0 +1,10 @@
{
"path-autocomplete.pathMappings": {
"@": "${folder}/src",
"/": "${folder}/src",
},
"emmet.preferences": {
"css.intUnit": "rpx",
"css.floatUnit": "rpx"
},
}

1
2024-10-31.md

@ -0,0 +1 @@
# 2024-10-31

26
README.md

@ -0,0 +1,26 @@
1. user 打开小程序进入 身份认证页面
2. 判断图片是否涂抹
3. 图像识别模糊 可以反向确认 通过ocr识别接口 接入ocr同时识别不到 姓名,年龄等字样,及判断该病历已被涂抹
<!--占位图像-->
https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567
images svn 地址
svn://39.106.86.127:28386/projects/takeda/proj_src/shop/frontend/web/wt
(/images/)(\S\*(?=["|']))
{{imageUrl}}$2?t={{Timestamp}}
ui问题
1. 首页绑定医生弹窗需要重新切图
2. 播放语音条图片没切
showModel颜色统一
```ts
wx.showModal({
confirmColor: "#00B4C5",
cancelColor: "#141515",
});
```

5
dist.nu

@ -0,0 +1,5 @@
cd ./src/images/;
svn add . --no-ignore --force;
svn ci -m "版本更新";
cd ..;
cd ..;

8
dist.ps1

@ -0,0 +1,8 @@
# Change to the src/images directory, or exit if the directory doesn't exist
Set-Location -Path ./src/images/ -ErrorAction Stop
# Add all files to svn, including ignored files and forced additions
svn add . --no-ignore --force
# Commit the changes with a message
svn ci -m "版本更新"

4
dist.sh

@ -0,0 +1,4 @@
#!/bin/bash
cd ./src/images/ || exit
svn add . --no-ignore --force
svn ci -m "版本更新"

28
eslint.config.mjs

@ -0,0 +1,28 @@
// eslint.config.mjs
import antfu from '@antfu/eslint-config'
import prettierConfig from 'eslint-config-prettier'
export default antfu(
{
env: {
es6: true,
},
stylistic: false,
parserOptions: { project: ['./tsconfig.json'] },
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
rules: {
'eslint-comments/no-unlimited-disable': 'off',
'ts/no-require-imports': 'off',
},
},
prettierConfig,
)

3
index.d.ts vendored

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

24
package.json

@ -0,0 +1,24 @@
{
"name": "wutian",
"version": "1.0.0",
"description": "",
"author": "",
"license": "",
"keywords": [],
"scripts": {
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@vant/weapp": "^1.11.6",
"dayjs": "^1.11.13",
"miniprogram-licia": "^1.39.2",
"typescript": "^5.3.3"
},
"devDependencies": {
"@antfu/eslint-config": "^3.7.3",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"miniprogram-api-typings": "^4.0.1",
"prettier": "^3.3.3"
}
}

3111
pnpm-lock.yaml

File diff suppressed because it is too large Load Diff

56
project.config.json

@ -0,0 +1,56 @@
{
"description": "项目配置文件",
"miniprogramRoot": "src/",
"compileType": "miniprogram",
"setting": {
"useCompilerPlugins": [
"typescript",
"sass"
],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"coverView": false,
"postcss": false,
"minified": false,
"enhance": true,
"showShadowRootInWxmlPanel": false,
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "package.json",
"miniprogramNpmDistDir": "./src"
}
],
"ignoreUploadUnusedFiles": true,
"compileHotReLoad": false,
"skylineRenderEnable": true,
"es6": true
},
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {},
"srcMiniprogramRoot": "src/",
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "2.32.3",
"packOptions": {
"ignore": [
{
"value": "src/images/*",
"type": "glob"
}
],
"include": [
{
"value": "/echart/components/ec-canvas/echarts.js",
"type": "file"
}
]
},
"appid": "wxaae50c206446a964"
}

225
project.private.config.json

@ -0,0 +1,225 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "wutian-miniprogram",
"setting": {
"compileHotReLoad": true,
"urlCheck": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "注销",
"pathName": "module1/pages/loginOut/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "module1/pages/doctorHome/index",
"pathName": "module1/pages/doctorHome/index",
"query": "id=100",
"launchMode": "default",
"scene": null
},
{
"name": "医生认证-选择医生",
"pathName": "module1/pages/setInfoDoctor/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "学习窗",
"pathName": "module1/pages/chatRoom/index",
"query": "id=4",
"launchMode": "default",
"scene": null
},
{
"name": "病历详情",
"pathName": "module1/pages/casesDetail/index",
"query": "id=25",
"launchMode": "default",
"scene": null
},
{
"name": "邀约码",
"pathName": "pages/start/index",
"query": "scene=doctorId%3D2%26inviteChan%3D1",
"launchMode": "default",
"scene": 1047
},
{
"name": "指派医生",
"pathName": "module1/pages/setDoctor/index",
"query": "id=5",
"launchMode": "default",
"scene": null
},
{
"name": "医生审核详情",
"pathName": "module1/pages/auditDoctorDetail/index",
"query": "id=5",
"launchMode": "default",
"scene": null
},
{
"name": "医生认证结果页",
"pathName": "module1/pages/setInfoResult/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "选择医院",
"pathName": "module1/pages/sHostipal/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "学习窗信息",
"pathName": "module1/pages/chatRoomInfo/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "学习窗列表",
"pathName": "pages/chatRoomList/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "病历反馈",
"pathName": "module1/pages/casesFeedback/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "录入病历结果",
"pathName": "module1/pages/entryCasesResult/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "录入病历",
"pathName": "module1/pages/entryCases/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "病历",
"pathName": "pages/cases/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "组织架构4",
"pathName": "module1/pages/org4/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "组织架构3",
"pathName": "module1/pages/org3/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "医院活跃排行榜",
"pathName": "module1/pages/doctorRankList/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "更换手机号",
"pathName": "module1/pages/changePhone/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "个人信息",
"pathName": "module1/pages/userInfo/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "我的",
"pathName": "pages/my/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "首页",
"pathName": "pages/home/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "医生审核列表",
"pathName": "module1/pages/auditDoctorList/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "创建医院结果页",
"pathName": "module1/pages/cHostipalResult/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "创建医院",
"pathName": "module1/pages/cHostipal/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "医生认证",
"pathName": "module1/pages/setInfo/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "邀约下级医生",
"pathName": "module1/pages/invite/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "注册隐私协议",
"pathName": "module1/pages/loginProtool/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "登录",
"pathName": "module1/pages/login/index",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
},
"libVersion": "3.6.3"
}

39
src/app.json

@ -0,0 +1,39 @@
{
"$schema": "https://dldir1.qq.com/WechatWebDev/editor-extension/wx-json/app.schema.json",
"pages": ["pages/home/index"],
"preloadRule": {},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle": "black",
"navigationStyle": "custom"
},
"tabBar": {
"custom": true,
"list": [
{
"pagePath": "pages/home/index",
"text": "首页"
},
{
"pagePath": "pages/my/index",
"text": "我的"
}
]
},
"resolveAlias": {
"@/*": "/*"
},
"rendererOptions": {
"skyline": {
"defaultDisplayBlock": true,
"disableABTest": true,
"sdkVersionBegin": "3.0.0",
"sdkVersionEnd": "15.255.255"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

1
src/app.scss

@ -0,0 +1 @@
/**app.wxss**/

125
src/app.ts

@ -0,0 +1,125 @@
import component from "@/utils/component";
import relativeTime from "@/utils/dayjs/relativeTime.js";
import page from "@/utils/page";
import { request } from "@/utils/request";
import { parseScene } from "./utils/util";
wx.WebIM = require("@/utils/webIM/WebIM.js").default;
const dayjs = require("dayjs");
const licia = require("miniprogram-licia");
require("/utils/dayjs/day-zh-cn.js");
dayjs.locale("zh-cn"); // 全局使用
dayjs.extend(relativeTime);
App<IAppOption>({
globalData: {
// 测试号 wx2b0bb13edf717c1d
// dev
// appid:wxaae50c206446a964
url: "https://m.takeda.hbraas.com",
upFileUrl: "https://m.takeda.hbraas.com/",
imageUrl: "https://m.takeda.hbraas.com/wt/",
// pro
// appid:wx1e025040096c7e1d
// url: 'https://m.raredheart.hbsaas.com',
// upFileUrl: 'https://m.raredheart.hbsaas.com/',
// imageUrl: 'https://m.raredheart.hbsaas.com/wt/',
loginState: "",
isLogin: 0,
doctorId: null,
scene: null,
needDeal: "",
caseNav: "0",
},
onLaunch() {
Page = page as WechatMiniprogram.Page.Constructor;
Component = component as WechatMiniprogram.Component.Constructor;
wx.ajax = licia.curry(request)({ gUrl: this.globalData.url });
wx.login({
success: (res) => {
wx.ajax({
method: "GET",
url: "?r=takeda/user/init-login",
data: {
code: res.code,
},
}).then((res) => {
this.globalData.loginState = res.loginState;
this.globalData.isLogin = res.isLogin;
this.globalData.doctorId = res.doctorId;
});
},
});
wx.setInnerAudioOption({
obeyMuteSwitch: false,
mixWithOther: false,
});
},
onShow(options) {
if (options.query.scene) {
this.globalData.scene = parseScene(options.query.scene);
}
// this.startLogin();
},
waitLogin(waitLoginState = false) {
let time: number;
return new Promise((resolve, reject) => {
time = setInterval(() => {
if (this.globalData.loginState) {
clearInterval(time);
if (waitLoginState) {
resolve(true);
} else if (this.globalData.isLogin === 0) {
reject(new Error("未登录"));
wx.reLaunch({ url: "/module1/pages/login/index" });
} else if (this.globalData.doctorId === null) {
this.getApplyDoctor().then((applyDoctorInfo) => {
if (applyDoctorInfo.AuditStatus === 0) {
wx.reLaunch({ url: "/module1/pages/setInfoResult/index" });
reject(new Error("还在审核中"));
} else {
wx.reLaunch({ url: "/module1/pages/setInfo/index" });
reject(new Error("还不是医生"));
}
});
} else {
resolve(true);
}
}
}, 500);
});
},
getApplyDoctor() {
return wx.ajax({
method: "GET",
url: "?r=takeda/reg/get-apply-doctor",
});
},
getUserInfo(self: WechatMiniprogram.Page.Instance<any, any>, callback?: (res: any) => void) {
wx.ajax({
method: "GET",
url: "?r=takeda/account/info",
data: {},
}).then((res) => {
self.setData({
userInfo: res,
});
callback?.(res);
});
},
getMenuInfo(self) {
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
self.setData({
menuButtonInfo,
});
},
});

20
src/components/pagination/index.js

@ -0,0 +1,20 @@
const app = getApp();
Component({
properties: {
pagination: {
type: Object,
value() {
return {};
},
},
},
data: {
imageUrl: app.globalData.imageUrl,
},
methods: {
handleTouchmove() {
return false;
},
},
});

6
src/components/pagination/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-divider": "@vant/weapp/divider/index"
}
}

6
src/components/pagination/index.scss

@ -0,0 +1,6 @@
/* components/pagination/index.wxss */
.none {
display: block;
margin: 30rpx auto;
width: 80%;
}

6
src/components/pagination/index.wxml

@ -0,0 +1,6 @@
<image class="none" src="{{imageUrl}}none.png?t={{Timestamp}}" wx:if="{{pagination.count==0}}"></image>
<van-divider contentPosition="center" wx:elif="{{pagination.page<pagination.pages}}">
<van-loading />
加载中...
</van-divider>
<van-divider contentPosition="center" wx:elif="{{pagination.page>=pagination.pages}}">没有更多了</van-divider>

4
src/custom-tab-bar/index.json

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

130
src/custom-tab-bar/index.scss

@ -0,0 +1,130 @@
.tabbar {
padding: 0 0 calc(env(safe-area-inset-bottom) + 12rpx);
display: flex;
justify-content: space-between;
background-color: #fff;
box-shadow: 0rpx 3rpx 27rpx 0rpx rgba(40, 48, 49, 0.1);
.custom {
flex-shrink: 0;
position: relative;
width: 94rpx;
height: 64rpx;
.add {
position: absolute;
top: -42rpx;
width: 94rpx;
height: 94rpx;
}
.popup-tip {
padding: 20rpx 34rpx 28rpx;
position: absolute;
top: -60rpx;
left: 50%;
transform: translate(-50%, -100%);
border-radius: 16rpx;
background: linear-gradient(90deg, #00b4c5 0%, #54e2b4 100%);
box-shadow: 0 4rpx 11rpx rgba(0, 0, 0, 0.08);
.close {
position: absolute;
top: -10rpx;
right: -10rpx;
width: 40rpx;
height: 40rpx;
}
.content {
text-align: center;
font-size: 32rpx;
color: #fff;
white-space: nowrap;
line-height: 48rpx;
.plus {
color: #fff;
font-size: 48rpx;
font-weight: bold;
}
}
.pt-footer {
margin-top: 16rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 24rpx;
white-space: nowrap;
.ok {
padding: 16rpx 42rpx;
font-size: 24rpx;
color: #00b4c5;
font-size: 32rpx;
line-height: 32rpx;
border-radius: 120rpx;
background: #fff;
}
}
&::after {
position: absolute;
content: "";
bottom: -10rpx;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-style: solid;
border-width: 12rpx 12rpx 0 12rpx;
border-color: #56cabb transparent transparent transparent;
}
}
}
.tab-item {
position: relative;
padding-top: 10rpx;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.icon-wrap {
position: relative;
width: 48rpx;
height: 48rpx;
.icon {
display: block;
width: 100%;
height: 100%;
}
.icon-active {
display: none;
width: 100%;
height: 100%;
}
.dot {
position: absolute;
top: 0;
right: 0;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background-color: #ed4f39;
}
}
.name {
margin-top: 8rpx;
font-size: 22rpx;
color: rgba(20, 21, 21, 1);
line-height: 21rpx;
}
&.active {
.icon-wrap {
.icon {
display: none;
}
.icon-active {
display: block;
}
}
.name {
color: rgba(0, 180, 197, 1);
}
}
}
}

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

@ -0,0 +1,74 @@
const _app = getApp<IAppOption>();
// pages/story/a.ts
Component({
/**
*
*/
properties: {},
/**
*
*/
data: {
showEntryCase: false,
active: 0,
notice: false,
tabbar: [
{
path: "/pages/home/index",
name: "首页",
icon: "tab1.png",
iconActive: "tab-active1.png",
activeIndex: 1,
},
{
path: "/pages/cases/index",
name: "病历",
icon: "tab2.png",
iconActive: "tab-active2.png",
activeIndex: 2,
},
{
custom: true,
path: "/module1/pages/entryCases/index",
},
{
path: "/pages/chatRoomList/index",
name: "学习窗",
icon: "tab3.png",
iconActive: "tab-active3.png",
activeIndex: 3,
},
{
path: "/pages/my/index",
name: "我的",
icon: "tab4.png",
iconActive: "tab-active4.png",
activeIndex: 4,
},
],
userInfo: {},
},
/**
*
*/
methods: {
handleTab(e: any) {
const { index } = e.currentTarget.dataset;
const tab = this.data.tabbar[index];
if (tab.custom) {
this.handleClsoeCaseTip();
wx.navigateTo({
url: tab.path,
});
} else {
wx.switchTab({
url: tab.path,
});
}
},
},
});
export {};

33
src/custom-tab-bar/index.wxml

@ -0,0 +1,33 @@
<view class="tabbar">
<block wx:for="{{tabbar}}" wx:key="index">
<view class="custom" wx:if="{{item.custom && userInfo.DoctorLevel<3}}" bind:tap="handleTab" data-index="{{index}}">
<image class="add" src="{{imageUrl}}tabbar/add.png?t={{Timestamp}}"></image>
<view class="popup-tip" wx:if="{{showEntryCase}}">
<image class="close" catch:tap="handleClsoeCaseTip" src="{{imageUrl}}icon-close-white.png?t={{Timestamp}}"></image>
<view class="content">
点击
<text class="plus">+</text>
,可录入病历
<view></view>
邀约合作医生一起讨论哦
</view>
<view class="pt-footer">
<view class="ok">去录入</view>
</view>
</view>
</view>
<view
class="tab-item {{active===item.activeIndex && 'active'}}"
wx:elif="{{!item.custom}}"
bind:tap="handleTab"
data-index="{{index}}"
>
<view class="icon-wrap">
<view class="dot" wx:if="{{notice && index===3}}"></view>
<image class="icon" src="{{imageUrl}}tabbar/{{item.icon}}?t={{Timestamp}}"></image>
<image class="icon-active" src="{{imageUrl}}tabbar/{{item.iconActive}}?t={{Timestamp}}"></image>
</view>
<view class="name">{{item.name}}</view>
</view>
</block>
</view>

BIN
src/images/tabbar/add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
src/images/tabbar/tab-active1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/images/tabbar/tab-active2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/images/tabbar/tab-active3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
src/images/tabbar/tab-active4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/images/tabbar/tab1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/images/tabbar/tab2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/images/tabbar/tab3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/images/tabbar/tab4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

3
src/pages/home/index.json

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

0
src/pages/home/index.scss

6
src/pages/home/index.ts

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

2
src/pages/home/index.wxml

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

3
src/pages/my/index.json

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

0
src/pages/my/index.scss

6
src/pages/my/index.ts

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

2
src/pages/my/index.wxml

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

1
src/sdk/Easemob-chat-4.1.4.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.1.5.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.1.7.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.2.0.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.2.1.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.3.0.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.3.1.js

File diff suppressed because one or more lines are too long

7367
src/sdk/Easemob-chat.d.ts vendored

File diff suppressed because it is too large Load Diff

7
src/sitemap.json

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

58
src/utils/component.ts

@ -0,0 +1,58 @@
/**
* 使
* 1app.js const page = require('xx/xx/page);
* 2app.js onLaunch Page = page
*/
const originalComponent = Component;
function component(
config: WechatMiniprogram.Component.Instance<
WechatMiniprogram.Component.DataOption,
WechatMiniprogram.Component.PropertyOption,
WechatMiniprogram.Component.MethodOption,
WechatMiniprogram.Component.BehaviorOption
>,
) {
if (config?.lifetimes?.attached) {
const originalOnAttached = config.lifetimes.attached;
config.lifetimes.attached = function (options) {
setImageParams(this);
getApp().getMenuInfo(this);
if (originalOnAttached) {
originalOnAttached.call(this, options);
}
};
} else {
const originalOnAttached = config.attached;
config.attached = function (options) {
setImageParams(this);
getApp().getMenuInfo(this);
if (originalOnAttached) {
originalOnAttached.call(this, options);
}
};
}
return originalComponent(config);
}
function setImageParams(
currPage: WechatMiniprogram.Component.Instance<
WechatMiniprogram.Component.DataOption,
WechatMiniprogram.Component.PropertyOption,
WechatMiniprogram.Component.MethodOption,
WechatMiniprogram.Component.BehaviorOption
>,
) {
const date = new Date();
const Timestamp = date.getTime();
currPage.setData({
imageUrl: getApp().globalData.imageUrl,
Timestamp,
});
}
export default component;

2
src/utils/dayjs/day-zh-cn.js

@ -0,0 +1,2 @@
!function(e,_){"object"==typeof exports&&"undefined"!=typeof module?module.exports=_(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],_):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_zh_cn=_(e.dayjs)}(this,(function(e){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,_){return"W"===_?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,_){var t=100*e+_;return t<600?"凌晨":t<900?"早上":t<1100?"上午":t<1300?"中午":t<1800?"下午":"晚上"}};return t.default.locale(d,null,!0),d}));

24
src/utils/dayjs/relativeTime.d.ts vendored

@ -0,0 +1,24 @@
import { PluginFunc, ConfigType } from 'dayjs'
declare interface RelativeTimeThreshold {
l: string
r?: number
d?: string
}
declare interface RelativeTimeOptions {
rounding?: (num: number) => number
thresholds?: RelativeTimeThreshold[]
}
declare const plugin: PluginFunc<RelativeTimeOptions>
export = plugin
declare module 'dayjs' {
interface Dayjs {
fromNow(withoutSuffix?: boolean): string
from(compared: ConfigType, withoutSuffix?: boolean): string
toNow(withoutSuffix?: boolean): string
to(compared: ConfigType, withoutSuffix?: boolean): string
}
}

1
src/utils/dayjs/relativeTime.js

@ -0,0 +1 @@
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).dayjs_plugin_relativeTime=e()}(this,(function(){"use strict";return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,!0):i.diff(e,y.d,!0));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return"function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,!0)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)}}}));

54
src/utils/page.ts

@ -0,0 +1,54 @@
/**
* 使
* 1app.js const page = require('xx/xx/page);
* 2app.js onLaunch Page = page
*/
const originalPage = Page
function page(config: WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>) {
const originalOnLoad = config.onLoad
config.onLoad = function (options) {
setImageParams(this)
getApp().getMenuInfo(this)
if (originalOnLoad) {
originalOnLoad.call(this, options)
}
}
const originalOnShareAppMessage = config.onShareAppMessage
config.onShareAppMessage = function (options) {
if (originalOnShareAppMessage) {
return originalOnShareAppMessage.call(this, options)
} else {
// const date = new Date();
// const Timestamp = date.getTime();
// const pages = getCurrentPages();
// const currentPage = pages[pages.length - 1];
// const url = currentPage.route;
return {
title: '武田',
path: '/pages/start/index',
// imageUrl: `${getApp().globalData.imageUrl}1/1.png?t=${Timestamp}`,
}
}
}
return originalPage(config)
}
function setImageParams(
currPage: WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>,
) {
const date = new Date()
const Timestamp = date.getTime()
currPage.setData({
imageUrl: getApp().globalData.imageUrl,
Timestamp,
})
}
export default page

71
src/utils/request.ts

@ -0,0 +1,71 @@
interface IGlobalParams {
gUrl: string
}
export const request = function (
{ gUrl }: IGlobalParams,
{ url, method, data, header, showMsg = true, loading = false, isJSON = false, ...options }: IAgaxParams,
): Promise<any> {
return new Promise((resolve, reject) => {
if (loading) {
wx.showLoading({
title: '加载中...',
mask: true,
})
}
wx.request({
header: {
loginState: getApp().globalData.loginState,
...header,
},
url: gUrl + url,
method,
data: {
loginState: getApp().globalData.loginState,
...(data as object),
},
...options,
success(res: any) {
const { code, data } = res.data
if (isJSON) {
resolve(res.data)
} else if (code === 0) {
resolve(data)
} else if (showMsg) {
const msg = errPicker(res.data)
if (loading) {
setTimeout(() => {
wx.showToast({
title: msg,
icon: 'none',
})
}, 30)
} else {
wx.showToast({
title: msg,
icon: 'none',
})
reject(res)
}
} else {
reject(res)
}
},
fail(err) {
reject(err)
},
complete() {
if (loading) {
wx.hideLoading()
}
},
})
})
}
function errPicker(err: any) {
if (typeof err === 'string') {
return err
}
return err.data || err.msg || err.errMsg || (err.detail && err.detail.errMsg) || '未知错误'
}

64
src/utils/util.ts

@ -0,0 +1,64 @@
export const formatTime = (date: Date) => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return `${[year, month, day].map(formatNumber).join("/")} ${[hour, minute, second].map(formatNumber).join(":")}`;
};
export const formatNumber = (n: number) => {
const s = n.toString();
return s[1] ? s : `0${s}`;
};
/**
*
* @returns string
*/
export const getCurrentPageUrl = function () {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const url = `/${currentPage.route}`;
return url;
};
/**
* &
* @returns string
*/
export const getCurrentPageUrlWithArgs = function () {
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}&`;
}
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1);
return urlWithArgs;
};
const parseUrlArgsToArray = (urlArgs) => {
urlArgs = urlArgs.split("&");
const results = {};
urlArgs.forEach((arg) => {
arg = arg.split("=");
if (arg[0] && arg[1]) {
results[arg[0]] = arg[1];
}
});
return results;
};
export const parseScene = (scene) => {
if (scene) {
return parseUrlArgsToArray(decodeURIComponent(scene));
} else {
return null;
}
};

12
src/utils/util.wxs

@ -0,0 +1,12 @@
function include(value, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] === value) {
return true;
}
}
return false;
}
module.exports = {
include: include,
};

37
src/utils/webIM/Dispatcher.js

@ -0,0 +1,37 @@
var dispCbs = [];
var dispIns = [];
function Dispatcher() {
dispIns.push(this);
dispCbs.push({});
}
Dispatcher.prototype = {
on(type, cb) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
if (!~cbs.indexOf(cb)) {
cbs.push(cb);
}
},
off(type, cb) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
let curTypeCbIdx = cbs.indexOf(cb);
if (~curTypeCbIdx) {
cbs.splice(curTypeCbIdx, 1);
}
},
fire(type, ...args) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
for (let i = 0; i < cbs.length; i++) {
cbs[i].apply(null, args);
}
}
};
module.exports = Dispatcher;

48
src/utils/webIM/Observe.js

@ -0,0 +1,48 @@
var obsCbs = obsCbs || [];
var obsObjs = obsObjs || [];
var cloneObjs = cloneObjs || [];
function newOne(obj){
obsObjs.push(obj);
obsCbs.push([]);
cloneObjs.push(Object.assign({}, obj));
}
module.exports = {
del(obj, cb){
let curObjIdx = obsObjs.indexOf(obj);
if(~curObjIdx){
let cbs = obsCbs[curObjIdx];
let curCbIdx = cbs.indexOf(cb);
if(~curCbIdx){
cbs.splice(curCbIdx, 1);
if(!cbs.length){
obsObjs.splice(curObjIdx, 1);
}
}
}
},
add(obj, cb){
let curIdx = obsObjs.indexOf(obj);
if(!~curIdx){
curIdx = obsObjs.length;
newOne(obj);
}
let cbs = obsCbs[curIdx];
cbs.push(cb);
for(let key in obj){
Object.defineProperty(obj, key, {
set: function(val){
cloneObjs[curIdx][key] = val;
for(let i = 0; i < cbs.length; i++){
cbs[i].apply(obj, [val, key]);
}
},
get: function(){
return cloneObjs[curIdx][key];
}
});
}
return obj;
},
};

266
src/utils/webIM/WebIM.js

@ -0,0 +1,266 @@
import websdk from "@/sdk/Easemob-chat-4.3.1";
import config from "./WebIMConfig";
console.group = console.group || {};
console.groupEnd = console.groupEnd || {};
const window = {};
const WebIM = window.WebIM = websdk;
WebIM.message = websdk.message
window.WebIM.config = config;
//var DOMParser = window.DOMParser = xmldom.DOMParser;
//let document = window.document = new DOMParser().parseFromString("<?xml version='1.0'?>\n", "text/xml");
WebIM.isDebug = function (option) {
if (option) {
WebIM.config.isDebug = option.isDebug
openDebug(WebIM.config.isDebug)
}
function openDebug(value) {
function ts() {
const d = new Date();
const Hours = d.getHours(); // 获取当前小时数(0-23)
const Minutes = d.getMinutes(); // 获取当前分钟数(0-59)
const Seconds = d.getSeconds(); // 获取当前秒数(0-59)
return `${Hours < 10 ? `0${ Hours}` : Hours }:${ Minutes < 10 ? `0${ Minutes}` : Minutes }:${ Seconds < 10 ? `0${ Seconds}` : Seconds } `;
}
// if (value) {
// Strophe.Strophe.Connection.prototype.rawOutput = function(data){
// try{
// console.group("%csend # " + ts(), "color: blue; font-size: large");
// console.log("%c" + data, "color: blue");
// console.groupEnd();
// }
// catch(e){
// console.log(e);
// }
// };
// }else{
// Strophe.Strophe.Connection.prototype.rawOutput = function(){};
// }
}
}
/**
* Set autoSignIn as true (autoSignInName and autoSignInPwd are configured below),
* You can auto signed in each time when you refresh the page in dev model.
*/
WebIM.config.autoSignIn = false;
if (WebIM.config.autoSignIn) {
WebIM.config.autoSignInName = "lwz2";
WebIM.config.autoSignInPwd = "1";
}
// var stropheConn = new window.Strophe.Connection("ws://im-api.easemob.com/ws/", {
// inactivity: 30,
// maxRetries: 5,
// pollingTime: 4500
// });
//
// stropheConn.connect(
// '$t$' + 'YWMtmbQEBKKIEeaGmMtXyg5n1wAAAVlkQvGO2WOJGlMCEJKM4VV9GCMnb_XLCXU',
// function() {
// console.log(arguments, 'ggogogo');
// }, stropheConn.wait, stropheConn.hold);
WebIM.parseEmoji = function (msg) {
if (typeof WebIM.Emoji === "undefined" || typeof WebIM.Emoji.map === "undefined") {
return msg;
}
const emoji = WebIM.Emoji;
var reg = null;
const msgList = [];
const objList = [];
for (const face in emoji.map) {
if (emoji.map.hasOwnProperty(face)) {
while (msg.includes(face)) {
msg = msg.replace(face, `^${ emoji.map[face] }^`);
}
}
}
const ary = msg.split("^");
var reg = /^e.*g$/;
for (var i = 0; i < ary.length; i++) {
if (ary[i] != "") {
msgList.push(ary[i]);
}
}
for (var i = 0; i < msgList.length; i++) {
if (reg.test(msgList[i])) {
var obj = {};
obj.data = msgList[i];
obj.type = "emoji";
objList.push(obj);
}
else {
var obj = {};
obj.data = msgList[i];
obj.type = "txt";
objList.push(obj);
}
}
return objList;
};
WebIM.time = function () {
const date = new Date();
const Hours = date.getHours();
const Minutes = date.getMinutes();
const Seconds = date.getSeconds();
const time = `${date.getFullYear() }-${ date.getMonth() + 1 }-${ date.getDate() } ${
Hours < 10 ? `0${ Hours}` : Hours }:${ Minutes < 10 ? `0${ Minutes}` : Minutes }:${ Seconds < 10 ? `0${ Seconds}` : Seconds}`;
return time;
};
WebIM.Emoji = {
path: "../../../../../images/faces/",
map: {
"[):]": "ee_1.png",
"[:D]": "ee_2.png",
"[;)]": "ee_3.png",
"[:-o]": "ee_4.png",
"[:p]": "ee_5.png",
"[(H)]": "ee_6.png",
"[:@]": "ee_7.png",
"[:s]": "ee_8.png",
"[:$]": "ee_9.png",
"[:(]": "ee_10.png",
"[:'(]": "ee_11.png",
"[<o)]": "ee_12.png",
"[(a)]": "ee_13.png",
"[8o|]": "ee_14.png",
"[8-|]": "ee_15.png",
"[+o(]": "ee_16.png",
"[|-)]": "ee_17.png",
"[:|]": "ee_18.png",
"[*-)]": "ee_19.png",
"[:-#]": "ee_20.png",
"[^o)]": "ee_21.png",
"[:-*]": "ee_22.png",
"[8-)]": "ee_23.png",
"[del]": "btn_del.png",
"[(|)]": "ee_24.png",
"[(u)]": "ee_25.png",
"[(S)]": "ee_26.png",
"[(*)]": "ee_27.png",
"[(#)]": "ee_28.png",
"[(R)]": "ee_29.png",
"[({)]": "ee_30.png",
"[(})]": "ee_31.png",
"[(k)]": "ee_32.png",
"[(F)]": "ee_33.png",
"[(W)]": "ee_34.png",
"[(D)]": "ee_35.png"
}
};
WebIM.EmojiObj = {
// 相对 emoji.js 路径
path: "../../../../../images/faces/",
map1: {
"[):]": "ee_1.png",
"[:D]": "ee_2.png",
"[;)]": "ee_3.png",
"[:-o]": "ee_4.png",
"[:p]": "ee_5.png",
"[(H)]": "ee_6.png",
"[:@]": "ee_7.png"
},
map2: {
"[:s]": "ee_8.png",
"[:$]": "ee_9.png",
"[:(]": "ee_10.png",
"[:'(]": "ee_11.png",
"[<o)]": "ee_12.png",
"[(a)]": "ee_13.png",
"[8o|]": "ee_14.png"
},
map3: {
"[8-|]": "ee_15.png",
"[+o(]": "ee_16.png",
"[|-)]": "ee_17.png",
"[:|]": "ee_18.png",
"[*-)]": "ee_19.png",
"[:-#]": "ee_20.png",
"[del]": "del.png"
},
map4: {
"[^o)]": "ee_21.png",
"[:-*]": "ee_22.png",
"[8-)]": "ee_23.png",
"[(|)]": "ee_24.png",
"[(u)]": "ee_25.png",
"[(S)]": "ee_26.png",
"[(*)]": "ee_27.png"
},
map5: {
"[(#)]": "ee_28.png",
"[(R)]": "ee_29.png",
"[({)]": "ee_30.png",
"[(})]": "ee_31.png",
"[(k)]": "ee_32.png",
"[(F)]": "ee_33.png",
"[(W)]": "ee_34.png",
"[(D)]": "ee_35.png"
},
map6: {
"[del]": "del.png"
}
};
WebIM.conn = new WebIM.connection({
appKey: WebIM.config.appkey,
isMultiLoginSessions: WebIM.config.isMultiLoginSessions,
https: true, //typeof WebIM.config.https === "boolean" ? WebIM.config.https : location.protocol === "https:",
url: WebIM.config.socketServer,
apiUrl: WebIM.config.apiURL,
isAutoLogin: false,
heartBeatWait: 30000, //WebIM.config.heartBeatWait,
autoReconnectNumMax: WebIM.config.autoReconnectNumMax,
autoReconnectInterval: WebIM.config.autoReconnectInterval,
isDebug: WebIM.config.isDebug,
deviceId: WebIM.config.deviceId
});
// async response
// WebIM.conn.listen({
// onOpened: () => dispatch({type: Types.ON_OPEND})
// })
Math.uuid = function (len, radix) {
const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
const chars = CHARS; const uuid = []; let i;
radix = radix || chars.length;
if (len) {
// Compact form
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
// rfc4122, version 4 form
let r;
// rfc4122 requires these characters
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
// Fill in random data. At i==19 set the high bits of clock sequence
// as
// per rfc4122, sec. 4.1.5
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
};
// export default WebIM;
module.exports = {
"default": WebIM
};

88
src/utils/webIM/WebIMConfig.js

@ -0,0 +1,88 @@
/**
* git do not control webim.config.js
* everyone should copy webim.config.js to webim.config.js
* and have their own configs.
* In this way , others won't be influenced by this config while git pull.
*
*/
// for react native
const location = {
protocol: "https",
};
const config = {
/*
* socket server
*/
// socketServer: "wss://im-api.easemob.com/ws/", //小程序2.0sdk线上环境 请使用2.0版本sdk
// socketServer: "wss://im-api-hsb.easemob.com/ws/", //小程序2.0sdk沙箱环境 请使用2.0版本sdk
// socketServer: 'wss://im-api-new-hsb.easemob.com/websocket', //小程序沙箱环境
socketServer: "wss://im-api-wechat.easemob.com/websocket", //小程序线上环境
// socketServer: 'wss://hk-wx.easemob.com/websocket',
/*
* Backend REST API URL
*/
// apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com',
apiURL: "https://a1.easemob.com", // 线上环境
// apiURL: "https://a1-hsb.easemob.com", // 沙箱环境
// apiURL: 'https://hk-test.easemob.com',
/*
* Application AppKey
*/
appkey: "1110180510146396#dream",
/*
* Whether to use HTTPS '1177161227178308#xcx'
* @parameter {Boolean} true or false
*/
https: false,
/*
* isMultiLoginSessions
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
* false: A visitor can sign in to only one webpage and receive messages at the webpage.
*/
isMultiLoginSessions: false,
/**
* Whether to use window.doQuery()
* @parameter {boolean} true or false
*/
isWindowSDK: false,
/**
* isSandBox=true: xmppURL: 'im-api.sandbox.easemob.com', apiURL: '//a1.sdb.easemob.com',
* isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com',
* @parameter {boolean} true or false
*/
isSandBox: false,
/**
* Whether to console.log in strophe.log()
* @parameter {boolean} true or false
*/
isDebug: true,
/**
* will auto connect the xmpp server autoReconnectNumMax times in background when client is offline.
* won't auto connect if autoReconnectNumMax=0.
*/
autoReconnectNumMax: 5,
/**
* the interval secons between each atuo reconnectting.
* works only if autoReconnectMaxNum >= 2.
*/
autoReconnectInterval: 2,
/**
* webrtc supports WebKit and https only
*/
isWebRTC: false,
/*
* Set to auto sign-in
*/
isAutoLogin: true,
heartBeatWait: 30000,
/*
* 需要替换成自己的声网 appId appId 有限量仅供参考使用同时获取声网 token 的接口仅能供此 appId 使用换成自己的 appId 后需要自己去实现 app server 获取声网token
*/
AgoraAppId: "15cb0d28b87b425ea613fc46f7c9f974",
};
export default config;

2
src/utils/webIM/broadcast.js

@ -0,0 +1,2 @@
var Dispatcher = require("./Dispatcher");
module.exports = new Dispatcher();

30
tsconfig.json

@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"experimentalDecorators": true,
"baseUrl": ".",
"module": "CommonJS",
"paths": {
"@vant/weapp/*": ["path/to/node_modules/@vant/weapp/dist/*"],
"@/*": ["src/*"]
},
"typeRoots": ["./typings"],
"types": ["miniprogram-api-typings"],
"allowJs": true,
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["./**/*.ts"],
"exclude": ["node_modules"]
}

73
typings/index.d.ts vendored

@ -0,0 +1,73 @@
interface IAppOption {
globalData: {
userInfo?: IUserInfo;
url: string;
upFileUrl: string;
imageUrl: string;
loginState: string;
isLogin: number;
doctorId: null | number;
scene: null | { [key: string]: any };
needDeal: "" | "1";
caseNav: "0" | "1" | "2" | "3";
};
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback;
waitLogin: (waitLoginState?: boolean) => Promise<any>;
getMenuInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>) => void;
getUserInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>, arg1?: (arg0: any) => void) => void;
getApplyDoctor: () => Promise<any>;
}
interface IAgaxParams extends WechatMiniprogram.RequestOption {
showMsg?: boolean;
loading?: boolean;
isJSON?: boolean;
}
declare namespace WechatMiniprogram {
export interface Wx {
ajax: (arg0: IAgaxParams) => Promise<any>;
WebIM;
}
}
interface IUserInfo {
UserId: string;
IsDoctor: number;
DoctorId: number;
Name: string;
Img: string;
Telephone: string;
HospitalId: string;
TitleType: number;
OtherTitle: string;
DoctorLevel: number;
Introduce: string;
Department: IDepartment[];
DepartmentId: string[];
Specialty: ISpecialty[];
SpecialtyId: string[];
HospitalName: string;
HospitalClassification: string;
HospitalLevel: string;
ProvinceName: string;
CityName: string;
CountyName: string;
Address: string;
HospitalClassificationName: string;
HospitalLevelName: string;
}
interface IDepartment {
DepartmentId: string;
DepartmentName: string;
DoctorId: string;
}
interface ISpecialty {
SpecialtyId: string;
SpecialtyName: string;
DepartmentId: string;
DoctorId: string;
}
Loading…
Cancel
Save