li.shaoyi 3 年之前
父节点
当前提交
5a3a8b9e21

+ 11 - 10
src/business/credit/index.ts

@@ -57,16 +57,6 @@ export function useCreditLottery() {
     })
 
     const formRefresh = () => {
-        queryTHJScoreConfig({
-            data: {
-                stype: ScoreConfigType.Lottery
-            },
-            success: (res) => {
-                if (res.data.length) {
-                    creditConfig.value = res.data[0]
-                }
-            },
-        })
         queryUserAccount({
             data: {
                 userID: getUserId()
@@ -106,6 +96,17 @@ export function useCreditLottery() {
         })
     }
 
+    queryTHJScoreConfig({
+        data: {
+            stype: ScoreConfigType.Lottery
+        },
+        success: (res) => {
+            if (res.data.length) {
+                creditConfig.value = res.data[0]
+            }
+        },
+    })
+
     return {
         loading,
         creditConfig,

+ 27 - 14
src/filters/index.ts

@@ -3,19 +3,43 @@ import service from '@/services'
 import moment from 'moment'
 
 /**
+ * 获取url对象方法
+ * @param url 
+ * @param base 
+ * @returns 
+ */
+export function getUrl(url: string, base?: string) {
+    const { uploadUrl } = service.config
+    return new URL(url, base ?? uploadUrl)
+}
+
+/**
  * 获取图片地址
  * @param fileUrl 
  */
 export function getImageUrl(fileUrl: string) {
     if (fileUrl) {
-        const { openApiUrl } = service.config
-        return openApiUrl + fileUrl.replace('./', '/')
+        const url = getUrl(fileUrl)
+        return url.href
     }
-    // 返回默认图片
     return ''
 }
 
 /**
+ * 格式化html字符串
+ * @param text 
+ * @returns 
+ */
+export function formatHtmlString(text: string) {
+    const html = text.replace(/[\n\r]/g, '<br />')
+    return html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, capture) => {
+        // 替换img标签src地址为绝对路径
+        const url = getUrl(capture)
+        return `<img src="${url.href}"  alt=""/>`
+    })
+}
+
+/**
  * 处理价格颜色的显示
  */
 export function handlePriceColor(curValue: number, preValue: number) {
@@ -110,17 +134,6 @@ export function formatDate(date: string, format = 'YYYY-MM-DD HH:mm:ss') {
     return moment(date).format(format)
 }
 
-export function formatText(text: string) {
-    const { uploadUrl } = service.config
-    const html = text.replace(/[\n\r]/g, '<br />')
-
-    //return html.replace(/(<img[^>]*src=['"])(?:(?!(https|http)))([^>]*>)/g, `$1${uploadUrl}$2/$3`)
-
-    return html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, capture) => {
-        return `<img src="${uploadUrl.replace('upload', '') + capture.replace('./', '')}"  alt=""/>`
-    })
-}
-
 /**
  * Des密钥
  * 手机发送验证码时加密方法

+ 9 - 0
src/packages/mobile/views/bank/sign/index.less

@@ -0,0 +1,9 @@
+.bank-sign {
+    &__empty {
+        text-align: center;
+
+        .van-button {
+            width: 50%;
+        }
+    }
+}

+ 10 - 3
src/packages/mobile/views/bank/sign/index.vue

@@ -3,13 +3,20 @@
         <template #header>
             <app-navbar title="签约账户管理" />
         </template>
-        <Button @click="routerTo('add-banksign')">添加签约账户</Button>
+        <div class="bank-sign__empty">
+            <Empty description="您还未添加签约账户" />
+            <Button type="primary" @click="routerTo('add-banksign')" round>添加签约账户</Button>
+        </div>
     </app-view>
 </template>
 
 <script lang="ts" setup>
-import { Button } from 'vant'
+import { Button, Empty } from 'vant'
 import { useNavigation } from '@/hooks/navigation'
 
 const { routerTo } = useNavigation()
-</script>
+</script>
+
+<style lang="less" scoped>
+@import './index.less';
+</style>

+ 8 - 5
src/packages/mobile/views/bank/wallet/components/deposit/index.vue

@@ -1,17 +1,20 @@
 <template>
-    <app-view>
+    <app-view class="g-form">
         <Form ref="formRef" class="g-form__container" @submit="formSubmit">
             <CellGroup inset>
-                <Field v-model="formData.Amount" label="充值金额" placeholder="请填写充值金额" :rules="formRules.Amount"/>
+                <Field v-model="formData.Amount" label="充值金额" placeholder="请填写充值金额" :rules="formRules.Amount" />
                 <Field label="凭证">
                     <template #input>
-                        <Uploader v-model="fileList" name="fileList" :max-size="5*1024*1024" @oversize="onOversize" max-count="1" :after-read="afterRead" :rules="formRules.fileList"/>
+                        <Uploader v-model="fileList" name="fileList" :max-size="5 * 1024 * 1024" @oversize="onOversize"
+                            max-count="1" :after-read="afterRead" :rules="formRules.fileList" />
                     </template>
                 </Field>
             </CellGroup>
         </Form>
         <template #footer>
-            <Button round block type="primary" @click="formRef?.submit()">确定</Button>
+            <div class="g-form__footer">
+                <Button round block type="primary" @click="formRef?.submit()">确定</Button>
+            </div>
         </template>
     </app-view>
 </template>
@@ -27,7 +30,7 @@ import { getServiceUrl } from '@/services/http';
 
 const formRef = ref<FormInstance>()
 const { formData, onSubmit, extendInfo } = doDeposit()
-const {router}=useNavigation()
+const { router } = useNavigation()
 
 /// 证件正面地址
 const fileList = ref([]);

+ 8 - 6
src/packages/mobile/views/bank/wallet/components/withdraw/index.vue

@@ -1,9 +1,9 @@
 <template>
-    <app-view>
-        <Form ref="formRef"  class="g-form__container" @submit="formSubmit">
+    <app-view class="g-form">
+        <Form ref="formRef" class="g-form__container" @submit="formSubmit">
             <CellGroup inset>
-                <Field label="提现金额" v-model="formData.Amount" placeholder="请填写提现金额" :rules="formRules.Amount"/>
-                <Field label="开户银行" >
+                <Field label="提现金额" v-model="formData.Amount" placeholder="请填写提现金额" :rules="formRules.Amount" />
+                <Field label="开户银行">
                     <template #input>
                         {{ sign.bankname }}
                     </template>
@@ -26,7 +26,9 @@
             </CellGroup>
         </Form>
         <template #footer>
-            <Button round block type="primary" @click="formRef?.submit()">确定</Button>
+            <div class="g-form__footer">
+                <Button round block type="primary" @click="formRef?.submit()">确定</Button>
+            </div>
         </template>
     </app-view>
 </template>
@@ -39,7 +41,7 @@ import { fullloading, dialog } from '@/utils/vant'
 import { useNavigation } from '@/hooks/navigation'
 
 const { formData, onSubmit, sign } = doWithdraw()
-const {router}=useNavigation()
+const { router } = useNavigation()
 const formRef = shallowRef<FormInstance>()
 
 // 表单验证规则

+ 1 - 1
src/packages/mobile/views/bank/wallet/index.less

@@ -1,4 +1,4 @@
-.account-bank {
+.bank-wallet {
     .van-tabs {
         display       : flex;
         flex-direction: column;

+ 13 - 8
src/packages/mobile/views/credit/lottery/index.vue

@@ -56,15 +56,20 @@ const { creditConfig, userAccount, creditList, redEnvelope, formSubmit, formRefr
 const showReward = shallowRef(false) // 显示抽奖红包
 
 const onSubmit = () => {
-    //showReward.value = true
-    fullloading((hideLoading) => {
-        formSubmit().then(() => {
-            hideLoading()
-            showReward.value = true
-        }).catch(() => {
-            Toast.fail('抽奖失败')
+    const { curscore = 0 } = userAccount.value
+    const { parma1 = 0 } = creditConfig.value
+    if (curscore < parma1) {
+        Toast.fail('可用积分不足')
+    } else {
+        fullloading((hideLoading) => {
+            formSubmit().then(() => {
+                hideLoading()
+                showReward.value = true
+            }).catch(() => {
+                Toast.fail('抽奖失败')
+            })
         })
-    })
+    }
 }
 
 formRefresh()

+ 2 - 2
src/packages/mobile/views/news/details/index.vue

@@ -9,7 +9,7 @@
                 <span>{{ details.author }}</span>
                 <span>{{ details.creaedate }}</span>
             </h4>
-            <p v-html="formatText(details.context)"></p>
+            <p v-html="formatHtmlString(details.context)"></p>
         </section>
     </app-view>
 </template>
@@ -17,7 +17,7 @@
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
 import { useNavigation } from '@/hooks/navigation'
-import { formatText } from '@/filters'
+import { formatHtmlString } from '@/filters'
 
 const { route } = useNavigation()
 const params = route.params.details

+ 1 - 1
src/packages/mobile/views/user/login/index.vue

@@ -67,7 +67,7 @@ const formSubmit = () => {
       }).catch((err) => {
         Toast.fail(err)
       })
-    })
+    }, '登录中...')
   } else {
     Toast('请先同意使用条款')
   }