123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <view v-for="(item, index) in messageList" :key="index">
- <view v-if="item.payload.operationType === 1" class="card handle">
- <view>
- <view class="time">{{ caculateTimeago(item.time * 1000) }}</view>
- {{ translateGroupSystemNotice(item) }}
- </view>
- <view class="choose"><view class="button" @tap="handleClick">处理</view></view>
- </view>
- <view class="card" v-else>
- <view class="time">{{ caculateTimeago(item.time * 1000) }}</view>
- {{translateGroupSystemNotice(item)}}
- </view>
- </view>
- </template>
- <script lang="ts">
- import { defineComponent, watchEffect, reactive, toRefs } from 'vue';
- import { translateGroupSystemNotice } from "../../../../utils/untis";
- import { caculateTimeago } from '../../../../utils/date';
- const MessageSystem = defineComponent({
- props: {
- data: {
- type: Array,
- default: () => {
- return [];
- }
- },
- types: {
- type: Object,
- default: () => {
- return {};
- }
- },
- },
- setup(props:any, ctx:any) {
- const data = reactive({
- messageList: [],
- types: {}
- });
- watchEffect(()=>{
- data.messageList = props.data;
- data.types = props.types;
- });
- const handleApplication = () => {
- uni.showActionSheet({
- itemList: ['同意', '拒绝'],
- success: res => {
- const option = {
- handleAction: 'Agree',
- handleMessage: '欢迎进群',
- message: this.message
- };
-
- if (res.tapIndex === 1) {
- option.handleAction = 'Reject';
- option.handleMessage = '拒绝申请';
- }
-
- uni.$TUIKit.handleGroupApplication(option)
- .then(() => {
- uni.showToast({
- title: option.handleAction === 'Agree' ? '已同意申请' : '已拒绝申请'
- });
- })
- .catch(error => {
- uni.showToast({
- title: error.message || '处理失败',
- icon: 'none'
- });
- });
- }
- });
- }
- // const handleApplication = (handleAction:string, message:any) => {
- // const options:any = {
- // handleAction,
- // message,
- // };
- // ctx.emit('application', options);
- // };
- return {
- ...toRefs(data),
- translateGroupSystemNotice,
- handleApplication,
- caculateTimeago,
- };
- }
- });
- export default MessageSystem
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100%;
- height: 200rpx;
- }
- .handle {
- display: flex;
- justify-content: space-between;
- }
- .card {
- font-size: 14px;
- margin: 20px;
- padding: 20px;
- box-sizing: border-box;
- border: 1px solid #abdcff;
- background-color: #f0faff;
- border-radius: 12px;
- }
- .time {}
- .button {
- color: blue;
- border-radius: 8px;
- line-height: 30px;
- font-size: 16px;
- width: 70px;
- }
- </style>
|