add file
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
const FileUtil = {
|
||||
|
||||
//file 为微信file 单文件
|
||||
getFileName(file){
|
||||
// size: 132224
|
||||
// thumb: "http://tmp/0ftStiYfd18K517836423bbfde024c385140a666b344.png"
|
||||
// type: "image"
|
||||
// url: "http://tmp/0ftStiYfd18K517836423bbfde024c385140a666b344.png"
|
||||
|
||||
if(file){
|
||||
const uuid = this.UUID().replace("/-/g","");
|
||||
if(file.url && (file.url.indexOf(".") > -1)){
|
||||
const fileType = file.url.split(".")[1];
|
||||
return uuid+"."+fileType;
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
||||
UUID () {
|
||||
if (typeof crypto === 'object') {
|
||||
if (typeof crypto.randomUUID === 'function') {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
|
||||
const callback = (c) => {
|
||||
const num = Number(c);
|
||||
return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16);
|
||||
};
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, callback);
|
||||
}
|
||||
}
|
||||
let timestamp = new Date().getTime();
|
||||
let perforNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0;
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
let random = Math.random() * 16;
|
||||
if (timestamp > 0) {
|
||||
random = (timestamp + random) % 16 | 0;
|
||||
timestamp = Math.floor(timestamp / 16);
|
||||
} else {
|
||||
random = (perforNow + random) % 16 | 0;
|
||||
perforNow = Math.floor(perforNow / 16);
|
||||
}
|
||||
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16);
|
||||
});
|
||||
},
|
||||
|
||||
canvasToFile(){
|
||||
let canvas = window.map3DControl.viewer.canvas;
|
||||
let imgWidth = 1920;
|
||||
let img = Canvas2Image.convertToImage(
|
||||
canvas,
|
||||
imgWidth,
|
||||
(imgWidth * canvas.height) / canvas.width,
|
||||
"png"
|
||||
);
|
||||
let file_name = new Date().getTime() + ".png";
|
||||
let imgsrc = img.src.slice(22)
|
||||
|
||||
let file = this.convertBase64UrlToImgFile(
|
||||
imgsrc,
|
||||
file_name,
|
||||
"image/png"
|
||||
)
|
||||
return file;
|
||||
},
|
||||
|
||||
convertBase64UrlToImgFile(urlData, fileName, fileType) {
|
||||
urlData = urlData.replace(/^data:image\/\w+;base64,/, "");
|
||||
let bytes = wx.base64ToArrayBuffer(urlData);
|
||||
|
||||
// var bytes = wx.atob(urlData); //转换为byte
|
||||
//处理异常,将ascii码小于0的转换为大于0
|
||||
var ab = new ArrayBuffer(bytes.length);
|
||||
var ia = new Int8Array(ab);
|
||||
var i;
|
||||
for (i = 0; i < bytes.length; i++) {
|
||||
ia[i] = bytes.charCodeAt(i);
|
||||
}
|
||||
//转换成文件,添加文件的type,name,lastModifiedDate属性
|
||||
var blob = new Blob([ab], { type: fileType });
|
||||
blob.lastModifiedDate = new Date();
|
||||
blob.name = fileName;
|
||||
return blob;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export { FileUtil }
|
||||
@@ -0,0 +1,440 @@
|
||||
import { HTTP } from './request'
|
||||
|
||||
class API extends HTTP {
|
||||
getStaticHost(){
|
||||
return `${this.staticHost}`;
|
||||
}
|
||||
//获取oss签名数据
|
||||
getOssSign(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/oss/sign`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取省份信息
|
||||
getAreaProvince(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/area/province`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//获取城市信息
|
||||
getAreaCity(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/area/city`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//获取区县信息
|
||||
getAreaCounty(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/area/county`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//获取医院数据
|
||||
getBasicHospital(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/hospital`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//获取自定义科室数据
|
||||
getBasicDepartment(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/department`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//获取医生专长列表
|
||||
getDoctorExpertise(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/info/expertise`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//使用微信手机号登陆
|
||||
wechatMobileLogin(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/login/wechat_mobile_login`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//医师端首页
|
||||
yiShiIndex(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/index`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取实名认证信息
|
||||
getDoctorAuthReal(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/real`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//新增实名认证信息
|
||||
postDoctorAuthReal(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/real`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取身份认证信息
|
||||
getDoctorAuthIden(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/iden`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
showLoading: false
|
||||
})
|
||||
}
|
||||
//新增/修改身份认证信息
|
||||
postDoctorAuthIden(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/iden`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
},
|
||||
contentType: 'application/json'
|
||||
})
|
||||
}
|
||||
//获取多点执业认证信息
|
||||
getDoctorAuthMulti(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/multi`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//新增多点执业认证信息
|
||||
postDoctorAuthMulti(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/auth/multi`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//手机号登陆
|
||||
mobileLogin(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/login/mobile_login`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取手机号验证码
|
||||
getCodePhone(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/code/phone`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取个人中心数据
|
||||
getDoctorCenter(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/center`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取银行卡列表
|
||||
getDoctorBank(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/bank`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//绑定医生银行卡
|
||||
postDoctorBank(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/bank`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//更换医生银行卡
|
||||
putDoctorBank(params) {
|
||||
let bank_card_id = params.bank_card_id;
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/bank/`+bank_card_id,
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取我的账户日账单明细数据
|
||||
getDoctorAccountInfo(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/account/info`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取提现数据
|
||||
getDoctorWithdrawal(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/withdrawal`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//可提现问诊订单列表
|
||||
getDoctorWithdrawalOrder(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/withdrawal/order`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生提现记录列表
|
||||
getDoctorWithdrawalRecord(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/withdrawal/record`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生我的账户数据
|
||||
getDoctorCenterAccount(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/account`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取个人中心数据
|
||||
getDoctorCenter(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/center`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取银行列表
|
||||
getBasicBank(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/bank`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生信息
|
||||
getDoctorCenterInfo(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/center/info`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生证书信息
|
||||
getDoctorCret(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/info/cret`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取获取医生评价
|
||||
getDoctorEvaluation(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/evaluation`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生问诊配置
|
||||
getDoctorInquiryConfig(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/config`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//医生问诊开关
|
||||
putDoctorInquiryOpen(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/open`,
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//修改医生问诊配置
|
||||
putDoctorInquiryConfig(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/config`,
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取处方列表
|
||||
getDoctorPrescription(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/prescription`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取操作手册列表
|
||||
getBasicOperationManual(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/operation/manual`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取操作手册详情
|
||||
getBasicOperationManualID(params) {
|
||||
let manual_id = params.manual_id;
|
||||
params = {};
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/operation/manual/`+manual_id,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取常用语列表
|
||||
getDoctorWords(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/words`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//新增常用语列表
|
||||
postDoctorWords(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/words`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//搜索疾病分类-系统
|
||||
getBasicDiseaseSearch(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/disease/search`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//搜索药品
|
||||
getBasicProductSearch(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/basic/product/search`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取医生名片
|
||||
getDoctorInfoCard(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/info/card`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export { API }
|
||||
@@ -0,0 +1,19 @@
|
||||
// 开发环境url
|
||||
export const dev = {
|
||||
baseUrl: "https://dev.hospital.applets.igandanyiyuan.com",
|
||||
staticHost: "https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com",//静态资源host
|
||||
appId: 'wxbdb4d63f81d98228' //此处为appId
|
||||
}
|
||||
// 测试环境url
|
||||
export const test = {
|
||||
baseUrl: "http://www.xxx.com",
|
||||
staticHost: "https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com",//静态资源host
|
||||
appId: 'wxbdb4d63f81d98228' //此处为appId
|
||||
}
|
||||
|
||||
// 线上环境url
|
||||
export const prod = {
|
||||
baseUrl: 'https://www.xxx.com',
|
||||
staticHost: "https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com",//静态资源host
|
||||
appId: 'wxbdb4d63f81d98228' //此处为appId
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
const env = require('./config').dev
|
||||
|
||||
class HTTP {
|
||||
constructor() {
|
||||
this.baseUrl = env.baseUrl,
|
||||
this.staticHost = env.staticHost,
|
||||
this.appId = env.appId
|
||||
}
|
||||
|
||||
request({
|
||||
url,
|
||||
data = {},
|
||||
method = 'GET',
|
||||
contentType = 'application/x-www-form-urlencoded',
|
||||
showLoading = true
|
||||
}){
|
||||
return new Promise((resolve, reject) => {
|
||||
this._request(url, resolve, reject, data, method, contentType, showLoading)
|
||||
})
|
||||
}
|
||||
|
||||
_request(url, resolve, reject, data = {}, method = 'GET', contentType = 'application/x-www-form-urlencoded', showLoading = true) {
|
||||
if(showLoading) wx.showLoading();
|
||||
wx.request({
|
||||
url: url,
|
||||
method: method,
|
||||
data: data,
|
||||
header: {
|
||||
'content-type': contentType,
|
||||
'appId': this.appId,
|
||||
'Authorization': "Bearer " + wx.getStorageSync('AUTH_TOKEN')
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("header Authorization: ", res.header.Authorization);
|
||||
var Authorization_token = res.header.Authorization;
|
||||
if(Authorization_token){
|
||||
wx.setStorageSync('AUTH_TOKEN', Authorization_token);//当token快过期时,服务器会返回新token,本地刷新
|
||||
}
|
||||
if (res.data) {
|
||||
const code = res.data.code;
|
||||
if (code == 200) {
|
||||
resolve(res.data)
|
||||
} else if(code == 401 || code == 403 || code == 405 || code == 406){
|
||||
wx.navigateTo({
|
||||
url: "/Pages/index/index"
|
||||
})
|
||||
} else {
|
||||
reject(res.data.message)
|
||||
this._show_error(res.data.message)
|
||||
}
|
||||
} else {
|
||||
resolve(res.data)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject()
|
||||
this._show_error(err.data.message)
|
||||
},
|
||||
complete: () => {
|
||||
if(showLoading) wx.hideLoading();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
_show_error(_message) {
|
||||
wx.showToast({
|
||||
title: `${_message}`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
HTTP
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
const formatTime = 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(':')}`
|
||||
}
|
||||
|
||||
const getDateArr = 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, hour, minute, second]
|
||||
}
|
||||
|
||||
const formatNumber = n => {
|
||||
n = n.toString()
|
||||
return n[1] ? n : `0${n}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime,
|
||||
getDateArr,
|
||||
formatNumber,
|
||||
}
|
||||
Reference in New Issue
Block a user