diff --git a/common/api/user.js b/common/api/user.js deleted file mode 100644 index a396093..0000000 --- a/common/api/user.js +++ /dev/null @@ -1,13 +0,0 @@ -export default { - init(vm){ - return { - // 首页协议 列子 - // documentInfo({document_code}) { - // return vm.$u.post('StartUp/documentInfo', { - // document_code : document_code - // }); - // }, - - } - } -} \ No newline at end of file diff --git a/common/http.api.js b/common/http.api.js index cf7e500..556c5ba 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -1,14 +1,21 @@ // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分: // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F -// import shop from "./api/shop" -import user from "./api/user" - const install = (Vue, vm) => { - let userApi = user.init(vm) - // let shopApi = shop.init(vm) + // 此处没有使用传入的params参数 + 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)下 - vm.$u.api = {...userApi}; + vm.$u.api = api; } export default { diff --git a/common/http.interceptor.js b/common/http.interceptor.js index f1144d9..4025b10 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,62 +1,20 @@ const install = (Vue, vm) => { // 此为自定义配置参数,具体参数见上方说明 Vue.prototype.$u.http.setConfig({ - baseUrl: 'https://dmmall.sdbairui.com/api', + baseUrl: 'https://dmmall.sdbairui.com//storeapi', loadingText: '努力加载中~', - loadingTime: 800 + loadingTime: 800, + // 设置自定义头部content-type + // header: { + // "Authorization" : "122" + // } // ...... - }); - - // 请求拦截,配置Token等参数 - Vue.prototype.$u.http.interceptor.request = (config) => { - // 引用token - // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式 - // 见:https://uviewui.com/components/globalVariable.html - // config.header.token = vm.token; - - // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 - // config.header.token = vm.$store.state.token; - - // 方式三,如果token放在了globalData,通过getApp().globalData获取 - // config.header.token = getApp().globalData.username; - - // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 - // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 - const token = uni.getStorageSync('token'); - // console.log(token); - // config.header.token = token; + }); + Vue.prototype.$u.http.interceptor.request = (config) => { + const token = uni.getStorageSync('token'); config.header.Authorization = 'Bearer' + " " + token; - // config.header.Token = 'xxxxxx'; - - // 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值 - // if(config.url == '/user/login') config.header.noToken = true; - // 最后需要将config进行return return config; - // 如果return一个false值,则会取消本次请求 - // if(config.url == '/user/rest') return false; // 取消某次请求 - } - - // // 响应拦截,判断状态码是否通过 - // Vue.prototype.$u.http.interceptor.response = (res) => { - // if(res.code == 200) { - // // res为服务端返回值,可能有code,result等字段 - // // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 - // // 如果配置了originalData为true,请留意这里的返回值 - // return res.result; - // } else if(res.code == 201) { - // // 假设201为token失效,这里跳转登录 - // vm.$u.toast('验证失败,请重新登录'); - // setTimeout(() => { - // // 此为uView的方法,详见路由相关文档 - // vm.$u.route('/pages/user/login') - // }, 1500) - // return false; - // } else { - // // 如果返回false,则会调用Promise的reject回调, - // // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 - // return false; - // } - // } + } } 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/main.js b/main.js index 1464370..a1080e1 100644 --- a/main.js +++ b/main.js @@ -11,6 +11,14 @@ App.mpType = 'app' const app = new Vue({ ...App }) +// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用 +import httpInterceptor from '@/common/http.interceptor.js' +Vue.use(httpInterceptor, app) + +// http接口API集中管理引入部分 +import httpApi from '@/common/http.api.js' +Vue.use(httpApi, app) + app.$mount() diff --git a/package-lock.json b/package-lock.json index 34b1f21..ec1bd6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "uview-ui": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.3.3.tgz", - "integrity": "sha512-aDXZCptHhBCzuPujX9QyCV26y2dX7WgNpm3VX9+6fxoeA6eA8s4CneNTh5jrsKzPrUYbbEs9TSqmN7zIN3a9xQ==" + "version": "1.5.2", + "resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.5.2.tgz?cache=0&sync_timestamp=1594781920423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuview-ui%2Fdownload%2Fuview-ui-1.5.2.tgz", + "integrity": "sha1-4jDud0TIBjMJe74GU+IyvJSyAwk=" } } } diff --git a/package.json b/package.json index 572e046..cd32e4e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "main.js", "dependencies": { - "uview-ui": "^1.3.3" + "uview-ui": "^1.5.2" }, "devDependencies": {}, "scripts": { diff --git a/pages.json b/pages.json index 9be94c2..3c1c507 100644 --- a/pages.json +++ b/pages.json @@ -3,7 +3,29 @@ "^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": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "app-plus": { + "titleNView": false, + "backgroundColor": "#f00", + "animationType": "slide-in-bottom" + } + } + }, { "path": "pages/index/index", "style": { @@ -27,17 +49,6 @@ } } }, - { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "app-plus": { - "titleNView": false, - "animationType": "slide-in-bottom" - } - } - }, { "path": "pages/release/video", "style": { @@ -179,5 +190,29 @@ "navigationBarTitleText": "uni-app", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" + }, + "tabBar":{ + "color": "#7A7E83", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "height": "50px", + "fontSize": "10px", + "iconWidth": "24px", + "spacing": "3px", + "list": [{ + "pagePath": "pages/index/index", + "iconPath": "", + "selectedIconPath": "", + "text": "首页", + "selectedColor":"#FBFBFB" + }, { + "pagePath": "pages/user/index", + "iconPath": "", + "selectedIconPath": "", + "text": "我的", + "selectedColor":"#FBFBFB" + }] + } } diff --git a/pages/index/index.vue b/pages/index/index.vue index a2d490d..24e55a2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -46,6 +46,7 @@ 投诉简介