222
CI/CD / build (push) Failing after 5m48s
Details
CI/CD / build (push) Failing after 5m48s
Details
This commit is contained in:
parent
ce1099a9e6
commit
db4cec1572
|
|
@ -26,7 +26,8 @@
|
||||||
"@vitejs/plugin-vue": "^6.0.1",
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
"vite": "^7.2.2",
|
"vite": "^7.2.2",
|
||||||
"@element-plus/icons-vue": "^2.3.2",
|
"@element-plus/icons-vue": "^2.3.2",
|
||||||
"element-plus": "^2.11.7"
|
"element-plus": "^2.11.7",
|
||||||
|
"@google/genai": "^1.27.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0",
|
"node": ">=16.0.0",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
export class WechatBus {
|
||||||
|
constructor(wx) {
|
||||||
|
this.wx = wx;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectToUrlParams(obj, prefix = '') {
|
||||||
|
const params = []
|
||||||
|
for (const key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
const value = obj[key]
|
||||||
|
const paramKey = prefix ? `${prefix}[${key}]` : key
|
||||||
|
|
||||||
|
if (value !== null && value !== undefined) {
|
||||||
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
|
const nestedParams = this.objectToUrlParams(value, paramKey)
|
||||||
|
params.push(...nestedParams)
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
value.forEach((item, index) => {
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
const nestedParams = this.objectToUrlParams(item, `${paramKey}[${index}]`)
|
||||||
|
params.push(...nestedParams)
|
||||||
|
} else {
|
||||||
|
params.push(`${encodeURIComponent(paramKey)}[${index}]=${encodeURIComponent(item)}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
params.push(`${encodeURIComponent(paramKey)}=${encodeURIComponent(value)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
// 导航到微信小程序页面并且携带通信参数
|
||||||
|
BusWechartForNavigate(url, data = {}) {
|
||||||
|
let finalUrl = url
|
||||||
|
if (data && typeof data === 'object' && Object.keys(data).length > 0) {
|
||||||
|
const params = this.objectToUrlParams(data)
|
||||||
|
if (params.length > 0) {
|
||||||
|
const separator = url.includes('?') ? '&' : '?'
|
||||||
|
finalUrl = url + separator + params.join('&')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.wx.navigateTo({
|
||||||
|
url: finalUrl
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//通过共享存储通信
|
||||||
|
BusWechartForStorageSync(key,data = {}) {
|
||||||
|
wx.miniProgram.setStorageSync({
|
||||||
|
key: key,
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,32 +1,58 @@
|
||||||
const wx = window.wx || window.jWeixin
|
export class WechatBus {
|
||||||
|
|
||||||
class WechatBus {
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.wx = null
|
||||||
this.isReady = false
|
this.isReady = false
|
||||||
this.messageHandlers = new Map()
|
|
||||||
this.eventListeners = new Map()
|
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
if (wx) {
|
if (typeof window !== 'undefined') {
|
||||||
this.isReady = true
|
this.wx = window.wx || window.jWeixin
|
||||||
console.log('WechatBus initialized successfully')
|
if (this.wx && this.wx.miniProgram) {
|
||||||
} else {
|
this.isReady = true
|
||||||
console.warn('Wechat JSSDK not loaded')
|
console.log('WechatBus initialized successfully')
|
||||||
|
} else {
|
||||||
|
console.warn('Wechat JSSDK not loaded or miniProgram not available')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkReady() {
|
checkReady() {
|
||||||
if (!this.isReady) {
|
if (!this.isReady || !this.wx || !this.wx.miniProgram) {
|
||||||
throw new Error('Wechat JSSDK is not ready')
|
throw new Error('Wechat JSSDK is not ready. Please ensure JSSDK is loaded.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadJSSDK(src = 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js') {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
reject(new Error('Window object not available'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.wx || window.jWeixin) {
|
||||||
|
this.init()
|
||||||
|
resolve(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const script = document.createElement('script')
|
||||||
|
script.src = src
|
||||||
|
script.onload = () => {
|
||||||
|
this.init()
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
script.onerror = () => {
|
||||||
|
reject(new Error('Failed to load Wechat JSSDK'))
|
||||||
|
}
|
||||||
|
document.head.appendChild(script)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
config(config) {
|
config(config) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.config({
|
this.wx.config({
|
||||||
debug: config.debug || false,
|
debug: config.debug || false,
|
||||||
appId: config.appId,
|
appId: config.appId,
|
||||||
timestamp: config.timestamp,
|
timestamp: config.timestamp,
|
||||||
|
|
@ -35,24 +61,139 @@ class WechatBus {
|
||||||
jsApiList: config.jsApiList || []
|
jsApiList: config.jsApiList || []
|
||||||
})
|
})
|
||||||
|
|
||||||
wx.ready(() => {
|
this.wx.ready(() => {
|
||||||
this.isReady = true
|
|
||||||
console.log('Wechat JSSDK config ready')
|
console.log('Wechat JSSDK config ready')
|
||||||
resolve(true)
|
resolve(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
wx.error((res) => {
|
this.wx.error((res) => {
|
||||||
console.error('Wechat JSSDK config error:', res)
|
console.error('Wechat JSSDK config error:', res)
|
||||||
reject(res)
|
reject(res)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
objectToUrlParams(obj, prefix = '') {
|
||||||
|
const params = []
|
||||||
|
|
||||||
|
for (const key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
const value = obj[key]
|
||||||
|
const paramKey = prefix ? `${prefix}[${key}]` : key
|
||||||
|
|
||||||
|
if (value !== null && value !== undefined) {
|
||||||
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
|
const nestedParams = this.objectToUrlParams(value, paramKey)
|
||||||
|
params.push(...nestedParams)
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
value.forEach((item, index) => {
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
const nestedParams = this.objectToUrlParams(item, `${paramKey}[${index}]`)
|
||||||
|
params.push(...nestedParams)
|
||||||
|
} else {
|
||||||
|
params.push(`${encodeURIComponent(paramKey)}[${index}]=${encodeURIComponent(item)}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
params.push(`${encodeURIComponent(paramKey)}=${encodeURIComponent(value)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateTo(url, data = {}) {
|
||||||
|
this.checkReady()
|
||||||
|
let finalUrl = url
|
||||||
|
|
||||||
|
if (data && typeof data === 'object' && Object.keys(data).length > 0) {
|
||||||
|
const params = this.objectToUrlParams(data)
|
||||||
|
if (params.length > 0) {
|
||||||
|
const separator = url.includes('?') ? '&' : '?'
|
||||||
|
finalUrl = url + separator + params.join('&')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.wx.miniProgram.navigateTo({
|
||||||
|
url: finalUrl,
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: (error) => reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateBack(delta = 1) {
|
||||||
|
this.checkReady()
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.wx.miniProgram.navigateBack({
|
||||||
|
delta,
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: (error) => reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
redirectTo(url, data = {}) {
|
||||||
|
this.checkReady()
|
||||||
|
let finalUrl = url
|
||||||
|
|
||||||
|
if (data && typeof data === 'object' && Object.keys(data).length > 0) {
|
||||||
|
const params = this.objectToUrlParams(data)
|
||||||
|
if (params.length > 0) {
|
||||||
|
const separator = url.includes('?') ? '&' : '?'
|
||||||
|
finalUrl = url + separator + params.join('&')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.wx.miniProgram.redirectTo({
|
||||||
|
url: finalUrl,
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: (error) => reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
switchTab(url) {
|
||||||
|
this.checkReady()
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.wx.miniProgram.switchTab({
|
||||||
|
url,
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: (error) => reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
reLaunch(url, data = {}) {
|
||||||
|
this.checkReady()
|
||||||
|
let finalUrl = url
|
||||||
|
|
||||||
|
if (data && typeof data === 'object' && Object.keys(data).length > 0) {
|
||||||
|
const params = this.objectToUrlParams(data)
|
||||||
|
if (params.length > 0) {
|
||||||
|
const separator = url.includes('?') ? '&' : '?'
|
||||||
|
finalUrl = url + separator + params.join('&')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.wx.miniProgram.reLaunch({
|
||||||
|
url: finalUrl,
|
||||||
|
success: (res) => resolve(res),
|
||||||
|
fail: (error) => reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
postMessage(data) {
|
postMessage(data) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
wx.miniProgram.postMessage({
|
this.wx.miniProgram.postMessage({
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
resolve(true)
|
resolve(true)
|
||||||
|
|
@ -63,130 +204,21 @@ class WechatBus {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateTo(url) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
wx.miniProgram.navigateTo({
|
|
||||||
url,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Navigate to error:', error)
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
navigateBack(delta = 1) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
wx.miniProgram.navigateBack({
|
|
||||||
delta,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Navigate back error:', error)
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
redirectTo(url) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
wx.miniProgram.redirectTo({
|
|
||||||
url,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Redirect to error:', error)
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
switchTab(url) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
wx.miniProgram.switchTab({
|
|
||||||
url,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Switch tab error:', error)
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
reLaunch(url) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
wx.miniProgram.reLaunch({
|
|
||||||
url,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('ReLaunch error:', error)
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getEnv() {
|
getEnv() {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return wx.miniProgram.getEnv()
|
return this.wx.miniProgram.getEnv()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountInfoSync() {
|
getAccountInfoSync() {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return wx.getAccountInfoSync()
|
return this.wx.getAccountInfoSync()
|
||||||
}
|
|
||||||
|
|
||||||
on(event, handler) {
|
|
||||||
if (!this.eventListeners.has(event)) {
|
|
||||||
this.eventListeners.set(event, new Set())
|
|
||||||
}
|
|
||||||
this.eventListeners.get(event).add(handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
off(event, handler) {
|
|
||||||
if (this.eventListeners.has(event)) {
|
|
||||||
if (handler) {
|
|
||||||
this.eventListeners.get(event).delete(handler)
|
|
||||||
} else {
|
|
||||||
this.eventListeners.delete(event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
emit(event, data) {
|
|
||||||
if (this.eventListeners.has(event)) {
|
|
||||||
this.eventListeners.get(event).forEach(handler => {
|
|
||||||
try {
|
|
||||||
handler(data)
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Event handler error for ${event}:`, error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setStorageSync(key, data) {
|
setStorageSync(key, data) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
wx.miniProgram.setStorageSync({
|
this.wx.miniProgram.setStorageSync({
|
||||||
key,
|
key,
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|
@ -202,7 +234,7 @@ class WechatBus {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const data = wx.miniProgram.getStorageSync({
|
const data = this.wx.miniProgram.getStorageSync({
|
||||||
key
|
key
|
||||||
})
|
})
|
||||||
resolve(data)
|
resolve(data)
|
||||||
|
|
@ -217,7 +249,7 @@ class WechatBus {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
wx.miniProgram.removeStorageSync({
|
this.wx.miniProgram.removeStorageSync({
|
||||||
key
|
key
|
||||||
})
|
})
|
||||||
resolve(true)
|
resolve(true)
|
||||||
|
|
@ -232,7 +264,7 @@ class WechatBus {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
wx.miniProgram.clearStorageSync()
|
this.wx.miniProgram.clearStorageSync()
|
||||||
resolve(true)
|
resolve(true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Clear storage error:', error)
|
console.error('Clear storage error:', error)
|
||||||
|
|
@ -251,7 +283,7 @@ class WechatBus {
|
||||||
...options
|
...options
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.chooseImage({
|
this.wx.chooseImage({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -262,7 +294,7 @@ class WechatBus {
|
||||||
previewImage(options) {
|
previewImage(options) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.previewImage({
|
this.wx.previewImage({
|
||||||
...options,
|
...options,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -270,18 +302,6 @@ class WechatBus {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadImage(localId, isShowProgressTips = 1) {
|
|
||||||
this.checkReady()
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
wx.uploadImage({
|
|
||||||
localId,
|
|
||||||
isShowProgressTips,
|
|
||||||
success: (res) => resolve(res),
|
|
||||||
fail: (error) => reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getLocation(options = {}) {
|
getLocation(options = {}) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
@ -290,7 +310,7 @@ class WechatBus {
|
||||||
...options
|
...options
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.getLocation({
|
this.wx.getLocation({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -301,7 +321,7 @@ class WechatBus {
|
||||||
openLocation(options) {
|
openLocation(options) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.openLocation({
|
this.wx.openLocation({
|
||||||
...options,
|
...options,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -318,7 +338,7 @@ class WechatBus {
|
||||||
...options
|
...options
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.scanQRCode({
|
this.wx.scanQRCode({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -329,7 +349,7 @@ class WechatBus {
|
||||||
chooseWXPay(options) {
|
chooseWXPay(options) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.chooseWXPay({
|
this.wx.chooseWXPay({
|
||||||
...options,
|
...options,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -337,24 +357,10 @@ class WechatBus {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuShareAppMessage(options) {
|
|
||||||
this.checkReady()
|
|
||||||
wx.onMenuShareAppMessage({
|
|
||||||
...options
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
onMenuShareTimeline(options) {
|
|
||||||
this.checkReady()
|
|
||||||
wx.onMenuShareTimeline({
|
|
||||||
...options
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
updateAppMessageShareData(options) {
|
updateAppMessageShareData(options) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.updateAppMessageShareData({
|
this.wx.updateAppMessageShareData({
|
||||||
...options,
|
...options,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -365,7 +371,7 @@ class WechatBus {
|
||||||
updateTimelineShareData(options) {
|
updateTimelineShareData(options) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.updateTimelineShareData({
|
this.wx.updateTimelineShareData({
|
||||||
...options,
|
...options,
|
||||||
success: (res) => resolve(res),
|
success: (res) => resolve(res),
|
||||||
fail: (error) => reject(error)
|
fail: (error) => reject(error)
|
||||||
|
|
@ -375,32 +381,22 @@ class WechatBus {
|
||||||
|
|
||||||
closeWindow() {
|
closeWindow() {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
wx.closeWindow()
|
this.wx.closeWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
hideMenuItems(menuList = []) {
|
hideMenuItems(menuList = []) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
wx.hideMenuItems({
|
this.wx.hideMenuItems({
|
||||||
menuList
|
menuList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
showMenuItems(menuList = []) {
|
showMenuItems(menuList = []) {
|
||||||
this.checkReady()
|
this.checkReady()
|
||||||
wx.showMenuItems({
|
this.wx.showMenuItems({
|
||||||
menuList
|
menuList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
hideAllNonBaseMenuItem() {
|
|
||||||
this.checkReady()
|
|
||||||
wx.hideAllNonBaseMenuItem()
|
|
||||||
}
|
|
||||||
|
|
||||||
showAllNonBaseMenuItem() {
|
|
||||||
this.checkReady()
|
|
||||||
wx.showAllNonBaseMenuItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const wechatBus = new WechatBus()
|
const wechatBus = new WechatBus()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue