Browse Source

fix:品牌认证查询bug修复

朱波 1 year ago
parent
commit
ae0191f9ee
3 changed files with 53 additions and 35 deletions
  1. 5 5
      project.config.json
  2. 14 0
      project.private.config.json
  3. 34 30
      src/pages/AuthResult/index.tsx

+ 5 - 5
project.config.json

@@ -7,9 +7,9 @@
         "urlCheck": false,
         "es6": false,
         "enhance": false,
-        "postcss": false,
+        "postcss": true,
         "preloadBackgroundData": false,
-        "minified": false,
+        "minified": true,
         "newFeature": true,
         "coverView": true,
         "nodeModules": false,
@@ -36,15 +36,15 @@
         "userConfirmedBundleSwitch": false,
         "packNpmManually": false,
         "packNpmRelationList": [],
-        "minifyWXSS": false,
+        "minifyWXSS": true,
         "lazyloadPlaceholderEnable": false,
         "useStaticServer": true,
         "showES6CompileOption": false,
         "disableUseStrict": false,
         "useCompilerPlugins": false,
-        "minifyWXML": false,
+        "minifyWXML": true,
         "condition": false,
-        "ignoreUploadUnusedFiles": false
+        "ignoreUploadUnusedFiles": true
     },
     "compileType": "miniprogram",
     "simulatorType": "wechat",

+ 14 - 0
project.private.config.json

@@ -7,6 +7,20 @@
     "condition": {
         "miniprogram": {
             "list": [
+                {
+                    "name": "",
+                    "pathName": "pages/AuthOpra/index",
+                    "query": "type=1&No=GT&__key_=16995003228282",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/AuthResult/index",
+                    "query": "result=%257B%2522website%2522%253A%252291410702MA9KWXC96R%2522%252C%2522address%2522%253A%2522%25E6%25B2%25B3%25E5%258D%2597%25E7%259C%2581%252C%25E6%2596%25B0%25E4%25B9%25A1%25E5%25B8%2582%252C%25E7%25BA%25A2%25E6%2597%2597%25E5%258C%25BA%2522%252C%2522filePath%2522%253A%2522https%253A%252F%252Fcdn.crm.luojigou.vip%252FFhbOhaIW0ZQCpH2TX1r_0IPZ8Vej%2522%252C%2522detailAddress%2522%253A%2522%25E6%25B2%25B3%25E5%258D%2597%25E7%259C%2581%25E6%2596%25B0%25E4%25B9%25A1%25E5%25B8%2582%25E7%25BA%25A2%25E6%2597%2597%25E5%258C%25BA%2520%25E4%25BC%259F%25E4%25B8%259A%25E5%258F%258C%25E5%25AD%2590%25E5%25BA%25A7%25E5%258C%2597%25E5%25A1%2594%25E4%25BA%2594%25E5%25B1%2582%252F%25E6%25B2%25B3%25E5%258D%2597%25E8%25B5%25A2%25E6%259C%25AA%25E6%259D%25A5%25E6%2596%2587%25E5%258C%2596%25E6%2595%2599%25E8%2582%25B2%2522%252C%2522company%2522%253A%2522%25E6%25B2%25B3%25E5%258D%2597%25E8%25B5%25A2%25E6%259C%25AA%25E6%259D%25A5%25E6%2596%2587%25E5%258C%2596%25E4%25BC%25A0%25E5%25AA%2592%25E6%259C%2589%25E9%2599%2590%25E5%2585%25AC%25E5%258F%25B8%2522%252C%2522startTime%2522%253A%25222023%25E5%25B9%25B401%25E6%259C%258801%25E6%2597%25A5%2522%252C%2522faren%2522%253A%2522%25E7%258E%258B%25E6%2599%2593%25E5%25A8%259F%2522%252C%2522endTime%2522%253A%25222023%25E5%25B9%25B412%25E6%259C%258831%25E6%2597%25A5%2522%252C%2522No%2522%253A%2522GT20230101001%2522%257D&__key_=16995002936973",
+                    "launchMode": "default",
+                    "scene": null
+                },
                 {
                     "name": "pages/AuthOpra/index",
                     "pathName": "pages/AuthOpra/index",

+ 34 - 30
src/pages/AuthResult/index.tsx

@@ -26,36 +26,36 @@ const imgUrl = require('@/assets/AuthResult/zhengshu.jpg')
 // }
 
 const AuthResult: React.FC = () => {
-    
+
     const [ result, setResult ] = useState<Record<string, any>>({})
 
     const [ canvasUrl, setCanvasUrl ] = useState<string>('')
-    
-    useEffect(() => { 
-      const _result = JSON.parse(decodeURIComponent(Taro.getCurrentInstance().router?.params.result as string)) 
+
+    useEffect(() => {
+      const _result = JSON.parse(decodeURIComponent(Taro.getCurrentInstance().router?.params.result as string))
       setResult(_result)
       console.log(_result, 'result');
-      
+
     // eslint-disable-next-line react-hooks/exhaustive-deps
     }, [])
 
     Taro.useReady( () => {
 
         setTimeout(() => {
- 
+
         Tip.loading('生成证书中')
         const query = Taro.createSelectorQuery()
         query.select('#myCanvas')
           .fields({ node: true, size: true })
           .exec((res) => {
-            console.log(res, 'resresres');
-            
+            console.log(res, 'resresres', result);
+
             const width = res[0].width;     // 获取canvas的最终宽度与高度
 
             const height = res[0].height;
 
-            const canvas = res[0].node 
-            
+            const canvas = res[0].node
+
             setTimeout(() => {
 
                 const ctx = canvas.getContext('2d')
@@ -63,18 +63,18 @@ const AuthResult: React.FC = () => {
                 const dpr = Taro.getSystemInfoSync().pixelRatio;  // 获取设备的像素比
 
                 console.log(dpr, 'dpr');
-                
+
                 canvas.width = width * dpr;
                 canvas.height = height * dpr;
-    
+
                 ctx.scale(dpr, dpr);
-    
+
                 const bgImg = canvas.createImage()
-                
+
                 bgImg.src = imgUrl
 
                 bgImg.onload = () => {
-                    
+
                     ctx.drawImage( bgImg, 0, 0, width ,  height);
 
                     // 证书编号
@@ -89,34 +89,38 @@ const AuthResult: React.FC = () => {
 
                     ctx.fillStyle = "greey";
 
+                  console.log(result,'result')
+
                     const title: string = result.company
 
+                  console.log(title,'title')
+
                     const titleX = 307 / 2 - (9.6 * title.length / 2 )
 
                     ctx.fillText( title, titleX, 118);
 
                     // 统一社会信用代码
-                        
+
                     ctx.font = " 600 " + "4px" + " PingFangSC-Semibold, PingFang SC";
 
                     ctx.fillStyle = "#666";  // canvas 文字颜色
-                    
+
                     ctx.fillText( result.website, 123, 128);  // canvas 文字
 
                     // 法人
                     ctx.font = " 600 " + "4px" + "PingFangSC-Semibold, PingFang SC";
                     ctx.fillStyle = "#666";
                     ctx.fillText( result.faren, 190, 128);
-                    
+
 
                     // 注册地址
                     ctx.font = " 600 " + "4px" + "PingFangSC-Semibold, PingFang SC";
-                    ctx.fillStyle = "#666";  
+                    ctx.fillStyle = "#666";
                     ctx.fillText( result.address.split(',').join('') + result.detailAddress, 110, 136);
 
                     // 地区
                     ctx.font = " 600 " + "4px" + " PingFangSC-Semibold, PingFang SC";
-                    ctx.fillStyle = "#666";  
+                    ctx.fillStyle = "#666";
                     ctx.fillText( result.address.split(',').join('') , 146, 144);
 
                     // 起始年
@@ -126,20 +130,20 @@ const AuthResult: React.FC = () => {
 
                     // 结束年
                     ctx.font = " 600 " + "4px" + " PingFangSC-Semibold, PingFang SC";
-                    ctx.fillStyle = "#666";  
+                    ctx.fillStyle = "#666";
                     ctx.fillText( result.endTime, 178, 151);
-      
+
                     setCanvasUrl(canvas.toDataURL())
                     Tip.loaded()
-                } 
+                }
             }, 1000);
           })
-        }, 0);
+        }, 5);
     })
 
     const openImagePriview = (url) => {
         console.log(url, 'url');
-        
+
         Taro.previewImage({
             current: url,
             urls: [url]
@@ -149,7 +153,7 @@ const AuthResult: React.FC = () => {
 
     return (
         <View className='AuthResult'>
-            <NavBar 
+            <NavBar
               icon={<AtIcon value='chevron-left' size='30rpx' color='#fff'  />}
               title=''
               fixed
@@ -175,7 +179,7 @@ const AuthResult: React.FC = () => {
                      <Image className='chapter' src={require('../../assets/AuthResult/chapter.png')} />
                     </View>
                 }
-               
+
             </View>
 
             {/* 证书 */}
@@ -184,9 +188,9 @@ const AuthResult: React.FC = () => {
                     <Image className='dog' src={require('../../assets/AuthResult/dog.png')} />
                     <Text>中德智慧教育官方授权品牌认证证书</Text>
                 </View>
-                <Canvas 
-                  type='2d' 
-                  id='myCanvas' 
+                <Canvas
+                  type='2d'
+                  id='myCanvas'
                   style={{width: '307px', height: '214px', marginTop: '11px'}}
                   onClick={()=> openImagePriview(canvasUrl)}
                 />