li.shaoyi 2 년 전
부모
커밋
bdf9319bcd

+ 1 - 1
package.json

@@ -22,7 +22,7 @@
     "build:zrwyt": "vue-cli-service build --mode zrwyt",
     "build:zrwyt@pc": "vue-cli-service build --mode zrwyt@pc",
     "build:qdhs": "vue-cli-service build --mode qdhs",
-    "build:qdhs@pc": "&& vue-cli-service build --mode qdhs@pc",
+    "build:qdhs@pc": "vue-cli-service build --mode qdhs@pc",
     "build:tc": "vue-cli-service build --mode tc",
     "build:tc@pc": "vue-cli-service build --mode tc@pc",
     "lint": "vue-cli-service lint",

+ 1 - 0
src/business/login/index.ts

@@ -142,6 +142,7 @@ export function useLogin(persist = false) {
 
         logout().finally(() => {
             accountStore.$reset()
+            futuresStore.$reset()
             loginStore.clearAutoLoginData()
             loginStore.clearLoginInfo()
             callback && callback()

+ 5 - 0
src/components/base/slider-verify/index.vue

@@ -651,6 +651,11 @@ nextTick(() => {
         tipTxt
     )
 })
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    reset: () => vfcx.reset()
+})
 </script> 
 <style scoped>
 .cur {

+ 4 - 73
src/packages/gstj/views/user/login/Index.vue

@@ -1,81 +1,12 @@
 <template>
-  <app-statusbar class="login">
-    <app-navback class="login-navback" />
-    <div class="login-logo">
-      <img src="../../../assets/images/login-logo.png" />
-    </div>
-    <Form class="login-form" @submit="formSubmit">
-      <CellGroup inset>
-        <Field v-model="formData.userName" name="account" label="用户名" label-align="top" size="large" placeholder="请输入用户名"
-          :rules="[{ required: true, message: '请输入用户名' }]" />
-        <Field v-model="formData.password" name="password" type="password" label="密码" label-align="top" size="large"
-          placeholder="请输入密码" :rules="[{ required: true, message: '请输入密码' }]" autocomplete="off" />
-      </CellGroup>
-      <div class="button-submit">
-        <Button type="primary" native-type="submit" round block>登录</Button>
-      </div>
-    </Form>
-    <div class="login-link">
-      <span @click="navigationTo('user-register')">用户注册</span>
-      <span @click="navigationTo('user-forget')">忘记密码</span>
-    </div>
-    <div class="login-footer">
-      <div class="login-footer__trem">
-        <Checkbox shape="square" icon-size=".32rem" v-model="checked">我已阅读并同意</Checkbox>
-        <span @click="routerTo('rules-zcxy')">《用户注册协议》</span>
-        <span>、</span>
-        <span @click="routerTo('rules-yhkhfxgzs')">《用户开户风险告知书》</span>
-        <span>、</span>
-        <span @click="routerTo('rules-yszc')">《隐私政策》</span>
-      </div>
-      <div class="login-footer__version" v-if="plus.getSystemInfo('os') !== 'Web'">
-        <span>v{{ appVersion }}</span>
-      </div>
-    </div>
-  </app-statusbar>
+  <AppLogin :logo-src="logoImage" />
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, onMounted, onUnmounted } from 'vue'
-import { Button, Field, CellGroup, Form, Checkbox, showFailToast, showSuccessToast, showToast } from 'vant'
-import { fullloading } from '@/utils/vant'
-import { useLogin } from '@/business/login'
-import { useNavigation } from '@mobile/router/navigation'
-import service from '@/services'
+import { onMounted, onUnmounted } from 'vue'
 import plus from '@/utils/h5plus'
-
-const { routerBack, routerTo } = useNavigation()
-const { formData, userLogin } = useLogin()
-const checked = shallowRef(false) // 是否同意协议管理
-const appVersion = plus.getSystemInfo('version') // 应用版本号
-
-// 导航跳转
-const navigationTo = (name: string) => {
-  fullloading((hideLoading) => {
-    service.onReady().then(() => {
-      hideLoading()
-      routerTo(name)
-    }).catch(() => {
-      showFailToast('初始化失败')
-    })
-  }, '加载中...')
-}
-
-const formSubmit = () => {
-  if (checked.value) {
-    fullloading((hideLoading) => {
-      userLogin().then(() => {
-        hideLoading()
-        routerBack()
-        showSuccessToast('登录成功')
-      }).catch((err) => {
-        showFailToast(err)
-      })
-    }, '登录中...')
-  } else {
-    showToast('请先同意使用条款')
-  }
-}
+import AppLogin from '@mobile/components/layouts/login/index.vue'
+import logoImage from '../../../assets/images/login-logo.png'
 
 onMounted(() => plus.setStatusBarStyle('dark'))
 onUnmounted(() => plus.setStatusBarStyle('light'))

+ 0 - 88
src/packages/gstj/views/user/login/index.less

@@ -1,97 +1,9 @@
 .login {
-    display: flex;
-    flex-direction: column;
     background: linear-gradient(35deg, #a5d9f4, #fff 65%, #e8f7f1);
 
-    &-navback {
-        >.van-icon {
-            color: #333;
-        }
-    }
-
     &-logo {
-        text-align: center;
-        padding: 1rem 0;
-
         img {
             height: 1.6rem;
         }
     }
-
-    &-form {
-        background-color: #fff;
-        box-shadow: 0 0 .72rem 0 rgba(0, 0, 0, .15);
-        border-radius: .32rem;
-        padding: .32rem;
-        margin: 0 .36rem;
-
-        .van-cell {
-            &::after {
-                display: none;
-            }
-
-            &-group--inset {
-                margin: 0;
-            }
-        }
-
-        .van-field {
-            &__control {
-                background-color: #f3f8fa;
-                border-radius: .1rem;
-                padding: .12rem .2rem;
-            }
-        }
-
-        .button {
-            &-link {
-                display: flex;
-                justify-content: space-between;
-                padding: .32rem 0;
-
-                a {
-                    color: #333;
-                }
-            }
-
-            &-submit {
-                --van-button-primary-background: #0ca53d;
-                //--van-button-primary-background: linear-gradient(to right, #dc364a, #1973e1);
-                padding: .24rem;
-                padding-top: .48rem;
-            }
-        }
-    }
-
-    &-link {
-        display: flex;
-        justify-content: space-between;
-        font-size: .26rem;
-        padding: .28rem .48rem;
-        margin: 0 .48rem;
-    }
-
-    &-footer {
-        padding: .36rem;
-        margin-top: auto;
-
-        &__trem {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            flex-wrap: wrap;
-            font-size: .24rem;
-
-            .van-checkbox {
-                margin-right: .12rem;
-            }
-        }
-
-        &__version {
-            font-size: .24rem;
-            color: #999;
-            text-align: center;
-            margin-top: .08rem;
-        }
-    }
 }

+ 8 - 1
src/packages/mobile/components/layouts/login/index.vue

@@ -12,7 +12,7 @@
           placeholder="请输入密码" :rules="[{ required: true, message: '请输入密码' }]" autocomplete="off" />
         <Field>
           <template #input>
-            <SliderVerify @statu="slide" style="max-width: 100%;margin: auto;" />
+            <SliderVerify @statu="slide" style="max-width: 100%;margin: auto;" v-if="showSliderVerify" />
           </template>
         </Field>
       </CellGroup>
@@ -62,6 +62,7 @@ const { routerBack, routerTo } = useNavigation()
 const { formData, userLogin } = useLogin()
 const checked = shallowRef(false) // 是否同意协议管理
 const appVersion = plus.getSystemInfo('version') // 应用版本号
+const showSliderVerify = shallowRef(true) // 验证滑块组件重载
 const sliderVerifyStatus = shallowRef(false) // 滑块验证状态
 
 // 导航跳转
@@ -94,7 +95,13 @@ const formSubmit = () => {
           routerBack()
           showSuccessToast('登录成功')
         }).catch((err) => {
+          showSliderVerify.value = false
+          sliderVerifyStatus.value = false
           showFailToast(err)
+
+          setTimeout(() => {
+            showSliderVerify.value = true
+          }, 0)
         })
       }, '登录中...')
     } else {

+ 3 - 2
src/packages/mobile/views/goods/detail/components/listing/Index.vue

@@ -44,7 +44,8 @@
                 <div class="g-form__footer">
                     <template v-if="buyOrSell === BuyOrSell.Buy">
                         <Button type="danger" block square :disabled="!formData.OrderQty"
-                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)">订立买入</Button>
+                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)"
+                            v-if="!quote?.iscannotbuy">订立买入</Button>
                         <Button type="primary" block square
                             :disabled="!formData.OrderQty || !sellQty || (formData.OrderQty > sellQty)"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)" v-if="!isTrademode16">
@@ -54,7 +55,7 @@
                     </template>
                     <template v-if="buyOrSell === BuyOrSell.Sell">
                         <Button type="danger" block square :disabled="!formData.OrderQty"
-                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)" v-if="!isTrademode16">订立卖出</Button>
+                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)" v-if="!isTrademode16 && !quote?.iscannotsell">订立卖出</Button>
                         <Button type="primary" block square
                             :disabled="!formData.OrderQty || !buyQty || (formData.OrderQty > buyQty)"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)">

+ 1 - 1
src/packages/mobile/views/order/list/components/goodsorder/detail/Index.vue

@@ -19,7 +19,7 @@
                 </CellGroup>
             </div>
             <template #footer v-if="[3, 7, 12].includes(selectedRow.orderstatus)">
-                <Button type="primary" block round @click="onCancelSumit">撤销</Button>
+                <Button type="danger" block square @click="onCancelSumit">撤销</Button>
             </template>
         </app-view>
     </app-modal>

+ 1 - 1
src/packages/mobile/views/order/list/components/listingorder/detail/Index.vue

@@ -21,7 +21,7 @@
                 </CellGroup>
             </div>
             <template #footer v-if="[3, 7].includes(selectedRow.wrtradeorderstatus)">
-                <Button type="primary" block round @click="onCancelSumit">撤销</Button>
+                <Button type="danger" block square @click="onCancelSumit">撤销</Button>
             </template>
         </app-view>
     </app-modal>

+ 1 - 1
src/packages/mobile/views/order/list/components/pricingorder/detail/Index.vue

@@ -18,7 +18,7 @@
                 </CellGroup>
             </div>
             <template #footer v-if="selectedRow.orderstatus === 3 || selectedRow.orderstatus === 7">
-                <Button type="primary" block round @click="onCancelSumit">撤销</Button>
+                <Button type="danger" block square @click="onCancelSumit">撤销</Button>
             </template>
         </app-view>
     </app-modal>

+ 1 - 1
src/packages/mobile/views/order/list/components/swaporder/detail/Index.vue

@@ -18,7 +18,7 @@
                 </CellGroup>
             </div>
             <template #footer v-if="selectedRow.orderstatus === 3 || selectedRow.orderstatus === 7">
-                <Button type="primary" block round @click="onCancelSumit">撤销</Button>
+                <Button type="danger" block square @click="onCancelSumit">撤销</Button>
             </template>
         </app-view>
     </app-modal>

+ 1 - 1
src/packages/mobile/views/order/list/components/transferorder/detail/Index.vue

@@ -18,7 +18,7 @@
                 </CellGroup>
             </div>
             <template #footer v-if="[3, 7].includes(selectedRow.orderstatus)">
-                <Button type="primary" block round @click="onCancelSumit(selectedRow)">撤销</Button>
+                <Button type="danger" block square @click="onCancelSumit(selectedRow)">撤销</Button>
             </template>
         </app-view>
     </app-modal>

+ 1 - 1
src/packages/mobile/views/transfer/listing/Index.vue

@@ -39,7 +39,7 @@
             <template #footer>
                 <div class="g-form__footer">
                     <Button block square type="danger" @click="formRef?.submit"
-                        v-if="buyOrSell === BuyOrSell.Buy">订立买入</Button>
+                        v-if="buyOrSell === BuyOrSell.Buy && !quote?.iscannotbuy">订立买入</Button>
                     <Button block square type="primary"
                         :disabled="!formData.OrderQty || !enableqty || (formData.OrderQty > enableqty)"
                         @click="formRef?.submit" v-if="buyOrSell === BuyOrSell.Sell">

+ 5 - 96
src/packages/mobile/views/user/login/Index.vue

@@ -1,104 +1,13 @@
 <template>
-  <app-statusbar class="login">
-    <app-navback class="login-navback" />
-    <div class="login-logo">
-      <img src="../../../assets/images/login-logo.png" />
-    </div>
-    <Form class="login-form" @submit="formSubmit">
-      <CellGroup inset>
-        <Field v-model="formData.userName" name="account" label="用户名" label-align="top" size="large" placeholder="请输入用户名"
-          :rules="[{ required: true, message: '请输入用户名' }]" />
-        <Field v-model="formData.password" name="password" type="password" label="密码" label-align="top" size="large"
-          placeholder="请输入密码" :rules="[{ required: true, message: '请输入密码' }]" autocomplete="off" />
-        <Field>
-          <template #input>
-            <SliderVerify @statu="slide" style="max-width: 100%;margin: auto;" />
-          </template>
-        </Field>
-      </CellGroup>
-      <div class="button-submit">
-        <Button type="primary" native-type="submit" round block>登录</Button>
-      </div>
-    </Form>
-    <div class="login-link">
-      <span @click="navigationTo('user-register')" v-if="service.hasSystemModule('register')">用户注册</span>
-      <span @click="navigationTo('user-forget')">忘记密码</span>
-    </div>
-    <div class="login-footer">
-      <div class="login-footer__trem">
-        <Checkbox shape="square" icon-size=".32rem" v-model="checked">我已阅读并同意</Checkbox>
-        <span @click="routerTo('rules-zcxy')">《用户注册协议》</span>
-        <span>、</span>
-        <span @click="routerTo('rules-yhkhfxgzs')">《用户开户风险告知书》</span>
-        <span>、</span>
-        <span @click="routerTo('rules-yszc')">《隐私政策》</span>
-      </div>
-      <div class="login-footer__version" v-if="plus.getSystemInfo('os') !== 'Web'">
-        <span>v{{ appVersion }}</span>
-      </div>
-    </div>
-  </app-statusbar>
+  <AppLogin :logo-src="logoImage" />
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, onMounted, onUnmounted } from 'vue'
-import { Button, Field, CellGroup, Form, Checkbox, showFailToast, showSuccessToast, showToast } from 'vant'
-import { fullloading } from '@/utils/vant'
-import { useLogin } from '@/business/login'
-import { useNavigation } from '@mobile/router/navigation'
-import service from '@/services'
+import { onMounted, onUnmounted } from 'vue'
 import plus from '@/utils/h5plus'
-import SliderVerify from '@/components/base/slider-verify/index.vue' // 临时调用,待优化
-
-const { routerBack, routerTo } = useNavigation()
-const { formData, userLogin } = useLogin()
-const checked = shallowRef(false) // 是否同意协议管理
-const appVersion = plus.getSystemInfo('version') // 应用版本号
-const sliderVerifyStatus = shallowRef(false) // 滑块验证状态
-
-// 导航跳转
-const navigationTo = (name: string) => {
-  fullloading((hideLoading) => {
-    service.onReady().then(() => {
-      hideLoading()
-      routerTo(name)
-    }).catch(() => {
-      showFailToast('初始化失败')
-    })
-  }, '加载中...')
-}
-
-// 滑块验证 
-const slide = (vfcStatu: { statu: string }) => {
-  if (vfcStatu.statu === 'success') {
-    sliderVerifyStatus.value = true
-  } else {
-    sliderVerifyStatus.value = false
-  }
-}
-
-const formSubmit = () => {
-  if (sliderVerifyStatus.value) {
-    if (checked.value) {
-      fullloading((hideLoading) => {
-        userLogin().then(() => {
-          hideLoading()
-          routerBack()
-          showSuccessToast('登录成功')
-        }).catch((err) => {
-          showFailToast(err)
-        })
-      }, '登录中...')
-    } else {
-      showToast('请先同意使用条款')
-    }
-  }
-}
+import AppLogin from '@mobile/components/layouts/login/index.vue'
+import logoImage from '../../../assets/images/login-logo.png'
 
 onMounted(() => plus.setStatusBarStyle('dark'))
 onUnmounted(() => plus.setStatusBarStyle('light'))
-</script>
-
-<style lang="less">
-@import './index.less';
-</style>
+</script>

+ 25 - 19
src/packages/pc/views/auth/login/index.vue

@@ -13,7 +13,7 @@
         </el-input>
       </el-form-item>
       <el-form-item>
-        <SliderVerify @statu="slide" />
+        <SliderVerify @statu="slide" v-if="showSliderVerify" />
       </el-form-item>
       <el-form-item>
         <div class="text-link">
@@ -67,6 +67,7 @@ const islogin = shallowRef(true)
 const isRegister = shallowRef(false)
 const qrContent = shallowRef('')
 const rloading = shallowRef(false)
+const showSliderVerify = shallowRef(true) // 验证滑块组件重载
 const sliderVerifyStatus = shallowRef(false) // 滑块验证状态
 
 const formRules: FormRules = {
@@ -98,26 +99,31 @@ const slide = (vfcStatu: { statu: string }) => {
 }
 
 const formSubmit = () => {
-  if (sliderVerifyStatus.value) {
-    formRef.value?.validate(async (valid) => {
-      if (valid) {
-        try {
-          loading.value = true
-          await userLogin()
-          await menuStore.getUserMenuList()
-          const redirect = route.query.redirect
-          if (redirect) {
-            router.replace(redirect.toString())
-          } else {
-            router.replace('/')
-          }
-        } catch (err) {
-          loading.value = false
-          ElMessage.error(err as string)
+  formRef.value?.validate(async (valid) => {
+    if (valid && sliderVerifyStatus.value) {
+      try {
+        loading.value = true
+        await userLogin()
+        await menuStore.getUserMenuList()
+        const redirect = route.query.redirect
+        if (redirect) {
+          router.replace(redirect.toString())
+        } else {
+          router.replace('/')
         }
+      } catch (err) {
+        loading.value = false
+        showSliderVerify.value = false
+        sliderVerifyStatus.value = false
+        formData.password = ''
+        ElMessage.error(err as string)
+
+        setTimeout(() => {
+          showSliderVerify.value = true
+        }, 0)
       }
-    })
-  }
+    }
+  })
 }
 
 service.systemInfoAsync.then(() => {

+ 1 - 1
src/packages/pc/views/query/trade/goods/history/index.vue

@@ -53,7 +53,7 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'charge', label: '手续费' },
     { prop: 'closepl', label: '平仓盈亏' },
     { prop: 'tradeid', label: '成交单号' },
-    { prop: 'matchaccountid', label: '成交对手' },
+    // { prop: 'matchaccountid', label: '成交对手' },
     { prop: 'tradetime', label: '成交时间' },
 ])
 

+ 1 - 1
src/packages/pc/views/query/trade/goods/list/index.vue

@@ -39,7 +39,7 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'charge', label: '手续费' },
     { prop: 'closepl', label: '平仓盈亏' },
     { prop: 'tradeid', label: '成交单号' },
-    { prop: 'matchaccountid', label: '成交对手' },
+    // { prop: 'matchaccountid', label: '成交对手' },
     { prop: 'tradetime', label: '成交时间' },
 ])
 </script>

+ 0 - 1
src/stores/index.ts

@@ -8,6 +8,5 @@ export { useFuturesStore } from './modules/futures'
 //export { i18n, useLanguageStore } from './modules/language'
 export { useErrorInfoStore } from './modules/errorInfo'
 export { useNoticeStore } from './modules/notice'
-export { useGoodsStore } from './modules/goods'
 export { usePositionStore } from './modules/position'
 export { useSettingStore } from './modules/setting'

+ 0 - 61
src/stores/modules/goods.ts

@@ -1,61 +0,0 @@
-import { toRefs, computed, reactive } from 'vue'
-import { queryQuoteGoodsList } from '@/services/api/swap'
-import { defineStore } from '../store'
-import { useUserStore } from './user'
-
-/**
- * 订单交易存储对象
- * @returns 
- */
-export const useGoodsStore = defineStore(() => {
-    const userStore = useUserStore()
-
-    const state = reactive({
-        loading: false,
-        quoteGoodsList: <Model.QuoteGoodsListRsp[]>[],
-        goodsId: <number | undefined>undefined,
-    })
-
-    // 当前选中的商品信息
-    const goodsInfo = computed(() => {
-        return {
-            ...state.quoteGoodsList.find((e) => e.goodsid === state.goodsId)
-        }
-    })
-
-    // 当前选中的商品代码
-    const goodsCode = computed(() => {
-        return goodsInfo.value.goodscode ?? ''
-    })
-
-    // 获取商品列表
-    const getQuoteGoodsList = async (params: Partial<Model.QuoteGoodsListReq>) => {
-        try {
-            state.loading = true
-            const res = await queryQuoteGoodsList({
-                data: {
-                    usertype: userStore.userType ?? 0,
-                    ...params
-                }
-            })
-            const data = res.data
-            state.quoteGoodsList = data
-
-            // 查找当前选中的商品
-            if (!data.every((e) => e.goodsid === state.goodsId)) {
-                state.goodsId = data[0].goodsid
-            } else {
-                state.goodsId = undefined
-            }
-        } finally {
-            state.loading = false
-        }
-    }
-
-    return {
-        ...toRefs(state),
-        goodsInfo,
-        goodsCode,
-        getQuoteGoodsList,
-    }
-})