diff --git a/common/http.api.js b/common/http.api.js index 550c93e..10342c3 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -6,6 +6,12 @@ const install = (Vue, vm) => { let api = { getLiveSpec(){ return vm.$u.get("Streaming/getLiveSpec") + }, + login({member_name,member_password}){ + return vm.$u.post("Login/login",{member_name,member_password}) + }, + createLivesp({spec_name}){ + return vm.$u.post("Streaming/createLivesp",{spec_name}) } } // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 diff --git a/common/http.interceptor.js b/common/http.interceptor.js index ff4b9f0..ebb8144 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,15 +1,20 @@ const install = (Vue, vm) => { // 此为自定义配置参数,具体参数见上方说明 Vue.prototype.$u.http.setConfig({ - baseUrl: 'https://dmmall.sdbairui.com//storeapi/', + baseUrl: 'https://dmmall.sdbairui.com//storeapi', loadingText: '努力加载中~', loadingTime: 800, // 设置自定义头部content-type // header: { - // 'content-type': 'xxx' + // "Authorization" : "122" // } // ...... - }); + }); + Vue.prototype.$u.http.interceptor.request = (config) => { + const token = uni.getStorageSync('token'); + config.header.Authorization = 'Bearer' + " " + token; + return config; + } } export default { diff --git a/components/release/tap_tosign.vue b/components/release/tap_tosign.vue index aff1e52..c543dc0 100644 --- a/components/release/tap_tosign.vue +++ b/components/release/tap_tosign.vue @@ -4,8 +4,8 @@ 标签 + 新建标签 - {{item}} + {{item.spec_name}} @@ -32,11 +32,11 @@ // 演示地址,请勿直接使用 action: 'http://www.example.com/upload', fileList: [], - fileListes: ["美妆", "博主穿搭", "美妆", "美妆", "美妆", "美妆", "美妆", "博主穿搭"], show: false, rSelect: [] } }, + props:['fileListes'], methods: { show_add() { console.log(this.show) diff --git a/pages.json b/pages.json index 94fa732..26d5d8c 100644 --- a/pages.json +++ b/pages.json @@ -3,6 +3,17 @@ "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" }, "pages": [ + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "app-plus": { + "titleNView": false, + "animationType": "slide-in-bottom" + } + } + }, { "path": "pages/release/tosign", "style": { @@ -38,17 +49,6 @@ } } }, - { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "app-plus": { - "titleNView": false, - "animationType": "slide-in-bottom" - } - } - }, { "path": "pages/release/video", "style": { diff --git a/pages/index/index.vue b/pages/index/index.vue index 382eaed..24e55a2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -194,7 +194,7 @@ export default { this.current = current; }, navto(url){ - this.$u.router({ + this.$u.route({ url:`/pages/${url}` }) // console.log(`/pages/${url}`) diff --git a/pages/login/login.vue b/pages/login/login.vue index eb59b14..d1bff77 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -9,15 +9,16 @@ 账号登录 - + - + - {{login}} + {{login}} + @@ -32,6 +33,8 @@ value: '', login: '登录', show: false, + zhanghao:"", + mima:"" }; }, @@ -54,6 +57,34 @@ }, loading(){ + }, + logins(){ + this.$u.api.login({member_name:this.zhanghao,member_password:this.mima}).then((res)=>{ + console.log(res) + if(res.errCode != 0){ + this.$refs.uToast.show({ + title: res.message, + type: 'error' + }) + }else{ + uni.setStorageSync("token",res.data.token) + uni.setStorageSync("userinfo",res.data) + this.$u.route({ + url:"/pages/index/index", + type:"switchTab" + }) + } + + }) + } + }, + onLoad(){ + let token = uni.getStorageSync('token'); + + if(token != undefined && token){ + this.$u.route({ + url:"/pages/index/index" + }) } } }; diff --git a/pages/release/tosign.vue b/pages/release/tosign.vue index adbcae0..77e05ce 100644 --- a/pages/release/tosign.vue +++ b/pages/release/tosign.vue @@ -26,7 +26,7 @@ - + 直播封面图 @@ -56,7 +56,8 @@ max : '优秀的标题可以卖的更好哦~', titleMaxLength : '20', show: false, - relerest: '开始直播' + relerest: '开始直播', + fileListes:[] }; }, @@ -89,6 +90,12 @@ this.max = String(this.max).slice(0, this.titleMaxLength); } } + }, + onLoad(){ + this.$u.api.getLiveSpec().then((res)=>{ + console.log(res) + this.fileListes = res.data + }) } };