Commit 73b08b2c by zhangquan

合并dev分支

1 parent 249bed34
// 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
}) })
} }
......
...@@ -27,7 +27,6 @@ Component({ ...@@ -27,7 +27,6 @@ Component({
hideTab hideTab
}) })
} }
} }
}, },
title: String, title: String,
...@@ -46,9 +45,7 @@ Component({ ...@@ -46,9 +45,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -65,11 +62,9 @@ Component({ ...@@ -65,11 +62,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
}) })
}, }
}) })
\ No newline at end of file \ No newline at end of file
// 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({
......
...@@ -34,9 +34,7 @@ Component({ ...@@ -34,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}`
......
{
"name": "store-assistant",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vant/weapp": {
"version": "1.10.5",
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.5.tgz",
"integrity": "sha512-bAHp9r0ZiRsOqPOLzQHI/ZvkAlXzol1/TFhM70MyghuxkzJTjcDUd8RIfLkCN3c1MCK/PfBGw2an8/afygftCg=="
},
"i": {
"version": "0.3.7",
"resolved": "https://registry.npmmirror.com/i/-/i-0.3.7.tgz",
"integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q=="
}
}
}
{
"name": "store-assistant",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.10.5",
"i": "^0.3.7"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://192.168.3.233:8090/saas_plus/store-assistant"
},
"author": "",
"license": "ISC"
}
<!--pages/login.wxml-->
<view>
<text>您好</text>
<text>欢迎登录门店助手</text>
<image></image>
</view>
// 特色产品 // 特色产品
.prod-wrap .big-title{ .prod-wrap .big-title{
margin-left: 40rpx; margin-left: 40rpx;
font-family: PingFangSC-S0pxibold;
font-weight: 600; font-weight: 600;
font-size: 36rpx; font-size: 36rpx;
color: #1B233D; color: #1B233D;
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
font-size: 24rpx; font-size: 24rpx;
letter-spacing: 0; letter-spacing: 0;
text-align: center; text-align: center;
font-family: PingFangSC-Regular;
line-height: 64rpx; line-height: 64rpx;
margin-right: 12rpx; margin-right: 12rpx;
background: #FFFFFF; background: #FFFFFF;
...@@ -67,6 +69,7 @@ ...@@ -67,6 +69,7 @@
line-height: 40rpx; line-height: 40rpx;
background: #D7F5EB; background: #D7F5EB;
border-radius: 4rpx; border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 600; font-weight: 600;
font-size: 24rpx; font-size: 24rpx;
color: #24B38C; color: #24B38C;
...@@ -87,6 +90,7 @@ ...@@ -87,6 +90,7 @@
line-height: 40rpx; line-height: 40rpx;
} }
.prod-info .title{ .prod-info .title{
font-family: PingFangSC-Medium;
font-weight: 600; font-weight: 600;
font-size: 28rpx; font-size: 28rpx;
color: #323436; color: #323436;
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
"useApiHook": true, "useApiHook": true,
"useApiHostProcess": true, "useApiHostProcess": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
"disableUseStrict": false, "disableUseStrict": false,
"ignoreUploadUnusedFiles": true, "ignoreUploadUnusedFiles": true,
...@@ -37,6 +35,13 @@ ...@@ -37,6 +35,13 @@
}, },
"useCompilerPlugins": [ "useCompilerPlugins": [
"sass" "sass"
],
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
] ]
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
...@@ -58,7 +63,7 @@ ...@@ -58,7 +63,7 @@
], ],
"include": [] "include": []
}, },
"appid": "wxe10067a63c1856ac", "appid": "wxfe82b8d65d07808f",
"projectname": "miniprogram-scrm-shopmall", "projectname": "miniprogram-scrm-shopmall",
"condition": {} "condition": {}
} }
\ No newline at end of file \ No newline at end of file
const _routeHooks = Symbol('_routeHooks') const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query') const _query = Symbol('_query')
const _routerList = Symbol('_routerList') const _routerList = Symbol('_routerList')
import { import { IMG_URL } from '~/utils/constantData'
generateRoutList import { generateRoutList } from './wxOnAppRoute.js'
} from './wxOnAppRoute.js' import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { import { getUserInfo } from '~/utils/cache/userInfo'
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
class Router { class Router {
[_query] = {}; [_query] = {};
[_routeHooks] = []; [_routeHooks] = [];
...@@ -21,6 +16,7 @@ class Router { ...@@ -21,6 +16,7 @@ class Router {
let thisPage = this.getPageInstance() let thisPage = this.getPageInstance()
if (thisPage) { if (thisPage) {
thisPage.options = this[_query] thisPage.options = this[_query]
thisPage.setData({ IMGURL: IMG_URL })
this.setNavigationBarTitleText(thisPage) this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query]) typeof onRoute === 'function' && onRoute(this[_query])
...@@ -41,10 +37,7 @@ class Router { ...@@ -41,10 +37,7 @@ class Router {
if (getUserInfo()) title = getUserInfo().merchantName if (getUserInfo()) title = getUserInfo().merchantName
const router = `${thisPage.__route__}.html` const router = `${thisPage.__route__}.html`
if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) { if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) {
let { let { navigationBarTitleText, navigationStyle } = __wxConfig.page[router].window
navigationBarTitleText,
navigationStyle
} = __wxConfig.page[router].window
if (!title) title = '生意助手' if (!title) title = '生意助手'
if (!navigationBarTitleText && !navigationStyle) if (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
...@@ -116,10 +109,7 @@ class Router { ...@@ -116,10 +109,7 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层 * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/ */
go(route, events) { go(route, events) {
let { let { routerMapItem, query } = this.checkRouter(route, events)
routerMapItem,
query
} = this.checkRouter(route, events)
if (routerMapItem.isTab) { if (routerMapItem.isTab) {
wx.switchTab({ wx.switchTab({
url: routerMapItem.url url: routerMapItem.url
...@@ -133,20 +123,14 @@ class Router { ...@@ -133,20 +123,14 @@ class Router {
} }
/**关闭所有页面,打开到应用内的某个页面 */ /**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) { reLaunch(route, events) {
let { let { routerMapItem, query } = this.checkRouter(route, events)
routerMapItem,
query
} = this.checkRouter(route, events)
wx.reLaunch({ wx.reLaunch({
url: `${routerMapItem.url}${query}` url: `${routerMapItem.url}${query}`
}) })
} }
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */ /**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) { redirectTo(route, events) {
let { let { routerMapItem, query } = this.checkRouter(route, events)
routerMapItem,
query
} = this.checkRouter(route, events)
wx.redirectTo({ wx.redirectTo({
url: `${routerMapItem.url}${query}` url: `${routerMapItem.url}${query}`
}) })
......
import { IMG_URL } from '~/utils/constantData' // import { IMG_URL } from '~/utils/constantData'
/** /**
* 执行路由前的准备工作 * 执行路由前的准备工作
*/ */
...@@ -7,8 +7,8 @@ import { IMG_URL } from '~/utils/constantData' ...@@ -7,8 +7,8 @@ import { IMG_URL } from '~/utils/constantData'
const routerBefore = next => { const routerBefore = next => {
// console.log("处理前置钩子逻辑"); // console.log("处理前置钩子逻辑");
// 配置图片全局路径 // 配置图片全局路径
let page = wx.$router.getPageInstance() // let page = wx.$router.getPageInstance()
page && (page.data.IMGURL = IMG_URL) // page && (page.data.IMG_URL = IMG_URL)
// page && page.setData({ IMG_URL }) // page && page.setData({ IMG_URL })
// console.log() // console.log()
......
...@@ -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!