|

楼主 |
发表于 2017-6-20 17:06:42
|
显示全部楼层
这是我的index.w文件的js文件- define(function(require) {
- var $ = require("jquery");
- var justep = require("$UI/system/lib/justep");
- var ShellImpl = require('$UI/system/lib/portal/shellImpl');
- var CommonUtils = require("$UI/system/components/justep/common/utils");
- require("$UI/demo/taobao/appVersionChecker");
- var Baas = justep.Baas;
- justep.Shell.custname = justep.Bind.observable();
- justep.Shell.custcode = justep.Bind.observable();
- justep.Shell.address = justep.Bind.observable();
- justep.Shell.phone = justep.Bind.observable();
- justep.Shell.FContact = justep.Bind.observable();
- justep.Shell.userName = justep.Bind.observable();
- justep.Shell.staffcode = justep.Bind.observable();
- justep.Shell.staffname = justep.Bind.observable();
- justep.Shell.departmentCode = justep.Bind.observable();
- justep.Shell.departmentname = justep.Bind.observable();
- var Model = function() {
- this.callParent();
- var shellImpl = new ShellImpl(this, {
- "contentsXid" : "pages",
- "pageMappings" : {
- "main" : {
- url : require.toUrl('./main.w')
- },
- "list" : {
- url : require.toUrl('./list.w')
- },
- "class" : {
- url : require.toUrl('./class.w')
- },
- "detail" : {
- url : require.toUrl('./detail.w')
- },
- "search" : {
- url : require.toUrl('./search.w')
- },
- "cart" : {
- url : require.toUrl('./cart.w')
- },
- "order" : {
- url : require.toUrl('./order.w')
- },
- "success" : {
- url : require.toUrl('./success.w')
- },
- "login" : {
- url : require.toUrl('./login.w')
- }
- }
- });
- //shellImpl.setIsSinglePage(true);
- shellImpl.useDefaultExitHandler = false;
- CommonUtils.attachDoubleClickExitApp(function() {
-
- var isHomePage = shellImpl.pagesComp.contents[0].innerContainer.getInnerModel().comp('contents2').getActiveIndex() == 0;
- if (shellImpl.pagesComp.getActiveIndex() === 0 && isHomePage) {
- return true;
- }
- return false;
- });
- };
- window.getSystemConfig = function(level,modelName){
- var sysConfig ={
- "OnlyShowFirstRowOfBill" : true,
- "BaasRootName":"qianfeng",
- "DataSourceName":"qianfeng",
- "LayOut_Form_FieldCount":3
- };
- return sysConfig;
- };
- window.shuiyin = function(canvasid,url,txt){//myCanvas,"/baas/justep/attachment/simpleFileStore?storeFileName=C7913D0C78B000016D1F18B01C503B20&ownerID=1&realFileName=IMG_20170615_174339.jpg&operateType=preview";
- var img = new Image();
- var previewUrl=url;//"/baas/justep/attachment/simpleFileStore?storeFileName=C7913D0C78B000016D1F18B01C503B20&ownerID=1&realFileName=IMG_20170615_174339.jpg&operateType=preview";
- img.src = previewUrl;// require.toUrl('picture.jpg');// 图片路径
- // 加载完成开始绘制
- img.onload = function() {
- // 准备canvas环境
- var canvas = document.getElementById("myCanvas");
- canvas.width = 200;
- canvas.height = 200;
- var ctx = canvas.getContext('2d');
- // 绘制图片
- ctx.drawImage(img, 0, 0, 383, 579);
- // 绘制水印
- ctx.font = "20px Georgia";
- ctx.fillStyle = "rgba(255,255,255,1)";
- // ctx.fillText("Hello World!", 10, 50);
- ctx.font = "30px Verdana";
- // 创建渐变
- var gradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
- gradient.addColorStop("0", "magenta");
- gradient.addColorStop("0.5", "blue");
- gradient.addColorStop("1.0", "red");
- // 用渐变填色
- ctx.fillStyle = gradient;
- ctx.fillText(txt, 10, 90);
- // alert(13);
- };
- };
- window.getServiceURL = function(subPath){
- var root = window.getSystemConfig(1,"").BaasRootName;
- return "/" + root + "/" + subPath;
- };
- window.getno=function(pro){
- var url =window.getServiceURL("select");
- var jsonResult = null;
- Baas.sendRequest({
- "url" : url,
- "action" : pro,
- "async" : false,
- "params" : {
- "db" : "qianfeng"
- },
- "success" : function(state) {
- jsonResult = state.state;
- },
- "error" : function(msg){
- justep.Util.hint("出错了!" + msg);
- }
- });
- return jsonResult;
- };
- Model.prototype.modelLoad = function(event){
- // justep.Shell.custname.set("请选择单位");
- // justep.Shell.custcode.set("请选择客户");
- // justep.Shell.showPage("main");
-
- justep.Shell.showPage("login");
- };
- return Model;
- });
复制代码
|
|