Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 22528b4f
authored
Nov 23, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化图片
1 parent
af923572
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
13 deletions
app.js
pages/tab/index/index.js
pages/tab/index/index.wxml
pages/template/company/company.wxml
utils/util.js
app.js
View file @
22528b4
...
@@ -29,6 +29,9 @@ App({
...
@@ -29,6 +29,9 @@ App({
wx
.
$router
=
router
wx
.
$router
=
router
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
wx
.
imageCanvas
=
wx
.
createOffscreenCanvas
({
type
:
'2d'
})
const
systemInfo
=
wx
.
$storage
.
get
(
'aicard_system_info'
)
const
systemInfo
=
wx
.
$storage
.
get
(
'aicard_system_info'
)
if
(
!
systemInfo
)
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
wx
.
getSystemInfo
({
...
...
pages/tab/index/index.js
View file @
22528b4
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* @Author: huyue
* @Author: huyue
* @Date: 2022-08-30 11:26:21
* @Date: 2022-08-30 11:26:21
* @LastEditors: huyue
* @LastEditors: huyue
* @LastEditTime: 2022-1
0-28 10:51:40
* @LastEditTime: 2022-1
1-23 15:21:05
*/
*/
// pages/tab/index/index.js
// pages/tab/index/index.js
import
{
menuMixin
}
from
"../../../mixins/index"
;
import
{
menuMixin
}
from
"../../../mixins/index"
;
...
@@ -11,6 +11,7 @@ import Draw from "../../../utils/Draw";
...
@@ -11,6 +11,7 @@ import Draw from "../../../utils/Draw";
import
{
ssoApi
,
entmicroApi
}
from
"../../../api/api"
;
import
{
ssoApi
,
entmicroApi
}
from
"../../../api/api"
;
import
util
from
"../../../utils/util"
;
import
util
from
"../../../utils/util"
;
import
{
trackData
}
from
"../../../utils/data"
;
import
{
trackData
}
from
"../../../utils/data"
;
Page
({
Page
({
behaviors
:
[
menuMixin
],
behaviors
:
[
menuMixin
],
/**
/**
...
@@ -59,14 +60,27 @@ Page({
...
@@ -59,14 +60,27 @@ Page({
image
:
'https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg'
,
image
:
'https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg'
,
qrCode
:
'https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg'
qrCode
:
'https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg'
},
},
banner
:
[
'company-img3
.png'
,
'company-img31.png
'
],
banner
:
[
'company-img3
'
,
'company-img31
'
],
current
:
0
,
current
:
0
,
clueList
:
[
'clue-img2.webp'
,
'clue-img3.webp'
,
'clue-img4.webp'
,
'clue-img5.webp'
,
'clue-img6.webp'
,
'clue-img7.webp'
,
'clue-img8.webp'
,
'clue-img9.webp'
,
'clue-img10.webp'
,
'clue-img11.webp'
,
'clue-img12.webp'
,
'clue-img13.webp'
],
clueList
:
[
'clue-img2.webp'
,
'clue-img3.webp'
,
'clue-img4.webp'
,
'clue-img5.webp'
,
'clue-img6.webp'
,
'clue-img7.webp'
,
'clue-img8.webp'
,
'clue-img9.webp'
,
'clue-img10.webp'
,
'clue-img11.webp'
,
'clue-img12.webp'
,
'clue-img13.webp'
],
clueCurrent
:
0
,
clueCurrent
:
0
,
awardBanner
:
[{
src
:
'company-img7.png'
,
name
:
'组织荣誉'
},
{
src
:
'company-img71.png'
,
name
:
'行业奖项'
}],
awardBanner
:
[{
src
:
'company-img7.png'
,
name
:
'组织荣誉'
},
{
src
:
'company-img71.png'
,
name
:
'行业奖项'
}],
awardCurrent
:
0
,
awardCurrent
:
0
,
shareDisabled
:
true
,
shareDisabled
:
true
,
autoplay
:
true
autoplay
:
true
,
imageObj
:
{
'company-img1'
:
false
,
'bg1'
:
false
,
'bg2'
:
false
,
'company-img2'
:
false
,
'company-img3'
:
false
,
'company-img5'
:
false
,
'company-img6'
:
false
,
'company-img7'
:
false
,
'company-img21'
:
false
,
'company-img31'
:
false
,
'company-img71'
:
false
}
},
},
introduce
(
e
)
{
introduce
(
e
)
{
const
curTabIndex
=
e
.
currentTarget
.
dataset
.
index
;
const
curTabIndex
=
e
.
currentTarget
.
dataset
.
index
;
...
@@ -184,6 +198,8 @@ Page({
...
@@ -184,6 +198,8 @@ Page({
clueCurrent
:
clueCurrent
clueCurrent
:
clueCurrent
})
})
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
...
@@ -203,8 +219,30 @@ Page({
...
@@ -203,8 +219,30 @@ Page({
wx
.
hideShareMenu
({
wx
.
hideShareMenu
({
menus
:
[
'shareAppMessage'
]
menus
:
[
'shareAppMessage'
]
})
})
this
.
getImageList
()
},
// 获取原图
getImageList
()
{
const
_this
=
this
let
arr
=
Object
.
keys
(
this
.
data
.
imageObj
)
let
list
=
arr
.
map
(
async
(
item
)
=>
{
return
await
util
.
getImage
(
item
)
})
console
.
log
(
arr
)
Promise
.
allSettled
(
list
).
then
(
result
=>
{
console
.
log
(
result
)
result
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
status
==
'fulfilled'
)
{
console
.
log
(
index
)
const
name
=
`imageObj.
${
arr
[
index
]}
`
_this
.
setData
({
[
name
]:
true
})
console
.
log
(
name
,
this
.
data
.
imageObj
)
}
})
})
},
},
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
...
...
pages/tab/index/index.wxml
View file @
22528b4
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</view>
</view>
<!-- 公司介绍 -->
<!-- 公司介绍 -->
<block wx:if="{{curTabIndex === 0 }}">
<block wx:if="{{curTabIndex === 0 }}">
<template is="company" data="{{IMGURL, banner, current, img_version, awardBanner, awardCurrent, autoplay}}"></template>
<template is="company" data="{{IMGURL, banner, current, img_version, awardBanner, awardCurrent, autoplay
, imageObj
}}"></template>
</block>
</block>
<!-- 方案介绍 -->
<!-- 方案介绍 -->
<block wx:if="{{curTabIndex === 1 }}">
<block wx:if="{{curTabIndex === 1 }}">
...
...
pages/template/company/company.wxml
View file @
22528b4
<!-- 公司介绍 -->
<!-- 公司介绍 -->
<template name="company">
<template name="company">
<view>
<view>
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
company-img1
.png?v={{img_version}}"></image>
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
{{imageObj['company-img1'] ? 'company-img1' : 'compress-company-img1'}}
.png?v={{img_version}}"></image>
<!-- 合同客户 -->
<!-- 合同客户 -->
<view class="relative">
<view class="relative">
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
bg1
.png?v={{img_version}}"></image>
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
{{imageObj['bg1'] ? 'bg1' : 'compress-bg1'}}
.png?v={{img_version}}"></image>
<view class="box2">
<view class="box2">
<swiper class="swiper" autoplay="{{autoplay}}" duration="5000" interval="5000" circular>
<swiper class="swiper" autoplay="{{autoplay}}" duration="5000" interval="5000" circular>
<swiper-item class="swiper-item">
<swiper-item class="swiper-item">
<image class="box2-content" webp src="{{IMGURL}}image/company/
company-img2
.png?v={{img_version}}"></image>
<image class="box2-content" webp src="{{IMGURL}}image/company/
{{imageObj['company-img2'] ? 'company-img2' : 'compress-company-img2'}}
.png?v={{img_version}}"></image>
</swiper-item>
</swiper-item>
<swiper-item class="swiper-item">
<swiper-item class="swiper-item">
<image class="box2-content" webp src="{{IMGURL}}image/company/
company-img21
.png?v={{img_version}}"></image>
<image class="box2-content" webp src="{{IMGURL}}image/company/
{{imageObj['company-img21'] ? 'company-img21' : 'compress-company-img21'}}
.png?v={{img_version}}"></image>
</swiper-item>
</swiper-item>
</swiper>
</swiper>
</view>
</view>
</view>
</view>
<!-- 政府与行业资质 -->
<!-- 政府与行业资质 -->
<view class="relative">
<view class="relative">
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
bg2
.png?v={{img_version}}"></image>
<image mode="widthFix" class="img" webp src="{{IMGURL}}image/company/
{{imageObj['bg2'] ? 'bg2' : 'compress-bg2'}}
.png?v={{img_version}}"></image>
<view class="box3">
<view class="box3">
<swiper class="box3-swiper" autoplay="{{autoplay}}" bindchange="changePage" current="{{current}}" indicator-dots="{{false}}" indicator-color="#E6E7EB" indicator-active-color="#5850FF" interval="5000" circular>
<swiper class="box3-swiper" autoplay="{{autoplay}}" bindchange="changePage" current="{{current}}" indicator-dots="{{false}}" indicator-color="#E6E7EB" indicator-active-color="#5850FF" interval="5000" circular>
<block wx:for="{{banner}}" wx:key="ind">
<block wx:for="{{banner}}" wx:key="ind">
<swiper-item class="swiper-item">
<swiper-item class="swiper-item">
<image class="box3-img" webp src="{{IMGURL}}image/company/{{i
tem}}
?v={{img_version}}"></image>
<image class="box3-img" webp src="{{IMGURL}}image/company/{{i
mageObj[item] ? item : 'compress-' + item}}.png
?v={{img_version}}"></image>
</swiper-item>
</swiper-item>
</block>
</block>
</swiper>
</swiper>
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<!-- 荣誉及奖项 -->
<!-- 荣誉及奖项 -->
<view class="relative box5">
<view class="relative box5">
<image class="box5-title" webp src="{{IMGURL}}image/company/company-img6.png?v={{img_version}}"></image>
<image class="box5-title" webp src="{{IMGURL}}image/company/company-img6.png?v={{img_version}}"></image>
<swiper class="box5-swiper" autoplay bindchange="changeBanner" current="{{awardCurrent}}" indicator-dots="{{false}}" indicator-color="#E6E7EB" indicator-active-color="#5850FF" interval="5000" circular>
<swiper class="box5-swiper" autoplay
="{{autoplay}}"
bindchange="changeBanner" current="{{awardCurrent}}" indicator-dots="{{false}}" indicator-color="#E6E7EB" indicator-active-color="#5850FF" interval="5000" circular>
<block wx:for="{{awardBanner}}" wx:key="ind">
<block wx:for="{{awardBanner}}" wx:key="ind">
<swiper-item class="swiper-item">
<swiper-item class="swiper-item">
<image class="box5-content" webp src="{{IMGURL}}image/company/{{item.src}}?v={{img_version}}"></image>
<image class="box5-content" webp src="{{IMGURL}}image/company/{{item.src}}?v={{img_version}}"></image>
...
@@ -53,6 +53,6 @@
...
@@ -53,6 +53,6 @@
</view>
</view>
<!-- <image mode="widthFix" class="img" src="{{IMGURL}}image/company/company-img5.png?v={{img_version}}"></image> -->
<!-- <image mode="widthFix" class="img" src="{{IMGURL}}image/company/company-img5.png?v={{img_version}}"></image> -->
<image mode="widthFix" webp class="img" src="{{IMGURL}}image/company/
company-img5
.png?v={{img_version}}"></image>
<image mode="widthFix" webp class="img" src="{{IMGURL}}image/company/
{{imageObj['company-img5'] ? 'company-img5' : 'compress-company-img5'}}
.png?v={{img_version}}"></image>
</view>
</view>
</template>
</template>
\ No newline at end of file
\ No newline at end of file
utils/util.js
View file @
22528b4
...
@@ -251,6 +251,17 @@ const getSessionId = () => {
...
@@ -251,6 +251,17 @@ const getSessionId = () => {
const
setSessionId
=
sessionId
=>
{
const
setSessionId
=
sessionId
=>
{
wx
.
setStorageSync
(
'aicard_sessionId'
,
sessionId
)
wx
.
setStorageSync
(
'aicard_sessionId'
,
sessionId
)
}
}
/** 利用离屏画布获取原图 */
const
getImage
=
(
name
)
=>
{
console
.
log
(
name
)
// const imageContext = imageCanvas.getContext('2d')
const
image
=
wx
.
imageCanvas
.
createImage
()
new
Promise
(
resolve
=>
{
image
.
onload
=
resolve
(
true
)
image
.
src
=
`
${
wx
.
$imgUrl
}
image/company/
${
name
}
.png?v=
${
new
Date
()}
`
})
}
const
removeSystemStorage
=
()
=>
{
const
removeSystemStorage
=
()
=>
{
wx
.
removeStorageSync
(
'aicard_user_info'
)
wx
.
removeStorageSync
(
'aicard_user_info'
)
wx
.
removeStorageSync
(
'aicard_sessionId'
)
wx
.
removeStorageSync
(
'aicard_sessionId'
)
...
@@ -509,5 +520,6 @@ const Util = {
...
@@ -509,5 +520,6 @@ const Util = {
deepClone
,
deepClone
,
isEmptyObj
,
isEmptyObj
,
parseString
,
parseString
,
getImage
}
}
export
default
Util
export
default
Util
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment