diff --git a/apis/clientCreditApi.js b/apis/clientCreditApi.js
index 625c189..bfd177e 100644
--- a/apis/clientCreditApi.js
+++ b/apis/clientCreditApi.js
@@ -19,3 +19,13 @@ export function getCustomerCreditInfo(data) {
data
})
}
+/**
+ * 创建月结授信
+ * @param {*} data
+ */
+export function makeMonthlyCreditInfo(data) {
+ return http.post({
+ url: '/yyt-uec/supplier/create/customer/credit',
+ data
+ })
+}
diff --git a/apis/commonApi.js b/apis/commonApi.js
index 1a07f27..1dc3bd6 100644
--- a/apis/commonApi.js
+++ b/apis/commonApi.js
@@ -44,3 +44,11 @@ export function getBaseInfo(data = {}, refresh = false) {
}
})
}
+
+/**
+ * 获取当前账号的企业实名认证地址
+ * @param {object} data 参数 enterpriseId
+ */
+export function getVerifyUrl(data = {}) {
+ return http.post({ url: '/yyt-uec/get/fdd-enterprise-verify-url', data })
+}
diff --git a/apis/mineApi.js b/apis/mineApi.js
new file mode 100644
index 0000000..f76e9bc
--- /dev/null
+++ b/apis/mineApi.js
@@ -0,0 +1,14 @@
+import http from '../utils/http/index.js'
+
+/**
+ * 纸掌柜获取纸盘商订单统计
+ * @param {object} data
+ * @returns 订单统计
+ * swagger:http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E7%99%BB%E5%BD%95%E8%AE%A4%E8%AF%81/authorizeByCaptchaUsingPOST
+ */
+export const getOrderStatistics = (data) => {
+ return http.get({
+ url: '/base-paper-trading/get/supplier/order-volume-statistics',
+ data
+ })
+}
diff --git a/components/qn-footer/qn-footer.vue b/components/qn-footer/qn-footer.vue
index c9362ef..991d0a8 100644
--- a/components/qn-footer/qn-footer.vue
+++ b/components/qn-footer/qn-footer.vue
@@ -42,6 +42,7 @@ export default {
background-color: #fff;
overflow: hidden;
padding: 16rpx 0;
+ margin-top: 24rpx;
}
.qn-footer--fixed {
position: fixed;
diff --git a/components/qn-form-item/qn-form-item.vue b/components/qn-form-item/qn-form-item.vue
new file mode 100644
index 0000000..4b0febf
--- /dev/null
+++ b/components/qn-form-item/qn-form-item.vue
@@ -0,0 +1,87 @@
+
+
+
+ {{ label }}
+
+
+
+
+ {{ label }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/enums/index.js b/enums/index.js
index 0f0b3ec..259f546 100644
--- a/enums/index.js
+++ b/enums/index.js
@@ -46,3 +46,28 @@ export const uploadUrl = {
image: `https://api-ops-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/image`,
file: `https://api-ops-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/file`
}
+/**
+ * 结算周期:1:月结30(飞算1期),2:月结45,3:月结60(飞算2期),4:月结75,5:月结90(飞算3期)
+ */
+export const settlementPeriodEnum = [
+ {
+ value: 1,
+ label: '月结30'
+ },
+ {
+ value: 2,
+ label: '月结45'
+ },
+ {
+ value: 3,
+ label: '月结60'
+ },
+ {
+ value: 4,
+ label: '月结75'
+ },
+ {
+ value: 5,
+ label: '月结90'
+ }
+]
diff --git a/env/index.js b/env/index.js
index 751d7ca..a0bfcb1 100644
--- a/env/index.js
+++ b/env/index.js
@@ -1,3 +1,6 @@
+/**
+ * @description 唯一环境变量
+ */
const env = 'test'
// const env = 'dev'
// const env = 'production'
diff --git a/main.js b/main.js
index 86cf81d..98dab6a 100644
--- a/main.js
+++ b/main.js
@@ -1,11 +1,12 @@
import App from './App'
-import pubFn from './common/js/publicFn.js'
-import store from "./store";
+import store from './store'
import Vue from 'vue'
+
Vue.config.productionTip = false
-Vue.prototype.$store = store;
+// Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
- ...App
+ ...App,
+ store
})
app.$mount()
diff --git a/pages.json b/pages.json
index 0e96a30..a6aa9ed 100644
--- a/pages.json
+++ b/pages.json
@@ -66,6 +66,14 @@
"navigationStyle": "custom"
}
},
+ {
+ "path": "pages/toggle-supplier/index",
+ "style": {
+ "navigationBarTitleText": "切换供应商",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "pages/message/index",
"style": {
@@ -104,9 +112,25 @@
}
},
{
- "path": "pages/client-signing/index",
+ "path": "pages/month-credit/index",
"style": {
- "navigationBarTitleText": "客户签约",
+ "navigationBarTitleText": "月结授信",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/fs-credit/index",
+ "style": {
+ "navigationBarTitleText": "飞算授信",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/guarantee-agreement/index",
+ "style": {
+ "navigationBarTitleText": "担保协议",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
@@ -130,8 +154,8 @@
{
"path": "pages/my-offer/index",
"style": {
- "navigationBarTitleText": "我的报价",
- "navigationStyle": "custom",
+ "navigationBarTitleText": "我的报价",
+ "navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
@@ -142,38 +166,39 @@
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
+ },
+ {
+ "path": "pages/quotation-details/index",
+ "style": {
+ "navigationBarTitleText": "报价详情",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/switching-mall/index",
+ "style": {
+ "navigationBarTitleText": "切换商城",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/add-paper/index",
+ "style": {
+ "navigationBarTitleText": "添加纸品",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/page-view/index",
+ "style": {
+ "navigationBarTitleText": "统一第三方页面",
+ "enablePullDownRefresh": false
+ }
}
- ,{
- "path" : "pages/quotation-details/index",
- "style" :
- {
- "navigationBarTitleText": "报价详情",
- "navigationStyle": "custom",
- "enablePullDownRefresh": false
- }
-
- }
- ,{
- "path" : "pages/switching-mall/index",
- "style" :
- {
- "navigationBarTitleText": "切换商城",
- "navigationStyle": "custom",
- "enablePullDownRefresh": false
- }
-
- }
- ,{
- "path" : "pages/add-paper/index",
- "style" :
- {
- "navigationBarTitleText": "添加纸品",
- "navigationStyle": "custom",
- "enablePullDownRefresh": false
- }
-
- }
- ],
+ ],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
diff --git a/pages/client-credit/index.vue b/pages/client-credit/index.vue
index 528807a..ba4ea52 100644
--- a/pages/client-credit/index.vue
+++ b/pages/client-credit/index.vue
@@ -1,23 +1,32 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
import { back, go2 } from '@/utils/hook.js'
-import qnForm from '@/components/qn-form/qn-form.vue'
-import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue'
import { getCompanyList, getCustomerCreditInfo } from '@/apis/clientCreditApi.js'
import { getBaseInfo } from '@/apis/commonApi.js'
-const columns = [
- {
- key: 1,
- type: 'title',
- label: '授信客户'
- },
- {
- key: 'name',
- type: 'item',
- label: '选择客户',
- required: true
- },
- {
- key: 'supplierName',
- type: 'item',
- label: '选择账号盘商',
- required: true
- },
- {
- key: 2,
- type: 'title',
- label: '选择授信方式'
- }
-]
+// import qnFooter from '@/components/qn-footer/qn-footer.vue'
export default {
- components: {
- qnForm,
- qnDataPicker
- },
data() {
return {
- columns: Object.freeze(columns),
form: {
enterpriseId: null,
name: null,
- supplierId: this.$store.state.supplierInfo.supplierId
+ supplierId: this.$store.state.supplierInfo.supplierId || null
},
creditType: null,
searchList: [],
@@ -127,15 +106,50 @@ export default {
})
}
},
+ confirmCompany(enterpriseName) {
+ if (enterpriseName) {
+ getCompanyList({ enterpriseName }).then((res) => {
+ if (res) {
+ this.searchList = res.records
+ if (this.searchList.length > 0) {
+ this.$refs.popup.open('bottom')
+ }
+ }
+ })
+ }
+ },
selectCompany(enterpriseId, enterpriseName) {
this.$refs.popup.close()
this.form.name = enterpriseName
this.form.enterpriseId = enterpriseId
},
next() {
- go2('client-signing', {
- ...this.form
- })
+ // 月结授信直接填表授信即可
+ // 通过searchList获取企业信息
+ let target = this.searchList.find((item) => item.enterpriseId === this.form.enterpriseId)
+ if (this.creditType === 'month') {
+ if (!target) {
+ uni.showToast({
+ title: '请选择客户',
+ icon: 'none'
+ })
+ return
+ }
+ go2('month-credit', {
+ enterpriseId: this.form.enterpriseId,
+ enterpriseName: target.enterpriseName,
+ legalPersonName: target.legalPerson,
+ mallSupplierId: this.form.supplierId
+ })
+ }
+ if (this.creditType === 'fs') {
+ go2('guarantee-agreement', {
+ enterpriseId: this.form.enterpriseId,
+ enterpriseName: target.enterpriseName,
+ legalPersonName: target.legalPerson,
+ mallSupplierId: this.form.supplierId
+ })
+ }
},
selectCreditType(creditType) {
if (this.hasCreditList.includes(creditType)) {
diff --git a/pages/enterprise-info/index.vue b/pages/enterprise-info/index.vue
index 2593478..50bbb0b 100644
--- a/pages/enterprise-info/index.vue
+++ b/pages/enterprise-info/index.vue
@@ -3,155 +3,157 @@
跳过
-
-
-
-
-
-
-
-
-
-
- {{ `${form.locProvinceName || ''}/${form.locCityName || ''}/${form.locDistrictName || ''}/${form.locStreetName || ''}` }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 点击上传
-
- 重新上传
+
+
+
+
+
+
+
+
+
+
+ {{ `${form.locProvinceName || ''}/${form.locCityName || ''}/${form.locDistrictName || ''}/${form.locStreetName || ''}` }}
- 预览
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+ 点击上传
+
+ 重新上传
+
+ 预览
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/client-signing/index.vue b/pages/fs-credit/index.vue
similarity index 100%
rename from pages/client-signing/index.vue
rename to pages/fs-credit/index.vue
diff --git a/pages/guarantee-agreement/index.vue b/pages/guarantee-agreement/index.vue
new file mode 100644
index 0000000..80f276f
--- /dev/null
+++ b/pages/guarantee-agreement/index.vue
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+ 以后再说
+
+
+ 签约
+
+
+
+
+
+
+
+
+
diff --git a/pages/login/index.vue b/pages/login/index.vue
index 560bc09..04faf55 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -167,7 +167,7 @@ export default {
fddEnterpriseStatus: supplierInfo.fddEnterpriseStatus,
supplierId: supplierInfo.supplier.id
})
- store.commit('setUserInfo', { name: supplierInfo.employeeName, userId: res.userId, mobile: res.mobile })
+ store.commit('setUserInfo', { name: supplierInfo.employeeName, userId: res.userId, mobile: res.mobile, avatar: null })
go2('client')
}
}
diff --git a/pages/mine/index.vue b/pages/mine/index.vue
index 838a57b..3290d88 100644
--- a/pages/mine/index.vue
+++ b/pages/mine/index.vue
@@ -5,7 +5,7 @@
-
+
点击登录
@@ -35,7 +35,7 @@
-
+
切换账号
@@ -55,8 +55,76 @@
+
+
+
+
+ {{ tradeData.tradingVolume }}
+ 交易额(元)
+
+
+ {{ tradeData.volumeOfBusiness }}
+ 交易量(吨)
+
+
+ {{ tradeData.orderQuantity }}
+ 成交订单(个)
+
+
+
+
+
+
+
+
+ 订单管理
+
+
+
+ 账期订单融资
+
+
+
+ 合同管理
+
+
+
+ 征信管理
+
+
+
+
mine
client-credit
+ enterprise-info
@@ -64,29 +132,115 @@
import { exit, go2 } from '@/utils/hook.js'
import { fddEnterpriseStatus } from '@/enums/index.js'
import { getBaseInfo } from '@/apis/commonApi.js'
+import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue'
+import { dateTimeFormat } from '@/utils/index.js'
+import { getOrderStatistics } from '@/apis/mineApi.js'
+// 获取本月第一天和最后一天
+const currentMonth = (() => {
+ let endDate = new Date()
+ let beginDate = new Date(endDate.getFullYear(), endDate.getMonth(), 1)
+ return [dateTimeFormat(beginDate, 'yyyy-mm-dd'), dateTimeFormat(endDate, 'yyyy-mm-dd')]
+})()
+
+// 获取上月第一天和最后一天
+const lastMonth = (() => {
+ let now = new Date()
+ let endDate = new Date(now.getFullYear(), now.getMonth(), 0)
+ let beginDate = new Date(now.getFullYear(), now.getMonth() - 1, 1)
+ return [dateTimeFormat(beginDate, 'yyyy-mm-dd'), dateTimeFormat(endDate, 'yyyy-mm-dd')]
+})()
export default {
+ components: { qnDataPicker },
data() {
return {
userInfo: {
- avatar: this.$store.state.userInfo.avatar,
- name: this.$store.state.userInfo.name,
- supplierName: this.$store.state.supplierInfo.name,
- fddEnterpriseStatus: this.$store.state.supplierInfo.fddEnterpriseStatus
+ avatar: this.$store.state.userInfo.avatar || '',
+ name: this.$store.state.userInfo.name || '',
+ supplierName: this.$store.state.supplierInfo.name || '',
+ fddEnterpriseStatus: this.$store.state.supplierInfo.fddEnterpriseStatus || 1
},
fddStatus: Object.freeze(fddEnterpriseStatus),
messageNum: 0,
- companyNum: 0
+ companyNum: 0,
+ tradeRange: [
+ {
+ text: '本月',
+ value: currentMonth.join('~')
+ },
+ {
+ text: '上月',
+ value: lastMonth.join('~')
+ },
+ {
+ text: '总计',
+ value: ''
+ }
+ ],
+ tradeDate: currentMonth.join('~'),
+ tradeData: {
+ tradingVolume: 0,
+ volumeOfBusiness: 0,
+ orderQuantity: 0
+ }
}
},
methods: {
logout() {
exit()
},
- go2
+ go2,
+ // 获取纸盘商订单统计
+ getStatistics() {
+ if (!this.hasLogin) {
+ return
+ }
+ let beginDate = this.tradeDate.split('~')[0] || ''
+ let endDate = this.tradeDate.split('~')[1] || ''
+ // 供应商id
+ let currentSupplier = this.$store.state.supplierInfo.supplierId
+ getOrderStatistics({
+ beginDate,
+ endDate,
+ currentSupplier
+ }).then((res) => {
+ console.log('res', res)
+ if (res) {
+ this.tradeData = res
+ }
+ })
+ }
+ },
+ watch: {
+ tradeDate(val) {
+ console.log('val:', val)
+ },
+ '$store.state.supplierInfo.supplierId': {
+ handler(val) {
+ console.log('切换了供应商:', val)
+ if (val) {
+ this.getStatistics()
+ }
+ },
+ immediate: true
+ },
+ tradeDate() {
+ this.getStatistics()
+ }
},
computed: {
hasLogin() {
+ console.log('token:', this.$store.state.qnToken)
return this.$store.state.qnToken != ''
+ },
+ curAvatar() {
+ if (!this.hasLogin) {
+ return '/static/imgs/mine/user-avatar.png'
+ }
+ if (this.userInfo.avatar) {
+ return this.userInfo.avatar
+ } else {
+ return '/static/imgs/mine/default-avatar.png'
+ }
}
},
onShow() {
@@ -95,6 +249,9 @@ export default {
this.companyNum = res.enterpriseList.length
}
})
+ },
+ created() {
+ this.getStatistics()
}
}
@@ -150,7 +307,6 @@ export default {
flex-grow: 0;
flex-shrink: 0;
overflow: hidden;
- background-color: #fff;
margin-right: 16rpx;
}
.user__name {
@@ -279,4 +435,89 @@ export default {
}
}
}
+.card-area {
+ width: 686rpx;
+ margin: 20rpx 32rpx 0;
+ background-color: #fff;
+ box-shadow: 0 2rpx 14rpx 0 rgba(220, 220, 220, 0.5);
+ border-radius: 10px;
+ .header {
+ padding: 20rpx 24rpx 14rpx;
+ border-bottom: 2rpx solid #f8f8f8;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ .item {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ .icon {
+ flex-grow: 0;
+ flex-shrink: 0;
+ margin-right: 10rpx;
+ }
+ .text {
+ font-size: 30rpx;
+ color: rgba(0, 0, 0, 0.85);
+ letter-spacing: 1.5rpx;
+ font-weight: 500;
+ }
+ }
+ }
+}
+.order-area {
+ padding: 20rpx 20rpx 30rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ .order-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ .value {
+ font-size: 36rpx;
+ color: rgba(0, 0, 0, 0.85);
+ font-weight: 500;
+ }
+ .label {
+ font-size: 26rpx;
+ color: #666666;
+ margin-top: 10rpx;
+ }
+ }
+}
+.icon-area {
+ padding: 40rpx 32rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ .icon-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ .icon {
+ width: 68rpx;
+ height: 68rpx;
+ flex-grow: 0;
+ flex-shrink: 0;
+ }
+ .label {
+ font-size: 26rpx;
+ color: #666666;
+ margin-top: 10rpx;
+ }
+ }
+}
+.time-range {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: flex-end;
+}
diff --git a/pages/month-credit/index.vue b/pages/month-credit/index.vue
new file mode 100644
index 0000000..26839d8
--- /dev/null
+++ b/pages/month-credit/index.vue
@@ -0,0 +1,181 @@
+
+
+
+
+ {{ form.enterpriseName }}
+ {{ form.legalPersonName }}
+
+
+
+
+
+
+
+
+
+
+ 立即授信
+
+
+
+
+
+
+
+
+
diff --git a/pages/page-view/index.vue b/pages/page-view/index.vue
new file mode 100644
index 0000000..767a9a6
--- /dev/null
+++ b/pages/page-view/index.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
diff --git a/pages/search/index.vue b/pages/search/index.vue
index 1e49d1d..eca9d44 100644
--- a/pages/search/index.vue
+++ b/pages/search/index.vue
@@ -106,7 +106,7 @@ export default {
},
computed: {
historyList() {
- return this.$store.state.searchHistory
+ return this.$store.state.searchHistory || []
}
}
}
diff --git a/pages/toggle-supplier/index.vue b/pages/toggle-supplier/index.vue
new file mode 100644
index 0000000..9cb29d9
--- /dev/null
+++ b/pages/toggle-supplier/index.vue
@@ -0,0 +1,9 @@
+
+ 切换供应商
+
+
+
+
+
diff --git a/static/imgs/mine/contract-icon.png b/static/imgs/mine/contract-icon.png
new file mode 100644
index 0000000..13dc629
Binary files /dev/null and b/static/imgs/mine/contract-icon.png differ
diff --git a/static/imgs/mine/credit-icon.png b/static/imgs/mine/credit-icon.png
new file mode 100644
index 0000000..fa4b43c
Binary files /dev/null and b/static/imgs/mine/credit-icon.png differ
diff --git a/static/imgs/mine/default-avatar.png b/static/imgs/mine/default-avatar.png
new file mode 100644
index 0000000..8976eb6
Binary files /dev/null and b/static/imgs/mine/default-avatar.png differ
diff --git a/static/imgs/mine/finance-icon.png b/static/imgs/mine/finance-icon.png
new file mode 100644
index 0000000..b26f8f1
Binary files /dev/null and b/static/imgs/mine/finance-icon.png differ
diff --git a/static/imgs/mine/money-icon.png b/static/imgs/mine/money-icon.png
new file mode 100644
index 0000000..8cc76fc
Binary files /dev/null and b/static/imgs/mine/money-icon.png differ
diff --git a/static/imgs/mine/order-icon.png b/static/imgs/mine/order-icon.png
new file mode 100644
index 0000000..27b06a6
Binary files /dev/null and b/static/imgs/mine/order-icon.png differ
diff --git a/static/imgs/mine/user-avatar.png b/static/imgs/mine/user-avatar.png
index c6c94fb..4df69c8 100644
Binary files a/static/imgs/mine/user-avatar.png and b/static/imgs/mine/user-avatar.png differ
diff --git a/uni_modules/uni-data-picker/changelog.md b/uni_modules/uni-data-picker/changelog.md
deleted file mode 100644
index d1998de..0000000
--- a/uni_modules/uni-data-picker/changelog.md
+++ /dev/null
@@ -1,52 +0,0 @@
-## 1.0.1(2021-11-23)
-- 修复 由上个版本引发的map、v-model等属性不生效的bug
-## 1.0.0(2021-11-19)
-- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
-- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-data-picker](https://uniapp.dcloud.io/component/uniui/uni-data-picker)
-## 0.4.9(2021-10-28)
-- 修复 VUE2 v-model 概率无效的 bug
-## 0.4.8(2021-10-27)
-- 修复 v-model 概率无效的 bug
-## 0.4.7(2021-10-25)
-- 新增 属性 spaceInfo 服务空间配置 HBuilderX 3.2.11+
-- 修复 树型 uniCloud 数据类型为 int 时报错的 bug
-## 0.4.6(2021-10-19)
-- 修复 非 VUE3 v-model 为 0 时无法选中的 bug
-## 0.4.5(2021-09-26)
-- 新增 清除已选项的功能(通过 clearIcon 属性配置是否显示按钮),同时提供 clear 方法以供调用,二者等效
-- 修复 readonly 为 true 时报错的 bug
-## 0.4.4(2021-09-26)
-- 修复 上一版本造成的 map 属性失效的 bug
-- 新增 ellipsis 属性,支持配置 tab 选项长度过长时是否自动省略
-## 0.4.3(2021-09-24)
-- 修复 某些情况下级联未触发的 bug
-## 0.4.2(2021-09-23)
-- 新增 提供 show 和 hide 方法,开发者可以通过 ref 调用
-- 新增 选项内容过长自动添加省略号
-## 0.4.1(2021-09-15)
-- 新增 map 属性 字段映射,将 text/value 映射到数据中的其他字段
-## 0.4.0(2021-07-13)
-- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
-## 0.3.5(2021-06-04)
-- 修复 无法加载云端数据的问题
-## 0.3.4(2021-05-28)
-- 修复 v-model 无效问题
-- 修复 loaddata 为空数据组时加载时间过长问题
-- 修复 上个版本引出的本地数据无法选择带有 children 的 2 级节点
-## 0.3.3(2021-05-12)
-- 新增 组件示例地址
-## 0.3.2(2021-04-22)
-- 修复 非树形数据有 where 属性查询报错的问题
-## 0.3.1(2021-04-15)
-- 修复 本地数据概率无法回显时问题
-## 0.3.0(2021-04-07)
-- 新增 支持云端非树形表结构数据
-- 修复 根节点 parent_field 字段等于 null 时选择界面错乱问题
-## 0.2.0(2021-03-15)
-- 修复 nodeclick、popupopened、popupclosed 事件无法触发的问题
-## 0.1.9(2021-03-09)
-- 修复 微信小程序某些情况下无法选择的问题
-## 0.1.8(2021-02-05)
-- 优化 部分样式在 nvue 上的兼容表现
-## 0.1.7(2021-02-05)
-- 调整为 uni_modules 目录规范
diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js b/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js
deleted file mode 100644
index 6ef26a2..0000000
--- a/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// #ifdef H5
-export default {
- name: 'Keypress',
- props: {
- disable: {
- type: Boolean,
- default: false
- }
- },
- mounted () {
- const keyNames = {
- esc: ['Esc', 'Escape'],
- tab: 'Tab',
- enter: 'Enter',
- space: [' ', 'Spacebar'],
- up: ['Up', 'ArrowUp'],
- left: ['Left', 'ArrowLeft'],
- right: ['Right', 'ArrowRight'],
- down: ['Down', 'ArrowDown'],
- delete: ['Backspace', 'Delete', 'Del']
- }
- const listener = ($event) => {
- if (this.disable) {
- return
- }
- const keyName = Object.keys(keyNames).find(key => {
- const keyName = $event.key
- const value = keyNames[key]
- return value === keyName || (Array.isArray(value) && value.includes(keyName))
- })
- if (keyName) {
- // 避免和其他按键事件冲突
- setTimeout(() => {
- this.$emit(keyName, {})
- }, 0)
- }
- }
- document.addEventListener('keyup', listener)
- this.$once('hook:beforeDestroy', () => {
- document.removeEventListener('keyup', listener)
- })
- },
- render: () => {}
-}
-// #endif
diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
deleted file mode 100644
index ce51b16..0000000
--- a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
+++ /dev/null
@@ -1,537 +0,0 @@
-
-
-
-
-
- {{errorMessage}}
-
-
-
-
-
-
- {{item.text}}{{split}}
-
-
-
- {{placeholder}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{popupTitle}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js
deleted file mode 100644
index c12fd54..0000000
--- a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js
+++ /dev/null
@@ -1,563 +0,0 @@
-export default {
- 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: 20
- },
- 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
- },
- postField() {
- let fields = [this.field];
- if (this.parentField) {
- fields.push(`${this.parentField} as parent_value`);
- }
- return fields.join(',');
- },
- dataValue() {
- let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined)
- 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) => {
- let needReset = false
- for (let i = 2; i < newValue.length; i++) {
- if (newValue[i] != oldValue[i]) {
- needReset = true
- break
- }
- }
- if (newValue[0] != oldValue[0]) {
- this.page.current = this.pageCurrent
- }
- this.page.size = this.pageSize
-
- this.onPropsChange()
- })
- this._treeData = []
- },
- methods: {
- onPropsChange() {
- this._treeData = []
- },
- getCommand(options = {}) {
- /* eslint-disable no-undef */
- let db = uniCloud.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 !== undefined ? options.pageCurrent : this.page.current
- const size = options.pageSize !== undefined ? options.pageSize : this.page.size
- const getCount = options.getcount !== undefined ? options.getcount : this.getcount
- const getTree = options.gettree !== undefined ? 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
- },
- getNodeData(callback) {
- if (this.loading) {
- return
- }
- this.loading = true
- this.getCommand({
- field: this.postField,
- where: this._pathWhere()
- }).then((res) => {
- this.loading = false
- this.selected = res.result.data
- callback && callback()
- }).catch((err) => {
- this.loading = false
- this.errorMessage = err
- })
- },
- getTreePath(callback) {
- if (this.loading) {
- return
- }
- this.loading = true
-
- this.getCommand({
- field: this.postField,
- getTreePath: {
- startWith: `${this.selfField}=='${this.dataValue}'`
- }
- }).then((res) => {
- this.loading = false
- let treePath = []
- this._extractTreePath(res.result.data, treePath)
- this.selected = treePath
- callback && callback()
- }).catch((err) => {
- this.loading = false
- this.errorMessage = err
- })
- },
- loadData() {
- if (this.isLocaldata) {
- this._processLocalData()
- return
- }
-
- if (this.dataValue != null) {
- this._loadNodeData((data) => {
- this._treeData = data
- this._updateBindData()
- this._updateSelected()
- })
- return
- }
-
- if (this.stepSearh) {
- this._loadNodeData((data) => {
- this._treeData = data
- this._updateBindData()
- })
- } else {
- this._loadAllData((data) => {
- this._treeData = []
- this._extractTree(data, this._treeData, null)
- this._updateBindData()
- })
- }
- },
- _loadAllData(callback) {
- if (this.loading) {
- return
- }
- this.loading = true
-
- this.getCommand({
- field: this.postField,
- gettree: true,
- startwith: `${this.selfField}=='${this.dataValue}'`
- }).then((res) => {
- this.loading = false
- callback(res.result.data)
- this.onDataChange()
- }).catch((err) => {
- this.loading = false
- this.errorMessage = err
- })
- },
- _loadNodeData(callback, pw) {
- if (this.loading) {
- return
- }
- this.loading = true
-
- this.getCommand({
- field: this.postField,
- where: pw || this._postWhere(),
- pageSize: 500
- }).then((res) => {
- this.loading = false
- callback(res.result.data)
- this.onDataChange()
- }).catch((err) => {
- this.loading = false
- this.errorMessage = err
- })
- },
- _pathWhere() {
- let result = []
- let where_field = this._getParentNameByField();
- if (where_field) {
- result.push(`${where_field} == '${this.dataValue}'`)
- }
-
- if (this.where) {
- return `(${this.where}) && (${result.join(' || ')})`
- }
-
- return result.join(' || ')
- },
- _postWhere() {
- 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(' && ')
- },
- _nodeWhere() {
- let result = []
- let selected = this.selected
- if (selected.length) {
- result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`)
- }
-
- if (this.where) {
- return `(${this.where}) && (${result.join(' || ')})`
- }
-
- return result.join(' || ')
- },
- _getParentNameByField() {
- const fields = this.field.split(',');
- let where_field = 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') {
- where_field = items[0].trim();
- break;
- }
- }
- return where_field
- },
- _isTreeView() {
- return (this.parentField && this.selfField)
- },
- _updateSelected() {
- var dl = this.dataList
- var sl = this.selected
- let textField = this.map.text
- let valueField = this.map.value
- for (var i = 0; i < sl.length; i++) {
- var value = sl[i].value
- var dl2 = dl[i]
- for (var j = 0; j < dl2.length; j++) {
- var item2 = dl2[j]
- if (item2[valueField] === value) {
- sl[i].text = item2[textField]
- break
- }
- }
- }
- },
- _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
- }
- },
- _filterData(data, paths) {
- let dataList = []
- let hasNodes = true
-
- dataList.push(data.filter((item) => {
- return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
- }))
- for (let i = 0; i < paths.length; i++) {
- var value = paths[i].value
- var 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 list = result || []
- 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 !== undefined && 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) {
- let list = 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 []
- },
- _processLocalData() {
- this._treeData = []
- this._extractTree(this.localdata, this._treeData)
-
- var inputValue = this.dataValue
- if (inputValue === undefined) {
- 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)
- }
- }
-}
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue
deleted file mode 100644
index 56cb09c..0000000
--- a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue
+++ /dev/null
@@ -1,333 +0,0 @@
-
-
-
-
-
-
- {{item.text}}
-
-
-
-
-
-
-
-
- {{item[map.text]}}
-
-
-
-
-
-
-
-
-
- {{errorMessage}}
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-data-picker/package.json b/uni_modules/uni-data-picker/package.json
deleted file mode 100644
index 188ea73..0000000
--- a/uni_modules/uni-data-picker/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "id": "uni-data-picker",
- "displayName": "uni-data-picker 数据驱动的picker选择器",
- "version": "1.0.1",
- "description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
- "keywords": [
- "uni-ui",
- "uniui",
- "picker",
- "级联",
- "省市区",
- ""
-],
- "repository": "https://github.com/dcloudio/uni-ui",
- "engines": {
- "HBuilderX": ""
- },
- "directories": {
- "example": "../../temps/example_temps"
- },
- "dcloudext": {
- "category": [
- "前端组件",
- "通用组件"
- ],
- "sale": {
- "regular": {
- "price": "0.00"
- },
- "sourcecode": {
- "price": "0.00"
- }
- },
- "contact": {
- "qq": ""
- },
- "declaration": {
- "ads": "无",
- "data": "无",
- "permissions": "无"
- },
- "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
- },
- "uni_modules": {
- "dependencies": [
- "uni-load-more",
- "uni-icons",
- "uni-scss"
- ],
- "encrypt": [],
- "platforms": {
- "cloud": {
- "tcb": "y",
- "aliyun": "y"
- },
- "client": {
- "App": {
- "app-vue": "y",
- "app-nvue": "y"
- },
- "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",
- "阿里": "y",
- "百度": "y",
- "字节跳动": "y",
- "QQ": "y"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- },
- "Vue": {
- "vue2": "y",
- "vue3": "y"
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/uni_modules/uni-data-picker/readme.md b/uni_modules/uni-data-picker/readme.md
deleted file mode 100644
index 6cda224..0000000
--- a/uni_modules/uni-data-picker/readme.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## DataPicker 级联选择
-> **组件名:uni-data-picker**
-> 代码块: `uDataPicker`
-> 关联组件:`uni-data-pickerview`、`uni-load-more`。
-
-
-`` 是一个选择类[datacom组件](https://uniapp.dcloud.net.cn/component/datacom)。
-
-支持单列、和多列级联选择。列数没有限制,如果屏幕显示不全,顶部tab区域会左右滚动。
-
-候选数据支持一次性加载完毕,也支持懒加载,比如示例图中,选择了“北京”后,动态加载北京的区县数据。
-
-`` 组件尤其适用于地址选择、分类选择等选择类。
-
-`` 支持本地数据、云端静态数据(json),uniCloud云数据库数据。
-
-`` 可以通过JQL直连uniCloud云数据库,配套[DB Schema](https://uniapp.dcloud.net.cn/uniCloud/schema),可在schema2code中自动生成前端页面,还支持服务器端校验。
-
-在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”,这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面,会自动生成地址管理的维护页面,自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。
-
-### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker)
-#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/changelog.md b/uni_modules/uni-datetime-picker/changelog.md
deleted file mode 100644
index 381c9a8..0000000
--- a/uni_modules/uni-datetime-picker/changelog.md
+++ /dev/null
@@ -1,85 +0,0 @@
-## 2.2.2(2021-12-10)
-- 修复 clear-icon 属性在小程序平台不生效的 bug
-## 2.2.1(2021-12-10)
-- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug
-## 2.2.0(2021-11-19)
-- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
-- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
-## 2.1.5(2021-11-09)
-- 新增 提供组件设计资源,组件样式调整
-## 2.1.4(2021-09-10)
-- 修复 hide-second 在移动端的 bug
-- 修复 单选赋默认值时,赋值日期未高亮的 bug
-- 修复 赋默认值时,移动端未正确显示时间的 bug
-## 2.1.3(2021-09-09)
-- 新增 hide-second 属性,支持只使用时分,隐藏秒
-## 2.1.2(2021-09-03)
-- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次
-- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法
-- 优化 调整字号大小,美化日历界面
-- 修复 因国际化导致的 placeholder 失效的 bug
-## 2.1.1(2021-08-24)
-- 新增 支持国际化
-- 优化 范围选择器在 pc 端过宽的问题
-## 2.1.0(2021-08-09)
-- 新增 适配 vue3
-## 2.0.19(2021-08-09)
-- 新增 支持作为 uni-forms 子组件相关功能
-- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug
-## 2.0.18(2021-08-05)
-- 修复 type 属性动态赋值无效的 bug
-- 修复 ‘确认’按钮被 tabbar 遮盖 bug
-- 修复 组件未赋值时范围选左、右日历相同的 bug
-## 2.0.17(2021-08-04)
-- 修复 范围选未正确显示当前值的 bug
-- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug
-## 2.0.16(2021-07-21)
-- 新增 return-type 属性支持返回 date 日期对象
-## 2.0.15(2021-07-14)
-- 修复 单选日期类型,初始赋值后不在当前日历的 bug
-- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效)
-- 优化 移动端移除显示框的清空按钮,无实际用途
-## 2.0.14(2021-07-14)
-- 修复 组件赋值为空,界面未更新的 bug
-- 修复 start 和 end 不能动态赋值的 bug
-- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug
-## 2.0.13(2021-07-08)
-- 修复 范围选择不能动态赋值的 bug
-## 2.0.12(2021-07-08)
-- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug
-## 2.0.11(2021-07-08)
-- 优化 弹出层在超出视窗边缘定位不准确的问题
-## 2.0.10(2021-07-08)
-- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
-- 优化 弹出层在超出视窗边缘被遮盖的问题
-## 2.0.9(2021-07-07)
-- 新增 maskClick 事件
-- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px
-- 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
-## 2.0.8(2021-07-07)
-- 新增 日期时间显示框支持插槽
-## 2.0.7(2021-07-01)
-- 优化 添加 uni-icons 依赖
-## 2.0.6(2021-05-22)
-- 修复 图标在小程序上不显示的 bug
-- 优化 重命名引用组件,避免潜在组件命名冲突
-## 2.0.5(2021-05-20)
-- 优化 代码目录扁平化
-## 2.0.4(2021-05-12)
-- 新增 组件示例地址
-## 2.0.3(2021-05-10)
-- 修复 ios 下不识别 '-' 日期格式的 bug
-- 优化 pc 下弹出层添加边框和阴影
-## 2.0.2(2021-05-08)
-- 修复 在 admin 中获取弹出层定位错误的bug
-## 2.0.1(2021-05-08)
-- 修复 type 属性向下兼容,默认值从 date 变更为 datetime
-## 2.0.0(2021-04-30)
-- 支持日历形式的日期+时间的范围选择
- > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
-## 1.0.6(2021-03-18)
-- 新增 hide-second 属性,时间支持仅选择时、分
-- 修复 选择跟显示的日期不一样的 bug
-- 修复 chang事件触发2次的 bug
-- 修复 分、秒 end 范围错误的 bug
-- 优化 更好的 nvue 适配
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
deleted file mode 100644
index b57610f..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
-
-
- {{weeks.date}}
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
deleted file mode 100644
index c48a096..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
+++ /dev/null
@@ -1,898 +0,0 @@
-
-
-
-
-
-
-
- {{nowDate.month}}
-
-
-
- {{SUNText}}
-
-
- {{monText}}
-
-
- {{TUEText}}
-
-
- {{WEDText}}
-
-
- {{THUText}}
-
-
- {{FRIText}}
-
-
- {{SATText}}
-
-
-
-
-
-
-
-
-
-
- {{tempSingleDate ? tempSingleDate : selectDateText}}
-
-
-
-
-
-
- {{tempRange.before ? tempRange.before : startDateText}}
-
-
-
-
-
-
- {{tempRange.after ? tempRange.after : endDateText}}
-
-
-
-
-
-
- 确认
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
deleted file mode 100644
index cc76311..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "uni-datetime-picker.selectDate": "select date",
- "uni-datetime-picker.selectTime": "select time",
- "uni-datetime-picker.selectDateTime": "select datetime",
- "uni-datetime-picker.startDate": "start date",
- "uni-datetime-picker.endDate": "end date",
- "uni-datetime-picker.startTime": "start time",
- "uni-datetime-picker.endTime": "end time",
- "uni-datetime-picker.ok": "ok",
- "uni-datetime-picker.clear": "clear",
- "uni-datetime-picker.cancel": "cancel",
- "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"
-}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
deleted file mode 100644
index de7509c..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import en from './en.json'
-import zhHans from './zh-Hans.json'
-import zhHant from './zh-Hant.json'
-export default {
- en,
- 'zh-Hans': zhHans,
- 'zh-Hant': zhHant
-}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
deleted file mode 100644
index 7bc7405..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "uni-datetime-picker.selectDate": "选择日期",
- "uni-datetime-picker.selectTime": "选择时间",
- "uni-datetime-picker.selectDateTime": "选择日期时间",
- "uni-datetime-picker.startDate": "开始日期",
- "uni-datetime-picker.endDate": "结束日期",
- "uni-datetime-picker.startTime": "开始时间",
- "uni-datetime-picker.endTime": "结束时间",
- "uni-datetime-picker.ok": "确定",
- "uni-datetime-picker.clear": "清除",
- "uni-datetime-picker.cancel": "取消",
- "uni-calender.SUN": "日",
- "uni-calender.MON": "一",
- "uni-calender.TUE": "二",
- "uni-calender.WED": "三",
- "uni-calender.THU": "四",
- "uni-calender.FRI": "五",
- "uni-calender.SAT": "六"
-}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
deleted file mode 100644
index 7d37043..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "uni-datetime-picker.selectDate": "選擇日期",
- "uni-datetime-picker.selectTime": "選擇時間",
- "uni-datetime-picker.selectDateTime": "選擇日期時間",
- "uni-datetime-picker.startDate": "開始日期",
- "uni-datetime-picker.endDate": "結束日期",
- "uni-datetime-picker.startTime": "開始时间",
- "uni-datetime-picker.endTime": "結束时间",
- "uni-datetime-picker.ok": "確定",
- "uni-datetime-picker.clear": "清除",
- "uni-datetime-picker.cancel": "取消",
- "uni-calender.SUN": "日",
- "uni-calender.MON": "一",
- "uni-calender.TUE": "二",
- "uni-calender.WED": "三",
- "uni-calender.THU": "四",
- "uni-calender.FRI": "五",
- "uni-calender.SAT": "六"
-}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js
deleted file mode 100644
index 9601aba..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// #ifdef H5
-export default {
- name: 'Keypress',
- props: {
- disable: {
- type: Boolean,
- default: false
- }
- },
- mounted () {
- const keyNames = {
- esc: ['Esc', 'Escape'],
- tab: 'Tab',
- enter: 'Enter',
- space: [' ', 'Spacebar'],
- up: ['Up', 'ArrowUp'],
- left: ['Left', 'ArrowLeft'],
- right: ['Right', 'ArrowRight'],
- down: ['Down', 'ArrowDown'],
- delete: ['Backspace', 'Delete', 'Del']
- }
- const listener = ($event) => {
- if (this.disable) {
- return
- }
- const keyName = Object.keys(keyNames).find(key => {
- const keyName = $event.key
- const value = keyNames[key]
- return value === keyName || (Array.isArray(value) && value.includes(keyName))
- })
- if (keyName) {
- // 避免和其他按键事件冲突
- setTimeout(() => {
- this.$emit(keyName, {})
- }, 0)
- }
- }
- document.addEventListener('keyup', listener)
- this.$once('hook:beforeDestroy', () => {
- document.removeEventListener('keyup', listener)
- })
- },
- render: () => {}
-}
-// #endif
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
deleted file mode 100644
index 699aa63..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
+++ /dev/null
@@ -1,927 +0,0 @@
-
-
-
-
-
- {{time}}
-
- {{selectTimeText}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
deleted file mode 100644
index e844331..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
+++ /dev/null
@@ -1,981 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{rangeSeparator}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
deleted file mode 100644
index efa5773..0000000
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
+++ /dev/null
@@ -1,410 +0,0 @@
-class Calendar {
- constructor({
- date,
- selected,
- startDate,
- endDate,
- range,
- // multipleStatus
- } = {}) {
- // 当前日期
- this.date = this.getDate(new Date()) // 当前初入日期
- // 打点信息
- this.selected = selected || [];
- // 范围开始
- this.startDate = startDate
- // 范围结束
- this.endDate = endDate
- this.range = range
- // 多选状态
- this.cleanMultipleStatus()
- // 每周日期
- this.weeks = {}
- // this._getWeek(this.date.fullDate)
- // this.multipleStatus = multipleStatus
- this.lastHover = false
- }
- /**
- * 设置日期
- * @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 = new Date()
- }
- if (typeof date !== 'object') {
- date = date.replace(/-/g, '/')
- }
- const dd = new Date(date)
- switch (str) {
- case 'day':
- dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
- break
- case 'month':
- if (dd.getDate() === 31) {
- dd.setDate(dd.getDate() + AddDayCount)
- } else {
- dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
- }
- break
- case 'year':
- dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
- break
- }
- const y = dd.getFullYear()
- const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
- const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
- 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,
- disable: true
- })
- }
- return dateArr
- }
- /**
- * 获取本月天数
- */
- _currentMonthDys(dateData, full) {
- let dateArr = []
- let fullDate = this.date.fullDate
- for (let i = 1; i <= dateData; i++) {
- let isinfo = false
- 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) {
- // let dateCompBefore = this.dateCompare(this.startDate, fullDate)
- // disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
- disableBefore = this.dateCompare(this.startDate, nowDate)
- }
-
- if (this.endDate) {
- // let dateCompAfter = this.dateCompare(fullDate, this.endDate)
- // disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
- 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.isLogicBefore(nowDate, this.multipleStatus.before, this.multipleStatus.after),
- afterMultiple: this.isLogicAfter(nowDate, this.multipleStatus.before, this.multipleStatus.after),
- month: full.month,
- disable: !(disableBefore && disableAfter),
- isDay,
- userChecked: false
- }
- 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,
- disable: true
- })
- }
- return dateArr
- }
-
- /**
- * 获取当前日期详情
- * @param {Object} date
- */
- getInfo(date) {
- if (!date) {
- date = 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
- }
- }
-
- /**
- * 比较真实起始日期
- */
-
- isLogicBefore(currentDay, before, after) {
- let logicBefore = before
- if (before && after) {
- logicBefore = this.dateCompare(before, after) ? before : after
- }
- return this.dateEqual(logicBefore, currentDay)
- }
-
- isLogicAfter(currentDay, before, after) {
- let logicAfter = after
- if (before && after) {
- logicAfter = this.dateCompare(before, after) ? after : before
- }
- return this.dateEqual(logicAfter, currentDay)
- }
-
- /**
- * 获取日期范围内所有日期
- * @param {Object} begin
- * @param {Object} end
- */
- geDateAll(begin, end) {
- var arr = []
- var ab = begin.split('-')
- var ae = end.split('-')
- var db = new Date()
- db.setFullYear(ab[0], ab[1] - 1, ab[2])
- var de = new Date()
- de.setFullYear(ae[0], ae[1] - 1, ae[2])
- var unixDb = db.getTime() - 24 * 60 * 60 * 1000
- var unixDe = de.getTime() - 24 * 60 * 60 * 1000
- for (var k = unixDb; k <= unixDe;) {
- k = k + 24 * 60 * 60 * 1000
- arr.push(this.getDate(new Date(parseInt(k))).fullDate)
- }
- return arr
- }
-
- /**
- * 获取多选状态
- */
- setMultiple(fullDate) {
- let {
- before,
- after
- } = this.multipleStatus
- if (!this.range) return
- if (before && after) {
- if (!this.lastHover) {
- this.lastHover = true
- return
- }
- this.multipleStatus.before = fullDate
- this.multipleStatus.after = ''
- this.multipleStatus.data = []
- this.multipleStatus.fulldate = ''
- this.lastHover = false
- } else {
- if (!before) {
- this.multipleStatus.before = fullDate
- this.lastHover = false
- } 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.lastHover = true
- }
- }
- this._getWeek(fullDate)
- }
-
- /**
- * 鼠标 hover 更新多选状态
- */
- setHoverMultiple(fullDate) {
- let {
- before,
- after
- } = this.multipleStatus
-
- if (!this.range) return
- if (this.lastHover) return
-
- 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)
- }
-
- /**
- * 更新默认值多选状态
- */
- setDefaultMultiple(before, after) {
- this.multipleStatus.before = before
- this.multipleStatus.after = after
- if (before && after) {
- if (this.dateCompare(before, after)) {
- this.multipleStatus.data = this.geDateAll(before, after);
- this._getWeek(after)
- } else {
- this.multipleStatus.data = this.geDateAll(after, before);
- this._getWeek(before)
- }
- }
- }
-
- /**
- * 获取每周数据
- * @param {Object} dateData
- */
- _getWeek(dateData) {
- const {
- fullDate,
- year,
- month,
- date,
- day
- } = 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;
- // }
-}
-
-
-export default Calendar
diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json
deleted file mode 100644
index 5e0ff11..0000000
--- a/uni_modules/uni-datetime-picker/package.json
+++ /dev/null
@@ -1,90 +0,0 @@
-{
- "id": "uni-datetime-picker",
- "displayName": "uni-datetime-picker 日期选择器",
- "version": "2.2.2",
- "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
- "keywords": [
- "uni-datetime-picker",
- "uni-ui",
- "uniui",
- "日期时间选择器",
- "日期时间"
-],
- "repository": "https://github.com/dcloudio/uni-ui",
- "engines": {
- "HBuilderX": ""
- },
- "directories": {
- "example": "../../temps/example_temps"
- },
- "dcloudext": {
- "category": [
- "前端组件",
- "通用组件"
- ],
- "sale": {
- "regular": {
- "price": "0.00"
- },
- "sourcecode": {
- "price": "0.00"
- }
- },
- "contact": {
- "qq": ""
- },
- "declaration": {
- "ads": "无",
- "data": "无",
- "permissions": "无"
- },
- "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
- },
- "uni_modules": {
- "dependencies": [
- "uni-scss",
- "uni-icons"
- ],
- "encrypt": [],
- "platforms": {
- "cloud": {
- "tcb": "y",
- "aliyun": "y"
- },
- "client": {
- "App": {
- "app-vue": "y",
- "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",
- "阿里": "y",
- "百度": "y",
- "字节跳动": "y",
- "QQ": "y"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- },
- "Vue": {
- "vue2": "y",
- "vue3": "y"
- }
- }
- }
- }
-}
diff --git a/uni_modules/uni-datetime-picker/readme.md b/uni_modules/uni-datetime-picker/readme.md
deleted file mode 100644
index 162fbef..0000000
--- a/uni_modules/uni-datetime-picker/readme.md
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-> `重要通知:组件升级更新 2.0.0 后,支持日期+时间范围选择,组件 ui 将使用日历选择日期,ui 变化较大,同时支持 PC 和 移动端。此版本不向后兼容,不再支持单独的时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)。若仍需使用旧版本,可在插件市场下载*非uni_modules版本*,旧版本将不再维护`
-
-## DatetimePicker 时间选择器
-
-> **组件名:uni-datetime-picker**
-> 代码块: `uDatetimePicker`
-
-
-该组件的优势是,支持**时间戳**输入和输出(起始时间、终止时间也支持时间戳),可**同时选择**日期和时间。
-
-若只是需要单独选择日期和时间,不需要时间戳输入和输出,可使用原生的 picker 组件。
-
-**_点击 picker 默认值规则:_**
-
-- 若设置初始值 value, 会显示在 picker 显示框中
-- 若无初始值 value,则初始值 value 为当前本地时间 Date.now(), 但不会显示在 picker 显示框中
-
-### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
-#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
diff --git a/utils/index.js b/utils/index.js
new file mode 100644
index 0000000..47671e3
--- /dev/null
+++ b/utils/index.js
@@ -0,0 +1,109 @@
+import env from '@/env/index.js'
+import store from '@/store/index.js'
+/**
+ * 日期格式化,样例 yyyy-mm-dd hh:MM:ss
+ * @param date Date 需要转换的日期
+ * @param fmt string 转化的格式
+ */
+export const dateTimeFormat = (date, fmt) => {
+ if (!date) {
+ throw new Error('日期不正确')
+ }
+ let ret
+ const opt = {
+ 'y+': date.getFullYear().toString(), // 年
+ 'm+': (date.getMonth() + 1).toString(), // 月
+ 'd+': date.getDate().toString(), // 日
+ 'h+': date.getHours().toString(), // 时
+ 'M+': date.getMinutes().toString(), // 分
+ 's+': date.getSeconds().toString() // 秒
+ }
+ for (let k in opt) {
+ ret = new RegExp('(' + k + ')').exec(fmt)
+ if (ret) {
+ fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0'))
+ }
+ }
+ return fmt
+}
+
+/**
+ * 创建websocket
+ * @param {*} data
+ * @value {string} pageInfo 页面信息
+ * @value {true} retry 是否重连,默认false
+ * @returns 一个websocket实例
+ */
+export const makeSocket = async ({ pageInfo = '', retry = false }) => {
+ const socket = {
+ sockTask: null,
+ close: function () {
+ this.sockTask.close({ code: 1000 })
+ closeFlag = true
+ },
+ onMessage: function () {}
+ }
+
+ let limitedNum = 0
+ let closeFlag = false
+ let timer = null
+
+ async function createSocket() {
+ let url = ''
+ if (env == 'production') {
+ url = 'wss://api-client-yyt.qniao.cn/qn-websocket-service/wechatwebsock?token='
+ } else if (env == 'test') {
+ url = 'wss://api-client-yyt-test.qniao.cn/qn-websocket-service/wechatwebsock?token='
+ }
+ const token = store.state.qnToken
+ const socketTask = await uni.connectSocket({
+ url: `${url}${token}`,
+ header: {
+ 'content-type': 'application/json'
+ },
+ success: () => {
+ console.log('websocket连接成功')
+ },
+ fail: () => {
+ console.log('websocket连接失败')
+ }
+ })
+ socketTask.onOpen(() => {
+ console.log(pageInfo + ' onOpen')
+ timer = setInterval(() => {
+ socketTask.send({ data: 'ping' })
+ }, 10000)
+ })
+ socketTask.onClose(() => {
+ console.log(pageInfo + ' onClose')
+ clearInterval(timer)
+ timer = null
+ if (!closeFlag && retry && limitedNum < 20) {
+ limitedNum++
+ console.log('重连次数:' + limitedNum)
+ createSocket()
+ }
+ })
+
+ socketTask.onError(() => {
+ console.log(pageInfo + ' error')
+ })
+
+ socket.sockTask = socketTask
+ }
+
+ await createSocket()
+ if (socket) {
+ socket.onMessage = (fn) => {
+ socket.sockTask.onMessage((res) => {
+ let data = JSON.parse(res.data)
+ console.log(pageInfo + '接收到消息:', data)
+ if (data.type != 'heartbeat') {
+ fn(data)
+ }
+ })
+ }
+ }
+
+ return socket
+}