diff --git a/pages.json b/pages.json index 4da23805d96e6030ee138cc8d0d62378d498eb93..42e8900cfab98d188dbd5ddc7c5558679a14216f 100644 --- a/pages.json +++ b/pages.json @@ -67,6 +67,12 @@ "navigationBarTitleText": "slider" } }, + { + "path": "pages/component/slider-100/slider-100", + "style": { + "navigationBarTitleText": "slider x 100" + } + }, { "path": "pages/component/switch/switch", "style": { @@ -84,24 +90,24 @@ "style": { "navigationBarTitleText": "image" } - }, - { - "path": "pages/component/image/image-format", - "style": { - "navigationBarTitleText": "image-format" - } - }, - { - "path": "pages/component/image/image-mode", - "style": { - "navigationBarTitleText": "image-mode" - } - }, - { - "path": "pages/component/image/image-path", - "style": { - "navigationBarTitleText": "image-path" - } + }, + { + "path": "pages/component/image/image-format", + "style": { + "navigationBarTitleText": "image-format" + } + }, + { + "path": "pages/component/image/image-mode", + "style": { + "navigationBarTitleText": "image-mode" + } + }, + { + "path": "pages/component/image/image-path", + "style": { + "navigationBarTitleText": "image-path" + } }, { "path": "pages/component/web-view/web-view", @@ -521,6 +527,23 @@ "enablePullDownRefresh": false } + }, { + "path" : "pages/component/scroll-view/scroll-view-refresher", + "style" : + { + "navigationBarTitleText": "scroll-view-refresher", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/component/list/list", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + } ], "globalStyle": { diff --git a/pages/API/download-file/download-file.uvue b/pages/API/download-file/download-file.uvue index 61a7af8292c765bdacb8eb304357a0870dd03000..6bb7cebbaa6bcd1dfc1466d86d6aa86c7e7dd1a1 100644 --- a/pages/API/download-file/download-file.uvue +++ b/pages/API/download-file/download-file.uvue @@ -1,8 +1,8 @@ + .img { + width: 500rpx; + height: 500rpx; + margin: 0 auto; + } + + .image-container { + display: flex; + justify-content: center; + align-items: center; + } + \ No newline at end of file diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index 292682584852c41840b666b659adc45f75ee6441..3d27b480798740112baba64ac4c31011022f8754 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -15,55 +15,70 @@ + \ No newline at end of file diff --git a/pages/API/upload-file/upload-file.uvue b/pages/API/upload-file/upload-file.uvue index a5f26a60a5ee9bb236d25728d0b1eb63c5b1c004..edcb14d31045a3a0256fc5f917f8de9091c590e5 100644 --- a/pages/API/upload-file/upload-file.uvue +++ b/pages/API/upload-file/upload-file.uvue @@ -10,15 +10,24 @@ - - + this.pageVisible = false; + const closeOptions = new CloseSocketOptions(); + uni.closeSocket(closeOptions); + uni.hideLoading() + }, + methods: { + connect() { + if (this.connected || this.connecting) { + uni.showModal({ + content: '正在连接或者已经连接,请勿重复连接', + showCancel: false + }) + return + } + this.connecting = true + uni.showLoading({ + title: '连接中...' + }) + uni.connectSocket({ + url: 'ws://192.168.12.106:8080/ws', + success(res) { + // 这里是接口调用成功的回调,不是连接成功的回调,请注意 + }, + fail(err) { + // 这里是接口调用失败的回调,不是连接失败的回调,请注意 + } + }) + uni.onSocketOpen((res) => { + if (this.pageVisible) { + this.connecting = false + this.connected = true + uni.hideLoading() + + uni.showToast({ + icon: 'none', + title: '连接成功' + }) + console.log('onOpen', res); + } + }) + uni.onSocketError((err) => { + if (this.pageVisible) { + this.connecting = false + this.connected = false + uni.hideLoading() + + uni.showModal({ + content: '连接失败,可能是websocket服务不可用,请稍后再试', + showCancel: false + }) + console.log('onError', err); + } + }) + uni.onSocketMessage((res) => { + if (this.pageVisible) { + this.msg = res.data as string + console.log('onMessage', res) + } + }) + uni.onSocketClose((res) => { + if (this.pageVisible) { + this.connected = false + this.msg = "" + console.log('onClose', res) + } + }) + }, + send() { + uni.sendSocketMessage({ + data: 'from ' + platform + ' : ' + parseInt((Math.random() * 10000).toString()).toString(), + success(res) { + console.log(res); + }, + fail(err) { + console.log(err); + } + }) + }, + close() { + const closeSocketOptions = new CloseSocketOptions(); + uni.closeSocket(closeSocketOptions) + } + } + } + + + \ No newline at end of file diff --git a/pages/API/websocket-socketTask/websocket-socketTask.uvue b/pages/API/websocket-socketTask/websocket-socketTask.uvue index de19b878b89c0cb38f66409189959d119a9921e1..06f474b058aa3c85ac73db54bb40d3658a131639 100644 --- a/pages/API/websocket-socketTask/websocket-socketTask.uvue +++ b/pages/API/websocket-socketTask/websocket-socketTask.uvue @@ -24,8 +24,9 @@ connected: false, connecting: false, socketTask: null as SocketTask | null, - msg: "", - platform :"", + msg: "", + platform: "", + pageVisible: false } }, computed: { @@ -40,14 +41,16 @@ return '尚未连接' } } - }, - onReady() { - this.platform = uni.getSystemInfoSync().platform; + }, + onLoad() { + this.platform = uni.getSystemInfoSync().platform; + this.pageVisible = true; }, onUnload() { + this.pageVisible = false; uni.hideLoading() - let task = this.socketTask; - if (task != null) { + let task = this.socketTask; + if (task != null) { const closeOptions = new CloseSocketOptions(); task.close(closeOptions) } @@ -64,7 +67,7 @@ this.connecting = true uni.showLoading({ title: '连接中...' - }) + }) this.socketTask = uni.connectSocket({ url: 'ws://192.168.12.106:8080/ws', success(res) { @@ -73,36 +76,44 @@ fail(err) { // 这里是接口调用失败的回调,不是连接失败的回调,请注意 } - }) + }) this.socketTask?.onOpen((res) => { - this.connecting = false - this.connected = true - uni.hideLoading() - uni.showToast({ - icon: 'none', - title: '连接成功' - }) - console.log('onOpen', res); + if (this.pageVisible) { + this.connecting = false + this.connected = true + uni.hideLoading() + uni.showToast({ + icon: 'none', + title: '连接成功' + }) + console.log('onOpen', res); + } }) this.socketTask?.onError((err) => { - this.connecting = false - this.connected = false - uni.hideLoading() - uni.showModal({ - content: '连接失败,可能是websocket服务不可用,请稍后再试', - showCancel: false - }) - console.log('onError', err); + if (this.pageVisible) { + this.connecting = false + this.connected = false + uni.hideLoading() + uni.showModal({ + content: '连接失败,可能是websocket服务不可用,请稍后再试', + showCancel: false + }) + console.log('onError', err); + } }) this.socketTask?.onMessage((res) => { - this.msg = res.data as string - console.log('onMessage', res) + if (this.pageVisible) { + this.msg = res.data as string + console.log('onMessage', res) + } }) this.socketTask?.onClose((res) => { - this.connected = false - this.socketTask = null - this.msg = "" - console.log('onClose', res) + if (this.pageVisible) { + this.connected = false + this.socketTask = null + this.msg = "" + console.log('onClose', res) + } }) }, send() { @@ -116,7 +127,7 @@ }, close() { let task = this.socketTask; - if (task != null) { + if (task != null) { let closeOptions = new CloseSocketOptions(); task.close(closeOptions) } diff --git a/pages/component/list/list.uvue b/pages/component/list/list.uvue new file mode 100644 index 0000000000000000000000000000000000000000..504d81b6cb2369f5d8a9b89b9ac778c0cd4985e3 --- /dev/null +++ b/pages/component/list/list.uvue @@ -0,0 +1,87 @@ + + + + \ No newline at end of file diff --git a/pages/component/scroll-view/scroll-view-refresher.uvue b/pages/component/scroll-view/scroll-view-refresher.uvue new file mode 100644 index 0000000000000000000000000000000000000000..b1ed10ad33c46bbd62dc8d58797abf0bd9a824c1 --- /dev/null +++ b/pages/component/scroll-view/scroll-view-refresher.uvue @@ -0,0 +1,80 @@ + + + + \ No newline at end of file diff --git a/pages/component/scroll-view/scroll-view.uvue b/pages/component/scroll-view/scroll-view.uvue index c94d3cc6fd4dfb22631cb483c331d0982e7ebf8a..41cd730b0692cf4c4b473b56fe899d15859d263f 100644 --- a/pages/component/scroll-view/scroll-view.uvue +++ b/pages/component/scroll-view/scroll-view.uvue @@ -7,8 +7,8 @@ 纵向滚动 - + A B C @@ -18,6 +18,11 @@ 点击这里返回顶部 + + 下拉刷新 + + + Horizontal Scroll 横向滚动 @@ -61,7 +66,12 @@ icon: "none", title: "纵向滚动 scrollTop 值已被修改为 0" }) - } + }, + gotoRefresher: function () { + uni.navigateTo({ + url:"/pages/component/scroll-view/scroll-view-refresher" + }) + } } } @@ -93,4 +103,7 @@ font-size: 36rpx; color: #ffffff; } + .button { + margin-top: 30rpx; + } \ No newline at end of file diff --git a/pages/component/slider-100/slider-100.uvue b/pages/component/slider-100/slider-100.uvue new file mode 100644 index 0000000000000000000000000000000000000000..8edfb5334860ea822b7732d85c1823ee5b5b1a6f --- /dev/null +++ b/pages/component/slider-100/slider-100.uvue @@ -0,0 +1,48 @@ + + + + + diff --git a/pages/component/web-view-local/web-view-local.uvue b/pages/component/web-view-local/web-view-local.uvue index 0309df1f37f1b031fbccd79b1b17f7de00a82567..3a37a738ef0f27170b27e27d6a251e64ddc90a3d 100644 --- a/pages/component/web-view-local/web-view-local.uvue +++ b/pages/component/web-view-local/web-view-local.uvue @@ -3,17 +3,19 @@ - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/pages/component/web-view/web-view.uvue b/pages/component/web-view/web-view.uvue index c041fd9421af23cf513333dbb9fe5c8bb6c21267..df8fdf44f2f742025434e889275f693724a1ddd9 100644 --- a/pages/component/web-view/web-view.uvue +++ b/pages/component/web-view/web-view.uvue @@ -3,17 +3,19 @@ - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/pages/tabBar/component/component.uvue b/pages/tabBar/component/component.uvue index 4e61f10504ef992249c2fd5c438e771516b5202f..504864e1385519a66bf66a2b4e690dbf1d75d77a 100644 --- a/pages/tabBar/component/component.uvue +++ b/pages/tabBar/component/component.uvue @@ -68,7 +68,11 @@ name: 'cover-view', enable: false }, - // #endif + // #endif + { + name:'list', + enable:false + } ] as Page[] }, { id: 'content', @@ -124,6 +128,9 @@ name: 'slider', enable: true }, { + name: 'slider-100', + enable: true + },{ name: 'switch', enable: true }, {