绿满眶商城微信小程序-uniapp
peng
2025-07-18 a77bbfaea09231e6bd73adc88416efcc3b663bf3
解决主包过大问题
7个文件已修改
4个文件已添加
440 ■■■■■ 已修改文件
App.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/api.js 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/m-share/index.vue 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/m-share/mp-share.scss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/payment/shareOrderGoods.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/passport/entry/seller/step3.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/passport/uniMap.vue 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/video/my-tag.vue 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/video/video-edit.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
                    // 获取本地存储中launchFlag标识 开屏广告
@@ -159,7 +159,7 @@
                        },
                    });
                }
            },
            }, */
            /**
             * 获取粘贴板数据
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",
};
//默认生产环境
config/config.js
@@ -23,5 +23,5 @@
  lightColor: "#ff6b35", // 高亮主题色
  aiderLightColor: "#ff9f28", // 辅助高亮颜色
  defaultUserPhoto: "/pages/subComponents/static/missing-face.png", // 默认用户头像
  enableFetchMobileLogin: false // 是否启用获取手机号登录 如果微信小程序提示封禁手机号获取权限 可将此选项设置成false作为备用登录方案
  enableFetchMobileLogin: true // 是否启用获取手机号登录 如果微信小程序提示封禁手机号获取权限 可将此选项设置成false作为备用登录方案
};
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';
// 自定义tabbar
pages/cart/m-share/index.vue
New file
@@ -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(goods,shop,pintuan) 拼团商品分享以及店铺分享
  props: ["thumbnail", "goodsName", "type", "goodsId", "link"],
  methods: {
    close() {
      this.$emit("close");
    },
    weChatShare(){
      this.$u.mpShare = {
        title:  this.shareTitle(), // 默认为小程序名称,可自定义
        path: '', // 默认为当前页面路径,一般无需修改,QQ小程序不支持
        // 分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径。
        // 支持PNG及JPG,默认为当前页面的截图
        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>
pages/cart/m-share/mp-share.scss
New file
@@ -0,0 +1,8 @@
.share-btn {
    background: none;
    font-size: 24rpx;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
}
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"; //购物车商品的模块
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},
pages/passport/uniMap.vue
New file
@@ -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服务的key
            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>
pages/video/my-tag.vue
New file
@@ -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'">&#xe6ea;</text>
        <text v-else-if="type == 'primary'">&#xe7f9;</text>
        <text v-else-if="type == 'success'">&#xe7fa;</text>
        <text v-else-if="type == 'warning'">&#xe7fb;</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>
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";