Skip to content

Commit b70dcd0

Browse files
committed
.
1 parent af72135 commit b70dcd0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/components/QiMen.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ const zhiFu = ref('')
149149
const zhiShi = ref('')
150150
const cfg = ref({1:{},2:{},3:{},4:{},5:{},6:{},7:{},8:{},9:{}})
151151
152+
const $ji = () => juShu.value > 0 ? 8 : 2
153+
const $jiXing = () => juShu.value > 0 ? '' : ''
154+
const $jiMen = () => juShu.value > 0 ? '' : ''
155+
152156
function paiQiYi() { // 地盘奇仪
153157
const qiYiList = juShu.value > 0 ? QI_YI : [QI_YI[0], ...QI_YI.slice().reverse()]
154158
for (let i = 0; i < 9; i++) {
@@ -157,7 +161,7 @@ function paiQiYi() { // 地盘奇仪
157161
}
158162
function paiFeiPan() { // 飞盘
159163
zhiFu.value = XING_F[xunShouGong - 1]
160-
zhiShi.value = xunShouGong === 5 ? '' : [...MEN_F.slice(0, 4), '', ...MEN_F.slice(-4)][xunShouGong - 1]
164+
zhiShi.value = xunShouGong === 5 ? $jiMen() : [...MEN_F.slice(0, 4), '', ...MEN_F.slice(-4)][xunShouGong - 1]
161165
for (let i = 0; i < 9; i++) { //
162166
cfg.value[(shiGanGong + i - 1) % 9 + 1][5] = [...XING_F, ...XING_F][XING_F.indexOf(zhiFu.value) + i]
163167
}
@@ -166,7 +170,7 @@ function paiFeiPan() { // 飞盘
166170
}
167171
let mark = 0
168172
for (let i = 0; i < 8; i++) { //
169-
if (shiZhiGong === 5) shiZhiGong = 2
173+
if (shiZhiGong === 5) shiZhiGong = $ji()
170174
if ((shiZhiGong + i) % 9 === 5) mark = 1
171175
cfg.value[(shiZhiGong + i + mark - 1) % 9 + 1][8] = [...MEN_F, ...MEN_F][MEN_F.indexOf(zhiShi.value) + i]
172176
}
@@ -178,20 +182,20 @@ function paiFeiPan() { // 飞盘
178182
function paiZhuanPan() { // 转盘
179183
const transer = [1,8,3,4,9,2,7,6, 1,8,3,4,9,2,7,6]
180184
zhiFu.value = xunShouGong === 5 ? '' : XING_Z[transer.indexOf(xunShouGong)]
181-
zhiShi.value = xunShouGong === 5 ? '' : MEN_Z[transer.indexOf(xunShouGong)]
185+
zhiShi.value = xunShouGong === 5 ? $jiMen() : MEN_Z[transer.indexOf(xunShouGong)]
182186
for (let i = 0; i < 8; i++) { //
183-
const j = transer[transer.indexOf(shiGanGong === 5 ? 2 : shiGanGong) + i]
184-
cfg.value[j][5] = [...XING_Z, ...XING_Z][XING_Z.indexOf(zhiFu.value === '' ? '' : zhiFu.value) + i]
187+
const j = transer[transer.indexOf(shiGanGong === 5 ? $ji() : shiGanGong) + i]
188+
cfg.value[j][5] = [...XING_Z, ...XING_Z][XING_Z.indexOf(zhiFu.value === '' ? $jiXing() : zhiFu.value) + i]
185189
}
186190
for (let i = 0; i < 8; i++) { // 天盘奇仪
187191
cfg.value[+Object.keys(cfg.value).find(k => cfg.value[k][5] === XING_Z[i])][6] = cfg.value[transer[i]][9]
188192
}
189193
for (let i = 0; i < 8; i++) { //
190-
const j = transer[transer.indexOf(shiZhiGong === 5 ? 2 : shiZhiGong) + i]
194+
const j = transer[transer.indexOf(shiZhiGong === 5 ? $ji() : shiZhiGong) + i]
191195
cfg.value[j][8] = [...MEN_Z, ...MEN_Z][MEN_Z.indexOf(zhiShi.value) + i]
192196
}
193197
for (let i = 0; i < 8; i++) { //
194-
const j = transer[transer.indexOf(shiGanGong === 5 ? 2 : shiGanGong) + i]
198+
const j = transer[transer.indexOf(shiGanGong === 5 ? $ji() : shiGanGong) + i]
195199
const shenList = juShu.value > 0 ? SHEN_Z : [SHEN_Z[0], ...SHEN_Z.slice().reverse()]
196200
cfg.value[j][2] = shenList[i]
197201
}

0 commit comments

Comments
 (0)