Compare commits
6 Commits
307b25d08d
...
e290d77397
Author | SHA1 | Date |
---|---|---|
|
e290d77397 | |
|
b33123604d | |
|
eff7819402 | |
|
9fd01b453f | |
|
a3f0bb6703 | |
|
0ee1576f8b |
|
@ -23,6 +23,7 @@ export const durian = {
|
|||
url: `/coreplay/durianfruitdetail/getDetailInfoByTreeId`,
|
||||
method: 'GET',
|
||||
query: param.query,
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
@ -34,6 +35,7 @@ export const durian = {
|
|||
url: `/coreplay/duriantreeinfo/boughtListByUser`,
|
||||
method: 'GET',
|
||||
query: param.query,
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -99,6 +99,7 @@ const intergral = {
|
|||
method: 'POST',
|
||||
query: param.query,
|
||||
data: param.data,
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -208,10 +208,11 @@ export const news = {
|
|||
})
|
||||
},
|
||||
|
||||
// 群聊发消息
|
||||
// 消息列表
|
||||
getMessageList(param) {
|
||||
return util.request({
|
||||
url: `/user/chat/getMessageList`,
|
||||
// url: `/user/chat/getMessageList`,
|
||||
url: `/user/chat/getMsgListById`,
|
||||
query: param.query,
|
||||
data: param.data,
|
||||
method: 'GET'
|
||||
|
|
|
@ -6,9 +6,7 @@ const config = {
|
|||
// host: 'h5api',
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// host: 'http://91f.xyz:8080',
|
||||
host: 'https://b433d23.r24.cpolar.top/',
|
||||
// host: 'http://hvw2rn.natappfree.cc',
|
||||
host: 'http://91f.xyz:8080',
|
||||
// #endif
|
||||
// 支付方式配置
|
||||
payType: {
|
||||
|
|
|
@ -15,6 +15,9 @@ import {
|
|||
reactive,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad,
|
||||
} from "@dcloudio/uni-app"
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
const {
|
||||
|
@ -149,6 +152,8 @@ onMounted(() => {
|
|||
//
|
||||
// proxy.$refs.alert.open()
|
||||
|
||||
})
|
||||
onLoad(()=>{
|
||||
// 获取未读消息数量
|
||||
getNoReadNum()
|
||||
})
|
||||
|
@ -182,6 +187,7 @@ function handleMenu(item) {
|
|||
else uni.navigateTo({
|
||||
url: `/${item.pagePath}`,
|
||||
})
|
||||
getNoReadNum()
|
||||
return
|
||||
}
|
||||
//
|
||||
|
@ -221,9 +227,10 @@ function getNoReadNum() {
|
|||
return
|
||||
}
|
||||
|
||||
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||
|
||||
// #ifdef APP
|
||||
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
|
||||
// #endif
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -43,9 +43,11 @@
|
|||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
// #ifdef APP
|
||||
uni.offKeyboardHeightChange(rs => {
|
||||
console.log('rs', rs)
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<view class="task pr mtb30 ptb20 plr40 f28 bFFFBF3 br20">
|
||||
<view class="title c333 f36" v-if="task.taskType === 0">任务读秒</view>
|
||||
<view class="title c333 f36" v-else>有效读秒</view>
|
||||
<view>{{task.viewingDuration}}</view>
|
||||
<!-- <view>{{task.viewingDuration}}</view> -->
|
||||
|
||||
<view class="progressBox oh bar mt60">
|
||||
<view class="progress bar" :style="{width: progress + '%'}"></view>
|
||||
|
|
|
@ -1,430 +1,433 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 通讯录
|
||||
*/
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
inject,
|
||||
getCurrentInstance,
|
||||
} from 'vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
import pinyin from 'js-pinyin'
|
||||
import {
|
||||
forEach
|
||||
} from 'lodash';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
const store = useStore()
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
const msgType = {}
|
||||
// 用户列表
|
||||
const userList = reactive({
|
||||
data: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
})
|
||||
// 当前操作的用户
|
||||
let user = reactive({})
|
||||
// 列表下标
|
||||
const listKey = ref('')
|
||||
// 字母列表
|
||||
const letterList = [{
|
||||
key: 'other',
|
||||
name: '#',
|
||||
},
|
||||
{
|
||||
key: 'a',
|
||||
name: 'A',
|
||||
},
|
||||
{
|
||||
key: 'b',
|
||||
name: 'B',
|
||||
},
|
||||
{
|
||||
key: 'c',
|
||||
name: 'C',
|
||||
},
|
||||
{
|
||||
key: 'd',
|
||||
name: 'D',
|
||||
},
|
||||
{
|
||||
key: 'e',
|
||||
name: 'E',
|
||||
},
|
||||
{
|
||||
key: 'f',
|
||||
name: 'F',
|
||||
},
|
||||
{
|
||||
key: 'g',
|
||||
name: 'G',
|
||||
},
|
||||
{
|
||||
key: 'h',
|
||||
name: 'H',
|
||||
},
|
||||
{
|
||||
key: 'i',
|
||||
name: 'I',
|
||||
},
|
||||
{
|
||||
key: 'j',
|
||||
name: 'J',
|
||||
},
|
||||
{
|
||||
key: 'k',
|
||||
name: 'K',
|
||||
},
|
||||
{
|
||||
key: 'l',
|
||||
name: 'L',
|
||||
},
|
||||
{
|
||||
key: 'm',
|
||||
name: 'M',
|
||||
},
|
||||
{
|
||||
key: 'n',
|
||||
name: 'N',
|
||||
},
|
||||
{
|
||||
key: 'o',
|
||||
name: 'O',
|
||||
},
|
||||
{
|
||||
key: 'p',
|
||||
name: 'P',
|
||||
},
|
||||
{
|
||||
key: 'q',
|
||||
name: 'Q',
|
||||
},
|
||||
{
|
||||
key: 'r',
|
||||
name: 'R',
|
||||
},
|
||||
{
|
||||
key: 's',
|
||||
name: 'S',
|
||||
},
|
||||
{
|
||||
key: 't',
|
||||
name: 'T',
|
||||
},
|
||||
{
|
||||
key: 'u',
|
||||
name: 'U',
|
||||
},
|
||||
{
|
||||
key: 'v',
|
||||
name: 'V',
|
||||
},
|
||||
{
|
||||
key: 'w',
|
||||
name: 'W',
|
||||
},
|
||||
{
|
||||
key: 'x',
|
||||
name: 'X',
|
||||
},
|
||||
{
|
||||
key: 'y',
|
||||
name: 'Y',
|
||||
},
|
||||
{
|
||||
key: 'z',
|
||||
name: 'Z',
|
||||
},
|
||||
]
|
||||
// 是否移动
|
||||
const touchmove = ref(false)
|
||||
// 字母列表dom属性
|
||||
const letterDom = reactive({
|
||||
itemHeight: 0,
|
||||
minHeight: 0,
|
||||
maxHeight: 0,
|
||||
height: 0,
|
||||
})
|
||||
// 右滑菜单
|
||||
const rightOption = [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#F85050'
|
||||
},
|
||||
fn: (user) => delFriend(user),
|
||||
},
|
||||
// {
|
||||
// text: '修改备注',
|
||||
// style: {
|
||||
// backgroundColor: '#10C100'
|
||||
// },
|
||||
// fn: (user) => setFriendNote(user),
|
||||
// },
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
// 获取字母属性
|
||||
getLetterProperty()
|
||||
// 添加监听
|
||||
addlistener()
|
||||
|
||||
// proxy.$refs.note.open()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
removelistener()
|
||||
})
|
||||
|
||||
const viewData = ref([])
|
||||
|
||||
// 添加加好友监听
|
||||
function addlistener() {
|
||||
let onFriendListUpdated = (event) => {
|
||||
console.log('onFriendListUpdated', event.data);
|
||||
getFriendList()
|
||||
}
|
||||
|
||||
uni.$chat.on(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, onFriendListUpdated);
|
||||
}
|
||||
|
||||
// 移除加好友监听
|
||||
function removelistener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, () => {});
|
||||
}
|
||||
/**
|
||||
* 通讯录
|
||||
*/
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
inject,
|
||||
getCurrentInstance,
|
||||
} from 'vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
import pinyin from 'js-pinyin'
|
||||
import {
|
||||
forEach
|
||||
} from 'lodash';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
const store = useStore()
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
const msgType = {}
|
||||
// 用户列表
|
||||
const userList = reactive({
|
||||
data: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
})
|
||||
// 当前操作的用户
|
||||
let user = reactive({})
|
||||
// 列表下标
|
||||
const listKey = ref('')
|
||||
// 字母列表
|
||||
const letterList = [{
|
||||
key: 'other',
|
||||
name: '#',
|
||||
},
|
||||
{
|
||||
key: 'a',
|
||||
name: 'A',
|
||||
},
|
||||
{
|
||||
key: 'b',
|
||||
name: 'B',
|
||||
},
|
||||
{
|
||||
key: 'c',
|
||||
name: 'C',
|
||||
},
|
||||
{
|
||||
key: 'd',
|
||||
name: 'D',
|
||||
},
|
||||
{
|
||||
key: 'e',
|
||||
name: 'E',
|
||||
},
|
||||
{
|
||||
key: 'f',
|
||||
name: 'F',
|
||||
},
|
||||
{
|
||||
key: 'g',
|
||||
name: 'G',
|
||||
},
|
||||
{
|
||||
key: 'h',
|
||||
name: 'H',
|
||||
},
|
||||
{
|
||||
key: 'i',
|
||||
name: 'I',
|
||||
},
|
||||
{
|
||||
key: 'j',
|
||||
name: 'J',
|
||||
},
|
||||
{
|
||||
key: 'k',
|
||||
name: 'K',
|
||||
},
|
||||
{
|
||||
key: 'l',
|
||||
name: 'L',
|
||||
},
|
||||
{
|
||||
key: 'm',
|
||||
name: 'M',
|
||||
},
|
||||
{
|
||||
key: 'n',
|
||||
name: 'N',
|
||||
},
|
||||
{
|
||||
key: 'o',
|
||||
name: 'O',
|
||||
},
|
||||
{
|
||||
key: 'p',
|
||||
name: 'P',
|
||||
},
|
||||
{
|
||||
key: 'q',
|
||||
name: 'Q',
|
||||
},
|
||||
{
|
||||
key: 'r',
|
||||
name: 'R',
|
||||
},
|
||||
{
|
||||
key: 's',
|
||||
name: 'S',
|
||||
},
|
||||
{
|
||||
key: 't',
|
||||
name: 'T',
|
||||
},
|
||||
{
|
||||
key: 'u',
|
||||
name: 'U',
|
||||
},
|
||||
{
|
||||
key: 'v',
|
||||
name: 'V',
|
||||
},
|
||||
{
|
||||
key: 'w',
|
||||
name: 'W',
|
||||
},
|
||||
{
|
||||
key: 'x',
|
||||
name: 'X',
|
||||
},
|
||||
{
|
||||
key: 'y',
|
||||
name: 'Y',
|
||||
},
|
||||
{
|
||||
key: 'z',
|
||||
name: 'Z',
|
||||
},
|
||||
]
|
||||
// 是否移动
|
||||
const touchmove = ref(false)
|
||||
// 字母列表dom属性
|
||||
const letterDom = reactive({
|
||||
itemHeight: 0,
|
||||
minHeight: 0,
|
||||
maxHeight: 0,
|
||||
height: 0,
|
||||
})
|
||||
// 右滑菜单
|
||||
const rightOption = [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#F85050'
|
||||
},
|
||||
fn: (user) => delFriend(user),
|
||||
},
|
||||
// {
|
||||
// text: '修改备注',
|
||||
// style: {
|
||||
// backgroundColor: '#10C100'
|
||||
// },
|
||||
// fn: (user) => setFriendNote(user),
|
||||
// },
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
// 获取朋友列表
|
||||
function getFriendList() {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
console.log('getFriendList', isReady)
|
||||
getFriendList()
|
||||
// 获取字母属性
|
||||
getLetterProperty()
|
||||
// 添加监听
|
||||
addlistener()
|
||||
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
getFriendList()
|
||||
}, 500);
|
||||
// proxy.$refs.note.open()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
removelistener()
|
||||
})
|
||||
|
||||
const viewData = ref([])
|
||||
|
||||
// 添加加好友监听
|
||||
function addlistener() {
|
||||
let onFriendListUpdated = (event) => {
|
||||
console.log('onFriendListUpdated', event.data);
|
||||
getFriendList()
|
||||
}
|
||||
|
||||
// #ifdef APP
|
||||
uni.$chat.on(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, onFriendListUpdated);
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 移除加好友监听
|
||||
function removelistener() {
|
||||
// #ifdef APP
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, () => { });
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 获取朋友列表
|
||||
function getFriendList() {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
console.log('getFriendList', isReady)
|
||||
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
getFriendList()
|
||||
}, 500);
|
||||
return
|
||||
}
|
||||
|
||||
//
|
||||
api.news.getFriendList().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
const result = rs.data
|
||||
userList.data.length = 0
|
||||
userList.data = handleUserList(result)
|
||||
return
|
||||
}
|
||||
console.log('getFriendList')
|
||||
|
||||
//
|
||||
api.news.getFriendList().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
const result = rs.data
|
||||
userList.data.length = 0
|
||||
userList.data = handleUserList(result)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户列表排序
|
||||
* @param {Object} userList
|
||||
*/
|
||||
function handleUserList(userList) {
|
||||
// 筛选后的用户列表
|
||||
const userArr = []
|
||||
// 遍历用户列表
|
||||
for (let i = 0; i < userList.length; i++) {
|
||||
const user = userList[i]
|
||||
// 取拼音
|
||||
let char = pinyin.getCamelChars(user.remark || user.userNickname);
|
||||
// 假设姓名的第一个字符为姓氏
|
||||
const letter = char.charAt(0)
|
||||
// 下标
|
||||
let find_index = userArr.findIndex(item => {
|
||||
return item.key === letter
|
||||
/**
|
||||
* 用户列表排序
|
||||
* @param {Object} userList
|
||||
*/
|
||||
function handleUserList(userList) {
|
||||
// 筛选后的用户列表
|
||||
const userArr = []
|
||||
// 遍历用户列表
|
||||
for (let i = 0; i < userList.length; i++) {
|
||||
const user = userList[i]
|
||||
// 取拼音
|
||||
let char = pinyin.getCamelChars(user.remark || user.userNickname);
|
||||
// 假设姓名的第一个字符为姓氏
|
||||
const letter = char.charAt(0)
|
||||
// 下标
|
||||
let find_index = userArr.findIndex(item => {
|
||||
return item.key === letter
|
||||
})
|
||||
|
||||
// 未找到追加整过数组 找到追加到子数组
|
||||
if (find_index == -1) {
|
||||
userArr.push({
|
||||
letter: letter,
|
||||
key: letter,
|
||||
child: [user]
|
||||
})
|
||||
|
||||
// 未找到追加整过数组 找到追加到子数组
|
||||
if (find_index == -1) {
|
||||
userArr.push({
|
||||
letter: letter,
|
||||
key: letter,
|
||||
child: [user]
|
||||
})
|
||||
} else {
|
||||
userArr[find_index].child.push(user)
|
||||
}
|
||||
} else {
|
||||
userArr[find_index].child.push(user)
|
||||
}
|
||||
|
||||
// 按照姓氏的字典序对二维数组进行排序
|
||||
// userArr.sort((a, b) => {
|
||||
// const surnameA = a.key;
|
||||
// const surnameB = b.key;
|
||||
// return surnameA.localeCompare(surnameB);
|
||||
// });
|
||||
return userArr;
|
||||
}
|
||||
|
||||
// 按照姓氏的字典序对二维数组进行排序
|
||||
// userArr.sort((a, b) => {
|
||||
// const surnameA = a.key;
|
||||
// const surnameB = b.key;
|
||||
// return surnameA.localeCompare(surnameB);
|
||||
// });
|
||||
return userArr;
|
||||
}
|
||||
|
||||
// 获取
|
||||
function getLetterProperty() {
|
||||
const query = uni.createSelectorQuery().in(proxy);
|
||||
|
||||
query.select(".letterBox").boundingClientRect((data) => {
|
||||
letterDom.minHeight = data.top
|
||||
letterDom.height = data.height
|
||||
letterDom.maxHeight = data.bottom
|
||||
letterDom.itemHeight = data.height / letterList.length
|
||||
}).exec();
|
||||
}
|
||||
// 获取
|
||||
function getLetterProperty() {
|
||||
const query = uni.createSelectorQuery().in(proxy);
|
||||
|
||||
// 手指触摸开始
|
||||
function handleTouchStart(ev) {
|
||||
touchmove.value = true
|
||||
}
|
||||
query.select(".letterBox").boundingClientRect((data) => {
|
||||
letterDom.minHeight = data.top
|
||||
letterDom.height = data.height
|
||||
letterDom.maxHeight = data.bottom
|
||||
letterDom.itemHeight = data.height / letterList.length
|
||||
}).exec();
|
||||
}
|
||||
|
||||
// 手指触摸移动
|
||||
function handleTouchMove(ev) {
|
||||
if (!touchmove.value) return
|
||||
// 判断临界值
|
||||
let result = ev.touches[0].pageY
|
||||
result = Math.max(result, letterDom.minHeight)
|
||||
result = Math.min(result, letterDom.maxHeight)
|
||||
// 手指触摸开始
|
||||
function handleTouchStart(ev) {
|
||||
touchmove.value = true
|
||||
}
|
||||
|
||||
// 计算当前在那个下标
|
||||
let index = Math.floor(result - letterDom.minHeight) / letterDom.itemHeight
|
||||
index = parseInt(index)
|
||||
// 手指触摸移动
|
||||
function handleTouchMove(ev) {
|
||||
if (!touchmove.value) return
|
||||
// 判断临界值
|
||||
let result = ev.touches[0].pageY
|
||||
result = Math.max(result, letterDom.minHeight)
|
||||
result = Math.min(result, letterDom.maxHeight)
|
||||
|
||||
// 修改下标
|
||||
listKey.value = letterList[index].key
|
||||
}
|
||||
// 计算当前在那个下标
|
||||
let index = Math.floor(result - letterDom.minHeight) / letterDom.itemHeight
|
||||
index = parseInt(index)
|
||||
|
||||
// 手指触摸结束
|
||||
function handleTouchEnd(ev) {
|
||||
touchmove.value = false
|
||||
}
|
||||
// 修改下标
|
||||
listKey.value = letterList[index].key
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击字母
|
||||
* @param {Object} item 点击的当前项
|
||||
*/
|
||||
function handleLetter(item) {
|
||||
listKey.value = item.key
|
||||
}
|
||||
// 手指触摸结束
|
||||
function handleTouchEnd(ev) {
|
||||
touchmove.value = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 右滑菜单
|
||||
* @param {Object} ev 默认事件
|
||||
* @param {Object} user 用户信息
|
||||
*/
|
||||
function handleSwipeAction(ev, user) {
|
||||
ev.content.fn(user)
|
||||
proxy.$refs.swipeAction.closeAll()
|
||||
}
|
||||
/**
|
||||
* 点击字母
|
||||
* @param {Object} item 点击的当前项
|
||||
*/
|
||||
function handleLetter(item) {
|
||||
listKey.value = item.key
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除好友
|
||||
* @param {Object} user 需要删除的好友信息
|
||||
*/
|
||||
function delFriend(user) {
|
||||
new Promise((resolve, reject) => {
|
||||
util.alert({
|
||||
content: `确认删除好友${user.remark || user.userNickname}?`
|
||||
}).then(res => {
|
||||
if (!res.confirm) return
|
||||
return resolve()
|
||||
})
|
||||
}).then(rs => {
|
||||
api.news.deleteFriend({
|
||||
query: {
|
||||
toUserIds: user.userId,
|
||||
},
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
/**
|
||||
* 右滑菜单
|
||||
* @param {Object} ev 默认事件
|
||||
* @param {Object} user 用户信息
|
||||
*/
|
||||
function handleSwipeAction(ev, user) {
|
||||
ev.content.fn(user)
|
||||
proxy.$refs.swipeAction.closeAll()
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除好友
|
||||
* @param {Object} user 需要删除的好友信息
|
||||
*/
|
||||
function delFriend(user) {
|
||||
new Promise((resolve, reject) => {
|
||||
util.alert({
|
||||
content: `确认删除好友${user.remark || user.userNickname}?`
|
||||
}).then(res => {
|
||||
if (!res.confirm) return
|
||||
return resolve()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置好友备注
|
||||
* @param {Object} ev 需要操作的好友信息
|
||||
*/
|
||||
function setFriendNote(ev) {
|
||||
// 合并用户信息
|
||||
Object.assign(user, ev)
|
||||
// 打开设置用户备注弹窗
|
||||
setTimeout(() => {
|
||||
proxy.$refs.note.open()
|
||||
}, 50)
|
||||
}
|
||||
|
||||
// 设置好友备注
|
||||
function handleSaveNote() {
|
||||
api.news.setNotes({
|
||||
}).then(rs => {
|
||||
api.news.deleteFriend({
|
||||
query: {
|
||||
name: user.note || '',
|
||||
friendId: user.userId,
|
||||
}
|
||||
toUserIds: user.userId,
|
||||
},
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
proxy.$refs.note.close()
|
||||
//
|
||||
refreshFriendList()
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
return
|
||||
}
|
||||
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击用户
|
||||
* @param {Object} user 当前用户信息
|
||||
*/
|
||||
function handleUser(user) {
|
||||
util.toChat({
|
||||
name: user.remark || user.userNickname,
|
||||
msgId: user.userId,
|
||||
type: 'C2C',
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 设置好友备注
|
||||
* @param {Object} ev 需要操作的好友信息
|
||||
*/
|
||||
function setFriendNote(ev) {
|
||||
// 合并用户信息
|
||||
Object.assign(user, ev)
|
||||
// 打开设置用户备注弹窗
|
||||
setTimeout(() => {
|
||||
proxy.$refs.note.open()
|
||||
}, 50)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
* @param {Object} url
|
||||
*/
|
||||
function link(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
// 设置好友备注
|
||||
function handleSaveNote() {
|
||||
api.news.setNotes({
|
||||
query: {
|
||||
name: user.note || '',
|
||||
friendId: user.userId,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
proxy.$refs.note.close()
|
||||
//
|
||||
refreshFriendList()
|
||||
return
|
||||
}
|
||||
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击用户
|
||||
* @param {Object} user 当前用户信息
|
||||
*/
|
||||
function handleUser(user) {
|
||||
util.toChat({
|
||||
name: user.remark || user.userNickname,
|
||||
msgId: user.userId,
|
||||
type: 'C2C',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
* @param {Object} url
|
||||
*/
|
||||
function link(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -449,10 +452,10 @@
|
|||
<view class="letter ptb10 plr30 c666 f20">{{ item.letter }}</view>
|
||||
<view class="child pl30 pr50">
|
||||
<uni-swipe-action-item :right-options="rightOption" v-for="(user, secIndex) in item.child"
|
||||
:key="secIndex" @click="handleSwipeAction($event,user)">
|
||||
:key="secIndex" @click="handleSwipeAction($event, user)">
|
||||
<view class="item rows ptb20" @click="handleUser(user)">
|
||||
<image class="wh80 avatar cir" :src="user.avatar" mode="aspectFill" />
|
||||
<view class="name thd f1 ml20 c333 f32">{{user.remark || user.userNickname}}</view>
|
||||
<view class="name thd f1 ml20 c333 f32">{{ user.remark || user.userNickname }}</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</view>
|
||||
|
@ -475,7 +478,7 @@
|
|||
<uni-popup ref="note" type="bottom" mask-background-color="rgba(0,0,0,0)">
|
||||
<view class="noteAlt popBot plr25 bfff">
|
||||
<view class="header rows ptb20">
|
||||
<view class="title c333 f34">设置好友({{user.remark}})备注</view>
|
||||
<view class="title c333 f34">设置好友({{ user.remark }})备注</view>
|
||||
<uni-icons type="closeempty" size="40rpx" @click="$refs.note.close()" />
|
||||
</view>
|
||||
|
||||
|
@ -489,47 +492,47 @@
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 朋友列表
|
||||
.firendBox {
|
||||
// 朋友列表
|
||||
.firendBox {
|
||||
height: 100%;
|
||||
|
||||
.scroll {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.scroll {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// 列表项
|
||||
.li {
|
||||
.letter {
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
|
||||
// 子集
|
||||
.child {
|
||||
.item+.item {
|
||||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
// 列表项
|
||||
.li {
|
||||
.letter {
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
|
||||
// 字母列表
|
||||
.letterBox {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
// 设置好友备注
|
||||
.noteAlt {
|
||||
box-shadow: 0 0 20rpx #0003;
|
||||
|
||||
.content {
|
||||
.input {
|
||||
padding: 20rpx 20rpx;
|
||||
background-color: #eaeaea;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
// 子集
|
||||
.child {
|
||||
.item+.item {
|
||||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 字母列表
|
||||
.letterBox {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
// 设置好友备注
|
||||
.noteAlt {
|
||||
box-shadow: 0 0 20rpx #0003;
|
||||
|
||||
.content {
|
||||
.input {
|
||||
padding: 20rpx 20rpx;
|
||||
background-color: #eaeaea;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -69,7 +69,7 @@ const list = reactive([])
|
|||
onMounted(() => {
|
||||
if (props.type == 0) {
|
||||
getList()
|
||||
} else if(props.type == 1) {
|
||||
} else if (props.type == 1) {
|
||||
// 视频消息
|
||||
} else if (props.type == 2) {
|
||||
// 商城消息
|
||||
|
@ -79,7 +79,7 @@ onMounted(() => {
|
|||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// removeListener()
|
||||
removeListener()
|
||||
})
|
||||
|
||||
// 开启监听消息
|
||||
|
@ -93,7 +93,9 @@ function addListener() {
|
|||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED);
|
||||
// #ifdef APP
|
||||
uni.$chat.off(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED);
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 获取消息列表
|
||||
|
@ -104,7 +106,8 @@ function getList() {
|
|||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
list.data = handleList(rs.data);
|
||||
// list.data = handleList(rs.data);
|
||||
list.data = handleList(JSON.parse(rs.msg).SessionItem);
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
|
@ -112,17 +115,6 @@ function getList() {
|
|||
showCancel: false,
|
||||
})
|
||||
})
|
||||
|
||||
// // 验证sdk是否准备完毕
|
||||
// let isReady = uni.$chat.isReady();
|
||||
// if (!isReady) {
|
||||
// setTimeout(function () {
|
||||
// getList();
|
||||
// }, 1000);
|
||||
// return
|
||||
// }
|
||||
|
||||
// uni.$chat.getMessageList({})
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,53 +122,37 @@ function getList() {
|
|||
* @param {Object} item
|
||||
*/
|
||||
function handleList(list) {
|
||||
list.forEach(item => {
|
||||
item.callbackJson = JSON.parse(item.callbackJson);
|
||||
|
||||
if (item.groupId != null) {
|
||||
item.unreadCount = getGroupNoReadNum(item.groupId)
|
||||
}
|
||||
if (item.callbackJson.callback_json.length) {
|
||||
let msgType = item.callbackJson.callback_json[0].MsgType;
|
||||
if (msgType == TencentCloudChat.TYPES.MSG_TEXT) {
|
||||
item.chatText = item.callbackJson.callback_json[0].MsgContent.Text
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_IMAGE) {
|
||||
item.chatText = '[图片]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_AUDIO) {
|
||||
item.chatText = '[语音]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_VIDEO) {
|
||||
item.chatText = '[视频]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_CUSTOM) {
|
||||
if (item.callbackJson.callback_json[0].businessType == 'redPacket') {
|
||||
item.chatText = `[红包] ${item.callbackJson.blessing}`
|
||||
} else if (item.callbackJson.callback_json[0].businessType == '1') {
|
||||
// if (item.callbackJson.callback_json[0].call_type == '1') {
|
||||
// item.chatText = '[语音通话]'
|
||||
// } else if (item.callbackJson.callback_json[0].call_type == '2') {
|
||||
// item.chatText = '[视频通话]'
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
// 查询群聊未读数量
|
||||
function getGroupNoReadNum(groupId) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
getGroupNoReadNum(groupId);
|
||||
handleList(list);
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
|
||||
const unreadCount = uni.$chat.getTotalUnreadMessageCount('GROUP', groupId);
|
||||
list.forEach(item => {
|
||||
item.MsgTime = handleDate(item.MsgTime)
|
||||
|
||||
return unreadCount;
|
||||
let type = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
uni.$chat.getConversationProfile(type).then(rs => {
|
||||
let res = rs.data.conversation;
|
||||
|
||||
item.chatText = res.lastMessage.messageForShow;
|
||||
item.unreadCount = res.unreadCount;
|
||||
if (item.Type == 1) {
|
||||
item.avatar = res.userProfile.avatar;
|
||||
item.name = res.userProfile.nick;
|
||||
} else if (item.Type == 2) {
|
||||
item.avatar = res.groupProfile.avatar;
|
||||
item.name = res.groupProfile.name;
|
||||
item.num = res.groupProfile.memberCount;
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
// // 点击用户
|
||||
|
@ -204,14 +180,14 @@ function handleChat(item) {
|
|||
// 单聊
|
||||
if (item.groupId == null) {
|
||||
param.type = 'C2C'
|
||||
param.name = `${item.callbackJson.from_name}`
|
||||
param.msgId = `${item.callbackJson.from_id}`
|
||||
param.name = `${item.name}`
|
||||
param.msgId = `${item.To_Account}`
|
||||
} else {
|
||||
// 群聊
|
||||
param.type = 'GROUP'
|
||||
param.name = `${item.groupChatDTO.name}`
|
||||
param.msgId = `${item.groupId}`
|
||||
param.num = `${item.groupChatDTO.memberCount}`
|
||||
param.name = `${item.name}`
|
||||
param.msgId = `${item.GroupId}`
|
||||
param.num = `${item.num}`
|
||||
}
|
||||
|
||||
setRead(item)
|
||||
|
@ -240,7 +216,7 @@ function delMsg(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
|
||||
let conversationId = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
|
||||
uni.$chat.deleteConversation(conversationId).then(rs => {
|
||||
getList()
|
||||
|
@ -258,7 +234,7 @@ function setRead(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
|
||||
let conversationId = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
uni.$chat.setMessageRead({
|
||||
conversationID: conversationId,
|
||||
}).then(rs => {
|
||||
|
@ -266,6 +242,21 @@ function setRead(item) {
|
|||
})
|
||||
}
|
||||
|
||||
// 时间转换
|
||||
function handleDate(timestamp) {
|
||||
var timestamp = +timestamp * 1000;
|
||||
var date = new Date(timestamp);
|
||||
|
||||
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
||||
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
|
||||
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
||||
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
|
||||
var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
|
||||
|
||||
var formattedDate = M + D + h + m + s;
|
||||
return formattedDate
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -326,25 +317,28 @@ function setRead(item) {
|
|||
@click="handleMenu($event, item)">
|
||||
<view class="item rows ptb20 plr30" @click.stop="handleChat(item)">
|
||||
<view class="image wh90 pr">
|
||||
<template v-if="item.groupId == null">
|
||||
<!-- <template v-if="item.groupId == null">
|
||||
<image class="cir wh90" :src="item.callbackJson.from_url" mode="aspectFill" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-else>
|
||||
<image class="cir wh90" :src="item.groupChatDTO.groupFaceUrl" mode="aspectFill" />
|
||||
</template>
|
||||
</template> -->
|
||||
|
||||
<image class="cir wh90" :src="item.avatar" mode="aspectFill" />
|
||||
<view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="col f1 ml20">
|
||||
<view class="rows">
|
||||
<template v-if="item.groupId == null">
|
||||
<view class="name f1 thd c333 f32">{{ item.name }}</view>
|
||||
<!-- <template v-if="item.groupId == null">
|
||||
<view class="name f1 thd c333 f32">{{ item.callbackJson.from_name }}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="name f1 thd c333 f32">{{ item.groupChatDTO.name }}</view>
|
||||
</template>
|
||||
</template> -->
|
||||
<view class="datetime c999 f22">
|
||||
{{ util.formatTime('MM-dd HH:mm', item.createTime) }}</view>
|
||||
{{ util.formatTime('MM-dd HH:mm', item.MsgTime) }}</view>
|
||||
</view>
|
||||
<view class="desc thd mt10 c666 f24">{{ item.chatText }}</view>
|
||||
</view>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name" : "九亿",
|
||||
"appid" : "__UNI__08B31BC",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.5",
|
||||
"versionCode" : 1005,
|
||||
"versionName" : "1.0.6",
|
||||
"versionCode" : 1006,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
|
|
@ -240,7 +240,7 @@
|
|||
{
|
||||
"path": "pages/index/durainActivation",
|
||||
"style": {
|
||||
"navigationBarTitleText": "已激活",
|
||||
"navigationBarTitleText": "我的榴莲果树",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
},
|
||||
|
@ -263,7 +263,7 @@
|
|||
{
|
||||
"path": "pages/index/durianLog",
|
||||
"style": {
|
||||
"navigationBarTitleText": "榴莲果明细",
|
||||
"navigationBarTitleText": "榴莲果产出明细",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
|
|
|
@ -34,7 +34,23 @@
|
|||
function buyDurianList() {
|
||||
api.durian.buyDurianList({}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// 我的榴莲果树
|
||||
treeData.value = rs.data.dataList.map(item => {
|
||||
// orderType 0赠送 1兑换
|
||||
item.style = {
|
||||
'0': {
|
||||
1: 'scroll1',
|
||||
2: 'scroll2',
|
||||
3: 'scroll3',
|
||||
4: 'scroll4',
|
||||
} [item.durianConfigId],
|
||||
'1': {
|
||||
1: 'buy1',
|
||||
2: 'buy2',
|
||||
3: 'buy3',
|
||||
4: 'buy4',
|
||||
} [item.durianConfigId],
|
||||
} [item.orderType]
|
||||
item.formatHash = formatStr(item.treeHash)
|
||||
return item
|
||||
})
|
||||
|
@ -83,20 +99,21 @@
|
|||
<view class="appbw">
|
||||
<!-- -->
|
||||
<view class="list mlr40">
|
||||
<view class="item rows mtb25 br15" v-for="(item,index) in treeData" :key="index"
|
||||
@click="handleDetail(item)">
|
||||
<view class="item rows mtb25 br15" v-for="(item,index) in treeData" :key="index" @click="handleDetail(item)"
|
||||
:class="item.style">
|
||||
<image class="wh180 fs0" src="/static/tree.png" mode="aspectFit" />
|
||||
|
||||
<view class="col f1 ml30 mtb30 c333 f26">
|
||||
<view class="txt mtb10">每日可释放:{{item.release}}</view>
|
||||
<view class="txt mtb10">每日可释放:{{item.releasableDaily}}</view>
|
||||
<view class="txt mtb10">剩余可释放:{{item.remainFruitCount}}</view>
|
||||
<view class="txt mtb10">当前级别:{{item.treeName}}</view>
|
||||
<view class="txt mtb10" @click.stop="util.copyText(item.treeHash)">
|
||||
<text>哈希值: {{item.formatHash}}</text>
|
||||
<image class="wh20 ml10" src="/static/copy.png" mode="aspectFit" />
|
||||
<image class="wh20 ml10" src="/static/copy.png" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tac c999 f40 mt80" v-if="!treeData[0]">当前暂无榴莲果树~</view>
|
||||
</view>
|
||||
|
||||
<!-- 填充 -->
|
||||
|
@ -107,20 +124,44 @@
|
|||
<style lang="scss">
|
||||
//
|
||||
.list {
|
||||
|
||||
// 默认
|
||||
.item {
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
|
||||
.item+.item:nth-child(3n+1) {
|
||||
background-color: #F4CAFF;
|
||||
// 卷轴赠送
|
||||
.scroll1 {
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
|
||||
.item+.item:nth-child(3n+2) {
|
||||
.scroll2 {
|
||||
background-color: #E4FBFF;
|
||||
}
|
||||
|
||||
.item+.item:nth-child(3n+3) {
|
||||
.scroll3 {
|
||||
background-color: #CACDFF;
|
||||
}
|
||||
|
||||
.scroll4 {
|
||||
background-color: #F4CAFF;
|
||||
}
|
||||
|
||||
// 普通购买
|
||||
.buy1 {
|
||||
background-color: rgb(225, 253, 204);
|
||||
}
|
||||
|
||||
.buy2 {
|
||||
background-color: #FFF0B1;
|
||||
}
|
||||
|
||||
.buy3 {
|
||||
background-color: #CAF0F3;
|
||||
}
|
||||
|
||||
.buy4 {
|
||||
background-color: #FBC5C5;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,229 +1,249 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 榴莲首页
|
||||
*/
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
import {
|
||||
onMounted,
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
defineExpose,
|
||||
} from 'vue';
|
||||
/**
|
||||
* 榴莲首页
|
||||
*/
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
import {
|
||||
onMounted,
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
defineExpose,
|
||||
} from 'vue';
|
||||
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onHide,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 未登录
|
||||
import noLogin from '@/components/login/noLogin.vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 进度
|
||||
import task from '@/components/index/task'
|
||||
// 接口
|
||||
import api from '@/api/index.js'
|
||||
// 二级支付
|
||||
import payPwd from '@/components/mine/payPwd.vue'
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 互转表单
|
||||
const form = reactive({
|
||||
// 交易对方的用户ID
|
||||
targetUserId: '',
|
||||
// 账户
|
||||
account: '',
|
||||
// 榴莲果数量
|
||||
fruitAmount: '',
|
||||
// 姓名首字
|
||||
first: '',
|
||||
// 姓名
|
||||
name: '',
|
||||
//
|
||||
secondPassword: '',
|
||||
})
|
||||
//读秒记录
|
||||
const viewData = ref({
|
||||
seconds: 0
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
return store.state.userinfo
|
||||
})
|
||||
// 进度条
|
||||
const progress = computed(() => {
|
||||
let result = viewData.value.seconds
|
||||
result = Math.min(Number(result), 100)
|
||||
return result
|
||||
})
|
||||
// 我的钱包
|
||||
const purse = computed(() => {
|
||||
return store.state.purse || {}
|
||||
})
|
||||
|
||||
// 榴莲果配置
|
||||
const configData = reactive({
|
||||
minConsumption: '',
|
||||
platformPercentage: ''
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
// proxy.$refs.dealRef.open()
|
||||
// proxy.$refs.payPwdRef.open()
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
// 获取钱包
|
||||
util.getPurse()
|
||||
|
||||
getConfig()
|
||||
})
|
||||
|
||||
// 榴莲果交易
|
||||
function handleSubmit() {
|
||||
// 验证必填项
|
||||
if (!form.account) {
|
||||
util.alert('请输入账号')
|
||||
return
|
||||
}
|
||||
if (!form.fruitAmount) {
|
||||
util.alert('请输入榴莲果转账数量')
|
||||
return
|
||||
}
|
||||
|
||||
// 根据账号查询用户id
|
||||
api.mine.getUserDataByAccount({
|
||||
query: {
|
||||
account: form.account,
|
||||
},
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
const result = rs.data
|
||||
// 交易对方的id
|
||||
form.targetUserId = result.userName
|
||||
form.name = result.userRealName.slice(1, result.userRealName.length)
|
||||
// 打开姓名校验
|
||||
proxy.$refs.payee.open()
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onHide,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 未登录
|
||||
import noLogin from '@/components/login/noLogin.vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 进度
|
||||
import task from '@/components/index/task'
|
||||
// 接口
|
||||
import api from '@/api/index.js'
|
||||
// 二级支付
|
||||
import payPwd from '@/components/mine/payPwd.vue'
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 互转表单
|
||||
const form = reactive({
|
||||
// 交易对方的用户ID
|
||||
targetUserId: '',
|
||||
// 账户
|
||||
account: '',
|
||||
// 榴莲果数量
|
||||
fruitAmount: '',
|
||||
// 姓名首字
|
||||
first: '',
|
||||
// 姓名
|
||||
name: '',
|
||||
//
|
||||
secondPassword: '',
|
||||
})
|
||||
}
|
||||
|
||||
// 验证真实姓名
|
||||
function handlePayeeConfirm() {
|
||||
// 验证必填项
|
||||
if (!form.first) {
|
||||
util.alert('请输入对方姓名首字母')
|
||||
return
|
||||
}
|
||||
|
||||
api.durian.nameComparison({
|
||||
query: {
|
||||
// 对方账号
|
||||
account: form.account,
|
||||
// 对方姓名
|
||||
name: `${form.first}${form.name}`,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
if (rs.data) proxy.$refs.payPwdRef.open()
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
//读秒记录
|
||||
const viewData = ref({
|
||||
seconds: 0
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
return store.state.userinfo
|
||||
})
|
||||
// 进度条
|
||||
const progress = computed(() => {
|
||||
let result = viewData.value.seconds
|
||||
result = Math.min(Number(result), 100)
|
||||
return result
|
||||
})
|
||||
// 我的钱包
|
||||
const purse = computed(() => {
|
||||
return store.state.purse || {}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易
|
||||
* @param {Object} ev 二级密码
|
||||
*/
|
||||
function handlePwdConfirm(ev) {
|
||||
// 验证必填项
|
||||
if (!form.first) {
|
||||
util.alert('请输入对方姓名首字母')
|
||||
return
|
||||
}
|
||||
if (!form.first) {
|
||||
util.alert('请输入对方姓名首字母')
|
||||
return
|
||||
}
|
||||
if (!form.account) {
|
||||
util.alert('请输入账号')
|
||||
return
|
||||
}
|
||||
if (!form.fruitAmount) {
|
||||
util.alert('请输入榴莲果转账数量')
|
||||
return
|
||||
}
|
||||
// 榴莲果配置
|
||||
const configData = reactive({
|
||||
minConsumption: '',
|
||||
platformPercentage: ''
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
// proxy.$refs.dealRef.open()
|
||||
// proxy.$refs.payPwdRef.open()
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
// 获取钱包
|
||||
util.getPurse()
|
||||
|
||||
getConfig()
|
||||
})
|
||||
|
||||
// 榴莲果交易
|
||||
api.durian.consume({
|
||||
data: {
|
||||
// 更新用户信息
|
||||
userId: userinfo.value.id,
|
||||
// 交易对方的用户id
|
||||
targetUserId: form.targetUserId,
|
||||
// 交易类型
|
||||
transactionType: 10,
|
||||
// 榴莲果交易数量
|
||||
fruitAmount: form.fruitAmount,
|
||||
// 对方姓名
|
||||
name: `${form.first}${form.name}`,
|
||||
// 对方账号
|
||||
account: form.account,
|
||||
// 二级密码
|
||||
secondPassword: ev
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
//
|
||||
util.getPurse()
|
||||
function handleSubmit() {
|
||||
// 验证必填项
|
||||
if (!form.account) {
|
||||
util.alert('请输入账号')
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转
|
||||
function navigateToPage(path) {
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 榴莲果配置
|
||||
function getConfig() {
|
||||
api.durian.durianFruitConfig().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
configData.minConsumption = rs.data.minConsumption
|
||||
configData.platformPercentage = +rs.data.platformPercentage * 100
|
||||
return;
|
||||
if (!form.fruitAmount) {
|
||||
util.alert('请输入榴莲果转账数量')
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
|
||||
// 验证添加最低金额限制
|
||||
const min = parseFloat(configData.minConsumption)
|
||||
const price = parseFloat(form.fruitAmount)
|
||||
if (price < min) {
|
||||
util.alert(`榴莲果最低${min}起转`)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 根据账号查询用户id
|
||||
api.mine.getUserDataByAccount({
|
||||
query: {
|
||||
account: form.account,
|
||||
},
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
const result = rs.data
|
||||
// 交易对方的id
|
||||
form.targetUserId = result.userName
|
||||
form.name = result.userRealName.slice(1, result.userRealName.length)
|
||||
// 打开姓名校验
|
||||
proxy.$refs.payee.open()
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 验证真实姓名
|
||||
function handlePayeeConfirm() {
|
||||
// 验证必填项
|
||||
if (!form.first) {
|
||||
util.alert('请输入对方姓名首字母')
|
||||
return
|
||||
}
|
||||
|
||||
api.durian.nameComparison({
|
||||
query: {
|
||||
// 对方账号
|
||||
account: form.account,
|
||||
// 对方姓名
|
||||
name: `${form.first}${form.name}`,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
if (rs.data) proxy.$refs.payPwdRef.open()
|
||||
else {
|
||||
util.alert({
|
||||
content: '姓名不匹配',
|
||||
showCancel: false,
|
||||
})
|
||||
form.first = ''
|
||||
}
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易
|
||||
* @param {Object} ev 二级密码
|
||||
*/
|
||||
function handlePwdConfirm(ev) {
|
||||
// 验证必填项
|
||||
if (!form.first) {
|
||||
util.alert('请输入对方姓名首字母')
|
||||
return
|
||||
}
|
||||
if (!form.account) {
|
||||
util.alert('请输入账号')
|
||||
return
|
||||
}
|
||||
if (!form.fruitAmount) {
|
||||
util.alert('请输入榴莲果转账数量')
|
||||
return
|
||||
}
|
||||
|
||||
// 榴莲果交易
|
||||
api.durian.consume({
|
||||
data: {
|
||||
// 更新用户信息
|
||||
userId: userinfo.value.id,
|
||||
// 交易对方的用户id
|
||||
targetUserId: form.targetUserId,
|
||||
// 交易类型
|
||||
transactionType: 10,
|
||||
// 榴莲果交易数量
|
||||
fruitAmount: form.fruitAmount,
|
||||
// 交易值
|
||||
totalAmount: form.fruitAmount,
|
||||
// 对方姓名
|
||||
name: `${form.first}${form.name}`,
|
||||
// 对方账号
|
||||
account: form.account,
|
||||
// 二级密码
|
||||
secondPassword: ev
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code === 200) {
|
||||
form.fruitAmount = ''
|
||||
form.account = ''
|
||||
form.first = ''
|
||||
proxy.$refs.dealRef.close()
|
||||
proxy.$refs.payee.close()
|
||||
//
|
||||
util.getPurse()
|
||||
//
|
||||
util.alert('转让成功')
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转
|
||||
function navigateToPage(path) {
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
|
||||
// 榴莲果配置
|
||||
function getConfig() {
|
||||
api.durian.durianFruitConfig().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
configData.minConsumption = rs.data.minConsumption
|
||||
configData.platformPercentage = +rs.data.platformPercentage * 100
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -304,8 +324,8 @@ function getConfig() {
|
|||
<!-- 互转 -->
|
||||
<uni-popup ref="dealRef" type="center">
|
||||
<view class="dealAlt popMid ptb40 plr60 bfff br30">
|
||||
<view class="title tac c333 f28">榴莲果互转</view>
|
||||
<view class="content rows mtb10">
|
||||
<view class="title thd tac c333 f32"> 当前可用榴莲果 {{purse.fruit}}</view>
|
||||
<view class="content rows mtb30">
|
||||
<image class="wh140" src="/static/fruit.png" mode="aspectFit" />
|
||||
<image class="wh70" src="/static/dealMid.png" mode="aspectFit" />
|
||||
<image class="wh140" src="/static/dealUser.png" mode="aspectFit" />
|
||||
|
@ -335,10 +355,12 @@ function getConfig() {
|
|||
|
||||
<view class="mtb20 f28">请补全对方姓名首字,以防转错</view>
|
||||
|
||||
<view class="inputBox rows mauto mtb20 plr30">
|
||||
<input class="first" v-model.trim="form.first" type="text" placeholder="" />
|
||||
<view class="">*</view>
|
||||
<view class="f1 tar">{{ form.name }}</view>
|
||||
<view class="inputEdit rows mauto mtb20 plr30">
|
||||
<input class="first side" v-model.trim="form.first" type="text" placeholder="" />
|
||||
<view class="mlr20">*</view>
|
||||
<view class="side tar">
|
||||
<text v-if="0">{{ form.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="rows mt50">
|
||||
|
@ -354,64 +376,68 @@ function getConfig() {
|
|||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
//
|
||||
.board {
|
||||
background-image: linear-gradient(103deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
||||
}
|
||||
|
||||
// 背景颜色
|
||||
.bgColor {
|
||||
background-color: #FFFBF3;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.explain {
|
||||
.button {
|
||||
width: 250rpx;
|
||||
margin-left: 0;
|
||||
//
|
||||
.board {
|
||||
background-image: linear-gradient(103deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
||||
}
|
||||
}
|
||||
|
||||
// 树苗
|
||||
.sapling {
|
||||
.button {
|
||||
width: 300rpx;
|
||||
// 背景颜色
|
||||
.bgColor {
|
||||
background-color: #FFFBF3;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 榴莲果专区
|
||||
.durianSection {
|
||||
|
||||
// 须知
|
||||
.notice {
|
||||
|
||||
.key {
|
||||
width: 140rpx;
|
||||
height: 70rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(99deg, #27efe2 0%, #a45eff 43%, #ff004f 100%), linear-gradient(108deg, #d7f550 -2%, #afef4d 98%);
|
||||
border-radius: 100rpx;
|
||||
.explain {
|
||||
.button {
|
||||
width: 250rpx;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
.dealAlt {
|
||||
.hint {
|
||||
color: #3d3d3d;
|
||||
opacity: .7;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付
|
||||
.payee {
|
||||
.inputBox {
|
||||
width: 120rpx;
|
||||
box-shadow: 0 0 20rpx rgba(0, 0, 0, .2);
|
||||
// 树苗
|
||||
.sapling {
|
||||
.button {
|
||||
width: 300rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.first {
|
||||
width: 50rpx;
|
||||
// 榴莲果专区
|
||||
.durianSection {
|
||||
|
||||
// 须知
|
||||
.notice {
|
||||
|
||||
.key {
|
||||
width: 140rpx;
|
||||
height: 70rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(99deg, #27efe2 0%, #a45eff 43%, #ff004f 100%), linear-gradient(108deg, #d7f550 -2%, #afef4d 98%);
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
.dealAlt {
|
||||
.hint {
|
||||
color: #3d3d3d;
|
||||
opacity: .7;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付
|
||||
.payee {
|
||||
|
||||
// 侧边
|
||||
.side {
|
||||
width: 80rpx;
|
||||
}
|
||||
|
||||
//
|
||||
.first {
|
||||
padding: 20rpx;
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -110,6 +110,9 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 暂无更多 -->
|
||||
<view class="nomore mtb50" v-if="!scrollLog.data[0]">暂无明细~</view>
|
||||
</view>
|
||||
|
||||
<!-- 填充 -->
|
||||
|
|
|
@ -58,6 +58,12 @@
|
|||
// 卷轴列表
|
||||
dataList.value = result.dataList.map(item => {
|
||||
item.formatHash = item.scrollHash.replace(/(\d{4})\d*(\d{4})/, "$1****$2")
|
||||
// item.style = {
|
||||
// '1级卷轴': 'scroll1',
|
||||
// '2级卷轴': 'scroll2',
|
||||
// '3级卷轴': 'scroll3',
|
||||
// '4级卷轴': 'scroll4',
|
||||
// } [item.scrollName]
|
||||
return item
|
||||
})
|
||||
return
|
||||
|
@ -117,7 +123,6 @@
|
|||
* @param {Object} item 当前对象
|
||||
*/
|
||||
function handleCopy(item) {
|
||||
// scrollHash
|
||||
util.copyText(item.scrollHash)
|
||||
}
|
||||
</script>
|
||||
|
@ -129,8 +134,9 @@
|
|||
<view class="value mt5 ptb5 plr20 tac br10">{{total}}</view>
|
||||
</view>
|
||||
|
||||
<view v-for="(item, index) in dataList" :key="item.id" @click="handleDetail(item)">
|
||||
<view class="board pr oh mtb30 mlr30 ptb20 plr20 cfff f30 br20">
|
||||
<view class="listBox">
|
||||
<view class="board pr oh mtb30 mlr30 ptb20 plr20 cfff f30 br20" v-for="(item, index) in dataList"
|
||||
:key="item.id" @click="handleDetail(item)">
|
||||
<view class=" df">
|
||||
<view class="left f1 mr40">
|
||||
<view class="key mt20 f32">卷轴可释放</view>
|
||||
|
@ -183,6 +189,25 @@
|
|||
background-color: #333;
|
||||
}
|
||||
|
||||
// 列表
|
||||
// .listBox {
|
||||
// .scroll1 {
|
||||
// background-color: #F4F4F4;
|
||||
// }
|
||||
|
||||
// .scroll2 {
|
||||
// background-color: #E4FBFF;
|
||||
// }
|
||||
|
||||
// .scroll3 {
|
||||
// background-color: #CACDFF;
|
||||
// }
|
||||
|
||||
// .scroll4 {
|
||||
// background-color: #F4CAFF;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
.board {
|
||||
background-image: linear-gradient(121deg, #27EFE2 0%, #A45EFF 43%, #FF004F 99%);
|
||||
|
|
|
@ -157,7 +157,8 @@
|
|||
<!-- 一级 -->
|
||||
<view class="li mtb30" v-for="(item,index) in team.sonUser" :key="item.id">
|
||||
<view class="menber df aic">
|
||||
<view class="c333 f32">{{item.userNickname}}</view>
|
||||
<view class="count mr20 plr10 cfff br10" v-if="item.isShop == 1">商</view>
|
||||
<view class="c333 f32">{{item.userNickname}}{{item.isShop}}</view>
|
||||
<template v-if="item.sonList[0]">
|
||||
<uni-icons @click="lowTeam(item)" type="up" color="#A45EFF" size="28rpx"
|
||||
v-if="item.showSecond" />
|
||||
|
@ -178,7 +179,7 @@
|
|||
<view class="content df aic f1 ptb10">
|
||||
<view class="line"></view>
|
||||
<view class="ml10 df aic c999 f28">
|
||||
<view class="count mr20 plr10 cfff br10" v-if="secItem.isShop">商</view>
|
||||
<view class="count mr20 plr10 cfff br10" v-if="secItem.isShop == 1">商</view>
|
||||
<view class="name">{{secItem.userNickname}}</view>
|
||||
<view class="label ml10">{{secItem.count}}</view>
|
||||
</view>
|
||||
|
@ -221,6 +222,12 @@
|
|||
.team {
|
||||
background-color: #FFFBF3;
|
||||
|
||||
// 商家标签
|
||||
.count {
|
||||
font-size: 28rpx;
|
||||
background-image: linear-gradient(114deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
||||
}
|
||||
|
||||
// 二级列表
|
||||
.list {
|
||||
padding-left: .5em;
|
||||
|
@ -259,11 +266,6 @@
|
|||
// background-clip: text;
|
||||
// text-fill-color: transparent;
|
||||
// }
|
||||
|
||||
// 商家标签
|
||||
.count {
|
||||
background-image: linear-gradient(114deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
// 榴莲果api
|
||||
import durianlApi from '@/api/durian.js';
|
||||
const {
|
||||
proxy
|
||||
|
@ -50,6 +51,8 @@
|
|||
buyDurianList()
|
||||
// 获取钱包
|
||||
util.getPurse()
|
||||
// 获取榴莲果规则
|
||||
getArticle()
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
|
@ -117,7 +120,7 @@
|
|||
function getArticle() {
|
||||
api.getArticle({
|
||||
query: {
|
||||
id: 2,
|
||||
agreementId: 5,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
|
@ -201,7 +204,7 @@
|
|||
|
||||
<view class="content mtb20 mlr25">
|
||||
<scroll-view scroll-y="true" class="scroll">
|
||||
<rich-text :nodes="rule.context"></rich-text>
|
||||
<rich-text :nodes="rule.content"></rich-text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
})
|
||||
|
||||
onReady(() => {
|
||||
proxy.$refs.orderDetail.open()
|
||||
// proxy.$refs.orderDetail.open()
|
||||
})
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
|
|
|
@ -19,6 +19,8 @@ import {
|
|||
} from 'vuex'
|
||||
// 顶部状态栏
|
||||
import statusBar from '@/components/header/statusBar'
|
||||
// 未登录状态
|
||||
import noLogin from '@/components/login/noLogin'
|
||||
|
||||
// 产品列表
|
||||
import productList from '@/components/shop/productList/productList';
|
||||
|
@ -64,7 +66,19 @@ function toCustomer() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<view class="app">
|
||||
<view class="page" v-if="!userinfo.id">
|
||||
<statusBar />
|
||||
<view class="head rows plr30">
|
||||
<view class="side"></view>
|
||||
<view class="f1"></view>
|
||||
<view class="side">
|
||||
<uni-icons type="gear" size="40rpx" color="#333" @click="link('/pages/mine/setting/setting')" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<noLogin class="f1" />
|
||||
</view>
|
||||
<view class="app" v-else>
|
||||
<view class="apex" :class="{ 'active': showHeader }">
|
||||
<statusBar />
|
||||
<view class="head rows">
|
||||
|
|
|
@ -155,7 +155,9 @@ function addListener() {
|
|||
}, 200)
|
||||
}
|
||||
|
||||
// #ifdef APP
|
||||
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 监听内容滚动
|
||||
|
@ -210,6 +212,7 @@ function sendMsg(param) {
|
|||
data: param.data,
|
||||
}).then((rs) => {
|
||||
if (rs.code == 200) {
|
||||
getHistory()
|
||||
param.success ? param.success() : ''
|
||||
return
|
||||
}
|
||||
|
@ -310,15 +313,15 @@ function getMoreHistroy() {
|
|||
*/
|
||||
function getHistory(param = {}) {
|
||||
// 验证sdk是否准备完毕
|
||||
// #ifdef APP
|
||||
let isReady = uni.$chat.isReady();
|
||||
//
|
||||
if (!isReady && userinfo.value.id) {
|
||||
setTimeout(function () {
|
||||
getHistory(param)
|
||||
getHistory()
|
||||
}, 200);
|
||||
return
|
||||
}
|
||||
//
|
||||
// #endif
|
||||
loading.value = true
|
||||
|
||||
// 获取单聊聊天记录
|
||||
|
|
|
@ -94,7 +94,9 @@ function imLoading() {
|
|||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
// #ifdef APP
|
||||
uni.$chat.off(TencentCloudChat.EVENT.SDK_READY);
|
||||
// #endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,9 +3,7 @@ import {
|
|||
} from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
// let target = 'http://91f.xyz:8080'
|
||||
let target = 'https://b433d23.r24.cpolar.top/'
|
||||
// let target = 'http://hvw2rn.natappfree.cc'
|
||||
let target = 'http://91f.xyz:8080'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
|
|
Loading…
Reference in New Issue