From 5066d336f5a78debfbcdacc69b71aeab6d2b58e5 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期四, 17 七月 2025 18:35:42 +0800 Subject: [PATCH] 解决主包过大问题 --- config/api.js | 16 ++-- pages/cusbar/video/video.vue | 2 pages/tabbar/user/utils/tool.vue | 5 pages/cusbar/my-tag.vue | 100 +++++++++++++++++++++++++ pages/mine/address/add.vue | 2 pages/mine/uniMap.vue | 111 +++++++++++++++++++++++++++ 6 files changed, 223 insertions(+), 13 deletions(-) diff --git a/config/api.js b/config/api.js index d5be35c..6298d5c 100644 --- a/config/api.js +++ b/config/api.js @@ -4,17 +4,17 @@ */ // 寮�鍙戠幆澧� const dev = { - // im: "http://192.168.0.15:8885", - // common: "http://192.168.0.15:8890", - // buyer: "http://192.168.0.15:8888", - // store: "http://192.168.0.15:8889", + im: "http://192.168.0.15:8885", + common: "http://192.168.0.15:8890", + buyer: "http://192.168.0.15:8888", + store: "http://192.168.0.15:8889", // common: "http://192.168.0.113:8890", // buyer: "http://192.168.0.113:8888", // im: "http://192.168.0.113:8885", - im: "http://1.95.67.54:888", - common: "http://1.95.67.54:888", - buyer: "http://1.95.67.54:888", - store: "http://1.95.67.54:888", + // im: "http://1.95.67.54:888", + // common: "http://1.95.67.54:888", + // buyer: "http://1.95.67.54:888", + // store: "http://1.95.67.54:888", }; // 鐢熶骇鐜 const prod = { diff --git a/pages/cusbar/my-tag.vue b/pages/cusbar/my-tag.vue new file mode 100644 index 0000000..b4e51f4 --- /dev/null +++ b/pages/cusbar/my-tag.vue @@ -0,0 +1,100 @@ +<template> + <view> + <view class="my-tab-warp" :class="[`my-tab-${type}`]"> + <text class="my-tab-text" @click="clickTab">{{text}}</text> + <view + v-if="closeable" + @click="close" + class="iconfont my-tab-close" + > + <text v-if="type == 'error'"></text> + <text v-else-if="type == 'primary'"></text> + <text v-else-if="type == 'success'"></text> + <text v-else-if="type == 'warning'"></text> + </view> + </view> + </view> +</template> + +<script> +export default { + name: "my-tag", + props: { + text: { + type: String + }, + // 鍏抽棴銆佺偣鍑绘椂鐨勫洖浼犲弬鏁� + index: { + type: Number + }, + closeable: { + type: Boolean, + default: true + }, + type: { + type: String, + default: 'error', + validator: (value) => ['primary', 'success', 'error', 'warning'].includes(value) + } + }, + methods: { + close() { + this.$emit('close', this.index) + }, + clickTab() { + this.$emit('click', this.index) + } + } +} +</script> + +<style> +.my-tab-warp { + display: inline-flex; + flex-direction: row; + justify-content: center; + align-items: center; + height: 22px; + line-height: 22px; + border-radius: 3px; + padding: 0 8px; + font-size: 12px; + margin-right: 3px; + border: 1px solid; +} + +.my-tab-text { + color: inherit; +} + +.my-tab-close { + font-size: 12px !important; + margin-left: 4px; + cursor: pointer; +} + +/* 涓嶅悓绫诲瀷鏍峰紡 */ +.my-tab-primary { + color: #2d8cf0; + border-color: #2d8cf0; + background-color: rgba(45, 140, 240, 0.1); +} + +.my-tab-success { + color: #19be6b; + border-color: #19be6b; + background-color: rgba(25, 190, 107, 0.1); +} + +.my-tab-error { + color: #ed4014; + border-color: #ed4014; + background-color: rgba(237, 64, 20, 0.1); +} + +.my-tab-warning { + color: #ff9900; + border-color: #ff9900; + background-color: rgba(255, 153, 0, 0.1); +} +</style> \ No newline at end of file diff --git a/pages/cusbar/video/video.vue b/pages/cusbar/video/video.vue index 9d44a31..0995917 100644 --- a/pages/cusbar/video/video.vue +++ b/pages/cusbar/video/video.vue @@ -206,7 +206,7 @@ <script> import '@/components/uview-components/uview-ui'; -import MyTag from '@/pages/subComponents/my-tag.vue' +import MyTag from '@/pages/cusbar/my-tag.vue' import { getSTSToken } from "@/api/common.js"; import { publish } from "@/api/video.js"; diff --git a/pages/mine/address/add.vue b/pages/mine/address/add.vue index 6c3c767..b2d8df2 100644 --- a/pages/mine/address/add.vue +++ b/pages/mine/address/add.vue @@ -44,7 +44,7 @@ import { addAddress, editAddress, getAddressDetail } from "@/api/address.js"; import city from "@/pages/mine/m-city/m-city.vue"; -import uniMap from "@/pages/subComponents/uniMap.vue"; +import uniMap from "@/pages/mine/uniMap.vue"; import permision from "@/js_sdk/wa-permission/permission.js"; export default { components: { diff --git a/pages/mine/uniMap.vue b/pages/mine/uniMap.vue new file mode 100644 index 0000000..c315487 --- /dev/null +++ b/pages/mine/uniMap.vue @@ -0,0 +1,111 @@ +<template></template> +<script> +import { getAddressCode } from "@/api/address"; +import config from '@/config/config' +export default { + data() { + return { + config + }; + }, + mounted() { + this.init(); + }, + methods: { + // 鍒濆鍖栧湴鍥惧苟涓旇皟鐢� + initMap() { + let that = this; + uni.chooseLocation({ + success: function (res) { + /**鑾峰彇鍦板潃璇︽儏鍦板潃 */ + that.posToCity(res.latitude, res.longitude).then((val) => { + /**鑾峰彇鍦板潃code */ + getAddressCode( + val.regeocode.addressComponent.citycode, + val.regeocode.addressComponent.township + ).then((code) => { + that.$emit("callback", { ...val, ...res, ...code }); + that.$emit("close"); + }); + }); + }, + fail(e) { + console.log(e) + that.$emit("close"); + }, + }); + }, + + // 鏍规嵁褰撳墠瀹㈡埛绔垽鏂睍绀轰笉鍚岀被鍨嬫暟鎹� + init() { + // #ifdef MP-WEIXIN + this.wechatMap(); + // #endif + // #ifndef MP-WEIXIN + this.initMap(); + // #endif + }, + + // 濡傛灉鏄井淇″皬绋嬪簭鍗曠嫭璧板井淇″皬绋嬪簭鎺堟潈妯″紡 + wechatMap() { + let that = this; + uni.authorize({ + scope: "scope.userLocation", + success() { + // 鍏佽鎺堟潈 + that.initMap(); + }, + fail() { + //鎷掔粷鎺堟潈 + uni.showModal({ + content: "妫�娴嬪埌鎮ㄦ病鎵撳紑鑾峰彇鍦板潃鍔熻兘鏉冮檺锛屾槸鍚﹀幓璁剧疆鎵撳紑锛�", + confirmText: "纭", + cancelText: "鍙栨秷", + success: (res) => { + if (res.confirm) { + // 鎵撳紑璁剧疆濂藉悗閲嶆柊鍒锋柊鍦板浘 + uni.openSetting({ + success: (res) => { + that.initMap(); + }, + }); + } else { + // 鍙栨秷鍚庡叧闂� + that.$emit("close"); + return false; + } + }, + }); + return false; + }, + }); + }, + // 鑾峰彇鍩庡競鐨勬暟鎹� + posToCity(latitude, longitude) { + return new Promise((resolve, reject) => { + uni.request({ + url: `https://restapi.amap.com/v3/geocode/regeo`, + method: "GET", + data: { + key: config.aMapKey, //web鏈嶅姟鐨刱ey + location: `${longitude},${latitude}`, + }, + success: ({ data }) => { + const { status, info } = data; + if (status === "1") { + resolve(data); + } else { + reject(info); + } + }, + fail: (err) => { + reject(err); + }, + }); + }); + }, + }, +}; +</script> +<style lang="scss" scoped> +</style> \ No newline at end of file diff --git a/pages/tabbar/user/utils/tool.vue b/pages/tabbar/user/utils/tool.vue index b1c458b..740dad8 100644 --- a/pages/tabbar/user/utils/tool.vue +++ b/pages/tabbar/user/utils/tool.vue @@ -3,7 +3,7 @@ <!-- 甯哥敤宸ュ叿 --> <view class="interact-tools" style="margin-bottom: 15px"> - <div class="paddingBox"> + <view class="paddingBox"> <view class="interact-container"> <view class="interact-item" @click="navigateTo('/pages/mine/address/addressManage')"> <image src="/static/mine/myaddress.png" mode=""></image> @@ -51,7 +51,6 @@ <image src="/static/mine/shensu.png" mode=""></image> <view>鎴戠殑娲诲姩</view> </view> --> - </view> <view class="interact-item" @click="navigateTo('/pages/mine/activity/applayActivityList')"> <image src="/static/mine/shensu.png" mode=""></image> @@ -138,7 +137,7 @@ </view> </view> - </div> + </view> </view> </view> </template> -- Gitblit v1.8.0