【新增】 IM基础模块

This commit is contained in:
2022-01-18 13:56:23 +08:00
parent 61d389bef4
commit 7c6916b4ae
14 changed files with 1499 additions and 930 deletions

136
App.vue
View File

@@ -1,68 +1,74 @@
<script>
import { getVersions } from './apis/interfaces/versions'
import im from '@/public/im'
export default {
onLaunch: function() {
//#ifdef APP-PLUS
// 获取系统版本号
getVersions({
platform: plus.os.name,
version : plus.runtime.versionCode
}).then(res => {
if(res.update){
uni.showModal({
title: "更新提示",
content: res.note || '版本更新信息',
confirmText: "更新",
success: modalRes => {
if (modalRes.confirm) {
if (plus.os.name == "Android") {
uni.showToast({
title: '新版本下载中,将在下载完成后自动为您安装更新包',
icon : 'none'
})
uni.downloadFile({
url : res.info.download,
success : apkPick=> {
plus.runtime.install(apkPick.tempFilePath, '', installRES => {
// 安装完成用于提示新版本引导,暂时无用
}, installERR => {
// 安装失败
})
},
fail(err){
uni.showToast({
title: '安装包下载失败,请检查您的网络或稍后重试',
icon : 'none'
})
}
})
// plus.runtime.openURL(res.info.download, err => {
// console.log(err)
// }, 'com.android.browser');
} else{
uni.showToast({
title: 'IOS应用暂未上架请打开测试(TestFlight)工具点击更新',
icon : 'none'
})
}
}
}
})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
//#endif
}
}
<script>
import {
getVersions
} from './apis/interfaces/versions'
import im from '@/utils/im/index.js'
export default {
onLaunch: function() {
im.initIm('lmxuhwaglu76d')
//#ifdef APP-PLUS
// 获取系统版本号
getVersions({
platform: plus.os.name,
version: plus.runtime.versionCode
}).then(res => {
if (res.update) {
uni.showModal({
title: "更新提示",
content: res.note || '版本更新信息',
confirmText: "更新",
success: modalRes => {
if (modalRes.confirm) {
if (plus.os.name == "Android") {
uni.showToast({
title: '新版本下载中,将在下载完成后自动为您安装更新包',
icon: 'none'
})
uni.downloadFile({
url: res.info.download,
success: apkPick => {
plus.runtime.install(apkPick
.tempFilePath, '',
installRES => {
// 安装完成用于提示新版本引导,暂时无用
}, installERR => {
// 安装失败
})
},
fail(err) {
uni.showToast({
title: '安装包下载失败,请检查您的网络或稍后重试',
icon: 'none'
})
}
})
// plus.runtime.openURL(res.info.download, err => {
// console.log(err)
// }, 'com.android.browser');
} else {
uni.showToast({
title: 'IOS应用暂未上架请打开测试(TestFlight)工具点击更新',
icon: 'none'
})
}
}
}
})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
//#endif
}
}
</script>
<style lang="scss">
@import "uview-ui/index.scss";
@import "@/static/iconfont.css";
<style lang="scss">
@import "uview-ui/index.scss";
@import "@/static/iconfont.css";
</style>