Ship native social weapp: immersive hall chat, SRS live, join pay.
Wire Taro social pages to social_svc (Centrifugo + live RTMP), drop multi-channel chat chrome, and add weapp WXSS sanitize/deploy helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
065dd7dc68
commit
92bbee3c6c
72
apps/admin/deploy/_fix_live_flv.py
Normal file
72
apps/admin/deploy/_fix_live_flv.py
Normal file
@ -0,0 +1,72 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
EXT=/www/server/panel/vhost/nginx/extension/www.nomadro.cn/live-flv.conf
|
||||
sudo tee "$EXT" >/dev/null <<'EOF'
|
||||
# Nomadro social native live — must beat Next catch-all
|
||||
location ^~ /live/ {
|
||||
proxy_pass http://127.0.0.1:1985/live/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
chunked_transfer_encoding on;
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Cache-Control no-cache always;
|
||||
add_header X-Nomadro-Live srs always;
|
||||
}
|
||||
EOF
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
echo '=== public /live/ headers ==='
|
||||
curl -skI --max-time 5 'https://nomadro.cn/live/nope.flv' | head -20 || true
|
||||
echo '=== local srs headers ==='
|
||||
curl -sI --max-time 3 'http://127.0.0.1:1985/live/nope.flv' | head -15 || true
|
||||
echo '=== join 2 peers ==='
|
||||
curl -sk --max-time 8 -X POST 'https://nomadro.cn/api/social/v1/live/rooms/hall1/join' \
|
||||
-H 'Content-Type: application/json' -H 'X-Social-Guest-Id: peer_alice' \
|
||||
-d '{"nick":"Alice"}' > /tmp/a.json
|
||||
curl -sk --max-time 8 -X POST 'https://nomadro.cn/api/social/v1/live/rooms/hall1/join' \
|
||||
-H 'Content-Type: application/json' -H 'X-Social-Guest-Id: peer_bob' \
|
||||
-d '{"nick":"Bob"}' > /tmp/b.json
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
a=json.load(open('/tmp/a.json'))
|
||||
b=json.load(open('/tmp/b.json'))
|
||||
print('alice_ok', a.get('ok'), 'peers', [p['nick'] for p in a.get('peers',[])])
|
||||
print('bob_ok', b.get('ok'), 'peers', [p['nick'] for p in b.get('peers',[])])
|
||||
print('push', (a.get('pushUrl') or '')[:90])
|
||||
print('play', (a.get('playUrl') or '')[:90])
|
||||
print('engine', a.get('engine'))
|
||||
PY
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=90, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
print("[exit", stdout.channel.recv_exit_status(), "]", flush=True)
|
||||
c.close()
|
||||
30
apps/admin/deploy/_fix_live_nginx.py
Normal file
30
apps/admin/deploy/_fix_live_nginx.py
Normal file
@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
echo '=== who serves 443 ==='
|
||||
sudo ss -lntp | grep ':443'
|
||||
echo '=== caddy? ==='
|
||||
systemctl is-active caddy 2>/dev/null || true
|
||||
ls /etc/caddy 2>/dev/null | head
|
||||
echo '=== nginx? ==='
|
||||
systemctl is-active nginx 2>/dev/null || true
|
||||
sudo nginx -T 2>/dev/null | grep -E 'server_name|8020|api/social|listen 443' | head -40
|
||||
echo '=== find social proxy ==='
|
||||
sudo grep -R '8020\|api/social' /etc /var/www -g '!*.log' 2>/dev/null | head -30
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
c.close()
|
||||
27
apps/admin/deploy/_fix_live_nginx2.py
Normal file
27
apps/admin/deploy/_fix_live_nginx2.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
sudo nginx -T 2>/dev/null | grep -n 'server_name nomadro.cn' | head
|
||||
# dump the nomadro.cn server block roughly
|
||||
sudo nginx -T 2>/dev/null | awk '/server_name nomadro.cn/{flag=1} flag{print} /server_name / && !/nomadro.cn/{if(flag&&seen++){exit}}' | head -120
|
||||
echo '==== conf files ===='
|
||||
sudo ls /www/server/panel/vhost/nginx 2>/dev/null | head
|
||||
sudo ls /www/server/nginx/conf/vhost 2>/dev/null | head
|
||||
ls /etc/nginx/sites-enabled 2>/dev/null
|
||||
find /www /etc/nginx -name '*nomadro*' 2>/dev/null | head -40
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
c.close()
|
||||
28
apps/admin/deploy/_fix_live_nginx3.py
Normal file
28
apps/admin/deploy/_fix_live_nginx3.py
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
find /www/server/panel/vhost/nginx -maxdepth 1 -type f -name '*.conf' | sort
|
||||
echo '---'
|
||||
F=$(find /www/server/panel/vhost/nginx -maxdepth 1 -type f -name 'nomadro.cn.conf' | head -1)
|
||||
echo "F=$F"
|
||||
if [ -n "$F" ]; then
|
||||
grep -n 'location\|8020\|proxy_pass\|social\|live\|server_name' "$F" | head -80
|
||||
fi
|
||||
# also check extension
|
||||
ls /www/server/panel/vhost/nginx/extension/nomadro.cn 2>/dev/null || true
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
c.close()
|
||||
27
apps/admin/deploy/_fix_live_nginx4.py
Normal file
27
apps/admin/deploy/_fix_live_nginx4.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
sudo ls /www/server/panel/vhost/nginx | grep -i nomad | head -40
|
||||
echo '===='
|
||||
sudo grep -Rnl 'server_name nomadro.cn' /www/server/panel/vhost/nginx 2>/dev/null | head
|
||||
F=$(sudo grep -Rnl 'server_name nomadro.cn;' /www/server/panel/vhost/nginx 2>/dev/null | head -1)
|
||||
echo F=$F
|
||||
sudo grep -n 'location\|8020\|proxy_pass\|social\|#LIVE' "$F" | head -100
|
||||
echo '==== ext ===='
|
||||
sudo ls "/www/server/panel/vhost/nginx/extension/nomadro.cn" 2>/dev/null || true
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
c.close()
|
||||
90
apps/admin/deploy/_patch_live_nginx.py
Normal file
90
apps/admin/deploy/_patch_live_nginx.py
Normal file
@ -0,0 +1,90 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Add /live/ FLV proxy next to social-api extension for www.nomadro.cn."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
EXT_DIR=/www/server/panel/vhost/nginx/extension/www.nomadro.cn
|
||||
sudo mkdir -p "$EXT_DIR"
|
||||
echo '--- existing ---'
|
||||
sudo ls -la "$EXT_DIR"
|
||||
sudo cat "$EXT_DIR/social-api.conf" 2>/dev/null | head -40 || true
|
||||
|
||||
# write live-flv.conf
|
||||
sudo tee "$EXT_DIR/live-flv.conf" >/dev/null <<'EOF'
|
||||
# Nomadro social native live — SRS HTTP-FLV for WeChat LivePlayer
|
||||
location /live/ {
|
||||
proxy_pass http://127.0.0.1:1985/live/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
chunked_transfer_encoding on;
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Cache-Control no-cache always;
|
||||
}
|
||||
EOF
|
||||
|
||||
# also ensure www.nomadro.cn.conf exists and includes extension (baota usually does)
|
||||
F=/www/server/panel/vhost/nginx/www.nomadro.cn.conf
|
||||
if sudo test -f "$F"; then
|
||||
echo "www conf exists"
|
||||
sudo grep -n 'extension\|include\|server_name' "$F" | head -30
|
||||
else
|
||||
echo "www conf missing?"
|
||||
sudo ls /www/server/panel/vhost/nginx | grep -i www || true
|
||||
fi
|
||||
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
echo '--- verify ---'
|
||||
curl -sk -o /dev/null -w 'flv_public %{http_code}\n' 'https://nomadro.cn/live/smoke_smoke_peer_1.flv' || true
|
||||
curl -sk -o /dev/null -w 'www_flv %{http_code}\n' 'https://www.nomadro.cn/live/smoke_smoke_peer_1.flv' || true
|
||||
curl -sk -o /dev/null -w 'srs_local %{http_code}\n' 'http://127.0.0.1:1985/api/v1/versions' || true
|
||||
curl -sk 'http://127.0.0.1:1985/api/v1/versions' | head -c 200; echo
|
||||
curl -sk -X POST 'https://nomadro.cn/api/social/v1/live/rooms/demo/join' \
|
||||
-H 'Content-Type: application/json' -H 'X-Social-Guest-Id: demo_a' \
|
||||
-d '{"nick":"A"}' | head -c 350; echo
|
||||
sudo docker ps --filter name=nomadro-srs --format '{{.Names}} {{.Status}} {{.Ports}}'
|
||||
systemctl is-active nomadro-social
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=120, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
code = stdout.channel.recv_exit_status()
|
||||
print(f"[exit {code}]", flush=True)
|
||||
c.close()
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
93
apps/admin/deploy/_proxy_rt_on_api.py
Normal file
93
apps/admin/deploy/_proxy_rt_on_api.py
Normal file
@ -0,0 +1,93 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Proxy Centrifugo /rt/ on api.nomadro.cn for weapp socket合法域名."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
# also push latest social api router
|
||||
from pathlib import Path
|
||||
|
||||
repo = Path(__file__).resolve().parents[3]
|
||||
sftp = c.open_sftp()
|
||||
for rel, remote in (
|
||||
("apps/api/services/social_svc/routers/api.py", "/tmp/social_routers_api.py"),
|
||||
):
|
||||
data = (repo / rel).read_bytes()
|
||||
with sftp.file(remote, "wb") as rf:
|
||||
rf.write(data)
|
||||
sftp.close()
|
||||
|
||||
cmd = r"""
|
||||
set -e
|
||||
EXT=/www/server/panel/vhost/nginx/extension/api.nomadro.cn
|
||||
sudo mkdir -p "$EXT"
|
||||
# copy www centrifugo snippet if exists, else write
|
||||
if sudo test -f /www/server/panel/vhost/nginx/extension/www.nomadro.cn/centrifugo-rt.conf; then
|
||||
sudo cp /www/server/panel/vhost/nginx/extension/www.nomadro.cn/centrifugo-rt.conf "$EXT/centrifugo-rt.conf"
|
||||
else
|
||||
sudo tee "$EXT/centrifugo-rt.conf" >/dev/null <<'EOF'
|
||||
location ^~ /rt/ {
|
||||
proxy_pass http://127.0.0.1:8008/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
# ensure social-api still there
|
||||
sudo test -f "$EXT/social-api.conf" || true
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
sudo cp /tmp/social_routers_api.py /var/www/nomadro.cn/apps/api/services/social_svc/routers/api.py
|
||||
sudo systemctl restart nomadro-social
|
||||
sleep 2
|
||||
|
||||
echo '=== token ==='
|
||||
curl -sk --max-time 5 'https://api.nomadro.cn/api/social/v1/realtime/token?channel_id=general&guest=chat1' | head -c 280; echo
|
||||
echo '=== list ==='
|
||||
curl -sk --max-time 5 'https://api.nomadro.cn/api/social/v1/channels/general/messages?guest=chat1' | head -c 200; echo
|
||||
echo '=== post ==='
|
||||
curl -sk --max-time 8 -X POST 'https://api.nomadro.cn/api/social/v1/channels/general/messages?guest=chat1' \
|
||||
-H 'Content-Type: application/json' --data-binary '{"author":"系统","text":"Centrifugo 聊天通路已接通"}' | head -c 240; echo
|
||||
echo '=== list2 ==='
|
||||
curl -sk --max-time 5 'https://api.nomadro.cn/api/social/v1/channels/general/messages?guest=chat1' | head -c 400; echo
|
||||
systemctl is-active centrifugo nomadro-social
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=90, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
code = stdout.channel.recv_exit_status()
|
||||
print(f"[exit {code}]", flush=True)
|
||||
c.close()
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
95
apps/admin/deploy/_proxy_social_on_api.py
Normal file
95
apps/admin/deploy/_proxy_social_on_api.py
Normal file
@ -0,0 +1,95 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Proxy /api/social/ on api.nomadro.cn → nomadro-social:8020 (weapp whitelist)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
EXT_DIR=/www/server/panel/vhost/nginx/extension/api.nomadro.cn
|
||||
sudo mkdir -p "$EXT_DIR"
|
||||
sudo tee "$EXT_DIR/social-api.conf" >/dev/null <<'EOF'
|
||||
# weapp 合法域名多为 api.nomadro.cn — 社交 live/join 必须可直连
|
||||
location ^~ /api/social/ {
|
||||
proxy_pass http://127.0.0.1:8020;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Social-Guest-Id $http_x_social_guest_id;
|
||||
}
|
||||
EOF
|
||||
|
||||
# ensure api conf includes extension/*.conf
|
||||
F=/www/server/panel/vhost/nginx/api.nomadro.cn.conf
|
||||
sudo grep -n 'extension/api.nomadro.cn\|include' "$F" | head -20
|
||||
if ! sudo grep -q 'extension/api.nomadro.cn/\*\.conf' "$F"; then
|
||||
# inject include after server_name line in https server
|
||||
sudo python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
p = Path("/www/server/panel/vhost/nginx/api.nomadro.cn.conf")
|
||||
text = p.read_text(encoding="utf-8")
|
||||
inc = " include /www/server/panel/vhost/nginx/extension/api.nomadro.cn/*.conf;\n"
|
||||
if "extension/api.nomadro.cn" in text:
|
||||
print("include already")
|
||||
else:
|
||||
# after first ssl server_name api.nomadro.cn;
|
||||
needle = "server_name api.nomadro.cn;"
|
||||
# prefer the ssl block (second occurrence often); insert after both
|
||||
parts = text.split(needle)
|
||||
if len(parts) < 2:
|
||||
raise SystemExit("no server_name")
|
||||
out = parts[0]
|
||||
for i, part in enumerate(parts[1:], 1):
|
||||
out += needle
|
||||
if "extension/api.nomadro.cn" not in part[:200]:
|
||||
out += "\n" + inc
|
||||
out += part
|
||||
p.write_text(out, encoding="utf-8")
|
||||
print("include injected")
|
||||
PY
|
||||
fi
|
||||
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
echo '=== api social health ==='
|
||||
curl -sk --max-time 5 'https://api.nomadro.cn/api/social/v1/health' | head -c 300; echo
|
||||
echo '=== api live join ==='
|
||||
curl -sk --max-time 8 -X POST 'https://api.nomadro.cn/api/social/v1/live/rooms/office/join' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'X-Social-Guest-Id: weapp_real_1' \
|
||||
--data-binary '{"nick":"真机"}' | head -c 400; echo
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=90, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
code = stdout.channel.recv_exit_status()
|
||||
print(f"[exit {code}]", flush=True)
|
||||
c.close()
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
98
apps/admin/deploy/_push_social_join_pay.py
Normal file
98
apps/admin/deploy/_push_social_join_pay.py
Normal file
@ -0,0 +1,98 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Push social-join virtual pay routes to production (/opt/nomadmini)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
REPO = Path(__file__).resolve().parents[3]
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def to_app_pkg(src: Path) -> bytes:
|
||||
data = src.read_text(encoding="utf-8").replace("ebook_svc.", "app.").encode("utf-8")
|
||||
assert b"ebook_svc" not in data, f"rewrite failed: {src}"
|
||||
return data
|
||||
|
||||
|
||||
def main() -> int:
|
||||
pairs = [
|
||||
(
|
||||
REPO / "apps/api/services/ebook_svc/core/rate_limit.py",
|
||||
"/tmp/rate_limit_app.py",
|
||||
"/opt/nomadmini/backend/app/core/rate_limit.py",
|
||||
),
|
||||
(
|
||||
REPO / "apps/api/services/ebook_svc/services/social_join_config.py",
|
||||
"/tmp/social_join_config_app.py",
|
||||
"/opt/nomadmini/backend/app/services/social_join_config.py",
|
||||
),
|
||||
(
|
||||
REPO / "apps/api/services/ebook_svc/routers/pay.py",
|
||||
"/tmp/pay_app.py",
|
||||
"/opt/nomadmini/backend/app/routers/pay.py",
|
||||
),
|
||||
]
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
sftp = c.open_sftp()
|
||||
for src, tmp, _final in pairs:
|
||||
data = to_app_pkg(src)
|
||||
with sftp.file(tmp, "wb") as rf:
|
||||
rf.write(data)
|
||||
print("up", tmp, len(data), flush=True)
|
||||
sftp.close()
|
||||
|
||||
cmd = r"""
|
||||
set -e
|
||||
B=/opt/nomadmini/backend/app
|
||||
sudo cp /tmp/rate_limit_app.py "$B/core/rate_limit.py"
|
||||
sudo cp /tmp/social_join_config_app.py "$B/services/social_join_config.py"
|
||||
sudo cp /tmp/pay_app.py "$B/routers/pay.py"
|
||||
cd /opt/nomadmini/backend
|
||||
.venv/bin/python - <<'PY'
|
||||
from app.core.rate_limit import rate_limit
|
||||
from app.services.social_join_config import SOCIAL_JOIN_BOOK_ID, read_social_join_config
|
||||
from app.routers import pay
|
||||
print(
|
||||
"import_ok",
|
||||
SOCIAL_JOIN_BOOK_ID,
|
||||
hasattr(pay, "create_social_join_order"),
|
||||
callable(rate_limit),
|
||||
read_social_join_config().get("socialJoinEnabled"),
|
||||
)
|
||||
PY
|
||||
sudo systemctl restart nomadmini-api
|
||||
sleep 4
|
||||
systemctl is-active nomadmini-api
|
||||
curl -sk -o /dev/null -w "health %{http_code}\n" https://api.nomadro.cn/health || true
|
||||
# 未登录应 401,不应再 404
|
||||
curl -sk -o /dev/null -w "sj-status %{http_code}\n" https://api.nomadro.cn/api/pay/social-join-status || true
|
||||
curl -sk -o /dev/null -w "sj-ebook %{http_code}\n" https://api.nomadro.cn/api/ebook/pay/social-join-status || true
|
||||
rm -f /tmp/rate_limit_app.py /tmp/social_join_config_app.py /tmp/pay_app.py
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=180, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
code = stdout.channel.recv_exit_status()
|
||||
print(f"[exit {code}]", flush=True)
|
||||
c.close()
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
56
apps/admin/deploy/_push_social_live_api.py
Normal file
56
apps/admin/deploy/_push_social_live_api.py
Normal file
@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Push social live API router + smoke join via api.nomadro.cn."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
REPO = Path(__file__).resolve().parents[3]
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
sftp = c.open_sftp()
|
||||
local = REPO / "apps/api/services/social_svc/routers/api.py"
|
||||
with sftp.file("/tmp/social_routers_api.py", "wb") as rf:
|
||||
rf.write(local.read_bytes())
|
||||
sftp.close()
|
||||
|
||||
cmd = r"""
|
||||
set -e
|
||||
sudo cp /tmp/social_routers_api.py /var/www/nomadro.cn/apps/api/services/social_svc/routers/api.py
|
||||
sudo systemctl restart nomadro-social
|
||||
sleep 2
|
||||
systemctl is-active nomadro-social
|
||||
curl -sk --max-time 8 -X POST 'https://api.nomadro.cn/api/social/v1/live/rooms/office/join?guest=weapp_real_2' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary '{"nick":"真机"}' | head -c 420; echo
|
||||
curl -sk --max-time 5 'https://api.nomadro.cn/api/social/v1/health'; echo
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
code = stdout.channel.recv_exit_status()
|
||||
print(f"[exit {code}]", flush=True)
|
||||
c.close()
|
||||
return code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
55
apps/admin/deploy/_push_social_live_py.py
Normal file
55
apps/admin/deploy/_push_social_live_py.py
Normal file
@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
REPO = Path(__file__).resolve().parents[3]
|
||||
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
HOST,
|
||||
username=USER,
|
||||
password=PASS,
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
sftp = c.open_sftp()
|
||||
for rel in ("live.py", "routers/api.py"):
|
||||
local = REPO / "apps/api/services/social_svc" / rel
|
||||
remote = f"/tmp/social_{rel.replace('/', '_')}"
|
||||
with sftp.file(remote, "wb") as rf:
|
||||
rf.write(local.read_bytes())
|
||||
print("up", remote, flush=True)
|
||||
sftp.close()
|
||||
cmd = r"""
|
||||
set -e
|
||||
B=/var/www/nomadro.cn/apps/api/services/social_svc
|
||||
sudo cp /tmp/social_live.py "$B/live.py"
|
||||
sudo cp /tmp/social_routers_api.py "$B/routers/api.py"
|
||||
sudo systemctl restart nomadro-social
|
||||
sleep 2
|
||||
curl -sk --max-time 8 -X POST 'https://api.nomadro.cn/api/social/v1/live/rooms/office/join?guest=camtest1' \
|
||||
-H 'Content-Type: application/json' --data-binary '{"nick":"cam"}' | head -c 360; echo
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=60, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
print("[exit", stdout.channel.recv_exit_status(), "]", flush=True)
|
||||
c.close()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
57
apps/admin/deploy/_smoke_rtmp_flv.py
Normal file
57
apps/admin/deploy/_smoke_rtmp_flv.py
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Publish a short test stream to SRS and confirm HTTPS FLV proxy responds."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
set -e
|
||||
# ffmpeg available?
|
||||
which ffmpeg || sudo apt-get install -y -qq ffmpeg >/tmp/ffinstall.log 2>&1 || true
|
||||
which ffmpeg
|
||||
|
||||
# publish 8s color bars in background
|
||||
nohup ffmpeg -re -f lavfi -i color=c=black:s=320x240:d=12 -f lavfi -i sine=f=440:d=12 \
|
||||
-c:v libx264 -tune zerolatency -preset ultrafast -pix_fmt yuv420p -g 30 \
|
||||
-c:a aac -f flv rtmp://127.0.0.1/live/smoke_test \
|
||||
>/tmp/ff_push.log 2>&1 &
|
||||
FFPID=$!
|
||||
echo "ffmpeg pid $FFPID"
|
||||
sleep 3
|
||||
|
||||
echo '=== local flv code ==='
|
||||
curl -s --max-time 4 -o /tmp/chunk.flv -w 'local %{http_code} size %{size_download}\n' \
|
||||
'http://127.0.0.1:1985/live/smoke_test.flv' || true
|
||||
file /tmp/chunk.flv 2>/dev/null || ls -la /tmp/chunk.flv
|
||||
|
||||
echo '=== public flv code ==='
|
||||
curl -sk --max-time 4 -o /tmp/chunk2.flv -D /tmp/chunk2.hdr -w 'public %{http_code} size %{size_download}\n' \
|
||||
'https://nomadro.cn/live/smoke_test.flv' || true
|
||||
head -20 /tmp/chunk2.hdr || true
|
||||
ls -la /tmp/chunk2.flv || true
|
||||
|
||||
kill $FFPID 2>/dev/null || true
|
||||
sleep 1
|
||||
tail -5 /tmp/ff_push.log || true
|
||||
"""
|
||||
_, stdout, _ = c.exec_command(cmd, timeout=180, get_pty=True)
|
||||
while not stdout.channel.exit_status_ready():
|
||||
if stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
time.sleep(0.05)
|
||||
while stdout.channel.recv_ready():
|
||||
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||
print("[exit", stdout.channel.recv_exit_status(), "]", flush=True)
|
||||
c.close()
|
||||
26
apps/admin/deploy/_verify_live_proxy.py
Normal file
26
apps/admin/deploy/_verify_live_proxy.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(
|
||||
"82.157.112.245",
|
||||
username="ubuntu",
|
||||
password="Xiao4669805",
|
||||
timeout=60,
|
||||
allow_agent=False,
|
||||
look_for_keys=False,
|
||||
)
|
||||
cmd = r"""
|
||||
# GET with max-time; print status + key headers
|
||||
curl -sk --max-time 3 -D - -o /dev/null 'https://nomadro.cn/live/nope.flv' | head -25 || true
|
||||
echo '----'
|
||||
curl -s --max-time 3 -D - -o /dev/null 'http://127.0.0.1:1985/live/nope.flv' | head -20 || true
|
||||
echo '---- ext file ----'
|
||||
sudo cat /www/server/panel/vhost/nginx/extension/www.nomadro.cn/live-flv.conf
|
||||
echo '---- rtmp port ----'
|
||||
ss -lntp | grep 1935 || true
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=40, get_pty=True)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
c.close()
|
||||
@ -16,6 +16,7 @@ from ebook_svc.domains.books.products import PRODUCT_OFFERS
|
||||
from ebook_svc.schemas.pay import DevConfirmBody, OrderBody, StatusBody
|
||||
from ebook_svc.services.shop_store import shop_store
|
||||
from ebook_svc.services.store import store
|
||||
from ebook_svc.services.social_join_config import SOCIAL_JOIN_BOOK_ID, read_social_join_config
|
||||
from ebook_svc.services.vip_config import read_vip_config
|
||||
from ebook_svc.services.wxpay import build_sign_data, calc_pay_sig, calc_signature, query_order
|
||||
|
||||
@ -24,6 +25,8 @@ router = APIRouter(prefix="/pay", tags=["pay"])
|
||||
# VIP 订单在 unlocks / orders 里用的哨兵 book_id(不是真实小册)
|
||||
VIP_BOOK_ID = "__vip__"
|
||||
SHOP_BOOK_ID = "__shop__"
|
||||
# 游民社区加群收费(与 VIP / community 付费体系隔离)
|
||||
# SOCIAL_JOIN_BOOK_ID = "__social_join__"
|
||||
|
||||
|
||||
class ShopOrderBody(BaseModel):
|
||||
@ -174,6 +177,106 @@ async def vip_status(openid: str = Depends(get_current_openid)):
|
||||
}
|
||||
|
||||
|
||||
def _build_social_join_order_payload(openid: str) -> dict[str, Any]:
|
||||
"""游民社区加群虚拟支付 — 独立 book_id/type,不写 __vip__、不走 community。"""
|
||||
cfg = read_social_join_config()
|
||||
if not cfg.get("socialJoinEnabled"):
|
||||
raise HTTPException(400, "加群支付暂未开放")
|
||||
product_id = str(cfg.get("socialJoinProductId") or "").strip()
|
||||
price_fen = int(cfg.get("socialJoinPriceFen") or 0)
|
||||
if not product_id or price_fen <= 0:
|
||||
raise HTTPException(400, "加群支付未配置道具,请联系运营")
|
||||
if store.is_unlocked(openid, SOCIAL_JOIN_BOOK_ID):
|
||||
raise HTTPException(400, "已加入游民社区,无需重复支付")
|
||||
|
||||
user = store.get_user(openid)
|
||||
if not user or not user.get("session_key"):
|
||||
raise HTTPException(401, "session_key 缺失,请重新登录")
|
||||
|
||||
attach = json.dumps(
|
||||
{
|
||||
"type": "social_join",
|
||||
"book_id": SOCIAL_JOIN_BOOK_ID,
|
||||
"openid": openid,
|
||||
},
|
||||
ensure_ascii=False,
|
||||
separators=(",", ":"),
|
||||
)
|
||||
out_trade_no = store.create_order(
|
||||
openid=openid,
|
||||
book_id=SOCIAL_JOIN_BOOK_ID,
|
||||
product_id=product_id,
|
||||
amount_fen=price_fen,
|
||||
attach=attach,
|
||||
)
|
||||
sign_data = build_sign_data(
|
||||
offer_id=settings.wx_offer_id,
|
||||
product_id=product_id,
|
||||
goods_price=price_fen,
|
||||
out_trade_no=out_trade_no,
|
||||
attach=attach,
|
||||
)
|
||||
pay_sig = calc_pay_sig("requestVirtualPayment", sign_data, settings.wx_app_key)
|
||||
signature = calc_signature(sign_data, user["session_key"])
|
||||
return {
|
||||
"signData": sign_data,
|
||||
"mode": "short_series_goods",
|
||||
"paySig": pay_sig,
|
||||
"signature": signature,
|
||||
"outTradeNo": out_trade_no,
|
||||
"productId": product_id,
|
||||
"goodsPrice": price_fen,
|
||||
"kind": "social_join",
|
||||
"title": cfg.get("socialJoinTitle") or "游民社区加群",
|
||||
}
|
||||
|
||||
|
||||
@router.post("/social-join-order")
|
||||
async def create_social_join_order(
|
||||
request: Request, openid: str = Depends(get_current_openid)
|
||||
):
|
||||
"""游民社区加群收费 — 微信小程序虚拟支付,与 VIP 订单隔离。"""
|
||||
rate_limit(request, bucket="pay.social_join", limit=20, window_sec=60.0)
|
||||
payload = _build_social_join_order_payload(openid)
|
||||
try:
|
||||
from ebook_svc.services.track import ingest_events
|
||||
|
||||
await ingest_events(
|
||||
[
|
||||
{
|
||||
"name": "pay_order_created",
|
||||
"page": "api",
|
||||
"label": payload.get("productId"),
|
||||
"props": {
|
||||
"kind": "social_join",
|
||||
"book_id": SOCIAL_JOIN_BOOK_ID,
|
||||
"out_trade_no": payload.get("outTradeNo"),
|
||||
"price_fen": payload.get("goodsPrice"),
|
||||
},
|
||||
"ts": None,
|
||||
}
|
||||
],
|
||||
openid=openid,
|
||||
client="api",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return payload
|
||||
|
||||
|
||||
@router.get("/social-join-status")
|
||||
async def social_join_status(openid: str = Depends(get_current_openid)):
|
||||
cfg = read_social_join_config()
|
||||
return {
|
||||
"ok": True,
|
||||
"isMember": store.is_unlocked(openid, SOCIAL_JOIN_BOOK_ID),
|
||||
"bookId": SOCIAL_JOIN_BOOK_ID,
|
||||
"title": cfg.get("socialJoinTitle") or "游民社区加群",
|
||||
"priceFen": int(cfg.get("socialJoinPriceFen") or 0),
|
||||
"enabled": bool(cfg.get("socialJoinEnabled")),
|
||||
}
|
||||
|
||||
|
||||
def _require_shop_vip(openid: str) -> None:
|
||||
cfg = read_vip_config()
|
||||
if cfg.get("is_free") or int(cfg.get("vipPriceFen") or 0) <= 0:
|
||||
|
||||
49
apps/api/services/ebook_svc/services/social_join_config.py
Normal file
49
apps/api/services/ebook_svc/services/social_join_config.py
Normal file
@ -0,0 +1,49 @@
|
||||
"""游民社区「加群收费」配置 — 与 VIP / community 付费体系隔离。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from ebook_svc.services.tt_platform_config import resolve_config_file
|
||||
|
||||
SOCIAL_JOIN_BOOK_ID = "__social_join__"
|
||||
|
||||
DEFAULT_SOCIAL_JOIN = {
|
||||
# 与 VIP(__vip__/tiktok) 隔离:默认用已发布 nomad 道具;后台可改价/改道具。
|
||||
"socialJoinPriceFen": 4900,
|
||||
"socialJoinProductId": "nomad",
|
||||
"socialJoinTitle": "游民社区加群",
|
||||
"socialJoinEnabled": True,
|
||||
}
|
||||
|
||||
|
||||
def _read_raw() -> dict[str, Any]:
|
||||
path = resolve_config_file()
|
||||
if not path.is_file():
|
||||
return {}
|
||||
try:
|
||||
raw = json.loads(path.read_text(encoding="utf-8"))
|
||||
return raw if isinstance(raw, dict) else {}
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
def read_social_join_config() -> dict[str, Any]:
|
||||
raw = _read_raw()
|
||||
flags = raw.get("flags") if isinstance(raw.get("flags"), dict) else {}
|
||||
copy = raw.get("copy") if isinstance(raw.get("copy"), dict) else {}
|
||||
out = dict(DEFAULT_SOCIAL_JOIN)
|
||||
if "socialJoinEnabled" in flags:
|
||||
out["socialJoinEnabled"] = bool(flags.get("socialJoinEnabled"))
|
||||
for key in ("socialJoinPriceFen", "socialJoinProductId", "socialJoinTitle"):
|
||||
if key in flags and flags[key] not in (None, ""):
|
||||
out[key] = flags[key]
|
||||
elif key in copy and copy[key] not in (None, ""):
|
||||
out[key] = copy[key]
|
||||
try:
|
||||
out["socialJoinPriceFen"] = int(out["socialJoinPriceFen"])
|
||||
except Exception:
|
||||
out["socialJoinPriceFen"] = DEFAULT_SOCIAL_JOIN["socialJoinPriceFen"]
|
||||
out["socialJoinProductId"] = str(out.get("socialJoinProductId") or "").strip()
|
||||
out["socialJoinTitle"] = str(out.get("socialJoinTitle") or DEFAULT_SOCIAL_JOIN["socialJoinTitle"])
|
||||
return out
|
||||
@ -20,3 +20,19 @@ CENTRIFUGO_WS_URL = os.getenv(
|
||||
"CENTRIFUGO_WS_URL",
|
||||
"wss://nomadro.cn/rt/connection/websocket",
|
||||
)
|
||||
|
||||
# 原生音视频厅(SRS RTMP 推 / HTTP-FLV 拉)— 微信 LivePusher/LivePlayer
|
||||
LIVE_RTMP_PUSH_BASE = os.getenv(
|
||||
"LIVE_RTMP_PUSH_BASE",
|
||||
"rtmp://82.157.112.245/live",
|
||||
)
|
||||
LIVE_HTTP_PLAY_BASE = os.getenv(
|
||||
"LIVE_HTTP_PLAY_BASE",
|
||||
"https://nomadro.cn/live",
|
||||
)
|
||||
LIVE_STREAM_SECRET = os.getenv(
|
||||
"LIVE_STREAM_SECRET",
|
||||
os.getenv("CENTRIFUGO_TOKEN_SECRET", "nomadro-live-dev-secret"),
|
||||
)
|
||||
LIVE_MAX_PEERS = int(os.getenv("LIVE_MAX_PEERS", "6"))
|
||||
LIVE_PEER_TTL_SEC = int(os.getenv("LIVE_PEER_TTL_SEC", "45"))
|
||||
|
||||
156
apps/api/services/social_svc/live.py
Normal file
156
apps/api/services/social_svc/live.py
Normal file
@ -0,0 +1,156 @@
|
||||
"""游民社区原生音视频厅 — SRS RTMP 推流 + HTTP-FLV 拉流 + 房间信令。
|
||||
|
||||
微信小程序:LivePusher(pushUrl) + LivePlayer(playUrl)
|
||||
门户 H5:仍可用 MiroTalk;本模块给 weapp 原生厅发流地址。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from social_svc.config import (
|
||||
LIVE_HTTP_PLAY_BASE,
|
||||
LIVE_MAX_PEERS,
|
||||
LIVE_PEER_TTL_SEC,
|
||||
LIVE_RTMP_PUSH_BASE,
|
||||
LIVE_STREAM_SECRET,
|
||||
)
|
||||
|
||||
_lock = threading.RLock()
|
||||
# room_id -> { peer_id: peer_dict }
|
||||
_rooms: dict[str, dict[str, dict[str, Any]]] = {}
|
||||
|
||||
|
||||
def _safe(s: str, n: int = 48) -> str:
|
||||
t = re.sub(r"[^a-zA-Z0-9_-]+", "", (s or "").strip())[:n]
|
||||
return t or "x"
|
||||
|
||||
|
||||
def _sig(stream: str, exp: int) -> str:
|
||||
raw = f"{stream}:{exp}".encode("utf-8")
|
||||
return hmac.new(LIVE_STREAM_SECRET.encode("utf-8"), raw, hashlib.sha256).hexdigest()[:16]
|
||||
|
||||
|
||||
def stream_name(room_id: str, peer_id: str) -> str:
|
||||
return f"{_safe(room_id, 24)}_{_safe(peer_id, 24)}"
|
||||
|
||||
|
||||
def build_urls(room_id: str, peer_id: str) -> dict[str, str]:
|
||||
stream = stream_name(room_id, peer_id)
|
||||
exp = int(time.time()) + 3600 * 6
|
||||
token = _sig(stream, exp)
|
||||
# 微信 LivePusher:RTMP url 勿带 query,否则真机常推流失败→本地黑屏
|
||||
push = f"{LIVE_RTMP_PUSH_BASE.rstrip('/')}/{stream}"
|
||||
# HTTP-FLV 拉流可带 token(nginx/SRS 忽略未知参数)
|
||||
play = f"{LIVE_HTTP_PLAY_BASE.rstrip('/')}/{stream}.flv?e={exp}&k={token}"
|
||||
return {"stream": stream, "pushUrl": push, "playUrl": play}
|
||||
|
||||
|
||||
def _purge(room_id: str) -> None:
|
||||
now = time.time()
|
||||
room = _rooms.get(room_id) or {}
|
||||
dead = [pid for pid, p in room.items() if now - float(p.get("seen", 0)) > LIVE_PEER_TTL_SEC]
|
||||
for pid in dead:
|
||||
room.pop(pid, None)
|
||||
if not room:
|
||||
_rooms.pop(room_id, None)
|
||||
|
||||
|
||||
def list_peers(room_id: str) -> list[dict[str, Any]]:
|
||||
with _lock:
|
||||
_purge(room_id)
|
||||
room = _rooms.get(room_id) or {}
|
||||
return [
|
||||
{
|
||||
"peerId": p["peerId"],
|
||||
"nick": p["nick"],
|
||||
"playUrl": p["playUrl"],
|
||||
"stream": p["stream"],
|
||||
"seen": p["seen"],
|
||||
}
|
||||
for p in room.values()
|
||||
]
|
||||
|
||||
|
||||
def join_room(room_id: str, guest_id: str, nick: str) -> dict[str, Any]:
|
||||
rid = _safe(room_id, 40)
|
||||
gid = _safe(guest_id, 40)
|
||||
name = (nick or "游民").strip()[:32] or "游民"
|
||||
with _lock:
|
||||
_purge(rid)
|
||||
room = _rooms.setdefault(rid, {})
|
||||
if gid not in room and len(room) >= LIVE_MAX_PEERS:
|
||||
raise ValueError(f"厅已满(最多 {LIVE_MAX_PEERS} 人)")
|
||||
urls = build_urls(rid, gid)
|
||||
peer = {
|
||||
"peerId": gid,
|
||||
"nick": name,
|
||||
"stream": urls["stream"],
|
||||
"pushUrl": urls["pushUrl"],
|
||||
"playUrl": urls["playUrl"],
|
||||
"seen": time.time(),
|
||||
"joinedAt": time.time(),
|
||||
}
|
||||
room[gid] = peer
|
||||
peers = [
|
||||
{
|
||||
"peerId": p["peerId"],
|
||||
"nick": p["nick"],
|
||||
"playUrl": p["playUrl"],
|
||||
"stream": p["stream"],
|
||||
}
|
||||
for pid, p in room.items()
|
||||
if pid != gid
|
||||
]
|
||||
return {
|
||||
"ok": True,
|
||||
"roomId": rid,
|
||||
"peerId": gid,
|
||||
"nick": name,
|
||||
"pushUrl": urls["pushUrl"],
|
||||
"playUrl": urls["playUrl"],
|
||||
"stream": urls["stream"],
|
||||
"peers": peers,
|
||||
"maxPeers": LIVE_MAX_PEERS,
|
||||
"channelId": f"live-{rid}",
|
||||
"engine": "srs-rtmp-flv",
|
||||
}
|
||||
|
||||
|
||||
def heartbeat(room_id: str, guest_id: str) -> dict[str, Any]:
|
||||
rid = _safe(room_id, 40)
|
||||
gid = _safe(guest_id, 40)
|
||||
with _lock:
|
||||
_purge(rid)
|
||||
room = _rooms.get(rid) or {}
|
||||
me = room.get(gid)
|
||||
if not me:
|
||||
raise ValueError("未在厅内,请重新进入")
|
||||
me["seen"] = time.time()
|
||||
peers = [
|
||||
{
|
||||
"peerId": p["peerId"],
|
||||
"nick": p["nick"],
|
||||
"playUrl": p["playUrl"],
|
||||
"stream": p["stream"],
|
||||
}
|
||||
for pid, p in room.items()
|
||||
if pid != gid
|
||||
]
|
||||
return {"ok": True, "roomId": rid, "peers": peers, "peerCount": len(peers) + 1}
|
||||
|
||||
|
||||
def leave_room(room_id: str, guest_id: str) -> dict[str, Any]:
|
||||
rid = _safe(room_id, 40)
|
||||
gid = _safe(guest_id, 40)
|
||||
with _lock:
|
||||
room = _rooms.get(rid) or {}
|
||||
room.pop(gid, None)
|
||||
if not room:
|
||||
_rooms.pop(rid, None)
|
||||
return {"ok": True, "roomId": rid}
|
||||
@ -52,11 +52,11 @@ def issue_connection_token(guest_id: str, channel_id: str | None = None) -> dict
|
||||
}
|
||||
|
||||
|
||||
async def publish_chat_message(channel_id: str, message: dict[str, Any]) -> bool:
|
||||
async def _publish(channel_id: str, data: dict[str, Any]) -> bool:
|
||||
if not CENTRIFUGO_ENABLED or not CENTRIFUGO_API_KEY:
|
||||
return False
|
||||
url = CENTRIFUGO_API_URL.rstrip("/") + "/publish"
|
||||
body = {"channel": channel_name(channel_id), "data": {"type": "chat.message", "message": message}}
|
||||
body = {"channel": channel_name(channel_id), "data": data}
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=3.0) as client:
|
||||
res = await client.post(
|
||||
@ -71,3 +71,11 @@ async def publish_chat_message(channel_id: str, message: dict[str, Any]) -> bool
|
||||
except Exception as e: # pragma: no cover
|
||||
log.warning("centrifugo publish failed: %s", e)
|
||||
return False
|
||||
|
||||
|
||||
async def publish_chat_message(channel_id: str, message: dict[str, Any]) -> bool:
|
||||
return await _publish(channel_id, {"type": "chat.message", "message": message})
|
||||
|
||||
|
||||
async def publish_live_event(channel_id: str, event: str, payload: dict[str, Any]) -> bool:
|
||||
return await _publish(channel_id, {"type": f"live.{event}", **payload})
|
||||
|
||||
@ -4,15 +4,22 @@ from __future__ import annotations
|
||||
from fastapi import APIRouter, Header, HTTPException, Query
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from social_svc import store
|
||||
from social_svc import live, store
|
||||
from social_svc.config import SOCIAL_ENABLED
|
||||
from social_svc.realtime import issue_connection_token, publish_chat_message
|
||||
from social_svc.realtime import (
|
||||
issue_connection_token,
|
||||
publish_chat_message,
|
||||
publish_live_event,
|
||||
)
|
||||
|
||||
router = APIRouter(tags=["social"])
|
||||
|
||||
|
||||
def _guest(x_social_guest_id: str | None) -> str:
|
||||
gid = (x_social_guest_id or "").strip()
|
||||
def _guest(
|
||||
x_social_guest_id: str | None,
|
||||
guest_q: str | None = None,
|
||||
) -> str:
|
||||
gid = (x_social_guest_id or guest_q or "").strip()
|
||||
if not gid or len(gid) > 80:
|
||||
raise HTTPException(status_code=400, detail="missing X-Social-Guest-Id")
|
||||
return gid
|
||||
@ -67,9 +74,10 @@ async def social_health():
|
||||
async def realtime_token(
|
||||
channel_id: str = Query(default="lobby"),
|
||||
x_social_guest_id: str | None = Header(default=None),
|
||||
guest: str | None = Query(default=None),
|
||||
):
|
||||
guest = _guest(x_social_guest_id)
|
||||
return issue_connection_token(guest, channel_id)
|
||||
peer = _guest(x_social_guest_id, guest)
|
||||
return issue_connection_token(peer, channel_id)
|
||||
|
||||
|
||||
@router.get("/channels/{channel_id}/messages")
|
||||
@ -83,12 +91,13 @@ async def post_message(
|
||||
channel_id: str,
|
||||
body: MessageIn,
|
||||
x_social_guest_id: str | None = Header(default=None),
|
||||
guest: str | None = Query(default=None),
|
||||
):
|
||||
guest = _guest(x_social_guest_id)
|
||||
peer = _guest(x_social_guest_id, guest)
|
||||
store.init_db()
|
||||
if not body.text.strip():
|
||||
raise HTTPException(status_code=400, detail="empty text")
|
||||
saved = store.add_message(channel_id, body.author, body.text, guest)
|
||||
saved = store.add_message(channel_id, body.author, body.text, peer)
|
||||
# 实时推送失败不影响落库成功
|
||||
try:
|
||||
await publish_chat_message(channel_id, saved)
|
||||
@ -157,3 +166,78 @@ async def post_gig_apply(
|
||||
guest = _guest(x_social_guest_id)
|
||||
store.init_db()
|
||||
return store.add_gig_app(gig_id, body.name, body.contact, body.note, guest)
|
||||
|
||||
|
||||
class LiveJoinIn(BaseModel):
|
||||
nick: str = Field(default="游民", max_length=32)
|
||||
|
||||
|
||||
@router.post("/live/rooms/{room_id}/join")
|
||||
async def live_join(
|
||||
room_id: str,
|
||||
body: LiveJoinIn,
|
||||
x_social_guest_id: str | None = Header(default=None),
|
||||
guest: str | None = Query(default=None, alias="guest"),
|
||||
):
|
||||
"""微信原生 LivePusher/LivePlayer 进厅:下发 RTMP 推流 + FLV 拉流。"""
|
||||
peer = _guest(x_social_guest_id, guest)
|
||||
try:
|
||||
payload = live.join_room(room_id, peer, body.nick)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e)) from e
|
||||
try:
|
||||
await publish_live_event(
|
||||
payload["channelId"],
|
||||
"peer_join",
|
||||
{
|
||||
"roomId": payload["roomId"],
|
||||
"peer": {
|
||||
"peerId": payload["peerId"],
|
||||
"nick": payload["nick"],
|
||||
"playUrl": payload["playUrl"],
|
||||
"stream": payload["stream"],
|
||||
},
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
# 附带实时通道 token,前端可订 live 频道
|
||||
payload["realtime"] = issue_connection_token(peer, payload["channelId"])
|
||||
return payload
|
||||
|
||||
|
||||
@router.post("/live/rooms/{room_id}/heartbeat")
|
||||
async def live_heartbeat(
|
||||
room_id: str,
|
||||
x_social_guest_id: str | None = Header(default=None),
|
||||
guest: str | None = Query(default=None),
|
||||
):
|
||||
peer = _guest(x_social_guest_id, guest)
|
||||
try:
|
||||
return live.heartbeat(room_id, peer)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e)) from e
|
||||
|
||||
|
||||
@router.get("/live/rooms/{room_id}/peers")
|
||||
async def live_peers(room_id: str):
|
||||
return {"ok": True, "roomId": room_id, "peers": live.list_peers(room_id)}
|
||||
|
||||
|
||||
@router.post("/live/rooms/{room_id}/leave")
|
||||
async def live_leave(
|
||||
room_id: str,
|
||||
x_social_guest_id: str | None = Header(default=None),
|
||||
guest: str | None = Query(default=None),
|
||||
):
|
||||
peer = _guest(x_social_guest_id, guest)
|
||||
out = live.leave_room(room_id, peer)
|
||||
try:
|
||||
await publish_live_event(
|
||||
f"live-{out['roomId']}",
|
||||
"peer_leave",
|
||||
{"roomId": out["roomId"], "peerId": peer},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return out
|
||||
|
||||
@ -13,10 +13,15 @@ OUT = Path(__file__).resolve().parents[1] / "tmp" / "h5-smoke"
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
ROUTES = [
|
||||
("home", "/#/pages/index/index", ["nomadro", "随处工作", "自由生活", "出海导航", "数字游民小册", "旅居社群"]),
|
||||
("home", "/#/pages/home/index", ["nomadro", "随处工作", "自由生活", "游民社区"]),
|
||||
("nav", "/#/pages/nav/index", ["导航"]),
|
||||
("book", "/#/pages/book/index", ["Nomadro"]), # cover brand after offline/API load
|
||||
("community", "/#/pages/community/index", ["nomadro"]),
|
||||
("social", "/#/pages/social/index", ["世界很大", "群组聊天", "认识一下", "想见的人", "一张一张认识新朋友"]),
|
||||
("social_date", "/#/pages/social/date/index", ["认识一下", "左滑划走", "想认识"]),
|
||||
("social_chat", "/#/pages/social/chat/index", ["大家聊天", "#general"]),
|
||||
("social_people", "/#/pages/social/people/index", ["想见的人"]),
|
||||
("social_roster", "/#/pages/social/roster/index", ["我的介绍", "保存介绍"]),
|
||||
("mine", "/#/pages/mine/index", ["我的"]),
|
||||
("vip", "/#/pages/vip/index", ["会员"]),
|
||||
]
|
||||
|
||||
@ -47,10 +47,10 @@ const wantTabBar = !isH5 && process.env.TARO_APP_TABBAR === '1'
|
||||
|
||||
/** 微信主包必须 ≤2MB:首页/我的/小册留主包(提审小册勿进分包,避免下载失败黑屏) */
|
||||
const weappConfig = {
|
||||
// 提审期:小册作启动页,打开即见正文(过审后改回 home 第一)
|
||||
// 启动页:门户首页(提审专用包见 apps/miniprogram/weapp-audit)
|
||||
pages: [
|
||||
'pages/book/index',
|
||||
'pages/home/index',
|
||||
'pages/book/index',
|
||||
'pages/mine/index',
|
||||
'pages/index/index',
|
||||
],
|
||||
@ -141,14 +141,29 @@ const weappConfig = {
|
||||
name: 'game',
|
||||
pages: ['index'],
|
||||
},
|
||||
{
|
||||
root: 'pages/social',
|
||||
name: 'social',
|
||||
pages: [
|
||||
'index',
|
||||
'chat/index',
|
||||
'date/index',
|
||||
'people/index',
|
||||
'people/profile/index',
|
||||
'roster/index',
|
||||
'meetup/index',
|
||||
'meetup-live/index',
|
||||
'team/index',
|
||||
],
|
||||
},
|
||||
],
|
||||
preloadRule: {
|
||||
'pages/home/index': {
|
||||
network: 'all',
|
||||
packages: ['nav', 'reader'],
|
||||
packages: ['nav', 'reader', 'social'],
|
||||
},
|
||||
},
|
||||
// 提审期先关掉按需注入:Taro+React 下偶发首屏空白/黑屏;过审后再开回 requiredComponents
|
||||
// AI 开发模式:agent / ai-pkg 独立分包由 weapp/scripts/copy-weapp-static 在 TARO_APP_AI_MODE=1 时注入,勿写进提审包
|
||||
// lazyCodeLoading: 'requiredComponents' as const,
|
||||
}
|
||||
|
||||
@ -175,6 +190,15 @@ const h5Config = {
|
||||
'pages/vip-memo/index',
|
||||
'pages/vip-memo-detail/index',
|
||||
'pages/game/index',
|
||||
'pages/social/index',
|
||||
'pages/social/chat/index',
|
||||
'pages/social/date/index',
|
||||
'pages/social/people/index',
|
||||
'pages/social/people/profile/index',
|
||||
'pages/social/roster/index',
|
||||
'pages/social/meetup/index',
|
||||
'pages/social/meetup-live/index',
|
||||
'pages/social/team/index',
|
||||
],
|
||||
}
|
||||
|
||||
@ -187,5 +211,13 @@ export default defineAppConfig({
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
},
|
||||
permission: {
|
||||
'scope.camera': {
|
||||
desc: '用于游民社区语音视频见面(live-pusher)',
|
||||
},
|
||||
'scope.record': {
|
||||
desc: '用于游民社区语音视频见面麦克风',
|
||||
},
|
||||
},
|
||||
...(wantTabBar ? { tabBar } : {}),
|
||||
})
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Fragment, useEffect } from 'react'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import { useDidHide, useDidShow, useLaunch } from '@tarojs/taro'
|
||||
import Taro, { useDidHide, useDidShow, useLaunch } from '@tarojs/taro'
|
||||
import { flush, trackAppLaunch } from './utils/track'
|
||||
import {
|
||||
loadRemoteConfig,
|
||||
@ -25,6 +25,35 @@ function App({ children }: PropsWithChildren) {
|
||||
if (process.env.TARO_ENV === 'h5') {
|
||||
applyH5Theme(getStoredH5Theme())
|
||||
}
|
||||
// 小程序 AI 接力:账号卡片进入页时同步 payload(仅 weapp + 基础库支持时)
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
try {
|
||||
const wxApi = Taro as unknown as {
|
||||
onAgentHandoff?: (
|
||||
cb: (p: {
|
||||
pageId: number
|
||||
path: string
|
||||
query: string
|
||||
payload: unknown
|
||||
}) => void,
|
||||
) => void
|
||||
}
|
||||
if (typeof wxApi.onAgentHandoff === 'function') {
|
||||
wxApi.onAgentHandoff(({ pageId, path, query, payload }) => {
|
||||
const g = globalThis as unknown as {
|
||||
__nomadroAgentHandoffs?: Record<
|
||||
number,
|
||||
{ path: string; query: string; payload: unknown }
|
||||
>
|
||||
}
|
||||
g.__nomadroAgentHandoffs = g.__nomadroAgentHandoffs || {}
|
||||
g.__nomadroAgentHandoffs[pageId] = { path, query, payload }
|
||||
})
|
||||
}
|
||||
} catch {
|
||||
/* AI 模式未开通时忽略 */
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
useDidShow(() => {
|
||||
|
||||
@ -16,6 +16,14 @@ type BoxProps = {
|
||||
'data-theme'?: string
|
||||
/** 设了则点击时自动 btn_click 埋点 */
|
||||
trackLabel?: string
|
||||
/** H5-only pointer handlers (ignored on mini programs) */
|
||||
onPointerDown?: (e: any) => void
|
||||
onPointerMove?: (e: any) => void
|
||||
onPointerUp?: (e: any) => void
|
||||
onPointerCancel?: (e: any) => void
|
||||
onTouchStart?: (e: any) => void
|
||||
onTouchMove?: (e: any) => void
|
||||
onTouchEnd?: (e: any) => void
|
||||
}
|
||||
|
||||
/** H5 uses native div (taro-view-core defaults to inline and breaks grid/absolute). */
|
||||
@ -30,6 +38,13 @@ export function H5Box({
|
||||
'aria-label': ariaLabel,
|
||||
'data-theme': dataTheme,
|
||||
trackLabel,
|
||||
onPointerDown,
|
||||
onPointerMove,
|
||||
onPointerUp,
|
||||
onPointerCancel,
|
||||
onTouchStart,
|
||||
onTouchMove,
|
||||
onTouchEnd,
|
||||
}: BoxProps) {
|
||||
const handleClick = onClick
|
||||
? () => {
|
||||
@ -37,8 +52,8 @@ export function H5Box({
|
||||
onClick()
|
||||
}
|
||||
: trackLabel
|
||||
? () => trackClick(trackLabel)
|
||||
: undefined
|
||||
? () => trackClick(trackLabel)
|
||||
: undefined
|
||||
|
||||
if (isH5) {
|
||||
return (
|
||||
@ -47,6 +62,13 @@ export function H5Box({
|
||||
className={className}
|
||||
style={style}
|
||||
onClick={handleClick}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
onPointerCancel={onPointerCancel}
|
||||
onTouchStart={onTouchStart}
|
||||
onTouchMove={onTouchMove}
|
||||
onTouchEnd={onTouchEnd}
|
||||
aria-hidden={ariaHidden}
|
||||
aria-label={ariaLabel}
|
||||
data-theme={dataTheme}
|
||||
@ -65,6 +87,10 @@ export function H5Box({
|
||||
className={className}
|
||||
style={style}
|
||||
onClick={handleClick}
|
||||
onTouchStart={onTouchStart || onPointerDown}
|
||||
onTouchMove={onTouchMove || onPointerMove}
|
||||
onTouchEnd={onTouchEnd || onPointerUp}
|
||||
onTouchCancel={onPointerCancel}
|
||||
data-theme={dataTheme}
|
||||
>
|
||||
{children}
|
||||
|
||||
2
apps/miniprogram/h5/src/components/SocialDock.tsx
Normal file
2
apps/miniprogram/h5/src/components/SocialDock.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
/** @deprecated use pages/social/_components/SocialDock */
|
||||
export { SocialDock } from '../pages/social/_components/SocialDock'
|
||||
@ -58,6 +58,7 @@ export type NomadroRemoteConfig = {
|
||||
destinations: ModuleToggle
|
||||
home: ModuleToggle
|
||||
game: ModuleToggle
|
||||
social: ModuleToggle
|
||||
}
|
||||
flags: {
|
||||
payEnabled: boolean
|
||||
@ -173,6 +174,7 @@ export const DEFAULT_REMOTE_CONFIG: NomadroRemoteConfig = {
|
||||
meetups: { enabled: false, title: '活动' },
|
||||
vip: { enabled: false, title: '会员中心' },
|
||||
game: { enabled: false, title: '数字游民', note: '冻结隐藏 · 勿开入口' },
|
||||
social: { enabled: true, title: '游民社区', tabLabel: '社区', note: 'Taro 原生 /social · rem 自适应' },
|
||||
},
|
||||
flags: {
|
||||
payEnabled: true,
|
||||
|
||||
237
apps/miniprogram/h5/src/data/socialCatalog.ts
Normal file
237
apps/miniprogram/h5/src/data/socialCatalog.ts
Normal file
@ -0,0 +1,237 @@
|
||||
import type {
|
||||
SocialCafe,
|
||||
SocialChannel,
|
||||
SocialChatMessage,
|
||||
SocialEbook,
|
||||
SocialGig,
|
||||
SocialMeetup,
|
||||
SocialTeamKind,
|
||||
SocialVideo,
|
||||
} from './socialTypes'
|
||||
|
||||
export const SEED_CHANNELS: SocialChannel[] = [
|
||||
{ id: "general", name: "#general", topic: "游民闲聊 · 报到打卡", members: 128 },
|
||||
{ id: "chiangmai", name: "#chiangmai", topic: "清迈同城 · cowork / visa", members: 64 },
|
||||
{ id: "meetup-live", name: "#meetup-live", topic: "线上活动文字房", members: 42 },
|
||||
{ id: "coffee", name: "#coffeechat", topic: "咖啡馆约见协调", members: 31 },
|
||||
];
|
||||
|
||||
export const SEED_MESSAGES: SocialChatMessage[] = [
|
||||
{
|
||||
id: "m1",
|
||||
channelId: "general",
|
||||
author: "林远",
|
||||
text: "欢迎来到游民社区实时聊天室 👋 先报个到:你在哪座城?",
|
||||
at: "2026-10-28T09:00:00.000Z",
|
||||
},
|
||||
{
|
||||
id: "m2",
|
||||
channelId: "general",
|
||||
author: "Mika",
|
||||
text: "清迈第三周,Nimman 找 cowork,有人一起吗?",
|
||||
at: "2026-10-28T09:12:00.000Z",
|
||||
},
|
||||
{
|
||||
id: "m3",
|
||||
channelId: "chiangmai",
|
||||
author: "Ken",
|
||||
text: "Graph Table 二楼靠窗位 WiFi 稳,插座够。",
|
||||
at: "2026-10-29T02:20:00.000Z",
|
||||
},
|
||||
{
|
||||
id: "m4",
|
||||
channelId: "meetup-live",
|
||||
author: "Host",
|
||||
text: "今晚 20:00 开视频见面,文字也可以在这儿继续聊。",
|
||||
at: "2026-10-30T08:00:00.000Z",
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_CAFES: SocialCafe[] = [
|
||||
{
|
||||
id: "graph-table",
|
||||
name: "Graph Table",
|
||||
city: "清迈",
|
||||
wifiMbps: 80,
|
||||
power: "座位大多有插座",
|
||||
vibe: "安静 · 设计感",
|
||||
partners: true,
|
||||
rating: 4.7,
|
||||
reviews: 18,
|
||||
},
|
||||
{
|
||||
id: "camp",
|
||||
name: "Camp",
|
||||
city: "清迈",
|
||||
wifiMbps: 100,
|
||||
power: "全覆盖",
|
||||
vibe: "社区感 · 活动多",
|
||||
partners: true,
|
||||
rating: 4.6,
|
||||
reviews: 24,
|
||||
},
|
||||
{
|
||||
id: "blink",
|
||||
name: "Blink Cowork",
|
||||
city: "槟城",
|
||||
wifiMbps: 120,
|
||||
power: "全覆盖",
|
||||
vibe: "海风 · 开放工位",
|
||||
partners: false,
|
||||
rating: 4.4,
|
||||
reviews: 9,
|
||||
},
|
||||
{
|
||||
id: "forest",
|
||||
name: "Forest Coffee",
|
||||
city: "大理",
|
||||
wifiMbps: 40,
|
||||
power: "靠窗有限",
|
||||
vibe: "慢节奏 · 适合深谈",
|
||||
partners: true,
|
||||
rating: 4.5,
|
||||
reviews: 11,
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_MEETUPS: SocialMeetup[] = [
|
||||
{
|
||||
id: "wk-nomad-office",
|
||||
title: "周三线上办公室",
|
||||
city: "Online",
|
||||
date: "2026-11-05",
|
||||
time: "20:00",
|
||||
mode: "online",
|
||||
mirotalkRoom: "nomadro-social-office",
|
||||
channelId: "meetup-live",
|
||||
},
|
||||
{
|
||||
id: "visa-ama",
|
||||
title: "签证 AMA · 东南亚",
|
||||
city: "Online",
|
||||
date: "2026-11-08",
|
||||
time: "21:00",
|
||||
mode: "hybrid",
|
||||
mirotalkRoom: "nomadro-visa-ama",
|
||||
channelId: "meetup-live",
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_VIDEOS: SocialVideo[] = [
|
||||
{
|
||||
id: "cm-morning",
|
||||
title: "清迈的周二早晨",
|
||||
city: "清迈",
|
||||
minutes: 12,
|
||||
coverEmoji: "🛵",
|
||||
summary: "咖啡馆办公、时区套利、同城聚餐。",
|
||||
},
|
||||
{
|
||||
id: "penang-walk",
|
||||
title: "槟城街头访谈",
|
||||
city: "槟城",
|
||||
minutes: 8,
|
||||
coverEmoji: "🎙",
|
||||
summary: "两位远程设计师聊租金与 cowork。",
|
||||
},
|
||||
{
|
||||
id: "dali-date",
|
||||
title: "大理 Coffeechat 实录",
|
||||
city: "大理",
|
||||
minutes: 15,
|
||||
coverEmoji: "☕",
|
||||
summary: "线下约见流程:场地、合照、评价。",
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_EBOOKS: SocialEbook[] = [
|
||||
{
|
||||
id: "social-playbook",
|
||||
title: "游民社区怎么玩",
|
||||
chapters: 6,
|
||||
minutes: 35,
|
||||
blurb: "怎么认识人、开视频、约咖啡、一起做事,一篇说清楚。",
|
||||
},
|
||||
{
|
||||
id: "roster-guide",
|
||||
title: "怎么写好自我介绍",
|
||||
chapters: 4,
|
||||
minutes: 20,
|
||||
blurb: "写几句让同城的人找到你,也不用写得很正式。",
|
||||
},
|
||||
];
|
||||
|
||||
export const SEED_GIGS: SocialGig[] = [
|
||||
{
|
||||
id: "vol-welcome",
|
||||
title: "欢迎新人的帮手",
|
||||
role: "帮忙志愿",
|
||||
pay: "公益积分 / 社群徽章",
|
||||
remote: true,
|
||||
kind: "volunteer",
|
||||
tags: ["带新人", "答疑", "周报"],
|
||||
},
|
||||
{
|
||||
id: "vol-event",
|
||||
title: "线下见面局帮手",
|
||||
role: "帮忙志愿",
|
||||
pay: "活动席位优先",
|
||||
remote: false,
|
||||
kind: "volunteer",
|
||||
tags: ["约咖啡", "合照", "场地协调"],
|
||||
},
|
||||
{
|
||||
id: "ops-assistant",
|
||||
title: "运营 / 拍摄助理",
|
||||
role: "大学生兼职",
|
||||
pay: "按场次结算",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
tags: ["拍摄", "剪辑", "活动跟场"],
|
||||
},
|
||||
{
|
||||
id: "community-mod",
|
||||
title: "社群值班主持人",
|
||||
role: "线上兼职",
|
||||
pay: "月度津贴",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
tags: ["聊天室", "视频见面主持"],
|
||||
},
|
||||
{
|
||||
id: "content-pt",
|
||||
title: "内容兼职编辑",
|
||||
role: "线上兼职",
|
||||
pay: "按篇结算",
|
||||
remote: true,
|
||||
kind: "parttime",
|
||||
tags: ["小册", "视频字幕", "社媒"],
|
||||
},
|
||||
{
|
||||
id: "ft-community",
|
||||
title: "社群运营负责人",
|
||||
role: "全职 · 线上优先",
|
||||
pay: "面议 · 季度复盘",
|
||||
remote: true,
|
||||
kind: "fulltime",
|
||||
tags: ["增长", "活动", "认识人"],
|
||||
},
|
||||
{
|
||||
id: "ft-fullstack",
|
||||
title: "全栈工程师",
|
||||
role: "全职 · 线上",
|
||||
pay: "面议",
|
||||
remote: true,
|
||||
kind: "fulltime",
|
||||
tags: ["Next.js", "FastAPI", "小程序"],
|
||||
},
|
||||
];
|
||||
|
||||
export const TEAM_KIND_LABEL: Record<SocialTeamKind, string> = {
|
||||
volunteer: "帮忙志愿",
|
||||
parttime: "兼职机会",
|
||||
fulltime: "全职机会",
|
||||
};
|
||||
|
||||
/** Same box as nomadro.cn (82.x). Prefer .cn — avoid .com→107 hop. */
|
||||
export const MIROTALK_URL = 'https://mirotalk.nomadro.cn'
|
||||
168
apps/miniprogram/h5/src/data/socialCities.ts
Normal file
168
apps/miniprogram/h5/src/data/socialCities.ts
Normal file
@ -0,0 +1,168 @@
|
||||
/** Offline city catalog — seed inspired by meetup.hackrobot.cn destination list. */
|
||||
|
||||
export type SocialCity = {
|
||||
id: string;
|
||||
name: string;
|
||||
country: string;
|
||||
emoji: string;
|
||||
vibe: string;
|
||||
members: number;
|
||||
costHint: string;
|
||||
wifiMbps: number;
|
||||
tags: string[];
|
||||
hot?: boolean;
|
||||
};
|
||||
|
||||
export const SOCIAL_CITIES: SocialCity[] = [
|
||||
{
|
||||
id: "dali",
|
||||
name: "大理",
|
||||
country: "中国",
|
||||
emoji: "🏔️",
|
||||
vibe: "苍山洱海 · 慢生活",
|
||||
members: 520,
|
||||
costHint: "¥3,000/月起",
|
||||
wifiMbps: 50,
|
||||
tags: ["热门", "便宜", "山城"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "chengdu",
|
||||
name: "成都",
|
||||
country: "中国",
|
||||
emoji: "🌶️",
|
||||
vibe: "天府之国 · 美食慢节奏",
|
||||
members: 680,
|
||||
costHint: "¥4,500/月起",
|
||||
wifiMbps: 80,
|
||||
tags: ["热门", "美食", "宜居"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "hangzhou",
|
||||
name: "杭州",
|
||||
country: "中国",
|
||||
emoji: "🏞️",
|
||||
vibe: "西湖 · 互联网重镇",
|
||||
members: 560,
|
||||
costHint: "¥6,000/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["热门", "高速网络"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "kunming",
|
||||
name: "昆明",
|
||||
country: "中国",
|
||||
emoji: "🌸",
|
||||
vibe: "四季如春 · 通往东南亚",
|
||||
members: 380,
|
||||
costHint: "¥3,500/月起",
|
||||
wifiMbps: 55,
|
||||
tags: ["温暖", "便宜"],
|
||||
},
|
||||
{
|
||||
id: "shenzhen",
|
||||
name: "深圳",
|
||||
country: "中国",
|
||||
emoji: "🚀",
|
||||
vibe: "科技创新 · 创业友好",
|
||||
members: 850,
|
||||
costHint: "¥8,000/月起",
|
||||
wifiMbps: 120,
|
||||
tags: ["热门", "高速网络", "一线城市"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "xiamen",
|
||||
name: "厦门",
|
||||
country: "中国",
|
||||
emoji: "🏝️",
|
||||
vibe: "海滨花园 · 鼓浪屿",
|
||||
members: 320,
|
||||
costHint: "¥5,500/月起",
|
||||
wifiMbps: 70,
|
||||
tags: ["海滨", "温暖"],
|
||||
},
|
||||
{
|
||||
id: "shanghai",
|
||||
name: "上海",
|
||||
country: "中国",
|
||||
emoji: "🌆",
|
||||
vibe: "国际大都市 · 文化交汇",
|
||||
members: 1200,
|
||||
costHint: "¥10,000/月起",
|
||||
wifiMbps: 110,
|
||||
tags: ["一线城市", "热门"],
|
||||
},
|
||||
{
|
||||
id: "lijiang",
|
||||
name: "丽江",
|
||||
country: "中国",
|
||||
emoji: "🏯",
|
||||
vibe: "玉龙雪山 · 古城慢旅",
|
||||
members: 280,
|
||||
costHint: "¥3,200/月起",
|
||||
wifiMbps: 45,
|
||||
tags: ["便宜", "山城"],
|
||||
},
|
||||
{
|
||||
id: "chiangmai",
|
||||
name: "清迈",
|
||||
country: "泰国",
|
||||
emoji: "🌿",
|
||||
vibe: "Nimman · 游民大本营",
|
||||
members: 940,
|
||||
costHint: "฿18,000/月起",
|
||||
wifiMbps: 90,
|
||||
tags: ["热门", "友好社区", "高速网络"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "bali",
|
||||
name: "巴厘岛",
|
||||
country: "印尼",
|
||||
emoji: "🌴",
|
||||
vibe: "Canggu · 冲浪与 cowork",
|
||||
members: 720,
|
||||
costHint: "Rp8jt/月起",
|
||||
wifiMbps: 60,
|
||||
tags: ["海滨", "温暖", "热门"],
|
||||
hot: true,
|
||||
},
|
||||
{
|
||||
id: "lisbon",
|
||||
name: "里斯本",
|
||||
country: "葡萄牙",
|
||||
emoji: "🌊",
|
||||
vibe: "阳光海岸 · 欧洲时区",
|
||||
members: 610,
|
||||
costHint: "€1,200/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["海滨", "友好社区"],
|
||||
},
|
||||
{
|
||||
id: "penang",
|
||||
name: "槟城",
|
||||
country: "马来西亚",
|
||||
emoji: "🍜",
|
||||
vibe: "美食 · 海风开放工位",
|
||||
members: 260,
|
||||
costHint: "RM2,800/月起",
|
||||
wifiMbps: 100,
|
||||
tags: ["美食", "便宜"],
|
||||
},
|
||||
];
|
||||
|
||||
export const CITY_FILTER_TAGS = [
|
||||
"全部",
|
||||
"热门",
|
||||
"便宜",
|
||||
"高速网络",
|
||||
"温暖",
|
||||
"海滨",
|
||||
"山城",
|
||||
"一线城市",
|
||||
"友好社区",
|
||||
"美食",
|
||||
] as const;
|
||||
243
apps/miniprogram/h5/src/data/socialRoster.ts
Normal file
243
apps/miniprogram/h5/src/data/socialRoster.ts
Normal file
@ -0,0 +1,243 @@
|
||||
/** 首页花名册 mock — 在线状态 / 想认识 / 可互动 */
|
||||
|
||||
export type SocialRosterMember = {
|
||||
id: string;
|
||||
name: string;
|
||||
title: string;
|
||||
city: string;
|
||||
tags: string[];
|
||||
avatar: string;
|
||||
bio: string;
|
||||
vibe: string;
|
||||
online: boolean;
|
||||
lookingFor: string;
|
||||
gender: "f" | "m";
|
||||
languages?: string[];
|
||||
availability?: string;
|
||||
timezone?: string;
|
||||
/** Extra photos for profile wall (nomads-style) */
|
||||
gallery?: string[];
|
||||
};
|
||||
|
||||
export const MOCK_ROSTER: SocialRosterMember[] = [
|
||||
{
|
||||
id: "m01",
|
||||
name: "林悦",
|
||||
title: "独立设计师",
|
||||
city: "清迈 · Nimman",
|
||||
tags: ["咖啡局", "设计", "日出"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/65.jpg",
|
||||
bio: "喜欢把 cowork 聊成真实见面。周末常去 Graph Table,也爱清晨骑车去山上看雾。",
|
||||
vibe: "温柔 · 有品味",
|
||||
online: true,
|
||||
lookingFor: "想认识会拍照的远程伙伴",
|
||||
gender: "f",
|
||||
languages: ["中文", "English"],
|
||||
availability: "本周可 Coffeechat",
|
||||
timezone: "ICT (UTC+7)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1523906834658-6e24ef2386f9?w=640&q=80",
|
||||
"https://images.unsplash.com/photo-1554118811-1e0d58224f24?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m02",
|
||||
name: "Ethan",
|
||||
title: "全栈 / SaaS",
|
||||
city: "里斯本",
|
||||
tags: ["Next.js", "夜跑", "冲浪"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/32.jpg",
|
||||
bio: "白天写代码,傍晚海边。欢迎 Coffeechat 聊产品与出海。",
|
||||
vibe: "阳光 · 靠谱",
|
||||
online: true,
|
||||
lookingFor: "找联创 / 一起做副业",
|
||||
gender: "m",
|
||||
languages: ["English", "Português", "中文"],
|
||||
availability: "欧洲晚间可视频",
|
||||
timezone: "WET (UTC+0)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1555881403-7463c9aea225?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m03",
|
||||
name: "苏晴",
|
||||
title: "内容创业者",
|
||||
city: "巴厘岛 · Canggu",
|
||||
tags: ["Vlog", "瑜伽", "出海"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/44.jpg",
|
||||
bio: "镜头前很活泼,线下更爱深度聊天。常在 Canggu cowork。",
|
||||
vibe: "活力",
|
||||
online: false,
|
||||
lookingFor: "想认识同频创作者",
|
||||
gender: "f",
|
||||
languages: ["中文", "English"],
|
||||
availability: "周末可线下局",
|
||||
timezone: "WITA (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m04",
|
||||
name: "Ken",
|
||||
title: "产品经理",
|
||||
city: "东京 / 远程",
|
||||
tags: ["B2B", "胶片", "拉面"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/75.jpg",
|
||||
bio: "时差玩家。开视频见面时很稳,私下爱胶片机。",
|
||||
vibe: "干净 · 有梗",
|
||||
online: true,
|
||||
lookingFor: "想找一起探索城市的人",
|
||||
gender: "m",
|
||||
languages: ["日本語", "English", "中文"],
|
||||
availability: "常来开视频见面",
|
||||
timezone: "JST (UTC+9)",
|
||||
},
|
||||
{
|
||||
id: "m05",
|
||||
name: "Mia",
|
||||
title: "增长黑客",
|
||||
city: "曼谷",
|
||||
tags: ["增长", "夜市", "泰语"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/68.jpg",
|
||||
bio: "把增长聊成故事。欢迎约路边摊。",
|
||||
vibe: "聪明 · 飒",
|
||||
online: true,
|
||||
lookingFor: "找一起搞出海的搭档",
|
||||
gender: "f",
|
||||
languages: ["中文", "English", "ไทย"],
|
||||
availability: "今晚可以开视频",
|
||||
timezone: "ICT (UTC+7)",
|
||||
},
|
||||
{
|
||||
id: "m06",
|
||||
name: "阿杰",
|
||||
title: "独立开发者",
|
||||
city: "成都 → 清迈",
|
||||
tags: ["Flutter", "火锅", "副业"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/52.jpg",
|
||||
bio: "刚到东南亚第三周,想认识本地局朋友。",
|
||||
vibe: "真诚 · 幽默",
|
||||
online: false,
|
||||
lookingFor: "想找 cowork 搭子",
|
||||
gender: "m",
|
||||
languages: ["中文", "English"],
|
||||
availability: "工作日 cowork",
|
||||
timezone: "ICT (UTC+7)",
|
||||
},
|
||||
{
|
||||
id: "m07",
|
||||
name: "Nora",
|
||||
title: "摄影师",
|
||||
city: "大城 / 曼谷",
|
||||
tags: ["旅拍", "胶片", "咖啡"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/21.jpg",
|
||||
bio: "擅长拍人。可以帮你拍「游民证件照」。",
|
||||
vibe: "氛围感",
|
||||
online: true,
|
||||
lookingFor: "想认识爱旅行的你",
|
||||
gender: "f",
|
||||
languages: ["English", "中文"],
|
||||
availability: "可约旅拍",
|
||||
timezone: "ICT (UTC+7)",
|
||||
gallery: [
|
||||
"https://images.unsplash.com/photo-1492691527719-9d1e07e534b4?w=640&q=80",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "m08",
|
||||
name: "Ryan",
|
||||
title: "跨境电商",
|
||||
city: "槟城",
|
||||
tags: ["TikTok", "冲浪", "搞钱"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/22.jpg",
|
||||
bio: "白天看数据,傍晚冲浪。社群里最活跃的那几个之一。",
|
||||
vibe: "热情 · 靠谱",
|
||||
online: true,
|
||||
lookingFor: "找一起搞钱也搞生活的人",
|
||||
gender: "m",
|
||||
languages: ["中文", "English", "Bahasa"],
|
||||
availability: "本周可视频",
|
||||
timezone: "MYT (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m09",
|
||||
name: "Iris",
|
||||
title: "UX 研究员",
|
||||
city: "柏林",
|
||||
tags: ["访谈", "市集", "播客"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/33.jpg",
|
||||
bio: "欧洲时区,擅长把陌生人聊成朋友。",
|
||||
vibe: "知性",
|
||||
online: false,
|
||||
lookingFor: "想认识认真做产品的人",
|
||||
gender: "f",
|
||||
languages: ["Deutsch", "English", "中文"],
|
||||
availability: "周末可聊",
|
||||
timezone: "CET (UTC+1)",
|
||||
},
|
||||
{
|
||||
id: "m10",
|
||||
name: "Leo",
|
||||
title: "AI 工程师",
|
||||
city: "首尔 / 远程",
|
||||
tags: ["Agent", "开源", "咖啡"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/41.jpg",
|
||||
bio: "技术宅但不社恐。经常来开视频见面。",
|
||||
vibe: "稳 · 有趣",
|
||||
online: true,
|
||||
lookingFor: "找一起做 AI 副业的人",
|
||||
gender: "m",
|
||||
languages: ["한국어", "English"],
|
||||
availability: "常在视频见面里",
|
||||
timezone: "KST (UTC+9)",
|
||||
},
|
||||
{
|
||||
id: "m11",
|
||||
name: "小满",
|
||||
title: "咖啡馆主理人",
|
||||
city: "大理",
|
||||
tags: ["手冲", "音乐会", "徒步"],
|
||||
avatar: "https://randomuser.me/api/portraits/women/90.jpg",
|
||||
bio: "店在古城边。来大理一定请你喝手冲。",
|
||||
vibe: "松弛",
|
||||
online: true,
|
||||
lookingFor: "欢迎路过的游民串门",
|
||||
gender: "f",
|
||||
languages: ["中文"],
|
||||
availability: "店里随时欢迎",
|
||||
timezone: "CST (UTC+8)",
|
||||
},
|
||||
{
|
||||
id: "m12",
|
||||
name: "Hugo",
|
||||
title: "游民教练",
|
||||
city: "里斯本",
|
||||
tags: ["签证", "地理套利", "跑步"],
|
||||
avatar: "https://randomuser.me/api/portraits/men/11.jpg",
|
||||
bio: "帮过上百人规划第一站。Coffeechat 从不冷场。",
|
||||
vibe: "温暖",
|
||||
online: false,
|
||||
lookingFor: "想认识想出发的你",
|
||||
gender: "m",
|
||||
languages: ["English", "Français", "中文"],
|
||||
availability: "可预约 1v1",
|
||||
timezone: "WET (UTC+0)",
|
||||
},
|
||||
];
|
||||
|
||||
export function findRosterMember(
|
||||
id: string,
|
||||
extra: SocialRosterMember[] = [],
|
||||
): SocialRosterMember | undefined {
|
||||
return (
|
||||
extra.find((m) => m.id === id) || MOCK_ROSTER.find((m) => m.id === id)
|
||||
);
|
||||
}
|
||||
|
||||
/** 仅演示用,禁止当作真实运营数据展示 */
|
||||
export const SOCIAL_PROOF = {
|
||||
onlineNow: MOCK_ROSTER.filter((m) => m.online).length,
|
||||
members: 1280,
|
||||
meetupsWeek: 6,
|
||||
cities: 42,
|
||||
isDemo: true as const,
|
||||
};
|
||||
111
apps/miniprogram/h5/src/data/socialSeed.ts
Normal file
111
apps/miniprogram/h5/src/data/socialSeed.ts
Normal file
@ -0,0 +1,111 @@
|
||||
/** Offline seed — aligned with Next /social landing + catalog */
|
||||
export type { SocialRosterMember } from './socialRoster'
|
||||
export { MOCK_ROSTER, SOCIAL_PROOF, findRosterMember } from './socialRoster'
|
||||
export {
|
||||
SEED_CHANNELS,
|
||||
SEED_MESSAGES,
|
||||
SEED_CAFES,
|
||||
SEED_MEETUPS,
|
||||
SEED_VIDEOS,
|
||||
SEED_EBOOKS,
|
||||
SEED_GIGS,
|
||||
TEAM_KIND_LABEL,
|
||||
MIROTALK_URL,
|
||||
} from './socialCatalog'
|
||||
export { SOCIAL_CITIES } from './socialCities'
|
||||
|
||||
export const SOCIAL_COPY = {
|
||||
socialEyebrow: '自由生活,同频相遇',
|
||||
socialHeroLine1: '世界很大,',
|
||||
socialHeroAccent: '同类',
|
||||
socialHeroLead:
|
||||
'换一座城市,不必重新孤独。\n从一句你好、一杯咖啡开始,找到一起生活、\n一起探索、一起做点什么的人。',
|
||||
socialJoinCta: '找到我的同频',
|
||||
socialInviteTitle: '下一站,和同类一起。',
|
||||
socialInviteLead:
|
||||
'无论你正在出发,还是已经在路上,这里都有一个属于你的位置。',
|
||||
socialOnlineTitle: '随时,聊得来',
|
||||
socialOfflineTitle: '同城,见一面',
|
||||
socialTeamTitle: '一起,做点事',
|
||||
socialWayGroup: '群组聊天',
|
||||
socialWayChat: '开视频聊聊',
|
||||
socialWayDate: '认识一下',
|
||||
socialWayCafe: '找个地方见面',
|
||||
socialWayTeam: '找搭子 · 共创',
|
||||
} as const
|
||||
|
||||
export type SocialLandingCopy = typeof SOCIAL_COPY
|
||||
|
||||
export const SOCIAL_DOCK = [
|
||||
{ path: '/pages/social/index', label: '首页', short: '首页', emoji: '🏠', match: 'exact' as const },
|
||||
{ path: '/pages/social/chat/index', label: '大家聊天', short: '聊天', emoji: '💬', match: 'prefix' as const },
|
||||
{ path: '/pages/social/date/index', label: '认识一下', short: '认识', emoji: '💕', match: 'prefix' as const },
|
||||
{ path: '/pages/social/people/index', label: '想见的人', short: '看看谁', emoji: '👋', match: 'prefix' as const },
|
||||
{ path: '/pages/social/roster/index', label: '我的介绍', short: '我', emoji: '🙂', match: 'prefix' as const },
|
||||
]
|
||||
|
||||
export const SOCIAL_WAYS = [
|
||||
{
|
||||
id: '01',
|
||||
path: '/pages/social/chat/index',
|
||||
emoji: '💬',
|
||||
titleKey: 'socialWayGroup' as const,
|
||||
sub: '大家一起聊 · 先打个招呼',
|
||||
cta: '进群聊',
|
||||
tone: 'mint',
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
path: '/pages/social/date/index',
|
||||
emoji: '💕',
|
||||
titleKey: 'socialWayDate' as const,
|
||||
sub: '左右滑,慢慢认识',
|
||||
cta: '开始看看',
|
||||
tone: 'coral',
|
||||
},
|
||||
{
|
||||
id: '03',
|
||||
path: '/pages/social/meetup/index',
|
||||
emoji: '📡',
|
||||
titleKey: 'socialWayChat' as const,
|
||||
sub: '聊天群组 · 语音视频',
|
||||
cta: '去聊聊',
|
||||
tone: 'mint',
|
||||
},
|
||||
{
|
||||
id: '04',
|
||||
path: '/pages/social/people/index?mode=cafe',
|
||||
emoji: '☕',
|
||||
titleKey: 'socialWayCafe' as const,
|
||||
sub: '同城,见一面',
|
||||
cta: '选城市',
|
||||
tone: 'yellow',
|
||||
},
|
||||
{
|
||||
id: '05',
|
||||
path: '/pages/social/team/index',
|
||||
emoji: '🚀',
|
||||
titleKey: 'socialWayTeam' as const,
|
||||
sub: '找搭档 / 兼职 / 志愿者',
|
||||
cta: '看看机会',
|
||||
tone: 'mint',
|
||||
},
|
||||
]
|
||||
|
||||
export const PATH_CHIPS = [
|
||||
{ href: '#people', label: '想见的人', emoji: '👋', page: '' },
|
||||
{ href: '#date', label: '认识一下', emoji: '💕', page: '' },
|
||||
{ href: '#meetup', label: '聊得来', emoji: '📡', page: '' },
|
||||
{ href: '#cities', label: '见一面', emoji: '🌆', page: '' },
|
||||
{ href: '#team', label: '一起做事', emoji: '🚀', page: '' },
|
||||
{ href: '/pages/social/chat/index', label: '群聊', emoji: '💬', page: 'chat' },
|
||||
] as const
|
||||
|
||||
export const ROLE_EMOJI: Record<string, string> = {
|
||||
volunteer: '🙋',
|
||||
parttime: '📝',
|
||||
fulltime: '💼',
|
||||
}
|
||||
|
||||
export const DEFAULT_PROMO =
|
||||
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4'
|
||||
93
apps/miniprogram/h5/src/data/socialTypes.ts
Normal file
93
apps/miniprogram/h5/src/data/socialTypes.ts
Normal file
@ -0,0 +1,93 @@
|
||||
export type SocialChannel = {
|
||||
id: string;
|
||||
name: string;
|
||||
topic: string;
|
||||
members: number;
|
||||
};
|
||||
|
||||
export type SocialChatMessage = {
|
||||
id: string;
|
||||
channelId: string;
|
||||
author: string;
|
||||
text: string;
|
||||
at: string;
|
||||
mine?: boolean;
|
||||
guestId?: string;
|
||||
delivery?: "sent" | "local" | "demo";
|
||||
};
|
||||
|
||||
export type SocialCafe = {
|
||||
id: string;
|
||||
name: string;
|
||||
city: string;
|
||||
wifiMbps: number;
|
||||
power: string;
|
||||
vibe: string;
|
||||
partners: boolean;
|
||||
rating: number;
|
||||
reviews: number;
|
||||
};
|
||||
|
||||
export type SocialCafeReview = {
|
||||
id: string;
|
||||
cafeId: string;
|
||||
author: string;
|
||||
score: number;
|
||||
text: string;
|
||||
photoNote?: string;
|
||||
at: string;
|
||||
};
|
||||
|
||||
export type SocialMeetup = {
|
||||
id: string;
|
||||
title: string;
|
||||
city: string;
|
||||
date: string;
|
||||
time: string;
|
||||
mode: "online" | "hybrid";
|
||||
mirotalkRoom: string;
|
||||
timeZone?: string;
|
||||
channelId: string;
|
||||
};
|
||||
|
||||
export type SocialVideo = {
|
||||
id: string;
|
||||
title: string;
|
||||
city: string;
|
||||
minutes: number;
|
||||
coverEmoji: string;
|
||||
summary: string;
|
||||
};
|
||||
|
||||
export type SocialEbook = {
|
||||
id: string;
|
||||
title: string;
|
||||
chapters: number;
|
||||
minutes: number;
|
||||
blurb: string;
|
||||
};
|
||||
|
||||
/** 远程团队岗位类型 */
|
||||
export type SocialTeamKind = "volunteer" | "parttime" | "fulltime";
|
||||
|
||||
export type SocialGig = {
|
||||
id: string;
|
||||
title: string;
|
||||
role: string;
|
||||
pay: string;
|
||||
remote: boolean;
|
||||
tags: string[];
|
||||
/** 远程团队:志愿者 / 兼职 / 全职 */
|
||||
kind?: SocialTeamKind;
|
||||
};
|
||||
|
||||
export type SocialRosterProfile = {
|
||||
name: string;
|
||||
title: string;
|
||||
city: string;
|
||||
phone: string;
|
||||
linktree: string;
|
||||
skills: string;
|
||||
bio: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
209
apps/miniprogram/h5/src/hooks/useSocialChat.ts
Normal file
209
apps/miniprogram/h5/src/hooks/useSocialChat.ts
Normal file
@ -0,0 +1,209 @@
|
||||
/**
|
||||
* 群组聊天:HTTP 拉历史/发消息 + Centrifugo WebSocket 实时。
|
||||
* 无假消息;离线时本地队列可重试,UI 标明状态。
|
||||
*/
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {
|
||||
getSocialGuestId,
|
||||
socialApi,
|
||||
type SocialChatMessage,
|
||||
} from '@/services/socialApi'
|
||||
import { connectChatRealtime } from '@/services/socialRealtime'
|
||||
|
||||
export type ChatLinkStatus = 'connecting' | 'live' | 'polling' | 'offline'
|
||||
|
||||
const NICK_KEY = 'nick'
|
||||
|
||||
export function useSocialChat(channelId: string) {
|
||||
const [messages, setMessages] = useState<SocialChatMessage[]>([])
|
||||
const [draft, setDraft] = useState('')
|
||||
const [nick, setNick] = useState(() => {
|
||||
try {
|
||||
return String(Taro.getStorageSync(NICK_KEY) || '游民')
|
||||
} catch {
|
||||
return '游民'
|
||||
}
|
||||
})
|
||||
const [status, setStatus] = useState<ChatLinkStatus>('connecting')
|
||||
const [sending, setSending] = useState(false)
|
||||
const lock = useRef(false)
|
||||
const mounted = useRef(true)
|
||||
const guest = getSocialGuestId()
|
||||
|
||||
const mergeRemote = useCallback((items: SocialChatMessage[]) => {
|
||||
setMessages((current) => {
|
||||
const pendingMine = current.filter(
|
||||
(m) => m.mine && (m.delivery === 'local' || m.delivery === 'pending'),
|
||||
)
|
||||
const remote = items.map((item) => ({
|
||||
...item,
|
||||
mine: item.guestId === guest,
|
||||
delivery: 'sent' as const,
|
||||
}))
|
||||
const ids = new Set(remote.map((m) => m.id))
|
||||
return [
|
||||
...remote,
|
||||
...pendingMine.filter((m) => !ids.has(m.id)),
|
||||
].slice(-300)
|
||||
})
|
||||
}, [guest])
|
||||
|
||||
useEffect(() => {
|
||||
mounted.current = true
|
||||
let cancelled = false
|
||||
let stopWs: (() => void) | null = null
|
||||
let refreshing = false
|
||||
|
||||
const refresh = async () => {
|
||||
if (cancelled || refreshing) return
|
||||
refreshing = true
|
||||
try {
|
||||
const res = await socialApi.listMessages(channelId)
|
||||
if (cancelled) return
|
||||
mergeRemote(res.items || [])
|
||||
setStatus((s) => (s === 'live' ? 'live' : 'polling'))
|
||||
} catch {
|
||||
if (!cancelled) setStatus((s) => (s === 'live' ? 'live' : 'offline'))
|
||||
} finally {
|
||||
refreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
setMessages([])
|
||||
setStatus('connecting')
|
||||
void refresh()
|
||||
|
||||
const poll = setInterval(() => void refresh(), 8000)
|
||||
|
||||
void connectChatRealtime(channelId, (item) => {
|
||||
if (cancelled) return
|
||||
setMessages((current) => {
|
||||
if (current.some((m) => m.id === item.id)) return current
|
||||
return [
|
||||
...current,
|
||||
{
|
||||
...item,
|
||||
mine: item.guestId === guest,
|
||||
delivery: 'sent',
|
||||
},
|
||||
].slice(-300)
|
||||
})
|
||||
setStatus('live')
|
||||
}).then((conn) => {
|
||||
if (cancelled) {
|
||||
conn?.disconnect()
|
||||
return
|
||||
}
|
||||
if (conn) {
|
||||
stopWs = conn.disconnect
|
||||
setStatus('live')
|
||||
} else {
|
||||
setStatus((s) => (s === 'offline' ? 'offline' : 'polling'))
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
mounted.current = false
|
||||
clearInterval(poll)
|
||||
stopWs?.()
|
||||
}
|
||||
}, [channelId, guest, mergeRemote])
|
||||
|
||||
const send = useCallback(async () => {
|
||||
const text = draft.trim()
|
||||
if (!text || text.length > 2000 || lock.current) return false
|
||||
lock.current = true
|
||||
setSending(true)
|
||||
const author = nick.trim() || '游民'
|
||||
const tempId = `local_${Date.now()}`
|
||||
setMessages((current) =>
|
||||
[
|
||||
...current,
|
||||
{
|
||||
id: tempId,
|
||||
channelId,
|
||||
author,
|
||||
text,
|
||||
at: new Date().toISOString(),
|
||||
guestId: guest,
|
||||
mine: true,
|
||||
delivery: 'pending',
|
||||
},
|
||||
].slice(-300),
|
||||
)
|
||||
setDraft('')
|
||||
try {
|
||||
Taro.setStorageSync(NICK_KEY, author)
|
||||
const saved = await socialApi.sendMessage(channelId, author, text)
|
||||
if (!mounted.current) return true
|
||||
setMessages((current) =>
|
||||
[
|
||||
...current.filter((m) => m.id !== tempId && m.id !== saved.id),
|
||||
{
|
||||
...saved,
|
||||
mine: true,
|
||||
guestId: guest,
|
||||
delivery: 'sent',
|
||||
},
|
||||
].slice(-300),
|
||||
)
|
||||
return true
|
||||
} catch {
|
||||
if (!mounted.current) return false
|
||||
setMessages((current) =>
|
||||
current.map((m) =>
|
||||
m.id === tempId ? { ...m, delivery: 'local' as const } : m,
|
||||
),
|
||||
)
|
||||
setStatus('offline')
|
||||
Taro.showToast({ title: '发送失败,已留在本地', icon: 'none' })
|
||||
return false
|
||||
} finally {
|
||||
lock.current = false
|
||||
if (mounted.current) setSending(false)
|
||||
}
|
||||
}, [channelId, draft, guest, nick])
|
||||
|
||||
const retryLocal = useCallback(
|
||||
async (id: string) => {
|
||||
const item = messages.find((m) => m.id === id && m.delivery === 'local')
|
||||
if (!item || lock.current) return
|
||||
lock.current = true
|
||||
setSending(true)
|
||||
try {
|
||||
const saved = await socialApi.sendMessage(
|
||||
channelId,
|
||||
item.author,
|
||||
item.text,
|
||||
)
|
||||
setMessages((current) =>
|
||||
[
|
||||
...current.filter((m) => m.id !== id && m.id !== saved.id),
|
||||
{ ...saved, mine: true, guestId: guest, delivery: 'sent' },
|
||||
].slice(-300),
|
||||
)
|
||||
setStatus((s) => (s === 'offline' ? 'polling' : s))
|
||||
} catch {
|
||||
Taro.showToast({ title: '仍失败,稍后重试', icon: 'none' })
|
||||
} finally {
|
||||
lock.current = false
|
||||
setSending(false)
|
||||
}
|
||||
},
|
||||
[channelId, guest, messages],
|
||||
)
|
||||
|
||||
return {
|
||||
messages,
|
||||
draft,
|
||||
setDraft,
|
||||
nick,
|
||||
setNick,
|
||||
status,
|
||||
sending,
|
||||
send,
|
||||
retryLocal,
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@ import { usePageShare, markPageShare } from '@/utils/pageShare'
|
||||
import { safePx, useSafeAreaMetrics } from '@/utils/safeArea'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import './index.scss'
|
||||
type PortalId = 'nav' | 'book' | 'community' | 'vip'
|
||||
type PortalId = 'nav' | 'book' | 'community' | 'social' | 'vip'
|
||||
|
||||
type Portal = {
|
||||
id: PortalId
|
||||
@ -31,13 +31,15 @@ type Portal = {
|
||||
const PORTALS: Portal[] = [
|
||||
{ id: 'nav', moduleKey: 'nav', emoji: '🧭', name: '出海导航', main: false },
|
||||
{ id: 'book', moduleKey: 'book', emoji: '📖', name: '数字游民', main: false },
|
||||
{ id: 'community', moduleKey: 'community', emoji: '🌏', name: '旅居社群', main: true },
|
||||
{ id: 'social', moduleKey: 'social', emoji: '💕', name: '游民社区', main: true },
|
||||
{ id: 'community', moduleKey: 'community', emoji: '🌏', name: '旅居社群', main: false },
|
||||
]
|
||||
|
||||
const INTERNAL_PORTALS: Record<PortalId, string> = {
|
||||
nav: '/pages/nav/index',
|
||||
book: '/pages/book/index',
|
||||
community: '/pages/community/index',
|
||||
social: '/pages/social/index',
|
||||
vip: '/pages/vip/index',
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
import { useMemo, useState } from 'react'
|
||||
import { MOCK_ROSTER } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { SocialAvatar } from './SocialAvatar'
|
||||
import { PeopleChip } from './PeopleChip'
|
||||
import { H5El } from './H5El'
|
||||
|
||||
const FILTERS = [
|
||||
{ id: 'all' as const, label: '全部', emoji: '✨' },
|
||||
{ id: 'online' as const, label: '在线', emoji: '🟢' },
|
||||
{ id: 'f' as const, label: '女生', emoji: '👩' },
|
||||
{ id: 'm' as const, label: '男生', emoji: '👨' },
|
||||
]
|
||||
|
||||
export function AttractiveRoster({ onJoin }: { onJoin: () => void }) {
|
||||
const [filter, setFilter] = useState<'all' | 'online' | 'f' | 'm'>('all')
|
||||
const [likes, setLikes] = useState<Record<string, boolean>>({})
|
||||
|
||||
const list = useMemo(() => {
|
||||
return MOCK_ROSTER.filter((m) => {
|
||||
if (filter === 'online') return m.online
|
||||
if (filter === 'f' || filter === 'm') return m.gender === filter
|
||||
return true
|
||||
})
|
||||
}, [filter])
|
||||
|
||||
const online = useMemo(() => MOCK_ROSTER.filter((m) => m.online), [])
|
||||
|
||||
return (
|
||||
<H5El as='section' className='section section-compact' id='people' aria-label='在线游民'>
|
||||
<H5El className='container'>
|
||||
<H5El className='section-header reveal visible'>
|
||||
<H5El as='span' className='section-tag'>
|
||||
<H5El as='span'>看看谁在这儿</H5El>
|
||||
<H5El as='span'>点开认识</H5El>
|
||||
</H5El>
|
||||
<H5El as='h2'>
|
||||
<H5El as='span' className='social-title-emoji' aria-hidden>
|
||||
👋
|
||||
</H5El>
|
||||
想见的人
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
点开卡片,看看对方在做什么、想认识谁。现在是示例介绍,方便你先逛逛。
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-people-bar reveal visible'>
|
||||
<H5El className='social-people-bar-avs' aria-hidden>
|
||||
{online.slice(0, 6).map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={30} />
|
||||
))}
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
<H5El as='strong' className='social-count-pulse'>
|
||||
{online.length}
|
||||
</H5El>{' '}
|
||||
位现在在线
|
||||
<H5El as='span'> · 示例数据</H5El>
|
||||
</H5El>
|
||||
<H5El as='button' className='btn btn-sm' onClick={onJoin}>
|
||||
加入社区
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-people-filters'>
|
||||
{FILTERS.map((f) => (
|
||||
<H5El
|
||||
as='button'
|
||||
key={f.id}
|
||||
type='button'
|
||||
className={`social-people-filter${filter === f.id ? ' is-on active' : ''}`}
|
||||
onClick={() => setFilter(f.id)}
|
||||
>
|
||||
{f.emoji} {f.label}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-people-grid'>
|
||||
{list.map((m, i) => (
|
||||
<PeopleChip
|
||||
key={m.id}
|
||||
member={m}
|
||||
liked={!!likes[m.id]}
|
||||
staggerMs={Math.min(i, 12) * 40}
|
||||
onToggleLike={() =>
|
||||
setLikes((prev) => ({ ...prev, [m.id]: !prev[m.id] }))
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
<H5El as='p' className='social-people-hint'>
|
||||
👆 点卡片看看详情,也可以先点爱心关注
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-section-actions reveal visible'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-ghost'
|
||||
href='#people'
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
>
|
||||
看全部
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-primary'
|
||||
href='#date'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
开始认识 ↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,376 @@
|
||||
import { useState, type CSSProperties } from 'react'
|
||||
import { Video } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { MOCK_ROSTER, SOCIAL_COPY, type SocialLandingCopy } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { SocialAvatar } from './SocialAvatar'
|
||||
import { FloatingEmojiField } from './SocialExperience'
|
||||
import { H5El } from './H5El'
|
||||
|
||||
const NODES = [
|
||||
{ member: 0, x: 22, y: 22, rotate: -8 },
|
||||
{ member: 1, x: 79, y: 26, rotate: 7 },
|
||||
{ member: 4, x: 85, y: 65, rotate: -6 },
|
||||
{ member: 3, x: 18, y: 69, rotate: 6 },
|
||||
]
|
||||
|
||||
const ORBIT_SVG = `<svg class="connection-orbits" viewBox="0 0 560 480" fill="none" aria-hidden="true">
|
||||
<defs>
|
||||
<radialGradient id="connection-globe"><stop stop-color="#4ecdc4" stop-opacity=".15"/><stop offset="1" stop-color="#4ecdc4" stop-opacity="0"/></radialGradient>
|
||||
<linearGradient id="connection-line" x1="100" y1="100" x2="450" y2="400" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#4ecdc4"/><stop offset=".5" stop-color="#ffe66d"/><stop offset="1" stop-color="#ff6b6b"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle cx="280" cy="240" r="185" fill="url(#connection-globe)"/>
|
||||
<g class="connection-globe-lines" stroke="currentColor" stroke-width=".7">
|
||||
<circle cx="280" cy="240" r="121"/><ellipse cx="280" cy="240" rx="121" ry="45"/><ellipse cx="280" cy="240" rx="121" ry="88"/>
|
||||
<ellipse cx="280" cy="240" rx="45" ry="121"/><ellipse cx="280" cy="240" rx="88" ry="121"/><path d="M159 240h242M280 119v242"/>
|
||||
</g>
|
||||
<g stroke="url(#connection-line)" stroke-width="1">
|
||||
<ellipse cx="280" cy="240" rx="221" ry="148" transform="rotate(-28 280 240)" opacity=".35"/>
|
||||
<ellipse cx="280" cy="240" rx="230" ry="186" transform="rotate(24 280 240)" stroke-dasharray="3 9" opacity=".3"/>
|
||||
<circle cx="280" cy="240" r="170" opacity=".12"/>
|
||||
</g>
|
||||
<g class="connection-orbit-traveler"><circle cx="280" cy="70" r="4" fill="#4ecdc4"/><circle cx="280" cy="70" r="9" stroke="#4ecdc4" stroke-opacity=".25"/></g>
|
||||
<g class="connection-orbit-traveler connection-orbit-traveler-second"><circle cx="280" cy="410" r="3" fill="#ff6b6b"/></g>
|
||||
<path class="connection-flight-path" d="M126 106Q280 40 442 125M100 330Q270 440 470 310" stroke="url(#connection-line)" stroke-width="1.5" stroke-dasharray="5 8" opacity=".55"/>
|
||||
</svg>`
|
||||
|
||||
const isH5 = process.env.TARO_ENV === 'h5'
|
||||
|
||||
export function ConnectionHero({
|
||||
onJoin,
|
||||
promoUrl,
|
||||
copy = SOCIAL_COPY,
|
||||
}: {
|
||||
onJoin: () => void
|
||||
promoUrl: string
|
||||
copy?: SocialLandingCopy
|
||||
}) {
|
||||
const [videoOpen, setVideoOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<H5El as='section' className='connection-hero' id='hero' aria-labelledby='connection-title'>
|
||||
<H5El className='connection-hero-grid' aria-hidden />
|
||||
<FloatingEmojiField />
|
||||
<H5El className='container connection-hero-layout'>
|
||||
<H5El className='connection-copy'>
|
||||
<H5El className='connection-eyebrow'>
|
||||
<H5El as='span' className='connection-status-dot' /> 游民社区{' '}
|
||||
<H5El as='span' className='connection-eyebrow-divider' /> {copy.socialEyebrow}
|
||||
</H5El>
|
||||
<H5El as='h1' id='connection-title'>
|
||||
<H5El as='span' className='connection-title-line'>
|
||||
{copy.socialHeroLine1}
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-title-line'>
|
||||
还好
|
||||
<H5El as='span' className='connection-title-accent'>
|
||||
{copy.socialHeroAccent}
|
||||
</H5El>
|
||||
不远
|
||||
<H5El as='span' className='connection-title-period'>
|
||||
。
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El as='p' className='connection-description'>
|
||||
{copy.socialHeroLead}
|
||||
</H5El>
|
||||
<H5El className='connection-actions'>
|
||||
<H5El
|
||||
as='button'
|
||||
className='btn connection-join'
|
||||
onClick={onJoin}
|
||||
trackLabel='social_join'
|
||||
>
|
||||
{copy.socialJoinCta} <H5El as='span'>↗</H5El>
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='connection-film'
|
||||
href='#chat'
|
||||
onClick={() => goPage('/pages/social/chat/index')}
|
||||
trackLabel='social_film_chat'
|
||||
>
|
||||
<H5El as='span'>💬</H5El>
|
||||
群组聊天
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='connection-film'
|
||||
href='#date'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
trackLabel='social_film_date'
|
||||
>
|
||||
<H5El as='span'>💕</H5El>
|
||||
认识一下
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
className='connection-film connection-film-story'
|
||||
onClick={() => setVideoOpen(true)}
|
||||
trackLabel='social_film_story'
|
||||
>
|
||||
<H5El as='span'>▶</H5El>
|
||||
社区故事
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='connection-proof'>
|
||||
<H5El className='connection-avatar-stack' aria-hidden>
|
||||
{MOCK_ROSTER.slice(0, 5).map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={36} />
|
||||
))}
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>同频的人,正在这里相遇</H5El>
|
||||
<H5El as='span'>自由职业 · 远程工作 · 出来见一面</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='connection-universe'>
|
||||
<H5El className='connection-universe-label'>
|
||||
<H5El as='span'>🌐</H5El>
|
||||
<H5El as='span'>不止在线,更在身边</H5El>
|
||||
<H5El as='span' className='connection-signal' aria-hidden>
|
||||
<H5El as='i' />
|
||||
<H5El as='i' />
|
||||
<H5El as='i' />
|
||||
<H5El as='i' />
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='connection-orbit-scene'>
|
||||
{isH5 ? (
|
||||
<H5El
|
||||
className='connection-orbits-host'
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: ORBIT_SVG }}
|
||||
/>
|
||||
) : null}
|
||||
<H5El className='connection-center'>
|
||||
<H5El className='connection-center-icon'>
|
||||
<H5El as='span'>✨</H5El>
|
||||
</H5El>
|
||||
<H5El as='strong'>同频,自有引力</H5El>
|
||||
<H5El as='span'>想见的人</H5El>
|
||||
</H5El>
|
||||
{NODES.map(({ member, x, y, rotate }, i) => {
|
||||
const m = MOCK_ROSTER[member]!
|
||||
const style = {
|
||||
['--node-x' as string]: `${x}%`,
|
||||
['--node-y' as string]: `${y}%`,
|
||||
['--node-rotate' as string]: `${rotate}deg`,
|
||||
['--node-delay' as string]: `${i * -1.4}s`,
|
||||
} as CSSProperties
|
||||
return (
|
||||
<H5El
|
||||
as='a'
|
||||
key={m.id}
|
||||
href='#people'
|
||||
className={`connection-person connection-person-${i}`}
|
||||
style={style}
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
aria-label={`认识${m.name},${m.title}`}
|
||||
>
|
||||
<H5El as='span' className='connection-person-avatar'>
|
||||
<SocialAvatar src={m.avatar} size={44} />
|
||||
<H5El as='i' />
|
||||
</H5El>
|
||||
<H5El as='span'>
|
||||
<H5El as='strong'>
|
||||
{m.name}
|
||||
<H5El as='span'>↗</H5El>
|
||||
</H5El>
|
||||
<H5El as='small'>{m.title}</H5El>
|
||||
<H5El as='em'>{m.city.split('·')[0]?.trim()}</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
)
|
||||
})}
|
||||
<H5El as='span' className='connection-coordinate connection-coordinate-one'>
|
||||
18.79° N · 清迈
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-coordinate connection-coordinate-two'>
|
||||
25.60° N · 大理
|
||||
</H5El>
|
||||
<H5El className='connection-wave'>
|
||||
<H5El as='span'>☕</H5El>
|
||||
<H5El as='span'>下一杯咖啡,和新朋友。</H5El>
|
||||
<H5El as='span'>↗</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='connection-universe-footer'>
|
||||
<H5El as='span'>
|
||||
<H5El as='span' className='connection-status-dot' /> 连接没有边界
|
||||
</H5El>
|
||||
<H5El as='span'>先用示例看看感觉</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container connection-hero-bottom'>
|
||||
<H5El
|
||||
as='a'
|
||||
href='#people'
|
||||
onClick={() => {
|
||||
if (process.env.TARO_ENV === 'h5' && typeof document !== 'undefined') {
|
||||
document.getElementById('people')?.scrollIntoView({ behavior: 'smooth' })
|
||||
} else {
|
||||
const query = Taro.createSelectorQuery()
|
||||
query.select('#people').boundingClientRect()
|
||||
query.selectViewport().scrollOffset()
|
||||
query.exec((res) => {
|
||||
const rect = res?.[0] as { top?: number } | undefined
|
||||
const offset = res?.[1] as { scrollTop?: number } | undefined
|
||||
if (!rect || typeof rect.top !== 'number') return
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: Math.max(0, (offset?.scrollTop || 0) + rect.top - 72),
|
||||
duration: 300,
|
||||
})
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
↓ 继续往下看
|
||||
</H5El>
|
||||
<H5El as='span'>认识人 · 开视频 · 见一面</H5El>
|
||||
</H5El>
|
||||
|
||||
{videoOpen ? (
|
||||
<H5El
|
||||
className='connection-video-dialog is-open'
|
||||
role='dialog'
|
||||
aria-label='社区故事'
|
||||
style={{
|
||||
position: 'fixed',
|
||||
inset: 0,
|
||||
zIndex: 2000,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background: 'rgba(0,0,0,0.72)',
|
||||
padding: 16,
|
||||
}}
|
||||
onClick={() => setVideoOpen(false)}
|
||||
>
|
||||
<H5El
|
||||
className='connection-video-content'
|
||||
style={{
|
||||
width: 'min(920px, 100%)',
|
||||
background: '#0c0c0f',
|
||||
borderRadius: 16,
|
||||
overflow: 'hidden',
|
||||
border: '1px solid rgba(255,255,255,0.1)',
|
||||
}}
|
||||
onClick={() => undefined}
|
||||
>
|
||||
<H5El
|
||||
as='header'
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
padding: '12px 16px',
|
||||
}}
|
||||
>
|
||||
<H5El as='h2'>游民社区 · 社区故事</H5El>
|
||||
<H5El as='button' onClick={() => setVideoOpen(false)} aria-label='关闭'>
|
||||
✕
|
||||
</H5El>
|
||||
</H5El>
|
||||
<Video
|
||||
src={promoUrl}
|
||||
controls
|
||||
autoplay
|
||||
style={{ width: '100%', height: 360, display: 'block' }}
|
||||
/>
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : null}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
|
||||
export function ConnectionWays({ copy = SOCIAL_COPY }: { copy?: SocialLandingCopy }) {
|
||||
const ways = [
|
||||
{
|
||||
id: '01',
|
||||
path: '/pages/social/chat/index',
|
||||
emoji: '💬',
|
||||
title: copy.socialWayGroup,
|
||||
sub: '大家一起聊 · 先打个招呼',
|
||||
cta: '进群聊',
|
||||
className: 'mint',
|
||||
},
|
||||
{
|
||||
id: '02',
|
||||
path: '/pages/social/date/index',
|
||||
emoji: '💕',
|
||||
title: copy.socialWayDate,
|
||||
sub: '左右滑,慢慢认识',
|
||||
cta: '开始看看',
|
||||
className: 'coral',
|
||||
},
|
||||
{
|
||||
id: '03',
|
||||
path: '/pages/social/meetup/index',
|
||||
emoji: '📡',
|
||||
title: copy.socialWayChat,
|
||||
sub: '聊天群组 · 语音视频',
|
||||
cta: '去聊聊',
|
||||
className: 'mint',
|
||||
},
|
||||
{
|
||||
id: '04',
|
||||
path: '/pages/social/people/index?mode=cafe',
|
||||
emoji: '☕',
|
||||
title: copy.socialWayCafe,
|
||||
sub: copy.socialOfflineTitle,
|
||||
cta: '选城市',
|
||||
className: 'yellow',
|
||||
},
|
||||
{
|
||||
id: '05',
|
||||
path: '/pages/social/team/index',
|
||||
emoji: '🚀',
|
||||
title: copy.socialWayTeam,
|
||||
sub: copy.socialTeamTitle,
|
||||
cta: '看看机会',
|
||||
className: 'mint',
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<H5El className='container connection-ways is-alive' aria-label='选择连接方式'>
|
||||
{ways.map((way, index) => (
|
||||
<H5El
|
||||
as='a'
|
||||
key={way.id}
|
||||
href={way.path}
|
||||
className={`connection-way ${way.className}`}
|
||||
style={{ ['--stagger' as string]: `${index * 70}ms` }}
|
||||
onClick={() => goPage(way.path)}
|
||||
trackLabel={`social_way_${way.id}`}
|
||||
>
|
||||
<H5El as='span' className='connection-way-index'>
|
||||
{way.id}
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-way-icon'>
|
||||
<H5El as='span' style={{ fontSize: 23 }}>
|
||||
{way.emoji}
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-way-copy'>
|
||||
<H5El as='strong'>{way.title}</H5El>
|
||||
<H5El as='small'>{way.sub}</H5El>
|
||||
<H5El as='em'>{way.cta}</H5El>
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-way-arrow'>
|
||||
↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
132
apps/miniprogram/h5/src/pages/social/_components/H5El.tsx
Normal file
132
apps/miniprogram/h5/src/pages/social/_components/H5El.tsx
Normal file
@ -0,0 +1,132 @@
|
||||
import type {
|
||||
CSSProperties,
|
||||
HTMLAttributes,
|
||||
ReactNode,
|
||||
ElementType,
|
||||
} from 'react'
|
||||
import { Text, View } from '@tarojs/components'
|
||||
import { trackClick } from '@/utils/track'
|
||||
|
||||
const isH5 = process.env.TARO_ENV === 'h5'
|
||||
|
||||
type Props = {
|
||||
as?: ElementType
|
||||
className?: string
|
||||
id?: string
|
||||
children?: ReactNode
|
||||
style?: CSSProperties
|
||||
onClick?: (e?: any) => void
|
||||
trackLabel?: string
|
||||
href?: string
|
||||
htmlFor?: string
|
||||
type?: string
|
||||
role?: string
|
||||
'aria-label'?: string
|
||||
'aria-hidden'?: boolean | 'true' | 'false'
|
||||
'aria-current'?: string
|
||||
'aria-selected'?: boolean | 'true' | 'false'
|
||||
'aria-labelledby'?: string
|
||||
'data-theme'?: string
|
||||
dangerouslySetInnerHTML?: { __html: string }
|
||||
} & Omit<
|
||||
HTMLAttributes<HTMLElement>,
|
||||
| 'onClick'
|
||||
| 'className'
|
||||
| 'style'
|
||||
| 'children'
|
||||
| 'dangerouslySetInnerHTML'
|
||||
| 'aria-current'
|
||||
| 'aria-selected'
|
||||
| 'aria-labelledby'
|
||||
>
|
||||
|
||||
/**
|
||||
* H5: real semantic tags so Next /social CSS selectors (h1/strong/small/em/a/nav…) match 1:1.
|
||||
* Mini program: View/Text fallback.
|
||||
*/
|
||||
export function H5El({
|
||||
as = 'div',
|
||||
className,
|
||||
id,
|
||||
children,
|
||||
style,
|
||||
onClick,
|
||||
trackLabel,
|
||||
href,
|
||||
type,
|
||||
role,
|
||||
'aria-label': ariaLabel,
|
||||
'aria-hidden': ariaHidden,
|
||||
'aria-current': ariaCurrent,
|
||||
'aria-selected': ariaSelected,
|
||||
'aria-labelledby': ariaLabelledby,
|
||||
'data-theme': dataTheme,
|
||||
dangerouslySetInnerHTML,
|
||||
...rest
|
||||
}: Props) {
|
||||
const handleClick = onClick
|
||||
? (e?: any) => {
|
||||
if (trackLabel) trackClick(trackLabel)
|
||||
onClick(e)
|
||||
}
|
||||
: trackLabel
|
||||
? () => trackClick(trackLabel)
|
||||
: undefined
|
||||
|
||||
if (isH5) {
|
||||
const Tag = as as ElementType
|
||||
const clickProps =
|
||||
Tag === 'a'
|
||||
? {
|
||||
href: href || '#',
|
||||
onClick: (e: any) => {
|
||||
if (handleClick) {
|
||||
e.preventDefault()
|
||||
handleClick(e)
|
||||
}
|
||||
},
|
||||
}
|
||||
: Tag === 'button'
|
||||
? { type: type || 'button', onClick: handleClick }
|
||||
: handleClick
|
||||
? { onClick: handleClick }
|
||||
: {}
|
||||
|
||||
return (
|
||||
<Tag
|
||||
id={id}
|
||||
className={className}
|
||||
style={style}
|
||||
role={role}
|
||||
aria-label={ariaLabel}
|
||||
aria-hidden={ariaHidden}
|
||||
aria-current={ariaCurrent}
|
||||
aria-selected={ariaSelected}
|
||||
aria-labelledby={ariaLabelledby}
|
||||
data-theme={dataTheme}
|
||||
dangerouslySetInnerHTML={dangerouslySetInnerHTML}
|
||||
{...clickProps}
|
||||
{...rest}
|
||||
>
|
||||
{dangerouslySetInnerHTML ? undefined : children}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
|
||||
const tag = typeof as === 'string' ? as : 'div'
|
||||
const Mini =
|
||||
tag === 'span' ||
|
||||
tag === 'strong' ||
|
||||
tag === 'small' ||
|
||||
tag === 'em' ||
|
||||
tag === 'i'
|
||||
? Text
|
||||
: View
|
||||
// weapp 无语义标签:补 as-* class,方便 CSS 用 .as-i / .as-h1 对齐 Next 选择器
|
||||
const miniClass = [className, `as-${tag}`].filter(Boolean).join(' ')
|
||||
return (
|
||||
<Mini id={id} className={miniClass} style={style} onClick={handleClick}>
|
||||
{children}
|
||||
</Mini>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
/* 加群底栏:rem + 全宽,禁止裸 px(weapp 750 会缩水) */
|
||||
.social-join-sheet-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1300;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.62);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-join-sheet-panel {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
border-radius: 1.25rem 1.25rem 0 0;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-bottom: none;
|
||||
background: rgba(12, 12, 15, 0.98);
|
||||
padding: 0.5rem 1.25rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
|
||||
box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-join-sheet-handle {
|
||||
width: 2.25rem;
|
||||
height: 0.25rem;
|
||||
border-radius: 99px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
margin: 0.2rem auto 0.85rem;
|
||||
}
|
||||
|
||||
.social-join-sheet-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 2.75rem;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.social-join-brand {
|
||||
font-size: 0.85rem;
|
||||
color: #f59e0b;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.social-join-sheet-close {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
border-radius: 0.65rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #94a3b8;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.social-join-sheet-title {
|
||||
margin: 0 0 0.4rem;
|
||||
font-size: 1.45rem;
|
||||
font-weight: 750;
|
||||
color: #f1f5f9;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.social-join-sheet-lead {
|
||||
margin: 0 0 1rem;
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.45;
|
||||
color: #94a3b8 !important;
|
||||
}
|
||||
|
||||
.social-join-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.65rem;
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.85rem 1rem;
|
||||
border-radius: 0.85rem;
|
||||
background: rgba(245, 158, 11, 0.08);
|
||||
border: 1px solid rgba(245, 158, 11, 0.22);
|
||||
}
|
||||
|
||||
.social-join-price strong {
|
||||
font-size: 1.65rem;
|
||||
color: #f59e0b;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.social-join-price span {
|
||||
font-size: 0.78rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-join-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.75rem;
|
||||
font-size: 0.82rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-join-input {
|
||||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 0.9rem;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #f1f5f9;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-join-err {
|
||||
margin: 0 0 0.65rem;
|
||||
color: #f87171;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.social-join-sheet-submit {
|
||||
width: 100%;
|
||||
min-height: 2.85rem;
|
||||
margin-top: 0.25rem;
|
||||
border-radius: 0.85rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.social-join-privacy {
|
||||
margin: 0.75rem 0 0;
|
||||
font-size: 0.72rem;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Input } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { H5El } from './H5El'
|
||||
import {
|
||||
fetchSocialJoinStatus,
|
||||
isSocialJoinLocal,
|
||||
paySocialJoin,
|
||||
} from '@/utils/socialJoinPay'
|
||||
import './JoinPaySheet.scss'
|
||||
|
||||
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
const EMAIL_KEY = 'userEmail'
|
||||
|
||||
type Props = {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
onPaid?: () => void
|
||||
}
|
||||
|
||||
/**
|
||||
* 加群收费底栏 — 微信虚拟支付(social-join),不是 VIP / community。
|
||||
* rem + 全宽底栏,避免 designWidth:750 缩水。
|
||||
*/
|
||||
export function JoinPaySheet({ open, onClose, onPaid }: Props) {
|
||||
const [email, setEmail] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [err, setErr] = useState('')
|
||||
const [priceLabel, setPriceLabel] = useState('¥49')
|
||||
const [already, setAlready] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
try {
|
||||
setEmail(String(Taro.getStorageSync(EMAIL_KEY) || ''))
|
||||
} catch {
|
||||
setEmail('')
|
||||
}
|
||||
setErr('')
|
||||
setBusy(false)
|
||||
setAlready(isSocialJoinLocal())
|
||||
void fetchSocialJoinStatus().then((s) => {
|
||||
if (!s) return
|
||||
if (s.isMember) setAlready(true)
|
||||
if (s.priceFen > 0) setPriceLabel(`¥${(s.priceFen / 100).toFixed(0)}`)
|
||||
})
|
||||
}, [open])
|
||||
|
||||
if (!open) return null
|
||||
|
||||
const submit = async () => {
|
||||
if (busy) return
|
||||
if (already) {
|
||||
onClose()
|
||||
return
|
||||
}
|
||||
const value = email.trim().toLowerCase()
|
||||
if (!EMAIL_RE.test(value)) {
|
||||
setErr('请输入有效邮箱')
|
||||
return
|
||||
}
|
||||
setErr('')
|
||||
setBusy(true)
|
||||
try {
|
||||
Taro.setStorageSync(EMAIL_KEY, value)
|
||||
Taro.setStorageSync('userName', value.split('@')[0] || '游民')
|
||||
await paySocialJoin()
|
||||
setAlready(true)
|
||||
Taro.showToast({ title: '已加入游民社区', icon: 'success' })
|
||||
onPaid?.()
|
||||
onClose()
|
||||
} catch (e) {
|
||||
const msg = String((e as Error)?.message || e || '')
|
||||
if (/取消|cancel/i.test(msg)) {
|
||||
setErr('')
|
||||
} else {
|
||||
setErr(msg || '支付唤起失败,请稍后重试')
|
||||
}
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<H5El className='social-join-sheet-mask' onClick={() => !busy && onClose()}>
|
||||
<H5El
|
||||
className='social-join-sheet-panel'
|
||||
onClick={(e) => {
|
||||
e?.stopPropagation?.()
|
||||
}}
|
||||
>
|
||||
<H5El className='social-join-sheet-handle' aria-hidden />
|
||||
<H5El className='social-join-sheet-head'>
|
||||
<H5El as='span' className='social-join-brand'>
|
||||
✨ 游民社区 · 加群
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-join-sheet-close'
|
||||
aria-label='关闭'
|
||||
onClick={() => !busy && onClose()}
|
||||
>
|
||||
✕
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El as='h2' className='social-join-sheet-title'>
|
||||
{already ? '你已在群里' : '加入游民社区'}
|
||||
</H5El>
|
||||
<H5El as='p' className='social-muted social-join-sheet-lead'>
|
||||
{already
|
||||
? '认识同频 · 开视频 · 找搭子,直接去逛就好。'
|
||||
: `认识同频的人 · 开视频聊聊 · 出来见一面 · 一起做点事`}
|
||||
</H5El>
|
||||
|
||||
{!already ? (
|
||||
<>
|
||||
<H5El className='social-join-price' aria-label='加群费用'>
|
||||
<H5El as='strong'>{priceLabel}</H5El>
|
||||
<H5El as='span'>一次性加群 · 非 VIP 会员</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-join-field'>
|
||||
<H5El as='span'>邮箱</H5El>
|
||||
<Input
|
||||
className='social-join-input'
|
||||
type='text'
|
||||
placeholder='你的常用邮箱'
|
||||
value={email}
|
||||
disabled={busy}
|
||||
onInput={(e) => setEmail(e.detail.value)}
|
||||
/>
|
||||
</H5El>
|
||||
{err ? (
|
||||
<H5El as='p' className='social-join-err' role='alert'>
|
||||
{err}
|
||||
</H5El>
|
||||
) : null}
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary social-join-sheet-submit'
|
||||
onClick={() => void submit()}
|
||||
>
|
||||
{busy ? '正在唤起支付…' : `确认并支付 ${priceLabel}`}
|
||||
</H5El>
|
||||
<H5El as='p' className='social-join-privacy'>
|
||||
🔒 邮箱用于账号识别 · 微信小程序虚拟支付
|
||||
</H5El>
|
||||
</>
|
||||
) : (
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary social-join-sheet-submit'
|
||||
onClick={onClose}
|
||||
>
|
||||
好的,继续逛
|
||||
</H5El>
|
||||
)}
|
||||
</H5El>
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
import type { SocialRosterMember } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { SocialAvatar } from './SocialAvatar'
|
||||
import { H5El } from './H5El'
|
||||
|
||||
/** Align with Next AttractiveRoster: 点卡片进个人详情(非 date 左右滑) */
|
||||
export function PeopleChip({
|
||||
member,
|
||||
liked,
|
||||
onToggleLike,
|
||||
staggerMs = 0,
|
||||
href,
|
||||
}: {
|
||||
member: SocialRosterMember
|
||||
liked?: boolean
|
||||
onToggleLike?: () => void
|
||||
staggerMs?: number
|
||||
href?: string
|
||||
}) {
|
||||
const city = member.city.split('·')[0]?.trim() || member.city
|
||||
const to =
|
||||
href ||
|
||||
`/pages/social/people/profile/index?id=${encodeURIComponent(member.id)}`
|
||||
return (
|
||||
<H5El
|
||||
as='article'
|
||||
className={`social-people-chip social-chip-pop is-rich${member.online ? ' is-online' : ''}${liked ? ' is-liked' : ''}`}
|
||||
style={{ ['--stagger' as string]: `${staggerMs}ms` }}
|
||||
onClick={() => goPage(to)}
|
||||
>
|
||||
<H5El className='social-people-chip-ava'>
|
||||
<SocialAvatar src={member.avatar} size={52} />
|
||||
{member.online ? <H5El as='i' aria-hidden /> : null}
|
||||
{liked ? (
|
||||
<H5El as='em' className='social-chip-heart' aria-hidden>
|
||||
♥
|
||||
</H5El>
|
||||
) : null}
|
||||
</H5El>
|
||||
<H5El as='strong'>
|
||||
{member.name}
|
||||
{member.online ? ' · 在线' : ''}
|
||||
</H5El>
|
||||
<H5El as='span' className='connection-member-role'>
|
||||
{member.title}
|
||||
{member.vibe ? ` · ${member.vibe.split('·')[0].trim()}` : ''}
|
||||
</H5El>
|
||||
<H5El as='em'>
|
||||
{city}
|
||||
{member.tags[0] ? ` · ${member.tags[0]}` : ''}
|
||||
</H5El>
|
||||
<H5El as='span' className='social-people-chip-want'>
|
||||
{member.lookingFor}
|
||||
</H5El>
|
||||
{onToggleLike ? (
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-people-chip-like'
|
||||
aria-label={liked ? '取消关注' : '关注'}
|
||||
onClick={(e) => {
|
||||
e?.stopPropagation?.()
|
||||
onToggleLike()
|
||||
}}
|
||||
>
|
||||
{liked ? '♥' : '♡'}
|
||||
</H5El>
|
||||
) : null}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
import { Image } from '@tarojs/components'
|
||||
|
||||
const isH5 = process.env.TARO_ENV === 'h5'
|
||||
|
||||
export function SocialAvatar({
|
||||
src,
|
||||
size = 40,
|
||||
className = '',
|
||||
}: {
|
||||
src: string
|
||||
size?: number
|
||||
className?: string
|
||||
}) {
|
||||
const style: CSSProperties = {
|
||||
width: size,
|
||||
height: size,
|
||||
borderRadius: '999px',
|
||||
display: 'block',
|
||||
objectFit: 'cover',
|
||||
flexShrink: 0,
|
||||
background: '#1a1d24',
|
||||
}
|
||||
|
||||
if (isH5) {
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
<img
|
||||
className={`social-avatar ${className}`.trim()}
|
||||
src={src}
|
||||
width={size}
|
||||
height={size}
|
||||
style={style}
|
||||
loading='lazy'
|
||||
alt=''
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Image
|
||||
className={`social-avatar ${className}`.trim()}
|
||||
src={src}
|
||||
mode='aspectFill'
|
||||
style={style}
|
||||
lazyLoad
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
import { useMemo } from 'react'
|
||||
import Taro, { useRouter } from '@tarojs/taro'
|
||||
import { SOCIAL_DOCK } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { H5El } from './H5El'
|
||||
|
||||
function normalize(path: string) {
|
||||
const raw = (path || '').split('?')[0]
|
||||
if (!raw) return ''
|
||||
return raw.startsWith('/') ? raw : `/${raw}`
|
||||
}
|
||||
|
||||
export function SocialDock() {
|
||||
const router = useRouter()
|
||||
const current = useMemo(() => {
|
||||
const fromRouter = normalize(router?.path || '')
|
||||
if (fromRouter) return fromRouter
|
||||
try {
|
||||
const pages = Taro.getCurrentPages()
|
||||
const last = pages[pages.length - 1] as { route?: string } | undefined
|
||||
return normalize(last?.route ? `/${last.route}` : '')
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}, [router?.path])
|
||||
|
||||
return (
|
||||
<H5El as='nav' className='social-mobile-dock' aria-label='快捷导航'>
|
||||
{SOCIAL_DOCK.map((item) => {
|
||||
const target = normalize(item.path)
|
||||
const active =
|
||||
item.match === 'exact'
|
||||
? current === target || /\/pages\/social\/index$/.test(current)
|
||||
: current.startsWith(target.replace(/\/index$/, '')) ||
|
||||
current === target
|
||||
return (
|
||||
<H5El
|
||||
as='a'
|
||||
key={item.path}
|
||||
href={item.path}
|
||||
aria-label={item.label}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
onClick={() => goPage(item.path)}
|
||||
trackLabel={`social_dock_${item.short}`}
|
||||
>
|
||||
<H5El as='span' style={{ fontSize: 18, lineHeight: 1 }}>
|
||||
{item.emoji}
|
||||
</H5El>
|
||||
<H5El as='span'>{item.short}</H5El>
|
||||
</H5El>
|
||||
)
|
||||
})}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,266 @@
|
||||
import {
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
type CSSProperties,
|
||||
type ReactNode,
|
||||
} from 'react'
|
||||
import { H5El } from './H5El'
|
||||
|
||||
const isH5 = process.env.TARO_ENV === 'h5'
|
||||
|
||||
function Constellation({ active }: { active: boolean }) {
|
||||
const canvasRef = useRef<HTMLCanvasElement | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isH5 || !active) return
|
||||
const canvas = canvasRef.current
|
||||
const context = canvas?.getContext('2d')
|
||||
if (!canvas || !context) return
|
||||
|
||||
const media = window.matchMedia('(prefers-reduced-motion: reduce)')
|
||||
let frame = 0
|
||||
let width = 0
|
||||
let height = 0
|
||||
let last = 0
|
||||
let pointer = { x: -1000, y: -1000 }
|
||||
let points: {
|
||||
x: number
|
||||
y: number
|
||||
vx: number
|
||||
vy: number
|
||||
r: number
|
||||
color: string
|
||||
}[] = []
|
||||
|
||||
const resize = () => {
|
||||
width = Math.max(
|
||||
window.innerWidth || 0,
|
||||
document.documentElement.clientWidth || 0,
|
||||
window.visualViewport?.width || 0,
|
||||
)
|
||||
height = Math.max(
|
||||
window.innerHeight || 0,
|
||||
document.documentElement.clientHeight || 0,
|
||||
window.visualViewport?.height || 0,
|
||||
)
|
||||
const ratio = Math.min(window.devicePixelRatio || 1, 1.5)
|
||||
canvas.style.width = `${width}px`
|
||||
canvas.style.height = `${height}px`
|
||||
canvas.width = Math.floor(width * ratio)
|
||||
canvas.height = Math.floor(height * ratio)
|
||||
context.setTransform(ratio, 0, 0, ratio, 0, 0)
|
||||
points = Array.from({ length: width < 700 ? 28 : 52 }, (_, i) => ({
|
||||
x: Math.random() * width,
|
||||
y: Math.random() * height,
|
||||
vx: (Math.random() - 0.5) * 0.28,
|
||||
vy: (Math.random() - 0.5) * 0.28,
|
||||
r: 0.9 + Math.random() * 1.4,
|
||||
color: ['78,205,196', '255,107,107', '255,230,109'][i % 3]!,
|
||||
}))
|
||||
}
|
||||
|
||||
const draw = (time: number) => {
|
||||
if (document.hidden || media.matches) return
|
||||
const delta = Math.min((time - last) / 16.67 || 1, 2)
|
||||
last = time
|
||||
context.clearRect(0, 0, width, height)
|
||||
points.forEach((p, index) => {
|
||||
p.x = (p.x + p.vx * delta + width) % width
|
||||
p.y = (p.y + p.vy * delta + height) % height
|
||||
const near = Math.hypot(pointer.x - p.x, pointer.y - p.y) < 240
|
||||
context.beginPath()
|
||||
context.arc(p.x, p.y, p.r, 0, Math.PI * 2)
|
||||
context.fillStyle = `rgba(${p.color},${near ? 0.55 : 0.28})`
|
||||
context.fill()
|
||||
if (near) {
|
||||
context.beginPath()
|
||||
context.arc(p.x, p.y, p.r + 4, 0, Math.PI * 2)
|
||||
context.fillStyle = `rgba(${p.color},0.1)`
|
||||
context.fill()
|
||||
}
|
||||
if (width > 700) {
|
||||
points.slice(index + 1).forEach((q) => {
|
||||
const distance = Math.hypot(q.x - p.x, q.y - p.y)
|
||||
if (distance > 140) return
|
||||
context.beginPath()
|
||||
context.moveTo(p.x, p.y)
|
||||
context.lineTo(q.x, q.y)
|
||||
context.strokeStyle = `rgba(78,205,196,${(1 - distance / 140) * 0.16})`
|
||||
context.lineWidth = 1.05
|
||||
context.stroke()
|
||||
})
|
||||
}
|
||||
})
|
||||
frame = requestAnimationFrame(draw)
|
||||
}
|
||||
|
||||
const restart = () => {
|
||||
cancelAnimationFrame(frame)
|
||||
last = 0
|
||||
context.clearRect(0, 0, width, height)
|
||||
if (!document.hidden && !media.matches) {
|
||||
frame = requestAnimationFrame(draw)
|
||||
}
|
||||
}
|
||||
|
||||
const move = (event: PointerEvent) => {
|
||||
if (event.pointerType === 'mouse') {
|
||||
pointer = { x: event.clientX, y: event.clientY }
|
||||
}
|
||||
}
|
||||
|
||||
resize()
|
||||
restart()
|
||||
window.addEventListener('resize', resize)
|
||||
window.addEventListener('pointermove', move, { passive: true })
|
||||
document.addEventListener('visibilitychange', restart)
|
||||
media.addEventListener('change', restart)
|
||||
return () => {
|
||||
cancelAnimationFrame(frame)
|
||||
window.removeEventListener('resize', resize)
|
||||
window.removeEventListener('pointermove', move)
|
||||
document.removeEventListener('visibilitychange', restart)
|
||||
media.removeEventListener('change', restart)
|
||||
context.clearRect(0, 0, width, height)
|
||||
}
|
||||
}, [active])
|
||||
|
||||
if (!isH5) return null
|
||||
return (
|
||||
<canvas
|
||||
ref={canvasRef}
|
||||
className='social-constellation'
|
||||
aria-hidden
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function FloatingEmojiField() {
|
||||
const EMOJIS = [
|
||||
{ e: '☕', x: '8%', y: '22%', delay: '0s', dur: '9s', size: '1.1rem' },
|
||||
{ e: '🌏', x: '88%', y: '20%', delay: '1.2s', dur: '11s', size: '1.15rem' },
|
||||
{ e: '✨', x: '78%', y: '62%', delay: '2.4s', dur: '10s', size: '0.95rem' },
|
||||
{ e: '💬', x: '14%', y: '68%', delay: '0.8s', dur: '12s', size: '1rem' },
|
||||
{ e: '🚀', x: '52%', y: '12%', delay: '3s', dur: '10.5s', size: '0.9rem' },
|
||||
]
|
||||
return (
|
||||
<H5El className='social-emoji-field social-emoji-field-soft' aria-hidden>
|
||||
{EMOJIS.map((item) => (
|
||||
<H5El
|
||||
as='span'
|
||||
key={item.e + item.x}
|
||||
className='social-emoji-float'
|
||||
style={
|
||||
{
|
||||
left: item.x,
|
||||
top: item.y,
|
||||
fontSize: item.size,
|
||||
animationDelay: item.delay,
|
||||
animationDuration: item.dur,
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
{item.e}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
|
||||
export function FxBelt() {
|
||||
const ROW = ['☕', '🌏', '💬', '✨', '📡', '🚀']
|
||||
const line = [...ROW, ...ROW, ...ROW].join(' ')
|
||||
return (
|
||||
<H5El className='social-fx-belt' aria-hidden>
|
||||
<H5El className='social-fx-belt-track'>
|
||||
<H5El as='span'>{line}</H5El>
|
||||
<H5El as='span'>{line}</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
|
||||
export function SocialExperience({
|
||||
children,
|
||||
showEmojiField = false,
|
||||
}: {
|
||||
children: ReactNode
|
||||
showEmojiField?: boolean
|
||||
}) {
|
||||
const [immersive, setImmersive] = useState(true)
|
||||
const rootRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isH5 || !immersive) return
|
||||
const root = rootRef.current
|
||||
if (!root) return
|
||||
let frame = 0
|
||||
const move = (event: PointerEvent) => {
|
||||
if (
|
||||
event.pointerType !== 'mouse' ||
|
||||
window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
) {
|
||||
return
|
||||
}
|
||||
cancelAnimationFrame(frame)
|
||||
frame = requestAnimationFrame(() => {
|
||||
root.style.setProperty('--pointer-x', `${event.clientX}px`)
|
||||
root.style.setProperty('--pointer-y', `${event.clientY}px`)
|
||||
const card = (event.target as Element).closest<HTMLElement>(
|
||||
'.social-card, .social-list-item, .social-panel, .social-member-card, .social-person-card, .connection-way',
|
||||
)
|
||||
if (card) {
|
||||
const rect = card.getBoundingClientRect()
|
||||
card.style.setProperty('--spot-x', `${event.clientX - rect.left}px`)
|
||||
card.style.setProperty('--spot-y', `${event.clientY - rect.top}px`)
|
||||
}
|
||||
})
|
||||
}
|
||||
root.addEventListener('pointermove', move, { passive: true })
|
||||
return () => {
|
||||
cancelAnimationFrame(frame)
|
||||
root.removeEventListener('pointermove', move)
|
||||
}
|
||||
}, [immersive])
|
||||
|
||||
// 微信禁止裸 <div>/<canvas>,否则整页黑屏;H5 才挂 pointer ref
|
||||
if (!isH5) {
|
||||
return (
|
||||
<H5El className='social-experience' data-theme='dark'>
|
||||
{children}
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={rootRef}
|
||||
className='social-experience'
|
||||
data-immersive={immersive ? 'true' : 'false'}
|
||||
>
|
||||
<H5El className='social-ambient' aria-hidden>
|
||||
<H5El as='i' />
|
||||
<H5El as='i' />
|
||||
<H5El as='i' />
|
||||
</H5El>
|
||||
<Constellation active={immersive} />
|
||||
<H5El className='social-pointer-glow' aria-hidden />
|
||||
{showEmojiField ? <FloatingEmojiField /> : null}
|
||||
{children}
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-fx-control'
|
||||
onClick={() => setImmersive((v) => !v)}
|
||||
aria-pressed={immersive}
|
||||
title='切换视觉动效强度'
|
||||
>
|
||||
<H5El as='span'>{immersive ? '✨' : '⚡'}</H5El>
|
||||
<H5El as='span'>动效 · {immersive ? '沉浸' : '轻量'}</H5El>
|
||||
</H5El>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export { FloatingEmojiField }
|
||||
@ -0,0 +1,367 @@
|
||||
@import '../../../styles/page-rem.scss';
|
||||
|
||||
/* 子页公共:live-bar / body / 表单 / chat / date(微信强制可读,不靠 @media) */
|
||||
.soc-taro-root.social-weapp .social-live-bar,
|
||||
.soc-taro-root.social-workspace .social-live-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 40;
|
||||
padding: calc(var(--safe-status-bar, 0PX) + 8PX) 14PX 10PX;
|
||||
background: rgba(10, 14, 23, 0.94);
|
||||
border-bottom: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
backdrop-filter: blur(16PX);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-live-bar-main,
|
||||
.soc-taro-root.social-workspace .social-live-bar-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10PX;
|
||||
min-height: 44PX;
|
||||
padding-right: var(--safe-menu-pad, 88PX);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-nav-back,
|
||||
.soc-taro-root.social-workspace .social-nav-back {
|
||||
flex: 0 0 auto;
|
||||
min-height: 40PX;
|
||||
padding: 0 12PX;
|
||||
border-radius: 999PX;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #e2e8f0;
|
||||
font-size: 13PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-live-bar-main > .as-div,
|
||||
.soc-taro-root.social-workspace .social-live-bar-main > view {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-sub-body,
|
||||
.soc-taro-root.social-workspace .social-sub-body {
|
||||
padding-top: 14PX !important;
|
||||
padding-bottom: 88PX !important;
|
||||
padding-inline: 16PX !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-sub-block {
|
||||
margin-bottom: 16PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-muted,
|
||||
.soc-taro-root.social-workspace .social-muted {
|
||||
color: #64748b !important;
|
||||
font-size: 12PX !important;
|
||||
}
|
||||
|
||||
/* —— 想见的人卡片(对齐 Next is-rich chip) —— */
|
||||
.soc-taro-root.social-weapp .social-people-filters,
|
||||
.soc-taro-root.social-home .social-people-filters,
|
||||
.soc-taro-root.social-workspace .social-people-filters {
|
||||
display: flex !important;
|
||||
flex-wrap: nowrap !important;
|
||||
gap: 8PX !important;
|
||||
margin-bottom: 14PX !important;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-filter,
|
||||
.soc-taro-root.social-home .social-people-filter,
|
||||
.soc-taro-root.social-workspace .social-people-filter {
|
||||
flex: 0 0 auto;
|
||||
min-height: 40PX !important;
|
||||
padding: 0 14PX !important;
|
||||
border-radius: 999PX !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.08) !important;
|
||||
background: rgba(255, 255, 255, 0.03) !important;
|
||||
color: #94a3b8 !important;
|
||||
font-size: 12PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-filter.is-on,
|
||||
.soc-taro-root.social-weapp .social-people-filter.active,
|
||||
.soc-taro-root.social-home .social-people-filter.is-on,
|
||||
.soc-taro-root.social-home .social-people-filter.active,
|
||||
.soc-taro-root.social-workspace .social-people-filter.is-on,
|
||||
.soc-taro-root.social-workspace .social-people-filter.active {
|
||||
border-color: rgba(78, 205, 196, 0.4) !important;
|
||||
background: rgba(78, 205, 196, 0.1) !important;
|
||||
color: #4ecdc4 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-grid,
|
||||
.soc-taro-root.social-home .social-people-grid,
|
||||
.soc-taro-root.social-workspace .social-people-grid {
|
||||
display: grid !important;
|
||||
grid-template-columns: 1fr !important;
|
||||
gap: 12PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip,
|
||||
.soc-taro-root.social-home .social-people-chip,
|
||||
.soc-taro-root.social-workspace .social-people-chip {
|
||||
position: relative !important;
|
||||
display: grid !important;
|
||||
grid-template-columns: 56PX 1fr !important;
|
||||
grid-template-rows: auto auto auto auto !important;
|
||||
column-gap: 12PX !important;
|
||||
row-gap: 4PX !important;
|
||||
align-items: start !important;
|
||||
padding: 16PX 44PX 16PX 14PX !important;
|
||||
border-radius: 18PX !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.1) !important;
|
||||
background: linear-gradient(160deg, rgba(24, 32, 48, 0.95), rgba(12, 16, 26, 0.92)) !important;
|
||||
box-shadow: 0 10PX 28PX rgba(0, 0, 0, 0.28) !important;
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
animation: none !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip-ava,
|
||||
.soc-taro-root.social-home .social-people-chip-ava,
|
||||
.soc-taro-root.social-workspace .social-people-chip-ava {
|
||||
grid-row: 1 / 3 !important;
|
||||
grid-column: 1 !important;
|
||||
width: 56PX !important;
|
||||
height: 56PX !important;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip .as-strong,
|
||||
.soc-taro-root.social-home .social-people-chip .as-strong,
|
||||
.soc-taro-root.social-workspace .social-people-chip .as-strong {
|
||||
grid-column: 2 !important;
|
||||
font-size: 15PX !important;
|
||||
font-weight: 750 !important;
|
||||
color: #f8fafc !important;
|
||||
line-height: 1.3 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip .connection-member-role,
|
||||
.soc-taro-root.social-home .social-people-chip .connection-member-role,
|
||||
.soc-taro-root.social-workspace .social-people-chip .connection-member-role {
|
||||
grid-column: 2 !important;
|
||||
font-size: 12PX !important;
|
||||
color: #94a3b8 !important;
|
||||
line-height: 1.35 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip > .as-em,
|
||||
.soc-taro-root.social-home .social-people-chip > .as-em,
|
||||
.soc-taro-root.social-workspace .social-people-chip > .as-em {
|
||||
grid-column: 1 / -1 !important;
|
||||
font-size: 12PX !important;
|
||||
font-style: normal !important;
|
||||
color: #64748b !important;
|
||||
margin-top: 2PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip-want,
|
||||
.soc-taro-root.social-home .social-people-chip-want,
|
||||
.soc-taro-root.social-workspace .social-people-chip-want {
|
||||
grid-column: 1 / -1 !important;
|
||||
display: block !important;
|
||||
margin-top: 2PX;
|
||||
padding: 8PX 10PX;
|
||||
border-radius: 12PX;
|
||||
background: rgba(78, 205, 196, 0.08);
|
||||
border: 1PX solid rgba(78, 205, 196, 0.16);
|
||||
color: #b7f0ea !important;
|
||||
font-size: 13PX !important;
|
||||
line-height: 1.45 !important;
|
||||
max-height: none !important;
|
||||
overflow: visible !important;
|
||||
-webkit-line-clamp: unset !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip-like,
|
||||
.soc-taro-root.social-home .social-people-chip-like,
|
||||
.soc-taro-root.social-workspace .social-people-chip-like {
|
||||
position: absolute !important;
|
||||
top: 10PX !important;
|
||||
right: 10PX !important;
|
||||
width: 36PX !important;
|
||||
height: 36PX !important;
|
||||
min-height: 36PX !important;
|
||||
border-radius: 999PX !important;
|
||||
border: 0 !important;
|
||||
background: rgba(255, 107, 107, 0.14) !important;
|
||||
color: #ff8f8f !important;
|
||||
font-size: 16PX !important;
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip.is-online .social-people-chip-ava::after,
|
||||
.soc-taro-root.social-home .social-people-chip.is-online .social-people-chip-ava::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 2PX;
|
||||
bottom: 2PX;
|
||||
width: 10PX;
|
||||
height: 10PX;
|
||||
border-radius: 50%;
|
||||
background: #34d399;
|
||||
border: 2PX solid #0c1018;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-bar,
|
||||
.soc-taro-root.social-home .social-people-bar {
|
||||
display: grid !important;
|
||||
grid-template-columns: auto 1fr !important;
|
||||
gap: 8PX 12PX !important;
|
||||
align-items: center !important;
|
||||
margin-bottom: 16PX !important;
|
||||
padding-bottom: 14PX !important;
|
||||
border-bottom: 1PX solid rgba(255, 255, 255, 0.06) !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-bar .btn,
|
||||
.soc-taro-root.social-home .social-people-bar .btn {
|
||||
grid-column: 1 / -1 !important;
|
||||
justify-self: start;
|
||||
min-height: 40PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-bar-avs,
|
||||
.soc-taro-root.social-home .social-people-bar-avs {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-hint,
|
||||
.soc-taro-root.social-home .social-people-hint {
|
||||
margin: 12PX 0 0 !important;
|
||||
font-size: 12PX !important;
|
||||
color: #64748b !important;
|
||||
}
|
||||
|
||||
/* chat */
|
||||
.soc-taro-root.social-weapp .social-chat-layout,
|
||||
.soc-taro-root.social-workspace .social-chat-layout {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 12PX !important;
|
||||
padding-bottom: 88PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-chat-sidebar,
|
||||
.soc-taro-root.social-workspace .social-chat-sidebar {
|
||||
display: flex !important;
|
||||
flex-direction: row !important;
|
||||
flex-wrap: nowrap !important;
|
||||
gap: 8PX !important;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-chat-channel,
|
||||
.soc-taro-root.social-workspace .social-chat-channel {
|
||||
flex: 0 0 auto;
|
||||
min-width: 140PX;
|
||||
padding: 10PX 12PX !important;
|
||||
border-radius: 14PX !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-chat-channel.is-on,
|
||||
.soc-taro-root.social-workspace .social-chat-channel.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.4);
|
||||
background: rgba(78, 205, 196, 0.1);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-chat-thread,
|
||||
.soc-taro-root.social-workspace .social-chat-thread {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10PX;
|
||||
min-height: 280PX;
|
||||
padding: 12PX;
|
||||
border-radius: 16PX;
|
||||
background: rgba(17, 24, 39, 0.7);
|
||||
border: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-chat-compose,
|
||||
.soc-taro-root.social-workspace .social-chat-compose {
|
||||
display: flex;
|
||||
gap: 8PX;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* date */
|
||||
.soc-taro-root.social-weapp.social-date-root .social-date-stage,
|
||||
.soc-taro-root.social-date-root .social-date-stage {
|
||||
padding: 12PX 16PX 96PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-deck,
|
||||
.soc-taro-root.social-date-root .social-date-deck {
|
||||
position: relative;
|
||||
min-height: 420PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-card-face,
|
||||
.soc-taro-root.social-date-root .social-date-card-face {
|
||||
border-radius: 22PX;
|
||||
overflow: hidden;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.1);
|
||||
background: #12141a;
|
||||
box-shadow: 0 18PX 40PX rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-card-body,
|
||||
.soc-taro-root.social-date-root .social-date-card-body {
|
||||
padding: 16PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-actions,
|
||||
.soc-taro-root.social-date-root .social-date-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 18PX;
|
||||
margin-top: 18PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-act,
|
||||
.soc-taro-root.social-date-root .social-date-act {
|
||||
width: 64PX;
|
||||
height: 64PX;
|
||||
border-radius: 999PX;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24PX;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-act.like,
|
||||
.soc-taro-root.social-date-root .social-date-act.like {
|
||||
background: rgba(255, 107, 107, 0.2);
|
||||
border-color: rgba(255, 107, 107, 0.45);
|
||||
color: #ff8f8f;
|
||||
}
|
||||
|
||||
/* roster form */
|
||||
.soc-taro-root.social-weapp .social-field-input,
|
||||
.soc-taro-root.social-workspace .social-field-input {
|
||||
width: 100%;
|
||||
min-height: 44PX;
|
||||
margin-top: 6PX;
|
||||
padding: 10PX 12PX;
|
||||
border-radius: 12PX;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #f1f5f9;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '游民大厅',
|
||||
navigationBarBackgroundColor: '#0a0e17',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0a0e17',
|
||||
disableScroll: true,
|
||||
})
|
||||
199
apps/miniprogram/h5/src/pages/social/chat/index.scss
Normal file
199
apps/miniprogram/h5/src/pages/social/chat/index.scss
Normal file
@ -0,0 +1,199 @@
|
||||
@import '../../../styles/page-rem.scss';
|
||||
|
||||
/* 全屏单大厅 IM:无频道条、无侧栏、无底栏 Dock */
|
||||
.im-root {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background: #0a0e17;
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
.im-status-row {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
padding: 0.45rem 0.75rem;
|
||||
border-bottom: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.im-pill {
|
||||
min-height: 1.6rem;
|
||||
padding: 0 0.65rem;
|
||||
border-radius: 999PX;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 0.7rem;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #94a3b8;
|
||||
}
|
||||
.im-pill.is-live {
|
||||
color: #042f2e;
|
||||
background: rgba(78, 205, 196, 0.85);
|
||||
}
|
||||
.im-pill.is-polling {
|
||||
color: #422006;
|
||||
background: rgba(245, 158, 11, 0.85);
|
||||
}
|
||||
.im-pill.is-offline {
|
||||
color: #fff;
|
||||
background: rgba(244, 63, 94, 0.75);
|
||||
}
|
||||
.im-pill.is-connecting {
|
||||
animation: im-pulse 1.2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes im-pulse {
|
||||
50% {
|
||||
opacity: 0.45;
|
||||
}
|
||||
}
|
||||
|
||||
.im-nick {
|
||||
min-width: 5rem;
|
||||
max-width: 8rem;
|
||||
min-height: 2.2rem;
|
||||
padding: 0 0.55rem;
|
||||
border-radius: 0.55rem;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #e2e8f0;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.im-thread {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
height: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.im-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.7rem;
|
||||
padding: 0.85rem 0.75rem 1.1rem;
|
||||
}
|
||||
|
||||
.im-row-wrap {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.im-empty {
|
||||
padding: 18vh 1.25rem 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
text-align: center;
|
||||
}
|
||||
.im-empty-title {
|
||||
font-size: 1.05rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.im-empty-desc {
|
||||
max-width: 16rem;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.5;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.im-bubble {
|
||||
max-width: 84%;
|
||||
padding: 0.7rem 0.85rem;
|
||||
border-radius: 1rem 1rem 1rem 0.35rem;
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
border: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.im-bubble.is-mine {
|
||||
margin-left: auto;
|
||||
border-radius: 1rem 1rem 0.35rem 1rem;
|
||||
background: rgba(78, 205, 196, 0.2);
|
||||
border-color: rgba(78, 205, 196, 0.35);
|
||||
}
|
||||
.im-bubble.is-fail {
|
||||
border-style: dashed;
|
||||
border-color: rgba(245, 158, 11, 0.6);
|
||||
}
|
||||
|
||||
.im-author {
|
||||
display: block;
|
||||
font-size: 0.7rem;
|
||||
color: #94a3b8;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.im-text {
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.55;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.im-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
margin-top: 0.3rem;
|
||||
font-size: 0.65rem;
|
||||
color: #64748b;
|
||||
}
|
||||
.im-fail {
|
||||
color: #fbbf24;
|
||||
}
|
||||
|
||||
.im-anchor {
|
||||
height: 1PX;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.im-composer {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0PX));
|
||||
border-top: 1PX solid rgba(255, 255, 255, 0.08);
|
||||
background: #080c14;
|
||||
}
|
||||
|
||||
.im-input {
|
||||
flex: 1;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 0.85rem;
|
||||
border-radius: 0.9rem;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #f8fafc;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.im-send {
|
||||
flex: 0 0 auto;
|
||||
min-width: 4.25rem;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 999PX;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: #64748b;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.im-send.is-on {
|
||||
background: linear-gradient(120deg, #f59e0b, #fbbf24);
|
||||
color: #1c1003;
|
||||
}
|
||||
.im-send.is-busy {
|
||||
opacity: 0.7;
|
||||
}
|
||||
200
apps/miniprogram/h5/src/pages/social/chat/index.tsx
Normal file
200
apps/miniprogram/h5/src/pages/social/chat/index.tsx
Normal file
@ -0,0 +1,200 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Input, ScrollView, Text } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { H5Box } from '@/components/H5Box'
|
||||
import { useSocialChat } from '@/hooks/useSocialChat'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import type { SocialChatMessage } from '@/services/socialApi'
|
||||
import '@/styles/social-next/entry'
|
||||
import '../_components/social-subpage.scss'
|
||||
import './index.scss'
|
||||
|
||||
/** 唯一总频道 */
|
||||
const LOBBY = 'general'
|
||||
|
||||
function statusLabel(s: string) {
|
||||
if (s === 'live') return '实时'
|
||||
if (s === 'polling') return '同步中'
|
||||
if (s === 'offline') return '离线'
|
||||
return '连接中'
|
||||
}
|
||||
|
||||
function formatTime(iso?: string) {
|
||||
if (!iso) return ''
|
||||
const d = new Date(iso)
|
||||
if (Number.isNaN(d.getTime())) return ''
|
||||
return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
function Bubble({
|
||||
m,
|
||||
onRetry,
|
||||
}: {
|
||||
m: SocialChatMessage
|
||||
onRetry: (id: string) => void
|
||||
}) {
|
||||
return (
|
||||
<H5Box
|
||||
className={`im-bubble${m.mine ? ' is-mine' : ''}${
|
||||
m.delivery === 'local' ? ' is-fail' : ''
|
||||
}`}
|
||||
onClick={() => {
|
||||
if (m.delivery === 'local') onRetry(m.id)
|
||||
}}
|
||||
>
|
||||
{!m.mine ? (
|
||||
<Text className='im-author'>{m.author || '游民'}</Text>
|
||||
) : null}
|
||||
<Text className='im-text'>{m.text}</Text>
|
||||
<H5Box className='im-meta'>
|
||||
<Text>{formatTime(m.at)}</Text>
|
||||
{m.delivery === 'pending' ? <Text>发送中</Text> : null}
|
||||
{m.delivery === 'local' ? (
|
||||
<Text className='im-fail'>未送达 · 点重试</Text>
|
||||
) : null}
|
||||
{m.mine && m.delivery === 'sent' ? <Text>已送达</Text> : null}
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
)
|
||||
}
|
||||
|
||||
function SocialChatLobby() {
|
||||
usePageShare({ title: 'nomadro · 游民大厅', path: '/pages/social/chat/index' })
|
||||
usePageTrack('social_chat')
|
||||
const {
|
||||
messages,
|
||||
draft,
|
||||
setDraft,
|
||||
nick,
|
||||
setNick,
|
||||
status,
|
||||
sending,
|
||||
send,
|
||||
retryLocal,
|
||||
} = useSocialChat(LOBBY)
|
||||
|
||||
const [scrollInto, setScrollInto] = useState('')
|
||||
const lastId = messages[messages.length - 1]?.id
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
const q = Taro.getCurrentInstance().router?.params || {}
|
||||
const raw = String(q.intro || '').trim()
|
||||
if (!raw) return
|
||||
setDraft((d) => d || decodeURIComponent(raw))
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}, [setDraft])
|
||||
|
||||
useEffect(() => {
|
||||
if (!lastId) return
|
||||
const t = setTimeout(() => setScrollInto(`msg_${lastId}`), 48)
|
||||
return () => clearTimeout(t)
|
||||
}, [lastId, messages.length])
|
||||
|
||||
const canSend = Boolean(draft.trim()) && !sending
|
||||
|
||||
const onSend = async () => {
|
||||
if (!canSend) return
|
||||
try {
|
||||
Taro.vibrateShort({ type: 'light' })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
const ok = await send()
|
||||
if (ok) setScrollInto('chat_bottom')
|
||||
}
|
||||
|
||||
return (
|
||||
<H5Box className='soc-taro-root im-root social-weapp' data-theme='dark'>
|
||||
<H5Box className='im-status-row'>
|
||||
<H5Box className={`im-pill is-${status}`}>
|
||||
<Text>{statusLabel(status)}</Text>
|
||||
</H5Box>
|
||||
<Input
|
||||
className='im-nick'
|
||||
value={nick}
|
||||
maxlength={24}
|
||||
placeholder='昵称'
|
||||
onInput={(e) => setNick(e.detail.value)}
|
||||
onBlur={() => {
|
||||
const n = nick.trim() || '游民'
|
||||
setNick(n)
|
||||
try {
|
||||
Taro.setStorageSync('nick', n)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</H5Box>
|
||||
|
||||
<ScrollView
|
||||
scrollY
|
||||
className='im-thread'
|
||||
scrollWithAnimation
|
||||
scrollIntoView={scrollInto}
|
||||
enhanced
|
||||
showScrollbar={false}
|
||||
>
|
||||
{messages.length === 0 ? (
|
||||
<H5Box className='im-empty'>
|
||||
<Text className='im-empty-title'>游民大厅</Text>
|
||||
<Text className='im-empty-desc'>
|
||||
{status === 'connecting'
|
||||
? '正在接入…'
|
||||
: status === 'offline'
|
||||
? '暂时连不上,发出的消息会先留在本机'
|
||||
: '还没有人说话,打个招呼吧'}
|
||||
</Text>
|
||||
</H5Box>
|
||||
) : (
|
||||
<H5Box className='im-list'>
|
||||
{messages.map((m) => (
|
||||
<H5Box key={m.id} id={`msg_${m.id}`} className='im-row-wrap'>
|
||||
<Bubble m={m} onRetry={(id) => void retryLocal(id)} />
|
||||
</H5Box>
|
||||
))}
|
||||
<H5Box id='chat_bottom' className='im-anchor' />
|
||||
</H5Box>
|
||||
)}
|
||||
</ScrollView>
|
||||
|
||||
<H5Box className='im-composer'>
|
||||
<Input
|
||||
className='im-input'
|
||||
value={draft}
|
||||
placeholder='说点什么…'
|
||||
confirmType='send'
|
||||
maxlength={2000}
|
||||
adjustPosition
|
||||
holdKeyboard
|
||||
onFocus={() => {
|
||||
setTimeout(() => setScrollInto('chat_bottom'), 120)
|
||||
}}
|
||||
onInput={(e) => setDraft(e.detail.value)}
|
||||
onConfirm={() => void onSend()}
|
||||
/>
|
||||
<H5Box
|
||||
className={`im-send${canSend ? ' is-on' : ''}${
|
||||
sending ? ' is-busy' : ''
|
||||
}`}
|
||||
onClick={() => void onSend()}
|
||||
>
|
||||
<Text>{sending ? '…' : '发送'}</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialChatPage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialChatLobby />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '认识一下',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
1
apps/miniprogram/h5/src/pages/social/date/index.scss
Normal file
1
apps/miniprogram/h5/src/pages/social/date/index.scss
Normal file
@ -0,0 +1 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
393
apps/miniprogram/h5/src/pages/social/date/index.tsx
Normal file
393
apps/miniprogram/h5/src/pages/social/date/index.tsx
Normal file
@ -0,0 +1,393 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { Text } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { H5Box } from '@/components/H5Box'
|
||||
import { MOCK_ROSTER, type SocialRosterMember } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import '@/styles/social-next/entry'
|
||||
import './index.scss'
|
||||
|
||||
type Filter = 'all' | 'f' | 'm'
|
||||
type Decision = 'like' | 'pass'
|
||||
|
||||
const THRESHOLD_DESKTOP = 110
|
||||
const THRESHOLD_MOBILE = 78
|
||||
|
||||
function shuffle<T>(list: T[]) {
|
||||
const next = [...list]
|
||||
for (let i = next.length - 1; i > 0; i -= 1) {
|
||||
const j = Math.floor(Math.random() * (i + 1))
|
||||
;[next[i], next[j]] = [next[j]!, next[i]!]
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
function DateCardFace({ member }: { member: SocialRosterMember }) {
|
||||
return (
|
||||
<H5Box className='social-date-card-face'>
|
||||
<H5Box
|
||||
className='social-date-card-cover'
|
||||
style={{
|
||||
backgroundImage: `linear-gradient(180deg, transparent 40%, #0a0a0ef5 90%), url(${member.avatar})`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
minHeight: 280,
|
||||
}}
|
||||
/>
|
||||
<H5Box className='social-date-card-body'>
|
||||
<Text style={{ fontWeight: 750, fontSize: 22 }}>
|
||||
{member.name}
|
||||
{member.online ? ' · 在线' : ''}
|
||||
</Text>
|
||||
<Text className='social-muted'>
|
||||
{member.title} · {member.city}
|
||||
</Text>
|
||||
<Text style={{ display: 'block', marginTop: 8, lineHeight: 1.5 }}>
|
||||
{member.bio}
|
||||
</Text>
|
||||
<Text style={{ display: 'block', marginTop: 6, opacity: 0.85 }}>
|
||||
{member.lookingFor}
|
||||
</Text>
|
||||
<H5Box className='social-date-card-tags' style={{ marginTop: 10 }}>
|
||||
{member.tags.map((t) => (
|
||||
<Text key={t}>{t}</Text>
|
||||
))}
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
)
|
||||
}
|
||||
|
||||
function SocialDate() {
|
||||
usePageShare({ title: 'nomadro · 认识一下', path: '/pages/social/date/index' })
|
||||
usePageTrack('social_date')
|
||||
const roster = MOCK_ROSTER
|
||||
const [filter, setFilter] = useState<Filter>('all')
|
||||
const [swipes, setSwipes] = useState<Record<string, Decision>>({})
|
||||
const [history, setHistory] = useState<{ id: string; decision: Decision }[]>(
|
||||
[],
|
||||
)
|
||||
const [order, setOrder] = useState<string[]>(() =>
|
||||
shuffle(roster.map((m) => m.id)),
|
||||
)
|
||||
const [drag, setDrag] = useState({ x: 0, y: 0, active: false })
|
||||
const [fly, setFly] = useState<null | { id: string; dir: Decision }>(null)
|
||||
const [likes, setLikes] = useState<Record<string, boolean>>({})
|
||||
const start = useRef({ x: 0, y: 0 })
|
||||
const dragging = useRef(false)
|
||||
const dragRef = useRef({ x: 0, y: 0 })
|
||||
const busy = useRef(false)
|
||||
|
||||
const deck = useMemo(() => {
|
||||
const ids = [
|
||||
...order,
|
||||
...roster.map((m) => m.id).filter((id) => !order.includes(id)),
|
||||
]
|
||||
return ids
|
||||
.map((id) => roster.find((m) => m.id === id)!)
|
||||
.filter((m) => m && !swipes[m.id])
|
||||
.filter((m) => filter === 'all' || m.gender === filter)
|
||||
}, [order, swipes, filter, roster])
|
||||
|
||||
const current = deck[0] || null
|
||||
const next = deck[1] || null
|
||||
const remaining = deck.length
|
||||
const totalForFilter = roster.filter(
|
||||
(m) => filter === 'all' || m.gender === filter,
|
||||
).length
|
||||
|
||||
const commit = useCallback(
|
||||
(member: SocialRosterMember, decision: Decision) => {
|
||||
if (busy.current || fly) return
|
||||
busy.current = true
|
||||
setFly({ id: member.id, dir: decision })
|
||||
setTimeout(() => {
|
||||
setSwipes((prev) => ({ ...prev, [member.id]: decision }))
|
||||
setHistory((prev) => [...prev, { id: member.id, decision }])
|
||||
if (decision === 'like') {
|
||||
setLikes((prev) => ({ ...prev, [member.id]: true }))
|
||||
Taro.showToast({ title: `想认识 ${member.name}`, icon: 'none' })
|
||||
} else {
|
||||
Taro.showToast({ title: '已跳过', icon: 'none' })
|
||||
}
|
||||
setFly(null)
|
||||
setDrag({ x: 0, y: 0, active: false })
|
||||
dragRef.current = { x: 0, y: 0 }
|
||||
busy.current = false
|
||||
}, 280)
|
||||
},
|
||||
[fly],
|
||||
)
|
||||
|
||||
const undo = useCallback(() => {
|
||||
if (busy.current || fly || !history.length) return
|
||||
const last = history[history.length - 1]!
|
||||
setHistory(history.slice(0, -1))
|
||||
setSwipes((prev) => {
|
||||
const nextStore = { ...prev }
|
||||
delete nextStore[last.id]
|
||||
return nextStore
|
||||
})
|
||||
if (last.decision === 'like') {
|
||||
setLikes((prev) => {
|
||||
const n = { ...prev }
|
||||
delete n[last.id]
|
||||
return n
|
||||
})
|
||||
}
|
||||
Taro.showToast({ title: '已撤销', icon: 'none' })
|
||||
}, [history, fly])
|
||||
|
||||
const onPointerDown = (event: any) => {
|
||||
if (!current || fly || busy.current) return
|
||||
const clientX = event.clientX ?? event.touches?.[0]?.clientX
|
||||
const clientY = event.clientY ?? event.touches?.[0]?.clientY
|
||||
if (clientX == null) return
|
||||
dragging.current = true
|
||||
start.current = { x: clientX, y: clientY || 0 }
|
||||
setDrag({ x: 0, y: 0, active: true })
|
||||
}
|
||||
|
||||
const onPointerMove = (event: any) => {
|
||||
if (!dragging.current || !current || fly) return
|
||||
const clientX = event.clientX ?? event.touches?.[0]?.clientX
|
||||
const clientY = event.clientY ?? event.touches?.[0]?.clientY
|
||||
if (clientX == null) return
|
||||
const nextDrag = {
|
||||
x: clientX - start.current.x,
|
||||
y: ((clientY || 0) - start.current.y) * 0.35,
|
||||
}
|
||||
dragRef.current = nextDrag
|
||||
setDrag({ ...nextDrag, active: true })
|
||||
}
|
||||
|
||||
const onPointerUp = () => {
|
||||
if (!dragging.current || !current || fly) return
|
||||
dragging.current = false
|
||||
const x = dragRef.current.x
|
||||
const threshold =
|
||||
process.env.TARO_ENV !== 'h5' ||
|
||||
(typeof window !== 'undefined' &&
|
||||
window.matchMedia('(max-width: 900px)').matches)
|
||||
? THRESHOLD_MOBILE
|
||||
: THRESHOLD_DESKTOP
|
||||
if (x > threshold) commit(current, 'like')
|
||||
else if (x < -threshold) commit(current, 'pass')
|
||||
else {
|
||||
setDrag({ x: 0, y: 0, active: false })
|
||||
dragRef.current = { x: 0, y: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
const resetDeck = () => {
|
||||
setSwipes({})
|
||||
setHistory([])
|
||||
setOrder(shuffle(roster.map((m) => m.id)))
|
||||
setDrag({ x: 0, y: 0, active: false })
|
||||
dragRef.current = { x: 0, y: 0 }
|
||||
setFly(null)
|
||||
setLikes({})
|
||||
busy.current = false
|
||||
Taro.showToast({ title: '已重新洗牌', icon: 'none' })
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined') return
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'ArrowRight' && current) {
|
||||
event.preventDefault()
|
||||
commit(current, 'like')
|
||||
} else if (event.key === 'ArrowLeft' && current) {
|
||||
event.preventDefault()
|
||||
commit(current, 'pass')
|
||||
} else if (event.key === 'Backspace') {
|
||||
event.preventDefault()
|
||||
undo()
|
||||
}
|
||||
}
|
||||
window.addEventListener('keydown', onKey)
|
||||
return () => window.removeEventListener('keydown', onKey)
|
||||
}, [current, commit, undo])
|
||||
|
||||
const rotate = drag.x / 18
|
||||
const stampThreshold =
|
||||
process.env.TARO_ENV !== 'h5' ||
|
||||
(typeof window !== 'undefined' &&
|
||||
window.matchMedia('(max-width: 900px)').matches)
|
||||
? THRESHOLD_MOBILE
|
||||
: THRESHOLD_DESKTOP
|
||||
const likeOpacity = Math.min(1, Math.max(0, drag.x / stampThreshold))
|
||||
const passOpacity = Math.min(1, Math.max(0, -drag.x / stampThreshold))
|
||||
const likedCount = Object.keys(likes).length
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5Box
|
||||
className='soc-taro-root social-root social-live-root social-skin social-date-root social-weapp'
|
||||
data-theme='dark'
|
||||
>
|
||||
<H5Box className='social-live-bar social-date-bar'>
|
||||
<H5Box className='social-live-bar-main'>
|
||||
<H5Box className='social-nav-back' onClick={() => goPage('/pages/social/index')}>
|
||||
<Text>← 首页</Text>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text style={{ fontWeight: 700 }}>认识一下</Text>
|
||||
<Text className='social-muted'>
|
||||
左滑划走 · 右滑想认识
|
||||
{totalForFilter ? ` · 还剩 ${remaining}/${totalForFilter}` : ''}
|
||||
</Text>
|
||||
</H5Box>
|
||||
<Text className='social-demo-badge'>示例介绍,方便先逛逛</Text>
|
||||
</H5Box>
|
||||
<H5Box className='social-date-bar-tools'>
|
||||
<H5Box className='social-filters' aria-label='筛选'>
|
||||
{(
|
||||
[
|
||||
['all', '全部'],
|
||||
['f', '女生'],
|
||||
['m', '男生'],
|
||||
] as const
|
||||
).map(([id, label]) => (
|
||||
<H5Box
|
||||
key={id}
|
||||
className={filter === id ? 'active' : ''}
|
||||
onClick={() => setFilter(id)}
|
||||
>
|
||||
<Text>{label}</Text>
|
||||
</H5Box>
|
||||
))}
|
||||
</H5Box>
|
||||
{likedCount > 0 ? (
|
||||
<H5Box className='social-btn'>
|
||||
<Text>♥ 想认识 {likedCount}</Text>
|
||||
</H5Box>
|
||||
) : null}
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
|
||||
<H5Box className='social-date-stage'>
|
||||
{totalForFilter > 0 ? (
|
||||
<H5Box className='social-date-progress' aria-label={`还剩 ${remaining} 人`}>
|
||||
<H5Box
|
||||
style={{
|
||||
width: `${Math.max(4, (remaining / totalForFilter) * 100)}%`,
|
||||
height: 4,
|
||||
borderRadius: 99,
|
||||
background: '#4ecdc4',
|
||||
}}
|
||||
/>
|
||||
</H5Box>
|
||||
) : null}
|
||||
|
||||
<H5Box className='social-date-deck' style={{ touchAction: 'none' }}>
|
||||
{!current ? (
|
||||
<H5Box className='social-date-empty'>
|
||||
<Text style={{ fontSize: 36 }}>✨</Text>
|
||||
<Text style={{ fontWeight: 700 }}>这批看完了</Text>
|
||||
<Text className='social-muted'>
|
||||
想认识的人会先记在你这边。可以再看一轮,或去聊天室打个招呼。
|
||||
</Text>
|
||||
<H5Box className='social-btn primary' onClick={resetDeck}>
|
||||
<Text>再来一轮</Text>
|
||||
</H5Box>
|
||||
<H5Box
|
||||
className='social-btn'
|
||||
onClick={() => goPage('/pages/social/chat/index')}
|
||||
>
|
||||
<Text>先去群组聊聊</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
) : null}
|
||||
|
||||
{next ? (
|
||||
<H5Box className='social-date-card is-next' aria-hidden>
|
||||
<DateCardFace member={next} />
|
||||
</H5Box>
|
||||
) : null}
|
||||
|
||||
{current ? (
|
||||
<H5Box
|
||||
className={`social-date-card is-top${drag.active ? ' is-dragging' : ''}${fly ? ` is-fly-${fly.dir}` : ''}`}
|
||||
style={
|
||||
fly
|
||||
? undefined
|
||||
: {
|
||||
transform: `translate3d(${drag.x}px, ${drag.y}px, 0) rotate(${rotate}deg)`,
|
||||
}
|
||||
}
|
||||
onClick={undefined}
|
||||
>
|
||||
{/* pointer events via native listeners on H5 */}
|
||||
<H5Box
|
||||
className='social-date-card-hit'
|
||||
style={{ position: 'absolute', inset: 0, zIndex: 2 }}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
onPointerCancel={() => {
|
||||
dragging.current = false
|
||||
dragRef.current = { x: 0, y: 0 }
|
||||
setDrag({ x: 0, y: 0, active: false })
|
||||
}}
|
||||
/>
|
||||
<Text
|
||||
className='social-date-stamp like'
|
||||
style={{ opacity: fly?.dir === 'like' ? 1 : likeOpacity }}
|
||||
>
|
||||
想认识
|
||||
</Text>
|
||||
<Text
|
||||
className='social-date-stamp pass'
|
||||
style={{ opacity: fly?.dir === 'pass' ? 1 : passOpacity }}
|
||||
>
|
||||
划走
|
||||
</Text>
|
||||
<DateCardFace member={current} />
|
||||
</H5Box>
|
||||
) : null}
|
||||
</H5Box>
|
||||
|
||||
<H5Box className='social-date-hint is-alive'>
|
||||
<Text className='social-date-hint-side pass'>← 划走</Text>
|
||||
<Text>拖卡片左右滑 · 或点下面按钮</Text>
|
||||
<Text className='social-date-hint-side like'>想认识 →</Text>
|
||||
</H5Box>
|
||||
|
||||
<H5Box className='social-date-actions is-alive'>
|
||||
<H5Box
|
||||
className='social-date-act pass'
|
||||
onClick={() => current && commit(current, 'pass')}
|
||||
>
|
||||
<Text>✕</Text>
|
||||
</H5Box>
|
||||
<H5Box className='social-date-act undo' onClick={undo}>
|
||||
<Text>↩</Text>
|
||||
</H5Box>
|
||||
<H5Box
|
||||
className='social-date-act like'
|
||||
onClick={() => current && commit(current, 'like')}
|
||||
>
|
||||
<Text>♥</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
|
||||
<SocialDock />
|
||||
</H5Box>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialDatePage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialDate />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
7
apps/miniprogram/h5/src/pages/social/index.config.ts
Normal file
7
apps/miniprogram/h5/src/pages/social/index.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '游民社区',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
navigationStyle: 'custom',
|
||||
})
|
||||
7
apps/miniprogram/h5/src/pages/social/index.scss
Normal file
7
apps/miniprogram/h5/src/pages/social/index.scss
Normal file
@ -0,0 +1,7 @@
|
||||
@import '../../styles/page-rem.scss';
|
||||
@import './_components/social-subpage.scss';
|
||||
|
||||
/* 页面级微调:主体视觉在 social-next/weapp-bridge */
|
||||
.soc-taro-root.social-weapp .social-mobile-dock {
|
||||
padding-bottom: calc(8PX + env(safe-area-inset-bottom, 0PX));
|
||||
}
|
||||
701
apps/miniprogram/h5/src/pages/social/index.tsx
Normal file
701
apps/miniprogram/h5/src/pages/social/index.tsx
Normal file
@ -0,0 +1,701 @@
|
||||
import { useEffect, useMemo, useState, type CSSProperties } from 'react'
|
||||
import Taro, { usePageScroll } from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import {
|
||||
DEFAULT_PROMO,
|
||||
MOCK_ROSTER,
|
||||
PATH_CHIPS,
|
||||
ROLE_EMOJI,
|
||||
SEED_EBOOKS,
|
||||
SEED_GIGS,
|
||||
SEED_MEETUPS,
|
||||
SEED_VIDEOS,
|
||||
SOCIAL_CITIES,
|
||||
SOCIAL_COPY,
|
||||
TEAM_KIND_LABEL,
|
||||
} from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import {
|
||||
ConnectionHero,
|
||||
ConnectionWays,
|
||||
} from './_components/ConnectionHero'
|
||||
import { AttractiveRoster } from './_components/AttractiveRoster'
|
||||
import { SocialDock } from './_components/SocialDock'
|
||||
import { SocialAvatar } from './_components/SocialAvatar'
|
||||
import { FxBelt, SocialExperience } from './_components/SocialExperience'
|
||||
import { H5El } from './_components/H5El'
|
||||
import { JoinPaySheet } from './_components/JoinPaySheet'
|
||||
import '@/styles/social-next/entry'
|
||||
import './index.scss'
|
||||
|
||||
const isH5 = process.env.TARO_ENV === 'h5'
|
||||
|
||||
function scrollToId(id: string) {
|
||||
if (!isH5) {
|
||||
// 微信:用选择器滚到锚点(无 DOM scrollIntoView)
|
||||
const query = Taro.createSelectorQuery()
|
||||
query.select(`#${id}`).boundingClientRect()
|
||||
query.selectViewport().scrollOffset()
|
||||
query.exec((res) => {
|
||||
const rect = res?.[0] as { top?: number } | undefined
|
||||
const offset = res?.[1] as { scrollTop?: number } | undefined
|
||||
if (!rect || typeof rect.top !== 'number') return
|
||||
const scrollTop = Math.max(0, (offset?.scrollTop || 0) + rect.top - 72)
|
||||
Taro.pageScrollTo({ scrollTop, duration: 300 })
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof document === 'undefined') return
|
||||
const el = document.getElementById(id)
|
||||
if (!el) return
|
||||
const page = document.querySelector('.taro_page') as HTMLElement | null
|
||||
if (page) {
|
||||
const top =
|
||||
el.getBoundingClientRect().top - page.getBoundingClientRect().top + page.scrollTop - 72
|
||||
page.scrollTo({ top, behavior: 'smooth' })
|
||||
return
|
||||
}
|
||||
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}
|
||||
|
||||
function SocialHome() {
|
||||
usePageShare({ title: 'nomadro · 游民社区', path: '/pages/social/index' })
|
||||
usePageTrack('social_home')
|
||||
const [scrolled, setScrolled] = useState(false)
|
||||
const [activeSection, setActiveSection] = useState('people')
|
||||
const [joinOpen, setJoinOpen] = useState(false)
|
||||
const copy = SOCIAL_COPY
|
||||
const datePreview = useMemo(
|
||||
() => MOCK_ROSTER.filter((m) => m.online).slice(0, 3),
|
||||
[],
|
||||
)
|
||||
const meetups = SEED_MEETUPS
|
||||
const gigs = SEED_GIGS
|
||||
const cities = SOCIAL_CITIES.filter((c) => c.hot).slice(0, 8)
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
const rootStyle = useMemo(
|
||||
() =>
|
||||
({
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
}) as CSSProperties,
|
||||
[safe],
|
||||
)
|
||||
|
||||
const onJoin = () => {
|
||||
// 加群收费(虚拟支付)≠ VIP / community 付费体系
|
||||
setJoinOpen(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
const q = Taro.getCurrentInstance()?.router?.params || {}
|
||||
if (String(q.join || '') === '1') setJoinOpen(true)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isH5 || typeof document === 'undefined') return
|
||||
const html = document.documentElement
|
||||
html.setAttribute('data-theme', 'dark')
|
||||
html.setAttribute('data-social-skin', '1')
|
||||
html.classList.add('dark')
|
||||
document.body.classList.add('social-body')
|
||||
return () => {
|
||||
document.body.classList.remove('social-body')
|
||||
}
|
||||
}, [])
|
||||
|
||||
// 微信:进页强制回顶,避免 sticky path + 页脚看起来像「整页只有链接列表」
|
||||
useEffect(() => {
|
||||
if (isH5) return
|
||||
Taro.pageScrollTo({ scrollTop: 0, duration: 0 })
|
||||
}, [])
|
||||
|
||||
usePageScroll(({ scrollTop }) => {
|
||||
if (!isH5) setScrolled(scrollTop > 24)
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!isH5 || typeof window === 'undefined') return
|
||||
const scroller =
|
||||
(document.querySelector('.taro_page') as HTMLElement | null) ||
|
||||
document.scrollingElement ||
|
||||
document.documentElement
|
||||
const onScroll = () => {
|
||||
const y =
|
||||
scroller === document.scrollingElement || scroller === document.documentElement
|
||||
? window.scrollY || document.documentElement.scrollTop
|
||||
: (scroller as HTMLElement).scrollTop
|
||||
setScrolled(y > 24)
|
||||
}
|
||||
onScroll()
|
||||
scroller.addEventListener('scroll', onScroll, { passive: true })
|
||||
window.addEventListener('scroll', onScroll, { passive: true })
|
||||
return () => {
|
||||
scroller.removeEventListener('scroll', onScroll)
|
||||
window.removeEventListener('scroll', onScroll)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isH5 || typeof document === 'undefined') return
|
||||
const root = document.querySelector('.social-home')
|
||||
if (!root) return
|
||||
root.querySelectorAll('.reveal').forEach((el) => el.classList.add('visible'))
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) setActiveSection(entry.target.id)
|
||||
})
|
||||
},
|
||||
{ rootMargin: '-25% 0px -55% 0px', threshold: 0 },
|
||||
)
|
||||
root.querySelectorAll('section[id]:not(#hero)').forEach((section) => observer.observe(section))
|
||||
return () => observer.disconnect()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className={`soc-taro-root community-root social-skin home-flow social-flow social-fx social-home social-root${isH5 ? '' : ' social-weapp'}`}
|
||||
data-theme='dark'
|
||||
style={rootStyle}
|
||||
>
|
||||
<H5El className='social-fx-orbs' aria-hidden>
|
||||
<H5El as='i' className='social-fx-orb o1' />
|
||||
<H5El as='i' className='social-fx-orb o2' />
|
||||
<H5El as='i' className='social-fx-orb o3' />
|
||||
</H5El>
|
||||
|
||||
<H5El as='nav' className={`navbar${scrolled ? ' scrolled' : ''}`} aria-label='游民社区'>
|
||||
<H5El className='nav-container'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='nav-logo'
|
||||
href='#home'
|
||||
onClick={() => goPage('/pages/home/index')}
|
||||
>
|
||||
<H5El as='span' className='logo-icon' aria-hidden>
|
||||
🌐
|
||||
</H5El>
|
||||
<H5El as='span'>游民社区</H5El>
|
||||
</H5El>
|
||||
<H5El className='nav-actions'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-btn coral social-nav-join'
|
||||
onClick={onJoin}
|
||||
>
|
||||
加入社区
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El as='main' id='social-main' className='social-main'>
|
||||
<ConnectionHero onJoin={onJoin} promoUrl={DEFAULT_PROMO} copy={copy} />
|
||||
<ConnectionWays copy={copy} />
|
||||
|
||||
<H5El as='nav' className='social-path' aria-label='本页导航'>
|
||||
<H5El className='container'>
|
||||
<H5El className='social-path-track reveal visible'>
|
||||
{PATH_CHIPS.map((p) => (
|
||||
<H5El
|
||||
as='a'
|
||||
key={p.href}
|
||||
href={p.href}
|
||||
className='social-path-link'
|
||||
aria-current={
|
||||
!p.page && activeSection === p.href.slice(1) ? 'location' : undefined
|
||||
}
|
||||
onClick={() => {
|
||||
if (p.page === 'chat') goPage(p.href)
|
||||
else scrollToId(p.href.slice(1))
|
||||
}}
|
||||
>
|
||||
<H5El as='span' className='social-path-emoji' aria-hidden>
|
||||
{p.emoji}
|
||||
</H5El>
|
||||
{p.label}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<AttractiveRoster onJoin={onJoin} />
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<H5El
|
||||
as='section'
|
||||
className='section section-compact social-section-alt'
|
||||
id='date'
|
||||
aria-label='认识一下'
|
||||
>
|
||||
<H5El className='container'>
|
||||
<H5El className='social-date-hero reveal visible is-alive'>
|
||||
<H5El className='social-date-hero-copy'>
|
||||
<H5El as='span' className='section-tag'>
|
||||
<H5El as='span'>认识一下</H5El>
|
||||
<H5El as='span'>左右滑</H5El>
|
||||
</H5El>
|
||||
<H5El as='h2'>
|
||||
<H5El as='span' className='social-title-emoji' aria-hidden>
|
||||
💕
|
||||
</H5El>
|
||||
一张一张认识新朋友
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
像翻相册一样:不感兴趣就划走,想认识就留下。记在你这边,之后再决定要不要打招呼。
|
||||
</H5El>
|
||||
<H5El as='ul' className='social-date-hero-steps'>
|
||||
<H5El as='li'>
|
||||
<H5El as='em'>←</H5El> 划走
|
||||
</H5El>
|
||||
<H5El as='li'>
|
||||
<H5El as='em'>→</H5El> 想认识
|
||||
</H5El>
|
||||
<H5El as='li'>
|
||||
<H5El as='em'>♥</H5El> 稍后打招呼
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-date-stage-acts'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-primary'
|
||||
href='#date-page'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
开始认识 ↗
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-ghost'
|
||||
href='#people'
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
>
|
||||
先浏览大家
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
href='#date-page'
|
||||
className='social-date-hero-deck'
|
||||
aria-label='开始认识'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
{datePreview.map((m, i) => (
|
||||
<H5El
|
||||
key={m.id}
|
||||
className={`social-date-hero-card social-date-hero-card-${i}`}
|
||||
style={{
|
||||
['--i' as string]: i,
|
||||
backgroundImage: `linear-gradient(180deg, transparent 35%, #0a0a0ef2 88%), url(${m.avatar})`,
|
||||
}}
|
||||
>
|
||||
{m.online ? (
|
||||
<H5El as='span' className='social-date-hero-online'>
|
||||
在线
|
||||
</H5El>
|
||||
) : null}
|
||||
<H5El className='social-date-hero-meta'>
|
||||
<H5El as='strong'>
|
||||
{m.name}
|
||||
<H5El as='small'>{m.title}</H5El>
|
||||
</H5El>
|
||||
<H5El as='em'>{m.city.split('·')[0]?.trim()}</H5El>
|
||||
<H5El as='p'>{m.lookingFor}</H5El>
|
||||
<H5El className='social-date-card-tags'>
|
||||
{m.tags.slice(0, 2).map((t) => (
|
||||
<H5El as='span' key={t}>
|
||||
{t}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
<H5El as='span' className='social-date-hero-cta'>
|
||||
♥ 点这里开始滑
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<H5El
|
||||
as='section'
|
||||
className='section section-compact social-section-alt'
|
||||
id='meetup'
|
||||
aria-label='开视频聊聊'
|
||||
>
|
||||
<H5El className='container'>
|
||||
<H5El className='section-header reveal visible'>
|
||||
<H5El as='span' className='section-tag'>
|
||||
<H5El as='span'>聊天群组</H5El>
|
||||
<H5El as='span'>语音 · 视频</H5El>
|
||||
</H5El>
|
||||
<H5El as='h2'>
|
||||
<H5El as='span' className='social-title-emoji' aria-hidden>
|
||||
📡
|
||||
</H5El>
|
||||
{copy.socialOnlineTitle}
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
先进聊天群组热热身,再开语音或视频见面。「想参加」会先记在你这边。
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-panel-grid social-panel-grid-2'>
|
||||
{meetups.map((m, i) => (
|
||||
<H5El
|
||||
as='article'
|
||||
key={m.id}
|
||||
className={`social-panel social-panel-fx reveal visible${i === 0 ? ' is-accent' : ''}`}
|
||||
style={{ ['--stagger' as string]: `${i * 80}ms` }}
|
||||
>
|
||||
<H5El className='connection-meetup-art is-live' aria-hidden>
|
||||
<H5El as='span' className='connection-meetup-number'>
|
||||
0{i + 1}
|
||||
</H5El>
|
||||
<H5El className='connection-audio-bars'>
|
||||
{Array.from({ length: 14 }, (_, n) => (
|
||||
<H5El
|
||||
as='i'
|
||||
key={n}
|
||||
style={{
|
||||
height: `${12 + ((n * 17 + i * 13) % 48)}px`,
|
||||
animationDelay: `${n * -0.15}s`,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-video-grid'>
|
||||
{MOCK_ROSTER.slice(i, i + 4).map((p) => (
|
||||
<H5El as='span' key={p.id} className='social-video-tile'>
|
||||
<SocialAvatar src={p.avatar} size={36} />
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El as='span'>📡</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-panel-meta'>
|
||||
<H5El as='span'>
|
||||
{m.city === 'Online' ? '群组 · 语音视频' : m.city}
|
||||
</H5El>
|
||||
<H5El as='time'>
|
||||
{m.date} · {m.time}
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-meetup-faces' aria-hidden>
|
||||
{MOCK_ROSTER.slice(i + 1, i + 5).map((p) => (
|
||||
<SocialAvatar key={p.id} src={p.avatar} size={24} />
|
||||
))}
|
||||
<H5El as='em'>+{6 + i} 想参加</H5El>
|
||||
</H5El>
|
||||
<H5El as='h3'>{m.title}</H5El>
|
||||
<H5El as='p'>群里打个招呼 → 开麦 / 开视频 → 认识新朋友</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-primary btn-sm'
|
||||
href='#chat'
|
||||
onClick={() =>
|
||||
goPage(
|
||||
`/pages/social/meetup-live/index?id=${encodeURIComponent(m.id)}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
进入聊聊 ↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-section-actions reveal visible'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-ghost'
|
||||
href='#chat'
|
||||
onClick={() => goPage('/pages/social/chat/index')}
|
||||
>
|
||||
文字群聊
|
||||
</H5El>
|
||||
<H5El as='button' type='button' className='btn btn-ghost' onClick={onJoin}>
|
||||
加入社区
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<H5El as='section' className='section section-compact' id='cities' aria-label='同城见一面'>
|
||||
<H5El className='container'>
|
||||
<H5El className='section-header reveal visible'>
|
||||
<H5El as='span' className='section-tag'>
|
||||
<H5El as='span'>挑一座城</H5El>
|
||||
<H5El as='span'>再出来见面</H5El>
|
||||
</H5El>
|
||||
<H5El as='h2'>
|
||||
<H5El as='span' className='social-title-emoji' aria-hidden>
|
||||
🌆
|
||||
</H5El>
|
||||
{copy.socialOfflineTitle}
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
认识了、聊过之后,出来见一面会更自然。先挑一座城市,再找适合见面的咖啡馆。
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-panel-grid social-panel-grid-3'>
|
||||
{cities.map((c, i) => (
|
||||
<H5El
|
||||
as='a'
|
||||
key={c.id}
|
||||
href='#cities'
|
||||
className='social-panel social-panel-fx reveal visible is-clickable'
|
||||
style={{ ['--stagger' as string]: `${i * 50}ms` }}
|
||||
onClick={() => goPage('/pages/social/people/index?mode=cafe')}
|
||||
>
|
||||
<H5El as='span' style={{ fontSize: 28 }}>
|
||||
{c.emoji}
|
||||
</H5El>
|
||||
<H5El as='h3'>{c.name}</H5El>
|
||||
<H5El as='p'>{c.vibe}</H5El>
|
||||
<H5El as='small'>
|
||||
{c.members} 人 · {c.costHint}
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-section-actions reveal visible'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-primary'
|
||||
href='#cities'
|
||||
onClick={() => goPage('/pages/social/people/index?mode=cafe')}
|
||||
>
|
||||
看看咖啡馆
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-ghost'
|
||||
href='#people'
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
>
|
||||
找同城的人
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<FxBelt />
|
||||
|
||||
<H5El
|
||||
as='section'
|
||||
className='section section-compact social-section-alt'
|
||||
id='team'
|
||||
aria-label='一起做点事'
|
||||
>
|
||||
<H5El className='container'>
|
||||
<H5El className='section-header reveal visible'>
|
||||
<H5El as='span' className='section-tag'>
|
||||
<H5El as='span'>找搭子</H5El>
|
||||
<H5El as='span'>共创</H5El>
|
||||
</H5El>
|
||||
<H5El as='h2'>
|
||||
<H5El as='span' className='social-title-emoji' aria-hidden>
|
||||
🚀
|
||||
</H5El>
|
||||
{copy.socialTeamTitle}
|
||||
</H5El>
|
||||
<H5El as='p'>
|
||||
有人在找帮手;也有人一起写小册、拍视频做共创。点卡片看看详情,合适再表达兴趣。
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-together-tabs reveal visible' role='tablist'>
|
||||
<H5El as='a' href='#team' className='is-on' role='tab' aria-selected='true'>
|
||||
找搭子
|
||||
</H5El>
|
||||
<H5El as='a' href='#team' role='tab' aria-selected='false'>
|
||||
共创
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-panel-grid social-panel-grid-3'>
|
||||
{gigs.slice(0, 3).map((g, i) => (
|
||||
<H5El
|
||||
as='a'
|
||||
key={g.id}
|
||||
href='#team'
|
||||
className='social-panel social-panel-fx connection-team reveal visible is-clickable'
|
||||
style={{ ['--stagger' as string]: `${i * 60}ms` }}
|
||||
onClick={() =>
|
||||
goPage(`/pages/social/team/index?gig=${encodeURIComponent(g.id)}`)
|
||||
}
|
||||
>
|
||||
<H5El className='social-panel-ico' aria-hidden>
|
||||
{ROLE_EMOJI[g.kind || 'parttime'] || '📝'}
|
||||
</H5El>
|
||||
<H5El className='social-panel-meta'>
|
||||
<H5El as='span'>{TEAM_KIND_LABEL[g.kind || 'parttime']}</H5El>
|
||||
<H5El as='span'>{g.remote ? '线上也能做' : '可以见面做'}</H5El>
|
||||
</H5El>
|
||||
<H5El as='h3'>{g.title}</H5El>
|
||||
<H5El as='p'>{g.pay}</H5El>
|
||||
<H5El className='social-panel-foot'>
|
||||
{(g.tags || []).slice(0, 3).map((t) => (
|
||||
<H5El as='span' key={t}>
|
||||
{t}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-ugc-row reveal visible'>
|
||||
{SEED_EBOOKS.slice(0, 2).map((book) => (
|
||||
<H5El
|
||||
as='a'
|
||||
key={book.id}
|
||||
href='#ebook'
|
||||
className='social-ugc-card'
|
||||
onClick={() => goPage('/pages/book/index')}
|
||||
>
|
||||
<H5El as='span' className='social-ugc-ico' aria-hidden>
|
||||
📖
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='em'>共创 · 小册</H5El>
|
||||
<H5El as='strong'>{book.title}</H5El>
|
||||
<H5El as='p'>{book.blurb}</H5El>
|
||||
</H5El>
|
||||
<H5El as='span'>↗</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
{SEED_VIDEOS.slice(0, 2).map((vid) => (
|
||||
<H5El as='a' key={vid.id} href='#videos' className='social-ugc-card is-video'>
|
||||
<H5El as='span' className='social-ugc-ico' aria-hidden>
|
||||
{vid.coverEmoji}
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='em'>共创 · 视频</H5El>
|
||||
<H5El as='strong'>{vid.title}</H5El>
|
||||
<H5El as='p'>
|
||||
{vid.city} · {vid.minutes} 分钟
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El as='span'>↗</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-section-actions reveal visible'>
|
||||
<H5El
|
||||
as='a'
|
||||
className='btn btn-ghost'
|
||||
href='#team'
|
||||
onClick={() => goPage('/pages/social/team/index')}
|
||||
>
|
||||
更多机会
|
||||
</H5El>
|
||||
<H5El as='button' type='button' className='btn btn-ghost' onClick={onJoin}>
|
||||
加入社区
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El as='section' className='connection-invite container' aria-label='加入社区'>
|
||||
<H5El className='connection-invite-orbit' aria-hidden>
|
||||
<H5El as='span' />
|
||||
<H5El as='span' />
|
||||
<H5El as='span' style={{ fontSize: 52 }}>
|
||||
✨
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='span' className='connection-eyebrow'>
|
||||
加入社区
|
||||
</H5El>
|
||||
<H5El as='h2'>{copy.socialInviteTitle}</H5El>
|
||||
<H5El as='p'>{copy.socialInviteLead}</H5El>
|
||||
</H5El>
|
||||
<H5El as='button' type='button' className='btn connection-join' onClick={onJoin}>
|
||||
加入游民社区 ↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El as='footer' className='footer'>
|
||||
<H5El className='container'>
|
||||
<H5El className='footer-grid footer-grid-rings'>
|
||||
<H5El className='footer-brand'>
|
||||
<H5El as='strong'>nomadro · 游民社区</H5El>
|
||||
<H5El as='p'>认识同频的人 · 开视频聊聊 · 出来见一面 · 一起做点事</H5El>
|
||||
</H5El>
|
||||
<H5El className='footer-links'>
|
||||
<H5El as='h4'>认识人</H5El>
|
||||
<H5El as='a' href='#people' onClick={() => goPage('/pages/social/people/index')}>
|
||||
想见的人
|
||||
</H5El>
|
||||
<H5El as='a' href='#date' onClick={() => goPage('/pages/social/date/index')}>
|
||||
认识一下
|
||||
</H5El>
|
||||
<H5El as='a' href='#chat' onClick={() => goPage('/pages/social/chat/index')}>
|
||||
大家聊天
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='footer-links'>
|
||||
<H5El as='h4'>见面 · 做事</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
href='#cities'
|
||||
onClick={() => goPage('/pages/social/people/index?mode=cafe')}
|
||||
>
|
||||
找城市见面
|
||||
</H5El>
|
||||
<H5El
|
||||
as='a'
|
||||
href='#team'
|
||||
onClick={() => goPage('/pages/social/team/index')}
|
||||
>
|
||||
找搭子做事
|
||||
</H5El>
|
||||
<H5El as='a' href='#home' onClick={() => goPage('/pages/home/index')}>
|
||||
门户首页
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='footer-bottom'>
|
||||
<H5El as='p'>© {new Date().getFullYear()} nomadro · 游民社区</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<JoinPaySheet open={joinOpen} onClose={() => setJoinOpen(false)} />
|
||||
<SocialDock />
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialIndexPage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialHome />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '语音视频',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
disableScroll: true,
|
||||
})
|
||||
120
apps/miniprogram/h5/src/pages/social/meetup-live/index.scss
Normal file
120
apps/miniprogram/h5/src/pages/social/meetup-live/index.scss
Normal file
@ -0,0 +1,120 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
|
||||
.social-live-gate {
|
||||
padding: 1.25rem 1rem 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.85rem;
|
||||
}
|
||||
|
||||
.social-live-nick-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.social-live-native-stage {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
overflow: visible !important;
|
||||
background: transparent;
|
||||
padding: 0 0 1rem;
|
||||
}
|
||||
|
||||
.social-meetup-live .social-live-video,
|
||||
.social-meetup-live .social-live-native-stage,
|
||||
.social-meetup-live .social-live-stage {
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-live-self {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-live-peers {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8PX;
|
||||
margin-top: 8PX;
|
||||
}
|
||||
|
||||
.social-live-tile {
|
||||
position: relative;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-live-pusher,
|
||||
.social-live-player {
|
||||
background: #1a1a1f;
|
||||
overflow: visible !important;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
.social-live-pusher-badge {
|
||||
position: absolute;
|
||||
left: 8PX;
|
||||
bottom: 8PX;
|
||||
padding: 4PX 10PX;
|
||||
font-size: 12PX;
|
||||
color: #fff;
|
||||
background-color: rgba(0, 0, 0, 0.55);
|
||||
border-radius: 999PX;
|
||||
}
|
||||
|
||||
.social-live-tile-label {
|
||||
margin-top: 4PX;
|
||||
text-align: center;
|
||||
font-size: 12PX;
|
||||
color: #cbd5e1;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.social-live-tools-cover {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8PX;
|
||||
padding: 8PX 4PX;
|
||||
}
|
||||
|
||||
.social-live-tool-btn {
|
||||
min-width: 72PX;
|
||||
min-height: 40PX;
|
||||
line-height: 40PX;
|
||||
padding: 0 12PX;
|
||||
text-align: center;
|
||||
font-size: 13PX;
|
||||
color: #e2e8f0;
|
||||
background-color: rgba(20, 28, 40, 0.92);
|
||||
border: 1PX solid rgba(255, 255, 255, 0.14);
|
||||
border-radius: 999PX;
|
||||
}
|
||||
|
||||
.social-live-tool-btn.is-leave {
|
||||
color: #082b2b;
|
||||
background-color: #4ecdc4;
|
||||
border-color: #4ecdc4;
|
||||
}
|
||||
|
||||
.social-live-hint {
|
||||
padding: 0 0.5rem 1rem;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.45;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.social-live-iframe-host {
|
||||
width: 100%;
|
||||
min-height: 62vh;
|
||||
}
|
||||
558
apps/miniprogram/h5/src/pages/social/meetup-live/index.tsx
Normal file
558
apps/miniprogram/h5/src/pages/social/meetup-live/index.tsx
Normal file
@ -0,0 +1,558 @@
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type CSSProperties,
|
||||
} from 'react'
|
||||
import {
|
||||
CoverView,
|
||||
Input,
|
||||
LivePlayer,
|
||||
LivePusher,
|
||||
View,
|
||||
} from '@tarojs/components'
|
||||
import Taro, { useRouter } from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { MIROTALK_URL, MOCK_ROSTER, SEED_MEETUPS } from '@/data/socialSeed'
|
||||
import { socialApi, type LivePeer } from '@/services/socialApi'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import { SocialAvatar } from '../_components/SocialAvatar'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import { H5El } from '../_components/H5El'
|
||||
import '@/styles/social-next/entry'
|
||||
import '../_components/social-subpage.scss'
|
||||
import './index.scss'
|
||||
|
||||
const ENV = Taro.getEnv()
|
||||
const isH5 = ENV === Taro.ENV_TYPE.WEB
|
||||
const isWeapp = ENV === Taro.ENV_TYPE.WEAPP
|
||||
const PUSHER_ID = 'socialLivePusher'
|
||||
|
||||
function joinMiro(room: string, name: string) {
|
||||
const q = new URLSearchParams({
|
||||
room,
|
||||
name,
|
||||
notify: '0',
|
||||
chat: '0',
|
||||
audio: '0',
|
||||
video: '0',
|
||||
})
|
||||
return `${MIROTALK_URL.replace(/\/$/, '')}/join?${q.toString()}`
|
||||
}
|
||||
|
||||
/** 微信 LivePusher 真机:RTMP 地址去掉 query,避免连不上导致黑屏 */
|
||||
function cleanRtmpUrl(url: string) {
|
||||
const s = String(url || '').trim()
|
||||
if (!s) return ''
|
||||
const i = s.indexOf('?')
|
||||
return i >= 0 ? s.slice(0, i) : s
|
||||
}
|
||||
|
||||
function selfTileSize() {
|
||||
try {
|
||||
const info = Taro.getSystemInfoSync()
|
||||
const w = Math.max(300, Math.floor(Number(info.windowWidth) || 375) - 24)
|
||||
const h = Math.min(
|
||||
Math.floor(w * 1.333),
|
||||
Math.floor((Number(info.windowHeight) || 640) * 0.55),
|
||||
)
|
||||
return { width: w, height: Math.max(360, h) }
|
||||
} catch {
|
||||
return { width: 340, height: 460 }
|
||||
}
|
||||
}
|
||||
|
||||
function peerTileSize() {
|
||||
try {
|
||||
const info = Taro.getSystemInfoSync()
|
||||
const w = Math.max(140, Math.floor(((Number(info.windowWidth) || 375) - 36) / 2))
|
||||
return { width: w, height: Math.floor(w * 1.25) }
|
||||
} catch {
|
||||
return { width: 160, height: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
function getPusherCtx() {
|
||||
try {
|
||||
return (
|
||||
Taro.createLivePusherContext as (id?: string) => ReturnType<
|
||||
typeof Taro.createLivePusherContext
|
||||
>
|
||||
)(PUSHER_ID)
|
||||
} catch {
|
||||
return Taro.createLivePusherContext()
|
||||
}
|
||||
}
|
||||
|
||||
async function ensureMediaAuth(): Promise<boolean> {
|
||||
if (!isWeapp) return true
|
||||
try {
|
||||
const wxAny = Taro as unknown as {
|
||||
requirePrivacyAuthorize?: (o: {
|
||||
success?: () => void
|
||||
fail?: () => void
|
||||
}) => void
|
||||
}
|
||||
if (typeof wxAny.requirePrivacyAuthorize === 'function') {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
wxAny.requirePrivacyAuthorize!({
|
||||
success: () => resolve(),
|
||||
fail: () => reject(new Error('privacy')),
|
||||
})
|
||||
})
|
||||
}
|
||||
} catch {
|
||||
/* continue */
|
||||
}
|
||||
try {
|
||||
await Taro.authorize({ scope: 'scope.camera' })
|
||||
await Taro.authorize({ scope: 'scope.record' })
|
||||
return true
|
||||
} catch {
|
||||
const open = await Taro.showModal({
|
||||
title: '需要摄像头与麦克风',
|
||||
content: '语音视频厅需要相机和录音权限。',
|
||||
confirmText: '去设置',
|
||||
})
|
||||
if (open.confirm) Taro.openSetting({})
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function SocialMeetupLive() {
|
||||
const router = useRouter()
|
||||
const meetupId = String(router.params?.id || SEED_MEETUPS[0]?.id || 'office')
|
||||
const meetup =
|
||||
SEED_MEETUPS.find((m) => m.id === meetupId) || {
|
||||
id: meetupId,
|
||||
title: '开视频见面',
|
||||
city: 'Online',
|
||||
date: '',
|
||||
time: '',
|
||||
mode: 'online' as const,
|
||||
mirotalkRoom: meetupId || 'nomadro-social-office',
|
||||
channelId: 'meetup-live',
|
||||
}
|
||||
|
||||
usePageShare({
|
||||
title: `nomadro · ${meetup.title}`,
|
||||
path: `/pages/social/meetup-live/index?id=${encodeURIComponent(meetup.id)}`,
|
||||
})
|
||||
usePageTrack('social_meetup_live')
|
||||
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
const selfSize = useMemo(() => selfTileSize(), [])
|
||||
const peerSize = useMemo(() => peerTileSize(), [])
|
||||
|
||||
const [nick, setNick] = useState(() => {
|
||||
try {
|
||||
return String(Taro.getStorageSync('nick') || router.params?.nick || '游民')
|
||||
} catch {
|
||||
return '游民'
|
||||
}
|
||||
})
|
||||
const [liveOn, setLiveOn] = useState(false)
|
||||
const [micOn, setMicOn] = useState(true)
|
||||
const [camOn, setCamOn] = useState(true)
|
||||
/** 先空串开本地预览,预览成功后再写入 RTMP */
|
||||
const [pusherUrl, setPusherUrl] = useState('')
|
||||
const pendingPush = useRef('')
|
||||
const [peers, setPeers] = useState<LivePeer[]>([])
|
||||
const [status, setStatus] = useState('待进入')
|
||||
const [roomId, setRoomId] = useState(meetup.id)
|
||||
const [previewOk, setPreviewOk] = useState(false)
|
||||
const hbRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
||||
|
||||
const miroSrc = useMemo(
|
||||
() => joinMiro(meetup.mirotalkRoom, nick.trim() || '游民'),
|
||||
[meetup.mirotalkRoom, nick],
|
||||
)
|
||||
|
||||
const stopHeartbeat = () => {
|
||||
if (hbRef.current) {
|
||||
clearInterval(hbRef.current)
|
||||
hbRef.current = null
|
||||
}
|
||||
}
|
||||
|
||||
const leaveNative = useCallback(async () => {
|
||||
stopHeartbeat()
|
||||
try {
|
||||
const ctx = getPusherCtx()
|
||||
ctx.stop({ complete: () => undefined })
|
||||
ctx.stopPreview({ complete: () => undefined })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
try {
|
||||
await socialApi.liveLeave(roomId)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
setLiveOn(false)
|
||||
setPusherUrl('')
|
||||
pendingPush.current = ''
|
||||
setPeers([])
|
||||
setPreviewOk(false)
|
||||
setStatus('已离开')
|
||||
}, [roomId])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
stopHeartbeat()
|
||||
if (isWeapp && liveOn) {
|
||||
try {
|
||||
socialApi.liveLeave(roomId)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
// ① 组件挂载后先本地预览(此时 url 为空)
|
||||
useEffect(() => {
|
||||
if (!isWeapp || !liveOn) return
|
||||
let cancelled = false
|
||||
const t = setTimeout(() => {
|
||||
if (cancelled) return
|
||||
try {
|
||||
const ctx = getPusherCtx()
|
||||
ctx.startPreview({
|
||||
success: () => {
|
||||
if (cancelled) return
|
||||
setPreviewOk(true)
|
||||
setStatus('摄像头已打开')
|
||||
// ② 预览成功后再挂 RTMP 并 start
|
||||
const url = pendingPush.current
|
||||
if (url) {
|
||||
setPusherUrl(url)
|
||||
}
|
||||
},
|
||||
fail: (e) => {
|
||||
if (cancelled) return
|
||||
setStatus(
|
||||
String(
|
||||
(e as { errMsg?: string })?.errMsg ||
|
||||
'打不开摄像头,请检查权限',
|
||||
),
|
||||
)
|
||||
},
|
||||
})
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
setStatus(String((e as Error)?.message || '摄像头错误'))
|
||||
}
|
||||
}
|
||||
}, 500)
|
||||
return () => {
|
||||
cancelled = true
|
||||
clearTimeout(t)
|
||||
}
|
||||
}, [liveOn])
|
||||
|
||||
// ③ url 写入后开始推流(autopush=false,手动 start)
|
||||
useEffect(() => {
|
||||
if (!isWeapp || !liveOn || !pusherUrl || !previewOk) return
|
||||
let cancelled = false
|
||||
const t = setTimeout(() => {
|
||||
if (cancelled) return
|
||||
try {
|
||||
getPusherCtx().start({
|
||||
success: () => !cancelled && setStatus('已推流 · 摄像头预览中'),
|
||||
fail: (e) =>
|
||||
!cancelled &&
|
||||
setStatus(
|
||||
`预览中 · 推流失败 ${String(
|
||||
(e as { errMsg?: string })?.errMsg || '',
|
||||
).slice(0, 24)}`,
|
||||
),
|
||||
})
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}, 300)
|
||||
return () => {
|
||||
cancelled = true
|
||||
clearTimeout(t)
|
||||
}
|
||||
}, [liveOn, pusherUrl, previewOk])
|
||||
|
||||
const startWeappLive = async () => {
|
||||
const ok = await ensureMediaAuth()
|
||||
if (!ok) return
|
||||
const name = nick.trim() || '游民'
|
||||
Taro.setStorageSync('nick', name)
|
||||
setStatus('正在进厅…')
|
||||
setPreviewOk(false)
|
||||
setPusherUrl('')
|
||||
try {
|
||||
const joined = await socialApi.liveJoin(meetup.id, name)
|
||||
const rtmp = cleanRtmpUrl(joined.pushUrl)
|
||||
pendingPush.current = rtmp
|
||||
setRoomId(joined.roomId)
|
||||
setPeers(joined.peers || [])
|
||||
// 先 liveOn:挂载空 url 的 LivePusher → startPreview
|
||||
setLiveOn(true)
|
||||
setStatus('正在打开摄像头…')
|
||||
stopHeartbeat()
|
||||
hbRef.current = setInterval(() => {
|
||||
socialApi
|
||||
.liveHeartbeat(joined.roomId)
|
||||
.then((r) => setPeers(r.peers || []))
|
||||
.catch(() => undefined)
|
||||
}, 4000)
|
||||
} catch (e) {
|
||||
const msg = String((e as Error)?.message || '进厅失败')
|
||||
setStatus(msg)
|
||||
Taro.showToast({ title: msg, icon: 'none', duration: 3200 })
|
||||
}
|
||||
}
|
||||
|
||||
const startH5 = () => {
|
||||
Taro.setStorageSync('nick', nick.trim() || '游民')
|
||||
setLiveOn(true)
|
||||
setStatus('MiroTalk WebRTC(H5)')
|
||||
}
|
||||
|
||||
const switchCam = () => {
|
||||
try {
|
||||
getPusherCtx().switchCamera({ complete: () => undefined })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className='soc-taro-root social-root social-workspace social-live-root social-weapp social-meetup-live'
|
||||
data-theme='dark'
|
||||
style={
|
||||
{
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<H5El className='social-live-bar'>
|
||||
<H5El className='social-live-bar-main'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-nav-back'
|
||||
onClick={() => {
|
||||
if (liveOn && isWeapp) void leaveNative()
|
||||
goPage('/pages/social/meetup/index')
|
||||
}}
|
||||
>
|
||||
← 场次
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>{meetup.title}</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
{status}
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container social-sub-body social-live-stage'>
|
||||
{!liveOn ? (
|
||||
<H5El className='social-live-gate social-panel'>
|
||||
<H5El as='h2'>语音视频厅</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
{isWeapp
|
||||
? '先进厅打开本地摄像头,再推流到厅内。请允许相机与麦克风。'
|
||||
: 'H5 使用 MiroTalk WebRTC;微信端为自研原生厅。'}
|
||||
</H5El>
|
||||
<H5El className='social-meetup-faces' aria-hidden>
|
||||
{MOCK_ROSTER.filter((m) => m.online)
|
||||
.slice(0, 5)
|
||||
.map((m) => (
|
||||
<SocialAvatar key={m.id} src={m.avatar} size={28} />
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-live-nick-row'>
|
||||
<H5El as='span' className='social-muted'>
|
||||
昵称
|
||||
</H5El>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
value={nick}
|
||||
maxlength={24}
|
||||
onInput={(e) => setNick(e.detail.value)}
|
||||
/>
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary'
|
||||
onClick={() => void (isWeapp ? startWeappLive() : startH5())}
|
||||
>
|
||||
进入语音视频厅
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : isWeapp ? (
|
||||
<View className='social-live-native-stage'>
|
||||
<View className='social-live-self'>
|
||||
<LivePusher
|
||||
id={PUSHER_ID}
|
||||
className='social-live-pusher'
|
||||
style={{
|
||||
width: `${selfSize.width}PX`,
|
||||
height: `${selfSize.height}PX`,
|
||||
display: 'block',
|
||||
backgroundColor: '#1a1a1f',
|
||||
}}
|
||||
url={pusherUrl}
|
||||
mode='RTC'
|
||||
autopush={false}
|
||||
enableCamera={camOn}
|
||||
enableMic={micOn}
|
||||
muted={!micOn}
|
||||
beauty={0}
|
||||
whiteness={0}
|
||||
aspect='3:4'
|
||||
devicePosition='front'
|
||||
localMirror='auto'
|
||||
onStateChange={(e) => {
|
||||
const code = (e as { detail?: { code?: number } })?.detail
|
||||
?.code
|
||||
if (code === 1003 || code === 1004) {
|
||||
setPreviewOk(true)
|
||||
setStatus('摄像头就绪')
|
||||
} else if (code === 1007 || code === 1008) {
|
||||
setStatus('推流中 · 可看见自己')
|
||||
} else if (code === -1307) {
|
||||
setStatus('网络断连,预览仍可用')
|
||||
}
|
||||
}}
|
||||
onError={(e) => {
|
||||
const msg = String(
|
||||
(e as { detail?: { errMsg?: string } })?.detail?.errMsg ||
|
||||
'摄像头错误',
|
||||
)
|
||||
setStatus(msg)
|
||||
}}
|
||||
>
|
||||
<CoverView className='social-live-pusher-badge'>
|
||||
我 · {nick}
|
||||
{previewOk ? ' · 预览中' : ' · 启动中'}
|
||||
</CoverView>
|
||||
</LivePusher>
|
||||
</View>
|
||||
|
||||
{peers.length > 0 ? (
|
||||
<View className='social-live-peers'>
|
||||
{peers.map((p) => (
|
||||
<View key={p.peerId} className='social-live-tile'>
|
||||
<LivePlayer
|
||||
id={`player_${p.peerId}`}
|
||||
className='social-live-player'
|
||||
style={{
|
||||
width: `${peerSize.width}PX`,
|
||||
height: `${peerSize.height}PX`,
|
||||
display: 'block',
|
||||
backgroundColor: '#0a0a0f',
|
||||
}}
|
||||
src={p.playUrl}
|
||||
mode='live'
|
||||
autoplay
|
||||
mute={false}
|
||||
objectFit='contain'
|
||||
/>
|
||||
<CoverView className='social-live-tile-label'>
|
||||
{p.nick || '游民'}
|
||||
</CoverView>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
<CoverView className='social-live-tools social-live-tools-cover'>
|
||||
<CoverView
|
||||
className='social-live-tool-btn'
|
||||
onClick={() => {
|
||||
setMicOn((v) => {
|
||||
const next = !v
|
||||
try {
|
||||
// enableMic 靠 props;再补一手
|
||||
getPusherCtx()
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return next
|
||||
})
|
||||
}}
|
||||
>
|
||||
{micOn ? '关麦' : '开麦'}
|
||||
</CoverView>
|
||||
<CoverView
|
||||
className='social-live-tool-btn'
|
||||
onClick={() => setCamOn((v) => !v)}
|
||||
>
|
||||
{camOn ? '关摄像头' : '开摄像头'}
|
||||
</CoverView>
|
||||
<CoverView className='social-live-tool-btn' onClick={switchCam}>
|
||||
翻转
|
||||
</CoverView>
|
||||
<CoverView
|
||||
className='social-live-tool-btn is-leave'
|
||||
onClick={() => void leaveNative()}
|
||||
>
|
||||
离开
|
||||
</CoverView>
|
||||
</CoverView>
|
||||
|
||||
<H5El as='p' className='social-muted social-live-hint'>
|
||||
{previewOk
|
||||
? peers.length
|
||||
? `厅内另有 ${peers.length} 人`
|
||||
: '应能看见自己画面;等人进同一场次'
|
||||
: '若一直黑屏:系统设置里打开微信的相机权限后重进'}
|
||||
</H5El>
|
||||
</View>
|
||||
) : (
|
||||
<H5El className='social-live-video social-panel'>
|
||||
<H5El
|
||||
className='social-live-iframe-host'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `<iframe title="${meetup.title}" src="${miroSrc}" class="social-live-iframe" allow="camera; microphone; display-capture; autoplay; fullscreen; clipboard-write" referrerpolicy="no-referrer-when-downgrade" style="width:100%;height:70vh;border:0;border-radius:12px;background:#000"></iframe>`,
|
||||
}}
|
||||
/>
|
||||
<H5El className='social-live-tools'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-sm'
|
||||
onClick={() => setLiveOn(false)}
|
||||
>
|
||||
离开视频
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
)}
|
||||
</H5El>
|
||||
{!liveOn || !isWeapp ? <SocialDock /> : null}
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialMeetupLivePage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialMeetupLive />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '开视频场次',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
1
apps/miniprogram/h5/src/pages/social/meetup/index.scss
Normal file
1
apps/miniprogram/h5/src/pages/social/meetup/index.scss
Normal file
@ -0,0 +1 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
109
apps/miniprogram/h5/src/pages/social/meetup/index.tsx
Normal file
109
apps/miniprogram/h5/src/pages/social/meetup/index.tsx
Normal file
@ -0,0 +1,109 @@
|
||||
import { useMemo, type CSSProperties } from 'react'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { MOCK_ROSTER, SEED_MEETUPS } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import { SocialAvatar } from '../_components/SocialAvatar'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import { H5El } from '../_components/H5El'
|
||||
import '@/styles/social-next/entry'
|
||||
import '../_components/social-subpage.scss'
|
||||
import './index.scss'
|
||||
|
||||
function SocialMeetupList() {
|
||||
usePageShare({ title: 'nomadro · 开视频', path: '/pages/social/meetup/index' })
|
||||
usePageTrack('social_meetup')
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className='soc-taro-root social-root social-workspace social-weapp'
|
||||
data-theme='dark'
|
||||
style={
|
||||
{
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<H5El className='social-live-bar'>
|
||||
<H5El className='social-live-bar-main'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-nav-back'
|
||||
onClick={() => goPage('/pages/social/index')}
|
||||
>
|
||||
← 首页
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>开视频场次</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
WebRTC · 与门户同款 MiroTalk
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container social-sub-body'>
|
||||
<H5El as='p' className='social-muted social-sub-block'>
|
||||
先进场次热热身,再开语音或视频。小程序内会引导用系统浏览器进入真正的 WebRTC 房间(禁止 web-view)。
|
||||
</H5El>
|
||||
<H5El className='social-panel-grid social-panel-grid-2'>
|
||||
{SEED_MEETUPS.map((m, i) => (
|
||||
<H5El
|
||||
as='article'
|
||||
key={m.id}
|
||||
className={`social-panel social-panel-fx${i === 0 ? ' is-accent' : ''}`}
|
||||
>
|
||||
<H5El className='social-panel-meta'>
|
||||
<H5El as='span'>
|
||||
{m.city === 'Online' ? '群组 · 语音视频' : m.city}
|
||||
</H5El>
|
||||
<H5El as='time'>
|
||||
{m.date} · {m.time}
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El className='social-meetup-faces' aria-hidden>
|
||||
{MOCK_ROSTER.slice(i + 1, i + 5).map((p) => (
|
||||
<SocialAvatar key={p.id} src={p.avatar} size={24} />
|
||||
))}
|
||||
<H5El as='em'>+{6 + i} 想参加</H5El>
|
||||
</H5El>
|
||||
<H5El as='h3'>{m.title}</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
房间 {m.mirotalkRoom}
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary btn-sm'
|
||||
onClick={() =>
|
||||
goPage(`/pages/social/meetup-live/index?id=${encodeURIComponent(m.id)}`)
|
||||
}
|
||||
>
|
||||
进入聊聊 ↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
<SocialDock />
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialMeetupPage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialMeetupList />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '想见的人',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
1
apps/miniprogram/h5/src/pages/social/people/index.scss
Normal file
1
apps/miniprogram/h5/src/pages/social/people/index.scss
Normal file
@ -0,0 +1 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
185
apps/miniprogram/h5/src/pages/social/people/index.tsx
Normal file
185
apps/miniprogram/h5/src/pages/social/people/index.tsx
Normal file
@ -0,0 +1,185 @@
|
||||
import { useEffect, useMemo, useState, type CSSProperties } from 'react'
|
||||
import { useRouter } from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import {
|
||||
MOCK_ROSTER,
|
||||
SEED_CAFES,
|
||||
SEED_GIGS,
|
||||
SOCIAL_CITIES,
|
||||
TEAM_KIND_LABEL,
|
||||
ROLE_EMOJI,
|
||||
} from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import { PeopleChip } from '../_components/PeopleChip'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import { H5El } from '../_components/H5El'
|
||||
import '@/styles/social-next/entry'
|
||||
import './index.scss'
|
||||
|
||||
function SocialPeople() {
|
||||
usePageShare({ title: 'nomadro · 想见的人', path: '/pages/social/people/index' })
|
||||
usePageTrack('social_people')
|
||||
const router = useRouter()
|
||||
const mode = (router.params?.mode as string) || 'all'
|
||||
const [filter, setFilter] = useState<'all' | 'online' | 'f' | 'm'>('all')
|
||||
const [likes, setLikes] = useState<Record<string, boolean>>({})
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
|
||||
useEffect(() => {
|
||||
if (mode === 'team') goPage('/pages/social/team/index')
|
||||
}, [mode])
|
||||
|
||||
const title =
|
||||
mode === 'cafe' ? '同城,见一面' : mode === 'team' ? '一起,做点事' : '想见的人'
|
||||
|
||||
const list = useMemo(() => {
|
||||
return MOCK_ROSTER.filter((m) => {
|
||||
if (filter === 'online') return m.online
|
||||
if (filter === 'f' || filter === 'm') return m.gender === filter
|
||||
return true
|
||||
})
|
||||
}, [filter])
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className='soc-taro-root social-root social-workspace social-home social-weapp'
|
||||
data-theme='dark'
|
||||
style={
|
||||
{
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<H5El className='social-live-bar'>
|
||||
<H5El className='social-live-bar-main'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-nav-back'
|
||||
onClick={() => goPage('/pages/social/index')}
|
||||
>
|
||||
← 首页
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>{title}</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
示例介绍 · 离线可逛
|
||||
</H5El>
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-sm'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
认识一下
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container social-sub-body'>
|
||||
{mode === 'cafe' ? (
|
||||
<>
|
||||
<H5El className='social-panel-grid social-panel-grid-2 social-sub-block'>
|
||||
{SOCIAL_CITIES.filter((c) => c.hot)
|
||||
.slice(0, 6)
|
||||
.map((c) => (
|
||||
<H5El key={c.id} className='social-panel'>
|
||||
<H5El as='span' style={{ fontSize: 26 }}>
|
||||
{c.emoji}
|
||||
</H5El>
|
||||
<H5El as='strong'>{c.name}</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
{c.vibe}
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-panel-grid social-panel-grid-2 social-sub-block'>
|
||||
{SEED_CAFES.map((cafe) => (
|
||||
<H5El key={cafe.id} className='social-panel'>
|
||||
<H5El as='strong'>☕ {cafe.name}</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
{cafe.city} · WiFi {cafe.wifiMbps}Mbps
|
||||
</H5El>
|
||||
<H5El as='p'>{cafe.vibe}</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{mode === 'team' ? (
|
||||
<H5El className='social-panel-grid social-panel-grid-2 social-sub-block'>
|
||||
{SEED_GIGS.map((g) => (
|
||||
<H5El key={g.id} className='social-panel'>
|
||||
<H5El as='span'>{ROLE_EMOJI[g.kind || 'parttime']}</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
{TEAM_KIND_LABEL[g.kind || 'parttime']}
|
||||
</H5El>
|
||||
<H5El as='strong'>{g.title}</H5El>
|
||||
<H5El as='p'>{g.pay}</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
) : null}
|
||||
|
||||
{mode === 'all' || mode === 'cafe' ? (
|
||||
<>
|
||||
<H5El className='social-people-filters'>
|
||||
{(
|
||||
[
|
||||
['all', '全部', '✨'],
|
||||
['online', '在线', '🟢'],
|
||||
['f', '女生', '👩'],
|
||||
['m', '男生', '👨'],
|
||||
] as const
|
||||
).map(([id, label, emoji]) => (
|
||||
<H5El
|
||||
key={id}
|
||||
as='button'
|
||||
type='button'
|
||||
className={`social-people-filter${filter === id ? ' is-on active' : ''}`}
|
||||
onClick={() => setFilter(id)}
|
||||
>
|
||||
{emoji} {label}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El className='social-people-grid'>
|
||||
{list.map((m, i) => (
|
||||
<PeopleChip
|
||||
key={m.id}
|
||||
member={m}
|
||||
liked={!!likes[m.id]}
|
||||
staggerMs={Math.min(i, 12) * 40}
|
||||
onToggleLike={() =>
|
||||
setLikes((prev) => ({ ...prev, [m.id]: !prev[m.id] }))
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</H5El>
|
||||
</>
|
||||
) : null}
|
||||
</H5El>
|
||||
<SocialDock />
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialPeoplePage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialPeople />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '游民名片',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
@ -0,0 +1,34 @@
|
||||
@import '../../../../styles/page-rem.scss';
|
||||
@import '../../_components/social-subpage.scss';
|
||||
|
||||
.soc-taro-root.social-profile-page .social-sub-body {
|
||||
padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0PX));
|
||||
}
|
||||
|
||||
.soc-taro-root.social-profile-page .social-profile-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-profile-page .social-profile-actions .btn,
|
||||
.soc-taro-root.social-profile-page .social-profile-actions .social-btn {
|
||||
min-height: 2.75rem;
|
||||
padding: 0 0.9rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-profile-page .social-profile-gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-profile-page .social-profile-gallery-grid image,
|
||||
.soc-taro-root.social-profile-page .social-profile-gallery-grid .as-img {
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 3;
|
||||
object-fit: cover;
|
||||
border-radius: 0.75rem;
|
||||
display: block;
|
||||
}
|
||||
270
apps/miniprogram/h5/src/pages/social/people/profile/index.tsx
Normal file
270
apps/miniprogram/h5/src/pages/social/people/profile/index.tsx
Normal file
@ -0,0 +1,270 @@
|
||||
import { useMemo, useState, type CSSProperties } from 'react'
|
||||
import { Image } from '@tarojs/components'
|
||||
import { useRouter } from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { findRosterMember, MOCK_ROSTER } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import { H5El } from '../../_components/H5El'
|
||||
import { SocialAvatar } from '../../_components/SocialAvatar'
|
||||
import { SocialDock } from '../../_components/SocialDock'
|
||||
import { SocialExperience } from '../../_components/SocialExperience'
|
||||
import { PeopleChip } from '../../_components/PeopleChip'
|
||||
import '@/styles/social-next/entry'
|
||||
import './index.scss'
|
||||
|
||||
function SocialPeopleProfile() {
|
||||
const router = useRouter()
|
||||
const id = String(router.params?.id || '').trim()
|
||||
const member = useMemo(() => findRosterMember(id), [id])
|
||||
const [liked, setLiked] = useState(false)
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
|
||||
usePageShare({
|
||||
title: member
|
||||
? `nomadro · ${member.name}`
|
||||
: 'nomadro · 游民名片',
|
||||
path: member
|
||||
? `/pages/social/people/profile/index?id=${member.id}`
|
||||
: '/pages/social/people/index',
|
||||
})
|
||||
usePageTrack('social_people_profile')
|
||||
|
||||
const similar = useMemo(() => {
|
||||
if (!member) return []
|
||||
const cityKey = member.city.split(/[·/]/)[0]?.trim() || ''
|
||||
return MOCK_ROSTER.filter(
|
||||
(m) =>
|
||||
m.id !== member.id &&
|
||||
cityKey.length >= 2 &&
|
||||
m.city.includes(cityKey.slice(0, 2)),
|
||||
).slice(0, 4)
|
||||
}, [member])
|
||||
|
||||
const intro = member
|
||||
? encodeURIComponent(
|
||||
`嗨 ${member.name}!看到你在做${member.tags[0] || '远程'},想认识一下。`,
|
||||
)
|
||||
: ''
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className='soc-taro-root social-root social-workspace social-home social-weapp social-profile-page'
|
||||
data-theme='dark'
|
||||
style={
|
||||
{
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<H5El className='social-live-bar'>
|
||||
<H5El className='social-live-bar-main'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-nav-back'
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
>
|
||||
← 回去看看大家
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>{member?.name || '游民名片'}</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
示例介绍 · 离线可逛
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container social-sub-body'>
|
||||
{!member ? (
|
||||
<H5El className='social-panel'>
|
||||
<H5El as='strong'>没有这位游民</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
这位朋友可能已离开,或者链接有点旧。回去再看看其他人吧。
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary'
|
||||
onClick={() => goPage('/pages/social/people/index')}
|
||||
>
|
||||
回去看看大家
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : (
|
||||
<H5El as='article' className='social-profile'>
|
||||
<H5El className='social-profile-hero'>
|
||||
<H5El
|
||||
className='social-profile-cover'
|
||||
style={
|
||||
member.gallery?.[0]
|
||||
? {
|
||||
backgroundImage: `linear-gradient(180deg, transparent 20%, #0c0c0fcc 92%), url(${member.gallery[0]})`,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
aria-hidden
|
||||
/>
|
||||
<H5El className='social-profile-identity'>
|
||||
<SocialAvatar src={member.avatar} size={96} />
|
||||
<H5El>
|
||||
<H5El as='p' className='social-profile-kicker'>
|
||||
<H5El
|
||||
as='span'
|
||||
className={member.online ? 'is-online' : undefined}
|
||||
>
|
||||
{member.online ? '在线' : '离线'}
|
||||
</H5El>
|
||||
<H5El as='span'>{member.vibe}</H5El>
|
||||
</H5El>
|
||||
<H5El as='h1'>{member.name}</H5El>
|
||||
<H5El as='p' className='social-profile-title'>
|
||||
{member.title}
|
||||
</H5El>
|
||||
<H5El as='p' className='social-profile-city'>
|
||||
📍 {member.city}
|
||||
{member.timezone ? ` · ${member.timezone}` : ''}
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-profile-actions'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className={`btn${liked ? ' btn-primary' : ''}`}
|
||||
onClick={() => setLiked((v) => !v)}
|
||||
>
|
||||
{liked ? '♥ 已关注' : '♡ 关注一下'}
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary'
|
||||
onClick={() =>
|
||||
goPage(`/pages/social/chat/index?intro=${intro}`)
|
||||
}
|
||||
>
|
||||
进群组打招呼
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn'
|
||||
onClick={() => goPage('/pages/social/meetup/index')}
|
||||
>
|
||||
语音视频场
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
去左右滑
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-profile-grid'>
|
||||
<H5El as='section' className='social-profile-card'>
|
||||
<H5El as='h2'>关于 TA</H5El>
|
||||
<H5El as='p'>{member.bio}</H5El>
|
||||
<H5El as='p' className='social-profile-looking'>
|
||||
✨ <H5El as='strong'>想认识:</H5El>
|
||||
{member.lookingFor}
|
||||
</H5El>
|
||||
{member.availability ? (
|
||||
<H5El as='p' className='social-muted'>
|
||||
什么时候方便 · {member.availability}
|
||||
</H5El>
|
||||
) : null}
|
||||
</H5El>
|
||||
|
||||
<H5El as='section' className='social-profile-card'>
|
||||
<H5El as='h2'>兴趣标签</H5El>
|
||||
<H5El className='social-tags'>
|
||||
{member.tags.map((t) => (
|
||||
<H5El as='span' key={t}>
|
||||
{t}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
{member.languages?.length ? (
|
||||
<>
|
||||
<H5El as='h2'>语言</H5El>
|
||||
<H5El className='social-tags is-soft'>
|
||||
{member.languages.map((l) => (
|
||||
<H5El as='span' key={l}>
|
||||
{l}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</>
|
||||
) : null}
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
{member.gallery && member.gallery.length > 0 ? (
|
||||
<H5El as='section' className='social-profile-gallery'>
|
||||
<H5El as='h2'>生活瞬间</H5El>
|
||||
<H5El className='social-profile-gallery-grid'>
|
||||
{member.gallery.map((src) => (
|
||||
<Image key={src} src={src} mode='aspectFill' lazyLoad />
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : null}
|
||||
|
||||
{similar.length > 0 ? (
|
||||
<H5El as='section' className='social-profile-similar'>
|
||||
<H5El as='h2'>附近可能同城的人</H5El>
|
||||
<H5El className='social-people-grid social-profile-similar-grid'>
|
||||
{similar.map((m) => (
|
||||
<PeopleChip key={m.id} member={m} />
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : null}
|
||||
|
||||
<H5El className='social-profile-footer-cta'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary'
|
||||
onClick={() => goPage('/pages/social/date/index')}
|
||||
>
|
||||
去左右滑认识更多人
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn'
|
||||
onClick={() => goPage('/pages/social/roster/index')}
|
||||
>
|
||||
写写我的介绍
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
)}
|
||||
</H5El>
|
||||
<SocialDock />
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialPeopleProfilePage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialPeopleProfile />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的介绍',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
1
apps/miniprogram/h5/src/pages/social/roster/index.scss
Normal file
1
apps/miniprogram/h5/src/pages/social/roster/index.scss
Normal file
@ -0,0 +1 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
121
apps/miniprogram/h5/src/pages/social/roster/index.tsx
Normal file
121
apps/miniprogram/h5/src/pages/social/roster/index.tsx
Normal file
@ -0,0 +1,121 @@
|
||||
import { useState } from 'react'
|
||||
import { Text, Input, Textarea } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { H5Box } from '@/components/H5Box'
|
||||
import { MOCK_ROSTER } from '@/data/socialSeed'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { SocialAvatar } from '../_components/SocialAvatar'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import '@/styles/social-next/entry'
|
||||
import './index.scss'
|
||||
|
||||
const SEED = MOCK_ROSTER[0]!
|
||||
|
||||
function SocialRoster() {
|
||||
usePageShare({ title: 'nomadro · 我的介绍', path: '/pages/social/roster/index' })
|
||||
usePageTrack('social_roster')
|
||||
const [name, setName] = useState(SEED.name)
|
||||
const [title, setTitle] = useState(SEED.title)
|
||||
const [city, setCity] = useState(SEED.city)
|
||||
const [bio, setBio] = useState(SEED.bio)
|
||||
const [lookingFor, setLookingFor] = useState(SEED.lookingFor)
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5Box className='soc-taro-root social-root social-workspace social-weapp' data-theme='dark'>
|
||||
<H5Box className='social-live-bar'>
|
||||
<H5Box className='social-live-bar-main'>
|
||||
<H5Box
|
||||
className='social-nav-back'
|
||||
onClick={() => goPage('/pages/social/index')}
|
||||
>
|
||||
<Text>← 首页</Text>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text style={{ fontWeight: 700 }}>我的介绍</Text>
|
||||
<Text className='social-muted'>让别人更快认识你</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
|
||||
<H5Box className='container social-sub-body'>
|
||||
<H5Box className='social-panel social-profile-studio'>
|
||||
<H5Box style={{ display: 'flex', gap: 14, alignItems: 'center', marginBottom: 16 }}>
|
||||
<SocialAvatar src={SEED.avatar} size={64} />
|
||||
<H5Box>
|
||||
<Text style={{ fontWeight: 750, fontSize: 18 }}>{name || '未命名'}</Text>
|
||||
<Text className='social-muted'>
|
||||
{title || '身份'} · {city || '城市'}
|
||||
</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
|
||||
<H5Box className='social-form' style={{ display: 'grid', gap: 12 }}>
|
||||
<H5Box>
|
||||
<Text className='social-muted'>昵称</Text>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
value={name}
|
||||
onInput={(e) => setName(e.detail.value)}
|
||||
/>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text className='social-muted'>身份</Text>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
value={title}
|
||||
onInput={(e) => setTitle(e.detail.value)}
|
||||
/>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text className='social-muted'>城市</Text>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
value={city}
|
||||
onInput={(e) => setCity(e.detail.value)}
|
||||
/>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text className='social-muted'>简介</Text>
|
||||
<Textarea
|
||||
className='social-field-input'
|
||||
value={bio}
|
||||
maxlength={160}
|
||||
autoHeight
|
||||
onInput={(e) => setBio(e.detail.value)}
|
||||
/>
|
||||
</H5Box>
|
||||
<H5Box>
|
||||
<Text className='social-muted'>想认识</Text>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
value={lookingFor}
|
||||
onInput={(e) => setLookingFor(e.detail.value)}
|
||||
/>
|
||||
</H5Box>
|
||||
<H5Box
|
||||
className='btn btn-primary'
|
||||
onClick={() => Taro.showToast({ title: '已保存到本机(离线)', icon: 'none' })}
|
||||
>
|
||||
<Text>保存介绍</Text>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
</H5Box>
|
||||
<SocialDock />
|
||||
</H5Box>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialRosterPage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialRoster />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '找搭子',
|
||||
navigationBarBackgroundColor: '#0c0c0f',
|
||||
navigationBarTextStyle: 'white',
|
||||
backgroundColor: '#0c0c0f',
|
||||
})
|
||||
177
apps/miniprogram/h5/src/pages/social/team/index.scss
Normal file
177
apps/miniprogram/h5/src/pages/social/team/index.scss
Normal file
@ -0,0 +1,177 @@
|
||||
@import '../_components/social-subpage.scss';
|
||||
|
||||
.social-team-search {
|
||||
width: 100%;
|
||||
margin-bottom: 0.85rem;
|
||||
min-height: 2.75rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-role-emoji {
|
||||
font-size: 1.5rem;
|
||||
display: block;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.social-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
margin: 0.5rem 0 0.75rem;
|
||||
}
|
||||
|
||||
.social-tags > .as-span,
|
||||
.social-tags > text,
|
||||
.social-tags > span {
|
||||
font-size: 0.72rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
/* 申请底栏:rem + 全宽,防 750 缩水 */
|
||||
.social-apply-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1300;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
background: rgba(0, 0, 0, 0.62);
|
||||
}
|
||||
|
||||
.social-apply-sheet {
|
||||
width: 100%;
|
||||
max-height: 88vh;
|
||||
overflow-y: auto;
|
||||
border-radius: 1.25rem 1.25rem 0 0;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-bottom: none;
|
||||
background: rgba(12, 12, 15, 0.98);
|
||||
padding: 0.5rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-apply-handle {
|
||||
width: 2.25rem;
|
||||
height: 0.25rem;
|
||||
border-radius: 99px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
margin: 0.15rem auto 0.75rem;
|
||||
}
|
||||
|
||||
.social-apply-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 2.75rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.social-apply-close {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #94a3b8;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.social-apply-hero {
|
||||
margin-bottom: 0.85rem;
|
||||
}
|
||||
|
||||
.social-apply-kind {
|
||||
display: inline-block;
|
||||
font-size: 0.72rem;
|
||||
color: #f59e0b;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.social-apply-progress {
|
||||
margin-bottom: 0.85rem;
|
||||
}
|
||||
|
||||
.social-apply-progress-track {
|
||||
display: block;
|
||||
height: 0.28rem;
|
||||
border-radius: 99px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
overflow: hidden;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.social-apply-progress-track > .as-i,
|
||||
.social-apply-progress-track > i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: #4ecdc4;
|
||||
border-radius: 99px;
|
||||
}
|
||||
|
||||
.social-apply-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
margin-bottom: 0.75rem;
|
||||
font-size: 0.82rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-apply-textarea {
|
||||
min-height: 5.5rem;
|
||||
}
|
||||
|
||||
.social-apply-prompts {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.social-apply-chip {
|
||||
min-height: 2rem;
|
||||
padding: 0 0.65rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #94a3b8;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.social-apply-submit {
|
||||
width: 100%;
|
||||
min-height: 2.85rem;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.social-apply-status {
|
||||
font-size: 0.82rem;
|
||||
color: #4ecdc4;
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
.social-apply-status.is-warn {
|
||||
color: #f59e0b;
|
||||
}
|
||||
|
||||
.social-apply-foot {
|
||||
margin-top: 0.65rem;
|
||||
text-align: center;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.social-apply-done {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.65rem;
|
||||
padding: 0.5rem 0 0.25rem;
|
||||
}
|
||||
|
||||
.social-apply-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
395
apps/miniprogram/h5/src/pages/social/team/index.tsx
Normal file
395
apps/miniprogram/h5/src/pages/social/team/index.tsx
Normal file
@ -0,0 +1,395 @@
|
||||
import { useEffect, useMemo, useState, type CSSProperties } from 'react'
|
||||
import { Input, Textarea } from '@tarojs/components'
|
||||
import Taro, { useRouter } from '@tarojs/taro'
|
||||
import { MiniModuleGate } from '@/components/MiniModuleGate'
|
||||
import { ROLE_EMOJI, SEED_GIGS, TEAM_KIND_LABEL } from '@/data/socialSeed'
|
||||
import type { SocialGig, SocialTeamKind } from '@/data/socialTypes'
|
||||
import { socialApi, getLocalApply, markLocalApplySent } from '@/services/socialApi'
|
||||
import { goPage } from '@/utils/nav'
|
||||
import { usePageShare } from '@/utils/pageShare'
|
||||
import { usePageTrack } from '@/hooks/usePageTrack'
|
||||
import { getSafeAreaMetrics, safePx } from '@/utils/safeArea'
|
||||
import { SocialDock } from '../_components/SocialDock'
|
||||
import { SocialExperience } from '../_components/SocialExperience'
|
||||
import { H5El } from '../_components/H5El'
|
||||
import '@/styles/social-next/entry'
|
||||
import '../_components/social-subpage.scss'
|
||||
import './index.scss'
|
||||
|
||||
const NOTE_PROMPTS = ['做过类似项目…', '每周可投入…', '作品在这里…', '想一起做成…'] as const
|
||||
const DRAFT_KEY = (id: string) => `gig-draft:${id}`
|
||||
|
||||
type Draft = { name: string; contact: string; note: string }
|
||||
|
||||
function loadDraft(gigId: string): Draft {
|
||||
try {
|
||||
const raw = Taro.getStorageSync(DRAFT_KEY(gigId))
|
||||
if (raw && typeof raw === 'object') {
|
||||
return {
|
||||
name: String((raw as Draft).name || ''),
|
||||
contact: String((raw as Draft).contact || ''),
|
||||
note: String((raw as Draft).note || ''),
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return { name: '', contact: '', note: '' }
|
||||
}
|
||||
|
||||
function ApplySheet({
|
||||
gig,
|
||||
onClose,
|
||||
}: {
|
||||
gig: SocialGig
|
||||
onClose: () => void
|
||||
}) {
|
||||
const local = getLocalApply(gig.id)
|
||||
const [draft, setDraft] = useState<Draft>(() => loadDraft(gig.id))
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [status, setStatus] = useState('')
|
||||
const [delivery, setDelivery] = useState<'draft' | 'local' | 'sent'>(
|
||||
local?.delivery === 'sent' ? 'sent' : 'draft',
|
||||
)
|
||||
|
||||
const filled =
|
||||
Number(Boolean(draft.name.trim())) +
|
||||
Number(Boolean(draft.contact.trim())) +
|
||||
Number(Boolean(draft.note.trim()))
|
||||
|
||||
const update = (key: keyof Draft, value: string) => {
|
||||
setDraft((d) => {
|
||||
const next = { ...d, [key]: value }
|
||||
try {
|
||||
Taro.setStorageSync(DRAFT_KEY(gig.id), next)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return next
|
||||
})
|
||||
setDelivery('draft')
|
||||
setStatus('')
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
if (busy || delivery === 'sent') return
|
||||
if (!draft.name.trim() || !draft.contact.trim()) {
|
||||
setStatus('请填写称呼和联系方式')
|
||||
return
|
||||
}
|
||||
setBusy(true)
|
||||
try {
|
||||
await socialApi.applyGig(gig.id, {
|
||||
name: draft.name.trim(),
|
||||
contact: draft.contact.trim(),
|
||||
note: draft.note.trim(),
|
||||
})
|
||||
markLocalApplySent(gig.id)
|
||||
setDelivery('sent')
|
||||
setStatus('申请已提交。对方看到后会再联系你——先不急。')
|
||||
Taro.showToast({ title: '已提交', icon: 'success' })
|
||||
} catch {
|
||||
setDelivery('local')
|
||||
setStatus('申请已先留在本机。有网后再点一次即可重试。')
|
||||
Taro.showToast({ title: '已存本机', icon: 'none' })
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<H5El className='social-apply-mask' onClick={onClose}>
|
||||
<H5El
|
||||
className='social-apply-sheet'
|
||||
onClick={(e) => {
|
||||
e?.stopPropagation?.()
|
||||
}}
|
||||
>
|
||||
<H5El className='social-apply-handle' aria-hidden />
|
||||
<H5El className='social-apply-head'>
|
||||
<H5El as='strong'>表达兴趣</H5El>
|
||||
<H5El as='button' type='button' className='social-apply-close' onClick={onClose}>
|
||||
✕
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
{delivery === 'sent' ? (
|
||||
<H5El className='social-apply-done'>
|
||||
<H5El as='strong'>已表达兴趣</H5El>
|
||||
<H5El as='p'>{status}</H5El>
|
||||
<H5El as='em'>{gig.title}</H5El>
|
||||
<H5El className='social-apply-actions'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary'
|
||||
onClick={() => goPage('/pages/social/chat/index')}
|
||||
>
|
||||
去群里打个招呼
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-ghost'
|
||||
onClick={() => {
|
||||
setDelivery('draft')
|
||||
setStatus('可以再改一版后提交。')
|
||||
}}
|
||||
>
|
||||
再投一份
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : (
|
||||
<>
|
||||
<H5El className='social-apply-hero'>
|
||||
<H5El as='span' className='social-apply-kind'>
|
||||
{TEAM_KIND_LABEL[gig.kind || 'parttime']}
|
||||
</H5El>
|
||||
<H5El as='strong'>{gig.title}</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
{gig.role} · {gig.pay}
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-apply-progress'>
|
||||
<H5El className='social-apply-progress-track'>
|
||||
<H5El as='i' style={{ width: `${(filled / 3) * 100}%` }} />
|
||||
</H5El>
|
||||
<H5El as='small' className='social-muted'>
|
||||
{filled === 0
|
||||
? '先简单介绍自己'
|
||||
: filled < 3
|
||||
? `还差 ${3 - filled} 项(简介可选)`
|
||||
: '可以提交了'}
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-apply-field'>
|
||||
<H5El as='span'>怎么称呼你</H5El>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
maxlength={64}
|
||||
placeholder='昵称或真名都行'
|
||||
value={draft.name}
|
||||
onInput={(e) => update('name', e.detail.value)}
|
||||
/>
|
||||
</H5El>
|
||||
<H5El className='social-apply-field'>
|
||||
<H5El as='span'>联系方式</H5El>
|
||||
<Input
|
||||
className='social-field-input'
|
||||
maxlength={120}
|
||||
placeholder='邮箱 / 微信 / Telegram…'
|
||||
value={draft.contact}
|
||||
onInput={(e) => update('contact', e.detail.value)}
|
||||
/>
|
||||
</H5El>
|
||||
<H5El className='social-apply-field'>
|
||||
<H5El as='span'>你能带来什么</H5El>
|
||||
<Textarea
|
||||
className='social-field-input social-apply-textarea'
|
||||
maxlength={2000}
|
||||
autoHeight
|
||||
placeholder='相关经历、作品链接、每周能投入多久…'
|
||||
value={draft.note}
|
||||
onInput={(e) => update('note', e.detail.value)}
|
||||
/>
|
||||
<H5El className='social-apply-prompts'>
|
||||
{NOTE_PROMPTS.map((tip) => (
|
||||
<H5El
|
||||
key={tip}
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-apply-chip'
|
||||
onClick={() =>
|
||||
update('note', draft.note.trim() ? `${draft.note.trim()}\n${tip}` : tip)
|
||||
}
|
||||
>
|
||||
{tip}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
{status ? (
|
||||
<H5El as='p' className={`social-apply-status${delivery === 'local' ? ' is-warn' : ''}`}>
|
||||
{status}
|
||||
</H5El>
|
||||
) : null}
|
||||
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary social-apply-submit'
|
||||
onClick={() => void submit()}
|
||||
>
|
||||
{busy ? '提交中…' : delivery === 'local' ? '重试提交' : '发送参与申请'}
|
||||
</H5El>
|
||||
<H5El as='p' className='social-muted social-apply-foot'>
|
||||
草稿会先留在你这边。提交只是表达兴趣,不代表已经被录用。
|
||||
</H5El>
|
||||
</>
|
||||
)}
|
||||
</H5El>
|
||||
</H5El>
|
||||
)
|
||||
}
|
||||
|
||||
function SocialTeam() {
|
||||
usePageShare({ title: 'nomadro · 找搭子', path: '/pages/social/team/index' })
|
||||
usePageTrack('social_team')
|
||||
const router = useRouter()
|
||||
const safe = useMemo(() => getSafeAreaMetrics(), [])
|
||||
const initialKind = (router.params?.kind as string) || 'all'
|
||||
const [kind, setKind] = useState<string>(initialKind)
|
||||
const [query, setQuery] = useState(String(router.params?.q || ''))
|
||||
const [active, setActive] = useState<SocialGig | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const gigId = String(router.params?.gig || '')
|
||||
if (!gigId) return
|
||||
const gig = SEED_GIGS.find((g) => g.id === gigId)
|
||||
if (gig) setActive(gig)
|
||||
}, [router.params?.gig])
|
||||
|
||||
const roles = SEED_GIGS.filter((gig) => {
|
||||
if (kind !== 'all' && gig.kind !== kind) return false
|
||||
const q = query.trim().toLowerCase()
|
||||
if (!q) return true
|
||||
return `${gig.title} ${gig.role} ${gig.tags.join(' ')}`.toLowerCase().includes(q)
|
||||
})
|
||||
|
||||
return (
|
||||
<SocialExperience>
|
||||
<H5El
|
||||
className='soc-taro-root social-root social-workspace social-weapp'
|
||||
data-theme='dark'
|
||||
style={
|
||||
{
|
||||
['--safe-status-bar' as string]: safePx(safe.statusBarHeight),
|
||||
['--safe-nav-bar' as string]: safePx(safe.navBarHeight),
|
||||
['--safe-menu-pad' as string]: safePx(safe.menuRightPad),
|
||||
['--safe-header' as string]: safePx(safe.headerHeight),
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<H5El className='social-live-bar'>
|
||||
<H5El className='social-live-bar-main'>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='social-nav-back'
|
||||
onClick={() => goPage('/pages/social/index')}
|
||||
>
|
||||
← 首页
|
||||
</H5El>
|
||||
<H5El>
|
||||
<H5El as='strong'>一起,做点事</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
找搭子 · 表单申请
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
</H5El>
|
||||
|
||||
<H5El className='container social-sub-body'>
|
||||
<H5El as='p' className='social-muted social-sub-block'>
|
||||
远程也能一起推进:认领角色、写申请,草稿会先留在本机。
|
||||
</H5El>
|
||||
|
||||
<Input
|
||||
className='social-field-input social-team-search'
|
||||
placeholder='角色 / 技能 / 关键词'
|
||||
value={query}
|
||||
onInput={(e) => setQuery(e.detail.value)}
|
||||
/>
|
||||
|
||||
<H5El className='social-people-filters'>
|
||||
{(
|
||||
[
|
||||
['all', '全部'],
|
||||
...Object.entries(TEAM_KIND_LABEL),
|
||||
] as [string, string][]
|
||||
).map(([id, label]) => (
|
||||
<H5El
|
||||
key={id}
|
||||
as='button'
|
||||
type='button'
|
||||
className={`social-people-filter${kind === id ? ' is-on active' : ''}`}
|
||||
onClick={() => setKind(id)}
|
||||
>
|
||||
{label}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
<H5El className='social-panel-grid social-panel-grid-2'>
|
||||
{roles.map((g, i) => (
|
||||
<H5El key={g.id} className='social-panel social-role-card'>
|
||||
<H5El as='span' className='social-role-emoji' aria-hidden>
|
||||
{ROLE_EMOJI[(g.kind || 'parttime') as SocialTeamKind] || '📝'}
|
||||
</H5El>
|
||||
<H5El as='span' className='social-muted'>
|
||||
{TEAM_KIND_LABEL[g.kind || 'parttime']}
|
||||
</H5El>
|
||||
<H5El as='strong'>{g.title}</H5El>
|
||||
<H5El as='p'>{g.role}</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
{g.pay} · {g.remote ? '线上也能做' : '可以见面做'}
|
||||
</H5El>
|
||||
<H5El className='social-tags'>
|
||||
{g.tags.slice(0, 4).map((t) => (
|
||||
<H5El as='span' key={t}>
|
||||
{t}
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-primary btn-sm'
|
||||
style={{ ['--stagger' as string]: `${i * 40}ms` }}
|
||||
onClick={() => setActive(g)}
|
||||
>
|
||||
我想参与 ↗
|
||||
</H5El>
|
||||
</H5El>
|
||||
))}
|
||||
</H5El>
|
||||
|
||||
{!roles.length ? (
|
||||
<H5El className='social-panel'>
|
||||
<H5El as='strong'>暂时没有合适的机会</H5El>
|
||||
<H5El as='p' className='social-muted'>
|
||||
换个词试试,或清空筛选。
|
||||
</H5El>
|
||||
<H5El
|
||||
as='button'
|
||||
type='button'
|
||||
className='btn btn-ghost'
|
||||
onClick={() => {
|
||||
setQuery('')
|
||||
setKind('all')
|
||||
}}
|
||||
>
|
||||
重新看看
|
||||
</H5El>
|
||||
</H5El>
|
||||
) : null}
|
||||
</H5El>
|
||||
|
||||
{active ? <ApplySheet gig={active} onClose={() => setActive(null)} /> : null}
|
||||
<SocialDock />
|
||||
</H5El>
|
||||
</SocialExperience>
|
||||
)
|
||||
}
|
||||
|
||||
export default function SocialTeamPage() {
|
||||
return (
|
||||
<MiniModuleGate moduleKey='social'>
|
||||
<SocialTeam />
|
||||
</MiniModuleGate>
|
||||
)
|
||||
}
|
||||
240
apps/miniprogram/h5/src/services/socialApi.ts
Normal file
240
apps/miniprogram/h5/src/services/socialApi.ts
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* 游民社区 API — 优先 api.nomadro.cn(微信合法域名),回退 nomadro.cn。
|
||||
*/
|
||||
import Taro from '@tarojs/taro'
|
||||
import { API_BASE, WEB_BASE } from '@/utils/config'
|
||||
|
||||
const GUEST_KEY = 'nomadro_social_guest'
|
||||
const APPLY_LOCAL_KEY = 'nomadro_social_gig_apps'
|
||||
|
||||
const SOCIAL_BASES = Array.from(
|
||||
new Set(
|
||||
[
|
||||
API_BASE.replace(/\/$/, ''),
|
||||
'https://api.nomadro.cn',
|
||||
WEB_BASE.replace(/\/$/, ''),
|
||||
'https://nomadro.cn',
|
||||
].filter(Boolean),
|
||||
),
|
||||
)
|
||||
|
||||
function guestId(): string {
|
||||
let id = String(Taro.getStorageSync(GUEST_KEY) || '')
|
||||
if (!id) {
|
||||
id = `g${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`
|
||||
Taro.setStorageSync(GUEST_KEY, id)
|
||||
}
|
||||
// 仅保留微信/流名安全字符
|
||||
return id.replace(/[^a-zA-Z0-9_-]/g, '').slice(0, 40) || `g${Date.now()}`
|
||||
}
|
||||
|
||||
export function getSocialGuestId() {
|
||||
return guestId()
|
||||
}
|
||||
|
||||
function errText(e: unknown, fallback: string) {
|
||||
if (!e) return fallback
|
||||
if (typeof e === 'string') return e
|
||||
const any = e as {
|
||||
errMsg?: string
|
||||
message?: string
|
||||
detail?: string
|
||||
}
|
||||
const raw = String(any.errMsg || any.message || any.detail || fallback)
|
||||
if (/url not in domain|不在以下 request|合法域名/i.test(raw)) {
|
||||
return '域名未配置:请加 api.nomadro.cn'
|
||||
}
|
||||
if (/timeout|超时/i.test(raw)) return '进厅超时,请重试'
|
||||
if (/fail|error/i.test(raw) && raw.length > 40) return raw.slice(0, 36)
|
||||
return raw.slice(0, 40)
|
||||
}
|
||||
|
||||
async function req<T>(
|
||||
path: string,
|
||||
init?: { method?: 'GET' | 'POST' | 'PUT'; data?: Record<string, unknown> },
|
||||
): Promise<T> {
|
||||
const gid = guestId()
|
||||
const qs = path.includes('?') ? `&guest=${encodeURIComponent(gid)}` : `?guest=${encodeURIComponent(gid)}`
|
||||
let lastErr: Error | null = null
|
||||
|
||||
for (const base of SOCIAL_BASES) {
|
||||
const url = `${base}/api/social/v1${path}${qs}`
|
||||
try {
|
||||
const res = await Taro.request({
|
||||
url,
|
||||
method: init?.method || 'GET',
|
||||
data: init?.data,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Social-Guest-Id': gid,
|
||||
},
|
||||
timeout: 12000,
|
||||
})
|
||||
if (res.statusCode >= 400) {
|
||||
const detail = (res.data as { detail?: unknown })?.detail
|
||||
const msg =
|
||||
typeof detail === 'string'
|
||||
? detail
|
||||
: Array.isArray(detail)
|
||||
? JSON.stringify(detail).slice(0, 80)
|
||||
: `HTTP ${res.statusCode}`
|
||||
lastErr = new Error(msg)
|
||||
// 404 换下一个域名
|
||||
continue
|
||||
}
|
||||
return res.data as T
|
||||
} catch (e) {
|
||||
lastErr = new Error(errText(e, '网络失败'))
|
||||
}
|
||||
}
|
||||
throw lastErr || new Error('进厅接口不可达')
|
||||
}
|
||||
|
||||
export type GigApplyPayload = {
|
||||
name: string
|
||||
contact: string
|
||||
note?: string
|
||||
}
|
||||
|
||||
export type LivePeer = {
|
||||
peerId: string
|
||||
nick: string
|
||||
playUrl: string
|
||||
stream?: string
|
||||
}
|
||||
|
||||
export type LiveJoinResult = {
|
||||
ok: boolean
|
||||
roomId: string
|
||||
peerId: string
|
||||
nick: string
|
||||
pushUrl: string
|
||||
playUrl: string
|
||||
stream: string
|
||||
peers: LivePeer[]
|
||||
maxPeers: number
|
||||
channelId: string
|
||||
engine: string
|
||||
}
|
||||
|
||||
export type SocialChatMessage = {
|
||||
id: string
|
||||
channelId: string
|
||||
author: string
|
||||
text: string
|
||||
at: string
|
||||
guestId?: string
|
||||
mine?: boolean
|
||||
delivery?: 'sent' | 'local' | 'pending'
|
||||
}
|
||||
|
||||
export type SocialRealtimeToken = {
|
||||
ok: boolean
|
||||
enabled: boolean
|
||||
wsUrl: string
|
||||
token: string
|
||||
channel: string
|
||||
}
|
||||
|
||||
function saveLocalApply(gigId: string, payload: GigApplyPayload) {
|
||||
try {
|
||||
const raw = Taro.getStorageSync(APPLY_LOCAL_KEY)
|
||||
const map = raw && typeof raw === 'object' ? { ...(raw as object) } : {}
|
||||
;(map as Record<string, unknown>)[gigId] = {
|
||||
...payload,
|
||||
at: Date.now(),
|
||||
delivery: 'local',
|
||||
}
|
||||
Taro.setStorageSync(APPLY_LOCAL_KEY, map)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
export function getLocalApply(
|
||||
gigId: string,
|
||||
): (GigApplyPayload & { delivery?: string }) | null {
|
||||
try {
|
||||
const raw = Taro.getStorageSync(APPLY_LOCAL_KEY)
|
||||
if (!raw || typeof raw !== 'object') return null
|
||||
const item = (raw as Record<string, GigApplyPayload & { delivery?: string }>)[
|
||||
gigId
|
||||
]
|
||||
return item || null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function markLocalApplySent(gigId: string) {
|
||||
try {
|
||||
const raw = Taro.getStorageSync(APPLY_LOCAL_KEY)
|
||||
const map = raw && typeof raw === 'object' ? { ...(raw as object) } : {}
|
||||
const prev = (map as Record<string, Record<string, unknown>>)[gigId] || {}
|
||||
;(map as Record<string, unknown>)[gigId] = {
|
||||
...prev,
|
||||
delivery: 'sent',
|
||||
at: Date.now(),
|
||||
}
|
||||
Taro.setStorageSync(APPLY_LOCAL_KEY, map)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
export const socialApi = {
|
||||
health: () =>
|
||||
req<{ ok: boolean; centrifugo?: boolean; isolated?: boolean }>('/health'),
|
||||
|
||||
realtimeToken: (channelId: string) =>
|
||||
req<SocialRealtimeToken>(
|
||||
`/realtime/token?channel_id=${encodeURIComponent(channelId)}`,
|
||||
),
|
||||
|
||||
listMessages: (channelId: string) =>
|
||||
req<{ items: SocialChatMessage[] }>(
|
||||
`/channels/${encodeURIComponent(channelId)}/messages`,
|
||||
),
|
||||
|
||||
sendMessage: (channelId: string, author: string, text: string) =>
|
||||
req<SocialChatMessage>(
|
||||
`/channels/${encodeURIComponent(channelId)}/messages`,
|
||||
{ method: 'POST', data: { author, text } },
|
||||
),
|
||||
|
||||
applyGig: async (gigId: string, payload: GigApplyPayload) => {
|
||||
try {
|
||||
const res = await req<{ ok?: boolean }>(
|
||||
`/gigs/${encodeURIComponent(gigId)}/apply`,
|
||||
{ method: 'POST', data: payload },
|
||||
)
|
||||
markLocalApplySent(gigId)
|
||||
return res
|
||||
} catch (e) {
|
||||
saveLocalApply(gigId, payload)
|
||||
throw e
|
||||
}
|
||||
},
|
||||
|
||||
liveJoin: (roomId: string, nick: string) =>
|
||||
req<LiveJoinResult>(`/live/rooms/${encodeURIComponent(roomId)}/join`, {
|
||||
method: 'POST',
|
||||
data: { nick },
|
||||
}),
|
||||
|
||||
liveHeartbeat: (roomId: string) =>
|
||||
req<{ ok: boolean; peers: LivePeer[]; peerCount: number }>(
|
||||
`/live/rooms/${encodeURIComponent(roomId)}/heartbeat`,
|
||||
{ method: 'POST' },
|
||||
),
|
||||
|
||||
livePeers: (roomId: string) =>
|
||||
req<{ ok: boolean; peers: LivePeer[] }>(
|
||||
`/live/rooms/${encodeURIComponent(roomId)}/peers`,
|
||||
),
|
||||
|
||||
liveLeave: (roomId: string) =>
|
||||
req<{ ok: boolean }>(`/live/rooms/${encodeURIComponent(roomId)}/leave`, {
|
||||
method: 'POST',
|
||||
}),
|
||||
}
|
||||
194
apps/miniprogram/h5/src/services/socialRealtime.ts
Normal file
194
apps/miniprogram/h5/src/services/socialRealtime.ts
Normal file
@ -0,0 +1,194 @@
|
||||
/**
|
||||
* Centrifugo WebSocket 客户端(微信小程序 Taro.connectSocket)
|
||||
* 协议:Centrifugo JSON (command/push)
|
||||
*/
|
||||
import Taro from '@tarojs/taro'
|
||||
import { socialApi, type SocialChatMessage, type SocialRealtimeToken } from './socialApi'
|
||||
|
||||
type PubHandler = (msg: SocialChatMessage) => void
|
||||
|
||||
function rewriteWsForWeapp(wsUrl: string): string[] {
|
||||
const raw = String(wsUrl || '').trim()
|
||||
const list: string[] = []
|
||||
if (raw) list.push(raw)
|
||||
// 真机 socket 合法域名常只有 api.nomadro.cn
|
||||
if (raw.includes('nomadro.cn') && !raw.includes('api.nomadro.cn')) {
|
||||
list.unshift(raw.replace('://nomadro.cn/', '://api.nomadro.cn/'))
|
||||
}
|
||||
if (!list.includes('wss://api.nomadro.cn/rt/connection/websocket')) {
|
||||
list.push('wss://api.nomadro.cn/rt/connection/websocket')
|
||||
}
|
||||
if (!list.includes('wss://nomadro.cn/rt/connection/websocket')) {
|
||||
list.push('wss://nomadro.cn/rt/connection/websocket')
|
||||
}
|
||||
return Array.from(new Set(list))
|
||||
}
|
||||
|
||||
export async function connectChatRealtime(
|
||||
channelId: string,
|
||||
onMessage: PubHandler,
|
||||
): Promise<{ disconnect: () => void } | null> {
|
||||
let info: SocialRealtimeToken
|
||||
try {
|
||||
info = await socialApi.realtimeToken(channelId)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
if (!info?.ok || !info.token) return null
|
||||
|
||||
const urls = rewriteWsForWeapp(info.wsUrl)
|
||||
const channel = info.channel || `social:${channelId}`
|
||||
|
||||
let task: Taro.SocketTask | null = null
|
||||
let closed = false
|
||||
let cmdId = 1
|
||||
|
||||
const sendCmd = (payload: Record<string, unknown>) => {
|
||||
if (!task || closed) return
|
||||
const id = cmdId++
|
||||
try {
|
||||
task.send({ data: JSON.stringify({ id, ...payload }) })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
const handleRaw = (raw: string) => {
|
||||
let msg: any
|
||||
try {
|
||||
msg = JSON.parse(raw)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
// reply
|
||||
if (msg.connect) {
|
||||
sendCmd({ subscribe: { channel } })
|
||||
return
|
||||
}
|
||||
// push publication
|
||||
const push = msg.push
|
||||
if (push?.pub?.data) {
|
||||
const data = push.pub.data as {
|
||||
type?: string
|
||||
message?: SocialChatMessage
|
||||
}
|
||||
if (data?.type === 'chat.message' && data.message?.id) {
|
||||
onMessage({
|
||||
id: data.message.id,
|
||||
channelId: data.message.channelId || channelId,
|
||||
author: data.message.author || '游民',
|
||||
text: data.message.text || '',
|
||||
at: data.message.at || new Date().toISOString(),
|
||||
guestId: data.message.guestId,
|
||||
mine: false,
|
||||
delivery: 'sent',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bind = (
|
||||
sock: Taro.SocketTask,
|
||||
finish: (ok: boolean) => void,
|
||||
markConnected: () => void,
|
||||
) => {
|
||||
const timer = setTimeout(() => {
|
||||
try {
|
||||
sock.close({})
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
finish(false)
|
||||
}, 8000)
|
||||
|
||||
sock.onOpen(() => {
|
||||
sendCmd({ connect: { token: info.token } })
|
||||
})
|
||||
sock.onMessage((ev) => {
|
||||
const data = typeof ev.data === 'string' ? ev.data : ''
|
||||
if (!data) return
|
||||
let msg: any
|
||||
try {
|
||||
msg = JSON.parse(data)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
if (msg.connect) {
|
||||
clearTimeout(timer)
|
||||
markConnected()
|
||||
sendCmd({ subscribe: { channel } })
|
||||
finish(true)
|
||||
return
|
||||
}
|
||||
handleRaw(data)
|
||||
})
|
||||
sock.onError(() => {
|
||||
clearTimeout(timer)
|
||||
finish(false)
|
||||
})
|
||||
sock.onClose(() => {
|
||||
clearTimeout(timer)
|
||||
finish(false)
|
||||
})
|
||||
}
|
||||
|
||||
const tryConnect = (index: number): Promise<boolean> =>
|
||||
new Promise((resolve) => {
|
||||
if (closed || index >= urls.length) {
|
||||
resolve(false)
|
||||
return
|
||||
}
|
||||
const url = urls[index]!
|
||||
let settled = false
|
||||
const finish = (ok: boolean) => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
resolve(ok)
|
||||
}
|
||||
|
||||
const openSocket = (sock: Taro.SocketTask) => {
|
||||
task = sock
|
||||
bind(sock, finish, () => undefined)
|
||||
}
|
||||
|
||||
try {
|
||||
const maybe = Taro.connectSocket({
|
||||
url,
|
||||
fail: () => finish(false),
|
||||
})
|
||||
// Taro 3:可能同步返回 SocketTask,或返回 Promise
|
||||
if (maybe && typeof (maybe as Taro.SocketTask).onOpen === 'function') {
|
||||
openSocket(maybe as Taro.SocketTask)
|
||||
} else {
|
||||
Promise.resolve(maybe as unknown as Promise<Taro.SocketTask>)
|
||||
.then(openSocket)
|
||||
.catch(() => finish(false))
|
||||
}
|
||||
} catch {
|
||||
finish(false)
|
||||
}
|
||||
})
|
||||
|
||||
// 依次尝试多个 wss
|
||||
for (let i = 0; i < urls.length; i += 1) {
|
||||
if (closed) break
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const ok = await tryConnect(i)
|
||||
if (ok) {
|
||||
return {
|
||||
disconnect: () => {
|
||||
closed = true
|
||||
try {
|
||||
task?.close({})
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
task = null
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export type { PubHandler }
|
||||
73
apps/miniprogram/h5/src/styles/social-next/bundle.scss
Normal file
73
apps/miniprogram/h5/src/styles/social-next/bundle.scss
Normal file
@ -0,0 +1,73 @@
|
||||
/* Same load order as src/app/social/layout.tsx — 1:1 with Next /social */
|
||||
@import './globals.css';
|
||||
@import './fx.css';
|
||||
@import './theme2.css';
|
||||
@import './home.css';
|
||||
@import './experience.css';
|
||||
@import './interaction.css';
|
||||
@import './studio.css';
|
||||
@import './motion.css';
|
||||
@import './depth.css';
|
||||
@import './vivid.css';
|
||||
@import './h5.css';
|
||||
|
||||
/* Taro H5 shell: hash router + dock safe area */
|
||||
.soc-taro-root {
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-mobile-dock {
|
||||
padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
.soc-taro-root img.social-avatar,
|
||||
.soc-taro-root .social-avatar img,
|
||||
.soc-taro-root .taro-img,
|
||||
.soc-taro-root .taro-img__mode-aspectFill {
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* Taro Text/View stand-ins for semantic tags used by Next CSS */
|
||||
.soc-taro-root .connection-copy .connection-title {
|
||||
display: block;
|
||||
font-size: clamp(2.4rem, 5vw, 4.2rem);
|
||||
font-weight: 780;
|
||||
line-height: 1.12;
|
||||
letter-spacing: -0.04em;
|
||||
margin: 0 0 14px;
|
||||
}
|
||||
.soc-taro-root .connection-way-copy text,
|
||||
.soc-taro-root .connection-way-copy .taro-text {
|
||||
display: block;
|
||||
}
|
||||
.soc-taro-root .connection-way-copy .taro-text:nth-child(1),
|
||||
.soc-taro-root .connection-way-copy > text:first-child,
|
||||
.soc-taro-root .connection-way-copy > span:first-child {
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
}
|
||||
.soc-taro-root .social-mobile-dock > div,
|
||||
.soc-taro-root .social-mobile-dock > .taro-view-core {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
min-height: 52px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.soc-taro-root .social-path-link {
|
||||
cursor: pointer;
|
||||
}
|
||||
.soc-taro-root .btn,
|
||||
.soc-taro-root .connection-film,
|
||||
.soc-taro-root .connection-way,
|
||||
.soc-taro-root .social-panel,
|
||||
.soc-taro-root .social-person-card {
|
||||
cursor: pointer;
|
||||
}
|
||||
14
apps/miniprogram/h5/src/styles/social-next/bundle.ts
Normal file
14
apps/miniprogram/h5/src/styles/social-next/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/** Same load order as src/app/social/layout.tsx — 1:1 with Next /social */
|
||||
import './community-globals.css'
|
||||
import './globals.css'
|
||||
import './fx.css'
|
||||
import './theme2.css'
|
||||
import './home.css'
|
||||
import './experience.css'
|
||||
import './interaction.css'
|
||||
import './studio.css'
|
||||
import './motion.css'
|
||||
import './depth.css'
|
||||
import './vivid.css'
|
||||
import './h5.css'
|
||||
import './taro-overrides.css'
|
||||
20
apps/miniprogram/h5/src/styles/social-next/bundle.weapp.ts
Normal file
20
apps/miniprogram/h5/src/styles/social-next/bundle.weapp.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 微信:与 Next /social H5 同款 CSS 源,但:
|
||||
* - 不用 community-globals 的 @layer / * reset
|
||||
* - 编译后由 sanitize-wxss 剥离 :has / :is / 残留 *
|
||||
* 视觉对齐 Next 移动端,不是另写一套缩水壳。
|
||||
*/
|
||||
import './community-globals.weapp.css'
|
||||
import './globals.css'
|
||||
import './fx.css'
|
||||
import './theme2.css'
|
||||
import './home.css'
|
||||
import './experience.css'
|
||||
import './interaction.css'
|
||||
import './studio.css'
|
||||
import './motion.css'
|
||||
import './depth.css'
|
||||
import './vivid.css'
|
||||
import './h5.css'
|
||||
import './taro-overrides.css'
|
||||
import './weapp-bridge.scss'
|
||||
12022
apps/miniprogram/h5/src/styles/social-next/community-globals.css
Normal file
12022
apps/miniprogram/h5/src/styles/social-next/community-globals.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,108 @@
|
||||
/* WeChat-safe seed: 变量 + 门户基础按钮/区块(community-globals 全量有 @layer/* 不可用) */
|
||||
page {
|
||||
--bg-primary: #0a0e17;
|
||||
--bg-secondary: #111827;
|
||||
--bg-card: rgba(17, 24, 39, 0.72);
|
||||
--bg-glass: rgba(255, 255, 255, 0.05);
|
||||
--text-primary: #f1f5f9;
|
||||
--text-secondary: #94a3b8;
|
||||
--text-muted: #64748b;
|
||||
--accent-1: #ff6b6b;
|
||||
--accent-2: #ffe66d;
|
||||
--accent-3: #4ecdc4;
|
||||
--accent-4: #4ecdc4;
|
||||
--gradient-main: linear-gradient(135deg, #ff6b6b, #ffe66d, #4ecdc4);
|
||||
--gradient-text: linear-gradient(135deg, #ff6b6b 0%, #ffe66d 50%, #4ecdc4 100%);
|
||||
--shadow-glow: 0 0 40px rgba(78, 205, 196, 0.15);
|
||||
--shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
--border-glass: 1px solid rgba(255, 255, 255, 0.08);
|
||||
--radius-sm: 8px;
|
||||
--radius-md: 16px;
|
||||
--radius-lg: 24px;
|
||||
--radius-xl: 32px;
|
||||
--font-display: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
|
||||
--font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
|
||||
--nav-height: 72px;
|
||||
--transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--sx-mint: #4ecdc4;
|
||||
--sx-coral: #ff7b75;
|
||||
--sx-gold: #ffe195;
|
||||
--sx-glass: #12141a;
|
||||
--sx-lift: 0 18px 40px rgba(0, 0, 0, 0.33);
|
||||
--connection-border: rgba(255, 255, 255, 0.1);
|
||||
background: #0a0e17;
|
||||
color: #f1f5f9;
|
||||
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root,
|
||||
.social-experience {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* —— 缺省按钮(原 community-globals,weapp 必带) —— */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
padding: 12px 22px;
|
||||
border-radius: 14px;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
font-family: inherit;
|
||||
text-decoration: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg, #ff6b6b, #ffe66d, #4ecdc4);
|
||||
color: #0a0e17;
|
||||
box-shadow: 0 4px 20px rgba(255, 107, 107, 0.28);
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
min-height: 40px;
|
||||
padding: 8px 16px;
|
||||
font-size: 12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.section {
|
||||
position: relative;
|
||||
padding: 48px 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
text-align: left;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.section-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 14px;
|
||||
border-radius: 100px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
color: #4ecdc4;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
1685
apps/miniprogram/h5/src/styles/social-next/depth.css
Normal file
1685
apps/miniprogram/h5/src/styles/social-next/depth.css
Normal file
File diff suppressed because it is too large
Load Diff
10
apps/miniprogram/h5/src/styles/social-next/entry.ts
Normal file
10
apps/miniprogram/h5/src/styles/social-next/entry.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* H5:完整 Next bundle。
|
||||
* 微信:同款视觉源(bundle.weapp)+ emit 后 sanitize,禁止另起缩水手写壳。
|
||||
* 无微信原生 tabBar;底栏仅 Next social-mobile-dock。
|
||||
*/
|
||||
if (process.env.TARO_ENV === 'h5') {
|
||||
require('./bundle')
|
||||
} else {
|
||||
require('./bundle.weapp')
|
||||
}
|
||||
1623
apps/miniprogram/h5/src/styles/social-next/experience.css
Normal file
1623
apps/miniprogram/h5/src/styles/social-next/experience.css
Normal file
File diff suppressed because it is too large
Load Diff
579
apps/miniprogram/h5/src/styles/social-next/fx.css
Normal file
579
apps/miniprogram/h5/src/styles/social-next/fx.css
Normal file
@ -0,0 +1,579 @@
|
||||
/* —— 动效强化(玻璃面板风格;禁止大图卡) —— */
|
||||
|
||||
.social-fx {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
overflow-x: clip;
|
||||
}
|
||||
|
||||
.social-fx #particle-canvas {
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.social-fx-orbs {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.social-fx-orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(70px);
|
||||
opacity: 0.35;
|
||||
animation: social-orb-drift 12s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.social-fx-orb.o1 {
|
||||
width: 340px;
|
||||
height: 340px;
|
||||
left: -80px;
|
||||
top: 18%;
|
||||
background: #ff6b6b;
|
||||
}
|
||||
|
||||
.social-fx-orb.o2 {
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
right: -60px;
|
||||
top: 48%;
|
||||
background: #4ecdc4;
|
||||
animation-delay: -4s;
|
||||
animation-duration: 14s;
|
||||
}
|
||||
|
||||
.social-fx-orb.o3 {
|
||||
width: 260px;
|
||||
height: 260px;
|
||||
left: 40%;
|
||||
bottom: 8%;
|
||||
background: #ffe66d;
|
||||
animation-delay: -7s;
|
||||
animation-duration: 16s;
|
||||
}
|
||||
|
||||
@keyframes social-orb-drift {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate(0, 0) scale(1);
|
||||
}
|
||||
33% {
|
||||
transform: translate(40px, -50px) scale(1.12);
|
||||
}
|
||||
66% {
|
||||
transform: translate(-30px, 30px) scale(0.92);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hero emoji rain */
|
||||
.social-hero-fx {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.social-emoji-field {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.social-emoji-float {
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
filter: none;
|
||||
animation-name: social-emoji-fly;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-iteration-count: infinite;
|
||||
will-change: transform, opacity;
|
||||
opacity: 0.22;
|
||||
}
|
||||
|
||||
.social-emoji-field-soft {
|
||||
z-index: 0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
@keyframes social-emoji-fly {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate3d(0, 4px, 0) rotate(-2deg) scale(1);
|
||||
opacity: 0.14;
|
||||
}
|
||||
50% {
|
||||
transform: translate3d(4px, -8px, 0) rotate(2deg) scale(1.04);
|
||||
opacity: 0.28;
|
||||
}
|
||||
}
|
||||
|
||||
/* Emoji marquee belt — quiet divider */
|
||||
.social-fx-belt {
|
||||
overflow: hidden;
|
||||
padding: 6px 0 10px;
|
||||
opacity: 0.35;
|
||||
mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
|
||||
}
|
||||
|
||||
.social-fx-belt-track {
|
||||
display: flex;
|
||||
width: max-content;
|
||||
gap: 0;
|
||||
animation: social-belt-run 48s linear infinite;
|
||||
}
|
||||
|
||||
.social-fx-belt-track span {
|
||||
padding-right: 56px;
|
||||
font-size: 0.95rem;
|
||||
letter-spacing: 0.45em;
|
||||
white-space: nowrap;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
@keyframes social-belt-run {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
to {
|
||||
transform: translateX(-33.333%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Section spark */
|
||||
.social-section-spark {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 8px;
|
||||
min-height: 28px;
|
||||
}
|
||||
|
||||
.social-section-spark-svg {
|
||||
width: min(240px, 72%);
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.social-spark-path {
|
||||
stroke-dasharray: 280;
|
||||
stroke-dashoffset: 280;
|
||||
}
|
||||
|
||||
.reveal.visible .social-spark-path {
|
||||
animation: social-spark-draw 1.1s ease forwards;
|
||||
}
|
||||
|
||||
@keyframes social-spark-draw {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.social-spark-dot {
|
||||
animation: social-spark-blink 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes social-spark-blink {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 0.35;
|
||||
r: 3;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
r: 6;
|
||||
}
|
||||
}
|
||||
|
||||
.social-title-emoji {
|
||||
display: inline-block;
|
||||
margin-right: 0.28em;
|
||||
opacity: 0.82;
|
||||
animation: none;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
@keyframes social-emoji-wiggle {
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0deg) scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: rotate(2deg) scale(1.02);
|
||||
}
|
||||
}
|
||||
|
||||
/* Path pills bounce in */
|
||||
.social-path-track.reveal.visible .social-path-link {
|
||||
animation: social-path-pop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
|
||||
}
|
||||
|
||||
.social-path-track.reveal.visible .social-path-link:nth-child(1) {
|
||||
animation-delay: 0.05s;
|
||||
}
|
||||
.social-path-track.reveal.visible .social-path-link:nth-child(2) {
|
||||
animation-delay: 0.12s;
|
||||
}
|
||||
.social-path-track.reveal.visible .social-path-link:nth-child(3) {
|
||||
animation-delay: 0.19s;
|
||||
}
|
||||
.social-path-track.reveal.visible .social-path-link:nth-child(4) {
|
||||
animation-delay: 0.26s;
|
||||
}
|
||||
|
||||
@keyframes social-path-pop {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(16px) scale(0.86);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.social-path-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.social-path-emoji {
|
||||
display: inline-block;
|
||||
font-size: 1.05rem;
|
||||
transition: transform 0.25s;
|
||||
}
|
||||
|
||||
.social-path-link:hover .social-path-emoji {
|
||||
animation: social-emoji-wiggle 0.55s ease;
|
||||
}
|
||||
|
||||
/* CTA pulse */
|
||||
.social-btn-pulse {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.social-btn-pulse::before,
|
||||
.social-btn-pulse::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -4px;
|
||||
border-radius: inherit;
|
||||
border: 2px solid rgba(78, 205, 196, 0.55);
|
||||
pointer-events: none;
|
||||
animation: social-btn-ring 1.6s ease-out infinite;
|
||||
}
|
||||
|
||||
.social-btn-pulse::before {
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
@keyframes social-btn-ring {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
opacity: 0.75;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1.28);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.social-promo-glow {
|
||||
animation: social-promo-breathe 3.2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes social-promo-breathe {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(78, 205, 196, 0);
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 48px 4px rgba(78, 205, 196, 0.28);
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
}
|
||||
|
||||
.social-promo-live {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 6px;
|
||||
border-radius: 999px;
|
||||
background: #22c55e;
|
||||
vertical-align: middle;
|
||||
animation: social-live-ping 1.2s ease-out infinite;
|
||||
}
|
||||
|
||||
@keyframes social-live-ping {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Panels: animate when revealed */
|
||||
.social-panel-fx {
|
||||
--stagger: 0ms;
|
||||
}
|
||||
|
||||
.reveal.visible .social-panel-fx,
|
||||
.social-panel-fx.reveal.visible {
|
||||
animation: social-panel-in 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) both;
|
||||
animation-delay: var(--stagger, 0ms);
|
||||
}
|
||||
|
||||
@keyframes social-panel-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(28px) scale(0.96) rotateX(6deg);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.social-panel-fx:hover {
|
||||
transform: translateY(-6px) scale(1.01);
|
||||
box-shadow: var(--shadow-glow), 0 0 0 1px rgba(78, 205, 196, 0.28);
|
||||
transition: transform 0.25s, box-shadow 0.25s;
|
||||
}
|
||||
|
||||
.social-panel-ico {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 16px;
|
||||
border: var(--border-glass);
|
||||
background: color-mix(in srgb, var(--accent-3, #4ecdc4) 14%, transparent);
|
||||
font-size: 1.45rem;
|
||||
color: var(--accent-3, #4ecdc4);
|
||||
animation: social-ico-bounce 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.social-panel-ico-bounce {
|
||||
animation-duration: 1.6s;
|
||||
}
|
||||
|
||||
@keyframes social-ico-bounce {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateY(0) rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-8px) rotate(-6deg);
|
||||
}
|
||||
}
|
||||
|
||||
.social-ring-spin {
|
||||
transform-origin: 24px 24px;
|
||||
animation: social-ring-spin 3.5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes social-ring-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* People chips */
|
||||
.social-chip-pop {
|
||||
animation: social-chip-in 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.15) both;
|
||||
animation-delay: var(--stagger, 0ms);
|
||||
}
|
||||
|
||||
@keyframes social-chip-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.5) translateY(12px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.social-people-chip:hover {
|
||||
transform: translateY(-6px) scale(1.05) !important;
|
||||
}
|
||||
|
||||
.social-people-chip.is-online .social-people-chip-ava::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -4px;
|
||||
border-radius: 999px;
|
||||
border: 2px solid rgba(78, 205, 196, 0.65);
|
||||
animation: social-btn-ring 1.4s ease-out infinite;
|
||||
}
|
||||
|
||||
.social-people-bar-avs img {
|
||||
animation: social-ava-bob 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.social-people-bar-avs img:nth-child(2) {
|
||||
animation-delay: 0.15s;
|
||||
}
|
||||
.social-people-bar-avs img:nth-child(3) {
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
.social-people-bar-avs img:nth-child(4) {
|
||||
animation-delay: 0.45s;
|
||||
}
|
||||
.social-people-bar-avs img:nth-child(5) {
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
.social-people-bar-avs img:nth-child(6) {
|
||||
animation-delay: 0.75s;
|
||||
}
|
||||
|
||||
@keyframes social-ava-bob {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
.social-chip-heart {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -6px;
|
||||
font-style: normal;
|
||||
font-size: 0.8rem;
|
||||
color: #ff6b6b;
|
||||
animation: social-heart-pop 0.45s ease;
|
||||
}
|
||||
|
||||
@keyframes social-heart-pop {
|
||||
from {
|
||||
transform: scale(0);
|
||||
}
|
||||
70% {
|
||||
transform: scale(1.35);
|
||||
}
|
||||
to {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.social-count-pulse {
|
||||
display: inline-block;
|
||||
color: var(--accent-3, #4ecdc4);
|
||||
animation: social-count-glow 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes social-count-glow {
|
||||
0%,
|
||||
100% {
|
||||
text-shadow: 0 0 0 transparent;
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
text-shadow: 0 0 16px rgba(78, 205, 196, 0.9);
|
||||
transform: scale(1.08);
|
||||
}
|
||||
}
|
||||
|
||||
.social-detail-in {
|
||||
animation: social-detail-slide 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@keyframes social-detail-slide {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(16px) scale(0.98);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.social-burst {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 0.2em;
|
||||
pointer-events: none;
|
||||
opacity: 0.55;
|
||||
animation: social-burst-up 0.55s ease forwards;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
@keyframes social-burst-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(6px) scale(0.9);
|
||||
}
|
||||
40% {
|
||||
opacity: 0.55;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: translateY(-18px) scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.social-logo-spin {
|
||||
display: inline-block;
|
||||
animation: social-logo-spin 6s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes social-logo-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.social-panel .btn-sm {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.social-hero-fx .shape {
|
||||
animation-duration: 5.5s !important;
|
||||
opacity: 0.55 !important;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.social-experience[data-immersive="false"] .social-emoji-float,
|
||||
.social-experience[data-immersive="false"] .social-fx-orb,
|
||||
.social-experience[data-immersive="false"] .social-fx-belt-track,
|
||||
.social-experience[data-immersive="false"] .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="false"] .social-btn-pulse::after,
|
||||
.social-experience[data-immersive="false"] .social-promo-glow,
|
||||
.social-experience[data-immersive="false"] .social-promo-live,
|
||||
.social-experience[data-immersive="false"] .social-panel-fx,
|
||||
.social-experience[data-immersive="false"] .social-chip-pop,
|
||||
.social-experience[data-immersive="false"] .social-title-emoji,
|
||||
.social-experience[data-immersive="false"] .social-panel-ico,
|
||||
.social-experience[data-immersive="false"] .social-ring-spin,
|
||||
.social-experience[data-immersive="false"] .social-logo-spin,
|
||||
.social-experience[data-immersive="false"]
|
||||
.social-people-chip.is-online
|
||||
.social-people-chip-ava::before,
|
||||
.social-experience[data-immersive="false"] .social-people-bar-avs img,
|
||||
.social-experience[data-immersive="false"] .social-count-pulse,
|
||||
.social-experience[data-immersive="false"] .social-spark-path,
|
||||
.social-experience[data-immersive="false"] .social-spark-dot,
|
||||
.social-experience[data-immersive="false"] .social-hero-fx .shape {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
1757
apps/miniprogram/h5/src/styles/social-next/globals.css
Normal file
1757
apps/miniprogram/h5/src/styles/social-next/globals.css
Normal file
File diff suppressed because it is too large
Load Diff
1472
apps/miniprogram/h5/src/styles/social-next/h5.css
Normal file
1472
apps/miniprogram/h5/src/styles/social-next/h5.css
Normal file
File diff suppressed because it is too large
Load Diff
2195
apps/miniprogram/h5/src/styles/social-next/home.css
Normal file
2195
apps/miniprogram/h5/src/styles/social-next/home.css
Normal file
File diff suppressed because it is too large
Load Diff
1585
apps/miniprogram/h5/src/styles/social-next/interaction.css
Normal file
1585
apps/miniprogram/h5/src/styles/social-next/interaction.css
Normal file
File diff suppressed because it is too large
Load Diff
542
apps/miniprogram/h5/src/styles/social-next/motion.css
Normal file
542
apps/miniprogram/h5/src/styles/social-next/motion.css
Normal file
@ -0,0 +1,542 @@
|
||||
/* Immersive motion — beat Codex home.css mutes (loaded last). */
|
||||
|
||||
.social-experience[data-immersive="true"] .social-ambient i {
|
||||
opacity: 0.22 !important;
|
||||
filter: blur(80px);
|
||||
animation: sx-aurora 18s ease-in-out infinite alternate !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-ambient i:nth-child(2) {
|
||||
opacity: 0.16 !important;
|
||||
animation-duration: 22s !important;
|
||||
animation-direction: alternate-reverse !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-ambient i:nth-child(3) {
|
||||
opacity: 0.12 !important;
|
||||
animation-duration: 26s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orbs {
|
||||
opacity: 0.72 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb.o3 {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb {
|
||||
animation: social-orb-drift 8s ease-in-out infinite !important;
|
||||
filter: blur(48px) !important;
|
||||
opacity: 0.62 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb.o2 {
|
||||
animation-duration: 10s !important;
|
||||
animation-delay: -3s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb.o3 {
|
||||
animation-duration: 12s !important;
|
||||
animation-delay: -6s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-constellation {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-pointer-glow {
|
||||
background: radial-gradient(
|
||||
480px circle at var(--pointer-x, -1000px) var(--pointer-y, -1000px),
|
||||
rgba(78, 205, 196, 0.18),
|
||||
rgba(255, 107, 107, 0.06) 42%,
|
||||
transparent 72%
|
||||
) !important;
|
||||
}
|
||||
|
||||
/* Hero floating emoji */
|
||||
.connection-hero {
|
||||
position: relative;
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.connection-hero .social-emoji-field {
|
||||
z-index: 0;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.connection-hero-layout {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-emoji-float {
|
||||
opacity: 0.22 !important;
|
||||
filter: none !important;
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-timing-function: ease-in-out !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="false"] .social-emoji-field,
|
||||
.social-experience[data-immersive="false"] .social-fx-belt {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Signal bars */
|
||||
.social-experience[data-immersive="true"] .connection-signal i {
|
||||
animation: social-signal-bars 1s ease-in-out infinite !important;
|
||||
transform-origin: bottom !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-signal i:nth-child(2) {
|
||||
animation-delay: 0.1s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-signal i:nth-child(3) {
|
||||
animation-delay: 0.2s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-signal i:nth-child(4) {
|
||||
animation-delay: 0.3s !important;
|
||||
}
|
||||
|
||||
@keyframes social-signal-bars {
|
||||
0%,
|
||||
100% {
|
||||
transform: scaleY(0.4);
|
||||
opacity: 0.4;
|
||||
}
|
||||
50% {
|
||||
transform: scaleY(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-status-dot {
|
||||
box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.6) !important;
|
||||
animation: social-live-ping 1.25s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-orbit-traveler {
|
||||
animation-duration: 12s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-orbit-traveler-second {
|
||||
animation-duration: 16s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-flight-path {
|
||||
animation-duration: 10s !important;
|
||||
opacity: 0.95 !important;
|
||||
stroke-width: 2.2 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-center-icon {
|
||||
animation: social-center-glow 2.4s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-center-icon svg {
|
||||
animation: connection-breathe 2s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
@keyframes social-center-glow {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow:
|
||||
0 0 36px rgba(78, 205, 196, 0.14),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
50% {
|
||||
box-shadow:
|
||||
0 0 80px rgba(78, 205, 196, 0.42),
|
||||
0 0 120px rgba(255, 107, 107, 0.12),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.16);
|
||||
}
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-person {
|
||||
animation-duration: 4s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-universe:hover .connection-person,
|
||||
.social-experience[data-immersive="true"]
|
||||
.connection-universe:focus-within
|
||||
.connection-person {
|
||||
animation-play-state: running !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-person-avatar > i {
|
||||
animation: social-live-ping 1.35s ease-out infinite !important;
|
||||
}
|
||||
|
||||
/* Title emoji: visible but calm (no infinite wiggle) */
|
||||
.social-experience[data-immersive="true"] .social-home .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
margin-right: 0.28em !important;
|
||||
animation: none !important;
|
||||
opacity: 0.85 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse {
|
||||
position: relative !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::after {
|
||||
content: "" !important;
|
||||
display: block !important;
|
||||
position: absolute !important;
|
||||
inset: -5px !important;
|
||||
border-radius: inherit !important;
|
||||
border: 2px solid rgba(78, 205, 196, 0.55) !important;
|
||||
pointer-events: none !important;
|
||||
animation: social-btn-ring 1.4s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::before {
|
||||
animation-delay: 0.7s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-people-bar-avs img {
|
||||
animation: social-ava-bob 1.8s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-people-bar-avs
|
||||
img:nth-child(2) {
|
||||
animation-delay: 0.1s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-people-bar-avs
|
||||
img:nth-child(3) {
|
||||
animation-delay: 0.2s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-people-bar-avs
|
||||
img:nth-child(4) {
|
||||
animation-delay: 0.3s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-count-pulse {
|
||||
animation: social-count-glow 1.15s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .nav-logo .logo-icon {
|
||||
animation: social-logo-spin 6s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-path-track a,
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-track.reveal.visible
|
||||
.social-path-link {
|
||||
animation: social-path-pop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1.15) both !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-track.reveal.visible
|
||||
a:nth-child(1) {
|
||||
animation-delay: 0.04s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-track.reveal.visible
|
||||
a:nth-child(2) {
|
||||
animation-delay: 0.1s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-track.reveal.visible
|
||||
a:nth-child(3) {
|
||||
animation-delay: 0.16s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-track.reveal.visible
|
||||
a:nth-child(4) {
|
||||
animation-delay: 0.22s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-path-emoji {
|
||||
display: inline-block !important;
|
||||
transition: transform 0.25s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.social-path-link:hover
|
||||
.social-path-emoji {
|
||||
animation: social-emoji-wiggle 0.5s ease !important;
|
||||
}
|
||||
|
||||
/* Meetup equalizer always on in immersive */
|
||||
.social-experience[data-immersive="true"] .connection-audio-bars i {
|
||||
animation: connection-audio 1.05s ease-in-out infinite !important;
|
||||
animation-play-state: running !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.connection-cafe
|
||||
.social-panel-ico {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-home
|
||||
.connection-cafe:hover
|
||||
.social-panel-ico {
|
||||
animation: social-ico-bounce 1.55s ease-in-out 1 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-chip-pop {
|
||||
animation: social-chip-in 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.15) both !important;
|
||||
animation-delay: var(--stagger, 0ms) !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-people-chip.is-online
|
||||
.social-people-chip-ava {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-people-chip.is-online
|
||||
.social-people-chip-ava::before {
|
||||
content: "" !important;
|
||||
position: absolute !important;
|
||||
inset: -5px !important;
|
||||
border-radius: 999px !important;
|
||||
border: 2px solid rgba(78, 205, 196, 0.7) !important;
|
||||
animation: social-btn-ring 1.25s ease-out infinite !important;
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
/* Emoji belt */
|
||||
.social-experience[data-immersive="true"] .social-fx-belt {
|
||||
opacity: 1 !important;
|
||||
padding: 14px 0 22px !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-fx-belt-track {
|
||||
animation: social-belt-run 14s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-fx-belt-track span {
|
||||
font-size: 1.65rem !important;
|
||||
opacity: 0.82 !important;
|
||||
letter-spacing: 0.45em !important;
|
||||
}
|
||||
|
||||
/* Join CTA ring */
|
||||
.social-experience[data-immersive="true"] .connection-join {
|
||||
position: relative !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-join::after {
|
||||
content: "" !important;
|
||||
position: absolute !important;
|
||||
inset: -6px !important;
|
||||
border-radius: inherit !important;
|
||||
border: 2px solid rgba(255, 107, 107, 0.5) !important;
|
||||
animation: social-btn-ring 1.45s ease-out infinite !important;
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
/* Section spark always draws when visible */
|
||||
.social-experience[data-immersive="true"] .reveal.visible .social-spark-path {
|
||||
animation: social-spark-draw 1s ease forwards !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-spark-dot {
|
||||
animation: social-spark-blink 1.2s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
/* Panel lift */
|
||||
.social-experience[data-immersive="true"] .reveal.visible .social-panel-fx,
|
||||
.social-experience[data-immersive="true"] .social-panel-fx.reveal.visible {
|
||||
animation: social-panel-in 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
|
||||
animation-delay: var(--stagger, 0ms) !important;
|
||||
}
|
||||
|
||||
/* Workspace subpages share immersive FX with home */
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orbs {
|
||||
opacity: 0.58 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orb {
|
||||
animation: social-orb-drift 9s ease-in-out infinite !important;
|
||||
filter: blur(52px) !important;
|
||||
opacity: 0.55 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
margin-right: 0.28em;
|
||||
animation: none !important;
|
||||
opacity: 0.85 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse {
|
||||
position: relative !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::after {
|
||||
content: "" !important;
|
||||
display: block !important;
|
||||
position: absolute !important;
|
||||
inset: -5px !important;
|
||||
border-radius: inherit !important;
|
||||
border: 2px solid rgba(78, 205, 196, 0.5) !important;
|
||||
pointer-events: none !important;
|
||||
animation: social-btn-ring 1.45s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before {
|
||||
animation-delay: 0.7s !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-room-hero-emoji i {
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-timing-function: ease-in-out !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
opacity: 0.25 !important;
|
||||
filter: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-role-art > i {
|
||||
animation: sx-orbit 18s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-page-intro .social-emoji-float {
|
||||
opacity: 0.2 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
* Immersive is an explicit opt-in. It must beat OS prefers-reduced-motion
|
||||
* (Windows “显示动画” off, automation browsers, etc.). Light mode still respects reduce.
|
||||
*/
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.social-experience[data-immersive="true"] .social-constellation,
|
||||
.social-experience[data-immersive="true"] .social-pointer-glow {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-emoji-float {
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-timing-function: ease-in-out !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-fx-orb,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-fx-orb {
|
||||
animation: social-orb-drift 8s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-title-emoji {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-room-hero-emoji i {
|
||||
animation-name: social-emoji-fly !important;
|
||||
animation-iteration-count: infinite !important;
|
||||
opacity: 0.22 !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-workspace .social-btn-pulse::after {
|
||||
animation: social-btn-ring 1.45s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-fx-belt-track {
|
||||
animation: social-belt-run 48s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-signal i {
|
||||
animation: social-signal-bars 1s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-status-dot,
|
||||
.social-experience[data-immersive="true"] .connection-person-avatar > i {
|
||||
animation: social-live-ping 1.25s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-orbit-traveler {
|
||||
animation-duration: 12s !important;
|
||||
animation-play-state: running !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-flight-path {
|
||||
animation-play-state: running !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-center-icon {
|
||||
animation: social-center-glow 2.4s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-center-icon svg {
|
||||
animation: connection-breathe 2s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-title-emoji {
|
||||
display: inline-block !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::before,
|
||||
.social-experience[data-immersive="true"] .social-home .social-btn-pulse::after,
|
||||
.social-experience[data-immersive="true"] .connection-join::after,
|
||||
.social-experience[data-immersive="true"]
|
||||
.social-people-chip.is-online
|
||||
.social-people-chip-ava::before {
|
||||
animation: social-btn-ring 1.4s ease-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .connection-audio-bars i {
|
||||
animation: connection-audio 1.05s ease-in-out infinite !important;
|
||||
animation-play-state: running !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .connection-cafe .social-panel-ico {
|
||||
animation: social-ico-bounce 1.55s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-people-bar-avs img {
|
||||
animation: social-ava-bob 1.8s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .social-count-pulse {
|
||||
animation: social-count-glow 1.15s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-home .nav-logo .logo-icon {
|
||||
animation: social-logo-spin 6s linear infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-ambient i {
|
||||
animation: sx-aurora 18s ease-in-out infinite alternate !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .social-spark-dot {
|
||||
animation: social-spark-blink 1.2s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
.social-experience[data-immersive="true"] .reveal.visible .social-spark-path {
|
||||
animation: social-spark-draw 1s ease forwards !important;
|
||||
}
|
||||
}
|
||||
735
apps/miniprogram/h5/src/styles/social-next/studio.css
Normal file
735
apps/miniprogram/h5/src/styles/social-next/studio.css
Normal file
@ -0,0 +1,735 @@
|
||||
.social-fieldset {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.social-fieldset:disabled {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.social-profile-studio {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
|
||||
gap: 28px;
|
||||
align-items: start;
|
||||
}
|
||||
.social-profile-studio .social-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.social-profile-studio .social-section-label {
|
||||
margin-top: 0;
|
||||
}
|
||||
.social-profile-studio .social-form small {
|
||||
text-align: right;
|
||||
color: var(--text-muted);
|
||||
font-size: 10px;
|
||||
}
|
||||
.social-profile-preview {
|
||||
min-width: 0;
|
||||
padding: 12px 8px;
|
||||
}
|
||||
.social-profile-passport {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
overflow: hidden;
|
||||
min-height: 415px;
|
||||
border: 1px solid #4ecdc43b;
|
||||
border-radius: 22px;
|
||||
padding: 31px;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
color-mix(in srgb, var(--bg-secondary) 85%, #4ecdc4),
|
||||
var(--bg-secondary) 62%
|
||||
);
|
||||
box-shadow: 0 20px 55px #0002;
|
||||
transform: perspective(1000px) rotateY(-4deg) rotateX(2deg);
|
||||
transition:
|
||||
transform 0.6s var(--sx-ease),
|
||||
box-shadow 0.6s;
|
||||
}
|
||||
.social-profile-passport:hover {
|
||||
transform: perspective(1000px) rotateY(0) rotateX(0) translateY(-5px);
|
||||
box-shadow: 0 26px 65px #4ecdc415;
|
||||
}
|
||||
.social-passport-pattern {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
color: #4ecdc430;
|
||||
top: 13px;
|
||||
right: -35px;
|
||||
animation: sx-orbit 90s linear infinite;
|
||||
}
|
||||
.social-profile-monogram {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid #4ecdc443;
|
||||
border-radius: 18px;
|
||||
color: var(--sx-mint);
|
||||
font-size: 28px;
|
||||
background: #4ecdc40c;
|
||||
margin-bottom: 24px;
|
||||
box-shadow: 0 0 35px #4ecdc411;
|
||||
}
|
||||
.social-profile-passport .social-page-kicker {
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.18em;
|
||||
}
|
||||
.social-profile-passport h2 {
|
||||
font-size: 30px;
|
||||
margin: 11px 0 6px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.social-profile-passport > p {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.9;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.social-profile-passport .social-member-city {
|
||||
margin: 15px 0;
|
||||
}
|
||||
.social-profile-passport .social-tags {
|
||||
margin: 16px 0;
|
||||
}
|
||||
.social-profile-passport .social-profile-bio {
|
||||
min-height: 55px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.social-profile-passport footer {
|
||||
margin-top: 25px;
|
||||
border-top: 1px dashed var(--sx-line);
|
||||
padding-top: 17px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.15em;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.social-profile-passport footer span {
|
||||
font-size: 18px;
|
||||
color: var(--sx-coral);
|
||||
}
|
||||
.social-profile-progress {
|
||||
margin: 27px 0;
|
||||
}
|
||||
.social-profile-progress > div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 11px;
|
||||
margin-bottom: 9px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.social-profile-progress strong {
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
.social-profile-progress progress {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
appearance: none;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-profile-progress progress::-webkit-progress-bar {
|
||||
background: var(--bg-glass);
|
||||
}
|
||||
.social-profile-progress progress::-webkit-progress-value {
|
||||
background: var(--sx-mint);
|
||||
transition: width 0.6s var(--sx-ease);
|
||||
}
|
||||
.social-profile-progress p {
|
||||
font-size: 10px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 9px;
|
||||
}
|
||||
.social-role-card {
|
||||
gap: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-role-art {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-height: 88px;
|
||||
margin: -4px -4px 4px;
|
||||
border-radius: 14px;
|
||||
background:
|
||||
radial-gradient(circle at 20% 30%, #4ecdc433, transparent 55%),
|
||||
radial-gradient(circle at 80% 70%, #ff6b6b28, transparent 50%),
|
||||
linear-gradient(135deg, #4ecdc40f, #ffe66d0a);
|
||||
color: var(--sx-mint);
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-role-art > span {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 10px;
|
||||
font-family: var(--font-display, inherit);
|
||||
font-size: 28px;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.06em;
|
||||
opacity: 0.22;
|
||||
}
|
||||
.social-role-art > i {
|
||||
position: absolute;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border: 1px solid #4ecdc433;
|
||||
border-radius: 50%;
|
||||
animation: sx-orbit 22s linear infinite;
|
||||
}
|
||||
.social-role-art > i:nth-of-type(2) {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border-color: #ff6b6b33;
|
||||
animation-direction: reverse;
|
||||
animation-duration: 16s;
|
||||
}
|
||||
.social-role-art > svg {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.social-role-symbol {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid #4ecdc42b;
|
||||
color: var(--sx-mint);
|
||||
background: #4ecdc40c;
|
||||
transition:
|
||||
rotate 0.5s var(--sx-ease),
|
||||
scale 0.5s;
|
||||
}
|
||||
.social-role-symbol.tone-1 {
|
||||
color: var(--sx-coral);
|
||||
background: #ff6b6b0c;
|
||||
border-color: #ff6b6b2b;
|
||||
}
|
||||
.social-role-symbol.tone-2 {
|
||||
color: var(--sx-gold);
|
||||
background: #ffe1950c;
|
||||
border-color: #ffe1952b;
|
||||
}
|
||||
.social-role-card:hover .social-role-symbol {
|
||||
rotate: -7deg;
|
||||
scale: 1.08;
|
||||
}
|
||||
.social-role-type {
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
.social-role-card h2 {
|
||||
font-size: 19px;
|
||||
}
|
||||
.social-role-card > p {
|
||||
margin: 0;
|
||||
}
|
||||
.social-role-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
padding-block: 13px;
|
||||
border-block: 1px solid var(--sx-line);
|
||||
font-size: 10px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.social-role-meta > span:first-child {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.social-role-card .social-tags {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.social-role-card > .social-btn {
|
||||
margin-top: auto;
|
||||
}
|
||||
.social-library-card {
|
||||
padding: 16px !important;
|
||||
gap: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.social-library-art {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 100%;
|
||||
height: 205px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--sx-line);
|
||||
border-radius: 13px;
|
||||
background:
|
||||
radial-gradient(ellipse at 80% 0%, #4ecdc42a, transparent 70%),
|
||||
linear-gradient(160deg, #15302e, #142231 70%);
|
||||
color: #e4f1ee;
|
||||
overflow: hidden;
|
||||
isolation: isolate;
|
||||
cursor: pointer;
|
||||
}
|
||||
.social-library-art.library-tone-1 {
|
||||
background:
|
||||
radial-gradient(ellipse at 80% 0%, #ff6b6b3b, transparent 70%),
|
||||
linear-gradient(160deg, #3c262a, #192534 70%);
|
||||
}
|
||||
.social-library-art.library-tone-2 {
|
||||
background:
|
||||
radial-gradient(ellipse at 80% 0%, #ffe19527, transparent 70%),
|
||||
linear-gradient(160deg, #333427, #172835 70%);
|
||||
}
|
||||
.social-library-number {
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
left: 18px;
|
||||
font-size: 10px;
|
||||
font-family: monospace;
|
||||
letter-spacing: 0.15em;
|
||||
color: #fff7;
|
||||
}
|
||||
.social-film-scene {
|
||||
font-size: 63px;
|
||||
filter: drop-shadow(0 12px 18px #0004);
|
||||
transition: transform 0.65s var(--sx-ease);
|
||||
transform: rotate(-8deg);
|
||||
}
|
||||
.social-library-art:hover .social-film-scene {
|
||||
transform: rotate(6deg) scale(1.15) translateY(-7px);
|
||||
}
|
||||
.social-film-orbit {
|
||||
position: absolute;
|
||||
width: 230px;
|
||||
height: 230px;
|
||||
border: 1px solid #4ecdc42b;
|
||||
border-radius: 50%;
|
||||
transform: rotateX(58deg) rotate(-25deg);
|
||||
animation: social-film-drift 9s ease-in-out infinite alternate;
|
||||
}
|
||||
.social-film-orbit::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 25px;
|
||||
border: 1px dashed #ffffff20;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.social-film-grain {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0.4;
|
||||
background-image: radial-gradient(#fff4 0.6px, transparent 0.6px);
|
||||
background-size: 5px 5px;
|
||||
pointer-events: none;
|
||||
mask-image: linear-gradient(transparent, #000);
|
||||
}
|
||||
.social-film-play {
|
||||
position: absolute;
|
||||
right: 17px;
|
||||
bottom: 16px;
|
||||
width: 41px;
|
||||
height: 41px;
|
||||
border: 1px solid #ffffff40;
|
||||
border-radius: 50%;
|
||||
background: #ffffff0b;
|
||||
backdrop-filter: blur(7px);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transition:
|
||||
background 0.25s,
|
||||
scale 0.25s;
|
||||
}
|
||||
.social-library-art:hover .social-film-play {
|
||||
background: #4ecdc42a;
|
||||
scale: 1.1;
|
||||
}
|
||||
.social-library-art > small {
|
||||
position: absolute;
|
||||
left: 18px;
|
||||
bottom: 21px;
|
||||
font-size: 10px;
|
||||
color: #ffffffa8;
|
||||
}
|
||||
.social-library-meta {
|
||||
font-size: 10px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.social-library-card h2 {
|
||||
font-size: 18px;
|
||||
letter-spacing: -0.02em;
|
||||
padding-inline: 3px;
|
||||
}
|
||||
.social-library-card > p {
|
||||
padding-inline: 3px;
|
||||
min-height: 43px;
|
||||
}
|
||||
.social-library-card .social-card-actions {
|
||||
margin-top: auto;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.social-library-grid.is-books {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.is-books .social-library-art {
|
||||
height: 265px;
|
||||
}
|
||||
.social-book-cover {
|
||||
width: 155px;
|
||||
height: 212px;
|
||||
border-radius: 2px 9px 9px 2px;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
#4ecdc438 0 4px,
|
||||
#0d302c 4px,
|
||||
#134a43 10px,
|
||||
#173b35 11px,
|
||||
#173b35 100%
|
||||
);
|
||||
box-shadow:
|
||||
-14px 15px 30px #0004,
|
||||
inset -4px 0 0 #ffffff12;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
color: #b7e0d2;
|
||||
transform: perspective(600px) rotateY(-14deg) rotateZ(-8deg);
|
||||
transition: transform 0.6s var(--sx-ease);
|
||||
}
|
||||
.library-tone-1 .social-book-cover {
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
#ff6b6b38 0 4px,
|
||||
#4a2327 4px,
|
||||
#612d34 10px,
|
||||
#4b2930 11px,
|
||||
#4b2930 100%
|
||||
);
|
||||
color: #eec3b4;
|
||||
}
|
||||
.social-library-art:hover .social-book-cover {
|
||||
transform: perspective(600px) rotateY(-2deg) rotateZ(0) translateY(-5px);
|
||||
}
|
||||
.social-book-cover small {
|
||||
font-size: 6px;
|
||||
letter-spacing: 0.15em;
|
||||
}
|
||||
.social-book-cover strong {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
}
|
||||
.social-book-cover > span {
|
||||
font-size: 5px;
|
||||
margin-top: auto;
|
||||
letter-spacing: 0.12em;
|
||||
}
|
||||
.social-resource-player {
|
||||
width: 100%;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 20px;
|
||||
background: #000;
|
||||
max-height: 360px;
|
||||
}
|
||||
.social-library-prompt {
|
||||
padding: 20px;
|
||||
border: 1px solid var(--sx-line);
|
||||
border-radius: 12px;
|
||||
background: #4ecdc406;
|
||||
}
|
||||
.social-library-prompt span {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
color: var(--sx-mint);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.social-library-prompt strong {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.social-feedback-panel {
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
.social-feedback-heading {
|
||||
display: flex;
|
||||
gap: 19px;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.social-feedback-heart {
|
||||
color: var(--sx-coral);
|
||||
width: 65px;
|
||||
height: 65px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid #ff6b6b30;
|
||||
border-radius: 19px;
|
||||
background: #ff6b6b07;
|
||||
flex-shrink: 0;
|
||||
animation: sx-breathe 4s ease-in-out infinite;
|
||||
}
|
||||
.social-feedback-heading h2 {
|
||||
font-size: 21px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
.social-feedback-heading p {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.social-welcome-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
padding: 30px;
|
||||
margin-bottom: 25px;
|
||||
border: 1px solid #4ecdc432;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(110deg, #4ecdc40c, transparent);
|
||||
}
|
||||
.social-welcome-banner h2 {
|
||||
font-size: 21px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.social-welcome-banner p {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.8;
|
||||
}
|
||||
.social-welcome-banner .social-btn {
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.social-welcome-faces {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 85px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.social-welcome-faces span {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 39px;
|
||||
height: 39px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--sx-line);
|
||||
background: var(--bg-secondary);
|
||||
font-size: 19px;
|
||||
margin: -2px;
|
||||
animation: social-welcome-bob 4s ease-in-out infinite alternate;
|
||||
}
|
||||
.social-welcome-faces span:nth-child(2n) {
|
||||
animation-delay: -2s;
|
||||
}
|
||||
.social-onboarding-card {
|
||||
gap: 18px;
|
||||
}
|
||||
.social-onboarding-card .social-card-top {
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
.social-onboarding-card .social-card-top > span {
|
||||
font-family: monospace;
|
||||
font-size: 27px;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.4;
|
||||
}
|
||||
.social-onboarding-card h2 {
|
||||
font-size: 19px;
|
||||
}
|
||||
.social-onboarding-card .social-btn {
|
||||
margin-top: auto;
|
||||
}
|
||||
.social-membership-banner {
|
||||
display: flex;
|
||||
gap: 45px;
|
||||
align-items: center;
|
||||
border: 1px solid #ffe19533;
|
||||
border-radius: 21px;
|
||||
padding: 50px;
|
||||
background:
|
||||
radial-gradient(ellipse at 0% 20%, #ffe1950d, transparent 65%),
|
||||
var(--sx-surface);
|
||||
}
|
||||
.social-membership-emblem {
|
||||
width: 155px;
|
||||
height: 155px;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--sx-gold);
|
||||
border: 1px solid #ffe19525;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.social-membership-emblem i {
|
||||
position: absolute;
|
||||
inset: 10px;
|
||||
border: 1px dashed #ffe19535;
|
||||
border-radius: 50%;
|
||||
animation: sx-orbit 25s linear infinite;
|
||||
}
|
||||
.social-membership-emblem i:last-child {
|
||||
inset: 28px;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
.social-membership-emblem::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 36px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 60px #ffe19515;
|
||||
}
|
||||
.social-membership-banner h2 {
|
||||
font-size: 30px;
|
||||
margin: 15px 0;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
.social-membership-banner p {
|
||||
font-size: 13px;
|
||||
line-height: 1.9;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.social-membership-banner .social-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
.social-membership-card {
|
||||
gap: 18px;
|
||||
}
|
||||
.social-membership-card > svg {
|
||||
color: var(--sx-gold);
|
||||
}
|
||||
.social-membership-card h2 {
|
||||
font-size: 17px;
|
||||
}
|
||||
.social-membership-card > span {
|
||||
margin-top: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
@keyframes social-film-drift {
|
||||
to {
|
||||
transform: rotateX(45deg) rotate(10deg);
|
||||
scale: 1.1;
|
||||
}
|
||||
}
|
||||
@keyframes social-welcome-bob {
|
||||
to {
|
||||
translate: 0 -6px;
|
||||
rotate: 7deg;
|
||||
}
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.social-profile-studio {
|
||||
gap: 20px;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.social-profile-preview {
|
||||
max-width: 550px;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
.social-welcome-banner {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.social-welcome-banner .social-btn {
|
||||
margin-left: 0;
|
||||
}
|
||||
.social-membership-banner {
|
||||
padding: 30px;
|
||||
gap: 26px;
|
||||
}
|
||||
.social-membership-emblem {
|
||||
width: 115px;
|
||||
height: 115px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.social-profile-studio .social-form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.social-profile-passport {
|
||||
transform: none;
|
||||
padding: 25px;
|
||||
}
|
||||
.social-library-grid.is-books {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.social-feedback-heading {
|
||||
align-items: flex-start;
|
||||
gap: 13px;
|
||||
}
|
||||
.social-feedback-heading h2 {
|
||||
font-size: 18px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.social-feedback-heart {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.social-feedback-heart svg {
|
||||
width: 24px;
|
||||
}
|
||||
.social-welcome-banner {
|
||||
padding: 22px;
|
||||
gap: 20px;
|
||||
}
|
||||
.social-welcome-banner h2 {
|
||||
font-size: 19px;
|
||||
}
|
||||
.social-membership-banner {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
padding: 25px;
|
||||
}
|
||||
.social-membership-banner h2 {
|
||||
font-size: 25px;
|
||||
}
|
||||
.social-membership-emblem {
|
||||
width: 95px;
|
||||
height: 95px;
|
||||
}
|
||||
.social-membership-emblem svg {
|
||||
width: 36px;
|
||||
}
|
||||
.social-library-art {
|
||||
height: 210px;
|
||||
}
|
||||
.social-profile-preview > .social-btn {
|
||||
width: 100%;
|
||||
}
|
||||
.social-filters button,
|
||||
.social-save,
|
||||
.social-room-channels a {
|
||||
min-height: 44px;
|
||||
}
|
||||
.social-message-tools button {
|
||||
min-height: 40px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.social-fx-control {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
min-height: 44px;
|
||||
}
|
||||
.social-search button {
|
||||
min-width: 32px;
|
||||
min-height: 42px;
|
||||
}
|
||||
}
|
||||
460
apps/miniprogram/h5/src/styles/social-next/taro-overrides.css
Normal file
460
apps/miniprogram/h5/src/styles/social-next/taro-overrides.css
Normal file
@ -0,0 +1,460 @@
|
||||
/* Taro H5 shell overrides — keep Next CSS intact */
|
||||
html,
|
||||
body,
|
||||
#app,
|
||||
.taro_page,
|
||||
.social-experience,
|
||||
.soc-taro-root {
|
||||
min-height: 100%;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app,
|
||||
.taro_page {
|
||||
background: #0a0e17 !important;
|
||||
}
|
||||
|
||||
.social-experience {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
min-height: 100%;
|
||||
width: 100%;
|
||||
/* let .taro_page own vertical scroll — do not nest another scrollport */
|
||||
overflow: visible;
|
||||
background:
|
||||
radial-gradient(ellipse 70% 45% at 50% -10%, rgba(78, 205, 196, 0.14), transparent),
|
||||
radial-gradient(ellipse 50% 35% at 90% 20%, rgba(255, 107, 107, 0.1), transparent),
|
||||
radial-gradient(ellipse 45% 30% at 10% 80%, rgba(255, 230, 109, 0.06), transparent),
|
||||
var(--bg-primary, #0a0e17);
|
||||
}
|
||||
|
||||
.soc-taro-root {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-height: 100dvh;
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Taro H5: body { overflow:hidden }, .taro_page is the scrollport.
|
||||
* Never set overflow:visible / height:auto on .taro_page — that kills scroll.
|
||||
*/
|
||||
.taro_page:has(.social-experience),
|
||||
.taro_page:has(.soc-taro-root) {
|
||||
height: 100% !important;
|
||||
min-height: 100% !important;
|
||||
max-height: 100% !important;
|
||||
background: #0a0e17 !important;
|
||||
overflow-x: hidden !important;
|
||||
overflow-y: auto !important;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
|
||||
.social-experience .social-ambient,
|
||||
.social-experience .social-constellation,
|
||||
.social-experience .social-pointer-glow {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.social-experience .social-ambient {
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
z-index: 0 !important;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Taro H5: bump aurora so full-bleed FX are obvious vs Next's subtler desktop */
|
||||
.social-experience[data-immersive='true'] .social-ambient i,
|
||||
.social-experience[data-immersive='true'] .social-ambient .as-i {
|
||||
opacity: 0.18 !important;
|
||||
filter: blur(90px);
|
||||
animation: sx-aurora 18s ease-in-out infinite alternate;
|
||||
}
|
||||
.social-experience[data-immersive='true'] .social-ambient i:nth-child(2),
|
||||
.social-experience[data-immersive='true'] .social-ambient .as-i:nth-child(2) {
|
||||
opacity: 0.14 !important;
|
||||
}
|
||||
.social-experience[data-immersive='true'] .social-ambient i:nth-child(3),
|
||||
.social-experience[data-immersive='true'] .social-ambient .as-i:nth-child(3) {
|
||||
opacity: 0.1 !important;
|
||||
}
|
||||
|
||||
/* weapp:语义标签变成 View/Text,用 as-* 接住关键的 tag 选择器 */
|
||||
.social-ambient .as-i,
|
||||
.social-fx-orbs .as-i,
|
||||
.connection-audio-bars .as-i {
|
||||
display: block;
|
||||
}
|
||||
.social-home .as-h1,
|
||||
.social-home .as-h2,
|
||||
.social-home .as-h3 {
|
||||
display: block;
|
||||
font-weight: 700;
|
||||
}
|
||||
.social-home .as-nav,
|
||||
.social-home .as-main,
|
||||
.social-home .as-section,
|
||||
.social-home .as-footer {
|
||||
display: block;
|
||||
}
|
||||
.social-home .as-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.social-experience .social-constellation {
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
width: 100vw !important;
|
||||
height: 100dvh !important;
|
||||
z-index: 0 !important;
|
||||
}
|
||||
|
||||
.social-experience .social-pointer-glow {
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
z-index: 0 !important;
|
||||
}
|
||||
|
||||
.social-experience > .soc-taro-root,
|
||||
.social-experience > .community-root {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.social-experience .social-fx-control {
|
||||
position: fixed;
|
||||
right: 12px;
|
||||
bottom: calc(72px + env(safe-area-inset-bottom, 0px));
|
||||
z-index: 60;
|
||||
}
|
||||
|
||||
/* Keep ambient FX on phone too (Next H5 hides emoji field; Taro keeps light layer) */
|
||||
@media (max-width: 900px) {
|
||||
.soc-taro-root.social-home .social-emoji-field {
|
||||
display: block !important;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.soc-taro-root.social-home .connection-universe {
|
||||
display: block !important;
|
||||
max-height: none;
|
||||
}
|
||||
}
|
||||
|
||||
.social-fx-belt {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-mobile-dock {
|
||||
padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
.soc-taro-root img.social-avatar,
|
||||
.soc-taro-root .social-avatar,
|
||||
.soc-taro-root .taro-img,
|
||||
.soc-taro-root .taro-img__mode-aspectFill {
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* Keep Next selectors (h1/strong/small/em/a/nav) — only patch Taro host quirks */
|
||||
.soc-taro-root .social-mobile-dock a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
min-height: 52px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-muted {
|
||||
opacity: 0.62;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
body.social-body {
|
||||
margin: 0;
|
||||
background: #0c0c0f;
|
||||
/* keep Taro scroll model (page scrolls; body stays clipped) */
|
||||
overflow: hidden !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
html:has(.soc-taro-root),
|
||||
html:has(.social-experience) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#app:has(.soc-taro-root),
|
||||
#app:has(.social-experience) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Ensure home shell navbar sticks like community-root / Next */
|
||||
.soc-taro-root.social-home > .navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
/* weapp:关闭 H5 专用 position:fixed 全屏层抢触摸(canvas 已不渲染) */
|
||||
.social-weapp .social-ambient,
|
||||
.social-weapp .social-pointer-glow {
|
||||
position: absolute !important;
|
||||
inset: 0 !important;
|
||||
height: 100% !important;
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
.social-weapp .social-emoji-field {
|
||||
display: none !important;
|
||||
}
|
||||
.soc-taro-root a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.soc-taro-root button {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-path-link,
|
||||
.soc-taro-root .btn,
|
||||
.soc-taro-root .connection-film,
|
||||
.soc-taro-root .connection-way,
|
||||
.soc-taro-root .social-panel,
|
||||
.soc-taro-root .social-person-card {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-people-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@media (min-width: 720px) {
|
||||
.soc-taro-root .social-people-grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1100px) {
|
||||
.soc-taro-root .social-people-grid {
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.soc-taro-root .social-person-card {
|
||||
padding: 16px;
|
||||
border-radius: 18px;
|
||||
border: 1px solid var(--connection-border, rgba(255, 255, 255, 0.1));
|
||||
background: color-mix(in srgb, var(--sx-glass, #12141a) 92%, transparent);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-person-card-top {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-like-btn {
|
||||
margin-left: auto;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-like-btn.is-on {
|
||||
color: #f06664;
|
||||
border-color: rgba(240, 102, 100, 0.4);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-person-card-bio {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-person-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-person-card-tags .as-span,
|
||||
.soc-taro-root .social-person-card-tags text,
|
||||
.soc-taro-root .social-person-card-tags span {
|
||||
font-size: 11px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-people-filter {
|
||||
flex: 0 0 auto;
|
||||
min-height: 36px;
|
||||
padding: 0 12px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-people-filter.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
color: #4ecdc4;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-demo-badge {
|
||||
font-size: 11px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-date-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-date-card-tags .as-span,
|
||||
.soc-taro-root .social-date-card-tags text,
|
||||
.soc-taro-root .social-date-card-tags span {
|
||||
font-size: 11px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-date-root {
|
||||
padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 14px;
|
||||
padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
@media (min-width: 901px) {
|
||||
.soc-taro-root .social-chat-layout {
|
||||
grid-template-columns: 260px 1fr;
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-side-title {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
opacity: 0.6;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-channel {
|
||||
padding: 12px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(18, 20, 26, 0.85);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-channel.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-presence {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-thread {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-bubble {
|
||||
max-width: 88%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-bubble.is-mine {
|
||||
align-self: flex-end;
|
||||
background: rgba(78, 205, 196, 0.16);
|
||||
border-color: rgba(78, 205, 196, 0.28);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-author {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
opacity: 0.6;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-composer {
|
||||
position: sticky;
|
||||
bottom: calc(64px + env(safe-area-inset-bottom, 0px));
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
padding: 8px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(12, 12, 15, 0.94);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-input,
|
||||
.soc-taro-root .social-field-input {
|
||||
flex: 1;
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
margin-top: 6px;
|
||||
padding: 10px 12px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #f1f5f9;
|
||||
font-size: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-chat-composer .social-chat-input {
|
||||
margin-top: 0;
|
||||
border: none;
|
||||
}
|
||||
494
apps/miniprogram/h5/src/styles/social-next/theme2.css
Normal file
494
apps/miniprogram/h5/src/styles/social-next/theme2.css
Normal file
@ -0,0 +1,494 @@
|
||||
/**
|
||||
* 游民社区 · 主题 2「琥珀信号」
|
||||
* 与主题 1(旅居社群对齐)完全独立;html[data-social-skin="2"] 启用。
|
||||
*/
|
||||
|
||||
html[data-social-skin="2"] .social-skin {
|
||||
--t2-ink: #07070a;
|
||||
--t2-panel: #101016;
|
||||
--t2-line: rgba(245, 158, 11, 0.22);
|
||||
--t2-amber: #f59e0b;
|
||||
--t2-amber-dim: rgba(245, 158, 11, 0.14);
|
||||
--t2-cyan: #22d3ee;
|
||||
--t2-text: #f4f1ea;
|
||||
--t2-muted: #9a958c;
|
||||
--t2-danger: #fb7185;
|
||||
--t2-radius: 4px;
|
||||
--t2-font-display: "Segoe UI Variable Display", "Bahnschrift", "DIN Alternate",
|
||||
var(--font-outfit), system-ui, sans-serif;
|
||||
--t2-font-body: var(--font-noto-sc), "Segoe UI", system-ui, sans-serif;
|
||||
--sc-bg: var(--t2-ink);
|
||||
--sc-bg-card: color-mix(in srgb, var(--t2-panel) 92%, transparent);
|
||||
--sc-bg-glass: var(--t2-amber-dim);
|
||||
--sc-text: var(--t2-text);
|
||||
--sc-muted: var(--t2-muted);
|
||||
--sc-accent-1: var(--t2-amber);
|
||||
--sc-accent-2: #fbbf24;
|
||||
--sc-accent-3: var(--t2-cyan);
|
||||
--sc-gradient: linear-gradient(120deg, #f59e0b 0%, #fbbf24 45%, #22d3ee 100%);
|
||||
--sc-border: 1px solid var(--t2-line);
|
||||
--sc-radius: var(--t2-radius);
|
||||
--sc-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08), 0 24px 60px rgba(0, 0, 0, 0.45);
|
||||
--sc-font-display: var(--t2-font-display);
|
||||
--sc-font-body: var(--t2-font-body);
|
||||
}
|
||||
|
||||
html.light[data-social-skin="2"] .social-skin,
|
||||
html[data-theme="light"][data-social-skin="2"] .social-skin {
|
||||
--t2-ink: #f6f3eb;
|
||||
--t2-panel: #ffffff;
|
||||
--t2-line: rgba(120, 80, 10, 0.18);
|
||||
--t2-amber: #b45309;
|
||||
--t2-amber-dim: rgba(180, 83, 9, 0.08);
|
||||
--t2-cyan: #0e7490;
|
||||
--t2-text: #1c1917;
|
||||
--t2-muted: #78716c;
|
||||
--sc-shadow: 0 0 0 1px rgba(180, 83, 9, 0.08), 0 18px 40px rgba(28, 25, 23, 0.08);
|
||||
}
|
||||
|
||||
/* —— 壳 / 背景 —— */
|
||||
html[data-social-skin="2"] .social-flow,
|
||||
html[data-social-skin="2"] .social-root,
|
||||
html[data-social-skin="2"] .home-flow.social-flow {
|
||||
background:
|
||||
linear-gradient(180deg, rgba(245, 158, 11, 0.07), transparent 28%),
|
||||
repeating-linear-gradient(
|
||||
0deg,
|
||||
transparent,
|
||||
transparent 47px,
|
||||
rgba(245, 158, 11, 0.035) 48px
|
||||
),
|
||||
radial-gradient(ellipse 80% 50% at 100% 0%, rgba(34, 211, 238, 0.08), transparent 55%),
|
||||
var(--t2-ink, #07070a);
|
||||
color: var(--t2-text, #f4f1ea);
|
||||
font-family: var(--t2-font-body);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-flow::before {
|
||||
content: "";
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
background: radial-gradient(circle at 12% 88%, rgba(245, 158, 11, 0.08), transparent 32%);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .navbar {
|
||||
border-bottom: 1px solid var(--t2-line);
|
||||
background: color-mix(in srgb, var(--t2-ink) 78%, transparent);
|
||||
backdrop-filter: blur(18px) saturate(1.2);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .navbar.scrolled {
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .logo-icon {
|
||||
border-radius: var(--t2-radius);
|
||||
background: var(--t2-amber);
|
||||
color: #111;
|
||||
box-shadow: 0 0 24px rgba(245, 158, 11, 0.45);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .logo-text {
|
||||
font-family: var(--t2-font-display);
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .btn-primary,
|
||||
html[data-social-skin="2"] .social-btn.primary,
|
||||
html[data-social-skin="2"] .social-compose button {
|
||||
border-radius: var(--t2-radius);
|
||||
background: var(--t2-amber) !important;
|
||||
color: #111 !important;
|
||||
border: none !important;
|
||||
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 28px rgba(245, 158, 11, 0.35);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .btn-primary:hover,
|
||||
html[data-social-skin="2"] .social-btn.primary:hover {
|
||||
filter: brightness(1.06);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .btn-ghost,
|
||||
html[data-social-skin="2"] .social-btn,
|
||||
html[data-social-skin="2"] .social-nav-back {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .nav-group-btn,
|
||||
html[data-social-skin="2"] .nav-dropdown-link,
|
||||
html[data-social-skin="2"] .nav-icon-btn {
|
||||
border-radius: var(--t2-radius);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .nav-dropdown {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: var(--t2-panel);
|
||||
box-shadow: var(--sc-shadow);
|
||||
}
|
||||
|
||||
/* 皮肤切换器 */
|
||||
html[data-social-skin="2"] .social-skin-switch,
|
||||
.social-skin-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
padding: 3px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.social-skin-switch button {
|
||||
min-height: 36px;
|
||||
min-width: 44px;
|
||||
padding: 0 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--sc-muted, #94a3b8);
|
||||
font: inherit;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.social-skin-switch button[aria-pressed="true"] {
|
||||
background: var(--t2-amber, #f59e0b);
|
||||
color: #111;
|
||||
}
|
||||
|
||||
html[data-social-skin="1"] .social-skin-switch button[aria-pressed="true"] {
|
||||
background: #4ecdc4;
|
||||
color: #0a0e17;
|
||||
}
|
||||
|
||||
/* —— Hero:品牌优先、少卡片 —— */
|
||||
html[data-social-skin="2"] .hero {
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
border-bottom: 1px solid var(--t2-line);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .hero-bg-shapes .shape {
|
||||
opacity: 0.28;
|
||||
filter: saturate(0.55) hue-rotate(18deg);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] #particles-canvas,
|
||||
html[data-social-skin="2"] .particle-canvas {
|
||||
opacity: 0.45;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .hero-badge {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: var(--t2-amber-dim);
|
||||
color: var(--t2-amber);
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .hero-badge .badge-dot {
|
||||
background: var(--t2-amber);
|
||||
box-shadow: 0 0 12px var(--t2-amber);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .hero-title {
|
||||
font-family: var(--t2-font-display);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.04em;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .gradient-text {
|
||||
background: linear-gradient(100deg, #f59e0b, #fde68a 55%, #22d3ee) !important;
|
||||
-webkit-background-clip: text !important;
|
||||
background-clip: text !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .hero-subtitle {
|
||||
color: var(--t2-muted);
|
||||
font-size: 1.05rem;
|
||||
max-width: 28rem;
|
||||
border-left: 2px solid var(--t2-amber);
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .float-card {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: color-mix(in srgb, var(--t2-panel) 88%, transparent);
|
||||
backdrop-filter: blur(10px);
|
||||
font-family: var(--t2-font-display);
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .float-card small {
|
||||
color: var(--t2-muted);
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .globe-svg circle[fill="url(#socialGlobeGlow)"] {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* PATH:竖轨信号条 */
|
||||
html[data-social-skin="2"] .journey-strip {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .section-tag {
|
||||
color: var(--t2-amber);
|
||||
letter-spacing: 0.2em;
|
||||
border: 1px solid var(--t2-line);
|
||||
border-radius: var(--t2-radius);
|
||||
padding: 4px 8px;
|
||||
background: var(--t2-amber-dim);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .section-header h2,
|
||||
html[data-social-skin="2"] .social-hub-block-head h3,
|
||||
html[data-social-skin="2"] .social-hero h1,
|
||||
html[data-social-skin="2"] .social-section-head h2 {
|
||||
font-family: var(--t2-font-display);
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .journey-card,
|
||||
html[data-social-skin="2"] .social-hub-card,
|
||||
html[data-social-skin="2"] .social-next-card,
|
||||
html[data-social-skin="2"] .social-card,
|
||||
html[data-social-skin="2"] .social-list-item,
|
||||
html[data-social-skin="2"] .social-panel {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background:
|
||||
linear-gradient(135deg, var(--t2-amber-dim), transparent 42%),
|
||||
var(--t2-panel);
|
||||
box-shadow: none;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card:hover,
|
||||
html[data-social-skin="2"] .social-next-card:hover,
|
||||
html[data-social-skin="2"] .social-card:hover,
|
||||
html[data-social-skin="2"] .journey-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: rgba(245, 158, 11, 0.55);
|
||||
box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2), 0 16px 40px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-emoji,
|
||||
html[data-social-skin="2"] .social-card-ico {
|
||||
border-radius: var(--t2-radius);
|
||||
background: #000;
|
||||
border: 1px solid var(--t2-line);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-pill,
|
||||
html[data-social-skin="2"] .social-badge {
|
||||
border-radius: var(--t2-radius);
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.68rem;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-pill.live,
|
||||
html[data-social-skin="2"] .social-badge.live {
|
||||
color: var(--t2-amber);
|
||||
border-color: rgba(245, 158, 11, 0.45);
|
||||
background: var(--t2-amber-dim);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-go,
|
||||
html[data-social-skin="2"] .social-next-card em,
|
||||
html[data-social-skin="2"] .social-list-item em {
|
||||
color: var(--t2-amber);
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .journey-n {
|
||||
color: var(--t2-amber);
|
||||
font-family: var(--t2-font-display);
|
||||
}
|
||||
|
||||
/* HUB:改成通栏带状,减弱「卡片堆」感 */
|
||||
html[data-social-skin="2"] .social-hub-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card {
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-template-rows: auto auto;
|
||||
gap: 6px 16px;
|
||||
align-items: center;
|
||||
padding: 16px 18px;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card-top {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card h4 {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card p {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-card .social-pill {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-go {
|
||||
grid-column: 3;
|
||||
grid-row: 1 / span 2;
|
||||
align-self: center;
|
||||
font-family: var(--t2-font-display);
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-next-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 900px) {
|
||||
html[data-social-skin="2"] .social-next-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Chat */
|
||||
html[data-social-skin="2"] .social-chat-thread {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background:
|
||||
linear-gradient(180deg, rgba(245, 158, 11, 0.05), transparent 20%),
|
||||
#0a0a0e;
|
||||
max-height: min(62vh, 560px);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-bubble {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: var(--t2-panel);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-bubble.mine {
|
||||
background: linear-gradient(160deg, rgba(245, 158, 11, 0.22), rgba(34, 211, 238, 0.08));
|
||||
border-color: rgba(245, 158, 11, 0.4);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-compose input,
|
||||
html[data-social-skin="2"] .social-form input,
|
||||
html[data-social-skin="2"] .social-form textarea,
|
||||
html[data-social-skin="2"] .social-chat-nick input {
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: #0a0a0e;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-compose {
|
||||
position: sticky;
|
||||
bottom: 12px;
|
||||
padding: 10px;
|
||||
border-radius: var(--t2-radius);
|
||||
border: 1px solid var(--t2-line);
|
||||
background: color-mix(in srgb, var(--t2-panel) 90%, transparent);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-compose button {
|
||||
border-radius: var(--t2-radius) !important;
|
||||
min-width: 96px;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hero-tag {
|
||||
border-radius: var(--t2-radius);
|
||||
color: var(--t2-amber);
|
||||
border-color: var(--t2-line);
|
||||
background: var(--t2-amber-dim);
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hero h1 span {
|
||||
background: linear-gradient(100deg, #f59e0b, #22d3ee);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .footer {
|
||||
border-top: 1px solid var(--t2-line);
|
||||
background: #050508;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .footer-cols h4 {
|
||||
color: var(--t2-amber);
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-live-tab.active {
|
||||
background: var(--t2-amber) !important;
|
||||
color: #111 !important;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-live-iframe-mark {
|
||||
background: var(--t2-amber) !important;
|
||||
color: #111 !important;
|
||||
border-radius: var(--t2-radius);
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-live-iframe-overlay h2 {
|
||||
background: linear-gradient(100deg, #f59e0b, #22d3ee);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
html[data-social-skin="2"] .social-hub-card {
|
||||
grid-template-columns: auto 1fr;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-hub-go {
|
||||
grid-column: 2;
|
||||
grid-row: 3;
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
html[data-social-skin="2"] .social-skin-switch button {
|
||||
min-width: 40px;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
}
|
||||
1397
apps/miniprogram/h5/src/styles/social-next/vivid.css
Normal file
1397
apps/miniprogram/h5/src/styles/social-next/vivid.css
Normal file
File diff suppressed because it is too large
Load Diff
801
apps/miniprogram/h5/src/styles/social-next/weapp-bridge.scss
Normal file
801
apps/miniprogram/h5/src/styles/social-next/weapp-bridge.scss
Normal file
@ -0,0 +1,801 @@
|
||||
/**
|
||||
* 微信桥接:Next /social 移动端观感强化(安全区 / 语义别名 / 缺省按钮补齐后的版式)。
|
||||
* 主视觉仍来自 bundle.weapp;这里强制手机构图,不依赖 @media 窗宽。
|
||||
*/
|
||||
|
||||
page {
|
||||
font-size: 16px;
|
||||
background: #0a0e17;
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
/* —— 语义标签 → View/Text —— */
|
||||
.soc-taro-root .as-h1,
|
||||
.soc-taro-root .as-h2,
|
||||
.soc-taro-root .as-h3,
|
||||
.soc-taro-root .as-h4,
|
||||
.soc-taro-root .as-p,
|
||||
.soc-taro-root .as-section,
|
||||
.soc-taro-root .as-nav,
|
||||
.soc-taro-root .as-main,
|
||||
.soc-taro-root .as-footer,
|
||||
.soc-taro-root .as-header,
|
||||
.soc-taro-root .as-ul,
|
||||
.soc-taro-root .as-li,
|
||||
.soc-taro-root .as-form,
|
||||
.soc-taro-root .as-article {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root .as-button,
|
||||
.soc-taro-root .as-a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root .as-span,
|
||||
.soc-taro-root .as-strong,
|
||||
.soc-taro-root .as-em,
|
||||
.soc-taro-root .as-small,
|
||||
.soc-taro-root .as-i,
|
||||
.soc-taro-root .as-time {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.connection-title-line {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* —— 顶栏:避开状态栏 + 胶囊 —— */
|
||||
.soc-taro-root.social-weapp > .navbar,
|
||||
.soc-taro-root.social-home > .navbar {
|
||||
position: fixed !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
height: auto !important;
|
||||
padding: var(--safe-status-bar, 0PX) 14PX 10PX !important;
|
||||
box-sizing: border-box;
|
||||
background: rgba(10, 14, 23, 0.86) !important;
|
||||
border-bottom: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
backdrop-filter: blur(18PX);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp > .navbar .nav-container,
|
||||
.soc-taro-root.social-home > .navbar .nav-container {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: var(--safe-nav-bar, 44PX);
|
||||
padding-right: var(--safe-menu-pad, 96PX) !important;
|
||||
gap: 10PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .nav-logo,
|
||||
.soc-taro-root.social-home .nav-logo {
|
||||
gap: 8PX;
|
||||
font-size: 15PX;
|
||||
font-weight: 700;
|
||||
color: #f1f5f9 !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .logo-icon,
|
||||
.soc-taro-root.social-home .logo-icon {
|
||||
width: 28PX;
|
||||
height: 28PX;
|
||||
font-size: 16PX;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-nav-join,
|
||||
.soc-taro-root.social-home .social-nav-join,
|
||||
.soc-taro-root.social-weapp .social-btn.coral,
|
||||
.soc-taro-root.social-home .social-btn.coral {
|
||||
min-height: 34PX !important;
|
||||
padding: 0 14PX !important;
|
||||
border-radius: 999PX !important;
|
||||
font-size: 12PX !important;
|
||||
font-weight: 700 !important;
|
||||
color: #2a1210 !important;
|
||||
background: linear-gradient(120deg, #ff8c78, #ff6b6b) !important;
|
||||
border: 0 !important;
|
||||
box-shadow: 0 4PX 16PX rgba(255, 107, 107, 0.28);
|
||||
}
|
||||
|
||||
/* —— Hero —— */
|
||||
.soc-taro-root.social-weapp .connection-hero,
|
||||
.soc-taro-root.social-home .connection-hero {
|
||||
padding-top: calc(var(--safe-header, 88PX) + 20PX) !important;
|
||||
padding-bottom: 12PX !important;
|
||||
/* 截图像空页:禁止 92dvh 撑满屏把正文顶飞 */
|
||||
min-height: 0 !important;
|
||||
height: auto !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.social-home .container {
|
||||
max-width: 100%;
|
||||
padding-inline: 20PX !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-hero-layout,
|
||||
.soc-taro-root.social-home .connection-hero-layout {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
grid-template-columns: none !important;
|
||||
gap: 28PX !important;
|
||||
min-height: 0 !important;
|
||||
align-items: stretch !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-eyebrow,
|
||||
.soc-taro-root.social-home .connection-eyebrow {
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
gap: 6PX;
|
||||
font-size: 11PX !important;
|
||||
letter-spacing: 0.08em;
|
||||
color: #94a3b8 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-copy .as-h1,
|
||||
.soc-taro-root.social-home .connection-copy .as-h1 {
|
||||
margin: 18PX 0 16PX !important;
|
||||
font-size: 36PX !important;
|
||||
line-height: 1.22 !important;
|
||||
letter-spacing: -0.045em !important;
|
||||
font-weight: 800 !important;
|
||||
color: #f8fafc !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-title-accent,
|
||||
.soc-taro-root.social-home .connection-title-accent {
|
||||
color: #4ecdc4 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-title-period,
|
||||
.soc-taro-root.social-home .connection-title-period {
|
||||
color: #ff6b6b !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-description,
|
||||
.soc-taro-root.social-home .connection-description {
|
||||
font-size: 13PX !important;
|
||||
line-height: 1.85 !important;
|
||||
color: #94a3b8 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-actions,
|
||||
.soc-taro-root.social-home .connection-actions {
|
||||
display: flex !important;
|
||||
flex-wrap: wrap !important;
|
||||
align-items: center !important;
|
||||
gap: 12PX 14PX !important;
|
||||
margin-top: 22PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-join,
|
||||
.soc-taro-root.social-home .connection-join {
|
||||
min-height: 48PX !important;
|
||||
padding: 0 22PX !important;
|
||||
gap: 10PX !important;
|
||||
border-radius: 14PX !important;
|
||||
font-size: 14PX !important;
|
||||
font-weight: 750 !important;
|
||||
color: #251414 !important;
|
||||
background: linear-gradient(120deg, #ff8c78, #ff6b6b) !important;
|
||||
border: 1PX solid #ff8b7c !important;
|
||||
box-shadow: 0 8PX 28PX rgba(255, 107, 107, 0.28) !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-film,
|
||||
.soc-taro-root.social-home .connection-film {
|
||||
min-height: 44PX !important;
|
||||
gap: 8PX !important;
|
||||
font-size: 12PX !important;
|
||||
color: #94a3b8 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-film > .as-span,
|
||||
.soc-taro-root.social-home .connection-film > .as-span {
|
||||
width: 32PX !important;
|
||||
height: 32PX !important;
|
||||
border-radius: 50% !important;
|
||||
border: 1PX solid rgba(171, 195, 213, 0.18) !important;
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(78, 205, 196, 0.06);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-proof,
|
||||
.soc-taro-root.social-home .connection-proof {
|
||||
margin-top: 24PX !important;
|
||||
gap: 12PX !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-visual,
|
||||
.soc-taro-root.social-home .connection-visual,
|
||||
.soc-taro-root.social-weapp .connection-universe,
|
||||
.soc-taro-root.social-home .connection-universe {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* —— 四种连接方式 —— */
|
||||
.soc-taro-root.social-weapp .connection-ways,
|
||||
.soc-taro-root.social-home .connection-ways {
|
||||
margin-bottom: 18PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way,
|
||||
.soc-taro-root.social-home .connection-way {
|
||||
min-height: 68PX !important;
|
||||
padding: 14PX 16PX !important;
|
||||
gap: 12PX !important;
|
||||
border-radius: 16PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way-icon,
|
||||
.soc-taro-root.social-home .connection-way-icon {
|
||||
width: 42PX !important;
|
||||
height: 42PX !important;
|
||||
border-radius: 14PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way-copy .as-strong,
|
||||
.soc-taro-root.social-home .connection-way-copy .as-strong {
|
||||
font-size: 14PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way-copy .as-small,
|
||||
.soc-taro-root.social-home .connection-way-copy .as-small {
|
||||
font-size: 11PX !important;
|
||||
color: #64748b !important;
|
||||
}
|
||||
|
||||
/* —— 本页路径芯片(勿 sticky:滚到底时会粘在顶栏下,截图像整页只剩 chips+页脚) —— */
|
||||
.soc-taro-root.social-weapp .social-path,
|
||||
.soc-taro-root.social-home .social-path {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
z-index: 2;
|
||||
padding: 8PX 0 !important;
|
||||
background: rgba(10, 14, 23, 0.92) !important;
|
||||
border-bottom: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
backdrop-filter: blur(14PX);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-path-track,
|
||||
.soc-taro-root.social-home .social-path-track {
|
||||
display: flex !important;
|
||||
flex-wrap: nowrap !important;
|
||||
justify-content: space-between !important;
|
||||
gap: 4PX !important;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-path-track .as-a,
|
||||
.soc-taro-root.social-weapp .social-path-link,
|
||||
.soc-taro-root.social-home .social-path-track .as-a,
|
||||
.soc-taro-root.social-home .social-path-link {
|
||||
flex: 1;
|
||||
flex-direction: column !important;
|
||||
justify-content: center;
|
||||
gap: 4PX !important;
|
||||
min-height: 52PX !important;
|
||||
padding: 6PX 2PX !important;
|
||||
border-radius: 14PX !important;
|
||||
font-size: 10PX !important;
|
||||
font-weight: 600;
|
||||
color: #94a3b8 !important;
|
||||
background: rgba(255, 255, 255, 0.03) !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.06) !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-path-emoji,
|
||||
.soc-taro-root.social-home .social-path-emoji {
|
||||
font-size: 14PX !important;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-path-track .as-a[aria-current],
|
||||
.soc-taro-root.social-home .social-path-track .as-a[aria-current] {
|
||||
color: #4ecdc4 !important;
|
||||
border-color: rgba(78, 205, 196, 0.35) !important;
|
||||
background: rgba(78, 205, 196, 0.1) !important;
|
||||
}
|
||||
|
||||
/* —— 区块标题 —— */
|
||||
.soc-taro-root.social-weapp .section,
|
||||
.soc-taro-root.social-home .section {
|
||||
padding-block: 40PX !important;
|
||||
scroll-margin-top: calc(var(--safe-header, 88PX) + 56PX);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .section-header,
|
||||
.soc-taro-root.social-home .section-header {
|
||||
margin-bottom: 20PX !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .section-header .section-tag,
|
||||
.soc-taro-root.social-home .section-header .section-tag {
|
||||
display: flex !important;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12PX !important;
|
||||
padding: 0 !important;
|
||||
background: none !important;
|
||||
border: 0 !important;
|
||||
color: #4ecdc4 !important;
|
||||
font-size: 10PX !important;
|
||||
letter-spacing: 0.12em;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .section-header .as-h2,
|
||||
.soc-taro-root.social-home .section-header .as-h2 {
|
||||
font-size: 24PX !important;
|
||||
font-weight: 750 !important;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.35 !important;
|
||||
color: #f8fafc !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .section-header .as-p,
|
||||
.soc-taro-root.social-home .section-header .as-p {
|
||||
margin-top: 8PX !important;
|
||||
font-size: 12PX !important;
|
||||
line-height: 1.75 !important;
|
||||
color: #64748b !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-title-emoji,
|
||||
.soc-taro-root.social-home .social-title-emoji {
|
||||
display: inline !important;
|
||||
margin-right: 6PX;
|
||||
}
|
||||
|
||||
/* —— 认识一下卡片 —— */
|
||||
.soc-taro-root.social-weapp .social-date-hero,
|
||||
.soc-taro-root.social-home .social-date-hero {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
grid-template-columns: none !important;
|
||||
gap: 20PX !important;
|
||||
padding: 20PX !important;
|
||||
border-radius: 22PX !important;
|
||||
border: 1PX solid rgba(255, 122, 114, 0.28) !important;
|
||||
background:
|
||||
radial-gradient(circle at 12% 10%, rgba(255, 122, 114, 0.22), transparent 42%),
|
||||
radial-gradient(circle at 90% 80%, rgba(255, 230, 109, 0.12), transparent 40%),
|
||||
#12141a !important;
|
||||
box-shadow: 0 16PX 36PX rgba(0, 0, 0, 0.35);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-copy .as-h2,
|
||||
.soc-taro-root.social-home .social-date-hero-copy .as-h2 {
|
||||
margin: 8PX 0 10PX !important;
|
||||
font-size: 22PX !important;
|
||||
line-height: 1.35 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-copy > .as-p,
|
||||
.soc-taro-root.social-home .social-date-hero-copy > .as-p {
|
||||
font-size: 12PX !important;
|
||||
line-height: 1.7 !important;
|
||||
color: #9aa3af !important;
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-steps,
|
||||
.soc-taro-root.social-home .social-date-hero-steps {
|
||||
display: flex !important;
|
||||
flex-wrap: wrap !important;
|
||||
gap: 8PX !important;
|
||||
margin: 0 0 14PX !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-steps .as-li,
|
||||
.soc-taro-root.social-home .social-date-hero-steps .as-li {
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
gap: 6PX;
|
||||
min-height: 34PX;
|
||||
padding: 0 12PX;
|
||||
border-radius: 999PX;
|
||||
border: 1PX solid rgba(255, 122, 114, 0.28);
|
||||
background: rgba(255, 122, 114, 0.1);
|
||||
font-size: 12PX;
|
||||
color: #ffc4c0;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-stage-acts,
|
||||
.soc-taro-root.social-home .social-date-stage-acts {
|
||||
display: flex !important;
|
||||
flex-wrap: wrap !important;
|
||||
gap: 10PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-deck,
|
||||
.soc-taro-root.social-home .social-date-hero-deck {
|
||||
position: relative !important;
|
||||
display: block !important;
|
||||
min-height: 280PX !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-card,
|
||||
.soc-taro-root.social-home .social-date-hero-card {
|
||||
width: 72% !important;
|
||||
max-width: 260PX;
|
||||
border-radius: 22PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-date-hero-cta,
|
||||
.soc-taro-root.social-home .social-date-hero-cta {
|
||||
left: 50% !important;
|
||||
transform: translateX(-50%);
|
||||
bottom: 10PX !important;
|
||||
min-height: 36PX;
|
||||
padding: 0 14PX;
|
||||
border-radius: 999PX;
|
||||
font-size: 12PX;
|
||||
background: rgba(255, 107, 107, 0.92);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* —— 人物网格 / 面板 —— */
|
||||
.soc-taro-root.social-weapp .social-people-grid,
|
||||
.soc-taro-root.social-home .social-people-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||
gap: 10PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-people-chip,
|
||||
.soc-taro-root.social-home .social-people-chip {
|
||||
padding: 12PX 10PX !important;
|
||||
border-radius: 16PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel-grid-2,
|
||||
.soc-taro-root.social-weapp .social-panel-grid-3,
|
||||
.soc-taro-root.social-home .social-panel-grid-2,
|
||||
.soc-taro-root.social-home .social-panel-grid-3 {
|
||||
grid-template-columns: 1fr !important;
|
||||
gap: 12PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel-grid-4,
|
||||
.soc-taro-root.social-home .social-panel-grid-4 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||
gap: 10PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel,
|
||||
.soc-taro-root.social-home .social-panel {
|
||||
padding: 16PX !important;
|
||||
border-radius: 18PX !important;
|
||||
min-height: 0 !important;
|
||||
background: rgba(17, 24, 39, 0.78) !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.08) !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel .as-h3,
|
||||
.soc-taro-root.social-home .social-panel .as-h3 {
|
||||
font-size: 16PX !important;
|
||||
font-weight: 700;
|
||||
color: #f8fafc;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel > .as-p,
|
||||
.soc-taro-root.social-home .social-panel > .as-p {
|
||||
font-size: 12PX !important;
|
||||
line-height: 1.65 !important;
|
||||
color: #94a3b8 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-panel .btn,
|
||||
.soc-taro-root.social-home .social-panel .btn,
|
||||
.soc-taro-root.social-weapp .social-section-actions .btn,
|
||||
.soc-taro-root.social-home .social-section-actions .btn,
|
||||
.soc-taro-root.social-weapp .social-date-stage-acts .btn,
|
||||
.soc-taro-root.social-home .social-date-stage-acts .btn {
|
||||
min-height: 44PX !important;
|
||||
padding: 0 16PX !important;
|
||||
border-radius: 12PX !important;
|
||||
font-size: 13PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-home .btn-primary,
|
||||
.soc-taro-root.social-home .btn-primary,
|
||||
.soc-taro-root .btn-primary {
|
||||
background: #4ecdc4 !important;
|
||||
color: #082b2b !important;
|
||||
box-shadow: 0 6PX 18PX rgba(78, 205, 196, 0.25) !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .btn-ghost,
|
||||
.soc-taro-root.social-home .btn-ghost {
|
||||
background: transparent !important;
|
||||
border: 1PX solid rgba(171, 195, 213, 0.18) !important;
|
||||
color: #e2e8f0 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .social-section-actions,
|
||||
.soc-taro-root.social-home .social-section-actions {
|
||||
justify-content: flex-start !important;
|
||||
margin-top: 18PX !important;
|
||||
gap: 10PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-meetup-art,
|
||||
.soc-taro-root.social-home .connection-meetup-art {
|
||||
min-height: 88PX !important;
|
||||
border-radius: 14PX !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-invite,
|
||||
.soc-taro-root.social-home .connection-invite {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
padding: 22PX 20PX !important;
|
||||
margin-block: 28PX !important;
|
||||
gap: 12PX !important;
|
||||
border-radius: 20PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-invite-orbit,
|
||||
.soc-taro-root.social-home .connection-invite-orbit {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-invite .as-h2,
|
||||
.soc-taro-root.social-home .connection-invite .as-h2 {
|
||||
font-size: 22PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .reveal,
|
||||
.soc-taro-root.social-home .reveal {
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
/*
|
||||
* 截图根因:connection-rise / panel-in 从 opacity:0 起,
|
||||
* 微信里动画常卡在 from → hero/ways/卡片整段透明,只剩 sticky path + 页脚链接。
|
||||
*/
|
||||
.soc-taro-root.social-weapp .connection-copy,
|
||||
.soc-taro-root.social-weapp .connection-universe,
|
||||
.soc-taro-root.social-weapp .connection-way,
|
||||
.soc-taro-root.social-weapp .connection-ways,
|
||||
.soc-taro-root.social-weapp .social-panel,
|
||||
.soc-taro-root.social-weapp .social-people-chip,
|
||||
.soc-taro-root.social-weapp .social-date-hero,
|
||||
.soc-taro-root.social-weapp .connection-invite,
|
||||
.soc-taro-root.social-weapp .footer,
|
||||
.soc-taro-root.social-weapp .footer-brand,
|
||||
.soc-taro-root.social-weapp .footer-links,
|
||||
.soc-taro-root.social-home .connection-copy,
|
||||
.soc-taro-root.social-home .connection-universe,
|
||||
.soc-taro-root.social-home .connection-way,
|
||||
.soc-taro-root.social-home .connection-ways,
|
||||
.soc-taro-root.social-home .social-panel,
|
||||
.soc-taro-root.social-home .social-people-chip,
|
||||
.soc-taro-root.social-home .social-date-hero,
|
||||
.soc-taro-root.social-home .connection-invite,
|
||||
.soc-taro-root.social-home .footer,
|
||||
.soc-taro-root.social-home .footer-brand,
|
||||
.soc-taro-root.social-home .footer-links {
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
/* ways:禁止桌面 5 列挤成拇指盖 */
|
||||
.soc-taro-root.social-weapp .connection-ways,
|
||||
.soc-taro-root.social-home .connection-ways {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
grid-template-columns: none !important;
|
||||
gap: 10PX !important;
|
||||
margin: 8PX 0 20PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way,
|
||||
.soc-taro-root.social-home .connection-way {
|
||||
width: 100% !important;
|
||||
min-height: 72PX !important;
|
||||
box-sizing: border-box;
|
||||
background: rgba(17, 24, 39, 0.85) !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.08) !important;
|
||||
border-radius: 16PX !important;
|
||||
padding: 14PX 16PX !important;
|
||||
}
|
||||
|
||||
/* 大号序号别压正文 */
|
||||
.soc-taro-root.social-weapp .connection-way-index,
|
||||
.soc-taro-root.social-home .connection-way-index {
|
||||
opacity: 0.12 !important;
|
||||
font-size: 28PX !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .connection-way-copy .as-em,
|
||||
.soc-taro-root.social-home .connection-way-copy .as-em {
|
||||
color: #4ecdc4 !important;
|
||||
font-style: normal !important;
|
||||
font-size: 12PX !important;
|
||||
}
|
||||
|
||||
/* 页脚:截图里是裸竖排链接 —— 强制成可读卡片区 */
|
||||
.soc-taro-root.social-weapp .footer,
|
||||
.soc-taro-root.social-home .footer {
|
||||
padding: 28PX 0 20PX !important;
|
||||
border-top: 1PX solid rgba(255, 255, 255, 0.06);
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-grid,
|
||||
.soc-taro-root.social-home .footer-grid {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
grid-template-columns: none !important;
|
||||
gap: 18PX !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-brand .as-strong,
|
||||
.soc-taro-root.social-home .footer-brand .as-strong {
|
||||
display: block !important;
|
||||
font-size: 16PX !important;
|
||||
font-weight: 700 !important;
|
||||
color: #f8fafc !important;
|
||||
margin-bottom: 6PX;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-brand .as-p,
|
||||
.soc-taro-root.social-home .footer-brand .as-p {
|
||||
font-size: 12PX !important;
|
||||
color: #64748b !important;
|
||||
line-height: 1.7 !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-links,
|
||||
.soc-taro-root.social-home .footer-links {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 8PX !important;
|
||||
padding: 14PX 16PX !important;
|
||||
border-radius: 14PX !important;
|
||||
background: rgba(255, 255, 255, 0.03) !important;
|
||||
border: 1PX solid rgba(255, 255, 255, 0.06) !important;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-links .as-h4,
|
||||
.soc-taro-root.social-home .footer-links .as-h4 {
|
||||
font-size: 12PX !important;
|
||||
color: #4ecdc4 !important;
|
||||
margin: 0 0 4PX !important;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-links .as-a,
|
||||
.soc-taro-root.social-home .footer-links .as-a {
|
||||
min-height: 40PX !important;
|
||||
font-size: 13PX !important;
|
||||
color: #cbd5e1 !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp .footer-bottom .as-p,
|
||||
.soc-taro-root.social-home .footer-bottom .as-p {
|
||||
font-size: 11PX !important;
|
||||
color: #475569 !important;
|
||||
text-align: center;
|
||||
margin-top: 8PX;
|
||||
}
|
||||
|
||||
/* path 不要在顶部假「主内容」——非 sticky,跟文档流走 */
|
||||
.soc-taro-root.social-weapp .social-path,
|
||||
.soc-taro-root.social-home .social-path {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
}
|
||||
|
||||
/* —— 底部 Dock(对齐 Next 移动端,非原生 tabBar) —— */
|
||||
.soc-taro-root .social-mobile-dock {
|
||||
position: fixed !important;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 80;
|
||||
display: flex !important;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
gap: 2PX;
|
||||
/* 模拟器已有 home indicator;再叠大 safe-area 会留一大块黑 */
|
||||
padding: 8PX 6PX 10PX !important;
|
||||
background: rgba(8, 10, 16, 0.96) !important;
|
||||
border-top: 1PX solid rgba(255, 255, 255, 0.08);
|
||||
backdrop-filter: blur(18PX);
|
||||
box-shadow: 0 -8PX 28PX rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.soc-taro-root .social-mobile-dock .as-a {
|
||||
flex: 1;
|
||||
flex-direction: column !important;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 3PX;
|
||||
min-height: 48PX;
|
||||
padding: 4PX 2PX;
|
||||
border-radius: 12PX;
|
||||
font-size: 10PX;
|
||||
font-weight: 600;
|
||||
color: #8090a3;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.soc-taro-root .social-mobile-dock .as-a[aria-current='page'] {
|
||||
color: #4ecdc4 !important;
|
||||
background: rgba(78, 205, 196, 0.1);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp,
|
||||
.soc-taro-root.social-home {
|
||||
padding-bottom: 72PX !important;
|
||||
}
|
||||
|
||||
/* —— 微信关掉 H5 特效层 —— */
|
||||
.social-weapp .social-constellation,
|
||||
.social-weapp .social-pointer-glow,
|
||||
.social-weapp .social-fx-control {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.social-weapp .social-fx-orbs {
|
||||
opacity: 0.55;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* —— 头像叠放 —— */
|
||||
.connection-avatar-stack {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
padding-left: 6PX;
|
||||
}
|
||||
|
||||
.connection-avatar-stack .social-avatar,
|
||||
.social-meetup-faces .social-avatar,
|
||||
.social-chat-presence-avs .social-avatar {
|
||||
margin-left: -8PX;
|
||||
border: 2PX solid #0a0e17;
|
||||
border-radius: 999PX;
|
||||
}
|
||||
|
||||
.connection-avatar-stack .social-avatar:first-child,
|
||||
.social-meetup-faces .social-avatar:first-child,
|
||||
.social-chat-presence-avs .social-avatar:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.social-meetup-faces {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
835
apps/miniprogram/h5/src/styles/social-weapp.scss
Normal file
835
apps/miniprogram/h5/src/styles/social-weapp.scss
Normal file
@ -0,0 +1,835 @@
|
||||
/**
|
||||
* 微信 / 非 H5:social 原生页样式(rem,WXSS 安全)。
|
||||
* 结构对齐 H5/Next DOM class,但不引入 @layer / :has / :is / html 全局 reset。
|
||||
*/
|
||||
@import './page-rem.scss';
|
||||
|
||||
page {
|
||||
background: #0a0e17;
|
||||
color: #f1f5f9;
|
||||
font-size: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-experience,
|
||||
.soc-taro-root {
|
||||
--sx-mint: #4ecdc4;
|
||||
--sx-coral: #ff7b75;
|
||||
--sx-gold: #ffe195;
|
||||
--bg-primary: #0a0e17;
|
||||
--connection-border: rgba(255, 255, 255, 0.1);
|
||||
--text-primary: #f1f5f9;
|
||||
--text-secondary: #94a3b8;
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
background:
|
||||
radial-gradient(ellipse 70% 45% at 50% -10%, rgba(78, 205, 196, 0.14), transparent),
|
||||
radial-gradient(ellipse 50% 35% at 90% 20%, rgba(255, 107, 107, 0.1), transparent),
|
||||
#0a0e17;
|
||||
color: #f1f5f9;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-taro-root view,
|
||||
.soc-taro-root text {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.social-ambient,
|
||||
.social-pointer-glow,
|
||||
.social-constellation,
|
||||
.social-emoji-field,
|
||||
.social-fx-belt {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.social-fx-orbs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.social-fx-control {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* —— 顶栏 —— */
|
||||
.soc-taro-root.social-home > .navbar,
|
||||
.soc-taro-root.social-weapp > .navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
padding: var(--safe-status-bar, 0PX) 0.75rem 0.5rem;
|
||||
background: rgba(10, 14, 23, 0.88);
|
||||
}
|
||||
|
||||
.soc-taro-root.social-weapp > .navbar .nav-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: var(--safe-nav-bar, 2.75rem);
|
||||
padding: 0.35rem 0.75rem;
|
||||
padding-right: var(--safe-menu-pad, 6rem);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 999px;
|
||||
background: rgba(18, 20, 26, 0.92);
|
||||
}
|
||||
|
||||
.nav-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-weight: 700;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.nav-actions .btn,
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #f1f5f9;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.btn.connection-join,
|
||||
.connection-join,
|
||||
.nav-actions .btn {
|
||||
background: linear-gradient(135deg, #ff7b75, #f06664);
|
||||
border-color: transparent;
|
||||
color: #111;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* —— Hero —— */
|
||||
.connection-hero {
|
||||
position: relative;
|
||||
padding: calc(var(--safe-header, 5.5rem) + 1.25rem) 0 1.5rem;
|
||||
}
|
||||
|
||||
.connection-hero-grid {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.connection-hero-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.connection-eyebrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.75rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.connection-status-dot {
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: var(--sx-mint);
|
||||
}
|
||||
|
||||
.connection-eyebrow-divider {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.connection-copy .as-h1,
|
||||
.connection-copy h1,
|
||||
#connection-title {
|
||||
margin: 0.6rem 0 0.75rem;
|
||||
font-size: 1.85rem;
|
||||
line-height: 1.25;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.connection-title-line {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.connection-title-accent {
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
|
||||
.connection-description {
|
||||
margin: 0 0 1rem;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.55;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.connection-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.connection-film {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.4rem;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: #f1f5f9;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.connection-proof {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.connection-avatar-stack {
|
||||
display: flex;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.connection-avatar-stack .social-avatar,
|
||||
.connection-avatar-stack image {
|
||||
margin-left: -0.45rem;
|
||||
border: 2px solid #0a0e17;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.connection-avatar-stack .social-avatar:first-child,
|
||||
.connection-avatar-stack image:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.connection-proof strong {
|
||||
display: block;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.connection-proof .as-span,
|
||||
.connection-proof span {
|
||||
font-size: 0.75rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.connection-universe {
|
||||
margin-top: 0.5rem;
|
||||
padding: 1rem;
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(18, 20, 26, 0.75);
|
||||
}
|
||||
|
||||
.connection-universe-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.8rem;
|
||||
color: #94a3b8;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.connection-orbit-scene {
|
||||
position: relative;
|
||||
min-height: 11rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.connection-center-icon {
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
border-radius: 999px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(78, 205, 196, 0.15);
|
||||
border: 1px solid rgba(78, 205, 196, 0.35);
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.connection-person {
|
||||
position: absolute;
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
border-radius: 999px;
|
||||
overflow: hidden;
|
||||
border: 2px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.connection-ways {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0 1rem;
|
||||
}
|
||||
|
||||
.connection-way {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
padding: 0.9rem 1rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(18, 20, 26, 0.8);
|
||||
}
|
||||
|
||||
.connection-way-index {
|
||||
font-size: 0.75rem;
|
||||
color: var(--sx-mint);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* —— 区块通用 —— */
|
||||
.social-main {
|
||||
padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0PX));
|
||||
}
|
||||
|
||||
.section,
|
||||
.section-compact {
|
||||
padding: 1.5rem 0;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-tag {
|
||||
display: inline-flex;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.7rem;
|
||||
color: #94a3b8;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.section-header .as-h2,
|
||||
.section-header h2 {
|
||||
margin: 0 0 0.4rem;
|
||||
font-size: 1.35rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.section-header .as-p,
|
||||
.section-header p {
|
||||
margin: 0;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.5;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-title-emoji {
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.social-path {
|
||||
position: sticky;
|
||||
top: calc(var(--safe-header, 5rem));
|
||||
z-index: 20;
|
||||
padding: 0.5rem 0;
|
||||
background: rgba(10, 14, 23, 0.92);
|
||||
}
|
||||
|
||||
.social-path-track {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.social-path-link {
|
||||
flex: 0 0 auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
min-height: 2.25rem;
|
||||
padding: 0 0.75rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
font-size: 0.75rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.social-path-link[aria-current='page'],
|
||||
.social-path-link.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
|
||||
.social-panel-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.social-panel {
|
||||
display: block;
|
||||
padding: 1rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(18, 20, 26, 0.85);
|
||||
}
|
||||
|
||||
.social-panel .as-h3,
|
||||
.social-panel h3 {
|
||||
margin: 0.5rem 0 0.35rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.social-panel .as-p,
|
||||
.social-panel p {
|
||||
margin: 0;
|
||||
font-size: 0.8rem;
|
||||
color: #94a3b8;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.social-panel-meta {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
font-size: 0.7rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-panel-ico {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.social-section-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.social-people-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.social-person-card {
|
||||
padding: 1rem;
|
||||
border-radius: 1.125rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(18, 20, 26, 0.88);
|
||||
}
|
||||
|
||||
.social-person-card-top {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.social-like-btn {
|
||||
margin-left: auto;
|
||||
min-width: 2.75rem;
|
||||
min-height: 2.75rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.social-like-btn.is-on {
|
||||
color: #f06664;
|
||||
border-color: rgba(240, 102, 100, 0.4);
|
||||
}
|
||||
|
||||
.social-person-card-bio {
|
||||
display: block;
|
||||
margin-top: 0.65rem;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.45;
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.social-person-card-tags,
|
||||
.social-date-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
margin-top: 0.65rem;
|
||||
}
|
||||
|
||||
.social-person-card-tags .as-span,
|
||||
.social-person-card-tags text,
|
||||
.social-date-card-tags .as-span,
|
||||
.social-date-card-tags text {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.social-people-filter {
|
||||
flex: 0 0 auto;
|
||||
min-height: 2.25rem;
|
||||
padding: 0 0.75rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.social-people-filter.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
|
||||
.social-demo-badge {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.social-muted {
|
||||
opacity: 0.62;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.social-avatar,
|
||||
.soc-taro-root image {
|
||||
display: block;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
/* —— 底栏 —— */
|
||||
.social-mobile-dock {
|
||||
position: fixed;
|
||||
left: 0.75rem;
|
||||
right: 0.75rem;
|
||||
bottom: calc(0.5rem + env(safe-area-inset-bottom, 0PX));
|
||||
z-index: 50;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
min-height: 3.5rem;
|
||||
padding: 0.35rem 0.25rem;
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(12, 12, 15, 0.94);
|
||||
}
|
||||
|
||||
.social-mobile-dock .as-a,
|
||||
.social-mobile-dock a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.15rem;
|
||||
min-height: 2.75rem;
|
||||
min-width: 2.75rem;
|
||||
font-size: 0.65rem;
|
||||
font-weight: 650;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.social-mobile-dock [aria-current='page'] {
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
|
||||
/* —— 子页条 —— */
|
||||
.social-live-bar,
|
||||
.social-date-bar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1rem 0.5rem;
|
||||
}
|
||||
|
||||
.social-live-bar-main,
|
||||
.social-date-bar-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.social-nav-back {
|
||||
min-height: 2.75rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.social-chat-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem calc(5.5rem + env(safe-area-inset-bottom, 0PX));
|
||||
}
|
||||
|
||||
.social-chat-channel {
|
||||
padding: 0.75rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(18, 20, 26, 0.85);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.social-chat-channel.is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
}
|
||||
|
||||
.social-chat-thread {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.65rem;
|
||||
min-height: 12rem;
|
||||
}
|
||||
|
||||
.social-chat-bubble {
|
||||
max-width: 88%;
|
||||
padding: 0.65rem 0.75rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.social-chat-bubble.is-mine {
|
||||
align-self: flex-end;
|
||||
background: rgba(78, 205, 196, 0.16);
|
||||
border-color: rgba(78, 205, 196, 0.28);
|
||||
}
|
||||
|
||||
.social-chat-composer {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(12, 12, 15, 0.94);
|
||||
}
|
||||
|
||||
.social-chat-input,
|
||||
.social-field-input {
|
||||
flex: 1;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
border-radius: 0.65rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #f1f5f9;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* —— date 卡片 —— */
|
||||
.social-date-root {
|
||||
padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0PX));
|
||||
}
|
||||
|
||||
.social-date-deck {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 26rem;
|
||||
margin: 0.75rem auto 0;
|
||||
min-height: 22rem;
|
||||
}
|
||||
|
||||
.social-date-card {
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
overflow: hidden;
|
||||
background: #12141a;
|
||||
}
|
||||
|
||||
.social-date-card.is-top {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.social-date-card-cover {
|
||||
min-height: 14rem;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.social-date-card-body {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.social-date-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.social-date-act {
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
border-radius: 999px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.social-date-act.like {
|
||||
background: rgba(78, 205, 196, 0.18);
|
||||
border-color: rgba(78, 205, 196, 0.4);
|
||||
}
|
||||
|
||||
.social-date-act.pass {
|
||||
background: rgba(255, 123, 117, 0.14);
|
||||
border-color: rgba(255, 123, 117, 0.35);
|
||||
}
|
||||
|
||||
.social-date-stamp {
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
z-index: 3;
|
||||
font-weight: 800;
|
||||
font-size: 1.1rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border: 2px solid currentColor;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.social-date-stamp.like {
|
||||
left: 1rem;
|
||||
color: var(--sx-mint);
|
||||
transform: rotate(-12deg);
|
||||
}
|
||||
|
||||
.social-date-stamp.pass {
|
||||
right: 1rem;
|
||||
color: #ff7b75;
|
||||
transform: rotate(12deg);
|
||||
}
|
||||
|
||||
.social-date-progress {
|
||||
height: 0.25rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
overflow: hidden;
|
||||
margin: 0 1rem 0.5rem;
|
||||
}
|
||||
|
||||
.social-date-empty {
|
||||
padding: 2rem 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.connection-invite {
|
||||
margin: 1.5rem 1rem 2rem;
|
||||
padding: 1.25rem;
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(18, 20, 26, 0.9);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.connection-invite .as-h2,
|
||||
.connection-invite h2 {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 1.5rem 1rem 6rem;
|
||||
opacity: 0.85;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.footer-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.footer-links .as-a,
|
||||
.footer-links a {
|
||||
display: block;
|
||||
padding: 0.35rem 0;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.reveal {
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.social-ugc-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.65rem;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.social-ugc-card {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: flex-start;
|
||||
padding: 0.85rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.social-together-tabs {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.social-together-tabs .as-a,
|
||||
.social-together-tabs a {
|
||||
min-height: 2.25rem;
|
||||
padding: 0 0.85rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.social-together-tabs .is-on {
|
||||
border-color: rgba(78, 205, 196, 0.45);
|
||||
color: var(--sx-mint);
|
||||
}
|
||||
722
apps/miniprogram/h5/src/styles/social.scss
Normal file
722
apps/miniprogram/h5/src/styles/social.scss
Normal file
@ -0,0 +1,722 @@
|
||||
/**
|
||||
* Taro social — rem 尺度(对齐 vip-landing / VipLoginModal)
|
||||
* 禁止裸 px 进共用样式(designWidth:750 会缩水)
|
||||
*/
|
||||
|
||||
.soc-root {
|
||||
--soc-bg: #0c0c0f;
|
||||
--soc-card: rgba(24, 26, 32, 0.92);
|
||||
--soc-border: rgba(255, 255, 255, 0.1);
|
||||
--soc-text: #f1f5f9;
|
||||
--soc-muted: rgba(241, 245, 249, 0.58);
|
||||
--soc-mint: #4ecdc4;
|
||||
--soc-coral: #f06664;
|
||||
--soc-amber: #f59e0b;
|
||||
--soc-dock-h: 4.25rem;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
background:
|
||||
radial-gradient(ellipse 80% 50% at 20% -10%, rgba(78, 205, 196, 0.16), transparent 55%),
|
||||
radial-gradient(ellipse 70% 45% at 90% 0%, rgba(240, 102, 100, 0.12), transparent 50%),
|
||||
var(--soc-bg);
|
||||
color: var(--soc-text);
|
||||
box-sizing: border-box;
|
||||
padding-bottom: calc(var(--soc-dock-h) + env(safe-area-inset-bottom, 0px) + 1rem);
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.soc-root *,
|
||||
.soc-root *::before,
|
||||
.soc-root *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.soc-shell {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.soc-topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 2.75rem;
|
||||
padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0 0.5rem;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.soc-brand {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.soc-brand-kicker {
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-brand-title {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--soc-text);
|
||||
}
|
||||
|
||||
.soc-top-cta {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid rgba(78, 205, 196, 0.35);
|
||||
background: rgba(78, 205, 196, 0.14);
|
||||
color: var(--soc-mint);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.soc-hero {
|
||||
padding: 0.75rem 0 0.25rem;
|
||||
}
|
||||
|
||||
.soc-hero-h1 {
|
||||
display: block;
|
||||
font-size: clamp(1.625rem, 6.5vw, 2.125rem);
|
||||
font-weight: 780;
|
||||
line-height: 1.2;
|
||||
letter-spacing: -0.03em;
|
||||
margin: 0 0 0.65rem;
|
||||
}
|
||||
|
||||
.soc-hero-accent {
|
||||
color: var(--soc-mint);
|
||||
}
|
||||
|
||||
.soc-hero-lead {
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.55;
|
||||
color: var(--soc-muted);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.soc-hero-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.soc-btn-primary {
|
||||
grid-column: 1 / -1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 3rem;
|
||||
border-radius: 0.875rem;
|
||||
background: linear-gradient(135deg, #4ecdc4, #2bb8b0);
|
||||
color: #041312;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.soc-btn-ghost {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.35rem;
|
||||
min-height: 2.75rem;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--soc-text);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.soc-ways {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0 1.25rem;
|
||||
}
|
||||
|
||||
.soc-ways-label {
|
||||
display: block;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--soc-muted);
|
||||
margin-bottom: 0.15rem;
|
||||
}
|
||||
|
||||
.soc-way {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
width: 100%;
|
||||
min-height: 4rem;
|
||||
padding: 0.875rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: var(--soc-card);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.soc-way--mint {
|
||||
box-shadow: inset 0 0 0 1px rgba(78, 205, 196, 0.08);
|
||||
}
|
||||
|
||||
.soc-way--coral {
|
||||
box-shadow: inset 0 0 0 1px rgba(240, 102, 100, 0.12);
|
||||
}
|
||||
|
||||
.soc-way--yellow {
|
||||
box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.14);
|
||||
}
|
||||
|
||||
.soc-way-index {
|
||||
position: absolute;
|
||||
right: 2.5rem;
|
||||
top: -0.15rem;
|
||||
font-size: 2.75rem;
|
||||
font-weight: 800;
|
||||
opacity: 0.06;
|
||||
pointer-events: none;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.soc-way-icon {
|
||||
flex-shrink: 0;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border-radius: 0.75rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.25rem;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.soc-way-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.soc-way-title {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.soc-way-sub {
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-way-arrow {
|
||||
flex-shrink: 0;
|
||||
font-size: 1rem;
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-section-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
margin: 0.25rem 0 0.75rem;
|
||||
}
|
||||
|
||||
.soc-section-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.soc-section-more {
|
||||
font-size: 0.75rem;
|
||||
color: var(--soc-mint);
|
||||
font-weight: 600;
|
||||
min-height: 2.75rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.soc-people-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
|
||||
.soc-person {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: flex-start;
|
||||
padding: 0.875rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: var(--soc-card);
|
||||
}
|
||||
|
||||
.soc-avatar {
|
||||
width: 3.25rem;
|
||||
height: 3.25rem;
|
||||
border-radius: 999px;
|
||||
flex-shrink: 0;
|
||||
background: #1a1d24;
|
||||
border: 2px solid rgba(78, 205, 196, 0.35);
|
||||
}
|
||||
|
||||
.soc-person-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
|
||||
.soc-person-name {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.soc-person-meta {
|
||||
font-size: 0.75rem;
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-person-bio {
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.45;
|
||||
color: rgba(241, 245, 249, 0.78);
|
||||
margin-top: 0.15rem;
|
||||
}
|
||||
|
||||
.soc-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.soc-tag {
|
||||
font-size: 0.6875rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-online {
|
||||
color: var(--soc-mint);
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.soc-offline {
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
/* —— Chat —— */
|
||||
.soc-room-list {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.soc-room {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
min-height: 4rem;
|
||||
padding: 0.875rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: var(--soc-card);
|
||||
}
|
||||
|
||||
.soc-room-emoji {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
border-radius: 0.85rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.25rem;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.soc-room-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.soc-room-title {
|
||||
display: block;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.soc-room-sub {
|
||||
display: block;
|
||||
font-size: 0.75rem;
|
||||
color: var(--soc-muted);
|
||||
margin-top: 0.15rem;
|
||||
}
|
||||
|
||||
.soc-badge {
|
||||
min-width: 1.35rem;
|
||||
height: 1.35rem;
|
||||
padding: 0 0.35rem;
|
||||
border-radius: 999px;
|
||||
background: var(--soc-coral);
|
||||
color: #fff;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.soc-thread {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.625rem;
|
||||
margin-top: 0.75rem;
|
||||
min-height: 12rem;
|
||||
}
|
||||
|
||||
.soc-bubble {
|
||||
max-width: 85%;
|
||||
padding: 0.65rem 0.85rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.45;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border: 1px solid var(--soc-border);
|
||||
}
|
||||
|
||||
.soc-bubble--mine {
|
||||
align-self: flex-end;
|
||||
background: rgba(78, 205, 196, 0.18);
|
||||
border-color: rgba(78, 205, 196, 0.28);
|
||||
}
|
||||
|
||||
.soc-bubble-from {
|
||||
display: block;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--soc-muted);
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.soc-composer {
|
||||
position: sticky;
|
||||
bottom: calc(var(--soc-dock-h) + env(safe-area-inset-bottom, 0px) + 0.5rem);
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
padding: 0.5rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: rgba(12, 12, 15, 0.92);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.soc-composer-input {
|
||||
flex: 1;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
border: none;
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: var(--soc-text);
|
||||
font-size: 1rem; /* iOS avoid zoom */
|
||||
}
|
||||
|
||||
.soc-composer-send {
|
||||
flex-shrink: 0;
|
||||
min-width: 4.5rem;
|
||||
min-height: 2.75rem;
|
||||
border-radius: 0.75rem;
|
||||
border: none;
|
||||
background: var(--soc-mint);
|
||||
color: #041312;
|
||||
font-weight: 700;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* —— Date cards —— */
|
||||
.soc-date-stage {
|
||||
position: relative;
|
||||
min-height: 26rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.soc-date-card {
|
||||
position: absolute;
|
||||
inset: 0 auto auto 0;
|
||||
width: 100%;
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: var(--soc-card);
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.soc-date-cover {
|
||||
width: 100%;
|
||||
height: 14rem;
|
||||
object-fit: cover;
|
||||
background: #1a1d24;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.soc-date-body {
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.soc-date-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.625rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.soc-date-pass,
|
||||
.soc-date-like {
|
||||
min-height: 3rem;
|
||||
border-radius: 0.875rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.soc-date-pass {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-date-like {
|
||||
background: rgba(240, 102, 100, 0.18);
|
||||
border-color: rgba(240, 102, 100, 0.35);
|
||||
color: #fecaca;
|
||||
}
|
||||
|
||||
.soc-empty {
|
||||
text-align: center;
|
||||
padding: 2.5rem 1rem;
|
||||
color: var(--soc-muted);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.soc-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
|
||||
.soc-roster-card {
|
||||
padding: 1rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: var(--soc-card);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.soc-roster-row {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.soc-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.soc-field-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--soc-muted);
|
||||
}
|
||||
|
||||
.soc-field-input {
|
||||
min-height: 2.75rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--soc-text);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.soc-save {
|
||||
min-height: 3rem;
|
||||
border-radius: 0.875rem;
|
||||
border: none;
|
||||
background: var(--soc-amber);
|
||||
color: #1a1205;
|
||||
font-weight: 750;
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
/* —— Dock —— */
|
||||
.soc-dock {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 50;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 0.15rem;
|
||||
padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
|
||||
background: rgba(12, 12, 15, 0.94);
|
||||
border-top: 1px solid var(--soc-border);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.soc-dock-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.15rem;
|
||||
min-height: 3.25rem;
|
||||
border-radius: 0.75rem;
|
||||
color: var(--soc-muted);
|
||||
font-size: 0.625rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.soc-dock-item.is-active {
|
||||
color: var(--soc-mint);
|
||||
background: rgba(78, 205, 196, 0.1);
|
||||
}
|
||||
|
||||
.soc-dock-emoji {
|
||||
font-size: 1.15rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* —— Tablet / PC adaptive —— */
|
||||
@media (min-width: 601px) {
|
||||
.soc-shell {
|
||||
max-width: 40rem;
|
||||
padding: 0 1.25rem;
|
||||
}
|
||||
|
||||
.soc-people-row,
|
||||
.soc-grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.soc-date-cover {
|
||||
height: 16rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 901px) {
|
||||
.soc-root {
|
||||
--soc-dock-h: 4.5rem;
|
||||
}
|
||||
|
||||
.soc-shell {
|
||||
max-width: 56rem;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
.soc-hero {
|
||||
display: grid;
|
||||
grid-template-columns: 1.15fr 0.85fr;
|
||||
gap: 1.5rem;
|
||||
align-items: end;
|
||||
padding-top: 1.25rem;
|
||||
}
|
||||
|
||||
.soc-hero-h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.soc-hero-lead {
|
||||
font-size: 0.9375rem;
|
||||
max-width: 28rem;
|
||||
}
|
||||
|
||||
.soc-ways {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.soc-ways-label {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.soc-way:first-of-type {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.soc-people-row {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
.soc-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
.soc-dock {
|
||||
left: 50%;
|
||||
right: auto;
|
||||
transform: translateX(-50%);
|
||||
width: min(36rem, calc(100% - 2rem));
|
||||
margin-bottom: 0.75rem;
|
||||
border-radius: 1.25rem;
|
||||
border: 1px solid var(--soc-border);
|
||||
box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.soc-composer {
|
||||
bottom: calc(var(--soc-dock-h) + 1.25rem);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.soc-shell {
|
||||
max-width: 64rem;
|
||||
}
|
||||
|
||||
.soc-ways {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
.soc-way:first-of-type {
|
||||
grid-column: span 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.soc-way,
|
||||
.soc-date-card {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
200
apps/miniprogram/h5/src/utils/socialJoinPay.ts
Normal file
200
apps/miniprogram/h5/src/utils/socialJoinPay.ts
Normal file
@ -0,0 +1,200 @@
|
||||
/**
|
||||
* 游民社区加群虚拟支付 — 走 /pay/social-join-order,禁止复用 VIP payVirtualProduct。
|
||||
*/
|
||||
import Taro from '@tarojs/taro'
|
||||
import { API_BASE, APP_TARGET, STORAGE_TOKEN } from './config'
|
||||
import { ensureLogin } from './request'
|
||||
|
||||
export type SocialJoinPayPayload = {
|
||||
signData: string
|
||||
mode: string
|
||||
paySig: string
|
||||
signature: string
|
||||
outTradeNo: string
|
||||
productId?: string
|
||||
goodsPrice?: number
|
||||
kind?: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
export type SocialJoinStatus = {
|
||||
ok: boolean
|
||||
isMember: boolean
|
||||
bookId: string
|
||||
title: string
|
||||
priceFen: number
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
const LOCAL_MEMBER_KEY = 'nomadro_social_join_member'
|
||||
|
||||
function isCancel(err: unknown): boolean {
|
||||
const msg = String((err as { message?: string })?.message || err || '').toLowerCase()
|
||||
const code = Number((err as { errCode?: number })?.errCode ?? NaN)
|
||||
return code === -2 || msg.includes('cancel') || msg.includes('取消')
|
||||
}
|
||||
|
||||
function isSessionPayError(err: unknown): boolean {
|
||||
const msg = String((err as { message?: string })?.message || err || '')
|
||||
const code = Number((err as { errCode?: number })?.errCode ?? NaN)
|
||||
return (
|
||||
code === -15005 ||
|
||||
code === -15007 ||
|
||||
code === 401 ||
|
||||
/signature|session|登录|过期|-15005|-15007|401|未登录|失效/i.test(msg)
|
||||
)
|
||||
}
|
||||
|
||||
function invokeVirtualPayment(payData: SocialJoinPayPayload): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const api = Taro as unknown as {
|
||||
requestVirtualPayment?: (opts: Record<string, unknown>) => void
|
||||
}
|
||||
if (typeof api.requestVirtualPayment !== 'function') {
|
||||
reject(Object.assign(new Error('当前环境不支持虚拟支付'), { errCode: -1002 }))
|
||||
return
|
||||
}
|
||||
api.requestVirtualPayment({
|
||||
signData: payData.signData,
|
||||
mode: payData.mode,
|
||||
paySig: payData.paySig,
|
||||
signature: payData.signature,
|
||||
success: () => resolve(),
|
||||
fail: (err: { errMsg?: string; errCode?: number }) => {
|
||||
reject(
|
||||
Object.assign(new Error(err?.errMsg || `支付失败 ${err?.errCode || ''}`), {
|
||||
errCode: err?.errCode,
|
||||
}),
|
||||
)
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function createSocialJoinOrder(): Promise<SocialJoinPayPayload> {
|
||||
await ensureLogin(true)
|
||||
const token = Taro.getStorageSync(STORAGE_TOKEN)
|
||||
const urls = [
|
||||
`${API_BASE}/api/ebook/pay/social-join-order`,
|
||||
`${API_BASE}/api/pay/social-join-order`,
|
||||
]
|
||||
let lastDetail = '加群下单失败'
|
||||
for (const url of urls) {
|
||||
const res = await Taro.request({
|
||||
url,
|
||||
method: 'POST',
|
||||
data: {},
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
})
|
||||
if (res.statusCode < 400) {
|
||||
return res.data as SocialJoinPayPayload
|
||||
}
|
||||
const detail = (res.data as { detail?: string })?.detail
|
||||
if (typeof detail === 'string' && detail) lastDetail = detail
|
||||
if (res.statusCode === 401) {
|
||||
await ensureLogin(true)
|
||||
}
|
||||
}
|
||||
throw new Error(lastDetail)
|
||||
}
|
||||
|
||||
export async function fetchSocialJoinStatus(): Promise<SocialJoinStatus | null> {
|
||||
try {
|
||||
await ensureLogin(false)
|
||||
const token = Taro.getStorageSync(STORAGE_TOKEN)
|
||||
if (!token) {
|
||||
return {
|
||||
ok: true,
|
||||
isMember: Boolean(Taro.getStorageSync(LOCAL_MEMBER_KEY)),
|
||||
bookId: '__social_join__',
|
||||
title: '游民社区加群',
|
||||
priceFen: 4900,
|
||||
enabled: true,
|
||||
}
|
||||
}
|
||||
const urls = [
|
||||
`${API_BASE}/api/ebook/pay/social-join-status`,
|
||||
`${API_BASE}/api/pay/social-join-status`,
|
||||
]
|
||||
for (const url of urls) {
|
||||
const res = await Taro.request({
|
||||
url,
|
||||
method: 'GET',
|
||||
header: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (res.statusCode < 400) {
|
||||
const data = res.data as SocialJoinStatus
|
||||
if (data?.isMember) Taro.setStorageSync(LOCAL_MEMBER_KEY, '1')
|
||||
return data
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* offline */
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
isMember: Boolean(Taro.getStorageSync(LOCAL_MEMBER_KEY)),
|
||||
bookId: '__social_join__',
|
||||
title: '游民社区加群',
|
||||
priceFen: 4900,
|
||||
enabled: true,
|
||||
}
|
||||
}
|
||||
|
||||
export function markSocialJoinLocal(): void {
|
||||
Taro.setStorageSync(LOCAL_MEMBER_KEY, '1')
|
||||
}
|
||||
|
||||
export function isSocialJoinLocal(): boolean {
|
||||
return Boolean(Taro.getStorageSync(LOCAL_MEMBER_KEY))
|
||||
}
|
||||
|
||||
/** 微信小程序:独立加群虚拟支付。tt/xhs:联调模拟。H5:本地标记(提示去小程序)。 */
|
||||
export async function paySocialJoin(): Promise<string> {
|
||||
if (APP_TARGET === 'tt' || APP_TARGET === 'xhs') {
|
||||
const conf = await Taro.showModal({
|
||||
title: '加群支付联调',
|
||||
content: '模拟游民社区加群收费(非 VIP)',
|
||||
confirmText: '模拟成功',
|
||||
})
|
||||
if (!conf.confirm) throw Object.assign(new Error('取消'), { errCode: -2 })
|
||||
markSocialJoinLocal()
|
||||
return `mock_social_${Date.now()}`
|
||||
}
|
||||
|
||||
if (APP_TARGET === 'h5' || process.env.TARO_ENV === 'h5') {
|
||||
markSocialJoinLocal()
|
||||
return `h5_local_${Date.now()}`
|
||||
}
|
||||
|
||||
let lastErr: unknown
|
||||
for (let attempt = 0; attempt < 3; attempt++) {
|
||||
try {
|
||||
if (attempt > 0) await ensureLogin(true)
|
||||
const payData = await createSocialJoinOrder()
|
||||
try {
|
||||
await invokeVirtualPayment(payData)
|
||||
markSocialJoinLocal()
|
||||
return payData.outTradeNo
|
||||
} catch (payErr) {
|
||||
if (isCancel(payErr)) throw payErr
|
||||
if (isSessionPayError(payErr) && attempt < 2) {
|
||||
lastErr = payErr
|
||||
continue
|
||||
}
|
||||
throw payErr
|
||||
}
|
||||
} catch (e) {
|
||||
if (isCancel(e)) throw e
|
||||
if (isSessionPayError(e) && attempt < 2) {
|
||||
lastErr = e
|
||||
continue
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
throw lastErr || new Error('加群支付未完成')
|
||||
}
|
||||
24
apps/miniprogram/weapp/ai-pkg/AGENTS.md
Normal file
24
apps/miniprogram/weapp/ai-pkg/AGENTS.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Nomadro 游民社区 · 小程序 AI
|
||||
|
||||
你是 nomadro 游民社区助手。帮助用户:加入社区(加群收费)、开语音/视频见面、找搭子/共创报名。
|
||||
|
||||
## 边界
|
||||
|
||||
- **加群收费**是游民社区一次性入群费(微信虚拟支付),**不是** VIP 会员、也不是 `pages/community` 社群付费。
|
||||
- **开视频**在微信内用原生 `live-pusher` / LivePusherContext(RTC);H5/门户用 MiroTalk WebRTC。禁止用 web-view 嵌业务页。
|
||||
- **找搭子/共创**需要填申请表(称呼、联系方式、能带来什么),提交只是表达兴趣。
|
||||
|
||||
## 技能选择
|
||||
|
||||
| 用户意图 | 调用 |
|
||||
|---|---|
|
||||
| 加群 / 入群 / 付费进社区 / 找到同频 | `joinSocialCommunity` |
|
||||
| 开视频 / 语音见面 / 进直播厅 / meetup | `listMeetupRooms` → `openMeetupLive` |
|
||||
| 找搭子 / 兼职 / 志愿 / 共创 / 申请岗位 | `listTeamGigs` → `applyTeamGig` |
|
||||
|
||||
登录身份与主小程序一致;可用 storage 共享 `nomadro_token`。
|
||||
未登录时引导用户点账号卡片进入接力页完成支付或表单。
|
||||
|
||||
## 语气
|
||||
|
||||
简洁、像同路人。不夸大「已录用」。不把加群说成开通 VIP。
|
||||
20
apps/miniprogram/weapp/ai-pkg/socialSkill/SKILL.md
Normal file
20
apps/miniprogram/weapp/ai-pkg/socialSkill/SKILL.md
Normal file
@ -0,0 +1,20 @@
|
||||
# 游民社区 socialSkill
|
||||
|
||||
帮助用户完成 nomadro 游民社区三件事:加群收费、开语音视频、找搭子申请。
|
||||
|
||||
## 何时使用
|
||||
|
||||
- 用户想加入游民社区、付费入群、认识同频的人 → `joinSocialCommunity`
|
||||
- 用户想开视频/语音、参加线上见面、进入某场 meetup → `listMeetupRooms` / `openMeetupLive`
|
||||
- 用户想找搭子、兼职、志愿、共创、报名岗位 → `listTeamGigs` / `applyTeamGig`
|
||||
|
||||
## 重要约束
|
||||
|
||||
1. 加群支付与 VIP(`__vip__`)隔离,书签权益是 `__social_join__`。
|
||||
2. 微信内视频用原生 live-pusher(RTC)+ 接力页;不要建议 web-view。
|
||||
3. 申请岗位必须有称呼与联系方式;简介可选。失败时说明已先留本机,可重试。
|
||||
4. 优先返回 handoff / page-link,让用户点进小程序接力页完成支付或填表。
|
||||
|
||||
## 离线兜底
|
||||
|
||||
接口失败时仍返回本地种子场次/岗位列表与对应页面路径,避免空回复。
|
||||
49
apps/miniprogram/weapp/ai-pkg/socialSkill/apis/_seed.js
Normal file
49
apps/miniprogram/weapp/ai-pkg/socialSkill/apis/_seed.js
Normal file
@ -0,0 +1,49 @@
|
||||
/** 离线种子 — 与 h5 socialCatalog 对齐,AI 原子环境无 bundler */
|
||||
const MEETUPS = [
|
||||
{
|
||||
id: 'wk-nomad-office',
|
||||
title: '周三线上办公室',
|
||||
date: '2026-11-05',
|
||||
time: '20:00',
|
||||
mirotalkRoom: 'nomadro-social-office',
|
||||
},
|
||||
{
|
||||
id: 'visa-ama',
|
||||
title: '签证 AMA · 东南亚',
|
||||
date: '2026-11-08',
|
||||
time: '21:00',
|
||||
mirotalkRoom: 'nomadro-visa-ama',
|
||||
},
|
||||
]
|
||||
|
||||
const GIGS = [
|
||||
{
|
||||
id: 'vol-welcome',
|
||||
title: '欢迎新人的帮手',
|
||||
role: '帮忙志愿',
|
||||
pay: '公益积分 / 社群徽章',
|
||||
kind: 'volunteer',
|
||||
remote: true,
|
||||
tags: ['带新人', '答疑', '周报'],
|
||||
},
|
||||
{
|
||||
id: 'ops-assistant',
|
||||
title: '运营 / 拍摄助理',
|
||||
role: '大学生兼职',
|
||||
pay: '按场次结算',
|
||||
kind: 'parttime',
|
||||
remote: true,
|
||||
tags: ['拍摄', '剪辑', '活动跟场'],
|
||||
},
|
||||
{
|
||||
id: 'ft-community',
|
||||
title: '社群运营负责人',
|
||||
role: '全职 · 线上优先',
|
||||
pay: '面议 · 季度复盘',
|
||||
kind: 'fulltime',
|
||||
remote: true,
|
||||
tags: ['增长', '活动', '认识人'],
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = { MEETUPS, GIGS }
|
||||
112
apps/miniprogram/weapp/ai-pkg/socialSkill/apis/applyTeamGig.js
Normal file
112
apps/miniprogram/weapp/ai-pkg/socialSkill/apis/applyTeamGig.js
Normal file
@ -0,0 +1,112 @@
|
||||
const { GIGS } = require('./_seed')
|
||||
const API = 'https://api.nomadro.cn'
|
||||
|
||||
function text(t) {
|
||||
return [{ type: 'text', text: t }]
|
||||
}
|
||||
|
||||
function guestId() {
|
||||
let id = ''
|
||||
try {
|
||||
id = wx.getStorageSync('nomadro_social_guest') || ''
|
||||
} catch (e) {
|
||||
id = ''
|
||||
}
|
||||
if (!id) {
|
||||
id = `guest_${Date.now().toString(36)}`
|
||||
try {
|
||||
wx.setStorageSync('nomadro_social_guest', id)
|
||||
} catch (e) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
async function applyTeamGig({ gigId, name, contact, note } = {}, ctx) {
|
||||
const id = String(gigId || '').trim()
|
||||
if (!id) {
|
||||
return {
|
||||
isError: true,
|
||||
content: text('请提供岗位 gigId。可先调用 listTeamGigs。'),
|
||||
}
|
||||
}
|
||||
const gig = GIGS.find((g) => g.id === id)
|
||||
const n = String(name || '').trim()
|
||||
const c = String(contact || '').trim()
|
||||
const noteText = String(note || (ctx && ctx.query) || '').trim()
|
||||
|
||||
if (!n || !c) {
|
||||
return {
|
||||
isError: false,
|
||||
content: text('申请需要「怎么称呼」和「联系方式」。点卡片打开表单补全后再提交。'),
|
||||
structuredContent: {
|
||||
status: 'need_form',
|
||||
gigId: id,
|
||||
title: (gig && gig.title) || id,
|
||||
pagePath: `/pages/social/team/index?gig=${encodeURIComponent(id)}`,
|
||||
linkText: '打开申请表',
|
||||
},
|
||||
handoff: () => ({
|
||||
path: '/pages/social/team/index',
|
||||
query: `gig=${encodeURIComponent(id)}&apply=1`,
|
||||
payload: {
|
||||
gigId: id,
|
||||
openApply: true,
|
||||
draft: { name: n, contact: c, note: noteText },
|
||||
},
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
let delivery = 'local'
|
||||
try {
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: `${API}/api/social/v1/gigs/${encodeURIComponent(id)}/apply`,
|
||||
method: 'POST',
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Social-Guest-Id': guestId(),
|
||||
},
|
||||
data: { name: n, contact: c, note: noteText },
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
delivery = res.statusCode < 400 ? 'sent' : 'local'
|
||||
} catch (e) {
|
||||
delivery = 'local'
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = wx.getStorageSync('nomadro_social_gig_apps') || {}
|
||||
raw[id] = { name: n, contact: c, note: noteText, delivery, at: Date.now() }
|
||||
wx.setStorageSync('nomadro_social_gig_apps', raw)
|
||||
} catch (e) {
|
||||
/* ignore */
|
||||
}
|
||||
|
||||
return {
|
||||
isError: false,
|
||||
content: text(
|
||||
delivery === 'sent'
|
||||
? `已提交「${(gig && gig.title) || id}」的兴趣申请,对方看到后会再联系你。`
|
||||
: `申请已先留在本机。有网后可在找搭子页重试提交。`,
|
||||
),
|
||||
structuredContent: {
|
||||
status: delivery,
|
||||
gigId: id,
|
||||
title: (gig && gig.title) || id,
|
||||
pagePath: `/pages/social/team/index?gig=${encodeURIComponent(id)}`,
|
||||
linkText: '查看申请',
|
||||
},
|
||||
handoff: () => ({
|
||||
path: '/pages/social/team/index',
|
||||
query: `gig=${encodeURIComponent(id)}`,
|
||||
payload: { gigId: id, delivery, draft: { name: n, contact: c, note: noteText } },
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = applyTeamGig
|
||||
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 原子接口:加群收费(虚拟支付)— 接力到 /pages/social/index 拉起 JoinPaySheet
|
||||
* 可用 API:wx.getStorageSync / wx.setStorageSync / wx.request / wx.login
|
||||
*/
|
||||
const API = 'https://api.nomadro.cn'
|
||||
|
||||
function text(t) {
|
||||
return [{ type: 'text', text: t }]
|
||||
}
|
||||
|
||||
async function joinSocialCommunity({ email } = {}) {
|
||||
if (email) {
|
||||
try {
|
||||
wx.setStorageSync('userEmail', String(email).trim().toLowerCase())
|
||||
} catch (e) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
let isMember = false
|
||||
let priceFen = 4900
|
||||
try {
|
||||
const token = wx.getStorageSync('nomadro_token') || ''
|
||||
if (token) {
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: `${API}/api/ebook/pay/social-join-status`,
|
||||
method: 'GET',
|
||||
header: { Authorization: `Bearer ${token}` },
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
if (res.statusCode < 400 && res.data) {
|
||||
isMember = Boolean(res.data.isMember)
|
||||
if (res.data.priceFen) priceFen = Number(res.data.priceFen) || priceFen
|
||||
}
|
||||
} else {
|
||||
isMember = Boolean(wx.getStorageSync('nomadro_social_join_member'))
|
||||
}
|
||||
} catch (e) {
|
||||
isMember = Boolean(wx.getStorageSync('nomadro_social_join_member'))
|
||||
}
|
||||
|
||||
const priceLabel = `¥${(priceFen / 100).toFixed(0)}`
|
||||
const pagePath = '/pages/social/index'
|
||||
const structuredContent = {
|
||||
title: isMember ? '你已在游民社区' : '加入游民社区 · 加群收费',
|
||||
priceLabel,
|
||||
isMember,
|
||||
pagePath,
|
||||
linkText: isMember ? '打开游民社区' : '去支付加群',
|
||||
}
|
||||
|
||||
return {
|
||||
isError: false,
|
||||
content: text(
|
||||
isMember
|
||||
? '你已经加过群了。点卡片进游民社区继续逛。'
|
||||
: `加群是一次性入群费(${priceLabel}),走微信虚拟支付,不是 VIP。点卡片填写邮箱并支付。`,
|
||||
),
|
||||
structuredContent,
|
||||
handoff: () => ({
|
||||
query: 'join=1',
|
||||
payload: { openJoinPay: true, email: email || '', priceFen, isMember },
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = joinSocialCommunity
|
||||
@ -0,0 +1,43 @@
|
||||
const { MEETUPS } = require('./_seed')
|
||||
|
||||
function text(t) {
|
||||
return [{ type: 'text', text: t }]
|
||||
}
|
||||
|
||||
async function listMeetupRooms({ keyword } = {}) {
|
||||
const q = String(keyword || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
const rooms = MEETUPS.filter(
|
||||
(m) =>
|
||||
!q ||
|
||||
m.title.toLowerCase().includes(q) ||
|
||||
m.id.toLowerCase().includes(q) ||
|
||||
m.mirotalkRoom.toLowerCase().includes(q),
|
||||
).map((m) => ({
|
||||
id: m.id,
|
||||
title: m.title,
|
||||
when: `${m.date} ${m.time}`,
|
||||
room: m.mirotalkRoom,
|
||||
}))
|
||||
|
||||
return {
|
||||
isError: false,
|
||||
content: text(
|
||||
rooms.length
|
||||
? `找到 ${rooms.length} 个语音视频场次。微信内用原生 live-pusher(RTC),点卡片进场。`
|
||||
: '暂时没有匹配场次,可以打开场次列表再挑。',
|
||||
),
|
||||
structuredContent: {
|
||||
rooms,
|
||||
pagePath: '/pages/social/meetup/index',
|
||||
linkText: '查看全部场次',
|
||||
},
|
||||
handoff: () => ({
|
||||
query: keyword ? `q=${encodeURIComponent(keyword)}` : '',
|
||||
payload: { rooms },
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = listMeetupRooms
|
||||
@ -0,0 +1,43 @@
|
||||
const { GIGS } = require('./_seed')
|
||||
|
||||
function text(t) {
|
||||
return [{ type: 'text', text: t }]
|
||||
}
|
||||
|
||||
async function listTeamGigs({ kind = 'all', keyword } = {}) {
|
||||
const k = String(kind || 'all')
|
||||
const q = String(keyword || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
const gigs = GIGS.filter((g) => {
|
||||
if (k !== 'all' && g.kind !== k) return false
|
||||
if (!q) return true
|
||||
const hay = `${g.title} ${g.role} ${(g.tags || []).join(' ')}`.toLowerCase()
|
||||
return hay.includes(q)
|
||||
})
|
||||
|
||||
return {
|
||||
isError: false,
|
||||
content: text(
|
||||
gigs.length
|
||||
? `找到 ${gigs.length} 个机会。选一个后用 applyTeamGig,或点卡片打开申请页填表。`
|
||||
: '暂时没有匹配机会,换个关键词或打开找搭子页看看。',
|
||||
),
|
||||
structuredContent: {
|
||||
gigs,
|
||||
pagePath: '/pages/social/team/index',
|
||||
linkText: '打开找搭子',
|
||||
},
|
||||
handoff: () => ({
|
||||
query: [
|
||||
k !== 'all' ? `kind=${encodeURIComponent(k)}` : '',
|
||||
q ? `q=${encodeURIComponent(keyword)}` : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('&'),
|
||||
payload: { gigs, kind: k, keyword: keyword || '' },
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = listTeamGigs
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user