From fd143bb3271ef205d0ed9aa68dfef3d18619f6e1 Mon Sep 17 00:00:00 2001
From: huliyong <2783385703@qq.com>
Date: Tue, 11 Mar 2025 23:08:42 +0800
Subject: [PATCH] 1
---
pages.json | 8 +
pages/home/index.vue | 22 +-
pages_subpack/tourGuide/tourGuide.vue | 470 ++++++++++++++++++++++++++++++++++
utils/oss-upload/oss/index.js | 10 -
utils/oss-upload/oss/web.js | 63 -----
5 files changed, 496 insertions(+), 77 deletions(-)
create mode 100644 pages_subpack/tourGuide/tourGuide.vue
delete mode 100644 utils/oss-upload/oss/web.js
diff --git a/pages.json b/pages.json
index 48ffa37..7f5a9eb 100644
--- a/pages.json
+++ b/pages.json
@@ -169,6 +169,14 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
+ },
+ {
+ "path": "tourGuide/tourGuide",
+ "style": {
+ "navigationBarTitleText": "地图导览",
+ "navigationBarBackgroundColor": "#1EC77A",
+ "navigationBarTextStyle": "white"
+ }
}
]
}
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 34dc4c3..81b91ae 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -184,6 +184,17 @@
commonIndexIndexIcon({}).then(response=>{
console.info('onCommonIndexIndexIcon',response)
that.nav = response.result
+ // 检查是否已存在地图导览入口
+ let hasMapGuide = that.nav.some(item => item.url === '/pages_subpack/tourGuide/tourGuide')
+ if(!hasMapGuide) {
+ // 添加地图导览入口
+ that.nav.push({
+ id: 'map_guide',
+ title: '地图导览',
+ image: 'https://tennis-oss.xzaiyp.top/2024-12-08/9704d4a0-e8d8-40fc-a2b6-28b928013a60.png',
+ url: '/pages_subpack/tourGuide/tourGuide'
+ })
+ }
}).catch(error=>{
})
@@ -260,10 +271,13 @@
},
handleAreaChange(){
- uni.chooseAddress({
- success(res) {
- console.info(res)
- }
+ // uni.chooseAddress({
+ // success(res) {
+ // console.info(res)
+ // }
+ // })
+ uni.navigateTo({
+ url:"/pages_subpack/tourGuide/tourGuide"
})
// this.$refs.citySelectRef.open()
},
diff --git a/pages_subpack/tourGuide/tourGuide.vue b/pages_subpack/tourGuide/tourGuide.vue
new file mode 100644
index 0000000..9cb4f87
--- /dev/null
+++ b/pages_subpack/tourGuide/tourGuide.vue
@@ -0,0 +1,470 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+ {{ item.homeType }}
+ {{ item.timeGo }}年
+
+
+
+
+
+ {{ items }}
+
+
+
+
+
+
+
+
+ {{ item.num }}
+
+
+
+ ¥{{ item.price }}元/{{ item.unit }}
+ {{ item.address }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/utils/oss-upload/oss/index.js b/utils/oss-upload/oss/index.js
index 024eb80..91b7093 100644
--- a/utils/oss-upload/oss/index.js
+++ b/utils/oss-upload/oss/index.js
@@ -2,10 +2,6 @@
* 阿里云OSS工具类
*/
import OSSConfig from "@/utils/oss-upload/oss/OSSConfig.js"
-//支持web端
-import {
- uploadFileToOSS
-} from '@/utils/oss-upload/oss/web.js'
import ossConfig from '@/config.js'
/**
@@ -93,9 +89,6 @@ export function ossUploadImage({
count: 1,
sizeType,
success(res) {
- // #ifdef H5
- return uploadFileToOSS(res.tempFiles[0]).then(success).catch(fail)
- // #endif
ossUpload(res.tempFilePaths[0], key, folder).then(success).catch(fail)
},
fail
@@ -123,9 +116,6 @@ export function ossUploadVideo({
maxDuration,
camera,
success(res) {
- // #ifdef H5
- return uploadFileToOSS(res.tempFile).then(success).catch(fail)
- // #endif
ossUpload(res.tempFilePath, key, folder).then(success).catch(fail)
},
fail
diff --git a/utils/oss-upload/oss/web.js b/utils/oss-upload/oss/web.js
deleted file mode 100644
index dfaab6e..0000000
--- a/utils/oss-upload/oss/web.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// 此方法适用于web
-import OSS from "ali-oss"
-import config from '@/config.js'
-
-/**
- * 生成一个随机的Key
- */
-function storeKey() {
- let s = [];
- let hexDigits = "0123456789abcdef";
- for (let i = 0; i < 36; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
- }
- s[14] = "4";
- s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
- s[8] = s[13] = s[18] = s[23] = "-";
- return s.join("");
-}
-
-/**
- * 根据当天日期在OSS端生成文件夹
- */
-function storeFolder() {
- const date = new Date();
- const formatNumber = n => {
- n = n.toString()
- return n[1] ? n : '0' + n
- }
- return [date.getFullYear(), date.getMonth() + 1, date.getDate()].map(formatNumber).join('-')
-}
-
-
-export function uploadFileToOSS(file) {
-
- uni.showLoading({
- title: '上传中...'
- });
-
- return new Promise((resolve,reject) => {
- // 创建OSS实例
- const client = new OSS(config.aliOss.config);
-
- // 设置文件名和文件目录
- const suffix = '.' + file.name.split('.').pop();
- let key = storeFolder()
- if(key[key.length - 1] != '/') key += '/'
- const fileName = key + storeKey() + suffix; // 注意:文件名需要是唯一的
-
- // 使用put接口上传文件
- client.multipartUpload(fileName, file, {
- headers: {
- 'Content-Disposition': 'inline',
- 'Content-Type': file.type
- }
- }).then(res => {
- uni.hideLoading();
- resolve(config.aliOss.url + res.name);
- }).catch(err => {
- uni.hideLoading();
- reject(err)
- })
- })
-}
\ No newline at end of file