微信商城小程序WeiMall

在线微信小程序可视化开发工具代码生成器:http://www.diygw.com

针对小程序特性,提供了商城跟PHP后台进行交互的解决方案,帮助用户高效完成小程序开发,项目持续更新中...。

源码地址:http://git.oschina.net/html580/weimall

项目说明:

微信小程序:实现一个移动端小商城,项目持续更新中...

使用技术:Weui.wxss 、 ES6

目录结构:

weimall/
  |-assets/
     |- images/
     |- plugins/
     |- styles/
     |- ...
  |-etc/
     |- config.js
     |- ...
  |-helpers/
     |- HttpResource.js
     |- HttpService.js
     |- ServiceBase.js
     |- Tools.js
     |- WxResource.js
     |- WxService.js
     |- WxValidate.js
     |- ...
  |-pages/
      |- start
        |- index.js
        |- index.json
        |- index.wxml
        |- index.wxss
      |- ...
  |-app.js
  |-app.json
  |-app.wxss
  |-...
  • assets — 存放静态文件,例如:images、styles、plugins
  • etc — 存放配置文件,例如:config.js
  • helpers — 存放帮助文件,例如:Promise 微信原生API、Promise wx.request、RESTful http client、Form validation
  • pages — 存放项目页面相关文件
  • app.js — 小程序逻辑
  • app.json — 小程序公共设置
  • app.wxss — 小程序公共样式表

增删改查

import ServiceBase from 'ServiceBase'

class Service extends ServiceBase {
    constructor() {
        super()
        this.$$prefix = ''
        this.$$path = {
      wechatSignUp: '/index/wechatSignUp',
      wechatSignIn: '/index/wechatSignIn',
      decryptData: '/index/decryptData',
      signIn: '/index/signIn',
      signOut: '/index/signOut',
      data:'/index/data',
      detail: '/index/detail',
      add: '/index/add', 
      del: '/index/del', 
      update: '/index/update'
    }
    }

    wechatSignUp(params) {
        return this.postRequest(this.$$path.wechatSignUp, params)
    }

    wechatSignIn(params) {
        return this.postRequest(this.$$path.wechatSignIn, params)
    }

    wechatDecryptData(params) {
        return this.postRequest(this.$$path.decryptData, params)
    }


    signIn(params) {
        return this.postRequest(this.$$path.signIn, params) 
    }

    signOut() {
        return this.postRequest(this.$$path.signOut) 
    }

  //获取表格分页数据
  getData(params) {
    return this.getRequest(this.$$path.data, params)
  }

  //获取单条数据
  getDetail(params) {
    return this.getRequest(this.$$path.detail, params)
  }

  //新增数据
  addData(params){
    return this.postRequest(this.$$path.add, params)
  }

  //删除数据
  delData(params) {
    return this.getRequest(this.$$path.del, params)
  }

  //更新数据
  updateData(params) {
    return this.getRequest(this.$$path.update, params)
  }

}

export default Service
     //调用数据
      App.HttpService.getData({
          table:'banner',
          page:1
      }).then(data=>{
        if(data.code==0){
          data.data.forEach(n => n.path = App.renderImage(n.img));
          this.setData({
            images: data.data
          });
        }else{
          this.showModal(data.message);
        }
      });

    //新增数据
    App.HttpService.addData(params).then(data => {
      if (data.code == 0) {
        this.showToast(data.message)
      }
    }); 

   //更新数据
    App.HttpService.updateData(params).then(data => {
      if (data.code == 0) {
        this.showToast(data.message);
      }
    });

  //删除数据
    App.WxService.showModal({
      title: '友情提示',
      content: '确定要删除这个地址吗?',
    })
      .then(data => {
        if (data.confirm == 1) {
          App.HttpService.delData({
            table: 'address',
            id: id
          }).then(() => App.WxService.navigateBack());
        }
      })

Form validation

 bindsubmit="submitForm">  class="weui-cells">  class="weui-cell weui-cell_input">  class="weui-cell__hd">  class="weui-label">姓名   class="weui-cell__bd">  name="name" value="{{ form.name }}" class="weui-input" type="text" placeholder="请输入姓名" />    class="weui-cell weui-cell_input">  class="weui-cell__hd">  class="weui-label">邮箱   class="weui-cell__bd">  name="email" value="{{ form.email }}" class="weui-input" type="text" placeholder="请输入邮箱" />     class="button-sp-area">  class="weui-btn" type="primary" formType="submit">确定   
import WxValidate from 'helpers/WxValidate' Page({ data: { form: { name : '', email: '', }, }, onLoad() { this.WxValidate = new WxValidate({ name: { required: true, minlength: 2, maxlength: 10, }, email: { required: true, email: true, }, }, { name: { required: '请输入姓名', }, email: { required: '请输入邮箱', email: '请输入有效的电子邮件地址', }, }) }, submitForm(e) { const params = e.detail.value if (!this.WxValidate.checkForm(e)) { const error = this.WxValidate.errorList console.log(error) return false } }, }) 

项目截图:

微信小程序商城解决方案 微信小程序商城解决方案 微信小程序商城解决方案 微信小程序商城解决方案 微信小程序商城解决方案 微信小程序商城解决方案

分享精神

非常感谢您的支持!如果您喜欢WeiMall,请将它介绍给自己的朋友,或者帮助他人安装一个DiyGw,又或者写一篇赞扬我们的文章。WeiMall是对ThinkPHP的传承和新的传奇。由GiyGw.com开发团队完成开发。
vs 2017 git成功 miyao 亲测可行 1.注册 ssh key 本地方生成 复制到远端 2. 远端建立仓库 3.在 网站上点击sourcetree 会自动打开本地sourcetree 。 本地先安装 好sourcetree ,并注册一下 4.sourcetree拉取远端文件 5.在vs中打开 自动可以操作了 在线购物商城微信小程序前端和后台源码 源码描述: 一、源码特点 在线购物商城微信小程序前端和后台数据管理系统源码,使用.net开发,测试无Bug,感兴趣的欢迎下载 二、微信小程序功能 1、 会员自动授权登录注册 2、 产品分类、产品检索、产品筛选、产品详情、 3、 广告展示、 4、 购物车 6、 收货地址 7、 订单提交微信支付 8、 订单检索等功能 三、后台功能 1、 后台会员系统:会员列表、会员基本信息,积分明细、余额明细、购物记录、收货地址(在系统设置的频道管理可以开启此功能) 2、 后台系统设置:导航栏目、分类管理、 OAuth设置 、支付设置、扩展字段 、频道管理、模型管理、站点基本信息等功能设置 3、 订单管理:在线购物订单查看、发货、确认 4、 产品管理:分类管理 、产品管理 、 积分产品管理 四、注意事项 1、开发环境为Visual Studio 2010,数据库为SQLServer2008,使用.net 4.0开发。 2、管理员登陆名:admin 密码:admin888 3、默认数据库连接字符串在webconfig配置文件中修改 4、DB文件夹中是数据库脚本文件,使用sqlerver工具运行即可 5、cmsWeb文件夹里面是api接口后台 xcx文件夹是微信小程序 DataBase文件夹是数据库文件
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值