import initCtx from "@/utils/ctx.js";

export default function () {
	const {utils, Tea} = initCtx(this)

    this.ip = ""
    this.result = {
        isDone: false,
        isOk: false,
        isFound: false,
        isAllowed: false,
        error: "",
        province: null,
        country: null,
        ipItem: null,
        ipList: null
    }

    this.$delay(function () {
        this.$watch("ip", function () {
            this.result.isDone = false
        })
    })

    this.success = function (resp) {
        this.result = resp.data.result
    }

    this.updateItem = function (listId, itemId) {
        utils.popup(Tea.url(".updateIPPopup?listId=" + listId, {itemId: itemId}), {
			height: utils.POPUP_HEIGHT_LG,
            callback: function () {
                utils.success("保存成功", function () {

                })
            }
        })
    }
}