feat(uniapp_v2): 二开功能迁移与小程序主包优化

- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动
- queue、assets 使用独立分包以降低主包体积
- 修复首页单根节点与支付结果页 v-if 链
- 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错
- 配置域名与 manifest 应用名称;cache/store 防御性处理

Made-with: Cursor
This commit is contained in:
apple
2026-03-26 12:16:01 +08:00
parent c84aeda062
commit 8e17762510
742 changed files with 184117 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import store from "../store";
import Cache from '../utils/cache';
import {
Debounce
} from '@/utils/validate.js'
// #ifdef H5 || APP-PLUS
import {
isWeixin
} from "../utils";
import auth from './wechat';
// #endif
import {
LOGIN_STATUS,
USER_INFO,
EXPIRES_TIME,
STATE_R_KEY
} from './../config/cache';
import Routine from '@/libs/routine';
function prePage() {
let pages = getCurrentPages();
let prePage = pages[pages.length - 1];
// #ifndef APP-PLUS
return prePage.route;
// #endif
// #ifdef APP-PLUS
return prePage.$page.fullPath;
// #endif
}
export const toLogin = Debounce(_toLogin, 800)
function _toLogin(push, pathLogin) {
store.commit("LOGOUT");
let path = prePage();
// #ifdef H5
path = location.pathname + location.search;
// #endif
if (!pathLogin)
pathLogin = '/page/users/login/index'
Cache.set('login_back_url', path);
const BASIC_CONFIG = uni.getStorageSync('BASIC_CONFIG');
// #ifdef H5
if (isWeixin() && BASIC_CONFIG.wechat_status) {
uni.navigateTo({
url: '/pages/users/wechat_login/index',
});
} else {
uni.navigateTo({
url: '/pages/users/login/index'
})
}
// #endif
// #ifdef MP
let url
if (!BASIC_CONFIG.wechat_auth_switch) {
url = '/pages/users/binding_phone/index?pageType=0'
} else {
url = '/pages/users/wechat_login/index'
}
uni.navigateTo({
url
})
// Routine.getCode()
// .then(code => {
// console.log(code)
// Routine.silenceAuth(code).then(res => {
// console.log(res)
// })
// })
// .catch(err => {
// uni.hideLoading();
// });
// #endif
// #ifdef APP-PLUS
uni.navigateTo({
url: '/pages/users/login/index'
})
// #endif
}
export function checkLogin() {
let token = Cache.get(LOGIN_STATUS);
let expiresTime = Cache.get(EXPIRES_TIME);
let newTime = Math.round(new Date() / 1000);
if (expiresTime < newTime || !token) {
uni.setStorageSync('authIng', false)
Cache.clear(LOGIN_STATUS);
Cache.clear(EXPIRES_TIME);
Cache.clear(USER_INFO);
Cache.clear(STATE_R_KEY);
return false;
} else {
store.commit('UPDATE_LOGIN', token);
let userInfo = Cache.get(USER_INFO, true);
if (userInfo) {
store.commit('UPDATE_USERINFO', userInfo);
}
return true;
}
}

View File

@@ -0,0 +1,9 @@
export function onNetworkStatusChange(onlineFun, offlineFun) {
uni.onNetworkStatusChange(res => {
if(res.networkType !== 'none') {
onlineFun && onlineFun(res);
} else{
offlineFun && offlineFun(res);
}
});
}

View File

@@ -0,0 +1,257 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import $store from "@/store";
import wechat from "@/libs/wechat";
import {
HTTP_REQUEST_URL,
VUE_APP_WS_URL
} from "@/config/app.js";
import {
getServerType
} from '@/api/api.js';
import {
onNetworkStatusChange
} from '@/libs/network.js';
function wss(wsSocketUrl) {
if (wsSocketUrl.indexOf('wss:') !== -1) {
return wsSocketUrl;
}
// #ifdef H5
let ishttps = document.location.protocol == 'https:';
if (ishttps) {
return wsSocketUrl.replace('ws:', 'wss:');
} else {
return wsSocketUrl.replace('wss:', 'ws:');
}
// #endif
// #ifndef H5
return wsSocketUrl.replace('ws:', 'wss:');
//#endif
}
class Socket {
constructor() {
this.socketTask = null; //socket 任务
this.timer = null; //心跳定时器
this.connectStatus = false; //连接状态
this.wsUrl = ''; //ws地址
this.reconnectTimer = 2000; //重连
this.handClse = false; //手动关闭
this.reconnetime = null; //重连 定时器
this.networkStatus = true;
this.connectLing = false; //连接是否进行中
this.defaultEvenv(); //执行默认事件
this.networkEvent();
}
//网络状态变化监听
networkEvent() {
onNetworkStatusChange((res) => {
this.networkStatus = true;
if (this.socketTask) {
this.socketTask.close();
}
uni.$on('timeout', this.timeoutEvent.bind(this))
}, () => {
this.networkStatus = false;
this.connectStatus = false;
clearInterval(this.timer);
this.timer = null;
uni.$off('timeout', this.timeoutEvent)
});
}
//开始连接
startConnect() {
console.log('开始链接')
this.handClse = false;
if (!this.connectStatus) {
this.init();
this.connect();
}
}
//默认事件
defaultEvenv() {
uni.$off('success', this.successEvent);
uni.$off('timeout', this.timeoutEvent);
uni.$on('success', this.successEvent.bind(this));
uni.$on('timeout', this.timeoutEvent.bind(this));
}
timeoutEvent() {
console.log('timeoutEvent')
this.reconne();
}
successEvent() {
console.log('success默认事件');
// this.changOnline();
}
//发送用户状态
changOnline() {
let online = cache.get('kefu_online')
if (online !== undefined && online !== '') {
this.send({
data: {
online: online
},
type: 'online'
});
}
}
//连接websocket
connect() {
this.connectLing = true;
this.socketTask = uni.connectSocket({
url: this.wsUrl,
complete: () => {}
});
this.socketTask.onOpen(this.onOpen.bind(this))
this.socketTask.onError(this.onError.bind(this));
this.socketTask.onMessage(this.onMessage.bind(this))
this.socketTask.onClose(this.onClose.bind(this));
}
init() {
let wsUrl = wss(`${VUE_APP_WS_URL}?type=user`),
form_type = 3;
//#ifdef MP || APP-PLUS
form_type = 2
//#endif
//#ifdef H5
form_type = wechat.isWeixin() ? 1 : 3
//#endif
this.wsUrl = `${wsUrl}&token=${$store.state.app.token}&form_type=${form_type}`
}
//断线重连
reconne() {
if (this.reconnetime || this.connectStatus) {
return;
}
this.reconnetime = setInterval(() => {
if (this.connectStatus) {
return;
}
this.connectLing || this.connect();
}, this.reconnectTimer);
}
onOpen() {
clearInterval(this.reconnetime);
this.reconnetime = null;
this.connectLing = false;
this.connectStatus = true;
this.ping();
}
onError(error) {
console.log('连接发生错误', error)
this.connectStatus = false;
this.connectLing = false;
this.reconne();
}
onClose(err) {
console.log(this.socketTask, err, '关闭连接')
uni.$emit('close');
//手动关闭不用重新连接
if (this.handClse) {
return;
}
clearInterval(this.timer);
this.timer = null;
this.connectStatus = false;
this.connectLing = false;
this.reconne();
}
ping() {
this.timer = setInterval(() => {
this.send({
type: 'ping'
})
}, 10000)
}
onMessage(response) {
let {
type,
data
} = JSON.parse(response.data);
uni.$emit(type, data);
}
send(data) {
let that = this;
//没有网络,或者没有连接
if (!this.connectStatus || !this.networkStatus) {
this.reconne();
}
return new Promise((reslove, reject) => {
this.socketTask.send({
data: JSON.stringify(data),
success() {
reslove();
},
fail(res) {
console.log(res)
if (res.errMsg ==
'sendSocketMessage:fail WebSocket is not connected' ||
res.errMsg ==
'sendSocketMessage:fail Error: SocketTask.readyState is not OPEN'
) {
that.reconne();
}
reject(res);
},
complete(res) {
console.log(res)
}
})
});
}
guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
clearPing() {
clearInterval(this.timer);
this.timer = null;
if (this.connectStatus) {
this.socketTask.close();
}
this.handClse = true;
this.connectStatus = false;
this.connectLing = false;
}
setBadgeNumber(count) {
//#ifdef APP-PLUS
plus.runtime.setBadgeNumber(Number(count));
//#endif
}
}
export default Socket;

View File

@@ -0,0 +1,44 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
let app = getApp()
export function goShopDetail(item, uid) {
return new Promise((resolve,reject) => {
if(item.is_presale_product){
uni.navigateTo({
url: `/pages/activity/goods_details/index?id=${item.id}&type=6`
})
}else{
if (item.activity && item.activity.type == 1) {
uni.navigateTo({
url: `/pages/activity/goods_details/index?id=${item.activity.id}&type=1&time=${item.activity.time}&status=1`
})
} else if (item.activity && item.activity.type == 2) {
uni.navigateTo({
url: `/pages/activity/goods_bargain_details/index?id=${item.activity.id}&spid=${uid}`
})
} else if (item.activity && item.activity.type == 3) {
uni.navigateTo({
url: `/pages/activity/goods_details/index?id=${item.activity.id}&type=3`
})
} else {
reject(item);
}
}
});
}
export function goPage() {
return new Promise(resolve => {
resolve(true);
});
}

View File

@@ -0,0 +1,214 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import store from '../store';
import {
checkLogin
} from './login';
import {
login,
routineLogin,
silenceAuth
} from '../api/public';
import Cache from '../utils/cache';
import {
STATE_R_KEY,
USER_INFO,
EXPIRES_TIME,
LOGIN_STATUS
} from './../config/cache';
import {
mapGetters
} from "vuex";
class Routine {
constructor() {
this.scopeUserInfo = 'scope.userInfo';
}
async getUserCode() {
let isAuth = await this.isAuth(),
code = '';
if (isAuth)
code = await this.getCode();
return code;
}
/**
* 获取用户信息
*/
getUserInfo() {
let that = this,
code = this.getUserCode();
return new Promise((resolve, reject) => {
uni.getUserInfo({
lang: 'zh_CN',
success(user) {
if (code) user.code = code;
resolve({
userInfo: user,
islogin: false
});
},
fail(res) {
reject(res);
}
})
})
}
/**
* 新版小程序获取用户信息 2021 4.13微信小程序开始正式启用
*/
getUserProfile(code) {
return new Promise((resolve, reject) => {
uni.getUserProfile({
lang: 'zh_CN',
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success(user) {
if (code) user.code = code;
resolve({
userInfo: user,
islogin: false
});
},
fail(res) {
reject(res);
}
})
})
}
/**
* 获取用户信息
*/
authorize() {
let that = this;
return new Promise((resolve, reject) => {
if (checkLogin())
return resolve({
userInfo: Cache.get(USER_INFO, true),
islogin: true,
});
uni.authorize({
scope: that.scopeUserInfo,
success() {
resolve({
islogin: false
});
},
fail(res) {
reject(res);
}
})
})
}
async getCode() {
let provider = await this.getProvider();
return new Promise((resolve, reject) => {
uni.login({
provider: provider,
success(res) {
if (res.code) Cache.set(STATE_R_KEY, res.code, 10800);
return resolve(res.code);
},
fail() {
return reject(null);
}
})
})
}
/**
* 获取服务供应商
*/
getProvider() {
return new Promise((resolve, reject) => {
uni.getProvider({
service: 'oauth',
success(res) {
resolve(res.provider);
},
fail() {
resolve(false);
}
});
});
}
/**
* 是否授权
*/
isAuth() {
let that = this;
return new Promise((resolve, reject) => {
uni.getSetting({
success(res) {
if (!res.authSetting[that.scopeUserInfo]) {
resolve(true)
} else {
resolve(true);
}
},
fail() {
resolve(false);
}
});
});
}
/**
* 小程序比较版本信息
* @param v1 当前版本
* @param v2 进行比较的版本
* @return boolen
*
*/
compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
}
authUserInfo(data) {
return new Promise((resolve, reject) => {
routineLogin(data).then(res => {
if (res.data.key !== undefined && res.data.key) {} else {
store.commit('UPDATE_USERINFO', res.data.userInfo);
store.commit('SETUID', res.data.userInfo.uid);
Cache.set(USER_INFO, res.data.userInfo);
}
return resolve(res);
}).catch(res => {
return reject(res);
})
})
}
}
export default new Routine();

View File

@@ -0,0 +1,230 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
// #ifdef H5
import {
getWechatConfig,
getShopConfig,
wechatAuthV2
} from "@/api/public";
import {
WX_AUTH,
STATE_KEY,
LOGINTYPE,
BACK_URL
} from '@/config/cache';
import {
parseQuery
} from '@/utils';
import store from '@/store';
import Cache from '@/utils/cache';
class AuthWechat {
constructor() {
this.instance = jWeixin;
//是否实例化
this.status = false;
this.initConfig = {};
}
isAndroid(){
let u = navigator.userAgent;
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
}
signLink() {
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
window.entryUrl = location.href
}
return /(Android)/i.test(navigator.userAgent) ? location.href : window.entryUrl;
}
/**
* 初始化wechat(分享配置)
*/
wechat() {
return new Promise((resolve, reject) => {
// if (this.status && !this.isAndroid()) return resolve(this.instance);
getWechatConfig()
.then(res => {
this.instance.config(res.data);
this.initConfig = res.data;
this.status = true;
this.instance.ready(() => {
resolve(this.instance);
})
}).catch(err => {
this.status = false;
reject(err);
});
});
}
/**
* 验证是否初始化
*/
verifyInstance() {
let that = this;
return new Promise((resolve, reject) => {
if (that.instance === null && !that.status) {
that.wechat().then(res => {
resolve(that.instance);
}).catch(() => {
return reject();
})
} else {
return resolve(that.instance);
}
})
}
// 微信公众号的共享地址
openAddress() {
return new Promise((resolve, reject) => {
this.wechat().then(wx => {
this.toPromise(wx.openAddress).then(res => {
resolve(res);
}).catch(err => {
reject(err);
});
}).catch(err => {
reject(err);
})
});
}
// 获取经纬度;
location(){
return new Promise((resolve, reject) => {
this.wechat().then(wx => {
this.toPromise(wx.getLocation,{type: 'wgs84'}).then(res => {
resolve(res);
}).catch(err => {
reject(err);
});
}).catch(err => {
reject(err);
})
});
}
// 使用微信内置地图查看位置接口;
seeLocation(config){
return new Promise((resolve, reject) => {
this.wechat().then(wx => {
this.toPromise(wx.openLocation, config).then(res => {
resolve(res);
}).catch(err => {
reject(err);
});
}).catch(err => {
reject(err);
})
});
}
/**
* 微信支付
* @param {Object} config
*/
pay(config) {
return new Promise((resolve, reject) => {
this.wechat().then((wx) => {
this.toPromise(wx.chooseWXPay, config).then(res => {
resolve(res);
}).catch(res => {
reject(res);
});
}).catch(res => {
reject(res);
});
});
}
toPromise(fn, config = {}) {
return new Promise((resolve, reject) => {
fn({
...config,
success(res) {
resolve(res);
},
fail(err) {
reject(err);
},
complete(err) {
reject(err);
},
cancel(err) {
reject(err);
}
});
});
}
/**
* 绑定事件
* @param {Object} name 事件名
* @param {Object} config 参数
*/
wechatEvevt(name, config) {
let that = this;
return new Promise((resolve, reject) => {
let configDefault = {
fail(res) {
if (that.instance) return reject({
is_ready: true,
wx: that.instance
});
that.verifyInstance().then(wx => {
return reject({
is_ready: true,
wx: wx
});
})
},
success(res) {
return resolve(res,2222);
}
};
Object.assign(configDefault, config);
that.wechat().then(wx => {
if (typeof name === 'object') {
name.forEach(item => {
wx[item] && wx[item](configDefault)
})
} else {
wx[name] && wx[name](configDefault)
}
})
});
}
isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
}
async newAuth(scope,url){
try {
let res = await getWechatConfig();
let redirect_url = encodeURIComponent(url);
let state = encodeURIComponent(("" + Math.random()).split(".")[1] + "authorizestate");
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.data.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}&connect_redirect=1#wechat_redirect`;
} catch (err) {
}
}
}
export default new AuthWechat();
// #endif

View File

@@ -0,0 +1,119 @@
import {getWorkConfig,getWorkAgentConfig} from "@/api/work.js"
// import {wx} from "@/utils/agent.js"
export function initWxConfig() {
return getTicket;
}
export function initAgentConfig() {
return agentConfig;
};
const getTicket = new Promise((resolve, reject) => {
getWorkConfig(window.location.href.split('#')[0]).then(res=>{
if (/(iPhone|iPad|iPod|iOS|macintosh|mac os x)/i.test(navigator.userAgent)) {
jWeixin.config({
beta: true,// 必须这么写否则wx.invoke调用形式的jsapi会有问题
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
appId: res.data.appId, // 必填企业微信的corpID
timestamp:res.data.timestamp , // 必填,生成签名的时间戳
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
signature: res.data.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
// jsApiList: res.data.jsApiList // 必填需要使用的JS接口列表凡是要调用的接口都需要传进来
jsApiList: ["getCurExternalContact", "getCurExternalChat", "getContext", "chooseImage","sendChatMessage","shareAppMessage"]
});
jWeixin.ready(function() {
// resolve(wx);
setTimeout(()=>{
getWorkAgentConfig(window.location.href.split('#')[0]).then(response=>{
let jWeixi = wx;
jWeixi.agentConfig({
corpid: response.data.corpid, // 必填企业微信的corpid必须与当前登录的企业一致
agentid: response.data.agentid, // 必填企业微信的应用id e.g. 1000247
timestamp: response.data.timestamp, // 必填,生成签名的时间戳
nonceStr: response.data.nonceStr, // 必填,生成签名的随机串
signature: response.data.signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
// jsApiList: response.data.jsApiList, //必填,传入需要使用的接口名称
jsApiList: ["getCurExternalContact", "getCurExternalChat", "getContext", "chooseImage","sendChatMessage","shareAppMessage"],
success: function(data) {
resolve(data);
},
fail: function(err) {
if(err.errMsg.indexOf('function not exist') > -1){
reject('版本过低请升级');
}
}
});
})
},1000)
})
}else{
// window.wx = window.jWeixin;
jWeixin.config({
beta: true,// 必须这么写否则wx.invoke调用形式的jsapi会有问题
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
appId: res.data.appId, // 必填企业微信的corpID
timestamp:res.data.timestamp , // 必填,生成签名的时间戳
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
signature: res.data.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: ["getCurExternalContact", "getCurExternalChat", "getContext", "chooseImage","sendChatMessage","shareAppMessage"] // 必填需要使用的JS接口列表凡是要调用的接口都需要传进来
});
jWeixin.ready(function() {
// resolve(wx);
getWorkAgentConfig(location.href).then(response=>{
jWeixin.agentConfig({
corpid: response.data.corpid, // 必填企业微信的corpid必须与当前登录的企业一致
agentid: response.data.agentid, // 必填企业微信的应用id e.g. 1000247
timestamp: response.data.timestamp, // 必填,生成签名的时间戳
nonceStr: response.data.nonceStr, // 必填,生成签名的随机串
signature: response.data.signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
// jsApiList: response.data.jsApiList, //必填,传入需要使用的接口名称
jsApiList: ["getCurExternalContact", "getCurExternalChat", "getContext", "chooseImage","sendChatMessage","shareAppMessage"],
success: function(data) {
resolve(data);
},
fail: function(err) {
if(err.errMsg.indexOf('function not exist') > -1){
reject('版本过低请升级');
}
}
});
})
})
}
}).catch(err=>{
reject(err);
})
})
const agentConfig = new Promise((resolve, reject)=>{
getWorkAgentConfig(location.href).then(res=>{
wx.agentConfig({
corpid: res.data.corpid, // 必填企业微信的corpid必须与当前登录的企业一致
agentid: res.data.agentid, // 必填企业微信的应用id e.g. 1000247
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
signature: res.data.signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ["getCurExternalContact", "getCurExternalChat", "getContext", "chooseImage","sendChatMessage","shareAppMessage"]
, //必填,传入需要使用的接口名称
success: function(res) {
resolve(res);
},
fail: function(res) {
if(res.errMsg.indexOf('function not exist') > -1){
reject('版本过低请升级');
}
}
});
})
})