Commit f6723fa2 by 杨北旺

..

2 parents 20beb725 c564c51b
......@@ -6,7 +6,7 @@ page {
color: #282829;
font-size: 28rpx;
--themeColor: #F13C3D;
--btnColor: #FC5B32;
--btnColor: #3666FE;
--borderRadius: 8rpx;
--margin: 32rpx;
}
......
// components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
......@@ -39,7 +35,7 @@ Component({
}
},
observers: {
'show': function (newVal) {
show: function (newVal) {
this.setData({
openSet: newVal
})
......@@ -48,9 +44,7 @@ Component({
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
*/
......@@ -60,13 +54,8 @@ Component({
*/
noScroll: wx.$util.noScroll(),
cancel(e) {
let {
confirm
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let { confirm } = e.currentTarget.dataset
let { buttonType, title } = this.data
let _this = this
if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({
......@@ -87,11 +76,7 @@ Component({
/**检验是否已授权位置 */
check() {
const _this = this
let {
buttonType,
scopeType,
autoOpen
} = this.properties
let { buttonType, scopeType, autoOpen } = this.properties
if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}`
buttonType = 'openSetting'
......@@ -128,12 +113,9 @@ Component({
}
})
}
},
/**授权手机号 */
getPhoneNumber({
detail
}) {
getPhoneNumber({ detail }) {
console.log(detail)
this.triggerEvent('getphonenumber', detail)
}
......@@ -144,4 +126,4 @@ Component({
},
hide: function () {}
}
})
\ No newline at end of file
})
......@@ -2,9 +2,7 @@
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
import {componentsMixin } from '../../mixins/index'
Component({
// behaviors:[componentsMixin],
/**
* 组件的属性列表
*/
......@@ -24,7 +22,7 @@ Component({
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let type = (e && e.currentTarget && e.currentTarget.dataset.type) || ''
let result = type === 'show'
if (!result) {
this.setData({
......@@ -44,29 +42,19 @@ Component({
}
},
dateChange(e) {
let {
current
} = e.detail
let { current } = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
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
let { dateType } = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
......@@ -87,4 +75,4 @@ Component({
attached() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file
})
// components/navigationBar/navigationBar.js
import {
componentsMixin
} from '../../mixins/index'
Component({
// behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
......@@ -40,18 +36,9 @@ Component({
* 获取自定义导航栏信息
*/
wx.getSystemInfo().then(res => {
let {
fontSizeSetting,
statusBarHeight,
screenWidth
} = res
const {
height,
right,
width,
top
} = wx.getMenuButtonBoundingClientRect()
let navigationBarHeight = height + ((top - statusBarHeight) * 2) + 4 // 4
let { fontSizeSetting, statusBarHeight, screenWidth } = res
const { height, right, width, top } = wx.getMenuButtonBoundingClientRect()
let navigationBarHeight = height + (top - statusBarHeight) * 2 + 4 // 4
let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width
this.setData({
......@@ -66,10 +53,7 @@ Component({
})
})
},
emit({
navigationBarHeight,
statusBarHeight
}) {
emit({ navigationBarHeight, statusBarHeight }) {
let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.$router.getPageInstance()
const currentPages = getCurrentPages()
......@@ -84,9 +68,10 @@ Component({
navHeight,
statusBarHeight
})
if (currentPages.length == 1 && !thisPage.rootName) thisPage.setData({
showHomeBtn: true
})
if (currentPages.length == 1 && !thisPage.rootName)
thisPage.setData({
showHomeBtn: true
})
}
},
lifetimes: {
......@@ -95,4 +80,4 @@ Component({
this.setPageTitle()
}
}
})
\ No newline at end of file
})
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
......@@ -30,7 +26,6 @@ Component({
hideTab
})
}
}
},
title: String,
......@@ -47,9 +42,7 @@ Component({
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
......@@ -66,11 +59,9 @@ Component({
}
},
attached() {
const {
isTab
} = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
const { isTab } = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
this.setData({
isTab
})
},
})
\ No newline at end of file
}
})
// components/SearchBox/SearchBox.js
import {componentsMixin } from '../../mixins/index';
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
placeholder: {
type: String,
value: "请输入搜索内容",
value: '请输入搜索内容'
},
value: {
type: String,
value: "",
value: '',
observer(n) {
this.setData({
inputValue: n,
});
},
inputValue: n
})
}
},
searchType: {
type: Number,
value: 1,
value: 1
},
couponDetails: Boolean,
couponDetails: Boolean
},
/**
* 组件的初始数据
*/
data: {
inputValue: "",
inputValue: ''
},
/**
......@@ -38,29 +36,29 @@ Component({
*/
methods: {
input(e) {
let { value } = e.detail;
let { value } = e.detail
this.setData({
inputValue: value,
});
inputValue: value
})
},
blur(e) {
let { inputValue } = this.data;
let { inputValue } = this.data
this.setData({
inputValue,
});
inputValue
})
},
clear() {
this.setData({
inputValue: "",
});
inputValue: ''
})
},
confirm(e) {
let { value } = e.detail;
this.triggerEvent("search", value);
let { value } = e.detail
this.triggerEvent('search', value)
},
search(e) {
let { value } = e.currentTarget.dataset;
this.triggerEvent("search", value);
},
},
});
let { value } = e.currentTarget.dataset
this.triggerEvent('search', value)
}
}
})
// components/SearchInput/SearchInput.js
import {componentsMixin } from '../../mixins/index'
Component({
behaviors:[componentsMixin],
/**
* 组件的属性列表
*/
......@@ -22,9 +20,7 @@ Component({
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
......@@ -39,9 +35,7 @@ Component({
})
},
input(e) {
let {
value
} = e.detail
let { value } = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
......@@ -55,9 +49,7 @@ Component({
},
emit(e) {
let {
detail:{
value
},
detail: { value },
type
} = e
this.setData({
......@@ -69,4 +61,4 @@ Component({
})
}
}
})
\ No newline at end of file
})
// components/Tab/Tab.js
import {componentsMixin } from '../../mixins/index'
Component({
behaviors:[componentsMixin],
/**
* 组件的属性列表
*/
......@@ -36,9 +34,7 @@ Component({
*/
methods: {
click(e) {
let {
count
} = e.currentTarget.dataset
let { count } = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`
......@@ -46,4 +42,4 @@ Component({
this.triggerEvent('click', count)
}
}
})
\ No newline at end of file
})
......@@ -6,6 +6,7 @@
width: 100%;
height: 92rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #EAEBEF;
}
.tab-box.left{
padding-left: 32rpx;
......@@ -25,8 +26,12 @@
display: flex;
align-items: center;
box-sizing: border-box;
color: #A9A9A9;
color: #8A8C90;
justify-content: center;
margin: 0 24rpx;
font-weight: 400;
font-size: 28rpx;
font-family: PingFangSC-Medium;
}
.left .text{
justify-content: flex-start;
......@@ -39,14 +44,14 @@
font-weight: 500;
font-size: 28rpx;
transition: all .25s;
color: #2C2C2C;
color: var(--btnColor);
}
.tab .line {
width: 48rpx;
height: var(--borderRadius);
background: var(--btnColor);
border-radius: 2rpx;
border-radius: 8rpx 8rpx 0 0;
margin: 0 auto;
transform: scale(0);
transition: all .25s;
......
import {IMG_URL} from '~/utils/constantData'
module.exports = Behavior({
data: {
IMGURL: IMG_URL
}
})
\ No newline at end of file
import imgUrlMixin from './imgUrl'
module.exports = {
}
\ No newline at end of file
imgUrlMixin
}
......@@ -30,12 +30,15 @@ Page({
clickRow(e){
const {index} = e.currentTarget.dataset
console.log(index);
if(index==1){
this.setData({
showModal:true
})
return
}
wx.$router.go('packageMine.settingName.index')
},
onLoad(options) {
......
......@@ -5,6 +5,8 @@ Page({
data: {
IMGURL:IMG_URL,
},
toSumbitData(){
wx.$router.go('packageMine.withdrawalSuccess.index')
}
})
\ No newline at end of file
......@@ -13,5 +13,5 @@
<view class="btn flex_cc">全部提现</view>
</view>
</view>
<view class="sumbit_btn flex_cc">提交</view>
<view class="sumbit_btn flex_cc" bind:tap="toSumbitData">提交</view>
</view>
\ No newline at end of file
......@@ -6,5 +6,8 @@ Page({
IMGURL:IMG_URL,
},
toWatchNote(){
wx.$router.go('packageMine.withdrawalNote.index')
},
})
\ No newline at end of file
......@@ -4,7 +4,7 @@
<view class="tip_text">您的提现申请已成功提交,预计将在24小时</view>
<view class="tip_text">到达您的微信零钱,请留意到账情况</view>
<view class="btn_group flex_cc">
<view class="btn_left flex_cc">查看提现记录</view>
<view class="btn_left flex_cc" bind:tap="toWatchNote">查看提现记录</view>
<view class="btn_right flex_cc">返回我的积分</view>
</view>
</view>
\ No newline at end of file
// 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
/* 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
<!--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
// 特色产品
.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
<!--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>
......@@ -5,16 +5,16 @@ Page({
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
methods:{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
{
"usingComponents": {}
"usingComponents": {
"headerNav": "./components/headerNav/headerNav",
"product": "./components/product/product"
},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/tab/output/output.wxss */
\ No newline at end of file
/* pages/tab/output/output.wxss */
<!--pages/tab/output/output.wxml-->
<text>pages/tab/output/output.wxml</text>
<view style="background: #fff;">
<headerNav></headerNav>
<product></product>
</view>
\ No newline at end of file
......@@ -18,6 +18,11 @@ Component({
* 组件的方法列表
*/
methods: {
toTiXian(){
wx.$router.go('packageMine.withdrawal.index')
},
toWatchNote(){
wx.$router.go('packageMine.withdrawalNote.index')
},
}
})
<view style="{{boxStyle}}" class="integral_widget">
<view class="wrapper">
<image mode="widthFix" class="bg_icon" src="{{IMGURL}}intergral_bg_icon.png" />
<view class="btn_wrap flex_sc">
<view bind:tap="toTiXian" class="btn_wrap flex_sc">
<text>我要提现</text>
<image class="right_icon" src="{{IMGURL}}right_arrow_icon.png" />
</view>
<view class="tip">我的积分</view>
<view class="money">5655999.99</view>
<view class="note_btn">提现记录</view>
<view class="note_btn" bind:tap="toWatchNote">提现记录</view>
</view>
</view>
\ No newline at end of file
......@@ -21,6 +21,8 @@ Component({
* 组件的方法列表
*/
methods: {
toEditPage(){
wx.$router.go('packageMine.editBasicInfo.index')
}
}
})
......@@ -4,7 +4,7 @@
<view class="info_text">
<view class="label flex_sc">
<text>百晓生</text>
<image mode="aspectFill" class="edit_icon" src="{{IMGURL}}center_edit_icon.png" />
<image bind:tap="toEditPage" mode="aspectFill" class="edit_icon" src="{{IMGURL}}center_edit_icon.png" />
</view>
<view class="contact_widget flex_sc">
<view class="text">18269445456</view>
......
const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import { wxOnAppRouteFn, generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo'
import {
generateRoutList
} from './wxOnAppRoute.js'
import {
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
class Router {
[_query] = {};
[_routeHooks] = [];
[_routerList] = []
constructor(router) {
this[_routerList] = generateRoutList(router)
let obj = {
query: this[_query],
routeHooks: this[_routeHooks],
routerList: this[_routerList],
getPageInstance: this.getPageInstance,
getRootName: this.getRootName,
setNavigationBarTitleText: this.setNavigationBarTitleText,
getRouterList: this.getRouterList
}
wxOnAppRouteFn(obj)
wx.onAppRoute &&
wx.onAppRoute(e => {
let thisPage = this.getPageInstance()
if (thisPage) {
thisPage.options = this[_query]
this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query])
}
this[_routeHooks].forEach(fn => {
try {
typeof fn === 'function' && fn(e, this[_query], this[_routerList])
} catch (err) {
console.log(err)
}
})
this[_query] = {}
})
}
/**设置标题栏 */
setNavigationBarTitleText = thisPage => {
......@@ -27,8 +41,11 @@ class Router {
if (getUserInfo()) title = getUserInfo().merchantName
const router = `${thisPage.__route__}.html`
if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) {
let { navigationBarTitleText, navigationStyle } = __wxConfig.page[router].window
if (!title) title = '广汇车生活'
let {
navigationBarTitleText,
navigationStyle
} = __wxConfig.page[router].window
if (!title) title = '生意助手'
if (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({
title
......@@ -39,12 +56,6 @@ class Router {
getRouterList = () => {
return this[_routerList]
}
/**获取当前分包名 */
getRootName = () => {
let router = `/${this.getPageInstance().__route__}`
let { rootName } = this.getRouterList().find(item => router === item.url)
return rootName
}
/**获取页面对象实例 */
getPageInstance = (size = 1) => {
const pages = getCurrentPages()
......@@ -67,15 +78,15 @@ class Router {
parent = _parent
}
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
if (!_name && !last_name) {
name = _parent
parent = this.getRootName() || parent
}
if (!_name && !last_name) name = _parent
const routerMapItem = this[_routerList].find(item => {
if (last_name) {
return item.parent === parent && item.name === last_name && item.subPages === name
} else {
return item.parent === parent && item.name === name
if (route.includes('/')) return item.url === route
else {
if (last_name) {
return item.parent === parent && item.name === last_name && item.subPages === name
} else {
return item.parent === parent && item.name === name
}
}
})
if (!routerMapItem) {
......@@ -89,11 +100,8 @@ class Router {
}
/**跳转至H5 */
jumpH5(url) {
this.intercept().then(response => {
if (response) return
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
}
/**页面跳转
......@@ -108,46 +116,39 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
let {
routerMapItem,
query
} = this.checkRouter(route, events)
if (routerMapItem.isTab) {
wx.switchTab({
url: routerMapItem.url
})
} else {
if (events && events.notIntercept) {
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
} else {
this.intercept().then(response => {
if (response) return
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
})
}
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
}
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
let {
routerMapItem,
query
} = this.checkRouter(route, events)
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
let {
routerMapItem,
query
} = this.checkRouter(route, events)
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
}
/**prevPageSize = 1
......@@ -164,7 +165,7 @@ class Router {
}
goHome() {
let [index] = this[_routerList]
wx.switchTab({
wx.reLaunch({
url: index.url
})
}
......@@ -180,18 +181,6 @@ class Router {
if (i > -1) list.splice(i, 1)
}
}
async intercept() {
const authStatus = wx.$authStatus
if (authStatus) {
const thisPage = this.getPageInstance()
thisPage.setData({
showLogin: true
})
return await true
} else {
return await false
}
}
}
export default Router
export default Router
\ No newline at end of file
import { IMG_URL } from '~/utils/constantData'
/**
* 执行路由前的准备工作
*/
/**处理前置钩子逻辑 */
const routerBefore = (next) => {
const routerBefore = next => {
// console.log("处理前置钩子逻辑");
// 配置图片全局路径
let page = wx.$router.getPageInstance()
page && (page.data.IMG_URL = IMG_URL)
next();
};
// page && page.setData({ IMG_URL })
// console.log()
// console.log(next)
next()
}
/**处理后置钩子逻辑 */
const routerAfter = (next) => {
const routerAfter = next => {
// console.log("处理后置钩子逻辑");
next();
};
next()
}
// 重写Page方法
const OldPage = Page;
const OldPage = Page
Page = function (options) {
const oldShow = options.onShow;
const oldHide = options.onHide;
const oldShow = options.onShow
const oldHide = options.onHide
options.onShow = function () {
routerBefore(() => {
oldShow.apply(this, arguments);
});
};
oldShow.apply(this, arguments)
})
}
options.onHide = function () {
routerAfter(() => {
oldHide.apply(this, arguments);
});
};
OldPage(options);
};
oldHide.apply(this, arguments)
})
}
OldPage(options)
}
export default routerBefore;
export default routerBefore
import util from '../utils/util.js'
import { getUserInfo } from '~/utils/cache/userInfo'
import { IMG_URL } from '~/utils/constantData'
// import util from '../utils/util.js'
// import {
// getUserInfo
// } from '~/utils/cache/userInfo'
/**
* wx.onAppRoute钩子方法,
......@@ -13,74 +14,6 @@ import { IMG_URL } from '~/utils/constantData'
* @param {*} obj.setNavigationBarTitleText
* @param {*} obj.getRouterList
*/
export const wxOnAppRouteFn = obj => {
wx.onAppRoute &&
wx.onAppRoute(e => {
let thisPage = obj.getPageInstance()
const rootName = obj.getRootName()
if (rootName) {
const selectedColor = rootName == 'packageEquity' ? '#f7dcbc' : '#FC5B32'
wx.setTabBarStyle({
selectedColor,
color: '#979899',
backgroundColor: '#FFFFFF',
borderStyle: 'white'
})
}
if (thisPage) {
obj.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
thisPage.$query = obj.query
typeof onRoute === 'function' && onRoute(obj.query)
thisPage.rootName = rootName
obj.getRouterList().find(item => {
if (`/${thisPage.__route__}` === item.url) {
const authStatus = wx.$authStatus
// if (item.isTab) thisPage.setData({
// showLogin: authStatus
// })
}
})
if (!wx.$version)
util.getImgVersion().then(({ version }) => {
wx.$version = version || '1.0.0'
thisPage.setData({
img_version: wx.$version
})
})
else
thisPage.setData({
img_version: wx.$version
})
// console.log(app)
thisPage.setData({
IMGURL: IMG_URL
})
let userInfo = getUserInfo()
if (userInfo && userInfo.phone) {
if (wx.$authStatus) {
thisPage.setData({
userInfo: null
})
} else {
thisPage.setData({
userInfo
})
if (thisPage.init) thisPage.init(userInfo)
}
}
}
obj.routeHooks.forEach(fn => {
try {
typeof fn === 'function' && fn(e, obj.query, obj.routerList)
} catch (err) {
console.log(err)
}
})
obj.query = {}
})
}
/**
* 生成特定格式路由
*
......@@ -102,16 +35,11 @@ export const generateRoutList = routerList => {
}
if (item.parent !== 'pages') {
let parentList = item.url.split(`/`)
if (parentList.length > 5) {
if (parentList.length > 4) {
item.url = item.url.replace(/\/__plugin__\/[a-z0-9A-Z]+/, '')
obj.subPages = item.url.split(`/${item.parent}/pages/`)[1].split('/')[0]
}
}
if (obj.isTab) {
__wxConfig.tabBar.list.map(e => {
if (obj.url === `/${e.pagePath.replace('.html', '')}`) obj.rootName = e.rootName
})
}
}
return obj
}))
......
......@@ -8,10 +8,8 @@ class Draw {
[_canvasObject_] = null;
[_canvas_] = null
constructor(canvasObject) {
wx.getSystemInfo().then(({
pixelRatio
}) => {
console.log(pixelRatio)
wx.getSystemInfo().then(({ pixelRatio }) => {
// console.log(pixelRatio)
this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || pixelRatio || 2
const height = this.toRpx(canvasObject.height),
......@@ -38,14 +36,7 @@ class Draw {
drawImages(imageParams, callback) {
this[_ctx_].beginPath()
this[_ctx_].save()
let {
borderRadius,
height,
width,
url,
x,
y
} = imageParams
let { borderRadius, height, width, url, x, y } = imageParams
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
......@@ -78,13 +69,7 @@ class Draw {
if (fontSize) this[_ctx_].font = `${fontSize}px${font}`
return this[_ctx_].measureText(text).width
}
drawFill({
x,
y,
width,
height,
color
}) {
drawFill({ x, y, width, height, color }) {
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
......@@ -97,25 +82,8 @@ class Draw {
this[_ctx_].save()
}
drawText(textParams) {
let {
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
lastFont,
opacity,
lineNum,
width,
color,
text,
x,
y
} = textParams,
font = this[_ctx_].font.split('px')[1]
let { textDecoration, textBaseline, lineHeight, fontWeight, textAlign, textWidth, maxWidth, fontSize, lastFont, opacity, lineNum, width, color, text, x, y } = textParams,
font = this[_ctx_].font.split('px')[1]
textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal'
opacity = typeof opacity === 'number' ? opacity : 1
......@@ -258,15 +226,7 @@ class Draw {
}
drawLine(lineParams, callback) {
this[_ctx_].beginPath()
let {
opacity,
startX,
startY,
width,
color,
endX,
endY
} = lineParams
let { opacity, startX, startY, width, color, endX, endY } = lineParams
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
......@@ -283,12 +243,7 @@ class Draw {
if (callback) callback()
}
setLineY = params => {
let {
textDecoration,
textBaseline,
fontSize,
y
} = params
let { textDecoration, textBaseline, fontSize, y } = params
let type = {
underline: {
top: y + fontSize,
......@@ -312,11 +267,7 @@ class Draw {
return type[textDecoration][textBaseline]
}
setLineX({
textAlign,
text,
x
}) {
setLineX({ textAlign, text, x }) {
let textWidth = this.getTextWidth(text)
let type = {
left: x,
......@@ -326,13 +277,7 @@ class Draw {
return type[textAlign]
}
drawRadiusRect({
borderRadius,
height,
width,
x,
y
}, callBack) {
drawRadiusRect({ borderRadius, height, width, x, y }, callBack) {
let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2
radius = radius || 0
this[_ctx_].beginPath()
......@@ -343,12 +288,7 @@ class Draw {
}
if (callBack) callBack()
}
getFontWidth({
textAlign,
fontSize,
text,
x
}) {
getFontWidth({ textAlign, fontSize, text, x }) {
let type = {
left: x,
center: x - (fontSize * text.length) / 2,
......@@ -358,12 +298,7 @@ class Draw {
}
drawDecoration(params) {
let {
newText,
opacity,
y,
x
} = params
let { newText, opacity, y, x } = params
let lineX = x
let lineY = y
lineX = this.setLineX(params)
......@@ -420,4 +355,4 @@ const createLocalImg = (url, callBack) => {
}
})
}
export default Draw
\ No newline at end of file
export default Draw
import { commonApi, equityApi } from '../api/api'
import { commonApi } from '../api/api'
// import {
// sopApi,
// commonApi,
// bigdatautilApi,
// equityApi
// } from '../api/api'
import $router from '../router/index'
/**
......
/**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: 'error',
title: '请输入手机号'
},
username: {
icon: 'error',
title: '请输入用户名'
},
password: {
icon: 'error',
title: '请输入密码'
}
}
/**
* 禁止滑动
*/
const noScroll = () => {}
......@@ -51,6 +70,26 @@ const showToast = val => {
}
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 => {
wx.getSystemInfo({
......@@ -82,6 +121,7 @@ const wxApi = {
setCopyData,
showToast,
phoneCall,
noScroll
noScroll,
wxShowToast
}
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!