Commit 73b08b2c by zhangquan

合并dev分支

1 parent 249bed34
// 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: {
......
......@@ -27,7 +27,6 @@ Component({
hideTab
})
}
}
},
title: String,
......@@ -46,9 +45,7 @@ Component({
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
......@@ -65,11 +62,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
})
......@@ -34,9 +34,7 @@ Component({
*/
methods: {
click(e) {
let {
count
} = e.currentTarget.dataset
let { count } = e.currentTarget.dataset
this.setData({
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{
margin-left: 40rpx;
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 36rpx;
color: #1B233D;
......@@ -22,6 +23,7 @@
font-size: 24rpx;
letter-spacing: 0;
text-align: center;
font-family: PingFangSC-Regular;
line-height: 64rpx;
margin-right: 12rpx;
background: #FFFFFF;
......@@ -67,6 +69,7 @@
line-height: 40rpx;
background: #D7F5EB;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #24B38C;
......@@ -87,6 +90,7 @@
line-height: 40rpx;
}
.prod-info .title{
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
......
......@@ -21,8 +21,6 @@
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"ignoreUploadUnusedFiles": true,
......@@ -37,6 +35,13 @@
},
"useCompilerPlugins": [
"sass"
],
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
]
},
"compileType": "miniprogram",
......@@ -58,7 +63,7 @@
],
"include": []
},
"appid": "wxe10067a63c1856ac",
"appid": "wxfe82b8d65d07808f",
"projectname": "miniprogram-scrm-shopmall",
"condition": {}
}
\ No newline at end of file
const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import {
generateRoutList
} from './wxOnAppRoute.js'
import {
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
import { IMG_URL } from '~/utils/constantData'
import { generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo'
class Router {
[_query] = {};
[_routeHooks] = [];
......@@ -21,6 +16,7 @@ class Router {
let thisPage = this.getPageInstance()
if (thisPage) {
thisPage.options = this[_query]
thisPage.setData({ IMGURL: IMG_URL })
this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query])
......@@ -41,10 +37,7 @@ 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
let { navigationBarTitleText, navigationStyle } = __wxConfig.page[router].window
if (!title) title = '生意助手'
if (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({
......@@ -116,10 +109,7 @@ 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
......@@ -133,20 +123,14 @@ class Router {
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
let {
routerMapItem,
query
} = this.checkRouter(route, events)
let { routerMapItem, query } = this.checkRouter(route, events)
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) {
let {
routerMapItem,
query
} = this.checkRouter(route, events)
let { routerMapItem, query } = this.checkRouter(route, events)
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
......@@ -183,4 +167,4 @@ class Router {
}
}
export default Router
\ No newline at end of file
export default Router
import { IMG_URL } from '~/utils/constantData'
// import { IMG_URL } from '~/utils/constantData'
/**
* 执行路由前的准备工作
*/
......@@ -7,8 +7,8 @@ import { IMG_URL } from '~/utils/constantData'
const routerBefore = next => {
// console.log("处理前置钩子逻辑");
// 配置图片全局路径
let page = wx.$router.getPageInstance()
page && (page.data.IMGURL = IMG_URL)
// let page = wx.$router.getPageInstance()
// page && (page.data.IMG_URL = IMG_URL)
// page && page.setData({ IMG_URL })
// console.log()
......
......@@ -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!