diff --git a/api/smoke.js b/api/smoke.js index e14dd89..5b4ebf7 100644 --- a/api/smoke.js +++ b/api/smoke.js @@ -51,3 +51,15 @@ export function unlockAiAdvice(data) { export function getStats(params = {}) { return request.get('/smoke/stats', params) } + +export function createShare(data = {}) { + return request.post('/smoke/share', data) +} + +export function getShareData(shareToken, params = {}) { + return request.get(`/smoke/share/${shareToken}`, params) +} + +export function revokeShare(shareToken) { + return request.post(`/smoke/share/${shareToken}/revoke`) +} diff --git a/pages.json b/pages.json index 1f9176e..e3d3b51 100644 --- a/pages.json +++ b/pages.json @@ -30,6 +30,12 @@ "navigationBarTitleText": "历史记录" } }, + { + "path": "pages/share/index", + "style": { + "navigationBarTitleText": "戒烟分享" + } + }, { "path": "pages/profile/index", "style": { diff --git a/pages/profile/index.vue b/pages/profile/index.vue index 1a3dca7..6967916 100644 --- a/pages/profile/index.vue +++ b/pages/profile/index.vue @@ -7,6 +7,26 @@ + + 🔗 + + 分享戒烟记录 + {{ shareDesc }} + + + + + + 🔄 + + 刷新分享链接 + 生成新的有效分享令牌 + + + + 📝 @@ -46,16 +66,68 @@ @@ -189,6 +269,26 @@ onMounted(async () => { color: #9CA3AF; } +.share-btn { + margin: 0; + padding: 10rpx 20rpx; + line-height: 1.4; + font-size: 24rpx; + border: none; + border-radius: 999rpx; + color: #ffffff; + background: #10b981; +} + +.share-btn[disabled] { + background: #9ca3af; + color: #ffffff; +} + +.share-btn::after { + border: none; +} + .logout-btn { text-align: center; padding: 28rpx; diff --git a/pages/share/index.vue b/pages/share/index.vue new file mode 100644 index 0000000..176cff8 --- /dev/null +++ b/pages/share/index.vue @@ -0,0 +1,575 @@ + + + + +