Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant-assemble
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 ec14b4a9
authored
Jun 12, 2023
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
发现
1 parent
633346a7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
152 additions
and
173 deletions
api/busassistantApi/BusassistantApi.js
package-lock.json
package.json
packagesList/packageDiscovery/pages/videoDetail/videoDetail.js
packagesList/packageDiscovery/pages/videoDetail/videoDetail.wxml
pages/tab/discovery/discovery.js
project.config.json
api/busassistantApi/BusassistantApi.js
View file @
ec14b4a
...
@@ -2,34 +2,43 @@ import api from "~/utils/request/request";
...
@@ -2,34 +2,43 @@ import api from "~/utils/request/request";
const
path
=
"scrm.api.stoassistant"
;
const
path
=
"scrm.api.stoassistant"
;
class
BusassistantApi
{
class
BusassistantApi
{
// 获取小程序首页数据列表
// 获取小程序首页数据列表
getDiscoverList
(
data
)
{
getDiscoverList
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.api.busassistant.discover.weapp.list'
,
method
:
'scrm.api.busassistant.discover.weapp.list'
,
...
data
...
data
},
},
true
true
)
)
}
}
// 获取特色产品内容详情
// 获取特色产品内容详情
getDiscoverDetail
(
data
)
{
getDiscoverDetail
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.api.busassistant.discover.content.detail'
,
method
:
'scrm.api.busassistant.discover.content.detail'
,
...
data
...
data
},
},
true
true
)
)
}
}
// 获取案例视频、操作指引详情
// 获取案例视频、操作指引详情
getDetailWithLike
(
data
)
{
getDetailWithLike
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
'scrm.api.busassistant.discover.content.detailWithLike'
,
method
:
'scrm.api.busassistant.discover.content.detailWithLike'
,
...
data
...
data
},
},
true
true
)
)
}
// 获取一级菜单下所在类别所有数据
getContentList
(
data
)
{
return
api
.
post
({
method
:
'scrm.api.busassistant.discover.weapp.contentList'
,
...
data
},
true
)
}
}
}
}
...
...
package-lock.json
View file @
ec14b4a
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
"integrity"
:
"sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
"integrity"
:
"sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
},
},
"glsx-applet-component"
:
{
"glsx-applet-component"
:
{
"version"
:
"1.1.1
1
"
,
"version"
:
"1.1.1
3
"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.1
1
.tgz"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.1
3
.tgz"
,
"integrity"
:
"sha512-
Gu70TYByO1q+4ZiOR/aRJOdajgSJSnJTgeggjKDb1GUNVgPgb/iS9sGwyeAImBqGe++76Ws5LxLoegiixTzl4w
=="
"integrity"
:
"sha512-
erZj/7TIXcckvf2h+Mlr5rMt6YHQLUq9LysgkgbbYA/u6OCVY6pQcT70HBl0WwsoFT4CMbPZ+4gqUKWOP2RocA
=="
}
}
}
}
}
}
package.json
View file @
ec14b4a
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"main"
:
"app.js"
,
"main"
:
"app.js"
,
"dependencies"
:
{
"dependencies"
:
{
"@vant/weapp"
:
"^1.10.7"
,
"@vant/weapp"
:
"^1.10.7"
,
"glsx-applet-component"
:
"^1.1.1
1
"
"glsx-applet-component"
:
"^1.1.1
3
"
},
},
"devDependencies"
:
{},
"devDependencies"
:
{},
"scripts"
:
{
"scripts"
:
{
...
...
packagesList/packageDiscovery/pages/videoDetail/videoDetail.js
View file @
ec14b4a
// packagesList/pages/videoDetal/videoDetal.js
import
{
// packagesList/pages/videoDetal/videoDetal.js
IMG_URL
}
from
"~/utils/constantData.js"
;
// import { senceData, productData } from "../constant/senceData";
import
{
senceData
,
productData
}
from
"~/pages/tab/discovery/constant/senceData"
;
// 导入方法
import
{
import
{
behavior
as
computedBehavior
IMG_URL
}
from
"~/utils/lib/miniprogram-computed"
;
}
from
"~/utils/constantData.js"
;
import
utils
from
'~/utils/util.js'
// import { senceData, productData } from "../constant/senceData";
import
BusassistantApi
from
"~/api/busassistantApi/index"
;
import
{
senceData
,
productData
}
from
"~/pages/tab/discovery/constant/senceData"
;
// 导入方法
import
{
behavior
as
computedBehavior
}
from
"~/utils/lib/miniprogram-computed"
;
import
utils
from
'~/utils/util.js'
import
busassistantApi
from
"~/api/busassistantApi/index"
;
Page
({
Page
({
noPageAuth
:
true
,
noPageAuth
:
true
,
/**
/**
...
@@ -21,75 +22,54 @@ Page({
...
@@ -21,75 +22,54 @@ Page({
data
:
{
data
:
{
// senceData,
// senceData,
// productData,
// productData,
hasProduct
:
true
,
// videoItem: {
// index: 0,
// videoList: [],
// videoUrl: '',
// isShare: false,//是否是被分享出去
// tabsActive: 1
// },
isShare
:
false
,
hasVideo
:
true
,
videoObj
:
{},
videoData
:
{},
videoData
:
{},
videoId
:
''
,
videoId
:
''
,
videoItem
:
{
showAuth
:
false
,
index
:
0
,
sceneCode
:
''
videoList
:
[],
videoUrl
:
''
,
isShare
:
false
,
//是否是被分享出去
tabsActive
:
1
},
videoObj
:
{},
showAuth
:
false
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
async
onLoad
(
options
)
{
async
onLoad
(
options
)
{
// wx.$router.getData(res => {
// this.setData({
// videoItem: res
// })
// })
// if (!utils.isEmptyObj(options)) {
// let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
// let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
// let videoList = []
// let videoUrl = ''
// let videoObj = {}
// if (tabsActive == '3') {
// videoList = item?.operationVideoList
// videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
// videoObj = item?.operationVideoList[videoIndex]
// }else{
// videoList = item?.videoList,
// videoUrl = item.videoList[videoIndex]?.videoUrl
// videoObj = item?.videoList[videoIndex]
// }
// let videoItem = {
// index: videoIndex,
// videoList: videoList,
// videoUrl: videoUrl,
// tabsActive: tabsActive
// }
// this.setData({
// videoItem: videoItem,
// isShare: isShare,
// videoObj: videoObj,
// leftMenuIndex: leftMenuIndex
// })
// this.shareDataFn(options)
// }
if
(
utils
.
isEmptyObj
(
options
))
return
if
(
utils
.
isEmptyObj
(
options
))
return
const
{
const
{
id
,
typeId
,
isDigitalCase
,
tabsActive
,
isShare
}
=
options
;
id
,
let
videoLikeList
=
[];
isShare
}
=
options
;
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
if
(
!
videoData
||
videoData
?.
status
==
2
)
{
videoLikeList
=
videoData
.
likeList
this
.
setData
({
isLoadding
:
false
,
if
(
isDigitalCase
==
'true'
)
{
hasProduct
:
false
// 调接口获取当前一级菜单下所有视频
})
videoLikeList
=
await
this
.
getVideoLikeList
(
typeId
,
tabsActive
);
return
this
.
setData
({
isDigitalCase
:
true
})
}
if
(
!
videoData
||
videoData
?.
status
==
2
)
{
this
.
setData
({
isLoadding
:
false
,
hasVideo
:
false
})
return
}
}
this
.
setData
({
this
.
setData
({
videoData
,
videoData
,
videoId
:
id
,
videoLikeList
,
isShare
videoId
:
id
,
isLoadding
:
false
,
typeId
,
isShare
,
tabsActive
});
});
this
.
setpagesTitle
(
videoData
.
proName
)
this
.
setpagesTitle
(
videoData
.
proName
)
this
.
changeShareData
()
this
.
changeShareData
()
...
@@ -97,118 +77,111 @@ Page({
...
@@ -97,118 +77,111 @@ Page({
//接受跳转的路由参数(小程序页面跳转)
//接受跳转的路由参数(小程序页面跳转)
async
onRoute
(
options
)
{
async
onRoute
(
options
)
{
if
(
!
options
||
utils
.
isEmptyObj
(
options
)
||
options
.
isShare
)
return
if
(
!
options
||
utils
.
isEmptyObj
(
options
)
||
options
.
isShare
)
return
// let { scenIndex, videoList, index, leftMenuIndex = 0 } = options
let
{
id
,
typeId
,
sceneCode
,
tabsActive
}
=
options
;
// options.videoIndex = index
let
videoLikeList
=
[];
// options.tabActive = scenIndex
// this.setData({
// videoObj: videoList[index],
// leftMenuIndex: leftMenuIndex
// })
let
{
id
,
sceneCode
}
=
options
;
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
if
(
!
videoData
||
videoData
?.
status
==
2
)
{
videoLikeList
=
videoData
.
likeList
this
.
setData
({
isLoadding
:
false
,
// 判断是不是在数字化转型案例菜单下
hasProduct
:
false
if
(
!
sceneCode
)
{
})
// 调接口获取当前一级菜单下所有视频
return
videoLikeList
=
await
this
.
getVideoLikeList
(
typeId
,
tabsActive
);
this
.
setData
({
isDigitalCase
:
true
})
}
if
(
!
videoData
||
videoData
?.
status
==
2
)
{
this
.
setData
({
isLoadding
:
false
,
hasVideo
:
false
})
return
}
}
this
.
setData
({
this
.
setData
({
videoData
,
videoData
,
isLoadding
:
false
,
videoLikeList
,
videoId
:
id
,
isLoadding
:
false
,
sceneCode
videoId
:
id
,
typeId
,
tabsActive
});
});
this
.
setpagesTitle
(
videoData
.
proName
)
this
.
setpagesTitle
(
videoData
.
proName
)
this
.
changeShareData
()
this
.
changeShareData
()
},
},
// 分享数据函数
// 获取视频详情
getDetailWithLike
(
id
)
{
// 获取视频详情
getDetailWithLike
(
id
)
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
_data
;
let
_data
;
BusassistantApi
.
getDetailWithLike
({
busassistantApi
.
getDetailWithLike
({
id
}).
then
((
res
)
=>
{
id
console
.
log
(
res
);
}).
then
((
res
)
=>
{
_data
=
res
.
data
;
_data
=
res
.
data
;
resolve
(
_data
);
resolve
(
_data
);
});
});
});
});
},
},
shareDataFn
(
options
)
{
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
tabActive
,
videoIndex
,
tabsActive
}
=
options
this
.
setData
({
tabsActive
,
tabActive
:
tabActive
,
videoIndex
:
videoIndex
,
},
()
=>
{
this
.
changeShareData
(
options
)
});
},
changeShareData
()
{
changeShareData
()
{
let
{
let
{
title
}
=
this
.
data
.
videoData
title
let
{
sceneCode
,
videoId
,
isDigitalCase
,
typeId
,
tabsActive
}
=
this
.
data
}
=
this
.
data
.
videoData
let
{
sceneCode
,
videoId
}
=
this
.
data
// // 设置转发标题
// // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo");
// let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName;
// let name = userInfoObj.merchantName;
this
.
shareTitle
=
`给您分享一个
${
title
}
视频`
;
let
{
proName
}
=
this
.
data
.
videoData
this
.
shareTitle
=
`给您分享一个
${
proName
}
视频`
;
//分享的数据
//分享的数据
// let senceItem = productData[tabActive][leftMenuIndex]
// let senceItem = productData[tabActive][leftMenuIndex]
this
.
shareQuery
=
`sceneCode=
${
sceneCode
}
&isShare=
${
true
}
&id=
${
videoId
}
`
this
.
shareQuery
=
`sceneCode=
${
sceneCode
}
&isShare=
${
true
}
&id=
${
videoId
}
&isDigitalCase=
${
isDigitalCase
}
&typeId=
${
typeId
}
&tabsActive=
${
tabsActive
}
`
this
.
shareAppMessage
=
{
this
.
shareAppMessage
=
{
title
:
t
itle
,
title
:
this
.
shareT
itle
,
path
:
`/
${
this
.
route
}
?
${
this
.
shareQuery
}
`
,
path
:
`/
${
this
.
route
}
?
${
this
.
shareQuery
}
`
,
query
:
this
.
shareQuery
query
:
this
.
shareQuery
}
}
},
},
// 切换视频
// 切换视频
async
chooseVideo
(
e
)
{
async
chooseVideo
(
e
)
{
const
{
const
{
title
,
id
}
=
e
.
detail
proName
,
id
}
=
e
.
detail
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
let
videoData
=
await
this
.
getDetailWithLike
(
id
);
this
.
setData
({
this
.
setData
({
videoId
:
id
,
videoId
:
id
,
videoData
videoData
})
})
this
.
setpagesTitle
(
proName
)
this
.
setpagesTitle
(
videoData
.
proName
)
this
.
changeShareData
()
this
.
changeShareData
()
},
},
// 获取一级菜单下所有视频
getVideoLikeList
(
id
,
type
)
{
return
new
Promise
((
resolve
)
=>
{
let
_data
;
let
params
=
{
menuId
:
id
,
// 内容专区(1:特色产品,2:案例视频,3:营销海报,4:操作指引,5:banner)
type
:
type
==
1
?
2
:
4
}
console
.
log
(
params
);
busassistantApi
.
getContentList
(
params
).
then
((
res
)
=>
{
console
.
log
(
res
);
_data
=
res
.
data
;
resolve
(
_data
);
});
});
},
// 下载视频
// 下载视频
downVideo
()
{
downVideo
()
{
const
_this
=
this
const
_this
=
this
// let { videoObj } = this.data
// let { videoObj } = this.data
// let url = videoObj.videoUrl
// let url = videoObj.videoUrl
let
{
let
{
videoId
}
=
this
.
data
videoId
const
{
vedioUrl
}
=
this
.
data
.
videoLikeList
.
find
(
item
=>
item
.
id
==
videoId
)
}
=
this
.
data
const
{
vedioUrl
}
=
this
.
data
.
videoData
.
likeList
.
find
(
item
=>
item
.
id
==
videoId
)
wx
.
getSetting
({
wx
.
getSetting
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
===
false
)
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
===
false
)
{
_this
.
setData
({
_this
.
setData
({
showAuth
:
true
showAuth
:
true
})
})
}
else
{
}
else
{
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
wx
.
downloadFile
({
url
:
vedioUrl
,
url
:
vedioUrl
,
...
@@ -221,9 +194,7 @@ Page({
...
@@ -221,9 +194,7 @@ Page({
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
$api
.
showToast
(
'下载成功!'
)
},
2000
)
},
2000
)
},
},
fail
({
fail
({
errMsg
})
{
errMsg
})
{
_this
.
setData
({
_this
.
setData
({
showAuth
:
errMsg
==
"saveVideoToPhotosAlbum:fail auth deny"
,
showAuth
:
errMsg
==
"saveVideoToPhotosAlbum:fail auth deny"
,
})
})
...
@@ -248,7 +219,7 @@ Page({
...
@@ -248,7 +219,7 @@ Page({
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady
()
{},
onReady
()
{
},
//设置标题
//设置标题
setpagesTitle
(
title
)
{
setpagesTitle
(
title
)
{
//设置标题
//设置标题
...
@@ -257,12 +228,11 @@ Page({
...
@@ -257,12 +228,11 @@ Page({
},
100
)
},
100
)
},
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
()
{
onShow
()
{
this
.
data
.
videoData
.
proName
&&
this
.
setpagesTitle
(
this
.
data
.
videoData
.
proName
)
},
},
/**
/**
...
@@ -298,7 +268,7 @@ Page({
...
@@ -298,7 +268,7 @@ Page({
*/
*/
onShareAppMessage
()
{
onShareAppMessage
()
{
return
{
return
{
...
this
.
shareAppMessage
...
this
.
shareAppMessage
}
}
}
}
})
})
\ No newline at end of file
\ No newline at end of file
packagesList/packageDiscovery/pages/videoDetail/videoDetail.wxml
View file @
ec14b4a
<!--packagesList/pages/videoDetal/videoDetal.wxml-->
<!--packagesList/pages/videoDetal/videoDetal.wxml-->
<!-- <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> -->
<!-- <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> -->
<block wx:if="{{!has
Product
}}">
<block wx:if="{{!has
Video
}}">
<no-product></no-product>
<no-product></no-product>
</block>
</block>
<block wx:else>
<block wx:else>
<gl-video-detail list="{{videoData
}}" bind:chooseVideo="chooseVideo"></gl-video-detail>
<gl-video-detail list="{{videoData}}" likeList="{{videoLikeList
}}" bind:chooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 -->
<!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
...
...
pages/tab/discovery/discovery.js
View file @
ec14b4a
This diff is collapsed.
Click to expand it.
project.config.json
View file @
ec14b4a
{
{
"appid"
:
"wx
c50d04ae5aa9984a
"
,
"appid"
:
"wx
96c8f2a3e76907cb
"
,
"projectname"
:
"business-assistant"
,
"projectname"
:
"business-assistant"
,
"compileType"
:
"miniprogram"
,
"compileType"
:
"miniprogram"
,
"packOptions"
:
{
"packOptions"
:
{
...
...
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