| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- /*****
- *
- * Assuming a HTML like
- *
- * <... id="test-app-1">
- * <... v-for="oneuser in userlist">
- * {{oneuser.id}} , name: {{oneuser.name}}
- * </...>
- *
- * </...>
- *
- */
- var test_vue_app = new Vue({
- el : "test-app-1",
- data : {
- userlist : [{id:1, name:"hello"}]
- }
- });
- /******************************************************************************
- //
- // To load directly from JS(jQuery)
- //
- /*****************************************************************************/
- function js_load_something(){
- var uid = 5; //for test.
- BasicFunction.get_data("smartUsers/list"+"?userId="+uid,
- /**
- * 下面的function是访问网络成功后的结果回调,obj 类似
- *
- * http://south.niimei.com:8866/server/smartUsers/list
- * {
- * "ret":"10000","detail":null,"field":null,"model":
- * {"page":1,"pageSize":15,"totalPage":1,"totalResult":15,
- * "list":
- * [
- * {
- * "uid":3,"usn":"cell_13520583918","pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
- * "name":"HelloWorld","title":"","priv":"view,order,deliver,pay","state":0,"sess":"iOgxGPkFIV3JxBlBfCv",
- * "phone":"13520583918","schoolDistrict":null,"userExpPts":null,"userGroup":null,"userVcoin":null,"registerTime":null,
- * "lastLoginTime":null,"wxUnionid":null,"wxEngineid":null,"wxOpenid":null,"note":null
- * },
- * {..第二条数据..},
- * {..第三条数据..}
- * ]
- * }
- * }
- * @param obj
- */
- function (obj) {
- var parsedObj = first_parse(this, obj);
- if(parsedObj != null && parsedObj != undefined) {
- test_vue_app = parsedObj.list;
- } else {
- // error
- }
- } //end of f (obj, status)
- ); // end of get_data
- }
- /******************************************************************************
- //
- // To load using DataObject + DataService + Module stuff
- //
- *****************************************************************************/
- //Module means some component (need only to draw);
- var test_vue_module = new Module("nothing", "smartUsers");
- test_vue_module.drawData = function (data) {
- test_vue_app.data.userlist.pop();
- for(let i = 0; i < data.len(); i++) {
- test_vue_app.data.userlist.push(data.getSorted(i));
- }
- } ;
- var loader = new (function(){
- /* this is the main data service that is auto-updating your data*/
- this.userListServ = new DataObjectService("smartUsers", AUTO, "?ext=1");
- // Optional for setting up self-defined interval
- // this.userListServ.autoInterval = 300;
- // this.userListServ.setUpInterval();
- /**
- * load Once, as is.
- */
- this.loadOnce = function(){
- var list = this.userListServ.list;
- test_vue_module.setData(list);
- };
- /***
- * loadOften : to auto-load some data
- */
- this.loadOften = function(){
- // Binding Intervals to DataService
- this.userListServ.bind(function (data) {
- // auto call
- test_vue_module.setData(data);
- });
- };
- })();
- //To load once
- loader.loadOnce();
- //To auto-refresh
- // loader.loadOften();
- // 上传货品信息
- /*
- BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
- console.log("------ Data Rcvd in PresentReg --------");
- console.log(response);
- if(response.ret === "10000"){
- this.$router.push('index');
- } else {
- // 注册失败的处理
- Toast.fail("上传失败,请检查网络");
- }
- }, [{"reviewId":1,"userId":1,"dormDistrict":10,
- "userSex":1,"userSchoolCard":20123333222,
- "userReviewStatus":1000,
- "reviewerId":1,"reviewerNote":"nmo",
- "reviewerNoteToUser":"noo"}]);
- 基本格式
- szuhuanhuan2018
- 登录 转义密码 就是 encodeURIComponent("实际密码")
- BasicFunction.get_data("ajaxlogin?u=手机号&p=(转义密码)", 回调函数, {})
- 验证码登录
- BasicFunction.get_data("ajaxotplogin?otp=", callback, {})
- 注册
- BasicFunction.get_data("ajaxregister?u=手机号&p=转义密码", 回调函数, {})
- 发送验证码
- BasicFunction.get_data("ajaxsendotp?u=手机号", 回调函数, {})
- 新建 (数据列表就是 [{...实际数据...}])
- BasicFunction.get_data("数据接口名称/saveBatch", 回调函数, 数据列表)
- 修改
- BasicFunction.get_data("数据接口名称/updateBatch", 回调函数, 数据列表)
- 搜索(获取)
- BasicFunction.get_data("数据接口名称/list?条件1=数据1&条件2=数据2&.....", 回调函数, {})
- 用户数据:
- smartUsers/list
- [{
- "uid":3, // 用户id
- "usn":"13520583918", // 登录用户名
- "pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
- "name":"HelloWorld", // 昵称
- "title":"",
- "priv":"view,order,deliver,pay",
- "state":0, // 状态
- "sess":"iOgxGPkFIV3JxBlBfCv",
- "phone":"13520583918", // 电话号码
- "schoolDistrict":null, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
- "userExpPts":null,
- "userGroup":null,
- "userVcoin":null,
- "registerTime":null, // 注册时间
- "lastLoginTime":null,
- "wxUnionid":null,
- "wxEngineid":null,
- "wxOpenid":null,
- "note":null
- },
- 新建货品:
- smartGoods/saveBatch
- [{
- "goodid":"", // 货品id
- "name":"萌犬毛绒抱枕", // 货品名
- "goodsNo":"A2",
- "modelId":"1",
- "ownerId":"18", // 货品所有者id
- "goodFirstKind":"1000", // 目标性别 男: 0,女: 1
- "goodSecondKind":"2000", // 标签 0~13
- "sellPrice":"0.0",
- "marketPrice":"0.0",
- "costPrice":"0.0",
- "upTime":"2018-12-10 01:01:01",
- "downTime":"2018-12-10 01:01:01",
- "createTime":"2018-12-10 01:01:01", // 货品注册时间
- "storeNums":"1",
- "img":"attachment/simple/acsac089e1nnsaxx72190dm.jpg", // 图片名
- "isDel":"0", // 是否被删除,0: 未被删 1: 被删,首页不显示
- "content":"none",
- "keywords":"none",
- "description":"绒毛玩具或填充玩具,中国大陆较常用“毛绒玩具”、香港为“毛公仔”,是...", // 货品描述
- "searchWords":"毛绒,玩具",
- "weight":"0.4",
- "point":"4",
- "unit":"10",
- "brandId":"1",
- "visit":"1",
- "favorite":"1",
- "sort":"1", // 货品状态 0: 审核中, 1: 匹配中, 2: 匹配成功, 3: 交换成功, 4: 审核失败
- "listImg":"attachment/simple/acsac089e1nnsaxx72190dm.jpg",
- "smallImg":"attachment/simple/bicno912nounx7xsg28d1nidx.jpg",
- "specArray":"{}","exp":"0"
- }]
- 新建货品审核单
- smartGoodReview/saveBatch
- [{"reviewId":"","goodId":"3","applicantId":"19","reviewerId":"0","reviewResult":"0","applyTime":"2018-12-10 01:01:01","reviewTime":"2018-12-10 01:01:01","previousReview":"0","reviewNote":"暂未审核","displayNote":"暂未审核"}]
- 新建货品池内条目(入池)
- smartGoodPool/saveBatch
- [{"poolItemId":"","goodId":"3","goodSenderId":"5","goodQuantity":"1","goodQuality":"100","goodFirstKind":"1000","reviewStatus":"1000","goodTargetRole":"1","goodTargetKind":"2","inpoolStatus":"1000"}]
- 新建评论
- smartOrderFeedback/saveBatch
- [{
- "feedbackId":"",
- "orderId":"13", // 收到的礼物的id
- "goodId":"3",
- "ratingStatus":"1000",
- "ratingMajor":"5", // 评分
- "ratingMinor":"4500",
- "content":"还不错,5颗星", // 评论内容
- "ratingTime":"2018-12-10 01:01:01"
- }]
- 新建用户身份审核单(校园卡审核)
- smartIdentity/saveBatch
- [{
- "reviewId":"",
- "userId":18, // 用户id
- "dormDistrict":1, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
- "userSex":1, // 用户性别
- "userSchoolCard":20123333222,
- "userReviewStatus":1000,
- "reviewerId":1,
- "reviewerNote":"nmo",
- "reviewerNoteToUser":"noo"
- }]
- 新建订单(配对成功)
- *** 前端不用操作 ***
- smartOrder/saveBatch
- [{"id":"","userId":"18","paymentId":"0","deliveryId":"0","merchandise":"{}","status":"1","payStatus":"0","distributionStatus":"0","dueAmount":"0.0","paidAmount":"0.0","taxes":"0","payableFreight":"0","realFreight":"0","payFee":"0","promotions":"0","discount":"1","orderAmount":"0","payTime":"2018-12-10 01:01:01","sendTime":"","createTime":"","completionTime":"","acceptTime":"","invoice":"0","invoiceTitle":"","postscript":"","note":"内部匹配","prop":"{}","exp":"0","point":"0","type":"0"}]
- 统计用(用户点击信息,页面位置+页面按钮/区域代码=clickEvent)
- [{"clickId":"","clickEvent":"100001","clickTime":"1544443423082","clickIdentity":"18"}]
- ****************
- ***** 查找:*****
- ****************
- 查找已经准备接收的礼物
- smartOrder/list
- [{"id":28,"userId":3,"paymentId":0,"deliveryId":0,"merchandise":"[{\"q\":1,\"model\":1,\"id\":\"3\",\"spec\":[{\"v\":\"100\",\"i\":1002}]},{\"q\":1,\"model\":1,\"id\":\"6\",\"spec\":[{\"v\":\"350\",\"i\":1002}]}]","status":2,"payStatus":2,"distributionStatus":0,"dueAmount":25.11,"paidAmount":0.0,"taxes":0.0,"payableFreight":0.0,"realFreight":0.0,"payFee":0.0,"promotions":0.49,"discount":1.0,"orderAmount":25.6,"payTime":"2017-12-23 10:38:20","sendTime":"2017-12-23 10:38:20","createTime":"2017-12-23 10:38:20","completionTime":"2017-12-23 10:38:20","acceptTime":"0","invoice":0,"invoiceTitle":"empty","postscript":"","note":"","prop":"{\"wechat\":1}","exp":0,"point":0,"type":1}]
- *************
- * // 第一阶段: 上传文件到fileServerURL
- function fileServerDeal(lst, fileServerURL, lstId) {
- uploadParams.uploadURI = fileServerURL;
- var formData = new FormData();
- upload_status_report("正在上传 - 第"+(lstId+1)+"个文件", (lstId + 1) +" / "+ lst.length);
- formData.append('file', $('#fileInput_'+lst[lstId])[0].files[0]);
- $.ajax({
- url: fileServerURL,
- type: 'POST',
- cache: false,
- data: formData,
- processData: false,
- contentType: false,
- now_list_id: lstId,
- now_lst:lst
- }).always(fileServerRet);
- }
- BasicFunction.getSigned(['checkJsApi', '...', '...'], function(){
- wx.ready(.......);
- });
- */
|