Commit 40df96c45116b6ed5e5788282cb9fccb4a43b810
Merge branch 'master' of http://39.98.150.180/webapp/GreenwayWeb
Showing
202 changed files
with
24297 additions
and
5797 deletions
Too many changes.
To preserve performance only 100 of 202 files are displayed.
admin-web-master/src/utils/request.js
| ... | ... | @@ -15,8 +15,14 @@ let hostall = window.location.href; |
| 15 | 15 | // const baseURL = 'http://192.168.2.38:9003'; |
| 16 | 16 | let baseURL = '' |
| 17 | 17 | if(host === 'localhost:8080' || host === 'localhost:8081' || host === 'localhost:9528'|| host === '192.168.31.45:9528'|| host === 'localhost:9529' ) { |
| 18 | +<<<<<<< HEAD | |
| 18 | 19 | baseURL = process.env.VUE_APP_DOMAIN_PREFIX_1; |
| 19 | 20 | // baseURL = 'http://192.168.2.225:9003'; |
| 21 | +======= | |
| 22 | + // baseURL = process.env.VUE_APP_DOMAIN_PREFIX_1; | |
| 23 | + baseURL = 'http://192.168.2.225:9003'; | |
| 24 | + // baseURL = 'http://192.168.2.36:9003'; | |
| 25 | +>>>>>>> 0fd8b75025d0861888b91aa4dec7c415341668ac | |
| 20 | 26 | } else { |
| 21 | 27 | console.error('---------------------') |
| 22 | 28 | console.error(hostall) | ... | ... |
admin-web-master/src/utils/request2.js
| ... | ... | @@ -15,6 +15,7 @@ let hostall = window.location.href; |
| 15 | 15 | // const baseURL = 'http://192.168.2.38:9003'; |
| 16 | 16 | let baseURL = '' |
| 17 | 17 | // || host === 'localhost:9528' |
| 18 | +<<<<<<< HEAD | |
| 18 | 19 | // if(host === 'localhost:8080' || host === 'localhost:8081'|| host === 'localhost:9528' || host === '192.168.31.45:9528'|| host === 'localhost:9529' ) { |
| 19 | 20 | // // baseURL = 'https://zhld.028wlkj.com:49008/cdwlMall/business-server'; |
| 20 | 21 | // baseURL = 'http://192.168.2.36:9003'; |
| ... | ... | @@ -28,6 +29,12 @@ let baseURL = '' |
| 28 | 29 | if(host === 'localhost:8080' || host === 'localhost:8081' || host === 'localhost:9528'|| host === '192.168.31.45:9528'|| host === 'localhost:9529' ) { |
| 29 | 30 | baseURL = process.env.VUE_APP_DOMAIN_PREFIX_1; |
| 30 | 31 | // baseURL = 'http://192.168.2.225:9003'; |
| 32 | +======= | |
| 33 | +if(host === 'localhost:8080' || host === 'localhost:8081'|| host === 'localhost:9528' || host === '192.168.31.45:9528'|| host === 'localhost:9529' ) { | |
| 34 | + // baseURL = 'https://zhld.028wlkj.com:49008/cdwlMall/business-server'; | |
| 35 | + // baseURL = 'http://172.16.61.125:9004'; | |
| 36 | + baseURL = 'http://192.168.2.225:9004'; | |
| 37 | +>>>>>>> 0fd8b75025d0861888b91aa4dec7c415341668ac | |
| 31 | 38 | } else { |
| 32 | 39 | console.error('---------------------') |
| 33 | 40 | console.error(hostall) | ... | ... |
admin-web-master/src/views/activity/activityBian.vue
| ... | ... | @@ -81,9 +81,10 @@ |
| 81 | 81 | </el-row> |
| 82 | 82 | <div style="padding: 10px"> |
| 83 | 83 | <el-row :gutter="20"> |
| 84 | - <el-col :span="12"> | |
| 84 | + <el-col :span="24"> | |
| 85 | 85 | <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> |
| 86 | - <upimg v-model="secondData.coverPoster" :value="secondData.coverPoster==''?'':secondData.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 86 | + <upimg filePath="act" :value="secondData.coverPoster==''?'':secondData.coverPoster" inputtype="coverPoster" :limit="1" @changimg="e=>changimg(e,'coverPoster')"></upimg> | |
| 87 | + <!-- <upimg v-model="secondData.coverPoster" :value="secondData.coverPoster==''?'':secondData.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> --> | |
| 87 | 88 | </el-form-item> |
| 88 | 89 | </el-col> |
| 89 | 90 | </el-row> |
| ... | ... | @@ -245,14 +246,15 @@ |
| 245 | 246 | 相关附件信息 |
| 246 | 247 | </div> |
| 247 | 248 | <div> |
| 248 | - <el-upload class="upload-demo" ref="upload" | |
| 249 | + <upfile filePath="act" inputtype="otherImageVideos" :islist="false" :accept="'.docx'" :value="ruleForm.otherImageVideos" @changimg="e=>changimg(e,'otherImageVideos')"></upfile> | |
| 250 | + <!-- <el-upload class="upload-demo" ref="upload" | |
| 249 | 251 | :action="uploadFileUrl" |
| 250 | 252 | :on-success="handleUploadSuccess" |
| 251 | 253 | :file-list="fileData" :show-file-list="false"> |
| 252 | 254 | <div style="color: #2d8a58;margin-left: 10px;margin-top: 10px;" slot="trigger"> |
| 253 | 255 | 上传附件 |
| 254 | 256 | </div> |
| 255 | - </el-upload> | |
| 257 | + </el-upload> --> | |
| 256 | 258 | </div> |
| 257 | 259 | </div> |
| 258 | 260 | <div style="padding: 20px 40px 0px 20px"> |
| ... | ... | @@ -338,6 +340,7 @@ |
| 338 | 340 | import Vue from 'vue' |
| 339 | 341 | import { uploadUrl } from '@/utils/request' |
| 340 | 342 | import upimg from "@/components/ImageUpload/index" |
| 343 | + import upfile from "@/components/fujianUpload/fujianList" | |
| 341 | 344 | export default { |
| 342 | 345 | props:{ |
| 343 | 346 | showBian:{ |
| ... | ... | @@ -345,7 +348,7 @@ |
| 345 | 348 | default: () => ({}) |
| 346 | 349 | } |
| 347 | 350 | }, |
| 348 | - components: { upimg}, | |
| 351 | + components: { upimg,upfile}, | |
| 349 | 352 | data() { |
| 350 | 353 | return { |
| 351 | 354 | uploadFileUrl: uploadUrl, // 请求地址 |
| ... | ... | @@ -370,6 +373,7 @@ |
| 370 | 373 | estimatedCost:'', |
| 371 | 374 | notes:'' |
| 372 | 375 | }, |
| 376 | + ruleForm:{} | |
| 373 | 377 | } |
| 374 | 378 | }, |
| 375 | 379 | |
| ... | ... | @@ -391,6 +395,27 @@ |
| 391 | 395 | mounted() { |
| 392 | 396 | }, |
| 393 | 397 | methods: { |
| 398 | + changimg(e,type) { | |
| 399 | + this.ruleForm[type] = e | |
| 400 | + | |
| 401 | + if(type=='otherImageVideos'){ | |
| 402 | + const parts = e.split('/'); | |
| 403 | + const filename = parts[parts.length - 1]; | |
| 404 | + // let file ={ | |
| 405 | + // url:e, | |
| 406 | + // attachmentName:filename | |
| 407 | + // } | |
| 408 | + let fuji={ | |
| 409 | + detailsId:this.secondData.id, | |
| 410 | + attachmentName:filename, | |
| 411 | + attachmentUrl:e, | |
| 412 | + } | |
| 413 | + fujiaAdd(fuji).then(res=>{ | |
| 414 | + this.fucha(this.secondData.id) | |
| 415 | + }) | |
| 416 | + // this.dataList.push(file) | |
| 417 | + } | |
| 418 | + }, | |
| 394 | 419 | //获取当前时间 |
| 395 | 420 | updateCurrentTime() { |
| 396 | 421 | const now = new Date(); | ... | ... |
admin-web-master/src/views/activity/activityBz.vue
| ... | ... | @@ -118,9 +118,10 @@ |
| 118 | 118 | </el-col> |
| 119 | 119 | </el-row> |
| 120 | 120 | <el-row :gutter="20"> |
| 121 | - <el-col :span="12"> | |
| 122 | - <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> | |
| 123 | - <upimg v-model="ruleForm.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 121 | + <el-col :span="24"> | |
| 122 | + <el-form-item label="活动封面海报" prop="coverPoster" class="grid-content bg-purple"> | |
| 123 | + <upimg filePath="act" :value="ruleForm.coverPoster" inputtype="coverPoster" :limit="1" @changimg="e=>changimg(e,'coverPoster')"></upimg> | |
| 124 | + <!-- <upimg v-model="ruleForm.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> --> | |
| 124 | 125 | </el-form-item> |
| 125 | 126 | </el-col> |
| 126 | 127 | </el-row> |
| ... | ... | @@ -278,15 +279,17 @@ |
| 278 | 279 | <el-tab-pane label="相关附件"> |
| 279 | 280 | <div style="border: 1px solid #E5E5E5;padding: 1px" id="fu"> |
| 280 | 281 | <div style="padding: 10px 13px;font-size: 12px;border-bottom: 1px solid #E5E5E5;display: flex;"> |
| 281 | - <div>相关附件</div> | |
| 282 | + <div style="line-height:38px;">相关附件</div> | |
| 282 | 283 | <div> |
| 283 | - <el-upload class="upload-demo" ref="upload" :on-preview="handlePreview" :on-remove="handleRemove" | |
| 284 | + <upfile filePath="act" inputtype="otherImageVideos" :limit="10" :islist="false" :accept="'.docx'" :value="ruleForm.otherImageVideos" @changimg="e=>changimg(e,'otherImageVideos')"></upfile> | |
| 285 | + | |
| 286 | + <!-- <el-upload class="upload-demo" ref="upload" :on-preview="handlePreview" :on-remove="handleRemove" | |
| 284 | 287 | :action="uploadFileUrl" :on-success="handleUploadSuccess" :file-list="fileData" |
| 285 | 288 | :show-file-list="false"> |
| 286 | 289 | <div style="color: #2d8a58;margin-left: 10px;" slot="trigger"> |
| 287 | 290 | 上传附件 |
| 288 | 291 | </div> |
| 289 | - </el-upload> | |
| 292 | + </el-upload> --> | |
| 290 | 293 | </div> |
| 291 | 294 | </div> |
| 292 | 295 | <div style="padding: 15px;"> |
| ... | ... | @@ -382,6 +385,7 @@ |
| 382 | 385 | } from '@/utils/request' |
| 383 | 386 | import html2canvas from 'html2canvas' |
| 384 | 387 | import jsPDF from 'jspdf' |
| 388 | + import upfile from "@/components/fujianUpload/fujianList" | |
| 385 | 389 | export default { |
| 386 | 390 | props: { |
| 387 | 391 | showAdd: { |
| ... | ... | @@ -398,7 +402,8 @@ |
| 398 | 402 | name: 'activityBz', |
| 399 | 403 | components: { |
| 400 | 404 | wangEditor, |
| 401 | - upimg | |
| 405 | + upimg, | |
| 406 | + upfile | |
| 402 | 407 | }, |
| 403 | 408 | |
| 404 | 409 | data() { |
| ... | ... | @@ -509,6 +514,19 @@ lishiList:'', |
| 509 | 514 | this.lishi() |
| 510 | 515 | }, |
| 511 | 516 | methods: { |
| 517 | + changimg(e,type) { | |
| 518 | + this.ruleForm[type] = e | |
| 519 | + | |
| 520 | + if(type=='otherImageVideos'){ | |
| 521 | + const parts = e.split('/'); | |
| 522 | + const filename = parts[parts.length - 1]; | |
| 523 | + let file ={ | |
| 524 | + url:e, | |
| 525 | + name:filename | |
| 526 | + } | |
| 527 | + this.dataList.push(file) | |
| 528 | + } | |
| 529 | + }, | |
| 512 | 530 | //获取当前时间 |
| 513 | 531 | updateCurrentTime() { |
| 514 | 532 | const now = new Date(); |
| ... | ... | @@ -543,6 +561,7 @@ lishiList:'', |
| 543 | 561 | this.$refs.upload.submit(); |
| 544 | 562 | }, |
| 545 | 563 | handleUploadSuccess(response, file, fileList) { |
| 564 | + | |
| 546 | 565 | this.dataList.push(file) |
| 547 | 566 | }, |
| 548 | 567 | handleRemove(file, fileList) { |
| ... | ... | @@ -676,7 +695,7 @@ lishiList:'', |
| 676 | 695 | let fuji = { |
| 677 | 696 | detailsId: res.data.id, |
| 678 | 697 | attachmentName: this.dataList[i].name, |
| 679 | - attachmentUrl: this.dataList[i].response.data.url, | |
| 698 | + attachmentUrl: this.dataList[i].url, | |
| 680 | 699 | } |
| 681 | 700 | fujiaAdd(fuji).then(res => { |
| 682 | 701 | console.log('成功') | ... | ... |
admin-web-master/src/views/activity/activitySp.vue
| ... | ... | @@ -178,7 +178,7 @@ |
| 178 | 178 | <div style="padding: 10px"> |
| 179 | 179 | <el-row :gutter="20"> |
| 180 | 180 | <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> |
| 181 | - <img :src="secondData.coverPoster" alt="" style="width: 80px;height:80px;"> | |
| 181 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 80px;height:80px;"> | |
| 182 | 182 | </el-form-item> |
| 183 | 183 | </el-row> |
| 184 | 184 | </div> |
| ... | ... | @@ -510,7 +510,7 @@ |
| 510 | 510 | <div style="width: 100%;"> |
| 511 | 511 | <div style="display: flex;padding:0px 20px 20px 20px; "> |
| 512 | 512 | <div style="width: 150px;height: 80px;" v-if="secondData.coverPoster"> |
| 513 | - <img :src="secondData.coverPoster" alt="" style="width: 100%;height: 80px;" /> | |
| 513 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 100%;height: 80px;" /> | |
| 514 | 514 | </div> |
| 515 | 515 | <div |
| 516 | 516 | style="display: flex;flex-direction: column;justify-content: space-around;padding: 0 10px;font-size: 12px;"> | ... | ... |
admin-web-master/src/views/activity/index.vue
| ... | ... | @@ -140,7 +140,7 @@ |
| 140 | 140 | <div style="width: 100%;"> |
| 141 | 141 | <div style="display: flex;padding:0px 20px 20px 20px; "> |
| 142 | 142 | <div style="width: 150px;height: 80px;" v-if="secondData.coverPoster"> |
| 143 | - <img :src="secondData.coverPoster" alt="" style="width: 100%;height: 80px;" /> | |
| 143 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 100%;height: 80px;" /> | |
| 144 | 144 | </div> |
| 145 | 145 | <div |
| 146 | 146 | style="display: flex;flex-direction: column;justify-content: space-around;padding: 0 10px;font-size: 12px;"> |
| ... | ... | @@ -262,7 +262,7 @@ |
| 262 | 262 | <el-table-column label="操作" min-width="20%"> |
| 263 | 263 | <template slot-scope="scope"> |
| 264 | 264 | <!-- <div class="tableBtn greens" @click="Down(scope.row)">下载</div> --> |
| 265 | - <a class="tableBtn greens" :href="scope.row.attachmentUrl" target="_blank" download>下载</a> | |
| 265 | + <a class="tableBtn greens" :href="$baseURL+scope.row.attachmentUrl" target="_blank" download>下载</a> | |
| 266 | 266 | </template> |
| 267 | 267 | </el-table-column> |
| 268 | 268 | |
| ... | ... | @@ -489,7 +489,7 @@ |
| 489 | 489 | </el-col> |
| 490 | 490 | |
| 491 | 491 | </el-row> |
| 492 | - <el-row :gutter="20"> | |
| 492 | + <!-- <el-row :gutter="20"> | |
| 493 | 493 | <el-col :span="24"> |
| 494 | 494 | <el-form-item label="反馈内容" class="grid-content bg-purple" prop="name"> |
| 495 | 495 | <el-upload class="upload-demo" ref="upload" :on-remove="handleRemove" |
| ... | ... | @@ -501,7 +501,7 @@ |
| 501 | 501 | </el-form-item> |
| 502 | 502 | </el-col> |
| 503 | 503 | |
| 504 | - </el-row> | |
| 504 | + </el-row> --> | |
| 505 | 505 | </el-form> |
| 506 | 506 | </div> |
| 507 | 507 | </div> |
| ... | ... | @@ -961,9 +961,7 @@ |
| 961 | 961 | </el-table-column> |
| 962 | 962 | <el-table-column label="类型" prop="planType" width="80"> |
| 963 | 963 | </el-table-column> |
| 964 | - <el-table-column label="发布状态" width="80" > | |
| 965 | 964 | |
| 966 | - </el-table-column> | |
| 967 | 965 | <el-table-column label="审批状态" width="150"> |
| 968 | 966 | <template slot-scope="scope"> |
| 969 | 967 | {{scope.row.state == ''?'待提交':scope.row.state == '1'?'待审批':scope.row.state == '2'?'部门领导审批':scope.row.state == '3'?'公司领导审批':scope.row.state == '4'?'其他审批':scope.row.state == '5'?'审核通过':'已驳回'}} |
| ... | ... | @@ -971,14 +969,12 @@ |
| 971 | 969 | </el-table-column> |
| 972 | 970 | <el-table-column label="修改时间" prop="createDate"width="250" > |
| 973 | 971 | </el-table-column> |
| 974 | - <el-table-column prop="createUser" label="上传人员" width="80"> | |
| 975 | 972 | |
| 976 | - </el-table-column> | |
| 977 | 973 | <el-table-column label="操作" width="350"> |
| 978 | 974 | <template slot-scope="scope"> |
| 979 | 975 | <div @click="shiyong(scope.row)" class="tableBtn greens">使用</div> |
| 980 | 976 | <!-- <div @click="actBian(scope.row)" class="tableBtn greens" v-if="scope.row.state == ''">修改</div> --> |
| 981 | - <div @click="handleDelete(scope.row)" class="tableBtn greens">删除</div> | |
| 977 | + <div @click="handleDel(scope.row)" class="tableBtn greens">删除</div> | |
| 982 | 978 | </template> |
| 983 | 979 | </el-table-column> |
| 984 | 980 | </el-table> |
| ... | ... | @@ -1378,6 +1374,39 @@ |
| 1378 | 1374 | }) |
| 1379 | 1375 | } |
| 1380 | 1376 | }, |
| 1377 | + handleDel(val){ | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + const h = this.$createElement; | |
| 1381 | + this.$msgbox({ | |
| 1382 | + title: '消息', | |
| 1383 | + message: h('p', null, [ | |
| 1384 | + h('span', null, '是否删除 '), | |
| 1385 | + ]), | |
| 1386 | + showCancelButton: true, | |
| 1387 | + showClose: false, | |
| 1388 | + confirmButtonText: '确定', | |
| 1389 | + cancelButtonText: '取消', | |
| 1390 | + customClass: 'oe-dialog-btn', | |
| 1391 | + beforeClose: (action, instance, done) => { | |
| 1392 | + if (action === 'confirm') { | |
| 1393 | + deleteById({ | |
| 1394 | + id:val.id | |
| 1395 | + }).then(res => { | |
| 1396 | + this.$message({ | |
| 1397 | + message: '删除成功', | |
| 1398 | + type: 'success' | |
| 1399 | + }) | |
| 1400 | + this.getAll() | |
| 1401 | + done(); | |
| 1402 | + }) | |
| 1403 | + } else { | |
| 1404 | + done(); | |
| 1405 | + } | |
| 1406 | + } | |
| 1407 | + }) | |
| 1408 | + | |
| 1409 | + }, | |
| 1381 | 1410 | //查询 |
| 1382 | 1411 | async onSubmit() { |
| 1383 | 1412 | if (this.planName != '' && this.eventTheme == '') { |
| ... | ... | @@ -2201,9 +2230,6 @@ |
| 2201 | 2230 | ::v-deep .el-form-item{ |
| 2202 | 2231 | margin-bottom:16px; |
| 2203 | 2232 | } |
| 2204 | - /deep/ .el-form-item__content { | |
| 2205 | - line-height: 0; | |
| 2206 | - } | |
| 2207 | 2233 | |
| 2208 | 2234 | .tableBtn { |
| 2209 | 2235 | display: inline-block; | ... | ... |
admin-web-master/src/views/atmosphere/atmosphereBian.vue
| ... | ... | @@ -79,9 +79,11 @@ |
| 79 | 79 | </el-row> |
| 80 | 80 | <div style="padding: 10px"> |
| 81 | 81 | <el-row :gutter="20"> |
| 82 | - <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> | |
| 83 | - <upimg v-model="secondData.coverPoster" :value="secondData.coverPoster==''?'':secondData.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 82 | + <el-col :span="24"> | |
| 83 | + <el-form-item label="活动封面海报" prop="coverPoster" class="grid-content bg-purple"> | |
| 84 | + <upimg filePath="act" :value="secondData.coverPoster==''?'':secondData.coverPoster" inputtype="coverPoster" :limit="1" @changimg="e=>changimg(e,'coverPoster')"></upimg> | |
| 84 | 85 | </el-form-item> |
| 86 | + </el-col> | |
| 85 | 87 | </el-row> |
| 86 | 88 | </div> |
| 87 | 89 | </el-form> |
| ... | ... | @@ -238,14 +240,15 @@ |
| 238 | 240 | 相关附件信息 |
| 239 | 241 | </div> |
| 240 | 242 | <div> |
| 241 | - <el-upload class="upload-demo" ref="upload" | |
| 243 | + <upfile filePath="act" inputtype="otherImageVideos" :islist="false" :accept="'.docx'" :value="ruleForm.otherImageVideos" @changimg="e=>changimg(e,'otherImageVideos')"></upfile> | |
| 244 | + <!-- <el-upload class="upload-demo" ref="upload" | |
| 242 | 245 | :action="uploadFileUrl" |
| 243 | 246 | :on-success="handleUploadSuccess" |
| 244 | 247 | :file-list="fileData" :show-file-list="false"> |
| 245 | 248 | <div style="color: #2d8a58;margin-left: 10px;margin-top: 10px;" slot="trigger"> |
| 246 | 249 | 上传附件 |
| 247 | 250 | </div> |
| 248 | - </el-upload> | |
| 251 | + </el-upload> --> | |
| 249 | 252 | </div> |
| 250 | 253 | </div> |
| 251 | 254 | <div style="padding: 20px 40px 0px 20px"> |
| ... | ... | @@ -330,6 +333,8 @@ |
| 330 | 333 | import Vue from 'vue' |
| 331 | 334 | import { uploadUrl } from '@/utils/request' |
| 332 | 335 | import upimg from "@/components/ImageUpload/index" |
| 336 | + import upfile from "@/components/fujianUpload/fujianList" | |
| 337 | + | |
| 333 | 338 | export default { |
| 334 | 339 | props:{ |
| 335 | 340 | showBian:{ |
| ... | ... | @@ -337,7 +342,7 @@ |
| 337 | 342 | default: () => ({}) |
| 338 | 343 | } |
| 339 | 344 | }, |
| 340 | - components: { upimg}, | |
| 345 | + components: { upfile,upimg}, | |
| 341 | 346 | data() { |
| 342 | 347 | return { |
| 343 | 348 | uploadFileUrl: uploadUrl, // 请求地址 |
| ... | ... | @@ -383,6 +388,27 @@ |
| 383 | 388 | mounted() { |
| 384 | 389 | }, |
| 385 | 390 | methods: { |
| 391 | + changimg(e,type) { | |
| 392 | + this.ruleForm[type] = e | |
| 393 | + | |
| 394 | + if(type=='otherImageVideos'){ | |
| 395 | + const parts = e.split('/'); | |
| 396 | + const filename = parts[parts.length - 1]; | |
| 397 | + // let file ={ | |
| 398 | + // url:e, | |
| 399 | + // attachmentName:filename | |
| 400 | + // } | |
| 401 | + let fuji={ | |
| 402 | + detailsId:this.secondData.id, | |
| 403 | + attachmentName:filename, | |
| 404 | + attachmentUrl:e, | |
| 405 | + } | |
| 406 | + fujiaAdd(fuji).then(res=>{ | |
| 407 | + this.fucha(this.secondData.id) | |
| 408 | + }) | |
| 409 | + // this.dataList.push(file) | |
| 410 | + } | |
| 411 | + }, | |
| 386 | 412 | //获取当前时间 |
| 387 | 413 | updateCurrentTime() { |
| 388 | 414 | const now = new Date(); | ... | ... |
admin-web-master/src/views/atmosphere/atmosphereBz.vue
| ... | ... | @@ -118,9 +118,9 @@ |
| 118 | 118 | </el-col> |
| 119 | 119 | </el-row> |
| 120 | 120 | <el-row :gutter="20"> |
| 121 | - <el-col :span="12"> | |
| 122 | - <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> | |
| 123 | - <upimg v-model="ruleForm.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 121 | + <el-col :span="24"> | |
| 122 | + <el-form-item label="活动封面海报" prop="coverPoster" class="grid-content bg-purple"> | |
| 123 | + <upimg filePath="act" :value="ruleForm.coverPoster" inputtype="coverPoster" :limit="1" @changimg="e=>changimg(e,'coverPoster')"></upimg> | |
| 124 | 124 | </el-form-item> |
| 125 | 125 | </el-col> |
| 126 | 126 | </el-row> |
| ... | ... | @@ -282,17 +282,9 @@ |
| 282 | 282 | <el-tab-pane label="相关附件"> |
| 283 | 283 | <div style="border: 1px solid #E5E5E5;padding: 1px" id="fu"> |
| 284 | 284 | <div style="padding: 10px 13px;font-size: 12px;border-bottom: 1px solid #E5E5E5;display: flex;"> |
| 285 | - <div>相关附件</div> | |
| 285 | + <div style="line-height:38px;">相关附件</div> | |
| 286 | 286 | <div> |
| 287 | - <el-upload class="upload-demo" ref="upload" | |
| 288 | - :action="uploadFileUrl" | |
| 289 | - :on-success="handleUploadSuccess" | |
| 290 | - :file-list="fileData" | |
| 291 | - :show-file-list="false" > | |
| 292 | - <div style="color: #2d8a58;margin-left: 10px;" slot="trigger"> | |
| 293 | - 上传附件 | |
| 294 | - </div> | |
| 295 | - </el-upload> | |
| 287 | + <upfile filePath="act" inputtype="otherImageVideos" :limit="10" :islist="false" :accept="'.docx'" :value="ruleForm.otherImageVideos" @changimg="e=>changimg(e,'otherImageVideos')"></upfile> | |
| 296 | 288 | </div> |
| 297 | 289 | </div> |
| 298 | 290 | <div style="padding: 15px;"> |
| ... | ... | @@ -391,6 +383,7 @@ |
| 391 | 383 | import { uploadUrl } from '@/utils/request' |
| 392 | 384 | import html2canvas from 'html2canvas' |
| 393 | 385 | import jsPDF from 'jspdf' |
| 386 | + import upfile from "@/components/fujianUpload/fujianList" | |
| 394 | 387 | export default { |
| 395 | 388 | props: { |
| 396 | 389 | showAdd:{ |
| ... | ... | @@ -404,7 +397,7 @@ export default { |
| 404 | 397 | }, |
| 405 | 398 | } |
| 406 | 399 | }, |
| 407 | - components: { wangEditor ,upimg}, | |
| 400 | + components: { wangEditor ,upimg,upfile}, | |
| 408 | 401 | data(){ |
| 409 | 402 | return{ |
| 410 | 403 | uploadFileUrl: uploadUrl, // 请求地址 |
| ... | ... | @@ -476,6 +469,19 @@ lishiList:'', |
| 476 | 469 | this.lishi() |
| 477 | 470 | }, |
| 478 | 471 | methods: { |
| 472 | + changimg(e,type) { | |
| 473 | + this.ruleForm[type] = e | |
| 474 | + | |
| 475 | + if(type=='otherImageVideos'){ | |
| 476 | + const parts = e.split('/'); | |
| 477 | + const filename = parts[parts.length - 1]; | |
| 478 | + let file ={ | |
| 479 | + url:e, | |
| 480 | + name:filename | |
| 481 | + } | |
| 482 | + this.dataList.push(file) | |
| 483 | + } | |
| 484 | + }, | |
| 479 | 485 | //获取当前时间 |
| 480 | 486 | updateCurrentTime() { |
| 481 | 487 | const now = new Date(); | ... | ... |
admin-web-master/src/views/atmosphere/atmosphereGl.vue
| ... | ... | @@ -139,7 +139,7 @@ |
| 139 | 139 | <div style="width: 100%;"> |
| 140 | 140 | <div style="display: flex;padding:0px 20px 20px 20px; "> |
| 141 | 141 | <div style="width: 150px;height: 80px;" v-if="secondData.coverPoster"> |
| 142 | - <img :src="secondData.coverPoster" alt="" style="width: 100%;height: 80px;"/> | |
| 142 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 100%;height: 80px;"/> | |
| 143 | 143 | </div> |
| 144 | 144 | <div |
| 145 | 145 | style="display: flex;flex-direction: column;justify-content: space-around;padding: 0 10px;font-size: 12px;"> |
| ... | ... | @@ -553,7 +553,7 @@ |
| 553 | 553 | </el-col> |
| 554 | 554 | |
| 555 | 555 | </el-row> |
| 556 | - <el-row :gutter="20"> | |
| 556 | + <!-- <el-row :gutter="20"> | |
| 557 | 557 | <el-col :span="24"> |
| 558 | 558 | <el-form-item label="反馈内容" class="grid-content bg-purple" prop="name"> |
| 559 | 559 | <el-upload class="upload-demo" ref="upload" :on-remove="handleRemove" |
| ... | ... | @@ -565,7 +565,7 @@ |
| 565 | 565 | </el-form-item> |
| 566 | 566 | </el-col> |
| 567 | 567 | |
| 568 | - </el-row> | |
| 568 | + </el-row> --> | |
| 569 | 569 | </el-form> |
| 570 | 570 | </div> |
| 571 | 571 | </div> |
| ... | ... | @@ -2216,9 +2216,6 @@ this.fileData=[] |
| 2216 | 2216 | |
| 2217 | 2217 | } |
| 2218 | 2218 | |
| 2219 | -/deep/ .el-form-item__content { | |
| 2220 | - line-height: 0; | |
| 2221 | -} | |
| 2222 | 2219 | |
| 2223 | 2220 | .tableBtn { |
| 2224 | 2221 | display: inline-block; | ... | ... |
admin-web-master/src/views/atmosphere/atmosphereSp.vue
| ... | ... | @@ -430,7 +430,7 @@ |
| 430 | 430 | <div style="padding: 10px"> |
| 431 | 431 | <el-row :gutter="20"> |
| 432 | 432 | <el-form-item label="活动封面海报" prop="cover_poster" class="grid-content bg-purple"> |
| 433 | - <img :src="secondData.coverPoster" alt="" style="width: 80px;height:80px;"> | |
| 433 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 80px;height:80px;"> | |
| 434 | 434 | </el-form-item> |
| 435 | 435 | </el-row> |
| 436 | 436 | </div> |
| ... | ... | @@ -761,7 +761,7 @@ |
| 761 | 761 | <div style="width: 100%;"> |
| 762 | 762 | <div style="display: flex;padding:0px 20px 20px 20px; "> |
| 763 | 763 | <div style="width: 150px;height: 80px;" v-if="secondData.coverPoster"> |
| 764 | - <img :src="secondData.coverPoster" alt="" style="width: 100%;height: 80px;"/> | |
| 764 | + <img :src="$baseURL+secondData.coverPoster" alt="" style="width: 100%;height: 80px;"/> | |
| 765 | 765 | </div> |
| 766 | 766 | <div |
| 767 | 767 | style="display: flex;flex-direction: column;justify-content: space-around;padding: 0 10px;font-size: 12px;"> | ... | ... |
admin-web-master/src/views/media/mediaMana.vue
| ... | ... | @@ -126,8 +126,8 @@ |
| 126 | 126 | </el-form-item> |
| 127 | 127 | <el-form-item label="封面海报" class="grid-content bg-purple" prop="name"> |
| 128 | 128 | <div style="margin:0 10px;"> |
| 129 | - <upimg v-model="secondData.coverImage" :value="secondData.coverImage" :limit="1" :fileSize="1" :isShowTip="false" v-if="wangShow==false"></upimg> | |
| 130 | - <img :src="secondData.coverImage" alt="" style="width:150px;height: 150px;" v-if="wangShow"/> | |
| 129 | + <upimg filePath="tuiguang" :value="secondData.coverImage" inputtype="coverImage" :limit="1" v-if="wangShow==false" @changimg="e=>changimg(e,'coverImage')"></upimg> | |
| 130 | + <img :src="$baseURL+secondData.coverImage" alt="" style="width:150px;height: 150px;" v-if="wangShow"/> | |
| 131 | 131 | </div> |
| 132 | 132 | </el-form-item> |
| 133 | 133 | <el-form-item label="宣传内容" class="grid-content bg-purple" prop="name"> |
| ... | ... | @@ -531,7 +531,7 @@ components: { addAct,wangEditor,upimg}, |
| 531 | 531 | planName: '', |
| 532 | 532 | planFen:'', |
| 533 | 533 | currentPage: 1, |
| 534 | - total: 100, | |
| 534 | + total: 0, | |
| 535 | 535 | flag: false, |
| 536 | 536 | pageSize: 10, |
| 537 | 537 | ggXin: false, |
| ... | ... | @@ -602,6 +602,10 @@ components: { addAct,wangEditor,upimg}, |
| 602 | 602 | |
| 603 | 603 | }, |
| 604 | 604 | methods: { |
| 605 | + changimg(e,type) { | |
| 606 | + this.secondData[type] = e | |
| 607 | + | |
| 608 | + }, | |
| 605 | 609 | //查询全数据 |
| 606 | 610 | async getAll() { |
| 607 | 611 | const res = await tuiGetAll(this.pageindex) | ... | ... |
admin-web-master/src/views/media/mediaMannaAdd.vue
| ... | ... | @@ -44,19 +44,20 @@ |
| 44 | 44 | <div style="padding:15px"> |
| 45 | 45 | <div style="display:flex;"> |
| 46 | 46 | <div style="display:flex;margin-right:30px;"> |
| 47 | - <div>微信</div> | |
| 48 | - <div style="margin:0 10px;"><upimg v-model="ruleForm.coverImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg></div> | |
| 49 | - <div style="color:#E5E5E5"> | |
| 50 | - 请选择海报 | |
| 51 | - </div> | |
| 47 | + <div>封面海报</div> | |
| 48 | + <div style="margin:0 10px;"> | |
| 49 | + <!-- <upimg v-model="ruleForm.coverImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg> --> | |
| 50 | + <upimg filePath="tuiguang" :value="ruleForm.coverImage" inputtype="coverImage" :limit="1" @changimg="e=>changimg(e,'coverImage')"></upimg> | |
| 51 | + </div> | |
| 52 | + | |
| 52 | 53 | </div> |
| 53 | - <div style="display:flex"> | |
| 54 | + <!-- <div style="display:flex"> | |
| 54 | 55 | <div>微信朋友圈</div> |
| 55 | 56 | <div style="margin:0 10px;"><upimg v-model="ruleForm.wxpyPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg></div> |
| 56 | 57 | <div style="color:#E5E5E5"> |
| 57 | 58 | 请选择海报 |
| 58 | 59 | </div> |
| 59 | - </div> | |
| 60 | + </div> --> | |
| 60 | 61 | </div> |
| 61 | 62 | </div> |
| 62 | 63 | </div> |
| ... | ... | @@ -69,10 +70,10 @@ |
| 69 | 70 | </el-button> |
| 70 | 71 | <!-- <el-button plain @click="close" size="mini" style="background-color: #3F9B6A;color: #fff;">发布信息填写 |
| 71 | 72 | </el-button> --> |
| 72 | - <el-button plain @click="close" size="mini" style="background-color: #3F9B6A;color: #fff;">媒体上传 | |
| 73 | + <!-- <el-button plain @click="close" size="mini" style="background-color: #3F9B6A;color: #fff;">媒体上传 | |
| 73 | 74 | </el-button> |
| 74 | 75 | <el-button plain @click="close" size="mini" style="background-color: #fff;color: #000;border:1px solid #A0A0A0" class="buttonHover">一键发布 |
| 75 | - </el-button> | |
| 76 | + </el-button> --> | |
| 76 | 77 | <el-button plain @click="close" size="mini" style="background-color: #fff;color: #000;border:1px solid #A0A0A0" class="buttonHover">返回 |
| 77 | 78 | </el-button> |
| 78 | 79 | </div> |
| ... | ... | @@ -147,6 +148,10 @@ |
| 147 | 148 | this.editTrue = true |
| 148 | 149 | }, |
| 149 | 150 | methods: { |
| 151 | + changimg(e,type) { | |
| 152 | + this.ruleForm[type] = e | |
| 153 | + | |
| 154 | + }, | |
| 150 | 155 | //获取当前时间 |
| 151 | 156 | updateCurrentTime() { |
| 152 | 157 | const now = new Date(); | ... | ... |
admin-web-master/src/views/promotion/account.vue
| ... | ... | @@ -139,7 +139,8 @@ |
| 139 | 139 | <el-input v-model="formInline.appKey" placeholder="请输入"></el-input> |
| 140 | 140 | </el-form-item> |
| 141 | 141 | <el-form-item label="APP图片" v-if="index==1?true:false" prop="coverPoster" style="margin-bottom:20px;"> |
| 142 | - <upimg v-model="formInline.coverPoster" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 142 | + <upimg filePath="qudao" :value="formInline.coverPoster" inputtype="coverPoster" :limit="1" @changimg="e=>changimg(e,'coverPoster')"></upimg> | |
| 143 | + | |
| 143 | 144 | </el-form-item> |
| 144 | 145 | <el-form-item label="备注"> |
| 145 | 146 | <el-input type="textarea" v-model="formInline.notes" :rows="4" |
| ... | ... | @@ -297,6 +298,9 @@ |
| 297 | 298 | this.getAll() |
| 298 | 299 | }, |
| 299 | 300 | methods: { |
| 301 | + changimg(e,type) { | |
| 302 | + this.formInline[type] = e | |
| 303 | + }, | |
| 300 | 304 | async getAll() { |
| 301 | 305 | const res = await quGetAll(this.pageindex) |
| 302 | 306 | this.tableData = res.data.content | ... | ... |
admin-web-master/src/views/promotion/audit.vue
| ... | ... | @@ -45,9 +45,7 @@ |
| 45 | 45 | </el-table-column> |
| 46 | 46 | <el-table-column label="类型" prop="promotionContent" min-width="150" > |
| 47 | 47 | </el-table-column> |
| 48 | - <el-table-column label="发布状态" prop="" min-width="80" > | |
| 49 | 48 | |
| 50 | - </el-table-column> | |
| 51 | 49 | <el-table-column label="审批状态" prop="state" min-width="150" > |
| 52 | 50 | <template slot-scope="scope"> |
| 53 | 51 | {{scope.row.state == ''?'待提交':scope.row.state == '1'?'待审批':scope.row.state == '2'?'部门领导审批':scope.row.state == '3'?'公司领导审批':scope.row.state == '4'?'其他审批':scope.row.state == '5'?'审核通过':'已驳回'}} |
| ... | ... | @@ -55,9 +53,7 @@ |
| 55 | 53 | </el-table-column> |
| 56 | 54 | <el-table-column label="修改时间" prop="createDate" min-width="250" > |
| 57 | 55 | </el-table-column> |
| 58 | - <el-table-column prop="eventEndTime" label="上传人员" min-width="120" > | |
| 59 | 56 | |
| 60 | - </el-table-column> | |
| 61 | 57 | <el-table-column label="操作" min-width="150"> |
| 62 | 58 | <template slot-scope="scope"> |
| 63 | 59 | <div @click="actSp(scope.row)" class="tableBtn greens" v-if="scope.row.state != ''">OA流程审批</div> |
| ... | ... | @@ -76,148 +72,6 @@ |
| 76 | 72 | </div> |
| 77 | 73 | </div> |
| 78 | 74 | |
| 79 | - <!-- 活动效果分析 --> | |
| 80 | - <el-dialog :visible.sync="ggXin" custom-class='fenxi_css' style="padding: 0;" width="75%" | |
| 81 | - center :close-on-click-modal="false" :close-on-press-escape="false"> | |
| 82 | - <div style="padding:15px;background-color:#F9F9F9;font-size:12px;border:1px solid #ECECEC;margin-bottom:20px"> | |
| 83 | - 渠道效果分析 | |
| 84 | - </div> | |
| 85 | - <div style="padding:0 20px;"> | |
| 86 | - <div style="font-size:12px;margin-bottom:10px;">成本分析</div> | |
| 87 | - <div style="display:flex;padding:10px 0;"> | |
| 88 | - <div style="margin-right:40px;width:17%"> | |
| 89 | - <div style="color:#BBBBBB;font-size:10px;">吸引游客流量</div> | |
| 90 | - <div style="font-size:14px;padding:10px 0"><span style="font-size:20px;font-weight:600;">4289</span>人</div> | |
| 91 | - <div style="color:#BBBBBB;font-size:10px;margin-bottom:10px">+45%</div> | |
| 92 | - <div style="height:5px;background-color:red;"></div> | |
| 93 | - </div> | |
| 94 | - <div style="margin-right:40px;width:17%"> | |
| 95 | - <div style="color:#BBBBBB;font-size:10px;">参与人数</div> | |
| 96 | - <div style="font-size:14px;padding:10px 0"><span style="font-size:20px;font-weight:600;">4289</span>人</div> | |
| 97 | - <div style="color:#BBBBBB;font-size:10px;margin-bottom:10px">+45%</div> | |
| 98 | - <div style="height:5px;background-color:red;"></div> | |
| 99 | - </div> | |
| 100 | - <div style="margin-right:40px;width:17%"> | |
| 101 | - <div style="color:#BBBBBB;font-size:10px;">直接收益</div> | |
| 102 | - <div style="font-size:14px;padding:10px 0"><span style="font-size:20px;font-weight:600;">4289</span>人</div> | |
| 103 | - <div style="color:#BBBBBB;font-size:10px;margin-bottom:10px">+45%</div> | |
| 104 | - <div style="height:5px;background-color:red;"></div> | |
| 105 | - </div> | |
| 106 | - <div style="margin-right:40px;width:17%"> | |
| 107 | - <div style="color:#BBBBBB;font-size:10px;">间接收益</div> | |
| 108 | - <div style="font-size:14px;padding:10px 0"><span style="font-size:20px;font-weight:600;">4289</span>人</div> | |
| 109 | - <div style="color:#BBBBBB;font-size:10px;margin-bottom:10px">+45%</div> | |
| 110 | - <div style="height:5px;background-color:red;"></div> | |
| 111 | - </div> | |
| 112 | - <div style="margin-right:40px;width:17%"> | |
| 113 | - <div style="color:#BBBBBB;font-size:10px;">投入生产比</div> | |
| 114 | - <div style="font-size:14px;padding:10px 0"><span style="font-size:20px;font-weight:600;">4289</span>人</div> | |
| 115 | - <div style="color:#BBBBBB;font-size:10px;margin-bottom:10px">+45%</div> | |
| 116 | - <div style="height:5px;background-color:red;"></div> | |
| 117 | - </div> | |
| 118 | - </div> | |
| 119 | - </div> | |
| 120 | - <div style="padding:15px;background-color:#F9F9F9;font-size:12px;border:1px solid #ECECEC;margin-bottom:20px"> | |
| 121 | - 策划主题占比 | |
| 122 | - </div> | |
| 123 | - <div style="padding:0 20px;display:flex;justify-content: space-around;color:#999999"> | |
| 124 | - <div style="display:flex;width:24%;align-items: center"> | |
| 125 | - <el-progress type="circle" :percentage="100"></el-progress> | |
| 126 | - <div style="margin-left:30px;"> | |
| 127 | - <div style="margin-bottom: 15px;">主题1</div> | |
| 128 | - <div><span style="font-size:26px;">53.2</span>万流量</div> | |
| 129 | - </div> | |
| 130 | - </div> | |
| 131 | - <div style="display:flex;width:24%;align-items: center"> | |
| 132 | - <el-progress type="circle" :percentage="25"></el-progress> | |
| 133 | - <div style="margin-left:30px;"> | |
| 134 | - <div style="margin-bottom: 15px;">主题2</div> | |
| 135 | - <div><span style="font-size:26px;">53.2</span>万流量</div> | |
| 136 | - </div> | |
| 137 | - </div> | |
| 138 | - <div style="display:flex;width:24%;align-items: center"> | |
| 139 | - <el-progress type="circle" :percentage="50"></el-progress> | |
| 140 | - <div style="margin-left:30px;"> | |
| 141 | - <div style="margin-bottom: 15px;">主题3</div> | |
| 142 | - <div><span style="font-size:26px;">53.2</span>万流量</div> | |
| 143 | - </div> | |
| 144 | - </div> | |
| 145 | - <div style="display:flex;width:24%;align-items: center"> | |
| 146 | - <el-progress type="circle" :percentage="75"></el-progress> | |
| 147 | - <div style="margin-left:30px;"> | |
| 148 | - <div style="margin-bottom: 15px;">主题4</div> | |
| 149 | - <div><span style="font-size:26px;">53.2</span>万流量</div> | |
| 150 | - </div> | |
| 151 | - </div> | |
| 152 | - </div> | |
| 153 | - <div style="padding:0 20px;margin-top:20px;"> | |
| 154 | - <div style="padding:55px 10px 10px 10px;background-color:#fff;position:relative"> | |
| 155 | - <div style="position: absolute;top: 60px;right: 10px; z-index: 10;"> | |
| 156 | - <el-radio-group v-model="radio1" style="margin-right:10px"> | |
| 157 | - <el-radio-button label="本周"></el-radio-button> | |
| 158 | - <el-radio-button label="本月"></el-radio-button> | |
| 159 | - <el-radio-button label="今年 "></el-radio-button> | |
| 160 | - <el-radio-button label="自定义"></el-radio-button> | |
| 161 | - </el-radio-group> | |
| 162 | - <el-date-picker | |
| 163 | - v-if="radio1=='自定义'" | |
| 164 | - | |
| 165 | - style="width:250px" | |
| 166 | - v-model="radio1_time" | |
| 167 | - type="datetimerange" | |
| 168 | - range-separator="至" | |
| 169 | - start-placeholder="开始日期" | |
| 170 | - end-placeholder="结束日期"> | |
| 171 | - </el-date-picker> | |
| 172 | - </div> | |
| 173 | - <el-tabs type="border-card" @tab-click="TabClick"> | |
| 174 | - <el-tab-pane label="整体效果分析"> | |
| 175 | - <el-table :data="dataList" | |
| 176 | - :header-cell-style="{fontSize: '12px', backgroundColor: '#FAFAFA',color:'#000',fontWeight: 'normal'}" | |
| 177 | - style="width: 100%"> | |
| 178 | - <el-table-column label="渠道" width="auto" min-width="12%" align="center"> | |
| 179 | - <template slot-scope="scope"> | |
| 180 | - {{scope.$index + 1}} | |
| 181 | - </template> | |
| 182 | - </el-table-column> | |
| 183 | - <el-table-column label="阅读量" width="auto" min-width="15%" align="center"> | |
| 184 | - <template slot-scope="scope"> | |
| 185 | - {{scope.$index + 1}} | |
| 186 | - </template> | |
| 187 | - </el-table-column> | |
| 188 | - <el-table-column label="点赞量" width="auto" min-width="15%" align="center"> | |
| 189 | - <template slot-scope="scope"> | |
| 190 | - {{scope.$index + 1}} | |
| 191 | - </template> | |
| 192 | - </el-table-column> | |
| 193 | - <el-table-column label="评论量" prop="name" width="auto" min-width="15%"> | |
| 194 | - <template slot-scope="scope"> | |
| 195 | - {{scope.row.name}} | |
| 196 | - </template> | |
| 197 | - </el-table-column> | |
| 198 | - <el-table-column label="播放量" prop="name" width="auto" min-width="15%"> | |
| 199 | - <template slot-scope="scope"> | |
| 200 | - {{scope.row.name}} | |
| 201 | - </template> | |
| 202 | - </el-table-column> | |
| 203 | - <el-table-column label="回访人数" prop="name" width="auto" min-width="15%"> | |
| 204 | - <template slot-scope="scope"> | |
| 205 | - {{scope.row.name}} | |
| 206 | - </template> | |
| 207 | - </el-table-column> | |
| 208 | - </el-table> | |
| 209 | - </el-tab-pane> | |
| 210 | - <el-tab-pane label="纵向分析"> | |
| 211 | - | |
| 212 | - </el-tab-pane> | |
| 213 | - <el-tab-pane label="横向分析"> | |
| 214 | - | |
| 215 | - </el-tab-pane> | |
| 216 | - </el-tabs> | |
| 217 | - </div> | |
| 218 | - | |
| 219 | - </div> | |
| 220 | - </el-dialog> | |
| 221 | 75 | </div> |
| 222 | 76 | </div> |
| 223 | 77 | <!-- 审批 --> |
| ... | ... | @@ -285,7 +139,7 @@ |
| 285 | 139 | <el-col :span="8"> |
| 286 | 140 | <el-form-item label="封面海报" class="grid-content bg-purple" prop="name"> |
| 287 | 141 | <div style="margin:0 10px;"> |
| 288 | - <img :src="secondData.coverImage" alt="" style="width:150px;height: 150px;" /> | |
| 142 | + <img :src="$baseURL+secondData.coverImage" alt="" style="width:150px;height: 150px;" /> | |
| 289 | 143 | </div> |
| 290 | 144 | </el-form-item> |
| 291 | 145 | </el-col> |
| ... | ... | @@ -797,7 +651,7 @@ actSp(item){ |
| 797 | 651 | line-height: 0; |
| 798 | 652 | } |
| 799 | 653 | |
| 800 | - | |
| 654 | + | |
| 801 | 655 | |
| 802 | 656 | .formSearch { |
| 803 | 657 | display: flex; | ... | ... |
admin-web-master/src/views/promotion/contentMant.vue
| ... | ... | @@ -97,11 +97,12 @@ |
| 97 | 97 | <div style="padding:20px;" v-if="index == 2" v-html="formInline.contentCompilation"></div> |
| 98 | 98 | </el-form-item> |
| 99 | 99 | <el-form-item label="附件上传" prop="accountNumber"> |
| 100 | - <el-upload class="upload-demo" ref="upload" :on-remove="handleRemove" | |
| 100 | + <!-- <el-upload class="upload-demo" ref="upload" :on-remove="handleRemove" | |
| 101 | 101 | :action="uploadFileUrl" :on-success="handleUploadSuccess" :file-list="fileData" |
| 102 | 102 | :auto-upload="true" v-if="index ==3 || index ==1"> |
| 103 | 103 | <el-button style="background-color: #fff;color: #3F9B6A;border: 1px solid #dcdfe6;" class="buttonHover" v-if="fileData.length==0">+点击上传</el-button> |
| 104 | - </el-upload> | |
| 104 | + </el-upload> --> | |
| 105 | + <upfile filePath="tuiguang" inputtype="otherImageVideos" :limit="1" :accept="'.docx'" :value="formInline.otherImageVideos" @changimg="e=>changimg(e,'otherImageVideos')"></upfile> | |
| 105 | 106 | <div style="padding:20px;" v-if="index == 2"> |
| 106 | 107 | {{formInline.attachmentUpload[0]&&formInline.attachmentUpload[0].name?formInline.attachmentUpload[0].name:''}} |
| 107 | 108 | </div> |
| ... | ... | @@ -119,7 +120,8 @@ |
| 119 | 120 | <el-input v-model="formInline.appKey" placeholder="请输入"></el-input> |
| 120 | 121 | </el-form-item> |
| 121 | 122 | <el-form-item label="APP图片" v-if="index==1?true:false" prop="appImage" style="margin-bottom:20px;"> |
| 122 | - <upimg v-model="formInline.appImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 123 | + <!-- <upimg v-model="formInline.appImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg> --> | |
| 124 | + <upimg filePath="tuiguang" :value="formInline.appImage" inputtype="appImage" :limit="1" @changimg="e=>changimg(e,'appImage')"></upimg> | |
| 123 | 125 | </el-form-item> |
| 124 | 126 | <el-form-item label="备注"> |
| 125 | 127 | <el-input type="textarea" v-model="formInline.remarks" :rows="4" |
| ... | ... | @@ -163,11 +165,12 @@ |
| 163 | 165 | } from '@/api/contentMant.js' |
| 164 | 166 | import upimg from "@/components/ImageUpload/index" |
| 165 | 167 | import wangEditor from "@/components/editor/index" |
| 168 | + import upfile from "@/components/fujianUpload/fujianList" | |
| 166 | 169 | import { |
| 167 | 170 | uploadUrl |
| 168 | 171 | } from '@/utils/request' |
| 169 | 172 | export default { |
| 170 | - components: { upimg,wangEditor}, | |
| 173 | + components: { upimg,wangEditor,upfile}, | |
| 171 | 174 | data() { |
| 172 | 175 | return { |
| 173 | 176 | uploadFileUrl: uploadUrl, // 请求地址 |
| ... | ... | @@ -234,6 +237,18 @@ |
| 234 | 237 | this.getAll() |
| 235 | 238 | }, |
| 236 | 239 | methods: { |
| 240 | + changimg(e,type) { | |
| 241 | + this.formInline[type] = e | |
| 242 | + if(type=='otherImageVideos'){ | |
| 243 | + const parts = e.split('/'); | |
| 244 | + const filename = parts[parts.length - 1]; | |
| 245 | + let file ={ | |
| 246 | + url:e, | |
| 247 | + name:filename | |
| 248 | + } | |
| 249 | + this.formInline.attachmentUpload = JSON.stringify(this.file) | |
| 250 | + } | |
| 251 | + }, | |
| 237 | 252 | async getAll() { |
| 238 | 253 | const res = await quGetAll(this.pageindex) |
| 239 | 254 | this.qudaoData = res.data.content |
| ... | ... | @@ -283,19 +298,19 @@ |
| 283 | 298 | this.$refs.jibenFrom.validate((valid) => { |
| 284 | 299 | if (valid) { |
| 285 | 300 | if(index == 1){ |
| 286 | - if(this.fileData.length !='0'){ | |
| 287 | - this.formInline.attachmentUpload = JSON.stringify(this.fileData) | |
| 288 | - } | |
| 301 | + // if(this.fileData.length !='0'){ | |
| 302 | + // this.formInline.attachmentUpload = JSON.stringify(this.fileData) | |
| 303 | + // } | |
| 289 | 304 | this.formInline.createDate = this.updateCurrentTime() |
| 290 | 305 | contentAdd(this.formInline).then(res => { |
| 291 | 306 | this.getAll() |
| 292 | 307 | this.ggXin = false |
| 293 | 308 | }) |
| 294 | 309 | }else{ |
| 295 | - if(this.fileData.length !='0'){ | |
| 296 | - this.formInline.attachmentUpload = JSON.stringify(this.fileData) | |
| 310 | + // if(this.fileData.length !='0'){ | |
| 311 | + // this.formInline.attachmentUpload = JSON.stringify(this.fileData) | |
| 297 | 312 | |
| 298 | - } | |
| 313 | + // } | |
| 299 | 314 | contentEdit(this.formInline).then(res => { |
| 300 | 315 | this.getAll() |
| 301 | 316 | this.ggXin = false |
| ... | ... | @@ -445,7 +460,7 @@ |
| 445 | 460 | line-height: 0; |
| 446 | 461 | } |
| 447 | 462 | |
| 448 | - | |
| 463 | + | |
| 449 | 464 | |
| 450 | 465 | .formSearch { |
| 451 | 466 | display: flex; | ... | ... |
admin-web-master/src/views/serve/MarkActivity/index.vue
| ... | ... | @@ -155,7 +155,8 @@ |
| 155 | 155 | <el-input placeholder="请输入" v-model="xiangData.contactPhone" :disabled="edit"></el-input> |
| 156 | 156 | </el-form-item> |
| 157 | 157 | <el-form-item label="封面图片" prop="coverImage"> |
| 158 | - <upimg v-model="xiangData.coverImage" :limit="1" :fileSize="1" :isShowTip="false" v-if="!edit"></upimg> | |
| 158 | + <!-- <upimg v-model="xiangData.coverImage" :limit="1" :fileSize="1" :isShowTip="false" v-if="!edit"></upimg> --> | |
| 159 | + <upimg filePath="serve" :value="xiangData.coverImage" inputtype="coverImage" :limit="1" v-if="!edit" @changimg="e=>changimg(e,'coverImage')"></upimg> | |
| 159 | 160 | <img :src="xiangData.coverImage" alt="" v-else> |
| 160 | 161 | </el-form-item> |
| 161 | 162 | |
| ... | ... | @@ -238,7 +239,8 @@ |
| 238 | 239 | <el-input placeholder="请输入" v-model="formInline.contactPhone" ></el-input> |
| 239 | 240 | </el-form-item> |
| 240 | 241 | <el-form-item label="封面图片"> |
| 241 | - <upimg v-model="formInline.coverImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg> | |
| 242 | + <!-- <upimg v-model="formInline.coverImage" :limit="1" :fileSize="1" :isShowTip="false"></upimg> --> | |
| 243 | + <upimg filePath="serve" :value="formInline.coverImage" inputtype="coverImage" :limit="1" v-if="!edit" @changimg="e=>changimg(e,'coverImage')"></upimg> | |
| 242 | 244 | </el-form-item> |
| 243 | 245 | |
| 244 | 246 | </el-form> |
| ... | ... | @@ -430,6 +432,10 @@ |
| 430 | 432 | |
| 431 | 433 | }, |
| 432 | 434 | methods: { |
| 435 | + changimg(e,type) { | |
| 436 | + this.xiangData[type] = e | |
| 437 | + this.changimg[type] = e | |
| 438 | + }, | |
| 433 | 439 | // 获取时间 |
| 434 | 440 | currentTime() { |
| 435 | 441 | let date = new Date(); | ... | ... |
admin-web-master/src/views/serve/procedure.vue
| ... | ... | @@ -244,15 +244,15 @@ |
| 244 | 244 | @click="closeFn(1)" |
| 245 | 245 | >取消</el-button |
| 246 | 246 | > |
| 247 | - <el-button | |
| 247 | + <!-- <el-button | |
| 248 | 248 | style="background-color: #3F9B6A;color: #fff;padding:8px 15px;" |
| 249 | 249 | @click="bianji" |
| 250 | - >编辑</el-button | |
| 251 | - > | |
| 250 | + >编辑</el-button> --> | |
| 252 | 251 | |
| 253 | 252 | <el-button |
| 254 | 253 | style="background-color: #3F9B6A;color: #fff;padding:8px 15px;" |
| 255 | 254 | @click="msgeditS" |
| 255 | + v-if="!edit" | |
| 256 | 256 | >确定</el-button |
| 257 | 257 | > |
| 258 | 258 | </div> |
| ... | ... | @@ -301,7 +301,7 @@ |
| 301 | 301 | </el-select> |
| 302 | 302 | </el-form-item> |
| 303 | 303 | <el-form-item label="公告内容"> |
| 304 | - <div style="border: 1px solid #ccc"> | |
| 304 | + <div> | |
| 305 | 305 | <wang-editor v-model="ruleForm.announcementContent" ref="editor"></wang-editor> |
| 306 | 306 | |
| 307 | 307 | </div> | ... | ... |
lvdao-miniapp/main.js
| ... | ... | @@ -14,7 +14,8 @@ Vue.prototype.$imgUrl = (url) => { |
| 14 | 14 | } |
| 15 | 15 | // Vue.prototype.$upload = "https://zhld.028wlkj.com:49008/cdwlMall/admin-server/miniio/upload" |
| 16 | 16 | // Vue.prototype.$img = "https://zhld.028wlkj.com:49008/cdwlMall" |
| 17 | -Vue.prototype.$upload = 'http://172.16.61.125/miniio/upload' | |
| 17 | +// Vue.prototype.$upload = 'http://172.16.61.125/miniio/upload' | |
| 18 | +Vue.prototype.$upload = 'http://192.168.2.225:9003/miniio/upload' | |
| 18 | 19 | Vue.prototype.$img = 'http://172.16.61.125/cdwlMall' |
| 19 | 20 | // Vue.prototype.$upload = "https://jy.scjysm.asia:18086/admin-server/file/upload" |
| 20 | 21 | ... | ... |
lvdao-miniapp/pages.json
| ... | ... | @@ -382,7 +382,42 @@ |
| 382 | 382 | "navigationBarBackgroundColor": "#FFFFFF", |
| 383 | 383 | "navigationBarTitleText": "商家入驻" |
| 384 | 384 | } |
| 385 | + }, | |
| 386 | + { | |
| 387 | + "path": "moreZu/moreZu", | |
| 388 | + "style": { | |
| 389 | + "navigationBarBackgroundColor": "#FFFFFF", | |
| 390 | + "navigationBarTitleText": "租金方案" | |
| 385 | 391 | } |
| 392 | + }, | |
| 393 | + { | |
| 394 | + "path": "myZiyuan/myZiyuan", | |
| 395 | + "style": { | |
| 396 | + "navigationBarBackgroundColor": "#FFFFFF", | |
| 397 | + "navigationBarTitleText": "我租赁的资产" | |
| 398 | + } | |
| 399 | + }, | |
| 400 | + { | |
| 401 | + "path": "myZiyuan/myZiDetails", | |
| 402 | + "style": { | |
| 403 | + "navigationBarBackgroundColor": "#FFFFFF", | |
| 404 | + "navigationBarTitleText": "资产详情" | |
| 405 | + } | |
| 406 | + }, | |
| 407 | + { | |
| 408 | + "path": "myZiyuan/myZiyuanQuit", | |
| 409 | + "style": { | |
| 410 | + "navigationBarBackgroundColor": "#FFFFFF", | |
| 411 | + "navigationBarTitleText": "申请退租" | |
| 412 | + } | |
| 413 | + }, | |
| 414 | + { | |
| 415 | + "path": "myZiyuan/addMyshop", | |
| 416 | + "style": { | |
| 417 | + "navigationBarBackgroundColor": "#FFFFFF", | |
| 418 | + "navigationBarTitleText": "店铺信息" | |
| 419 | + } | |
| 420 | + } | |
| 386 | 421 | ] |
| 387 | 422 | }], |
| 388 | 423 | "globalStyle": { | ... | ... |
lvdao-miniapp/pages/accepting/accepting.vue
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <view class="record-list"> |
| 5 | 5 | <view class="good-item"> |
| 6 | 6 | <view class="img"> |
| 7 | - <u-image width="100%" height="100%" :src="record.cereBasicInformationShop&&record.cereBasicInformationShop.displayMainImage?record.cereBasicInformationShop.displayMainImage:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.displayImage?record.cereBasicInformationVenue.displayImage:record.cereAdvertisingInformation&&record.cereAdvertisingInformation.locationDiagram?record.cereAdvertisingInformation.locationDiagram:''"></u-image> | |
| 7 | + <u-image width="100%" height="100%" :src="record.cereBasicInformationShop&&record.cereBasicInformationShop.displayMainImage?$img + record.cereBasicInformationShop.displayMainImage:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.displayImage?$img + record.cereBasicInformationVenue.displayImage:record.cereAdvertisingInformation&&record.cereAdvertisingInformation.locationDiagram?$img + record.cereAdvertisingInformation.locationDiagram:''"></u-image> | |
| 8 | 8 | </view> |
| 9 | 9 | <view class="info"> |
| 10 | 10 | <view class="title">{{ |
| ... | ... | @@ -25,8 +25,7 @@ |
| 25 | 25 | }}</text> |
| 26 | 26 | </view> |
| 27 | 27 | <view class="info-item"> |
| 28 | - <text style="padding-right: 20rpx;" v-if="!record.advertisingSpaceType">租金:<span>¥1067/月</span></text> | |
| 29 | - <text style="padding-right: 20rpx;" v-if="record.advertisingSpaceType">租金:<span>¥1067/天</span></text> | |
| 28 | + <text style="padding-right: 20rpx;" >租金:<span>¥{{moban[0].rentalPrice}}/{{moban[0].leaseTerm}}</span></text> | |
| 30 | 29 | <text v-if="!record.advertisingSpaceType">面积:<span>81/m²</span></text> |
| 31 | 30 | </view> |
| 32 | 31 | </view> |
| ... | ... | @@ -40,7 +39,7 @@ |
| 40 | 39 | </view> |
| 41 | 40 | <view class="form-item"> |
| 42 | 41 | <view class="label">申请状态</view> |
| 43 | - <text>{{record.auditStatus == '1'?'待审核':record.auditStatus == '2'?'审核通过':record.auditStatus == '3'?'已驳回':''}}</text> | |
| 42 | + <text> {{record.auditStatus =='1'?'待审核':record.auditStatus =='2'?'待签约':record.auditStatus =='3'?'已驳回':record.auditStatus =='4'?'已签约':'已终止'}}</text> | |
| 44 | 43 | </view> |
| 45 | 44 | <view class="form-item" v-if="!record.advertisingSpaceType"> |
| 46 | 45 | <view class="label">经营用途</view> |
| ... | ... | @@ -64,63 +63,63 @@ |
| 64 | 63 | </view> |
| 65 | 64 | <view class="form-item" v-if="!record.advertisingSpaceType"> |
| 66 | 65 | <view class="label">经营主体</view> |
| 67 | - <text>{{record.operatingEntity}}</text> | |
| 66 | + <text>{{record.entityName}}</text> | |
| 68 | 67 | </view> |
| 69 | 68 | <!-- 广告显示 --> |
| 70 | 69 | <view class="form-item" label-top v-if="record.advertisingSpaceType"> |
| 71 | 70 | <view class="label">广告图片</view> |
| 72 | 71 | <view class="img"> |
| 73 | - <u-image width="304rpx" height="182rpx" :src="record.coverImage" ></u-image> | |
| 72 | + <u-image width="304rpx" height="182rpx" :src="$img + record.coverImage" ></u-image> | |
| 74 | 73 | </view> |
| 75 | 74 | </view> |
| 76 | 75 | </view> |
| 77 | 76 | <view class="msglist"> |
| 78 | 77 | <view class="form-item"> |
| 79 | 78 | <view class="label">经营者姓名</view> |
| 80 | - <text>{{record.operatorName||record.lesseeName}}</text> | |
| 79 | + <text>{{shopMsg.name}}</text> | |
| 81 | 80 | </view> |
| 82 | 81 | <view class="form-item"> |
| 83 | 82 | <view class="label">证件类型</view> |
| 84 | - <text>{{record.idCardType}}</text> | |
| 83 | + <text>{{shopMsg.idCardType}}</text> | |
| 85 | 84 | </view> |
| 86 | 85 | <view class="form-item"> |
| 87 | 86 | <view class="label">身份证号码</view> |
| 88 | - <text>{{record.idNumber || record.idCardNumber}}</text> | |
| 87 | + <text>{{shopMsg.idCardNumber}}</text> | |
| 89 | 88 | </view> |
| 90 | - <view class="form-item"> | |
| 89 | + <!-- <view class="form-item"> | |
| 91 | 90 | <view class="label">身份证有效期</view> |
| 92 | 91 | <text>{{record.idValidStart || record.idCardValidStart}}至 {{record.idValidEnd || record.idCardValidEnd}}</text> |
| 93 | - </view> | |
| 92 | + </view> --> | |
| 94 | 93 | <view class="form-item" label-top> |
| 95 | 94 | <view class="label">身份证照片</view> |
| 96 | 95 | <view class="deom-box"> |
| 97 | 96 | <view class="img-deom"> |
| 98 | - <u-image width="304rpx" height="182rpx" :src="record.idPhotoFront || record.idCardPhotoFront"></u-image> | |
| 97 | + <u-image width="304rpx" height="182rpx" :src="$img+shopMsg.idCardFrontImage"></u-image> | |
| 99 | 98 | </view> |
| 100 | 99 | <view class="img-deom"> |
| 101 | - <u-image width="304rpx" height="182rpx" :src="record.idPhotoBack || record.idCardPhotoBack"></u-image> | |
| 100 | + <u-image width="304rpx" height="182rpx" :src="$img+shopMsg.idCardBackImage"></u-image> | |
| 102 | 101 | </view> |
| 103 | 102 | </view> |
| 104 | 103 | </view> |
| 105 | - <view class="form-item" label-top> | |
| 104 | + <!-- <view class="form-item" label-top> | |
| 106 | 105 | <view class="label">企业授权书</view> |
| 107 | 106 | <view class="img"> |
| 108 | 107 | <u-image width="304rpx" height="182rpx" :src="record.enterpriseAuthorization" ></u-image> |
| 109 | 108 | </view> |
| 110 | - </view> | |
| 109 | + </view> --> | |
| 111 | 110 | </view> |
| 112 | - <view style="height: 180rpx;" v-if="record.auditStatus == '2'"></view> | |
| 113 | - <view class="footbtn" v-if="record.auditStatus == '2'"> | |
| 111 | + | |
| 112 | + <!-- <view class="footbtn" v-if="record.auditStatus == '2'"> | |
| 114 | 113 | <view class="info-total"> |
| 115 | 114 | <view >租期:<span v-if="!record.advertisingSpaceType">2年</span> <span v-if="record.advertisingSpaceType">2/天</span></view> |
| 116 | 115 | <view >租金:<span v-if="!record.advertisingSpaceType">1067/月</span> <span v-if="record.advertisingSpaceType">150/天</span></view> |
| 117 | 116 | <view>合计:<span>元</span></view> |
| 118 | 117 | </view> |
| 119 | 118 | <view class="footer-btn"> |
| 120 | - <!-- <u-button type="primary" shape="circle">查看合同</u-button> --> | |
| 119 | + <u-button type="primary" shape="circle">查看合同</u-button> | |
| 121 | 120 | <u-button type="success" shape="circle" @click="Zhicheck()">立即支付</u-button> |
| 122 | 121 | </view> |
| 123 | - </view> | |
| 122 | + </view> --> | |
| 124 | 123 | </view> |
| 125 | 124 | </template> |
| 126 | 125 | |
| ... | ... | @@ -129,13 +128,39 @@ |
| 129 | 128 | data() { |
| 130 | 129 | return { |
| 131 | 130 | record:{}, |
| 132 | - | |
| 131 | + shopMsg:{}, | |
| 132 | + moban:[] | |
| 133 | 133 | } |
| 134 | 134 | }, |
| 135 | 135 | onLoad(options) { |
| 136 | 136 | const item = JSON.parse(decodeURIComponent(options.item)); |
| 137 | 137 | console.log('Received item:', item); |
| 138 | 138 | this.record = item |
| 139 | + let objst = { | |
| 140 | + pageNumber: 0, | |
| 141 | + pageSize: 10, | |
| 142 | + checkState: "2", | |
| 143 | + phone:item.applicant | |
| 144 | + } | |
| 145 | + let paesize = { | |
| 146 | + pageNumber: 0, | |
| 147 | + pageSize: 10, | |
| 148 | + resourcesId: '' | |
| 149 | + } | |
| 150 | + if(item.cereAdvertisingInformation.id){ | |
| 151 | + paesize.resourcesId = `gg${item.cereAdvertisingInformation.id}` | |
| 152 | + }else if(item.cereBasicInformationShop.id){ | |
| 153 | + paesize.resourcesId = `sp${item.cereBasicInformationShop.id}` | |
| 154 | + }else{ | |
| 155 | + paesize.resourcesId = `cd${item.cereBasicInformationVenue.id}` | |
| 156 | + } | |
| 157 | + this.$http.sendRequest('/cerePlatformMerchant/queryByPage', 'POST', objst,1).then(res => { | |
| 158 | + this.shopMsg = res.data.data.content[0] | |
| 159 | + | |
| 160 | + }) | |
| 161 | + this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', paesize,1).then(res => { | |
| 162 | + this.moban = res.data.data | |
| 163 | + }) | |
| 139 | 164 | }, |
| 140 | 165 | methods: { |
| 141 | 166 | Zhicheck(){ | ... | ... |
lvdao-miniapp/pages/advertisement/advertisement.vue
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | <view class="goods-list"> |
| 29 | 29 | <view class="list" v-for="(item,index) in tableData" :key="index" @click="toDetail(item)"> |
| 30 | 30 | <view class="thumb"> |
| 31 | - <u-image width="20vw" height="20vw" :src="item.locationDiagram"></u-image> | |
| 31 | + <u-image width="20vw" height="20vw" border-radius="20" :src="$img + item.locationDiagram"></u-image> | |
| 32 | 32 | <!-- <image :src="item.locationDiagram" mode="widthFix"></image> --> |
| 33 | 33 | </view> |
| 34 | 34 | <view class="item"> |
| ... | ... | @@ -37,14 +37,19 @@ |
| 37 | 37 | </view> |
| 38 | 38 | <view> |
| 39 | 39 | <view class="goods-list-text"> |
| 40 | + <view class="goods-list-txt">广告位类型:{{item.advertisingType}}</view> | |
| 41 | + <view class="goods-list-txt">广告尺寸:{{item.dimensions}}</view> | |
| 42 | + </view> | |
| 43 | + <view class="goods-list-text" v-if="item.advertisingType == '线上广告位'"> | |
| 40 | 44 | <view class="goods-list-txt">轮播顺序:<text>{{item.rotationOrder}}</text></view> |
| 41 | 45 | <view class="goods-list-txt">所属移动端:<text>{{item.affiliation}}</text></view> |
| 42 | 46 | </view> |
| 43 | - <view class="goods-list-text"> | |
| 44 | - <view class="goods-list-txt">投放定价:<text>100元/天</text></view> | |
| 45 | - <view class="goods-list-txt">单次可租赁时间:<text>1天</text></view> | |
| 47 | + <view class="goods-list-text" v-if="item.advertisingType == '实体广告位'"> | |
| 48 | + <view class="goods-list-txt">位置信息:<text>{{item.detailedLocation}}</text></view> | |
| 49 | + <view class="goods-list-txt">广告材质:<text>{{item.advertisingMaterial}}</text></view> | |
| 46 | 50 | </view> |
| 47 | 51 | </view> |
| 52 | + | |
| 48 | 53 | </view> |
| 49 | 54 | </view> |
| 50 | 55 | </view> |
| ... | ... | @@ -60,11 +65,12 @@ |
| 60 | 65 | query: { |
| 61 | 66 | advertisingName: '', |
| 62 | 67 | advertisingType: '', |
| 68 | + publishStatus:2 | |
| 63 | 69 | }, |
| 64 | 70 | pageindex: { |
| 65 | - pageNumber: 1, | |
| 71 | + pageNumber: 0, | |
| 66 | 72 | pageSize: 10, |
| 67 | - publishStatus:'1' | |
| 73 | + publishStatus:2 | |
| 68 | 74 | }, |
| 69 | 75 | typeshow: false, |
| 70 | 76 | typeList: [ |
| ... | ... | @@ -80,7 +86,7 @@ |
| 80 | 86 | }, |
| 81 | 87 | { |
| 82 | 88 | value: '2', |
| 83 | - label: '线下广告位' | |
| 89 | + label: '实体广告位' | |
| 84 | 90 | } |
| 85 | 91 | ] |
| 86 | 92 | }; |
| ... | ... | @@ -99,6 +105,18 @@ |
| 99 | 105 | console.log(err) |
| 100 | 106 | //请求失败 |
| 101 | 107 | }) |
| 108 | + // let pages ={ | |
| 109 | + // pageNumber:0, | |
| 110 | + // pageSize:10, | |
| 111 | + // resourcesId:`gg${}` | |
| 112 | + // } | |
| 113 | + // this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', pages, 1).then(res => { | |
| 114 | + // //成功回调 | |
| 115 | + // this.tableData = res.data.data.content; | |
| 116 | + // }).catch(err => { | |
| 117 | + // console.log(err) | |
| 118 | + // //请求失败 | |
| 119 | + // }) | |
| 102 | 120 | }, |
| 103 | 121 | search() { |
| 104 | 122 | this.pageindex = { | ... | ... |
lvdao-miniapp/pages/advertisementAdd/advertisementAdd.vue
| ... | ... | @@ -5,31 +5,39 @@ |
| 5 | 5 | </view> |
| 6 | 6 | <view> |
| 7 | 7 | <view v-show="active == 0"> |
| 8 | + <view style="padding:15px;margin-top:10px;"> | |
| 9 | + <wu-calendar :insert="true" @change="calendarChange" slideSwitchMode="horizontal" mode="range" :selected="selected" color="#3f9b6a" style="border-radius: 10px;"></wu-calendar> | |
| 10 | + </view> | |
| 11 | + | |
| 8 | 12 | <u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250"> |
| 9 | 13 | <view class="add-list"> |
| 10 | - <u-form-item label="投放时段" prop="scheduleTime" borderBottom> | |
| 11 | - <!-- <u-input v-model="model1.name" type="select" @click="toChangeTime"></u-input> --> | |
| 12 | - <u-input v-model="model1.scheduleTime" type="select" @click="TimeStratshow = true" | |
| 13 | - placeholder="请选择" /> | |
| 14 | - <u-picker mode="time" v-model="TimeStratshow" :params="params" | |
| 15 | - @confirm="startTimeChange"></u-picker> | |
| 14 | + <u-form-item label="*投放时段" prop="scheduleTime" borderBottom> | |
| 15 | + <u-input v-model="model1.scheduleTime" type="select" placeholder="请选择上面时间" ></u-input> | |
| 16 | + <!-- <u-input v-model="model1.scheduleTime" type="select" @click="TimeStratshow = true" | |
| 17 | + placeholder="请选择" /> --> | |
| 18 | + <!-- <u-picker mode="time" v-model="TimeStratshow" :params="params" | |
| 19 | + @confirm="startTimeChange"></u-picker> --> | |
| 16 | 20 | </u-form-item> |
| 17 | 21 | </view> |
| 18 | 22 | <view class="add-list"> |
| 19 | - <u-form-item label="跳转类型" prop="advertisementContent" borderBottom> | |
| 23 | + <u-form-item label="*跳转类型" prop="advertisementContent" borderBottom> | |
| 20 | 24 | <u-input v-model="model1.advertisementContent"></u-input> |
| 21 | 25 | </u-form-item> |
| 22 | - <u-form-item label="链接" prop="redirectUrl" borderBottom> | |
| 26 | + <u-form-item label="*链接" prop="redirectUrl" borderBottom> | |
| 23 | 27 | <u-input v-model="model1.redirectUrl"></u-input> |
| 24 | 28 | </u-form-item> |
| 25 | 29 | </view> |
| 26 | 30 | <view class="add-list"> |
| 27 | - <u-form-item label="封面图片" prop="coverImage" borderBottom labelPosition="top"> | |
| 28 | - <u-upload :action="$upload" :auto-upload="true" ref="coverImage" :max-count="1"></u-upload> | |
| 31 | + <u-form-item label="*封面图片" prop="coverImage" borderBottom labelPosition="top"> | |
| 32 | + <u-upload :action="$upload" :auto-upload="false" ref="coverImage" :max-count="1" | |
| 33 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'coverImage')"></u-upload> | |
| 29 | 34 | </u-form-item> |
| 35 | + <!-- <u-form-item label="封面图片" prop="coverImage" borderBottom labelPosition="top"> | |
| 36 | + <u-upload :action="$upload" :auto-upload="true" ref="coverImage" :max-count="1"></u-upload> | |
| 37 | + </u-form-item> --> | |
| 30 | 38 | </view> |
| 31 | 39 | <view class="add-list"> |
| 32 | - <u-form-item label="广告标题" prop="adTitle" borderBottom labelPosition="top"> | |
| 40 | + <u-form-item label="*广告标题" prop="adTitle" borderBottom labelPosition="top"> | |
| 33 | 41 | <u-input v-model="model1.adTitle" /> |
| 34 | 42 | </u-form-item> |
| 35 | 43 | </view> |
| ... | ... | @@ -42,47 +50,53 @@ |
| 42 | 50 | |
| 43 | 51 | <view class="add-list" v-show='active == 1'> |
| 44 | 52 | <u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250"> |
| 45 | - <u-form-item label="主体名称" prop="subjectName" borderBottom> | |
| 53 | + <u-form-item label="*主体名称" prop="subjectName" borderBottom> | |
| 46 | 54 | <u-input v-model="model1.subjectName"></u-input> |
| 47 | 55 | </u-form-item> |
| 48 | - <u-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode" borderBottom> | |
| 56 | + <u-form-item label="*统一社会信用代码" prop="unifiedSocialCreditCode" borderBottom> | |
| 49 | 57 | <u-input v-model="model1.unifiedSocialCreditCode"></u-input> |
| 50 | 58 | </u-form-item> |
| 51 | - <u-form-item label="类型" prop="type" borderBottom> | |
| 59 | + <u-form-item label="*类型" prop="type" borderBottom> | |
| 52 | 60 | <u-input v-model="model1.type" type="select" @click="typeShow = true" placeholder='请选择类型' /> |
| 53 | 61 | </u-form-item> |
| 54 | - <u-form-item label="法定代表人" prop="legalRepresentative" borderBottom> | |
| 62 | + <u-form-item label="*法定代表人" prop="legalRepresentative" borderBottom> | |
| 55 | 63 | <u-input v-model="model1.legalRepresentative"></u-input> |
| 56 | 64 | </u-form-item> |
| 57 | - <u-form-item label="经营范围" prop="businessScope" borderBottom> | |
| 65 | + <u-form-item label="*经营范围" prop="businessScope" borderBottom> | |
| 58 | 66 | <u-input v-model="model1.businessScope"></u-input> |
| 59 | 67 | </u-form-item> |
| 60 | - <u-form-item label="注册资本" prop="registeredCapital" borderBottom> | |
| 68 | + <u-form-item label="*注册资本" prop="registeredCapital" borderBottom> | |
| 61 | 69 | <u-input v-model="model1.registeredCapital"></u-input> |
| 62 | 70 | </u-form-item> |
| 63 | - <u-form-item label="成立日期" prop="establishmentDate" borderBottom> | |
| 64 | - <u-input v-model="model1.establishmentDate"></u-input> | |
| 71 | + <u-form-item label="*成立日期" prop="establishmentDate" borderBottom> | |
| 72 | + <!-- <u-input v-model="model1.establishmentDate"></u-input> --> | |
| 73 | + <u-input v-model="model1.establishmentDate" type="select" @click="establishow = true" | |
| 74 | + placeholder="请选择" /> | |
| 75 | + <u-picker mode="time" v-model="establishow" :params="params" | |
| 76 | + @confirm="establiChange"></u-picker> | |
| 65 | 77 | </u-form-item> |
| 66 | - <u-form-item label="住所" prop="address" borderBottom> | |
| 78 | + <u-form-item label="*住所" prop="address" borderBottom> | |
| 67 | 79 | <u-input v-model="model1.address"></u-input> |
| 68 | 80 | </u-form-item> |
| 69 | - <u-form-item label="邮箱地址" prop="emailAddress" borderBottom> | |
| 81 | + <u-form-item label="*邮箱地址" prop="emailAddress" borderBottom> | |
| 70 | 82 | <u-input v-model="model1.emailAddress"></u-input> |
| 71 | 83 | </u-form-item> |
| 72 | - <u-form-item label="经营开始时间" prop="businessStartDate" borderBottom> | |
| 84 | + <u-form-item label="*经营开始时间" prop="businessStartDate" borderBottom> | |
| 73 | 85 | <u-input v-model="model1.businessStartDate" type="select" @click="busStartshow = true" |
| 74 | 86 | placeholder="请选择" /> |
| 75 | 87 | <u-picker mode="time" v-model="busStartshow" :params="params" |
| 76 | 88 | @confirm="busStTimeChange"></u-picker> |
| 77 | 89 | </u-form-item> |
| 78 | - <u-form-item label="经营结束时间" prop="businessEndDate" borderBottom> | |
| 90 | + <u-form-item label="*经营结束时间" prop="businessEndDate" borderBottom> | |
| 79 | 91 | <u-input v-model="model1.businessEndDate" type="select" @click="busEndtshow = true" |
| 80 | 92 | placeholder="请选择" /> |
| 81 | 93 | <u-picker mode="time" v-model="busEndtshow" :params="params" |
| 82 | 94 | @confirm="busEndTimeChange"></u-picker> |
| 83 | 95 | </u-form-item> |
| 84 | - <u-form-item label="营业执照" prop="businessLicense" borderBottom labelPosition="top"> | |
| 85 | - <u-upload :action="$upload" :auto-upload="true" ref="businessLicense" :max-count="1"></u-upload> | |
| 96 | + <u-form-item label="*营业执照" prop="businessLicense" borderBottom labelPosition="top"> | |
| 97 | + <u-upload :action="$upload" :auto-upload="false" ref="businessLicense" :max-count="1" | |
| 98 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'businessLicense')"></u-upload> | |
| 99 | + <!-- <u-upload :action="$upload" :auto-upload="true" ref="businessLicense" :max-count="1"></u-upload> --> | |
| 86 | 100 | </u-form-item> |
| 87 | 101 | </u-form> |
| 88 | 102 | </view> |
| ... | ... | @@ -91,23 +105,23 @@ |
| 91 | 105 | <view v-show="active == 2"> |
| 92 | 106 | <u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250"> |
| 93 | 107 | <view class="add-list"> |
| 94 | - <u-form-item label="经营者姓名" prop="lesseeName" borderBottom> | |
| 108 | + <u-form-item label="*经营者姓名" prop="lesseeName" borderBottom> | |
| 95 | 109 | <u-input v-model="model1.lesseeName"></u-input> |
| 96 | 110 | </u-form-item> |
| 97 | - <u-form-item label="证件类型" prop="idCardType" borderBottom> | |
| 111 | + <u-form-item label="*证件类型" prop="idCardType" borderBottom> | |
| 98 | 112 | <u-input v-model="model1.idCardType" type="select" @click="IdtypeShow = true" |
| 99 | 113 | placeholder='请选择类型' /> |
| 100 | 114 | </u-form-item> |
| 101 | - <u-form-item label="身份证号码" prop="idCardNumber" borderBottom> | |
| 115 | + <u-form-item label="*身份证号码" prop="idCardNumber" borderBottom> | |
| 102 | 116 | <u-input v-model="model1.idCardNumber"></u-input> |
| 103 | 117 | </u-form-item> |
| 104 | - <u-form-item label="身份证有效开始时间" prop="idCardValidStart" borderBottom> | |
| 118 | + <u-form-item label="*身份证有效开始时间" prop="idCardValidStart" borderBottom> | |
| 105 | 119 | <u-input v-model="model1.idCardValidStart" type="select" @click="idCardStartshow = true" |
| 106 | 120 | placeholder="请选择" /> |
| 107 | 121 | <u-picker mode="time" v-model="idCardStartshow" :params="params1" |
| 108 | 122 | @confirm="idCardStTimeChange"></u-picker> |
| 109 | 123 | </u-form-item> |
| 110 | - <u-form-item label="身份证有效结束时间" prop="idCardValidEnd" borderBottom> | |
| 124 | + <u-form-item label="*身份证有效结束时间" prop="idCardValidEnd" borderBottom> | |
| 111 | 125 | <u-input v-model="model1.idCardValidEnd" type="select" @click="idCardEndtshow = true" |
| 112 | 126 | placeholder="请选择" /> |
| 113 | 127 | <u-picker mode="time" v-model="idCardEndtshow" :params="params1" |
| ... | ... | @@ -117,7 +131,10 @@ |
| 117 | 131 | <view class="add-list"> |
| 118 | 132 | <view class="deom-box"> |
| 119 | 133 | <view class="img-deom"> |
| 120 | - <u-upload :action="$upload" :custom-btn="true" :max-count="1" ref="idCardPhotoFront"> | |
| 134 | + | |
| 135 | + <u-upload :action="$upload" :custom-btn="true" | |
| 136 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'idCardPhotoFront')" | |
| 137 | + :auto-upload="false" :max-count="1" ref="idCardPhotoFront"> | |
| 121 | 138 | <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" |
| 122 | 139 | hover-stay-time="150"> |
| 123 | 140 | <u-image width="304rpx" height="182rpx" |
| ... | ... | @@ -127,7 +144,10 @@ |
| 127 | 144 | <text>点击上传证件人像面</text> |
| 128 | 145 | </view> |
| 129 | 146 | <view class="img-deom"> |
| 130 | - <u-upload :action="$upload" :custom-btn="true" :max-count="1" ref="idCardPhotoBack"> | |
| 147 | + | |
| 148 | + <u-upload :action="$upload" :custom-btn="true" | |
| 149 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'idCardPhotoBack')" | |
| 150 | + :auto-upload="false" :max-count="1" ref="idCardPhotoBack"> | |
| 131 | 151 | <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" |
| 132 | 152 | hover-stay-time="150"> |
| 133 | 153 | <u-image width="304rpx" height="182rpx" |
| ... | ... | @@ -137,7 +157,7 @@ |
| 137 | 157 | <text>点击上传证件国徽面</text> |
| 138 | 158 | </view> |
| 139 | 159 | </view> |
| 140 | - </view> | |
| 160 | + </view> | |
| 141 | 161 | <view class="add-list"> |
| 142 | 162 | <view style="line-height: 60rpx;">上传示例</view> |
| 143 | 163 | <view class="deom-box"> |
| ... | ... | @@ -155,13 +175,13 @@ |
| 155 | 175 | style="display: inline-block; font-size: 24rpx; line-height: 30px; margin: 24rpx 30rpx 0;">请拍摄证件原件,保证照片拍摄清晰,取图完整,不反光。</text> |
| 156 | 176 | <view class="add-list" labelPosition="left" :model="model1" :rules="rules" ref="uForm" |
| 157 | 177 | :labelWidth="250"> |
| 158 | - <u-form-item label="是否为法人" prop="isLegalPerson" borderBottom> | |
| 178 | + <u-form-item label="*是否为法人" prop="isLegalPerson" borderBottom> | |
| 159 | 179 | <u-radio-group v-model="model1.isLegalPerson"> |
| 160 | 180 | <u-radio name="1" value="1">是</u-radio> |
| 161 | 181 | <u-radio name="0" value="0">否</u-radio> |
| 162 | 182 | </u-radio-group> |
| 163 | 183 | </u-form-item> |
| 164 | - <u-form-item label="企业授权书" prop="enterpriseAuthorization" borderBottom labelPosition="top"> | |
| 184 | + <u-form-item label="*企业授权书" prop="enterpriseAuthorization" borderBottom labelPosition="top"> | |
| 165 | 185 | |
| 166 | 186 | <u-upload :action="$upload" :auto-upload="true" ref="enter" :max-count="1"></u-upload> |
| 167 | 187 | </u-form-item> |
| ... | ... | @@ -176,23 +196,29 @@ |
| 176 | 196 | <view class="page-footer"> |
| 177 | 197 | <u-button style="background-color: #DFE0E4; flex: 1; margin: 0 10px;" @click="toBefor" |
| 178 | 198 | v-if="active != 0">上一步</u-button> |
| 179 | - <u-button type="success" style="flex: 1; margin: 0 10px;" @click="toNext" v-if="active != 2">下一步</u-button> | |
| 180 | - <u-button type="success" style="flex: 1; margin: 0 10px;" @click="go" v-if="active == 2">提交申请</u-button> | |
| 199 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="toNext" v-if="active != 1">下一步</u-button> | |
| 200 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="go" v-if="active == 1">提交申请</u-button> | |
| 181 | 201 | </view> |
| 182 | 202 | </view> |
| 183 | 203 | </template> |
| 184 | 204 | |
| 185 | 205 | <script> |
| 206 | + | |
| 186 | 207 | export default { |
| 187 | 208 | data() { |
| 188 | 209 | return { |
| 189 | 210 | active: 0, |
| 211 | + // numList: [{ | |
| 212 | + // name: '租赁信息' | |
| 213 | + // }, { | |
| 214 | + // name: '主体信息' | |
| 215 | + // }, { | |
| 216 | + // name: '经营者信息' | |
| 217 | + // }], | |
| 190 | 218 | numList: [{ |
| 191 | 219 | name: '租赁信息' |
| 192 | 220 | }, { |
| 193 | - name: '主体信息' | |
| 194 | - }, { | |
| 195 | - name: '经营者信息' | |
| 221 | + name: '营业执照信息' | |
| 196 | 222 | }], |
| 197 | 223 | model1: { |
| 198 | 224 | scheduleTime: '', |
| ... | ... | @@ -264,48 +290,117 @@ |
| 264 | 290 | }, |
| 265 | 291 | ziyuanId: '', |
| 266 | 292 | ziyuanType:'', |
| 267 | - | |
| 293 | + selected: [ | |
| 294 | + { | |
| 295 | + date: '2025-01-08', | |
| 296 | + info: '¥850', | |
| 297 | + infoColor: '#3f9b6a', | |
| 298 | + disable: true // 禁用 | |
| 299 | + }, | |
| 300 | + { | |
| 301 | + date: '2025-01-11', | |
| 302 | + info: '¥950', | |
| 303 | + infoColor: '#3f9b6a', | |
| 304 | + }, | |
| 305 | + { | |
| 306 | + date: '2025-01-14', | |
| 307 | + info: '¥900', | |
| 308 | + infoColor: '#6ac695', | |
| 309 | + }, | |
| 310 | + ], | |
| 311 | + establishow:false | |
| 312 | + | |
| 268 | 313 | } |
| 269 | 314 | }, |
| 270 | 315 | onLoad(option) { |
| 271 | 316 | this.ziyuanId = option.ids |
| 272 | 317 | this.ziyuanType = option.type |
| 318 | + this.showlendar = true | |
| 273 | 319 | }, |
| 274 | - onShow() { | |
| 275 | - let shopId = { | |
| 276 | - shopId:uni.getStorageSync('shopId') || '' | |
| 277 | - } | |
| 278 | - const isLogin = uni.getStorageSync('token'); | |
| 279 | - if (isLogin =='') { | |
| 280 | - // 如果未登录,跳转到登录页面 | |
| 281 | - uni.navigateTo({ | |
| 282 | - url: '/pages/login/login' | |
| 283 | - }) | |
| 284 | - }else{ | |
| 285 | - let page={ | |
| 286 | - condition:2 | |
| 287 | - } | |
| 288 | - this.$http.sendRequest('/shop/getById', 'POST',shopId).then(res => { | |
| 289 | - if(res.data.code !="20004"){ | |
| 290 | - this.shopMsg = res.data.data | |
| 291 | - this.Islogin= false | |
| 292 | - this.$http.sendRequest('/index/index', 'POST',page).then(res => { | |
| 293 | - //成功回调 | |
| 294 | - this.tongji = res.data.data | |
| 295 | - }) | |
| 296 | - }else{ | |
| 297 | - uni.navigateTo({ | |
| 298 | - url: '/pages/login/login' | |
| 299 | - }) | |
| 300 | - } | |
| 301 | - }) | |
| 302 | - } | |
| 320 | + onReady() { | |
| 303 | 321 | |
| 322 | + }, | |
| 323 | + onShow() { | |
| 324 | + let shopId = { | |
| 325 | + shopId: uni.getStorageSync('shopId') || '' | |
| 326 | + } | |
| 327 | + const isLogin = uni.getStorageSync('token'); | |
| 328 | + if (isLogin == '') { | |
| 329 | + // 如果未登录,跳转到登录页面 | |
| 330 | + uni.navigateTo({ | |
| 331 | + url: '/pages/login/login' | |
| 332 | + }) | |
| 333 | + } else { | |
| 334 | + let page = { | |
| 335 | + condition: 2 | |
| 336 | + } | |
| 337 | + this.$http.sendRequest('/shop/getById', 'POST', shopId).then(res => { | |
| 338 | + if (res.data.code != "20004") { | |
| 339 | + this.shopMsg = res.data.data | |
| 340 | + this.Islogin = false | |
| 341 | + this.$http.sendRequest('/index/index', 'POST', page).then(res => { | |
| 342 | + //成功回调 | |
| 343 | + this.tongji = res.data.data | |
| 344 | + }) | |
| 345 | + } else { | |
| 346 | + uni.navigateTo({ | |
| 347 | + url: '/pages/login/login' | |
| 348 | + }) | |
| 349 | + } | |
| 350 | + }) | |
| 351 | + } | |
| 352 | + | |
| 304 | 353 | }, |
| 305 | 354 | methods: { |
| 355 | + generateDateRange(datas) { | |
| 356 | + const result = []; | |
| 357 | + const startDate = new Date(datas[0]) | |
| 358 | + const endDate = new Date(datas[1]) | |
| 359 | + if (startDate > endDate) { | |
| 360 | + [startDate, endDate] = [endDate, startDate] | |
| 361 | + } | |
| 362 | + let currentDate = new Date(startDate); | |
| 363 | + while (currentDate <= endDate) { | |
| 364 | + const year = currentDate.getFullYear(); | |
| 365 | + const month = String(currentDate.getMonth() + 1).padStart(1, '0'); | |
| 366 | + const day = String(currentDate.getDate()).padStart(1, '0'); | |
| 367 | + const dateString = `${year}-${month}-${day}`; | |
| 368 | + result.push({ | |
| 369 | + date: dateString, | |
| 370 | + info: '¥850', | |
| 371 | + disable: true | |
| 372 | + }); | |
| 373 | + currentDate.setDate(currentDate.getDate() + 1); | |
| 374 | + } | |
| 375 | + return result; | |
| 376 | + }, | |
| 377 | + calendarChange(e){ | |
| 378 | + if(e.range.after == ''){ | |
| 379 | + uni.showToast({ | |
| 380 | + icon: 'none', | |
| 381 | + title: '请选择结束时间' | |
| 382 | + }) | |
| 383 | + return | |
| 384 | + } | |
| 385 | + this.model1.scheduleTime = e.range.after+'至'+e.range.before | |
| 386 | + }, | |
| 306 | 387 | typeChange(e) { |
| 307 | 388 | this.model1.type = e[0].label; |
| 308 | 389 | }, |
| 390 | + establiChange(val){ | |
| 391 | + this.model1.establishmentDate = this.timeChange(val) | |
| 392 | + }, | |
| 393 | + formatter(day) { | |
| 394 | + const d = new Date() | |
| 395 | + let month = d.getMonth() + 1 | |
| 396 | + const date = d.getDate() | |
| 397 | + if(day.month == month && day.day == date + 3) | |
| 398 | + { | |
| 399 | + day.bottomInfo = '有优惠' | |
| 400 | + day.dot = true | |
| 401 | + } | |
| 402 | + return day | |
| 403 | + }, | |
| 309 | 404 | getCurrentTime() { |
| 310 | 405 | const now = new Date(); |
| 311 | 406 | const year = now.getFullYear(); |
| ... | ... | @@ -318,52 +413,31 @@ |
| 318 | 413 | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| 319 | 414 | }, |
| 320 | 415 | go() { |
| 321 | - let coverImg = [] | |
| 322 | - let files = [] | |
| 323 | - let idCardOne = [] | |
| 324 | - let idCardTwo = [] | |
| 325 | - let enterS = [] | |
| 326 | - // // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作) | |
| 327 | - coverImg = this.$refs.coverImage.lists.filter(val => { | |
| 328 | - return val.progress == 100; | |
| 329 | - }) | |
| 330 | - coverImg.map(item => { | |
| 331 | - this.model1.coverImage = item.response.data.url | |
| 332 | - }) | |
| 333 | - files = this.$refs.businessLicense.lists.filter(val => { | |
| 334 | - return val.progress == 100; | |
| 335 | - }) | |
| 336 | - | |
| 337 | - files.map(item => { | |
| 338 | - this.model1.businessLicense = item.response.data.url | |
| 339 | - }) | |
| 340 | - idCardOne = this.$refs.idCardPhotoFront.lists.filter(val => { | |
| 341 | - return val.progress == 100; | |
| 342 | - }) | |
| 343 | - idCardOne.map(item => { | |
| 344 | - this.model1.idCardPhotoFront = item.response.data.url | |
| 345 | - | |
| 346 | - }) | |
| 347 | - idCardTwo = this.$refs.idCardPhotoBack.lists.filter(val => { | |
| 348 | - return val.progress == 100; | |
| 349 | - }) | |
| 350 | - idCardTwo.map(item => { | |
| 351 | - this.model1.idCardPhotoBack = item.response.data.url | |
| 352 | - }) | |
| 353 | - enterS = this.$refs.enter.lists.filter(val => { | |
| 354 | - return val.progress == 100; | |
| 355 | - }) | |
| 356 | - enterS.map(item => { | |
| 357 | - this.model1.enterpriseAuthorization = item.response.data.url | |
| 358 | - }) | |
| 416 | + | |
| 417 | + let show = this.chek() | |
| 418 | + if(show == false){ | |
| 419 | + return | |
| 420 | + } | |
| 359 | 421 | this.model1.rentalResourcesId = this.ziyuanId |
| 360 | 422 | this.model1.advertisingSpaceType = this.ziyuanType |
| 361 | - this.model1.applicant = uni.getStorageSync('shopId') | |
| 423 | + this.model1.applicant =uni.getStorageSync('user').phone | |
| 362 | 424 | this.model1.applicationTime = this.getCurrentTime() |
| 363 | - this.$http.sendRequest('/cereAdvertiserInfo/add', 'POST', this.model1, 1).then(res => { | |
| 364 | - uni.navigateTo({ | |
| 365 | - url: '/pages/record/record' | |
| 366 | - }) | |
| 425 | + let info = { | |
| 426 | + ...this.model1, | |
| 427 | + coverImage : this.model1.coverImage.replace(this.$img,''), | |
| 428 | + businessLicense:this.model1.businessLicense.replace(this.$img,''), | |
| 429 | + // idPhotoFront:this.model1.idPhotoFront.replace(this.$img,''), | |
| 430 | + // idPhotoBack:this.model1.idPhotoBack.replace(this.$img,''), | |
| 431 | + // enterpriseAuthorization:this.model1.enterpriseAuthorization.replace(this.$img,''), | |
| 432 | + } | |
| 433 | + this.$http.sendRequest('/cereAdvertiserInfo/add', 'POST', info, 1).then(res => { | |
| 434 | + uni.showToast({ | |
| 435 | + title: '提交成功', | |
| 436 | + icon: 'none', | |
| 437 | + }); | |
| 438 | + setTimeout(() => { | |
| 439 | + uni.navigateBack() | |
| 440 | + }, 1000) | |
| 367 | 441 | }) |
| 368 | 442 | }, |
| 369 | 443 | // toChangeTime(val) { |
| ... | ... | @@ -377,8 +451,136 @@ |
| 377 | 451 | }, |
| 378 | 452 | // 下一步 |
| 379 | 453 | toNext() { |
| 454 | + if(this.active == '0') { | |
| 455 | + if (!this.model1.scheduleTime) { | |
| 456 | + uni.showToast({ | |
| 457 | + icon: 'none', | |
| 458 | + title: '请选择投放时段' | |
| 459 | + }); | |
| 460 | + return; | |
| 461 | + } | |
| 462 | + | |
| 463 | + if (!this.model1.advertisementContent) { | |
| 464 | + uni.showToast({ | |
| 465 | + icon: 'none', | |
| 466 | + title: '跳转类型' | |
| 467 | + }); | |
| 468 | + return; | |
| 469 | + } | |
| 470 | + if (!this.model1.redirectUrl) { | |
| 471 | + uni.showToast({ | |
| 472 | + icon: 'none', | |
| 473 | + title: '请输入跳转链接' | |
| 474 | + }); | |
| 475 | + return; | |
| 476 | + } | |
| 477 | + if (!this.model1.coverImage) { | |
| 478 | + uni.showToast({ | |
| 479 | + icon: 'none', | |
| 480 | + title: '请选择封面图片' | |
| 481 | + }); | |
| 482 | + return; | |
| 483 | + } | |
| 484 | + if (!this.model1.adTitle) { | |
| 485 | + uni.showToast({ | |
| 486 | + icon: 'none', | |
| 487 | + title: '请输入广告标题' | |
| 488 | + }); | |
| 489 | + return; | |
| 490 | + } | |
| 491 | + } | |
| 492 | + | |
| 380 | 493 | this.active = +this.active + 1; |
| 381 | 494 | }, |
| 495 | + chek() { | |
| 496 | + | |
| 497 | + | |
| 498 | + if (!this.model1.subjectName) { | |
| 499 | + uni.showToast({ | |
| 500 | + icon: 'none', | |
| 501 | + title: '请输入主体名称' | |
| 502 | + }); | |
| 503 | + return false; | |
| 504 | + } | |
| 505 | + if (!this.model1.unifiedSocialCreditCode) { | |
| 506 | + uni.showToast({ | |
| 507 | + icon: 'none', | |
| 508 | + title: '请输入统一社会信用代码' | |
| 509 | + }); | |
| 510 | + return false; | |
| 511 | + } | |
| 512 | + if (!this.model1.type) { | |
| 513 | + uni.showToast({ | |
| 514 | + icon: 'none', | |
| 515 | + title: '请选择主体类型' | |
| 516 | + }); | |
| 517 | + return false; | |
| 518 | + } | |
| 519 | + if (!this.model1.legalRepresentative) { | |
| 520 | + uni.showToast({ | |
| 521 | + icon: 'none', | |
| 522 | + title: '请输入法定代表人' | |
| 523 | + }); | |
| 524 | + return false; | |
| 525 | + } | |
| 526 | + if (!this.model1.businessScope) { | |
| 527 | + uni.showToast({ | |
| 528 | + icon: 'none', | |
| 529 | + title: '请输入经营范围' | |
| 530 | + }); | |
| 531 | + return false; | |
| 532 | + } | |
| 533 | + if (!this.model1.registeredCapital) { | |
| 534 | + uni.showToast({ | |
| 535 | + icon: 'none', | |
| 536 | + title: '请输入注册资本' | |
| 537 | + }); | |
| 538 | + return false; | |
| 539 | + } | |
| 540 | + if (!this.model1.establishmentDate) { | |
| 541 | + uni.showToast({ | |
| 542 | + icon: 'none', | |
| 543 | + title: '请输入成立日期' | |
| 544 | + }); | |
| 545 | + return false; | |
| 546 | + } | |
| 547 | + if (!this.model1.address) { | |
| 548 | + uni.showToast({ | |
| 549 | + icon: 'none', | |
| 550 | + title: '请输入住所' | |
| 551 | + }); | |
| 552 | + return false; | |
| 553 | + } | |
| 554 | + if (!this.model1.emailAddress) { | |
| 555 | + uni.showToast({ | |
| 556 | + icon: 'none', | |
| 557 | + title: '请输入邮箱地址' | |
| 558 | + }); | |
| 559 | + return false; | |
| 560 | + } | |
| 561 | + if (!this.model1.businessStartDate) { | |
| 562 | + uni.showToast({ | |
| 563 | + icon: 'none', | |
| 564 | + title: '请选择经营开始时间' | |
| 565 | + }); | |
| 566 | + return false; | |
| 567 | + } | |
| 568 | + if (!this.model1.businessEndDate) { | |
| 569 | + uni.showToast({ | |
| 570 | + icon: 'none', | |
| 571 | + title: '请选择经营结束时间' | |
| 572 | + }); | |
| 573 | + return false; | |
| 574 | + } | |
| 575 | + if (!this.model1.businessLicense) { | |
| 576 | + uni.showToast({ | |
| 577 | + icon: 'none', | |
| 578 | + title: '请上传营业执照' | |
| 579 | + }); | |
| 580 | + return false; | |
| 581 | + } | |
| 582 | + return true; | |
| 583 | + }, | |
| 382 | 584 | startTimeChange(val) { |
| 383 | 585 | this.model1.scheduleTime = this.timeChange(val) |
| 384 | 586 | }, |
| ... | ... | @@ -434,6 +636,43 @@ |
| 434 | 636 | } = val; |
| 435 | 637 | return `${year}-${month}-${day}`; |
| 436 | 638 | }, |
| 639 | + onsuccess1(e, file, fileList, ziduan) { | |
| 640 | + console.error(e, file, fileList, ziduan) | |
| 641 | + uni.uploadFile({ | |
| 642 | + url: this.$upload, // 仅为示例,请替换为您的服务器上传接口 | |
| 643 | + filePath: e[0].url, | |
| 644 | + name: 'file', // 后端接收的文件参数名 | |
| 645 | + formData: { | |
| 646 | + filePath: 'xcx', // 其他表单数据 | |
| 647 | + }, | |
| 648 | + success: (uploadFileRes) => { | |
| 649 | + if (ziduan == 'businessLicense') { | |
| 650 | + this.model1.businessLicense = this.$img + JSON.parse(uploadFileRes.data).data | |
| 651 | + } else if (ziduan == 'idPhotoFront') { | |
| 652 | + this.model1.idPhotoFront = this.$img + JSON.parse(uploadFileRes.data).data | |
| 653 | + } else if (ziduan == 'idPhotoBack') { | |
| 654 | + this.model1.idPhotoBack = this.$img + JSON.parse(uploadFileRes.data).data | |
| 655 | + } else if(ziduan == 'coverImage'){ | |
| 656 | + this.model1.coverImage = this.$img + JSON.parse(uploadFileRes.data).data | |
| 657 | + }else{ | |
| 658 | + this.model1.enterpriseAuthorization = this.$img + JSON.parse(uploadFileRes.data).data | |
| 659 | + } | |
| 660 | + | |
| 661 | + console.log('上传成功', this.model1); | |
| 662 | + uni.showToast({ | |
| 663 | + title: '上传成功', | |
| 664 | + icon: 'success', | |
| 665 | + }); | |
| 666 | + }, | |
| 667 | + fail: (err) => { | |
| 668 | + console.error('上传失败', err); | |
| 669 | + uni.showToast({ | |
| 670 | + title: '上传失败', | |
| 671 | + icon: 'none', | |
| 672 | + }); | |
| 673 | + }, | |
| 674 | + }); | |
| 675 | + }, | |
| 437 | 676 | } |
| 438 | 677 | } |
| 439 | 678 | </script> | ... | ... |
lvdao-miniapp/pages/advertisementDetail/advertisementDetail.scss
lvdao-miniapp/pages/advertisementDetail/advertisementDetail.vue
| ... | ... | @@ -6,9 +6,13 @@ |
| 6 | 6 | {{tableData.advertisingName}} |
| 7 | 7 | </view> |
| 8 | 8 | <view class="info-text">{{tableData.shopDescription}}</view> |
| 9 | - <view class="info-racord"> | |
| 10 | - <view class="info-price"><span>1000</span>元/月</view> | |
| 11 | - <view class="info-intention">2456人有意向</view> | |
| 9 | + <view class="info-racord" v-if="moban.length !=0"> | |
| 10 | + <view class="info-price"><span>{{moban[0].rentalPrice || ''}}</span>元/{{moban[0].leaseTerm || ''}}</view> | |
| 11 | + <!-- <view class="info-intention">{{tableData.id}}人有意向</view> --> | |
| 12 | + </view> | |
| 13 | + <view class="" v-if="moban.length !=0" @click="moreZu"> | |
| 14 | + 查看更多租金优惠 | |
| 15 | + <u-icon name="arrow-right" ></u-icon> | |
| 12 | 16 | </view> |
| 13 | 17 | </view> |
| 14 | 18 | <view class="banner-item field"> |
| ... | ... | @@ -58,7 +62,7 @@ |
| 58 | 62 | </view> |
| 59 | 63 | </u-col> |
| 60 | 64 | <u-col span="12"> |
| 61 | - <image :src="tableData.locationDiagram" width="100%"></image> | |
| 65 | + <image :src="$img+tableData.locationDiagram" width="100%"></image> | |
| 62 | 66 | </u-col> |
| 63 | 67 | </u-row> |
| 64 | 68 | </view> |
| ... | ... | @@ -72,7 +76,7 @@ |
| 72 | 76 | </view> --> |
| 73 | 77 | <view class="footer-btn"> |
| 74 | 78 | <!-- <u-button type="primary" @click="leaseAdd('/pages/intentionApply/intentionApply')" style="margin-right:10px;height: 35px;">意向申请</u-button> --> |
| 75 | - <u-button type="success" style="height: 35px;" @click="leaseAdd('/pages/advertisementAdd/advertisementAdd')">租赁申请</u-button> | |
| 79 | + <u-button type="success" style="width: 100%;border-radius: 10px;" @click="leaseAdd('/pages/advertisementAdd/advertisementAdd')">租赁申请</u-button> | |
| 76 | 80 | <!-- <u-button type="success" style="margin-left: unset;" @click="leaseAdd">广告申请</u-button> --> |
| 77 | 81 | </view> |
| 78 | 82 | <!-- <view class="footer-service"> |
| ... | ... | @@ -99,19 +103,76 @@ export default { |
| 99 | 103 | ], |
| 100 | 104 | latitude: 39.909, |
| 101 | 105 | longitude: 116.39742, |
| 106 | + moban:[], | |
| 107 | + resourcesId:'' | |
| 102 | 108 | }; |
| 103 | 109 | }, |
| 104 | 110 | onLoad(option){ |
| 105 | 111 | let data = JSON.parse(option.item) |
| 106 | 112 | this.tableData = data; |
| 113 | + this.resourcesId = `gg${data.id}` | |
| 114 | + let paesize = { | |
| 115 | + pageNumber: 0, | |
| 116 | + pageSize: 10, | |
| 117 | + resourcesId: `gg${data.id}` | |
| 118 | + } | |
| 119 | + this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', paesize,1).then(res => { | |
| 120 | + | |
| 121 | + this.moban = res.data.data | |
| 122 | + }).catch(err => { | |
| 123 | + console.log(err) | |
| 124 | + //请求失败 | |
| 125 | + }) | |
| 107 | 126 | }, |
| 108 | 127 | methods: { |
| 109 | 128 | leaseAdd(url){ |
| 110 | - console.log(this.tableData) | |
| 111 | - uni.navigateTo({ | |
| 112 | - url:`${url}?ids=${this.tableData.id}&type=${this.tableData.advertisingType}` | |
| 113 | - }) | |
| 114 | - } | |
| 129 | + | |
| 130 | + this.$http.sendRequest('/cerePlatformMerchant/queryByPage', 'POST',{"pageSize":10,pageNumber:0,phone:uni.getStorageSync('user').phone},2).then(res => { | |
| 131 | + //成功回调 | |
| 132 | + if(res.data.data.content.length>0) { | |
| 133 | + let c1 = res.data.data.content[0] | |
| 134 | + console.error({...c1}) | |
| 135 | + if(c1.checkState == '1') { | |
| 136 | + uni.showToast({ | |
| 137 | + icon:'none', | |
| 138 | + title: '商家申请正在审核中', | |
| 139 | + duration:3000 | |
| 140 | + }); | |
| 141 | + } else if(c1.checkState == '3') { | |
| 142 | + uni.showToast({ | |
| 143 | + icon:'none', | |
| 144 | + title: '商家申请审核已被拒绝 请重新提交', | |
| 145 | + duration:3000 | |
| 146 | + }); | |
| 147 | + setTimeout(() => { | |
| 148 | + uni.navigateTo({ | |
| 149 | + url:'/pagesA/leaseAdd/leaseAdd' | |
| 150 | + }) | |
| 151 | + }, 3000) | |
| 152 | + } else if(c1.checkState == '2') { | |
| 153 | + uni.navigateTo({ | |
| 154 | + url:`${url}?ids=${this.tableData.id}&type=${this.tableData.advertisingType}` | |
| 155 | + }) | |
| 156 | + } | |
| 157 | + }else{ | |
| 158 | + uni.showToast({ | |
| 159 | + icon:'none', | |
| 160 | + title: '请先申请成为商家', | |
| 161 | + duration:3000 | |
| 162 | + }); | |
| 163 | + setTimeout(() => { | |
| 164 | + uni.navigateTo({ | |
| 165 | + url:'/pagesA/leaseAdd/leaseAdd' | |
| 166 | + }) | |
| 167 | + }, 3000) | |
| 168 | + } | |
| 169 | + }) | |
| 170 | + }, | |
| 171 | + moreZu(){ | |
| 172 | + uni.navigateTo({ | |
| 173 | + url:`/pagesA/moreZu/moreZu?resourcesId=${this.resourcesId}` | |
| 174 | + }) | |
| 175 | + }, | |
| 115 | 176 | } |
| 116 | 177 | }; |
| 117 | 178 | </script> | ... | ... |
lvdao-miniapp/pages/complaint/complaint.vue
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | <view class="add-list"> |
| 6 | 6 | <view class="list"> |
| 7 | 7 | <view class="title"> |
| 8 | - <text style="font-weight: bold;">投诉类型</text> | |
| 8 | + <text style="font-weight: bold;">*投诉类型</text> | |
| 9 | 9 | <!-- <text class="star">*</text> --> |
| 10 | 10 | </view> |
| 11 | 11 | <view class="content" @click="chooseLocation(1)" style="width: 25%;"> |
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | </view> |
| 17 | 17 | <view class="list"> |
| 18 | 18 | <view class="title"> |
| 19 | - <text style="font-weight: bold;">问题描述</text> | |
| 19 | + <text style="font-weight: bold;">*问题描述</text> | |
| 20 | 20 | <!-- <text class="star">*</text> --> |
| 21 | 21 | </view> |
| 22 | 22 | <view class="content"> |
| ... | ... | @@ -33,14 +33,14 @@ |
| 33 | 33 | <view class="feedback-data"> |
| 34 | 34 | <view > |
| 35 | 35 | <view class="title"> |
| 36 | - <text style="font-weight: bold;">现场照片</text> | |
| 36 | + <text style="font-weight: bold;">*现场照片</text> | |
| 37 | 37 | <!-- <text class="star">*</text> --> |
| 38 | 38 | </view> |
| 39 | 39 | </view> |
| 40 | 40 | <view class="voucher-img"> |
| 41 | 41 | <view class="voucher-list"> |
| 42 | - <!-- <image :src="$imgUrl('/voucher_bg.png')" ></image> --> | |
| 43 | - <u-upload :action="$upload" :auto-upload="true" ref="uUpload" ></u-upload> | |
| 42 | + <u-upload :action="$upload" :auto-upload="false" ref="uUpload" :max-count="5" | |
| 43 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'uUpload')"></u-upload> | |
| 44 | 44 | </view> |
| 45 | 45 | </view> |
| 46 | 46 | </view> |
| ... | ... | @@ -52,14 +52,14 @@ |
| 52 | 52 | <view class="feedback-data"> |
| 53 | 53 | <view> |
| 54 | 54 | <view class="title"> |
| 55 | - <text style="font-weight: bold;">备注信息</text> | |
| 55 | + <text style="font-weight: bold;">*备注信息</text> | |
| 56 | 56 | <!-- <text class="star">*</text> --> |
| 57 | 57 | </view> |
| 58 | 58 | </view> |
| 59 | 59 | <view class="voucher-img"> |
| 60 | 60 | <view class="voucher-list" style="width: 100%;"> |
| 61 | 61 | <view class="" style="background-color: #F0F0F0;border-radius: 20rpx;"> |
| 62 | - <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx 0;" v-model="ruleForm.remark"></textarea> | |
| 62 | + <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx;" v-model="ruleForm.remark"></textarea> | |
| 63 | 63 | </view> |
| 64 | 64 | </view> |
| 65 | 65 | </view> |
| ... | ... | @@ -69,11 +69,7 @@ |
| 69 | 69 | <u-select v-model="popup1" mode="mutil-column-auto" :list="list" @confirm="pops" label-name="label" value-name="value"></u-select> |
| 70 | 70 | <!-- 保存按钮 --> |
| 71 | 71 | <view class="page-footer"> |
| 72 | - <view class="footer-buy"> | |
| 73 | - <view class="cart-add" @click="submit"> | |
| 74 | - <text>提交</text> | |
| 75 | - </view> | |
| 76 | - </view> | |
| 72 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="submit">提交</u-button> | |
| 77 | 73 | </view> |
| 78 | 74 | </view> |
| 79 | 75 | </template> |
| ... | ... | @@ -84,11 +80,8 @@ |
| 84 | 80 | return { |
| 85 | 81 | fileList:[], |
| 86 | 82 | ruleForm:{ |
| 87 | - onSitePhoto:'', | |
| 88 | - complaintType:'', | |
| 89 | - problemDescription:'', | |
| 90 | - remark:'', | |
| 91 | - applicationTime:'', | |
| 83 | + onSitePhoto:[], | |
| 84 | + | |
| 92 | 85 | status:'1' |
| 93 | 86 | }, |
| 94 | 87 | list: [{ |
| ... | ... | @@ -111,21 +104,53 @@ |
| 111 | 104 | this.ruleForm.complaintType = val[0].label |
| 112 | 105 | |
| 113 | 106 | }, |
| 107 | + check(){ | |
| 108 | + if (this.ruleForm.onSitePhoto.length== 0) { | |
| 109 | + uni.showToast({ | |
| 110 | + icon: 'none', | |
| 111 | + title: '请上传现场图片' | |
| 112 | + }); | |
| 113 | + return false; | |
| 114 | + } | |
| 115 | + if (!this.ruleForm.complaintType) { | |
| 116 | + uni.showToast({ | |
| 117 | + icon: 'none', | |
| 118 | + title: '请选择投诉类型' | |
| 119 | + }); | |
| 120 | + return false; | |
| 121 | + } | |
| 122 | + if (!this.ruleForm.problemDescription) { | |
| 123 | + uni.showToast({ | |
| 124 | + icon: 'none', | |
| 125 | + title: '请输入问题描述' | |
| 126 | + }); | |
| 127 | + return false; | |
| 128 | + } | |
| 129 | + if (!this.ruleForm.remark) { | |
| 130 | + uni.showToast({ | |
| 131 | + icon: 'none', | |
| 132 | + title: '请输入备注信息' | |
| 133 | + }); | |
| 134 | + return false; | |
| 135 | + } | |
| 136 | + | |
| 137 | + return true; | |
| 138 | + }, | |
| 114 | 139 | submit() { |
| 115 | - let files = [] | |
| 116 | - // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作) | |
| 117 | - files = this.$refs.uUpload.lists.filter(val => { | |
| 118 | - return val.progress == 100; | |
| 119 | - }) | |
| 120 | - // 如果您不需要进行太多的处理,直接如下即可 | |
| 121 | - // files = this.$refs.uUpload.lists; | |
| 122 | - files.map(item=>{ | |
| 123 | - this.ruleForm.onSitePhoto = item.response.data.url | |
| 124 | - }) | |
| 125 | - this.ruleForm.applicationTime = this.currentTime() | |
| 126 | - | |
| 127 | - this.ruleForm.applicant = uni.getStorageSync('shopId') | |
| 128 | - this.$http.sendRequest('/cereComplaintsSuggestions/add', 'POST',this.ruleForm,1).then(res => { | |
| 140 | + let show = this.check() | |
| 141 | + if(show == false){ | |
| 142 | + return | |
| 143 | + } | |
| 144 | + this.ruleForm.applicationTime = this.currentTime() | |
| 145 | + this.ruleForm.createUser = uni.getStorageSync('user').phone | |
| 146 | + this.ruleForm.onSitePhoto.map(item=>{ | |
| 147 | + item.replace(this.$img,'') | |
| 148 | + }) | |
| 149 | + let info = { | |
| 150 | + ...this.ruleForm, | |
| 151 | + onSitePhoto:this.ruleForm.onSitePhoto.join(','), | |
| 152 | + } | |
| 153 | + this.$http.sendRequest('/cereComplaintsSuggestions/add', 'POST',info,1).then(res => { | |
| 129 | 154 | uni.navigateTo({ |
| 130 | 155 | url: '/pages/serve/serve' |
| 131 | 156 | }) |
| ... | ... | @@ -156,6 +181,31 @@ |
| 156 | 181 | let strDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| 157 | 182 | return strDate; |
| 158 | 183 | }, |
| 184 | + onsuccess1(e, file, fileList, ziduan) { | |
| 185 | + console.error(e, file, fileList, ziduan) | |
| 186 | + uni.uploadFile({ | |
| 187 | + url: this.$upload, // 仅为示例,请替换为您的服务器上传接口 | |
| 188 | + filePath: e[0].url, | |
| 189 | + name: 'file', // 后端接收的文件参数名 | |
| 190 | + formData: { | |
| 191 | + filePath: 'xcx', // 其他表单数据 | |
| 192 | + }, | |
| 193 | + success: (uploadFileRes) => { | |
| 194 | + this.ruleForm.onSitePhoto.push(this.$img + JSON.parse(uploadFileRes.data).data) | |
| 195 | + uni.showToast({ | |
| 196 | + title: '上传成功', | |
| 197 | + icon: 'success', | |
| 198 | + }); | |
| 199 | + }, | |
| 200 | + fail: (err) => { | |
| 201 | + console.error('上传失败', err); | |
| 202 | + uni.showToast({ | |
| 203 | + title: '上传失败', | |
| 204 | + icon: 'none', | |
| 205 | + }); | |
| 206 | + }, | |
| 207 | + }); | |
| 208 | + }, | |
| 159 | 209 | } |
| 160 | 210 | } |
| 161 | 211 | </script> | ... | ... |
lvdao-miniapp/pages/details/details.scss
lvdao-miniapp/pages/details/details.vue
| ... | ... | @@ -14,9 +14,10 @@ |
| 14 | 14 | <view class="info-price"><span>{{moban[0].rentalPrice || ''}}</span>元/{{moban[0].leaseTerm || ''}}</view> |
| 15 | 15 | <!-- <view class="info-intention">{{tableData.id}}人有意向</view> --> |
| 16 | 16 | </view> |
| 17 | - <!-- <view class="info-racord" v-if="moban.length !=0"> | |
| 18 | - 查看更多租金优惠 | |
| 19 | - </view> --> | |
| 17 | + <view class="" v-if="moban.length !=0" @click="moreZu"> | |
| 18 | + 查看更多租金优惠 | |
| 19 | + <u-icon name="arrow-right" ></u-icon> | |
| 20 | + </view> | |
| 20 | 21 | </view> |
| 21 | 22 | <view class="banner-item field"> |
| 22 | 23 | <view class="banner-item-title">场地信息</view> |
| ... | ... | @@ -25,7 +26,7 @@ |
| 25 | 26 | <u-col span="6"> |
| 26 | 27 | <view class="form-item"> |
| 27 | 28 | <view class="label">场地类型:</view> |
| 28 | - <text>{{tableData.architecturalForm || tableData.venueType}}</text> | |
| 29 | + <text>{{tableData.shopName?'商铺':'场地'}}</text> | |
| 29 | 30 | </view> |
| 30 | 31 | </u-col> |
| 31 | 32 | <u-col span="6"> |
| ... | ... | @@ -64,7 +65,7 @@ |
| 64 | 65 | <map style="width: 100%; height: 150rpx;"> |
| 65 | 66 | <view class="position-info"> |
| 66 | 67 | <u-image :showLoading="true" :src="$imgUrl('/location-icon.png')" width="20rpx" height="20rpx"></u-image> |
| 67 | - <text>{{tableData.shopName || tableData.venueName}}</text> | |
| 68 | + <text>{{tableData.detailedLocation}}</text> | |
| 68 | 69 | </view> |
| 69 | 70 | </map> |
| 70 | 71 | </view> |
| ... | ... | @@ -95,7 +96,7 @@ |
| 95 | 96 | </view> --> |
| 96 | 97 | <view class="footer-btn"> |
| 97 | 98 | <!-- <u-button type="primary" @click="leaseAdd('/pages/intentionApply/intentionApply')" style="margin-right:10px;height: 35px;">意向申请</u-button> --> |
| 98 | - <u-button type="success" style="height: 35px;" @click="leaseAdd('/pages/leaseAdd/leaseAdd')" >租赁申请</u-button> | |
| 99 | + <u-button type="success" style="width: 100%;border-radius: 10px;" @click="leaseAdd('/pages/leaseAdd/leaseAdd')" >租赁申请</u-button> | |
| 99 | 100 | <!-- <u-button type="success" style="margin-left: unset;" @click="leaseAdd">广告申请</u-button> --> |
| 100 | 101 | </view> |
| 101 | 102 | <!-- <view class="footer-service"> |
| ... | ... | @@ -123,7 +124,8 @@ export default { |
| 123 | 124 | latitude: 39.909, |
| 124 | 125 | longitude: 116.39742, |
| 125 | 126 | qianzui:'', |
| 126 | - moban:[] | |
| 127 | + moban:[], | |
| 128 | + resourcesId:'' | |
| 127 | 129 | }; |
| 128 | 130 | }, |
| 129 | 131 | filters: { |
| ... | ... | @@ -135,12 +137,13 @@ export default { |
| 135 | 137 | onLoad(option){ |
| 136 | 138 | |
| 137 | 139 | let data = JSON.parse(option.item) |
| 138 | - | |
| 140 | + console.log(data) | |
| 139 | 141 | if(data.shopName){ |
| 140 | 142 | this.qianzui = 'sp' |
| 141 | 143 | }else{ |
| 142 | 144 | this.qianzui = 'cd' |
| 143 | 145 | } |
| 146 | + this.resourcesId = `${this.qianzui}${data.id}` | |
| 144 | 147 | let paesize = { |
| 145 | 148 | pageNumber: 0, |
| 146 | 149 | pageSize: 10, |
| ... | ... | @@ -155,14 +158,14 @@ export default { |
| 155 | 158 | }) |
| 156 | 159 | this.swiperList[0].url = data.displayMainImage || data.locationDiagram |
| 157 | 160 | this.tableData = data |
| 158 | - let location | |
| 159 | - if(data.mapPunctuation){ | |
| 160 | - location = JSON.parse(data.mapPunctuation) | |
| 161 | - }else{ | |
| 162 | - location = JSON.parse(data.mapMarker) | |
| 163 | - } | |
| 164 | - this.latitude = location.latitude; | |
| 165 | - this.longitude = location.longitude; | |
| 161 | + // let location | |
| 162 | + // if(data.mapPunctuation){ | |
| 163 | + // location = JSON.parse(data.mapPunctuation) | |
| 164 | + // }else{ | |
| 165 | + // location = JSON.parse(data.mapMarker) | |
| 166 | + // } | |
| 167 | + // this.latitude = location.latitude; | |
| 168 | + // this.longitude = location.longitude; | |
| 166 | 169 | |
| 167 | 170 | }, |
| 168 | 171 | methods: { |
| ... | ... | @@ -208,7 +211,12 @@ export default { |
| 208 | 211 | } |
| 209 | 212 | }) |
| 210 | 213 | |
| 211 | - } | |
| 214 | + }, | |
| 215 | + moreZu(){ | |
| 216 | + uni.navigateTo({ | |
| 217 | + url:`/pagesA/moreZu/moreZu?resourcesId=${this.resourcesId}` | |
| 218 | + }) | |
| 219 | + }, | |
| 212 | 220 | } |
| 213 | 221 | }; |
| 214 | 222 | </script> | ... | ... |
lvdao-miniapp/pages/field/field.vue
| ... | ... | @@ -67,7 +67,7 @@ |
| 67 | 67 | <view class="goods-list"> |
| 68 | 68 | <view class="list" v-for="(item,index) in tableData" :key="index" @click="reconciliationdetail(item)"> |
| 69 | 69 | <view class="thumb"> |
| 70 | - <u-image width="25vw" height="25vw" :src="item.displayImage"></u-image> | |
| 70 | + <u-image width="25vw" height="25vw" border-radius="20" :src="$img + item.displayImage"></u-image> | |
| 71 | 71 | <!-- <image :src="item.displayMainImage" mode=""></image> --> |
| 72 | 72 | </view> |
| 73 | 73 | <view class="item"> |
| ... | ... | @@ -84,11 +84,6 @@ |
| 84 | 84 | </view> |
| 85 | 85 | <view class="like-goods"> |
| 86 | 86 | <view class="retail-price"> |
| 87 | - <text>租金:</text> | |
| 88 | - <text class="min">¥</text> | |
| 89 | - <text class="max">{{item.id*10}}</text> | |
| 90 | - <text class="min">/月</text> | |
| 91 | - <text class="line"></text> | |
| 92 | 87 | <text>面积:</text> |
| 93 | 88 | <text class="max">{{item.actualArea}}</text> |
| 94 | 89 | <text class="min">/m²</text> |
| ... | ... | @@ -107,13 +102,15 @@ |
| 107 | 102 | return { |
| 108 | 103 | query:{ |
| 109 | 104 | venueName:'', |
| 110 | - pageNumber: 1, | |
| 105 | + pageNumber: 0, | |
| 111 | 106 | pageSize: 10, |
| 107 | + publishStatus:2 | |
| 112 | 108 | }, |
| 113 | 109 | pageindex: { |
| 114 | - pageNumber: 1, | |
| 110 | + pageNumber: 0, | |
| 115 | 111 | pageSize: 10, |
| 116 | - publishStatus:'1' | |
| 112 | + publishStatus:'1', | |
| 113 | + publishStatus:2 | |
| 117 | 114 | }, |
| 118 | 115 | areList: [ |
| 119 | 116 | {value: '武侯区', label: '武侯区'}, | ... | ... |
lvdao-miniapp/pages/home/home.vue
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" |
| 17 | 17 | interval="5000" duration="500"> |
| 18 | 18 | <swiper-item v-for="(item,index) in swiperList" :key="index"> |
| 19 | - <image :src="item.imageUrl" mode="aspectFill"></image> | |
| 19 | + <image :src="$img+item.imageUrl" mode="aspectFill"></image> | |
| 20 | 20 | <!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> --> |
| 21 | 21 | </swiper-item> |
| 22 | 22 | </swiper> |
| ... | ... | @@ -235,10 +235,14 @@ |
| 235 | 235 | </view> |
| 236 | 236 | <!-- <view class="business-card-item">租金:¥<span>{{item.id * 10}}</span>/月</view> |
| 237 | 237 | <view class="business-card-item">面积:<span>{{item.actualUsableArea?item.actualUsableArea:'55.4'}}</span>/m2</view> --> |
| 238 | - <view class="introduce" v-if='item.detailedLocation'> | |
| 238 | + <view class="introduce" v-if='item.detailedLocation && item.advertisingType== undefined '> | |
| 239 | 239 | <image :src="$imgUrl('/kefu.png')"></image> |
| 240 | 240 | <text class="one-omit">{{item.detailedLocation}}</text> |
| 241 | 241 | </view> |
| 242 | + <view class="introduce" v-if='item.advertisingType'> | |
| 243 | + <text>类型:</text> | |
| 244 | + <text class="one-omit">{{item.advertisingType}}</text> | |
| 245 | + </view> | |
| 242 | 246 | </view> |
| 243 | 247 | </view> |
| 244 | 248 | </scroll-view> |
| ... | ... | @@ -419,7 +423,7 @@ |
| 419 | 423 | }, |
| 420 | 424 | onCouponTab(type) { |
| 421 | 425 | let pagesize = { |
| 422 | - pageNumber: 1, | |
| 426 | + pageNumber: 0, | |
| 423 | 427 | pageSize: 10, |
| 424 | 428 | publishStatus:'2' |
| 425 | 429 | } |
| ... | ... | @@ -444,7 +448,7 @@ |
| 444 | 448 | |
| 445 | 449 | } else if (type == 2) { |
| 446 | 450 | pagesize.pageNumber = 0 |
| 447 | - pagesize.advertisingType = '线上广告位' | |
| 451 | + // pagesize.advertisingType = '线上广告位' | |
| 448 | 452 | this.$http.sendRequest('/cereAdvertisingInformation/likeGet', 'POST', pagesize,1).then(res => { |
| 449 | 453 | //成功回调 |
| 450 | 454 | this.tableData = res.data.data.content | ... | ... |
lvdao-miniapp/pages/leaseAdd/leaseAdd.vue
| ... | ... | @@ -5,15 +5,18 @@ |
| 5 | 5 | </view> |
| 6 | 6 | <view> |
| 7 | 7 | <view class="add-list" v-show="active == 0"> |
| 8 | + <view style="padding:15px;margin-top:10px;" v-if="map ==0"> | |
| 9 | + <wu-calendar :insert="true" @change="calendarChange" slideSwitchMode="horizontal" mode="range" :selected="selected" color="#3f9b6a" style="border-radius: 10px;"></wu-calendar> | |
| 10 | + </view> | |
| 8 | 11 | <u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250"> |
| 9 | - <u-form-item label="*经营用途" prop="businessPurpose" borderBottom> | |
| 10 | - <u-input v-model="model1.businessPurpose"></u-input> | |
| 12 | + <u-form-item label="*租赁周期" prop="intendedLeaseTerm" borderBottom v-if="map==0"> | |
| 13 | + <u-input v-model="model1.intendedLeaseTerm" type="select" placeholder="请选择上面时间" ></u-input> | |
| 11 | 14 | </u-form-item> |
| 12 | - <u-form-item label="*意向租期" prop="intendedLeaseTerm" placeholder="请输入月、年" borderBottom> | |
| 13 | - <u-input v-model="model1.intendedLeaseTerm"></u-input> | |
| 15 | + <u-form-item label="*租赁周期" prop="intendedLeaseTerm" borderBottom v-else> | |
| 16 | + <u-input v-model="model1.intendedLeaseTerm" placeholder="请输入租赁周期" ></u-input> | |
| 14 | 17 | </u-form-item> |
| 15 | - <u-form-item label="*经营主体" prop="operatingEntity" borderBottom> | |
| 16 | - <u-input v-model="model1.operatingEntity"></u-input> | |
| 18 | + <u-form-item label="*经营用途" prop="businessPurpose" borderBottom> | |
| 19 | + <u-input v-model="model1.businessPurpose"></u-input> | |
| 17 | 20 | </u-form-item> |
| 18 | 21 | </u-form> |
| 19 | 22 | </view> |
| ... | ... | @@ -57,7 +60,11 @@ |
| 57 | 60 | <u-input v-model="model1.registeredCapital"></u-input> |
| 58 | 61 | </u-form-item> |
| 59 | 62 | <u-form-item label="*成立日期" prop="establishmentDate" borderBottom> |
| 60 | - <u-input v-model="model1.establishmentDate"></u-input> | |
| 63 | + <!-- <u-input v-model="model1.establishmentDate"></u-input> --> | |
| 64 | + <u-input v-model="model1.establishmentDate" type="select" @click="establishow = true" | |
| 65 | + placeholder="请选择" /> | |
| 66 | + <u-picker mode="time" v-model="establishow" :params="params" | |
| 67 | + @confirm="establiChange"></u-picker> | |
| 61 | 68 | </u-form-item> |
| 62 | 69 | <u-form-item label="*住所" prop="residence" borderBottom> |
| 63 | 70 | <u-input v-model="model1.residence"></u-input> |
| ... | ... | @@ -83,7 +90,7 @@ |
| 83 | 90 | </u-form-item> |
| 84 | 91 | </u-form> |
| 85 | 92 | </view> |
| 86 | - <view v-show="active==2"> | |
| 93 | + <!-- <view v-show="active==2"> | |
| 87 | 94 | <u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250"> |
| 88 | 95 | <view class="add-list"> |
| 89 | 96 | <u-form-item label="*经营者姓名" prop="operatorName" borderBottom> |
| ... | ... | @@ -168,7 +175,7 @@ |
| 168 | 175 | </u-form-item> |
| 169 | 176 | </view> |
| 170 | 177 | </u-form> |
| 171 | - </view> | |
| 178 | + </view> --> | |
| 172 | 179 | </view> |
| 173 | 180 | <u-select v-model="typeShow" :list="activesType" @confirm="typeChange"></u-select> |
| 174 | 181 | <u-select v-model="celueShow" :list="celueType" @confirm="celueChange"></u-select> |
| ... | ... | @@ -177,8 +184,8 @@ |
| 177 | 184 | <view class="page-footer"> |
| 178 | 185 | <u-button style="background-color: #DFE0E4; flex: 1; margin: 0 10px;" @click="toBefor" |
| 179 | 186 | v-if="active != 0">上一步</u-button> |
| 180 | - <u-button type="success" style="flex: 1; margin: 0 10px;" @click="toNext" v-if="active != 2">下一步</u-button> | |
| 181 | - <u-button type="success" style="flex: 1; margin: 0 10px;" @click="go" v-if="active == 2">提交申请</u-button> | |
| 187 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="toNext" v-if="active != 1">下一步</u-button> | |
| 188 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="go" v-if="active == 1">提交申请</u-button> | |
| 182 | 189 | </view> |
| 183 | 190 | </view> |
| 184 | 191 | </template> |
| ... | ... | @@ -188,12 +195,17 @@ |
| 188 | 195 | data() { |
| 189 | 196 | return { |
| 190 | 197 | active: 0, |
| 198 | + // numList: [{ | |
| 199 | + // name: '租赁信息' | |
| 200 | + // }, { | |
| 201 | + // name: '主体信息' | |
| 202 | + // }, { | |
| 203 | + // name: '经营者信息' | |
| 204 | + // }], | |
| 191 | 205 | numList: [{ |
| 192 | 206 | name: '租赁信息' |
| 193 | 207 | }, { |
| 194 | - name: '主体信息' | |
| 195 | - }, { | |
| 196 | - name: '经营者信息' | |
| 208 | + name: '营业执照信息' | |
| 197 | 209 | }], |
| 198 | 210 | model1: { |
| 199 | 211 | businessPurpose: '', |
| ... | ... | @@ -277,7 +289,27 @@ |
| 277 | 289 | moban: [], |
| 278 | 290 | zhengce: '', |
| 279 | 291 | shuoming: '', |
| 280 | - zujin: '' | |
| 292 | + zujin: '', | |
| 293 | + selected: [ | |
| 294 | + { | |
| 295 | + date: '2025-01-08', | |
| 296 | + info: '¥850', | |
| 297 | + infoColor: '#3f9b6a', | |
| 298 | + disable: true // 禁用 | |
| 299 | + }, | |
| 300 | + { | |
| 301 | + date: '2025-01-11', | |
| 302 | + info: '¥950', | |
| 303 | + infoColor: '#3f9b6a', | |
| 304 | + }, | |
| 305 | + { | |
| 306 | + date: '2025-01-14', | |
| 307 | + info: '¥900', | |
| 308 | + infoColor: '#6ac695', | |
| 309 | + }, | |
| 310 | + ], | |
| 311 | + map:0, | |
| 312 | + establishow:false | |
| 281 | 313 | }; |
| 282 | 314 | }, |
| 283 | 315 | onLoad(option) { |
| ... | ... | @@ -287,6 +319,12 @@ |
| 287 | 319 | pageSize: 10, |
| 288 | 320 | resourcesId: option.ids |
| 289 | 321 | } |
| 322 | + const containsSp = option.ids.includes('sp'); | |
| 323 | + if (containsSp) { | |
| 324 | + this.map = 1; | |
| 325 | + } else { | |
| 326 | + this.map = 0; // 或者其他默认值 | |
| 327 | + } | |
| 290 | 328 | this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', paesize, 1).then(res => { |
| 291 | 329 | |
| 292 | 330 | this.moban = res.data.data |
| ... | ... | @@ -334,6 +372,38 @@ |
| 334 | 372 | |
| 335 | 373 | }, |
| 336 | 374 | methods: { |
| 375 | + generateDateRange(datas) { | |
| 376 | + const result = []; | |
| 377 | + const startDate = new Date(datas[0]) | |
| 378 | + const endDate = new Date(datas[1]) | |
| 379 | + if (startDate > endDate) { | |
| 380 | + [startDate, endDate] = [endDate, startDate] | |
| 381 | + } | |
| 382 | + let currentDate = new Date(startDate); | |
| 383 | + while (currentDate <= endDate) { | |
| 384 | + const year = currentDate.getFullYear(); | |
| 385 | + const month = String(currentDate.getMonth() + 1).padStart(1, '0'); | |
| 386 | + const day = String(currentDate.getDate()).padStart(1, '0'); | |
| 387 | + const dateString = `${year}-${month}-${day}`; | |
| 388 | + result.push({ | |
| 389 | + date: dateString, | |
| 390 | + info: '¥850', | |
| 391 | + disable: true | |
| 392 | + }); | |
| 393 | + currentDate.setDate(currentDate.getDate() + 1); | |
| 394 | + } | |
| 395 | + return result; | |
| 396 | + }, | |
| 397 | + calendarChange(e){ | |
| 398 | + if(e.range.after == ''){ | |
| 399 | + uni.showToast({ | |
| 400 | + icon: 'none', | |
| 401 | + title: '请选择结束时间' | |
| 402 | + }) | |
| 403 | + return | |
| 404 | + } | |
| 405 | + this.model1.intendedLeaseTerm = e.range.before+'至'+e.range.after | |
| 406 | + }, | |
| 337 | 407 | typeChange(e) { |
| 338 | 408 | this.model1.entityType = e[0].label; |
| 339 | 409 | }, |
| ... | ... | @@ -384,221 +454,154 @@ |
| 384 | 454 | }); |
| 385 | 455 | }, |
| 386 | 456 | chek() { |
| 387 | - | |
| 388 | - if (!this.model1.operatorName) { | |
| 389 | - uni.showToast({ | |
| 390 | - icon: 'none', | |
| 391 | - title: '请输入经营者姓名' | |
| 392 | - }); | |
| 393 | - return; | |
| 394 | - } | |
| 395 | - if (!this.model1.idCardType) { | |
| 396 | - uni.showToast({ | |
| 397 | - icon: 'none', | |
| 398 | - title: '请选择证件类型' | |
| 399 | - }); | |
| 400 | - return; | |
| 401 | - } | |
| 402 | - if (!this.model1.idNumber) { | |
| 403 | - uni.showToast({ | |
| 404 | - icon: 'none', | |
| 405 | - title: '请输入身份证号码' | |
| 406 | - }); | |
| 407 | - return; | |
| 408 | - } | |
| 409 | - if (!this.model1.idValidStart) { | |
| 410 | - uni.showToast({ | |
| 411 | - icon: 'none', | |
| 412 | - title: '请选择有效开始时间' | |
| 413 | - }); | |
| 414 | - return; | |
| 415 | - } | |
| 416 | - if (!this.model1.idValidEnd) { | |
| 417 | - uni.showToast({ | |
| 418 | - icon: 'none', | |
| 419 | - title: '请选择有效结束时间' | |
| 420 | - }); | |
| 421 | - return; | |
| 422 | - } | |
| 423 | - if (!this.model1.idPhotoFront.length) { | |
| 424 | - uni.showToast({ | |
| 425 | - icon: 'none', | |
| 426 | - title: '请上传证件人像面' | |
| 427 | - }); | |
| 428 | - return; | |
| 429 | - } | |
| 430 | - if (!this.model1.idPhotoBack.length) { | |
| 431 | - uni.showToast({ | |
| 432 | - icon: 'none', | |
| 433 | - title: '请上传证件国徽面' | |
| 434 | - }); | |
| 435 | - return; | |
| 436 | - } | |
| 437 | - if (this.model1.isLegalPerson === null || this.model1.isLegalPerson === undefined) { | |
| 438 | - uni.showToast({ | |
| 439 | - icon: 'none', | |
| 440 | - title: '请选择是否为法人' | |
| 441 | - }); | |
| 442 | - return; | |
| 443 | - } | |
| 444 | - if (!this.model1.enterpriseAuthorization.length) { | |
| 445 | - uni.showToast({ | |
| 446 | - icon: 'none', | |
| 447 | - title: '请上传企业授权书' | |
| 448 | - }); | |
| 449 | - return; | |
| 450 | - } | |
| 451 | - }, | |
| 452 | - go() { | |
| 453 | - this.model1.rentalResourcesId = this.ziyuanId | |
| 454 | - this.model1.applicant = uni.getStorageSync('shopId') | |
| 455 | - this.model1.applicationTime = this.getCurrentTime() | |
| 456 | - this.chek() | |
| 457 | - console.log(this.model1) | |
| 458 | - let info = { | |
| 459 | - ...this.model1, | |
| 460 | - businessLicense:this.model1.businessLicense.replace(this.$img,''), | |
| 461 | - idPhotoFront:this.model1.idPhotoFront.replace(this.$img,''), | |
| 462 | - idPhotoBack:this.model1.idPhotoBack.replace(this.$img,''), | |
| 463 | - enterpriseAuthorization:this.model1.enterpriseAuthorization.replace(this.$img,''), | |
| 464 | - } | |
| 465 | - console.log(info) | |
| 466 | - // return | |
| 467 | - this.$http.sendRequest('/cereBusinessInfo/add', 'POST',info, 1).then(res => { | |
| 468 | - // uni.redirectTo({ | |
| 469 | - // url: '/pages/record/record' | |
| 470 | - // }) | |
| 471 | - uni.showToast({ | |
| 472 | - title: '提交成功', | |
| 473 | - icon: 'none', | |
| 474 | - }); | |
| 475 | - setTimeout(() => { | |
| 476 | - uni.navigateBack() | |
| 477 | - }, 1000) | |
| 478 | - | |
| 479 | - }) | |
| 480 | - }, | |
| 481 | - // 上一步 | |
| 482 | - toBefor() { | |
| 483 | - this.active = +this.active - 1; | |
| 484 | - }, | |
| 485 | - // 下一步 | |
| 486 | - toNext() { | |
| 487 | - if(this.active == '0') { | |
| 488 | - if (!this.model1.businessPurpose) { | |
| 489 | - uni.showToast({ | |
| 490 | - icon: 'none', | |
| 491 | - title: '请输入经营用途' | |
| 492 | - }); | |
| 493 | - return; | |
| 494 | - } | |
| 495 | - if (!this.model1.intendedLeaseTerm) { | |
| 496 | - uni.showToast({ | |
| 497 | - icon: 'none', | |
| 498 | - title: '请输入意向租期' | |
| 499 | - }); | |
| 500 | - return; | |
| 501 | - } | |
| 502 | - if (!this.model1.operatingEntity) { | |
| 503 | - uni.showToast({ | |
| 504 | - icon: 'none', | |
| 505 | - title: '请输入经营主体' | |
| 506 | - }); | |
| 507 | - return; | |
| 508 | - } | |
| 509 | - if (!this.model1.fangan) { | |
| 510 | - uni.showToast({ | |
| 511 | - icon: 'none', | |
| 512 | - title: '请选择租金方案' | |
| 513 | - }); | |
| 514 | - return; | |
| 515 | - } | |
| 516 | - } else if(this.active == '1') { | |
| 517 | 457 | if (!this.model1.entityName) { |
| 518 | 458 | uni.showToast({ |
| 519 | 459 | icon: 'none', |
| 520 | 460 | title: '请输入主体名称' |
| 521 | 461 | }); |
| 522 | - return; | |
| 462 | + return false; | |
| 523 | 463 | } |
| 524 | 464 | if (!this.model1.unifiedSocialCreditCode) { |
| 525 | 465 | uni.showToast({ |
| 526 | 466 | icon: 'none', |
| 527 | 467 | title: '请输入统一社会信用代码' |
| 528 | 468 | }); |
| 529 | - return; | |
| 469 | + return false; | |
| 530 | 470 | } |
| 531 | 471 | if (!this.model1.entityType) { |
| 532 | 472 | uni.showToast({ |
| 533 | 473 | icon: 'none', |
| 534 | 474 | title: '请选择主体类型' |
| 535 | 475 | }); |
| 536 | - return; | |
| 476 | + return false; | |
| 537 | 477 | } |
| 538 | 478 | if (!this.model1.legalRepresentative) { |
| 539 | 479 | uni.showToast({ |
| 540 | 480 | icon: 'none', |
| 541 | 481 | title: '请输入法定代表人' |
| 542 | 482 | }); |
| 543 | - return; | |
| 483 | + return false; | |
| 544 | 484 | } |
| 545 | 485 | if (!this.model1.businessScope) { |
| 546 | 486 | uni.showToast({ |
| 547 | 487 | icon: 'none', |
| 548 | 488 | title: '请输入经营范围' |
| 549 | 489 | }); |
| 550 | - return; | |
| 490 | + return false; | |
| 551 | 491 | } |
| 552 | 492 | if (!this.model1.registeredCapital) { |
| 553 | 493 | uni.showToast({ |
| 554 | 494 | icon: 'none', |
| 555 | 495 | title: '请输入注册资本' |
| 556 | 496 | }); |
| 557 | - return; | |
| 497 | + return false; | |
| 558 | 498 | } |
| 559 | 499 | if (!this.model1.establishmentDate) { |
| 560 | 500 | uni.showToast({ |
| 561 | 501 | icon: 'none', |
| 562 | 502 | title: '请输入成立日期' |
| 563 | 503 | }); |
| 564 | - return; | |
| 504 | + return false; | |
| 565 | 505 | } |
| 566 | 506 | if (!this.model1.residence) { |
| 567 | 507 | uni.showToast({ |
| 568 | 508 | icon: 'none', |
| 569 | 509 | title: '请输入住所' |
| 570 | 510 | }); |
| 571 | - return; | |
| 511 | + return false; | |
| 572 | 512 | } |
| 573 | 513 | if (!this.model1.emailAddress) { |
| 574 | 514 | uni.showToast({ |
| 575 | 515 | icon: 'none', |
| 576 | 516 | title: '请输入邮箱地址' |
| 577 | 517 | }); |
| 578 | - return; | |
| 518 | + return false; | |
| 579 | 519 | } |
| 580 | 520 | if (!this.model1.businessStartDate) { |
| 581 | 521 | uni.showToast({ |
| 582 | 522 | icon: 'none', |
| 583 | 523 | title: '请选择经营开始时间' |
| 584 | 524 | }); |
| 585 | - return; | |
| 525 | + return false; | |
| 586 | 526 | } |
| 587 | 527 | if (!this.model1.businessEndDate) { |
| 588 | 528 | uni.showToast({ |
| 589 | 529 | icon: 'none', |
| 590 | 530 | title: '请选择经营结束时间' |
| 591 | 531 | }); |
| 592 | - return; | |
| 532 | + return false; | |
| 593 | 533 | } |
| 594 | 534 | if (!this.model1.businessLicense) { |
| 595 | 535 | uni.showToast({ |
| 596 | 536 | icon: 'none', |
| 597 | 537 | title: '请上传营业执照' |
| 598 | 538 | }); |
| 539 | + return false; | |
| 540 | + } | |
| 541 | + return true; | |
| 542 | + }, | |
| 543 | + go() { | |
| 544 | + this.model1.rentalResourcesId = this.ziyuanId | |
| 545 | + this.model1.applicant = uni.getStorageSync('user').phone | |
| 546 | + this.model1.applicationTime = this.getCurrentTime() | |
| 547 | + let show = this.chek() | |
| 548 | + if(show == false){ | |
| 549 | + return | |
| 550 | + } | |
| 551 | + console.log(this.model1.applicant) | |
| 552 | + let info = { | |
| 553 | + ...this.model1, | |
| 554 | + businessLicense:this.model1.businessLicense.replace(this.$img,''), | |
| 555 | + // idPhotoFront:this.model1.idPhotoFront.replace(this.$img,''), | |
| 556 | + // idPhotoBack:this.model1.idPhotoBack.replace(this.$img,''), | |
| 557 | + // enterpriseAuthorization:this.model1.enterpriseAuthorization.replace(this.$img,''), | |
| 558 | + } | |
| 559 | + | |
| 560 | + // return | |
| 561 | + this.$http.sendRequest('/cereBusinessInfo/add', 'POST',info, 1).then(res => { | |
| 562 | + // uni.redirectTo({ | |
| 563 | + // url: '/pages/record/record' | |
| 564 | + // }) | |
| 565 | + uni.showToast({ | |
| 566 | + title: '提交成功', | |
| 567 | + icon: 'none', | |
| 568 | + }); | |
| 569 | + setTimeout(() => { | |
| 570 | + uni.navigateBack() | |
| 571 | + }, 1000) | |
| 572 | + | |
| 573 | + }) | |
| 574 | + }, | |
| 575 | + // 上一步 | |
| 576 | + toBefor() { | |
| 577 | + this.active = +this.active - 1; | |
| 578 | + }, | |
| 579 | + // 下一步 | |
| 580 | + toNext() { | |
| 581 | + if(this.active == '0') { | |
| 582 | + if (!this.model1.intendedLeaseTerm) { | |
| 583 | + uni.showToast({ | |
| 584 | + icon: 'none', | |
| 585 | + title: '请选择租赁周期' | |
| 586 | + }); | |
| 587 | + return; | |
| 588 | + } | |
| 589 | + if (!this.model1.businessPurpose) { | |
| 590 | + uni.showToast({ | |
| 591 | + icon: 'none', | |
| 592 | + title: '请输入经营用途' | |
| 593 | + }); | |
| 594 | + return; | |
| 595 | + } | |
| 596 | + if (!this.model1.fangan) { | |
| 597 | + uni.showToast({ | |
| 598 | + icon: 'none', | |
| 599 | + title: '请选择租金方案' | |
| 600 | + }); | |
| 599 | 601 | return; |
| 600 | 602 | } |
| 601 | 603 | } |
| 604 | + | |
| 602 | 605 | this.active = +this.active + 1; |
| 603 | 606 | }, |
| 604 | 607 | startTimeChange(val) { |
| ... | ... | @@ -628,6 +631,9 @@ |
| 628 | 631 | this.model1.businessStartDate = this.timeChange(val) |
| 629 | 632 | this.model1.businessEndDate = '' |
| 630 | 633 | }, |
| 634 | + establiChange(val){ | |
| 635 | + this.model1.establishmentDate = this.timeChange(val) | |
| 636 | + }, | |
| 631 | 637 | busEndTimeChange(val) { |
| 632 | 638 | const time = this.timeChange(val); |
| 633 | 639 | if (new Date(time).getTime() > new Date(this.model1.businessStartDate).getTime()) { | ... | ... |
lvdao-miniapp/pages/my/my.vue
| ... | ... | @@ -162,14 +162,14 @@ |
| 162 | 162 | <image :src="$imgUrl('/right2.png')"></image> |
| 163 | 163 | </view> |
| 164 | 164 | </view> --> |
| 165 | - <view class="list" @click="toPage('/pages/record/record')"> | |
| 165 | + <view class="list" @click="toPage('/pagesA/myZiyuan/myZiyuan')"> | |
| 166 | 166 | <view class="icon-data"> |
| 167 | 167 | <view class="icon"> |
| 168 | 168 | <image :src="$imgUrl('/my-icon2.png')" mode=""></image> |
| 169 | 169 | </view> |
| 170 | 170 | <view class="data"> |
| 171 | 171 | <view class="title"> |
| 172 | - <text>申请记录</text> | |
| 172 | + <text>我的租赁资产</text> | |
| 173 | 173 | </view> |
| 174 | 174 | </view> |
| 175 | 175 | </view> |
| ... | ... | @@ -177,14 +177,14 @@ |
| 177 | 177 | <image :src="$imgUrl('/right2.png')"></image> |
| 178 | 178 | </view> |
| 179 | 179 | </view> |
| 180 | - <view class="list" @click="toPage('/pages/serve/serve')"> | |
| 180 | + <view class="list" @click="toPage('/pages/record/record')"> | |
| 181 | 181 | <view class="icon-data"> |
| 182 | 182 | <view class="icon"> |
| 183 | 183 | <image :src="$imgUrl('/my-icon2.png')" mode=""></image> |
| 184 | 184 | </view> |
| 185 | 185 | <view class="data"> |
| 186 | 186 | <view class="title"> |
| 187 | - <text>服务记录</text> | |
| 187 | + <text>申请记录</text> | |
| 188 | 188 | </view> |
| 189 | 189 | </view> |
| 190 | 190 | </view> |
| ... | ... | @@ -192,14 +192,14 @@ |
| 192 | 192 | <image :src="$imgUrl('/right2.png')"></image> |
| 193 | 193 | </view> |
| 194 | 194 | </view> |
| 195 | - <view class="list" @click="repair"> | |
| 195 | + <view class="list" @click="toPage('/pages/serve/serve')"> | |
| 196 | 196 | <view class="icon-data"> |
| 197 | 197 | <view class="icon"> |
| 198 | - <image :src="$imgUrl('/my-icon3.png')" mode=""></image> | |
| 198 | + <image :src="$imgUrl('/my-icon2.png')" mode=""></image> | |
| 199 | 199 | </view> |
| 200 | 200 | <view class="data"> |
| 201 | 201 | <view class="title"> |
| 202 | - <text>报事报修</text> | |
| 202 | + <text>服务记录</text> | |
| 203 | 203 | </view> |
| 204 | 204 | </view> |
| 205 | 205 | </view> |
| ... | ... | @@ -207,14 +207,14 @@ |
| 207 | 207 | <image :src="$imgUrl('/right2.png')"></image> |
| 208 | 208 | </view> |
| 209 | 209 | </view> |
| 210 | - <view class="list" @click="complaint"> | |
| 210 | + <view class="list" @click="repair"> | |
| 211 | 211 | <view class="icon-data"> |
| 212 | 212 | <view class="icon"> |
| 213 | - <image :src="$imgUrl('/my-icon2.png')" mode=""></image> | |
| 213 | + <image :src="$imgUrl('/my-icon3.png')" mode=""></image> | |
| 214 | 214 | </view> |
| 215 | 215 | <view class="data"> |
| 216 | 216 | <view class="title"> |
| 217 | - <text>投诉建议</text> | |
| 217 | + <text>报事报修</text> | |
| 218 | 218 | </view> |
| 219 | 219 | </view> |
| 220 | 220 | </view> |
| ... | ... | @@ -222,21 +222,22 @@ |
| 222 | 222 | <image :src="$imgUrl('/right2.png')"></image> |
| 223 | 223 | </view> |
| 224 | 224 | </view> |
| 225 | - <!-- <view class="list" @click="handleApplySettle"> | |
| 225 | + <view class="list" @click="complaint"> | |
| 226 | 226 | <view class="icon-data"> |
| 227 | 227 | <view class="icon"> |
| 228 | - <image :src="$imgUrl('/my-icon4.png')" mode=""></image> | |
| 228 | + <image :src="$imgUrl('/my-icon2.png')" mode=""></image> | |
| 229 | 229 | </view> |
| 230 | 230 | <view class="data"> |
| 231 | 231 | <view class="title"> |
| 232 | - <text>商城入驻申请</text> | |
| 232 | + <text>投诉建议</text> | |
| 233 | 233 | </view> |
| 234 | 234 | </view> |
| 235 | 235 | </view> |
| 236 | 236 | <view class="more"> |
| 237 | 237 | <image :src="$imgUrl('/right2.png')"></image> |
| 238 | 238 | </view> |
| 239 | - </view> --> | |
| 239 | + </view> | |
| 240 | + | |
| 240 | 241 | </view> |
| 241 | 242 | </view> |
| 242 | 243 | <!-- tabbar --> |
| ... | ... | @@ -455,44 +456,7 @@ |
| 455 | 456 | } |
| 456 | 457 | |
| 457 | 458 | }, |
| 458 | - handleApplySettle() { | |
| 459 | - // uni.navigateTo({ | |
| 460 | - // url: '/pages/myzili/myzili' | |
| 461 | - // }) | |
| 462 | - const res = uni.getStorageSync('token'); | |
| 463 | - let token = Encrypt(res) | |
| 464 | - let username = this.shopMsg.shopName | |
| 465 | - // let url = 'http://8.130.38.56:8027/settled-merchant' | |
| 466 | - let url = 'https://jy.scjysm.asia:18086/settled-merchant' | |
| 467 | - | |
| 468 | - // #ifdef H5 | |
| 469 | - console.log('h5 test') | |
| 470 | - window.location.href = url + `/#/?username=${ username }&user=${ token }` | |
| 471 | - // #endif | |
| 472 | - // #ifdef APP-PLUS | |
| 473 | - plus.runtime.openURL(url + `/#/?username=${ username }&user=${ token }`, function( | |
| 474 | - e) { | |
| 475 | - console.log(e); | |
| 476 | - }) | |
| 477 | - // #endif | |
| 478 | - // #ifdef MP-WEIXIN | |
| 479 | - uni.navigateTo({ | |
| 480 | - url: `../linkOthers/index?url=${ url }&username=${ username }&user=${ token }` | |
| 481 | - // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址 | |
| 482 | - // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url) | |
| 483 | - // url:'../../../pages_category_page2/userModule/coupon' | |
| 484 | - }) | |
| 485 | - // #endif | |
| 486 | - // #ifdef MP-ALIPAY | |
| 487 | - uni.navigateTo({ | |
| 488 | - url: `../linkOthers/index?url=${ url }&username=${ username }&user=${ token }` | |
| 489 | - // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址 | |
| 490 | - // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url) | |
| 491 | - // url:'../../../pages_category_page2/userModule/coupon' | |
| 492 | - }) | |
| 493 | - // #endif | |
| 494 | - | |
| 495 | - }, | |
| 459 | + | |
| 496 | 460 | myMsg() { |
| 497 | 461 | const res = uni.getStorageSync('token'); |
| 498 | 462 | if (res == '') { | ... | ... |
lvdao-miniapp/pages/record/record.vue
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | <view class="right"><u-icon name="arrow-rightward"></u-icon></view> |
| 16 | 16 | </view> |
| 17 | 17 | <view class="info-item">申请时间:{{item.applicationTime}}</view> |
| 18 | - <view class="info-item">状态:<span style="color: #0FBB59;">{{item.auditStatus == '1'?'待审核':item.auditStatus == '2'?'审核通过':item.auditStatus == '3'?'已驳回':''}}</span></view> | |
| 18 | + <view class="info-item">状态:<span style="color: #0FBB59;">{{item.auditStatus =='1'?'待审核':item.auditStatus =='2'?'待签约':item.auditStatus =='3'?'已驳回':item.auditStatus =='4'?'已签约':'已终止'}}</span></view> | |
| 19 | 19 | </view> |
| 20 | 20 | </view> |
| 21 | 21 | </view> |
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | }, |
| 39 | 39 | methods: { |
| 40 | 40 | getALL(){ |
| 41 | - this.pageindex.applicant =uni.getStorageSync('shopId') | |
| 41 | + this.pageindex.applicant =uni.getStorageSync('user').phone | |
| 42 | 42 | this.$http.sendRequest('/cereBusinessInfo/queryByPage', 'POST', this.pageindex,1).then(res => { |
| 43 | 43 | //成功回调 |
| 44 | 44 | ... | ... |
lvdao-miniapp/pages/repair/repair.vue
| ... | ... | @@ -6,13 +6,13 @@ |
| 6 | 6 | <view> |
| 7 | 7 | <view class="title"> |
| 8 | 8 | <text style="font-weight: bold;">现场照片</text> |
| 9 | - <!-- <text class="star">*</text> --> | |
| 9 | + | |
| 10 | 10 | </view> |
| 11 | 11 | </view> |
| 12 | 12 | <view class="voucher-img"> |
| 13 | 13 | <view class="voucher-list"> |
| 14 | - <!-- <image :src="$imgUrl('/voucher_bg.png')" ></image> --> | |
| 15 | - <u-upload :action="$upload" :auto-upload="true" ref="uUpload" ></u-upload> | |
| 14 | + <u-upload :action="$upload" :auto-upload="false" ref="uUpload" :max-count="1" | |
| 15 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'uUpload')"></u-upload> | |
| 16 | 16 | </view> |
| 17 | 17 | </view> |
| 18 | 18 | </view> |
| ... | ... | @@ -72,7 +72,7 @@ |
| 72 | 72 | <view class="voucher-img"> |
| 73 | 73 | <view class="voucher-list" style="width: 100%;"> |
| 74 | 74 | <view class="" style="background-color: #F0F0F0;border-radius: 20rpx;"> |
| 75 | - <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx 0;" v-model="ruleForm.memo"></textarea> | |
| 75 | + <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx;" v-model="ruleForm.memo"></textarea> | |
| 76 | 76 | </view> |
| 77 | 77 | </view> |
| 78 | 78 | </view> |
| ... | ... | @@ -83,11 +83,7 @@ |
| 83 | 83 | <u-select v-model="popup2" mode="mutil-column-auto" :list="list1" @confirm="pops1" label-name="label" value-name="value"></u-select> |
| 84 | 84 | <!-- 保存按钮 --> |
| 85 | 85 | <view class="page-footer"> |
| 86 | - <view class="footer-buy"> | |
| 87 | - <view class="cart-add" @click="submit"> | |
| 88 | - <text>提交</text> | |
| 89 | - </view> | |
| 90 | - </view> | |
| 86 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="submit">提交</u-button> | |
| 91 | 87 | </view> |
| 92 | 88 | </view> |
| 93 | 89 | </template> |
| ... | ... | @@ -145,18 +141,14 @@ |
| 145 | 141 | this.ruleForm.deviceType = val[0].label |
| 146 | 142 | }, |
| 147 | 143 | submit() { |
| 148 | - let files = [] | |
| 149 | - // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作) | |
| 150 | - files = this.$refs.uUpload.lists.filter(val => { | |
| 151 | - return val.progress == 100; | |
| 152 | - }) | |
| 153 | - // 如果您不需要进行太多的处理,直接如下即可 | |
| 154 | - // files = this.$refs.uUpload.lists; | |
| 155 | - files.map(item=>{ | |
| 156 | - this.ruleForm.onSitePhoto = item.response.data.url | |
| 157 | - }) | |
| 144 | + | |
| 158 | 145 | this.ruleForm.applicationTime = this.currentTime() |
| 159 | - this.$http.sendRequest('/cereReportIssuesRepairs/add', 'POST',this.ruleForm,1).then(res => { | |
| 146 | + this.ruleForm.createUser = uni.getStorageSync('user').phone | |
| 147 | + let info = { | |
| 148 | + ...this.ruleForm, | |
| 149 | + onSitePhoto:this.ruleForm.onSitePhoto.replace(this.$img,''), | |
| 150 | + } | |
| 151 | + this.$http.sendRequest('/cereReportIssuesRepairs/add', 'POST',info,1).then(res => { | |
| 160 | 152 | uni.navigateTo({ |
| 161 | 153 | url: '/pages/serve/serve' |
| 162 | 154 | }) |
| ... | ... | @@ -187,6 +179,31 @@ |
| 187 | 179 | let strDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| 188 | 180 | return strDate; |
| 189 | 181 | }, |
| 182 | + onsuccess1(e, file, fileList, ziduan) { | |
| 183 | + console.error(e, file, fileList, ziduan) | |
| 184 | + uni.uploadFile({ | |
| 185 | + url: this.$upload, // 仅为示例,请替换为您的服务器上传接口 | |
| 186 | + filePath: e[0].url, | |
| 187 | + name: 'file', // 后端接收的文件参数名 | |
| 188 | + formData: { | |
| 189 | + filePath: 'xcx', // 其他表单数据 | |
| 190 | + }, | |
| 191 | + success: (uploadFileRes) => { | |
| 192 | + this.ruleForm.onSitePhoto= this.$img + JSON.parse(uploadFileRes.data).data | |
| 193 | + uni.showToast({ | |
| 194 | + title: '上传成功', | |
| 195 | + icon: 'success', | |
| 196 | + }); | |
| 197 | + }, | |
| 198 | + fail: (err) => { | |
| 199 | + console.error('上传失败', err); | |
| 200 | + uni.showToast({ | |
| 201 | + title: '上传失败', | |
| 202 | + icon: 'none', | |
| 203 | + }); | |
| 204 | + }, | |
| 205 | + }); | |
| 206 | + }, | |
| 190 | 207 | } |
| 191 | 208 | } |
| 192 | 209 | </script> | ... | ... |
lvdao-miniapp/pages/saleReport/saleReport.vue
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | <view class="up_line"></view> |
| 33 | 33 | <view class="item"> |
| 34 | 34 | <view class="title"> |
| 35 | - 价格 | |
| 35 | + 单价 | |
| 36 | 36 | </view> |
| 37 | 37 | <view class="inputContent"> |
| 38 | 38 | <input type="text" v-model="item.price" placeholder="请输入" /> |
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | }, |
| 112 | 112 | go(){ |
| 113 | 113 | this.items.map(tem=>{ |
| 114 | - tem.merchantId = uni.getStorageSync('shopId') | |
| 114 | + tem.merchantId = uni.getStorageSync('user').phone | |
| 115 | 115 | this.$http.sendRequest('/cereSalesReporting/add', 'POST',tem,1).then(res => { |
| 116 | 116 | uni.showModal({ |
| 117 | 117 | title: '上报成功', | ... | ... |
lvdao-miniapp/pages/salesReporting/salesReporting.vue
| ... | ... | @@ -10,8 +10,8 @@ |
| 10 | 10 | <view class="title" style="font-size: 26rpx;"> |
| 11 | 11 | 今日销售金额 |
| 12 | 12 | </view> |
| 13 | - <view class="num">21</view> | |
| 14 | - <view>同比昨日上升5</view> | |
| 13 | + <view class="num">{{todayRe}}</view> | |
| 14 | + <view>同比昨日<span>{{subtract}}</span></view> | |
| 15 | 15 | </view> |
| 16 | 16 | <!-- <view class="cardOne"> |
| 17 | 17 | <view class="title"> |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | </view> |
| 26 | 26 | <view class="" style="width: 96%;margin: 0 auto;background-color: #fff;border-radius: 20rpx;margin-top: 20rpx;"> |
| 27 | 27 | <view class="" style="width: 96%;margin: 0 auto;padding: 20rpx 20rpx;"> |
| 28 | - <view style="font-weight: bold;font-size: 28rpx;">营业额趋势</view> | |
| 28 | + <view style="font-weight: bold;font-size: 28rpx;">营业额趋势(周)</view> | |
| 29 | 29 | <view style="height: 300px;width: 100%;margin-top: 20rpx;"> |
| 30 | 30 | <qiun-data-charts type="line" :opts="opts" :chartData="chartData" /> |
| 31 | 31 | </view> |
| ... | ... | @@ -51,32 +51,33 @@ |
| 51 | 51 | return { |
| 52 | 52 | chart: null, |
| 53 | 53 | chartData: {}, |
| 54 | + todayRe:0, | |
| 55 | + subtract:0, | |
| 54 | 56 | opts: { |
| 55 | - color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", | |
| 56 | - "#ea7ccc" | |
| 57 | - ], | |
| 58 | - padding: [15, 10, 0, 15], | |
| 59 | - enableScroll: false, | |
| 60 | - legend: {}, | |
| 61 | - xAxis: { | |
| 62 | - disableGrid: true | |
| 63 | - }, | |
| 64 | - yAxis: { | |
| 65 | - gridType: "dash", | |
| 66 | - dashLength: 2 | |
| 67 | - }, | |
| 68 | - extra: { | |
| 69 | - line: { | |
| 70 | - type: "straight", | |
| 71 | - width: 2, | |
| 72 | - activeType: "hollow" | |
| 73 | - } | |
| 74 | - } | |
| 75 | - }, | |
| 57 | + color: ["#3CA272"], | |
| 58 | + padding: [15,10,0,15], | |
| 59 | + enableScroll: false, | |
| 60 | + legend: {}, | |
| 61 | + xAxis: { | |
| 62 | + disableGrid: true, | |
| 63 | + fontSize: 10, // 设置X轴字体大小 | |
| 64 | + }, | |
| 65 | + yAxis: { | |
| 66 | + gridType: "dash", | |
| 67 | + dashLength: 2 | |
| 68 | + }, | |
| 69 | + extra: { | |
| 70 | + line: { | |
| 71 | + type: "curve", | |
| 72 | + width: 2, | |
| 73 | + activeType: "hollow" | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + }, | |
| 76 | 78 | chartData1: {}, |
| 77 | 79 | opts1: { |
| 78 | - color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", | |
| 79 | - "#ea7ccc" | |
| 80 | + color: ["#3CA272" | |
| 80 | 81 | ], |
| 81 | 82 | padding: [15, 30, 0, 5], |
| 82 | 83 | enableScroll: false, |
| ... | ... | @@ -86,9 +87,12 @@ |
| 86 | 87 | disableGrid: false, |
| 87 | 88 | min: 0, |
| 88 | 89 | axisLine: false, |
| 89 | - max: 70 | |
| 90 | + AllyDecimals: false, | |
| 91 | + | |
| 92 | + }, | |
| 93 | + yAxis: { | |
| 94 | + | |
| 90 | 95 | }, |
| 91 | - yAxis: {}, | |
| 92 | 96 | extra: { |
| 93 | 97 | bar: { |
| 94 | 98 | type: "stack", |
| ... | ... | @@ -111,44 +115,79 @@ |
| 111 | 115 | }, |
| 112 | 116 | methods: { |
| 113 | 117 | getServerData() { |
| 114 | - //模拟从服务器获取数据时的延时 | |
| 115 | - setTimeout(() => { | |
| 116 | - //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 | |
| 117 | - let res = { | |
| 118 | - categories: ["2020", "2021", "2022", "2023", "2024", "2025"], | |
| 119 | - series: [{ | |
| 120 | - name: "成交量A", | |
| 121 | - data: [0, 0, 0, 0, 4,0] | |
| 122 | - }, | |
| 123 | - { | |
| 124 | - name: "成交量B", | |
| 125 | - data: [0,0 ,0, 0, 44, 0] | |
| 126 | - }, | |
| 127 | - { | |
| 128 | - name: "成交量C", | |
| 129 | - data: [0, 0, 0, 0, 112, 0] | |
| 130 | - } | |
| 131 | - ] | |
| 132 | - }; | |
| 133 | - this.chartData = JSON.parse(JSON.stringify(res)); | |
| 134 | - }, 500); | |
| 135 | - | |
| 136 | - setTimeout(() => { | |
| 137 | - //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 | |
| 138 | - let res = { | |
| 139 | - categories: ["2020", "2021", "2022", "2023", "2024", "2025"], | |
| 140 | - series: [{ | |
| 141 | - name: "目标值", | |
| 142 | - data: [0, 0, 0,0 ,13, 0] | |
| 143 | - }, | |
| 144 | - { | |
| 145 | - name: "完成量", | |
| 146 | - data: [0, 0, 0, 0, 6, 0] | |
| 147 | - } | |
| 148 | - ] | |
| 149 | - }; | |
| 150 | - this.chartData1 = JSON.parse(JSON.stringify(res)); | |
| 151 | - }, 500); | |
| 118 | + let ids = uni.getStorageSync('user').phone | |
| 119 | + this.$http.sendRequest(`/cereSalesReporting/salesStatistics/${ids}`, 'GET',{},1).then(res => { | |
| 120 | + this.subtract = res.data.data.subtract | |
| 121 | + this.todayRe = res.data.data.todayRe | |
| 122 | + let salesRankingCate = [] | |
| 123 | + let salesRankingSeries =[] | |
| 124 | + res.data.data.salesRanking.map(item=>{ | |
| 125 | + salesRankingCate.push(item.productName) | |
| 126 | + salesRankingSeries.push(item.salesQuantity) | |
| 127 | + }) | |
| 128 | + let objList = { | |
| 129 | + categories:salesRankingCate, | |
| 130 | + series: [{ | |
| 131 | + name: "数量", | |
| 132 | + data: salesRankingSeries, | |
| 133 | + } | |
| 134 | + ] | |
| 135 | + } | |
| 136 | + | |
| 137 | + let turnoverDetailSeries =[] | |
| 138 | + let objMsg ={ | |
| 139 | + name:'销售额', | |
| 140 | + data:[0,0,0,0,0,0,0] | |
| 141 | + } | |
| 142 | + res.data.data.sameDaySalesVOS.map(item=>{ | |
| 143 | + | |
| 144 | + | |
| 145 | + if(this.getWeekday(item.saleTime) == '周一'){ | |
| 146 | + objMsg.data[0] = item.price | |
| 147 | + }else if(this.getWeekday(item.saleTime) == '周二'){ | |
| 148 | + objMsg.data[1] = item.price | |
| 149 | + }else if(this.getWeekday(item.saleTime) == '周三'){ | |
| 150 | + objMsg.data[2] = item.price | |
| 151 | + }else if(this.getWeekday(item.saleTime) == '周四'){ | |
| 152 | + objMsg.data[3] = item.price | |
| 153 | + }else if(this.getWeekday(item.saleTime) == '周五'){ | |
| 154 | + objMsg.data[4] = item.price | |
| 155 | + }else if(this.getWeekday(item.saleTime) == '周六'){ | |
| 156 | + objMsg.data[5] = item.price | |
| 157 | + }else if(this.getWeekday(item.saleTime) == '周天'){ | |
| 158 | + objMsg.data[6] = item.price | |
| 159 | + } | |
| 160 | + | |
| 161 | + | |
| 162 | + }) | |
| 163 | + turnoverDetailSeries.push(objMsg) | |
| 164 | + this.chartData1 = JSON.parse(JSON.stringify(objList)) | |
| 165 | + let qushi = { | |
| 166 | + categories: ["周一", "周二", "周三", "周四", "周五", "周六","周天"], | |
| 167 | + series: turnoverDetailSeries | |
| 168 | + } | |
| 169 | + this.chartData = JSON.parse(JSON.stringify(qushi)) | |
| 170 | + | |
| 171 | + }) | |
| 172 | + | |
| 173 | + | |
| 174 | + }, | |
| 175 | + getWeekday(dateString) { | |
| 176 | + // 解析日期字符串 | |
| 177 | + const date = new Date(dateString) | |
| 178 | + | |
| 179 | + // 检查日期是否有效 | |
| 180 | + if (isNaN(date)) { | |
| 181 | + throw new Error('无效的日期格式。请使用 "YYYY-M-D" 或 "YYYY-MM-DD" 格式。') | |
| 182 | + } | |
| 183 | + | |
| 184 | + // 定义星期的中文表示 | |
| 185 | + const weekdays = ["周一", "周二", "周三", "周四", "周五", "周六","周天"] | |
| 186 | + | |
| 187 | + // 获取星期几(0-6) | |
| 188 | + const dayIndex = date.getDay() | |
| 189 | + | |
| 190 | + return weekdays[dayIndex] | |
| 152 | 191 | }, |
| 153 | 192 | // 跳转到销售上报页面 |
| 154 | 193 | toSaleReport(){ | ... | ... |
lvdao-miniapp/pages/salesSta/salesSta.vue
| ... | ... | @@ -47,25 +47,26 @@ |
| 47 | 47 | chart: null, |
| 48 | 48 | chartData: {}, |
| 49 | 49 | opts: { |
| 50 | - color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"], | |
| 51 | - padding: [15,10,0,15], | |
| 52 | - enableScroll: false, | |
| 53 | - legend: {}, | |
| 54 | - xAxis: { | |
| 55 | - disableGrid: true | |
| 56 | - }, | |
| 57 | - yAxis: { | |
| 58 | - gridType: "dash", | |
| 59 | - dashLength: 2 | |
| 60 | - }, | |
| 61 | - extra: { | |
| 62 | - line: { | |
| 63 | - type: "straight", | |
| 64 | - width: 2, | |
| 65 | - activeType: "hollow" | |
| 66 | - } | |
| 67 | - } | |
| 68 | - }, | |
| 50 | + color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"], | |
| 51 | + padding: [15,10,0,15], | |
| 52 | + enableScroll: false, | |
| 53 | + legend: {}, | |
| 54 | + xAxis: { | |
| 55 | + disableGrid: true | |
| 56 | + }, | |
| 57 | + yAxis: { | |
| 58 | + gridType: "dash", | |
| 59 | + dashLength: 2 | |
| 60 | + }, | |
| 61 | + extra: { | |
| 62 | + line: { | |
| 63 | + type: "curve", | |
| 64 | + width: 2, | |
| 65 | + activeType: "hollow" | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + }, | |
| 69 | 70 | chartData1:{}, |
| 70 | 71 | opts1: { |
| 71 | 72 | color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"], |
| ... | ... | @@ -122,7 +123,7 @@ |
| 122 | 123 | } |
| 123 | 124 | ] |
| 124 | 125 | }; |
| 125 | - this.chartData = JSON.parse(JSON.stringify(res)); | |
| 126 | + this.chartData = JSON.parse(JSON.stringify(res)) | |
| 126 | 127 | }, 500); |
| 127 | 128 | |
| 128 | 129 | setTimeout(() => { | ... | ... |
lvdao-miniapp/pages/serve/serve.vue
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | }, |
| 52 | 52 | methods: { |
| 53 | 53 | getALL(){ |
| 54 | - this.pageindex.applicant =uni.getStorageSync('shopId') | |
| 54 | + this.pageindex.createUser =uni.getStorageSync('user').phone | |
| 55 | 55 | this.$http.sendRequest('/cereReportIssuesRepairs/queryByPage', 'POST',this.pageindex,1).then(res => { |
| 56 | 56 | this.recordList = res.data.data.content |
| 57 | 57 | }).catch(err => { | ... | ... |
lvdao-miniapp/pages/shops/shops.vue
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | <view class="goods-list"> |
| 31 | 31 | <view class="list" v-for="(item,index) in tableData" :key="index" @click="reconciliationdetail(item)"> |
| 32 | 32 | <view class="thumb"> |
| 33 | - <u-image width="25vw" height="25vw" :src="$img + (item.displayMainImage || item.locationDiagram || item.displayImage) | getimgurl"></u-image> | |
| 33 | + <u-image width="25vw" height="25vw" border-radius="20" :src="$img + (item.displayMainImage || item.locationDiagram || item.displayImage) | getimgurl"></u-image> | |
| 34 | 34 | <!-- <image :src="item.displayMainImage" mode=""></image> --> |
| 35 | 35 | </view> |
| 36 | 36 | <view class="item"> |
| ... | ... | @@ -129,13 +129,14 @@ |
| 129 | 129 | query: { |
| 130 | 130 | shopName:'', |
| 131 | 131 | belongingRegion: '', |
| 132 | - pageNumber: 1, | |
| 132 | + pageNumber: 0, | |
| 133 | 133 | pageSize: 10 , |
| 134 | + publishStatus:2 | |
| 134 | 135 | }, |
| 135 | 136 | pageindex: { |
| 136 | 137 | pageNumber: 0, |
| 137 | 138 | pageSize: 10, |
| 138 | - publishStatus:'1' | |
| 139 | + publishStatus:2 | |
| 139 | 140 | }, |
| 140 | 141 | tableData: [], |
| 141 | 142 | areList: [ | ... | ... |
lvdao-miniapp/pagesA/moreZu/moreZu.scss
0 → 100644
| 1 | +.page{ | |
| 2 | + position: absolute; | |
| 3 | + left: 0; | |
| 4 | + top: 0; | |
| 5 | + width: 100%; | |
| 6 | + padding: 15px; | |
| 7 | + overflow-y: scroll; | |
| 8 | + height: calc(100% - 120rpx); | |
| 9 | + background-color: #f6f6f6; | |
| 10 | +} | |
| 11 | +.cardZu{ | |
| 12 | + background-color: #fff; | |
| 13 | + padding: 15px; | |
| 14 | + border-radius: 10px; | |
| 15 | + margin-bottom: 15px; | |
| 16 | +} | |
| 17 | +.zuTitle{ | |
| 18 | + padding-bottom: 10px; | |
| 19 | + border-bottom: 1px solid #F5F5F5; | |
| 20 | + font-size: 18px; | |
| 21 | +} | |
| 22 | +.youTitle{ | |
| 23 | + font-size: 16px; | |
| 24 | +} | |
| 25 | +.youcont{ | |
| 26 | + color: #94969C; | |
| 27 | + padding: 10px 0; | |
| 28 | + font-size: 16px; | |
| 29 | +} | |
| 0 | 30 | \ No newline at end of file | ... | ... |
lvdao-miniapp/pagesA/moreZu/moreZu.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <view class="cardZu" v-for="(item,index) in moban"> | |
| 4 | + <view class="zuTitle">{{item.policyName}}</view> | |
| 5 | + <view class=""> | |
| 6 | + <view style="padding: 10rpx; color: #3f9b6a;font-size: 16px;padding: 15px 0;"> | |
| 7 | + {{item.rentalPrice}}元/{{item.leaseTerm}} | |
| 8 | + </view> | |
| 9 | + <view class="youTitle"> | |
| 10 | + 优惠政策: | |
| 11 | + </view> | |
| 12 | + <view class="youcont"> | |
| 13 | + <u-parse :html="item.preferentialPolicy"></u-parse> | |
| 14 | + </view> | |
| 15 | + <view class="youTitle"> | |
| 16 | + 其他说明: | |
| 17 | + </view> | |
| 18 | + <view class="youcont"> | |
| 19 | + <u-parse :html="item.otherDescription"></u-parse> | |
| 20 | + </view> | |
| 21 | + </view> | |
| 22 | + </view> | |
| 23 | + </view> | |
| 24 | +</template> | |
| 25 | + | |
| 26 | +<script> | |
| 27 | + export default { | |
| 28 | + data() { | |
| 29 | + return { | |
| 30 | + paesize: { | |
| 31 | + pageNumber: 0, | |
| 32 | + pageSize: 100, | |
| 33 | + resourcesId: '' | |
| 34 | + | |
| 35 | + }, | |
| 36 | + moban: [], | |
| 37 | + zhengce:'' | |
| 38 | + }; | |
| 39 | + }, | |
| 40 | + onLoad(opting) { | |
| 41 | + | |
| 42 | + this.paesize.resourcesId = opting.resourcesId | |
| 43 | + }, | |
| 44 | + onShow() { | |
| 45 | + this.getAll() | |
| 46 | + | |
| 47 | + }, | |
| 48 | + methods: { | |
| 49 | + getAll(){ | |
| 50 | + this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', this.paesize,1).then(res => { | |
| 51 | + this.moban = res.data.data | |
| 52 | + }) | |
| 53 | + } | |
| 54 | + } | |
| 55 | + } | |
| 56 | +</script> | |
| 57 | + | |
| 58 | +<style scoped lang="scss"> | |
| 59 | + @import 'moreZu.scss'; | |
| 60 | +</style> | |
| 0 | 61 | \ No newline at end of file | ... | ... |
lvdao-miniapp/pagesA/myZiyuan/addMyshop.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <view class="item"> | |
| 4 | + <view class="contents" style="background-color:#fff;padding:10px 20px;"> | |
| 5 | + <view class="feedback-data"> | |
| 6 | + <view> | |
| 7 | + <view class="title"> | |
| 8 | + <text style="font-weight: bold;">*店内照片</text> | |
| 9 | + <!-- <text class="star">*</text> --> | |
| 10 | + </view> | |
| 11 | + </view> | |
| 12 | + <view class="voucher-img"> | |
| 13 | + <view class="voucher-list"> | |
| 14 | + <u-upload :action="$upload" :auto-upload="false" ref="coverImage" :max-count="5" | |
| 15 | + @on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'coverImage')"></u-upload> | |
| 16 | + </view> | |
| 17 | + </view> | |
| 18 | + </view> | |
| 19 | + </view> | |
| 20 | + </view> | |
| 21 | + <view class="item"> | |
| 22 | + <view class="contents"> | |
| 23 | + <view class="add-list"> | |
| 24 | + <view class="list"> | |
| 25 | + <view class="title"> | |
| 26 | + <text style="font-weight: bold;">*店铺名称</text> | |
| 27 | + <!-- <text class="star">*</text> --> | |
| 28 | + </view> | |
| 29 | + <view class="content"> | |
| 30 | + <input type="text" placeholder="请输入" v-model="ruleForm.deviceName"> | |
| 31 | + </view> | |
| 32 | + </view> | |
| 33 | + <view class="item"> | |
| 34 | + <view class="contents" style="background-color:#fff;"> | |
| 35 | + <view class="feedback-data"> | |
| 36 | + <view> | |
| 37 | + <view class="title"> | |
| 38 | + <text style="font-weight: bold;">*店铺介绍</text> | |
| 39 | + <!-- <text class="star">*</text> --> | |
| 40 | + </view> | |
| 41 | + </view> | |
| 42 | + <view class="voucher-img"> | |
| 43 | + <view class="voucher-list" style="width: 100%;"> | |
| 44 | + <view class="" style="background-color: #F0F0F0;border-radius: 20rpx;"> | |
| 45 | + <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx 0;padding:10px;" v-model="ruleForm.memo"></textarea> | |
| 46 | + </view> | |
| 47 | + </view> | |
| 48 | + </view> | |
| 49 | + </view> | |
| 50 | + </view> | |
| 51 | + </view> | |
| 52 | + <view class="list"> | |
| 53 | + <view class="title"> | |
| 54 | + <text style="font-weight: bold;">*联系电话</text> | |
| 55 | + <!-- <text class="star">*</text> --> | |
| 56 | + </view> | |
| 57 | + <view class="content"> | |
| 58 | + <input type="text" placeholder="请输入" v-model="ruleForm.deviceName"> | |
| 59 | + </view> | |
| 60 | + </view> | |
| 61 | + | |
| 62 | + | |
| 63 | + </view> | |
| 64 | + </view> | |
| 65 | + </view> | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + <view class="item"> | |
| 70 | + <view class="contents" style="background-color:#fff;padding:10px 20px;"> | |
| 71 | + <view class="feedback-data"> | |
| 72 | + <view> | |
| 73 | + <view class="title"> | |
| 74 | + <text style="font-weight: bold;">*位置描述</text> | |
| 75 | + <!-- <text class="star">*</text> --> | |
| 76 | + </view> | |
| 77 | + </view> | |
| 78 | + <view class="voucher-img"> | |
| 79 | + <view class="voucher-list" style="width: 100%;"> | |
| 80 | + <view class="" style="background-color: #F0F0F0;border-radius: 20rpx;"> | |
| 81 | + <textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx 0;padding:10px;" v-model="ruleForm.memo"></textarea> | |
| 82 | + </view> | |
| 83 | + </view> | |
| 84 | + </view> | |
| 85 | + </view> | |
| 86 | + </view> | |
| 87 | + </view> | |
| 88 | + <u-select v-model="popup1" mode="mutil-column-auto" :list="list" @confirm="pops" label-name="label" value-name="value"></u-select> | |
| 89 | + <u-select v-model="popup2" mode="mutil-column-auto" :list="list1" @confirm="pops1" label-name="label" value-name="value"></u-select> | |
| 90 | + <!-- 保存按钮 --> | |
| 91 | + <view class="page-footer"> | |
| 92 | + <u-button type="success" style="width: 100%;border-radius: 10px;" @click="submit">提交</u-button> | |
| 93 | + </view> | |
| 94 | + </view> | |
| 95 | +</template> | |
| 96 | + | |
| 97 | +<script> | |
| 98 | + export default { | |
| 99 | + data() { | |
| 100 | + return { | |
| 101 | + fileList:[], | |
| 102 | + ruleForm:{ | |
| 103 | + onSitePhoto:'', | |
| 104 | + deviceName:'', | |
| 105 | + deviceType:'', | |
| 106 | + warrantyIssue:'', | |
| 107 | + memo:'', | |
| 108 | + applicationTime:'', | |
| 109 | + enterpriseAuthorization:[], | |
| 110 | + status:'1' | |
| 111 | + }, | |
| 112 | + lableXian:'', | |
| 113 | + shelei:'', | |
| 114 | + list: [{ | |
| 115 | + value: '水管问题', | |
| 116 | + label: '水管问题' | |
| 117 | + }, | |
| 118 | + { | |
| 119 | + value: '物业问题', | |
| 120 | + label: '物业问题' | |
| 121 | + } | |
| 122 | + ], | |
| 123 | + list1: [{ | |
| 124 | + value: '类型1', | |
| 125 | + label: '类型1' | |
| 126 | + }, | |
| 127 | + { | |
| 128 | + value: '类型2', | |
| 129 | + label: '类型2' | |
| 130 | + } | |
| 131 | + ], | |
| 132 | + popup1:false, | |
| 133 | + popup2:false | |
| 134 | + } | |
| 135 | + }, | |
| 136 | + methods:{ | |
| 137 | + chooseLocation(val, item) { | |
| 138 | + this.popup1 = true | |
| 139 | + }, | |
| 140 | + choose(val, item) { | |
| 141 | + this.popup2 = true | |
| 142 | + }, | |
| 143 | + pops(val) { | |
| 144 | + | |
| 145 | + this.ruleForm.warrantyIssue = val[0].label | |
| 146 | + }, | |
| 147 | + pops1(val) { | |
| 148 | + this.ruleForm.deviceType = val[0].label | |
| 149 | + }, | |
| 150 | + check(){ | |
| 151 | + if (this.ruleForm.onSitePhoto.length== 0) { | |
| 152 | + uni.showToast({ | |
| 153 | + icon: 'none', | |
| 154 | + title: '请上传现场图片' | |
| 155 | + }); | |
| 156 | + return false; | |
| 157 | + } | |
| 158 | + if (!this.ruleForm.complaintType) { | |
| 159 | + uni.showToast({ | |
| 160 | + icon: 'none', | |
| 161 | + title: '请选择投诉类型' | |
| 162 | + }); | |
| 163 | + return false; | |
| 164 | + } | |
| 165 | + if (!this.ruleForm.problemDescription) { | |
| 166 | + uni.showToast({ | |
| 167 | + icon: 'none', | |
| 168 | + title: '请输入问题描述' | |
| 169 | + }); | |
| 170 | + return false; | |
| 171 | + } | |
| 172 | + if (!this.ruleForm.remark) { | |
| 173 | + uni.showToast({ | |
| 174 | + icon: 'none', | |
| 175 | + title: '请输入备注信息' | |
| 176 | + }); | |
| 177 | + return false; | |
| 178 | + } | |
| 179 | + | |
| 180 | + return true; | |
| 181 | + }, | |
| 182 | + submit() { | |
| 183 | + let show = this.check() | |
| 184 | + if(show == false){ | |
| 185 | + return | |
| 186 | + } | |
| 187 | + this.ruleForm.enterpriseAuthorization.map(item=>{ | |
| 188 | + item.replace(this.$img,'') | |
| 189 | + }) | |
| 190 | + this.ruleForm.applicationTime = this.currentTime() | |
| 191 | + let info = { | |
| 192 | + ...this.ruleForm, | |
| 193 | + enterpriseAuthorization:this.ruleForm.enterpriseAuthorization.join(','), | |
| 194 | + } | |
| 195 | + | |
| 196 | + this.$http.sendRequest('/cereReportIssuesRepairs/add', 'POST',info,1).then(res => { | |
| 197 | + uni.navigateTo({ | |
| 198 | + url: '/pages/serve/serve' | |
| 199 | + }) | |
| 200 | + }).catch(err => { | |
| 201 | + console.log(err) | |
| 202 | + //请求失败 | |
| 203 | + }) | |
| 204 | + | |
| 205 | + }, | |
| 206 | + // 获取时间 | |
| 207 | + currentTime() { | |
| 208 | + let date = new Date(); | |
| 209 | + let year = date.getFullYear(); | |
| 210 | + let month = date.getMonth() + 1; // 月份从0~11,所以加一 | |
| 211 | + let day = date.getDate(); | |
| 212 | + let hours = date.getHours(); | |
| 213 | + let minutes = date.getMinutes(); | |
| 214 | + let seconds = date.getSeconds(); | |
| 215 | + | |
| 216 | + // 为月、日、时、分、秒添加前导零(如果需要) | |
| 217 | + month = month < 10 ? '0' + month : month; | |
| 218 | + day = day < 10 ? '0' + day : day; | |
| 219 | + hours = hours < 10 ? '0' + hours : hours; | |
| 220 | + minutes = minutes < 10 ? '0' + minutes : minutes; | |
| 221 | + seconds = seconds < 10 ? '0' + seconds : seconds; | |
| 222 | + | |
| 223 | + // 拼接日期和时间字符串 | |
| 224 | + let strDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; | |
| 225 | + return strDate; | |
| 226 | + }, | |
| 227 | + onsuccess1(e, file, fileList, ziduan) { | |
| 228 | + console.error(e, file, fileList, ziduan) | |
| 229 | + uni.uploadFile({ | |
| 230 | + url: this.$upload, // 仅为示例,请替换为您的服务器上传接口 | |
| 231 | + filePath: e[0].url, | |
| 232 | + name: 'file', // 后端接收的文件参数名 | |
| 233 | + formData: { | |
| 234 | + filePath: 'xcx', // 其他表单数据 | |
| 235 | + }, | |
| 236 | + success: (uploadFileRes) => { | |
| 237 | + this.ruleForm.enterpriseAuthorization.push(this.$img + JSON.parse(uploadFileRes.data).data) | |
| 238 | + uni.showToast({ | |
| 239 | + title: '上传成功', | |
| 240 | + icon: 'success', | |
| 241 | + }); | |
| 242 | + }, | |
| 243 | + fail: (err) => { | |
| 244 | + console.error('上传失败', err); | |
| 245 | + uni.showToast({ | |
| 246 | + title: '上传失败', | |
| 247 | + icon: 'none', | |
| 248 | + }); | |
| 249 | + }, | |
| 250 | + }); | |
| 251 | + }, | |
| 252 | + } | |
| 253 | + } | |
| 254 | +</script> | |
| 255 | + | |
| 256 | +<style scoped lang="scss"> | |
| 257 | + .page{ | |
| 258 | + position: absolute; | |
| 259 | + left: 0; | |
| 260 | + top: 0; | |
| 261 | + width: 100%; | |
| 262 | + height: 100%; | |
| 263 | + background-color: #f6f6f6; | |
| 264 | + } | |
| 265 | + | |
| 266 | + .add-list{ | |
| 267 | + padding: 0 4%; | |
| 268 | + background-color: #FFFFFF; | |
| 269 | + border-radius: 20rpx; | |
| 270 | + margin-top: 20rpx; | |
| 271 | + width: 100%; | |
| 272 | + .list{ | |
| 273 | + display: flex; | |
| 274 | + justify-content: space-between; | |
| 275 | + align-items: center; | |
| 276 | + width: 100%; | |
| 277 | + height: 100rpx; | |
| 278 | + border-bottom: 2rpx solid #f6f6f6; | |
| 279 | + .title{ | |
| 280 | + display: flex; | |
| 281 | + align-items: center; | |
| 282 | + height: 100%; | |
| 283 | + text{ | |
| 284 | + font-size: 26rpx; | |
| 285 | + color: #222222; | |
| 286 | + } | |
| 287 | + .star{ | |
| 288 | + color: red; | |
| 289 | + } | |
| 290 | + } | |
| 291 | + .content{ | |
| 292 | + display: flex; | |
| 293 | + align-items: center; | |
| 294 | + text-align: right; | |
| 295 | + input{ | |
| 296 | + width: 100%; | |
| 297 | + color: #222222; | |
| 298 | + font-size: 26rpx; | |
| 299 | + padding-top: 6rpx; | |
| 300 | + /* #ifdef MP */ | |
| 301 | + padding-top: 5rpx; | |
| 302 | + /* #endif */ | |
| 303 | + } | |
| 304 | + image { | |
| 305 | + width: 20rpx; | |
| 306 | + height: 20rpx; | |
| 307 | + margin-left: 10rpx; | |
| 308 | + /* #ifdef MP */ | |
| 309 | + margin-top: 5rpx; | |
| 310 | + /* #endif */ | |
| 311 | + } | |
| 312 | + } | |
| 313 | + } | |
| 314 | + } | |
| 315 | + | |
| 316 | + /* 保存按钮 */ | |
| 317 | + .page-footer{ | |
| 318 | + position: fixed; | |
| 319 | + left: 0; | |
| 320 | + bottom: 0; | |
| 321 | + display: flex; | |
| 322 | + z-index: 999; | |
| 323 | + width: 100%; | |
| 324 | + height: 100rpx; | |
| 325 | + background-color: #FFFFFF; | |
| 326 | + padding-bottom: constant(safe-area-inset-bottom); | |
| 327 | + padding-bottom: env(safe-area-inset-bottom); | |
| 328 | + padding: 0 20px; | |
| 329 | + } | |
| 330 | + | |
| 331 | + .feedback-data{ | |
| 332 | + width: 100%; | |
| 333 | + padding-bottom: 20rpx; | |
| 334 | + border-bottom: 2rpx solid #f6f6f6; | |
| 335 | + .title{ | |
| 336 | + display: flex; | |
| 337 | + align-items: center; | |
| 338 | + height: 100rpx; | |
| 339 | + text{ | |
| 340 | + font-size: 26rpx; | |
| 341 | + color: #222222; | |
| 342 | + } | |
| 343 | + .star{ | |
| 344 | + color: red; | |
| 345 | + } | |
| 346 | + } | |
| 347 | + .voucher-img{ | |
| 348 | + display: flex; | |
| 349 | + align-items: center; | |
| 350 | + .voucher-list { | |
| 351 | + width: 33%; | |
| 352 | + height: 100%; | |
| 353 | + image{ | |
| 354 | + width: 160rpx; | |
| 355 | + height: 160rpx; | |
| 356 | + border-radius: 10rpx; | |
| 357 | + } | |
| 358 | + } | |
| 359 | + } | |
| 360 | + } | |
| 361 | +</style> | ... | ... |
lvdao-miniapp/pagesA/myZiyuan/myZiDetails.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <view class="zhutu"> | |
| 4 | + <!-- <u-image width="100%" height="300rpx" :src="$img+record.appendicesContract" border-radius="10"></u-image> --> | |
| 5 | + <u-image width="100%" height="300rpx" :src="record.cereBasicInformationShop&&record.cereBasicInformationShop.displayMainImage?$img + record.cereBasicInformationShop.displayMainImage:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.displayImage?$img + record.cereBasicInformationVenue.displayImage:record.cereAdvertisingInformation&&record.cereAdvertisingInformation.locationDiagram?$img + record.cereAdvertisingInformation.locationDiagram:''"></u-image> | |
| 6 | + </view> | |
| 7 | + <view class="msglist"> | |
| 8 | + | |
| 9 | + <view class="form-item"> | |
| 10 | + <view class="label">租赁状态</view> | |
| 11 | + <text>{{record.auditStatus =='1'?'待审核':record.auditStatus =='2'?'待签约':record.auditStatus =='3'?'已驳回':record.auditStatus =='4'?'已签约':'已终止'}}</text> | |
| 12 | + </view> | |
| 13 | + <view class="form-item" v-if="!record.advertisingSpaceType"> | |
| 14 | + <view class="label">经营用途</view> | |
| 15 | + <text>{{record.businessPurpose}}</text> | |
| 16 | + </view> | |
| 17 | + <view class="form-item"> | |
| 18 | + <view class="label">租赁期限</view> | |
| 19 | + <text>{{record.contractTerminationDate}}</text> | |
| 20 | + </view> | |
| 21 | + <view class="form-item"> | |
| 22 | + <view class="label">租金</view> | |
| 23 | + <text>{{record.contractAmount}}</text> | |
| 24 | + </view> | |
| 25 | + <view class="form-item"> | |
| 26 | + <view class="label">付款日</view> | |
| 27 | + <text>{{record.paymentCycle}}</text> | |
| 28 | + </view> | |
| 29 | + </view> | |
| 30 | + <view class="msglist" v-if="mapType == '商铺'"> | |
| 31 | + <u-read-more show-height="300" color="#3f9b6a" close-text="查看更多" text-indent="0em"> | |
| 32 | + | |
| 33 | + <view class="form-item"> | |
| 34 | + <view class="label">商铺名称</view> | |
| 35 | + <text>{{record.warrantyIssue || record.complaintType}}</text> | |
| 36 | + </view> | |
| 37 | + <view class="form-item"> | |
| 38 | + <view class="label">商铺类型</view> | |
| 39 | + <text>{{record.applicationTime}}</text> | |
| 40 | + </view> | |
| 41 | + <view class="form-item"> | |
| 42 | + <view class="label">租赁期限</view> | |
| 43 | + <text>{{record.deviceType || record.problemDescription}}</text> | |
| 44 | + </view> | |
| 45 | + <view class="form-item"> | |
| 46 | + <view class="label">租金</view> | |
| 47 | + <text>{{record.memo || record.remark}}</text> | |
| 48 | + </view> | |
| 49 | + <view class="form-item"> | |
| 50 | + <view class="label">付款日</view> | |
| 51 | + <text>{{record.memo || record.remark}}</text> | |
| 52 | + </view> | |
| 53 | + | |
| 54 | + </u-read-more> | |
| 55 | + </view> | |
| 56 | + <view class="msglist" v-if="mapType == '广告位'"> | |
| 57 | + <u-read-more show-height="300" color="#3f9b6a" close-text="查看更多" text-indent="0em"> | |
| 58 | + | |
| 59 | + <view class="form-item"> | |
| 60 | + <view class="label">广告位名称</view> | |
| 61 | + <text>{{record.warrantyIssue || record.complaintType}}</text> | |
| 62 | + </view> | |
| 63 | + <view class="form-item"> | |
| 64 | + <view class="label">所属端</view> | |
| 65 | + <text>{{record.applicationTime}}</text> | |
| 66 | + </view> | |
| 67 | + <view class="form-item"> | |
| 68 | + <view class="label">租赁期限</view> | |
| 69 | + <text>{{record.deviceType || record.problemDescription}}</text> | |
| 70 | + </view> | |
| 71 | + <view class="form-item"> | |
| 72 | + <view class="label">租金</view> | |
| 73 | + <text>{{record.memo || record.remark}}</text> | |
| 74 | + </view> | |
| 75 | + <view class="form-item"> | |
| 76 | + <view class="label">付款日</view> | |
| 77 | + <text>{{record.memo || record.remark}}</text> | |
| 78 | + </view> | |
| 79 | + | |
| 80 | + </u-read-more> | |
| 81 | + </view> | |
| 82 | + <view class="msglist" v-if="mapType == '场地'"> | |
| 83 | + <u-read-more show-height="300" color="#3f9b6a" close-text="查看更多" text-indent="0em"> | |
| 84 | + | |
| 85 | + <view class="form-item"> | |
| 86 | + <view class="label">场地名称</view> | |
| 87 | + <text>{{record.warrantyIssue || record.complaintType}}</text> | |
| 88 | + </view> | |
| 89 | + <view class="form-item"> | |
| 90 | + <view class="label">场地类型</view> | |
| 91 | + <text>{{record.applicationTime}}</text> | |
| 92 | + </view> | |
| 93 | + <view class="form-item"> | |
| 94 | + <view class="label">实际使用面积</view> | |
| 95 | + <text>{{record.deviceType || record.problemDescription}}</text> | |
| 96 | + </view> | |
| 97 | + <view class="form-item"> | |
| 98 | + <view class="label">租金</view> | |
| 99 | + <text>{{record.memo || record.remark}}</text> | |
| 100 | + </view> | |
| 101 | + <view class="form-item"> | |
| 102 | + <view class="label">付款日</view> | |
| 103 | + <text>{{record.memo || record.remark}}</text> | |
| 104 | + </view> | |
| 105 | + | |
| 106 | + </u-read-more> | |
| 107 | + </view> | |
| 108 | + <view v-if="btnShow&&mapType == '商铺'"><u-button @click="xiuMsg(1)" shape="circle" :custom-style="hoverStyle" hover-class="none" :plain="true">添加我的店铺信息</u-button></view> | |
| 109 | + <view class="msglist" v-if="btnShow == false&&mapType == '商铺'"> | |
| 110 | + <u-read-more show-height="300" color="#3f9b6a" close-text="查看更多" text-indent="0em" > | |
| 111 | + | |
| 112 | + <view class="form-item"> | |
| 113 | + <view class="label">商铺名称</view> | |
| 114 | + <text>{{record.warrantyIssue || record.complaintType}}</text> | |
| 115 | + </view> | |
| 116 | + <view class="form-item"> | |
| 117 | + <view class="label">商铺类型</view> | |
| 118 | + <text>{{record.applicationTime}}</text> | |
| 119 | + </view> | |
| 120 | + <view class="form-item"> | |
| 121 | + <view class="label">租赁期限</view> | |
| 122 | + <text>{{record.deviceType || record.problemDescription}}</text> | |
| 123 | + </view> | |
| 124 | + <view class="form-item"> | |
| 125 | + <view class="label">租金</view> | |
| 126 | + <text>{{record.memo || record.remark}}</text> | |
| 127 | + </view> | |
| 128 | + <view class="form-item"> | |
| 129 | + <view class="label">付款日</view> | |
| 130 | + <text>{{record.memo || record.remark}}</text> | |
| 131 | + </view> | |
| 132 | + | |
| 133 | + </u-read-more> | |
| 134 | + </view> | |
| 135 | + <view class="msglist" v-if="mapType == '广告位'"> | |
| 136 | + | |
| 137 | + | |
| 138 | + <view class="form-item"> | |
| 139 | + <view class="label">投放内容</view> | |
| 140 | + </view> | |
| 141 | + <u-parse :html="content"></u-parse> | |
| 142 | + | |
| 143 | + | |
| 144 | + </view> | |
| 145 | + <view class="page-footer"> | |
| 146 | + <u-button style="background-color: #DFE0E4; flex: 1; margin: 0 10px;" @click="getQuit('/pagesA/myZiyuan/myZiyuanQuit')" | |
| 147 | + >申请退租</u-button> | |
| 148 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="xuShow = true" >申请续租</u-button> | |
| 149 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="xiuMsg(2)" v-if="btnShow == false&&mapType == '商铺'">修改资料</u-button> | |
| 150 | + </view> | |
| 151 | + <u-modal v-model="xuShow" :content="content" @confirm="xufirm" :show-cancel-button="true" ></u-modal> | |
| 152 | + </view> | |
| 153 | + | |
| 154 | +</template> | |
| 155 | + | |
| 156 | +<script> | |
| 157 | + export default { | |
| 158 | + data() { | |
| 159 | + return { | |
| 160 | + record:{}, | |
| 161 | + btnShow:true, | |
| 162 | + hoverStyle:{ | |
| 163 | + | |
| 164 | + color:'#3f9b6a' | |
| 165 | + }, | |
| 166 | + mapType:'商铺', | |
| 167 | + content:'<p>露从今夜白,月是故乡明</p>', | |
| 168 | + xuShow:false, | |
| 169 | + content:'您确定是否需要续租' | |
| 170 | + } | |
| 171 | + }, | |
| 172 | + onLoad(options) { | |
| 173 | + const item = JSON.parse(decodeURIComponent(options.item)); | |
| 174 | + console.log('Received item:', item); | |
| 175 | + this.record = item | |
| 176 | + }, | |
| 177 | + methods: { | |
| 178 | + getQuit(urls){ | |
| 179 | + console.log(urls) | |
| 180 | + uni.navigateTo({ | |
| 181 | + url: urls | |
| 182 | + }) | |
| 183 | + }, | |
| 184 | + xufirm(){ | |
| 185 | + | |
| 186 | + }, | |
| 187 | + xiuMsg(val){ | |
| 188 | + if(val == 1){ | |
| 189 | + uni.navigateTo({ | |
| 190 | + url: '/pagesA/myZiyuan/addMyshop' | |
| 191 | + }) | |
| 192 | + }else{ | |
| 193 | + uni.navigateTo({ | |
| 194 | + url: '/pagesA/myZiyuan/addMyshop' | |
| 195 | + }) | |
| 196 | + } | |
| 197 | + } | |
| 198 | + } | |
| 199 | + } | |
| 200 | +</script> | |
| 201 | + | |
| 202 | +<style scoped lang="scss"> | |
| 203 | + .page{ | |
| 204 | + position: absolute; | |
| 205 | + left: 0; | |
| 206 | + top: 0; | |
| 207 | + width: 100%; | |
| 208 | + height: 100%; | |
| 209 | + padding: 0 24rpx; | |
| 210 | + } | |
| 211 | + .zhutu{ | |
| 212 | + margin: 15px 0; | |
| 213 | + background-color: #fff; | |
| 214 | + } | |
| 215 | + | |
| 216 | + /* 记录列表 */ | |
| 217 | + .record-list{ | |
| 218 | + margin-top: 20rpx; | |
| 219 | + .good-item { | |
| 220 | + width: 100%; | |
| 221 | + display: flex; | |
| 222 | + background-color: #fff; | |
| 223 | + padding: 16rpx; | |
| 224 | + border-radius: 14rpx; | |
| 225 | + margin-bottom: 26rpx; | |
| 226 | + .img { | |
| 227 | + width: 200rpx; | |
| 228 | + height: 200rpx; | |
| 229 | + } | |
| 230 | + .info { | |
| 231 | + width: calc(100% - 220rpx); | |
| 232 | + margin-left: 20rpx; | |
| 233 | + .title { | |
| 234 | + width: 100%; | |
| 235 | + font-size: 28rpx; | |
| 236 | + line-height: 44rpx; | |
| 237 | + font-weight: 700; | |
| 238 | + white-space: nowrap; | |
| 239 | + overflow : hidden; | |
| 240 | + text-overflow: ellipsis; | |
| 241 | + margin-bottom: 20rpx; | |
| 242 | + } | |
| 243 | + .info-item { | |
| 244 | + display: flex; | |
| 245 | + line-height: 30rpx; | |
| 246 | + font-size: 26rpx; | |
| 247 | + color: #717981; | |
| 248 | + text { | |
| 249 | + white-space: nowrap; | |
| 250 | + overflow : hidden; | |
| 251 | + text-overflow: ellipsis; | |
| 252 | + margin-left: 10rpx; | |
| 253 | + span { | |
| 254 | + font-size: 30rpx; | |
| 255 | + color: #000; | |
| 256 | + font-weight: 700; | |
| 257 | + } | |
| 258 | + } | |
| 259 | + .u-tag { | |
| 260 | + margin: 0 6rpx; | |
| 261 | + border: unset; | |
| 262 | + } | |
| 263 | + } | |
| 264 | + } | |
| 265 | + } | |
| 266 | + } | |
| 267 | + .msglist{ | |
| 268 | + padding: 0 30rpx; | |
| 269 | + background-color: #Fff; | |
| 270 | + border-radius: 14rpx; | |
| 271 | + margin-bottom: 20rpx; | |
| 272 | + .form-item { | |
| 273 | + display: flex; | |
| 274 | + flex-direction: row; | |
| 275 | + align-items: center; | |
| 276 | + justify-content: space-between; | |
| 277 | + line-height: 70rpx; | |
| 278 | + border-bottom: #eee solid 1rpx; | |
| 279 | + padding: 10rpx 0; | |
| 280 | + &[label-top] { | |
| 281 | + flex-direction: column; | |
| 282 | + justify-content: flex-start; | |
| 283 | + align-items: flex-start; | |
| 284 | + } | |
| 285 | + text { | |
| 286 | + font-size: 24rpx; | |
| 287 | + color: #3D3D3D; | |
| 288 | + } | |
| 289 | + .img { | |
| 290 | + padding-bottom: 18rpx; | |
| 291 | + } | |
| 292 | + .deom-box { | |
| 293 | + width: 100%; | |
| 294 | + display: flex !important; | |
| 295 | + margin: 0 -20rpx; | |
| 296 | + background-color: #FFFFFF; | |
| 297 | + border-radius: 9px; | |
| 298 | + // margin-top: 9px; | |
| 299 | + width: 100%; | |
| 300 | + // .u-upload { | |
| 301 | + // .u-add-wrap { | |
| 302 | + // width: 304rpx !important; | |
| 303 | + // height: 182rpx !important; | |
| 304 | + // } | |
| 305 | + // } | |
| 306 | + // .u-upload { | |
| 307 | + // height: 88px; | |
| 308 | + // width: 155px; | |
| 309 | + // background: url(/static/images/uploadID1.png); | |
| 310 | + // background-size:134rpx 188rpx; | |
| 311 | + // background-repeat:no-repeat; | |
| 312 | + // } | |
| 313 | + .img-deom { | |
| 314 | + flex: 1; | |
| 315 | + display: flex; | |
| 316 | + flex-direction: column; | |
| 317 | + align-items: center; | |
| 318 | + padding: 20rpx; | |
| 319 | + text { | |
| 320 | + margin-top: 18rpx; | |
| 321 | + } | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + :last-child { | |
| 326 | + border-bottom: unset; | |
| 327 | + } | |
| 328 | + } | |
| 329 | + .footbtn{ | |
| 330 | + position: fixed; | |
| 331 | + bottom: 0; | |
| 332 | + left: 0; | |
| 333 | + z-index: 10; | |
| 334 | + height:180rpx; | |
| 335 | + width: 100%; | |
| 336 | + border-radius: 26rpx 26rpx 0 0; | |
| 337 | + background-color: #fff; | |
| 338 | + .info-total { | |
| 339 | + display: flex; | |
| 340 | + flex-direction: row; | |
| 341 | + align-items: center; | |
| 342 | + justify-content: space-between; | |
| 343 | + margin: 24rpx 50rpx; | |
| 344 | + font-weight: 700; | |
| 345 | + font-size: 24rpx; | |
| 346 | + span { | |
| 347 | + color: #0FBB59; | |
| 348 | + font-size: 32rpx | |
| 349 | + } | |
| 350 | + } | |
| 351 | + .footer-btn { | |
| 352 | + display: flex; | |
| 353 | + .u-btn { | |
| 354 | + width: 40%; | |
| 355 | + } | |
| 356 | + } | |
| 357 | + } | |
| 358 | + .page-footer{ | |
| 359 | + position: fixed; | |
| 360 | + left: 0; | |
| 361 | + bottom: 0; | |
| 362 | + display: flex; | |
| 363 | + align-items: center; | |
| 364 | + width: 100%; | |
| 365 | + height: 125rpx; | |
| 366 | + background-color: #FFFFFF; | |
| 367 | + padding-bottom: constant(safe-area-inset-bottom); | |
| 368 | + padding-bottom: env(safe-area-inset-bottom); | |
| 369 | + .footer-buy{ | |
| 370 | + display: flex; | |
| 371 | + align-items: center; | |
| 372 | + justify-content: space-between; | |
| 373 | + width: 100%; | |
| 374 | + height: 100%; | |
| 375 | + .cart-add{ | |
| 376 | + display: flex; | |
| 377 | + align-items: center; | |
| 378 | + justify-content: center; | |
| 379 | + width: 100%; | |
| 380 | + height: 100rpx; | |
| 381 | + background-color: #3f9b6a; | |
| 382 | + text{ | |
| 383 | + font-size: 28rpx; | |
| 384 | + color: #FFFFFF; | |
| 385 | + } | |
| 386 | + } | |
| 387 | + } | |
| 388 | + } | |
| 389 | +</style> | ... | ... |
lvdao-miniapp/pagesA/myZiyuan/myZiyuan.scss
0 → 100644
| 1 | +.page{ | |
| 2 | + position: absolute; | |
| 3 | + left: 0; | |
| 4 | + top: 0; | |
| 5 | + width: 100%; | |
| 6 | + height: 100%; | |
| 7 | +} | |
| 8 | +.screen-list { | |
| 9 | + display: flex; | |
| 10 | + align-items: center; | |
| 11 | + width: 100%; | |
| 12 | + margin: 20rpx 20rpx; | |
| 13 | + padding: 0 10rpx; | |
| 14 | + .zidong{ | |
| 15 | + width: 160rpx; | |
| 16 | + background-color: #3F9B6A; | |
| 17 | + color: #fff; | |
| 18 | + padding: 10rpx; | |
| 19 | + border-radius: 30rpx; | |
| 20 | + font-size: 24rpx; | |
| 21 | + text-align: center; | |
| 22 | + } | |
| 23 | + .list { | |
| 24 | + display: flex; | |
| 25 | + justify-content: center; | |
| 26 | + align-items: center; | |
| 27 | + width: 30%; | |
| 28 | + height: 100%; | |
| 29 | + background-color: #fff; | |
| 30 | + padding: 0rpx 15px; | |
| 31 | + border-radius: 18rpx; | |
| 32 | + color: #0FBB59; | |
| 33 | + text { | |
| 34 | + font-size: 26rpx; | |
| 35 | + } | |
| 36 | + image { | |
| 37 | + width: 30rpx; | |
| 38 | + height: 30rpx; | |
| 39 | + margin-left: 10rpx; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + .action { | |
| 43 | + text { | |
| 44 | + color: $base; | |
| 45 | + } | |
| 46 | + } | |
| 47 | + } | |
| 48 | +/* 记录列表 */ | |
| 49 | +.record-list{ | |
| 50 | + margin: 0 20rpx; | |
| 51 | + .record-list-box { | |
| 52 | + background-color: #FFFFFF; | |
| 53 | + border-radius: 20rpx; | |
| 54 | + padding: 20rpx 30rpx; | |
| 55 | + margin-bottom: 20rpx; | |
| 56 | + .title { | |
| 57 | + display: flex; | |
| 58 | + .left { | |
| 59 | + font-size: 28rpx; | |
| 60 | + font-weight: 700; | |
| 61 | + } | |
| 62 | + .right { | |
| 63 | + width: 100rpx; | |
| 64 | + text-align: right; | |
| 65 | + color: #0FBB59; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + .info-item { | |
| 69 | + line-height: 50rpx; | |
| 70 | + color: #808080; | |
| 71 | + } | |
| 72 | + } | |
| 73 | +} | ... | ... |
lvdao-miniapp/pagesA/myZiyuan/myZiyuan.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <view class="screen-list"> | |
| 4 | + <view class="list"> | |
| 5 | + <u-input v-model="pageindex.start" type="select" @click="typeShow = true" placeholder='状态筛选' /> | |
| 6 | + </view> | |
| 7 | + </view> | |
| 8 | + <!-- 记录列表 --> | |
| 9 | + <view class="record-list"> | |
| 10 | + <view class="record-list-box" v-for="(item,index) in recordList" :key="index" @click="recordXq(item)"> | |
| 11 | + <view class="list"> | |
| 12 | + <view class="title"> | |
| 13 | + <view class="left">{{item.cereBasicInformationShop&&item.cereBasicInformationShop.shopName?item.cereBasicInformationShop.shopName:item.cereBasicInformationVenue&&item.cereBasicInformationVenue.venueName?item.cereBasicInformationVenue.venueName:item.cereAdvertisingInformation&&item.cereAdvertisingInformation.advertisingName?item.cereAdvertisingInformation.advertisingName:''}}</view> | |
| 14 | + <view class="right"><u-icon name="arrow-rightward"></u-icon></view> | |
| 15 | + </view> | |
| 16 | + <view class="info-item">申请时间:{{item.applicationTime}}</view> | |
| 17 | + <view class="info-item">状态:<span style="color: #0FBB59;">{{item.auditStatus =='1'?'待审核':item.auditStatus =='2'?'待签约':item.auditStatus =='3'?'已驳回':item.auditStatus =='4'?'已签约':'已终止'}}</span></view> | |
| 18 | + </view> | |
| 19 | + </view> | |
| 20 | + </view> | |
| 21 | + <u-select v-model="typeShow" :list="activesType" @confirm="typeChange"></u-select> | |
| 22 | + </view> | |
| 23 | +</template> | |
| 24 | + | |
| 25 | +<script> | |
| 26 | + export default { | |
| 27 | + data() { | |
| 28 | + return { | |
| 29 | + | |
| 30 | + pageindex: { | |
| 31 | + pageNumber: 1, | |
| 32 | + pageSize: 10 | |
| 33 | + }, | |
| 34 | + activesType: [{ | |
| 35 | + value: 1, | |
| 36 | + label: '租赁中' | |
| 37 | + }, | |
| 38 | + { | |
| 39 | + value: 2, | |
| 40 | + label: '已终止' | |
| 41 | + }, | |
| 42 | + ], | |
| 43 | + typeShow:false, | |
| 44 | + recordList:[], | |
| 45 | + pageindex: { | |
| 46 | + pageNumber: 1, | |
| 47 | + pageSize: 10 | |
| 48 | + }, | |
| 49 | + } | |
| 50 | + }, | |
| 51 | + mounted(){ | |
| 52 | + this.getALL() | |
| 53 | + }, | |
| 54 | + methods: { | |
| 55 | + getALL(){ | |
| 56 | + this.pageindex.applicant =uni.getStorageSync('user').phone | |
| 57 | + this.$http.sendRequest('/cereBusinessInfo/queryByPage', 'POST', this.pageindex,1).then(res => { | |
| 58 | + //成功回调 | |
| 59 | + | |
| 60 | + this.$http.sendRequest('/cereAdvertiserInfo/queryByPage', 'POST', this.pageindex, 1).then(item => { | |
| 61 | + | |
| 62 | + this.recordList = [...res.data.data.content,...item.data.data.content] | |
| 63 | + | |
| 64 | + }) | |
| 65 | + }) | |
| 66 | + | |
| 67 | + }, | |
| 68 | + recordXq(item){ | |
| 69 | + const encodedItem = encodeURIComponent(JSON.stringify(item)); | |
| 70 | + uni.navigateTo({ | |
| 71 | + url: `/pagesA/myZiyuan/myZiDetails?item=${encodedItem}`, | |
| 72 | + }) | |
| 73 | + }, | |
| 74 | + contractdetail(){ | |
| 75 | + // uni.navigateTo({ | |
| 76 | + | |
| 77 | + // }) | |
| 78 | + }, | |
| 79 | + typeChange(e) { | |
| 80 | + this.pageindex.start = e[0].label; | |
| 81 | + }, | |
| 82 | + } | |
| 83 | + } | |
| 84 | +</script> | |
| 85 | + | |
| 86 | +<style scoped lang="scss"> | |
| 87 | + @import 'myZiyuan.scss'; | |
| 88 | +</style> | ... | ... |
lvdao-miniapp/pagesA/myZiyuan/myZiyuanQuit.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + | |
| 4 | + <view class="add-list"> | |
| 5 | + <u-form labelPosition="left" :model="model1" ref="uForm" :labelWidth="250"> | |
| 6 | + <u-form-item label="*申请原因" prop="businessPurpose" borderBottom> | |
| 7 | + </u-form-item> | |
| 8 | + <u-input v-model="model1.businessPurpose" type="textarea" :custom-style="customStyle"></u-input> | |
| 9 | + </u-form> | |
| 10 | + </view> | |
| 11 | +<view class="add-list"> | |
| 12 | + <u-form labelPosition="left" :model="model1" ref="uForm" :labelWidth="250"> | |
| 13 | + <u-form-item label="*申请退租时间" prop="businessStartDate" borderBottom> | |
| 14 | + <u-input v-model="model1.businessStartDate" type="select" @click="busStartshow = true" | |
| 15 | + placeholder="请选择" :custom-style="selStyle"/> | |
| 16 | + <u-picker mode="time" v-model="busStartshow" :params="params" | |
| 17 | + @confirm="busStTimeChange"></u-picker> | |
| 18 | + </u-form-item> | |
| 19 | + | |
| 20 | + </u-form> | |
| 21 | + </view> | |
| 22 | + <!-- 保存按钮 --> | |
| 23 | + <view class="page-footer"> | |
| 24 | + <u-button type="success" style="flex: 1; margin: 0 10px;" @click="go">提交申请</u-button> | |
| 25 | + </view> | |
| 26 | + </view> | |
| 27 | +</template> | |
| 28 | + | |
| 29 | +<script> | |
| 30 | + export default { | |
| 31 | + data() { | |
| 32 | + return { | |
| 33 | + model1: { | |
| 34 | + businessStartDate:'', | |
| 35 | + businessPurpose:'' | |
| 36 | + }, | |
| 37 | + busStartshow: false, | |
| 38 | + params: { | |
| 39 | + year: true, | |
| 40 | + month: true, | |
| 41 | + day: true, | |
| 42 | + }, | |
| 43 | + customStyle:{ | |
| 44 | + padding:'10px', | |
| 45 | + backgroundColor:'#F0F0F0', | |
| 46 | + borderRadius:'10px', | |
| 47 | + | |
| 48 | + }, | |
| 49 | + selStyle:{ | |
| 50 | + textAlign:'right' | |
| 51 | + } | |
| 52 | + | |
| 53 | + }; | |
| 54 | + }, | |
| 55 | + onLoad(option) { | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + }, | |
| 60 | + onShow() {}, | |
| 61 | + methods: { | |
| 62 | + getCurrentTime() { | |
| 63 | + const now = new Date(); | |
| 64 | + const year = now.getFullYear(); | |
| 65 | + const month = ('0' + (now.getMonth() + 1)).slice(-2); | |
| 66 | + const day = ('0' + now.getDate()).slice(-2); | |
| 67 | + const hours = ('0' + now.getHours()).slice(-2); | |
| 68 | + const minutes = ('0' + now.getMinutes()).slice(-2); | |
| 69 | + const seconds = ('0' + now.getSeconds()).slice(-2); | |
| 70 | + | |
| 71 | + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; | |
| 72 | + }, | |
| 73 | + chek() { | |
| 74 | + if (!this.model1.businessStartDate) { | |
| 75 | + uni.showToast({ | |
| 76 | + icon: 'none', | |
| 77 | + title: '请输入申请原因' | |
| 78 | + }); | |
| 79 | + return; | |
| 80 | + } | |
| 81 | + if (!this.model1.businessPurpose) { | |
| 82 | + uni.showToast({ | |
| 83 | + icon: 'none', | |
| 84 | + title: '请选择退租申请时间' | |
| 85 | + }); | |
| 86 | + return; | |
| 87 | + } | |
| 88 | + | |
| 89 | + }, | |
| 90 | + go() { | |
| 91 | + this.model1.rentalResourcesId = '' | |
| 92 | + this.model1.applicant = uni.getStorageSync('user').phone | |
| 93 | + this.model1.applicationTime = this.getCurrentTime() | |
| 94 | + this.chek() | |
| 95 | + // this.$http.sendRequest('/cereBusinessInfo/add', 'POST',info, 1).then(res => { | |
| 96 | + // uni.showToast({ | |
| 97 | + // title: '提交成功', | |
| 98 | + // icon: 'none', | |
| 99 | + // }); | |
| 100 | + // setTimeout(() => { | |
| 101 | + // uni.navigateBack() | |
| 102 | + // }, 1000) | |
| 103 | + | |
| 104 | + // }) | |
| 105 | + }, | |
| 106 | + timeChange(val) { | |
| 107 | + const { | |
| 108 | + year, | |
| 109 | + month, | |
| 110 | + day, | |
| 111 | + } = val; | |
| 112 | + return `${year}-${month}-${day}`; | |
| 113 | + }, | |
| 114 | + busStTimeChange(val) { | |
| 115 | + this.model1.businessStartDate = this.timeChange(val) | |
| 116 | + }, | |
| 117 | + | |
| 118 | + | |
| 119 | + } | |
| 120 | + } | |
| 121 | +</script> | |
| 122 | + | |
| 123 | +<style scoped lang="scss"> | |
| 124 | + .page{ | |
| 125 | + position: absolute; | |
| 126 | + left: 0; | |
| 127 | + top: 0; | |
| 128 | + width: 100%; | |
| 129 | + overflow-y: scroll; | |
| 130 | + height: calc(100% - 120rpx); | |
| 131 | + background-color: #f6f6f6; | |
| 132 | + padding: 0 10px; | |
| 133 | + } | |
| 134 | + .steps-box { | |
| 135 | + padding-top: 40rpx; | |
| 136 | + } | |
| 137 | + | |
| 138 | + .add-list{ | |
| 139 | + | |
| 140 | + padding: 0 20px 20px 20px; | |
| 141 | + background-color: #FFFFFF; | |
| 142 | + border-radius: 20rpx; | |
| 143 | + margin-top: 20rpx; | |
| 144 | + width: 100%; | |
| 145 | + | |
| 146 | + | |
| 147 | + } | |
| 148 | + | |
| 149 | + /* 保存按钮 */ | |
| 150 | + .page-footer{ | |
| 151 | + position: fixed; | |
| 152 | + left: 0; | |
| 153 | + bottom: 0; | |
| 154 | + display: flex; | |
| 155 | + align-items: center; | |
| 156 | + width: 100%; | |
| 157 | + height: 125rpx; | |
| 158 | + background-color: #FFFFFF; | |
| 159 | + padding-bottom: constant(safe-area-inset-bottom); | |
| 160 | + padding-bottom: env(safe-area-inset-bottom); | |
| 161 | + .footer-buy{ | |
| 162 | + display: flex; | |
| 163 | + align-items: center; | |
| 164 | + justify-content: space-between; | |
| 165 | + width: 100%; | |
| 166 | + height: 100%; | |
| 167 | + .cart-add{ | |
| 168 | + display: flex; | |
| 169 | + align-items: center; | |
| 170 | + justify-content: center; | |
| 171 | + width: 100%; | |
| 172 | + height: 100rpx; | |
| 173 | + background-color: #3f9b6a; | |
| 174 | + text{ | |
| 175 | + font-size: 28rpx; | |
| 176 | + color: #FFFFFF; | |
| 177 | + } | |
| 178 | + } | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + .feedback-data{ | |
| 183 | + width: 100%; | |
| 184 | + padding-bottom: 20rpx; | |
| 185 | + border-bottom: 2rpx solid #f6f6f6; | |
| 186 | + .title{ | |
| 187 | + display: flex; | |
| 188 | + align-items: center; | |
| 189 | + height: 100rpx; | |
| 190 | + text{ | |
| 191 | + font-size: 26rpx; | |
| 192 | + color: #222222; | |
| 193 | + } | |
| 194 | + .star{ | |
| 195 | + color: red; | |
| 196 | + } | |
| 197 | + } | |
| 198 | + .voucher-img{ | |
| 199 | + display: flex; | |
| 200 | + align-items: center; | |
| 201 | + .voucher-list { | |
| 202 | + width: 33%; | |
| 203 | + height: 100%; | |
| 204 | + image{ | |
| 205 | + width: 160rpx; | |
| 206 | + height: 160rpx; | |
| 207 | + border-radius: 10rpx; | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + } | |
| 212 | +</style> | |
| 0 | 213 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/i18n/en.json
0 → 100644
| 1 | +{ | |
| 2 | + "wu-calender.ok": "ok", | |
| 3 | + "wu-calender.cancel": "cancel", | |
| 4 | + "wu-calender.year": "year", | |
| 5 | + "wu-calender.month": "month", | |
| 6 | + "wu-calender.today": "today", | |
| 7 | + "wu-calender.MON": "MON", | |
| 8 | + "wu-calender.TUE": "TUE", | |
| 9 | + "wu-calender.WED": "WED", | |
| 10 | + "wu-calender.THU": "THU", | |
| 11 | + "wu-calender.FRI": "FRI", | |
| 12 | + "wu-calender.SAT": "SAT", | |
| 13 | + "wu-calender.SUN": "SUN" | |
| 14 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/i18n/index.js
0 → 100644
lvdao-miniapp/uni_modules/wu-calendar/components/i18n/zh-Hans.json
0 → 100644
| 1 | +{ | |
| 2 | + "wu-calender.ok": "确定", | |
| 3 | + "wu-calender.cancel": "取消", | |
| 4 | + "wu-calender.year": "年", | |
| 5 | + "wu-calender.month": "月", | |
| 6 | + "wu-calender.today": "今日", | |
| 7 | + "wu-calender.SUN": "日", | |
| 8 | + "wu-calender.MON": "一", | |
| 9 | + "wu-calender.TUE": "二", | |
| 10 | + "wu-calender.WED": "三", | |
| 11 | + "wu-calender.THU": "四", | |
| 12 | + "wu-calender.FRI": "五", | |
| 13 | + "wu-calender.SAT": "六" | |
| 14 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/i18n/zh-Hant.json
0 → 100644
| 1 | +{ | |
| 2 | + "wu-calender.ok": "確定", | |
| 3 | + "wu-calender.cancel": "取消", | |
| 4 | + "wu-calender.year": "年", | |
| 5 | + "wu-calender.month": "月", | |
| 6 | + "wu-calender.today": "今日", | |
| 7 | + "wu-calender.SUN": "日", | |
| 8 | + "wu-calender.MON": "一", | |
| 9 | + "wu-calender.TUE": "二", | |
| 10 | + "wu-calender.WED": "三", | |
| 11 | + "wu-calender.THU": "四", | |
| 12 | + "wu-calender.FRI": "五", | |
| 13 | + "wu-calender.SAT": "六" | |
| 14 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar-block/props.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + showMonth: { | |
| 4 | + type: Boolean, | |
| 5 | + default: false | |
| 6 | + }, | |
| 7 | + // 折叠状态 | |
| 8 | + FoldStatus: { | |
| 9 | + type: String, | |
| 10 | + default: null | |
| 11 | + }, | |
| 12 | + month: { | |
| 13 | + type: [Number, String], | |
| 14 | + default: null | |
| 15 | + }, | |
| 16 | + color: { | |
| 17 | + type: String, | |
| 18 | + default: '#3c9cff' | |
| 19 | + }, | |
| 20 | + startText: { | |
| 21 | + type: String, | |
| 22 | + default: '开始' | |
| 23 | + }, | |
| 24 | + endText: { | |
| 25 | + type: String, | |
| 26 | + default: '结束' | |
| 27 | + }, | |
| 28 | + weeks: { | |
| 29 | + type: [Object, Array], | |
| 30 | + default: ()=> { | |
| 31 | + return [] | |
| 32 | + } | |
| 33 | + }, | |
| 34 | + calendar: { | |
| 35 | + type: Object, | |
| 36 | + default: () => { | |
| 37 | + return {} | |
| 38 | + } | |
| 39 | + }, | |
| 40 | + selected: { | |
| 41 | + type: Array, | |
| 42 | + default: () => { | |
| 43 | + return [] | |
| 44 | + } | |
| 45 | + }, | |
| 46 | + lunar: { | |
| 47 | + type: Boolean, | |
| 48 | + default: false | |
| 49 | + }, | |
| 50 | + itemHeight: { | |
| 51 | + type: Number, | |
| 52 | + default: 64 | |
| 53 | + }, | |
| 54 | + monthShowCurrentMonth: { | |
| 55 | + type: Boolean, | |
| 56 | + default: false | |
| 57 | + }, | |
| 58 | + actBadgeColor: { | |
| 59 | + type: String, | |
| 60 | + default: '#fff' | |
| 61 | + }, | |
| 62 | + // 默认边距 | |
| 63 | + defaultMargin: { | |
| 64 | + type: Number, | |
| 65 | + default: 8 | |
| 66 | + }, | |
| 67 | + // 是否显示今日默认样式(默认为true) | |
| 68 | + todayDefaultStyle: { | |
| 69 | + type: Boolean, | |
| 70 | + default: true | |
| 71 | + }, | |
| 72 | + } | |
| 73 | +} | |
| 0 | 74 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar-block/wu-calendar-block.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="wu-calendar-block"> | |
| 3 | + <view v-if="showMonth && FoldShowMonth" class="wu-calendar__box-bg"> | |
| 4 | + <text class="wu-calendar__box-bg-text">{{month}}</text> | |
| 5 | + </view> | |
| 6 | + <!-- 月或周日历 --> | |
| 7 | + <view class="wu-calendar__weeks" v-for="(item, index) in weeks" :key="index"> | |
| 8 | + <template v-for="(weeks, weeksIndex) in item"> | |
| 9 | + <wu-calendar-item :key="weeksIndex" v-if="!monthShowCurrentMonth || !weeks.empty" class="wu-calendar-item--hook" :weekItemStyle="weekItemStyle" :weeks="weeks" :calendar="calendar" | |
| 10 | + :selected="selected" :lunar="lunar" @change="choiceDate" :color="color" :actBadgeColor="actBadgeColor" | |
| 11 | + :startText="startText" :endText="endText" :itemHeight="itemHeight - defaultMargin" :todayDefaultStyle="todayDefaultStyle"></wu-calendar-item> | |
| 12 | + <view v-else class="wu-calendar__weeks-item" :style="[weekItemStyle]"></view> | |
| 13 | + </template> | |
| 14 | + </view> | |
| 15 | + </view> | |
| 16 | +</template> | |
| 17 | + | |
| 18 | +<script> | |
| 19 | + import mpMixin from '@/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js'; | |
| 20 | + import mixin from '@/uni_modules/wu-ui-tools/libs/mixin/mixin.js'; | |
| 21 | + import props from './props.js'; | |
| 22 | + | |
| 23 | + import { | |
| 24 | + initVueI18n | |
| 25 | + } from '@dcloudio/uni-i18n' | |
| 26 | + import i18nMessages from '../i18n/index.js' | |
| 27 | + const { | |
| 28 | + t | |
| 29 | + } = initVueI18n(i18nMessages) | |
| 30 | + | |
| 31 | + export default { | |
| 32 | + emits: ['change'], | |
| 33 | + mixins: [mpMixin, mixin, props], | |
| 34 | + data() { | |
| 35 | + return { | |
| 36 | + FoldShowMonth: false, | |
| 37 | + } | |
| 38 | + }, | |
| 39 | + mounted() { | |
| 40 | + this.FoldShowMonth = this.FoldStatus == 'open'; | |
| 41 | + }, | |
| 42 | + computed: { | |
| 43 | + weekItemStyle() { | |
| 44 | + let weeksLength = Object.keys(this.weeks).length; | |
| 45 | + let calendarHeight = this.FoldStatus === 'open' ? this.itemHeight * 6 : this.itemHeight; | |
| 46 | + let margin = weeksLength && this.weeks[weeksLength - 1][0].empty ? this.itemHeight / (weeksLength - 1) + this.defaultMargin : this.defaultMargin | |
| 47 | + return { | |
| 48 | + marginTop: margin / 2 + 'px', | |
| 49 | + marginBottom: margin / 2 + 'px', | |
| 50 | + height: this.itemHeight - this.defaultMargin + 'px' | |
| 51 | + } | |
| 52 | + } | |
| 53 | + }, | |
| 54 | + watch: { | |
| 55 | + FoldStatus(newVal) { | |
| 56 | + this.$nextTick(()=>{ | |
| 57 | + this.FoldShowMonth = this.FoldStatus == 'open'; | |
| 58 | + }) | |
| 59 | + } | |
| 60 | + }, | |
| 61 | + methods: { | |
| 62 | + choiceDate(weeks) { | |
| 63 | + this.$emit('change', weeks) | |
| 64 | + } | |
| 65 | + } | |
| 66 | + } | |
| 67 | +</script> | |
| 68 | + | |
| 69 | +<style lang="scss" scoped> | |
| 70 | + $wu-text-color-grey: #999; | |
| 71 | + | |
| 72 | + .wu-calendar-block { | |
| 73 | + .wu-calendar__weeks { | |
| 74 | + position: relative; | |
| 75 | + /* #ifndef APP-NVUE */ | |
| 76 | + display: flex; | |
| 77 | + /* #endif */ | |
| 78 | + flex-direction: row; | |
| 79 | + padding: 0 8rpx; | |
| 80 | + } | |
| 81 | + | |
| 82 | + .wu-calendar__weeks-item { | |
| 83 | + flex: 1; | |
| 84 | + } | |
| 85 | + | |
| 86 | + .wu-calendar__box-bg { | |
| 87 | + /* #ifndef APP-NVUE */ | |
| 88 | + display: flex; | |
| 89 | + /* #endif */ | |
| 90 | + justify-content: center; | |
| 91 | + align-items: center; | |
| 92 | + position: absolute; | |
| 93 | + top: 0; | |
| 94 | + left: 0; | |
| 95 | + right: 0; | |
| 96 | + bottom: 0; | |
| 97 | + } | |
| 98 | + | |
| 99 | + .wu-calendar__box-bg-text { | |
| 100 | + font-size: 100rpx; | |
| 101 | + transform: scale(4); | |
| 102 | + font-weight: bold; | |
| 103 | + color: $wu-text-color-grey; | |
| 104 | + opacity: 0.1; | |
| 105 | + text-align: center; | |
| 106 | + /* #ifndef APP-NVUE */ | |
| 107 | + line-height: 1; | |
| 108 | + /* #endif */ | |
| 109 | + } | |
| 110 | + } | |
| 111 | +</style> | |
| 0 | 112 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar-item/props.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + color: { | |
| 4 | + type: String, | |
| 5 | + default: '#3c9cff' | |
| 6 | + }, | |
| 7 | + startText: { | |
| 8 | + type: String, | |
| 9 | + default: '开始' | |
| 10 | + }, | |
| 11 | + endText: { | |
| 12 | + type: String, | |
| 13 | + default: '结束' | |
| 14 | + }, | |
| 15 | + weeks: { | |
| 16 | + type: Object, | |
| 17 | + default () { | |
| 18 | + return {} | |
| 19 | + } | |
| 20 | + }, | |
| 21 | + calendar: { | |
| 22 | + type: Object, | |
| 23 | + default: () => { | |
| 24 | + return {} | |
| 25 | + } | |
| 26 | + }, | |
| 27 | + selected: { | |
| 28 | + type: Array, | |
| 29 | + default: () => { | |
| 30 | + return [] | |
| 31 | + } | |
| 32 | + }, | |
| 33 | + lunar: { | |
| 34 | + type: Boolean, | |
| 35 | + default: false | |
| 36 | + }, | |
| 37 | + itemHeight: { | |
| 38 | + type: Number, | |
| 39 | + default: 64 | |
| 40 | + }, | |
| 41 | + actBadgeColor: { | |
| 42 | + type: String, | |
| 43 | + default: '#fff', | |
| 44 | + }, | |
| 45 | + weekItemStyle: { | |
| 46 | + type: Object, | |
| 47 | + default: {} | |
| 48 | + }, | |
| 49 | + // 是否显示今日默认样式(默认为true) | |
| 50 | + todayDefaultStyle: { | |
| 51 | + type: Boolean, | |
| 52 | + default: true | |
| 53 | + }, | |
| 54 | + } | |
| 55 | +} | |
| 0 | 56 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar-item/wu-calendar-item.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view ref="$weeksBox" class="wu-calendar-item__weeks-box" :style="[calendarItemStyle, weekItemStyle, { | |
| 3 | + borderTopLeftRadius: weeks.beforeRange ? '12rpx' : '', | |
| 4 | + borderBottomLeftRadius: weeks.beforeRange ? '12rpx' : '', | |
| 5 | + borderTopRightRadius: weeks.afterRange ? '12rpx' : '', | |
| 6 | + borderBottomRightRadius: weeks.afterRange ? '12rpx' : '', | |
| 7 | + }]" @click="choiceDate(weeks)"> | |
| 8 | + <view class="wu-calendar-item__weeks-box-item" :style="[actMultipleStyle, {width: itemWidth, height: itemHeight + 'px'}]"> | |
| 9 | + <!-- 自定义打点上方信息 --> | |
| 10 | + <text v-if="weeks.extraInfo && weeks.extraInfo.topInfo" class="wu-calendar-item__weeks-lunar-text" :style="[{color: weeks.extraInfo.topInfoColor || '#e43d33'}, calendarItemStyle, actMultipleStyle]">{{weeks.extraInfo.topInfo}}</text> | |
| 11 | + <!-- 徽标 --> | |
| 12 | + <text v-if="selected && weeks.extraInfo && weeks.extraInfo.badge" class="wu-calendar-item__weeks-box-circle" :style="[badgeStyle]"></text> | |
| 13 | + <!-- 日期文字 --> | |
| 14 | + <text class="wu-calendar-item__weeks-box-text" :style="[calendarItemStyle, actMultipleStyle]">{{weeks.date}}</text> | |
| 15 | + <!-- 今日的文字 --> | |
| 16 | + <text v-if="!lunar && !weeks.extraInfo && weeks.isDay && !weeks.beforeRange && !weeks.afterRange" class="wu-calendar-item__weeks-lunar-text" :style="[calendarItemStyle, actMultipleStyle]">{{todayText}}</text> | |
| 17 | + <!-- 农历文字 --> | |
| 18 | + <text v-if="lunar && !weeks.extraInfo && !weeks.beforeRange && !weeks.afterRange" class="wu-calendar-item__weeks-lunar-text" :style="[calendarItemStyle, actMultipleStyle]">{{dayText}}</text> | |
| 19 | + <!-- 选中的文字展示 --> | |
| 20 | + <text v-if="!weeks.extraInfo && (weeks.beforeRange || weeks.afterRange)" class="wu-calendar-item__weeks-lunar-text" :style="[calendarItemStyle, actMultipleStyle]">{{multipleText}}</text> | |
| 21 | + <!-- 自定义打点下方信息 --> | |
| 22 | + <text v-if="weeks.extraInfo && weeks.extraInfo.info" class="wu-calendar-item__weeks-lunar-text" :style="[{color: weeks.extraInfo.infoColor || '#e43d33'}, calendarItemStyle, actMultipleStyle]">{{weeks.extraInfo.info}}</text> | |
| 23 | + </view> | |
| 24 | + </view> | |
| 25 | +</template> | |
| 26 | + | |
| 27 | +<script> | |
| 28 | + import mpMixin from '@/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js'; | |
| 29 | + import mixin from '@/uni_modules/wu-ui-tools/libs/mixin/mixin.js'; | |
| 30 | + import props from './props.js'; | |
| 31 | + | |
| 32 | + import { | |
| 33 | + initVueI18n | |
| 34 | + } from '@dcloudio/uni-i18n' | |
| 35 | + import i18nMessages from '../i18n/index.js' | |
| 36 | +import { nextTick } from 'vue'; | |
| 37 | + const { | |
| 38 | + t | |
| 39 | + } = initVueI18n(i18nMessages) | |
| 40 | + | |
| 41 | + export default { | |
| 42 | + emits: ['change'], | |
| 43 | + mixins: [mpMixin, mixin, props], | |
| 44 | + computed: { | |
| 45 | + todayText() { | |
| 46 | + return t("wu-calender.today") | |
| 47 | + }, | |
| 48 | + // 每项日历样式 | |
| 49 | + calendarItemStyle() { | |
| 50 | + let style = {}; | |
| 51 | + let color = this.$w.Color.gradient(this.color, this.$w.Color.isLight(this.color) ? '#000' : '#fff', 100)[6] | |
| 52 | + // 有顺序别乱动 | |
| 53 | + // 选中的日期范围内的样式 | |
| 54 | + if (this.weeks.rangeMultiple) { | |
| 55 | + style = { | |
| 56 | + backgroundColor: this.$w.Color.gradient(this.color, '#fff', 100)[80], | |
| 57 | + color | |
| 58 | + } | |
| 59 | + }; | |
| 60 | + // 今天的日期样式 | |
| 61 | + if (this.weeks.isDay && this.todayDefaultStyle) { | |
| 62 | + style.color = color; | |
| 63 | + } | |
| 64 | + // 禁用的日期样式 | |
| 65 | + if(this.weeks.disable) { | |
| 66 | + style = { | |
| 67 | + backgroundColor: 'rgba(249, 249, 249, 0.3)', | |
| 68 | + color: '#c0c0c0' | |
| 69 | + } | |
| 70 | + } | |
| 71 | + return style; | |
| 72 | + }, | |
| 73 | + // 选中的日期样式 | |
| 74 | + actMultipleStyle() { | |
| 75 | + if ((this.weeks.beforeRange || this.weeks.afterRange || this.weeks.multiples || (this.calendar.fullDate === this.weeks | |
| 76 | + .fullDate && this.weeks.mode === 'single')) && !this.weeks.disable) { | |
| 77 | + // #ifdef APP-NVUE | |
| 78 | + if(this.itemWidth == '100%') return {}; | |
| 79 | + return { | |
| 80 | + backgroundColor: this.color, | |
| 81 | + color: '#fff', | |
| 82 | + borderRadius: '12rpx' | |
| 83 | + } | |
| 84 | + // #endif | |
| 85 | + // #ifndef APP-NVUE | |
| 86 | + return { | |
| 87 | + backgroundColor: this.color, | |
| 88 | + color: '#fff', | |
| 89 | + borderRadius: '12rpx' | |
| 90 | + } | |
| 91 | + // #endif | |
| 92 | + } | |
| 93 | + }, | |
| 94 | + // 徽标样式 | |
| 95 | + badgeStyle() { | |
| 96 | + let style = { | |
| 97 | + backgroundColor: this.weeks.disable ? '#c0c0c0' : '#e43d33', | |
| 98 | + width: '16rpx', | |
| 99 | + height: '16rpx' | |
| 100 | + }; | |
| 101 | + if(this.weeks.extraInfo) { | |
| 102 | + if(this.weeks.extraInfo.badgeColor) { | |
| 103 | + // 如果当前是选中日期的徽标且徽标颜色与主题色一致 为了保证 徽标颜色可以被看见 再选中时将其设置为 #fff | |
| 104 | + if ((this.weeks.beforeRange || this.weeks.afterRange || this.weeks.multiples || (this.calendar.fullDate === this.weeks | |
| 105 | + .fullDate && this.weeks.mode === 'single')) && !this.weeks.disable && this.$w.Color.convertFormat(this.weeks.extraInfo.badgeColor) == this.$w.Color.convertFormat(this.color)) { | |
| 106 | + style.backgroundColor = this.actBadgeColor; | |
| 107 | + } else { | |
| 108 | + style.backgroundColor = this.weeks.extraInfo.badgeColor | |
| 109 | + } | |
| 110 | + } | |
| 111 | + if(this.weeks.extraInfo.badgeSize) { | |
| 112 | + style.width = this.weeks.extraInfo.badgeSize | |
| 113 | + style.height = this.weeks.extraInfo.badgeSize | |
| 114 | + } | |
| 115 | + | |
| 116 | + if(!this.weeks.extraInfo.badgePosition) { | |
| 117 | + style.right = '10rpx'; | |
| 118 | + style.top = '10rpx'; | |
| 119 | + } else if(this.weeks.extraInfo.badgePosition == 'top-left'){ | |
| 120 | + style.top = '10rpx'; | |
| 121 | + style.left = '10rpx'; | |
| 122 | + } else if(this.weeks.extraInfo.badgePosition == 'top-center'){ | |
| 123 | + style.top = '10rpx'; | |
| 124 | + style.left = 'center'; | |
| 125 | + } else if(this.weeks.extraInfo.badgePosition == 'top-right'){ | |
| 126 | + style.top = '10rpx'; | |
| 127 | + style.right = '10rpx'; | |
| 128 | + } else if(this.weeks.extraInfo.badgePosition == 'bottom-left'){ | |
| 129 | + style.bottom = '10rpx'; | |
| 130 | + style.left = '10rpx'; | |
| 131 | + } else if(this.weeks.extraInfo.badgePosition == 'bottom-center'){ | |
| 132 | + style.bottom = '10rpx'; | |
| 133 | + style.left = 'center'; | |
| 134 | + } else if(this.weeks.extraInfo.badgePosition == 'bottom-right'){ | |
| 135 | + style.bottom = '10rpx'; | |
| 136 | + style.right = '10rpx'; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + return style | |
| 141 | + }, | |
| 142 | + // 日期文字 | |
| 143 | + dayText() { | |
| 144 | + let text = ''; | |
| 145 | + if (this.weeks.isDay) { | |
| 146 | + text = this.todayText | |
| 147 | + } else if(this.weeks.lunar.festival) { | |
| 148 | + text = this.weeks.lunar.festival | |
| 149 | + } else if(this.weeks.lunar.isTerm) { | |
| 150 | + text = this.weeks.lunar.Term | |
| 151 | + } else if (this.weeks.lunar.IDayCn === '初一') { | |
| 152 | + text = this.weeks.lunar.IMonthCn | |
| 153 | + } else { | |
| 154 | + text = this.weeks.lunar.IDayCn | |
| 155 | + } | |
| 156 | + return text | |
| 157 | + }, | |
| 158 | + // 选中的文字 | |
| 159 | + multipleText() { | |
| 160 | + let text = ''; | |
| 161 | + if (this.weeks.afterRange) { | |
| 162 | + text = this.endText | |
| 163 | + } else if (this.weeks.beforeRange) { | |
| 164 | + text = this.startText | |
| 165 | + } | |
| 166 | + return text; | |
| 167 | + } | |
| 168 | + }, | |
| 169 | + data() { | |
| 170 | + return { | |
| 171 | + itemWidth: '100%' | |
| 172 | + } | |
| 173 | + }, | |
| 174 | + methods: { | |
| 175 | + choiceDate(weeks) { | |
| 176 | + this.$emit('change', weeks) | |
| 177 | + } | |
| 178 | + }, | |
| 179 | + mounted() { | |
| 180 | + // #ifdef APP-NVUE | |
| 181 | + setTimeout(()=>{ | |
| 182 | + const dom = uni.requireNativePlugin('dom'); | |
| 183 | + dom.getComponentRect(this.$refs.$weeksBox, res=> { | |
| 184 | + this.itemWidth = res.size.width + 'px'; | |
| 185 | + }) | |
| 186 | + }, 10) | |
| 187 | + // #endif | |
| 188 | + } | |
| 189 | + } | |
| 190 | +</script> | |
| 191 | + | |
| 192 | +<style lang="scss" scoped> | |
| 193 | + @import '@/uni_modules/wu-ui-tools/theme.scss'; | |
| 194 | + $wu-font-size-base: 28rpx; | |
| 195 | + $wu-text-color: #333; | |
| 196 | + $wu-font-size-sm: 24rpx; | |
| 197 | + $wu-color-error: #e43d33; | |
| 198 | + $wu-opacity-disabled: 0.3; | |
| 199 | + $wu-text-color-disable: #c0c0c0; | |
| 200 | + | |
| 201 | + .wu-calendar-item__weeks-box { | |
| 202 | + flex: 1; | |
| 203 | + /* #ifndef APP-NVUE */ | |
| 204 | + display: flex; | |
| 205 | + /* #endif */ | |
| 206 | + flex-direction: column; | |
| 207 | + justify-content: center; | |
| 208 | + align-items: center; | |
| 209 | + padding: 0 0.5px; | |
| 210 | + } | |
| 211 | + | |
| 212 | + .wu-calendar-item__weeks-box-text { | |
| 213 | + font-size: $wu-font-size-base; | |
| 214 | + color: $wu-text-color; | |
| 215 | + } | |
| 216 | + | |
| 217 | + .wu-calendar-item__weeks-lunar-text { | |
| 218 | + font-size: $wu-font-size-sm; | |
| 219 | + color: $wu-text-color; | |
| 220 | + } | |
| 221 | + | |
| 222 | + .wu-calendar-item__weeks-box-item { | |
| 223 | + flex: 1; | |
| 224 | + position: relative; | |
| 225 | + /* #ifndef APP-NVUE */ | |
| 226 | + display: flex; | |
| 227 | + /* #endif */ | |
| 228 | + flex-direction: column; | |
| 229 | + justify-content: center; | |
| 230 | + align-items: center; | |
| 231 | + } | |
| 232 | + | |
| 233 | + .wu-calendar-item__weeks-box-circle { | |
| 234 | + position: absolute; | |
| 235 | + border-radius: 16rpx; | |
| 236 | + background-color: $wu-color-error; | |
| 237 | + } | |
| 238 | + | |
| 239 | + .wu-calendar-item--disable { | |
| 240 | + background-color: rgba(249, 249, 249, $wu-opacity-disabled); | |
| 241 | + color: $wu-text-color-disable; | |
| 242 | + } | |
| 243 | + | |
| 244 | + .wu-calendar-item--extra { | |
| 245 | + color: $wu-color-error; | |
| 246 | + opacity: 0.8; | |
| 247 | + } | |
| 248 | + | |
| 249 | + .wu-calendar-item--checked { | |
| 250 | + color: #fff; | |
| 251 | + } | |
| 252 | +</style> | |
| 0 | 253 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar/calendar.js
0 → 100644
| 1 | +/** | |
| 2 | + * @1900-2100区间内的公历、农历互转 | |
| 3 | + * @charset UTF-8 | |
| 4 | + * @github https://github.com/jjonline/calendar.js | |
| 5 | + * @Author Jea杨(JJonline@JJonline.Cn) | |
| 6 | + * @Time 2014-7-21 | |
| 7 | + * @Time 2016-8-13 Fixed 2033hex、Attribution Annals | |
| 8 | + * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug | |
| 9 | + * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year | |
| 10 | + * @Version 1.0.3 | |
| 11 | + * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] | |
| 12 | + * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] | |
| 13 | + */ | |
| 14 | +/* eslint-disable */ | |
| 15 | +var calendar = { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 农历1900-2100的润大小信息表 | |
| 19 | + * @Array Of Property | |
| 20 | + * @return Hex | |
| 21 | + */ | |
| 22 | + lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, | |
| 23 | + 0x055d2, // 1900-1909 | |
| 24 | + 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 | |
| 25 | + 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 | |
| 26 | + 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 | |
| 27 | + 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 | |
| 28 | + 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 | |
| 29 | + 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 | |
| 30 | + 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 | |
| 31 | + 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 | |
| 32 | + 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 | |
| 33 | + 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 | |
| 34 | + 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 | |
| 35 | + 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 | |
| 36 | + 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 | |
| 37 | + 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 | |
| 38 | + /** Add By JJonline@JJonline.Cn**/ | |
| 39 | + 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 | |
| 40 | + 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 | |
| 41 | + 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 | |
| 42 | + 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 | |
| 43 | + 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 | |
| 44 | + 0x0d520 | |
| 45 | + ], // 2100 | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 公历每个月份的天数普通表 | |
| 49 | + * @Array Of Property | |
| 50 | + * @return Number | |
| 51 | + */ | |
| 52 | + solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 天干地支之天干速查表 | |
| 56 | + * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] | |
| 57 | + * @return Cn string | |
| 58 | + */ | |
| 59 | + Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 天干地支之地支速查表 | |
| 63 | + * @Array Of Property | |
| 64 | + * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] | |
| 65 | + * @return Cn string | |
| 66 | + */ | |
| 67 | + Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', | |
| 68 | + '\u620c', '\u4ea5' | |
| 69 | + ], | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 天干地支之地支速查表<=>生肖 | |
| 73 | + * @Array Of Property | |
| 74 | + * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] | |
| 75 | + * @return Cn string | |
| 76 | + */ | |
| 77 | + Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', | |
| 78 | + '\u72d7', '\u732a' | |
| 79 | + ], | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 24节气速查表 | |
| 83 | + * @Array Of Property | |
| 84 | + * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] | |
| 85 | + * @return Cn string | |
| 86 | + */ | |
| 87 | + solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', | |
| 88 | + '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', | |
| 89 | + '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', | |
| 90 | + '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3' | |
| 91 | + ], | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 1900-2100各年的24节气日期速查表 | |
| 95 | + * @Array Of Property | |
| 96 | + * @return 0x string For splice | |
| 97 | + */ | |
| 98 | + sTermInfo: [ | |
| 99 | + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', | |
| 100 | + '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |
| 101 | + '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', | |
| 102 | + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', | |
| 103 | + 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', | |
| 104 | + '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', | |
| 105 | + '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', | |
| 106 | + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', | |
| 107 | + '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |
| 108 | + '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 109 | + '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', | |
| 110 | + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', | |
| 111 | + '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |
| 112 | + '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 113 | + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', | |
| 114 | + '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', | |
| 115 | + '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | |
| 116 | + '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | |
| 117 | + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', | |
| 118 | + '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |
| 119 | + '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 120 | + '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |
| 121 | + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', | |
| 122 | + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |
| 123 | + '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 124 | + '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |
| 125 | + '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', | |
| 126 | + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | |
| 127 | + '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | |
| 128 | + '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | |
| 129 | + '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | |
| 130 | + '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 131 | + '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |
| 132 | + '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |
| 133 | + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | |
| 134 | + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |
| 135 | + '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |
| 136 | + '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |
| 137 | + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', | |
| 138 | + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', | |
| 139 | + '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | |
| 140 | + '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |
| 141 | + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', | |
| 142 | + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |
| 143 | + '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |
| 144 | + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |
| 145 | + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', | |
| 146 | + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |
| 147 | + '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |
| 148 | + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', | |
| 149 | + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', | |
| 150 | + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', | |
| 151 | + '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |
| 152 | + '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | |
| 153 | + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', | |
| 154 | + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |
| 155 | + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', | |
| 156 | + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', | |
| 157 | + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', | |
| 158 | + '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |
| 159 | + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', | |
| 160 | + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', | |
| 161 | + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', | |
| 162 | + '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |
| 163 | + '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | |
| 164 | + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', | |
| 165 | + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722' | |
| 166 | + ], | |
| 167 | + | |
| 168 | + festivals: { | |
| 169 | + '1-1': '元旦', | |
| 170 | + '2-14': '情人节', | |
| 171 | + '3-8': '妇女节', | |
| 172 | + '3-12': '植树节', | |
| 173 | + '4-1': '愚人节', | |
| 174 | + '5-1': '劳动节', | |
| 175 | + '5-4': '青年节', | |
| 176 | + '5-12': '护士节', | |
| 177 | + '6-1': '儿童节', | |
| 178 | + '8-1': '建军节', | |
| 179 | + '9-10': '教师节', | |
| 180 | + '10-1': '国庆', | |
| 181 | + '11-1': '万圣节', | |
| 182 | + '12-24': '圣诞节', | |
| 183 | + '正月初一': '春节', | |
| 184 | + '二月初二': '龙抬头', | |
| 185 | + '五月初五': '端午节', | |
| 186 | + '七月初七': '七夕节', | |
| 187 | + '七月十五': '中元节', | |
| 188 | + '八月十五': '中秋节', | |
| 189 | + '九月初九': '重阳节', | |
| 190 | + '腊月初八': '腊八节', | |
| 191 | + '腊月廿三': '小年', | |
| 192 | + '腊月三十': '除夕', | |
| 193 | + }, | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * 数字转中文速查表 | |
| 197 | + * @Array Of Property | |
| 198 | + * @trans ['日','一','二','三','四','五','六','七','八','九','十'] | |
| 199 | + * @return Cn string | |
| 200 | + */ | |
| 201 | + nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', | |
| 202 | + '\u5341' | |
| 203 | + ], | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * 日期转农历称呼速查表 | |
| 207 | + * @Array Of Property | |
| 208 | + * @trans ['初','十','廿','卅'] | |
| 209 | + * @return Cn string | |
| 210 | + */ | |
| 211 | + nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], | |
| 212 | + | |
| 213 | + /** | |
| 214 | + * 月份转农历称呼速查表 | |
| 215 | + * @Array Of Property | |
| 216 | + * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] | |
| 217 | + * @return Cn string | |
| 218 | + */ | |
| 219 | + nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', | |
| 220 | + '\u51ac', '\u814a' | |
| 221 | + ], | |
| 222 | + | |
| 223 | + /** | |
| 224 | + * 返回农历y年一整年的总天数 | |
| 225 | + * @param lunar Year | |
| 226 | + * @return Number | |
| 227 | + * @eg:var count = calendar.lYearDays(1987) ;//count=387 | |
| 228 | + */ | |
| 229 | + lYearDays: function(y) { | |
| 230 | + var i; | |
| 231 | + var sum = 348 | |
| 232 | + for (i = 0x8000; i > 0x8; i >>= 1) { | |
| 233 | + sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 | |
| 234 | + } | |
| 235 | + return (sum + this.leapDays(y)) | |
| 236 | + }, | |
| 237 | + | |
| 238 | + /** | |
| 239 | + * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 | |
| 240 | + * @param lunar Year | |
| 241 | + * @return Number (0-12) | |
| 242 | + * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 | |
| 243 | + */ | |
| 244 | + leapMonth: function(y) { // 闰字编码 \u95f0 | |
| 245 | + return (this.lunarInfo[y - 1900] & 0xf) | |
| 246 | + }, | |
| 247 | + | |
| 248 | + /** | |
| 249 | + * 返回农历y年闰月的天数 若该年没有闰月则返回0 | |
| 250 | + * @param lunar Year | |
| 251 | + * @return Number (0、29、30) | |
| 252 | + * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 | |
| 253 | + */ | |
| 254 | + leapDays: function(y) { | |
| 255 | + if (this.leapMonth(y)) { | |
| 256 | + return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) | |
| 257 | + } | |
| 258 | + return (0) | |
| 259 | + }, | |
| 260 | + | |
| 261 | + /** | |
| 262 | + * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 | |
| 263 | + * @param lunar Year | |
| 264 | + * @return Number (-1、29、30) | |
| 265 | + * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 | |
| 266 | + */ | |
| 267 | + monthDays: function(y, m) { | |
| 268 | + if (m > 12 || m < 1) { | |
| 269 | + return -1 | |
| 270 | + } // 月份参数从1至12,参数错误返回-1 | |
| 271 | + return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) | |
| 272 | + }, | |
| 273 | + | |
| 274 | + /** | |
| 275 | + * 返回公历(!)y年m月的天数 | |
| 276 | + * @param solar Year | |
| 277 | + * @return Number (-1、28、29、30、31) | |
| 278 | + * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 | |
| 279 | + */ | |
| 280 | + solarDays: function(y, m) { | |
| 281 | + if (m > 12 || m < 1) { | |
| 282 | + return -1 | |
| 283 | + } // 若参数错误 返回-1 | |
| 284 | + var ms = m - 1 | |
| 285 | + if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29 | |
| 286 | + return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) | |
| 287 | + } else { | |
| 288 | + return (this.solarMonth[ms]) | |
| 289 | + } | |
| 290 | + }, | |
| 291 | + | |
| 292 | + /** | |
| 293 | + * 农历年份转换为干支纪年 | |
| 294 | + * @param lYear 农历年的年份数 | |
| 295 | + * @return Cn string | |
| 296 | + */ | |
| 297 | + toGanZhiYear: function(lYear) { | |
| 298 | + var ganKey = (lYear - 3) % 10 | |
| 299 | + var zhiKey = (lYear - 3) % 12 | |
| 300 | + if (ganKey == 0) ganKey = 10 // 如果余数为0则为最后一个天干 | |
| 301 | + if (zhiKey == 0) zhiKey = 12 // 如果余数为0则为最后一个地支 | |
| 302 | + return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] | |
| 303 | + }, | |
| 304 | + | |
| 305 | + /** | |
| 306 | + * 公历月、日判断所属星座 | |
| 307 | + * @param cMonth [description] | |
| 308 | + * @param cDay [description] | |
| 309 | + * @return Cn string | |
| 310 | + */ | |
| 311 | + toAstro: function(cMonth, cDay) { | |
| 312 | + var s = | |
| 313 | + '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' | |
| 314 | + var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] | |
| 315 | + return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7' // 座 | |
| 316 | + }, | |
| 317 | + | |
| 318 | + /** | |
| 319 | + * 传入offset偏移量返回干支 | |
| 320 | + * @param offset 相对甲子的偏移量 | |
| 321 | + * @return Cn string | |
| 322 | + */ | |
| 323 | + toGanZhi: function(offset) { | |
| 324 | + return this.Gan[offset % 10] + this.Zhi[offset % 12] | |
| 325 | + }, | |
| 326 | + | |
| 327 | + /** | |
| 328 | + * 传入公历(!)y年获得该年第n个节气的公历日期 | |
| 329 | + * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 | |
| 330 | + * @return day Number | |
| 331 | + * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 | |
| 332 | + */ | |
| 333 | + getTerm: function(y, n) { | |
| 334 | + if (y < 1900 || y > 2100) { | |
| 335 | + return -1 | |
| 336 | + } | |
| 337 | + if (n < 1 || n > 24) { | |
| 338 | + return -1 | |
| 339 | + } | |
| 340 | + var _table = this.sTermInfo[y - 1900] | |
| 341 | + var _info = [ | |
| 342 | + parseInt('0x' + _table.substr(0, 5)).toString(), | |
| 343 | + parseInt('0x' + _table.substr(5, 5)).toString(), | |
| 344 | + parseInt('0x' + _table.substr(10, 5)).toString(), | |
| 345 | + parseInt('0x' + _table.substr(15, 5)).toString(), | |
| 346 | + parseInt('0x' + _table.substr(20, 5)).toString(), | |
| 347 | + parseInt('0x' + _table.substr(25, 5)).toString() | |
| 348 | + ] | |
| 349 | + var _calday = [ | |
| 350 | + _info[0].substr(0, 1), | |
| 351 | + _info[0].substr(1, 2), | |
| 352 | + _info[0].substr(3, 1), | |
| 353 | + _info[0].substr(4, 2), | |
| 354 | + | |
| 355 | + _info[1].substr(0, 1), | |
| 356 | + _info[1].substr(1, 2), | |
| 357 | + _info[1].substr(3, 1), | |
| 358 | + _info[1].substr(4, 2), | |
| 359 | + | |
| 360 | + _info[2].substr(0, 1), | |
| 361 | + _info[2].substr(1, 2), | |
| 362 | + _info[2].substr(3, 1), | |
| 363 | + _info[2].substr(4, 2), | |
| 364 | + | |
| 365 | + _info[3].substr(0, 1), | |
| 366 | + _info[3].substr(1, 2), | |
| 367 | + _info[3].substr(3, 1), | |
| 368 | + _info[3].substr(4, 2), | |
| 369 | + | |
| 370 | + _info[4].substr(0, 1), | |
| 371 | + _info[4].substr(1, 2), | |
| 372 | + _info[4].substr(3, 1), | |
| 373 | + _info[4].substr(4, 2), | |
| 374 | + | |
| 375 | + _info[5].substr(0, 1), | |
| 376 | + _info[5].substr(1, 2), | |
| 377 | + _info[5].substr(3, 1), | |
| 378 | + _info[5].substr(4, 2) | |
| 379 | + ] | |
| 380 | + return parseInt(_calday[n - 1]) | |
| 381 | + }, | |
| 382 | + | |
| 383 | + /** | |
| 384 | + * 传入农历数字月份返回汉语通俗表示法 | |
| 385 | + * @param lunar month | |
| 386 | + * @return Cn string | |
| 387 | + * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' | |
| 388 | + */ | |
| 389 | + toChinaMonth: function(m) { // 月 => \u6708 | |
| 390 | + if (m > 12 || m < 1) { | |
| 391 | + return -1 | |
| 392 | + } // 若参数错误 返回-1 | |
| 393 | + var s = this.nStr3[m - 1] | |
| 394 | + s += '\u6708' // 加上月字 | |
| 395 | + return s | |
| 396 | + }, | |
| 397 | + | |
| 398 | + /** | |
| 399 | + * 传入农历日期数字返回汉字表示法 | |
| 400 | + * @param lunar day | |
| 401 | + * @return Cn string | |
| 402 | + * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' | |
| 403 | + */ | |
| 404 | + toChinaDay: function(d) { // 日 => \u65e5 | |
| 405 | + var s | |
| 406 | + switch (d) { | |
| 407 | + case 10: | |
| 408 | + s = '\u521d\u5341'; | |
| 409 | + break | |
| 410 | + case 20: | |
| 411 | + s = '\u4e8c\u5341'; | |
| 412 | + break | |
| 413 | + break | |
| 414 | + case 30: | |
| 415 | + s = '\u4e09\u5341'; | |
| 416 | + break | |
| 417 | + break | |
| 418 | + default: | |
| 419 | + s = this.nStr2[Math.floor(d / 10)] | |
| 420 | + s += this.nStr1[d % 10] | |
| 421 | + } | |
| 422 | + return (s) | |
| 423 | + }, | |
| 424 | + | |
| 425 | + /** | |
| 426 | + * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” | |
| 427 | + * @param y year | |
| 428 | + * @return Cn string | |
| 429 | + * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' | |
| 430 | + */ | |
| 431 | + getAnimal: function(y) { | |
| 432 | + return this.Animals[(y - 4) % 12] | |
| 433 | + }, | |
| 434 | + | |
| 435 | + /** | |
| 436 | + * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON | |
| 437 | + * @param y solar year | |
| 438 | + * @param m solar month | |
| 439 | + * @param d solar day | |
| 440 | + * @return JSON object | |
| 441 | + * @eg:console.log(calendar.solar2lunar(1987,11,01)); | |
| 442 | + */ | |
| 443 | + solar2lunar: function(y, m, d) { // 参数区间1900.1.31~2100.12.31 | |
| 444 | + // 年份限定、上限 | |
| 445 | + if (y < 1900 || y > 2100) { | |
| 446 | + return -1 // undefined转换为数字变为NaN | |
| 447 | + } | |
| 448 | + // 公历传参最下限 | |
| 449 | + if (y == 1900 && m == 1 && d < 31) { | |
| 450 | + return -1 | |
| 451 | + } | |
| 452 | + // 未传参 获得当天 | |
| 453 | + if (!y) { | |
| 454 | + var objDate = new Date() | |
| 455 | + } else { | |
| 456 | + var objDate = new Date(y, parseInt(m) - 1, d) | |
| 457 | + } | |
| 458 | + var i; | |
| 459 | + var leap = 0; | |
| 460 | + var temp = 0 | |
| 461 | + // 修正ymd参数 | |
| 462 | + var y = objDate.getFullYear() | |
| 463 | + var m = objDate.getMonth() + 1 | |
| 464 | + var d = objDate.getDate() | |
| 465 | + var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, | |
| 466 | + 31)) / 86400000 | |
| 467 | + for (i = 1900; i < 2101 && offset > 0; i++) { | |
| 468 | + temp = this.lYearDays(i) | |
| 469 | + offset -= temp | |
| 470 | + } | |
| 471 | + if (offset < 0) { | |
| 472 | + offset += temp; | |
| 473 | + i-- | |
| 474 | + } | |
| 475 | + | |
| 476 | + // 是否今天 | |
| 477 | + var isTodayObj = new Date() | |
| 478 | + var isToday = false | |
| 479 | + if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { | |
| 480 | + isToday = true | |
| 481 | + } | |
| 482 | + // 星期几 | |
| 483 | + var nWeek = objDate.getDay() | |
| 484 | + var cWeek = this.nStr1[nWeek] | |
| 485 | + // 数字表示周几顺应天朝周一开始的惯例 | |
| 486 | + if (nWeek == 0) { | |
| 487 | + nWeek = 7 | |
| 488 | + } | |
| 489 | + // 农历年 | |
| 490 | + var year = i | |
| 491 | + var leap = this.leapMonth(i) // 闰哪个月 | |
| 492 | + var isLeap = false | |
| 493 | + | |
| 494 | + // 效验闰月 | |
| 495 | + for (i = 1; i < 13 && offset > 0; i++) { | |
| 496 | + // 闰月 | |
| 497 | + if (leap > 0 && i == (leap + 1) && isLeap == false) { | |
| 498 | + --i | |
| 499 | + isLeap = true; | |
| 500 | + temp = this.leapDays(year) // 计算农历闰月天数 | |
| 501 | + } else { | |
| 502 | + temp = this.monthDays(year, i) // 计算农历普通月天数 | |
| 503 | + } | |
| 504 | + // 解除闰月 | |
| 505 | + if (isLeap == true && i == (leap + 1)) { | |
| 506 | + isLeap = false | |
| 507 | + } | |
| 508 | + offset -= temp | |
| 509 | + } | |
| 510 | + // 闰月导致数组下标重叠取反 | |
| 511 | + if (offset == 0 && leap > 0 && i == leap + 1) { | |
| 512 | + if (isLeap) { | |
| 513 | + isLeap = false | |
| 514 | + } else { | |
| 515 | + isLeap = true; | |
| 516 | + --i | |
| 517 | + } | |
| 518 | + } | |
| 519 | + if (offset < 0) { | |
| 520 | + offset += temp; | |
| 521 | + --i | |
| 522 | + } | |
| 523 | + // 农历月 | |
| 524 | + var month = i | |
| 525 | + // 农历日 | |
| 526 | + var day = offset + 1 | |
| 527 | + // 天干地支处理 | |
| 528 | + var sm = m - 1 | |
| 529 | + var gzY = this.toGanZhiYear(year) | |
| 530 | + | |
| 531 | + // 当月的两个节气 | |
| 532 | + // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` | |
| 533 | + var firstNode = this.getTerm(y, (m * 2 - 1)) // 返回当月「节」为几日开始 | |
| 534 | + var secondNode = this.getTerm(y, (m * 2)) // 返回当月「节」为几日开始 | |
| 535 | + | |
| 536 | + // 依据12节气修正干支月 | |
| 537 | + var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) | |
| 538 | + if (d >= firstNode) { | |
| 539 | + gzM = this.toGanZhi((y - 1900) * 12 + m + 12) | |
| 540 | + } | |
| 541 | + | |
| 542 | + // 传入的日期的节气与否 | |
| 543 | + var isTerm = false | |
| 544 | + var Term = null | |
| 545 | + if (firstNode == d) { | |
| 546 | + isTerm = true | |
| 547 | + Term = this.solarTerm[m * 2 - 2] | |
| 548 | + } | |
| 549 | + if (secondNode == d) { | |
| 550 | + isTerm = true | |
| 551 | + Term = this.solarTerm[m * 2 - 1] | |
| 552 | + } | |
| 553 | + | |
| 554 | + // 计算农历日期 | |
| 555 | + const IMonthCn = (isLeap ? '\u95f0' : '') + this.toChinaMonth(month) | |
| 556 | + // 农历日期的汉字表述法 | |
| 557 | + let IDayCn = this.toChinaDay(day) | |
| 558 | + | |
| 559 | + // 节日 | |
| 560 | + let festival = ''; | |
| 561 | + // 农历的月日汉字表述 | |
| 562 | + let lMDcn = IMonthCn + IDayCn; | |
| 563 | + // 月份日期 | |
| 564 | + let MD = m + '-' + d; | |
| 565 | + if (this.festivals.hasOwnProperty(lMDcn)) { | |
| 566 | + festival = this.festivals[lMDcn] | |
| 567 | + } else if(this.festivals.hasOwnProperty(MD)) { | |
| 568 | + festival = this.festivals[MD] | |
| 569 | + } | |
| 570 | + | |
| 571 | + // 日柱 当月一日与 1900/1/1 相差天数 | |
| 572 | + var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 | |
| 573 | + var gzD = this.toGanZhi(dayCyclical + d - 1) | |
| 574 | + // 该日期所属的星座 | |
| 575 | + var astro = this.toAstro(m, d) | |
| 576 | + | |
| 577 | + return { | |
| 578 | + 'lYear': year, | |
| 579 | + 'lMonth': month, | |
| 580 | + 'lDay': day, | |
| 581 | + 'Animal': this.getAnimal(year), | |
| 582 | + 'IMonthCn': IMonthCn, | |
| 583 | + 'IDayCn': IDayCn, | |
| 584 | + 'cYear': y, | |
| 585 | + 'cMonth': m, | |
| 586 | + 'cDay': d, | |
| 587 | + 'gzYear': gzY, | |
| 588 | + 'gzMonth': gzM, | |
| 589 | + 'gzDay': gzD, | |
| 590 | + 'isToday': isToday, | |
| 591 | + 'isLeap': isLeap, | |
| 592 | + 'nWeek': nWeek, | |
| 593 | + 'ncWeek': '\u661f\u671f' + cWeek, | |
| 594 | + 'isTerm': isTerm, | |
| 595 | + 'Term': Term, | |
| 596 | + 'astro': astro, | |
| 597 | + 'festival': festival | |
| 598 | + } | |
| 599 | + }, | |
| 600 | + | |
| 601 | + /** | |
| 602 | + * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON | |
| 603 | + * @param y lunar year | |
| 604 | + * @param m lunar month | |
| 605 | + * @param d lunar day | |
| 606 | + * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] | |
| 607 | + * @return JSON object | |
| 608 | + * @eg:console.log(calendar.lunar2solar(1987,9,10)); | |
| 609 | + */ | |
| 610 | + lunar2solar: function(y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1 | |
| 611 | + var isLeapMonth = !!isLeapMonth | |
| 612 | + var leapOffset = 0 | |
| 613 | + var leapMonth = this.leapMonth(y) | |
| 614 | + var leapDay = this.leapDays(y) | |
| 615 | + if (isLeapMonth && (leapMonth != m)) { | |
| 616 | + return -1 | |
| 617 | + } // 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 | |
| 618 | + if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { | |
| 619 | + return -1 | |
| 620 | + } // 超出了最大极限值 | |
| 621 | + var day = this.monthDays(y, m) | |
| 622 | + var _day = day | |
| 623 | + // bugFix 2016-9-25 | |
| 624 | + // if month is leap, _day use leapDays method | |
| 625 | + if (isLeapMonth) { | |
| 626 | + _day = this.leapDays(y, m) | |
| 627 | + } | |
| 628 | + if (y < 1900 || y > 2100 || d > _day) { | |
| 629 | + return -1 | |
| 630 | + } // 参数合法性效验 | |
| 631 | + | |
| 632 | + // 计算农历的时间差 | |
| 633 | + var offset = 0 | |
| 634 | + for (var i = 1900; i < y; i++) { | |
| 635 | + offset += this.lYearDays(i) | |
| 636 | + } | |
| 637 | + var leap = 0; | |
| 638 | + var isAdd = false | |
| 639 | + for (var i = 1; i < m; i++) { | |
| 640 | + leap = this.leapMonth(y) | |
| 641 | + if (!isAdd) { // 处理闰月 | |
| 642 | + if (leap <= i && leap > 0) { | |
| 643 | + offset += this.leapDays(y); | |
| 644 | + isAdd = true | |
| 645 | + } | |
| 646 | + } | |
| 647 | + offset += this.monthDays(y, i) | |
| 648 | + } | |
| 649 | + // 转换闰月农历 需补充该年闰月的前一个月的时差 | |
| 650 | + if (isLeapMonth) { | |
| 651 | + offset += day | |
| 652 | + } | |
| 653 | + // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) | |
| 654 | + var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) | |
| 655 | + var calObj = new Date((offset + d - 31) * 86400000 + stmap) | |
| 656 | + var cY = calObj.getUTCFullYear() | |
| 657 | + var cM = calObj.getUTCMonth() + 1 | |
| 658 | + var cD = calObj.getUTCDate() | |
| 659 | + | |
| 660 | + return this.solar2lunar(cY, cM, cD) | |
| 661 | + } | |
| 662 | +} | |
| 663 | + | |
| 664 | +export default calendar | |
| 0 | 665 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar/props.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + // 自定义当前时间 | |
| 4 | + date: { | |
| 5 | + type: [String, Array], | |
| 6 | + default: '' | |
| 7 | + }, | |
| 8 | + // 日历类型(默认为month) | |
| 9 | + type: { | |
| 10 | + type: String, | |
| 11 | + default: 'month', | |
| 12 | + validator(value) { | |
| 13 | + return ['month', 'week'].includes(value) | |
| 14 | + } | |
| 15 | + }, | |
| 16 | + // 日期选择模式 | |
| 17 | + mode: { | |
| 18 | + type: String, | |
| 19 | + default: 'single' | |
| 20 | + }, | |
| 21 | + // 是否使用默认日期(今天,默认为true) | |
| 22 | + useToday: { | |
| 23 | + type: Boolean, | |
| 24 | + default: true | |
| 25 | + }, | |
| 26 | + // 是否显示今日默认样式(默认为true) | |
| 27 | + todayDefaultStyle: { | |
| 28 | + type: Boolean, | |
| 29 | + default: true | |
| 30 | + }, | |
| 31 | + // 是否使用折叠功能 | |
| 32 | + fold: { | |
| 33 | + type: Boolean, | |
| 34 | + default: null | |
| 35 | + }, | |
| 36 | + // 主题色 | |
| 37 | + color: { | |
| 38 | + type: String, | |
| 39 | + default: '#3c9cff' | |
| 40 | + }, | |
| 41 | + // 日历中每一项日期的高度(默认70),单位px | |
| 42 | + itemHeight: { | |
| 43 | + type: Number, | |
| 44 | + default: 70 | |
| 45 | + }, | |
| 46 | + // 取消文字的颜色 | |
| 47 | + cancelColor: { | |
| 48 | + type: String, | |
| 49 | + default: '#333' | |
| 50 | + }, | |
| 51 | + // 确定文字的颜色 | |
| 52 | + confirmColor: { | |
| 53 | + type: String, | |
| 54 | + default: '#333' | |
| 55 | + }, | |
| 56 | + // mode=range时,第一个日期底部的提示文字 | |
| 57 | + startText: { | |
| 58 | + type: String, | |
| 59 | + default: '开始' | |
| 60 | + }, | |
| 61 | + // mode=range时,最后一个日期底部的提示文字 | |
| 62 | + endText: { | |
| 63 | + type: String, | |
| 64 | + default: '结束' | |
| 65 | + }, | |
| 66 | + // 日历以周几开始 | |
| 67 | + startWeek: { | |
| 68 | + type: String, | |
| 69 | + default: 'sun', | |
| 70 | + validator(value) { | |
| 71 | + return ['sun', 'mon'].includes(value) | |
| 72 | + } | |
| 73 | + }, | |
| 74 | + // 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] | |
| 75 | + selected: { | |
| 76 | + type: Array, | |
| 77 | + default () { | |
| 78 | + return [] | |
| 79 | + } | |
| 80 | + }, | |
| 81 | + // 是否显示农历 | |
| 82 | + lunar: { | |
| 83 | + type: Boolean, | |
| 84 | + default: false | |
| 85 | + }, | |
| 86 | + // 日期选择范围-开始日期 | |
| 87 | + startDate: { | |
| 88 | + type: String, | |
| 89 | + default: '' | |
| 90 | + }, | |
| 91 | + // 日期选择范围-结束日期 | |
| 92 | + endDate: { | |
| 93 | + type: String, | |
| 94 | + default: '' | |
| 95 | + }, | |
| 96 | + // 允许日期选择范围内重选结束日期 | |
| 97 | + rangeEndRepick: { | |
| 98 | + type: Boolean, | |
| 99 | + default: false | |
| 100 | + }, | |
| 101 | + // 允许日期选择范围起始日期为同一天 | |
| 102 | + rangeSameDay: { | |
| 103 | + type: Boolean, | |
| 104 | + default: false | |
| 105 | + }, | |
| 106 | + // 允许日期选择范围内遇到打点禁用日期进行截断 | |
| 107 | + rangeHaveDisableTruncation: { | |
| 108 | + type: Boolean, | |
| 109 | + default: false | |
| 110 | + }, | |
| 111 | + // 每月仅显示当月日期 | |
| 112 | + monthShowCurrentMonth: { | |
| 113 | + type: Boolean, | |
| 114 | + default: false | |
| 115 | + }, | |
| 116 | + // 插入模式,可选值,ture:插入模式;false:弹窗模式; 默认为插入模式 | |
| 117 | + insert: { | |
| 118 | + type: Boolean, | |
| 119 | + default: true | |
| 120 | + }, | |
| 121 | + // 滑动切换模式,可选值 horizontal: 横向 vertical:纵向 none: 不使用滑动切换 | |
| 122 | + slideSwitchMode: { | |
| 123 | + type: String, | |
| 124 | + default: 'horizontal' | |
| 125 | + }, | |
| 126 | + // 是否显示月份为背景 | |
| 127 | + showMonth: { | |
| 128 | + type: Boolean, | |
| 129 | + default: true | |
| 130 | + }, | |
| 131 | + // 弹窗模式是否清空上次选择内容 | |
| 132 | + clearDate: { | |
| 133 | + type: Boolean, | |
| 134 | + default: true | |
| 135 | + }, | |
| 136 | + // 是否点击遮罩层关闭 | |
| 137 | + maskClick: { | |
| 138 | + type: Boolean, | |
| 139 | + default: false | |
| 140 | + }, | |
| 141 | + // 是否禁止点击日历 | |
| 142 | + disabledChoice: { | |
| 143 | + type: Boolean, | |
| 144 | + default: false | |
| 145 | + }, | |
| 146 | + // 弹窗日历取消和确认按钮的显示位置 | |
| 147 | + operationPosition: { | |
| 148 | + type: String, | |
| 149 | + default: 'top', | |
| 150 | + validator(value) { | |
| 151 | + return ['top', 'bottom'].includes(value) | |
| 152 | + } | |
| 153 | + }, | |
| 154 | + // 弹窗日历点击确认时是否需要选择完整日期 | |
| 155 | + confirmFullDate: { | |
| 156 | + type: Boolean, | |
| 157 | + default: false | |
| 158 | + }, | |
| 159 | + // 当通过 `selected` 属性设置某个日期 `badgeColor`后,如果该日期被选择且主题色与 `badgeColor` 一致时,徽标会显示本颜色 | |
| 160 | + actBadgeColor: { | |
| 161 | + type: String, | |
| 162 | + default: '#fff' | |
| 163 | + }, | |
| 164 | + ...uni.$w?.props?.calendar | |
| 165 | + } | |
| 166 | +} | |
| 0 | 167 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar/util.js
0 → 100644
| 1 | +import calendar from './calendar.js'; | |
| 2 | +import CALENDAR from './calendar.js' | |
| 3 | + | |
| 4 | +class Calendar { | |
| 5 | + constructor({ | |
| 6 | + date, | |
| 7 | + selected, | |
| 8 | + startDate, | |
| 9 | + endDate, | |
| 10 | + mode, | |
| 11 | + monthShowCurrentMonth, | |
| 12 | + rangeEndRepick, | |
| 13 | + rangeSameDay, | |
| 14 | + rangeHaveDisableTruncation, | |
| 15 | + type, | |
| 16 | + foldStatus, | |
| 17 | + startWeek | |
| 18 | + } = {}) { | |
| 19 | + // 当前日期 | |
| 20 | + this.date = this.getDate(new Date()) // 当前初入日期 | |
| 21 | + // 打点信息 | |
| 22 | + this.selected = selected || []; | |
| 23 | + // 范围开始 | |
| 24 | + this.startDate = startDate | |
| 25 | + // 范围结束 | |
| 26 | + this.endDate = endDate | |
| 27 | + // 日历以周几开始 | |
| 28 | + this.startWeek = startWeek | |
| 29 | + // 日期选择类型 | |
| 30 | + this.mode = mode | |
| 31 | + // 日历类型 | |
| 32 | + this.type = type | |
| 33 | + // 折叠状态 | |
| 34 | + this.foldStatus = foldStatus | |
| 35 | + // 允许范围内重选结束日期 | |
| 36 | + this.rangeEndRepick = rangeEndRepick | |
| 37 | + // 允许日期选择范围起始日期为同一天 | |
| 38 | + this.rangeSameDay = rangeSameDay | |
| 39 | + // 日期选择范围内遇到打点禁用日期是否截断 | |
| 40 | + this.rangeHaveDisableTruncation = rangeHaveDisableTruncation | |
| 41 | + // 每月是否仅显示当月的数据 | |
| 42 | + this.monthShowCurrentMonth = monthShowCurrentMonth | |
| 43 | + // 清理多选状态 | |
| 44 | + this.cleanRange() | |
| 45 | + // 每周日期 | |
| 46 | + this.weeks = {} | |
| 47 | + // 多个日期 | |
| 48 | + this.multiple = []; | |
| 49 | + } | |
| 50 | + /** | |
| 51 | + * 设置日期 | |
| 52 | + * @param {Object} date | |
| 53 | + */ | |
| 54 | + setDate(date) { | |
| 55 | + this.selectDate = this.getDate(date) | |
| 56 | + this._getWeek(this.selectDate.fullDate) | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 清除范围 | |
| 61 | + */ | |
| 62 | + cleanRange() { | |
| 63 | + this.rangeStatus = { | |
| 64 | + before: '', | |
| 65 | + after: '', | |
| 66 | + data: [] | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 清除多选 | |
| 72 | + */ | |
| 73 | + cleanMultiple() { | |
| 74 | + this.multiple = [] | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 重置开始日期 | |
| 79 | + */ | |
| 80 | + resetSatrtDate(startDate) { | |
| 81 | + // 范围开始 | |
| 82 | + this.startDate = startDate | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 重置结束日期 | |
| 87 | + */ | |
| 88 | + resetEndDate(endDate) { | |
| 89 | + // 范围结束 | |
| 90 | + this.endDate = endDate | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 重置是否每月仅显示当月数据 | |
| 95 | + * @param {Boolean} show 是否仅显示当月数据 | |
| 96 | + */ | |
| 97 | + resetMonthShowCurrentMonth(show) { | |
| 98 | + this.monthShowCurrentMonth = show | |
| 99 | + } | |
| 100 | + | |
| 101 | + // 重置允许范围内重选结束日期 | |
| 102 | + resetRangeEndRepick(val) { | |
| 103 | + this.rangeEndRepick = val | |
| 104 | + } | |
| 105 | + | |
| 106 | + // 重置允许日期范围选择起始日期为同一天 | |
| 107 | + resetRangeSameDay(val) { | |
| 108 | + this.rangeSameDay = val | |
| 109 | + } | |
| 110 | + | |
| 111 | + // 重置范围内遇到打点禁用日期是否截断 | |
| 112 | + resetRangeHaveDisableTruncation(val) { | |
| 113 | + this.rangeHaveDisableTruncation = val | |
| 114 | + } | |
| 115 | + | |
| 116 | + // 重置日期选择模式 | |
| 117 | + resetMode(val) { | |
| 118 | + this.mode = val | |
| 119 | + } | |
| 120 | + | |
| 121 | + // 重置折叠状态 | |
| 122 | + resetFoldStatus(val) { | |
| 123 | + this.foldStatus = val | |
| 124 | + } | |
| 125 | + | |
| 126 | + // 重置日历以周几开始 | |
| 127 | + resetStartWeek(val) { | |
| 128 | + this.startWeek = val | |
| 129 | + } | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * 创建本月某一天的信息 | |
| 133 | + */ | |
| 134 | + _createCurrentDay(nowDate, full, date) { | |
| 135 | + // 是否今天 | |
| 136 | + let isDay = this.date.fullDate === nowDate | |
| 137 | + // 获取打点信息 | |
| 138 | + let info = this.selected && this.selected.find((item) => { | |
| 139 | + if (this.dateEqual(nowDate, item.date)) { | |
| 140 | + return item | |
| 141 | + } | |
| 142 | + }) | |
| 143 | + | |
| 144 | + // 日期禁用 | |
| 145 | + let disableBefore = true | |
| 146 | + let disableAfter = true | |
| 147 | + if (this.startDate) { | |
| 148 | + disableBefore = this.dateCompare(this.startDate, nowDate) | |
| 149 | + } | |
| 150 | + | |
| 151 | + if (this.endDate) { | |
| 152 | + disableAfter = this.dateCompare(nowDate, this.endDate) | |
| 153 | + } | |
| 154 | + | |
| 155 | + // 范围选择模式 | |
| 156 | + let ranges = this.rangeStatus.data | |
| 157 | + let checked = false | |
| 158 | + if (this.mode == 'range') { | |
| 159 | + checked = ranges.findIndex((item) => this.dateEqual(item, nowDate)) !== -1 ? true : false; | |
| 160 | + } | |
| 161 | + | |
| 162 | + // 多日期选择模式 | |
| 163 | + let multiples = this.multiple | |
| 164 | + let multiplesChecked = false | |
| 165 | + if (this.mode == 'multiple') { | |
| 166 | + multiplesChecked = multiples.findIndex(item => this.dateEqual(item, nowDate)) !== -1; | |
| 167 | + } | |
| 168 | + | |
| 169 | + let data = { | |
| 170 | + fullDate: nowDate, | |
| 171 | + year: full.year, | |
| 172 | + date, | |
| 173 | + type: this.type, | |
| 174 | + mode: this.mode, | |
| 175 | + multiples: this.mode == 'multiple' ? multiplesChecked : false, | |
| 176 | + rangeMultiple: this.mode == 'range' ? checked : false, | |
| 177 | + beforeRange: this.dateEqual(this.rangeStatus.before, nowDate), | |
| 178 | + afterRange: this.dateEqual(this.rangeStatus.after, nowDate), | |
| 179 | + month: full.month, | |
| 180 | + lunar: this.getlunar(full.year, full.month, date), | |
| 181 | + disable: !(disableBefore && disableAfter), | |
| 182 | + isDay | |
| 183 | + } | |
| 184 | + | |
| 185 | + | |
| 186 | + if (info) { | |
| 187 | + data.extraInfo = info; | |
| 188 | + data.disable = info.disable || false; | |
| 189 | + } | |
| 190 | + | |
| 191 | + return data | |
| 192 | + } | |
| 193 | + | |
| 194 | + /** | |
| 195 | + * 获取任意时间 | |
| 196 | + */ | |
| 197 | + getDate(date, AddDayCount = 0, str = 'day') { | |
| 198 | + if (!date) { | |
| 199 | + date = new Date() | |
| 200 | + } | |
| 201 | + if (typeof date !== 'object') { | |
| 202 | + date = date.replace(/-/g, '/') | |
| 203 | + } | |
| 204 | + const dd = new Date(date) | |
| 205 | + switch (str) { | |
| 206 | + case 'day': | |
| 207 | + dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 | |
| 208 | + break | |
| 209 | + case 'month': | |
| 210 | + if (dd.getDate() === 31 && AddDayCount > 0) { | |
| 211 | + dd.setDate(dd.getDate() + AddDayCount) | |
| 212 | + } else { | |
| 213 | + const preMonth = dd.getMonth() | |
| 214 | + dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期 | |
| 215 | + const nextMonth = dd.getMonth() | |
| 216 | + // 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 | |
| 217 | + if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) { | |
| 218 | + dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount)) | |
| 219 | + } | |
| 220 | + // 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 | |
| 221 | + if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) { | |
| 222 | + dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount)) | |
| 223 | + } | |
| 224 | + } | |
| 225 | + break | |
| 226 | + case 'week': | |
| 227 | + dd.setDate(dd.getDate() + (AddDayCount * 7)) | |
| 228 | + break; | |
| 229 | + case 'year': | |
| 230 | + dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 | |
| 231 | + break | |
| 232 | + } | |
| 233 | + const y = dd.getFullYear() | |
| 234 | + const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 | |
| 235 | + const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0 | |
| 236 | + return { | |
| 237 | + fullDate: y + '-' + m + '-' + d, | |
| 238 | + year: y, | |
| 239 | + month: m, | |
| 240 | + date: d, | |
| 241 | + day: dd.getDay() | |
| 242 | + } | |
| 243 | + } | |
| 244 | + | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * 获取上月剩余天数 | |
| 248 | + */ | |
| 249 | + _getLastMonthDays(firstDay, full) { | |
| 250 | + let dateArr = [] | |
| 251 | + for (let i = firstDay; i > 0; i--) { | |
| 252 | + const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() | |
| 253 | + dateArr.push({ | |
| 254 | + date: beforeDate, | |
| 255 | + month: full.month - 1, | |
| 256 | + year: full.year, | |
| 257 | + lunar: this.getlunar(full.year, full.month - 1, beforeDate), | |
| 258 | + disable: true | |
| 259 | + }) | |
| 260 | + } | |
| 261 | + return dateArr | |
| 262 | + } | |
| 263 | + /** | |
| 264 | + * 获取本月天数 | |
| 265 | + */ | |
| 266 | + _currentMonthDays(dateData, full) { | |
| 267 | + let dateArr = [] | |
| 268 | + let fullDate = this.date.fullDate | |
| 269 | + for (let i = 1; i <= dateData; i++) { | |
| 270 | + let nowDate = full.year + '-' + (full.month < 10 ? | |
| 271 | + full.month : full.month) + '-' + (i < 10 ? | |
| 272 | + '0' + i : i) | |
| 273 | + dateArr.push(this._createCurrentDay(nowDate, full, i)) | |
| 274 | + } | |
| 275 | + return dateArr | |
| 276 | + } | |
| 277 | + /** | |
| 278 | + * 获取下月天数 | |
| 279 | + */ | |
| 280 | + _getNextMonthDays(surplus, full) { | |
| 281 | + let dateArr = [] | |
| 282 | + for (let i = 1; i < surplus + 1; i++) { | |
| 283 | + dateArr.push({ | |
| 284 | + date: i, | |
| 285 | + month: Number(full.month) + 1, | |
| 286 | + lunar: this.getlunar(full.year, Number(full.month) + 1, i), | |
| 287 | + disable: true | |
| 288 | + }) | |
| 289 | + } | |
| 290 | + return dateArr | |
| 291 | + } | |
| 292 | + /** | |
| 293 | + * 获取任意日期的一周 | |
| 294 | + */ | |
| 295 | + _getWeekDays(dateData) { | |
| 296 | + let dateArr = []; | |
| 297 | + let oneDayTime = 1000 * 60 * 60 * 24 | |
| 298 | + let today = new Date(dateData); | |
| 299 | + // 获取这个日期是星期几 | |
| 300 | + let todayDay; | |
| 301 | + let startDate; | |
| 302 | + // 如果日历以周一开始 | |
| 303 | + if(this.startWeek == 'mon') { | |
| 304 | + todayDay = today.getDay() || 7; | |
| 305 | + startDate = new Date(today.getTime() - oneDayTime * (todayDay - 1)); | |
| 306 | + } else { | |
| 307 | + todayDay = today.getDay(); | |
| 308 | + startDate = new Date(today.getTime() - oneDayTime * todayDay); | |
| 309 | + } | |
| 310 | + | |
| 311 | + for (let i = 0; i < 7; i++) { | |
| 312 | + let temp = new Date(startDate.getTime() + i * oneDayTime) | |
| 313 | + let newDate = this.getDate(`${temp.getFullYear()}-${temp.getMonth() + 1}-${temp.getDate()}`) | |
| 314 | + dateArr.push(this._createCurrentDay(newDate.fullDate, newDate, Number(newDate.date))) | |
| 315 | + } | |
| 316 | + | |
| 317 | + return dateArr; | |
| 318 | + } | |
| 319 | + | |
| 320 | + /** | |
| 321 | + * 获取当前日期详情 | |
| 322 | + * @param {Object} date | |
| 323 | + */ | |
| 324 | + getInfo(date) { | |
| 325 | + if (!date) { | |
| 326 | + date = new Date() | |
| 327 | + } | |
| 328 | + const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) | |
| 329 | + return dateInfo | |
| 330 | + } | |
| 331 | + | |
| 332 | + /** | |
| 333 | + * 比较时间大小 | |
| 334 | + */ | |
| 335 | + dateCompare(startDate, endDate) { | |
| 336 | + // 计算截止时间 | |
| 337 | + startDate = new Date(startDate.replace('-', '/').replace('-', '/')) | |
| 338 | + // 计算详细项的截止时间 | |
| 339 | + endDate = new Date(endDate.replace('-', '/').replace('-', '/')) | |
| 340 | + if (startDate <= endDate) { | |
| 341 | + return true | |
| 342 | + } else { | |
| 343 | + return false | |
| 344 | + } | |
| 345 | + } | |
| 346 | + | |
| 347 | + /** | |
| 348 | + * 比较时间是否相等 | |
| 349 | + */ | |
| 350 | + dateEqual(before = '', after = '') { | |
| 351 | + // 计算截止时间 | |
| 352 | + before = new Date(before.replace('-', '/').replace('-', '/')) | |
| 353 | + // 计算详细项的截止时间 | |
| 354 | + after = new Date(after.replace('-', '/').replace('-', '/')) | |
| 355 | + if (before.getTime() - after.getTime() === 0) { | |
| 356 | + return true | |
| 357 | + } else { | |
| 358 | + return false | |
| 359 | + } | |
| 360 | + } | |
| 361 | + | |
| 362 | + | |
| 363 | + /** | |
| 364 | + * 获取日期范围内所有日期 | |
| 365 | + * @param {Object} begin | |
| 366 | + * @param {Object} end | |
| 367 | + */ | |
| 368 | + getDateAll(begin, end) { | |
| 369 | + // 找出所有打点中已禁用的部分 不让其被添加在日期选择范围内 | |
| 370 | + let disableList = this.selected.filter(item => item.date && item.disable).map(item => item.date) | |
| 371 | + | |
| 372 | + var arr = [] | |
| 373 | + var ab = begin.split('-') | |
| 374 | + var ae = end.split('-') | |
| 375 | + var db = new Date() | |
| 376 | + db.setFullYear(ab[0], ab[1] - 1, ab[2]) | |
| 377 | + var de = new Date() | |
| 378 | + de.setFullYear(ae[0], ae[1] - 1, ae[2]) | |
| 379 | + var wuxDb = db.getTime() - 24 * 60 * 60 * 1000 | |
| 380 | + var wuxDe = de.getTime() - 24 * 60 * 60 * 1000 | |
| 381 | + for (var k = wuxDb; k <= wuxDe;) { | |
| 382 | + k = k + 24 * 60 * 60 * 1000 | |
| 383 | + let fullDate = this.getDate(new Date(parseInt(k))).fullDate | |
| 384 | + // 如果要在选择范围内截断日期 | |
| 385 | + if(this.rangeHaveDisableTruncation) { | |
| 386 | + // 如果不在打点禁止列表中 | |
| 387 | + if (disableList.includes(fullDate)) return arr; | |
| 388 | + arr.push(fullDate) | |
| 389 | + } else { | |
| 390 | + if (!disableList.includes(fullDate)) arr.push(fullDate); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + return arr | |
| 394 | + } | |
| 395 | + /** | |
| 396 | + * 计算阴历日期显示 | |
| 397 | + */ | |
| 398 | + getlunar(year, month, date) { | |
| 399 | + return CALENDAR.solar2lunar(year, month, date) | |
| 400 | + } | |
| 401 | + /** | |
| 402 | + * 设置打点 | |
| 403 | + */ | |
| 404 | + setSelectInfo(data, value) { | |
| 405 | + this.selected = value | |
| 406 | + this._getWeek(data) | |
| 407 | + } | |
| 408 | + | |
| 409 | + /** | |
| 410 | + * 设置范围 | |
| 411 | + */ | |
| 412 | + setRange(fullDate) { | |
| 413 | + let { | |
| 414 | + before, | |
| 415 | + after | |
| 416 | + } = this.rangeStatus; | |
| 417 | + | |
| 418 | + // 非范围选择不再执行 | |
| 419 | + if (this.mode != 'range') return | |
| 420 | + | |
| 421 | + // 判断目前的日期 是否 比before日期小或者等于before日期 如果为true就要重置 | |
| 422 | + let reset = this.dateCompare(fullDate, before); | |
| 423 | + // 如果日期选择范围允许为同一天 且 目前是需要重置的 | |
| 424 | + if (this.rangeSameDay && before && reset) { | |
| 425 | + // 判断是否需要相等 如果 不相等 则 重置 如果相等 则不重置 | |
| 426 | + reset = !this.dateEqual(fullDate, before); | |
| 427 | + } | |
| 428 | + | |
| 429 | + if ((before && after || reset) && (!this.rangeEndRepick || (this.rangeEndRepick && this.rangeStatus.data | |
| 430 | + .indexOf(fullDate) == -1))) { | |
| 431 | + this.rangeStatus.before = fullDate; | |
| 432 | + this.rangeStatus.after = ''; | |
| 433 | + this.rangeStatus.data = []; | |
| 434 | + } else { | |
| 435 | + if (!before) { | |
| 436 | + this.rangeStatus.before = fullDate | |
| 437 | + } else { | |
| 438 | + if (this.dateCompare(this.rangeStatus.before, fullDate)) { | |
| 439 | + this.rangeStatus.data = this.getDateAll(this.rangeStatus.before, fullDate); | |
| 440 | + } else { | |
| 441 | + this.rangeStatus.data = this.getDateAll(fullDate, this.rangeStatus.before); | |
| 442 | + } | |
| 443 | + this.rangeStatus.after = this.rangeStatus.data[this.rangeStatus.data.length - 1] | |
| 444 | + } | |
| 445 | + } | |
| 446 | + this._getWeek(fullDate) | |
| 447 | + } | |
| 448 | + | |
| 449 | + /** | |
| 450 | + * 设置多选 | |
| 451 | + */ | |
| 452 | + setMultiple(fullDate) { | |
| 453 | + // 非多选不再执行 | |
| 454 | + if (this.mode != 'multiple') return | |
| 455 | + // 检查是否已经多选 | |
| 456 | + let index = this.multiple.findIndex((item) => { | |
| 457 | + if (this.dateEqual(fullDate, item)) { | |
| 458 | + return item | |
| 459 | + } | |
| 460 | + }); | |
| 461 | + if (index === -1) { | |
| 462 | + this.multiple.push(fullDate) | |
| 463 | + this.setDate(fullDate) | |
| 464 | + } else { | |
| 465 | + this.multiple = this.multiple.filter((item, i) => i != index) | |
| 466 | + } | |
| 467 | + this._getWeek(fullDate) | |
| 468 | + } | |
| 469 | + | |
| 470 | + /** | |
| 471 | + * 获取每周数据 | |
| 472 | + * @param {Object} dateData | |
| 473 | + */ | |
| 474 | + _getWeek(dateData, useWeeks = true) { | |
| 475 | + const { | |
| 476 | + year, | |
| 477 | + month | |
| 478 | + } = this.getDate(dateData) | |
| 479 | + | |
| 480 | + let weeks = {} | |
| 481 | + // 日历数据 | |
| 482 | + let canlender = []; | |
| 483 | + | |
| 484 | + if (this.foldStatus === 'open') { | |
| 485 | + // 默认以周末开始 | |
| 486 | + let firstDay = new Date(year, month - 1, 1).getDay(); | |
| 487 | + // 如果以周一开始 | |
| 488 | + if(this.startWeek === 'mon') { | |
| 489 | + firstDay = firstDay === 0 ? 6 : firstDay - 1; | |
| 490 | + } | |
| 491 | + let currentDay = new Date(year, month, 0).getDate() | |
| 492 | + // 日期数据 | |
| 493 | + let dates = { | |
| 494 | + lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 | |
| 495 | + currentMonthDys: this._currentMonthDays(currentDay, this.getDate(dateData)), // 本月天数 | |
| 496 | + weeks: [] | |
| 497 | + } | |
| 498 | + // 下月开始几天 | |
| 499 | + const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) | |
| 500 | + dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) | |
| 501 | + | |
| 502 | + // 如果仅显示当月 | |
| 503 | + if (this.monthShowCurrentMonth) { | |
| 504 | + // 日历数据 | |
| 505 | + canlender = canlender.concat( | |
| 506 | + dates.lastMonthDays.map(item => item = { | |
| 507 | + empty: true, | |
| 508 | + lunar: {}, | |
| 509 | + }), | |
| 510 | + dates.currentMonthDys, | |
| 511 | + dates.nextMonthDays.map(item => item = { | |
| 512 | + empty: true, | |
| 513 | + lunar: {}, | |
| 514 | + }), | |
| 515 | + ); | |
| 516 | + | |
| 517 | + } else { | |
| 518 | + // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 | |
| 519 | + canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) | |
| 520 | + } | |
| 521 | + | |
| 522 | + } else { | |
| 523 | + canlender = this._getWeekDays(dateData) | |
| 524 | + } | |
| 525 | + | |
| 526 | + for (let i = 0; i < canlender.length; i++) { | |
| 527 | + if (i % 7 === 0) { | |
| 528 | + weeks[parseInt(i / 7)] = new Array(7) | |
| 529 | + } | |
| 530 | + weeks[parseInt(i / 7)][i % 7] = canlender[i] || {}; | |
| 531 | + } | |
| 532 | + | |
| 533 | + if (useWeeks) { | |
| 534 | + this.canlender = canlender | |
| 535 | + this.weeks = weeks | |
| 536 | + } | |
| 537 | + | |
| 538 | + return weeks | |
| 539 | + } | |
| 540 | + | |
| 541 | + | |
| 542 | + //静态方法 | |
| 543 | + // static init(date) { | |
| 544 | + // if (!this.instance) { | |
| 545 | + // this.instance = new Calendar(date); | |
| 546 | + // } | |
| 547 | + // return this.instance; | |
| 548 | + // } | |
| 549 | +} | |
| 550 | + | |
| 551 | + | |
| 552 | +export default Calendar | |
| 0 | 553 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/components/wu-calendar/wu-calendar.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="wu-calendar" @click.stop> | |
| 3 | + <view v-if="!insert && show" class="wu-calendar__mask" :class="{'wu-calendar--mask-show': aniMaskShow}" | |
| 4 | + @click="clean"></view> | |
| 5 | + <view v-if="insert || show" class="wu-calendar__content" | |
| 6 | + :class="{'wu-calendar--fixed': !insert, 'wu-calendar--ani-show': aniMaskShow}"> | |
| 7 | + <!-- 弹窗日历取消与确认按钮位置 --> | |
| 8 | + <slot name="operation" v-if="operationPosition == 'top'"> | |
| 9 | + <view v-if="!insert" class="wu-calendar__header wu-calendar--fixed-top"> | |
| 10 | + <view class="wu-calendar__header-btn-box" @click="cancel"> | |
| 11 | + <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{color: cancelColor}]">{{cancelText}}</text> | |
| 12 | + </view> | |
| 13 | + <view class="wu-calendar__header-btn-box" @click="confirm"> | |
| 14 | + <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{color: confirmColor}]">{{okText}}</text> | |
| 15 | + </view> | |
| 16 | + </view> | |
| 17 | + </slot> | |
| 18 | + <!-- 日历头部 --> | |
| 19 | + <slot name="header" :nowDate="nowDate"> | |
| 20 | + <view class="wu-calendar__header"> | |
| 21 | + <!-- 纵向滑动切换展示内容 --> | |
| 22 | + <template v-if="slideSwitchMode == 'vertical'"> | |
| 23 | + <view class="wu-calendar__header-btn-box vertical"> | |
| 24 | + <view class="wu-calendar__header-btn wu-calendar--top" @click.stop="pre"></view> | |
| 25 | + <picker mode="date" :value="nowDate.fullDate" fields="month" @change="bindDateChange"> | |
| 26 | + <text | |
| 27 | + class="wu-calendar__header-text">{{ (nowDate.year||'') + YearText + ( nowDate.month||'') + MonthText }}</text> | |
| 28 | + </picker> | |
| 29 | + <view class="wu-calendar__header-btn wu-calendar--bottom" @click.stop="next"></view> | |
| 30 | + </view> | |
| 31 | + <text class="wu-calendar__backtoday vertical" @click="backToday">{{todayText}}</text> | |
| 32 | + </template> | |
| 33 | + <!-- 横向滑动与无滑动展示内容 --> | |
| 34 | + <template v-else> | |
| 35 | + <view class="wu-calendar__header-btn-box horizontal" @click.stop="pre"> | |
| 36 | + <view class="wu-calendar__header-btn wu-calendar--left"></view> | |
| 37 | + </view> | |
| 38 | + <picker mode="date" :value="nowDate.fullDate" fields="month" @change="bindDateChange"> | |
| 39 | + <text | |
| 40 | + class="wu-calendar__header-text">{{ (nowDate.year||'') + YearText + ( nowDate.month||'') + MonthText }}</text> | |
| 41 | + </picker> | |
| 42 | + <view class="wu-calendar__header-btn-box horizontal" @click.stop="next"> | |
| 43 | + <view class="wu-calendar__header-btn wu-calendar--right"></view> | |
| 44 | + </view> | |
| 45 | + <text class="wu-calendar__backtoday" @click="backToday">{{todayText}}</text> | |
| 46 | + </template> | |
| 47 | + </view> | |
| 48 | + </slot> | |
| 49 | + <view class="wu-calendar__box"> | |
| 50 | + <view class="wu-calendar__weeks"> | |
| 51 | + <view class="wu-calendar__weeks-day" v-if="startWeek === 'sun'"> | |
| 52 | + <text class="wu-calendar__weeks-day-text">{{SUNText}}</text> | |
| 53 | + </view> | |
| 54 | + <view class="wu-calendar__weeks-day"> | |
| 55 | + <text class="wu-calendar__weeks-day-text">{{monText}}</text> | |
| 56 | + </view> | |
| 57 | + <view class="wu-calendar__weeks-day"> | |
| 58 | + <text class="wu-calendar__weeks-day-text">{{TUEText}}</text> | |
| 59 | + </view> | |
| 60 | + <view class="wu-calendar__weeks-day"> | |
| 61 | + <text class="wu-calendar__weeks-day-text">{{WEDText}}</text> | |
| 62 | + </view> | |
| 63 | + <view class="wu-calendar__weeks-day"> | |
| 64 | + <text class="wu-calendar__weeks-day-text">{{THUText}}</text> | |
| 65 | + </view> | |
| 66 | + <view class="wu-calendar__weeks-day"> | |
| 67 | + <text class="wu-calendar__weeks-day-text">{{FRIText}}</text> | |
| 68 | + </view> | |
| 69 | + <view class="wu-calendar__weeks-day"> | |
| 70 | + <text class="wu-calendar__weeks-day-text">{{SATText}}</text> | |
| 71 | + </view> | |
| 72 | + <view class="wu-calendar__weeks-day" v-if="startWeek === 'mon'"> | |
| 73 | + <text class="wu-calendar__weeks-day-text">{{SUNText}}</text> | |
| 74 | + </view> | |
| 75 | + </view> | |
| 76 | + <!-- 滑动切换 --> | |
| 77 | + <swiper v-if="slideSwitchMode !== 'none'" :class="{'wu-calendar__weeks_container': initStatus}" | |
| 78 | + :style="[calendarContentStyle]" :duration="500" :vertical="slideSwitchMode == 'vertical'" circular | |
| 79 | + :current="swiperCurrent" @change="swiperChange" skip-hidden-item-layout> | |
| 80 | + <!-- 月或周日历 --> | |
| 81 | + <template v-if="type === 'month' || type === 'week'"> | |
| 82 | + <swiper-item> | |
| 83 | + <wu-calendar-block :weeks="preWeeks" :calendar="calendar" :selected="selected" | |
| 84 | + :lunar="lunar" @change="choiceDate" :color="color" :actBadgeColor="actBadgeColor" :startText="startText" | |
| 85 | + :endText="endText" :month="preWeeksMonth" :FoldStatus="FoldStatus" | |
| 86 | + :monthShowCurrentMonth="monthShowCurrentMonth" :showMonth="showMonth" | |
| 87 | + :itemHeight="itemHeight" :defaultMargin="defaultMargin" :todayDefaultStyle="todayDefaultStyle"></wu-calendar-block> | |
| 88 | + </swiper-item> | |
| 89 | + <swiper-item> | |
| 90 | + <wu-calendar-block :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" | |
| 91 | + @change="choiceDate" :color="color" :actBadgeColor="actBadgeColor" :startText="startText" :endText="endText" | |
| 92 | + :monthShowCurrentMonth="monthShowCurrentMonth" :month="weeksMonth" | |
| 93 | + :FoldStatus="FoldStatus" :showMonth="showMonth" | |
| 94 | + :itemHeight="itemHeight" :defaultMargin="defaultMargin" :todayDefaultStyle="todayDefaultStyle"></wu-calendar-block> | |
| 95 | + </swiper-item> | |
| 96 | + <swiper-item> | |
| 97 | + <wu-calendar-block :weeks="nextWeeks" :calendar="calendar" :selected="selected" | |
| 98 | + :lunar="lunar" @change="choiceDate" :color="color" :actBadgeColor="actBadgeColor" :startText="startText" | |
| 99 | + :endText="endText" :month="nextWeeksMonth" :FoldStatus="FoldStatus" | |
| 100 | + :monthShowCurrentMonth="monthShowCurrentMonth" :showMonth="showMonth" | |
| 101 | + :itemHeight="itemHeight" :defaultMargin="defaultMargin" :todayDefaultStyle="todayDefaultStyle"></wu-calendar-block> | |
| 102 | + </swiper-item> | |
| 103 | + </template> | |
| 104 | + </swiper> | |
| 105 | + <!-- 无滑动切换 --> | |
| 106 | + <template v-else> | |
| 107 | + <!-- 月或周日历 --> | |
| 108 | + <wu-calendar-block class="wu-calendar__weeks_container" :style="[calendarContentStyle]" | |
| 109 | + :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate" | |
| 110 | + :color="color" :actBadgeColor="actBadgeColor" :startText="startText" :endText="endText" :month="nowDate.month" | |
| 111 | + :FoldStatus="FoldStatus" :monthShowCurrentMonth="monthShowCurrentMonth" :showMonth="showMonth" | |
| 112 | + :itemHeight="itemHeight" :defaultMargin="defaultMargin" :todayDefaultStyle="todayDefaultStyle"></wu-calendar-block> | |
| 113 | + </template> | |
| 114 | + </view> | |
| 115 | + <view class="wu-calendar__fold" v-if="type !== 'year' && Fold" @click="FoldClick"> | |
| 116 | + <wu-icon v-if="FoldStatus == 'open'" name="arrow-up" bold size="18"></wu-icon> | |
| 117 | + <wu-icon v-else-if="FoldStatus == 'close'" name="arrow-down" bold size="18"></wu-icon> | |
| 118 | + </view> | |
| 119 | + <!-- 弹窗日历取消与确认按钮位置 --> | |
| 120 | + <slot name="operation" v-if="operationPosition == 'bottom'"> | |
| 121 | + <view v-if="!insert" class="wu-calendar__header wu-calendar--fixed-top"> | |
| 122 | + <view class="wu-calendar__header-btn-box" @click="cancel"> | |
| 123 | + <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{color: cancelColor}]">{{cancelText}}</text> | |
| 124 | + </view> | |
| 125 | + <view class="wu-calendar__header-btn-box" @click="confirm"> | |
| 126 | + <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{color: confirmColor}]">{{okText}}</text> | |
| 127 | + </view> | |
| 128 | + </view> | |
| 129 | + </slot> | |
| 130 | + <wu-safe-bottom v-if="!insert && show"></wu-safe-bottom> | |
| 131 | + </view> | |
| 132 | + </view> | |
| 133 | +</template> | |
| 134 | + | |
| 135 | +<script> | |
| 136 | + import Calendar from './util.js'; | |
| 137 | + import mpMixin from '@/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js'; | |
| 138 | + import mixin from '@/uni_modules/wu-ui-tools/libs/mixin/mixin.js'; | |
| 139 | + import props from './props.js'; | |
| 140 | + | |
| 141 | + import { | |
| 142 | + initVueI18n | |
| 143 | + } from '@dcloudio/uni-i18n' | |
| 144 | + import i18nMessages from '../i18n/index.js' | |
| 145 | + const { | |
| 146 | + t | |
| 147 | + } = initVueI18n(i18nMessages) | |
| 148 | + | |
| 149 | + /** | |
| 150 | + * Calendar 日历 | |
| 151 | + * @description 日历组件,多模式选择(单日期、多日期、范围日期选择),多日历类型(周、月日历),动态计算滑动。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 | |
| 152 | + * @tutorial https://wuui.cn/zh-CN/components/calendar.html | |
| 153 | + * @property {String} date 自定义当前时间,默认为今天 | |
| 154 | + * @property {String} type 日历类型(默认为month) | |
| 155 | + * @value month 月日历 | |
| 156 | + * @value week 周日历 | |
| 157 | + * @property {Boolean} fold 是否支持折叠(默认值 month: true, week: false) | |
| 158 | + * @property {Boolean} useToday 是否使用默认日期(今天,默认为true) | |
| 159 | + * @property {Boolean} todayDefaultStyle 是否显示今日默认样式(默认为true) | |
| 160 | + * @property {String} color 主题色(默认#3c9cff) | |
| 161 | + * @property {String} mode = [single|multiple|range] 日期选择类型(默认single(单日期选择)) | |
| 162 | + * @value single 单日期选择 | |
| 163 | + * @value multiple 多日期选择 | |
| 164 | + * @value range 范围选择 | |
| 165 | + * @property {String} color 主题色(默认#3c9cff) | |
| 166 | + * @property {Number} itemHeight 日历中每一项日期的高度(默认60),单位px | |
| 167 | + * @property {String} cancelColor 取消文字的颜色(默认#333333) | |
| 168 | + * @property {String} confirmColor 确认文字的颜色(默认#333333) | |
| 169 | + * @property {String} startText mode=range时,第一个日期底部的提示文字 | |
| 170 | + * @property {String} endText mode=range时,最后一个日期底部的提示文字 | |
| 171 | + * @property {String} startWeek 日历以周几开始,默认为周日(sun),`type: month | week`时生效 | |
| 172 | + * @value sun 周日 | |
| 173 | + * @value mon 周一 | |
| 174 | + * @property {Boolean} lunar 显示农历 | |
| 175 | + * @property {String} startDate 日期选择范围-开始日期 | |
| 176 | + * @property {String} endDate 日期选择范围-结束日期 | |
| 177 | + * @property {Boolean} rangeEndRepick 允许范围内重选结束日期(默认false) | |
| 178 | + * @property {Boolean} rangeSameDay 允许日期选择范围起始日期为同一天(默认false) | |
| 179 | + * @property {Boolean} rangeHaveDisableTruncation 允许日期选择范围内遇到打点禁用日期进行截断 | |
| 180 | + * @property {Boolean} monthShowCurrentMonth 当月是否仅展示当月数据 | |
| 181 | + * @property {Boolean} insert = [true|false] 插入模式,默认为true | |
| 182 | + * @value true 插入模式 | |
| 183 | + * @value false 弹窗模式 | |
| 184 | + * @property {String} slideSwitchMode 滑动切换模式,默认为horizontal(横向滑动切换) | |
| 185 | + * @value horizontal 横向滑动切换 | |
| 186 | + * @value vertical 纵向滑动切换 | |
| 187 | + * @value none 不使用滑动切换 | |
| 188 | + * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 | |
| 189 | + * @property {Array[Object]} selected 自定义打点,期待格式 [{date: '2023-11-18', info: '¥888', infoColor: '#6ac695', topInfo: '机票打折', topInfoColor: '#6ac695', badge: true, badgePosition: 'top-right', disable: false}, ...] | |
| 190 | + * @property {Boolean} showMonth 是否选择月份为背景(默认true) | |
| 191 | + * @property {Boolean} maskClick 是否点击遮罩层关闭(默认false) | |
| 192 | + * @property {Boolean} disabledChoice 是否禁止点击日历(默认false) | |
| 193 | + * @property {String} actBadgeColor 当通过 `selected` 属性设置某个日期 `badgeColor`后,如果该日期被选择且主题色与 `badgeColor` 一致时,徽标会显示本颜色 | |
| 194 | + * @property {String} operationPosition 弹窗日历取消和确认按钮的显示位置 | |
| 195 | + * @property {Boolean} confirmFullDate 弹窗日历点击确认时是否需要选择完整日期 | |
| 196 | + * @event {Function} close 日历弹窗点击遮罩层关闭,`insert :false` 时生效 | |
| 197 | + * @event {Function} change 日期改变,`insert :ture` 时生效 | |
| 198 | + * @event {Function} confirm 确认选择,`insert :false` 时生效 | |
| 199 | + * @event {Function} cancel 点击取消按钮,`insert :false` 时生效 | |
| 200 | + * @event {Function} monthSwitch 切换月份时触发 | |
| 201 | + * @event {Function} foldSwitch 切换折叠状态时触发,`type: month | week` & `fold: true` 时生效 | |
| 202 | + * @example <wu-calendar :insert="true":lunar="true" start-date="2022-5-20" end-date="2023-5-20"@change="change" /> | |
| 203 | + */ | |
| 204 | + export default { | |
| 205 | + mixins: [mpMixin, mixin, props], | |
| 206 | + emits: ['close', 'cancel', 'confirm', 'change', 'monthSwitch', 'foldSwitch'], | |
| 207 | + data() { | |
| 208 | + return { | |
| 209 | + show: false, | |
| 210 | + weeks: [], | |
| 211 | + preWeeks: [], | |
| 212 | + nextWeeks: [], | |
| 213 | + weeksMonth: null, | |
| 214 | + preWeeksMonth: null, | |
| 215 | + nextWeeksMonth: null, | |
| 216 | + calendar: {}, | |
| 217 | + nowDate: '', | |
| 218 | + aniMaskShow: false, | |
| 219 | + swiperCurrent: 1, | |
| 220 | + swiperChangeDirection: '', | |
| 221 | + pickerDate: '', | |
| 222 | + Fold: null, | |
| 223 | + FoldStatus: null, | |
| 224 | + weekContentStyle: {}, | |
| 225 | + initStatus: false, | |
| 226 | + defaultMargin: 8 | |
| 227 | + } | |
| 228 | + }, | |
| 229 | + computed: { | |
| 230 | + /** | |
| 231 | + * for i18n | |
| 232 | + */ | |
| 233 | + okText() { | |
| 234 | + return t("wu-calender.ok") | |
| 235 | + }, | |
| 236 | + cancelText() { | |
| 237 | + return t("wu-calender.cancel") | |
| 238 | + }, | |
| 239 | + YearText() { | |
| 240 | + return t("wu-calender.year") | |
| 241 | + }, | |
| 242 | + MonthText() { | |
| 243 | + return t("wu-calender.month") | |
| 244 | + }, | |
| 245 | + todayText() { | |
| 246 | + return t("wu-calender.today") | |
| 247 | + }, | |
| 248 | + monText() { | |
| 249 | + return t("wu-calender.MON") | |
| 250 | + }, | |
| 251 | + TUEText() { | |
| 252 | + return t("wu-calender.TUE") | |
| 253 | + }, | |
| 254 | + WEDText() { | |
| 255 | + return t("wu-calender.WED") | |
| 256 | + }, | |
| 257 | + THUText() { | |
| 258 | + return t("wu-calender.THU") | |
| 259 | + }, | |
| 260 | + FRIText() { | |
| 261 | + return t("wu-calender.FRI") | |
| 262 | + }, | |
| 263 | + SATText() { | |
| 264 | + return t("wu-calender.SAT") | |
| 265 | + }, | |
| 266 | + SUNText() { | |
| 267 | + return t("wu-calender.SUN") | |
| 268 | + }, | |
| 269 | + calendarContentStyle() { | |
| 270 | + return { | |
| 271 | + height: (this.FoldStatus === 'open' ? this.itemHeight * 6 : this.itemHeight) + 'px' | |
| 272 | + } | |
| 273 | + }, | |
| 274 | + getDateType() { | |
| 275 | + if (this.type === 'year') return this.type | |
| 276 | + return this.FoldStatus === 'open' ? 'month' : 'week' | |
| 277 | + } | |
| 278 | + }, | |
| 279 | + watch: { | |
| 280 | + date(newVal) { | |
| 281 | + this.cale.cleanRange(); | |
| 282 | + this.init(newVal) | |
| 283 | + }, | |
| 284 | + mode(newVal) { | |
| 285 | + this.cale.cleanRange(); | |
| 286 | + this.cale.resetMode(newVal) | |
| 287 | + this.init(this.date) | |
| 288 | + }, | |
| 289 | + startDate(val) { | |
| 290 | + this.cale.resetSatrtDate(val) | |
| 291 | + this.cale.setDate(this.nowDate.fullDate) | |
| 292 | + this.assignmentWeeks(); | |
| 293 | + }, | |
| 294 | + endDate(val) { | |
| 295 | + this.cale.resetEndDate(val) | |
| 296 | + this.cale.setDate(this.nowDate.fullDate) | |
| 297 | + this.assignmentWeeks(); | |
| 298 | + }, | |
| 299 | + monthShowCurrentMonth(val) { | |
| 300 | + this.cale.resetMonthShowCurrentMonth(val) | |
| 301 | + this.setDate(this.nowDate.fullDate) | |
| 302 | + }, | |
| 303 | + rangeEndRepick(val) { | |
| 304 | + this.cale.resetRangeEndRepick(val) | |
| 305 | + }, | |
| 306 | + rangeSameDay(val) { | |
| 307 | + this.cale.resetRangeSameDay(val) | |
| 308 | + }, | |
| 309 | + rangeHaveDisableTruncation(val) { | |
| 310 | + this.cale.resetRangeHaveDisableTruncation(val) | |
| 311 | + this.cale.cleanRange() | |
| 312 | + this.init(this.date) | |
| 313 | + }, | |
| 314 | + selected: { | |
| 315 | + handler(newVal) { | |
| 316 | + this.cale.setSelectInfo(this.nowDate.fullDate, newVal) | |
| 317 | + this.assignmentWeeks() | |
| 318 | + // 找出目前的信息weeks 并 将 this.calendar重新赋值 | |
| 319 | + let nowDateInfo = this.cale.canlender.filter(item => item.fullDate && this.cale.dateEqual(item | |
| 320 | + .fullDate, this.calendar.fullDate)) | |
| 321 | + if (nowDateInfo.length) this.calendar = nowDateInfo[0] | |
| 322 | + }, | |
| 323 | + deep: true | |
| 324 | + }, | |
| 325 | + fold(newVal) { | |
| 326 | + this.Fold = newVal | |
| 327 | + }, | |
| 328 | + type(newVal) { | |
| 329 | + this.initFold(); | |
| 330 | + this.cale.resetFoldStatus(this.FoldStatus); | |
| 331 | + this.init(this.date) | |
| 332 | + }, | |
| 333 | + startWeek(newVal) { | |
| 334 | + this.cale.cleanRange(); | |
| 335 | + this.cale.resetStartWeek(newVal) | |
| 336 | + this.init(this.date) | |
| 337 | + } | |
| 338 | + }, | |
| 339 | + created() { | |
| 340 | + this.initFold(); | |
| 341 | + this.cale = new Calendar({ | |
| 342 | + selected: this.selected, | |
| 343 | + startDate: this.startDate, | |
| 344 | + endDate: this.endDate, | |
| 345 | + mode: this.mode, | |
| 346 | + type: this.type, | |
| 347 | + startWeek: this.startWeek, | |
| 348 | + foldStatus: this.FoldStatus, | |
| 349 | + monthShowCurrentMonth: this.monthShowCurrentMonth, | |
| 350 | + rangeEndRepick: this.rangeEndRepick, | |
| 351 | + rangeSameDay: this.rangeSameDay, | |
| 352 | + rangeHaveDisableTruncation: this.rangeHaveDisableTruncation | |
| 353 | + }) | |
| 354 | + this.init(this.date); | |
| 355 | + }, | |
| 356 | + methods: { | |
| 357 | + // 取消穿透 | |
| 358 | + clean() { | |
| 359 | + if (this.maskClick) { | |
| 360 | + this.$emit('close') | |
| 361 | + this.close() | |
| 362 | + } | |
| 363 | + }, | |
| 364 | + bindDateChange(e) { | |
| 365 | + const value = e.detail.value + '-1' | |
| 366 | + this.setDate(value) | |
| 367 | + this.swiperCurrentChangeWeeks(); | |
| 368 | + | |
| 369 | + const { | |
| 370 | + year, | |
| 371 | + month | |
| 372 | + } = this.cale.getDate(value) | |
| 373 | + this.$emit('monthSwitch', { | |
| 374 | + year, | |
| 375 | + month: Number(month), | |
| 376 | + fullDate: `${year}-${`${month}`.padStart(2, '0')}` | |
| 377 | + }) | |
| 378 | + }, | |
| 379 | + /** | |
| 380 | + * 初始化日期显示 | |
| 381 | + * @param {Object} date | |
| 382 | + */ | |
| 383 | + init(date) { | |
| 384 | + this.$nextTick(()=>{ | |
| 385 | + // 初始化 | |
| 386 | + this.initStatus = false; | |
| 387 | + let firstDate = this.mode == 'single' ? date : date[0]; | |
| 388 | + // 如果填写默认值 | |
| 389 | + if (date) { | |
| 390 | + // 当前数据类型 | |
| 391 | + let dateType = Object.prototype.toString.call(date); | |
| 392 | + // 验证类型 | |
| 393 | + if (this.mode == 'single' && dateType != '[object String]') { | |
| 394 | + return console.error(`类型错误,mode=${this.mode}时,date=String`) | |
| 395 | + } else if (this.mode != 'single' && dateType != '[object Array]') { | |
| 396 | + return console.error(`类型错误,mode=${this.mode}时,date=Array`) | |
| 397 | + } | |
| 398 | + // 根据类型默认选中不同的值 | |
| 399 | + if (this.mode == 'multiple') { | |
| 400 | + this.cale.multiple = date.map(item=>item); | |
| 401 | + this.cale._getWeek(this.cale.multiple[this.cale.multiple.length - 1]); | |
| 402 | + } else if (this.mode == 'range') { | |
| 403 | + date[0] ? this.cale.setRange(date[0]) : '' | |
| 404 | + date[1] ? this.cale.setRange(date[1]) : '' | |
| 405 | + } | |
| 406 | + } | |
| 407 | + // 如果不填写默认值 且 使用今日作为默认值 并且 还没有在打点中禁用今天的日期 | |
| 408 | + else if (this.useToday && !this.selected.filter(item => item.disable && this.cale.dateEqual(item.date, this | |
| 409 | + .cale.date.fullDate)).length) { | |
| 410 | + if (this.mode == 'multiple') { | |
| 411 | + this.cale.multiple = [this.cale.date.fullDate]; | |
| 412 | + this.cale._getWeek(this.cale.multiple[this.cale.multiple.length - 1]); | |
| 413 | + } else if (this.mode == 'range') { | |
| 414 | + this.cale.setRange(this.cale.date.fullDate) | |
| 415 | + } | |
| 416 | + } | |
| 417 | + | |
| 418 | + // 设置日期 | |
| 419 | + this.cale.setDate(firstDate); | |
| 420 | + // 现在的日期 | |
| 421 | + this.nowDate = this.cale.getInfo(firstDate); | |
| 422 | + // 设置当前月份 | |
| 423 | + this.weeksMonth = this.nowDate.month; | |
| 424 | + // 如果不填写默认值 且 使用今日作为默认值 | |
| 425 | + if ((this.useToday && !this.date) || this.date) { | |
| 426 | + this.calendar = this.nowDate; | |
| 427 | + } | |
| 428 | + | |
| 429 | + // 渲染 | |
| 430 | + this.updateWeeks(false, true); | |
| 431 | + // 初始化成功 | |
| 432 | + this.initStatus = true; | |
| 433 | + }) | |
| 434 | + }, | |
| 435 | + /** | |
| 436 | + * 打开日历弹窗 | |
| 437 | + */ | |
| 438 | + open() { | |
| 439 | + // #ifdef APP-NVUE | |
| 440 | + // 为弹窗模式且需要清理数据 | |
| 441 | + if (this.clearDate && !this.insert) { | |
| 442 | + this.reset(this.date); | |
| 443 | + } | |
| 444 | + // #endif | |
| 445 | + this.show = true; | |
| 446 | + // #ifdef H5 | |
| 447 | + if (!this.insert) document.body.style = 'overflow: hidden' | |
| 448 | + // #endif | |
| 449 | + this.$nextTick(() => { | |
| 450 | + setTimeout(() => { | |
| 451 | + this.aniMaskShow = true; | |
| 452 | + }, 50) | |
| 453 | + }) | |
| 454 | + }, | |
| 455 | + /** | |
| 456 | + * 关闭日历弹窗 | |
| 457 | + */ | |
| 458 | + close() { | |
| 459 | + this.aniMaskShow = false; | |
| 460 | + this.$nextTick(() => { | |
| 461 | + setTimeout(() => { | |
| 462 | + this.show = false | |
| 463 | + // #ifdef H5 | |
| 464 | + if (!this.insert) document.body.style = 'overflow: visible' | |
| 465 | + // #endif | |
| 466 | + // #ifndef APP-NVUE | |
| 467 | + // 为弹窗模式且需要清理数据 | |
| 468 | + if (this.clearDate && !this.insert) { | |
| 469 | + this.reset() | |
| 470 | + } | |
| 471 | + // #endif | |
| 472 | + }, 300) | |
| 473 | + }) | |
| 474 | + }, | |
| 475 | + /** | |
| 476 | + * 重置 | |
| 477 | + */ | |
| 478 | + reset() { | |
| 479 | + this.cale.cleanRange(); | |
| 480 | + this.cale.cleanMultiple(); | |
| 481 | + this.swiperCurrent = 1; | |
| 482 | + this.init(this.date); | |
| 483 | + }, | |
| 484 | + /** | |
| 485 | + * 清空选中 | |
| 486 | + */ | |
| 487 | + clearSelect() { | |
| 488 | + this.cale.cleanRange(); | |
| 489 | + this.cale.cleanMultiple(); | |
| 490 | + this.calendar = {}; | |
| 491 | + this.updateWeeks(false, true); | |
| 492 | + }, | |
| 493 | + /** | |
| 494 | + * 确认按钮 | |
| 495 | + */ | |
| 496 | + confirm() { | |
| 497 | + if(this.confirmFullDate) { | |
| 498 | + if(this.mode == 'single' && !this.calendar.fullDate) { | |
| 499 | + return uni.showToast({ | |
| 500 | + icon: 'none', | |
| 501 | + title: '请选择日期', | |
| 502 | + duration: 600 | |
| 503 | + }); | |
| 504 | + } else if(this.mode == 'multiple' && !this.cale.multiple.length) { | |
| 505 | + return uni.showToast({ | |
| 506 | + icon: 'none', | |
| 507 | + title: '请至少选择一个日期', | |
| 508 | + duration: 600 | |
| 509 | + }); | |
| 510 | + } else if(this.mode == 'range') { | |
| 511 | + if(!this.cale.rangeStatus.before) { | |
| 512 | + return uni.showToast({ | |
| 513 | + icon: 'none', | |
| 514 | + title: '请选择开始日期', | |
| 515 | + duration: 600 | |
| 516 | + }); | |
| 517 | + } else if(!this.cale.rangeStatus.after) { | |
| 518 | + return uni.showToast({ | |
| 519 | + icon: 'none', | |
| 520 | + title: '请选择结束日期', | |
| 521 | + duration: 600 | |
| 522 | + }); | |
| 523 | + } | |
| 524 | + } | |
| 525 | + } | |
| 526 | + this.setEmit('confirm') | |
| 527 | + this.close() | |
| 528 | + }, | |
| 529 | + /** | |
| 530 | + * 取消按钮 | |
| 531 | + */ | |
| 532 | + cancel() { | |
| 533 | + this.$emit('cancel') | |
| 534 | + this.close() | |
| 535 | + }, | |
| 536 | + /** | |
| 537 | + * 变化触发 | |
| 538 | + */ | |
| 539 | + change() { | |
| 540 | + if (!this.insert) return | |
| 541 | + this.setEmit('change') | |
| 542 | + }, | |
| 543 | + /** | |
| 544 | + * 选择月份触发 | |
| 545 | + */ | |
| 546 | + monthSwitch() { | |
| 547 | + let { | |
| 548 | + year, | |
| 549 | + month | |
| 550 | + } = this.nowDate; | |
| 551 | + this.$emit('monthSwitch', { | |
| 552 | + year, | |
| 553 | + month: Number(month), | |
| 554 | + fullDate: `${year}-${`${month}`.padStart(2, '0')}` | |
| 555 | + }) | |
| 556 | + }, | |
| 557 | + /** | |
| 558 | + * 派发事件 | |
| 559 | + * @param {Object} name | |
| 560 | + */ | |
| 561 | + setEmit(name) { | |
| 562 | + let { | |
| 563 | + year, | |
| 564 | + month, | |
| 565 | + date, | |
| 566 | + fullDate, | |
| 567 | + lunar, | |
| 568 | + extraInfo, | |
| 569 | + type, | |
| 570 | + mode | |
| 571 | + } = this.calendar; | |
| 572 | + | |
| 573 | + let params = { | |
| 574 | + range: this.cale.rangeStatus, | |
| 575 | + multiple: this.cale.multiple, | |
| 576 | + mode, | |
| 577 | + type, | |
| 578 | + year, | |
| 579 | + month: Number(month), | |
| 580 | + date, | |
| 581 | + fulldate: fullDate, | |
| 582 | + lunar, | |
| 583 | + extraInfo: extraInfo || {} | |
| 584 | + } | |
| 585 | + | |
| 586 | + if (this.type === 'month' || this.type === 'week') { | |
| 587 | + params.foldStatus = this.FoldStatus | |
| 588 | + } | |
| 589 | + | |
| 590 | + this.$emit(name, params) | |
| 591 | + }, | |
| 592 | + /** | |
| 593 | + * 选择天触发 | |
| 594 | + * @param {Object} weeks | |
| 595 | + */ | |
| 596 | + choiceDate(weeks) { | |
| 597 | + // 如果为禁用 或者 空数据 或者 禁止点击日期 | |
| 598 | + if (weeks.disable || weeks.empty || this.disabledChoice) return; | |
| 599 | + | |
| 600 | + this.calendar = weeks; | |
| 601 | + // 保存操作的日历信息 | |
| 602 | + this.nowDate = this.calendar; | |
| 603 | + // 设置选择范围 | |
| 604 | + this.cale.setRange(this.calendar.fullDate); | |
| 605 | + // 设置多选 | |
| 606 | + this.cale.setMultiple(this.calendar.fullDate); | |
| 607 | + | |
| 608 | + // 如果启用滑动切换 且当前模式为范围选择时则重新计算上月与下月 | |
| 609 | + if (this.slideSwitchMode !== 'none') { | |
| 610 | + let weekName = ''; | |
| 611 | + switch (this.swiperCurrent) { | |
| 612 | + case 0: | |
| 613 | + weekName = 'preWeeks' | |
| 614 | + if (this.mode == 'range') { | |
| 615 | + this.weeks = this.cale._getWeek(this.weeks[0].find(item => item.fullDate).fullDate, false) | |
| 616 | + this.nextWeeks = this.cale._getWeek(this.nextWeeks[0].find(item => item.fullDate).fullDate, | |
| 617 | + false) | |
| 618 | + } | |
| 619 | + break; | |
| 620 | + case 1: | |
| 621 | + weekName = 'weeks' | |
| 622 | + if (this.mode == 'range') { | |
| 623 | + this.preWeeks = this.cale._getWeek(this.preWeeks[0].find(item => item.fullDate).fullDate, | |
| 624 | + false) | |
| 625 | + this.nextWeeks = this.cale._getWeek(this.nextWeeks[0].find(item => item.fullDate).fullDate, | |
| 626 | + false) | |
| 627 | + } | |
| 628 | + break; | |
| 629 | + case 2: | |
| 630 | + weekName = 'nextWeeks' | |
| 631 | + if (this.mode == 'range') { | |
| 632 | + this.weeks = this.cale._getWeek(this.weeks[0].find(item => item.fullDate).fullDate, false) | |
| 633 | + this.preWeeks = this.cale._getWeek(this.preWeeks[0].find(item => item.fullDate).fullDate, | |
| 634 | + false) | |
| 635 | + } | |
| 636 | + break; | |
| 637 | + } | |
| 638 | + this[weekName] = this.cale.weeks; | |
| 639 | + } else { | |
| 640 | + this.weeks = this.cale.weeks; | |
| 641 | + } | |
| 642 | + | |
| 643 | + this.change(); | |
| 644 | + }, | |
| 645 | + /** | |
| 646 | + * 回到今天 | |
| 647 | + */ | |
| 648 | + backToday() { | |
| 649 | + // 获取目前的年月 | |
| 650 | + const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}` | |
| 651 | + | |
| 652 | + if (this.cale.rangeStatus.before && !this.cale.rangeStatus.after) { | |
| 653 | + this.cale.rangeStatus.before = ''; | |
| 654 | + } | |
| 655 | + | |
| 656 | + // 设置日期 | |
| 657 | + this.setDate(this.cale.date.fullDate); | |
| 658 | + let date = this.nowDate; | |
| 659 | + this.calendar = date; | |
| 660 | + // 设置选中的日期 | |
| 661 | + this.cale.setRange(date.fullDate); | |
| 662 | + // 今天的日期 | |
| 663 | + const todayYearMonth = `${date.year}-${date.month}` | |
| 664 | + | |
| 665 | + // 如果当前日期 与 今天的日期不符 | |
| 666 | + if (nowYearMonth !== todayYearMonth) { | |
| 667 | + // 触发月份切换事件 | |
| 668 | + this.monthSwitch() | |
| 669 | + } | |
| 670 | + | |
| 671 | + // 设置日期 | |
| 672 | + this.setDate(this.cale.date.fullDate); | |
| 673 | + // swiperCurrent改变需要改动的weeks | |
| 674 | + this.swiperCurrentChangeWeeks(); | |
| 675 | + // 改变事件 | |
| 676 | + this.change() | |
| 677 | + }, | |
| 678 | + /** | |
| 679 | + * 上个月 | |
| 680 | + */ | |
| 681 | + pre() { | |
| 682 | + this.swiperChangeDirection = 'pre' | |
| 683 | + this.updateWeeks(); | |
| 684 | + }, | |
| 685 | + /** | |
| 686 | + * 下个月 | |
| 687 | + */ | |
| 688 | + next() { | |
| 689 | + this.swiperChangeDirection = 'next' | |
| 690 | + this.updateWeeks(); | |
| 691 | + }, | |
| 692 | + /** | |
| 693 | + * 设置日期 | |
| 694 | + * @param {Object} date | |
| 695 | + */ | |
| 696 | + setDate(date) { | |
| 697 | + this.cale.setDate(date) | |
| 698 | + this.nowDate = this.cale.getInfo(date) | |
| 699 | + this.assignmentWeeks() | |
| 700 | + }, | |
| 701 | + /** | |
| 702 | + * 用来将cale.weeks 赋值到 weeks | |
| 703 | + */ | |
| 704 | + assignmentWeeks() { | |
| 705 | + let weekName = ''; | |
| 706 | + let weekMonthName = ''; | |
| 707 | + switch (this.swiperCurrent) { | |
| 708 | + case 0: | |
| 709 | + weekName = 'preWeeks' | |
| 710 | + weekMonthName = 'preWeeksMonth' | |
| 711 | + break; | |
| 712 | + case 1: | |
| 713 | + weekName = 'weeks' | |
| 714 | + weekMonthName = 'weeksMonth' | |
| 715 | + break; | |
| 716 | + case 2: | |
| 717 | + weekName = 'nextWeeks' | |
| 718 | + weekMonthName = 'nextWeeksMonth' | |
| 719 | + break; | |
| 720 | + } | |
| 721 | + this[weekName] = this.cale.weeks; | |
| 722 | + this[weekMonthName] = this.cale.selectDate.month; | |
| 723 | + }, | |
| 724 | + /** | |
| 725 | + * 滑动切换日期 | |
| 726 | + */ | |
| 727 | + swiperChange(e) { | |
| 728 | + // 非用户滑动不执行 | |
| 729 | + if (e.detail.source !== 'touch' && e.detail.source !== 'autoplay') return; | |
| 730 | + let curr = e.detail.current; | |
| 731 | + if (curr - this.swiperCurrent == 1 || curr - this.swiperCurrent == -2) { | |
| 732 | + this.swiperChangeDirection = 'next' | |
| 733 | + } else { | |
| 734 | + this.swiperChangeDirection = 'pre' | |
| 735 | + } | |
| 736 | + this.swiperCurrent = curr; | |
| 737 | + this.updateWeeks(); | |
| 738 | + }, | |
| 739 | + /** | |
| 740 | + * 更新weeks | |
| 741 | + * @param {Boolean} isChange 是否使当前的weeks发生变化 | |
| 742 | + */ | |
| 743 | + updateWeeks(isChange = true, isInt = false) { | |
| 744 | + let newFullDate = '' | |
| 745 | + // 是否变动日期信息 | |
| 746 | + if (isChange) { | |
| 747 | + // 如果目前处于打开状态也就是月日历时,将记录月份改为一号(这样可以在用户切换到任意月份时并折叠自动选中1号) | |
| 748 | + let fullDate = this.FoldStatus === 'close' ? this.nowDate.fullDate : `${this.nowDate.year}-${this.nowDate.month}-${1}` | |
| 749 | + newFullDate = this.cale.getDate(fullDate, this.swiperChangeDirection === 'next' ? +1 : -1, this.getDateType).fullDate; | |
| 750 | + } else { | |
| 751 | + newFullDate = this.cale.getDate(this.nowDate.fullDate, 0, this.getDateType).fullDate; | |
| 752 | + } | |
| 753 | + this.setDate(newFullDate) | |
| 754 | + this.swiperCurrentChangeWeeks(); | |
| 755 | + if(!isInt) { | |
| 756 | + this.monthSwitch(); | |
| 757 | + } | |
| 758 | + }, | |
| 759 | + /** | |
| 760 | + * swiperCurrent改变需要改动的weeks | |
| 761 | + */ | |
| 762 | + swiperCurrentChangeWeeks() { | |
| 763 | + if (this.slideSwitchMode === 'none') return; | |
| 764 | + // 防止一次渲染过多数据,造成对nvue的卡顿 | |
| 765 | + this.$nextTick(() => { | |
| 766 | + let nextDate = this.cale.getDate(this.nowDate.fullDate, +1, this.getDateType); | |
| 767 | + let nextWeeks = this.cale._getWeek(nextDate.fullDate, false); | |
| 768 | + let nextWeeksMonth = nextDate.month | |
| 769 | + let preDate = this.cale.getDate(this.nowDate.fullDate, -1, this.getDateType); | |
| 770 | + let preWeeks = this.cale._getWeek(preDate.fullDate, false); | |
| 771 | + let preWeeksMonth = preDate.month | |
| 772 | + | |
| 773 | + if (this.swiperCurrent == 0) { | |
| 774 | + this.weeks = nextWeeks; | |
| 775 | + this.weeksMonth = nextWeeksMonth; | |
| 776 | + this.nextWeeks = preWeeks; | |
| 777 | + this.nextWeeksMonth = preWeeksMonth; | |
| 778 | + } else if (this.swiperCurrent == 1) { | |
| 779 | + this.nextWeeks = nextWeeks; | |
| 780 | + this.nextWeeksMonth = nextWeeksMonth; | |
| 781 | + this.preWeeks = preWeeks; | |
| 782 | + this.preWeeksMonth = preWeeksMonth; | |
| 783 | + } else { | |
| 784 | + this.preWeeks = nextWeeks; | |
| 785 | + this.preWeeksMonth = nextWeeksMonth; | |
| 786 | + this.weeks = preWeeks; | |
| 787 | + this.weeksMonth = preWeeksMonth; | |
| 788 | + } | |
| 789 | + }) | |
| 790 | + }, | |
| 791 | + | |
| 792 | + // 点击折叠 | |
| 793 | + FoldClick() { | |
| 794 | + this.FoldStatus = this.FoldStatus === 'open' ? 'close' : 'open'; | |
| 795 | + this.cale.resetFoldStatus(this.FoldStatus); | |
| 796 | + // 重置当前weeks | |
| 797 | + this.setDate(this.nowDate.fullDate); | |
| 798 | + this.$nextTick(() => { | |
| 799 | + // 重置左右切换的上下weeks | |
| 800 | + if (this.slideSwitchMode !== 'none') { | |
| 801 | + let nextDate = this.cale.getDate(this.nowDate.fullDate, +1, this.getDateType); | |
| 802 | + let nextWeeks = this.cale._getWeek(nextDate.fullDate, false); | |
| 803 | + let nextWeeksMonth = nextDate.month; | |
| 804 | + | |
| 805 | + let preDate = this.cale.getDate(this.nowDate.fullDate, -1, this.getDateType); | |
| 806 | + let preWeeks = this.cale._getWeek(preDate.fullDate, false); | |
| 807 | + let preWeeksMonth = preDate.month; | |
| 808 | + | |
| 809 | + if (this.swiperChangeDirection == 'next') { | |
| 810 | + if (this.swiperCurrent == 0) { | |
| 811 | + this.weeks = nextWeeks; | |
| 812 | + this.weeksMonth = nextWeeksMonth; | |
| 813 | + this.nextWeeks = preWeeks; | |
| 814 | + this.nextWeeksMonth = preWeeksMonth; | |
| 815 | + } else if (this.swiperCurrent == 1) { | |
| 816 | + this.nextWeeks = nextWeeks; | |
| 817 | + this.nextWeeksMonth = nextWeeksMonth; | |
| 818 | + this.preWeeks = preWeeks; | |
| 819 | + this.preWeeksMonth = preWeeksMonth; | |
| 820 | + } else { | |
| 821 | + this.preWeeks = nextWeeks; | |
| 822 | + this.preWeeksMonth = nextWeeksMonth; | |
| 823 | + this.weeks = preWeeks; | |
| 824 | + this.weeksMonth = preWeeksMonth; | |
| 825 | + } | |
| 826 | + } else { | |
| 827 | + if (this.swiperCurrent == 0) { | |
| 828 | + this.nextWeeks = preWeeks; | |
| 829 | + this.nextWeeksMonth = preWeeksMonth; | |
| 830 | + this.weeks = nextWeeks; | |
| 831 | + this.weeksMonth = nextWeeksMonth; | |
| 832 | + } else if (this.swiperCurrent == 1) { | |
| 833 | + this.preWeeks = preWeeks; | |
| 834 | + this.preWeeksMonth = preWeeksMonth; | |
| 835 | + this.nextWeeks = nextWeeks; | |
| 836 | + this.nextWeeksMonth = nextWeeksMonth; | |
| 837 | + } else { | |
| 838 | + this.weeks = preWeeks; | |
| 839 | + this.weeksMonth = preWeeksMonth; | |
| 840 | + this.preWeeks = nextWeeks; | |
| 841 | + this.preWeeksMonth = nextWeeksMonth; | |
| 842 | + } | |
| 843 | + } | |
| 844 | + } | |
| 845 | + }) | |
| 846 | + // fold切换事件 | |
| 847 | + this.$emit('foldSwitch', { | |
| 848 | + type: this.type, | |
| 849 | + status: this.FoldStatus | |
| 850 | + }) | |
| 851 | + }, | |
| 852 | + // 初始化折叠 | |
| 853 | + initFold() { | |
| 854 | + if (this.type === 'month' || this.type === 'week') { | |
| 855 | + this.Fold = this.fold === null ? this.type !== 'month' : this.fold; | |
| 856 | + this.FoldStatus = this.type !== 'month' ? 'close' : 'open'; | |
| 857 | + } | |
| 858 | + } | |
| 859 | + } | |
| 860 | + } | |
| 861 | +</script> | |
| 862 | + | |
| 863 | +<style lang="scss" scoped> | |
| 864 | + $wu-bg-color-mask: rgba($color: #000000, $alpha: 0.4); | |
| 865 | + $wu-border-color: #EDEDED; | |
| 866 | + $wu-text-color: #333; | |
| 867 | + $wu-bg-color-hover: #f1f1f1; | |
| 868 | + $wu-font-size-base: 32rpx; | |
| 869 | + $wu-text-color-placeholder: #808080; | |
| 870 | + $wu-color-subtitle: #555555; | |
| 871 | + $wu-text-color-grey: #999; | |
| 872 | + | |
| 873 | + .wu-calendar { | |
| 874 | + /* #ifndef APP-NVUE */ | |
| 875 | + display: flex; | |
| 876 | + /* #endif */ | |
| 877 | + flex-direction: column; | |
| 878 | + } | |
| 879 | + | |
| 880 | + .wu-calendar__mask { | |
| 881 | + position: fixed; | |
| 882 | + bottom: 0; | |
| 883 | + top: 0; | |
| 884 | + left: 0; | |
| 885 | + right: 0; | |
| 886 | + background-color: $wu-bg-color-mask; | |
| 887 | + transition-property: opacity; | |
| 888 | + transition-duration: 0.3s; | |
| 889 | + opacity: 0; | |
| 890 | + /* #ifndef APP-NVUE */ | |
| 891 | + z-index: 99; | |
| 892 | + /* #endif */ | |
| 893 | + } | |
| 894 | + | |
| 895 | + .wu-calendar--mask-show { | |
| 896 | + opacity: 1; | |
| 897 | + } | |
| 898 | + | |
| 899 | + .wu-calendar--fixed { | |
| 900 | + position: fixed; | |
| 901 | + /* #ifdef APP-NVUE */ | |
| 902 | + bottom: 0; | |
| 903 | + /* #endif */ | |
| 904 | + left: 0; | |
| 905 | + right: 0; | |
| 906 | + transition-property: transform; | |
| 907 | + transition-duration: 0.3s; | |
| 908 | + transform: translateY(1080rpx); | |
| 909 | + /* #ifndef APP-NVUE */ | |
| 910 | + bottom: calc(var(--window-bottom)); | |
| 911 | + z-index: 99; | |
| 912 | + /* #endif */ | |
| 913 | + } | |
| 914 | + | |
| 915 | + .wu-calendar--ani-show { | |
| 916 | + transform: translateY(0); | |
| 917 | + } | |
| 918 | + | |
| 919 | + .wu-calendar__content { | |
| 920 | + background-color: #fff; | |
| 921 | + } | |
| 922 | + | |
| 923 | + .wu-calendar__header { | |
| 924 | + position: relative; | |
| 925 | + /* #ifndef APP-NVUE */ | |
| 926 | + display: flex; | |
| 927 | + /* #endif */ | |
| 928 | + flex-direction: row; | |
| 929 | + justify-content: center; | |
| 930 | + align-items: center; | |
| 931 | + border-bottom-color: $wu-border-color; | |
| 932 | + border-bottom-style: solid; | |
| 933 | + border-bottom-width: 2rpx; | |
| 934 | + } | |
| 935 | + | |
| 936 | + .wu-calendar--fixed-top { | |
| 937 | + /* #ifndef APP-NVUE */ | |
| 938 | + display: flex; | |
| 939 | + /* #endif */ | |
| 940 | + height: 90rpx; | |
| 941 | + flex-direction: row; | |
| 942 | + justify-content: space-between; | |
| 943 | + border-top-color: $wu-border-color; | |
| 944 | + border-top-style: solid; | |
| 945 | + border-top-width: 2rpx; | |
| 946 | + } | |
| 947 | + | |
| 948 | + .wu-calendar--fixed-width { | |
| 949 | + width: 100rpx; | |
| 950 | + } | |
| 951 | + | |
| 952 | + .wu-calendar__backtoday { | |
| 953 | + position: absolute; | |
| 954 | + right: 0; | |
| 955 | + top: 25rpx; | |
| 956 | + padding: 0 10rpx; | |
| 957 | + padding-left: 20rpx; | |
| 958 | + height: 50rpx; | |
| 959 | + line-height: 50rpx; | |
| 960 | + font-size: 24rpx; | |
| 961 | + border-top-left-radius: 50rpx; | |
| 962 | + border-bottom-left-radius: 50rpx; | |
| 963 | + color: $wu-text-color; | |
| 964 | + background-color: $wu-bg-color-hover; | |
| 965 | + | |
| 966 | + &.vertical { | |
| 967 | + top: 38rpx; | |
| 968 | + } | |
| 969 | + } | |
| 970 | + | |
| 971 | + .wu-calendar__header-text { | |
| 972 | + text-align: center; | |
| 973 | + width: 200rpx; | |
| 974 | + font-size: $wu-font-size-base; | |
| 975 | + color: $wu-text-color; | |
| 976 | + } | |
| 977 | + | |
| 978 | + .wu-calendar__header-btn-box { | |
| 979 | + /* #ifndef APP-NVUE */ | |
| 980 | + display: flex; | |
| 981 | + /* #endif */ | |
| 982 | + flex-direction: row; | |
| 983 | + align-items: center; | |
| 984 | + justify-content: center; | |
| 985 | + | |
| 986 | + .wu-calendar__header-btn { | |
| 987 | + width: 20rpx; | |
| 988 | + height: 20rpx; | |
| 989 | + } | |
| 990 | + | |
| 991 | + &.horizontal { | |
| 992 | + width: 100rpx; | |
| 993 | + height: 100rpx; | |
| 994 | + } | |
| 995 | + | |
| 996 | + &.vertical { | |
| 997 | + flex-direction: column; | |
| 998 | + padding: 20rpx 0; | |
| 999 | + } | |
| 1000 | + } | |
| 1001 | + | |
| 1002 | + .wu-calendar__header-btn { | |
| 1003 | + border-left-color: $wu-text-color-placeholder; | |
| 1004 | + border-left-style: solid; | |
| 1005 | + border-left-width: 4rpx; | |
| 1006 | + border-top-color: $wu-color-subtitle; | |
| 1007 | + border-top-style: solid; | |
| 1008 | + border-top-width: 4rpx; | |
| 1009 | + } | |
| 1010 | + | |
| 1011 | + .wu-calendar--left { | |
| 1012 | + transform: rotate(-45deg); | |
| 1013 | + } | |
| 1014 | + | |
| 1015 | + .wu-calendar--right { | |
| 1016 | + transform: rotate(135deg); | |
| 1017 | + } | |
| 1018 | + | |
| 1019 | + .wu-calendar--top { | |
| 1020 | + transform: rotate(45deg); | |
| 1021 | + } | |
| 1022 | + | |
| 1023 | + .wu-calendar--bottom { | |
| 1024 | + transform: rotate(225deg); | |
| 1025 | + } | |
| 1026 | + | |
| 1027 | + .wu-calendar__weeks { | |
| 1028 | + position: relative; | |
| 1029 | + /* #ifndef APP-NVUE */ | |
| 1030 | + display: flex; | |
| 1031 | + /* #endif */ | |
| 1032 | + flex-direction: row; | |
| 1033 | + padding: 0 8rpx; | |
| 1034 | + } | |
| 1035 | + | |
| 1036 | + .wu-calendar__weeks-day { | |
| 1037 | + flex: 1; | |
| 1038 | + /* #ifndef APP-NVUE */ | |
| 1039 | + display: flex; | |
| 1040 | + /* #endif */ | |
| 1041 | + flex-direction: column; | |
| 1042 | + justify-content: center; | |
| 1043 | + align-items: center; | |
| 1044 | + height: 90rpx; | |
| 1045 | + border-bottom-color: #F5F5F5; | |
| 1046 | + border-bottom-style: solid; | |
| 1047 | + border-bottom-width: 2rpx; | |
| 1048 | + } | |
| 1049 | + | |
| 1050 | + .wu-calendar__weeks-day-text { | |
| 1051 | + font-size: 28rpx; | |
| 1052 | + } | |
| 1053 | + | |
| 1054 | + .wu-calendar__box { | |
| 1055 | + position: relative; | |
| 1056 | + } | |
| 1057 | + | |
| 1058 | + .wu-calendar__weeks_container { | |
| 1059 | + transition: height 0.2s linear; | |
| 1060 | + } | |
| 1061 | + | |
| 1062 | + .wu-calendar__fold { | |
| 1063 | + /* #ifndef APP-NVUE */ | |
| 1064 | + display: flex; | |
| 1065 | + /* #endif */ | |
| 1066 | + flex-direction: row; | |
| 1067 | + justify-content: center; | |
| 1068 | + } | |
| 1069 | +</style> | |
| 0 | 1070 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-calendar/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "id": "wu-calendar", | |
| 3 | + "displayName": "wu-calendar 最全日历,动态滑动切换、多滑动模式、多日历类型、多日期选择模式等,全端兼容,无论平台,一致体验。", | |
| 4 | + "version": "1.5.6", | |
| 5 | + "description": "唯一支持动态滑动计算的日历插件,多滑动切换模式(纵、横、不滑动)、多日历类型(周、月)、多日期选择模式(单选、多选、范围)、日历周几(周日、周一)、自定义主题、农历显示等,可以让您纵享丝滑的使用日历", | |
| 6 | + "keywords": [ | |
| 7 | + "wu-calendar", | |
| 8 | + "日历", | |
| 9 | + "多日历类型", | |
| 10 | + "动态滑动计算", | |
| 11 | + "wu-ui" | |
| 12 | +], | |
| 13 | + "repository": "", | |
| 14 | + "engines": { | |
| 15 | + "HBuilderX": "^3.5.5" | |
| 16 | + }, | |
| 17 | + "dcloudext": { | |
| 18 | + "type": "component-vue", | |
| 19 | + "sale": { | |
| 20 | + "regular": { | |
| 21 | + "price": "0.00" | |
| 22 | + }, | |
| 23 | + "sourcecode": { | |
| 24 | + "price": "0.00" | |
| 25 | + } | |
| 26 | + }, | |
| 27 | + "contact": { | |
| 28 | + "qq": "" | |
| 29 | + }, | |
| 30 | + "declaration": { | |
| 31 | + "ads": "无", | |
| 32 | + "data": "插件不采集任何数据", | |
| 33 | + "permissions": "无" | |
| 34 | + }, | |
| 35 | + "npmurl": "" | |
| 36 | + }, | |
| 37 | + "uni_modules": { | |
| 38 | + "dependencies": [ | |
| 39 | + "wu-ui-tools", | |
| 40 | + "wu-icon", | |
| 41 | + "wu-safe-bottom" | |
| 42 | + ], | |
| 43 | + "encrypt": [], | |
| 44 | + "platforms": { | |
| 45 | + "cloud": { | |
| 46 | + "tcb": "y", | |
| 47 | + "aliyun": "y", | |
| 48 | + "alipay": "n" | |
| 49 | + }, | |
| 50 | + "client": { | |
| 51 | + "Vue": { | |
| 52 | + "vue2": "y", | |
| 53 | + "vue3": "y" | |
| 54 | + }, | |
| 55 | + "App": { | |
| 56 | + "app-vue": "y", | |
| 57 | + "app-nvue": "y", | |
| 58 | + "app-uvue": "u" | |
| 59 | + }, | |
| 60 | + "H5-mobile": { | |
| 61 | + "Safari": "y", | |
| 62 | + "Android Browser": "y", | |
| 63 | + "微信浏览器(Android)": "y", | |
| 64 | + "QQ浏览器(Android)": "y" | |
| 65 | + }, | |
| 66 | + "H5-pc": { | |
| 67 | + "Chrome": "y", | |
| 68 | + "IE": "y", | |
| 69 | + "Edge": "y", | |
| 70 | + "Firefox": "y", | |
| 71 | + "Safari": "y" | |
| 72 | + }, | |
| 73 | + "小程序": { | |
| 74 | + "微信": "y", | |
| 75 | + "阿里": "y", | |
| 76 | + "百度": "y", | |
| 77 | + "字节跳动": "y", | |
| 78 | + "QQ": "y", | |
| 79 | + "钉钉": "n", | |
| 80 | + "快手": "n", | |
| 81 | + "飞书": "n", | |
| 82 | + "京东": "n" | |
| 83 | + }, | |
| 84 | + "快应用": { | |
| 85 | + "华为": "n", | |
| 86 | + "联盟": "n" | |
| 87 | + } | |
| 88 | + } | |
| 89 | + } | |
| 90 | + } | |
| 91 | +} | |
| 0 | 92 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-icon/components/wu-icon/icons.js
0 → 100644
| 1 | +export default { | |
| 2 | + 'wuicon-level': 'e68f', | |
| 3 | + 'wuicon-download': 'e670', | |
| 4 | + 'wuicon-search': 'e632', | |
| 5 | + 'wuicon-reload': 'e627', | |
| 6 | + 'wuicon-scan': 'e631', | |
| 7 | + 'wuicon-calendar': 'e65c', | |
| 8 | + 'wuicon-bag': 'e647', | |
| 9 | + 'wuicon-checkbox-mark': 'e659', | |
| 10 | + 'wuicon-attach': 'e640', | |
| 11 | + 'wuicon-wifi-off': 'e6cc', | |
| 12 | + | |
| 13 | + 'wuicon-woman': 'e626', | |
| 14 | + 'wuicon-man': 'e675', | |
| 15 | + 'wuicon-chat': 'e656', | |
| 16 | + 'wuicon-chat-fill': 'e63f', | |
| 17 | + 'wuicon-red-packet': 'e6c3', | |
| 18 | + 'wuicon-folder': 'e694', | |
| 19 | + 'wuicon-order': 'e695', | |
| 20 | + 'wuicon-arrow-up-fill': 'e636', | |
| 21 | + 'wuicon-arrow-down-fill': 'e638', | |
| 22 | + 'wuicon-backspace': 'e64d', | |
| 23 | + 'wuicon-photo': 'e60d', | |
| 24 | + 'wuicon-photo-fill': 'e6b4', | |
| 25 | + 'wuicon-lock': 'e69d', | |
| 26 | + 'wuicon-lock-fill': 'e6a6', | |
| 27 | + 'wuicon-lock-open': 'e68d', | |
| 28 | + 'wuicon-lock-opened-fill': 'e6a1', | |
| 29 | + 'wuicon-home': 'e67b', | |
| 30 | + 'wuicon-home-fill': 'e68e', | |
| 31 | + 'wuicon-star': 'e618', | |
| 32 | + 'wuicon-star-fill': 'e61e', | |
| 33 | + 'wuicon-share': 'e629', | |
| 34 | + 'wuicon-share-fill': 'e6bb', | |
| 35 | + 'wuicon-share-square': 'e6c4', | |
| 36 | + 'wuicon-volume': 'e605', | |
| 37 | + 'wuicon-volume-fill': 'e624', | |
| 38 | + 'wuicon-volume-off': 'e6bd', | |
| 39 | + 'wuicon-volume-off-fill': 'e6c8', | |
| 40 | + 'wuicon-trash': 'e623', | |
| 41 | + 'wuicon-trash-fill': 'e6ce', | |
| 42 | + 'wuicon-shopping-cart': 'e6cb', | |
| 43 | + 'wuicon-shopping-cart-fill': 'e630', | |
| 44 | + 'wuicon-question-circle': 'e622', | |
| 45 | + 'wuicon-question-circle-fill': 'e6bc', | |
| 46 | + 'wuicon-plus': 'e625', | |
| 47 | + 'wuicon-plus-circle': 'e603', | |
| 48 | + 'wuicon-plus-circle-fill': 'e611', | |
| 49 | + 'wuicon-tags': 'e621', | |
| 50 | + 'wuicon-tags-fill': 'e613', | |
| 51 | + 'wuicon-pause': 'e61c', | |
| 52 | + 'wuicon-pause-circle': 'e696', | |
| 53 | + 'wuicon-pause-circle-fill': 'e60c', | |
| 54 | + 'wuicon-play-circle': 'e6af', | |
| 55 | + 'wuicon-play-circle-fill': 'e62a', | |
| 56 | + 'wuicon-map': 'e665', | |
| 57 | + 'wuicon-map-fill': 'e6a8', | |
| 58 | + 'wuicon-phone': 'e6ba', | |
| 59 | + 'wuicon-phone-fill': 'e6ac', | |
| 60 | + 'wuicon-list': 'e690', | |
| 61 | + 'wuicon-list-dot': 'e6a9', | |
| 62 | + 'wuicon-info-circle': 'e69f', | |
| 63 | + 'wuicon-info-circle-fill': 'e6a7', | |
| 64 | + 'wuicon-minus': 'e614', | |
| 65 | + 'wuicon-minus-circle': 'e6a5', | |
| 66 | + 'wuicon-mic': 'e66d', | |
| 67 | + 'wuicon-mic-off': 'e691', | |
| 68 | + 'wuicon-grid': 'e68c', | |
| 69 | + 'wuicon-grid-fill': 'e698', | |
| 70 | + 'wuicon-eye': 'e664', | |
| 71 | + 'wuicon-eye-fill': 'e697', | |
| 72 | + 'wuicon-eye-off': 'e69c', | |
| 73 | + 'wuicon-eye-off-outline': 'e688', | |
| 74 | + 'wuicon-file-text': 'e687', | |
| 75 | + 'wuicon-file-text-fill': 'e67f', | |
| 76 | + 'wuicon-edit-pen': 'e65d', | |
| 77 | + 'wuicon-edit-pen-fill': 'e679', | |
| 78 | + 'wuicon-email': 'e673', | |
| 79 | + 'wuicon-email-fill': 'e683', | |
| 80 | + 'wuicon-checkmark': 'e64a', | |
| 81 | + 'wuicon-checkmark-circle': 'e643', | |
| 82 | + 'wuicon-checkmark-circle-fill': 'e668', | |
| 83 | + 'wuicon-clock': 'e66c', | |
| 84 | + 'wuicon-clock-fill': 'e64b', | |
| 85 | + 'wuicon-close': 'e65a', | |
| 86 | + 'wuicon-close-circle': 'e64e', | |
| 87 | + 'wuicon-close-circle-fill': 'e666', | |
| 88 | + 'wuicon-car': 'e64f', | |
| 89 | + 'wuicon-car-fill': 'e648', | |
| 90 | + 'wuicon-bell': 'e651', | |
| 91 | + 'wuicon-bell-fill': 'e604', | |
| 92 | + 'wuicon-play-left': 'e6bf', | |
| 93 | + 'wuicon-play-right': 'e6b3', | |
| 94 | + 'wuicon-play-left-fill': 'e6ae', | |
| 95 | + 'wuicon-play-right-fill': 'e6ad', | |
| 96 | + 'wuicon-skip-back-left': 'e6c5', | |
| 97 | + 'wuicon-skip-forward-right': 'e61f', | |
| 98 | + 'wuicon-setting': 'e602', | |
| 99 | + 'wuicon-setting-fill': 'e6d0', | |
| 100 | + 'wuicon-more-dot-fill': 'e66f', | |
| 101 | + 'wuicon-more-circle': 'e69e', | |
| 102 | + 'wuicon-more-circle-fill': 'e684', | |
| 103 | + 'wuicon-arrow-upward': 'e641', | |
| 104 | + 'wuicon-arrow-downward': 'e634', | |
| 105 | + 'wuicon-arrow-leftward': 'e63b', | |
| 106 | + 'wuicon-arrow-rightward': 'e644', | |
| 107 | + 'wuicon-arrow-up': 'e633', | |
| 108 | + 'wuicon-arrow-down': 'e63e', | |
| 109 | + 'wuicon-arrow-left': 'e646', | |
| 110 | + 'wuicon-arrow-right': 'e63c', | |
| 111 | + 'wuicon-thumb-up': 'e612', | |
| 112 | + 'wuicon-thumb-up-fill': 'e62c', | |
| 113 | + 'wuicon-thumb-down': 'e60a', | |
| 114 | + 'wuicon-thumb-down-fill': 'e628', | |
| 115 | + 'wuicon-coupon': 'e65f', | |
| 116 | + 'wuicon-coupon-fill': 'e64c', | |
| 117 | + 'wuicon-kefu-ermai': 'e660', | |
| 118 | + 'wuicon-server-fill': 'e610', | |
| 119 | + 'wuicon-server-man': 'e601', | |
| 120 | + 'wuicon-warning': 'e6c1', | |
| 121 | + 'wuicon-warning-fill': 'e6c7', | |
| 122 | + 'wuicon-camera': 'e642', | |
| 123 | + 'wuicon-camera-fill': 'e650', | |
| 124 | + 'wuicon-pushpin': 'e6d1', | |
| 125 | + 'wuicon-pushpin-fill': 'e6b6', | |
| 126 | + 'wuicon-heart': 'e6a2', | |
| 127 | + 'wuicon-heart-fill': 'e68b', | |
| 128 | + 'wuicon-account': 'e63a', | |
| 129 | + 'wuicon-account-fill': 'e653', | |
| 130 | + 'wuicon-integral': 'e693', | |
| 131 | + 'wuicon-integral-fill': 'e6b1', | |
| 132 | + 'wuicon-gift': 'e680', | |
| 133 | + 'wuicon-gift-fill': 'e6b0', | |
| 134 | + | |
| 135 | + | |
| 136 | + 'wuicon-empty-data': 'e671', | |
| 137 | + 'wuicon-empty-address': 'e68a', | |
| 138 | + 'wuicon-empty-favor': 'e662', | |
| 139 | + 'wuicon-empty-car': 'e656', | |
| 140 | + 'wuicon-empty-order': 'e66b', | |
| 141 | + 'wuicon-empty-list': 'e671', | |
| 142 | + 'wuicon-empty-search': 'e677', | |
| 143 | + 'wuicon-empty-permission': 'e67c', | |
| 144 | + 'wuicon-empty-news': 'e67d', | |
| 145 | + 'wuicon-empty-history': 'e684', | |
| 146 | + 'wuicon-empty-coupon': 'e69b', | |
| 147 | + 'wuicon-empty-page': 'e60e', | |
| 148 | + | |
| 149 | + 'wuicon-apple-fill': 'e635', | |
| 150 | + 'wuicon-zhifubao-circle-fill': 'e617', | |
| 151 | + 'wuicon-weixin-circle-fill': 'e6cd', | |
| 152 | + 'wuicon-weixin-fill': 'e620', | |
| 153 | + 'wuicon-qq-fill': 'e608', | |
| 154 | + 'wuicon-qq-circle-fill': 'e6b9', | |
| 155 | + 'wuicon-moments': 'e6a0', | |
| 156 | + 'wuicon-moments-circel-fill': 'e6c2', | |
| 157 | + 'wuicon-twitter': 'e607', | |
| 158 | + 'wuicon-twitter-circle-fill': 'e6cf', | |
| 159 | +} | |
| 0 | 160 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-icon/components/wu-icon/props.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + // 图标类名 | |
| 4 | + name: { | |
| 5 | + type: String, | |
| 6 | + default: '' | |
| 7 | + }, | |
| 8 | + // 图标颜色,可接受主题色 | |
| 9 | + color: { | |
| 10 | + type: String, | |
| 11 | + default: '#606266' | |
| 12 | + }, | |
| 13 | + // 字体大小,单位px | |
| 14 | + size: { | |
| 15 | + type: [String, Number], | |
| 16 | + default: '16px' | |
| 17 | + }, | |
| 18 | + // 是否显示粗体 | |
| 19 | + bold: { | |
| 20 | + type: Boolean, | |
| 21 | + default: false | |
| 22 | + }, | |
| 23 | + // 点击图标的时候传递事件出去的index(用于区分点击了哪一个) | |
| 24 | + index: { | |
| 25 | + type: [String, Number], | |
| 26 | + default: null | |
| 27 | + }, | |
| 28 | + // 触摸图标时的类名 | |
| 29 | + hoverClass: { | |
| 30 | + type: String, | |
| 31 | + default: '' | |
| 32 | + }, | |
| 33 | + // 自定义扩展前缀,方便用户扩展自己的图标库 | |
| 34 | + customPrefix: { | |
| 35 | + type: String, | |
| 36 | + default: 'wuicon' | |
| 37 | + }, | |
| 38 | + // 图标右边或者下面的文字 | |
| 39 | + label: { | |
| 40 | + type: [String, Number], | |
| 41 | + default: '' | |
| 42 | + }, | |
| 43 | + // label的位置,只能右边或者下边 | |
| 44 | + labelPos: { | |
| 45 | + type: String, | |
| 46 | + default: 'right' | |
| 47 | + }, | |
| 48 | + // label的大小 | |
| 49 | + labelSize: { | |
| 50 | + type: [String, Number], | |
| 51 | + default: '15px' | |
| 52 | + }, | |
| 53 | + // label的颜色 | |
| 54 | + labelColor: { | |
| 55 | + type: String, | |
| 56 | + default: '#606266' | |
| 57 | + }, | |
| 58 | + // label与图标的距离 | |
| 59 | + space: { | |
| 60 | + type: [String, Number], | |
| 61 | + default: '3px' | |
| 62 | + }, | |
| 63 | + // 图片的mode | |
| 64 | + imgMode: { | |
| 65 | + type: String, | |
| 66 | + default: '' | |
| 67 | + }, | |
| 68 | + // 用于显示图片小图标时,图片的宽度 | |
| 69 | + width: { | |
| 70 | + type: [String, Number], | |
| 71 | + default: '' | |
| 72 | + }, | |
| 73 | + // 用于显示图片小图标时,图片的高度 | |
| 74 | + height: { | |
| 75 | + type: [String, Number], | |
| 76 | + default: '' | |
| 77 | + }, | |
| 78 | + // 用于解决某些情况下,让图标垂直居中的用途 | |
| 79 | + top: { | |
| 80 | + type: [String, Number], | |
| 81 | + default: 0 | |
| 82 | + }, | |
| 83 | + // 是否阻止事件传播 | |
| 84 | + stop: { | |
| 85 | + type: Boolean, | |
| 86 | + default: false | |
| 87 | + }, | |
| 88 | + ...uni.$w?.props?.icon | |
| 89 | + } | |
| 90 | +} | |
| 0 | 91 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-icon/components/wu-icon/wu-icon.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="wu-icon" @tap="clickHandler" :class="['wu-icon--' + labelPos]"> | |
| 3 | + <!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 --> | |
| 4 | + <text v-if="label !== '' && (labelPos == 'left' || labelPos == 'top')" class="wu-icon__label" :style="labelStyle">{{ label }}</text> | |
| 5 | + <image class="wu-icon__img" v-if="isImg" :src="name" :mode="imgMode" | |
| 6 | + :style="[imgStyle, $w.addStyle(customStyle)]"></image> | |
| 7 | + <text v-else class="wu-icon__icon" :class="uClasses" :style="[iconStyle, $w.addStyle(customStyle)]" | |
| 8 | + :hover-class="hoverClass">{{icon}}</text> | |
| 9 | + <!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 --> | |
| 10 | + <text v-if="label !== '' && (labelPos == 'right' || labelPos == 'bottom')" class="wu-icon__label" :style="labelStyle">{{ label }}</text> | |
| 11 | + </view> | |
| 12 | +</template> | |
| 13 | + | |
| 14 | +<script> | |
| 15 | + import mpMixin from '@/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js' | |
| 16 | + import mixin from '@/uni_modules/wu-ui-tools/libs/mixin/mixin.js' | |
| 17 | + // #ifdef APP-NVUE | |
| 18 | + // nvue通过weex的dom模块引入字体,相关文档地址如下: | |
| 19 | + // https://weex.apache.org/zh/docs/modules/dom.html#addrule | |
| 20 | + import iconUrl from './wuicons.ttf'; | |
| 21 | + const domModule = weex.requireModule('dom'); | |
| 22 | + domModule.addRule('fontFace', { | |
| 23 | + 'fontFamily': "wuicon-iconfont", | |
| 24 | + 'src': "url('" + iconUrl + "')" | |
| 25 | + }) | |
| 26 | + // #endif | |
| 27 | + // 引入图标名称,已经对应的unicode | |
| 28 | + import icons from './icons'; | |
| 29 | + import props from './props.js'; | |
| 30 | + /** | |
| 31 | + * icon 图标 | |
| 32 | + * @description 基于字体的图标集,包含了大多数常见场景的图标。 | |
| 33 | + * @tutorial https://wuui.cn/zh-CN/components/icon.html | |
| 34 | + * @property {String} name 图标名称,若带有 `/` 或遵循 `base64` 图片格式,会被认为是图片图标,则文字图标相关属性会失效。 | |
| 35 | + * @property {String} color 图标颜色,可接受主题色 (默认 color: #606266 ) | |
| 36 | + * @property {String | Number} size 图标字体大小,单位px/rpx (默认 '16px' ) | |
| 37 | + * @property {Boolean} bold 是否显示粗体 (默认 false ) | |
| 38 | + * @property {String | Number} index 点击图标的时候传递事件出去的index(用于区分点击了哪一个) | |
| 39 | + * @property {String} hoverClass 图标按下去的样式类,用法同uni的view组件的hoverClass参数,详情见官网 | |
| 40 | + * @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'wuicon' ) | |
| 41 | + * @property {String | Number} label 图标右侧的label文字 | |
| 42 | + * @property {String} labelPos label相对于图标的位置(默认 'right' ) | |
| 43 | + * @value top 上方 | |
| 44 | + * @value bottom 下方 | |
| 45 | + * @value left 左侧 | |
| 46 | + * @value right 右侧 | |
| 47 | + * @property {String | Number} labelSize label字体大小,单位px (默认 '15px' ) | |
| 48 | + * @property {String} labelColor 图标右侧的label文字颜色 ( 默认 color['wu-content-color'] ) | |
| 49 | + * @property {String | Number} space label与图标的距离,单位px (默认 '3px' ) | |
| 50 | + * @property {String} imgMode image组件的mode,详见:[image](https://uniapp.dcloud.net.cn/component/image.html#image) | |
| 51 | + * @property {String | Number} width 显示图片小图标时的宽度 | |
| 52 | + * @property {String | Number} height 显示图片小图标时的高度 | |
| 53 | + * @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 ) | |
| 54 | + * @property {Boolean} stop 是否阻止事件传播 (默认 false ) | |
| 55 | + * @property {Object} customStyle icon的样式,对象形式 | |
| 56 | + * @event {Function} click 点击图标时触发 | |
| 57 | + * @event {Function} touchstart 事件触摸时触发 | |
| 58 | + * @example <wu-icon name="photo" color="#2979ff" size="28"></wu-icon> | |
| 59 | + */ | |
| 60 | + export default { | |
| 61 | + name: 'wu-icon', | |
| 62 | + emits: ['click'], | |
| 63 | + mixins: [mpMixin, mixin, props], | |
| 64 | + data() { | |
| 65 | + return { | |
| 66 | + colorType: [ | |
| 67 | + 'primary', | |
| 68 | + 'success', | |
| 69 | + 'info', | |
| 70 | + 'error', | |
| 71 | + 'warning' | |
| 72 | + ] | |
| 73 | + } | |
| 74 | + }, | |
| 75 | + computed: { | |
| 76 | + uClasses() { | |
| 77 | + let classes = [] | |
| 78 | + classes.push(this.customPrefix) | |
| 79 | + classes.push(this.customPrefix + '-' + this.name) | |
| 80 | + // 主题色,通过类配置 | |
| 81 | + if (this.color && this.colorType.includes(this.color)) classes.push('wu-icon__icon--' + this.color) | |
| 82 | + // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别 | |
| 83 | + // 故需将其拆成一个字符串的形式,通过空格隔开各个类名 | |
| 84 | + //#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU | |
| 85 | + classes = classes.join(' ') | |
| 86 | + //#endif | |
| 87 | + return classes | |
| 88 | + }, | |
| 89 | + iconStyle() { | |
| 90 | + let style = {} | |
| 91 | + style = { | |
| 92 | + fontSize: this.$w.addUnit(this.size), | |
| 93 | + lineHeight: this.$w.addUnit(this.size), | |
| 94 | + fontWeight: this.bold ? 'bold' : 'normal', | |
| 95 | + // 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中 | |
| 96 | + top: this.$w.addUnit(this.top) | |
| 97 | + } | |
| 98 | + // 非主题色值时,才当作颜色值 | |
| 99 | + if (this.color && !this.colorType.includes(this.color)) style.color = this.color | |
| 100 | + return style | |
| 101 | + }, | |
| 102 | + // 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式 | |
| 103 | + isImg() { | |
| 104 | + const isBase64 = this.name.indexOf('data:') > -1 && this.name.indexOf('base64') > -1; | |
| 105 | + return this.name.indexOf('/') !== -1 || isBase64; | |
| 106 | + }, | |
| 107 | + imgStyle() { | |
| 108 | + let style = {} | |
| 109 | + // 如果设置width和height属性,则优先使用,否则使用size属性 | |
| 110 | + style.width = this.width ? this.$w.addUnit(this.width) : this.$w.addUnit(this.size) | |
| 111 | + style.height = this.height ? this.$w.addUnit(this.height) : this.$w.addUnit(this.size) | |
| 112 | + return style | |
| 113 | + }, | |
| 114 | + // 通过图标名,查找对应的图标 | |
| 115 | + icon() { | |
| 116 | + // 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码 | |
| 117 | + const code = icons['wuicon-' + this.name]; | |
| 118 | + if (['wuicon'].indexOf(this.customPrefix) > -1) { | |
| 119 | + return code ? unescape(`%u${code}`) : this.name; | |
| 120 | + } else { | |
| 121 | + // #ifndef APP-NVUE | |
| 122 | + return '' | |
| 123 | + // #endif | |
| 124 | + // #ifdef APP-NVUE | |
| 125 | + return unescape(`%u${this.name}`) | |
| 126 | + // #endif | |
| 127 | + } | |
| 128 | + }, | |
| 129 | + // label样式 | |
| 130 | + labelStyle() { | |
| 131 | + let style = { | |
| 132 | + color: this.labelColor, | |
| 133 | + fontSize: this.$w.addUnit(this.labelSize), | |
| 134 | + marginLeft: this.labelPos == 'right' ? this.$w.addUnit(this.space) : 0, | |
| 135 | + marginTop: this.labelPos == 'bottom' ? this.$w.addUnit(this.space) : 0, | |
| 136 | + marginRight: this.labelPos == 'left' ? this.$w.addUnit(this.space) : 0, | |
| 137 | + marginBottom: this.labelPos == 'top' ? this.$w.addUnit(this.space) : 0 | |
| 138 | + }; | |
| 139 | + return style | |
| 140 | + } | |
| 141 | + }, | |
| 142 | + methods: { | |
| 143 | + clickHandler(e) { | |
| 144 | + this.$emit('click', this.index) | |
| 145 | + // 是否阻止事件冒泡 | |
| 146 | + this.stop && this.preventEvent(e) | |
| 147 | + } | |
| 148 | + } | |
| 149 | + } | |
| 150 | +</script> | |
| 151 | + | |
| 152 | +<style lang="scss" scoped> | |
| 153 | + @import '@/uni_modules/wu-ui-tools/libs/css/components.scss'; | |
| 154 | + @import '@/uni_modules/wu-ui-tools/libs/css/color.scss'; | |
| 155 | + // 变量定义 | |
| 156 | + $wu-icon-primary: $wu-primary !default; | |
| 157 | + $wu-icon-success: $wu-success !default; | |
| 158 | + $wu-icon-info: $wu-info !default; | |
| 159 | + $wu-icon-warning: $wu-warning !default; | |
| 160 | + $wu-icon-error: $wu-error !default; | |
| 161 | + $wu-icon-label-line-height: 1 !default; | |
| 162 | + | |
| 163 | + /* #ifndef APP-NVUE */ | |
| 164 | + // 非nvue下加载字体 | |
| 165 | + @font-face { | |
| 166 | + font-family: 'wuicon-iconfont'; | |
| 167 | + src: url('./wuicons.ttf') format('truetype'); | |
| 168 | + } | |
| 169 | + | |
| 170 | + /* #endif */ | |
| 171 | + .wu-icon { | |
| 172 | + /* #ifndef APP-NVUE */ | |
| 173 | + display: flex; | |
| 174 | + /* #endif */ | |
| 175 | + align-items: center; | |
| 176 | + | |
| 177 | + &--left, &--right { | |
| 178 | + flex-direction: row; | |
| 179 | + } | |
| 180 | + | |
| 181 | + &--top, &--bottom { | |
| 182 | + flex-direction: column; | |
| 183 | + } | |
| 184 | + | |
| 185 | + &__icon { | |
| 186 | + font-family: wuicon-iconfont; | |
| 187 | + position: relative; | |
| 188 | + @include flex; | |
| 189 | + align-items: center; | |
| 190 | + | |
| 191 | + &--primary { | |
| 192 | + color: $wu-icon-primary; | |
| 193 | + } | |
| 194 | + | |
| 195 | + &--success { | |
| 196 | + color: $wu-icon-success; | |
| 197 | + } | |
| 198 | + | |
| 199 | + &--error { | |
| 200 | + color: $wu-icon-error; | |
| 201 | + } | |
| 202 | + | |
| 203 | + &--warning { | |
| 204 | + color: $wu-icon-warning; | |
| 205 | + } | |
| 206 | + | |
| 207 | + &--info { | |
| 208 | + color: $wu-icon-info; | |
| 209 | + } | |
| 210 | + } | |
| 211 | + | |
| 212 | + &__img { | |
| 213 | + /* #ifndef APP-NVUE */ | |
| 214 | + height: auto; | |
| 215 | + will-change: transform; | |
| 216 | + /* #endif */ | |
| 217 | + } | |
| 218 | + | |
| 219 | + &__label { | |
| 220 | + /* #ifndef APP-NVUE */ | |
| 221 | + line-height: $wu-icon-label-line-height; | |
| 222 | + /* #endif */ | |
| 223 | + } | |
| 224 | + } | |
| 225 | +</style> | |
| 0 | 226 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-icon/components/wu-icon/wuicons.ttf
0 → 100644
No preview for this file type
lvdao-miniapp/uni_modules/wu-icon/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "id": "wu-icon", | |
| 3 | + "displayName": "wu-icon 图标 全面兼容小程序、nvue、vue2、vue3等多端", | |
| 4 | + "version": "1.0.4", | |
| 5 | + "description": "基于字体的图标集,包含了大多数常见场景的图标,支持自定义,支持自定义图片图标等。可自定义颜色、大小。", | |
| 6 | + "keywords": [ | |
| 7 | + "wu-ui", | |
| 8 | + "图标", | |
| 9 | + "wu-icon", | |
| 10 | + "文字图标" | |
| 11 | + ], | |
| 12 | + "repository": "", | |
| 13 | + "engines": { | |
| 14 | + "HBuilderX": "^3.4.15" | |
| 15 | + }, | |
| 16 | + "dcloudext": { | |
| 17 | + "type": "component-vue", | |
| 18 | + "sale": { | |
| 19 | + "regular": { | |
| 20 | + "price": "0.00" | |
| 21 | + }, | |
| 22 | + "sourcecode": { | |
| 23 | + "price": "0.00" | |
| 24 | + } | |
| 25 | + }, | |
| 26 | + "contact": { | |
| 27 | + "qq": "" | |
| 28 | + }, | |
| 29 | + "declaration": { | |
| 30 | + "ads": "无", | |
| 31 | + "data": "插件不采集任何数据", | |
| 32 | + "permissions": "无" | |
| 33 | + }, | |
| 34 | + "npmurl": "" | |
| 35 | + }, | |
| 36 | + "uni_modules": { | |
| 37 | + "dependencies": [ | |
| 38 | + "wu-ui-tools" | |
| 39 | + ], | |
| 40 | + "encrypt": [], | |
| 41 | + "platforms": { | |
| 42 | + "cloud": { | |
| 43 | + "tcb": "y", | |
| 44 | + "aliyun": "y", | |
| 45 | + "alipay": "n" | |
| 46 | + }, | |
| 47 | + "client": { | |
| 48 | + "Vue": { | |
| 49 | + "vue2": "y", | |
| 50 | + "vue3": "y" | |
| 51 | + }, | |
| 52 | + "App": { | |
| 53 | + "app-vue": "y", | |
| 54 | + "app-nvue": "y" | |
| 55 | + }, | |
| 56 | + "H5-mobile": { | |
| 57 | + "Safari": "y", | |
| 58 | + "Android Browser": "y", | |
| 59 | + "微信浏览器(Android)": "y", | |
| 60 | + "QQ浏览器(Android)": "y" | |
| 61 | + }, | |
| 62 | + "H5-pc": { | |
| 63 | + "Chrome": "y", | |
| 64 | + "IE": "y", | |
| 65 | + "Edge": "y", | |
| 66 | + "Firefox": "y", | |
| 67 | + "Safari": "y" | |
| 68 | + }, | |
| 69 | + "小程序": { | |
| 70 | + "微信": "y", | |
| 71 | + "阿里": "y", | |
| 72 | + "百度": "y", | |
| 73 | + "字节跳动": "y", | |
| 74 | + "QQ": "y", | |
| 75 | + "钉钉": "u", | |
| 76 | + "快手": "u", | |
| 77 | + "飞书": "u", | |
| 78 | + "京东": "u" | |
| 79 | + }, | |
| 80 | + "快应用": { | |
| 81 | + "华为": "u", | |
| 82 | + "联盟": "u" | |
| 83 | + } | |
| 84 | + } | |
| 85 | + } | |
| 86 | + } | |
| 87 | +} | |
| 0 | 88 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-safe-bottom/components/wu-safe-bottom/props.js
0 → 100644
lvdao-miniapp/uni_modules/wu-safe-bottom/components/wu-safe-bottom/wu-safe-bottom.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view | |
| 3 | + class="wu-safe-bottom" | |
| 4 | + :style="[style]" | |
| 5 | + > | |
| 6 | + </view> | |
| 7 | +</template> | |
| 8 | + | |
| 9 | +<script> | |
| 10 | + import mpMixin from '@/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js'; | |
| 11 | + import mixin from '@/uni_modules/wu-ui-tools/libs/mixin/mixin.js'; | |
| 12 | + import props from './props.js'; | |
| 13 | + /** | |
| 14 | + * SafeBottom 底部安全区 | |
| 15 | + * @description 这个适配,主要是针对IPhone X等一些底部带指示条的机型,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。 | |
| 16 | + * @tutorial https://wuui.cn/zh-CN/components/safeAreaInset.html | |
| 17 | + * @property {type} prop_name | |
| 18 | + * @property {Object} customStyle 定义需要用到的外部样式 | |
| 19 | + * | |
| 20 | + * @event {Function()} | |
| 21 | + * @example <wu-status-bar></wu-status-bar> | |
| 22 | + */ | |
| 23 | + export default { | |
| 24 | + name: "wu-safe-bottom", | |
| 25 | + mixins: [mpMixin, mixin, props], | |
| 26 | + data() { | |
| 27 | + return { | |
| 28 | + safeAreaBottomHeight: 0, | |
| 29 | + isNvue: false, | |
| 30 | + }; | |
| 31 | + }, | |
| 32 | + computed: { | |
| 33 | + style() { | |
| 34 | + const { | |
| 35 | + windowWidth, | |
| 36 | + windowHeight, | |
| 37 | + windowTop, | |
| 38 | + safeArea, | |
| 39 | + screenHeight, | |
| 40 | + safeAreaInsets | |
| 41 | + } = this.$w.sys(); | |
| 42 | + const style = {}; | |
| 43 | + // #ifdef MP-WEIXIN | |
| 44 | + style.height = this.$w.addUnit(screenHeight - safeArea.bottom, 'px'); | |
| 45 | + // #endif | |
| 46 | + // #ifndef MP-WEIXIN | |
| 47 | + style.height = this.$w.addUnit(safeAreaInsets.bottom, 'px'); | |
| 48 | + // #endif | |
| 49 | + return this.$w.deepMerge(style, this.$w.addStyle(this.customStyle)); | |
| 50 | + }, | |
| 51 | + }, | |
| 52 | + }; | |
| 53 | +</script> | |
| 54 | + | |
| 55 | +<style lang="scss" scoped> | |
| 56 | + .wu-safe-bottom { | |
| 57 | + /* #ifndef APP-NVUE */ | |
| 58 | + width: 100%; | |
| 59 | + /* #endif */ | |
| 60 | + } | |
| 61 | +</style> | ... | ... |
lvdao-miniapp/uni_modules/wu-safe-bottom/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "id": "wu-safe-bottom", | |
| 3 | + "displayName": "wu-safe-bottom底部安全区 全端兼容 无论平台 一致体验", | |
| 4 | + "version": "1.0.2", | |
| 5 | + "description": "针对一些底部带指示条的机型,操作区域与页面底部重合,容易误操作,因此本插件对这些机型进行底部安全区适配", | |
| 6 | + "keywords": [ | |
| 7 | + "wu-ui", | |
| 8 | + "wuui", | |
| 9 | + "wu-safe-bottom", | |
| 10 | + "safe-bottom", | |
| 11 | + "底部安全区" | |
| 12 | +], | |
| 13 | + "repository": "", | |
| 14 | + "engines": { | |
| 15 | + "HBuilderX": "^3.4.15" | |
| 16 | + }, | |
| 17 | + "dcloudext": { | |
| 18 | + "type": "component-vue", | |
| 19 | + "sale": { | |
| 20 | + "regular": { | |
| 21 | + "price": "0.00" | |
| 22 | + }, | |
| 23 | + "sourcecode": { | |
| 24 | + "price": "0.00" | |
| 25 | + } | |
| 26 | + }, | |
| 27 | + "contact": { | |
| 28 | + "qq": "" | |
| 29 | + }, | |
| 30 | + "declaration": { | |
| 31 | + "ads": "无", | |
| 32 | + "data": "插件不采集任何数据", | |
| 33 | + "permissions": "无" | |
| 34 | + }, | |
| 35 | + "npmurl": "" | |
| 36 | + }, | |
| 37 | + "uni_modules": { | |
| 38 | + "dependencies": [ | |
| 39 | + "wu-ui-tools" | |
| 40 | + ], | |
| 41 | + "encrypt": [], | |
| 42 | + "platforms": { | |
| 43 | + "cloud": { | |
| 44 | + "tcb": "y", | |
| 45 | + "aliyun": "y", | |
| 46 | + "alipay": "n" | |
| 47 | + }, | |
| 48 | + "client": { | |
| 49 | + "Vue": { | |
| 50 | + "vue2": "y", | |
| 51 | + "vue3": "y" | |
| 52 | + }, | |
| 53 | + "App": { | |
| 54 | + "app-vue": "y", | |
| 55 | + "app-nvue": "y" | |
| 56 | + }, | |
| 57 | + "H5-mobile": { | |
| 58 | + "Safari": "y", | |
| 59 | + "Android Browser": "y", | |
| 60 | + "微信浏览器(Android)": "y", | |
| 61 | + "QQ浏览器(Android)": "y" | |
| 62 | + }, | |
| 63 | + "H5-pc": { | |
| 64 | + "Chrome": "y", | |
| 65 | + "IE": "y", | |
| 66 | + "Edge": "y", | |
| 67 | + "Firefox": "y", | |
| 68 | + "Safari": "y" | |
| 69 | + }, | |
| 70 | + "小程序": { | |
| 71 | + "微信": "y", | |
| 72 | + "阿里": "y", | |
| 73 | + "百度": "y", | |
| 74 | + "字节跳动": "y", | |
| 75 | + "QQ": "y", | |
| 76 | + "钉钉": "n", | |
| 77 | + "快手": "n", | |
| 78 | + "飞书": "n", | |
| 79 | + "京东": "n" | |
| 80 | + }, | |
| 81 | + "快应用": { | |
| 82 | + "华为": "n", | |
| 83 | + "联盟": "n" | |
| 84 | + } | |
| 85 | + } | |
| 86 | + } | |
| 87 | + } | |
| 88 | +} | |
| 0 | 89 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/components/wu-ui-tools/wu-ui-tools.vue
0 → 100644
lvdao-miniapp/uni_modules/wu-ui-tools/index.js
0 → 100644
| 1 | +// 全局挂载引入http相关请求拦截插件 | |
| 2 | +import Request from './libs/luch-request' | |
| 3 | + | |
| 4 | +// 引入全局mixin | |
| 5 | +import mixin from './libs/mixin/mixin.js' | |
| 6 | +// 小程序特有的mixin | |
| 7 | +import mpMixin from './libs/mixin/mpMixin.js' | |
| 8 | +// #ifdef MP | |
| 9 | +import mpShare from './libs/mixin/mpShare.js' | |
| 10 | +// #endif | |
| 11 | + | |
| 12 | +// 路由封装 | |
| 13 | +import route from './libs/util/route.js' | |
| 14 | +// 公共工具函数 | |
| 15 | +import * as index from './libs/function/index.js' | |
| 16 | +// 防抖方法 | |
| 17 | +import debounce from './libs/function/debounce.js' | |
| 18 | +// 节流方法 | |
| 19 | +import throttle from './libs/function/throttle.js' | |
| 20 | +// 规则检验 | |
| 21 | +import * as test from './libs/function/test.js' | |
| 22 | + | |
| 23 | +// 配置信息 | |
| 24 | +import config from './libs/config/config.js' | |
| 25 | +// 平台 | |
| 26 | +import platform from './libs/function/platform' | |
| 27 | + | |
| 28 | +import Color from './libs/function/color/index.js' | |
| 29 | + | |
| 30 | +const $w = { | |
| 31 | + ...index, | |
| 32 | + route, | |
| 33 | + config, | |
| 34 | + test, | |
| 35 | + throttle, | |
| 36 | + date: index.timeFormat, // 另名date | |
| 37 | + Color, | |
| 38 | + http: new Request(), | |
| 39 | + debounce, | |
| 40 | + throttle, | |
| 41 | + platform, | |
| 42 | + mixin, | |
| 43 | + mpMixin | |
| 44 | +} | |
| 45 | +uni.$w = $w; | |
| 46 | +const install = (Vue,options={}) => { | |
| 47 | + // #ifndef APP-NVUE | |
| 48 | + Vue.mixin(mixin); | |
| 49 | + // #ifdef MP | |
| 50 | + if(options.mpShare){ | |
| 51 | + Vue.mixin(mpShare); | |
| 52 | + } | |
| 53 | + // #endif | |
| 54 | + // #endif | |
| 55 | + // #ifdef VUE2 | |
| 56 | + // 时间格式化,同时两个名称,date和timeFormat | |
| 57 | + Vue.filter('timeFormat', (timestamp, format) => uni.$w.timeFormat(timestamp, format)); | |
| 58 | + Vue.filter('date', (timestamp, format) => uni.$w.timeFormat(timestamp, format)); | |
| 59 | + // 将多久以前的方法,注入到全局过滤器 | |
| 60 | + Vue.filter('timeFrom', (timestamp, format) => uni.$w.timeFrom(timestamp, format)); | |
| 61 | + // 同时挂载到uni和Vue.prototype中 | |
| 62 | + // #ifndef APP-NVUE | |
| 63 | + // 只有vue,挂载到Vue.prototype才有意义,因为nvue中全局Vue.prototype和Vue.mixin是无效的 | |
| 64 | + Vue.prototype.$w = $w; | |
| 65 | + // #endif | |
| 66 | + // #endif | |
| 67 | + // #ifdef VUE3 | |
| 68 | + Vue.config.globalProperties.$w = $w; | |
| 69 | + // #endif | |
| 70 | +} | |
| 71 | +export default { | |
| 72 | + install | |
| 73 | +} | |
| 0 | 74 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/index.scss
0 → 100644
lvdao-miniapp/uni_modules/wu-ui-tools/libs/config/config.js
0 → 100644
| 1 | +// 此版本发布于2023-09-13 | |
| 2 | +const version = '1.0.9' | |
| 3 | + | |
| 4 | +// 开发环境才提示,生产环境不会提示 | |
| 5 | +if (process.env.NODE_ENV === 'development') { | |
| 6 | + console.log(`\n %c wuui V${version} https://wuui.geeks.ink/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;'); | |
| 7 | +} | |
| 8 | + | |
| 9 | +export default { | |
| 10 | + v: version, | |
| 11 | + version, | |
| 12 | + // 主题名称 | |
| 13 | + type: [ | |
| 14 | + 'primary', | |
| 15 | + 'success', | |
| 16 | + 'info', | |
| 17 | + 'error', | |
| 18 | + 'warning' | |
| 19 | + ], | |
| 20 | + // 颜色部分,本来可以通过scss的:export导出供js使用,但是奈何nvue不支持 | |
| 21 | + color: { | |
| 22 | + 'wu-primary': '#2979ff', | |
| 23 | + 'wu-warning': '#ff9900', | |
| 24 | + 'wu-success': '#19be6b', | |
| 25 | + 'wu-error': '#fa3534', | |
| 26 | + 'wu-info': '#909399', | |
| 27 | + 'wu-main-color': '#303133', | |
| 28 | + 'wu-content-color': '#606266', | |
| 29 | + 'wu-tips-color': '#909399', | |
| 30 | + 'wu-light-color': '#c0c4cc' | |
| 31 | + }, | |
| 32 | + // 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx | |
| 33 | + unit: 'px' | |
| 34 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/css/color.scss
0 → 100644
| 1 | +$wu-main-color: #303133 !default; | |
| 2 | +$wu-content-color: #606266 !default; | |
| 3 | +$wu-tips-color: #909193 !default; | |
| 4 | +$wu-light-color: #c0c4cc !default; | |
| 5 | +$wu-border-color: #dadbde !default; | |
| 6 | +$wu-bg-color: #f3f4f6 !default; | |
| 7 | +$wu-disabled-color: #c8c9cc !default; | |
| 8 | + | |
| 9 | +$wu-primary: #3c9cff !default; | |
| 10 | +$wu-primary-dark: #398ade !default; | |
| 11 | +$wu-primary-disabled: #9acafc !default; | |
| 12 | +$wu-primary-light: #ecf5ff !default; | |
| 13 | + | |
| 14 | +$wu-warning: #f9ae3d !default; | |
| 15 | +$wu-warning-dark: #f1a532 !default; | |
| 16 | +$wu-warning-disabled: #f9d39b !default; | |
| 17 | +$wu-warning-light: #fdf6ec !default; | |
| 18 | + | |
| 19 | +$wu-success: #5ac725 !default; | |
| 20 | +$wu-success-dark: #53c21d !default; | |
| 21 | +$wu-success-disabled: #a9e08f !default; | |
| 22 | +$wu-success-light: #f5fff0; | |
| 23 | + | |
| 24 | +$wu-error: #f56c6c !default; | |
| 25 | +$wu-error-dark: #e45656 !default; | |
| 26 | +$wu-error-disabled: #f7b2b2 !default; | |
| 27 | +$wu-error-light: #fef0f0 !default; | |
| 28 | + | |
| 29 | +$wu-info: #909399 !default; | |
| 30 | +$wu-info-dark: #767a82 !default; | |
| 31 | +$wu-info-disabled: #c4c6c9 !default; | |
| 32 | +$wu-info-light: #f4f4f5 !default; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/css/common.scss
0 → 100644
| 1 | +// 超出行数,自动显示行尾省略号,最多5行 | |
| 2 | +// 来自wuui的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】 | |
| 3 | +@for $i from 1 through 5 { | |
| 4 | + .wu-line-#{$i} { | |
| 5 | + /* #ifdef APP-NVUE */ | |
| 6 | + // nvue下,可以直接使用lines属性,这是weex特有样式 | |
| 7 | + lines: $i; | |
| 8 | + text-overflow: ellipsis; | |
| 9 | + overflow: hidden; | |
| 10 | + flex: 1; | |
| 11 | + /* #endif */ | |
| 12 | + | |
| 13 | + /* #ifndef APP-NVUE */ | |
| 14 | + // vue下,单行和多行显示省略号需要单独处理 | |
| 15 | + @if $i == '1' { | |
| 16 | + overflow: hidden; | |
| 17 | + white-space: nowrap; | |
| 18 | + text-overflow: ellipsis; | |
| 19 | + } @else { | |
| 20 | + display: -webkit-box!important; | |
| 21 | + overflow: hidden; | |
| 22 | + text-overflow: ellipsis; | |
| 23 | + word-break: break-all; | |
| 24 | + -webkit-line-clamp: $i; | |
| 25 | + -webkit-box-orient: vertical!important; | |
| 26 | + } | |
| 27 | + /* #endif */ | |
| 28 | + } | |
| 29 | +} | |
| 30 | +$wu-bordercolor: #dadbde; | |
| 31 | +@if variable-exists(wu-border-color) { | |
| 32 | + $wu-bordercolor: $wu-border-color; | |
| 33 | +} | |
| 34 | + | |
| 35 | +// 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时, | |
| 36 | +// App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效 | |
| 37 | +// 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important | |
| 38 | +// 移动端兼容性较好,直接使用0.5px去实现细边框,不使用伪元素形式实现 | |
| 39 | +.wu-border { | |
| 40 | + border-width: 0.5px!important; | |
| 41 | + border-color: $wu-bordercolor!important; | |
| 42 | + border-style: solid; | |
| 43 | +} | |
| 44 | + | |
| 45 | +.wu-border-top { | |
| 46 | + border-top-width: 0.5px!important; | |
| 47 | + border-color: $wu-bordercolor!important; | |
| 48 | + border-top-style: solid; | |
| 49 | +} | |
| 50 | + | |
| 51 | +.wu-border-left { | |
| 52 | + border-left-width: 0.5px!important; | |
| 53 | + border-color: $wu-bordercolor!important; | |
| 54 | + border-left-style: solid; | |
| 55 | +} | |
| 56 | + | |
| 57 | +.wu-border-right { | |
| 58 | + border-right-width: 0.5px!important; | |
| 59 | + border-color: $wu-bordercolor!important; | |
| 60 | + border-right-style: solid; | |
| 61 | +} | |
| 62 | + | |
| 63 | +.wu-border-bottom { | |
| 64 | + border-bottom-width: 0.5px!important; | |
| 65 | + border-color: $wu-bordercolor!important; | |
| 66 | + border-bottom-style: solid; | |
| 67 | +} | |
| 68 | + | |
| 69 | +.wu-border-top-bottom { | |
| 70 | + border-top-width: 0.5px!important; | |
| 71 | + border-bottom-width: 0.5px!important; | |
| 72 | + border-color: $wu-bordercolor!important; | |
| 73 | + border-top-style: solid; | |
| 74 | + border-bottom-style: solid; | |
| 75 | +} | |
| 76 | + | |
| 77 | +// 去除button的所有默认样式,让其表现跟普通的view、text元素一样 | |
| 78 | +.wu-reset-button { | |
| 79 | + padding: 0; | |
| 80 | + background-color: transparent; | |
| 81 | + /* #ifndef APP-PLUS */ | |
| 82 | + font-size: inherit; | |
| 83 | + line-height: inherit; | |
| 84 | + color: inherit; | |
| 85 | + /* #endif */ | |
| 86 | + /* #ifdef APP-NVUE */ | |
| 87 | + border-width: 0; | |
| 88 | + /* #endif */ | |
| 89 | +} | |
| 90 | + | |
| 91 | +/* #ifndef APP-NVUE */ | |
| 92 | +.wu-reset-button::after { | |
| 93 | + border: none; | |
| 94 | +} | |
| 95 | +/* #endif */ | |
| 96 | + | |
| 97 | +.wu-hover-class { | |
| 98 | + opacity: 0.7; | |
| 99 | +} | |
| 100 | + | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/css/components.scss
0 → 100644
| 1 | +@mixin flex($direction: row) { | |
| 2 | + /* #ifndef APP-NVUE */ | |
| 3 | + display: flex; | |
| 4 | + /* #endif */ | |
| 5 | + flex-direction: $direction; | |
| 6 | +} | |
| 7 | + | |
| 8 | +/* #ifndef APP-NVUE */ | |
| 9 | +// 由于wuui是基于nvue环境进行开发的,此环境中普通元素默认为flex-direction: column; | |
| 10 | +// 所以在非nvue中,需要对元素进行重置为flex-direction: column; 否则可能会表现异常 | |
| 11 | +$wuui-nvue-style: true !default; | |
| 12 | +@if $wuui-nvue-style == true { | |
| 13 | + view, scroll-view, swiper-item { | |
| 14 | + display: flex; | |
| 15 | + flex-direction: column; | |
| 16 | + flex-shrink: 0; | |
| 17 | + flex-grow: 0; | |
| 18 | + flex-basis: auto; | |
| 19 | + align-items: stretch; | |
| 20 | + align-content: flex-start; | |
| 21 | + } | |
| 22 | +} | |
| 23 | +/* #endif */ | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/css/variable.scss
0 → 100644
| 1 | +// 超出行数,自动显示行尾省略号,最多5行 | |
| 2 | +// 来自uvui的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】 | |
| 3 | +@if variable-exists(show-lines) { | |
| 4 | + @for $i from 1 through 5 { | |
| 5 | + .wu-line-#{$i} { | |
| 6 | + /* #ifdef APP-NVUE */ | |
| 7 | + // nvue下,可以直接使用lines属性,这是weex特有样式 | |
| 8 | + lines: $i; | |
| 9 | + text-overflow: ellipsis; | |
| 10 | + overflow: hidden; | |
| 11 | + flex: 1; | |
| 12 | + /* #endif */ | |
| 13 | + | |
| 14 | + /* #ifndef APP-NVUE */ | |
| 15 | + // vue下,单行和多行显示省略号需要单独处理 | |
| 16 | + @if $i == '1' { | |
| 17 | + overflow: hidden; | |
| 18 | + white-space: nowrap; | |
| 19 | + text-overflow: ellipsis; | |
| 20 | + } @else { | |
| 21 | + display: -webkit-box!important; | |
| 22 | + overflow: hidden; | |
| 23 | + text-overflow: ellipsis; | |
| 24 | + word-break: break-all; | |
| 25 | + -webkit-line-clamp: $i; | |
| 26 | + -webkit-box-orient: vertical!important; | |
| 27 | + } | |
| 28 | + /* #endif */ | |
| 29 | + } | |
| 30 | + } | |
| 31 | +} | |
| 32 | +@if variable-exists(show-border) { | |
| 33 | + $wu-bordercolor: #dadbde; | |
| 34 | + @if variable-exists(wu-border-color) { | |
| 35 | + $wu-bordercolor: $wu-border-color; | |
| 36 | + } | |
| 37 | + // 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时, | |
| 38 | + // App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效 | |
| 39 | + // 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important | |
| 40 | + // 移动端兼容性较好,直接使用0.5px去实现细边框,不使用伪元素形式实现 | |
| 41 | + @if variable-exists(show-border-surround) { | |
| 42 | + .wu-border { | |
| 43 | + border-width: 0.5px!important; | |
| 44 | + border-color: $wu-bordercolor!important; | |
| 45 | + border-style: solid; | |
| 46 | + } | |
| 47 | + } | |
| 48 | + @if variable-exists(show-border-top) { | |
| 49 | + .wu-border-top { | |
| 50 | + border-top-width: 0.5px!important; | |
| 51 | + border-color: $wu-bordercolor!important; | |
| 52 | + border-top-style: solid; | |
| 53 | + } | |
| 54 | + } | |
| 55 | + @if variable-exists(show-border-left) { | |
| 56 | + .wu-border-left { | |
| 57 | + border-left-width: 0.5px!important; | |
| 58 | + border-color: $wu-bordercolor!important; | |
| 59 | + border-left-style: solid; | |
| 60 | + } | |
| 61 | + } | |
| 62 | + @if variable-exists(show-border-right) { | |
| 63 | + .wu-border-right { | |
| 64 | + border-right-width: 0.5px!important; | |
| 65 | + border-color: $wu-bordercolor!important; | |
| 66 | + border-right-style: solid; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + @if variable-exists(show-border-bottom) { | |
| 70 | + .wu-border-bottom { | |
| 71 | + border-bottom-width: 0.5px!important; | |
| 72 | + border-color: $wu-bordercolor!important; | |
| 73 | + border-bottom-style: solid; | |
| 74 | + } | |
| 75 | + } | |
| 76 | + @if variable-exists(show-border-top-bottom) { | |
| 77 | + .wu-border-top-bottom { | |
| 78 | + border-top-width: 0.5px!important; | |
| 79 | + border-bottom-width: 0.5px!important; | |
| 80 | + border-color: $wu-bordercolor!important; | |
| 81 | + border-top-style: solid; | |
| 82 | + border-bottom-style: solid; | |
| 83 | + } | |
| 84 | + } | |
| 85 | +} | |
| 86 | +@if variable-exists(show-reset-button) { | |
| 87 | + // 去除button的所有默认样式,让其表现跟普通的view、text元素一样 | |
| 88 | + .wu-reset-button { | |
| 89 | + padding: 0; | |
| 90 | + background-color: transparent; | |
| 91 | + /* #ifndef APP-PLUS */ | |
| 92 | + font-size: inherit; | |
| 93 | + line-height: inherit; | |
| 94 | + color: inherit; | |
| 95 | + /* #endif */ | |
| 96 | + /* #ifdef APP-NVUE */ | |
| 97 | + border-width: 0; | |
| 98 | + /* #endif */ | |
| 99 | + } | |
| 100 | + | |
| 101 | + /* #ifndef APP-NVUE */ | |
| 102 | + .wu-reset-button::after { | |
| 103 | + border: none; | |
| 104 | + } | |
| 105 | + /* #endif */ | |
| 106 | +} | |
| 107 | +@if variable-exists(show-hover) { | |
| 108 | + .wu-hover-class { | |
| 109 | + opacity: 0.7; | |
| 110 | + } | |
| 111 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/css/vue.scss
0 → 100644
| 1 | +// 历遍生成4个方向的底部安全区 | |
| 2 | +@each $d in top, right, bottom, left { | |
| 3 | + .wu-safe-area-inset-#{$d} { | |
| 4 | + padding-#{$d}: 0; | |
| 5 | + padding-#{$d}: constant(safe-area-inset-#{$d}); | |
| 6 | + padding-#{$d}: env(safe-area-inset-#{$d}); | |
| 7 | + } | |
| 8 | +} | |
| 9 | + | |
| 10 | +//提升H5端uni.toast()的层级,避免被wuui的modal等遮盖 | |
| 11 | +/* #ifdef H5 */ | |
| 12 | +uni-toast { | |
| 13 | + z-index: 10090; | |
| 14 | +} | |
| 15 | +uni-toast .uni-toast { | |
| 16 | + z-index: 10090; | |
| 17 | +} | |
| 18 | +/* #endif */ | |
| 19 | + | |
| 20 | +// 隐藏scroll-view的滚动条 | |
| 21 | +::-webkit-scrollbar { | |
| 22 | + display: none; | |
| 23 | + width: 0 !important; | |
| 24 | + height: 0 !important; | |
| 25 | + -webkit-appearance: none; | |
| 26 | + background: transparent; | |
| 27 | +} | |
| 28 | + | |
| 29 | +$wuui-nvue-style: true !default; | |
| 30 | +@if $wuui-nvue-style == false { | |
| 31 | + view, scroll-view, swiper-item { | |
| 32 | + display: flex; | |
| 33 | + flex-direction: column; | |
| 34 | + flex-shrink: 0; | |
| 35 | + flex-grow: 0; | |
| 36 | + flex-basis: auto; | |
| 37 | + align-items: stretch; | |
| 38 | + align-content: flex-start; | |
| 39 | + } | |
| 40 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-convert/LICENSE
0 → 100644
| 1 | +Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com> | |
| 2 | + | |
| 3 | +Permission is hereby granted, free of charge, to any person obtaining | |
| 4 | +a copy of this software and associated documentation files (the | |
| 5 | +"Software"), to deal in the Software without restriction, including | |
| 6 | +without limitation the rights to use, copy, modify, merge, publish, | |
| 7 | +distribute, sublicense, and/or sell copies of the Software, and to | |
| 8 | +permit persons to whom the Software is furnished to do so, subject to | |
| 9 | +the following conditions: | |
| 10 | + | |
| 11 | +The above copyright notice and this permission notice shall be | |
| 12 | +included in all copies or substantial portions of the Software. | |
| 13 | + | |
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 15 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 16 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 17 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 18 | +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 19 | +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 20 | +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-convert/conversions.js
0 → 100644
| 1 | +/* MIT license */ | |
| 2 | +/* eslint-disable no-mixed-operators */ | |
| 3 | +import cssKeywords from '../color-name'; | |
| 4 | + | |
| 5 | +// NOTE: conversions should only return primitive values (i.e. arrays, or | |
| 6 | +// values that give correct `typeof` results). | |
| 7 | +// do not use box values types (i.e. Number(), String(), etc.) | |
| 8 | + | |
| 9 | +const reverseKeywords = {}; | |
| 10 | +for (const key of Object.keys(cssKeywords)) { | |
| 11 | + reverseKeywords[cssKeywords[key]] = key; | |
| 12 | +} | |
| 13 | + | |
| 14 | +const convert = { | |
| 15 | + rgb: {channels: 3, labels: 'rgb'}, | |
| 16 | + hsl: {channels: 3, labels: 'hsl'}, | |
| 17 | + hsv: {channels: 3, labels: 'hsv'}, | |
| 18 | + hwb: {channels: 3, labels: 'hwb'}, | |
| 19 | + cmyk: {channels: 4, labels: 'cmyk'}, | |
| 20 | + xyz: {channels: 3, labels: 'xyz'}, | |
| 21 | + lab: {channels: 3, labels: 'lab'}, | |
| 22 | + lch: {channels: 3, labels: 'lch'}, | |
| 23 | + hex: {channels: 1, labels: ['hex']}, | |
| 24 | + keyword: {channels: 1, labels: ['keyword']}, | |
| 25 | + ansi16: {channels: 1, labels: ['ansi16']}, | |
| 26 | + ansi256: {channels: 1, labels: ['ansi256']}, | |
| 27 | + hcg: {channels: 3, labels: ['h', 'c', 'g']}, | |
| 28 | + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, | |
| 29 | + gray: {channels: 1, labels: ['gray']} | |
| 30 | +}; | |
| 31 | + | |
| 32 | +export default convert; | |
| 33 | + | |
| 34 | +// Hide .channels and .labels properties | |
| 35 | +for (const model of Object.keys(convert)) { | |
| 36 | + if (!('channels' in convert[model])) { | |
| 37 | + throw new Error('missing channels property: ' + model); | |
| 38 | + } | |
| 39 | + | |
| 40 | + if (!('labels' in convert[model])) { | |
| 41 | + throw new Error('missing channel labels property: ' + model); | |
| 42 | + } | |
| 43 | + | |
| 44 | + if (convert[model].labels.length !== convert[model].channels) { | |
| 45 | + throw new Error('channel and label counts mismatch: ' + model); | |
| 46 | + } | |
| 47 | + | |
| 48 | + const {channels, labels} = convert[model]; | |
| 49 | + delete convert[model].channels; | |
| 50 | + delete convert[model].labels; | |
| 51 | + Object.defineProperty(convert[model], 'channels', {value: channels}); | |
| 52 | + Object.defineProperty(convert[model], 'labels', {value: labels}); | |
| 53 | +} | |
| 54 | + | |
| 55 | +convert.rgb.hsl = function (rgb) { | |
| 56 | + const r = rgb[0] / 255; | |
| 57 | + const g = rgb[1] / 255; | |
| 58 | + const b = rgb[2] / 255; | |
| 59 | + const min = Math.min(r, g, b); | |
| 60 | + const max = Math.max(r, g, b); | |
| 61 | + const delta = max - min; | |
| 62 | + let h; | |
| 63 | + let s; | |
| 64 | + | |
| 65 | + if (max === min) { | |
| 66 | + h = 0; | |
| 67 | + } else if (r === max) { | |
| 68 | + h = (g - b) / delta; | |
| 69 | + } else if (g === max) { | |
| 70 | + h = 2 + (b - r) / delta; | |
| 71 | + } else if (b === max) { | |
| 72 | + h = 4 + (r - g) / delta; | |
| 73 | + } | |
| 74 | + | |
| 75 | + h = Math.min(h * 60, 360); | |
| 76 | + | |
| 77 | + if (h < 0) { | |
| 78 | + h += 360; | |
| 79 | + } | |
| 80 | + | |
| 81 | + const l = (min + max) / 2; | |
| 82 | + | |
| 83 | + if (max === min) { | |
| 84 | + s = 0; | |
| 85 | + } else if (l <= 0.5) { | |
| 86 | + s = delta / (max + min); | |
| 87 | + } else { | |
| 88 | + s = delta / (2 - max - min); | |
| 89 | + } | |
| 90 | + | |
| 91 | + return [h, s * 100, l * 100]; | |
| 92 | +}; | |
| 93 | + | |
| 94 | +convert.rgb.hsv = function (rgb) { | |
| 95 | + let rdif; | |
| 96 | + let gdif; | |
| 97 | + let bdif; | |
| 98 | + let h; | |
| 99 | + let s; | |
| 100 | + | |
| 101 | + const r = rgb[0] / 255; | |
| 102 | + const g = rgb[1] / 255; | |
| 103 | + const b = rgb[2] / 255; | |
| 104 | + const v = Math.max(r, g, b); | |
| 105 | + const diff = v - Math.min(r, g, b); | |
| 106 | + const diffc = function (c) { | |
| 107 | + return (v - c) / 6 / diff + 1 / 2; | |
| 108 | + }; | |
| 109 | + | |
| 110 | + if (diff === 0) { | |
| 111 | + h = 0; | |
| 112 | + s = 0; | |
| 113 | + } else { | |
| 114 | + s = diff / v; | |
| 115 | + rdif = diffc(r); | |
| 116 | + gdif = diffc(g); | |
| 117 | + bdif = diffc(b); | |
| 118 | + | |
| 119 | + if (r === v) { | |
| 120 | + h = bdif - gdif; | |
| 121 | + } else if (g === v) { | |
| 122 | + h = (1 / 3) + rdif - bdif; | |
| 123 | + } else if (b === v) { | |
| 124 | + h = (2 / 3) + gdif - rdif; | |
| 125 | + } | |
| 126 | + | |
| 127 | + if (h < 0) { | |
| 128 | + h += 1; | |
| 129 | + } else if (h > 1) { | |
| 130 | + h -= 1; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + return [ | |
| 135 | + h * 360, | |
| 136 | + s * 100, | |
| 137 | + v * 100 | |
| 138 | + ]; | |
| 139 | +}; | |
| 140 | + | |
| 141 | +convert.rgb.hwb = function (rgb) { | |
| 142 | + const r = rgb[0]; | |
| 143 | + const g = rgb[1]; | |
| 144 | + let b = rgb[2]; | |
| 145 | + const h = convert.rgb.hsl(rgb)[0]; | |
| 146 | + const w = 1 / 255 * Math.min(r, Math.min(g, b)); | |
| 147 | + | |
| 148 | + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); | |
| 149 | + | |
| 150 | + return [h, w * 100, b * 100]; | |
| 151 | +}; | |
| 152 | + | |
| 153 | +convert.rgb.cmyk = function (rgb) { | |
| 154 | + const r = rgb[0] / 255; | |
| 155 | + const g = rgb[1] / 255; | |
| 156 | + const b = rgb[2] / 255; | |
| 157 | + | |
| 158 | + const k = Math.min(1 - r, 1 - g, 1 - b); | |
| 159 | + const c = (1 - r - k) / (1 - k) || 0; | |
| 160 | + const m = (1 - g - k) / (1 - k) || 0; | |
| 161 | + const y = (1 - b - k) / (1 - k) || 0; | |
| 162 | + | |
| 163 | + return [c * 100, m * 100, y * 100, k * 100]; | |
| 164 | +}; | |
| 165 | + | |
| 166 | +function comparativeDistance(x, y) { | |
| 167 | + /* | |
| 168 | + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | |
| 169 | + */ | |
| 170 | + return ( | |
| 171 | + ((x[0] - y[0]) ** 2) + | |
| 172 | + ((x[1] - y[1]) ** 2) + | |
| 173 | + ((x[2] - y[2]) ** 2) | |
| 174 | + ); | |
| 175 | +} | |
| 176 | + | |
| 177 | +convert.rgb.keyword = function (rgb) { | |
| 178 | + const reversed = reverseKeywords[rgb]; | |
| 179 | + if (reversed) { | |
| 180 | + return reversed; | |
| 181 | + } | |
| 182 | + | |
| 183 | + let currentClosestDistance = Infinity; | |
| 184 | + let currentClosestKeyword; | |
| 185 | + | |
| 186 | + for (const keyword of Object.keys(cssKeywords)) { | |
| 187 | + const value = cssKeywords[keyword]; | |
| 188 | + | |
| 189 | + // Compute comparative distance | |
| 190 | + const distance = comparativeDistance(rgb, value); | |
| 191 | + | |
| 192 | + // Check if its less, if so set as closest | |
| 193 | + if (distance < currentClosestDistance) { | |
| 194 | + currentClosestDistance = distance; | |
| 195 | + currentClosestKeyword = keyword; | |
| 196 | + } | |
| 197 | + } | |
| 198 | + | |
| 199 | + return currentClosestKeyword; | |
| 200 | +}; | |
| 201 | + | |
| 202 | +convert.keyword.rgb = function (keyword) { | |
| 203 | + return cssKeywords[keyword]; | |
| 204 | +}; | |
| 205 | + | |
| 206 | +convert.rgb.xyz = function (rgb) { | |
| 207 | + let r = rgb[0] / 255; | |
| 208 | + let g = rgb[1] / 255; | |
| 209 | + let b = rgb[2] / 255; | |
| 210 | + | |
| 211 | + // Assume sRGB | |
| 212 | + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); | |
| 213 | + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); | |
| 214 | + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); | |
| 215 | + | |
| 216 | + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); | |
| 217 | + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); | |
| 218 | + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); | |
| 219 | + | |
| 220 | + return [x * 100, y * 100, z * 100]; | |
| 221 | +}; | |
| 222 | + | |
| 223 | +convert.rgb.lab = function (rgb) { | |
| 224 | + const xyz = convert.rgb.xyz(rgb); | |
| 225 | + let x = xyz[0]; | |
| 226 | + let y = xyz[1]; | |
| 227 | + let z = xyz[2]; | |
| 228 | + | |
| 229 | + x /= 95.047; | |
| 230 | + y /= 100; | |
| 231 | + z /= 108.883; | |
| 232 | + | |
| 233 | + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); | |
| 234 | + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); | |
| 235 | + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); | |
| 236 | + | |
| 237 | + const l = (116 * y) - 16; | |
| 238 | + const a = 500 * (x - y); | |
| 239 | + const b = 200 * (y - z); | |
| 240 | + | |
| 241 | + return [l, a, b]; | |
| 242 | +}; | |
| 243 | + | |
| 244 | +convert.hsl.rgb = function (hsl) { | |
| 245 | + const h = hsl[0] / 360; | |
| 246 | + const s = hsl[1] / 100; | |
| 247 | + const l = hsl[2] / 100; | |
| 248 | + let t2; | |
| 249 | + let t3; | |
| 250 | + let val; | |
| 251 | + | |
| 252 | + if (s === 0) { | |
| 253 | + val = l * 255; | |
| 254 | + return [val, val, val]; | |
| 255 | + } | |
| 256 | + | |
| 257 | + if (l < 0.5) { | |
| 258 | + t2 = l * (1 + s); | |
| 259 | + } else { | |
| 260 | + t2 = l + s - l * s; | |
| 261 | + } | |
| 262 | + | |
| 263 | + const t1 = 2 * l - t2; | |
| 264 | + | |
| 265 | + const rgb = [0, 0, 0]; | |
| 266 | + for (let i = 0; i < 3; i++) { | |
| 267 | + t3 = h + 1 / 3 * -(i - 1); | |
| 268 | + if (t3 < 0) { | |
| 269 | + t3++; | |
| 270 | + } | |
| 271 | + | |
| 272 | + if (t3 > 1) { | |
| 273 | + t3--; | |
| 274 | + } | |
| 275 | + | |
| 276 | + if (6 * t3 < 1) { | |
| 277 | + val = t1 + (t2 - t1) * 6 * t3; | |
| 278 | + } else if (2 * t3 < 1) { | |
| 279 | + val = t2; | |
| 280 | + } else if (3 * t3 < 2) { | |
| 281 | + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; | |
| 282 | + } else { | |
| 283 | + val = t1; | |
| 284 | + } | |
| 285 | + | |
| 286 | + rgb[i] = val * 255; | |
| 287 | + } | |
| 288 | + | |
| 289 | + return rgb; | |
| 290 | +}; | |
| 291 | + | |
| 292 | +convert.hsl.hsv = function (hsl) { | |
| 293 | + const h = hsl[0]; | |
| 294 | + let s = hsl[1] / 100; | |
| 295 | + let l = hsl[2] / 100; | |
| 296 | + let smin = s; | |
| 297 | + const lmin = Math.max(l, 0.01); | |
| 298 | + | |
| 299 | + l *= 2; | |
| 300 | + s *= (l <= 1) ? l : 2 - l; | |
| 301 | + smin *= lmin <= 1 ? lmin : 2 - lmin; | |
| 302 | + const v = (l + s) / 2; | |
| 303 | + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); | |
| 304 | + | |
| 305 | + return [h, sv * 100, v * 100]; | |
| 306 | +}; | |
| 307 | + | |
| 308 | +convert.hsv.rgb = function (hsv) { | |
| 309 | + const h = hsv[0] / 60; | |
| 310 | + const s = hsv[1] / 100; | |
| 311 | + let v = hsv[2] / 100; | |
| 312 | + const hi = Math.floor(h) % 6; | |
| 313 | + | |
| 314 | + const f = h - Math.floor(h); | |
| 315 | + const p = 255 * v * (1 - s); | |
| 316 | + const q = 255 * v * (1 - (s * f)); | |
| 317 | + const t = 255 * v * (1 - (s * (1 - f))); | |
| 318 | + v *= 255; | |
| 319 | + | |
| 320 | + switch (hi) { | |
| 321 | + case 0: | |
| 322 | + return [v, t, p]; | |
| 323 | + case 1: | |
| 324 | + return [q, v, p]; | |
| 325 | + case 2: | |
| 326 | + return [p, v, t]; | |
| 327 | + case 3: | |
| 328 | + return [p, q, v]; | |
| 329 | + case 4: | |
| 330 | + return [t, p, v]; | |
| 331 | + case 5: | |
| 332 | + return [v, p, q]; | |
| 333 | + } | |
| 334 | +}; | |
| 335 | + | |
| 336 | +convert.hsv.hsl = function (hsv) { | |
| 337 | + const h = hsv[0]; | |
| 338 | + const s = hsv[1] / 100; | |
| 339 | + const v = hsv[2] / 100; | |
| 340 | + const vmin = Math.max(v, 0.01); | |
| 341 | + let sl; | |
| 342 | + let l; | |
| 343 | + | |
| 344 | + l = (2 - s) * v; | |
| 345 | + const lmin = (2 - s) * vmin; | |
| 346 | + sl = s * vmin; | |
| 347 | + sl /= (lmin <= 1) ? lmin : 2 - lmin; | |
| 348 | + sl = sl || 0; | |
| 349 | + l /= 2; | |
| 350 | + | |
| 351 | + return [h, sl * 100, l * 100]; | |
| 352 | +}; | |
| 353 | + | |
| 354 | +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb | |
| 355 | +convert.hwb.rgb = function (hwb) { | |
| 356 | + const h = hwb[0] / 360; | |
| 357 | + let wh = hwb[1] / 100; | |
| 358 | + let bl = hwb[2] / 100; | |
| 359 | + const ratio = wh + bl; | |
| 360 | + let f; | |
| 361 | + | |
| 362 | + // Wh + bl cant be > 1 | |
| 363 | + if (ratio > 1) { | |
| 364 | + wh /= ratio; | |
| 365 | + bl /= ratio; | |
| 366 | + } | |
| 367 | + | |
| 368 | + const i = Math.floor(6 * h); | |
| 369 | + const v = 1 - bl; | |
| 370 | + f = 6 * h - i; | |
| 371 | + | |
| 372 | + if ((i & 0x01) !== 0) { | |
| 373 | + f = 1 - f; | |
| 374 | + } | |
| 375 | + | |
| 376 | + const n = wh + f * (v - wh); // Linear interpolation | |
| 377 | + | |
| 378 | + let r; | |
| 379 | + let g; | |
| 380 | + let b; | |
| 381 | + /* eslint-disable max-statements-per-line,no-multi-spaces */ | |
| 382 | + switch (i) { | |
| 383 | + default: | |
| 384 | + case 6: | |
| 385 | + case 0: r = v; g = n; b = wh; break; | |
| 386 | + case 1: r = n; g = v; b = wh; break; | |
| 387 | + case 2: r = wh; g = v; b = n; break; | |
| 388 | + case 3: r = wh; g = n; b = v; break; | |
| 389 | + case 4: r = n; g = wh; b = v; break; | |
| 390 | + case 5: r = v; g = wh; b = n; break; | |
| 391 | + } | |
| 392 | + /* eslint-enable max-statements-per-line,no-multi-spaces */ | |
| 393 | + | |
| 394 | + return [r * 255, g * 255, b * 255]; | |
| 395 | +}; | |
| 396 | + | |
| 397 | +convert.cmyk.rgb = function (cmyk) { | |
| 398 | + const c = cmyk[0] / 100; | |
| 399 | + const m = cmyk[1] / 100; | |
| 400 | + const y = cmyk[2] / 100; | |
| 401 | + const k = cmyk[3] / 100; | |
| 402 | + | |
| 403 | + const r = 1 - Math.min(1, c * (1 - k) + k); | |
| 404 | + const g = 1 - Math.min(1, m * (1 - k) + k); | |
| 405 | + const b = 1 - Math.min(1, y * (1 - k) + k); | |
| 406 | + | |
| 407 | + return [r * 255, g * 255, b * 255]; | |
| 408 | +}; | |
| 409 | + | |
| 410 | +convert.xyz.rgb = function (xyz) { | |
| 411 | + const x = xyz[0] / 100; | |
| 412 | + const y = xyz[1] / 100; | |
| 413 | + const z = xyz[2] / 100; | |
| 414 | + let r; | |
| 415 | + let g; | |
| 416 | + let b; | |
| 417 | + | |
| 418 | + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); | |
| 419 | + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); | |
| 420 | + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); | |
| 421 | + | |
| 422 | + // Assume sRGB | |
| 423 | + r = r > 0.0031308 | |
| 424 | + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) | |
| 425 | + : r * 12.92; | |
| 426 | + | |
| 427 | + g = g > 0.0031308 | |
| 428 | + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) | |
| 429 | + : g * 12.92; | |
| 430 | + | |
| 431 | + b = b > 0.0031308 | |
| 432 | + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) | |
| 433 | + : b * 12.92; | |
| 434 | + | |
| 435 | + r = Math.min(Math.max(0, r), 1); | |
| 436 | + g = Math.min(Math.max(0, g), 1); | |
| 437 | + b = Math.min(Math.max(0, b), 1); | |
| 438 | + | |
| 439 | + return [r * 255, g * 255, b * 255]; | |
| 440 | +}; | |
| 441 | + | |
| 442 | +convert.xyz.lab = function (xyz) { | |
| 443 | + let x = xyz[0]; | |
| 444 | + let y = xyz[1]; | |
| 445 | + let z = xyz[2]; | |
| 446 | + | |
| 447 | + x /= 95.047; | |
| 448 | + y /= 100; | |
| 449 | + z /= 108.883; | |
| 450 | + | |
| 451 | + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); | |
| 452 | + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); | |
| 453 | + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); | |
| 454 | + | |
| 455 | + const l = (116 * y) - 16; | |
| 456 | + const a = 500 * (x - y); | |
| 457 | + const b = 200 * (y - z); | |
| 458 | + | |
| 459 | + return [l, a, b]; | |
| 460 | +}; | |
| 461 | + | |
| 462 | +convert.lab.xyz = function (lab) { | |
| 463 | + const l = lab[0]; | |
| 464 | + const a = lab[1]; | |
| 465 | + const b = lab[2]; | |
| 466 | + let x; | |
| 467 | + let y; | |
| 468 | + let z; | |
| 469 | + | |
| 470 | + y = (l + 16) / 116; | |
| 471 | + x = a / 500 + y; | |
| 472 | + z = y - b / 200; | |
| 473 | + | |
| 474 | + const y2 = y ** 3; | |
| 475 | + const x2 = x ** 3; | |
| 476 | + const z2 = z ** 3; | |
| 477 | + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; | |
| 478 | + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; | |
| 479 | + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; | |
| 480 | + | |
| 481 | + x *= 95.047; | |
| 482 | + y *= 100; | |
| 483 | + z *= 108.883; | |
| 484 | + | |
| 485 | + return [x, y, z]; | |
| 486 | +}; | |
| 487 | + | |
| 488 | +convert.lab.lch = function (lab) { | |
| 489 | + const l = lab[0]; | |
| 490 | + const a = lab[1]; | |
| 491 | + const b = lab[2]; | |
| 492 | + let h; | |
| 493 | + | |
| 494 | + const hr = Math.atan2(b, a); | |
| 495 | + h = hr * 360 / 2 / Math.PI; | |
| 496 | + | |
| 497 | + if (h < 0) { | |
| 498 | + h += 360; | |
| 499 | + } | |
| 500 | + | |
| 501 | + const c = Math.sqrt(a * a + b * b); | |
| 502 | + | |
| 503 | + return [l, c, h]; | |
| 504 | +}; | |
| 505 | + | |
| 506 | +convert.lch.lab = function (lch) { | |
| 507 | + const l = lch[0]; | |
| 508 | + const c = lch[1]; | |
| 509 | + const h = lch[2]; | |
| 510 | + | |
| 511 | + const hr = h / 360 * 2 * Math.PI; | |
| 512 | + const a = c * Math.cos(hr); | |
| 513 | + const b = c * Math.sin(hr); | |
| 514 | + | |
| 515 | + return [l, a, b]; | |
| 516 | +}; | |
| 517 | + | |
| 518 | +convert.rgb.ansi16 = function (args, saturation = null) { | |
| 519 | + const [r, g, b] = args; | |
| 520 | + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization | |
| 521 | + | |
| 522 | + value = Math.round(value / 50); | |
| 523 | + | |
| 524 | + if (value === 0) { | |
| 525 | + return 30; | |
| 526 | + } | |
| 527 | + | |
| 528 | + let ansi = 30 | |
| 529 | + + ((Math.round(b / 255) << 2) | |
| 530 | + | (Math.round(g / 255) << 1) | |
| 531 | + | Math.round(r / 255)); | |
| 532 | + | |
| 533 | + if (value === 2) { | |
| 534 | + ansi += 60; | |
| 535 | + } | |
| 536 | + | |
| 537 | + return ansi; | |
| 538 | +}; | |
| 539 | + | |
| 540 | +convert.hsv.ansi16 = function (args) { | |
| 541 | + // Optimization here; we already know the value and don't need to get | |
| 542 | + // it converted for us. | |
| 543 | + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); | |
| 544 | +}; | |
| 545 | + | |
| 546 | +convert.rgb.ansi256 = function (args) { | |
| 547 | + const r = args[0]; | |
| 548 | + const g = args[1]; | |
| 549 | + const b = args[2]; | |
| 550 | + | |
| 551 | + // We use the extended greyscale palette here, with the exception of | |
| 552 | + // black and white. normal palette only has 4 greyscale shades. | |
| 553 | + if (r === g && g === b) { | |
| 554 | + if (r < 8) { | |
| 555 | + return 16; | |
| 556 | + } | |
| 557 | + | |
| 558 | + if (r > 248) { | |
| 559 | + return 231; | |
| 560 | + } | |
| 561 | + | |
| 562 | + return Math.round(((r - 8) / 247) * 24) + 232; | |
| 563 | + } | |
| 564 | + | |
| 565 | + const ansi = 16 | |
| 566 | + + (36 * Math.round(r / 255 * 5)) | |
| 567 | + + (6 * Math.round(g / 255 * 5)) | |
| 568 | + + Math.round(b / 255 * 5); | |
| 569 | + | |
| 570 | + return ansi; | |
| 571 | +}; | |
| 572 | + | |
| 573 | +convert.ansi16.rgb = function (args) { | |
| 574 | + let color = args % 10; | |
| 575 | + | |
| 576 | + // Handle greyscale | |
| 577 | + if (color === 0 || color === 7) { | |
| 578 | + if (args > 50) { | |
| 579 | + color += 3.5; | |
| 580 | + } | |
| 581 | + | |
| 582 | + color = color / 10.5 * 255; | |
| 583 | + | |
| 584 | + return [color, color, color]; | |
| 585 | + } | |
| 586 | + | |
| 587 | + const mult = (~~(args > 50) + 1) * 0.5; | |
| 588 | + const r = ((color & 1) * mult) * 255; | |
| 589 | + const g = (((color >> 1) & 1) * mult) * 255; | |
| 590 | + const b = (((color >> 2) & 1) * mult) * 255; | |
| 591 | + | |
| 592 | + return [r, g, b]; | |
| 593 | +}; | |
| 594 | + | |
| 595 | +convert.ansi256.rgb = function (args) { | |
| 596 | + // Handle greyscale | |
| 597 | + if (args >= 232) { | |
| 598 | + const c = (args - 232) * 10 + 8; | |
| 599 | + return [c, c, c]; | |
| 600 | + } | |
| 601 | + | |
| 602 | + args -= 16; | |
| 603 | + | |
| 604 | + let rem; | |
| 605 | + const r = Math.floor(args / 36) / 5 * 255; | |
| 606 | + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; | |
| 607 | + const b = (rem % 6) / 5 * 255; | |
| 608 | + | |
| 609 | + return [r, g, b]; | |
| 610 | +}; | |
| 611 | + | |
| 612 | +convert.rgb.hex = function (args) { | |
| 613 | + const integer = ((Math.round(args[0]) & 0xFF) << 16) | |
| 614 | + + ((Math.round(args[1]) & 0xFF) << 8) | |
| 615 | + + (Math.round(args[2]) & 0xFF); | |
| 616 | + | |
| 617 | + const string = integer.toString(16).toUpperCase(); | |
| 618 | + return '000000'.substring(string.length) + string; | |
| 619 | +}; | |
| 620 | + | |
| 621 | +convert.hex.rgb = function (args) { | |
| 622 | + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); | |
| 623 | + if (!match) { | |
| 624 | + return [0, 0, 0]; | |
| 625 | + } | |
| 626 | + | |
| 627 | + let colorString = match[0]; | |
| 628 | + | |
| 629 | + if (match[0].length === 3) { | |
| 630 | + colorString = colorString.split('').map(char => { | |
| 631 | + return char + char; | |
| 632 | + }).join(''); | |
| 633 | + } | |
| 634 | + | |
| 635 | + const integer = parseInt(colorString, 16); | |
| 636 | + const r = (integer >> 16) & 0xFF; | |
| 637 | + const g = (integer >> 8) & 0xFF; | |
| 638 | + const b = integer & 0xFF; | |
| 639 | + | |
| 640 | + return [r, g, b]; | |
| 641 | +}; | |
| 642 | + | |
| 643 | +convert.rgb.hcg = function (rgb) { | |
| 644 | + const r = rgb[0] / 255; | |
| 645 | + const g = rgb[1] / 255; | |
| 646 | + const b = rgb[2] / 255; | |
| 647 | + const max = Math.max(Math.max(r, g), b); | |
| 648 | + const min = Math.min(Math.min(r, g), b); | |
| 649 | + const chroma = (max - min); | |
| 650 | + let grayscale; | |
| 651 | + let hue; | |
| 652 | + | |
| 653 | + if (chroma < 1) { | |
| 654 | + grayscale = min / (1 - chroma); | |
| 655 | + } else { | |
| 656 | + grayscale = 0; | |
| 657 | + } | |
| 658 | + | |
| 659 | + if (chroma <= 0) { | |
| 660 | + hue = 0; | |
| 661 | + } else | |
| 662 | + if (max === r) { | |
| 663 | + hue = ((g - b) / chroma) % 6; | |
| 664 | + } else | |
| 665 | + if (max === g) { | |
| 666 | + hue = 2 + (b - r) / chroma; | |
| 667 | + } else { | |
| 668 | + hue = 4 + (r - g) / chroma; | |
| 669 | + } | |
| 670 | + | |
| 671 | + hue /= 6; | |
| 672 | + hue %= 1; | |
| 673 | + | |
| 674 | + return [hue * 360, chroma * 100, grayscale * 100]; | |
| 675 | +}; | |
| 676 | + | |
| 677 | +convert.hsl.hcg = function (hsl) { | |
| 678 | + const s = hsl[1] / 100; | |
| 679 | + const l = hsl[2] / 100; | |
| 680 | + | |
| 681 | + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); | |
| 682 | + | |
| 683 | + let f = 0; | |
| 684 | + if (c < 1.0) { | |
| 685 | + f = (l - 0.5 * c) / (1.0 - c); | |
| 686 | + } | |
| 687 | + | |
| 688 | + return [hsl[0], c * 100, f * 100]; | |
| 689 | +}; | |
| 690 | + | |
| 691 | +convert.hsv.hcg = function (hsv) { | |
| 692 | + const s = hsv[1] / 100; | |
| 693 | + const v = hsv[2] / 100; | |
| 694 | + | |
| 695 | + const c = s * v; | |
| 696 | + let f = 0; | |
| 697 | + | |
| 698 | + if (c < 1.0) { | |
| 699 | + f = (v - c) / (1 - c); | |
| 700 | + } | |
| 701 | + | |
| 702 | + return [hsv[0], c * 100, f * 100]; | |
| 703 | +}; | |
| 704 | + | |
| 705 | +convert.hcg.rgb = function (hcg) { | |
| 706 | + const h = hcg[0] / 360; | |
| 707 | + const c = hcg[1] / 100; | |
| 708 | + const g = hcg[2] / 100; | |
| 709 | + | |
| 710 | + if (c === 0.0) { | |
| 711 | + return [g * 255, g * 255, g * 255]; | |
| 712 | + } | |
| 713 | + | |
| 714 | + const pure = [0, 0, 0]; | |
| 715 | + const hi = (h % 1) * 6; | |
| 716 | + const v = hi % 1; | |
| 717 | + const w = 1 - v; | |
| 718 | + let mg = 0; | |
| 719 | + | |
| 720 | + /* eslint-disable max-statements-per-line */ | |
| 721 | + switch (Math.floor(hi)) { | |
| 722 | + case 0: | |
| 723 | + pure[0] = 1; pure[1] = v; pure[2] = 0; break; | |
| 724 | + case 1: | |
| 725 | + pure[0] = w; pure[1] = 1; pure[2] = 0; break; | |
| 726 | + case 2: | |
| 727 | + pure[0] = 0; pure[1] = 1; pure[2] = v; break; | |
| 728 | + case 3: | |
| 729 | + pure[0] = 0; pure[1] = w; pure[2] = 1; break; | |
| 730 | + case 4: | |
| 731 | + pure[0] = v; pure[1] = 0; pure[2] = 1; break; | |
| 732 | + default: | |
| 733 | + pure[0] = 1; pure[1] = 0; pure[2] = w; | |
| 734 | + } | |
| 735 | + /* eslint-enable max-statements-per-line */ | |
| 736 | + | |
| 737 | + mg = (1.0 - c) * g; | |
| 738 | + | |
| 739 | + return [ | |
| 740 | + (c * pure[0] + mg) * 255, | |
| 741 | + (c * pure[1] + mg) * 255, | |
| 742 | + (c * pure[2] + mg) * 255 | |
| 743 | + ]; | |
| 744 | +}; | |
| 745 | + | |
| 746 | +convert.hcg.hsv = function (hcg) { | |
| 747 | + const c = hcg[1] / 100; | |
| 748 | + const g = hcg[2] / 100; | |
| 749 | + | |
| 750 | + const v = c + g * (1.0 - c); | |
| 751 | + let f = 0; | |
| 752 | + | |
| 753 | + if (v > 0.0) { | |
| 754 | + f = c / v; | |
| 755 | + } | |
| 756 | + | |
| 757 | + return [hcg[0], f * 100, v * 100]; | |
| 758 | +}; | |
| 759 | + | |
| 760 | +convert.hcg.hsl = function (hcg) { | |
| 761 | + const c = hcg[1] / 100; | |
| 762 | + const g = hcg[2] / 100; | |
| 763 | + | |
| 764 | + const l = g * (1.0 - c) + 0.5 * c; | |
| 765 | + let s = 0; | |
| 766 | + | |
| 767 | + if (l > 0.0 && l < 0.5) { | |
| 768 | + s = c / (2 * l); | |
| 769 | + } else | |
| 770 | + if (l >= 0.5 && l < 1.0) { | |
| 771 | + s = c / (2 * (1 - l)); | |
| 772 | + } | |
| 773 | + | |
| 774 | + return [hcg[0], s * 100, l * 100]; | |
| 775 | +}; | |
| 776 | + | |
| 777 | +convert.hcg.hwb = function (hcg) { | |
| 778 | + const c = hcg[1] / 100; | |
| 779 | + const g = hcg[2] / 100; | |
| 780 | + const v = c + g * (1.0 - c); | |
| 781 | + return [hcg[0], (v - c) * 100, (1 - v) * 100]; | |
| 782 | +}; | |
| 783 | + | |
| 784 | +convert.hwb.hcg = function (hwb) { | |
| 785 | + const w = hwb[1] / 100; | |
| 786 | + const b = hwb[2] / 100; | |
| 787 | + const v = 1 - b; | |
| 788 | + const c = v - w; | |
| 789 | + let g = 0; | |
| 790 | + | |
| 791 | + if (c < 1) { | |
| 792 | + g = (v - c) / (1 - c); | |
| 793 | + } | |
| 794 | + | |
| 795 | + return [hwb[0], c * 100, g * 100]; | |
| 796 | +}; | |
| 797 | + | |
| 798 | +convert.apple.rgb = function (apple) { | |
| 799 | + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; | |
| 800 | +}; | |
| 801 | + | |
| 802 | +convert.rgb.apple = function (rgb) { | |
| 803 | + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; | |
| 804 | +}; | |
| 805 | + | |
| 806 | +convert.gray.rgb = function (args) { | |
| 807 | + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; | |
| 808 | +}; | |
| 809 | + | |
| 810 | +convert.gray.hsl = function (args) { | |
| 811 | + return [0, 0, args[0]]; | |
| 812 | +}; | |
| 813 | + | |
| 814 | +convert.gray.hsv = convert.gray.hsl; | |
| 815 | + | |
| 816 | +convert.gray.hwb = function (gray) { | |
| 817 | + return [0, 100, gray[0]]; | |
| 818 | +}; | |
| 819 | + | |
| 820 | +convert.gray.cmyk = function (gray) { | |
| 821 | + return [0, 0, 0, gray[0]]; | |
| 822 | +}; | |
| 823 | + | |
| 824 | +convert.gray.lab = function (gray) { | |
| 825 | + return [gray[0], 0, 0]; | |
| 826 | +}; | |
| 827 | + | |
| 828 | +convert.gray.hex = function (gray) { | |
| 829 | + const val = Math.round(gray[0] / 100 * 255) & 0xFF; | |
| 830 | + const integer = (val << 16) + (val << 8) + val; | |
| 831 | + | |
| 832 | + const string = integer.toString(16).toUpperCase(); | |
| 833 | + return '000000'.substring(string.length) + string; | |
| 834 | +}; | |
| 835 | + | |
| 836 | +convert.rgb.gray = function (rgb) { | |
| 837 | + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; | |
| 838 | + return [val / 255 * 100]; | |
| 839 | +}; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-convert/index.js
0 → 100644
| 1 | +import route from './route' | |
| 2 | +import conversions from './conversions' | |
| 3 | + | |
| 4 | +const convert = {}; | |
| 5 | + | |
| 6 | +const models = Object.keys(conversions); | |
| 7 | + | |
| 8 | +function wrapRaw(fn) { | |
| 9 | + const wrappedFn = function (...args) { | |
| 10 | + const arg0 = args[0]; | |
| 11 | + if (arg0 === undefined || arg0 === null) { | |
| 12 | + return arg0; | |
| 13 | + } | |
| 14 | + | |
| 15 | + if (arg0.length > 1) { | |
| 16 | + args = arg0; | |
| 17 | + } | |
| 18 | + | |
| 19 | + return fn(args); | |
| 20 | + }; | |
| 21 | + | |
| 22 | + // Preserve .conversion property if there is one | |
| 23 | + if ('conversion' in fn) { | |
| 24 | + wrappedFn.conversion = fn.conversion; | |
| 25 | + } | |
| 26 | + | |
| 27 | + return wrappedFn; | |
| 28 | +} | |
| 29 | + | |
| 30 | +function wrapRounded(fn) { | |
| 31 | + const wrappedFn = function (...args) { | |
| 32 | + const arg0 = args[0]; | |
| 33 | + | |
| 34 | + if (arg0 === undefined || arg0 === null) { | |
| 35 | + return arg0; | |
| 36 | + } | |
| 37 | + | |
| 38 | + if (arg0.length > 1) { | |
| 39 | + args = arg0; | |
| 40 | + } | |
| 41 | + | |
| 42 | + const result = fn(args); | |
| 43 | + | |
| 44 | + // We're assuming the result is an array here. | |
| 45 | + // see notice in conversions.js; don't use box types | |
| 46 | + // in conversion functions. | |
| 47 | + if (typeof result === 'object') { | |
| 48 | + for (let len = result.length, i = 0; i < len; i++) { | |
| 49 | + result[i] = Math.round(result[i]); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + | |
| 53 | + return result; | |
| 54 | + }; | |
| 55 | + | |
| 56 | + // Preserve .conversion property if there is one | |
| 57 | + if ('conversion' in fn) { | |
| 58 | + wrappedFn.conversion = fn.conversion; | |
| 59 | + } | |
| 60 | + | |
| 61 | + return wrappedFn; | |
| 62 | +} | |
| 63 | + | |
| 64 | +models.forEach(fromModel => { | |
| 65 | + convert[fromModel] = {}; | |
| 66 | + | |
| 67 | + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); | |
| 68 | + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); | |
| 69 | + | |
| 70 | + const routes = route(fromModel); | |
| 71 | + const routeModels = Object.keys(routes); | |
| 72 | + | |
| 73 | + routeModels.forEach(toModel => { | |
| 74 | + const fn = routes[toModel]; | |
| 75 | + | |
| 76 | + convert[fromModel][toModel] = wrapRounded(fn); | |
| 77 | + convert[fromModel][toModel].raw = wrapRaw(fn); | |
| 78 | + }); | |
| 79 | +}); | |
| 80 | + | |
| 81 | +export default convert; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-convert/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "color-convert", | |
| 3 | + "description": "Plain color conversion functions", | |
| 4 | + "version": "2.0.1", | |
| 5 | + "author": "Heather Arthur <fayearthur@gmail.com>", | |
| 6 | + "license": "MIT", | |
| 7 | + "repository": "Qix-/color-convert", | |
| 8 | + "scripts": { | |
| 9 | + "pretest": "xo", | |
| 10 | + "test": "node test/basic.js" | |
| 11 | + }, | |
| 12 | + "engines": { | |
| 13 | + "node": ">=7.0.0" | |
| 14 | + }, | |
| 15 | + "keywords": [ | |
| 16 | + "color", | |
| 17 | + "colour", | |
| 18 | + "convert", | |
| 19 | + "converter", | |
| 20 | + "conversion", | |
| 21 | + "rgb", | |
| 22 | + "hsl", | |
| 23 | + "hsv", | |
| 24 | + "hwb", | |
| 25 | + "cmyk", | |
| 26 | + "ansi", | |
| 27 | + "ansi16" | |
| 28 | + ], | |
| 29 | + "files": [ | |
| 30 | + "index.js", | |
| 31 | + "conversions.js", | |
| 32 | + "route.js" | |
| 33 | + ], | |
| 34 | + "xo": { | |
| 35 | + "rules": { | |
| 36 | + "default-case": 0, | |
| 37 | + "no-inline-comments": 0, | |
| 38 | + "operator-linebreak": 0 | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + "devDependencies": { | |
| 42 | + "chalk": "^2.4.2", | |
| 43 | + "xo": "^0.24.0" | |
| 44 | + }, | |
| 45 | + "dependencies": { | |
| 46 | + "color-name": "~1.1.4" | |
| 47 | + } | |
| 48 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-convert/route.js
0 → 100644
| 1 | +import conversions from './conversions' | |
| 2 | + | |
| 3 | +/* | |
| 4 | + This function routes a model to all other models. | |
| 5 | + | |
| 6 | + all functions that are routed have a property `.conversion` attached | |
| 7 | + to the returned synthetic function. This property is an array | |
| 8 | + of strings, each with the steps in between the 'from' and 'to' | |
| 9 | + color models (inclusive). | |
| 10 | + | |
| 11 | + conversions that are not possible simply are not included. | |
| 12 | +*/ | |
| 13 | + | |
| 14 | +function buildGraph() { | |
| 15 | + const graph = {}; | |
| 16 | + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 | |
| 17 | + const models = Object.keys(conversions); | |
| 18 | + | |
| 19 | + for (let len = models.length, i = 0; i < len; i++) { | |
| 20 | + graph[models[i]] = { | |
| 21 | + // http://jsperf.com/1-vs-infinity | |
| 22 | + // micro-opt, but this is simple. | |
| 23 | + distance: -1, | |
| 24 | + parent: null | |
| 25 | + }; | |
| 26 | + } | |
| 27 | + | |
| 28 | + return graph; | |
| 29 | +} | |
| 30 | + | |
| 31 | +// https://en.wikipedia.org/wiki/Breadth-first_search | |
| 32 | +function deriveBFS(fromModel) { | |
| 33 | + const graph = buildGraph(); | |
| 34 | + const queue = [fromModel]; // Unshift -> queue -> pop | |
| 35 | + | |
| 36 | + graph[fromModel].distance = 0; | |
| 37 | + | |
| 38 | + while (queue.length) { | |
| 39 | + const current = queue.pop(); | |
| 40 | + const adjacents = Object.keys(conversions[current]); | |
| 41 | + | |
| 42 | + for (let len = adjacents.length, i = 0; i < len; i++) { | |
| 43 | + const adjacent = adjacents[i]; | |
| 44 | + const node = graph[adjacent]; | |
| 45 | + | |
| 46 | + if (node.distance === -1) { | |
| 47 | + node.distance = graph[current].distance + 1; | |
| 48 | + node.parent = current; | |
| 49 | + queue.unshift(adjacent); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + return graph; | |
| 55 | +} | |
| 56 | + | |
| 57 | +function link(from, to) { | |
| 58 | + return function (args) { | |
| 59 | + return to(from(args)); | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +function wrapConversion(toModel, graph) { | |
| 64 | + const path = [graph[toModel].parent, toModel]; | |
| 65 | + let fn = conversions[graph[toModel].parent][toModel]; | |
| 66 | + | |
| 67 | + let cur = graph[toModel].parent; | |
| 68 | + while (graph[cur].parent) { | |
| 69 | + path.unshift(graph[cur].parent); | |
| 70 | + fn = link(conversions[graph[cur].parent][cur], fn); | |
| 71 | + cur = graph[cur].parent; | |
| 72 | + } | |
| 73 | + | |
| 74 | + fn.conversion = path; | |
| 75 | + return fn; | |
| 76 | +} | |
| 77 | + | |
| 78 | +export default function (fromModel) { | |
| 79 | + const graph = deriveBFS(fromModel); | |
| 80 | + const conversion = {}; | |
| 81 | + | |
| 82 | + const models = Object.keys(graph); | |
| 83 | + for (let len = models.length, i = 0; i < len; i++) { | |
| 84 | + const toModel = models[i]; | |
| 85 | + const node = graph[toModel]; | |
| 86 | + | |
| 87 | + if (node.parent === null) { | |
| 88 | + // No possible conversion, or this node is the source model. | |
| 89 | + continue; | |
| 90 | + } | |
| 91 | + | |
| 92 | + conversion[toModel] = wrapConversion(toModel, graph); | |
| 93 | + } | |
| 94 | + | |
| 95 | + return conversion; | |
| 96 | +}; | |
| 97 | + | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-name/LICENSE
0 → 100644
| 1 | +The MIT License (MIT) | |
| 2 | +Copyright (c) 2015 Dmitry Ivanov | |
| 3 | + | |
| 4 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| 5 | + | |
| 6 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| 7 | + | |
| 8 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 0 | 9 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-name/index.js
0 → 100644
| 1 | +'use strict' | |
| 2 | + | |
| 3 | +export default { | |
| 4 | + "aliceblue": [240, 248, 255], | |
| 5 | + "antiquewhite": [250, 235, 215], | |
| 6 | + "aqua": [0, 255, 255], | |
| 7 | + "aquamarine": [127, 255, 212], | |
| 8 | + "azure": [240, 255, 255], | |
| 9 | + "beige": [245, 245, 220], | |
| 10 | + "bisque": [255, 228, 196], | |
| 11 | + "black": [0, 0, 0], | |
| 12 | + "blanchedalmond": [255, 235, 205], | |
| 13 | + "blue": [0, 0, 255], | |
| 14 | + "blueviolet": [138, 43, 226], | |
| 15 | + "brown": [165, 42, 42], | |
| 16 | + "burlywood": [222, 184, 135], | |
| 17 | + "cadetblue": [95, 158, 160], | |
| 18 | + "chartreuse": [127, 255, 0], | |
| 19 | + "chocolate": [210, 105, 30], | |
| 20 | + "coral": [255, 127, 80], | |
| 21 | + "cornflowerblue": [100, 149, 237], | |
| 22 | + "cornsilk": [255, 248, 220], | |
| 23 | + "crimson": [220, 20, 60], | |
| 24 | + "cyan": [0, 255, 255], | |
| 25 | + "darkblue": [0, 0, 139], | |
| 26 | + "darkcyan": [0, 139, 139], | |
| 27 | + "darkgoldenrod": [184, 134, 11], | |
| 28 | + "darkgray": [169, 169, 169], | |
| 29 | + "darkgreen": [0, 100, 0], | |
| 30 | + "darkgrey": [169, 169, 169], | |
| 31 | + "darkkhaki": [189, 183, 107], | |
| 32 | + "darkmagenta": [139, 0, 139], | |
| 33 | + "darkolivegreen": [85, 107, 47], | |
| 34 | + "darkorange": [255, 140, 0], | |
| 35 | + "darkorchid": [153, 50, 204], | |
| 36 | + "darkred": [139, 0, 0], | |
| 37 | + "darksalmon": [233, 150, 122], | |
| 38 | + "darkseagreen": [143, 188, 143], | |
| 39 | + "darkslateblue": [72, 61, 139], | |
| 40 | + "darkslategray": [47, 79, 79], | |
| 41 | + "darkslategrey": [47, 79, 79], | |
| 42 | + "darkturquoise": [0, 206, 209], | |
| 43 | + "darkviolet": [148, 0, 211], | |
| 44 | + "deeppink": [255, 20, 147], | |
| 45 | + "deepskyblue": [0, 191, 255], | |
| 46 | + "dimgray": [105, 105, 105], | |
| 47 | + "dimgrey": [105, 105, 105], | |
| 48 | + "dodgerblue": [30, 144, 255], | |
| 49 | + "firebrick": [178, 34, 34], | |
| 50 | + "floralwhite": [255, 250, 240], | |
| 51 | + "forestgreen": [34, 139, 34], | |
| 52 | + "fuchsia": [255, 0, 255], | |
| 53 | + "gainsboro": [220, 220, 220], | |
| 54 | + "ghostwhite": [248, 248, 255], | |
| 55 | + "gold": [255, 215, 0], | |
| 56 | + "goldenrod": [218, 165, 32], | |
| 57 | + "gray": [128, 128, 128], | |
| 58 | + "green": [0, 128, 0], | |
| 59 | + "greenyellow": [173, 255, 47], | |
| 60 | + "grey": [128, 128, 128], | |
| 61 | + "honeydew": [240, 255, 240], | |
| 62 | + "hotpink": [255, 105, 180], | |
| 63 | + "indianred": [205, 92, 92], | |
| 64 | + "indigo": [75, 0, 130], | |
| 65 | + "ivory": [255, 255, 240], | |
| 66 | + "khaki": [240, 230, 140], | |
| 67 | + "lavender": [230, 230, 250], | |
| 68 | + "lavenderblush": [255, 240, 245], | |
| 69 | + "lawngreen": [124, 252, 0], | |
| 70 | + "lemonchiffon": [255, 250, 205], | |
| 71 | + "lightblue": [173, 216, 230], | |
| 72 | + "lightcoral": [240, 128, 128], | |
| 73 | + "lightcyan": [224, 255, 255], | |
| 74 | + "lightgoldenrodyellow": [250, 250, 210], | |
| 75 | + "lightgray": [211, 211, 211], | |
| 76 | + "lightgreen": [144, 238, 144], | |
| 77 | + "lightgrey": [211, 211, 211], | |
| 78 | + "lightpink": [255, 182, 193], | |
| 79 | + "lightsalmon": [255, 160, 122], | |
| 80 | + "lightseagreen": [32, 178, 170], | |
| 81 | + "lightskyblue": [135, 206, 250], | |
| 82 | + "lightslategray": [119, 136, 153], | |
| 83 | + "lightslategrey": [119, 136, 153], | |
| 84 | + "lightsteelblue": [176, 196, 222], | |
| 85 | + "lightyellow": [255, 255, 224], | |
| 86 | + "lime": [0, 255, 0], | |
| 87 | + "limegreen": [50, 205, 50], | |
| 88 | + "linen": [250, 240, 230], | |
| 89 | + "magenta": [255, 0, 255], | |
| 90 | + "maroon": [128, 0, 0], | |
| 91 | + "mediumaquamarine": [102, 205, 170], | |
| 92 | + "mediumblue": [0, 0, 205], | |
| 93 | + "mediumorchid": [186, 85, 211], | |
| 94 | + "mediumpurple": [147, 112, 219], | |
| 95 | + "mediumseagreen": [60, 179, 113], | |
| 96 | + "mediumslateblue": [123, 104, 238], | |
| 97 | + "mediumspringgreen": [0, 250, 154], | |
| 98 | + "mediumturquoise": [72, 209, 204], | |
| 99 | + "mediumvioletred": [199, 21, 133], | |
| 100 | + "midnightblue": [25, 25, 112], | |
| 101 | + "mintcream": [245, 255, 250], | |
| 102 | + "mistyrose": [255, 228, 225], | |
| 103 | + "moccasin": [255, 228, 181], | |
| 104 | + "navajowhite": [255, 222, 173], | |
| 105 | + "navy": [0, 0, 128], | |
| 106 | + "oldlace": [253, 245, 230], | |
| 107 | + "olive": [128, 128, 0], | |
| 108 | + "olivedrab": [107, 142, 35], | |
| 109 | + "orange": [255, 165, 0], | |
| 110 | + "orangered": [255, 69, 0], | |
| 111 | + "orchid": [218, 112, 214], | |
| 112 | + "palegoldenrod": [238, 232, 170], | |
| 113 | + "palegreen": [152, 251, 152], | |
| 114 | + "paleturquoise": [175, 238, 238], | |
| 115 | + "palevioletred": [219, 112, 147], | |
| 116 | + "papayawhip": [255, 239, 213], | |
| 117 | + "peachpuff": [255, 218, 185], | |
| 118 | + "peru": [205, 133, 63], | |
| 119 | + "pink": [255, 192, 203], | |
| 120 | + "plum": [221, 160, 221], | |
| 121 | + "powderblue": [176, 224, 230], | |
| 122 | + "purple": [128, 0, 128], | |
| 123 | + "rebeccapurple": [102, 51, 153], | |
| 124 | + "red": [255, 0, 0], | |
| 125 | + "rosybrown": [188, 143, 143], | |
| 126 | + "royalblue": [65, 105, 225], | |
| 127 | + "saddlebrown": [139, 69, 19], | |
| 128 | + "salmon": [250, 128, 114], | |
| 129 | + "sandybrown": [244, 164, 96], | |
| 130 | + "seagreen": [46, 139, 87], | |
| 131 | + "seashell": [255, 245, 238], | |
| 132 | + "sienna": [160, 82, 45], | |
| 133 | + "silver": [192, 192, 192], | |
| 134 | + "skyblue": [135, 206, 235], | |
| 135 | + "slateblue": [106, 90, 205], | |
| 136 | + "slategray": [112, 128, 144], | |
| 137 | + "slategrey": [112, 128, 144], | |
| 138 | + "snow": [255, 250, 250], | |
| 139 | + "springgreen": [0, 255, 127], | |
| 140 | + "steelblue": [70, 130, 180], | |
| 141 | + "tan": [210, 180, 140], | |
| 142 | + "teal": [0, 128, 128], | |
| 143 | + "thistle": [216, 191, 216], | |
| 144 | + "tomato": [255, 99, 71], | |
| 145 | + "turquoise": [64, 224, 208], | |
| 146 | + "violet": [238, 130, 238], | |
| 147 | + "wheat": [245, 222, 179], | |
| 148 | + "white": [255, 255, 255], | |
| 149 | + "whitesmoke": [245, 245, 245], | |
| 150 | + "yellow": [255, 255, 0], | |
| 151 | + "yellowgreen": [154, 205, 50] | |
| 152 | +}; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-name/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "color-name", | |
| 3 | + "version": "1.1.4", | |
| 4 | + "description": "A list of color names and its values", | |
| 5 | + "main": "index.js", | |
| 6 | + "files": [ | |
| 7 | + "index.js" | |
| 8 | + ], | |
| 9 | + "scripts": { | |
| 10 | + "test": "node test.js" | |
| 11 | + }, | |
| 12 | + "repository": { | |
| 13 | + "type": "git", | |
| 14 | + "url": "git@github.com:colorjs/color-name.git" | |
| 15 | + }, | |
| 16 | + "keywords": [ | |
| 17 | + "color-name", | |
| 18 | + "color", | |
| 19 | + "color-keyword", | |
| 20 | + "keyword" | |
| 21 | + ], | |
| 22 | + "author": "DY <dfcreative@gmail.com>", | |
| 23 | + "license": "MIT", | |
| 24 | + "bugs": { | |
| 25 | + "url": "https://github.com/colorjs/color-name/issues" | |
| 26 | + }, | |
| 27 | + "homepage": "https://github.com/colorjs/color-name" | |
| 28 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-string/LICENSE
0 → 100644
| 1 | +Copyright (c) 2011 Heather Arthur <fayearthur@gmail.com> | |
| 2 | + | |
| 3 | +Permission is hereby granted, free of charge, to any person obtaining | |
| 4 | +a copy of this software and associated documentation files (the | |
| 5 | +"Software"), to deal in the Software without restriction, including | |
| 6 | +without limitation the rights to use, copy, modify, merge, publish, | |
| 7 | +distribute, sublicense, and/or sell copies of the Software, and to | |
| 8 | +permit persons to whom the Software is furnished to do so, subject to | |
| 9 | +the following conditions: | |
| 10 | + | |
| 11 | +The above copyright notice and this permission notice shall be | |
| 12 | +included in all copies or substantial portions of the Software. | |
| 13 | + | |
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 15 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 16 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 17 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 18 | +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 19 | +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 20 | +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-string/index.js
0 → 100644
| 1 | +/* MIT license */ | |
| 2 | +import colorNames from '../color-name' | |
| 3 | +import swizzle from '../simple-swizzle' | |
| 4 | +var hasOwnProperty = Object.hasOwnProperty; | |
| 5 | + | |
| 6 | +var reverseNames = Object.create(null); | |
| 7 | + | |
| 8 | +// create a list of reverse color names | |
| 9 | +for (var name in colorNames) { | |
| 10 | + if (hasOwnProperty.call(colorNames, name)) { | |
| 11 | + reverseNames[colorNames[name]] = name; | |
| 12 | + } | |
| 13 | +} | |
| 14 | + | |
| 15 | +var cs = { | |
| 16 | + to: {}, | |
| 17 | + get: {} | |
| 18 | +}; | |
| 19 | + | |
| 20 | +cs.get = function (string) { | |
| 21 | + var prefix = string.substring(0, 3).toLowerCase(); | |
| 22 | + var val; | |
| 23 | + var model; | |
| 24 | + switch (prefix) { | |
| 25 | + case 'hsl': | |
| 26 | + val = cs.get.hsl(string); | |
| 27 | + model = 'hsl'; | |
| 28 | + break; | |
| 29 | + case 'hwb': | |
| 30 | + val = cs.get.hwb(string); | |
| 31 | + model = 'hwb'; | |
| 32 | + break; | |
| 33 | + default: | |
| 34 | + val = cs.get.rgb(string); | |
| 35 | + model = 'rgb'; | |
| 36 | + break; | |
| 37 | + } | |
| 38 | + | |
| 39 | + if (!val) { | |
| 40 | + return null; | |
| 41 | + } | |
| 42 | + | |
| 43 | + return {model: model, value: val}; | |
| 44 | +}; | |
| 45 | + | |
| 46 | +cs.get.rgb = function (string) { | |
| 47 | + if (!string) { | |
| 48 | + return null; | |
| 49 | + } | |
| 50 | + | |
| 51 | + var abbr = /^#([a-f0-9]{3,4})$/i; | |
| 52 | + var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i; | |
| 53 | + var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/; | |
| 54 | + var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/; | |
| 55 | + var keyword = /^(\w+)$/; | |
| 56 | + | |
| 57 | + var rgb = [0, 0, 0, 1]; | |
| 58 | + var match; | |
| 59 | + var i; | |
| 60 | + var hexAlpha; | |
| 61 | + | |
| 62 | + if (match = string.match(hex)) { | |
| 63 | + hexAlpha = match[2]; | |
| 64 | + match = match[1]; | |
| 65 | + | |
| 66 | + for (i = 0; i < 3; i++) { | |
| 67 | + // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19 | |
| 68 | + var i2 = i * 2; | |
| 69 | + rgb[i] = parseInt(match.slice(i2, i2 + 2), 16); | |
| 70 | + } | |
| 71 | + | |
| 72 | + if (hexAlpha) { | |
| 73 | + rgb[3] = parseInt(hexAlpha, 16) / 255; | |
| 74 | + } | |
| 75 | + } else if (match = string.match(abbr)) { | |
| 76 | + match = match[1]; | |
| 77 | + hexAlpha = match[3]; | |
| 78 | + | |
| 79 | + for (i = 0; i < 3; i++) { | |
| 80 | + rgb[i] = parseInt(match[i] + match[i], 16); | |
| 81 | + } | |
| 82 | + | |
| 83 | + if (hexAlpha) { | |
| 84 | + rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255; | |
| 85 | + } | |
| 86 | + } else if (match = string.match(rgba)) { | |
| 87 | + for (i = 0; i < 3; i++) { | |
| 88 | + rgb[i] = parseInt(match[i + 1], 0); | |
| 89 | + } | |
| 90 | + | |
| 91 | + if (match[4]) { | |
| 92 | + if (match[5]) { | |
| 93 | + rgb[3] = parseFloat(match[4]) * 0.01; | |
| 94 | + } else { | |
| 95 | + rgb[3] = parseFloat(match[4]); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } else if (match = string.match(per)) { | |
| 99 | + for (i = 0; i < 3; i++) { | |
| 100 | + rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55); | |
| 101 | + } | |
| 102 | + | |
| 103 | + if (match[4]) { | |
| 104 | + if (match[5]) { | |
| 105 | + rgb[3] = parseFloat(match[4]) * 0.01; | |
| 106 | + } else { | |
| 107 | + rgb[3] = parseFloat(match[4]); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + } else if (match = string.match(keyword)) { | |
| 111 | + if (match[1] === 'transparent') { | |
| 112 | + return [0, 0, 0, 0]; | |
| 113 | + } | |
| 114 | + | |
| 115 | + if (!hasOwnProperty.call(colorNames, match[1])) { | |
| 116 | + return null; | |
| 117 | + } | |
| 118 | + | |
| 119 | + rgb = colorNames[match[1]]; | |
| 120 | + rgb[3] = 1; | |
| 121 | + | |
| 122 | + return rgb; | |
| 123 | + } else { | |
| 124 | + return null; | |
| 125 | + } | |
| 126 | + | |
| 127 | + for (i = 0; i < 3; i++) { | |
| 128 | + rgb[i] = clamp(rgb[i], 0, 255); | |
| 129 | + } | |
| 130 | + rgb[3] = clamp(rgb[3], 0, 1); | |
| 131 | + | |
| 132 | + return rgb; | |
| 133 | +}; | |
| 134 | + | |
| 135 | +cs.get.hsl = function (string) { | |
| 136 | + if (!string) { | |
| 137 | + return null; | |
| 138 | + } | |
| 139 | + | |
| 140 | + var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/; | |
| 141 | + var match = string.match(hsl); | |
| 142 | + | |
| 143 | + if (match) { | |
| 144 | + var alpha = parseFloat(match[4]); | |
| 145 | + var h = ((parseFloat(match[1]) % 360) + 360) % 360; | |
| 146 | + var s = clamp(parseFloat(match[2]), 0, 100); | |
| 147 | + var l = clamp(parseFloat(match[3]), 0, 100); | |
| 148 | + var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1); | |
| 149 | + | |
| 150 | + return [h, s, l, a]; | |
| 151 | + } | |
| 152 | + | |
| 153 | + return null; | |
| 154 | +}; | |
| 155 | + | |
| 156 | +cs.get.hwb = function (string) { | |
| 157 | + if (!string) { | |
| 158 | + return null; | |
| 159 | + } | |
| 160 | + | |
| 161 | + var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/; | |
| 162 | + var match = string.match(hwb); | |
| 163 | + | |
| 164 | + if (match) { | |
| 165 | + var alpha = parseFloat(match[4]); | |
| 166 | + var h = ((parseFloat(match[1]) % 360) + 360) % 360; | |
| 167 | + var w = clamp(parseFloat(match[2]), 0, 100); | |
| 168 | + var b = clamp(parseFloat(match[3]), 0, 100); | |
| 169 | + var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1); | |
| 170 | + return [h, w, b, a]; | |
| 171 | + } | |
| 172 | + | |
| 173 | + return null; | |
| 174 | +}; | |
| 175 | + | |
| 176 | +cs.to.hex = function () { | |
| 177 | + var rgba = swizzle(arguments); | |
| 178 | + | |
| 179 | + return ( | |
| 180 | + '#' + | |
| 181 | + hexDouble(rgba[0]) + | |
| 182 | + hexDouble(rgba[1]) + | |
| 183 | + hexDouble(rgba[2]) + | |
| 184 | + (rgba[3] < 1 | |
| 185 | + ? (hexDouble(Math.round(rgba[3] * 255))) | |
| 186 | + : '') | |
| 187 | + ); | |
| 188 | +}; | |
| 189 | + | |
| 190 | +cs.to.rgb = function () { | |
| 191 | + var rgba = swizzle(arguments); | |
| 192 | + | |
| 193 | + return rgba.length < 4 || rgba[3] === 1 | |
| 194 | + ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' | |
| 195 | + : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')'; | |
| 196 | +}; | |
| 197 | + | |
| 198 | +cs.to.rgb.percent = function () { | |
| 199 | + var rgba = swizzle(arguments); | |
| 200 | + | |
| 201 | + var r = Math.round(rgba[0] / 255 * 100); | |
| 202 | + var g = Math.round(rgba[1] / 255 * 100); | |
| 203 | + var b = Math.round(rgba[2] / 255 * 100); | |
| 204 | + | |
| 205 | + return rgba.length < 4 || rgba[3] === 1 | |
| 206 | + ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' | |
| 207 | + : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')'; | |
| 208 | +}; | |
| 209 | + | |
| 210 | +cs.to.hsl = function () { | |
| 211 | + var hsla = swizzle(arguments); | |
| 212 | + return hsla.length < 4 || hsla[3] === 1 | |
| 213 | + ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' | |
| 214 | + : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')'; | |
| 215 | +}; | |
| 216 | + | |
| 217 | +// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax | |
| 218 | +// (hwb have alpha optional & 1 is default value) | |
| 219 | +cs.to.hwb = function () { | |
| 220 | + var hwba = swizzle(arguments); | |
| 221 | + | |
| 222 | + var a = ''; | |
| 223 | + if (hwba.length >= 4 && hwba[3] !== 1) { | |
| 224 | + a = ', ' + hwba[3]; | |
| 225 | + } | |
| 226 | + | |
| 227 | + return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')'; | |
| 228 | +}; | |
| 229 | + | |
| 230 | +cs.to.keyword = function (rgb) { | |
| 231 | + return reverseNames[rgb.slice(0, 3)]; | |
| 232 | +}; | |
| 233 | + | |
| 234 | +// helpers | |
| 235 | +function clamp(num, min, max) { | |
| 236 | + return Math.min(Math.max(min, num), max); | |
| 237 | +} | |
| 238 | + | |
| 239 | +function hexDouble(num) { | |
| 240 | + var str = Math.round(num).toString(16).toUpperCase(); | |
| 241 | + return (str.length < 2) ? '0' + str : str; | |
| 242 | +} | |
| 243 | + | |
| 244 | +export default cs; | |
| 0 | 245 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color-string/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "color-string", | |
| 3 | + "description": "Parser and generator for CSS color strings", | |
| 4 | + "version": "1.9.1", | |
| 5 | + "author": "Heather Arthur <fayearthur@gmail.com>", | |
| 6 | + "contributors": [ | |
| 7 | + "Maxime Thirouin", | |
| 8 | + "Dyma Ywanov <dfcreative@gmail.com>", | |
| 9 | + "Josh Junon" | |
| 10 | + ], | |
| 11 | + "repository": "Qix-/color-string", | |
| 12 | + "scripts": { | |
| 13 | + "pretest": "xo", | |
| 14 | + "test": "node test/basic.js" | |
| 15 | + }, | |
| 16 | + "license": "MIT", | |
| 17 | + "files": [ | |
| 18 | + "index.js" | |
| 19 | + ], | |
| 20 | + "xo": { | |
| 21 | + "rules": { | |
| 22 | + "no-cond-assign": 0, | |
| 23 | + "operator-linebreak": 0 | |
| 24 | + } | |
| 25 | + }, | |
| 26 | + "dependencies": { | |
| 27 | + "color-name": "^1.0.0", | |
| 28 | + "simple-swizzle": "^0.2.2" | |
| 29 | + }, | |
| 30 | + "devDependencies": { | |
| 31 | + "xo": "^0.12.1" | |
| 32 | + }, | |
| 33 | + "keywords": [ | |
| 34 | + "color", | |
| 35 | + "colour", | |
| 36 | + "rgb", | |
| 37 | + "css" | |
| 38 | + ] | |
| 39 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/color.js
0 → 100644
| 1 | +import colorString from './color-string' | |
| 2 | +import convert from './color-convert' | |
| 3 | + | |
| 4 | +const skippedModels = [ | |
| 5 | + // To be honest, I don't really feel like keyword belongs in color convert, but eh. | |
| 6 | + 'keyword', | |
| 7 | + | |
| 8 | + // Gray conflicts with some method names, and has its own method defined. | |
| 9 | + 'gray', | |
| 10 | + | |
| 11 | + // Shouldn't really be in color-convert either... | |
| 12 | + 'hex', | |
| 13 | +]; | |
| 14 | + | |
| 15 | +const hashedModelKeys = {}; | |
| 16 | +for (const model of Object.keys(convert)) { | |
| 17 | + hashedModelKeys[[...convert[model].labels].sort().join('')] = model; | |
| 18 | +} | |
| 19 | + | |
| 20 | +const limiters = {}; | |
| 21 | + | |
| 22 | +function Color(object, model) { | |
| 23 | + if (!(this instanceof Color)) { | |
| 24 | + return new Color(object, model); | |
| 25 | + } | |
| 26 | + | |
| 27 | + if (model && model in skippedModels) { | |
| 28 | + model = null; | |
| 29 | + } | |
| 30 | + | |
| 31 | + if (model && !(model in convert)) { | |
| 32 | + throw new Error('Unknown model: ' + model); | |
| 33 | + } | |
| 34 | + | |
| 35 | + let i; | |
| 36 | + let channels; | |
| 37 | + | |
| 38 | + if (object == null) { // eslint-disable-line no-eq-null,eqeqeq | |
| 39 | + this.model = 'rgb'; | |
| 40 | + this.color = [0, 0, 0]; | |
| 41 | + this.valpha = 1; | |
| 42 | + } else if (object instanceof Color) { | |
| 43 | + this.model = object.model; | |
| 44 | + this.color = [...object.color]; | |
| 45 | + this.valpha = object.valpha; | |
| 46 | + } else if (typeof object === 'string') { | |
| 47 | + const result = colorString.get(object); | |
| 48 | + if (result === null) { | |
| 49 | + throw new Error('Unable to parse color from string: ' + object); | |
| 50 | + } | |
| 51 | + | |
| 52 | + this.model = result.model; | |
| 53 | + channels = convert[this.model].channels; | |
| 54 | + this.color = result.value.slice(0, channels); | |
| 55 | + this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1; | |
| 56 | + } else if (object.length > 0) { | |
| 57 | + this.model = model || 'rgb'; | |
| 58 | + channels = convert[this.model].channels; | |
| 59 | + const newArray = Array.prototype.slice.call(object, 0, channels); | |
| 60 | + this.color = zeroArray(newArray, channels); | |
| 61 | + this.valpha = typeof object[channels] === 'number' ? object[channels] : 1; | |
| 62 | + } else if (typeof object === 'number') { | |
| 63 | + // This is always RGB - can be converted later on. | |
| 64 | + this.model = 'rgb'; | |
| 65 | + this.color = [ | |
| 66 | + (object >> 16) & 0xFF, | |
| 67 | + (object >> 8) & 0xFF, | |
| 68 | + object & 0xFF, | |
| 69 | + ]; | |
| 70 | + this.valpha = 1; | |
| 71 | + } else { | |
| 72 | + this.valpha = 1; | |
| 73 | + | |
| 74 | + const keys = Object.keys(object); | |
| 75 | + if ('alpha' in object) { | |
| 76 | + keys.splice(keys.indexOf('alpha'), 1); | |
| 77 | + this.valpha = typeof object.alpha === 'number' ? object.alpha : 0; | |
| 78 | + } | |
| 79 | + | |
| 80 | + const hashedKeys = keys.sort().join(''); | |
| 81 | + if (!(hashedKeys in hashedModelKeys)) { | |
| 82 | + throw new Error('Unable to parse color from object: ' + JSON.stringify(object)); | |
| 83 | + } | |
| 84 | + | |
| 85 | + this.model = hashedModelKeys[hashedKeys]; | |
| 86 | + | |
| 87 | + const {labels} = convert[this.model]; | |
| 88 | + const color = []; | |
| 89 | + for (i = 0; i < labels.length; i++) { | |
| 90 | + color.push(object[labels[i]]); | |
| 91 | + } | |
| 92 | + | |
| 93 | + this.color = zeroArray(color); | |
| 94 | + } | |
| 95 | + | |
| 96 | + // Perform limitations (clamping, etc.) | |
| 97 | + if (limiters[this.model]) { | |
| 98 | + channels = convert[this.model].channels; | |
| 99 | + for (i = 0; i < channels; i++) { | |
| 100 | + const limit = limiters[this.model][i]; | |
| 101 | + if (limit) { | |
| 102 | + this.color[i] = limit(this.color[i]); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | + this.valpha = Math.max(0, Math.min(1, this.valpha)); | |
| 108 | + | |
| 109 | + if (Object.freeze) { | |
| 110 | + Object.freeze(this); | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |
| 114 | +Color.prototype = { | |
| 115 | + toString() { | |
| 116 | + return this.string(); | |
| 117 | + }, | |
| 118 | + | |
| 119 | + toJSON() { | |
| 120 | + return this[this.model](); | |
| 121 | + }, | |
| 122 | + | |
| 123 | + string(places) { | |
| 124 | + let self = this.model in colorString.to ? this : this.rgb(); | |
| 125 | + self = self.round(typeof places === 'number' ? places : 1); | |
| 126 | + const args = self.valpha === 1 ? self.color : [...self.color, this.valpha]; | |
| 127 | + return colorString.to[self.model](args); | |
| 128 | + }, | |
| 129 | + | |
| 130 | + percentString(places) { | |
| 131 | + const self = this.rgb().round(typeof places === 'number' ? places : 1); | |
| 132 | + const args = self.valpha === 1 ? self.color : [...self.color, this.valpha]; | |
| 133 | + return colorString.to.rgb.percent(args); | |
| 134 | + }, | |
| 135 | + | |
| 136 | + array() { | |
| 137 | + return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha]; | |
| 138 | + }, | |
| 139 | + | |
| 140 | + object() { | |
| 141 | + const result = {}; | |
| 142 | + const {channels} = convert[this.model]; | |
| 143 | + const {labels} = convert[this.model]; | |
| 144 | + | |
| 145 | + for (let i = 0; i < channels; i++) { | |
| 146 | + result[labels[i]] = this.color[i]; | |
| 147 | + } | |
| 148 | + | |
| 149 | + if (this.valpha !== 1) { | |
| 150 | + result.alpha = this.valpha; | |
| 151 | + } | |
| 152 | + | |
| 153 | + return result; | |
| 154 | + }, | |
| 155 | + | |
| 156 | + unitArray() { | |
| 157 | + const rgb = this.rgb().color; | |
| 158 | + rgb[0] /= 255; | |
| 159 | + rgb[1] /= 255; | |
| 160 | + rgb[2] /= 255; | |
| 161 | + | |
| 162 | + if (this.valpha !== 1) { | |
| 163 | + rgb.push(this.valpha); | |
| 164 | + } | |
| 165 | + | |
| 166 | + return rgb; | |
| 167 | + }, | |
| 168 | + | |
| 169 | + unitObject() { | |
| 170 | + const rgb = this.rgb().object(); | |
| 171 | + rgb.r /= 255; | |
| 172 | + rgb.g /= 255; | |
| 173 | + rgb.b /= 255; | |
| 174 | + | |
| 175 | + if (this.valpha !== 1) { | |
| 176 | + rgb.alpha = this.valpha; | |
| 177 | + } | |
| 178 | + | |
| 179 | + return rgb; | |
| 180 | + }, | |
| 181 | + | |
| 182 | + round(places) { | |
| 183 | + places = Math.max(places || 0, 0); | |
| 184 | + return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model); | |
| 185 | + }, | |
| 186 | + | |
| 187 | + alpha(value) { | |
| 188 | + if (value !== undefined) { | |
| 189 | + return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model); | |
| 190 | + } | |
| 191 | + | |
| 192 | + return this.valpha; | |
| 193 | + }, | |
| 194 | + | |
| 195 | + // Rgb | |
| 196 | + red: getset('rgb', 0, maxfn(255)), | |
| 197 | + green: getset('rgb', 1, maxfn(255)), | |
| 198 | + blue: getset('rgb', 2, maxfn(255)), | |
| 199 | + | |
| 200 | + hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360), | |
| 201 | + | |
| 202 | + saturationl: getset('hsl', 1, maxfn(100)), | |
| 203 | + lightness: getset('hsl', 2, maxfn(100)), | |
| 204 | + | |
| 205 | + saturationv: getset('hsv', 1, maxfn(100)), | |
| 206 | + value: getset('hsv', 2, maxfn(100)), | |
| 207 | + | |
| 208 | + chroma: getset('hcg', 1, maxfn(100)), | |
| 209 | + gray: getset('hcg', 2, maxfn(100)), | |
| 210 | + | |
| 211 | + white: getset('hwb', 1, maxfn(100)), | |
| 212 | + wblack: getset('hwb', 2, maxfn(100)), | |
| 213 | + | |
| 214 | + cyan: getset('cmyk', 0, maxfn(100)), | |
| 215 | + magenta: getset('cmyk', 1, maxfn(100)), | |
| 216 | + yellow: getset('cmyk', 2, maxfn(100)), | |
| 217 | + black: getset('cmyk', 3, maxfn(100)), | |
| 218 | + | |
| 219 | + x: getset('xyz', 0, maxfn(95.047)), | |
| 220 | + y: getset('xyz', 1, maxfn(100)), | |
| 221 | + z: getset('xyz', 2, maxfn(108.833)), | |
| 222 | + | |
| 223 | + l: getset('lab', 0, maxfn(100)), | |
| 224 | + a: getset('lab', 1), | |
| 225 | + b: getset('lab', 2), | |
| 226 | + | |
| 227 | + keyword(value) { | |
| 228 | + if (value !== undefined) { | |
| 229 | + return new Color(value); | |
| 230 | + } | |
| 231 | + | |
| 232 | + return convert[this.model].keyword(this.color); | |
| 233 | + }, | |
| 234 | + | |
| 235 | + hex(value) { | |
| 236 | + if (value !== undefined) { | |
| 237 | + return new Color(value); | |
| 238 | + } | |
| 239 | + | |
| 240 | + return colorString.to.hex(this.rgb().round().color); | |
| 241 | + }, | |
| 242 | + | |
| 243 | + hexa(value) { | |
| 244 | + if (value !== undefined) { | |
| 245 | + return new Color(value); | |
| 246 | + } | |
| 247 | + | |
| 248 | + const rgbArray = this.rgb().round().color; | |
| 249 | + | |
| 250 | + let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase(); | |
| 251 | + if (alphaHex.length === 1) { | |
| 252 | + alphaHex = '0' + alphaHex; | |
| 253 | + } | |
| 254 | + | |
| 255 | + return colorString.to.hex(rgbArray) + alphaHex; | |
| 256 | + }, | |
| 257 | + | |
| 258 | + rgbNumber() { | |
| 259 | + const rgb = this.rgb().color; | |
| 260 | + return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF); | |
| 261 | + }, | |
| 262 | + | |
| 263 | + luminosity() { | |
| 264 | + // http://www.w3.org/TR/WCAG20/#relativeluminancedef | |
| 265 | + const rgb = this.rgb().color; | |
| 266 | + | |
| 267 | + const lum = []; | |
| 268 | + for (const [i, element] of rgb.entries()) { | |
| 269 | + const chan = element / 255; | |
| 270 | + lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4; | |
| 271 | + } | |
| 272 | + | |
| 273 | + return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2]; | |
| 274 | + }, | |
| 275 | + | |
| 276 | + contrast(color2) { | |
| 277 | + // http://www.w3.org/TR/WCAG20/#contrast-ratiodef | |
| 278 | + const lum1 = this.luminosity(); | |
| 279 | + const lum2 = color2.luminosity(); | |
| 280 | + | |
| 281 | + if (lum1 > lum2) { | |
| 282 | + return (lum1 + 0.05) / (lum2 + 0.05); | |
| 283 | + } | |
| 284 | + | |
| 285 | + return (lum2 + 0.05) / (lum1 + 0.05); | |
| 286 | + }, | |
| 287 | + | |
| 288 | + level(color2) { | |
| 289 | + // https://www.w3.org/TR/WCAG/#contrast-enhanced | |
| 290 | + const contrastRatio = this.contrast(color2); | |
| 291 | + if (contrastRatio >= 7) { | |
| 292 | + return 'AAA'; | |
| 293 | + } | |
| 294 | + | |
| 295 | + return (contrastRatio >= 4.5) ? 'AA' : ''; | |
| 296 | + }, | |
| 297 | + | |
| 298 | + isDark() { | |
| 299 | + // YIQ equation from http://24ways.org/2010/calculating-color-contrast | |
| 300 | + const rgb = this.rgb().color; | |
| 301 | + const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000; | |
| 302 | + return yiq < 128; | |
| 303 | + }, | |
| 304 | + | |
| 305 | + isLight() { | |
| 306 | + return !this.isDark(); | |
| 307 | + }, | |
| 308 | + | |
| 309 | + negate() { | |
| 310 | + const rgb = this.rgb(); | |
| 311 | + for (let i = 0; i < 3; i++) { | |
| 312 | + rgb.color[i] = 255 - rgb.color[i]; | |
| 313 | + } | |
| 314 | + | |
| 315 | + return rgb; | |
| 316 | + }, | |
| 317 | + | |
| 318 | + lighten(ratio) { | |
| 319 | + const hsl = this.hsl(); | |
| 320 | + hsl.color[2] += hsl.color[2] * ratio; | |
| 321 | + return hsl; | |
| 322 | + }, | |
| 323 | + | |
| 324 | + darken(ratio) { | |
| 325 | + const hsl = this.hsl(); | |
| 326 | + hsl.color[2] -= hsl.color[2] * ratio; | |
| 327 | + return hsl; | |
| 328 | + }, | |
| 329 | + | |
| 330 | + saturate(ratio) { | |
| 331 | + const hsl = this.hsl(); | |
| 332 | + hsl.color[1] += hsl.color[1] * ratio; | |
| 333 | + return hsl; | |
| 334 | + }, | |
| 335 | + | |
| 336 | + desaturate(ratio) { | |
| 337 | + const hsl = this.hsl(); | |
| 338 | + hsl.color[1] -= hsl.color[1] * ratio; | |
| 339 | + return hsl; | |
| 340 | + }, | |
| 341 | + | |
| 342 | + whiten(ratio) { | |
| 343 | + const hwb = this.hwb(); | |
| 344 | + hwb.color[1] += hwb.color[1] * ratio; | |
| 345 | + return hwb; | |
| 346 | + }, | |
| 347 | + | |
| 348 | + blacken(ratio) { | |
| 349 | + const hwb = this.hwb(); | |
| 350 | + hwb.color[2] += hwb.color[2] * ratio; | |
| 351 | + return hwb; | |
| 352 | + }, | |
| 353 | + | |
| 354 | + grayscale() { | |
| 355 | + // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale | |
| 356 | + const rgb = this.rgb().color; | |
| 357 | + const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11; | |
| 358 | + return Color.rgb(value, value, value); | |
| 359 | + }, | |
| 360 | + | |
| 361 | + fade(ratio) { | |
| 362 | + return this.alpha(this.valpha - (this.valpha * ratio)); | |
| 363 | + }, | |
| 364 | + | |
| 365 | + opaquer(ratio) { | |
| 366 | + return this.alpha(this.valpha + (this.valpha * ratio)); | |
| 367 | + }, | |
| 368 | + | |
| 369 | + rotate(degrees) { | |
| 370 | + const hsl = this.hsl(); | |
| 371 | + let hue = hsl.color[0]; | |
| 372 | + hue = (hue + degrees) % 360; | |
| 373 | + hue = hue < 0 ? 360 + hue : hue; | |
| 374 | + hsl.color[0] = hue; | |
| 375 | + return hsl; | |
| 376 | + }, | |
| 377 | + | |
| 378 | + mix(mixinColor, weight) { | |
| 379 | + // Ported from sass implementation in C | |
| 380 | + // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 | |
| 381 | + if (!mixinColor || !mixinColor.rgb) { | |
| 382 | + throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor); | |
| 383 | + } | |
| 384 | + | |
| 385 | + const color1 = mixinColor.rgb(); | |
| 386 | + const color2 = this.rgb(); | |
| 387 | + const p = weight === undefined ? 0.5 : weight; | |
| 388 | + | |
| 389 | + const w = 2 * p - 1; | |
| 390 | + const a = color1.alpha() - color2.alpha(); | |
| 391 | + | |
| 392 | + const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2; | |
| 393 | + const w2 = 1 - w1; | |
| 394 | + | |
| 395 | + return Color.rgb( | |
| 396 | + w1 * color1.red() + w2 * color2.red(), | |
| 397 | + w1 * color1.green() + w2 * color2.green(), | |
| 398 | + w1 * color1.blue() + w2 * color2.blue(), | |
| 399 | + color1.alpha() * p + color2.alpha() * (1 - p)); | |
| 400 | + }, | |
| 401 | +}; | |
| 402 | + | |
| 403 | +// Model conversion methods and static constructors | |
| 404 | +for (const model of Object.keys(convert)) { | |
| 405 | + if (skippedModels.includes(model)) { | |
| 406 | + continue; | |
| 407 | + } | |
| 408 | + | |
| 409 | + const {channels} = convert[model]; | |
| 410 | + | |
| 411 | + // Conversion methods | |
| 412 | + Color.prototype[model] = function (...args) { | |
| 413 | + if (this.model === model) { | |
| 414 | + return new Color(this); | |
| 415 | + } | |
| 416 | + | |
| 417 | + if (args.length > 0) { | |
| 418 | + return new Color(args, model); | |
| 419 | + } | |
| 420 | + | |
| 421 | + return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model); | |
| 422 | + }; | |
| 423 | + | |
| 424 | + // 'static' construction methods | |
| 425 | + Color[model] = function (...args) { | |
| 426 | + let color = args[0]; | |
| 427 | + if (typeof color === 'number') { | |
| 428 | + color = zeroArray(args, channels); | |
| 429 | + } | |
| 430 | + | |
| 431 | + return new Color(color, model); | |
| 432 | + }; | |
| 433 | +} | |
| 434 | + | |
| 435 | +function roundTo(number, places) { | |
| 436 | + return Number(number.toFixed(places)); | |
| 437 | +} | |
| 438 | + | |
| 439 | +function roundToPlace(places) { | |
| 440 | + return function (number) { | |
| 441 | + return roundTo(number, places); | |
| 442 | + }; | |
| 443 | +} | |
| 444 | + | |
| 445 | +function getset(model, channel, modifier) { | |
| 446 | + model = Array.isArray(model) ? model : [model]; | |
| 447 | + | |
| 448 | + for (const m of model) { | |
| 449 | + (limiters[m] || (limiters[m] = []))[channel] = modifier; | |
| 450 | + } | |
| 451 | + | |
| 452 | + model = model[0]; | |
| 453 | + | |
| 454 | + return function (value) { | |
| 455 | + let result; | |
| 456 | + | |
| 457 | + if (value !== undefined) { | |
| 458 | + if (modifier) { | |
| 459 | + value = modifier(value); | |
| 460 | + } | |
| 461 | + | |
| 462 | + result = this[model](); | |
| 463 | + result.color[channel] = value; | |
| 464 | + return result; | |
| 465 | + } | |
| 466 | + | |
| 467 | + result = this[model]().color[channel]; | |
| 468 | + if (modifier) { | |
| 469 | + result = modifier(result); | |
| 470 | + } | |
| 471 | + | |
| 472 | + return result; | |
| 473 | + }; | |
| 474 | +} | |
| 475 | + | |
| 476 | +function maxfn(max) { | |
| 477 | + return function (v) { | |
| 478 | + return Math.max(0, Math.min(max, v)); | |
| 479 | + }; | |
| 480 | +} | |
| 481 | + | |
| 482 | +function assertArray(value) { | |
| 483 | + return Array.isArray(value) ? value : [value]; | |
| 484 | +} | |
| 485 | + | |
| 486 | +function zeroArray(array, length) { | |
| 487 | + for (let i = 0; i < length; i++) { | |
| 488 | + if (typeof array[i] !== 'number') { | |
| 489 | + array[i] = 0; | |
| 490 | + } | |
| 491 | + } | |
| 492 | + | |
| 493 | + return array; | |
| 494 | +} | |
| 495 | + | |
| 496 | +export default Color; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/index.js
0 → 100644
| 1 | +import Color from './color'; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 转换颜色格式。 | |
| 5 | + * @param {Object} params - 参数对象。 | |
| 6 | + * @param {string} color - 输入的颜色,默认为 '#fff'。 | |
| 7 | + * @param {string} format - 需要转换的格式(支持 'rgb', 'hex', 'hsl', 'hsv', 'hwb')。 | |
| 8 | + * @param {string} type - 转换后的类型(支持 'string', 'object', 'array', 'round')。 | |
| 9 | + * @returns {string|Object|Array} 转换后的颜色表示。 | |
| 10 | + */ | |
| 11 | +function convertFormat(color = '#fff', format = 'rgb', type = 'string') { | |
| 12 | + let colorObj = Color(color); | |
| 13 | + // 如果格式存在 | |
| 14 | + if (colorObj[format]) { | |
| 15 | + // hex 无法直接转换为 除string类型外的任何类型 | |
| 16 | + // 所以转为rgb 后 获取其他类型 | |
| 17 | + if(format == 'hex' && type != 'string') format = 'rgb'; | |
| 18 | + // 类型名称 | |
| 19 | + let typeName = ''; | |
| 20 | + switch (type) { | |
| 21 | + case 'string': | |
| 22 | + typeName = 'toString'; | |
| 23 | + break; | |
| 24 | + case 'object': | |
| 25 | + typeName = 'object'; | |
| 26 | + break; | |
| 27 | + case 'array': | |
| 28 | + typeName = 'array'; | |
| 29 | + break; | |
| 30 | + case 'round': | |
| 31 | + typeName = 'round'; | |
| 32 | + break; | |
| 33 | + default: | |
| 34 | + throw Error('Unsupported target type:' + type) | |
| 35 | + } | |
| 36 | + return colorObj[format]()[typeName](); | |
| 37 | + } else { | |
| 38 | + throw Error('Unsupported target format: ' + format); | |
| 39 | + } | |
| 40 | +} | |
| 41 | + | |
| 42 | +/** | |
| 43 | + * 计算两个颜色之间的渐变值。 | |
| 44 | + * @param {string} startColor - 开始的颜色,默认为黑色。 | |
| 45 | + * @param {string} endColor - 结束的颜色,默认为白色。 | |
| 46 | + * @param {number} step - 渐变的步数,默认为10。 | |
| 47 | + * @returns {Array<string>} 两个颜色之间的渐变颜色数组。 | |
| 48 | + */ | |
| 49 | +function gradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) { | |
| 50 | + const startRGB = convertFormat(startColor, 'rgb', 'array') // 转换为rgb数组模式 | |
| 51 | + const startR = startRGB[0] | |
| 52 | + const startG = startRGB[1] | |
| 53 | + const startB = startRGB[2] | |
| 54 | + | |
| 55 | + const endRGB = convertFormat(endColor, 'rgb', 'array') | |
| 56 | + const endR = endRGB[0] | |
| 57 | + const endG = endRGB[1] | |
| 58 | + const endB = endRGB[2] | |
| 59 | + | |
| 60 | + const sR = (endR - startR) / step // 总差值 | |
| 61 | + const sG = (endG - startG) / step | |
| 62 | + const sB = (endB - startB) / step | |
| 63 | + const colorArr = [] | |
| 64 | + for (let i = 0; i < step; i++) { | |
| 65 | + // 计算每一步的hex值 | |
| 66 | + let hex = convertFormat(`rgb(${Math.round((sR * i + startR))},${Math.round((sG * i + startG))},${Math.round((sB | |
| 67 | + * i + startB))})`, 'hex') | |
| 68 | + // 确保第一个颜色值为startColor的值 | |
| 69 | + if (i === 0) hex = convertFormat(startColor, 'hex') | |
| 70 | + // 确保最后一个颜色值为endColor的值 | |
| 71 | + if (i === step - 1) hex = convertFormat(endColor, 'hex') | |
| 72 | + colorArr.push(hex) | |
| 73 | + } | |
| 74 | + return colorArr | |
| 75 | +} | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | +export default { | |
| 80 | + /** | |
| 81 | + * 格式转换。 | |
| 82 | + */ | |
| 83 | + convertFormat, | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 计算两个颜色之间的渐变值。 | |
| 87 | + */ | |
| 88 | + gradient, | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 增加颜色的亮度。 | |
| 92 | + * @param {string} color - 输入的颜色。 | |
| 93 | + * @param {number} value - 增加的亮度值(0-1)。 | |
| 94 | + * @returns {string} 调整后的颜色。 | |
| 95 | + */ | |
| 96 | + lighten: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).lighten(value), format, type), | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 减少颜色的亮度。 | |
| 100 | + * @param {string} color - 输入的颜色。 | |
| 101 | + * @param {number} value - 减少的亮度值(0-1)。 | |
| 102 | + * @returns {string} 调整后的颜色。 | |
| 103 | + */ | |
| 104 | + darken: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).darken(value), format, type), | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 增加颜色的饱和度。 | |
| 108 | + * @param {string} color - 输入的颜色。 | |
| 109 | + * @param {number} value - 增加的饱和度值(0-1)。 | |
| 110 | + * @returns {string} 调整后的颜色。 | |
| 111 | + */ | |
| 112 | + saturate: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).saturate(value), format, type), | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 减少颜色的饱和度。 | |
| 116 | + * @param {string} color - 输入的颜色。 | |
| 117 | + * @param {number} value - 减少的饱和度值(0-1)。 | |
| 118 | + * @returns {string} 调整后的颜色。 | |
| 119 | + */ | |
| 120 | + desaturate: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).desaturate(value), format, type), | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * 旋转颜色的色相。 | |
| 124 | + * @param {string} color - 输入的颜色。 | |
| 125 | + * @param {number} degrees - 旋转的度数。 | |
| 126 | + * @returns {string} 调整后的颜色。 | |
| 127 | + */ | |
| 128 | + rotate: (color, degrees, format = 'rgb', type = 'string') => convertFormat(Color(color).rotate(degrees), format, type), | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 调整颜色的透明度。 | |
| 132 | + * @param {string} color - 输入的颜色。 | |
| 133 | + * @param {number} value - 透明度值(0-1,其中 1 是不透明)。 | |
| 134 | + * @returns {string} 调整后的颜色。 | |
| 135 | + */ | |
| 136 | + adjustAlpha: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).alpha(value), format, type), | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 获取颜色的亮度。 | |
| 140 | + * @param {string} color - 输入的颜色。 | |
| 141 | + * @returns {number} 颜色的亮度值(0-1)。 | |
| 142 | + */ | |
| 143 | + luminosity: (color, format) => Color(color).luminosity(), | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 判断颜色是否为暗色。 | |
| 147 | + * @param {string} color - 输入的颜色。 | |
| 148 | + * @returns {boolean} 如果是暗色则返回 true,否则返回 false。 | |
| 149 | + */ | |
| 150 | + isDark: (color, format) => Color(color).isDark(), | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 判断颜色是否为亮色。 | |
| 154 | + * @param {string} color - 输入的颜色。 | |
| 155 | + * @returns {boolean} 如果是亮色则返回 true,否则返回 false。 | |
| 156 | + */ | |
| 157 | + isLight: (color, format) => Color(color).isLight() | |
| 158 | +}; | |
| 0 | 159 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/LICENSE
0 → 100644
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) 2015 JD Ballard | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/index.js
0 → 100644
| 1 | +export default function isArrayish(obj) { | |
| 2 | + if (!obj || typeof obj === 'string') { | |
| 3 | + return false; | |
| 4 | + } | |
| 5 | + | |
| 6 | + return obj instanceof Array || Array.isArray(obj) || | |
| 7 | + (obj.length >= 0 && (obj.splice instanceof Function || | |
| 8 | + (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String'))); | |
| 9 | +}; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "is-arrayish", | |
| 3 | + "description": "Determines if an object can be used as an array", | |
| 4 | + "version": "0.3.2", | |
| 5 | + "author": "Qix (http://github.com/qix-)", | |
| 6 | + "keywords": [ | |
| 7 | + "is", | |
| 8 | + "array", | |
| 9 | + "duck", | |
| 10 | + "type", | |
| 11 | + "arrayish", | |
| 12 | + "similar", | |
| 13 | + "proto", | |
| 14 | + "prototype", | |
| 15 | + "type" | |
| 16 | + ], | |
| 17 | + "license": "MIT", | |
| 18 | + "scripts": { | |
| 19 | + "test": "mocha --require coffeescript/register ./test/**/*.coffee", | |
| 20 | + "lint": "zeit-eslint --ext .jsx,.js .", | |
| 21 | + "lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint" | |
| 22 | + }, | |
| 23 | + "repository": { | |
| 24 | + "type": "git", | |
| 25 | + "url": "https://github.com/qix-/node-is-arrayish.git" | |
| 26 | + }, | |
| 27 | + "devDependencies": { | |
| 28 | + "@zeit/eslint-config-node": "^0.3.0", | |
| 29 | + "@zeit/git-hooks": "^0.1.4", | |
| 30 | + "coffeescript": "^2.3.1", | |
| 31 | + "coveralls": "^3.0.1", | |
| 32 | + "eslint": "^4.19.1", | |
| 33 | + "istanbul": "^0.4.5", | |
| 34 | + "mocha": "^5.2.0", | |
| 35 | + "should": "^13.2.1" | |
| 36 | + }, | |
| 37 | + "eslintConfig": { | |
| 38 | + "extends": [ | |
| 39 | + "@zeit/eslint-config-node" | |
| 40 | + ] | |
| 41 | + }, | |
| 42 | + "git": { | |
| 43 | + "pre-commit": "lint-staged" | |
| 44 | + } | |
| 45 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/LICENSE
0 → 100644
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) 2015 Josh Junon | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in | |
| 13 | +all copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 21 | +THE SOFTWARE. | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/index.js
0 → 100644
| 1 | +'use strict'; | |
| 2 | + | |
| 3 | +import isArrayish from '../is-arrayish'; | |
| 4 | + | |
| 5 | +var concat = Array.prototype.concat; | |
| 6 | +var slice = Array.prototype.slice; | |
| 7 | + | |
| 8 | +export default function swizzle(args) { | |
| 9 | + var results = []; | |
| 10 | + | |
| 11 | + for (var i = 0, len = args.length; i < len; i++) { | |
| 12 | + var arg = args[i]; | |
| 13 | + | |
| 14 | + if (isArrayish(arg)) { | |
| 15 | + // http://jsperf.com/javascript-array-concat-vs-push/98 | |
| 16 | + results = concat.call(results, slice.call(arg)); | |
| 17 | + } else { | |
| 18 | + results.push(arg); | |
| 19 | + } | |
| 20 | + } | |
| 21 | + | |
| 22 | + return results; | |
| 23 | +}; | |
| 24 | + | |
| 25 | +swizzle.wrap = function (fn) { | |
| 26 | + return function () { | |
| 27 | + return fn(swizzle(arguments)); | |
| 28 | + }; | |
| 29 | +}; | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "simple-swizzle", | |
| 3 | + "description": "Simply swizzle your arguments", | |
| 4 | + "version": "0.2.2", | |
| 5 | + "author": "Qix (http://github.com/qix-)", | |
| 6 | + "keywords": [ | |
| 7 | + "argument", | |
| 8 | + "arguments", | |
| 9 | + "swizzle", | |
| 10 | + "swizzling", | |
| 11 | + "parameter", | |
| 12 | + "parameters", | |
| 13 | + "mixed", | |
| 14 | + "array" | |
| 15 | + ], | |
| 16 | + "license": "MIT", | |
| 17 | + "scripts": { | |
| 18 | + "pretest": "xo", | |
| 19 | + "test": "mocha --compilers coffee:coffee-script/register" | |
| 20 | + }, | |
| 21 | + "files": [ | |
| 22 | + "index.js" | |
| 23 | + ], | |
| 24 | + "repository": "qix-/node-simple-swizzle", | |
| 25 | + "devDependencies": { | |
| 26 | + "coffee-script": "^1.9.3", | |
| 27 | + "coveralls": "^2.11.2", | |
| 28 | + "istanbul": "^0.3.17", | |
| 29 | + "mocha": "^2.2.5", | |
| 30 | + "should": "^7.0.1", | |
| 31 | + "xo": "^0.7.1" | |
| 32 | + }, | |
| 33 | + "dependencies": { | |
| 34 | + "is-arrayish": "^0.3.1" | |
| 35 | + } | |
| 36 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/debounce.js
0 → 100644
| 1 | +let timeout = null | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数 | |
| 5 | + * | |
| 6 | + * @param {Function} func 要执行的回调函数 | |
| 7 | + * @param {Number} wait 延时的时间 | |
| 8 | + * @param {Boolean} immediate 是否立即执行 | |
| 9 | + * @return null | |
| 10 | + */ | |
| 11 | +function debounce(func, wait = 500, immediate = false) { | |
| 12 | + // 清除定时器 | |
| 13 | + if (timeout !== null) clearTimeout(timeout) | |
| 14 | + // 立即执行,此类情况一般用不到 | |
| 15 | + if (immediate) { | |
| 16 | + const callNow = !timeout | |
| 17 | + timeout = setTimeout(() => { | |
| 18 | + timeout = null | |
| 19 | + }, wait) | |
| 20 | + if (callNow) typeof func === 'function' && func() | |
| 21 | + } else { | |
| 22 | + // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 | |
| 23 | + timeout = setTimeout(() => { | |
| 24 | + typeof func === 'function' && func() | |
| 25 | + }, wait) | |
| 26 | + } | |
| 27 | +} | |
| 28 | + | |
| 29 | +export default debounce | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/digit.js
0 → 100644
| 1 | +let _boundaryCheckingState = true; // 是否进行越界检查的全局开关 | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 把错误的数据转正 | |
| 5 | + * @private | |
| 6 | + * @example strip(0.09999999999999998)=0.1 | |
| 7 | + */ | |
| 8 | +function strip(num, precision = 15) { | |
| 9 | + return +parseFloat(Number(num).toPrecision(precision)); | |
| 10 | +} | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Return digits length of a number | |
| 14 | + * @private | |
| 15 | + * @param {*number} num Input number | |
| 16 | + */ | |
| 17 | +function digitLength(num) { | |
| 18 | + // Get digit length of e | |
| 19 | + const eSplit = num.toString().split(/[eE]/); | |
| 20 | + const len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0); | |
| 21 | + return len > 0 ? len : 0; | |
| 22 | +} | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * 把小数转成整数,如果是小数则放大成整数 | |
| 26 | + * @private | |
| 27 | + * @param {*number} num 输入数 | |
| 28 | + */ | |
| 29 | +function float2Fixed(num) { | |
| 30 | + if (num.toString().indexOf('e') === -1) { | |
| 31 | + return Number(num.toString().replace('.', '')); | |
| 32 | + } | |
| 33 | + const dLen = digitLength(num); | |
| 34 | + return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num); | |
| 35 | +} | |
| 36 | + | |
| 37 | +/** | |
| 38 | + * 检测数字是否越界,如果越界给出提示 | |
| 39 | + * @private | |
| 40 | + * @param {*number} num 输入数 | |
| 41 | + */ | |
| 42 | +function checkBoundary(num) { | |
| 43 | + if (_boundaryCheckingState) { | |
| 44 | + if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) { | |
| 45 | + console.warn(`${num} 超出了精度限制,结果可能不正确`); | |
| 46 | + } | |
| 47 | + } | |
| 48 | +} | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * 把递归操作扁平迭代化 | |
| 52 | + * @param {number[]} arr 要操作的数字数组 | |
| 53 | + * @param {function} operation 迭代操作 | |
| 54 | + * @private | |
| 55 | + */ | |
| 56 | +function iteratorOperation(arr, operation) { | |
| 57 | + const [num1, num2, ...others] = arr; | |
| 58 | + let res = operation(num1, num2); | |
| 59 | + | |
| 60 | + others.forEach((num) => { | |
| 61 | + res = operation(res, num); | |
| 62 | + }); | |
| 63 | + | |
| 64 | + return res; | |
| 65 | +} | |
| 66 | + | |
| 67 | +/** | |
| 68 | + * 高精度乘法 | |
| 69 | + * @export | |
| 70 | + */ | |
| 71 | +export function times(...nums) { | |
| 72 | + if (nums.length > 2) { | |
| 73 | + return iteratorOperation(nums, times); | |
| 74 | + } | |
| 75 | + | |
| 76 | + const [num1, num2] = nums; | |
| 77 | + const num1Changed = float2Fixed(num1); | |
| 78 | + const num2Changed = float2Fixed(num2); | |
| 79 | + const baseNum = digitLength(num1) + digitLength(num2); | |
| 80 | + const leftValue = num1Changed * num2Changed; | |
| 81 | + | |
| 82 | + checkBoundary(leftValue); | |
| 83 | + | |
| 84 | + return leftValue / Math.pow(10, baseNum); | |
| 85 | +} | |
| 86 | + | |
| 87 | +/** | |
| 88 | + * 高精度加法 | |
| 89 | + * @export | |
| 90 | + */ | |
| 91 | +export function plus(...nums) { | |
| 92 | + if (nums.length > 2) { | |
| 93 | + return iteratorOperation(nums, plus); | |
| 94 | + } | |
| 95 | + | |
| 96 | + const [num1, num2] = nums; | |
| 97 | + // 取最大的小数位 | |
| 98 | + const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2))); | |
| 99 | + // 把小数都转为整数然后再计算 | |
| 100 | + return (times(num1, baseNum) + times(num2, baseNum)) / baseNum; | |
| 101 | +} | |
| 102 | + | |
| 103 | +/** | |
| 104 | + * 高精度减法 | |
| 105 | + * @export | |
| 106 | + */ | |
| 107 | +export function minus(...nums) { | |
| 108 | + if (nums.length > 2) { | |
| 109 | + return iteratorOperation(nums, minus); | |
| 110 | + } | |
| 111 | + | |
| 112 | + const [num1, num2] = nums; | |
| 113 | + const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2))); | |
| 114 | + return (times(num1, baseNum) - times(num2, baseNum)) / baseNum; | |
| 115 | +} | |
| 116 | + | |
| 117 | +/** | |
| 118 | + * 高精度除法 | |
| 119 | + * @export | |
| 120 | + */ | |
| 121 | +export function divide(...nums) { | |
| 122 | + if (nums.length > 2) { | |
| 123 | + return iteratorOperation(nums, divide); | |
| 124 | + } | |
| 125 | + | |
| 126 | + const [num1, num2] = nums; | |
| 127 | + const num1Changed = float2Fixed(num1); | |
| 128 | + const num2Changed = float2Fixed(num2); | |
| 129 | + checkBoundary(num1Changed); | |
| 130 | + checkBoundary(num2Changed); | |
| 131 | + // 重要,这里必须用strip进行修正 | |
| 132 | + return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1)))); | |
| 133 | +} | |
| 134 | + | |
| 135 | +/** | |
| 136 | + * 四舍五入 | |
| 137 | + * @export | |
| 138 | + */ | |
| 139 | +export function round(num, ratio) { | |
| 140 | + const base = Math.pow(10, ratio); | |
| 141 | + let result = divide(Math.round(Math.abs(times(num, base))), base); | |
| 142 | + if (num < 0 && result !== 0) { | |
| 143 | + result = times(result, -1); | |
| 144 | + } | |
| 145 | + // 位数不足则补0 | |
| 146 | + return result; | |
| 147 | +} | |
| 148 | + | |
| 149 | +/** | |
| 150 | + * 是否进行边界检查,默认开启 | |
| 151 | + * @param flag 标记开关,true 为开启,false 为关闭,默认为 true | |
| 152 | + * @export | |
| 153 | + */ | |
| 154 | +export function enableBoundaryChecking(flag = true) { | |
| 155 | + _boundaryCheckingState = flag; | |
| 156 | +} | |
| 157 | + | |
| 158 | + | |
| 159 | +export default { | |
| 160 | + times, | |
| 161 | + plus, | |
| 162 | + minus, | |
| 163 | + divide, | |
| 164 | + round, | |
| 165 | + enableBoundaryChecking, | |
| 166 | +}; | |
| 167 | + | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/index.js
0 → 100644
| 1 | +import { number, empty } from './test.js' | |
| 2 | +import { round } from './digit.js' | |
| 3 | +// 颜色操作方法 | |
| 4 | +import Color from './color' | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @description 如果value小于min,取min;如果value大于max,取max | |
| 8 | + * @param {number} min | |
| 9 | + * @param {number} max | |
| 10 | + * @param {number} value | |
| 11 | + */ | |
| 12 | +function range(min = 0, max = 0, value = 0) { | |
| 13 | + return Math.max(min, Math.min(max, Number(value))) | |
| 14 | +} | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换 | |
| 18 | + * @param {number|string} value 用户传递值的px值 | |
| 19 | + * @param {boolean} unit | |
| 20 | + * @returns {number|string} | |
| 21 | + */ | |
| 22 | +function getPx(value, unit = false) { | |
| 23 | + if (number(value)) { | |
| 24 | + return unit ? `${value}px` : Number(value) | |
| 25 | + } | |
| 26 | + // 如果带有rpx,先取出其数值部分,再转为px值 | |
| 27 | + if (/(rpx|upx)$/.test(value)) { | |
| 28 | + return unit ? `${uni.upx2px(parseInt(value))}px` : Number(uni.upx2px(parseInt(value))) | |
| 29 | + } | |
| 30 | + return unit ? `${parseInt(value)}px` : parseInt(value) | |
| 31 | +} | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * @description 进行延时,以达到可以简写代码的目的 比如: await uni.$w.sleep(20)将会阻塞20ms | |
| 35 | + * @param {number} value 堵塞时间 单位ms 毫秒 | |
| 36 | + * @returns {Promise} 返回promise | |
| 37 | + */ | |
| 38 | +function sleep(value = 30) { | |
| 39 | + return new Promise((resolve) => { | |
| 40 | + setTimeout(() => { | |
| 41 | + resolve() | |
| 42 | + }, value) | |
| 43 | + }) | |
| 44 | +} | |
| 45 | +/** | |
| 46 | + * @description 运行期判断平台 | |
| 47 | + * @returns {string} 返回所在平台(小写) | |
| 48 | + * @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台 | |
| 49 | + */ | |
| 50 | +function os() { | |
| 51 | + return uni.getSystemInfoSync().platform.toLowerCase() | |
| 52 | +} | |
| 53 | +/** | |
| 54 | + * @description 获取系统信息同步接口 | |
| 55 | + * @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync | |
| 56 | + */ | |
| 57 | +function sys() { | |
| 58 | + return uni.getSystemInfoSync() | |
| 59 | +} | |
| 60 | + | |
| 61 | +/** | |
| 62 | + * @description 取一个区间数 | |
| 63 | + * @param {Number} min 最小值 | |
| 64 | + * @param {Number} max 最大值 | |
| 65 | + */ | |
| 66 | +function random(min, max) { | |
| 67 | + if (min >= 0 && max > 0 && max >= min) { | |
| 68 | + const gab = max - min + 1 | |
| 69 | + return Math.floor(Math.random() * gab + min) | |
| 70 | + } | |
| 71 | + return 0 | |
| 72 | +} | |
| 73 | + | |
| 74 | +/** | |
| 75 | + * @param {Number} len uuid的长度 | |
| 76 | + * @param {Boolean} firstU 将返回的首字母置为"u" | |
| 77 | + * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制 | |
| 78 | + */ | |
| 79 | +function guid(len = 32, firstU = true, radix = null) { | |
| 80 | + const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') | |
| 81 | + const uuid = [] | |
| 82 | + radix = radix || chars.length | |
| 83 | + | |
| 84 | + if (len) { | |
| 85 | + // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位 | |
| 86 | + for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix] | |
| 87 | + } else { | |
| 88 | + let r | |
| 89 | + // rfc4122标准要求返回的uuid中,某些位为固定的字符 | |
| 90 | + uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-' | |
| 91 | + uuid[14] = '4' | |
| 92 | + | |
| 93 | + for (let i = 0; i < 36; i++) { | |
| 94 | + if (!uuid[i]) { | |
| 95 | + r = 0 | Math.random() * 16 | |
| 96 | + uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r] | |
| 97 | + } | |
| 98 | + } | |
| 99 | + } | |
| 100 | + // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class | |
| 101 | + if (firstU) { | |
| 102 | + uuid.shift() | |
| 103 | + return `u${uuid.join('')}` | |
| 104 | + } | |
| 105 | + return uuid.join('') | |
| 106 | +} | |
| 107 | + | |
| 108 | +/** | |
| 109 | +* @description 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法 | |
| 110 | + this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx | |
| 111 | + 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name | |
| 112 | + 值(默认为undefined),就是查找最顶层的$parent | |
| 113 | +* @param {string|undefined} name 父组件的参数名 | |
| 114 | +*/ | |
| 115 | +function $parent(name = undefined) { | |
| 116 | + let parent = this.$parent | |
| 117 | + // 通过while历遍,这里主要是为了H5需要多层解析的问题 | |
| 118 | + while (parent) { | |
| 119 | + // 父组件 | |
| 120 | + if (parent.$options && parent.$options.name !== name) { | |
| 121 | + // 如果组件的name不相等,继续上一级寻找 | |
| 122 | + parent = parent.$parent | |
| 123 | + } else { | |
| 124 | + return parent | |
| 125 | + } | |
| 126 | + } | |
| 127 | + return false | |
| 128 | +} | |
| 129 | + | |
| 130 | +/** | |
| 131 | + * @description 样式转换 | |
| 132 | + * 对象转字符串,或者字符串转对象 | |
| 133 | + * @param {object | string} customStyle 需要转换的目标 | |
| 134 | + * @param {String} target 转换的目的,object-转为对象,string-转为字符串 | |
| 135 | + * @returns {object|string} | |
| 136 | + */ | |
| 137 | +function addStyle(customStyle, target = 'object') { | |
| 138 | + // 字符串转字符串,对象转对象情形,直接返回 | |
| 139 | + if (empty(customStyle) || typeof(customStyle) === 'object' && target === 'object' || target === 'string' && | |
| 140 | + typeof(customStyle) === 'string') { | |
| 141 | + return customStyle | |
| 142 | + } | |
| 143 | + // 字符串转对象 | |
| 144 | + if (target === 'object') { | |
| 145 | + // 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的 | |
| 146 | + customStyle = trim(customStyle) | |
| 147 | + // 根据";"将字符串转为数组形式 | |
| 148 | + const styleArray = customStyle.split(';') | |
| 149 | + const style = {} | |
| 150 | + // 历遍数组,拼接成对象 | |
| 151 | + for (let i = 0; i < styleArray.length; i++) { | |
| 152 | + // 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤 | |
| 153 | + if (styleArray[i]) { | |
| 154 | + const item = styleArray[i].split(':') | |
| 155 | + style[trim(item[0])] = trim(item[1]) | |
| 156 | + } | |
| 157 | + } | |
| 158 | + return style | |
| 159 | + } | |
| 160 | + // 这里为对象转字符串形式 | |
| 161 | + let string = '' | |
| 162 | + for (const i in customStyle) { | |
| 163 | + // 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名 | |
| 164 | + const key = i.replace(/([A-Z])/g, '-$1').toLowerCase() | |
| 165 | + string += `${key}:${customStyle[i]};` | |
| 166 | + } | |
| 167 | + // 去除两端空格 | |
| 168 | + return trim(string) | |
| 169 | +} | |
| 170 | + | |
| 171 | +/** | |
| 172 | + * @description 添加单位,如果有rpx,upx,%,px等单位结尾或者值为auto,直接返回,否则加上px单位结尾 | |
| 173 | + * @param {string|number} value 需要添加单位的值 | |
| 174 | + * @param {string} unit 添加的单位名 比如px | |
| 175 | + */ | |
| 176 | +function addUnit(value = 'auto', unit = uni?.$w?.config?.unit ? uni?.$w?.config?.unit : 'px') { | |
| 177 | + value = String(value) | |
| 178 | + // 用wuui内置验证规则中的number判断是否为数值 | |
| 179 | + return number(value) ? `${value}${unit}` : value | |
| 180 | +} | |
| 181 | + | |
| 182 | +/** | |
| 183 | + * @description 深度克隆 | |
| 184 | + * @param {object} obj 需要深度克隆的对象 | |
| 185 | + * @param cache 缓存 | |
| 186 | + * @returns {*} 克隆后的对象或者原值(不是对象) | |
| 187 | + */ | |
| 188 | +function deepClone(obj, cache = new WeakMap()) { | |
| 189 | + if (obj === null || typeof obj !== 'object') return obj; | |
| 190 | + if (cache.has(obj)) return cache.get(obj); | |
| 191 | + let clone; | |
| 192 | + if (obj instanceof Date) { | |
| 193 | + clone = new Date(obj.getTime()); | |
| 194 | + } else if (obj instanceof RegExp) { | |
| 195 | + clone = new RegExp(obj); | |
| 196 | + } else if (obj instanceof Map) { | |
| 197 | + clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)])); | |
| 198 | + } else if (obj instanceof Set) { | |
| 199 | + clone = new Set(Array.from(obj, value => deepClone(value, cache))); | |
| 200 | + } else if (Array.isArray(obj)) { | |
| 201 | + clone = obj.map(value => deepClone(value, cache)); | |
| 202 | + } else if (Object.prototype.toString.call(obj) === '[object Object]') { | |
| 203 | + clone = Object.create(Object.getPrototypeOf(obj)); | |
| 204 | + cache.set(obj, clone); | |
| 205 | + for (const [key, value] of Object.entries(obj)) { | |
| 206 | + clone[key] = deepClone(value, cache); | |
| 207 | + } | |
| 208 | + } else { | |
| 209 | + clone = Object.assign({}, obj); | |
| 210 | + } | |
| 211 | + cache.set(obj, clone); | |
| 212 | + return clone; | |
| 213 | +} | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * @description JS对象深度合并 | |
| 217 | + * @param {object} target 需要拷贝的对象 | |
| 218 | + * @param {object} source 拷贝的来源对象 | |
| 219 | + * @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象) | |
| 220 | + */ | |
| 221 | +function deepMerge(target = {}, source = {}) { | |
| 222 | + target = deepClone(target) | |
| 223 | + if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target; | |
| 224 | + const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target); | |
| 225 | + for (const prop in source) { | |
| 226 | + if (!source.hasOwnProperty(prop)) continue; | |
| 227 | + const sourceValue = source[prop]; | |
| 228 | + const targetValue = merged[prop]; | |
| 229 | + if (sourceValue instanceof Date) { | |
| 230 | + merged[prop] = new Date(sourceValue); | |
| 231 | + } else if (sourceValue instanceof RegExp) { | |
| 232 | + merged[prop] = new RegExp(sourceValue); | |
| 233 | + } else if (sourceValue instanceof Map) { | |
| 234 | + merged[prop] = new Map(sourceValue); | |
| 235 | + } else if (sourceValue instanceof Set) { | |
| 236 | + merged[prop] = new Set(sourceValue); | |
| 237 | + } else if (typeof sourceValue === 'object' && sourceValue !== null) { | |
| 238 | + merged[prop] = deepMerge(targetValue, sourceValue); | |
| 239 | + } else { | |
| 240 | + merged[prop] = sourceValue; | |
| 241 | + } | |
| 242 | + } | |
| 243 | + return merged; | |
| 244 | +} | |
| 245 | + | |
| 246 | +/** | |
| 247 | + * @description error提示 | |
| 248 | + * @param {*} err 错误内容 | |
| 249 | + */ | |
| 250 | +function error(err) { | |
| 251 | + // 开发环境才提示,生产环境不会提示 | |
| 252 | + if (process.env.NODE_ENV === 'development') { | |
| 253 | + console.error(`wuui提示:${err}`) | |
| 254 | + } | |
| 255 | +} | |
| 256 | + | |
| 257 | +/** | |
| 258 | + * @description 打乱数组 | |
| 259 | + * @param {array} array 需要打乱的数组 | |
| 260 | + * @returns {array} 打乱后的数组 | |
| 261 | + */ | |
| 262 | +function randomArray(array = []) { | |
| 263 | + // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0 | |
| 264 | + return array.sort(() => Math.random() - 0.5) | |
| 265 | +} | |
| 266 | + | |
| 267 | +// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序 | |
| 268 | +// 所以这里做一个兼容polyfill的兼容处理 | |
| 269 | +if (!String.prototype.padStart) { | |
| 270 | + // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解 | |
| 271 | + String.prototype.padStart = function(maxLength, fillString = ' ') { | |
| 272 | + if (Object.prototype.toString.call(fillString) !== '[object String]') { | |
| 273 | + throw new TypeError( | |
| 274 | + 'fillString must be String' | |
| 275 | + ) | |
| 276 | + } | |
| 277 | + const str = this | |
| 278 | + // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉 | |
| 279 | + if (str.length >= maxLength) return String(str) | |
| 280 | + | |
| 281 | + const fillLength = maxLength - str.length | |
| 282 | + let times = Math.ceil(fillLength / fillString.length) | |
| 283 | + while (times >>= 1) { | |
| 284 | + fillString += fillString | |
| 285 | + if (times === 1) { | |
| 286 | + fillString += fillString | |
| 287 | + } | |
| 288 | + } | |
| 289 | + return fillString.slice(0, fillLength) + str | |
| 290 | + } | |
| 291 | +} | |
| 292 | + | |
| 293 | +/** | |
| 294 | + * @description 格式化时间 | |
| 295 | + * @param {String|Number} dateTime 需要格式化的时间戳 | |
| 296 | + * @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd | |
| 297 | + * @returns {string} 返回格式化后的字符串 | |
| 298 | + */ | |
| 299 | +function timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') { | |
| 300 | + let date | |
| 301 | + // 若传入时间为假值,则取当前时间 | |
| 302 | + if (!dateTime) { | |
| 303 | + date = new Date() | |
| 304 | + } | |
| 305 | + // 若为unix秒时间戳,则转为毫秒时间戳(逻辑有点奇怪,但不敢改,以保证历史兼容) | |
| 306 | + else if (/^\d{10}$/.test(dateTime?.toString().trim())) { | |
| 307 | + date = new Date(dateTime * 1000) | |
| 308 | + } | |
| 309 | + // 若用户传入字符串格式时间戳,new Date无法解析,需做兼容 | |
| 310 | + else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) { | |
| 311 | + date = new Date(Number(dateTime)) | |
| 312 | + } | |
| 313 | + // 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间 | |
| 314 | + // 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03' | |
| 315 | + else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) { | |
| 316 | + date = new Date(dateTime.replace(/-/g, '/')) | |
| 317 | + } | |
| 318 | + // 其他都认为符合 RFC 2822 规范 | |
| 319 | + else { | |
| 320 | + date = new Date(dateTime) | |
| 321 | + } | |
| 322 | + | |
| 323 | + const timeSource = { | |
| 324 | + 'y': date.getFullYear().toString(), // 年 | |
| 325 | + 'm': (date.getMonth() + 1).toString().padStart(2, '0'), // 月 | |
| 326 | + 'd': date.getDate().toString().padStart(2, '0'), // 日 | |
| 327 | + 'h': date.getHours().toString().padStart(2, '0'), // 时 | |
| 328 | + 'M': date.getMinutes().toString().padStart(2, '0'), // 分 | |
| 329 | + 's': date.getSeconds().toString().padStart(2, '0') // 秒 | |
| 330 | + // 有其他格式化字符需求可以继续添加,必须转化成字符串 | |
| 331 | + } | |
| 332 | + | |
| 333 | + for (const key in timeSource) { | |
| 334 | + const [ret] = new RegExp(`${key}+`).exec(formatStr) || [] | |
| 335 | + if (ret) { | |
| 336 | + // 年可能只需展示两位 | |
| 337 | + const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0 | |
| 338 | + formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex)) | |
| 339 | + } | |
| 340 | + } | |
| 341 | + | |
| 342 | + return formatStr | |
| 343 | +} | |
| 344 | + | |
| 345 | +/** | |
| 346 | + * @description 时间戳转为多久之前 | |
| 347 | + * @param {String|Number} timestamp 时间戳 | |
| 348 | + * @param {String|Boolean} format | |
| 349 | + * 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式; | |
| 350 | + * 如果为布尔值false,无论什么时间,都返回多久以前的格式 | |
| 351 | + * @returns {string} 转化后的内容 | |
| 352 | + */ | |
| 353 | +function timeFrom(timestamp = null, format = 'yyyy-mm-dd') { | |
| 354 | + if (timestamp == null) timestamp = Number(new Date()) | |
| 355 | + timestamp = parseInt(timestamp) | |
| 356 | + // 判断用户输入的时间戳是秒还是毫秒,一般前端js获取的时间戳是毫秒(13位),后端传过来的为秒(10位) | |
| 357 | + if (timestamp.toString().length == 10) timestamp *= 1000 | |
| 358 | + let timer = (new Date()).getTime() - timestamp | |
| 359 | + timer = parseInt(timer / 1000) | |
| 360 | + // 如果小于5分钟,则返回"刚刚",其他以此类推 | |
| 361 | + let tips = '' | |
| 362 | + switch (true) { | |
| 363 | + case timer < 300: | |
| 364 | + tips = '刚刚' | |
| 365 | + break | |
| 366 | + case timer >= 300 && timer < 3600: | |
| 367 | + tips = `${parseInt(timer / 60)}分钟前` | |
| 368 | + break | |
| 369 | + case timer >= 3600 && timer < 86400: | |
| 370 | + tips = `${parseInt(timer / 3600)}小时前` | |
| 371 | + break | |
| 372 | + case timer >= 86400 && timer < 2592000: | |
| 373 | + tips = `${parseInt(timer / 86400)}天前` | |
| 374 | + break | |
| 375 | + default: | |
| 376 | + // 如果format为false,则无论什么时间戳,都显示xx之前 | |
| 377 | + if (format === false) { | |
| 378 | + if (timer >= 2592000 && timer < 365 * 86400) { | |
| 379 | + tips = `${parseInt(timer / (86400 * 30))}个月前` | |
| 380 | + } else { | |
| 381 | + tips = `${parseInt(timer / (86400 * 365))}年前` | |
| 382 | + } | |
| 383 | + } else { | |
| 384 | + tips = timeFormat(timestamp, format) | |
| 385 | + } | |
| 386 | + } | |
| 387 | + return tips | |
| 388 | +} | |
| 389 | + | |
| 390 | +/** | |
| 391 | + * @description 去除空格 | |
| 392 | + * @param String str 需要去除空格的字符串 | |
| 393 | + * @param String pos both(左右)|left|right|all 默认both | |
| 394 | + */ | |
| 395 | +function trim(str, pos = 'both') { | |
| 396 | + str = String(str) | |
| 397 | + if (pos == 'both') { | |
| 398 | + return str.replace(/^\s+|\s+$/g, '') | |
| 399 | + } | |
| 400 | + if (pos == 'left') { | |
| 401 | + return str.replace(/^\s*/, '') | |
| 402 | + } | |
| 403 | + if (pos == 'right') { | |
| 404 | + return str.replace(/(\s*$)/g, '') | |
| 405 | + } | |
| 406 | + if (pos == 'all') { | |
| 407 | + return str.replace(/\s+/g, '') | |
| 408 | + } | |
| 409 | + return str | |
| 410 | +} | |
| 411 | + | |
| 412 | +/** | |
| 413 | + * @description 对象转url参数 | |
| 414 | + * @param {object} data,对象 | |
| 415 | + * @param {Boolean} isPrefix,是否自动加上"?" | |
| 416 | + * @param {string} arrayFormat 规则 indices|brackets|repeat|comma | |
| 417 | + */ | |
| 418 | +function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') { | |
| 419 | + const prefix = isPrefix ? '?' : '' | |
| 420 | + const _result = [] | |
| 421 | + if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets' | |
| 422 | + for (const key in data) { | |
| 423 | + const value = data[key] | |
| 424 | + // 去掉为空的参数 | |
| 425 | + if (['', undefined, null].indexOf(value) >= 0) { | |
| 426 | + continue | |
| 427 | + } | |
| 428 | + // 如果值为数组,另行处理 | |
| 429 | + if (value.constructor === Array) { | |
| 430 | + // e.g. {ids: [1, 2, 3]} | |
| 431 | + switch (arrayFormat) { | |
| 432 | + case 'indices': | |
| 433 | + // 结果: ids[0]=1&ids[1]=2&ids[2]=3 | |
| 434 | + for (let i = 0; i < value.length; i++) { | |
| 435 | + _result.push(`${key}[${i}]=${value[i]}`) | |
| 436 | + } | |
| 437 | + break | |
| 438 | + case 'brackets': | |
| 439 | + // 结果: ids[]=1&ids[]=2&ids[]=3 | |
| 440 | + value.forEach((_value) => { | |
| 441 | + _result.push(`${key}[]=${_value}`) | |
| 442 | + }) | |
| 443 | + break | |
| 444 | + case 'repeat': | |
| 445 | + // 结果: ids=1&ids=2&ids=3 | |
| 446 | + value.forEach((_value) => { | |
| 447 | + _result.push(`${key}=${_value}`) | |
| 448 | + }) | |
| 449 | + break | |
| 450 | + case 'comma': | |
| 451 | + // 结果: ids=1,2,3 | |
| 452 | + let commaStr = '' | |
| 453 | + value.forEach((_value) => { | |
| 454 | + commaStr += (commaStr ? ',' : '') + _value | |
| 455 | + }) | |
| 456 | + _result.push(`${key}=${commaStr}`) | |
| 457 | + break | |
| 458 | + default: | |
| 459 | + value.forEach((_value) => { | |
| 460 | + _result.push(`${key}[]=${_value}`) | |
| 461 | + }) | |
| 462 | + } | |
| 463 | + } else { | |
| 464 | + _result.push(`${key}=${value}`) | |
| 465 | + } | |
| 466 | + } | |
| 467 | + return _result.length ? prefix + _result.join('&') : '' | |
| 468 | +} | |
| 469 | + | |
| 470 | +/** | |
| 471 | + * 显示消息提示框 | |
| 472 | + * @param {String} title 提示的内容,长度与 icon 取值有关。 | |
| 473 | + * @param {Number} duration 提示的延迟时间,单位毫秒,默认:2000 | |
| 474 | + */ | |
| 475 | +function toast(title, duration = 2000) { | |
| 476 | + uni.showToast({ | |
| 477 | + title: String(title), | |
| 478 | + icon: 'none', | |
| 479 | + duration | |
| 480 | + }) | |
| 481 | +} | |
| 482 | + | |
| 483 | +/** | |
| 484 | + * @description 根据主题type值,获取对应的图标 | |
| 485 | + * @param {String} type 主题名称,primary|info|error|warning|success | |
| 486 | + * @param {boolean} fill 是否使用fill填充实体的图标 | |
| 487 | + */ | |
| 488 | +function type2icon(type = 'success', fill = false) { | |
| 489 | + // 如果非预置值,默认为success | |
| 490 | + if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success' | |
| 491 | + let iconName = '' | |
| 492 | + // 目前(2019-12-12),info和primary使用同一个图标 | |
| 493 | + switch (type) { | |
| 494 | + case 'primary': | |
| 495 | + iconName = 'info-circle' | |
| 496 | + break | |
| 497 | + case 'info': | |
| 498 | + iconName = 'info-circle' | |
| 499 | + break | |
| 500 | + case 'error': | |
| 501 | + iconName = 'close-circle' | |
| 502 | + break | |
| 503 | + case 'warning': | |
| 504 | + iconName = 'error-circle' | |
| 505 | + break | |
| 506 | + case 'success': | |
| 507 | + iconName = 'checkmark-circle' | |
| 508 | + break | |
| 509 | + default: | |
| 510 | + iconName = 'checkmark-circle' | |
| 511 | + } | |
| 512 | + // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的 | |
| 513 | + if (fill) iconName += '-fill' | |
| 514 | + return iconName | |
| 515 | +} | |
| 516 | + | |
| 517 | +/** | |
| 518 | + * @description 数字格式化 | |
| 519 | + * @param {number|string} number 要格式化的数字 | |
| 520 | + * @param {number} decimals 保留几位小数 | |
| 521 | + * @param {string} decimalPoint 小数点符号 | |
| 522 | + * @param {string} thousandsSeparator 千分位符号 | |
| 523 | + * @returns {string} 格式化后的数字 | |
| 524 | + */ | |
| 525 | +function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') { | |
| 526 | + number = (`${number}`).replace(/[^0-9+-Ee.]/g, '') | |
| 527 | + const n = !isFinite(+number) ? 0 : +number | |
| 528 | + const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals) | |
| 529 | + const sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator | |
| 530 | + const dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint | |
| 531 | + let s = '' | |
| 532 | + | |
| 533 | + s = (prec ? round(n, prec) + '' : `${Math.round(n)}`).split('.') | |
| 534 | + const re = /(-?\d+)(\d{3})/ | |
| 535 | + while (re.test(s[0])) { | |
| 536 | + s[0] = s[0].replace(re, `$1${sep}$2`) | |
| 537 | + } | |
| 538 | + | |
| 539 | + if ((s[1] || '').length < prec) { | |
| 540 | + s[1] = s[1] || '' | |
| 541 | + s[1] += new Array(prec - s[1].length + 1).join('0') | |
| 542 | + } | |
| 543 | + return s.join(dec) | |
| 544 | +} | |
| 545 | + | |
| 546 | +/** | |
| 547 | + * @description 获取duration值 | |
| 548 | + * 如果带有ms或者s直接返回,如果大于一定值,认为是ms单位,小于一定值,认为是s单位 | |
| 549 | + * 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画 | |
| 550 | + * @param {String|number} value 比如: "1s"|"100ms"|1|100 | |
| 551 | + * @param {boolean} unit 提示: 如果是false 默认返回number | |
| 552 | + * @return {string|number} | |
| 553 | + */ | |
| 554 | +function getDuration(value, unit = true) { | |
| 555 | + const valueNum = parseInt(value) | |
| 556 | + if (unit) { | |
| 557 | + if (/s$/.test(value)) return value | |
| 558 | + return value > 30 ? `${value}ms` : `${value}s` | |
| 559 | + } | |
| 560 | + if (/ms$/.test(value)) return valueNum | |
| 561 | + if (/s$/.test(value)) return valueNum > 30 ? valueNum : valueNum * 1000 | |
| 562 | + return valueNum | |
| 563 | +} | |
| 564 | + | |
| 565 | +/** | |
| 566 | + * @description 日期的月或日补零操作 | |
| 567 | + * @param {String} value 需要补零的值 | |
| 568 | + */ | |
| 569 | +function padZero(value) { | |
| 570 | + return `00${value}`.slice(-2) | |
| 571 | +} | |
| 572 | + | |
| 573 | +/** | |
| 574 | + * @description 在wu-form的子组件内容发生变化,或者失去焦点时,尝试通知wu-form执行校验方法 | |
| 575 | + * @param {*} instance | |
| 576 | + * @param {*} event | |
| 577 | + */ | |
| 578 | +function formValidate(instance, event) { | |
| 579 | + const formItem = $parent.call(instance, 'wu-form-item') | |
| 580 | + const form = $parent.call(instance, 'wu-form') | |
| 581 | + // 如果发生变化的input或者textarea等,其父组件中有wu-form-item或者wu-form等,就执行form的validate方法 | |
| 582 | + // 同时将form-item的pros传递给form,让其进行精确对象验证 | |
| 583 | + if (formItem && form) { | |
| 584 | + form.validateField(formItem.prop, () => {}, event) | |
| 585 | + } | |
| 586 | +} | |
| 587 | + | |
| 588 | +/** | |
| 589 | + * @description 获取某个对象下的属性,用于通过类似'a.b.c'的形式去获取一个对象的的属性的形式 | |
| 590 | + * @param {object} obj 对象 | |
| 591 | + * @param {string} key 需要获取的属性字段 | |
| 592 | + * @returns {*} | |
| 593 | + */ | |
| 594 | +function getProperty(obj, key) { | |
| 595 | + if (!obj) { | |
| 596 | + return | |
| 597 | + } | |
| 598 | + if (typeof key !== 'string' || key === '') { | |
| 599 | + return '' | |
| 600 | + } | |
| 601 | + if (key.indexOf('.') !== -1) { | |
| 602 | + const keys = key.split('.') | |
| 603 | + let firstObj = obj[keys[0]] || {} | |
| 604 | + | |
| 605 | + for (let i = 1; i < keys.length; i++) { | |
| 606 | + if (firstObj) { | |
| 607 | + firstObj = firstObj[keys[i]] | |
| 608 | + } | |
| 609 | + } | |
| 610 | + return firstObj | |
| 611 | + } | |
| 612 | + return obj[key] | |
| 613 | +} | |
| 614 | + | |
| 615 | +/** | |
| 616 | + * @description 设置对象的属性值,如果'a.b.c'的形式进行设置 | |
| 617 | + * @param {object} obj 对象 | |
| 618 | + * @param {string} key 需要设置的属性 | |
| 619 | + * @param {string} value 设置的值 | |
| 620 | + */ | |
| 621 | +function setProperty(obj, key, value) { | |
| 622 | + if (!obj) { | |
| 623 | + return | |
| 624 | + } | |
| 625 | + // 递归赋值 | |
| 626 | + const inFn = function(_obj, keys, v) { | |
| 627 | + // 最后一个属性key | |
| 628 | + if (keys.length === 1) { | |
| 629 | + _obj[keys[0]] = v | |
| 630 | + return | |
| 631 | + } | |
| 632 | + // 0~length-1个key | |
| 633 | + while (keys.length > 1) { | |
| 634 | + const k = keys[0] | |
| 635 | + if (!_obj[k] || (typeof _obj[k] !== 'object')) { | |
| 636 | + _obj[k] = {} | |
| 637 | + } | |
| 638 | + const key = keys.shift() | |
| 639 | + // 自调用判断是否存在属性,不存在则自动创建对象 | |
| 640 | + inFn(_obj[k], keys, v) | |
| 641 | + } | |
| 642 | + } | |
| 643 | + | |
| 644 | + if (typeof key !== 'string' || key === '') { | |
| 645 | + | |
| 646 | + } else if (key.indexOf('.') !== -1) { // 支持多层级赋值操作 | |
| 647 | + const keys = key.split('.') | |
| 648 | + inFn(obj, keys, value) | |
| 649 | + } else { | |
| 650 | + obj[key] = value | |
| 651 | + } | |
| 652 | +} | |
| 653 | + | |
| 654 | +/** | |
| 655 | + * @description 获取当前页面路径 | |
| 656 | + */ | |
| 657 | +function page() { | |
| 658 | + const pages = getCurrentPages(); | |
| 659 | + const route = pages[pages.length - 1]?.route; | |
| 660 | + // 某些特殊情况下(比如页面进行redirectTo时的一些时机),pages可能为空数组 | |
| 661 | + return `/${route ? route : ''}` | |
| 662 | +} | |
| 663 | + | |
| 664 | +/** | |
| 665 | + * @description 获取当前路由栈实例数组 | |
| 666 | + */ | |
| 667 | +function pages() { | |
| 668 | + const pages = getCurrentPages() | |
| 669 | + return pages | |
| 670 | +} | |
| 671 | + | |
| 672 | +/** | |
| 673 | + * 获取页面历史栈指定层实例 | |
| 674 | + * @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。 | |
| 675 | + */ | |
| 676 | +function getHistoryPage(back = 0) { | |
| 677 | + const pages = getCurrentPages() | |
| 678 | + const len = pages.length | |
| 679 | + return pages[len - 1 + back] | |
| 680 | +} | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | +/** | |
| 685 | + * @description 修改wuui内置属性值 | |
| 686 | + * @param {object} props 修改内置props属性 | |
| 687 | + * @param {object} config 修改内置config属性 | |
| 688 | + * @param {object} color 修改内置color属性 | |
| 689 | + * @param {object} zIndex 修改内置zIndex属性 | |
| 690 | + */ | |
| 691 | +function setConfig({ | |
| 692 | + props = {}, | |
| 693 | + config = {}, | |
| 694 | + color = {}, | |
| 695 | + zIndex = {} | |
| 696 | +}) { | |
| 697 | + const { | |
| 698 | + deepMerge, | |
| 699 | + } = uni.$w | |
| 700 | + uni.$w.config = deepMerge(uni.$w.config, config) | |
| 701 | + uni.$w.props = deepMerge(uni.$w.props, props) | |
| 702 | + uni.$w.color = deepMerge(uni.$w.color, color) | |
| 703 | + uni.$w.zIndex = deepMerge(uni.$w.zIndex, zIndex) | |
| 704 | +} | |
| 705 | + | |
| 706 | +export { | |
| 707 | + range, | |
| 708 | + getPx, | |
| 709 | + sleep, | |
| 710 | + os, | |
| 711 | + sys, | |
| 712 | + random, | |
| 713 | + guid, | |
| 714 | + $parent, | |
| 715 | + addStyle, | |
| 716 | + addUnit, | |
| 717 | + deepClone, | |
| 718 | + deepMerge, | |
| 719 | + error, | |
| 720 | + randomArray, | |
| 721 | + timeFormat, | |
| 722 | + timeFrom, | |
| 723 | + trim, | |
| 724 | + queryParams, | |
| 725 | + toast, | |
| 726 | + type2icon, | |
| 727 | + priceFormat, | |
| 728 | + getDuration, | |
| 729 | + padZero, | |
| 730 | + formValidate, | |
| 731 | + getProperty, | |
| 732 | + setProperty, | |
| 733 | + page, | |
| 734 | + pages, | |
| 735 | + getHistoryPage, | |
| 736 | + setConfig, | |
| 737 | + Color | |
| 738 | +} | |
| 0 | 739 | \ No newline at end of file | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/platform.js
0 → 100644
| 1 | +/** | |
| 2 | + * 注意: | |
| 3 | + * 此部分内容,在vue-cli模式下,需要在vue.config.js加入如下内容才有效: | |
| 4 | + * module.exports = { | |
| 5 | + * transpileDependencies: ['uview-v2'] | |
| 6 | + * } | |
| 7 | + */ | |
| 8 | + | |
| 9 | +let platform = 'none' | |
| 10 | + | |
| 11 | +// #ifdef VUE3 | |
| 12 | +platform = 'vue3' | |
| 13 | +// #endif | |
| 14 | + | |
| 15 | +// #ifdef VUE2 | |
| 16 | +platform = 'vue2' | |
| 17 | +// #endif | |
| 18 | + | |
| 19 | +// #ifdef APP-PLUS | |
| 20 | +platform = 'plus' | |
| 21 | +// #endif | |
| 22 | + | |
| 23 | +// #ifdef APP-NVUE | |
| 24 | +platform = 'nvue' | |
| 25 | +// #endif | |
| 26 | + | |
| 27 | +// #ifdef H5 | |
| 28 | +platform = 'h5' | |
| 29 | +// #endif | |
| 30 | + | |
| 31 | +// #ifdef MP-WEIXIN | |
| 32 | +platform = 'weixin' | |
| 33 | +// #endif | |
| 34 | + | |
| 35 | +// #ifdef MP-ALIPAY | |
| 36 | +platform = 'alipay' | |
| 37 | +// #endif | |
| 38 | + | |
| 39 | +// #ifdef MP-BAIDU | |
| 40 | +platform = 'baidu' | |
| 41 | +// #endif | |
| 42 | + | |
| 43 | +// #ifdef MP-TOUTIAO | |
| 44 | +platform = 'toutiao' | |
| 45 | +// #endif | |
| 46 | + | |
| 47 | +// #ifdef MP-QQ | |
| 48 | +platform = 'qq' | |
| 49 | +// #endif | |
| 50 | + | |
| 51 | +// #ifdef MP-KUAISHOU | |
| 52 | +platform = 'kuaishou' | |
| 53 | +// #endif | |
| 54 | + | |
| 55 | +// #ifdef MP-360 | |
| 56 | +platform = '360' | |
| 57 | +// #endif | |
| 58 | + | |
| 59 | +// #ifdef MP | |
| 60 | +platform = 'mp' | |
| 61 | +// #endif | |
| 62 | + | |
| 63 | +// #ifdef QUICKAPP-WEBVIEW | |
| 64 | +platform = 'quickapp-webview' | |
| 65 | +// #endif | |
| 66 | + | |
| 67 | +// #ifdef QUICKAPP-WEBVIEW-HUAWEI | |
| 68 | +platform = 'quickapp-webview-huawei' | |
| 69 | +// #endif | |
| 70 | + | |
| 71 | +// #ifdef QUICKAPP-WEBVIEW-UNION | |
| 72 | +platform = 'quckapp-webview-union' | |
| 73 | +// #endif | |
| 74 | + | |
| 75 | +export default platform | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/test.js
0 → 100644
| 1 | +/** | |
| 2 | + * 验证电子邮箱格式 | |
| 3 | + */ | |
| 4 | +function email(value) { | |
| 5 | + return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value) | |
| 6 | +} | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 验证手机格式 | |
| 10 | + */ | |
| 11 | +function mobile(value) { | |
| 12 | + return /^1([3589]\d|4[5-9]|6[1-2,4-7]|7[0-8])\d{8}$/.test(value) | |
| 13 | +} | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 验证URL格式 | |
| 17 | + */ | |
| 18 | +function url(value) { | |
| 19 | + return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/ | |
| 20 | + .test(value) | |
| 21 | +} | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 验证日期格式 | |
| 25 | + */ | |
| 26 | +function date(value) { | |
| 27 | + if (!value) return false | |
| 28 | + // 判断是否数值或者字符串数值(意味着为时间戳),转为数值,否则new Date无法识别字符串时间戳 | |
| 29 | + if (number(value)) value = +value | |
| 30 | + return !/Invalid|NaN/.test(new Date(value).toString()) | |
| 31 | +} | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * 验证ISO类型的日期格式 | |
| 35 | + */ | |
| 36 | +function dateISO(value) { | |
| 37 | + return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value) | |
| 38 | +} | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * 验证十进制数字 | |
| 42 | + */ | |
| 43 | +function number(value) { | |
| 44 | + return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value) | |
| 45 | +} | |
| 46 | + | |
| 47 | +/** | |
| 48 | + * 验证字符串 | |
| 49 | + */ | |
| 50 | +function string(value) { | |
| 51 | + return typeof value === 'string' | |
| 52 | +} | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * 验证整数 | |
| 56 | + */ | |
| 57 | +function digits(value) { | |
| 58 | + return /^\d+$/.test(value) | |
| 59 | +} | |
| 60 | + | |
| 61 | +/** | |
| 62 | + * 验证身份证号码 | |
| 63 | + */ | |
| 64 | +function idCard(value) { | |
| 65 | + return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test( | |
| 66 | + value | |
| 67 | + ) | |
| 68 | +} | |
| 69 | + | |
| 70 | +/** | |
| 71 | + * 是否车牌号 | |
| 72 | + */ | |
| 73 | +function carNo(value) { | |
| 74 | + // 新能源车牌 | |
| 75 | + const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/ | |
| 76 | + // 旧车牌 | |
| 77 | + const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/ | |
| 78 | + if (value.length === 7) { | |
| 79 | + return creg.test(value) | |
| 80 | + } if (value.length === 8) { | |
| 81 | + return xreg.test(value) | |
| 82 | + } | |
| 83 | + return false | |
| 84 | +} | |
| 85 | + | |
| 86 | +/** | |
| 87 | + * 金额,只允许2位小数 | |
| 88 | + */ | |
| 89 | +function amount(value) { | |
| 90 | + // 金额,只允许保留两位小数 | |
| 91 | + return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value) | |
| 92 | +} | |
| 93 | + | |
| 94 | +/** | |
| 95 | + * 中文 | |
| 96 | + */ | |
| 97 | +function chinese(value) { | |
| 98 | + const reg = /^[\u4e00-\u9fa5]+$/gi | |
| 99 | + return reg.test(value) | |
| 100 | +} | |
| 101 | + | |
| 102 | +/** | |
| 103 | + * 只能输入字母 | |
| 104 | + */ | |
| 105 | +function letter(value) { | |
| 106 | + return /^[a-zA-Z]*$/.test(value) | |
| 107 | +} | |
| 108 | + | |
| 109 | +/** | |
| 110 | + * 只能是字母或者数字 | |
| 111 | + */ | |
| 112 | +function enOrNum(value) { | |
| 113 | + // 英文或者数字 | |
| 114 | + const reg = /^[0-9a-zA-Z]*$/g | |
| 115 | + return reg.test(value) | |
| 116 | +} | |
| 117 | + | |
| 118 | +/** | |
| 119 | + * 验证是否包含某个值 | |
| 120 | + */ | |
| 121 | +function contains(value, param) { | |
| 122 | + return value.indexOf(param) >= 0 | |
| 123 | +} | |
| 124 | + | |
| 125 | +/** | |
| 126 | + * 验证一个值范围[min, max] | |
| 127 | + */ | |
| 128 | +function range(value, param) { | |
| 129 | + return value >= param[0] && value <= param[1] | |
| 130 | +} | |
| 131 | + | |
| 132 | +/** | |
| 133 | + * 验证一个长度范围[min, max] | |
| 134 | + */ | |
| 135 | +function rangeLength(value, param) { | |
| 136 | + return value.length >= param[0] && value.length <= param[1] | |
| 137 | +} | |
| 138 | + | |
| 139 | +/** | |
| 140 | + * 是否固定电话 | |
| 141 | + */ | |
| 142 | +function landline(value) { | |
| 143 | + const reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/ | |
| 144 | + return reg.test(value) | |
| 145 | +} | |
| 146 | + | |
| 147 | +/** | |
| 148 | + * 判断是否为空 | |
| 149 | + */ | |
| 150 | +function empty(value) { | |
| 151 | + switch (typeof value) { | |
| 152 | + case 'undefined': | |
| 153 | + return true | |
| 154 | + case 'string': | |
| 155 | + if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true | |
| 156 | + break | |
| 157 | + case 'boolean': | |
| 158 | + if (!value) return true | |
| 159 | + break | |
| 160 | + case 'number': | |
| 161 | + if (value === 0 || isNaN(value)) return true | |
| 162 | + break | |
| 163 | + case 'object': | |
| 164 | + if (value === null || value.length === 0) return true | |
| 165 | + for (const i in value) { | |
| 166 | + return false | |
| 167 | + } | |
| 168 | + return true | |
| 169 | + } | |
| 170 | + return false | |
| 171 | +} | |
| 172 | + | |
| 173 | +/** | |
| 174 | + * 是否json字符串 | |
| 175 | + */ | |
| 176 | +function jsonString(value) { | |
| 177 | + if (typeof value === 'string') { | |
| 178 | + try { | |
| 179 | + const obj = JSON.parse(value) | |
| 180 | + if (typeof obj === 'object' && obj) { | |
| 181 | + return true | |
| 182 | + } | |
| 183 | + return false | |
| 184 | + } catch (e) { | |
| 185 | + return false | |
| 186 | + } | |
| 187 | + } | |
| 188 | + return false | |
| 189 | +} | |
| 190 | + | |
| 191 | +/** | |
| 192 | + * 是否数组 | |
| 193 | + */ | |
| 194 | +function array(value) { | |
| 195 | + if (typeof Array.isArray === 'function') { | |
| 196 | + return Array.isArray(value) | |
| 197 | + } | |
| 198 | + return Object.prototype.toString.call(value) === '[object Array]' | |
| 199 | +} | |
| 200 | + | |
| 201 | +/** | |
| 202 | + * 是否对象 | |
| 203 | + */ | |
| 204 | +function object(value) { | |
| 205 | + return Object.prototype.toString.call(value) === '[object Object]' | |
| 206 | +} | |
| 207 | + | |
| 208 | +/** | |
| 209 | + * 是否短信验证码 | |
| 210 | + */ | |
| 211 | +function code(value, len = 6) { | |
| 212 | + return new RegExp(`^\\d{${len}}$`).test(value) | |
| 213 | +} | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * 是否函数方法 | |
| 217 | + * @param {Object} value | |
| 218 | + */ | |
| 219 | +function func(value) { | |
| 220 | + return typeof value === 'function' | |
| 221 | +} | |
| 222 | + | |
| 223 | +/** | |
| 224 | + * 是否promise对象 | |
| 225 | + * @param {Object} value | |
| 226 | + */ | |
| 227 | +function promise(value) { | |
| 228 | + return object(value) && func(value.then) && func(value.catch) | |
| 229 | +} | |
| 230 | + | |
| 231 | +/** 是否图片格式 | |
| 232 | + * @param {Object} value | |
| 233 | + */ | |
| 234 | +function image(value) { | |
| 235 | + const newValue = value.split('?')[0] | |
| 236 | + const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i | |
| 237 | + return IMAGE_REGEXP.test(newValue) | |
| 238 | +} | |
| 239 | + | |
| 240 | +/** | |
| 241 | + * 是否视频格式 | |
| 242 | + * @param {Object} value | |
| 243 | + */ | |
| 244 | +function video(value) { | |
| 245 | + const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i | |
| 246 | + return VIDEO_REGEXP.test(value) | |
| 247 | +} | |
| 248 | + | |
| 249 | +/** | |
| 250 | + * 是否为正则对象 | |
| 251 | + * @param {Object} | |
| 252 | + * @return {Boolean} | |
| 253 | + */ | |
| 254 | +function regExp(o) { | |
| 255 | + return o && Object.prototype.toString.call(o) === '[object RegExp]' | |
| 256 | +} | |
| 257 | + | |
| 258 | +export { | |
| 259 | + email, | |
| 260 | + mobile, | |
| 261 | + url, | |
| 262 | + date, | |
| 263 | + dateISO, | |
| 264 | + number, | |
| 265 | + digits, | |
| 266 | + idCard, | |
| 267 | + carNo, | |
| 268 | + amount, | |
| 269 | + chinese, | |
| 270 | + letter, | |
| 271 | + enOrNum, | |
| 272 | + contains, | |
| 273 | + range, | |
| 274 | + rangeLength, | |
| 275 | + empty, | |
| 276 | + jsonString, | |
| 277 | + landline, | |
| 278 | + object, | |
| 279 | + array, | |
| 280 | + code, | |
| 281 | + func, | |
| 282 | + promise, | |
| 283 | + video, | |
| 284 | + image, | |
| 285 | + regExp, | |
| 286 | + string | |
| 287 | +} | ... | ... |
lvdao-miniapp/uni_modules/wu-ui-tools/libs/function/throttle.js
0 → 100644
| 1 | +let timer; let | |
| 2 | + flag | |
| 3 | +/** | |
| 4 | + * 节流原理:在一定时间内,只能触发一次 | |
| 5 | + * | |
| 6 | + * @param {Function} func 要执行的回调函数 | |
| 7 | + * @param {Number} wait 延时的时间 | |
| 8 | + * @param {Boolean} immediate 是否立即执行 | |
| 9 | + * @return null | |
| 10 | + */ | |
| 11 | +function throttle(func, wait = 500, immediate = true) { | |
| 12 | + if (immediate) { | |
| 13 | + if (!flag) { | |
| 14 | + flag = true | |
| 15 | + // 如果是立即执行,则在wait毫秒内开始时执行 | |
| 16 | + typeof func === 'function' && func() | |
| 17 | + timer = setTimeout(() => { | |
| 18 | + flag = false | |
| 19 | + }, wait) | |
| 20 | + } | |
| 21 | + } else if (!flag) { | |
| 22 | + flag = true | |
| 23 | + // 如果是非立即执行,则在wait毫秒内的结束处执行 | |
| 24 | + timer = setTimeout(() => { | |
| 25 | + flag = false | |
| 26 | + typeof func === 'function' && func() | |
| 27 | + }, wait) | |
| 28 | + } | |
| 29 | +} | |
| 30 | +export default throttle | ... | ... |