fix: 修复了一些东西,新增了方法
This commit is contained in:
8
App.vue
8
App.vue
@@ -3,6 +3,7 @@
|
||||
getVersion
|
||||
} from './request/api/api'
|
||||
import { webSocketManager } from '@/utils/ws/websocket.js';
|
||||
import {checkDev} from "@/utils/utils";
|
||||
export default {
|
||||
// //初始化状态-如果登录过,保持登录状态
|
||||
onLaunch: async function() {
|
||||
@@ -30,11 +31,14 @@
|
||||
|
||||
|
||||
|
||||
console.log('获取更新机制', uni.canIUse('getUpdateManager'))
|
||||
// 获取小程序更新机制兼容
|
||||
if (uni.canIUse('getUpdateManager')) {
|
||||
const updateManager = uni.getUpdateManager()
|
||||
console.log('updateManager', updateManager)
|
||||
// 检查是否有新版本发布
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
console.log('检查是否有新版本发布', res)
|
||||
if (res.hasUpdate) {
|
||||
//小程序有新版本,则静默下载新版本,做好更新准备
|
||||
updateManager.onUpdateReady(function() {
|
||||
@@ -83,7 +87,9 @@
|
||||
})
|
||||
}
|
||||
|
||||
this.initWebSocket();
|
||||
if (checkDev('open-im')) {
|
||||
this.initWebSocket();
|
||||
}
|
||||
},
|
||||
|
||||
onShow: function(e) {
|
||||
|
||||
@@ -104,8 +104,8 @@
|
||||
if (res.data.errcode == 0) {
|
||||
// console.log(res, 'res');
|
||||
this.categoryLists = res.data.data.list
|
||||
this.cid = res.data.data.map(x => x.id)
|
||||
this.num = res.data.data[0].id //初始选中
|
||||
this.cid = res.data.data.list.map(x => x.id)
|
||||
this.num = res.data.data.list[0].id //初始选中
|
||||
// this.current = res.data.data[0].subs[0].id //初始选中2
|
||||
}
|
||||
})
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<!-- 模拟<u-divider>在线问诊</u-divider>效果-->
|
||||
|
||||
<!-- 标题 -->
|
||||
<view class="title">
|
||||
<view v-if="checkDev('open-im')" class="title">
|
||||
<text>在线问诊</text>
|
||||
<!-- <view class="clear" @click="getClearInfo">-->
|
||||
<!-- <text class="iconfont icon-qingchu"></text>-->
|
||||
@@ -93,7 +93,7 @@
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
<!-- 在线问诊 - 用户-->
|
||||
<view v-for="item in imChat" :key="item.id" class="list" @click="goChat(item)">
|
||||
<view v-if="checkDev('open-im')" v-for="item in imChat" :key="item.id" class="list" @click="goChat(item)">
|
||||
<!-- 头像 -->
|
||||
<view class="avator">
|
||||
<view class="img">
|
||||
@@ -127,6 +127,7 @@ import {
|
||||
getseesionRead
|
||||
} from '../../request/api/api'
|
||||
import {getChatFriendsListApi} from "@/request/api/im";
|
||||
import {checkDev} from "@/utils/utils";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -142,6 +143,7 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkDev,
|
||||
// 清除未读信息
|
||||
getClearInfo() {
|
||||
getseesionRead({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Base64} from "js-base64";
|
||||
import {checkDev} from "@/utils/utils";
|
||||
|
||||
|
||||
const arr = [
|
||||
@@ -18,13 +19,14 @@ const sensitiveData = [
|
||||
'idcard'
|
||||
]
|
||||
|
||||
const isDev = true;
|
||||
const isDev = checkDev('dev');
|
||||
|
||||
function request(url, params, method = 0) {
|
||||
let baseURL = isDev === true? 'http://127.0.0.1:18000/member': "https://app.xiaokang88.com/member"
|
||||
// let baseURL = "http://127.0.0.1:18000/member"
|
||||
if (url.split('/').indexOf('imApi') !== -1) {
|
||||
baseURL = "http://127.0.0.1:12080/api"
|
||||
let baseURL = isDev === true? 'http://127.0.0.1:12080/api': "https://app.xiaokang88.com/member"
|
||||
}
|
||||
if (url.split('/').indexOf('newApi') !== -1) {
|
||||
baseURL = isDev === true? 'https://shop.xiaokang88.com/member': "https://shop.xiaokang88.com/member"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
@change="handleTypeChange"
|
||||
>
|
||||
<u-radio name="0" label="线下问诊">线下问诊</u-radio>
|
||||
<u-radio name="1" label="线上咨询">线上咨询</u-radio>
|
||||
<u-radio v-if="checkDev('open-im')" name="1" label="线上咨询">线上咨询</u-radio>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
@@ -130,6 +130,7 @@ import {
|
||||
userEidtPatient,
|
||||
registe
|
||||
} from '@/request/api/api.js'
|
||||
import {checkDev} from "@/utils/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -201,6 +202,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkDev,
|
||||
// 处理挂号类型切换
|
||||
handleTypeChange(type) {
|
||||
this.registerType = type;
|
||||
@@ -302,6 +304,10 @@ export default {
|
||||
|
||||
// 挂号
|
||||
getAsk() {
|
||||
uni.showLoading({
|
||||
title: "加载中...",
|
||||
mask: true
|
||||
});
|
||||
registe({
|
||||
method: "post",
|
||||
data: {
|
||||
@@ -341,6 +347,8 @@ export default {
|
||||
icon: false
|
||||
})
|
||||
}
|
||||
}).finally(() => {
|
||||
uni.hideLoading();
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
service
|
||||
} from '../../request/api/api';
|
||||
import {createRoomByDoctorIdApi, sendToUserApi} from "@/request/api/im";
|
||||
import {checkDev} from "@/utils/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -204,20 +205,22 @@
|
||||
});
|
||||
|
||||
|
||||
createRoomByDoctorIdApi({
|
||||
doctor_id: that.currentDoctorId
|
||||
}).then(result => {
|
||||
sendToUserApi({
|
||||
room_id: result.data.result.room_id,
|
||||
sender_user_id: that.currentUserId,
|
||||
receiver_user_id: that.currentDoctorId,
|
||||
message_type: 10,
|
||||
message_content: JSON.stringify({
|
||||
id: that.register_id,
|
||||
}),
|
||||
duration: 0
|
||||
if (checkDev('open-im') && that.registList.register_type === 1) {
|
||||
createRoomByDoctorIdApi({
|
||||
doctor_id: that.currentDoctorId
|
||||
}).then(result => {
|
||||
sendToUserApi({
|
||||
room_id: result.data.result.room_id,
|
||||
sender_user_id: that.currentUserId,
|
||||
receiver_user_id: that.currentDoctorId,
|
||||
message_type: 10,
|
||||
message_content: JSON.stringify({
|
||||
id: that.register_id,
|
||||
}),
|
||||
duration: 0
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (res.data.data.is_paid == 1) {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
export function checkImageUrl(url) {
|
||||
// 如果url包含http,则返回url,反之加上 data:image/jpeg;base64,
|
||||
return url.includes('http') ? url : 'data:image/jpeg;base64,' + url
|
||||
};
|
||||
export function checkDev(key = '') {
|
||||
// 判断某些模块是否开启
|
||||
switch (key) {
|
||||
case 'dev':
|
||||
return true;
|
||||
case 'open-im':
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user