This commit is contained in:
ghusermoon 2020-06-15 11:34:33 +08:00
parent 3f63d8ade9
commit b697270eb9
6 changed files with 66 additions and 30 deletions

12
App.vue
View File

@ -1,15 +1,5 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
export default {}
</script>
<style lang="scss">
@import "/static/css/normalize"

View File

@ -1,10 +1,24 @@
export default {
init(vm){
return {
getlogn({id,name}){
return vm.$u.get('popArticles');
}
phoneRegister({member_mobile, sms_code}) {
return vm.$u.post('auth/phoneRegister', {
member_mobile: member_mobile,
sms_code: sms_code
});
},
phoneLogin({member_mobile, sms_code}) {
return vm.$u.post('auth/phoneLogin', {
member_mobile: member_mobile,
sms_code: sms_code
});
},
sendSmsCode({member_mobile, sms_type}) {
return vm.$u.get('sms/sendSmsCode', {
member_mobile: member_mobile,
sms_type: sms_type
});
}
}
}
}

View File

@ -5,10 +5,10 @@ import shop from "./api/shop"
import user from "./api/user"
const install = (Vue, vm) => {
let userapi = user.init(vm)
let shopapi = shop.init(vm)
let userApi = user.init(vm)
let shopApi = shop.init(vm)
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {...userapi,...shopapi};
vm.$u.api = {...userApi,...shopApi};
}
export default {

View File

@ -1,7 +1,7 @@
const install = (Vue, vm) => {
// 此为自定义配置参数,具体参数见上方说明
Vue.prototype.$u.http.setConfig({
baseUrl: 'https://luyuan.tk/api',
baseUrl: 'https://dmmall.sdbairui.com/api',
loadingText: '努力加载中~',
loadingTime: 800
// ......
@ -22,8 +22,8 @@ const install = (Vue, vm) => {
// 方式四如果token放在了Storage本地存储中拦截是每次请求都执行的
// 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值
// const token = uni.getStorageSync('token');
// config.header.token = token;
const token = uni.getStorageSync('token');
config.header.token = token;
// config.header.Token = 'xxxxxx';
// 可以对某个url进行特别处理此url参数为this.$u.get(url)中的url值

View File

@ -749,6 +749,12 @@
}
],
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pageA/welcome/welcome",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
@ -756,6 +762,13 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/shop/index",
"style": {
"navigationBarTitleText": "商城",
"navigationStyle": "custom"
}
},
{
"path": "pages/mine/index",
"style": {
@ -778,9 +791,35 @@
}
}
],
"tabBar": {
"color": "#999999",
"selectedColor": "#FFC023",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/image/tabbar/home.png",
"selectedIconPath": "static/image/tabbar/home2.png",
"text": "首页"
}, {
"pagePath": "pages/shop/index",
"iconPath": "static/image/tabbar/mall.png",
"selectedIconPath": "static/image/tabbar/mall2.png",
"text": "商城"
}, {
"pagePath": "pages/API/index",
"iconPath": "static/image/tabbar/message.png",
"selectedIconPath": "static/image/tabbar/message2.png",
"text": "消息"
}, {
"pagePath": "pages/mine/index",
"iconPath": "static/image/tabbar/mine.png",
"selectedIconPath": "static/image/tabbar/mine2.png",
"text": "我的"
}]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}

View File

@ -197,13 +197,6 @@ export default {
}
}
},
onLoad(){
this.$u.api.getlogn({
id:1,
name:2
}).then((res)=>{
console.log(res)
})
}
onLoad(){}
}
</script>