Commit dafbc3b6 by liwk

commit

0 parents
> 1%
last 2 versions
not dead
# 所有环境默认
# 网络请求公用地址(正式环境)
VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router
# 测试环境 。
#VUE_APP_API=https://qcwx.glsx.com.cn/rop-ddh-carlife/router
#正式环境
#VUE_APP_KEY=d7ffc3346fc9a45bccaaa35300d59022
#VUE_APP_SECRET=4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353
#测试环境
VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
\ No newline at end of file
# 所有环境默认
# 页面 title 前缀
VUE_APP_TITLE=广联运营平台
# 网络请求公用地址
#VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router
VUE_APP_API=https://qcwx.glsx.com.cn/rop-ddh-carlife/router
# APPKEY
VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
\ No newline at end of file
module.exports = {
root: true,
env: {
node: true
},
globals: { wx: true },
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
},
}
\ No newline at end of file
.DS_Store
node_modules
/dist
# 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*
\ No newline at end of file
# wechat
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run dev
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This diff could not be displayed because it is too large.
{
"name": "wechat",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.0",
"core-js": "^3.6.5",
"sha1": "^1.1.1",
"vant": "^2.10.11",
"vconsole": "^3.4.0",
"vue": "^2.6.12",
"vue-router": "^3.2.0",
"vue-wechat-title": "^2.0.7",
"vuex": "^3.6.2",
"webpack-spritesmith": "^1.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0",
"@vue/cli-plugin-eslint": "^4.5.0",
"@vue/cli-plugin-router": "^4.5.0",
"@vue/cli-plugin-vuex": "^4.5.0",
"@vue/cli-service": "^4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.12.0",
"postcss-px-to-viewport": "^1.1.1",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
}
}
const path = require('path');
module.exports = ({ file }) => {
return {
plugins: {
autoprefixer: {},
"postcss-px-to-viewport": {
unitToConvert: "px",
viewportWidth: 375,
unitPrecision: 6,
propList: ["*"],
viewportUnit: "vw",
fontViewportUnit: "vw",
selectorBlackList: [],
minPixelValue: 1,
mediaQuery: true,
exclude: [],
landscape: false
}
}
}
}
\ No newline at end of file
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<title>权益中心</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<style>
html,
body {
margin: 0;
padding: 0;
}
#app {
color: #333333;
}
</style>
\ No newline at end of file
<template>
<div id="app">
<template v-if="$route.meta.showNavBar && !isMiniprogram">
<div class="nav-bar">
<van-nav-bar
safe-area-inset-top
:title="$route.meta.title"
left-arrow
@click-left="onClickLeft"
/>
</div>
</template>
<transition name="fade">
<keep-alive>
<router-view
v-if='$route.meta.keepAlive'
v-wechat-title="$route.meta.title"
/>
</keep-alive>
</transition>
<transition name="fade">
<router-view
v-wechat-title="$route.meta.title"
v-if='!$route.meta.keepAlive'
/>
</transition>
</div>
</template>
<script>
// import VConsole from 'vconsole'
export default {
data () {
return {
}
},
components: {
},
created () {
},
mounted () {
// if (this.isMiniprogram)
// window.vConsole = new VConsole()
},
methods: {
onClickLeft () {
if (this.goHome) {
if (this.checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 1 }))
} else {
window.myjs.jumpNativeApp(JSON.stringify({ type: 1 }))
}
} else {
this.$router.back()
}
}
}
}
</script>
<style scoped>
#app {
font-size: 14px;
}
</style>
\ No newline at end of file
const RequestMethods = {
POST: 'post',
GET: 'get',
PUT: 'put',
DELETE: 'delete'
}
export default RequestMethods
\ No newline at end of file
import request from './request'
export const scene = {
/**场景列表 */
getList() {
return request({}, 'ddh.carlife.scene.getList')
},
/**场景详情/ */
getSceneDetails(data) {
return request(data, 'ddh.carlife.scene.getById')
},
/**场景开关 */
setSceneSwitch(data) {
return request(data, 'ddh.carlife.scene.updateStatus')
},
/**场景模版详情 */
getSceneTemplateDetails(data) {
return request(data, 'ddh.carlife.scene.template.getById ')
},
/**设备列表 */
getDevList(data = {}) {
return request(data, 'ddh.carlife.product.remote.getList')
},
/**获取设备ID */
getProductList(data) {
return request(data, 'ddh.carlife.product.getList')
},
/**获取设备指令 */
getConditionList() {
return request({}, 'ddh.carlife.product.type.getConditionList')
},
/** 获取设备任务列表 */
getContentList() {
return request({}, 'ddh.carlife.product.type.getContentList')
},
/**设置设备任务 */
setDevMission(data) {
return request(data, 'ddh.carlife.scene.orderValue.getList ')
},
/**新增场景 d*/
sceneSave(data) {
return request(data, 'ddh.carlife.scene.save ')
},
/** 埋点*/
getUseCount(data) {
return request(data, 'ddh.carlife.smadeviceinfo.getUseCount', 'GET')
},
/**红外设备 */
getRemotes(data) {
return request(data, 'ddh.carlife.smadeviceinfo.findRemotes', 'GET')
},
/**删除场景 */
deleteScene(data) {
return request(data, 'ddh.carlife.scene.delete')
},
/**家庭信息接口 */
getUserAddress() {
return request({}, 'ddh.carlife.intelligent.family.address.get')
},
/**手动执行 */
issueOrder(data) {
return request(data, ' ddh.carlife.scene.issueOrder', 'GET')
},
}
export const discover = {
/** 发现页banner */
getBannerList() {
return request({ functionType: 3 }, 'ddh.carlife.smadeviceinfo.getBannerList')
},
/**发现页 */
getDiscoverList() {
return request({}, 'ddh.carlife.scene.template.getList')
},
}
\ No newline at end of file
import axios from 'axios'
import Qs from 'qs'
import {
Toast,
Notify,
Dialog
} from 'vant'
import store from '@/store'
axios.defaults.withCredentials = true
const service = axios.create({
baseURL: process.env.VUE_APP_API,
timeout: 60 * 1000, // 请求超时时间
transformRequest: [function(data) {
return Qs.stringify(data)
}],
headers: {
'Cache-Control': 'no-cache'
}
})
service.interceptors.request.use(
config => {
return config
}
)
service.interceptors.response.use(
response => {
Toast.clear()
const dataAxios = response.data
// 这个状态码是和后端约定的
const { code, data, message } = dataAxios
// 有 code 代表这是一个后端接口 可以进行进一步的判断
if (code == -1) {
Notify({ type: 'danger', message })
}
switch (+code) {
case 0:
return data
case 1:
Notify({ type: 'danger', message })
break
case 20:
case 21:
if (window.__wxjs_environment === 'miniprogram') {
Dialog.alert({
title: '温馨提示',
message: '登录过期,请重新登录。',
confirmButtonColor: '#008fff'
}).then(() => {
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateTo({
url: `/pages/relogin/relogin?sessionId=${store.state.sessionId}`
})
} else {
if (this.checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 0 }))
} else {
window.myjs.jumpNativeApp(JSON.stringify({ type: 0 }))
}
}
})
}
break
default:
break
}
},
error => {
Toast.clear()
Notify({ type: 'danger', message: '系统异常' })
console.log(error)
return Promise.reject(error)
})
export default service
\ No newline at end of file
import axios from './axios'
import sign from './sign'
import RequestMethods from './RequestMethods'
import store from '@/store'
const request = (params = {}, url, method = RequestMethods.POST, noSignAttr = []) => {
params.method = url.trimStart().trimEnd()
params.source = 'h5'
params.appKey = process.env.VUE_APP_KEY
params.timestamp = new Date().format('yyyy-MM-dd hh:mm:ss')
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
let { sessionId } = store.state
params.sessionId = sessionId
if (method == 'post') {
return axios({
method,
data: sign(params, noSignAttr)
})
} else {
return axios({
method,
params: sign(params, noSignAttr)
})
}
}
export default request
\ No newline at end of file
import sha1 from 'sha1'
import qs from 'qs'
const secret = process.env.VUE_APP_SECRET
const sign = (params, noSignAttr = []) => {
delete params.sign
var objStr = qs.stringify(params, { arrayFormat: 'indices', encode: false, allowDots: true })
var objVal = objStr.split('&')
var realObj = {}
objVal.forEach(item => {
if (item.split('=')[0] == 'scene') {
realObj.scene = params.scene
} else {
realObj[item.split('=')[0]] = item.split('=')[1]
}
})
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
export default sign
\ No newline at end of file
@import './sprite';
* {
margin: 0;
padding: 0;
}
img {
width: 100%;
height: 100%;
vertical-align: top;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.btn-disabled {
background: #ccc !important;
}
.x-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.y-center {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.fixed-btn {
position: fixed !important;
bottom: 20px;
}
.btn-on-leave {
position: relative;
overflow: hidden;
&::after {
position: absolute;
top: 0;
left: 0;
content: '';
width: 100%;
height: 100%;
background-color: rgba($color: #000000, $alpha: .1);
display: block;
}
}
// 路由淡入淡出
.fade-enter-active,
.fade-leave-active {
transition-property: opacity;
transition-duration: .3s;
}
.fade-enter-active {
transition-delay: .3s;
}
.fade-enter,
.fade-leave-active {
opacity: 0;
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 446px 356px;}
.icon-default-avatar { width: 50px; height: 50px; background-position: -210px -296px;}
.icon-equity-card { width: 336px; height: 216px; background-position: 0px 0px;}
.icon-tuanyou { width: 60px; height: 60px; background-position: -346px -70px;}
.icon-vip { width: 20px; height: 18px; background-position: -416px -100px;}
.icon-more { width: 20px; height: 20px; background-position: -416px -70px;}
.icon-didi { width: 60px; height: 60px; background-position: -346px -140px;}
.icon-halou { width: 60px; height: 60px; background-position: -346px -210px;}
.icon-qingji { width: 60px; height: 60px; background-position: 0px -296px;}
.icon-tickets { width: 60px; height: 60px; background-position: -70px -296px;}
.icon-today { width: 60px; height: 60px; background-position: -140px -296px;}
.icon-kfc { width: 100px; height: 60px; background-position: 0px -226px;}
.icon-m { width: 100px; height: 60px; background-position: -110px -226px;}
.icon-xbk { width: 100px; height: 60px; background-position: -220px -226px;}
.icon-ruixing { width: 100px; height: 60px; background-position: -346px 0px;}
\ No newline at end of file
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '@u/util'
import Vant from 'vant'
import 'vant/lib/index.css'
import VueWechatTitle from 'vue-wechat-title'
import '@a/scss/common.scss'
import store from "./store"
Vue.use(VueWechatTitle)
Vue.use(Vant)
Vue.config.productionTip = false
Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram'
window.vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
\ No newline at end of file
import indexMixin from './indexMixin'
export {
indexMixin
}
\ No newline at end of file
export default {
data() {
return {
notice: '',
phone_range: ['134', '135', '136', '137', '138', '139', '147', '150', '151', '152', '157', '158', '159', '182', '183', '184', '187', '188', '130', '131', '132', '145', '155', '156', '185', '186', '133', '153', '180', '181', '189', '170', '176', '177', '178'],
travelList: [{
name: '全国加油',
icon: 'tuanyou',
description: '8折起'
},
{
name: '青桔单车',
icon: 'qingji',
description: '6折起'
},
{
name: '滴滴出行',
icon: 'didi',
description: '9折起'
},
{
name: '哈喽单车',
icon: 'halou',
description: '7折起'
}
],
hotelList: [{
name: '今日特惠',
icon: 'today',
description: '超性价比'
},
{
name: '景区门票',
icon: 'tickets',
description: '全国3000+景点'
}
],
cateringList: [{
name: '肯德基',
icon: 'kfc',
description: '最高省81元'
},
{
name: '麦当劳',
icon: 'm',
description: '最高省44元'
},
{
name: '星巴克',
icon: 'xbk',
description: '最高省17元'
},
{
name: '瑞幸咖啡',
icon: 'ruixing',
description: '最高省10元'
}
]
}
},
mounted() {
this.setNoticeInfo()
},
methods: {
setNoticeInfo() {
let { phone_range } = this
let start = this.setRandom(0, phone_range.length, 'floor')
let end = `${this.setRandom(0, 9, 'floor')}${this.setRandom(0, 9, 'floor')}${this.setRandom(0, 9, 'floor')}${this.setRandom(0, 9, 'floor')}`
let phone = `${phone_range[start]}***${end}`
let price = this.setRandom(25.99, 45.99).toFixed(2)
this.notice = `距离您当前位置的油站有优惠,点击加油,用户${phone}刚通过加油优惠${price}元`
},
setRandom(start, end, type) {
if (type == 'floor') {
return Math.floor(Math.random() * (end - start)) + start
}
return Math.random() * (end - start) + start
},
updataNotice() {
this.setNoticeInfo()
}
},
}
\ No newline at end of file
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
const router = new VueRouter({
routes
})
// import store from '@/store'
router.beforeEach(async(to, from, next) => {
let { meta: { showTab, toTop, isDetail } } = to
Vue.prototype.TabShowHide = showTab || false
if (toTop) document.documentElement.scrollTop = 0
if (isDetail) Vue.prototype.goHome = !from.name
next()
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
export default router
\ No newline at end of file
const pages = {
equity: [{
name: 'index',
}],
common: [
]
}
let routes = []
Object.keys(pages).map(parent => {
pages[parent].map((val, index) => {
let { name } = val
let meta = val
delete meta.name
meta.rank = index
if (!meta.title) meta.title = '权益中心'
let routeName = `${parent}.${name}`
let route = {
component: resolve => require([`@v/${parent}/${name}.vue`], resolve),
path: routeName === 'equity.index' ? '/' : `/${parent}/${name}`,
name: routeName,
meta
}
routes.push(route)
})
})
export default routes
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
})
\ No newline at end of file
import Vue from 'vue'
import { Toast, Dialog } from 'vant'
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function(fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
}
const WindowEvent = (type, callBack) => {
if (window.attachEvent) {
window.attachEvent(`on${type}`, function() {
callBack.call(window)
})
} else {
window.addEventListener(type, callBack, false)
}
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function() {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
}
/**防止重复点击 */
// const noScroll = (e) => { e.preventDefault() }
const showLoading = (title = '加载中...') => {
Toast({
type: 'loading',
message: title,
forbidClick: true,
duration: 0
})
}
const hideLoading = () => {
Toast.clear()
}
/**监听页面滚动事件 */
const onPageScroll = callBack => {
WindowEvent('scroll', $event => {
return callBack($event)
})
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow
}
const showToast = (title = '') => {
Toast({
message: title,
forbidClick: true,
})
}
/**触摸样式 */
const touchstart = e => {
e.target.classList.add('btn-on-leave')
}
const touchend = e => {
e.target.classList.remove('btn-on-leave')
}
const setLocalStorage = (key, item) => {
localStorage.setItem(key, JSON.stringify(item))
}
const getLocalStorage = key => {
return JSON.parse(localStorage.getItem(key))
}
const removeLocalStorage = key => {
localStorage.removeItem(key)
}
const dialog = (params = {}) => {
params.confirmButtonColor = '#008fff'
return Dialog.confirm(params)
}
const checkPhoneType = () => {
let equipmentType = ""
let agent = navigator.userAgent.toLowerCase()
let android = agent.indexOf("android")
let iphone = agent.indexOf("iphone")
let ipad = agent.indexOf("ipad")
if (android != -1) {
equipmentType = "android"
}
if (iphone != -1 || ipad != -1) {
equipmentType = "ios"
}
return equipmentType
}
const utils = {
removeLocalStorage,
setLocalStorage,
getLocalStorage,
checkPhoneType,
onPageScroll,
showLoading,
hideLoading,
touchstart,
showToast,
touchend,
throttle,
decimal,
dialog,
}
Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key]
})
\ No newline at end of file
<template>
<div class="main">
<div class="card-box">
<div class="sprite-icon icon-equity-card card">
<div class="card-name">
<div class="sprite-icon icon-vip"></div>
无忧权益尊享版
</div>
<div class="card-user">
<img
:src="userInfo.icon"
v-if="userInfo.icon"
>
<div
v-else
class="sprite-icon icon-default-avatar"
></div>
<div class="card-user-info">
<div class="card-user-info-name text-hide">恒河猴</div>
<div class="card-user-info-time">到期:2021-10-10</div>
</div>
</div>
<div class="card-No">NO:123456789</div>
</div>
</div>
<div class="content">
<van-notice-bar
color="#2C2C2C"
background="#fff"
:left-icon="icon"
@replay="updataNotice"
speed="30"
>
{{notice}}
</van-notice-bar>
<div class="box">
<div class="title">
出行特权
<div class="more">更多<div class="sprite-icon icon-more"></div>
</div>
</div>
<div class="items">
<template v-for="(i,index) in travelList">
<div
class="item"
:key="index"
>
<div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<div class="item-name">{{i.name}}</div>
<div>{{i.description}}</div>
</div>
</template>
</div>
</div>
<div class="box">
<div class="title">
餐饮特权
<div class="more">更多<div class="sprite-icon icon-more"></div>
</div>
</div>
<div class="scroll-items">
<template v-for="(i,index) in cateringList">
<div
class="item"
:key="index"
>
<div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<div class="item-name">{{i.name}}</div>
<div>{{i.description}}</div>
</div>
</template>
</div>
</div>
<div class="box">
<div class="title">
酒店旅游特权
<div class="more">更多<div class="sprite-icon icon-more"></div>
</div>
</div>
<div class="items">
<template v-for="(i,index) in hotelList">
<div
class="item"
:key="index"
>
<div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<div class="item-name">{{i.name}}</div>
<div>{{i.description}}</div>
</div>
</template>
</div>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import { indexMixin } from '@/mixins'
export default {
name: 'index',
data () {
return {
userInfo: {},
icon: require(`@a/images/notice.png`),
}
},
mixins: [indexMixin],
mounted () {
},
methods: {
}
}
</script>
<style lang='scss'>
html,
body {
background-color: rgb(242, 242, 242);
}
.main {
.card-box {
padding: 20px 0 0;
.card {
margin: 0 auto;
position: relative;
font-size: 14px;
color: #ffffff;
padding-left: 24px;
box-sizing: border-box;
&-name {
display: flex;
align-items: center;
height: 70px;
.icon-vip {
margin-right: 8px;
}
}
&-user {
display: grid;
grid-template-columns: 50px calc(100% - 84px);
gap: 0 10px;
&-info {
&-name {
margin-bottom: 10px;
}
}
}
&-No {
position: absolute;
bottom: 33px;
left: 24px;
font-size: 16px;
}
}
}
.content {
.van-notice-bar {
margin: 0 20px 16px;
padding: 0 5px;
border-radius: 8px;
}
.box {
margin-bottom: 20px;
padding-bottom: 20px;
background-color: #fff;
.title {
font-size: 18px;
color: #2c2c2c;
display: flex;
justify-content: space-between;
font-weight: 700;
padding: 10px 20px;
margin-bottom: 14px;
.more {
font-weight: normal;
font-size: 14px;
display: flex;
align-items: center;
.icon-more {
margin-left: 7px;
}
}
}
.items {
display: grid;
grid-template-columns: repeat(4, 1fr);
.item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #999999;
.sprite-icon {
margin-bottom: 4px;
}
&-name {
font-size: 14px;
color: #2c2c2c;
}
}
}
.scroll-items {
overflow-x: scroll;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
padding: 0 20px;
display: flex;
.item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #999999;
.sprite-icon {
margin-bottom: 4px;
margin-right: 10px;
}
&-name {
font-size: 14px;
color: #2c2c2c;
}
}
.item:last-of-type {
.sprite-icon {
margin-right: 20px;
}
}
&::-webkit-scrollbar {
display: none;
height: 0;
opacity: 0;
width: 0;
}
}
}
}
}
</style>
\ No newline at end of file
const path = require('path')
/**
* 雪碧图插件
*/
const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => {
let { spritesheet, sprites } = data
let shared = `.sprite-icon { background-image: url(${data.sprites[0].image});background-size: ${spritesheet.width / 2}px ${spritesheet.height / 2}px;}`
let perSprite = sprites.map(sprite => {
let { name, width, height, offset_x, offset_y } = sprite
return `.icon-${name} { width: ${width / 2}px; height: ${height / 2}px; background-position: ${offset_x / 2}px ${offset_y / 2}px;}`
}).join('\n')
return `${shared}\n${perSprite}`
}
const versions = Math.round(new Date() / 1000)
const CDN_URL = 'https://cdn.bootcdn.net/'
const CDN = {
css: [
'https://cdn.jsdelivr.net/npm/vant@2.12/lib/index.css'
],
js: [
`${CDN_URL}ajax/libs/vue/2.6.11/vue.min.js`,
`${CDN_URL}ajax/libs/vue-router/3.2.0/vue-router.min.js`,
`${CDN_URL}ajax/libs/axios/0.21.0/axios.min.js`,
`${CDN_URL}ajax/libs/vuex/3.6.2/vuex.min.js`,
'https://cdn.jsdelivr.net/npm/vant@2.12/lib/vant.min.js'
]
}
module.exports = {
devServer: {
disableHostCheck: true
},
configureWebpack: config => {
config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [
new SpritesmithPlugin({
// 引入图片文件夹
src: {
cwd: path.resolve(__dirname, './src/assets/spritesmith'),
glob: ['*.png', '*.jpg']
},
// 生成图片的路径
target: {
image: path.resolve(__dirname, './src/assets/images/sprite.png'),
// 生成SCSS
css: [
[path.resolve(__dirname, './src/assets/scss/sprite.scss'), {
format: 'function_based_template'
}]
]
},
customTemplates: {
'function_based_template': spritesmithFunction,
},
//background引用路径
apiOptions: {
cssImageRef: '../images/sprite.png'
},
// 每个图片间距
spritesmithOptions: {
padding: 20
}
})
]
config.plugins = [...config.plugins, ...Plugins]
config.externals = {
'wx': 'wx'
}
},
publicPath: './',
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {
// 给js和css配置版本号
config.output.filename(`js/[name].${versions}.js`).end()
config.output.chunkFilename(`js/[name].${versions}.js`).end()
config.plugin('extract-css').tap(args => [{
filename: `css/[name].${versions}.css`,
chunkFilename: `css/[name].${versions}.css`
}])
config.externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vant': 'Vant',
'axios': 'Axios',
'Vuex': 'vuex'
}
config.plugin('html')
.tap(args => {
args[0].cdn = CDN
return args
})
}
// 修复HMR
config.resolve.symlinks(true);
// 别名配置
config.resolve.alias
.set('@', path.resolve(__dirname, './src'))
.set('@a', path.resolve(__dirname, './src/assets'))
.set('@r', path.resolve(__dirname, './src/api'))
.set('@c', path.resolve(__dirname, './src/components'))
.set('@v', path.resolve(__dirname, './src/views'))
.set('@u', path.resolve(__dirname, './src/utils'))
},
css: {
sourceMap: false
},
runtimeCompiler: true,
productionSourceMap: false
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!