@ -1,22 +1,22 @@
|
|||||||
-- 创建数据库
|
-- 创建数据库
|
||||||
CREATE DATABASE IF NOT EXISTS wx_miniapp DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
CREATE DATABASE IF NOT EXISTS wx_miniapp DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
-- 使用数据库
|
-- 使用数据库
|
||||||
USE wx_miniapp;
|
USE wx_miniapp;
|
||||||
|
|
||||||
-- 创建微信用户表
|
-- 创建微信用户表
|
||||||
CREATE TABLE IF NOT EXISTS `wx_user` (
|
CREATE TABLE IF NOT EXISTS `wx_user` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
`openid` varchar(100) NOT NULL COMMENT '微信openid',
|
`openid` varchar(100) NOT NULL COMMENT '微信openid',
|
||||||
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
|
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
|
||||||
`avatar_url` varchar(500) DEFAULT NULL COMMENT '头像URL',
|
`avatar_url` varchar(500) DEFAULT NULL COMMENT '头像URL',
|
||||||
`gender` tinyint(4) DEFAULT NULL COMMENT '性别 0-未知 1-男 2-女',
|
`gender` tinyint(4) DEFAULT NULL COMMENT '性别 0-未知 1-男 2-女',
|
||||||
`country` varchar(50) DEFAULT NULL COMMENT '国家',
|
`country` varchar(50) DEFAULT NULL COMMENT '国家',
|
||||||
`province` varchar(50) DEFAULT NULL COMMENT '省份',
|
`province` varchar(50) DEFAULT NULL COMMENT '省份',
|
||||||
`city` varchar(50) DEFAULT NULL COMMENT '城市',
|
`city` varchar(50) DEFAULT NULL COMMENT '城市',
|
||||||
`language` varchar(50) DEFAULT NULL COMMENT '语言',
|
`language` varchar(50) DEFAULT NULL COMMENT '语言',
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_openid` (`openid`) COMMENT 'openid唯一索引'
|
UNIQUE KEY `uk_openid` (`openid`) COMMENT 'openid唯一索引'
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信用户表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信用户表';
|
@ -1,58 +1,58 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.learning.newdemo.mapper.WxUserMapper">
|
<mapper namespace="com.learning.newdemo.mapper.WxUserMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxUser">
|
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxUser">
|
||||||
<id column="id" property="id" jdbcType="INTEGER"/>
|
<id column="id" property="id" jdbcType="INTEGER"/>
|
||||||
<result column="openid" property="openid" jdbcType="VARCHAR"/>
|
<result column="openid" property="openid" jdbcType="VARCHAR"/>
|
||||||
<result column="nickname" property="nickname" jdbcType="VARCHAR"/>
|
<result column="nickname" property="nickname" jdbcType="VARCHAR"/>
|
||||||
<result column="avatar_url" property="avatarUrl" jdbcType="VARCHAR"/>
|
<result column="avatar_url" property="avatarUrl" jdbcType="VARCHAR"/>
|
||||||
<result column="gender" property="gender" jdbcType="INTEGER"/>
|
<result column="gender" property="gender" jdbcType="INTEGER"/>
|
||||||
<result column="country" property="country" jdbcType="VARCHAR"/>
|
<result column="country" property="country" jdbcType="VARCHAR"/>
|
||||||
<result column="province" property="province" jdbcType="VARCHAR"/>
|
<result column="province" property="province" jdbcType="VARCHAR"/>
|
||||||
<result column="city" property="city" jdbcType="VARCHAR"/>
|
<result column="city" property="city" jdbcType="VARCHAR"/>
|
||||||
<result column="language" property="language" jdbcType="VARCHAR"/>
|
<result column="language" property="language" jdbcType="VARCHAR"/>
|
||||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, openid, nickname, avatar_url, gender, country, province, city, language, create_time, update_time
|
id, openid, nickname, avatar_url, gender, country, province, city, language, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectByOpenid" resultMap="BaseResultMap" parameterType="java.lang.String">
|
<select id="selectByOpenid" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from wx_user
|
from wx_user
|
||||||
where openid = #{openid,jdbcType=VARCHAR}
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.learning.newdemo.entity.WxUser" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insert" parameterType="com.learning.newdemo.entity.WxUser" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into wx_user (
|
insert into wx_user (
|
||||||
openid, nickname, avatar_url, gender, country, province, city, language, create_time
|
openid, nickname, avatar_url, gender, country, province, city, language, create_time
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
#{openid,jdbcType=VARCHAR},
|
#{openid,jdbcType=VARCHAR},
|
||||||
#{nickname,jdbcType=VARCHAR},
|
#{nickname,jdbcType=VARCHAR},
|
||||||
#{avatarUrl,jdbcType=VARCHAR},
|
#{avatarUrl,jdbcType=VARCHAR},
|
||||||
#{gender,jdbcType=INTEGER},
|
#{gender,jdbcType=INTEGER},
|
||||||
#{country,jdbcType=VARCHAR},
|
#{country,jdbcType=VARCHAR},
|
||||||
#{province,jdbcType=VARCHAR},
|
#{province,jdbcType=VARCHAR},
|
||||||
#{city,jdbcType=VARCHAR},
|
#{city,jdbcType=VARCHAR},
|
||||||
#{language,jdbcType=VARCHAR},
|
#{language,jdbcType=VARCHAR},
|
||||||
now()
|
now()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.learning.newdemo.entity.WxUser">
|
<update id="updateByPrimaryKey" parameterType="com.learning.newdemo.entity.WxUser">
|
||||||
update wx_user
|
update wx_user
|
||||||
set nickname = #{nickname,jdbcType=VARCHAR},
|
set nickname = #{nickname,jdbcType=VARCHAR},
|
||||||
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
|
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
|
||||||
gender = #{gender,jdbcType=INTEGER},
|
gender = #{gender,jdbcType=INTEGER},
|
||||||
country = #{country,jdbcType=VARCHAR},
|
country = #{country,jdbcType=VARCHAR},
|
||||||
province = #{province,jdbcType=VARCHAR},
|
province = #{province,jdbcType=VARCHAR},
|
||||||
city = #{city,jdbcType=VARCHAR},
|
city = #{city,jdbcType=VARCHAR},
|
||||||
language = #{language,jdbcType=VARCHAR},
|
language = #{language,jdbcType=VARCHAR},
|
||||||
update_time = now()
|
update_time = now()
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
@ -1,136 +1,164 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="tab-bar">
|
<view class="tab-bar">
|
||||||
<!-- 添加移动的背景块 -->
|
<view
|
||||||
<view class="active-bg" :style="{ transform: `translateX(${100 * props.currentComponentIndex}%)` }"></view>
|
v-for="(tab, index) in tabs"
|
||||||
|
:key="index"
|
||||||
<view
|
class="tab-item"
|
||||||
class="tab-item"
|
:class="{ active: activeTab === index }"
|
||||||
:class="{
|
@click="switchTab(index)"
|
||||||
'active': props.currentComponentIndex === index,
|
>
|
||||||
'is-first-tab': index === 0
|
<view class="tab-icon-container" :class="{ active: activeTab === index }">
|
||||||
}"
|
<view class="tab-icon">
|
||||||
v-for="(item, index) in tabList"
|
<image :src="activeTab === index ? tab.activeIcon : tab.icon" mode="aspectFit"></image>
|
||||||
:key="index"
|
</view>
|
||||||
@click="changeTab(index)">
|
</view>
|
||||||
<text :class="{'active': props.currentComponentIndex === index}">{{ item.pageName }}</text>
|
<view class="tab-label" :class="{ active: activeTab === index }">{{ tab.label }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script>
|
||||||
|
export default {
|
||||||
// 定义emit事件
|
props: {
|
||||||
const emit = defineEmits(['change-tab', 'change-index']);
|
activeTab: {
|
||||||
const props = defineProps(['currentComponentIndex']);
|
type: Number,
|
||||||
|
default: 0
|
||||||
const tabList = [
|
}
|
||||||
{
|
},
|
||||||
pageName:'首页',
|
data() {
|
||||||
component:'PageOfHome'
|
return {
|
||||||
},
|
tabs: [
|
||||||
{
|
{
|
||||||
pageName:'立论',
|
label: '首页',
|
||||||
component:'PageOfArgument'
|
icon: '/static/icons/home.png',
|
||||||
},
|
activeIcon: '/static/icons/home-fill.png'
|
||||||
{
|
},
|
||||||
pageName:'复盘',
|
{
|
||||||
component:'PageOfReview'
|
label: '辩论',
|
||||||
},
|
icon: '/static/icons/chat-1-line.png',
|
||||||
{
|
activeIcon: '/static/icons/chat-1-fill.png'
|
||||||
pageName:'辩论',
|
},
|
||||||
component:'PageOfDebate'
|
{
|
||||||
}
|
label: '立论',
|
||||||
];
|
icon: '/static/icons/lightbulb-line.png',
|
||||||
|
activeIcon: '/static/icons/lightbulb-fill.png'
|
||||||
const changeTab = (index) => {
|
},
|
||||||
if(props.currentComponentIndex === index) return;
|
{
|
||||||
// 触发事件并传递当前组件名称和索引
|
label: '复盘',
|
||||||
emit('change-tab', tabList[index].component);
|
icon: '/static/icons/file-chart-line.png',
|
||||||
emit('change-index', index);
|
activeIcon: '/static/icons/file-chart-fill.png'
|
||||||
};
|
}
|
||||||
|
]
|
||||||
</script>
|
};
|
||||||
|
},
|
||||||
<style scoped>
|
methods: {
|
||||||
.tab-bar {
|
switchTab(index) {
|
||||||
display: flex;
|
if (this.activeTab === index) return;
|
||||||
width: 70%;
|
this.$emit('tab-change', index);
|
||||||
margin: 0 auto;
|
}
|
||||||
height: 70%;
|
}
|
||||||
background-color: #1A2C42;
|
};
|
||||||
border: none;
|
</script>
|
||||||
position: relative;
|
|
||||||
border-radius: 25rpx;
|
<style scoped>
|
||||||
overflow: hidden;
|
.tab-bar {
|
||||||
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.2);
|
position: fixed;
|
||||||
transform: translateZ(0);
|
bottom: 0;
|
||||||
-webkit-transform: translateZ(0);
|
left: 0;
|
||||||
backface-visibility: hidden;
|
right: 0;
|
||||||
-webkit-backface-visibility: hidden;
|
height: 120rpx;
|
||||||
}
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
display: flex;
|
||||||
/* 移动的背景块 */
|
justify-content: space-around;
|
||||||
.active-bg {
|
align-items: center;
|
||||||
position: absolute;
|
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
width: 25%;
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
height: 100%;
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
background-color: #00D6B9;
|
z-index: 100;
|
||||||
border-radius: 25rpx;
|
}
|
||||||
transition: transform 0.3s ease;
|
|
||||||
z-index: 1;
|
.tab-item {
|
||||||
box-shadow: 0 0 20rpx rgba(0, 214, 185, 0.5);
|
display: flex;
|
||||||
/* 添加硬件加速 */
|
flex-direction: column;
|
||||||
will-change: transform;
|
align-items: center;
|
||||||
}
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
.tab-item {
|
flex: 1;
|
||||||
flex: 1;
|
height: 100%;
|
||||||
display: flex;
|
transition: all 0.3s;
|
||||||
justify-content: center;
|
}
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
.tab-icon-container {
|
||||||
position: relative;
|
width: 100rpx;
|
||||||
z-index: 2;
|
height: 100rpx;
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.tab-item::before {
|
justify-content: center;
|
||||||
content: '';
|
position: relative;
|
||||||
position: absolute;
|
transition: all 0.3s ease;
|
||||||
left: 0;
|
z-index: 2;
|
||||||
top: 50%;
|
border-radius: 50%;
|
||||||
transform: translateY(-50%);
|
min-width: 80rpx; /* 防止 flex 压缩 */
|
||||||
width: 1px;
|
min-height: 80rpx;
|
||||||
height: 60%;
|
flex-shrink: 0; /* 禁止压缩 */
|
||||||
z-index: 2;
|
}
|
||||||
background: linear-gradient(
|
|
||||||
to bottom,
|
.tab-icon-container.active {
|
||||||
transparent,
|
width: 120rpx;
|
||||||
rgba(0, 214, 185, 0.1) 15%,
|
height: 120rpx;
|
||||||
rgba(0, 214, 185, 0.5) 50%,
|
border-radius: 50%;
|
||||||
rgba(0, 214, 185, 0.1) 85%,
|
background-color: #B59DF1;
|
||||||
transparent
|
transform: translateY(-45rpx);
|
||||||
);
|
border: 14rpx solid #6839E0;
|
||||||
}
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
.tab-item.is-first-tab::before {
|
box-shadow: 0 4rpx 20rpx rgba(104, 57, 224, 0.4);
|
||||||
display: none;
|
}
|
||||||
}
|
|
||||||
|
.tab-icon {
|
||||||
.tab-item.active {
|
width: 60rpx;
|
||||||
background-color: transparent;
|
height: 60rpx;
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.tab-item text {
|
justify-content: center;
|
||||||
font-size: 24rpx;
|
transition: all 0.3s;
|
||||||
color: rgba(0, 214, 185, 0.7);
|
}
|
||||||
transition: all 0.3s ease;
|
|
||||||
text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.2);
|
.tab-icon image {
|
||||||
}
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
.tab-item text.active {
|
filter: brightness(0) invert(0.8);
|
||||||
color: #ffffff;
|
opacity: 0.7;
|
||||||
font-weight: bold;
|
transition: all 0.3s;
|
||||||
text-shadow: 0 1rpx 8rpx rgba(255, 255, 255, 0.4);
|
}
|
||||||
transform: scale(1.05);
|
|
||||||
}
|
.tab-label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
transition: all 0.3s;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
opacity: 0.7;
|
||||||
|
font-family: 'Poppins' , 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
|
||||||
|
letter-spacing: 1rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-label.active {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: 600;
|
||||||
|
opacity: 1;
|
||||||
|
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
|
||||||
|
transform: translateY(-15rpx) scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.tab-icon-container.active .tab-icon image {
|
||||||
|
opacity: 1;
|
||||||
|
filter: brightness(0) invert(1);
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item:active {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -1,22 +1,25 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"path": "pages/login/index",
|
"path": "pages/login/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "登录"
|
"navigationBarTitleText": "登录"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "首页"
|
"navigationBarTitleText": "首页"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "white",
|
"navigationBarTextStyle": "white",
|
||||||
"navigationBarTitleText": "智辩云枢",
|
"navigationBarTitleText": "智辩云枢",
|
||||||
"navigationBarBackgroundColor": "#1a2a6c",
|
"navigationBarBackgroundColor": "#1a2a6c",
|
||||||
"backgroundColor": "#000000"
|
"backgroundColor": "#000000"
|
||||||
}
|
},
|
||||||
}
|
"style": {
|
||||||
|
"scoped": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.5 KiB |