Commit cdceeb8b766f37e8bd0d78e3bfc66960ed09bea8
1 parent
243edd37
优化小程序,司机上传图片交互优化
Showing
9 changed files
with
250 additions
and
21 deletions
garbage-removal/.env.dev
garbage-removal/.env.local
garbage-removal/dist.zip
0 → 100644
No preview for this file type
garbage-removal/src/pages/home-info/clean/index.vue
| @@ -408,7 +408,14 @@ | @@ -408,7 +408,14 @@ | ||
| 408 | const afterRead = async (event) => { | 408 | const afterRead = async (event) => { |
| 409 | // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式 | 409 | // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式 |
| 410 | let lists = [].concat(event.file); | 410 | let lists = [].concat(event.file); |
| 411 | + if(fileList.value[0].label=="预览"){ | ||
| 412 | + fileList.value = []; | ||
| 413 | + } | ||
| 414 | + | ||
| 411 | 415 | ||
| 416 | + console.log("1",fileList.value); | ||
| 417 | + let fileListLen = fileList.value.length; | ||
| 418 | + | ||
| 412 | lists.map((item) => { | 419 | lists.map((item) => { |
| 413 | fileList.value.push({ | 420 | fileList.value.push({ |
| 414 | ...item, | 421 | ...item, |
| @@ -416,7 +423,9 @@ | @@ -416,7 +423,9 @@ | ||
| 416 | message: '上传中', | 423 | message: '上传中', |
| 417 | }); | 424 | }); |
| 418 | }); | 425 | }); |
| 419 | - let fileListLen = fileList.value.length--; | 426 | + |
| 427 | + | ||
| 428 | + | ||
| 420 | // 将blob转为file对象的方法 | 429 | // 将blob转为file对象的方法 |
| 421 | function blobToFile(blob, fileName) { | 430 | function blobToFile(blob, fileName) { |
| 422 | return new File([blob], fileName, { | 431 | return new File([blob], fileName, { |
| @@ -448,10 +457,12 @@ | @@ -448,10 +457,12 @@ | ||
| 448 | 457 | ||
| 449 | 458 | ||
| 450 | } | 459 | } |
| 451 | - fileList.value = fileList.value.filter(item => { | ||
| 452 | - deletable.value = true | ||
| 453 | - return !item.label | ||
| 454 | - }) | 460 | + // console.log("2",fileList.value); |
| 461 | + // fileList.value = fileList.value.filter(item => { | ||
| 462 | + // deletable.value = true | ||
| 463 | + // return !item.label | ||
| 464 | + // }) | ||
| 465 | + console.log("3",fileList.value); | ||
| 455 | }; | 466 | }; |
| 456 | 467 | ||
| 457 | 468 |
garbage-removal/src/pages/order-info/order-disposal/scan-detail/index.vue
| @@ -179,11 +179,6 @@ | @@ -179,11 +179,6 @@ | ||
| 179 | console.log(val); | 179 | console.log(val); |
| 180 | } | 180 | } |
| 181 | const handlerSubmit = async () => { | 181 | const handlerSubmit = async () => { |
| 182 | - if (typeof(location.value.latitude) === 'undefined') { | ||
| 183 | - console.log('定位获取失败', ); | ||
| 184 | - uni.$u.toast("需要位置权限才能提交"); | ||
| 185 | - return; | ||
| 186 | - } | ||
| 187 | // 校验参数 | 182 | // 校验参数 |
| 188 | let params = { | 183 | let params = { |
| 189 | ...details.value, | 184 | ...details.value, |
| @@ -231,6 +226,13 @@ | @@ -231,6 +226,13 @@ | ||
| 231 | if (!validateImage(params.fillImageList)) { | 226 | if (!validateImage(params.fillImageList)) { |
| 232 | return false; | 227 | return false; |
| 233 | } | 228 | } |
| 229 | + | ||
| 230 | + if (typeof(location.value.latitude) === 'undefined') { | ||
| 231 | + console.log('定位获取失败', ); | ||
| 232 | + uni.$u.toast("需要位置权限才能提交"); | ||
| 233 | + return; | ||
| 234 | + } | ||
| 235 | + | ||
| 234 | return true; | 236 | return true; |
| 235 | } | 237 | } |
| 236 | 238 |
garbage-removal/src/pages/order-info/order-driver/detail/index.vue
| @@ -385,7 +385,21 @@ const createQrCodeValid = (val) => { | @@ -385,7 +385,21 @@ const createQrCodeValid = (val) => { | ||
| 385 | */ | 385 | */ |
| 386 | const handleUploadImage = (orderId, putType) => { | 386 | const handleUploadImage = (orderId, putType) => { |
| 387 | const data = dataGram.value; | 387 | const data = dataGram.value; |
| 388 | - uni.$u.route(`pages/order-info/order-driver/upload/index?orderId=${orderId}&carPlate=${data.garHandlerCarCode}&driver=${store.userInfo.userName}`) | 388 | + uni.showActionSheet({ |
| 389 | + itemList: ['上传装车图片', '上传卸车图片'], | ||
| 390 | + success: function (res) { | ||
| 391 | + console.log('选中了第' + (res.tapIndex + 1) + '个按钮'); | ||
| 392 | + if(res.tapIndex === 0){ | ||
| 393 | + uni.$u.route(`pages/order-info/order-driver/upload/index?orderId=${orderId}&carPlate=${data.garHandlerCarCode}&driver=${store.userInfo.userName}&putType=putOnImages`) | ||
| 394 | + }else{ | ||
| 395 | + uni.$u.route(`pages/order-info/order-driver/upload/index?orderId=${orderId}&carPlate=${data.garHandlerCarCode}&driver=${store.userInfo.userName}&putType=putDownImages`) | ||
| 396 | + } | ||
| 397 | + }, | ||
| 398 | + fail: function (res) { | ||
| 399 | + console.log(res.errMsg); | ||
| 400 | + } | ||
| 401 | + }); | ||
| 402 | + // uni.$u.route(`pages/order-info/order-driver/upload/index?orderId=${orderId}&carPlate=${data.garHandlerCarCode}&driver=${store.userInfo.userName}`) | ||
| 389 | } | 403 | } |
| 390 | 404 | ||
| 391 | /** | 405 | /** |
garbage-removal/src/pages/order-info/order-driver/upload/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <view class="upload-image-box"> | 2 | <view class="upload-image-box"> |
| 3 | - <view class="upload-image-box-choose"> | 3 | + <!-- <view class="upload-image-box-choose"> |
| 4 | <text class="upload-image-box-choose-txt">请选着上传图片类型:</text> | 4 | <text class="upload-image-box-choose-txt">请选着上传图片类型:</text> |
| 5 | <view class="upload-image-box-choose-type"> | 5 | <view class="upload-image-box-choose-type"> |
| 6 | <u-radio-group v-model="putType" @change="groupChange" placement="row"> | 6 | <u-radio-group v-model="putType" @change="groupChange" placement="row"> |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | </u-radio> | 10 | </u-radio> |
| 11 | </u-radio-group> | 11 | </u-radio-group> |
| 12 | </view> | 12 | </view> |
| 13 | - </view> | 13 | + </view> --> |
| 14 | <view class="upload-image-box-bottom"> | 14 | <view class="upload-image-box-bottom"> |
| 15 | <text class="upload-image-box-bottom-txt">{{ putType }}(最多上传10张)</text> | 15 | <text class="upload-image-box-bottom-txt">{{ putType }}(最多上传10张)</text> |
| 16 | <view class="upload-image-box-button-container"> | 16 | <view class="upload-image-box-button-container"> |
| @@ -58,6 +58,10 @@ | @@ -58,6 +58,10 @@ | ||
| 58 | name: "卸车图片" | 58 | name: "卸车图片" |
| 59 | }]) | 59 | }]) |
| 60 | const location = ref({}); | 60 | const location = ref({}); |
| 61 | + | ||
| 62 | + const isUpload = ref(false); | ||
| 63 | + | ||
| 64 | + | ||
| 61 | // 删除图片 | 65 | // 删除图片 |
| 62 | const deletePic = (event) => { | 66 | const deletePic = (event) => { |
| 63 | fileList.value.splice(event.index, 1); | 67 | fileList.value.splice(event.index, 1); |
| @@ -215,8 +219,8 @@ | @@ -215,8 +219,8 @@ | ||
| 215 | orderId.value = options.orderId; | 219 | orderId.value = options.orderId; |
| 216 | carPlate.value = options.carPlate; | 220 | carPlate.value = options.carPlate; |
| 217 | driver.value = options.driver; | 221 | driver.value = options.driver; |
| 218 | - // putType.value = options.putType === "putOnImages" ? "装车图片" : "卸车图片"; | ||
| 219 | - | 222 | + console.log(options.putType); |
| 223 | + putType.value = options.putType === "putOnImages" ? "装车图片" : "卸车图片"; | ||
| 220 | }) | 224 | }) |
| 221 | </script> | 225 | </script> |
| 222 | 226 |
garbage-removal/vite.config.js
| @@ -8,7 +8,7 @@ export default defineConfig({ | @@ -8,7 +8,7 @@ export default defineConfig({ | ||
| 8 | plugins: [ | 8 | plugins: [ |
| 9 | uni(), | 9 | uni(), |
| 10 | //本地环境开启https | 10 | //本地环境开启https |
| 11 | - // basicSsl() | 11 | + basicSsl() |
| 12 | ], | 12 | ], |
| 13 | resolve: { | 13 | resolve: { |
| 14 | alias: { | 14 | alias: { |
| @@ -19,6 +19,6 @@ export default defineConfig({ | @@ -19,6 +19,6 @@ export default defineConfig({ | ||
| 19 | server: { | 19 | server: { |
| 20 | port: 9000, | 20 | port: 9000, |
| 21 | //本地环境开启https | 21 | //本地环境开启https |
| 22 | - // https: true | 22 | + https: true |
| 23 | } | 23 | } |
| 24 | }) | 24 | }) |
install.sh
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +# Color definitions | ||
| 4 | +RED='\033[0;31m' | ||
| 5 | +GREEN='\033[0;32m' | ||
| 6 | +YELLOW='\033[1;33m' | ||
| 7 | +BLUE='\033[0;34m' | ||
| 8 | +CYAN='\033[0;36m' | ||
| 9 | +NC='\033[0m' # No Color | ||
| 10 | + | ||
| 11 | +# Logo | ||
| 12 | +print_logo() { | ||
| 13 | + echo -e "${CYAN}" | ||
| 14 | + cat << "EOF" | ||
| 15 | + ██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ | ||
| 16 | + ██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔═══██╗ | ||
| 17 | + ██║ ██║ ██║██████╔╝███████╗██║ ██║██████╔╝ ██████╔╝██████╔╝██║ ██║ | ||
| 18 | + ██║ ██║ ██║██╔══██╗╚════██║██║ ██║██╔══██╗ ██╔═══╝ ██╔══██╗██║ ██║ | ||
| 19 | + ╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║ ██║ ██║ ██║╚██████╔╝ | ||
| 20 | + ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ | ||
| 21 | +EOF | ||
| 22 | + echo -e "${NC}" | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +# Get download folder path | ||
| 26 | +get_downloads_dir() { | ||
| 27 | + if [[ "$(uname)" == "Darwin" ]]; then | ||
| 28 | + echo "$HOME/Downloads" | ||
| 29 | + else | ||
| 30 | + if [ -f "$HOME/.config/user-dirs.dirs" ]; then | ||
| 31 | + . "$HOME/.config/user-dirs.dirs" | ||
| 32 | + echo "${XDG_DOWNLOAD_DIR:-$HOME/Downloads}" | ||
| 33 | + else | ||
| 34 | + echo "$HOME/Downloads" | ||
| 35 | + fi | ||
| 36 | + fi | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +# Get latest version | ||
| 40 | +get_latest_version() { | ||
| 41 | + echo -e "${CYAN}ℹ️ Checking latest version...${NC}" | ||
| 42 | + latest_release=$(curl -s https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest) || { | ||
| 43 | + echo -e "${RED}❌ Cannot get latest version information${NC}" | ||
| 44 | + exit 1 | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + VERSION=$(echo "$latest_release" | grep -o '"tag_name": ".*"' | cut -d'"' -f4 | tr -d 'v') | ||
| 48 | + if [ -z "$VERSION" ]; then | ||
| 49 | + echo -e "${RED}❌ Failed to parse version from GitHub API response:\n${latest_release}" | ||
| 50 | + exit 1 | ||
| 51 | + fi | ||
| 52 | + | ||
| 53 | + echo -e "${GREEN}✅ Found latest version: ${VERSION}${NC}" | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +# Detect system type and architecture | ||
| 57 | +detect_os() { | ||
| 58 | + if [[ "$(uname)" == "Darwin" ]]; then | ||
| 59 | + # Detect macOS architecture | ||
| 60 | + ARCH=$(uname -m) | ||
| 61 | + if [[ "$ARCH" == "arm64" ]]; then | ||
| 62 | + OS="mac_arm64" | ||
| 63 | + echo -e "${CYAN}ℹ️ Detected macOS ARM64 architecture${NC}" | ||
| 64 | + else | ||
| 65 | + OS="mac_intel" | ||
| 66 | + echo -e "${CYAN}ℹ️ Detected macOS Intel architecture${NC}" | ||
| 67 | + fi | ||
| 68 | + elif [[ "$(uname)" == "Linux" ]]; then | ||
| 69 | + # Detect Linux architecture | ||
| 70 | + ARCH=$(uname -m) | ||
| 71 | + if [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then | ||
| 72 | + OS="linux_arm64" | ||
| 73 | + echo -e "${CYAN}ℹ️ Detected Linux ARM64 architecture${NC}" | ||
| 74 | + else | ||
| 75 | + OS="linux_x64" | ||
| 76 | + echo -e "${CYAN}ℹ️ Detected Linux x64 architecture${NC}" | ||
| 77 | + fi | ||
| 78 | + else | ||
| 79 | + # Assume Windows | ||
| 80 | + OS="windows" | ||
| 81 | + echo -e "${CYAN}ℹ️ Detected Windows system${NC}" | ||
| 82 | + fi | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +# Install and download | ||
| 86 | +install_cursor_free_vip() { | ||
| 87 | + local downloads_dir=$(get_downloads_dir) | ||
| 88 | + local binary_name="CursorFreeVIP_${VERSION}_${OS}" | ||
| 89 | + local binary_path="${downloads_dir}/${binary_name}" | ||
| 90 | + local download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}" | ||
| 91 | + | ||
| 92 | + # Check if file already exists | ||
| 93 | + if [ -f "${binary_path}" ]; then | ||
| 94 | + echo -e "${GREEN}✅ Found existing installation file${NC}" | ||
| 95 | + echo -e "${CYAN}ℹ️ Location: ${binary_path}${NC}" | ||
| 96 | + | ||
| 97 | + # Check if running as root | ||
| 98 | + if [ "$EUID" -ne 0 ]; then | ||
| 99 | + echo -e "${YELLOW}⚠️ Requesting administrator privileges...${NC}" | ||
| 100 | + if command -v sudo >/dev/null 2>&1; then | ||
| 101 | + echo -e "${CYAN}ℹ️ Starting program with sudo...${NC}" | ||
| 102 | + sudo chmod +x "${binary_path}" | ||
| 103 | + sudo "${binary_path}" | ||
| 104 | + else | ||
| 105 | + echo -e "${YELLOW}⚠️ sudo not found, trying to run normally...${NC}" | ||
| 106 | + chmod +x "${binary_path}" | ||
| 107 | + "${binary_path}" | ||
| 108 | + fi | ||
| 109 | + else | ||
| 110 | + # Already running as root | ||
| 111 | + echo -e "${CYAN}ℹ️ Already running as root, starting program...${NC}" | ||
| 112 | + chmod +x "${binary_path}" | ||
| 113 | + "${binary_path}" | ||
| 114 | + fi | ||
| 115 | + return | ||
| 116 | + fi | ||
| 117 | + | ||
| 118 | + echo -e "${CYAN}ℹ️ No existing installation file found, starting download...${NC}" | ||
| 119 | + echo -e "${CYAN}ℹ️ Downloading to ${downloads_dir}...${NC}" | ||
| 120 | + echo -e "${CYAN}ℹ️ Download link: ${download_url}${NC}" | ||
| 121 | + | ||
| 122 | + # Check if file exists | ||
| 123 | + if curl --output /dev/null --silent --head --fail "$download_url"; then | ||
| 124 | + echo -e "${GREEN}✅ File exists, starting download...${NC}" | ||
| 125 | + else | ||
| 126 | + echo -e "${RED}❌ Download link does not exist: ${download_url}${NC}" | ||
| 127 | + echo -e "${YELLOW}⚠️ Trying without architecture...${NC}" | ||
| 128 | + | ||
| 129 | + # Try without architecture | ||
| 130 | + if [[ "$OS" == "mac_arm64" || "$OS" == "mac_intel" ]]; then | ||
| 131 | + OS="mac" | ||
| 132 | + binary_name="CursorFreeVIP_${VERSION}_${OS}" | ||
| 133 | + download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}" | ||
| 134 | + echo -e "${CYAN}ℹ️ New download link: ${download_url}${NC}" | ||
| 135 | + | ||
| 136 | + if ! curl --output /dev/null --silent --head --fail "$download_url"; then | ||
| 137 | + echo -e "${RED}❌ New download link does not exist${NC}" | ||
| 138 | + exit 1 | ||
| 139 | + fi | ||
| 140 | + elif [[ "$OS" == "linux_x64" || "$OS" == "linux_arm64" ]]; then | ||
| 141 | + OS="linux" | ||
| 142 | + binary_name="CursorFreeVIP_${VERSION}_${OS}" | ||
| 143 | + download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}" | ||
| 144 | + echo -e "${CYAN}ℹ️ New download link: ${download_url}${NC}" | ||
| 145 | + | ||
| 146 | + if ! curl --output /dev/null --silent --head --fail "$download_url"; then | ||
| 147 | + echo -e "${RED}❌ New download link does not exist${NC}" | ||
| 148 | + exit 1 | ||
| 149 | + fi | ||
| 150 | + else | ||
| 151 | + exit 1 | ||
| 152 | + fi | ||
| 153 | + fi | ||
| 154 | + | ||
| 155 | + # Download file | ||
| 156 | + if ! curl -L -o "${binary_path}" "$download_url"; then | ||
| 157 | + echo -e "${RED}❌ Download failed${NC}" | ||
| 158 | + exit 1 | ||
| 159 | + fi | ||
| 160 | + | ||
| 161 | + # Check downloaded file size | ||
| 162 | + local file_size=$(stat -f%z "${binary_path}" 2>/dev/null || stat -c%s "${binary_path}" 2>/dev/null) | ||
| 163 | + echo -e "${CYAN}ℹ️ Downloaded file size: ${file_size} bytes${NC}" | ||
| 164 | + | ||
| 165 | + # If file is too small, it might be an error message | ||
| 166 | + if [ "$file_size" -lt 1000 ]; then | ||
| 167 | + echo -e "${YELLOW}⚠️ Warning: Downloaded file is too small, possibly not a valid executable file${NC}" | ||
| 168 | + echo -e "${YELLOW}⚠️ File content:${NC}" | ||
| 169 | + cat "${binary_path}" | ||
| 170 | + echo "" | ||
| 171 | + echo -e "${RED}❌ Download failed, please check version and operating system${NC}" | ||
| 172 | + exit 1 | ||
| 173 | + fi | ||
| 174 | + | ||
| 175 | + echo -e "${CYAN}ℹ️ Setting executable permissions...${NC}" | ||
| 176 | + if chmod +x "${binary_path}"; then | ||
| 177 | + echo -e "${GREEN}✅ Installation completed!${NC}" | ||
| 178 | + echo -e "${CYAN}ℹ️ Program downloaded to: ${binary_path}${NC}" | ||
| 179 | + echo -e "${CYAN}ℹ️ Starting program...${NC}" | ||
| 180 | + | ||
| 181 | + # Run program directly | ||
| 182 | + "${binary_path}" | ||
| 183 | + else | ||
| 184 | + echo -e "${RED}❌ Installation failed${NC}" | ||
| 185 | + exit 1 | ||
| 186 | + fi | ||
| 187 | +} | ||
| 188 | + | ||
| 189 | +# Main program | ||
| 190 | +main() { | ||
| 191 | + print_logo | ||
| 192 | + get_latest_version | ||
| 193 | + detect_os | ||
| 194 | + install_cursor_free_vip | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +# Run main program | ||
| 198 | +main |