feat: 小程序统一走 Go 后台,咨询与登录切到 /api/v1

去掉协会 WebView 和魔方账密页,微信登录与咨询接口共用同一 token 和拦截器。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-09-15 00:26:28 +08:00
co-authored by Cursor
parent 6e97f01378
commit b09d82df8d
40 changed files with 3852 additions and 285 deletions
+111
View File
@@ -0,0 +1,111 @@
<template>
<view class="yxg-nav" :style="barStyle">
<view class="yxg-nav-row" :style="rowStyle">
<view v-if="showBack" class="yxg-nav-back" @click="onBack">
<text class="yxg-nav-back-ico"></text>
</view>
<image
v-if="logo"
class="yxg-nav-logo"
:src="logoSrc"
mode="aspectFit"
:style="logoStyle"
/>
<text v-else class="yxg-nav-title">{{ title }}</text>
</view>
</view>
<view v-if="placeholder" :style="barStyle" />
</template>
<script setup>
import { YXG_MP_LOGO_URL } from '@/util/yxgConfig.js'
import { yxgBack } from '@/util/yxgNav.js'
const props = defineProps({
title: { type: String, default: '' },
logo: { type: Boolean, default: false },
showBack: { type: Boolean, default: true },
placeholder: { type: Boolean, default: true },
})
function readWindow() {
// #ifdef MP-WEIXIN
if (typeof wx !== 'undefined' && wx.getWindowInfo) return wx.getWindowInfo()
// #endif
return uni.getSystemInfoSync()
}
const win = readWindow()
const statusBarH = win.statusBarHeight || 0
const screenW = win.windowWidth || win.screenWidth || 375
let navBarH = 44
let menuH = 32
try {
const menu = uni.getMenuButtonBoundingClientRect()
if (menu?.height) {
navBarH = (menu.top - statusBarH) * 2 + menu.height
menuH = menu.height
}
} catch (e) {
/* keep default */
}
const headH = statusBarH + navBarH
const logoH = Math.min(menuH, 30)
const logoW = Math.min(Math.round((logoH * 598) / 130), Math.floor(screenW * 0.4))
const barStyle = `height:${headH}px;padding-top:${statusBarH}px;box-sizing:border-box;`
const rowStyle = `height:${navBarH}px;`
const logoStyle = `width:${logoW}px;height:${logoH}px;`
const logoSrc = YXG_MP_LOGO_URL
function onBack() {
yxgBack()
}
</script>
<style scoped>
.yxg-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
background: #ffd1c7;
}
.yxg-nav-row {
display: flex;
align-items: center;
justify-content: center;
position: relative;
width: 100%;
}
.yxg-nav-back {
position: absolute;
left: 8px;
top: 0;
bottom: 0;
width: 44px;
display: flex;
align-items: center;
justify-content: center;
}
.yxg-nav-back-ico {
font-size: 28px;
line-height: 1;
color: #614d49;
font-weight: 300;
}
.yxg-nav-title {
font-size: 16px;
font-weight: 700;
color: #333;
max-width: 56%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.yxg-nav-logo {
display: block;
}
</style>
+28
View File
@@ -0,0 +1,28 @@
<template>
<view class="yxg-wrap">
<yxg-nav :title="title" :show-back="showBack" />
<view class="yxg-body">
<slot />
</view>
</view>
</template>
<script setup>
import YxgNav from './yxg-nav.vue'
defineProps({
title: { type: String, default: '' },
showBack: { type: Boolean, default: true },
})
</script>
<style scoped>
.yxg-wrap {
min-height: 100vh;
background: linear-gradient(180deg, #ffd1c7 0%, #ffe4d8 28%, #fff4ef 52%, #fff9f7 100%);
padding-bottom: 32px;
}
.yxg-body {
padding-bottom: 24px;
}
</style>
+70
View File
@@ -0,0 +1,70 @@
<template>
<view class="hti" :class="'hti-' + name" :style="boxStyle">
<text class="hti-txt">{{ mark }}</text>
</view>
</template>
<script setup>
const props = defineProps({
name: { type: String, default: 'mbti' },
size: { type: Number, default: 48 },
})
const MARK = {
mbti: 'I/E',
star: '★',
portrait: '解',
rhythm: '律',
synastry: '合',
astro: '盘',
companion: '节',
ask: '问',
cards: '卡',
reports: '报',
growth: '长',
relation: '配',
nine: '9',
eq: '情',
stress: '压',
sleep: '眠',
}
const mark = computed(() => MARK[props.name] || '·')
const boxStyle = computed(() => {
const px = Math.round(props.size * 1.15)
return `width:${px}px;height:${px}px;`
})
</script>
<style scoped>
.hti {
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}
.hti-txt {
color: #fff;
font-weight: 800;
font-size: 15px;
letter-spacing: 0.5px;
}
.hti-mbti { background: linear-gradient(145deg, #ffe9a0, #f0b020); }
.hti-star { background: linear-gradient(145deg, #b8deff, #2f7fe0); }
.hti-portrait { background: linear-gradient(145deg, #ffe8b0, #d4922a); }
.hti-rhythm { background: linear-gradient(145deg, #c8f5d4, #2fa866); }
.hti-synastry { background: linear-gradient(145deg, #ffd0e0, #e84880); }
.hti-astro { background: linear-gradient(145deg, #e4d4ff, #7c5ce0); }
.hti-companion { background: linear-gradient(145deg, #ffe9a0, #f0b020); }
.hti-ask { background: linear-gradient(145deg, #ffe0b8, #e87830); }
.hti-cards { background: linear-gradient(145deg, #c8f5f0, #2a9d8f); }
.hti-reports { background: linear-gradient(145deg, #e8f4ff, #2f7fe0); }
.hti-growth { background: linear-gradient(145deg, #ffe0b8, #e87830); }
.hti-relation { background: linear-gradient(145deg, #ffd0e0, #e84880); }
.hti-nine { background: linear-gradient(145deg, #e4d4ff, #7c5ce0); }
.hti-eq { background: linear-gradient(145deg, #c8f5f0, #2a9d8f); }
.hti-stress { background: linear-gradient(145deg, #ffc8b8, #e54d42); }
.hti-sleep { background: linear-gradient(145deg, #b8deff, #2f7fe0); }
</style>