Commit d6dff14e by 张立顺

Merge branch 'develop' of 192.168.3.233:saas_plus/business-assistant into develop

2 parents 0e97ecd0 a0ba21c7
import api from '~/utils/request/request' import api from '~/utils/request/request'
const { appId } = wx.getAccountInfoSync().miniProgram const {
appId
} = wx.getAccountInfoSync().miniProgram
const CODE = { const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT', platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3' productCode: 'PC00c3'
...@@ -7,20 +9,27 @@ const CODE = { ...@@ -7,20 +9,27 @@ const CODE = {
class UsersApi { class UsersApi {
/**调用后台接口获取用户信息js_code换取sessionId */ /**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() { async wxCodeLogin() {
const { code } = await this.getWxCode() const appEnter = wx.getEnterOptionsSync()
return await api.post( try {
{ if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
method: 'scrm.api.sso.wechat.applets.jscode.login', const {
appId,
code code
}, } = await this.getWxCode()
true return await api.post({
) method: 'scrm.api.sso.wechat.applets.jscode.login',
appId,
code
},
true
)
} catch (error) {
console.log(error)
return Promise.reject()
}
} }
/**退出登录 */ /**退出登录 */
logout() { logout() {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.logout' method: 'scrm.api.sso.wechat.applets.logout'
}, },
true true
...@@ -46,8 +55,7 @@ class UsersApi { ...@@ -46,8 +55,7 @@ class UsersApi {
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
detail.loginToken = loginToken detail.loginToken = loginToken
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.auth.phone', method: 'scrm.api.sso.wechat.applets.auth.phone',
...detail, ...detail,
platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
...@@ -58,8 +66,7 @@ class UsersApi { ...@@ -58,8 +66,7 @@ class UsersApi {
} }
/**账号密码登录 */ /**账号密码登录 */
async accountLogin(data = {}) { async accountLogin(data = {}) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.password.login', method: 'scrm.api.sso.wechat.applets.password.login',
...data, ...data,
...CODE ...CODE
...@@ -69,8 +76,7 @@ class UsersApi { ...@@ -69,8 +76,7 @@ class UsersApi {
} }
/** 手机号获取短信验证码 */ /** 手机号获取短信验证码 */
getSmsCode(mobile) { getSmsCode(mobile) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.sms.get.code', method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile mobile
}, },
...@@ -79,8 +85,7 @@ class UsersApi { ...@@ -79,8 +85,7 @@ class UsersApi {
} }
/** 手机号短信验证码登录 */ /** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) { phoneSmsLogin(data = {}) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.sms.login', method: 'scrm.api.sso.wechat.applets.sms.login',
...data, ...data,
source: 'MINIAPP', source: 'MINIAPP',
...@@ -91,8 +96,7 @@ class UsersApi { ...@@ -91,8 +96,7 @@ class UsersApi {
} }
/** 获取登录账号列表 */ /** 获取登录账号列表 */
getAccountList(sessionId) { getAccountList(sessionId) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.listSelectAccount', method: 'scrm.api.sso.wechat.applets.listSelectAccount',
...CODE, ...CODE,
sessionId sessionId
...@@ -103,8 +107,7 @@ class UsersApi { ...@@ -103,8 +107,7 @@ class UsersApi {
/** /**
* 选择账号登录(手机绑定多个账号时) */ * 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) { selectAccountLogin(data) {
return api.post( return api.post({
{
method: 'scrm.api.sso.wechat.applets.selectAccountLogin', method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
...CODE, ...CODE,
...data ...data
...@@ -114,8 +117,7 @@ class UsersApi { ...@@ -114,8 +117,7 @@ class UsersApi {
} }
/**检查sessionId 是否过期 */ /**检查sessionId 是否过期 */
checkSession() { checkSession() {
return api.post( return api.post({
{
method: 'scrm.api.sso.login.status.check' method: 'scrm.api.sso.login.status.check'
}, },
true true
...@@ -123,8 +125,7 @@ class UsersApi { ...@@ -123,8 +125,7 @@ class UsersApi {
} }
/** 超级管理员切换账号 */ /** 超级管理员切换账号 */
adminSelectLogin(data) { adminSelectLogin(data) {
return api.post( return api.post({
{
method: 'scrm.api.sso.super.administrator.select.login', method: 'scrm.api.sso.super.administrator.select.login',
...CODE, ...CODE,
...data ...data
...@@ -143,14 +144,13 @@ class UsersApi { ...@@ -143,14 +144,13 @@ class UsersApi {
/**获取微信用户信息 */ /**获取微信用户信息 */
async getWXUserInfo() { async getWXUserInfo() {
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)
if (!wx_user_info) { if (!wx_user_info) {
const data = await this.getUserProfile() const data = await this.getUserProfile()
wx.$storage.set('wx_user_info', data) wx.$storage.set('wx_user_info', data)
return data return data
} else return wx_user_info } else return wx_user_info
} }
/** 手机号授权解析(单纯解析内容返回前端) /** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid * 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号 * 传加密信息就解析手机号
*/ */
...@@ -169,4 +169,4 @@ class UsersApi { ...@@ -169,4 +169,4 @@ class UsersApi {
}) })
} }
} }
export default UsersApi export default UsersApi
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": {}, "usingComponents": {},
"navigationStyle": "custom" "navigationStyle": "custom",
"disableScroll": true
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
const navStyle = "background-color: #fff"; const navStyle = "background-color: #fff";
import { senceData } from "~/pages/tab/index/constant/data"; import { senceData } from "~/pages/tab/index/constant/data";
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import { productBysceneApi } from '~/api/index.js'
import Draw from "~/utils/Draw.js"; import Draw from "~/utils/Draw.js";
import { createQrCodeApi, sceneByIdApi } from "~/api/checkProduct.js"; import { createQrCodeApi, sceneByIdApi } from "~/api/checkProduct.js";
import utils from "~/utils/util.js"; import utils from "~/utils/util.js";
...@@ -17,7 +18,7 @@ Page({ ...@@ -17,7 +18,7 @@ Page({
headerHeight: 0, headerHeight: 0,
senceData, senceData,
// 模态框 // 模态框
isShow: true, isShow: false,
// IMG_URL: `${IMG_URL}index`, // IMG_URL: `${IMG_URL}index`,
btnList: [ btnList: [
{ {
...@@ -93,6 +94,45 @@ Page({ ...@@ -93,6 +94,45 @@ Page({
isShow: true, isShow: true,
}); });
}, },
//如果是直接查看页面,获取合成apiData
getData() {
console.log(123456)
// 看产品
productBysceneApi().then(res => {
let { code, data } = res
if (code == 0 && data) {
// this.setData({
// apiData: data
// })
this.compositionData(senceData, data)
// this.getFirstSenceIndex();
}
})
},
//接口数据,本地数据对接
compositionData(localData, apiData) {
localData.forEach((item, index) => {
apiData.forEach((inner, idx) => {
if (item.name == inner.stage) {
item.sceneStatus = inner.sceneStatus
item.productList.forEach((outChild, outIndex) => {
inner.productList.forEach((innerChild, innerIndex) => {
if (outChild.proName == innerChild.productName) {
outChild.productStatus = innerChild.productStatus
}
})
})
}
})
})
// console.log('localData, apiData: ', localData);
this.setData({
senceData: localData
})
},
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { onRoute(options) {
console.log("分享options: ", options); console.log("分享options: ", options);
...@@ -102,7 +142,7 @@ Page({ ...@@ -102,7 +142,7 @@ Page({
let { let {
actNum, actNum,
activeNavIdx, activeNavIdx,
apiData, // apiData,
outshowVideo, outshowVideo,
// origin //跳转来源 home // origin //跳转来源 home
} = options; } = options;
...@@ -110,24 +150,25 @@ Page({ ...@@ -110,24 +150,25 @@ Page({
// 设置标题 // 设置标题
this.shareTitle = `给你分享一个${senceData[actNum]?.productList[activeNavIdx].proName}~`; this.shareTitle = `给你分享一个${senceData[actNum]?.productList[activeNavIdx].proName}~`;
this.getImgInfo(actNum)
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 = senceData[actNum]?.productList[activeNavIdx];
this.shareQuery = `sceneCode=${apiData[actNum].sceneCode}&productCode=${ this.shareQuery = `sceneCode=${senceData[actNum].sceneCode}&productCode=${
item?.productCode item?.productCode
}&isShare=${true}&productDesc=${item?.productName}&category=${ }&isShare=${true}&productDesc=${item?.productName}&category=${
item?.category item?.category
}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&apiData=${apiDataJson}`; }&actNum=${actNum}&activeNavIdx=${activeNavIdx}`;
this.shareTrackData = { this.shareTrackData = {
sceneCode: apiData[actNum]?.sceneCode, sceneCode: senceData[actNum]?.sceneCode,
productCode: item?.productCode, productCode: item?.productCode,
productName: item?.productName, productName: item?.productName,
category: item?.category, category: item?.category,
...@@ -156,7 +197,7 @@ Page({ ...@@ -156,7 +197,7 @@ Page({
}, },
// 下载海报 // 下载海报
async download() { async download() {
let { actNum, activeNavIdx, imgHeightArr } = this.data; let { actNum, activeNavIdx, imgHeightArr ,imgPath} = 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 = {
...@@ -165,59 +206,22 @@ Page({ ...@@ -165,59 +206,22 @@ Page({
isShare: true, isShare: true,
}; };
console.log(' wx_user_info.appId', wx_user_info)
let res = await createQrCodeApi({ let res = await createQrCodeApi({
appId: wx_user_info.appId, appId: wx_user_info.appId,
// appId:'wx2c28337db96364d2', // appId:'wx2c28337db96364d2',
path: "pages/checkProduct/checkProduct", path: "pages/checkProduct/checkProduct",
scene: JSON.stringify(params), scene: JSON.stringify(params),
}); });
// console.log('res: ', res);
// let { actNum, imgHeightArr } = this.data;
//所有的长度
let imgAllHeight = imgHeightArr[actNum].reduce((total, current) => {
return total + current;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let erCodeHeight =
imgHeightArr[actNum].slice(0, 4).reduce((total, current) => {
return total + current;
}) +
98 * 2;
let _this = this; let _this = this;
wx.getImageInfo({ wx.getImageInfo({
src: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${ src: imgPath,
actNum + 1
}.png`,
success: async () => { success: async () => {
// // console.log("imgAllHeight: ", imgAllHeight);
// let drawFun = new Draw({
// width: 750,
// height: imgAllHeight,
// });
let drawFun = new Draw({ let drawFun = new Draw({
width: _this.data.imgWidth, width: _this.data.imgWidth,
height: _this.data.imgHeight, height: _this.data.imgHeight,
}); });
// let imgList = [
// {
// x: 0,
// y: 0,
// width: 750,
// height: imgAllHeight,
// url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
// actNum + 1
// }.png`,
// },
// {
// x: 245 * 2,
// y: erCodeHeight + 30,
// width: 120 * 2,
// height: 120 * 2,
// url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
// },
// ];
let arr = [456, 222, 0, 496]; let arr = [456, 222, 0, 496];
let imgList = [ let imgList = [
...@@ -269,16 +273,35 @@ Page({ ...@@ -269,16 +273,35 @@ Page({
// }, // },
// 图片加载事件 // 图片加载事件
onloadFn(event) { onloadFn(event) {
console.log("event.detail", event.detail); // console.log("event.detail", event.detail);
wx.hideLoading();
// this.setData({
// imgHeight: (event.detail.height * 0.2).toFixed(0),
// });
this.setData({ this.setData({
imgHeight: event.detail.height / 5, imgHeight: event.detail.height / 5,
imgWidth: event.detail.width / 5, imgWidth: event.detail.width / 5,
}); });
}, },
// 图片视频加载回调拿到url
getImgInfo(actNum){
wx.showLoading({
title: "加载中",
});
let _this = this;
wx.getImageInfo({
src: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum + 1
}.png`,
success: async (res) => {
console.log('res: ', res)
wx.hideLoading()
wx.nextTick(() => {
_this.setData({
isShow: true,
imgPath:res.path
})
})
}
})
},
// 分享获取懂得用户数 // 分享获取懂得用户数
authorizedFn(e) { authorizedFn(e) {
let res = e.detail; let res = e.detail;
...@@ -297,6 +320,7 @@ Page({ ...@@ -297,6 +320,7 @@ Page({
* 生命周期函数--监听页面加载 (扫码,分享链接) * 生命周期函数--监听页面加载 (扫码,分享链接)
*/ */
async onLoad(options) { async onLoad(options) {
this.getData()
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;
......
...@@ -58,7 +58,6 @@ Component({ ...@@ -58,7 +58,6 @@ Component({
activeNavIdx:this.data.wrapactiveNavIdx activeNavIdx:this.data.wrapactiveNavIdx
}) })
} }
console.log('outshowVideo', this.data.outshowVideo)
if(!this.data.outshowVideo){ if(!this.data.outshowVideo){
this.setData({ this.setData({
...@@ -77,7 +76,6 @@ Component({ ...@@ -77,7 +76,6 @@ Component({
}, },
observers: { observers: {
actNum: function (newval, oldval) { actNum: function (newval, oldval) {
console.log('newval, oldval: ', newval, oldval);
let navList; let navList;
let tab = [ let tab = [
"场景说明", "场景说明",
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
} }
.prod-wrap .nav-wrap .nav { .prod-wrap .nav-wrap .nav {
display: inline-block; display: inline-block;
width: 188rpx;
height: 64rpx; height: 64rpx;
border-radius: 12rpx; border-radius: 12rpx;
font-weight: 600; font-weight: 600;
...@@ -31,6 +30,7 @@ ...@@ -31,6 +30,7 @@
background: #ffffff; background: #ffffff;
border: 2rpx solid #dde3f0; border: 2rpx solid #dde3f0;
color: #323436; color: #323436;
padding: 0 16rpx;
} }
.prod-wrap .nav-wrap .active-nav { .prod-wrap .nav-wrap .active-nav {
color: #ffffff; color: #ffffff;
...@@ -44,9 +44,8 @@ ...@@ -44,9 +44,8 @@
} }
.prod-item { .prod-item {
padding-bottom: 32rpx; padding: 0 32rpx 32rpx;
margin: 16rpx auto 0; margin: 16rpx auto 0;
width: 343px;
background-color: #f5f7fb; background-color: #f5f7fb;
border-radius: 48rpx 48rpx 0 0; border-radius: 48rpx 48rpx 0 0;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</view> </view>
</view> </view>
</view> </view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" origin="home" apiData="{{apiData}}" bindsharehandle="sharehandle" /> <product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" origin="home" bindsharehandle="sharehandle" />
</view> </view>
<!-- 看线索内容 --> <!-- 看线索内容 -->
<view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false"> <view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false">
......
...@@ -52,7 +52,7 @@ class Share { ...@@ -52,7 +52,7 @@ class Share {
if (sharePath) path = `/${sharePath}` if (sharePath) path = `/${sharePath}`
path += that.setCommonShareQuery() path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}` if (shareQuery) path += `&${shareQuery}`
console.log('::', path) console.log('===============', path)
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}` if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun() if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData) if (shareTrackData) that.reportShareData(shareTrackData)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!