Commit 2635dadb by 前端

Merge branch 'huyue_v3.3.0' into 'v3.3.0'

Huyue v3.3.0

See merge request !13
2 parents f9877dbe 18aefbaf
Showing 236 changed files with 1775 additions and 2686 deletions
.svn/
\ No newline at end of file \ No newline at end of file
.svn/
project.config.json
project.private.config.json
sitemap.json
miniprogram_npm
node_modules
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-09 15:17:35
*/
import api from './request' import api from './request'
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import wechatApi from './wechatApi' import wechatApi from './wechatApi'
import entmicroApi from './entmicroApi' import entmicroApi from './entmicroApi'
const common = 'scrm.api.carlife.common.'
module.exports = { module.exports = {
ssoApi, ssoApi,
entmicroApi, entmicroApi,
wechatApi, wechatApi,
commonApi: { commonApi: {
/**上传图片
*/
uploadImg(data) {
return api.post({
method: `${common}uploadImg`,
...data,
noSignAttr: ['file']
})
},
/**视频上传
*/
uploadVideo(data) {
return api.post({
method: `${common}uploadVideo`,
...data,
noSignAttr: ['file']
})
},
// /**根据sceneId 查参数 */
// getSceneById(data) {
// return api.post('dj.api.smartcarlife.common.getSceneById', data)
// },
/** 首页、发现列表 搜索接口 */
search(data) {
return api.post({
method: 'scrm.api.carlife.weapp.homeSearch.search',
pageSize: 10,
...data
})
},
/** 根据sap编码获取商户详情 */
getBySapCode(data) {
return api.post({
method: `scrm.api.carlife.merchant.getBySapCode`,
...data,
}, true)
},
/**获取图片版本号 */ /**获取图片版本号 */
getMockConfig() { getMockConfig() {
return api.getMock() return api.getMock()
......
import api from "./request";
const serverApi = {
//生成二维码
createQrCode: "scrm.api.wechat.miniprogram.createQrcode",
// 解析二维码参数
sceneById:'scrm.api.wechat.get.scene.by.id'
};
export const createQrCodeApi = (data) => {
return api.post(
{
method: serverApi.createQrCode,
...data,
},
true
);
};
export const sceneByIdApi = (data) => {
return api.post(
{
method: serverApi.sceneById,
...data,
}
);
};
\ No newline at end of file \ No newline at end of file
import api from "./request"; import api from "./request";
module.exports = { module.exports = {
// 智能名片详情 // 智能名片详情
getCardDetail(data) { getCardDetail(data) {
return api.post( return api.post({
{
method: `entmicro.api.business.card.cardDetail`, method: `entmicro.api.business.card.cardDetail`,
...data, ...data,
}, },
...@@ -16,6 +15,48 @@ module.exports = { ...@@ -16,6 +15,48 @@ module.exports = {
return api.post({ return api.post({
method: `entmicro.api.business.card.activity.apply`, method: `entmicro.api.business.card.activity.apply`,
...data, ...data,
},true) }, true)
},
// 检查登录用户是否是滴加智慧云员工
checkPhone(data) {
return api.post({
method: `entmicro.api.business.activityRecord.checkPhone`,
...data,
}, true)
},
// 获取活动记录全集
getActivityRecord(data) {
return api.post({
method: `entmicro.api.business.activityRecord.list`,
...data
}, true)
},
// 根据id查询
getActivityDetail(data) {
return api.post({
method: `entmicro.api.business.activityRecord.detail`,
...data
})
},
//获取活动配置
getActiveApi(data) {
return api.post({
method: 'scrm.api.busassistant.activity.getActivityUrl',
...data
},
true
)
},
// 是否显示门店助手、生意助手按钮
checkCooperate(data) {
return api.post({
method: 'entmicro.api.business.activityRecord.checkCooperate',
...data
})
} }
}
\ No newline at end of file \ No newline at end of file
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-09 13:59:57
*/
const target = ["ip", "dev", "uat", "beta", "prod"]; const target = ["ip", "dev", "uat", "beta", "prod"];
/** /**
* *
...@@ -7,7 +14,7 @@ const target = ["ip", "dev", "uat", "beta", "prod"]; ...@@ -7,7 +14,7 @@ const target = ["ip", "dev", "uat", "beta", "prod"];
3预发布 3预发布
4生产 4生产
*/ */
const index = 4; const index = 2;
const secretKey = { const secretKey = {
ip: {}, ip: {},
dev: { dev: {
...@@ -48,6 +55,7 @@ const pathEnum = { ...@@ -48,6 +55,7 @@ const pathEnum = {
sso: "/rop-scrm-sso/", sso: "/rop-scrm-sso/",
wechat: "/rop-scrm-wechat/", wechat: "/rop-scrm-wechat/",
business: "/rop-scrm-entmicro/", business: "/rop-scrm-entmicro/",
busassistant: '/rop-scrm-busassistant/'
}; };
module.exports = { module.exports = {
index, index,
......
...@@ -53,7 +53,7 @@ class Request { ...@@ -53,7 +53,7 @@ class Request {
if (!wx.$authStatus) { if (!wx.$authStatus) {
if (INTERRUPT) return if (INTERRUPT) return
INTERRUPT = true INTERRUPT = true
wx.showLoading() // wx.showLoading()
getApp().login().then(() => { getApp().login().then(() => {
if (thisPage.init && thisPage.data.userInfo) thisPage.init() if (thisPage.init && thisPage.data.userInfo) thisPage.init()
if (thisPage.loginCallBack && thisPage.data.userInfo) thisPage.loginCallBack(thisPage.data.userInfo) if (thisPage.loginCallBack && thisPage.data.userInfo) thisPage.loginCallBack(thisPage.data.userInfo)
...@@ -79,7 +79,7 @@ class Request { ...@@ -79,7 +79,7 @@ class Request {
} }
}, },
fail(error) { fail(error) {
wx.hideLoading() // wx.hideLoading()
wx.showToast({ wx.showToast({
title: '系统异常', title: '系统异常',
icon: 'error' icon: 'error'
......
...@@ -13,7 +13,7 @@ import util from './utils/util.js' ...@@ -13,7 +13,7 @@ import util from './utils/util.js'
import './utils/Track' import './utils/Track'
import { ssoApi, wechatApi } from './api/api' import { ssoApi, wechatApi } from './api/api'
import { trackData } from './utils/data' import { trackData } from './utils/data'
import eventbus from './utils/evenbus' // import eventbus from './utils/evenbus'
// 实例化对象存储 // 实例化对象存储
import { Storage } from './utils/cache/storage' import { Storage } from './utils/cache/storage'
const $Storage = new Storage() const $Storage = new Storage()
...@@ -24,11 +24,12 @@ App({ ...@@ -24,11 +24,12 @@ App({
/**挂载到wx对象 */ /**挂载到wx对象 */
this.autoUpdate() this.autoUpdate()
wx.$storage = $Storage /** 挂载全局缓存方法 */ wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$eventbus = eventbus // wx.$eventbus = eventbus
wx.$util = util wx.$util = util
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
this.clearFileSystem()
const systemInfo = wx.$storage.get('aicard_system_info') const systemInfo = wx.$storage.get('aicard_system_info')
if (!systemInfo) if (!systemInfo)
wx.getSystemInfo({ wx.getSystemInfo({
...@@ -39,8 +40,10 @@ App({ ...@@ -39,8 +40,10 @@ App({
if (options.path != 'pages/tab/index/index') { if (options.path != 'pages/tab/index/index') {
this.login() this.login()
} }
// wx.showMeasure = false
wx.showMeasure = !!(options.query && options.query.scene) wx.showMeasure = !!(options.query && options.query.scene)
wx.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
}, },
login(returnResponse) { login(returnResponse) {
let _this = this let _this = this
...@@ -59,7 +62,6 @@ App({ ...@@ -59,7 +62,6 @@ App({
wx.$storage.set('aicard_info', wechatInfo) wx.$storage.set('aicard_info', wechatInfo)
wx.$authStatus = res.code != 0 wx.$authStatus = res.code != 0
openId = wechatInfo.openId openId = wechatInfo.openId
console.log(wx.$trackData)
wx.showMeasure = !!wx.$trackData.scene wx.showMeasure = !!wx.$trackData.scene
if (wx.$trackData.scene) { if (wx.$trackData.scene) {
// 初次进入小程序默认埋首页 // 初次进入小程序默认埋首页
...@@ -72,10 +74,8 @@ App({ ...@@ -72,10 +74,8 @@ App({
cardId: res.cardId cardId: res.cardId
}) })
_this.getUserInfo(openId, returnResponse).then(result => { _this.getUserInfo(openId, returnResponse).then(result => {
wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
resolve(result) resolve(result)
}) })
}) })
} else { } else {
// 其他的分享进来的页面走这里,在进页面的onshow中需对wx.$trackData先赋值 // 其他的分享进来的页面走这里,在进页面的onshow中需对wx.$trackData先赋值
...@@ -85,7 +85,7 @@ App({ ...@@ -85,7 +85,7 @@ App({
case 'SHARE_HOME': case 'SHARE_HOME':
// 名片分享在这里设置埋点 // 名片分享在这里设置埋点
wx.$storage.set('scene', wx.$trackData) wx.$storage.set('scene', wx.$trackData)
wx.$Track.sendTrack(trackData.COMPANY, wechatInfo) // wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
break break
case 'SHARE_D': case 'SHARE_D':
wx.$storage.set('scene', wx.$trackData) wx.$storage.set('scene', wx.$trackData)
...@@ -185,5 +185,27 @@ App({ ...@@ -185,5 +185,27 @@ App({
// 新版本下载失败 // 新版本下载失败
}) })
}, },
globalData: {} // 清内存
clearFileSystem: function() {
const fn = wx.getFileSystemManager()
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({
files
}) {
files.length && files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
})
}
})
},
globalData: {},
onPageNotFound(res) {
console.log(res, '不存在的页面')
setTimeout(() => {
wx.$router.go('/pages/tab/index/index', res.query)
}, 1000)
},
}) })
{ {
"pages": [ "pages": [
"pages/tab/index/index", "pages/tab/index/index",
"pages/applicationAccount/applicationAccount", "pages/webView/webView"
"pages/applicationPartener/applicationPartener",
"pages/applySuccess/applySuccess",
"pages/tab/introduction/introduction",
"pages/addTransform/addTransform/addTransform",
"pages/addTransform/addTransformDetail/addTransformDetail",
"pages/addValue/addValue/addValue",
"pages/productDetail/ambientLighting/ambientLighting",
"pages/productDetail/arNavigation/arNavigation",
"pages/productDetail/carBeauty/carBeauty",
"pages/productDetail/changingFilm/changingFilm",
"pages/productDetail/equity/equity",
"pages/productDetail/lossPhase/lossPhase",
"pages/productDetail/navigationArround/navigationArround",
"pages/productDetail/paintProtect/paintProtect",
"pages/productDetail/seatVentilate/seatVentilate",
"pages/productDetail/solarFilm/solarFilm",
"pages/activityApplication/activityApplication",
"pages/newEnergy/newEnergy",
"pages/measure/measure/measure",
"pages/measure/measureResult/measureResult",
"pages/scene/scene",
"pages/checkProduct/checkProduct"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
...@@ -32,11 +10,28 @@ ...@@ -32,11 +10,28 @@
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"initialRenderingCache": "static" "initialRenderingCache": "static"
}, },
"subpackages": [
{
"root": "packagesList",
"name": "packagesList",
"pages": [
"pages/index/index",
"pages/measure/measure/measure",
"pages/measure/measureResult/measureResult",
"pages/activityDetail/activityDetail",
"pages/activityApply/activityApply",
"pages/applySuccess/applySuccess",
"pages/videoDetal/videoDetal",
"pages/productDetail/productDetail",
"pages/scenarioDetail/scenarioDetail"
]
}
],
"usingComponents": { "usingComponents": {
"authorize": "components/Authorize/Authorize",
"phone-number": "components/PhoneNumber/PhoneNumber", "phone-number": "components/PhoneNumber/PhoneNumber",
"tab": "/components/Tab/Tab", "navigation-bar": "/components/NavigationBar/NavigationBar",
"navigation-bar": "/components/NavigationBar/NavigationBar" "glsx-image": "/components/image/index",
"loadding": "/components/loadding/loadding"
}, },
"resolveAlias": { "resolveAlias": {
"~/*": "/*" "~/*": "/*"
......
@import "/style/common.wxss";
page {
/* vant 样式覆盖 */
--tabs-bottom-bar-color:#5850FF;
--sidebar-selected-border-color:#5850FF;
--tree-select-nav-background-color:#f6f6f6;
}
.box-center{ .box-center{
position: absolute; position: absolute;
top: 50%; top: 50%;
......
// components/Authorize/Authorize.js // components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -39,7 +35,7 @@ Component({ ...@@ -39,7 +35,7 @@ Component({
} }
}, },
observers: { observers: {
'show': function (newVal) { show: function (newVal) {
this.setData({ this.setData({
openSet: newVal openSet: newVal
}) })
...@@ -48,9 +44,7 @@ Component({ ...@@ -48,9 +44,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -58,15 +52,10 @@ Component({ ...@@ -58,15 +52,10 @@ Component({
/** /**
* 禁止滑动 * 禁止滑动
*/ */
noScroll: wx.$util.noScroll(), noScroll(){},
cancel(e) { cancel(e) {
let { let { confirm } = e.currentTarget.dataset
confirm let { buttonType, title } = this.data
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let _this = this let _this = this
if (buttonType == 'getUserInfo' && confirm) { if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({ wx.getUserProfile({
...@@ -87,11 +76,7 @@ Component({ ...@@ -87,11 +76,7 @@ Component({
/**检验是否已授权位置 */ /**检验是否已授权位置 */
check() { check() {
const _this = this const _this = this
let { let { buttonType, scopeType, autoOpen } = this.properties
buttonType,
scopeType,
autoOpen
} = this.properties
if (buttonType != 'getPhoneNumber') { if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}` let type = `scope.${scopeType}`
buttonType = 'openSetting' buttonType = 'openSetting'
...@@ -128,12 +113,10 @@ Component({ ...@@ -128,12 +113,10 @@ Component({
} }
}) })
} }
}, },
/**授权手机号 */ /**授权手机号 */
getPhoneNumber({ getPhoneNumber({ detail }) {
detail console.log(detail)
}) {
this.triggerEvent('getphonenumber', detail) this.triggerEvent('getphonenumber', detail)
} }
}, },
...@@ -143,4 +126,4 @@ Component({ ...@@ -143,4 +126,4 @@ Component({
}, },
hide: function () {} hide: function () {}
} }
})
\ No newline at end of file \ No newline at end of file
})
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
},
dateChange(e) {
let {
current
} = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
done() {
let {
dateType
} = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
let { value } = e.detail
this.setData({
current: value
})
},
showShortcutPicker() {
this.setData({
showShortcut: !this.data.showShortcut
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
}
},
attached() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file \ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot></slot>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar"></view>
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{isFullSucreen&&!showConfirm?"isFullSucreen":""}}' style="height:{{height}}">
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
<block wx:if="{{rangeAll && dateType == 'range'}}">
<view class="calender-all" style="color:{{calenderColor}};" bindtap="chooseAll">全选</view>
</block>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="../images/close.png" webp class='calender-close-image'></image>
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}'></view>
</view>
</picker>
<view class='calender-subtitle' wx:else>{{dateList[current]}}</view>
</block>
<view class='calendar-weekdays'>
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<swiper class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view>
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}' style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose" data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}'></view>
<view class='box-center text'>
{{i.day}}
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class='calender-footer {{isFullSucreen}}' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">
{{confirmText||'确定'}}
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 99;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: 34px !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: 24rpx;
transform: translateY(-50%);
font-size: 20rpx;
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: rgba(0, 0, 0, .1);
text-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 999rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file \ No newline at end of file
const _CalendarObject_ = Symbol('_CalendarObject_')
const _nowDate_ = Symbol('_nowDate_')
const _separator_ = Symbol('_separator_')
class Calendar {
[_CalendarObject_] = {};
[_nowDate_] = new Date();
[_separator_] = '-';
constructor(calendarObject) {
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let {
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let {
data: calenderHeight
} = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => {
let {
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
}
_this.setData({
isFullSucreen: wx.$util.isFullSucreen(),
height
})
}
/**设置日期高度 */
setCalenderBodyHeight() {
let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => {
wx.$util.getViewInfo('.calender-footer', footer => {
let headerHeight = header.height
let footerHeight = footer && footer.height || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
}, _this)
}, _this)
}
/**设置日期列表 */
setMonthList() {
let {
separator,
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
if (maxDate || minDate) {
if (!minDate) {
let nowMonth = new Date().getMonth()
minDate = new Date(new Date().setMonth(nowMonth - previous)).format(`yyyy${separator}MM${separator}dd`)
}
if (!maxDate) {
maxDate = this[_nowDate_].format(`yyyy${separator}MM${separator}dd`)
}
previous = this.getMonthDifference(minDate, this[_nowDate_].format(`yyyy${separator}MM${separator}dd`))
next = this.getMonthDifference(this[_nowDate_].format(`yyyy${separator}MM${separator}dd`), maxDate)
} else {
previous = previous < 0 ? 0 : previous
next = next < 0 ? 0 : next
}
let nowMonth = this[_nowDate_].getMonth()
let now = new Date().setDate(1)
for (let i = nowMonth - previous; i <= nowMonth + next; i++) {
this.init(new Date(now).setMonth(i))
}
}
/**初始化日期 */
init(date) {
let _this = this[_CalendarObject_]
let {
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [now_year, now_month, now_day] = today.split(separator)
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}`
let obj = {
day: i,
data: dayStr,
active: now_year == year && now_month == month && i == Number(now_day)
}
if ((minDate && Date.parse(minDate) > Date.parse(dayStr)) || (maxDate && Date.parse(maxDate) < Date.parse(dayStr))) obj.disable = true
if (dateType === 'multiple') multipleDate.push(todayStr)
if (nextDay) {
if (now_year == year && now_month == month && i == Number(now_day)) {
obj.start = true
rangeDate.start = todayStr
}
if (next_year == year && next_month == month && i == Number(next_day)) {
obj.active = true
obj.end = true
rangeDate.end = `${year}${separator}${next_month}${separator}${next_day}`
}
}
firstDayOfWeek = firstDayOfWeek == 7 ? 0 : firstDayOfWeek
if (i === 1) obj.week = `week-${week - firstDayOfWeek}`
arr.push(obj)
}
monthList.push({
data: arr,
mark: Number(month)
})
if (current <= 1) {
let [nowYear, nowMonth] = today.split(separator)
current = dateList.findIndex(e => e === `${nowYear}${separator}${nowMonth}`)
}
_this.setData({
multipleDate,
date: today,
rangeDate,
monthList,
dateList,
current
})
}
/**当设置最小日期或者最大日期时 自动设置前后月份 */
getMonthDifference(date1, date2) {
let separator = this[_separator_]
//获取年,月数
let [year1, month1] = date1.split(separator)
let [year2, month2] = date2.split(separator)
let months = (parseInt(year2) - parseInt(year1)) * 12 + (parseInt(month2) - parseInt(month1))
return months
}
/**单选 */
single(e) {
let _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
monthList.map(x => {
x.data.map(i => i.active = false)
})
monthList[index].data[ind].active = true
_this.setData({
monthList,
date: data
})
if (!showConfirm) this.done()
}
/**多选 */
multiple(e) {
let _this = this[_CalendarObject_]
let {
index,
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => {
if (i.active) arr.push(i.data)
}))
_this.setData({
[`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr
})
}
/**范围选择 */
range(e) {
const _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({
monthList,
index,
ind
})
rangeDate.start = data
rangeDate.end = ''
} else {
if (!allowSameDay && Date.parse(data) == Date.parse(rangeDate.start)) return
monthList[index].data[ind].active = true
monthList[index].data[ind].end = true
rangeDate.end = data
monthList.map(x => {
x.data.map(i => {
let day = Date.parse(i.data)
i.middle = day > start && day < Date.parse(data)
})
})
}
_this.setData({
monthList,
rangeDate
})
if (!showConfirm && rangeDate.end) this.done()
}
/**点击完成 */
done() {
let _this = this[_CalendarObject_]
let {
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let targer = {
'single': date,
'multiple': multipleDate,
'range': rangeDate
}
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', {
date: targer[dateType]
})
_this.showCalendar()
}
/**清空范围选择状态 */
clearStatus(params) {
let {
monthList,
index,
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
}))
monthList[index].data[ind].active = true
monthList[index].data[ind].start = true
return monthList
}
/**
* 获取月份天数
*/
getDayNumber(year, month) {
let days = 31
switch (month) {
case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break;
case 4:
case 6:
case 9:
case 11:
days = 30
break;
}
return days
}
/**日期范围 点击全选 */
chooseAll() {
let _this = this[_CalendarObject_]
let {
monthList,
minDate,
maxDate
} = _this.data
monthList.map((e, index) => {
e.data.map((i, ind) => {
let obj = {
currentTarget: {
dataset: {
index,
ind,
data: i.data
}
}
}
if (i.data == minDate) this.range(obj)
if(i.data == maxDate) this.range(obj)
})
})
}
}
export default Calendar
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
type: [String, Number]
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#00A479'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
dateType: {
type: String,
value: 'single'
},
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/**是否显示日期范围 全选 */
rangeAll: Boolean,
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
type: [Number, String],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
}
}
\ No newline at end of file \ No newline at end of file
// components/CooperationApply/CooperationApply.js // components/CooperationApply/CooperationApply.js
import WxValidate from "../../utils/WxValidate"; import WxValidate from "../../utils/WxValidate";
import util from "../../utils/util" import util from "../../utils/util"
import {
componentsMixin
} from "../../mixins/index";
Component({ Component({
behaviors: [componentsMixin],
options: {
// 基础库2.2.3开始支持
addGlobalClass: true
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -11,23 +19,25 @@ Component({ ...@@ -11,23 +19,25 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
tabData: [ tabData: [{
{ name: "增值转化",
name: "门店合作申请",
value: 0, value: 0,
}, },
{ {
name: "代理商合作申请", name: "系统订阅",
value: 1, value: 1,
}, },
], ],
tabIndex: 0, tabIndex: 0,
applyForm: { applyForm: {
applyType: '1',
merchantName: "", merchantName: "",
carModel: "", carModel: "",
contactName: "", contactName: "",
contactPhone: "", contactPhone: "",
}, },
foldFlag: false,
selectApply: 1
}, },
/** /**
...@@ -39,11 +49,29 @@ Component({ ...@@ -39,11 +49,29 @@ Component({
this.setData({ this.setData({
tabIndex: e.currentTarget.dataset.index, tabIndex: e.currentTarget.dataset.index,
}); });
this.selectComponent("#sceneBox").resetScene()
},
// 合作方式切换
applyChange(e) {
console.log(e.detail.value);
this.setData({
selectApply: e.detail.value,
});
// this.selectComponent("#sceneBox").resetScene()
},
// 展开收起
handleFold() {
this.setData({
foldFlag: !this.data.foldFlag
})
}, },
// 表单验证规则 // 表单验证规则
initValidate() { initValidate() {
console.log(123123); console.log(123123);
const rules = { const rules = {
applyType: {
required: true,
},
merchantName: { merchantName: {
required: true, required: true,
}, },
...@@ -97,7 +125,24 @@ Component({ ...@@ -97,7 +125,24 @@ Component({
this.showModal(error); this.showModal(error);
return false; return false;
} else { } else {
return [params, this.data.tabIndex]; // return [params, this.data.tabIndex, this.data.applyForm.applyType];
let selectScene = this.selectComponent("#sceneBox").getSceneItems();
if (selectScene && !selectScene[2]) {
wx.hideLoading();
wx.showToast({
title: "请至少选择一个产品",
icon: "none",
});
return false
}
if (selectScene) {
params.businessScenario = selectScene[0].title;
params.productItems = selectScene[1].join(",");
}
let applyType = this.data.tabIndex == 0 ? '增值转化' : '系统订阅';
let ccoperationType = this.data.selectApply == 1 ? '门店' : '代理商';
params.merchantName = params.merchantName + '(' + applyType + '-' + ccoperationType + ')'
return params
} }
}, },
...@@ -116,11 +161,11 @@ Component({ ...@@ -116,11 +161,11 @@ Component({
// 初始化验证规则函数 // 初始化验证规则函数
this.initValidate(); this.initValidate();
}, },
attached: function() { attached: function () {
if (util.getUserInfo()&& util.getUserInfo().phone) { if (util.getUserInfo() && util.getUserInfo().phone) {
this.setPhone(util.getUserInfo().phone) this.setPhone(util.getUserInfo().phone)
console.log(this.data.applyForm) console.log(this.data.applyForm)
} }
} }
}, },
}); });
\ No newline at end of file \ No newline at end of file
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {
"scene" : "../scene/scene"
}
} }
\ No newline at end of file \ No newline at end of file
/* components/CooperationApply/CooperationApply.wxss */ /* components/CooperationApply/CooperationApply.wxss */
.apply-main {
width: 702rpx;
background: #FFFFFF;
box-shadow: 0 6rpx 24rpx 0 rgba(175, 181, 219, 0.40);
border-radius: 16rpx;
}
.tab-top { .tab-top {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
...@@ -16,7 +23,7 @@ ...@@ -16,7 +23,7 @@
.tab-title-active { .tab-title-active {
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-weight: 600; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #323436; color: #323436;
line-height: 110rpx; line-height: 110rpx;
...@@ -47,6 +54,10 @@ ...@@ -47,6 +54,10 @@
border-bottom: 1rpx solid #eee; border-bottom: 1rpx solid #eee;
} }
.info-list:last-child {
border-bottom: none;
}
.info-lable { .info-lable {
width: 176rpx; width: 176rpx;
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
...@@ -57,4 +68,28 @@ ...@@ -57,4 +68,28 @@
.require { .require {
color: #EB4E4E; color: #EB4E4E;
}
.apply-fold {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #5850FF;
text-align: center;
padding: 32rpx 0 40rpx 0;
}
.fold-icon {
width: 24rpx;
height: 24rpx;
vertical-align: middle;
margin-left: 8rpx;
}
.scene-box {
padding-bottom: 50rpx;
}
.cooperate-left {
margin-right: 70rpx;
} }
\ No newline at end of file \ No newline at end of file
<!-- components/CooperationApply/CooperationApply.wxml --> <!-- components/CooperationApply/CooperationApply.wxml -->
<view> <view class="apply-main">
<view class="tab-top"> <view class="tab-top">
<view wx:for="{{tabData}}" wx:key="index" class="tab-title {{item.value == tabIndex ? 'tab-title-active' : ''}}" bindtap="selectTab" data-index="{{item.value}}"> <view wx:for="{{tabData}}" wx:key="index" class="tab-title {{item.value == tabIndex ? 'tab-title-active' : ''}}" bindtap="selectTab" data-index="{{item.value}}">
{{item.name}} {{item.name}}
...@@ -8,13 +8,25 @@ ...@@ -8,13 +8,25 @@
<form> <form>
<view class="apply-info"> <view class="apply-info">
<view class='info-list'> <view class='info-list'>
<text class="info-lable">门店名称<text class="require">*</text> <text class="info-lable">合作方式<text class="require">*</text>
</text>
<radio-group name="applyType" class="radio-wrap" bindchange="applyChange">
<label class="cooperate-left">
<radio value="1" checked />门店合作
</label>
<label>
<radio value="2" />代理商合作
</label>
</radio-group>
</view>
<view class='info-list'>
<text class="info-lable">{{tabIndex == 0 ? '门店名称' : '企业名称'}}<text class="require">*</text>
</text> </text>
<input name="merchantName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入门店名称' value="{{applyForm.merchantName}}" bindinput="handleInput" data-name="merchantName" maxlength="30"></input> <input name="merchantName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入门店名称' value="{{applyForm.merchantName}}" bindinput="handleInput" data-name="merchantName" maxlength="30"></input>
</view> </view>
<view class='info-list'> <view class='info-list'>
<text class="info-lable">{{tabIndex == 0 ? '主营品牌' : '合作品牌'}}</text> <text class="info-lable">{{tabIndex == 0 ? '主营品牌' : '合作品牌'}}</text>
<input name="carModel" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder="{{tabIndex == 0 ? '请输入主营品牌' : '请输入合作品牌'}}"value="{{applyForm.carModel}}" bindinput="handleInput" data-name="carModel" maxlength="30"></input> <input name="carModel" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder="{{tabIndex == 0 ? '请输入主营品牌' : '请输入合作品牌'}}" value="{{applyForm.carModel}}" bindinput="handleInput" data-name="carModel" maxlength="30"></input>
</view> </view>
<view class='info-list'> <view class='info-list'>
<text class="info-lable">联系人<text class="require">*</text> <text class="info-lable">联系人<text class="require">*</text>
...@@ -22,10 +34,21 @@ ...@@ -22,10 +34,21 @@
<input name="contactName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入姓名' value="{{applyForm.contactName}}" bindinput="handleInput" data-name="contactName" maxlength="30"></input> <input name="contactName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入姓名' value="{{applyForm.contactName}}" bindinput="handleInput" data-name="contactName" maxlength="30"></input>
</view> </view>
<view class='info-list'> <view class='info-list'>
<text class="info-lable">手机号<text class="require">*</text> <text class="info-lable">联系电话<text class="require">*</text>
</text> </text>
<input name="contactPhone" type='text' maxlength="11" placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入手机号' value="{{applyForm.contactPhone}}" bindinput="handleInput" data-name="contactPhone"></input> <input name="contactPhone" type='text' maxlength="11" placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入手机号' value="{{applyForm.contactPhone}}" bindinput="handleInput" data-name="contactPhone"></input>
</view> </view>
</view> </view>
</form> </form>
<!-- 展开收起 -->
<view class="apply-fold" bindtap="handleFold">
<text wx:if="{{!foldFlag}}">选择业务场景</text>
<text wx:else>收起</text>
<image wx:if="{{!foldFlag}}" class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/down_icon.png?v={{img_version}}"></image>
<image wx:else class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/up_icon.png?v={{img_version}}"></image>
</view>
<!-- 选择产品和场景 -->
<view class="scene-box">
<scene id="sceneBox" foldFlag="{{foldFlag}}" selectApply="{{tabIndex}}"></scene>
</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
<view class='cell-box'>
<view class='cell {{border?"border":""}}' bindtap="click">
<view class='cell-label' style="width:{{labelWidth}}">
<text wx:if='{{required}}' class='required'>*</text>{{label||'标题'}}
</view>
<view class='cell-value ' style="width:calc(100% - {{labelWidth}});">
<view class='value {{valueAlign}} {{haveArrow}}'>
<view class='slot'><slot></slot></view>
<view class='details'>{{value}}</view>
</view>
<image wx:if='{{haveArrow}}' webp class='arrow' src="../images/arrow-x.png"></image>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/GlCell/GlCell.wxss */
.cell-box {
background: #fff;
font-size: 28rpx;
color: #333333;
padding-left: 40rpx;
box-sizing: border-box;
}
.cell {
width: 100%;
height: 90rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.cell.border {
border-bottom: 2rpx solid #eee;
}
.cell-label {
width: 25%;
}
.cell-value {
width: 75%;
position: relative;
height: 100%;
}
.cell-value .false {
padding-right: 40rpx !important;
}
.value {
width: 100%;
height: 100%;
display: flex;
align-items: center;
padding-right: 70rpx;
box-sizing: border-box;
}
.required{
color: #f00;
}
.details{
display: none;
}
.slot:empty + .details{
display: block;
}
.cell-value .right {
justify-content: flex-end;
height: 100%;
box-sizing: border-box;
}
.slot{
width: 100%;
}
.slot:empty{
display: none;
}
.arrow {
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 28rpx;
height: 26rpx;
}
// components/glTextarea/glTextarea.js
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
placeholder: String,
showWordLimit: Boolean,
disabled: Boolean,
value: String,
filterEmoji:{
type:Boolean,
value:true
}
},
/**
* 组件的初始数据
*/
data: {
edit: true,
value: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
setValue(value) {
if(this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
this.setData({
value
})
},
textareaInput(e) {
let {
value
} = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
})
},
textareaBlur(e) {
let {
value
} = e.detail
this.setData({
edit: true
})
this.setValue(value)
this.triggerEvent('blur', {
value
})
},
}
})
\ No newline at end of file \ No newline at end of file
<view class='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<text class='textarea' bindtap="openTextarea" style="color:{{value?'#333':'#999'}}">{{value||placeholder||'请输入'}}</text>
</block>
<block wx:else>
<textarea class='_textarea_' maxlength="{{maxlength}}" value='{{value}}' bindinput='textareaInput' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur' ></textarea>
</block>
<block wx:if='{{maxlength>0&&showWordLimit}}'>
<view class='wordLimit'>
{{value.length||0}} / {{maxlength}}
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/glTextarea/glTextarea.wxss */
.textarea-box {
width: 100%;
height: 100%;
position: relative;
}
.textarea-box .textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
}
._textarea_ {
width: 100%;
height: calc(100% - 40rpx);
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
// components/Login/Login.js
import {
ssoApi
} from '../../api/api'
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
content: {
type: String,
value: '您还没有登录,请您登录后查看!'
},
returnResponse: {
type: Boolean,
value: true
}
},
observers: {
'show': function (newVal, oldVal) {
let {
returnResponse
} = this.data
if (newVal) {
wx.$util.showLoading()
getApp().login(returnResponse).then(({
code,
data
}) => {
this.triggerEvent('loginInfo', {
code,
data
})
wx.hideLoading()
if (data) {
let {
sessionId
} = data
this.setData({
sessionId,
openSet: code != 0
})
this.sessionId = sessionId
if (data.isLogin == 'Y'&& code == '0') {
let thisPage = wx.$router.getPageInstance()
if (thisPage.loginCallBack) thisPage.loginCallBack(data)
if (thisPage.onRoute) thisPage.onRoute()
}
}
})
} else {
this.hide()
}
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
hide() {
this.setData({
openSet: false
})
},
cancel(flag) {
this.hide()
if (flag) this.triggerEvent('cancel')
},
noScroll: wx.$util.noScroll(),
getPhoneNumber({
detail
}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') {
this.cancel(true)
return
}
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
const {
sessionId
} = this.data
wx.$util.showLoading()
detail.sessionId = sessionId
ssoApi.authUserPhone(detail).then(({
data,
code
}) => {
wx.$Track.setTrack({}, 3)
wx.hideLoading()
let thisPage = wx.$router.getPageInstance()
if (code == '0') {
thisPage.setData({
showLogin: false,
userInfo: data
})
wx.$authStatus = false
this.setData({
sessionId: ''
})
wx.$util.setUserInfo(data)
// wx.$util.setSessionId(data.sessionId)
thisPage.onLoad()
thisPage.onShow()
if (thisPage.init) thisPage.init()
if (thisPage.onRoute) thisPage.onRoute()
if (thisPage.loginCallBack) thisPage.loginCallBack(data)
let customerId = wx.$storage.get('srcm_shopmall_customer_id')
let merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
if (customerId) {
ssoApi.updataCustomerPhone({
customerId,
merchantId
}).then(() => {
wx.removeStorageSync('srcm_shopmall_customer_id')
})
}
wx.$util.customerbehavior()
wx.$eventbus.emit('EQUITY')
}
})
}
},
}
})
\ No newline at end of file \ No newline at end of file
<view class="open-seting-bg text-center" wx:if="{{openSet}}" catchtouchmove="noScroll">
<view class="bg" ></view>
<view class="open-set-inner">
<view class="set-title">
<text class="title">温馨提示</text>
<view class="content">{{content}}</view>
</view>
<view class="btn-openset">
<!-- <view bindtap="cancel" class="btn text-center cancel" >取消</view> -->
<navigator class="btn text-center cancel" target="miniProgram" open-type="exit">取消</navigator>
<view class="btn text-center">
登录
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="button-style"></button>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Login/Login.wxss */
@import '../Authorize/Authorize.wxss';
.bg {
position: absolute;
left: 0;
top: 0;
z-index: -1;
width: 100%;
height: 100%;
}
.title {
margin-bottom: 60rpx;
font-size: 36rpx;
font-weight: 500;
}
.content {
font-size: 28rpx;
color: #A3A3A3;
}
.btn {
color: #F13C3D;
}
.cancel {
color: #999;
}
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-09 13:58:15
* @LastEditors: huyue
* @LastEditTime: 2022-12-13 10:36:15
*/
// components/Login/Login.js // components/Login/Login.js
import { ssoApi } from "../../api/api"; import { ssoApi } from "../../api/api";
import { componentsMixin } from "../../mixins/index"; import { componentsMixin } from "../../mixins/index";
Component({ Component({
externalClasses: ['custom-class'],
behaviors: [componentsMixin], behaviors: [componentsMixin],
// options: {
// styleIsolation: 'isolated'
// },
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
isHidden: {
type: Boolean,
value: false
},
phoneText: { phoneText: {
type: String, type: String,
value: '了解更多案例' value: '了解更多案例'
}, },
isImage: { /**
type: Boolean, * type: 场景类型: home.首页,整行;product.详情中的查看更多和申请合作切换;scenario场景详情:转发+合作申请;video 视频详情
value: false */
type: {
type: String
}, },
showIcon: { hasPhoneNumber: {
type: Boolean, type: Boolean,
value: true observer(n) {
this.setData({
hasPhone: n
})
}
} }
}, },
observers: {},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: {}, data: {
hasPhone: false
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -36,40 +50,52 @@ Component({ ...@@ -36,40 +50,52 @@ Component({
methods: { methods: {
// 获取手机号 // 获取手机号
getPhoneNumber({detail}) { getPhoneNumber({detail}) {
if ( if ( detail.errMsg && detail.errMsg.indexOf('user deny') !== -1 ) {
detail.errMsg &&
// e.detail.errMsg == "getPhoneNumber:fail user deny"
detail.errMsg.indexOf('user deny') !== -1
) {
wx.hideLoading() wx.hideLoading()
return; return;
} else {
// wx.$util.showLoading('正在授权...')
} }
// this.triggerEvent("updatePhoneNumber", '18873336682');
wx.$util.showLoading('正在授权...') wx.$util.showLoading('正在授权...')
getApp() delete detail.errMsg;
.login(true) if (detail.iv && detail.encryptedData) {
.then(({ data }) => { ssoApi.authUserPhone(detail).then(({ data, code, message }) => {
delete detail.errMsg; wx.hideLoading()
if (detail.iv && detail.encryptedData) { if (code==0) {
ssoApi.authUserPhone(detail).then(({ data, code, message }) => { wx.$util.setUserInfo(data);
wx.hideLoading() // 其他操作
if (code==0) { this.triggerEvent("updatePhoneNumber", data.phone);
wx.$util.setUserInfo(data); this.setData({
// wx.$util.setSessionId(data.sessionId); hasPhone: true
// 其他操作 })
this.triggerEvent("updatePhoneNumber", data.phone); } else {
} else { wx.showToast({
wx.showToast({ title: message,
title: message, icon: 'none',
icon: 'none', duration: 2000
duration: 2000 })
})
}
});
} }
}); });
}
},
jump() {
// this.triggerEvent('toApplication')
console.log(333);
wx.$router.go("/packagesList/pages/activityApply/activityApply");
},
forward() {
this.triggerEvent('toForward')
}, },
downVideo() {
let that = this
wx.showModal({
content: '是否下载视频',
success (res) {
if (res.confirm) {
that.triggerEvent('videodown')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
}, },
}); });
.fixBottom {
position: fixed;
display: flex;
bottom: 0;
width: 100%;
box-sizing: border-box;
background-color: #fff;
box-shadow: inset 0 2rpx 0 0 #F2F3F7;
padding: 16rpx 48rpx;
filter: blur(0);
.home-btn {
width: 100%;
}
.video-btn {
display: flex;
flex: 1;
}
.phoneNumber {
width: 100%;
color: #fff;
background-color: #5850FF;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
letter-spacing: 0;
height: 72rpx;
line-height: 72rpx;
animation: scaleDrew 2.5s infinite;
}
@keyframes scaleDrew {
/* 定义关键帧、scaleDrew是需要绑定到选择器的关键帧名称 */
0% {
transform: scale(1);
}
25% {
transform: scale(0.95);
}
50% {
transform: scale(1);
}
75% {
transform: scale(0.95);
}
}
.forward-box {
width: 136rpx;
padding: 4rpx 44rpx;
height: 88rpx;
text-align: center;
margin-right: 40rpx;
margin-top: -16rpx;
box-shadow: 8rpx 0 16rpx 0 rgba(202, 211, 230, 0.30);
.forward-text {
line-height: 32rpx;
}
.icon-forward {
width: 48rpx;
height: 48rpx;
}
}
button {
margin: 0;
line-height: 88rpx;
}
// 了解更多的样式
.phone-number {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
// margin: 16rpx 48rpx;
color: #fff;
font-size: 28rpx;
letter-spacing: 0.8rpx;
background: #5850FF;
background-image: linear-gradient(180deg, #4791FF 0%, #5850FF 100%, #643DFF 100%);
border-radius: 8rpx;
line-height: 72rpx;
.icon-arrow {
width: 32rpx;
height: 32rpx;
}
.icon-arrow:first-child {
margin-right: 48rpx;
}
.icon-arrow:last-child {
margin-left: 48rpx;
}
}
.video-box {
display: inline-flex;
margin-right: 20rpx;
.btn-item {
width: 100rpx;
text-align: center;
.btn-text {
font-weight: 500;
font-size: 20rpx;
color: #5A6066;
}
}
.icon-forward {
width: 40rpx;
height: 40rpx;
}
.phoneNumber {}
}
}
// .isFullSucreen {
// width: 100%;
// }
.product_full {
flex: 1;
display: flex;
align-items: center;
}
.forward_box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 !important;
margin: 0;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 10px;
color: #6E6E7A;
background: #fff;
box-shadow: 4px 0 8px 0 rgba(202, 211, 230, 0.30);
.icon-forward {
flex-shrink: 0;
}
}
.share_btn_item {
line-height: normal !important;
box-shadow: none;
border: 0 !important;
background-color: none !important;
}
.share_btn_item:after {
display: none;
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{isImage}}">
<button class="imageBtn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
</button>
</block>
<block wx:else>
<button class="{{isHidden ? 'hidden-phone':'phone-number'}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
<image wx:if="{{showIcon}}" class="icon-arrow" webp src="{{IMGURL}}home/icon-arrow.png"></image>
{{phoneText}}
<image wx:if="{{showIcon}}" class="icon-arrow" webp src="{{IMGURL}}home/icon-arrow.png"></image>
</button>
</block>
\ No newline at end of file \ No newline at end of file
<view class="fixBottom custom-class">
<view wx:if="{{type == 'home'}}" class="isFullSucreen home-btn">
<!-- <view class="isFullSucreen"> -->
<button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请</button>
<button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button>
<!-- </view> -->
</view>
<view wx:if="{{type == 'product'}}" class="isFullSucreen product_full">
<block wx:if="{{hasPhone}}">
<button class="forward-box forward_box" open-type="share">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="forward-text" bindtap="forward">转发</view>
</button>
<button class="phoneNumber" bindtap="jump">申请合作</button>
</block>
<block wx:else>
<button class="phone-number" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
<image class="icon-arrow" webp src="{{IMGURL}}home/icon-arrow.png"></image>
{{phoneText}}
<image class="icon-arrow" webp src="{{IMGURL}}home/icon-arrow.png"></image>
</button>
</block>
</view>
<view wx:if="{{type == 'scenario'}}" class="isFullSucreen product_full">
<button class="forward-box forward_box" open-type="share">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="forward-text" bindtap="forward">转发</view>
</button>
<button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请</button>
<button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button>
</view>
<view wx:if="{{type == 'video'}}" class="isFullSucreen video-btn">
<view class="video-box">
<view class="btn-item" bindtap="downVideo">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-download.png"></image>
<view class="btn-text" >下载</view>
</view>
<button class="btn-item forward_box share_btn_item" bindtap="forward" open-type="share">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="btn-text">转发</view>
</button>
</view>
<button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请</button>
<button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* 手机号授权 */
.phone-number {
display: flex;
align-items: center;
justify-content: center;
margin: 16rpx 48rpx;
color: #fff;
font-size: 28rpx;
letter-spacing: 0.8rpx;
background: #5850FF;
background-image: linear-gradient(180deg, #4791FF 0%, #5850FF 100%, #643DFF 100%);
border-radius: 8rpx;
}
.icon-arrow {
width: 32rpx;
height: 32rpx;
}
.icon-arrow:first-child {
margin-right: 48rpx;
}
.icon-arrow:last-child {
margin-left: 48rpx;
}
.hidden-phone {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
background-color: transparent;
color: transparent;
}
.imageBtn {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: transparent;
}
\ No newline at end of file \ No newline at end of file
// components/share/share.js
import Draw_Function from './draw_function'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (newVal, oldVal) {
let {
wxShare
} = this.data
this.check(newVal)
if (!wxShare) {
this.setData({
_show: true
})
}
}
},
toast: {
type: String,
value: '生成中...'
},
canvasObject: Object,
hideCancel: Boolean,
diyDraw: Boolean,
hideWx: Boolean,
wxShare: Boolean
},
ready() {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
/**
* 检查
*/
check(bool) {
if (bool) {
if (this.data.tempFilePath) return
this.getImgData(res => {
this.draw(res)
})
}
},
/**
* 禁止滑动
*/
noScroll: wx.$util.noScroll(),
/**
* 取消
*/
cancel() {
this.setData({
_show: false
})
},
saveImg() {
let _this = this
wx.saveImageToPhotosAlbum({
filePath: _this.data.tempFilePath,
success(e) {
wx.$util.showToast('保存成功')
_this.triggerEvent('callBack')
}
})
},
/**保存 */
save() {
this.saveImg()
wx.nextTick(() => this.cancel())
},
/**
* 检查
*/
checkSetting() {
this.setData({
settingStatus: !this.data.settingStatus
})
},
/**
* 开始生成
*/
draw(images) {
const {
canvasObject,
wxShare
} = this.__data__
let {
height,
width
} = canvasObject
width = width || 300
height = height || 150
wx.$util.getPhoneInfo(phoneInfo => {
wx.$util.getViewInfo('.choose-list', listInfo => {
wx.$util.getViewInfo('.bg', bgInfo => {
let {
windowWidth
} = phoneInfo
let pixelRatio = windowWidth / 750
let viewTop = !wxShare ? (bgInfo.height - listInfo.height - height * pixelRatio) / 2 : 0
this.setData({
canvasStyle: `width:${width * pixelRatio}px;height:${height * pixelRatio}px;top:${viewTop}px;`,
previewStyle: `width:${width * pixelRatio}px;height:${width * pixelRatio * 0.8}px;`,
pixelRatio,
viewTop,
height,
width
})
this.ctx = wx.createCanvasContext('canvasImg', this)
this.ctx.clearRect(0, 0, width, height)
this.draw_canvas({
canvasObject,
images,
width,
height
}, canvas => {
canvas.draw(false, setTimeout(() => {
this.getCanvasImg()
}, 500))
})
})
}, this)
}, this)
},
/**画布 */
draw_canvas(params, callBack) {
const {
canvasObject,
images,
height,
width
} = params
const {
backgroundColor,
textList,
lines
} = canvasObject
const draw_function = new Draw_Function(this)
this.ctx.setFillStyle(backgroundColor || '#fff')
this.ctx.fillRect(0, 0, width, height)
this.ctx.save()
if (this.__data__.diyDraw) {
this.triggerEvent('draw', {
ctx: this.ctx,
canvasObject,
callBack,
height,
images,
width
})
} else {
images && images.length > 0 && (images.map(e => {
draw_function.drawImages(e)
}))
textList && textList.length > 0 && (textList.map(e => {
e.width = canvasObject.width
draw_function.drawText(e)
}))
lines && lines.length > 0 && (lines.map(e => {
draw_function.drawLine(e)
}))
callBack(this.ctx)
}
},
/**
* 画布生成图片
*/
getCanvasImg() {
let _this = this
let {
pixelRatio,
wxShare,
height,
width
} = _this.data
wx.canvasToTempFilePath({
canvasId: 'canvasImg',
width: width * pixelRatio,
height: height * pixelRatio,
fileType: 'jpg',
quality: 1,
x: 0,
y: 0,
success(res) {
let {
tempFilePath
} = res
if (wxShare) {
wx.hideLoading()
_this.checkSetting()
wx.showShareImageMenu({
path: tempFilePath,
success(res) {
console.log(res)
}
})
} else {
setTimeout(() => {
_this.createPreviewImg({
tempFilePath,
width
})
}, 300)
}
},
fail(err) {
wx.hideLoading()
}
}, this)
},
/**生成预览图 */
createPreviewImg(params) {
const p_ctx = wx.createCanvasContext('preview', this)
let {
tempFilePath,
width
} = params
p_ctx.drawImage(tempFilePath, 0, 0, width, width * 0.8)
let _this = this
p_ctx.draw(false, setTimeout(() => {
wx.canvasToTempFilePath({
height: width * 1.6,
width: width * 2,
canvasId: 'preview',
fileType: 'jpg',
quality: 1,
x: 0,
y: 0,
success(preview) {
_this.setData({
tempFilePath
})
_this.triggerEvent('init', {
previewImg: preview.tempFilePath,
tempFilePath
})
wx.hideLoading()
},
fail(err) {
wx.hideLoading()
}
}, this)
}, 500))
},
/**
* 批量转换图片
*/
getImgData(callBack) {
let _this = this
let {
canvasObject,
toast,
} = this.__data__
let {
imgList
} = canvasObject
wx.showLoading({
title: toast,
mask: true,
success() {
if (imgList.length > 0) {
_this.createLocalImg(imgList, 0, res => {
callBack(res)
})
} else {
callBack()
}
}
})
},
/**网络图片转成本地资源 */
createLocalImg(imgList, index = 0, callBack) {
if (index === imgList.length) return callBack(imgList)
wx.$util.promise(resolve => {
wx.getImageInfo({
src: imgList[index].url,
success(res) {
imgList[index].url = res.path
resolve()
},
fail() {
wx.$util.showToast('图片生成失败,请稍后再试')
wx.hideLoading()
console.error(`索引为:${index}的图片转换本地失败,${JSON.stringify(imgList[index].url)}`)
}
})
}).then(() => {
this.createLocalImg(imgList, index + 1, callBack)
})
}
}
})
\ No newline at end of file \ No newline at end of file
<view class='share-box' catchtouchmove='noScroll' wx:if='{{_show}}'>
<view class='bg' bindtap='cancel'></view>
<view class='info {{flag?"flag":""}}' style="top:{{viewTop}}px;" hidden="{{canvasObject.showCanvas}}">
<slot></slot>
</view>
<view class='choose-list' style="height:{{hideCancel?'auto':'298rpx'}}">
<view class='list'>
<view class='list-btn' wx:if='{{!hideWx}}'>
<image src='../images/wx.png' webp class='image'></image>
<view>微信好友</view>
<button open-type='share' bindtap='cancel' class='button'></button>
</view>
<view class='list-btn' bindtap='checkSetting'>
<image src='../images/share.png' webp class='image'></image>
<view>保存分享</view>
</view>
</view>
<view wx:if='{{!hideCancel}}' class='cancel' bindtap='cancel'>取消</view>
</view>
</view>
<view class='canvas {{wxShare?"":"showCanvas"}}' style="{{canvasStyle}}">
<canvas canvas-id='canvasImg' style='width:100%;height:100%;'></canvas>
</view>
<view class='preview' style="{{previewStyle}}">
<canvas canvas-id="preview" style='width:100%;height:100%;'></canvas>
</view>
<authorize scopeType='writePhotosAlbum' checkSetting='{{settingStatus}}' bindsuccess='save'></authorize>
\ No newline at end of file \ No newline at end of file
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.share-box {
position: fixed;
z-index: 999999;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.share-box .info {
width: auto;
height: auto;
position: absolute;
left: 1000%;
transform: translateX(-50%);
overflow: hidden;
}
.share-box .info.flag{
left: 50%;
animation: showInfo .5s forwards;
}
@keyframes showInfo{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.share-box .bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
}
.choose-list {
width: 100%;
position: absolute;
left: 0;
background: #f6f6f6;
animation: showChoose .4s forwards;
}
@keyframes showChoose{
0%{
bottom: -100%;
}
100%{
bottom: 0%;
}
}
.choose-list .cancel {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
font-size: 28rpx;
color: #333;
background: #fff;
}
.list {
width: 100%;
height: 182rpx;
background: #fff;
display: flex;
}
.list-btn {
flex: 1;
text-align: center;
font-size: 24rpx;
color: #333;
padding-top: 40rpx;
position: relative;
}
.list-btn .image {
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
}
.list-btn .button {
width: 100%;
height: 100%;
position: absolute;
opacity: 0;
top: 0;
left: 0;
}
.canvas {
position: fixed;
top: -1000%;
left: -1000%;
animation: canvasShow .5s forwards;
}
.preview{
position: fixed;
top: 1000%;
left: 1000%;
z-index: 999999999;
}
@keyframes canvasShow{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.showCanvas{
left: 50%;
transform: translateX(-50%);
z-index: 99999999999;
}
\ No newline at end of file \ No newline at end of file
const _ctx_ = Symbol('_ctx_')
const _pixelRatio_ = Symbol('_pixelRatio_')
class Draw_Function {
[_ctx_] = null;
[_pixelRatio_] = null;
constructor(_this_) {
this[_ctx_] = _this_.ctx
this[_pixelRatio_] = _this_.data.pixelRatio || 2
}
drawImages(imageParams) {
this[_ctx_].beginPath()
this[_ctx_].save()
let {
borderRadius,
height,
width,
url,
x,
y,
} = imageParams
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
if (borderRadius) {
this.drawRadiusRect({
borderRadius,
height,
width,
x,
y,
})
this[_ctx_].clip()
}
this[_ctx_].drawImage(url, x, y, width, height)
this[_ctx_].restore()
}
toRpx(val) {
return this[_pixelRatio_] * val
}
getTextWidth(text, fontSize) {
if (fontSize) this[_ctx_].setFontSize(fontSize)
return this[_ctx_].measureText(text).width
}
drawFill(x, y, width, height, color) {
this[_ctx_].beginPath()
this[_ctx_].setFillStyle(color || '#000')
this[_ctx_].fillRect(x, y, width, height)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
}
drawText(textParams) {
let {
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
opacity,
lineNum,
width,
color,
text,
x,
y,
} = textParams
let text_width = this.getTextWidth(text)
textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal'
opacity = typeof opacity === 'number' ? opacity : 1
lineHeight = this.toRpx(lineHeight || fontSize || 12)
textWidth = this.toRpx(textWidth || 0)
fontSize = this.toRpx(fontSize || 12)
maxWidth = this.toRpx(maxWidth || width)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
let fontX = this.getFontWidth({
textAlign,
fontSize,
text,
x,
})
if (textParams.border) {
let boxX = this.toRpx(textParams.x - 4.5),
boxY = this.toRpx(textParams.y - 0.5),
boxWidth = text_width + this.toRpx(9),
boxHeight = lineHeight + this.toRpx(4)
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(9)
}
this.drawFill(boxX, boxY, boxWidth, boxHeight, textParams.border)
}
if (textParams.background) {
let boxX = this.toRpx(textParams.x - 4),
boxY = this.toRpx(textParams.y),
boxWidth = text_width + this.toRpx(8),
boxHeight = lineHeight + this.toRpx(3)
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(8)
}
this.drawFill(boxX, boxY, boxWidth, boxHeight, textParams.background)
}
this[_ctx_].beginPath()
this[_ctx_].setGlobalAlpha(opacity)
this[_ctx_].setFontSize(fontSize)
this[_ctx_].setFillStyle(color || '#000')
this[_ctx_].setStrokeStyle(color || '#000')
this[_ctx_].setTextBaseline(textBaseline)
this[_ctx_].setTextAlign(textAlign)
this[_ctx_].setLineWidth(this.toRpx(2))
const drawOneLineText = () => {
let textArr = text.split(''),
newText = '',
ellipsis = false
try {
textArr.map(e => {
newText += e
if (this.getTextWidth(newText) > width - fontX) throw true
})
} catch (error) {
ellipsis = error
}
if (ellipsis) newText += '…'
if (lastFont) newText += lastFont
this[_ctx_].fillText(newText, x, y, maxWidth)
if (checkFontWeight(fontWeight)) this[_ctx_].strokeText(newText, x, textHeight, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
textDecoration,
textBaseline,
textAlign,
fontSize,
newText,
opacity,
text,
y,
x
})
}
}
if (lineNum > 1) {
let textArr = text.split(''),
textRowArr = [],
currentText = '',
viewWidth = width - fontX
if (text_width > viewWidth) {
textArr.map(e => {
currentText += e
if (this.getTextWidth(currentText) >= viewWidth && textRowArr.length < lineNum - 1) {
textRowArr.push(currentText)
currentText = ''
}
})
if (currentText.length) textRowArr.push(currentText)
textRowArr.map((e, index) => {
if (this.getTextWidth(e) > viewWidth && index == lineNum - 1) {
try {
let lastText = '',
lastArr = e.split('')
lastArr.map(i => {
lastText += i
if (this.getTextWidth(lastText) > width - fontX - this.getTextWidth('…')) throw lastText
})
} catch (error) {
if (lastFont) e = `${error.substring(0, error.length - lastFont.length)}…${lastFont}`
else e = `${error}…`
}
}
if (lastFont && e.indexOf(lastFont) == -1 && textRowArr.length < 2) e = `${e.substring(0, e.length - lastFont.length)}…${lastFont}`
let textHeight = y + index * (lineHeight || fontSize)
this[_ctx_].fillText(e, x, textHeight, maxWidth)
if (checkFontWeight(fontWeight)) this[_ctx_].strokeText(newText, x, textHeight, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
y: textHeight,
textDecoration,
textBaseline,
textAlign,
fontSize,
newText: e,
opacity,
text,
x
})
}
})
} else {
drawOneLineText()
}
} else {
drawOneLineText()
}
this[_ctx_].stroke()
}
drawLine(lineParams) {
this[_ctx_].beginPath()
let {
opacity,
startX,
startY,
width,
color,
endX,
endY,
} = lineParams
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
endX = this.toRpx(endX)
endY = this.toRpx(endY)
this[_ctx_].setGlobalAlpha(typeof opacity === 'number' ? opacity : 1)
this[_ctx_].setStrokeStyle(color || '#000')
this[_ctx_].setLineWidth(width || this.toRpx(1))
this[_ctx_].moveTo(startX, startY)
this[_ctx_].lineTo(endX, endY)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
}
setLineY = params => {
let {
textDecoration,
textBaseline,
fontSize,
y
} = params
let type = {
'underline': {
'top': y + fontSize,
'middle': y + fontSize / 2,
'bottom': y,
'normal': y,
},
'overline': {
'top': y,
'middle': y - fontSize / 2,
'bottom': y - fontSize,
'normal': y,
},
'line-through': {
'top': y + fontSize / 2,
'middle': y - fontSize / 2,
'bottom': y,
'normal': y,
}
}
return type[textDecoration][textBaseline]
}
setLineX(params) {
let {
textAlign,
text,
x
} = params
let textWidth = this[_ctx_].measureText(text).width
let type = {
'left': x,
'center': x - textWidth / 2,
'right': x - textWidth
}
return type[textAlign]
}
drawRadiusRect(params) {
let {
borderRadius,
height,
width,
x,
y,
} = params
let radius = typeof borderRadius === 'string' ? (Number(borderRadius.split('%')[0]) / 100 * width) / 2 : borderRadius / 2
radius = radius || 0
this[_ctx_].beginPath()
for (let i = 1; i < 5; i++) {
let arcX = i === 1 || i === 4 ? x + width - radius : x + radius
let arcY = i === 1 || i === 2 ? y + height - radius : y + radius
this[_ctx_].arc(arcX, arcY, radius, 2 * Math.PI * ((i - 1) / 4), 2 * Math.PI * (i / 4))
}
}
getFontWidth(params) {
let {
textAlign,
fontSize,
text,
x
} = params
let type = {
'left': x,
'center': x - fontSize * text.length / 2,
'right': x - fontSize * text.length
}
return type[textAlign] < 0 ? 0 : type[textAlign]
}
drawDecoration(params) {
let {
newText,
opacity,
y,
x
} = params
let lineX = x
let lineY = y
lineX = this.setLineX(params)
lineY = this.setLineY(params)
this[_ctx_].setGlobalAlpha(opacity)
this[_ctx_].moveTo(lineX, lineY)
this[_ctx_].lineTo(lineX + this[_ctx_].measureText(newText).width, lineY)
}
}
const checkFontWeight = (fontWeight = '0') => {
return (fontWeight && (typeof fontWeight === 'string' || typeof fontWeight === 'number') && (fontWeight == 'bold' || fontWeight >= 700))
}
const checkTextDecoration = textDecoration => {
return (textDecoration && (textDecoration === 'underline' || textDecoration === 'overline' || textDecoration === 'line-through'))
}
export default Draw_Function
\ No newline at end of file \ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height: {
type: String,
value: '100vh'
},
tagIndex: {
type: Number,
value: 0,
observer: function (n, o) {
this.setData({
count: n
})
}
},
key: {
type: String,
value: 'name'
},
showClickLoading:Boolean
},
/**
* 组件的初始数据
*/
data: {
count: 0,
scrollTop: 0
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
item,
index
} = e.currentTarget.dataset
if(this.data.count === index) return
if(this.properties.showClickLoading) wx.$util.showLoading('')
item.index = index
this.setData({
count: index,
scrollTop: 0
})
this.triggerEvent('click', item)
wx.nextTick(()=>{
wx.hideLoading()
})
},
tabScrollTolower(e) {
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e) {
this.triggerEvent('viewScrollTolower')
}
},
ready() {
}
})
\ No newline at end of file \ No newline at end of file
<view class='tab-box' id='tabView' style="height:{{height}}">
<scroll-view style="height:100%;" scroll-y class='tab' bindscrolltolower='tabScrollTolower'>
<view>
<block wx:for='{{tabList}}' wx:key='index'>
<view class='tab-item {{count==index?"active":""}}' bindtap="click" data-item='{{item}}' data-index='{{index}}'>{{item[key]}}</view>
</block>
</view>
</scroll-view>
<view class='view'>
<scroll-view style="height:100%" scroll-y scroll-top='{{scrollTop}}' bindscrolltolower='viewScrollTolower'>
<slot></slot>
</scroll-view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/tabView/tabView.wxss */
.tab {
float: left;
width: 26.67%;
box-sizing: border-box;
text-align: center;
background: #f4f4f4;
}
.view {
float: left;
width: 73.33%;
height: 100%;
position: relative;
}
.tab-item {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #333;
box-sizing: border-box;
padding: 0 10rpx;
}
.active {
font-weight: 700;
background: #fff;
position: sticky;
top: 0;
font-size: 28rpx;
}
// components/TimeHorizon/TimeHorizon.js
Component({
/**
* 组件的属性列表
*/
properties: {
config: {
type: Object,
observer: function (newVal, oldVal) {
let {
havehhmmss,
startData,
startTime,
startLabel,
valueAlign,
endData,
endLabel,
} = newVal
valueAlign = valueAlign || 'left'
this.setData({
havehhmmss,
startData,
startTime,
startLabel,
valueAlign,
endData,
endLabel
})
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
dateChange(e) {
let {
value
} = e.detail
let {
type
} = e.currentTarget.dataset
if (this.data.endData && type === 'start') {
this.setData({
endData: ''
})
}
let {
havehhmmss
} = this.data
if(havehhmmss)
value = havehhmmss ? type === 'start' ? `${value} 00:00:00` : `${value} 23:59:59` : value
this.setData({
[`${type}Data`]: value
})
let {
startData,
endData,
} = this.data
if (startData && endData) this.triggerEvent('change', {
startData,
endData
})
}
}
})
\ No newline at end of file \ No newline at end of file
<view class='time-box'>
<picker class='time-picker' mode="date" value="{{startData}}" start="{{startTime}}" bindchange="dateChange" data-type='start'>
<view class='time-picker-view'>
<view class='time-picker-label'>{{startLabel||'开始时间'}}</view>
<view class='time-picker-value {{!startData?"no-data":""}} {{valueAlign}}'>
{{startData||'请选择'}}
<image class='arrow' webp src="../images/arrow-x.png"></image>
</view>
</view>
</picker>
<picker class='time-picker' mode="date" value="{{endData}}" start="{{startData}}" bindchange="dateChange" data-type='end'>
<view class='time-picker-view'>
<view class='time-picker-label'>{{endLabel||'结束时间'}}</view>
<view class='time-picker-value {{!endData?"no-data":""}} {{valueAlign}}'>
{{endData||'请选择'}}
<image class='arrow' webp src="../images/arrow-x.png"></image>
</view>
</view>
</picker>
</view>
\ No newline at end of file \ No newline at end of file
/* components/TimeHorizon/TimeHorizon.wxss */
.time-box {
background: #fff;
font-size: 28rpx;
color: #333333;
}
.time-picker {
padding-left: 40rpx;
}
.time-picker-view {
display: flex;
align-items: center;
width: 100%;
height: 90rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #eee;
}
.time-picker-label{
width: 25%;
box-sizing: border-box;
}
.time-picker-value{
width: 75%;
display: flex;
align-items: center;
position: relative;
}
.time-picker-value.right{
justify-content: flex-end;
padding-right: 70rpx;
}
.no-data {
color: #999;
}
.arrow {
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 28rpx;
height: 26rpx;
}
// components/GlCell/GlCell.js // components/customer/customer.js
import {
componentsMixin
} from "../../mixins/index";
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
label:String, qrCode: {
labelWidth:String, type: String,
border:Boolean, }
haveArrow:Boolean,
value:String,
valueAlign:String,
required:Boolean
}, },
/** /**
...@@ -24,8 +24,10 @@ Component({ ...@@ -24,8 +24,10 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
click(e){ // 关闭客服弹框
this.triggerEvent('click') closeQR() {
console.log(333);
this.triggerEvent('closeQR')
} }
} }
}) })
/* components/customer/customer.wxss */
.model {
position: fixed;
left: 0;
right: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
z-index: 999999;
.bg-icon {
position: absolute;
top: 220rpx;
left: 0;
width: 750rpx;
height: 800rpx;
}
.qrcode-icon {
position: absolute;
top: 470rpx;
right: 190rpx;
width: 374rpx;
height: 374rpx;
}
.tip-icon {
position: absolute;
top: 500rpx;
right: 33rpx;
width: 100rpx;
height: 100rpx;
}
.close-icon {
position: absolute;
top: 940rpx;
right: 343rpx;
width: 64rpx;
height: 64rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--components/customer/customer.wxml-->
<block>
<view class="model">
<image class="bg-icon" webp src="{{IMGURL}}home/QR_code_bg.png?v={{img_version}}"></image>
<image webp class="qrcode-icon" show-menu-by-longpress src="{{qrCode}}"></image>
<!-- <image class="tip-icon" webp src="{{IMGURL}}home/custom.png?v={{img_version}}"></image> -->
<image class="close-icon" bindtap="closeQR" webp src="{{IMGURL}}home/close_icon.png?v={{img_version}}"></image>
</view>
</block>
// components/image/index.js
import { IMG_URL, IMG_VERSION } from '~/utils/constantData'
Component({
externalClasses: ['custom-class', 'class'],
/**
* 组件的属性列表
*/
properties: {
src: {
type: String,
value: '',
observer: function (url, o) {
if (url) {
let isWebp = url.includes('webp')
this.setData({
isWebp,
imagePath: `${IMG_URL}${url}?v=` + IMG_VERSION()
})
}
}
},
mode: {
type: String,
value: 'scaleToFill'
},
webp: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
imagePath: '',
isWebp: false
},
// 组件生命周期
lifetimes: {
// 在组件实例进入页面节点树时执行
// attached: function () {
// let src = this.data.src
// let prefix = IMG_URL
// this.setData({
// imagePath: `${prefix}${src}?v=` + IMG_VERSION()
// })
// },
// 在组件实例被从页面节点树移除时执行
detached: function () {}
},
/**
* 组件的方法列表
*/
methods: {}
})
/* components/image/index.wxss */
\ No newline at end of file \ No newline at end of file
<!-- components/image/index.wxml -->
<image
src="{{imagePath}}"
mode="{{mode}}"
webp="{{webp||isWebp}}"
lazy-load
class="custom-class class" />
// components/shareBtn/shareBtn.js // components/loadding/loadding.js
import { componentsMixin } from "../../mixins/index";
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
......
/* components/loadding/loadding.wxss */
.loadding {
height: 100vh;
font-weight: 500;
font-size: 48rpx;
color: #2D2D33;
text-align: center;
margin-top: 340rpx;
&-img {
width: 432rpx;
height: 300rpx;
margin-bottom: 50rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--components/loadding/loadding.wxml-->
<view class="loadding">
<glsx-image custom-class="loadding-img" src="home/loadding.webp" />
<view>努力加载中</view>
</view>
// packagesList/pages/productDetail/components/proDetail/proDetail.js
import { senceData, productData1 } from '~/pages/tab/index/constant/senceData'
const norTabList = ['项目亮点', '合作案例', '合作方式', '适配产品']
import { componentsMixin } from "../../mixins/index";
Component({
externalClasses: ['custom-class'],
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
// 场景值下标
actNum: {
type: Number,
value: -1,
observer(n) {
this.getInfo()
this.getImgHeight()
}
},
// 选中的产品
activeNavIdx: {
type: Number,
value: 0
},
cardInfo: {
type: Object,
value: {}
},
// 配置url
activeUrl: {
type: String,
value: ''
},
detailType: {
type: String,
value: 'pro'
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
productData: productData1,
proInfo: {},
prodItemVideo: '', //选中的场景下的video的第一个
tabAct: 0,
scrollTop: 0,
showCard: false,
tabList: []
},
/**
* 组件的方法列表
*/
methods: {
getInfo() {
let { activeNavIdx, actNum } = this.data
console.log(actNum)
console.log(activeNavIdx)
const spcList = [99, 4] // 订阅模块需要特殊处理
console.log(productData1, 'productData')
const senceList = productData1[actNum].filter(item => item.name != '全部')
console.log(senceList)
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = item?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
console.log(item, 'item----')
//console.log(item.productList.find(k => k.id == activeNavIdx))
let proInfo = item.productList.find(k => k.id == activeNavIdx)
this.setData({
proInfo,
productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : item.productImgs,
tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
prodItemVideo: item.videoList.length ? spcList.includes(actNum) ?item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
})
console.log(this.data.productImgs, proInfo)
// console.log(this.data.prodItemVideo, 'prodItemVideo--------')
break
}
}
},
getImgHeight() {
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let imgTopArr = []
let s = 0
let top
let { scrollTop } = this.data
let _this = this
query
.selectAll('.img-item')
.boundingClientRect(react => {
react.forEach((item, index) => {
//44 tab的高度
// console.log('item',item)
s = item.top - 44 + scrollTop
imgTopArr.push(s)
})
_this.setData({
imgTopArr
})
})
.exec()
// setTimeout(() => {
// console.log('imgTopArr',this.data.imgTopArr)
// },500)
},
// 1.3查看活动详情按钮
checkActive() {
// 跳转
// console.log('跳转')
let { activeUrl } = this.data
wx.$router.jumpH5(activeUrl);
},
onClickTab(event) {
// console.log('event: ', event);
let { index } = event.detail
// console.log('index: ', index);
this.setData({
tabAct: index
})
let { imgTopArr } = this.data
wx.pageScrollTo({
scrollTop: imgTopArr[index] + 5
})
},
pageSroll(e) {
let { imgTopArr } = this.data
wx.nextTick(() => {
let idx
if (imgTopArr[0] > e.scrollTop) {
idx = 0
} else if (imgTopArr[imgTopArr.length - 1] > e.scrollTop && imgTopArr[0] < e.scrollTop) {
idx = imgTopArr.findIndex(item => item > e.scrollTop) - 1
} else {
idx = imgTopArr.length - 1
}
this.setData({
tabAct: idx,
scrollTop: e.scrollTop
})
})
},
selectCard() {
this.setData({
showCard: !this.data.showCard
})
},
// 长按图片
handleLongPress(e) {
let { actnum, index } = e.target.dataset
// 膨胀金活动,合作方式
if (actnum == 4 && index == 4) {
wx.$router.jumpH5('https://scrm.glsx.com.cn/frontpdf/expand_agreement.pdf');
}
}
}
})
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"user-info": "../UserInfo/UserInfo"
}
} }
\ No newline at end of file \ No newline at end of file
/* packagesList/pages/productDetail/components/proDetail/proDetail.wxss */
page {
background-color: #fff;
}
.view-prod {
.frame {
margin: 16rpx 32rpx;
width: calc(100% - 64rpx);
height: 422rpx;
border-radius: 16rpx;
box-sizing: border-box;
}
.title-wrap {
margin-bottom: 32rpx;
margin-left: 32rpx;
margin-right: 32rpx;
display: flex;
height: 104rpx;
align-items: center;
.title {
width: 564rpx;
height: 48rpx;
font-weight: 500;
font-size: 32rpx;
color: #323436;
// line-height: 48rpx;
}
.check {
margin-left: 30rpx;
margin-right: 6rpx;
width: 28rpx;
height: 28rpx;
}
.num {
font-size: 24rpx;
color: #5a6066;
}
}
.no-video {
margin: 16rpx auto 32rpx;
display: block;
width: 686rpx;
height: 386rpx;
border-radius: 16rpx;
}
.tab-wrap {
position: sticky;
top: 0;
margin-bottom: 20rpx;
z-index: 1;
.tabs-index--van-tabs {
top: -1px
}
.van-tab {
font-size: 28rpx;
color: #5a6066;
}
.van-tab--active {
font-weight: 600;
font-size: 28rpx;
color: #3666fe;
}
frame .van-tabs__line {
width: 112rpx !important;
height: 4rpx !important;
}
}
.prod-detail {
.occupancy {
height: 120rpx;
}
.img-item {
position: relative;
width: 100%;
}
.phone {
position: absolute;
top: 60rpx;
right: 32rpx;
font-weight: 400;
font-size: 24rpx;
color: #6C6C6C;
display: flex;
align-items: center;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 6rpx;
}
}
.check-act {
position: absolute;
bottom: 94rpx;
right: 60rpx;
font-size: 24rpx;
color: #3666FE;
text-decoration: underline;
}
.more-btn {
position: absolute;
left: 50%;
bottom: 50px;
transform: translateX(-50%);
width: 622rpx;
height: 96rpx;
background-image: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/btn.png");
background-size: 100% 100%;
font-weight: 500;
font-size: 16px;
color: #ffffff;
text-align: center;
line-height: 96rpx;
}
// .img-item0 {
// width: 100%;
// height: 2564rpx;
// }
// .img-item1 {
// width: 100%;
// height: 1812rpx;
// }
// .img-item2 {
// width: 100%;
// height: 620rpx;
// }
// .img-item3 {
// width: 100%;
// height: 2156rpx;
// }
// 流程图一
.img-item00 {
width: 100%;
height: 3308rpx;
}
.img-item01 {
width: 100%;
height: 2598rpx;
}
.img-item02 {
width: 100%;
height: 490rpx;
}
.img-item03 {
width: 100%;
height: 688rpx;
}
// // 流程图二
.img-item10 {
width: 100%;
height: 1488rpx;
}
.img-item11 {
width: 100%;
height: 2192rpx;
}
.img-item12 {
width: 100%;
height: 490rpx;
}
.img-item13 {
width: 100%;
height: 688rpx;
}
// // 流程图三
.img-item20 {
width: 100%;
height: 1488rpx;
}
.img-item21 {
width: 100%;
height: 570rpx;
}
.img-item22 {
width: 100%;
height: 490rpx;
}
.img-item23 {
width: 100%;
height: 864rpx;
}
// // 流程图四
.img-item30 {
width: 100%;
height: 5758rpx;
}
.img-item31 {
width: 100%;
height: 1812rpx;
}
.img-item32 {
width: 100%;
height: 490rpx;
}
.img-item33 {
width: 100%;
height: 2002rpx;
}
.img-item46 {
width: 100%;
height: 1684rpx;
}
.img-item47 {
width: 100%;
height: 3688rpx;
}
// .img-item48 {
// width: 100%;
// height: 4004rpx;
// }
.img-item48 {
width: 100%;
height: 472rpx;
}
.img-item49 {
width: 100%;
height: 4594rpx;
}
.img-item50 {
width: 100%;
height: 1650rpx;
}
.img-item51 {
width: 100%;
height: 552rpx;
}
.img-item52 {
width: 100%;
height: 4360rpx;
}
.img-item53 {
width: 100%;
height: 1130rpx;
}
.img-item54 {
width: 100%;
height: 428rpx;
}
.img-item40 {
height: 1564rpx;
}
.img-item41 {
height: 1224rpx;
}
.img-item42 {
height: 1148rpx;
}
.img-item43 {
height: 3504rpx;
}
.img-item44 {
height: 2220rpx;
}
.img-item45 {
height: 1092rpx;
}
}
}
/* 用户授权 */
.user-profile {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 3;
background-color: transparent;
}
.pro-head {
position: relative;
.select-card {
position: absolute;
right: 0;
top: 26rpx;
width: 142rpx;
height: 68rpx;
background: #FFFFFF;
box-shadow: 0 6rpx 16rpx 0 rgba(175, 175, 219, 0.65);
border-radius: 34rpx 0 0 34rpx;
z-index: 2;
display: flex;
align-items: center;
padding: 12rpx;
box-sizing: border-box;
font-weight: 600;
font-size: 26rpx;
color: #57578A;
.icon-card {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml -->
<view class="view-prod custom-class">
<view class="pro-head">
<view class="select-card" wx:if="{{detailType == 'pro'}}" bindtap="selectCard">
<glsx-image custom-class="icon-card" src="home/icon-card.png"></glsx-image>
<view>{{showCard ? '视频' : '名片'}}</view>
</view>
<!-- 有视频 -->
<block wx:if="{{!showCard}}">
<video class="frame" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}" />
<image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" />
<view class="title-wrap">
<view class="title">{{prodItemVideo.name}}</view>
<image class="check" wx:if="{{actNum != 2}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{actNum != 2}}">{{prodItemVideo.view}}</view>
</view>
</block>
<user-info wx:if="{{detailType == 'pro' && showCard}}" class="card-info" cardInfo="{{cardInfo}}"></user-info>
</view>
<view class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab wx:for="{{tabList}}" title="{{item}}" wx:key="idnex" />
<!-- <van-tab title="合作案例" />
<van-tab title="合作方式" />
<van-tab title="适配产品" /> -->
</van-tabs>
</view>
<view class="prod-detail">
<block wx:for="{{productImgs}}" wx:key="index">
<image webp wx:if="{{ index < 3}}" webp class="img-item {{item.className?item.className:''}} img-item{{index}} img-item{{actNum}}{{index}}" src="{{item.url?item.url:item}}?v={{img_version}}">
<block wx:if="{{ index == 0}}">
<!-- && phone -->
<view class="phone" bindtap="phoneCall" data-phone="{{phone}}">
<!-- <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image> -->
<!-- <glsx-image webp src="index/phone.png" class="icon" />
请联系我 -->
<view style="color:#3666fe">{{sharephone}}</view>
</view>
</block>
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 1 && actNum == 3 && activeUrl}}">
<view class="check-act" bindtap="checkActive">点击查看活动页面</view>
<!-- <button class="check-act" type="default" plain="true" bindtap="checkActive">查看活动详情</button> -->
</block>
<!-- 获取更多详情 -->
<block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情
</button>
</block>
</image>
<image webp wx:if="{{ index >= 3 && !showLeftFlag}}" webp class="img-item {{item.className?item.className:''}} img-item{{index}} img-item{{actNum}}{{index}}" src="{{item.url?item.url:item}}?v={{img_version}}" bindlongpress="handleLongPress" data-actnum="{{actNum}}" data-index="{{index}}" />
</block>
<view class="occupancy" wx:if="{{!isShare}}">
<!-- padding底部 占位元素 -->
</view>
</view>
</view>
<!-- 申请按钮 不是分享出去的显示按钮 -->
<!-- <apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button> -->
<!-- 授权昵称 -->
<!-- <view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view> -->
\ No newline at end of file \ No newline at end of file
/* components/scene/scene.wxss */
.fold-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
padding-left: 32rpx;
}
.product-tab-box {
display: flex;
margin-bottom: 38rpx;
}
.fold-box {
padding: 44rpx 16rpx;
}
.item-wrap {
position: relative;
/* width: 160rpx; */
width: calc(100%/4);
height: 152rpx;
border-radius: 12rpx;
margin-right: 12rpx;
}
.item-wrap:last-child {
margin-right: 0
}
.act {
border: 2rpx solid #5850FF;
}
.act::after {
position: absolute;
left: 50%;
bottom: -15rpx;
display: block;
content: "";
width: 14rpx;
height: 14rpx;
border-bottom: 2rpx solid #5850FF;
border-right: 2rpx solid #5850FF;
transform: rotate(45deg) translateX(-50%);
background-color: #fff;
}
.fold-scene-item {
/* width: 160rpx; */
width: 100%;
height: 152rpx;
background: #F7F7FC;
border-radius: 12rpx;
text-align: center;
}
.fold-scene-item-active {
background-image: linear-gradient(145deg, #E6E6FF 0%, #FFFFFF 73%);
}
.fold-img {
width: 56rpx;
height: 56rpx;
margin-top: 20rpx;
}
.product-item-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
line-height: 44rpx;
margin-top: 4rpx;
}
.product-item-title-active {
color: #5850FF;
}
// .product-item-type {
// font-family: PingFangSC-Regular;
// font-weight: 500;
// font-size: 17rpx;
// color: #323436;
// letter-spacing: 0;
// text-align: center;
// line-height: 24rpx;
// }
// .product-item-type-active {
// color: #807AFF;
// }
.fold-tip {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 22rpx;
color: #6E6E7A;
}
.fold-product {
display: flex;
flex-wrap: wrap;
padding: 36rpx 16rpx 64rpx 16rpx;
}
.item {
/* width: 216rpx; */
width: calc((100% - 24rpx)/3);
height: 64rpx;
background: #F5F5FA;
border-radius: 8rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
margin-right: 12rpx;
margin-bottom: 20rpx;
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.item-subscrib {
width: calc((100% - 24rpx)/2);
}
.item:nth-child(3n) {
margin-right: 0;
}
.item-selected {
color: #5850FF;
font-weight: 600;
border: 2rpx solid #9B96FF;
}
.selected-img {
width: 30rpx;
height: 22rpx;
position: absolute;
top: -1rpx;
right: -1rpx;
}
\ No newline at end of file \ No newline at end of file
<!--components/scene/scene.wxml-->
<block wx:if="{{foldFlag}}">
<!-- 业务场景 -->
<view class="fold-title">业务场景</view>
<view class="product-tab-box fold-box">
<view wx:for="{{selectApply == 0 ? productTabList : productSubscribTabList}}" wx:key="index" class="item-wrap {{item.id == sceneNum ? 'act':''}}" bindtap="selectScene" data-item="{{item}}">
<view class="fold-scene-item {{item.id == sceneNum ? 'fold-scene-item-active':''}}">
<image class="fold-img" mode="widthFix" webp src="{{IMGURL}}application/{{item.url}}.png?v={{img_version}}"></image>
<view class="product-item-title {{item.id == sceneNum ? 'product-item-title-active':''}}">
{{item.title}}
</view>
</view>
</view>
</view>
<!-- 选择产品 -->
<block wx:if="{{sceneNum}}">
<view>
<text class="fold-title">选择产品</text>
<text class="fold-tip">(可多选)</text>
</view>
<view class="fold-product">
<!-- 增值转化 -->
<block wx:if="{{selectApply == 0}}">
<block wx:for="{{productList[sceneName]}}">
<view class="item {{item.isSelect ? 'item-selected': ''}}" bindtap="selectScenePro" data-index="{{index}}">
<view>{{item.nameZh}}</view>
<image wx:if="{{item.isSelect}}" class="selected-img" mode="widthFix" webp src="{{IMGURL}}application/selected_icon.png?v={{img_version}}"></image>
</view>
</block>
</block>
<!-- 系统订阅 -->
<block wx:if="{{selectApply == 1}}">
<block wx:for="{{productSubscibList[sceneName]}}">
<view class="item item-subscrib {{item.isSelect ? 'item-selected': ''}}" bindtap="selectScenePro" data-index="{{index}}">
<view>{{item.nameZh}}</view>
<image wx:if="{{item.isSelect}}" class="selected-img" mode="widthFix" webp src="{{IMGURL}}application/selected_icon.png?v={{img_version}}"></image>
</view>
</block>
</block>
</view>
</block>
</block>
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--components/shareBtn/shareBtn.wxml-->
<button class="btn-share" open-type="share">
<image class="btn-icon" mode="widthFix" webp src="{{IMGURL}}image/productDetail/equity/share.png?v={{img_version}}" />
<text>分享此页面</text>
</button>
\ No newline at end of file \ No newline at end of file
/* components/shareBtn/shareBtn.wxss */
.btn-icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
.btn-share {
display: flex;
justify-content: center;
align-items: center;
height: 72rpx;
line-height: 72rpx;
font-size: 28rpx;
color: #FFFFFF;
background: #5850FF;
background-image: linear-gradient(180deg, #4791FF 0%, #5850FF 100%, #643DFF 100%);
border-radius: 8rpx;
margin: 0 48rpx;
}
\ No newline at end of file \ No newline at end of file
module.exports = Behavior({
methods: {
/** 跳转门店助手 */
toStoreMiniProgram () {
wx.$util.getMockConfig().then(({storeParams, storeappId}) => {
console.log(storeParams, storeappId)
wx.navigateToMiniProgram({
appId: storeappId,
path: 'packageStoreAssistant/packageAuth/pages/authentication/loading/loading',
extraData: storeParams,
envVersion: 'trial',
success(res) {
console.log(res, storeParams)
// 打开成功
}
})
})
},
/** 跳转生意助手 */
toBusinessMiniProgram (){
wx.$util.getMockConfig().then(({businessParams, businessappId}) => {
console.log(businessParams, businessappId)
wx.navigateToMiniProgram({
appId: businessappId,
path: 'login/loading/loading',
extraData: businessParams,
envVersion: 'trial',
success(res) {
// 打开成功
}
})
})
}
}
})
\ No newline at end of file \ No newline at end of file
import componentsMixin from './componentsMixin' import componentsMixin from './componentsMixin'
import menuMixin from './menuMixin'
import shareTrackMixin from './shareTrackMixin' import shareTrackMixin from './shareTrackMixin'
import commonMixin from './commonMixin'
module.exports = { module.exports = {
componentsMixin, componentsMixin,
menuMixin, shareTrackMixin,
shareTrackMixin commonMixin
} }
\ No newline at end of file \ No newline at end of file
import { trackData } from "../utils/data";
module.exports = Behavior({
data: {
menuList: ["企微魔方", "数字化权益", "智能线索", "D+增值转化"],
templateMethods: [{"tap": "selectIntroduce"}],
curIntroduceIndex: 0,
menuTab: [trackData.CUBE,trackData.EQUITY,trackData.CLUE],
clueAutoplay: true
},
methods: {
// 0-企微魔方 1-数字化权益 2-智能线索 3-D+增值转化
selectIntroduce(e) {
const curIntroduceIndex = e.currentTarget.dataset.index;
this.setData({
clueAutoplay: false
})
switch(curIntroduceIndex) {
case 3:
wx.$router.go('scene');
// wx.$router.go('addTransform', {notIntercept: true});
// wx.showToast({
// title: '敬请期待',
// icon: 'none'
// })
wx.$Track.sendTrack(trackData.DIJIA)
break
case 2:
this.setData({
curIntroduceIndex: curIntroduceIndex,clueAutoplay: true
})
wx.$Track.sendTrack(this.data.menuTab[this.data.curIntroduceIndex]);
break
default:
this.setData({
curIntroduceIndex: curIntroduceIndex,
});
wx.$Track.sendTrack(this.data.menuTab[this.data.curIntroduceIndex]);
break
}
},
},
});
\ No newline at end of file \ No newline at end of file
{
"name": "ai-card",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vant/weapp": {
"version": "1.10.9",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.9.tgz",
"integrity": "sha512-hFJ48SCSvRgcwT/9TcxwNnNnWSpy2BpaBfwQwVdU6uwgFH+2OqGL435VQN7EDpIMH8YjHbiM84hueTyxAzIPqQ=="
},
"glsx-applet-component": {
"version": "1.0.40",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.40.tgz",
"integrity": "sha512-ZqThscIToW/UfNWN1XYRa/+9C0P5J0UJYAuF0kiLjfyQx0ToaBEwfsXOO66EXZKxmDf9mOh+GoDEddLxcJ/6/w=="
}
}
}
{
"name": "ai-card",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.10.9",
"glsx-applet-component": "^1.0.40"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://huyue@192.168.3.233:8090/saas/mini-program/ai-card.git"
},
"author": "",
"license": "ISC"
}
// pages/productDetail/ambientLighting/ambientLighting.js // packagesList/pages/activityApply/activityApply.js
import {
entmicroApi
} from "../../../api/api";
import util from "../../../utils/util"
import { trackData } from "../../../utils/data"; import { trackData } from "../../../utils/data";
import {shareTrackMixin} from "../../../mixins/index";
Page({ Page({
behaviors: [shareTrackMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
isStaff: false
},
// 提交表单
submitApply() {
wx.$util.showLoading("提交中...");
let validFlag = this.selectComponent("#applyForm").validateForm();
console.log(validFlag);
if (!validFlag) return
let params = JSON.parse(JSON.stringify(validFlag))
params.cardId = wx.$storage.get("scene").cardId;
params.merchant =
wx.$storage.get("scene").merchant ||
wx.$storage.get("scene").merchantId;
params.openId = wx.$storage.get("aicard_info").openId;
params.unionId = wx.$storage.get("aicard_info").unionId;
console.log(params);
entmicroApi.activityApply(params).then(({
data,
code,
message
}) => {
if (code == 0) {
wx.hideLoading();
wx.showToast({
msg: "提交成功",
});
wx.$router.go("applySuccess");
} else {
wx.hideLoading();
wx.showToast({
title: message,
icon: "none",
});
}
});
},
toCesuan() {
wx.$router.go("measure");
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if (util.getUserInfo() && util.getUserInfo().phone) {
console.log(util.getUserInfo().phone)
let params = {
phone: util.getUserInfo().phone
}
entmicroApi.checkPhone(params).then(res => {
console.log(res);
this.setData({
isStaff: res.data
})
})
}
}, },
/** /**
...@@ -36,7 +89,7 @@ Page({ ...@@ -36,7 +89,7 @@ Page({
.login() .login()
.then(({ data }) => { .then(({ data }) => {
if (!wx.$trackData.detailShare) { if (!wx.$trackData.detailShare) {
wx.$Track.sendTrack(trackData.LIGHT) wx.$Track.sendTrack(trackData.ACTIVITYAPPLICATION);
} }
}); });
}, },
...@@ -73,11 +126,6 @@ Page({ ...@@ -73,11 +126,6 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
this.shareTrack('LIGHT', 'ambientLighting')
// let merchant = util.getStorageSync("scene").merchant || util.getStorageSync("scene").merchantId
// return {
// title: trackData.LIGHT.pageName,
// path: 'pages/productDetail/ambientLighting/ambientLighting?cardId=' + util.getStorageSync('scene').cardId+"&merchant="+merchant+'&detailShare=' +trackData.LIGHT.pageName
// }
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": { "usingComponents": {
"apply-content": "../../components/CooperationApply/CooperationApply" "CooperationApply" : "../../../components/CooperationApply/CooperationApply"
}, },
"navigationBarTitleText": "活动申请" "navigationBarTitleText": "活动申请"
} }
\ No newline at end of file \ No newline at end of file
/* packagesList/pages/activityApply/activityApply.wxss */
.apply-main {
position: relative;
}
.top-img {
width: 750rpx;
height: 320rpx;
}
.apply-box {
width: 750rpx;
// height: 664rpx;
background-image: linear-gradient(179deg, #D5DEFC 0%, #FEFEFE 100%);
display: flex;
flex-direction: column;
}
.cooperation {
align-self: center;
}
/* 选中后的背景样式*/
/*按钮的大小*/
label {
font-size: 28rpx;
}
radio .wx-radio-input {
width: 22rpx;
height: 22rpx;
border-radius: 50%;
}
radio .wx-radio-input.wx-radio-input-checked {
/* 背景颜色 */
background-color: #fff !important;
/* 边框颜色 */
border-color: #5850FF !important;
}
/* 选中后的实心样式*/
radio .wx-radio-input.wx-radio-input-checked::before {
/* 将对号去掉 */
content: '';
/*实心圆圈的大小*/
width: 18rpx;
height: 18rpx;
line-height: 18rpx;
text-align: center;
/*将圆角设置成50%才是一个圆*/
border-radius: 50%;
/*圆圈颜色*/
background-color: #5850FF;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
.submit-btn {
position: fixed;
bottom: 32rpx;
left: 48rpx;
width: 622rpx;
height: 80rpx;
background: #5850FF;
border-radius: 8rpx;
text-align: center;
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
font-family: PingFangSC-Medium;
line-height: 80rpx;
}
.caculate-box {
position: absolute;
top: 230rpx;
left: 32rpx;
display: flex;
align-items: center;
justify-content: center;
width: 228rpx;
height: 64rpx;
background: #5850FF;
box-shadow: 0 6rpx 24rpx 0 rgba(175, 181, 219, 0.40);
border-radius: 32rpx;
.caculate-img {
width: 36rpx;
height: 36rpx;
margin-right: 16rpx;
}
.caculate-text {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
}
}
\ No newline at end of file \ No newline at end of file
<!--packagesList/pages/activityApply/activityApply.wxml-->
<view class="apply-main">
<image class="top-img" mode="widthFix" webp src="{{IMGURL}}application/application_top.png?v={{img_version}}"></image>
<view class="apply-box">
<view class="cooperation">
<CooperationApply id="applyForm"></CooperationApply>
</view>
</view>
<button class="submit-btn" bindtap="submitApply">提交申请</button>
<!-- 展业测算 -->
<view class="caculate-box" wx:if="{{isStaff}}" bindtap="toCesuan">
<image class="caculate-img" mode="widthFix" webp src="{{IMGURL}}application/caculate_icon.png?v={{img_version}}"></image>
<text class="caculate-text">展业测算</text>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// pages/addTransform/index/index.js // packagesList/pages/activityDetail/activityDetail.js
import pageData from '../constant/data'
import { entmicroApi } from "../../../api/api";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
editForm: { activityInfo: {},
sales: 100, hasPhoneNumber: false,
userNum: 10000 autoplay: true
}, },
actualForm: {
sales: 100, toActivity(){
userNum: 10000 // wx.$util.getMockConfig().then(({businessParams, businessappId}) => {
}, // console.log(businessParams, businessappId)
IMGURL: wx.$imgUrl, const { activityInfo } = this.data
height: 'calc(100vh - 100rpx)', wx.navigateToMiniProgram({
tagIndex: 0, appId: 'wxe10067a63c1856ac',
tabList: pageData.tabList, path: 'pages/crowdfunding/index/index?id=' + activityInfo.crowdFundActivityId + '&merchantId=' + activityInfo.merchantNo,
introduceObj: {}, envVersion: 'trial',
cardList: [], success(res) {
// 玩法介绍 console.log(res, storeParams)
introduceVisible: false, // 打开成功
introduceList: pageData.introduceList, }
// 产品详情 })
detailKeyList: Object.keys(pageData.addDatailObj)
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options)
if (options && options.id) {
wx.$trackData = options
wx.$storage.set('scene', options)
this.getActivityDetail(options.id)
this.setData({
hasPhoneNumber: true // 不需要授权
})
} else {
wx.$router.getData(res => {
console.log(res)
this.getActivityDetail(res.id)
this.setData({
hasPhoneNumber: res.hasPhoneNumber
})
})
}
},
getActivityDetail(id) {
entmicroApi.getActivityDetail({id}).then(res => {
console.log(wx.$util.iosTimeFormat(res.beginTime), new Date(wx.$util.iosTimeFormat(res.beginTime)).format('yyyy年MM月dd日'))
res.beginTime = new Date(wx.$util.iosTimeFormat(res.beginTime)).format('yyyy年MM月dd日')
res.endTime = new Date(wx.$util.iosTimeFormat(res.endTime)).format('yyyy年MM月dd日')
wx.$Track.sendTrack({
pageKey: res.crowdFundActivityId,
pageName: res.activityName
})
this.setData({
activityInfo: res
})
})
},
handleplay() {
this.setData({ this.setData({
introduceObj: this.data.tabList[this.data.tagIndex].introduce, autoplay: false
cardList: this.data.tabList[this.data.tagIndex].cardList
}) })
}, },
handlepause() {
this.setData({
autoplay: true
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -83,55 +122,13 @@ Page({ ...@@ -83,55 +122,13 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
const shareType = 'ACTIVITY'
}, const {id} = this.data.activityInfo
const cardId = wx.$storage.get('scene').cardId
handleInput(e) { const merchant = wx.$storage.get('scene').merchant || wx.$storage.get('scene').merchantId
const attr = e.target.dataset.attr return {
this.setData({ title: `您好,我向你分享了一个活动~`,
[`${attr}`]: e.detail.value path: `packagesList/pages/activityDetail/activityDetail?id=${id}&shareType=${shareType}&cardId=${cardId}&merchant=${merchant}`
})
},
handleTabClick(e) {
let {
index,
introduce,
cardList
} = e.detail
let {
tagIndex
} = this.data
if (index == tagIndex) return
this.setData({
tagIndex: index,
introduceObj: introduce || {},
cardList: cardList || []
})
},
handleCardClick(e) {
var obj = e.detail
if(!this.data.detailKeyList.includes(obj.detailAttrName)) {
wx.$util.showToast('敬请期待')
return true
} }
wx.$router.go('addTransformDetail', { proName: obj.proName, attrName: obj.detailAttrName })
},
handleIntroduceClick() {
this.handleIntroduceClose()
},
handleIntroduceClose() {
this.setData({
introduceVisible: !this.data.introduceVisible
})
},
handleConfirm() {
this.setData({
actualForm: this.data.editForm
})
} }
}) })
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!