Commit e383c323 authored by liwei's avatar liwei

将图片基础路径放到了vuex里

parent 0a4ba165
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
}; };
}, },
methods: { methods: {
......
import App from './App' import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// 引入全局uView
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
import { import {
request, request,
BASE_URL, BASE_URL,
getId,
} from 'util/api.js'; } from 'util/api.js';
// 导入并挂载全局的分享方法
import share from '@/common/share.js'
import Vue from 'vue'
// 引入全局uView
import uView from '@/uni_modules/uview-ui'
import store from './store/index'
Vue.config.productionTip = false
App.mpType = 'app'
Vue.use(uView)
Vue.prototype.$myRequest = request; // 接口请求 Vue.prototype.$myRequest = request; // 接口请求
Vue.prototype.$BASE_URL = BASE_URL;//正式接口 Vue.prototype.$BASE_URL = BASE_URL;//正式接口
Vue.prototype.$getId = getId; // 获取缓存用户信息 Vue.prototype.$store = store;//正式接口
// 导入并挂载全局的分享方法
import share from '@/common/share.js'
Vue.mixin(share) Vue.mixin(share)
const app = new Vue({
store,
// #ifdef VUE3 ...App
import { })
createSSRApp app.$mount()
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
tagStyle: { tagStyle: {
text: 'line-height:1em' text: 'line-height:1em'
}, },
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
// v-model绑定的这个变量不要在分页请求结束中自己赋值!!! // v-model绑定的这个变量不要在分页请求结束中自己赋值!!!
dataList: [], dataList: [],
// 当前组件是否已经加载过了 // 当前组件是否已经加载过了
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//分页查询参数 //分页查询参数
queryParam:{ queryParam:{
page:1, page:1,
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//tab标签 //tab标签
list: [{ list: [{
name: '关注' name: '关注'
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
// 商家列表 // 商家列表
notice:{}, notice:{},
//banner列表 //banner列表
......
...@@ -194,7 +194,7 @@ import {setUserProfile} from '../../api/login/index' ...@@ -194,7 +194,7 @@ import {setUserProfile} from '../../api/login/index'
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
tipsShow:false,//授权弹窗 tipsShow:false,//授权弹窗
nologin: '',//登录标志 nologin: '',//登录标志
userInfo:{},//用户信息 userInfo:{},//用户信息
......
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
subList: [ subList: [
{ {
name: '女生榜' name: '女生榜'
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
show: false, show: false,
info: this.dataInfo info: this.dataInfo
}; };
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
show: false, //报名弹窗 show: false, //报名弹窗
activityDetail: {},//活动详情 activityDetail: {},//活动详情
activityId: '', // 活动id activityId: '', // 活动id
......
...@@ -200,7 +200,7 @@ export default{ ...@@ -200,7 +200,7 @@ export default{
data () { data () {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
item:{ item:{
createTime:'2024-12-28 15:02:01', createTime:'2024-12-28 15:02:01',
headPortrait:'http://192.168.1.80/upload/CmsBanner/20241230/18E63B570FF04DB3A8EFE277D58256C4.jpg',//头像 headPortrait:'http://192.168.1.80/upload/CmsBanner/20241230/18E63B570FF04DB3A8EFE277D58256C4.jpg',//头像
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
tagStyle: { tagStyle: {
text: 'line-height:1em' text: 'line-height:1em'
}, },
......
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//用户信息 //用户信息
userData: { userData: {
result:true, result:true,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
export default { export default {
data() { data() {
return { return {
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//用户初始化登录 (可能用户类型传参错误) //用户初始化登录 (可能用户类型传参错误)
initLoginError: false, initLoginError: false,
tipMsg: '', tipMsg: '',
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
show: false, show: false,
info: this.dataInfo info: this.dataInfo
}; };
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
userInfo: {}, userInfo: {},
tipMsg: '', tipMsg: '',
isConfirm: false isConfirm: false
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
updatezImg: "", updatezImg: "",
updatefImg: "", updatefImg: "",
newImageSrc: "", newImageSrc: "",
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//用户列表 //用户列表
userList:[ userList:[
{ {
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
//用户资料 //用户资料
userInfo: { userInfo: {
waitApprovedStatus:'', waitApprovedStatus:'',
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
data() { data() {
return{ return{
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
} }
}, },
methods: { methods: {
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
list: [{ list: [{
name: "推荐设置", name: "推荐设置",
url: "/pagespreference/preference/preference" url: "/pagespreference/preference/preference"
......
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
data() { data() {
return { return {
//图片路径 //图片路径
baseUrl: 'http://192.168.1.80/static/images', baseUrl: this.$store.state.imgUrl,
falg: false, falg: false,
minValue: 1, minValue: 1,
maxValue: 100, maxValue: 100,
......
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
imgUrl: 'http://192.168.1.80/static/images'
//公共的变量,这里的变量不能随便修改,只能通过触发mutations的方法才能改变
},
mutations: {
//相当于同步的操作
},
actions: {
//相当于异步的操作,不能直接改变state的值,只能通过触发mutations的方法才能改变
}
})
export default store
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