Skip to content

Commit 91473a3

Browse files
committed
可通过设置initWithOpenid方法参数修改conf文件中的默认配置
1 parent 7240826 commit 91473a3

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

sensorsdata.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var ArrayProto = Array.prototype,
2626
slice = ArrayProto.slice,
2727
toString = ObjProto.toString,
2828
hasOwnProperty = ObjProto.hasOwnProperty,
29-
LIB_VERSION = '1.10.1',
29+
LIB_VERSION = '1.10.2',
3030
LIB_NAME = 'MiniProgram';
3131

3232
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -164,8 +164,7 @@ logger.info = function () {
164164
_.extend = function (obj) {
165165
each(slice.call(arguments, 1), function (source) {
166166
for (var prop in source) {
167-
if (source[prop] !==
168-
void 0) {
167+
if (source[prop] !== void 0) {
169168
obj[prop] = source[prop];
170169
}
171170
}
@@ -1116,7 +1115,7 @@ sa.initial = function () {
11161115

11171116
sa.init = function (obj) {
11181117
if(_.isObject(obj)){
1119-
sa.para = obj;
1118+
sa.para = _.extend(sa.para,obj);
11201119
}
11211120
sa.initialState.storeIsComplete = true;
11221121
sa.initialState.checkIsComplete();
@@ -1239,12 +1238,17 @@ sa.setOpenid = function (openid, isCover) {
12391238
};
12401239

12411240
sa.initWithOpenid = function (options) {
1242-
options = options || {};
1241+
if(_.isObject(options)){
1242+
options = _.extend(sa.para,options);
1243+
}else{
1244+
options = {};
1245+
}
1246+
//options = options || {};
12431247
sa.openid.getOpenid(function (openid) {
12441248
if (openid) {
12451249
sa.setOpenid(openid, options.isCoverLogin);
12461250
}
1247-
sa.init();
1251+
sa.init(options);
12481252
});
12491253

12501254
};

sensorsdata.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata_conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ var conf = {
44
// 如果要通过sdk自动获取openid,需要在神策分析中配置appid和appsercret,并在这里标志appid,不需要的话,不用填。
55
appid: 'wx16ce2f6e06acd4d5',
66
// 神策分析数据接收地址
7-
server_url: 'https://xxxxx.datasink.xxxx/sa.gif?project=default&token=27eeee',
7+
// server_url: 'https://xxxxx.datasink.xxxx/sa.gif?project=default&token=27eeee',
8+
server_url:'https://test-syg.datasink.sensorsdata.cn/sa.gif?project=xubo&token=27f1e21b78daf376',
89
//请求发送超时时间
910
send_timeout: 1000,
1011
// 传入的字符串最大长度限制,防止未知字符串超长

0 commit comments

Comments
 (0)