前段时间跟朋友一起搞了一个预约的项目,前端用的APICloud的AVM框架做的,后端用的php开发的,用的tp5框架,没几天就搞出来了。简单跟大家分享一下开发中的一些功能点的实现吧。也欢迎大家一起探讨。

一、整理项目脑图

二、项目原型图

原型是用的码前做的,大家可以通过​​www.devbefore.com/protomobile/47942983009476608​​查看

三、项目前端

本项目中前端采用APICloud AVM多端开发技术进行开发,要点包括 swiper 轮播图、网络请求封装等。使用 APICloud 多端技术进行开发,实现一套代码多端运行,支持编译成 Android & iOS App 以及微信小程序。

1、APICloud使用步骤:

(1)下载 APICloud Studio 3 作为开发工具。下载地址:​​​www.apicloud.com/studio3​​​

(2)注册账号后在控制台创建app,控制台地址:​​www.apicloud.com/console​​

(3)设置证书,一键创建安卓证书

(4)APICloud Studio3 拉取代码,点击项目,导出云端检出

检出

检出后工作目录

(5)修改或者提交项目源码,并为当前项目云编译自定义 Loader 进行真机同步调试预览。

使用 AppLoader 进行真机同步调试预览,后台自动以loader下载到手机端,安装后,点击小圆圈,输入ip地址:192.168.2.152 端口:10916,连接后真机同步,可以看到刚创建后的结果。

2、AVM框架的使用

为什么选择AVM?

  • 易用:有 Vue、React 基础,可快速上手,配套专用的开发工具APICloud Studio3。
  • 多端:一次开发,多端渲染,一个技术栈搞定移动端开发。
  • 功能 API 丰富:提供 1千+ 模块和 2万+ API 可直接调用,面向行业和场景无限制)

(1)UI

官方文档:​​https://docs.apicloud.com/apicloud3/#/component/view?index=4&subIndex=0​​

原来有一个叫流浪男的做的AUI框架,还不错,后来就是用一些简单的大公司的框架,这个看自己了。好多UI都是自己设计,自己写一些UI。字体图标用的阿里字体图标。CSS框架,要是没啥选择推荐可以用AUI,这个框架有CSS基础的一看就知道写的啥,而且特别好修改。实在不行了直接改源码。

APICloud官网组装了一套vant的,​​https://docs.apicloud.com/Client-API/AVM-Components/readme.md​​

(2)ajax网络交互

// 表单方式提交数据或文件

// 表单方式提交数据或文件
api.ajax({url: 'http://192.168.1.101:3101/upLoad',method: 'post',data: {values: {name: 'haha'},files: {file: 'fs://a.gif'}}
}, function(ret, err) {if (ret) {api.alert({ msg: JSON.stringify(ret) });} else {api.alert({ msg: JSON.stringify(err) });}
});// 提交JSON数据
api.ajax({url: 'http://192.168.1.101:3101/upLoad',method: 'post',headers: {'Content-Type': 'application/json;charset=utf-8'},data: {body: {name: 'haha'}}
}, function(ret, err) {if (ret) {api.alert({ msg: JSON.stringify(ret) });} else {api.alert({ msg: JSON.stringify(err) });}
});

(3)vue指令使用(v-for v-show v-if v-else v-for v-on v-bind v-model等)

1>数据绑定

使用 Mustache 语法:

<text text={{msg}}></text>

使用v-bind指令:

<text v-bind:text="msg"></text>

2>事件绑定

<template><text onclick="doThis('avm');">Click me!</text>
</template>
<script>export default {name: 'test',methods: {doThis(msg){api.alert({msg: msg});}}}
</script>

(4)注册、登录

1>注册接口链接:​​http://showdoc.deui.cn/web/#/27?page_id=365​​

注册代码

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><!-- <text class="header__title">APICloud</text> --></safe-area><scroll-view class="main"><view><image src="https://baodinglingqian.oss-cn-beijing.aliyuncs.com/1.png" class="touxiang " /></view><div class="zhanghao"><input placeholder="请输入账号" v-model="zhanghao" maxlength="10" autofocus /></div><div class="mima"><input type="password" placeholder="请输入密码" v-model="password" /></div><text class="zhuce" @click="reg()">注册</text><text class="denglu" @click="handleClick()">登录</text></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
export default {name: "tpl",apiready() {api.setStatusBarStyle({style: "light",color: "-"});},data() {return {zhanghao: '',password: '',src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"};},computed: {},methods: {handleClick(e) {api.openWin({name: 'main',url: './main.stml',pageParam: {name: 'test'}});},reg() {var _this = this;// 提交JSON数据api.ajax({url: 'http://yy.deui.cn/api.php/index/re',method: 'get',// headers: {//  'Content-Type': 'application/json;charset=utf-8'// },data: {body: {username: _this.zhanghao,password: _this.password}}}, function (ret, err) {console.log(JSON.stringify(ret))if (ret.msg == '返回成功') {api.toast({msg: '注册成功',location: "middle"});} else {api.alert({ msg: JSON.stringify(err) });}});}}
};
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 15px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
</style>

2>登录接口链接:​​http://showdoc.deui.cn/web/#/27?page_id=364​​

登录代码

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><!-- <text class="header__title">APICloud</text> --></safe-area><scroll-view class="main"><view><image src="https://baodinglingqian.oss-cn-beijing.aliyuncs.com/1.png" class="touxiang " /></view><div class="zhanghao"><input placeholder="请输入账号" v-model="zhanghao" maxlength="10" autofocus /></div><div class="mima"><input type="password" placeholder="请输入mima" v-model="password" /></div><text class="zhuce" @click="login()">登录</text><text class="denglu" @click="handleClick()">注册</text></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
export default {name: "tpl",apiready() {api.setStatusBarStyle({style: "light",color: "-"});var value = localStorage.getItem('uid');api.openWin({name: 'home',url: './home.stml'});},data() {return {zhanghao: '',password: '',src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"};},computed: {},methods: {handleClick(e) {api.openWin({name: 'region',url: './region.stml',pageParam: {name: 'test'}});// api.toast({//  msg: this.data.text,//  location: "middle"// });},login() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/login',method: 'get',// headers: {//  'Content-Type': 'application/json;charset=utf-8'// },data: {body: {username: _this.zhanghao,password: _this.password}}}, function (ret, err) {console.log(JSON.stringify(ret))localStorage.setItem('uid', ret.data.data[0]['id']);if (ret.msg == '返回成功') {api.toast({msg: '登录成功',location: "middle"});api.openWin({name: 'home',url: './home.stml'});} else {api.alert({ msg: JSON.stringify(err) });}});}}
};
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 15px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
</style>

(5)首页轮播图

轮播图链接:​​http://showdoc.deui.cn/web/#/27?page_id=366​​

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><text class="header__title">首页</text></safe-area><scroll-view class="main" scroll-y><swiper class="swiper" id="customSwiper" autoplay circular indicator-dots indicator-color="#ddd"indicator-active-color="#f0f"><swiper-item class="swiper-item" v-for="(_item,_index) in bannerlist"><!-- <text class="desc">{_item.image}</text> --><image mode="scaleToFill" src={_item.image}></image></swiper-item></swiper><div><a-cell-group><a-cell v-bind:title="_item.name" v-bind:value="_item.content" v-bind:label="_item.address"arrow-direction="right" @click="godetial(_item)" v-for="(_item,_index) in shangjialist" /><!-- <a-cell title="单元格" value="内容" label="描述信息" /> --></a-cell-group></div></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
import ACellGroup from "../../components/act/a-cell-group";
import ACell from "../../components/act/a-cell";
export default {name: 'test',data() {return {shangjialist: [],bannerlist: [],current: 0,src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"}},methods: {apiready() {this.banner()this.allstores()// var customSwiper = document.getElementById('customSwiper');// customSwiper.load({//  data: this.data.dataList// });},onchange(e) {this.data.current = e.detail.current;},godetial(item) {console.log(JSON.stringify(item))api.openWin({name: 'detial',url: './detial.stml',pageParam: {id: item.id}});},banner() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/banner',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {_this.data.bannerlist = ret.data.data// var customSwiper = document.getElementById('customSwiper');// customSwiper.load({//  data: _this.data.bannerlist// });// console.log(JSON.stringify(_this.bannerlist))} else {api.alert({ msg: JSON.stringify(err) });}});},allstores() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/stores',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.data))console.log(1)var obj = ret.data.datafor (let index = 0; index < obj.length; index++) {const element = obj[index];element['content'] = element['content'].substring(0, 9) + '...'}console.log(JSON.stringify(obj))_this.data.shangjialist = obj} else {api.alert({ msg: JSON.stringify(err) });}});}}
}
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 0px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
.main {width: 100%;height: 100%;
}
.swiper {width: 100%;height: 190px;/* background-color: blue; */
}
.swiper-item {justify-content: center;
}
.title {padding: 10px 0;font-size: 20px;
}
.desc {width: 100%;text-align: center;
}
.container {width: 100%;height: 200px;
}
.indicator {flex-direction: row;justify-content: center;position: absolute;width: 100%;height: 20px;bottom: 8px;
}
.indicator-item {width: 15px;height: 8px;margin: 3px;
}
.indicator-item-normal {background-color: #ddd;
}
.indicator-item-active {background-color: red;
}
</style>

(6)首页列表

所有店铺链接:​​http://showdoc.deui.cn/web/#/27?page_id=369​​

上面的5的代码里面含有了。

<a-cell-group><a-cell v-bind:title="_item.name" v-bind:value="_item.content" v-bind:label="_item.address" arrow-direction="right" @click="godetial(_item)" v-for="(_item,_index) in shangjialist" />
</a-cell-group>shangjialist: [],
allstores() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/stores',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.data))console.log(1)var obj = ret.data.datafor (let index = 0; index < obj.length; index++) {const element = obj[index];element['content'] = element['content'].substring(0, 9) + '...'}console.log(JSON.stringify(obj))_this.data.shangjialist = obj} else {api.alert({ msg: JSON.stringify(err) });}});}

(7)页面传参获取详情

api.openWin({name: 'detial',url: './detial.stml',pageParam: {id: 123}});apiready() {//like createdif (api.pageParam.id) {this.data.id = api.pageParam.id}console.log(this.data.id)}

店铺详情:​​http://showdoc.deui.cn/web/#/27?page_id=370​​

<template><view class="page"><view><a-nav-bar v-bind:title="title" left-text="返回" left-arrow @click-left="onClickLeft"@click-right="onClickRight" /></view><view><a-cell-group><a-cell title="名称"  v-bind:value="store.name" /><a-cell title="电话"  v-bind:value="store.phone" /><a-cell title="城市"  v-bind:value="store.city" /><a-cell title="地址"  v-bind:value="store.address" /><a-cell title="内容"  v-bind:value="store.content" /></a-cell-group><!-- <text text={{store.name}}></text><text text={{store.city}}></text><text text={{store.content}}></text><text text={{store.address}}></text><text text={{store.phone}}></text> --></view><view><a-button type="success">产品</a-button></view><view><a-cell-group><a-cell  v-bind:title="_item.name"  v-bind:value="_item.content" label="点击可预约" v-for="(_item,_index) in product" @click="yuyuproduct(_item)" /></a-cell-group></view></view>
</template>
<script>
import ACellGroup from "../../components/act/a-cell-group";
import ACell from "../../components/act/a-cell";
import ANavBar from "../../components/act/a-nav-bar";
import AButton from "../../components/act/a-button";
export default {name: 'detial',apiready() {//like createdif (api.pageParam.id) {this.data.id = api.pageParam.id}console.log(this.data.id)this.init()},data() {return {title: "详情",id: 1,store: {},product:[]}},methods: {init() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/searchstore',method: 'get',data: {body: {id: _this.data.id}}}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.product))console.log(1)_this.data.store = ret.data.data[0]_this.data.product = ret.data.product} else {api.alert({ msg: JSON.stringify(err) });}});},yuyuproduct(_item){console.log(JSON.stringify(_item))},onClickLeft() {api.closeWin();},onClickRight() {}}
}
</script>
<style>
.page {height: 100%;
}
</style>

(8)导航栏组件

import ANavBar from “…/…/components/act/a-nav-bar”;

<a-nav-bar v-bind:title=“title” left-text=“返回” left-arrow @click-left=“onClickLeft”

@click-right=“onClickRight” />

注意:导航栏组件的使用,文档中的引用

import ACell from"…/…/components/act/a-nav-bar.stml";

使用中建议去掉stml后缀,import ACell from"…/…/components/act/a-nav-bar";

(9)localStorage 对象使用

main.stml里面的这个,就是用的这个对象

localStorage.setItem('uid', ret.data.data[0]['id']);

下面是localStorage的用法

// 设置存储.
sessionStorage.setItem('key', 'value');// 获取存储.
var value = sessionStorage.getItem('key');// 移除存储
sessionStorage.removeItem('key');// 清除所有存储项
sessionStorage.clear();// 获取已有存储项数
var length = sessionStorage.length;// 根据存储项索引获取存储键名
var keyName = sessionStorage.key(index);

(10)APICloud组件、模块的使用

模块中添加模块,如果是H5的需要下载后,放到自己的代码中;如果是原生的模块,需要添加到自己应用中,去require去使用。网上有专门介绍这块的教程,不清楚的可以去搜搜。

四、项目后台

这块是自己写的php后台,用的tp5框架。

tp5下的fastadmin框架,可以根据fastadmin一键生成简单后台,数据库文件为:

后台接口代码

<?phpnamespace app\api\controller;use app\common\controller\Api;
use think\Db;
/*** 首页接口*/
class Index extends Api
{protected $noNeedLogin = ['*'];protected $noNeedRight = ['*'];/*** 首页**/public function index(){$this->success('请求成功');}//注册public function re(){$username = $this->request->request("username");$password = md5($this->request->request("password"));$sql = " INSERT INTO `yuyuuser` (`id`, `group_id`, `username`, `nickname`, `password`, `salt`, `email`, `mobile`, `avatar`, `level`, `gender`, `birthday`, `bio`, `money`, `score`, `successions`, `maxsuccessions`, `prevtime`, `logintime`, `loginip`, `loginfailure`, `joinip`, `jointime`, `createtime`, `updatetime`, `token`, `status`, `verification`) VALUES (NULL, '0', '', '".$username ."', '".$password."', '', '', '', '', '0', '0', NULL, '', '0.00', '0', '1', '1', NULL, NULL, '', '0', '', NULL, NULL, NULL, '', '', '')";$rst = Db::query($sql);$data =1;$this->success('返回成功', ['data' =>  $data]);}//登录public function login(){$username = $this->request->request("username");$password = md5($this->request->request("password"));$sql = "SELECT  nickname,id FROM yuyuuser where nickname='".$username."' and password='".$password."' order by id DESC LIMIT 1";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//获取轮播图public function banner(){$sql = "SELECT * FROM `yuyubanner`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//获取网络协议public function xieyi(){$sql = "SELECT * FROM `yuyuxieyi`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//所有类型public function leixing(){$sql = " SELECT * FROM `yuyutype`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//所有店面public function stores(){$sql = "    SELECT * FROM `yuyustore`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//店铺信息public function searchstore(){$id = $this->request->request("id");$sql = " SELECT * FROM `yuyustore` where id = ".$id;$sql1 = "SELECT * FROM `yuyuproduct` where store_id = ".$id;$rst = Db::query($sql);$rst1 = Db::query($sql1);$this->success('返回成功', ['data' =>  $rst,'product'=>$rst1]);}
}

前段时间跟朋友一起搞了一个预约的项目,前端用的APICloud的AVM框架做的,后端用的php开发的,用的tp5框架,没几天就搞出来了。简单跟大家分享一下开发中的一些功能点的实现吧。也欢迎大家一起探讨。

一、整理项目脑图

二、项目原型图

原型是用的码前做的,大家可以通过​​www.devbefore.com/protomobile/47942983009476608​​查看

三、项目前端

本项目中前端采用APICloud AVM多端开发技术进行开发,要点包括 swiper 轮播图、网络请求封装等。使用 APICloud 多端技术进行开发,实现一套代码多端运行,支持编译成 Android & iOS App 以及微信小程序。

1、APICloud使用步骤:

(1)下载 APICloud Studio 3 作为开发工具。下载地址:​​​www.apicloud.com/studio3​​​

(2)注册账号后在控制台创建app,控制台地址:​​www.apicloud.com/console​​

(3)设置证书,一键创建安卓证书

(4)APICloud Studio3 拉取代码,点击项目,导出云端检出

检出

检出后工作目录

(5)修改或者提交项目源码,并为当前项目云编译自定义 Loader 进行真机同步调试预览。

使用 AppLoader 进行真机同步调试预览,后台自动以loader下载到手机端,安装后,点击小圆圈,输入ip地址:192.168.2.152 端口:10916,连接后真机同步,可以看到刚创建后的结果。

2、AVM框架的使用

为什么选择AVM?

  • 易用:有 Vue、React 基础,可快速上手,配套专用的开发工具APICloud Studio3。
  • 多端:一次开发,多端渲染,一个技术栈搞定移动端开发。
  • 功能 API 丰富:提供 1千+ 模块和 2万+ API 可直接调用,面向行业和场景无限制)

(1)UI

官方文档:​​https://docs.apicloud.com/apicloud3/#/component/view?index=4&subIndex=0​​

原来有一个叫流浪男的做的AUI框架,还不错,后来就是用一些简单的大公司的框架,这个看自己了。好多UI都是自己设计,自己写一些UI。字体图标用的阿里字体图标。CSS框架,要是没啥选择推荐可以用AUI,这个框架有CSS基础的一看就知道写的啥,而且特别好修改。实在不行了直接改源码。

APICloud官网组装了一套vant的,​​https://docs.apicloud.com/Client-API/AVM-Components/readme.md​​

(2)ajax网络交互

// 表单方式提交数据或文件

// 表单方式提交数据或文件
api.ajax({url: 'http://192.168.1.101:3101/upLoad',method: 'post',data: {values: {name: 'haha'},files: {file: 'fs://a.gif'}}
}, function(ret, err) {if (ret) {api.alert({ msg: JSON.stringify(ret) });} else {api.alert({ msg: JSON.stringify(err) });}
});// 提交JSON数据
api.ajax({url: 'http://192.168.1.101:3101/upLoad',method: 'post',headers: {'Content-Type': 'application/json;charset=utf-8'},data: {body: {name: 'haha'}}
}, function(ret, err) {if (ret) {api.alert({ msg: JSON.stringify(ret) });} else {api.alert({ msg: JSON.stringify(err) });}
});

(3)vue指令使用(v-for v-show v-if v-else v-for v-on v-bind v-model等)

1>数据绑定

使用 Mustache 语法:

<text text={{msg}}></text>

使用v-bind指令:

<text v-bind:text="msg"></text>

2>事件绑定

<template><text onclick="doThis('avm');">Click me!</text>
</template>
<script>export default {name: 'test',methods: {doThis(msg){api.alert({msg: msg});}}}
</script>

(4)注册、登录

1>注册接口链接:​​http://showdoc.deui.cn/web/#/27?page_id=365​​

注册代码

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><!-- <text class="header__title">APICloud</text> --></safe-area><scroll-view class="main"><view><image src="https://baodinglingqian.oss-cn-beijing.aliyuncs.com/1.png" class="touxiang " /></view><div class="zhanghao"><input placeholder="请输入账号" v-model="zhanghao" maxlength="10" autofocus /></div><div class="mima"><input type="password" placeholder="请输入密码" v-model="password" /></div><text class="zhuce" @click="reg()">注册</text><text class="denglu" @click="handleClick()">登录</text></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
export default {name: "tpl",apiready() {api.setStatusBarStyle({style: "light",color: "-"});},data() {return {zhanghao: '',password: '',src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"};},computed: {},methods: {handleClick(e) {api.openWin({name: 'main',url: './main.stml',pageParam: {name: 'test'}});},reg() {var _this = this;// 提交JSON数据api.ajax({url: 'http://yy.deui.cn/api.php/index/re',method: 'get',// headers: {//  'Content-Type': 'application/json;charset=utf-8'// },data: {body: {username: _this.zhanghao,password: _this.password}}}, function (ret, err) {console.log(JSON.stringify(ret))if (ret.msg == '返回成功') {api.toast({msg: '注册成功',location: "middle"});} else {api.alert({ msg: JSON.stringify(err) });}});}}
};
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 15px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
</style>

2>登录接口链接:​​http://showdoc.deui.cn/web/#/27?page_id=364​​

登录代码

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><!-- <text class="header__title">APICloud</text> --></safe-area><scroll-view class="main"><view><image src="https://baodinglingqian.oss-cn-beijing.aliyuncs.com/1.png" class="touxiang " /></view><div class="zhanghao"><input placeholder="请输入账号" v-model="zhanghao" maxlength="10" autofocus /></div><div class="mima"><input type="password" placeholder="请输入mima" v-model="password" /></div><text class="zhuce" @click="login()">登录</text><text class="denglu" @click="handleClick()">注册</text></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
export default {name: "tpl",apiready() {api.setStatusBarStyle({style: "light",color: "-"});var value = localStorage.getItem('uid');api.openWin({name: 'home',url: './home.stml'});},data() {return {zhanghao: '',password: '',src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"};},computed: {},methods: {handleClick(e) {api.openWin({name: 'region',url: './region.stml',pageParam: {name: 'test'}});// api.toast({//  msg: this.data.text,//  location: "middle"// });},login() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/login',method: 'get',// headers: {//  'Content-Type': 'application/json;charset=utf-8'// },data: {body: {username: _this.zhanghao,password: _this.password}}}, function (ret, err) {console.log(JSON.stringify(ret))localStorage.setItem('uid', ret.data.data[0]['id']);if (ret.msg == '返回成功') {api.toast({msg: '登录成功',location: "middle"});api.openWin({name: 'home',url: './home.stml'});} else {api.alert({ msg: JSON.stringify(err) });}});}}
};
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 15px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
</style>

(5)首页轮播图

轮播图链接:​​http://showdoc.deui.cn/web/#/27?page_id=366​​

<template name='tpl'><view class="page"><div class="page1"><safe-area class="header"><text class="header__title">首页</text></safe-area><scroll-view class="main" scroll-y><swiper class="swiper" id="customSwiper" autoplay circular indicator-dots indicator-color="#ddd"indicator-active-color="#f0f"><swiper-item class="swiper-item" v-for="(_item,_index) in bannerlist"><!-- <text class="desc">{_item.image}</text> --><image mode="scaleToFill" src={_item.image}></image></swiper-item></swiper><div><a-cell-group><a-cell v-bind:title="_item.name" v-bind:value="_item.content" v-bind:label="_item.address"arrow-direction="right" @click="godetial(_item)" v-for="(_item,_index) in shangjialist" /><!-- <a-cell title="单元格" value="内容" label="描述信息" /> --></a-cell-group></div></scroll-view></div><image class="originImage" mode="scaleToFill" src={src}></image></view>
</template>
<script>
import ACellGroup from "../../components/act/a-cell-group";
import ACell from "../../components/act/a-cell";
export default {name: 'test',data() {return {shangjialist: [],bannerlist: [],current: 0,src: "https://baodinglingqian.oss-cn-beijing.aliyuncs.com/bg.png"}},methods: {apiready() {this.banner()this.allstores()// var customSwiper = document.getElementById('customSwiper');// customSwiper.load({//  data: this.data.dataList// });},onchange(e) {this.data.current = e.detail.current;},godetial(item) {console.log(JSON.stringify(item))api.openWin({name: 'detial',url: './detial.stml',pageParam: {id: item.id}});},banner() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/banner',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {_this.data.bannerlist = ret.data.data// var customSwiper = document.getElementById('customSwiper');// customSwiper.load({//  data: _this.data.bannerlist// });// console.log(JSON.stringify(_this.bannerlist))} else {api.alert({ msg: JSON.stringify(err) });}});},allstores() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/stores',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.data))console.log(1)var obj = ret.data.datafor (let index = 0; index < obj.length; index++) {const element = obj[index];element['content'] = element['content'].substring(0, 9) + '...'}console.log(JSON.stringify(obj))_this.data.shangjialist = obj} else {api.alert({ msg: JSON.stringify(err) });}});}}
}
</script>
<style>
.denglu {margin-top: 10px;font-size: 14px;
}
.touxiang {margin-top: 10%;width: 150px;height: 150px;border-radius: 100px;margin: 0 auto;
}
html {width: 100%;height: 100%;
}
body {width: 100%;height: 100%;
}
.originImage {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 1;
}
.page {/* position:fixed; */position: relative;z-index: 9;width: 100%;height: 100%;
}
.page1 {position: absolute;top: 0px;left: 0px;right: 0px;bottom: 0px;z-index: 2;
}
input {padding-left: 10px;line-height: 35px;height: 35px;border-radius: 5px;
}
.zhanghao {display: block;margin: 0 auto;margin-top: 15%;margin-bottom: 15px;height: 60px;
}
.mima {display: block;margin: 0 auto;margin-top: 25px;
}
.zhuce {width: 100%;height: 35px;line-height: 35px;background-color: coral;text-align: center;color: #fff;margin-top: 25px;
}
.page {height: 100%;background-color: white;
}
.header {background: #81a9c3;justify-content: center;align-items: center;
}
.header__title {color: #fff;font-size: 18px;font-weight: bold;height: 50px;line-height: 50px;
}.main {flex: 1;padding: 0px;
}.h1 {font-size: 24px;
}.item {flex-direction: row;padding: 10px 0;
}
.item__text {color: #333;white-space: nowrap;
}.item__value {margin-left: 5px;
}.footer {background: #81a9c3;flex-direction: row;justify-content: center;align-items: center;
}.footer__text {color: #fff;font-size: 14px;height: 30px;line-height: 30px;
}
.main {width: 100%;height: 100%;
}
.swiper {width: 100%;height: 190px;/* background-color: blue; */
}
.swiper-item {justify-content: center;
}
.title {padding: 10px 0;font-size: 20px;
}
.desc {width: 100%;text-align: center;
}
.container {width: 100%;height: 200px;
}
.indicator {flex-direction: row;justify-content: center;position: absolute;width: 100%;height: 20px;bottom: 8px;
}
.indicator-item {width: 15px;height: 8px;margin: 3px;
}
.indicator-item-normal {background-color: #ddd;
}
.indicator-item-active {background-color: red;
}
</style>

(6)首页列表

所有店铺链接:​​http://showdoc.deui.cn/web/#/27?page_id=369​​

上面的5的代码里面含有了。

<a-cell-group><a-cell v-bind:title="_item.name" v-bind:value="_item.content" v-bind:label="_item.address" arrow-direction="right" @click="godetial(_item)" v-for="(_item,_index) in shangjialist" />
</a-cell-group>shangjialist: [],
allstores() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/stores',method: 'get',}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.data))console.log(1)var obj = ret.data.datafor (let index = 0; index < obj.length; index++) {const element = obj[index];element['content'] = element['content'].substring(0, 9) + '...'}console.log(JSON.stringify(obj))_this.data.shangjialist = obj} else {api.alert({ msg: JSON.stringify(err) });}});}

(7)页面传参获取详情

api.openWin({name: 'detial',url: './detial.stml',pageParam: {id: 123}});apiready() {//like createdif (api.pageParam.id) {this.data.id = api.pageParam.id}console.log(this.data.id)}

店铺详情:​​http://showdoc.deui.cn/web/#/27?page_id=370​​

<template><view class="page"><view><a-nav-bar v-bind:title="title" left-text="返回" left-arrow @click-left="onClickLeft"@click-right="onClickRight" /></view><view><a-cell-group><a-cell title="名称"  v-bind:value="store.name" /><a-cell title="电话"  v-bind:value="store.phone" /><a-cell title="城市"  v-bind:value="store.city" /><a-cell title="地址"  v-bind:value="store.address" /><a-cell title="内容"  v-bind:value="store.content" /></a-cell-group><!-- <text text={{store.name}}></text><text text={{store.city}}></text><text text={{store.content}}></text><text text={{store.address}}></text><text text={{store.phone}}></text> --></view><view><a-button type="success">产品</a-button></view><view><a-cell-group><a-cell  v-bind:title="_item.name"  v-bind:value="_item.content" label="点击可预约" v-for="(_item,_index) in product" @click="yuyuproduct(_item)" /></a-cell-group></view></view>
</template>
<script>
import ACellGroup from "../../components/act/a-cell-group";
import ACell from "../../components/act/a-cell";
import ANavBar from "../../components/act/a-nav-bar";
import AButton from "../../components/act/a-button";
export default {name: 'detial',apiready() {//like createdif (api.pageParam.id) {this.data.id = api.pageParam.id}console.log(this.data.id)this.init()},data() {return {title: "详情",id: 1,store: {},product:[]}},methods: {init() {var _this = this;api.ajax({url: 'http://yy.deui.cn/api.php/index/searchstore',method: 'get',data: {body: {id: _this.data.id}}}, function (ret, err) {if (ret.msg == '返回成功') {console.log(1)console.log(JSON.stringify(ret.data.product))console.log(1)_this.data.store = ret.data.data[0]_this.data.product = ret.data.product} else {api.alert({ msg: JSON.stringify(err) });}});},yuyuproduct(_item){console.log(JSON.stringify(_item))},onClickLeft() {api.closeWin();},onClickRight() {}}
}
</script>
<style>
.page {height: 100%;
}
</style>

(8)导航栏组件

import ANavBar from “…/…/components/act/a-nav-bar”;

<a-nav-bar v-bind:title=“title” left-text=“返回” left-arrow @click-left=“onClickLeft”

@click-right=“onClickRight” />

注意:导航栏组件的使用,文档中的引用

import ACell from"…/…/components/act/a-nav-bar.stml";

使用中建议去掉stml后缀,import ACell from"…/…/components/act/a-nav-bar";

(9)localStorage 对象使用

main.stml里面的这个,就是用的这个对象

localStorage.setItem('uid', ret.data.data[0]['id']);

下面是localStorage的用法

// 设置存储.
sessionStorage.setItem('key', 'value');// 获取存储.
var value = sessionStorage.getItem('key');// 移除存储
sessionStorage.removeItem('key');// 清除所有存储项
sessionStorage.clear();// 获取已有存储项数
var length = sessionStorage.length;// 根据存储项索引获取存储键名
var keyName = sessionStorage.key(index);

(10)APICloud组件、模块的使用

模块中添加模块,如果是H5的需要下载后,放到自己的代码中;如果是原生的模块,需要添加到自己应用中,去require去使用。网上有专门介绍这块的教程,不清楚的可以去搜搜。

四、项目后台

这块是自己写的php后台,用的tp5框架。

tp5下的fastadmin框架,可以根据fastadmin一键生成简单后台,数据库文件为:

后台接口代码

<?phpnamespace app\api\controller;use app\common\controller\Api;
use think\Db;
/*** 首页接口*/
class Index extends Api
{protected $noNeedLogin = ['*'];protected $noNeedRight = ['*'];/*** 首页**/public function index(){$this->success('请求成功');}//注册public function re(){$username = $this->request->request("username");$password = md5($this->request->request("password"));$sql = " INSERT INTO `yuyuuser` (`id`, `group_id`, `username`, `nickname`, `password`, `salt`, `email`, `mobile`, `avatar`, `level`, `gender`, `birthday`, `bio`, `money`, `score`, `successions`, `maxsuccessions`, `prevtime`, `logintime`, `loginip`, `loginfailure`, `joinip`, `jointime`, `createtime`, `updatetime`, `token`, `status`, `verification`) VALUES (NULL, '0', '', '".$username ."', '".$password."', '', '', '', '', '0', '0', NULL, '', '0.00', '0', '1', '1', NULL, NULL, '', '0', '', NULL, NULL, NULL, '', '', '')";$rst = Db::query($sql);$data =1;$this->success('返回成功', ['data' =>  $data]);}//登录public function login(){$username = $this->request->request("username");$password = md5($this->request->request("password"));$sql = "SELECT  nickname,id FROM yuyuuser where nickname='".$username."' and password='".$password."' order by id DESC LIMIT 1";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//获取轮播图public function banner(){$sql = "SELECT * FROM `yuyubanner`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//获取网络协议public function xieyi(){$sql = "SELECT * FROM `yuyuxieyi`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//所有类型public function leixing(){$sql = " SELECT * FROM `yuyutype`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//所有店面public function stores(){$sql = "    SELECT * FROM `yuyustore`";$rst = Db::query($sql);$this->success('返回成功', ['data' =>  $rst]);}//店铺信息public function searchstore(){$id = $this->request->request("id");$sql = " SELECT * FROM `yuyustore` where id = ".$id;$sql1 = "SELECT * FROM `yuyuproduct` where store_id = ".$id;$rst = Db::query($sql);$rst1 = Db::query($sql1);$this->success('返回成功', ['data' =>  $rst,'product'=>$rst1]);}
}
查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. 2022中国低电阻微欧表市场现状研究分析与发展前景预测报告

    据QYR最新调研&#xff0c;2021年中国低电阻微欧表市场销售收入达到了 万元&#xff0c;预计2028年可以达到 万元&#xff0c;2022-2028期间年复合增长率(CAGR)为 %。中国市场核心厂商包括Megger、Seaward (GMC-Instruments)、Chauvin Arnoux、SONEL S.A.和DV Power (IBEKO Pow…...

    2024/4/14 10:19:59
  2. Java16:枚举类型

    使用enum来定义枚举类&#xff1a; enum Weekday {SUN, MON, TUE, WED, THU, FRI, SAT; //依次列出枚举的常量名 }class test {public static void main(String[] args) {Weekday day Weekday.SUN; //为枚举类型if (day Weekday.SUN) { }} }使用enum定义的枚举类是一种引用…...

    2024/4/20 14:06:36
  3. 算法Chapter1

    1. 定义 算法是一个满足下列条件的计算&#xff1a;有穷性/终止性&#xff1a;有限步内必须停止确定性&#xff1a;每一步都是严格定义和确定的动作能行性&#xff1a;每一个动作都能够被精确地机械执行输入&#xff1a;有一个满足给定约束条件的输入输出&#xff1a;满足给定约…...

    2024/4/14 14:41:13
  4. uniapp开发App调用微信授权登陆

    一键授权登陆在 微信开放平台 中创建移动应用&#xff0c;其中安卓应用签名为DCloud应用证书详情中的MD5密文&#xff08;密文需要去除冒号并转小写&#xff09; wxLogin() {let _this this;uni.getProvider({service: oauth,success: function(res) {if (~res.provider.inde…...

    2024/4/14 10:19:49
  5. 重新安装vmware-tool后可以共享文件夹的操作

    如果安装vmware后&#xff0c;共享文件夹不能使用&#xff0c;需要重新安装vmware-tool。 打开虚拟机&#xff0c;如果虚拟机里的“重装vmware-tool”按钮是灰色的&#xff0c;则&#xff0c; ① 关闭Linux系统&#xff0c;点击编辑虚拟机设置&#xff1b; ② 分别设置CD/DV…...

    2024/4/14 10:20:24
  6. [月痕]利用sax解析xml模拟spring的getbean功能

    1.创建pojo类 /** * */ package testspring.bean; /** * author 无痕菌 * */ public class Student { private int id 1; private String name "张三"; private String clazz "大四一班"; /** * return id */ p…...

    2024/4/20 8:24:31
  7. 二维数组转树结构(json)需要用到fastjson

    定义一个实体 package com.tdy.tiger.trr;import lombok.Data;import java.util.ArrayList; import java.util.List;Data public class Menu {private Integer id;//idprivate Integer pid;//父idprivate String name;//名称List<Menu> child new ArrayList<>();…...

    2024/4/5 4:41:58
  8. 记录的技术博文

    JAVA基础篇 1.String intern 解释 String的Intern方法详解 - 简单爱_wxg - 博客园...

    2024/4/30 19:23:10
  9. 【减法电路】实现0V~+5V输入-5V~+5V输出

    确定是同相放大还是反向放大&#xff1f; 减法电路分析&#xff1a;...

    2024/4/14 10:20:19
  10. iso27001认证怎么申请?(iso27001认证基本条件和详细流程)

    ISO27001认证是世界上应用最广泛与典型的信息安全管理标准&#xff0c;主要用于保障组织的信息安全&#xff0c;它是在BSI/DISC的BDD/2信息安全管理委员会指导下制定完成&#xff0c; 是现代IT企业信息安全标准的重要体现。也是信息安全管理领域迄今最为重要的标准之一。 信息…...

    2024/4/14 23:58:22
  11. 股东会特别决议的事项有哪些

    1、修改公司章程 公司章程是公司组织和行为的基本规则&#xff0c;是公司活动的依据&#xff0c;法律对其制定、内容、形式等都有明确要求&#xff0c;公司可以对公司章程进行修改&#xff0c;但必须严格按照法定程序进行&#xff0c;必须经代表2/3以上表决权的股东通过&#…...

    2024/4/25 5:11:26
  12. 2022年中国汽车和工业用激光雷达市场现状研究分析与发展前景预测报告

    据QYR最新调研&#xff0c;2021年中国汽车和工业用激光雷达市场销售收入达到了 万元&#xff0c;预计2028年可以达到 万元&#xff0c;2022-2028期间年复合增长率(CAGR)为 %。中国市场核心厂商包括法雷奥、速腾聚创、Luminar、览沃科技和Quanergy等&#xff0c;按收入计&#x…...

    2024/4/14 10:20:19
  13. 达梦7读写分离问题总结

    DM7部署读写分离、启动mount时&#xff0c;报错如下&#xff1a; 原因&#xff1a;使用DM8的方式配置DM7&#xff0c;启动时报错&#xff0c;去掉MAL_INST_DW_PORT 参数即可 同一个守护进程组&#xff0c;必须使用同一份 dmwatcher.ctl。 这里直接拷贝配置主库时已经生成的dm…...

    2024/4/19 10:29:59
  14. 函数调用、方法调用及构造函数调用

    构造函数和其它函数唯一的区别就是调用方式不同&#xff0c;但构造函数还是函数&#xff0c;不存在定义构造函数的特殊语法&#xff0c;任何函数都可以通过new操作符来调用&#xff0c;只要用new操作符来调用它就可以作构造函数;但是任何函数也可以不通过new 操作符来调用&…...

    2024/4/16 20:56:20
  15. Linux基础(更新中)

    文章目录:wind_chime:linux基础​查看是否有定时任务&#xff1a;yum源定义文件存放位置&#xff1a;将光驱挂载到/mnt/cdrom中&#xff1a;查看系统的默认运行级别&#xff1a;列出系统中所有可用的yum源&#xff1a;测试当前用户是否对/etc/passwd文件具有读写权限&#xff0…...

    2024/4/26 5:20:24
  16. 简单弹簧的应用

    上面3个图片就是对弹簧这种运动的基本应用。其实弹簧的原理很简单&#xff0c;公式就是胡克定律&#xff0c;高中的课程中有讲解&#xff0c;这里我们需要把公式转换成Unity里面具体的参数和方法。核心的原理是下面几段代码 float force 0 - _angle;_velocity _springForce *…...

    2024/4/19 20:03:24
  17. Redis(一)—— 数据类型

    Redis&#xff08;一&#xff09;—— 数据类型 文章目录Redis&#xff08;一&#xff09;—— 数据类型一、String基本操作string 类型数据的扩展操作二、Hash基本操作hash 类型数据操作的注意事项三、List基本操作拓展操作注意事项四、Set基本操作扩展操作五、sorted_set基本…...

    2024/4/14 10:20:45
  18. 宝塔更改登录端口为“六六六六”

    加油&#xff0c;新时代打工人。 根据宝塔面板的建议端口范围更改为8888~65535 那我们就改6666&#xff0c;看6不6 设置完6666后&#xff0c;我们控制台安全组中放行6666&#xff0c;回到终端&#xff0c;查看防火墙放行没 firewall-cmd --list-all若没放行&#xff0c;添加放…...

    2024/4/14 10:21:20
  19. 【Elasticsearch数据备份】

    备份ES数据的步骤&#xff1a; 1.创建共享目录&#xff1a; 何为共享仓库&#xff0c;其实就是集群中各个节点都能感知到并将数据写入到该仓库的文件。一般一个节点部署在一个服务器上&#xff0c;在哪里&#xff0c;怎样创建一个文件让各个节点都能往里面写数据呢&#xff1f…...

    2024/4/15 6:36:22
  20. WPF 获取屏幕分辨率下面的显示器名称 ModeName

    WPF 获取屏幕分辨率下面的显示器名称 由于Screen.AllScreens不能获取屏幕分辨率下面的显示器名称&#xff0c;所以要通过MyMonitor.DeviceFriendlyName转出才行。 自测&#xff1a;win7 win10 都可以获取到 foreach (var item in Screen.AllScreens) { string name MyMoni…...

    2024/4/5 4:42:12

最新文章

  1. JS 笔记9 认识JavaScript

    相关内容&#xff1a;JS对象、属性、常用事件处理过程、运算符、if...else、for、…… <script type"text/javascript"></script> type属性用来指定MIME(Multipurpose Internet Mail Extension)类型&#xff0c;主要是告诉浏览器目前使用的是哪一种Scri…...

    2024/5/5 4:56:07
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. xv6项目开源—05

    xv6项目开源—05.md 理论&#xff1a; 1、设备驱动程序在两种环境中执行代码&#xff1a;上半部分在进程的内核线程中运行&#xff0c;下半部分在中断时执行。上半部分通过系统调用进行调用&#xff0c;如希望设备执行I/O操作的read和write。这段代码可能会要求硬件执行操作&…...

    2024/5/2 2:36:53
  4. 鸿蒙OS开发实例:【应用事件打点】

    简介 传统的日志系统里汇聚了整个设备上所有程序运行的过程流水日志&#xff0c;难以识别其中的关键信息。因此&#xff0c;应用开发者需要一种数据打点机制&#xff0c;用来评估如访问数、日活、用户操作习惯以及影响用户使用的关键因素等关键信息。 HiAppEvent是在系统层面…...

    2024/5/5 2:49:33
  5. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/4 23:54:56
  6. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/4 23:54:56
  7. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  8. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/4 23:55:17
  9. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  10. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  11. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  12. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/4 23:55:16
  13. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  14. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/4 18:20:48
  15. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  16. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/4 23:55:17
  17. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/4 23:55:06
  18. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  19. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/4 23:55:06
  20. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/4 2:59:34
  21. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/4 23:55:16
  22. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  23. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/4 23:55:01
  24. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57