12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import { _decorator, Component, Node, Sprite, SpriteFrame } from 'cc';
- import { base_ui } from '../../fw/base_ui';
- import { feedback_selected } from './feedback_selected';
- import { feedback_submit } from './feedback_submit';
- import { http } from '../../http';
- import { config } from '../../config';
- import { uiManager } from '../../manager/uiManager';
- import { SdkUtil } from '../../sdkUtil';
- const { ccclass, property } = _decorator;
- @ccclass('feedback')
- export class feedback extends base_ui {
- @property(Node) btn_close:Node = null
- @property(Node) img_title:Node = null
- @property(SpriteFrame) sf_feedback_title:SpriteFrame = null
- @property(Node) submit_bottom:Node = null
- @property(Node) btn_submit_up:Node = null
- @property(Node) btn_submit_true:Node = null
- @property(Node) selected_node:Node = null
- @property(Node) submit_node:Node = null
- start() {
- this.onButtonListen(this.btn_close, ()=>{
- this.close()
- })
- this.onButtonListen(this.btn_submit_up, ()=>{
- this.selected_node.active = true
- this.submit_bottom.active = false
- this.submit_node.active = false
- this.img_title.getComponent(Sprite).spriteFrame = this.sf_feedback_title
- })
- this.onButtonListen(this.btn_submit_true, ()=>{
- this.onClickSubmit()
- })
- this.selected_node.getComponent(feedback_selected).initView((r)=>{
- this.img_title.getComponent(Sprite).spriteFrame = r.sf
- this.selected_node.active = false
- this.submit_bottom.active = true
- this.submit_node.active = true
- this.submit_node.getComponent(feedback_submit).initView(r)
- })
- }
- onClickSubmit() {
- let data = this.submit_node.getComponent(feedback_submit).getData()
- // console.log('submit data=',data)
- if(data!=null) {
- uiManager.Instance().showLoading('正在提交...')
- http.post(config.API.feedback, data, (err,d)=>{
- uiManager.Instance().hideLoading()
- if(!err){
- let nd = JSON.parse(d)
- if(nd.code === config.status.SUCCESS){
- SdkUtil.showToast('意见反馈已提交')
- this.close()
- }
- }
- })
- }
- }
- }
|