Commit b7debe51 by 前端

Merge branch 'develop' into 'master'

Develop

See merge request !7
2 parents efa6efd0 a2043580
Showing 226 changed files with 2618 additions and 423 deletions
project.config.json
project.private.config.json
sitemap.json
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
## 正式版appid wx2c28337db96364d2
## 体验版appid wx24ebae5768e74138
\ No newline at end of file \ No newline at end of file
import api from '~/utils/request/request' import api from '~/utils/request/request'
import ssoApi from './ssoApi'
const common = 'scrm.api.carlife.common.' const common = 'scrm.api.carlife.common.'
module.exports = { module.exports = {
ssoApi,
commonApi: { commonApi: {
/**上传图片 /**上传图片
*/ */
......
/**
* 申请门店开通
*/
// import api from '~/utils/request/request'
// const serverApi = {
// productByscene:'scrm.api.busassistant.activity.productByscene'
// }
// export const productBysceneApi = (data) =>{
// return api.post(
// {
// method: serverApi.productByscene,
// ...data
// },
// true
// )
// }
import api from '~/utils/request/request'
// const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class applyApi {
/**申请门店 */
merchantApply(data) {
return api.post(
{
method: 'scrm.api.busassistant.merchant.apply',
...data
}
// true
)
}
}
export default applyApi
import applyApi from './applyApi.js'
export default new applyApi()
import api from "~/utils/request/request";
const serverApi = {
//生成二维码
createQrCode: "scrm.api.wechat.miniprogram.createQrcode",
// 解析二维码参数
sceneById:'scrm.api.wechat.get.scene.by.id'
};
export const createQrCodeApi = (data) => {
return api.post(
{
method: serverApi.createQrCode,
...data,
},
true
);
};
export const sceneByIdApi = (data) => {
return api.post(
{
method: serverApi.sceneById,
...data,
}
);
};
\ No newline at end of file \ No newline at end of file
/**
* 拓客户,看线索接口
*/
import api from '~/utils/request/request' import api from '~/utils/request/request'
const path = 'scrm.api.sso.weapp.'
module.exports = { const serverApi = {
/**wx.login登录 */ // 拓客户
jsCodeLogin(data) { productByscene: 'scrm.api.busassistant.activity.findSceneProductStatus',
// 看线索
unread: 'scrm.api.busassistant.clue.unread', //获取未读线索数量
page: 'scrm.api.busassistant.clue.page', //分页查询线索列表
read: 'scrm.api.busassistant.clue.read', //标记线索已读
tag: 'scrm.api.busassistant.clue.tag', //线索标记意向客户
battleMessage: 'scrm.api.busassistant.message.battleMessage' //获取最新战报消息
}
// 拓客户
const productBysceneApi = data => {
return api.post( return api.post(
{ {
method: `${path}jscode.login`, method: serverApi.productByscene,
...data ...data
}, },
true true
) )
}, }
/**授权用户信息 */
authUserInfo(data) { // 看线索
const unreadApi = data => {
return api.post( return api.post(
{ {
method: 'scrm.api.sso.weapp.auth.userinfo', method: serverApi.unread,
...data ...data
}, },
true true
) )
}, }
/**授权手机号 */ const pageApi = data => {
authUserPhone(data) {
return api.post( return api.post(
{ {
method: `${path}auth.phone`, method: serverApi.page,
...data ...data
}, },
true true
) )
}, }
/**退出 */ const readApi = data => {
logout() {
return api.post( return api.post(
{ {
method: `scrm.api.sso.user.logout` method: serverApi.read,
...data
}, },
true true
) )
}, }
//保存用户授权信息 const tagApi = data => {
saveuserProfile(data) {
return api.post( return api.post(
{ {
method: `scrm.api.wechat.auth.userProfile.save`, method: serverApi.tag,
...data ...data
}, },
true true
) )
}, }
/**更新客户手机号 */ const battleMessageApi = data => {
updataCustomerPhone(data) {
return api.post({ return api.post({
method: `scrm.api.sso.weapp.mark.phone`, method: serverApi.battleMessage,
...data ...data
}) })
} }
module.exports = {
/** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动)
*/
reportData(data = {}, operationType = 0) {
return api.post({
method: 'scrm.api.busassistant.clue.report',
...data,
operationType,
operationDate: new Date().format('yyyy-MM-dd hh:mm:ss')
})
},
productBysceneApi,
unreadApi,
pageApi,
readApi,
tagApi,
battleMessageApi
} }
import mineApi from './mine.js'
export default new mineApi()
import api from '~/utils/request/request'
// const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class mineApi {
/**分页查询客户列表 */
merchantCustomInfo(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.merchantCustomInfo.page',
...data
}
// true
)
}
/** 保存客户信息 */
saveMerchantCustomInfo(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.merchantCustomInfo.save',
...data
}
// true
)
}
/** 消息盒子列表 */
messageBoxPage(data) {
return api.post(
{
method: 'scrm.api.busassistant.messageBox.page',
...data
}
// true
)
}
/** 是否有未读消息 */
messageBoxPageIsRead(data) {
return api.post(
{
method: 'scrm.api.busassistant.messageBox.isread',
...data
}
// true
)
}
}
export default mineApi
import outputApi from './output.js'
export default new outputApi()
import api from '~/utils/request/request'
// const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class outputApi {
/** 获取服务商(生意助手看产值)我的客户页总收益 */
getMerchantTotal(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.getMerchantTotal',
...data
})
}
/** 分页获取服务商(生意助手看产值)我的客户页数据 */
getCustomerPageList(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.customerPageList',
...data
})
}
/** 服务商(生意助手看产值)我的客户详情数据 */
getCustomerDetail(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.partnermerchant.getCustomerDetail',
...data
})
}
/**获取园区店开通场景数据 */
getSignMerchant(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.getSceneTotal.byYqMerchantId',
...data
}
// true
)
}
/**获取服务商(生意助手看产值)我的门店页数据 */
partnerMerchantTotal(data) {
return api.post(
{
method: 'scrm.api.boutiquecoupon.partnermerchant.yqList',
...data
},
true
)
}
/** 查找可开通的产品 */
getNoOpenPro(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
...data
})
}
/**查询场景和产品的开通状态 */
getSceneProStatus(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findSceneProductStatus',
...data
})
}
/** 申请开通活动*/
applyActivity(data) {
return api.post({
method: 'scrm.api.busassistant.activity.apply',
...data
})
}
/** 查询门店众筹活动产值 */
getActivityRevenue(data) {
return api.post({
method: 'scrm.api.busassistant.merchant.activity.Revenue',
...data
})
}
/** 店面汇总-下载海报 */
getPosterUrl(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.poster',
...data
})
}
}
export default outputApi
// import api from '../api/request'
import api from '~/utils/request/request' import api from '~/utils/request/request'
const { appId } = wx.getAccountInfoSync().miniProgram const {
appId
} = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class UsersApi { class UsersApi {
/**调用后台接口获取用户信息 */ /**调用后台接口获取用户信息js_code换取sessionId */
async login() { async wxCodeLogin() {
return this.getWxCode().then(({ code }) => { const appEnter = wx.getEnterOptionsSync()
return api.post( try {
{ if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
method: 'scrm.api.sso.weapp.jscode.login', const {
code
} = await this.getWxCode()
return await api.post({
method: 'scrm.api.sso.wechat.applets.jscode.login',
appId, appId,
code code
}, },
true true
) )
}) } catch (error) {
console.log(error)
return Promise.reject()
}
}
/**退出登录 */
logout() {
return api.post({
method: 'scrm.api.sso.wechat.applets.logout'
},
true
)
} }
/**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */ /**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */
getWxCode() { getWxCode() {
...@@ -24,38 +44,128 @@ class UsersApi { ...@@ -24,38 +44,128 @@ class UsersApi {
}) })
}) })
} }
/**授权手机号 */ /**授权手机号登录 */
async authUserPhone(detail, sessionId) { async authUserPhone(detail, loginToken) {
if (!sessionId) { if (!loginToken) {
wx.$util.showToast('缺少sessionId') wx.$api.showToast('缺少loginToken')
Promise.reject() Promise.reject()
return
} }
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject() if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
wx.$util.showLoading() detail.loginToken = loginToken
detail.sessionId = sessionId return api.post({
return api.post( method: 'scrm.api.sso.wechat.applets.auth.phone',
{ ...detail,
method: 'scrm.api.sso.weapp.auth.phone', platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
...detail
}, },
true true
) )
} else Promise.reject() } else Promise.reject()
} }
/**更新客户手机号 */ /**账号密码登录 */
updataCustomerPhone() { async accountLogin(data = {}) {
let customerId = wx.$storage.get('srcm_shopmall_customer_id'), return api.post({
merchantId = wx.$storage.get('srcm_shopmall_merchant_id') method: 'scrm.api.sso.wechat.applets.password.login',
api ...data,
.post({ ...CODE
method: 'scrm.api.sso.weapp.mark.phone', },
customerId, true
merchantId )
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile
},
true
)
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.login',
...data,
source: 'MINIAPP',
platformEntrance: 'BUSINESS_ASSISTANT'
},
true
)
}
/** 获取登录账号列表 */
getAccountList(sessionId) {
return api.post({
method: 'scrm.api.sso.wechat.applets.listSelectAccount',
...CODE,
sessionId
},
true
)
}
/**
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
...CODE,
...data
},
true
)
}
/**检查sessionId 是否过期 */
checkSession() {
return api.post({
method: 'scrm.api.sso.login.status.check'
},
true
)
}
/** 超级管理员切换账号 */
adminSelectLogin(data) {
return api.post({
method: 'scrm.api.sso.super.administrator.select.login',
...CODE,
...data
}
// true
)
}
/** 超管切换子账号 */
switchSubLoginInfo(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.switch.subLoginInfo',
...CODE,
...data
}) })
.then(() => { }
wx.removeStorageSync('srcm_shopmall_customer_id') /**获取微信用户信息 */
async getWXUserInfo() {
let wx_user_info = wx.$storage.get('wx_user_info')
if (!wx_user_info) {
const data = await this.getUserProfile()
wx.$storage.set('wx_user_info', data)
return data
} else return wx_user_info
}
/** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
*/
async getUserProfile(loginToken, detail = {}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (!loginToken) {
let res = await this.wxCodeLogin()
loginToken = res.data
}
detail.loginToken = loginToken
return api.post({
method: 'scrm.api.sso.wechat.applets.phone.grant.analysis',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT'
}) })
} }
} }
......
// app.js // app.js
import util from './utils/util.js'
import '~/router/routerBefore.js' // 初始化sentry
import router from './router/index.js' import sentryInit from '~/utils/sentryConfig/sentryInit'
sentryInit()
import util from './utils/util'
import wxApi from './utils/utils_wx'
import '~/router/routerBefore'
import router from './router/index'
// 有问题 前后顺序不能随意调整 // 有问题 前后顺序不能随意调整
// console.log(test)
import { setSystem_info } from '~/utils/cache/storageApi' import { setSystem_info } from '~/utils/cache/storageApi'
// console.log(setSystem_info) // console.log(setSystem_info)
// 判断小程序是否需要更新 // 判断小程序是否需要更新
import getUpdateManager from './utils/lib/wxUpdateManager' import getUpdateManager from './utils/lib/wxUpdateManager'
// 埋点 // 埋点
import './utils/track/Track' // import './utils/track/Track'
import eventbus from './utils/evenbus' import eventbus from './utils/evenbus'
...@@ -24,11 +31,19 @@ promisifyAll() ...@@ -24,11 +31,19 @@ promisifyAll()
import { Storage } from './utils/cache/storage' import { Storage } from './utils/cache/storage'
const $Storage = new Storage() const $Storage = new Storage()
//全局分享
import './utils/share'
//监听网络状态
import './utils/network'
App({ App({
onLaunch(options) { onLaunch(options) {
/**挂载到wx对象 */ /**挂载到wx对象 */
/**挂载到wx对象 */
wx.$authStatus = false wx.$authStatus = false
wx.$util = util wx.$util = util
wx.$api = wxApi
wx.$router = router wx.$router = router
wx.$storage = $Storage /** 挂载全局缓存方法 */ wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$eventbus = eventbus wx.$eventbus = eventbus
...@@ -45,6 +60,5 @@ App({ ...@@ -45,6 +60,5 @@ App({
wx.$router.goHome() wx.$router.goHome()
}, },
onHide() {}, onHide() {},
globalData: { globalData: {}
}
}) })
{ {
"pages": ["login/loading/loading","pages/tab/index/index", "pages/tab/output/output", "pages/tab/mine/mine", "pages/webView/webView","login/index/index"], "pages": [
"login/loading/loading",
"pages/tab/index/index",
"pages/tab/output/output",
"pages/tab/mine/mine",
"pages/webView/webView",
"pages/apply/apply",
"login/index/index",
"login/accountItems/accountItems",
"pages/checkProduct/checkProduct",
"packageOutput/pages/summary/summary",
"packageOutput/pages/openBusiness/openBusiness",
"pages/mineDetail/customerManagement/customerManagement",
"pages/mineDetail/messageBox/messageBox"
],
"requiredPrivateInfos": ["getLocation"], "requiredPrivateInfos": ["getLocation"],
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"window": { "window": {
...@@ -12,7 +26,8 @@ ...@@ -12,7 +26,8 @@
"selectedColor": "#3666FE", "selectedColor": "#3666FE",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "white", "borderStyle": "white",
"list": [{ "list": [
{
"pagePath": "pages/tab/index/index", "pagePath": "pages/tab/index/index",
"text": "拓客户", "text": "拓客户",
"iconPath": "images/home.png", "iconPath": "images/home.png",
...@@ -21,8 +36,8 @@ ...@@ -21,8 +36,8 @@
{ {
"pagePath": "pages/tab/output/output", "pagePath": "pages/tab/output/output",
"text": "看产值", "text": "看产值",
"iconPath": "images/mall.png", "iconPath": "images/output.png",
"selectedIconPath": "images/mall_active.png" "selectedIconPath": "images/output_active.png"
}, },
{ {
"pagePath": "pages/tab/mine/mine", "pagePath": "pages/tab/mine/mine",
...@@ -34,7 +49,11 @@ ...@@ -34,7 +49,11 @@
}, },
"subpackages": [], "subpackages": [],
"usingComponents": { "usingComponents": {
"tab": "/components/Tab/Tab",
"navigation-bar": "/components/NavigationBar/NavigationBar",
"popup": "/components/Popup/Popup",
"nothing-tips": "/components/Nothing-tips/nothingTips",
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster"
}, },
"style": "v2", "style": "v2",
"resolveAlias": { "resolveAlias": {
...@@ -45,6 +64,5 @@ ...@@ -45,6 +64,5 @@
"scope.userLocation": { "scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示" "desc": "你的位置信息将用于小程序位置接口的效果展示"
} }
}, }
"plugins": {}
} }
@import "/common.wxss"; @import "/style/common.wxss";
page { page {
background-color: #F7F7F7; background-color: #F7F7F7;
color: #282829; color: #282829;
font-size: 28rpx; font-size: 28rpx;
--themeColor: #F13C3D; --themeColor: #F13C3D;
--btnColor: #FC5B32; --btnColor: #3666FE;
--borderRadius: 8rpx; --borderRadius: 8rpx;
--margin: 32rpx; --margin: 32rpx;
} }
......
// components/Authorize/Authorize.js // components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -39,7 +35,7 @@ Component({ ...@@ -39,7 +35,7 @@ Component({
} }
}, },
observers: { observers: {
'show': function (newVal) { show: function (newVal) {
this.setData({ this.setData({
openSet: newVal openSet: newVal
}) })
...@@ -48,9 +44,7 @@ Component({ ...@@ -48,9 +44,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -58,15 +52,10 @@ Component({ ...@@ -58,15 +52,10 @@ Component({
/** /**
* 禁止滑动 * 禁止滑动
*/ */
noScroll: wx.$util.noScroll(), 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) {
......
...@@ -4,16 +4,13 @@ const _separator_ = Symbol('_separator_') ...@@ -4,16 +4,13 @@ const _separator_ = Symbol('_separator_')
class Calendar { class Calendar {
[_CalendarObject_] = {}; [_CalendarObject_] = {};
[_nowDate_] = new Date(); [_nowDate_] = new Date();
[_separator_] = '-'; [_separator_] = '-'
constructor(calendarObject) { constructor(calendarObject) {
this[_CalendarObject_] = calendarObject this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator this[_separator_] = calendarObject.data.separator
this.setCalenderHeight() this.setCalenderHeight()
this.setMonthList() this.setMonthList()
let { let { weekdays, firstDayOfWeek } = calendarObject.data
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1] let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay) let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({ calendarObject.setData({
...@@ -23,15 +20,11 @@ class Calendar { ...@@ -23,15 +20,11 @@ class Calendar {
/**设置日历高度 */ /**设置日历高度 */
setCalenderHeight() { setCalenderHeight() {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { data: calenderHeight } = _this
data: calenderHeight
} = _this
let height = '80%' let height = '80%'
if (typeof calenderHeight === 'number') { if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => { wx.$api.getSystemInfo(res => {
let { let { windowHeight } = res
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5 if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px` height = `${calenderHeight}px`
...@@ -56,25 +49,27 @@ class Calendar { ...@@ -56,25 +49,27 @@ class Calendar {
/**设置日期高度 */ /**设置日期高度 */
setCalenderBodyHeight() { setCalenderBodyHeight() {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => { wx.$util.getViewInfo(
wx.$util.getViewInfo('.calender-footer', footer => { '.calender-header',
header => {
wx.$util.getViewInfo(
'.calender-footer',
footer => {
let headerHeight = header.height let headerHeight = header.height
let footerHeight = footer && footer.height || 0 let footerHeight = (footer && footer.height) || 0
_this.setData({ _this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px` calenderBodyHeight: `${headerHeight + footerHeight}px`
}) })
}, _this) },
}, _this) _this
)
},
_this
)
} }
/**设置日期列表 */ /**设置日期列表 */
setMonthList() { setMonthList() {
let { let { separator, previous, minDate, maxDate, next } = this[_CalendarObject_].data
separator,
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
if (maxDate || minDate) { if (maxDate || minDate) {
if (!minDate) { if (!minDate) {
let nowMonth = new Date().getMonth() let nowMonth = new Date().getMonth()
...@@ -98,19 +93,7 @@ class Calendar { ...@@ -98,19 +93,7 @@ class Calendar {
/**初始化日期 */ /**初始化日期 */
init(date) { init(date) {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { firstDayOfWeek, allowSameDay, multipleDate, monthList, rangeDate, dateList, dateType, current, minDate, maxDate, value } = _this.data
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_] let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator) let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month)) let days = this.getDayNumber(year, Number(month))
...@@ -127,7 +110,7 @@ class Calendar { ...@@ -127,7 +110,7 @@ class Calendar {
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator) let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) { for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}` let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}` let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}` : i}`
let obj = { let obj = {
day: i, day: i,
data: dayStr, data: dayStr,
...@@ -180,17 +163,10 @@ class Calendar { ...@@ -180,17 +163,10 @@ class Calendar {
/**单选 */ /**单选 */
single(e) { single(e) {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { index, data, ind } = e.currentTarget.dataset
index, let { showConfirm, monthList } = _this.data
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
monthList.map(x => { monthList.map(x => {
x.data.map(i => i.active = false) x.data.map(i => (i.active = false))
}) })
monthList[index].data[ind].active = true monthList[index].data[ind].active = true
_this.setData({ _this.setData({
...@@ -202,18 +178,15 @@ class Calendar { ...@@ -202,18 +178,15 @@ class Calendar {
/**多选 */ /**多选 */
multiple(e) { multiple(e) {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { index, ind } = e.currentTarget.dataset
index, let { monthList } = _this.data
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let arr = [] let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => { monthList.map(x =>
x.data.map(i => {
if (i.active) arr.push(i.data) if (i.active) arr.push(i.data)
})) })
)
_this.setData({ _this.setData({
[`monthList[${index}].data`]: monthList[index].data, [`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr multipleDate: arr
...@@ -222,17 +195,8 @@ class Calendar { ...@@ -222,17 +195,8 @@ class Calendar {
/**范围选择 */ /**范围选择 */
range(e) { range(e) {
const _this = this[_CalendarObject_] const _this = this[_CalendarObject_]
let { let { index, data, ind } = e.currentTarget.dataset
index, let { allowSameDay, showConfirm, monthList, rangeDate } = _this.data
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
const start = Date.parse(rangeDate.start) const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) { if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({ monthList = this.clearStatus({
...@@ -264,16 +228,11 @@ class Calendar { ...@@ -264,16 +228,11 @@ class Calendar {
/**点击完成 */ /**点击完成 */
done() { done() {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { multipleDate, rangeDate, dateType, date } = _this.data
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let targer = { let targer = {
'single': date, single: date,
'multiple': multipleDate, multiple: multipleDate,
'range': rangeDate range: rangeDate
} }
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', { _this.triggerEvent('select', {
...@@ -284,17 +243,15 @@ class Calendar { ...@@ -284,17 +243,15 @@ class Calendar {
/**清空范围选择状态 */ /**清空范围选择状态 */
clearStatus(params) { clearStatus(params) {
let { let { monthList, index, ind } = params
monthList, monthList.map(x =>
index, x.data.map(i => {
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false i.active = false
i.start = false i.start = false
i.end = false i.end = false
i.middle = false i.middle = false
})) })
)
monthList[index].data[ind].active = true monthList[index].data[ind].active = true
monthList[index].data[ind].start = true monthList[index].data[ind].start = true
return monthList return monthList
...@@ -307,24 +264,20 @@ class Calendar { ...@@ -307,24 +264,20 @@ class Calendar {
switch (month) { switch (month) {
case 2: case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28 days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break; break
case 4: case 4:
case 6: case 6:
case 9: case 9:
case 11: case 11:
days = 30 days = 30
break; break
} }
return days return days
} }
/**日期范围 点击全选 */ /**日期范围 点击全选 */
chooseAll() { chooseAll() {
let _this = this[_CalendarObject_] let _this = this[_CalendarObject_]
let { let { monthList, minDate, maxDate } = _this.data
monthList,
minDate,
maxDate
} = _this.data
monthList.map((e, index) => { monthList.map((e, index) => {
e.data.map((i, ind) => { e.data.map((i, ind) => {
let obj = { let obj = {
...@@ -337,11 +290,10 @@ class Calendar { ...@@ -337,11 +290,10 @@ class Calendar {
} }
} }
if (i.data == minDate) this.range(obj) if (i.data == minDate) this.range(obj)
if(i.data == maxDate) this.range(obj) if (i.data == maxDate) this.range(obj)
}) })
}) })
} }
} }
export default Calendar export default Calendar
// packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.js
import Draw from '~/utils/Draw'
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
observer(n) {
console.log(n, '=================')
n.posterUrl && this.getImageInfo(n)
}
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
getImageInfo(n, width, height) {
wx.$api.showLoading('处理中')
let that = this
wx.getImageInfo({
src: `${n.posterUrl}?v=${Date.now()}`,
success: function (res) {
console.log(res)
// w = res.width
// h = res.height
that.init(n, res.width, res.height)
},
fail: function (res) {
console.log(res)
wx.$api.showToast('生成失败')
}
})
},
async init(n, ImgWidth, ImgHeight) {
let proportion = ImgWidth / 247
let actualHeight = ImgHeight / proportion
console.log(actualHeight)
n.activityName = n.activityName.length > 12 ? `${n.activityName.substring(0, 12)}...` : n.activityName
const drawfun = new Draw(
{
width: 279,
// height: 554
height: 82 + actualHeight
},
this
),
{ userInfo } = wx.$storage.get(),
merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName,
res = await drawfun.begin({
imageList: [
{
x: 0,
y: 0,
width: 279,
height: 66,
url: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/poster-bg.png'
},
{
x: 16,
y: 70,
width: 247,
height: actualHeight,
url: n.posterUrl
}
],
textList: [
{
x: 12,
y: 14,
fontSize: 14,
color: '#2D2D33',
text: merchantName,
textBaseline: 'top'
},
{
x: 12,
y: 36,
fontSize: 14,
color: '#1B233D',
text: n.activityName,
textBaseline: 'top',
fontWeight: 500
},
{
x: 14 + drawfun.getTextWidth(n.activityName, 14) + 9,
y: 37,
fontSize: 10,
color: '#4466F0',
text: '众筹',
textBaseline: 'top',
border: {
width: 1,
color: '#4466F0',
radius: 2,
padding: [2, 5],
opacity: 0.5
}
}
]
})
console.log(res)
wx.hideLoading()
this.setData({
poster: res.path,
show: true
})
},
download() {
const filePath = this.data.poster,
_this = this
wx.saveImageToPhotosAlbum({
filePath,
success() {
wx.$api.showToast('保存成功')
},
fail(err) {
const auth = _this.selectComponent('#auth')
auth.check()
}
})
},
hide() {
this.setData({
show: false,
poster: ''
})
},
noScroll() {},
authFail(e) {
this.setData({
showAuth: true
})
}
}
})
{
"component": true,
"usingComponents": {
"authorize":"/components/Authorize/Authorize"
}
}
\ No newline at end of file \ No newline at end of file
/* packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.wxss */
.layout {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(28, 27, 35, 0.60);
}
.poster {
width: 558rpx;
// height: 60%;
height: 1108rpx;
overflow: scroll;
border-radius: 8rpx;
}
.btn {
width: 320rpx;
height: 88rpx;
line-height: 88rpx;
background: #3666FE;
// background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
border-radius: 16rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
margin-top: 32rpx;
}
.tips {
margin: 16rpx 80rpx 0;
font-size: 24rpx;
color: #FFFFFF;
line-height: 36rpx;
}
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}">
<!-- catchtouchmove="noScroll" -->
<view class="layout">
<view class="bg" bindtap="hide" />
<view class="poster">
<!-- <scroll-view scroll-x="false" scroll-y="true" style="height: 100%"> -->
<image src="{{poster}}" mode="widthFix" />
<!-- </scroll-view> -->
</view>
<view class="btn" bindtap="download">保存至相册</view>
<view class="tips">提示:这是您的专属活动海报,请下载转发给门店员工注册并参与活动分享。请不要将此海报转发给非相关活动参与者,避免活动数据泄漏。</view>
</view>
</block>
<authorize
scopeType="writePhotosAlbum"
bindfail="authFail"
show="{{showAuth}}"
isShowCheck="{{false}}"
id="auth" />
// components/GlCell/GlCell.js
Component({
/**
* 组件的属性列表
*/
properties: {
label: String,
labelWidth: String,
border: Boolean,
haveArrow: Boolean,
value: String,
valueAlign: String,
required: Boolean,
placeholder: String,
iconSrc: String,
labelStyle: String,
cellHeight: {
type: Boolean,
value: true
},
requiredBefore: {
type: Boolean,
value: true
},
requiredAfter: {
type: Boolean,
value: false,
observer: function (n, o) {
if (n) {
this.setData({
requiredBefore: false
})
}
}
},
disabled: Boolean
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
click(e) {
if (this.data.disabled) return
this.triggerEvent('click')
},
titleClick() {
this.triggerEvent('titleClick')
}
}
})
<view class='cell-box'>
<view class="cell {{cellHeight?'cellHeight': ''}} {{border?'border':''}}" bindtap="click">
<view class='cell-label' style="width:{{labelWidth}};{{labelStyle}}" bindtap="titleClick">
<text wx:if='{{required&&requiredBefore}}' class='required'>*</text>
{{label||'标题'}}
<image class="titleIcon" wx:if="{{iconSrc}}" src="{{iconSrc}}" />
<text wx:if='{{required&&requiredAfter}}' class='required'>*</text>
</view>
<view class='cell-value ' style="width:calc(100% - {{labelWidth}});">
<view class='value {{valueAlign}} {{haveArrow}}'>
<view class='slot'>
<slot/>
</view>
<block wx:if="{{value}}">
<view class='details'>{{value}}</view>
</block>
<block wx:if="{{placeholder}}">
<view class='placeholder'>{{placeholder}}</view>
</block>
</view>
<image wx:if='{{haveArrow}}' class='arrow' src="../images/arrow-x.png" />
</view>
</view>
</view>
/* components/GlCell/GlCell.wxss */
.cell-box {
background: #fff;
font-size: 28rpx;
color: #333333;
box-sizing: border-box;
}
.cell {
width: 100%;
box-sizing: border-box;
display: flex;
/* padding-left: 40rpx; */
align-items: center;
}
.cellHeight {
height: 120rpx;
}
.cell.border {
border-bottom: 2rpx solid rgba(195, 195, 195, .3);
}
.cell-label {
width: 25%;
}
.titleIcon {
width: 34rpx;
height: 34rpx;
}
.cell-value {
width: 75%;
position: relative;
height: 100%;
}
.cell-value .false {
padding-right: 40rpx !important;
}
.value {
width: 100%;
height: 100%;
display: flex;
align-items: center;
padding-right: 70rpx;
box-sizing: border-box;
}
.required {
color: #f00;
}
.details,
.placeholder {
display: none;
}
.slot:empty+.details,
.slot:empty+.placeholder {
display: block;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.placeholder {
color: #C3C3C3;
}
.cell-value .right {
justify-content: flex-end;
height: 100%;
box-sizing: border-box;
}
.cell-value .right .details,
.cell-value .right .placeholder {
text-align: right;
}
.slot {
width: 100%;
}
.slot:empty {
display: none;
}
.arrow {
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
width: 28rpx;
height: 26rpx;
}
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ Component({ ...@@ -6,6 +6,7 @@ Component({
properties: { properties: {
navStyle: String, navStyle: String,
custom: Boolean, custom: Boolean,
showBack: Boolean,
pageTitle: { pageTitle: {
type: String, type: String,
value: '', value: '',
...@@ -46,7 +47,13 @@ Component({ ...@@ -46,7 +47,13 @@ Component({
right, right,
width, width,
top top
} = wx.getMenuButtonBoundingClientRect() } = wx.getMenuButtonBoundingClientRect(),
currentPages = getCurrentPages(), {
showBack
} = this.data
if (showBack && currentPages.length > 1) this.setData({
SHOWBACK: true
})
let navigationBarHeight = height + ((top - statusBarHeight) * 2) + 4 // 4 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
...@@ -68,7 +75,6 @@ Component({ ...@@ -68,7 +75,6 @@ Component({
}) { }) {
let navHeight = navigationBarHeight + statusBarHeight let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.$router.getPageInstance() const thisPage = wx.$router.getPageInstance()
const currentPages = getCurrentPages()
this.triggerEvent('navbarReady', { this.triggerEvent('navbarReady', {
height: navHeight, height: navHeight,
statusBarHeight statusBarHeight
...@@ -80,9 +86,9 @@ Component({ ...@@ -80,9 +86,9 @@ Component({
navHeight, navHeight,
statusBarHeight statusBarHeight
}) })
if (currentPages.length == 1 && !thisPage.rootName) thisPage.setData({ },
showHomeBtn: true back() {
}) wx.$router.back()
} }
}, },
lifetimes: { lifetimes: {
......
<view class="navigation-bar" id="navigation-bar" <view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}"> <block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}"> <view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<block wx:if="{{SHOWBACK}}">
<view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" />
</view>
</block>
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}"> <view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
<slot></slot> <slot/>
</view> </view>
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<slot></slot> <slot/>
</block> </block>
</view> </view>
/* components/navigationBar/navigationBar.wxss */ /* components/navigationBar/navigationBar.wxss */
.navigation-bar{ .navigation-bar {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
background-color: #fff; background-color: #fff;
transition: all .15s; transition: all .15s;
} }
.navigation-bar-box{
.navigation-bar-box {
position: relative; position: relative;
height: 100%; height: 100%;
display: flex; display: flex;
...@@ -17,7 +18,8 @@ ...@@ -17,7 +18,8 @@
box-sizing: border-box; box-sizing: border-box;
} }
.navigation-bar-titleText{
.navigation-bar-titleText {
color: #333333; color: #333333;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -27,18 +29,29 @@ ...@@ -27,18 +29,29 @@
text-align: center; text-align: center;
letter-spacing: 1rpx; letter-spacing: 1rpx;
} }
.back-box{
.back-box {
width: 76rpx; width: 76rpx;
height: 100%; height: 100%;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
} }
.back{
.back {
position: absolute; position: absolute;
left: 20rpx; left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 36rpx; width: 100rpx;
height: 36rpx; /* height: 34rpx; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back .img {
width: 16rpx;
height: 34rpx;
} }
\ No newline at end of file \ No newline at end of file
// components/Nothing-tips/nothingTips.js
Component({
/**
* 组件的属性列表
*/
properties: {
tips: String,
bg: String
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/Nothing-tips/nothingTips.wxss */
.nothingCon {
width: 100vw;
height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
// justify-content: center;
.bg {
width: 512rpx;
height: 512rpx;
}
.tips {
margin-top: -15rpx;
font-size: 24rpx;
color: #CCCED1;
text-align: center;
}
}
\ No newline at end of file \ No newline at end of file
<!-- components/Nothing-tips/nothingTips.wxml -->
<view class="nothingCon">
<image
wx:if="{{bg}}"
class="bg"
src="{{bg}}"
webp></image>
<view wx:if="{{tips}}" class="tips">{{tips}}</view>
<slot/>
</view>
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js // tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -23,14 +19,13 @@ Component({ ...@@ -23,14 +19,13 @@ Component({
}, 0.2 * 1000) }, 0.2 * 1000)
} else { } else {
let hideTab = wx.$hideTab let hideTab = wx.$hideTab
console.log(hideTab) // console.log(hideTab)
this.setData({ this.setData({
showPopup: true, showPopup: true,
close: false, close: false,
hideTab hideTab
}) })
} }
} }
}, },
title: String, title: String,
...@@ -48,7 +43,7 @@ Component({ ...@@ -48,7 +43,7 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
// hideTab: false
}, },
/** /**
...@@ -60,17 +55,16 @@ Component({ ...@@ -60,17 +55,16 @@ Component({
this.setData({ this.setData({
show: false show: false
}) })
this.triggerEvent('hidePopup')
}, },
confirm() { confirm() {
this.triggerEvent('confirm') this.triggerEvent('confirm')
} }
}, },
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
}) })
}, }
}) })
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
} }
.popup-slot { .popup-slot {
height: calc(100% - 200rpx); height: calc(100% - 100rpx);
} }
.popup-slot.isFullSucreen { .popup-slot.isFullSucreen {
......
// pages/tab/output/components/sceneBox/sceneBox.js
import { IMG_URL } from '~/utils/constantData'
Component({
/**
* 组件的属性列表
*/
properties: {
sceneActive: {
type: Number,
value: -1
},
hasOpenIcon: {
type: Boolean,
value: true
},
hasLockIcon: {
type: Boolean,
value: true
},
formData: {
type: Object,
value: () => {}
},
scenePriceList: {
type: Array,
value: () => []
}
},
/**
* 组件的初始数据
*/
data: {
IMGURL: IMG_URL,
openedIcon: `${IMG_URL}/output/openedIcon.png`,
custSceneList: [
{
title: '新车洽谈场景',
subTitle: '1.0新车权益升级'
},
{
title: '新车交付场景',
subTitle: '1.1新车精品升级'
},
{
title: '0-6个月',
subTitle: '1.2次新车膨胀金活动'
},
{
title: '6个月以上',
subTitle: '1.3售后直播众筹活动'
}
]
},
/**
* 组件的方法列表
*/
methods: {
handleClick(e) {
let { idx } = e.currentTarget.dataset
this.triggerEvent('handleSceneChange', { sceneIdx: idx })
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!-- pages/tab/output/components/sceneBox/sceneBox.wxml -->
<view class="flex scene">
<view
class="scene-item {{ (formData['scene' + (index + 1)] && hasOpenIcon) ? 'open' : ''}} {{ (sceneActive != -1 && sceneActive == index + 1) ? 'active' : ''}}"
wx:for="{{custSceneList}}"
wx:key="index"
bindtap="handleClick"
data-idx="{{index + 1}}">
<!-- && sceneActive != (index + 1) -->
<view wx:if="{{hasOpenIcon && formData['scene' + (index + 1)]}}" class="open-icon">
<image src="{{openedIcon}}" webp></image>
</view>
<image webp wx:if="{{formData['scene' + (index + 1)]}}" class="scene-img" src="{{IMGURL}}output/caract0{{index + 1}}.png?v={{img_version}}" ></image>
<view wx:else class="no-open-img">
<image webp wx:if="{{hasLockIcon}}" class="lock-img" src="{{IMGURL}}output/carlock0{{index + 1}}.png?v={{img_version}}" ></image>
<image webp wx:else="" class="scene-img" src="{{IMGURL}}output/car0{{index + 1}}.png?v={{img_version}}" ></image>
</view>
<view class="scene-title {{formData['scene' + (index + 1)] ? '' : 'on-open'}}">
{{item.title}}
</view>
<view>{{item.subTitle}}</view>
<view class="total-price" wx:if="{{scenePriceList.length}}">
¥ {{scenePriceList[index].total}}
</view>
</view>
</view>
/* pages/tab/output/components/sceneBox/sceneBox.wxss */
.flex {
display: flex;
}
.scene {
text-align: center;
width: 100%;
}
.scene-item {
box-sizing: border-box;
position: relative;
width: 25%;
/* flex: 1; */
background: #F7F8FC;
margin-right: 4rpx;
font-size: 18rpx;
/* color: #8A8C90; */
color: #323436;
padding: 32rpx 0 28rpx;
border-radius: 12rpx;
font-weight: 500;
/* margin-bottom: 20rpx; */
}
.scene-item:last-child {
margin-right: 0;
}
.scene-title {
font-size: 24rpx;
height: 44rpx;
line-height: 44rpx;
margin: 10rpx 0 4rpx;
}
/* 已开通 - start */
.open.scene-item {
background: #F0F7FF;
}
.open-icon {
box-sizing: border-box;
position: absolute;
top: 0;
right: 0;
width: 78rpx;
height: 78rpx;
/* left: 0.5rpx;
top: 0.5rpx;
width: 56rpx;
height: 32rpx;
line-height: 24rpx;
background: #FEEBD6;
border-radius: 6rpx 0 8rpx 0;
font-size: 18rpx;
font-weight: 600;
color: #EF971E;
padding: 4rpx; */
}
/* 已开通 - end */
/* 选中 - start */
.active.scene-item {
background-image: linear-gradient(145deg, #F0F7FF 0%, #FFFFFF 73%);
border: 2rpx solid #3666FE;
box-shadow: 0 4rpx 8rpx 0 rgba(180, 186, 204, 0.32), 0 8rpx 20rpx 0 rgba(180, 186, 204, 0.40);
}
.active::after {
position: absolute;
left: 50%;
bottom: -17rpx;
display: block;
content: "";
width: 16rpx;
height: 16rpx;
/* border-radius: 4rpx; */
border-bottom: 1px solid var(--btnColor);
border-right: 1px solid var(--btnColor);
transform: rotate(45deg) translateX(-50%);
background-color: #fff;
}
/* 选中 - end */
.scene-title {
color: #323436;
}
/* .scene-title.on-open {
color: #8A8C90;
} */
.no-open-img {
position: relative;
}
.scene-img {
width: 56rpx;
height: 56rpx;
}
.lock-img {
width: 92rpx;
height: 64rpx;
}
.total-price {
height: 40rpx;
line-height: 40rpx;
margin-top: 22rpx;
font-size: 24rpx;
color: #3666FE;
font-weight: 600;
}
.notOpened {
color: #8A8C90;
}
\ 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({
......
// components/Select/Select.js
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
innerText: {
type: String,
value: 'default value'
}
},
data: {
// 这里是一些组件内部数据
someData: {}
},
methods: {
// 这里是一个自定义方法
customMethod: function () {}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/Select/Select.wxss */
.com-selectBox {
width: 200px;
}
.com-sContent {
border: 1px solid #e2e2e2;
background: white;
font-size: 16px;
position: relative;
height: 30px;
line-height: 30px;
}
.com-sImg {
position: absolute;
right: 10px;
top: 11px;
width: 16px;
height: 9px;
transition: all .3s ease;
}
.com-sTxt {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 20px 0 6px;
font-size: 14px;
}
.com-sList {
background: white;
width: inherit;
position: absolute;
border: 1px solid #e2e2e2;
border-top: none;
box-sizing: border-box;
z-index: 3;
max-height: 120px;
overflow: auto;
}
.com-sItem {
height: 30px;
line-height: 30px;
border-top: 1px solid #e2e2e2;
padding: 0 6px;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
}
.com-sItem:first-child {
border-top: none;
}
\ No newline at end of file \ No newline at end of file
<!-- components/Select/Select.wxml -->
<view class='com-selectBox'>
<view class='com-sContent' bindtap='selectToggle'>
<view class='com-sTxt'>{{nowText}}</view>
<image src='../../public/image/index/jinru1@2x.png' class='com-sImg' animation="{{animationData}}" />
</view>
<view class='com-sList' wx:if="{{selectShow}}">
<view
wx:for="{{propArray}}"
data-index="{{index}}"
wx:key=''
class='com-sItem'
bindtap='setText'>
{{item.text}}
</view>
</view>
</view>
// components/Tab/Tab.js // components/Tab/Tab.js
import {componentsMixin } from '../../mixins/index' // behaviors: [LocationBehavior],
import { imgUrlMixin } from '~/mixins/index'
Component({ Component({
behaviors:[componentsMixin], behaviors: [imgUrlMixin],
options: {
addGlobalClass: true
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
outClassName:String,
tab: Array, tab: Array,
openScroll: Boolean, openScroll: Boolean,
tabHeight: {
type: Boolean,
value: false
},
productHeight: {
type: Boolean,
value: false
},
index: { index: {
type: Number, type: Number,
observer: function (n) { observer: function (n) {
...@@ -17,10 +30,16 @@ Component({ ...@@ -17,10 +30,16 @@ Component({
}) })
} }
}, },
itemWidth: String,
align: { align: {
type: String, type: String,
default: '' value: ''
} },
// 是否有红点
unreadClueCount: {
type: Number,
value: 0
},
}, },
/** /**
...@@ -30,18 +49,22 @@ Component({ ...@@ -30,18 +49,22 @@ Component({
count: 0, count: 0,
to: '' to: ''
}, },
// lifetimes:{
// attached: function() {
// console.log('unreadClueCount',this.data.unreadClueCount)
// }
// },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
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}`,
unreadClueCount:0
}) })
this.triggerEvent('click', count) this.triggerEvent('click', count)
} }
......
<wxs src="./Tab.wxs" module="filterUtils" />
<block wx:if="{{openScroll}}"> <block wx:if="{{openScroll}}">
<scroll-view class="tab-box {{align}}" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}"> <scroll-view class="tab-box {{align}} {{outClassName}}" style="{{productHeight ? 'height: 72rpx;' : ''}}" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}" enhanced="{{true}}" show-scrollbar="{{false}}">
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}" id="to-{{index}}" > <view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}" id="to-{{index}}">
<view class="text" >{{item}}</view> <view class="text" style="{{productHeight ? 'height: 60rpx;' : ''}}">{{item}}</view>
<!-- <view class="text" style="width:{{38 * item.length + 20}}rpx;">{{item}}</view> --> <!-- <view class="text" style="width:{{38 * item.length + 20}}rpx;">{{item}}</view> -->
<view class="line"></view> <view class="line" style="{{productHeight ? 'height: 4rpx;' : ''}}" />
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
</block> </block>
<block wx:else> <block wx:else>
<view class="tab-box flex"> <view class="tab-box flex" style="{{tabHeight ? 'height: 60rpx;' : ''}}">
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}"> <view class="tab {{index==count?'active':''}}" style="width:{{itemWidth}}; {{index == 0 ? 'margin-left: 32rpx;' : ''}}" bindtap="click" data-count="{{index}}">
<view class="text text-center">{{item}}</view> <view class="text text-center" style="{{tabHeight ? 'height: 60rpx;' : ''}}">{{item}}</view>
<view class="line"></view> <view class="line" style="{{tabHeight ? 'margin-top: 6rpx;' : ''}}" />
<!-- -->
<view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" />
</view> </view>
</block> </block>
</view> </view>
......
var hasRedpoint = function (unreadClueCount) {
// console.log('unreadClueCount: ', unreadClueCount);
if(unreadClueCount>0){
return true
}else{
return false;
}
};
module.exports = {
hasRedpoint: hasRedpoint,
};
/* components/Tab/Tab.wxss */ /* components/Tab/Tab.wxss */
@import "../../common.wxss";
.tab-box { .tab-box {
display: flex; display: flex;
/* display: grid; */
width: 100%; width: 100%;
height: 92rpx; height: 92rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.tab-box.left{
.tab-box.left {
padding-left: 32rpx; padding-left: 32rpx;
} }
.left .tab{
padding-right:40rpx; .left .tab {
padding-right: 40rpx;
} }
.flex .tab {
/* .flex .tab {
flex: 1; flex: 1;
} } */
.tab { .tab {
position: relative; position: relative;
flex-shrink: 0; flex-shrink: 0;
} }
.tab .text { .tab .text {
height: 84rpx; height: 84rpx;
display: flex; display: flex;
...@@ -27,19 +32,24 @@ ...@@ -27,19 +32,24 @@
box-sizing: border-box; box-sizing: border-box;
color: #A9A9A9; color: #A9A9A9;
justify-content: center; justify-content: center;
font-size: 28rpx;
} }
.left .text{
.left .text {
justify-content: flex-start; justify-content: flex-start;
} }
.flex .tab .text { .flex .tab .text {
padding: 0; padding: 0;
} }
.tab.active .text { .tab.active .text {
font-weight: 500; /* font-weight: 500; */
font-size: 28rpx; font-weight: 600;
font-size: 44rpx;
transition: all .25s; transition: all .25s;
color: #2C2C2C; color: #2C2C2C;
font-family: PingFangSC-S0pxibold;
} }
.tab .line { .tab .line {
...@@ -62,3 +72,38 @@ ...@@ -62,3 +72,38 @@
height: 0; height: 0;
color: transparent; color: transparent;
} }
.active .redpoint {
display: none;
}
.redpoint {
position: absolute;
top: 10px;
right: 5px;
/* top: 8px;
right: 10px; */
width: 10px;
height: 10px;
background: #EB4E4E;
border-radius: 50%;
}
/* 外部出进来的自定义样式 */
.project-tab {
padding-left: 20px;
padding-right: 20px;
}
.project-tab .tab {
margin-right: 28px;
}
.project-tab .tab.active .text {
font-size: 28rpx;
color: var(--btnColor);
}
.project-tab .tab .line {
width: auto;
}
\ No newline at end of file \ No newline at end of file
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
export const preReleaseAppId = 'wx24ebae5768e74138'
// sentry Dsn 地址
export const dsnUrl = 'https://59c3cfc3ffb84ed68fc0dda26fb09e12@sentry.glsx.com.cn/30'

1.42 KB | W: | H:

2.64 KB | W: | H:

images/home.png
images/home.png
images/home.png
images/home.png
  • 2-up
  • Swipe
  • Onion skin

1.63 KB | W: | H:

2.88 KB | W: | H:

images/home_active.png
images/home_active.png
images/home_active.png
images/home_active.png
  • 2-up
  • Swipe
  • Onion skin

1.34 KB | W: | H:

2.59 KB | W: | H:

images/mine.png
images/mine.png
images/mine.png
images/mine.png
  • 2-up
  • Swipe
  • Onion skin

1.47 KB | W: | H:

2.84 KB | W: | H:

images/mine_active.png
images/mine_active.png
images/mine_active.png
images/mine_active.png
  • 2-up
  • Swipe
  • Onion skin
// pages/accountItems/accountItems.js
import USERAPI from '~/api/usersApi/index'
import {
selectAccountLogin
} from '~/login/lib/index'
const navStyle = 'background-color: rgba(0,0,0,0)'
Page({
/**
* 页面的初始数据
*/
data: {
navStyle
},
onRoute({
sessionId
}) {
this.getListSelectAccount(sessionId)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onPageScroll({
scrollTop
}) {
let scrollTop_num = scrollTop / 100
if (scrollTop_num > 0 && scrollTop_num <= 1 && this.data.navStyle != 'background-color:#FFF;') this.setData({
navStyle: `background-color:#FFF;`
})
if (scrollTop_num == 0) this.setData({
navStyle
})
},
getListSelectAccount(sessionId) {
wx.$api.showLoading('加载中...')
USERAPI.getAccountList(sessionId).then(({
code,
data,
message
}) => {
wx.hideLoading()
if (code == 0) {
let {
loginUserInfoList,
sessionId
} = data
this.setData({
loginUserInfoList
})
this.sessionId = sessionId
} else wx.$api.showToast(message)
this.setData({
flag: true
})
})
},
chooseAccount(e) {
let {
index
} = e.currentTarget.dataset
let {
loginUserInfoList
} = this.data
if (loginUserInfoList[index].active) return
loginUserInfoList.map(i => (i.active = false))
loginUserInfoList[index].active = true
this.setData({
loginUserInfoList
})
},
choiceAccountLogin() {
let {
loginUserInfoList
} = this.data,
id = null, {
sessionId
} = this
loginUserInfoList.map(e => {
if (e.active) id = e.uuid
})
if (!id) {
wx.$api.showToast('请选择账号')
return
}
console.log(sessionId)
wx.$api.showLoading()
selectAccountLogin({
id,
sessionId
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar"
},
"navigationStyle": "custom"
}
\ No newline at end of file \ No newline at end of file
/* login/accountItems/accountItems.wxss */
@import '../index/index.scss';
page {
background-color: #fff;
}
.layout {
font-size: 28rpx;
color: #323436;
letter-spacing: 0;
padding: 196rpx 32rpx 224rpx;
position: relative;
&::after {
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
}
.title {
font-weight: 500;
font-size: 36rpx;
color: #323436;
margin-bottom: 20rpx;
}
.items {
width: 100%;
min-height: 108rpx;
box-shadow: 0 4rpx 16rpx 0 rgba(180, 186, 204, 0.32);
padding: 32rpx;
margin-bottom: 32rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.items .name {
width: calc(100% - 70rpx);
}
.items:last-of-type {
margin-bottom: 0;
}
.radio {
width: 28rpx;
height: 28rpx;
border: 2rpx solid #DDE3F0;
border-radius: 100%;
transition: all .2s;
box-sizing: border-box;
}
.icon {
width: 28rpx;
height: 28rpx;
transition: all .2s;
display: none;
}
.active .icon {
display: block;
}
.active .radio {
display: none;
}
.btn-box {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 140rpx;
display: flex;
justify-content: center;
align-items: center;
z-index: 20;
background-color: #fff;
color: #fff;
padding: 0 32rpx;
box-sizing: border-box;
}
.list-not {
height: calc(100vh - 159px);
font-size: 40rpx;
}
\ No newline at end of file \ No newline at end of file
<view class="layout">
<navigation-bar navStyle="{{navStyle}}">选择账号</navigation-bar>
<view class="title">请选择登录的账号</view>
<view class="list">
<block wx:if="{{flag}}">
<block wx:if="{{loginUserInfoList.length}}">
<block wx:for="{{loginUserInfoList}}" wx:key="index">
<view class="items {{item.active?'active':''}}" bindtap="chooseAccount" data-index="{{index}}">
<view class="name">
{{item.merchantName}}{{item.isSuper?'(超管)':item.userType==1?'(商户号)':'(员工号)'}}
</view>
<view class="icon">
<image src="{{IMG_URL}}login/radio.png" />
</view>
<view class='radio' />
</view>
</block>
</block>
<block wx:else>
<view class="list-not text-center" bindtap="getListSelectAccount">
点击刷新
</view>
</block>
</block>
</view>
<view class="btn-box isFullSucreen">
<button class="button" disabled="{{!loginUserInfoList.length}}" bindtap="choiceAccountLogin">确定</button>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// login/index/components/Agree/Agree.js
import { imgUrlMixin } from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
options: {
styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
text: String,
value: {
type: Boolean,
value: false,
observer(n) {
this.setData({
agree: n
})
}
}
},
/**
* 组件的初始数据
*/
data: {
agree: false
},
/**
* 组件的方法列表
*/
methods: {
agree() {
let {agree} = this.data
this.triggerEvent('change', !agree)
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* login/index/components/Protocol/Protocol.wxss */ /* login/index/components/Agree/Agree.wxss */
.protocol { .agree {
margin-top: 274rpx; // position: fixed;
// left: 0;
// bottom: 100rpx;
width: 100%;
margin-top: 20rpx;
text { text {
color: #5092FF; color: #5092FF;
} }
......
<block wx:if="{{show}}">
<view class="agree text-center" bindtap="agree">
<view class="icon {{agree}}">
<image webp src="{{IMGURL}}login/radio.png"></image>
</view>
<block wx:if="{{text}}">{{text}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
</block>
\ No newline at end of file \ No newline at end of file
// login/index/components/LoginBox.js // login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index'
import {
checkLoginUserInfo,
setLoginInfo,
loginModal
} from '~/login/lib/index'
import md5 from '~/utils/lib/md5'
import network from '~/utils/network'
import {
imgUrlMixin
} from '~/mixins/index'
let thisPage
Component({ Component({
behaviors: [imgUrlMixin],
options: {
styleIsolation: 'shared'
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
loginType: Number loginType: Number,
disabled: Boolean
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
formData: {
phone: '',
code: '',
account: '',
password: ''
},
phoneReady: false,
countDown: null
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
/**隐藏验证码错误 */
hideError(name) {
if (name == 'code')
this.setData({
smsError: false
})
},
/**输入回调 */
input(e) {
const {
value
} = e.detail, {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: value
})
if (name == 'phone')
this.setData({
phoneReady: thisPage.validate.methods.tel(value)
})
this.hideError(name)
this.checkFormData()
},
/**清除input value */
clear(e) {
const {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: ''
})
this.hideError(name)
this.checkFormData()
},
/**获取验证码 */
getSmsCode() {
const {
phoneReady,
formData,
count
} = this.data,
countDown = 60
if (!phoneReady || count) return
this.setData({
smsLoading: true
})
USERAPI.getSmsCode(formData.phone)
.then(({
code,
message
}) => {
this.setData({
smsLoading: false
})
if (code == '0') this.countDown(countDown)
else wx.$api.showToast(message || '发送验证码失败')
})
.catch(err => {
this.setData({
smsLoading: false
})
wx.$api.showToast(err || '发送验证码失败')
})
},
/**验证码倒计时 */
countDown(countDown) {
if (countDown)
this.setData({
count: countDown
})
setTimeout(() => {
let {
count
} = this.data
this.setData({
count: --count
})
if (count > 0) this.countDown()
else
this.setData({
count: null
})
}, 1e3)
},
/**检查输入框内容 */
checkFormData() {
const {
loginType,
formData
} = this.data
if (loginType != 0) {
if (loginType == 1) {
this.setData({
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
},
() => {
thisPage.checkLoginBtn()
}
)
} else thisPage.checkLoginBtn()
}
},
/**显示隐藏密码 */
pwdSwitch() {
this.setData({
showPwd: !this.data.showPwd
})
},
/**手机号&帐号密码登录 */
login() {
const {
formData,
loginType
} = this.data,
target = {
1: 'phoneSmsLogin',
2: 'accountLogin'
} [loginType],
obj =
loginType == 1 ? {
mobile: formData.phone,
code: formData.code
} : {
userName: formData.account,
password: md5(formData.password)
}
this.setBtnLoading()
USERAPI[target](obj)
.then(({
code,
data,
message
}) => {
this.setBtnLoading(false)
if (code == '0') {
if (loginType == 1) checkLoginUserInfo(data)
else {
const {
autoLogin
} = thisPage.data, {
sessionId,
loginUserInfoList
} = data,
validTime = 3600 * 24 * 7 * 1e3,
autoLoginFailureTime = Date.now() + validTime
if (autoLogin && loginUserInfoList[0]) {
wx.$storage.set('auto_login_object', {
failureTime: autoLoginFailureTime,
userName: formData.account,
password: md5(formData.password)
})
} else wx.$storage.rm('auto_login_object')
setLoginInfo(loginUserInfoList[0], sessionId)
}
} else {
if (loginType == 1)
this.setData({
smsError: true
})
wx.$api.showToast(message || '系统异常')
}
})
.catch(err => {
wx.$api.showToast('系统异常')
this.setBtnLoading(false)
})
},
/**微信登录 */
wxLogin({
detail
}) {
if (!detail.code) return
this.setBtnLoading()
USERAPI.authUserPhone(detail, this.loginToken)
.then(({
code,
data,
message
}) => {
if (code == '0') checkLoginUserInfo(data)
else {
wx.$api.showToast(message || '系统异常')
this.init()
}
this.setBtnLoading(false)
})
.catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false)
this.init()
})
},
/**设置登录按钮loading状态 */
setBtnLoading(loading = true) {
thisPage.setData({
loading
})
this.setData({
loading
})
},
/**页面初始化 */
async init() {
network.getNetworkType()
thisPage = wx.$router.getPageInstance()
try {
const {
data,
code,
message
} = await USERAPI.wxCodeLogin()
if (code == '0') {
thisPage.setData({
disabled: false
})
this.loginToken = data
} else this.reLogin(message)
wx.hideLoading()
} catch ({
errMsg
}) {
console.error(errMsg)
this.reLogin()
}
},
/**获取loginToken */
async reLogin(message) {
const reload = await loginModal({
message: message || '获取loginToken失败'
})
if (reload) this.init()
}
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {
"input-icon":"../InputIcon/InputIcon"
}
} }
\ No newline at end of file \ No newline at end of file
/* login/index/components/LoginBox.wxss */ /* login/index/components/LoginBox.wxss */
.box { .box {
height: 800rpx; // height: 800rpx;
height: 750rpx;
.opacity-view {
animation: opacity-view .5s forwards;
}
.img { .img {
width: 472rpx; width: 472rpx;
height: 458rpx; height: 458rpx;
position: absolute; position: absolute;
left: 151rpx; left: 151rpx;
top: 264rpx; // top: 264rpx;
top: 214rpx;
}
.input-box {
width: 540rpx;
// padding-top: 352rpx;
padding-top: 302rpx;
margin: 0 auto;
.title {
font-weight: 500;
font-size: 44rpx;
color: #323436;
}
.input {
display: flex;
align-items: center;
margin-top: 33rpx;
border-bottom: 1rpx solid #E3E3E6;
padding: 24rpx 0;
position: relative;
input {
flex: 1;
color: #323436;
font-size: 28rpx;
}
.placeholder {
color: #CCCED1;
font-size: 28rpx;
}
.sms {
width: 160rpx;
flex-shrink: 0;
color: #5092FF;
font-size: 24rpx;
padding: 0;
text-align: right;
transition: all .25s;
&[disabled]:not([type]) {
color: #CCCED1;
}
}
.error {
position: absolute;
font-size: 24rpx;
color: #F35251;
left: 0;
bottom: -13rpx;
transform: translateY(100%);
}
}
} }
} }
\ No newline at end of file \ No newline at end of file
<view class="box"> <view class="box">
<block wx:if="{{loginType == 0}}"> <block wx:if="{{loginType == 0}}">
<image webp class="img" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/login.png" /> <image webp class="img opacity-view" src="{{IMGURL}}login/login.webp" />
</block> </block>
<block wx:else> <block wx:else>
<view class="input-box opacity-view">
<view class="title">{{loginType == 1?'手机号':'账号'}}登录</view>
<block wx:if="{{loginType == 1}}">
<view class="input">
<input type="number" placeholder="填写手机号" placeholder-class="placeholder" bindinput="input" data-name="phone" value="{{formData.phone}}" maxlength="11" />
<input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
</view>
<view class="input">
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="4" />
<input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
<button class="sms text-center " bindtap="getSmsCode" disabled="{{count || !phoneReady}}" loading="{{smsLoading}}">{{
count? count + 's':'获取验证码'
}}</button>
<block wx:if="{{smsError}}">
<view class="error">验证码错误</view>
</block>
</view>
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="填写账号" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="15" />
<input-icon show="{{formData.account}}" bindtap="clear" data-name="account" />
</view>
<view class="input">
<input type="text" placeholder="填写密码" placeholder-class="placeholder" bindinput="input" data-name="password" value="{{formData.password}}" maxlength="20" password='{{!showPwd}}' />
<input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" />
<input-icon show="{{formData.password}}" bindtap="clear" data-name="password" />
</view>
</block>
</view>
</block> </block>
</view> </view>
<block wx:if="{{loginType == 0}}">
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin" loading="{{loading}}">微信登录</button>
</block>
<block wx:else>
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" bindtap="login" loading="{{loading}}">登录</button>
</block>
\ No newline at end of file \ No newline at end of file
// login/index/components/InputIcon/InputIcon.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
type: {
type: String,
value: 'clear'
},
src: String
},
/**
* 组件的初始数据
*/
data: {
ICON_TYPE: {
showPwd: './images/seePwd.png',
hidePwd: './images/hidePwd.png',
clear: './images/clear.png'
}
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* login/index/components/Clear/Clear.wxss */
.icon-box {
width: 44rpx;
height: 40rpx;
padding: 0 10rpx;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
transition: all .25s;
.icon {
width: 32rpx;
height: 32rpx;
}
}
\ No newline at end of file \ No newline at end of file
<view class="icon-box" hidden="{{!show}}">
<image src="{{src || ICON_TYPE[type]}}" class="icon"></image>
</view>
\ No newline at end of file \ No newline at end of file
// login/index/components/Protocol/Protocol.js // login/index/components/Mask/Mask.js
Component({ Component({
options: {
styleIsolation: 'shared'
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
agree:Boolean maskStyle: String,
show: Boolean
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
agreeProtocol() {
const thisPage = wx.$router.getPageInstance(),
{agree} = thisPage.data
thisPage.setData({
agree: !agree
})
thisPage.checkLoginBtn()
},
} }
}) })
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* login/index/components/Mask/Mask.wxss */
.mask{
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 99999999999;
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}">
<view class="mask" style="{{maskStyle}}"></view>
</block>
\ No newline at end of file \ No newline at end of file
<view class="protocol text-center">
<view class="icon {{agree}}" bindtap="agreeProtocol">
<image src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/radio.png"></image>
</view>
我已阅读并同意<text>《隐私权政策》</text>
</view>
\ No newline at end of file \ No newline at end of file
// login/index/components/TypeList.js // login/index/components/TypeList.js
import { imgUrlMixin } from '~/mixins/index'
Component({ Component({
behaviors: [imgUrlMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -24,6 +26,7 @@ Component({ ...@@ -24,6 +26,7 @@ Component({
thisPage.setData({ thisPage.setData({
loginType loginType
}) })
wx.vibrateShort()
thisPage.checkLoginBtn() thisPage.checkLoginBtn()
}, },
} }
......
/* login/index/components/TypeList.wxss */ /* login/index/components/TypeList.wxss */
.tips { .tips {
padding-top: 120rpx; padding-top: 100rpx;
text-align: center; text-align: center;
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.tips.true{
padding-top: 48rpx;
}
.login-list { .login-list {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 0 118rpx;
.item { .item {
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
width: 100rpx; width: 100rpx;
animation: opacity-view .25s forwards; animation: btn-move .25s forwards;
margin:0 59rpx;
.icon { .icon {
width: 68rpx; width: 68rpx;
height: 68rpx; height: 68rpx;
...@@ -25,5 +26,13 @@ ...@@ -25,5 +26,13 @@
} }
} }
@keyframes btn-move {
0% {
transform: scale(0.1);
}
100% {
transform: scale(1);
}
}
} }
\ No newline at end of file \ No newline at end of file
<view class="tips">其他方式</view> <view class="tips {{loginType == 2}}">其他方式</view>
<view class="login-list"> <view class="login-list">
<block wx:for="{{loginList}}" wx:key="index"> <block wx:for="{{loginList}}" wx:key="index">
<block wx:if="{{loginType != index}}"> <block wx:if="{{loginType != index}}">
<view class="item" bindtap="changLoginType" data-index="{{index}}"> <view class="item" bindtap="changLoginType" data-index="{{index}}">
<image class="icon" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/icon-{{index}}.png"></image> <image class="icon" webp src="{{IMGURL}}login/icon-{{index}}.png"></image>
{{item}} {{item}}
</view> </view>
</block> </block>
......
// pages/login/index/index.js import WxValidate from '../../utils/WxValidate.js'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
navStyle: 'background-color: rgba(0,0,0,0);', /**0:微信 1:手机号 2:账号密码 */
loginType: 0, loginType: 0,
agree: true /**按钮disabled */
disabled: true,
/**免登 */
autoLogin: false
}, },
onRoute(options) {},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.validate = new WxValidate()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady() {},
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow(options, refresh) {
wx.$util.showLoading() 1
if (refresh) {
this.setData({
disabled: true
})
}
wx.hideHomeButton({ wx.hideHomeButton({
success: (res) => { success: res => {
wx.hideLoading() wx.hideLoading()
const login = this.selectComponent('#box')
if (login) login.init()
// this.checkLoginBtn()
} }
}) })
}, },
...@@ -39,44 +47,44 @@ Page({ ...@@ -39,44 +47,44 @@ Page({
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {},
},
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {},
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {},
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {},
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { // onShareAppMessage() {},
/**30天免登 */
changeAgree(e) {
this.setData({
autoLogin: e.detail
})
}, },
checkLoginBtn() { checkLoginBtn(disabled = false) {
const { const { loginType } = this.data,
agree, {
loginType data: { formData },
} = this.data loginToken
} = this.selectComponent('#box')
if (loginType == 0) {
disabled = loginToken
} else disabled = loginType == 1 ? formData.phone && this.validate.methods.tel(formData.phone) && formData.code && formData.code.length == 4 : formData.account && formData.password
this.setData({ this.setData({
disabled: !agree disabled: !disabled
}) })
} }
}) })
{ {
"usingComponents": { "usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar", "navigation-bar": "/components/NavigationBar/NavigationBar",
"mask": "./components/Mask/Mask",
"box": "./components/Box/Box", "box": "./components/Box/Box",
"type-list": "./components/TypeList/TypeList", "type-list": "./components/TypeList/TypeList",
"protocol": "./components/Protocol/Protocol" "agree": "./components/Agree/Agree"
}, },
"navigationStyle": "custom" "navigationStyle": "custom",
"disableScroll": true
} }
\ No newline at end of file \ No newline at end of file
@keyframes opacity-view {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.layout { .layout {
position: relative; position: relative;
padding: 0 32rpx; padding: 0 32rpx;
...@@ -18,29 +8,41 @@ ...@@ -18,29 +8,41 @@
content: ''; content: '';
width: 100%; width: 100%;
height: 486rpx; height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat; background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx; background-size: 100% 486rpx;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
z-index: -1; z-index: -1;
} }
.button { }
width: 100%; @keyframes opacity-view {
0% {
opacity: 0;
transform: scale(0.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.button {
width: 100% !important;
height: 88rpx; height: 88rpx;
background: #3666FE; background: var(--btnColor);
border-radius: 8rpx; border-radius: 8rpx;
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; color: #FFFFFF;
line-height: 88rpx; line-height: 88rpx;
padding: 0; padding: 0;
transition: all .1s;
&[disabled]:not([type]){
background: #CCCED1 !important;
color: #fff !important;
} }
.disabled{ }
background: #CCCED1; .btn-hover {
}
.btn-hover {
opacity: .75; opacity: .75;
}
} }
\ No newline at end of file \ No newline at end of file
<navigation-bar navStyle="{{navStyle}}">生意助手</navigation-bar>
<view class="layout"> <view class="layout">
<box loginType="{{loginType}}" /> <mask show="{{loading}}"></mask>
<button class="button {{disabled?'disabled':''}}" hover-class="btn-hover">{{loginType == 0?'微信登陆':'登陆'}}</button> <navigation-bar navStyle="background-color: rgba(0,0,0,0)">生意助手</navigation-bar>
<box loginType="{{loginType}}" disabled="{{disabled}}" id="box" />
<agree show="{{loginType == 2}}" text="7天内免登陆" value="{{autoLogin}}" bindchange="changeAgree" />
<type-list loginType="{{loginType}}" /> <type-list loginType="{{loginType}}" />
<protocol agree="{{agree}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
import {
setSessionId,
setUserInfo
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
const setRouteData = targetPath => {
let [url, query] = targetPath.split('?'),
obj = {}
if (query) {
const [key, val] = query.split('=')
obj = {
[key]: val
}
}
return {
url,
obj
}
}
/**选择账号登录 */
const selectAccountLogin = ({
id,
sessionId
}) => {
USERAPI.selectAccountLogin({
id,
sessionId
}).then(({
code,
data,
message
}) => {
if (code == '0') {
console.log(data)
setLoginInfo(data.loginUserInfoList[0], data.sessionId)
} else wx.$api.showToast(message || '系统异常')
})
}
/**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => {
if (!userInfo) {
wx.$api.showToast('仅支持服务商类型账户登录')
return
}
setUserInfo(userInfo)
setSessionId(sessionId)
loginSuccess()
}
/**成功跳转 */
const loginSuccess = () => {
const {
options: {
targetPath
}
} = wx.$router.getPageInstance()
if (targetPath) {
const {
url,
obj
} = setRouteData(targetPath)
wx.$router.reLaunch(url, obj)
} else wx.$router.go('pages.index')
}
const loginModal = async ({
message,
confirmText,
cancelText
}) => {
return new Promise((resolve, reject) => {
wx.showModal({
content: message || '网络异常',
confirmText: confirmText || '重试',
cancelText: cancelText || '取消',
confirmColor: '#3666FE',
success(res) {
if (res.confirm) resolve(res.confirm)
if (res.cancel) reject(false)
}
})
})
}
/**手机号&微信登录:是否跳转登录列表页 */
const checkLoginUserInfo = ({
loginUserInfoList,
sessionId
}) => {
const thisPage = wx.$router.getPageInstance()
/**多个账号 */
if (loginUserInfoList.length > 1)
wx.$router.go('login.accountItems', {
sessionId,
...thisPage.options
})
/**只有一个账号 */
else
selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
}
module.exports = {
checkLoginUserInfo,
selectAccountLogin,
loginSuccess,
setRouteData,
setLoginInfo,
loginModal
}
\ No newline at end of file \ No newline at end of file
import {
checkLoginUserInfo,
setRouteData,
setLoginInfo,
loginModal
} from '../lib/index'
import {
getSessionId,
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
Page({ Page({
/** /**
...@@ -25,19 +36,16 @@ Page({ ...@@ -25,19 +36,16 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
const appEnter = wx.getEnterOptionsSync()
if (appEnter.scene == 1037) {
if (Object.keys(appEnter.referrerInfo).length) {
const { const {
sessionId, extraData
} = wx.$storage.get(), { } = appEnter.referrerInfo
url, if (extraData && Object.keys(extraData).length) this.phoneSmsLogin(extraData)
path = decodeURIComponent(url) else this.init()
} = this.options } else this.init()
console.log(path) } else this.init()
if (sessionId) {
} else {
wx.$router.reLaunch('login.index')
}
}, },
/** /**
...@@ -67,11 +75,93 @@ Page({ ...@@ -67,11 +75,93 @@ Page({
onReachBottom() { onReachBottom() {
}, },
init() {
/** wx.nextTick(() => {
* 用户点击右上角分享 const sessionId = getSessionId(),
*/ {
onShareAppMessage() { url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
if (sessionId) {
USERAPI.checkSession().then(({
code
}) => {
if (code == '0') {
if (targetPath) {
path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(path, obj)
} else this.autoLogin(obj)
})
} else this.autoLogin(obj)
})
},
autoLogin(obj) {
const autoLoginObject = wx.$storage.get('auto_login_object')
if (autoLoginObject) {
const {
failureTime,
userName,
password
} = autoLoginObject
if (Date.now() < failureTime) {
USERAPI.accountLogin({
userName,
password
}).then(async ({
data,
code,
message
}) => {
if (code == '0' && data.loginUserInfoList.length) {
const {
sessionId,
loginUserInfoList
} = data
setLoginInfo(loginUserInfoList[0], sessionId)
} else {
try {
const reload = await loginModal({
message: data.loginUserInfoList.length ? message : '登录失败请重试',
cancelText: '返回'
})
if (reload) this.onShow()
} catch (error) {
wx.$storage.rm('auto_login_object')
wx.$router.reLaunch('login.index', obj)
}
}
})
} else wx.$router.reLaunch('login.index', obj)
} else wx.$router.reLaunch('login.index', obj)
},
phoneSmsLogin(extraData) {
console.log(extraData)
USERAPI.phoneSmsLogin({
mobile: extraData.phone,
code: extraData.smscode
}).then(({
code,
data,
message
}) => {
if (code == '0') checkLoginUserInfo(data)
else {
wx.$api.showToast(message || '系统异常')
setTimeout(() => {
wx.$router.reLaunch('login.index')
}, 1e3)
}
})
.catch(err => {
wx.$api.showToast('系统异常')
setTimeout(() => {
wx.$router.reLaunch('login.index')
}, 1e3)
})
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": {} "usingComponents": {},
"navigationStyle": "custom",
"disableScroll": true
} }
\ No newline at end of file \ No newline at end of file
.layout{ .layout {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
display: grid; display: flex;
place-items: center; align-items: center;
.icon{ justify-content: center;
width: 480rpx; flex-direction: column;
height: 480rpx; background-color: #fff;
.loading {
height: 48rpx;
view {
width: 16rpx;
height: 100%;
display: inline-block;
background-color: #0052d9;
animation: stretchdelay 1.2s infinite ease-in-out;
margin: 0 4rpx;
&:nth-child(2) {
animation-delay: -1.1s;
}
&:nth-child(3) {
animation-delay: -1s;
}
&:nth-child(4) {
animation-delay: -.9s;
}
}
}
}
@keyframes stretchdelay {
0%,
100%,
40% {
transform: scaley(.33);
}
20% {
transform: scaley(1);
} }
} }
\ No newline at end of file \ No newline at end of file
<view class="layout"> <view class="layout">
<image class="icon" src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/COVER_LIVE.gif"></image> <image webp src="{{IMG_URL}}login/index-loading.webp" mode="widthFix" ></image>
<!-- <view class="loading">
<block wx:for="{{4}}" wx:key="index">
<view></view>
</block>
</view> -->
</view> </view>
\ No newline at end of file \ No newline at end of file
No preview for this file type
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!