# Conflicts:
#	gasStation-uni/store/modules/user.js
This commit is contained in:
wangh 2023-11-30 11:08:38 +08:00
commit 6229da52c9
5 changed files with 223 additions and 86 deletions

View File

@ -709,6 +709,7 @@ export default {
this.pddhidlist.push(row.id) this.pddhidlist.push(row.id)
console.log(row) console.log(row)
let data ={ let data ={
giftUserType:0,//
activeGift: 2, // 01 2. 3 4. activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id goodsIds: "", //id
goodsName:"" , // goodsName:"" , //
@ -908,6 +909,7 @@ export default {
console.log(this.ruleForm.activeRecommendChildList) console.log(this.ruleForm.activeRecommendChildList)
console.log(this.ruleForm) console.log(this.ruleForm)
this.ruleForm.id = 1 this.ruleForm.id = 1
this.$refs["ruleForm"].validate(valid => { this.$refs["ruleForm"].validate(valid => {
if (valid) { if (valid) {
if (this.ruleForm.id != null) { if (this.ruleForm.id != null) {

View File

@ -34,6 +34,13 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "activeIn/index",
"style": {
"navigationBarTitleText": "你建的",
"navigationStyle": "custom"
}
},
{ {
"path": "Address/Address", "path": "Address/Address",
"style": { "style": {

View File

@ -7,7 +7,8 @@
<view class="my-icons"></view> <view class="my-icons"></view>
</view> </view>
<view class="mub"> <view class="mub">
<view class="mub-box" v-for="(item,index) in activityList" :key="index" @click="getactvity(item.path)"> <!-- <view class="mub-box" v-for="(item,index) in activityList" :key="index" @click="getactvity(item.path)"> -->
<view class="mub-box" v-for="(item,index) in activityList" :key="index" @click="intoOtherPage()">
<view class="box-img"> <view class="box-img">
<image src="../../static/imgs/xp.jpg" mode=""></image> <image src="../../static/imgs/xp.jpg" mode=""></image>
</view> </view>
@ -29,6 +30,7 @@
</template> </template>
<script> <script>
import request from '../../utils/request'
export default { export default {
data() { data() {
return { return {
@ -58,11 +60,38 @@
} }
}, },
datas() {
return {
datas: [{
"activeDescribe": ""
}]
}
},
components: { components: {
}, },
methods: { methods: {
intoOtherPage() {
uni.navigateTo({
url: '/pagesHome/activeIn/index'
})
},
getData() {
// request({
// url: '/business/marketingActivity/activeConsumption/AppletList',
// method: 'get',
// success: function(res) {
// this.datas = res.data
// }
// })
request({
url: '/business/marketingActivity/activeConsumption/AppletList',
method: 'get',
}).then(res => {
console.log(res);
this.datas = res.data
})
},
getactvity(url) { getactvity(url) {
if (url) { if (url) {
console.log('跳转中'); console.log('跳转中');

View File

@ -0,0 +1,82 @@
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">样版页</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="" v-for="(item,index) in datas" :key="index">
<text>{{item.activeDescribe || ""}}</text>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
title: '',
datas: [],
}
},
components: {
},
onLoad() {
this.getData();
},
methods: {
getData() {
request({
url: '/business/marketingActivity/activeConsumption/appletList',
method: 'get',
}).then(res => {
this.datas = res.data
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
</style>

View File

@ -1,98 +1,115 @@
import config from '@/config' import config from '@/config'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant' import constant from '@/utils/constant'
import { login, logout, getInfo } from '@/api/login' import {
import { getToken, setToken, removeToken } from '@/utils/auth' login,
logout,
getInfo
} from '@/api/login'
import {
getToken,
setToken,
removeToken
} from '@/utils/auth'
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
const user = { const user = {
state: { state: {
token: getToken(), token: getToken(),
name: storage.get(constant.name), name: storage.get(constant.name),
avatar: storage.get(constant.avatar), avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles), roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions) permissions: storage.get(constant.permissions)
}, },
mutations: { mutations: {
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
state.token = token state.token = token
}, },
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name
storage.set(constant.name, name) storage.set(constant.name, name)
}, },
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
storage.set(constant.avatar, avatar) storage.set(constant.avatar, avatar)
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
storage.set(constant.roles, roles) storage.set(constant.roles, roles)
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
storage.set(constant.permissions, permissions) storage.set(constant.permissions, permissions)
} }
}, },
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({
const username = userInfo.username.trim() commit
const password = userInfo.password }, userInfo) {
const code = userInfo.code const username = userInfo.username.trim()
const uuid = userInfo.uuid const password = userInfo.password
return new Promise((resolve, reject) => { const code = userInfo.code
login(username, password, code, uuid).then(res => { const uuid = userInfo.uuid
setToken(res.token) return new Promise((resolve, reject) => {
commit('SET_TOKEN', res.token) login(username, password, code, uuid).then(res => {
resolve() setToken(res.token)
}).catch(error => { commit('SET_TOKEN', res.token)
reject(error) resolve()
}) }).catch(error => {
}) reject(error)
}, })
})
},
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({
return new Promise((resolve, reject) => { commit,
getInfo().then(res => { state
const user = res.user }) {
const avatar = baseUrl + user.avatar return new Promise((resolve, reject) => {
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName getInfo().then(res => {
if (res.roles && res.roles.length > 0) { const user = res.user
commit('SET_ROLES', res.roles) const avatar = baseUrl + user.avatar
commit('SET_PERMISSIONS', res.permissions) const username = (user == null || user.userName == "" || user.userName ==
} else { null) ? "" : user.userName
commit('SET_ROLES', ['ROLE_DEFAULT']) if (res.roles && res.roles.length > 0) {
} commit('SET_ROLES', res.roles)
commit('SET_NAME', username) commit('SET_PERMISSIONS', res.permissions)
commit('SET_AVATAR', avatar) } else {
resolve(res) commit('SET_ROLES', ['ROLE_DEFAULT'])
}).catch(error => { }
reject(error) commit('SET_NAME', username)
}) commit('SET_AVATAR', avatar)
}) resolve(res)
}, }).catch(error => {
reject(error)
})
})
},
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({
return new Promise((resolve, reject) => { commit,
logout(state.token).then(() => { state
commit('SET_TOKEN', '') }) {
commit('SET_ROLES', []) return new Promise((resolve, reject) => {
commit('SET_PERMISSIONS', []) logout(state.token).then(() => {
removeToken() commit('SET_TOKEN', '')
storage.clean() commit('SET_ROLES', [])
resolve() commit('SET_PERMISSIONS', [])
}).catch(error => { removeToken()
reject(error) storage.clean()
}) resolve()
}) }).catch(error => {
} reject(error)
} })
})
}
}
} }
export default user export default user