孕妈广场:「我的投稿」从右上角移到「全部」瀑布流第一张入口卡,新增独立页 guangchang/mine/(统计、筛选、审核状态、奖励、重投);首页审核提醒 ?mine=1 转到该页;v26110222

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-02 12:10:08 +00:00
parent a5128c4a19
commit 770d7068ec
6 changed files with 260 additions and 60 deletions

View File

@@ -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>