9 Commits

Author SHA1 Message Date
017289c694 Merge branch 'fix-109' of https://git.nianxx.cn/zoujing/YGChatCS 2025-10-14 19:54:51 +08:00
28d26fb894 feat: 样式修改 2025-10-14 19:54:35 +08:00
duanshuwen
03f49a5b48 feat: 调整RecommendPostsList组件样式 2025-10-14 19:52:13 +08:00
duanshuwen
4b14ea4f08 feat: 调整RecommendPostsList组件样式 2025-10-14 19:44:18 +08:00
0b39a9507b feat: 组件的边距调整 2025-10-14 19:32:30 +08:00
duanshuwen
851bfe149c feat:新增原子样式 2025-10-14 18:26:46 +08:00
duanshuwen
52975fe514 feat: 新增样式文件 2025-10-13 21:07:50 +08:00
621d5d4c57 feat: 实现小程序分享 2025-10-13 20:04:05 +08:00
2abce21c49 feat: 登录逻辑的调整 2025-10-12 13:55:35 +08:00
40 changed files with 466 additions and 93 deletions

View File

@@ -16,6 +16,7 @@ onHide(() => {
<style lang="scss"> <style lang="scss">
@import "@/static/fonts/iconfont.css"; @import "@/static/fonts/iconfont.css";
@import "@/static/scss/index.scss";
/* 添加全局样式 */ /* 添加全局样式 */
page, page,

View File

@@ -1,4 +1,4 @@
import { loginAuth, bindPhone } from "@/manager/LoginManager"; import { loginAuth, bindPhone, checkPhone } from "@/manager/LoginManager";
import { clientId } from "@/constant/base"; import { clientId } from "@/constant/base";
import { useAppStore } from "@/store"; import { useAppStore } from "@/store";
@@ -10,16 +10,28 @@ export const goBack = () => uni.navigateBack({ delta: 1 });
// 登录逻辑 // 登录逻辑
export const onLogin = async (e) => { export const onLogin = async (e) => {
console.info("onLogin code: ", e.detail); console.info("onLogin code: ", e);
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
// 判断用户拒绝 // 判断用户拒绝
if (e.detail.errno === 104) { if (e !== undefined && e && e.detail && e.detail.errno === 104) {
reject(); reject();
return; return;
} }
await loginAuth(e).then(async () => { await loginAuth(e).then(async () => {
// 检查手机号是否绑定
const checkRes = await checkPhone();
if (checkRes.data) {
resolve();
return;
}
if (e === undefined) {
resolve();
return;
}
const { code } = e.detail; const { code } = e.detail;
// 绑定手机号 // 绑定手机号

View File

@@ -1,4 +1,5 @@
import App from "./App"; import App from "./App";
import share from "./utils/share";
// #ifndef VUE3 // #ifndef VUE3
import Vue from "vue"; import Vue from "vue";
@@ -21,6 +22,7 @@ export function createApp() {
pinia.use(createUnistorage()); pinia.use(createUnistorage());
app.use(pinia); app.use(pinia);
app.use(share);
return { return {
app, app,

View File

@@ -11,7 +11,10 @@ export const getWeChatAuthCode = (e) => {
// #endif // #endif
// 判断用户拒绝授权 // 判断用户拒绝授权
if (e.detail.errMsg === "getPhoneNumber:fail user deny") { if (
e !== undefined &&
e.detail.errMsg === "getPhoneNumber:fail user deny"
) {
reject(); reject();
return; return;
} }

View File

@@ -48,13 +48,9 @@ const bindPhone = async (params) => {
} }
}; };
const checkPhone = async (phone) => { const checkPhone = async () => {
try { const response = await checkUserPhone();
const response = await checkUserPhone(phone);
return response; return response;
} catch (error) {
throw err;
}
}; };
export { loginAuth, bindPhone, checkPhone }; export { loginAuth, bindPhone, checkPhone };

View File

@@ -5,15 +5,10 @@
overflow-x: hidden; // ✅ 防止横向撑开 overflow-x: hidden; // ✅ 防止横向撑开
.chat-ai { .chat-ai {
margin: 6px 12px; margin: 6px 0;
padding: 0 12px; padding: 0 20px; // 消息内容的内边距 左右20px
max-width: 100%; // ✅ 限制最大宽度
min-width: 100px; min-width: 100px;
background: rgba(255, 255, 255, 0.4); max-width: 100%; // ✅ 限制最大宽度
box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.1);
border-radius: 4px 20px 20px 20px;
border: 1px solid;
border-color: #ffffff;
overflow: hidden; // ✅ 超出内容被切掉 overflow: hidden; // ✅ 超出内容被切掉
word-wrap: break-word; // ✅ 长单词自动换行 word-wrap: break-word; // ✅ 长单词自动换行
word-break: break-all; // ✅ 强制换行 word-break: break-all; // ✅ 强制换行

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="chat-mine"> <view class="chat-mine bg-17294E">
<text>{{ text }}</text> <text>{{ text }}</text>
<slot></slot> <slot></slot>
</view> </view>

View File

@@ -1,12 +1,7 @@
.chat-mine { .chat-mine {
margin: 6px 12px; margin: 6px 20px;
padding: 8px 16px; padding: 8px 16px;
border-radius: 15px;
background-color: #00a6ff;
box-shadow: 2px 2px 10px 0px rgba(0, 0, 0, 0.1);
border-radius: 20px 4px 20px 20px;
border: 1px solid;
border-color: #ffffff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -1,7 +1,6 @@
.chat-other { .chat-other {
width: 100%; width: 100%;
margin: 6px 0; margin: 6px 0;
padding: 0 12px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 100%; // ✅ 限制最大宽度 max-width: 100%; // ✅ 限制最大宽度

View File

@@ -6,7 +6,10 @@
v-for="(item, index) in itemList" v-for="(item, index) in itemList"
:key="index" :key="index"
> >
<view class="more-tips-item-title" @click="sendReply(item)"> <view
class="more-tips-item-title font-500 font-size-12 line-height-24 text-center"
@click="sendReply(item)"
>
{{ item }} {{ item }}
</view> </view>
</view> </view>

View File

@@ -7,13 +7,13 @@
overflow-x: auto; overflow-x: auto;
white-space: nowrap; white-space: nowrap;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
padding-bottom: 12px; padding: 8px 16px;
box-sizing: border-box; box-sizing: border-box;
} }
.more-tips-item { .more-tips-item {
border-radius: 8px; border-radius: 8px;
margin: 4px; margin: 0 4px;
box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1);
background-color: $uni-bg-color; background-color: $uni-bg-color;
padding: 2px 12px; padding: 2px 12px;
@@ -24,11 +24,7 @@
position: relative; position: relative;
.more-tips-item-title { .more-tips-item-title {
font-weight: 500;
font-size: $uni-font-size-sm;
color: #00a6ff; color: #00a6ff;
line-height: 24px;
text-align: center;
white-space: nowrap; white-space: nowrap;
} }
} }

View File

@@ -106,6 +106,7 @@ const handleLogout = () => {
if (res.confirm) { if (res.confirm) {
uni.clearStorageSync(); uni.clearStorageSync();
appStore.setHasToken(false); appStore.setHasToken(false);
appStore.setTokenExpired(true);
emits("closeDrawer"); emits("closeDrawer");
uni.$emit(NOTICE_EVENT_LOGOUT); uni.$emit(NOTICE_EVENT_LOGOUT);
} }

View File

@@ -1,17 +1,28 @@
<template> <template>
<view class="container"> <view class="container">
<ModuleTitle :title="recommendTheme.themeName" /> <ModuleTitle :title="recommendTheme.themeName" />
<view class="container-scroll">
<view class="container-scroll font-size-0 scroll-x whitescape-nowrap">
<view <view
class="card-item bg-white inline-block rounded-20 mr-8"
v-for="(item, index) in recommendTheme.recommendPostsList" v-for="(item, index) in recommendTheme.recommendPostsList"
:key="index" :key="index"
@click="sendReply(item)"
> >
<view class="mk-card-item" @click="sendReply(item)"> <view class="m-4 relative">
<image class="card-img" :src="item.coverPhoto" mode="aspectFill" /> <image
class="card-img rounded-16 relative z-10"
:src="item.coverPhoto"
mode="aspectFill"
/>
<view class="overlay-gradient"> <view class="shadow absolute rounded-16"></view>
<text class="overlay-text">{{ item.topic }}</text>
</view> </view>
<view
class="card-text color-171717 font-size-14 line-height-20 border-box"
>
{{ item.topic }}
</view> </view>
</view> </view>
</view> </view>

View File

@@ -1,53 +1,27 @@
.container {
width: 100%;
}
.container-scroll { .container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin: 4px 0 6px; margin: 4px 0 6px;
} }
.mk-card-item { .card-item {
flex-shrink: 0; /* 关键:防止 flex 布局压缩子元素宽度 */ width: 128px;
width: 142px; height: 164px;
height: 126px; }
border-radius: 10px;
overflow: hidden;
margin-right: 8px;
position: relative;
.card-img { .card-img {
width: 100%; height: 120px;
height: 100%; width: 120px;
display: block;
} }
/* 渐变背景层 */ .shadow {
.overlay-gradient { background-color: #e5e8ee;
position: absolute; height: 96px;
bottom: 0; width: 96px;
left: 0; bottom: -4px;
width: 100%; left: 50%;
height: 50px; /* 渐变层高度,可调 */ transform: translateX(-50%);
background: linear-gradient( z-index: 1;
to bottom,
rgba(0, 0, 0, 0.001) 0%,
rgba(0, 0, 0, 0.5) 100%
);
display: flex;
align-items: flex-end; /* 文字贴近底部 */
padding: 0 8px 6px; /* 内边距让文字与边缘保持距离 */
box-sizing: border-box;
} }
/* 渐变层上的文字 */ .card-text {
.overlay-text { padding: 4px 8px 8px;
color: #fff;
font-weight: 500;
font-size: $uni-font-size-sm;
text-align: left;
width: 100%;
}
} }

View File

@@ -29,15 +29,25 @@
> >
微信一键登录 微信一键登录
</button> </button>
<button <button
v-if="isAgree" v-if="isAgree && !appStore.tokenExpired"
class="login-btn" class="login-btn"
open-type="getPhoneNumber"
type="primary" type="primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber" @getphonenumber="getPhoneNumber"
> >
微信一键登录 微信一键登录
</button> </button>
<button
v-if="isAgree && appStore.tokenExpired"
class="login-btn"
type="primary"
@click="handleLogin"
>
微信一键登录
</button>
</view> </view>
<!-- 协议勾选 --> <!-- 协议勾选 -->
@@ -79,6 +89,8 @@ import CheckBox from "@/components/CheckBox/index.vue";
import AgreePopup from "./components/AgreePopup/index.vue"; import AgreePopup from "./components/AgreePopup/index.vue";
import { zniconsMap } from "@/static/fonts/znicons.js"; import { zniconsMap } from "@/static/fonts/znicons.js";
import { getCurrentConfig } from "@/constant/base"; import { getCurrentConfig } from "@/constant/base";
import { useAppStore } from "@/store";
const appStore = useAppStore();
const isAgree = ref(false); const isAgree = ref(false);
const visible = ref(false); const visible = ref(false);
@@ -113,6 +125,20 @@ const getPhoneNumber = (e) => {
.catch(() => {}); .catch(() => {});
}; };
const handleLogin = () => {
console.log("handleLogin");
onLogin()
.then(() => {
uni.showToast({
title: "登录成功",
icon: "success",
});
appStore.setTokenExpired(false);
goBack();
})
.catch(() => {});
};
// 处理同意协议点击事件 // 处理同意协议点击事件
const handleAgreeClick = (type) => { const handleAgreeClick = (type) => {
visible.value = true; visible.value = true;

View File

@@ -60,6 +60,7 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
uni.setStorageSync("token", ""); uni.setStorageSync("token", "");
const appStore = useAppStore(); const appStore = useAppStore();
appStore.setHasToken(false); appStore.setHasToken(false);
appStore.setTokenExpired(true);
uni.$emit(NOTICE_EVENT_LOGOUT); uni.$emit(NOTICE_EVENT_LOGOUT);
goLogin(); goLogin();
} }

View File

@@ -0,0 +1,23 @@
// 背景颜色
.bg-white {
background-color: #fff;
}
.bg-gray {
background-color: #f5f5f5;
}
.bg-17294E {
background-color: #17294e;
}
.bg-liner {
background: linear-gradient(205deg, #8ae3fc 0%, rgba(138, 227, 252, 0) 20%),
linear-gradient(155deg, #fef7e1 0%, rgba(254, 247, 225, 0) 20%),
radial-gradient(
48% 48% at 61% 118%,
#ffffff 0%,
rgba(255, 255, 255, 0) 100%
),
linear-gradient(180deg, rgba(238, 248, 255, 0) 0%, #eef8ff 50%), #eef8ff;
}

View File

@@ -0,0 +1,4 @@
// 边框
.border {
border: 1px solid #000;
}

View File

@@ -0,0 +1,49 @@
// 字体颜色
.color-white {
color: #fff;
}
.color-00 {
color: #000;
}
.color-33 {
color: #333;
}
.color-66 {
color: #666;
}
.color-99 {
color: #999;
}
.color-525866 {
color: #525866;
}
.color-171717 {
color: #171717;
}
.color-99A0AE {
color: #99a0ae;
}
.color-FF3D60 {
color: #ff3d60;
}
.color-2D91FF {
color: #2d91ff;
}
.color-43669A {
color: #43669a;
}
.color-21B466 {
color: #21b466;
}

View File

@@ -0,0 +1,16 @@
// 显示类型
.block {
display: block;
}
.inline-block {
display: inline-block;
}
.flex {
display: flex;
}
.grid {
display: grid;
}

View File

@@ -0,0 +1,13 @@
// 省略号
.ellipsis-1 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ellipsis-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}

20
src/static/scss/flex.scss Normal file
View File

@@ -0,0 +1,20 @@
// 弹性布局
.flex {
display: flex;
}
.flex-items-center {
align-items: center;
}
.flex-justify-center {
justify-content: center;
}
.flex-col {
flex-direction: column;
}
.flex-wrap {
flex-wrap: wrap;
}

View File

@@ -0,0 +1,4 @@
// 字体-family
.font-family-sans-serif {
font-family: sans-serif;
}

View File

@@ -0,0 +1,28 @@
// 字体-size
.font-size-0 {
font-size: 0px;
}
.font-size-12 {
font-size: 12px;
}
.font-size-14 {
font-size: 14px;
}
.font-size-16 {
font-size: 16px;
}
.font-size-17 {
font-size: 17px;
}
.font-size-18 {
font-size: 18px;
}
.font-size-20 {
font-size: 20px;
}

View File

@@ -0,0 +1,20 @@
// 字体-weight
.font-bold {
font-weight: bold;
}
.font-400 {
font-weight: 400;
}
.font-500 {
font-weight: 500;
}
.font-600 {
font-weight: 600;
}
.font-700 {
font-weight: 700;
}

View File

View File

@@ -0,0 +1,21 @@
@import "./background.scss";
@import "./border.scss";
@import "./colors.scss";
@import "./display.scss";
@import "./flex.scss";
@import "./font-weight.scss";
@import "./height.scss";
@import "./line-height.scss";
@import "./margin.scss";
@import "./padding.scss";
@import "./font-size.scss";
@import "./font-family.scss";
@import "./text-align.scss";
@import "./rounded.scss";
@import "./ellipsis.scss";
@import "./position.scss";
@import "./scroll.scss";
@import "./overflow.scss";
@import "./width.scss";
@import "./z-index.scss";
@import "./white-scape.scss";

View File

@@ -0,0 +1,20 @@
// 行高
.line-height-17 {
line-height: 17px;
}
.line-height-18 {
line-height: 18px;
}
.line-height-20 {
line-height: 20px;
}
.line-height-21 {
line-height: 21px;
}
.line-height-22 {
line-height: 22px;
}

View File

@@ -0,0 +1,16 @@
// 外边距-bottom
.m-4 {
margin: 4px;
}
.mr-8 {
margin-right: 8px;
}
.mb-10 {
margin-bottom: 10px;
}
.mb-12 {
margin-bottom: 12px;
}

View File

@@ -0,0 +1,4 @@
// 溢出
.overflow-hidden {
overflow: hidden;
}

View File

@@ -0,0 +1,24 @@
// 内边距
.p-8 {
padding: 8px;
}
.p-12 {
padding: 12px;
}
.pt-12 {
padding-top: 12px;
}
.pr-12 {
padding-right: 12px;
}
.pb-12 {
padding-bottom: 12px;
}
.pl-12 {
padding-left: 12px;
}

View File

@@ -0,0 +1,8 @@
// 定位
.relative {
position: relative;
}
.absolute {
position: absolute;
}

View File

@@ -0,0 +1,24 @@
// 圆角
.rounded-4 {
border-radius: 4px;
}
.rounded-8 {
border-radius: 8px;
}
.rounded-12 {
border-radius: 12px;
}
.rounded-16 {
border-radius: 16px;
}
.rounded-20 {
border-radius: 20px;
}
.rounded-full {
border-radius: 50%;
}

View File

@@ -0,0 +1,8 @@
// 滚动条
.scroll-y {
overflow-y: auto;
}
.scroll-x {
overflow-x: auto;
}

View File

@@ -0,0 +1,12 @@
// 文本-align
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}

View File

@@ -0,0 +1,3 @@
.whitescape-nowrap {
white-space: nowrap;
}

View File

@@ -0,0 +1,7 @@
.w-full {
width: 100%;
}
.w-50 {
width: 50%;
}

View File

@@ -0,0 +1,15 @@
.z-0 {
z-index: 0;
}
.z-10 {
z-index: 10;
}
.z-20 {
z-index: 20;
}
.z-30 {
z-index: 30;
}

View File

@@ -6,6 +6,7 @@ export const useAppStore = defineStore("app", {
title: "", title: "",
sceneId: "", sceneId: "",
hasToken: false, hasToken: false,
tokenExpired: false,
}; };
}, },
getters: {}, getters: {},
@@ -17,8 +18,11 @@ export const useAppStore = defineStore("app", {
setSceneId(data) { setSceneId(data) {
this.sceneId = data; this.sceneId = data;
}, },
setHasToken(data) { setHasToken(status) {
this.hasToken = data; this.hasToken = status;
},
setTokenExpired(status) {
this.tokenExpired = status;
}, },
}, },

15
src/utils/share.js Normal file
View File

@@ -0,0 +1,15 @@
export default {
install(app) {
app.mixin({
onLoad() {
const page = getCurrentPages().pop();
if (page) {
uni.showShareMenu({
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
}
},
});
},
};