gxd-uni-library-editx 1.0.143 → 1.0.145

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gxd-uni-library-editx",
3
- "version": "1.0.143",
3
+ "version": "1.0.145",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -117,6 +117,74 @@ export default {
117
117
  },
118
118
  getNoData(){
119
119
  return this.colorObj.nodata
120
- }
120
+ },
121
+ /**
122
+ * @description 单业务自动跳转功能
123
+ * @param entry {Array} 业务链接信息
124
+ */
125
+ handleOneBussClick(entry){
126
+ debugger
127
+ if (this.$configProject['isPreview']) return;
128
+
129
+ //登陆成功,有回调地址返回回调地址
130
+ if(this.inCallbackUrlOrg) {
131
+ this.$xdUniHelper.redirectTo({
132
+ url:this.inCallback
133
+ }, false);
134
+ return;
135
+ }
136
+
137
+ const {dir, path, host, appType} = entry['redirect_data'];
138
+ let regHttp = /^(\/\/|http:\/\/|https:\/\/).+$/;
139
+ let regSp = /(-apiuri\/v)/;
140
+
141
+ if(!appType) entry.redirect_data.appType = 'h5';
142
+ let nsp = Base64.encodeURI(JSON.stringify({business_code: entry['business_code']}));
143
+
144
+ //外站配置地址
145
+ if(entry.redirect_type === 'URL') {
146
+ if(regHttp.test(entry.redirect_data['path']) || regSp.test(entry.redirect_data['path'])) {
147
+ let urlPath = entry.redirect_data['path'];
148
+ if(urlPath.indexOf('?') === -1) urlPath = `${urlPath}?x-common=${nsp}&vs=${new Date().getTime()}`;
149
+ else urlPath = `${urlPath}&x-common=${nsp}&vs=${new Date().getTime()}`;
150
+ this.$xdUniHelper.redirectTo({
151
+ url:urlPath
152
+ }, false)
153
+ }
154
+ else {
155
+ console.error(`配置错误:${entry.redirect_data['path']}`);
156
+ throw new Error(`配置错误:${entry.redirect_data['path']}`)
157
+ }
158
+ return
159
+ }
160
+
161
+ //站内应用处理
162
+ let jumpUrl = path;
163
+ let cardPathStr = '';
164
+ const {deploy_dir} = this.projectAttr;
165
+ if(host === this.projectAttr.host && deploy_dir !== dir){
166
+ jumpUrl = `//${host}/${dir}${path}`;
167
+ //#ifdef MP-WEIXIN
168
+ jumpUrl = `https:${jumpUrl}`;
169
+ //#endif
170
+ }
171
+
172
+ //#ifdef MP-WEIXIN
173
+ //获取自定义卡券登录地址(微信小程序跳转到H5平台起作用)
174
+ if(entry.redirect_data.appType === 'h5') {
175
+ const custom_redirect_data = this.$xdUniHelper.checkVarType(entry['custom_redirect_data']) === 'object'?entry['custom_redirect_data']:{};
176
+ const cardPathObject = this.getCardPath(custom_redirect_data);
177
+ if(cardPathObject !== null) {
178
+ const {cardPath, cardSelf} =cardPathObject
179
+ if(cardPath) cardPathStr = `&card-login=${encodeURIComponent(cardPath)}&cardSelf=${cardSelf}`
180
+ }
181
+ }
182
+ //#endif
183
+
184
+ jumpUrl = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}${cardPathStr}`;
185
+ console.warn(`entry.path:${jumpUrl}`);
186
+ if(regHttp.test(jumpUrl)) this.$xdUniHelper.redirectTo({url:jumpUrl}, false)
187
+ else this.$xdUniHelper.navigateTo({url:jumpUrl}, false)
188
+ },
121
189
  }
122
190
  }