code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
<template> <view class="login-container"> <!-- 提示登录的图标 --> <!-- <uni-icons type="contact-filled" size="100" color="#AFAFAF"></uni-icons> --> <!-- 登录按钮 --> <!-- 可以从 @getuserinfo 事件处理函数的形参中,获取到用户的基本信息 --> <!-- <button type="primary" class="btn-login" open-type="getUserInfo" @getuserinfo="getUserInfo">一键登录</button> --> <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <image v-if="avatarUrl" :src="avatarUrl" class="avatar"></image> <uni-icons v-else type="contact-filled" size="100" color="#AFAFAF"></uni-icons> </button> <!-- 新版昵称获取方式 --> <form @submit="formSubmit"> <input name="nickname" :value="nickName" placeholder="请输入昵称" type="nickname" class="nickname-input" /> <button form-type="submit" type="primary" class="btn-login">一键登录</button> </form> <!-- 登录提示 --> <view class="tips-text">登录后尽享更多权益</view> </view> </template> <script> // 1. 按需导入 mapMutations 辅助函数 import { mapMutations, mapState } from 'vuex' export default { data() { return { avatarUrl: '', nickName: '' } }, computed: { // 调用 mapState 辅助方法,把 m_user 模块中的数据映射到当前用组件中使用 ...mapState('m_user', ['redirectInfo']) }, methods: { // 2. 调用 mapMutations 辅助方法,把 m_user 模块中的 updateUserInfo 映射到当前组件中使用 ...mapMutations('m_user', ['updateUserInfo', 'updateToken', 'updateRedirectInfo']), // 获取头像 onChooseAvatar(e) { if (e.detail.errMsg && e.detail.errMsg.indexOf('fail') !== -1) { uni.$showMsg('获取头像失败,请重试'); return; } this.avatarUrl = e.detail.avatarUrl console.log(e) }, // 获取微信用户的基本信息 // 修改后的 formSubmit 方法 async formSubmit(e) { // if (e.detail.errMsg.includes('fail')) { // return uni.$showMsg('您取消了登录授权') // } // console.log(e) const nickName = e.detail.value.nickname if (!nickName) return uni.$showMsg('请输入昵称') if (!this.avatarUrl) return uni.$showMsg('请选择头像') this.nickName = nickName const userInfo = { nickName: nickName, avatarUrl: this.avatarUrl } // 存储用户基本信息 this.updateUserInfo(userInfo) try { // 调用微信登录接口获取code const loginRes = await uni.login() if (loginRes.errMsg !== 'login:ok') { return uni.$showMsg('微信登录失败') } // 准备参数对象 // const params = { // code: loginRes.code, // iv: e.detail.iv, // encryptedData: e.detail.encryptedData, // rawData: e.detail.rawData, // signature: e.detail.signature // } const params = { code: loginRes.code, nickName: nickName, avatarUrl: this.avatarUrl } // 请求后端获取token const { data } = await uni.$http.post('/api/public/v1/users/wxlogin', params) // this.updateToken("1") // this.navigateBack() if (data.meta.status !== 200) { return uni.$showMsg('token获取失败') } // 更新token到vuex this.updateToken(data.token) uni.$showMsg('登录成功', 'success') // 判断 vuex 中的 redirectInfo 是否为 null // 如果不为 null,则登录成功之后,需要重新导航到对应的页面 this.navigateBack() } catch (error) { console.error('登录异常:', error) uni.$showMsg('登录过程发生错误') } }, // 返回登录之前的页面 navigateBack() { // redirectInfo 不为 null,并且导航方式为 switchTab if (this.redirectInfo && this.redirectInfo.openType === 'switchTab') { // 调用小程序提供的 uni.switchTab() API 进行页面的导航 uni.switchTab({ url: this.redirectInfo.form, // 导航成功之后,把 vuex 中的 redirectInfo 对象重置为 null complete: () => { this.updateRedirectInfo(null) } }) } } } } </script> <style scoped lang="scss"> .avatar-wrapper { background: none; border: none; padding: 0; margin: 0; line-height: 1; &::after { border: none; } .avatar { width: 100px; height: 100px; border-radius: 50%; } } .nickname-input { width: 80%; margin: 20px auto; padding: 10px; border: 1px solid #ddd; border-radius: 5px; background: #fff; } .login-container { // 登录盒子的样式 height: 750rpx; display: flex; flex-direction: column; justify-content: center; align-items: center; background-color: #f8f8f8; position: relative; overflow: hidden; // 绘制登录盒子底部的半椭圆造型 &::after { //伪类选择器 content: ' '; display: block; position: absolute; width: 100%; height: 40px; left: 0; bottom: 0; background-color: white; border-radius: 100%; //椭圆 transform: translateY(50%); //竖直上偏移 } // 登录按钮的样式 .btn-login { width: 90%; border-radius: 100px; margin: 15px 0; background-color: #c00000; } // 按钮下方提示消息的样式 .tips-text { font-size: 12px; color: gray; } } </style>
2301_80339408/uni-shop2
uni_modules/my-login/components/my-login/my-login.vue
Vue
unknown
6,159
<template> <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler"> <view class="my-search-box" :style="{'border-radius':radius + 'px'}"> <uni-icons type="search" size="17"></uni-icons> <text class="placeholder">搜索</text> </view> </view> </template> <script> export default{ props:{ //背景颜色 bgcolor:{ type:String, default:'#C00000' }, //圆角尺寸 radius:{ type:Number, default:18 //单位是px } }, data(){ return { }; }, methods:{ // 点击了模拟的 input 输入框 searchBoxHandler(){ // 触发外界通过 @click 绑定的 click 事件处理函数 this.$emit('click') } } } </script> <style lang="scss"> .my-search-container{ // background-color: #c00000; height: 50px; padding: 0 10px; display: flex; align-items: center; .my-search-box{ height: 36px; background-color: #ffffff; // border-radius: 15px; width: 100%; display: flex; align-items: center;//垂直居中 justify-content: center;//水平居中 .placeholder{ font-size: 15px; margin-left: 5px; } } } </style>
2301_80339408/uni-shop2
uni_modules/my-search/components/my-search/my-search.vue
Vue
unknown
1,368
<template> <!-- 最外层的容器 --> <view class="my-settle-container"> <!-- 全选区域 --> <label class="radio" @click="changeAllState"> <radio color="#c00000" :checked="isFullCheck" /><text>全选</text> </label> <!-- 合计区域 --> <view class="amount-box"> 合计:<text class="amount">¥{{checkedGoodsAmount}}</text> </view> <!-- 结算按钮 --> <view class="btn-settle" @click="settlement">结算({{checkedCount}})</view> </view> </template> <script> import { mapGetters, mapMutations, mapState } from 'vuex' export default { data() { return { // 倒计时的秒数 seconds: 3, // 定时器的 Id timer: null } }, computed: { ...mapGetters('m_cart', ['checkedCount', 'total', 'checkedGoodsAmount']), ...mapGetters('m_user', ['addstr']), // token 是用户登录成功之后的 token 字符串 ...mapState('m_user', ['token']), ...mapState('m_cart', ['cart']), // 2. 是否全选 isFullCheck() { return this.total == this.checkedCount } }, methods: { // 2. 使用 mapMutations 辅助函数,把 m_cart 模块提供的 updateAllGoodsState 方法映射到当前组件中使用 ...mapMutations('m_cart', ['updateAllGoodsState']), // 把 m_user 模块中的 updateRedirectInfo 方法映射到当前页面中使用 ...mapMutations('m_user', ['updateRedirectInfo']), changeAllState() { // 修改购物车中所有商品的选中状态 // !this.isFullCheck 表示:当前全选按钮的状态取反之后,就是最新的勾选状态 this.updateAllGoodsState(!this.isFullCheck) }, // 点击了结算按钮 settlement() { // 1. 先判断是否勾选了要结算的商品 if (!this.checkedCount) return uni.$showMsg('请选择要结算的商品!') // 2. 再判断用户是否选择了收货地址 if (!this.addstr) return uni.$showMsg('请选择收货地址!') // 3. 最后判断用户是否登录了 // if (!this.token) return uni.$showMsg('请先登录!') // 3. 最后判断用户是否登录了,如果没有登录,则调用 delayNavigate() 进行倒计时的导航跳转 if (!this.token) return this.delayNavigate() // 4. 实现微信支付功能 this.payOrder() }, // 微信支付 async payOrder() { // 1. 创建订单 // 1.1 组织订单的信息对象 const orderInfo = { // 开发期间,注释掉真实的订单价格, // order_price: this.checkedGoodsAmount, // 写死订单总价为 1 分钱 order_price: 0.01, consignee_addr: this.addstr, goods: this.cart.filter(x => x.goods_state).map(x => ({ goods_id: x.goods_id, goods_number: x.goods_count, goods_price: x.goods_price })) } // 1.2 发起请求创建订单 const { data: res } = await uni.$http.post('/api/public/v1/my/orders/create', orderInfo) if (res.meta.status !== 200) return uni.$showMsg('创建订单失败!') // 1.3 得到服务器响应的“订单编号” const orderNumber = res.message.order_number // 2. 订单预支付 // 2.1 发起请求获取订单的支付信息 const { data: res2 } = await uni.$http.post('/api/public/v1/my/orders/req_unifiedorder', { order_number: orderNumber }) // 2.2 预付订单生成失败 if (res2.meta.status !== 200) return uni.$showError('预付订单生成失败!') // 2.3 得到订单支付相关的必要参数 const payInfo = res2.message.pay // 3. 发起微信支付 // 3.1 调用 uni.requestPayment() 发起微信支付 const succ = uni.requestPayment(payInfo) // 3.2 未完成支付 if (succ.errMsg.includes('cancel') || succ.errMsg.includes('fail')) return uni.$showMsg('订单未支付!') // 3.3 完成了支付,进一步查询支付的结果 const { data: res3 } = await uni.$http.post('/api/public/v1/my/orders/chkOrder', { order_number: orderNumber }) // 3.4 检测到订单未支付 if (res3.meta.status !== 200) return uni.$showMsg('订单未支付!') // 3.5 检测到订单支付完成 uni.showToast({ icon: 'success', title: '支付完成!' }) }, // 展示倒计时的提示消息 showTips(n) { // 调用 uni.showToast() 方法,展示提示消息 uni.showToast({ // 不展示任何图标 icon: 'none', // 提示的消息 title: '请登录后再结算!' + n + ' 秒后自动跳转到登录页', mask: true, // 1.5 秒后自动消失 duration: 1500 }) }, // 延迟导航到 my 页面 delayNavigate() { // 把 data 中的秒数重置成 3 秒 this.seconds = 3 this.showTips(this.seconds) // 2. 创建定时器,每隔 1 秒执行一次 // 1. 将定时器的 Id 存储到 timer 中 this.timer = setInterval(() => { // 2.1 先让秒数自减 1 this.seconds-- // 2. 判断秒数是否 <= 0 if (this.seconds <= 0) { // 2.1 清除定时器 clearInterval(this.timer) // 2.2 跳转到 my 页面 uni.switchTab({ url: "/pages/my/my", // 页面跳转成功之后的回调函数 success: () => { // 调用 vuex 的 updateRedirectInfo 方法,把跳转信息存储到 Store 中 this.updateRedirectInfo({ // 跳转的方式 openType: 'switchTab', // 从哪个页面跳转过去的 from: '/page/cart/cart' }) } }) // 2.3 终止后续代码的运行(当秒数为 0 时,不再展示 toast 提示消息) return } // 2.2 再根据最新的秒数,进行消息提示 this.showTips(this.seconds) }, 1000) } } } </script> <style scoped lang="scss"> .my-settle-container { position: fixed; //固定定位 bottom: 0; left: 0; /* 设置宽高和背景色 */ width: 100%; height: 50px; background-color: white; display: flex; align-items: center; justify-content: space-around; padding-left: 5px; font-size: 14px; .radio { display: flex; align-items: center; } .amount { color: #c00000; } .btn-settle { height: 50px; line-height: 50px; min-width: 100px; background-color: #c00000; color: white; text-align: center; //文本居中对齐 padding: 0 10px; } } </style>
2301_80339408/uni-shop2
uni_modules/my-settle/components/my-settle/my-settle.vue
Vue
unknown
7,305
<template> <view class="my-userinfo-container"> <!-- 头像昵称区域 --> <view class="top-box"> <image :src="userInfo.avatarUrl" class="avatar"></image> <view class="nickname">{{userInfo.nickName}}</view> </view> <!-- 面板的列表区域 --> <view class="panel-list"> <!-- 第一个面板 --> <view class="panel"> <!-- panel 的主体区域 --> <view class="panel-body"> <!-- panel 的 item 项 --> <view class="panel-item"> <text>8</text> <text>收藏的店铺</text> </view> <view class="panel-item"> <text>14</text> <text>收藏的商品</text> </view> <view class="panel-item"> <text>18</text> <text>关注的商品</text> </view> <view class="panel-item"> <text>84</text> <text>足迹</text> </view> </view> </view> <!-- 第二个面板 --> <!-- 第二个面板 --> <view class="panel"> <!-- 面板的标题 --> <view class="panel-title">我的订单</view> <!-- 面板的主体 --> <view class="panel-body"> <!-- 面板主体中的 item 项 --> <view class="panel-item"> <image src="/static/my-icons/icon1.png" class="icon"></image> <text>待付款</text> </view> <view class="panel-item"> <image src="/static/my-icons/icon2.png" class="icon"></image> <text>待收货</text> </view> <view class="panel-item"> <image src="/static/my-icons/icon3.png" class="icon"></image> <text>退款/退货</text> </view> <view class="panel-item"> <image src="/static/my-icons/icon4.png" class="icon"></image> <text>全部订单</text> </view> </view> </view> <!-- 第三个面板 --> <view class="panel"> <view class="panel-list-item"> <text>收货地址</text> <uni-icons type="arrowright" size="15"></uni-icons> </view> <view class="panel-list-item"> <text>联系客服</text> <uni-icons type="arrowright" size="15"></uni-icons> </view> <view class="panel-list-item" @click="logout"> <text>退出登录</text> <uni-icons type="arrowright" size="15"></uni-icons> </view> </view> </view> </view> </template> <script> // 按需导入 mapState 辅助函数 import { mapState, mapMutations } from 'vuex' export default { computed: { ...mapState('m_user', ['userInfo']) }, data() { return { } }, methods: { ...mapMutations('m_user', ['updateUserInfo', 'updateToken', 'updateAddress']), async logout() { // 询问用户是否退出登录 const succ = await uni.showModal({ title: '提示', content: "确认退出登录吗?" }) if (!succ.confirm) { uni.$showMsg("用户取消退出") } if (succ && succ.confirm) { // 用户确认了退出登录的操作 // 需要清空 vuex 中的 userinfo、token 和 address this.updateUserInfo({}) this.updateToken('') this.updateAddress({}) } } } } </script> <style scoped lang="scss"> .my-userinfo-container { height: 100%; // 为整个组件的结构添加浅灰色的背景 background-color: #f4f4f4; .top-box { height: 400rpx; background-color: #c00000; display: flex; flex-direction: column; align-items: center; justify-content: center; } .avatar { display: block; width: 90px; height: 90px; border-radius: 45px; border: 2px solid white; box-shadow: 0 1px 5px black; } .nickname { color: white; font-size: 16px; font-weight: bold; margin-top: 10px; } .panel-list { padding: 0 10px; position: relative; //实现定位使其到达想要的位置 top: -10px; .panel { background-color: white; border-radius: 3px; margin-bottom: 8px; .panel-title { line-height: 45px; padding-left: 10px; font-size: 15px; border-bottom: 1px solid #f4f4f4; } .panel-body { display: flex; justify-content: space-around; .panel-item { display: flex; flex-direction: column; align-items: center; justify-content: space-around; font-size: 13px; padding: 10px 0; .icon { width: 35px; height: 35px; } } } } .panel-list-item { height: 45px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; padding: 0 10px; } } } </style>
2301_80339408/uni-shop2
uni_modules/my-userinfo/components/my-userinfo/my-userinfo.vue
Vue
unknown
5,328
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_80339408/uni-shop2
uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/index.js
JavaScript
unknown
170
<template> <view class="uni-goods-nav"> <!-- 底部占位 --> <view class="uni-tab__seat" /> <view class="uni-tab__cart-box flex"> <view class="flex uni-tab__cart-sub-left"> <view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)"> <view class="uni-tab__icon"> <uni-icons :type="item.icon" size="20" color="#646566"></uni-icons> <!-- <image class="image" :src="item.icon" mode="widthFix" /> --> </view> <text class="uni-tab__text">{{ item.text }}</text> <view class="flex uni-tab__dot-box"> <text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot " :style="{'backgroundColor':item.infoBackgroundColor?item.infoBackgroundColor:'#ff0000', color:item.infoColor?item.infoColor:'#fff' }">{{ item.info }}</text> </view> </view> </view> <view :class="{'uni-tab__right':fill}" class="flex uni-tab__cart-sub-right "> <view v-for="(item,index) in buttonGroup" :key="index" :style="{background:item.backgroundColor,color:item.color}" class="flex uni-tab__cart-button-right" @click="buttonClick(index,item)"><text :style="{color:item.color}" class="uni-tab__cart-button-right-text">{{ item.text }}</text></view> </view> </view> </view> </template> <script> import { initVueI18n } from '@dcloudio/uni-i18n' import messages from './i18n/index.js' const { t } = initVueI18n(messages) /** * GoodsNav 商品导航 * @description 商品加入购物车、立即购买等 * @tutorial https://ext.dcloud.net.cn/plugin?id=865 * @property {Array} options 组件参数 * @property {Array} buttonGroup 组件按钮组参数 * @property {Boolean} fill = [true | false] 组件按钮组参数 * @property {Boolean} stat 是否开启统计功能 * @event {Function} click 左侧点击事件 * @event {Function} buttonClick 右侧按钮组点击事件 * @example <uni-goods-nav :fill="true" options="" buttonGroup="buttonGroup" @click="" @buttonClick="" /> */ export default { name: 'UniGoodsNav', emits:['click','buttonClick'], props: { options: { type: Array, default () { return [{ icon: 'shop', text: t("uni-goods-nav.options.shop"), }, { icon: 'cart', text: t("uni-goods-nav.options.cart") }] } }, buttonGroup: { type: Array, default () { return [{ text: t("uni-goods-nav.buttonGroup.addToCart"), backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)', color: '#fff' }, { text: t("uni-goods-nav.buttonGroup.buyNow"), backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)', color: '#fff' } ] } }, fill: { type: Boolean, default: false }, stat:{ type: Boolean, default: false } }, methods: { onClick(index, item) { this.$emit('click', { index, content: item, }) }, buttonClick(index, item) { if (uni.report && this.stat) { uni.report(item.text, item.text) } this.$emit('buttonClick', { index, content: item }) } } } </script> <style lang="scss" > .flex { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .uni-goods-nav { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; } .uni-tab__cart-box { flex: 1; height: 50px; background-color: #fff; z-index: 900; } .uni-tab__cart-sub-left { padding: 0 5px; } .uni-tab__cart-sub-right { flex: 1; } .uni-tab__right { margin: 5px 0; margin-right: 10px; border-radius: 100px; overflow: hidden; } .uni-tab__cart-button-left { /* #ifndef APP-NVUE */ display: flex; /* #endif */ // flex: 1; position: relative; justify-content: center; align-items: center; flex-direction: column; margin: 0 10px; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-tab__icon { width: 18px; height: 18px; } .image { width: 18px; height: 18px; } .uni-tab__text { margin-top: 3px; font-size: 12px; color: #646566; } .uni-tab__cart-button-right { /* #ifndef APP-NVUE */ display: flex; flex-direction: column; /* #endif */ flex: 1; justify-content: center; align-items: center; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-tab__cart-button-right-text { font-size: 14px; color: #fff; } .uni-tab__cart-button-right:active { opacity: 0.7; } .uni-tab__dot-box { /* #ifndef APP-NVUE */ display: flex; flex-direction: column; /* #endif */ position: absolute; right: -2px; top: 2px; justify-content: center; align-items: center; // width: 0; // height: 0; } .uni-tab__dot { // width: 30rpx; // height: 30rpx; padding: 0 4px; line-height: 15px; color: #ffffff; text-align: center; font-size: 12px; background-color: #ff0000; border-radius: 15px; } .uni-tab__dots { padding: 0 4px; // width: auto; border-radius: 15px; } </style>
2301_80339408/uni-shop2
uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue
Vue
unknown
5,288
<template> <!-- #ifdef APP-NVUE --> <text :style="styleObj" class="uni-icons" @click="_onClick">{{unicode}}</text> <!-- #endif --> <!-- #ifndef APP-NVUE --> <text :style="styleObj" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"> <slot></slot> </text> <!-- #endif --> </template> <script> import { fontData } from './uniicons_file_vue.js'; const getVal = (val) => { const reg = /^[0-9]*$/g return (typeof val === 'number' || reg.test(val)) ? val + 'px' : val; } // #ifdef APP-NVUE var domModule = weex.requireModule('dom'); import iconUrl from './uniicons.ttf' domModule.addRule('fontFace', { 'fontFamily': "uniicons", 'src': "url('" + iconUrl + "')" }); // #endif /** * Icons 图标 * @description 用于展示 icons 图标 * @tutorial https://ext.dcloud.net.cn/plugin?id=28 * @property {Number} size 图标大小 * @property {String} type 图标图案,参考示例 * @property {String} color 图标颜色 * @property {String} customPrefix 自定义图标 * @event {Function} click 点击 Icon 触发事件 */ export default { name: 'UniIcons', emits: ['click'], props: { type: { type: String, default: '' }, color: { type: String, default: '#333333' }, size: { type: [Number, String], default: 16 }, customPrefix: { type: String, default: '' }, fontFamily: { type: String, default: '' } }, data() { return { icons: fontData } }, computed: { unicode() { let code = this.icons.find(v => v.font_class === this.type) if (code) { return code.unicode } return '' }, iconSize() { return getVal(this.size) }, styleObj() { if (this.fontFamily !== '') { return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};` } return `color: ${this.color}; font-size: ${this.iconSize};` } }, methods: { _onClick() { this.$emit('click') } } } </script> <style lang="scss"> /* #ifndef APP-NVUE */ @import './uniicons.css'; @font-face { font-family: uniicons; src: url('./uniicons.ttf'); } /* #endif */ .uni-icons { font-family: uniicons; text-decoration: none; text-align: center; } </style>
2301_80339408/uni-shop2
uni_modules/uni-icons/components/uni-icons/uni-icons.vue
Vue
unknown
2,403
.uniui-cart-filled:before { content: "\e6d0"; } .uniui-gift-filled:before { content: "\e6c4"; } .uniui-color:before { content: "\e6cf"; } .uniui-wallet:before { content: "\e6b1"; } .uniui-settings-filled:before { content: "\e6ce"; } .uniui-auth-filled:before { content: "\e6cc"; } .uniui-shop-filled:before { content: "\e6cd"; } .uniui-staff-filled:before { content: "\e6cb"; } .uniui-vip-filled:before { content: "\e6c6"; } .uniui-plus-filled:before { content: "\e6c7"; } .uniui-folder-add-filled:before { content: "\e6c8"; } .uniui-color-filled:before { content: "\e6c9"; } .uniui-tune-filled:before { content: "\e6ca"; } .uniui-calendar-filled:before { content: "\e6c0"; } .uniui-notification-filled:before { content: "\e6c1"; } .uniui-wallet-filled:before { content: "\e6c2"; } .uniui-medal-filled:before { content: "\e6c3"; } .uniui-fire-filled:before { content: "\e6c5"; } .uniui-refreshempty:before { content: "\e6bf"; } .uniui-location-filled:before { content: "\e6af"; } .uniui-person-filled:before { content: "\e69d"; } .uniui-personadd-filled:before { content: "\e698"; } .uniui-arrowthinleft:before { content: "\e6d2"; } .uniui-arrowthinup:before { content: "\e6d3"; } .uniui-arrowthindown:before { content: "\e6d4"; } .uniui-back:before { content: "\e6b9"; } .uniui-forward:before { content: "\e6ba"; } .uniui-arrow-right:before { content: "\e6bb"; } .uniui-arrow-left:before { content: "\e6bc"; } .uniui-arrow-up:before { content: "\e6bd"; } .uniui-arrow-down:before { content: "\e6be"; } .uniui-arrowthinright:before { content: "\e6d1"; } .uniui-down:before { content: "\e6b8"; } .uniui-bottom:before { content: "\e6b8"; } .uniui-arrowright:before { content: "\e6d5"; } .uniui-right:before { content: "\e6b5"; } .uniui-up:before { content: "\e6b6"; } .uniui-top:before { content: "\e6b6"; } .uniui-left:before { content: "\e6b7"; } .uniui-arrowup:before { content: "\e6d6"; } .uniui-eye:before { content: "\e651"; } .uniui-eye-filled:before { content: "\e66a"; } .uniui-eye-slash:before { content: "\e6b3"; } .uniui-eye-slash-filled:before { content: "\e6b4"; } .uniui-info-filled:before { content: "\e649"; } .uniui-reload:before { content: "\e6b2"; } .uniui-micoff-filled:before { content: "\e6b0"; } .uniui-map-pin-ellipse:before { content: "\e6ac"; } .uniui-map-pin:before { content: "\e6ad"; } .uniui-location:before { content: "\e6ae"; } .uniui-starhalf:before { content: "\e683"; } .uniui-star:before { content: "\e688"; } .uniui-star-filled:before { content: "\e68f"; } .uniui-calendar:before { content: "\e6a0"; } .uniui-fire:before { content: "\e6a1"; } .uniui-medal:before { content: "\e6a2"; } .uniui-font:before { content: "\e6a3"; } .uniui-gift:before { content: "\e6a4"; } .uniui-link:before { content: "\e6a5"; } .uniui-notification:before { content: "\e6a6"; } .uniui-staff:before { content: "\e6a7"; } .uniui-vip:before { content: "\e6a8"; } .uniui-folder-add:before { content: "\e6a9"; } .uniui-tune:before { content: "\e6aa"; } .uniui-auth:before { content: "\e6ab"; } .uniui-person:before { content: "\e699"; } .uniui-email-filled:before { content: "\e69a"; } .uniui-phone-filled:before { content: "\e69b"; } .uniui-phone:before { content: "\e69c"; } .uniui-email:before { content: "\e69e"; } .uniui-personadd:before { content: "\e69f"; } .uniui-chatboxes-filled:before { content: "\e692"; } .uniui-contact:before { content: "\e693"; } .uniui-chatbubble-filled:before { content: "\e694"; } .uniui-contact-filled:before { content: "\e695"; } .uniui-chatboxes:before { content: "\e696"; } .uniui-chatbubble:before { content: "\e697"; } .uniui-upload-filled:before { content: "\e68e"; } .uniui-upload:before { content: "\e690"; } .uniui-weixin:before { content: "\e691"; } .uniui-compose:before { content: "\e67f"; } .uniui-qq:before { content: "\e680"; } .uniui-download-filled:before { content: "\e681"; } .uniui-pyq:before { content: "\e682"; } .uniui-sound:before { content: "\e684"; } .uniui-trash-filled:before { content: "\e685"; } .uniui-sound-filled:before { content: "\e686"; } .uniui-trash:before { content: "\e687"; } .uniui-videocam-filled:before { content: "\e689"; } .uniui-spinner-cycle:before { content: "\e68a"; } .uniui-weibo:before { content: "\e68b"; } .uniui-videocam:before { content: "\e68c"; } .uniui-download:before { content: "\e68d"; } .uniui-help:before { content: "\e679"; } .uniui-navigate-filled:before { content: "\e67a"; } .uniui-plusempty:before { content: "\e67b"; } .uniui-smallcircle:before { content: "\e67c"; } .uniui-minus-filled:before { content: "\e67d"; } .uniui-micoff:before { content: "\e67e"; } .uniui-closeempty:before { content: "\e66c"; } .uniui-clear:before { content: "\e66d"; } .uniui-navigate:before { content: "\e66e"; } .uniui-minus:before { content: "\e66f"; } .uniui-image:before { content: "\e670"; } .uniui-mic:before { content: "\e671"; } .uniui-paperplane:before { content: "\e672"; } .uniui-close:before { content: "\e673"; } .uniui-help-filled:before { content: "\e674"; } .uniui-paperplane-filled:before { content: "\e675"; } .uniui-plus:before { content: "\e676"; } .uniui-mic-filled:before { content: "\e677"; } .uniui-image-filled:before { content: "\e678"; } .uniui-locked-filled:before { content: "\e668"; } .uniui-info:before { content: "\e669"; } .uniui-locked:before { content: "\e66b"; } .uniui-camera-filled:before { content: "\e658"; } .uniui-chat-filled:before { content: "\e659"; } .uniui-camera:before { content: "\e65a"; } .uniui-circle:before { content: "\e65b"; } .uniui-checkmarkempty:before { content: "\e65c"; } .uniui-chat:before { content: "\e65d"; } .uniui-circle-filled:before { content: "\e65e"; } .uniui-flag:before { content: "\e65f"; } .uniui-flag-filled:before { content: "\e660"; } .uniui-gear-filled:before { content: "\e661"; } .uniui-home:before { content: "\e662"; } .uniui-home-filled:before { content: "\e663"; } .uniui-gear:before { content: "\e664"; } .uniui-smallcircle-filled:before { content: "\e665"; } .uniui-map-filled:before { content: "\e666"; } .uniui-map:before { content: "\e667"; } .uniui-refresh-filled:before { content: "\e656"; } .uniui-refresh:before { content: "\e657"; } .uniui-cloud-upload:before { content: "\e645"; } .uniui-cloud-download-filled:before { content: "\e646"; } .uniui-cloud-download:before { content: "\e647"; } .uniui-cloud-upload-filled:before { content: "\e648"; } .uniui-redo:before { content: "\e64a"; } .uniui-images-filled:before { content: "\e64b"; } .uniui-undo-filled:before { content: "\e64c"; } .uniui-more:before { content: "\e64d"; } .uniui-more-filled:before { content: "\e64e"; } .uniui-undo:before { content: "\e64f"; } .uniui-images:before { content: "\e650"; } .uniui-paperclip:before { content: "\e652"; } .uniui-settings:before { content: "\e653"; } .uniui-search:before { content: "\e654"; } .uniui-redo-filled:before { content: "\e655"; } .uniui-list:before { content: "\e644"; } .uniui-mail-open-filled:before { content: "\e63a"; } .uniui-hand-down-filled:before { content: "\e63c"; } .uniui-hand-down:before { content: "\e63d"; } .uniui-hand-up-filled:before { content: "\e63e"; } .uniui-hand-up:before { content: "\e63f"; } .uniui-heart-filled:before { content: "\e641"; } .uniui-mail-open:before { content: "\e643"; } .uniui-heart:before { content: "\e639"; } .uniui-loop:before { content: "\e633"; } .uniui-pulldown:before { content: "\e632"; } .uniui-scan:before { content: "\e62a"; } .uniui-bars:before { content: "\e627"; } .uniui-checkbox:before { content: "\e62b"; } .uniui-checkbox-filled:before { content: "\e62c"; } .uniui-shop:before { content: "\e62f"; } .uniui-headphones:before { content: "\e630"; } .uniui-cart:before { content: "\e631"; }
2301_80339408/uni-shop2
uni_modules/uni-icons/components/uni-icons/uniicons.css
CSS
unknown
8,151
export type IconsData = { id : string name : string font_family : string css_prefix_text : string description : string glyphs : Array<IconsDataItem> } export type IconsDataItem = { font_class : string unicode : string } export const fontData = [ { "font_class": "arrow-down", "unicode": "\ue6be" }, { "font_class": "arrow-left", "unicode": "\ue6bc" }, { "font_class": "arrow-right", "unicode": "\ue6bb" }, { "font_class": "arrow-up", "unicode": "\ue6bd" }, { "font_class": "auth", "unicode": "\ue6ab" }, { "font_class": "auth-filled", "unicode": "\ue6cc" }, { "font_class": "back", "unicode": "\ue6b9" }, { "font_class": "bars", "unicode": "\ue627" }, { "font_class": "calendar", "unicode": "\ue6a0" }, { "font_class": "calendar-filled", "unicode": "\ue6c0" }, { "font_class": "camera", "unicode": "\ue65a" }, { "font_class": "camera-filled", "unicode": "\ue658" }, { "font_class": "cart", "unicode": "\ue631" }, { "font_class": "cart-filled", "unicode": "\ue6d0" }, { "font_class": "chat", "unicode": "\ue65d" }, { "font_class": "chat-filled", "unicode": "\ue659" }, { "font_class": "chatboxes", "unicode": "\ue696" }, { "font_class": "chatboxes-filled", "unicode": "\ue692" }, { "font_class": "chatbubble", "unicode": "\ue697" }, { "font_class": "chatbubble-filled", "unicode": "\ue694" }, { "font_class": "checkbox", "unicode": "\ue62b" }, { "font_class": "checkbox-filled", "unicode": "\ue62c" }, { "font_class": "checkmarkempty", "unicode": "\ue65c" }, { "font_class": "circle", "unicode": "\ue65b" }, { "font_class": "circle-filled", "unicode": "\ue65e" }, { "font_class": "clear", "unicode": "\ue66d" }, { "font_class": "close", "unicode": "\ue673" }, { "font_class": "closeempty", "unicode": "\ue66c" }, { "font_class": "cloud-download", "unicode": "\ue647" }, { "font_class": "cloud-download-filled", "unicode": "\ue646" }, { "font_class": "cloud-upload", "unicode": "\ue645" }, { "font_class": "cloud-upload-filled", "unicode": "\ue648" }, { "font_class": "color", "unicode": "\ue6cf" }, { "font_class": "color-filled", "unicode": "\ue6c9" }, { "font_class": "compose", "unicode": "\ue67f" }, { "font_class": "contact", "unicode": "\ue693" }, { "font_class": "contact-filled", "unicode": "\ue695" }, { "font_class": "down", "unicode": "\ue6b8" }, { "font_class": "bottom", "unicode": "\ue6b8" }, { "font_class": "download", "unicode": "\ue68d" }, { "font_class": "download-filled", "unicode": "\ue681" }, { "font_class": "email", "unicode": "\ue69e" }, { "font_class": "email-filled", "unicode": "\ue69a" }, { "font_class": "eye", "unicode": "\ue651" }, { "font_class": "eye-filled", "unicode": "\ue66a" }, { "font_class": "eye-slash", "unicode": "\ue6b3" }, { "font_class": "eye-slash-filled", "unicode": "\ue6b4" }, { "font_class": "fire", "unicode": "\ue6a1" }, { "font_class": "fire-filled", "unicode": "\ue6c5" }, { "font_class": "flag", "unicode": "\ue65f" }, { "font_class": "flag-filled", "unicode": "\ue660" }, { "font_class": "folder-add", "unicode": "\ue6a9" }, { "font_class": "folder-add-filled", "unicode": "\ue6c8" }, { "font_class": "font", "unicode": "\ue6a3" }, { "font_class": "forward", "unicode": "\ue6ba" }, { "font_class": "gear", "unicode": "\ue664" }, { "font_class": "gear-filled", "unicode": "\ue661" }, { "font_class": "gift", "unicode": "\ue6a4" }, { "font_class": "gift-filled", "unicode": "\ue6c4" }, { "font_class": "hand-down", "unicode": "\ue63d" }, { "font_class": "hand-down-filled", "unicode": "\ue63c" }, { "font_class": "hand-up", "unicode": "\ue63f" }, { "font_class": "hand-up-filled", "unicode": "\ue63e" }, { "font_class": "headphones", "unicode": "\ue630" }, { "font_class": "heart", "unicode": "\ue639" }, { "font_class": "heart-filled", "unicode": "\ue641" }, { "font_class": "help", "unicode": "\ue679" }, { "font_class": "help-filled", "unicode": "\ue674" }, { "font_class": "home", "unicode": "\ue662" }, { "font_class": "home-filled", "unicode": "\ue663" }, { "font_class": "image", "unicode": "\ue670" }, { "font_class": "image-filled", "unicode": "\ue678" }, { "font_class": "images", "unicode": "\ue650" }, { "font_class": "images-filled", "unicode": "\ue64b" }, { "font_class": "info", "unicode": "\ue669" }, { "font_class": "info-filled", "unicode": "\ue649" }, { "font_class": "left", "unicode": "\ue6b7" }, { "font_class": "link", "unicode": "\ue6a5" }, { "font_class": "list", "unicode": "\ue644" }, { "font_class": "location", "unicode": "\ue6ae" }, { "font_class": "location-filled", "unicode": "\ue6af" }, { "font_class": "locked", "unicode": "\ue66b" }, { "font_class": "locked-filled", "unicode": "\ue668" }, { "font_class": "loop", "unicode": "\ue633" }, { "font_class": "mail-open", "unicode": "\ue643" }, { "font_class": "mail-open-filled", "unicode": "\ue63a" }, { "font_class": "map", "unicode": "\ue667" }, { "font_class": "map-filled", "unicode": "\ue666" }, { "font_class": "map-pin", "unicode": "\ue6ad" }, { "font_class": "map-pin-ellipse", "unicode": "\ue6ac" }, { "font_class": "medal", "unicode": "\ue6a2" }, { "font_class": "medal-filled", "unicode": "\ue6c3" }, { "font_class": "mic", "unicode": "\ue671" }, { "font_class": "mic-filled", "unicode": "\ue677" }, { "font_class": "micoff", "unicode": "\ue67e" }, { "font_class": "micoff-filled", "unicode": "\ue6b0" }, { "font_class": "minus", "unicode": "\ue66f" }, { "font_class": "minus-filled", "unicode": "\ue67d" }, { "font_class": "more", "unicode": "\ue64d" }, { "font_class": "more-filled", "unicode": "\ue64e" }, { "font_class": "navigate", "unicode": "\ue66e" }, { "font_class": "navigate-filled", "unicode": "\ue67a" }, { "font_class": "notification", "unicode": "\ue6a6" }, { "font_class": "notification-filled", "unicode": "\ue6c1" }, { "font_class": "paperclip", "unicode": "\ue652" }, { "font_class": "paperplane", "unicode": "\ue672" }, { "font_class": "paperplane-filled", "unicode": "\ue675" }, { "font_class": "person", "unicode": "\ue699" }, { "font_class": "person-filled", "unicode": "\ue69d" }, { "font_class": "personadd", "unicode": "\ue69f" }, { "font_class": "personadd-filled", "unicode": "\ue698" }, { "font_class": "personadd-filled-copy", "unicode": "\ue6d1" }, { "font_class": "phone", "unicode": "\ue69c" }, { "font_class": "phone-filled", "unicode": "\ue69b" }, { "font_class": "plus", "unicode": "\ue676" }, { "font_class": "plus-filled", "unicode": "\ue6c7" }, { "font_class": "plusempty", "unicode": "\ue67b" }, { "font_class": "pulldown", "unicode": "\ue632" }, { "font_class": "pyq", "unicode": "\ue682" }, { "font_class": "qq", "unicode": "\ue680" }, { "font_class": "redo", "unicode": "\ue64a" }, { "font_class": "redo-filled", "unicode": "\ue655" }, { "font_class": "refresh", "unicode": "\ue657" }, { "font_class": "refresh-filled", "unicode": "\ue656" }, { "font_class": "refreshempty", "unicode": "\ue6bf" }, { "font_class": "reload", "unicode": "\ue6b2" }, { "font_class": "right", "unicode": "\ue6b5" }, { "font_class": "scan", "unicode": "\ue62a" }, { "font_class": "search", "unicode": "\ue654" }, { "font_class": "settings", "unicode": "\ue653" }, { "font_class": "settings-filled", "unicode": "\ue6ce" }, { "font_class": "shop", "unicode": "\ue62f" }, { "font_class": "shop-filled", "unicode": "\ue6cd" }, { "font_class": "smallcircle", "unicode": "\ue67c" }, { "font_class": "smallcircle-filled", "unicode": "\ue665" }, { "font_class": "sound", "unicode": "\ue684" }, { "font_class": "sound-filled", "unicode": "\ue686" }, { "font_class": "spinner-cycle", "unicode": "\ue68a" }, { "font_class": "staff", "unicode": "\ue6a7" }, { "font_class": "staff-filled", "unicode": "\ue6cb" }, { "font_class": "star", "unicode": "\ue688" }, { "font_class": "star-filled", "unicode": "\ue68f" }, { "font_class": "starhalf", "unicode": "\ue683" }, { "font_class": "trash", "unicode": "\ue687" }, { "font_class": "trash-filled", "unicode": "\ue685" }, { "font_class": "tune", "unicode": "\ue6aa" }, { "font_class": "tune-filled", "unicode": "\ue6ca" }, { "font_class": "undo", "unicode": "\ue64f" }, { "font_class": "undo-filled", "unicode": "\ue64c" }, { "font_class": "up", "unicode": "\ue6b6" }, { "font_class": "top", "unicode": "\ue6b6" }, { "font_class": "upload", "unicode": "\ue690" }, { "font_class": "upload-filled", "unicode": "\ue68e" }, { "font_class": "videocam", "unicode": "\ue68c" }, { "font_class": "videocam-filled", "unicode": "\ue689" }, { "font_class": "vip", "unicode": "\ue6a8" }, { "font_class": "vip-filled", "unicode": "\ue6c6" }, { "font_class": "wallet", "unicode": "\ue6b1" }, { "font_class": "wallet-filled", "unicode": "\ue6c2" }, { "font_class": "weibo", "unicode": "\ue68b" }, { "font_class": "weixin", "unicode": "\ue691" } ] as IconsDataItem[] // export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
2301_80339408/uni-shop2
uni_modules/uni-icons/components/uni-icons/uniicons_file.ts
TypeScript
unknown
10,675
export const fontData = [ { "font_class": "arrow-down", "unicode": "\ue6be" }, { "font_class": "arrow-left", "unicode": "\ue6bc" }, { "font_class": "arrow-right", "unicode": "\ue6bb" }, { "font_class": "arrow-up", "unicode": "\ue6bd" }, { "font_class": "auth", "unicode": "\ue6ab" }, { "font_class": "auth-filled", "unicode": "\ue6cc" }, { "font_class": "back", "unicode": "\ue6b9" }, { "font_class": "bars", "unicode": "\ue627" }, { "font_class": "calendar", "unicode": "\ue6a0" }, { "font_class": "calendar-filled", "unicode": "\ue6c0" }, { "font_class": "camera", "unicode": "\ue65a" }, { "font_class": "camera-filled", "unicode": "\ue658" }, { "font_class": "cart", "unicode": "\ue631" }, { "font_class": "cart-filled", "unicode": "\ue6d0" }, { "font_class": "chat", "unicode": "\ue65d" }, { "font_class": "chat-filled", "unicode": "\ue659" }, { "font_class": "chatboxes", "unicode": "\ue696" }, { "font_class": "chatboxes-filled", "unicode": "\ue692" }, { "font_class": "chatbubble", "unicode": "\ue697" }, { "font_class": "chatbubble-filled", "unicode": "\ue694" }, { "font_class": "checkbox", "unicode": "\ue62b" }, { "font_class": "checkbox-filled", "unicode": "\ue62c" }, { "font_class": "checkmarkempty", "unicode": "\ue65c" }, { "font_class": "circle", "unicode": "\ue65b" }, { "font_class": "circle-filled", "unicode": "\ue65e" }, { "font_class": "clear", "unicode": "\ue66d" }, { "font_class": "close", "unicode": "\ue673" }, { "font_class": "closeempty", "unicode": "\ue66c" }, { "font_class": "cloud-download", "unicode": "\ue647" }, { "font_class": "cloud-download-filled", "unicode": "\ue646" }, { "font_class": "cloud-upload", "unicode": "\ue645" }, { "font_class": "cloud-upload-filled", "unicode": "\ue648" }, { "font_class": "color", "unicode": "\ue6cf" }, { "font_class": "color-filled", "unicode": "\ue6c9" }, { "font_class": "compose", "unicode": "\ue67f" }, { "font_class": "contact", "unicode": "\ue693" }, { "font_class": "contact-filled", "unicode": "\ue695" }, { "font_class": "down", "unicode": "\ue6b8" }, { "font_class": "bottom", "unicode": "\ue6b8" }, { "font_class": "download", "unicode": "\ue68d" }, { "font_class": "download-filled", "unicode": "\ue681" }, { "font_class": "email", "unicode": "\ue69e" }, { "font_class": "email-filled", "unicode": "\ue69a" }, { "font_class": "eye", "unicode": "\ue651" }, { "font_class": "eye-filled", "unicode": "\ue66a" }, { "font_class": "eye-slash", "unicode": "\ue6b3" }, { "font_class": "eye-slash-filled", "unicode": "\ue6b4" }, { "font_class": "fire", "unicode": "\ue6a1" }, { "font_class": "fire-filled", "unicode": "\ue6c5" }, { "font_class": "flag", "unicode": "\ue65f" }, { "font_class": "flag-filled", "unicode": "\ue660" }, { "font_class": "folder-add", "unicode": "\ue6a9" }, { "font_class": "folder-add-filled", "unicode": "\ue6c8" }, { "font_class": "font", "unicode": "\ue6a3" }, { "font_class": "forward", "unicode": "\ue6ba" }, { "font_class": "gear", "unicode": "\ue664" }, { "font_class": "gear-filled", "unicode": "\ue661" }, { "font_class": "gift", "unicode": "\ue6a4" }, { "font_class": "gift-filled", "unicode": "\ue6c4" }, { "font_class": "hand-down", "unicode": "\ue63d" }, { "font_class": "hand-down-filled", "unicode": "\ue63c" }, { "font_class": "hand-up", "unicode": "\ue63f" }, { "font_class": "hand-up-filled", "unicode": "\ue63e" }, { "font_class": "headphones", "unicode": "\ue630" }, { "font_class": "heart", "unicode": "\ue639" }, { "font_class": "heart-filled", "unicode": "\ue641" }, { "font_class": "help", "unicode": "\ue679" }, { "font_class": "help-filled", "unicode": "\ue674" }, { "font_class": "home", "unicode": "\ue662" }, { "font_class": "home-filled", "unicode": "\ue663" }, { "font_class": "image", "unicode": "\ue670" }, { "font_class": "image-filled", "unicode": "\ue678" }, { "font_class": "images", "unicode": "\ue650" }, { "font_class": "images-filled", "unicode": "\ue64b" }, { "font_class": "info", "unicode": "\ue669" }, { "font_class": "info-filled", "unicode": "\ue649" }, { "font_class": "left", "unicode": "\ue6b7" }, { "font_class": "link", "unicode": "\ue6a5" }, { "font_class": "list", "unicode": "\ue644" }, { "font_class": "location", "unicode": "\ue6ae" }, { "font_class": "location-filled", "unicode": "\ue6af" }, { "font_class": "locked", "unicode": "\ue66b" }, { "font_class": "locked-filled", "unicode": "\ue668" }, { "font_class": "loop", "unicode": "\ue633" }, { "font_class": "mail-open", "unicode": "\ue643" }, { "font_class": "mail-open-filled", "unicode": "\ue63a" }, { "font_class": "map", "unicode": "\ue667" }, { "font_class": "map-filled", "unicode": "\ue666" }, { "font_class": "map-pin", "unicode": "\ue6ad" }, { "font_class": "map-pin-ellipse", "unicode": "\ue6ac" }, { "font_class": "medal", "unicode": "\ue6a2" }, { "font_class": "medal-filled", "unicode": "\ue6c3" }, { "font_class": "mic", "unicode": "\ue671" }, { "font_class": "mic-filled", "unicode": "\ue677" }, { "font_class": "micoff", "unicode": "\ue67e" }, { "font_class": "micoff-filled", "unicode": "\ue6b0" }, { "font_class": "minus", "unicode": "\ue66f" }, { "font_class": "minus-filled", "unicode": "\ue67d" }, { "font_class": "more", "unicode": "\ue64d" }, { "font_class": "more-filled", "unicode": "\ue64e" }, { "font_class": "navigate", "unicode": "\ue66e" }, { "font_class": "navigate-filled", "unicode": "\ue67a" }, { "font_class": "notification", "unicode": "\ue6a6" }, { "font_class": "notification-filled", "unicode": "\ue6c1" }, { "font_class": "paperclip", "unicode": "\ue652" }, { "font_class": "paperplane", "unicode": "\ue672" }, { "font_class": "paperplane-filled", "unicode": "\ue675" }, { "font_class": "person", "unicode": "\ue699" }, { "font_class": "person-filled", "unicode": "\ue69d" }, { "font_class": "personadd", "unicode": "\ue69f" }, { "font_class": "personadd-filled", "unicode": "\ue698" }, { "font_class": "personadd-filled-copy", "unicode": "\ue6d1" }, { "font_class": "phone", "unicode": "\ue69c" }, { "font_class": "phone-filled", "unicode": "\ue69b" }, { "font_class": "plus", "unicode": "\ue676" }, { "font_class": "plus-filled", "unicode": "\ue6c7" }, { "font_class": "plusempty", "unicode": "\ue67b" }, { "font_class": "pulldown", "unicode": "\ue632" }, { "font_class": "pyq", "unicode": "\ue682" }, { "font_class": "qq", "unicode": "\ue680" }, { "font_class": "redo", "unicode": "\ue64a" }, { "font_class": "redo-filled", "unicode": "\ue655" }, { "font_class": "refresh", "unicode": "\ue657" }, { "font_class": "refresh-filled", "unicode": "\ue656" }, { "font_class": "refreshempty", "unicode": "\ue6bf" }, { "font_class": "reload", "unicode": "\ue6b2" }, { "font_class": "right", "unicode": "\ue6b5" }, { "font_class": "scan", "unicode": "\ue62a" }, { "font_class": "search", "unicode": "\ue654" }, { "font_class": "settings", "unicode": "\ue653" }, { "font_class": "settings-filled", "unicode": "\ue6ce" }, { "font_class": "shop", "unicode": "\ue62f" }, { "font_class": "shop-filled", "unicode": "\ue6cd" }, { "font_class": "smallcircle", "unicode": "\ue67c" }, { "font_class": "smallcircle-filled", "unicode": "\ue665" }, { "font_class": "sound", "unicode": "\ue684" }, { "font_class": "sound-filled", "unicode": "\ue686" }, { "font_class": "spinner-cycle", "unicode": "\ue68a" }, { "font_class": "staff", "unicode": "\ue6a7" }, { "font_class": "staff-filled", "unicode": "\ue6cb" }, { "font_class": "star", "unicode": "\ue688" }, { "font_class": "star-filled", "unicode": "\ue68f" }, { "font_class": "starhalf", "unicode": "\ue683" }, { "font_class": "trash", "unicode": "\ue687" }, { "font_class": "trash-filled", "unicode": "\ue685" }, { "font_class": "tune", "unicode": "\ue6aa" }, { "font_class": "tune-filled", "unicode": "\ue6ca" }, { "font_class": "undo", "unicode": "\ue64f" }, { "font_class": "undo-filled", "unicode": "\ue64c" }, { "font_class": "up", "unicode": "\ue6b6" }, { "font_class": "top", "unicode": "\ue6b6" }, { "font_class": "upload", "unicode": "\ue690" }, { "font_class": "upload-filled", "unicode": "\ue68e" }, { "font_class": "videocam", "unicode": "\ue68c" }, { "font_class": "videocam-filled", "unicode": "\ue689" }, { "font_class": "vip", "unicode": "\ue6a8" }, { "font_class": "vip-filled", "unicode": "\ue6c6" }, { "font_class": "wallet", "unicode": "\ue6b1" }, { "font_class": "wallet-filled", "unicode": "\ue6c2" }, { "font_class": "weibo", "unicode": "\ue68b" }, { "font_class": "weixin", "unicode": "\ue691" } ] // export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
2301_80339408/uni-shop2
uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js
JavaScript
unknown
10,410
<template> <view class="uni-numbox"> <view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}"> <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text> </view> <input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" :type="step<1?'digit':'number'" v-model="inputValue" :style="{background, color, width:widthWithPx}" /> <view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}"> <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text> </view> </view> </template> <script> /** * NumberBox 数字输入框 * @description 带加减按钮的数字输入框 * @tutorial https://ext.dcloud.net.cn/plugin?id=31 * @property {Number} value 输入框当前值 * @property {Number} min 最小值 * @property {Number} max 最大值 * @property {Number} step 每次点击改变的间隔大小 * @property {String} background 背景色 * @property {String} color 字体颜色(前景色) * @property {Number} width 输入框宽度(单位:px) * @property {Boolean} disabled = [true|false] 是否为禁用状态 * @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value * @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象 * @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象 */ export default { name: "UniNumberBox", emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'], props: { value: { type: [Number, String], default: 1 }, modelValue: { type: [Number, String], default: 1 }, min: { type: Number, default: 0 }, max: { type: Number, default: 100 }, step: { type: Number, default: 1 }, background: { type: String, default: '#f5f5f5' }, color: { type: String, default: '#333' }, disabled: { type: Boolean, default: false }, width: { type: Number, default: 40, } }, data() { return { inputValue: 0 }; }, watch: { value(val) { this.inputValue = +val; }, modelValue(val) { this.inputValue = +val; } }, computed: { widthWithPx() { return this.width + 'px'; } }, created() { if (this.value === 1) { this.inputValue = +this.modelValue; } if (this.modelValue === 1) { this.inputValue = +this.value; } }, methods: { _calcValue(type) { if (this.disabled) { return; } const scale = this._getDecimalScale(); let value = this.inputValue * scale; let step = this.step * scale; if (type === "minus") { value -= step; if (value < (this.min * scale)) { return; } if (value > (this.max * scale)) { value = this.max * scale } } if (type === "plus") { value += step; if (value > (this.max * scale)) { return; } if (value < (this.min * scale)) { value = this.min * scale } } this.inputValue = (value / scale).toFixed(String(scale).length - 1); // TODO vue2 兼容 this.$emit("input", +this.inputValue); // TODO vue3 兼容 this.$emit("update:modelValue", +this.inputValue); this.$emit("change", +this.inputValue); }, _getDecimalScale() { let scale = 1; // 浮点型 if (~~this.step !== this.step) { scale = Math.pow(10, String(this.step).split(".")[1].length); } return scale; }, _onBlur(event) { this.$emit('blur', event) let value = event.detail.value; if (isNaN(value)) { this.inputValue = this.value; return; } value = +value; if (value > this.max) { value = this.max; } else if (value < this.min) { value = this.min; } const scale = this._getDecimalScale(); this.inputValue = value.toFixed(String(scale).length - 1); this.$emit("input", +this.inputValue); this.$emit("update:modelValue", +this.inputValue); this.$emit("change", +this.inputValue); }, _onFocus(event) { this.$emit('focus', event) } } }; </script> <style lang="scss"> $box-height: 26px; $bg: #f5f5f5; $br: 2px; $color: #333; .uni-numbox { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .uni-numbox-btns { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: center; justify-content: center; padding: 0 8px; background-color: $bg; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-numbox__value { margin: 0 2px; background-color: $bg; width: 40px; height: $box-height; text-align: center; font-size: 14px; border-width: 0; color: $color; } .uni-numbox__minus { border-top-left-radius: $br; border-bottom-left-radius: $br; } .uni-numbox__plus { border-top-right-radius: $br; border-bottom-right-radius: $br; } .uni-numbox--text { // fix nvue line-height: 20px; margin-bottom: 2px; font-size: 20px; font-weight: 300; color: $color; } .uni-numbox .uni-numbox--disabled { color: #c0c0c0 !important; /* #ifdef H5 */ cursor: not-allowed; /* #endif */ } </style>
2301_80339408/uni-shop2
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
Vue
unknown
5,594
@import './styles/index.scss';
2301_80339408/uni-shop2
uni_modules/uni-scss/index.scss
SCSS
unknown
31
@import './setting/_variables.scss'; @import './setting/_border.scss'; @import './setting/_color.scss'; @import './setting/_space.scss'; @import './setting/_radius.scss'; @import './setting/_text.scss'; @import './setting/_styles.scss';
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/index.scss
SCSS
unknown
237
.uni-border { border: 1px $uni-border-1 solid; }
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_border.scss
SCSS
unknown
49
// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 // @mixin get-styles($k,$c) { // @if $k == size or $k == weight{ // font-#{$k}:#{$c} // }@else{ // #{$k}:#{$c} // } // } $uni-ui-color:( // 主色 primary: $uni-primary, primary-disable: $uni-primary-disable, primary-light: $uni-primary-light, // 辅助色 success: $uni-success, success-disable: $uni-success-disable, success-light: $uni-success-light, warning: $uni-warning, warning-disable: $uni-warning-disable, warning-light: $uni-warning-light, error: $uni-error, error-disable: $uni-error-disable, error-light: $uni-error-light, info: $uni-info, info-disable: $uni-info-disable, info-light: $uni-info-light, // 中性色 main-color: $uni-main-color, base-color: $uni-base-color, secondary-color: $uni-secondary-color, extra-color: $uni-extra-color, // 背景色 bg-color: $uni-bg-color, // 边框颜色 border-1: $uni-border-1, border-2: $uni-border-2, border-3: $uni-border-3, border-4: $uni-border-4, // 黑色 black:$uni-black, // 白色 white:$uni-white, // 透明 transparent:$uni-transparent ) !default; @each $key, $child in $uni-ui-color { .uni-#{"" + $key} { color: $child; } .uni-#{"" + $key}-bg { background-color: $child; } } .uni-shadow-sm { box-shadow: $uni-shadow-sm; } .uni-shadow-base { box-shadow: $uni-shadow-base; } .uni-shadow-lg { box-shadow: $uni-shadow-lg; } .uni-mask { background-color:$uni-mask; }
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_color.scss
SCSS
unknown
1,491
@mixin radius($r,$d:null ,$important: false){ $radius-value:map-get($uni-radius, $r) if($important, !important, null); // Key exists within the $uni-radius variable @if (map-has-key($uni-radius, $r) and $d){ @if $d == t { border-top-left-radius:$radius-value; border-top-right-radius:$radius-value; }@else if $d == r { border-top-right-radius:$radius-value; border-bottom-right-radius:$radius-value; }@else if $d == b { border-bottom-left-radius:$radius-value; border-bottom-right-radius:$radius-value; }@else if $d == l { border-top-left-radius:$radius-value; border-bottom-left-radius:$radius-value; }@else if $d == tl { border-top-left-radius:$radius-value; }@else if $d == tr { border-top-right-radius:$radius-value; }@else if $d == br { border-bottom-right-radius:$radius-value; }@else if $d == bl { border-bottom-left-radius:$radius-value; } }@else{ border-radius:$radius-value; } } @each $key, $child in $uni-radius { @if($key){ .uni-radius-#{"" + $key} { @include radius($key) } }@else{ .uni-radius { @include radius($key) } } } @each $direction in t, r, b, l,tl, tr, br, bl { @each $key, $child in $uni-radius { @if($key){ .uni-radius-#{"" + $direction}-#{"" + $key} { @include radius($key,$direction,false) } }@else{ .uni-radius-#{$direction} { @include radius($key,$direction,false) } } } }
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_radius.scss
SCSS
unknown
1,430
@mixin fn($space,$direction,$size,$n) { @if $n { #{$space}-#{$direction}: #{$size*$uni-space-root}px } @else { #{$space}-#{$direction}: #{-$size*$uni-space-root}px } } @mixin get-styles($direction,$i,$space,$n){ @if $direction == t { @include fn($space, top,$i,$n); } @if $direction == r { @include fn($space, right,$i,$n); } @if $direction == b { @include fn($space, bottom,$i,$n); } @if $direction == l { @include fn($space, left,$i,$n); } @if $direction == x { @include fn($space, left,$i,$n); @include fn($space, right,$i,$n); } @if $direction == y { @include fn($space, top,$i,$n); @include fn($space, bottom,$i,$n); } @if $direction == a { @if $n { #{$space}:#{$i*$uni-space-root}px; } @else { #{$space}:#{-$i*$uni-space-root}px; } } } @each $orientation in m,p { $space: margin; @if $orientation == m { $space: margin; } @else { $space: padding; } @for $i from 0 through 16 { @each $direction in t, r, b, l, x, y, a { .uni-#{$orientation}#{$direction}-#{$i} { @include get-styles($direction,$i,$space,true); } .uni-#{$orientation}#{$direction}-n#{$i} { @include get-styles($direction,$i,$space,false); } } } }
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_space.scss
SCSS
unknown
1,214
/* #ifndef APP-NVUE */ $-color-white:#fff; $-color-black:#000; @mixin base-style($color) { color: #fff; background-color: $color; border-color: mix($-color-black, $color, 8%); &:not([hover-class]):active { background: mix($-color-black, $color, 10%); border-color: mix($-color-black, $color, 20%); color: $-color-white; outline: none; } } @mixin is-color($color) { @include base-style($color); &[loading] { @include base-style($color); &::before { margin-right:5px; } } &[disabled] { &, &[loading], &:not([hover-class]):active { color: $-color-white; border-color: mix(darken($color,10%), $-color-white); background-color: mix($color, $-color-white); } } } @mixin base-plain-style($color) { color:$color; background-color: mix($-color-white, $color, 90%); border-color: mix($-color-white, $color, 70%); &:not([hover-class]):active { background: mix($-color-white, $color, 80%); color: $color; outline: none; border-color: mix($-color-white, $color, 50%); } } @mixin is-plain($color){ &[plain] { @include base-plain-style($color); &[loading] { @include base-plain-style($color); &::before { margin-right:5px; } } &[disabled] { &, &:active { color: mix($-color-white, $color, 40%); background-color: mix($-color-white, $color, 90%); border-color: mix($-color-white, $color, 80%); } } } } .uni-btn { margin: 5px; color: #393939; border:1px solid #ccc; font-size: 16px; font-weight: 200; background-color: #F9F9F9; // TODO 暂时处理边框隐藏一边的问题 overflow: visible; &::after{ border: none; } &:not([type]),&[type=default] { color: #999; &[loading] { background: none; &::before { margin-right:5px; } } &[disabled]{ color: mix($-color-white, #999, 60%); &, &[loading], &:active { color: mix($-color-white, #999, 60%); background-color: mix($-color-white,$-color-black , 98%); border-color: mix($-color-white, #999, 85%); } } &[plain] { color: #999; background: none; border-color: $uni-border-1; &:not([hover-class]):active { background: none; color: mix($-color-white, $-color-black, 80%); border-color: mix($-color-white, $-color-black, 90%); outline: none; } &[disabled]{ &, &[loading], &:active { background: none; color: mix($-color-white, #999, 60%); border-color: mix($-color-white, #999, 85%); } } } } &:not([hover-class]):active { color: mix($-color-white, $-color-black, 50%); } &[size=mini] { font-size: 16px; font-weight: 200; border-radius: 8px; } &.uni-btn-small { font-size: 14px; } &.uni-btn-mini { font-size: 12px; } &.uni-btn-radius { border-radius: 999px; } &[type=primary] { @include is-color($uni-primary); @include is-plain($uni-primary) } &[type=success] { @include is-color($uni-success); @include is-plain($uni-success) } &[type=error] { @include is-color($uni-error); @include is-plain($uni-error) } &[type=warning] { @include is-color($uni-warning); @include is-plain($uni-warning) } &[type=info] { @include is-color($uni-info); @include is-plain($uni-info) } } /* #endif */
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_styles.scss
SCSS
unknown
3,253
@mixin get-styles($k,$c) { @if $k == size or $k == weight{ font-#{$k}:#{$c} }@else{ #{$k}:#{$c} } } @each $key, $child in $uni-headings { /* #ifndef APP-NVUE */ .uni-#{$key} { @each $k, $c in $child { @include get-styles($k,$c) } } /* #endif */ /* #ifdef APP-NVUE */ .container .uni-#{$key} { @each $k, $c in $child { @include get-styles($k,$c) } } /* #endif */ }
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_text.scss
SCSS
unknown
394
// @use "sass:math"; @import '../tools/functions.scss'; // 间距基础倍数 $uni-space-root: 2 !default; // 边框半径默认值 $uni-radius-root:5px !default; $uni-radius: () !default; // 边框半径断点 $uni-radius: map-deep-merge( ( 0: 0, // TODO 当前版本暂时不支持 sm 属性 // 'sm': math.div($uni-radius-root, 2), null: $uni-radius-root, 'lg': $uni-radius-root * 2, 'xl': $uni-radius-root * 6, 'pill': 9999px, 'circle': 50% ), $uni-radius ); // 字体家族 $body-font-family: 'Roboto', sans-serif !default; // 文本 $heading-font-family: $body-font-family !default; $uni-headings: () !default; $letterSpacing: -0.01562em; $uni-headings: map-deep-merge( ( 'h1': ( size: 32px, weight: 300, line-height: 50px, // letter-spacing:-0.01562em ), 'h2': ( size: 28px, weight: 300, line-height: 40px, // letter-spacing: -0.00833em ), 'h3': ( size: 24px, weight: 400, line-height: 32px, // letter-spacing: normal ), 'h4': ( size: 20px, weight: 400, line-height: 30px, // letter-spacing: 0.00735em ), 'h5': ( size: 16px, weight: 400, line-height: 24px, // letter-spacing: normal ), 'h6': ( size: 14px, weight: 500, line-height: 18px, // letter-spacing: 0.0125em ), 'subtitle': ( size: 12px, weight: 400, line-height: 20px, // letter-spacing: 0.00937em ), 'body': ( font-size: 14px, font-weight: 400, line-height: 22px, // letter-spacing: 0.03125em ), 'caption': ( 'size': 12px, 'weight': 400, 'line-height': 20px, // 'letter-spacing': 0.03333em, // 'text-transform': false ) ), $uni-headings ); // 主色 $uni-primary: #2979ff !default; $uni-primary-disable:lighten($uni-primary,20%) !default; $uni-primary-light: lighten($uni-primary,25%) !default; // 辅助色 // 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 $uni-success: #18bc37 !default; $uni-success-disable:lighten($uni-success,20%) !default; $uni-success-light: lighten($uni-success,25%) !default; $uni-warning: #f3a73f !default; $uni-warning-disable:lighten($uni-warning,20%) !default; $uni-warning-light: lighten($uni-warning,25%) !default; $uni-error: #e43d33 !default; $uni-error-disable:lighten($uni-error,20%) !default; $uni-error-light: lighten($uni-error,25%) !default; $uni-info: #8f939c !default; $uni-info-disable:lighten($uni-info,20%) !default; $uni-info-light: lighten($uni-info,25%) !default; // 中性色 // 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 $uni-main-color: #3a3a3a !default; // 主要文字 $uni-base-color: #6a6a6a !default; // 常规文字 $uni-secondary-color: #909399 !default; // 次要文字 $uni-extra-color: #c7c7c7 !default; // 辅助说明 // 边框颜色 $uni-border-1: #F0F0F0 !default; $uni-border-2: #EDEDED !default; $uni-border-3: #DCDCDC !default; $uni-border-4: #B9B9B9 !default; // 常规色 $uni-black: #000000 !default; $uni-white: #ffffff !default; $uni-transparent: rgba($color: #000000, $alpha: 0) !default; // 背景色 $uni-bg-color: #f7f7f7 !default; /* 水平间距 */ $uni-spacing-sm: 8px !default; $uni-spacing-base: 15px !default; $uni-spacing-lg: 30px !default; // 阴影 $uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; $uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; $uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; // 蒙版 $uni-mask: rgba($color: #000000, $alpha: 0.4) !default;
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/setting/_variables.scss
SCSS
unknown
3,753
// 合并 map @function map-deep-merge($parent-map, $child-map){ $result: $parent-map; @each $key, $child in $child-map { $parent-has-key: map-has-key($result, $key); $parent-value: map-get($result, $key); $parent-type: type-of($parent-value); $child-type: type-of($child); $parent-is-map: $parent-type == map; $child-is-map: $child-type == map; @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ $result: map-merge($result, ( $key: $child )); }@else { $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); } } @return $result; };
2301_80339408/uni-shop2
uni_modules/uni-scss/styles/tools/functions.scss
SCSS
unknown
640
// 间距基础倍数 $uni-space-root: 2; // 边框半径默认值 $uni-radius-root:5px; // 主色 $uni-primary: #2979ff; // 辅助色 $uni-success: #4cd964; // 警告色 $uni-warning: #f0ad4e; // 错误色 $uni-error: #dd524d; // 描述色 $uni-info: #909399; // 中性色 $uni-main-color: #303133; $uni-base-color: #606266; $uni-secondary-color: #909399; $uni-extra-color: #C0C4CC; // 背景色 $uni-bg-color: #f5f5f5; // 边框颜色 $uni-border-1: #DCDFE6; $uni-border-2: #E4E7ED; $uni-border-3: #EBEEF5; $uni-border-4: #F2F6FC; // 常规色 $uni-black: #000000; $uni-white: #ffffff; $uni-transparent: rgba($color: #000000, $alpha: 0);
2301_80339408/uni-shop2
uni_modules/uni-scss/theme.scss
SCSS
unknown
641
@import './styles/setting/_variables.scss'; // 间距基础倍数 $uni-space-root: 2; // 边框半径默认值 $uni-radius-root:5px; // 主色 $uni-primary: #2979ff; $uni-primary-disable:mix(#fff,$uni-primary,50%); $uni-primary-light: mix(#fff,$uni-primary,80%); // 辅助色 // 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 $uni-success: #18bc37; $uni-success-disable:mix(#fff,$uni-success,50%); $uni-success-light: mix(#fff,$uni-success,80%); $uni-warning: #f3a73f; $uni-warning-disable:mix(#fff,$uni-warning,50%); $uni-warning-light: mix(#fff,$uni-warning,80%); $uni-error: #e43d33; $uni-error-disable:mix(#fff,$uni-error,50%); $uni-error-light: mix(#fff,$uni-error,80%); $uni-info: #8f939c; $uni-info-disable:mix(#fff,$uni-info,50%); $uni-info-light: mix(#fff,$uni-info,80%); // 中性色 // 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 $uni-main-color: #3a3a3a; // 主要文字 $uni-base-color: #6a6a6a; // 常规文字 $uni-secondary-color: #909399; // 次要文字 $uni-extra-color: #c7c7c7; // 辅助说明 // 边框颜色 $uni-border-1: #F0F0F0; $uni-border-2: #EDEDED; $uni-border-3: #DCDCDC; $uni-border-4: #B9B9B9; // 常规色 $uni-black: #000000; $uni-white: #ffffff; $uni-transparent: rgba($color: #000000, $alpha: 0); // 背景色 $uni-bg-color: #f7f7f7; /* 水平间距 */ $uni-spacing-sm: 8px; $uni-spacing-base: 15px; $uni-spacing-lg: 30px; // 阴影 $uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); $uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); $uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); // 蒙版 $uni-mask: rgba($color: #000000, $alpha: 0.4);
2301_80339408/uni-shop2
uni_modules/uni-scss/variables.scss
SCSS
unknown
1,764
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_80339408/uni-shop2
uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js
JavaScript
unknown
169
<template> <view class="uni-searchbar"> <view :style="{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box" @click="searchClick"> <view class="uni-searchbar__box-icon-search"> <slot name="searchIcon"> <uni-icons color="#c0c4cc" size="18" type="search" /> </slot> </view> <input v-if="show || searchVal" :focus="showSync" :disabled="readonly" :placeholder="placeholderText" :maxlength="maxlength" class="uni-searchbar__box-search-input" confirm-type="search" type="text" v-model="searchVal" :style="{color:textColor}" @confirm="confirm" @blur="blur" @focus="emitFocus"/> <text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text> <view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='') &&!readonly" class="uni-searchbar__box-icon-clear" @click="clear"> <slot name="clearIcon"> <uni-icons color="#c0c4cc" size="20" type="clear" /> </slot> </view> </view> <text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelTextI18n}}</text> </view> </template> <script> import { initVueI18n } from '@dcloudio/uni-i18n' import messages from './i18n/index.js' const { t } = initVueI18n(messages) /** * SearchBar 搜索栏 * @description 搜索栏组件,通常用于搜索商品、文章等 * @tutorial https://ext.dcloud.net.cn/plugin?id=866 * @property {Number} radius 搜索栏圆角 * @property {Number} maxlength 输入最大长度 * @property {String} placeholder 搜索栏Placeholder * @property {String} clearButton = [always|auto|none] 是否显示清除按钮 * @value always 一直显示 * @value auto 输入框不为空时显示 * @value none 一直不显示 * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮 * @value always 一直显示 * @value auto 输入框不为空时显示 * @value none 一直不显示 * @property {String} cancelText 取消按钮的文字 * @property {String} bgColor 输入框背景颜色 * @property {String} textColor 输入文字颜色 * @property {Boolean} focus 是否自动聚焦 * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示 * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number} */ export default { name: "UniSearchBar", emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'], props: { placeholder: { type: String, default: "" }, radius: { type: [Number, String], default: 5 }, clearButton: { type: String, default: "auto" }, cancelButton: { type: String, default: "auto" }, cancelText: { type: String, default: "" }, bgColor: { type: String, default: "#F8F8F8" }, textColor: { type: String, default: "#000000" }, maxlength: { type: [Number, String], default: 100 }, value: { type: [Number, String], default: "" }, modelValue: { type: [Number, String], default: "" }, focus: { type: Boolean, default: false }, readonly: { type: Boolean, default: false } }, data() { return { show: false, showSync: false, searchVal: '' } }, computed: { cancelTextI18n() { return this.cancelText || t("uni-search-bar.cancel") }, placeholderText() { return this.placeholder || t("uni-search-bar.placeholder") } }, watch: { // #ifndef VUE3 value: { immediate: true, handler(newVal) { this.searchVal = newVal if (newVal) { this.show = true } } }, // #endif // #ifdef VUE3 modelValue: { immediate: true, handler(newVal) { this.searchVal = newVal if (newVal) { this.show = true } } }, // #endif focus: { immediate: true, handler(newVal) { if (newVal) { if(this.readonly) return this.show = true; this.$nextTick(() => { this.showSync = true }) } } }, searchVal(newVal, oldVal) { this.$emit("input", newVal) // #ifdef VUE3 this.$emit("update:modelValue", newVal) // #endif } }, methods: { searchClick() { if(this.readonly) return if (this.show) { return } this.show = true; this.$nextTick(() => { this.showSync = true }) }, clear() { this.searchVal = "" this.$nextTick(() => { this.$emit("clear", { value: "" }) }) }, cancel() { if(this.readonly) return this.$emit("cancel", { value: this.searchVal }); this.searchVal = "" this.show = false this.showSync = false // #ifndef APP-PLUS uni.hideKeyboard() // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif }, confirm() { // #ifndef APP-PLUS uni.hideKeyboard(); // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif this.$emit("confirm", { value: this.searchVal }) }, blur() { // #ifndef APP-PLUS uni.hideKeyboard(); // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif this.$emit("blur", { value: this.searchVal }) }, emitFocus(e) { this.$emit("focus", e.detail) } } }; </script> <style lang="scss"> $uni-searchbar-height: 36px; .uni-searchbar { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; position: relative; padding: 10px; background-color: #C00000; } .uni-searchbar__box { /* #ifndef APP-NVUE */ display: flex; box-sizing: border-box; justify-content: left; /* #endif */ overflow: hidden; position: relative; flex: 1; flex-direction: row; align-items: center; height: $uni-searchbar-height; padding: 5px 8px 5px 0px; } .uni-searchbar__box-icon-search { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; // width: 32px; padding: 0 8px; justify-content: center; align-items: center; color: #B3B3B3; } .uni-searchbar__box-search-input { flex: 1; font-size: 14px; color: #333; margin-left: 5px; margin-top: 1px; /* #ifndef APP-NVUE */ background-color: inherit; /* #endif */ } .uni-searchbar__box-icon-clear { align-items: center; line-height: 24px; padding-left: 8px; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-searchbar__text-placeholder { font-size: 14px; color: #B3B3B3; margin-left: 5px; text-align: left; } .uni-searchbar__cancel { padding-left: 10px; line-height: $uni-searchbar-height; font-size: 14px; color: #333333; /* #ifdef H5 */ cursor: pointer; /* #endif */ } </style>
2301_80339408/uni-shop2
uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue
Vue
unknown
7,613
<template> <view> <slot></slot> </view> </template> <script> /** * SwipeAction 滑动操作 * @description 通过滑动触发选项的容器 * @tutorial https://ext.dcloud.net.cn/plugin?id=181 */ export default { name:"uniSwipeAction", data() { return {}; }, created() { this.children = []; }, methods: { // 公开给用户使用,重制组件样式 resize(){ // wxs 会自己计算组件大小,所以无需执行下面代码 // #ifndef APP-VUE || H5 || MP-WEIXIN || MP-HARMONY this.children.forEach(vm=>{ vm.init() }) // #endif }, // 公开给用户使用,关闭全部 已经打开的组件 closeAll(){ this.children.forEach(vm=>{ // #ifdef APP-VUE || H5 || MP-WEIXIN || MP-HARMONY vm.is_show = 'none' // #endif // #ifndef APP-VUE || H5 || MP-WEIXIN || MP-HARMONY vm.close() // #endif }) }, closeOther(vm) { if (this.openItem && this.openItem !== vm) { // #ifdef APP-VUE || H5 || MP-WEIXIN || MP-HARMONY this.openItem.is_show = 'none' // #endif // #ifndef APP-VUE || H5 || MP-WEIXIN || MP-HARMONY this.openItem.close() // #endif } // 记录上一个打开的 swipe-action-item ,用于 auto-close this.openItem = vm } } }; </script> <style></style>
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue
Vue
unknown
1,326
let bindIngXMixins = {} // #ifdef APP-NVUE const BindingX = uni.requireNativePlugin('bindingx'); const dom = uni.requireNativePlugin('dom'); const animation = uni.requireNativePlugin('animation'); bindIngXMixins = { data() { return {} }, watch: { show(newVal) { if (this.autoClose) return if (this.stop) return this.stop = true if (newVal) { this.open(newVal) } else { this.close() } }, leftOptions() { this.getSelectorQuery() this.init() }, rightOptions(newVal) { this.init() } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.box = this.getEl(this.$refs['selector-box--hock']) this.selector = this.getEl(this.$refs['selector-content--hock']); this.leftButton = this.getEl(this.$refs['selector-left-button--hock']); this.rightButton = this.getEl(this.$refs['selector-right-button--hock']); this.init() }, // beforeDestroy() { // this.swipeaction.children.forEach((item, index) => { // if (item === this) { // this.swipeaction.children.splice(index, 1) // } // }) // }, methods: { init() { this.$nextTick(() => { this.x = 0 this.button = { show: false } setTimeout(() => { this.getSelectorQuery() }, 200) }) }, onClick(index, item, position) { this.$emit('click', { content: item, index, position }) }, touchstart(e) { // fix by mehaotian 禁止滑动 if (this.disabled) return // 每次只触发一次,避免多次监听造成闪烁 if (this.stop) return this.stop = true if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } const leftWidth = this.button.left.width const rightWidth = this.button.right.width let expression = this.range(this.x, -rightWidth, leftWidth) let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0) let rightExpression = this.range(this.x + rightWidth, 0, rightWidth) this.eventpan = BindingX.bind({ anchor: this.box, eventType: 'pan', props: [{ element: this.selector, property: 'transform.translateX', expression }, { element: this.leftButton, property: 'transform.translateX', expression: leftExpression }, { element: this.rightButton, property: 'transform.translateX', expression: rightExpression }, ] }, (e) => { // nope if (e.state === 'end') { this.x = e.deltaX + this.x; this.isclick = true this.bindTiming(e.deltaX) } }); }, touchend(e) { if (this.isopen !== 'none' && !this.isclick) { this.open('none') } }, bindTiming(x) { const left = this.x const leftWidth = this.button.left.width const rightWidth = this.button.right.width const threshold = this.threshold if (!this.isopen || this.isopen === 'none') { if (left > threshold) { this.open('left') } else if (left < -threshold) { this.open('right') } else { this.open('none') } } else { if ((x > -leftWidth && x < 0) || x > rightWidth) { if ((x > -threshold && x < 0) || (x - rightWidth > threshold)) { this.open('left') } else { this.open('none') } } else { if ((x < threshold && x > 0) || (x + leftWidth < -threshold)) { this.open('right') } else { this.open('none') } } } }, /** * 移动范围 * @param {Object} num * @param {Object} mix * @param {Object} max */ range(num, mix, max) { return `min(max(x+${num}, ${mix}), ${max})` }, /** * 开启swipe */ open(type) { this.animation(type) }, /** * 关闭swipe */ close() { this.animation('none') }, /** * 开启关闭动画 * @param {Object} type */ animation(type) { const time = 300 const leftWidth = this.button.left.width const rightWidth = this.button.right.width if (this.eventpan && this.eventpan.token) { BindingX.unbind({ token: this.eventpan.token, eventType: 'pan' }) } switch (type) { case 'left': Promise.all([ this.move(this.selector, leftWidth), this.move(this.leftButton, 0), this.move(this.rightButton, rightWidth * 2) ]).then(() => { this.setEmit(leftWidth, type) }) break case 'right': Promise.all([ this.move(this.selector, -rightWidth), this.move(this.leftButton, -leftWidth * 2), this.move(this.rightButton, 0) ]).then(() => { this.setEmit(-rightWidth, type) }) break default: Promise.all([ this.move(this.selector, 0), this.move(this.leftButton, -leftWidth), this.move(this.rightButton, rightWidth) ]).then(() => { this.setEmit(0, type) }) } }, setEmit(x, type) { const leftWidth = this.button.left.width const rightWidth = this.button.right.width this.isopen = this.isopen || 'none' this.stop = false this.isclick = false // 只有状态不一致才会返回结果 if (this.isopen !== type && this.x !== x) { if (type === 'left' && leftWidth > 0) { this.$emit('change', 'left') } if (type === 'right' && rightWidth > 0) { this.$emit('change', 'right') } if (type === 'none') { this.$emit('change', 'none') } } this.x = x this.isopen = type }, move(ref, value) { return new Promise((resolve, reject) => { animation.transition(ref, { styles: { transform: `translateX(${value})`, }, duration: 150, //ms timingFunction: 'linear', needLayout: false, delay: 0 //ms }, function(res) { resolve(res) }) }) }, /** * 获取ref * @param {Object} el */ getEl(el) { return el.ref }, /** * 获取节点信息 */ getSelectorQuery() { Promise.all([ this.getDom('left'), this.getDom('right'), ]).then((data) => { let show = 'none' if (this.autoClose) { show = 'none' } else { show = this.show } if (show === 'none') { // this.close() } else { this.open(show) } }) }, getDom(str) { return new Promise((resolve, reject) => { dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => { if (data) { this.button[str] = data.size resolve(data) } else { reject() } }) }) } } } // #endif export default bindIngXMixins
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js
JavaScript
unknown
6,835
export function isPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (let v = 0; v < Agents.length - 1; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; }
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js
JavaScript
unknown
322
export default { data() { return { x: 0, transition: false, width: 0, viewWidth: 0, swipeShow: 0 } }, watch: { show(newVal) { if (this.autoClose) return if (newVal && newVal !== 'none') { this.transition = true this.open(newVal) } else { this.close() } } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.isopen = false setTimeout(() => { this.getQuerySelect() }, 50) }, methods: { appTouchStart(e) { const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, /** * 移动触发 * @param {Object} e */ onChange(e) { this.moveX = e.detail.x this.isclose = false }, touchstart(e) { this.transition = false this.isclose = true if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, touchmove(e) {}, touchend(e) { // 0的位置什么都不执行 if (this.isclose && this.isopen === 'none') return if (this.isclose && this.isopen !== 'none') { this.transition = true this.close() } else { this.move(this.moveX + this.leftWidth) } }, /** * 移动 * @param {Object} moveX */ move(moveX) { // 打开关闭的处理逻辑不太一样 this.transition = true // 未打开状态 if (!this.isopen || this.isopen === 'none') { if (moveX > this.threshold) { this.open('left') } else if (moveX < -this.threshold) { this.open('right') } else { this.close() } } else { if (moveX < 0 && moveX < this.rightWidth) { const rightX = this.rightWidth + moveX if (rightX < this.threshold) { this.open('right') } else { this.close() } } else if (moveX > 0 && moveX < this.leftWidth) { const leftX = this.leftWidth - moveX if (leftX < this.threshold) { this.open('left') } else { this.close() } } } }, /** * 打开 */ open(type) { this.x = this.moveX this.animation(type) }, /** * 关闭 */ close() { this.x = this.moveX // TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化 this.$nextTick(() => { this.x = -this.leftWidth if (this.isopen !== 'none') { this.$emit('change', 'none') } this.isopen = 'none' }) }, /** * 执行结束动画 * @param {Object} type */ animation(type) { this.$nextTick(() => { if (type === 'left') { this.x = 0 } else { this.x = -this.rightWidth - this.leftWidth } if (this.isopen !== type) { this.$emit('change', type) } this.isopen = type }) }, getSlide(x) {}, getQuerySelect() { const query = uni.createSelectorQuery().in(this); query.selectAll('.movable-view--hock').boundingClientRect(data => { this.leftWidth = data[1].width this.rightWidth = data[2].width this.width = data[0].width this.viewWidth = this.width + this.rightWidth + this.leftWidth if (this.leftWidth === 0) { // TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点 this.x = -0.1 } else { this.x = -this.leftWidth } this.moveX = this.x this.$nextTick(() => { this.swipeShow = 1 }) if (!this.buttonWidth) { this.disabledView = true } if (this.autoClose) return if (this.show !== 'none') { this.transition = true this.open(this.shows) } }).exec(); } } }
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js
JavaScript
unknown
4,256
let otherMixins = {} // #ifndef APP-PLUS|| MP-WEIXIN || H5 const MIN_DISTANCE = 10; otherMixins = { data() { // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` return { uniShow: false, left: 0, buttonShow: 'none', ani: false, moveLeft: '', elClass } }, watch: { show(newVal) { if (this.autoClose) return this.openState(newVal) }, left() { this.moveLeft = `translateX(${this.left}px)` }, buttonShow(newVal) { if (this.autoClose) return this.openState(newVal) }, leftOptions() { this.init() }, rightOptions() { this.init() } }, mounted() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } this.init() }, methods: { init() { clearTimeout(this.timer) this.timer = setTimeout(() => { this.getSelectorQuery() }, 100) // 移动距离 this.left = 0 this.x = 0 }, closeSwipe(e) { if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, appTouchStart(e) { const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, touchstart(e) { if (this.disabled) return this.ani = false this.x = this.left || 0 this.stopTouchStart(e) this.autoClose && this.closeSwipe() }, touchmove(e) { if (this.disabled) return // 是否可以滑动页面 this.stopTouchMove(e); if (this.direction !== 'horizontal') { return; } this.move(this.x + this.deltaX) return false }, touchend() { if (this.disabled) return this.moveDirection(this.left) }, /** * 设置移动距离 * @param {Object} value */ move(value) { value = value || 0 const leftWidth = this.leftWidth const rightWidth = this.rightWidth // 获取可滑动范围 this.left = this.range(value, -rightWidth, leftWidth); }, /** * 获取范围 * @param {Object} num * @param {Object} min * @param {Object} max */ range(num, min, max) { return Math.min(Math.max(num, min), max); }, /** * 移动方向判断 * @param {Object} left * @param {Object} value */ moveDirection(left) { const threshold = this.threshold const isopen = this.isopen || 'none' const leftWidth = this.leftWidth const rightWidth = this.rightWidth if (this.deltaX === 0) { this.openState('none') return } if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) { // right this.openState('right') } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) { // left this.openState('left') } else { // default this.openState('none') } }, /** * 开启状态 * @param {Boolean} type */ openState(type) { const leftWidth = this.leftWidth const rightWidth = this.rightWidth let left = '' this.isopen = this.isopen ? this.isopen : 'none' switch (type) { case "left": left = leftWidth break case "right": left = -rightWidth break default: left = 0 } if (this.isopen !== type) { this.throttle = true this.$emit('change', type) } this.isopen = type // 添加动画类 this.ani = true this.$nextTick(() => { this.move(left) }) // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 }, close() { this.openState('none') }, getDirection(x, y) { if (x > y && x > MIN_DISTANCE) { return 'horizontal'; } if (y > x && y > MIN_DISTANCE) { return 'vertical'; } return ''; }, /** * 重置滑动状态 * @param {Object} event */ resetTouchStatus() { this.direction = ''; this.deltaX = 0; this.deltaY = 0; this.offsetX = 0; this.offsetY = 0; }, /** * 设置滑动开始位置 * @param {Object} event */ stopTouchStart(event) { this.resetTouchStatus(); const touch = event.touches[0]; this.startX = touch.clientX; this.startY = touch.clientY; }, /** * 滑动中,是否禁止打开 * @param {Object} event */ stopTouchMove(event) { const touch = event.touches[0]; this.deltaX = touch.clientX - this.startX; this.deltaY = touch.clientY - this.startY; this.offsetX = Math.abs(this.deltaX); this.offsetY = Math.abs(this.deltaY); this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY); }, getSelectorQuery() { const views = uni.createSelectorQuery().in(this) views .selectAll('.' + this.elClass) .boundingClientRect(data => { if (data.length === 0) return let show = 'none' if (this.autoClose) { show = 'none' } else { show = this.show } this.leftWidth = data[0].width || 0 this.rightWidth = data[1].width || 0 this.buttonShow = show }) .exec() } } } // #endif export default otherMixins
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js
JavaScript
unknown
5,895
let mpMixins = {} let is_pc = null // #ifdef H5 import { isPC } from "./isPC" is_pc = isPC() // #endif // #ifdef APP-VUE || APP-HARMONY || MP-WEIXIN || H5 mpMixins = { data() { return { is_show: 'none' } }, watch: { show(newVal) { this.is_show = this.show } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.is_show = this.show }, methods: { // wxs 中调用 closeSwipe(e) { if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, change(e) { this.$emit('change', e.open) if (this.is_show !== e.open) { this.is_show = e.open } }, appTouchStart(e) { if (is_pc) return const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { if (is_pc) return const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, onClickForPC(index, item, position) { if (!is_pc) return // #ifdef H5 this.$emit('click', { content: item, index, position }) // #endif } } } // #endif export default mpMixins
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js
JavaScript
unknown
1,629
const MIN_DISTANCE = 10; export default { showWatch(newVal, oldVal, ownerInstance, instance, self) { var state = self.state || {} var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el if (!$el) return this.getDom(instance, ownerInstance, self) if (newVal && newVal !== 'none') { this.openState(newVal, instance, ownerInstance, self) return } if (state.left) { this.openState('none', instance, ownerInstance, self) } this.resetTouchStatus(instance, self) }, /** * 开始触摸操作 * @param {Object} e * @param {Object} ins */ touchstart(e, ownerInstance, self) { let instance = e.instance; let disabled = instance.getDataset().disabled let state = self.state || {}; this.getDom(instance, ownerInstance, self) // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 开始触摸时移除动画类 instance.requestAnimationFrame(function() { instance.removeClass('ani'); ownerInstance.callMethod('closeSwipe'); }) // 记录上次的位置 state.x = state.left || 0 // 计算滑动开始位置 this.stopTouchStart(e, ownerInstance, self) }, /** * 开始滑动操作 * @param {Object} e * @param {Object} ownerInstance */ touchmove(e, ownerInstance, self) { let instance = e.instance; // 删除之后已经那不到实例了 if (!instance) return; let disabled = instance.getDataset().disabled let state = self.state || {} // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 是否可以滑动页面 this.stopTouchMove(e, self); if (state.direction !== 'horizontal') { return; } if (e.preventDefault) { // 阻止页面滚动 e.preventDefault() } let x = state.x + state.deltaX this.move(x, instance, ownerInstance, self) }, /** * 结束触摸操作 * @param {Object} e * @param {Object} ownerInstance */ touchend(e, ownerInstance, self) { let instance = e.instance; let disabled = instance.getDataset().disabled let state = self.state || {} // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 this.moveDirection(state.left, instance, ownerInstance, self) }, /** * 设置移动距离 * @param {Object} value * @param {Object} instance * @param {Object} ownerInstance */ move(value, instance, ownerInstance, self) { value = value || 0 let state = self.state || {} let leftWidth = state.leftWidth let rightWidth = state.rightWidth // 获取可滑动范围 state.left = this.range(value, -rightWidth, leftWidth); instance.requestAnimationFrame(function() { instance.setStyle({ transform: 'translateX(' + state.left + 'px)', '-webkit-transform': 'translateX(' + state.left + 'px)' }) }) }, /** * 获取元素信息 * @param {Object} instance * @param {Object} ownerInstance */ getDom(instance, ownerInstance, self) { var state = self.state || {} var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el var leftDom = $el.querySelector('.button-group--left') var rightDom = $el.querySelector('.button-group--right') if (leftDom && leftDom.offsetWidth) { state.leftWidth = leftDom.offsetWidth || 0 } else { state.leftWidth = 0 } if (rightDom && rightDom.offsetWidth) { state.rightWidth = rightDom.offsetWidth || 0 } else { state.rightWidth = 0 } state.threshold = instance.getDataset().threshold }, getDisabledType(value) { return (typeof(value) === 'string' ? JSON.parse(value) : value) || false; }, /** * 获取范围 * @param {Object} num * @param {Object} min * @param {Object} max */ range(num, min, max) { return Math.min(Math.max(num, min), max); }, /** * 移动方向判断 * @param {Object} left * @param {Object} value * @param {Object} ownerInstance * @param {Object} ins */ moveDirection(left, ins, ownerInstance, self) { var state = self.state || {} var threshold = state.threshold var position = state.position var isopen = state.isopen || 'none' var leftWidth = state.leftWidth var rightWidth = state.rightWidth if (state.deltaX === 0) { this.openState('none', ins, ownerInstance, self) return } if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) { // right this.openState('right', ins, ownerInstance, self) } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) { // left this.openState('left', ins, ownerInstance, self) } else { // default this.openState('none', ins, ownerInstance, self) } }, /** * 开启状态 * @param {Boolean} type * @param {Object} ins * @param {Object} ownerInstance */ openState(type, ins, ownerInstance, self) { let state = self.state || {} let leftWidth = state.leftWidth let rightWidth = state.rightWidth let left = '' state.isopen = state.isopen ? state.isopen : 'none' switch (type) { case "left": left = leftWidth break case "right": left = -rightWidth break default: left = 0 } // && !state.throttle if (state.isopen !== type) { state.throttle = true ownerInstance.callMethod('change', { open: type }) } state.isopen = type // 添加动画类 ins.requestAnimationFrame(() => { ins.addClass('ani'); this.move(left, ins, ownerInstance, self) }) }, getDirection(x, y) { if (x > y && x > MIN_DISTANCE) { return 'horizontal'; } if (y > x && y > MIN_DISTANCE) { return 'vertical'; } return ''; }, /** * 重置滑动状态 * @param {Object} event */ resetTouchStatus(instance, self) { let state = self.state || {}; state.direction = ''; state.deltaX = 0; state.deltaY = 0; state.offsetX = 0; state.offsetY = 0; }, /** * 设置滑动开始位置 * @param {Object} event */ stopTouchStart(event, ownerInstance, self) { let instance = event.instance; let state = self.state || {} this.resetTouchStatus(instance, self); var touch = event.touches[0]; state.startX = touch.clientX; state.startY = touch.clientY; }, /** * 滑动中,是否禁止打开 * @param {Object} event */ stopTouchMove(event, self) { let instance = event.instance; let state = self.state || {}; let touch = event.touches[0]; state.deltaX = touch.clientX - state.startX; state.deltaY = touch.clientY - state.startY; state.offsetY = Math.abs(state.deltaY); state.offsetX = Math.abs(state.deltaX); state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY); } }
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
JavaScript
unknown
7,492
<template> <!-- 在微信小程序 app vue端 h5 使用wxs 实现--> <!-- #ifdef APP-VUE || APP-HARMONY || MP-WEIXIN || H5 --> <view class="uni-swipe"> <!-- #ifdef MP-WEIXIN || H5 --> <view class="uni-swipe_box" :change:prop="wxsswipe.showWatch" :prop="is_show" :data-threshold="threshold" :data-disabled="disabled" @touchstart="wxsswipe.touchstart" @touchmove="wxsswipe.touchmove" @touchend="wxsswipe.touchend"> <!-- #endif --> <!-- #ifndef MP-WEIXIN || H5 --> <view class="uni-swipe_box" :change:prop="renderswipe.showWatch" :prop="is_show" :data-threshold="threshold" :data-disabled="disabled+''" @touchstart="renderswipe.touchstart" @touchmove="renderswipe.touchmove" @touchend="renderswipe.touchend"> <!-- #endif --> <!-- 在微信小程序 app vue端 h5 使用wxs 实现--> <view class="uni-swipe_button-group button-group--left"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'left')" @click.stop="onClickForPC(index,item,'left')"> <text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> <view class="uni-swipe_text--center"> <slot></slot> </view> <view class="uni-swipe_button-group button-group--right"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'right')" @click.stop="onClickForPC(index,item,'right')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> </view> </view> <!-- #endif --> <!-- app nvue端 使用 bindingx --> <!-- #ifdef APP-NVUE --> <view ref="selector-box--hock" class="uni-swipe" @horizontalpan="touchstart" @touchend="touchend"> <view ref='selector-left-button--hock' class="uni-swipe_button-group button-group--left"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')"> <text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}"> {{ item.text }} </text> </view> </slot> </view> <view ref='selector-right-button--hock' class="uni-swipe_button-group button-group--right"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> <view ref='selector-content--hock' class="uni-swipe_box"> <slot></slot> </view> </view> <!-- #endif --> <!-- 其他平台使用 js ,长列表性能可能会有影响--> <!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ || MP-HARMONY --> <view class="uni-swipe"> <view class="uni-swipe_box" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend" :style="{transform:moveLeft}" :class="{ani:ani}"> <view class="uni-swipe_button-group button-group--left" :class="[elClass]"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'left')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text> </view> </slot> </view> <slot></slot> <view class="uni-swipe_button-group button-group--right" :class="[elClass]"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px' }" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'right')" class="uni-swipe_button button-hock"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text> </view> </slot> </view> </view> </view> <!-- #endif --> </template> <script src="./wx.wxs" module="wxsswipe" lang="wxs"></script> <script module="renderswipe" lang="renderjs"> import render from './render.js' export default { mounted(e, ins, owner) { this.state = {} }, methods: { showWatch(newVal, oldVal, ownerInstance, instance) { render.showWatch(newVal, oldVal, ownerInstance, instance, this) }, touchstart(e, ownerInstance) { render.touchstart(e, ownerInstance, this) }, touchmove(e, ownerInstance) { render.touchmove(e, ownerInstance, this) }, touchend(e, ownerInstance) { render.touchend(e, ownerInstance, this) } } } </script> <script> import mpwxs from './mpwxs' import bindingx from './bindingx.js' import mpother from './mpother' /** * SwipeActionItem 滑动操作子组件 * @description 通过滑动触发选项的容器 * @tutorial https://ext.dcloud.net.cn/plugin?id=181 * @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效 * @property {Boolean} disabled = [true|false] 是否禁止滑动 * @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件 * @property {Number} threshold 滑动缺省值 * @property {Array} leftOptions 左侧选项内容及样式 * @property {Array} rightOptions 右侧选项内容及样式 * @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标) * @event {Function} change 组件打开或关闭时触发,left\right\none */ export default { mixins: [mpwxs, bindingx, mpother], emits: ['click', 'change'], props: { // 控制开关 show: { type: String, default: 'none' }, // 禁用 disabled: { type: Boolean, default: false }, // 是否自动关闭 autoClose: { type: Boolean, default: true }, // 滑动缺省距离 threshold: { type: Number, default: 20 }, // 左侧按钮内容 leftOptions: { type: Array, default () { return [] } }, // 右侧按钮内容 rightOptions: { type: Array, default () { return [] } } }, // #ifndef VUE3 // TODO vue2 destroyed() { if (this.__isUnmounted) return this.uninstall() }, // #endif // #ifdef VUE3 // TODO vue3 unmounted() { this.__isUnmounted = true this.uninstall() }, // #endif methods: { uninstall() { if (this.swipeaction) { this.swipeaction.children.forEach((item, index) => { if (item === this) { this.swipeaction.children.splice(index, 1) } }) } }, /** * 获取父元素实例 */ getSwipeAction(name = 'uniSwipeAction') { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false; parentName = parent.$options.name; } return parent; } } } </script> <style lang="scss"> .uni-swipe { position: relative; /* #ifndef APP-NVUE */ overflow: hidden; /* #endif */ } .uni-swipe_box { /* #ifndef APP-NVUE */ display: flex; flex-shrink: 0; // touch-action: none; /* #endif */ position: relative; } .uni-swipe_content { // border: 1px red solid; } .uni-swipe_text--center { width: 100%; /* #ifndef APP-NVUE */ cursor: grab; /* #endif */ } .uni-swipe_button-group { /* #ifndef APP-NVUE */ box-sizing: border-box; display: flex; /* #endif */ flex-direction: row; position: absolute; top: 0; bottom: 0; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .button-group--left { left: 0; transform: translateX(-100%) } .button-group--right { right: 0; transform: translateX(100%) } .uni-swipe_button { /* #ifdef APP-NVUE */ flex: 1; /* #endif */ /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; align-items: center; padding: 0 20px; } .uni-swipe_button-text { /* #ifndef APP-NVUE */ flex-shrink: 0; /* #endif */ font-size: 14px; } .ani { transition-property: transform; transition-duration: 0.3s; transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1); } /* #ifdef MP-ALIPAY */ .movable-area { /* width: 100%; */ height: 45px; } .movable-view { display: flex; /* justify-content: center; */ position: relative; flex: 1; height: 45px; z-index: 2; } .movable-view-button { display: flex; flex-shrink: 0; flex-direction: row; height: 100%; background: #C0C0C0; } /* .transition { transition: all 0.3s; } */ .movable-view-box { flex-shrink: 0; height: 100%; background-color: #fff; } /* #endif */ </style>
2301_80339408/uni-shop2
uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue
Vue
unknown
10,505
<template> <text class="uni-tag" v-if="text" :class="classes" :style="customStyle" @click="onClick">{{text}}</text> </template> <script> /** * Tag 标签 * @description 用于展示1个或多个文字标签,可点击切换选中、不选中的状态 * @tutorial https://ext.dcloud.net.cn/plugin?id=35 * @property {String} text 标签内容 * @property {String} size = [default|small|mini] 大小尺寸 * @value default 正常 * @value small 小尺寸 * @value mini 迷你尺寸 * @property {String} type = [default|primary|success|warning|error] 颜色类型 * @value default 灰色 * @value primary 蓝色 * @value success 绿色 * @value warning 黄色 * @value error 红色 * @property {Boolean} disabled = [true|false] 是否为禁用状态 * @property {Boolean} inverted = [true|false] 是否无需背景颜色(空心标签) * @property {Boolean} circle = [true|false] 是否为圆角 * @event {Function} click 点击 Tag 触发事件 */ export default { name: "UniTag", emits: ['click'], props: { type: { // 标签类型default、primary、success、warning、error、royal type: String, default: "default" }, size: { // 标签大小 normal, small type: String, default: "normal" }, // 标签内容 text: { type: String, default: "" }, disabled: { // 是否为禁用状态 type: [Boolean, String], default: false }, inverted: { // 是否为空心 type: [Boolean, String], default: false }, circle: { // 是否为圆角样式 type: [Boolean, String], default: false }, mark: { // 是否为标记样式 type: [Boolean, String], default: false }, customStyle: { type: String, default: '' } }, computed: { classes() { const { type, disabled, inverted, circle, mark, size, isTrue } = this const classArr = [ 'uni-tag--' + type, 'uni-tag--' + size, isTrue(disabled) ? 'uni-tag--disabled' : '', isTrue(inverted) ? 'uni-tag--' + type + '--inverted' : '', isTrue(circle) ? 'uni-tag--circle' : '', isTrue(mark) ? 'uni-tag--mark' : '', // type === 'default' ? 'uni-tag--default' : 'uni-tag-text', isTrue(inverted) ? 'uni-tag--inverted uni-tag-text--' + type : '', size === 'small' ? 'uni-tag-text--small' : '' ] // 返回类的字符串,兼容字节小程序 return classArr.join(' ') } }, methods: { isTrue(value) { return value === true || value === 'true' }, onClick() { if (this.isTrue(this.disabled)) return this.$emit("click"); } } }; </script> <style lang="scss" scoped> $uni-primary: #2979ff !default; $uni-success: #18bc37 !default; $uni-warning: #f3a73f !default; $uni-error: #e43d33 !default; $uni-info: #8f939c !default; $tag-default-pd: 4px 7px; $tag-small-pd: 2px 5px; $tag-mini-pd: 1px 3px; .uni-tag { line-height: 14px; font-size: 12px; font-weight: 200; padding: $tag-default-pd; color: #fff; border-radius: 3px; background-color: $uni-info; border-width: 1px; border-style: solid; border-color: $uni-info; /* #ifdef H5 */ cursor: pointer; /* #endif */ // size attr &--default { font-size: 12px; } &--default--inverted { color: $uni-info; border-color: $uni-info; } &--small { padding: $tag-small-pd; font-size: 12px; border-radius: 2px; } &--mini { padding: $tag-mini-pd; font-size: 12px; border-radius: 2px; } // type attr &--primary { background-color: $uni-primary; border-color: $uni-primary; color: #fff; } &--success { color: #fff; background-color: $uni-success; border-color: $uni-success; } &--warning { color: #fff; background-color: $uni-warning; border-color: $uni-warning; } &--error { color: #fff; background-color: $uni-error; border-color: $uni-error; } &--primary--inverted { color: $uni-primary; border-color: $uni-primary; } &--success--inverted { color: $uni-success; border-color: $uni-success; } &--warning--inverted { color: $uni-warning; border-color: $uni-warning; } &--error--inverted { color: $uni-error; border-color: $uni-error; } &--inverted { background-color: #fff; } // other attr &--circle { border-radius: 15px; } &--mark { border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: 15px; border-bottom-right-radius: 15px; } &--disabled { opacity: 0.5; /* #ifdef H5 */ cursor: not-allowed; /* #endif */ } } .uni-tag-text { color: #fff; font-size: 14px; &--primary { color: $uni-primary; } &--success { color: $uni-success; } &--warning { color: $uni-warning; } &--error { color: $uni-error; } &--small { font-size: 12px; } } </style>
2301_80339408/uni-shop2
uni_modules/uni-tag/components/uni-tag/uni-tag.vue
Vue
unknown
5,202
<script> export default { onLaunch: function() { console.log('App Launch') }, onShow: function() { console.log('App Show') }, onHide: function() { console.log('App Hide') } } </script> <style> /*每个页面公共css */ </style>
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
App.vue
Vue
unknown
254
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <script> var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) document.write( '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />') </script> <title></title> <!--preload-links--> <!--app-context--> </head> <body> <div id="app"><!--app-html--></div> <script type="module" src="/main.js"></script> </body> </html>
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
index.html
HTML
unknown
672
import App from './App' // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) return { app } } // #endif
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
main.js
JavaScript
unknown
352
<template> <view class="content"> <image class="logo" src="/static/logo.png"></image> <view class="text-area"> <text class="title">{{title}}</text> </view> </view> </template> <script> export default { data() { return { title: 'Hello' } }, onLoad() { }, methods: { } } </script> <style> .content { display: flex; flex-direction: column; align-items: center; justify-content: center; } .logo { height: 200rpx; width: 200rpx; margin-top: 200rpx; margin-left: auto; margin-right: auto; margin-bottom: 50rpx; } .text-area { display: flex; justify-content: center; } .title { font-size: 36rpx; color: #8f8f94; } </style>
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
pages/index/index.vue
Vue
unknown
694
uni.addInterceptor({ returnValue (res) { if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { return res; } return new Promise((resolve, reject) => { res.then((res) => { if (!res) return resolve(res) return res[0] ? reject(res[0]) : resolve(res[1]) }); }); }, });
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
uni.promisify.adaptor.js
JavaScript
unknown
373
/** * 这里是uni-app内置的常用样式变量 * * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App * */ /** * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 * * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 */ /* 颜色变量 */ /* 行为相关颜色 */ $uni-color-primary: #007aff; $uni-color-success: #4cd964; $uni-color-warning: #f0ad4e; $uni-color-error: #dd524d; /* 文字基本颜色 */ $uni-text-color:#333;//基本色 $uni-text-color-inverse:#fff;//反色 $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 $uni-text-color-placeholder: #808080; $uni-text-color-disable:#c0c0c0; /* 背景颜色 */ $uni-bg-color:#ffffff; $uni-bg-color-grey:#f8f8f8; $uni-bg-color-hover:#f1f1f1;//点击状态颜色 $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 /* 边框颜色 */ $uni-border-color:#c8c7cc; /* 尺寸变量 */ /* 文字尺寸 */ $uni-font-size-sm:12px; $uni-font-size-base:14px; $uni-font-size-lg:16px; /* 图片尺寸 */ $uni-img-size-sm:20px; $uni-img-size-base:26px; $uni-img-size-lg:40px; /* Border Radius */ $uni-border-radius-sm: 2px; $uni-border-radius-base: 3px; $uni-border-radius-lg: 6px; $uni-border-radius-circle: 50%; /* 水平间距 */ $uni-spacing-row-sm: 5px; $uni-spacing-row-base: 10px; $uni-spacing-row-lg: 15px; /* 垂直间距 */ $uni-spacing-col-sm: 4px; $uni-spacing-col-base: 8px; $uni-spacing-col-lg: 12px; /* 透明度 */ $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 /* 文章场景相关 */ $uni-color-title: #2C405A; // 文章标题颜色 $uni-font-size-title:20px; $uni-color-subtitle: #555555; // 二级标题颜色 $uni-font-size-subtitle:26px; $uni-color-paragraph: #3F536E; // 文章段落颜色 $uni-font-size-paragraph:15px;
2301_80494651/u_n_i_a_p_p_s_r_p_xiao_cheng_xu
uni.scss
SCSS
unknown
2,217
import math import random def assign_cluster(x, centroids): min_distance = float('inf') closest_centroid = 0 for i, centroid in enumerate(centroids): # 计算欧几里得距离 distance = math.sqrt(sum((a - b) ** 2 for a, b in zip(x, centroid))) if distance < min_distance: min_distance = distance closest_centroid = i return closest_centroid def Kmeans(data, k, epsilon=1e-4, max_iterations=100): """ K均值聚类算法 """ centroids = random.sample(data, k) for _ in range(max_iterations): clusters = [[] for _ in range(k)] for point in data: cluster_idx = assign_cluster(point, centroids) clusters[cluster_idx].append(point) new_centroids = [] for cluster_points in clusters: if cluster_points: new_center = [sum(dim) / len(cluster_points) for dim in zip(*cluster_points)] new_centroids.append(new_center) else: new_centroids.append(centroids[len(new_centroids)]) movement = sum(math.sqrt(sum((a - b) ** 2 for a, b in zip(old, new))) for old, new in zip(centroids, new_centroids)) if movement < epsilon: break centroids = new_centroids return centroids, clusters def main(): data = [ [1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0], [8, 2], [8, 4], [8, 0] ] k = 3 centroids, clusters = Kmeans(data, k) print("聚类中心:") for i, centroid in enumerate(centroids): print(f"中心 {i}: {centroid}") print("\n聚类结果:") for i, cluster in enumerate(clusters): print(f"聚类 {i} 有 {len(cluster)} 个点: {cluster}") if __name__ == "__main__": main()
2301_80556923/machine-learning-course
1班10.py
Python
mit
1,887
import math import random def assign_cluster(x, centroids): min_distance = float('inf') closest_centroid = 0 for i, centroid in enumerate(centroids): # 计算欧几里得距离 distance = math.sqrt(sum((a - b) ** 2 for a, b in zip(x, centroid))) if distance < min_distance: min_distance = distance closest_centroid = i return closest_centroid def Kmeans(data, k, epsilon=1e-4, max_iterations=100): """ K均值聚类算法 """ centroids = random.sample(data, k) for _ in range(max_iterations): clusters = [[] for _ in range(k)] for point in data: cluster_idx = assign_cluster(point, centroids) clusters[cluster_idx].append(point) new_centroids = [] for cluster_points in clusters: if cluster_points: new_center = [sum(dim) / len(cluster_points) for dim in zip(*cluster_points)] new_centroids.append(new_center) else: new_centroids.append(centroids[len(new_centroids)]) movement = sum(math.sqrt(sum((a - b) ** 2 for a, b in zip(old, new))) for old, new in zip(centroids, new_centroids)) if movement < epsilon: break centroids = new_centroids return centroids, clusters def main(): data = [ [1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0], [8, 2], [8, 4], [8, 0] ] k = 3 centroids, clusters = Kmeans(data, k) print("聚类中心:") for i, centroid in enumerate(centroids): print(f"中心 {i}: {centroid}") print("\n聚类结果:") for i, cluster in enumerate(clusters): print(f"聚类 {i} 有 {len(cluster)} 个点: {cluster}") if __name__ == "__main__": main()
2301_80556923/machine-learning-course
assignment3/1班10.py
Python
mit
1,887
import math def euclidean_distance(point1, point2): return math.sqrt(sum((a - b) ** 2 for a, b in zip(point1, point2))) def knn_predict(training_data, training_labels, test_point, k=3): if len(training_data) != len(training_labels): raise ValueError("训练数据和标签长度不一致") if k > len(training_data): raise ValueError("k值不能大于训练数据数量") distances = [] for i, train_point in enumerate(training_data): dist = euclidean_distance(train_point, test_point) distances.append((training_labels[i], dist)) distances.sort(key=lambda x: x[1]) k_nearest = distances[:k] label_counts = {} for label, _ in k_nearest: if label in label_counts: label_counts[label] += 1 else: label_counts[label] = 1 max_count = 0 predicted_label = None for label, count in label_counts.items(): if count > max_count: max_count = count predicted_label = label return predicted_label def knn_predict_all(training_data, training_labels, test_data, k=3): predictions = [] for test_point in test_data: prediction = knn_predict(training_data, training_labels, test_point, k) predictions.append(prediction) return predictions def main(): training_data = [ [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [6, 5], [7, 6], [8, 5], [8, 7], [7, 8] ] training_labels = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B'] test_points = [ [1.5, 2.5], [7.5, 6.5], [4, 4] ] k = 3 predictions = knn_predict_all(training_data, training_labels, test_points, k) print("K近邻算法预测结果 (k={}):".format(k)) for i, (point, prediction) in enumerate(zip(test_points, predictions)): print(f"测试点 {point} -> 预测类别: {prediction}") if __name__ == "__main__": main()
2301_80556923/machine-learning-course
assignment4/1班10.py
Python
mit
2,008
import os import random from PIL import Image from torch.utils.data import DataLoader,Dataset from torchvision import transforms #把训练集和测试集分为8:2 train_ratio = 0.8 test_ratio = 1 - train_ratio rootdata = r'D:\niggger\niigger\pythonProject\dataset\train' train_list, test_list = [], [] data_list = [] #图片的标签 class_flag = -1 ''' 要取得该文件夹下的所有文件,可以使用 for(root,dirs,files) in walk(roots)函数 roots:代表需要便利的根文件夹 root: 表示正在遍历的文件夹的名字 dirs:记录正在遍历的文件夹中的文件 ''' for root, dirs, files in os.walk(rootdata): for i in range(len(files)): ''' os.path.join()函数:连接两个或者更多的路径名组价你 1.如果各组件首字母不包含'/',则函数会自动加上 2.如果一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃 3.如果最后一个组件为空,则成一个路径以一个'/'分隔符结尾 root='/home/hsy/PycharmProjects/数据集/5月下旬/train/鱼腥草' files[i]='yuxingcao_1.jpg' os.path.join(root,files[i])='/home/hsy/PycharmProjects/数据集/5月下旬/train/鱼腥草/yuxingcao_1.jpg' ''' data_list.append(os.path.join(root, files[i])) for i in range(0, int(len(files) * train_ratio)): train_data = os.path.join(root, files[i]) + '\t' + str(class_flag) + '\n' train_list.append(train_data) for i in range(int(len(files) * train_ratio), len(files)): test_data = os.path.join(root, files[i]) + '\t' + str(class_flag) + '\n' test_list.append(test_data) class_flag += 1 # print(train_list) # 将数据打乱 random.shuffle(train_list) random.shuffle(test_list) # 保存到txt with open('../dataset/train.txt', 'w', encoding='UTF-8') as f: for train in train_list: f.write(train) with open('../dataset/test.txt', 'w', encoding='UTF-8') as f: for test in test_list: f.write(test) print(test_list) # 图像标准化 # transform_BN=transforms.Normalize((0.485,0.456,0.406),(0.226,0.224,0.225)) class LoadData(Dataset): def __init__(self, txt_path, train_flag=True): self.imgs_info = self.get_imags(txt_path) self.train_flag = train_flag self.transform_train = transforms.Compose([ transforms.Resize((256, 256)), # 先将图像调整到较大尺寸,以便后续裁剪 transforms.CenterCrop(224), # 从中心裁剪到224x224 transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ]) self.transform_test = transforms.Compose([ transforms.Resize((256, 256)), # 测试集也做相同的处理 transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ]) def get_imags(self, txt_path): with open(txt_path, 'r', encoding='UTF-8') as f: imgs_info = f.readlines() imgs_info = list(map(lambda x: x.strip().split('\t'), imgs_info)) return imgs_info def __getitem__(self, index): img_path, label = self.imgs_info[index] img = Image.open(img_path) img = img.convert("RGB") if self.train_flag: img = self.transform_train(img) else: img = self.transform_test(img) label = int(label) # 返回打开的图片和它的标签 return img, label def __len__(self): return len(self.imgs_info) train_txt_path = '../dataset/train.txt' test_txt_path = '../dataset/test.txt' train_dataset = LoadData(txt_path=train_txt_path, train_flag=True) test_dataset = LoadData(txt_path=test_txt_path, train_flag=False) # 创建DataLoader实例 batch_size = 64 # 你可以根据需要调整批大小 train_loader = DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True) test_loader = DataLoader(dataset=test_dataset, batch_size=batch_size, shuffle=False) # 创建网络模型 # model.py from torch import nn import torch # 搭建神经网络 class Tudui(nn.Module): def __init__(self): super(Tudui, self).__init__() self.model = nn.Sequential( nn.Conv2d(3, 32, 3, 1, padding=1), # 使用3x3卷积核 nn.BatchNorm2d(32), # 添加批量归一化 nn.ReLU(), # 添加ReLU激活函数 nn.MaxPool2d(2), nn.Conv2d(32, 64, 3, 1, padding=1), # 增加通道数以提取更多特征 nn.BatchNorm2d(64), nn.ReLU(), nn.MaxPool2d(2), nn.Conv2d(64, 128, 3, 1, padding=1), # 再次增加通道数 nn.BatchNorm2d(128), nn.ReLU(), nn.MaxPool2d(2), nn.AdaptiveAvgPool2d(1), # 使用全局平均池化代替Flatten nn.Flatten(), # 展平 nn.Dropout(0.5), # 添加Dropout层 nn.Linear(128, 64), # 根据全局平均池化后的特征数调整输入维度 nn.ReLU(), nn.Linear(64, 2), ) def forward(self, x): x = self.model(x) return x tudui = Tudui() if __name__ == '__main__': tudui = Tudui() input = torch.ones((64, 3, 32, 32)) output = tudui(input) print(output.shape) # 损失函数 loss_fn = nn.CrossEntropyLoss() # 优化器 learning_rate = 1e-2 optimizer = torch.optim.SGD(tudui.parameters(), lr=learning_rate) # 设置训练网络的一些参数 # 记录训练的次数 total_train_step = 0 # 记录测试的次数 total_test_step = 0 # 训练的轮数 epoch = 30 for i in range(epoch): print("-------------第 {} 轮训练开始------------".format(i + 1)) # 训练步骤开始 for data in train_loader: imgs, targets = data output = tudui(imgs) loss = loss_fn(output, targets) # 优化器优化模型 optimizer.zero_grad() loss.backward() optimizer.step() total_train_step = total_train_step + 1 if total_train_step % 100 == 0: print("训练次数:{}, Loss:{}".format(total_train_step, loss.item())) # 测试步骤开始 total_test_loss = 0 with torch.no_grad(): for data in test_loader: imgs, targets = data outputs = tudui(imgs) loss = loss_fn(outputs, targets) total_test_loss = total_test_loss + loss.item() print("整体测试集上的Loss:{}".format(total_test_loss)) total_test_step = total_test_step + 1 torch.save(tudui, "tudui_{}.pth".format(i)) print("模型已保存") # 保存模型 # 注意:应该保存模型的state_dict torch.save(tudui.state_dict(), "tudui_final.pth")
2301_80685755/learn
exam.py
Python
unknown
7,076
import os import random from PIL import Image from torch.utils.data import DataLoader,Dataset from torchvision import transforms #把训练集和测试集分为8:2 train_ratio = 0.8 test_ratio = 1 - train_ratio rootdata = r'D:\niggger\niigger\pythonProject\dataset\train' train_list, test_list = [], [] data_list = [] #图片的标签 class_flag = -1 ''' 要取得该文件夹下的所有文件,可以使用 for(root,dirs,files) in walk(roots)函数 roots:代表需要便利的根文件夹 root: 表示正在遍历的文件夹的名字 dirs:记录正在遍历的文件夹中的文件 ''' for root, dirs, files in os.walk(rootdata): for i in range(len(files)): ''' os.path.join()函数:连接两个或者更多的路径名组价你 1.如果各组件首字母不包含'/',则函数会自动加上 2.如果一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃 3.如果最后一个组件为空,则成一个路径以一个'/'分隔符结尾 root='/home/hsy/PycharmProjects/数据集/5月下旬/train/鱼腥草' files[i]='yuxingcao_1.jpg' os.path.join(root,files[i])='/home/hsy/PycharmProjects/数据集/5月下旬/train/鱼腥草/yuxingcao_1.jpg' ''' data_list.append(os.path.join(root, files[i])) for i in range(0, int(len(files) * train_ratio)): train_data = os.path.join(root, files[i]) + '\t' + str(class_flag) + '\n' train_list.append(train_data) for i in range(int(len(files) * train_ratio), len(files)): test_data = os.path.join(root, files[i]) + '\t' + str(class_flag) + '\n' test_list.append(test_data) class_flag += 1 # print(train_list) # 将数据打乱 random.shuffle(train_list) random.shuffle(test_list) # 保存到txt with open('../dataset/train.txt', 'w', encoding='UTF-8') as f: for train in train_list: f.write(train) with open('../dataset/test.txt', 'w', encoding='UTF-8') as f: for test in test_list: f.write(test) print(test_list) # 图像标准化 # transform_BN=transforms.Normalize((0.485,0.456,0.406),(0.226,0.224,0.225)) class LoadData(Dataset): def __init__(self, txt_path, train_flag=True): self.imgs_info = self.get_imags(txt_path) self.train_flag = train_flag self.transform_train = transforms.Compose([ transforms.Resize((32, 32)), # 先将图像调整到较大尺寸,以便后续裁剪 transforms.CenterCrop(32), # 从中心裁剪到224x224 transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ]) self.transform_test = transforms.Compose([ transforms.Resize((32, 32)), # 测试集也做相同的处理 transforms.CenterCrop(32), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ]) def get_imags(self, txt_path): with open(txt_path, 'r', encoding='UTF-8') as f: imgs_info = f.readlines() imgs_info = list(map(lambda x: x.strip().split('\t'), imgs_info)) return imgs_info def __getitem__(self, index): img_path, label = self.imgs_info[index] img = Image.open(img_path) img = img.convert("RGB") if self.train_flag: img = self.transform_train(img) else: img = self.transform_test(img) label = int(label) # 返回打开的图片和它的标签 return img, label def __len__(self): return len(self.imgs_info) train_txt_path = '../dataset/train.txt' test_txt_path = '../dataset/test.txt' train_dataset = LoadData(txt_path=train_txt_path, train_flag=True) test_dataset = LoadData(txt_path=test_txt_path, train_flag=False) # 创建DataLoader实例 batch_size = 64 # 你可以根据需要调整批大小 train_loader = DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True) test_loader = DataLoader(dataset=test_dataset, batch_size=batch_size, shuffle=False) # 创建网络模型 # model.py from torch import nn import torch # 搭建神经网络 class Tudui(nn.Module): def __init__(self): super(Tudui, self).__init__() self.model = nn.Sequential( nn.Conv2d(3, 32, 5, 1, padding=2), nn.MaxPool2d(2), nn.Conv2d(32, 32, 5, 1, padding=2), nn.MaxPool2d(2), nn.Conv2d(32, 64, 5, 1, padding=2), nn.MaxPool2d(2), nn.Flatten(), # 展平后的序列长度为 64*4*4=1024 nn.Linear(1024, 64), nn.Linear(64, 10) ) def forward(self, x): x = self.model(x) return x tudui = Tudui() if __name__ == '__main__': tudui = Tudui() input = torch.ones((64, 3, 32, 32)) output = tudui(input) print(output.shape) # 损失函数 loss_fn = nn.CrossEntropyLoss() # 优化器 learning_rate = 1e-2 optimizer = torch.optim.SGD(tudui.parameters(), lr=learning_rate) # 设置训练网络的一些参数 # 记录训练的次数 total_train_step = 0 # 记录测试的次数 total_test_step = 0 # 训练的轮数 epoch = 10 for i in range(epoch): print("-------------第 {} 轮训练开始------------".format(i + 1)) # 训练步骤开始 for data in train_loader: imgs, targets = data output = tudui(imgs) loss = loss_fn(output, targets) # 优化器优化模型 optimizer.zero_grad() loss.backward() optimizer.step() total_train_step = total_train_step + 1 if total_train_step % 100 == 0: print("训练次数:{}, Loss:{}".format(total_train_step, loss.item())) # 测试步骤开始 total_test_loss = 0 with torch.no_grad(): for data in test_loader: imgs, targets = data outputs = tudui(imgs) loss = loss_fn(outputs, targets) total_test_loss = total_test_loss + loss.item() print("整体测试集上的Loss:{}".format(total_test_loss)) total_test_step = total_test_step + 1 torch.save(tudui, "tudui_{}.pth".format(i)) print("模型已保存") # 保存模型 # 注意:应该保存模型的state_dict torch.save(tudui.state_dict(), "tudui_final.pth")
2301_80685755/learn
study.py
Python
unknown
6,579
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Vite + Vue + TS</title> </head> <body> <div id="app"></div> <script type="module" src="/src/main.ts"></script> </body> </html>
2301_80690806/Binary_Tree
index.html
HTML
unknown
362
<script setup lang="ts"> </script> <template> <div id="app"> <router-view /> </div> </template> <style lang="scss"> :root { // 全局css初始化 font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; line-height: 1.5em; color: #303133; box-sizing: border-box; } button { border-radius: 8px; border: 1px solid transparent; padding: 0.6em 1.2em; font-size: 1em; font-weight: 500; font-family: inherit; background-color: #ecf5ff; cursor: pointer; transition: border-color 0.25s; } button:hover { border-color: #646cff; } button:focus, button:focus-visible { outline: 4px auto -webkit-focus-ring-color; } </style>
2301_80690806/Binary_Tree
src/App.vue
Vue
unknown
858
<script setup lang="ts"> import { ref } from 'vue' defineProps<{ msg: string }>() const count = ref(0) </script> <template> <h1>{{ msg }}</h1> <div class="card"> <button type="button" @click="count++">count is {{ count }}</button> <p> Edit <code>components/HelloWorld.vue</code> to test HMR </p> </div> <p> Check out <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank" >create-vue</a >, the official Vue + Vite starter </p> <p> Learn more about IDE Support for Vue in the <a href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support" target="_blank" >Vue Docs Scaling up Guide</a >. </p> <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p> </template> <style scoped> .read-the-docs { color: #888; } </style>
2301_80690806/Binary_Tree
src/components/HelloWorld.vue
Vue
unknown
856
<template> <div class="left-list"> <el-scrollbar class="left-form"> <div v-for="([key, item], index) in [...fatherMap]" :key="index" class="scrollbar-demo-item" @click="setOrderData(key,item)"> <div class="left-item" >{{ index+1 }}</div> <div class="traversal"> <div class="traversal-item">前序遍历:{{ key }}</div> <div class="traversal-item">中序遍历:{{ item }}</div> </div> </div> </el-scrollbar> <div class="choose-input"> <div class="input-group pre-order"> <label for="preOrder">前序遍历</label> <el-input id="preOrder" v-model="orderData.preOrder" placeholder="请输入前序遍历" /> </div> <div class="input-group in-order"> <label for="inOrder">中序遍历</label> <el-input id="inOrder" v-model="orderData.inOrder" placeholder="请输入中序遍历" /> </div> <el-button class="btn btn-primary" @click="$emit('submit', orderData)">确定</el-button> </div> </div> </template> <style> .left-list { width: 400px; height: 100%; background-color: #fff; float: left; border-right: 1px solid #ccc; display: flex; flex-direction: column; margin-left: 5px; } .left-form { flex: 1; height: 10%; /* calc(100% - 50px) */ } .scrollbar-demo-item { display: flex; align-items: center; justify-content: left; padding-left: 10px; height: 80px; margin: 10px; text-align: center; border-radius: 4px; background: var(--el-color-primary-light-9); color: var(--el-color-primary); } .left-item { width: 20px; } .traversal { margin-left: 10px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; } .traversal-item { margin-bottom: 5px; /* 调整间距 */ } .input-group { display: flex; align-items: center; margin-bottom: 10px; height: 40px; } .input-group label { margin-right: 10px; } .input-group .el-input { width: 240px; height: 100%; } .choose-input { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 20%; } </style> <script setup> import { ref, reactive, watch } from 'vue' import { defineProps } from 'vue'; const props = defineProps({ // 接收父组件传值,传入前序遍历和中序遍历 fatherMap: Map }) const preOrder = ref('') const inOrder = ref('') const orderData = reactive({ preOrder: '', inOrder: '' }) const setOrderData = function(key,item){ this.orderData.preOrder = key; this.orderData.inOrder = item; } import { Check, Delete, Edit, Message, Search, Star, } from '@element-plus/icons-vue' </script>
2301_80690806/Binary_Tree
src/components/LeftForm.vue
Vue
unknown
2,900
<template> <div> <span>{{ props.orderData }}</span> <button @click="handleClick">click</button> </div> <div style="padding-left: 200px;"> <div class="tree"> <div v-for="(level, index) in treeLevels" :key="index" class="level" style="display: flex; justify-content: space-around; width: 50%;"> <div v-for="(node, nodeIndex) in Math.pow(2, index)" :key="nodeIndex" :class="['tree-node', { 'highlight': isHighlighted((Math.pow(2, index) - 1) + nodeIndex + 1) }]" :id="(Math.pow(2, index) - 1) + nodeIndex + 1" style="background-color: #ecf5ff;"> <div>{{ setNodeValueById((Math.pow(2, index) - 1) + nodeIndex + 1) }}</div> <!-- ID 计算 --> </div> </div> </div> <div style="display: flex; justify-content: center; gap: 20px;"> <button @click="highlightTraversal('preorder')">前序遍历</button> <button @click="highlightTraversal('inorder')">中序遍历</button> <button @click="highlightTraversal('postorder')">后序遍历</button> <button @click="highlightTraversal('levelorder')">层序遍历</button> <button @click="highlightTraversal('OrderThreading')">中序线索</button> </div> </div> </template> <script setup> import { watch, ref, toRefs } from 'vue'; import BinaryTreeClass from '../utils/BuildTree'; import { TreeNode } from '../model/TreeNode'; import inThreading from '../utils/inThreading'; import _ from 'lodash'; const props = defineProps({ orderData: Object }); const nodeID = ref(0); // 使用 toRefs 将 orderData 变为响应式引用 const { orderData } = toRefs(props); const treeLevels = ref([]); const treeData = ref(null); const highlightedNodes = ref([]); const levelOrderMap = ref(new Map()); const ThreadingTree = ref([]); // 监视 orderData 的变化,深度监听 watch(orderData, (newValue) => { console.log('orderData 变化:', newValue); if (newValue.preOrder && newValue.inOrder) { nodeID.value = 1; // 重置节点id // 直接将 preOrder 和 inOrder 按空格分割,不再只处理数字 const preorderArray = newValue.preOrder.split(' ') .filter(item => item.trim() !== ''); // 清除空格并过滤空项 const inorderArray = newValue.inOrder.split(' ') .filter(item => item.trim() !== ''); // 同上 // 构建二叉树 treeData.value = BinaryTreeClass.buildTree(preorderArray, inorderArray); levelOrderMap.value = BinaryTreeClass.levelOrderBuildMap(treeData.value); // 根据先序和中序遍历结果生成层序遍历结果的id与值映射表 // 深度复制 treeData const copiedTreeData = _.cloneDeep(treeData.value); ThreadingTree.value = inThreading.inOrderThreading(copiedTreeData);// 对复制的数据进行线索化 // 返回层序遍历结果 const levelOrderResult = () => { const result = []; levelOrderMap.value.forEach((value, key) => { result.push(value); }); return result; }; treeLevels.value = buildLevels(levelOrderResult()); console.log('树结构已更新:', treeData.value); // 调试打印 const allNodes = document.querySelectorAll('.tree-node'); allNodes.forEach(node => { node.style.backgroundColor = '#ecf5ff'; }); } }, { immediate: true, deep: true }); const setNodeValueById = (id) => { const node = levelOrderMap.value.get(id); // 获取 map 中的值 if (node) { return node; // 返回值而非 node.value,假设这里 `node` 本身就是你想要的值 } return null; }; // 点击事件,输出树结构和层序遍历结果 const handleClick = () => { if (treeData.value) { console.log('树结构:', treeData.value); console.log("线索化树结构:", ThreadingTree.value) // 输出层序遍历结果 console.log('层序遍历结果:'); levelOrderMap.value.forEach((value, key) => { console.log(key + ': ' + value); }); const preOrderTraversalResult = BinaryTreeClass.preOrderTraversal(treeData.value); console.log('前序遍历结果:'); preOrderTraversalResult.forEach(node => { console.log(node.id + ': ' + node.value); }); console.log('Map:', levelOrderMap.value); } else { console.log('树结构尚未构建,无法进行层序遍历。'); } }; // 通过层序遍历生成树的层次 function buildLevels(nodes) { const levels = []; let level = 0; let levelNodes = []; let currentLevelSize = 1; nodes.forEach((node, index) => { if (index === currentLevelSize) { levels.push(levelNodes); levelNodes = []; currentLevelSize = Math.pow(2, level++) + index; } levelNodes.push(node); }); levels.push(levelNodes); // 最后一层 return levels; } // 高亮显示指定遍历结果 const highlightTraversal = (type) => { let traversalNodes = []; switch (type) { case 'preorder': traversalNodes = BinaryTreeClass.preOrderTraversal(treeData.value); break; case 'inorder': traversalNodes = BinaryTreeClass.inOrderTraversal(treeData.value); break; case 'postorder': traversalNodes = BinaryTreeClass.postOrderTraversal(treeData.value); break; case 'levelorder': traversalNodes = BinaryTreeClass.levelOrderTraversal(treeData.value); break; case 'OrderThreading': traversalNodes = inThreading.inOrderTraversalWithThreads(ThreadingTree.value); break; } highlightedNodes.value = traversalNodes.map(node => node.id); console.log('高亮节点:', highlightedNodes.value); // 高亮节点 highlightedNodes.value.forEach((id, index) => { setTimeout(() => { const element = document.getElementById(id); if (element) { element.style.backgroundColor = 'rgb(158, 158, 252)'; } }, index * 500); // 每个节点高亮间隔500毫秒 }); // 恢复其他节点的颜色 const allNodes = document.querySelectorAll('.tree-node'); allNodes.forEach(node => { node.style.backgroundColor = '#ecf5ff'; }); }; const isHighlighted = (id) => { return highlightedNodes.value.includes(id); }; </script> <style scoped> .tree { display: flex; flex-direction: column; align-items: center; } .tree-node { display: inline-block; padding: 10px; margin: 10px; border-radius: 50%; background-color: #f0f0f0; text-align: center; width: 50px; height: 50px; line-height: 50px; font-weight: bold; transition: background-color 0.3s; } .highlight { background-color: rgb(158, 158, 252); color: rgb(0, 0, 0); } .level { display: flex; justify-content: center; margin-top: 20px; } </style>
2301_80690806/Binary_Tree
src/components/Tree.vue
Vue
unknown
7,168
import { createApp } from 'vue' import './style.css' import App from './App.vue' import router from './router/router' import ElementPlus from 'element-plus' createApp(App).use(router).use(ElementPlus).mount('#app')
2301_80690806/Binary_Tree
src/main.ts
TypeScript
unknown
218
interface Result<T> { code: number; data: T; msg: string; } export default Result;
2301_80690806/Binary_Tree
src/model/Result.ts
TypeScript
unknown
95
class TreeNode { value: any; // 节点值可以是任何类型 left: TreeNode | null = null; right: TreeNode | null = null; id: number|null; constructor(value: any) { this.value = value; this.id = null; // 节点ID } } class Tree { constructor() { this.root = null; } root: TreeNode | null; } export { TreeNode, Tree };
2301_80690806/Binary_Tree
src/model/TreeNode.ts
TypeScript
unknown
365
import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router' const routes: Array<RouteRecordRaw> = [ { path: '/', name: 'Index', component: () => import('../views/Index.vue'), //redirect: '/welcome', children: [], } ] const router = createRouter({ history: createWebHistory(), routes }) export default router
2301_80690806/Binary_Tree
src/router/router.ts
TypeScript
unknown
383
/*:root { font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; font-weight: 400; color-scheme: light dark; color: rgba(255, 255, 255, 0.87); background-color: #242424; font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } a { font-weight: 500; color: #646cff; text-decoration: inherit; } a:hover { color: #535bf2; } body { margin: 0; display: flex; place-items: center; min-width: 320px; min-height: 100vh; } h1 { font-size: 3.2em; line-height: 1.1; } button { border-radius: 8px; border: 1px solid transparent; padding: 0.6em 1.2em; font-size: 1em; font-weight: 500; font-family: inherit; background-color: #1a1a1a; cursor: pointer; transition: border-color 0.25s; } button:hover { border-color: #646cff; } button:focus, button:focus-visible { outline: 4px auto -webkit-focus-ring-color; } .card { padding: 2em; } #app { max-width: 1280px; margin: 0 auto; padding: 2rem; text-align: center; } @media (prefers-color-scheme: light) { :root { color: #213547; background-color: #ffffff; } a:hover { color: #747bff; } button { background-color: #f9f9f9; } } */
2301_80690806/Binary_Tree
src/style.css
CSS
unknown
1,280
import { TreeNode } from '../model/TreeNode'; class BinaryTree { // 根据前序和中序遍历构建二叉树 public static buildTree(preorderArray: any[], inorderArray: any[]): TreeNode | null { if (preorderArray.length === 0 || inorderArray.length === 0) { return null; } const rootValue = preorderArray[0]; // 在前序遍历找到树根 const root = new TreeNode(rootValue); // 建立根节点 // 找到根节点在中序遍历中的索引 const rootIndex = inorderArray.indexOf(rootValue); // 检查根节点是否存在于中序数组中 if (rootIndex === -1) { console.error(`根节点 ${rootValue} 未在中序遍历中找到.`); return null; // 如果根节点不在中序数组中,返回 null } // 计算左子树的节点数量 const leftSize = rootIndex; // 左子树节点的个数 // 递归构建左子树和右子树 root.left = this.buildTree( preorderArray.slice(1, 1 + leftSize), // 前序遍历中左子树部分 inorderArray.slice(0, leftSize) // 中序遍历中左子树部分 ); root.right = this.buildTree( preorderArray.slice(1 + leftSize), // 前序遍历中右子树部分 inorderArray.slice(leftSize + 1) // 中序遍历中右子树部分 ); return root; } // 层序遍历构建Map方法,返回 Map<number, number | null> 类型,key 为结点 ID,value 为结点值 public static levelOrderBuildMap(root: TreeNode | null): Map<number, number | null> { if (!root) return new Map(); const result: Map<number, number | null> = new Map(); const queue: { node: TreeNode; id: number }[] = [{ node: root, id: 1 }]; // 从1开始分配ID while (queue.length > 0) { const { node: currentNode, id } = queue.shift()!; // 将当前节点的ID和值存入结果 result.set(id, currentNode.value); currentNode.id = id; // 计算左右子节点的ID const leftId = id * 2; // 左子节点ID const rightId = id * 2 + 1; // 右子节点ID if (currentNode.left) { queue.push({ node: currentNode.left, id: leftId }); } if (currentNode.right) { queue.push({ node: currentNode.right, id: rightId }); } } return result; } // 前序遍历 public static preOrderTraversal(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const traverse = (node: TreeNode | null): void => { if (!node) return; result.push(node); // 访问根节点 traverse(node.left); // 访问左子树 traverse(node.right); // 访问右子树 }; traverse(root); return result; } // 中序遍历 public static inOrderTraversal(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const traverse = (node: TreeNode | null): void => { if (!node) return; traverse(node.left); // 访问左子树 result.push(node); // 访问根节点 traverse(node.right); // 访问右子树 }; traverse(root); return result; } // 后序遍历 public static postOrderTraversal(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const traverse = (node: TreeNode | null): void => { if (!node) return; traverse(node.left); // 访问左子树 traverse(node.right); // 访问右子树 result.push(node); // 访问根节点 }; traverse(root); return result; } // 层序遍历 public static levelOrderTraversal(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const queue: TreeNode[] = []; if (root) queue.push(root); while (queue.length > 0) { const currentNode = queue.shift()!; result.push(currentNode); // 访问当前节点 // 将左子节点加入队列 if (currentNode.left) { queue.push(currentNode.left); } // 将右子节点加入队列 if (currentNode.right) { queue.push(currentNode.right); } } return result; } // 前序遍历(非递归) public static preOrderTraversalIterative(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const stack: TreeNode[] = []; if (root) stack.push(root); while (stack.length > 0) { const node = stack.pop()!; result.push(node); // 访问根节点 if (node.right) stack.push(node.right); // 先入栈右子树 if (node.left) stack.push(node.left); // 后入栈左子树 } return result; } // 中序遍历(非递归) public static inOrderTraversalIterative(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const stack: TreeNode[] = []; let current: TreeNode | null = root; while (current || stack.length > 0) { while (current) { stack.push(current); current = current.left; // 先访问左子树 } current = stack.pop()!; result.push(current); // 访问根节点 current = current.right; // 再访问右子树 } return result; } // 后序遍历(非递归) public static postOrderTraversalIterative(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const stack: TreeNode[] = []; let lastVisitedNode: TreeNode | null = null; let current: TreeNode | null = root; while (current || stack.length > 0) { while (current) { stack.push(current); current = current.left; // 先访问左子树 } const peekNode = stack[stack.length - 1]; if (peekNode.right && peekNode.right !== lastVisitedNode) { current = peekNode.right; // 优先访问右子树 } else { stack.pop(); result.push(peekNode); // 访问根节点 lastVisitedNode = peekNode; } } return result; } // 层序遍历(递归) public static levelOrderTraversalRecursive(root: TreeNode | null): TreeNode[][] { const result: TreeNode[][] = []; const traverse = (node: TreeNode | null, level: number): void => { if (!node) return; // 如果结果数组的长度等于当前层数,表示需要新增一层 if (result.length === level) { result.push([]); } // 将当前节点添加到对应层级的数组中 result[level].push(node); // 递归访问左子树和右子树 traverse(node.left, level + 1); traverse(node.right, level + 1); }; traverse(root, 0); return result; } } export default BinaryTree;
2301_80690806/Binary_Tree
src/utils/BuildTree.ts
TypeScript
unknown
6,957
import Result from '../model/Result'; import axios, { Axios, } from 'axios'; /** * @description axios封装 */ class Service { private baseURL: string = "http://localhost:8080"; private service: Axios; constructor() { // 创建axios实例 this.service = axios.create({ baseURL: this.baseURL, // api的base_url // timeout: 10000 // 请求超时时间 }); /* // request拦截器 this.service.interceptors.request.use( (config: AxiosRequestConfig) => { // 可以在这里添加请求头、修改请求配置等 return config; }, (error) => { return Promise.reject(error); } ); // response拦截器 this.service.interceptors.response.use( (response: AxiosResponse) => { // 返回后端自定义的响应数据 return response.data as Result<any>; }, (error) => { return Promise.reject(error); } );*/ } public async get(url: string, params: any = null) : Promise<Result<any>>{ let error: boolean = false; let res = await this.service.get(url, { params: params }).catch(() => { error = true; }); if (!error) { return res as unknown as Result<any>; }else { return { code: 500, msg: '请求失败', data: null } } } public async post(url: string, params: any) : Promise<Result<any>>{ let error: boolean = false; let res = await this.service.post(url, params).catch(() => { error = true; }); if (!error) { return res as unknown as Result<any>; }else { return { code: 500, msg: '请求失败', data: null } } } public async put(url: string, params: any) : Promise<Result<any>>{ let error: boolean = false; let res = await this.service.put(url, params).catch(() => { error = true; }); if (!error) { return res as unknown as Result<any>; }else { return { code: 500, msg: '请求失败', data: null } } } public async delete(url: string, params: any) : Promise<Result<any>>{ let error: boolean = false; let res = await this.service.delete(url, { params: params }).catch(() => { error = true; }); if (!error) { return res as unknown as Result<any>; }else { return { code: 500, msg: '请求失败', data: null } } } } export default new Service();
2301_80690806/Binary_Tree
src/utils/axios.ts
TypeScript
unknown
2,962
class TreeNode { value: any; left: TreeNode | null; right: TreeNode | null; isLeftThread: boolean; isRightThread: boolean; constructor(value: any) { this.value = value; this.left = null; this.right = null; this.isLeftThread = false; this.isRightThread = false; } } class inThreading { // 中序线索化 public static inOrderThreading(root: TreeNode | null): TreeNode | null { if (!root) return null; const stack: TreeNode[] = []; // 使用数组模拟栈 let current: TreeNode | null = root; let prev: TreeNode | null = null; while (current !== null || stack.length > 0) { if (current !== null) { stack.push(current); current = current.left; } else { current = stack.pop()!; if (current !== null && current.left === null) { // 添加对 current 的检查 current.isLeftThread = true; current.left = prev; } if (prev !== null && prev.right === null) { prev.isRightThread = true; prev.right = current; } prev = current; if (current != null) { current = current.right; } } } // 处理最后一个节点 if (prev !== null) { prev.isRightThread = true; prev.right = null; } return root; } // 找到第一个节点 private static FirstNode(root: TreeNode | null): TreeNode | null { let current = root; while (current !== null && !current.isLeftThread) { current = current.left; } return current; } // 找到下一个节点 private static NextNode(node: TreeNode | null): TreeNode | null { if (node === null) return null; if (!node.isRightThread) { return this.FirstNode(node.right); } else { return node.right; } } // 线索化中序遍历 public static inOrderTraversalWithThreads(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; let current = this.FirstNode(root); while (current !== null) { result.push(current); // 访问当前节点 console.log(current.value); current = this.NextNode(current); } return result; } /*// 传统中序遍历(用于对比) inOrderTraversal(root: TreeNode | null): TreeNode[] { const result: TreeNode[] = []; const traverse = (node: TreeNode | null): void => { if (!node) return; traverse(node.left); // 访问左子树 result.push(node); // 访问根节点 traverse(node.right); // 访问右子树 }; traverse(root); return result; }*/ } export default inThreading; // 示例用法 /*const tree = new TreeNode(1); tree.left = new TreeNode(2); tree.right = new TreeNode(3); tree.left.left = new TreeNode(4); tree.left.right = new TreeNode(5); const binaryTree = new inThreading(); binaryTree.inOrderThreading(tree); console.log("线索化中序遍历:", binaryTree.inOrderTraversalWithThreads(tree).map(node => node.value)); //console.log("传统中序遍历:", binaryTree.inOrderTraversal(tree).map(node => node.value));*/
2301_80690806/Binary_Tree
src/utils/inThreading.ts
TypeScript
unknown
3,484
<template> <div class="left"> <LeftForm :fatherMap="map" @submit="submit" /> </div> <button @click="test">点我发送请求给java</button> <Tree :orderData="TreeOrderData" /> </template> <style lang="scss"> .left { position: absolute; height: calc(100% - 30px); left: 0; } </style> <script lang="ts" setup> import { useRoute, useRouter, RouteLocationNormalizedLoaded, Router } from 'vue-router' import { ref, onMounted, Ref,reactive,watch } from 'vue' import Service from '../utils/axios' import LeftForm from '../components/LeftForm.vue' import Tree from '../components/Tree.vue' const isCollapse: Ref<boolean> = ref(false) const activeIndex: Ref<string> = ref('1') const route: RouteLocationNormalizedLoaded = useRoute() const router: Router = useRouter() function test() { console.log("test"); Service.get('/api/test', {}); } onMounted(async () => { await router.isReady(); /* if (new RegExp('welcome').test(route.path)) { activeIndex.value = '1' } else if (new RegExp('user').test(route.path)) { activeIndex.value = '2' } else if (new RegExp('table').test(route.path)) { activeIndex.value = '3' }*/ }); // 定义二叉树的映射关系,这里是整个项目的数据集 const map = new Map([ ['3 9 20 15 7', '9 3 15 20 7'], ['A B D C E', 'D B A C E'], ['A B C', 'B A C'], ['X Y Z', 'Y X Z'], ['M N O P', 'N M O P'], ['1 2 3 4', '2 1 4 3'], ['A B C D E F', 'B A D E C F'], ['K L M N O', 'M L O N K'], ['P Q R S', 'Q P S R'], ['S T U', 'T S U'], ['G H I', 'H G I'], ['A B C D E F G', 'C B D A F E G'], ['T U V W', 'U T W V'], ['1 2 3', '2 3 1'], ['A B C', 'C B A'] ]); const TreeOrderData = reactive({ preOrder: '', inOrder: '' }) const submit = (orderData: any ) => { TreeOrderData.preOrder = orderData.preOrder; // 更新 preOrder TreeOrderData.inOrder = orderData.inOrder; // 更新 inOrder } /* watch(TreeOrderData, (newValue) => { console.log('orderData changed:', newValue); });*/ </script>
2301_80690806/Binary_Tree
src/views/Index.vue
Vue
unknown
2,095
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // https://vite.dev/config/ export default defineConfig({ plugins: [ vue(), AutoImport({ resolvers: [ElementPlusResolver()], }), Components({ resolvers: [ElementPlusResolver()], }), ], server: { port: 8081, // 指定启动端口,后端与前端不能使用同一个端口 open: true // 启动后是否自动打开浏览器 }, })
2301_80690806/Binary_Tree
vite.config.ts
TypeScript
unknown
629
import { defineConfig } from 'vitepress'; import { demoblockPlugin, VitePluginDemoblock } from 'vitepress-theme-demoblock'; import vueI18n from "@intlify/unplugin-vue-i18n/vite"; import sideBarEn from './theme/themeConfig/sideBar-en'; import sideBarZh from './theme/themeConfig/sideBar-zh'; export default defineConfig({ title: 'MateChat - 轻松构建你的AI应用', description: 'MateChat - 前端智能化场景解决方案UI库,轻松构建你的AI应用。已服务于华为内部多个应用智能化改造,并助力CodeArts、InsCode AI IDE等智能化助手搭建。是一款企业级开箱即用的产品。全部代码开源并遵循 MIT 协议,任何企业、组织及个人均可免费使用。', head: [ ['link', { rel: 'icon', href: '/logo.svg' }], ['meta', { name: 'keywords', content: 'chat,AI,vue,GPT,web,MateChat,开源,open source,智能化,components,组件库' }] ], markdown: { config: (md) => { md.use(demoblockPlugin); }, }, vite: { plugins: [ VitePluginDemoblock(), vueI18n({ ssr: true }) ], ssr: { noExternal: ['devui-theme', 'vue-devui', 'xss'], }, }, ignoreDeadLinks: true, themeConfig: { nav: [ { text: 'nav.guide', link: '/use-guide/introduction' }, { text: 'nav.component', link: '/components/introduction/demo' }, { text: 'nav.demo', link: '/playground/playground' }, ], sidebar: { ...sideBarZh, ...sideBarEn, }, outline: { level: 3 }, socialLinks: [{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }], }, lang: 'zh', locales: { root: { label: '简体中文', lang: 'zh', }, en: { label: 'English', lang: 'en', link: '/en/', }, }, });
2301_80257615/MateChat
docs/.vitepress/config.ts
TypeScript
mit
1,771
import { Layout } from '../../theme-default'; import { registerComponents } from './register-components'; import DevUI from 'vue-devui'; import 'vue-devui/style.css'; import MateChat from '@matechat/core'; import '@devui-design/icons/icomoon/devui-icon.css'; import i18n from '../../i18n'; import localeHref from '../../directive/localeHref'; export default { Layout, enhanceApp({ app }) { registerComponents(app); app.directive('localeHref', localeHref); app.use(DevUI).use(i18n).use(MateChat); }, };
2301_80257615/MateChat
docs/.vitepress/theme/index.ts
TypeScript
mit
522
import Demo from '../../theme-default/components/Demo.vue'; import DemoBlock from '../../theme-default/components/DemoBlock.vue'; export function registerComponents(app) { app.component('Demo', Demo); app.component('DemoBlock', DemoBlock); }
2301_80257615/MateChat
docs/.vitepress/theme/register-components.js
JavaScript
mit
247
export default { '/en/components/': [ { text: 'Theme', link: '/en/components/theme' }, { text: 'General', items: [{ text: 'Introduction', link: '/en/components/introduction' }], }, { text: 'Layout', items: [ { text: 'Header', link: '/en/components/header' }, { text: 'Layout', link: '/en/components/layout' }, ], }, { text: 'Conversation', items: [{ text: 'Bubble', link: '/en/components/bubble' }], }, { text: 'Input', items: [ { text: 'Input', link: '/en/components/input' }, { text: 'Prompt', link: '/en/components/prompt' }, { text: 'Mention', link: '/en/components/mention' }, ], }, { text: 'Developing', items: [ { text: 'MarkDown Card', link: '/components/markDownCard/demo' } ], }, ], '/en/design/': [ { text: 'Intro', link: '/en/design/intro' }, { text: 'Basic', items: [ { text: 'Color', link: '/en/design/color' }, { text: 'Font', link: '/en/design/font' }, ], }, ], '/en/use-guide/': [ { text: 'Start', link: '/en/use-guide/introduction' }, { text: 'On-demand Import', link: '/use-guide/require' }, { text: 'i18n', link: '/use-guide/i18n' }, { text: 'Theming', link: '/use-guide/theme' }, { text: 'Model Intergration', items: [ { text: 'OpenAI', link: '/use-guide/model/openai' }, { text: 'DeepSeek', link: '/use-guide/model/deepseek' }, { text: 'Ohter', link: '/use-guide/model/other' }, ], }, { text: 'Other', items: [ { text: 'How to Use', link: '/use-guide/access' }, { text: 'Contributing', link: '/use-guide/contributing' }, { text: 'FAQ', link: '/use-guide/faq' }, ] } ], '/en/playground/': [{ text: 'Demo', link: '/en/playground/playground' }], };
2301_80257615/MateChat
docs/.vitepress/theme/themeConfig/sideBar-en.js
JavaScript
mit
1,914
export default { '/components/': [ { text: '通用', items: [ { text: 'Introduction 介绍', link: '/components/introduction/demo' }, { text: 'List 列表', link: '/components/list/demo' }, ], }, { text: '布局', items: [ { text: 'Header 头部', link: '/components/header/demo' }, { text: 'Layout 布局', link: '/components/layout/demo' }, ], }, { text: '会话', items: [{ text: 'Bubble 气泡', link: '/components/bubble/demo' }], }, { text: '输入', items: [ { text: 'Input 输入', link: '/components/input/demo' }, { text: 'Prompt 提示', link: '/components/prompt/demo' }, { text: 'Mention 快捷操作', link: '/components/mention/demo' }, ], }, { text: '演进中', items: [{ text: 'MarkDown 卡片', link: '/components/markDownCard/demo' }], }, ], '/design/': [ { text: '介绍', link: '/design/intro' }, { text: '基础', items: [ { text: '色彩', link: '/design/color' }, { text: '字体', link: '/design/font' }, ], }, ], '/use-guide/': [ // { text: '更新日志', link: '/use-guide/changelog' }, { text: '快速开始', link: '/use-guide/introduction' }, { text: '按需引入', link: '/use-guide/require' }, { text: '国际化', link: '/use-guide/i18n' }, { text: '自定义主题', link: '/use-guide/theme' }, { text: '模型对接', items: [ { text: 'OpenAI', link: '/use-guide/model/openai' }, { text: 'DeepSeek', link: '/use-guide/model/deepseek' }, { text: '其他', link: '/use-guide/model/other' }, ], }, { text: '其他', items: [ { text: '使用MateChat的多种方式', link: '/use-guide/access' }, { text: '贡献指南', link: '/use-guide/contributing' }, { text: 'FAQ', link: '/use-guide/faq' }, ] } ], '/playground/': [{ text: '演示', link: '/playground/playground' }], };
2301_80257615/MateChat
docs/.vitepress/theme/themeConfig/sideBar-zh.js
JavaScript
mit
2,064
<template> <svg t="1735560070455" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7624" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink" > <path d="M882.912 611.392c14.72-54.976 16.736-110.368 7.872-163.04a225.408 225.408 0 0 1-60.48 96.96v0.288a227.52 227.52 0 0 1-258.816 42.56 227.296 227.296 0 0 1-90.592-329.696A227.392 227.392 0 0 1 544 194.816a227.328 227.328 0 0 1 108.992-40.032c-13.44-5.28-27.328-9.888-41.6-13.696-204.864-54.88-415.424 66.656-470.304 271.52-54.912 204.864 66.688 415.424 271.52 470.304 204.864 54.88 415.424-66.688 470.304-271.52z m-81.44 37.12c-64.64 137.536-220.352 213.28-372.288 172.576-170.72-45.76-272-221.216-226.272-391.904a319.936 319.936 0 0 1 236.064-228.8 295.36 295.36 0 0 0 224 478.56 295.392 295.392 0 0 0 138.496-30.4z m26.048-372.864L810.752 224l-16.8 51.648h-54.304l43.936 31.936-16.768 51.648 43.936-31.936 43.936 31.936-16.8-51.648 43.936-31.936H827.52zM618.752 224l16.768 51.648h54.336l-43.968 31.936 16.8 51.648-43.936-31.936-43.936 31.936 16.768-51.648-43.936-31.936h54.304L618.752 224z m112.768 179.648L714.752 352l-16.8 51.648h-54.304l43.936 31.936-16.768 51.648 43.936-31.936 43.936 31.936-16.8-51.648 43.936-31.936H731.52z" p-id="7625" data-spm-anchor-id="a313x.collections_detail.0.i7.5ce33a810YndEt" class="selected" ></path> </svg> </template> <script setup lang="ts"></script>
2301_80257615/MateChat
docs/components/prompt/Icon.vue
Vue
mit
1,472
import { getLocaleUrlPrefix } from '../theme-default/support/utils'; export default { mounted(el, binding) { el.href = getLocaleUrlPrefix(binding.value) }, updated(el, binding) { el.href = getLocaleUrlPrefix(binding.value) } }
2301_80257615/MateChat
docs/directive/localeHref.js
JavaScript
mit
259
import { createI18n } from 'vue-i18n'; import en from './en.json'; import zh from './zh.json'; const i18n = createI18n({ locale: typeof localStorage !== 'undefined' ? localStorage.getItem('locale') || 'zh' : 'zh', // 默认语言 fallbackFormat: 'en', legacy: false, messages: { en, zh, }, globalInjection: true, }); export default i18n;
2301_80257615/MateChat
docs/i18n/index.ts
TypeScript
mit
360
<template> <div ref="markdownCardRef" class="mc-markdown-render" v-html="markedHtml"></div> </template> <script setup lang="ts"> import markdownit from 'markdown-it'; import hljs from 'highlight.js'; import { computed } from 'vue'; const props = defineProps({ content: { type: String, default: '', }, }); const mdt = markdownit({ breaks: true, linkify: true, html: true, highlight: (str, lang) => { if (lang && hljs.getLanguage(lang)) { try { return hljs.highlight(str, { language: lang }).value; } catch (_) {} } return ''; // use external default escaping }, }); const markedHtml = computed(() => { return mdt.render(props.content); }); </script> <style lang="scss" scoped> .mc-markdown-render { overflow-x: auto; :deep(p) { margin: 0 !important; } } </style>
2301_80257615/MateChat
docs/playground/RenderMarkdown.vue
Vue
mit
835
import quickSortMd from './quicksort.md?raw'; import helpMd from './help.md?raw'; import bindProjectSpaceMd from './bind-project-space.md?raw'; import piplineListMd from './pipeline-list.md?raw'; import formatDateMd from './format-date.md?raw'; export const introPrompt = { direction: 'horizontal', list: [ { value: 'quickSort', label: '帮我写一个快速排序', iconConfig: { name: 'icon-info-o', color: '#5e7ce0' }, desc: '使用 js 实现一个快速排序', }, { value: 'helpMd', label: '你可以帮我做些什么?', iconConfig: { name: 'icon-star', color: 'rgb(255, 215, 0)' }, desc: '了解当前大模型可以帮你做的事', }, { value: 'bindProjectSpace', label: '怎么绑定项目空间', iconConfig: { name: 'icon-priority', color: '#3ac295' }, desc: '如何绑定云空间中的项目', }, ], }; export const guessQuestions = [ { label: '最近执行流水线列表', value: 'pipelineList' }, { label: '帮我写一个快速排序', value: 'quickSort' }, { label: '使用 js 格式化时间', value: 'formatDate' }, ]; export const simplePrompt = [ { value: 'quickSort', iconConfig: { name: 'icon-info-o', color: '#5e7ce0' }, label: '帮我写一个快速排序', }, { value: 'helpMd', iconConfig: { name: 'icon-star', color: 'rgb(255, 215, 0)' }, label: '你可以帮我做些什么?', }, ]; export const mockAnswer = { quickSort: quickSortMd, helpMd: helpMd, bindProjectSpace: bindProjectSpaceMd, pipelineList: piplineListMd, formatDate: formatDateMd, };
2301_80257615/MateChat
docs/playground/mock.constants.ts
TypeScript
mit
1,636
export const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i; export const APPEARANCE_KEY = 'vitepress-theme-appearance'; const HASH_RE = /#.*$/; const HASH_OR_QUERY_RE = /[?#].*$/; const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)$/; export const inBrowser = typeof document !== 'undefined'; export const notFoundPageData = { relativePath: '404.md', filePath: '', title: '404', description: 'Not Found', headers: [], frontmatter: { sidebar: false, layout: 'page' }, lastUpdated: 0, isNotFound: true }; export function isActive(currentPath, matchPath, asRegex = false) { if (matchPath === undefined) { return false; } currentPath = normalize(`/${currentPath}`); if (asRegex) { return new RegExp(matchPath).test(currentPath); } if (normalize(matchPath) !== currentPath) { return false; } const hashMatch = matchPath.match(HASH_RE); if (hashMatch) { return (inBrowser ? location.hash : '') === hashMatch[0]; } return true; } function normalize(path) { return decodeURI(path) .replace(HASH_OR_QUERY_RE, '') .replace(INDEX_OR_EXT_RE, '$1'); } export function isExternal(path) { return EXTERNAL_URL_RE.test(path); } export function getLocaleForPath(siteData, relativePath) { return (Object.keys(siteData?.locales || {}).find((key) => key !== 'root' && !isExternal(key) && isActive(relativePath, `/${key}/`, true)) || 'root'); } /** * this merges the locales data to the main data by the route */ export function resolveSiteDataByRoute(siteData, relativePath) { const localeIndex = getLocaleForPath(siteData, relativePath); return Object.assign({}, siteData, { localeIndex, lang: siteData.locales[localeIndex]?.lang ?? siteData.lang, dir: siteData.locales[localeIndex]?.dir ?? siteData.dir, title: siteData.locales[localeIndex]?.title ?? siteData.title, titleTemplate: siteData.locales[localeIndex]?.titleTemplate ?? siteData.titleTemplate, description: siteData.locales[localeIndex]?.description ?? siteData.description, head: mergeHead(siteData.head, siteData.locales[localeIndex]?.head ?? []), themeConfig: { ...siteData.themeConfig, ...siteData.locales[localeIndex]?.themeConfig } }); } /** * Create the page title string based on config. */ export function createTitle(siteData, pageData) { const title = pageData.title || siteData.title; const template = pageData.titleTemplate ?? siteData.titleTemplate; if (typeof template === 'string' && template.includes(':title')) { return template.replace(/:title/g, title); } const templateString = createTitleTemplate(siteData.title, template); if (title === templateString.slice(3)) { return title; } return `${title}${templateString}`; } function createTitleTemplate(siteTitle, template) { if (template === false) { return ''; } if (template === true || template === undefined) { return ` | ${siteTitle}`; } if (siteTitle === template) { return ''; } return ` | ${template}`; } function hasTag(head, tag) { const [tagType, tagAttrs] = tag; if (tagType !== 'meta') return false; const keyAttr = Object.entries(tagAttrs)[0]; // First key if (keyAttr == null) return false; return head.some(([type, attrs]) => type === tagType && attrs[keyAttr[0]] === keyAttr[1]); } export function mergeHead(prev, curr) { return [...prev.filter((tagAttrs) => !hasTag(curr, tagAttrs)), ...curr]; } // https://github.com/rollup/rollup/blob/fec513270c6ac350072425cc045db367656c623b/src/utils/sanitizeFileName.ts const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g; const DRIVE_LETTER_REGEX = /^[a-z]:/i; export function sanitizeFileName(name) { const match = DRIVE_LETTER_REGEX.exec(name); const driveLetter = match ? match[0] : ''; return (driveLetter + name .slice(driveLetter.length) .replace(INVALID_CHAR_REGEX, '_') .replace(/(^|\/)_+(?=[^/]*$)/, '$1')); } export function slash(p) { return p.replace(/\\/g, '/'); } const KNOWN_EXTENSIONS = new Set(); export function treatAsHtml(filename) { if (KNOWN_EXTENSIONS.size === 0) { const extraExts = (typeof process === 'object' && process.env?.VITE_EXTRA_EXTENSIONS) || import.meta.env?.VITE_EXTRA_EXTENSIONS || ''; ('3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,' + 'doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,' + 'man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,' + 'opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,' + 'tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,' + 'yaml,yml,zip' + (extraExts && typeof extraExts === 'string' ? ',' + extraExts : '')) .split(',') .forEach((ext) => KNOWN_EXTENSIONS.add(ext)); } const ext = filename.split('.').pop(); return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase()); } // https://github.com/sindresorhus/escape-string-regexp/blob/ba9a4473850cb367936417e97f1f2191b7cc67dd/index.js export function escapeRegExp(str) { return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'); } /** * @internal */ export function escapeHtml(str) { return str .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/&(?![\w#]+;)/g, '&amp;'); }
2301_80257615/MateChat
docs/shared.js
JavaScript
mit
5,672
<template> <span>{{ msg }}</span> </template> <script setup lang="ts"> import { ref } from 'vue'; const msg = ref('404页面'); </script>
2301_80257615/MateChat
docs/theme-default/components/404.vue
Vue
mit
142
<template> <div class="collapse-container"> <div class="collapse-title devui-text-ellipsis" @click="isExpand = !isExpand"> <span :title="title">{{ title }}</span> <CollapseArrow :class="['collapse-icon', { expanded: isExpand }]" /> </div> <Transition name="collapse-transition" @beforeEnter="beforeEnter" @enter="enter" @afterEnter="afterEnter" @beforeLeave="beforeLeave" @leave="leave" @afterLeave="afterLeave" > <div v-if="isExpand" class="collapse-content"><slot /></div> </Transition> </div> </template> <script setup lang="ts"> import { computed, RendererElement } from 'vue'; import CollapseArrow from './icons/CollapseArrow.vue'; const props = defineProps({ modelValue: { type: Boolean, default: true }, title: { type: String, default: '' }, }); const emits = defineEmits(['update:modelValue']); const isExpand = computed({ get: () => props.modelValue, set: (val: boolean) => emits('update:modelValue', val), }); const beforeEnter = (el: RendererElement) => { if (!el.dataset) { el.dataset = {}; } if (el.style.height) { el.dataset.height = el.style.height; } el.style.maxHeight = 0; }; const enter = (el: RendererElement) => { requestAnimationFrame(() => { el.dataset.oldOverflow = el.style.overflow; if (el.dataset.height) { el.style.maxHeight = el.dataset.height; } else if (el.scrollHeight !== 0) { el.style.maxHeight = `${el.scrollHeight}px`; } else { el.style.maxHeight = 0; } el.style.overflow = 'hidden'; }); }; const afterEnter = (el: RendererElement) => { el.style.maxHeight = ''; el.style.overflow = el.dataset.oldOverflow; }; const beforeLeave = (el: RendererElement) => { if (!el.dataset) { el.dataset = {}; } el.dataset.oldOverflow = el.style.overflow; el.style.maxHeight = `${el.scrollHeight}px`; el.style.overflow = 'hidden'; }; const leave = (el: RendererElement) => { if (el.scrollHeight !== 0) { el.style.maxHeight = 0; } }; const afterLeave = (el: RendererElement) => { el.style.maxHeight = ''; el.style.overflow = el.dataset.oldOverflow; }; </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .collapse-title { position: relative; display: block; width: 100%; height: 40px; padding-left: 12px; padding-right: 28px; line-height: 40px; color: $devui-text-weak; border-radius: $devui-border-radius; font-size: $devui-font-size; font-weight: 600; box-sizing: border-box; transition: font-weight $devui-animation-duration-fast $devui-animation-ease-in-out-smooth, background-color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth; cursor: pointer; &:hover { color: $devui-list-item-hover-text; background-color: $devui-list-item-hover-bg; } } .collapse-icon { position: absolute; top: 12px; right: 10px; transform: rotate(-90deg); transform-origin: center; transition: transform $devui-animation-duration-slow $devui-animation-ease-in-out-smooth; :deep(g path) { fill: $devui-icon-fill; } &.expanded { transform: none; } } .collapse-content { line-height: 1.5; color: $devui-text-weak; } .collapse-transition { &-enter-from, &-leave-to { opacity: 0; } &-enter-to, &-leave-from { opacity: 1; } &-enter-active, &-leave-active { transition: max-height 0.3s cubic-bezier(0.5, 0.05, 0.5, 0.95), opacity 0.3s cubic-bezier(0.5, 0.05, 0.5, 0.95); } } </style>
2301_80257615/MateChat
docs/theme-default/components/Collapse.vue
Vue
mit
3,549
<template> <div ref="sliderContainer" class="slider-container"> <div id="banner-container" class="banner-container"> <img :src="basicSrc + props.bannerSrc" :class="{ darkMode: isDark }" /> </div> <div id="icon-container" class="icon-container"> <img :src="basicSrc + props.iconSrc" :class="{ darkMode: isDark }" /> </div> <div ref="tabsRef"> <d-tabs id="content-slider-tabs" type="slider" v-model="id" class="tabs" :class="{ 'tab-current': id === 'api' }" @active-tab-change="tabChange($event)" :reactivable="false" > <d-tab id="demo"> <template v-slot:title> <div class="tab-content"> <d-icon name="code" style="vertical-align: middle" /> <span class="tab-words" style="margin-left: 8px">Demo</span> </div> </template> </d-tab> <d-tab id="api"> <template v-slot:title> <div class="tab-content"> <d-icon name="icon-api" style="vertical-align: middle" /> <span class="tab-words" style="margin-left: 8px">API</span> </div> </template> </d-tab> </d-tabs> </div> </div> </template> <script setup lang="ts"> import { ref, onMounted, onUnmounted, watch } from 'vue'; import { useData, useRoute, useRouter } from 'vitepress'; import { defineProps } from 'vue'; const props = defineProps({ bannerSrc: { type: String, default: '/banner.png', }, iconSrc: { type: String, default: '/defaultIcon.png', }, }); const basicSrc = '/png/contentSlider'; const { isDark } = useData(); const route = useRoute(); const router = useRouter(); const id = ref('demo'); const tabsRef = ref<HTMLElement | null>(null); const sliderContainer = ref<HTMLElement | null>(null); const handleScroll = () => { if (sliderContainer.value && tabsRef.value) { const sliderContainerTop = sliderContainer.value.getBoundingClientRect().top; if (sliderContainerTop <= -72) { tabsRef.value.classList.add('fix-tab'); tabsRef.value.style.width = `${sliderContainer.value.offsetWidth}px`; } else { tabsRef.value.classList.remove('fix-tab'); } } }; const tabChange = (event) => { let currentId = id.value; id.value = event; let nextPath = route.path.replace(currentId, event); router.go(nextPath); }; const setTabId = (path) => { if (path.includes('/api')) { id.value = 'api'; } else { id.value = 'demo'; } }; watch( () => route.path, (newPath) => { setTabId(newPath); }, ); onMounted(() => { window.addEventListener('scroll', handleScroll); setTabId(route.path); }); onUnmounted(() => { window.removeEventListener('scroll', handleScroll); }); </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; $slider-tabs-height: 56px; .slider-container { width: 100%; height: 176px; position: relative; } .banner-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; border-radius: 20px; img { width: 100%; height: 100%; } } .icon-container { position: absolute; top: -90px; right: 24px; width: 160px; height: 160px; background-color: #fff3; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 20px; } .tabs { width: 100%; position: absolute; bottom: -30px; border-radius: 0 0 20px 20px; } .tabs :deep(ul) { width: 100%; background: #f2f2f399; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 0 0 20px 20px; } .tabs :deep(li) { flex: 1; height: 56px; line-height: 56px; border-radius: 0 0 20px 20px; margin: 0; } .tabs :deep(.devui-tabs__nav-content a) { display: inline-block; text-align: center; padding: 0 16px; height: 100%; width: 100%; line-height: 56px; } .tabs { & :deep(.devui-tabs__nav-slider-animation) { width: 50% !important; left: 0 !important; height: 56px; border-radius: 0 0 20px 20px; box-shadow: 2px 2px 16px $devui-shadow !important; background-color: $devui-base-bg; } &.tab-current :deep(.devui-tabs__nav-slider-animation) { left: 50.1% !important; } } .tabs :deep(.devui-tabs__nav) { overflow-y: unset !important; overflow-x: unset !important; } .fix-tab { width: 100%; position: fixed; top: 46px; height: 56px; z-index: 1000; & :deep(.devui-tabs__nav-slider-animation) { box-shadow: 0 2px 4px 0 $devui-shadow !important; } } .tab-content { color: $devui-text; font-size: 18px; } .darkMode { filter: brightness(0.9); } @media (max-width: 1280px) { } @media screen and (max-width: 768px) { .icon-container { width: 110px; height: 110px; top: -60px; } .slider-container { height: 120px; } .tabs { :deep(ul) { height: 40px; } :deep(li) { height: 40px; line-height: 40px; } :deep(.devui-tabs__nav-content a) { line-height: 40px; } & :deep(.devui-tabs__nav-slider-animation) { height: 40px; } } .fix-tab { height: 40px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/ContentSlider.vue
Vue
mit
5,221
<template> <div ref="demoBlock" :class="['demo-block', blockClass, customClass ? customClass : '', { hover }]" @mouseenter="hover = true" @mouseleave="hover = false" > <div class="source"> <slot /> </div> <div ref="meta" class="meta"> <div v-if="$slots.description" ref="description" class="description"> <slot name="description" /> </div> <div ref="highlight" class="highlight"> <slot name="highlight" /> </div> </div> <div ref="control" :class="['demo-block-control', { 'is-fixed': fixedControl }]" @click="onClickControl"> <transition name="arrow-slide"> <i :class="['control-icon', { 'icon-caret-down': !isExpanded, 'icon-caret-up': isExpanded, hovering: hover }]"></i> </transition> <transition name="text-slide"> <span v-show="hover" class="control-text">{{ controlText }}</span> </transition> <div class="control-button-wrap"> <transition name="text-slide"> <span v-show="isExpanded" class="control-button copy-button" @click.stop="onCopy"> {{ copyText }} </span> </transition> </div> </div> </div> </template> <script> import { useRoute, useData } from 'vitepress'; import { throttle } from 'lodash-es'; import copy from 'clipboard-copy'; import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick, defineAsyncComponent } from 'vue'; export default { name: 'Demo', props: { customClass: String, sourceCode: String, lightCode: String, desc: String, targetFilePath: String, demoList: Array | undefined, }, setup(props) { const hover = ref(false); const fixedControl = ref(false); const isExpanded = ref(false); const isShowTip = ref(false); const isUseVueFile = computed(() => !!props.targetFilePath); const data = useData(); const route = useRoute(); const pathArr = ref(route.path.split('/')); const component = computed(() => pathArr.value[pathArr.value.length - 1].split('.')[0]); const DemoComponent = props.demoList?.[props.targetFilePath]?.default ?? defineAsyncComponent(() => import(/* vite-ignore */ props.targetFilePath)); watch( () => route.path, (path) => { pathArr.value = path.split('/'); }, ); const onClickControl = () => { isExpanded.value = !isExpanded.value; hover.value = isExpanded.value; }; const blockClass = computed(() => { return `demo-${component.value}`; }); const locale = computed(() => { return ( data.theme.value.demoblock?.[data.localePath.value] ?? { 'hide-text': '隐藏代码', 'show-text': '显示代码', 'copy-button-text': '复制代码片段', 'copy-success-text': '复制成功', } ); }); const decoded = computed(() => { return decodeURIComponent(props.lightCode); }); const desc = computed(() => { return props?.desc ? decodeURIComponent(props.desc) : null; }); const copyText = computed(() => { return isShowTip.value ? locale.value['copy-success-text'] : locale.value['copy-button-text']; }); const controlText = computed(() => { return isExpanded.value ? locale.value['hide-text'] : locale.value['show-text']; }); // template refs const highlight = ref(null); const description = ref(null); const meta = ref(null); const control = ref(null); const demoBlock = ref(null); const codeAreaHeight = computed(() => { if (description.value) { return description.value.clientHeight + highlight.value.clientHeight + 20; } return highlight.value.clientHeight; }); const _scrollHandler = () => { const { top, bottom, left } = meta.value.getBoundingClientRect(); const innerHeight = window.innerHeight || document.body.clientHeight; fixedControl.value = bottom > innerHeight && top + 44 <= innerHeight; control.value.style.left = fixedControl.value ? `${left}px` : '0'; const dv = fixedControl.value ? 1 : 2; control.value.style.width = `${demoBlock.value.offsetWidth - dv}px`; }; const scrollHandler = throttle(_scrollHandler, 200); const removeScrollHandler = () => { window.removeEventListener('scroll', scrollHandler); window.removeEventListener('resize', scrollHandler); }; const onCopy = () => { copy(props.sourceCode); isShowTip.value = true; setTimeout(() => { isShowTip.value = false; }, 1300); }; watch(isExpanded, (val) => { meta.value.style.height = val ? `${codeAreaHeight.value + 1}px` : '0'; if (!val) { fixedControl.value = false; control.value.style.left = '0'; control.value.style.width = `${demoBlock.value.offsetWidth - 2}px`; removeScrollHandler(); return; } setTimeout(() => { window.addEventListener('scroll', scrollHandler); window.addEventListener('resize', scrollHandler); _scrollHandler(); }, 300); }); onMounted(() => { nextTick(() => { if (!description.value) { highlight.value.style.width = '100%'; } }); }); onBeforeUnmount(() => { removeScrollHandler(); }); return { blockClass, hover, fixedControl, isExpanded, isUseVueFile, locale, controlText, onClickControl, copyText, highlight, desc, description, meta, control, onCopy, demoBlock, decoded, DemoComponent, }; }, }; </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .demo-block { margin: 10px 0; border: solid 1px $devui-line; border-radius: 20px; transition: 0.2s; } .demo-block.hover { box-shadow: 0 0 8px 0 $devui-light-shadow, 0 2px 4px 0 $devui-light-shadow; } :deep(.mc-markdown-render p) { margin: 0 !important; } .source { box-sizing: border-box; padding: 24px; transition: 0.2s; overflow: auto; } .meta { border-top: solid 1px $devui-line; background-color: var(--code-bg-color); overflow: hidden; height: 0; transition: height 0.2s; } .description { border: solid 1px $devui-line; border-radius: 3px; padding: 20px; box-sizing: border-box; line-height: 26px; color: var(--c-text); word-break: break-word; margin: 10px 10px 6px 10px; background-color: #fff; } .demo-block-control { border-top: solid 1px $devui-line; height: 44px; box-sizing: border-box; background-color: $devui-base-bg; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; text-align: center; margin-top: -1px; color: $devui-text !important; cursor: pointer; position: relative; } .icon-caret-down { width: 16px; height: 100%; position: relative; content: ''; width: 0; height: 0; border-color: inherit; border: 6px solid transparent; border-top: 7.5px solid; position: absolute; top: 50%; left: 50%; margin-top: -2.5px; margin-left: -6px; } .icon-caret-up { width: 16px; height: 100%; position: relative; content: ''; width: 0; height: 0; border-color: inherit; border: 6px solid transparent; border-bottom: 7px solid; position: absolute; top: 50%; left: 50%; margin-top: -8.5px; margin-left: -6px; } .demo-block-control.is-fixed { position: sticky; bottom: 0; /* width: calc(100% - 320px - 48px - 200px - 1px); */ border-right: solid 1px $devui-line; z-index: 2; } .demo-block-control .control-icon { display: inline-block; font-size: 16px; line-height: 44px; transition: 0.3s; } .demo-block-control .control-icon.hovering { color: $devui-text; transform: translateX(-40px); } .demo-block-control .control-text { position: absolute; transform: translateX(-30px); font-size: 14px; line-height: 44px; font-weight: 500; transition: 0.3s; display: inline-block; } .demo-block-control:hover { color: var(--c-brand); // background-color: #f9fafc; } .demo-block-control .text-slide-enter, .demo-block-control .text-slide-leave-active { opacity: 0; transform: translateX(10px); } .demo-block-control .control-button { color: var(--c-brand); font-size: 14px; font-weight: 500; margin: 0 10px; } .demo-block-control .control-button-wrap { line-height: 43px; position: absolute; top: 0; right: 0; padding-left: 5px; padding-right: 25px; } </style> <style> .highlight div[class*='language-'] { margin: 0 !important; } </style>
2301_80257615/MateChat
docs/theme-default/components/Demo.vue
Vue
mit
8,630
<template> <div class="demo-block" :class="[customClass ? customClass : '']"> <div class="source"> <slot></slot> </div> </div> </template> <script> export default { name: 'DemoBlock', props: { customClass: String } } </script> <style scoped> .demo-block { margin: 10px 0; } .demo-block .source { border: solid 1px #ebebeb; border-radius: 3px; box-sizing: border-box; padding: 24px; transition: .2s; } </style>
2301_80257615/MateChat
docs/theme-default/components/DemoBlock.vue
Vue
mit
452
<template> <div class="ai-container"> <div class="title">匹配不同业务类型的生成式AI体验</div> <div class="banner"> <div class="scene" v-for="(item, i) in list" :key="i" :class="{ active: index === i }" @mouseenter="index = i"> <div class="label">{{ item.label }}</div> <div class="desc">{{ item.desc }}</div> </div> </div> <div class="content"> <img class="bottom" :src="list[index].img" /> </div> </div> </template> <script setup lang="ts"> import { ref } from 'vue'; const list = [ { label: '协作式', desc: '助力原平台开启更多智慧体验', img: '/png/home/ai/cooperation.png', }, { label: '沉浸式', desc: '不只是对话,还有更完整的GenAI交互生态资源', img: '/png/home/ai/immerse.png', }, { label: '情境式', desc: '更适合研发场景、融入作业流程的体验套件', img: '/png/home/ai/scene.png', }, ]; const index = ref(1); </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .ai-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .banner { margin: 80px 0 56px 0; width: 60%; display: flex; justify-content: center; gap: 24px; .scene { flex: 1; max-width: 382px; display: flex; flex-direction: column; padding: 25px; border-radius: 24px; background: no-repeat center/cover url(/png/home/aiDefault.png), rgba(255, 255, 255, 0.8); color: #43406D; cursor: pointer; &.active { color: rgba(255, 255, 255, 0.8); background: no-repeat center/cover url(/png/home/aiDefault.png), linear-gradient(to right, #f157ff, #7b79ff); .desc { color: rgba(255, 255, 255, 0.8); } } .label { margin-bottom: 10px; font-size: 28px; font-weight: bold; line-height: 1.5; } .desc { font-size: 16px; color: $devui-aide-text; } } } .content { width: 80%; display: flex; justify-content: center; background: no-repeat url(/png/home/ai/contentBg.svg); background-size: 100%; background-position: center; img { width: 90%; object-fit: contain; } padding-bottom: 140px; } @media (max-width: 1600px) { .banner { margin: 56px 0 30px 0; .scene { padding: 15px; border-radius: 12px; .label { font-size: 18px; } .desc { font-size: 11px; } } } .content { padding-bottom: 56px; } } @media (max-width: 768px) { .banner { width: 80%; margin: 56px 0 30px 0; .scene { .label { font-size: 12px; text-align: center; margin-bottom: 0; } .desc { display: none; } } } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/AIComp.vue
Vue
mit
2,895
<template> <div class="comp-container"> <div class="title">应用案例</div> <div class="content"> <div class="case"> <div class="label"> <img src="/logo.svg" data-src="/png/home/demoLogo.png" /> InsCode AI IDE </div> <div class="desc"> InsCode AI IDE 是由 CSDN 、GitCode 和华为云 CodeArts IDE 联合开发的 AI 跨平台集成开发环境。使用MateChat灵活丰富的组件资源,InsCode快速完成了IDE AI插件的设计搭建,为开发者提供高效、便捷的IDE编程体验。 </div> </div> <div class="video-container"> <video ref="vDemoRef" class="top" muted src="/png/home/demo.mp4" poster="/png/home/demo.png"> </video> </div> </div> </div> </template> <script setup lang="ts"> import { onMounted, ref } from 'vue'; const vDemoRef = ref(); onMounted(() => { vDemoRef.value.addEventListener('loadeddata', () => { vDemoRef.value.play(); }); vDemoRef.value.addEventListener('ended', webPlay); }); const webPlay = () => { if (vDemoRef.value) { vDemoRef.value.play(); } }; </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .comp-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .content { width: 80%; margin: 80px 0 160px 0; display: flex; align-items: center; .case { max-width: min(30%, 375px); margin-right: 30px; .label { display: flex; align-items: center; font-size: 36px; margin-bottom: 32px; img { margin-right: 8px; width: 1em; height: 1em; } } .desc { font-size: 16px; } } .video-container { flex: 1; width: 60%; video { width: 100%; object-fit: contain; border-radius: 24px; } } } @media (max-width: 1600px) { .content { margin: 56px 0; .case { .label { font-size: 24px; margin-bottom: 20px; } .desc { font-size: 11px; } } .video-container video { border-radius: 12px; } } } @media (max-width: 768px) { .content { flex-direction: column; margin: 40px 0 56px 0; .case { max-width: 100%; margin-right: 0; margin-bottom: 30px; .label { font-size: 16px; margin-bottom: 0; } .desc { display: none; } } .video-container { width: 90%; } } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/DemoComp.vue
Vue
mit
2,649
<template> <div class="eco-container"> <div class="title">技术生态</div> <div class="content"> <div class="partner" v-for="(item, i) in list" :key="i"> <img src="/logo.svg" :data-src="item.img" /> </div> </div> </div> </template> <script setup lang="ts"> const list = [ { img: '/png/home/ecoLogo.png', }, { img: '/png/home/ecoLogo.png', }, { img: '/png/home/ecoLogo.png', }, ]; </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .eco-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .content { width: 60%; margin: 98px 0; display: flex; flex-wrap: wrap; justify-content: space-around; .partner { width: 30%; padding: 5% 0; background: rgba(255, 255, 255, 0.6); border-radius: 20px; display: flex; align-items: center; justify-content: center; img { width: 30%; object-fit: contain; } } } @media (max-width: 1600px) { .content { margin: 56px 0; } } @media (max-width: 768px) { .content { margin: 40px 0 56px 0; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/EcoComp.vue
Vue
mit
1,217
<template> <div class="gradual-container"> <div class="title">体验无边界 业务无侵害</div> <div class="title-desc"> MateChat致力于构建不同业务场景下高一致性的GenAI体验系统语言,同时匹配各种工具/平台的原生业务场景和界面特征,提供更适合研发工具领域的对话组件,打造流畅亲和、跨界一致、易学易用的用户体验,以及易接入、易维护、易扩展的开发体验。 </div> <div class="gradual-video"> <video ref="vWebRef" class="top" muted src="/png/home/gradualWeb.mp4" poster="/png/home/gradualTop.png"> </video> <video ref="vIDERef" class="bottom" muted @mouseenter="startIDEPlay()" @mouseout="stopIDE()" src="/png/home/gradualIDE.mp4" poster="/png/home/gradualBottom.png" ></video> </div> </div> </template> <script setup lang="ts"> import { onMounted, ref } from 'vue'; const vWebRef = ref(); const vIDERef = ref(); onMounted(() => { vWebRef.value.addEventListener('loadeddata', () => { vWebRef.value.play(); }) vWebRef.value.addEventListener('ended', webPlay); }); const webPlay = () => { if (vWebRef.value) { vWebRef.value.play(); } }; const IDEPlay = () => { if (vIDERef.value) { vIDERef.value.play(); } }; function startIDEPlay() { vWebRef.value.pause(); IDEPlay(); vIDERef.value.addEventListener('ended', IDEPlay); } function stopIDE() { vIDERef.value.pause(); vIDERef.value.removeEventListener('ended', IDEPlay); webPlay(); } </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .gradual-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .gradual-video { margin-top: 80px; margin-bottom: 42px; padding-bottom: 98px; width: 100%; height: 100%; display: flex; justify-content: center; background: no-repeat url(/png/home/gradual/videoBg.svg); background-size: contain; background-position: center 100px; video { position: relative; width: 40%; border-radius: 10px; transition: all 0.3s ease; } .top { z-index: 2; transform: translateX(20%); &:hover { transform: translateX(20%) scale(1.1); } } .bottom { z-index: 1; transform: translateX(-20%); &:hover { z-index: 3; transform: translateX(-20%) scale(1.1); } } } @media (max-width: 1600px) { .gradual-video { margin: 56px 0 0 0; padding-bottom: 56px; background-position: center 50px; } } @media (max-width: 768px) { .gradual-video { background-size: 80%; background-position: center 10px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/GradualComp.vue
Vue
mit
2,820
<template> <div class="carousel-container"> <d-carousel ref="carousel" height="80%" arrowTrigger="never" :show-dots="false"> <d-carousel-item class="d-carousel-item" v-for="(src, i) in items" :key="i"> <img :src="src" /> </d-carousel-item> </d-carousel> </div> </template> <script setup lang="ts"> import { ref } from 'vue'; const items = ref<string[]>([ '/png/home/interact/1.png', '/png/home/interact/2.png', '/png/home/interact/3.png', '/png/home/interact/4.png', '/png/home/interact/5.png', ]); const carousel = ref(); function go(i: number) { carousel.value?.goto?.(i); } defineExpose({ go }); </script> <style lang="scss" scoped> .carousel-container { width: 100%; height: 100%; .d-carousel-item { width: 100%; height: 100%; } img { width: 100%; height: 100%; object-fit: contain; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/InteractCarousel.vue
Vue
mit
880
<template> <div class="interact-container" ref="interactRef" @mousewheel="onMouseWheel($event)"> <div class="title">构建通用GenAI交互体系</div> <div class="title-desc">MateChat聚焦于打造对话式交互的关键体验,致力于在多元业务场景下,构建高度一致的GenAI语言交流系统。</div> <div class="content"> <div class="steps" ref="stepsRef"> <ul> <div class="cartoon-line" ref="cartoonLine"></div> <div class="cartoon-dot" ref="cartoonDot" @transitionend="onTransitionEnd()"></div> <li v-for="(item, i) in steps" :key="i" ref="listItems"> <div class="line" :class="{ active: i <= index - 1 || (index === 4 && i === 4) }"></div> <div class="row"> <div class="dot" :class="{ active: i <= index }"></div> <div class="label" :class="{ 'active-label': i === index }" @click="onStepClick(i)"> {{ item.label }}<span>{{ item.labelNext }}</span> </div> </div> <div class="desc">{{ item.desc }}</div> </li> <li> <a v-localeHref="'/playground/playground.html'"> <div class="trial-btn" style="margin-left: 78px"> 立即体验 <img src="/logo.svg" data-src="/png/home/interact/arrow-right.svg" /> </div> </a> </li> </ul> </div> <div class="steps-h"> <ul> <div class="cartoon-line-h" ref="cartoonLineH"></div> <div class="cartoon-dot-h" ref="cartoonDotH"></div> <li v-for="(item, i) in steps" :key="i" ref="listItemsH"> <div class="line-h" :class="{ active: i <= index - 1 || (index === 4 && i === 4) }"></div> <div class="row-h"> <div class="dot-h" :class="{ active: i <= index }"></div> <div class="label-h" :class="{ 'unactivated-label': i !== index }" @click="onHStepClick(i)"> {{ item.label }}<span>{{ item.labelNext }}</span> </div> </div> </li> </ul> </div> <div class="demo"> <!-- <InteractCarousel ref="carouselRef" class="demo-carousel"></InteractCarousel> --> <img class="left" src="/logo.svg" data-src="/png/home/interact/interLeft.png" /> <img ref="imgRef" class="center" :src="imgs[0]" /> <img class="right" src="/logo.svg" data-src="/png/home/interact/interRight.png" /> </div> <div class="btn-h"> <a v-localeHref="'/playground/playground.html'" style="display: flex; align-items: center; justify-content: center"> <div class="trial-btn"> 立即体验 <img src="/logo.svg" data-src="/png/home/interact/arrow-right.svg" /> </div> </a> </div> </div> </div> </template> <script setup lang="ts"> import { onMounted, ref, computed, nextTick, watch } from 'vue'; import InteractCarousel from './InteractCarousel.vue'; const imgRef = ref(); const steps = [ { label: '快速', labelNext: '唤醒', desc: '固定入口、情境建议或快捷键...不管是DevOps类平台还是IDE,总有最灵巧的唤醒方式', }, { label: '轻松', labelNext: '使用', desc: '适时的引导和手边提示,为产品的易学易用性保驾护航', }, { label: '自由', labelNext: '表达', desc: '专为与GenAI对话打造的输入区域,功能完善,易于配置扩展', }, { label: '过程', labelNext: '监督', desc: '帮助用户正确理解AI系统内部状态,促进良性的人机互动', }, { label: '可读', labelNext: '性强', desc: '有层次、有逻辑的Markdown语法渲染样式和清晰直观的界面布局,提供最佳阅读体验', }, ]; const imgs = [ '/png/home/interact/1.png', '/png/home/interact/2.png', '/png/home/interact/3.png', '/png/home/interact/4.png', '/png/home/interact/5.png', ]; let flag = false; const maxIndex = computed(() => steps.length - 1); const interactRef = ref(); const stepsRef = ref(); const carouselRef = ref(); const listItems = ref(); const index = ref(0); const cartoonLine = ref(); const cartoonDot = ref(); let lisHeight = []; // horizontal const listItemsH = ref(); const cartoonLineH = ref(); const cartoonDotH = ref(); let listWidth = []; watch(index, () => { if (!imgRef.value) { return; } imgRef.value.style.opacity = 0.5; setTimeout(() => { imgRef.value.src = imgs[index.value]; imgRef.value.style.opacity = 1; }, 300); }); onMounted(() => { lisHeight = listItems.value.map((li) => li.clientHeight); listWidth = listItemsH.value.map((li) => li.clientWidth); window.addEventListener('resize', getSize); }); function getSize() { onStepClick(index.value); onHStepClick(index.value); } async function onStepClick(i) { if (!cartoonLine.value) { return; } index.value = i; await nextTick(); // carouselRef.value.go(index.value); lisHeight = listItems.value.map((li) => li.clientHeight); const height = lisHeight.slice(0, i).reduce((a, b) => a + b, 0); cartoonLine.value.style.height = height + 20 + 'px'; cartoonDot.value.style.transform = `translateX(-44px) translateY(${height - 20}px)`; } function onHStepClick(i) { if (!cartoonLineH.value) { return; } listWidth = listItemsH.value.map((li) => li.clientWidth); index.value = i; const width = listWidth.slice(0, i).reduce((a, b) => a + b, 0); cartoonLineH.value.style.height = width + 20 + 'px'; cartoonDotH.value.style.transform = `translateY(-12px) translateX(${width}px)`; } function onMouseWheel(e) { if (stepsRef.value.clientWidth == 0) { return; } if (index.value === 0 && e.deltaY < 0) { return; } if (index.value === maxIndex.value && e.deltaY > 0) { return; } const rect = interactRef.value.getBoundingClientRect(); const fix = document.documentElement.clientHeight + 200; if (rect.top < 0 || rect.top + interactRef.value.clientHeight > fix) { return; } e.preventDefault(); if (flag) { return; } if (e.deltaY > 0) { index.value++; flag = true; } if (e.deltaY < 0) { index.value--; flag = true; } onStepClick(index.value); } function onTransitionEnd() { flag = false; } </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .interact-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .content { margin: 98px 0; margin-bottom: 140px; width: 80%; display: flex; align-items: stretch; justify-content: center; gap: 25px; transform: translateX(6%); } .steps { display: flex; ul, li { margin: 0; padding: 0; list-style: none; position: relative; } .line { position: absolute; top: 0; left: 7px; width: 2px; height: 100%; background-color: #DFE0F4; transition: all 0.8s linear; } .row { display: flex; align-items: center; gap: 42px; font-size: 28px; .dot { width: 16px; height: 16px; background-color: #DFE0F4; border-radius: 50%; transition: all 0.8s linear; } .label { cursor: pointer; } .active-label { font-size: 30px; font-weight: bold; span { color: $devui-link; } } } .desc { padding: 12px 0 32px 0; padding-left: 58px; font-size: 16px; color: $devui-aide-text; } .active { opacity: 0; } li:last-child > .line { height: 30px; } .cartoon-line { position: absolute; z-index: 1; width: 8px; height: 20px; left: 4px; background: no-repeat center/cover url(/png/home/interLine.svg); transition: all 0.8s linear; } .cartoon-dot { position: absolute; z-index: 2; width: 98px; height: 98px; background: no-repeat center/cover url(/png/home/interact/dot.svg); transform: translateX(-44px) translateY(-12px); transition: all 0.8s linear; } } .trial-btn { display: flex; gap: 4px; width: fit-content; padding: 15px 30px; border-radius: 30px; background: linear-gradient(135deg, #B369FF, #7B79FF); background-repeat: no-repeat; background-position: center; transition: all 0.3s ease-in-out; color: $devui-light-text; font-size: 18px; font-weight: bold; cursor: pointer; &:hover { transform: scale(1.05); } } .demo { position: relative; display: flex; align-items: center; justify-content: center; img { width: 36%; object-fit: contain; transition: all 0.3s linear; } .left { position: absolute; z-index: 1; transform: translateX(-30%) translateY(70%); } .center { z-index: 3; } .right { position: absolute; z-index: 2; transform: translateX(30%) translateY(-30%); } // &::before { // content: ''; // position: absolute; // display: block; // width: 20%; // height: 20%; // background: no-repeat center / cover url(/png/home/interact/sticker.png); // transform: translateX(-30%) translateY(70%); // } } .steps-h { display: none; width: 90%; ul, li { margin: 0; padding: 0; list-style: none; position: relative; } ul { display: flex; padding: 0 2em; margin-bottom: 56px; } .line-h { position: absolute; top: 7px; left: 0; width: 100%; height: 2px; background-color: #DFE0F4; transition: all 0.8s linear; } .row-h { display: flex; flex-direction: column; padding: 0 1em; gap: 14px; font-size: 14px; .dot-h { width: 16px; height: 16px; background-color: #DFE0F4; border-radius: 50%; transition: all 0.8s linear; } .label-h { cursor: pointer; &.unactivated-label { color: $devui-aide-text; } } } .active { opacity: 0; } // 动线 .cartoon-line-h { position: absolute; top: 8px; z-index: 1; width: 8px; height: 20px; transform-origin: top; transform: rotateZ(-90deg); background: no-repeat center/cover url(/png/home/interLine.svg); transition: all 0.8s linear; } .cartoon-dot-h { position: absolute; z-index: 2; width: 40px; height: 40px; background: no-repeat center/cover url(/logo.svg); transform: translateY(-12px); transition: all 0.8s linear; } } .btn-h { display: none; } @media (max-width: 1600px) { .content { margin: 56px 0 78px 0; } .steps { display: block; .row { font-size: 18px; } .desc { font-size: 12px; padding: 8px 0 20px 0; padding-left: 58px; } } li:last-child { .line { height: 18px; } } } @media (max-width: 768px) { .content { flex-direction: column; align-items: center; margin: 56px 0 78px 0; transform: translate(0); } .steps { display: none; } .steps-h { display: flex; justify-content: center; } .btn-h { display: block; } .trial-btn { padding: 10px 15px; font-size: 14px; align-items: center; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/InteractComp.vue
Vue
mit
11,257
<template> <div class="main-container"> <div class="model"> <!-- <Scene3D class="scene-container"></Scene3D> --> <img class="model-img" src="/png/home/bigLogo.png" /> <img class="model-text" src="/png/home/homeText.png" /> </div> <div class="main-input"> <div class="use-panel"> <div class="use">如何接入使用</div> </div> <a v-localeHref="'/use-guide/introduction.html'"> <div class="btn-send">{{ $t('home.send') }}</div> </a> </div> <div class="main-text">- <span class="light-text">生成式人工智能</span> 体验设计系统 & 前端解决方案 -</div> <a v-localeHref="'/components/introduction/demo.html'"> <div class="btn-learn">开始使用</div> </a> </div> </template> <script setup lang="ts"> import Scene3D from './Scene3D.vue'; </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; .main-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; } .model { position: relative; width: 65%; height: 60%; .scene-container { width: 100%; height: 100%; } .model-img, .model-text { position: absolute; width: 120%; height: 120%; object-fit: contain; } .model-text { z-index: 2; } } .main-input { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; border-radius: 25px; background-color: rgba(255, 255, 255, 0.8); padding-left: 52px; background-image: url(/png/home/star.png); background-repeat: no-repeat; background-position: 16px center; background-size: 4%; font-size: 22px; z-index: 2; .use-panel { width: 11em; display: flex; align-items: baseline; } .use { position: relative; white-space: nowrap; overflow: hidden; animation: showText 1s steps(6) forwards; } .use::after { content: ''; position: absolute; width: 2px; right: 0; height: 100%; animation: blink 0.5s steps(2) infinite; } .btn-send { margin: 5px 5px 5px 150px; width: 88px; height: 40px; line-height: 40px; border-radius: 40px; text-align: center; background: linear-gradient(135deg, #B369FF, #7B79FF); background-repeat: no-repeat; background-position: center; transition: all 0.3s ease-in-out; color: $devui-light-text; cursor: pointer; font-size: 20px; text-indent: 1px; } .btn-send:hover { transform: scale(1.05); } } .main-text { .light-text { color: $devui-link-active; } } .btn-learn { // background: linear-gradient(to right, #f157ff, #7b79ff); margin-top: 5vh; width: 252px; height: 84px; line-height: 84px; border-radius: 84px; text-align: center; background: linear-gradient(135deg, #B369FF, #7B79FF); background-repeat: no-repeat; background-position: center; transition: all 0.3s ease-in-out; color: $devui-light-text; font-size: 28px; font-weight: bold; cursor: pointer; z-index: 2; &:hover { transform: scale(1.05); background: no-repeat center/cover url(/png/home/btnActive.png); } } @keyframes showText { 0% { width: 0; } 100% { width: 6.1em; } } @keyframes blink { 0% { border-left: 2px solid transparent; } 100% { border-left: 2px solid $devui-text; } } @keyframes rockText { 0% { transform: translateX(0); } 25% { transform: translateX(-2px); } 50% { transform: translateX(0); } 75% { transform: translateX(2px); } 100% { transform: translateX(0); } } @media (max-width: 1600px) { .model { .text1, .text2, .text3 { transform: scale(0.8); } } .btn-learn { width: 194px; height: 65px; line-height: 65px; font-size: 25px; } } @media (max-width: 768px) { .model { height: 35%; } .main-input { padding-left: 38px; font-size: 14px; .btn-send { margin-left: 50px; width: 44px; height: 26px; line-height: 26px; border-radius: 26px; font-size: 12px; } } .main-text { font-size: 12px; } .btn-learn { width: 126px; height: 42px; line-height: 42px; font-size: 16px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/MainComp.vue
Vue
mit
4,327
<template> <div class="scene-container" ref="sceneRef"> </div> </template> <script setup lang="ts"> import { onMounted, onUnmounted, ref } from 'vue'; import * as THREE from 'three'; import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; const sceneRef = ref(); const loader = new GLTFLoader(); const scene = new THREE.Scene(); let camera; let controls; const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); scene.add( new THREE.AmbientLight( 0xffffff ) ); let model; loader.load( '../../../assets/gltf/shuizhi.gltf', ( gltf ) => { gltf.scene.position.x = 0; gltf.scene.position.y = -20; gltf.scene.position.z = 0; gltf.scene.scale.x = 130.0; gltf.scene.scale.y = 130.0; gltf.scene.scale.z = 130.0; model = gltf.scene; scene.add( gltf.scene ); gltf.scene.name = "model"; }); onMounted(() => { if (!sceneRef.value) { return; } renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( sceneRef.value.clientWidth, sceneRef.value.clientHeight ); sceneRef.value.appendChild( renderer.domElement ); camera = new THREE.PerspectiveCamera( 75, sceneRef.value.clientWidth / sceneRef.value.clientHeight, 1, 10000 ); camera.position.z = 100; controls = new OrbitControls( camera, renderer.domElement ); controls.maxPolarAngle = Math.PI * 0.5; controls.minDistance = 100; controls.maxDistance = 5000; controls.addEventListener( 'change', cameraChange ); window.addEventListener('resize', onWindowResize, false); render(); }); onUnmounted(() => { window.removeEventListener('resize', onWindowResize); }) function render(rotate?) { requestAnimationFrame(render); //渲染 if (model) { model.rotation.y += 0.01; } renderer.render(scene, camera); } function cameraChange() { renderer.render(scene, camera); } function onWindowResize(){ camera.aspect = sceneRef.value.clientWidth / sceneRef.value.clientHeight; camera.updateProjectionMatrix(); renderer.setSize( sceneRef.value.clientWidth, sceneRef.value.clientHeight ); cameraChange(); } </script> <style lang="scss" scoped> .scene-container { width: 100%; height: 100%; } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/Scene3D.vue
Vue
mit
2,323
<template> <div class="typical-container"> <div class="title">典型组件展示</div> <div class="main"> <div class="content"> <div class="comp-card" v-for="(item, i) in list" :key="i" :class="item.class"> <div class="img-container"> <a v-localeHref="item.href"> <img :data-src="item.img" src="/logo.svg" /> </a> </div> <div class="bottom"> <div class="label">{{ item.label }}</div> <div class="desc">{{ item.desc }}</div> </div> </div> </div> <div class="typical-btn"> <a v-localeHref="'/components/introduction/demo.html'"> <div class="btn"> <div class="btn-text">了解更多组件</div> </div> </a> </div> </div> </div> </template> <script setup lang="ts"> const list = [ { label: '消息气泡', desc: '用于承载对话内容的气泡组件', class: ['bubble-bg'], img: '/png/home/comp/bubbleComp.png', href: '/components/bubble/demo.html', }, { label: '快捷使用', desc: '用于根据输入内容进行快捷提示的组件', class: ['mention-bg'], img: '/png/home/comp/mentionComp.png', href: '/components/mention/demo.html', }, { label: '输入框', desc: '用于对话的输入框组件', class: ['input-bg'], img: '/png/home/comp/inputComp.png', href: '/components/input/demo.html', }, ]; </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; @import './common.scss'; .typical-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; } .main { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; // background: no-repeat url(/png/home/comp/bg.svg); background-size: contain; background-position: right; // &::before { // position: absolute; // content: ''; // display: block; // width: 100px; // height: 100px; // background: no-repeat center / cover url(/png/home/comp/sticker.png); // } } .content { width: 80%; margin: 80px 0 56px 0; margin-left: calc(5% - 2em); display: flex; flex-wrap: wrap; gap: 2em; .comp-card { width: 30%; aspect-ratio: 1 / 1.1; display: flex; flex-direction: column; align-items: center; justify-content: space-around; .img-container { width: 100%; height: 70%; display: flex; align-items: center; justify-content: center; a { width: 60%; max-height: 90%; } img { width: 100%; max-height: 100%; object-fit: contain; transition: all 0.5s ease-in-out; cursor: pointer; &:hover { transform: scale(1.1); } } } .bottom { width: 60%; height: auto; display: flex; flex-direction: column; gap: 10%; padding-bottom: 5%; .label { font-size: 28px; font-weight: bold; color: rgba(0, 0, 0, 0.8); margin-bottom: 8px; } .desc { font-size: 16px; color: $devui-aide-text; } } } } .bubble-bg { background: no-repeat center/cover url(/png/home/comp/bubbleBg.png); background-size: 100% 100%; } .mention-bg { background: no-repeat center/cover url(/png/home/comp/mentionBg.png); background-size: 100% 100%; } .input-bg { background: no-repeat center/cover url(/png/home/comp/inputBg.png); background-size: 100% 100%; } .typical-btn { display: flex; align-items: center; justify-content: center; margin-bottom: 56px; .btn { width: 252px; height: 84px; line-height: 84px; text-align: center; border-radius: 84px; background: no-repeat center/contain url(/png/home/comp/btnBg.svg); color: #db6fe5; font-size: 30px; cursor: pointer; transition: all 0.5s ease-in-out; &:hover { transform: scale(1.05); } .btn-text { background: linear-gradient(to right, #B369FF, #7B79FF); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } } } @media (max-width: 1600px) { .content { margin: 56px 0; margin-left: calc(10% - 4em); .comp-card .bottom { .label { font-size: 18px; } .desc { font-size: 11px; } } } .typical-btn .btn { width: 194px; height: 65px; line-height: 65px; border-radius: 65px; font-size: 25px; } } @media (max-width: 768px) { .content .comp-card { width: 45%; .bottom { .label { font-size: 12px; margin-bottom: 0; } .desc { display: none; } } } .typical-btn .btn { width: 126px; height: 42px; line-height: 42px; border-radius: 42px; font-size: 16px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/TypicalComp.vue
Vue
mit
4,978
.title { display: flex; align-items: center; text-align: center; font-weight: bold; font-size: 56px; line-height: 1.5; color: #302e51; &::before { content: ''; display: block; margin: 0 10px; width: 1.5em; height: 1em; background: no-repeat center / cover url(/png/home/titleLeft.svg); } &::after { content: ''; display: block; margin: 0 10px; width: 1.5em; height: 1em; background: no-repeat center / cover url(/png/home/titleRight.svg); } } .title-desc { margin-top: 8px; max-width: 60%; font-size: 16px; text-align: center; color: $devui-aide-text; } @media (max-width: 1600px) { .title { font-size: 38px; } } @media (max-width: 768px) { .title { font-size: 25px; } .title-desc { font-size: 12px; max-width: 80%; } }
2301_80257615/MateChat
docs/theme-default/components/Home/common.scss
SCSS
mit
830
<template> <div class="home-container"> <Header :show-theme="false" :isScroll="isScroll"></Header> <MainComp class="main-container"></MainComp> <Suspense> <template #default> <div> <div class="intro-container"> <GradualComp class="gradual-container"></GradualComp> <InteractComp class="interact-container"></InteractComp> <AIComp class="ai-container"></AIComp> <TypicalComp class="typical-container"></TypicalComp> </div> <div class="demo-container"> <DemoComp class="comp-container"></DemoComp> </div> <Footer class="footer-container"></Footer> </div> </template> </Suspense> </div> </template> <script setup lang="ts"> import { onMounted, onUnmounted, ref } from 'vue'; import { infinityTheme, galaxyTheme } from 'devui-theme'; import GradualComp from './GradualComp.vue'; // 体验无边界 import InteractComp from './InteractComp.vue'; // AI交互 import AIComp from './AIComp.vue'; // AI体验 import TypicalComp from './TypicalComp.vue'; // 组件展示 import DemoComp from './DemoComp.vue'; // 应用案例 import Footer from '../common/Footer.vue'; // 底部 import Header from '../common/Header.vue'; import MainComp from './MainComp.vue'; // 主页 import { themeServiceInstance } from '../../index'; import { ThemeKey } from '../datas/type'; const ThemeConfig = { [ThemeKey.Galaxy]: galaxyTheme, [ThemeKey.Infinity]: infinityTheme, }; const isScroll = ref(false); onMounted(() => { themeServiceInstance?.applyTheme(ThemeConfig[ThemeKey.Infinity]); window.addEventListener('scroll', onScroll); }); onUnmounted(() => { if (localStorage.getItem('theme') === ThemeKey.Galaxy) { themeServiceInstance?.applyTheme(ThemeConfig[ThemeKey.Galaxy]); } window.removeEventListener('scroll', onScroll); }); function onScroll() { const imgs = document.querySelectorAll('img[data-src]'); const videos = document.querySelectorAll('video[data-src]'); imgs.forEach((img: any) => { const rect = img.getBoundingClientRect(); if (rect.top < document.documentElement.clientHeight * 2) { img.src = img.dataset.src; img.removeAttribute('data-src'); } }); videos.forEach((video: any) => { const rect = video.getBoundingClientRect(); if (rect.top < document.documentElement.clientHeight * 2) { video.src = video.dataset.src; video.removeAttribute('data-src'); } }); isScroll.value = window.scrollY > 0; } </script> <style lang="scss" scoped> .home-container { width: 100%; height: 100%; min-width: 375px; overflow-x: auto; display: flex; flex-direction: column; align-items: center; } .loading { width: 100%; height: 50px; display: flex; align-items: center; justify-content: center; } .main-container { width: 100%; height: 100vh; background: no-repeat center/cover url(/png/home/bgHome.png); } .intro-container { width: 100%; height: 100%; background: no-repeat center/cover url(/png/home/introBg.png); .gradual-c0ntainer, .interact-container, .ai-container, .typical-container { width: 100%; } } .demo-container { width: 100%; height: 100%; padding-top: 84px; background: no-repeat center/cover url(/png/home/demoBg.png); .comp-container, .eco-container { width: 100%; } } .footer-container { width: 100%; } @media (max-width: 768px) { .main-container { height: auto; aspect-ratio: 1 / 1.5; } .demo-container { padding-top: 56px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Home/index.vue
Vue
mit
3,568
<template> <NotFound v-if="page.isNotFound" /> <Home v-else-if="frontmatter.layout === 'home'" /> <Page v-else /> </template> <script setup lang="ts"> import { useData } from 'vitepress'; import NotFound from './404.vue'; import Home from './Home/index.vue'; import Page from './Page.vue'; const { page, frontmatter } = useData(); if (typeof window !== 'undefined' && typeof location !== 'undefined') { const isProd = location.href.indexOf('matechat.gitcode') > -1; const x = 'https://res.hc-cdn.com/FurionSdkStatic/3.6.43/furion-cdn.min.js', n = '__fr'; if (isProd) { window[n] = window[n] || {}; window[n].config = { appId: '1830A6C762C44E4387F4C347ACB416C5', setting: 'perf,jsTrack,api,uba,longtask,rtti,crash,resource', crossOriginApi: false, hashMode: true, closeReportFMP: true, smartJsErr: true, sendResource: true, option: { api: { headers: [], }, whiteScreen: { rootElements: ['html', 'body', '#app', '#root'], }, }, }; const o = document.createElement('script'); o.src = x; o.async = !0; const d = document.body.firstChild; document.body.insertBefore(o, d); } } </script>
2301_80257615/MateChat
docs/theme-default/components/Layout.vue
Vue
mit
1,243
<template> <Header class="page-header" /> <div class="page-container"> <SideMenu v-if="!frontmatter.isPlayground" class="side-menu" /> <div ref="containerEl" :class="['main-container', { 'main-container-playground': frontmatter.isPlayground }]"> <div :class="['main-content', { 'main-content-playground': frontmatter.isPlayground }]"> <h1 v-if="page.relativePath.includes('components')" class="title">{{ frontmatter.title }}</h1> <h2 v-if="page.relativePath.includes('components')" class="description">{{ frontmatter.desc }}</h2> <ContentSlider v-if="page.relativePath.includes('components')" :bannerSrc="frontmatter.bannerSrc" :iconSrc="frontmatter.iconSrc" /> <Content class="vp-doc" /> </div> <div v-if="!frontmatter.isPlayground" class="content-nav devui-scrollbar devui-scroll-overlay"> <PageNav /> </div> </div> </div> </template> <script setup lang="ts"> import { onMounted, onUnmounted, ref } from 'vue'; import { useData } from 'vitepress'; import SideMenu from './SideMenu.vue'; import PageNav from './PageNav.vue'; import ContentSlider from './ContentSlider.vue'; import Header from './common/Header.vue'; import { useActiveAnchor } from '../composables/outline'; const containerEl = ref<HTMLElement>(); const { page, frontmatter } = useData(); useActiveAnchor(containerEl); const handleResize = () => { const sideMenu = document.querySelector('.side-menu') as HTMLElement; if (!sideMenu) { return; } if (window.innerWidth <= 768) { sideMenu.style.width = '0'; } else if (window.innerWidth <= 1280) { sideMenu.style.width = '230px'; } else { sideMenu.style.width = '320px'; } }; onMounted(() => { window.addEventListener('resize', handleResize); }); onUnmounted(() => { window.removeEventListener('resize', handleResize); }); </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .page-header { border-bottom: 1px solid $devui-dividing-line; } .page-container { display: flex; background-color: $devui-base-bg; } .main-container { width: calc(100vw - 20px); padding-right: 150px; max-width: 1600px; margin: 0 auto; &.main-container-playground { padding-right: 0; } } .main-content { width: 100%; padding: 80px 11vw 32px 25vw; position: relative; z-index: 1; @media screen and (min-width: 1680px) { padding: 80px 180px 32px 420px; } &.main-content-playground { padding: 48px 10vw 0 10vw; @media screen and (min-width: 1680px) { padding: 48px 168px 0 168px; } } .title { font-size: 36px; height: 24px; font-weight: bold; color: $devui-text; } .description { margin-bottom: 30px; height: 24px; font-size: $devui-font-size; color: $devui-aide-text; } } .content-nav { font-size: $devui-font-size-sm; position: fixed; top: 80px; right: 40px; z-index: 10; width: 200px; max-height: 100%; overflow-x: hidden; } .sider-container { border-right: 1px solid #dfe1e6; width: 302px; height: 100vh; position: fixed; background: white; display: flex; flex-direction: column; } .search { margin: 20px 10px; } .side-menu { width: 320px; z-index: 1001; } @media screen and (max-width: 1280px) { .content-nav { display: none; transition: 0.5s; } .main-container { padding-right: 0px; } .main-content { padding: 80px 2vw 32px 250px; &.main-content-playground { padding: 48px 10vw 0 10vw; } } .side-menu { width: 220px; transition: width 0.5s; } } @media screen and (max-width: 768px) { .side-menu { width: 0; padding: 0; transition: 0.5s; } .main-content { min-width: 320px; padding: 80px 3vw 32px 3vw; } } @media (max-width: 320px) { .page-header { width: 320px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/Page.vue
Vue
mit
3,900
<template> <div class="page-nav-container"> <ul> <li v-for="({ link, title }, index) in headers" :key="index" :title="title" :id="`nav-${link}`" class="page-nav-link devui-text-ellipsis" @click="() => onClick(link)" > {{ title }} </li> </ul> </div> </template> <script setup lang="ts"> import { shallowRef } from 'vue'; import { onContentUpdated, useData } from 'vitepress'; import { getHeaders } from '../composables/outline'; const { frontmatter, theme } = useData(); const headers = shallowRef([]); let timer: ReturnType<typeof setTimeout> | null = null; const onClick = (link: string) => { const heading = document.getElementById(decodeURIComponent(link)); heading?.scrollIntoView({ behavior: 'smooth', block: 'start' }); timer = setTimeout(() => { window.location.href = `#${link}`; if (timer) { clearTimeout(timer); timer = null; } }, 1000); }; onContentUpdated(() => { headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline); }); </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .page-nav-link { list-style: none; width: 100%; height: 36px; line-height: 36px; padding-left: 16px; font-size: 12px; color: $devui-text; border-radius: 100px; cursor: pointer; &.active { color: $devui-list-item-active-text; background-color: $devui-list-item-active-bg; font-weight: 600; } &:hover { color: $devui-list-item-hover-text; background-color: $devui-list-item-hover-bg; } } </style>
2301_80257615/MateChat
docs/theme-default/components/PageNav.vue
Vue
mit
1,613
<template> <div class="side-menu-container devui-scroll-overlay devui-scrollbar"> <template v-for="(item, index) in sidebarList" :key="index"> <a v-if="!item.items" :href="item.link" :title="item.text" :class="['menu-item full-radios devui-text-ellipsis', { 'menu-item-active': isActive(item.link) }]" > {{ item.text }} </a> <Collapse class="menu-list" v-else v-model="item.expand" :title="item.text"> <div> <a v-for="(menu, idx) in item.items" :key="`${index}+${idx}`" :href="menu.link" :title="menu.text" :class="['menu-item devui-text-ellipsis', { 'menu-item-active': isActive(menu.link) }]" > {{ menu.text }} </a> </div> </Collapse> </template> </div> </template> <script setup lang="ts"> import { watch, ref, onMounted } from 'vue'; import { useData } from 'vitepress'; import { useSidebar } from '../composables/sidebar'; import Collapse from './Collapse.vue'; interface SidebarItem { text: string; link: string; expand?: boolean; items?: SidebarItem[]; } const { page } = useData(); const { sidebarGroups } = useSidebar(); const relativePath = ref(''); const sidebarList = ref<SidebarItem[]>([]); const isActive = (link: string) => { let currentPath = relativePath.value.replace('.md', '').replace('.html', ''); let currentLink = link.replace('/demo', '').replace('/api', ''); if (currentLink.startsWith('/')) { currentLink = currentLink.substring(1); } return currentPath.includes(currentLink); }; const initSidebarList = () => { sidebarList.value = sidebarGroups.value.map((item) => { if (!item.text && item.items.length === 1) { return item.items[0]; } else { item.expand = true; return item; } }); }; watch( page, () => { relativePath.value = page.value.relativePath; initSidebarList(); }, { immediate: true }, ); </script> <style scoped lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .side-menu-container { border-right: 1px solid $devui-dividing-line; width: 302px; height: 100vh; position: fixed; z-index: 10; top: 48px; background: $devui-base-bg; padding: 16px 8px; :deep(.collapse-container):not(:first-child) { margin-top: 8px; } } .menu-item { display: block; width: 100%; height: 40px; padding: 0 12px; margin-top: 8px; line-height: 40px; color: $devui-text-weak; border-radius: $devui-border-radius; font-size: $devui-font-size; font-weight: 400; box-sizing: border-box; transition: font-weight $devui-animation-duration-fast $devui-animation-ease-in-out-smooth, background-color $devui-animation-duration-fast $devui-animation-ease-in-out-smooth; cursor: pointer; &.full-radios { border-radius: $devui-border-radius-full ; } &.menu-item-active { color: $devui-list-item-active-text; background-color: $devui-list-item-active-bg; font-weight: 700; } &:hover { color: $devui-list-item-hover-text; background-color: $devui-list-item-hover-bg; } } .menu-list { .menu-item { padding-left: 22px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/SideMenu.vue
Vue
mit
3,228
<template> <div class="related-container"> <div class="title">相关资源</div> <div class="content"> <template v-for="(item, i) in list" :key="i"> <div class="info-container" @mouseover="onMouseOver($event, item, i)" @mouseout="onMouseOut(item)"> <a class="info" :href="item.href" rel="noopener noreferrer" target="_blank"> <img :src="item.icon" /> {{ item.label }} </a> <img v-if="item.expandImg" class="expand" :data-index="i" :class="{'active': item.hover}" :src="item.expandImg"/> </div> </template> </div> </div> </template> <script setup lang="ts"> import { ref, nextTick } from 'vue'; const list = ref([ { label: 'GitCode', href: 'https://gitcode.com/DevCloudFE/MateChat/overview', icon: '/png/footer/gitcode.svg', hover: false, }, { label: 'DevUI Design', href: 'https://devui.design/home', icon: '/png/footer/devui.svg', hover: false, }, { label: 'DevUI团队', href: 'https://juejin.cn/user/712139267650141', icon: '/png/footer/juejin.svg', hover: false, }, { label: 'DevUI Design', href: 'https://zhuanlan.zhihu.com/devui', icon: '/png/footer/zhihu.svg', hover: false, }, { label: '官方交流群', icon: '/png/footer/wechat.svg', expandImg: '/png/footer/wechat.jpg', hover: false, }, ]); async function onMouseOver(event, item, i) { if (!item.expandImg) { return; } const rect = event.target.getBoundingClientRect(); const disR = document.documentElement.clientWidth - rect.right; const expandEl = document.querySelector(`img.expand[data-index='${i}']`) as HTMLElement; if (!expandEl) { return; } if (disR < 300) { expandEl.style.transformOrigin = 'right bottom'; } else { expandEl.style.transformOrigin = 'left bottom'; } await nextTick(); item.hover = true; } function onMouseOut(item) { if (!item.expandImg) { return; } item.hover = false; } </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; .related-container { width: 100%; padding: 20px 60px; color: $devui-light-text; background: no-repeat center/cover url(/png/home/footerBg.png); .title { margin-bottom: 20px; font-size: 16px; } } .content { display: flex; flex-wrap: wrap; gap: 20px 100px; font-size: 14px; .info-container { position: relative; width: 120px; &:hover { cursor: pointer; } } .info { display: flex; align-items: center; gap: 8px; width: auto; img { height: 1em; object-fit: contain; } } a:hover { color: $devui-link-light; } .expand { position: absolute; display: none; left: 0; bottom: 2em; width: 160px; border-radius: 8px; transform-origin: left bottom; transition: all 0.1s linear; transform: scale(2.5); &.active { display: block !important; } } } @media (max-width: 1600px) { .content .expand{ border-radius: 4px; } } </style>
2301_80257615/MateChat
docs/theme-default/components/common/Footer.vue
Vue
mit
3,106
<template> <section class="header" :class="{ 'intro-header': page.relativePath.includes('index'), active: isDropdown, scroll: isScroll }"> <div class="left-nav"> <d-button v-if="page.relativePath.includes('components')" icon="nav-expand" variant="text" @click="collapseSideMenu()"></d-button> <a class="mc-logo" v-localeHref="'/'"> <img src="/logo.svg" /> MateChat </a> </div> <div class="right-nav"> <d-dropdown :overlay-class="page.relativePath.includes('index') ? 'intro-header-right-nav-dropdown' : 'header-right-nav-dropdown'" @toggle="onDropdown($event)" > <d-button class="nav-drop-btn" icon="icon-project-nav" variant="text"></d-button> <template #menu> <div class="nav-drop-menu"> <ul> <li v-for="(item, index) in theme.nav" :key="index" @click="go(item.link)"> <img :class="{ 'enhance-icon': isGalaxy }" :src="iconMap[index]" /> <span>{{ $t(item.text) }}</span> </li> <li v-show="showTheme"> <div class="theme"> <d-switch color="var(--devui-base-bg-dark)" v-model="isGalaxy" @change="themeChange($event)"> <template #checkedContent> <i class="icon-dark"></i> </template> <template #uncheckedContent> <i class="icon-light"></i> </template> </d-switch> <div>主题</div> </div> </li> <a href="https://gitcode.com/DevCloudFE/MateChat/overview" rel="noopener noreferrer" target="_blank"> <img src="/png/footer/gitcode.svg" style="height: 16px" /> <span>MateChat</span> </a> </ul> </div> </template> </d-dropdown> <div class="nav-list"> <a v-for="(item, index) in theme.nav" :key="index" v-localeHref="item.link" :class="['nav-op', { 'nav-active': isActive(item.link) }]" > <div v-if="!isGalaxy"> <img v-if="isActive(item.link)" :src="activeIconMap[index]" /> <img v-if="!isActive(item.link)" :src="iconMap[index]" /> </div> <div v-if="isGalaxy"> <img :class="{ 'enhance-icon': isActive(item.link) }" :src="iconMap[index]" /> </div> {{ $t(item.text) }} </a> </div> <div class="release"> <d-dropdown :trigger="'hover'" style="width: 100px" :position="['bottom-end', 'right', 'top-end']"> <div class="version"> <span>1.3.0</span> <i class="icon-chevron-down-2"></i> </div> <template #menu> <ul class="list-menu"> <li class="menu-item"> <d-icon name="jump-to" operable @click="goThird('https://gitcode.com/DevCloudFE/MateChat/releases')"> <template #prefix> <span>更新日志</span> </template> </d-icon> </li> </ul> </template> </d-dropdown> </div> <div v-if="showTheme" class="header-menu-splitter"></div> <div v-show="showTheme" class="theme"> <div> <d-switch color="var(--devui-base-bg-dark)" v-model="isGalaxy" @change="themeChange($event)"> <template #checkedContent> <i class="icon-dark"></i> </template> <template #uncheckedContent> <i class="icon-light"></i> </template> </d-switch> </div> </div> <div class="header-menu-splitter"></div> <div class="gitcode-address" title="到GitCode关注"> <a href="https://gitcode.com/DevCloudFE/MateChat/overview" rel="noopener noreferrer" target="_blank"> <img src="/png/footer/gitcode.svg" style="height: 16px" /> </a> </div> </div> </section> </template> <script setup lang="ts"> import { ref, onMounted, computed, inject } from 'vue'; import { useData } from 'vitepress'; import { ThemeKey, LocaleKey } from '../datas/type'; import { infinityTheme, galaxyTheme } from 'devui-theme'; import { themeServiceInstance } from '../../index'; import { useI18n } from 'vue-i18n'; import { useLangs } from '../../composables/langs'; import { useRouter } from 'vitepress'; import { APPEARANCE_KEY } from '../../../shared'; const i18n = useI18n(); const { localeLinks, currentLang } = useLangs({ correspondingLink: true }); const { theme, page, isDark } = useData(); const isGalaxy = ref(false); const isZh = ref(true); const router = useRouter(); const href = computed(() => localeLinks.value[0].link); const iconMap = ['/png/header/instruction.png', '/png/header/components.png', '/png/header/demo.png']; const activeIconMap = ['/png/header/instructionActive.png', '/png/header/componentsActive.png', '/png/header/demoActive.png']; const props = defineProps({ isScroll: { type: Boolean, default: false, }, showTheme: { type: Boolean, default: true, }, }); const ThemeConfig = { [ThemeKey.Galaxy]: galaxyTheme, [ThemeKey.Infinity]: infinityTheme, }; const isActive = (link: string) => { const prefix = link.split('/')[1]; return page.value.relativePath.startsWith(prefix); }; const isDropdown = ref(false); onMounted(() => { if (typeof localStorage !== 'undefined') { if (localStorage.getItem('theme') === ThemeKey.Galaxy) { isGalaxy.value = true; } if (localStorage.getItem('locale') === LocaleKey.en) { isZh.value = false; } } if (typeof window !== 'undefined') { const mediaQueryListDark = window.matchMedia('(prefers-color-scheme: dark)'); mediaQueryListDark.addListener(windowThemeChange); // 添加主题变动监控事件 windowThemeChange(mediaQueryListDark); } }); const go = (link: string) => { router.go(link); }; const goThird = (link: string) => { window.open(link, '_blank'); }; const toggleAppearance = inject('toggle-appearance', (isGalaxy) => { isDark.value = isGalaxy; }); function windowThemeChange(mediaQueryListEvent) { const vpTheme = typeof localStorage !== 'undefined' && localStorage.getItem(APPEARANCE_KEY); if (vpTheme === 'auto') { isGalaxy.value = !!mediaQueryListEvent.matches; // matches 存在则 系统是深色主题 changeDevUiTheme(isGalaxy.value); } } function themeChange(change) { changeDevUiTheme(change); toggleAppearance(isGalaxy.value); } function changeDevUiTheme(change) { const key = change ? ThemeKey.Galaxy : ThemeKey.Infinity; typeof localStorage !== 'undefined' && localStorage.setItem('theme', key); themeServiceInstance?.applyTheme(ThemeConfig[key]); } function collapseSideMenu() { const sideMenu = document.querySelector('.side-menu') as HTMLElement; sideMenu.style.width = !sideMenu.style.width || sideMenu.style.width === '0px' ? '230px' : '0px'; } function onDropdown(status: boolean) { isDropdown.value = status; } </script> <style lang="scss" scoped> @import 'devui-theme/styles-var/devui-var.scss'; .enhance-icon { filter: brightness(10); } .header { position: fixed; z-index: 20; display: flex; justify-content: space-between; align-items: center; top: 0; width: 100vw; height: 48px; background-color: $devui-base-bg; transition: 0.5s; img { height: 32px; margin: 8px 8px; cursor: pointer; } .mc-logo { display: flex; align-items: center; font-size: 22px; font-weight: bold; line-height: 1.5; color: $devui-text; img { margin: 8px 8px 8px 20px; } } .left-nav { display: flex; align-items: center; button { display: none; } } .release { margin-right: 12px; color: $devui-icon-fill; cursor: pointer; display: flex; align-items: center; height: 32px; .version { line-height: 32px; } &:hover { color: $devui-text; transition: color $devui-animation-duration-base $devui-animation-ease-in-out-smooth; } } .theme { display: flex; margin: 0 16px; .opt { padding: 5px; cursor: pointer; transition: 0.5s; border-radius: 25%; &:hover { transform: scale(1.1); background-color: $devui-glass-morphism-bg; } } } } .intro-header { background-color: rgba(255, 255, 255, 0); backdrop-filter: blur(4px); &.scroll { transition: background-color 1s; background-color: rgba(255, 255, 255, 0.5); } &.active { background-color: $devui-base-bg; } } .right-nav { display: flex; align-items: center; .nav-drop-btn { display: none; } .nav-list { gap: 12px; display: flex; margin-right: 12px; .nav-op { &:hover { color: $devui-text; background: $devui-icon-bg; transition: all var(--devui-animation-duration-base, 0.2s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(0.645, 0.045, 0.355, 1)); box-shadow: var(--devui-shadow-length-base, 0 2px 6px 0) var(--devui-light-shadow, rgba(37, 43, 58, 0.12)); border-radius: $devui-border-radius-card; } color: $devui-aide-text; display: flex; align-items: center; padding-right: 8px; img { width: 16px; height: 16px; } } & > a { text-decoration: none; } .nav-active { color: $devui-text; background: $devui-icon-bg; box-shadow: var(--devui-shadow-length-base, 0 2px 6px 0) var(--devui-light-shadow, rgba(37, 43, 58, 0.12)); border-radius: $devui-border-radius-card; } } .header-menu-splitter { height: 24px; border-left: 1px solid $devui-line; } .gitcode-address { margin: 0 20px 0 8px; } } .nav-drop-menu { display: flex; background-color: $devui-base-bg; width: 100vw; justify-content: center; ul { padding: 12px; } li, a { height: 40px; padding: 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; span { color: $devui-text; } } img { width: 16px; height: 16px; } .theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; } } .list-menu { padding: 0; margin: 0 0 3px 0; } .menu-item { padding: 5px 0 2px 8px; display: flex; justify-content: center; align-items: center; } @media (max-width: 768px) { .header img { margin: 8px; } .header { .left-nav { button { display: block; margin-right: -8px; } } .right-nav { .nav-drop-btn { margin-right: 10px; display: block; } .nav-list, .theme, .release, .header-menu-splitter, .gitcode-address { display: none; } } } } @media (max-width: 320px) { .nav-drop-menu { width: 320px; } } </style> <style lang="scss"> @import 'devui-theme/styles-var/devui-var.scss'; .header-right-nav-dropdown { left: 0 !important; background: $devui-base-bg; display: flex; justify-self: center; box-shadow: 0 2px 0 0 $devui-shadow !important; } .intro-header-right-nav-dropdown { left: 0 !important; background: rgba(255, 255, 255, 0) !important; display: flex; justify-self: center; box-shadow: none !important; } </style>
2301_80257615/MateChat
docs/theme-default/components/common/Header.vue
Vue
mit
11,509
export enum ThemeKey { Galaxy = 'Galaxy', Infinity = 'Infinity', } export enum LocaleKey { zh = 'zh', en = 'en', }
2301_80257615/MateChat
docs/theme-default/components/datas/type.ts
TypeScript
mit
131
<template> <svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <path d="M3.64644661,5.64644661 C3.82001296,5.47288026 4.08943736,5.45359511 4.2843055,5.58859116 L4.35355339,5.64644661 L8,9.293 L11.6464466,5.64644661 C11.820013,5.47288026 12.0894374,5.45359511 12.2843055,5.58859116 L12.3535534,5.64644661 C12.5271197,5.82001296 12.5464049,6.08943736 12.4114088,6.2843055 L12.3535534,6.35355339 L8.35355339,10.3535534 C8.17998704,10.5271197 7.91056264,10.5464049 7.7156945,10.4114088 L7.64644661,10.3535534 L3.64644661,6.35355339 C3.45118446,6.15829124 3.45118446,5.84170876 3.64644661,5.64644661 Z" ></path> </g> </svg> </template>
2301_80257615/MateChat
docs/theme-default/components/icons/CollapseArrow.vue
Vue
mit
851
import { useMediaQuery } from '@vueuse/core'; import { computed } from 'vue'; import { useSidebar } from './sidebar'; export function useAside() { const { hasSidebar } = useSidebar(); const is960 = useMediaQuery('(min-width: 960px)'); const is1280 = useMediaQuery('(min-width: 1280px)'); const isAsideEnabled = computed(() => { if (!is1280.value && !is960.value) { return false; } return hasSidebar.value ? is1280.value : is960.value; }); return { isAsideEnabled }; }
2301_80257615/MateChat
docs/theme-default/composables/aside.js
JavaScript
mit
540
import { useData as useData$ } from 'vitepress'; export const useData = useData$;
2301_80257615/MateChat
docs/theme-default/composables/data.js
JavaScript
mit
82
import { computed } from 'vue'; import { useData } from './data'; export function useEditLink() { const { theme, page } = useData(); return computed(() => { const { text = 'Edit this page', pattern = '' } = theme.value.editLink || {}; let url; if (typeof pattern === 'function') { url = pattern(page.value); } else { url = pattern.replace(/:path/g, page.value.filePath); } return { url, text }; }); }
2301_80257615/MateChat
docs/theme-default/composables/edit-link.js
JavaScript
mit
493
import { ref, watch, readonly, onUnmounted } from 'vue'; import { inBrowser } from '../../shared'; export const focusedElement = ref(); let active = false; let listeners = 0; export function useFlyout(options) { const focus = ref(false); if (inBrowser) { !active && activateFocusTracking(); listeners++; const unwatch = watch(focusedElement, (el) => { if (el === options.el.value || options.el.value?.contains(el)) { focus.value = true; options.onFocus?.(); } else { focus.value = false; options.onBlur?.(); } }); onUnmounted(() => { unwatch(); listeners--; if (!listeners) { deactivateFocusTracking(); } }); } return readonly(focus); } function activateFocusTracking() { document.addEventListener('focusin', handleFocusIn); active = true; focusedElement.value = document.activeElement; } function deactivateFocusTracking() { document.removeEventListener('focusin', handleFocusIn); } function handleFocusIn() { focusedElement.value = document.activeElement; }
2301_80257615/MateChat
docs/theme-default/composables/flyout.js
JavaScript
mit
1,220
import { computed } from 'vue'; import { ensureStartingSlash } from '../support/utils'; import { useData } from './data'; export function useLangs({ correspondingLink = false } = {}) { const { site, localeIndex, page, theme, hash } = useData(); const currentLang = computed(() => ({ label: site.value.locales[localeIndex.value]?.label, link: site.value.locales[localeIndex.value]?.link || (localeIndex.value === 'root' ? '/' : `/${localeIndex.value}/`) })); const localeLinks = computed(() => Object.entries(site.value.locales).flatMap(([key, value]) => currentLang.value.label === value.label ? [] : { text: value.label, link: normalizeLink(value.link || (key === 'root' ? '/' : `/${key}/`), theme.value.i18nRouting !== false && correspondingLink, page.value.relativePath.slice(currentLang.value.link.length - 1), !site.value.cleanUrls) + hash.value })); return { localeLinks, currentLang }; } function normalizeLink(link, addPath, path, addExt) { return addPath ? link.replace(/\/$/, '') + ensureStartingSlash(path .replace(/(^|\/)index\.md$/, '$1') .replace(/\.md$/, addExt ? '.html' : '')) : link; }
2301_80257615/MateChat
docs/theme-default/composables/langs.js
JavaScript
mit
1,264