oa_app仓库初始化
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<fy-header title="发起群聊" back />
|
||||
<view class="card field">
|
||||
<input v-model="name" placeholder="群名称(必填)" />
|
||||
</view>
|
||||
<view class="hint">已选 {{ picked.length }} 人</view>
|
||||
<view class="card">
|
||||
<view v-for="p in people" :key="p.id" class="item" @click="toggle(p.id)">
|
||||
<view class="box" :class="{ on: picked.includes(p.id) }" />
|
||||
<view class="av">{{ p.name.slice(0, 1) }}</view>
|
||||
<view class="meta">
|
||||
<text class="n">{{ p.name }}</text>
|
||||
<text class="s">{{ p.title }} · {{ p.department }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad">
|
||||
<view class="btn-primary" :class="{ off: !can }" @click="ok">创建并进入</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FyHeader from '../../components/fy-header.vue'
|
||||
import { store } from '../../utils/store.js'
|
||||
import { toast } from '../../utils/format.js'
|
||||
|
||||
export default {
|
||||
components: { FyHeader },
|
||||
data() {
|
||||
return { name: '', picked: [] }
|
||||
},
|
||||
computed: {
|
||||
people() {
|
||||
return Object.values(store.people).filter((p) => !store.me || p.id !== store.me.id)
|
||||
},
|
||||
can() {
|
||||
return String(this.name || '').trim() && this.picked.length >= 1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggle(id) {
|
||||
const i = this.picked.indexOf(id)
|
||||
if (i >= 0) this.picked.splice(i, 1)
|
||||
else this.picked.push(id)
|
||||
},
|
||||
async ok() {
|
||||
if (!this.can) {
|
||||
toast('请填写群名并至少选一位同事')
|
||||
return
|
||||
}
|
||||
try {
|
||||
uni.showLoading({ title: '创建中…', mask: true })
|
||||
const conv = await store.createGroup(this.name.trim(), this.picked)
|
||||
uni.hideLoading()
|
||||
uni.redirectTo({ url: '/pages/chat/chat?sid=' + encodeURIComponent(conv.id) })
|
||||
} catch (e) {
|
||||
uni.hideLoading()
|
||||
toast((e && e.message) || '创建失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.field { margin: 24rpx; padding: 8rpx 24rpx; }
|
||||
.field input { height: 80rpx; font-size: 30rpx; }
|
||||
.hint { margin: 0 32rpx 12rpx; font-size: 22rpx; color: #737686; }
|
||||
.card { margin: 0 24rpx 24rpx; overflow: hidden; }
|
||||
.item { display: flex; align-items: center; padding: 20rpx 24rpx; }
|
||||
.box { width: 36rpx; height: 36rpx; border: 2rpx solid #c3c6d7; border-radius: 8rpx; margin-right: 16rpx; }
|
||||
.box.on { background: #2563eb; border-color: #2563eb; }
|
||||
.av { width: 72rpx; height: 72rpx; border-radius: 50%; background: #e2e7ff; color: #004ac6; display: flex; align-items: center; justify-content: center; font-weight: 600; }
|
||||
.meta { margin-left: 16rpx; }
|
||||
.n { display: block; font-size: 28rpx; font-weight: 600; }
|
||||
.s { font-size: 22rpx; color: #737686; }
|
||||
.pad { padding: 0 24rpx 40rpx; }
|
||||
.off { opacity: 0.45; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user