Commit bddcdc91 authored by 郝聪敏's avatar 郝聪敏

新增视频初始播放状态;新增视频暂停播放功能

parent d5b8ee06
......@@ -4,7 +4,7 @@ import eventHub from './common/eventHub';
import vuex from '@wepy/x';
wepy.use(vuex);
//import store from './store';
// import store from './store';
wepy.app({
hooks: {
// App 级别 hook,对整个 App 生效
......@@ -15,38 +15,42 @@ wepy.app({
},
onLaunch() {
let that= this;
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
let that = this;
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
// store.dispatch('setUserInfo',res.userInfo);
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (that.userInfoReadyCallback) {
that.userInfoReadyCallback(res => {
if (that.userInfoReadyCallback) {
that.userInfoReadyCallback(res => {
// store.dispatch('setUserInfo',res.userInfo);
})
}
},
fail: ()=> {
wx.reLaunch({
url: '/pages/auth',
})
}
})
}else{
});
}
},
fail: () => {
wx.reLaunch({
url: '/pages/auth'
});
}
});
} else {
// 未授权,跳转到授权页面
wx.reLaunch({
url: '/pages/auth',
})
}
}
})
wx.reLaunch({
url: '/pages/auth'
});
}
}
});
wx.setStorageSync('onNetworkStatusChange', true);
wx.onNetworkStatusChange((res) => {
wx.setStorageSync('onNetworkStatusChange', res.isConnected);
});
},
methods: {}
});
......
import wepy from 'wepy';
const wxRequest = async (params = {}, url) => {
console.log('wxRequest', params);
const isConnected = wx.getStorageSync('onNetworkStatusChange');
if (!isConnected) {
wx.showToast({
title: '无网络',
icon: 'loading',
duration: 2000
});
return;
}
// tip.loading()
let data = params.query || {};
const header = params.header || {};
let res = await wepy.request({
url: url,
method: params.method || 'GET',
data: data,
header: header
});
// tip.loaded()
console.log('wxRequest', res);
return res;
};
module.exports = {
wxRequest
};
<template>
<div class="loading-container">
<van-loading size="24px" vertical>加载中...</van-loading>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
});
</script>
<style lang="less">
.loading-container {
position: absolute;
width: 100%;
height: 100%;
background: #000;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
}
</style>
<config>
{
usingComponents: {
'van-loading': '~@/components/vant/loading/index'
}
}
</config>
<template>
<div class="network-container">
<div class="network-wrapper">
<span class="network-text">网络状况不佳,请刷新重试</span>
<van-button custom-class="network-button" round type="info" @tap="setIsConnected">刷新</van-button>
</div>
</div>
</template>
<script>
import wepy from '@wepy/core';
import { mapActions } from '@wepy/x';
import store from '../../store';
wepy.component({
store,
methods: {
...mapActions(['setIsConnected'])
}
});
</script>
<style lang="less">
.network-container {
position: absolute;
width: 100%;
height: 100%;
background: #000;
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
.network-wrapper {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.network-text {
color: #AAA;
font-size: 12px;
}
.network-button {
margin-top: 10px;
width: 90px;
font-size: 12px;
height: 28px;
line-height: 28px;
background: #FF6600;
border-color: #FF6600;
}
}
}
</style>
<config>
{
usingComponents: {
'van-button': '~@/components/vant/button/index'
}
}
</config>
<template>
<div class="loading-container" :class="{'opened': opened}">
<div class="bg rotate"></div>
<div class="mod-chest" @tap="click">
<div class="chest-close" :class="{'shake': shake, 'show': showChest}">
<div class="gift"></div>
</div>
<div class="chest-open" :class="{'show': show, 'blur': blur}">
<div class="mod-chest-cont open-cont">
<div class="content">
<div class="gift">
x 500
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
data: {
showChest: true,
shake: false,
opened: false,
show: false,
blur: false
},
methods: {
click: function() {
console.log('click');
this.shake = true;
setTimeout(() => {
this.opened = true;
setTimeout(() => {
this.showChest = false;
this.show = true;
setTimeout(() => {
this.blur = true;
}, 500);
}, 200);
}, 1200);
}
}
});
</script>
<style lang="less">
.loading-container {
position: absolute;
width: 100%;
height: 100%;
background: grey;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
}
.bg{position: absolute;z-index: 1;background:url('http://activitystatic.xyqb.com/light.png') 0px 0px no-repeat;background-size:452px auto;width:452px;height:510px; max-height:100%; left:50%;margin-left:-226px;top:-25px;}
.bg.rotate{-webkit-animation: rotate 10s infinite linear;}
.mod-chest .chest-close:after{width: 320px;height:300px;position: absolute;top:-100px;left:-61px;content:"";display: block;}
.mod-chest .chest-close:active{-webkit-transform:scale(1.05);-webkit-transition:all .3s;}
.mod-chest .chest-close.shake .gift{-webkit-animation:shake 1.2s linear;-webkit-animation-fill-mode:forwards;}
.mod-chest .chest-open{}
.mod-chest .chest-open.blur:after{width: 320px;height: 68px;background: url('http://activitystatic.xyqb.com/chest-open-blur.png') no-repeat 0px 0px;background-size: 320px auto;position: relative;z-index: 1;position: absolute;left: 0px;top: -5px;content:"";display: block;}
.mod-chest-cont{background: url('http://activitystatic.xyqb.com/open-bg-top.png') center top no-repeat, url('http://activitystatic.xyqb.com/open-bg-bottom.png') center bottom no-repeat;background-size: 276px auto;width:276px;margin:27px auto 118px;position: relative;}
.mod-chest-cont:before{width:100%;position: absolute;top:12px;bottom:80px;left:0px;content:"";background:#fff;border-left:#e59c00 1px solid;border-right:#e59c00 1px solid;box-sizing:border-box;}
.mod-chest-cont .content{position: relative;z-index: 2;padding:13px;}
.mod-chest-cont h3{color:#865500;font-size: 15px;}
.mod-chest{position: relative;width: 100%;}
.mod-chest .chest-close{width: 320px;height:135px;opacity: 0;position: relative;z-index: 1;position: absolute;left:50%;top:0px;margin-left:-160px;}
.mod-chest .chest-close .gift{width: 320px;height:135px;background:url('http://activitystatic.xyqb.com/chest.png') no-repeat 0px 0px;background-size: 320px auto;position: absolute;left:0;top:-147px;}
.mod-chest .chest-open{width: 320px;height:150px;background:url('http://activitystatic.xyqb.com/chest.png') no-repeat 0px -137px;background-size: 320px auto;opacity: 0;position: relative;z-index: 1;position: absolute;left:0px;top:-147px;}
.mod-chest .chest-open .mod-chest-cont{position: absolute;bottom:-27px;left:50%;margin-left:-138px;}
.mod-chest .show{z-index: 2;opacity: 1;}
.loading-container.opened .mod-chest .chest-open{-webkit-transform:translate(0px,61px);}
.loading-container .mod-chest-cont{padding:30px 0px 50px;text-align: center;overflow: hidden;opacity: 0;-webkit-transform:translate(0px,30px);/*-webkit-transition:all .3s .3s;-webkit-transition:all .3s .3s cubic-bezier(.53,1.5,.69,1.81);*/z-index: 9;-webkit-animation-fill-mode: forwards;}
.loading-container .chest-open.show .mod-chest-cont{/*-webkit-transform:translate(0px,0px);opacity: 1;*/-webkit-animation:move2 .2s .0s linear;-webkit-animation-fill-mode: forwards;}
.loading-container .mod-chest-cont .gift{color:#ff6000;font-size: 24px;line-height: 30px;padding-bottom:30px;}
.loading-container .mod-chest-cont .gift .icon{width: 58px;height:0px;position:relative;display: inline-block;vertical-align: middle;}
.loading-container .mod-chest-cont .gift img{width: 75px;height:50px;position: absolute;top:-28px;left:-5px;}
@-webkit-keyframes shake {
0% {
transform: scale(1);
-webkit-transform: scale3d(1, 1, 1);
}
6%{
-webkit-transform: scale(.9) rotate(-8deg);
-webkit-transform: scale3d(1, 1, 1) rotate(0, 0, 1, -8deg);
}
18%, 30%,42%{
-webkit-transform: scale(1.1) rotate(8deg);
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 8deg);
}
12%,24%, 36%,48%{
-webkit-transform: scale(1.1) rotate(-8deg);
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -8deg);
}
54%{
-webkit-transform: scale(1);
-webkit-transform: scale3d(1, 1, 1);
}
60%{
-webkit-transform: scale(1);
-webkit-transform: scale3d(1, 1, 1);
}
80% {
-webkit-transform: scale(1) translate(0px,61px);
// -webkit-transform: scale3d(1, 1, 1) translate3d(0px,61px,0);
}
90% {
-webkit-transform: scale(1) translate(0px,40px);
// -webkit-transform: scale3d(1, 1, 1) translate3d(0px,400px,0);
}
100% {
-webkit-transform: scale(1) translate(0px,61px);
// -webkit-transform: scale3d(1, 1, 1) translate3d(0px,61px,0);
}
}
@-webkit-keyframes rotate {
0% {
-webkit-transform:rotate(0deg);
}
100% {
-webkit-transform:rotate(360deg);
}
}
@-webkit-keyframes move {
0% {
-webkit-transform:translate(0px ,0px);
}
100% {
-webkit-transform:translate(0px ,-5px);
}
}
@-webkit-keyframes move2 {
0% {
-webkit-transform:translate(0px,30px);
opacity: 0;
}
70% {
-webkit-transform:translate(0px,-20px);
opacity: 1;
}
100% {
-webkit-transform:translate(0px,0px);
opacity: 1;
}
}
</style>
<config>
{
usingComponents: {
'van-loading': '~@/components/vant/loading/index'
}
}
</config>
<template>
<div class="container">
<cover-view class="circle" :style="{ background: bgColor }" @tap="handleTaps">
<cover-view class="title" :style="{ color: fontColor }">{{title}}</cover-view>
</cover-view>
<cover-view class="tips tips_animate" v-if="showAnimation">+1克币</cover-view>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
data: {
showAnimation: false
},
props: {
title: '',
bgColor: {
type: String,
default: '#FFF'
},
fontColor: {
type: String,
default: '#FF0000'
}
},
methods: {
handleTaps: function() {
this.showAnimation = !this.showAnimation;
[this.bgColor, this.fontColor] = [this.fontColor, this.bgColor];
}
}
});
</script>
<style lang="less">
.container {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: -8px;
left: 200px;
width: 150rpx;
.tips {
flex: 1;
color: #FF0000;
position: absolute;
text-align: center;
overflow: visible;
top: -40rpx;
width: 150rpx;
}
.tips_animate {
animation:mymove 2s ease forwards;
-webkit-animation:mymove 2s ease forwards; /*Safari and Chrome*/
}
@keyframes mymove {
from { font-size:10px;opacity: 1.0; top: -20px;}
to { font-size:20px;opacity: 0; top: -80px;}
}
.circle {
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
width: 100rpx;
height: 100rpx;
background: #fff;
.title {
color: #FF0000;
}
}
}
</style>
<config>
{
usingComponents: {
'van-icon': '~@/components/vant/icon/index'
}
}
</config>
<template>
<div class="loading-container">
<!-- <van-loading size="24px" vertical>加载中...</van-loading> -->
<div class="loader">
<div class="face">
<div class="circle"></div>
</div>
</div>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
});
</script>
<style lang="less">
.loading-container {
position: absolute;
width: 100%;
height: 100%;
background: grey;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
.loader {
width: 20em;
height: 20em;
font-size: 10px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
.face {
position: absolute;
border-radius: 50%;
border-style: solid;
animation: animate 3s linear infinite;
&:nth-child(1) {
width: 100%;
height: 100%;
color: black;
border-color: currentColor transparent transparent currentColor;
border-width: 0.2em 0.2em 0 0;
--deg: -45deg;
animation-direction: normal;
}
.circle {
position: absolute;
width: 50%;
height: 0.1em;
top: 50%;
left: 50%;
background-color: transparent;
transform: rotate(var(--deg));
transform-origin: left;
&::before {
position: absolute;
top: -0.5em;
right: -0.5em;
content: '';
width: 1em;
height: 1em;
background-color: currentColor;
border-radius: 50%;
box-shadow: 0 0 2em,
0 0 4em,
0 0 6em,
0 0 8em,
0 0 10em,
0 0 0.5em rgba(255, 255, 0, 0.1);
}
@keyframes animate {
to {
transform: rotate(1turn);
}
}
}
}
}
}
</style>
<config>
{
usingComponents: {
'van-loading': '~@/components/vant/loading/index'
}
}
</config>
<template>
<div class="loading-container">
<!-- <van-loading size="24px" vertical>加载中...</van-loading> -->
<div class="meteor">
<div class="star"></div>
</div>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
});
</script>
<style lang="less">
.loading-container {
position: absolute;
width: 100%;
height: 100%;
background: grey;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
.meteor {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
transform: rotateZ(45deg);
transform: -webkit-rotateZ(45deg);
}
.star {
position: absolute;
top: 38%;
left: -43%;
height: 2px;
width: 100px;
background: linear-gradient(45deg,rgba(255,255,255,0),yellow);
background: -webkit-linear-gradient(45deg,rgba(255,255,255,0),yellow);
/*此处为下一步的添加动画*/
-webkit-animation: tail 3s ease-in-out infinite,shooting 3s ease-in-out infinite;
-o-animation: tail 3s ease-in-out infinite,shooting 3s ease-in-out infinite;
animation: tail 3s ease-in-out infinite,shooting 3s ease-in-out infinite;
}
.star::before,
.star::after{
content: "";
position: absolute;
top: calc(100% - 1px);
left: 100%;
height: 2px;
background: linear-gradient(45deg,rgba(255,255,255,0),yellow,rgba(255,255,255,0));
background: -webkit-linear-gradient(45deg,rgba(255,255,255,0),yellow,rgba(255,255,255,0));
/*此处为下一步的添加动画*/
-webkit-animation: shining 3s ease-in-out infinite;
-o-animation: shining 3s ease-in-out infinite;
animation: shining 3s ease-in-out infinite;
}
.star:before {
transform: translateX(-50%) rotateZ(-45deg);
transform: -webkit-translateX(-50%) -webkit-rotateZ(-45deg);
}
.star:after {
transform: translateX(-50%) rotateZ(45deg);
transform: -webkit-translateX(-50%) -webkit-rotateZ(45deg);
}
@-webkit-keyframes shining {
0% {width: 0;}
50% {width: 30px;}
100% {width: 0;}
}
@keyframes shining {
0% {width: 0;}
50% {width: 30px;}
100% {width: 0;}
}
@-webkit-keyframes tail {
0% {width: 0;}
30% {width: 50px;}
100% {width: 0;}
}
@keyframes tail {
0% {width: 0;}
30% {width: 100px;}
100% {width: 0;}
}
@-webkit-keyframes shooting {
0% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
100% {
-webkit-transform: translateX(350px);
transform: translateX(350px);
}
}
@keyframes shooting {
0% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
100% {
-webkit-transform: translateX(350px);
transform: translateX(350px);
}
}
}
</style>
<config>
{
usingComponents: {
'van-loading': '~@/components/vant/loading/index'
}
}
</config>
<template>
<div class="video-icon-view" v-if="pause">
<van-icon custom-class="video-icon video-icon_animate" name="play" />
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
props: {
pause: false
}
});
</script>
<style lang="less">
.video-icon-view {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
.video-icon {
z-index: 2;
color: rgba(255,255,255,0.5);
font-size: 100rpx;
}
}
.video-icon_animate {
animation:mymoves .5s forwards;
-webkit-animation:mymoves .5s forwards; /*Safari and Chrome*/
}
@keyframes mymoves {
from { transform: scale(2);opacity: 0;}
to { transform: scale(1);opacity: 1;}
}
</style>
<config>
{
usingComponents: {
'van-icon': '~@/components/vant/icon/index'
}
}
</config>
......@@ -27,17 +27,15 @@
vertical
current="1"
bindanimationfinish="animationfinish"
bindchange="cancelPause"
>
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<swiper-item wx:for="{{currentVideo}}" wx:key="index">
<swiper-item wx:for="{{curQueue}}" wx:key="index">
<view class="video-wrapper">
<video
id="video_{{index}}"
class="video_item"
loop
enable-play-gesture
enable-progress-gesture
autoplay
show-center-play-btn="{{false}}"
controls="{{false}}"
src="{{item.url}}"
......@@ -47,8 +45,12 @@
binderror="onError"
bindwaiting="onWaiting"
bindloadedmetadata="onLoadedMetaData"
bindtimeupdate="onTimeUpdate"
@tap="videoTap"
>
<video-pause :pause="pause"></video-pause>
</video>
<video-loading v-if="item.time === 0"/>
<slot></slot>
</view>
</swiper-item>
......@@ -58,7 +60,7 @@
<script>
import wepy from '@wepy/core';
wepy.component({
props:{
props: {
videoList: {
type: Array,
value: []
......@@ -66,46 +68,98 @@
duration: {
type: Number,
value: 800
},
}
},
data: {
pause: false,
nextQueue: [],
prevQueue: [],
curQueue: [],
circular: false,
currentVideo: [],
_videoContexts: [],
_last: 1,
_change: -1,
_invalidUp: 0,
_invalidDown: 0,
_videoContexts: []
},
watch: {
videoList () {
var newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._videoListChanged(newVal);
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
if (newVal.length) this._videoListChanged(newVal);
}
},
attached() {
this._videoContexts = [
wx.createVideoContext('video_0', this.$wx),
wx.createVideoContext('video_1', this.$wx),
wx.createVideoContext('video_2', this.$wx)
];
},
methods: {
_videoListChanged (newVal) {
var _this = this;
let currentVideo = this.currentVideo;
let _videoContexts = this._videoContexts;
let first = currentVideo.length === 0;
let length = this.currentVideo.length;
newVal.forEach(function (item,index) {
currentVideo.push(item);
_videoContexts.push(wx.createVideoContext('video_'+length+index, _this))
newVal.forEach((item, index) => {
item.time = 0;
this.nextQueue.push(item);
});
this.currentVideo = currentVideo;
this._videoContexts = _videoContexts;
first && this.playCurrent(1);
/*this.setData({
currentVideo: data.currentVideo,
_videoContexts: data._videoContexts,
}, function () {
_this.playCurrent(1);
});*/
if (!this.curQueue.length) {
this.curQueue = this.nextQueue.splice(0, 3);
this.playCurrent(1);
console.log('newVal', this.nextQueue, this.curQueue);
}
},
animationfinish(e) {
console.log(e.$wx.detail)
var current = e.$wx.detail.current;
this.playCurrent(current);
let curQueue = this.currentVideo;
this.$emit('change', { activeId: curQueue[current].id });
const current = e.$wx.detail.current;
console.log(current);
const diff = current - this._last;
if (diff === 0) return;
this._last = current;
// this.playCurrent(current);
this.$emit('change', { activeId: this.curQueue[current].id });
setTimeout(() => {
const direction = diff === 1 || diff === -2 ? 'up' : 'down';
if (direction === 'up') {
if (this._invalidDown === 0) {
const change = (this._change + 1) % 3;
const add = this.nextQueue.shift();
const remove = this.curQueue[change];
if (add) {
this.prevQueue.push(remove);
this.curQueue[change] = add;
this._change = change;
} else {
this._invalidUp += 1;
}
} else {
this._invalidDown -= 1;
}
}
if (direction === 'down') {
if (this._invalidUp === 0) {
const _change2 = this._change;
const _remove = this.curQueue[_change2];
const _add = this.prevQueue.pop();
if (_add) {
this.curQueue[_change2] = _add;
this.nextQueue.unshift(_remove);
this._change = (_change2 - 1 + 3) % 3;
} else {
this._invalidDown += 1;
}
} else {
this._invalidUp -= 1;
}
}
this.circular = true;
if (this.nextQueue.length === 0 && current !== 0) {
this.circular = false;
}
if (this.prevQueue.length === 0 && current !== 2) {
console.log('circular2');
this.circular = false;
}
this.playCurrent(current);
console.log(this.prevQueue, this.curQueue, this.nextQueue);
});
},
onWaiting (e) {
this.trigger(e, 'wait');
......@@ -116,9 +170,28 @@
onError(e) {
this.trigger(e, 'error');
},
onTimeUpdate(e) {
const currentTime = e.$wx.detail.currentTime;
if (currentTime > 0 && currentTime < 10) {
const id = e.target.dataset.id;
this.curQueue.forEach((v, i) => {
if (v.id === id && v.time === 0) {
this.curQueue[i].time = currentTime;
}
});
this.curQueue = [...this.curQueue];
}
},
playCurrent(current) {
this._videoContexts.forEach(function (ctx, index) {
index !== current ? ctx.pause() : ctx.play();
this._videoContexts.forEach((ctx, index) => {
console.log('playCurrent', current, index);
if (index !== current) {
setTimeout(() => {
ctx.pause();
}, 300);
} else {
ctx.play();
}
});
},
trigger(e, type) {
......@@ -126,7 +199,27 @@
var detail = e.$wx.detail;
var activeId = e.target.dataset.id;
this.$emit(type, Object.assign(Object.assign(Object.assign({}, detail), { activeId: activeId }), ext));
},
videoTap(e) {
const current = e.currentTarget.dataset.index;
this._videoContexts.forEach((ctx, index) => {
if (index === current) {
this.pause ? ctx.play() : ctx.pause();
}
});
this.pause = !this.pause;
},
cancelPause() {
this.pause = false;
}
},
}
});
</script>
<config>
{
usingComponents: {
'video-pause': '~@/components/custom/videoPause',
'video-loading': '~@/components/custom/loading'
}
}
</config>
......@@ -11,9 +11,11 @@
</template>
<script>
import { mapActions } from '@wepy/x';
import wepy from '@wepy/core';
import store from '../store';
wepy.page({
store,
hooks: {
'before-setData': function (dirty) {
......@@ -23,16 +25,13 @@
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
computed: {
},
methods: {
...mapActions([ 'setUserInfo' ]),
getUserInfo (e) {
store.dispatch('setUserInfo',e.$wx.detail.userInfo);
this.setUserInfo(e.$wx.detail.userInfo);
wx.reLaunch({
url: '/pages/index',
})
url: '/pages/index'
});
}
},
......
This diff is collapsed.
......@@ -3,15 +3,23 @@ import Vuex from '@wepy/x';
export default new Vuex.Store({
state: {
userInfo: null,
isConnected: true
},
mutations: {
setInfo (state,info) {
setInfo (state, info) {
state.userInfo = info;
},
setIsConnected (state, isConnected) {
state.isConnected = isConnected;
}
},
actions: {
setUserInfo ({ commit }, info) {
commit('setInfo', info);
},
setIsConnected ({ commit }) {
const isConnected = wx.getStorageSync('onNetworkStatusChange');
commit('setIsConnected', isConnected);
}
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment