bulade-ui 1.1.66 → 1.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miniprogram_dist/behaviors/i18n-behavior.js +18 -120
- package/miniprogram_dist/behaviors/i18n-behavior.js.map +1 -1
- package/miniprogram_dist/bld-form/bld-form-item/bld-form-date/index.js +2 -2
- package/miniprogram_dist/bld-form/bld-form-item/bld-form-date/index.js.map +1 -1
- package/miniprogram_dist/bld-form/bld-form-item/bld-form-date/index.wxml +5 -5
- package/miniprogram_dist/bld-form/bld-form-item/bld-form-textarea/index.wxml +1 -1
- package/miniprogram_dist/bld-form/bld-form-item/bld-form-time/index.wxml +1 -1
- package/package.json +1 -1
- package/src/behaviors/i18n-behavior.js +20 -120
- package/src/bld-form/bld-form-item/bld-form-date/index.js +2 -2
- package/src/bld-form/bld-form-item/bld-form-date/index.wxml +5 -5
- package/src/bld-form/bld-form-item/bld-form-textarea/index.wxml +1 -1
- package/src/bld-form/bld-form-item/bld-form-time/index.wxml +1 -1
|
@@ -95,130 +95,13 @@ module.exports =
|
|
|
95
95
|
|
|
96
96
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
97
97
|
|
|
98
|
-
// const app = getApp()
|
|
99
|
-
|
|
100
|
-
// module.exports = Behavior({
|
|
101
|
-
// data: {
|
|
102
|
-
// i18n: {},
|
|
103
|
-
// lang: ""
|
|
104
|
-
// },
|
|
105
|
-
// attached() {
|
|
106
|
-
// // 页面挂载,初始化翻译文本
|
|
107
|
-
// this.setData({
|
|
108
|
-
// i18n: app.getI18n(),
|
|
109
|
-
// lang: app.globalData.lang
|
|
110
|
-
// })
|
|
111
|
-
// // 监听全局语言切换事件,收到通知立刻更新data,视图自动刷新
|
|
112
|
-
// this.langChangeHandle = (lang) => {
|
|
113
|
-
// this.setData({
|
|
114
|
-
// i18n: app.getI18n(),
|
|
115
|
-
// lang
|
|
116
|
-
// })
|
|
117
|
-
// }
|
|
118
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
119
|
-
// },
|
|
120
|
-
// detached() {
|
|
121
|
-
// // 页面销毁必须解绑事件!防止内存泄漏!Skyline重要!
|
|
122
|
-
// app.event.off("change:lang", this.langChangeHandle)
|
|
123
|
-
// }
|
|
124
|
-
// })
|
|
125
|
-
|
|
126
|
-
// 把原来最开头的 const app = getApp() 删掉!
|
|
127
|
-
|
|
128
|
-
// module.exports = Behavior({
|
|
129
|
-
// data: {
|
|
130
|
-
// i18n: {},
|
|
131
|
-
// lang: ""
|
|
132
|
-
// },
|
|
133
|
-
// attached() {
|
|
134
|
-
// // 移到这里!attached执行的时候,App早就初始化完了!
|
|
135
|
-
// const app = getApp()
|
|
136
|
-
// // 存下来,detached的时候用
|
|
137
|
-
// this._app = app
|
|
138
|
-
|
|
139
|
-
// this.setData({
|
|
140
|
-
// i18n: app.getI18n(),
|
|
141
|
-
// lang: app.globalData.lang,
|
|
142
|
-
// langEn:app.globalData.lang === 'en'
|
|
143
|
-
// })
|
|
144
|
-
// // 监听全局语言切换事件
|
|
145
|
-
// this.langChangeHandle = (lang) => {
|
|
146
|
-
// this.setData({
|
|
147
|
-
// i18n: app.getI18n(),
|
|
148
|
-
// lang,
|
|
149
|
-
// langEn:lang === 'en'
|
|
150
|
-
// })
|
|
151
|
-
// }
|
|
152
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
153
|
-
// },
|
|
154
|
-
// detached() {
|
|
155
|
-
// // 用存下来的app实例解绑
|
|
156
|
-
// if (this._app && this.langChangeHandle) {
|
|
157
|
-
// this._app.event.off("change:lang", this.langChangeHandle)
|
|
158
|
-
// }
|
|
159
|
-
// }
|
|
160
|
-
// })
|
|
161
|
-
|
|
162
|
-
// module.exports = Behavior({
|
|
163
|
-
// data: {
|
|
164
|
-
// i18n: {},
|
|
165
|
-
// lang: "",
|
|
166
|
-
// langEn: false
|
|
167
|
-
// },
|
|
168
|
-
// attached() {
|
|
169
|
-
// const app = getApp()
|
|
170
|
-
// this._app = app
|
|
171
|
-
|
|
172
|
-
// // 生成代理i18n对象,处理 _s 缩写后缀
|
|
173
|
-
// function wrapI18n(rawI18n, isEn) {
|
|
174
|
-
// return new Proxy(rawI18n, {
|
|
175
|
-
// get(target, prop) {
|
|
176
|
-
// const key = String(prop)
|
|
177
|
-
// if (key.endsWith('_s')) {
|
|
178
|
-
// const baseKey = key.slice(0, -2)
|
|
179
|
-
// if (isEn) {
|
|
180
|
-
// return Reflect.has(target, key) ? target[key] : target[baseKey]
|
|
181
|
-
// } else {
|
|
182
|
-
// // 中文环境直接回退原key
|
|
183
|
-
// return target[baseKey]
|
|
184
|
-
// }
|
|
185
|
-
// }
|
|
186
|
-
// return target[prop]
|
|
187
|
-
// }
|
|
188
|
-
// })
|
|
189
|
-
// }
|
|
190
|
-
|
|
191
|
-
// const raw = app.getI18n()
|
|
192
|
-
// const isEn = app.globalData.lang === 'en'
|
|
193
|
-
// this.setData({
|
|
194
|
-
// i18n: wrapI18n(raw, isEn),
|
|
195
|
-
// lang: app.globalData.lang,
|
|
196
|
-
// langEn: isEn
|
|
197
|
-
// })
|
|
198
|
-
|
|
199
|
-
// this.langChangeHandle = (lang) => {
|
|
200
|
-
// const rawNew = app.getI18n()
|
|
201
|
-
// const enFlag = lang === 'en'
|
|
202
|
-
// this.setData({
|
|
203
|
-
// i18n: wrapI18n(rawNew, enFlag),
|
|
204
|
-
// lang,
|
|
205
|
-
// langEn: enFlag
|
|
206
|
-
// })
|
|
207
|
-
// }
|
|
208
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
209
|
-
// },
|
|
210
|
-
// detached() {
|
|
211
|
-
// if (this._app && this.langChangeHandle) {
|
|
212
|
-
// this._app.event.off("change:lang", this.langChangeHandle)
|
|
213
|
-
// }
|
|
214
|
-
// }
|
|
215
|
-
// })
|
|
216
|
-
|
|
217
98
|
module.exports = Behavior({
|
|
218
99
|
data: {
|
|
219
100
|
i18n: {},
|
|
220
101
|
lang: "",
|
|
221
|
-
langEn: false
|
|
102
|
+
langEn: false,
|
|
103
|
+
enableAutoTrans: false,
|
|
104
|
+
needTrans: false
|
|
222
105
|
},
|
|
223
106
|
lifetimes: {
|
|
224
107
|
attached: function attached() {
|
|
@@ -227,11 +110,17 @@ module.exports = Behavior({
|
|
|
227
110
|
var app = getApp();
|
|
228
111
|
this._app = app;
|
|
229
112
|
this.updateI18nData();
|
|
113
|
+
this.updateAutoTrans();
|
|
230
114
|
|
|
231
115
|
this.langChangeHandle = function () {
|
|
232
116
|
_this.updateI18nData();
|
|
233
117
|
};
|
|
118
|
+
this.autoTransHandle = function () {
|
|
119
|
+
_this.updateAutoTrans();
|
|
120
|
+
};
|
|
121
|
+
|
|
234
122
|
app.event.on("change:lang", this.langChangeHandle);
|
|
123
|
+
app.event.on("change:autoTrans", this.autoTransHandle);
|
|
235
124
|
},
|
|
236
125
|
|
|
237
126
|
|
|
@@ -242,6 +131,7 @@ module.exports = Behavior({
|
|
|
242
131
|
detached: function detached() {
|
|
243
132
|
if (this._app && this.langChangeHandle) {
|
|
244
133
|
this._app.event.off("change:lang", this.langChangeHandle);
|
|
134
|
+
this._app.event.off("change:autoTrans", this.autoTransHandle);
|
|
245
135
|
}
|
|
246
136
|
}
|
|
247
137
|
},
|
|
@@ -268,6 +158,14 @@ module.exports = Behavior({
|
|
|
268
158
|
i18n: i18nObj,
|
|
269
159
|
lang: app.globalData.lang,
|
|
270
160
|
langEn: isEn
|
|
161
|
+
// needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
updateAutoTrans: function updateAutoTrans() {
|
|
165
|
+
var app = getApp();
|
|
166
|
+
this.setData({
|
|
167
|
+
// enableAutoTrans: app.globalData.enableAutoTrans,
|
|
168
|
+
needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'
|
|
271
169
|
});
|
|
272
170
|
}
|
|
273
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/behaviors/i18n-behavior.js"],"names":["module","exports","Behavior","data","i18n","lang","langEn","lifetimes","attached","app","getApp","_app","updateI18nData","langChangeHandle","event","on","onShow","detached","off","methods","raw","getI18n","isEn","globalData","i18nObj","Object","keys","forEach","key","endsWith","sKey","Reflect","has","setData"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AAjB,IAAyBV,IAAIU,IAAJ,CAAzB,GAAqCV,IAAIQ,GAAJ,CAArD;AACD,WAFD,MAEO;AACLJ,oBAAQM,IAAR,IAAgBV,IAAIQ,GAAJ,CAAhB;AACD;AACF;AACF,OATD;;AAWA,WAAKK,OAAL,CAAa;AACX7B,cAAMoB,OADK;AAEXnB,cAAMI,IAAIc,UAAJ,CAAelB,IAFV;AAGXC,gBAAQgB;AAHG,OAAb;AAKD;AAxBM;AA7Be,CAAT,CAAjB,C","file":"behaviors/i18n-behavior.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 59);\n","// const app = getApp()\n\n// module.exports = Behavior({\n// data: {\n// i18n: {},\n// lang: \"\"\n// },\n// attached() {\n// // 页面挂载,初始化翻译文本\n// this.setData({\n// i18n: app.getI18n(),\n// lang: app.globalData.lang \n// })\n// // 监听全局语言切换事件,收到通知立刻更新data,视图自动刷新\n// this.langChangeHandle = (lang) => {\n// this.setData({\n// i18n: app.getI18n(),\n// lang\n// })\n// }\n// app.event.on(\"change:lang\", this.langChangeHandle)\n// },\n// detached() {\n// // 页面销毁必须解绑事件!防止内存泄漏!Skyline重要!\n// app.event.off(\"change:lang\", this.langChangeHandle)\n// }\n// })\n\n// 把原来最开头的 const app = getApp() 删掉!\n\n// module.exports = Behavior({\n// data: {\n// i18n: {},\n// lang: \"\"\n// },\n// attached() {\n// // 移到这里!attached执行的时候,App早就初始化完了!\n// const app = getApp()\n// // 存下来,detached的时候用\n// this._app = app\n\n// this.setData({\n// i18n: app.getI18n(),\n// lang: app.globalData.lang,\n// langEn:app.globalData.lang === 'en'\n// }) \n// // 监听全局语言切换事件\n// this.langChangeHandle = (lang) => {\n// this.setData({\n// i18n: app.getI18n(),\n// lang,\n// langEn:lang === 'en'\n// })\n// }\n// app.event.on(\"change:lang\", this.langChangeHandle)\n// },\n// detached() {\n// // 用存下来的app实例解绑\n// if (this._app && this.langChangeHandle) {\n// this._app.event.off(\"change:lang\", this.langChangeHandle)\n// }\n// }\n// })\n\n// module.exports = Behavior({\n// data: {\n// i18n: {},\n// lang: \"\",\n// langEn: false\n// },\n// attached() {\n// const app = getApp()\n// this._app = app\n\n// // 生成代理i18n对象,处理 _s 缩写后缀\n// function wrapI18n(rawI18n, isEn) {\n// return new Proxy(rawI18n, {\n// get(target, prop) {\n// const key = String(prop)\n// if (key.endsWith('_s')) {\n// const baseKey = key.slice(0, -2)\n// if (isEn) {\n// return Reflect.has(target, key) ? target[key] : target[baseKey]\n// } else {\n// // 中文环境直接回退原key\n// return target[baseKey]\n// }\n// }\n// return target[prop]\n// }\n// })\n// }\n\n// const raw = app.getI18n()\n// const isEn = app.globalData.lang === 'en'\n// this.setData({\n// i18n: wrapI18n(raw, isEn),\n// lang: app.globalData.lang,\n// langEn: isEn\n// })\n\n// this.langChangeHandle = (lang) => {\n// const rawNew = app.getI18n()\n// const enFlag = lang === 'en'\n// this.setData({\n// i18n: wrapI18n(rawNew, enFlag),\n// lang,\n// langEn: enFlag\n// })\n// }\n// app.event.on(\"change:lang\", this.langChangeHandle)\n// },\n// detached() {\n// if (this._app && this.langChangeHandle) {\n// this._app.event.off(\"change:lang\", this.langChangeHandle)\n// }\n// }\n// })\n\nmodule.exports = Behavior({\n data: {\n i18n: {},\n lang: \"\",\n langEn: false\n },\n lifetimes: {\n attached() {\n const app = getApp()\n this._app = app\n this.updateI18nData()\n\n this.langChangeHandle = () => {\n this.updateI18nData()\n }\n app.event.on(\"change:lang\", this.langChangeHandle)\n },\n\n // 关键:分包onShow时,mergeI18n已经执行完毕,重新构建完整i18n\n onShow() {\n this.updateI18nData()\n },\n\n detached() {\n if (this._app && this.langChangeHandle) {\n this._app.event.off(\"change:lang\", this.langChangeHandle)\n }\n }\n },\n methods: {\n // 不再返回Proxy,生成纯普通对象,预计算 _s\n updateI18nData() {\n const app = getApp()\n const raw = app.getI18n()\n const isEn = app.globalData.lang === 'en'\n\n const i18nObj = { ...raw }\n Object.keys(raw).forEach((key) => {\n if (!key.endsWith('_s')) {\n const sKey = key + '_s'\n if (isEn) {\n i18nObj[sKey] = Reflect.has(raw, sKey) ? raw[sKey] : raw[key]\n } else {\n i18nObj[sKey] = raw[key]\n }\n }\n })\n\n this.setData({\n i18n: i18nObj,\n lang: app.globalData.lang,\n langEn: isEn\n })\n }\n }\n})\n\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/behaviors/i18n-behavior.js"],"names":["module","exports","Behavior","data","i18n","lang","langEn","enableAutoTrans","needTrans","lifetimes","attached","app","getApp","_app","updateI18nData","updateAutoTrans","langChangeHandle","autoTransHandle","event","on","onShow","detached","off","methods","raw","getI18n","isEn","globalData","i18nObj","Object","keys","forEach","key","endsWith","sKey","Reflect","has","setData"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QAC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N,GAAZ,EAAiBO,OAAjB,CAAyB,UAACC,GAAD,EAAS;AAChC,YAAI,CAACA,IAAIC,QAAJ,CAAa,IAAb,CAAL,EAAyB;AACvB,cAAMC,OAAOF,MAAM,IAAnB;AACA,cAAIN,IAAJ,EAAU;AACRE,oBAAQM,IAAR,IAAgBC,QAAQC,GAAR,CAAYZ,GAAZ,EAAiBU,IAAjB,IAAyBV,IAAIU,IAAJ,CAAzB,GAAqCV,IAAIQ,GAAJ,CAArD;AACD,WAFD,MAEO;AACLJ,oBAAQM,IAAR,IAAgBV,IAAIQ,GAAJ,CAAhB;AACD;AACF;AACF,OATD;;AAWA,WAAKK,OAAL,CAAa;AACXjC,cAAMwB,OADK;AAEXvB,cAAMM,IAAIgB,UAAJ,CAAetB,IAFV;AAGXC,gBAAQoB;AACR;AAJW,OAAb;AAMD,KAzBM;AA2BPX,mBA3BO,6BA2BW;AAChB,UAAMJ,MAAMC,QAAZ;AACA,WAAKyB,OAAL,CAAa;AACX;AACA7B,mBAAWG,IAAIgB,UAAJ,CAAepB,eAAf,KAAmC,IAAnC,IAA2CI,IAAIgB,UAAJ,CAAetB,IAAf,KAAwB;AAFnE,OAAb;AAID;AAjCM;AAtCe,CAAT,CAAjB,C","file":"behaviors/i18n-behavior.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 59);\n","\nmodule.exports = Behavior({\n data: {\n i18n: {},\n lang: \"\",\n langEn: false,\n enableAutoTrans: false,\n needTrans: false\n },\n lifetimes: {\n attached() {\n const app = getApp()\n this._app = app\n this.updateI18nData()\n this.updateAutoTrans()\n\n this.langChangeHandle = () => {\n this.updateI18nData()\n }\n this.autoTransHandle = () => {\n this.updateAutoTrans()\n }\n\n app.event.on(\"change:lang\", this.langChangeHandle)\n app.event.on(\"change:autoTrans\", this.autoTransHandle)\n },\n\n // 关键:分包onShow时,mergeI18n已经执行完毕,重新构建完整i18n\n onShow() {\n this.updateI18nData()\n },\n\n detached() {\n if (this._app && this.langChangeHandle) {\n this._app.event.off(\"change:lang\", this.langChangeHandle)\n this._app.event.off(\"change:autoTrans\", this.autoTransHandle)\n }\n }\n },\n methods: {\n // 不再返回Proxy,生成纯普通对象,预计算 _s\n updateI18nData() {\n const app = getApp()\n const raw = app.getI18n()\n const isEn = app.globalData.lang === 'en'\n\n const i18nObj = { ...raw }\n Object.keys(raw).forEach((key) => {\n if (!key.endsWith('_s')) {\n const sKey = key + '_s'\n if (isEn) {\n i18nObj[sKey] = Reflect.has(raw, sKey) ? raw[sKey] : raw[key]\n } else {\n i18nObj[sKey] = raw[key]\n }\n }\n })\n\n this.setData({\n i18n: i18nObj,\n lang: app.globalData.lang,\n langEn: isEn,\n // needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'\n })\n },\n \n updateAutoTrans() {\n const app = getApp()\n this.setData({\n // enableAutoTrans: app.globalData.enableAutoTrans,\n needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'\n })\n }\n }\n})\n\n"],"sourceRoot":""}
|
|
@@ -201,7 +201,7 @@ Component({
|
|
|
201
201
|
|
|
202
202
|
this.setData({
|
|
203
203
|
selectValue: [_valueYear, _valueMonth, valueDate],
|
|
204
|
-
text: this.data.years[_valueYear] + "
|
|
204
|
+
text: this.data.years[_valueYear] + "-" + this.data.months[_valueMonth] + "-" + this.data.days[valueDate]
|
|
205
205
|
});
|
|
206
206
|
} else {
|
|
207
207
|
this.setData({
|
|
@@ -236,7 +236,7 @@ Component({
|
|
|
236
236
|
|
|
237
237
|
this.setData({
|
|
238
238
|
showActionsheet: false,
|
|
239
|
-
text: year + "
|
|
239
|
+
text: year + "-" + month + "-" + day,
|
|
240
240
|
value: year.toString().padStart(2, "0") + "-" + month.toString().padStart(2, "0") + "-" + day.toString().padStart(2, "0")
|
|
241
241
|
});
|
|
242
242
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/bld-form/bld-form-item/bld-form-date/index.js"],"names":["nowDate","date","Date","years","getFullYear","months","getMonth","days","getDate","Component","externalClasses","properties","label","type","String","value","required","Boolean","labelWidth","disabled","min","max","data","year","month","day","showActionsheet","selectValue","text","observers","initDate","lifetimes","ready","methods","i","push","daysLength","valueDates","replace","valueYear","valueMonth","includes","setData","valueDate","showSellect","handelChoose","compareSize","toString","padStart","bindChange","e","val","detail","setDays","setDay","Number","wx","showToast","title","icon","setMonth","slice","selectedDay","maxDay"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;AClFA,SAASA,OAAT,GAAmB;AACjB,MAAMC,OAAO,IAAIC,IAAJ,EAAb;AACA,MAAMC,QAAQF,KAAKG,WAAL,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AAc,KAAKL,IAAL,CAAUK,WAAV,CAAsBkC,KAAtB,EAApB;AACA,UAAIlC,YAAY,CAAZ,KAAkBF,GAAtB,EAA2B;AACzBE,oBAAY,CAAZ,IAAiBF,MAAM,CAAvB;AACA,YAAMqC,cAAcvD,KAAKoB,YAAY,CAAZ,CAAL,EAAqBoB,QAArB,GAAgCC,QAAhC,CAAyC,CAAzC,EAA4C,GAA5C,CAApB;AACA,aAAKN,OAAL,CAAa;AACXnC,gBAAMA,IADK;AAEXoB,uBAAaA,WAFF;AAGXF,eAAKqC;AAHM,SAAb;AAKD,OARD,MAQO;AACL,aAAKpB,OAAL,CAAa;AACXnC,gBAAMA;AADK,SAAb;AAGD;AACF,KAtKM;AAuKP+C,UAvKO,kBAuKAS,MAvKA,EAuKQ;AACb,UAAMpC,cAAc,KAAKL,IAAL,CAAUK,WAAV,CAAsBkC,KAAtB,EAApB;AACAlC,kBAAY,CAAZ,IAAiBoC,MAAjB;AACA,UAAMD,cAAc,KAAKxC,IAAL,CAAUf,IAAV,CAAewD,MAAf,IAAyB,KAAKzC,IAAL,CAAUf,IAAV,CAAewD,MAAf,EAAuBhB,QAAvB,GAAkCC,QAAlC,CAA2C,CAA3C,EAA8C,GAA9C,CAAzB,GAA8E,EAAlG;AACA,WAAKN,OAAL,CAAa;AACXf,qBAAaA,WADF;AAEXF,aAAKqC;AAFM,OAAb;AAID;AA/KM;AAvDD,CAAV,E","file":"bld-form/bld-form-item/bld-form-date/index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 13);\n","function nowDate() {\n const date = new Date();\n const years = date.getFullYear() - 1925;\n const months = date.getMonth();\n const days = date.getDate() - 1;\n return [years, months, days];\n}\nComponent({\n externalClasses: [\"form-item\", \"form-label\", \"form-value\", \"select-icon\"],\n properties: {\n label: {\n type: String,\n value: \"\",\n },\n required: {\n type: Boolean,\n value: false,\n },\n labelWidth: {\n type: String,\n value: \"auto\",\n },\n value: {\n type: String,\n value: \"\",\n },\n disabled: {\n type: Boolean,\n value: false,\n },\n min: {\n type: String,\n value: \"\",\n },\n max: {\n type: String,\n value: \"\",\n },\n },\n data: {\n date: new Date(),\n years: [],\n year: \"\",\n months: [],\n month: \"\",\n days: [],\n day: \"\",\n showActionsheet: false,\n selectValue: nowDate(),\n text: \"\",\n },\n\n observers: {\n value: function () {\n this.initDate(this.data.value);\n },\n },\n lifetimes: {\n ready() {\n // this.initDate(this.data.value);\n },\n },\n methods: {\n initDate(value = \"\") {\n const date = new Date();\n const years = [];\n const months = [];\n const days = [];\n for (let i = 1925; i <= date.getFullYear() + 10; i++) {\n years.push(i);\n }\n\n for (let i = 1; i <= 12; i++) {\n months.push(i);\n }\n let daysLength = 31;\n if(value){\n const valueDates = new Date(value.replace(/-/g, \"/\"));\n const valueYear = valueDates.getFullYear()\n const valueMonth = valueDates.getMonth();\n if ([0, 2, 4, 6, 7, 9, 11].includes(valueMonth)) {\n daysLength = 31;\n } else if ([3, 5, 8, 10].includes(valueMonth)) {\n daysLength = 30;\n } else if ((valueYear % 4 == 0&& valueYear % 100 !== 0)||(valueYear % 400 === 0)) {\n daysLength = 29;\n } else {\n daysLength = 28;\n }\n }\n for (let i = 1; i <= daysLength; i++) {\n days.push(i);\n }\n this.setData({\n years: years,\n months: months,\n days: days,\n });\n if (value) {\n const valueDates = new Date(value.replace(/-/g, \"/\"));\n const valueYear = valueDates.getFullYear() - 1925;\n const valueMonth = valueDates.getMonth();\n const valueDate = valueDates.getDate() - 1;\n\n this.setData({\n selectValue: [valueYear, valueMonth, valueDate],\n text:\n this.data.years[valueYear] + \"年\" + this.data.months[valueMonth] + \"月\" + this.data.days[valueDate] + \"日\",\n });\n } else {\n this.setData({\n selectValue: nowDate(),\n text: \"\",\n });\n }\n },\n showSellect() {\n if (this.data.disabled) return;\n this.setData({\n showActionsheet: true,\n year: \"\",\n month: \"\",\n day: \"\",\n });\n },\n handelChoose() {\n const year = this.data.year || this.data.years[this.data.selectValue[0]];\n const month = this.data.month || this.data.months[this.data.selectValue[1]];\n const day = this.data.day || this.data.days[this.data.selectValue[2]];\n if(this.data.min){\n if(!this.compareSize(\"min\",''+year+month.toString().padStart(2, \"0\")+day.toString().padStart(2, \"0\"))){\n return\n }\n }\n if(this.data.max){\n if(!this.compareSize(\"max\",''+year+month.toString().padStart(2, \"0\")+day.toString().padStart(2, \"0\"))){\n return\n }\n }\n\n this.setData({\n showActionsheet: false,\n text: year + \"年\" + month + \"月\" + day + \"日\",\n value: year.toString().padStart(2, \"0\") + \"-\" + month.toString().padStart(2, \"0\") + \"-\" + day.toString().padStart(2, \"0\"),\n });\n },\n bindChange(e) {\n const val = e.detail.value;\n const year=this.data.years[val[0]];\n const month=this.data.months[val[1]].toString().padStart(2, \"0\");\n const day=this.data.days[val[2]].toString().padStart(2, \"0\");\n this.setData({\n year,\n month,\n day,\n selectValue: val,\n });\n if ([0, 2, 4, 6, 7, 9, 11].includes(val[1])) {\n this.setDays(31);\n } else if ([3, 5, 8, 10].includes(val[1])) {\n this.setDays(30);\n if (val[2] > 29) {\n this.setDay(29);\n }\n } else if ((this.data.years[val[0]] % 4 == 0&& this.data.years[val[0]] % 100 !== 0)||(this.data.years[val[0]] % 400 === 0)) {\n this.setDays(29);\n if (val[2] > 28) {\n this.setDay(28);\n }\n } else {\n this.setDays(28);\n if (val[2] > 27) {\n this.setDay(27);\n }\n }\n },\n compareSize(type,value){\n if(type === \"min\"){\n if(Number(this.data.min.replace(/-/g, \"\"))>value){\n wx.showToast({\n title: '不在可选时间范围',\n icon: 'none'\n })\n return false\n }else {\n return true;\n }\n }\n if(type === \"max\"){\n if(Number(this.data.max.replace(/-/g, \"\"))<value){\n wx.showToast({\n title: '不在可选时间范围',\n icon: 'none'\n })\n return false\n }else {\n return true;\n }\n }\n },\n setMonth(month) {\n const months = [];\n for (let i = 1; i <= month; i++) {\n months.push(i);\n }\n this.setData({\n months: months,\n });\n },\n setDays(day) {\n const days = [];\n for (let i = 1; i <= day; i++) {\n days.push(i);\n }\n const selectValue = this.data.selectValue.slice();\n if (selectValue[2] >= day) {\n selectValue[2] = day - 1;\n const selectedDay = days[selectValue[2]].toString().padStart(2, \"0\");\n this.setData({\n days: days,\n selectValue: selectValue,\n day: selectedDay,\n });\n } else {\n this.setData({\n days: days,\n });\n }\n },\n setDay(maxDay) {\n const selectValue = this.data.selectValue.slice();\n selectValue[2] = maxDay;\n const selectedDay = this.data.days[maxDay] ? this.data.days[maxDay].toString().padStart(2, \"0\") : \"\";\n this.setData({\n selectValue: selectValue,\n day: selectedDay,\n });\n },\n },\n});"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/bld-form/bld-form-item/bld-form-date/index.js"],"names":["nowDate","date","Date","years","getFullYear","months","getMonth","days","getDate","Component","externalClasses","properties","label","type","String","value","required","Boolean","labelWidth","disabled","min","max","data","year","month","day","showActionsheet","selectValue","text","observers","initDate","lifetimes","ready","methods","i","push","daysLength","valueDates","replace","valueYear","valueMonth","includes","setData","valueDate","showSellect","handelChoose","compareSize","toString","padStart","bindChange","e","val","detail","setDays","setDay","Number","wx","showToast","title","icon","setMonth","slice","selectedDay","maxDay"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E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,WADF;AAEXF,aAAKqC;AAFM,OAAb;AAID;AA/KM;AAvDD,CAAV,E","file":"bld-form/bld-form-item/bld-form-date/index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 13);\n","function nowDate() {\n const date = new Date();\n const years = date.getFullYear() - 1925;\n const months = date.getMonth();\n const days = date.getDate() - 1;\n return [years, months, days];\n}\nComponent({\n externalClasses: [\"form-item\", \"form-label\", \"form-value\", \"select-icon\"],\n properties: {\n label: {\n type: String,\n value: \"\",\n },\n required: {\n type: Boolean,\n value: false,\n },\n labelWidth: {\n type: String,\n value: \"auto\",\n },\n value: {\n type: String,\n value: \"\",\n },\n disabled: {\n type: Boolean,\n value: false,\n },\n min: {\n type: String,\n value: \"\",\n },\n max: {\n type: String,\n value: \"\",\n },\n },\n data: {\n date: new Date(),\n years: [],\n year: \"\",\n months: [],\n month: \"\",\n days: [],\n day: \"\",\n showActionsheet: false,\n selectValue: nowDate(),\n text: \"\",\n },\n\n observers: {\n value: function () {\n this.initDate(this.data.value);\n },\n },\n lifetimes: {\n ready() {\n // this.initDate(this.data.value);\n },\n },\n methods: {\n initDate(value = \"\") {\n const date = new Date();\n const years = [];\n const months = [];\n const days = [];\n for (let i = 1925; i <= date.getFullYear() + 10; i++) {\n years.push(i);\n }\n\n for (let i = 1; i <= 12; i++) {\n months.push(i);\n }\n let daysLength = 31;\n if(value){\n const valueDates = new Date(value.replace(/-/g, \"/\"));\n const valueYear = valueDates.getFullYear()\n const valueMonth = valueDates.getMonth();\n if ([0, 2, 4, 6, 7, 9, 11].includes(valueMonth)) {\n daysLength = 31;\n } else if ([3, 5, 8, 10].includes(valueMonth)) {\n daysLength = 30;\n } else if ((valueYear % 4 == 0&& valueYear % 100 !== 0)||(valueYear % 400 === 0)) {\n daysLength = 29;\n } else {\n daysLength = 28;\n }\n }\n for (let i = 1; i <= daysLength; i++) {\n days.push(i);\n }\n this.setData({\n years: years,\n months: months,\n days: days,\n });\n if (value) {\n const valueDates = new Date(value.replace(/-/g, \"/\"));\n const valueYear = valueDates.getFullYear() - 1925;\n const valueMonth = valueDates.getMonth();\n const valueDate = valueDates.getDate() - 1;\n\n this.setData({\n selectValue: [valueYear, valueMonth, valueDate],\n text:\n this.data.years[valueYear] + \"-\" + this.data.months[valueMonth] + \"-\" + this.data.days[valueDate],\n });\n } else {\n this.setData({\n selectValue: nowDate(),\n text: \"\",\n });\n }\n },\n showSellect() {\n if (this.data.disabled) return;\n this.setData({\n showActionsheet: true,\n year: \"\",\n month: \"\",\n day: \"\",\n });\n },\n handelChoose() {\n const year = this.data.year || this.data.years[this.data.selectValue[0]];\n const month = this.data.month || this.data.months[this.data.selectValue[1]];\n const day = this.data.day || this.data.days[this.data.selectValue[2]];\n if(this.data.min){\n if(!this.compareSize(\"min\",''+year+month.toString().padStart(2, \"0\")+day.toString().padStart(2, \"0\"))){\n return\n }\n }\n if(this.data.max){\n if(!this.compareSize(\"max\",''+year+month.toString().padStart(2, \"0\")+day.toString().padStart(2, \"0\"))){\n return\n }\n }\n\n this.setData({\n showActionsheet: false,\n text: year + \"-\" + month + \"-\" + day,\n value: year.toString().padStart(2, \"0\") + \"-\" + month.toString().padStart(2, \"0\") + \"-\" + day.toString().padStart(2, \"0\"),\n });\n },\n bindChange(e) {\n const val = e.detail.value;\n const year=this.data.years[val[0]];\n const month=this.data.months[val[1]].toString().padStart(2, \"0\");\n const day=this.data.days[val[2]].toString().padStart(2, \"0\");\n this.setData({\n year,\n month,\n day,\n selectValue: val,\n });\n if ([0, 2, 4, 6, 7, 9, 11].includes(val[1])) {\n this.setDays(31);\n } else if ([3, 5, 8, 10].includes(val[1])) {\n this.setDays(30);\n if (val[2] > 29) {\n this.setDay(29);\n }\n } else if ((this.data.years[val[0]] % 4 == 0&& this.data.years[val[0]] % 100 !== 0)||(this.data.years[val[0]] % 400 === 0)) {\n this.setDays(29);\n if (val[2] > 28) {\n this.setDay(28);\n }\n } else {\n this.setDays(28);\n if (val[2] > 27) {\n this.setDay(27);\n }\n }\n },\n compareSize(type,value){\n if(type === \"min\"){\n if(Number(this.data.min.replace(/-/g, \"\"))>value){\n wx.showToast({\n title: '不在可选时间范围',\n icon: 'none'\n })\n return false\n }else {\n return true;\n }\n }\n if(type === \"max\"){\n if(Number(this.data.max.replace(/-/g, \"\"))<value){\n wx.showToast({\n title: '不在可选时间范围',\n icon: 'none'\n })\n return false\n }else {\n return true;\n }\n }\n },\n setMonth(month) {\n const months = [];\n for (let i = 1; i <= month; i++) {\n months.push(i);\n }\n this.setData({\n months: months,\n });\n },\n setDays(day) {\n const days = [];\n for (let i = 1; i <= day; i++) {\n days.push(i);\n }\n const selectValue = this.data.selectValue.slice();\n if (selectValue[2] >= day) {\n selectValue[2] = day - 1;\n const selectedDay = days[selectValue[2]].toString().padStart(2, \"0\");\n this.setData({\n days: days,\n selectValue: selectValue,\n day: selectedDay,\n });\n } else {\n this.setData({\n days: days,\n });\n }\n },\n setDay(maxDay) {\n const selectValue = this.data.selectValue.slice();\n selectValue[2] = maxDay;\n const selectedDay = this.data.days[maxDay] ? this.data.days[maxDay].toString().padStart(2, \"0\") : \"\";\n this.setData({\n selectValue: selectValue,\n day: selectedDay,\n });\n },\n },\n});"],"sourceRoot":""}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
</view>
|
|
15
15
|
<view class="item-value-box">
|
|
16
|
-
<view class="item-value-text form-value {{text?text:'value-placeholder'}}">{{text?text:
|
|
16
|
+
<view class="item-value-text form-value {{text?text:'value-placeholder'}}">{{text ? text : i18n.please_select + ' ' + label }}</view>
|
|
17
17
|
<bld-cloud-image
|
|
18
18
|
iclass="arrow-icon select-icon"
|
|
19
19
|
src="my/arrow.png"
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
<view slot="content">
|
|
28
28
|
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{selectValue}}" bindchange="bindChange">
|
|
29
29
|
<picker-view-column>
|
|
30
|
-
<view wx:for="{{years}}" wx:key="{{years}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
30
|
+
<view wx:for="{{years}}" wx:key="{{years}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
31
31
|
</picker-view-column>
|
|
32
32
|
<picker-view-column>
|
|
33
|
-
<view wx:for="{{months}}" wx:key="{{months}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
33
|
+
<view wx:for="{{months}}" wx:key="{{months}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
34
34
|
</picker-view-column>
|
|
35
35
|
<picker-view-column>
|
|
36
|
-
<view wx:for="{{days}}" wx:key="{{days}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
36
|
+
<view wx:for="{{days}}" wx:key="{{days}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
37
37
|
</picker-view-column>
|
|
38
38
|
</picker-view>
|
|
39
39
|
</view>
|
|
40
40
|
|
|
41
41
|
<view slot="footer">
|
|
42
|
-
<view class="sure-button" bind:tap="handelChoose"
|
|
42
|
+
<view class="sure-button" bind:tap="handelChoose">{{ i18n.sure }}</view>
|
|
43
43
|
</view>
|
|
44
44
|
</bld-half-screen>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
disabled="{{disabled}}"
|
|
19
19
|
auto-height="{{autoHeight}}"
|
|
20
20
|
model:value="{{ value }}"
|
|
21
|
-
placeholder="
|
|
21
|
+
placeholder="{{ i18n.please_input + ' ' + label }}"
|
|
22
22
|
placeholder-style="color:#acacac;font-size:30rpx;font-weight:normal;"
|
|
23
23
|
bindinput="valueChange"
|
|
24
24
|
/>
|
package/package.json
CHANGED
|
@@ -1,138 +1,28 @@
|
|
|
1
|
-
// const app = getApp()
|
|
2
|
-
|
|
3
|
-
// module.exports = Behavior({
|
|
4
|
-
// data: {
|
|
5
|
-
// i18n: {},
|
|
6
|
-
// lang: ""
|
|
7
|
-
// },
|
|
8
|
-
// attached() {
|
|
9
|
-
// // 页面挂载,初始化翻译文本
|
|
10
|
-
// this.setData({
|
|
11
|
-
// i18n: app.getI18n(),
|
|
12
|
-
// lang: app.globalData.lang
|
|
13
|
-
// })
|
|
14
|
-
// // 监听全局语言切换事件,收到通知立刻更新data,视图自动刷新
|
|
15
|
-
// this.langChangeHandle = (lang) => {
|
|
16
|
-
// this.setData({
|
|
17
|
-
// i18n: app.getI18n(),
|
|
18
|
-
// lang
|
|
19
|
-
// })
|
|
20
|
-
// }
|
|
21
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
22
|
-
// },
|
|
23
|
-
// detached() {
|
|
24
|
-
// // 页面销毁必须解绑事件!防止内存泄漏!Skyline重要!
|
|
25
|
-
// app.event.off("change:lang", this.langChangeHandle)
|
|
26
|
-
// }
|
|
27
|
-
// })
|
|
28
|
-
|
|
29
|
-
// 把原来最开头的 const app = getApp() 删掉!
|
|
30
|
-
|
|
31
|
-
// module.exports = Behavior({
|
|
32
|
-
// data: {
|
|
33
|
-
// i18n: {},
|
|
34
|
-
// lang: ""
|
|
35
|
-
// },
|
|
36
|
-
// attached() {
|
|
37
|
-
// // 移到这里!attached执行的时候,App早就初始化完了!
|
|
38
|
-
// const app = getApp()
|
|
39
|
-
// // 存下来,detached的时候用
|
|
40
|
-
// this._app = app
|
|
41
|
-
|
|
42
|
-
// this.setData({
|
|
43
|
-
// i18n: app.getI18n(),
|
|
44
|
-
// lang: app.globalData.lang,
|
|
45
|
-
// langEn:app.globalData.lang === 'en'
|
|
46
|
-
// })
|
|
47
|
-
// // 监听全局语言切换事件
|
|
48
|
-
// this.langChangeHandle = (lang) => {
|
|
49
|
-
// this.setData({
|
|
50
|
-
// i18n: app.getI18n(),
|
|
51
|
-
// lang,
|
|
52
|
-
// langEn:lang === 'en'
|
|
53
|
-
// })
|
|
54
|
-
// }
|
|
55
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
56
|
-
// },
|
|
57
|
-
// detached() {
|
|
58
|
-
// // 用存下来的app实例解绑
|
|
59
|
-
// if (this._app && this.langChangeHandle) {
|
|
60
|
-
// this._app.event.off("change:lang", this.langChangeHandle)
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// })
|
|
64
|
-
|
|
65
|
-
// module.exports = Behavior({
|
|
66
|
-
// data: {
|
|
67
|
-
// i18n: {},
|
|
68
|
-
// lang: "",
|
|
69
|
-
// langEn: false
|
|
70
|
-
// },
|
|
71
|
-
// attached() {
|
|
72
|
-
// const app = getApp()
|
|
73
|
-
// this._app = app
|
|
74
|
-
|
|
75
|
-
// // 生成代理i18n对象,处理 _s 缩写后缀
|
|
76
|
-
// function wrapI18n(rawI18n, isEn) {
|
|
77
|
-
// return new Proxy(rawI18n, {
|
|
78
|
-
// get(target, prop) {
|
|
79
|
-
// const key = String(prop)
|
|
80
|
-
// if (key.endsWith('_s')) {
|
|
81
|
-
// const baseKey = key.slice(0, -2)
|
|
82
|
-
// if (isEn) {
|
|
83
|
-
// return Reflect.has(target, key) ? target[key] : target[baseKey]
|
|
84
|
-
// } else {
|
|
85
|
-
// // 中文环境直接回退原key
|
|
86
|
-
// return target[baseKey]
|
|
87
|
-
// }
|
|
88
|
-
// }
|
|
89
|
-
// return target[prop]
|
|
90
|
-
// }
|
|
91
|
-
// })
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
|
-
// const raw = app.getI18n()
|
|
95
|
-
// const isEn = app.globalData.lang === 'en'
|
|
96
|
-
// this.setData({
|
|
97
|
-
// i18n: wrapI18n(raw, isEn),
|
|
98
|
-
// lang: app.globalData.lang,
|
|
99
|
-
// langEn: isEn
|
|
100
|
-
// })
|
|
101
|
-
|
|
102
|
-
// this.langChangeHandle = (lang) => {
|
|
103
|
-
// const rawNew = app.getI18n()
|
|
104
|
-
// const enFlag = lang === 'en'
|
|
105
|
-
// this.setData({
|
|
106
|
-
// i18n: wrapI18n(rawNew, enFlag),
|
|
107
|
-
// lang,
|
|
108
|
-
// langEn: enFlag
|
|
109
|
-
// })
|
|
110
|
-
// }
|
|
111
|
-
// app.event.on("change:lang", this.langChangeHandle)
|
|
112
|
-
// },
|
|
113
|
-
// detached() {
|
|
114
|
-
// if (this._app && this.langChangeHandle) {
|
|
115
|
-
// this._app.event.off("change:lang", this.langChangeHandle)
|
|
116
|
-
// }
|
|
117
|
-
// }
|
|
118
|
-
// })
|
|
119
1
|
|
|
120
2
|
module.exports = Behavior({
|
|
121
3
|
data: {
|
|
122
4
|
i18n: {},
|
|
123
5
|
lang: "",
|
|
124
|
-
langEn: false
|
|
6
|
+
langEn: false,
|
|
7
|
+
enableAutoTrans: false,
|
|
8
|
+
needTrans: false
|
|
125
9
|
},
|
|
126
10
|
lifetimes: {
|
|
127
11
|
attached() {
|
|
128
12
|
const app = getApp()
|
|
129
13
|
this._app = app
|
|
130
14
|
this.updateI18nData()
|
|
15
|
+
this.updateAutoTrans()
|
|
131
16
|
|
|
132
17
|
this.langChangeHandle = () => {
|
|
133
18
|
this.updateI18nData()
|
|
134
19
|
}
|
|
20
|
+
this.autoTransHandle = () => {
|
|
21
|
+
this.updateAutoTrans()
|
|
22
|
+
}
|
|
23
|
+
|
|
135
24
|
app.event.on("change:lang", this.langChangeHandle)
|
|
25
|
+
app.event.on("change:autoTrans", this.autoTransHandle)
|
|
136
26
|
},
|
|
137
27
|
|
|
138
28
|
// 关键:分包onShow时,mergeI18n已经执行完毕,重新构建完整i18n
|
|
@@ -143,6 +33,7 @@ module.exports = Behavior({
|
|
|
143
33
|
detached() {
|
|
144
34
|
if (this._app && this.langChangeHandle) {
|
|
145
35
|
this._app.event.off("change:lang", this.langChangeHandle)
|
|
36
|
+
this._app.event.off("change:autoTrans", this.autoTransHandle)
|
|
146
37
|
}
|
|
147
38
|
}
|
|
148
39
|
},
|
|
@@ -168,7 +59,16 @@ module.exports = Behavior({
|
|
|
168
59
|
this.setData({
|
|
169
60
|
i18n: i18nObj,
|
|
170
61
|
lang: app.globalData.lang,
|
|
171
|
-
langEn: isEn
|
|
62
|
+
langEn: isEn,
|
|
63
|
+
// needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
updateAutoTrans() {
|
|
68
|
+
const app = getApp()
|
|
69
|
+
this.setData({
|
|
70
|
+
// enableAutoTrans: app.globalData.enableAutoTrans,
|
|
71
|
+
needTrans: app.globalData.enableAutoTrans === true && app.globalData.lang === 'en'
|
|
172
72
|
})
|
|
173
73
|
}
|
|
174
74
|
}
|
|
@@ -105,7 +105,7 @@ Component({
|
|
|
105
105
|
this.setData({
|
|
106
106
|
selectValue: [valueYear, valueMonth, valueDate],
|
|
107
107
|
text:
|
|
108
|
-
this.data.years[valueYear] + "
|
|
108
|
+
this.data.years[valueYear] + "-" + this.data.months[valueMonth] + "-" + this.data.days[valueDate],
|
|
109
109
|
});
|
|
110
110
|
} else {
|
|
111
111
|
this.setData({
|
|
@@ -140,7 +140,7 @@ Component({
|
|
|
140
140
|
|
|
141
141
|
this.setData({
|
|
142
142
|
showActionsheet: false,
|
|
143
|
-
text: year + "
|
|
143
|
+
text: year + "-" + month + "-" + day,
|
|
144
144
|
value: year.toString().padStart(2, "0") + "-" + month.toString().padStart(2, "0") + "-" + day.toString().padStart(2, "0"),
|
|
145
145
|
});
|
|
146
146
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
</view>
|
|
15
15
|
<view class="item-value-box">
|
|
16
|
-
<view class="item-value-text form-value {{text?text:'value-placeholder'}}">{{text?text:
|
|
16
|
+
<view class="item-value-text form-value {{text?text:'value-placeholder'}}">{{text ? text : i18n.please_select + ' ' + label }}</view>
|
|
17
17
|
<bld-cloud-image
|
|
18
18
|
iclass="arrow-icon select-icon"
|
|
19
19
|
src="my/arrow.png"
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
<view slot="content">
|
|
28
28
|
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{selectValue}}" bindchange="bindChange">
|
|
29
29
|
<picker-view-column>
|
|
30
|
-
<view wx:for="{{years}}" wx:key="{{years}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
30
|
+
<view wx:for="{{years}}" wx:key="{{years}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
31
31
|
</picker-view-column>
|
|
32
32
|
<picker-view-column>
|
|
33
|
-
<view wx:for="{{months}}" wx:key="{{months}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
33
|
+
<view wx:for="{{months}}" wx:key="{{months}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
34
34
|
</picker-view-column>
|
|
35
35
|
<picker-view-column>
|
|
36
|
-
<view wx:for="{{days}}" wx:key="{{days}}" style="line-height: 50px; text-align: center;">{{item}}
|
|
36
|
+
<view wx:for="{{days}}" wx:key="{{days}}" style="line-height: 50px; text-align: center;">{{item}}</view>
|
|
37
37
|
</picker-view-column>
|
|
38
38
|
</picker-view>
|
|
39
39
|
</view>
|
|
40
40
|
|
|
41
41
|
<view slot="footer">
|
|
42
|
-
<view class="sure-button" bind:tap="handelChoose"
|
|
42
|
+
<view class="sure-button" bind:tap="handelChoose">{{ i18n.sure }}</view>
|
|
43
43
|
</view>
|
|
44
44
|
</bld-half-screen>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
disabled="{{disabled}}"
|
|
19
19
|
auto-height="{{autoHeight}}"
|
|
20
20
|
model:value="{{ value }}"
|
|
21
|
-
placeholder="
|
|
21
|
+
placeholder="{{ i18n.please_input + ' ' + label }}"
|
|
22
22
|
placeholder-style="color:#acacac;font-size:30rpx;font-weight:normal;"
|
|
23
23
|
bindinput="valueChange"
|
|
24
24
|
/>
|