添加页面及部分多语言切换

This commit is contained in:
浅念
2025-03-15 15:46:16 +08:00
parent 36ee43c61b
commit f050f7cd4d
19 changed files with 1126 additions and 302 deletions
+110 -6
View File
@@ -37,7 +37,7 @@
<view class="cell1" v-if="form.followType==2">
<view>当前位置拍照上传</view>
<view style="margin-top: 10px;">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select" @delete="delfn('front_45_degree')">
<uni-file-picker fileMediatype="image" limit="1" :del-icon="false" disable-preview @select="select1" @delete="delfn('front_45_degree')">
<image src="/static/image/customer/upimg.png" mode="" class="addimg"></image>
</uni-file-picker>
</view>
@@ -46,15 +46,16 @@
<view class="cell1" v-if="form.followType==2">
<view>拜访内容</view>
<view class="yuyin">
<textarea auto-height v-model="form.condition_desc" placeholder="拜访内容..."/>
<image src="/static/image/customer/yuyin.png" mode=""></image>
<textarea auto-height v-model="form.bf_desc" placeholder="拜访内容..."/>
<image src="/static/image/customer/yuyin.png" mode="" @tap="startRecognizebd"></image>
</view>
</view>
<u-divider text="" v-if="form.followType==2"></u-divider>
<view class="cell1" v-if="form.followType==2">
<view>备注(非必填)</view>
<view class="">
<view class="yuyin">
<textarea auto-height v-model="form.condition_desc" placeholder="详细情况..."/>
<image src="/static/image/customer/yuyin.png" mode="" @tap="startRecognize"></image>
</view>
</view>
</view>
@@ -121,8 +122,8 @@
</view>
</template>
<script>
import permision from "@/common/permission.js"
import { request,showToast } from '@/api/apiT.js'
// import ldSelect from '@/components/ld-select/ld-select.vue'
export default {
data() {
return {
@@ -139,7 +140,8 @@
level: '初步接触',
region: '',
firstFollow: '2025-03-11 12:00:01',
details: ''
details: '',
bf_desc:''
}
}
},
@@ -152,6 +154,9 @@
leftClick(){
uni.navigateBack({})
},
nextFn(){
},
cancel() {
this.show = false
@@ -180,6 +185,105 @@
return ''
}
},
delfn(name){
console.log(name)
that.carinfo[name] =''
},
uploadfn(imgUrl,name){
var that = this;
uni.uploadFile({
url: 'https://api.collect.hs.hnzhwlkj.club/upload',
filePath: imgUrl,
name: 'image',
header:{'content-type': 'application/x-www-form-urlencoded','Authorization': 'Bearer ' + uni.getStorageSync('token')},
success: (uploadFileRes) => {
const path=JSON.parse(uploadFileRes.data)
that.carinfo[name] = path.data.image_name
console.log(that.carinfo)
}
});
},
select(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_45_degree')
},
select1(e){
const tempFilePaths = e.tempFilePaths;
const imgUrl=tempFilePaths[0]
this.uploadfn(imgUrl,'front_45_degree')
},
async startRecognizebd () {
// #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.valuebd = "";
plus.speech.startRecognize(options, function (s) {
console.log(s);
that.valuebd += s;
}, function (e) {
console.log("语音识别失败:" + e.message);
});
},
async startRecognize () {
// #ifdef APP-PLUS
let status = await this.checkPermission();
if (status !== 1) {
return;
}
// #endif
// TODO ios 在没有请求过权限之前无法得知是否有相关权限,这种状态下需要直接调用语音,会弹出正在识别的toast
var options = {};
var that = this;
that.value = "";
options.engine = 'iFly';
options.punctuation = false; // 是否需要标点符号
options.timeout = 10 * 1000; //语音录入持续时长
plus.speech.startRecognize(options, function(s) {
console.log(s);
that.value += s;
// 关闭语音
plus.speech.stopRecognize();
}, 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>