feat: v0.05-release

feat: 支持企业开放注册通道
feat: 优化后台管理tab默认选中
feat: 支持指定pm2进程日志路径
feat: 优化请求异常处理
fix: 修复通过分享加入群聊消息错误
fix: 修复浏览器通知失效
fix: 修复画板变量作用域
fix: 修复频道公开开关变更不及时
This commit is contained in:
iamtsm 2025-06-21 21:41:50 +08:00
parent 0f59746e47
commit c46d009e59
27 changed files with 288 additions and 113 deletions

View File

@ -1,6 +1,6 @@
{
"name": "tl-rtc-app",
"version": "0.0.3",
"version": "0.0.5",
"description": "webrtc, p2p, file, video, draw, chat",
"scripts": {
"http": "pm2 start pm2.config.http.json",
@ -20,7 +20,6 @@
"@grpc/grpc-js": "^1.8.0",
"@grpc/proto-loader": "^0.6.0",
"body-parser": "^1.20.2",
"bull": "^4.16.5",
"concurrently": "^8.2.0",
"cookie-parser": "^1.4.6",
"cross-env": "^5.2.0",
@ -49,7 +48,6 @@
"image-size": "^2.0.1",
"lru-cache": "^10.0.1",
"minimist": "^1.2.5",
"mocha": "^10.2.0",
"multer": "^1.4.5-lts.1",
"music-metadata": "^7.14.0",
"mysql2": "^2.1.0",

View File

@ -8,7 +8,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "http"
}
},
"out_file": "./logs/tl-rtc-app-super-api.log",
"error_file": "./logs/tl-rtc-app-super-api.error.log",
"merge_logs": false
},
{
"name": "tl-rtc-app-api",
@ -18,7 +21,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "http"
}
},
"out_file": "./logs/tl-rtc-app-api.log",
"error_file": "./logs/tl-rtc-app-api.error.log",
"merge_logs": false
},
{
"name": "tl-rtc-app-socket",
@ -28,7 +34,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "http"
}
},
"out_file": "./logs/tl-rtc-app-socket.log",
"error_file": "./logs/tl-rtc-app-socket.error.log",
"merge_logs": false
}
]
}

View File

@ -8,7 +8,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "https"
}
},
"out_file": "./logs/tl-rtc-app-super-api.log",
"error_file": "./logs/tl-rtc-app-super-api.error.log",
"merge_logs": false
},
{
"name": "tl-rtc-app-api",
@ -18,7 +21,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "https"
}
},
"out_file": "./logs/tl-rtc-app-api.log",
"error_file": "./logs/tl-rtc-app-api.error.log",
"merge_logs": false
},
{
"name": "tl-rtc-app-socket",
@ -28,7 +34,10 @@
"max_memory_restart": "500M",
"env": {
"tl_rtc_app_env_mode": "https"
}
},
"out_file": "./logs/tl-rtc-app-socket.log",
"error_file": "./logs/tl-rtc-app-socket.error.log",
"merge_logs": false
}
]
}

View File

@ -100,12 +100,12 @@ const addChannelUser = async function({
TlUserDef.name
])
let message = '<p>' + userInfo[TlUserDef.name] + "加入频道" + '</p>';
let message = '<p>' + userInfo[TlUserDef.name] + "加入群聊" + '</p>';
if(isInvite){
message = '<p>' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入频道" + '</p>';
message = '<p>' + loginUsername + "邀请 " + userInfo[TlUserDef.name] + "加入群聊" + '</p>';
}
if(isShare){
message = '<p>' + loginUsername + "通过分享加入频道" + '</p>';
message = '<p>' + userInfo[TlUserDef.name] + "通过" + loginUsername + "的分享加入群聊" + '</p>';
}
// 生成邀请消息
@ -255,7 +255,7 @@ const addChannelUserList = async function({ loginInfo, channelId, userIdList, ro
channelId,
message: '<p>' + loginUsername + "邀请 " + userInfoList.map(
item => item[TlUserDef.name]
).join(",") + " 共" + userInfoList.length + "人加入频道" + '</p>',
).join(",") + " 共" + userInfoList.length + "人加入群聊" + '</p>',
other: JSON.stringify({
[TlChannelChatOther.ip]: '',
}),

View File

@ -26,7 +26,7 @@ const {
* @param {*} description
*/
const adminAddCompany = async function ({
loginInfo, name, address, phone, email, website, logo, description
loginInfo, name, address, phone, email, website, logo, description, openRegister
}) {
const {
loginUserCompanyId, loginUserId, loginUserRoleId
@ -66,6 +66,11 @@ const adminAddCompany = async function ({
const code = uuid.v4().replace(/-/g, '')
let flag = 0
if(openRegister !== null && openRegister !== undefined){
flag = setBit(flag, TlCompanyFlag.IS_OPEN_REGISTER, openRegister)
}
const info = await companyService.addInfo({
name,
address,
@ -74,7 +79,8 @@ const adminAddCompany = async function ({
website,
logo,
description,
code
code,
flag
})
if(Object.keys(info).length == 0){
@ -99,10 +105,11 @@ const adminAddCompany = async function ({
* @param {*} code
* @param {*} authStatus
* @param {*} expiredStatus
* @param {*} openRegister
*/
const adminUpdateCompany = async function ({
id, loginInfo, name, address, phone, email,
website, logo, description, code, authStatus, expiredStatus
website, logo, description, code, authStatus, expiredStatus, openRegister
}) {
const {
loginUserCompanyId, loginUserId, loginUserRoleId
@ -148,6 +155,10 @@ const adminUpdateCompany = async function ({
return tlResponseArgsError("请求参数错误")
}
if(openRegister == undefined || openRegister == null){
return tlResponseArgsError("请求参数错误")
}
const info = await companyService.getInfoById({
id
})
@ -169,6 +180,8 @@ const adminUpdateCompany = async function ({
flag = setBit(flag, TlCompanyFlag.IS_EXPIRED, false)
}
flag = setBit(flag, TlCompanyFlag.IS_OPEN_REGISTER, openRegister)
const result = await companyService.updateInfoById({
id: id,
}, {
@ -301,6 +314,7 @@ const adminGetCompanyList = async function ({
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
resultList.push({
id: item[TlCompanyDef.id],
@ -314,6 +328,7 @@ const adminGetCompanyList = async function ({
code: item[TlCompanyDef.code],
authStatus,
expiredStatus,
openRegister,
createTime: item[TlCompanyDef.createdAt],
})
}
@ -396,6 +411,7 @@ const adminGetCompanyInfo = async function ({
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
return tlResponseSuccess("获取成功", {
id: info[TlCompanyDef.id],
@ -409,11 +425,14 @@ const adminGetCompanyInfo = async function ({
code: info[TlCompanyDef.code],
authStatus,
expiredStatus,
openRegister,
createTime: info[TlCompanyDef.createdAt],
})
}
module.exports = {
getCompanyInfo,
@ -421,5 +440,5 @@ module.exports = {
adminUpdateCompany,
adminGetCompanyList,
adminDeleteCompany,
adminGetCompanyInfo
adminGetCompanyInfo,
}

View File

@ -1,14 +1,64 @@
const crypto = require("crypto")
const {
tlResponseSuccess, tlResponseForbidden
checkBit, tlResponseSuccess, tlResponseForbidden
} = require("../../utils/utils");
const { get_env_config, set_env_config } = require("../../../conf/env_config");
const conf = get_env_config()
const companyService = require('../../service/company/tl_company_service')
const userSessionService = require('../../service/user/tl_user_session_service')
const { inner: TlRoleInner } = require('../../tables/tl_role')
const { fields: TlCompanyFields } = require('../../tables/tl_company')
const {
Def: TlCompanyDef, Flag: TlCompanyFlag
} = TlCompanyFields
/**
* 获取所有企业邀请码 - 最多返回10个
* @returns
*/
const getAllCompanyInviteCode = async function () {
const companyList = await companyService.getListForPage({}, [
TlCompanyDef.id,
TlCompanyDef.code,
TlCompanyDef.name,
TlCompanyDef.flag
], 1, 10)
const resultList = []
for(let i = 0; i < companyList.length; i++) {
const item = companyList[i];
// 处理每个企业的邀请码
const flag = item[TlCompanyDef.flag] || 0
const code = item[TlCompanyDef.code] || ''
const name = item[TlCompanyDef.name] || ''
// 过滤掉没有邀请码的企业
if(code.length === 0) {
continue
}
const authStatus = checkBit(flag, TlCompanyFlag.IS_PASS_AUTH)
const expiredStatus = checkBit(flag, TlCompanyFlag.IS_EXPIRED)
const openRegister = checkBit(flag, TlCompanyFlag.IS_OPEN_REGISTER)
// 没有通过认证、已过期、未开放注册的企业,不算在内
if(!authStatus && !expiredStatus && !openRegister) {
continue
}
resultList.push({
value: code,
name: name
})
}
return resultList
}
/**
@ -19,6 +69,8 @@ const { inner: TlRoleInner } = require('../../tables/tl_role')
* @param {*} loginInfo 登录信息
*/
const initData = async function({openTurn, useSecret, ip, token}){
const inviteCodeList = await getAllCompanyInviteCode()
if(!token){
return tlResponseSuccess("获取成功",{
version : conf.version,
@ -26,6 +78,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
rtcConfig: { iceServers: [] },
options: {},
logo : genClientLogo(),
codeList: inviteCodeList
})
}
@ -40,6 +93,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
rtcConfig: { iceServers: [] },
options: {},
logo : genClientLogo(),
codeList: inviteCodeList
})
}
@ -57,6 +111,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
"offerToReceiveVideo": 1
},
logo : genClientLogo(),
codeList: inviteCodeList
})
}
@ -70,6 +125,7 @@ const initData = async function({openTurn, useSecret, ip, token}){
"offerToReceiveVideo": 1
},
logo : genClientLogo(),
codeList: inviteCodeList
})
}
@ -158,14 +214,6 @@ const adminGetSystemEnvConfig = async function({
password: conf.redis_password,
}
// 队列配置
const queueConfig = {
type: conf.task_queue_type,
host: conf.task_queue_host,
port: conf.task_queue_port,
password: conf.task_queue_password,
}
// webrtc配置
const webrtcConfig = {
stun_host: conf.webrtc_stun_host,

View File

@ -21,7 +21,7 @@ const { Def: TlUserDef, Flag: TlUserFlag } = userFields
const { fields: userFingerPrintFields } = require('../../tables/tl_user_finger_print')
const { Def: TlUserFingerPrintDef } = userFingerPrintFields
const { fields: channelUserFields } = require('../../tables/tl_channel_user')
const { Def: TlChannelUserDef } = channelUserFields
const { Def: TlChannelUserDef, Type: TlChannelUserType } = channelUserFields
const { inner: TlRoleInner } = require('../../tables/tl_role')
@ -30,8 +30,9 @@ const { inner: TlRoleInner } = require('../../tables/tl_role')
* @param {*} account
* @param {*} password
* @param {*} fps
* @param {*} inviteCode
*/
const userLoginByAccount = async function({account, password, fps}){
const userLoginByAccount = async function({account, password, fps, inviteCode}){
if(!account){
return tlResponseArgsError("用户名或密码错误")
}
@ -40,6 +41,10 @@ const userLoginByAccount = async function({account, password, fps}){
return tlResponseArgsError("用户名或密码错误")
}
if(!inviteCode){
return tlResponseArgsError("邀请码错误")
}
// base64解码
account = Buffer.from(account, 'base64').toString()
password = Buffer.from(password, 'base64').toString()
@ -52,7 +57,26 @@ const userLoginByAccount = async function({account, password, fps}){
return tlResponseArgsError("用户名或密码错误")
}
const user = await userService.getInfoByNameForLogin({
const company = await companyService.getInfoByCode({
code: inviteCode
}, [
TlCompanyDef.id,
TlCompanyDef.name
])
if(Object.keys(company).length === 0){
return tlResponseArgsError("邀请码无效")
}
const companyId = company[TlCompanyDef.id]
const companyName = company[TlCompanyDef.name]
if(!companyId){
return tlResponseForbidden("非法用户")
}
const user = await userService.getInfoByName({
companyId: companyId,
name: account
}, [
TlUserDef.id,
@ -78,20 +102,6 @@ const userLoginByAccount = async function({account, password, fps}){
return tlResponseArgsError("用户名或密码错误")
}
const company = await companyService.getInfoById({
id: user[TlUserDef.companyId]
}, [
TlCompanyDef.id,
TlCompanyDef.name,
])
const companyId = company[TlCompanyDef.id]
const companyName = company[TlCompanyDef.name]
if(!companyId){
return tlResponseForbidden("非法用户")
}
const token = userSessionService.generateLoginToken();
const info = {
loginUserId: user[TlUserDef.id],
@ -122,8 +132,9 @@ const userLoginByAccount = async function({account, password, fps}){
* @param {*} email
* @param {*} password
* @param {*} fps
* @param {*} inviteCode
*/
const userLoginByEmail = async function({email, password, fps}){
const userLoginByEmail = async function({email, password, fps, inviteCode}){
if(!email){
return tlResponseArgsError("邮箱或密码错误")
}
@ -132,6 +143,10 @@ const userLoginByEmail = async function({email, password, fps}){
return tlResponseArgsError("邮箱或密码错误")
}
if(!inviteCode){
return tlResponseArgsError("邀请码错误")
}
// base64解码
email = Buffer.from(email, 'base64').toString()
password = Buffer.from(password, 'base64').toString()
@ -144,7 +159,26 @@ const userLoginByEmail = async function({email, password, fps}){
return tlResponseArgsError("邮箱或密码错误")
}
const user = await userService.getInfoByEmailForLogin({
const company = await companyService.getInfoByCode({
code: inviteCode
}, [
TlCompanyDef.id,
TlCompanyDef.name
])
if(Object.keys(company).length === 0){
return tlResponseArgsError("邀请码无效")
}
const companyId = company[TlCompanyDef.id]
const companyName = company[TlCompanyDef.name]
if(!companyId){
return tlResponseForbidden("非法用户")
}
const user = await userService.getInfoByEmail({
companyId: companyId,
email
}, [
TlUserDef.id,
@ -162,20 +196,6 @@ const userLoginByEmail = async function({email, password, fps}){
return tlResponseArgsError("邮箱或密码错误")
}
const company = await companyService.getInfoById({
id: user[TlUserDef.companyId]
}, [
TlCompanyDef.id,
TlCompanyDef.name
])
const companyId = company[TlCompanyDef.id]
const companyName = company[TlCompanyDef.name]
if(!companyId){
return tlResponseForbidden("非法用户")
}
if(!verifyEncryptStr({
inputStr: password,
hashedStr: user[TlUserDef.password],
@ -214,6 +234,7 @@ const userLoginByEmail = async function({email, password, fps}){
* 通过指纹登录接口 - 一键登录
* @param {*} fps
* @param {*} username
* @param {*} inviteCode
*/
const userLoginByFingerPrint = async function({fps, username}){
if(!fps){
@ -223,7 +244,7 @@ const userLoginByFingerPrint = async function({fps, username}){
if(!username){
return tlResponseArgsError("一键登录失败, 请使用其他登录方式登录")
}
if(username.length > 20){
return tlResponseArgsError("一键登录失败, 请使用其他登录方式登录")
}

View File

@ -1,5 +1,6 @@
const {
tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams,
tlConsole, tlResponseSvrError, tlConsoleError, tlResponseArgsError, checkRequestParams,
encryptData
} = require("../../../utils/utils");
const express = require('express');
const router = express.Router();
@ -14,10 +15,10 @@ const companyBiz = require('../../../biz/company/company_biz');
*/
router.post('/add-company', async function(request, response) {
try {
const { name, address, phone, email, website, logo, description } = request.body;
const { name, address, phone, email, website, logo, description, openRegister } = request.body;
if (!checkRequestParams({
name, address, phone, email, website, logo, description
name, address, phone, email, website, logo, description, openRegister
})) {
response.json(tlResponseArgsError("请求参数非法"));
return;
@ -25,7 +26,7 @@ router.post('/add-company', async function(request, response) {
const loginInfo = request.ctx || {}
const result = await companyBiz.adminAddCompany({
name, address, phone, email, website, logo, description, loginInfo
name, address, phone, email, website, logo, description, loginInfo, openRegister
});
response.json(result);
@ -46,7 +47,7 @@ router.post('/update-company', async function(request, response) {
try {
const {
id, name, address, phone, email, website, logo,
description, code, authStatus, expiredStatus
description, code, authStatus, expiredStatus, openRegister
} = request.body;
if (!checkRequestParams({
@ -60,7 +61,7 @@ router.post('/update-company', async function(request, response) {
const loginInfo = request.ctx || {}
const result = await companyBiz.adminUpdateCompany({
id, name, address, phone, email, website,
logo, description, loginInfo, code, authStatus, expiredStatus
logo, description, loginInfo, code, authStatus, expiredStatus, openRegister
});
response.json(result);

View File

@ -1,4 +1,4 @@
const {
const {
tlResponseSvrError, tlConsoleError,
tlResponseArgsError, checkRequestParams,
tlResponseSuccess
@ -11,7 +11,6 @@ const {
LOGIN : {
LOGIN_TOKEN_KEY,
LOGIN_TOKEN_EXPIRE,
SYSTEM_LOGIN_TOKEN_EXPIRE,
SYSTEM_LOGIN_TOKEN_KEY
}
@ -46,7 +45,7 @@ router.get('/login-state', async function(request, response) {
*/
router.post('/login-by-account', async function(request, response) {
try {
const { account, password, fps } = request.body;
const { account, password, fps, inviteCode } = request.body;
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
if(token){
@ -59,14 +58,14 @@ router.post('/login-by-account', async function(request, response) {
}
if (!checkRequestParams({
account, password, fps
account, password, fps, inviteCode
})) {
response.json(tlResponseArgsError("请求参数非法"));
return;
}
const result = await userLoginBiz.userLoginByAccount({
account, password, fps
account, password, fps, inviteCode
});
response.cookie(LOGIN_TOKEN_KEY, result.data, {
@ -88,7 +87,7 @@ router.post('/login-by-account', async function(request, response) {
*/
router.post('/login-by-email', async function(request, response) {
try {
const { email, password, fps } = request.body;
const { email, password, fps, inviteCode } = request.body;
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
if(token){
@ -101,14 +100,14 @@ router.post('/login-by-email', async function(request, response) {
}
if (!checkRequestParams({
email, password, fps
email, password, fps, inviteCode
})) {
response.json(tlResponseArgsError("请求参数非法"));
return;
}
const result = await userLoginBiz.userLoginByEmail({
email, password, fps
email, password, fps, inviteCode
});
response.cookie(LOGIN_TOKEN_KEY, result.data, {
@ -131,7 +130,7 @@ router.post('/login-by-email', async function(request, response) {
*/
router.post('/login-by-fp', async function(request, response) {
try {
const { username, fps} = request.body;
const { username, fps, inviteCode } = request.body;
const { [LOGIN_TOKEN_KEY]: token } = request.cookies;
if(token){
@ -144,14 +143,14 @@ router.post('/login-by-fp', async function(request, response) {
}
if (!checkRequestParams({
username, fps
username, fps, inviteCode
})) {
response.json(tlResponseArgsError("请求参数非法"));
return;
}
const result = await userLoginBiz.userLoginByFingerPrint({
username, fps
username, fps, inviteCode
});
response.cookie(LOGIN_TOKEN_KEY, result.data, {

View File

@ -1,7 +1,7 @@
const crypto = require('crypto');
const { get_env_config } = require("./../../conf/env_config");
const {
tlConsoleWarn, encryptStr, verifyEncryptStr,
tlConsoleWarn, encryptStr, verifyEncryptStr, setBit
} = require("./../../src/utils/utils");
//获取环境变量
const conf = get_env_config();
@ -14,6 +14,7 @@ const { fields: companyFields } = require('../tables/tl_company')
const TlUserDef = userFields.Def
const TlCompanyDef = companyFields.Def
const TlCompanyFlag = companyFields.Flag
/**
@ -45,7 +46,8 @@ const checkDefaultBeforStartServer = async function(){
website: 'https://github.com/tl-open-source/tl-rtc-app',
description: 'TL-RTC-APP默认企业',
logo: '/image/tlrtcapp-logo.svg',
code: 'tl-rtc-app'
code: 'tl-rtc-app',
flag: setBit(0, TlCompanyFlag.IS_OPEN_REGISTER, true)
})
if(Object.keys(result).length === 0){

View File

@ -2,6 +2,7 @@ const { fields } = require('../../tables/tl_company')
const TlCompanyDao = require('../../dao/tl_company_dao')
const TlCompanyDef = fields.Def
const TableName = fields.Name
const TableFields = Object.keys(fields.Def).map(key => fields.Def[key])
const { tlConsoleError, tlConsole } = require("../../../src/utils/utils");
const { Op } = require('sequelize')
@ -11,7 +12,7 @@ const { Op } = require('sequelize')
* @param {*} data
*/
const addInfo = async function ({
name, address, phone, email, website, logo, description, code
name, address, phone, email, website, logo, description, code, flag
}) {
// 参数校验
if (!name) {
@ -49,6 +50,11 @@ const addInfo = async function ({
return {}
}
if(flag == undefined || flag == null){
tlConsoleError(TableName, "请求service参数flag为空")
return {}
}
const info = await TlCompanyDao.addInfo({
[TlCompanyDef.name]: name,
[TlCompanyDef.address]: address,
@ -57,6 +63,7 @@ const addInfo = async function ({
[TlCompanyDef.website]: website,
[TlCompanyDef.logo]: logo,
[TlCompanyDef.code]: code,
[TlCompanyDef.flag]: flag,
[TlCompanyDef.description]: description
});

View File

@ -20,6 +20,7 @@ const tl_company_fields = {
Flag: {
IS_PASS_AUTH: 0x1, //是否通过认证
IS_EXPIRED: 0x2, //是否过期
IS_OPEN_REGISTER: 0x4, // 是否开放注册
},
}

View File

@ -109,6 +109,10 @@ Vue.component('company-detail', {
<span class="info-label">认证状态:</span>
<span class="info-value">{{ currentCompany.authStatus ? '已认证' : '未认证' }}</span>
</div>
<div class="info-item">
<span class="info-label">注册通道:</span>
<span class="info-value">{{ currentCompany.openRegister ? '已开放' : '已关闭' }}</span>
</div>
<div class="info-item">
<span class="info-label">创建时间:</span>
<span class="info-value">{{ window.util.timeAgo(currentCompany.createTime) }}</span>

View File

@ -21,6 +21,7 @@ Vue.component('company-component', {
description: '',
expiredStatus: false,
authStatus: false,
openRegister: false,
createTime: ''
},
companySearch: { // 企业搜索条件
@ -175,7 +176,8 @@ Vue.component('company-component', {
logo: '',
description: '',
expiredStatus: false,
authStatus: false
authStatus: false,
openRegister: false
};
this.showCompanyDialog('添加企业');
@ -198,7 +200,8 @@ Vue.component('company-component', {
logo: company.logo || '',
description: company.description || '',
authStatus: company.authStatus || false,
expiredStatus: company.expiredStatus || false
expiredStatus: company.expiredStatus || false,
openRegister: company.openRegister || false
};
this.showCompanyDialog('编辑企业');
@ -274,6 +277,12 @@ Vue.component('company-component', {
<input type="checkbox" name="expiredStatus" lay-skin="switch" lay-text="已过期|未过期" ${this.companyForm.expiredStatus ? 'checked' : ''}>
</div>
</div>
<div class="layui-form-item" style="${isAdd ? 'display:none;' : ''}">
<label class="layui-form-label">注册通道</label>
<div class="layui-input-block">
<input type="checkbox" name="openRegister" lay-skin="switch" lay-text="关闭|开放" ${this.companyForm.openRegister ? 'checked' : ''}>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">企业描述</label>
<div class="layui-input-block">
@ -295,6 +304,8 @@ Vue.component('company-component', {
that.companyForm.authStatus = data.elem.checked;
}else if(data.elem.name === 'expiredStatus'){
that.companyForm.expiredStatus = data.elem.checked;
}else if(data.elem.name === 'openRegister'){
that.companyForm.openRegister = data.elem.checked;
}
});
},
@ -311,7 +322,8 @@ Vue.component('company-component', {
logo: $('input[name="logo"]').val(),
description: $('textarea[name="description"]').val(),
authStatus: that.companyForm.authStatus,
expiredStatus: that.companyForm.expiredStatus
expiredStatus: that.companyForm.expiredStatus,
openRegister: that.companyForm.openRegister
};
// 保存企业信息

View File

@ -119,7 +119,7 @@ const loadSystemJs = function(){
username: username, // 用户名
userAvatar: userAvatar, // 用户头像
showUserPanel: false, // 显示用户面板
activeTab: '', // 当前激活的Tab
activeTab: 'service', // 当前激活的Tab
sidebarCollapsed: false,// 侧边栏是否收缩
loginForm: { // 登录表单
username: '',

View File

@ -1,5 +1,5 @@
#-----------------以下为基础配置-----------------#
tl_rtc_app_version=0.0.3
tl_rtc_app_version=0.0.5
## 后台管理端口
tl_rtc_app_super_api_port=9098
## api服务端口

View File

@ -69,6 +69,7 @@
:is-mobile="isMobile"
:right-module="rightModule"
:left-module="leftModule"
:code-list="codeList"
v-cloak>
</tl_rtc_app_module_login>
@ -90,6 +91,8 @@
@left-module-change="leftModuleChange"
v-show="leftModule == 'contact'"
:socket="socket"
:company="company"
:user="user"
:is-mobile="isMobile"
:right-module="rightModule"
:left-module="leftModule"
@ -133,6 +136,7 @@
:is-mobile="isMobile"
:right-module="rightModule"
:left-module="leftModule"
:code-list="codeList"
v-cloak>
</tl_rtc_app_module_login_content>

View File

@ -128,7 +128,14 @@ const tl_rtc_app_api = new Vue({
options.responseType = responseType;
}
let response = await axios(options)
let response = null
try{
response = await axios(options)
}catch(e){
console.error("request error: ", e.message)
callback && callback(null)
return null
}
if(useCache && this.defaultOpenCache){
await this.setData({

View File

@ -1394,6 +1394,7 @@ const tl_rtc_app_draw = new Vue({
parentDom.appendChild(textarea);
textarea.focus();
let that = this;
textarea.addEventListener('blur', function () {
if (textarea.value !== '') {
drawTextHandler(textarea.value);

View File

@ -1394,6 +1394,8 @@ const tl_rtc_app_module_channel_content = {
update_types: ['channelInfo'],
}
})
this.channelGroupCanBeSearch = !this.channelGroupCanBeSearch
},
},
mounted() {

View File

@ -228,7 +228,7 @@ const tl_rtc_app_module_channel_list = {
}
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
const channelInfo = this.channels.find(item => item.channelId === channelId)
new Notification(channelInfo.channelName, {
body: '收到新消息啦,快去看看吧',

View File

@ -15,7 +15,11 @@ const tl_rtc_app_module_contact = {
rightModule: {
type: String,
default: ''
}
},
user: {
type: Object,
default: {}
},
},
computed: {
propsSocket(){
@ -30,6 +34,9 @@ const tl_rtc_app_module_contact = {
propsRightModule() {
return this.rightModule;
},
propsUser(){
return this.user;
},
},
watch: {
leftModule: function (val) {
@ -74,6 +81,7 @@ const tl_rtc_app_module_contact = {
:left-module="propsLeftModule"
:right-module="propsRightModule"
:socket="propsSocket"
:user="propsUser"
@left-module-change="leftModuleChange"
@right-module-change="rightModuleChange"
v-cloak>
@ -84,6 +92,7 @@ const tl_rtc_app_module_contact = {
:right-module="propsRightModule"
:is-mobile="propsIsMobile"
:socket="propsSocket"
:user="propsUser"
@left-module-change="leftModuleChange"
@right-module-change="rightModuleChange"
v-cloak>

View File

@ -524,7 +524,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyContactList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("好友申请提醒", {
body: '收到新的好友申请,快去看看吧',
dir: 'auto',
@ -544,7 +544,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyContactList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("好友申请提醒", {
body: 'ta通过了你的好友申请',
dir: 'auto',
@ -564,7 +564,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyContactList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("好友申请提醒", {
body: 'ta拒绝了你的好友申请',
dir: 'auto',
@ -582,7 +582,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyGroupList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("群聊申请提醒", {
body: '收到新的群聊申请,快去看看吧',
dir: 'auto',
@ -598,7 +598,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyGroupList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("群聊申请提醒", {
body: 'ta通过了你的群聊申请',
dir: 'auto',
@ -614,7 +614,7 @@ const tl_rtc_app_module_contact_list = {
await this.getApplyGroupList()
// 有浏览器系统桌面消息通知
if(webNotify && window.Notification && Notification.permission === 'granted'){
if(this.webNotify && window.Notification && Notification.permission === 'granted'){
new Notification("群聊申请提醒", {
body: 'ta拒绝了你的群聊申请',
dir: 'auto',

View File

@ -15,6 +15,10 @@ const tl_rtc_app_module_login_content = {
rightModule: {
type: String,
default: ''
},
codeList: {
type: Array,
default: () => []
}
},
computed: {
@ -30,6 +34,9 @@ const tl_rtc_app_module_login_content = {
propsRightModule() {
return this.rightModule;
},
propsCodeList() {
return this.codeList;
}
},
watch: {
leftModule: function (val) {
@ -105,6 +112,7 @@ const tl_rtc_app_module_login_content = {
:socket="propsSocket"
:left-module="propsLeftModule"
:right-module="propsRightModule"
:code-list="propsCodeList"
@left-module-change="leftModuleChange"
@right-module-change="rightModuleChange"
>
@ -116,6 +124,7 @@ const tl_rtc_app_module_login_content = {
:socket="propsSocket"
:left-module="propsLeftModule"
:right-module="propsRightModule"
:code-list="propsCodeList"
@left-module-change="leftModuleChange"
@right-module-change="rightModuleChange"
>

View File

@ -11,6 +11,10 @@ const tl_rtc_app_module_login_content_account = {
rightModule: {
type: String,
default: ''
},
codeList: {
type: Array,
default: () => []
}
},
computed: {
@ -23,6 +27,9 @@ const tl_rtc_app_module_login_content_account = {
propsRightModule() {
return this.rightModule;
},
propsCodeList() {
return this.codeList;
}
},
watch: {
leftModule: function (val) {
@ -36,7 +43,7 @@ const tl_rtc_app_module_login_content_account = {
return {
account: '',
password: '',
inviteCode: 'tlrtcappdemo',
inviteCode: '请输入邀请码',
btnType : 'login',
requesting : false
}
@ -92,6 +99,7 @@ const tl_rtc_app_module_login_content_account = {
let params = {
account: Base64.encode(this.account),
password: Base64.encode(this.password),
inviteCode: this.inviteCode,
fps: fps,
}
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
@ -182,10 +190,11 @@ const tl_rtc_app_module_login_content_account = {
开始注册帐号
</div>
<div class="tl-rtc-app-right-login-content-body-form">
<div class="tl-rtc-app-right-login-content-body-form-item" v-show="btnType === 'register'">
<input
v-model="inviteCode"
type="text" autocomplete="off" placeholder="邀请码" class="layui-input" maxlength="60">
<div class="tl-rtc-app-right-login-content-body-form-item">
<select class="layui-input" lay-search="" v-model="inviteCode">
<option key="请输入邀请码" value="请输入邀请码">请输入邀请码</option>
<option v-for="code in propsCodeList" :key="code.value" :value="code.value">{{ code.value }} ({{ code.name }})</option>
</select>
</div>
<div class="tl-rtc-app-right-login-content-body-form-item">
<input id='loginAccountInput'

View File

@ -11,6 +11,10 @@ const tl_rtc_app_module_login_content_email = {
rightModule: {
type: String,
default: ''
},
codeList: {
type: Array,
default: () => []
}
},
computed: {
@ -29,6 +33,9 @@ const tl_rtc_app_module_login_content_email = {
propsRightModule() {
return this.rightModule;
},
propsCodeList() {
return this.codeList;
}
},
watch: {
leftModule: function (val) {
@ -43,7 +50,7 @@ const tl_rtc_app_module_login_content_email = {
code: '',
email: '',
password: '',
inviteCode: 'tlrtcappdemo',
inviteCode: '请输入邀请码',
btnType : 'login',
requesting : false,
getCodeTime: 0,
@ -99,7 +106,8 @@ const tl_rtc_app_module_login_content_email = {
let params = {
email: Base64.encode(this.email),
password: Base64.encode(this.password)
password: Base64.encode(this.password),
inviteCode: this.inviteCode
}
if(!window.tl_rtc_app_comm.checkRequestParams(params)){
this.popErrorMsg("请求参数非法")
@ -314,8 +322,11 @@ const tl_rtc_app_module_login_content_email = {
开始重置密码
</div>
<div class="tl-rtc-app-right-login-content-body-form">
<div class="tl-rtc-app-right-login-content-body-form-item" v-show="btnType === 'register' || btnType === 'forgot'">
<input v-model="inviteCode" type="text" autocomplete="off" placeholder="邀请码" class="layui-input" maxlength="60">
<div class="tl-rtc-app-right-login-content-body-form-item">
<select class="layui-input" lay-search="" v-model="inviteCode">
<option key="请输入邀请码" value="请输入邀请码">请输入邀请码</option>
<option v-for="code in propsCodeList" :key="code.value" :value="code.value">{{ code.value }} ({{ code.name }})</option>
</select>
</div>
<div class="tl-rtc-app-right-login-content-body-form-item">
<input id='loginEmailInput' v-model="email" type="text" autocomplete="off" placeholder="邮箱" class="layui-input" maxlength="48">

View File

@ -13,7 +13,7 @@ let load_tl_rtc_app_js = async function(){
}
let {
wsHost, logo, version, rtcConfig, options,
wsHost, logo, version, rtcConfig, options, codeList
} = configInitRes.data
let {
@ -195,15 +195,7 @@ let load_tl_rtc_app_js = async function(){
})
}
let langMode = 'zh'
let langArgs = tl_rtc_app_comm.getRequestHashArgs("lang")
if (langArgs && ['zh','en'].includes(langArgs)) {
langMode = langArgs;
}
return {
langMode : langMode, // 默认中文
lang : tl_rtc_app_lang, // 语言包
logo : logo, // 打印logo
version : version,// 项目当前版本
socket: socket, // socket
@ -211,6 +203,7 @@ let load_tl_rtc_app_js = async function(){
options: options, // rtc配置
wsHost : wsHost, // ws地址
isLogin : isLogin, // 是否登录
codeList: codeList, // 开放的邀请码列表
user: {
userId : userId, // 用户id
username: username, // 用户名称