From a77bbfaea09231e6bd73adc88416efcc3b663bf3 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期五, 18 七月 2025 15:22:13 +0800 Subject: [PATCH] 解决主包过大问题 --- config/api.js | 23 +- pages/video/video-edit.vue | 2 pages/video/my-tag.vue | 100 ++++++++++++ pages/cart/m-share/mp-share.scss | 8 + main.js | 2 pages/cart/payment/shareOrderGoods.vue | 2 App.vue | 10 config/config.js | 2 pages/passport/entry/seller/step3.vue | 2 pages/passport/uniMap.vue | 111 +++++++++++++ pages/cart/m-share/index.vue | 178 ++++++++++++++++++++++ 11 files changed, 419 insertions(+), 21 deletions(-) diff --git a/App.vue b/App.vue index 62fe818..d6bac29 100644 --- a/App.vue +++ b/App.vue @@ -42,7 +42,7 @@ let curRoute = routes[routes.length - 1].options; routes.forEach((item) => { if ( - item.route == "pages/tabbar/cart/cartList" || + item.route == "pages/cusbar/cart/cartList" || item.route.indexOf("pages/product/goods") != -1 ) { uni.redirectTo({ @@ -53,7 +53,7 @@ if (curRoute.addId) { uni.reLaunch({ - url: "/pages/tabbar/cart/cartList", + url: "/pages/cusbar/cart/cartList", }); } else { uni.navigateBack(); @@ -90,7 +90,7 @@ if (storage.getShow()) { if (uni.getSystemInfoSync().platform == 'ios') { - this.$u.route("/pages/tabbar/screen/fullScreen"); + this.$u.route("/pages/cusbar/screen/fullScreen"); } } @@ -124,7 +124,7 @@ }); }, - // TODO 寮�灞忓箍鍛� 鍚庣画浼樺寲娣诲姞 +/* // TODO 寮�灞忓箍鍛� 鍚庣画浼樺寲娣诲姞 launch() { try { // 鑾峰彇鏈湴瀛樺偍涓璴aunchFlag鏍囪瘑 寮�灞忓箍鍛� @@ -159,7 +159,7 @@ }, }); } - }, + }, */ /** * 鑾峰彇绮樿创鏉挎暟鎹� diff --git a/config/api.js b/config/api.js index 6298d5c..6e032b5 100644 --- a/config/api.js +++ b/config/api.js @@ -4,23 +4,24 @@ */ // 寮�鍙戠幆澧� 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 = { - im: "https://im-api.pickmall.cn", - common: "https://common-api.pickmall.cn", - buyer: "https://buyer-api.pickmall.cn", + 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", }; //榛樿鐢熶骇鐜 diff --git a/config/config.js b/config/config.js index f6d044d..d5e771e 100644 --- a/config/config.js +++ b/config/config.js @@ -23,5 +23,5 @@ lightColor: "#ff6b35", // 楂樹寒涓婚鑹� aiderLightColor: "#ff9f28", // 杈呭姪楂樹寒棰滆壊 defaultUserPhoto: "/pages/subComponents/static/missing-face.png", // 榛樿鐢ㄦ埛澶村儚 - enableFetchMobileLogin: false // 鏄惁鍚敤鑾峰彇鎵嬫満鍙风櫥褰� 濡傛灉寰俊灏忕▼搴忔彁绀哄皝绂佹墜鏈哄彿鑾峰彇鏉冮檺 鍙皢姝ら�夐」璁剧疆鎴恌alse浣滀负澶囩敤鐧诲綍鏂规 + enableFetchMobileLogin: true // 鏄惁鍚敤鑾峰彇鎵嬫満鍙风櫥褰� 濡傛灉寰俊灏忕▼搴忔彁绀哄皝绂佹墜鏈哄彿鑾峰彇鏉冮檺 鍙皢姝ら�夐」璁剧疆鎴恌alse浣滀负澶囩敤鐧诲綍鏂规 }; diff --git a/main.js b/main.js index 6ba3692..9007db8 100644 --- a/main.js +++ b/main.js @@ -4,7 +4,7 @@ import uView from '@/components/uview-components/uview-ui' import store from "./store"; import config from '@/config/config'; -import airBtn from "@/pages/subComponents/m-airbtn/index.vue"; +import airBtn from "./pages/subComponents/m-airbtn"; import socketIO from './pages/mine/im/socket'; // 鑷畾涔塼abbar diff --git a/pages/cart/m-share/index.vue b/pages/cart/m-share/index.vue new file mode 100644 index 0000000..e181d43 --- /dev/null +++ b/pages/cart/m-share/index.vue @@ -0,0 +1,178 @@ +<template> + <!-- 閬僵灞� --> + <u-popup @close="close" v-model="show" mode="bottom" border-radius="30" height="260rpx"> + + <view class="share-title"> + <span>鍒嗕韩鑷�</span> + </view> + <view class="share-list"> + <!-- #ifdef MP-WEIXIN --> + <view class="share-item"> + <button class="share-btn" @click="weChatShare" open-type="share"> + <u-icon color="#04BE02" size="80" name="weixin-fill"></u-icon>寰俊濂藉弸 + </button> + </view> + <!-- #endif --> + <!-- #ifdef APP-PLUS --> + <view class="share-item" @click="handleShare(item)" v-for="(item, index) in list" :key="index"> + <u-icon :color="item.color" size="80" :name="item.icon"></u-icon> + <view>{{ item.title }}</view> + </view> + <!-- #endif --> + <!-- #ifdef H5 --> + <view class="share-item" @click="copyLink()"> + <u-icon color="#b4aee8" size="80" name="share-fill"></u-icon> + <view>{{ '澶嶅埗閾炬帴' }}</view> + </view> + <!-- #endif --> + </view> + </u-popup> +</template> +<script> +import '@/components/uview-components/uview-ui'; + +import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js"; +import configs from "@/config/config"; +import mpShare from "@/components/uview-components/uview-ui/index.js"; + +export default { + mixins: [mpShare], + data() { + return { + configs, + show: true, + list: [ + { + color: "#04BE02", + title: "寰俊濂藉弸", + icon: "weixin-fill", + type: 0, + }, + { + color: "#04BE02", + title: "鏈嬪弸鍦�", + icon: "weixin-circle-fill", + type: 1, + }, + ], + }; + }, + // 鍥剧墖缂╃暐鍥俱�� 鍟嗗搧鍚嶇О 銆� type锛坓oods,shop,pintuan) 鎷煎洟鍟嗗搧鍒嗕韩浠ュ強搴楅摵鍒嗕韩 + + props: ["thumbnail", "goodsName", "type", "goodsId", "link"], + methods: { + close() { + this.$emit("close"); + }, + weChatShare(){ + this.$u.mpShare = { + title: this.shareTitle(), // 榛樿涓哄皬绋嬪簭鍚嶇О锛屽彲鑷畾涔� + path: '', // 榛樿涓哄綋鍓嶉〉闈㈣矾寰勶紝涓�鑸棤闇�淇敼锛孮Q灏忕▼搴忎笉鏀寔 + // 鍒嗕韩鍥炬爣锛岃矾寰勫彲浠ユ槸鏈湴鏂囦欢璺緞銆佷唬鐮佸寘鏂囦欢璺緞鎴栬�呯綉缁滃浘鐗囪矾寰勩�� + // 鏀寔PNG鍙奐PG锛岄粯璁や负褰撳墠椤甸潰鐨勬埅鍥� + imageUrl: this.thumbnail ||'' + } + }, + + // h5澶嶅埗閾炬帴 + // #ifdef H5 + copyLink() { + let content; + if (this.link) { + content = this.configs.shareLink + this.link; + } else { + content = + this.configs.shareLink + + getCurrentPages()[getCurrentPages().length - 1].__page__.fullPath; + } + this.$options.filters.setClipboard(content) + }, + // #endif + + shareTitle() { + let shareTitle; + if (this.type == "goods") { + shareTitle = `[濂藉弸鎺ㄨ崘]${this.goodsName}蹇潵璺熸垜涓�璧风湅鐪嬪惂`; + } else if (this.type == "shops") { + shareTitle = `[濂藉弸鍙戠幇]${this.goodsName}蹇潵璺熸垜涓�璧风湅鐪嬪惂`; + } else if (this.type == "pintuan") { + shareTitle = `[濂藉弸閭�璇穄${this.goodsName}蹇潵璺熸垜涓�璧锋姠璐惂!`; + } else if (this.type == "kanjia") { + shareTitle = `[濂藉弸閭�璇穄璇峰揩鏉ュ府鎴戠爫涓�鍒�${this.goodsName}`; + } + return shareTitle; + }, + + // #ifdef APP-PLUS + handleShare(val) { + console.log("12312312") + if (val.type <= 1) { + let scene; // "WXSenceTimeline 鏈嬪弸鍦� WXSceneSession 寰俊濂藉弸" + val.type == 1 + ? (scene = "WXSenceTimeline") + : (scene = "WXSceneSession"); + uni.share({ + provider: "weixin", + scene: scene, + href: configs.shareLink + this.link, + imageUrl: this.thumbnail, + type: 0, + summary: this.goodsName, + title: this.shareTitle(), + success: function (res) { + uni.showToast({ + title: "鍒嗕韩鎴愬姛!", + duration: 2000, + icon: "none", + }); + this.$emit("close"); + }, + fail: function (err) { + uni.showToast({ + title: "鍒嗕韩澶辫触!", + duration: 2000, + icon: "none", + }); + this.$emit("close"); + }, + }); + } + }, + // #endif + }, +}; +</script> +<style lang="scss" scoped> +@import "./mp-share.scss"; +.share-title { + position: relative; + height: 90rpx; + font-size: 32rpx; + line-height: 90rpx; + text-align: center; + > .share-close { + position: absolute; + right: 0; + right: 20rpx; + top: 30rpx; + } +} +button:after { + border: none; +} + +.share-list { + padding: 0 32rpx; + display: flex; + text-align: center; + align-items: center; + > .share-item { + width: 25%; + font-size: 24rpx; + color: #666; + > * { + margin: 8rpx 0; + } + } +} +</style> \ No newline at end of file diff --git a/pages/cart/m-share/mp-share.scss b/pages/cart/m-share/mp-share.scss new file mode 100644 index 0000000..44e02a9 --- /dev/null +++ b/pages/cart/m-share/mp-share.scss @@ -0,0 +1,8 @@ +.share-btn { + background: none; + font-size: 24rpx; + color: #666; + display: flex; + flex-direction: column; + align-items: center; +} diff --git a/pages/cart/payment/shareOrderGoods.vue b/pages/cart/payment/shareOrderGoods.vue index 52eed0c..cfad93b 100644 --- a/pages/cart/payment/shareOrderGoods.vue +++ b/pages/cart/payment/shareOrderGoods.vue @@ -66,7 +66,7 @@ import '@/components/uview-components/uview-ui' import { getGoods } from "@/api/goods.js"; import { getPinTuanShare } from "@/api/order"; -import shares from "@/pages/cusbar/m-share/index.vue"; +import shares from "@/pages/cart/m-share/index.vue"; import storage from "@/utils/storage.js"; import popupGoods from "@/pages/cart/m-buy/goods.vue"; //璐墿杞﹀晢鍝佺殑妯″潡 diff --git a/pages/passport/entry/seller/step3.vue b/pages/passport/entry/seller/step3.vue index 111b531..d66812d 100644 --- a/pages/passport/entry/seller/step3.vue +++ b/pages/passport/entry/seller/step3.vue @@ -118,7 +118,7 @@ import city from "@/pages/passport/m-city/m-city.vue"; import storage from "@/utils/storage.js"; import { upload } from "@/api/common.js"; -import uniMap from "@/pages/subComponents/uniMap.vue"; +import uniMap from "@/pages/passport/uniMap.vue"; import permision from "@/js_sdk/wa-permission/permission.js"; export default { components: { "m-city": city, uniMap}, diff --git a/pages/passport/uniMap.vue b/pages/passport/uniMap.vue new file mode 100644 index 0000000..c315487 --- /dev/null +++ b/pages/passport/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/video/my-tag.vue b/pages/video/my-tag.vue new file mode 100644 index 0000000..b4e51f4 --- /dev/null +++ b/pages/video/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/video/video-edit.vue b/pages/video/video-edit.vue index 1b15ab4..8106225 100644 --- a/pages/video/video-edit.vue +++ b/pages/video/video-edit.vue @@ -206,7 +206,7 @@ <script> import '@/components/uview-components/uview-ui'; -import MyTag from '@/pages/subComponents/my-tag.vue' +import MyTag from '@/pages/video/my-tag.vue' import { getSTSToken, getFilePreviewUrl } from "@/api/common.js"; import { updateVideo, getVideoDetail } from "@/api/video.js"; -- Gitblit v1.8.0