This commit is contained in:
lr 2025-02-22 17:13:30 +08:00
parent a0925a4ec7
commit 61dd26ab64
4 changed files with 39 additions and 17 deletions

View File

@ -7,7 +7,7 @@ const config = {
// #endif // #endif
// #ifndef H5 // #ifndef H5
host: 'http://91f.xyz:8080', host: 'http://91f.xyz:8080',
// host: 'https://1e49a851.r24.cpolar.top/', // host: 'https://1a880cd5.r24.cpolar.top/',
// #endif // #endif
// 支付方式配置 // 支付方式配置
payType: { payType: {

View File

@ -66,14 +66,14 @@ const util = {
showCancel: obj.showCancel, showCancel: obj.showCancel,
cancelText: obj.cancelText, cancelText: obj.cancelText,
success: res => { success: res => {
obj.success ? obj.success(res) : () => {} obj.success ? obj.success(res) : () => { }
resolve(res) resolve(res)
}, },
fail: err => { fail: err => {
obj.fail ? obj.fail(err) : () => {} obj.fail ? obj.fail(err) : () => { }
reject(err) reject(err)
}, },
complete: res => {} complete: res => { }
}) })
}) })
}, },
@ -921,7 +921,7 @@ const util = {
const file_suffix = util.config[{ const file_suffix = util.config[{
'file': 'file_suffix', 'file': 'file_suffix',
'audio': 'audio_suffix', 'audio': 'audio_suffix',
} [type]] }[type]]
let result = '' let result = ''
if (url) result = file_suffix.find(item => item.id === url.split('.').pop().toLowerCase()) if (url) result = file_suffix.find(item => item.id === url.split('.').pop().toLowerCase())
return result return result
@ -1047,7 +1047,7 @@ const util = {
obj.fail ? obj.fail('no data') : '' obj.fail ? obj.fail('no data') : ''
} }
break break
// app支付 // app支付
case "app": case "app":
uni.requestPayment({ uni.requestPayment({
provider: "wxpay", provider: "wxpay",
@ -1069,7 +1069,7 @@ const util = {
break break
} }
break break
// 支付宝支付 // 支付宝支付
case "2": case "2":
switch (obj.method) { switch (obj.method) {
// app支付 // app支付
@ -1094,7 +1094,7 @@ const util = {
break break
} }
break break
// 钱包支付 // 钱包支付
case "4": case "4":
obj.success ? obj.success(rs) : '' obj.success ? obj.success(rs) : ''
result_goto('success') result_goto('success')
@ -1166,7 +1166,7 @@ const util = {
util.alert("您拒绝了授权"); util.alert("您拒绝了授权");
// 失败 // 失败
obj.fail ? obj.fail(res) : (res) => {}; obj.fail ? obj.fail(res) : (res) => { };
}, },
complete() { complete() {
// 结束 // 结束
@ -1366,11 +1366,11 @@ const util = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 是否在微信小程序限制范围内 // 是否在微信小程序限制范围内
if (!['scope.userInfo', 'scope.userLocation', 'scope.userLocationBackground', if (!['scope.userInfo', 'scope.userLocation', 'scope.userLocationBackground',
'scope.address', 'scope.address',
'scope.record', 'scope.writePhotosAlbum', 'scope.camera', 'scope.record', 'scope.writePhotosAlbum', 'scope.camera',
'scope.invoice', 'scope.invoice',
'scope.invoiceTitle', 'scope.werun' 'scope.invoiceTitle', 'scope.werun'
].includes(obj.scope)) { ].includes(obj.scope)) {
resolve({ resolve({
msg: '不在限制范围内', msg: '不在限制范围内',
}) })
@ -1466,11 +1466,32 @@ const util = {
userID: userinfo.id + '', userID: userinfo.id + '',
userSig: imSig, userSig: imSig,
}).then(rs => { }).then(rs => {
util.updateMyProfile(userinfo)
console.log('im login success', rs) console.log('im login success', rs)
}) })
}) })
}, },
// 更新im个人资料
updateMyProfile(userinfo) {
// 验证sdk是否准备完毕
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function () {
util.updateMyProfile(userinfo);
}, 800);
return
}
let obj = {
nick: userinfo.userNickname,
avatar: userinfo.avatar
}
uni.$chat.updateMyProfile(obj).then(res => {
// console.log(res);
})
},
/** /**
* 获取用户信息 * 获取用户信息
* @param {Function} cb 回调函数 * @param {Function} cb 回调函数
@ -1731,7 +1752,7 @@ const util = {
} }
}); });
}, },
showToastAndRedirect(title, icon = 'none', fun = () => {}) { showToastAndRedirect(title, icon = 'none', fun = () => { }) {
uni.showToast({ uni.showToast({
title, title,
icon, icon,
@ -1767,7 +1788,7 @@ const util = {
success: (res) => { success: (res) => {
if (res && res.result) { if (res && res.result) {
let result = JSON.parse(res.result) let result = JSON.parse(res.result)
if (result.type == 'ADDFRIEND') { if (result.type == 'ADDFRIEND') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/news/addFriend?account=${result.account}` url: `/pages/news/addFriend?account=${result.account}`
}); });

View File

@ -111,6 +111,7 @@ function getList() {
uni.$chat.getConversationList().then(rs => { uni.$chat.getConversationList().then(rs => {
let res = rs.data.conversationList let res = rs.data.conversationList
console.log(res);
let arr = [] let arr = []
res.forEach(item => { res.forEach(item => {
let obj = {} let obj = {}

View File

@ -4,7 +4,7 @@ import {
import uni from '@dcloudio/vite-plugin-uni'; import uni from '@dcloudio/vite-plugin-uni';
let target = 'http://91f.xyz:8080' let target = 'http://91f.xyz:8080'
// let target = 'https://1e49a851.r24.cpolar.top/' // let target = 'https://1a880cd5.r24.cpolar.top/'
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],