创建产品追溯页面 进一步完善各项功能

Signed-off-by: YangWork <yang@xixingwl.cn>
This commit is contained in:
YangWork
2023-02-16 18:00:22 +08:00
parent 1a0c4482a3
commit b77282d0dc
15 changed files with 451 additions and 116 deletions

View File

@@ -2,7 +2,7 @@
// 引入 uni-ajax 模块 // 引入 uni-ajax 模块
import ajax from '@/uni_modules/u-ajax' import ajax from '@/uni_modules/u-ajax'
import store from '@/store/index.js';
// 创建请求实例 // 创建请求实例
const instance = ajax.create({ const instance = ajax.create({
// 初始配置 // 初始配置
@@ -11,7 +11,10 @@ const instance = ajax.create({
// 添加请求拦截器 // 添加请求拦截器
instance.interceptors.request.use( instance.interceptors.request.use(
config => { config => {
if (store.getters.getuserIsLogin) {
config.header['token'] = store.state.user.token
}
// 在发送请求前做些什么 // 在发送请求前做些什么
return config return config
}, },
@@ -25,12 +28,14 @@ instance.interceptors.request.use(
instance.interceptors.response.use( instance.interceptors.response.use(
response => { response => {
if (response.statusCode == 200) { if (response.statusCode == 200) {
let res = response.data;
if (res.hasOwnProperty('token'))
uni.setStorageSync('token', res.token);
return response.data return response.data
} }
// 对响应数据做些什么 // 对响应数据做些什么
console.log(response) console.log(response)
return response.data return response.data
}, },
error => { error => {

View File

@@ -113,13 +113,11 @@
}, },
onLoad: function() {}, onLoad: function() {},
methods: { methods: {
...mapMutations(["updateUserInfo", "saveUserInfoToStorge"]), ...mapMutations(["updateUserInfo"]),
onChooseAvatar(e) { onChooseAvatar(e) {
console.log(e)
const { const {
avatarUrl avatarUrl
} = e.detail } = e.detail
this.formDataReg.avatarUrl = avatarUrl this.formDataReg.avatarUrl = avatarUrl
}, },
submitLogin(loginform) { submitLogin(loginform) {
@@ -169,8 +167,7 @@
sessionKey: this.sessionKey, sessionKey: this.sessionKey,
openId: this.openId, openId: this.openId,
}).then(res => { }).then(res => {
this.formDataReg.mobile = res.data.phoneNumber this.formDataReg.mobile = res.data.phoneNumber
console.log(res.data)
}); });
} }
} }

22
cpzs/chucang/chucang.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

22
cpzs/chushou/chushou.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

22
cpzs/diaohuo/diaohuo.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

114
cpzs/index/index.vue Normal file
View File

@@ -0,0 +1,114 @@
<template>
<view class="box-bg">
<uni-nav-bar fixed="true" statusBar="true" leftIcon="left" leftText="返回" @clickLeft="back" rightIcon="scan" @clickRight="scan">
<view class="input-view">
<uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
<input confirm-type="search" class="nav-bar-input" type="text" placeholder="输入搜索关键词"
@confirm="confirm" />
</view>
</uni-nav-bar>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
city: '北京'
}
},
methods: {
back() {
uni.navigateBack({
delta: 1
})
},
search() {
uni.showToast({
title: '搜索'
})
},
scan() {
// #ifdef H5
uni.showToast({
title: '暂不支持H5扫码'
})
// #endif
// #ifndef H5
uni.scanCode({
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
// #endif
},
confirm() {
uni.showToast({
title: '搜索'
})
}
},
onPullDownRefresh() {
console.log('onPullDownRefresh')
setTimeout(function() {
uni.stopPullDownRefresh()
console.log('stopPullDownRefresh')
}, 1000)
}
}
</script>
<style lang="scss">
$nav-height: 30px;
.box-bg {
background-color: #F5F5F5;
padding: 5px 0;
}
.city {
/* #ifndef APP-PLUS-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: flex-start;
// width: 160rpx;
margin-left: 4px;
}
.input-view {
/* #ifndef APP-PLUS-NVUE */
display: flex;
/* #endif */
flex-direction: row;
// width: 500rpx;
flex: 1;
background-color: #f8f8f8;
height: $nav-height;
border-radius: 15px;
padding: 0 15px;
flex-wrap: nowrap;
margin: 7px 0;
line-height: $nav-height;
}
.input-uni-icon {
line-height: $nav-height;
}
.nav-bar-input {
height: $nav-height;
line-height: $nav-height;
/* #ifdef APP-PLUS-NVUE */
width: 370rpx;
/* #endif */
padding: 0 5px;
font-size: 12px;
background-color: #f8f8f8;
}
</style>

22
cpzs/rucang/rucang.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

22
cpzs/ruku/ruku.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

22
cpzs/shouhou/shouhou.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -1,77 +1,62 @@
<template> <template>
<view class="container"> <view class="container">
<uni-nav-bar shadow left-icon="left" fixed leftText="返回" dark rightIcon="compose" rightText="编辑" title="个人资料"/> <uni-nav-bar shadow left-icon="left" fixed leftText="返回" dark rightIcon="compose" rightText="编辑" @clickRight="editTrue" title="个人资料"/>
<view class="example"> <view class="example">
<!-- 基础表单校验 --> <!-- 基础表单校验 -->
<uni-forms ref="valiForm" :rules="rules" :modelValue="formData"> <uni-forms ref="valiForm" :rules="rules" :modelValue="formData">
<uni-forms-item label="签名"> <uni-forms-item label="签名">
<uni-easyinput type="textarea" :disabled="isDisabled" v-model="formData.introduction" <uni-easyinput type="textarea" :disabled="isDisabled" v-model="formData.signature"
placeholder="请输入自我介绍" /> placeholder="个性签名" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="昵称" name="nickname"> <uni-forms-item label="昵称" name="nickname">
<uni-easyinput v-model="formData.nickname" placeholder="请输入昵称" :disabled="isDisabled" /> <uni-easyinput v-model="formData.nickname" placeholder="请输入昵称" :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="性别"> <uni-forms-item label="性别" name="sex">
<uni-data-checkbox v-model="formData.sex" :localdata="sexs" :disabled="isDisabled" /> <uni-data-checkbox v-model="formData.sex" :localdata="sexs" :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="生日"> <uni-forms-item label="生日" name="birthday">
<uni-datetime-picker type="date" return-type="timestamp" v-model="formData.datetimesingle" <uni-datetime-picker type="date" return-type="timestamp" v-model="formData.birthday"
:disabled="isDisabled" /> :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="身高" name="height"> <uni-forms-item label="身高" name="height">
<uni-easyinput v-model="formData.height" type="number" placeholder="请输入姓名" :disabled="isDisabled" /> <uni-easyinput v-model="formData.height" type="number" placeholder="身高" :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="所在地"> <uni-forms-item label="所在地" name="location">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker> <uni-data-picker v-model="formData.location" popup-title="请选所在地区" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="学历"> <uni-forms-item label="学历" name="education">
<uni-data-select :localdata="educations" :disabled="isDisabled"> <uni-data-select v-model="formData.education" :localdata="educations" :disabled="isDisabled">
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="职业"> <uni-forms-item label="职业" name="job">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker> <uni-data-picker v-model="formData.job" popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="企业"> <uni-forms-item label="企业" name="company">
<uni-easyinput type="number" placeholder="请输入姓名" :disabled="isDisabled" /> <uni-easyinput v-model="formData.company" type="text" placeholder="请输入姓名" :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="家乡"> <uni-forms-item label="家乡" name="hometown">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker> <uni-data-picker v-model="formData.hometown" popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="自我介绍" name="introduction"> <uni-forms-item label="简介" name="introduction">
<uni-easyinput type="textarea" v-model="formData.introduction" placeholder="请输入自我介绍" <uni-easyinput type="textarea" v-model="formData.introduction" placeholder="请输入自我介绍"
:disabled="isDisabled" /> :disabled="isDisabled" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="月收入"> <uni-forms-item label="月收入" name="income">
<uni-data-select :localdata="educations" :disabled="isDisabled"> <uni-data-select v-model="formData.income" :localdata="educations" :disabled="isDisabled">
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="婚姻"> <uni-forms-item label="婚姻" name="marriage" >
<uni-data-select :localdata="educations" :disabled="isDisabled"> <uni-data-select :localdata="educations" :disabled="isDisabled">
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="房产"> <uni-forms-item label="房产" name="house">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker> <uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="所在地">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item>
<uni-forms-item label="年龄">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item>
<uni-forms-item label="身高">
<uni-data-picker popup-title="请选择班级" :readonly="isDisabled"></uni-data-picker>
</uni-forms-item>
<uni-forms-item label="学历">
<uni-data-select :localdata="educations" :disabled="isDisabled">
</uni-data-select>
</uni-forms-item>
</uni-forms> </uni-forms>
<button type="primary" @click="submit('valiForm')">提交</button> <button type="primary" @click="submit('valiForm')">提交</button>
</view> </view>
@@ -87,13 +72,20 @@
isDisabled: true, isDisabled: true,
// 基础表单数据 // 基础表单数据
formData: { formData: {
signature:'',
nickname: '', nickname: '',
height:0, sex: 1,
age: 0, birthday: 0,
height:178,
location:"",
education:"",
job:"",
company:"",
hometown:"",
introduction: '', introduction: '',
sex: 2, income:"",
hobby: [5], marriage:"",
datetimesingle: 1627529992399 house:"",
}, },
@@ -212,6 +204,10 @@
//this.$refs.customForm.setRules(this.customRules) //this.$refs.customForm.setRules(this.customRules)
}, },
methods: { methods: {
editTrue(){
this.isDisabled = false;
console.log(this.isDisabled)
},
onClickItem(e) { onClickItem(e) {
console.log(e); console.log(e);
this.current = e.currentIndex this.current = e.currentIndex

View File

@@ -78,7 +78,71 @@
}] }]
},{ },{
"root": "cpzs", "root": "cpzs",
"pages": [] "pages": [{
"path" : "index/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "ruku/ruku",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "rucang/rucang",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "diaohuo/diaohuo",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "chushou/chushou",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "shouhou/shouhou",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "shouhoudo/shouhoudo",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
} }
], ],
"tabBar": { "tabBar": {

View File

@@ -1,36 +1,41 @@
<template> <template>
<view> <view>
<view class="warp"> <view class="warp">
<uni-search-bar @confirm="search" v-model="searchValue" @input="input" clearButton="always" <uni-nav-bar fixed="true" statusBar="true" leftWidth="10px" right-width="10px">
cancelButton="none" @clear="scan"> <view style="display: flex; align-items: center; width: 100%; background-color: transparent; ">
<template v-slot:clearIcon> <uni-search-bar @confirm="search" v-model="searchValue" @input="input" clearButton="always"
<uni-icons color="#999999" size="18" type="scan" /> cancelButton="none" @clear="scan">
</template> <template v-slot:clearIcon>
</uni-search-bar> <uni-icons color="#999999" size="18" type="scan" />
</template>
</uni-search-bar>
</view>
</uni-nav-bar>
<!-- 个人中心页方格列表数据 --> <!-- 个人中心页方格列表数据 -->
<view class="Grid"> <view class="Grid">
<view class="Grid-Item"> <view class="Grid-Item">
<view class="Grid-Item-1"> <view class="Grid-Item-1">
<image class="GSimg" src="../../../static/logo.png"></image> <image class="GSimg" src="../../../static/logo.png"></image>
<view class="GStitle">测试功能</view> <view class="GStitle">新闻动态</view>
</view> </view>
</view> </view>
<view class="Grid-Item"> <view class="Grid-Item">
<view class="Grid-Item-1"> <view class="Grid-Item-1">
<image class="GSimg" src="../../../static/logo.png"></image> <image class="GSimg" src="../../../static/logo.png"></image>
<view class="GStitle">测试功能</view> <view class="GStitle">视频教程</view>
</view> </view>
</view> </view>
<view class="Grid-Item"> <view class="Grid-Item">
<view class="Grid-Item-1"> <view class="Grid-Item-1">
<image class="GSimg" src="../../../static/logo.png"></image> <image class="GSimg" src="../../../static/logo.png"></image>
<view class="GStitle">测试功能</view> <view class="GStitle">产品追溯</view>
</view> </view>
</view> </view>
<view class="Grid-Item"> <view class="Grid-Item">
<view class="Grid-Item-1"> <view class="Grid-Item-1">
<image class="GSimg" src="../../../static/logo.png"></image> <image class="GSimg" src="../../../static/logo.png"></image>
<view class="GStitle">测试功能</view> <view class="GStitle">车架查询</view>
</view> </view>
</view> </view>
</view> </view>
@@ -1304,7 +1309,7 @@
} }
} }
page { page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -1,10 +1,10 @@
<template> <template>
<view> <view>
<view class="warp warp1" style=""> <view class="warp warp1">
<view class="user" style=""> <view class="user">
<view class="user-info"> <view class="user-info">
<text class="nickname"> {{userInfo.nickname}} </text> <text class="nickname"> {{userInfo.nickname}} </text>
<text> UID {{userInfo.uid}}</text> <text> UID {{userInfo.uid}}</text>
<text> 云深不知归处爱你不会迷路</text> <text> 云深不知归处爱你不会迷路</text>
</view> </view>
<image class="user-avatar" mode="aspectFit" :src="userInfo.avatar" <image class="user-avatar" mode="aspectFit" :src="userInfo.avatar"
@@ -39,30 +39,24 @@
</view> </view>
<view style="padding: 10rpx;"></view> <view style="padding: 10rpx;"></view>
<uni-list style=""> <uni-list>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}" <uni-list-item :showExtraIcon="true" link to="/member/profile/profile" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}"
title="列表左侧带扩展图标" clickable showArrow> title="个人信息" clickable showArrow>
</uni-list-item> </uni-list-item>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}" <uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}"
title="列表左侧带扩展图标" clickable showArrow> title="账号与安全" clickable showArrow>
</uni-list-item> </uni-list-item>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}"
title="列表左侧带扩展图标" clickable showArrow>
</uni-list-item>
</uni-list> </uni-list>
<view style="padding: 10rpx;"></view> <view style="padding: 10rpx;"></view>
<uni-list> <uni-list>
<uni-list-item title="列表左侧带略缩图"
thumb="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
thumb-size="sm" rightText="右侧文字" showArrow></uni-list-item>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}" title="设置" <uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'gear'}" title="设置"
clickable showArrow> clickable showArrow>
</uni-list-item> </uni-list-item>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'info'}" title="关于" <uni-list-item :showExtraIcon="true" :extraIcon="{color: '#4cd964',size: '25',type: 'info'}" title="关于"
clickable showArrow> clickable showArrow>
</uni-list-item> </uni-list-item>
<uni-list-item :showExtraIcon="true" :extraIcon="{color: '#ff0000',size: '25',type: 'back'}" title="退出" <uni-list-item :showExtraIcon="true" @click="logOut"
clickable showArrow> :extraIcon="{color: '#ff0000',size: '25',type: 'back'}" title="注销登录" clickable showArrow>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
</view> </view>
@@ -88,8 +82,7 @@
data() { data() {
return {} return {}
}, },
onLoad() { onLoad() {
console.log(this.isLogin);
if (!this.isLogin) { if (!this.isLogin) {
uni.redirectTo({ uni.redirectTo({
url: "/pages/login/login" url: "/pages/login/login"
@@ -97,7 +90,23 @@
} }
}, },
methods: { methods: {
logOut() {
let self = this;
uni.showModal({
content: "确定注销登录嘛?",
confirmText: "确定",
cancelText: "取消",
success(res) {
if (res.confirm) {
self.$store.dispatch("actionLogout");
uni.reLaunch({
url:"/pages/tabbar/home/home"
})
}
}
})
}
}, },
onBackPress() { onBackPress() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
@@ -108,24 +117,26 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.warp1{ } .warp1 {}
.user { .user {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
padding: 180rpx 25rpx 25rpx 15rpx; padding: 180rpx 25rpx 25rpx 15rpx;
/* #ifdef H5 */ /* #ifdef H5 */
padding-top: 80rpx; padding-top: 80rpx;
/* #endif */
/* #endif */
// background-image: url(/static/user/back.jpg); // background-image: url(/static/user/back.jpg);
// background-size: 100% 100%; // background-size: 100% 100%;
// background: linear-gradient(pink,#a900ff7a, pink); // background: linear-gradient(pink,#a900ff7a, pink);
.user-avatar { .user-avatar {
width: 138rpx; width: 138rpx;
height: 138rpx; height: 138rpx;
border-radius: 50%; border-radius: 50%;
} }
.user-info { .user-info {
@@ -134,8 +145,8 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
padding-left: 25rpx; padding-left: 25rpx;
.nickname{ .nickname {
font-size: 64rpx; font-size: 64rpx;
font-weight: 48rpx; font-weight: 48rpx;
} }

View File

@@ -1,8 +1,7 @@
// 子模块moduleB路径store/modules/moduleB.js // 子模块moduleB路径store/modules/moduleB.js
export default { export default {
state: { state: {
timestamp: 1608820295, //初始时间戳 timestamp: 1608820295, //初始时间戳
isLogin: false,
token: uni.getStorageSync('token') || '', token: uni.getStorageSync('token') || '',
userinfo: JSON.parse(uni.getStorageSync('userinfo') || '{}'), userinfo: JSON.parse(uni.getStorageSync('userinfo') || '{}'),
openId: null, openId: null,
@@ -21,8 +20,8 @@ export default {
var trDay = day < 10 ? '0' + day : day var trDay = day < 10 ? '0' + day : day
return year + '-' + trMon + '-' + trDay + " " + hours + ":" + minu + ":" + sec; return year + '-' + trMon + '-' + trDay + " " + hours + ":" + minu + ":" + sec;
}, },
getuserIsLogin(state){ getuserIsLogin(state){
return state.isLogin; return Object.keys(state.userinfo).length > 0 ;
}, },
getSessionKey(state){ getSessionKey(state){
return state.sessionKey; return state.sessionKey;
@@ -42,26 +41,11 @@ export default {
state.timestamp = Date.now() state.timestamp = Date.now()
}, },
// 更新用户信息 // 更新用户信息
updateUserInfo(state, userinfo) { updateUserInfo(state, userinfo) {
state.userinfo = userinfo state.userinfo = userinfo ;
state.isLogin = true; uni.setStorageSync('userinfo', JSON.stringify(state.userinfo)) ;
this.commit('saveUserInfoToStorge')
},
// 将用户信息持久化存储到本地
saveUserInfoToStorge(state) {
uni.setStorageSync('userinfo', JSON.stringify(state.userinfo))
},
// 更新 token 字符串
updateToken(state, token) {
state.token = token
// 调用saveTokenToStorage方法
this.commit('saveTokenToStorage')
},
// 将 token 字符串持久化存储到本地
saveTokenToStorage(state) {
uni.setStorageSync('token', state.token)
}, },
// 将 token 字符串持久化存储到本地 // 将 token 字符串持久化存储到本地
saveOpenIdSession(state, res) { saveOpenIdSession(state, res) {
console.log("saveOpenIdSession",res) console.log("saveOpenIdSession",res)
@@ -71,6 +55,11 @@ export default {
} }
}, },
actions: { actions: {
actionLogout(context ){
uni.$ajax("/User/logout").then(res => {
context.commit('updateUserInfo', {});
uni.setStorageSync('token', "");
});
}
} }
} }