chameleon-team / cml-yanxuan

仿网易严选的跨端cml应用
68 stars 21 forks source link

cml build后的发布包首页无法正常显示 #2

Closed sotoup closed 5 years ago

sotoup commented 5 years ago

bug描述 cml build后的发布包首页无法正常显示

复现bug的步骤

npm install -g http-server
cd cml-yanxuan
修改 chameleon.config.js
const publicPath = 'http://192.168.0.108:8080/cml-yanxuan/dist';
// 设置api请求前缀
const apiPrefix = 'http://192.168.0.108:8080';
cml build
cd ..
http-server
访问 http://192.168.0.108:8080/cml-yanxuan/dist/web/cml-yanxuan.html#/
无法正常显示
但是点击进入/cml/h5/list 页面却显示正常

试了下官方发布的地址也是同样的问题
https://chameleon-team.github.io/cml-yanxuan/dist/web/cml-yanxuan.html#/

经调试发现index页下相关cml.get的调用返回的res都是string,因此res.code为undefined,if(res.code ==0){} 这个逻辑不会被调用,而list页面确实正常的

      cml.get({
        url: '/cml-yanxuan/mock/getHomeImgList.json'
      }).then(res => {
        if (res.code == 0) {
          const {special, disscountPriceImgUrl} = res.data;
          this.special = special;
          this.disscountPriceImgUrl = disscountPriceImgUrl;
        }
      }).catch(err => {
        console.log(err)
      })

问题截图

编译环境信息 chameleon-tool 版本:chameleon-tool@0.0.15 nodejs版本、npm版本:[node v10.9.0、npm 6.2.0] 电脑操作系统:windows8 amd64 运行环境信息

beatles-chameleon commented 5 years ago

谢谢指正,已修复~