首先,先确认是否设置了合法域名,或者在开发环境下不校验合法域名。关于设置合法域名请看→微信小程序 网络请求之设置合法域名
以下是wx.request的详细说明,截图于微信小程序开发文档
在微信index.js 发起一个普通HTTPS请求,上代码
wx.request({
url: 'http://localhost:8800/ws_member.asmx/test',
data: { strCallUserCode: 'test', strCallPassword: '123' },
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT header: { 'content-type': 'application/json'
},// 设置请求的 header
success: function (res) { if (res.statusCode == 200) {
} else {
console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode)
}
},
fail: function () {
console.log("index.js wx.request CheckCallUser fail")
},
complete: function () { // complete }
})
没咋看懂你的程序,感觉状态机有点乱,电路中还是尽量不要有latch,而且代码应该规范点。发一个我写的吧,程序不好,将就看看,希望对你有帮助
module test(
clk,
rst_n,
R,
L,
I
)
input clk
input rst_n
input [2:0] I//
output [2:0] R
output [2:0] L
reg [2:0] R
reg [2:0] L
reg[2:0] Q
reg[3:0] state,nstate
parameter IDLE = 4'b0001,// kong xian
Cycle_L = 4'b0010,
Cycle_R = 4'b0100,
NON_Cycle = 4'b1000,
//Cycle_R2 = 4'b1001,
Cycle_R1 = 4'b1010,
Cycle_R0 = 4'b1011,
//Cycle_L2 = 4'b1100,
Cycle_L1 = 4'b1101,
Cycle_L0 = 4'b1110
always @ (posedge clk)
if(!rst_n)
state <= IDLE
else
state <= nstate
always @ (state or I)
begin
case(state)
IDLE: begin
R <= 3'b111
L <= 3'b111
if(!I[0]) nstate <= Cycle_R
else if(!I[1]) nstate <= Cycle_L
else if(!I[2]) nstate <= NON_Cycle
else nstate <= IDLE
end
Cycle_R: begin
L <= 3'b111
R <= 3'b011
if(!I[0])
nstate <= Cycle_R1
else
nstate <= IDLE
end
Cycle_R1: begin
R <= 3'b101
if(!I[0])
nstate <= Cycle_R0
else
nstate <= IDLE
end
Cycle_R0: begin
R <= 3'b110
if(!I[0])
nstate <= Cycle_R
else
nstate <= IDLE
end
Cycle_L: begin
R <= 3'b111
L <= 3'b110
nstate <= Cycle_L1
end
Cycle_L1:begin
L <= 3'b101
if(!I[1])
nstate <= Cycle_L0
else
nstate <= IDLE
end
Cycle_L0:begin
L <= 3'b011
if(!I[1])
nstate <= Cycle_L
else
nstate <= IDLE
end
NON_Cycle: begin
R <= 3'b111
L <= 3'b111
end
default:
endcase
end
endmodule
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)