flat: 删除无用js和插件

This commit is contained in:
史典卓
2025-05-19 15:31:49 +08:00
parent 6c478a9d0b
commit 9f47ea0e53
15 changed files with 0 additions and 1380 deletions

View File

@@ -1 +0,0 @@
const _count=Symbol("count");const _lowestCount=Symbol("lowestCount");const _items=Symbol("items");class Queue{constructor(){this[_count]=0;this[_lowestCount]=0;this[_items]={}}enqueue(element){this[_items][this[_count]]=element;this[_count]++}dequeue(){if(this.isEmpty())return undefined;const result=this[_items][this[_lowestCount]];delete this[_items][this[_lowestCount]];this[_lowestCount]++;return result}peek(){return this.isEmpty()?undefined:this[_items][this[_lowestCount]]}isEmpty(){return this[_count]-this[_lowestCount]===0}size(){return this[_count]-this[_lowestCount]}clear(){this[_count]=0;this[_lowestCount]=0;this[_items]={}}toString(){return Object.values(this[_items]).join(",")}}Object.freeze(Queue.prototype);const _dequeItems=Symbol("dequeItems");class Deque{constructor(){this[_items]={};this[_lowestCount]=0;this[_count]=0}addFront(element){if(this.isEmpty()){this.addBack(element)}else if(this[_lowestCount]>0){this[_lowestCount]--;this[_items][this[_lowestCount]]=element}else{for(let i=this[_count];i>0;i--){this[_items][i]=this[_items][i-1]}this[_items][0]=element;this[_count]++}}addBack(element){this[_items][this[_count]]=element;this[_count]++}removeFront(){if(this.isEmpty())return undefined;const result=this[_items][this[_lowestCount]];delete this[_items][this[_lowestCount]];this[_lowestCount]++;return result}removeBack(){if(this.isEmpty())return undefined;this[_count]--;const result=this[_items][this[_count]];delete this[_items][this[_count]];return result}peekFront(){return this.isEmpty()?undefined:this[_items][this[_lowestCount]]}peekBack(){return this.isEmpty()?undefined:this[_items][this[_count]-1]}isEmpty(){return this[_count]-this[_lowestCount]===0}size(){return this[_count]-this[_lowestCount]}clear(){this[_items]={};this[_lowestCount]=0;this[_count]=0}toString(){return Object.values(this[_items]).join(",")}}Object.freeze(Deque.prototype);export{Queue,Deque};

BIN
uni_modules/.DS_Store vendored

Binary file not shown.

View File

@@ -1,39 +0,0 @@
## 1.0.82024-03-28
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.72024-01-20
- 修复 长文本回显超过容器的bug超过容器部分显示省略号
## 1.0.62023-04-12
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.52023-02-03
- 修复 禁用时会显示清空按钮
## 1.0.42023-02-02
- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
## 1.0.32023-01-16
- 修复 不关联服务空间报错的问题
## 1.0.22023-01-14
- 新增 属性 `format` 可用于格式化显示选项内容
## 1.0.12022-12-06
- 修复 当where变化时数据不会自动更新的问题
## 0.1.92022-09-05
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.82022-08-29
- 修复 点击的位置不准确
## 0.1.72022-08-12
- 新增 支持 disabled 属性
## 0.1.62022-07-06
- 修复 pc端宽度异常的bug
## 0.1.5
- 修复 pc端宽度异常的bug
## 0.1.42022-07-05
- 优化 显示样式
## 0.1.32022-06-02
- 修复 localdata 赋值不生效的 bug
- 新增 支持 uni.scss 修改颜色
- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用)
## 0.1.22022-05-08
- 修复 当 value 为 0 时选择不生效的 bug
## 0.1.12022-05-07
- 新增 记住上次的选项(仅 collection 存在时有效)
## 0.1.02022-04-22
- 初始化

View File

@@ -1,574 +0,0 @@
<template>
<view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{ label + '' }}</span>
<view class="uni-stat-box" :class="{ 'uni-stat__actived': current }">
<view class="uni-select" :class="{ 'uni-select--disabled': disabled, 'uni-select--border': border }">
<view class="uni-select__input-box" @click="toggleSelector">
<view v-if="current" class="uni-select__input-text" :style="viewStyle">{{ textShow }}</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder">
{{ typePlaceholder }}
</view>
<view v-if="current && clear && !disabled" @click.stop="clearVal">
<uni-icons type="clear" color="#c0c4cc" size="24" />
</view>
<view v-else>
<uni-icons :type="showSelector ? 'top' : 'bottom'" size="14" color="#999" />
</view>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement == 'bottom' ? 'uni-popper__arrow_bottom' : 'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{ emptyTips }}</text>
</view>
<view
v-else
class="uni-select__selector-item"
v-for="(item, index) in mixinDatacomResData"
:key="index"
@click="change(item)"
>
<text :class="{ 'uni-select__selector__disabled': item.disable }">
{{ formatItemName(item) }}
</text>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
* @property {String} value 默认值
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出default)
* @event {Function} change 选中发生变化触发
*/
export default {
name: 'uni-data-select',
mixins: [uniCloud.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',
},
border: {
type: Boolean,
default: true,
},
viewStyle: {
type: String,
default: '',
},
},
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() {
// #ifdef VUE3
return this.modelValue;
// #endif
// #ifndef VUE3
return this.value;
// #endif
},
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 = uni.getStorageSync(this.cacheKey) || {};
return cacheData[name];
},
// 设置缓存
setCache(value, name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
cacheData[name] = value;
uni.setStorageSync(this.cacheKey, cacheData);
},
// 删除缓存
removeCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
delete cacheData[name];
uni.setStorageSync(this.cacheKey, cacheData);
},
},
};
</script>
<style lang="scss">
$uni-base-color: #6a6a6a !default;
$uni-main-color: #333 !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
display: none;
}
}
/* #endif */
.uni-stat__select {
display: flex;
align-items: center;
// padding: 15px;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
width: 100%;
flex: 1;
box-sizing: border-box;
}
.uni-stat-box {
width: 100%;
flex: 1;
}
.uni-stat__actived {
width: 100%;
flex: 1;
// outline: 1px solid #2979ff;
}
.uni-label-text {
font-size: 14px;
font-weight: bold;
color: $uni-base-color;
margin: auto 0;
margin-right: 5px;
}
.uni-select {
font-size: 14px;
// border: 1px solid $uni-border-3;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
padding-left: 10px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
user-select: none;
/* #endif */
flex-direction: row;
align-items: center;
// border-bottom: solid 1px $uni-border-3;
width: 100%;
flex: 1;
height: 35px;
&--disabled {
background-color: #f5f7fa;
cursor: not-allowed;
}
&--border {
border: 1px solid $uni-border-3;
border-bottom: solid 1px $uni-border-3;
}
}
.uni-select__label {
font-size: 16px;
// line-height: 22px;
height: 35px;
padding-right: 10px;
color: $uni-secondary-color;
}
.uni-select__input-box {
height: 35px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
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: $uni-secondary-color;
}
.uni-select__selector {
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
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;
min-width: 300rpx;
}
.uni-select__selector-scroll {
/* #ifndef APP-NVUE */
max-height: 200px;
box-sizing: border-box;
/* #endif */
}
/* #ifdef H5 */
@media (min-width: 768px) {
.uni-select__selector-scroll {
max-height: 600px;
}
}
/* #endif */
.uni-select__selector-empty,
.uni-select__selector-item {
/* #ifndef APP-NVUE */
display: flex;
cursor: pointer;
/* #endif */
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 {
/* #ifndef APP-NVUE */
border-bottom: none;
/* #endif */
}
.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: 280px;
width: 100%;
color: $uni-main-color;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
}
.uni-select__input-placeholder {
color: $uni-base-color;
font-size: 12px;
}
.uni-select--mask {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 2;
}
</style>

View File

@@ -1,86 +0,0 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.0.8",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
"select",
"uni-data-select",
"下拉框",
"下拉选"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.1.1"
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-load-more"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -1,8 +0,0 @@
## DataSelect 下拉框选择器
> **组件名uni-data-select**
> 代码块: `uDataSelect`
当选项过多时,使用下拉菜单展示并选择内容
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@@ -1,268 +0,0 @@
<template>
<view style="width: 100%; height: 100%">
<view id="mapDiv" class="mapDiv" :apikey="apiKey" :prop="option" :change:prop="Trenderjs.initTMap"></view>
</view>
</template>
<script>
import tools from '../../tools.js';
import iconPath from '../../static/point2.png';
import iconRangePath from '../../static/range.png';
export default {
name: 'TianDiTu-Map',
data() {
return {
Tmap: null,
option: {
type: '',
apikey: '',
cover: null,
lng: '',
lat: '',
png: iconPath,
rangePng: iconRangePath,
showLabel: true,
showCirle: false,
range: 0,
},
};
},
props: {
apiKey: {
type: String,
require: true,
default: '',
},
customIcon: {
type: String,
default: '',
},
showLabel: {
type: Boolean,
default: true,
},
showCirle: {
type: Boolean,
default: true,
},
},
methods: {
compliteonLoadTianDiTu() {
this.$emit('onLoadTianDiTu');
},
initCharts(lng, lat) {
this.option = {
...this.option,
apikey: this.apiKey,
showLabel: this.showLabel,
showCirle: this.showCirle,
lng,
lat,
png: this.customIcon || this.option.png,
type: 'open',
};
},
upDataCharts(lng, lat) {
this.option = {
...this.option,
type: 'Icon',
lng,
lat,
png: this.customIcon || this.option.png,
type: 'update',
showLabel: this.showLabel,
};
},
addFeature(cover) {
this.option = {
...this.option,
type: 'Icon',
cover,
png: this.customIcon || this.option.png,
type: 'addFeature',
showLabel: this.showLabel,
};
},
changeRange(range) {
this.option = {
...this.option,
type: 'Icon',
png: this.customIcon || this.option.png,
type: 'changeRange',
showLabel: this.showLabel,
showCirle: this.showCirle,
range: range,
};
},
selectItem(info) {
this.$emit('onSelect', info);
},
},
};
</script>
<script module="Trenderjs" lang="renderjs">
var Tmap = null;
export default {
data() {
return {
options: {},
circle: [],
}
},
mounted() {
},
methods: {
initTMap(newValue, oldValue, ownerInstance, instance) {
this.options = newValue
if (newValue.type === 'open' && newValue.apikey) {
if (!window.T) {
const script = document.createElement('script')
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.options.apikey
script.onload = this.initChartsRender.bind(this)
document.head.appendChild(script)
console.log('open')
} else {
const {
lng,
lat
} = this.options
Tmap = null;
Tmap = new T.Map('mapDiv', {
projection: 'EPSG:4326',
});
const control = new T.Control.Zoom({ position: T_ANCHOR_TOP_RIGHT});
const scale = new T.Control.Scale({ position: T_ANCHOR_TOP_LEFT});
Tmap.addControl(scale);
Tmap.addControl(control);
this.upDataChartsRender(lng, lat)
this.$ownerInstance.callMethod('compliteonLoadTianDiTu')
}
} else {
const {
lng,
lat,
cover,
showLabel,
showCirle,
range
} = newValue
switch (newValue.type) {
case 'update':
this.upDataChartsRender(lng, lat)
break;
case 'addFeature':
Tmap.clearOverLays()
this.circle = []
cover.map((item, index) => {
this.setIcon(item.lon, item.lat, false, showLabel, false, showCirle, item)
})
break;
case 'changeRange':
this.setRange(range)
default:
break;
}
}
},
initChartsRender() {
this.$ownerInstance.callMethod('compliteonLoadTianDiTu')
const {
lng,
lat
} = this.options
var that = this;
Tmap = new T.Map('mapDiv', {
projection: 'EPSG:4326',
});
this.upDataChartsRender(lng, lat)
const control = new T.Control.Zoom({ position: T_ANCHOR_TOP_RIGHT});
const scale = new T.Control.Scale({ position: T_ANCHOR_TOP_LEFT});
Tmap.addControl(scale);
Tmap.addControl(control);
console.log('初始化1')
},
upDataChartsRender(lng, lat, zoom = 15) {
if (!Tmap) return
Tmap.centerAndZoom(new T.LngLat(lng, lat), zoom);
},
setRange(range) {
for (let item in this.circle) {
this.circle[item].setRadius(range * 1000)
}
// this.circle.setRadius(range * 1000)
},
setIcon(lng, lat, isClear, isClick = false, isLabel = false, isCirle = false, item) {
if (isClear) {
Tmap.clearOverLays()
}
const latlng = new T.LngLat(lng, lat)
const icon = new T.Icon({
iconUrl: this.options.png,
iconSize: new T.Point(30, 30),
iconAnchor: new T.Point(15, 30)
});
if (isLabel) {
const label = new T.Label({
text: `<div style="max-width: 50px; overflow: hidden">${item.label}</div>`,
position: latlng,
offset: new T.Point(-50, 0)
});
Tmap.addOverLay(label);
}
if(isCirle) {
const circleObj = new T.Circle(latlng , parseFloat(50), {
color:"#13C57C",weight:2,opacity:1,fillColor:"#13C57C",fillOpacity:0.24
})
this.circle.push(circleObj)
Tmap.addOverLay(circleObj);
}
const marker = new T.Marker(latlng, {
icon
});
if (isClick) {
this.removeMarkerClick(marker);
//注册标注的点击事件
marker.addEventListener("click", this.MarkerClick.bind(null, item));
}
Tmap.addOverLay(marker);
},
removeMarkerClick(marker) {
//移除标注的点击事件
marker.removeEventListener("click", this.MarkerClick);
},
MarkerClick(item, e) {
this.openInfo(item.label, e)
this.$ownerInstance.callMethod('selectItem', item)
},
openInfo(content, e) {
const point = e.lnglat;
const marker = new T.Marker(point); // 创建标注
const markerInfoWin = new T.InfoWindow(content, {
offset: new T.Point(0, -30)
}); // 创建信息窗口对象
Tmap.openInfoWindow(markerInfoWin, point); //开启信息窗口
}
},
}
</script>
<style scoped>
#mapDiv {
width: 100%;
height: 100%;
overflow: hidden;
}
/deep/ .tdt-control-copyright {
display: none;
}
/deep/ .tdt-label {
/* background: transparent;
box-shadow: none;
border: 0; */
}
</style>

View File

@@ -1,214 +0,0 @@
<template>
<view style="width: 100%; height: 100%">
<view class="mask" style="width: 100%; height: 100%">
<tiandituMap
ref="tiandituMapRefs"
@onLoadTianDiTu="initMaps"
@onSelect="selectPoint"
:apiKey="apiKey"
:customIcon="icon"
:showLabel="showLabel"
:showCirle="showCirle"
></tiandituMap>
</view>
</view>
</template>
<script>
import tiandituMap from './tianditu-map.vue';
import tools from '../../tools.js';
export default {
name: 'zhuozhuoTiandituPlugin',
components: {
tiandituMap,
},
props: {
apiKey: {
type: String,
require: true,
default: '',
},
icon: {
type: String,
default: '',
},
showLabel: {
type: Boolean,
default: true,
},
showCirle: {
type: Boolean,
default: true,
},
},
data() {
return {
winWidth: 0,
winHeight: 0,
winTop: 0,
visible: false,
datalist: [],
selectItem: {},
iStatusBarHeight: 0,
option: {
apikey: 123123,
},
};
},
created() {
var that = this;
// #ifdef APP
// 44 + 10 44: search Input height
const searchHeight = this.search ? 54 : 10;
const { statusBarHeight, screenHeight, windowHeight } = uni.getSystemInfoSync();
if (screenHeight === windowHeight) {
that.iStatusBarHeight = statusBarHeight + searchHeight;
} else {
that.iStatusBarHeight = 0;
}
// #endif
uni.getSystemInfo({
success: function (res) {
that.winWidth = res.windowWidth;
that.winHeight = res.windowHeight;
that.winTop = res.windowTop;
},
});
},
methods: {
open(lon, lat) {
if (lon && lat) {
this.visible = true;
this.$nextTick(() => {
this.$refs.tiandituMapRefs.initCharts(lon, lat);
});
} else {
console.error('请传入lon, lat');
}
},
upDateLonLat(cover) {
if (lon && lat) {
this.$refs.tiandituMapRefs.upDataCharts(lon && lat);
} else {
console.error('请传入lon, lat');
}
},
addFeature(cover) {
if (cover && Array.isArray(cover) && cover.length) {
this.$refs.tiandituMapRefs.addFeature(cover);
} else {
console.error('请传入 cover', cover);
}
},
changeRange(range) {
this.$refs.tiandituMapRefs.changeRange(range);
},
selectPoint(e) {
this.$emit('onSelect', e);
},
initMaps() {
console.warn('--------天地图加载完成--------');
this.$emit('onLoad');
},
},
};
</script>
<style scope>
.mask {
/* overflow: hidden; */
/* position: fixed;
left: 0;
z-index: 399; */
background-color: #ffffff;
}
/* footer */
.list-boxd {
position: absolute;
bottom: 0;
left: 0;
z-index: 401;
right: 0;
border-radius: 14px 14px 0 0;
background: #ffffff;
transition: all 1s;
}
.list-header {
height: 20px;
position: relative;
border-bottom: 1px solid #f3f4f6;
cursor: pointer;
}
.list-header::after {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
content: '';
height: 6px;
width: 60px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
}
.list-content {
max-height: 50vh;
overflow-y: scroll;
}
.card {
min-height: 44px;
padding: 12px;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
}
.card-left {
display: flex;
flex-direction: column;
justify-content: center;
}
.card-right {
padding-right: 10px;
}
.arrow {
border-top: 2px solid #666666;
border-right: 2px solid #666666;
width: 10px;
height: 10px;
transform: rotate(45deg);
}
.card:active {
background-color: #f3f4f6;
}
.card::after {
position: absolute;
content: '';
bottom: 0;
height: 1px;
background-color: #e8e8e8;
width: 90%;
}
.card:last-child::after {
height: 0;
background-color: #ffffff;
}
.card-title {
font-size: 18px;
}
.card-text {
color: #e8e8e8;
font-size: 13px;
}
</style>

View File

@@ -1,83 +0,0 @@
{
"id": "zhuo-tianditu-MultiPoint-Mapper",
"displayName": "zhuo-tianditu-MultiPoint-Mapper",
"version": "1.0.0",
"description": "zhuo-tianditu-MultiPoint-Mapper",
"keywords": [
"zhuo-tianditu-MultiPoint-Mapper"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u",
"alipay": "u"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u",
"app-uvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

View File

@@ -1 +0,0 @@
# zhuo-tianditu-MultiPoint-Mapper

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,106 +0,0 @@
/**
* @param title String提示的内容
* @param duration String提示的延迟时间单位毫秒默认1500
* @param mask Boolean是否显示透明蒙层防止触摸穿透默认false
* @param icon String图标success、error、fail、exception、loading、none默认none
**/
export function createMessage(title, duration = 1500, mask = false, icon = "none") {
uni.showToast({
title,
duration: duration,
mask,
icon
});
}
/**
* @param url String请求的地址默认none
* @param data Object请求的参数默认{}
* @param method String请求的方式默认GET
* @param loading Boolean是否需要loading 默认false
* @param header Objectheaders默认{}
* @returns promise
**/
export function createRequest(url, data = {}, loading = false, method = 'GET', header = {}) {
if (loading) {
uni.showLoading({
title: '请稍后',
mask: true
})
}
return new Promise((resolve, reject) => {
uni.request({
url: url,
method: method,
data: data,
header: header,
success: res => {
if (res.statusCode === 200) {
resolve(res.data)
} else {
if (res.data.msg) {
const str = typeof res.data.resolve === 'string' ? ',' + res.data.resolve :
''
createMessage(res.data.msg + str)
}
throw new Error('请求错误 ' + url)
reject()
}
},
fail: (err) => {
reject(err)
},
complete: () => {
uni.hideLoading();
}
});
})
}
/**
* 数据格式化
* @param obj Object响应的数据
* @param type Number 0 1处理类型
* @returns Object {address = string, name = string, location = {lon, lat }, infomation = {}}
*/
export function formatterAdressLocation(obj, type) {
switch (type) {
case 1:
return {
address: obj.formatted_address,
name: '',
location: obj.location,
infomation: obj.addressComponent
}
break;
case 2:
const [lon, lat] = obj.lonlat.split(',')
return {
address: obj.address,
name: obj.name,
location: {
lon,
lat
},
infomation: obj
}
break
case 3:
return {
address: obj.location.keyWord,
name: '',
location: {
lon: obj.location.lon,
lat: obj.location.lat,
},
infomation: obj.location
}
default:
break;
}
}
export default {
createMessage,
createRequest,
formatterAdressLocation
}