Mini Program reports an error as soon as he runs
but other pages are successful. I don"t know what is going on on this page. On the Internet, it is said to use a relative path. It is useless to try.
related codes: common.js
let url= "https://devxcx.webf10.com";
export let getopenidbycode=url+"/xcx/stockgame?action=getopenidbycode";
export let adduser=url+" / xcx/stockgame?action=adduser ";
export let getstockinfo=url+"/xcx/stockgame?action=getstockinfo";
export let getusergamedata=url+"/xcx/stockgame?action=getusergamedata";
export let uploadgamedata=url+"/xcx/stockgame?action=uploadgamedata";
export let getwechatpic=url+"/xcx/stockgame?action=getwechatpic";
export let getranking=url+"/xcx/stockgame?action=getranking";
export default function axios (init) {
init=init?init.url?init:false:false;
if(!init) return "!!!";
let defaults={
data:{},
method:"get",
dataType:"json",
header: { "content-type": "application/json"},
...init
};
defaults={...defaults,...init};
let abort;
let Pro=new Promise(function(resolve,reject){
abort=wx.request({
...defaults,
success(e){
resolve(e);
},
fail(e){
reject(e);
wx.showToast({
title: "~~~",
icon: "none",
duration: 2000
})
}
})
});
return {
ajax:Pro,
abort
}
};
game.js
import request, {
getstockinfo,
uploadgamedata
} from ".. /.. / assets/js/common.js";
import * as echarts from ".. / ec-canvas/echarts.js";
const app = getApp ();
function initChart (canvas, width, height, option) {
const chart = echarts.init (canvas, null, {
width: width,
height: height
});
canvas.setChart (chart);
chart.setOption (option);
return chart;
};
game.json
{
"usingComponents": {
"ec-canvas": "../ec-canvas/ec-canvas"
},
"deviceOrientation": "portrait",
"openDataContext": "pages/index"
}
I really don"t know how to modify it. Ask for advice