孕妈广场:「我的投稿」从右上角移到「全部」瀑布流第一张入口卡,新增独立页 guangchang/mine/(统计、筛选、审核状态、奖励、重投);首页审核提醒 ?mine=1 转到该页;v26110222
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -187,5 +187,5 @@
|
||||
}
|
||||
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
|
||||
if (window.GC_FEED) init();
|
||||
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110221'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
||||
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110222'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
||||
})();
|
||||
|
||||
@@ -323,7 +323,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
</div>
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script src="tests.js?v=26110221"></script>
|
||||
<script src="tests.js?v=26110222"></script>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
@@ -287,6 +287,19 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
.wf .col{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
|
||||
.nc{display:block;width:100%;text-align:left;border-radius:14px;overflow:hidden;background:#fff;box-shadow:0 3px 12px rgba(170,110,90,.08);animation:ncIn .35s ease both}
|
||||
.nc:active{transform:scale(.985)}
|
||||
/* 我的投稿入口卡(11-02 从右上角挪到「全部」瀑布流第一位,点进 mine/ 独立页) */
|
||||
.nc.myc{position:relative;padding:14px 12px 12px;color:#fff;background:linear-gradient(150deg,#FF8A65,#F0607E 70%,#D8609E);box-shadow:0 10px 20px -14px #E8506E}
|
||||
.nc.myc::after{content:"";position:absolute;right:-26px;top:-30px;width:96px;height:96px;border-radius:50%;background:rgba(255,255,255,.15)}
|
||||
.myc .mi{position:relative;width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:rgba(255,255,255,.22)}
|
||||
.myc .mi .ic{width:20px;height:20px}
|
||||
.myc b{position:relative;display:block;margin-top:10px;font-size:16px;font-weight:900}
|
||||
.myc p{position:relative;margin:2px 0 0;font-size:11.5px;line-height:1.5;opacity:.92}
|
||||
.myc p em{font-style:normal;font-weight:900;color:#FFF1B8}
|
||||
.myc .ms{position:relative;display:flex;gap:4px;flex-wrap:wrap;margin-top:9px}
|
||||
.myc .ms span{height:20px;padding:0 7px;border-radius:6px;background:rgba(255,255,255,.95);color:#C0504E;font-size:11px;font-weight:800;line-height:20px}
|
||||
.myc .go{position:relative;display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-top:9px;border-top:1px dashed rgba(255,255,255,.4);font-size:12px;font-weight:800}
|
||||
.myc .go .ic{width:14px;height:14px}
|
||||
.myc .dot{position:absolute;right:10px;top:10px;z-index:1;height:18px;padding:0 6px;border-radius:99px;background:#fff;color:#E8473A;font-size:10.5px;font-style:normal;font-weight:900;line-height:18px}
|
||||
@keyframes ncIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
||||
.nc .cvw{position:relative}
|
||||
.nc .nb{padding:8px 9px 9px}
|
||||
@@ -444,8 +457,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
.bar:not(.typing) .send{display:none}
|
||||
|
||||
/* ---------- 投稿(11-01:用户可投稿 → 审核中 → 后台通过/不通过 → 下次打开提醒) ---------- */
|
||||
.nav .mine{position:relative;flex:none;height:30px;padding:0 10px;border-radius:99px;background:#fff;border:1px solid #F0E2DA;font-size:12.5px;font-weight:800;color:#6E5A55}
|
||||
.nav .mine i{position:absolute;right:-2px;top:-3px;min-width:16px;height:16px;padding:0 4px;border-radius:99px;background:#F0453A;color:#fff;font-size:10px;font-style:normal;font-weight:800;line-height:16px;text-align:center;box-shadow:0 0 0 2px #F8F3EF}
|
||||
.nav .nsp{flex:none;width:36px}
|
||||
#cp{position:fixed;inset:0;z-index:50;background:#FFFBF8;display:flex;flex-direction:column;transform:translateY(100%);transition:transform .3s cubic-bezier(.2,.8,.2,1)}
|
||||
#cp.show{transform:none}
|
||||
#cp .cph{flex:none;display:flex;align-items:center;gap:8px;height:calc(50px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 12px 0 6px;border-bottom:1px solid var(--line);background:#fff}
|
||||
@@ -475,21 +487,6 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
.cp-pics .add{display:grid;place-items:center;border:1.5px dashed #E2CFC7;background:#FFF8F4;color:#B8A49E;font-size:12px}
|
||||
.cp-pics .add .ic{display:block;margin:0 auto 4px;width:22px;height:22px}
|
||||
.cp-tip{margin-top:16px;font-size:12px;line-height:1.7;color:#B8A49E}
|
||||
/* 我的投稿 */
|
||||
.my-e{padding:26px 0 10px;text-align:center;color:var(--muted);font-size:13.5px}
|
||||
.my-it{padding:12px 0;border-bottom:1px solid #F3E9E4}
|
||||
.my-it:last-child{border-bottom:0}
|
||||
.my-h{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
|
||||
.my-h .tn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.st{flex:none;height:20px;padding:0 7px;border-radius:6px;font-size:11.5px;font-weight:800;line-height:20px}
|
||||
.st.pending{background:#FFF1DE;color:#C27612}
|
||||
.st.approved{background:#DDF2EE;color:#21705F}
|
||||
.st.rejected{background:#F2ECEA;color:#8A7570}
|
||||
.my-it b{display:block;margin-top:5px;font-size:15px;font-weight:800;color:#2A1E1E}
|
||||
.my-it p{margin:4px 0 0;font-size:12.5px;line-height:1.6;color:#7A6663}
|
||||
.my-it p.why{padding:7px 10px;border-radius:10px;background:#F6F0EE}
|
||||
.my-it p.rw2{padding:7px 10px;border-radius:10px;background:#FFF1EB;color:#9A5A44}
|
||||
.my-it p.rw2 em{font-style:normal;font-weight:900;color:#E8473A}
|
||||
/* 审核结果 / 提交成功弹窗 */
|
||||
#rs{position:fixed;inset:0;z-index:70;display:grid;place-items:center;padding:24px;background:rgba(30,20,18,.5);opacity:0;pointer-events:none;transition:opacity .2s}
|
||||
#rs.show{opacity:1;pointer-events:auto}
|
||||
@@ -545,7 +542,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
<div class="nav">
|
||||
<button class="bk" id="back" type="button" aria-label="返回"><svg class="ic"><use href="#i-back"/></svg></button>
|
||||
<h1><span>孕妈广场</span></h1>
|
||||
<button class="mine" id="mineBtn" type="button">我的投稿<i id="mineDot" class="hide"></i></button>
|
||||
<i class="nsp"></i>
|
||||
</div>
|
||||
<div class="cats" id="cats" role="tablist" aria-label="分类"></div>
|
||||
</div>
|
||||
@@ -590,10 +587,10 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
<div id="sheet" role="dialog" aria-modal="true"><i class="sg"></i><div class="sbd" id="sbd"></div></div>
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script src="topics.js?v=26110221"></script>
|
||||
<script src="data.js?v=26110221"></script>
|
||||
<script src="feed.js?v=26110221"></script>
|
||||
<script src="ceshi/meta.js?v=26110221"></script>
|
||||
<script src="topics.js?v=26110222"></script>
|
||||
<script src="data.js?v=26110222"></script>
|
||||
<script src="feed.js?v=26110222"></script>
|
||||
<script src="ceshi/meta.js?v=26110222"></script>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
@@ -786,7 +783,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
var CS_MIX = ['t11', 't29', 't01', 't24', 't26', 't16', 't03', 't27', 't14', 't21', 't30', 't18'], CS_AT = [3, 10, 18, 27, 37, 48, 60, 73, 87, 102, 118, 135];
|
||||
function csDone() { try { return (JSON.parse(localStorage.getItem('mmbox.gcts.v1') || '{}')[param('openid') || '_guest']) || {}; } catch (e) { return {}; } }
|
||||
function ceshiURL(id, fromTab) {
|
||||
var q = new URLSearchParams(location.search); ['t', 'n', 'c', 'id', 'mine'].forEach(function (k) { q.delete(k); });
|
||||
var q = new URLSearchParams(location.search); ['t', 'n', 'c', 'id', 'mine', 'write'].forEach(function (k) { q.delete(k); });
|
||||
if (fromTab) q.set('c', 'ceshi');
|
||||
q.set('id', id);
|
||||
return 'ceshi/?' + q.toString() + location.hash;
|
||||
@@ -920,10 +917,15 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
if (!cur && !catF && TM.length) {
|
||||
var dn = csDone(), mixed = [], ci = 0;
|
||||
list.forEach(function (n, k) { while (ci < CS_AT.length && CS_AT[ci] === mixed.length) { if (TMBY[CS_MIX[ci]]) mixed.push({ test: TMBY[CS_MIX[ci]] }); ci++; } mixed.push(n); });
|
||||
list = mixed;
|
||||
list = [{ mine: 1 }].concat(mixed);
|
||||
}
|
||||
var nk = 0;
|
||||
list.forEach(function (n, k) {
|
||||
if (n.mine) {
|
||||
tmp.innerHTML = myCardHTML(); var me = tmp.firstChild;
|
||||
cols[0].appendChild(me); hs[0] += me.offsetHeight + 8;
|
||||
return;
|
||||
}
|
||||
if (n.test) {
|
||||
tmp.innerHTML = testCardHTML(n.test, dn);
|
||||
var te = tmp.firstChild; te.style.animationDelay = Math.min(k, 10) * 30 + 'ms';
|
||||
@@ -949,7 +951,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
if (t) q.set('t', t); else q.delete('t');
|
||||
if (!t && catF) q.set('c', catF); else q.delete('c'); /* 只选了分类没选话题时记在 ?c=,刷新 / 详情返回还在原分类 */
|
||||
if (n) q.set('n', n); else q.delete('n');
|
||||
q.delete('mine');
|
||||
q.delete('mine'); q.delete('write');
|
||||
var s = q.toString();
|
||||
return location.pathname + (s ? '?' + s : '') + location.hash; /* hash(身份)原样保留 */
|
||||
}
|
||||
@@ -1110,6 +1112,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
if (ts) { e.stopPropagation(); haptic(); location.href = ceshiURL(ts.dataset.test, true); }
|
||||
}, true);
|
||||
$('#wf').addEventListener('click', function (e) {
|
||||
if (e.target.closest('[data-mine]')) { haptic(); location.href = mineURL(); return; }
|
||||
var ts = e.target.closest('[data-test]');
|
||||
if (ts) { haptic(); location.href = ceshiURL(ts.dataset.test, catF === 'ceshi'); return; }
|
||||
var lk = e.target.closest('[data-like]');
|
||||
@@ -1264,7 +1267,6 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
var API = '/api/mp/public/mama-box/plaza', UNION = param('unionid');
|
||||
var idq = function () { return 'openid=' + encodeURIComponent(OPENID) + (UNION ? '&unionid=' + encodeURIComponent(UNION) : ''); };
|
||||
var getJ = function (u, opt) { return fetch(u, opt).then(function (r) { return r.json(); }); };
|
||||
var ST_NAME = { pending: '审核中', approved: '已通过', rejected: '未通过' };
|
||||
var MINE = [];
|
||||
|
||||
/* 已通过的稿件 → 混进笔记流(话题流和「全部」都排最前) */
|
||||
@@ -1287,34 +1289,29 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
/* 我的投稿 */
|
||||
/* 我的投稿:入口卡在「全部」瀑布流第一位,详情是独立页 mine/ */
|
||||
var UNREAD = 0;
|
||||
var mineURL = function () { return 'mine/' + location.hash; };
|
||||
function myCardHTML() {
|
||||
var n = { pending: 0, approved: 0 };
|
||||
MINE.forEach(function (p) { if (n[p.status] != null) n[p.status]++; });
|
||||
return '<button type="button" class="nc myc" id="myc" data-mine="1">' + (UNREAD ? '<i class="dot">' + UNREAD + ' 条新结果</i>' : '') +
|
||||
'<span class="mi"><svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg></span>' +
|
||||
'<b>我的投稿</b>' + (MINE.length ? '<p>已投 ' + MINE.length + ' 篇,看看审核进度</p><div class="ms">' + (n.pending ? '<span>审核中 ' + n.pending + '</span>' : '') + (n.approved ? '<span>已通过 ' + n.approved + '</span>' : '') + '</div>'
|
||||
: '<p>写下你的故事,被选中得 <em>¥30</em> + <em>500</em> 兜豆</p>') +
|
||||
'<span class="go">' + (MINE.length ? '查看全部' : '去看看') + '<svg class="ic"><use href="#i-right"/></svg></span></button>';
|
||||
}
|
||||
function syncMyCard() { var c = $('#myc'); if (c) { c.outerHTML = myCardHTML(); } }
|
||||
function loadMine(cb) {
|
||||
if (!OPENID) return;
|
||||
getJ(API + '/mine?' + idq()).then(function (j) {
|
||||
var r = j && j.result; if (!r) return;
|
||||
MINE = r.list || [];
|
||||
var un = r.unread || [];
|
||||
var d = $('#mineDot'); d.textContent = un.length || ''; d.classList.toggle('hide', !un.length);
|
||||
UNREAD = un.length; syncMyCard();
|
||||
if (cb) cb(); else if (un.length) showResults(un);
|
||||
}).catch(function () {});
|
||||
}
|
||||
function fmtDay(ms) { var d = new Date(ms); return (d.getMonth() + 1) + '月' + d.getDate() + '日'; }
|
||||
function openMine() {
|
||||
var h = '<h3>我的投稿</h3>';
|
||||
if (!OPENID) h += '<div class="my-e">请从小程序里打开孕妈广场,才能查看你的投稿</div>';
|
||||
else if (!MINE.length) h += '<div class="my-e">还没有投稿,写下你的第一个故事吧</div>';
|
||||
else h += MINE.map(function (p) {
|
||||
var t = TBY[p.topic];
|
||||
return '<div class="my-it"><div class="my-h"><span class="tn">#' + esc(t ? t.name : p.topicName || '') + '#</span><span>' + fmtDay(p.at) + '</span><span class="st ' + p.status + '">' + (ST_NAME[p.status] || '') + '</span></div>' +
|
||||
'<b>' + esc(p.title) + '</b>' +
|
||||
(p.status === 'pending' ? '<p>正在审核中,有结果会第一时间提醒你</p>' : '') +
|
||||
(p.status === 'rejected' ? '<p class="why">没通过的原因:' + esc(p.reason || '暂不符合展示要求') + '</p>' : '') +
|
||||
(p.status === 'approved' ? '<p class="rw2">已被选中,奖励 <em>¥30</em> 现金 + <em>500</em> 兜豆 · ' + (p.reward === 'paid' ? '已发放' : '待发放') + '</p>' : '') + '</div>';
|
||||
}).join('');
|
||||
h += '<button type="button" class="sbtn" data-mywrite="1" style="margin-top:16px">写新的故事</button>';
|
||||
openSheet('mine', h);
|
||||
}
|
||||
$('#mineBtn').addEventListener('click', function () { haptic(); loadMine(openMine); openMine(); });
|
||||
|
||||
/* 审核结果弹窗:逐条弹,全部看完一次性 seen */
|
||||
function showResults(list) {
|
||||
@@ -1323,7 +1320,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
var p = q.shift();
|
||||
if (!p) {
|
||||
fetch(API + '/mine/seen?' + idq(), { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ids: ids }) }).catch(function () {});
|
||||
$('#mineDot').classList.add('hide');
|
||||
UNREAD = 0; syncMyCard();
|
||||
return;
|
||||
}
|
||||
var ok = p.status === 'approved';
|
||||
@@ -1473,18 +1470,15 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
||||
}, { passive: false });
|
||||
|
||||
/* ---------- 启动 ---------- */
|
||||
var deep = new URLSearchParams(location.search).get('n'); /* 先读:selectTopic 会 replaceState 把 n 去掉 */
|
||||
var deep = new URLSearchParams(location.search).get('n'), q0 = new URLSearchParams(location.search); /* 先读:selectTopic 会 replaceState 把 n 去掉 */
|
||||
var c0 = new URLSearchParams(location.search).get('c');
|
||||
if (CAT_ORDER.indexOf(c0) >= 0 || c0 === 'ceshi') catF = c0;
|
||||
selectTopic(param('t') && TBY[param('t')] ? param('t') : '', false);
|
||||
if (deep && NBY[deep]) openNote(deep, false);
|
||||
loadApproved();
|
||||
if (new URLSearchParams(location.search).get('mine') === '1') {
|
||||
loadMine(function () {
|
||||
var un = MINE.filter(function (p) { return !p.seen && p.status !== 'pending'; });
|
||||
if (un.length) showResults(un); else openMine();
|
||||
});
|
||||
} else loadMine();
|
||||
if (q0.get('mine') === '1') location.href = mineURL(); /* 首页审核提醒 ?mine=1 → 我的投稿页(selectTopic 已把 mine 从地址里去掉,返回不会再跳) */
|
||||
else if (q0.get('write') === '1') { loadMine(function () {}); openCompose(q0.get('t') || ''); } /* 我的投稿页「写新的故事 / 修改后重投」:结果在那页已看过,不再弹 */
|
||||
else loadMine(); /* 我的投稿页「写新的故事 / 修改后重投」 */
|
||||
var rt; window.addEventListener('resize', function () { clearTimeout(rt); rt = setTimeout(renderFeed, 150); });
|
||||
})();
|
||||
</script>
|
||||
|
||||
206
guangchang/mine/index.html
Normal file
206
guangchang/mine/index.html
Normal file
@@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>我的投稿</title>
|
||||
<!-- 孕妈广场 · 我的投稿(2026-11-02 独立成页)
|
||||
用户原话:「我的投稿不要放在右上角……可以放到大家在聊的瀑布流上,给它一个单独页面」
|
||||
· 入口:广场「全部」瀑布流第一张卡(data-mine);首页审核提醒 guangchang/?mine=1 也转到这里。
|
||||
· 数据:GET /api/mp/public/mama-box/plaza/mine → {list, unread};打开本页即把 unread 标为已提醒(POST mine/seen),条目上挂「新」。
|
||||
· 写新故事 / 修改后重投 → ../?write=1(广场页打开写稿层);已通过的稿件 → ../?n=u-<id> 打开广场详情。hash(身份)原样带上。
|
||||
· 禁止下拉回弹:固定外壳 + 容器滚动 + touchmove 拦截(同广场页)。 -->
|
||||
<style>
|
||||
:root{--ink:#2B2320;--muted:#9A8380;--bg:#F8F3EF;--btn:linear-gradient(135deg,#F77B55,#EE5A3E)}
|
||||
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
|
||||
html,body{margin:0;padding:0;height:100%;overflow:hidden;overscroll-behavior:none}
|
||||
body{background:var(--bg);font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Segoe UI",Roboto,sans-serif;
|
||||
color:var(--ink);-webkit-font-smoothing:antialiased;font-size:14px;line-height:1.5;-webkit-text-size-adjust:100%}
|
||||
button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:pointer}
|
||||
.ic{width:16px;height:16px;flex:none;display:inline-block;vertical-align:middle;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
|
||||
#sc{position:fixed;inset:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(96px + env(safe-area-inset-bottom));
|
||||
background:radial-gradient(260px 200px at 100% 0,rgba(255,196,214,.5),rgba(255,196,214,0) 70%),radial-gradient(240px 200px at 0 60px,rgba(255,206,170,.45),rgba(255,206,170,0) 70%),var(--bg)}
|
||||
#sc::-webkit-scrollbar{display:none}
|
||||
.nav{position:sticky;top:0;z-index:10;display:flex;align-items:center;height:46px;padding:env(safe-area-inset-top) 10px 0;background:rgba(248,243,239,.88);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
|
||||
.nav .bk{width:36px;height:36px;display:grid;place-items:center;border-radius:50%}
|
||||
.nav .bk .ic{width:22px;height:22px}
|
||||
.nav h1{flex:1;margin:0;text-align:center;font-size:17px;font-weight:900;letter-spacing:.5px}
|
||||
.nav h1 span{background:linear-gradient(transparent 60%,#FFD0DC 60%,#FFD0DC 92%,transparent 92%);padding:0 3px}
|
||||
.nav i{width:36px}
|
||||
main{padding:6px 16px 0}
|
||||
|
||||
/* 头卡:投稿统计 + 奖励说明 */
|
||||
.hero{position:relative;padding:18px 18px 16px;border-radius:24px;overflow:hidden;color:#fff;background:linear-gradient(135deg,#FF8A65,#F0607E 70%,#D8609E);box-shadow:0 14px 28px -18px #E8506E}
|
||||
.hero::after{content:"";position:absolute;right:-40px;top:-50px;width:170px;height:170px;border-radius:50%;background:rgba(255,255,255,.14)}
|
||||
.hero small{position:relative;font-size:12px;opacity:.9}
|
||||
.hero b{position:relative;display:block;margin-top:2px;font-size:21px;font-weight:900;line-height:1.35}
|
||||
.hero .rw{position:relative;display:inline-flex;align-items:center;gap:5px;margin-top:8px;height:26px;padding:0 10px;border-radius:99px;background:rgba(255,255,255,.2);font-size:12px;font-weight:700}
|
||||
.hero .rw em{font-style:normal;font-weight:900;color:#FFF1B8}
|
||||
.stat{position:relative;display:grid;grid-template-columns:repeat(3,1fr);margin-top:14px;padding:10px 0;border-radius:16px;background:rgba(255,255,255,.95);color:var(--ink)}
|
||||
.stat div{text-align:center}
|
||||
.stat div+div{border-left:1px solid #F3E6E1}
|
||||
.stat strong{display:block;font-size:20px;font-weight:900;line-height:1.2;font-family:Georgia,serif}
|
||||
.stat span{font-size:11.5px;color:var(--muted)}
|
||||
.stat .p strong{color:#D98A1E}.stat .a strong{color:#21A08A}.stat .r strong{color:#A08B85}
|
||||
|
||||
/* 筛选 */
|
||||
.fl{display:flex;gap:8px;margin:18px 0 4px;overflow-x:auto;scrollbar-width:none}
|
||||
.fl::-webkit-scrollbar{display:none}
|
||||
.fl button{flex:none;height:32px;padding:0 14px;border-radius:99px;background:#fff;border:1px solid #F0E2DA;font-size:13px;font-weight:800;color:#7A6663}
|
||||
.fl button.on{background:#2B2320;border-color:#2B2320;color:#fff}
|
||||
.fl button i{font-style:normal;margin-left:3px;opacity:.6}
|
||||
|
||||
/* 稿件卡 */
|
||||
.it{position:relative;margin-top:12px;padding:14px 14px 13px;border-radius:20px;background:#fff;box-shadow:0 4px 14px rgba(170,110,90,.08);animation:in .3s ease both}
|
||||
@keyframes in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
||||
.it::before{content:"";position:absolute;left:0;top:18px;bottom:18px;width:4px;border-radius:0 4px 4px 0;background:var(--sc)}
|
||||
.it.pending{--sc:#F2A93B;--sl:#FFF4E2;--st:#B8700E}
|
||||
.it.approved{--sc:#2BB39A;--sl:#E0F5F0;--st:#1D7A69}
|
||||
.it.rejected{--sc:#C9B6B0;--sl:#F4EEEC;--st:#8A7570}
|
||||
.ih{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
|
||||
.ih .st{flex:none;display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 8px;border-radius:7px;background:var(--sl);color:var(--st);font-size:11.5px;font-weight:800}
|
||||
.ih .st .ic{width:12px;height:12px;stroke-width:2.6}
|
||||
.ih .tn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.ih .nw{flex:none;height:18px;padding:0 6px;border-radius:99px;background:#F0453A;color:#fff;font-size:10.5px;font-style:normal;font-weight:800;line-height:18px}
|
||||
.it h3{margin:9px 0 0;font-size:16px;font-weight:900;line-height:1.45}
|
||||
.it .bd{margin:4px 0 0;font-size:13px;line-height:1.65;color:#7A6663;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
||||
.pics{display:flex;gap:6px;margin-top:10px}
|
||||
.pics img{width:72px;height:72px;border-radius:10px;object-fit:cover;background:#F3EAE5}
|
||||
.pics span{width:72px;height:72px;border-radius:10px;display:grid;place-items:center;background:#F6F0EE;color:var(--muted);font-size:13px;font-weight:800}
|
||||
.nt{margin-top:11px;padding:9px 11px;border-radius:12px;background:var(--sl);font-size:12.5px;line-height:1.6;color:var(--st)}
|
||||
.nt em{font-style:normal;font-weight:900;color:#E8473A}
|
||||
.ia{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}
|
||||
.ia button{height:30px;padding:0 13px;border-radius:99px;border:1px solid #EBDDD7;font-size:12.5px;font-weight:800;color:#6E5A55}
|
||||
.ia button.pr{border-color:transparent;background:var(--sc);color:#fff}
|
||||
|
||||
/* 空 / 未登录 */
|
||||
.em{margin-top:16px;padding:30px 20px 26px;border-radius:22px;background:#fff;text-align:center}
|
||||
.em svg{width:86px;height:86px}
|
||||
.em b{display:block;margin-top:8px;font-size:16px;font-weight:900}
|
||||
.em p{margin:4px 0 0;font-size:13px;color:var(--muted);line-height:1.6}
|
||||
.sk{height:120px;margin-top:12px;border-radius:20px;background:linear-gradient(90deg,#F4ECE8 0,#FBF6F3 40%,#F4ECE8 80%);background-size:200% 100%;animation:sk 1.2s linear infinite}
|
||||
@keyframes sk{to{background-position:-200% 0}}
|
||||
|
||||
/* 底部写稿 */
|
||||
.wb{position:fixed;left:0;right:0;bottom:0;z-index:10;padding:12px 16px calc(12px + env(safe-area-inset-bottom));background:linear-gradient(rgba(248,243,239,0),rgba(248,243,239,.95) 35%)}
|
||||
.wb button{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:48px;border-radius:99px;background:var(--btn);color:#fff;font-size:16px;font-weight:900;box-shadow:0 10px 20px -10px #EE5A3E}
|
||||
.wb .ic{width:18px;height:18px;stroke-width:2.4}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sc">
|
||||
<div class="nav">
|
||||
<button class="bk" id="back" type="button" aria-label="返回"><svg class="ic" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></svg></button>
|
||||
<h1><span>我的投稿</span></h1><i></i>
|
||||
</div>
|
||||
<main>
|
||||
<div class="hero" id="hero"><small>分享你的孕育故事</small><b>写下的每一篇,都可能帮到另一个妈妈</b>
|
||||
<span class="rw">被选中可得 <em>¥30</em> 现金 + <em>500</em> 兜豆</span>
|
||||
<div class="stat"><div class="p"><strong id="nP">–</strong><span>审核中</span></div><div class="a"><strong id="nA">–</strong><span>已通过</span></div><div class="r"><strong id="nR">–</strong><span>未通过</span></div></div>
|
||||
</div>
|
||||
<div class="fl" id="fl"></div>
|
||||
<div id="list"><div class="sk"></div><div class="sk"></div></div>
|
||||
</main>
|
||||
</div>
|
||||
<div class="wb"><button type="button" id="write"><svg class="ic" viewBox="0 0 24 24"><path d="M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>写新的故事</button></div>
|
||||
|
||||
<script src="../topics.js?v=26110222"></script>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); };
|
||||
function param(name) {
|
||||
try {
|
||||
var h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || '');
|
||||
var m = h.match(new RegExp('(?:^|[&#])' + name + '=([^&#]*)'));
|
||||
return m ? decodeURIComponent(m[1]).split('?')[0] : '';
|
||||
} catch (e) { return ''; }
|
||||
}
|
||||
var OPENID = param('openid'), UNION = param('unionid');
|
||||
var API = '/api/mp/public/mama-box/plaza';
|
||||
var idq = function () { return 'openid=' + encodeURIComponent(OPENID) + (UNION ? '&unionid=' + encodeURIComponent(UNION) : ''); };
|
||||
var TBY = {}; (window.GC_TOPICS || []).forEach(function (t) { TBY[t.id] = t; });
|
||||
var ST = { pending: ['审核中', 'M12 3a9 9 0 100 18 9 9 0 000-18zM12 7.5V12l3 2'], approved: ['已通过', 'M5 12l5 5 9-10'], rejected: ['未通过', 'M7 7l10 10M17 7L7 17'] };
|
||||
var LIST = [], NEW = {}, F = '';
|
||||
var plaza = function (q) { return '../' + (q ? '?' + q : '') + location.hash; };
|
||||
var fmtDay = function (ms) { var d = new Date(ms); return (d.getMonth() + 1) + '月' + d.getDate() + '日'; };
|
||||
|
||||
function render() {
|
||||
var n = { pending: 0, approved: 0, rejected: 0 };
|
||||
LIST.forEach(function (p) { if (n[p.status] != null) n[p.status]++; });
|
||||
$('#nP').textContent = n.pending; $('#nA').textContent = n.approved; $('#nR').textContent = n.rejected;
|
||||
$('#fl').innerHTML = LIST.length ? [['', '全部', LIST.length], ['pending', '审核中', n.pending], ['approved', '已通过', n.approved], ['rejected', '未通过', n.rejected]].map(function (f) {
|
||||
return '<button type="button" data-f="' + f[0] + '"' + (F === f[0] ? ' class="on"' : '') + '>' + f[1] + '<i>' + f[2] + '</i></button>';
|
||||
}).join('') : '';
|
||||
var l = LIST.filter(function (p) { return !F || p.status === F; });
|
||||
if (!LIST.length) { $('#list').innerHTML = empty('还没有投稿', '孕期的小发现、踩过的坑、温暖的瞬间,<br>都值得写下来分享给其他妈妈'); return; }
|
||||
if (!l.length) { $('#list').innerHTML = '<div class="em"><p>这里暂时没有稿件</p></div>'; return; }
|
||||
$('#list').innerHTML = l.map(function (p, i) {
|
||||
var t = TBY[p.topic], s = ST[p.status] || ['', ''], im = p.images || [];
|
||||
return '<div class="it ' + p.status + '" style="animation-delay:' + Math.min(i, 8) * 40 + 'ms">' +
|
||||
'<div class="ih"><span class="st"><svg class="ic" viewBox="0 0 24 24"><path d="' + s[1] + '"/></svg>' + s[0] + '</span>' +
|
||||
'<span class="tn">' + ((t ? t.name : p.topicName) ? '#' + esc(t ? t.name : p.topicName) + '# · ' : '') + fmtDay(p.at) + '</span>' + (NEW[p.id] ? '<em class="nw">新结果</em>' : '') + '</div>' +
|
||||
'<h3>' + esc(p.title) + '</h3>' + (p.body ? '<p class="bd">' + esc(p.body) + '</p>' : '') +
|
||||
(im.length ? '<div class="pics">' + im.slice(0, 3).map(function (u) { return '<img src="' + esc(u) + '" alt="" loading="lazy">'; }).join('') + (im.length > 3 ? '<span>+' + (im.length - 3) + '</span>' : '') + '</div>' : '') +
|
||||
(p.status === 'pending' ? '<div class="nt">正在审核中,有结果会第一时间提醒你</div>' : '') +
|
||||
(p.status === 'rejected' ? '<div class="nt">没通过的原因:' + esc(p.reason || '暂不符合展示要求') + '</div><div class="ia"><button type="button" class="pr" data-w="' + esc(p.topic) + '">修改后重新投稿</button></div>' : '') +
|
||||
(p.status === 'approved' ? '<div class="nt">已被选中,奖励 <em>¥30</em> 现金 + <em>500</em> 兜豆 · ' + (p.reward === 'paid' ? '已发放' : '待发放') + '</div><div class="ia"><button type="button" class="pr" data-n="' + esc(p.id) + '">去广场看看</button></div>' : '') +
|
||||
'</div>';
|
||||
}).join('');
|
||||
}
|
||||
function empty(b, p) {
|
||||
return '<div class="em"><svg viewBox="0 0 86 86"><circle cx="43" cy="43" r="40" fill="#FFEDE6"/><rect x="25" y="20" width="36" height="46" rx="6" fill="#fff" stroke="#F0A08A" stroke-width="3"/>' +
|
||||
'<path d="M32 33h22M32 42h22M32 51h13" stroke="#F6C2B3" stroke-width="3" stroke-linecap="round"/><path d="M52 58l12-12 4 4-12 12-5 1z" fill="#F77B55"/></svg><b>' + b + '</b><p>' + p + '</p></div>';
|
||||
}
|
||||
|
||||
if (!OPENID) {
|
||||
$('#list').innerHTML = empty('请从小程序里打开', '从小程序进入孕妈广场后,才能查看你的投稿');
|
||||
$('#nP').textContent = $('#nA').textContent = $('#nR').textContent = '0';
|
||||
} else {
|
||||
fetch(API + '/mine?' + idq()).then(function (r) { return r.json(); }).then(function (j) {
|
||||
var r = (j && j.result) || {};
|
||||
LIST = r.list || [];
|
||||
var un = r.unread || [];
|
||||
un.forEach(function (p) { NEW[p.id] = 1; });
|
||||
render();
|
||||
if (un.length) fetch(API + '/mine/seen?' + idq(), { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ids: un.map(function (p) { return p.id; }) }) }).catch(function () {});
|
||||
}).catch(function () { $('#list').innerHTML = empty('暂时没加载出来', '网络好像不太顺畅,稍后再试试'); });
|
||||
}
|
||||
|
||||
$('#fl').addEventListener('click', function (e) { var b = e.target.closest('[data-f]'); if (b) { F = b.dataset.f; render(); } });
|
||||
$('#list').addEventListener('click', function (e) {
|
||||
var w = e.target.closest('[data-w]'); if (w) { location.href = plaza('write=1' + (w.dataset.w ? '&t=' + encodeURIComponent(w.dataset.w) : '')); return; }
|
||||
var n = e.target.closest('[data-n]'); if (n) location.href = plaza('n=u-' + encodeURIComponent(n.dataset.n));
|
||||
});
|
||||
$('#write').addEventListener('click', function () { location.href = plaza('write=1'); });
|
||||
$('#back').addEventListener('click', function () {
|
||||
var ref = document.referrer || '';
|
||||
if (history.length > 1 && ref.indexOf('/guangchang/') >= 0) history.back(); else location.href = plaza('');
|
||||
});
|
||||
|
||||
/* 禁止下拉回弹(同广场页) */
|
||||
var sx = 0, sy = 0;
|
||||
document.addEventListener('touchstart', function (e) { if (e.touches.length === 1) { sx = e.touches[0].clientX; sy = e.touches[0].clientY; } }, { passive: true });
|
||||
document.addEventListener('touchmove', function (e) {
|
||||
if (e.touches.length !== 1) { if (e.cancelable) e.preventDefault(); return; }
|
||||
var dx = e.touches[0].clientX - sx, dy = e.touches[0].clientY - sy;
|
||||
if (Math.abs(dy) <= Math.abs(dx)) return;
|
||||
var el = e.target;
|
||||
while (el && el !== document.body && el !== document.documentElement) {
|
||||
if (el.nodeType === 1) {
|
||||
var oy = getComputedStyle(el).overflowY;
|
||||
if ((oy === 'auto' || oy === 'scroll') && el.scrollHeight > el.clientHeight + 1) {
|
||||
if (dy > 0 && el.scrollTop > 0) return;
|
||||
if (dy < 0 && el.scrollTop + el.clientHeight < el.scrollHeight - 1) return;
|
||||
}
|
||||
}
|
||||
el = el.parentNode;
|
||||
}
|
||||
if (e.cancelable) e.preventDefault();
|
||||
}, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>兜爸心选 · 孕育陪伴</title>
|
||||
<!-- V:26110221 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26110222 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<link rel="stylesheet" href="mama-box.css">
|
||||
<link rel="stylesheet" href="night.css">
|
||||
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
||||
@@ -2498,7 +2498,7 @@
|
||||
<script src="/_bridge/avatar-picker.js?v=26101105"></script>
|
||||
<script src="/_bridge/hand-icons.js?v=26101202"></script>
|
||||
<script src="js/zodiac-art.js"></script>
|
||||
<script src="guangchang/topics.js?v=26110221"></script>
|
||||
<script src="guangchang/topics.js?v=26110222"></script>
|
||||
<script src="js/app.js"></script>
|
||||
<script>
|
||||
/* 11-02 首页「孕妈广场」效果稿:地址带 ?gcv=1~6 时,把 #gcHome 换成 demo/gch/vN.css + vN.js 的版式并滚到这一块。
|
||||
@@ -2506,7 +2506,7 @@
|
||||
(function () {
|
||||
var m = location.search.match(/[?&]gcv=([1-6])(?:&|$)/);
|
||||
if (!m) window.__gcDefault = 1;
|
||||
var n = m ? m[1] : '6', l = document.createElement('link'), s = document.createElement('script'), q = m ? Date.now() : 'v=26110221';
|
||||
var n = m ? m[1] : '6', l = document.createElement('link'), s = document.createElement('script'), q = m ? Date.now() : 'v=26110222';
|
||||
l.rel = 'stylesheet'; l.href = 'demo/gch/v' + n + '.css?' + q;
|
||||
s.src = 'demo/gch/v' + n + '.js?' + q;
|
||||
if (m) s.onload = function () { setTimeout(function () { var el = document.getElementById('gcHome'); if (el) el.scrollIntoView({ block: 'center' }); }, 900); };
|
||||
@@ -2514,7 +2514,7 @@
|
||||
/* 11-02 品牌露出(用户定 4 处都要):默认加载,?brand=0 可关掉对比;⚠️ 上正式前和 V6 一起并进正式代码,别依赖 demo/ */
|
||||
if (!/[?&]brand=0/.test(location.search)) {
|
||||
var bl = document.createElement('link'), bs = document.createElement('script');
|
||||
bl.rel = 'stylesheet'; bl.href = 'demo/brand/brand.css?v=26110221'; bs.src = 'demo/brand/brand.js?v=26110221';
|
||||
bl.rel = 'stylesheet'; bl.href = 'demo/brand/brand.css?v=26110222'; bs.src = 'demo/brand/brand.js?v=26110222';
|
||||
document.head.appendChild(bl); document.body.appendChild(bs);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user