Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
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 dc6cb58b
authored
Oct 22, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:分享标题添加
1 parent
e9fa0528
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
91 deletions
pages/checkProduct/checkProduct.js
pages/tab/index/index.wxml
utils/constantData.js
pages/checkProduct/checkProduct.js
View file @
dc6cb58
// pages/checkProduct/checkProduct.js
// pages/checkProduct/checkProduct.js
// const navStyle = "background-color: transparent;";
// const navStyle = "background-color: transparent;";
const
navStyle
=
"background-color: #fff"
;
const
navStyle
=
"background-color: #fff"
;
import
{
import
{
senceData
}
from
"~/pages/tab/index/constant/data"
;
senceData
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
}
from
"~/pages/tab/index/constant/data"
;
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
import
Draw
from
"~/utils/Draw.js"
;
import
Draw
from
"~/utils/Draw.js"
;
import
{
import
{
createQrCodeApi
,
sceneByIdApi
}
from
"~/api/checkProduct.js"
;
createQrCodeApi
,
sceneByIdApi
}
from
"~/api/checkProduct.js"
;
import
utils
from
"~/utils/util.js"
;
import
utils
from
"~/utils/util.js"
;
Page
({
Page
({
...
@@ -26,18 +19,19 @@ Page({
...
@@ -26,18 +19,19 @@ Page({
// 模态框
// 模态框
isShow
:
true
,
isShow
:
true
,
// IMG_URL: `${IMG_URL}index`,
// IMG_URL: `${IMG_URL}index`,
btnList
:
[{
btnList
:
[
src
:
`
${
IMG_URL
}
index/wechat.png`
,
{
name
:
"微信转发"
,
src
:
`
${
IMG_URL
}
index/wechat.png`
,
},
name
:
"微信转发"
,
// {
},
// src: `${IMG_URL}index/moments.png`,
// {
// name: "朋友圈分享",
// src: `${IMG_URL}index/moments.png`,
// },
// name: "朋友圈分享",
{
// },
src
:
`
${
IMG_URL
}
index/down.png`
,
{
name
:
"下载为海报"
,
src
:
`
${
IMG_URL
}
index/down.png`
,
},
name
:
"下载为海报"
,
},
],
],
// 4种场景下图片所有的高 (单位 rpx)
// 4种场景下图片所有的高 (单位 rpx)
imgHeightArr
:
[
imgHeightArr
:
[
...
@@ -52,8 +46,8 @@ Page({
...
@@ -52,8 +46,8 @@ Page({
isShare
:
false
,
isShare
:
false
,
// 是否授权昵称
// 是否授权昵称
hasUserInfo
:
false
,
hasUserInfo
:
false
,
phone
:
''
,
//授权手机号
phone
:
""
,
//授权手机号
userInfo
:
''
userInfo
:
""
,
},
},
observers
:
{
observers
:
{
actNum
:
function
(
actNum
)
{
actNum
:
function
(
actNum
)
{
...
@@ -77,10 +71,7 @@ Page({
...
@@ -77,10 +71,7 @@ Page({
},
},
// navbar高度设置
// navbar高度设置
navbarReady
(
e
)
{
navbarReady
(
e
)
{
let
{
let
{
height
,
statusBarHeight
}
=
e
.
detail
;
height
,
statusBarHeight
}
=
e
.
detail
;
this
.
setData
({
this
.
setData
({
headerHeight
:
height
/
2
+
statusBarHeight
,
headerHeight
:
height
/
2
+
statusBarHeight
,
// headerHeight: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight,
...
@@ -111,23 +102,29 @@ Page({
...
@@ -111,23 +102,29 @@ Page({
actNum
,
actNum
,
activeNavIdx
,
activeNavIdx
,
apiData
,
apiData
,
outshowVideo
outshowVideo
,
// origin //跳转来源 home
// origin //跳转来源 home
}
=
options
;
}
=
options
;
// if(actNum&&activeNavIdx)return
// if(actNum&&activeNavIdx)return
// 设置标题
this
.
shareTitle
=
`~给你分享一个
${
senceData
[
actNum
]?.
productList
[
activeNavIdx
].
proName
}
`;
this.setData({
this.setData({
actNum,
actNum,
activeNavIdx,
activeNavIdx,
apiData,
apiData,
outshowVideo
outshowVideo
,
// origin
// origin
// isShare
// isShare
});
});
let apiDataJson = JSON.stringify(apiData);
let apiDataJson = JSON.stringify(apiData);
let item = apiData[actNum]?.productList[activeNavIdx];
let item = apiData[actNum]?.productList[activeNavIdx];
this
.
shareQuery
=
`sceneCode=
${
apiData
[
actNum
].
sceneCode
}
&productCode=
${
item
?.
productCode
this.shareQuery = `
sceneCode
=
$
{
apiData
[
actNum
].
sceneCode
}
&
productCode
=
$
{
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
item
?.
productCode
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
apiData
=
$
{
apiDataJson
}
`;
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
apiData
=
$
{
apiDataJson
}
`;
this.shareTrackData = {
this.shareTrackData = {
sceneCode: apiData[actNum]?.sceneCode,
sceneCode: apiData[actNum]?.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
...
@@ -141,9 +138,7 @@ Page({
...
@@ -141,9 +138,7 @@ Page({
},
},
// 分享按钮
// 分享按钮
handleClick(e) {
handleClick(e) {
let {
let { index } = e.currentTarget.dataset;
index
} = e.currentTarget.dataset;
switch (index) {
switch (index) {
case 0:
case 0:
this.wechatFn();
this.wechatFn();
...
@@ -160,11 +155,7 @@ Page({
...
@@ -160,11 +155,7 @@ Page({
},
},
// 下载海报
// 下载海报
async download() {
async download() {
let {
let { actNum, activeNavIdx, imgHeightArr } = this.data;
actNum,
activeNavIdx,
imgHeightArr
} = this.data;
let wx_user_info = wx.$storage.get("wx_user_info");
let wx_user_info = wx.$storage.get("wx_user_info");
// console.log('wx_user_info: ', wx_user_info.appId);
// console.log('wx_user_info: ', wx_user_info.appId);
let params = {
let params = {
...
@@ -195,8 +186,9 @@ Page({
...
@@ -195,8 +186,9 @@ Page({
let _this = this;
let _this = this;
wx.getImageInfo({
wx.getImageInfo({
src: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${actNum + 1
src: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
}.
png
`,
actNum
+
1
}.
png
`,
success: async () => {
success: async () => {
// // console.log("imgAllHeight: ", imgAllHeight);
// // console.log("imgAllHeight: ", imgAllHeight);
// let drawFun = new Draw({
// let drawFun = new Draw({
...
@@ -227,25 +219,27 @@ Page({
...
@@ -227,25 +219,27 @@ Page({
// ];
// ];
let
arr
=
[
456
,
222
,
0
,
496
];
let
arr
=
[
456
,
222
,
0
,
496
];
let
imgList
=
[{
let
imgList
=
[
x
:
0
,
{
y
:
0
,
x
:
0
,
width
:
_this
.
data
.
imgWidth
,
y
:
0
,
height
:
_this
.
data
.
imgHeight
,
width
:
_this
.
data
.
imgWidth
,
url
:
`https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic
${
actNum
+
1
height
:
_this
.
data
.
imgHeight
,
url
:
`https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic
${
actNum
+
1
}.
png
`,
}.
png
`,
},
},
{
{
// x: 245 * 2,
// x: 245 * 2,
// y: erCodeHeight + 30,
// y: erCodeHeight + 30,
// width: 120 * 2,
// width: 120 * 2,
// height: 120 * 2,
// height: 120 * 2,
x: _this.data.imgWidth - 64,
x: _this.data.imgWidth - 64,
y: _this.data.imgHeight - arr[actNum] - 64,
y: _this.data.imgHeight - arr[actNum] - 64,
width: 64,
width: 64,
height: 64,
height: 64,
url: res.data, //二维码
url: res.data, //二维码
},
},
];
];
// console.log(imgList)
// console.log(imgList)
let posterUrl = await drawFun.begin({
let posterUrl = await drawFun.begin({
...
@@ -295,14 +289,28 @@ Page({
...
@@ -295,14 +289,28 @@ Page({
phone: res.phone,
phone: res.phone,
});
});
});
});
//储存手机号
wx.$storage.set("authphone", phone);
},
},
/**
/**
* 生命周期函数--监听页面加载 (扫码,分享链接)
* 生命周期函数--监听页面加载 (扫码,分享链接)
*/
*/
async onLoad(options) {
async onLoad(options) {
// 有手机号就不用再一次授权昵称,手机号
let phone = wx.$storage.get("authphone");
if (phone) {
this.setData({
origin: "",
});
}
console.log("分享options12255565: ", options);
console.log("分享options12255565: ", options);
// actNum,activeNavIdx isShare
// actNum,activeNavIdx isShare
if (!options || utils.isEmptyObj(options)) return;
if (!options || utils.isEmptyObj(options)) return;
this.analysisOption();
},
// 解析二维码回调
async analysisOption() {
// 解析二维码参数
// 解析二维码参数
if (options.scene) {
if (options.scene) {
this.setData({
this.setData({
...
@@ -313,11 +321,7 @@ Page({
...
@@ -313,11 +321,7 @@ Page({
}
}
// 扫码进来
// 扫码进来
let {
let { actNum, activeNavIdx, isShare } = options;
actNum,
activeNavIdx,
isShare
} = options;
if (isShare == "true") {
if (isShare == "true") {
this.setData({
this.setData({
isShow: false,
isShow: false,
...
@@ -332,14 +336,16 @@ Page({
...
@@ -332,14 +336,16 @@ Page({
actNum,
actNum,
activeNavIdx,
activeNavIdx,
isShare: true,
isShare: true,
outshowVideo:false, //显示视频列表
outshowVideo:
false, //显示视频列表
});
});
// 发请求
// 发请求
let senceItem = senceData[actNum];
let senceItem = senceData[actNum];
let item = senceData[actNum]?.productList[activeNavIdx];
let item = senceData[actNum]?.productList[activeNavIdx];
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
item
?.
productCode
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`;
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`;
this.shareTrackData = {
this.shareTrackData = {
sceneCode: senceItem?.sceneCode,
sceneCode: senceItem?.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
...
@@ -350,11 +356,12 @@ Page({
...
@@ -350,11 +356,12 @@ Page({
// activeNavIdx,
// activeNavIdx,
};
};
},
},
// 解析扫码进来参数
// 解析扫码进来参数
async analysisQRcode(str) {
async analysisQRcode(str) {
let id = str.split("%3D")[1];
let id = str.split("%3D")[1];
let res = await sceneByIdApi({
let res = await sceneByIdApi({
id
id
,
});
});
// console.log('res: ', res);
// console.log('res: ', res);
return res;
return res;
...
@@ -372,17 +379,17 @@ Page({
...
@@ -372,17 +379,17 @@ Page({
// console.log('res: ', res.userInfo.nickName);
// console.log('res: ', res.userInfo.nickName);
// userInfo.nickName
// userInfo.nickName
this.setData({
this.setData({
userInfo: res.userInfo
userInfo: res.userInfo
,
})
})
;
let wx_user_info = wx.$storage.get(
'wx_user_info')
let wx_user_info = wx.$storage.get(
"wx_user_info");
// console.log('wx_user_info: ', wx_user_info);
// console.log('wx_user_info: ', wx_user_info);
let obj ={
let obj =
{
...wx_user_info,
...wx_user_info,
nickName:res.userInfo.nickName,
nickName:
res.userInfo.nickName,
avatarUrl:res.userInfo.avatarUrl,
avatarUrl:
res.userInfo.avatarUrl,
}
}
;
// console.log('obj',obj)
// console.log('obj',obj)
wx.$storage.set(
'wx_user_info', obj)
wx.$storage.set(
"wx_user_info", obj);
// this.onLoad(null);
// this.onLoad(null);
},
},
});
});
...
@@ -391,40 +398,40 @@ Page({
...
@@ -391,40 +398,40 @@ Page({
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady() {
},
onReady() {},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow(options) {
},
onShow(options) {},
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
*/
*/
onHide() {
},
onHide() {},
/**
/**
* 生命周期函数--监听页面卸载
* 生命周期函数--监听页面卸载
*/
*/
onUnload() {
},
onUnload() {},
/**
/**
* 页面相关事件处理函数--监听用户下拉动作
* 页面相关事件处理函数--监听用户下拉动作
*/
*/
onPullDownRefresh() {
},
onPullDownRefresh() {},
/**
/**
* 页面上拉触底事件的处理函数
* 页面上拉触底事件的处理函数
*/
*/
onReachBottom() {
},
onReachBottom() {},
/**
/**
* 用户点击右上角分享
* 用户点击右上角分享
*/
*/
onShareAppMessage() {
},
onShareAppMessage() {},
/**
/**
* 浏览埋点
* 浏览埋点
*/
*/
onShareTimeline() {
},
onShareTimeline() {},
onViewTrack: true,
onViewTrack: true,
});
\ No newline at end of file
\ No newline at end of file
});
pages/tab/index/index.wxml
View file @
dc6cb58
...
@@ -131,8 +131,8 @@
...
@@ -131,8 +131,8 @@
<view class="dialog-box">
<view class="dialog-box">
<form bindsubmit="submit">
<form bindsubmit="submit">
<view class="dialog-header">
<view class="dialog-header">
<view wx:if="{{isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view wx:if="{{
!
isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view wx:if="{{
!
isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<view wx:if="{{isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
</view>
<view class="dialog-content">
<view class="dialog-content">
...
...
utils/constantData.js
View file @
dc6cb58
...
@@ -13,5 +13,6 @@ export const STORAGE_OBJECTkEY = {
...
@@ -13,5 +13,6 @@ export const STORAGE_OBJECTkEY = {
auto_login_object
:
'auto_login_object'
,
auto_login_object
:
'auto_login_object'
,
wx_user_info
:
'wx_user_info'
,
wx_user_info
:
'wx_user_info'
,
userPhone
:
'userPhone'
,
userPhone
:
'userPhone'
,
firstLogin
:
'firstLogin'
firstLogin
:
'firstLogin'
,
authphone
:
'authphone'
}
}
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