Browse Source

ios 语音问题

master
kami 2 years ago
parent
commit
5bc9ce0118
  1. 5
      src/main.js
  2. 2
      src/store/wx.js
  3. 13
      src/views/Home.vue
  4. 41
      src/views/mail/components/Write.vue
  5. 13
      vite.config.js

5
src/main.js

@ -2,6 +2,7 @@ import { createApp } from 'vue'
import router from './router/index'
import { createPinia } from 'pinia'
import App from './App.vue'
import { Button, Tab, Tabs, Form, Field, CellGroup, Cell, RadioGroup, Radio, Uploader, Icon, Popup, Loading, Overlay, Empty, List, Picker } from 'vant';
import IconComponent from '@/components/Icon.vue'
@ -13,6 +14,10 @@ import 'vant/lib/index.css';
import './assets/style/style.scss'
import './assets/style/vant.scss'
// import VConsole from 'vconsole';
//
// const vConsole = new VConsole();
const app = createApp(App)
.use(router)
.use(createPinia())

2
src/store/wx.js

@ -11,7 +11,7 @@ const WxStore = defineStore(
initSign() {
const _this = this;
return new Promise((resolve, reject) => {
const url = window.location.href.split("?")[0];
const url = window.location.href;
wxSign(url).then((data) => {
wx.config({
// debug: true, // 开启调试模式

13
src/views/Home.vue

@ -41,6 +41,7 @@ import { auth, authOpenid } from "@/api/auth";
import UserStore from "@/store/user";
import {setToken, getToken} from "@/util/cookie";
import WxStore from "@/store/wx";
const wxStore = WxStore();
const router = useRouter();
@ -57,8 +58,8 @@ if (!getToken()) {
setToken(data.token);
userStore.user = data.user;
loading.value = false
wxStore.initSign()
window.location.href = "https://mailbox.biutag.com/"
// wxStore.initSign()
});
} else if (route.query.openid) {
//
@ -66,8 +67,8 @@ if (!getToken()) {
setToken(data.token);
userStore.user = data.user;
loading.value = false
wxStore.initSign()
window.location.href = "https://mailbox.biutag.com/"
// wxStore.initSign()
});
} else {
const appid = "wx795f76e4bc3b0062";
@ -80,7 +81,6 @@ if (!getToken()) {
}
} else {
loading.value = false
wxStore.initSign()
}
</script>
@ -88,11 +88,13 @@ if (!getToken()) {
.wrapper {
background-color: #fff;
}
header {
img {
width: 100%;
}
}
a {
width: 45.2%;
height: 84px;
@ -101,6 +103,7 @@ a {
color: var(--primary-color);
font-weight: bold;
font-size: 18px;
&:hover {
cursor: pointer;
}

41
src/views/mail/components/Write.vue

@ -63,7 +63,8 @@
sendBtnDisabled
? `${time}秒后重发`
: "发送验证码"
}}</van-button
}}
</van-button
>
</div>
</template>
@ -175,7 +176,8 @@
>
<van-button block @click="handleSaveDraft">存稿</van-button>
<van-button block type="primary" @click="handleSave"
>提交</van-button
>提交
</van-button
>
</div>
</van-form>
@ -262,6 +264,7 @@ if (!wxStore.signInitFlag) {
const mail = ref({});
initMail();
function initMail() {
mail.value = {
contactName: userStore.user.realName,
@ -379,6 +382,7 @@ let timer;
let recorder;
const recordTime = ref(59);
const showCountdown = ref(false);
function handleVoiceShow() {
navigator.mediaDevices
.getUserMedia({audio: true})
@ -386,10 +390,14 @@ function handleVoiceShow() {
showCountdown.value = false;
voiceShow.value = true;
//
if ('vibrate' in navigator) {
navigator.vibrate([100]);
}
speechText.value = "";
//
recorder = startRecorder(() => {}, speechText);
recorder = startRecorder(() => {
}, speechText);
recordTime.value = 59;
timer = setInterval(() => {
recordTime.value -= 1;
@ -403,12 +411,14 @@ function handleVoiceShow() {
}, 1000);
})
.catch(function (err) {
console.log(err)
showToast("未启用麦克风权限,请刷新重试");
});
}
const cancleBtnRef = ref();
const successBtnRef = ref();
function handleCanleTalk() {
cancleBtnRef.value.style.backgroundColor = "#d15454";
recorder?.stop();
@ -429,6 +439,7 @@ function handleSuccenssTalk() {
const sendBtnDisabled = ref(false);
let time = ref(30);
function smsSendCode() {
formRef.value.validate("contactPhone").then(() => {
sendBtnDisabled.value = true;
@ -449,6 +460,7 @@ function smsSendCode() {
const showImgPreview = ref(false);
const imgFilepath = ref("");
function handleShowImgPreview(filepath) {
imgFilepath.value = filepath;
showImgPreview.value = true;
@ -495,6 +507,7 @@ function validatorContent() {
top: 3px;
right: var(--van-cell-horizontal-padding);
}
.upload-btn {
width: 108px;
height: 108px;
@ -502,18 +515,22 @@ function validatorContent() {
border: 1px solid var(--primary-color);
color: var(--primary-color);
}
.attachments {
margin-top: 10px;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 10px;
img {
width: 100%;
height: 108px;
}
.file {
background-color: #f3faff;
height: 108px;
.name {
width: 100%;
max-width: 108px;
@ -524,8 +541,10 @@ function validatorContent() {
}
}
}
.van-popup {
user-select: none;
header {
font-size: 16px;
font-family: PingFangSC-Medium;
@ -533,16 +552,19 @@ function validatorContent() {
margin: 20px;
}
}
.send-btn {
position: absolute;
top: -4px;
right: 0;
}
.record-btn {
&[active="true"] {
animation: scaleIn 1.2s ease-out infinite;
}
}
@keyframes scaleIn {
0% {
transform: scale(1, 1);
@ -563,12 +585,14 @@ function validatorContent() {
bottom: 0;
z-index: 2;
background-color: var(--van-overlay-background);
.recording-container {
position: fixed;
left: 0;
right: 0;
bottom: 0;
}
.text {
min-height: 60px;
background-color: var(--primary-color);
@ -578,6 +602,7 @@ function validatorContent() {
padding: var(--van-padding-md);
margin-bottom: 60px;
position: relative;
textarea {
border: none;
background-color: inherit;
@ -587,12 +612,14 @@ function validatorContent() {
max-height: calc(90vh - 280px);
font-size: 16px;
}
img {
position: absolute;
bottom: -13px;
right: 6px;
width: 50px;
}
.countdown {
position: absolute;
bottom: 4px;
@ -600,9 +627,11 @@ function validatorContent() {
color: #bbb;
}
}
.tools {
padding: 30px;
margin-bottom: 10vh;
button {
background-color: #3a3a3a;
height: 100px;
@ -610,25 +639,30 @@ function validatorContent() {
border-radius: 50%;
border: none;
color: #ccc;
&:hover {
background-color: #ddd;
color: #777;
}
&.cancel {
background-color: transparent;
color: #fff;
&:hover {
background-color: #d15454;
}
}
}
}
.recording {
height: 16vh;
margin-top: 60px;
background: linear-gradient(#a4a4a4, #fff);
color: #ccc;
position: relative;
&::before {
display: block;
content: "";
@ -645,6 +679,7 @@ function validatorContent() {
}
}
}
.file-item {
a {
position: absolute;

13
vite.config.js

@ -38,5 +38,18 @@ export default defineConfig({
rewrite: (p) => p.replace(/^\/api/, '')
}
}
},
build: {
rollupOptions: {
output: {
entryFileNames: `assets/[name].${new Date().getTime()}.js`,
chunkFileNames: `assets/[name].${new Date().getTime()}.js`,
assetFileNames: `assets/[name].${new Date().getTime()}.[ext]`,
compact: true,
manualChunks: {
vue: ['vue']
},
}
}
}
})

Loading…
Cancel
Save