14 Commits

Author SHA1 Message Date
7a117a3b46 Merge branch 'fix-109' of https://git.nianxx.cn/zoujing/YGChatCS 2025-10-14 21:53:49 +08:00
b97c836f97 feat: 输入框的样式调整 2025-10-14 21:53:23 +08:00
duanshuwen
b5f5bc646a Merge branch 'main' of https://git.nianxx.cn/zoujing/YGChatCS into fix-109 2025-10-14 20:10:50 +08:00
duanshuwen
07251f7676 feat: 调整首页容器样式 2025-10-14 20:10:40 +08:00
f1e009d656 feat: 样式调整 2025-10-14 20:09:18 +08:00
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
48 changed files with 543 additions and 122 deletions

View File

@@ -16,6 +16,7 @@ onHide(() => {
<style lang="scss">
@import "@/static/fonts/iconfont.css";
@import "@/static/scss/index.scss";
/* 添加全局样式 */
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 { useAppStore } from "@/store";
@@ -10,16 +10,28 @@ export const goBack = () => uni.navigateBack({ delta: 1 });
// 登录逻辑
export const onLogin = async (e) => {
console.info("onLogin code: ", e.detail);
console.info("onLogin code: ", e);
return new Promise(async (resolve, reject) => {
// 判断用户拒绝
if (e.detail.errno === 104) {
if (e !== undefined && e && e.detail && e.detail.errno === 104) {
reject();
return;
}
await loginAuth(e).then(async () => {
// 检查手机号是否绑定
const checkRes = await checkPhone();
if (checkRes.data) {
resolve();
return;
}
if (e === undefined) {
resolve();
return;
}
const { code } = e.detail;
// 绑定手机号

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,7 @@
.chat-mine {
margin: 6px 12px;
margin: 6px 20px;
padding: 8px 16px;
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;
border-radius: 15px;
display: flex;
flex-direction: column;

View File

@@ -1,5 +1,5 @@
<template>
<view class="chat-other">
<view class="chat-other pl-20">
<text>{{ text }}</text>
<slot></slot>
</view>

View File

@@ -1,11 +1,11 @@
.chat-other {
width: 100%;
margin: 6px 0;
padding: 0 12px;
display: flex;
flex-direction: column;
max-width: 100%; // ✅ 限制最大宽度
overflow-x: hidden; // ✅ 防止横向撑开
padding-left: 20px;
text {
font-size: $uni-font-size-base;

View File

@@ -6,12 +6,12 @@
<image
class="voice-icon"
v-if="!isVoiceMode"
src="https://oss.nianxx.cn/mp/static/input_voice_icon.png"
src="https://oss.nianxx.cn/mp/static/version_1_0_1/input_voice_icon.png"
/>
<image
class="voice-icon"
v-else
src="https://oss.nianxx.cn/mp/static/input_keyboard_icon.png"
src="https://oss.nianxx.cn/mp/static/version_1_0_1/input_keyboard_icon.png"
/>
</view>
@@ -53,20 +53,20 @@
<view class="input-container-send">
<view class="input-container-send-btn" @click="sendMessage">
<image
v-if="props.isSessionActive"
class="send-icon"
src="https://oss.nianxx.cn/mp/static/input_stop_icon.png"
/>
<view v-if="props.isSessionActive" class="send-stop"> </view>
<image
v-else
class="send-icon"
src="https://oss.nianxx.cn/mp/static/input_send_icon.png"
src="https://oss.nianxx.cn/mp/static/version_1_0_1/input_send_icon.png"
/>
</view>
</view>
</view>
<view class="color-99A0AE font-size-9 text-center text-gray-400 mb-8">
内容由AI大模型生成请仔细鉴别
</view>
<!-- 录音按钮 -->
<RecordingWaveBtn v-if="visibleWaveBtn" ref="recordingWaveBtnRef" />
</view>

View File

@@ -1,10 +1,10 @@
.area-input {
display: flex;
align-items: center;
border-radius: 22px;
border-radius: 24px;
background-color: $uni-bg-color;
box-shadow: 0px 0px 20px 0px rgba(52, 25, 204, 0.05);
margin: 0 12px;
margin: 0 20px;
margin-bottom: 8px;
.input-container-voice {
@@ -12,12 +12,12 @@
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
width: 48px;
height: 48px;
.voice-icon {
width: 22px;
height: 22px;
width: 24px;
height: 24px;
}
}
@@ -45,20 +45,39 @@
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
width: 48px;
height: 48px;
.input-container-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
width: 36px;
height: 36px;
border-radius: 50%;
background: radial-gradient(
39% 39% at 97% 81%,
#79dffb 0%,
rgba(138, 227, 252, 0) 100%
),
radial-gradient(
54% 54% at 3% 70%,
#8afcf8 0%,
rgba(138, 252, 248, 0) 100%
),
#2d91ff;
}
.send-icon {
width: 28px;
height: 28px;
width: 24px;
height: 24px;
}
.send-stop {
width: 12px;
height: 12px;
background: #ffffff;
border-radius: 4px;
}
}

View File

@@ -6,7 +6,10 @@
v-for="(item, index) in itemList"
: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 }}
</view>
</view>

View File

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

View File

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

View File

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

View File

@@ -1,53 +1,27 @@
.container {
width: 100%;
}
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin: 4px 0 6px;
}
.mk-card-item {
flex-shrink: 0; /* 关键:防止 flex 布局压缩子元素宽度 */
width: 142px;
height: 126px;
border-radius: 10px;
overflow: hidden;
margin-right: 8px;
position: relative;
.card-item {
width: 128px;
height: 164px;
}
.card-img {
width: 100%;
height: 100%;
display: block;
height: 120px;
width: 120px;
}
/* 渐变背景层 */
.overlay-gradient {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 50px; /* 渐变层高度,可调 */
background: linear-gradient(
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;
.shadow {
background-color: #e5e8ee;
height: 96px;
width: 96px;
bottom: -4px;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
/* 渐变层上的文字 */
.overlay-text {
color: #fff;
font-weight: 500;
font-size: $uni-font-size-sm;
text-align: left;
width: 100%;
}
.card-text {
padding: 4px 8px 8px;
}

View File

@@ -1,5 +1,5 @@
<template>
<view class="container">
<view class="w-full h-screen">
<ChatMainList />
</view>
@@ -61,10 +61,4 @@ onUnmounted(() => {
});
</script>
<style lang="scss" scoped>
.container {
width: 100vw;
height: 100vh;
background-color: $uni-bg-color;
}
</style>
<style lang="scss" scoped></style>

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 966 B

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,36 @@
// 字体-size
.font-size-0 {
font-size: 0px;
}
.font-size-9 {
font-size: 9px;
}
.font-size-10 {
font-size: 10px;
}
.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

@@ -0,0 +1,3 @@
.h-screen {
height: 100vh;
}

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,20 @@
// 外边距-bottom
.m-4 {
margin: 4px;
}
.mr-8 {
margin-right: 8px;
}
.mb-8 {
margin-bottom: 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,40 @@
// 内边距
.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;
}
.pl-16 {
padding-left: 16px;
}
.pr-16 {
padding-right: 16px;
}
.pl-20 {
padding-left: 20px;
}
.pr-20 {
padding-right: 20px;
}

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: "",
sceneId: "",
hasToken: false,
tokenExpired: false,
};
},
getters: {},
@@ -17,8 +18,11 @@ export const useAppStore = defineStore("app", {
setSceneId(data) {
this.sceneId = data;
},
setHasToken(data) {
this.hasToken = data;
setHasToken(status) {
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"],
});
}
},
});
},
};