im-ui-mobile 0.0.94 → 0.0.95

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/index.js CHANGED
@@ -39,46 +39,19 @@ for (const key in importComponents) {
39
39
 
40
40
  // 全局配置对象
41
41
  let config = {}
42
-
43
- // // 默认配置
44
- // const defaultConfig = {
45
- // emojiUrl: '',
46
- // baseUrl: ''
47
- // }
48
-
49
42
  let emoji = null
50
43
 
51
44
  const install = (app, upuiParams = '') => {
52
- // // 合并配置
53
- // config = { ...defaultConfig, ...options }
54
-
55
- // // 提供全局配置
56
- // app.provide('im-config', config)
57
- // configManager.setConfig(config)
58
-
59
- // if (!emoji) {
60
- // emoji = new Emoji({ emojiUrl: config.emojiUrl })
61
- // }
62
-
63
- console.log('upuiParams', upuiParams)
64
-
65
45
  // 初始化
66
46
  if (upuiParams) {
67
47
  uni.upuiParams = upuiParams
68
- let temp = upuiParams()
69
- if (temp.httpIns) {
70
- temp.httpIns(http)
71
- }
72
- if (temp.options) {
73
- // 合并配置
74
- config = temp.options
75
- configManager.setConfig(temp.options)
76
- console.log('install', configManager.get('emojiUrl'))
48
+ const params = upuiParams()
49
+ if (params.options) {
50
+ config = params.options
51
+ configManager.setConfig(params.options)
77
52
  }
78
-
79
53
  }
80
54
 
81
-
82
55
  // 安装插件
83
56
  app.use(UViewPlusPlugin)
84
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "im-ui-mobile",
3
- "version": "0.0.94",
3
+ "version": "0.0.95",
4
4
  "description": "A Vue3.0 + Typescript instant messaging component library for Uniapp",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/utils/config.js CHANGED
@@ -15,11 +15,11 @@ export const configManager = {
15
15
  }
16
16
  }
17
17
 
18
- // 初始化自定义配置
19
- if (uni && uni.upuiParams) {
20
- let temp = uni.upuiParams()
21
- console.log('setting im-ui-mobile', temp)
22
- if (temp.options) {
23
- configManager.setConfig(temp.options)
24
- }
25
- }
18
+ // // 初始化自定义配置
19
+ // if (uni && uni.upuiParams) {
20
+ // const params = uni.upuiParams()
21
+ // console.log('setting im-ui-mobile', params.options)
22
+ // if (params.options) {
23
+ // configManager.setConfig(params.options)
24
+ // }
25
+ // }
package/utils/emoji.js CHANGED
@@ -11,7 +11,7 @@ class Emoji {
11
11
  */
12
12
  constructor(options = {}) {
13
13
  // 表情图片基础URL
14
- // this.emojiUrl = options.emojiUrl || 'url not config.';
14
+ this.emojiUrl = configManager.get('emojiUrl', 'url not found from awear.');
15
15
 
16
16
  // 表情文本列表
17
17
  this.emoTextList = [
@@ -25,12 +25,6 @@ class Emoji {
25
25
 
26
26
  // 正则表达式匹配表情文本
27
27
  this.regex = /\#[\u4E00-\u9FA5]{1,3}\;/gi;
28
-
29
- console.log('new Emoji', configManager.get('emojiUrl'))
30
- }
31
-
32
- getEmojiUrl() {
33
- return configManager.get('emojiUrl', 'url not found from awear.')
34
28
  }
35
29
 
36
30
  /**
@@ -77,8 +71,8 @@ class Emoji {
77
71
  if (idx === -1) {
78
72
  return '';
79
73
  }
80
- console.log('textToPath',this.getEmojiUrl())
81
- return this.getEmojiUrl() + idx + ".gif";
74
+ console.log('textToPath',this.emojiUrl)
75
+ return this.emojiUrl + idx + ".gif";
82
76
  }
83
77
 
84
78
  /**
@@ -87,13 +81,13 @@ class Emoji {
87
81
  * @returns {string} 表情文本,格式如 "#开心;"
88
82
  */
89
83
  pathToText(path) {
90
- if (!path || !this.getEmojiUrl() || !path.includes(this.getEmojiUrl())) {
84
+ if (!path || !this.emojiUrl || !path.includes(this.emojiUrl)) {
91
85
  return '';
92
86
  }
93
87
 
94
88
  try {
95
89
  // 从路径中提取表情索引
96
- const filename = path.replace(this.getEmojiUrl(), '').replace('.gif', '');
90
+ const filename = path.replace(this.emojiUrl, '').replace('.gif', '');
97
91
  const index = parseInt(filename);
98
92
 
99
93
  // 检查索引是否有效