You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.3 KiB

<template>
<view>
<!-- #ifdef APP-PLUS -->
<view v-for="(items,indexs) in imglist" :key="indexs" v-if="network_log=='none'">
<view class="cu-avatar lg" v-if="info.imgname === items.name" :class="appSetting.circleAvatar?'round':'radius'" @tap="openUserInfo(info)" :style="[{backgroundImage:'url('+ items.path +')'}]"></view>
</view>
<view v-else class="cu-avatar lg" :class="appSetting.circleAvatar?'round':'radius'" @tap="openUserInfo(info)" :style="[{backgroundImage:'url('+ info.avatar +')'}]"></view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="cu-avatar lg" :class="appSetting.circleAvatar?'round':'radius'" @tap="openUserInfo(info)" :style="[{backgroundImage:'url('+ info.avatar +')'}]"></view>
<!-- #endif -->
</view>
</template>
<script>
const userInfo=uni.getStorageSync('userInfo');
const appSetting=uni.getStorageSync('appSetting');
import { useMsgStore } from '@/store/message';
// #ifdef APP-PLUS
import {getSavedImages} from '@/utils/LocalFileSystemURL.js'
// #endif
import { storeToRefs } from 'pinia';
import pinia from '@/store/index'
const msgStore = useMsgStore(pinia)
const {network_log} = storeToRefs(msgStore);
export default{
name : "im-touch",
props : {
info:{type:Object, default:function(){return {};}},
circleAvatar:{type:Boolean, default:false},
profile:{type:Boolean, default:false},
},
data() {
return {
toucheTimer : 0,
fingerRes : [],
distance : 0,
taptimer : 100,
appSetting:appSetting,
imglist:[],
network_log:network_log
}
},
created() {
// #ifdef APP-PLUS
this.getImagePath();
// #endif
// console.info(this.info,'读取地址');
},
methods:{
async getImagePath(){
this.imglist = await getSavedImages()
this.imglist.map(item => {
item.path = plus.io.convertLocalFileSystemURL(item.path)
});
// console.info(this.imglist,'读取地址');
},
// 打开用户详情
openUserInfo(item){
let friend=msgStore.getContact(item.user_id);
// if(!this.profile && !friend){
// uni.showToast({
// title:'已开启用户隐私!',
// icon:'none'
// })
// return false;
// }
// if(item.id==userInfo.user_id) return;
// uni.redirectTo({
// url:"/pages/contacts/detail?id="+this.info.id
// })
uni.navigateTo({
url:"/pages/contacts/detail?id="+this.info.id
})
}
}
}
</script>
<style scoped></style>