1
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 557 KiB |
|
After Width: | Height: | Size: 557 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 994 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 19 KiB |
@@ -18,6 +18,7 @@
|
||||
recognition: null,
|
||||
listening: false,
|
||||
menus: null,
|
||||
platform: "PC",
|
||||
parentMap: {},
|
||||
lastText: "",
|
||||
pendingMatches: [],
|
||||
@@ -128,7 +129,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
function getMenus() {
|
||||
function getCurrentPlatform() {
|
||||
const $button = $("#voice-menu-btn")
|
||||
return String(($button.data("platform") || state.platform || "PC")).toUpperCase()
|
||||
}
|
||||
|
||||
function setCurrentPlatform(platform) {
|
||||
const nextPlatform = String(platform || "PC").toUpperCase()
|
||||
if (state.platform !== nextPlatform) {
|
||||
state.menus = null
|
||||
state.parentMap = {}
|
||||
}
|
||||
state.platform = nextPlatform
|
||||
return state.platform
|
||||
}
|
||||
|
||||
function filterMenusByPlatform(menus, platform) {
|
||||
const currentPlatform = String(platform || "PC").toUpperCase()
|
||||
return (menus || []).filter(function (menu) {
|
||||
return String(menu.platform || "PC").toUpperCase() === currentPlatform
|
||||
})
|
||||
}
|
||||
|
||||
function setMenus(menus, platform) {
|
||||
state.parentMap = {}
|
||||
state.menus = filterMenusByPlatform(flattenMenus(menus, "", []), platform).filter(function (menu) {
|
||||
return menu.href
|
||||
})
|
||||
return state.menus
|
||||
}
|
||||
|
||||
function getMenus(platform) {
|
||||
platform = String(platform || getCurrentPlatform()).toUpperCase()
|
||||
setCurrentPlatform(platform)
|
||||
const cached = state.menus
|
||||
if (cached && cached.length) {
|
||||
return $.Deferred().resolve(cached).promise()
|
||||
@@ -136,35 +169,22 @@
|
||||
|
||||
const storeMenus = getStoreMenus()
|
||||
if (storeMenus && storeMenus.length) {
|
||||
state.menus = flattenMenus(storeMenus, "", []).filter(function (menu) {
|
||||
return menu.href
|
||||
})
|
||||
return $.Deferred().resolve(state.menus).promise()
|
||||
return $.Deferred().resolve(setMenus(storeMenus, platform)).promise()
|
||||
}
|
||||
|
||||
return $.get("/platform/sys/user/getLogonUser").then(function (res) {
|
||||
if (res && res.code === 0 && res.data && res.data.menus) {
|
||||
state.parentMap = {}
|
||||
state.menus = flattenMenus(res.data.menus, "", []).filter(function (menu) {
|
||||
return menu.href
|
||||
})
|
||||
return state.menus
|
||||
return setMenus(res.data.menus, platform)
|
||||
}
|
||||
const sessionMenus = getSessionMenus()
|
||||
if (sessionMenus && sessionMenus.length) {
|
||||
state.menus = flattenMenus(sessionMenus, "", []).filter(function (menu) {
|
||||
return menu.href
|
||||
})
|
||||
return state.menus
|
||||
return setMenus(sessionMenus, platform)
|
||||
}
|
||||
return []
|
||||
}, function () {
|
||||
const sessionMenus = getSessionMenus()
|
||||
if (sessionMenus && sessionMenus.length) {
|
||||
state.menus = flattenMenus(sessionMenus, "", []).filter(function (menu) {
|
||||
return menu.href
|
||||
})
|
||||
return state.menus
|
||||
return setMenus(sessionMenus, platform)
|
||||
}
|
||||
return []
|
||||
})
|
||||
@@ -409,7 +429,7 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
getMenus().then(function (menus) {
|
||||
getMenus(getCurrentPlatform()).then(function (menus) {
|
||||
const matches = matchMenus(state.lastText, menus)
|
||||
runAfterRecognitionEnd(function () {
|
||||
chooseMenu(matches)
|
||||
@@ -423,6 +443,7 @@
|
||||
|
||||
function init() {
|
||||
$(document).on("click", "#voice-menu-btn", function () {
|
||||
setCurrentPlatform($(this).data("platform") || "PC")
|
||||
start()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:on-exceed="handleExceed"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:limit="upload_number"
|
||||
:limit="uploadLimitNumber"
|
||||
:accept="fileAccept"
|
||||
:multiple="true"
|
||||
>
|
||||
@@ -31,7 +31,7 @@
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:limit="upload_number"
|
||||
:limit="uploadLimitNumber"
|
||||
:accept="fileAccept"
|
||||
:multiple="true"
|
||||
list-type="picture-card"
|
||||
@@ -71,7 +71,7 @@
|
||||
:on-remove="handleRemove"
|
||||
:on-exceed="handleExceed"
|
||||
:before-upload="beforeUpload"
|
||||
:limit="upload_number"
|
||||
:limit="uploadLimitNumber"
|
||||
:accept="fileAccept"
|
||||
class="drag-upload"
|
||||
:class="{ 'drag-upload-disabled': uploadMode !== 'pc' }"
|
||||
@@ -123,7 +123,7 @@ module.exports = {
|
||||
},
|
||||
// 上传数量
|
||||
upload_number: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
default: 1,
|
||||
required: false
|
||||
},
|
||||
@@ -198,8 +198,12 @@ module.exports = {
|
||||
action() {
|
||||
return this.upload_result_type === "id" ? this.upload_return_id_api : this.upload_dynamic_return_url_api
|
||||
},
|
||||
uploadLimitNumber() {
|
||||
const number = Number(this.upload_number)
|
||||
return Number.isFinite(number) && number > 0 ? number : 1
|
||||
},
|
||||
upload_tips() {
|
||||
const uploadNumber = this.upload_number
|
||||
const uploadNumber = this.uploadLimitNumber
|
||||
const fileAccept = this.fileAccept
|
||||
const fileSize = this.upload_size
|
||||
|
||||
@@ -359,10 +363,12 @@ module.exports = {
|
||||
|
||||
handleRemove(file, fileList) {
|
||||
if (this.upload_result_category === "interval") {
|
||||
if (this.upload_result_type === "id") {
|
||||
}
|
||||
if (this.upload_result_type === "url") {
|
||||
}
|
||||
const resultIntervalValue = fileList
|
||||
.map((item) => item.response && item.response.data ? item.response.data : item.url || item.data)
|
||||
.filter((item) => item)
|
||||
.join(",")
|
||||
this.$emit("update:value", resultIntervalValue)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.upload_result_category === "array") {
|
||||
@@ -381,13 +387,11 @@ module.exports = {
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$emit("update:value", fileList)
|
||||
}
|
||||
},
|
||||
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning("最多只能上传" + this.upload_number + "个文件")
|
||||
this.$message.warning("最多只能上传" + this.uploadLimitNumber + "个文件")
|
||||
},
|
||||
|
||||
// 上传事件
|
||||
@@ -562,8 +566,8 @@ module.exports = {
|
||||
const originFileList = this.fileList || []
|
||||
console.log(data.files)
|
||||
|
||||
if (this.upload_number) {
|
||||
if (originFileList.length + data.files.length > this.upload_number) {
|
||||
if (this.uploadLimitNumber) {
|
||||
if (originFileList.length + data.files.length > this.uploadLimitNumber) {
|
||||
this.$message.error("上传文件数量超出限制")
|
||||
return
|
||||
}
|
||||
|
||||