diff --git a/front-end/mall4uni/.eslintrc.cjs b/front-end/mall4uni/.eslintrc.cjs index a87c46f..2e051ac 100644 --- a/front-end/mall4uni/.eslintrc.cjs +++ b/front-end/mall4uni/.eslintrc.cjs @@ -1,32 +1,34 @@ module.exports = { env: { - browser: true, - es2021: true, - node: true + browser: true, // 启用浏览器环境,提供全局变量如 `window` 和 `document` + es2021: true, // 启用 ES2021 语法支持 + node: true // 启用 Node.js 环境,提供全局变量如 `require` 和 `module` }, globals: { - uni: 'readonly', - getApp: 'readonly', - wx: 'readonly', - getCurrentPages: 'readonly', - plus: 'readonly' + uni: 'readonly', // 将 `uni` 定义为只读全局变量,适用于 Uni-App 框架 + getApp: 'readonly', // 将 `getApp` 定义为只读全局函数,用于获取应用实例 + wx: 'readonly', // 将 `wx` 定义为只读全局对象,适用于微信小程序 + getCurrentPages: 'readonly', // 将 `getCurrentPages` 定义为只读全局函数,用于获取当前页面栈 + plus: 'readonly' // 将 `plus` 定义为只读全局对象,适用于 5+App(HTML5+) }, extends: [ - 'standard', - './.eslintrc-auto-import.json', - 'plugin:vue/vue3-recommended', - 'plugin:vue-scoped-css/vue3-recommended' + 'standard', // 继承 Standard 代码风格规则集 + './.eslintrc-auto-import.json', // 继承自定义的自动导入配置文件 + 'plugin:vue/vue3-recommended', // 继承 Vue 3 的推荐规则集 + 'plugin:vue-scoped-css/vue3-recommended' // 继承 Vue 3 scoped CSS 的推荐规则集 ], overrides: [ + // 用于针对特定文件或文件模式进行规则覆盖,当前为空 ], parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module' + ecmaVersion: 'latest', // 使用最新的 ECMAScript 版本解析代码 + sourceType: 'module' // 将代码视为 ES 模块 }, plugins: [ - 'vue' - ], + 'vue' // 使用 `eslint-plugin-vue` 插件来支持 Vue 文件的 linting + ] +}; rules: { // Possible Errors // 要求使用 let 或 const 而不是 var diff --git a/front-end/mall4uni/.npmrc b/front-end/mall4uni/.npmrc index febf696..ea2be49 100644 --- a/front-end/mall4uni/.npmrc +++ b/front-end/mall4uni/.npmrc @@ -1,4 +1,23 @@ +# 启用严格的引擎检查 +# 当设置为 true 时,npm 会严格检查项目的 package.json 文件中的 engines 字段, +# 确保当前环境的 Node.js 和 npm 版本符合指定的要求。如果不符合,npm 将抛出错误并阻止安装依赖。 engine-strict = true + +# 启用“羞耻地提升”(shameful hoisting) +# 在 yarn 中,默认情况下,依赖项会被提升到顶层 node_modules 目录中,以减少嵌套层级。 +# 但是,某些情况下,yarn 会避免提升一些依赖项,以防止潜在的冲突。 +# 设置为 true 时,yarn 会忽略这些规则,尽可能地将所有依赖项提升到顶层,即使这样做可能会导致冲突。 +# 这种做法被称为“羞耻地提升”,因为它可能会引入不稳定的依赖关系。 shamefully-hoist = true + +# 禁用严格的 peer 依赖检查 +# 当设置为 false 时,npm 或 yarn 不会因为 peer 依赖版本不匹配而抛出错误或警告。 +# peer 依赖通常用于插件系统,确保插件和主库的版本兼容性。 +# 设置为 false 可以避免因 peer 依赖版本不匹配而导致的安装失败,但可能会引入潜在的兼容性问题。 strict-peer-dependencies = false + +# 指定 npm 或 yarn 使用的注册表(registry) +# 默认情况下,npm 和 yarn 使用官方的 npm 注册表 (https://registry.npmjs.org)。 +# 通过设置此选项,可以切换到其他镜像源,例如国内的 npmmirror,以加快包的下载速度。 +# 这里指定了使用 https://registry.npmmirror.com 作为注册表,适用于中国大陆用户。 registry = https://registry.npmmirror.com diff --git a/front-end/mall4uni/index.html b/front-end/mall4uni/index.html index f4d9584..a499942 100644 --- a/front-end/mall4uni/index.html +++ b/front-end/mall4uni/index.html @@ -2,20 +2,33 @@ + + mall4uni-pro + + - + + -
- +
+ + + + diff --git a/front-end/mall4uni/jsconfig.json b/front-end/mall4uni/jsconfig.json index c177f0b..256e776 100644 --- a/front-end/mall4uni/jsconfig.json +++ b/front-end/mall4uni/jsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "types": [ - "@dcloudio/types", - "miniprogram-api-typings", - "mini-types" + "@dcloudio/types", // 引入 DCloud 提供的类型定义,适用于 Uni-App 框架 + "miniprogram-api-typings", // 引入微信小程序 API 的类型定义,确保 TypeScript 能够识别小程序的 API + "mini-types" // 引入其他小程序相关的类型定义,扩展 TypeScript 对小程序的支持 ] }, "allowJs": true // 允许编译js文件 diff --git a/front-end/mall4uni/src/app.css b/front-end/mall4uni/src/app.css index 8ff70e1..af2239e 100644 --- a/front-end/mall4uni/src/app.css +++ b/front-end/mall4uni/src/app.css @@ -1,108 +1,176 @@ -/**app.wxss**/ +/** app.wxss **/ + +/* + * 容器样式 + * 设置容器的高度为100%,确保其占据整个屏幕高度。 + * 使用 border-box 模型,使得 padding 和 border 包含在元素的总宽度和高度内。 + * 设置文本颜色为 #333,并指定字体系列以确保跨平台一致性。 + */ .container { height: 100%; box-sizing: border-box; color: #333; - font-family: helvetica,'Heiti SC',PingFangSC-Light; + font-family: helvetica, 'Heiti SC', PingFangSC-Light; } -.price{ + +/* + * 价格样式 + * 设置价格的字体为 Arial,显示为行内块级元素,颜色为红色 (#eb2444)。 + * 添加底部和左侧的内边距,使价格与其他内容之间有适当的间距。 + */ +.price { font-family: Arial; display: inline-block; color: #eb2444; - padding-bottom:10rpx; - padding-left:10rpx; + padding-bottom: 10rpx; + padding-left: 10rpx; } -/* 价格数字显示不同大小 */ +/* + * 价格符号(如¥、$等)样式 + * 设置符号的字体大小为 24rpx。 + */ .symbol { font-size: 24rpx; } +/* + * 大号数字样式 + * 设置大号数字的字体大小为 32rpx。 + */ .big-num { font-size: 32rpx; } +/* + * 小号数字样式 + * 设置小号数字的字体大小为 24rpx。 + */ .small-num { font-size: 24rpx; } /* -*改变checkbox样式 -*自定义样式 -*/ -/* reg */ + * 改变checkbox样式 + * 自定义样式以适应应用设计 + */ + +/* + * checkbox 组样式 + * 设置 checkbox 组的宽度为 100%,确保其占满整个父容器。 + */ uni-checkbox-group { width: 100% !important; } -uni-checkbox-group uni-label{ - width: 33% !important; - display: inline-flex; - margin-bottom: 20rpx; -} -/*checkbox 选项框大小 */ -uni-checkbox .uni-checkbox-input{ + + /* + * checkbox 标签样式 + * 设置每个 checkbox 标签的宽度为 33%,并使用行内弹性布局,使其在一行中均匀分布。 + * 添加底部外边距,确保标签之间有足够的间距。 + */ + uni-checkbox-group uni-label { + width: 33% !important; + display: inline-flex; + margin-bottom: 20rpx; + } + +/* + * checkbox 选项框大小 + * 设置 checkbox 选项框的宽度和高度为 38rpx,并设置为圆形(border-radius: 50%)。 + */ +uni-checkbox .uni-checkbox-input { width: 38rpx !important; height: 38rpx !important; - border-radius: 50%!important; -} -/*checkbox选中后样式 */ -uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked{ - background: #e43130; - border: 1px solid transparent !important; -} -/*checkbox选中后图标样式 */ -uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked::before{ - display: inline-block; - width: 20rpx; - height: 20rpx; - line-height: 20rpx; - text-align: center; - font-size: 18rpx; - color: #fff; - background: transparent; - transform: translate(-60%, -50%) scale(1); - -webkit-transform: translate(-60%, -50%) scale(1); + border-radius: 50% !important; } + /* + * checkbox 选中后样式 + * 设置选中后的 checkbox 背景颜色为红色 (#e43130),并移除默认边框。 + */ + uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked { + background: #e43130; + border: 1px solid transparent !important; + } + + /* + * checkbox 选中后图标样式 + * 设置选中后的 checkbox 图标的样式,包括尺寸、对齐方式、字体大小和颜色。 + * 使用 transform 属性调整图标的居中位置和缩放比例。 + */ + uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked::before { + display: inline-block; + width: 20rpx; + height: 20rpx; + line-height: 20rpx; + text-align: center; + font-size: 18rpx; + color: #fff; + background: transparent; + transform: translate(-60%, -50%) scale(1); + -webkit-transform: translate(-60%, -50%) scale(1); + } + /* -*改变radio样式 -*自定义样式 -*/ -/* 未选中的 背景样式 */ -uni-radio .uni-radio-input{ + * 改变radio样式 + * 自定义样式以适应应用设计 + */ + +/* + * 未选中的 radio 背景样式 + * 设置未选中的 radio 选项框的高度和宽度为 36rpx,背景透明,并设置为圆形。 + */ +uni-radio .uni-radio-input { height: 36rpx; width: 36rpx; border-radius: 50%; background: transparent; box-sizing: border-box; } -/* 选中后的 背景样式 */ -uni-radio .uni-radio-input.uni-radio-input-checked{ - border: none !important; - background: #e43130 !important; -} -/* 选中后的 对勾样式 */ -uni-radio .uni-radio-input.uni-radio-input-checked::before{ - border-radius: 50%; - width: 32rpx; - height: 32rpx; - line-height: 32rpx; - text-align: center; - font-size: 20rpx; - color:#fff; - background: #e43130; - border-radius: 50%; - transform: translate(-50%, -50%) scale(1); - -webkit-transform: translate(-50%, -50%) scale(1); -} -/* 底部按钮兼容 iPhone X以上 */ -@media screen and (width: 375px) and (height: 812px){ + /* + * 选中后的 radio 背景样式 + * 设置选中后的 radio 选项框的背景颜色为红色 (#e43130),并移除默认边框。 + */ + uni-radio .uni-radio-input.uni-radio-input-checked { + border: none !important; + background: #e43130 !important; + } + + /* + * 选中后的 radio 对勾样式 + * 设置选中后的 radio 对勾的样式,包括尺寸、对齐方式、字体大小和颜色。 + * 使用 transform 属性调整对勾的居中位置和缩放比例。 + */ + uni-radio .uni-radio-input.uni-radio-input-checked::before { + border-radius: 50%; + width: 32rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + font-size: 20rpx; + color: #fff; + background: #e43130; + border-radius: 50%; + transform: translate(-50%, -50%) scale(1); + -webkit-transform: translate(-50%, -50%) scale(1); + } + +/* + * 底部按钮兼容 iPhone X以上 + * 为特定屏幕尺寸的设备(如 iPhone X 及以上)添加额外的底部内边距,以避免底部按钮被虚拟键盘遮挡。 + */ +@media screen and (width: 375px) and (height: 812px) { .container { padding-bottom: 70px; } } -@media screen and (width: 414px) and (height: 736px){ + +/* + * 底部按钮兼容 iPhone 8 Plus + * 为特定屏幕尺寸的设备(如 iPhone 8 Plus)添加额外的底部内边距,以避免底部按钮被虚拟键盘遮挡。 + */ +@media screen and (width: 414px) and (height: 736px) { .container { padding-bottom: 70px; } diff --git a/front-end/mall4uni/src/components/img-show/img-show.vue b/front-end/mall4uni/src/components/img-show/img-show.vue index 8bf664d..fd1cbf9 100644 --- a/front-end/mall4uni/src/components/img-show/img-show.vue +++ b/front-end/mall4uni/src/components/img-show/img-show.vue @@ -1,79 +1,94 @@ diff --git a/front-end/mall4uni/src/components/production/production.scss b/front-end/mall4uni/src/components/production/production.scss index b7105a2..cb773d6 100644 --- a/front-end/mall4uni/src/components/production/production.scss +++ b/front-end/mall4uni/src/components/production/production.scss @@ -1,53 +1,86 @@ +/* +.prod-items 类用于设置商品相关元素的样式 +宽度占比为43%,背景颜色为白色,底部外边距为40rpx,并且使用了盒模型为 border-box(使元素的宽高包含内边距和边框) +*/ .prod-items { width: 43%; background: #fff; margin-bottom: 40rpx; box-sizing: border-box; - .hot-imagecont { + /* + .hot-imagecont 类用于设置包含商品图片元素的容器样式 + 给这个容器设置了圆角、文本居中以及将字体大小设为0(通常用于去除图片下方的空白间隙等情况) + */ + .hot-imagecont { border-radius: 8rpx; text-align: center; font-size: 0; } - .hot-text { + .hot-text { margin-top: 20rpx; - .prod-info { + /* + .prod-info 类用于设置商品相关信息文本的样式,比如字体大小、颜色、内边距以及距离顶部的外边距等 + */ + .prod-info { font-size: 20rpx; color: #777; padding: 0 20rpx; margin-top: 8rpx; } - .prod-text-info { + /* + .prod-text-info 类用于设置商品文本信息所在元素的整体样式,定义了高度、行高、字体族等基本样式属性 + 并且内部还有针对价格等更具体样式的嵌套类 + */ + .prod-text-info { position: relative; height: 50rpx; line-height: 70rpx; font-family: Arial; - .price { + /* + .price 类用于设置商品价格文本的颜色,将其设置为特定的红色(#eb2444),同时设置了左边的内边距 + */ + .price { color: #eb2444; padding-left: 20rpx; } } } } +/* +prod 伪类选择器,用于根据元素的顺序来区分不同的商品元素,分别设置不同的内边距样式 +:nth-child(2n-1) 表示奇数项的商品元素 +*/ prod { &:nth-child(2n-1) { - .prod-items { + .prod-items { padding: 20rpx 10rpx 10rpx 20rpx; } } + /* + :nth-child(2n) 表示偶数项的商品元素 + 对偶数项的商品元素中的.prod-items 类设置相应的内边距样式 + */ &:nth-child(2n) { - .prod-items { + .prod-items { padding: 20rpx 20rpx 10rpx 10rpx; } } } +/* +.hot-imagecont 类下的.hotsaleimg 类用于设置商品图片本身的样式,使其宽度占满父元素,高度为345rpx +*/ .hot-imagecont { - .hotsaleimg { + .hotsaleimg { width: 100%; height: 345rpx; } } +/* +.hot-text 类下的.hotprod-text 类用于设置商品标题等主要文本的样式 +设置了高度、字体大小、文本的换行显示方式(超出2行显示省略号等)、文本颜色等样式 +*/ .hot-text { - .hotprod-text { + .hotprod-text { height: 76rpx; font-size: 28rpx; display: -webkit-box; @@ -61,6 +94,9 @@ prod { color: #000; } } +/* +.deadline-price 类用于设置特定价格相关文本的字体大小以及右边的外边距样式 +*/ .deadline-price { font-size: 22rpx; margin-right: 5rpx; diff --git a/front-end/mall4uni/src/components/production/production.vue b/front-end/mall4uni/src/components/production/production.vue index 849c8be..7ab21cf 100644 --- a/front-end/mall4uni/src/components/production/production.vue +++ b/front-end/mall4uni/src/components/production/production.vue @@ -1,39 +1,70 @@ diff --git a/front-end/mall4uni/src/main.js b/front-end/mall4uni/src/main.js index ebe9b26..055ca7e 100644 --- a/front-end/mall4uni/src/main.js +++ b/front-end/mall4uni/src/main.js @@ -1,9 +1,18 @@ import { - createSSRApp + createSSRApp // 从 Vue 库中导入 createSSRApp 函数,用于创建一个适用于服务器端渲染 (SSR) 的 Vue 应用实例 } from 'vue' -import App from './App.vue' -export function createApp () { +import App from './App.vue' // 导入应用的根组件 + +/** + * 创建并返回一个 Vue 应用实例 + * + * @returns {Object} - 包含应用实例的对象 + */ +export function createApp() { + // 使用 createSSRApp 函数创建一个新的 Vue 应用实例,并传入根组件 App const app = createSSRApp(App) + + // 返回一个对象,包含创建的应用实例 return { app } diff --git a/front-end/mall4uni/src/manifest.json b/front-end/mall4uni/src/manifest.json index 0d4e2ac..440924b 100644 --- a/front-end/mall4uni/src/manifest.json +++ b/front-end/mall4uni/src/manifest.json @@ -1,99 +1,106 @@ { - "name" : "", - "appid" : "__UNI__2CF44C6", - "description" : "", - "versionName" : "1.0.0", - "versionCode" : "100", - "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "compatible" : { - "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持 - }, - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - /* 模块配置 */ - "modules" : { - "Camera" : {}, - "LivePusher" : {} - }, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] - } - } + "name": "", // 应用名称,当前为空 + "appid": "__UNI__2CF44C6", // 应用的唯一标识符(AppID) + "description": "", // 应用描述,当前为空 + "versionName": "1.0.0", // 应用版本名称 + "versionCode": "100", // 应用版本号,用于内部版本控制 + "transformPx": false, // 是否将 px 单位转换为 rpx,false 表示不转换 + + /* 5+App特有相关 */ + "app-plus": { + "compatible": { + "ignoreVersion": true // true 表示忽略版本检查提示框,HBuilderX 1.9.0 及以上版本支持 }, - /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "wx6fa71e69231a4fa4", - "setting" : { - "urlCheck" : false - }, - "usingComponents" : true, - "permission" : { - "scope.userLocation" : { - "desc" : "你的位置信息将用于地址信息新增、修改以及获取附近门店" - } - }, - "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ] + "usingComponents": true, // 是否启用自定义组件,true 表示启用 + "nvueStyleCompiler": "uni-app", // 指定 nvue 样式编译器,使用 uni-app 编译器 + "compilerVersion": 3, // 编译器版本号 + + "splashscreen": { + "alwaysShowBeforeRender": true, // 启动页是否总是在渲染前显示,true 表示是 + "waiting": true, // 启动页是否显示等待动画,true 表示是 + "autoclose": true, // 启动页是否自动关闭,true 表示是 + "delay": 0 // 启动页延迟关闭的时间(毫秒),0 表示无延迟 }, - "h5" : { - "title" : "", - "domain" : "https://mini-h5.mall4j.com", - "router" : { - "mode" : "history" - }, - "uniStatistics" : { - "enable" : false - }, - "optimization" : { - "treeShaking" : { - "enable" : false - } - }, - "template" : "index.html", - "devServer" : { - "disableHostCheck" : true, - "port" : 80 - }, - "sdkConfigs" : { - "maps" : { - "qqmap" : { - // 用于h5端ip定位 - "key" : "" - } - } - } + + /* 模块配置 */ + "modules": { + "Camera": {}, // 配置 Camera 模块 + "LivePusher": {} // 配置 LivePusher 模块 + }, + + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "permissions": [ + "", // 使用相机功能 + "", // 使用自动对焦功能 + "", // 访问网络状态 + "", // 访问 Wi-Fi 状态 + "", // 使用相机权限 + "", // 更改网络状态 + "", // 更改 Wi-Fi 状态 + "", // 使用闪光灯 + "", // 获取账户信息 + "", // 挂载和卸载文件系统 + "", // 读取日志 + "", // 读取电话状态 + "", // 录音权限 + "", // 使用振动 + "", // 保持唤醒锁 + "" // 修改系统设置 + ], + "abiFilters": [ "armeabi-v7a", "arm64-v8a", "x86" ] // 支持的 ABI 架构 + } + } + }, + + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "wx6fa71e69231a4fa4", // 微信小程序的 AppID + "setting": { + "urlCheck": false // 是否开启 URL 安全检查,false 表示不开启 + }, + "usingComponents": true, // 是否启用自定义组件,true 表示启用 + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于地址信息新增、修改以及获取附近门店" // 位置权限说明 + } }, - "uniStatistics" : { - "enable" : false + "requiredPrivateInfos": [ "getLocation", "chooseLocation" ] // 必须申请的私有信息权限 + }, + + "h5": { + "title": "", // H5 页面标题,当前为空 + "domain": "https://mini-h5.mall4j.com", // H5 应用的域名 + "router": { + "mode": "history" // 路由模式,使用 history 模式 }, - "vueVersion" : "3" + "uniStatistics": { + "enable": false // 是否启用 Uni-App 统计,false 表示不启用 + }, + "optimization": { + "treeShaking": { + "enable": false // 是否启用 Tree Shaking 优化,false 表示不启用 + } + }, + "template": "index.html", // H5 应用的模板文件 + "devServer": { + "disableHostCheck": true, // 是否禁用主机检查,true 表示禁用 + "port": 80 // 开发服务器端口 + }, + "sdkConfigs": { + "maps": { + "qqmap": { + "key": "" // QQ 地图 API Key,用于 H5 端 IP 定位 + } + } + } + }, + + "uniStatistics": { + "enable": false // 是否启用 Uni-App 统计,false 表示不启用 + }, + + "vueVersion": "3" // 使用的 Vue 版本,当前为 Vue 3 } diff --git a/front-end/mall4uni/src/pages.json b/front-end/mall4uni/src/pages.json index 7a0fa2a..b8c99b9 100644 --- a/front-end/mall4uni/src/pages.json +++ b/front-end/mall4uni/src/pages.json @@ -1,196 +1,200 @@ { "pages": [ { - "path": "pages/index/index", + "path": "pages/index/index", // 首页路径 "style": { - "backgroundTextStyle": "dark", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black", - "enablePullDownRefresh": true, - "navigationBarTitleText": "mall4j" + "backgroundTextStyle": "dark", // 下拉刷新时背景文本颜色,"dark" 表示深色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTextStyle": "black", // 导航栏文字颜色,黑色 + "enablePullDownRefresh": true, // 是否启用下拉刷新功能,true 表示启用 + "navigationBarTitleText": "mall4j" // 导航栏标题文本 } }, { - "path": "pages/user/user", + "path": "pages/user/user", // 个人中心页面路径 "style": { - "navigationBarTitleText": "个人中心" + "navigationBarTitleText": "个人中心" // 导航栏标题文本 } }, { - "path": "pages/basket/basket", + "path": "pages/basket/basket", // 购物车页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "购物车", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "购物车", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/category/category", + "path": "pages/category/category", // 分类商品页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "分类商品", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "分类商品", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/sub-category/sub-category" + "path": "pages/sub-category/sub-category" // 子分类页面路径 }, { - "path": "pages/search-page/search-page", + "path": "pages/search-page/search-page", // 搜索页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "搜索", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "搜索", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/delivery-address/delivery-address", + "path": "pages/delivery-address/delivery-address", // 收货地址页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "收货地址", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "收货地址", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/editAddress/editAddress", + "path": "pages/editAddress/editAddress", // 编辑收货地址页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "编辑收货地址", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "编辑收货地址", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/orderList/orderList", + "path": "pages/orderList/orderList", // 订单列表页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarTitleText": "订单列表", - "navigationBarTextStyle": "black", - "navigationBarBackgroundColor": "#fafafa" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarTitleText": "订单列表", // 导航栏标题文本 + "navigationBarTextStyle": "black", // 导航栏文字颜色,黑色 + "navigationBarBackgroundColor": "#fafafa" // 导航栏背景颜色,浅灰色 } }, { - "path": "pages/order-detail/order-detail", + "path": "pages/order-detail/order-detail", // 订单详情页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "订单详情", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "订单详情", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/submit-order/submit-order", + "path": "pages/submit-order/submit-order", // 提交订单页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "提交订单", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "提交订单", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/express-delivery/express-delivery", + "path": "pages/express-delivery/express-delivery", // 物流查询页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "物流查询", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "物流查询", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/pay-result/pay-result", + "path": "pages/pay-result/pay-result", // 支付结果页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "支付结果", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "支付结果", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/search-prod-show/search-prod-show", + "path": "pages/search-prod-show/search-prod-show", // 搜索结果页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "搜索结果", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 导航栏背景颜色,白色 + "navigationBarTitleText": "搜索结果", // 导航栏标题文本 + "navigationBarTextStyle": "black" // 导航栏文字颜色,黑色 } }, { - "path": "pages/prod/prod", + "path": "pages/prod/prod", // 商品详情页面路径 "style": { - "navigationBarTitleText": "商品详情" + "navigationBarTitleText": "商品详情" // 导航栏标题文本 } }, { - "path": "pages/prod-classify/prod-classify", + "path": "pages/prod-classify/prod-classify", // 商品分类页面路径 "style": { - "onReachBottomDistance": 0 + "onReachBottomDistance": 0 // 触底加载距离,0 表示触底即触发 } }, { - "path": "pages/recent-news/recent-news", + "path": "pages/recent-news/recent-news", // 最新公告页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarTitleText": "最新公告", - "navigationBarTextStyle": "black", - "navigationBarBackgroundColor": "#fafafa" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarTitleText": "最新公告", // 导航栏标题文本 + "navigationBarTextStyle": "black", // 导航栏文字颜色,黑色 + "navigationBarBackgroundColor": "#fafafa" // 导航栏背景颜色,浅灰色 } }, { - "path": "pages/news-detail/news-detail", + "path": "pages/news-detail/news-detail", // 公告详情页面路径 "style": { - "backgroundTextStyle": "light", - "navigationBarTitleText": "最新公告", - "navigationBarTextStyle": "black", - "navigationBarBackgroundColor": "#fafafa" + "backgroundTextStyle": "light", // 下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarTitleText": "最新公告", // 导航栏标题文本 + "navigationBarTextStyle": "black", // 导航栏文字颜色,黑色 + "navigationBarBackgroundColor": "#fafafa" // 导航栏背景颜色,浅灰色 } }, { - "path": "pages/accountLogin/accountLogin" + "path": "pages/accountLogin/accountLogin" // 账号登录页面路径 }, { - "path": "pages/register/register" + "path": "pages/register/register" // 注册页面路径 } ], + "tabBar": { - "selectedColor": "#3a86b9", - "color": "#b8b8b8", + "selectedColor": "#3a86b9", // 选中项的颜色 + "color": "#b8b8b8", // 未选中项的颜色 "list": [ { - "pagePath": "pages/index/index", - "text": "首页", - "iconPath": "/static/images/tabbar/homepage.png", - "selectedIconPath": "/static/images/tabbar/homepage-sel.png" + "pagePath": "pages/index/index", // 首页路径 + "text": "首页", // 标签文本 + "iconPath": "/static/images/tabbar/homepage.png", // 未选中图标路径 + "selectedIconPath": "/static/images/tabbar/homepage-sel.png" // 选中图标路径 }, { - "pagePath": "pages/category/category", - "text": "分类", - "iconPath": "/static/images/tabbar/category.png", - "selectedIconPath": "/static/images/tabbar/category-sel.png" + "pagePath": "pages/category/category", // 分类页面路径 + "text": "分类", // 标签文本 + "iconPath": "/static/images/tabbar/category.png", // 未选中图标路径 + "selectedIconPath": "/static/images/tabbar/category-sel.png" // 选中图标路径 }, { - "pagePath": "pages/basket/basket", - "text": "购物车", - "iconPath": "/static/images/tabbar/basket.png", - "selectedIconPath": "/static/images/tabbar/basket-sel.png" + "pagePath": "pages/basket/basket", // 购物车页面路径 + "text": "购物车", // 标签文本 + "iconPath": "/static/images/tabbar/basket.png", // 未选中图标路径 + "selectedIconPath": "/static/images/tabbar/basket-sel.png" // 选中图标路径 }, { - "pagePath": "pages/user/user", - "text": "我的", - "iconPath": "/static/images/tabbar/user.png", - "selectedIconPath": "/static/images/tabbar/user-sel.png" + "pagePath": "pages/user/user", // 个人中心页面路径 + "text": "我的", // 标签文本 + "iconPath": "/static/images/tabbar/user.png", // 未选中图标路径 + "selectedIconPath": "/static/images/tabbar/user-sel.png" // 选中图标路径 } ] }, - "sitemapLocation": "sitemap.json", + + "sitemapLocation": "sitemap.json", // 站点地图文件位置 + "globalStyle": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "WeChat", - "navigationBarTextStyle": "black" + "backgroundTextStyle": "light", // 全局下拉刷新时背景文本颜色,"light" 表示浅色 + "navigationBarBackgroundColor": "#fff", // 全局导航栏背景颜色,白色 + "navigationBarTitleText": "WeChat", // 全局导航栏标题文本(默认值) + "navigationBarTextStyle": "black" // 全局导航栏文字颜色,黑色 }, - "subPackages": [] + + "subPackages": [] // 子包配置,当前为空 } diff --git a/front-end/mall4uni/src/pages/accountLogin/accountLogin.scss b/front-end/mall4uni/src/pages/accountLogin/accountLogin.scss index fdbdd26..311d11e 100644 --- a/front-end/mall4uni/src/pages/accountLogin/accountLogin.scss +++ b/front-end/mall4uni/src/pages/accountLogin/accountLogin.scss @@ -1,8 +1,18 @@ +/* +.con 类用于设置一个容器的样式,将背景颜色设置为白色,高度设为100%(通常是相对于父元素的高度占满), +并且距离顶部有50px的外边距,可用于页面中某个主要内容区域的整体样式设置 +*/ .con { background: #fff; height: 100%; margin-top: 50px; } + +/* +image 选择器用于设置页面中图片元素的样式,使其以块级元素显示(默认是行内元素,设置为块级方便布局等操作), +宽度和高度都设置为150rpx,在水平方向上自动居中(通过 margin: auto 实现),并且设置了圆角为50%使其呈现圆形外观, +同时在底部设置了8%的外边距,用于和下方元素保持一定的间距 +*/ image { display: block; width: 150rpx; @@ -13,11 +23,22 @@ image { height: 150rpx; margin-bottom: 8%; } + +/* +.login-form 类用于设置登录表单相关元素的样式,宽度占父元素的90%,并且在水平方向上自动居中(通过 margin: 0 auto 实现), +在底部设置了20%的外边距,用于和下方元素留出间隔,可用于包裹登录表单内的各种输入框、按钮等元素,使其整体布局合理 +*/ .login-form { width: 90%; margin: 0 auto; margin-bottom: 20%; } + +/* +authorized-btn 类用于设置授权按钮的样式,宽度占父元素的90%,在水平方向上自动居中,文本内容居中显示, +背景颜色设置为绿色(#0ab906),边框颜色和背景色一致且宽度为1rpx,文字颜色设为白色,设置了6rpx的圆角,字体大小为26rpx, +内部有一定的内边距(8rpx),并且在顶部设置了80rpx的外边距,用于和上方元素间隔开,重复定义的样式属性可能是为了强调或者方便后续修改调整 +*/ .authorized-btn { width: 90%; margin: 0 auto; @@ -35,6 +56,12 @@ image { padding: 8rpx; margin-top: 80rpx; } + +/* +to-idx-btn 类用于设置跳转到首页按钮(推测,根据命名)的样式,宽度占父元素的90%,水平自动居中,文本居中, +背景颜色设为灰色(#eeeeee),文字颜色为深灰色(#333),设置了6rpx的圆角,字体大小为26rpx,有8rpx的内边距, +在顶部设置了30rpx的外边距,同样存在重复定义的样式属性,作用与上述类似 +*/ .to-idx-btn { width: 90%; margin: 0 auto; @@ -50,6 +77,11 @@ image { padding: 8rpx; margin-top: 30rpx; } + +/* +form-title 类用于设置表单标题的样式,宽度占满父元素(100%),在底部设置了50rpx的外边距, +字体大小为32rpx,文本居中显示,颜色设置为蓝色(#00a0e9),重复定义的外边距和字体大小属性可能是误写或者便于后续调整 +*/ .form-title { width: 100%; margin-bottom: 50rpx; @@ -59,11 +91,22 @@ image { margin-bottom: 50rpx; font-size: 32rpx; } + +/* +.item 类用于设置某个元素的样式,使其以块级元素显示(方便布局等),在底部设置了30rpx的外边距, +可能用于表单内各个输入项等元素的基础样式设置,同样存在重复定义外边距属性的情况 +*/ .item { display: block; margin-bottom: 30rpx; margin-bottom: 30rpx; } + +/* +.account 类用于设置账号相关输入框等元素的样式,使其以弹性盒子布局显示(flex布局), +背景颜色设置为浅灰色(#f8f8f8),有15rpx的内边距,使用了盒模型为 border-box(保证内边距不会撑大元素尺寸),字体大小为26rpx, +并且在垂直方向上让内部元素居中对齐(通过 align-items: center 实现),内部还对 input 子元素设置了样式 +*/ .account { display: flex; background: #f8f8f8; @@ -71,28 +114,51 @@ image { box-sizing: border-box; font-size: 26rpx; align-items: center; + input { + /* + 给 input 元素设置左边的内边距为20rpx,宽度占父元素的75%,用于控制输入框内文本距离左边框的距离以及输入框自身的宽度占比 + */ padding-left: 20rpx; width: 75%; padding-left: 20rpx; } } + +/* +button 元素的 ::after 伪元素样式设置,将其边框设置为0,并且通过!important 提升优先级,确保该样式生效, +通常用于去除按钮点击等操作后默认生成的边框样式等情况 +*/ button { &::after { border: 0 !important; } } + +/* +operate 类用于设置某个操作相关元素的样式,使其以弹性盒子布局显示(flex布局), +并且通过 justify-content: space-between 让内部元素在水平方向上两端对齐,均匀分布,同时在垂直方向上居中对齐(通过 align-items: center 实现), +可用于操作按钮组等元素的布局设置 +*/ .operate { display: flex; justify-content: space-between; align-items: center; } +/* +to-register 类用于设置跳转到注册页面链接(推测,根据命名)的样式,字体大小为28rpx,文字颜色设置为蓝色(#00AAFF), +可用于引导用户进行注册操作相关的文本样式设置,同样存在重复定义字体大小属性的情况 +*/ .to-register { font-size: 28rpx; color: #00AAFF; font-size: 28rpx; } + +/* +.error 类用于设置错误提示相关元素的整体样式,内部有.error-text 类用于更具体的错误提示文本等样式设置 +*/ .error { .error-text { display: block; @@ -103,7 +169,13 @@ button { margin-top: 10rpx; font-size: 28rpx; margin-top: 10rpx; + .warning-icon { + /* + .warning-icon 类用于设置错误提示图标相关元素的样式,使其以行内块元素显示,颜色设为白色, + 宽度和高度都为26rpx,设置了行高为26rpx保证文本垂直居中,背景颜色为红色(#e43130),设置了50%的圆角使其呈现圆形外观, + 文本在水平方向上居中显示,在右边设置了12rpx的外边距,用于和旁边的错误提示文本间隔开,同样存在重复定义尺寸等属性的情况 + */ display: inline-block; color: #fff; width: 26rpx; diff --git a/front-end/mall4uni/src/pages/accountLogin/accountLogin.vue b/front-end/mall4uni/src/pages/accountLogin/accountLogin.vue index 4027267..5b266f8 100644 --- a/front-end/mall4uni/src/pages/accountLogin/accountLogin.vue +++ b/front-end/mall4uni/src/pages/accountLogin/accountLogin.vue @@ -1,172 +1,183 @@ - diff --git a/front-end/mall4uni/src/pages/basket/basket.scss b/front-end/mall4uni/src/pages/basket/basket.scss index ff73ece..1faa801 100644 --- a/front-end/mall4uni/src/pages/basket/basket.scss +++ b/front-end/mall4uni/src/pages/basket/basket.scss @@ -1,365 +1,391 @@ +/* 容器样式 */ .container { - width: 100%; - background: #f4f4f4; - min-height: calc(100vh - 118rpx); + width: 100%; /* 设置容器宽度为100% */ + background: #f4f4f4; /* 设置背景颜色 */ + min-height: calc(100vh - 118rpx); /* 设置最小高度为视窗高度减去底部导航栏高度 */ } + +/* 产品列表样式 */ .prod-list { - padding-bottom: 118rpx; - width: 100%; + padding-bottom: 118rpx; /* 底部填充以防止内容被固定底部遮挡 */ + width: 100%; /* 设置宽度为100% */ + /* 单个产品块样式 */ .prod-block { - background: #fff; - margin-top: 15rpx; + background: #fff; /* 背景颜色 */ + margin-top: 15rpx; /* 上边距 */ + /* 折扣提示样式 */ .discount-tips { - padding: 20rpx 0 20rpx 20rpx; - border-bottom: 2rpx solid #f4f4f4; - height: 40rpx; - line-height: 40rpx; + padding: 20rpx 0 20rpx 20rpx; /* 内边距 */ + border-bottom: 2rpx solid #f4f4f4; /* 下边框 */ + height: 40rpx; /* 高度 */ + line-height: 40rpx; /* 行高 */ + /* 文字块样式 */ .text-block { - padding: 3rpx 5rpx; - border-radius: 8rpx; - font-size: 22rpx; - color: #eb2444; - border: 2rpx solid #eb2444; + padding: 3rpx 5rpx; /* 内边距 */ + border-radius: 8rpx; /* 圆角 */ + font-size: 22rpx; /* 字体大小 */ + color: #eb2444; /* 文字颜色 */ + border: 2rpx solid #eb2444; /* 边框 */ } + /* 文字列表样式 */ .text-list { - font-size: 24rpx; - margin-left: 10rpx; + font-size: 24rpx; /* 字体大小 */ + margin-left: 10rpx; /* 左边距 */ } } } + /* 产品项样式 */ .item { - background: #fff; - display: flex; - align-items: center; - padding: 20rpx; + background: #fff; /* 背景颜色 */ + display: flex; /* 使用弹性布局 */ + align-items: center; /* 垂直居中对齐 */ + padding: 20rpx; /* 内边距 */ + /* 产品信息样式 */ .prodinfo { - position: relative; - color: #999; - width: 100%; + position: relative; /* 相对定位 */ + color: #999; /* 文字颜色 */ + width: 100%; /* 宽度 */ + /* 底线伪元素 */ &::after { - content: ''; - background-color: #f4f4f4; - left: 0; - height: 1px; - transform-origin: 50% 100% 0; - bottom: -20rpx; - position: absolute; - display: block; - width: 642rpx; - padding-left: 20rpx; + content: ''; /* 伪元素内容为空 */ + background-color: #f4f4f4; /* 背景颜色 */ + left: 0; /* 左偏移 */ + height: 1px; /* 高度 */ + transform-origin: 50% 100% 0; /* 变换原点 */ + bottom: -20rpx; /* 底部偏移 */ + position: absolute; /* 绝对定位 */ + display: block; /* 显示为块级元素 */ + width: 642rpx; /* 宽度 */ + padding-left: 20rpx; /* 左内边距 */ } - .pic { - text-align: center; - width: 180rpx; - height: 180rpx; - line-height: 180rpx; - font-size: 0; - } - } - &:last-child { - .prodinfo { + /* 最后一个子元素去除底线 */ + &:last-child { &::after { - height: 0; + height: 0; /* 高度设为0 */ } } + /* 图片容器 */ + .pic { + text-align: center; /* 文本居中 */ + width: 180rpx; /* 宽度 */ + height: 180rpx; /* 高度 */ + line-height: 180rpx; /* 行高 */ + font-size: 0; /* 字体大小 */ + } } + /* 状态样式 */ .staus { - text-align: center; - background: rgb(196, 192, 192); - font-size: 20rpx; - width: 50rpx; - color: #fff; + text-align: center; /* 文本居中 */ + background: rgb(196, 192, 192); /* 背景颜色 */ + font-size: 20rpx; /* 字体大小 */ + width: 50rpx; /* 宽度 */ + color: #fff; /* 文字颜色 */ } + /* 操作选项样式 */ .opt { - font-size: 28rpx; - margin-left: 20rpx; - width: 100%; + font-size: 28rpx; /* 字体大小 */ + margin-left: 20rpx; /* 左边距 */ + width: 100%; /* 宽度 */ } + /* 图片样式 */ .pic { image { - max-width: 100%; - max-height: 100%; - vertical-align: middle; + max-width: 100%; /* 最大宽度 */ + max-height: 100%; /* 最大高度 */ + vertical-align: middle; /* 垂直对齐 */ } } } + /* 失效产品样式 */ .lose-efficacy { .discount-tips { - padding: 20rpx 0; - border-bottom: 2rpx solid #ddd; - height: 50rpx; - line-height: 50rpx; - margin-left: 20rpx; + padding: 20rpx 0; /* 内边距 */ + border-bottom: 2rpx solid #ddd; /* 下边框 */ + height: 50rpx; /* 高度 */ + line-height: 50rpx; /* 行高 */ + margin-left: 20rpx; /* 左边距 */ + /* 文字列表样式 */ .text-list { - font-size: 30rpx; - margin-left: 10rpx; + font-size: 30rpx; /* 字体大小 */ + margin-left: 10rpx; /* 左边距 */ } } } } + +/* 产品信息样式 */ .prodinfo { - display: flex; - margin-left: 20rpx; + display: flex; /* 使用弹性布局 */ + margin-left: 20rpx; /* 左边距 */ + /* 操作选项样式 */ .opt { .prod-name { - color: #333; - max-height: 72rpx; - line-height: 36rpx; - display: -webkit-box; - word-break: break-all; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; + color: #333; /* 文字颜色 */ + max-height: 72rpx; /* 最大高度 */ + line-height: 36rpx; /* 行高 */ + display: -webkit-box; /* WebKit行盒模型 */ + word-break: break-all; /* 允许单词内断行 */ + overflow: hidden; /* 隐藏溢出内容 */ + text-overflow: ellipsis; /* 溢出用省略号表示 */ + -webkit-line-clamp: 2; /* 限制行数 */ + -webkit-box-orient: vertical; /* 竖向排列 */ } + /* 产品信息文本样式 */ .prod-info-text { - color: #999; - display: inline-block; - -webkit-line-clamp: 1; - height: 48rpx; - line-height: 48rpx; - background: #f9f9f9; - padding: 0 10rpx 0 10rpx; - border-radius: 4rpx; - margin: 10rpx 0 0rpx 0; - overflow: hidden; - font-size: 24rpx; - position: relative; - font-family: arial; + color: #999; /* 文字颜色 */ + display: inline-block; /* 显示为行内块 */ + -webkit-line-clamp: 1; /* 限制行数 */ + height: 48rpx; /* 高度 */ + line-height: 48rpx; /* 行高 */ + background: #f9f9f9; /* 背景颜色 */ + padding: 0 10rpx; /* 内边距 */ + border-radius: 4rpx; /* 圆角 */ + margin: 10rpx 0 0rpx 0; /* 外边距 */ + overflow: hidden; /* 隐藏溢出内容 */ + font-size: 24rpx; /* 字体大小 */ + position: relative; /* 相对定位 */ + font-family: arial; /* 字体系列 */ } + /* 空的产品信息文本样式 */ .prod-info-text.empty-n { - padding: 0; + padding: 0; /* 内边距 */ } + /* 价格和数量样式 */ .price-count { - display: flex; - align-items: center; - justify-content: space-between; + display: flex; /* 使用弹性布局 */ + align-items: center; /* 垂直居中对齐 */ + justify-content: space-between; /* 两端对齐 */ + /* 价格样式 */ .price { - color: #eb2444; + color: #eb2444; /* 文字颜色 */ } } } } + +/* 产品信息文本伪元素样式 */ .prod-info-text { &:before { - border-top: 5px solid #aaa; + border-top: 5px solid #aaa; /* 上边框 */ } + &:after { - border-top: 5px solid #f9f9f9; - top: 9px; + border-top: 5px solid #f9f9f9; /* 上边框 */ + top: 9px; /* 顶部偏移 */ } } + +/* 失效产品样式 */ .lose-efficacy { .prodinfo { .opt { .price-count { .price { - color: #999; + color: #999; /* 文字颜色 */ } } } } - margin-top: 20rpx; - background: #fff; + + margin-top: 20rpx; /* 上边距 */ + background: #fff; /* 背景颜色 */ + /* 产品项样式 */ .item { - background: #f8f8f9; + background: #f8f8f9; /* 背景颜色 */ } + /* 折扣提示样式 */ .discount-tips { .empty-prod { - color: #777; - font-size: 26rpx; - border: 2rpx solid #999; - padding: 0 10rpx; - border-radius: 8rpx; - float: right; - margin-right: 20rpx; + color: #777; /* 文字颜色 */ + font-size: 26rpx; /* 字体大小 */ + border: 2rpx solid #999; /* 边框 */ + padding: 0 10rpx; /* 内边距 */ + border-radius: 8rpx; /* 圆角 */ + float: right; /* 向右浮动 */ + margin-right: 20rpx; /* 右边距 */ } } } + +/* 数量选择器样式 */ .m-numSelector { - .minus { - float: left; - box-sizing: border-box; - height: 56rpx; - border: 2rpx solid #d9d9d9; - position: relative; - width: 56rpx; - border-right: 0; - border-top-left-radius: 4rpx; - border-bottom-left-radius: 4rpx; - &::before { - position: absolute; + .minus, + .plus { + float: left; /* 向左浮动 */ + box-sizing: border-box; /* 盒模型 */ + height: 56rpx; /* 高度 */ + border: 2rpx solid #d9d9d9; /* 边框 */ + position: relative; /* 相对定位 */ + width: 56rpx; /* 宽度 */ + &::before, + &::after { + position: absolute; /* 绝对定位 */ top: 0; left: 0; right: 0; bottom: 0; - margin: auto; - content: ' '; - width: 22rpx; - height: 3rpx; - background-color: #7f7f7f; + margin: auto; /* 自动外边距 */ + content: ' '; /* 伪元素内容为空 */ + width: 22rpx; /* 宽度 */ + height: 3rpx; /* 高度 */ + background-color: #7f7f7f; /* 背景颜色 */ } } + /* 减号按钮样式 */ + .minus { + border-right: 0; /* 右边框 */ + border-top-left-radius: 4rpx; /* 左上圆角 */ + border-bottom-left-radius: 4rpx; /* 左下圆角 */ + } + /* 输入框样式 */ input { - float: left; - box-sizing: border-box; - height: 56rpx; - border: 2rpx solid #d9d9d9; - width: 56rpx; - text-align: center; - color: #333; + float: left; /* 向左浮动 */ + box-sizing: border-box; /* 盒模型 */ + height: 56rpx; /* 高度 */ + border: 2rpx solid #d9d9d9; /* 边框 */ + width: 56rpx; /* 宽度 */ + text-align: center; /* 文本居中 */ + color: #333; /* 文字颜色 */ } + /* 加号按钮样式 */ .plus { - float: left; - box-sizing: border-box; - height: 56rpx; - border: 2rpx solid #d9d9d9; - position: relative; - width: 56rpx; - border-left: 0; - border-top-right-radius: 4rpx; - border-bottom-right-radius: 4rpx; - &::before { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - margin: auto; - content: ' '; - width: 22rpx; - height: 3rpx; - background-color: #7f7f7f; - } + border-left: 0; /* 左边框 */ + border-top-right-radius: 4rpx; /* 右上圆角 */ + border-bottom-right-radius: 4rpx; /* 右下圆角 */ &::after { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - margin: auto; - content: ' '; - width: 22rpx; - height: 3rpx; - background-color: #7f7f7f; - transform: rotate(90deg); + transform: rotate(90deg); /* 旋转90度 */ } } - float: right; + + float: right; /* 向右浮动 */ + /* 非禁用状态下的交互样式 */ &:not(.disabled) { - .minus { - &:not(.disabled) { - &:active { - background-color: #f4f4f4; - } - } - } + .minus, .plus { &:not(.disabled) { &:active { - background-color: #f4f4f4; + background-color: #f4f4f4; /* 激活时背景颜色 */ } } } } } + +/* 深层选择器用于复选框样式 */ :deep(checkbox) { .uni-checkbox-input, .wx-checkbox-input { - border-radius: 50%; - width: 35rpx; - height: 35rpx; + border-radius: 50%; /* 圆形 */ + width: 35rpx; /* 宽度 */ + height: 35rpx; /* 高度 */ } + /* 选中状态下的复选框样式 */ .wx-checkbox-input.wx-checkbox-input-checked { - background: #eb2444; - border-color: #eb2444; + background: #eb2444; /* 背景颜色 */ + border-color: #eb2444; /* 边框颜色 */ &::before { - text-align: center; - font-size: 22rpx; - color: #fff; - background: transparent; - transform: translate(-50%, -50%) scale(1); - -webkit-transform: translate(-50%, -50%) scale(1); + text-align: center; /* 文本居中 */ + font-size: 22rpx; /* 字体大小 */ + color: #fff; /* 文字颜色 */ + background: transparent; /* 透明背景 */ + transform: translate(-50%, -50%) scale(1); /* 居中缩放 */ + -webkit-transform: translate(-50%, -50%) scale(1); /* WebKit浏览器居中缩放 */ } } } + +/* 空状态样式 */ .empty { - font-size: 26rpx; - color: #aaa; - padding-top: 200rpx; + font-size: 26rpx; /* 字体大小 */ + color: #aaa; /* 文字颜色 */ + padding-top: 200rpx; /* 上内边距 */ + /* 文字样式 */ .txt { - text-align: center; - margin-top: 30rpx; + text-align: center; /* 文本居中 */ + margin-top: 30rpx; /* 上边距 */ } + /* 图片样式 */ .img { - margin-top: 80rpx; - text-align: center; + margin-top: 80rpx; /* 上边距 */ + text-align: center; /* 文本居中 */ image { - width: 80rpx; - height: 80rpx; + width: 80rpx; /* 宽度 */ + height: 80rpx; /* 高度 */ } } } + +/* 价格和数量样式 */ .price-count { .disable-price { - color: #999; + color: #999; /* 文字颜色 */ } } + +/* 购物车底部栏样式 */ .cart-footer { - position: fixed; - bottom: calc(90rpx + env(safe-area-inset-bottom)); - left: 0; - width: 100%; - display: flex; - flex-direction: row nowrap; - height: 98rpx; - border-top: 2rpx solid #f4f4f4; - z-index: 999; + position: fixed; /* 固定定位 */ + bottom: calc(90rpx + env(safe-area-inset-bottom)); /* 底部距离 */ + left: 0; /* 左偏移 */ + width: 100%; /* 宽度 */ + display: flex; /* 使用弹性布局 */ + flex-direction: row nowrap; /* 行内不换行 */ + height: 98rpx; /* 高度 */ + border-top: 2rpx solid #f4f4f4; /* 上边框 */ + z-index: 999; /* 层叠顺序 */ + /* 按钮样式 */ .btn { - position: relative; - display: flex; - flex-grow: 1; - justify-content: center; - align-items: center; - width: 0; - background-color: #fafafa; - background: rgba(255,255,255,0.95); - font-size: 28rpx; + position: relative; /* 相对定位 */ + display: flex; /* 使用弹性布局 */ + flex-grow: 1; /* 弹性增长 */ + justify-content: center; /* 水平居中 */ + align-items: center; /* 垂直居中 */ + width: 0; /* 宽度 */ + background-color: #fafafa; /* 背景颜色 */ + background: rgba(255,255,255,0.95); /* 半透明背景 */ + font-size: 28rpx; /* 字体大小 */ + /* 总金额消息样式 */ .total-msg { - font-size: 20rpx; + font-size: 20rpx; /* 字体大小 */ } } + /* 总价按钮样式 */ .btn.total { - display: flex; - flex-flow: column; - align-items: flex-start; - width: 300rpx; + display: flex; /* 使用弹性布局 */ + flex-flow: column; /* 列方向 */ + align-items: flex-start; /* 左对齐 */ + width: 300rpx; /* 宽度 */ + /* 价格样式 */ .price { - color: #eb2444; - font-size: 30rpx; + color: #eb2444; /* 文字颜色 */ + font-size: 30rpx; /* 字体大小 */ } } + /* 删除按钮样式 */ .btn.del { - color: #eb2444; - width: 70rpx; - font-size: 22rpx; - text-align: left; - display: block; - line-height: 102rpx; + color: #eb2444; /* 文字颜色 */ + width: 70rpx; /* 宽度 */ + font-size: 22rpx; /* 字体大小 */ + text-align: left; /* 文本左对齐 */ + display: block; /* 显示为块级元素 */ + line-height: 102rpx; /* 行高 */ } + /* 全选按钮样式 */ .btn.all { - width: 150rpx; - font-size: 26rpx; + width: 150rpx; /* 宽度 */ + font-size: 26rpx; /* 字体大小 */ + /* 标签样式 */ label { - display: flex; - flex-grow: 1; - justify-content: center; - align-items: center; + display: flex; /* 使用弹性布局 */ + flex-grow: 1; /* 弹性增长 */ + justify-content: center; /* 水平居中 */ + align-items: center; /* 垂直居中 */ } } + /* 结算按钮样式 */ .btn.settle { - width: 200rpx; - background: #eb2444; - color: #fff; + width: 200rpx; /* 宽度 */ + background: #eb2444; /* 背景颜色 */ + color: #fff; /* 文字颜色 */ } } diff --git a/front-end/mall4uni/src/pages/basket/basket.vue b/front-end/mall4uni/src/pages/basket/basket.vue index b9b9d2a..8f8c029 100644 --- a/front-end/mall4uni/src/pages/basket/basket.vue +++ b/front-end/mall4uni/src/pages/basket/basket.vue @@ -1,82 +1,86 @@ + diff --git a/front-end/mall4uni/src/pages/delivery-address/delivery-address.scss b/front-end/mall4uni/src/pages/delivery-address/delivery-address.scss index a6e8325..faa9144 100644 --- a/front-end/mall4uni/src/pages/delivery-address/delivery-address.scss +++ b/front-end/mall4uni/src/pages/delivery-address/delivery-address.scss @@ -1,30 +1,53 @@ +/* +.container 类用于设置页面整体容器的样式。 +设置了背景颜色为浅灰色(#f4f4f4),顶部添加了一条 2rpx 宽的灰色边框(#e9eaec),并且设置最小高度为视口高度(100vh),确保页面在内容较少时也能占满整个屏幕高度。 +*/ .container { background-color: #f4f4f4; border-top: 2rpx solid #e9eaec; min-height: 100vh; } + +/* +.main 类用于页面主体部分的样式设置。 +设置了顶部外边距为 20rpx,底部内边距为 150rpx,通过这两个属性来调整主体内容在页面中的位置以及预留底部空间(可能用于放置其他固定在底部的元素等情况)。 +*/ .main { margin-top: 20rpx; padding-bottom: 150rpx; } + +/* +.address 类用于地址相关区域的整体样式设置,该区域宽度占满父元素(100%),背景颜色为白色(#fff),底部有一条 2rpx 宽的灰色边框(#e9eaec),并且设置了底部外边距为 15rpx,用于与下方元素隔开一定距离。 +其内部还有多个子元素的样式设置,用于更细致地布局和展示地址相关信息。 +*/ .address { margin-bottom: 15rpx; width: 100%; background-color: #fff; border-bottom: 2rpx solid #e9eaec; + /* +.personal 类是 address 内部用于个人信息相关部分的样式设置,设置了相对定位,方便内部的一些元素基于该元素进行定位,同时设置了上下和左右的内边距,并且底部添加了一条 3rpx 宽的虚线边框(#e9eaec),用于视觉上区分不同部分的信息。 + 其内部还有更细化的子元素样式设置。 + */ .personal { position: relative; padding: 20rpx 30rpx; border-bottom: 3rpx dashed #e9eaec; + /* + .info-tit 类用于个人信息标题部分的样式设置,内部包含姓名(.name)、电话(.tel)等信息以及一个图片元素的样式设置,用于展示相关图标等情况,通过不同的样式属性来控制它们的布局、字体大小、显示方式等。 + */ .info-tit { .name { margin-right: 30rpx; font-size: 32rpx; display: inline-block; } + .tel { font-size: 30rpx; } + image { position: absolute; right: 30rpx; @@ -36,21 +59,31 @@ } } } + /* +.select-btn 类用于地址选择按钮相关部分的样式设置,设置了上下和左右的内边距,通过弹性盒子布局(display: flex),使其内部子元素能方便地实现水平对齐(align-items: center)以及两端对齐(justify-content: space-between),一般用于放置如选择、编辑等按钮之类的元素,并且对内部的文本元素(.box)设置了字体大小。 + */ .select-btn { padding: 15rpx 30rpx; display: flex; align-items: center; justify-content: space-between; + .box { font-size: 26rpx; } } } + +/* +.personal 类下的.addr 类用于地址详细内容部分的样式设置,设置了字体大小以及上下外边距,其中顶部外边距相对大一些(20rpx),用于调整与上方元素的间距,并且内部的.addr-get 类用于具体地址文本的样式设置,设置为行内块元素(display: inline-block),文字颜色为灰色(#999),宽度占满父元素(100%),并设置了文本换行方式(word-break: break-word),确保长地址文本能正确换行显示。 +这里出现了两次.personal 类,可能在 HTML 结构中有不同的嵌套层级对应不同的样式应用场景,具体要结合 HTML 来看。 +*/ .personal { .addr { font-size: 26rpx; margin: 10rpx 0; margin-top: 20rpx; + .addr-get { display: inline-block; color: #999; @@ -59,6 +92,10 @@ } } } + +/* +.footer 类用于页面底部固定栏的样式设置,设置为固定定位(position: fixed),使其固定在页面底部(bottom: 0),宽度占满父元素(100%),高度为 100rpx,并且设置了行高与高度相等,使内部文本垂直居中,文本对齐方式为居中对齐(text-align: center),背景颜色为白色(#fff),添加了一个淡淡的阴影效果,用于在视觉上与页面主体区分开,内部文本元素(text)设置了字体大小和颜色(红色,#eb2444)。 +*/ .footer { position: fixed; bottom: 0; @@ -68,15 +105,24 @@ text-align: center; background-color: #fff; box-shadow: 0 -1rpx 8rpx rgba(0, 0, 0, 0.05); + text { font-size: 32rpx; color: #eb2444; } } + +/* +.empty 类用于当某个区域内容为空时的整体样式设置,内部包含图片(.img)和文本(.txt)两部分的样式设置,用于展示提示信息,告知用户该区域暂无内容等情况。 +*/ .empty { + /* +.img 类用于空内容提示区域中图片部分的样式设置,设置文本对齐方式为居中对齐,顶部外边距为 130rpx,使图片在垂直方向上处于合适位置,内部的图片元素(image)设置了宽度、高度以及显示方式(display: block 和 margin: auto),确保图片能在该区域内水平居中显示。 + */ .img { text-align: center; margin-top: 130rpx; + image { width: 100rpx; height: 100rpx; @@ -84,6 +130,9 @@ margin: auto; } } + /* +.txt 类用于空内容提示区域中文本部分的样式设置,设置了顶部外边距为 30rpx,字体大小以及文本对齐方式为居中对齐,文字颜色为灰色(#999),用于展示相应的提示文字内容。 + */ .txt { margin-top: 30rpx; font-size: 24rpx; diff --git a/front-end/mall4uni/src/pages/delivery-address/delivery-address.vue b/front-end/mall4uni/src/pages/delivery-address/delivery-address.vue index c32b68b..bad0035 100644 --- a/front-end/mall4uni/src/pages/delivery-address/delivery-address.vue +++ b/front-end/mall4uni/src/pages/delivery-address/delivery-address.vue @@ -1,59 +1,63 @@ diff --git a/front-end/mall4uni/src/pages/editAddress/editAddress.scss b/front-end/mall4uni/src/pages/editAddress/editAddress.scss index b8e9ee5..936f2b0 100644 --- a/front-end/mall4uni/src/pages/editAddress/editAddress.scss +++ b/front-end/mall4uni/src/pages/editAddress/editAddress.scss @@ -1,10 +1,22 @@ +/* +.container 类用于设置页面整体容器的背景颜色为白色(#fff),可能作为页面内容的基础背景样式。 +*/ .container { background: #fff; } + +/* +.input-box 类用于设置输入框相关区域的样式,设置了底部外边距为 50rpx,背景颜色同样为白色(#fff),并且添加了左右内边距为 20rpx,用于调整内部元素的布局空间。 +其内部还有一个.section 类用于更细致地设置每一个输入项相关部分的样式。 +*/ .input-box { margin-bottom: 50rpx; background: #fff; padding: 0 20rpx; + /* + .section 类用于输入项部分的样式设置,将内部元素设置为弹性盒子布局(display: flex),使其子元素能方便地实现水平对齐(align-items: center),宽度占满父元素(100%),设置了字体大小、上下内边距、行高以及盒子模型属性(box-sizing),并且底部添加了一条 2rpx 宽的灰色边框(#e5e5e5),用于视觉上区分不同的输入项。 + 内部还有针对不同类型输入元素(text、input、picker、.pca、.arrow 等)的具体样式设置。 + */ .section { display: flex; align-items: center; @@ -15,26 +27,42 @@ height: 100%; box-sizing: border-box; border-bottom: 2rpx solid #e5e5e5; + /* + text 类用于输入项的文本标签部分的样式设置,设置宽度占父元素的 20%,文字颜色为深灰色(#333),用于显示如“姓名”“手机号”等输入项的提示文字。 + */ text { width: 20%; color: #333; } + /* + input 类用于普通文本输入框的样式设置,设置宽度占父元素的 70%,添加了左右内边距为 20rpx,文字颜色为深灰色(#333),用于用户输入具体的文本内容,如输入地址、电话号码等信息。 + */ input { width: 70%; padding: 0 20rpx; color: #333; } + /* + picker 类用于选择器组件(如日期选择器、下拉选择器等)的样式设置,设置宽度占父元素的 70%,添加了左右内边距为 30rpx,用于控制选择器在页面中的显示宽度和内部元素的布局空间。 + */ picker { width: 70%; padding: 0 30rpx; } + /* + .pca 类同样用于某种选择器相关元素的样式设置(从类名推测可能和地址选择等相关,具体要结合实际应用场景),设置宽度占父元素的 70%,添加了左右内边距为 20rpx,用于调整其在页面中的布局空间。 + */ .pca { width: 70%; padding: 0 20rpx; } + /* + .arrow 类用于输入项旁边的箭头图标相关的样式设置,设置了宽度和高度均为 28rpx,内部的图片元素(image)设置为宽度和高度都占满父元素(100%),并且垂直对齐方式为顶部对齐(vertical-align: top),这个箭头图标可能用于提示用户可点击展开选择器等操作。 + */ .arrow { width: 28rpx; height: 28rpx; + image { width: 100%; height: 100%; @@ -43,14 +71,23 @@ } } } + +/* +.btn-box 类用于按钮区域的整体样式设置,设置了上下内边距(5px 和 10px),宽度占满父元素(100%),文本对齐方式为居中对齐,并且通过 margin: auto 使其在父元素中水平居中。 +内部还有针对不同按钮样式的进一步设置,如.clear.btn、.keep 等类。 +*/ .btn-box { padding: 5px 10px; width: 100%; text-align: center; margin: auto; + text { font-size: 30rpx; } + /* + .clear.btn 类用于“清除”之类功能的按钮样式设置,设置了宽度占父元素的 60%,高度为 80rpx,通过 line-height 使内部文本垂直居中,在父元素中水平居中(margin: auto),设置了边框样式(颜色、粗细、圆角等)、阴影效果以及文字颜色(#eb2444)和半透明的背景颜色(#f8f0f1b6),用于在视觉上突出按钮并与其他按钮区分开,同时显示出其特定的功能属性(如清除操作相关按钮)。 + */ .clear.btn { width: 60%; height: 80rpx; @@ -64,11 +101,18 @@ color: #eb2444; background-color: #f8f0f1b6; } + /* + .keep 类用于特定功能(可能是保存、确认等操作)的按钮样式设置,主要设置了文字颜色为白色(#fff),背景颜色为红色(#eb2444),用于在视觉上突出该按钮的重要性和操作功能,后续应该还有对应的.keep.btn 类结合使用来进一步完善按钮的具体样式细节(如尺寸、边框等)。 + */ .keep { color: #fff; background-color: #eb2444; } } + +/* +.keep.btn 类进一步细化了.keep 类对应的按钮的样式,设置了宽度占父元素的 60%,高度为 80rpx,通过 line-height 使内部文本垂直居中,在父元素中水平居中(margin: auto),设置了边框样式(颜色、粗细、圆角等)以及阴影效果,用于完整呈现按钮的外观样式,使其在页面中能有一个统一且符合设计要求的显示效果,方便用户识别和操作。 +*/ .keep.btn { width: 60%; height: 80rpx; @@ -79,12 +123,20 @@ border-radius: 50rpx; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(255, 255, 255, 0.3); } + +/* +.infoText 类用于展示提示信息文本的样式设置,设置了顶部外边距为 20rpx,文本对齐方式为居中对齐,宽度占满父元素(100%),并且设置了水平方向上的对齐方式为居中(justify-content: center,虽然这里对文本元素使用 flex 相关属性有点不太常规,但可能在特定的 HTML 结构中有其应用场景),用于在页面中合适的位置展示如操作提示、说明文字等信息。 +*/ .infoText { margin-top: 20rpx; text-align: center; width: 100%; justify-content: center; } + +/* +picker-view 类用于选择器视图组件(如弹出式的日期选择器、多级联动选择器等的整体视图样式设置),设置了背景颜色为白色(white),去除了内边距(padding: 0),宽度占满父元素(100%),高度为 380rpx,设置为固定定位(position: fixed)使其固定在页面底部(bottom: 0),并且内部的文本元素(text)设置了相关的样式,如文字颜色为灰色(#999)、显示方式(inline-flex)、位置(通过固定定位设置在特定位置)、高度、文本对齐方式、行高以及字体相关属性等,用于控制选择器内部文本的显示效果。 +*/ picker-view { background-color: white; padding: 0; @@ -92,6 +144,7 @@ picker-view { height: 380rpx; bottom: 0; position: fixed; + text { color: #999; display: inline-flex; @@ -104,6 +157,10 @@ picker-view { font-family: Arial, Helvetica, sans-serif; } } + +/* +picker-view-column 类用于选择器视图组件中的每一列的样式设置,内部的 view 元素设置了垂直对齐方式为中间对齐(vertical-align: middle),字体大小、行高以及高度占满父元素(100%),通过弹性盒子布局使其内部元素能在垂直和水平方向上方便地居中对齐(display: flex,align-items: center,justify-content: center),用于控制选择器每一列中选项的显示样式和布局方式。 +*/ picker-view-column { view { vertical-align: middle; @@ -115,6 +172,10 @@ picker-view-column { justify-content: center; } } + +/* +.animation-element-wrapper 类用于创建一个覆盖整个页面的半透明背景元素的样式设置,将其设置为弹性盒子布局(display: flex),通过固定定位(position: fixed)使其覆盖整个页面(left: 0,top: 0,width: 100%,height: 100%),设置了背景颜色为半透明黑色(rgba(0, 0, 0, 0.6)),层级(z-index)设置为较高的 999,一般用于作为弹出层、动画效果等的背景遮罩,增强视觉效果和用户交互体验。 +*/ .animation-element-wrapper { display: flex; position: fixed; @@ -125,6 +186,10 @@ picker-view-column { background-color: rgba(0, 0, 0, 0.6); z-index: 999; } + +/* +.animation-element 类用于动画元素(可能是弹出的对话框、菜单等有动画效果的组件)的样式设置,同样设置为固定定位,宽度占满父元素(100%),高度为 470rpx,使其固定在页面底部(bottom: 0),背景颜色为白色(#fff),用于定义这个动画元素的基本外观和在页面中的位置布局,后续可能通过 JavaScript 等添加动画效果来实现一些动态展示的功能。 +*/ .animation-element { display: flex; position: fixed; @@ -133,21 +198,37 @@ picker-view-column { bottom: 0; background-color: rgba(255, 255, 255, 1); } + +/* +.animation-button 类用于动画元素中的按钮的通用样式设置,设置了顶部外边距为 20rpx,宽度为 290rpx,高度为 100rpx,并且设置了子元素在垂直方向上的对齐方式为居中对齐(align-items: center),用于为按钮提供一个基本的布局样式框架,后续通过更具体的类(如.left-bt、.right-bt 等)来进一步调整按钮在水平方向上的位置等细节样式。 +*/ .animation-button { top: 20rpx; width: 290rpx; height: 100rpx; align-items: center; } + +/* +.left-bt 类用于将按钮定位在左边的样式设置,通过设置 left 属性为 30rpx,使其相对于父元素(可能是.animation-element 之类的包含它的元素)向左偏移一定距离,一般用于多个按钮排列时,将某个按钮放置在左边位置,结合其他按钮的定位样式实现合适的布局效果。 +*/ .left-bt { left: 30rpx; } + +/* +.right-bt 类用于将按钮定位在右边的样式设置,通过设置 right 属性为 20rpx 以及 top 属性为 20rpx,使其相对于父元素定位在右上角位置(通过绝对定位实现,position: absolute),并且设置了宽度为 80rpx,并且添加了!important 声明来提高该样式的优先级(可能存在样式冲突时确保该宽度设置生效),用于在页面布局中精确控制按钮的位置和尺寸,实现特定的交互界面设计要求。 +*/ .right-bt { right: 20rpx; top: 20rpx; position: absolute; width: 80rpx !important; } + +/* +.line 类用于绘制一条水平分割线的样式设置,设置为块级元素(display: block),通过固定定位使其固定在页面中的特定位置(这里是距离顶部 89rpx 的位置),设置了高度为 2rpx,宽度占满父元素(100%),背景颜色为浅灰色(#eee),一般用于在页面中视觉上区分不同的区域或者内容部分。 +*/ .line { display: block; position: fixed; diff --git a/front-end/mall4uni/src/pages/editAddress/editAddress.vue b/front-end/mall4uni/src/pages/editAddress/editAddress.vue index 8875137..9554315 100644 --- a/front-end/mall4uni/src/pages/editAddress/editAddress.vue +++ b/front-end/mall4uni/src/pages/editAddress/editAddress.vue @@ -1,82 +1,77 @@ diff --git a/front-end/mall4uni/src/pages/index/index.scss b/front-end/mall4uni/src/pages/index/index.scss index 9eba5a5..c85a66f 100644 --- a/front-end/mall4uni/src/pages/index/index.scss +++ b/front-end/mall4uni/src/pages/index/index.scss @@ -1,3 +1,4 @@ +/* 容器背景颜色设置为浅灰色,并且高度根据内容自动调整 */ .container { background: #f7f7f7; height: auto; @@ -5,409 +6,443 @@ /* 轮播图及搜索框 */ swiper { - width: 100%; - height: 350rpx; - overflow: hidden; + width: 100%; /* 占满整个宽度 */ + height: 350rpx; /* 高度为350rpx */ + overflow: hidden; /* 隐藏超出容器的内容 */ } + swiper.pic-swiper { - padding: 10rpx 0; - background: #fff; - height: 422rpx; + padding: 10rpx 0; /* 上下内边距 */ + background: #fff; /* 白色背景 */ + height: 422rpx; /* 设置轮播图的高度 */ .img-box { - font-size: 0; + font-size: 0; /* 去除图片间的空白间隙 */ } + .banner { - position: absolute; - width: 690rpx; - margin: 0 10rpx; - height: 402rpx; - border-radius: 8rpx; - display: inline-block; - box-shadow: 0 4px 10px 0 rgba(83, 83, 83, 0.288); + position: absolute; /* 绝对定位 */ + width: 690rpx; /* 宽度 */ + margin: 0 10rpx; /* 左右外边距 */ + height: 402rpx; /* 高度 */ + border-radius: 8rpx; /* 圆角 */ + display: inline-block; /* 内联块级元素 */ + box-shadow: 0 4px 10px 0 rgba(83, 83, 83, 0.288); /* 添加阴影效果 */ } } + swiper-item { - font-size: 26rpx; - font-weight: bold; + font-size: 26rpx; /* 文字大小 */ + font-weight: bold; /* 加粗字体 */ } + .wx-swiper-dots { - margin-bottom: 15rpx; + margin-bottom: 15rpx; /* 下边距 */ } + .banner-item { - box-sizing: border-box; + box-sizing: border-box; /* 盒模型包含内边距和边框 */ } + +/* 搜索框固定在顶部 */ .container { .bg-sear { - position: fixed; - z-index: 999; - width: 100%; - line-height: 56rpx; - background: #fff; - padding: 20rpx 0; - text-align: center; - top: 0; + position: fixed; /* 固定定位 */ + z-index: 999; /* 确保位于其他内容之上 */ + width: 100%; /* 占满整个宽度 */ + line-height: 56rpx; /* 行高 */ + background: #fff; /* 白色背景 */ + padding: 20rpx 0; /* 上下内边距 */ + text-align: center; /* 文本居中 */ + top: 0; /* 顶部位置 */ } } + .bg-sear { .section { - display: flex; - justify-content: center; - align-items: center; - height: 60rpx; - background: #fff; - z-index: 1; - border-radius: 50rpx; - width: 92%; - margin: auto; - left: 4%; - background: #f7f7f7; + display: flex; /* 弹性布局 */ + justify-content: center; /* 水平居中 */ + align-items: center; /* 垂直居中 */ + height: 60rpx; /* 高度 */ + background: #fff; /* 白色背景 */ + z-index: 1; /* 层叠顺序 */ + border-radius: 50rpx; /* 圆角 */ + width: 92%; /* 宽度 */ + margin: auto; /* 自动外边距 */ + left: 4%; /* 左侧位置 */ + background: #f7f7f7; /* 浅灰色背景 */ .placeholder { - display: block; - font-size: 24rpx; - color: #999; + display: block; /* 块级元素 */ + font-size: 24rpx; /* 字体大小 */ + color: #999; /* 颜色 */ } + .search-img { - width: 32rpx; - height: 32rpx; - margin-right: 10rpx; + width: 32rpx; /* 宽度 */ + height: 32rpx; /* 高度 */ + margin-right: 10rpx; /* 右侧外边距 */ } } } /* 分类栏目 */ .content { - background: #fff; + background: #fff; /* 白色背景 */ } + .cat-item { - display: flex; - justify-content: space-between; - background: #fff; - padding-top: 20rpx; - padding-bottom: 30rpx; + display: flex; /* 弹性布局 */ + justify-content: space-between; /* 子元素两端对齐 */ + background: #fff; /* 白色背景 */ + padding-top: 20rpx; /* 上内边距 */ + padding-bottom: 30rpx; /* 下内边距 */ .item { - text-align: center; - width: 25%; - display: flex; - flex-direction: column; - margin: auto; - align-items: center; + text-align: center; /* 文本居中 */ + width: 25%; /* 宽度 */ + display: flex; /* 弹性布局 */ + flex-direction: column; /* 列方向排列 */ + margin: auto; /* 自动外边距 */ + align-items: center; /* 子元素垂直居中 */ image { - width: 75rpx; - height: 75rpx; + width: 75rpx; /* 宽度 */ + height: 75rpx; /* 高度 */ } + text { - font-size: 26rpx; - margin-top: 20rpx; + font-size: 26rpx; /* 字体大小 */ + margin-top: 20rpx; /* 上外边距 */ } } } /* 消息播放 */ .message-play { - position: relative; - height: 90rpx; - background: #fff; - margin: auto; - padding: 0 60rpx 0 100rpx; - box-sizing: border-box; - box-shadow: 0 16rpx 32rpx 0 rgba(7, 17, 27, 0.05); - border: 2rpx solid #fafafa; + position: relative; /* 相对定位 */ + height: 90rpx; /* 高度 */ + background: #fff; /* 白色背景 */ + margin: auto; /* 自动外边距 */ + padding: 0 60rpx 0 100rpx; /* 内边距 */ + box-sizing: border-box; /* 盒模型包含内边距和边框 */ + box-shadow: 0 16rpx 32rpx 0 rgba(7, 17, 27, 0.05); /* 添加阴影效果 */ + border: 2rpx solid #fafafa; /* 边框 */ .hornpng { - width: 77rpx; - height: 36rpx; - position: absolute; - left: 20rpx; - top: 27rpx; - margin-right: 8rpx; + width: 77rpx; /* 宽度 */ + height: 36rpx; /* 高度 */ + position: absolute; /* 绝对定位 */ + left: 20rpx; /* 左侧位置 */ + top: 27rpx; /* 顶部位置 */ + margin-right: 8rpx; /* 右侧外边距 */ } + .swiper-cont { - height: 90rpx; - line-height: 90rpx; + height: 90rpx; /* 高度 */ + line-height: 90rpx; /* 行高 */ .items { - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - text-align: left; + text-overflow: ellipsis; /* 超出文本显示省略号 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 1; /* 限制行数 */ + -webkit-box-orient: vertical; /* 垂直排列 */ + text-align: left; /* 文本左对齐 */ } } } + .arrow { - width: 15rpx; - height: 15rpx; - border-top: 3rpx solid #686868; - border-right: 3rpx solid #686868; - transform: rotate(45deg); - position: absolute; - right: 30rpx; - top: 34rpx; + width: 15rpx; /* 宽度 */ + height: 15rpx; /* 高度 */ + border-top: 3rpx solid #686868; /* 上边框 */ + border-right: 3rpx solid #686868; /* 右边框 */ + transform: rotate(45deg); /* 旋转45度形成箭头 */ + position: absolute; /* 绝对定位 */ + right: 30rpx; /* 右侧位置 */ + top: 34rpx; /* 顶部位置 */ } /* 每日上新 */ .title { - position: relative; - height: 64rpx; - line-height: 64rpx; - font-size: 32rpx; - padding: 40rpx 0 10rpx 30rpx; - color: #333; - background: #fff; + position: relative; /* 相对定位 */ + height: 64rpx; /* 高度 */ + line-height: 64rpx; /* 行高 */ + font-size: 32rpx; /* 字体大小 */ + padding: 40rpx 0 10rpx 30rpx; /* 内边距 */ + color: #333; /* 颜色 */ + background: #fff; /* 白色背景 */ .more-prod-cont { - color: #999; - display: inline-block; - text-align: right; + color: #999; /* 颜色 */ + display: inline-block; /* 内联块级元素 */ + text-align: right; /* 文本右对齐 */ .more { - position: absolute; - right: 30rpx; - top: 48rpx; - color: #666; - font-size: 24rpx; - padding: 0 20rpx; - height: 44rpx; - line-height: 44rpx; + position: absolute; /* 绝对定位 */ + right: 30rpx; /* 右侧位置 */ + top: 48rpx; /* 顶部位置 */ + color: #666; /* 颜色 */ + font-size: 24rpx; /* 字体大小 */ + padding: 0 20rpx; /* 内边距 */ + height: 44rpx; /* 高度 */ + line-height: 44rpx; /* 行高 */ } + .arrow { - top: 58rpx; - right: 30rpx; - border-top: 2rpx solid #666; - border-right: 2rpx solid #666; + top: 58rpx; /* 顶部位置 */ + right: 30rpx; /* 右侧位置 */ + border-top: 2rpx solid #666; /* 上边框 */ + border-right: 2rpx solid #666; /* 右边框 */ } } } + .up-to-date { .title { - color: #fff; - background: none; + color: #fff; /* 颜色 */ + background: none; /* 无背景 */ .more-prod-cont { .more { - position: absolute; - right: 30rpx; - top: 48rpx; - color: #fff; - font-size: 24rpx; - background: #65addf; - border-radius: 30rpx; - padding: 0 30rpx; - height: 44rpx; - line-height: 44rpx; + position: absolute; /* 绝对定位 */ + right: 30rpx; /* 右侧位置 */ + top: 48rpx; /* 顶部位置 */ + color: #fff; /* 颜色 */ + font-size: 24rpx; /* 字体大小 */ + background: #65addf; /* 背景颜色 */ + border-radius: 30rpx; /* 圆角 */ + padding: 0 30rpx; /* 内边距 */ + height: 44rpx; /* 高度 */ + line-height: 44rpx; /* 行高 */ } } } - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAABxCAYAAACkwXoWAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAAZBJREFUeJzt1DEBwCAAwLAxYfhEGXJABkcTBb065trnAwj6XwcAvGKAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGRdKykDj9OUNYkAAAAASUVORK5CYII="); - background-position: top; - background-size: 100% 332rpx; - background-repeat: no-repeat; - background-color: #fff; + + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAABxCAYAAACkwXoWAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAAZBJREFUeJzt1DEBwCAAwLAxYfhEGXJABkcTBb065trnAwj6XwcAvGKAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGRdKykDj9OUNYkAAAAASUVORK5CYII="); + background-position: top; /* 背景图像位置 */ + background-size: 100% 332rpx; /* 背景图像大小 */ + background-repeat: no-repeat; /* 不重复背景图像 */ + background-color: #fff; /* 白色背景 */ .item-cont { - margin: auto; - height: auto; - width: calc(100% - 40rpx); - display: flex; - flex-wrap: wrap; + margin: auto; /* 自动外边距 */ + height: auto; /* 自动高度 */ + width: calc(100% - 40rpx); /* 宽度计算 */ + display: flex; /* 弹性布局 */ + flex-wrap: wrap; /* 换行 */ &::before { - clear: both; - height: 0; - overflow: hidden; + clear: both; /* 清除浮动 */ + height: 0; /* 高度 */ + overflow: hidden; /* 隐藏溢出 */ } + .prod-item { - border-radius: 10rpx; - width: 220rpx; - background: #fff; - display: inline-block; - margin: 0 8rpx; - margin-bottom: 20rpx; - box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); + border-radius: 10rpx; /* 圆角 */ + width: 220rpx; /* 宽度 */ + background: #fff; /* 白色背景 */ + display: inline-block; /* 内联块级元素 */ + margin: 0 8rpx; /* 左右边距 */ + margin-bottom: 20rpx; /* 下边距 */ + box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); /* 添加阴影效果 */ .imagecont { - width: 100%; - font-size: 0; - width: 220rpx; - height: 220rpx; + width: 100%; /* 占满整个宽度 */ + font-size: 0; /* 去除图片间的空白间隙 */ + width: 220rpx; /* 宽度 */ + height: 220rpx; /* 高度 */ .prodimg { - width: 220rpx; - height: 220rpx; - vertical-align: middle; - border-top-left-radius: 10rpx; - border-top-right-radius: 10rpx; - font-size: 0; + width: 220rpx; /* 宽度 */ + height: 220rpx; /* 高度 */ + vertical-align: middle; /* 垂直居中 */ + border-top-left-radius: 10rpx; /* 左上圆角 */ + border-top-right-radius: 10rpx; /* 右上圆角 */ + font-size: 0; /* 去除图片间的空白间隙 */ } } + .prod-text { - font-size: 28rpx; - overflow: hidden; - margin: 10rpx 0; - height: 75rpx; - display: -webkit-box; - word-break: break-all; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - color: #000; - padding: 0 10rpx; + font-size: 28rpx; /* 字体大小 */ + overflow: hidden; /* 隐藏溢出 */ + margin: 10rpx 0; /* 上下外边距 */ + height: 75rpx; /* 高度 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + word-break: break-all; /* 单词换行 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 2; /* 限制行数 */ + -webkit-box-orient: vertical; /* 垂直排列 */ + color: #000; /* 颜色 */ + padding: 0 10rpx; /* 内边距 */ } + .prod-price { - font-size: 25rpx; - color: #eb2444; - font-family: Arial; - padding: 0 10rpx; + font-size: 25rpx; /* 字体大小 */ + color: #eb2444; /* 颜色 */ + font-family: Arial; /* 字体 */ + padding: 0 10rpx; /* 内边距 */ } } } } + .hotsale-item-cont { - padding-bottom: 20rpx; - background: #fff; + padding-bottom: 20rpx; /* 下内边距 */ + background: #fff; /* 白色背景 */ } + .more.prod-price { - position: absolute; - bottom: 20rpx; + position: absolute; /* 绝对定位 */ + bottom: 20rpx; /* 底部位置 */ } /* 商城热卖 */ .hot-sale { .prod-items { - width: 345rpx; - display: inline-block; - background: #fff; - padding-bottom: 20rpx; - box-sizing: border-box; - box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); + width: 345rpx; /* 宽度 */ + display: inline-block; /* 内联块级元素 */ + background: #fff; /* 白色背景 */ + padding-bottom: 20rpx; /* 下内边距 */ + box-sizing: border-box; /* 盒模型包含内边距和边框 */ + box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); /* 添加阴影效果 */ &:nth-child(2n-1) { - margin: 20rpx 10rpx 10rpx 20rpx; + margin: 20rpx 10rpx 10rpx 20rpx; /* 奇数项的外边距 */ } + &:nth-child(2n) { - margin: 20rpx 20rpx 10rpx 10rpx; + margin: 20rpx 20rpx 10rpx 10rpx; /* 偶数项的外边距 */ } } } + .prod-items { .hot-imagecont { - width: 341rpx; - height: 341rpx; + width: 341rpx; /* 宽度 */ + height: 341rpx; /* 高度 */ .hotsaleimg { - width: 341rpx; - height: 341rpx; + width: 341rpx; /* 宽度 */ + height: 341rpx; /* 高度 */ } - font-size: 0; - text-align: center; + + font-size: 0; /* 去除图片间的空白间隙 */ + text-align: center; /* 文本居中 */ } + .hot-text { .hotprod-text { - font-size: 28rpx; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + font-size: 28rpx; /* 字体大小 */ + white-space: nowrap; /* 不换行 */ + overflow: hidden; /* 隐藏溢出 */ + text-overflow: ellipsis; /* 超出文本显示省略号 */ } - margin-top: 20rpx; - padding: 0 10rpx; + + margin-top: 20rpx; /* 上外边距 */ + padding: 0 10rpx; /* 内边距 */ .prod-info { - font-size: 22rpx; - color: #999; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + font-size: 22rpx; /* 字体大小 */ + color: #999; /* 颜色 */ + white-space: nowrap; /* 不换行 */ + overflow: hidden; /* 隐藏溢出 */ + text-overflow: ellipsis; /* 超出文本显示省略号 */ } + .prod-text-info { - position: relative; - height: 70rpx; - line-height: 70rpx; - font-family: Arial; + position: relative; /* 相对定位 */ + height: 70rpx; /* 高度 */ + line-height: 70rpx; /* 行高 */ + font-family: Arial; /* 字体 */ .hotprod-price { - display: inline; - font-size: 26rpx; - color: #eb2444; + display: inline; /* 内联元素 */ + font-size: 26rpx; /* 字体大小 */ + color: #eb2444; /* 颜色 */ } + .basket-img { - width: 50rpx; - height: 50rpx; - position: absolute; - right: 0; - bottom: 7rpx; - padding: 8rpx; + width: 50rpx; /* 宽度 */ + height: 50rpx; /* 高度 */ + position: absolute; /* 绝对定位 */ + right: 0; /* 右侧位置 */ + bottom: 7rpx; /* 底部位置 */ + padding: 8rpx; /* 内边距 */ } } } } + .more-prod { .prod-text-right { .prod-info { - font-size: 22rpx; - color: #999; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + font-size: 22rpx; /* 字体大小 */ + color: #999; /* 颜色 */ + white-space: nowrap; /* 不换行 */ + overflow: hidden; /* 隐藏溢出 */ + text-overflow: ellipsis; /* 超出文本显示省略号 */ } } } + .singal-price { - display: inline; - font-size: 20rpx; - text-decoration: line-through; - color: #777; - margin-left: 15rpx; + display: inline; /* 内联元素 */ + font-size: 20rpx; /* 字体大小 */ + text-decoration: line-through; /* 删除线 */ + color: #777; /* 颜色 */ + margin-left: 15rpx; /* 左边距 */ } /* 更多宝贝 */ .more-prod { - background: #fff; + background: #fff; /* 白色背景 */ .prod-show { .show-item { .more-prod-pic { - width: 250rpx; - height: 250rpx; + width: 250rpx; /* 宽度 */ + height: 250rpx; /* 高度 */ .more-pic { - max-width: 100%; - max-height: 100%; + max-width: 100%; /* 最大宽度 */ + max-height: 100%; /* 最大高度 */ } } - position: relative; - display: flex; - padding: 20rpx; - justify-content: flex-start; - border-top: 2rpx solid #f4f4f4; + + position: relative; /* 相对定位 */ + display: flex; /* 弹性布局 */ + padding: 20rpx; /* 内边距 */ + justify-content: flex-start; /* 子元素左对齐 */ + border-top: 2rpx solid #f4f4f4; /* 上边框 */ .prod-text-right { - margin-left: 30rpx; - width: 72%; - padding-bottom: 10rpx; - display: flex; - flex-direction: column; - justify-content: center; + margin-left: 30rpx; /* 左边距 */ + width: 72%; /* 宽度 */ + padding-bottom: 10rpx; /* 下内边距 */ + display: flex; /* 弹性布局 */ + flex-direction: column; /* 列方向排列 */ + justify-content: center; /* 子元素垂直居中 */ .go-to-buy { - font-size: 26rpx; - background: #fff2f5; - color: #eb2444; - border-radius: 50rpx; - text-align: center; - padding: 12rpx 20rpx; - position: absolute; - right: 20rpx; - bottom: 20rpx; + font-size: 26rpx; /* 字体大小 */ + background: #fff2f5; /* 背景颜色 */ + color: #eb2444; /* 颜色 */ + border-radius: 50rpx; /* 圆角 */ + text-align: center; /* 文本居中 */ + padding: 12rpx 20rpx; /* 内边距 */ + position: absolute; /* 绝对定位 */ + right: 20rpx; /* 右侧位置 */ + bottom: 20rpx; /* 底部位置 */ } + .prod-text.more { - margin: 0; - font-size: 28rpx; - overflow: hidden; - margin-bottom: 20rpx; - display: -webkit-box; - word-break: break-all; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; + margin: 0; /* 外边距 */ + font-size: 28rpx; /* 字体大小 */ + overflow: hidden; /* 隐藏溢出 */ + margin-bottom: 20rpx; /* 下外边距 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + word-break: break-all; /* 单词换行 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 2; /* 限制行数 */ + -webkit-box-orient: vertical; /* 垂直排列 */ } + .more.prod-price { - font-size: 28rpx; - font-family: arial; + font-size: 28rpx; /* 字体大小 */ + font-family: arial; /* 字体 */ } } } } } + .b-cart { - margin-top: 30rpx; + margin-top: 30rpx; /* 上外边距 */ .basket-img { - width: 50rpx; - height: 50rpx; - position: absolute; - right: 46rpx; - padding: 8rpx; + width: 50rpx; /* 宽度 */ + height: 50rpx; /* 高度 */ + position: absolute; /* 绝对定位 */ + right: 46rpx; /* 右侧位置 */ + padding: 8rpx; /* 内边距 */ } } diff --git a/front-end/mall4uni/src/pages/index/index.vue b/front-end/mall4uni/src/pages/index/index.vue index 70a8c77..d92335c 100644 --- a/front-end/mall4uni/src/pages/index/index.vue +++ b/front-end/mall4uni/src/pages/index/index.vue @@ -1,15 +1,17 @@ diff --git a/front-end/mall4uni/src/pages/pay-result/pay-result.scss b/front-end/mall4uni/src/pages/pay-result/pay-result.scss index eb8e3e3..f857c70 100644 --- a/front-end/mall4uni/src/pages/pay-result/pay-result.scss +++ b/front-end/mall4uni/src/pages/pay-result/pay-result.scss @@ -1,50 +1,92 @@ +/* 定义支付状态信息的样式 */ .pay-sts { + /* 设置字体大小为40rpx */ font-size: 40rpx; + /* 设置顶部外边距为100rpx,使支付状态信息与页面顶部有一定的间距 */ margin-top: 100rpx; + /* 设置上下内边距为30rpx,左右内边距为0,确保文本有足够的内部空间 */ padding: 30rpx 0; + /* 文本居中对齐 */ text-align: center; } + +/* 当支付状态为失败时,设置文本颜色为红色(#f43530),以视觉上突出错误信息 */ .pay-sts.fail { color: #f43530; } + +/* 当支付状态为成功时,设置文本颜色为绿色(#19be6b),表示操作成功 */ .pay-sts.succ { color: #19be6b; } + +/* 定义按钮组的样式 */ .btns { + /* 设置顶部外边距为50rpx,使按钮组与上方内容有一定的间距 */ margin-top: 50rpx; + /* 文本居中对齐 */ text-align: center; + /* 定义默认按钮样式 */ .button { + /* 设置圆角半径为10rpx,使按钮看起来更加圆润 */ border-radius: 10rpx; + /* 设置字体大小为28rpx */ font-size: 28rpx; + /* 设置背景颜色为白色 */ background: #fff; + /* 设置文本颜色为深灰色 */ color: #333; + /* 设置上下内边距为20rpx,左右内边距为35rpx,确保按钮内的文本有足够的内部空间 */ padding: 20rpx 35rpx; + /* 设置按钮宽度为300rpx,确保按钮在不同屏幕尺寸下都能保持一致的宽度 */ width: 300rpx; + /* 设置左右外边距为20rpx,确保按钮之间有一定的间距 */ margin: 0 20rpx; + /* 文本居中对齐 */ text-align: center; } + /* 定义“查看订单”按钮的样式 */ .button.checkorder { + /* 设置背景颜色为绿色(#19be6b),表示这是一个积极的操作 */ background: #19be6b; + /* 设置文本颜色为白色 */ color: #fff; + /* 设置底部外边距为20rpx,使按钮与其他元素之间有一定的间距 */ margin-bottom: 20rpx; + /* 设置边框为2rpx宽的绿色实线 */ border: 2rpx solid #19be6b; } + /* 定义“再次支付”按钮的样式 */ .button.payagain { + /* 设置背景颜色为白色 */ background: #fff; + /* 设置边框为2rpx宽的橙色实线 */ border: 2rpx solid #f90; + /* 设置文本颜色为橙色 */ color: #f90; } + /* 定义“继续购物”按钮的样式 */ .button.shopcontinue { + /* 设置背景颜色为白色 */ background: #fff; + /* 设置边框为2rpx宽的绿色实线 */ border: 2rpx solid #19be6b; + /* 设置文本颜色为绿色 */ color: #19be6b; } } + +/* 定义提示信息的样式 */ .tips { + /* 设置字体大小为28rpx */ font-size: 28rpx; + /* 设置文本颜色为浅灰色(#999),使提示信息显得不那么显眼 */ color: #999; + /* 文本居中对齐 */ text-align: center; + /* 定义警告信息的样式 */ .warn { + /* 设置文本颜色为红色(#f43530),用于突出显示警告或错误信息 */ color: #f43530; } } diff --git a/front-end/mall4uni/src/pages/pay-result/pay-result.vue b/front-end/mall4uni/src/pages/pay-result/pay-result.vue index 9dae116..aada750 100644 --- a/front-end/mall4uni/src/pages/pay-result/pay-result.vue +++ b/front-end/mall4uni/src/pages/pay-result/pay-result.vue @@ -1,52 +1,61 @@ diff --git a/front-end/mall4uni/src/pages/prod-classify/prod-classify.scss b/front-end/mall4uni/src/pages/prod-classify/prod-classify.scss index 3932b9b..38698c5 100644 --- a/front-end/mall4uni/src/pages/prod-classify/prod-classify.scss +++ b/front-end/mall4uni/src/pages/prod-classify/prod-classify.scss @@ -1,38 +1,48 @@ +/* 容器样式 */ .container { - background: #f4f4f4; - min-height: 100vh; - padding: 7px; + background: #f4f4f4; /* 设置背景颜色为浅灰色 */ + min-height: 100vh; /* 最小高度为视口高度,确保内容不满屏时也有足够的空间 */ + padding: 7px; /* 内边距,给容器内的元素留出一定的空间 */ } + +/* 固定在顶部的线条 */ .line-fix { - width: 100%; - height: 2rpx; - background: #e1e1e1; - position: fixed; - top: 0; + width: 100%; /* 线条宽度为100%,覆盖整个屏幕宽度 */ + height: 2rpx; /* 线条高度为2rpx(响应式单位),非常细的一条线 */ + background: #e1e1e1; /* 线条颜色为浅灰色 */ + position: fixed; /* 将线条固定在页面顶部,不会随页面滚动而移动 */ + top: 0; /* 线条距离页面顶部0像素 */ } + +/* 标题背景样式 */ .tit-background { - width: 100%; - height: 20rpx; - background: #f4f4f4; + width: 100%; /* 背景宽度为100%,覆盖整个屏幕宽度 */ + height: 20rpx; /* 背景高度为20rpx(响应式单位) */ + background: #f4f4f4; /* 背景颜色为浅灰色 */ } + +/* 商品列表样式 */ .prod-list { - display: flex; - flex-wrap: wrap; - justify-content: space-between; + display: flex; /* 使用弹性布局,使子元素可以灵活排列 */ + flex-wrap: wrap; /* 允许子元素换行显示 */ + justify-content: space-between; /* 子元素之间均匀分布,两端对齐 */ } + +/* 深度选择器,用于修改子组件的样式 */ :deep(.prod-items) { - display: inline-block; - width: 345rpx !important; - &:nth-child(2n) { - margin-left: 30rpx; + display: inline-block; /* 将商品项设置为行内块级元素,允许在同一行中显示多个商品 */ + width: 345rpx !important; /* 设置商品项的宽度为345rpx,并使用!important确保优先级 */ + &:nth-child(2n) { /* 对于每第二个商品项 */ + margin-left: 30rpx; /* 左边距为30rpx,使第二列的商品与第一列保持一定间距 */ } } -/* 空 */ + +/* 空状态提示样式 */ .empty { - display: block; - width: 100%; - font-size: 26rpx; - color: #999; - margin-top: 20vh; - text-align: center; + display: block; /* 将空状态提示设置为块级元素 */ + width: 100%; /* 提示宽度为100%,覆盖整个父容器 */ + font-size: 26rpx; /* 字体大小为26rpx(响应式单位) */ + color: #999; /* 文字颜色为浅灰色 */ + margin-top: 20vh; /* 上边距为视口高度的20%,将提示居中显示 */ + text-align: center; /* 文字水平居中 */ } diff --git a/front-end/mall4uni/src/pages/prod-classify/prod-classify.vue b/front-end/mall4uni/src/pages/prod-classify/prod-classify.vue index c43ae5a..2e85f50 100644 --- a/front-end/mall4uni/src/pages/prod-classify/prod-classify.vue +++ b/front-end/mall4uni/src/pages/prod-classify/prod-classify.vue @@ -1,16 +1,13 @@ diff --git a/front-end/mall4uni/src/pages/prod/prod.scss b/front-end/mall4uni/src/pages/prod/prod.scss index 7478438..578df99 100644 --- a/front-end/mall4uni/src/pages/prod/prod.scss +++ b/front-end/mall4uni/src/pages/prod/prod.scss @@ -1,26 +1,35 @@ -.container { +.c /* 容器样式,设置了背景颜色、高度为100%(相对于父元素),并且在底部留出150rpx的内边距 */ +container { background: #f4f4f4; height: 100%; padding-bottom: 150rpx; } + +/* 轮播图组件,设定了高度、宽度以及下边框。内部图片也设定了相同的高度和宽度以确保适应轮播图容器 */ swiper { height: 750rpx; width: 100%; border-bottom: 2rpx solid #f8f8f8; + image { height: 750rpx; width: 100%; } } + +/* 产品信息区域,设置了上下左右的内边距,相对定位,白色背景 */ .prod-info { padding: 30rpx 30rpx 0 30rpx; position: relative; background: #fff; } + +/* 标题包装器,使用了相对定位来放置子元素,并定义了行高和右边距 */ .tit-wrap { position: relative; line-height: 40rpx; padding-right: 104rpx; + /* 列元素,绝对定位在标题包装器的右上角,作为额外的信息展示,如收藏按钮等 */ .col { position: absolute; top: 0; @@ -30,12 +39,14 @@ swiper { font-size: 20rpx; padding-left: 20rpx; text-align: center; + /* 列内的图标,设置为块级元素并居中显示 */ image { display: block; margin: auto; width: 40rpx; height: 40rpx; } + /* 在列元素左侧添加一条竖线装饰 */ &::after { content: ""; display: block; @@ -49,11 +60,15 @@ swiper { } } } + +/* 产品标题,设定字体大小、颜色和右边距 */ .prod-tit { font-size: 32rpx; color: #333; padding-right: 20rpx; } + +/* 销量段落,设置了背景色、行高、颜色、字体大小、上边距和右边距 */ .sales-p { background: #fff; line-height: 40rpx; @@ -62,29 +77,38 @@ swiper { margin-top: 6rpx; margin-right: 104rpx; } + +/* 产品价格部分,包含新旧价格对比 */ .prod-price { font-size: 30rpx; height: 100rpx; line-height: 100rpx; + /* 新价格的颜色、字体大小、加粗和右边距 */ + .price { + color: #eb2444; + font-size: 24rpx; + font-weight: 600; + margin-right: 30rpx; + } + /* 新价格的数字部分,加大字体 */ + .price-num { + font-size: 46rpx; + font-weight: 400; + } + /* 原价,较小字体,灰色,带删除线 */ + .ori-price { + font-size: 25rpx; + color: #999; + text-decoration: line-through; + } } -.price { - color: #eb2444; - font-size: 24rpx; - font-weight: 600; - margin-right: 30rpx; -} -.price-num { - font-size: 46rpx; - font-weight: 400; -} -.ori-price { - font-size: 25rpx; - color: #999; - text-decoration: line-through; -} + +/* 销量文字的颜色 */ .sales { color: #999; } + +/* 更多选项按钮,绝对定位在右侧,设置了宽度、顶部位置、文本对齐、字体大小和颜色 */ .more { position: absolute; right: 20rpx; @@ -95,243 +119,280 @@ swiper { color: #999; letter-spacing: 1px; } + +/* SKU(库存保有单位)信息,设置了内边距、背景色、外边距、相对定位和行高 */ .sku { padding: 20rpx; background: #fff; margin-top: 20rpx; position: relative; line-height: 48rpx; + /* SKU标题,绝对定位在左上角,作为SKU信息的标签 */ + .sku-tit { + position: absolute; + display: inline-block; + width: 60rpx; + left: 20rpx; + font-size: 22rpx; + top: 20rpx; + color: #999; + } + /* SKU内容,从标题右侧开始,单行显示,超出部分用省略号代替 */ + .sku-con { + margin: 0 80rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: 28rpx; + font-weight: bold; + } } -.sku-tit { - position: absolute; - display: inline-block; - width: 60rpx; - left: 20rpx; - font-size: 22rpx; - top: 20rpx; - color: #999; -} -.sku-con { - margin: 0 80rpx; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - font-size: 28rpx; - font-weight: bold; -} + +/* 评论区包裹,设置了背景色、外边距、相对定位和行高 */ .cmt-wrap { background: #fff; margin-top: 20rpx; position: relative; line-height: 48rpx; -} -.cmt-tit { - font-size: 32rpx; - position: relative; - border-bottom: 1px solid #ddd; - padding: 20rpx; -} -.cmt-t { - width: 300rpx; -} -.cmt-good { - color: #eb2444; - font-size: 24rpx; -} -.cmt-count { - position: absolute; - right: 20rpx; - top: 20rpx; - font-size: 24rpx; - color: #666; -} -.cmt-more { - width: 20rpx; - height: 20rpx; - border-top: 2rpx solid #999; - border-right: 2rpx solid #999; - transform: rotate(45deg); - margin-left: 10rpx; - display: inline-block; -} -.cmt-cont { - padding: 0 20rpx; -} -.cmt-tag { - position: relative; - padding: 14px 3px 0 0; - margin: 0; - text { - margin: 0 10px 10px 0; - background: #fdf0f0; - display: inline-block; - padding: 0 10px; - height: 25px; - border-radius: 3px; - line-height: 25px; - font-size: 12px; - font-family: -apple-system, Helvetica, sans-serif; - color: #666; + /* 评论区标题,较大字体,带有下边框,内边距 */ + .cmt-tit { + font-size: 32rpx; + position: relative; + border-bottom: 1px solid #ddd; + padding: 20rpx; } - text.selected { - color: #fff; - background: #e93b3d; + /* 评论区的好评率,红色字体,稍小字号 */ + .cmt-good { + color: #eb2444; + font-size: 24rpx; } -} -.cmt-item { - position: relative; - padding: 10px 0; - &::after { - content: ""; - height: 0; - display: block; - border-bottom: 1px solid #ddd; + /* 评论数量,绝对定位在右上角,设置了字体大小和颜色 */ + .cmt-count { position: absolute; - left: 0; - bottom: 0; - right: -10px; - border-bottom-color: #e5e5e5; + right: 20rpx; + top: 20rpx; + font-size: 24rpx; + color: #666; } -} -.cmt-items { - .empty { + /* 展示更多评论的箭头图标,通过旋转创建 */ + .cmt-more { + width: 20rpx; + height: 20rpx; + border-top: 2rpx solid #999; + border-right: 2rpx solid #999; + transform: rotate(45deg); + margin-left: 10rpx; + display: inline-block; + } + /* 评论内容区,设置了左右内边距 */ + .cmt-cont { + padding: 0 20rpx; + } + /* 评论标签,设置了相对定位,允许内部元素浮动或绝对定位 */ + .cmt-tag { + position: relative; + padding: 14px 3px 0 0; + margin: 0; + /* 每个标签,设置了背景色、内边距、圆角、行高、字体大小和颜色 */ + text { + margin: 0 10px 10px 0; + background: #fdf0f0; + display: inline-block; + padding: 0 10px; + height: 25px; + border-radius: 3px; + line-height: 25px; + font-size: 12px; + color: #666; + /* 当标签被选中时,改变背景色和字体颜色 */ + &.selected { + color: #fff; + background: #e93b3d; + } + } + } + /* 单条评论项,设置了相对定位,添加了底部边框 */ + .cmt-item { + position: relative; + padding: 10px 0; + /* 使用伪元素添加底部边框 */ + &::after { + content: ""; + height: 0; + display: block; + border-bottom: 1px solid #ddd; + position: absolute; + left: 0; + bottom: 0; + right: -10px; + border-bottom-color: #e5e5e5; + } + } + /* 评论列表为空时的提示 */ + .cmt-items .empty { display: block; font-size: 24rpx; text-align: center; color: #aaa; margin-top: 5vh; } -} -.cmt-user { - line-height: 25px; - margin-bottom: 8px; - font-size: 12px; - .user-img { - width: 25px; - height: 25px; - border-radius: 50%; - vertical-align: middle; - } - .nickname { - margin-left: 10px; - display: inline-block; - color: #333; - max-width: 8.2em; - height: 25px; - line-height: 27px; - } - .date { - float: right; - color: #999; - margin-left: -60px; - } -} -.cmt-user-info { - display: flex; - align-items: center; - width: 400rpx; -} -.cmt-cnt { - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - position: relative; - line-height: 1.5; - font-size: 14px; - margin: 5px 0; - word-break: break-all; - max-height: 126px; -} -.cmt-attr { - height: 85px; - width: 100%; - white-space: nowrap; - image { - display: inline-block; - width: 80px; - height: 80px; - margin-right: 5px; - margin-bottom: 5px; - border-radius: 2px; - background: #f3f3f3; - } -} -.cmt-more-v { - text-align: center; - background-color: #fff; - font-size: 12px; - text { - height: 25px; + /* 用户信息,设置了行高、底边距、字体大小 */ + .cmt-user { line-height: 25px; + margin-bottom: 8px; font-size: 12px; - text-align: center; - color: #333; - padding: 0px 10px; - margin: 10px 0; - border: 1px solid #ccc; - border-radius: 40px; - display: inline-block; + /* 用户头像,圆形,设置了宽度、高度、圆角和垂直对齐方式 */ + .user-img { + width: 25px; + height: 25px; + border-radius: 50%; + vertical-align: middle; + } + /* 用户昵称,设置了左边距、显示方式、颜色、最大宽度和高度 */ + .nickname { + margin-left: 10px; + display: inline-block; + color: #333; + max-width: 8.2em; + height: 25px; + line-height: 27px; + } + /* 评论日期,设置为右侧浮动,颜色和左边距 */ + .date { + float: right; + color: #999; + margin-left: -60px; + } } -} -.cmt-popup { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: 998; - background-color: #fff; - padding-bottom: 98rpx; - .cmt-cont { - height: calc(100% - 80rpx); - overflow: auto; + /* 用户信息容器,使用flex布局,对齐项目中心,设置了宽度 */ + .cmt-user-info { + display: flex; + align-items: center; + width: 400rpx; } + /* 评论内容,设置了溢出隐藏、文本溢出处理、弹性盒子模型属性、相对定位、行高、字体大小、边距、单词断开和最大高度 */ .cmt-cnt { - -webkit-line-clamp: 20; - max-height: 500px; - } - .load-more { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + position: relative; + line-height: 1.5; font-size: 14px; - padding: 20px; + margin: 5px 0; + word-break: break-all; + max-height: 126px; + } + /* 评论中的商品属性展示,设置了高度、宽度和白空间处理 */ + .cmt-attr { + height: 85px; + width: 100%; + white-space: nowrap; + /* 商品图片,设置了宽高、右边距、底边距、圆角和背景色 */ + image { + display: inline-block; + width: 80px; + height: 80px; + margin-right: 5px; + margin-bottom: 5px; + border-radius: 2px; + background: #f3f3f3; + } + } + /* 查看更多评论按钮,居中对齐,设置了背景色、字体大小、内边距、边框、圆角 */ + .cmt-more-v { text-align: center; - margin-bottom: 10px; + background-color: #fff; + font-size: 12px; + /* 按钮文本,设置了高度、行高、字体大小、文本对齐、颜色、内边距、边框、圆角 */ text { - border: 1px solid #ddd; - padding: 5px 10px; - border-radius: 10px; - color: #666; + height: 25px; + line-height: 25px; + font-size: 12px; + text-align: center; + color: #333; + padding: 0px 10px; + margin: 10px 0; + border: 1px solid #ccc; + border-radius: 40px; + display: inline-block; + } + } + /* 弹出层用于查看完整评论,设置了固定定位、z-index、背景色、内边距 */ + .cmt-popup { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 998; + background-color: #fff; + padding-bottom: 98rpx; + /* 弹出层内的评论内容,设置了高度、溢出滚动 */ + .cmt-cont { + height: calc(100% - 80rpx); + overflow: auto; + } + /* 弹出层内的评论内容,增加了行数限制和最大高度 */ + .cmt-cnt { + -webkit-line-clamp: 20; + max-height: 500px; + } + /* 加载更多按钮,设置了字体大小、内边距、文本对齐、边距、边框、圆角 */ + .load-more { + font-size: 14px; + padding: 20px; + text-align: center; + margin-bottom: 10px; + /* 按钮文本,设置了边框、内边距、圆角和颜色 */ + text { + border: 1px solid #ddd; + padding: 5px 10px; + border-radius: 10px; + color: #666; + } } } } +. /* 评论回复部分,设置了字体大小、上边框(虚线)、上下内边距 */ .cmt-reply { font-size: 14px; border-top: 1px dashed #ddd; padding: 5px 0; + /* 回复标题,红色字体强调 */ .reply-tit { color: #eb2444; } } + +/* 产品详情部分,设置了背景色、上外边距、相对定位和行高 */ .prod-detail { background: #fff; margin-top: 20rpx; position: relative; line-height: 48rpx; + /* 详情图片,宽度设为750rpx并确保是块级元素显示 */ image { width: 750rpx !important; display: block; } } + +/* 富文本组件内的图片,确保宽度为100%以适应父容器 */ rich-text { image { width: 100% !important; } } + +/* 深度选择器,用于覆盖第三方组件或库的样式,确保图片宽度为100%并作为块级元素显示 */ :deep(.img) { width: 100% !important; display: block; } + +/* 购物车底部固定栏,设置了固定位置、底部对齐、宽度、弹性布局、高度、z-index和阴影效果 */ .cart-footer { position: fixed; bottom: 0; @@ -342,6 +403,7 @@ rich-text { height: 98rpx; z-index: 999; box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); + /* 按钮,设置了相对定位、弹性增长、内容居中、宽度、背景色、字体大小和列式布局 */ .btn { position: relative; display: flex; @@ -352,6 +414,7 @@ rich-text { background-color: #fff; font-size: 28rpx; flex-flow: column; + /* 徽章,绝对定位的小圆圈,用于展示数字,如购物车商品数量 */ .badge { position: absolute; top: 20rpx; @@ -366,30 +429,37 @@ rich-text { font-size: 18rpx; color: #fff; } + /* 稍大一点的徽章 */ .badge-1 { width: 36rpx; } } + /* 图标按钮,不随其他按钮拉伸,设置了固定宽度、字体大小和颜色 */ .btn.icon { flex-grow: 0; flex-shrink: 0; width: 125rpx; font-size: 20rpx; color: #666; + /* 图标按钮内的图片,设置了宽度和高度 */ image { width: 50rpx; height: 50rpx; } } + /* 购物车按钮,设置了背景色和文字颜色 */ .btn.cart { background: #584e61; color: #fff; } + /* 立即购买按钮,设置了背景色和文字颜色 */ .btn.buy { background: #eb2444; color: #fff; } } + +/* 关闭按钮,设置了颜色、圆角、行高、文本对齐、高度、宽度、字体大小、内边距、位置和伪元素内容 */ .close { color: #aaa; border-radius: 12px; @@ -402,15 +472,20 @@ rich-text { top: 10px; right: 10px; position: absolute; + /* 伪元素,设置关闭符号 */ &::before { content: "\2716"; } } + +/* 弹出层内容区,设置了最大高度、溢出滚动和左右内边距 */ .popup-cnt { max-height: 429px; overflow: auto; padding: 0 10px; } + +/* SKU弹出层背景,设置了固定位置、全屏尺寸、z-index和半透明黑色背景 */ .pup-sku { position: fixed; top: 0; @@ -420,6 +495,8 @@ rich-text { z-index: 999; background-color: rgba(0, 0, 0, 0.3); } + +/* SKU弹出层主要内容,绝对定位在屏幕底部,设置了宽度、最小和最大高度、白色背景 */ .pup-sku-main { position: absolute; bottom: 0; @@ -428,6 +505,8 @@ rich-text { max-height: 475px; background-color: #fff; } + +/* SKU弹出层头部,设置了相对定位、行高、字体大小、颜色、高度、内边距和背景色 */ .pup-sku-header { position: relative; line-height: 46px; @@ -437,6 +516,8 @@ rich-text { padding: 0 0 10px 110px; background-color: #fff; } + +/* SKU弹出层中的产品图片,设置了绝对定位、左上偏移、圆角、宽度、高度和垂直对齐 */ .pup-sku-img { position: absolute; left: 10px; @@ -447,6 +528,8 @@ rich-text { border: 0 none; vertical-align: top; } + +/* SKU弹出层价格,设置了行内块显示、高度、行高、颜色和字体大小 */ .pup-sku-price { display: inline-block; height: 40px; @@ -454,9 +537,13 @@ rich-text { color: #e4393c; font-size: 10px; } + +/* SKU弹出层价格整数部分,加大字体 */ .pup-sku-price-int { font-size: 16px; } + +/* SKU弹出层属性描述,允许单词断开,设置了字体大小、颜色、行高、右边距、溢出隐藏、文本溢出处理和弹性盒子模型属性 */ .pup-sku-prop { word-break: break-all; font-size: 12px; @@ -468,17 +555,22 @@ rich-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; + /* 属性描述中的文本,设置了颜色和右边距 */ text { color: #999; margin-right: 5px; } } + +/* SKU弹出层主体内容,设置了盒模型属性、最大高度、下内边距和溢出滚动 */ .pup-sku-body { box-sizing: border-box; max-height: 379px; padding-bottom: 100px; overflow: auto; } + +/* SKU区域,设置了字体大小、颜色、内外边距和高度 */ .pup-sku-area { .sku-kind { font-size: 12px; @@ -487,11 +579,14 @@ rich-text { height: 40px; line-height: 40px; } + /* SKU选择项容器,设置了溢出隐藏和底边距 */ .sku-choose { overflow: hidden; margin-bottom: 3px; } } + +/* SKU选择项,设置了行内块显示、内边距、最小和最大宽度、高度、文本对齐、左边距、底边距、圆角、颜色、背景色和字体大小 */ .sku-choose-item { display: inline-block; padding: 0 10px; @@ -508,23 +603,31 @@ rich-text { background-color: #f7f7f7; font-size: 14px; } + +/* 当SKU选择项被选中时,改变背景色和字体颜色 */ .sku-choose-item.active { background-color: #eb2444; color: #fff; } + +/* 当SKU选择项不可用时,改变背景色和字体颜色 */ .sku-choose-item.gray { background-color: #f9f9f9; color: #ddd; } + +/* SKU弹出层数量选择部分,设置了内边距和字体大小 */ .pup-sku-count { padding: 0 10px 13px; font-size: 12px; + /* 数量名称标签,设置了颜色、高度、行高和宽度 */ .count-name { color: #999; height: 31px; line-height: 31px; width: 100rpx; } + /* 数量选择器包裹,设置了相对定位、宽度、浮动和垂直对齐 */ .num-wrap { position: relative; z-index: 0; @@ -533,11 +636,13 @@ rich-text { vertical-align: middle; display: flex; } + /* 输入框包裹,设置了相对定位、宽度、z-index和左右内边距 */ .text-wrap { position: relative; width: 45px; z-index: 0; margin: 0 1px; + /* 输入框,设置了高度、宽度、颜色、背景、字体大小、文本对齐、无边框和背景色 */ input { height: 30px; width: 100%; @@ -550,8 +655,11 @@ rich-text { } } } + +/* 数量选择器的减号和加号按钮,设置了相对定位、最大最小宽度、高度、行高、背景色、文本对齐、圆角 */ .num-wrap { - .minus { + .minus, + .plus { position: relative; max-width: 30px; min-width: 30px; @@ -559,20 +667,18 @@ rich-text { line-height: 30px; background: #f7f7f7; text-align: center; + } + /* 减号按钮,设置了左上和左下圆角 */ + .minus { border-top-left-radius: 3px; border-bottom-left-radius: 3px; } + /* 加号按钮,设置了右上和右下圆角 */ .plus { - position: relative; - max-width: 30px; - min-width: 30px; - height: 30px; - line-height: 30px; - background: #f7f7f7; - text-align: center; border-top-right-radius: 3px; border-bottom-right-radius: 3px; } + /* 行元素,创建加号的横线,设置了圆角、绝对定位、顶部和左侧偏移、宽度、高度和背景色 */ .row { border-radius: 20px; position: absolute; @@ -584,6 +690,7 @@ rich-text { height: 2px; background-color: #ccc; } + /* 列元素,创建加号的竖线,设置了圆角、绝对定位、顶部和左侧偏移、宽度、高度和背景色 */ .col { border-radius: 20px; position: absolute; @@ -596,6 +703,8 @@ rich-text { background-color: #999; } } + +/* SKU弹出层底部固定栏,设置了固定位置、底部对齐、宽度、弹性布局、高度、z-index和阴影效果 */ .pup-sku-footer { position: fixed; bottom: 0; @@ -606,6 +715,7 @@ rich-text { height: 98rpx; z-index: 999; box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); + /* 按钮,设置了相对定位、弹性增长、内容居中、宽度、背景色、字体大小和列式布局 */ .btn { position: relative; display: flex; @@ -617,10 +727,12 @@ rich-text { font-size: 28rpx; flex-flow: column; } + /* 购物车按钮,设置了背景色和文字颜色 */ .btn.cart { background: #584e61; color: #fff; } + /* 立即购买按钮,设置了背景色和文字颜色 */ .btn.buy { background: #eb2444; color: #fff; diff --git a/front-end/mall4uni/src/pages/prod/prod.vue b/front-end/mall4uni/src/pages/prod/prod.vue index 576998e..9941e85 100644 --- a/front-end/mall4uni/src/pages/prod/prod.vue +++ b/front-end/mall4uni/src/pages/prod/prod.vue @@ -1,260 +1,157 @@ - - - + http.request({ + url: '/p/shopCart/changeItem', + method: 'POST', + data: { + basketId: 0, + count: prodNum.value, + prodId, + shopId, + skuId: defaultSku.value.skuId + } + }) + .then(() => { + totalCartNum.value = totalCartNum.value + prodNum.value + uni.hideLoading() + uni.showToast({ + title: '加入购物车成功', + icon: 'none' + }) + }) + } + + /** + * 立即购买 + */ + const buyNow = () => { + uni.setStorageSync('orderItem', JSON.stringify({ + prodId, + skuId: defaultSku.value.skuId, + prodCount: prodNum.value, + shopId + })) + uni.navigateTo({ + url: '/pages/submit-order/submit-order?orderEntry=1' + }) + } + + /** + * 减数量 + */ + const onCountMinus = () => { + if (prodNum.value > 1) { + prodNum.value = prodNum.value - 1 + } + } + + /** + * 加数量 + */ + const onCountPlus = () => { + if (prodNum.value < 1000) { + prodNum.value = prodNum.value + 1 + } + } + + const skuShow = ref(false) + const showSku = () => { + skuShow.value = true + } + + const commentShow = ref(false) + const showComment = () => { + commentShow.value = true + } + + const closePopup = () => { + skuShow.value = false + commentShow.value = false + } + + + diff --git a/front-end/mall4uni/src/pages/recent-news/recent-news.scss b/front-end/mall4uni/src/pages/recent-news/recent-news.scss index f6dbc96..736da00 100644 --- a/front-end/mall4uni/src/pages/recent-news/recent-news.scss +++ b/front-end/mall4uni/src/pages/recent-news/recent-news.scss @@ -1,34 +1,40 @@ .recent-news { - background: #fff; + background: #fff; /* 设置最近新闻容器的背景颜色为白色 */ + .news-item { - padding: 20rpx 20rpx 0 20rpx; - position: relative; + padding: 20rpx 20rpx 0 20rpx; /* 内边距:上20rpx,左右各20rpx,下0rpx */ + position: relative; /* 使子元素可以相对于此元素进行绝对定位 */ + &::after { - content: " "; - width: 100%; - height: 2rpx; - background-color: #e1e1e1; - left: 20rpx; - display: block; - position: absolute; + content: " "; /* 生成一个伪元素 */ + width: 100%; /* 伪元素宽度为100% */ + height: 2rpx; /* 伪元素高度为2rpx,作为分隔线 */ + background-color: #e1e1e1; /* 分隔线的颜色为浅灰色 */ + left: 20rpx; /* 从左边开始20rpx,与父元素内边距对齐 */ + display: block; /* 伪元素作为块级元素显示 */ + position: absolute; /* 伪元素绝对定位,相对于父元素 */ + bottom: 0; /* 伪元素位于父元素底部 */ } + .news-item-title { - font-size: 28rpx; - text-align: left; + font-size: 28rpx; /* 新闻标题字体大小为28rpx */ + text-align: left; /* 文字左对齐 */ } + .news-item-date { - font-size: 24rpx; - color: #999; - text-align: right; - margin-top: 10rpx; - margin-bottom: 20rpx; + font-size: 24rpx; /* 日期字体大小为24rpx */ + color: #999; /* 日期颜色为浅灰色 */ + text-align: right; /* 文字右对齐 */ + margin-top: 10rpx; /* 上边距为10rpx */ + margin-bottom: 20rpx; /* 下边距为20rpx */ } } + .empty { - display: block; - padding-top: 200rpx; - color: #999; - font-size: 26rpx; - text-align: center; + display: block; /* 空状态提示作为块级元素显示 */ + padding-top: 200rpx; /* 上内边距为200rpx,用于居中显示空状态提示 */ + color: #999; /* 文字颜色为浅灰色 */ + font-size: 26rpx; /* 字体大小为26rpx */ + text-align: center; /* 文字水平居中 */ } } diff --git a/front-end/mall4uni/src/pages/recent-news/recent-news.vue b/front-end/mall4uni/src/pages/recent-news/recent-news.vue index 779d20a..07a39b2 100644 --- a/front-end/mall4uni/src/pages/recent-news/recent-news.vue +++ b/front-end/mall4uni/src/pages/recent-news/recent-news.vue @@ -1,60 +1,62 @@ diff --git a/front-end/mall4uni/src/pages/register/register.scss b/front-end/mall4uni/src/pages/register/register.scss index fdbdd26..28c8616 100644 --- a/front-end/mall4uni/src/pages/register/register.scss +++ b/front-end/mall4uni/src/pages/register/register.scss @@ -1,124 +1,146 @@ +/* 容器样式 */ .con { - background: #fff; - height: 100%; - margin-top: 50px; + background: #fff; /* 设置容器的背景颜色为白色 */ + height: 100%; /* 容器的高度占满父元素的100% */ + margin-top: 50px; /* 容器与页面顶部的距离为50像素 */ } + +/* 图像样式 */ image { - display: block; - width: 150rpx; - height: 150rpx; - margin: auto; - border-radius: 50%; - width: 150rpx; - height: 150rpx; - margin-bottom: 8%; + display: block; /* 确保图像作为块级元素显示,避免与其他元素在同一行 */ + width: 150rpx; /* 图像宽度为150响应式像素 */ + height: 150rpx; /* 图像高度为150响应式像素 */ + margin: auto; /* 使图像水平居中 */ + border-radius: 50%; /* 将图像设置为圆形(50%创建一个圆形) */ + width: 150rpx; /* 重复定义图像宽度为150响应式像素 */ + height: 150rpx; /* 重复定义图像高度为150响应式像素 */ + margin-bottom: 8%; /* 图像底部外边距为父元素高度的8% */ } + +/* 登录表单样式 */ .login-form { - width: 90%; - margin: 0 auto; - margin-bottom: 20%; + width: 90%; /* 表单宽度为父元素宽度的90% */ + margin: 0 auto; /* 表单左右外边距自动,实现水平居中 */ + margin-bottom: 20%; /* 表单底部外边距为父元素高度的20%,确保与下方内容有足够的间距 */ } + +/* 授权按钮样式 */ .authorized-btn { - width: 90%; - margin: 0 auto; - text-align: center; - background-color: #0ab906; - border: 1rpx solid #0ab906; - color: #fff; - border-radius: 6rpx; - font-size: 26rpx; - padding: 8rpx; - margin-top: 80rpx; - border: 1rpx solid #0ab906; - border-radius: 6rpx; - font-size: 26rpx; - padding: 8rpx; - margin-top: 80rpx; + width: 90%; /* 按钮宽度为父元素宽度的90% */ + margin: 0 auto; /* 按钮左右外边距自动,实现水平居中 */ + text-align: center; /* 按钮内的文本居中对齐 */ + background-color: #0ab906; /* 按钮背景颜色设置为绿色 */ + border: 1rpx solid #0ab906; /* 按钮边框为1响应式像素宽,颜色为绿色 */ + color: #fff; /* 按钮文字颜色设置为白色 */ + border-radius: 6rpx; /* 按钮边角圆滑度,半径为6响应式像素 */ + font-size: 26rpx; /* 按钮文字大小设置为26响应式像素 */ + padding: 8rpx; /* 按钮内边距,即文字与按钮边缘之间的距离 */ + margin-top: 80rpx; /* 按钮顶部外边距为80响应式像素 */ + border: 1rpx solid #0ab906; /* 重复定义按钮边框为1响应式像素宽,颜色为绿色 */ + border-radius: 6rpx; /* 重复定义按钮边角圆滑度,半径为6响应式像素 */ + font-size: 26rpx; /* 重复定义按钮文字大小为26响应式像素 */ + padding: 8rpx; /* 重复定义按钮内边距 */ + margin-top: 80rpx; /* 重复定义按钮顶部外边距 */ } + +/* 返回首页按钮样式 */ .to-idx-btn { - width: 90%; - margin: 0 auto; - text-align: center; - background-color: #eeeeee; - color: #333; - border-radius: 6rpx; - font-size: 26rpx; - padding: 8rpx; - margin-top: 30rpx; - border-radius: 6rpx; - font-size: 26rpx; - padding: 8rpx; - margin-top: 30rpx; + width: 90%; /* 按钮宽度为父元素宽度的90% */ + margin: 0 auto; /* 按钮左右外边距自动,实现水平居中 */ + text-align: center; /* 按钮内的文本居中对齐 */ + background-color: #eeeeee; /* 按钮背景颜色设置为浅灰色 */ + color: #333; /* 按钮文字颜色设置为深灰色 */ + border-radius: 6rpx; /* 按钮边角圆滑度,半径为6响应式像素 */ + font-size: 26rpx; /* 按钮文字大小设置为26响应式像素 */ + padding: 8rpx; /* 按钮内边距,即文字与按钮边缘之间的距离 */ + margin-top: 30rpx; /* 按钮顶部外边距为30响应式像素 */ + border-radius: 6rpx; /* 重复定义按钮边角圆滑度,半径为6响应式像素 */ + font-size: 26rpx; /* 重复定义按钮文字大小为26响应式像素 */ + padding: 8rpx; /* 重复定义按钮内边距 */ + margin-top: 30rpx; /* 重复定义按钮顶部外边距 */ } + +/* 表单标题样式 */ .form-title { - width: 100%; - margin-bottom: 50rpx; - font-size: 32rpx; - text-align: center; - color: #00a0e9; - margin-bottom: 50rpx; - font-size: 32rpx; + width: 100%; /* 标题宽度为100%,即占满整个父元素的宽度 */ + margin-bottom: 50rpx; /* 标题底部外边距为50响应式像素 */ + font-size: 32rpx; /* 标题字体大小设置为32响应式像素 */ + text-align: center; /* 标题文本居中对齐 */ + color: #00a0e9; /* 标题文字颜色设置为蓝色 */ + margin-bottom: 50rpx; /* 重复定义标题底部外边距为50响应式像素 */ + font-size: 32rpx; /* 重复定义标题字体大小为32响应式像素 */ } + +/* 表单项样式 */ .item { - display: block; - margin-bottom: 30rpx; - margin-bottom: 30rpx; + display: block; /* 确保每个表单项作为一个单独的块级元素显示 */ + margin-bottom: 30rpx; /* 每个表单项底部外边距为30响应式像素 */ + margin-bottom: 30rpx; /* 重复定义每个表单项底部外边距为30响应式像素 */ } + +/* 账号输入框样式 */ .account { - display: flex; - background: #f8f8f8; - padding: 15rpx; - box-sizing: border-box; - font-size: 26rpx; - align-items: center; + display: flex; /* 使用弹性布局来排列子元素 */ + background: #f8f8f8; /* 输入框背景颜色设置为浅灰色 */ + padding: 15rpx; /* 输入框内边距为15响应式像素 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + font-size: 26rpx; /* 输入框内的字体大小设置为26响应式像素 */ + align-items: center; /* 子元素垂直居中对齐 */ + input { - padding-left: 20rpx; - width: 75%; - padding-left: 20rpx; + padding-left: 20rpx; /* 输入框内部左侧留出20响应式像素的空间 */ + width: 75%; /* 输入框宽度为父元素宽度的75% */ + padding-left: 20rpx; /* 重复定义输入框内部左侧留出20响应式像素的空间 */ } } -button { - &::after { - border: 0 !important; - } + +/* 移除按钮默认边框 */ +button::after { + border: 0 !important; /* 移除按钮点击时出现的默认边框,使用!important确保覆盖其他样式 */ } + +/* 操作区域样式 */ .operate { - display: flex; - justify-content: space-between; - align-items: center; + display: flex; /* 使用弹性布局来排列子元素 */ + justify-content: space-between; /* 子元素之间均匀分布,两端对齐 */ + align-items: center; /* 子元素垂直居中对齐 */ } +/* 注册链接样式 */ .to-register { - font-size: 28rpx; - color: #00AAFF; - font-size: 28rpx; + font-size: 28rpx; /* 链接字体大小设置为28响应式像素 */ + color: #00AAFF; /* 链接文字颜色设置为蓝色 */ + font-size: 28rpx; /* 重复定义链接字体大小为28响应式像素 */ } + +/* 错误提示样式 */ .error { .error-text { - display: block; - width: 100%; - font-size: 28rpx; - color: #e43130; - text-align: left; - margin-top: 10rpx; - font-size: 28rpx; - margin-top: 10rpx; + display: block; /* 错误信息作为块级元素显示 */ + width: 100%; /* 错误信息宽度为100%,即占满整个父元素的宽度 */ + font-size: 28rpx; /* 错误信息字体大小设置为28响应式像素 */ + color: #e43130; /* 错误信息文字颜色设置为红色 */ + text-align: left; /* 错误信息文本左对齐 */ + margin-top: 10rpx; /* 错误信息顶部外边距为10响应式像素 */ + font-size: 28rpx; /* 重复定义错误信息字体大小为28响应式像素 */ + margin-top: 10rpx; /* 重复定义错误信息顶部外边距 */ + .warning-icon { - display: inline-block; - color: #fff; - width: 26rpx; - height: 26rpx; - line-height: 26rpx; - background: #e43130; - border-radius: 50%; - text-align: center; - margin-right: 12rpx; - font-size: 22rpx; - width: 26rpx; - height: 26rpx; - line-height: 26rpx; - margin-right: 12rpx; - font-size: 22rpx; + display: inline-block; /* 警告图标作为行内块级元素显示 */ + color: #fff; /* 警告图标文字颜色设置为白色 */ + width: 26rpx; /* 警告图标宽度为26响应式像素 */ + height: 26rpx; /* 警告图标高度为26响应式像素 */ + line-height: 26rpx; /* 警告图标行高设置为26响应式像素,以确保文字垂直居中 */ + background: #e43130; /* 警告图标背景颜色设置为红色 */ + border-radius: 50%; /* 警告图标边角设置为圆形 */ + text-align: center; /* 警告图标文字居中对齐 */ + margin-right: 12rpx; /* 警告图标右侧留出12响应式像素的空间 */ + font-size: 22rpx; /* 警告图标内的字体大小设置为22响应式像素 */ + width: 26rpx; /* 重复定义警告图标宽度为26响应式像素 */ + height: 26rpx; /* 重复定义警告图标高度为26响应式像素 */ + line-height: 26rpx; /* 重复定义警告图标行高 */ + margin-right: 12rpx; /* 重复定义警告图标右侧留出12响应式像素的空间 */ + font-size: 22rpx; /* 重复定义警告图标内的字体大小 */ } } } diff --git a/front-end/mall4uni/src/pages/register/register.vue b/front-end/mall4uni/src/pages/register/register.vue index c03c8f3..0b4a3f5 100644 --- a/front-end/mall4uni/src/pages/register/register.vue +++ b/front-end/mall4uni/src/pages/register/register.vue @@ -1,77 +1,68 @@ diff --git a/front-end/mall4uni/src/pages/search-page/search-page.scss b/front-end/mall4uni/src/pages/search-page/search-page.scss index 51687fd..eb18afe 100644 --- a/front-end/mall4uni/src/pages/search-page/search-page.scss +++ b/front-end/mall4uni/src/pages/search-page/search-page.scss @@ -1,119 +1,139 @@ +/* 搜索栏样式 */ .search-bar { - width: 100%; - position: fixed; - top: 0; - left: 0; - color: #777; - background: #fff; - box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.07); - z-index: 3; + width: 100%; /* 搜索栏宽度占满整个父元素 */ + position: fixed; /* 固定定位,使搜索栏始终位于页面顶部 */ + top: 0; /* 距离页面顶部0像素 */ + left: 0; /* 距离页面左侧0像素 */ + color: #777; /* 搜索栏内文本颜色为浅灰色 */ + background: #fff; /* 搜索栏背景颜色为白色 */ + box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.07); /* 添加轻微的阴影效果,增强立体感 */ + z-index: 3; /* 设置堆叠顺序,确保搜索栏在其他内容之上 */ + .search-box { - position: relative; - height: 60rpx; - background: #f7f7f7; - z-index: 999; - width: 80%; - margin-left: 70rpx; - border-radius: 50rpx; - margin: 20rpx 0 20rpx 20rpx; + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + height: 60rpx; /* 搜索框高度为60响应式像素 */ + background: #f7f7f7; /* 搜索框背景颜色为浅灰色 */ + z-index: 999; /* 设置较高的堆叠顺序,确保搜索框在其他元素之上 */ + width: 80%; /* 搜索框宽度为父元素宽度的80% */ + margin-left: 70rpx; /* 搜索框左侧外边距为70响应式像素 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + margin: 20rpx 0 20rpx 20rpx; /* 上下外边距为20响应式像素,右侧外边距为0,左侧外边距为20响应式像素 */ + .search-img { - width: 32rpx; - height: 32rpx; - position: absolute; - left: 20rpx; - top: 14rpx; - display: block; + width: 32rpx; /* 搜索图标宽度为32响应式像素 */ + height: 32rpx; /* 搜索图标高度为32响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + left: 20rpx; /* 搜索图标距离左侧20响应式像素 */ + top: 14rpx; /* 搜索图标距离顶部14响应式像素 */ + display: block; /* 确保图标作为块级元素显示 */ } } + .search-hint { - font-size: 28rpx; - position: absolute; - right: 30rpx; - top: 31rpx; - color: #eb2444; + font-size: 28rpx; /* 提示文本字体大小为28响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 30rpx; /* 提示文本距离右侧30响应式像素 */ + top: 31rpx; /* 提示文本距离顶部31响应式像素 */ + color: #eb2444; /* 提示文本颜色为红色 */ } } + +/* 搜索输入框样式 */ .sear-input { - height: 60rpx; - border-radius: 50rpx; - border: 0; - margin: 0 30rpx 0 64rpx; - line-height: 48rpx; - vertical-align: top; - background: #f7f7f7; - font-size: 28rpx; + height: 60rpx; /* 输入框高度为60响应式像素 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + border: 0; /* 移除默认边框 */ + margin: 0 30rpx 0 64rpx; /* 左右外边距分别为30和64响应式像素 */ + line-height: 48rpx; /* 行高设置为48响应式像素,确保文字垂直居中 */ + vertical-align: top; /* 垂直对齐方式为顶部 */ + background: #f7f7f7; /* 输入框背景颜色为浅灰色 */ + font-size: 28rpx; /* 输入框内的字体大小为28响应式像素 */ } + +/* 搜索结果显示区域样式 */ .search-display { - background: #fff; - padding: 20rpx; - margin-top: 100rpx; + background: #fff; /* 背景颜色为白色 */ + padding: 20rpx; /* 内边距为20响应式像素 */ + margin-top: 100rpx; /* 顶部外边距为100响应式像素,确保与搜索栏有足够的间距 */ + .title-text { - padding: 30rpx 0; - font-size: 30rpx; - color: #666; + padding: 30rpx 0; /* 上下内边距为30响应式像素 */ + font-size: 30rpx; /* 标题文本字体大小为30响应式像素 */ + color: #666; /* 标题文本颜色为深灰色 */ } } + +/* 热门搜索样式 */ .hot-search { .hot-search-tags { - overflow: hidden; - font-size: 26rpx; - text-align: center; - padding-bottom: 30rpx; + overflow: hidden; /* 隐藏超出容器的内容 */ + font-size: 26rpx; /* 标签字体大小为26响应式像素 */ + text-align: center; /* 标签文本居中对齐 */ + padding-bottom: 30rpx; /* 底部内边距为30响应式像素 */ + .tags { - display: block; - max-width: 100%; - overflow: hidden; - float: left; - border-radius: 50rpx; - white-space: nowrap; - text-overflow: ellipsis; - background-color: #f2f2f2; - box-sizing: border-box; - margin-right: 20rpx; - margin-bottom: 20rpx; - padding: 10rpx 30rpx; + display: block; /* 标签作为块级元素显示 */ + max-width: 100%; /* 标签最大宽度为100% */ + overflow: hidden; /* 隐藏超出标签的内容 */ + float: left; /* 标签左浮动,实现水平排列 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + white-space: nowrap; /* 防止文本换行 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + background-color: #f2f2f2; /* 标签背景颜色为浅灰色 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + margin-right: 20rpx; /* 右侧外边距为20响应式像素 */ + margin-bottom: 20rpx; /* 底部外边距为20响应式像素 */ + padding: 10rpx 30rpx; /* 内边距为10和30响应式像素 */ } } } + +/* 历史搜索样式 */ .history-search { .title-text.history-line { - position: relative; - border-top: 2rpx solid #e1e1e1; + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + border-top: 2rpx solid #e1e1e1; /* 顶部边框为2响应式像素宽,颜色为浅灰色 */ } + .his-search-tags { - overflow: hidden; - font-size: 26rpx; - text-align: center; - display: inline-block; + overflow: hidden; /* 隐藏超出容器的内容 */ + font-size: 26rpx; /* 标签字体大小为26响应式像素 */ + text-align: center; /* 标签文本居中对齐 */ + display: inline-block; /* 作为行内块级元素显示 */ + .tags { - max-width: 300rpx; - overflow: hidden; - float: left; - border-radius: 50rpx; - white-space: nowrap; - text-overflow: ellipsis; - background-color: #f2f2f2; - box-sizing: border-box; - margin-right: 20rpx; - margin-bottom: 20rpx; - padding: 10rpx 30rpx; + max-width: 300rpx; /* 标签最大宽度为300响应式像素 */ + overflow: hidden; /* 隐藏超出标签的内容 */ + float: left; /* 标签左浮动,实现水平排列 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + white-space: nowrap; /* 防止文本换行 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + background-color: #f2f2f2; /* 标签背景颜色为浅灰色 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + margin-right: 20rpx; /* 右侧外边距为20响应式像素 */ + margin-bottom: 20rpx; /* 底部外边距为20响应式像素 */ + padding: 10rpx 30rpx; /* 内边距为10和30响应式像素 */ } } } + +/* 清除历史记录按钮样式 */ .clear-history { image { - width: 32rpx; - height: 32rpx; - position: absolute; - right: 10rpx; - top: 30rpx; + width: 32rpx; /* 图标宽度为32响应式像素 */ + height: 32rpx; /* 图标高度为32响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 10rpx; /* 图标距离右侧10响应式像素 */ + top: 30rpx; /* 图标距离顶部30响应式像素 */ } } + +/* 搜索结果为空时的提示样式 */ .search-tit-empty { - display: block; - margin: 0 auto; - text-align: center; - width: 100%; - font-size: 24rpx; - color: #aaa; + display: block; /* 作为块级元素显示 */ + margin: 0 auto; /* 水平居中 */ + text-align: center; /* 文本居中对齐 */ + width: 100%; /* 宽度为100%,即占满整个父元素 */ + font-size: 24rpx; /* 提示文本字体大小为24响应式像素 */ + color: #aaa; /* 提示文本颜色为浅灰色 */ } diff --git a/front-end/mall4uni/src/pages/search-page/search-page.vue b/front-end/mall4uni/src/pages/search-page/search-page.vue index bacaa84..7b4e130 100644 --- a/front-end/mall4uni/src/pages/search-page/search-page.vue +++ b/front-end/mall4uni/src/pages/search-page/search-page.vue @@ -2,84 +2,86 @@ + - - + class="sear-input" + confirm-type="search" + :value="prodName" + @confirm="toSearchProdPage" + @input="getSearchContent" + /> + + + class="search-img" /> - + + @tap="goBackIndex" > 取消 + + 热门搜索 - + class="hot-search-tags" > + :key="index" > + :data-name="item.content" + @tap="onHistSearch" > - {{ item.title }} + {{ item.title }} - + + 暂无数据 - class="history-search" > - + 搜索历史 + + @tap="clearSearch" /> + + :key="index" > + :data-name="item" + @tap="onHistSearch" > - {{ item }} + {{ item }} @@ -89,95 +91,114 @@ diff --git a/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.scss b/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.scss index 56b4bfb..1067f73 100644 --- a/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.scss +++ b/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.scss @@ -1,184 +1,218 @@ +/* 容器样式 */ .container { - background: #f4f4f4; + background: #f4f4f4; /* 设置背景颜色为浅灰色 */ + .empty { - text-align: center; - color: #999; - font-size: 26rpx; + text-align: center; /* 文本居中对齐 */ + color: #999; /* 文本颜色为灰色 */ + font-size: 26rpx; /* 字体大小为26响应式像素 */ } + .empty.empty-top { - margin-top: 300rpx; + margin-top: 300rpx; /* 顶部外边距为300响应式像素,用于在页面顶部显示空状态时有足够的间距 */ } } + +/* 固定定位的盒子样式 */ .fixed-box { - position: fixed; - width: 100%; - top: 0; - z-index: 999; - background: #fff; + position: fixed; /* 固定定位,使盒子始终位于页面顶部 */ + width: 100%; /* 宽度占满整个父元素 */ + top: 0; /* 距离页面顶部0像素 */ + z-index: 999; /* 设置较高的堆叠顺序,确保盒子在其他内容之上 */ + background: #fff; /* 背景颜色为白色 */ + .tabs { - width: 100%; - height: 80rpx; - line-height: 80rpx; - padding: 10rpx 0; - z-index: 999; - background: #fff; + width: 100%; /* 宽度占满整个父元素 */ + height: 80rpx; /* 高度为80响应式像素 */ + line-height: 80rpx; /* 行高设置为80响应式像素,确保文本垂直居中 */ + padding: 10rpx 0; /* 上下内边距为10响应式像素 */ + z-index: 999; /* 设置较高的堆叠顺序,确保标签栏在其他内容之上 */ + background: #fff; /* 背景颜色为白色 */ + &::after { - content: ''; - background-color: #e1e1e1; - left: 0; - height: 1px; - transform-origin: 50% 100% 0; - bottom: 0; - position: absolute; - display: block; - width: 100%; + content: ''; /* 伪元素内容为空 */ + background-color: #e1e1e1; /* 伪元素背景颜色为浅灰色 */ + left: 0; /* 伪元素距离左侧0像素 */ + height: 1px; /* 伪元素高度为1像素 */ + transform-origin: 50% 100% 0; /* 伪元素变换原点为底部中心 */ + bottom: 0; /* 伪元素距离底部0像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + display: block; /* 确保伪元素作为块级元素显示 */ + width: 100%; /* 伪元素宽度为100%,即占满整个父元素 */ } + .tab-item { - display: inline-block; - width: 33.33%; - text-align: center; - font-size: 28rpx; + display: inline-block; /* 标签项作为行内块级元素显示 */ + width: 33.33%; /* 每个标签项占据父元素宽度的33.33%,实现三等分 */ + text-align: center; /* 文本居中对齐 */ + font-size: 28rpx; /* 字体大小为28响应式像素 */ } + .tab-item.on { - color: #eb2444; + color: #eb2444; /* 当前选中的标签项文本颜色为红色 */ } } } + +/* 搜索栏样式 */ .search-bar { - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - color: #777; - background: #fff; - z-index: 3; - padding: 0 30rpx; - box-sizing: border-box; - margin: 30rpx 0; + display: flex; /* 使用弹性布局 */ + align-items: center; /* 垂直居中对齐 */ + justify-content: space-between; /* 内容左右对齐 */ + width: 100%; /* 宽度占满整个父元素 */ + color: #777; /* 搜索栏内文本颜色为浅灰色 */ + background: #fff; /* 搜索栏背景颜色为白色 */ + z-index: 3; /* 设置堆叠顺序,确保搜索栏在其他内容之上 */ + padding: 0 30rpx; /* 左右内边距为30响应式像素 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + margin: 30rpx 0; /* 上下外边距为30响应式像素 */ + .search-box { - position: relative; - height: 60rpx; - background: #f7f7f7; - z-index: 999; - width: 80%; - border-radius: 50rpx; - margin-right: 30rpx; - flex: 1; + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + height: 60rpx; /* 搜索框高度为60响应式像素 */ + background: #f7f7f7; /* 搜索框背景颜色为浅灰色 */ + z-index: 999; /* 设置较高的堆叠顺序,确保搜索框在其他内容之上 */ + width: 80%; /* 搜索框宽度为父元素宽度的80% */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + margin-right: 30rpx; /* 右侧外边距为30响应式像素 */ + flex: 1; /* 搜索框占据剩余空间 */ + .search-img { - width: 32rpx; - height: 32rpx; - position: absolute; - left: 20rpx; - top: 14rpx; - display: block; + width: 32rpx; /* 搜索图标宽度为32响应式像素 */ + height: 32rpx; /* 搜索图标高度为32响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + left: 20rpx; /* 搜索图标距离左侧20响应式像素 */ + top: 14rpx; /* 搜索图标距离顶部14响应式像素 */ + display: block; /* 确保图标作为块级元素显示 */ } } + .search-hint { - font-size: 28rpx; - position: absolute; - right: 30rpx; - top: 31rpx; - color: #eb2444; + font-size: 28rpx; /* 提示文本字体大小为28响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 30rpx; /* 提示文本距离右侧30响应式像素 */ + top: 31rpx; /* 提示文本距离顶部31响应式像素 */ + color: #eb2444; /* 提示文本颜色为红色 */ } + .search-list-img { - width: 40rpx; - height: 40rpx; - font-size: 0; + width: 40rpx; /* 图标宽度为40响应式像素 */ + height: 40rpx; /* 图标高度为40响应式像素 */ + font-size: 0; /* 移除默认字体大小,防止影响图标显示 */ image { - width: 100%; - height: 100%; + width: 100%; /* 图片宽度为100%,即占满父元素 */ + height: 100%; /* 图片高度为100%,即占满父元素 */ } } } + +/* 搜索输入框样式 */ .sear-input { - height: 60rpx; - border-radius: 50rpx; - border: 0; - margin: 0 30rpx 0 64rpx; - line-height: 48rpx; - vertical-align: top; - background: #f7f7f7; - font-size: 28rpx; + height: 60rpx; /* 输入框高度为60响应式像素 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + border: 0; /* 移除默认边框 */ + margin: 0 30rpx 0 64rpx; /* 左右外边距分别为30和64响应式像素 */ + line-height: 48rpx; /* 行高设置为48响应式像素,确保文字垂直居中 */ + vertical-align: top; /* 垂直对齐方式为顶部 */ + background: #f7f7f7; /* 输入框背景颜色为浅灰色 */ + font-size: 28rpx; /* 输入框内的字体大小为28响应式像素 */ } + +/* 商品展示区域样式 */ .prod-show { - background: #fff; + background: #fff; /* 背景颜色为白色 */ + .prod-items { - float: left; - background: #fff; - padding-bottom: 20rpx; - box-sizing: border-box; + float: left; /* 商品项左浮动,实现水平排列 */ + background: #fff; /* 商品项背景颜色为白色 */ + padding-bottom: 20rpx; /* 底部内边距为20响应式像素 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ } } + .prod-items { - margin: 0 20rpx; + margin: 0 20rpx; /* 左右外边距为20响应式像素 */ } + +/* 热销商品容器样式 */ .hotsale-item-cont { - display: flex; - flex-wrap: wrap; - justify-content: space-between; + display: flex; /* 使用弹性布局 */ + flex-wrap: wrap; /* 允许换行 */ + justify-content: space-between; /* 内容左右对齐 */ } + +/* 商品列表样式 */ .prod-list { - padding-top: 150rpx; - min-height: calc(100vh - 150rpx); + padding-top: 150rpx; /* 顶部内边距为150响应式像素,确保与固定头部有足够的间距 */ + min-height: calc(100vh - 150rpx); /* 最小高度为视口高度减去150响应式像素 */ + .cont-item { - padding: 0 20rpx 20rpx 20rpx; + padding: 0 20rpx 20rpx 20rpx; /* 内边距为上下20响应式像素,左右20响应式像素 */ + .show-item { .more-prod-pic { - text-align: center; - width: 170rpx; - height: 170rpx; - font-size: 0; + text-align: center; /* 图片文本居中对齐 */ + width: 170rpx; /* 图片容器宽度为170响应式像素 */ + height: 170rpx; /* 图片容器高度为170响应式像素 */ + font-size: 0; /* 移除默认字体大小,防止影响图片显示 */ + .more-pic { - width: 100%; - height: 100%; - vertical-align: middle; + width: 100%; /* 图片宽度为100%,即占满父元素 */ + height: 100%; /* 图片高度为100%,即占满父元素 */ + vertical-align: middle; /* 图片垂直居中对齐 */ } } - position: relative; - display: flex; - justify-content: flex-start; - padding: 20rpx; - border-radius: 20rpx; - background: #fff; - margin-bottom: 20rpx; - box-shadow: 0 16rpx 32rpx 0 rgba(7, 17, 27, 0.05); + + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + display: flex; /* 使用弹性布局 */ + justify-content: flex-start; /* 内容左对齐 */ + padding: 20rpx; /* 内边距为20响应式像素 */ + border-radius: 20rpx; /* 圆角边框,半径为20响应式像素 */ + background: #fff; /* 背景颜色为白色 */ + margin-bottom: 20rpx; /* 底部外边距为20响应式像素 */ + box-shadow: 0 16rpx 32rpx 0 rgba(7, 17, 27, 0.05); /* 添加轻微的阴影效果,增强立体感 */ + .prod-text-right { - margin-left: 20rpx; - width: 75%; + margin-left: 20rpx; /* 左侧外边距为20响应式像素 */ + width: 75%; /* 占据父元素宽度的75% */ + .cate-prod-info { - font-size: 22rpx; - color: #999; - margin: 10rpx 0 20rpx 0; + font-size: 22rpx; /* 字体大小为22响应式像素 */ + color: #999; /* 文本颜色为灰色 */ + margin: 10rpx 0 20rpx 0; /* 上下外边距分别为10和20响应式像素 */ } + .go-to-buy { - font-size: 26rpx; - background: #eb2444; - color: #fff; - border-radius: 50rpx; - width: 150rpx; - text-align: center; - padding: 8rpx 3rpx; - position: absolute; - right: 20rpx; - bottom: 20rpx; + font-size: 26rpx; /* 字体大小为26响应式像素 */ + background: #eb2444; /* 背景颜色为红色 */ + color: #fff; /* 文本颜色为白色 */ + border-radius: 50rpx; /* 圆角边框,半径为50响应式像素 */ + width: 150rpx; /* 宽度为150响应式像素 */ + text-align: center; /* 文本居中对齐 */ + padding: 8rpx 3rpx; /* 内边距为8和3响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 20rpx; /* 按钮距离右侧20响应式像素 */ + bottom: 20rpx; /* 按钮距离底部20响应式像素 */ } + .prod-text.more { - margin: 0; - height: 78rpx; - font-size: 28rpx; - display: -webkit-box; - word-break: break-all; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - color: #000; + margin: 0; /* 移除默认外边距 */ + height: 78rpx; /* 高度为78响应式像素 */ + font-size: 28rpx; /* 字体大小为28响应式像素 */ + display: -webkit-box; /* 使用Webkit的多行文本溢出处理 */ + word-break: break-all; /* 允许单词内断行 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + display: -webkit-box; /* 重复声明以确保兼容性 */ + -webkit-line-clamp: 2; /* 限制显示两行文本 */ + -webkit-box-orient: vertical; /* 文本方向为垂直 */ + color: #000; /* 文本颜色为黑色 */ } + .prod-price.more { - font-size: 28rpx; - color: #eb2444; - font-family: arial; + font-size: 28rpx; /* 字体大小为28响应式像素 */ + color: #eb2444; /* 文本颜色为红色 */ + font-family: arial; /* 字体系列为Arial */ } } } diff --git a/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.vue b/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.vue index c41c936..d065c7b 100644 --- a/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.vue +++ b/front-end/mall4uni/src/pages/search-prod-show/search-prod-show.vue @@ -2,54 +2,52 @@ + + - - + + class="sear-input" + :value="prodName" + confirm-type="search" + @input="getSearchContent" + @confirm="toSearchConfirm" + /> + + class="search-img" /> - + @tap="changeShowType" > + src="@/static/images/icon/search-col.png" /> + src="@/static/images/icon/search-col2.png" /> - + + data-sts="0" + @tap="onStsTap" > 综合 - + data-sts="1" + @tap="onStsTap" > 销量 - + data-sts="2" + @tap="onStsTap" > 价格 @@ -58,61 +56,54 @@ + - class="prod-show" > - + + :key="index" > + sts="6" /> - class="cont-item" > + :key="index" > + :data-prodid="item.prodId" + @tap="toProdPage" > - + + class="more-pic" /> - - - {{ item.prodName }} + + + {{ item.prodName }} - - {{ item.praiseNumber }}评价 {{ item.positiveRating }}%好评 + + {{ item.praiseNumber }}评价 {{ item.positiveRating }}%好评 - - - ¥ - - - {{ wxs.parsePrice(item.price)[0] }} - - - .{{ wxs.parsePrice(item.price)[1] }} - + + + {{ wxs.parsePrice(item.price)[0] }} + .{{ wxs.parsePrice(item.price)[1] }} @@ -120,9 +111,8 @@ - + :class="['empty', showType == 1 ? 'empty-top' : '']" > 暂无结果 @@ -131,93 +121,128 @@ diff --git a/front-end/mall4uni/src/pages/sub-category/sub-category.scss b/front-end/mall4uni/src/pages/sub-category/sub-category.scss index b4b2d57..261dd27 100644 --- a/front-end/mall4uni/src/pages/sub-category/sub-category.scss +++ b/front-end/mall4uni/src/pages/sub-category/sub-category.scss @@ -1,110 +1,138 @@ +/* 容器样式 */ .container { - background: #f4f4f4; + background: #f4f4f4; /* 设置背景颜色为浅灰色 */ } + +/* 分类标题栏样式 */ .category-tit { - width: 100%; - white-space: nowrap; - position: fixed; - top: 0px; - z-index: 999; - background-color: #fff; - border-bottom: 2rpx solid #f4f4f4; - font-size: 30rpx; + width: 100%; /* 宽度占满整个父元素 */ + white-space: nowrap; /* 禁止文本换行,确保所有分类项在一行显示 */ + position: fixed; /* 固定定位,使标题栏始终位于页面顶部 */ + top: 0px; /* 距离页面顶部0像素 */ + z-index: 999; /* 设置较高的堆叠顺序,确保标题栏在其他内容之上 */ + background-color: #fff; /* 背景颜色为白色 */ + border-bottom: 2rpx solid #f4f4f4; /* 底部边框,使用浅灰色实线 */ + font-size: 30rpx; /* 标题文字大小为30响应式像素 */ + .category-item { - display: inline-block; - padding: 20rpx 10rpx; - margin: 0 20rpx; - box-sizing: border-box; - font-size: 28rpx; + display: inline-block; /* 分类项作为行内块级元素显示,确保它们在同一行 */ + padding: 20rpx 10rpx; /* 内边距为上下20响应式像素,左右10响应式像素 */ + margin: 0 20rpx; /* 左右外边距为20响应式像素 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + font-size: 28rpx; /* 分类项文字大小为28响应式像素 */ } } -.prod-item { - height: calc(100vh - 100rpx); -} + +/* 当前选中的分类项样式 */ .on { - border-bottom: 4rpx solid #e43130; - color: #e43130; + border-bottom: 4rpx solid #e43130; /* 底部边框,使用红色实线,表示当前选中 */ + color: #e43130; /* 文本颜色为红色 */ +} + +/* 商品项容器样式 */ +.prod-item { + height: calc(100vh - 100rpx); /* 高度为视口高度减去100响应式像素,确保与固定头部有足够的间距 */ } + +/* 隐藏滚动条样式 */ ::-webkit-scrollbar { - width: 0; - height: 0; - color: transparent; + width: 0; /* 滚动条宽度为0 */ + height: 0; /* 滚动条高度为0 */ + color: transparent; /* 滚动条颜色为透明 */ } + +/* 空状态样式 */ .empty { - margin-top: 200rpx; + margin-top: 200rpx; /* 顶部外边距为200响应式像素,确保空状态提示在页面中间 */ } + +/* 商品项样式 */ .prod-items { - width: 345rpx; - display: inline-block; - background: #fff; - padding-bottom: 20rpx; - box-sizing: border-box; - box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); + width: 345rpx; /* 商品项宽度为345响应式像素 */ + display: inline-block; /* 作为行内块级元素显示,确保它们在同一行 */ + background: #fff; /* 背景颜色为白色 */ + padding-bottom: 20rpx; /* 底部内边距为20响应式像素 */ + box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */ + box-shadow: 0rpx 6rpx 8rpx rgba(58, 134, 185, 0.2); /* 添加轻微的阴影效果,增强立体感 */ + &:nth-child(2n-1) { - margin: 20rpx 10rpx 10rpx 20rpx; + margin: 20rpx 10rpx 10rpx 20rpx; /* 奇数商品项的外边距设置 */ } + &:nth-child(2n) { - margin: 20rpx 20rpx 10rpx 10rpx; + margin: 20rpx 20rpx 10rpx 10rpx; /* 偶数商品项的外边距设置 */ } + .hot-imagecont { .hotsaleimg { - width: 341rpx; - height: 341rpx; + width: 341rpx; /* 图片宽度为341响应式像素 */ + height: 341rpx; /* 图片高度为341响应式像素 */ } - font-size: 0; - text-align: center; + + font-size: 0; /* 移除默认字体大小,防止影响图片显示 */ + text-align: center; /* 图片居中对齐 */ } + .hot-text { .hotprod-text { - font-size: 28rpx; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + font-size: 28rpx; /* 商品名称文字大小为28响应式像素 */ + white-space: nowrap; /* 禁止文本换行 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ } - margin-top: 20rpx; - padding: 0 10rpx; + + margin-top: 20rpx; /* 顶部外边距为20响应式像素 */ + padding: 0 10rpx; /* 左右内边距为10响应式像素 */ + .prod-info { - min-height: 30rpx; - font-size: 22rpx; - color: #999; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + min-height: 30rpx; /* 最小高度为30响应式像素 */ + font-size: 22rpx; /* 商品信息文字大小为22响应式像素 */ + color: #999; /* 文本颜色为灰色 */ + white-space: nowrap; /* 禁止文本换行 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ } + .prod-text-info { - position: relative; - height: 70rpx; - line-height: 70rpx; - font-family: Arial; + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + height: 70rpx; /* 高度为70响应式像素 */ + line-height: 70rpx; /* 行高设置为70响应式像素,确保文本垂直居中 */ + font-family: Arial; /* 字体系列为Arial */ + .hotprod-price { - display: inline; - font-size: 26rpx; - color: #eb2444; + display: inline; /* 价格文本作为行内元素显示 */ + font-size: 26rpx; /* 价格文字大小为26响应式像素 */ + color: #eb2444; /* 价格颜色为红色 */ } + .basket-img { - width: 50rpx; - height: 50rpx; - position: absolute; - right: 0; - bottom: 7rpx; - padding: 8rpx; + width: 50rpx; /* 购物车图标宽度为50响应式像素 */ + height: 50rpx; /* 购物车图标高度为50响应式像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 0; /* 购物车图标距离右侧0像素 */ + bottom: 7rpx; /* 购物车图标距离底部7响应式像素 */ + padding: 8rpx; /* 内边距为8响应式像素 */ } } } } + +/* 更多商品样式 */ .more-prod { .prod-text-right { .prod-info { - font-size: 22rpx; - color: #999; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + font-size: 22rpx; /* 商品信息文字大小为22响应式像素 */ + color: #999; /* 文本颜色为灰色 */ + white-space: nowrap; /* 禁止文本换行 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ } } } + +/* 空状态占位样式 */ .empty-wrap { - color: #aaa; - text-align: center; - padding-top: 400rpx; + color: #aaa; /* 文本颜色为浅灰色 */ + text-align: center; /* 文本居中对齐 */ + padding-top: 400rpx; /* 顶部内边距为400响应式像素,确保空状态提示在页面中间 */ } diff --git a/front-end/mall4uni/src/pages/sub-category/sub-category.vue b/front-end/mall4uni/src/pages/sub-category/sub-category.vue index fa8ab78..6368320 100644 --- a/front-end/mall4uni/src/pages/sub-category/sub-category.vue +++ b/front-end/mall4uni/src/pages/sub-category/sub-category.vue @@ -1,71 +1,65 @@ diff --git a/front-end/mall4uni/src/pages/submit-order/submit-order.scss b/front-end/mall4uni/src/pages/submit-order/submit-order.scss index 97eadec..f82f12a 100644 --- a/front-end/mall4uni/src/pages/submit-order/submit-order.scss +++ b/front-end/mall4uni/src/pages/submit-order/submit-order.scss @@ -1,429 +1,489 @@ +/* 容器样式 */ .container { - background: #f4f4f4; + background: #f4f4f4; /* 设置背景颜色为浅灰色 */ } + +/* 提交订单区域样式 */ .submit-order { - margin-bottom: 100rpx; - padding-bottom: 160rpx; - .delivery-addr { - position: relative; - background: #fff; - .addr-icon { - width: 32rpx; - height: 32rpx; - display: block; - position: absolute; - left: 30rpx; - top: 24rpx; - image { - width: 100%; - height: 100%; + margin-bottom: 100rpx; /* 底部外边距为100响应式像素 */ + padding-bottom: 160rpx; /* 底部内边距为160响应式像素 */ + + .delivery-addr { /* 配送地址样式 */ + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + background: #fff; /* 背景颜色为白色 */ + + .addr-icon { /* 地址图标样式 */ + width: 32rpx; /* 图标宽度为32响应式像素 */ + height: 32rpx; /* 图标高度为32响应式像素 */ + display: block; /* 作为块级元素显示 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + left: 30rpx; /* 距离左侧30响应式像素 */ + top: 24rpx; /* 距离顶部24响应式像素 */ + + image { /* 图片样式 */ + width: 100%; /* 宽度占满父元素 */ + height: 100%; /* 高度占满父元素 */ } } - .user-info { - padding-top: 20rpx; - line-height: 48rpx; - word-wrap: break-word; - word-break: break-all; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - .item { - font-size: 30rpx; - margin-right: 30rpx; - vertical-align: top; - display: inline-block; + + .user-info { /* 用户信息样式 */ + padding-top: 20rpx; /* 顶部内边距为20响应式像素 */ + line-height: 48rpx; /* 行高设置为48响应式像素 */ + word-wrap: break-word; /* 允许长单词或URL地址换行到下一行 */ + word-break: break-all; /* 强制文本在任意字符处换行 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 1; /* 限制文本显示为1行 */ + -webkit-box-orient: vertical; /* 文本垂直排列 */ + + .item { /* 用户信息项样式 */ + font-size: 30rpx; /* 文字大小为30响应式像素 */ + margin-right: 30rpx; /* 右侧外边距为30响应式像素 */ + vertical-align: top; /* 垂直对齐方式为顶部 */ + display: inline-block; /* 作为行内块级元素显示 */ } } - .addr { - font-size: 26rpx; - line-height: 36rpx; - color: #999; - width: 90%; - padding-bottom: 20rpx; - margin-top: 15rpx; - word-wrap: break-word; + + .addr { /* 地址样式 */ + font-size: 26rpx; /* 文字大小为26响应式像素 */ + line-height: 36rpx; /* 行高设置为36响应式像素 */ + color: #999; /* 文本颜色为灰色 */ + width: 90%; /* 宽度为父元素的90% */ + padding-bottom: 20rpx; /* 底部内边距为20响应式像素 */ + margin-top: 15rpx; /* 顶部外边距为15响应式像素 */ + word-wrap: break-word; /* 允许长单词或URL地址换行到下一行 */ } - .arrow { - width: 15rpx; - height: 15rpx; - border-top: 2rpx solid #777; - border-right: 2rpx solid #777; - transform: rotate(45deg); - position: absolute; - right: 30rpx; - top: 60rpx; + + .arrow { /* 箭头样式 */ + width: 15rpx; /* 宽度为15响应式像素 */ + height: 15rpx; /* 高度为15响应式像素 */ + border-top: 2rpx solid #777; /* 上边框为2响应式像素宽的灰色实线 */ + border-right: 2rpx solid #777; /* 右边框为2响应式像素宽的灰色实线 */ + transform: rotate(45deg); /* 旋转45度形成箭头形状 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 30rpx; /* 距离右侧30响应式像素 */ + top: 60rpx; /* 距离顶部60响应式像素 */ } - .arrow.empty { - top: 39rpx; + + .arrow.empty { /* 空状态下的箭头样式 */ + top: 39rpx; /* 距离顶部39响应式像素 */ } } } -.delivery-addr { - .addr-bg { - .add-addr { - .plus-sign { - color: #eb2444; - border: 2rpx solid #eb2444; - padding: 0rpx 6rpx; - margin-right: 10rpx; + +.delivery-addr { /* 配送地址样式(重复定义,可能用于覆盖或扩展) */ + .addr-bg { /* 地址背景样式 */ + .add-addr { /* 添加地址按钮样式 */ + .plus-sign { /* 加号样式 */ + color: #eb2444; /* 文本颜色为红色 */ + border: 2rpx solid #eb2444; /* 边框为2响应式像素宽的红色实线 */ + padding: 0rpx 6rpx; /* 内边距为上下0响应式像素,左右6响应式像素 */ + margin-right: 10rpx; /* 右侧外边距为10响应式像素 */ } - font-size: 28rpx; - color: #666; - display: flex; - align-items: center; - padding: 30rpx 0; + + font-size: 28rpx; /* 文字大小为28响应式像素 */ + color: #666; /* 文本颜色为深灰色 */ + display: flex; /* 使用Flex布局 */ + align-items: center; /* 垂直居中对齐 */ + padding: 30rpx 0; /* 上下内边距为30响应式像素 */ } - padding: 0 30rpx; + + padding: 0 30rpx; /* 左右内边距为30响应式像素 */ } - .addr-bg.whole { - padding: 0 39rpx 0 77rpx; + + .addr-bg.whole { /* 整个地址背景样式 */ + padding: 0 39rpx 0 77rpx; /* 左右内边距分别为39响应式像素和77响应式像素 */ } } -.addr-bg { - .add-addr { - .plus-sign-img { - width: 32rpx; - height: 32rpx; - font-size: 0; - margin-right: 10rpx; - image { - width: 100%; - height: 100%; + +.addr-bg { /* 地址背景样式(重复定义,可能用于覆盖或扩展) */ + .add-addr { /* 添加地址按钮样式 */ + .plus-sign-img { /* 加号图片样式 */ + width: 32rpx; /* 宽度为32响应式像素 */ + height: 32rpx; /* 高度为32响应式像素 */ + font-size: 0; /* 移除默认字体大小,防止影响图片显示 */ + margin-right: 10rpx; /* 右侧外边距为10响应式像素 */ + + image { /* 图片样式 */ + width: 100%; /* 宽度占满父元素 */ + height: 100%; /* 高度占满父元素 */ } } } } -.prod-item { - background-color: #fff; - margin-top: 15rpx; - font-size: 28rpx; - .item-cont { - .prod-pic { - image { - width: 180rpx; - height: 180rpx; - width: 100%; - height: 100%; + +.prod-item { /* 商品项样式 */ + background-color: #fff; /* 背景颜色为白色 */ + margin-top: 15rpx; /* 顶部外边距为15响应式像素 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + + .item-cont { /* 商品内容样式 */ + .prod-pic { /* 商品图片样式 */ + image { /* 图片样式 */ + width: 180rpx; /* 宽度为180响应式像素 */ + height: 180rpx; /* 高度为180响应式像素 */ + width: 100%; /* 宽度占满父元素 */ + height: 100%; /* 高度占满父元素 */ } - font-size: 0; - display: block; - width: 160rpx; - height: 160rpx; - overflow: hidden; - background: #fff; - margin-right: 16rpx; + + font-size: 0; /* 移除默认字体大小,防止影响图片显示 */ + display: block; /* 作为块级元素显示 */ + width: 160rpx; /* 宽度为160响应式像素 */ + height: 160rpx; /* 高度为160响应式像素 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + background: #fff; /* 背景颜色为白色 */ + margin-right: 16rpx; /* 右侧外边距为16响应式像素 */ } - display: flex; - align-items: center; - padding: 30rpx; - border-bottom: 2rpx solid #f1f1f1; - .prod-info { - margin-left: 10rpx; - font-size: 28rpx; - width: 100%; - position: relative; - height: 160rpx; - -webkit-flex: 1; - -ms-flex: 1; - -webkit-box-flex: 1; - -moz-box-flex: 1; - flex: 1; - .prodname { - font-size: 28rpx; - line-height: 40rpx; - max-height: 86rpx; - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - text-overflow: ellipsis; - word-break: break-all; + + display: flex; /* 使用Flex布局 */ + align-items: center; /* 垂直居中对齐 */ + padding: 30rpx; /* 内边距为30响应式像素 */ + border-bottom: 2rpx solid #f1f1f1; /* 底部边框为2响应式像素宽的浅灰色实线 */ + + .prod-info { /* 商品信息样式 */ + margin-left: 10rpx; /* 左侧外边距为10响应式像素 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + width: 100%; /* 宽度占满父元素 */ + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + height: 160rpx; /* 高度为160响应式像素 */ + flex: 1; /* 占用剩余空间 */ + + .prodname { /* 商品名称样式 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + line-height: 40rpx; /* 行高设置为40响应式像素 */ + max-height: 86rpx; /* 最大高度为86响应式像素 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 2; /* 限制文本显示为2行 */ + -webkit-box-orient: vertical; /* 文本垂直排列 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + word-break: break-all; /* 强制文本在任意字符处换行 */ } - .prod-info-cont { - color: #999; - line-height: 40rpx; - margin-top: 10rpx; - font-size: 22rpx; - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - text-overflow: ellipsis; - word-break: break-all; + + .prod-info-cont { /* 商品信息内容样式 */ + color: #999; /* 文本颜色为灰色 */ + line-height: 40rpx; /* 行高设置为40响应式像素 */ + margin-top: 10rpx; /* 顶部外边距为10响应式像素 */ + font-size: 22rpx; /* 文字大小为22响应式像素 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 1; /* 限制文本显示为1行 */ + -webkit-box-orient: vertical; /* 文本垂直排列 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + word-break: break-all; /* 强制文本在任意字符处换行 */ } } } - .order-num { - padding: 20rpx 30rpx; - display: flex; - justify-content: space-between; - font-size: 28rpx; - .clear-btn { - width: 32rpx; - height: 32rpx; - font-size: 0; - vertical-align: top; - margin-top: 6rpx; - margin-left: 42rpx; - position: relative; - &::after { - content: " "; - display: block; - position: absolute; - left: -10px; - top: 1px; - width: 1px; - height: 12px; - background: #ddd; + + .order-num { /* 订单数量样式 */ + padding: 20rpx 30rpx; /* 内边距为上下20响应式像素,左右30响应式像素 */ + display: flex; /* 使用Flex布局 */ + justify-content: space-between; /* 水平两端对齐 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + + .clear-btn { /* 清空按钮样式 */ + width: 32rpx; /* 宽度为32响应式像素 */ + height: 32rpx; /* 高度为32响应式像素 */ + font-size: 0; /* 移除默认字体大小,防止影响图片显示 */ + vertical-align: top; /* 垂直对齐方式为顶部 */ + margin-top: 6rpx; /* 顶部外边距为6响应式像素 */ + margin-left: 42rpx; /* 左侧外边距为42响应式像素 */ + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + + &::after { /* 清空按钮后的竖线样式 */ + content: " "; /* 生成伪元素 */ + display: block; /* 作为块级元素显示 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + left: -10px; /* 距离左侧-10像素 */ + top: 1px; /* 距离顶部1像素 */ + width: 1px; /* 宽度为1像素 */ + height: 12px; /* 高度为12像素 */ + background: #ddd; /* 背景颜色为浅灰色 */ } - .clear-list-btn { - width: 100%; - height: 100%; - vertical-align: middle; + + .clear-list-btn { /* 清空列表按钮样式 */ + width: 100%; /* 宽度占满父元素 */ + height: 100%; /* 高度占满父元素 */ + vertical-align: middle; /* 垂直居中对齐 */ } } } - .total-num { - text-align: right; - padding: 20rpx 30rpx; - font-size: 28rpx; - .prodprice { - display: inline-block; - color: #333; + + .total-num { /* 总数量样式 */ + text-align: right; /* 文本右对齐 */ + padding: 20rpx 30rpx; /* 内边距为上下20响应式像素,左右30响应式像素 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + + .prodprice { /* 商品价格样式 */ + display: inline-block; /* 作为行内块级元素显示 */ + color: #333; /* 文本颜色为深灰色 */ } - .prodcount { - margin-right: 20rpx; + + .prodcount { /* 商品数量样式 */ + margin-right: 20rpx; /* 右侧外边距为20响应式像素 */ } } - .price-nums { - .prodprice { - position: absolute; - bottom: 0; + + .price-nums { /* 价格和数量样式 */ + .prodprice { /* 商品价格样式 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + bottom: 0; /* 距离底部0响应式像素 */ } - .prodcount { - position: absolute; - bottom: 5rpx; - right: 0; - color: #999; - font-family: verdana; + + .prodcount { /* 商品数量样式 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + bottom: 5rpx; /* 距离底部5响应式像素 */ + right: 0; /* 距离右侧0响应式像素 */ + color: #999; /* 文本颜色为灰色 */ + font-family: verdana; /* 字体系列为Verdana */ } } } -.order-state { - display: flex; - align-items: center; + +.order-state { /* 订单状态样式 */ + display: flex; /* 使用Flex布局 */ + align-items: center; /* 垂直居中对齐 */ } -.order-msg { - background: #fff; - margin-top: 15rpx; - padding: 0 30rpx; - font-size: 28rpx; - .msg-item { - border-top: 2rpx solid #f1f1f1; - &:first-child { - border: 0; + +.order-msg { /* 订单消息样式 */ + background: #fff; /* 背景颜色为白色 */ + margin-top: 15rpx; /* 顶部外边距为15响应式像素 */ + padding: 0 30rpx; /* 左右内边距为30响应式像素 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + + .msg-item { /* 消息项样式 */ + border-top: 2rpx solid #f1f1f1; /* 顶部边框为2响应式像素宽的浅灰色实线 */ + + &:first-child { /* 第一个消息项样式 */ + border: 0; /* 移除边框 */ } - .item { - position: relative; - display: flex; - padding: 16rpx 0; - align-items: center; - .item-tit { - line-height: 48rpx; + + .item { /* 消息项内容样式 */ + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + display: flex; /* 使用Flex布局 */ + padding: 16rpx 0; /* 上下内边距为16响应式像素 */ + align-items: center; /* 垂直居中对齐 */ + + .item-tit { /* 消息标题样式 */ + line-height: 48rpx; /* 行高设置为48响应式像素 */ } - .item-txt { - -webkit-box-flex: 1; - -moz-box-flex: 1; - flex: 1; - font-family: arial; - max-height: 48rpx; - overflow: hidden; - line-height: 48rpx; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - text-overflow: ellipsis; - word-break: break-all; + + .item-txt { /* 消息文本样式 */ + flex: 1; /* 占用剩余空间 */ + font-family: arial; /* 字体系列为Arial */ + max-height: 48rpx; /* 最大高度为48响应式像素 */ + overflow: hidden; /* 隐藏超出容器的内容 */ + line-height: 48rpx; /* 行高设置为48响应式像素 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + -webkit-line-clamp: 1; /* 限制文本显示为1行 */ + -webkit-box-orient: vertical; /* 文本垂直排列 */ + text-overflow: ellipsis; /* 当文本溢出时显示省略号 */ + word-break: break-all; /* 强制文本在任意字符处换行 */ } - .item-txt.price { - padding: 0; - text-align: right; + + .item-txt.price { /* 价格文本样式 */ + padding: 0; /* 移除内边距 */ + text-align: right; /* 文本右对齐 */ } - input { - flex: 1; + + input { /* 输入框样式 */ + flex: 1; /* 占用剩余空间 */ } - .coupon-btn { - display: block; - margin: 0 30rpx; - line-height: 28rpx; - color: #999; + + .coupon-btn { /* 优惠券按钮样式 */ + display: block; /* 作为块级元素显示 */ + margin: 0 30rpx; /* 左右外边距为30响应式像素 */ + line-height: 28rpx; /* 行高设置为28响应式像素 */ + color: #999; /* 文本颜色为灰色 */ } - .arrow { - width: 15rpx; - height: 15rpx; - border-top: 2rpx solid #999; - border-right: 2rpx solid #999; - transform: rotate(45deg); - position: absolute; - right: 0rpx; + + .arrow { /* 箭头样式 */ + width: 15rpx; /* 宽度为15响应式像素 */ + height: 15rpx; /* 高度为15响应式像素 */ + border-top: 2rpx solid #999; /* 上边框为2响应式像素宽的灰色实线 */ + border-right: 2rpx solid #999; /* 右边框为2响应式像素宽的灰色实线 */ + transform: rotate(45deg); /* 旋转45度形成箭头形状 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + right: 0rpx; /* 距离右侧0响应式像素 */ } } - .item.payment { - border-top: 2rpx solid #f1f1f1; - color: #eb2444; + + .item.payment { /* 支付项样式 */ + border-top: 2rpx solid #f1f1f1; /* 顶部边框为2响应式像素宽的浅灰色实线 */ + color: #eb2444; /* 文本颜色为红色 */ } - .item.coupon { - border-bottom: 2rpx solid #e1e1e1; + + .item.coupon { /* 优惠券项样式 */ + border-bottom: 2rpx solid #e1e1e1; /* 底部边框为2响应式像素宽的浅灰色实线 */ } } } -.submit-order-footer { - position: fixed; - bottom: 0; - width: 100%; - max-width: 750rpx; - background: #fff; - margin: auto; - display: -webkit-flex; - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: flex; - font-size: 26rpx; - box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); - .sub-order { - flex: 1; - margin: 0 30rpx; - line-height: 100rpx; - display: block; - text-align: left; - font-size: 28rpx; - .item-txt { - .price { - display: inline; - color: #eb2444; - font-size: 28rpx; + +.submit-order-footer { /* 提交订单页脚样式 */ + position: fixed; /* 固定定位,确保始终位于页面底部 */ + bottom: 0; /* 距离页面底部0像素 */ + width: 100%; /* 宽度占满整个屏幕 */ + max-width: 750rpx; /* 最大宽度为750响应式像素 */ + background: #fff; /* 背景颜色为白色 */ + margin: auto; /* 水平居中 */ + display: -webkit-flex; /* 使用Webkit Flex布局 */ + display: -webkit-box; /* 使用Webkit盒模型 */ + display: -moz-box; /* 使用Mozilla盒模型 */ + display: -ms-flexbox; /* 使用IE Flex布局 */ + display: flex; /* 使用标准Flex布局 */ + font-size: 26rpx; /* 文字大小为26响应式像素 */ + box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); /* 添加轻微的阴影效果 */ + + .sub-order { /* 订单提交按钮样式 */ + flex: 1; /* 占用剩余空间 */ + margin: 0 30rpx; /* 左右外边距为30响应式像素 */ + line-height: 100rpx; /* 行高设置为100响应式像素 */ + display: block; /* 作为块级元素显示 */ + text-align: left; /* 文本左对齐 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ + + .item-txt { /* 订单金额样式 */ + .price { /* 价格样式 */ + display: inline; /* 作为行内元素显示 */ + color: #eb2444; /* 文本颜色为红色 */ + font-size: 28rpx; /* 文字大小为28响应式像素 */ } } } - .footer-box { - padding: 0 10rpx; - width: 200rpx; - background: #eb2444; - text-align: center; - line-height: 100rpx; - color: #fff; + + .footer-box { /* 页脚按钮样式 */ + padding: 0 10rpx; /* 左右内边距为10响应式像素 */ + width: 200rpx; /* 宽度为200响应式像素 */ + background: #eb2444; /* 背景颜色为红色 */ + text-align: center; /* 文本居中对齐 */ + line-height: 100rpx; /* 行高设置为100响应式像素 */ + color: #fff; /* 文本颜色为白色 */ } } -.clearfix { - &:after { - content: " "; - display: table; - clear: both; + +.clearfix { /* 清除浮动样式 */ + &:after { /* 生成伪元素清除浮动 */ + content: " "; /* 生成空内容 */ + display: table; /* 作为表格元素显示 */ + clear: both; /* 清除浮动 */ } } -.popup-hide { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: 999; - background-color: rgba(0, 0, 0, 0.3); + +.popup-hide { /* 弹出层隐藏样式 */ + position: fixed; /* 固定定位,覆盖整个屏幕 */ + top: 0; /* 距离页面顶部0像素 */ + bottom: 0; /* 距离页面底部0像素 */ + left: 0; /* 距离页面左侧0像素 */ + right: 0; /* 距离页面右侧0像素 */ + z-index: 999; /* 设置较高的堆叠顺序,确保弹出层在其他内容之上 */ + background-color: rgba(0, 0, 0, 0.3); /* 背景颜色为半透明黑色 */ } -.popup-box { - position: absolute; - bottom: 0; - width: 100%; - height: 80%; - overflow: hidden; - background-color: #fff; + +.popup-box { /* 弹出层盒子样式 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + bottom: 0; /* 距离页面底部0像素 */ + width: 100%; /* 宽度占满整个屏幕 */ + height: 80%; /* 高度为屏幕高度的80% */ + overflow: hidden; /* 隐藏超出容器的内容 */ + background-color: #fff; /* 背景颜色为白色 */ } -.popup-tit { - position: relative; - height: 46px; - line-height: 46px; - padding-left: 10px; - font-size: 16px; - color: #333; - font-weight: bold; + +.popup-tit { /* 弹出层标题样式 */ + position: relative; /* 相对定位,用于内部元素的绝对定位 */ + height: 46px; /* 高度为46像素 */ + line-height: 46px; /* 行高设置为46像素 */ + padding-left: 10px; /* 左侧内边距为10像素 */ + font-size: 16px; /* 文字大小为16像素 */ + color: #333; /* 文本颜色为深灰色 */ + font-weight: bold; /* 文本加粗 */ } -.close { - color: #aaa; - border-radius: 12px; - line-height: 20px; - text-align: center; - height: 20px; - width: 20px; - font-size: 18px; - padding: 1px; - top: 10px; - right: 10px; - position: absolute; - &::before { - content: "\2716"; + +.close { /* 关闭按钮样式 */ + color: #aaa; /* 文本颜色为浅灰色 */ + border-radius: 12px; /* 圆角半径为12像素 */ + line-height: 20px; /* 行高设置为20像素 */ + text-align: center; /* 文本居中对齐 */ + height: 20px; /* 高度为20像素 */ + width: 20px; /* 宽度为20像素 */ + font-size: 18px; /* 文字大小为18像素 */ + padding: 1px; /* 内边距为1像素 */ + top: 10px; /* 距离顶部10像素 */ + right: 10px; /* 距离右侧10像素 */ + position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */ + + &::before { /* 生成关闭符号样式 */ + content: "\2716"; /* 使用Unicode字符表示关闭符号 */ } } -.coupon-tabs { - display: flex; - font-size: 14px; - justify-content: space-around; - border-bottom: 1px solid #f2f2f2; + +.coupon-tabs { /* 优惠券标签样式 */ + display: flex; /* 使用Flex布局 */ + font-size: 14px; /* 文字大小为14像素 */ + justify-content: space-around; /* 水平均匀分布 */ + border-bottom: 1px solid #f2f2f2; /* 底部边框为1像素宽的浅灰色实线 */ } -.coupon-tab { - padding: 10px 0; + +.coupon-tab { /* 优惠券标签项样式 */ + padding: 10px 0; /* 上下内边距为10像素 */ } -.coupon-tab.on { - border-bottom: 2px solid #eb2444; - font-weight: 600; + +.coupon-tab.on { /* 选中的优惠券标签项样式 */ + border-bottom: 2px solid #eb2444; /* 底部边框为2像素宽的红色实线 */ + font-weight: 600; /* 文本加粗 */ } -.popup-cnt { - height: calc(100% - 88px); - overflow: auto; - padding: 0 10px; - background: #f4f4f4; + +.popup-cnt { /* 弹出层内容样式 */ + height: calc(100% - 88px); /* 高度为弹出层盒子高度减去88像素 */ + overflow: auto; /* 允许滚动 */ + padding: 0 10px; /* 左右内边距为10像素 */ + background: #f4f4f4; /* 背景颜色为浅灰色 */ } -.coupon-ok { - position: fixed; - bottom: 0; - width: 100%; - height: 60px; - line-height: 50px; - font-size: 14px; - text-align: center; - box-shadow: 0px -1px 1px #ddd; - text { - border-radius: 20px; - display: inline-block; - height: 20px; - line-height: 20px; - width: 450rpx; - padding: 7px; - color: #fff; - box-shadow: -1px 3px 3px #aaa; + +.coupon-ok { /* 优惠券确认按钮样式 */ + position: fixed; /* 固定定位,确保始终位于页面底部 */ + bottom: 0; /* 距离页面底部0像素 */ + width: 100%; /* 宽度占满整个屏幕 */ + height: 60px; /* 高度为60像素 */ + line-height: 50px; /* 行高设置为50像素 */ + font-size: 14px; /* 文字大小为14像素 */ + text-align: center; /* 文本居中对齐 */ + box-shadow: 0px -1px 1px #ddd; /* 添加轻微的阴影效果 */ + + text { /* 按钮文本样式 */ + border-radius: 20px; /* 圆角半径为20像素 */ + display: inline-block; /* 作为行内块级元素显示 */ + height: 20px; /* 高度为20像素 */ + line-height: 20px; /* 行高设置为20像素 */ + width: 450rpx; /* 宽度为450响应式像素 */ + padding: 7px; /* 内边距为7像素 */ + color: #fff; /* 文本颜色为白色 */ + box-shadow: -1px 3px 3px #aaa; /* 添加轻微的阴影效果 */ } } -.botm-empty { - height: 60px; + +.botm-empty { /* 底部空白样式 */ + height: 60px; /* 高度为60像素 */ } -checkbox { - .wx-checkbox-input { - border-radius: 50%; - width: 35rpx; - height: 35rpx; + +checkbox { /* 复选框样式 */ + .wx-checkbox-input { /* 复选框输入框样式 */ + border-radius: 50%; /* 圆形边框 */ + width: 35rpx; /* 宽度为35响应式像素 */ + height: 35rpx; /* 高度为35响应式像素 */ } - .wx-checkbox-input.wx-checkbox-input-checked { - background: #eb2444; - border-color: #eb2444; - &::before { - text-align: center; - font-size: 22rpx; - color: #fff; - background: transparent; - transform: translate(-50%, -50%) scale(1); - -webkit-transform: translate(-50%, -50%) scale(1); + + .wx-checkbox-input.wx-checkbox-input-checked { /* 选中的复选框输入框样式 */ + background: #eb2444; /* 背景颜色为红色 */ + border-color: #eb2444; /* 边框颜色为红色 */ + + &::before { /* 选中符号样式 */ + text-align: center; /* 文本居中对齐 */ + font-size: 22rpx; /* 文字大小为22响应式像素 */ + color: #fff; /* 文本颜色为白色 */ + background: transparent; /* 背景颜色为透明 */ + transform: translate(-50%, -50%) scale(1); /* 居中并缩放 */ + -webkit-transform: translate(-50%, -50%) scale(1); /* Webkit浏览器兼容 */ } } } diff --git a/front-end/mall4uni/src/pages/submit-order/submit-order.vue b/front-end/mall4uni/src/pages/submit-order/submit-order.vue index 166ad64..e273adb 100644 --- a/front-end/mall4uni/src/pages/submit-order/submit-order.vue +++ b/front-end/mall4uni/src/pages/submit-order/submit-order.vue @@ -3,100 +3,82 @@ - > + + class="addr-bg" > - + - 新增收货地址 + 新增收货地址 - + + + class="addr-bg whole" > - + - {{ userAddr.province }}{{ userAddr.city }}{{ userAddr.area }}{{ userAddr.addr }} + {{ userAddr.province }}{{ userAddr.city }}{{ userAddr.area }}{{ userAddr.addr }} - + - + :key="index" > + @tap="toOrderDetailPage" > - + - {{ item.prodName }} + {{ item.prodName }} - {{ item.skuName }} + {{ item.skuName }} - - ¥ - - - {{ wxs.parsePrice(item.price)[0] }} - - - .{{ wxs.parsePrice(item.price)[1] }} - - - - x{{ item.prodCount }} + + {{ wxs.parsePrice(item.price)[0] }} + .{{ wxs.parsePrice(item.price)[1] }} + x{{ item.prodCount }} + - - 共{{ totalCount }}件商品 - + 共{{ totalCount }}件商品 合计: - - ¥ - - - {{ wxs.parsePrice(total)[0] }} - - - .{{ wxs.parsePrice(total)[1] }} - + + {{ wxs.parsePrice(total)[0] }} + .{{ wxs.parsePrice(total)[1] }} @@ -104,96 +86,58 @@ - + > - - 优惠券: - - - 暂无可用 - - - {{ coupons.totalLength ? coupons.totalLength : 0 }}张 - - + 优惠券: + 暂无可用 + {{ coupons.totalLength ? coupons.totalLength : 0 }}张 + + 买家留言: - + + placeholder="给卖家留言" + /> + - - 订单总额: - + 订单总额: - - ¥ - - - {{ wxs.parsePrice(total)[0] }} - - - .{{ wxs.parsePrice(total)[1] }} - + + {{ wxs.parsePrice(total)[0] }} + .{{ wxs.parsePrice(total)[1] }} - - 运费: - + 运费: - - ¥ - - - {{ wxs.parsePrice(transfee)[0] }} - - - .{{ wxs.parsePrice(transfee)[1] }} - + + {{ wxs.parsePrice(transfee)[0] }} + .{{ wxs.parsePrice(transfee)[1] }} - - 优惠金额: - + 优惠金额: - - -¥ - - - {{ wxs.parsePrice(shopReduce)[0] }} - - - .{{ wxs.parsePrice(shopReduce)[1] }} - + -¥ + {{ wxs.parsePrice(shopReduce)[0] }} + .{{ wxs.parsePrice(shopReduce)[1] }} 小计: - - ¥ - - - {{ wxs.parsePrice(actualTotal)[0] }} - - - .{{ wxs.parsePrice(actualTotal)[1] }} - + + {{ wxs.parsePrice(actualTotal)[0] }} + .{{ wxs.parsePrice(actualTotal)[1] }} @@ -206,21 +150,14 @@ 合计: - - ¥ - - - {{ wxs.parsePrice(actualTotal)[0] }} - - - .{{ wxs.parsePrice(actualTotal)[1] }} - + + {{ wxs.parsePrice(actualTotal)[0] }} + .{{ wxs.parsePrice(actualTotal)[1] }} - > 提交订单 @@ -228,69 +165,69 @@ - class="popup-hide" > - 优惠券 + 优惠券 /> + data-sts="1" - @tap="changeCouponSts" + @tap="changeCouponSts" > - 可用优惠券({{ coupons.canUseCoupons.length ? coupons.canUseCoupons.length : 0 }}) + 可用优惠券({{ coupons.canUseCoupons.length ? coupons.canUseCoupons.length : 0 }}) data-sts="2" - @tap="changeCouponSts" + @tap="changeCouponSts" > - 不可用优惠券({{ coupons.unCanUseCoupons.length ? coupons.unCanUseCoupons.length : 0 }}) + 不可用优惠券({{ coupons.unCanUseCoupons.length ? coupons.unCanUseCoupons.length : 0 }}) + - + + :key="index" > + order="true" + can-use="true" + @check-coupon="checkCoupon" /> - + + :key="index" > + order="true" + can-use="false" /> - + + class="coupon-ok" > - - 确定 - + 确定 @@ -298,230 +235,309 @@ diff --git a/front-end/mall4uni/src/pages/user/user.scss b/front-end/mall4uni/src/pages/user/user.scss index c5e82dc..22b29e6 100644 --- a/front-end/mall4uni/src/pages/user/user.scss +++ b/front-end/mall4uni/src/pages/user/user.scss @@ -1,222 +1,400 @@ +/* 定义容器样式 */ .container { + /* 设置背景颜色 */ background-color: #f7f7f7; + /* 设置底部内边距,以确保内容与底部有适当的空间 */ padding-bottom: 60rpx; } + +/* 用户信息模块样式 */ .userinfo { + /* 设置相对定位,以便其子元素可以使用绝对定位 */ position: relative; + /* 占满整个宽度 */ width: 100%; + /* 设置白色背景 */ background: #fff; + /* 文本居中显示 */ text-align: center; + /* 上下内边距,左右无内边距 */ padding: 30rpx 0; + .userinfo-con { + /* 设置固定宽度,使用户信息框在页面中心对齐 */ width: 240rpx; + /* 水平居中 */ margin: auto; + .userinfo-avatar { + /* 确保超出部分不显示 */ overflow: hidden; + /* 块级显示 */ display: block; + /* 设置头像的尺寸 */ width: 160rpx; height: 160rpx; + /* 圆形头像 */ border-radius: 50%; + /* 添加阴影效果 */ box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); + /* 水平居中 */ margin: auto; + image { + /* 设置图像的尺寸 */ width: 160rpx; height: 160rpx; } } + .userinfo-name { + /* 设置字体大小 */ font-size: 30rpx; + /* 加粗字体 */ font-weight: bold; + /* 与头像保持一定间距 */ margin-top: 20rpx; + /* 处理文本溢出 */ overflow: hidden; + /* 使用 WebKit 独有的多行文本截断 */ display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; + /* 当文本溢出时用省略号表示 */ text-overflow: ellipsis; + /* 允许单词内部断行 */ word-break: break-all; } } } + +/* 未登录用户的提示信息样式 */ .userinfo-none { + /* 使用 Flexbox 布局,使子元素垂直和水平居中 */ display: flex; + /* 内边距 */ padding: 30rpx; + /* 白色背景 */ background: #fff; + /* 子元素垂直居中 */ align-items: center; + .default-pic { + /* 右侧内边距 */ padding-right: 30rpx; + image { + /* 设置图像的尺寸 */ width: 160rpx; height: 160rpx; } } } + +/* 未登录状态下的按钮和文本样式 */ .none-login { button { + /* 按钮背景色为白色 */ background: #fff; + &::after { + /* 移除默认的按钮边框 */ border: 0; } } + .unlogin { + /* 设置字体大小 */ font-size: 30rpx; + /* 文本左对齐 */ text-align: left; + /* 移除上下内边距 */ padding: 0; } + .click-login { + /* 设置较小的字体大小 */ font-size: 26rpx; + /* 颜色较深 */ color: #777; + /* 文本左对齐 */ text-align: left; + /* 移除上下内边距 */ padding: 0; } } + +/* 绑定手机号的样式 */ .binding-phone { + /* 相对定位 */ position: relative; + /* 白色背景 */ background: #fff; + /* 固定高度 */ height: 80rpx; + /* 行高与高度相同,使文本垂直居中 */ line-height: 80rpx; + /* 内边距 */ padding: 0 30rpx; + /* 上下边框 */ border-top: 2rpx solid #f7f7f7; border-bottom: 2rpx solid #f7f7f7; + .show-tip { + /* 设置字体大小 */ font-size: 26rpx; } + .gotobinding { + /* 设置圆角 */ border-radius: 8rpx; + /* 字体大小 */ font-size: 28rpx; - color: #e24b4b; + /* 颜色为红色 */ + color: #e24b42; + /* 加粗字体 */ font-weight: bold; } } + +/* 列表内容样式 */ .list-cont { + /* 占满整个宽度 */ width: 100%; + /* 背景颜色 */ background: #f7f7f7; + /* 顶部外边距 */ margin-top: 20rpx; + .total-order { + /* 白色背景 */ background: #fff; + .order-tit { + /* 使用 Flexbox 布局 */ display: flex; + /* 两端对齐 */ justify-content: space-between; + /* 固定高度 */ height: 80rpx; + /* 行高与高度相同,使文本垂直居中 */ line-height: 80rpx; + /* 字体大小 */ font-size: 30rpx; + /* 下边框 */ border-bottom: 1px solid #f7f7f7; + /* 内边距 */ padding: 0 30rpx; + .checkmore { + /* 较小的字体大小 */ font-size: 22rpx; + /* 颜色较暗 */ color: #80848f; + /* 使用 Flexbox 布局 */ display: flex; + /* 垂直居中 */ align-items: center; } } + .procedure { + /* 使用 Flexbox 布局 */ display: flex; + /* 项目均匀分布 */ justify-content: space-around; + /* 项目垂直居中 */ align-items: center; + /* 字体大小 */ font-size: 25rpx; + /* 固定高度 */ height: 160rpx; + .items { + /* 相对定位 */ position: relative; + /* 使用 Flexbox 布局 */ display: flex; + /* 项目垂直排列 */ flex-direction: column; + /* 项目水平居中 */ align-items: center; + image { + /* 设置图像的尺寸 */ width: 70rpx; height: 70rpx; + /* 与下方文字保持间距 */ margin-bottom: 20rpx; } + .num-badge { + /* 绝对定位 */ position: absolute; + /* 设置徽章位置 */ top: -15rpx; right: -12rpx; + /* 颜色为红色 */ color: #eb2444; + /* 边框颜色为红色 */ border: 3rpx solid #eb2444; + /* 圆形 */ border-radius: 50rpx; + /* 白色背景 */ background: #fff; + /* 最小宽度 */ min-width: 30rpx; + /* 固定高度 */ height: 30rpx; + /* 行高与高度相同,使文本垂直居中 */ line-height: 30rpx; + /* 文本水平居中 */ text-align: center; + /* 内边距 */ padding: 2rpx; + /* 块级显示 */ display: block; } } } } + .my-menu { + /* 白色背景 */ background-color: #fff; + /* 顶部外边距 */ margin-top: 20rpx; + .memu-item { + /* 使用 Flexbox 布局 */ display: flex; + /* 项目垂直居中 */ align-items: center; + /* 项目两端对齐 */ justify-content: space-between; + /* 固定高度 */ height: 100rpx; + /* 下边框 */ border-bottom: 2rpx solid #f7f7f7; + /* 内边距 */ padding: 0 30rpx; + &:nth-child(1) { + /* 第一个项目的上边框 */ border-top: 2rpx solid #f7f7f7; } + &:last-child { + /* 最后一个项目的下边框移除 */ border-bottom: none; } + text { + /* 字体大小 */ font-size: 28rpx; } + image { + /* 设置图像的尺寸 */ width: 50rpx; height: 50rpx; + /* 与右侧文本保持间距 */ margin-right: 20rpx; } + .i-name { + /* 使用 Flexbox 布局 */ display: flex; + /* 项目垂直居中 */ align-items: center; } } } } + +/* 箭头样式 */ .arrowhead { + /* 设置箭头的尺寸 */ width: 15rpx; height: 15rpx; + /* 上边框 */ border-top: 2rpx solid #999; + /* 右边框 */ border-right: 2rpx solid #999; + /* 旋转45度形成箭头形状 */ transform: rotate(45deg); + /* 左侧外边距 */ margin-left: 10rpx; } + +/* 产品栏样式 */ .prod-col { + /* 顶部外边距 */ margin-top: 20rpx; + /* 白色背景 */ background: #fff; + /* 使用 Flexbox 布局 */ display: flex; + /* 项目均匀分布 */ justify-content: space-around; + /* 内边距 */ padding: 30rpx 0 10rpx 0; + /* 字体大小 */ font-size: 12px; + .col-item { + /* 文本居中 */ text-align: center; + .num { + /* 字体较大且加粗 */ font-size: 16px; font-weight: 700; + /* 颜色为蓝色 */ color: #3a86b9; } + .tit { + /* 行高 */ line-height: 34px; } } } + +/* 登出按钮样式 */ .log-out { + /* 内边距 */ padding: 20rpx; + /* 文本居中 */ text-align: center; + /* 顶部外边距 */ margin-top: 20rpx; } + .log-out-n { + /* 字体大小 */ font-size: 30rpx; + /* 水平居中 */ margin: auto; + /* 固定宽度 */ width: 200rpx; + /* 内边距 */ padding: 20rpx; + /* 圆角 */ border-radius: 10rpx; + /* 红色背景 */ background: #e43130; + /* 白色文字 */ color: #ffffff; } + +/* 自定义菜单按钮样式 */ button.memu-btn.memu-item { + /* 白色背景 */ background-color: #fff; + &:after { + /* 移除默认的按钮边框 */ border: 0; } } diff --git a/front-end/mall4uni/src/pages/user/user.vue b/front-end/mall4uni/src/pages/user/user.vue index 51aed0b..475bce8 100644 --- a/front-end/mall4uni/src/pages/user/user.vue +++ b/front-end/mall4uni/src/pages/user/user.vue @@ -1,221 +1,131 @@ diff --git a/front-end/mall4uni/src/utils/http.js b/front-end/mall4uni/src/utils/http.js index f4dbb86..719c3ea 100644 --- a/front-end/mall4uni/src/utils/http.js +++ b/front-end/mall4uni/src/utils/http.js @@ -3,102 +3,108 @@ import loginMethods from './login' const http = { + /** + * 发起HTTP请求 + * @param {Object} params - 请求参数对象,包含url、data、method等 + * @returns {Promise} - 返回一个Promise对象,解析或拒绝根据请求结果 + */ request: async function (params) { - // 请求参数处理 + // 处理请求数据类型,确保数组和数字被正确序列化为字符串 if (Object.prototype.toString.call(params.data) === '[object Array]') { params.data = JSON.stringify(params.data) } else if (Object.prototype.toString.call(params.data) === '[object Number]') { params.data = params.data + '' } - // 刷新token + // 如果不是登录请求且应用未完全启动(即未完成首次加载),并且不是刷新token的请求,则尝试刷新token if (!params.login && !getApp()?.globalData.isLanding && !params.isRefreshing) { await loginMethods.refreshToken() } - // 发起请求 + + // 发起请求,并返回Promise对象处理异步操作 return new Promise((resolve, reject) => { uni.request({ dataType: 'json', responseType: params.responseType === undefined ? 'text' : params.responseType, header: { - Authorization: uni.getStorageSync('Token') + Authorization: uni.getStorageSync('Token') // 设置请求头中的Authorization字段 }, - url: (params.domain ? params.domain : import.meta.env.VITE_APP_BASE_API) + params.url, - data: params.data, - method: params.method === undefined ? 'POST' : params.method, + url: (params.domain ? params.domain : import.meta.env.VITE_APP_BASE_API) + params.url, // 拼接完整的请求URL + data: params.data, // 请求体数据 + method: params.method === undefined ? 'POST' : params.method, // 默认请求方法为POST success: (res) => { const responseData = res.data - // 请求小程序码 + // 特殊处理小程序码请求 if (params.responseType === 'arraybuffer' && res.statusCode === 200) { return resolve(responseData) } - // 00000 请求成功 - // A00002 用于直接显示提示系统的成功,内容由输入决定 - if (responseData.code === '00000' || responseData.code === 'A00002') { - resolve(responseData) - } - // A00004 未授权 - if (responseData.code === 'A00004') { - // 重设登录后跳转地址 - loginMethods.setRouteUrlAfterLogin() - uni.removeStorageSync('expiresTimeStamp') - uni.removeStorageSync('loginResult') - uni.removeStorageSync('Token') - if (!params.dontTrunLogin) { - uni.showModal({ - title: '提示', - content: uni.getStorageSync('hadLogin') ? '登录已过期,请重新登陆!' : '请先进行登录!', - cancelText: '取消', - confirmText: '确定', - success: res => { - if (res.confirm) { - uni.navigateTo({ - url: '/pages/accountLogin/accountLogin' - }) - } else { - const router = getCurrentPages() - if (router[0].route === 'pages/basket/basket') { - uni.switchTab({ - url: '/pages/index/index' + // 根据响应码处理不同情况 + switch (responseData.code) { + case '00000': // 请求成功 + case 'A00002': // 系统成功的提示信息 + resolve(responseData) + break; + case 'A00004': // 未授权 + // 重设登录后跳转地址,并清除相关存储 + loginMethods.setRouteUrlAfterLogin() + uni.removeStorageSync('expiresTimeStamp') + uni.removeStorageSync('loginResult') + uni.removeStorageSync('Token') + + // 如果允许转向登录页面,则显示模态框提示用户重新登录 + if (!params.dontTrunLogin) { + uni.showModal({ + title: '提示', + content: uni.getStorageSync('hadLogin') ? '登录已过期,请重新登陆!' : '请先进行登录!', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + uni.navigateTo({ + url: '/pages/accountLogin/accountLogin' }) + } else { + const router = getCurrentPages() + if (router[0].route === 'pages/basket/basket') { + uni.switchTab({ + url: '/pages/index/index' + }) + } } } - } - }) - } - resolve(responseData) - } - - // A00005 服务器出了点小差 - if (responseData.code === 'A00005') { - this.onRequestFail(params, responseData) - uni.showToast({ - title: '服务器出了点小差~', - icon: 'none' - }) - } - - // 其他异常码 - // A00001 用于直接显示提示用户的错误,内容由输入内容决定 - // A04001 社交账号未绑定 - // A00012 tempUid错误 - // A00006 验证码错误 - if (responseData.code === 'A04001' || responseData.code === 'A00001' || responseData.code === 'A00012' || responseData.code === 'A00006') { - if (!params.hasCatch) { + }) + } + resolve(responseData) + break; + case 'A00005': // 服务器错误 + this.onRequestFail(params, responseData) uni.showToast({ - title: responseData.msg || responseData.data || 'Error', + title: '服务器出了点小差~', icon: 'none' }) - } - } - - if (responseData.code !== '00000') { - reject(responseData) + break; + case 'A04001': // 社交账号未绑定 + case 'A00001': // 直接显示提示用户的错误 + case 'A00012': // tempUid错误 + case 'A00006': // 验证码错误 + if (!params.hasCatch) { + uni.showToast({ + title: responseData.msg || responseData.data || 'Error', + icon: 'none' + }) + } + reject(responseData) + break; + default: + if (responseData.code !== '00000') { + reject(responseData) + } } }, fail: (err) => { + // 请求失败时显示提示并拒绝Promise uni.showToast({ title: '请求失败' }) @@ -107,56 +113,70 @@ const http = { }) }) }, + + /** + * 获取购物车商品数量,并更新tabBar徽章 + */ getCartCount: () => { if (!uni.getStorageSync('Token')) { - util.removeTabBadge() + util.removeTabBadge() // 如果没有token,移除购物车徽章 return } http.request({ url: '/p/shopCart/prodCount', method: 'GET', - dontTrunLogin: true, + dontTrunLogin: true, // 不需要转向登录 data: {} }) .then(({ data }) => { if (data > 0) { uni.setTabBarBadge({ - index: 2, - text: data + '' + index: 2, // 假设购物车位于第三个tab + text: data + '' // 显示商品数量 }) - getApp().globalData.totalCartCount = data + getApp().globalData.totalCartCount = data // 更新全局购物车数量 } else { uni.removeTabBarBadge({ - index: 2 + index: 2 // 移除购物车徽章 }) getApp().globalData.totalCartCount = 0 } }) }, + + /** + * 请求失败时的日志记录 + * @param {Object} params - 请求参数 + * @param {Object} responseData - 响应数据 + */ onRequestFail: (params, responseData) => { console.error('============== 请求异常 ==============') console.log('接口地址: ', params.url) console.log('异常信息: ', responseData) console.error('============== 请求异常 end ==========') }, + /** - * 登录成功后执行 - * @param {Object} result 登录成功返回的数据 - * @param {Object} fn 登录成功后的回调 + * 登录成功后的处理逻辑 + * @param {Object} result - 登录成功返回的数据 + * @param {Function} fn - 登录成功后的回调函数 */ loginSuccess: (result, fn) => { - // 保存登陆信息 + // 保存登录信息到本地存储 wx.setStorageSync('loginResult', result) - // 保存成功登录标识,token过期判断 + // 保存成功登录标识,用于判断token是否过期 wx.setStorageSync('hadLogin', true) - const expiresTimeStamp = result.expiresIn * 1000 / 2 + new Date().getTime() + const expiresTimeStamp = result.expiresIn * 1000 / 2 + new Date().getTime() // 计算token过期时间 // 缓存token的过期时间 uni.setStorageSync('expiresTimeStamp', expiresTimeStamp) - wx.setStorageSync('Token', result.accessToken) // 把token存入缓存,请求接口数据时要用 + // 将accessToken保存到本地存储,以便后续请求使用 + wx.setStorageSync('Token', result.accessToken) + // 执行登录成功后的回调函数 if (fn) { fn() } } } + export default http diff --git a/front-end/mall4uni/src/utils/login.js b/front-end/mall4uni/src/utils/login.js index 2a5a458..6b27192 100644 --- a/front-end/mall4uni/src/utils/login.js +++ b/front-end/mall4uni/src/utils/login.js @@ -1,37 +1,58 @@ const loginMethods = { /** * 刷新token + * 当用户的Token即将过期时,自动发起请求以获取新的Token。 + * 这个过程会检查当前Token是否有效以及是否正在进行刷新操作,以避免重复请求。 */ refreshToken: () => { + // 从本地存储中获取Token的过期时间戳 const expiresTimeStamp = uni.getStorageSync('expiresTimeStamp') + + // 如果没有有效的Token或过期时间戳,则直接返回,不进行刷新 if (!uni.getStorageSync('Token') || !expiresTimeStamp) return + + // 检查Token是否已经过期 const isExpires = expiresTimeStamp < new Date().getTime() + + // 检查是否已经有刷新Token的操作正在进行 const isRefreshing = uni.getStorageSync('isRefreshingToken') + + // 如果Token未过期或已有刷新操作正在进行,则直接返回 if (!isExpires || isRefreshing) { return } + + // 设置标志位,表示正在刷新Token,防止并发刷新 uni.setStorageSync('isRefreshingToken', true) + + // 发起刷新Token的请求 http.request({ - url: '/token/refresh', - method: 'POST', - login: true, - isRefreshing: true, - dontTrunLogin: true + url: '/token/refresh', // 刷新Token的API接口 + method: 'POST', // 使用POST方法发送请求 + login: true, // 标记这是一个与登录相关的请求 + isRefreshing: true, // 标记这是刷新Token的请求 + dontTrunLogin: true // 即使刷新失败也不跳转到登录页面 }).then(res => { + // 刷新成功后,更新本地存储中的Token过期时间 uni.setStorageSync('isRefreshingToken', false) uni.setStorageSync('expiresTimeStamp', res.data * 1000 / 2 + new Date().getTime()) }).catch(() => { + // 刷新失败后,重置标志位 uni.setStorageSync('isRefreshingToken', false) }) }, /** * 设置登录后的跳转地址 + * 在用户登录之前,记录当前页面的路径,以便在登录成功后能够返回到该页面。 */ setRouteUrlAfterLogin: () => { + // 获取当前所有页面的栈 const pages = getCurrentPages() - // 登录后的回跳地址 + + // 确保当前页面不是登录页面(避免循环跳转) if (pages[pages.length - 1].route.indexOf('user-login') === -1) { + // 记录当前页面的完整路径,用于登录成功后的跳转 uni.setStorageSync('routeUrlAfterLogin', pages[pages.length - 1].$page.fullPath) } } diff --git a/front-end/mall4uni/src/utils/util.js b/front-end/mall4uni/src/utils/util.js index 553e5bb..616160f 100644 --- a/front-end/mall4uni/src/utils/util.js +++ b/front-end/mall4uni/src/utils/util.js @@ -1,34 +1,71 @@ const util = { + /** + * 格式化日期时间 + * 将传入的Date对象格式化为"YYYY/MM/DD HH:MM:SS"的字符串形式。 + * @param {Date} date - 要格式化的日期对象 + * @returns {String} - 格式化后的日期时间字符串 + */ formatTime: date => { - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - const hour = date.getHours() - const minute = date.getMinutes() - const second = date.getSeconds() + const year = date.getFullYear() // 获取年份 + const month = date.getMonth() + 1 // 获取月份(注意:getMonth()返回的是0-11,所以需要加1) + const day = date.getDate() // 获取日期 + const hour = date.getHours() // 获取小时 + const minute = date.getMinutes() // 获取分钟 + const second = date.getSeconds() // 获取秒 + + // 使用formatNumber方法确保所有时间部分都是两位数,并用'/'连接日期部分,':'连接时间部分 return [year, month, day].map(util.formatNumber).join('/') + ' ' + [hour, minute, second].map(util.formatNumber).join(':') }, + /** + * 格式化数字 + * 确保传入的数字是两位数,如果不是,则在前面补零。 + * @param {Number|String} n - 需要格式化的数字 + * @returns {String} - 格式化后的两位数字符串 + */ formatNumber: n => { - n = n.toString() - return n[1] ? n : '0' + n + n = n.toString() // 将数字转换为字符串 + return n[1] ? n : '0' + n // 如果长度大于1则直接返回,否则在前面补零 }, + /** + * 格式化HTML内容 + * 对传入的HTML字符串进行样式调整,以适应移动端显示,特别是处理图片、表格等内容的宽度和布局。 + * @param {String} content - 需要格式化的HTML字符串 + * @returns {String} - 格式化后的HTML字符串 + */ formatHtml: content => { if (!content) { - return + return // 如果没有内容,直接返回 } + + // 替换

标签,设置最大宽度、单词换行等样式 content = content.replace(/

标签,设置最大宽度、高度自适应、边距等样式 content = content.replace(/标签中的样式,确保内部样式不会覆盖外部样式 content = content.replace(/style="/gi, 'style="max-width:100% !important;table-layout:fixed;word-wrap:break-word;word-break:break-word;') + + // 替换标签,设置表格布局和单词换行等样式 content = content.replace(/
标签,设置单元格间距、填充、边框等样式 content = content.replace(/
') - return content - }, + return content // 返回格式化后的HTML字符串 + } +} + +export default util /** * 移除购物车Tabbar的数字 */ diff --git a/front-end/mall4uni/vite.config.js b/front-end/mall4uni/vite.config.js index d4a3b1f..30ff9c0 100644 --- a/front-end/mall4uni/vite.config.js +++ b/front-end/mall4uni/vite.config.js @@ -1,38 +1,42 @@ -import { defineConfig } from 'vite' -import uni from '@dcloudio/vite-plugin-uni' -import path from 'path' -import AutoImport from 'unplugin-auto-import/vite' -import h5ProdEffectPlugin from 'uni-vite-plugin-h5-prod-effect' +import { defineConfig } from 'vite'; // 从 Vite 导入 defineConfig 函数,用于定义 Vite 配置 +import uni from '@dcloudio/vite-plugin-uni'; // 导入 Uni-App 的 Vite 插件,用于支持 Uni-App 项目 +import path from 'path'; // 导入 Node.js 的 path 模块,用于处理文件路径 +import AutoImport from 'unplugin-auto-import/vite'; // 导入 unplugin-auto-import 插件,用于自动导入常用模块 +import h5ProdEffectPlugin from 'uni-vite-plugin-h5-prod-effect'; // 导入 H5 生产环境打包时的特殊处理插件 // https://vitejs.dev/config/ export default defineConfig({ plugins: [ - uni(), + uni(), // 启用 Uni-App 的 Vite 插件,确保 Vite 能够正确处理 Uni-App 项目 + AutoImport({ imports: [ - 'vue', - 'uni-app' + 'vue', // 自动导入 Vue 的全局 API + 'uni-app' // 自动导入 Uni-App 的全局 API ], dirs: [ - 'src/utils', - 'src/wxs/**' + 'src/utils', // 指定自动导入的目录,这里是 `src/utils` 目录下的所有文件 + 'src/wxs/**' // 指定自动导入的目录,这里是 `src/wxs` 目录及其子目录下的所有文件 ], - dts: 'src/auto-imports.d.ts', + dts: 'src/auto-imports.d.ts', // 生成的类型声明文件路径,用于 TypeScript 支持 eslintrc: { - enabled: true + enabled: true // 启用 ESLint 配置文件的自动生成,确保 ESLint 知道哪些模块是自动导入的 } }), - // 对h5 production环境打包时的特殊处理,否则uni-crazy-router在这个环境会异常 + + // 对 H5 生产环境打包时的特殊处理,确保 `uni-crazy-router` 在生产环境中正常工作 h5ProdEffectPlugin() ], + server: { - host: true, - port: 80, - open: true + host: true, // 允许外部访问开发服务器,设置为 `true` 可以在局域网内访问 + port: 80, // 设置开发服务器的端口号为 80 + open: true // 启动开发服务器时自动打开浏览器 }, + resolve: { alias: { - '@': path.resolve(__dirname, 'src') + '@': path.resolve(__dirname, 'src') // 设置别名 `@` 指向项目的 `src` 目录,方便路径引用 } } -}) +});