chore(组件): components-diy 必须使用easyncom系统,不然在微信上无法渲染

This commit is contained in:
2026-01-05 09:29:19 +08:00
parent 311efe1ecd
commit b24f77be1a
49 changed files with 1462 additions and 1547 deletions

View File

@@ -111,9 +111,8 @@ export default {
} }
}, },
onShow() { async onShow() {
await this.init();
this.init();
}, },
onHide() { onHide() {
if (this.storeTimeOut) { if (this.storeTimeOut) {

View File

@@ -35,7 +35,7 @@ export const adaptSubpackageUrl = (url) => {
'/pages/goods/': '/pages_goods/', '/pages/goods/': '/pages_goods/',
'/pages/contact/': '/pages_tool/contact/', '/pages/contact/': '/pages_tool/contact/',
'/pages/member/': '/pages_tool/member/', '/pages/member/': '/pages_tool/member/',
'/pages/vr': '/pages_tool/vr/' '/pages/vr': '/pages_tool/vr/',
}; };
// 构建正则表达式 // 构建正则表达式
@@ -58,7 +58,20 @@ export const adaptSubpackageUrl = (url) => {
}); });
} }
return replacePrefix(url); const currentUrl = replacePrefix(url);
// 分包子包导致的路径变化,需要根据前后关系修复
const subPackagesMap = {
'/pages_tool/member/index': '/pages_tool/member/basic/index',
}
// 修复url
if (subPackagesMap[currentUrl]) {
return subPackagesMap[currentUrl];
}
return currentUrl;
} }
/** /**

View File

@@ -47,6 +47,9 @@ export default {
type: Object type: Object
} }
}, },
components: {
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
},
mixins: [DiyMinx], mixins: [DiyMinx],
data() { data() {
return { return {

View File

@@ -293,6 +293,9 @@ export default {
default: false default: false
} }
}, },
components: {
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},
mixins: [DiyMinx], mixins: [DiyMinx],
data() { data() {
return { return {

View File

@@ -166,7 +166,7 @@ var contentWrapHeight, query, cartPosition;
// 商品分类 // 商品分类
export default { export default {
components: { components: {
nsGoodsSkuCategory: () => import('@/components/ns-goods-sku/ns-goods-sku-category.vue'), nsGoodsSkuCategory: () => import('@/components/ns-goods-sku/ns-goods-sku-category.vue'),
}, },
name: 'diy-category', name: 'diy-category',

View File

@@ -258,7 +258,7 @@ import DiyMinx from './minx.js'
// 自定义商品列表展示 // 自定义商品列表展示
export default { export default {
name: 'diy-goods-list', name: 'diy-goods-list',
components: { components: {
nsGoodsSkuIndex: () => import('@/components/ns-goods-sku/ns-goods-sku-index.vue'), nsGoodsSkuIndex: () => import('@/components/ns-goods-sku/ns-goods-sku-index.vue'),
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'), XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
}, },

View File

@@ -103,7 +103,7 @@ export default {
type: Object type: Object
} }
}, },
components: { components: {
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'), XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
}, },

View File

@@ -251,6 +251,11 @@
<diy-icon :value="item"></diy-icon> <diy-icon :value="item"></diy-icon>
</template> </template>
<template v-if="item.componentName == 'Group'">
<!-- 组件组 -->
<diy-group :diyData="item"></diy-group>
</template>
<!-- 自定义扩展组件 --> <!-- 自定义扩展组件 -->
<diy-comp-extend :value="item"></diy-comp-extend> <diy-comp-extend :value="item"></diy-comp-extend>
</view> </view>
@@ -261,20 +266,24 @@
// 组件组展示 // 组件组展示
import DiyMinx from './minx.js' import DiyMinx from './minx.js'
export default { export default {
components: {}, name: 'DiyGroup',
mixins: [DiyMinx],
props: { props: {
diyData: { diyData: {
type: Object type: Object,
default: () => ({})
}, },
scrollTop: { scrollTop: {
type: [String, Number], type: [String, Number],
default: '0' default: '0'
}, },
haveTopCategory: { haveTopCategory: {
type: Boolean type: Boolean,
default: false
}, },
followOfficialAccount: { followOfficialAccount: {
type: Object type: Object,
default: () => ({})
}, },
}, },
mixins: [DiyMinx], mixins: [DiyMinx],
@@ -284,25 +293,28 @@ export default {
}; };
}, },
created() { created() {
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData)); this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData || {}));
}, },
computed: { computed: {
topNavColor() { topNavColor() {
var color = ''; var color = '';
if (this.diyData.global.topNavBg) { if (this.diyData.global && this.diyData.global.topNavBg) {
color = 'transparent'; color = 'transparent';
if (this.scrollTop > 20) { if (this.scrollTop > 20 && this.diyData.global.topNavColor) {
color = this.diyData.global.topNavColor; color = this.diyData.global.topNavColor;
} else { } else {
color = 'transparent'; color = 'transparent';
} }
} else { } else if (this.diyData.global && this.diyData.global.topNavColor) {
color = this.diyData.global.topNavColor; color = this.diyData.global.topNavColor;
} }
return color; return color;
}, },
// 修改属性样式 // 修改属性样式
setPagestyle() { setPagestyle() {
if (!this.diyGlobalData || !this.diyGlobalData.value || !Array.isArray(this.diyGlobalData.value)) {
return [];
}
this.diyGlobalData.value.forEach((item, index) => { this.diyGlobalData.value.forEach((item, index) => {
item.pageStyle = ''; item.pageStyle = '';
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位 // 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
@@ -314,12 +326,12 @@ export default {
return false; return false;
} }
item.pageStyle += 'background-color:' + item.pageBgColor + ';'; item.pageStyle += 'background-color:' + (item.pageBgColor || '') + ';';
if (item.margin) { if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';'; item.pageStyle += 'padding-top:' + (item.margin.top || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';'; item.pageStyle += 'padding-bottom:' + (item.margin.bottom || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';'; item.pageStyle += 'padding-right:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';'; item.pageStyle += 'padding-left:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
} }
}); });
@@ -327,20 +339,35 @@ export default {
}, },
// 过滤组件的渲染 // 过滤组件的渲染
diyDataArray() { diyDataArray() {
let data = [], let data = [];
showModuleData = this.$store.state.diyGroupShowModule ? JSON.parse(this.$store.state let showModuleData = [];
.diyGroupShowModule) : '';
// 安全获取store中的模块显示数据
try {
if (this.$store && this.$store.state && this.$store.state.diyGroupShowModule) {
showModuleData = JSON.parse(this.$store.state.diyGroupShowModule);
// 确保showModuleData是数组
if (!Array.isArray(showModuleData)) {
showModuleData = [];
}
}
} catch (e) {
showModuleData = [];
}
const diyDataArr = this.setPagestyle;
if (showModuleData.length) { if (showModuleData.length) {
if (showModuleData.includes('null')) return []; if (showModuleData.includes('null')) return [];
let diyDataArr = this.setPagestyle;
diyDataArr.forEach((item, index) => { diyDataArr.forEach((item, index) => {
if (showModuleData.includes(item.componentName)) { if (item && item.componentName && showModuleData.includes(item.componentName)) {
data.push(item); data.push(item);
} }
}); });
} else data = this.setPagestyle; } else {
data = diyDataArr;
}
return data; return data;
} }
}, },

View File

@@ -51,7 +51,7 @@
// 文章 // 文章
import DiyMinx from './minx.js' import DiyMinx from './minx.js'
export default { export default {
name: 'diy-article', name: 'diy-merch-list',
props: { props: {
value: { value: {
type: Object type: Object

View File

@@ -86,9 +86,9 @@
}, },
components: { components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsChatGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-goods.vue'), nsChatGoods: () => import('@/components/ns-chat/ns-chat-goods.vue'),
nsChatOrder: () => import('@/pages_tool/components/ns-chat/ns-chat-order.vue'), nsChatOrder: () => import('@/components/ns-chat/ns-chat-order.vue'),
nsChatReceiveGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-receiveGoods.vue'), nsChatReceiveGoods: () => import('@/components/ns-chat/ns-chat-receiveGoods.vue')
}, },
data() { data() {
return { return {

View File

@@ -1,149 +1,149 @@
<template> <template>
<view class="message"> <view class="message">
<view class="goods-item" v-if="orderdetails"> <view class="goods-item" v-if="orderdetails">
<image :src="$util.img(orderdetails.order_goods ? orderdetails.order_goods[0].sku_image : '')" mode="aspectFill"></image> <image :src="$util.img(orderdetails.order_goods ? orderdetails.order_goods[0].sku_image : '')" mode="aspectFill"></image>
<view class="goods-info"> <view class="goods-info">
<view class="goods-name">{{ orderdetails.order_goods ? orderdetails.order_goods[0].sku_name : '' }}</view> <view class="goods-name">{{ orderdetails.order_goods ? orderdetails.order_goods[0].sku_name : '' }}</view>
<view class="font-size-goods-tag">订单状态:{{ orderdetails.order_status_name }}</view> <view class="font-size-goods-tag">订单状态:{{ orderdetails.order_status_name }}</view>
<view class="font-size-goods-tag">配送方式:{{ orderdetails.delivery_type_name }}</view> <view class="font-size-goods-tag">配送方式:{{ orderdetails.delivery_type_name }}</view>
<view class="goods-bottom"> <view class="goods-bottom">
<view class="goods-price color-base-text"> <view class="goods-price color-base-text">
<text class="goods-price-sign"></text> <text class="goods-price-sign"></text>
<text>{{ orderdetails.order_goods ? orderdetails.order_goods[0].price : '' }}</text> <text>{{ orderdetails.order_goods ? orderdetails.order_goods[0].price : '' }}</text>
</view> </view>
<view class="goods-option font-size-goods-tag color-base-bg" @click="sendMsg('order')">发送</view> <view class="goods-option font-size-goods-tag color-base-bg" @click="sendMsg('order')">发送</view>
</view> </view>
</view> </view>
</view> </view>
<view class="goods-item" v-else-if="orderInfo"> <view class="goods-item" v-else-if="orderInfo">
<image :src="$util.img(orderInfo.order_goods ? orderInfo.order_goods[0].sku_image : '')" mode="aspectFill"></image> <image :src="$util.img(orderInfo.order_goods ? orderInfo.order_goods[0].sku_image : '')" mode="aspectFill"></image>
<view class="goods-info"> <view class="goods-info">
<view class="goods-name">{{ orderInfo.order_goods ? orderInfo.order_goods[0].sku_name : '' }}</view> <view class="goods-name">{{ orderInfo.order_goods ? orderInfo.order_goods[0].sku_name : '' }}</view>
<view class="font-size-goods-tag">订单状态:{{ orderInfo.order_status_name }}</view> <view class="font-size-goods-tag">订单状态:{{ orderInfo.order_status_name }}</view>
<view class="font-size-goods-tag">配送方式:{{ orderInfo.delivery_type_name }}</view> <view class="font-size-goods-tag">配送方式:{{ orderInfo.delivery_type_name }}</view>
<view class="goods-bottom"> <view class="goods-bottom">
<view class="goods-price color-base-text"> <view class="goods-price color-base-text">
<text class="goods-price-sign"></text> <text class="goods-price-sign"></text>
<text>{{ orderInfo.order_goods ? orderInfo.order_goods[0].price : '' }}</text> <text>{{ orderInfo.order_goods ? orderInfo.order_goods[0].price : '' }}</text>
</view> </view>
<view class="goods-option font-size-goods-tag disabled">已发送</view> <view class="goods-option font-size-goods-tag disabled">已发送</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'ns-chat-order', name: 'ns-chat-order',
props: { props: {
orderId: { orderId: {
type: [Number, String] type: [Number, String]
}, },
isCanSend: Boolean, isCanSend: Boolean,
orderdetails: { orderdetails: {
type: [Object] type: [Object]
} }
}, },
data() { data() {
return { return {
orderInfo: {} orderInfo: {}
}; };
}, },
mounted() { mounted() {
this.getGoodsInfo(); this.getGoodsInfo();
}, },
methods: { methods: {
getGoodsInfo() { getGoodsInfo() {
if (this.orderId) { if (this.orderId) {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/order/detail', url: '/api/order/detail',
data: { data: {
order_id: this.orderId order_id: this.orderId
}, },
success: res => { success: res => {
if (res.code >= 0) { if (res.code >= 0) {
this.orderInfo = res.data; this.orderInfo = res.data;
} }
} }
}); });
} }
}, },
sendMsg() { sendMsg() {
this.$emit('sendMsg', 'order'); this.$emit('sendMsg', 'order');
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.message { .message {
padding: 13rpx 20rpx; padding: 13rpx 20rpx;
box-sizing: border-box; box-sizing: border-box;
width: 100vw; width: 100vw;
position: relative; position: relative;
.goods-item { .goods-item {
width: 100%; width: 100%;
height: 220rpx; height: 220rpx;
background: #ffffff; background: #ffffff;
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 20rpx; border-radius: 20rpx;
margin: 0 auto; margin: 0 auto;
padding: $padding; padding: $padding;
box-sizing: border-box; box-sizing: border-box;
image { image {
width: 180rpx; width: 180rpx;
height: 180rpx; height: 180rpx;
} }
.goods-info { .goods-info {
width: 100%; width: 100%;
height: 180rpx; height: 180rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
padding-left: 20rpx; padding-left: 20rpx;
box-sizing: border-box; box-sizing: border-box;
.goods-name { .goods-name {
width: 100%; width: 100%;
line-height: 1.4; line-height: 1.4;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
overflow: hidden; overflow: hidden;
// font-size: $font-size-tag; // font-size: $font-size-tag;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.goods-bottom { .goods-bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
text { text {
line-height: 1; line-height: 1;
} }
.goods-price { .goods-price {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
padding-bottom: 10rpx; padding-bottom: 10rpx;
font-weight: 500; font-weight: 500;
.goods-price-sign { .goods-price-sign {
font-size: 20rpx; font-size: 20rpx;
} }
} }
.goods-option { .goods-option {
width: 150rpx; width: 150rpx;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
text-align: center; text-align: center;
border-radius: $border-radius; border-radius: $border-radius;
color: #ffffff; color: #ffffff;
} }
} }
} }
.disabled { .disabled {
background: #e5e5e5; background: #e5e5e5;
} }
} }
} }
</style> </style>

View File

@@ -1,142 +1,142 @@
<template> <template>
<view class="copyrigt-wrap" v-if="copyright && (showLogo || showBeian)"> <view class="copyrigt-wrap" v-if="copyright && (showLogo || showBeian)">
<!-- <view class="copyright-info" v-if="showLogo"> <!-- <view class="copyright-info" v-if="showLogo">
<view class="copyright-pic" v-if="copyright.logo" @click="link(copyright.copyright_link)"> <view class="copyright-pic" v-if="copyright.logo" @click="link(copyright.copyright_link)">
<image :src="$util.img(copyright.logo)" @error="error" mode="widthFix"></image> <image :src="$util.img(copyright.logo)" @error="error" mode="widthFix"></image>
</view> </view>
</view> </view>
<view class="record-info" v-if="showBeian"> <view class="record-info" v-if="showBeian">
<view class="icp" v-if="copyright && copyright.icp" @click="toHref('https://beian.miit.gov.cn')">备案号{{ copyright.icp }} <view class="icp" v-if="copyright && copyright.icp" @click="toHref('https://beian.miit.gov.cn')">备案号{{ copyright.icp }}
</view> </view>
<view v-if="copyright && copyright.gov_record" class="gov-wrap" @click="toHref(copyright.gov_url)" target="_blank"> <view v-if="copyright && copyright.gov_record" class="gov-wrap" @click="toHref(copyright.gov_url)" target="_blank">
<image :src="$util.img('public/uniapp/common/gov_record.png')" alt="公安备案" /> <image :src="$util.img('public/uniapp/common/gov_record.png')" alt="公安备案" />
<text>{{ copyright.gov_record }}</text> <text>{{ copyright.gov_record }}</text>
</view> </view>
</view> --> </view> -->
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
showLogo: true, showLogo: true,
}; };
}, },
created() {}, created() {},
computed: { computed: {
showBeian() { showBeian() {
// 如果都为空,则隐藏 // 如果都为空,则隐藏
if (this.copyright && (!this.copyright.icp && !this.copyright.gov_record)) { if (this.copyright && (!this.copyright.icp && !this.copyright.gov_record)) {
return false; return false;
} }
return true; return true;
} }
}, },
methods: { methods: {
link(url) { link(url) {
if (url) { if (url) {
this.$util.redirectTo('/pages_tool/webview/webview', { this.$util.redirectTo('/pages_tool/webview/webview', {
src: encodeURIComponent(url) src: encodeURIComponent(url)
}); });
} }
}, },
toHref(url) { toHref(url) {
location.href = url; location.href = url;
}, },
error() { error() {
this.showLogo = false; this.showLogo = false;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.copyrigt-wrap { .copyrigt-wrap {
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
>view { >view {
font-size: $font-size-tag; font-size: $font-size-tag;
color: #666666; color: #666666;
&:last-child { &:last-child {
margin-top: 10rpx; margin-top: 10rpx;
} }
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
} }
.copyright-info { .copyright-info {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
.copyright-pic { .copyright-pic {
image { image {
width: 160rpx; width: 160rpx;
height: 24rpx; height: 24rpx;
} }
} }
text { text {
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
height: 100rpx; height: 100rpx;
line-height: 100rpx; line-height: 100rpx;
color: $color-tip !important; color: $color-tip !important;
} }
.copyright-desc { .copyright-desc {
color: lighten($color-tip, 30%); color: lighten($color-tip, 30%);
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
text-shadow: 0 0 2rpx lighten($color-tip, 40%); text-shadow: 0 0 2rpx lighten($color-tip, 40%);
} }
} }
.record-info { .record-info {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
margin-top: 10rpx; margin-top: 10rpx;
text { text {
color: #666666; color: #666666;
font-size: $font-size-tag; font-size: $font-size-tag;
} }
view { view {
font-size: $font-size-tag; font-size: $font-size-tag;
color: #666666; color: #666666;
&:last-child { &:last-child {
margin-top: 10rpx; margin-top: 10rpx;
} }
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
} }
.gov-wrap { .gov-wrap {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
image { image {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
} }
} }
} }
</style> </style>

View File

@@ -1,37 +1,37 @@
<template> <template>
<view class="progress"><view class="progress-bar " ref="progress" :style="{ width: progress + '%' }"></view></view> <view class="progress"><view class="progress-bar " ref="progress" :style="{ width: progress + '%' }"></view></view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return {}; return {};
}, },
props: { props: {
progress: { progress: {
type: [Number, String], type: [Number, String],
default: 10 default: 10
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.progress { .progress {
height: 12rpx; height: 12rpx;
overflow: hidden; overflow: hidden;
background-color: #ccc; background-color: #ccc;
border-radius: 8rpx; border-radius: 8rpx;
} }
.progress-bar { .progress-bar {
float: left; float: left;
height: 100%; height: 100%;
font-size: $font-size-tag; font-size: $font-size-tag;
line-height: 40rpx; line-height: 40rpx;
color: #fff; color: #fff;
text-align: center; text-align: center;
transition: width 0.6s ease; transition: width 0.6s ease;
background-color: #fff; background-color: #fff;
} }
</style> </style>

View File

@@ -1,6 +1,6 @@
export function getClientRect(selector, component) { export function getClientRect(selector, component) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let query = component ? uni.createSelectorQuery().in(component) : uni.createSelectorQuery(); let query = component ? uni.createSelectorQuery().in(component) : uni.createSelectorQuery();
return query.select(selector).boundingClientRect(resolve).exec() return query.select(selector).boundingClientRect(resolve).exec()
}) })
} }

View File

@@ -1,21 +1,21 @@
@font-face {font-family: "iconfont"; @font-face {font-family: "iconfont";
src: url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482'); /* IE9 */ src: url('~@/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482'); /* IE9 */
src: url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482#iefix') format('embedded-opentype'), /* IE6-IE8 */ src: url('~@/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAK8AAsAAAAABnAAAAJwAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAp8gQgBNgIkAwgLBgAEIAWEbQcuG6wFyA4lTcHACOEZBUg8fL/2O3f3fTHEkoh28SSayCSxkkgQG6Uz3UvYITu9Qr5K0Vh6Ij6f+8CXKzVBHDvWa6d0lSfK57mc3gQ6kGt8oBz3ojUG9QLqxYEU6B4YRVYqecPYBS7hMYG6QWF0dlOycoGxxFoViFuxkALGuYAksXRVKNccTOJdSTV7zbSAt/D78Y8XxmRKOavq5CZZAOK+7u2svLVode0TggR0vIQc84BEXNQmjugJxumpJ/SNAvsqD77ui8K3i71aBPvrrNIm6IfSe5K58ltNZ3BbU40Blkf9OmKsIW/Un1qddc4dcSma3ArIX7PPXdlxK5l2zJ+aD6TXnQqmu330wqpeWkYN/OnNm/0trU+YvqNR4UN99f+x/tApIFTfR7u39X4gKPnb9pOX5RAQB6DYyc/zOKCD4OUp6KiiPeqnapbAp56NdegrdhLo5wKq+3UG/0fWcyDpCsuWJVVWO5oZO29bXR0FwJ4uV2ONvTeTCVW9I1wVAylyVeNkYudR0rCOsqoN1M1JPd7QDdMTqYZZXQChwwYybT6Q63BIJvYSJX1eUNYReqi7CrsLGyZDbJqIEUWQAPLroJhWKhjHQUyj8mwkrJJROKsI+XyENeIw5LI4xXQqUiA8xxZNtZBHCAMZrJTDFPAcksmUUIWVEkQTlogQVQSbzdS9iUUr5cDUDgyhEIgAxFcHEqMpKTD+eMK09PlsiFAVGQpu6atJ5kMwDfHsEBcLpweZqlX06ruXVzSqCfEQBANiYEpyUAqYh8jIKEGq+nkSCI1gEY2IqURg28OYvlrW+nr5152AOsuUhV2fSy+EwgAAAA==') format('woff2'), url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAK8AAsAAAAABnAAAAJwAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAp8gQgBNgIkAwgLBgAEIAWEbQcuG6wFyA4lTcHACOEZBUg8fL/2O3f3fTHEkoh28SSayCSxkkgQG6Uz3UvYITu9Qr5K0Vh6Ij6f+8CXKzVBHDvWa6d0lSfK57mc3gQ6kGt8oBz3ojUG9QLqxYEU6B4YRVYqecPYBS7hMYG6QWF0dlOycoGxxFoViFuxkALGuYAksXRVKNccTOJdSTV7zbSAt/D78Y8XxmRKOavq5CZZAOK+7u2svLVode0TggR0vIQc84BEXNQmjugJxumpJ/SNAvsqD77ui8K3i71aBPvrrNIm6IfSe5K58ltNZ3BbU40Blkf9OmKsIW/Un1qddc4dcSma3ArIX7PPXdlxK5l2zJ+aD6TXnQqmu330wqpeWkYN/OnNm/0trU+YvqNR4UN99f+x/tApIFTfR7u39X4gKPnb9pOX5RAQB6DYyc/zOKCD4OUp6KiiPeqnapbAp56NdegrdhLo5wKq+3UG/0fWcyDpCsuWJVVWO5oZO29bXR0FwJ4uV2ONvTeTCVW9I1wVAylyVeNkYudR0rCOsqoN1M1JPd7QDdMTqYZZXQChwwYybT6Q63BIJvYSJX1eUNYReqi7CrsLGyZDbJqIEUWQAPLroJhWKhjHQUyj8mwkrJJROKsI+XyENeIw5LI4xXQqUiA8xxZNtZBHCAMZrJTDFPAcksmUUIWVEkQTlogQVQSbzdS9iUUr5cDUDgyhEIgAxFcHEqMpKTD+eMK09PlsiFAVGQpu6atJ5kMwDfHsEBcLpweZqlX06ruXVzSqCfEQBANiYEpyUAqYh8jIKEGq+nkSCI1gEY2IqURg28OYvlrW+nr5152AOsuUhV2fSy+EwgAAAA==') format('woff2'),
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.woff?t=1574760464482') format('woff'), url('~@/components/sx-rate/sx-rate/iconfont.woff?t=1574760464482') format('woff'),
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.ttf?t=1574760464482') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ url('~@/components/sx-rate/sx-rate/iconfont.ttf?t=1574760464482') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.svg?t=1574760464482#iconfont') format('svg'); /* iOS 4.1- */ url('~@/components/sx-rate/sx-rate/iconfont.svg?t=1574760464482#iconfont') format('svg'); /* iOS 4.1- */
} }
.iconfont { .iconfont {
font-family: "iconfont" !important; font-family: "iconfont" !important;
font-size: inherit; font-size: inherit;
font-style: normal; font-style: normal;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-star:before { .icon-star:before {
content: "\e6e3"; content: "\e6e3";
} }

View File

@@ -1,29 +1,29 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!-- <!--
2013-9-30: Created. 2013-9-30: Created.
--> -->
<svg> <svg>
<metadata> <metadata>
Created by iconfont Created by iconfont
</metadata> </metadata>
<defs> <defs>
<font id="iconfont" horiz-adv-x="1024" > <font id="iconfont" horiz-adv-x="1024" >
<font-face <font-face
font-family="iconfont" font-family="iconfont"
font-weight="500" font-weight="500"
font-stretch="normal" font-stretch="normal"
units-per-em="1024" units-per-em="1024"
ascent="896" ascent="896"
descent="-128" descent="-128"
/> />
<missing-glyph /> <missing-glyph />
<glyph glyph-name="star" unicode="&#59107;" d="M544.256 812.032l117.248-237.568c5.12-10.752 15.36-17.92 27.136-19.456l262.144-37.888c29.696-4.096 41.472-40.448 19.968-61.44l-189.44-184.832c-8.704-8.192-12.288-19.968-10.24-31.744l44.544-261.12c5.12-29.184-25.6-51.712-52.224-37.888l-234.496 123.392c-10.24 5.632-23.04 5.632-33.28 0L261.12-59.904c-26.112-13.824-57.344 8.704-52.224 37.888l44.544 261.12c2.048 11.776-2.048 23.552-10.24 31.744L53.76 455.68C32.256 476.16 44.032 512.512 73.728 517.12l262.144 37.888c11.776 1.536 22.016 9.216 27.136 19.456l117.248 237.568C493.056 838.656 530.944 838.656 544.256 812.032z" horiz-adv-x="1024" /> <glyph glyph-name="star" unicode="&#59107;" d="M544.256 812.032l117.248-237.568c5.12-10.752 15.36-17.92 27.136-19.456l262.144-37.888c29.696-4.096 41.472-40.448 19.968-61.44l-189.44-184.832c-8.704-8.192-12.288-19.968-10.24-31.744l44.544-261.12c5.12-29.184-25.6-51.712-52.224-37.888l-234.496 123.392c-10.24 5.632-23.04 5.632-33.28 0L261.12-59.904c-26.112-13.824-57.344 8.704-52.224 37.888l44.544 261.12c2.048 11.776-2.048 23.552-10.24 31.744L53.76 455.68C32.256 476.16 44.032 512.512 73.728 517.12l262.144 37.888c11.776 1.536 22.016 9.216 27.136 19.456l117.248 237.568C493.056 838.656 530.944 838.656 544.256 812.032z" horiz-adv-x="1024" />
</font> </font>
</defs></svg> </defs></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,354 +1,354 @@
import CALENDAR from './calendar.js' import CALENDAR from './calendar.js'
class Calendar { class Calendar {
constructor({ constructor({
date, date,
selected, selected,
startDate, startDate,
endDate, endDate,
range range
} = {}) { } = {}) {
// 当前日期 // 当前日期
this.date = this.getDate(new Date()) // 当前初入日期 this.date = this.getDate(new Date()) // 当前初入日期
// 打点信息 // 打点信息
this.selected = selected || []; this.selected = selected || [];
// 范围开始 // 范围开始
this.startDate = startDate this.startDate = startDate
// 范围结束 // 范围结束
this.endDate = endDate this.endDate = endDate
this.range = range this.range = range
// 多选状态 // 多选状态
this.cleanMultipleStatus() this.cleanMultipleStatus()
// 每周日期 // 每周日期
this.weeks = {} this.weeks = {}
// this._getWeek(this.date.fullDate) // this._getWeek(this.date.fullDate)
} }
/** /**
* 设置日期 * 设置日期
* @param {Object} date * @param {Object} date
*/ */
setDate(date) { setDate(date) {
this.selectDate = this.getDate(date) this.selectDate = this.getDate(date)
this._getWeek(this.selectDate.fullDate) this._getWeek(this.selectDate.fullDate)
} }
/** /**
* 清理多选状态 * 清理多选状态
*/ */
cleanMultipleStatus() { cleanMultipleStatus() {
this.multipleStatus = { this.multipleStatus = {
before: '', before: '',
after: '', after: '',
data: [] data: []
} }
} }
/** /**
* 重置开始日期 * 重置开始日期
*/ */
resetSatrtDate(startDate) { resetSatrtDate(startDate) {
// 范围开始 // 范围开始
this.startDate = startDate this.startDate = startDate
} }
/** /**
* 重置结束日期 * 重置结束日期
*/ */
resetEndDate(endDate) { resetEndDate(endDate) {
// 范围结束 // 范围结束
this.endDate = endDate this.endDate = endDate
} }
/** /**
* 获取任意时间 * 获取任意时间
*/ */
getDate(date, AddDayCount = 0, str = 'day') { getDate(date, AddDayCount = 0, str = 'day') {
if (!date) { if (!date) {
date = new Date() date = new Date()
} }
if (typeof date !== 'object') { if (typeof date !== 'object') {
date = date.replace(/-/g, '/') date = date.replace(/-/g, '/')
} }
const dd = new Date(date) const dd = new Date(date)
switch (str) { switch (str) {
case 'day': case 'day':
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
break break
case 'month': case 'month':
if (dd.getDate() === 31) { if (dd.getDate() === 31) {
dd.setDate(dd.getDate() + AddDayCount) dd.setDate(dd.getDate() + AddDayCount)
} else { } else {
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期 dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
} }
break break
case 'year': case 'year':
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
break break
} }
const y = dd.getFullYear() const y = dd.getFullYear()
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期不足10补0 const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期不足10补0
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号不足10补0 const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号不足10补0
return { return {
fullDate: y + '-' + m + '-' + d, fullDate: y + '-' + m + '-' + d,
year: y, year: y,
month: m, month: m,
date: d, date: d,
day: dd.getDay() day: dd.getDay()
} }
} }
/** /**
* 获取上月剩余天数 * 获取上月剩余天数
*/ */
_getLastMonthDays(firstDay, full) { _getLastMonthDays(firstDay, full) {
let dateArr = [] let dateArr = []
for (let i = firstDay; i > 0; i--) { for (let i = firstDay; i > 0; i--) {
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate()
dateArr.push({ dateArr.push({
date: beforeDate, date: beforeDate,
month: full.month - 1, month: full.month - 1,
lunar: this.getlunar(full.year, full.month - 1, beforeDate), lunar: this.getlunar(full.year, full.month - 1, beforeDate),
disable: true disable: true
}) })
} }
return dateArr return dateArr
} }
/** /**
* 获取本月天数 * 获取本月天数
*/ */
_currentMonthDys(dateData, full) { _currentMonthDys(dateData, full) {
let dateArr = [] let dateArr = []
let fullDate = this.date.fullDate let fullDate = this.date.fullDate
for (let i = 1; i <= dateData; i++) { for (let i = 1; i <= dateData; i++) {
let isinfo = false let isinfo = false
let nowDate = full.year + '-' + (full.month < 10 ? let nowDate = full.year + '-' + (full.month < 10 ?
full.month : full.month) + '-' + (i < 10 ? full.month : full.month) + '-' + (i < 10 ?
'0' + i : i) '0' + i : i)
// 是否今天 // 是否今天
let isDay = fullDate === nowDate let isDay = fullDate === nowDate
// 获取打点信息 // 获取打点信息
let info = this.selected && this.selected.find((item) => { let info = this.selected && this.selected.find((item) => {
if (this.dateEqual(nowDate, item.date)) { if (this.dateEqual(nowDate, item.date)) {
return item return item
} }
}) })
// 日期禁用 // 日期禁用
let disableBefore = true let disableBefore = true
let disableAfter = true let disableAfter = true
if (this.startDate) { if (this.startDate) {
let dateCompBefore = this.dateCompare(this.startDate, fullDate) let dateCompBefore = this.dateCompare(this.startDate, fullDate)
disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
} }
if (this.endDate) { if (this.endDate) {
let dateCompAfter = this.dateCompare(fullDate, this.endDate) let dateCompAfter = this.dateCompare(fullDate, this.endDate)
disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
} }
let multiples = this.multipleStatus.data let multiples = this.multipleStatus.data
let checked = false let checked = false
let multiplesStatus = -1 let multiplesStatus = -1
if (this.range) { if (this.range) {
if (multiples) { if (multiples) {
multiplesStatus = multiples.findIndex((item) => { multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, nowDate) return this.dateEqual(item, nowDate)
}) })
} }
if (multiplesStatus !== -1) { if (multiplesStatus !== -1) {
checked = true checked = true
} }
} }
let data = { let data = {
fullDate: nowDate, fullDate: nowDate,
year: full.year, year: full.year,
date: i, date: i,
multiple: this.range ? checked : false, multiple: this.range ? checked : false,
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate), beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate), afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
month: full.month, month: full.month,
lunar: this.getlunar(full.year, full.month, i), lunar: this.getlunar(full.year, full.month, i),
disable: !disableBefore || !disableAfter, disable: !disableBefore || !disableAfter,
isDay isDay
} }
if (info) { if (info) {
data.extraInfo = info data.extraInfo = info
} }
dateArr.push(data) dateArr.push(data)
} }
return dateArr return dateArr
} }
/** /**
* 获取下月天数 * 获取下月天数
*/ */
_getNextMonthDays(surplus, full) { _getNextMonthDays(surplus, full) {
let dateArr = [] let dateArr = []
for (let i = 1; i < surplus + 1; i++) { for (let i = 1; i < surplus + 1; i++) {
dateArr.push({ dateArr.push({
date: i, date: i,
month: Number(full.month) + 1, month: Number(full.month) + 1,
lunar: this.getlunar(full.year, Number(full.month) + 1, i), lunar: this.getlunar(full.year, Number(full.month) + 1, i),
disable: true disable: true
}) })
} }
return dateArr return dateArr
} }
/** /**
* 获取当前日期详情 * 获取当前日期详情
* @param {Object} date * @param {Object} date
*/ */
getInfo(date) { getInfo(date) {
if (!date) { if (!date) {
date = new Date() date = new Date()
} }
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
return dateInfo return dateInfo
} }
/** /**
* 比较时间大小 * 比较时间大小
*/ */
dateCompare(startDate, endDate) { dateCompare(startDate, endDate) {
// 计算截止时间 // 计算截止时间
startDate = new Date(startDate.replace('-', '/').replace('-', '/')) startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间 // 计算详细项的截止时间
endDate = new Date(endDate.replace('-', '/').replace('-', '/')) endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
if (startDate <= endDate) { if (startDate <= endDate) {
return true return true
} else { } else {
return false return false
} }
} }
/** /**
* 比较时间是否相等 * 比较时间是否相等
*/ */
dateEqual(before, after) { dateEqual(before, after) {
// 计算截止时间 // 计算截止时间
before = new Date(before.replace('-', '/').replace('-', '/')) before = new Date(before.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间 // 计算详细项的截止时间
after = new Date(after.replace('-', '/').replace('-', '/')) after = new Date(after.replace('-', '/').replace('-', '/'))
if (before.getTime() - after.getTime() === 0) { if (before.getTime() - after.getTime() === 0) {
return true return true
} else { } else {
return false return false
} }
} }
/** /**
* 获取日期范围内所有日期 * 获取日期范围内所有日期
* @param {Object} begin * @param {Object} begin
* @param {Object} end * @param {Object} end
*/ */
geDateAll(begin, end) { geDateAll(begin, end) {
var arr = [] var arr = []
var ab = begin.split('-') var ab = begin.split('-')
var ae = end.split('-') var ae = end.split('-')
var db = new Date() var db = new Date()
db.setFullYear(ab[0], ab[1] - 1, ab[2]) db.setFullYear(ab[0], ab[1] - 1, ab[2])
var de = new Date() var de = new Date()
de.setFullYear(ae[0], ae[1] - 1, ae[2]) de.setFullYear(ae[0], ae[1] - 1, ae[2])
var unixDb = db.getTime() - 24 * 60 * 60 * 1000 var unixDb = db.getTime() - 24 * 60 * 60 * 1000
var unixDe = de.getTime() - 24 * 60 * 60 * 1000 var unixDe = de.getTime() - 24 * 60 * 60 * 1000
for (var k = unixDb; k <= unixDe;) { for (var k = unixDb; k <= unixDe;) {
k = k + 24 * 60 * 60 * 1000 k = k + 24 * 60 * 60 * 1000
arr.push(this.getDate(new Date(parseInt(k))).fullDate) arr.push(this.getDate(new Date(parseInt(k))).fullDate)
} }
return arr return arr
} }
/** /**
* 计算阴历日期显示 * 计算阴历日期显示
*/ */
getlunar(year, month, date) { getlunar(year, month, date) {
return CALENDAR.solar2lunar(year, month, date) return CALENDAR.solar2lunar(year, month, date)
} }
/** /**
* 设置打点 * 设置打点
*/ */
setSelectInfo(data, value) { setSelectInfo(data, value) {
this.selected = value this.selected = value
this._getWeek(data) this._getWeek(data)
} }
/** /**
* 获取多选状态 * 获取多选状态
*/ */
setMultiple(fullDate) { setMultiple(fullDate) {
let { let {
before, before,
after after
} = this.multipleStatus } = this.multipleStatus
if (!this.range) return if (!this.range) return
if (before && after) { if (before && after) {
this.multipleStatus.before = '' this.multipleStatus.before = ''
this.multipleStatus.after = '' this.multipleStatus.after = ''
this.multipleStatus.data = [] this.multipleStatus.data = []
} else { } else {
if (!before) { if (!before) {
this.multipleStatus.before = fullDate this.multipleStatus.before = fullDate
} else { } else {
this.multipleStatus.after = fullDate this.multipleStatus.after = fullDate
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
.after); .after);
} else { } else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus
.before); .before);
} }
} }
} }
this._getWeek(fullDate) this._getWeek(fullDate)
} }
/** /**
* 获取每周数据 * 获取每周数据
* @param {Object} dateData * @param {Object} dateData
*/ */
_getWeek(dateData) { _getWeek(dateData) {
const { const {
fullDate, fullDate,
year, year,
month, month,
date, date,
day day
} = this.getDate(dateData) } = this.getDate(dateData)
let firstDay = new Date(year, month - 1, 1).getDay() let firstDay = new Date(year, month - 1, 1).getDay()
let currentDay = new Date(year, month, 0).getDate() let currentDay = new Date(year, month, 0).getDate()
let dates = { let dates = {
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数 currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
nextMonthDays: [], // 下个月开始几天 nextMonthDays: [], // 下个月开始几天
weeks: [] weeks: []
} }
let canlender = [] let canlender = []
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
let weeks = {} let weeks = {}
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
for (let i = 0; i < canlender.length; i++) { for (let i = 0; i < canlender.length; i++) {
if (i % 7 === 0) { if (i % 7 === 0) {
weeks[parseInt(i / 7)] = new Array(7) weeks[parseInt(i / 7)] = new Array(7)
} }
weeks[parseInt(i / 7)][i % 7] = canlender[i] weeks[parseInt(i / 7)][i % 7] = canlender[i]
} }
this.canlender = canlender this.canlender = canlender
this.weeks = weeks this.weeks = weeks
} }
//静态方法 //静态方法
// static init(date) { // static init(date) {
// if (!this.instance) { // if (!this.instance) {
// this.instance = new Calendar(date); // this.instance = new Calendar(date);
// } // }
// return this.instance; // return this.instance;
// } // }
} }
export default Calendar export default Calendar

View File

@@ -42,7 +42,7 @@
export default { export default {
name: 'UniNavBar', name: 'UniNavBar',
components: { components: {
uniStatusBar: () => import('@/pages_tool/components/uni-status-bar/uni-status-bar.vue'), uniStatusBar: () => import('@/components/uni-status-bar/uni-status-bar.vue'),
uniIcons: () => import('@/components/uni-icons/uni-icons.vue'), uniIcons: () => import('@/components/uni-icons/uni-icons.vue'),
}, },
props: { props: {

View File

@@ -344,11 +344,7 @@
} }
] ]
}, },
{
//******************工具模块主分包(公共组件)******************
"root": "pages_tool",
"pages": []
},
{ {
//******************会员模块-基础信息子分包****************** //******************会员模块-基础信息子分包******************
"root": "pages_tool/member/basic", "root": "pages_tool/member/basic",

View File

@@ -14,7 +14,7 @@
</view> </view>
</view> </view>
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号' <view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
}}</view> }}</view>
</view> </view>
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }"> <!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
@@ -156,15 +156,17 @@ import indexJs from './public/js/index.js';
export default { export default {
components: { components: {
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'), nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
toTop: () => import('@/components/toTop/toTop.vue'), toTop: () => import('@/components/toTop/toTop.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'), privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif // #endif
}, },
mixins: [diyJs, scroll, indexJs] mixins: [diyJs, scroll, indexJs],
}; };
</script> </script>
@@ -211,12 +213,8 @@ export default {
font-size: 60rpx; font-size: 60rpx;
} }
</style> </style>
<style scoped>
.swiper /deep/ .uni-swiper-dots-horizontal {
left: 40%;
bottom: 40px
}
<style scoped>
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box { .wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none !important; background: none !important;
} }
@@ -224,8 +222,15 @@ export default {
.choose-store>>>.goodslist-uni-popup-box { .choose-store>>>.goodslist-uni-popup-box {
width: 80%; width: 80%;
} }
</style>
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box { <style lang="scss" scoped>
.swiper /deep/ .uni-swiper-dots-horizontal {
left: 40%;
bottom: 40px
}
/deep/ .diy-index-page .uni-popup .uni-popup__wrapper-box {
border-radius: 0; border-radius: 0;
} }

View File

@@ -37,7 +37,7 @@
export default { export default {
components: { components: {
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'), nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'), MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -1,120 +0,0 @@
<template>
<view v-if="advList.length" :class="['container-box',className]">
<swiper :indicator-dots="advList.length > 1" indicator-active-color="#ffffff" :autoplay="true" :interval="3000" :duration="1000" v-if="advList.length > 1" @change="changeSwiper" :current="currentIndex" :style="{ height: swiperHeight + 'px' }" class="item-wrap">
<swiper-item v-for="(item, index) in advList" :key="index" @click="jumppage(item.adv_url)">
<view class="image-box">
<image :src="$util.img(item.adv_image)" mode="widthFix" :id="'content-wrap' + index"/>
</view>
</swiper-item>
</swiper>
<view v-else class="container-box item-wrap">
<image :src="$util.img(advList[0]['adv_image'])" mode="widthFix" lazy-load="true" @load="imageLoad" @click="jumppage(advList[0].adv_url)"/>
</view>
</view>
</template>
<script>
export default {
name: 'ns-advert',
props: {
keyword: {
type: String
},
className: {
type: String
}
},
data() {
return {
advList: [],
isImage: false,
//滑块的高度(单位px)
swiperHeight: 150,
//当前索引
currentIndex: 0,
};
},
created() {
this.getAdvList();
},
methods: {
//获取广告位
getAdvList() {
var item = {
adv_image: '',
adv_url: ''
};
this.$api.sendRequest({
url: '/api/adv/detail',
data: {
keyword: this.keyword
},
success: res => {
if (res.code == 0) {
var data = res.data.adv_list;
for (var index in data) {
if (data[index].adv_url) data[index].adv_url = JSON.parse(data[index].adv_url);
}
this.advList = res.data.adv_list;
//动态设置swiper的高度
this.$nextTick(() => {
this.setSwiperHeight();
});
}
}
});
},
jumppage(e) {
this.$util.diyRedirectTo(e);
},
imageLoad(data) {
this.isImage = true;
},
//手动切换题目
changeSwiper(e) {
this.currentIndex = e.detail.current;
//动态设置swiper的高度使用nextTick延时设置
this.$nextTick(() => {
this.setSwiperHeight();
});
},
//动态设置swiper的高度
setSwiperHeight() {
if (this.advList.length > 1) {
setTimeout(() => {
let element = "#content-wrap" + this.currentIndex;
let query = uni.createSelectorQuery().in(this);
query.select(element).boundingClientRect();
query.exec((res) => {
if (res && res[0]) {
this.swiperHeight = res[0].height;
}
});
}, 10);
}
},
}
};
</script>
<style lang="scss">
.container-box {
width: 100%;
.item-wrap {
border-radius: 10rpx;
.image-box {
border-radius: 10rpx;
}
image {
width: 100%;
height: auto;
border-radius: 10rpx;
will-change: transform;
}
}
}
</style>

View File

@@ -162,7 +162,6 @@ export default {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
toTop: () => import('@/components/toTop/toTop.vue'), toTop: () => import('@/components/toTop/toTop.vue'),
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'), hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
}, },
mixins: [scroll], mixins: [scroll],
data() { data() {

View File

@@ -54,7 +54,7 @@ export default {
} }
}, },
components: { components: {
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'), nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'), nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'), MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),

View File

@@ -28,7 +28,7 @@ export default {
components: { components: {
uniGrid: () => import('@/components/uni-grid/uni-grid.vue'), uniGrid: () => import('@/components/uni-grid/uni-grid.vue'),
uniGridItem: () => import('@/components/uni-grid-item/uni-grid-item.vue'), uniGridItem: () => import('@/components/uni-grid-item/uni-grid-item.vue'),
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'), nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'), MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -61,10 +61,6 @@ import microPageJs from './public/js/diy.js';
export default { export default {
components: { components: {
diyIndexPage: () => import('@/components-diy/diy-index-page.vue'),
diyGroup: () => import('@/components-diy/diy-group.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'), nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'), nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),

View File

@@ -63,7 +63,7 @@
import validate from 'common/js/validate.js'; import validate from 'common/js/validate.js';
export default { export default {
components: { components: {
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'), mypOne: () => import('@/components/myp-one/myp-one.vue'),
}, },
data() { data() {
return { return {

View File

@@ -80,9 +80,6 @@ import indexJs from '../public/js/index.js';
export default { export default {
components: { components: {
diyGroup: () => import('@/components-diy/diy-group.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'), nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'), nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),

View File

@@ -112,7 +112,7 @@ import info from '../public/js/info.js';
export default { export default {
components: { components: {
uniNavBar: () => import('@/pages_tool/components/uni-nav-bar/uni-nav-bar.vue'), uniNavBar: () => import('@/components/uni-nav-bar/uni-nav-bar.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
}, },
data() { data() {

View File

@@ -179,7 +179,7 @@ import auth from '@/common/js/auth.js';
export default { export default {
components: { components: {
uniNavBar: () => import('@/pages_tool/components/uni-nav-bar/uni-nav-bar.vue'), uniNavBar: () => import('@/components/uni-nav-bar/uni-nav-bar.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'), nsLogin: () => import('@/components/ns-login/ns-login.vue'),
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'), pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
}, },

View File

@@ -33,7 +33,7 @@
export default { export default {
components: { components: {
imgCropping: () => import('@/pages_tool/components/img-cropping/cropping.vue'), imgCropping: () => import('@/components/img-cropping/cropping.vue'),
}, },
data() { data() {
return { return {

View File

@@ -21,7 +21,7 @@
export default { export default {
components: { components: {
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'), mypOne: () => import('@/components/myp-one/myp-one.vue')
}, },
data() { data() {
return { return {

View File

@@ -184,7 +184,7 @@
import scroll from '@/common/js/scroll-view.js'; import scroll from '@/common/js/scroll-view.js';
export default { export default {
components: { components: {
nsProgress: () => import('@/pages_tool/components/ns-progress/ns-progress.vue'), nsProgress: () => import('@/components/ns-progress/ns-progress.vue'),
toTop: () => import('@/components/toTop/toTop.vue'), toTop: () => import('@/components/toTop/toTop.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'), uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -48,7 +48,7 @@ import scroll from '@/common/js/scroll-view.js';
export default { export default {
components: { components: {
nsProgress: () => import('@/pages_tool/components/ns-progress/ns-progress.vue'), nsProgress: () => import('@/components/ns-progress/ns-progress.vue'),
toTop: () => import('@/components/toTop/toTop.vue'), toTop: () => import('@/components/toTop/toTop.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
}, },

View File

@@ -84,7 +84,7 @@
import evaluate from './public/js/evaluate.js'; import evaluate from './public/js/evaluate.js';
export default { export default {
components: { components: {
sxRate: () => import('@/pages_tool/components/sx-rate/index.vue'), sxRate: () => import('@/components/sx-rate/index.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'), loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
}, },
mixins: [evaluate], mixins: [evaluate],

View File

@@ -8,9 +8,6 @@
<script> <script>
export default { export default {
components: {
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
},
data() { data() {
return { return {
src: '' src: ''