-
zhangwei
2024-09-10 38130802e3fd55080f518f4128ef20ddfdd907c3
src/pages/enterprise/enterprise.vue
@@ -5,10 +5,9 @@
            <up-form-item label="营业执照" prop="businessLicense" required ref="item1">
               <fui-upload immediate :url="`${apiBaseUrl}/api/UpFile/UpBizLicense`" ref="uploadB" max='1'
                  background='#fff' @success="success" @error="error" @complete="complete" width="300"
                  height="150">
                  <image
                     :src="enterpriseInfo.businessLicense?enterpriseInfo.businessLicense:'/static/enterprise.png'"
                     mode="widthFix" style="width: 300rpx;height: 150rpx;"></image>
                  :sizeType='sizeType' height="150">
                  <image src="/static/enterprise.png" mode="widthFix" style="width: 300rpx;height: 150rpx;">
                  </image>
               </fui-upload>
               <!-- <template #right>
                  <up-icon name="arrow-right"></up-icon>
@@ -59,6 +58,7 @@
      onShow,
      onReady
   } from "@dcloudio/uni-app";
   let sizeType = ['compressed']
   let rules = {
      businessLicense: {
         required: true,
@@ -113,8 +113,26 @@
      $util,
      $db
   } = getCurrentInstance().appContext.config.globalProperties
   let uploadB = ref()
   onLoad(() => {
      let data = JSON.parse($db.get('userInfo')).userCompany
      const userToken = $db.get("userToken");
      if (!userToken) {
         uni.showToast({
            title: '请先登录!',
            icon: 'none',
            duration: 1000,
            complete: function() {
               setTimeout(function() {
                     uni.hideToast();
                     uni.navigateTo({
                        url: '/pages/login/index'
                     });
                  },
                  1000);
            }
         });
      }
      let data = $db.get('userInfo') ? JSON.parse($db.get('userInfo')).userCompany : null
      if (data) {
         enterpriseInfo.businessLicense = data.businessLicense
         enterpriseInfo.suppliername = data.suppliername //企业名称
@@ -132,6 +150,10 @@
   const formRef = ref(null);
   onReady(() => {
      formRef.value.setRules(rules);
      if(enterpriseInfo.businessLicense){
         uploadB.value.urls = [enterpriseInfo.businessLicense]
         uploadB.value.status = ['success']
      }
   })
   onMounted(() => {
      formRef.value.setRules(rules);