@ -1,232 +0,0 @@ |
|||||||
<template> |
|
||||||
<view class="page"> |
|
||||||
<view class="feedback-title"> |
|
||||||
<text>问题和意见</text> |
|
||||||
<text class="feedback-quick" @tap="chooseMsg">快速键入</text> |
|
||||||
</view> |
|
||||||
<view class="feedback-body"><textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content" class="feedback-textare"></textarea></view> |
|
||||||
<view class="feedback-title"><text>图片(选填,提供问题截图,总大小10M以下)</text></view> |
|
||||||
<view class="feedback-body feedback-uploader"> |
|
||||||
<view class="uni-uploader"> |
|
||||||
<view class="uni-uploader-head"> |
|
||||||
<view class="uni-uploader-title">点击预览图片</view> |
|
||||||
<view class="uni-uploader-info">{{ imageList.length }}/5</view> |
|
||||||
</view> |
|
||||||
<view class="uni-uploader-body"> |
|
||||||
<view class="uni-uploader__files"> |
|
||||||
<block v-for="(image, index) in imageList" :key="index"> |
|
||||||
<view class="uni-uploader__file" style="position: relative;"> |
|
||||||
<image class="uni-uploader__img" :src="image" @tap="previewImage(index)"></image> |
|
||||||
<view class="close-view" @click="close(index)">x</view> |
|
||||||
</view> |
|
||||||
</block> |
|
||||||
<view class="uni-uploader__input-box" v-show="imageList.length < 5"><view class="uni-uploader__input" @tap="chooseImg"></view></view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="feedback-title"><text>QQ/邮箱</text></view> |
|
||||||
<view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact" placeholder="(选填,方便我们联系你 )" /></view> |
|
||||||
<view class="feedback-title feedback-star-view"> |
|
||||||
<text>应用评分</text> |
|
||||||
<view class="feedback-star-view"><uni-rate v-model="sendDate.score" color="#bbb"></uni-rate></view> |
|
||||||
</view> |
|
||||||
<button type="default" class="feedback-submit" @tap="send">提交</button> |
|
||||||
<view class="feedback-title"><text>用户反馈的结果可在app打包后于DCloud开发者中心查看</text></view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视,丑哭了', '偶发性崩溃'], |
|
||||||
stars: [1, 2, 3, 4, 5], |
|
||||||
imageList: [], |
|
||||||
sendDate: { |
|
||||||
score: 0, |
|
||||||
content: '', |
|
||||||
contact: '' |
|
||||||
} |
|
||||||
}; |
|
||||||
}, |
|
||||||
onLoad() { |
|
||||||
this.deviceInfo = { |
|
||||||
// appid: plus.runtime.appid, |
|
||||||
appid: '__UNI__5D0B0CA', |
|
||||||
imei: plus.device.imei, //设备标识 |
|
||||||
p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。 |
|
||||||
md: plus.device.model, //设备型号 |
|
||||||
app_version: plus.runtime.version, |
|
||||||
plus_version: plus.runtime.innerVersion, //基座版本号 |
|
||||||
os: plus.os.version, |
|
||||||
net: '' + plus.networkinfo.getCurrentType() |
|
||||||
}; |
|
||||||
this.sendDate = Object.assign(this.deviceInfo, this.sendDate); |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
/** |
|
||||||
* 关闭图片 |
|
||||||
* @param {Object} e |
|
||||||
*/ |
|
||||||
close(e) { |
|
||||||
this.imageList.splice(e, 1); |
|
||||||
}, |
|
||||||
|
|
||||||
/** |
|
||||||
* 快速输入 |
|
||||||
*/ |
|
||||||
chooseMsg() { |
|
||||||
uni.showActionSheet({ |
|
||||||
itemList: this.msgContents, |
|
||||||
success: res => { |
|
||||||
this.sendDate.content = this.msgContents[res.tapIndex]; |
|
||||||
} |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
/** |
|
||||||
* 选择图片 |
|
||||||
*/ |
|
||||||
chooseImg() { |
|
||||||
//选择图片 |
|
||||||
uni.chooseImage({ |
|
||||||
sourceType: ['camera', 'album'], |
|
||||||
sizeType: 'compressed', |
|
||||||
count: 5 - this.imageList.length, |
|
||||||
success: res => { |
|
||||||
this.imageList = this.imageList.concat(res.tempFilePaths); |
|
||||||
} |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
/** |
|
||||||
* 评分 |
|
||||||
* @param {Object} e |
|
||||||
*/ |
|
||||||
chooseStar(e) { |
|
||||||
//点击评星 |
|
||||||
this.sendDate.score = e; |
|
||||||
}, |
|
||||||
/** |
|
||||||
* 预览图片 |
|
||||||
* @param {Object} index |
|
||||||
*/ |
|
||||||
previewImage(index) { |
|
||||||
uni.previewImage({ |
|
||||||
urls: this.imageList, |
|
||||||
current: this.imageList[index] |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
/** |
|
||||||
* 提交 |
|
||||||
*/ |
|
||||||
send() { |
|
||||||
//发送反馈 |
|
||||||
if (this.sendDate.content.length === 0) { |
|
||||||
uni.showModal({ |
|
||||||
content: '请输入问题和意见', |
|
||||||
showCancel: false |
|
||||||
}); |
|
||||||
return; |
|
||||||
} |
|
||||||
uni.showLoading({ |
|
||||||
title: '上传中...' |
|
||||||
}); |
|
||||||
let imgs = this.imageList.map((value, index) => { |
|
||||||
return { |
|
||||||
name: 'images' + index, |
|
||||||
uri: value |
|
||||||
}; |
|
||||||
}); |
|
||||||
// TODO 服务端限制上传文件一次最大不超过 2M, 图片一次最多不超过5张 |
|
||||||
this.request(this.sendDate, imgs) |
|
||||||
.then(res => { |
|
||||||
if (typeof res.data === 'string') { |
|
||||||
res.data = JSON.parse(res.data); |
|
||||||
} |
|
||||||
if (res.statusCode === 200 && res.data && res.data.ret === 0) { |
|
||||||
uni.showModal({ |
|
||||||
content: '反馈成功', |
|
||||||
showCancel: false |
|
||||||
}); |
|
||||||
this.imageList = []; |
|
||||||
this.sendDate = Object.assign(this.deviceInfo, { |
|
||||||
score: 0, |
|
||||||
content: '', |
|
||||||
contact: '' |
|
||||||
}); |
|
||||||
} else if (res.statusCode !== 200) { |
|
||||||
uni.showModal({ |
|
||||||
content: '反馈失败,错误码为:' + res.statusCode, |
|
||||||
showCancel: false |
|
||||||
}); |
|
||||||
} else { |
|
||||||
uni.showModal({ |
|
||||||
content: '反馈失败', |
|
||||||
showCancel: false |
|
||||||
}); |
|
||||||
} |
|
||||||
}) |
|
||||||
.catch(err => { |
|
||||||
console.log(err); |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
/** |
|
||||||
* 发送请求到后台 |
|
||||||
*/ |
|
||||||
request(sendDate, imgs) { |
|
||||||
return new Promise((resolve, reject) => { |
|
||||||
let fromData = { |
|
||||||
url: 'https://service.dcloud.net.cn/feedback', |
|
||||||
success: res => { |
|
||||||
resolve(res); |
|
||||||
}, |
|
||||||
fail: res => { |
|
||||||
reject(res); |
|
||||||
}, |
|
||||||
complete() { |
|
||||||
uni.hideLoading(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
if (imgs.length > 0) { |
|
||||||
fromData.files = imgs; |
|
||||||
fromData.formData = sendDate; |
|
||||||
uni.uploadFile(fromData); |
|
||||||
} else { |
|
||||||
fromData.data = sendDate; |
|
||||||
fromData.method = 'POST'; |
|
||||||
uni.request(fromData); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
page { |
|
||||||
background-color: #efeff4; |
|
||||||
} |
|
||||||
|
|
||||||
.input-view { |
|
||||||
font-size: 28rpx; |
|
||||||
} |
|
||||||
|
|
||||||
.close-view { |
|
||||||
text-align: center; |
|
||||||
line-height: 14px; |
|
||||||
height: 16px; |
|
||||||
width: 16px; |
|
||||||
border-radius: 50%; |
|
||||||
background: #ff5053; |
|
||||||
color: #ffffff; |
|
||||||
position: absolute; |
|
||||||
top: -6px; |
|
||||||
right: -4px; |
|
||||||
font-size: 12px; |
|
||||||
} |
|
||||||
</style> |
|
||||||
@ -1,64 +0,0 @@ |
|||||||
<template> |
|
||||||
<view> |
|
||||||
<page-head :title="title"></page-head> |
|
||||||
<view class="uni-padding-wrap uni-common-mt"> |
|
||||||
<view class="uni-btn-v"> |
|
||||||
<button type="primary" @tap="getOrient">获取设备的方向信息</button> |
|
||||||
<button type="primary" @tap="watchOrient">监听设备的方向变化</button> |
|
||||||
<button type="primary" @tap="watchStop">停止监听</button> |
|
||||||
</view> |
|
||||||
<view class="uni-textarea"> |
|
||||||
<textarea :value="value" /> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
var id = null |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
title: 'orientation', |
|
||||||
value: '' |
|
||||||
} |
|
||||||
}, |
|
||||||
onUnload() { |
|
||||||
this.watchStop(); |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
getOrient: function () { |
|
||||||
var that = this; |
|
||||||
plus.orientation.getCurrentOrientation(function (o) { |
|
||||||
that.value = "alpha:" + o.alpha + "\nbeta:" + o.beta + "\ngamma:" + o.gamma; |
|
||||||
}, function (e) { |
|
||||||
console.log("获取失败:" + e.message); |
|
||||||
}); |
|
||||||
}, |
|
||||||
watchOrient: function () { |
|
||||||
var that = this; |
|
||||||
if (id) { |
|
||||||
return; |
|
||||||
} |
|
||||||
id = plus.orientation.watchOrientation(function (o) { |
|
||||||
that.value = "监听设备方向变化信息\n" + "alpha:" + o.alpha + "\nbeta:" + o.beta + "\ngamma:" + o.gamma; |
|
||||||
}, function (e) { |
|
||||||
plus.orientation.clearWatch(id); |
|
||||||
id = null; |
|
||||||
console.log("监听失败:" + e.message); |
|
||||||
}); |
|
||||||
}, |
|
||||||
watchStop: function () { |
|
||||||
if (id) { |
|
||||||
plus.orientation.clearWatch(id); |
|
||||||
id = null; |
|
||||||
} else { |
|
||||||
console.log("没有监听设备方向变化"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
|
|
||||||
</style> |
|
||||||
@ -1,69 +0,0 @@ |
|||||||
<template> |
|
||||||
<view> |
|
||||||
<page-head :title="title"></page-head> |
|
||||||
<view class="uni-padding-wrap uni-common-mt"> |
|
||||||
<view class="uni-hello-text"> |
|
||||||
手机顶部听筒处有传感器监听距离手机屏幕的障碍物,覆盖该传感器会触发本事件变化 |
|
||||||
</view> |
|
||||||
<view class="uni-btn-v uni-common-mt"> |
|
||||||
<button type="primary" @tap="getProximity">获取距离传感器信息</button> |
|
||||||
<button type="primary" @tap="watchProximity">监听距离传感器变化</button> |
|
||||||
<button type="primary" @tap="watchStop">停止监听</button> |
|
||||||
</view> |
|
||||||
<view class="uni-textarea uni-common-mt"> |
|
||||||
<textarea :value="value" /> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
var id = null |
|
||||||
var bright = null |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
title: 'proximity', |
|
||||||
value: '' |
|
||||||
} |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
getProximity: function () { |
|
||||||
var that = this; |
|
||||||
plus.proximity.getCurrentProximity(function (d) { |
|
||||||
that.value = "距离为:" + d; |
|
||||||
}, function (e) { |
|
||||||
that.value = "获取失败:" + e.message; |
|
||||||
}); |
|
||||||
}, |
|
||||||
watchProximity: function () { |
|
||||||
var that = this; |
|
||||||
if (id) { |
|
||||||
return; |
|
||||||
} |
|
||||||
bright = plus.screen.getBrightness(); |
|
||||||
id = plus.proximity.watchProximity(function (d) { |
|
||||||
that.value = "距离变化:" + d; |
|
||||||
plus.screen.setBrightness((d < 1) ? 0.01 : bright); |
|
||||||
}, function (e) { |
|
||||||
plus.proximity.clearWatch(id); |
|
||||||
id = null; |
|
||||||
that.value = "监听失败:" + e.message; |
|
||||||
}); |
|
||||||
}, |
|
||||||
watchStop: function () { |
|
||||||
var that = this; |
|
||||||
if (id) { |
|
||||||
that.value = "停止监听设备距离传感器信息"; |
|
||||||
plus.proximity.clearWatch(id); |
|
||||||
id = null; |
|
||||||
} else { |
|
||||||
that.value = "没有监听设备距离传感器"; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
|
|
||||||
</style> |
|
||||||
@ -1,81 +0,0 @@ |
|||||||
<template> |
|
||||||
<view> |
|
||||||
<page-head :title="title"></page-head> |
|
||||||
<view class="uni-padding-wrap" v-if="provider[0]"> |
|
||||||
<view class="uni-btn-v uni-common-mt"> |
|
||||||
<button type="primary" @tap="listenTranMsg">监听透传数据</button> |
|
||||||
</view> |
|
||||||
<view class="uni-btn-v uni-common-mt"> |
|
||||||
<button type="primary" @tap="requireTranMsg">发送"透传数据"消息</button> |
|
||||||
</view> |
|
||||||
<view class="uni-title uni-common-mt">透传内容:</view> |
|
||||||
<view class="uni-textarea"> |
|
||||||
<textarea v-model="tranMsg" /> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
title: 'push', |
|
||||||
provider: [], |
|
||||||
pushServer: 'http://demo.dcloud.net.cn/push/?', |
|
||||||
tranMsg:'' |
|
||||||
} |
|
||||||
}, |
|
||||||
onLoad: function () { |
|
||||||
uni.getProvider({ |
|
||||||
service: "push", |
|
||||||
success: (e) => { |
|
||||||
console.log("success", e); |
|
||||||
this.provider = e.provider; |
|
||||||
}, |
|
||||||
fail: (e) => { |
|
||||||
console.log("获取推送通道失败", e); |
|
||||||
} |
|
||||||
}); |
|
||||||
}, |
|
||||||
onUnload:function(){ |
|
||||||
this.tranMsg = '' |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
listenTranMsg() { |
|
||||||
// IOS端在客户端在运行时收到推送消息触发receive事件,离线接收到的推送消息全部进入系统消息中心。点击消息中心的消息触发click |
|
||||||
plus.push.addEventListener('click', (msg)=> { |
|
||||||
this.tranMsg = JSON.stringify(msg) |
|
||||||
}); |
|
||||||
plus.push.addEventListener('receive',(msg)=>{ |
|
||||||
this.tranMsg = JSON.stringify(msg) |
|
||||||
}) |
|
||||||
uni.showToast({ |
|
||||||
title: '开始监听透传数据', |
|
||||||
icon: 'success' |
|
||||||
}) |
|
||||||
}, |
|
||||||
requireTranMsg() { //请求‘透传数据’推送消息 |
|
||||||
var inf = plus.push.getClientInfo(); |
|
||||||
var url = this.pushServer + 'type=tran&appid=' + encodeURIComponent(plus.runtime.appid); |
|
||||||
inf.id && (url += '&id=' + inf.id); |
|
||||||
url += ('&cid=' + encodeURIComponent(inf.clientid)); |
|
||||||
if (plus.os.name == 'iOS') { |
|
||||||
url += ('&token=' + encodeURIComponent(inf.token)); |
|
||||||
} |
|
||||||
url += ('&title=' + encodeURIComponent('Hello uniapp')); |
|
||||||
url += ('&content=' + encodeURIComponent('带透传数据推送通知!')); |
|
||||||
if(plus.os.name === 'iOS'){ |
|
||||||
url += ('&payload=' + encodeURIComponent('{"title":"Hello uniapp Test","content":"test content"}')); |
|
||||||
}else{ |
|
||||||
url += ('&payload=' + encodeURIComponent('\'{"title":"Hello uniapp Test","content":"test content"}\'')); |
|
||||||
} |
|
||||||
url += ('&version=' + encodeURIComponent(plus.runtime.version)); |
|
||||||
plus.runtime.openURL(url); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
|
|
||||||
</style> |
|
||||||
@ -1,106 +0,0 @@ |
|||||||
<template> |
|
||||||
<view class="root" :style="{backgroundImage:'url('+img+')'}"> |
|
||||||
<view :class="[show ? 'up' : '','shake-up']"> |
|
||||||
<image mode="aspectFit" src="https://web-assets.dcloud.net.cn/unidoc/zh/shakeup.png"></image> |
|
||||||
</view> |
|
||||||
<view :class="[show ? 'down' : '','shake-down']"> |
|
||||||
<image mode="aspectFit" src="https://web-assets.dcloud.net.cn/unidoc/zh/shakedown.png"></image> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
img: 'https://web-assets.dcloud.net.cn/unidoc/zh/1.jpg', |
|
||||||
show: false, |
|
||||||
isOpened: false, |
|
||||||
index: 1 |
|
||||||
} |
|
||||||
}, |
|
||||||
computed:{ |
|
||||||
pageIndex() { |
|
||||||
if (this.index === 1) { |
|
||||||
return 'aff47ed0-517d-11eb-8ff1-d5dcf8779628' |
|
||||||
} else if (this.index === 2) { |
|
||||||
return '1fc36f80-5199-11eb-a16f-5b3e54966275' |
|
||||||
} else if (this.index === 3) { |
|
||||||
return '20a3bd60-5199-11eb-97b7-0dc4655d6e68' |
|
||||||
} else if (this.index === 4) { |
|
||||||
return '8b872410-51a7-11eb-8a36-ebb87efcf8c0' |
|
||||||
} else { |
|
||||||
return 'aff47ed0-517d-11eb-8ff1-d5dcf8779628' |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
onLoad: function () { |
|
||||||
this.music = uni.createInnerAudioContext(); |
|
||||||
this.music.src = 'https://web-assets.dcloud.net.cn/unidoc/zh/shake.wav'; |
|
||||||
|
|
||||||
let t = null; |
|
||||||
uni.onAccelerometerChange((res) => { |
|
||||||
if (Math.abs(res.x) + Math.abs(res.y) + Math.abs(res.z) > 20 && !this.show && this.isOpened) { |
|
||||||
this.music.play(); |
|
||||||
setTimeout(() => { |
|
||||||
this.index++; |
|
||||||
if (this.index > 4) { |
|
||||||
this.index = 1 |
|
||||||
} |
|
||||||
this.img = 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/' + this.pageIndex + '.jpg'; |
|
||||||
}, 2000); |
|
||||||
this.show = true; |
|
||||||
if (t) { |
|
||||||
clearTimeout(t); |
|
||||||
} |
|
||||||
t = setTimeout(() => { |
|
||||||
t = null; |
|
||||||
this.show = false; |
|
||||||
}, 600) |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
onShow() { |
|
||||||
this.isOpened = true; |
|
||||||
}, |
|
||||||
onUnload() { |
|
||||||
this.show = false; |
|
||||||
this.isOpened = false; |
|
||||||
uni.stopAccelerometer(); |
|
||||||
this.music.destroy(); |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
.root { |
|
||||||
height: 100%; |
|
||||||
display: flex; |
|
||||||
flex-direction: column; |
|
||||||
background-position: center center; |
|
||||||
background-repeat: no-repeat; |
|
||||||
} |
|
||||||
|
|
||||||
.shake-up, |
|
||||||
.shake-down { |
|
||||||
height: 50%; |
|
||||||
overflow: hidden; |
|
||||||
transition: all .5s ease-in-out; |
|
||||||
-webkit-transition: all .5s ease-in-out; |
|
||||||
background: #333; |
|
||||||
} |
|
||||||
|
|
||||||
.up { |
|
||||||
transform: translateY(-50%); |
|
||||||
-webkit-transform: translateY(-50%); |
|
||||||
} |
|
||||||
|
|
||||||
.down { |
|
||||||
transform: translateY(50%); |
|
||||||
-webkit-transform: translateY(50%); |
|
||||||
} |
|
||||||
|
|
||||||
image { |
|
||||||
height: 100%; |
|
||||||
width: 100%; |
|
||||||
} |
|
||||||
</style> |
|
||||||
@ -1,105 +0,0 @@ |
|||||||
<template> |
|
||||||
<view> |
|
||||||
<page-head :title="title"></page-head> |
|
||||||
<view class="uni-padding-wrap uni-common-mt"> |
|
||||||
<view class="uni-textarea"> |
|
||||||
<textarea :value="value" placeholder="语音识别内容展示区域" disabled /> |
|
||||||
</view> |
|
||||||
<view class="uni-common-mt uni-btn-v"> |
|
||||||
<button type="primary" @tap="startRecognize">开始语音识别</button> |
|
||||||
<!-- <button type="primary" @tap="startRecognizeEnglish">开始语音识别(英语)</button> --> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
import permision from "@/common/permission.js" |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
title: 'speech', |
|
||||||
value: '' |
|
||||||
} |
|
||||||
}, |
|
||||||
onUnload(){ |
|
||||||
this.value = "" |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
async startRecognize () { |
|
||||||
// #ifdef APP-PLUS |
|
||||||
let status = await this.checkPermission(); |
|
||||||
if (status !== 1) { |
|
||||||
return; |
|
||||||
} |
|
||||||
// #endif |
|
||||||
|
|
||||||
// TODO ios 在没有请求过权限之前无法得知是否有相关权限,这种状态下需要直接调用语音,会弹出正在识别的toast |
|
||||||
var options = {}; |
|
||||||
var that = this; |
|
||||||
options.engine = 'baidu'; |
|
||||||
that.value = ""; |
|
||||||
plus.speech.startRecognize(options, function (s) { |
|
||||||
console.log(s); |
|
||||||
that.value += s; |
|
||||||
}, function (e) { |
|
||||||
console.log("语音识别失败:" + e.message); |
|
||||||
}); |
|
||||||
}, |
|
||||||
async startRecognizeEnglish () { |
|
||||||
// #ifdef APP-PLUS |
|
||||||
let status = await this.checkPermission(); |
|
||||||
if (status !== 1) { |
|
||||||
return; |
|
||||||
} |
|
||||||
// #endif |
|
||||||
|
|
||||||
// TODO ios 在没有请求过权限之前无法得知是否有相关权限,这种状态下需要直接调用语音,会弹出正在识别的toast |
|
||||||
var options = {}; |
|
||||||
var that = this; |
|
||||||
options.engine = 'baidu'; |
|
||||||
options.lang = 'en-us'; |
|
||||||
that.value = ""; |
|
||||||
plus.speech.startRecognize(options, function (s) { |
|
||||||
console.log(s); |
|
||||||
that.value += s; |
|
||||||
}, function (e) { |
|
||||||
console.log("语音识别失败:" + e.message); |
|
||||||
}); |
|
||||||
} |
|
||||||
// #ifdef APP-PLUS |
|
||||||
, |
|
||||||
async checkPermission() { |
|
||||||
let status = permision.isIOS ? await permision.requestIOS('record') : |
|
||||||
await permision.requestAndroid('android.permission.RECORD_AUDIO'); |
|
||||||
|
|
||||||
if (status === null || status === 1) { |
|
||||||
status = 1; |
|
||||||
} else if (status === 2) { |
|
||||||
uni.showModal({ |
|
||||||
content: "系统麦克风已关闭", |
|
||||||
confirmText: "确定", |
|
||||||
showCancel: false, |
|
||||||
success: function(res) { |
|
||||||
} |
|
||||||
}) |
|
||||||
} else { |
|
||||||
uni.showModal({ |
|
||||||
content: "需要麦克风权限", |
|
||||||
confirmText: "设置", |
|
||||||
success: function(res) { |
|
||||||
if (res.confirm) { |
|
||||||
permision.gotoAppSetting(); |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
return status; |
|
||||||
} |
|
||||||
// #endif |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style> |
|
||||||
|
|
||||||
</style> |
|
||||||
|
Before Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 401 B |
|
Before Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 365 B |
|
Before Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 565 B |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
@ -1,20 +0,0 @@ |
|||||||
@font-face { |
|
||||||
font-family: "customicons"; /* Project id 2878519 */ |
|
||||||
src:url('/static/customicons.ttf') format('truetype'); |
|
||||||
} |
|
||||||
|
|
||||||
.customicons { |
|
||||||
font-family: "customicons" !important; |
|
||||||
} |
|
||||||
|
|
||||||
.youxi:before { |
|
||||||
content: "\e60e"; |
|
||||||
} |
|
||||||
|
|
||||||
.wenjian:before { |
|
||||||
content: "\e60f"; |
|
||||||
} |
|
||||||
|
|
||||||
.zhuanfa:before { |
|
||||||
content: "\e610"; |
|
||||||
} |
|
||||||
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 554 B |
@ -1,32 +0,0 @@ |
|||||||
@font-face { |
|
||||||
font-family: "iconfont"; /* Project id */ |
|
||||||
src: url('@/static/iconfont.ttf') format('truetype'); |
|
||||||
} |
|
||||||
|
|
||||||
.iconfont { |
|
||||||
font-family: "iconfont" !important; |
|
||||||
font-size: 16px; |
|
||||||
font-style: normal; |
|
||||||
-webkit-font-smoothing: antialiased; |
|
||||||
-moz-osx-font-smoothing: grayscale; |
|
||||||
} |
|
||||||
|
|
||||||
.icon-link:before { |
|
||||||
content: "\e772"; |
|
||||||
} |
|
||||||
|
|
||||||
.icon-poweroff:before { |
|
||||||
content: "\e774"; |
|
||||||
} |
|
||||||
|
|
||||||
.icon-safety-certificate:before { |
|
||||||
content: "\e776"; |
|
||||||
} |
|
||||||
|
|
||||||
.icon-chart-pie-alt:before { |
|
||||||
content: "\e78c"; |
|
||||||
} |
|
||||||
|
|
||||||
.icon-kongxincai:before { |
|
||||||
content: "\e642"; |
|
||||||
} |
|
||||||
|
Before Width: | Height: | Size: 677 B |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 429 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 828 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 686 B |
|
Before Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1017 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 801 B |
|
Before Width: | Height: | Size: 902 B |
|
Before Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 948 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 534 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 716 B |
|
Before Width: | Height: | Size: 981 B |
|
Before Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 943 B |
|
Before Width: | Height: | Size: 980 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 624 B |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 557 B |
|
Before Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 741 KiB |
|
Before Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |