|
|
|
@ -17,28 +17,39 @@
@@ -17,28 +17,39 @@
|
|
|
|
|
<span class="capacity" :class="{ 'height': itemNum / grid.length > 0.8 }"> |
|
|
|
|
{{ itemNum }}/{{ grid.length }} |
|
|
|
|
</span> |
|
|
|
|
<button class="button addGrid" @click="addGrid">+</button> |
|
|
|
|
<button class="button" @click="neaten">{{ t('neaten') }}</button> |
|
|
|
|
<button class="button" @click="sellAll">{{ t('sellAll') }}</button> |
|
|
|
|
<AutoSell /> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<Confirm ref="confirm" width="8rem" :tip="replace(t('addGrid.1'), [needCoins, addNum])" :confirm="t('addGrid.2')" |
|
|
|
|
:cancel="t('addGrid.3')" @confirm="confirmAddGrid" /> |
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import { useStore } from "vuex"; |
|
|
|
|
import { computed, onMounted, ref } from "vue"; |
|
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
|
import EquipIcon from "@/components/equip-icon.vue"; |
|
|
|
|
import { EquipIcon, Confirm } from "@/components"; |
|
|
|
|
import { lock_icon, backpack_num } from "@/config"; |
|
|
|
|
import AutoSell from "./auto-sell.vue"; |
|
|
|
|
import { userMobile } from "@/tool"; |
|
|
|
|
import { userMobile, replace } from "@/tool"; |
|
|
|
|
|
|
|
|
|
const { t } = useI18n(); |
|
|
|
|
const { state, commit, dispatch } = useStore(); |
|
|
|
|
const grid = computed(() => { |
|
|
|
|
return state.grid; |
|
|
|
|
}); |
|
|
|
|
const emit = defineEmits(['openEquipMenu']) |
|
|
|
|
const emit = defineEmits(['openEquipMenu']); |
|
|
|
|
const confirm = ref(); |
|
|
|
|
const userCoins = computed(() => { |
|
|
|
|
return state.playerAttribute.coins; |
|
|
|
|
}) |
|
|
|
|
const needCoins = 2000000; |
|
|
|
|
const addNum = 8; |
|
|
|
|
const maxNum = 160; |
|
|
|
|
|
|
|
|
|
const itemNum = computed(() => { |
|
|
|
|
let i = 0; |
|
|
|
@ -78,6 +89,24 @@ mobile.onClick = (e, data) => {
@@ -78,6 +89,24 @@ mobile.onClick = (e, data) => {
|
|
|
|
|
commit('show_equip_tip', { equip: data[0], compare: true, e: e.touches[0] }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const addGrid = (e) => { |
|
|
|
|
if (grid.value.length >= maxNum) { |
|
|
|
|
commit("set_sys_info", { msg: replace(t('addGrid.4'), [maxNum]), type: "warning", }); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
confirm.value.open(0, e) |
|
|
|
|
} |
|
|
|
|
const confirmAddGrid = () => { |
|
|
|
|
if (userCoins.value < needCoins) { |
|
|
|
|
commit("set_sys_info", { msg: t('stNoCoins'), type: "warning", }); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
commit("add_player_coins", -1 * needCoins); |
|
|
|
|
for (let i = 0; i < addNum; i++) { |
|
|
|
|
grid.value.push(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMounted(() => { }); |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
@ -89,7 +118,8 @@ onMounted(() => { });
@@ -89,7 +118,8 @@ onMounted(() => { });
|
|
|
|
|
align-items: flex-start; |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
display: flex; |
|
|
|
|
padding-left: 1.3rem; |
|
|
|
|
padding-left: 0.8rem; |
|
|
|
|
overflow: auto; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.grid { |
|
|
|
@ -154,10 +184,16 @@ onMounted(() => { });
@@ -154,10 +184,16 @@ onMounted(() => { });
|
|
|
|
|
color: red; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.button { |
|
|
|
|
float: right; |
|
|
|
|
margin-top: 0.9rem; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.addGrid { |
|
|
|
|
padding: 0 0.8rem; |
|
|
|
|
float: left; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@media only screen and (max-width: 768px) { |
|
|
|
@ -196,6 +232,11 @@ onMounted(() => { });
@@ -196,6 +232,11 @@ onMounted(() => { });
|
|
|
|
|
.button { |
|
|
|
|
margin-top: 0.5rem; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.addGrid { |
|
|
|
|
padding: 0 0.4rem; |
|
|
|
|
float: left; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|