Uninote
Uninote
用户根目录

09 todo

基于dajx 新建一个分支开发

替换左侧树形控件,并优化定位

http://video.dajxyl.com/video_play.html?video_url=https://admin.dajxyl.com/oss?path=video/upload/202109/20210903_143826.mp4

env 环境切换

http://video.dajxyl.com/video_play.html?video_url=https://admin.dajxyl.com/oss?path=video/upload/202109/20210904_185154.mp4

  • 这个不做了

参数配置 = url + local storage

http://video.dajxyl.com/video_play.html?video_url=https://admin.dajxyl.com/oss?path=video/upload/202109/20210905_161500.mp4

url 转换配置模块

http://video.dajxyl.com/video_play.html?video_url=https://admin.dajxyl.com/oss?path=video/upload/202109/20210908_121627.mp4

前缀匹配,则替换
遍历,不中途退出,可能被多次转换
存储到 local storage,不存url 参数
如果被转换了,则 base 配置失效

/api/user/login  >> https://dev.api.dajxyl.com/user/login


/a/c/e >> /b/c/e >> /x/e
/a/d/e >> /b/d/e >> /y/e

变更

上面提到的最终 url 拼接,变更如下:

  • base = 配置的 base 参数(如有),或者当前访问的 URL 的 origin 部分(http(s) + host)
  • rewritten_url = 接口的 url 进行遍历重写
  • 最终用于请求的 resolved_url = new URL(rewritten_url, base)
  • new URL 是浏览器的接口,w3c 标准:
// from https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#examples
// Base urls
let m = 'https://developer.mozilla.org';
let a = new URL("/", m);                                // => 'https://developer.mozilla.org/'
let b = new URL(m);                                     // => 'https://developer.mozilla.org/'

        new URL('en-US/docs', b);                      // => 'https://developer.mozilla.org/en-US/docs'
let d = new URL('/en-US/docs', b);                     // => 'https://developer.mozilla.org/en-US/docs'
        new URL('/en-US/docs', d);                     // => 'https://developer.mozilla.org/en-US/docs'
        new URL('/en-US/docs', a);                     // => 'https://developer.mozilla.org/en-US/docs'

        new URL('/en-US/docs', "https://developer.mozilla.org/fr-FR/toto");
                                                       // => 'https://developer.mozilla.org/en-US/docs'

        new URL('/en-US/docs', '');                    // Raises a TypeError exception as '' is not a valid URL
        new URL('/en-US/docs');                        // Raises a TypeError exception as '/en-US/docs' is not a valid URL
        new URL('http://www.example.com', );           // => 'http://www.example.com/'
        new URL('http://www.example.com', b);          // => 'http://www.example.com/'

        new URL("//foo.com", "https://example.com")    // => 'https://foo.com' (see relative URLs)

待细化的需求

模块所需变量注入

交流

http://video.dajxyl.com/video_play.html?video_url=https://admin.dajxyl.com/oss?path=video/upload/202109/20210917_104037.mp4 powder我的修改,base,utils提取

powder-test

powder-todo-dajx

点赞(0) 阅读(1) 举报
目录
标题