vhall-mini-sdk 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,22 +29,22 @@ uni-app工程安装完成后,会在当前工程目录下自动生成 wxcompone
29
29
  (1) 原生微信小程序开发
30
30
 
31
31
  ```js
32
- const VhallMiniSdk = require('vhall-mini-sdk/sdk/main/index.js').default;
33
- const CustomMenuServer = require('vhall-mini-sdk/sdk/plugins/CustomMenuServer.js').default;
34
- const ChatServer = require('vhall-mini-sdk/sdk/plugins/ChatServer.js').default;
35
- const ProductServer = require('vhall-mini-sdk/sdk/plugins/ProductServer.js').default;
36
- const InteractServer = require('vhall-mini-sdk/sdk/plugins/InteractServer.js').default;
32
+ const VhallMiniSdk = require('vhall-mini-sdk/sdk/main/index.js');
33
+ const CustomMenuServer = require('vhall-mini-sdk/sdk/plugins/CustomMenuServer.js');
34
+ const ChatServer = require('vhall-mini-sdk/sdk/plugins/ChatServer.js');
35
+ const ProductServer = require('vhall-mini-sdk/sdk/plugins/ProductServer.js');
36
+ const InteractServer = require('vhall-mini-sdk/sdk/plugins/InteractServer.js');
37
37
  ```
38
38
 
39
39
  (2) uni-app小程序开发
40
40
 
41
41
  ```js
42
42
  import { ref, onMounted } from 'vue';
43
- const VhallMiniSdk = require('../../wxcomponents/vhall-mini-sdk/sdk/main/index.js').default;
44
- const CustomMenuServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/CustomMenuServer.js').default;
45
- const ChatServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/ChatServer.js').default;
46
- const ProductServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/ProductServer.js').default;
47
- const InteractServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/InteractServer.js').default;
43
+ const VhallMiniSdk = require('../../wxcomponents/vhall-mini-sdk/sdk/main/index.js');
44
+ const CustomMenuServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/CustomMenuServer.js');
45
+ const ChatServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/ChatServer.js');
46
+ const ProductServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/ProductServer.js');
47
+ const InteractServer = require('../../wxcomponents/vhall-mini-sdk/sdk/plugins/InteractServer.js');
48
48
  ```
49
49
 
50
50
  4. 更多接入支持,参考文档: https://vhall.apifox.cn/dev/sdk/wmp/quick-start
@@ -202,6 +202,10 @@ Component({
202
202
 
203
203
  // 点击小黄车,显示商品列表弹窗
204
204
  showProductList() {
205
+ const productServer = this.sdkInstance.get('productServer');
206
+ if (productServer) {
207
+ productServer.getProductList();
208
+ }
205
209
  this.setData({
206
210
  showProductList: true
207
211
  });
@@ -142,6 +142,7 @@ Component({
142
142
  this.unlistener = this.sdkInstance.on(obj);
143
143
  },
144
144
  async checkAndFetchMallRewardInfo(from, extra) {
145
+ this.sdkInstance.BRSAgent?.customLog(`checkAndFetchMallRewardInfo from=${from}`, JSON.stringify(extra));
145
146
  log.info('mall-reward checkAndFetchMallRewardInfo start');
146
147
  const mallRewardServer = this.sdkInstance.get('mallRewardServer');
147
148
  if (!mallRewardServer) return;
@@ -46,6 +46,7 @@ Component({
46
46
  const filteredProducts = val.filter(product => product.push_status === 1);
47
47
  // 最多显示3个商品卡片
48
48
  const products = filteredProducts.slice(0, 3);
49
+ this.properties.sdkInstance.get('logReportServer').report('116999', { stage: 'productCardUpdate', logData: products });
49
50
  this.setData({
50
51
  products: products
51
52
  });
@@ -1 +1 @@
1
- .product-card-container{align-items:flex-end;bottom:180rpx;display:flex;flex-direction:column;gap:16rpx;position:fixed;right:20rpx;z-index:999}.product-card{animation:slideIn .3s ease-out forwards;background-color:#fff;border-radius:12rpx;box-shadow:0 4rpx 12rpx rgba(0,0,0,.15);opacity:0;overflow:hidden;position:relative;transform:translateX(100%);width:240rpx}.product-card:first-child{animation-delay:0s}.product-card:nth-child(2){animation-delay:.1s}.product-card:nth-child(3){animation-delay:.2s}@keyframes slideIn{0%{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}.product-card-badge{background-color:rgba(0,0,0,.6);border-radius:30rpx;color:#fff;font-size:.71rem;left:8rpx;padding:4rpx 20rpx;position:absolute;top:8rpx;z-index:10}.product-card-badge .product-card-badge-icon{height:20rpx}.product-card-close{color:#fff;font-size:1.14rem;padding:0 14rpx;position:absolute;right:0rpx;top:0rpx;z-index:10}.product-card-image{height:240rpx;position:relative;width:100%}.product-card-image .product-card-img{height:100%;object-fit:cover;width:100%}.product-card-info{padding:12rpx}.product-card-title{color:#333;display:block;font-size:.86rem;font-weight:500;margin-bottom:12rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.product-card-price-container{align-items:center;background:#fb2626;border-radius:8rpx;color:#fff;display:flex;height:50rpx;justify-content:space-between;margin-top:12rpx;padding-left:10rpx}.product-card-buy{background-color:#ff4d4f;border-radius:6rpx;color:#fff;cursor:pointer;font-size:.71rem;padding:8rpx 16rpx}.product-card-mask{align-items:center;background-color:rgba(0,0,0,.4);bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.product-card-mask-text{border-radius:20rpx;color:#fff;font-size:.86rem;padding:8rpx 16rpx}.product-card-disabled{opacity:.7}.product-card-disabled .product-card-price{color:#fff}.product-card-disabled .product-card-price-container{opacity:.6}.buy-icon{display:block;height:100%}.product-card-small{width:180rpx}.product-card-small .product-card-image{height:180rpx}.product-card-small .product-card-price-container{height:40rpx}.product-card-small .product-card-badge{font-size:.64rem;padding:3rpx 16rpx}.product-card-small .product-card-close{font-size:1rem;padding:0 10rpx}.product-card-small .buy-icon{display:none}
1
+ .product-card-container{align-items:flex-end;bottom:180rpx;display:flex;flex-direction:column;gap:16rpx;position:fixed;right:20rpx;z-index:999}.product-card{background-color:#fff;border-radius:12rpx;box-shadow:0 4rpx 12rpx rgba(0,0,0,.15);overflow:hidden;position:relative;width:240rpx}.product-card-badge{background-color:rgba(0,0,0,.6);border-radius:30rpx;color:#fff;font-size:.71rem;left:8rpx;padding:4rpx 20rpx;position:absolute;top:8rpx;z-index:10}.product-card-badge .product-card-badge-icon{height:20rpx}.product-card-close{color:#fff;font-size:1.14rem;padding:0 14rpx;position:absolute;right:0rpx;top:0rpx;z-index:10}.product-card-image{height:240rpx;position:relative;width:100%}.product-card-image .product-card-img{height:100%;object-fit:cover;width:100%}.product-card-info{padding:12rpx}.product-card-title{color:#333;display:block;font-size:.86rem;font-weight:500;margin-bottom:12rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.product-card-price-container{align-items:center;background:#fb2626;border-radius:8rpx;color:#fff;display:flex;height:50rpx;justify-content:space-between;margin-top:12rpx;padding-left:10rpx}.product-card-buy{background-color:#ff4d4f;border-radius:6rpx;color:#fff;cursor:pointer;font-size:.71rem;padding:8rpx 16rpx}.product-card-mask{align-items:center;background-color:rgba(0,0,0,.4);bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.product-card-mask-text{border-radius:20rpx;color:#fff;font-size:.86rem;padding:8rpx 16rpx}.product-card-disabled{opacity:.7}.product-card-disabled .product-card-price{color:#fff}.product-card-disabled .product-card-price-container{opacity:.6}.buy-icon{display:block;height:100%}.product-card-small{width:180rpx}.product-card-small .product-card-image{height:180rpx}.product-card-small .product-card-price-container{height:40rpx}.product-card-small .product-card-badge{font-size:.64rem;padding:3rpx 16rpx}.product-card-small .product-card-close{font-size:1rem;padding:0 10rpx}.product-card-small .buy-icon{display:none}
@@ -50,6 +50,7 @@ Component({
50
50
  this.unsub = this.properties.sdkInstance.store.get({
51
51
  productList: (val) => {
52
52
  if (val) {
53
+ this.properties.sdkInstance.get('logReportServer').report('116999', { stage: 'productListUpdate', logData: val });
53
54
  this.setData({ productList: val });
54
55
  }
55
56
  }
@@ -1,3 +1,4 @@
1
+ import { reloadCurrentPage } from '../../shared/mpUtils.js'
1
2
  const errorMap = {
2
3
  512002: {
3
4
  msg: '活动不存在或已删除'
@@ -121,26 +122,7 @@ Component({
121
122
  methods: {
122
123
  onTap() {
123
124
  if (this.data.code === 900004 && this.data.secondText > 0) return;
124
- // 获取页面栈
125
- const pageStack = getCurrentPages();
126
- const currentPage = pageStack[pageStack.length - 1];
127
- const route = currentPage.route;
128
- const options = currentPage.options;
129
-
130
- // 拼接路由参数
131
- let queryStr = '';
132
- const params = [];
133
- for (const key in options) {
134
- params.push(`${key}=${encodeURIComponent(options[key])}`);
135
- }
136
- if (params.length) {
137
- queryStr = '?' + params.join('&');
138
- }
139
-
140
- // redirectTo:关闭当前页面,重新打开同页面,页面栈层级不变
141
- wx.redirectTo({
142
- url: `/${route}${queryStr}`
143
- });
125
+ reloadCurrentPage();
144
126
  },
145
127
  },
146
128
  });
@@ -1 +1 @@
1
- !function(){"use strict";var t={d:function(n,e){for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{_PLATFORM:function(){return o},envConfig:function(){return e}});const e={production:{BASE_URL:"https://open-api.vhall.com",VHALLYUN_API_BASE:"https://api.vhallyun.com",LOG_REPORT_BASE_URL:"https://dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0eUJFtW3vryA2NXx4M4f\n1w7dg3PHwOCA6Kx7JVfD/9eBGfqLhqsp+pg4AXG4PhuQx8EsV+sncQIiQO5J2//T\n3pO8LftDtCQztLnxnhq+BjhbFeswgfez2CwV2YKLTX2zyZ69T1Vu/M4H4gWSLeiV\n1FcH6xycA2+jG+EvOxSSItCKYT9EkB9BZSKf5RU7gM+qPtzdPtJP5vlsMCa0WnpY\nI6Qrmu/w9CZkL0397gUek9nBpPHkyPYg7ZijF3Gj8EqCMCVVTYpX96k4dd/Rz1em\ns4OSPF5jDsYZi58p+LmTcc3g7W9bD3QWWxzn47ie/Dh9LbnWfCqpGjUaHd3d42vR\ncQIDAQAB\n-----END PUBLIC KEY-----"},test:{BASE_URL:"https://test01-open-api.vhou.tv",VHALLYUN_API_BASE:"https://test01-api.vhallyun.com",LOG_REPORT_BASE_URL:"https://t-dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxWGCgHz2NLdVNa91CsNX\nFfCsxfgkTx738t3yMpuPYLL/5wwuWRrX7hBfNsfC+R5BW5b13ISzD001NNt+BWGK\np3V5fdWO18j9M/AhaTV2Ao/IpdP5huvVoNFVWPUQvX70FHu0sPVTev8ycAZHUpKx\n+mm83wxOpWBN5vAMJYx75pRCQfidb73XbOm6JXLJlxN91TUTrTiblxBhRwH0AQyr\ns9dUr+IJUZ1ea2uU3fkB4uYh7V/cHuNDMsJowfLtEU2+9IqEuJY4OwqX0qdfPF72\nsGMjCgghgL0z/7kv7Qe1+tOkJTBQTzODXBheGTVbF7hH2+5XuZsK2TfgBIew0I4k\n1wIDAQAB\n-----END PUBLIC KEY-----"}},o=19;module.exports=n}();
1
+ "use strict";const envConfig={production:{BASE_URL:"https://open-api.vhall.com",VHALLYUN_API_BASE:"https://api.vhallyun.com",LOG_REPORT_BASE_URL:"https://dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0eUJFtW3vryA2NXx4M4f\n1w7dg3PHwOCA6Kx7JVfD/9eBGfqLhqsp+pg4AXG4PhuQx8EsV+sncQIiQO5J2//T\n3pO8LftDtCQztLnxnhq+BjhbFeswgfez2CwV2YKLTX2zyZ69T1Vu/M4H4gWSLeiV\n1FcH6xycA2+jG+EvOxSSItCKYT9EkB9BZSKf5RU7gM+qPtzdPtJP5vlsMCa0WnpY\nI6Qrmu/w9CZkL0397gUek9nBpPHkyPYg7ZijF3Gj8EqCMCVVTYpX96k4dd/Rz1em\ns4OSPF5jDsYZi58p+LmTcc3g7W9bD3QWWxzn47ie/Dh9LbnWfCqpGjUaHd3d42vR\ncQIDAQAB\n-----END PUBLIC KEY-----"},test:{BASE_URL:"https://test01-open-api.vhou.tv",VHALLYUN_API_BASE:"https://test01-api.vhallyun.com",LOG_REPORT_BASE_URL:"https://t-dc.e.vhall.com/login",PUBLIC_KEY:"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxWGCgHz2NLdVNa91CsNX\nFfCsxfgkTx738t3yMpuPYLL/5wwuWRrX7hBfNsfC+R5BW5b13ISzD001NNt+BWGK\np3V5fdWO18j9M/AhaTV2Ao/IpdP5huvVoNFVWPUQvX70FHu0sPVTev8ycAZHUpKx\n+mm83wxOpWBN5vAMJYx75pRCQfidb73XbOm6JXLJlxN91TUTrTiblxBhRwH0AQyr\ns9dUr+IJUZ1ea2uU3fkB4uYh7V/cHuNDMsJowfLtEU2+9IqEuJY4OwqX0qdfPF72\nsGMjCgghgL0z/7kv7Qe1+tOkJTBQTzODXBheGTVbF7hH2+5XuZsK2TfgBIew0I4k\n1wIDAQAB\n-----END PUBLIC KEY-----"}};exports._PLATFORM=19,exports.envConfig=envConfig;