Commit c8cee13b by zhangxw

tabBar

1 parent ef265726
......@@ -27,13 +27,13 @@ class UsersApi {
/**授权手机号 */
async authUserPhone(detail, sessionId) {
if (!sessionId) {
wx.$util.showToast('缺少sessionId')
wx.$api.showToast('缺少sessionId')
Promise.reject()
}
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
wx.$util.showLoading()
wx.$api.showLoading()
detail.sessionId = sessionId
return api.post(
{
......
// app.js
import util from './utils/util.js'
import '~/router/routerBefore.js'
import router from './router/index.js'
import util from './utils/util'
import wxApi from './utils/utils_wx'
import '~/router/routerBefore'
import router from './router/index'
// 有问题 前后顺序不能随意调整
import { ssoApi, commonApi, shopmallApi } from './api/api'
import { filterUrlParam } from '~/utils/routerApi'
import { setUserInfo, setSessionId } from '~/utils/cache/userInfo'
import { setSystem_info } from '~/utils/cache/storageApi'
// console.log(setSystem_info)
// 判断小程序是否需要更新
import getUpdateManager from './utils/lib/wxUpdateManager'
......@@ -32,6 +27,7 @@ App({
/**挂载到wx对象 */
wx.$authStatus = false
wx.$util = util
wx.$api = wxApi
wx.$router = router
wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$eventbus = eventbus
......@@ -40,145 +36,13 @@ App({
setSystem_info()
},
// $Storage: $Storage,
// getStorage: $Storage.get,
// setStorage: $Storage.set,
// rmStorage: $Storage.rm,
setPageParmas(query) {
if (query.merchantId) $Storage.set('srcm_shopmall_merchant_id', query.merchantId)
if (query.customerId) $Storage.set('srcm_shopmall_customer_id', query.customerId)
let storeCode = query.storeCode || filterUrlParam(decodeURIComponent(query.scene))['storeCode']
if (query.scene) {
let scene = decodeURIComponent(query.scene)
let [key, val] = scene.split('=')
if (key == 'storeCode') {
this.getGHMerchant(val)
return
}
shopmallApi
.getLiveActivityId({
id: val
})
.then(({ code, data }) => {
console.log(data)
if (code == 0) {
let op = {}
data.scene.split('&').map(item => {
const [key, val] = item.split('=')
op[key] = val
})
if (op.storeCode) this.getGHMerchant(op.storeCode)
}
})
return
}
if (storeCode) {
this.getGHMerchant(storeCode)
return
}
if (query.merchantId) {
$Storage.set('srcm_shopmall_merchant_id', query.merchantId)
this.login()
return
}
},
getGHMerchant(storeCode, callBack) {
$Storage.set('srcm_shopmall_store_code', storeCode)
commonApi
.getBySapCode({
sapCode: storeCode
})
.then(({ code, data }) => {
if (code == '0') $Storage.set('srcm_shopmall_merchant_id', data.merchantNo)
this.login().then(res => {
if (callBack) callBack(res)
})
})
},
login(returnResponse) {
let _this = this
return new Promise((resolve, reject) => {
wx.login({
success({ code }) {
const appId = wx.getAccountInfoSync().miniProgram.appId
ssoApi
.jsCodeLogin({
code,
appId
})
.then(res => {
wx.$isGroup = res.data.group
wx.$authStatus = res.code != 0
if (res && res.data) {
if (res.data.sapCode) $Storage.set('srcm_shopmall_store_code', res.data.sapCode)
}
if (returnResponse) {
resolve(res)
} else {
if (res.data)
wx.$storage.set('merchant_info', {
merchantId: res.data.merchantId,
merchantName: res.data.merchantName,
sapCode: res.data.sapCode || ''
})
if (res.code != -1) {
if (res.code == 0) {
setUserInfo(res.data)
setSessionId(res.data.sessionId)
let customerId = $Storage.get('srcm_shopmall_customer_id')
let merchantId = $Storage.get('srcm_shopmall_merchant_id')
if (customerId) {
ssoApi
.updataCustomerPhone({
customerId,
merchantId
})
.then(() => {
wx.removeStorageSync('srcm_shopmall_customer_id')
})
}
// 登录完加载权益会员信息接口(目前只针对权益商品页面)
eventbus.emit('EQUITYGOODS', true)
} else {
util.showToast(res.message || '网络异常')
}
}
resolve(res)
}
})
.catch(() => {
wx.$authStatus = true
reject()
})
}
})
})
},
onShow(options) {
getUpdateManager()
let query = Object.keys(options.query)
if (query.length)
query.map(e => {
let params = decodeURIComponent(e).split('&')
params.map(i => {
let [key, val] = i.split('=')
if (!val) val = options.query[key]
this.setPageParmas({
[key]: val
})
})
})
else this.login()
},
/**页面不存在时触发 */
onPageNotFound(e) {
wx.$router.goHome()
},
onHide() {},
globalData: {
// appId: '',
// merchantId: '44189923' // 44184606 44189923
}
globalData: {}
})
{
"pages": ["pages/index/index","pages/tab/index/index", "pages/tab/output/output", "pages/tab/mine/mine", "pages/webView/webView"],
"requiredPrivateInfos": ["getLocation"],
"pages": ["pages/tab/index/index", "pages/tab/discovery/discovery", "pages/tab/mine/mine", "pages/webView/webView"],
"lazyCodeLoading": "requiredComponents",
"window": {
"backgroundTextStyle": "light",
......@@ -8,33 +7,32 @@
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#5A6066",
"selectedColor": "#3666FE",
"color": "#999BAD",
"selectedColor": "#5C72F6",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [{
"pagePath": "pages/tab/index/index",
"text": "拓客户",
"iconPath": "images/home.png",
"selectedIconPath": "images/home_active.png"
"text": "活动",
"iconPath": "images/icon_activity.png",
"selectedIconPath": "images/icon_activity_active.png"
},
{
"pagePath": "pages/tab/output/output",
"text": "看产值",
"iconPath": "images/mall.png",
"selectedIconPath": "images/mall_active.png"
"pagePath": "pages/tab/discovery/discovery",
"text": "发现",
"iconPath": "images/icon_discovery.png",
"selectedIconPath": "images/icon_discovery_active.png"
},
{
"pagePath": "pages/tab/mine/mine",
"text": "个人中心",
"iconPath": "images/mine.png",
"selectedIconPath": "images/mine_active.png"
"iconPath": "images/icon_mine.png",
"selectedIconPath": "images/icon_mine_active.png"
}
]
},
"subpackages": [],
"usingComponents": {
},
"style": "v2",
"resolveAlias": {
......
......@@ -4,7 +4,7 @@ import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
import {componentsMixin } from '../../mixins/index'
Component({
behaviors:[componentsMixin],
// behaviors:[componentsMixin],
/**
* 组件的属性列表
*/
......
......@@ -4,77 +4,72 @@ const _separator_ = Symbol('_separator_')
class Calendar {
[_CalendarObject_] = {};
[_nowDate_] = new Date();
[_separator_] = '-';
[_separator_] = '-'
constructor(calendarObject) {
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let {
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let { weekdays, firstDayOfWeek } = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let { data: calenderHeight } = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$api.getSystemInfo(res => {
let { windowHeight } = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let {
data: calenderHeight
} = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => {
let {
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
_this.setData({
height
})
}
/**设置日期高度 */
_this.setData({
height
})
}
/**设置日期高度 */
setCalenderBodyHeight() {
let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => {
wx.$util.getViewInfo('.calender-footer', footer => {
let headerHeight = header.height
let footerHeight = footer && footer.height || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
}, _this)
}, _this)
}
/**设置日期列表 */
let _this = this[_CalendarObject_]
wx.$util.getViewInfo(
'.calender-header',
header => {
wx.$util.getViewInfo(
'.calender-footer',
footer => {
let headerHeight = header.height
let footerHeight = (footer && footer.height) || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
},
_this
)
},
_this
)
}
/**设置日期列表 */
setMonthList() {
let {
separator,
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
let { separator, previous, minDate, maxDate, next } = this[_CalendarObject_].data
if (maxDate || minDate) {
if (!minDate) {
let nowMonth = new Date().getMonth()
......@@ -94,40 +89,28 @@ class Calendar {
for (let i = nowMonth - previous; i <= nowMonth + next; i++) {
this.init(new Date(now).setMonth(i))
}
}
/**初始化日期 */
}
/**初始化日期 */
init(date) {
let _this = this[_CalendarObject_]
let {
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [now_year, now_month, now_day] = today.split(separator)
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}`
let _this = this[_CalendarObject_]
let { firstDayOfWeek, allowSameDay, multipleDate, monthList, rangeDate, dateList, dateType, current, minDate, maxDate, value } = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [now_year, now_month, now_day] = today.split(separator)
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}` : i}`
let obj = {
day: i,
data: dayStr,
......@@ -180,17 +163,10 @@ class Calendar {
/**单选 */
single(e) {
let _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
let { index, data, ind } = e.currentTarget.dataset
let { showConfirm, monthList } = _this.data
monthList.map(x => {
x.data.map(i => i.active = false)
x.data.map(i => (i.active = false))
})
monthList[index].data[ind].active = true
_this.setData({
......@@ -202,18 +178,15 @@ class Calendar {
/**多选 */
multiple(e) {
let _this = this[_CalendarObject_]
let {
index,
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let { index, ind } = e.currentTarget.dataset
let { monthList } = _this.data
let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => {
if (i.active) arr.push(i.data)
}))
monthList.map(x =>
x.data.map(i => {
if (i.active) arr.push(i.data)
})
)
_this.setData({
[`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr
......@@ -222,17 +195,8 @@ class Calendar {
/**范围选择 */
range(e) {
const _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
let { index, data, ind } = e.currentTarget.dataset
let { allowSameDay, showConfirm, monthList, rangeDate } = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({
......@@ -264,16 +228,11 @@ class Calendar {
/**点击完成 */
done() {
let _this = this[_CalendarObject_]
let {
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let { multipleDate, rangeDate, dateType, date } = _this.data
let targer = {
'single': date,
'multiple': multipleDate,
'range': rangeDate
single: date,
multiple: multipleDate,
range: rangeDate
}
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', {
......@@ -284,17 +243,15 @@ class Calendar {
/**清空范围选择状态 */
clearStatus(params) {
let {
monthList,
index,
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
}))
let { monthList, index, ind } = params
monthList.map(x =>
x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
})
)
monthList[index].data[ind].active = true
monthList[index].data[ind].start = true
return monthList
......@@ -307,24 +264,20 @@ class Calendar {
switch (month) {
case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break;
break
case 4:
case 6:
case 9:
case 11:
days = 30
break;
break
}
return days
}
/**日期范围 点击全选 */
chooseAll() {
let _this = this[_CalendarObject_]
let {
monthList,
minDate,
maxDate
} = _this.data
let { monthList, minDate, maxDate } = _this.data
monthList.map((e, index) => {
e.data.map((i, ind) => {
let obj = {
......@@ -337,11 +290,10 @@ class Calendar {
}
}
if (i.data == minDate) this.range(obj)
if(i.data == maxDate) this.range(obj)
if (i.data == maxDate) this.range(obj)
})
})
}
}
export default Calendar
\ No newline at end of file
export default Calendar
......@@ -3,7 +3,7 @@ import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
// behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
......
<view class="navigation-bar" id="navigation-bar"
style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<view>123</view>
<block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
......
{
"usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar"
},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
......
<view class="navigation-bar">
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="活动">门店助手</navigation-bar>
</view>
{
"navigationStyle": "custom",
"enablePullDownRefresh": true
"enablePullDownRefresh": true,
"usingComponents": {
}
}
\ No newline at end of file
// pages/webView/webView.js
Page({
/**
* 页面的初始数据
*/
......@@ -24,16 +23,16 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
wx.$util.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url);
onLoad: function (options) {
wx.$api.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url)
let param = this.getParams(decodeUrl)
if (param.urlParam) {
let query = JSON.parse(param.urlParam)
this.data.refresh = query.refresh
}
this.setData({
url: decodeUrl,
url: decodeUrl
})
wx.hideLoading()
},
......@@ -41,29 +40,30 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
if (this.data.refresh) {
this.setData({
flag: true
}, () => {
this.setData({
url: this.data.url
})
})
this.setData(
{
flag: true
},
() => {
this.setData({
url: this.data.url
})
}
)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
if (this.data.refresh) {
this.setData({
flag: false
......@@ -74,7 +74,7 @@ Page({
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
if (this.data.refresh) {
this.setData({
flag: false
......@@ -85,14 +85,10 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
}
})
\ No newline at end of file
onReachBottom: function () {}
})
......@@ -58,7 +58,7 @@
],
"include": []
},
"appid": "wxfe82b8d65d07808f",
"appid": "wxe10067a63c1856ac",
"projectname": "miniprogram-scrm-shopmall",
"condition": {}
}
\ No newline at end of file
......@@ -59,7 +59,7 @@
]
}
},
"projectname": "miniprogram-template",
"projectname": "store-assistant",
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "2.24.4"
}
\ No newline at end of file
......@@ -30,59 +30,6 @@ Date.prototype.format = function (fmt) {
return fmt
}
/**
* 防止重复点击
*/
const showLoading = (title = '') => {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.showLoading({
title,
mask: true
})
} else {
// 低版本采用Toast兼容处理并将时间设为20秒以免自动消失
wx.showToast({
title,
icon: 'loading',
mask: true,
duration: 20000
})
}
}
const hideLoading = () => {
if (wx.hideLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.hideLoading()
} else {
wx.hideToast()
}
}
const showToast = val => {
let obj = {}
if (val && typeof val === 'string') {
obj.title = val
obj.icon = 'none'
} else {
obj = val
}
return wx.showToast(obj)
}
/**获取节点信息
* name(id获取class)
* callBack 回调函数
* isComponents是否在组件
*/
const getViewInfo = (name, callBack, isComponents) => {
const query = !isComponents ? wx.createSelectorQuery() : wx.createSelectorQuery().in(isComponents)
query
.select(name)
.boundingClientRect(res => {
callBack(res)
})
.exec()
}
/**触底加载 */
const onReachBottom = (obj, callBack) => {
let _this = $router.getPageInstance()
......@@ -105,21 +52,6 @@ const onReachBottom = (obj, callBack) => {
}
}
/**
* 禁止滑动
*/
const noScroll = () => {}
/**设置粘贴板内容 */
const setCopyData = (data, callBack) => {
wx.setClipboardData({
data: data,
success(res) {
if (callBack && typeof callBack === 'function') callBack(res)
}
})
}
/**是否全面屏 */
const isFullSucreen = isComponents => {
const thisPage = $router.getPageInstance()
......@@ -150,30 +82,6 @@ const isFullSucreen = isComponents => {
return val
}
/**获取手机信息 */
const getPhoneInfo = callBack => {
wx.getSystemInfo({
success(res) {
callBack(res)
},
fail(err) {
callBack(err)
}
})
}
/**拨打电话 */
const phoneCall = phoneNumber => {
wx.makePhoneCall({
phoneNumber: `${phoneNumber}`
})
}
/**查看大图 */
const previewImage = params => {
wx.previewImage(params)
}
/**节流 */
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
......@@ -212,21 +120,10 @@ const getImgVersion = () => {
}
const Util = {
// setNavigationBarTitleText,
// getNavigationBarTitleText,
getImgVersion,
onReachBottom,
isFullSucreen,
previewImage,
getPhoneInfo,
clearObjNull,
showLoading,
hideLoading,
getViewInfo,
setCopyData,
showToast,
phoneCall,
noScroll,
throttle
}
export default Util
/**
* 禁止滑动
*/
const noScroll = () => {}
/**设置粘贴板内容 */
const setCopyData = (data, callBack) => {
wx.setClipboardData({
data: data,
success(res) {
if (callBack && typeof callBack === 'function') callBack(res)
}
})
}
/**
* 防止重复点击
*/
const showLoading = (title = '') => {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.showLoading({
title,
mask: true
})
} else {
// 低版本采用Toast兼容处理并将时间设为20秒以免自动消失
wx.showToast({
title,
icon: 'loading',
mask: true,
duration: 20000
})
}
}
const hideLoading = () => {
if (wx.hideLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.hideLoading()
} else {
wx.hideToast()
}
}
const showToast = val => {
let obj = {}
if (val && typeof val === 'string') {
obj.title = val
obj.icon = 'none'
} else {
obj = val
}
return wx.showToast(obj)
}
/**获取设备信息 */
const getSystemInfo = callBack => {
wx.getSystemInfo({
success(res) {
callBack(res)
},
fail(err) {
callBack(err)
}
})
}
/**拨打电话 */
const phoneCall = phoneNumber => {
wx.makePhoneCall({
phoneNumber: `${phoneNumber}`
})
}
/**查看大图 */
const previewImage = params => {
wx.previewImage(params)
}
const wxApi = {
previewImage,
getSystemInfo,
showLoading,
hideLoading,
setCopyData,
showToast,
phoneCall,
noScroll
}
export default wxApi
# 小程序模板 说明
<img src="C:\Users\admin\Desktop\工作\miniprogram-template\小程序通用模板文件结构.jpg" style="zoom:25%;" />
<img src="./小程序通用模板文件结构.jpg" style="zoom:25%;" />
## 命名规范
小程序 components 组件文件夹命名规则是 第一个字母大写
......@@ -13,7 +13,6 @@ const IMG_URL = 'xxx'
## 小程序配置sass
在project.config.json增加如下配置,对应页面新增.sass 编写即可
......@@ -64,6 +63,9 @@ get: 通过 wx.$Storage.get 调用
​ 输入值: 1.key对象 2. syncFlag (同步状态,true 为同步, false (异步),默认)
key为空值会返回默认定义的数组集合参数 为关键字则返回定义的数组集合参数 (这个方法是一个对象)
都不是则作为取值的key
​ 输出: 对应key值的JSON.parse 内容(没有对应的key 默认返回空)
set: 通过 $storage.set 或setStorage 调用
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!