Commit 21d9f6eb by 前端

Merge branch 'develop' into 'zhangxw_dev_3.0'

Develop

See merge request !5
2 parents 22b3b2b2 76ae7ca4
...@@ -6,7 +6,7 @@ page { ...@@ -6,7 +6,7 @@ page {
color: #282829; color: #282829;
font-size: 28rpx; font-size: 28rpx;
--themeColor: #F13C3D; --themeColor: #F13C3D;
--btnColor: #FC5B32; --btnColor: #3666FE;
--borderRadius: 8rpx; --borderRadius: 8rpx;
--margin: 32rpx; --margin: 32rpx;
} }
......
// 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: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -60,13 +54,8 @@ Component({ ...@@ -60,13 +54,8 @@ Component({
*/ */
noScroll: wx.$util.noScroll(), noScroll: wx.$util.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,9 @@ Component({ ...@@ -128,12 +113,9 @@ Component({
} }
}) })
} }
}, },
/**授权手机号 */ /**授权手机号 */
getPhoneNumber({ getPhoneNumber({ detail }) {
detail
}) {
console.log(detail) console.log(detail)
this.triggerEvent('getphonenumber', detail) this.triggerEvent('getphonenumber', detail)
} }
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
import Calendar from './Calendar_Function' import Calendar from './Calendar_Function'
import _component_ from './Static_Properties' import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction') const CalendarFunction = Symbol('CalendarFunction')
import {componentsMixin } from '../../mixins/index'
Component({ Component({
// behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -24,7 +22,7 @@ Component({ ...@@ -24,7 +22,7 @@ Component({
this[CalendarFunction].setCalenderBodyHeight() this[CalendarFunction].setCalenderBodyHeight()
}, },
showCalendar(e) { showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || '' let type = (e && e.currentTarget && e.currentTarget.dataset.type) || ''
let result = type === 'show' let result = type === 'show'
if (!result) { if (!result) {
this.setData({ this.setData({
...@@ -44,29 +42,19 @@ Component({ ...@@ -44,29 +42,19 @@ Component({
} }
}, },
dateChange(e) { dateChange(e) {
let { let { current } = e.detail
current
} = e.detail
this.setData({ this.setData({
current current
}) })
}, },
choose(e) { choose(e) {
let { let { dateType, minDate, maxDate } = this.data
dateType, let { data } = e.currentTarget.dataset
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 if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e) this[CalendarFunction][dateType](e)
}, },
done() { done() {
let { let { dateType } = this.data
dateType
} = this.data
this[CalendarFunction].done(dateType) this[CalendarFunction].done(dateType)
}, },
changeDate(e) { changeDate(e) {
......
// components/navigationBar/navigationBar.js // components/navigationBar/navigationBar.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
// behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -40,18 +36,9 @@ Component({ ...@@ -40,18 +36,9 @@ Component({
* 获取自定义导航栏信息 * 获取自定义导航栏信息
*/ */
wx.getSystemInfo().then(res => { wx.getSystemInfo().then(res => {
let { let { fontSizeSetting, statusBarHeight, screenWidth } = res
fontSizeSetting, const { height, right, width, top } = wx.getMenuButtonBoundingClientRect()
statusBarHeight, let navigationBarHeight = height + (top - statusBarHeight) * 2 + 4 // 4
screenWidth
} = res
const {
height,
right,
width,
top
} = wx.getMenuButtonBoundingClientRect()
let navigationBarHeight = height + ((top - statusBarHeight) * 2) + 4 // 4
let navigationBarPadding = screenWidth - right let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width
this.setData({ this.setData({
...@@ -66,10 +53,7 @@ Component({ ...@@ -66,10 +53,7 @@ Component({
}) })
}) })
}, },
emit({ emit({ navigationBarHeight, statusBarHeight }) {
navigationBarHeight,
statusBarHeight
}) {
let navHeight = navigationBarHeight + statusBarHeight let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.$router.getPageInstance() const thisPage = wx.$router.getPageInstance()
const currentPages = getCurrentPages() const currentPages = getCurrentPages()
...@@ -84,7 +68,8 @@ Component({ ...@@ -84,7 +68,8 @@ Component({
navHeight, navHeight,
statusBarHeight statusBarHeight
}) })
if (currentPages.length == 1 && !thisPage.rootName) thisPage.setData({ if (currentPages.length == 1 && !thisPage.rootName)
thisPage.setData({
showHomeBtn: true showHomeBtn: true
}) })
} }
......
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js // tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -30,7 +26,6 @@ Component({ ...@@ -30,7 +26,6 @@ Component({
hideTab hideTab
}) })
} }
} }
}, },
title: String, title: String,
...@@ -47,9 +42,7 @@ Component({ ...@@ -47,9 +42,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -66,11 +59,9 @@ Component({ ...@@ -66,11 +59,9 @@ Component({
} }
}, },
attached() { attached() {
const { const { isTab } = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
isTab
} = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
this.setData({ this.setData({
isTab isTab
}) })
}, }
}) })
// components/SearchBox/SearchBox.js // components/SearchBox/SearchBox.js
import {componentsMixin } from '../../mixins/index';
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
placeholder: { placeholder: {
type: String, type: String,
value: "请输入搜索内容", value: '请输入搜索内容'
}, },
value: { value: {
type: String, type: String,
value: "", value: '',
observer(n) { observer(n) {
this.setData({ this.setData({
inputValue: n, inputValue: n
}); })
}, }
}, },
searchType: { searchType: {
type: Number, type: Number,
value: 1, value: 1
}, },
couponDetails: Boolean, couponDetails: Boolean
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
inputValue: "", inputValue: ''
}, },
/** /**
...@@ -38,29 +36,29 @@ Component({ ...@@ -38,29 +36,29 @@ Component({
*/ */
methods: { methods: {
input(e) { input(e) {
let { value } = e.detail; let { value } = e.detail
this.setData({ this.setData({
inputValue: value, inputValue: value
}); })
}, },
blur(e) { blur(e) {
let { inputValue } = this.data; let { inputValue } = this.data
this.setData({ this.setData({
inputValue, inputValue
}); })
}, },
clear() { clear() {
this.setData({ this.setData({
inputValue: "", inputValue: ''
}); })
}, },
confirm(e) { confirm(e) {
let { value } = e.detail; let { value } = e.detail
this.triggerEvent("search", value); this.triggerEvent('search', value)
}, },
search(e) { search(e) {
let { value } = e.currentTarget.dataset; let { value } = e.currentTarget.dataset
this.triggerEvent("search", value); this.triggerEvent('search', value)
}, }
}, }
}); })
// components/SearchInput/SearchInput.js // components/SearchInput/SearchInput.js
import {componentsMixin } from '../../mixins/index'
Component({ Component({
behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -22,9 +20,7 @@ Component({ ...@@ -22,9 +20,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,9 +35,7 @@ Component({ ...@@ -39,9 +35,7 @@ Component({
}) })
}, },
input(e) { input(e) {
let { let { value } = e.detail
value
} = e.detail
this.setValue(value) this.setValue(value)
this.triggerEvent('input', { this.triggerEvent('input', {
value value
...@@ -55,9 +49,7 @@ Component({ ...@@ -55,9 +49,7 @@ Component({
}, },
emit(e) { emit(e) {
let { let {
detail:{ detail: { value },
value
},
type type
} = e } = e
this.setData({ this.setData({
......
// components/Tab/Tab.js // components/Tab/Tab.js
import {componentsMixin } from '../../mixins/index'
Component({ Component({
behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -36,9 +34,7 @@ Component({ ...@@ -36,9 +34,7 @@ Component({
*/ */
methods: { methods: {
click(e) { click(e) {
let { let { count } = e.currentTarget.dataset
count
} = e.currentTarget.dataset
this.setData({ this.setData({
count, count,
to: `to-${count}` to: `to-${count}`
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
width: 100%; width: 100%;
height: 92rpx; height: 92rpx;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1rpx solid #EAEBEF;
} }
.tab-box.left{ .tab-box.left{
padding-left: 32rpx; padding-left: 32rpx;
...@@ -25,8 +26,12 @@ ...@@ -25,8 +26,12 @@
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
color: #A9A9A9; color: #8A8C90;
justify-content: center; justify-content: center;
margin: 0 24rpx;
font-weight: 400;
font-size: 28rpx;
font-family: PingFangSC-Medium;
} }
.left .text{ .left .text{
justify-content: flex-start; justify-content: flex-start;
...@@ -39,14 +44,14 @@ ...@@ -39,14 +44,14 @@
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
transition: all .25s; transition: all .25s;
color: #2C2C2C; color: var(--btnColor);
} }
.tab .line { .tab .line {
width: 48rpx; width: 48rpx;
height: var(--borderRadius); height: var(--borderRadius);
background: var(--btnColor); background: var(--btnColor);
border-radius: 2rpx; border-radius: 8rpx 8rpx 0 0;
margin: 0 auto; margin: 0 auto;
transform: scale(0); transform: scale(0);
transition: all .25s; transition: all .25s;
......
import {IMG_URL} from '~/utils/constantData'
module.exports = Behavior({
data: {
IMGURL: IMG_URL
}
})
\ No newline at end of file \ No newline at end of file
import imgUrlMixin from './imgUrl'
module.exports = { module.exports = {
imgUrlMixin
} }
// pages/tab/discovery/components/headerNav/headerNav.js
const navStyle = "background-color: transparent;";
import {imgUrlMixin} from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
navStyle,
// IMG_URL,
sceneList:['scene_talk.png','scene_delivery.png','scene_within_12mth.png','scene_more_12mth.png'],
},
navbarReady(e) {
let {
height
} = e.detail;
this.setData({
user_box_style: `padding-top:${height + 20}px`,
});
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* pages/tab/discovery/components/headerNav/headerNav.wxss */
.header{
position: relative;
width: 100%;
height: 304rpx;
margin-bottom: 80rpx;
box-shadow: 0 16rpx 16rpx 0 rgba(230, 236, 245, 0.6);
}
.scene-wrap{
position: absolute;
bottom: 0;
transform: translateY(75rpx);
white-space: nowrap;
}
.scene-item{
width: 672rpx;
height: 180rpx;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/discovery/components/headerNav/headerNav.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
</navigation-bar>
<view class="header">
<image style="width: 100%;height: 100%" src="{{IMGURL}}discovery_center_bg.png"></image>
<scroll-view class="scene-wrap" scroll-x="{{true}}">
<block wx:for="{{sceneList}}" wx:key="index">
<image class="scene-item" src="{{IMGURL}}{{item}}"></image>
</block>
</scroll-view>
</view>
// pages/tab/discovery/components/product/product.js
import {imgUrlMixin} from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
navList:['360全景导航','AR实景导航','座椅通风','氛围灯','数字化美容'],
activeNavIdx: 0,
tab:['适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程','适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程'],
heightArr:[],
curTabIdx:0,
intoViewId: 'to-0'
},
lifetimes:{
ready: function (){
console.log(11111)
this.getImgHeight()
},
},
/**
* 组件的方法列表
*/
methods: {
changeTab(e){
let idx = e.detail
this.setData({
intoViewId: `to-${idx}`
})
},
changeNav(event){
console.log(event,event.target.dataset.index,111)
this.setData({
activeNavIdx: event.target.dataset.index
})
},
scrolltoupper(event){
const idx = this.data.heightArr.findIndex(item => item>event.detail.scrollTop)
this.setData({
curTabIdx: idx
})
console.log(this.data.curTabIdx1)
},
getImgHeight(){
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let s = 0
query.selectAll('.img-item').boundingClientRect((react) => {
react.forEach(item => {
s += item.height
heightArr.push(s)
})
this.data.heightArr = heightArr
console.log( this.data.heightArr)
}).exec()
}
}
})
{
"component": true,
"usingComponents": {
"tab": "../../../../../components/Tab/Tab"
}
}
\ No newline at end of file \ No newline at end of file
// 特色产品
.prod-wrap .big-title{
margin-left: 40rpx;
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 36rpx;
color: #1B233D;
line-height: 56rpx;
}
.prod-wrap .nav-wrap{
white-space: nowrap;
box-sizing: border-box;
margin-top: 24rpx;
margin-bottom: 32rpx;
padding: 0 20rpx;
}
.prod-wrap .nav-wrap .nav{
display: inline-block;
width: 188rpx;
height: 64rpx;
border-radius: 12rpx;
font-weight: 600;
font-size: 24rpx;
letter-spacing: 0;
text-align: center;
font-family: PingFangSC-Regular;
line-height: 64rpx;
margin-right: 12rpx;
background: #FFFFFF;
border: 2rpx solid #DDE3F0;
}
.prod-wrap .nav-wrap .active-nav{
background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%);
border: 2rpx solid rgba(68,97,240,0.50);
box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35);
}
.prod-wrap .nav-wrap .nav:last-child{
margin-right: 0;
}
.prod-item{
background-color: #F5F7FB;
border-radius: 48rpx 48rpx 0 0;
padding: 40rpx 24rpx 32rpx;
}
.prod-card{
display: flex;
height: 208rpx;
background-image: linear-gradient(1deg, #FFFFFF 10%, #FDFCFF 100%);
border: 2rpx solid #FFFFFF;
box-shadow: 0 8rpx 20rpx 0 rgba(197,205,235,0.35);
border-radius: 20rpx;
padding: 20rpx 24rpx;
box-sizing: border-box;
position: relative;
}
.prod-card .card-img{
width: 160rpx;
height: 160rpx;
flex-shrink: 0;
border-radius: 4rpx;
}
.img-desc{
position: absolute;
width: 104rpx;
height: 40rpx;
line-height: 40rpx;
background: #D7F5EB;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #24B38C;
letter-spacing: 0;
text-align: center;
}
.prod-info{
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 12rpx 0;
margin-left: 24rpx;
}
.prod-info>text{
display: block;
white-space: nowrap;
height: 40rpx;
line-height: 40rpx;
}
.prod-info .title{
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
}
.prod-info .sale,.prod-info .earnings{
font-size: 26rpx;
color: #7A8299;
}
.prod-info .sale-num{
font-size: 26rpx;
color: #323436;
}
.prod-info .earnings-num{
font-size: 28rpx;
font-family: DINAlternate-Bold;
font-weight: Bold;
color: #F35251;
}
.share-btn{
height: 56rpx;
line-height: 56rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
border-radius: 12rpx;
color: #fff;
padding: 0 20rpx;
display: flex;
align-items: center;
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
}
.share-btn .icon{
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
}
.project-wrap{
background-color: #F5F7FB;
}
.project-img{
height: 500rpx;
white-space: nowrap;
.img-item{
height: 300rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/discovery/components/product/product.wxml-->
<view class="prod-wrap">
<text class="big-title">特色产品</text>
<scroll-view class="nav-wrap" scroll-x="{{true}}">
<block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block>
</scroll-view>
<view class="prod-item">
<view class="prod-card">
<view class="card-img">
<text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png"></image>
</view>
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">100</text></text>
<text class="earnings">预估收益 <text class="earnings-num">92.4 万</text></text>
</view>
<view class="share-btn">
<image class="icon" src="{{IMGURL}}share.png"></image>
<text>分享</text>
</view>
</view>
</view>
</view>
<view class="project-wrap">
<tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
<scroll-view class="project-img" scroll-into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item">
{{item}}
</view>
</block>
</scroll-view>
</view>
...@@ -7,14 +7,14 @@ Page({ ...@@ -7,14 +7,14 @@ Page({
data: { data: {
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
}, },
methods:{
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
{ {
"usingComponents": {} "usingComponents": {
"headerNav": "./components/headerNav/headerNav",
"product": "./components/product/product"
},
"navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
/* pages/tab/output/output.wxss */ /* pages/tab/output/output.wxss */
<!--pages/tab/output/output.wxml--> <view style="background: #fff;">
<text>pages/tab/output/output.wxml</text> <headerNav></headerNav>
<product></product>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/tab/discovery/discovery",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
import { IMG_URL } from '~/utils/constantData'
/** /**
* 执行路由前的准备工作 * 执行路由前的准备工作
*/ */
/**处理前置钩子逻辑 */ /**处理前置钩子逻辑 */
const routerBefore = (next) => { const routerBefore = next => {
// console.log("处理前置钩子逻辑"); // console.log("处理前置钩子逻辑");
// 配置图片全局路径
let page = wx.$router.getPageInstance()
page && (page.data.IMG_URL = IMG_URL)
next(); next()
}; }
/**处理后置钩子逻辑 */ /**处理后置钩子逻辑 */
const routerAfter = (next) => { const routerAfter = next => {
// console.log("处理后置钩子逻辑"); // console.log("处理后置钩子逻辑");
next(); next()
}; }
// 重写Page方法 // 重写Page方法
const OldPage = Page; const OldPage = Page
Page = function (options) { Page = function (options) {
const oldShow = options.onShow; const oldShow = options.onShow
const oldHide = options.onHide; const oldHide = options.onHide
options.onShow = function () { options.onShow = function () {
routerBefore(() => { routerBefore(() => {
oldShow.apply(this, arguments); oldShow.apply(this, arguments)
}); })
}; }
options.onHide = function () { options.onHide = function () {
routerAfter(() => { routerAfter(() => {
oldHide.apply(this, arguments); oldHide.apply(this, arguments)
}); })
}; }
OldPage(options); OldPage(options)
}; }
export default routerBefore; export default routerBefore
...@@ -8,10 +8,8 @@ class Draw { ...@@ -8,10 +8,8 @@ class Draw {
[_canvasObject_] = null; [_canvasObject_] = null;
[_canvas_] = null [_canvas_] = null
constructor(canvasObject) { constructor(canvasObject) {
wx.getSystemInfo().then(({ wx.getSystemInfo().then(({ pixelRatio }) => {
pixelRatio // console.log(pixelRatio)
}) => {
console.log(pixelRatio)
this[_canvasObject_] = canvasObject this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || pixelRatio || 2 this[_pixelRatio_] = canvasObject.pixelRatio || pixelRatio || 2
const height = this.toRpx(canvasObject.height), const height = this.toRpx(canvasObject.height),
...@@ -38,14 +36,7 @@ class Draw { ...@@ -38,14 +36,7 @@ class Draw {
drawImages(imageParams, callback) { drawImages(imageParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
this[_ctx_].save() this[_ctx_].save()
let { let { borderRadius, height, width, url, x, y } = imageParams
borderRadius,
height,
width,
url,
x,
y
} = imageParams
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -78,13 +69,7 @@ class Draw { ...@@ -78,13 +69,7 @@ class Draw {
if (fontSize) this[_ctx_].font = `${fontSize}px${font}` if (fontSize) this[_ctx_].font = `${fontSize}px${font}`
return this[_ctx_].measureText(text).width return this[_ctx_].measureText(text).width
} }
drawFill({ drawFill({ x, y, width, height, color }) {
x,
y,
width,
height,
color
}) {
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -97,24 +82,7 @@ class Draw { ...@@ -97,24 +82,7 @@ class Draw {
this[_ctx_].save() this[_ctx_].save()
} }
drawText(textParams) { drawText(textParams) {
let { let { textDecoration, textBaseline, lineHeight, fontWeight, textAlign, textWidth, maxWidth, fontSize, lastFont, opacity, lineNum, width, color, text, x, y } = textParams,
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
lastFont,
opacity,
lineNum,
width,
color,
text,
x,
y
} = textParams,
font = this[_ctx_].font.split('px')[1] font = this[_ctx_].font.split('px')[1]
textAlign = textAlign || 'left' textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal' textBaseline = textBaseline || 'normal'
...@@ -258,15 +226,7 @@ class Draw { ...@@ -258,15 +226,7 @@ class Draw {
} }
drawLine(lineParams, callback) { drawLine(lineParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
let { let { opacity, startX, startY, width, color, endX, endY } = lineParams
opacity,
startX,
startY,
width,
color,
endX,
endY
} = lineParams
startX = this.toRpx(startX) startX = this.toRpx(startX)
startY = this.toRpx(startY) startY = this.toRpx(startY)
width = this.toRpx(width) width = this.toRpx(width)
...@@ -283,12 +243,7 @@ class Draw { ...@@ -283,12 +243,7 @@ class Draw {
if (callback) callback() if (callback) callback()
} }
setLineY = params => { setLineY = params => {
let { let { textDecoration, textBaseline, fontSize, y } = params
textDecoration,
textBaseline,
fontSize,
y
} = params
let type = { let type = {
underline: { underline: {
top: y + fontSize, top: y + fontSize,
...@@ -312,11 +267,7 @@ class Draw { ...@@ -312,11 +267,7 @@ class Draw {
return type[textDecoration][textBaseline] return type[textDecoration][textBaseline]
} }
setLineX({ setLineX({ textAlign, text, x }) {
textAlign,
text,
x
}) {
let textWidth = this.getTextWidth(text) let textWidth = this.getTextWidth(text)
let type = { let type = {
left: x, left: x,
...@@ -326,13 +277,7 @@ class Draw { ...@@ -326,13 +277,7 @@ class Draw {
return type[textAlign] return type[textAlign]
} }
drawRadiusRect({ drawRadiusRect({ borderRadius, height, width, x, y }, callBack) {
borderRadius,
height,
width,
x,
y
}, callBack) {
let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2 let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2
radius = radius || 0 radius = radius || 0
this[_ctx_].beginPath() this[_ctx_].beginPath()
...@@ -343,12 +288,7 @@ class Draw { ...@@ -343,12 +288,7 @@ class Draw {
} }
if (callBack) callBack() if (callBack) callBack()
} }
getFontWidth({ getFontWidth({ textAlign, fontSize, text, x }) {
textAlign,
fontSize,
text,
x
}) {
let type = { let type = {
left: x, left: x,
center: x - (fontSize * text.length) / 2, center: x - (fontSize * text.length) / 2,
...@@ -358,12 +298,7 @@ class Draw { ...@@ -358,12 +298,7 @@ class Draw {
} }
drawDecoration(params) { drawDecoration(params) {
let { let { newText, opacity, y, x } = params
newText,
opacity,
y,
x
} = params
let lineX = x let lineX = x
let lineY = y let lineY = y
lineX = this.setLineX(params) lineX = this.setLineX(params)
......
import { commonApi, equityApi } from '../api/api' import { commonApi } from '../api/api'
// import {
// sopApi,
// commonApi,
// bigdatautilApi,
// equityApi
// } from '../api/api'
import $router from '../router/index' import $router from '../router/index'
/** /**
......
/** /**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: 'error',
title: '请输入手机号'
},
username: {
icon: 'error',
title: '请输入用户名'
},
password: {
icon: 'error',
title: '请输入密码'
}
}
/**
* 禁止滑动 * 禁止滑动
*/ */
const noScroll = () => {} const noScroll = () => {}
...@@ -51,6 +70,26 @@ const showToast = val => { ...@@ -51,6 +70,26 @@ const showToast = val => {
} }
return wx.showToast(obj) return wx.showToast(obj)
} }
/**
*
* @param {* string | object} name 信息名称
* @param {* object | null} [params] 信息名称参数
*/
const wxShowToast = (name, params) => {
if (arguments.length == 2) {
wx.showToast({
title: tipsObj[name]['title'],
icon: tipsObj[name]['icon'],
...params
})
} else {
wx.showToast({
...params
})
}
}
/**获取设备信息 */ /**获取设备信息 */
const getSystemInfo = callBack => { const getSystemInfo = callBack => {
wx.getSystemInfo({ wx.getSystemInfo({
...@@ -82,6 +121,7 @@ const wxApi = { ...@@ -82,6 +121,7 @@ const wxApi = {
setCopyData, setCopyData,
showToast, showToast,
phoneCall, phoneCall,
noScroll noScroll,
wxShowToast
} }
export default wxApi export default wxApi
/**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: "error",
title: "请输入手机号",
},
username: {
icon: "error",
title: "请输入用户名",
},
password: {
icon: "error",
title: "请输入密码",
},
};
/**
*
* @param {* string | object} name 信息名称
* @param {* object | null} [params] 信息名称参数
*/
const wxShowToast = (name, params) => {
if (arguments.length == 2) {
wx.showToast({
title: tipsObj[name]["title"],
icon: tipsObj[name]["icon"],
...params,
});
} else {
wx.showToast({
...params,
});
}
};
export default wxShowToast;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!