Browse Source

页面头部背景图片修改 加入腾讯地图选点

master
mk 1 year ago
parent
commit
cbc280e023
  1. 5
      .gitignore
  2. 4
      main.js
  3. 66
      manifest.json
  4. 37
      package.json
  5. 2
      pages.json
  6. 2
      pages/mine/mine.vue
  7. 4
      subpages/OCRCard/pages/index/index.vue
  8. 8
      subpages/addResi/pages/editResi/editResi.vue
  9. 4
      subpages/addhouse/pages/addhouse/addhouse.vue
  10. 8
      subpages/communitySelfInsp/pages/synthesis/synthesis.vue
  11. 67
      subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue
  12. 336
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.vue
  13. 1
      wxcomponents/vant/cascader/index.d.ts
  14. 222
      wxcomponents/vant/cascader/index.js
  15. 8
      wxcomponents/vant/cascader/index.json
  16. 53
      wxcomponents/vant/cascader/index.wxml
  17. 24
      wxcomponents/vant/cascader/index.wxs
  18. 1
      wxcomponents/vant/cascader/index.wxss

5
.gitignore

@ -0,0 +1,5 @@
**/.idea
.idea
/node_modules/
project.config.json
project.private.config.json

4
main.js

@ -5,11 +5,11 @@ import zpMixins from '@/uni_modules/zp-mixins/index.js';
// #ifndef VUE3
import Vue from 'vue';
Vue.use(zpMixins);
Vue.config.productionTip = false;
App.mpType = 'app';
// import Vant from 'vant';
// Vue.use(Vant);
const app = new Vue({
...App
});

66
manifest.json

@ -38,6 +38,9 @@
},
"ios" : {},
"sdkConfigs" : {}
},
"uniStatistics" : {
"enable" : false
}
},
"quickapp" : {},
@ -65,16 +68,28 @@
"version" : "0.3.6",
"provider" : "wx069ba97219f66d99"
}
},
"uniStatistics" : {
"enable" : false
}
},
"mp-alipay" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"mp-baidu" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"mp-toutiao" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"uniStatistics" : {
"enable" : false
@ -82,5 +97,48 @@
"vueVersion" : "2",
"networkTimeout" : {
"request" : 60000
}
},
"h5" : {
"uniStatistics" : {
"enable" : false
},
"sdkConfigs" : {
"maps" : {
"qqmap" : {
"key" : "UDOBZ-KWRKZ-XCZXE-ZFSTS-QPNKV-VKBK7"
}
}
}
},
"mp-jd" : {
"uniStatistics" : {
"enable" : false
}
},
"mp-kuaishou" : {
"uniStatistics" : {
"enable" : false
}
},
"mp-lark" : {
"uniStatistics" : {
"enable" : false
}
},
"mp-qq" : {
"uniStatistics" : {
"enable" : false
}
},
"quickapp-webview-huawei" : {
"uniStatistics" : {
"enable" : false
}
},
"quickapp-webview-union" : {
"uniStatistics" : {
"enable" : false
}
},
"fallbackLocale" : "zh-Hans"
}

37
package.json

@ -1,19 +1,20 @@
{
"name": "epmet-work-mp",
"version": "1.0.0",
"description": "{\r \"pagePath\": \"pages/information/information\",\r \"text\": \"数据\",\r \"iconPath\": \"images/home/information.png\",\r \"selectedIconPath\": \"images/home/informationSelected.png\"\r },",
"main": ".eslintrc.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"dependencies": {
"@vant/weapp": "^1.11.4"
},
"license": "ISC",
"devDependencies": {},
"repository": {
"type": "git",
"url": "http://120.46.222.128:10021/elink-star/epmet-work-mp.git"
}
}
"name": "epmet-work-mp",
"version": "1.0.0",
"description": "{\r \"pagePath\": \"pages/information/information\",\r \"text\": \"数据\",\r \"iconPath\": \"images/home/information.png\",\r \"selectedIconPath\": \"images/home/informationSelected.png\"\r },",
"main": ".eslintrc.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"dependencies": {
"@vant/weapp": "^1.11.4",
"vant": "^4.9.8"
},
"license": "ISC",
"devDependencies": {},
"repository": {
"type": "git",
"url": "http://120.46.222.128:10021/elink-star/epmet-work-mp.git"
}
}

2
pages.json

@ -591,6 +591,7 @@
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black",
"usingComponents": {
"wuxDatePicker":"/wxcomponents/dist/date-picker/index",
"van-action-sheet": "/wxcomponents/vant/action-sheet/index",
"van-area": "/wxcomponents/vant/area/index",
"van-button": "/wxcomponents/vant/button/index",
@ -615,6 +616,7 @@
"van-notify": "/wxcomponents/vant/notify/index",
"van-panel": "/wxcomponents/vant/panel/index",
"van-popup": "/wxcomponents/vant/popup/index",
"van-cascader": "/wxcomponents/vant/cascader/index",
"van-progress": "/wxcomponents/vant/progress/index",
"van-radio": "/wxcomponents/vant/radio/index",
"van-radio-group": "/wxcomponents/vant/radio-group/index",

2
pages/mine/mine.vue

@ -3,7 +3,7 @@
<!-- pages/mine/mine.wxml -->
<view class="header">
<view class="navigation" :style="'height: ' + navigationHeight + 'px; top: ' + statusHeight + 'px;'">
<view style="margin-top: 100rpx">我的</view>
<view style="margin-top: 100rpx"></view>
</view>
<view class="content">
<view class="left"><image v-if="avatar" :src="avatar" mode="aspectFill" /></view>

4
subpages/OCRCard/pages/index/index.vue

@ -2,7 +2,7 @@
<view>
<!-- subpages/OCRCard/pages/index/index.wxml -->
<view class="header">
<image class="header-bg" src="/static/subpages/OCRCard/image/headerBg.png" mode="widthFix" />
<!-- <image class="header-bg" src="/static/subpages/OCRCard/image/headerBg.png" mode="widthFix" /> -->
<image src="/static/images/back.png" class="back" @tap="back" :style="' top: ' + statusHeight + 'px;width: 50rpx;height: 50rpx;'" mode="" />
<view class="navigation" :style="'height: ' + navigationHeight + 'px; top: ' + statusHeight + 'px;'">身份证识别</view>
</view>
@ -137,6 +137,8 @@ page {
width: 100%;
height: 550rpx;
overflow: hidden;
background-image: url('/static/subpages/OCRCard/image/headerBg.png');
background-size: 100% 100%;
}
.blue {
color: #3a80e7;

8
subpages/addResi/pages/editResi/editResi.vue

@ -3,7 +3,7 @@
<!-- subpages/addResi/pages/addResi/addResi.wxml -->
<view class="header">
<image src="/static/images/back.png" class="back" :style="' top: ' + statusHeight + 'px;width: 50rpx;height: 50rpx;'" @tap="back" mode="" />
<image class="header-bg" src="/static/subpages/addResi/pages/images/header.png" mode="widthFix" />
<!-- <image class="header-bg" src="/static/subpages/addResi/pages/images/header.png" mode="widthFix" /> -->
<view class="navigation" :style="'height: ' + navigationHeight + 'px; top: ' + statusHeight + 'px;'">
{{ formType == 'edit' ? '修改人口信息' : '新增人口信息' }}
</view>
@ -1992,10 +1992,8 @@ page {
width: 100%;
height: 444rpx;
overflow: hidden;
/* position: fixed;
top: 0;
left: 0;
z-index: 1000; */
background-image: url('/static/subpages/addResi/pages/images/header.png');
background-size: 100% 100%;
}
.header .header-bg {
width: 100%;

4
subpages/addhouse/pages/addhouse/addhouse.vue

@ -3,7 +3,7 @@
<!-- subpages/addhouse/pages/addhouse/addhouse.wxml -->
<view class="header">
<image src="/static/images/back.png" class="back" :style="' top: ' + statusHeight + 'px;width: 50rpx;height: 50rpx;'" @tap="back" mode="" />
<image class="header-bg" src="/static/subpages/addhouse/pages/images/header.png" mode="widthFix" />
<!-- <image class="header-bg" src="/static/subpages/addhouse/pages/images/header.png" mode="widthFix" /> -->
<view class="navigation" :style="'height: ' + navigationHeight + 'px; top: ' + statusHeight + 'px;'">
{{ formType == 'edit' ? '修改房屋信息' : '新增房屋信息' }}
</view>
@ -897,6 +897,8 @@ page {
width: 100%;
height: 444rpx;
overflow: hidden;
background-image: url('/static/subpages/addhouse/pages/images/header.png');
background-size: 100% 100%;
}
.header .header-bg {
width: 100%;

8
subpages/communitySelfInsp/pages/synthesis/synthesis.vue

@ -1,7 +1,7 @@
<template>
<view>
<view class="header">
<image class="header-bg" src="/static/images/work/bg.png" mode="widthFix" />
<!-- <image class="header-bg" src="/static/images/work/bg.png" mode="widthFix" /> -->
<image src="/static/images/back.png" class="back" @tap="back" :style="' top: ' + statusHeight + 'px;width: 50rpx;height: 50rpx;'" mode="" />
<view class="navigation" :style="'height: ' + navigationHeight + 'px; top: ' + statusHeight + 'px;'">社区满意度自查</view>
<view class="content">
@ -300,10 +300,8 @@ page {
.header {
width: 100%;
height: 464rpx;
/* position: fixed;
top: 0;
left: 0;
z-index: 1000; */
background-image: url('/static/images/work/bg.png');
background-size: 100% 100%;
overflow: hidden;
}
.blue {

67
subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue

@ -162,8 +162,8 @@
<view class="field-text">发生地点</view>
</view>
<view class="value-dl">
<view class="di-name" @tap="toughGetLocation">{{ addressContent }}</view>
<image class="di-but" v-if="!addressContent" src="/static/images/right.png" mode="aspectFit" />
<view class="di-name">{{ addressContent }}</view>
<image class="di-but" @click="toughGetLocation" v-if="!addressContent" src="/static/images/right.png" mode="aspectFit" />
<image class="di-but" v-else style="width: 46rpx; height: 46rpx" src="/static/images/导航.png" mode="aspectFit" @tap="routePlanning" />
</view>
</view>
@ -391,55 +391,6 @@
</view>
</view>
<wux-actionsheet id="wux-actionsheet" />
<!-- 需求时间/发生时间 -->
<wux-date-picker
:visible="visibleTime"
controlled
mode="datetime"
:value="fmData.happenTime"
lang="zh_CN"
:minDate="minDate"
:maxDate="maxDate"
@confirm="onConfirmDate"
@visibleChange="onVisibleChange"
@cancel="onCancel"
/>
<!-- 服务时间 bind:visibleChange="onVisibleChange" -->
<wux-date-picker
:visible="visibleTimeWantServiceTime"
controlled
mode="datetime"
:value="fmData.wantServiceTime"
lang="zh_CN"
:minDate="minDate"
:maxDate="maxDate"
@confirm="onConfirmWantServiceTime"
@cancel="onCancel"
/>
<wux-picker :options="angencyList" :value="fmData.gridId" :visible="angencyVisible" controlled cascade @cancel="hidePickerAngency" @confirm="onConfirmAngecy"></wux-picker>
<wux-picker
:options="reportTypeList"
:value="form.reportType"
:visible="reportTypeVisible"
controlled
cascade
@cancel="hidePickerReportType"
@confirm="onConfirmReportType"
></wux-picker>
<wux-picker
:options="measureList"
:value="measureValue"
:visible="measureVisible"
:defaultFieldNames="defaultMeasureNames"
cols="2"
controlled
cascade
@cancel="hidePickerMeasure"
@confirm="onConfirmMeasure"
></wux-picker>
<van-popup :show="visible1" round position="bottom">
<van-cascader v-if="visible1" :default-value="value1" title="事件分类" :options="casOptions" @close="onClose1" @finish="onConfirm1" :field-names="catField" />
</van-popup>
@ -447,12 +398,7 @@
</template>
<script>
import wuxActionsheet from '../../../../../wxcomponents/dist/actionsheet/index';
import wuxSegmentedControl from '../../../../../wxcomponents/dist/segmented-control/index';
import wuxDatePicker from '../../../../../wxcomponents/dist/date-picker/index';
import wuxCellGroup from '../../../../../wxcomponents/dist/cell-group/index';
import wuxPicker from '../../../../../wxcomponents/dist/picker/index';
import { $wuxActionSheet } from '../../../../../wxcomponents/dist/index';
import { icEventOldProcess, getCategoryTree } from '../../../../../utils/statisticsApi';
const QQMapWX = require('../../../../../utils/qqmap-wx-jssdk');
const config = require('../../../../../utils/config');
@ -467,11 +413,7 @@ import api from '../../../../../utils/api';
var timer;
export default {
components: {
wuxActionsheet,
wuxSegmentedControl,
wuxDatePicker,
wuxCellGroup,
wuxPicker
},
data() {
return {
@ -1245,7 +1187,6 @@ export default {
// this.getLocation(false);
uni.chooseLocation({
success: (res) => {
console.log('resadddres', res);
const { fmData } = this;
this.setData({
fmData: {

336
subpages/safetyinspection/pages/safetyinspection/safetyinspection.vue

@ -19,7 +19,7 @@
<view class="nes">
<view class="conclusion">
<text class="prosecutors_pre">检查结论</text>
<picker class="prosecutors_name" @change="pickerChange" :value="checkResultFlag" :range="array">
<picker class="prosecutors_name" @change="pickerChange" :value="checkResultFlag" :range="array" mode="selector">
<view :class="checkResultFlagName ? '' : 'gray'">
{{ checkResultFlagName ? checkResultFlagName : '请选择' }}
</view>
@ -100,6 +100,7 @@
<image @tap="deleteImage" :data-imageid="item.imageId" class="close" v-else src="/static/images/icon_close.png" />
</view>
<image v-if="uploadImageList.length < 3" src="/static/images/ig_tianjiatupian@2x.png" @tap="chooseImage" />
</view>
</view>
<view class="attachment">
@ -109,7 +110,7 @@
</view>
</view>
</view>
<view class="form_record">
<view class="form_record" >
<view class="text2">巡查记录</view>
<view class="logsBox" v-for="(item, index) in showList" :key="index">
<view :class="'item-dian ' + (index != 0 ? 'item-dian1' : '')">
@ -130,15 +131,15 @@
<text class="logs-content-title">检查结论</text>
<text class="logs-content-txt">{{ item.checkResultFlag == 1 ? '合格' : '不合格' }}</text>
</view>
<view v-if="item.hiddenDangeList0.length">
<view v-if="item.hiddenDangeList0">
<text class="logs-content-title">{{ !item.hiddenDangeList3 ? '未整改隐患:' : '隐患明细:' }}</text>
<text class="logs-content-txt" :name="index" v-for="(item, index1) in item.hiddenDangeList0" :key="index1">{{ index + 1 }}.{{ item.hazardDesc }}</text>
</view>
<view v-if="item.hiddenDangeList1.length">
<view v-if="item.hiddenDangeList1">
<text class="logs-content-title" v-if="item.hiddenDangeList2.length == 0">已整改隐患</text>
<text class="logs-content-txt" :name="index" v-for="(item, index1) in item.hiddenDangeList1" :key="index1">{{ index + 1 }}.{{ item.hazardDesc }}</text>
</view>
<view v-if="item.hiddenDangeList2.length">
<view v-if="item.hiddenDangeList2">
<text class="logs-content-title">整改要求</text>
<text class="logs-content-txt" v-for="(item, index1) in item.hiddenDangeList2" :key="index1">{{ index + 1 }}.{{ item.hazardDesc }}</text>
</view>
@ -148,7 +149,7 @@
</view>
<view>
<text class="logs-content-title" v-if="item.attachmentUrls">附件</text>
<block v-if="item.attachmentUrls.length > 0">
<block >
<text class="logs-content-txt" :data-item="item" @tap="onImage" v-for="(item, index1) in item.attachmentUrls" :key="index1">
{{ item.fileName }}
</text>
@ -179,27 +180,24 @@
</van-checkbox-group>
</view>
</van-popup>
<wux-actionsheet id="wux-actionsheet" />
<van-popup :show="showtime" close-icon="close" position="bottom" custom-style="height: 50%" @close="closePopup" round>
<van-datetime-picker type="datetime" :value="currentDate" :min-date="minDate" :max-date="maxDate" @confirm="handelConfirmDate" @input="onInput" @cancel="onCancel" />
<van-datetime-picker v-model="currentDate" type="datetime" />
</van-popup>
<van-popup :show="imageshow" @close="onClose1" custom-style="imageup">
<van-image width="300" height="300" :src="attachmentUrl" />
</van-popup>
<van-action-sheet v-model="uploadImageSheet" :actions="actions" @select="onSelectUpload" />
</view>
</template>
<script>
import wuxActionsheet from '../../../../wxcomponents/dist/actionsheet/index';
// subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
import { $wuxActionSheet } from '../../../../wxcomponents/dist/index';
const app = getApp();
import { showRecord, addRecord, inspectionStaff, securityCheckk } from '../../../../utils/api';
import { timestampToTime } from '../../../../utils/index';
const config = require('../../../../utils/config');
export default {
components: {
wuxActionsheet
},
data() {
return {
@ -229,7 +227,7 @@ export default {
selectedOptions: [],
//
selectedNames: [],
selectedNames: '',
//
newContent: '',
@ -256,7 +254,9 @@ export default {
currentDateShow: '',
checkPersonsIdList: '',
checkResultFlagName: '',
getData: ''
getData: '',
actions:[{name:'拍照'},{name:'从相册中获取'}],
uploadImageSheet:true
};
},
/**
@ -437,6 +437,8 @@ export default {
this.setData({
showList: res.data
});
console.log(this.showList,'seeee');
const updatedShowList = this.showList.map((item, index, array) => {
if (index < array.length - 1) {
if (array[index + 1].checkResultFlag === 1 && item.checkResultFlag === 0) {
@ -488,7 +490,7 @@ export default {
});
this.setData({
showPopup: false,
selectedNames: names,
selectedNames: names.join(','),
checkPersonsIdList: this.selectedOptions
}); //
},
@ -504,7 +506,7 @@ export default {
const selectedName = this.arr.filter((item) => this.selectedOptions.includes(item.staffId)).map((item) => item.name);
this.setData({
showPopup: false,
selectedNames: selectedName
selectedNames: selectedName.join(',')
}); //
},
@ -670,157 +672,159 @@ export default {
});
return;
}
const _this = this;
$wuxActionSheet().showSheet({
buttons: [
{
text: '拍照'
},
{
text: '从相册中获取',
openType: null
}
],
className: 'dialog-class',
buttonClicked(index) {
if (index === 0) {
uni.chooseMedia({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['camera'],
success(res) {
let deleteLength = _this.uploadImageList.length;
const uploadImageList = [..._this.uploadImageList];
if (res.tempFiles[0].size <= 5242880) {
uploadImageList.push({
uploaded: false,
ossUrl: {
url: res.tempFiles[0].tempFilePath
},
imgUrl: res.tempFiles[0].tempFilePath,
imageId: ++_this.imageId,
type: res.tempFiles[0].tempFilePath.substr(res.tempFiles[0].tempFilePath.length - 3, 3),
format: 'image',
name: 'wximage'
});
} else {
_this.showToast('图片上限5M,请压缩后重试~');
return false;
}
_this.setData({
uploadImageList
});
uni.uploadFile({
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
filePath: res.tempFiles[0].tempFilePath,
name: 'file',
header: {
'Content-type': 'application/json;charset=UTF-8',
Authorization: uni.getStorageSync('token')
},
success(fileRes) {
if (!JSON.parse(fileRes.data).data) {
_this.showToast('图片上传失败,请重试~');
//
const index = _this.uploadImageList.findIndex((item) => item.imageId === _this.imageId);
if (index > -1) {
_this.uploadImageList.splice(index, 1);
_this.setData({
uploadImageList: _this.uploadImageList
});
}
} else {
uploadImageList[uploadImageList.length - 1].uploaded = true;
uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data;
_this.setData({
uploadImageList
});
}
},
fail(fileRes) {
_this.setData({
uploadImageList: []
});
_this.showToast('图片上传失败,请重试~');
}
});
}
});
} else if (index === 1) {
uni.chooseMedia({
count: 1,
type: 'image',
sourceType: ['album'],
success(res) {
let deleteLength = _this.uploadImageList.length;
const uploadImageList = [];
const endIndex = _this.uploadImageList.length;
res.tempFiles.forEach((item, index) => {
if (item.size <= 5242880) {
uploadImageList.push({
uploaded: false,
ossUrl: {
url: item.tempFilePath
},
imgUrl: item.tempFilePath,
imageId: ++_this.imageId,
format: 'image',
type: item.tempFilePath.substr(item.tempFilePath.length - 3, 3),
originFileName: 'image' + index + 1
});
} else {
_this.showToast('图片上限5M,请压缩后重试~');
}
});
_this.setData({
uploadImageList: [..._this.uploadImageList, ...uploadImageList]
});
uploadImageList.forEach((item, index) => {
return (function (index) {
uni.uploadFile({
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
filePath: res.tempFiles[index].tempFilePath,
name: 'file',
header: {
'Content-type': 'application/json;charset=UTF-8',
Authorization: uni.getStorageSync('token')
},
success(fileRes) {
if (!JSON.parse(fileRes.data).data) {
_this.showToast('图片上传失败,请重试~');
_this.uploadImageList.splice(deleteLength, _this.uploadImageList.length - deleteLength);
_this.setData({
uploadImageList: _this.uploadImageList
});
} else {
uploadImageList[index].uploaded = true;
uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data;
_this.uploadImageList = _this.uploadImageList.slice(0, endIndex);
_this.setData({
uploadImageList: [..._this.uploadImageList, ...uploadImageList]
});
}
},
fail(fileRes) {
_this.setData({
uploadImageList: []
});
_this.showToast('图片上传失败,请重试~');
}
});
})(index);
});
}
});
}
return true;
},
cancelText: '取消',
cancel() {},
destructiveButtonClicked() {}
});
this.uploadImageSheet = true;
},
onSelectUpload(item){
console.log(item);
// wuxActionsheet.showSheet({
// buttons: [
// {
// text: ''
// },
// {
// text: '',
// openType: null
// }
// ],
// className: 'dialog-class',
// buttonClicked(index) {
// if (index === 0) {
// uni.chooseMedia({
// count: 1,
// sizeType: ['original', 'compressed'],
// sourceType: ['camera'],
// success(res) {
// let deleteLength = _this.uploadImageList.length;
// const uploadImageList = [..._this.uploadImageList];
// if (res.tempFiles[0].size <= 5242880) {
// uploadImageList.push({
// uploaded: false,
// ossUrl: {
// url: res.tempFiles[0].tempFilePath
// },
// imgUrl: res.tempFiles[0].tempFilePath,
// imageId: ++_this.imageId,
// type: res.tempFiles[0].tempFilePath.substr(res.tempFiles[0].tempFilePath.length - 3, 3),
// format: 'image',
// name: 'wximage'
// });
// } else {
// _this.showToast('5M~');
// return false;
// }
// _this.setData({
// uploadImageList
// });
// uni.uploadFile({
// url: `${config.BASEURL()}oss/file/uploadvariedfile`,
// filePath: res.tempFiles[0].tempFilePath,
// name: 'file',
// header: {
// 'Content-type': 'application/json;charset=UTF-8',
// Authorization: uni.getStorageSync('token')
// },
// success(fileRes) {
// if (!JSON.parse(fileRes.data).data) {
// _this.showToast('~');
// //
// const index = _this.uploadImageList.findIndex((item) => item.imageId === _this.imageId);
// if (index > -1) {
// _this.uploadImageList.splice(index, 1);
// _this.setData({
// uploadImageList: _this.uploadImageList
// });
// }
// } else {
// uploadImageList[uploadImageList.length - 1].uploaded = true;
// uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data;
// _this.setData({
// uploadImageList
// });
// }
// },
// fail(fileRes) {
// _this.setData({
// uploadImageList: []
// });
// _this.showToast('~');
// }
// });
// }
// });
// } else if (index === 1) {
// uni.chooseMedia({
// count: 1,
// type: 'image',
// sourceType: ['album'],
// success(res) {
// let deleteLength = _this.uploadImageList.length;
// const uploadImageList = [];
// const endIndex = _this.uploadImageList.length;
// res.tempFiles.forEach((item, index) => {
// if (item.size <= 5242880) {
// uploadImageList.push({
// uploaded: false,
// ossUrl: {
// url: item.tempFilePath
// },
// imgUrl: item.tempFilePath,
// imageId: ++_this.imageId,
// format: 'image',
// type: item.tempFilePath.substr(item.tempFilePath.length - 3, 3),
// originFileName: 'image' + index + 1
// });
// } else {
// _this.showToast('5M~');
// }
// });
// _this.setData({
// uploadImageList: [..._this.uploadImageList, ...uploadImageList]
// });
// uploadImageList.forEach((item, index) => {
// return (function (index) {
// uni.uploadFile({
// url: `${config.BASEURL()}oss/file/uploadvariedfile`,
// filePath: res.tempFiles[index].tempFilePath,
// name: 'file',
// header: {
// 'Content-type': 'application/json;charset=UTF-8',
// Authorization: uni.getStorageSync('token')
// },
// success(fileRes) {
// if (!JSON.parse(fileRes.data).data) {
// _this.showToast('~');
// _this.uploadImageList.splice(deleteLength, _this.uploadImageList.length - deleteLength);
// _this.setData({
// uploadImageList: _this.uploadImageList
// });
// } else {
// uploadImageList[index].uploaded = true;
// uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data;
// _this.uploadImageList = _this.uploadImageList.slice(0, endIndex);
// _this.setData({
// uploadImageList: [..._this.uploadImageList, ...uploadImageList]
// });
// }
// },
// fail(fileRes) {
// _this.setData({
// uploadImageList: []
// });
// _this.showToast('~');
// }
// });
// })(index);
// });
// }
// });
// }
// return true;
// },
// cancelText: '',
// cancel() {},
// destructiveButtonClicked() {}
// });
},
pickerChange: function (e) {
this.setData({
checkResultFlag: e.detail.value,

1
wxcomponents/vant/cascader/index.d.ts

@ -0,0 +1 @@
export {};

222
wxcomponents/vant/cascader/index.js

@ -0,0 +1,222 @@
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var FieldName;
(function (FieldName) {
FieldName["TEXT"] = "text";
FieldName["VALUE"] = "value";
FieldName["CHILDREN"] = "children";
})(FieldName || (FieldName = {}));
var defaultFieldNames = {
text: FieldName.TEXT,
value: FieldName.VALUE,
children: FieldName.CHILDREN,
};
(0, component_1.VantComponent)({
props: {
title: String,
value: {
type: String,
},
placeholder: {
type: String,
value: '请选择',
},
activeColor: {
type: String,
value: '#1989fa',
},
options: {
type: Array,
value: [],
},
swipeable: {
type: Boolean,
value: false,
},
closeable: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
},
closeIcon: {
type: String,
value: 'cross',
},
fieldNames: {
type: Object,
value: defaultFieldNames,
observer: 'updateFieldNames',
},
},
data: {
tabs: [],
activeTab: 0,
textKey: FieldName.TEXT,
valueKey: FieldName.VALUE,
childrenKey: FieldName.CHILDREN,
innerValue: '',
},
watch: {
options: function () {
this.updateTabs();
},
value: function (newVal) {
this.updateValue(newVal);
},
},
created: function () {
this.updateTabs();
},
methods: {
updateValue: function (val) {
var _this = this;
if (val !== undefined) {
var values = this.data.tabs.map(function (tab) { return tab.selected && tab.selected[_this.data.valueKey]; });
if (values.indexOf(val) > -1) {
return;
}
}
this.innerValue = val;
this.updateTabs();
},
updateFieldNames: function () {
var _a = this.data.fieldNames || defaultFieldNames, _b = _a.text, text = _b === void 0 ? 'text' : _b, _c = _a.value, value = _c === void 0 ? 'value' : _c, _d = _a.children, children = _d === void 0 ? 'children' : _d;
this.setData({
textKey: text,
valueKey: value,
childrenKey: children,
});
},
getSelectedOptionsByValue: function (options, value) {
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option[this.data.valueKey] === value) {
return [option];
}
if (option[this.data.childrenKey]) {
var selectedOptions = this.getSelectedOptionsByValue(option[this.data.childrenKey], value);
if (selectedOptions) {
return __spreadArray([option], selectedOptions, true);
}
}
}
},
updateTabs: function () {
var _this = this;
var options = this.data.options;
var innerValue = this.innerValue;
if (!options.length) {
return;
}
if (innerValue !== undefined) {
var selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
if (selectedOptions) {
var optionsCursor_1 = options;
var tabs_1 = selectedOptions.map(function (option) {
var tab = {
options: optionsCursor_1,
selected: option,
};
var next = optionsCursor_1.find(function (item) { return item[_this.data.valueKey] === option[_this.data.valueKey]; });
if (next) {
optionsCursor_1 = next[_this.data.childrenKey];
}
return tab;
});
if (optionsCursor_1) {
tabs_1.push({
options: optionsCursor_1,
selected: null,
});
}
this.setData({
tabs: tabs_1,
});
wx.nextTick(function () {
_this.setData({
activeTab: tabs_1.length - 1,
});
});
return;
}
}
this.setData({
tabs: [
{
options: options,
selected: null,
},
],
});
},
onClose: function () {
this.$emit('close');
},
onClickTab: function (e) {
var _a = e.detail, tabIndex = _a.index, title = _a.title;
this.$emit('click-tab', { title: title, tabIndex: tabIndex });
this.setData({
activeTab: tabIndex,
});
},
// 选中
onSelect: function (e) {
var _this = this;
var _a = e.currentTarget.dataset, option = _a.option, tabIndex = _a.tabIndex;
if (option && option.disabled) {
return;
}
var _b = this.data, valueKey = _b.valueKey, childrenKey = _b.childrenKey;
var tabs = this.data.tabs;
tabs[tabIndex].selected = option;
if (tabs.length > tabIndex + 1) {
tabs = tabs.slice(0, tabIndex + 1);
}
if (option[childrenKey]) {
var nextTab = {
options: option[childrenKey],
selected: null,
};
if (tabs[tabIndex + 1]) {
tabs[tabIndex + 1] = nextTab;
}
else {
tabs.push(nextTab);
}
wx.nextTick(function () {
_this.setData({
activeTab: tabIndex + 1,
});
});
}
this.setData({
tabs: tabs,
});
var selectedOptions = tabs.map(function (tab) { return tab.selected; }).filter(Boolean);
var value = option[valueKey];
var params = {
value: value,
tabIndex: tabIndex,
selectedOptions: selectedOptions,
};
this.innerValue = value;
this.$emit('change', params);
if (!option[childrenKey]) {
this.$emit('finish', params);
}
},
},
});

8
wxcomponents/vant/cascader/index.json

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-tab": "../tab/index",
"van-tabs": "../tabs/index"
}
}

53
wxcomponents/vant/cascader/index.wxml

@ -0,0 +1,53 @@
<wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header">
<text class="van-cascader__title"><slot name="title"></slot>{{ title }}</text>
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"
class="van-cascader__close-icon"
bind:tap="onClose"
/>
</view>
<van-tabs
active="{{ activeTab }}"
custom-class="van-cascader__tabs"
wrap-class="van-cascader__tabs-wrap"
tab-class="van-cascader__tab"
color="{{ activeColor }}"
border="{{ false }}"
swipeable="{{ swipeable }}"
bind:click="onClickTab"
>
<van-tab
wx:for="{{ tabs }}"
wx:for-item="tab"
wx:for-index="tabIndex"
wx:key="tabIndex"
title="{{ tab.selected ? tab.selected[textKey] : placeholder }}"
style="width: 100%;"
title-style="{{ !tab.selected ? 'color: #969799;font-weight:normal;' : '' }}"
>
<!-- 暂不支持 -->
<!-- <slot name="options-top"></slot> -->
<view class="van-cascader__options">
<view
wx:for="{{ tab.options }}"
wx:for-item="option"
wx:key="index"
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
data-option="{{ option }}"
data-tab-index="{{ tabIndex }}"
bind:tap="onSelect"
>
<text>{{ option[textKey] }}</text>
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
</view>
</view>
<!-- 暂不支持 -->
<!-- <slot name="options-bottom"></slot> -->
</van-tab>
</van-tabs>

24
wxcomponents/vant/cascader/index.wxs

@ -0,0 +1,24 @@
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function isSelected(tab, valueKey, option) {
return tab.selected && tab.selected[valueKey] === option[valueKey]
}
function optionClass(tab, valueKey, option) {
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
}
function optionStyle(data) {
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
return style({
color
});
}
module.exports = {
isSelected: isSelected,
optionClass: optionClass,
optionStyle: optionStyle,
};

1
wxcomponents/vant/cascader/index.wxss

@ -0,0 +1 @@
@import '../common/index.wxss';.van-cascader__header{align-items:center;display:flex;height:48px;justify-content:space-between;padding:0 16px}.van-cascader__title{font-size:16px;font-weight:600;line-height:20px}.van-cascader__close-icon{color:#c8c9cc;font-size:22px;height:22px}.van-cascader__tabs-wrap{height:48px!important;padding:0 8px}.van-cascader__tab{color:#323233!important;flex:none!important;font-weight:600!important;padding:0 8px!important}.van-cascader__tab--unselected{color:#969799!important;font-weight:400!important}.van-cascader__option{align-items:center;cursor:pointer;display:flex;font-size:14px;justify-content:space-between;line-height:20px;padding:10px 16px}.van-cascader__option:active{background-color:#f2f3f5}.van-cascader__option--selected{color:#1989fa;font-weight:600}.van-cascader__option--disabled{color:#c8c9cc;cursor:not-allowed}.van-cascader__option--disabled:active{background-color:initial}.van-cascader__options{-webkit-overflow-scrolling:touch;box-sizing:border-box;height:384px;overflow-y:auto;padding-top:6px}
Loading…
Cancel
Save