@@ -1,117 +1,120 @@ | |||||
{ | { | ||||
"name": "AI销讲助手", | |||||
"appid": "__UNI__7A1611D", | |||||
"description": "AI销讲助手", | |||||
"versionName": "1.1.0", | |||||
"versionCode": "100", | |||||
"transformPx": false, | |||||
"app-plus": { | |||||
"usingComponents": true, | |||||
"nvueCompiler": "uni-app", | |||||
"compilerVersion": 3, | |||||
"splashscreen": { | |||||
"alwaysShowBeforeRender": true, | |||||
"waiting": true, | |||||
"autoclose": true, | |||||
"delay": 0 | |||||
}, | |||||
"modules": { | |||||
"Push": {}, | |||||
"UIWebview": {}, | |||||
"Webview-x5": {} | |||||
}, | |||||
"distribute": { | |||||
"android": { | |||||
"permissions": [ | |||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", | |||||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", | |||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", | |||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", | |||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", | |||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", | |||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" | |||||
], | |||||
"abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"] | |||||
}, | |||||
"ios": { | |||||
"idfa": false | |||||
}, | |||||
"sdkConfigs": { | |||||
"ad": {}, | |||||
"oauth": {} | |||||
}, | |||||
"icons": { | |||||
"android": { | |||||
"hdpi": "", | |||||
"xhdpi": "", | |||||
"xxhdpi": "", | |||||
"xxxhdpi": "" | |||||
}, | |||||
"ios": { | |||||
"appstore": "", | |||||
"ipad": {}, | |||||
"iphone": {} | |||||
} | |||||
} | |||||
} | |||||
}, | |||||
"quickapp": {}, | |||||
"mp-weixin": { | |||||
"appid": "wx8f883dca5ecc5510", | |||||
"setting": { | |||||
"urlCheck": false, | |||||
"es6": true, | |||||
"postcss": true, | |||||
"minified": false | |||||
}, | |||||
"usingComponents": true, | |||||
"permission": {}, | |||||
"requiredBackgroundModes": ["audio"], | |||||
"lazyCodeLoading": "requiredComponents", | |||||
"plugins": { | |||||
"WechatSI": { | |||||
"version": "0.3.4", | |||||
"provider": "wx069ba97219f66d99" | |||||
}, | |||||
"digital-human-plugin": { | |||||
"version": "3.0.0", | |||||
"provider": "wxb827be471e4dce7b" | |||||
} | |||||
}, | |||||
"uniStatistics": { | |||||
"enable": true | |||||
} | |||||
}, | |||||
"mp-alipay": { | |||||
"usingComponents": true | |||||
}, | |||||
"mp-baidu": { | |||||
"usingComponents": true | |||||
}, | |||||
"mp-toutiao": { | |||||
"usingComponents": true | |||||
}, | |||||
"h5": { | |||||
"router": { | |||||
"base": "/pages/login/guide" | |||||
} | |||||
}, | |||||
"uniStatistics": { | |||||
"version": "1" | |||||
} | |||||
"name" : "AI销讲助手", | |||||
"appid" : "__UNI__7A1611D", | |||||
"description" : "AI销讲助手", | |||||
"versionName" : "1.1.0", | |||||
"versionCode" : "100", | |||||
"transformPx" : false, | |||||
"app-plus" : { | |||||
"usingComponents" : true, | |||||
"nvueCompiler" : "uni-app", | |||||
"compilerVersion" : 3, | |||||
"splashscreen" : { | |||||
"alwaysShowBeforeRender" : true, | |||||
"waiting" : true, | |||||
"autoclose" : true, | |||||
"delay" : 0 | |||||
}, | |||||
"modules" : { | |||||
"Push" : {}, | |||||
"UIWebview" : {}, | |||||
"Webview-x5" : {} | |||||
}, | |||||
"distribute" : { | |||||
"android" : { | |||||
"permissions" : [ | |||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", | |||||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", | |||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", | |||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", | |||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", | |||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", | |||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" | |||||
], | |||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] | |||||
}, | |||||
"ios" : { | |||||
"idfa" : false | |||||
}, | |||||
"sdkConfigs" : { | |||||
"ad" : {}, | |||||
"oauth" : {} | |||||
}, | |||||
"icons" : { | |||||
"android" : { | |||||
"hdpi" : "", | |||||
"xhdpi" : "", | |||||
"xxhdpi" : "", | |||||
"xxxhdpi" : "" | |||||
}, | |||||
"ios" : { | |||||
"appstore" : "", | |||||
"ipad" : {}, | |||||
"iphone" : {} | |||||
} | |||||
} | |||||
} | |||||
}, | |||||
"quickapp" : {}, | |||||
"mp-weixin" : { | |||||
"appid" : "wx8f883dca5ecc5510", | |||||
"setting" : { | |||||
"urlCheck" : false, | |||||
"es6" : true, | |||||
"postcss" : true, | |||||
"minified" : true | |||||
}, | |||||
"usingComponents" : true, | |||||
"permission" : {}, | |||||
"requiredBackgroundModes" : [ "audio" ], | |||||
"lazyCodeLoading" : "requiredComponents", | |||||
"plugins" : { | |||||
"WechatSI" : { | |||||
"version" : "0.3.4", | |||||
"provider" : "wx069ba97219f66d99" | |||||
}, | |||||
"digital-human-plugin" : { | |||||
"version" : "3.0.0", | |||||
"provider" : "wxb827be471e4dce7b" | |||||
} | |||||
}, | |||||
"uniStatistics" : { | |||||
"enable" : true | |||||
}, | |||||
"optimization" : { | |||||
"subPackages" : true | |||||
} | |||||
}, | |||||
"mp-alipay" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"mp-baidu" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"mp-toutiao" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"h5" : { | |||||
"router" : { | |||||
"base" : "/pages/login/guide" | |||||
} | |||||
}, | |||||
"uniStatistics" : { | |||||
"version" : "1" | |||||
} | |||||
} | } |
@@ -679,13 +679,6 @@ | |||||
id: 0 | id: 0 | ||||
}) | }) | ||||
}) | }) | ||||
// util.getRequestPromise(config.service.findAllYi, {}, false).then(data => { | |||||
// this.biaoqianlist = data | |||||
// this.biaoqianlist.unshift({ | |||||
// name: "逼单话术", | |||||
// id: 0 | |||||
// }) | |||||
// }); | |||||
}, | }, | ||||
// 取消加精 | // 取消加精 | ||||
Cancelout2() { | Cancelout2() { | ||||
@@ -3,14 +3,42 @@ | |||||
<digital-human :width="0" | <digital-human :width="0" | ||||
rootStyle="position: fixed; left: 50%; top: 100rpx; transform: translateX(-50%);z-index: -1;"> | rootStyle="position: fixed; left: 50%; top: 100rpx; transform: translateX(-50%);z-index: -1;"> | ||||
</digital-human> | </digital-human> | ||||
<input placeholder="123" type="text" @input="sendChat"> | |||||
<!-- | |||||
<view class="message-box"> | |||||
<!-- 对话框 --> | |||||
<block v-for="(message, index) in messageList"> | |||||
<view :class="{lside: message.direction == 'lside', rside: message.direction == 'rside'}" :key="index"> | |||||
{{ message.text }} | |||||
</view> | |||||
</block> | |||||
</view> | |||||
<view class="input-box" style="padding: 0 24rpx;"> | |||||
<input style="border: 1rpx solid #00BFFF;height: 80rpx;padding: 0 24rpx;" placeholder="请输入" type="text" | |||||
confirm-type="search" @confirm="sendChat"> | |||||
<view class="radio"> | |||||
<!-- <image class="voice" @click.stop="changeVoiceShow" src="/static/images/recordingManagement/voice.png" | |||||
mode=""></image> --> | |||||
<cover-view class="voiceContent"> | |||||
<cover-view class="box" @click.stop="" @touchstart="touchStart" @touchend="touchEnd"> | |||||
<cover-view class="center"> | |||||
<cover-image class="voice" src="/static/images/voice.png" mode="widthFix"></cover-image> | |||||
<cover-view class="text"> | |||||
{{voiceState}} | |||||
</cover-view> | |||||
</cover-view> | |||||
</cover-view> | |||||
</cover-view> | |||||
</view> | |||||
</view> | |||||
<!-- | |||||
<view class="topBox" | <view class="topBox" | ||||
style="position: fixed;left: 50%; bottom: 0; transform: translateX(-50%);z-index: 999999;width: 100vw;height: 40vh;background-color: #1890FF;"> | style="position: fixed;left: 50%; bottom: 0; transform: translateX(-50%);z-index: 999999;width: 100vw;height: 40vh;background-color: #1890FF;"> | ||||
</view> | </view> | ||||
--> | --> | ||||
<view class="booximg"> | |||||
<!-- <view class="booximg"> | |||||
<image v-if="domainObj.domain == 'zh.aihxz.com'" class="img" | <image v-if="domainObj.domain == 'zh.aihxz.com'" class="img" | ||||
src="https://autoiot.oss-cn-beijing.aliyuncs.com/static/wabIndexs.png" mode=""></image> | src="https://autoiot.oss-cn-beijing.aliyuncs.com/static/wabIndexs.png" mode=""></image> | ||||
<image v-else class="img" src="https://autoiot.oss-cn-beijing.aliyuncs.com/static/wabIndex.png" mode=""> | <image v-else class="img" src="https://autoiot.oss-cn-beijing.aliyuncs.com/static/wabIndex.png" mode=""> | ||||
@@ -49,7 +77,7 @@ | |||||
<view class="view"> | <view class="view"> | ||||
立即去登录 | 立即去登录 | ||||
</view> | </view> | ||||
</view> | |||||
</view> --> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
@@ -57,14 +85,26 @@ | |||||
var app = getApp(); | var app = getApp(); | ||||
var config = require("../../config"); | var config = require("../../config"); | ||||
const domainObj = require('@/utils/domain.js'); | const domainObj = require('@/utils/domain.js'); | ||||
var plugins = requirePlugin("WechatSI"); | |||||
let manager = plugins.getRecordRecognitionManager(); | |||||
import human from './mathManIndex.js' | import human from './mathManIndex.js' | ||||
export default { | export default { | ||||
mixins: [human], | mixins: [human], | ||||
data() { | data() { | ||||
return { | return { | ||||
domainObj: domainObj, // 域名 | domainObj: domainObj, // 域名 | ||||
isRecording: false, | |||||
voiceState: "你可以这样说...", | |||||
}; | }; | ||||
}, | }, | ||||
onLoad() { | |||||
this.initRecord() | |||||
}, | |||||
onShow() { | onShow() { | ||||
uni.request({ | uni.request({ | ||||
@@ -89,8 +129,46 @@ | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/login/index' | url: '/pages/login/index' | ||||
}); | }); | ||||
} | |||||
}, | |||||
touchStart() { | |||||
manager.start({ | |||||
duration: 60000, | |||||
lang: "zh_CN" | |||||
}); | |||||
}, | |||||
touchEnd() { | |||||
uni.showToast() | |||||
manager.stop(); | |||||
}, | |||||
/** | |||||
* 初始化语音识别回调 | |||||
* 绑定语音播放开始事件 | |||||
*/ | |||||
initRecord() { | |||||
manager.onStart = (res) => { | |||||
this.voiceState = "onStart:" + res.msg + "正在录音" | |||||
}; | |||||
//有新的识别内容返回,则会调用此事件 | |||||
manager.onRecognize = (res) => { | |||||
this.voiceState = res.result; | |||||
} | |||||
// 识别结束事件 | |||||
manager.onStop = async (res) => { | |||||
this.voiceState = res.result; | |||||
await this.getReply(res.result) | |||||
} | |||||
// 识别错误事件 | |||||
manager.onError = (res) => { | |||||
this.voiceState = res.msg; | |||||
} | |||||
}, | |||||
} | } | ||||
}; | }; | ||||
</script> | </script> | ||||
@@ -167,5 +245,73 @@ | |||||
font-size: 32rpx; | font-size: 32rpx; | ||||
} | } | ||||
} | } | ||||
// 语音输入 | |||||
.message-box { | |||||
padding: 24rpx; | |||||
width: 100vw; | |||||
height: 50vh; | |||||
display: flex; | |||||
flex-direction: column; | |||||
justify-content: flex-end; | |||||
.lside { | |||||
display: flex; | |||||
justify-content: flex-start; | |||||
} | |||||
.rside { | |||||
display: flex; | |||||
justify-content: flex-end; | |||||
} | |||||
} | |||||
.voiceContent { | |||||
width: 100vw; | |||||
height: 90rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
.box { | |||||
width: 100%; | |||||
height: 100%; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
.center { | |||||
width: 100%; | |||||
height: 100%; | |||||
background: #1590E9; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
.voice { | |||||
width: 70rpx; | |||||
height: 70rpx; | |||||
} | |||||
.text { | |||||
color: #FFFFFF; | |||||
font-size: 36rpx; | |||||
margin-top: 24rpx; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
.voice { | |||||
width: 44rpx; | |||||
height: 44rpx; | |||||
margin-left: 38rpx; | |||||
} | |||||
} | } | ||||
</style> | </style> |
@@ -145,24 +145,15 @@ | |||||
</view> | </view> | ||||
</template> | </template> | ||||
</view> | </view> | ||||
<!-- 底部导航栏 --> | |||||
<!-- <u-tabbar :isBtnTop="false" class="tabbar" :mid-button="true" activeColor="#1296db" inactiveColor="#999999" | |||||
v-model="current" :list="tabbarList"></u-tabbar> --> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
var config = require("../../config"); | var config = require("../../config"); | ||||
var util = require("@/utils/util.js"); | var util = require("@/utils/util.js"); | ||||
import tabbarList from '@/utils/tabbar.js' | |||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
// tabbar配置项 | |||||
current: 3, | |||||
tabbarList: tabbarList, | |||||
//--- end --- tabbar配置项 | |||||
tablist: [{ | tablist: [{ | ||||
name: "优秀案例" | name: "优秀案例" | ||||
}, | }, | ||||
@@ -130,6 +130,9 @@ module.exports = { | |||||
mockReplies: ["嘻嘻", "没听清", "你真厉害"], | mockReplies: ["嘻嘻", "没听清", "你真厉害"], | ||||
plugin: null, | plugin: null, | ||||
messageList: [], // 消息列表 | |||||
} | } | ||||
}, | }, | ||||
@@ -146,34 +149,28 @@ module.exports = { | |||||
return false; | return false; | ||||
}, | }, | ||||
onSuccess: () => { | onSuccess: () => { | ||||
const texts = [{ | |||||
text: `你好啊`, | |||||
gesture: "" | |||||
}, | |||||
{ | |||||
text: `我叫韩晓东`, | |||||
gesture: "" | |||||
}, | |||||
]; | |||||
async function talk(texts) { | |||||
// 轮播文本内容 | |||||
for (let i = 0; i < texts.length; i++) { | |||||
await _this.plugin.human.talkAsync( | |||||
texts[i].text, | |||||
texts[i].gesture, { | |||||
onTalkStartOnce: (playInfo) => { | |||||
console.log("播放句子:", playInfo); | |||||
}, | |||||
onTalkEndOnce: () => { | |||||
console.log("播放句子完成"); | |||||
}, | |||||
} | |||||
); | |||||
console.log("完成时间:", Date.now()); | |||||
} | |||||
} | |||||
talk(texts); | |||||
// async function talk(texts) { | |||||
// // 轮播文本内容 | |||||
// for (let i = 0; i < texts.length; i++) { | |||||
// await _this.plugin.human.talkAsync( | |||||
// texts[i].text, | |||||
// texts[i].gesture, { | |||||
// onTalkStartOnce: (playInfo) => { | |||||
// console.log("播放句子:", playInfo); | |||||
// }, | |||||
// onTalkEndOnce: () => { | |||||
// console.log("播放句子完成"); | |||||
// }, | |||||
// } | |||||
// ); | |||||
// console.log("完成时间:", Date.now()); | |||||
// } | |||||
// } | |||||
// talk(texts); | |||||
}, | }, | ||||
onError: (res) => { | |||||
console.log(res) | |||||
} | |||||
}) | }) | ||||
// #ifdef MP-WEIXIN | // #ifdef MP-WEIXIN | ||||
// 内存告警处理 | // 内存告警处理 | ||||
@@ -192,7 +189,7 @@ module.exports = { | |||||
methods: { | methods: { | ||||
// // 模拟聊天回复接口 | // // 模拟聊天回复接口 | ||||
async getReply(text) { | async getReply(text) { | ||||
return await uni.request({ | |||||
await uni.request({ | |||||
url: `${this.config.chatConfig.url}/1`, | url: `${this.config.chatConfig.url}/1`, | ||||
method: 'POST', | method: 'POST', | ||||
data: { | data: { | ||||
@@ -202,23 +199,26 @@ module.exports = { | |||||
} | } | ||||
}, | }, | ||||
success: (res) => { | success: (res) => { | ||||
const replay = res.data.sceneInfo[0].audioText[0] | |||||
console.log(res) | console.log(res) | ||||
console.log(res.data.sceneInfo[0]) | |||||
this.messageList.push({ | |||||
direction: 'rside', | |||||
text: text | |||||
}) | |||||
console.log(this.messageList) | |||||
this.messageList.push({ | |||||
direction: 'lside', | |||||
text: res.data.sceneInfo[0].audioText[0] | |||||
}) | |||||
this.plugin.human?.talkAsync(replay) | |||||
this.$forceUpdate() | |||||
} | } | ||||
}) | }) | ||||
// return await this.mockReplies[Math.floor(Math.random() * this.mockReplies.length)] | |||||
}, | }, | ||||
sendChat(e) { | sendChat(e) { | ||||
this.customChat(e.detail.value) | |||||
this.getReply(e.detail.value) | |||||
}, | }, | ||||
async customChat(text) { | |||||
console.log(text) | |||||
// // 调用自定义的api获取回复 | |||||
const reply = await this.getReply(text) | |||||
// // 主动调用播放接口,并等待播放完成 | |||||
await this.plugin.human?.talkAsync(reply) | |||||
console.log("回复完成"); | |||||
} | |||||
} | } | ||||
} | } |
@@ -81,8 +81,6 @@ | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- 底部导航栏 --> | |||||
<!-- <u-tabbar :isBtnTop="false" :mid-button="true" activeColor="#1296db" inactiveColor="#999999" v-model="current" :list="tabbarList"></u-tabbar> --> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
@@ -90,14 +88,9 @@ | |||||
var app = getApp(); | var app = getApp(); | ||||
var util = require("../../utils/util.js"); | var util = require("../../utils/util.js"); | ||||
var config = require("../../config"); | var config = require("../../config"); | ||||
import tabbarList from '@/utils/tabbar.js' | |||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
// tabbar配置项 | |||||
current: 0, | |||||
tabbarList: tabbarList, | |||||
//--- end --- tabbar配置项 | |||||
name: "", | name: "", | ||||
photo: "", | photo: "", | ||||
mobile: "", | mobile: "", | ||||
@@ -5,8 +5,6 @@ Vue.use(Vuex) | |||||
export default new Vuex.Store({ | export default new Vuex.Store({ | ||||
state: { | state: { | ||||
bgAudioMannager: null, // 背景音频播放对象 | |||||
isBgPlay: false, // 是否后台播放 | |||||
messageObj: {}, // | messageObj: {}, // | ||||
}, | }, | ||||
@@ -16,51 +14,5 @@ export default new Vuex.Store({ | |||||
setMessageObj(state, obj) { | setMessageObj(state, obj) { | ||||
state.messageObj = obj | state.messageObj = obj | ||||
}, | }, | ||||
createAudio(state) { | |||||
state.bgAudioMannager = uni.getBackgroundAudioManager(); | |||||
}, | |||||
setSeekAudio(state, t) { | |||||
state.bgAudioMannager.seek(t) | |||||
}, | |||||
// 加载音频监听方法 | |||||
initAudioMethod(state, obj) { | |||||
state.bgAudioMannager.onCanplay(() => { | |||||
state.bgAudioMannager.currentTime = obj.currentTime | |||||
}); | |||||
state.bgAudioMannager.onStop(() => { | |||||
console.log('停止播放'); | |||||
}); | |||||
state.bgAudioMannager.onPause(() => { | |||||
console.log('暂停播放'); | |||||
}); | |||||
state.bgAudioMannager.onEnded(() => { | |||||
//初始化 需要的参数 | |||||
console.log('自然播放结束事件'); | |||||
}); | |||||
state.bgAudioMannager.onError((res) => { | |||||
console.log(res.errMsg); | |||||
console.log(res.errCode); | |||||
}); | |||||
}, | |||||
// 停止全局音频播放 | |||||
stopAduio(state) { | |||||
if (state.bgAudioMannager != null) { | |||||
if (state.bgAudioMannager.src != '') { | |||||
state.bgAudioMannager.src = '' | |||||
} | |||||
} | |||||
}, | |||||
// 设置播放状态 | |||||
setIsBgPlay(state, value) { | |||||
state.isBgPlay = value | |||||
} | |||||
}, | }, | ||||
}) | }) |
@@ -1,234 +0,0 @@ | |||||
// import Strophe from "../sdk/libs/strophe"; | |||||
//import xmldom from "../sdk/libs/xmldom/dom-parser"; | |||||
// import websdk from "../sdk/sdk/src/connection"; | |||||
import websdk from "../sdk/webimSDK3.1.1.js"; | |||||
import config from "./WebIMConfig"; | |||||
console.group = console.group || {}; | |||||
console.groupEnd = console.groupEnd || {}; | |||||
var window = {}; | |||||
let WebIM = window.WebIM = websdk; | |||||
window.WebIM.config = config; //var DOMParser = window.DOMParser = xmldom.DOMParser; | |||||
//let document = window.document = new DOMParser().parseFromString("<?xml version='1.0'?>\n", "text/xml"); | |||||
WebIM.isDebug = function (option) { | |||||
if (option) { | |||||
WebIM.config.isDebug = option.isDebug; | |||||
openDebug(WebIM.config.isDebug); | |||||
} | |||||
function openDebug(value) { | |||||
function ts() { | |||||
var d = new Date(); | |||||
var Hours = d.getHours(); // 获取当前小时数(0-23) | |||||
var Minutes = d.getMinutes(); // 获取当前分钟数(0-59) | |||||
var Seconds = d.getSeconds(); // 获取当前秒数(0-59) | |||||
return (Hours < 10 ? "0" + Hours : Hours) + ":" + (Minutes < 10 ? "0" + Minutes : Minutes) + ":" + (Seconds < 10 ? "0" + Seconds : Seconds) + " "; | |||||
} // if (value) { | |||||
// Strophe.Strophe.Connection.prototype.rawOutput = function(data){ | |||||
// try{ | |||||
// console.group("%csend # " + ts(), "color: blue; font-size: large"); | |||||
// console.log("%c" + data, "color: blue"); | |||||
// console.groupEnd(); | |||||
// } | |||||
// catch(e){ | |||||
// console.log(e); | |||||
// } | |||||
// }; | |||||
// }else{ | |||||
// Strophe.Strophe.Connection.prototype.rawOutput = function(){}; | |||||
// } | |||||
} | |||||
}; | |||||
/** | |||||
* Set autoSignIn as true (autoSignInName and autoSignInPwd are configured below), | |||||
* You can auto signed in each time when you refresh the page in dev model. | |||||
*/ | |||||
WebIM.config.autoSignIn = false; | |||||
if (WebIM.config.autoSignIn) { | |||||
WebIM.config.autoSignInName = "lwz2"; | |||||
WebIM.config.autoSignInPwd = "1"; | |||||
} // var stropheConn = new window.Strophe.Connection("ws://im-api.easemob.com/ws/", { | |||||
// inactivity: 30, | |||||
// maxRetries: 5, | |||||
// pollingTime: 4500 | |||||
// }); | |||||
// | |||||
// stropheConn.connect( | |||||
// '$t$' + 'YWMtmbQEBKKIEeaGmMtXyg5n1wAAAVlkQvGO2WOJGlMCEJKM4VV9GCMnb_XLCXU', | |||||
// function() { | |||||
// console.log(arguments, 'ggogogo'); | |||||
// }, stropheConn.wait, stropheConn.hold); | |||||
WebIM.parseEmoji = function (msg) { | |||||
if (typeof WebIM.Emoji === "undefined" || typeof WebIM.Emoji.map === "undefined") { | |||||
return msg; | |||||
} | |||||
var emoji = WebIM.Emoji, | |||||
reg = null; | |||||
var msgList = []; | |||||
var objList = []; | |||||
for (var face in emoji.map) { | |||||
if (emoji.map.hasOwnProperty(face)) { | |||||
while (msg.indexOf(face) > -1) { | |||||
msg = msg.replace(face, "^" + emoji.map[face] + "^"); | |||||
} | |||||
} | |||||
} | |||||
var ary = msg.split("^"); | |||||
var reg = /^e.*g$/; | |||||
for (var i = 0; i < ary.length; i++) { | |||||
if (ary[i] != "") { | |||||
msgList.push(ary[i]); | |||||
} | |||||
} | |||||
for (var i = 0; i < msgList.length; i++) { | |||||
if (reg.test(msgList[i])) { | |||||
var obj = {}; | |||||
obj.data = msgList[i]; | |||||
obj.type = "emoji"; | |||||
objList.push(obj); | |||||
} else { | |||||
var obj = {}; | |||||
obj.data = msgList[i]; | |||||
obj.type = "txt"; | |||||
objList.push(obj); | |||||
} | |||||
} | |||||
return objList; | |||||
}; | |||||
WebIM.time = function () { | |||||
var date = new Date(); | |||||
var Hours = date.getHours(); | |||||
var Minutes = date.getMinutes(); | |||||
var Seconds = date.getSeconds(); | |||||
var time = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + (Hours < 10 ? "0" + Hours : Hours) + ":" + (Minutes < 10 ? "0" + Minutes : Minutes) + ":" + (Seconds < 10 ? "0" + Seconds : Seconds); | |||||
return time; | |||||
}; | |||||
WebIM.Emoji = { | |||||
map: { | |||||
"[):]": "ee_1.png", | |||||
"[:D]": "ee_2.png", | |||||
"[;)]": "ee_3.png", | |||||
"[:-o]": "ee_4.png", | |||||
"[:p]": "ee_5.png", | |||||
"[(H)]": "ee_6.png", | |||||
"[:@]": "ee_7.png", | |||||
"[:s]": "ee_8.png", | |||||
"[:$]": "ee_9.png", | |||||
"[:(]": "ee_10.png", | |||||
"[:'(]": "ee_11.png", | |||||
"[<o)]": "ee_12.png", | |||||
"[(a)]": "ee_13.png", | |||||
"[8o|]": "ee_14.png", | |||||
"[8-|]": "ee_15.png", | |||||
"[+o(]": "ee_16.png", | |||||
"[|-)]": "ee_17.png", | |||||
"[:|]": "ee_18.png", | |||||
"[*-)]": "ee_19.png", | |||||
"[:-#]": "ee_20.png", | |||||
"[^o)]": "ee_21.png", | |||||
"[:-*]": "ee_22.png", | |||||
"[8-)]": "ee_23.png", | |||||
"[del]": "btn_del.png", | |||||
"[(|)]": "ee_24.png", | |||||
"[(u)]": "ee_25.png", | |||||
"[(S)]": "ee_26.png", | |||||
"[(*)]": "ee_27.png", | |||||
"[(#)]": "ee_28.png", | |||||
"[(R)]": "ee_29.png", | |||||
"[({)]": "ee_30.png", | |||||
"[(})]": "ee_31.png", | |||||
"[(k)]": "ee_32.png", | |||||
"[(F)]": "ee_33.png", | |||||
"[(W)]": "ee_34.png", | |||||
"[(D)]": "ee_35.png" | |||||
} | |||||
}; | |||||
WebIM.EmojiObj = { | |||||
// 相对 emoji.js 路径 | |||||
map1: { | |||||
"[):]": "ee_1.png", | |||||
"[:D]": "ee_2.png", | |||||
"[;)]": "ee_3.png", | |||||
"[:-o]": "ee_4.png", | |||||
"[:p]": "ee_5.png", | |||||
"[(H)]": "ee_6.png", | |||||
"[:@]": "ee_7.png" | |||||
}, | |||||
map2: { | |||||
"[:s]": "ee_8.png", | |||||
"[:$]": "ee_9.png", | |||||
"[:(]": "ee_10.png", | |||||
"[:'(]": "ee_11.png", | |||||
"[<o)]": "ee_12.png", | |||||
"[(a)]": "ee_13.png", | |||||
"[8o|]": "ee_14.png" | |||||
}, | |||||
map3: { | |||||
"[8-|]": "ee_15.png", | |||||
"[+o(]": "ee_16.png", | |||||
"[|-)]": "ee_17.png", | |||||
"[:|]": "ee_18.png", | |||||
"[*-)]": "ee_19.png", | |||||
"[:-#]": "ee_20.png", | |||||
"[del]": "del.png" | |||||
}, | |||||
map4: { | |||||
"[^o)]": "ee_21.png", | |||||
"[:-*]": "ee_22.png", | |||||
"[8-)]": "ee_23.png", | |||||
"[(|)]": "ee_24.png", | |||||
"[(u)]": "ee_25.png", | |||||
"[(S)]": "ee_26.png", | |||||
"[(*)]": "ee_27.png" | |||||
}, | |||||
map5: { | |||||
"[(#)]": "ee_28.png", | |||||
"[(R)]": "ee_29.png", | |||||
"[({)]": "ee_30.png", | |||||
"[(})]": "ee_31.png", | |||||
"[(k)]": "ee_32.png", | |||||
"[(F)]": "ee_33.png", | |||||
"[(W)]": "ee_34.png", | |||||
"[(D)]": "ee_35.png" | |||||
}, | |||||
map6: { | |||||
"[del]": "del.png" | |||||
} | |||||
}; // wx.connectSocket({url: WebIM.config.xmppURL, method: "GET"}) | |||||
WebIM.conn = new WebIM.connection({ | |||||
appKey: WebIM.config.appkey, | |||||
isMultiLoginSessions: WebIM.config.isMultiLoginSessions, | |||||
https: typeof WebIM.config.https === "boolean" ? WebIM.config.https : location.protocol === "https:", | |||||
url: WebIM.config.xmppURL, | |||||
apiUrl: WebIM.config.apiURL, | |||||
isAutoLogin: false, | |||||
heartBeatWait: WebIM.config.heartBeatWait, | |||||
autoReconnectNumMax: WebIM.config.autoReconnectNumMax, | |||||
autoReconnectInterval: WebIM.config.autoReconnectInterval | |||||
}); // async response | |||||
// WebIM.conn.listen({ | |||||
// onOpened: () => dispatch({type: Types.ON_OPEND}) | |||||
// }) | |||||
// export default WebIM; | |||||
module.exports = { | |||||
"default": WebIM | |||||
}; |
@@ -1,90 +0,0 @@ | |||||
/** | |||||
* git do not control webim.config.js | |||||
* everyone should copy webim.config.js to webim.config.js | |||||
* and have their own configs. | |||||
* In this way , others won't be influenced by this config while git pull. | |||||
* | |||||
*/ | |||||
// for react native | |||||
let location = { | |||||
protocol: "https" | |||||
}; | |||||
let config = { | |||||
/* | |||||
* XMPP server | |||||
*/ | |||||
// xmppURL: "wss://im-api.easemob.com/ws/", //小程序2.0sdk线上环境 | |||||
// xmppURL: "wss://im-api-hsb.easemob.com/ws/", //小程序2.0sdk沙箱环境 | |||||
// xmppURL: 'wss://im-api-new-hsb.easemob.com/websocket', //小程序沙箱环境 | |||||
xmppURL: 'wss://im-api-wechat.easemob.com/websocket', | |||||
//小程序线上环境 | |||||
/* | |||||
* Backend REST API URL | |||||
*/ | |||||
// apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com', | |||||
apiURL: "https://a1.easemob.com", | |||||
// 线上环境 | |||||
// apiURL: "https://a1-hsb.easemob.com", // 沙箱环境 | |||||
// apiURL: 'https://172.17.3.155:8080', | |||||
/* | |||||
* Application AppKey | |||||
*/ | |||||
appkey: "1106191017019057#qufang", | |||||
/* | |||||
* Whether to use HTTPS '1177161227178308#xcx' | |||||
* @parameter {Boolean} true or false | |||||
*/ | |||||
https: false, | |||||
/* | |||||
* isMultiLoginSessions | |||||
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages. | |||||
* false: A visitor can sign in to only one webpage and receive messages at the webpage. | |||||
*/ | |||||
isMultiLoginSessions: true, | |||||
/** | |||||
* Whether to use window.doQuery() | |||||
* @parameter {Boolean} true or false | |||||
*/ | |||||
isWindowSDK: false, | |||||
/** | |||||
* isSandBox=true: xmppURL: 'im-api.sandbox.easemob.com', apiURL: '//a1.sdb.easemob.com', | |||||
* isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com', | |||||
* @parameter {Boolean} true or false | |||||
*/ | |||||
isSandBox: false, | |||||
/** | |||||
* Whether to console.log in strophe.log() | |||||
* @parameter {Boolean} true or false | |||||
*/ | |||||
isDebug: false, | |||||
/** | |||||
* will auto connect the xmpp server autoReconnectNumMax times in background when client is offline. | |||||
* won't auto connect if autoReconnectNumMax=0. | |||||
*/ | |||||
autoReconnectNumMax: 15, | |||||
/** | |||||
* the interval secons between each atuo reconnectting. | |||||
* works only if autoReconnectMaxNum >= 2. | |||||
*/ | |||||
autoReconnectInterval: 2, | |||||
/** | |||||
* webrtc supports WebKit and https only | |||||
*/ | |||||
isWebRTC: false, | |||||
/* | |||||
* Set to auto sign-in | |||||
*/ | |||||
isAutoLogin: true | |||||
}; | |||||
export default config; |
@@ -1,23 +0,0 @@ | |||||
var sub = function (val, lengths) { | |||||
var length_val = val.length + ''; | |||||
if (length_val == 0 || val == undefined) { | |||||
return; | |||||
} | |||||
if (length_val > lengths) { | |||||
return val.substring(0, lengths) + "..."; | |||||
} else { | |||||
return val; | |||||
} | |||||
}; | |||||
var subMore = function (val, lengths) { | |||||
var val = val + ''; | |||||
return val.substring(0, lengths); | |||||
}; | |||||
module.exports = { | |||||
sub: sub, | |||||
subMore: subMore | |||||
}; |
@@ -1,32 +0,0 @@ | |||||
export default [{ | |||||
"pagePath": "/pages/index/customer", | |||||
"iconPath": "/static/images/tabBar/jiedai.png", | |||||
"selectedIconPath": "/static/images/tabBar/jiedaiActive.png", | |||||
"text": "接待" | |||||
}, | |||||
{ | |||||
"pagePath": "/pages/index/consumer/index", | |||||
"iconPath": "/static/images/tabBar/kehu.png", | |||||
"selectedIconPath": "/static/images/tabBar/kehuActive.png", | |||||
"text": "客户" | |||||
}, | |||||
{ | |||||
"pagePath": "/pages/index/index", | |||||
"iconPath": "/static/images/tabBar/work.png", | |||||
"selectedIconPath": "/static/images/tabBar/workActive.png", | |||||
"midButton": true, | |||||
"text": "工作台" | |||||
}, | |||||
{ | |||||
"pagePath": "/pages/index/learning", | |||||
"iconPath": "/static/images/tabBar/xuexi.png", | |||||
"selectedIconPath": "/static/images/tabBar/xuexiActive.png", | |||||
"text": "学习" | |||||
}, | |||||
{ | |||||
"pagePath": "/pages/index/personal", | |||||
"iconPath": "/static/images/tabBar/me.png", | |||||
"selectedIconPath": "/static/images/tabBar/meActive.png", | |||||
"text": "我的" | |||||
} | |||||
]; |
@@ -1,4 +1,3 @@ | |||||
let WebIM = uni.WebIM = require("./WebIM.js")["default"]; | |||||
import * as CryptoJS from '../components/crypto-js' | import * as CryptoJS from '../components/crypto-js' | ||||
function formatLongTime(mss) { | function formatLongTime(mss) { | ||||
var days = parseInt(mss / (1000 * 60 * 60 * 24)); | var days = parseInt(mss / (1000 * 60 * 60 * 24)); | ||||
@@ -474,7 +473,7 @@ function getRequest(url, params, callback) { | |||||
} | } | ||||
} | } | ||||
}); // WebIM.conn.close(); | |||||
}); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -551,8 +550,7 @@ function getRequestPromise(url, params, isNone,option) { | |||||
} | } | ||||
} | } | ||||
}); // WebIM.conn.close(); | |||||
}); | |||||
return false; | return false; | ||||
} else if (result.data.code == '60001') { | } else if (result.data.code == '60001') { | ||||
//已录入客户 | //已录入客户 | ||||