Browse Source

feat: h5;

h5
Fox-33 1 day ago
parent
commit
7ad9d1e3fb
5 changed files with 59 additions and 42 deletions
  1. +6
    -6
      config.js
  2. +1
    -1
      index.html
  3. +2
    -2
      pages.json
  4. +46
    -31
      pages/report/index.vue
  5. +4
    -2
      pages/report/progressCircle.vue

+ 6
- 6
config.js View File

@ -17,7 +17,7 @@ const config = {
baseUrl : 'http://augcl.natapp1.cc/assessment-admin/assessment',
},
prod : {
baseUrl : 'https://assessment.augcl.com/assessment-admin/assessment',
baseUrl : 'https://admin.kjetax.com/assessment-admin/assessment',
}
}
@ -26,17 +26,17 @@ const config = {
const defaultConfig = {
mapKey : 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU',
aliOss: {
url: 'https://image.hhlm1688.com/',
url: 'https://image.kjetax.com/',
config: {
//桶的地址
region: 'oss-cn-guangzhou',
//id
accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
accessKeyId: 'LTAI5tSfSyNKzrvkyCn3Tmon',
//密钥
accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
accessKeySecret: '5Tax04eUSHBlYiDpCTBR5YsTwtPf2B',
//桶的名字
bucket: 'hanhaiimage',
endpoint: 'oss-cn-shenzhen.aliyuncs.com',
bucket: 'risk-assessment',
endpoint: 'oss-cn-guangzhou.aliyuncs.com',
}
},
}


+ 1
- 1
index.html View File

@ -9,7 +9,7 @@
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<title>报告保存&分享</title>
<!--preload-links-->
<!--app-context-->
</head>


+ 2
- 2
pages.json View File

@ -3,7 +3,7 @@
{
"path": "pages/report/index",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "报告保存&分享",
"navigationStyle": "custom"
}
}
@ -16,7 +16,7 @@
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "报告",
"navigationBarTitleText": "报告保存&分享",
"navigationBarBackgroundColor": "#014FA2",
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom"


+ 46
- 31
pages/report/index.vue View File

@ -32,7 +32,7 @@
<view class="table">
<!-- 全部合规 -->
<template v-if="detail.level3Num === detail.levelAllNum">
<img class="img-succ" style="display: block;" :src="configList.compliance_img" crossorigin=anonymous />
<img ref="succ" class="img-succ" style="display: block;" :src="configList.compliance_img" crossorigin=anonymous />
</template>
<template v-else>
<reportTableView :list="tableList"></reportTableView>
@ -41,23 +41,18 @@
</view>
</view>
<view class="flex flex-column contact">
<view class="flex flex-column contact" v-if="configList.company_qrcode">
<view>扫下方二维码联系我们给你1V1解决方案</view>
<img class="qr" style="display: block;" :src="configList.company_qrcode" crossorigin=anonymous />
<img ref="qr" class="qr" style="display: block;" :src="configList.company_qrcode" crossorigin=anonymous />
</view>
<view>
<img class="img" style="display: block;" :src="configList.company_info" crossorigin=anonymous />
<view class="logo">
<img class="img" style="display: block;" :src="configList.company_logo" crossorigin=anonymous />
<img v-if="configList.company_info" ref="info" class="img" style="display: block;" :src="configList.company_info" crossorigin=anonymous />
<view class="logo" v-if="configList.company_logo">
<img ref="logo" class="img" style="display: block;" :src="configList.company_logo" crossorigin=anonymous />
</view>
</view>
</template>
<!-- <view class="bottom" data-html2canvas-ignore="true">
<button class="btn" @click="onDownload">长按图片保存到手机</button>
</view> -->
</view>
</template>
@ -75,6 +70,7 @@
},
data() {
return {
batchNo: null,
detail: null,
tableList: [],
canvas: null,
@ -95,8 +91,22 @@
const { batchNo, token } = arg
token && uni.setStorageSync('token', token)
await this.getData(batchNo)
this.batchNo = batchNo
},
async mounted() {
console.log('mounted', this.batchNo)
await this.getData(this.batchNo)
let fetchs = [
{ ref: 'qr', url: this.configList.company_qrcode },
{ ref: 'info', url: this.configList.company_info },
{ ref: 'logo', url: this.configList.company_logo },
{ ref: 'succ', url: this.configList.compliance_img },
].map(item => {
return this.preLoadImage(item.ref, item.url)
})
await Promise.all(fetchs)
setTimeout(async () => {
await this.createImage()
@ -109,7 +119,7 @@
showCancel: false,
confirmText: '知道了'
})
}, 800)
}, 1000)
},
methods: {
async getData(batchNo) {
@ -167,6 +177,28 @@
}
},
async preLoadImage(ref, url) {
return new Promise((resolve) => {
console.log(ref, url)
if (!this.$refs[ref] || !url) {
resolve()
return
}
uni.downloadFile({
url,
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功');
this.$refs[ref].src = res.tempFilePath
resolve()
}
},
fail: (err) => {
resolve()
}
});
})
},
async createImage() {
console.log('createImage')
const node = document.querySelector('.export')
@ -181,23 +213,6 @@
});
},
onDownload() {
if (!this.tempFilePath) {
uni.showToast({
title: '图片还未生成完成',
icon: 'none'
})
return
}
// H5
uni.showModal({
title: '保存图片',
content: '请长按上方图片,选择"保存图片"即可保存到手机',
showCancel: false,
confirmText: '知道了'
})
},
},
}
</script>


+ 4
- 2
pages/report/progressCircle.vue View File

@ -1,7 +1,7 @@
<template>
<view class="flex progress_box" :style="style">
<view>{{ label || '' }}</view>
<canvas
<canvas ref="canvas"
class="progress_bar"
:canvas-id="`cpbar${code}`"
:id="`cpbar${code}`"
@ -46,9 +46,11 @@
methods: {
drawProgress(color) {
const clientWidth = this.$refs.canvas.$el.clientWidth
const ctx = uni.createCanvasContext(`cpbar${this.code}`)
let Ratio = 1 / 2
let Ratio = clientWidth / 126
let w = 14 * Ratio
ctx.setLineWidth(w); //
ctx.setStrokeStyle(color); //


Loading…
Cancel
Save