已支付订单列表:where.payStatus = 1;
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniBadge",
|
||||
emits: ["click"],
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: "error"
|
||||
},
|
||||
inverted: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isDot: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
maxNum: {
|
||||
type: Number,
|
||||
default: 99
|
||||
},
|
||||
absolute: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
offset: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [0, 0];
|
||||
}
|
||||
},
|
||||
text: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: "small"
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
width() {
|
||||
return String(this.text).length * 8 + 12;
|
||||
},
|
||||
classNames() {
|
||||
const {
|
||||
inverted,
|
||||
type,
|
||||
size,
|
||||
absolute
|
||||
} = this;
|
||||
return [
|
||||
inverted ? "uni-badge--" + type + "-inverted" : "",
|
||||
"uni-badge--" + type,
|
||||
"uni-badge--" + size,
|
||||
absolute ? "uni-badge--absolute" : ""
|
||||
].join(" ");
|
||||
},
|
||||
positionStyle() {
|
||||
if (!this.absolute) return {};
|
||||
let w = this.width / 2, h = 10;
|
||||
if (this.isDot) {
|
||||
w = 5;
|
||||
h = 5;
|
||||
}
|
||||
const x = `${-w + this.offset[0]}px`;
|
||||
const y = `${-h + this.offset[1]}px`;
|
||||
const whiteList = {
|
||||
rightTop: {
|
||||
right: x,
|
||||
top: y
|
||||
},
|
||||
rightBottom: {
|
||||
right: x,
|
||||
bottom: y
|
||||
},
|
||||
leftBottom: {
|
||||
left: x,
|
||||
bottom: y
|
||||
},
|
||||
leftTop: {
|
||||
left: x,
|
||||
top: y
|
||||
}
|
||||
};
|
||||
const match = whiteList[this.absolute];
|
||||
return match ? match : whiteList["rightTop"];
|
||||
},
|
||||
dotStyle() {
|
||||
if (!this.isDot) return {};
|
||||
return {
|
||||
width: "10px",
|
||||
minWidth: "0",
|
||||
height: "10px",
|
||||
padding: "0",
|
||||
borderRadius: "10px"
|
||||
};
|
||||
},
|
||||
displayValue() {
|
||||
const {
|
||||
isDot,
|
||||
text,
|
||||
maxNum
|
||||
} = this;
|
||||
return isDot ? "" : Number(text) > maxNum ? `${maxNum}+` : text;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit("click");
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.text
|
||||
}, $props.text ? {
|
||||
b: common_vendor.t($options.displayValue),
|
||||
c: common_vendor.n($options.classNames),
|
||||
d: common_vendor.s($options.positionStyle),
|
||||
e: common_vendor.s($props.customStyle),
|
||||
f: common_vendor.s($options.dotStyle),
|
||||
g: common_vendor.o(($event) => $options.onClick())
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-badge/components/uni-badge/uni-badge.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-badge--x"><slot/><text wx:if="{{a}}" class="{{[c, 'uni-badge']}}" style="{{d + ';' + e + ';' + f}}" bindtap="{{g}}">{{b}}</text></view>
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-badge--x {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.uni-badge--absolute {
|
||||
position: absolute;
|
||||
}
|
||||
.uni-badge--small {
|
||||
transform: scale(0.8);
|
||||
transform-origin: center center;
|
||||
}
|
||||
.uni-badge {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
font-feature-settings: "tnum";
|
||||
min-width: 20px;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
border-radius: 100px;
|
||||
background-color: #909399;
|
||||
background-color: transparent;
|
||||
border: 1px solid #fff;
|
||||
text-align: center;
|
||||
font-family: "Helvetica Neue", Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-badge--info {
|
||||
color: #fff;
|
||||
background-color: #909399;
|
||||
}
|
||||
.uni-badge--primary {
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-badge--success {
|
||||
background-color: #4cd964;
|
||||
}
|
||||
.uni-badge--warning {
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
.uni-badge--error {
|
||||
background-color: #dd524d;
|
||||
}
|
||||
.uni-badge--inverted {
|
||||
padding: 0 5px 0 0;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-badge--info-inverted {
|
||||
color: #909399;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--primary-inverted {
|
||||
color: #2979ff;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--success-inverted {
|
||||
color: #4cd964;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--warning-inverted {
|
||||
color: #f0ad4e;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--error-inverted {
|
||||
color: #dd524d;
|
||||
background-color: transparent;
|
||||
}
|
||||
+839
@@ -0,0 +1,839 @@
|
||||
"use strict";
|
||||
var calendar = {
|
||||
/**
|
||||
* 农历1900-2100的润大小信息表
|
||||
* @Array Of Property
|
||||
* @return Hex
|
||||
*/
|
||||
lunarInfo: [
|
||||
19416,
|
||||
19168,
|
||||
42352,
|
||||
21717,
|
||||
53856,
|
||||
55632,
|
||||
91476,
|
||||
22176,
|
||||
39632,
|
||||
21970,
|
||||
// 1900-1909
|
||||
19168,
|
||||
42422,
|
||||
42192,
|
||||
53840,
|
||||
119381,
|
||||
46400,
|
||||
54944,
|
||||
44450,
|
||||
38320,
|
||||
84343,
|
||||
// 1910-1919
|
||||
18800,
|
||||
42160,
|
||||
46261,
|
||||
27216,
|
||||
27968,
|
||||
109396,
|
||||
11104,
|
||||
38256,
|
||||
21234,
|
||||
18800,
|
||||
// 1920-1929
|
||||
25958,
|
||||
54432,
|
||||
59984,
|
||||
28309,
|
||||
23248,
|
||||
11104,
|
||||
100067,
|
||||
37600,
|
||||
116951,
|
||||
51536,
|
||||
// 1930-1939
|
||||
54432,
|
||||
120998,
|
||||
46416,
|
||||
22176,
|
||||
107956,
|
||||
9680,
|
||||
37584,
|
||||
53938,
|
||||
43344,
|
||||
46423,
|
||||
// 1940-1949
|
||||
27808,
|
||||
46416,
|
||||
86869,
|
||||
19872,
|
||||
42416,
|
||||
83315,
|
||||
21168,
|
||||
43432,
|
||||
59728,
|
||||
27296,
|
||||
// 1950-1959
|
||||
44710,
|
||||
43856,
|
||||
19296,
|
||||
43748,
|
||||
42352,
|
||||
21088,
|
||||
62051,
|
||||
55632,
|
||||
23383,
|
||||
22176,
|
||||
// 1960-1969
|
||||
38608,
|
||||
19925,
|
||||
19152,
|
||||
42192,
|
||||
54484,
|
||||
53840,
|
||||
54616,
|
||||
46400,
|
||||
46752,
|
||||
103846,
|
||||
// 1970-1979
|
||||
38320,
|
||||
18864,
|
||||
43380,
|
||||
42160,
|
||||
45690,
|
||||
27216,
|
||||
27968,
|
||||
44870,
|
||||
43872,
|
||||
38256,
|
||||
// 1980-1989
|
||||
19189,
|
||||
18800,
|
||||
25776,
|
||||
29859,
|
||||
59984,
|
||||
27480,
|
||||
23232,
|
||||
43872,
|
||||
38613,
|
||||
37600,
|
||||
// 1990-1999
|
||||
51552,
|
||||
55636,
|
||||
54432,
|
||||
55888,
|
||||
30034,
|
||||
22176,
|
||||
43959,
|
||||
9680,
|
||||
37584,
|
||||
51893,
|
||||
// 2000-2009
|
||||
43344,
|
||||
46240,
|
||||
47780,
|
||||
44368,
|
||||
21977,
|
||||
19360,
|
||||
42416,
|
||||
86390,
|
||||
21168,
|
||||
43312,
|
||||
// 2010-2019
|
||||
31060,
|
||||
27296,
|
||||
44368,
|
||||
23378,
|
||||
19296,
|
||||
42726,
|
||||
42208,
|
||||
53856,
|
||||
60005,
|
||||
54576,
|
||||
// 2020-2029
|
||||
23200,
|
||||
30371,
|
||||
38608,
|
||||
19195,
|
||||
19152,
|
||||
42192,
|
||||
118966,
|
||||
53840,
|
||||
54560,
|
||||
56645,
|
||||
// 2030-2039
|
||||
46496,
|
||||
22224,
|
||||
21938,
|
||||
18864,
|
||||
42359,
|
||||
42160,
|
||||
43600,
|
||||
111189,
|
||||
27936,
|
||||
44448,
|
||||
// 2040-2049
|
||||
/** Add By JJonline@JJonline.Cn**/
|
||||
84835,
|
||||
37744,
|
||||
18936,
|
||||
18800,
|
||||
25776,
|
||||
92326,
|
||||
59984,
|
||||
27424,
|
||||
108228,
|
||||
43744,
|
||||
// 2050-2059
|
||||
41696,
|
||||
53987,
|
||||
51552,
|
||||
54615,
|
||||
54432,
|
||||
55888,
|
||||
23893,
|
||||
22176,
|
||||
42704,
|
||||
21972,
|
||||
// 2060-2069
|
||||
21200,
|
||||
43448,
|
||||
43344,
|
||||
46240,
|
||||
46758,
|
||||
44368,
|
||||
21920,
|
||||
43940,
|
||||
42416,
|
||||
21168,
|
||||
// 2070-2079
|
||||
45683,
|
||||
26928,
|
||||
29495,
|
||||
27296,
|
||||
44368,
|
||||
84821,
|
||||
19296,
|
||||
42352,
|
||||
21732,
|
||||
53600,
|
||||
// 2080-2089
|
||||
59752,
|
||||
54560,
|
||||
55968,
|
||||
92838,
|
||||
22224,
|
||||
19168,
|
||||
43476,
|
||||
41680,
|
||||
53584,
|
||||
62034,
|
||||
// 2090-2099
|
||||
54560
|
||||
],
|
||||
// 2100
|
||||
/**
|
||||
* 公历每个月份的天数普通表
|
||||
* @Array Of Property
|
||||
* @return Number
|
||||
*/
|
||||
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||
/**
|
||||
* 天干地支之天干速查表
|
||||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Gan: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"],
|
||||
/**
|
||||
* 天干地支之地支速查表
|
||||
* @Array Of Property
|
||||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Zhi: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"],
|
||||
/**
|
||||
* 天干地支之地支速查表<=>生肖
|
||||
* @Array Of Property
|
||||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Animals: ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"],
|
||||
/**
|
||||
* 24节气速查表
|
||||
* @Array Of Property
|
||||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
|
||||
* @return Cn string
|
||||
*/
|
||||
solarTerm: ["小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"],
|
||||
/**
|
||||
* 1900-2100各年的24节气日期速查表
|
||||
* @Array Of Property
|
||||
* @return 0x string For splice
|
||||
*/
|
||||
sTermInfo: [
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c3598082c95f8c965cc920f",
|
||||
"97bd0b06bdb0722c965ce1cfcc920f",
|
||||
"b027097bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c359801ec95f8c965cc920f",
|
||||
"97bd0b06bdb0722c965ce1cfcc920f",
|
||||
"b027097bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c359801ec95f8c965cc920f",
|
||||
"97bd0b06bdb0722c965ce1cfcc920f",
|
||||
"b027097bd097c36b0b6fc9274c91aa",
|
||||
"9778397bd19801ec9210c965cc920e",
|
||||
"97b6b97bd19801ec95f8c965cc920f",
|
||||
"97bd09801d98082c95f8e1cfcc920f",
|
||||
"97bd097bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd197c36c9210c9274c91aa",
|
||||
"97b6b97bd19801ec95f8c965cc920e",
|
||||
"97bd09801d98082c95f8e1cfcc920f",
|
||||
"97bd097bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36c9210c9274c91aa",
|
||||
"97b6b97bd19801ec95f8c965cc920e",
|
||||
"97bcf97c3598082c95f8e1cfcc920f",
|
||||
"97bd097bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36c9210c9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c3598082c95f8c965cc920f",
|
||||
"97bd097bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c3598082c95f8c965cc920f",
|
||||
"97bd097bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c359801ec95f8c965cc920f",
|
||||
"97bd097bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c359801ec95f8c965cc920f",
|
||||
"97bd097bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf97c359801ec95f8c965cc920f",
|
||||
"97bd097bd07f595b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd19801ec9210c9274c920e",
|
||||
"97b6b97bd19801ec95f8c965cc920f",
|
||||
"97bd07f5307f595b0b0bc920fb0722",
|
||||
"7f0e397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36c9210c9274c920e",
|
||||
"97b6b97bd19801ec95f8c965cc920f",
|
||||
"97bd07f5307f595b0b0bc920fb0722",
|
||||
"7f0e397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36c9210c9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bd07f1487f595b0b0bc920fb0722",
|
||||
"7f0e397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf7f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf7f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf7f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c965cc920e",
|
||||
"97bcf7f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b97bd19801ec9210c9274c920e",
|
||||
"97bcf7f0e47f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"9778397bd097c36b0b6fc9210c91aa",
|
||||
"97b6b97bd197c36c9210c9274c920e",
|
||||
"97bcf7f0e47f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"9778397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36c9210c9274c920e",
|
||||
"97b6b7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f5307f595b0b0bc920fb0722",
|
||||
"7f0e397bd097c36b0b6fc9210c8dc2",
|
||||
"9778397bd097c36b0b70c9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e37f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc9210c8dc2",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"9778397bd097c36b0b6fc9274c91aa",
|
||||
"97b6b7f0e47f531b0723b0787b0721",
|
||||
"7f0e27f0e47f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"9778397bd097c36b0b6fc9210c91aa",
|
||||
"97b6b7f0e47f149b0723b0787b0721",
|
||||
"7f0e27f0e47f531b0723b0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"9778397bd097c36b0b6fc9210c8dc2",
|
||||
"977837f0e37f149b0723b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f5307f595b0b0bc920fb0722",
|
||||
"7f0e397bd097c35b0b6fc9210c8dc2",
|
||||
"977837f0e37f14998082b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e37f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc9210c8dc2",
|
||||
"977837f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"977837f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd097c35b0b6fc920fb0722",
|
||||
"977837f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"977837f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"977837f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f149b0723b0787b0721",
|
||||
"7f0e27f0e47f531b0b0bb0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"977837f0e37f14998082b0723b06bd",
|
||||
"7f07e7f0e37f149b0723b0787b0721",
|
||||
"7f0e27f0e47f531b0723b0b6fb0722",
|
||||
"7f0e397bd07f595b0b0bc920fb0722",
|
||||
"977837f0e37f14898082b0723b02d5",
|
||||
"7ec967f0e37f14998082b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f1487f595b0b0bb0b6fb0722",
|
||||
"7f0e37f0e37f14898082b0723b02d5",
|
||||
"7ec967f0e37f14998082b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e37f0e37f14898082b0723b02d5",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e37f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e37f0e37f14898082b072297c35",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e37f0e37f14898082b072297c35",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e37f0e366aa89801eb072297c35",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f149b0723b0787b0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722",
|
||||
"7f0e37f0e366aa89801eb072297c35",
|
||||
"7ec967f0e37f14998082b0723b06bd",
|
||||
"7f07e7f0e47f149b0723b0787b0721",
|
||||
"7f0e27f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f0e366aa89801eb072297c35",
|
||||
"7ec967f0e37f14998082b0723b06bd",
|
||||
"7f07e7f0e37f14998083b0787b0721",
|
||||
"7f0e27f0e47f531b0723b0b6fb0722",
|
||||
"7f0e37f0e366aa89801eb072297c35",
|
||||
"7ec967f0e37f14898082b0723b02d5",
|
||||
"7f07e7f0e37f14998082b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e36665b66aa89801e9808297c35",
|
||||
"665f67f0e37f14898082b0723b02d5",
|
||||
"7ec967f0e37f14998082b0787b0721",
|
||||
"7f07e7f0e47f531b0723b0b6fb0722",
|
||||
"7f0e36665b66a449801e9808297c35",
|
||||
"665f67f0e37f14898082b0723b02d5",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e36665b66a449801e9808297c35",
|
||||
"665f67f0e37f14898082b072297c35",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e26665b66a449801e9808297c35",
|
||||
"665f67f0e37f1489801eb072297c35",
|
||||
"7ec967f0e37f14998082b0787b06bd",
|
||||
"7f07e7f0e47f531b0723b0b6fb0721",
|
||||
"7f0e27f1487f531b0b0bb0b6fb0722"
|
||||
],
|
||||
/**
|
||||
* 数字转中文速查表
|
||||
* @Array Of Property
|
||||
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr1: ["日", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"],
|
||||
/**
|
||||
* 日期转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['初','十','廿','卅']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr2: ["初", "十", "廿", "卅"],
|
||||
/**
|
||||
* 月份转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr3: ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"],
|
||||
/**
|
||||
* 返回农历y年一整年的总天数
|
||||
* @param lunar Year
|
||||
* @return Number
|
||||
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
||||
*/
|
||||
lYearDays: function(y) {
|
||||
var i;
|
||||
var sum = 348;
|
||||
for (i = 32768; i > 8; i >>= 1) {
|
||||
sum += this.lunarInfo[y - 1900] & i ? 1 : 0;
|
||||
}
|
||||
return sum + this.leapDays(y);
|
||||
},
|
||||
/**
|
||||
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0-12)
|
||||
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
|
||||
*/
|
||||
leapMonth: function(y) {
|
||||
return this.lunarInfo[y - 1900] & 15;
|
||||
},
|
||||
/**
|
||||
* 返回农历y年闰月的天数 若该年没有闰月则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0、29、30)
|
||||
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
|
||||
*/
|
||||
leapDays: function(y) {
|
||||
if (this.leapMonth(y)) {
|
||||
return this.lunarInfo[y - 1900] & 65536 ? 30 : 29;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
/**
|
||||
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
|
||||
* @param lunar Year
|
||||
* @return Number (-1、29、30)
|
||||
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
|
||||
*/
|
||||
monthDays: function(y, m) {
|
||||
if (m > 12 || m < 1) {
|
||||
return -1;
|
||||
}
|
||||
return this.lunarInfo[y - 1900] & 65536 >> m ? 30 : 29;
|
||||
},
|
||||
/**
|
||||
* 返回公历(!)y年m月的天数
|
||||
* @param solar Year
|
||||
* @return Number (-1、28、29、30、31)
|
||||
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
|
||||
*/
|
||||
solarDays: function(y, m) {
|
||||
if (m > 12 || m < 1) {
|
||||
return -1;
|
||||
}
|
||||
var ms = m - 1;
|
||||
if (ms == 1) {
|
||||
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0 ? 29 : 28;
|
||||
} else {
|
||||
return this.solarMonth[ms];
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 农历年份转换为干支纪年
|
||||
* @param lYear 农历年的年份数
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhiYear: function(lYear) {
|
||||
var ganKey = (lYear - 3) % 10;
|
||||
var zhiKey = (lYear - 3) % 12;
|
||||
if (ganKey == 0) ganKey = 10;
|
||||
if (zhiKey == 0) zhiKey = 12;
|
||||
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1];
|
||||
},
|
||||
/**
|
||||
* 公历月、日判断所属星座
|
||||
* @param cMonth [description]
|
||||
* @param cDay [description]
|
||||
* @return Cn string
|
||||
*/
|
||||
toAstro: function(cMonth, cDay) {
|
||||
var s = "魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
|
||||
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22];
|
||||
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "座";
|
||||
},
|
||||
/**
|
||||
* 传入offset偏移量返回干支
|
||||
* @param offset 相对甲子的偏移量
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhi: function(offset) {
|
||||
return this.Gan[offset % 10] + this.Zhi[offset % 12];
|
||||
},
|
||||
/**
|
||||
* 传入公历(!)y年获得该年第n个节气的公历日期
|
||||
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
|
||||
* @return day Number
|
||||
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
|
||||
*/
|
||||
getTerm: function(y, n) {
|
||||
if (y < 1900 || y > 2100) {
|
||||
return -1;
|
||||
}
|
||||
if (n < 1 || n > 24) {
|
||||
return -1;
|
||||
}
|
||||
var _table = this.sTermInfo[y - 1900];
|
||||
var _info = [
|
||||
parseInt("0x" + _table.substr(0, 5)).toString(),
|
||||
parseInt("0x" + _table.substr(5, 5)).toString(),
|
||||
parseInt("0x" + _table.substr(10, 5)).toString(),
|
||||
parseInt("0x" + _table.substr(15, 5)).toString(),
|
||||
parseInt("0x" + _table.substr(20, 5)).toString(),
|
||||
parseInt("0x" + _table.substr(25, 5)).toString()
|
||||
];
|
||||
var _calday = [
|
||||
_info[0].substr(0, 1),
|
||||
_info[0].substr(1, 2),
|
||||
_info[0].substr(3, 1),
|
||||
_info[0].substr(4, 2),
|
||||
_info[1].substr(0, 1),
|
||||
_info[1].substr(1, 2),
|
||||
_info[1].substr(3, 1),
|
||||
_info[1].substr(4, 2),
|
||||
_info[2].substr(0, 1),
|
||||
_info[2].substr(1, 2),
|
||||
_info[2].substr(3, 1),
|
||||
_info[2].substr(4, 2),
|
||||
_info[3].substr(0, 1),
|
||||
_info[3].substr(1, 2),
|
||||
_info[3].substr(3, 1),
|
||||
_info[3].substr(4, 2),
|
||||
_info[4].substr(0, 1),
|
||||
_info[4].substr(1, 2),
|
||||
_info[4].substr(3, 1),
|
||||
_info[4].substr(4, 2),
|
||||
_info[5].substr(0, 1),
|
||||
_info[5].substr(1, 2),
|
||||
_info[5].substr(3, 1),
|
||||
_info[5].substr(4, 2)
|
||||
];
|
||||
return parseInt(_calday[n - 1]);
|
||||
},
|
||||
/**
|
||||
* 传入农历数字月份返回汉语通俗表示法
|
||||
* @param lunar month
|
||||
* @return Cn string
|
||||
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
|
||||
*/
|
||||
toChinaMonth: function(m) {
|
||||
if (m > 12 || m < 1) {
|
||||
return -1;
|
||||
}
|
||||
var s = this.nStr3[m - 1];
|
||||
s += "月";
|
||||
return s;
|
||||
},
|
||||
/**
|
||||
* 传入农历日期数字返回汉字表示法
|
||||
* @param lunar day
|
||||
* @return Cn string
|
||||
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
||||
*/
|
||||
toChinaDay: function(d) {
|
||||
var s;
|
||||
switch (d) {
|
||||
case 10:
|
||||
s = "初十";
|
||||
break;
|
||||
case 20:
|
||||
s = "二十";
|
||||
break;
|
||||
case 30:
|
||||
s = "三十";
|
||||
break;
|
||||
default:
|
||||
s = this.nStr2[Math.floor(d / 10)];
|
||||
s += this.nStr1[d % 10];
|
||||
}
|
||||
return s;
|
||||
},
|
||||
/**
|
||||
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
|
||||
* @param y year
|
||||
* @return Cn string
|
||||
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
|
||||
*/
|
||||
getAnimal: function(y) {
|
||||
return this.Animals[(y - 4) % 12];
|
||||
},
|
||||
/**
|
||||
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y solar year
|
||||
* @param m solar month
|
||||
* @param d solar day
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.solar2lunar(1987,11,01));
|
||||
*/
|
||||
solar2lunar: function(y, m, d) {
|
||||
if (y < 1900 || y > 2100) {
|
||||
return -1;
|
||||
}
|
||||
if (y == 1900 && m == 1 && d < 31) {
|
||||
return -1;
|
||||
}
|
||||
if (!y) {
|
||||
var objDate = /* @__PURE__ */ new Date();
|
||||
} else {
|
||||
var objDate = new Date(y, parseInt(m) - 1, d);
|
||||
}
|
||||
var i;
|
||||
var leap = 0;
|
||||
var temp = 0;
|
||||
var y = objDate.getFullYear();
|
||||
var m = objDate.getMonth() + 1;
|
||||
var d = objDate.getDate();
|
||||
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 864e5;
|
||||
for (i = 1900; i < 2101 && offset > 0; i++) {
|
||||
temp = this.lYearDays(i);
|
||||
offset -= temp;
|
||||
}
|
||||
if (offset < 0) {
|
||||
offset += temp;
|
||||
i--;
|
||||
}
|
||||
var isTodayObj = /* @__PURE__ */ new Date();
|
||||
var isToday = false;
|
||||
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
|
||||
isToday = true;
|
||||
}
|
||||
var nWeek = objDate.getDay();
|
||||
var cWeek = this.nStr1[nWeek];
|
||||
if (nWeek == 0) {
|
||||
nWeek = 7;
|
||||
}
|
||||
var year = i;
|
||||
var leap = this.leapMonth(i);
|
||||
var isLeap = false;
|
||||
for (i = 1; i < 13 && offset > 0; i++) {
|
||||
if (leap > 0 && i == leap + 1 && isLeap == false) {
|
||||
--i;
|
||||
isLeap = true;
|
||||
temp = this.leapDays(year);
|
||||
} else {
|
||||
temp = this.monthDays(year, i);
|
||||
}
|
||||
if (isLeap == true && i == leap + 1) {
|
||||
isLeap = false;
|
||||
}
|
||||
offset -= temp;
|
||||
}
|
||||
if (offset == 0 && leap > 0 && i == leap + 1) {
|
||||
if (isLeap) {
|
||||
isLeap = false;
|
||||
} else {
|
||||
isLeap = true;
|
||||
--i;
|
||||
}
|
||||
}
|
||||
if (offset < 0) {
|
||||
offset += temp;
|
||||
--i;
|
||||
}
|
||||
var month = i;
|
||||
var day = offset + 1;
|
||||
var sm = m - 1;
|
||||
var gzY = this.toGanZhiYear(year);
|
||||
var firstNode = this.getTerm(y, m * 2 - 1);
|
||||
var secondNode = this.getTerm(y, m * 2);
|
||||
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11);
|
||||
if (d >= firstNode) {
|
||||
gzM = this.toGanZhi((y - 1900) * 12 + m + 12);
|
||||
}
|
||||
var isTerm = false;
|
||||
var Term = null;
|
||||
if (firstNode == d) {
|
||||
isTerm = true;
|
||||
Term = this.solarTerm[m * 2 - 2];
|
||||
}
|
||||
if (secondNode == d) {
|
||||
isTerm = true;
|
||||
Term = this.solarTerm[m * 2 - 1];
|
||||
}
|
||||
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 864e5 + 25567 + 10;
|
||||
var gzD = this.toGanZhi(dayCyclical + d - 1);
|
||||
var astro = this.toAstro(m, d);
|
||||
return { "lYear": year, "lMonth": month, "lDay": day, "Animal": this.getAnimal(year), "IMonthCn": (isLeap ? "闰" : "") + this.toChinaMonth(month), "IDayCn": this.toChinaDay(day), "cYear": y, "cMonth": m, "cDay": d, "gzYear": gzY, "gzMonth": gzM, "gzDay": gzD, "isToday": isToday, "isLeap": isLeap, "nWeek": nWeek, "ncWeek": "星期" + cWeek, "isTerm": isTerm, "Term": Term, "astro": astro };
|
||||
},
|
||||
/**
|
||||
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y lunar year
|
||||
* @param m lunar month
|
||||
* @param d lunar day
|
||||
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.lunar2solar(1987,9,10));
|
||||
*/
|
||||
lunar2solar: function(y, m, d, isLeapMonth) {
|
||||
var isLeapMonth = !!isLeapMonth;
|
||||
var leapMonth = this.leapMonth(y);
|
||||
this.leapDays(y);
|
||||
if (isLeapMonth && leapMonth != m) {
|
||||
return -1;
|
||||
}
|
||||
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) {
|
||||
return -1;
|
||||
}
|
||||
var day = this.monthDays(y, m);
|
||||
var _day = day;
|
||||
if (isLeapMonth) {
|
||||
_day = this.leapDays(y, m);
|
||||
}
|
||||
if (y < 1900 || y > 2100 || d > _day) {
|
||||
return -1;
|
||||
}
|
||||
var offset = 0;
|
||||
for (var i = 1900; i < y; i++) {
|
||||
offset += this.lYearDays(i);
|
||||
}
|
||||
var leap = 0;
|
||||
var isAdd = false;
|
||||
for (var i = 1; i < m; i++) {
|
||||
leap = this.leapMonth(y);
|
||||
if (!isAdd) {
|
||||
if (leap <= i && leap > 0) {
|
||||
offset += this.leapDays(y);
|
||||
isAdd = true;
|
||||
}
|
||||
}
|
||||
offset += this.monthDays(y, i);
|
||||
}
|
||||
if (isLeapMonth) {
|
||||
offset += day;
|
||||
}
|
||||
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0);
|
||||
var calObj = new Date((offset + d - 31) * 864e5 + stmap);
|
||||
var cY = calObj.getUTCFullYear();
|
||||
var cM = calObj.getUTCMonth() + 1;
|
||||
var cD = calObj.getUTCDate();
|
||||
return this.solar2lunar(cY, cM, cD);
|
||||
}
|
||||
};
|
||||
exports.calendar = calendar;
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
const en = {
|
||||
"uni-calender.ok": "ok",
|
||||
"uni-calender.cancel": "cancel",
|
||||
"uni-calender.today": "today",
|
||||
"uni-calender.MON": "MON",
|
||||
"uni-calender.TUE": "TUE",
|
||||
"uni-calender.WED": "WED",
|
||||
"uni-calender.THU": "THU",
|
||||
"uni-calender.FRI": "FRI",
|
||||
"uni-calender.SAT": "SAT",
|
||||
"uni-calender.SUN": "SUN"
|
||||
};
|
||||
const zhHans = {
|
||||
"uni-calender.ok": "确定",
|
||||
"uni-calender.cancel": "取消",
|
||||
"uni-calender.today": "今日",
|
||||
"uni-calender.SUN": "日",
|
||||
"uni-calender.MON": "一",
|
||||
"uni-calender.TUE": "二",
|
||||
"uni-calender.WED": "三",
|
||||
"uni-calender.THU": "四",
|
||||
"uni-calender.FRI": "五",
|
||||
"uni-calender.SAT": "六"
|
||||
};
|
||||
const zhHant = {
|
||||
"uni-calender.ok": "確定",
|
||||
"uni-calender.cancel": "取消",
|
||||
"uni-calender.today": "今日",
|
||||
"uni-calender.SUN": "日",
|
||||
"uni-calender.MON": "一",
|
||||
"uni-calender.TUE": "二",
|
||||
"uni-calender.WED": "三",
|
||||
"uni-calender.THU": "四",
|
||||
"uni-calender.FRI": "五",
|
||||
"uni-calender.SAT": "六"
|
||||
};
|
||||
const i18nMessages = {
|
||||
en,
|
||||
"zh-Hans": zhHans,
|
||||
"zh-Hant": zhHant
|
||||
};
|
||||
exports.i18nMessages = i18nMessages;
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniCalendar_components_uniCalendar_i18n_index = require("./i18n/index.js");
|
||||
const { t } = common_vendor.initVueI18n(uni_modules_uniCalendar_components_uniCalendar_i18n_index.i18nMessages);
|
||||
const _sfc_main = {
|
||||
emits: ["change"],
|
||||
props: {
|
||||
weeks: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
selected: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
lunar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
todayText() {
|
||||
return t("uni-calender.today");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
choiceDate(weeks) {
|
||||
this.$emit("change", weeks);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.selected && $props.weeks.extraInfo
|
||||
}, $props.selected && $props.weeks.extraInfo ? {} : {}, {
|
||||
b: common_vendor.t($props.weeks.date),
|
||||
c: $props.weeks.isDay ? 1 : "",
|
||||
d: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
|
||||
e: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
|
||||
f: $props.weeks.beforeMultiple ? 1 : "",
|
||||
g: $props.weeks.multiple ? 1 : "",
|
||||
h: $props.weeks.afterMultiple ? 1 : "",
|
||||
i: $props.weeks.disable ? 1 : "",
|
||||
j: !$props.lunar && !$props.weeks.extraInfo && $props.weeks.isDay
|
||||
}, !$props.lunar && !$props.weeks.extraInfo && $props.weeks.isDay ? {
|
||||
k: common_vendor.t($options.todayText),
|
||||
l: $props.weeks.isDay ? 1 : "",
|
||||
m: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
|
||||
n: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
|
||||
o: $props.weeks.beforeMultiple ? 1 : "",
|
||||
p: $props.weeks.multiple ? 1 : "",
|
||||
q: $props.weeks.afterMultiple ? 1 : ""
|
||||
} : {}, {
|
||||
r: $props.lunar && !$props.weeks.extraInfo
|
||||
}, $props.lunar && !$props.weeks.extraInfo ? {
|
||||
s: common_vendor.t($props.weeks.isDay ? $options.todayText : $props.weeks.lunar.IDayCn === "初一" ? $props.weeks.lunar.IMonthCn : $props.weeks.lunar.IDayCn),
|
||||
t: $props.weeks.isDay ? 1 : "",
|
||||
v: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
|
||||
w: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
|
||||
x: $props.weeks.beforeMultiple ? 1 : "",
|
||||
y: $props.weeks.multiple ? 1 : "",
|
||||
z: $props.weeks.afterMultiple ? 1 : "",
|
||||
A: $props.weeks.disable ? 1 : ""
|
||||
} : {}, {
|
||||
B: $props.weeks.extraInfo && $props.weeks.extraInfo.info
|
||||
}, $props.weeks.extraInfo && $props.weeks.extraInfo.info ? {
|
||||
C: common_vendor.t($props.weeks.extraInfo.info),
|
||||
D: $props.weeks.extraInfo.info ? 1 : "",
|
||||
E: $props.weeks.isDay ? 1 : "",
|
||||
F: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
|
||||
G: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
|
||||
H: $props.weeks.beforeMultiple ? 1 : "",
|
||||
I: $props.weeks.multiple ? 1 : "",
|
||||
J: $props.weeks.afterMultiple ? 1 : "",
|
||||
K: $props.weeks.disable ? 1 : ""
|
||||
} : {}, {
|
||||
L: $props.weeks.disable ? 1 : "",
|
||||
M: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
|
||||
N: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
|
||||
O: $props.weeks.beforeMultiple ? 1 : "",
|
||||
P: $props.weeks.multiple ? 1 : "",
|
||||
Q: $props.weeks.afterMultiple ? 1 : "",
|
||||
R: common_vendor.o(($event) => $options.choiceDate($props.weeks))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-aa793075"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="{{['uni-calendar-item__weeks-box', 'data-v-aa793075', L && 'uni-calendar-item--disable', M && 'uni-calendar-item--isDay', N && 'uni-calendar-item--checked', O && 'uni-calendar-item--before-checked', P && 'uni-calendar-item--multiple', Q && 'uni-calendar-item--after-checked']}}" bindtap="{{R}}"><view class="uni-calendar-item__weeks-box-item data-v-aa793075"><text wx:if="{{a}}" class="uni-calendar-item__weeks-box-circle data-v-aa793075"></text><text class="{{['uni-calendar-item__weeks-box-text', 'data-v-aa793075', c && 'uni-calendar-item--isDay-text', d && 'uni-calendar-item--isDay', e && 'uni-calendar-item--checked', f && 'uni-calendar-item--before-checked', g && 'uni-calendar-item--multiple', h && 'uni-calendar-item--after-checked', i && 'uni-calendar-item--disable']}}">{{b}}</text><text wx:if="{{j}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', l && 'uni-calendar-item--isDay-text', m && 'uni-calendar-item--isDay', n && 'uni-calendar-item--checked', o && 'uni-calendar-item--before-checked', p && 'uni-calendar-item--multiple', q && 'uni-calendar-item--after-checked']}}">{{k}}</text><text wx:if="{{r}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', t && 'uni-calendar-item--isDay-text', v && 'uni-calendar-item--isDay', w && 'uni-calendar-item--checked', x && 'uni-calendar-item--before-checked', y && 'uni-calendar-item--multiple', z && 'uni-calendar-item--after-checked', A && 'uni-calendar-item--disable']}}">{{s}}</text><text wx:if="{{B}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', D && 'uni-calendar-item--extra', E && 'uni-calendar-item--isDay-text', F && 'uni-calendar-item--isDay', G && 'uni-calendar-item--checked', H && 'uni-calendar-item--before-checked', I && 'uni-calendar-item--multiple', J && 'uni-calendar-item--after-checked', K && 'uni-calendar-item--disable']}}">{{C}}</text></view></view>
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-calendar-item__weeks-box.data-v-aa793075 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-calendar-item__weeks-box-text.data-v-aa793075 {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
.uni-calendar-item__weeks-lunar-text.data-v-aa793075 {
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
}
|
||||
.uni-calendar-item__weeks-box-item.data-v-aa793075 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
.uni-calendar-item__weeks-box-circle.data-v-aa793075 {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 8px;
|
||||
background-color: #e43d33;
|
||||
}
|
||||
.uni-calendar-item--disable.data-v-aa793075 {
|
||||
background-color: rgba(249, 249, 249, 0.3);
|
||||
color: #c0c0c0;
|
||||
}
|
||||
.uni-calendar-item--isDay-text.data-v-aa793075 {
|
||||
color: #2979ff;
|
||||
}
|
||||
.uni-calendar-item--isDay.data-v-aa793075 {
|
||||
background-color: #2979ff;
|
||||
opacity: 0.8;
|
||||
color: #fff;
|
||||
}
|
||||
.uni-calendar-item--extra.data-v-aa793075 {
|
||||
color: #e43d33;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.uni-calendar-item--checked.data-v-aa793075 {
|
||||
background-color: #2979ff;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.uni-calendar-item--multiple.data-v-aa793075 {
|
||||
background-color: #2979ff;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.uni-calendar-item--before-checked.data-v-aa793075 {
|
||||
background-color: #ff5a5f;
|
||||
color: #fff;
|
||||
}
|
||||
.uni-calendar-item--after-checked.data-v-aa793075 {
|
||||
background-color: #ff5a5f;
|
||||
color: #fff;
|
||||
}
|
||||
+335
@@ -0,0 +1,335 @@
|
||||
"use strict";
|
||||
const uni_modules_uniCalendar_components_uniCalendar_util = require("./util.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniCalendar_components_uniCalendar_i18n_index = require("./i18n/index.js");
|
||||
const CalendarItem = () => "./uni-calendar-item.js";
|
||||
const { t } = common_vendor.initVueI18n(uni_modules_uniCalendar_components_uniCalendar_i18n_index.i18nMessages);
|
||||
const _sfc_main = {
|
||||
components: {
|
||||
CalendarItem
|
||||
},
|
||||
emits: ["close", "confirm", "change", "monthSwitch"],
|
||||
props: {
|
||||
date: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
selected: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
lunar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
startDate: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
endDate: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
range: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
insert: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showMonth: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
clearDate: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
weeks: [],
|
||||
calendar: {},
|
||||
nowDate: "",
|
||||
aniMaskShow: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
* for i18n
|
||||
*/
|
||||
okText() {
|
||||
return t("uni-calender.ok");
|
||||
},
|
||||
cancelText() {
|
||||
return t("uni-calender.cancel");
|
||||
},
|
||||
todayText() {
|
||||
return t("uni-calender.today");
|
||||
},
|
||||
monText() {
|
||||
return t("uni-calender.MON");
|
||||
},
|
||||
TUEText() {
|
||||
return t("uni-calender.TUE");
|
||||
},
|
||||
WEDText() {
|
||||
return t("uni-calender.WED");
|
||||
},
|
||||
THUText() {
|
||||
return t("uni-calender.THU");
|
||||
},
|
||||
FRIText() {
|
||||
return t("uni-calender.FRI");
|
||||
},
|
||||
SATText() {
|
||||
return t("uni-calender.SAT");
|
||||
},
|
||||
SUNText() {
|
||||
return t("uni-calender.SUN");
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
date(newVal) {
|
||||
this.init(newVal);
|
||||
},
|
||||
startDate(val) {
|
||||
this.cale.resetSatrtDate(val);
|
||||
this.cale.setDate(this.nowDate.fullDate);
|
||||
this.weeks = this.cale.weeks;
|
||||
},
|
||||
endDate(val) {
|
||||
this.cale.resetEndDate(val);
|
||||
this.cale.setDate(this.nowDate.fullDate);
|
||||
this.weeks = this.cale.weeks;
|
||||
},
|
||||
selected(newVal) {
|
||||
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
|
||||
this.weeks = this.cale.weeks;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.cale = new uni_modules_uniCalendar_components_uniCalendar_util.Calendar({
|
||||
selected: this.selected,
|
||||
startDate: this.startDate,
|
||||
endDate: this.endDate,
|
||||
range: this.range
|
||||
});
|
||||
this.init(this.date);
|
||||
},
|
||||
methods: {
|
||||
// 取消穿透
|
||||
clean() {
|
||||
},
|
||||
bindDateChange(e) {
|
||||
const value = e.detail.value + "-1";
|
||||
this.setDate(value);
|
||||
const { year, month } = this.cale.getDate(value);
|
||||
this.$emit("monthSwitch", {
|
||||
year,
|
||||
month
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 初始化日期显示
|
||||
* @param {Object} date
|
||||
*/
|
||||
init(date) {
|
||||
this.cale.setDate(date);
|
||||
this.weeks = this.cale.weeks;
|
||||
this.nowDate = this.calendar = this.cale.getInfo(date);
|
||||
},
|
||||
/**
|
||||
* 打开日历弹窗
|
||||
*/
|
||||
open() {
|
||||
if (this.clearDate && !this.insert) {
|
||||
this.cale.cleanMultipleStatus();
|
||||
this.init(this.date);
|
||||
}
|
||||
this.show = true;
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.aniMaskShow = true;
|
||||
}, 50);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 关闭日历弹窗
|
||||
*/
|
||||
close() {
|
||||
this.aniMaskShow = false;
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.show = false;
|
||||
this.$emit("close");
|
||||
}, 300);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 确认按钮
|
||||
*/
|
||||
confirm() {
|
||||
this.setEmit("confirm");
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
* 变化触发
|
||||
*/
|
||||
change() {
|
||||
if (!this.insert) return;
|
||||
this.setEmit("change");
|
||||
},
|
||||
/**
|
||||
* 选择月份触发
|
||||
*/
|
||||
monthSwitch() {
|
||||
let {
|
||||
year,
|
||||
month
|
||||
} = this.nowDate;
|
||||
this.$emit("monthSwitch", {
|
||||
year,
|
||||
month: Number(month)
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 派发事件
|
||||
* @param {Object} name
|
||||
*/
|
||||
setEmit(name) {
|
||||
let {
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
fullDate,
|
||||
lunar,
|
||||
extraInfo
|
||||
} = this.calendar;
|
||||
this.$emit(name, {
|
||||
range: this.cale.multipleStatus,
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
fulldate: fullDate,
|
||||
lunar,
|
||||
extraInfo: extraInfo || {}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 选择天触发
|
||||
* @param {Object} weeks
|
||||
*/
|
||||
choiceDate(weeks) {
|
||||
if (weeks.disable) return;
|
||||
this.calendar = weeks;
|
||||
this.cale.setMultiple(this.calendar.fullDate);
|
||||
this.weeks = this.cale.weeks;
|
||||
this.change();
|
||||
},
|
||||
/**
|
||||
* 回到今天
|
||||
*/
|
||||
backToday() {
|
||||
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`;
|
||||
const date = this.cale.getDate(/* @__PURE__ */ new Date());
|
||||
const todayYearMonth = `${date.year}-${date.month}`;
|
||||
if (nowYearMonth !== todayYearMonth) {
|
||||
this.monthSwitch();
|
||||
}
|
||||
this.init(date.fullDate);
|
||||
this.change();
|
||||
},
|
||||
/**
|
||||
* 上个月
|
||||
*/
|
||||
pre() {
|
||||
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, "month").fullDate;
|
||||
this.setDate(preDate);
|
||||
this.monthSwitch();
|
||||
},
|
||||
/**
|
||||
* 下个月
|
||||
*/
|
||||
next() {
|
||||
const nextDate = this.cale.getDate(this.nowDate.fullDate, 1, "month").fullDate;
|
||||
this.setDate(nextDate);
|
||||
this.monthSwitch();
|
||||
},
|
||||
/**
|
||||
* 设置日期
|
||||
* @param {Object} date
|
||||
*/
|
||||
setDate(date) {
|
||||
this.cale.setDate(date);
|
||||
this.weeks = this.cale.weeks;
|
||||
this.nowDate = this.cale.getInfo(date);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _component_calendar_item = common_vendor.resolveComponent("calendar-item");
|
||||
_component_calendar_item();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !$props.insert && $data.show
|
||||
}, !$props.insert && $data.show ? {
|
||||
b: $data.aniMaskShow ? 1 : "",
|
||||
c: common_vendor.o((...args) => $options.clean && $options.clean(...args))
|
||||
} : {}, {
|
||||
d: $props.insert || $data.show
|
||||
}, $props.insert || $data.show ? common_vendor.e({
|
||||
e: !$props.insert
|
||||
}, !$props.insert ? {
|
||||
f: common_vendor.t($options.cancelText),
|
||||
g: common_vendor.o((...args) => $options.close && $options.close(...args)),
|
||||
h: common_vendor.t($options.okText),
|
||||
i: common_vendor.o((...args) => $options.confirm && $options.confirm(...args))
|
||||
} : {}, {
|
||||
j: common_vendor.o((...args) => $options.pre && $options.pre(...args)),
|
||||
k: common_vendor.t(($data.nowDate.year || "") + " / " + ($data.nowDate.month || "")),
|
||||
l: $props.date,
|
||||
m: common_vendor.o((...args) => $options.bindDateChange && $options.bindDateChange(...args)),
|
||||
n: common_vendor.o((...args) => $options.next && $options.next(...args)),
|
||||
o: common_vendor.t($options.todayText),
|
||||
p: common_vendor.o((...args) => $options.backToday && $options.backToday(...args)),
|
||||
q: $props.showMonth
|
||||
}, $props.showMonth ? {
|
||||
r: common_vendor.t($data.nowDate.month)
|
||||
} : {}, {
|
||||
s: common_vendor.t($options.SUNText),
|
||||
t: common_vendor.t($options.monText),
|
||||
v: common_vendor.t($options.TUEText),
|
||||
w: common_vendor.t($options.WEDText),
|
||||
x: common_vendor.t($options.THUText),
|
||||
y: common_vendor.t($options.FRIText),
|
||||
z: common_vendor.t($options.SATText),
|
||||
A: common_vendor.f($data.weeks, (item, weekIndex, i0) => {
|
||||
return {
|
||||
a: common_vendor.f(item, (weeks, weeksIndex, i1) => {
|
||||
return {
|
||||
a: common_vendor.o($options.choiceDate, weeksIndex),
|
||||
b: "3d225f58-0-" + i0 + "-" + i1,
|
||||
c: common_vendor.p({
|
||||
weeks,
|
||||
calendar: $data.calendar,
|
||||
selected: $props.selected,
|
||||
lunar: $props.lunar
|
||||
}),
|
||||
d: weeksIndex
|
||||
};
|
||||
}),
|
||||
b: weekIndex
|
||||
};
|
||||
}),
|
||||
B: !$props.insert ? 1 : "",
|
||||
C: $data.aniMaskShow ? 1 : ""
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3d225f58"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"calendar-item": "./uni-calendar-item"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-calendar data-v-3d225f58"><view wx:if="{{a}}" class="{{['uni-calendar__mask', 'data-v-3d225f58', b && 'uni-calendar--mask-show']}}" bindtap="{{c}}"></view><view wx:if="{{d}}" class="{{['uni-calendar__content', 'data-v-3d225f58', B && 'uni-calendar--fixed', C && 'uni-calendar--ani-show']}}"><view wx:if="{{e}}" class="uni-calendar__header uni-calendar--fixed-top data-v-3d225f58"><view class="uni-calendar__header-btn-box data-v-3d225f58" bindtap="{{g}}"><text class="uni-calendar__header-text uni-calendar--fixed-width data-v-3d225f58">{{f}}</text></view><view class="uni-calendar__header-btn-box data-v-3d225f58" bindtap="{{i}}"><text class="uni-calendar__header-text uni-calendar--fixed-width data-v-3d225f58">{{h}}</text></view></view><view class="uni-calendar__header data-v-3d225f58"><view class="uni-calendar__header-btn-box data-v-3d225f58" catchtap="{{j}}"><view class="uni-calendar__header-btn uni-calendar--left data-v-3d225f58"></view></view><picker class="data-v-3d225f58" mode="date" value="{{l}}" fields="month" bindchange="{{m}}"><text class="uni-calendar__header-text data-v-3d225f58">{{k}}</text></picker><view class="uni-calendar__header-btn-box data-v-3d225f58" catchtap="{{n}}"><view class="uni-calendar__header-btn uni-calendar--right data-v-3d225f58"></view></view><text class="uni-calendar__backtoday data-v-3d225f58" bindtap="{{p}}">{{o}}</text></view><view class="uni-calendar__box data-v-3d225f58"><view wx:if="{{q}}" class="uni-calendar__box-bg data-v-3d225f58"><text class="uni-calendar__box-bg-text data-v-3d225f58">{{r}}</text></view><view class="uni-calendar__weeks data-v-3d225f58"><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{s}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{t}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{v}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{w}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{x}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{y}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{z}}</text></view></view><view wx:for="{{A}}" wx:for-item="item" wx:key="b" class="uni-calendar__weeks data-v-3d225f58"><view wx:for="{{item.a}}" wx:for-item="weeks" wx:key="d" class="uni-calendar__weeks-item data-v-3d225f58"><calendar-item wx:if="{{weeks.c}}" class="uni-calendar-item--hook data-v-3d225f58" bindchange="{{weeks.a}}" u-i="{{weeks.b}}" bind:__l="__l" u-p="{{weeks.c}}"></calendar-item></view></view></view></view></view>
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-calendar.data-v-3d225f58 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-calendar__mask.data-v-3d225f58 {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
transition-property: opacity;
|
||||
transition-duration: 0.3s;
|
||||
opacity: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
.uni-calendar--mask-show.data-v-3d225f58 {
|
||||
opacity: 1;
|
||||
}
|
||||
.uni-calendar--fixed.data-v-3d225f58 {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transition-property: transform;
|
||||
transition-duration: 0.3s;
|
||||
transform: translateY(460px);
|
||||
bottom: calc(var(--window-bottom));
|
||||
z-index: 99;
|
||||
}
|
||||
.uni-calendar--ani-show.data-v-3d225f58 {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.uni-calendar__content.data-v-3d225f58 {
|
||||
background-color: #fff;
|
||||
}
|
||||
.uni-calendar__header.data-v-3d225f58 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
border-bottom-color: #EDEDED;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
.uni-calendar--fixed-top.data-v-3d225f58 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
border-top-color: #EDEDED;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
.uni-calendar--fixed-width.data-v-3d225f58 {
|
||||
width: 50px;
|
||||
}
|
||||
.uni-calendar__backtoday.data-v-3d225f58 {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 25rpx;
|
||||
padding: 0 5px;
|
||||
padding-left: 10px;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
font-size: 12px;
|
||||
border-top-left-radius: 25px;
|
||||
border-bottom-left-radius: 25px;
|
||||
color: #333;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
.uni-calendar__header-text.data-v-3d225f58 {
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
.uni-calendar__header-btn-box.data-v-3d225f58 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
.uni-calendar__header-btn.data-v-3d225f58 {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-left-color: #808080;
|
||||
border-left-style: solid;
|
||||
border-left-width: 2px;
|
||||
border-top-color: #555555;
|
||||
border-top-style: solid;
|
||||
border-top-width: 2px;
|
||||
}
|
||||
.uni-calendar--left.data-v-3d225f58 {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
.uni-calendar--right.data-v-3d225f58 {
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
.uni-calendar__weeks.data-v-3d225f58 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-calendar__weeks-item.data-v-3d225f58 {
|
||||
flex: 1;
|
||||
}
|
||||
.uni-calendar__weeks-day.data-v-3d225f58 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
border-bottom-color: #F5F5F5;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
.uni-calendar__weeks-day-text.data-v-3d225f58 {
|
||||
font-size: 14px;
|
||||
}
|
||||
.uni-calendar__box.data-v-3d225f58 {
|
||||
position: relative;
|
||||
}
|
||||
.uni-calendar__box-bg.data-v-3d225f58 {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.uni-calendar__box-bg-text.data-v-3d225f58 {
|
||||
font-size: 200px;
|
||||
font-weight: bold;
|
||||
color: #999;
|
||||
opacity: 0.1;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
"use strict";
|
||||
const uni_modules_uniCalendar_components_uniCalendar_calendar = require("./calendar.js");
|
||||
class Calendar {
|
||||
constructor({
|
||||
date,
|
||||
selected,
|
||||
startDate,
|
||||
endDate,
|
||||
range
|
||||
} = {}) {
|
||||
this.date = this.getDate(/* @__PURE__ */ new Date());
|
||||
this.selected = selected || [];
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.range = range;
|
||||
this.cleanMultipleStatus();
|
||||
this.weeks = {};
|
||||
}
|
||||
/**
|
||||
* 设置日期
|
||||
* @param {Object} date
|
||||
*/
|
||||
setDate(date) {
|
||||
this.selectDate = this.getDate(date);
|
||||
this._getWeek(this.selectDate.fullDate);
|
||||
}
|
||||
/**
|
||||
* 清理多选状态
|
||||
*/
|
||||
cleanMultipleStatus() {
|
||||
this.multipleStatus = {
|
||||
before: "",
|
||||
after: "",
|
||||
data: []
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 重置开始日期
|
||||
*/
|
||||
resetSatrtDate(startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
/**
|
||||
* 重置结束日期
|
||||
*/
|
||||
resetEndDate(endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
/**
|
||||
* 获取任意时间
|
||||
*/
|
||||
getDate(date, AddDayCount = 0, str = "day") {
|
||||
if (!date) {
|
||||
date = /* @__PURE__ */ new Date();
|
||||
}
|
||||
if (typeof date !== "object") {
|
||||
date = date.replace(/-/g, "/");
|
||||
}
|
||||
const dd = new Date(date);
|
||||
switch (str) {
|
||||
case "day":
|
||||
dd.setDate(dd.getDate() + AddDayCount);
|
||||
break;
|
||||
case "month":
|
||||
if (dd.getDate() === 31 && AddDayCount > 0) {
|
||||
dd.setDate(dd.getDate() + AddDayCount);
|
||||
} else {
|
||||
const preMonth = dd.getMonth();
|
||||
dd.setMonth(preMonth + AddDayCount);
|
||||
const nextMonth = dd.getMonth();
|
||||
if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) {
|
||||
dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount));
|
||||
}
|
||||
if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) {
|
||||
dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "year":
|
||||
dd.setFullYear(dd.getFullYear() + AddDayCount);
|
||||
break;
|
||||
}
|
||||
const y = dd.getFullYear();
|
||||
const m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1;
|
||||
const d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
|
||||
return {
|
||||
fullDate: y + "-" + m + "-" + d,
|
||||
year: y,
|
||||
month: m,
|
||||
date: d,
|
||||
day: dd.getDay()
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 获取上月剩余天数
|
||||
*/
|
||||
_getLastMonthDays(firstDay, full) {
|
||||
let dateArr = [];
|
||||
for (let i = firstDay; i > 0; i--) {
|
||||
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate();
|
||||
dateArr.push({
|
||||
date: beforeDate,
|
||||
month: full.month - 1,
|
||||
lunar: this.getlunar(full.year, full.month - 1, beforeDate),
|
||||
disable: true
|
||||
});
|
||||
}
|
||||
return dateArr;
|
||||
}
|
||||
/**
|
||||
* 获取本月天数
|
||||
*/
|
||||
_currentMonthDys(dateData, full) {
|
||||
let dateArr = [];
|
||||
let fullDate = this.date.fullDate;
|
||||
for (let i = 1; i <= dateData; i++) {
|
||||
let nowDate = full.year + "-" + (full.month < 10 ? full.month : full.month) + "-" + (i < 10 ? "0" + i : i);
|
||||
let isDay = fullDate === nowDate;
|
||||
let info = this.selected && this.selected.find((item) => {
|
||||
if (this.dateEqual(nowDate, item.date)) {
|
||||
return item;
|
||||
}
|
||||
});
|
||||
let disableBefore = true;
|
||||
let disableAfter = true;
|
||||
if (this.startDate) {
|
||||
disableBefore = this.dateCompare(this.startDate, nowDate);
|
||||
}
|
||||
if (this.endDate) {
|
||||
disableAfter = this.dateCompare(nowDate, this.endDate);
|
||||
}
|
||||
let multiples = this.multipleStatus.data;
|
||||
let checked = false;
|
||||
let multiplesStatus = -1;
|
||||
if (this.range) {
|
||||
if (multiples) {
|
||||
multiplesStatus = multiples.findIndex((item) => {
|
||||
return this.dateEqual(item, nowDate);
|
||||
});
|
||||
}
|
||||
if (multiplesStatus !== -1) {
|
||||
checked = true;
|
||||
}
|
||||
}
|
||||
let data = {
|
||||
fullDate: nowDate,
|
||||
year: full.year,
|
||||
date: i,
|
||||
multiple: this.range ? checked : false,
|
||||
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
|
||||
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
|
||||
month: full.month,
|
||||
lunar: this.getlunar(full.year, full.month, i),
|
||||
disable: !(disableBefore && disableAfter),
|
||||
isDay
|
||||
};
|
||||
if (info) {
|
||||
data.extraInfo = info;
|
||||
}
|
||||
dateArr.push(data);
|
||||
}
|
||||
return dateArr;
|
||||
}
|
||||
/**
|
||||
* 获取下月天数
|
||||
*/
|
||||
_getNextMonthDays(surplus, full) {
|
||||
let dateArr = [];
|
||||
for (let i = 1; i < surplus + 1; i++) {
|
||||
dateArr.push({
|
||||
date: i,
|
||||
month: Number(full.month) + 1,
|
||||
lunar: this.getlunar(full.year, Number(full.month) + 1, i),
|
||||
disable: true
|
||||
});
|
||||
}
|
||||
return dateArr;
|
||||
}
|
||||
/**
|
||||
* 获取当前日期详情
|
||||
* @param {Object} date
|
||||
*/
|
||||
getInfo(date) {
|
||||
if (!date) {
|
||||
date = /* @__PURE__ */ new Date();
|
||||
}
|
||||
const dateInfo = this.canlender.find((item) => item.fullDate === this.getDate(date).fullDate);
|
||||
return dateInfo;
|
||||
}
|
||||
/**
|
||||
* 比较时间大小
|
||||
*/
|
||||
dateCompare(startDate, endDate) {
|
||||
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
|
||||
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
|
||||
if (startDate <= endDate) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 比较时间是否相等
|
||||
*/
|
||||
dateEqual(before, after) {
|
||||
before = new Date(before.replace("-", "/").replace("-", "/"));
|
||||
after = new Date(after.replace("-", "/").replace("-", "/"));
|
||||
if (before.getTime() - after.getTime() === 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取日期范围内所有日期
|
||||
* @param {Object} begin
|
||||
* @param {Object} end
|
||||
*/
|
||||
geDateAll(begin, end) {
|
||||
var arr = [];
|
||||
var ab = begin.split("-");
|
||||
var ae = end.split("-");
|
||||
var db = /* @__PURE__ */ new Date();
|
||||
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
|
||||
var de = /* @__PURE__ */ new Date();
|
||||
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
|
||||
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
|
||||
var unixDe = de.getTime() - 24 * 60 * 60 * 1e3;
|
||||
for (var k = unixDb; k <= unixDe; ) {
|
||||
k = k + 24 * 60 * 60 * 1e3;
|
||||
arr.push(this.getDate(new Date(parseInt(k))).fullDate);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
/**
|
||||
* 计算阴历日期显示
|
||||
*/
|
||||
getlunar(year, month, date) {
|
||||
return uni_modules_uniCalendar_components_uniCalendar_calendar.calendar.solar2lunar(year, month, date);
|
||||
}
|
||||
/**
|
||||
* 设置打点
|
||||
*/
|
||||
setSelectInfo(data, value) {
|
||||
this.selected = value;
|
||||
this._getWeek(data);
|
||||
}
|
||||
/**
|
||||
* 获取多选状态
|
||||
*/
|
||||
setMultiple(fullDate) {
|
||||
let {
|
||||
before,
|
||||
after
|
||||
} = this.multipleStatus;
|
||||
if (!this.range) return;
|
||||
if (before && after) {
|
||||
this.multipleStatus.before = "";
|
||||
this.multipleStatus.after = "";
|
||||
this.multipleStatus.data = [];
|
||||
} else {
|
||||
if (!before) {
|
||||
this.multipleStatus.before = fullDate;
|
||||
} else {
|
||||
this.multipleStatus.after = fullDate;
|
||||
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
||||
} else {
|
||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._getWeek(fullDate);
|
||||
}
|
||||
/**
|
||||
* 获取每周数据
|
||||
* @param {Object} dateData
|
||||
*/
|
||||
_getWeek(dateData) {
|
||||
const {
|
||||
year,
|
||||
month
|
||||
} = this.getDate(dateData);
|
||||
let firstDay = new Date(year, month - 1, 1).getDay();
|
||||
let currentDay = new Date(year, month, 0).getDate();
|
||||
let dates = {
|
||||
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)),
|
||||
// 上个月末尾几天
|
||||
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)),
|
||||
// 本月天数
|
||||
nextMonthDays: [],
|
||||
// 下个月开始几天
|
||||
weeks: []
|
||||
};
|
||||
let canlender = [];
|
||||
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length);
|
||||
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData));
|
||||
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays);
|
||||
let weeks = {};
|
||||
for (let i = 0; i < canlender.length; i++) {
|
||||
if (i % 7 === 0) {
|
||||
weeks[parseInt(i / 7)] = new Array(7);
|
||||
}
|
||||
weeks[parseInt(i / 7)][i % 7] = canlender[i];
|
||||
}
|
||||
this.canlender = canlender;
|
||||
this.weeks = weeks;
|
||||
}
|
||||
//静态方法
|
||||
// static init(date) {
|
||||
// if (!this.instance) {
|
||||
// this.instance = new Calendar(date);
|
||||
// }
|
||||
// return this.instance;
|
||||
// }
|
||||
}
|
||||
exports.Calendar = Calendar;
|
||||
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniCard",
|
||||
emits: ["click"],
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
padding: {
|
||||
type: String,
|
||||
default: "10px"
|
||||
},
|
||||
margin: {
|
||||
type: String,
|
||||
default: "15px"
|
||||
},
|
||||
spacing: {
|
||||
type: String,
|
||||
default: "0 10px"
|
||||
},
|
||||
extra: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
cover: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
thumbnail: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
isFull: {
|
||||
// 内容区域是否通栏
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isShadow: {
|
||||
// 是否开启阴影
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
shadow: {
|
||||
type: String,
|
||||
default: "0px 0px 3px 1px rgba(0, 0, 0, 0.08)"
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick(type) {
|
||||
this.$emit("click", type);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.cover
|
||||
}, $props.cover ? {
|
||||
b: common_vendor.o(($event) => $options.onClick("cover")),
|
||||
c: $props.cover
|
||||
} : {}, {
|
||||
d: $props.title || $props.extra
|
||||
}, $props.title || $props.extra ? common_vendor.e({
|
||||
e: $props.thumbnail
|
||||
}, $props.thumbnail ? {
|
||||
f: $props.thumbnail
|
||||
} : {}, {
|
||||
g: common_vendor.t($props.title),
|
||||
h: $props.title && $props.subTitle
|
||||
}, $props.title && $props.subTitle ? {
|
||||
i: common_vendor.t($props.subTitle)
|
||||
} : {}, {
|
||||
j: common_vendor.o(($event) => $options.onClick("title")),
|
||||
k: common_vendor.t($props.extra),
|
||||
l: common_vendor.o(($event) => $options.onClick("extra"))
|
||||
}) : {}, {
|
||||
m: $props.padding,
|
||||
n: common_vendor.o(($event) => $options.onClick("content")),
|
||||
o: common_vendor.o(($event) => $options.onClick("actions")),
|
||||
p: $props.isFull ? 1 : "",
|
||||
q: $props.isShadow ? 1 : "",
|
||||
r: $props.border ? 1 : "",
|
||||
s: $props.isFull ? 0 : $props.margin,
|
||||
t: $props.spacing,
|
||||
v: $props.isShadow ? $props.shadow : ""
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-card/components/uni-card/uni-card.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['uni-card', p && 'uni-card--full', q && 'uni-card--shadow', r && 'uni-card--border']}}" style="{{'margin:' + s + ';' + ('padding:' + t) + ';' + ('box-shadow:' + v)}}"><block wx:if="{{$slots.cover}}"><slot name="cover"></slot></block><block wx:else><view wx:if="{{a}}" class="uni-card__cover"><image class="uni-card__cover-image" mode="widthFix" bindtap="{{b}}" src="{{c}}"></image></view></block><block wx:if="{{$slots.title}}"><slot name="title"></slot></block><block wx:else><view wx:if="{{d}}" class="uni-card__header"><view class="uni-card__header-box" bindtap="{{j}}"><view wx:if="{{e}}" class="uni-card__header-avatar"><image class="uni-card__header-avatar-image" src="{{f}}" mode="aspectFit"/></view><view class="uni-card__header-content"><text class="uni-card__header-content-title uni-ellipsis">{{g}}</text><text wx:if="{{h}}" class="uni-card__header-content-subtitle uni-ellipsis">{{i}}</text></view></view><view class="uni-card__header-extra" bindtap="{{l}}"><text class="uni-card__header-extra-text">{{k}}</text></view></view></block><view class="uni-card__content" style="{{'padding:' + m}}" bindtap="{{n}}"><slot></slot></view><view class="uni-card__actions" bindtap="{{o}}"><slot name="actions"></slot></view></view>
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-card {
|
||||
margin: 10px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
|
||||
background-color: #fff;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-card .uni-card__cover {
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.uni-card .uni-card__cover .uni-card__cover-image {
|
||||
flex: 1;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.uni-card .uni-card__header {
|
||||
display: flex;
|
||||
border-bottom: 1px #EBEEF5 solid;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-box {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-avatar .uni-card__header-avatar-image {
|
||||
flex: 1;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-title {
|
||||
font-size: 15px;
|
||||
color: #3a3a3a;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-subtitle {
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-extra {
|
||||
line-height: 12px;
|
||||
}
|
||||
.uni-card .uni-card__header .uni-card__header-extra .uni-card__header-extra-text {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-card .uni-card__content {
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
color: #6a6a6a;
|
||||
line-height: 22px;
|
||||
}
|
||||
.uni-card .uni-card__actions {
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-card--border {
|
||||
border: 1px solid #EBEEF5;
|
||||
}
|
||||
.uni-card--shadow {
|
||||
position: relative;
|
||||
box-shadow: 0 0px 6px 1px rgba(165, 165, 165, 0.2);
|
||||
}
|
||||
.uni-card--full {
|
||||
margin: 0;
|
||||
border-left-width: 0;
|
||||
border-left-width: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.uni-card--full:after {
|
||||
border-radius: 0;
|
||||
}
|
||||
.uni-ellipsis {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
Vendored
+427
@@ -0,0 +1,427 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniDataChecklist",
|
||||
mixins: [common_vendor.Ws.mixinDatacom || {}],
|
||||
emits: ["input", "update:modelValue", "change"],
|
||||
props: {
|
||||
mode: {
|
||||
type: String,
|
||||
default: "default"
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: {
|
||||
type: [Array, String, Number],
|
||||
default() {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
// TODO vue3
|
||||
modelValue: {
|
||||
type: [Array, String, Number],
|
||||
default() {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
localdata: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
min: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
},
|
||||
max: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
},
|
||||
wrap: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: "left"
|
||||
},
|
||||
selectedColor: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
selectedTextColor: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "暂无数据"
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
map: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
text: "text",
|
||||
value: "value"
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
localdata: {
|
||||
handler(newVal) {
|
||||
this.range = newVal;
|
||||
this.dataList = this.getDataList(this.getSelectedValue(newVal));
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
mixinDatacomResData(newVal) {
|
||||
this.range = newVal;
|
||||
this.dataList = this.getDataList(this.getSelectedValue(newVal));
|
||||
},
|
||||
value(newVal) {
|
||||
this.dataList = this.getDataList(newVal);
|
||||
},
|
||||
modelValue(newVal) {
|
||||
this.dataList = this.getDataList(newVal);
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: [],
|
||||
range: [],
|
||||
contentText: {
|
||||
contentdown: "查看更多",
|
||||
contentrefresh: "加载中",
|
||||
contentnomore: "没有更多"
|
||||
},
|
||||
isLocal: true,
|
||||
styles: {
|
||||
selectedColor: "#2979ff",
|
||||
selectedTextColor: "#666"
|
||||
},
|
||||
isTop: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dataValue() {
|
||||
if (this.value === "") return this.modelValue;
|
||||
if (this.modelValue === "") return this.value;
|
||||
return this.value;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.localdata && this.localdata.length !== 0) {
|
||||
this.isLocal = true;
|
||||
this.range = this.localdata;
|
||||
this.dataList = this.getDataList(this.getSelectedValue(this.range));
|
||||
} else {
|
||||
if (this.collection) {
|
||||
this.isLocal = false;
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData() {
|
||||
this.mixinDatacomGet().then((res) => {
|
||||
this.mixinDatacomResData = res.result.data;
|
||||
if (this.mixinDatacomResData.length === 0) {
|
||||
this.isLocal = false;
|
||||
this.mixinDatacomErrorMessage = this.emptyText;
|
||||
} else {
|
||||
this.isLocal = true;
|
||||
}
|
||||
}).catch((err) => {
|
||||
this.mixinDatacomErrorMessage = err.message;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getForm(name = "uniForms") {
|
||||
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;
|
||||
},
|
||||
chagne(e) {
|
||||
const values = e.detail.value;
|
||||
let detail = {
|
||||
value: [],
|
||||
data: []
|
||||
};
|
||||
if (this.multiple) {
|
||||
this.range.forEach((item) => {
|
||||
if (values.includes(item[this.map.value] + "")) {
|
||||
detail.value.push(item[this.map.value]);
|
||||
detail.data.push(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const range = this.range.find((item) => item[this.map.value] + "" === values);
|
||||
if (range) {
|
||||
detail = {
|
||||
value: range[this.map.value],
|
||||
data: range
|
||||
};
|
||||
}
|
||||
}
|
||||
this.$emit("input", detail.value);
|
||||
this.$emit("update:modelValue", detail.value);
|
||||
this.$emit("change", {
|
||||
detail
|
||||
});
|
||||
if (this.multiple) {
|
||||
this.dataList = this.getDataList(detail.value, true);
|
||||
} else {
|
||||
this.dataList = this.getDataList(detail.value);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取渲染的新数组
|
||||
* @param {Object} value 选中内容
|
||||
*/
|
||||
getDataList(value) {
|
||||
let dataList = JSON.parse(JSON.stringify(this.range));
|
||||
let list = [];
|
||||
if (this.multiple) {
|
||||
if (!Array.isArray(value)) {
|
||||
value = [];
|
||||
}
|
||||
}
|
||||
dataList.forEach((item, index) => {
|
||||
item.disabled = item.disable || item.disabled || false;
|
||||
if (this.multiple) {
|
||||
if (value.length > 0) {
|
||||
let have = value.find((val) => val === item[this.map.value]);
|
||||
item.selected = have !== void 0;
|
||||
} else {
|
||||
item.selected = false;
|
||||
}
|
||||
} else {
|
||||
item.selected = value === item[this.map.value];
|
||||
}
|
||||
list.push(item);
|
||||
});
|
||||
return this.setRange(list);
|
||||
},
|
||||
/**
|
||||
* 处理最大最小值
|
||||
* @param {Object} list
|
||||
*/
|
||||
setRange(list) {
|
||||
let selectList = list.filter((item) => item.selected);
|
||||
let min = Number(this.min) || 0;
|
||||
let max = Number(this.max) || "";
|
||||
list.forEach((item, index) => {
|
||||
if (this.multiple) {
|
||||
if (selectList.length <= min) {
|
||||
let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
|
||||
if (have !== void 0) {
|
||||
item.disabled = true;
|
||||
}
|
||||
}
|
||||
if (selectList.length >= max && max !== "") {
|
||||
let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
|
||||
if (have === void 0) {
|
||||
item.disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setStyles(item, index);
|
||||
list[index] = item;
|
||||
});
|
||||
return list;
|
||||
},
|
||||
/**
|
||||
* 设置 class
|
||||
* @param {Object} item
|
||||
* @param {Object} index
|
||||
*/
|
||||
setStyles(item, index) {
|
||||
item.styleBackgroud = this.setStyleBackgroud(item);
|
||||
item.styleIcon = this.setStyleIcon(item);
|
||||
item.styleIconText = this.setStyleIconText(item);
|
||||
item.styleRightIcon = this.setStyleRightIcon(item);
|
||||
},
|
||||
/**
|
||||
* 获取选中值
|
||||
* @param {Object} range
|
||||
*/
|
||||
getSelectedValue(range) {
|
||||
if (!this.multiple) return this.dataValue;
|
||||
let selectedArr = [];
|
||||
range.forEach((item) => {
|
||||
if (item.selected) {
|
||||
selectedArr.push(item[this.map.value]);
|
||||
}
|
||||
});
|
||||
return this.dataValue.length > 0 ? this.dataValue : selectedArr;
|
||||
},
|
||||
/**
|
||||
* 设置背景样式
|
||||
*/
|
||||
setStyleBackgroud(item) {
|
||||
let styles = {};
|
||||
let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
|
||||
if (this.selectedColor) {
|
||||
if (this.mode !== "list") {
|
||||
styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
|
||||
}
|
||||
if (this.mode === "tag") {
|
||||
styles["background-color"] = item.selected ? selectedColor : "#f5f5f5";
|
||||
}
|
||||
}
|
||||
let classles = "";
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`;
|
||||
}
|
||||
return classles;
|
||||
},
|
||||
setStyleIcon(item) {
|
||||
let styles = {};
|
||||
let classles = "";
|
||||
if (this.selectedColor) {
|
||||
let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
|
||||
styles["background-color"] = item.selected ? selectedColor : "#fff";
|
||||
styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
|
||||
if (!item.selected && item.disabled) {
|
||||
styles["background-color"] = "#F2F6FC";
|
||||
styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
|
||||
}
|
||||
}
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`;
|
||||
}
|
||||
return classles;
|
||||
},
|
||||
setStyleIconText(item) {
|
||||
let styles = {};
|
||||
let classles = "";
|
||||
if (this.selectedColor) {
|
||||
let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
|
||||
if (this.mode === "tag") {
|
||||
styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : "#fff" : "#666";
|
||||
} else {
|
||||
styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : selectedColor : "#666";
|
||||
}
|
||||
if (!item.selected && item.disabled) {
|
||||
styles.color = "#999";
|
||||
}
|
||||
}
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`;
|
||||
}
|
||||
return classles;
|
||||
},
|
||||
setStyleRightIcon(item) {
|
||||
let styles = {};
|
||||
let classles = "";
|
||||
if (this.mode === "list") {
|
||||
styles["border-color"] = item.selected ? this.styles.selectedColor : "#DCDFE6";
|
||||
}
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`;
|
||||
}
|
||||
return classles;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
||||
_easycom_uni_load_more2();
|
||||
}
|
||||
const _easycom_uni_load_more = () => "../../../uni-load-more/components/uni-load-more/uni-load-more.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_load_more();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !$data.isLocal
|
||||
}, !$data.isLocal ? common_vendor.e({
|
||||
b: !_ctx.mixinDatacomErrorMessage
|
||||
}, !_ctx.mixinDatacomErrorMessage ? {
|
||||
c: common_vendor.p({
|
||||
status: "loading",
|
||||
iconType: "snow",
|
||||
iconSize: 18,
|
||||
["content-text"]: $data.contentText
|
||||
})
|
||||
} : {
|
||||
d: common_vendor.t(_ctx.mixinDatacomErrorMessage)
|
||||
}) : common_vendor.e({
|
||||
e: $props.multiple
|
||||
}, $props.multiple ? {
|
||||
f: common_vendor.f($data.dataList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: $props.disabled || !!item.disabled,
|
||||
b: item[$props.map.value] + "",
|
||||
c: item.selected
|
||||
}, $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? {
|
||||
d: common_vendor.s(item.styleIcon)
|
||||
} : {}, {
|
||||
e: common_vendor.t(item[$props.map.text]),
|
||||
f: common_vendor.s(item.styleIconText)
|
||||
}, $props.mode === "list" && $props.icon === "right" ? {
|
||||
g: common_vendor.s(item.styleBackgroud)
|
||||
} : {}, {
|
||||
h: common_vendor.n(item.selected ? "is-checked" : ""),
|
||||
i: common_vendor.n($props.disabled || !!item.disabled ? "is-disable" : ""),
|
||||
j: common_vendor.n(index !== 0 && $props.mode === "list" ? "is-list-border" : ""),
|
||||
k: common_vendor.s(item.styleBackgroud),
|
||||
l: index
|
||||
});
|
||||
}),
|
||||
g: $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left",
|
||||
h: $props.mode === "list" && $props.icon === "right",
|
||||
i: $props.mode === "list" && $props.icon === "left" ? 1 : "",
|
||||
j: common_vendor.n("is--" + $props.mode),
|
||||
k: $props.mode === "list" || $props.wrap ? 1 : "",
|
||||
l: common_vendor.o((...args) => $options.chagne && $options.chagne(...args))
|
||||
} : {
|
||||
m: common_vendor.f($data.dataList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: $props.disabled || item.disabled,
|
||||
b: item[$props.map.value] + "",
|
||||
c: item.selected
|
||||
}, $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? {
|
||||
d: common_vendor.s(item.styleIcon),
|
||||
e: common_vendor.s(item.styleBackgroud)
|
||||
} : {}, {
|
||||
f: common_vendor.t(item[$props.map.text]),
|
||||
g: common_vendor.s(item.styleIconText)
|
||||
}, $props.mode === "list" && $props.icon === "right" ? {
|
||||
h: common_vendor.s(item.styleRightIcon)
|
||||
} : {}, {
|
||||
i: common_vendor.n(item.selected ? "is-checked" : ""),
|
||||
j: common_vendor.n($props.disabled || !!item.disabled ? "is-disable" : ""),
|
||||
k: common_vendor.n(index !== 0 && $props.mode === "list" ? "is-list-border" : ""),
|
||||
l: common_vendor.s(item.styleBackgroud),
|
||||
m: index
|
||||
});
|
||||
}),
|
||||
n: $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left",
|
||||
o: $props.mode === "list" && $props.icon === "right",
|
||||
p: $props.mode === "list" && $props.icon === "left" ? 1 : "",
|
||||
q: common_vendor.n("is--" + $props.mode),
|
||||
r: $props.mode === "list" ? 1 : "",
|
||||
s: $props.wrap ? 1 : "",
|
||||
t: common_vendor.o((...args) => $options.chagne && $options.chagne(...args))
|
||||
}), {
|
||||
v: $data.isTop + "px"
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
dist/dev/mp-weixin/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.json
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-load-more": "../../../uni-load-more/components/uni-load-more/uni-load-more"
|
||||
}
|
||||
}
|
||||
dist/dev/mp-weixin/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.wxml
Vendored
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-data-checklist" style="{{'margin-top:' + v}}"><block wx:if="{{a}}"><view class="uni-data-loading"><uni-load-more wx:if="{{b}}" u-i="70c629e8-0" bind:__l="__l" u-p="{{c}}"></uni-load-more><text wx:else>{{d}}</text></view></block><block wx:else><checkbox-group wx:if="{{e}}" class="{{['checklist-group', k && 'is-list']}}" bindchange="{{l}}"><label wx:for="{{f}}" wx:for-item="item" wx:key="l" class="{{['checklist-box', j, item.h, item.i, item.j]}}" style="{{item.k}}"><checkbox class="hidden" hidden disabled="{{item.a}}" value="{{item.b}}" checked="{{item.c}}"/><view wx:if="{{g}}" class="checkbox__inner" style="{{item.d}}"><view class="checkbox__inner-icon"></view></view><view class="{{['checklist-content', i && 'list-content']}}"><text class="checklist-text" style="{{item.f}}">{{item.e}}</text><view wx:if="{{h}}" class="checkobx__list" style="{{item.g}}"></view></view></label></checkbox-group><radio-group wx:else class="{{['checklist-group', r && 'is-list', s && 'is-wrap']}}" bindchange="{{t}}"><label wx:for="{{m}}" wx:for-item="item" wx:key="m" class="{{['checklist-box', q, item.i, item.j, item.k]}}" style="{{item.l}}"><radio class="hidden" hidden disabled="{{item.a}}" value="{{item.b}}" checked="{{item.c}}"/><view wx:if="{{n}}" class="radio__inner" style="{{item.e}}"><view class="radio__inner-icon" style="{{item.d}}"></view></view><view class="{{['checklist-content', p && 'list-content']}}"><text class="checklist-text" style="{{item.g}}">{{item.f}}</text><view wx:if="{{o}}" style="{{item.h}}" class="checkobx__list"></view></view></label></radio-group></block></view>
|
||||
dist/dev/mp-weixin/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.wxss
Vendored
+278
@@ -0,0 +1,278 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-data-loading {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
padding-left: 10px;
|
||||
color: #999;
|
||||
}
|
||||
.uni-data-checklist {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-data-checklist .checklist-group {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.uni-data-checklist .checklist-group.is-list {
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin: 5px 0;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .hidden {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .checklist-content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-left: 5px;
|
||||
line-height: 14px;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .checklist-content .checkobx__list {
|
||||
border-right-width: 1px;
|
||||
border-right-color: #007aff;
|
||||
border-right-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: #007aff;
|
||||
border-bottom-style: solid;
|
||||
height: 12px;
|
||||
width: 6px;
|
||||
left: -5px;
|
||||
transform-origin: center;
|
||||
transform: rotate(45deg);
|
||||
opacity: 0;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .checkbox__inner {
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 1px solid #DCDFE6;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .checkbox__inner .checkbox__inner-icon {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 5px;
|
||||
height: 8px;
|
||||
width: 4px;
|
||||
border-right-width: 1px;
|
||||
border-right-color: #fff;
|
||||
border-right-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: #fff;
|
||||
border-bottom-style: solid;
|
||||
opacity: 0;
|
||||
transform-origin: center;
|
||||
transform: rotate(40deg);
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .radio__inner {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 1px solid #DCDFE6;
|
||||
border-radius: 16px;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box .radio__inner .radio__inner-icon {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 10px;
|
||||
opacity: 0;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .checkbox__inner {
|
||||
background-color: #F2F6FC;
|
||||
border-color: #DCDFE6;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .radio__inner {
|
||||
background-color: #F2F6FC;
|
||||
border-color: #DCDFE6;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-disable .checklist-text {
|
||||
color: #999;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner {
|
||||
border-color: #2979ff;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner .checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .radio__inner {
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .radio__inner .radio__inner-icon {
|
||||
opacity: 1;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checklist-text {
|
||||
color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .checkbox__inner {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .checklist-text {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--default.is-checked.is-disable .radio__inner {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button {
|
||||
margin-right: 10px;
|
||||
padding: 5px 10px;
|
||||
border: 1px #DCDFE6 solid;
|
||||
border-radius: 3px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-disable {
|
||||
border: 1px #eee solid;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .checkbox__inner {
|
||||
background-color: #F2F6FC;
|
||||
border-color: #DCDFE6;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .radio__inner {
|
||||
background-color: #F2F6FC;
|
||||
border-color: #DCDFE6;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-disable .checklist-text {
|
||||
color: #999;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked {
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checkbox__inner {
|
||||
border-color: #2979ff;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checkbox__inner .checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .radio__inner {
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .radio__inner .radio__inner-icon {
|
||||
opacity: 1;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked .checklist-text {
|
||||
color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--button.is-checked.is-disable {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--tag {
|
||||
margin-right: 10px;
|
||||
padding: 5px 10px;
|
||||
border: 1px #DCDFE6 solid;
|
||||
border-radius: 3px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--tag .checklist-text {
|
||||
margin: 0;
|
||||
color: #666;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--tag.is-disable {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked {
|
||||
background-color: #2979ff;
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked .checklist-text {
|
||||
color: #fff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list {
|
||||
display: flex;
|
||||
padding: 10px 15px;
|
||||
padding-left: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-list-border {
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-disable .checkbox__inner {
|
||||
background-color: #F2F6FC;
|
||||
border-color: #DCDFE6;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-disable .checklist-text {
|
||||
color: #999;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checkbox__inner {
|
||||
border-color: #2979ff;
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checkbox__inner .checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .radio__inner .radio__inner-icon {
|
||||
opacity: 1;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checklist-text {
|
||||
color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checklist-content .checkobx__list {
|
||||
opacity: 1;
|
||||
border-color: #2979ff;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked.is-disable .checkbox__inner {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.uni-data-checklist .checklist-group .checklist-box.is--list.is-checked.is-disable .checklist-text {
|
||||
opacity: 0.4;
|
||||
}
|
||||
Vendored
+295
@@ -0,0 +1,295 @@
|
||||
"use strict";
|
||||
const uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker = require("../uni-data-pickerview/uni-data-picker.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const DataPickerView = () => "../uni-data-pickerview/uni-data-pickerview.js";
|
||||
const _sfc_main = {
|
||||
name: "UniDataPicker",
|
||||
emits: ["popupopened", "popupclosed", "nodeclick", "input", "change", "update:modelValue", "inputclick"],
|
||||
mixins: [uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker.dataPicker],
|
||||
components: {
|
||||
DataPickerView
|
||||
},
|
||||
props: {
|
||||
options: {
|
||||
type: [Object, Array],
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
popupTitle: {
|
||||
type: String,
|
||||
default: "请选择"
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请选择"
|
||||
},
|
||||
heightMobile: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
clearIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
split: {
|
||||
type: String,
|
||||
default: "/"
|
||||
},
|
||||
ellipsis: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isOpened: false,
|
||||
inputSelected: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.load();
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
localdata: {
|
||||
handler() {
|
||||
this.load();
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clear() {
|
||||
this._dispatchEvent([]);
|
||||
},
|
||||
onPropsChange() {
|
||||
this._treeData = [];
|
||||
this.selectedIndex = 0;
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
if (this.readonly) {
|
||||
this._processReadonly(this.localdata, this.dataValue);
|
||||
return;
|
||||
}
|
||||
if (this.isLocalData) {
|
||||
this.loadData();
|
||||
this.inputSelected = this.selected.slice(0);
|
||||
} else if (this.isCloudDataList || this.isCloudDataTree) {
|
||||
this.loading = true;
|
||||
this.getCloudDataValue().then((res) => {
|
||||
this.loading = false;
|
||||
this.inputSelected = res;
|
||||
}).catch((err) => {
|
||||
this.loading = false;
|
||||
this.errorMessage = err;
|
||||
});
|
||||
}
|
||||
},
|
||||
show() {
|
||||
this.isOpened = true;
|
||||
setTimeout(() => {
|
||||
this.$refs.pickerView.updateData({
|
||||
treeData: this._treeData,
|
||||
selected: this.selected,
|
||||
selectedIndex: this.selectedIndex
|
||||
});
|
||||
}, 200);
|
||||
this.$emit("popupopened");
|
||||
},
|
||||
hide() {
|
||||
this.isOpened = false;
|
||||
this.$emit("popupclosed");
|
||||
},
|
||||
handleInput() {
|
||||
if (this.readonly) {
|
||||
this.$emit("inputclick");
|
||||
return;
|
||||
}
|
||||
this.show();
|
||||
},
|
||||
handleClose(e) {
|
||||
this.hide();
|
||||
},
|
||||
onnodeclick(e) {
|
||||
this.$emit("nodeclick", e);
|
||||
},
|
||||
ondatachange(e) {
|
||||
this._treeData = this.$refs.pickerView._treeData;
|
||||
},
|
||||
onchange(e) {
|
||||
this.hide();
|
||||
this.$nextTick(() => {
|
||||
this.inputSelected = e;
|
||||
});
|
||||
this._dispatchEvent(e);
|
||||
},
|
||||
_processReadonly(dataList, value) {
|
||||
var isTree = dataList.findIndex((item2) => {
|
||||
return item2.children;
|
||||
});
|
||||
if (isTree > -1) {
|
||||
let inputValue;
|
||||
if (Array.isArray(value)) {
|
||||
inputValue = value[value.length - 1];
|
||||
if (typeof inputValue === "object" && inputValue.value) {
|
||||
inputValue = inputValue.value;
|
||||
}
|
||||
} else {
|
||||
inputValue = value;
|
||||
}
|
||||
this.inputSelected = this._findNodePath(inputValue, this.localdata);
|
||||
return;
|
||||
}
|
||||
if (!this.hasValue) {
|
||||
this.inputSelected = [];
|
||||
return;
|
||||
}
|
||||
let result = [];
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
var val = value[i];
|
||||
var item = dataList.find((v) => {
|
||||
return v.value == val;
|
||||
});
|
||||
if (item) {
|
||||
result.push(item);
|
||||
}
|
||||
}
|
||||
if (result.length) {
|
||||
this.inputSelected = result;
|
||||
}
|
||||
},
|
||||
_filterForArray(data, valueArray) {
|
||||
var result = [];
|
||||
for (let i = 0; i < valueArray.length; i++) {
|
||||
var value = valueArray[i];
|
||||
var found = data.find((item) => {
|
||||
return item.value == value;
|
||||
});
|
||||
if (found) {
|
||||
result.push(found);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
_dispatchEvent(selected) {
|
||||
let item = {};
|
||||
if (selected.length) {
|
||||
var value = new Array(selected.length);
|
||||
for (var i = 0; i < selected.length; i++) {
|
||||
value[i] = selected[i].value;
|
||||
}
|
||||
item = selected[selected.length - 1];
|
||||
} else {
|
||||
item.value = "";
|
||||
}
|
||||
if (this.formItem) {
|
||||
this.formItem.setValue(item.value);
|
||||
}
|
||||
this.$emit("input", item.value);
|
||||
this.$emit("update:modelValue", item.value);
|
||||
this.$emit("change", {
|
||||
detail: {
|
||||
value: selected
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
const _component_data_picker_view = common_vendor.resolveComponent("data-picker-view");
|
||||
(_easycom_uni_load_more2 + _easycom_uni_icons2 + _component_data_picker_view)();
|
||||
}
|
||||
const _easycom_uni_load_more = () => "../../../uni-load-more/components/uni-load-more/uni-load-more.js";
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_load_more + _easycom_uni_icons)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.errorMessage
|
||||
}, _ctx.errorMessage ? {
|
||||
b: common_vendor.t(_ctx.errorMessage)
|
||||
} : _ctx.loading && !$data.isOpened ? {
|
||||
d: common_vendor.p({
|
||||
contentText: _ctx.loadMore,
|
||||
status: "loading"
|
||||
})
|
||||
} : $data.inputSelected.length ? {
|
||||
f: common_vendor.f($data.inputSelected, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.text),
|
||||
b: index < $data.inputSelected.length - 1
|
||||
}, index < $data.inputSelected.length - 1 ? {
|
||||
c: common_vendor.t($props.split)
|
||||
} : {}, {
|
||||
d: index
|
||||
});
|
||||
})
|
||||
} : {
|
||||
g: common_vendor.t($props.placeholder)
|
||||
}, {
|
||||
c: _ctx.loading && !$data.isOpened,
|
||||
e: $data.inputSelected.length,
|
||||
h: $props.clearIcon && !$props.readonly && $data.inputSelected.length
|
||||
}, $props.clearIcon && !$props.readonly && $data.inputSelected.length ? {
|
||||
i: common_vendor.p({
|
||||
type: "clear",
|
||||
color: "#c0c4cc",
|
||||
size: "24"
|
||||
}),
|
||||
j: common_vendor.o((...args) => $options.clear && $options.clear(...args))
|
||||
} : {}, {
|
||||
k: (!$props.clearIcon || !$data.inputSelected.length) && !$props.readonly
|
||||
}, (!$props.clearIcon || !$data.inputSelected.length) && !$props.readonly ? {} : {}, {
|
||||
l: $props.border ? 1 : "",
|
||||
m: common_vendor.r("d", {
|
||||
options: $props.options,
|
||||
data: $data.inputSelected,
|
||||
error: _ctx.errorMessage
|
||||
}),
|
||||
n: common_vendor.o((...args) => $options.handleInput && $options.handleInput(...args)),
|
||||
o: $data.isOpened
|
||||
}, $data.isOpened ? {
|
||||
p: common_vendor.o((...args) => $options.handleClose && $options.handleClose(...args))
|
||||
} : {}, {
|
||||
q: $data.isOpened
|
||||
}, $data.isOpened ? {
|
||||
r: common_vendor.t($props.popupTitle),
|
||||
s: common_vendor.o((...args) => $options.handleClose && $options.handleClose(...args)),
|
||||
t: common_vendor.sr("pickerView", "fb9b1612-2"),
|
||||
v: common_vendor.o($options.onchange),
|
||||
w: common_vendor.o($options.ondatachange),
|
||||
x: common_vendor.o($options.onnodeclick),
|
||||
y: common_vendor.o(($event) => _ctx.dataValue = $event),
|
||||
z: common_vendor.p({
|
||||
localdata: _ctx.localdata,
|
||||
preload: _ctx.preload,
|
||||
collection: _ctx.collection,
|
||||
field: _ctx.field,
|
||||
orderby: _ctx.orderby,
|
||||
where: _ctx.where,
|
||||
["step-searh"]: _ctx.stepSearh,
|
||||
["self-field"]: _ctx.selfField,
|
||||
["parent-field"]: _ctx.parentField,
|
||||
["managed-mode"]: true,
|
||||
map: _ctx.map,
|
||||
ellipsis: $props.ellipsis,
|
||||
modelValue: _ctx.dataValue
|
||||
})
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"data-picker-view": "../uni-data-pickerview/uni-data-pickerview",
|
||||
"uni-load-more": "../../../uni-load-more/components/uni-load-more/uni-load-more",
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-data-tree"><view class="uni-data-tree-input" bindtap="{{n}}"><block wx:if="{{$slots.d}}"><slot name="d"></slot></block><block wx:else><view class="{{['input-value', l && 'input-value-border']}}"><text wx:if="{{a}}" class="selected-area error-text">{{b}}</text><view wx:elif="{{c}}" class="selected-area"><uni-load-more wx:if="{{d}}" class="load-more" u-i="fb9b1612-0" bind:__l="__l" u-p="{{d}}"></uni-load-more></view><scroll-view wx:elif="{{e}}" class="selected-area" scroll-x="true"><view class="selected-list"><view wx:for="{{f}}" wx:for-item="item" wx:key="d" class="selected-item"><text class="text-color">{{item.a}}</text><text wx:if="{{item.b}}" class="input-split-line">{{item.c}}</text></view></view></scroll-view><text wx:else class="selected-area placeholder">{{g}}</text><view wx:if="{{h}}" class="icon-clear" catchtap="{{j}}"><uni-icons wx:if="{{i}}" u-i="fb9b1612-1" bind:__l="__l" u-p="{{i}}"></uni-icons></view><view wx:if="{{k}}" class="arrow-area"><view class="input-arrow"></view></view></view></block></view><view wx:if="{{o}}" class="uni-data-tree-cover" bindtap="{{p}}"></view><view wx:if="{{q}}" class="uni-data-tree-dialog"><view class="uni-popper__arrow"></view><view class="dialog-caption"><view class="title-area"><text class="dialog-title">{{r}}</text></view><view class="dialog-close" bindtap="{{s}}"><view class="dialog-close-plus" data-id="close"></view><view class="dialog-close-plus dialog-close-rotate" data-id="close"></view></view></view><data-picker-view wx:if="{{z}}" class="picker-view r" u-r="pickerView" bindchange="{{v}}" binddatachange="{{w}}" bindnodeclick="{{x}}" u-i="fb9b1612-2" bind:__l="__l" bindupdateModelValue="{{y}}" u-p="{{z}}"></data-picker-view></view></view>
|
||||
Vendored
+229
@@ -0,0 +1,229 @@
|
||||
|
||||
.uni-data-tree {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
}
|
||||
.error-text {
|
||||
color: #DD524D;
|
||||
}
|
||||
.input-value {
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
font-size: 14px;
|
||||
/* line-height: 35px; */
|
||||
padding: 0 10px;
|
||||
padding-right: 5px;
|
||||
overflow: hidden;
|
||||
height: 35px;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.input-value-border {
|
||||
border: 1px solid #e5e5e5;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.selected-area {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
}
|
||||
.load-more {
|
||||
|
||||
margin-right: auto;
|
||||
}
|
||||
.selected-list {
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
/* padding: 0 5px; */
|
||||
}
|
||||
.selected-item {
|
||||
flex-direction: row;
|
||||
/* padding: 0 1px; */
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
.text-color {
|
||||
color: #333;
|
||||
}
|
||||
.placeholder {
|
||||
color: grey;
|
||||
font-size: 12px;
|
||||
}
|
||||
.input-split-line {
|
||||
opacity: .5;
|
||||
}
|
||||
.arrow-area {
|
||||
position: relative;
|
||||
width: 20px;
|
||||
|
||||
margin-bottom: 5px;
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
|
||||
justify-content: center;
|
||||
transform: rotate(-45deg);
|
||||
transform-origin: center;
|
||||
}
|
||||
.input-arrow {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-left: 1px solid #999;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
.uni-data-tree-cover {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, .4);
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
z-index: 100;
|
||||
}
|
||||
.uni-data-tree-dialog {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
|
||||
top: 20%;
|
||||
|
||||
|
||||
|
||||
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #FFFFFF;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
z-index: 102;
|
||||
overflow: hidden;
|
||||
}
|
||||
.dialog-caption {
|
||||
position: relative;
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
/* border-bottom: 1px solid #f0f0f0; */
|
||||
}
|
||||
.title-area {
|
||||
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
|
||||
margin: auto;
|
||||
|
||||
padding: 0 10px;
|
||||
}
|
||||
.dialog-title {
|
||||
/* font-weight: bold; */
|
||||
line-height: 44px;
|
||||
}
|
||||
.dialog-close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 15px;
|
||||
}
|
||||
.dialog-close-plus {
|
||||
width: 16px;
|
||||
height: 2px;
|
||||
background-color: #666;
|
||||
border-radius: 2px;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.dialog-close-rotate {
|
||||
position: absolute;
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
.picker-view {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
.icon-clear {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* picker 弹出层通用的指示小三角, todo:扩展至上下左右方向定位 */
|
||||
.uni-popper__arrow,
|
||||
.uni-popper__arrow::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 6px;
|
||||
}
|
||||
.uni-popper__arrow {
|
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
||||
top: -6px;
|
||||
left: 10%;
|
||||
margin-right: 3px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #EBEEF5;
|
||||
}
|
||||
.uni-popper__arrow::after {
|
||||
content: " ";
|
||||
top: 1px;
|
||||
margin-left: -6px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+547
@@ -0,0 +1,547 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const dataPicker = {
|
||||
props: {
|
||||
localdata: {
|
||||
type: [Array, Object],
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
spaceInfo: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
collection: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
action: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
field: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
orderby: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
where: {
|
||||
type: [String, Object],
|
||||
default: ""
|
||||
},
|
||||
pageData: {
|
||||
type: String,
|
||||
default: "add"
|
||||
},
|
||||
pageCurrent: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 500
|
||||
},
|
||||
getcount: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
getone: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
gettree: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
manual: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
value: {
|
||||
type: [Array, String, Number],
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
modelValue: {
|
||||
type: [Array, String, Number],
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
preload: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
stepSearh: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
selfField: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
parentField: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
map: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
text: "text",
|
||||
value: "value"
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
errorMessage: "",
|
||||
loadMore: {
|
||||
contentdown: "",
|
||||
contentrefresh: "",
|
||||
contentnomore: ""
|
||||
},
|
||||
dataList: [],
|
||||
selected: [],
|
||||
selectedIndex: 0,
|
||||
page: {
|
||||
current: this.pageCurrent,
|
||||
size: this.pageSize,
|
||||
count: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isLocalData() {
|
||||
return !this.collection.length;
|
||||
},
|
||||
isCloudData() {
|
||||
return this.collection.length > 0;
|
||||
},
|
||||
isCloudDataList() {
|
||||
return this.isCloudData && (!this.parentField && !this.selfField);
|
||||
},
|
||||
isCloudDataTree() {
|
||||
return this.isCloudData && this.parentField && this.selfField;
|
||||
},
|
||||
dataValue() {
|
||||
let isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== void 0;
|
||||
return isModelValue ? this.modelValue : this.value;
|
||||
},
|
||||
hasValue() {
|
||||
if (typeof this.dataValue === "number") {
|
||||
return true;
|
||||
}
|
||||
return this.dataValue != null && this.dataValue.length > 0;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$watch(() => {
|
||||
var al = [];
|
||||
[
|
||||
"pageCurrent",
|
||||
"pageSize",
|
||||
"spaceInfo",
|
||||
"value",
|
||||
"modelValue",
|
||||
"localdata",
|
||||
"collection",
|
||||
"action",
|
||||
"field",
|
||||
"orderby",
|
||||
"where",
|
||||
"getont",
|
||||
"getcount",
|
||||
"gettree"
|
||||
].forEach((key) => {
|
||||
al.push(this[key]);
|
||||
});
|
||||
return al;
|
||||
}, (newValue, oldValue) => {
|
||||
for (let i = 2; i < newValue.length; i++) {
|
||||
if (newValue[i] != oldValue[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newValue[0] != oldValue[0]) {
|
||||
this.page.current = this.pageCurrent;
|
||||
}
|
||||
this.page.size = this.pageSize;
|
||||
this.onPropsChange();
|
||||
});
|
||||
this._treeData = [];
|
||||
},
|
||||
methods: {
|
||||
onPropsChange() {
|
||||
this._treeData = [];
|
||||
},
|
||||
// 填充 pickview 数据
|
||||
async loadData() {
|
||||
if (this.isLocalData) {
|
||||
this.loadLocalData();
|
||||
} else if (this.isCloudDataList) {
|
||||
this.loadCloudDataList();
|
||||
} else if (this.isCloudDataTree) {
|
||||
this.loadCloudDataTree();
|
||||
}
|
||||
},
|
||||
// 加载本地数据
|
||||
async loadLocalData() {
|
||||
this._treeData = [];
|
||||
this._extractTree(this.localdata, this._treeData);
|
||||
let inputValue = this.dataValue;
|
||||
if (inputValue === void 0) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(inputValue)) {
|
||||
inputValue = inputValue[inputValue.length - 1];
|
||||
if (typeof inputValue === "object" && inputValue[this.map.value]) {
|
||||
inputValue = inputValue[this.map.value];
|
||||
}
|
||||
}
|
||||
this.selected = this._findNodePath(inputValue, this.localdata);
|
||||
},
|
||||
// 加载 Cloud 数据 (单列)
|
||||
async loadCloudDataList() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
try {
|
||||
let response = await this.getCommand();
|
||||
let responseData = response.result.data;
|
||||
this._treeData = responseData;
|
||||
this._updateBindData();
|
||||
this._updateSelected();
|
||||
this.onDataChange();
|
||||
} catch (e) {
|
||||
this.errorMessage = e;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 加载 Cloud 数据 (树形)
|
||||
async loadCloudDataTree() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
try {
|
||||
let commandOptions = {
|
||||
field: this._cloudDataPostField(),
|
||||
where: this._cloudDataTreeWhere()
|
||||
};
|
||||
if (this.gettree) {
|
||||
commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`;
|
||||
}
|
||||
let response = await this.getCommand(commandOptions);
|
||||
let responseData = response.result.data;
|
||||
this._treeData = responseData;
|
||||
this._updateBindData();
|
||||
this._updateSelected();
|
||||
this.onDataChange();
|
||||
} catch (e) {
|
||||
this.errorMessage = e;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 加载 Cloud 数据 (节点)
|
||||
async loadCloudDataNode(callback) {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
try {
|
||||
let commandOptions = {
|
||||
field: this._cloudDataPostField(),
|
||||
where: this._cloudDataNodeWhere()
|
||||
};
|
||||
let response = await this.getCommand(commandOptions);
|
||||
let responseData = response.result.data;
|
||||
callback(responseData);
|
||||
} catch (e) {
|
||||
this.errorMessage = e;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 回显 Cloud 数据
|
||||
getCloudDataValue() {
|
||||
if (this.isCloudDataList) {
|
||||
return this.getCloudDataListValue();
|
||||
}
|
||||
if (this.isCloudDataTree) {
|
||||
return this.getCloudDataTreeValue();
|
||||
}
|
||||
},
|
||||
// 回显 Cloud 数据 (单列)
|
||||
getCloudDataListValue() {
|
||||
let where = [];
|
||||
let whereField = this._getForeignKeyByField();
|
||||
if (whereField) {
|
||||
where.push(`${whereField} == '${this.dataValue}'`);
|
||||
}
|
||||
where = where.join(" || ");
|
||||
if (this.where) {
|
||||
where = `(${this.where}) && (${where})`;
|
||||
}
|
||||
return this.getCommand({
|
||||
field: this._cloudDataPostField(),
|
||||
where
|
||||
}).then((res) => {
|
||||
this.selected = res.result.data;
|
||||
return res.result.data;
|
||||
});
|
||||
},
|
||||
// 回显 Cloud 数据 (树形)
|
||||
getCloudDataTreeValue() {
|
||||
return this.getCommand({
|
||||
field: this._cloudDataPostField(),
|
||||
getTreePath: {
|
||||
startWith: `${this.selfField}=='${this.dataValue}'`
|
||||
}
|
||||
}).then((res) => {
|
||||
let treePath = [];
|
||||
this._extractTreePath(res.result.data, treePath);
|
||||
this.selected = treePath;
|
||||
return treePath;
|
||||
});
|
||||
},
|
||||
getCommand(options = {}) {
|
||||
let db = common_vendor.Ws.database(this.spaceInfo);
|
||||
const action = options.action || this.action;
|
||||
if (action) {
|
||||
db = db.action(action);
|
||||
}
|
||||
const collection = options.collection || this.collection;
|
||||
db = db.collection(collection);
|
||||
const where = options.where || this.where;
|
||||
if (!(!where || !Object.keys(where).length)) {
|
||||
db = db.where(where);
|
||||
}
|
||||
const field = options.field || this.field;
|
||||
if (field) {
|
||||
db = db.field(field);
|
||||
}
|
||||
const orderby = options.orderby || this.orderby;
|
||||
if (orderby) {
|
||||
db = db.orderBy(orderby);
|
||||
}
|
||||
const current = options.pageCurrent !== void 0 ? options.pageCurrent : this.page.current;
|
||||
const size = options.pageSize !== void 0 ? options.pageSize : this.page.size;
|
||||
const getCount = options.getcount !== void 0 ? options.getcount : this.getcount;
|
||||
const getTree = options.gettree !== void 0 ? options.gettree : this.gettree;
|
||||
const getOptions = {
|
||||
getCount,
|
||||
getTree
|
||||
};
|
||||
if (options.getTreePath) {
|
||||
getOptions.getTreePath = options.getTreePath;
|
||||
}
|
||||
db = db.skip(size * (current - 1)).limit(size).get(getOptions);
|
||||
return db;
|
||||
},
|
||||
_cloudDataPostField() {
|
||||
let fields = [this.field];
|
||||
if (this.parentField) {
|
||||
fields.push(`${this.parentField} as parent_value`);
|
||||
}
|
||||
return fields.join(",");
|
||||
},
|
||||
_cloudDataTreeWhere() {
|
||||
let result = [];
|
||||
let selected = this.selected;
|
||||
let parentField = this.parentField;
|
||||
if (parentField) {
|
||||
result.push(`${parentField} == null || ${parentField} == ""`);
|
||||
}
|
||||
if (selected.length) {
|
||||
for (var i = 0; i < selected.length - 1; i++) {
|
||||
result.push(`${parentField} == '${selected[i].value}'`);
|
||||
}
|
||||
}
|
||||
let where = [];
|
||||
if (this.where) {
|
||||
where.push(`(${this.where})`);
|
||||
}
|
||||
if (result.length) {
|
||||
where.push(`(${result.join(" || ")})`);
|
||||
}
|
||||
return where.join(" && ");
|
||||
},
|
||||
_cloudDataNodeWhere() {
|
||||
let where = [];
|
||||
let selected = this.selected;
|
||||
if (selected.length) {
|
||||
where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
|
||||
}
|
||||
where = where.join(" || ");
|
||||
if (this.where) {
|
||||
return `(${this.where}) && (${where})`;
|
||||
}
|
||||
return where;
|
||||
},
|
||||
_getWhereByForeignKey() {
|
||||
let result = [];
|
||||
let whereField = this._getForeignKeyByField();
|
||||
if (whereField) {
|
||||
result.push(`${whereField} == '${this.dataValue}'`);
|
||||
}
|
||||
if (this.where) {
|
||||
return `(${this.where}) && (${result.join(" || ")})`;
|
||||
}
|
||||
return result.join(" || ");
|
||||
},
|
||||
_getForeignKeyByField() {
|
||||
let fields = this.field.split(",");
|
||||
let whereField = null;
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
const items = fields[i].split("as");
|
||||
if (items.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if (items[1].trim() === "value") {
|
||||
whereField = items[0].trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return whereField;
|
||||
},
|
||||
_updateBindData(node) {
|
||||
const {
|
||||
dataList,
|
||||
hasNodes
|
||||
} = this._filterData(this._treeData, this.selected);
|
||||
let isleaf = this._stepSearh === false && !hasNodes;
|
||||
if (node) {
|
||||
node.isleaf = isleaf;
|
||||
}
|
||||
this.dataList = dataList;
|
||||
this.selectedIndex = dataList.length - 1;
|
||||
if (!isleaf && this.selected.length < dataList.length) {
|
||||
this.selected.push({
|
||||
value: null,
|
||||
text: "请选择"
|
||||
});
|
||||
}
|
||||
return {
|
||||
isleaf,
|
||||
hasNodes
|
||||
};
|
||||
},
|
||||
_updateSelected() {
|
||||
let dl = this.dataList;
|
||||
let sl = this.selected;
|
||||
let textField = this.map.text;
|
||||
let valueField = this.map.value;
|
||||
for (let i = 0; i < sl.length; i++) {
|
||||
let value = sl[i].value;
|
||||
let dl2 = dl[i];
|
||||
for (let j = 0; j < dl2.length; j++) {
|
||||
let item2 = dl2[j];
|
||||
if (item2[valueField] === value) {
|
||||
sl[i].text = item2[textField];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_filterData(data, paths) {
|
||||
let dataList = [];
|
||||
let hasNodes = true;
|
||||
dataList.push(data.filter((item) => {
|
||||
return item.parent_value === null || item.parent_value === void 0 || item.parent_value === "";
|
||||
}));
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
let value = paths[i].value;
|
||||
let nodes = data.filter((item) => {
|
||||
return item.parent_value === value;
|
||||
});
|
||||
if (nodes.length) {
|
||||
dataList.push(nodes);
|
||||
} else {
|
||||
hasNodes = false;
|
||||
}
|
||||
}
|
||||
return {
|
||||
dataList,
|
||||
hasNodes
|
||||
};
|
||||
},
|
||||
_extractTree(nodes, result, parent_value) {
|
||||
let valueField = this.map.value;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
let node = nodes[i];
|
||||
let child = {};
|
||||
for (let key in node) {
|
||||
if (key !== "children") {
|
||||
child[key] = node[key];
|
||||
}
|
||||
}
|
||||
if (parent_value !== null && parent_value !== void 0 && parent_value !== "") {
|
||||
child.parent_value = parent_value;
|
||||
}
|
||||
result.push(child);
|
||||
let children = node.children;
|
||||
if (children) {
|
||||
this._extractTree(children, result, node[valueField]);
|
||||
}
|
||||
}
|
||||
},
|
||||
_extractTreePath(nodes, result) {
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
let node = nodes[i];
|
||||
let child = {};
|
||||
for (let key in node) {
|
||||
if (key !== "children") {
|
||||
child[key] = node[key];
|
||||
}
|
||||
}
|
||||
result.push(child);
|
||||
let children = node.children;
|
||||
if (children) {
|
||||
this._extractTreePath(children, result);
|
||||
}
|
||||
}
|
||||
},
|
||||
_findNodePath(key, nodes, path = []) {
|
||||
let textField = this.map.text;
|
||||
let valueField = this.map.value;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
let node = nodes[i];
|
||||
let children = node.children;
|
||||
let text = node[textField];
|
||||
let value = node[valueField];
|
||||
path.push({
|
||||
value,
|
||||
text
|
||||
});
|
||||
if (value === key) {
|
||||
return path;
|
||||
}
|
||||
if (children) {
|
||||
const p = this._findNodePath(key, children, path);
|
||||
if (p.length) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
path.pop();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.dataPicker = dataPicker;
|
||||
dist/dev/mp-weixin/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.js
Vendored
+152
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
const uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker = require("./uni-data-picker.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniDataPickerView",
|
||||
emits: ["nodeclick", "change", "datachange", "update:modelValue"],
|
||||
mixins: [uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker.dataPicker],
|
||||
props: {
|
||||
managedMode: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
ellipsis: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.managedMode) {
|
||||
this.$nextTick(() => {
|
||||
this.loadData();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPropsChange() {
|
||||
this._treeData = [];
|
||||
this.selectedIndex = 0;
|
||||
this.$nextTick(() => {
|
||||
this.loadData();
|
||||
});
|
||||
},
|
||||
handleSelect(index) {
|
||||
this.selectedIndex = index;
|
||||
},
|
||||
handleNodeClick(item, i, j) {
|
||||
if (item.disable) {
|
||||
return;
|
||||
}
|
||||
const node = this.dataList[i][j];
|
||||
const text = node[this.map.text];
|
||||
const value = node[this.map.value];
|
||||
if (i < this.selected.length - 1) {
|
||||
this.selected.splice(i, this.selected.length - i);
|
||||
this.selected.push({
|
||||
text,
|
||||
value
|
||||
});
|
||||
} else if (i === this.selected.length - 1) {
|
||||
this.selected.splice(i, 1, {
|
||||
text,
|
||||
value
|
||||
});
|
||||
}
|
||||
if (node.isleaf) {
|
||||
this.onSelectedChange(node, node.isleaf);
|
||||
return;
|
||||
}
|
||||
const {
|
||||
isleaf,
|
||||
hasNodes
|
||||
} = this._updateBindData();
|
||||
if (this.isLocalData) {
|
||||
this.onSelectedChange(node, !hasNodes || isleaf);
|
||||
} else if (this.isCloudDataList) {
|
||||
this.onSelectedChange(node, true);
|
||||
} else if (this.isCloudDataTree) {
|
||||
if (isleaf) {
|
||||
this.onSelectedChange(node, node.isleaf);
|
||||
} else if (!hasNodes) {
|
||||
this.loadCloudDataNode((data) => {
|
||||
if (!data.length) {
|
||||
node.isleaf = true;
|
||||
} else {
|
||||
this._treeData.push(...data);
|
||||
this._updateBindData(node);
|
||||
}
|
||||
this.onSelectedChange(node, node.isleaf);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
updateData(data) {
|
||||
this._treeData = data.treeData;
|
||||
this.selected = data.selected;
|
||||
if (!this._treeData.length) {
|
||||
this.loadData();
|
||||
} else {
|
||||
this._updateBindData();
|
||||
}
|
||||
},
|
||||
onDataChange() {
|
||||
this.$emit("datachange");
|
||||
},
|
||||
onSelectedChange(node, isleaf) {
|
||||
if (isleaf) {
|
||||
this._dispatchEvent();
|
||||
}
|
||||
if (node) {
|
||||
this.$emit("nodeclick", node);
|
||||
}
|
||||
},
|
||||
_dispatchEvent() {
|
||||
this.$emit("change", this.selected.slice(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
||||
_easycom_uni_load_more2();
|
||||
}
|
||||
const _easycom_uni_load_more = () => "../../../uni-load-more/components/uni-load-more/uni-load-more.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_load_more();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !_ctx.isCloudDataList
|
||||
}, !_ctx.isCloudDataList ? {
|
||||
b: common_vendor.f(_ctx.selected, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.text || ""),
|
||||
b: index,
|
||||
c: index == _ctx.selectedIndex ? 1 : "",
|
||||
d: common_vendor.o(($event) => $options.handleSelect(index), index)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
c: common_vendor.f(_ctx.dataList[_ctx.selectedIndex], (item, j, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item[_ctx.map.text]),
|
||||
b: _ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value
|
||||
}, _ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value ? {} : {}, {
|
||||
c: !!item.disable ? 1 : "",
|
||||
d: j,
|
||||
e: common_vendor.o(($event) => $options.handleNodeClick(item, _ctx.selectedIndex, j), j)
|
||||
});
|
||||
}),
|
||||
d: _ctx.loading
|
||||
}, _ctx.loading ? {
|
||||
e: common_vendor.p({
|
||||
contentText: _ctx.loadMore,
|
||||
status: "loading"
|
||||
})
|
||||
} : {}, {
|
||||
f: _ctx.errorMessage
|
||||
}, _ctx.errorMessage ? {
|
||||
g: common_vendor.t(_ctx.errorMessage)
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-load-more": "../../../uni-load-more/components/uni-load-more/uni-load-more"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-data-pickerview"><scroll-view wx:if="{{a}}" class="selected-area" scroll-x="true"><view class="selected-list"><view wx:for="{{b}}" wx:for-item="item" wx:key="b" class="{{['selected-item', item.c && 'selected-item-active']}}" bindtap="{{item.d}}"><text>{{item.a}}</text></view></view></scroll-view><view class="tab-c"><scroll-view class="list" scroll-y="{{true}}"><view wx:for="{{c}}" wx:for-item="item" wx:key="d" class="{{['item', item.c && 'is-disabled']}}" bindtap="{{item.e}}"><text class="item-text">{{item.a}}</text><view wx:if="{{item.b}}" class="check"></view></view></scroll-view><view wx:if="{{d}}" class="loading-cover"><uni-load-more wx:if="{{e}}" class="load-more" u-i="51653c41-0" bind:__l="__l" u-p="{{e}}"></uni-load-more></view><view wx:if="{{f}}" class="error-message"><text class="error-text">{{g}}</text></view></view></view>
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-data-pickerview {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.error-text {
|
||||
color: #DD524D;
|
||||
}
|
||||
.loading-cover {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
z-index: 1001;
|
||||
}
|
||||
.load-more {
|
||||
margin: auto;
|
||||
}
|
||||
.error-message {
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 15px;
|
||||
opacity: 0.9;
|
||||
z-index: 102;
|
||||
}
|
||||
.selected-list {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
padding: 0 5px;
|
||||
border-bottom: 1px solid #f8f8f8;
|
||||
}
|
||||
.selected-item {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.selected-item-text-overflow {
|
||||
width: 168px;
|
||||
/* fix nvue */
|
||||
overflow: hidden;
|
||||
width: 6em;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
}
|
||||
.selected-item-active {
|
||||
border-bottom: 2px solid #007aff;
|
||||
}
|
||||
.selected-item-text {
|
||||
color: #007aff;
|
||||
}
|
||||
.tab-c {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
}
|
||||
.list {
|
||||
flex: 1;
|
||||
}
|
||||
.item {
|
||||
padding: 12px 15px;
|
||||
/* border-bottom: 1px solid #f0f0f0; */
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.is-disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.item-text {
|
||||
/* flex: 1; */
|
||||
color: #333333;
|
||||
}
|
||||
.item-text-overflow {
|
||||
width: 280px;
|
||||
/* fix nvue */
|
||||
overflow: hidden;
|
||||
width: 20em;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
}
|
||||
.check {
|
||||
margin-right: 5px;
|
||||
border: 2px solid #007aff;
|
||||
border-left: 0;
|
||||
border-top: 0;
|
||||
height: 12px;
|
||||
width: 6px;
|
||||
transform-origin: center;
|
||||
transition: all 0.3s;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
Vendored
+317
@@ -0,0 +1,317 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uni-data-select",
|
||||
mixins: [common_vendor.Ws.mixinDatacom || {}],
|
||||
props: {
|
||||
localdata: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请选择"
|
||||
},
|
||||
emptyTips: {
|
||||
type: String,
|
||||
default: "无选项"
|
||||
},
|
||||
clear: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
defItem: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
|
||||
format: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
placement: {
|
||||
type: String,
|
||||
default: "bottom"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelector: false,
|
||||
current: "",
|
||||
mixinDatacomResData: [],
|
||||
apps: [],
|
||||
channels: [],
|
||||
cacheKey: "uni-data-select-lastSelectedValue"
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.debounceGet = this.debounce(() => {
|
||||
this.query();
|
||||
}, 300);
|
||||
if (this.collection && !this.localdata.length) {
|
||||
this.debounceGet();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
typePlaceholder() {
|
||||
const text = {
|
||||
"opendb-stat-app-versions": "版本",
|
||||
"opendb-app-channels": "渠道",
|
||||
"opendb-app-list": "应用"
|
||||
};
|
||||
const common = this.placeholder;
|
||||
const placeholder = text[this.collection];
|
||||
return placeholder ? common + placeholder : common;
|
||||
},
|
||||
valueCom() {
|
||||
return this.modelValue;
|
||||
},
|
||||
textShow() {
|
||||
let text = this.current;
|
||||
if (text.length > 10) {
|
||||
return text.slice(0, 25) + "...";
|
||||
}
|
||||
return text;
|
||||
},
|
||||
getOffsetByPlacement() {
|
||||
switch (this.placement) {
|
||||
case "top":
|
||||
return "bottom:calc(100% + 12px);";
|
||||
case "bottom":
|
||||
return "top:calc(100% + 12px);";
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
localdata: {
|
||||
immediate: true,
|
||||
handler(val, old) {
|
||||
if (Array.isArray(val) && old !== val) {
|
||||
this.mixinDatacomResData = val;
|
||||
}
|
||||
}
|
||||
},
|
||||
valueCom(val, old) {
|
||||
this.initDefVal();
|
||||
},
|
||||
mixinDatacomResData: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val.length) {
|
||||
this.initDefVal();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
debounce(fn, time = 100) {
|
||||
let timer = null;
|
||||
return function(...args) {
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
}, time);
|
||||
};
|
||||
},
|
||||
// 执行数据库查询
|
||||
query() {
|
||||
this.mixinDatacomEasyGet();
|
||||
},
|
||||
// 监听查询条件变更事件
|
||||
onMixinDatacomPropsChange() {
|
||||
if (this.collection) {
|
||||
this.debounceGet();
|
||||
}
|
||||
},
|
||||
initDefVal() {
|
||||
let defValue = "";
|
||||
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
||||
defValue = this.valueCom;
|
||||
} else {
|
||||
let strogeValue;
|
||||
if (this.collection) {
|
||||
strogeValue = this.getCache();
|
||||
}
|
||||
if (strogeValue || strogeValue === 0) {
|
||||
defValue = strogeValue;
|
||||
} else {
|
||||
let defItem = "";
|
||||
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
||||
defItem = this.mixinDatacomResData[this.defItem - 1].value;
|
||||
}
|
||||
defValue = defItem;
|
||||
}
|
||||
if (defValue || defValue === 0) {
|
||||
this.emit(defValue);
|
||||
}
|
||||
}
|
||||
const def = this.mixinDatacomResData.find((item) => item.value === defValue);
|
||||
this.current = def ? this.formatItemName(def) : "";
|
||||
},
|
||||
/**
|
||||
* @param {[String, Number]} value
|
||||
* 判断用户给的 value 是否同时为禁用状态
|
||||
*/
|
||||
isDisabled(value) {
|
||||
let isDisabled = false;
|
||||
this.mixinDatacomResData.forEach((item) => {
|
||||
if (item.value === value) {
|
||||
isDisabled = item.disable;
|
||||
}
|
||||
});
|
||||
return isDisabled;
|
||||
},
|
||||
clearVal() {
|
||||
this.emit("");
|
||||
if (this.collection) {
|
||||
this.removeCache();
|
||||
}
|
||||
},
|
||||
change(item) {
|
||||
if (!item.disable) {
|
||||
this.showSelector = false;
|
||||
this.current = this.formatItemName(item);
|
||||
this.emit(item.value);
|
||||
}
|
||||
},
|
||||
emit(val) {
|
||||
this.$emit("input", val);
|
||||
this.$emit("update:modelValue", val);
|
||||
this.$emit("change", val);
|
||||
if (this.collection) {
|
||||
this.setCache(val);
|
||||
}
|
||||
},
|
||||
toggleSelector() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
this.showSelector = !this.showSelector;
|
||||
},
|
||||
formatItemName(item) {
|
||||
let {
|
||||
text,
|
||||
value,
|
||||
channel_code
|
||||
} = item;
|
||||
channel_code = channel_code ? `(${channel_code})` : "";
|
||||
if (this.format) {
|
||||
let str = "";
|
||||
str = this.format;
|
||||
for (let key in item) {
|
||||
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return this.collection.indexOf("app-list") > 0 ? `${text}(${value})` : text ? text : `未命名${channel_code}`;
|
||||
}
|
||||
},
|
||||
// 获取当前加载的数据
|
||||
getLoadData() {
|
||||
return this.mixinDatacomResData;
|
||||
},
|
||||
// 获取当前缓存key
|
||||
getCurrentCacheKey() {
|
||||
return this.collection;
|
||||
},
|
||||
// 获取缓存
|
||||
getCache(name = this.getCurrentCacheKey()) {
|
||||
let cacheData = common_vendor.index.getStorageSync(this.cacheKey) || {};
|
||||
return cacheData[name];
|
||||
},
|
||||
// 设置缓存
|
||||
setCache(value, name = this.getCurrentCacheKey()) {
|
||||
let cacheData = common_vendor.index.getStorageSync(this.cacheKey) || {};
|
||||
cacheData[name] = value;
|
||||
common_vendor.index.setStorageSync(this.cacheKey, cacheData);
|
||||
},
|
||||
// 删除缓存
|
||||
removeCache(name = this.getCurrentCacheKey()) {
|
||||
let cacheData = common_vendor.index.getStorageSync(this.cacheKey) || {};
|
||||
delete cacheData[name];
|
||||
common_vendor.index.setStorageSync(this.cacheKey, cacheData);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
_easycom_uni_icons2();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_icons();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.label
|
||||
}, $props.label ? {
|
||||
b: common_vendor.t($props.label + ":")
|
||||
} : {}, {
|
||||
c: $data.current
|
||||
}, $data.current ? {
|
||||
d: common_vendor.t($options.textShow)
|
||||
} : {
|
||||
e: common_vendor.t($options.typePlaceholder)
|
||||
}, {
|
||||
f: $data.current && $props.clear && !$props.disabled
|
||||
}, $data.current && $props.clear && !$props.disabled ? {
|
||||
g: common_vendor.p({
|
||||
type: "clear",
|
||||
color: "#c0c4cc",
|
||||
size: "24"
|
||||
}),
|
||||
h: common_vendor.o((...args) => $options.clearVal && $options.clearVal(...args))
|
||||
} : {
|
||||
i: common_vendor.p({
|
||||
type: $data.showSelector ? "top" : "bottom",
|
||||
size: "14",
|
||||
color: "#999"
|
||||
})
|
||||
}, {
|
||||
j: common_vendor.o((...args) => $options.toggleSelector && $options.toggleSelector(...args)),
|
||||
k: $data.showSelector
|
||||
}, $data.showSelector ? {
|
||||
l: common_vendor.o((...args) => $options.toggleSelector && $options.toggleSelector(...args))
|
||||
} : {}, {
|
||||
m: $data.showSelector
|
||||
}, $data.showSelector ? common_vendor.e({
|
||||
n: common_vendor.n($props.placement == "bottom" ? "uni-popper__arrow_bottom" : "uni-popper__arrow_top"),
|
||||
o: $data.mixinDatacomResData.length === 0
|
||||
}, $data.mixinDatacomResData.length === 0 ? {
|
||||
p: common_vendor.t($props.emptyTips)
|
||||
} : {
|
||||
q: common_vendor.f($data.mixinDatacomResData, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t($options.formatItemName(item)),
|
||||
b: item.disable ? 1 : "",
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.change(item), index)
|
||||
};
|
||||
})
|
||||
}, {
|
||||
r: common_vendor.s($options.getOffsetByPlacement)
|
||||
}) : {}, {
|
||||
s: $props.disabled ? 1 : "",
|
||||
t: $data.current ? 1 : ""
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-stat__select"><label wx:if="{{a}}" class="uni-label-text hide-on-phone">{{b}}</label><view class="{{['uni-stat-box', t && 'uni-stat__actived']}}"><view class="{{['uni-select', s && 'uni-select--disabled']}}"><view class="uni-select__input-box" bindtap="{{j}}"><view wx:if="{{c}}" class="uni-select__input-text">{{d}}</view><view wx:else class="uni-select__input-text uni-select__input-placeholder">{{e}}</view><view wx:if="{{f}}" catchtap="{{h}}"><uni-icons wx:if="{{g}}" u-i="a27774b6-0" bind:__l="__l" u-p="{{g}}"/></view><view wx:else><uni-icons wx:if="{{i}}" u-i="a27774b6-1" bind:__l="__l" u-p="{{i}}"/></view></view><view wx:if="{{k}}" class="uni-select--mask" bindtap="{{l}}"/><view wx:if="{{m}}" class="uni-select__selector" style="{{r}}"><view class="{{n}}"></view><scroll-view scroll-y="true" class="uni-select__selector-scroll"><view wx:if="{{o}}" class="uni-select__selector-empty"><text>{{p}}</text></view><block wx:else><view wx:for="{{q}}" wx:for-item="item" wx:key="c" class="uni-select__selector-item" bindtap="{{item.d}}"><text class="{{[item.b && 'uni-select__selector__disabled']}}">{{item.a}}</text></view></block></scroll-view></view></view></view></view>
|
||||
Vendored
+200
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
@media screen and (max-width: 500px) {
|
||||
.hide-on-phone {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.uni-stat__select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-stat-box {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-stat__actived {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-label-text {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #6a6a6a;
|
||||
margin: auto 0;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.uni-select {
|
||||
font-size: 14px;
|
||||
border: 1px solid #e5e5e5;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
padding-left: 10px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-bottom: solid 1px #e5e5e5;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
height: 35px;
|
||||
}
|
||||
.uni-select--disabled {
|
||||
background-color: #f5f7fa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.uni-select__label {
|
||||
font-size: 16px;
|
||||
height: 35px;
|
||||
padding-right: 10px;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-select__input-box {
|
||||
height: 35px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-select__input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.uni-select__input-plac {
|
||||
font-size: 14px;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-select__selector {
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
border: 1px solid #EBEEF5;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
z-index: 3;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.uni-select__selector-scroll {
|
||||
max-height: 200px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-select__selector-empty,
|
||||
.uni-select__selector-item {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
line-height: 35px;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
/* border-bottom: solid 1px $uni-border-3; */
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.uni-select__selector-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.uni-select__selector-empty:last-child,
|
||||
.uni-select__selector-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.uni-select__selector__disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* picker 弹出层通用的指示小三角 */
|
||||
.uni-popper__arrow_bottom,
|
||||
.uni-popper__arrow_bottom::after,
|
||||
.uni-popper__arrow_top,
|
||||
.uni-popper__arrow_top::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 6px;
|
||||
}
|
||||
.uni-popper__arrow_bottom {
|
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
||||
top: -6px;
|
||||
left: 10%;
|
||||
margin-right: 3px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #EBEEF5;
|
||||
}
|
||||
.uni-popper__arrow_bottom::after {
|
||||
content: " ";
|
||||
top: 1px;
|
||||
margin-left: -6px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.uni-popper__arrow_top {
|
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
||||
bottom: -6px;
|
||||
left: 10%;
|
||||
margin-right: 3px;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #EBEEF5;
|
||||
}
|
||||
.uni-popper__arrow_top::after {
|
||||
content: " ";
|
||||
bottom: 1px;
|
||||
margin-left: -6px;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
.uni-select__input-text {
|
||||
width: 100%;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-select__input-placeholder {
|
||||
color: #6a6a6a;
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-select--mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
+447
@@ -0,0 +1,447 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
function obj2strClass(obj) {
|
||||
let classess = "";
|
||||
for (let key in obj) {
|
||||
const val = obj[key];
|
||||
if (val) {
|
||||
classess += `${key} `;
|
||||
}
|
||||
}
|
||||
return classess;
|
||||
}
|
||||
function obj2strStyle(obj) {
|
||||
let style = "";
|
||||
for (let key in obj) {
|
||||
const val = obj[key];
|
||||
style += `${key}:${val};`;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
const _sfc_main = {
|
||||
name: "uni-easyinput",
|
||||
emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
|
||||
model: {
|
||||
prop: "modelValue",
|
||||
event: "update:modelValue"
|
||||
},
|
||||
options: {
|
||||
virtualHost: true
|
||||
},
|
||||
inject: {
|
||||
form: {
|
||||
from: "uniForm",
|
||||
default: null
|
||||
},
|
||||
formItem: {
|
||||
from: "uniFormItem",
|
||||
default: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
name: String,
|
||||
value: [Number, String],
|
||||
modelValue: [Number, String],
|
||||
type: {
|
||||
type: String,
|
||||
default: "text"
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
autoHeight: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: " "
|
||||
},
|
||||
placeholderStyle: String,
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
maxlength: {
|
||||
type: [Number, String],
|
||||
default: 140
|
||||
},
|
||||
confirmType: {
|
||||
type: String,
|
||||
default: "done"
|
||||
},
|
||||
clearSize: {
|
||||
type: [Number, String],
|
||||
default: 24
|
||||
},
|
||||
inputBorder: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
trim: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
cursorSpacing: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
passwordIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
primaryColor: {
|
||||
type: String,
|
||||
default: "#2979ff"
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
color: "#333",
|
||||
backgroundColor: "#fff",
|
||||
disableColor: "#F7F6F6",
|
||||
borderColor: "#e5e5e5"
|
||||
};
|
||||
}
|
||||
},
|
||||
errorMessage: {
|
||||
type: [String, Boolean],
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
focused: false,
|
||||
val: "",
|
||||
showMsg: "",
|
||||
border: false,
|
||||
isFirstBorder: false,
|
||||
showClearIcon: false,
|
||||
showPassword: false,
|
||||
focusShow: false,
|
||||
localMsg: "",
|
||||
isEnter: false
|
||||
// 用于判断当前是否是使用回车操作
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 输入框内是否有值
|
||||
isVal() {
|
||||
const val = this.val;
|
||||
if (val || val === 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
msg() {
|
||||
return this.localMsg || this.errorMessage;
|
||||
},
|
||||
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
||||
inputMaxlength() {
|
||||
return Number(this.maxlength);
|
||||
},
|
||||
// 处理外层样式的style
|
||||
boxStyle() {
|
||||
return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
|
||||
},
|
||||
// input 内容的类和样式处理
|
||||
inputContentClass() {
|
||||
return obj2strClass({
|
||||
"is-input-border": this.inputBorder,
|
||||
"is-input-error-border": this.inputBorder && this.msg,
|
||||
"is-textarea": this.type === "textarea",
|
||||
"is-disabled": this.disabled,
|
||||
"is-focused": this.focusShow
|
||||
});
|
||||
},
|
||||
inputContentStyle() {
|
||||
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
|
||||
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
|
||||
return obj2strStyle({
|
||||
"border-color": borderColor || "#e5e5e5",
|
||||
"background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
|
||||
});
|
||||
},
|
||||
// input右侧样式
|
||||
inputStyle() {
|
||||
const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
|
||||
return obj2strStyle({
|
||||
"padding-right": paddingRight,
|
||||
"padding-left": this.prefixIcon ? "" : "10px"
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
this.val = newVal;
|
||||
},
|
||||
modelValue(newVal) {
|
||||
this.val = newVal;
|
||||
},
|
||||
focus(newVal) {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus;
|
||||
this.focusShow = this.focus;
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
if (this.form && this.formItem) {
|
||||
this.$watch("formItem.errMsg", (newVal) => {
|
||||
this.localMsg = newVal;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus;
|
||||
this.focusShow = this.focus;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 初始化变量值
|
||||
*/
|
||||
init() {
|
||||
if (this.value || this.value === 0) {
|
||||
this.val = this.value;
|
||||
} else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
|
||||
this.val = this.modelValue;
|
||||
} else {
|
||||
this.val = null;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 点击图标时触发
|
||||
* @param {Object} type
|
||||
*/
|
||||
onClickIcon(type) {
|
||||
this.$emit("iconClick", type);
|
||||
},
|
||||
/**
|
||||
* 显示隐藏内容,密码框时生效
|
||||
*/
|
||||
onEyes() {
|
||||
this.showPassword = !this.showPassword;
|
||||
this.$emit("eyes", this.showPassword);
|
||||
},
|
||||
/**
|
||||
* 输入时触发
|
||||
* @param {Object} event
|
||||
*/
|
||||
onInput(event) {
|
||||
let value = event.detail.value;
|
||||
if (this.trim) {
|
||||
if (typeof this.trim === "boolean" && this.trim) {
|
||||
value = this.trimStr(value);
|
||||
}
|
||||
if (typeof this.trim === "string") {
|
||||
value = this.trimStr(value, this.trim);
|
||||
}
|
||||
}
|
||||
if (this.errMsg) this.errMsg = "";
|
||||
this.val = value;
|
||||
this.$emit("input", value);
|
||||
this.$emit("update:modelValue", value);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 获取焦点时触发
|
||||
* @param {Object} event
|
||||
*/
|
||||
onFocus() {
|
||||
this.$nextTick(() => {
|
||||
this.focused = true;
|
||||
});
|
||||
this.$emit("focus", null);
|
||||
},
|
||||
_Focus(event) {
|
||||
this.focusShow = true;
|
||||
this.$emit("focus", event);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 失去焦点时触发
|
||||
* @param {Object} event
|
||||
*/
|
||||
onBlur() {
|
||||
this.focused = false;
|
||||
this.$emit("focus", null);
|
||||
},
|
||||
_Blur(event) {
|
||||
event.detail.value;
|
||||
this.focusShow = false;
|
||||
this.$emit("blur", event);
|
||||
if (this.isEnter === false) {
|
||||
this.$emit("change", this.val);
|
||||
}
|
||||
if (this.form && this.formItem) {
|
||||
const { validateTrigger } = this.form;
|
||||
if (validateTrigger === "blur") {
|
||||
this.formItem.onFieldChange();
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 按下键盘的发送键
|
||||
* @param {Object} e
|
||||
*/
|
||||
onConfirm(e) {
|
||||
this.$emit("confirm", this.val);
|
||||
this.isEnter = true;
|
||||
this.$emit("change", this.val);
|
||||
this.$nextTick(() => {
|
||||
this.isEnter = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 清理内容
|
||||
* @param {Object} event
|
||||
*/
|
||||
onClear(event) {
|
||||
this.val = "";
|
||||
this.$emit("input", "");
|
||||
this.$emit("update:modelValue", "");
|
||||
this.$emit("clear");
|
||||
},
|
||||
/**
|
||||
* 键盘高度发生变化的时候触发此事件
|
||||
* 兼容性:微信小程序2.7.0+、App 3.1.0+
|
||||
* @param {Object} event
|
||||
*/
|
||||
onkeyboardheightchange(event) {
|
||||
this.$emit("keyboardheightchange", event);
|
||||
},
|
||||
/**
|
||||
* 去除空格
|
||||
*/
|
||||
trimStr(str, pos = "both") {
|
||||
if (pos === "both") {
|
||||
return str.trim();
|
||||
} else if (pos === "left") {
|
||||
return str.trimLeft();
|
||||
} else if (pos === "right") {
|
||||
return str.trimRight();
|
||||
} else if (pos === "start") {
|
||||
return str.trimStart();
|
||||
} else if (pos === "end") {
|
||||
return str.trimEnd();
|
||||
} else if (pos === "all") {
|
||||
return str.replace(/\s+/g, "");
|
||||
} else if (pos === "none") {
|
||||
return str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
_easycom_uni_icons2();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_icons();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.prefixIcon
|
||||
}, $props.prefixIcon ? {
|
||||
b: common_vendor.o(($event) => $options.onClickIcon("prefix")),
|
||||
c: common_vendor.p({
|
||||
type: $props.prefixIcon,
|
||||
color: "#c0c4cc",
|
||||
size: "22"
|
||||
})
|
||||
} : {}, {
|
||||
d: $props.type === "textarea"
|
||||
}, $props.type === "textarea" ? {
|
||||
e: $props.inputBorder ? 1 : "",
|
||||
f: $props.name,
|
||||
g: $data.val,
|
||||
h: $props.placeholder,
|
||||
i: $props.placeholderStyle,
|
||||
j: $props.disabled,
|
||||
k: $options.inputMaxlength,
|
||||
l: $data.focused,
|
||||
m: $props.autoHeight,
|
||||
n: $props.cursorSpacing,
|
||||
o: common_vendor.o((...args) => $options.onInput && $options.onInput(...args)),
|
||||
p: common_vendor.o((...args) => $options._Blur && $options._Blur(...args)),
|
||||
q: common_vendor.o((...args) => $options._Focus && $options._Focus(...args)),
|
||||
r: common_vendor.o((...args) => $options.onConfirm && $options.onConfirm(...args)),
|
||||
s: common_vendor.o((...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
|
||||
} : {
|
||||
t: $props.type === "password" ? "text" : $props.type,
|
||||
v: common_vendor.s($options.inputStyle),
|
||||
w: $props.name,
|
||||
x: $data.val,
|
||||
y: !$data.showPassword && $props.type === "password",
|
||||
z: $props.placeholder,
|
||||
A: $props.placeholderStyle,
|
||||
B: $props.disabled,
|
||||
C: $options.inputMaxlength,
|
||||
D: $data.focused,
|
||||
E: $props.confirmType,
|
||||
F: $props.cursorSpacing,
|
||||
G: common_vendor.o((...args) => $options._Focus && $options._Focus(...args)),
|
||||
H: common_vendor.o((...args) => $options._Blur && $options._Blur(...args)),
|
||||
I: common_vendor.o((...args) => $options.onInput && $options.onInput(...args)),
|
||||
J: common_vendor.o((...args) => $options.onConfirm && $options.onConfirm(...args)),
|
||||
K: common_vendor.o((...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
|
||||
}, {
|
||||
L: $props.type === "password" && $props.passwordIcon
|
||||
}, $props.type === "password" && $props.passwordIcon ? common_vendor.e({
|
||||
M: $options.isVal
|
||||
}, $options.isVal ? {
|
||||
N: $props.type === "textarea" ? 1 : "",
|
||||
O: common_vendor.o($options.onEyes),
|
||||
P: common_vendor.p({
|
||||
type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
|
||||
size: 22,
|
||||
color: $data.focusShow ? $props.primaryColor : "#c0c4cc"
|
||||
})
|
||||
} : {}) : $props.suffixIcon ? common_vendor.e({
|
||||
R: $props.suffixIcon
|
||||
}, $props.suffixIcon ? {
|
||||
S: common_vendor.o(($event) => $options.onClickIcon("suffix")),
|
||||
T: common_vendor.p({
|
||||
type: $props.suffixIcon,
|
||||
color: "#c0c4cc",
|
||||
size: "22"
|
||||
})
|
||||
} : {}) : common_vendor.e({
|
||||
U: $props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea"
|
||||
}, $props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? {
|
||||
V: $props.type === "textarea" ? 1 : "",
|
||||
W: common_vendor.o($options.onClear),
|
||||
X: common_vendor.p({
|
||||
type: "clear",
|
||||
size: $props.clearSize,
|
||||
color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc"
|
||||
})
|
||||
} : {}), {
|
||||
Q: $props.suffixIcon,
|
||||
Y: common_vendor.n($options.inputContentClass),
|
||||
Z: common_vendor.s($options.inputContentStyle),
|
||||
aa: $options.msg ? 1 : "",
|
||||
ab: common_vendor.s($options.boxStyle)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="{{['uni-easyinput', aa && 'uni-easyinput-error']}}" style="{{ab}}"><view class="{{['uni-easyinput__content', Y]}}" style="{{Z}}"><uni-icons wx:if="{{a}}" class="content-clear-icon" bindclick="{{b}}" u-i="77f3104e-0" bind:__l="__l" u-p="{{c}}"></uni-icons><textarea wx:if="{{d}}" class="{{['uni-easyinput__content-textarea', e && 'input-padding']}}" name="{{f}}" value="{{g}}" placeholder="{{h}}" placeholderStyle="{{i}}" disabled="{{j}}" placeholder-class="uni-easyinput__placeholder-class" maxlength="{{k}}" focus="{{l}}" autoHeight="{{m}}" cursor-spacing="{{n}}" bindinput="{{o}}" bindblur="{{p}}" bindfocus="{{q}}" bindconfirm="{{r}}" bindkeyboardheightchange="{{s}}"></textarea><block wx:else><input wx:if="{{r0}}" type="{{t}}" class="uni-easyinput__content-input" style="{{v}}" name="{{w}}" value="{{x}}" password="{{y}}" placeholder="{{z}}" placeholderStyle="{{A}}" placeholder-class="uni-easyinput__placeholder-class" disabled="{{B}}" maxlength="{{C}}" focus="{{D}}" confirmType="{{E}}" cursor-spacing="{{F}}" bindfocus="{{G}}" bindblur="{{H}}" bindinput="{{I}}" bindconfirm="{{J}}" bindkeyboardheightchange="{{K}}"/></block><block wx:if="{{L}}"><uni-icons wx:if="{{M}}" class="{{['content-clear-icon', N && 'is-textarea-icon']}}" bindclick="{{O}}" u-i="77f3104e-1" bind:__l="__l" u-p="{{P}}"></uni-icons></block><block wx:elif="{{Q}}"><uni-icons wx:if="{{R}}" class="content-clear-icon" bindclick="{{S}}" u-i="77f3104e-2" bind:__l="__l" u-p="{{T}}"></uni-icons></block><block wx:else><uni-icons wx:if="{{U}}" class="{{['content-clear-icon', V && 'is-textarea-icon']}}" bindclick="{{W}}" u-i="77f3104e-3" bind:__l="__l" u-p="{{X}}"></uni-icons></block><slot name="right"></slot></view></view>
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-easyinput {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
.uni-easyinput__content {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-color: #fff;
|
||||
transition-property: border-color;
|
||||
transition-duration: 0.3s;
|
||||
}
|
||||
.uni-easyinput__content-input {
|
||||
width: auto;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
line-height: 1;
|
||||
font-size: 14px;
|
||||
height: 35px;
|
||||
}
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
.is-textarea {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.is-textarea-icon {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.uni-easyinput__content-textarea {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
line-height: 1.5;
|
||||
font-size: 14px;
|
||||
margin: 6px;
|
||||
margin-left: 0;
|
||||
height: 80px;
|
||||
min-height: 80px;
|
||||
min-height: 80px;
|
||||
width: auto;
|
||||
}
|
||||
.input-padding {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.content-clear-icon {
|
||||
padding: 0 5px;
|
||||
}
|
||||
.label-icon {
|
||||
margin-right: 5px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
.is-input-border {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.uni-error-message {
|
||||
position: absolute;
|
||||
bottom: -17px;
|
||||
left: 0;
|
||||
line-height: 12px;
|
||||
color: #e43d33;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
.uni-error-msg--boeder {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
line-height: 22px;
|
||||
}
|
||||
.is-input-error-border {
|
||||
border-color: #e43d33;
|
||||
}
|
||||
.is-input-error-border .uni-easyinput__placeholder-class {
|
||||
color: #f29e99;
|
||||
}
|
||||
.uni-easyinput--border {
|
||||
margin-bottom: 0;
|
||||
padding: 10px 15px;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.uni-easyinput-error {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.is-first-border {
|
||||
border: none;
|
||||
}
|
||||
.is-disabled {
|
||||
background-color: #f7f6f6;
|
||||
color: #d5d5d5;
|
||||
}
|
||||
.is-disabled .uni-easyinput__placeholder-class {
|
||||
color: #d5d5d5;
|
||||
font-size: 12px;
|
||||
}
|
||||
+345
@@ -0,0 +1,345 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniFormsItem",
|
||||
options: {
|
||||
virtualHost: true
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
uniFormItem: this
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
form: {
|
||||
from: "uniForm",
|
||||
default: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
type: Array,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 表单域的属性名,在使用校验规则时必填
|
||||
name: {
|
||||
type: [String, Array],
|
||||
default: ""
|
||||
},
|
||||
required: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// label的宽度
|
||||
labelWidth: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
// label 居中方式,默认 left 取值 left/center/right
|
||||
labelAlign: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// 强制显示错误信息
|
||||
errorMessage: {
|
||||
type: [String, Boolean],
|
||||
default: ""
|
||||
},
|
||||
// 1.4.0 弃用,统一使用 form 的校验时机
|
||||
// validateTrigger: {
|
||||
// type: String,
|
||||
// default: ''
|
||||
// },
|
||||
// 1.4.0 弃用,统一使用 form 的label 位置
|
||||
// labelPosition: {
|
||||
// type: String,
|
||||
// default: ''
|
||||
// },
|
||||
// 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
|
||||
leftIcon: String,
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: "#606266"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
errMsg: "",
|
||||
userRules: null,
|
||||
localLabelAlign: "left",
|
||||
localLabelWidth: "70px",
|
||||
localLabelPos: "left",
|
||||
border: false,
|
||||
isFirstBorder: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 处理错误信息
|
||||
msg() {
|
||||
return this.errorMessage || this.errMsg;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 规则发生变化通知子组件更新
|
||||
"form.formRules"(val) {
|
||||
this.init();
|
||||
},
|
||||
"form.labelWidth"(val) {
|
||||
this.localLabelWidth = this._labelWidthUnit(val);
|
||||
},
|
||||
"form.labelPosition"(val) {
|
||||
this.localLabelPos = this._labelPosition();
|
||||
},
|
||||
"form.labelAlign"(val) {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init(true);
|
||||
if (this.name && this.form) {
|
||||
this.$watch(
|
||||
() => {
|
||||
const val = this.form._getDataValue(this.name, this.form.localData);
|
||||
return val;
|
||||
},
|
||||
(value, oldVal) => {
|
||||
const isEqual = this.form._isEqual(value, oldVal);
|
||||
if (!isEqual) {
|
||||
const val = this.itemSetValue(value);
|
||||
this.onFieldChange(val, false);
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: false
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
unmounted() {
|
||||
this.__isUnmounted = true;
|
||||
this.unInit();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 设置规则 ,主要用于小程序自定义检验规则
|
||||
* @param {Array} rules 规则源数据
|
||||
*/
|
||||
setRules(rules = null) {
|
||||
this.userRules = rules;
|
||||
this.init(false);
|
||||
},
|
||||
// 兼容老版本表单组件
|
||||
setValue() {
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 校验数据
|
||||
* @param {any} value 需要校验的数据
|
||||
* @param {boolean} 是否立即校验
|
||||
* @return {Array|null} 校验内容
|
||||
*/
|
||||
async onFieldChange(value, formtrigger = true) {
|
||||
const {
|
||||
formData,
|
||||
localData,
|
||||
errShowType,
|
||||
validateCheck,
|
||||
validateTrigger,
|
||||
_isRequiredField,
|
||||
_realName
|
||||
} = this.form;
|
||||
const name = _realName(this.name);
|
||||
if (!value) {
|
||||
value = this.form.formData[name];
|
||||
}
|
||||
const ruleLen = this.itemRules.rules && this.itemRules.rules.length;
|
||||
if (!this.validator || !ruleLen || ruleLen === 0) return;
|
||||
const isRequiredField = _isRequiredField(this.itemRules.rules || []);
|
||||
let result = null;
|
||||
if (validateTrigger === "bind" || formtrigger) {
|
||||
result = await this.validator.validateUpdate(
|
||||
{
|
||||
[name]: value
|
||||
},
|
||||
formData
|
||||
);
|
||||
if (!isRequiredField && (value === void 0 || value === "")) {
|
||||
result = null;
|
||||
}
|
||||
if (result && result.errorMessage) {
|
||||
if (errShowType === "undertext") {
|
||||
this.errMsg = !result ? "" : result.errorMessage;
|
||||
}
|
||||
if (errShowType === "toast") {
|
||||
common_vendor.index.showToast({
|
||||
title: result.errorMessage || "校验错误",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
if (errShowType === "modal") {
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: result.errorMessage || "校验错误"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.errMsg = "";
|
||||
}
|
||||
validateCheck(result ? result : null);
|
||||
} else {
|
||||
this.errMsg = "";
|
||||
}
|
||||
return result ? result : null;
|
||||
},
|
||||
/**
|
||||
* 初始组件数据
|
||||
*/
|
||||
init(type = false) {
|
||||
const {
|
||||
validator,
|
||||
formRules,
|
||||
childrens,
|
||||
formData,
|
||||
localData,
|
||||
_realName,
|
||||
labelWidth,
|
||||
_getDataValue,
|
||||
_setDataValue
|
||||
} = this.form || {};
|
||||
this.localLabelAlign = this._justifyContent();
|
||||
this.localLabelWidth = this._labelWidthUnit(labelWidth);
|
||||
this.localLabelPos = this._labelPosition();
|
||||
this.form && type && childrens.push(this);
|
||||
if (!validator || !formRules) return;
|
||||
if (!this.form.isFirstBorder) {
|
||||
this.form.isFirstBorder = true;
|
||||
this.isFirstBorder = true;
|
||||
}
|
||||
if (this.group) {
|
||||
if (!this.group.isFirstBorder) {
|
||||
this.group.isFirstBorder = true;
|
||||
this.isFirstBorder = true;
|
||||
}
|
||||
}
|
||||
this.border = this.form.border;
|
||||
const name = _realName(this.name);
|
||||
const itemRule = this.userRules || this.rules;
|
||||
if (typeof formRules === "object" && itemRule) {
|
||||
formRules[name] = {
|
||||
rules: itemRule
|
||||
};
|
||||
validator.updateSchema(formRules);
|
||||
}
|
||||
const itemRules = formRules[name] || {};
|
||||
this.itemRules = itemRules;
|
||||
this.validator = validator;
|
||||
this.itemSetValue(_getDataValue(this.name, localData));
|
||||
},
|
||||
unInit() {
|
||||
if (this.form) {
|
||||
const {
|
||||
childrens,
|
||||
formData,
|
||||
_realName
|
||||
} = this.form;
|
||||
childrens.forEach((item, index) => {
|
||||
if (item === this) {
|
||||
this.form.childrens.splice(index, 1);
|
||||
delete formData[_realName(item.name)];
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 设置item 的值
|
||||
itemSetValue(value) {
|
||||
const name = this.form._realName(this.name);
|
||||
const rules = this.itemRules.rules || [];
|
||||
const val = this.form._getValue(name, value, rules);
|
||||
this.form._setDataValue(name, this.form.formData, val);
|
||||
return val;
|
||||
},
|
||||
/**
|
||||
* 移除该表单项的校验结果
|
||||
*/
|
||||
clearValidate() {
|
||||
this.errMsg = "";
|
||||
},
|
||||
// 是否显示星号
|
||||
_isRequired() {
|
||||
return this.required;
|
||||
},
|
||||
// 处理对齐方式
|
||||
_justifyContent() {
|
||||
if (this.form) {
|
||||
const {
|
||||
labelAlign
|
||||
} = this.form;
|
||||
let labelAli = this.labelAlign ? this.labelAlign : labelAlign;
|
||||
if (labelAli === "left") return "flex-start";
|
||||
if (labelAli === "center") return "center";
|
||||
if (labelAli === "right") return "flex-end";
|
||||
}
|
||||
return "flex-start";
|
||||
},
|
||||
// 处理 label宽度单位 ,继承父元素的值
|
||||
_labelWidthUnit(labelWidth) {
|
||||
return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 70 : "auto"));
|
||||
},
|
||||
// 处理 label 位置
|
||||
_labelPosition() {
|
||||
if (this.form) return this.form.labelPosition || "left";
|
||||
return "left";
|
||||
},
|
||||
/**
|
||||
* 触发时机
|
||||
* @param {Object} rule 当前规则内时机
|
||||
* @param {Object} itemRlue 当前组件时机
|
||||
* @param {Object} parentRule 父组件时机
|
||||
*/
|
||||
isTrigger(rule, itemRlue, parentRule) {
|
||||
if (rule === "submit" || !rule) {
|
||||
if (rule === void 0) {
|
||||
if (itemRlue !== "bind") {
|
||||
if (!itemRlue) {
|
||||
return parentRule === "" ? "bind" : "submit";
|
||||
}
|
||||
return "submit";
|
||||
}
|
||||
return "bind";
|
||||
}
|
||||
return "submit";
|
||||
}
|
||||
return "bind";
|
||||
},
|
||||
num2px(num) {
|
||||
if (typeof num === "number") {
|
||||
return `${num}px`;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.required
|
||||
}, $props.required ? {} : {}, {
|
||||
b: common_vendor.t($props.label),
|
||||
c: !$props.label && !$props.required ? 1 : "",
|
||||
d: $data.localLabelWidth,
|
||||
e: $data.localLabelAlign,
|
||||
f: common_vendor.t($options.msg),
|
||||
g: $options.msg ? 1 : "",
|
||||
h: common_vendor.n("is-direction-" + $data.localLabelPos),
|
||||
i: common_vendor.n($data.border ? "uni-forms-item--border" : ""),
|
||||
j: common_vendor.n($data.border && $data.isFirstBorder ? "is-first-border" : "")
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="{{['uni-forms-item', h, i, j]}}"><block wx:if="{{$slots.label}}"><slot name="label"></slot></block><block wx:else><view class="{{['uni-forms-item__label', c && 'no-label']}}" style="{{'width:' + d + ';' + ('justify-content:' + e)}}"><text wx:if="{{a}}" class="is-required">*</text><text>{{b}}</text></view></block><view class="uni-forms-item__content"><slot></slot><view class="{{['uni-forms-item__error', g && 'msg--active']}}"><text>{{f}}</text></view></view></view>
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-forms-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
margin-bottom: 22px;
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-forms-item__label {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
height: 36px;
|
||||
padding: 0 12px 0 0;
|
||||
vertical-align: middle;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-forms-item__label.no-label {
|
||||
padding: 0;
|
||||
}
|
||||
.uni-forms-item__content {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-forms-item .uni-forms-item__nuve-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-forms-item__error {
|
||||
color: #f56c6c;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
padding-top: 4px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
transition: transform 0.3s;
|
||||
transform: translateY(-100%);
|
||||
opacity: 0;
|
||||
}
|
||||
.uni-forms-item__error .error-text {
|
||||
color: #f56c6c;
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-forms-item__error.msg--active {
|
||||
opacity: 1;
|
||||
transform: translateY(0%);
|
||||
}
|
||||
.uni-forms-item.is-direction-left {
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-forms-item.is-direction-top {
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-forms-item.is-direction-top .uni-forms-item__label {
|
||||
padding: 0 0 8px;
|
||||
line-height: 1.5715;
|
||||
text-align: left;
|
||||
white-space: initial;
|
||||
}
|
||||
.uni-forms-item .is-required {
|
||||
color: #dd524d;
|
||||
font-weight: bold;
|
||||
}
|
||||
.uni-forms-item--border {
|
||||
margin-bottom: 0;
|
||||
padding: 10px 0;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.uni-forms-item--border .uni-forms-item__content {
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.uni-forms-item--border .uni-forms-item__content .uni-forms-item__error {
|
||||
position: relative;
|
||||
top: 5px;
|
||||
left: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
.is-first-border {
|
||||
border: none;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
"use strict";
|
||||
const uni_modules_uniForms_components_uniForms_validate = require("./validate.js");
|
||||
const uni_modules_uniForms_components_uniForms_utils = require("./utils.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniForms",
|
||||
emits: ["validate", "submit"],
|
||||
options: {
|
||||
virtualHost: true
|
||||
},
|
||||
props: {
|
||||
// 即将弃用
|
||||
value: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// vue3 替换 value 属性
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue
|
||||
model: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
//校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal]
|
||||
errShowType: {
|
||||
type: String,
|
||||
default: "undertext"
|
||||
},
|
||||
// 校验触发器方式 默认 bind 取值 [bind|submit]
|
||||
validateTrigger: {
|
||||
type: String,
|
||||
default: "submit"
|
||||
},
|
||||
// label 位置,默认 left 取值 top/left
|
||||
labelPosition: {
|
||||
type: String,
|
||||
default: "left"
|
||||
},
|
||||
// label 宽度
|
||||
labelWidth: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
// label 居中方式,默认 left 取值 left/center/right
|
||||
labelAlign: {
|
||||
type: String,
|
||||
default: "left"
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
uniForm: this
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 表单本地值的记录,不应该与传如的值进行关联
|
||||
formData: {},
|
||||
formRules: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 计算数据源变化的
|
||||
localData() {
|
||||
const localVal = this.model || this.modelValue || this.value;
|
||||
if (localVal) {
|
||||
return uni_modules_uniForms_components_uniForms_utils.deepCopy(localVal);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听数据变化 ,暂时不使用,需要单独赋值
|
||||
// localData: {},
|
||||
// 监听规则变化
|
||||
rules: {
|
||||
handler: function(val, oldVal) {
|
||||
this.setRules(val);
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let getbinddata = getApp().$vm.$.appContext.config.globalProperties.binddata;
|
||||
if (!getbinddata) {
|
||||
getApp().$vm.$.appContext.config.globalProperties.binddata = function(name, value, formName) {
|
||||
if (formName) {
|
||||
this.$refs[formName].setValue(name, value);
|
||||
} else {
|
||||
let formVm;
|
||||
for (let i in this.$refs) {
|
||||
const vm = this.$refs[i];
|
||||
if (vm && vm.$options && vm.$options.name === "uniForms") {
|
||||
formVm = vm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!formVm) return console.error("当前 uni-froms 组件缺少 ref 属性");
|
||||
formVm.setValue(name, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
this.childrens = [];
|
||||
this.inputChildrens = [];
|
||||
this.setRules(this.rules);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 设置规则 ,主要用于小程序自定义检验规则
|
||||
* @param {Array} rules 规则源数据
|
||||
*/
|
||||
setRules(rules) {
|
||||
this.formRules = Object.assign({}, this.formRules, rules);
|
||||
this.validator = new uni_modules_uniForms_components_uniForms_validate.SchemaValidator(rules);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用
|
||||
* @param {Object} key
|
||||
* @param {Object} value
|
||||
*/
|
||||
setValue(key, value) {
|
||||
let example = this.childrens.find((child) => child.name === key);
|
||||
if (!example) return null;
|
||||
this.formData[key] = uni_modules_uniForms_components_uniForms_utils.getValue(key, value, this.formRules[key] && this.formRules[key].rules || []);
|
||||
return example.onFieldChange(this.formData[key]);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 手动提交校验表单
|
||||
* 对整个表单进行校验的方法,参数为一个回调函数。
|
||||
* @param {Array} keepitem 保留不参与校验的字段
|
||||
* @param {type} callback 方法回调
|
||||
*/
|
||||
validate(keepitem, callback) {
|
||||
return this.checkAll(this.formData, keepitem, callback);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 部分表单校验
|
||||
* @param {Array|String} props 需要校验的字段
|
||||
* @param {Function} 回调函数
|
||||
*/
|
||||
validateField(props = [], callback) {
|
||||
props = [].concat(props);
|
||||
let invalidFields = {};
|
||||
this.childrens.forEach((item) => {
|
||||
const name = uni_modules_uniForms_components_uniForms_utils.realName(item.name);
|
||||
if (props.indexOf(name) !== -1) {
|
||||
invalidFields = Object.assign({}, invalidFields, {
|
||||
[name]: this.formData[name]
|
||||
});
|
||||
}
|
||||
});
|
||||
return this.checkAll(invalidFields, [], callback);
|
||||
},
|
||||
/**
|
||||
* 外部调用方法
|
||||
* 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
|
||||
* @param {Array|String} props 需要移除校验的字段 ,不填为所有
|
||||
*/
|
||||
clearValidate(props = []) {
|
||||
props = [].concat(props);
|
||||
this.childrens.forEach((item) => {
|
||||
if (props.length === 0) {
|
||||
item.errMsg = "";
|
||||
} else {
|
||||
const name = uni_modules_uniForms_components_uniForms_utils.realName(item.name);
|
||||
if (props.indexOf(name) !== -1) {
|
||||
item.errMsg = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 外部调用方法 ,即将废弃
|
||||
* 手动提交校验表单
|
||||
* 对整个表单进行校验的方法,参数为一个回调函数。
|
||||
* @param {Array} keepitem 保留不参与校验的字段
|
||||
* @param {type} callback 方法回调
|
||||
*/
|
||||
submit(keepitem, callback, type) {
|
||||
for (let i in this.dataValue) {
|
||||
const itemData = this.childrens.find((v) => v.name === i);
|
||||
if (itemData) {
|
||||
if (this.formData[i] === void 0) {
|
||||
this.formData[i] = this._getValue(i, this.dataValue[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!type) {
|
||||
console.warn("submit 方法即将废弃,请使用validate方法代替!");
|
||||
}
|
||||
return this.checkAll(this.formData, keepitem, callback, "submit");
|
||||
},
|
||||
// 校验所有
|
||||
async checkAll(invalidFields, keepitem, callback, type) {
|
||||
if (!this.validator) return;
|
||||
let childrens = [];
|
||||
for (let i in invalidFields) {
|
||||
const item = this.childrens.find((v) => uni_modules_uniForms_components_uniForms_utils.realName(v.name) === i);
|
||||
if (item) {
|
||||
childrens.push(item);
|
||||
}
|
||||
}
|
||||
if (!callback && typeof keepitem === "function") {
|
||||
callback = keepitem;
|
||||
}
|
||||
let promise;
|
||||
if (!callback && typeof callback !== "function" && Promise) {
|
||||
promise = new Promise((resolve, reject) => {
|
||||
callback = function(valid, invalidFields2) {
|
||||
!valid ? resolve(invalidFields2) : reject(valid);
|
||||
};
|
||||
});
|
||||
}
|
||||
let results = [];
|
||||
let tempFormData = JSON.parse(JSON.stringify(invalidFields));
|
||||
for (let i in childrens) {
|
||||
const child = childrens[i];
|
||||
let name = uni_modules_uniForms_components_uniForms_utils.realName(child.name);
|
||||
const result = await child.onFieldChange(tempFormData[name]);
|
||||
if (result) {
|
||||
results.push(result);
|
||||
if (this.errShowType === "toast" || this.errShowType === "modal") break;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(results)) {
|
||||
if (results.length === 0) results = null;
|
||||
}
|
||||
if (Array.isArray(keepitem)) {
|
||||
keepitem.forEach((v) => {
|
||||
let vName = uni_modules_uniForms_components_uniForms_utils.realName(v);
|
||||
let value = uni_modules_uniForms_components_uniForms_utils.getDataValue(v, this.localData);
|
||||
if (value !== void 0) {
|
||||
tempFormData[vName] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === "submit") {
|
||||
this.$emit("submit", {
|
||||
detail: {
|
||||
value: tempFormData,
|
||||
errors: results
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$emit("validate", results);
|
||||
}
|
||||
let resetFormData = {};
|
||||
resetFormData = uni_modules_uniForms_components_uniForms_utils.rawData(tempFormData, this.name);
|
||||
callback && typeof callback === "function" && callback(results, resetFormData);
|
||||
if (promise && callback) {
|
||||
return promise;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 返回validate事件
|
||||
* @param {Object} result
|
||||
*/
|
||||
validateCheck(result) {
|
||||
this.$emit("validate", result);
|
||||
},
|
||||
_getValue: uni_modules_uniForms_components_uniForms_utils.getValue,
|
||||
_isRequiredField: uni_modules_uniForms_components_uniForms_utils.isRequiredField,
|
||||
_setDataValue: uni_modules_uniForms_components_uniForms_utils.setDataValue,
|
||||
_getDataValue: uni_modules_uniForms_components_uniForms_utils.getDataValue,
|
||||
_realName: uni_modules_uniForms_components_uniForms_utils.realName,
|
||||
_isRealName: uni_modules_uniForms_components_uniForms_utils.isRealName,
|
||||
_isEqual: uni_modules_uniForms_components_uniForms_utils.isEqual
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-forms/components/uni-forms/uni-forms.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-forms"><form><slot></slot></form></view>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
const deepCopy = (val) => {
|
||||
return JSON.parse(JSON.stringify(val));
|
||||
};
|
||||
const typeFilter = (format) => {
|
||||
return format === "int" || format === "double" || format === "number" || format === "timestamp";
|
||||
};
|
||||
const getValue = (key, value, rules) => {
|
||||
const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format));
|
||||
const isRuleBoolType = rules.find((val) => val.format && val.format === "boolean" || val.format === "bool");
|
||||
if (!!isRuleNumType) {
|
||||
if (!value && value !== 0) {
|
||||
value = null;
|
||||
} else {
|
||||
value = isNumber(Number(value)) ? Number(value) : value;
|
||||
}
|
||||
}
|
||||
if (!!isRuleBoolType) {
|
||||
value = isBoolean(value) ? value : false;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const setDataValue = (field, formdata, value) => {
|
||||
formdata[field] = value;
|
||||
return value || "";
|
||||
};
|
||||
const getDataValue = (field, data) => {
|
||||
return objGet(data, field);
|
||||
};
|
||||
const realName = (name, data = {}) => {
|
||||
const base_name = _basePath(name);
|
||||
if (typeof base_name === "object" && Array.isArray(base_name) && base_name.length > 1) {
|
||||
const realname = base_name.reduce((a, b) => a += `#${b}`, "_formdata_");
|
||||
return realname;
|
||||
}
|
||||
return base_name[0] || name;
|
||||
};
|
||||
const isRealName = (name) => {
|
||||
const reg = /^_formdata_#*/;
|
||||
return reg.test(name);
|
||||
};
|
||||
const rawData = (object = {}, name) => {
|
||||
let newData = JSON.parse(JSON.stringify(object));
|
||||
let formData = {};
|
||||
for (let i in newData) {
|
||||
let path = name2arr(i);
|
||||
objSet(formData, path, newData[i]);
|
||||
}
|
||||
return formData;
|
||||
};
|
||||
const name2arr = (name) => {
|
||||
let field = name.replace("_formdata_#", "");
|
||||
field = field.split("#").map((v) => isNumber(v) ? Number(v) : v);
|
||||
return field;
|
||||
};
|
||||
const objSet = (object, path, value) => {
|
||||
if (typeof object !== "object") return object;
|
||||
_basePath(path).reduce((o, k, i, _) => {
|
||||
if (i === _.length - 1) {
|
||||
o[k] = value;
|
||||
return null;
|
||||
} else if (k in o) {
|
||||
return o[k];
|
||||
} else {
|
||||
o[k] = /^[0-9]{1,}$/.test(_[i + 1]) ? [] : {};
|
||||
return o[k];
|
||||
}
|
||||
}, object);
|
||||
return object;
|
||||
};
|
||||
function _basePath(path) {
|
||||
if (Array.isArray(path)) return path;
|
||||
return path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
||||
}
|
||||
const objGet = (object, path, defaultVal = "undefined") => {
|
||||
let newPath = _basePath(path);
|
||||
let val = newPath.reduce((o, k) => {
|
||||
return (o || {})[k];
|
||||
}, object);
|
||||
return !val || val !== void 0 ? val : defaultVal;
|
||||
};
|
||||
const isNumber = (num) => {
|
||||
return !isNaN(Number(num));
|
||||
};
|
||||
const isBoolean = (bool) => {
|
||||
return typeof bool === "boolean";
|
||||
};
|
||||
const isRequiredField = (rules) => {
|
||||
let isNoField = false;
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
const ruleData = rules[i];
|
||||
if (ruleData.required) {
|
||||
isNoField = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isNoField;
|
||||
};
|
||||
const isEqual = (a, b) => {
|
||||
if (a === b) {
|
||||
return a !== 0 || 1 / a === 1 / b;
|
||||
}
|
||||
if (a == null || b == null) {
|
||||
return a === b;
|
||||
}
|
||||
var classNameA = toString.call(a), classNameB = toString.call(b);
|
||||
if (classNameA !== classNameB) {
|
||||
return false;
|
||||
}
|
||||
switch (classNameA) {
|
||||
case "[object RegExp]":
|
||||
case "[object String]":
|
||||
return "" + a === "" + b;
|
||||
case "[object Number]":
|
||||
if (+a !== +a) {
|
||||
return +b !== +b;
|
||||
}
|
||||
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
|
||||
case "[object Date]":
|
||||
case "[object Boolean]":
|
||||
return +a === +b;
|
||||
}
|
||||
if (classNameA == "[object Object]") {
|
||||
var propsA = Object.getOwnPropertyNames(a), propsB = Object.getOwnPropertyNames(b);
|
||||
if (propsA.length != propsB.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < propsA.length; i++) {
|
||||
var propName = propsA[i];
|
||||
if (a[propName] !== b[propName]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (classNameA == "[object Array]") {
|
||||
if (a.toString() == b.toString()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
exports.deepCopy = deepCopy;
|
||||
exports.getDataValue = getDataValue;
|
||||
exports.getValue = getValue;
|
||||
exports.isEqual = isEqual;
|
||||
exports.isRealName = isRealName;
|
||||
exports.isRequiredField = isRequiredField;
|
||||
exports.rawData = rawData;
|
||||
exports.realName = realName;
|
||||
exports.setDataValue = setDataValue;
|
||||
@@ -0,0 +1,420 @@
|
||||
"use strict";
|
||||
var pattern = {
|
||||
email: /^\S+?@\S+?\.\S+?$/,
|
||||
idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
|
||||
url: new RegExp(
|
||||
"^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
|
||||
"i"
|
||||
)
|
||||
};
|
||||
const FORMAT_MAPPING = {
|
||||
"int": "integer",
|
||||
"bool": "boolean",
|
||||
"double": "number",
|
||||
"long": "number",
|
||||
"password": "string"
|
||||
// "fileurls": 'array'
|
||||
};
|
||||
function formatMessage(args, resources = "") {
|
||||
var defaultMessage = ["label"];
|
||||
defaultMessage.forEach((item) => {
|
||||
if (args[item] === void 0) {
|
||||
args[item] = "";
|
||||
}
|
||||
});
|
||||
let str = resources;
|
||||
for (let key in args) {
|
||||
let reg = new RegExp("{" + key + "}");
|
||||
str = str.replace(reg, args[key]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function isEmptyValue(value, type) {
|
||||
if (value === void 0 || value === null) {
|
||||
return true;
|
||||
}
|
||||
if (typeof value === "string" && !value) {
|
||||
return true;
|
||||
}
|
||||
if (Array.isArray(value) && !value.length) {
|
||||
return true;
|
||||
}
|
||||
if (type === "object" && !Object.keys(value).length) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const types = {
|
||||
integer(value) {
|
||||
return types.number(value) && parseInt(value, 10) === value;
|
||||
},
|
||||
string(value) {
|
||||
return typeof value === "string";
|
||||
},
|
||||
number(value) {
|
||||
if (isNaN(value)) {
|
||||
return false;
|
||||
}
|
||||
return typeof value === "number";
|
||||
},
|
||||
"boolean": function(value) {
|
||||
return typeof value === "boolean";
|
||||
},
|
||||
"float": function(value) {
|
||||
return types.number(value) && !types.integer(value);
|
||||
},
|
||||
array(value) {
|
||||
return Array.isArray(value);
|
||||
},
|
||||
object(value) {
|
||||
return typeof value === "object" && !types.array(value);
|
||||
},
|
||||
date(value) {
|
||||
return value instanceof Date;
|
||||
},
|
||||
timestamp(value) {
|
||||
if (!this.integer(value) || Math.abs(value).toString().length > 16) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
file(value) {
|
||||
return typeof value.url === "string";
|
||||
},
|
||||
email(value) {
|
||||
return typeof value === "string" && !!value.match(pattern.email) && value.length < 255;
|
||||
},
|
||||
url(value) {
|
||||
return typeof value === "string" && !!value.match(pattern.url);
|
||||
},
|
||||
pattern(reg, value) {
|
||||
try {
|
||||
return new RegExp(reg).test(value);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
method(value) {
|
||||
return typeof value === "function";
|
||||
},
|
||||
idcard(value) {
|
||||
return typeof value === "string" && !!value.match(pattern.idcard);
|
||||
},
|
||||
"url-https"(value) {
|
||||
return this.url(value) && value.startsWith("https://");
|
||||
},
|
||||
"url-scheme"(value) {
|
||||
return value.startsWith("://");
|
||||
},
|
||||
"url-web"(value) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
class RuleValidator {
|
||||
constructor(message) {
|
||||
this._message = message;
|
||||
}
|
||||
async validateRule(fieldKey, fieldValue, value, data, allData) {
|
||||
var result = null;
|
||||
let rules = fieldValue.rules;
|
||||
let hasRequired = rules.findIndex((item) => {
|
||||
return item.required;
|
||||
});
|
||||
if (hasRequired < 0) {
|
||||
if (value === null || value === void 0) {
|
||||
return result;
|
||||
}
|
||||
if (typeof value === "string" && !value.length) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
var message = this._message;
|
||||
if (rules === void 0) {
|
||||
return message["default"];
|
||||
}
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
let rule = rules[i];
|
||||
let vt = this._getValidateType(rule);
|
||||
Object.assign(rule, {
|
||||
label: fieldValue.label || `["${fieldKey}"]`
|
||||
});
|
||||
if (RuleValidatorHelper[vt]) {
|
||||
result = RuleValidatorHelper[vt](rule, value, message);
|
||||
if (result != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rule.validateExpr) {
|
||||
let now = Date.now();
|
||||
let resultExpr = rule.validateExpr(value, allData, now);
|
||||
if (resultExpr === false) {
|
||||
result = this._getMessage(rule, rule.errorMessage || this._message["default"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rule.validateFunction) {
|
||||
result = await this.validateFunction(rule, value, data, allData, vt);
|
||||
if (result !== null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result !== null) {
|
||||
result = message.TAG + result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async validateFunction(rule, value, data, allData, vt) {
|
||||
let result = null;
|
||||
try {
|
||||
let callbackMessage = null;
|
||||
const res = await rule.validateFunction(rule, value, allData || data, (message) => {
|
||||
callbackMessage = message;
|
||||
});
|
||||
if (callbackMessage || typeof res === "string" && res || res === false) {
|
||||
result = this._getMessage(rule, callbackMessage || res, vt);
|
||||
}
|
||||
} catch (e) {
|
||||
result = this._getMessage(rule, e.message, vt);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
_getMessage(rule, message, vt) {
|
||||
return formatMessage(rule, message || rule.errorMessage || this._message[vt] || message["default"]);
|
||||
}
|
||||
_getValidateType(rule) {
|
||||
var result = "";
|
||||
if (rule.required) {
|
||||
result = "required";
|
||||
} else if (rule.format) {
|
||||
result = "format";
|
||||
} else if (rule.arrayType) {
|
||||
result = "arrayTypeFormat";
|
||||
} else if (rule.range) {
|
||||
result = "range";
|
||||
} else if (rule.maximum !== void 0 || rule.minimum !== void 0) {
|
||||
result = "rangeNumber";
|
||||
} else if (rule.maxLength !== void 0 || rule.minLength !== void 0) {
|
||||
result = "rangeLength";
|
||||
} else if (rule.pattern) {
|
||||
result = "pattern";
|
||||
} else if (rule.validateFunction) {
|
||||
result = "validateFunction";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
const RuleValidatorHelper = {
|
||||
required(rule, value, message) {
|
||||
if (rule.required && isEmptyValue(value, rule.format || typeof value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.required);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
range(rule, value, message) {
|
||||
const {
|
||||
range,
|
||||
errorMessage
|
||||
} = rule;
|
||||
let list = new Array(range.length);
|
||||
for (let i = 0; i < range.length; i++) {
|
||||
const item = range[i];
|
||||
if (types.object(item) && item.value !== void 0) {
|
||||
list[i] = item.value;
|
||||
} else {
|
||||
list[i] = item;
|
||||
}
|
||||
}
|
||||
let result = false;
|
||||
if (Array.isArray(value)) {
|
||||
result = new Set(value.concat(list)).size === list.length;
|
||||
} else {
|
||||
if (list.indexOf(value) > -1) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
return formatMessage(rule, errorMessage || message["enum"]);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
rangeNumber(rule, value, message) {
|
||||
if (!types.number(value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
|
||||
}
|
||||
let {
|
||||
minimum,
|
||||
maximum,
|
||||
exclusiveMinimum,
|
||||
exclusiveMaximum
|
||||
} = rule;
|
||||
let min = exclusiveMinimum ? value <= minimum : value < minimum;
|
||||
let max = exclusiveMaximum ? value >= maximum : value > maximum;
|
||||
if (minimum !== void 0 && min) {
|
||||
return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMinimum ? "exclusiveMinimum" : "minimum"]);
|
||||
} else if (maximum !== void 0 && max) {
|
||||
return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMaximum ? "exclusiveMaximum" : "maximum"]);
|
||||
} else if (minimum !== void 0 && maximum !== void 0 && (min || max)) {
|
||||
return formatMessage(rule, rule.errorMessage || message["number"].range);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
rangeLength(rule, value, message) {
|
||||
if (!types.string(value) && !types.array(value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
|
||||
}
|
||||
let min = rule.minLength;
|
||||
let max = rule.maxLength;
|
||||
let val = value.length;
|
||||
if (min !== void 0 && val < min) {
|
||||
return formatMessage(rule, rule.errorMessage || message["length"].minLength);
|
||||
} else if (max !== void 0 && val > max) {
|
||||
return formatMessage(rule, rule.errorMessage || message["length"].maxLength);
|
||||
} else if (min !== void 0 && max !== void 0 && (val < min || val > max)) {
|
||||
return formatMessage(rule, rule.errorMessage || message["length"].range);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
pattern(rule, value, message) {
|
||||
if (!types["pattern"](rule.pattern, value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
format(rule, value, message) {
|
||||
var customTypes = Object.keys(types);
|
||||
var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : rule.format || rule.arrayType;
|
||||
if (customTypes.indexOf(format) > -1) {
|
||||
if (!types[format](value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.typeError);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
arrayTypeFormat(rule, value, message) {
|
||||
if (!Array.isArray(value)) {
|
||||
return formatMessage(rule, rule.errorMessage || message.typeError);
|
||||
}
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const element = value[i];
|
||||
let formatResult = this.format(rule, element, message);
|
||||
if (formatResult !== null) {
|
||||
return formatResult;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
class SchemaValidator extends RuleValidator {
|
||||
constructor(schema, options) {
|
||||
super(SchemaValidator.message);
|
||||
this._schema = schema;
|
||||
this._options = options || null;
|
||||
}
|
||||
updateSchema(schema) {
|
||||
this._schema = schema;
|
||||
}
|
||||
async validate(data, allData) {
|
||||
let result = this._checkFieldInSchema(data);
|
||||
if (!result) {
|
||||
result = await this.invokeValidate(data, false, allData);
|
||||
}
|
||||
return result.length ? result[0] : null;
|
||||
}
|
||||
async validateAll(data, allData) {
|
||||
let result = this._checkFieldInSchema(data);
|
||||
if (!result) {
|
||||
result = await this.invokeValidate(data, true, allData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async validateUpdate(data, allData) {
|
||||
let result = this._checkFieldInSchema(data);
|
||||
if (!result) {
|
||||
result = await this.invokeValidateUpdate(data, false, allData);
|
||||
}
|
||||
return result.length ? result[0] : null;
|
||||
}
|
||||
async invokeValidate(data, all, allData) {
|
||||
let result = [];
|
||||
let schema = this._schema;
|
||||
for (let key in schema) {
|
||||
let value = schema[key];
|
||||
let errorMessage = await this.validateRule(key, value, data[key], data, allData);
|
||||
if (errorMessage != null) {
|
||||
result.push({
|
||||
key,
|
||||
errorMessage
|
||||
});
|
||||
if (!all) break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async invokeValidateUpdate(data, all, allData) {
|
||||
let result = [];
|
||||
for (let key in data) {
|
||||
let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData);
|
||||
if (errorMessage != null) {
|
||||
result.push({
|
||||
key,
|
||||
errorMessage
|
||||
});
|
||||
if (!all) break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
_checkFieldInSchema(data) {
|
||||
var keys = Object.keys(data);
|
||||
var keys2 = Object.keys(this._schema);
|
||||
if (new Set(keys.concat(keys2)).size === keys2.length) {
|
||||
return "";
|
||||
}
|
||||
var noExistFields = keys.filter((key) => {
|
||||
return keys2.indexOf(key) < 0;
|
||||
});
|
||||
var errorMessage = formatMessage({
|
||||
field: JSON.stringify(noExistFields)
|
||||
}, SchemaValidator.message.TAG + SchemaValidator.message["defaultInvalid"]);
|
||||
return [{
|
||||
key: "invalid",
|
||||
errorMessage
|
||||
}];
|
||||
}
|
||||
}
|
||||
function Message() {
|
||||
return {
|
||||
TAG: "",
|
||||
default: "验证错误",
|
||||
defaultInvalid: "提交的字段{field}在数据库中并不存在",
|
||||
validateFunction: "验证无效",
|
||||
required: "{label}必填",
|
||||
"enum": "{label}超出范围",
|
||||
timestamp: "{label}格式无效",
|
||||
whitespace: "{label}不能为空",
|
||||
typeError: "{label}类型无效",
|
||||
date: {
|
||||
format: "{label}日期{value}格式无效",
|
||||
parse: "{label}日期无法解析,{value}无效",
|
||||
invalid: "{label}日期{value}无效"
|
||||
},
|
||||
length: {
|
||||
minLength: "{label}长度不能少于{minLength}",
|
||||
maxLength: "{label}长度不能超过{maxLength}",
|
||||
range: "{label}必须介于{minLength}和{maxLength}之间"
|
||||
},
|
||||
number: {
|
||||
minimum: "{label}不能小于{minimum}",
|
||||
maximum: "{label}不能大于{maximum}",
|
||||
exclusiveMinimum: "{label}不能小于等于{minimum}",
|
||||
exclusiveMaximum: "{label}不能大于等于{maximum}",
|
||||
range: "{label}必须介于{minimum}and{maximum}之间"
|
||||
},
|
||||
pattern: {
|
||||
mismatch: "{label}格式不匹配"
|
||||
}
|
||||
};
|
||||
}
|
||||
SchemaValidator.message = new Message();
|
||||
exports.SchemaValidator = SchemaValidator;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
const en = {
|
||||
"uni-goods-nav.options.shop": "shop",
|
||||
"uni-goods-nav.options.cart": "cart",
|
||||
"uni-goods-nav.buttonGroup.addToCart": "add to cart",
|
||||
"uni-goods-nav.buttonGroup.buyNow": "buy now"
|
||||
};
|
||||
const zhHans = {
|
||||
"uni-goods-nav.options.shop": "店铺",
|
||||
"uni-goods-nav.options.cart": "购物车",
|
||||
"uni-goods-nav.buttonGroup.addToCart": "加入购物车",
|
||||
"uni-goods-nav.buttonGroup.buyNow": "立即购买"
|
||||
};
|
||||
const zhHant = {
|
||||
"uni-goods-nav.options.shop": "店鋪",
|
||||
"uni-goods-nav.options.cart": "購物車",
|
||||
"uni-goods-nav.buttonGroup.addToCart": "加入購物車",
|
||||
"uni-goods-nav.buttonGroup.buyNow": "立即購買"
|
||||
};
|
||||
const messages = {
|
||||
en,
|
||||
"zh-Hans": zhHans,
|
||||
"zh-Hant": zhHant
|
||||
};
|
||||
exports.messages = messages;
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniGoodsNav_components_uniGoodsNav_i18n_index = require("./i18n/index.js");
|
||||
const { t } = common_vendor.initVueI18n(uni_modules_uniGoodsNav_components_uniGoodsNav_i18n_index.messages);
|
||||
const _sfc_main = {
|
||||
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 (common_vendor.index.report && this.stat) {
|
||||
common_vendor.index.report(item.text, item.text);
|
||||
}
|
||||
this.$emit("buttonClick", {
|
||||
index,
|
||||
content: item
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
_easycom_uni_icons2();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_icons();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($props.options, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: "14fff81c-0-" + i0,
|
||||
b: common_vendor.p({
|
||||
type: item.icon,
|
||||
size: "20",
|
||||
color: "#646566"
|
||||
}),
|
||||
c: common_vendor.t(item.text),
|
||||
d: item.info
|
||||
}, item.info ? {
|
||||
e: common_vendor.t(item.info),
|
||||
f: item.info > 9 ? 1 : "",
|
||||
g: item.infoBackgroundColor ? item.infoBackgroundColor : "#ff0000",
|
||||
h: item.infoColor ? item.infoColor : "#fff"
|
||||
} : {}, {
|
||||
i: index,
|
||||
j: common_vendor.o(($event) => $options.onClick(index, item), index)
|
||||
});
|
||||
}),
|
||||
b: common_vendor.f($props.buttonGroup, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.text),
|
||||
b: item.color,
|
||||
c: index,
|
||||
d: item.backgroundColor,
|
||||
e: item.color,
|
||||
f: common_vendor.o(($event) => $options.buttonClick(index, item), index)
|
||||
};
|
||||
}),
|
||||
c: $props.fill ? 1 : ""
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<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 wx:for="{{a}}" wx:for-item="item" wx:key="i" class="flex uni-tab__cart-button-left uni-tab__shop-cart" bindtap="{{item.j}}"><view class="uni-tab__icon"><uni-icons wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></uni-icons></view><text class="uni-tab__text">{{item.c}}</text><view class="flex uni-tab__dot-box"><text wx:if="{{item.d}}" class="{{[item.f && 'uni-tab__dots', 'uni-tab__dot']}}" style="{{'background-color:' + item.g + ';' + ('color:' + item.h)}}">{{item.e}}</text></view></view></view><view class="{{[c && 'uni-tab__right', 'flex', 'uni-tab__cart-sub-right']}}"><view wx:for="{{b}}" wx:for-item="item" wx:key="c" style="{{'background:' + item.d + ';' + ('color:' + item.e)}}" class="flex uni-tab__cart-button-right" bindtap="{{item.f}}"><text style="{{'color:' + item.b}}" class="uni-tab__cart-button-right-text">{{item.a}}</text></view></view></view></view>
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-goods-nav {
|
||||
display: flex;
|
||||
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 {
|
||||
display: flex;
|
||||
position: relative;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
margin: 0 10px;
|
||||
}
|
||||
.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 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-tab__cart-button-right-text {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
}
|
||||
.uni-tab__cart-button-right:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.uni-tab__dot-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
right: -2px;
|
||||
top: 2px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-tab__dot {
|
||||
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;
|
||||
border-radius: 15px;
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniGridItem",
|
||||
inject: ["grid"],
|
||||
props: {
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
column: 0,
|
||||
showBorder: true,
|
||||
square: true,
|
||||
highlight: true,
|
||||
left: 0,
|
||||
top: 0,
|
||||
openNum: 2,
|
||||
width: 0,
|
||||
borderColor: "#e5e5e5"
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.column = this.grid.column;
|
||||
this.showBorder = this.grid.showBorder;
|
||||
this.square = this.grid.square;
|
||||
this.highlight = this.grid.highlight;
|
||||
this.top = this.hor === 0 ? this.grid.hor : this.hor;
|
||||
this.left = this.ver === 0 ? this.grid.ver : this.ver;
|
||||
this.borderColor = this.grid.borderColor;
|
||||
this.grid.children.push(this);
|
||||
this.width = this.grid.width;
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.grid.children.forEach((item, index) => {
|
||||
if (item === this) {
|
||||
this.grid.children.splice(index, 1);
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_onClick() {
|
||||
this.grid.change({
|
||||
detail: {
|
||||
index: this.index
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.width
|
||||
}, $data.width ? {
|
||||
b: $data.showBorder ? 1 : "",
|
||||
c: $data.showBorder && $props.index < $data.column ? 1 : "",
|
||||
d: $data.highlight ? 1 : "",
|
||||
e: $data.borderColor,
|
||||
f: $data.borderColor,
|
||||
g: $data.borderColor,
|
||||
h: common_vendor.o((...args) => $options._onClick && $options._onClick(...args)),
|
||||
i: common_vendor.s("width:" + $data.width + ";" + ($data.square ? "height:" + $data.width : ""))
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-645c48f3"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view wx:if="{{a}}" style="{{i}}" class="uni-grid-item data-v-645c48f3"><view class="{{[b && 'uni-grid-item--border', c && 'uni-grid-item--border-top', d && 'uni-highlight', 'uni-grid-item__box', 'data-v-645c48f3']}}" style="{{'border-right-color:' + e + ';' + ('border-bottom-color:' + f) + ';' + ('border-top-color:' + g)}}" bindtap="{{h}}"><slot/></view></view>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-grid-item.data-v-645c48f3 {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.uni-grid-item__box.data-v-645c48f3 {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-grid-item--border.data-v-645c48f3 {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
border-bottom: 1px #D2D2D2 solid;
|
||||
border-right: 1px #D2D2D2 solid;
|
||||
}
|
||||
.uni-grid-item--border-top.data-v-645c48f3 {
|
||||
position: relative;
|
||||
border-top: 1px #D2D2D2 solid;
|
||||
z-index: 0;
|
||||
}
|
||||
.uni-highlight.data-v-645c48f3:active {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniGrid",
|
||||
emits: ["change"],
|
||||
props: {
|
||||
// 每列显示个数
|
||||
column: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
// 是否显示边框
|
||||
showBorder: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 边框颜色
|
||||
borderColor: {
|
||||
type: String,
|
||||
default: "#D2D2D2"
|
||||
},
|
||||
// 是否正方形显示,默认为 true
|
||||
square: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
highlight: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
grid: this
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const elId = `Uni_${Math.ceil(Math.random() * 1e6).toString(36)}`;
|
||||
return {
|
||||
elId,
|
||||
width: 0
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.children = [];
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.init();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
setTimeout(() => {
|
||||
this._getSize((width) => {
|
||||
this.children.forEach((item, index) => {
|
||||
item.width = width;
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
},
|
||||
change(e) {
|
||||
this.$emit("change", e);
|
||||
},
|
||||
_getSize(fn) {
|
||||
common_vendor.index.createSelectorQuery().in(this).select(`#${this.elId}`).boundingClientRect().exec((ret) => {
|
||||
this.width = parseInt((ret[0].width - 1) / this.column) + "px";
|
||||
fn(this.width);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: $data.elId,
|
||||
b: $props.showBorder ? 1 : "",
|
||||
c: $props.borderColor
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d803be04"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-grid/components/uni-grid/uni-grid.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-grid-wrap data-v-d803be04"><view id="{{a}}" ref="uni-grid" class="{{['uni-grid', 'data-v-d803be04', b && 'uni-grid--border']}}" style="{{'border-left-color:' + c}}"><slot/></view></view>
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-grid-wrap.data-v-d803be04 {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-grid.data-v-d803be04 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.uni-grid--border.data-v-d803be04 {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-left: 1px #D2D2D2 solid;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
const uni_modules_uniIcons_components_uniIcons_uniicons_file_vue = require("./uniicons_file_vue.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const getVal = (val) => {
|
||||
const reg = /^[0-9]*$/g;
|
||||
return typeof val === "number" || reg.test(val) ? val + "px" : val;
|
||||
};
|
||||
const _sfc_main = {
|
||||
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: uni_modules_uniIcons_components_uniIcons_uniicons_file_vue.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");
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.s($options.styleObj),
|
||||
b: common_vendor.n("uniui-" + $props.type),
|
||||
c: common_vendor.n($props.customPrefix),
|
||||
d: common_vendor.n($props.customPrefix ? $props.type : ""),
|
||||
e: common_vendor.o((...args) => $options._onClick && $options._onClick(...args))
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<text style="{{a}}" class="{{['uni-icons', b, c, d]}}" bindtap="{{e}}"><slot></slot></text>
|
||||
+532
File diff suppressed because one or more lines are too long
+648
@@ -0,0 +1,648 @@
|
||||
"use strict";
|
||||
const fontData = [
|
||||
{
|
||||
"font_class": "arrow-down",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "arrow-left",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "arrow-right",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "arrow-up",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "auth",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "auth-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "back",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "bars",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "calendar",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "calendar-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "camera",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "camera-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cart",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cart-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chat",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chat-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chatboxes",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chatboxes-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chatbubble",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "chatbubble-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "checkbox",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "checkbox-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "checkmarkempty",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "circle",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "circle-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "clear",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "close",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "closeempty",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cloud-download",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cloud-download-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cloud-upload",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "cloud-upload-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "color",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "color-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "compose",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "contact",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "contact-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "down",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "bottom",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "download",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "download-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "email",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "email-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "eye",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "eye-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "eye-slash",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "eye-slash-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "fire",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "fire-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "flag",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "flag-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "folder-add",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "folder-add-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "font",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "forward",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "gear",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "gear-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "gift",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "gift-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "hand-down",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "hand-down-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "hand-up",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "hand-up-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "headphones",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "heart",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "heart-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "help",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "help-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "home",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "home-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "image",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "image-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "images",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "images-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "info",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "info-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "left",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "link",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "list",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "location",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "location-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "locked",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "locked-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "loop",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "mail-open",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "mail-open-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "map",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "map-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "map-pin",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "map-pin-ellipse",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "medal",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "medal-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "mic",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "mic-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "micoff",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "micoff-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "minus",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "minus-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "more",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "more-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "navigate",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "navigate-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "notification",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "notification-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "paperclip",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "paperplane",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "paperplane-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "person",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "person-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "personadd",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "personadd-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "personadd-filled-copy",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "phone",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "phone-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "plus",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "plus-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "plusempty",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "pulldown",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "pyq",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "qq",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "redo",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "redo-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "refresh",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "refresh-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "refreshempty",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "reload",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "right",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "scan",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "search",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "settings",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "settings-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "shop",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "shop-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "smallcircle",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "smallcircle-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "sound",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "sound-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "spinner-cycle",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "staff",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "staff-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "star",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "star-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "starhalf",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "trash",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "trash-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "tune",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "tune-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "undo",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "undo-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "up",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "top",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "upload",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "upload-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "videocam",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "videocam-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "vip",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "vip-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "wallet",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "wallet-filled",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "weibo",
|
||||
"unicode": ""
|
||||
},
|
||||
{
|
||||
"font_class": "weixin",
|
||||
"unicode": ""
|
||||
}
|
||||
];
|
||||
exports.fontData = fontData;
|
||||
+321
@@ -0,0 +1,321 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniListItem",
|
||||
emits: ["click", "switchChange"],
|
||||
props: {
|
||||
direction: {
|
||||
type: String,
|
||||
default: "row"
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
note: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
ellipsis: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
disabled: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
clickable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showArrow: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
link: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
to: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
showBadge: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
showSwitch: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
switchChecked: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
badgeText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
badgeType: {
|
||||
type: String,
|
||||
default: "success"
|
||||
},
|
||||
badgeStyle: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
rightText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
thumb: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
thumbSize: {
|
||||
type: String,
|
||||
default: "base"
|
||||
},
|
||||
showExtraIcon: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
extraIcon: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
type: "",
|
||||
color: "#000000",
|
||||
size: 20,
|
||||
customPrefix: ""
|
||||
};
|
||||
}
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
padding: "",
|
||||
backgroundColor: "#FFFFFF"
|
||||
};
|
||||
}
|
||||
},
|
||||
keepScrollPosition: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"customStyle.padding": {
|
||||
handler(padding) {
|
||||
if (typeof padding == "number") {
|
||||
padding += "";
|
||||
}
|
||||
let paddingArr = padding.split(" ");
|
||||
if (paddingArr.length === 1) {
|
||||
const allPadding = paddingArr[0];
|
||||
this.padding = {
|
||||
"top": allPadding,
|
||||
"right": allPadding,
|
||||
"bottom": allPadding,
|
||||
"left": allPadding
|
||||
};
|
||||
} else if (paddingArr.length === 2) {
|
||||
const [verticalPadding, horizontalPadding] = paddingArr;
|
||||
this.padding = {
|
||||
"top": verticalPadding,
|
||||
"right": horizontalPadding,
|
||||
"bottom": verticalPadding,
|
||||
"left": horizontalPadding
|
||||
};
|
||||
} else if (paddingArr.length === 4) {
|
||||
const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
|
||||
this.padding = {
|
||||
"top": topPadding,
|
||||
"right": rightPadding,
|
||||
"bottom": bottomPadding,
|
||||
"left": leftPadding
|
||||
};
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
// inject: ['list'],
|
||||
data() {
|
||||
return {
|
||||
isFirstChild: false,
|
||||
padding: {
|
||||
top: "",
|
||||
right: "",
|
||||
bottom: "",
|
||||
left: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.list = this.getForm();
|
||||
if (this.list) {
|
||||
if (!this.list.firstChildAppend) {
|
||||
this.list.firstChildAppend = true;
|
||||
this.isFirstChild = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getForm(name = "uniList") {
|
||||
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;
|
||||
},
|
||||
onClick() {
|
||||
if (this.to !== "") {
|
||||
this.openPage();
|
||||
return;
|
||||
}
|
||||
if (this.clickable || this.link) {
|
||||
this.$emit("click", {
|
||||
data: {}
|
||||
});
|
||||
}
|
||||
},
|
||||
onSwitchChange(e) {
|
||||
this.$emit("switchChange", e.detail);
|
||||
},
|
||||
openPage() {
|
||||
if (["navigateTo", "redirectTo", "reLaunch", "switchTab"].indexOf(this.link) !== -1) {
|
||||
this.pageApi(this.link);
|
||||
} else {
|
||||
this.pageApi("navigateTo");
|
||||
}
|
||||
},
|
||||
pageApi(api) {
|
||||
let callback = {
|
||||
url: this.to,
|
||||
success: (res) => {
|
||||
this.$emit("click", {
|
||||
data: res
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
this.$emit("click", {
|
||||
data: err
|
||||
});
|
||||
}
|
||||
};
|
||||
switch (api) {
|
||||
case "navigateTo":
|
||||
common_vendor.index.navigateTo(callback);
|
||||
break;
|
||||
case "redirectTo":
|
||||
common_vendor.index.redirectTo(callback);
|
||||
break;
|
||||
case "reLaunch":
|
||||
common_vendor.index.reLaunch(callback);
|
||||
break;
|
||||
case "switchTab":
|
||||
common_vendor.index.switchTab(callback);
|
||||
break;
|
||||
default:
|
||||
common_vendor.index.navigateTo(callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
const _easycom_uni_badge2 = common_vendor.resolveComponent("uni-badge");
|
||||
(_easycom_uni_icons2 + _easycom_uni_badge2)();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
|
||||
const _easycom_uni_badge = () => "../../../uni-badge/components/uni-badge/uni-badge.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_icons + _easycom_uni_badge)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: !$data.isFirstChild
|
||||
}, !$data.isFirstChild ? {
|
||||
b: $props.border ? 1 : ""
|
||||
} : {}, {
|
||||
c: $props.thumb
|
||||
}, $props.thumb ? {
|
||||
d: $props.thumb,
|
||||
e: common_vendor.n("uni-list--" + $props.thumbSize)
|
||||
} : $props.showExtraIcon ? {
|
||||
g: common_vendor.p({
|
||||
customPrefix: $props.extraIcon.customPrefix,
|
||||
color: $props.extraIcon.color,
|
||||
size: $props.extraIcon.size,
|
||||
type: $props.extraIcon.type
|
||||
})
|
||||
} : {}, {
|
||||
f: $props.showExtraIcon,
|
||||
h: $props.title
|
||||
}, $props.title ? {
|
||||
i: common_vendor.t($props.title),
|
||||
j: common_vendor.n($props.ellipsis !== 0 && $props.ellipsis <= 2 ? "uni-ellipsis-" + $props.ellipsis : "")
|
||||
} : {}, {
|
||||
k: $props.note
|
||||
}, $props.note ? {
|
||||
l: common_vendor.t($props.note)
|
||||
} : {}, {
|
||||
m: $props.thumb || $props.showExtraIcon || $props.showBadge || $props.showSwitch ? 1 : "",
|
||||
n: $props.rightText || $props.showBadge || $props.showSwitch
|
||||
}, $props.rightText || $props.showBadge || $props.showSwitch ? common_vendor.e({
|
||||
o: $props.rightText
|
||||
}, $props.rightText ? {
|
||||
p: common_vendor.t($props.rightText)
|
||||
} : {}, {
|
||||
q: $props.showBadge
|
||||
}, $props.showBadge ? {
|
||||
r: common_vendor.p({
|
||||
type: $props.badgeType,
|
||||
text: $props.badgeText,
|
||||
["custom-style"]: $props.badgeStyle
|
||||
})
|
||||
} : {}, {
|
||||
s: $props.showSwitch
|
||||
}, $props.showSwitch ? {
|
||||
t: $props.disabled,
|
||||
v: $props.switchChecked,
|
||||
w: common_vendor.o((...args) => $options.onSwitchChange && $options.onSwitchChange(...args))
|
||||
} : {}, {
|
||||
x: $props.direction === "column" ? 1 : ""
|
||||
}) : {}, {
|
||||
y: $props.showArrow || $props.link ? 1 : "",
|
||||
z: $props.direction === "column" ? 1 : "",
|
||||
A: $data.padding.top,
|
||||
B: $data.padding.left,
|
||||
C: $data.padding.right,
|
||||
D: $data.padding.bottom,
|
||||
E: $props.showArrow || $props.link
|
||||
}, $props.showArrow || $props.link ? {
|
||||
F: common_vendor.p({
|
||||
size: 16,
|
||||
color: "#bbb",
|
||||
type: "arrowright"
|
||||
})
|
||||
} : {}, {
|
||||
G: $props.disabled ? 1 : "",
|
||||
H: $props.customStyle.backgroundColor,
|
||||
I: !$props.clickable && !$props.link || $props.disabled || $props.showSwitch ? "" : "uni-list-item--hover",
|
||||
J: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons",
|
||||
"uni-badge": "../../../uni-badge/components/uni-badge/uni-badge"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="{{[G && 'uni-list-item--disabled', 'uni-list-item']}}" style="{{'background-color:' + H}}" hover-class="{{I}}" bindtap="{{J}}"><view wx:if="{{a}}" class="{{['border--left', b && 'uni-list--border']}}"></view><view class="{{['uni-list-item__container', y && 'container--right', z && 'flex--direction']}}" style="{{'padding-top:' + A + ';' + ('padding-left:' + B) + ';' + ('padding-right:' + C) + ';' + ('padding-bottom:' + D)}}"><block wx:if="{{$slots.header}}"><slot name="header"></slot></block><block wx:else><view class="uni-list-item__header"><view wx:if="{{c}}" class="uni-list-item__icon"><image src="{{d}}" class="{{['uni-list-item__icon-img', e]}}"/></view><view wx:elif="{{f}}" class="uni-list-item__icon"><uni-icons wx:if="{{g}}" u-i="1b82e48a-0" bind:__l="__l" u-p="{{g}}"/></view></view></block><block wx:if="{{$slots.body}}"><slot name="body"></slot></block><block wx:else><view class="{{['uni-list-item__content', m && 'uni-list-item__content--center']}}"><text wx:if="{{h}}" class="{{['uni-list-item__content-title', j]}}">{{i}}</text><text wx:if="{{k}}" class="uni-list-item__content-note">{{l}}</text></view></block><block wx:if="{{$slots.footer}}"><slot name="footer"></slot></block><block wx:else><view wx:if="{{n}}" class="{{['uni-list-item__extra', x && 'flex--justify']}}"><text wx:if="{{o}}" class="uni-list-item__extra-text">{{p}}</text><uni-badge wx:if="{{q}}" u-i="1b82e48a-1" bind:__l="__l" u-p="{{r}}"/><switch wx:if="{{s}}" disabled="{{t}}" checked="{{v}}" bindchange="{{w}}"/></view></block></view><uni-icons wx:if="{{E}}" class="uni-icon-wrapper" u-i="1b82e48a-2" bind:__l="__l" u-p="{{F}}"/></view>
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-list-item {
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
flex-direction: row;
|
||||
}
|
||||
.uni-list-item--disabled {
|
||||
opacity: 0.3;
|
||||
}
|
||||
.uni-list-item--hover {
|
||||
background-color: #f1f1f1 !important;
|
||||
}
|
||||
.uni-list-item__container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 12px 15px;
|
||||
padding-left: 15px;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
.container--right {
|
||||
padding-right: 0;
|
||||
}
|
||||
.uni-list--border {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
.uni-list--border:after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
content: "";
|
||||
transform: scaleY(0.5);
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
.uni-list-item__content {
|
||||
display: flex;
|
||||
padding-right: 8px;
|
||||
flex: 1;
|
||||
color: #3b4144;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-list-item__content--center {
|
||||
justify-content: center;
|
||||
}
|
||||
.uni-list-item__content-title {
|
||||
font-size: 14px;
|
||||
color: #3b4144;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-list-item__content-note {
|
||||
margin-top: 6rpx;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uni-list-item__extra {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-list-item__header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-list-item__icon {
|
||||
margin-right: 18rpx;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-list-item__icon-img {
|
||||
display: block;
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.uni-icon-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.flex--direction {
|
||||
flex-direction: column;
|
||||
align-items: initial;
|
||||
}
|
||||
.flex--justify {
|
||||
justify-content: initial;
|
||||
}
|
||||
.uni-list--lg {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
}
|
||||
.uni-list--base {
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
}
|
||||
.uni-list--sm {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.uni-list-item__extra-text {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-ellipsis-1 {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.uni-ellipsis-2 {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniList",
|
||||
"mp-weixin": {
|
||||
options: {
|
||||
multipleSlots: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
stackFromEnd: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
enableBackToTop: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
scrollY: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
renderReverse: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
// provide() {
|
||||
// return {
|
||||
// list: this
|
||||
// };
|
||||
// },
|
||||
created() {
|
||||
this.firstChildAppend = false;
|
||||
},
|
||||
methods: {
|
||||
loadMore(e) {
|
||||
this.$emit("scrolltolower");
|
||||
},
|
||||
scroll(e) {
|
||||
this.$emit("scroll", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.border
|
||||
}, $props.border ? {} : {}, {
|
||||
b: $props.border
|
||||
}, $props.border ? {} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-list/components/uni-list/uni-list.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-list uni-border-top-bottom"><view wx:if="{{a}}" class="uni-list--border-top"></view><slot/><view wx:if="{{b}}" class="uni-list--border-bottom"></view></view>
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-list {
|
||||
display: flex;
|
||||
background-color: #ffffff;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
}
|
||||
.uni-list--border {
|
||||
position: relative;
|
||||
z-index: -1;
|
||||
}
|
||||
.uni-list--border-top {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
transform: scaleY(0.5);
|
||||
background-color: #e5e5e5;
|
||||
z-index: 1;
|
||||
}
|
||||
.uni-list--border-bottom {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
transform: scaleY(0.5);
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
const en = {
|
||||
"uni-load-more.contentdown": "Pull up to show more",
|
||||
"uni-load-more.contentrefresh": "loading...",
|
||||
"uni-load-more.contentnomore": "No more data"
|
||||
};
|
||||
const zhHans = {
|
||||
"uni-load-more.contentdown": "上拉显示更多",
|
||||
"uni-load-more.contentrefresh": "正在加载...",
|
||||
"uni-load-more.contentnomore": "没有更多数据了"
|
||||
};
|
||||
const zhHant = {
|
||||
"uni-load-more.contentdown": "上拉顯示更多",
|
||||
"uni-load-more.contentrefresh": "正在加載...",
|
||||
"uni-load-more.contentnomore": "沒有更多數據了"
|
||||
};
|
||||
const messages = {
|
||||
en,
|
||||
"zh-Hans": zhHans,
|
||||
"zh-Hant": zhHant
|
||||
};
|
||||
exports.messages = messages;
|
||||
+111
File diff suppressed because one or more lines are too long
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="uni-load-more" bindtap="{{q}}"><view wx:if="{{a}}" style="{{'width:' + h + ';' + ('height:' + i)}}" class="uni-load-more__img uni-load-more__img--android-MP"><view class="uni-load-more__img-icon" style="{{'border-top-color:' + b + ';' + ('border-top-width:' + c)}}"></view><view class="uni-load-more__img-icon" style="{{'border-top-color:' + d + ';' + ('border-top-width:' + e)}}"></view><view class="uni-load-more__img-icon" style="{{'border-top-color:' + f + ';' + ('border-top-width:' + g)}}"></view></view><view wx:elif="{{j}}" style="{{'width:' + l + ';' + ('height:' + m)}}" class="uni-load-more__img uni-load-more__img--ios-H5"><image src="{{k}}" mode="widthFix"></image></view><text wx:if="{{n}}" class="uni-load-more__text" style="{{'color:' + p}}">{{o}}</text></view>
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-load-more {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.uni-load-more__text {
|
||||
font-size: 14px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.uni-load-more__img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.uni-load-more__img--nvue {
|
||||
color: #666666;
|
||||
}
|
||||
.uni-load-more__img--android,
|
||||
.uni-load-more__img--ios {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
.uni-load-more__img--android {
|
||||
animation: loading-ios 1s 0s linear infinite;
|
||||
}
|
||||
@keyframes loading-android {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.uni-load-more__img--ios-H5 {
|
||||
position: relative;
|
||||
animation: loading-ios-H5 1s 0s step-end infinite;
|
||||
}
|
||||
.uni-load-more__img--ios-H5 image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
@keyframes loading-ios-H5 {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
8% {
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
16% {
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
24% {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
32% {
|
||||
transform: rotate(120deg);
|
||||
}
|
||||
40% {
|
||||
transform: rotate(150deg);
|
||||
}
|
||||
48% {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
56% {
|
||||
transform: rotate(210deg);
|
||||
}
|
||||
64% {
|
||||
transform: rotate(240deg);
|
||||
}
|
||||
73% {
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
82% {
|
||||
transform: rotate(300deg);
|
||||
}
|
||||
91% {
|
||||
transform: rotate(330deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.uni-load-more__img--android-MP {
|
||||
position: relative;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
transform: rotate(0deg);
|
||||
animation: loading-ios 1s 0s ease infinite;
|
||||
}
|
||||
.uni-load-more__img--android-MP .uni-load-more__img-icon {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: solid 2px transparent;
|
||||
border-top: solid 2px #777777;
|
||||
transform-origin: center;
|
||||
}
|
||||
.uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(1) {
|
||||
animation: loading-android-MP-1 1s 0s linear infinite;
|
||||
}
|
||||
.uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(2) {
|
||||
animation: loading-android-MP-2 1s 0s linear infinite;
|
||||
}
|
||||
.uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(3) {
|
||||
animation: loading-android-MP-3 1s 0s linear infinite;
|
||||
}
|
||||
@keyframes loading-android {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes loading-android-MP-1 {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes loading-android-MP-2 {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes loading-android-MP-3 {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "uniPopup",
|
||||
components: {},
|
||||
emits: ["change", "maskClick"],
|
||||
props: {
|
||||
// 开启动画
|
||||
animation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
||||
// message: 消息提示 ; dialog : 对话框
|
||||
type: {
|
||||
type: String,
|
||||
default: "center"
|
||||
},
|
||||
// maskClick
|
||||
isMaskClick: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
},
|
||||
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
|
||||
maskClick: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
},
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: "none"
|
||||
},
|
||||
safeArea: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
maskBackgroundColor: {
|
||||
type: String,
|
||||
default: "rgba(0, 0, 0, 0.4)"
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
/**
|
||||
* 监听type类型
|
||||
*/
|
||||
type: {
|
||||
handler: function(type) {
|
||||
if (!this.config[type]) return;
|
||||
this[this.config[type]](true);
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
isDesktop: {
|
||||
handler: function(newVal) {
|
||||
if (!this.config[newVal]) return;
|
||||
this[this.config[this.type]](true);
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
/**
|
||||
* 监听遮罩是否可点击
|
||||
* @param {Object} val
|
||||
*/
|
||||
maskClick: {
|
||||
handler: function(val) {
|
||||
this.mkclick = val;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
isMaskClick: {
|
||||
handler: function(val) {
|
||||
this.mkclick = val;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// H5 下禁止底部滚动
|
||||
showPopup(show) {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
duration: 300,
|
||||
ani: [],
|
||||
showPopup: false,
|
||||
showTrans: false,
|
||||
popupWidth: 0,
|
||||
popupHeight: 0,
|
||||
config: {
|
||||
top: "top",
|
||||
bottom: "bottom",
|
||||
center: "center",
|
||||
left: "left",
|
||||
right: "right",
|
||||
message: "top",
|
||||
dialog: "center",
|
||||
share: "bottom"
|
||||
},
|
||||
maskClass: {
|
||||
position: "fixed",
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
||||
},
|
||||
transClass: {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0
|
||||
},
|
||||
maskShow: true,
|
||||
mkclick: true,
|
||||
popupstyle: "top"
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isDesktop() {
|
||||
return this.popupWidth >= 500 && this.popupHeight >= 500;
|
||||
},
|
||||
bg() {
|
||||
if (this.backgroundColor === "" || this.backgroundColor === "none") {
|
||||
return "transparent";
|
||||
}
|
||||
return this.backgroundColor;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const fixSize = () => {
|
||||
const {
|
||||
windowWidth,
|
||||
windowHeight,
|
||||
windowTop,
|
||||
safeArea,
|
||||
screenHeight,
|
||||
safeAreaInsets
|
||||
} = common_vendor.index.getSystemInfoSync();
|
||||
this.popupWidth = windowWidth;
|
||||
this.popupHeight = windowHeight + (windowTop || 0);
|
||||
if (safeArea && this.safeArea) {
|
||||
this.safeAreaInsets = screenHeight - safeArea.bottom;
|
||||
} else {
|
||||
this.safeAreaInsets = 0;
|
||||
}
|
||||
};
|
||||
fixSize();
|
||||
},
|
||||
// TODO vue3
|
||||
unmounted() {
|
||||
this.setH5Visible();
|
||||
},
|
||||
created() {
|
||||
if (this.isMaskClick === null && this.maskClick === null) {
|
||||
this.mkclick = true;
|
||||
} else {
|
||||
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
|
||||
}
|
||||
if (this.animation) {
|
||||
this.duration = 300;
|
||||
} else {
|
||||
this.duration = 0;
|
||||
}
|
||||
this.messageChild = null;
|
||||
this.clearPropagation = false;
|
||||
this.maskClass.backgroundColor = this.maskBackgroundColor;
|
||||
},
|
||||
methods: {
|
||||
setH5Visible() {
|
||||
},
|
||||
/**
|
||||
* 公用方法,不显示遮罩层
|
||||
*/
|
||||
closeMask() {
|
||||
this.maskShow = false;
|
||||
},
|
||||
/**
|
||||
* 公用方法,遮罩层禁止点击
|
||||
*/
|
||||
disableMask() {
|
||||
this.mkclick = false;
|
||||
},
|
||||
// TODO nvue 取消冒泡
|
||||
clear(e) {
|
||||
e.stopPropagation();
|
||||
this.clearPropagation = true;
|
||||
},
|
||||
open(direction) {
|
||||
if (this.showPopup) {
|
||||
return;
|
||||
}
|
||||
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
|
||||
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
||||
direction = this.type;
|
||||
}
|
||||
if (!this.config[direction]) {
|
||||
console.error("缺少类型:", direction);
|
||||
return;
|
||||
}
|
||||
this[this.config[direction]]();
|
||||
this.$emit("change", {
|
||||
show: true,
|
||||
type: direction
|
||||
});
|
||||
},
|
||||
close(type) {
|
||||
this.showTrans = false;
|
||||
this.$emit("change", {
|
||||
show: false,
|
||||
type: this.type
|
||||
});
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.showPopup = false;
|
||||
}, 300);
|
||||
},
|
||||
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
|
||||
touchstart() {
|
||||
this.clearPropagation = false;
|
||||
},
|
||||
onTap() {
|
||||
if (this.clearPropagation) {
|
||||
this.clearPropagation = false;
|
||||
return;
|
||||
}
|
||||
this.$emit("maskClick");
|
||||
if (!this.mkclick) return;
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
* 顶部弹出样式处理
|
||||
*/
|
||||
top(type) {
|
||||
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
|
||||
this.ani = ["slide-top"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: this.bg
|
||||
};
|
||||
if (type) return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.messageChild && this.type === "message") {
|
||||
this.messageChild.timerClose();
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 底部弹出样式处理
|
||||
*/
|
||||
bottom(type) {
|
||||
this.popupstyle = "bottom";
|
||||
this.ani = ["slide-bottom"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
paddingBottom: this.safeAreaInsets + "px",
|
||||
backgroundColor: this.bg
|
||||
};
|
||||
if (type) return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
/**
|
||||
* 中间弹出样式处理
|
||||
*/
|
||||
center(type) {
|
||||
this.popupstyle = "center";
|
||||
this.ani = ["zoom-out", "fade"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
};
|
||||
if (type) return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
left(type) {
|
||||
this.popupstyle = "left";
|
||||
this.ani = ["slide-left"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
backgroundColor: this.bg,
|
||||
display: "flex",
|
||||
flexDirection: "column"
|
||||
};
|
||||
if (type) return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
},
|
||||
right(type) {
|
||||
this.popupstyle = "right";
|
||||
this.ani = ["slide-right"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
backgroundColor: this.bg,
|
||||
display: "flex",
|
||||
flexDirection: "column"
|
||||
};
|
||||
if (type) return;
|
||||
this.showPopup = true;
|
||||
this.showTrans = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
|
||||
_easycom_uni_transition2();
|
||||
}
|
||||
const _easycom_uni_transition = () => "../../../uni-transition/components/uni-transition/uni-transition.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_transition();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.showPopup
|
||||
}, $data.showPopup ? common_vendor.e({
|
||||
b: $data.maskShow
|
||||
}, $data.maskShow ? {
|
||||
c: common_vendor.o($options.onTap),
|
||||
d: common_vendor.p({
|
||||
name: "mask",
|
||||
["mode-class"]: "fade",
|
||||
styles: $data.maskClass,
|
||||
duration: $data.duration,
|
||||
show: $data.showTrans
|
||||
})
|
||||
} : {}, {
|
||||
e: $options.bg,
|
||||
f: common_vendor.n($data.popupstyle),
|
||||
g: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
|
||||
h: common_vendor.o($options.onTap),
|
||||
i: common_vendor.p({
|
||||
["mode-class"]: $data.ani,
|
||||
name: "content",
|
||||
styles: $data.transClass,
|
||||
duration: $data.duration,
|
||||
show: $data.showTrans
|
||||
}),
|
||||
j: common_vendor.o((...args) => $options.touchstart && $options.touchstart(...args)),
|
||||
k: common_vendor.n($data.popupstyle),
|
||||
l: common_vendor.n($options.isDesktop ? "fixforpc-z-index" : "")
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-transition": "../../../uni-transition/components/uni-transition/uni-transition"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view wx:if="{{a}}" class="{{['uni-popup', k, l]}}"><view bindtouchstart="{{j}}"><uni-transition wx:if="{{b}}" key="1" bindclick="{{c}}" u-i="757f00f2-0" bind:__l="__l" u-p="{{d}}"/><uni-transition wx:if="{{i}}" u-s="{{['d']}}" key="2" bindclick="{{h}}" u-i="757f00f2-1" bind:__l="__l" u-p="{{i}}"><view style="{{'background-color:' + e}}" class="{{['uni-popup__wrapper', f]}}" bindtap="{{g}}"><slot/></view></uni-transition></view></view>
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-popup {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
}
|
||||
.uni-popup.top, .uni-popup.left, .uni-popup.right {
|
||||
top: 0;
|
||||
}
|
||||
.uni-popup .uni-popup__wrapper {
|
||||
display: block;
|
||||
position: relative;
|
||||
/* iphonex 等安全区设置,底部安全区适配 */
|
||||
}
|
||||
.uni-popup .uni-popup__wrapper.left, .uni-popup .uni-popup__wrapper.right {
|
||||
padding-top: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.fixforpc-z-index {
|
||||
z-index: 999;
|
||||
}
|
||||
.fixforpc-top {
|
||||
top: 0;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const ComponentClass = "uni-col";
|
||||
const _sfc_main = {
|
||||
name: "uniCol",
|
||||
options: {
|
||||
virtualHost: true
|
||||
// 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
|
||||
},
|
||||
props: {
|
||||
span: {
|
||||
type: Number,
|
||||
default: 24
|
||||
},
|
||||
offset: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
pull: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
push: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
xs: [Number, Object],
|
||||
sm: [Number, Object],
|
||||
md: [Number, Object],
|
||||
lg: [Number, Object],
|
||||
xl: [Number, Object]
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
gutter: 0,
|
||||
sizeClass: "",
|
||||
parentWidth: 0,
|
||||
nvueWidth: 0,
|
||||
marginLeft: 0,
|
||||
right: 0,
|
||||
left: 0
|
||||
};
|
||||
},
|
||||
created() {
|
||||
let parent = this.$parent;
|
||||
while (parent && parent.$options.componentName !== "uniRow") {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
this.updateGutter(parent.gutter);
|
||||
parent.$watch("gutter", (gutter) => {
|
||||
this.updateGutter(gutter);
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
sizeList() {
|
||||
let {
|
||||
span,
|
||||
offset,
|
||||
pull,
|
||||
push
|
||||
} = this;
|
||||
return {
|
||||
span,
|
||||
offset,
|
||||
pull,
|
||||
push
|
||||
};
|
||||
},
|
||||
pointClassList() {
|
||||
let classList = [];
|
||||
["xs", "sm", "md", "lg", "xl"].forEach((point) => {
|
||||
const props = this[point];
|
||||
if (typeof props === "number") {
|
||||
classList.push(`${ComponentClass}-${point}-${props}`);
|
||||
} else if (typeof props === "object" && props) {
|
||||
Object.keys(props).forEach((pointProp) => {
|
||||
classList.push(
|
||||
pointProp === "span" ? `${ComponentClass}-${point}-${props[pointProp]}` : `${ComponentClass}-${point}-${pointProp}-${props[pointProp]}`
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
return classList.join(" ");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateGutter(parentGutter) {
|
||||
parentGutter = Number(parentGutter);
|
||||
if (!isNaN(parentGutter)) {
|
||||
this.gutter = parentGutter / 2;
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
sizeList: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
let classList = [];
|
||||
for (let size in newVal) {
|
||||
const curSize = newVal[size];
|
||||
if ((curSize || curSize === 0) && curSize !== -1) {
|
||||
classList.push(
|
||||
size === "span" ? `${ComponentClass}-${curSize}` : `${ComponentClass}-${size}-${curSize}`
|
||||
);
|
||||
}
|
||||
}
|
||||
this.sizeClass = classList.join(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.n($data.sizeClass),
|
||||
b: common_vendor.n($options.pointClassList),
|
||||
c: `${Number($data.gutter)}rpx`,
|
||||
d: `${Number($data.gutter)}rpx`
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-67dffd50"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-row/components/uni-col/uni-col.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-67dffd50', 'uni-col', a, b]}}" style="{{'padding-left:' + c + ';' + ('padding-right:' + d)}}"><slot></slot></view>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const ComponentClass = "uni-row";
|
||||
const modifierSeparator = "--";
|
||||
const _sfc_main = {
|
||||
name: "uniRow",
|
||||
componentName: "uniRow",
|
||||
options: {
|
||||
virtualHost: true
|
||||
// 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现,可使用flex布局
|
||||
},
|
||||
props: {
|
||||
type: String,
|
||||
gutter: Number,
|
||||
justify: {
|
||||
type: String,
|
||||
default: "start"
|
||||
},
|
||||
align: {
|
||||
type: String,
|
||||
default: "top"
|
||||
},
|
||||
// nvue如果使用span等属性,需要配置宽度
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: 750
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {
|
||||
marginValue() {
|
||||
if (this.gutter) {
|
||||
return -(this.gutter / 2);
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
typeClass() {
|
||||
return this.type === "flex" ? `${ComponentClass + modifierSeparator}flex` : "";
|
||||
},
|
||||
justifyClass() {
|
||||
return this.justify !== "start" ? `${ComponentClass + modifierSeparator}flex-justify-${this.justify}` : "";
|
||||
},
|
||||
alignClass() {
|
||||
return this.align !== "top" ? `${ComponentClass + modifierSeparator}flex-align-${this.align}` : "";
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.n($options.typeClass),
|
||||
b: common_vendor.n($options.justifyClass),
|
||||
c: common_vendor.n($options.alignClass),
|
||||
d: `${Number($options.marginValue)}rpx`,
|
||||
e: `${Number($options.marginValue)}rpx`
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-row/components/uni-row/uni-row.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="{{['uni-row', a, b, c]}}" style="{{'margin-left:' + d + ';' + ('margin-right:' + e)}}"><slot></slot></view>
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-row {
|
||||
position: relative;
|
||||
flex-direction: row;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-row::before,
|
||||
.uni-row::after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
.uni-row::after {
|
||||
clear: both;
|
||||
}
|
||||
.uni-row--flex {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-row--flex:before, .uni-row--flex:after {
|
||||
display: none;
|
||||
}
|
||||
.uni-row--flex-justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.uni-row--flex-justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.uni-row--flex-justify-space-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.uni-row--flex-justify-space-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.uni-row--flex-align-middle {
|
||||
align-items: center;
|
||||
}
|
||||
.uni-row--flex-align-bottom {
|
||||
align-items: flex-end;
|
||||
}
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "UniSegmentedControl",
|
||||
emits: ["clickItem"],
|
||||
props: {
|
||||
current: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
values: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: "#2979FF"
|
||||
},
|
||||
styleType: {
|
||||
type: String,
|
||||
default: "button"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentIndex: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
current(val) {
|
||||
if (val !== this.currentIndex) {
|
||||
this.currentIndex = val;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.currentIndex = this.current;
|
||||
},
|
||||
methods: {
|
||||
_onClick(index) {
|
||||
if (this.currentIndex !== index) {
|
||||
this.currentIndex = index;
|
||||
this.$emit("clickItem", {
|
||||
currentIndex: index
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($props.values, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index === $data.currentIndex ? $props.styleType === "text" ? $props.activeColor : "#fff" : $props.styleType === "text" ? "#000" : $props.activeColor,
|
||||
c: common_vendor.n($props.styleType === "text" && index === $data.currentIndex ? "segmented-control__item--text" : ""),
|
||||
d: common_vendor.n(index === $data.currentIndex && $props.styleType === "button" ? "segmented-control__item--button--active" : ""),
|
||||
e: common_vendor.n(index === 0 && $props.styleType === "button" ? "segmented-control__item--button--first" : ""),
|
||||
f: common_vendor.n(index === $props.values.length - 1 && $props.styleType === "button" ? "segmented-control__item--button--last" : ""),
|
||||
g: index,
|
||||
h: index === $data.currentIndex && $props.styleType === "button" ? $props.activeColor : "",
|
||||
i: index === $data.currentIndex && $props.styleType === "text" || $props.styleType === "button" ? $props.activeColor : "transparent",
|
||||
j: common_vendor.o(($event) => $options._onClick(index), index)
|
||||
};
|
||||
}),
|
||||
b: common_vendor.n($props.styleType === "text" ? "" : "segmented-control__item--button"),
|
||||
c: common_vendor.n($props.styleType === "text" ? "segmented-control--text" : "segmented-control--button"),
|
||||
d: $props.styleType === "text" ? "" : $props.activeColor
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-634a5194"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="{{[c, 'segmented-control', 'data-v-634a5194']}}" style="{{'border-color:' + d}}"><view wx:for="{{a}}" wx:for-item="item" wx:key="g" class="{{[b, item.d, item.e, item.f, 'segmented-control__item', 'data-v-634a5194']}}" style="{{'background-color:' + item.h + ';' + ('border-color:' + item.i)}}" bindtap="{{item.j}}"><view class="data-v-634a5194"><text style="{{'color:' + item.b}}" class="{{['segmented-control__text', 'data-v-634a5194', item.c]}}">{{item.a}}</text></view></view></view>
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.segmented-control.data-v-634a5194 {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: row;
|
||||
height: 36px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.segmented-control__item.data-v-634a5194 {
|
||||
display: inline-flex;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.segmented-control__item--button.data-v-634a5194 {
|
||||
border-style: solid;
|
||||
border-top-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-left-width: 0;
|
||||
}
|
||||
.segmented-control__item--button--first.data-v-634a5194 {
|
||||
border-left-width: 1px;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
.segmented-control__item--button--last.data-v-634a5194 {
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
.segmented-control__item--text.data-v-634a5194 {
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 2px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
.segmented-control__text.data-v-634a5194 {
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
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");
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $props.text
|
||||
}, $props.text ? {
|
||||
b: common_vendor.t($props.text),
|
||||
c: common_vendor.n($options.classes),
|
||||
d: common_vendor.s($props.customStyle),
|
||||
e: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-873c359d"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-tag/components/uni-tag/uni-tag.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<text wx:if="{{a}}" class="{{['uni-tag', 'data-v-873c359d', c]}}" style="{{d}}" bindtap="{{e}}">{{b}}</text>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user