autojs编写的支付宝支付模板,带toast弹窗,自定义控件,界面上插入图片,功能非常强大和完善值得学习
说明
本文提供的代码仅供参考。不建议用于生产环境。
可能有些地方在最新版本的Auto.js上面需要做修改,才能运行。
Auto.js简介
Auto.js是利用安卓系统的“辅助功能”实现类似于按键精灵一样,可以通过代码模拟一系列界面动作的辅助工作。
与“按键精灵”不同的是,它的模拟动作并不是简单的使用在界面定坐标点来实现,而是类似与win一般,找窗口句柄来实现的。
Auto.js使用JavaScript作为脚本语言,目前使用Rhino 1.7.7.2作为脚本引擎,支持ES5与部分ES6特性。
推荐教程
Auto.js Pro安卓全分辨率免ROOT引流脚本开发视频教程(HD超清1080p)
开发文档
Auto.js Pro开发文档
文档尚在完善中,可能有文档描述和代码实际行为有出入的情况。
为什么要使用Auto.js Pro开发脚本,有什么特点?
吸引我使用Auto.js Pro的原因有很多。最主要的几个原因是:
- Auto.js Pro能开发免ROOT的安卓脚本
- Auto.js Pro基于节点操作,能开发全分辨率的脚本,自动适配各种安卓机型
- Auto.js Pro丰富的UI组件,能自定义各种样式的安卓界面
- Auto.js Pro使用的javascript的语法比较优雅,代码可读性强
- Auto.js Pro的命令库非常的丰富,接口比较多
- Auto.js Pro脚本文件体积比较小。1000行的代码,打包后的apk文件只有3-5M,还没有广告
示例代码
/** @Version: Auto.Js Pro* @LastEditors: 大柒* @Date: 2019-04-30 22:27:06* @LastEditTime: 2019-05-05 12:25:42* @Description: 支付UI界面* 此模板是参照爱奇艺支付模板* 使用 自定义控件 降低代码重复率* 有支付宝支付功能 是我自己本人的接口* 有弹窗模板 仿toast弹窗 *///此代码由飞云脚本圈整理提供(www.feiyunjs.com)
"ui";
//此代码由飞云脚本圈整理提供(www.feiyunjs.com)
importClass("androidx.drawerlayout.widget.DrawerLayout")
importClass(android.view.WindowManager);
importClass(android.view.View);
importClass(android.graphics.Color)
importClass(android.app.AlertDialog)
importClass(java.io.FileOutputStream);
importClass(java.io.File);importClass(java.lang.Runnable);
importClass(android.animation.ObjectAnimator)
importClass(android.animation.PropertyValuesHolder)
importClass(android.animation.ValueAnimator)
importClass(android.animation.AnimatorSet)
importClass(android.view.animation.AccelerateInterpolator)
importClass(android.view.animation.TranslateAnimation)
importClass(android.animation.ObjectAnimator)
importClass(android.animation.TimeInterpolator)
importClass(android.os.Bundle)
importClass(android.view.Window)importClass(android.view.animation.AccelerateDecelerateInterpolator)
importClass(android.view.animation.AccelerateInterpolator)
importClass(android.view.animation.AnticipateInterpolator)
importClass(android.view.animation.AnticipateOvershootInterpolator)
importClass(android.view.animation.BounceInterpolator)
importClass(android.view.animation.CycleInterpolator)
importClass(android.view.animation.DecelerateInterpolator)
importClass(android.view.animation.LinearInterpolator)
importClass(android.view.animation.OvershootInterpolator)
importClass(android.view.animation.PathInterpolator)
importClass(android.widget.Button)
importClass(android.widget.ImageView)
importClass(android.widget.TextView)//用户信息
user = {name: "大柒",id: "15",phone: "18000000000",time_off: "2019-05-31",
}//套餐信息
payName = "黄金VIP套餐"//IMG图片数据
img_zfb = "http://gdown.baidu.com/img/0/512_512/4bfcfd18afa6dc68ef84b00302344dbd.png";
img_wx = "https://16570095.s21i.faiusr.com/4/ABUIABAEGAAgh9i35gUogKLn1wUwgAQ4gAQ.png";
img_user = "https://16570095.s21i.faiusr.com/2/ABUIABACGAAgu9y35gUo0Mbk_AUw9AM49AM.jpg"const animation_time = 500//动画时间//任务栏透明
var window = activity.getWindow();
var decorView = window.getDecorView();
var option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
window.setStatusBarColor(Color.TRANSPARENT);//确认支付按钮 背景和文字color
pay_bnt = {s: { bg: "#e3e3e3", color: "#ffffff" },c: { bg: "#f2c186", color: "#6b4128" }
}var MyColor = "#3d3d3f"//主题色
const log_back = "@drawable/ic_chevron_left_black_48dp"//返回按钮var v_meal_bg = [];//套餐view信息
var v_pay_radio = [];//支付方式 单选框值
var order = {};
var remind = {};//订单支付信息
var data = {name: user.name,id: user.id,goods: payName,money: "",pay: "",date: "",
}//自定义控件 充值套餐
var setMealLayout = (function () {util.extend(setMealLayout, ui.Widget);function setMealLayout() {ui.Widget.call(this);this.defineAttr("title", (view, attr, value, defineSetter) => {view._title_bg.attr("visibility", "visible");view._title_text.setText(value);})this.defineAttr("month", (view, attr, value, defineSetter) => {view._month.setText(value);});this.defineAttr("money", (view, attr, value, defineSetter) => {view._money.setText(value);});this.defineAttr("subtitle", (view, attr, value, defineSetter) => {view._subtitle.attr("visibility", "visible");view._subtitle.setText(value);});this.defineAttr("remind", (view, attr, value, defineSetter) => {view._remind_bg.attr("visibility", "visible");view._remind.setText(value);});this.defineAttr("onClick", (view, name, defaultGetter) => {return this._onClick;}, (view, name, value, defaultSetter) => {v_meal_bg[v_meal_bg.length] = viewthis._onClick = value;});};setMealLayout.prototype.render = function () {return (<frame h="*" w="*" marginRight="10" ><cardid="_title_bg"w="auto" h="14"cardCornerRadius="5dp"cardBackgroundColor="#3b3b3b"gravity="center"foreground="?selectableItemBackground"visibility="invisible"><text id="_title_text" text="0" margin="5 0 5 0" textSize="10" textStyle="bold" textColor="#dbbb88" /></card><vertical id="_bg" h="*" w="*" marginTop="7" bg="#e3e3e3" ><vertical id="_bg_1" w="*" h="*" margin="1" bg="#ffffff" gravity="center_horizontal"><text id="_month" w="auto" text="0个月" marginTop="10" textStyle="bold" textSize="22" /><horizontal w="auto" h="auto" ><text text="¥" textColor="#a37655" /><text id="_money" text="0.00" textColor="#a37655" textSize="32" textStyle="bold" typeface="serif" /></horizontal><text id="_subtitle" w="auto" text="0" textSize="10" visibility="invisible" /><card id="_remind_bg"w="auto" h="auto"marginTop="5" marginBottom="15"cardCornerRadius="6"cardBackgroundColor="#dcbb86"gravity="center"foreground="?selectableItemBackground"visibility="invisible" ><horizontal margin="2 0 2 0"><img w="10" h="10" margin="5 2 3 0" src="@drawable/ic_thumb_up_black_48dp" tint="#ffffff" /><text id="_remind" text="0" margin="0 0 5 0" textSize="10" textStyle="bold" textColor="#ffffff" /></horizontal></card></vertical></vertical></frame>);};setMealLayout.prototype.onViewCreated = function (view) {view.on("click", () => {if (this._onClick) {for (let i = 0; i != v_meal_bg.length; i++) {v_meal_bg[i]._bg.attr("bg", "#e3e3e3");v_meal_bg[i]._bg_1.attr("alpha", "1");}ui.money.setText(view._money.text())ui.money_s.setText("你已选择" + ui.money_name.text() + view._month.text() + "套餐")data.money = parseInt(view._month.text())view._bg.attr("bg", "#d6bf93");view._bg_1.attr("alpha", "0.8");pay_money = parseInt(view._month.text())eval(this._onClick);}});};ui.registerWidget("setMeal-layout", setMealLayout);return setMealLayout;
})();//自定义控件 用户信息标题
var userTitleLayout = (function () {util.extend(userTitleLayout, ui.Widget);function userTitleLayout() {ui.Widget.call(this);}userTitleLayout.prototype.render = function () {return (<horizontal h="*" w="*" bg="{{MyColor}}" gravity="center_vertical" ><img marginLeft="10" src="{{img_user}}" h="44" w="44" circle="true" scaleType="fitXY" layout_gravity="center_vertical" /><vertical w="*" h="44" marginLeft="10" ><horizontal h="22" gravity="vertical_center"><text id="user_name" text="{{user.name}}" textSize="18" textStyle="bold" textColor="#ffffff" /><card w="auto" h="auto" margin="5 3 0 0" cardCornerRadius="5dp" cardBackgroundColor="#dbbb88"cardElevation="5dp" gravity="center" foreground="?selectableItemBackground"><horizontal margin="5 0 5 0"><text id="user_id" text="ID: {{user.id}}" textColor="{{MyColor}}" textStyle="bold" /></horizontal></card><text id="user_phone" text="({{user.phone}} 登录)" h="*" marginTop="1" textSize="16" gravity="center_vertical" textColor="#ffffff" /></horizontal><text text="{{user.time_off}}到期,购买后有效期将延顺" h="*" gravity="center_vertical" textColor="#80ffffff" /></vertical></horizontal>)}ui.registerWidget("user_title-layout", userTitleLayout);return userTitleLayout;
})();//自定义控件 付款方式
var payLayout = (function () {util.extend(payLayout, ui.Widget);function payLayout() {ui.Widget.call(this);this.defineAttr("name", (view, attr, value, defineSetter) => {view._pay_name.setText(value);});this.defineAttr("label", (view, attr, value, defineSetter) => {view._label_text.setText(value)switch (value) {case "推荐":view._label_bg.attr("cardBackgroundColor", "#f5a623")break;case "维护":view._label_bg.attr("cardBackgroundColor", "#999999")break;}view._label_bg.attr("visibility", "visible");})this.defineAttr("subtitle", (view, attr, value, defineSetter) => {view._subtitle.setText(value);view._subtitle.attr("visibility", "visible");});this.defineAttr("src", (view, attr, value, defineSetter) => {view._img.attr("src", value);});this.defineAttr("onClick", (view, name, defaultGetter) => {return this._onClick;}, (view, name, value, defaultSetter) => {v_pay_radio[v_pay_radio.length] = view._radiothis._onClick = value;});}payLayout.prototype.render = function () {return (<vertical ><frame h="1" w="*" bg="#e3e3e3" /><horizontal marginTop="10" marginBottom="10" w="*" h="44" ><img id="_img" w="44" src="#ffffff" /><vertical h="*" w="auto" marginLeft="10"><horizontal h="22" w="auto"><text id="_pay_name" w="auto" text="未知" textSize="18" textStyle="bold" textColor="#000000" minWidth="60" /><card id="_label_bg" w="auto" h="auto" marginLeft="10" layout_gravity="center_vertical" cardCornerRadius="6" cardBackgroundColor="#f5a623"foreground="?selectableItemBackground" visibility="invisible"><text id="_label_text" margin="10 0 10 0" text="暂无" textStyle="bold" textSize="14" textColor="#ffffff" /></card></horizontal><text id="_subtitle" w="auto" h="*" gravity="bottom" text="暂无" textSize="12" visibility="invisible" /></vertical><vertical w="*" h="*" gravity="right|center"><radio id="_radio" w="auto" clickable="false" /></vertical></horizontal></vertical>)};payLayout.prototype.onViewCreated = function (view) {view.on("click", () => {if (this._onClick) {for (let i = 0; i != v_pay_radio.length; i++) {v_pay_radio[i].attr("checked", false);}if (view._label_text.text() == "维护") {pay = 0alert(view._pay_name.text() + "支付通道正在维护中")} else {pay = view._pay_name.text()view._radio.attr("checked", true)}eval(this._onClick);}});};ui.registerWidget("pay-layout", payLayout);return payLayout;
})();//自定义控件 处理中toast
var remindLayout = (function () {util.extend(remindLayout, ui.Widget);function remindLayout() {ui.Widget.call(this);this.defineAttr("onClick", (view, name, defaultGetter) => {return this._onClick;}, (view, name, value, defaultSetter) => {remind = viewthis._onClick = value;});}remindLayout.prototype.render = function () {return (<frame id="_loads" w="*" h="*" ><card id="_load" h="150" w="150" cardBackgroundColor="#95000000" layout_gravity="center"cardElevation="0" cardCornerRadius="10dp" alpha="0"><frame ><frame alpha="0.6"><img id="_load_colse" w="70" h="70" src="@drawable/ic_sentiment_dissatisfied_black_48dp" layout_gravity="center" marginBottom="10" tint="#ffffff" alpha="0" /></frame><frame id="_load_0"><text id="_load_time" text="10" w="auto" h="auto" layout_gravity="center" marginBottom="10" textStyle="bold" textColor="#90ffffff" textSize="30" /><progressbar w="80" h="80" layout_gravity="center" marginBottom="10" alpha="0.8" /></frame><text id="_load_text" text="正在创建订单" w="auto" h="auto" marginBottom="10" layout_gravity="bottom|center" textStyle="bold" textColor="#90ffffff" textSize="16" /></frame></card></frame>)}ui.registerWidget("remind-layout", remindLayout);return remindLayout;
})();//自定义控件 支付弹窗ui
var orderLayout = (function () {util.extend(orderLayout, ui.Widget);function orderLayout() {ui.Widget.call(this);this.defineAttr("src", (view, attr, value, defineSetter) => {view._img.attr("src", value);});this.defineAttr("onClick", (view, name, defaultGetter) => {return this._onClick;}, (view, name, value, defaultSetter) => {order = viewthis._onClick = value;});}orderLayout.prototype.render = function () {return (<frame id="pay_bg_bg" w="*" h="*" bg="#000000" alpha="0" visibility="gone" ><vertical w="*" h="*" gravity="center_vertical" marginTop="-40"><horizontal w="*" h="auto" weightSum="5" gravity="center" ><card id="pay_bg" h="auto" w="auto" margin="0 40 0 40" layout_weight="2"cardElevation="20" cardCornerRadius="25dp" cardBackgroundColor="#ffffff" alpha="0"><vertical h="*" w="*" clipChildren="false"><vertical h="*" w="*" marginBottom="30" ><horizontal marginTop="10" gravity="center_horizontal"><text text="支付时请核对下面订单号" textColor="#000000" /></horizontal><textid="_data"marginTop="10"text="0"textColor="#000000"gravity="center_horizontal"/><horizontal w="*" h="150" weightSum="5" gravity="center_horizontal"><img id="_img" w="*" h="*" src="#ffffff" layout_weight="3" scaleType="fitCenter" layout_gravity="center_horizontal" /></horizontal><textid="_pay_g"text="198.00"textColor="#000000"textStyle="bold"textSize="30"gravity="center"/></vertical><vertical h="auto" w="*" layout_weight="1" bg="#00a0e8" ><img w="44" h="44" marginTop="-22" src="{{img_user}}" layout_gravity="center_horizontal" circle="true" borderWidth="2" borderColor="#ffffff" /><vertical marginLeft="20" marginTop="10"><textid="_user"h="auto"text="用户信息: "textColor="#ffffff"textSize="12"/><textid="_pay"h="*"text="订单信息: "textColor="#ffffff"textSize="12"/><textid="_date"h="*"text="创建时间: "textColor="#ffffff"textSize="12"/></vertical><frame w="*" h="25" margin="0 10 0 10" gravity="center_horizontal"><text w="auto" h="*" text="已完成支付" textColor="#ffffff" gravity="center_vertical" /><img id="_validation" w="100" h="25" src="#00ffffff" borderWidth="1" borderColor="#ffffff" layout_gravity="center_horizontal" scaleType="fitXY" radius="20" /></frame></vertical></vertical></card></horizontal><frame id="_close" w="40" h="40" marginTop="-20" layout_gravity="center_horizontal" alpha="0.5" rotation="45"><img w="*" h="*" src="#00ffffff" borderWidth="1" borderColor="#ffffff" layout_gravity="center_horizontal" scaleType="fitXY" radius="60" /><vertical w="25" h="1" bg="#ffffff" layout_gravity="center" /><vertical w="1" h="25" bg="#ffffff" layout_gravity="center" /></frame></vertical><texttext="UI示例,@大柒 "textColor="#80ffffff"textSize="28"textStyle="bold"gravity="center_horizontal"marginTop="20" /><vertical w="*" h="auto" layout_gravity="bottom"><frame w="*" h="25" marginBottom="10" gravity="center_horizontal" alpha="0.5"><text id="_intent_text" w="auto" h="*" text="本机支付" textColor="#ffffff" gravity="center_vertical" /><img id="_intent" w="100" h="25" src="#00ffffff" borderWidth="1" borderColor="#ffffff" layout_gravity="center_horizontal" scaleType="fitXY" radius="20" /></frame><text h="auto" text="扫描上方二维码进行付款" textColor="#80ffffff" gravity="center_horizontal" textSize="10" /><text h="auto" text="付款完成后,点击已完成支付" textColor="#80ffffff" gravity="center_horizontal" textSize="10" /></vertical></frame>)};orderLayout.prototype.onViewCreated = function (view, attr, value) {};ui.registerWidget("order-layout", orderLayout);return orderLayout;
})();//ui界面
ui.layout(<vertical h="*" ><frame h="*" id="pay_0"><vertical h="*" w="*"><vertical h="auto"><appbar ><toolbar bg="{{MyColor}}" id="toolbar" fitsSystemWindows="true" h="75" ><img h="35" id="pay_close" src="{{log_back}}" tint="#98ffffff" /><text text="会员中心" textStyle="bold" textSize="18" textColor="#98ffffff" layout_gravity="center" /></toolbar></appbar></vertical><scroll h="*" w="*" layout_gravity="center"><vertical h="*" w="*" bg="#f5f6f8" ><user_title-layout h="60" w="*" /><vertical h="auto" w="*" bg="#ffffff" ><frame h="64" w="*" margin="10 0 10 0" ><text h="*" w="auto" id="money_name" text="{{payName}}" textSize="22" textColor="#000000" textStyle="bold" layout_gravity="left" gravity="center_vertical" /><frame h="*" w="auto" layout_gravity="right" ><text h="*" w="auto" id="pay_key" text="激活码续费 >" gravity="center_vertical" /></frame></frame><horizontal h="auto" marginLeft="10" marginBottom="30" ><setMeal-layout h="auto" w="*" layout_weight="1" title="赠一对一专属客服" month="12个月" money="198" subtitle="折合16.5/月" remind="最大优惠哦!" onClick="pay_bnt_color1()" /><setMeal-layout h="auto" w="*" layout_weight="1" title="优惠很低" month="3个月" money="58" subtitle="折合19.3/月" onClick="pay_bnt_color1()" /><setMeal-layout h="auto" w="*" layout_weight="1" month="1个月" money="19.8" onClick="pay_bnt_color1()" /></horizontal></vertical><vertical w="*" h="auto" marginTop="10" bg="#ffffff"><vertical margin="10 10 20 10"><text text="付款方式" marginBottom="10" textSize="22" textStyle="bold" textColor="#000000" /><pay-layout w="*" h="auto"name="支付宝"src="{{img_zfb}}"label="推荐"subtitle="数亿人都在用 , 安全可托付"onClick="pay_bnt_color1()"/><pay-layout w="*" h="auto"name="微信"src="{{img_wx}}"label="维护"subtitle="诚信1+1 , 支付百分百"onClick="pay_bnt_color1()"/></vertical></vertical><vertical w="*" h="100" /></vertical></scroll><card h="60" w="*" bg="#f5f6f8" marginTop="-60" layout_gravity="bottom"cardElevation="30"><horizontal h="*" w="*" ><vertical h="*" w="*" layout_weight="1" marginLeft="20"><horizontal w="*" h="40"><text text="总计:" h="*" w="auto" textSize="20" gravity="center_vertical" textColor="#000000" /><text text="¥" textSize="20" marginLeft="10" gravity="center_vertical" textColor="#b48c51" /><text id="money" text="0.00" textSize="30" textStyle="bold" gravity="center_vertical" textColor="#b48c51" /></horizontal><frame w="*" h="20" ><text id="money_s" text="请选择套餐" /></frame></vertical><vertical id="pay_bnt_bg" h="*" w="*" layout_weight="2" bg="{{pay_bnt.s.bg}}" gravity="center"><text id="pay_bnt_color" text="确认支付" textStyle="bold" textSize="20" gravity="center" textColor="{{pay_bnt.s.color}}" /></vertical></horizontal></card></vertical><remind-layout w="*" h="*" onClick="" /><order-layout w="*" h="*" onClick="" /></frame></vertical>
);var pay = 0
var pay_money = 0
var int_0 = 0, int_1 = 0
var load_time = 10
var load_pay = false
var pay_key = {}
var uname
var get_url = "http://shangtai0115.vicp.io:45981/"ui.pay_bnt_bg.on("click", () => {if (load_pay) { toast("请不要重复提交订单"); return };if (!pay_money) { dialogs.alert("请选择续费套餐"); return };if (!pay) { dialogs.alert("请选择支付方式"); return };ui.run(function () {remind._load_colse.attr("alpha", "0")remind._load_text.setText("正在创建订单")remind._load_0.attr("alpha", "1")load_time = 10remind._load_time.setText("10")dialogs.select("请选择预执行的动作", ["生成订单", "生成赞赏码"]).then(i => {switch (i) {case 0:let get = "open-get?flag=测试订单&"get += "user=" + user.name + "&"get += "id=" + user.id + "&"get += "data=" + pay_money + "&"get += "pay=支付宝"uname = "购买" + pay_money + "个月" + payNamegethttp(get)break;case 1:rawInput("请输入要赞赏的金额").then(age => {let A = age//let A = parseFloat(age)if (isNaN(A) || A == null || A <= 0) { log("错误"); alert("请输入正确金额"); return }let get = "open-get?flag=自定义赞赏&"get += "user=" + user.name + "&"get += "id=" + user.id + "&"get += "data=" + A + "&"get += "pay=支付宝"uname = "自定义赞赏"gethttp(get)});break;}});})function gethttp(data) {remind._loads.attr("clickable", true);load_pay = true//采用回调方式GET请求http.get(get_url + data, {}, function (res, err) {if (err) {console.error(err);return;}pay_key = res.body.json()http.get(pay_key.url_logo, {}, function (res1, err) {if (err) {console.error(err);return;}let AA1 = res1.body.string()var pattern = "qrcode_plugins_img =\"(.*)\"";pay_key.img = AA1.match(pattern)[1];//log("html = " + pay_key.img);pay_loading()});});//定时器倒计时remind._load.attr("alpha", "1");int_0 = setInterval(function () {if (!load_pay) { toast_load_colse(); clearInterval(int_0); }if (load_time == 0) {ui.run(function () {remind._load_colse.attr("alpha", "1")remind._load_0.attr("alpha", "0")remind._load_text.setText("创建订单失败")clearInterval(int_0);})setTimeout(function () {toast_load_colse()}, 2000);return}load_time--remind._load_time.setText("" + load_time)}, 1000);}
})ui.pay_key.on("click", () => {log("激活码续费")alert("UI示例文件,不支持激活码续费")
})ui.pay_close.on("click", () => {toastLog("ui关闭")exit()
})function toast_load_colse() {ui.run(function () {remind._load.attr("alpha", "0")clearInterval(int_0);load_pay = falseremind._loads.attr("clickable", false);})
}function pay_bnt_color1() {ui.run(function () {if (pay && pay_money) {ui.pay_bnt_bg.attr("bg", pay_bnt.c.bg)ui.pay_bnt_color.setTextColor(colors.parseColor(pay_bnt.c.color))} else {ui.pay_bnt_bg.attr("bg", pay_bnt.s.bg)ui.pay_bnt_color.setTextColor(colors.parseColor(pay_bnt.s.color))}})
}function pay_loading() {ui.run(function () {order._img.attr("src", "http:" + pay_key.img)order._user.setText('用户信息: ' + user.name + ' ID: ' + user.id)order._pay.setText('订单信息: ' + uname)order._date.setText('创建时间: ' + pay_key.date)order._pay_g.setText(keepTwoDecimalFull(pay_key.pay))order._data.setText(str_key(pay_key.data, 4))})sleep(2000)toast_load_colse()load_pay = trueui.run(function () {order.pay_bg_bg.attr("visibility", "visible");order.pay_bg_bg.attr("clickable", true);slX = ObjectAnimator.ofFloat(order.pay_bg, "scaleX", 0, 1)slY = ObjectAnimator.ofFloat(order.pay_bg, "scaleY", 0, 1)animator = ObjectAnimator.ofFloat(order.pay_bg, "alpha", 1, 1)animator1 = ObjectAnimator.ofFloat(order.pay_bg_bg, "alpha", 0, 1)set = new AnimatorSet()set.playTogether(slX, slY, animator, animator1);set.setDuration(animation_time);set.start();})
}/*** 支付页面 控件触发*/
order._intent.on("click", () => {log("跳转支付宝")try {app.startActivity({data: pay_key.url});toast("正在打开支付宝")} catch (error) {toast("没有安装支付宝")}});order._close.on("click", () => {log("点击>>>关闭")confirm("确定要关闭吗").then(value => {//当点击确定后会执行这里, value为true或false, 表示点击"确定"或"取消"if (value) {slX = ObjectAnimator.ofFloat(order.pay_bg, "scaleX", 1, 0)slY = ObjectAnimator.ofFloat(order.pay_bg, "scaleY", 1, 0)animator = ObjectAnimator.ofFloat(order.pay_bg, "alpha", 1, 1)animator1 = ObjectAnimator.ofFloat(order.pay_bg_bg, "alpha", 1, 0)set = new AnimatorSet()set.playTogether(slX, slY, animator, animator1);set.setDuration(animation_time);set.start();setTimeout(function () {load_pay = falseui.run(function () {order.pay_bg_bg.attr("clickable", false);order.pay_bg_bg.attr("visibility", "gone");})}, animation_time);}});
})order._validation.on("click", () => {log("效验结果")alert("UI示例文件,不支持支付结果效验")
})function keepTwoDecimalFull(num) {var result = parseFloat(num);if (isNaN(result)) {alert('传递参数错误,请检查!');return false;}result = Math.round(num * 100) / 100;var s_x = result.toString();var pos_decimal = s_x.indexOf('.');if (pos_decimal < 0) {pos_decimal = s_x.length;s_x += '.';}while (s_x.length <= pos_decimal + 2) {s_x += '0';}return s_x;
}function str_key(source, count) {let arr = [];for (let i = 0, len = source.length / count; i < len; i++) {let subStr = source.substr(0, count);arr.push(subStr);source = source.replace(subStr, "");}let str = ""for (i = 0; i < arr.length - 1; i++) {str += arr[i] + " "}return str + arr[arr.length - 1]
}
autojs编写的支付宝支付模板,带toast弹窗,自定义控件,界面上插入图片,功能非常强大和完善值得学习相关推荐
- Qt编写微信支付宝支付
文章目录 一 微信支付配置参数 二 支付宝支付配置参数 三 功能 四 Demo效果图 五 体验地址 一 微信支付配置参数 微信支付API,需要三个基本必填参数. 微信公众号或者小程序等的appid: ...
- android提现功能是哪的钱,支付宝支付助手的钱怎么提现?这是什么功能?
支付宝是大家常用的一款工具,基本每个人的手机里面都有下载支付宝软件,不知道大家有没有听说过支付宝助手这个工具,它的功能也非常的强大.下面了解一下支付宝助手如何提现. 支付助手显示的是消息,不能直接在支 ...
- 最新实用版——JAVA使用POI替换Word模板中指定字符,并可插入图片。
JAVA替换Word模板指定字符,并可插入图片. 在一年之前还之前有写过一篇使用jacob对word插入图片的博客.点击率蛮高8800多次,当然多亏了百度搜索引擎的帮忙
- C#的NPOI操作Eexcel模板信息(填入数据及插入图片)
@[TOC]NPOI操作已经有了参考 指路参考博客 参考博客 流程梳理 首先是对于自己模板excel的导入,因为有整体格式要求较高的excel,所以先制成模板,再向里面填充数据. IWorkbook ...
- Android Study 之 6分钟妥妥集成微信以及支付宝支付
LZ-Says:来说俩件事儿: 1.一心只为一人用,一言只为一人说~ 2.今天坐公交,末班车,车上只有司机和我,阴森森的,吓死LZ了...一路小跑!!! 前言 (浪费一分钟) 今天,不讲这个,也不讲那 ...
- php实现支付宝支付接口,PHP实现个人支付宝支付开发(二)
在前面的文章<PHP实现个人支付宝支付开发(一)>中,我们为大家简单介绍了通过第三方接口平台码支付来实现个人支付宝支付功能的交易流程. 下面我们继续结合图文,给大家介绍通过码支付实现PHP ...
- 三方支付与微信,支付宝支付有什么优势
西米支付网(www.45ri.com) 首先我们来看一下,财付通 (又称微信支付).支付宝支付 ,三方支付的相同之处与关联 (1)三方支付又称非银行清算机构,是除了银行之外能够合理合法进行收付款服务 ...
- Excel模板导出并插入图片
目录 一.先准备二维码 1.设置二维码的数据,以及生成路径,然后调用工具类方法进行生成二维码 2.二维码工具类 二.插入图片方法 1.插入二维码 2.设置图片的位置 关于这个业务问题也是客户要求才做的 ...
- ppt模板插入图片有白底怎么解决?
ppt模板插入图片有白底怎么解决?在ppt模板设计中插入图片发现有白底,图片没有填充完整怎么办呢?ppt家园就来介绍一下去掉图片白底的ppt模板制作技巧. 创新创业计划书模板通用商业计划书创业路演pp ...
最新文章
- SpringMVC启动分析
- 《适用于初学者的 Python》
- 《小账本》开发日志 第三天
- 解决 后台播放音乐时,设置手机铃声,后台音乐不会暂停
- 四川网络推广介绍搜索引擎从哪几个方面判断网站质量好坏?
- 蔡氏电路matlab程序,蔡氏电路matlab仿真报告
- 一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少...
- 算法的时间复杂度和空间复杂度的原理
- phpmyadmin在centos 7中安装
- 你的旧船票能否搭上这艘巨轮?——解读近5年大数据产业发展规划
- 《爱你就像爱生命》你好哇,陌生人
- 玩转 ESP32 + Arduino (十九) SIM800L调试(基于TTGO T-CALL)
- 微云解析源码_后续,微云直链解析源码记录
- 【前端初/中级面经】中小型公司面试时都会问些什么,VUE出境最高?
- Python 之心有猛虎,细嗅蔷薇
- 同济大学计算机其中考试时间,上海高三上学期期中考试时间一般定在几月份?...
- Android编译Lambda,Android lambda 入门教程
- 计算机基础知识(基础入门小白专属)五
- 不等式解集怎么取_不等式的解集怎么求
- win7产生大量evtx文件_Windows XML Event Log (EVTX)单条日志清除(四)——通过注入获取日志文件句柄删除当前系统单条日志记录...